@deephaven/embed-widget 0.69.2-beta.2 → 0.70.0
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.
- package/build/assets/{App-7dd9d4a9.js → App-af094410.js} +2 -2
- package/build/assets/{App-7dd9d4a9.js.map → App-af094410.js.map} +1 -1
- package/build/assets/{Chart-c6b1304b.js → Chart-a80a0169.js} +2 -2
- package/build/assets/{Chart-c6b1304b.js.map → Chart-a80a0169.js.map} +1 -1
- package/build/assets/{IrisGrid-a4f4ebc6.js → IrisGrid-e6345e8d.js} +2 -2
- package/build/assets/{IrisGrid-a4f4ebc6.js.map → IrisGrid-e6345e8d.js.map} +1 -1
- package/build/assets/{IrisGridThemeProvider-005153c7.js → IrisGridThemeProvider-5b2515b0.js} +2 -2
- package/build/assets/{IrisGridThemeProvider-005153c7.js.map → IrisGridThemeProvider-5b2515b0.js.map} +1 -1
- package/build/assets/{MarkdownEditor-4b982230.js → MarkdownEditor-568e6647.js} +2 -2
- package/build/assets/{MarkdownEditor-4b982230.js.map → MarkdownEditor-568e6647.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-fd9a4017.js → MarkdownNotebook-b9d585db.js} +2 -2
- package/build/assets/{MarkdownNotebook-fd9a4017.js.map → MarkdownNotebook-b9d585db.js.map} +1 -1
- package/build/assets/Plot-d4ea1393.js +2 -0
- package/build/assets/{Plot-388bf0e3.js.map → Plot-d4ea1393.js.map} +1 -1
- package/build/assets/{Plotly-6969cf7e.js → Plotly-44e84d2b.js} +2 -2
- package/build/assets/{Plotly-6969cf7e.js.map → Plotly-44e84d2b.js.map} +1 -1
- package/build/assets/{index-02ac7b13.js → index-4a9bfe03.js} +2 -2
- package/build/assets/{index-02ac7b13.js.map → index-4a9bfe03.js.map} +1 -1
- package/build/assets/{index-dc227336.js → index-8437cfdf.js} +2 -2
- package/build/assets/{index-dc227336.js.map → index-8437cfdf.js.map} +1 -1
- package/build/assets/{index-6f8dd525.js → index-f0554a8a.js} +4 -4
- package/build/assets/{index-6f8dd525.js.map → index-f0554a8a.js.map} +1 -1
- package/build/assets/plotly-c434cf1f.js +7 -0
- package/build/assets/{plotly-581fca1a.js.map → plotly-c434cf1f.js.map} +1 -1
- package/build/assets/{useConnection-bfbe7844.js → useConnection-e32db6dc.js} +2 -2
- package/build/assets/{useConnection-bfbe7844.js.map → useConnection-e32db6dc.js.map} +1 -1
- package/build/assets/{usePlugins-2d06e38b.js → usePlugins-a4e842f0.js} +2 -2
- package/build/assets/{usePlugins-2d06e38b.js.map → usePlugins-a4e842f0.js.map} +1 -1
- package/build/index.html +2 -2
- package/package.json +14 -14
- package/build/assets/Plot-388bf0e3.js +0 -2
- package/build/assets/plotly-581fca1a.js +0 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{aZ as ff,r as b,M as Ue,D as h,a_ as vf,H as Z,a$ as pf,E as Pa,F as J,R as Ha,W as O,G as ue,b0 as ss,L as It,V as qe,b1 as gf,b2 as bf,Y as Kt,_ as Ai,b3 as Eh,b4 as Q,b5 as al,b6 as mr,b7 as Cf,b8 as ls,b9 as yf,ba as Sf,bb as wf,bc as Ef,aP as ds,aQ as Pf,bd as Ph,aS as oe,be as Gt,bf as Tf,bg as an,bh as wt,bi as Xn,bj as ol,bk as _f,bl as Si,aR as Ta,bm as Ht}from"./vendor-3c001961.js";import{T as _a,L as z,M as us,o as hs,b as cs,R as Th,U as Of,V as Df,X as Mf,Y as _h,y as If,B as Nf,D as xf,x as Ff,E as Rf,s as Lf,I as Af,m as kf,Z as jf,_ as $f,O as Hf,a as dn,h as I,r as Oh,z as Vf,$ as Uf,a0 as Er,a1 as Bf,a2 as Dh,a3 as ms,a4 as fs,n as Mh,e as Wf,a5 as xr,a6 as Gf,a7 as sl,a8 as zf,a9 as Kf,aa as qf,ab as Xf,v as ki,ac as vs,ad as Ih,c as wi,ae as Ao,af as Zf,ag as ll,ah as Nh,ai as dl,aj as xh,ak as Yf,al as Va,am as Qf,an as Jf,ao as ev,ap as tv,aq as nv,ar as rv,as as iv,at as Fh,au as av,av as Rh,aw as Lh,ax as ul,ay as ov,az as sv,aA as lv,aB as dv,aC as uv,aD as hv}from"./index-02ac7b13.js";import{P as we,a as _t,t as go,b as cv,u as Ua,T as mv,s as fv,q as hl,g as vv,C as pv,c as Yn,r as Ah,n as gv,l as bv,p as Cv}from"./usePlugins-2d06e38b.js";var Oe=Object.freeze([]),Ca=new Map,VD=()=>{};function bo(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.filter(n=>n!=null)}function ps(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=yv(r,e);t.forEach(n=>{r[n]=r[n].bind(r)})}function yv(r,e){for(var t=new Set,n=r,i=0;n!=null&&n!==Object.prototype&&(i<=1||e);){for(var a of Object.getOwnPropertyNames(n))a!=="constructor"&&typeof n[a]=="function"&&t.add(a);n=Object.getPrototypeOf(n),i+=1}return[...t.keys()]}function cl(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Sv(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){cl(a,n,i,o,s,"next",l)}function s(l){cl(a,n,i,o,s,"throw",l)}o(void 0)})}}function gs(r){return ko.apply(this,arguments)}function ko(){return ko=Sv(function*(r){var{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(r)}catch{return ml(r)}ml(r)}),ko.apply(this,arguments)}function ml(r){var e=document.activeElement,t=document.createElement("textarea");t.value=r,document.body.appendChild(t),t.focus(),t.select();var n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}function Zr(r,e,t){return e=wv(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wv(r){var e=Ev(r,"string");return typeof e=="symbol"?e:String(e)}function Ev(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Pv="table_",kh="column_",Tv=new Set(["in","not","i","ii","k"]),_v=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),Ov=/[^a-zA-Z0-9_$+@-]/g,Dv=/[^A-Za-z0-9_$]/g;class $t{}Zr($t,"legalize",(r,e,t,n,i)=>{var a=r.trim().replace(/[- ]/g,"_");return n&&(Tv.has(a)||_v.has(a))&&(a=e+a),a=a.replace(t,""),a||(a=e+i),Number.isNaN(Number(a.charAt(0)))||(a=e+a),a});Zr($t,"legalizeTableName",r=>$t.legalize(r,Pv,Ov,!1,0));Zr($t,"legalizeColumnNames",r=>{var e=[];return r.forEach((t,n)=>{var i=$t.legalizeColumnName(t,n);e.includes(i)&&(i=kh+n),e.push(i)}),e});Zr($t,"legalizeColumnName",function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return $t.legalize(r,kh,Dv,!0,e)});Zr($t,"isValidTableName",r=>$t.legalizeTableName(r)===r);Zr($t,"isValidColumnName",r=>$t.legalizeColumnName(r)===r);const jh=$t;class Te extends CustomEvent{constructor(e,t){super(e,t)}}function fl(r,e,t){return e=Mv(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mv(r){var e=Iv(r,"string");return typeof e=="symbol"?e:String(e)}function Iv(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Nv{constructor(){fl(this,"pending",[]),fl(this,"resolved",[])}add(e,t){var n=we.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}const Qn=Nv;class bs{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!bs.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var n=0;n<e.length;n+=1){var i=e[n],a=i[0],o=i[1];if(a<=t&&t<=o)return!0}return!1}static selectRange(e,t){for(var[n,i]=t,a=[...e],o=a.length-1;o>=0;o-=1){var s=a[o],l=s[0],d=s[1];if(l<=n&&i<=d)return a;n<=d&&l<=i&&(n=Math.min(n,l),i=Math.max(i,d),a.splice(o,1))}return a.push([n,i]),a}static deselectRange(e,t){for(var[n,i]=t,a=[...e],o=a.length-1;o>=0;o-=1){var s=a[o],l=s[0],d=s[1];if(!(i<l||d<n))if(l<n&&i<d){a[o]=[l,n-1],a.splice(o+1,0,[i+1,d]);break}else n<=l&&d<=i?a.splice(o,1):l<n?a[o]=[l,n-1]:a[o]=[i+1,d]}return a}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,i)=>{for(var a=[...n],o=i[0];o<=i[1];o+=1)a.push(e[o]);return a},[])}}const Sn=bs;function*UD(r,e){for(var t=r;t<=e;++t)yield t}class xv{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var n=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(n,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?n?-1:1:e>t?n?1:-1:0}}const Lt=xv;function $h(r,e,t){return e=Fv(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fv(r){var e=Rv(r,"string");return typeof e=="symbol"?e:String(e)}function Rv(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ji{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=Math.floor(e/3600),n=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(n>0||t>0?"".concat(n,"m "):"")+"".concat(e>=60?"".concat(i,"s").padStart(3,"0"):"".concat(i,"s"))}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),i=String(Math.floor(n/60)).padStart(2,"0"),a=n%60,o=String(Math.ceil(a)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(o)}static isTimeString(e){return new RegExp(ji.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error("".concat(e," is not a valid string"));var t=e.split(":");if(t.length!==3)throw new Error("".concat(e," is not a time string that can be parsed"));return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}$h(ji,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");$h(ji,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));const Hh=ji;function Lv(r,e,t){return e=Av(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Av(r){var e=kv(r,"string");return typeof e=="symbol"?e:String(e)}function kv(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class jv extends Error{constructor(){super(...arguments),Lv(this,"isInvalid",!0)}}const Ei=jv;const $v={"dh-spectrum-palette":"_dh-spectrum-palette_llwuf_1"},Hv={"dh-spectrum-alias":"_dh-spectrum-alias_1906d_1"};function vl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pl(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vl(Object(t),!0).forEach(function(n){Vv(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Vv(r,e,t){return e=Uv(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Uv(r){var e=Bv(r,"string");return typeof e=="symbol"?e:String(e)}function Bv(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var gl=pl(pl({},$v),Hv);function bl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Yi(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bl(Object(t),!0).forEach(function(n){Wv(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):bl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Wv(r,e,t){return e=Gv(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gv(r){var e=zv(r,"string");return typeof e=="symbol"?e:String(e)}function zv(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var{global:Kv,light:qv,dark:Xv,medium:Zv,large:Yv}=ff,Qv={global:Kv,light:Yi(Yi({},qv),gl),dark:Yi(Yi({},Xv),gl),medium:Zv,large:Yv};function Vh(r){var{children:e,isPortal:t=!1,theme:n=Qv,colorScheme:i}=r,[a]=b.useState(t?Ue():null);return h.jsx(vf,{UNSAFE_className:"spectrum-theme-provider",theme:n,colorScheme:i,"data-unique-id":a,children:e})}function Cl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Jv(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Cl(Object(t),!0).forEach(function(n){Ar(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Cl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ar(r,e,t){return e=ep(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ep(r){var e=tp(r,"string");return typeof e=="symbol"?e:String(e)}function tp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var yl="popper";class Cs extends b.Component{constructor(e){super(e),Ar(this,"element",void 0),Ar(this,"container",void 0),Ar(this,"rAF",void 0),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=Z.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:n}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=Jv({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var a=this.getVisibleElement(this.container.current);a==null&&(a=this.container.current),e=new pf(n||a,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t){var o=this.element.querySelector(".".concat(yl));o instanceof HTMLElement&&!o.contains(document.activeElement)&&o.focus()}}),this.setState({popper:e})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:n,interactive:i,closeOnBlur:a}=this.props,{show:o}=this.state;return h.jsx(Vh,{isPortal:!0,children:h.jsx(Pa,{in:o,timeout:n,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:h.jsx("div",{onClick:s=>{s.stopPropagation()},onKeyDown:s=>{s.key==="Escape"&&this.hide()},className:J(yl,{interactive:i},e),onBlur:a?this.handleBlur:void 0,tabIndex:a?-1:void 0,role:"presentation",children:h.jsxs("div",{className:"popper-content",children:[t,h.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return h.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Ha.createPortal(this.renderContent(),this.element)})}}Ar(Cs,"propTypes",{children:O.node.isRequired,options:O.shape({}),className:O.string,timeout:O.number,onEntered:O.func,onExited:O.func,isShown:O.bool,closeOnBlur:O.bool,interactive:O.bool,referenceObject:O.shape({}),"data-testid":O.string});Ar(Cs,"defaultProps",{options:{},className:"",timeout:_a.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const ys=Cs;function Sl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function np(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sl(Object(t),!0).forEach(function(n){Xt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Sl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Xt(r,e,t){return e=rp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rp(r){var e=ip(r,"string");return typeof e=="symbol"?e:String(e)}function ip(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ap=z.module("Tooltip");class We extends b.Component{static handleHidden(){We.shownTooltipCount-=1,We.shownTooltipCount===0&&(We.lastHiddenTime=Date.now())}static handleShown(){We.shownTooltipCount+=1}constructor(e){super(e),Xt(this,"container",void 0),Xt(this,"popper",void 0),Xt(this,"parent",void 0),Xt(this,"timer",void 0),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=Z.createRef(),this.popper=Z.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:n}=t,{isShown:i}=this.state;i!==n&&(i?We.handleShown():We.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&We.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){ap.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,n=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var a=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();t>=a.left&&t<=a.left+a.width&&n>=a.top&&n<=a.top+a.height?this.handleMouseMove():t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,n=e;(We.shownTooltipCount>0||Date.now()-We.lastHiddenTime<We.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),this.setState({isShown:!0});var{interactive:n}=this.props;n&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:n,popperClassName:i,"data-testid":a,onEntered:o}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=np({placement:"bottom"},l),h.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:h.jsx(ys,{className:J(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:e,referenceObject:n,children:h.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}Xt(We,"defaultTimeout",500);Xt(We,"defaultReshowTimeout",100);Xt(We,"triggerReshowThreshold",300);Xt(We,"shownTooltipCount",0);Xt(We,"lastHiddenTime",Date.now());Xt(We,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:We.defaultReshowTimeout,timeout:We.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const On=We;function Uh(){var r=b.useRef(!1);return b.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}function wl(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function op(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){wl(a,n,i,o,s,"next",l)}function s(l){wl(a,n,i,o,s,"throw",l)}o(void 0)})}}var sp=z.module("useAsyncInterval");function lp(r,e){var t=Uh(),n=b.useRef(0),i=b.useRef(0),a=b.useRef(null),o=b.useCallback(op(function*(){var s=Date.now();i.current+=1;var l=a.current==null?e:s-a.current;a.current=s;try{yield r()}catch(c){sp.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-a.current;var d=Math.max(0,l-e),u=Math.max(0,e-d);n.current=window.setTimeout(o,u)}}),[r,t,e]);b.useEffect(()=>(a.current=null,o(),()=>{window.clearTimeout(n.current)}),[e,o])}function dp(r){var e=b.useRef();return b.useEffect(function(){e.current=r}),e.current}function Bh(r){var e=b.useRef(null);return b.useEffect(function(){r&&(typeof r=="function"?r(e.current):r.current=e.current)}),e}var up=3500,hp=z.module("useCopyToClipboard");function cp(){var[r,e]=b.useState(!1),t=b.useRef(null),n=b.useCallback(i=>{gs(i).then(()=>{e(!0)}).catch(a=>hp.error("Unable to copy ".concat(i),`
|
|
2
|
-
`,a))},[]);return b.useEffect(()=>(t.current&&clearTimeout(t.current),r&&(t.current=setTimeout(()=>{e(!1)},up)),()=>{t.current&&clearTimeout(t.current)}),[r]),[r,n]}function Ba(r){var{children:e,className:t,style:n,"data-testid":i}=r;return h.jsx("div",{className:J("btn-group",t),style:n,role:"group","data-testid":i,children:e})}Ba.displayName="ButtonGroup";Ba.propTypes={children:O.node.isRequired,className:O.string,style:O.object,"data-testid":O.string};Ba.defaultProps={className:null,style:{},"data-testid":void 0};var mp=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function El(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Pl(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?El(Object(t),!0).forEach(function(n){fp(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):El(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function fp(r,e,t){return e=vp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vp(r){var e=pp(r,"string");return typeof e=="symbol"?e:String(e)}function pp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function gp(r,e){if(r==null)return{};var t=bp(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function bp(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}var Cp=["primary","secondary","tertiary","success","danger","inline","ghost"],yp=["group-end"];function Sp(r,e){switch(r){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return J("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function wp(r){switch(r){case"group-end":return J("pl-2","pr-3")}}var Wa=Z.forwardRef((r,e)=>{var{kind:t,variant:n,type:i,tooltip:a,icon:o,disabled:s=!1,active:l,onClick:d,onContextMenu:u,onMouseDown:c,onMouseUp:m,onMouseEnter:f,onMouseLeave:g,onKeyDown:v,className:p,style:C,children:S,tabIndex:y,"data-testid":w,"aria-label":E}=r,D=gp(r,mp),M;n&&(M=wp(n));var _;o&&(_=Z.isValidElement(o)?o:h.jsx(ue,{icon:o}));var T=_!=null&&S==null,N=Sp(t,T),x;a!==void 0&&(x=typeof a=="string"?h.jsx(On,{children:a}):a);var F=E;E===void 0&&T&&a!=null&&typeof a=="string"&&(F=a);var k=h.jsxs("button",Pl(Pl({"data-testid":w,ref:e,type:i,className:J("btn",N,M,{active:l},p),onClick:d,onContextMenu:u,onMouseUp:m,onMouseDown:c,onMouseEnter:f,onMouseLeave:g,onKeyDown:v,style:C,disabled:s,tabIndex:y,"aria-label":F},D),{},{children:[o&&_,S,a!=null&&!s&&x]}));return s&&a!=null?h.jsxs("span",{className:"btn-disabled-wrapper",children:[k,x]}):k});Wa.displayName="Button";Wa.propTypes={kind:O.oneOf(Cp).isRequired,variant:O.oneOf(yp),type:O.oneOf(["submit","reset","button"]),tooltip(r){var{tooltip:e,icon:t,children:n}=r;return e===void 0&&t!=null&&n==null?new Error("Tooltip is required for icon only buttons"):null},icon(r){var{children:e,icon:t}=r;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!Z.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:O.bool,active:O.bool,onClick(r){var{onClick:e,type:t}=r;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:O.func,onMouseUp:O.func,onMouseDown:O.func,onMouseEnter:O.func,onMouseLeave:O.func,onKeyDown:O.func,tabIndex:O.number,children:O.node,className:O.string,style:O.object,"data-testid":O.string};Wa.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const Y=Wa;function Ss(r){var{className:e="modal-footer",children:t,"data-testid":n}=r;return h.jsx("div",{className:e,"data-testid":n,children:t})}function fr(r){var{isOpen:e,headerText:t,bodyText:n,onCancel:i,onConfirm:a,onDiscard:o,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:d="Okay",discardButtonText:u="Discard",isConfirmDanger:c=!1,children:m,"data-testid":f}=r,g=b.useRef(null),v=b.useRef(null),p=b.useCallback(()=>{v.current!==null&&v.current.checked&&s&&s(),a()},[a,s]),C=b.useCallback(()=>{var y;(y=g.current)===null||y===void 0||y.focus()},[]),S="";return e&&(S=typeof n=="function"?n():n),h.jsxs(us,{isOpen:e,onOpened:C,children:[h.jsx(hs,{closeButton:!1,children:t}),h.jsx(cs,{children:S}),h.jsxs(Ss,{children:[s&&h.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[h.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:v,"data-testid":f!==void 0?"".concat(f,"-checkbox-confirm"):void 0}),h.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),o&&h.jsx(Y,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:o,"data-testid":f!==void 0?"".concat(f,"-btn-discard"):void 0,children:u}),i&&h.jsx(Y,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":f!==void 0?"".concat(f,"-btn-cancel"):void 0,children:l}),h.jsxs(Ba,{children:[h.jsx(Y,{kind:c?"danger":"primary",onClick:p,ref:g,"data-testid":f!==void 0?"".concat(f,"-btn-confirm"):void 0,children:d}),m]})]})]})}fr.propTypes={isOpen:O.bool.isRequired,headerText:O.string.isRequired,bodyText:O.oneOfType([O.string,O.func]).isRequired,onCancel:O.func,onConfirm:O.func.isRequired,onDiscard:O.func,onModalDisable:O.func,cancelButtonText:O.string,confirmButtonText:O.string,discardButtonText:O.string,children:O.node,"data-testid":O.string};fr.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};var Ga=Z.forwardRef((r,e)=>{var{children:t,className:n,disabled:i,onClick:a,style:o,id:s}=r;return h.jsx("button",{ref:e,type:"button",className:J("btn",n),onClick:a,style:o,disabled:i,id:s,children:t})});Ga.displayName="Button";Ga.propTypes={children:O.node,className:O.string,disabled:O.bool,onClick:O.func,style:O.shape({}),id:O.string};Ga.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Tl=Ga;function ws(r){var{className:e,isFlipped:t,children:n,"data-testid":i}=r,a=d=>{if(n.length!==2)throw new Error("CardFlip requires 2 children to function");return n[d]},o=b.useRef(null),s=b.useCallback(d=>{d.target===d.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=b.useCallback(d=>{d.target===d.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return b.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",s);var u=o.current;return function(){if(u!=null)return u.removeEventListener("transitionstart",s)}},[s]),h.jsxs("div",{className:J(e,{"card-flip--show-front":t,"card-flip--show-back":!t}),"data-testid":i,children:[h.jsx("div",{className:"card-flip--back",children:a(0)}),h.jsx("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:a(1)})]})}var _l=z.module("GlobalContextAction");class Ep extends b.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){var t=e;t.contextActions==null&&(t.contextActions=[]);var{action:n}=this.props;n.title==null&&!n.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(n),_l.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!_t.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var n;_l.debug("Global hotkey matched!",e),(n=t.action)===null||n===void 0||n.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}const Pp=Ep;class Tp extends b.Component{render(){for(var{actions:e,"data-testid":t}=this.props,n=[],i=0;i<e.length;i+=1){var a=e[i],{shortcut:o}=a;if(a.title!=null||a.menuElement||o){var s=h.jsx(Pp,{action:a,"data-testid":t},"".concat(a.title,".").concat(o==null?void 0:o.id));n.push(s)}}return n}}const _p=Tp;function Wh(r,e,t){return e=Op(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Op(r){var e=Dp(r,"string");return typeof e=="symbol"?e:String(e)}function Dp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Qi=z.module("ContextActions");class Gh extends b.Component{static triggerMenu(e,t,n,i){if(i.length!==0){var a=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});a.contextActions=i,e.dispatchEvent(a)}}constructor(e){super(e),Wh(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=Z.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};var t=e.actions.filter(i=>!go(i)&&typeof i!="function"&&i.isGlobal),n=e.actions.filter(i=>!go(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:n}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){var{ignoreClassNames:t=[]}=this.props;if(t.length>0)for(var n=e.target,i=function(){var{classList:d}=n,u=t.find(c=>d.contains(c));if(u!==void 0)return Qi.debug2('Contextmenu event ignored based on the target className "'.concat(u,'"')),{v:void 0};n=n.parentElement};n!=null;){var a=i();if(typeof a=="object")return a.v}if(_t.isContextActionEvent(e)||(e.contextActions=[]),!!_t.isContextActionEvent(e)){var{actions:o}=this.props;if(o!=null){var s=o;Array.isArray(s)&&(s=s.filter(l=>go(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}Qi.debug("Received context menu event! Menu items are now: ",e.contextActions)}}handleKeyDown(e){for(var{keyboardActions:t}=this.state,n=0;n<t.length;n+=1){var i=t[n];if(!_t.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var a;Qi.debug("Context hotkey matched!",e),(a=i.action)===null||a===void 0||a.call(i,e),e.stopPropagation(),e.preventDefault(),Qi.debug2("Matched hotkey returned false, key event not consumed")}}}render(){var{"data-testid":e}=this.props,{globalActions:t}=this.state;return h.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:h.jsx(_p,{actions:t})})}}Wh(Gh,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});const fe=Gh;var za=Z.forwardRef((r,e)=>{var{checked:t=!1,children:n,className:i,disabled:a,inputClassName:o,isInvalid:s,labelClassName:l,name:d,onChange:u,"data-testid":c}=r,[m]=b.useState(Ue()),f=Bh(e);b.useEffect(function(){f.current&&(f.current.indeterminate=t===null)},[f,t]);var g=b.useCallback(v=>{f.current&&(f.current.indeterminate=t===null),u&&u(v)},[f,t,u]);return h.jsxs("div",{className:J("custom-control custom-checkbox",i),children:[h.jsx("input",{type:"checkbox",ref:f,checked:t??!1,className:J("custom-control-input",o,{"is-invalid":s}),disabled:a,id:m,name:d,onChange:g,"data-testid":c}),h.jsx("label",{className:J("custom-control-label",l),htmlFor:m,children:n})]})});za.displayName="Checkbox";za.propTypes={checked:(r,e)=>{var{[e]:t}=r;return t!==null&&typeof t!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:O.node.isRequired,className:O.string,disabled:O.bool,inputClassName:O.string,isInvalid:O.bool,labelClassName:O.string,name:O.string,onChange:O.func,"data-testid":O.string};za.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Mp=za;function Bn(r,e,t){return e=Ip(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ip(r){var e=Np(r,"string");return typeof e=="symbol"?e:String(e)}function Np(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ol=z.module("Shortcut"),re;(function(r){r.CTRL="MODIFIER_CTRL",r.CMD="MODIFIER_CMD",r.ALT="MODIFIER_ALT",r.OPTION="MODIFIER_OPTION",r.SHIFT="MODIFIER_SHIFT"})(re||(re={}));var q;(function(r){r.A="A",r.B="B",r.C="C",r.D="D",r.E="E",r.F="F",r.G="G",r.H="H",r.I="I",r.J="J",r.K="K",r.L="L",r.M="M",r.N="N",r.O="O",r.P="P",r.Q="Q",r.R="R",r.S="S",r.T="T",r.U="U",r.V="V",r.W="W",r.X="X",r.Y="Y",r.Z="Z",r.ZERO="0",r.ONE="1",r.TWO="2",r.THREE="3",r.FOUR="4",r.FIVE="5",r.SIX="6",r.SEVEN="7",r.EIGHT="8",r.NINE="9",r.BACKSPACE="Backspace",r.ESCAPE="Escape",r.ENTER="Enter",r.DELETE="Delete",r.SLASH="/",r.QUESTION_MARK="?",r.BACKSLASH="\\",r.PIPE="|",r.MINUS="-",r.UNDERSCORE="_",r.EQUALS="=",r.PLUS="+",r.BACKTICK="`",r.TILDE="~",r.COMMA=",",r.LEFT_CHEVRON="<",r.PERIOD=".",r.RIGHT_CHEVRON=">",r.SEMICOLON=";",r.COLON=":",r.SINGLE_QUOTE="'",r.DOUBLE_QUOTE='"',r.LEFT_BRACKET="[",r.RIGHT_BRACKET="]",r.LEFT_CURLY="{",r.RIGHT_CURLY="}",r.F1="F1",r.F2="F2",r.F3="F3",r.F4="F4",r.F5="F5",r.F6="F6",r.F7="F7",r.F8="F8",r.F9="F9",r.F10="F10",r.F11="F11",r.F12="F12"})(q||(q={}));var xp=new Set([q.ENTER,q.DELETE,q.F1,q.F2,q.F3,q.F4,q.F5,q.F6,q.F7,q.F8,q.F9,q.F10,q.F11,q.F12]);class je extends ss{static isAllowedKey(e){return Object.values(q).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!je.isMacPlatform&&e.metaKey||!je.isAllowedKey(t))return!1;var n=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!n||xp.has(t)}static createKeyState(e){var t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case re.CTRL:t.ctrlKey=!0;break;case re.ALT:case re.OPTION:t.altKey=!0;break;case re.CMD:t.metaKey=!0;break;case re.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var{key:t,keyCode:n}=e,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!je.isAllowedKey(t)&&je.isAllowedKey(String.fromCharCode(n))?i=String.fromCharCode(n):i=t,{keyValue:i,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){var t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue===q.ESCAPE?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){var t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case q.ENTER:t+="⏎";break;case q.ESCAPE:t+="⎋";break;case q.BACKSPACE:t+="⌫";break;case q.DELETE:t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var n,i;return((n=e.keyValue)===null||n===void 0?void 0:n.toUpperCase())===((i=t.keyValue)===null||i===void 0?void 0:i.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":je.isMacPlatform?je.getMacDisplayText(e):je.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:n,macShortcut:i,isEditable:a=!0,name:o,tooltip:s}=e;super(),Bn(this,"id",void 0),Bn(this,"name",void 0),Bn(this,"tooltip",void 0),Bn(this,"isEditable",void 0),Bn(this,"defaultKeyState",void 0),Bn(this,"keyState",void 0),this.id=t,this.name=o,this.tooltip=s,this.isEditable=a;var l=je.isMacPlatform,d=l?i:n;this.defaultKeyState=je.createKeyState(d),this.keyState=this.defaultKeyState}getDisplayText(){return je.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){je.isValidKeyState(e)?(Ol.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new Te("onUpdate",{detail:this}))):Ol.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return je.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(je.NULL_KEY_STATE)}isNull(){return je.doKeyStatesMatch(this.keyState,je.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return je.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(je.getKeyStateFromEvent(e))}}Bn(je,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Bn(je,"isMacPlatform",_t.isMacPlatform());function Dl(r,e,t){return e=Fp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fp(r){var e=Rp(r,"string");return typeof e=="symbol"?e:String(e)}function Rp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ml=z.module("ShortcutRegistry");class Lp extends ss{constructor(){super(...arguments),Dl(this,"shortcutMap",new Map),Dl(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new je(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return Ml.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;Ml.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",a=>{var{detail:o}=a;return this.dispatchEvent(new Te("onUpdate",{detail:o}))});var n=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(n)){var i;(i=this.shortcutsByCategory.get(n))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(n,[e]);return e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}var Ap=Object.freeze(new Lp);const De=Ap;var kp={COPY:De.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[re.CTRL,q.C],macShortcut:[re.CMD,q.C],isEditable:!1}),PASTE:De.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[re.CTRL,q.V],macShortcut:[re.CMD,q.V],isEditable:!1}),SAVE:De.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[re.CTRL,q.S],macShortcut:[re.CMD,q.S],isEditable:!1}),SELECT_ALL:De.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[re.CTRL,q.A],macShortcut:[re.CMD,q.A],isEditable:!1}),LINKER:De.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[re.CTRL,q.L],macShortcut:[re.CMD,q.L]}),LINKER_CLOSE:De.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[q.ESCAPE],macShortcut:[q.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:De.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[re.CTRL,re.ALT,q.I],macShortcut:[re.CMD,re.SHIFT,q.I],isEditable:!0}),NEXT:De.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[q.ENTER],macShortcut:[q.ENTER],isEditable:!1}),PREVIOUS:De.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[re.SHIFT,q.ENTER],macShortcut:[re.SHIFT,q.ENTER],isEditable:!1})};const Pn=kp;function jo(r,e,t){return e=jp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jp(r){var e=$p(r,"string");return typeof e=="symbol"?e:String(e)}function $p(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class zh extends b.PureComponent{constructor(e){super(e),jo(this,"inputField",void 0),jo(this,"searchChangeSelection",void 0),this.inputField=Z.createRef(),this.searchChangeSelection=Z.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}setInputPaddingRight(){var e=this.inputField.current,t=this.searchChangeSelection.current;if(e&&t){var n=t.getBoundingClientRect().width;e.style.paddingRight="".concat(n,"px")}}render(){var{value:e,placeholder:t,onBlur:n,onChange:i,className:a,disabled:o,matchCount:s,id:l,onKeyDown:d,"data-testid":u,cursor:c}=this.props,m,f=[{action:()=>c==null?void 0:c.next("forward"),shortcut:Pn.NEXT},{action:()=>c==null?void 0:c.next("back"),shortcut:Pn.PREVIOUS}];return c&&s>1?m=h.jsxs(h.Fragment,{children:[h.jsx(Y,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("back")},icon:Th,tooltip:"Previous match (".concat(Pn.PREVIOUS.getDisplayText(),")")}),h.jsxs("span",{className:"search-change-text",children:[c.index!==void 0&&"".concat(c.index+1," of "),s]}),h.jsx(Y,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("forward")},icon:Of,tooltip:"Next match (".concat(Pn.NEXT.getDisplayText(),")")})]}):m=s>0&&h.jsx("span",{className:"search-match",children:s}),h.jsxs("div",{className:J("search-group",a),children:[h.jsx("input",{type:"search",value:e,onBlur:n,onChange:i,onKeyDown:d,className:"form-control",disabled:o,placeholder:t,ref:this.inputField,id:l,"data-testid":u}),s!=null?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:m}),h.jsx(fe,{actions:f})]}):h.jsx("span",{className:"search-icon",children:h.jsx(ue,{icon:Df})})]})}}jo(zh,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});const Es=zh;function Hp(r){var{copy:e,kind:t="ghost",tooltip:n="Copy",className:i,style:a,"data-testid":o,children:s}=r,[l,d]=cp();return h.jsx(Y,{kind:t,className:i,style:a,"data-testid":o,icon:l?Mf:_h,tooltip:l?"Copied":n,onClick:()=>{d(typeof e=="function"?e():e)},children:s})}function Il(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Vp(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Il(Object(t),!0).forEach(function(n){Pi(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Il(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Pi(r,e,t){return e=Up(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Up(r){var e=Bp(r,"string");return typeof e=="symbol"?e:String(e)}function Bp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Kh extends b.PureComponent{constructor(e){var t;super(e),Pi(this,"container",void 0),Pi(this,"oldFocus",void 0),Pi(this,"rAF",void 0),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=Z.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var{options:n}=e,i=(t=n.initialKeyboardIndex)!==null&&t!==void 0?t:-1;this.state={menuItems:[],keyboardIndex:i,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e){var{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});var{actions:e}=this.props,t=_t.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:_t.sortActions(n.menuItems.concat(t))}))}handleKeyDown(e){var{menuItems:t}=this.state,n=this.getKeyboardIndex(),i=n;if(e.key==="Enter"||e.key===" "){n!=null&&n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="Escape")i=null;else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0){var a;i=_t.getNextMenuItem((a=i)!==null&&a!==void 0?a:0,-1,t)}else if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var o;i=_t.getNextMenuItem((o=i)!==null&&o!==void 0?o:0,1,t)}n!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0))}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:n,menuItems:i,mouseIndex:a}=this.state,o=0;o<i.length;o+=1){var s=i[o];o>0&&s.group!==i[o-1].group&&e.push(h.jsx("hr",{},"".concat(o,".separator")));var l=h.jsx(cv,{isKeyboardSelected:n===o,isMouseSelected:a===o,menuItem:s,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},o);e.push(l)}var{menuStyle:d}=this.props;return h.jsx("div",{className:"context-menu-container",style:Vp({},d),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Pi(Kh,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Wp=Kh;function Nl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function xl(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Nl(Object(t),!0).forEach(function(n){Fr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Nl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Fr(r,e,t){return e=Gp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gp(r){var e=zp(r,"string");return typeof e=="symbol"?e:String(e)}function zp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class qh extends b.PureComponent{constructor(e){super(e),Fr(this,"container",void 0),Fr(this,"parent",void 0),Fr(this,"popper",void 0),Fr(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=Z.createRef(),this.parent=null,this.popper=Z.createRef(),this.isOpen=!1}componentDidMount(){var{isShown:e}=this.props;if(e===null){var t;(t=this.container.current)!==null&&t!==void 0&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick))}else e&&this.openMenu()}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===void 0||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;var{onMenuClosed:e}=this.props;e()}render(){var{actions:e,onMenuOpened:t,popperClassName:n,"data-testid":i}=this.props,{menuStyle:a}=this.props,{options:o,popperOptions:s}=this.props;return s=xl({placement:"bottom"},s),o=xl({separateKeyboardMouse:!0},o),h.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:h.jsx(ys,{ref:this.popper,options:s,className:J("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:h.jsx(Wp,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:o,menuStyle:a})})})}}Fr(qh,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});const kr=qh;function Xh(r,e,t){return e=Kp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Kp(r){var e=qp(r,"string");return typeof e=="symbol"?e:String(e)}function qp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Zh extends b.PureComponent{constructor(e){super(e),Xh(this,"searchInput",void 0),this.searchInput=Z.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=It(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var{value:t}=this.props;e.value!==t&&this.setState({value:t})}focus(){var e;(e=this.searchInput.current)===null||e===void 0||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){var{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){var{placeholder:e,className:t,matchCount:n,id:i,"data-testid":a}=this.props,{value:o}=this.state;return h.jsx(Es,{value:o,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:i,"data-testid":a})}}Xh(Zh,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const Xp=Zh;function Yh(r,e,t){return e=Zp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zp(r){var e=Yp(r,"string");return typeof e=="symbol"?e:String(e)}function Yp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Qp=z.module("ItemListItem");class Ka extends b.Component{static handleKeyDown(){return Qp.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),Yh(this,"itemRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=Z.createRef()}handleBlur(e){var{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){var{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){var{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){var{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){var{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:n,style:i,children:a,"data-testid":o}=this.props;return h.jsx("div",{className:J("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Ka.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:i,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":o,children:a})}}Yh(Ka,"defaultProps",{children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}});const Jp=Ka;function Fl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Rl(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fl(Object(t),!0).forEach(function(n){At(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Fl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function At(r,e,t){return e=eg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eg(r){var e=tg(r,"string");return typeof e=="symbol"?e:String(e)}function tg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ll=z.module("ItemList"),Al=5;class Ot extends b.PureComponent{static renderItem(e){var t,n,{item:i}=e;return h.jsx("div",{className:"item-list-item-content",children:i!=null&&((t=(n=i.displayValue)!==null&&n!==void 0?n:i.value)!==null&&t!==void 0?t:"".concat(i))})}constructor(e){super(e),At(this,"list",void 0),At(this,"listContainer",void 0),At(this,"getItemSelected",qe((i,a)=>Sn.isSelected(a,i),{max:Ot.CACHE_SIZE})),At(this,"getCachedItem",qe((i,a,o,s,l,d,u,c)=>{var m=d({item:o,itemIndex:i,isFocused:s,isSelected:l,style:u});return h.jsx(Jp,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:u,children:m},a)},{max:Ot.CACHE_SIZE})),At(this,"getOuterElement",qe(i=>{var a=Z.forwardRef((o,s)=>h.jsx("div",Rl({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},o)));return a.displayName="ItemListOuterElement",a})),At(this,"getInnerElement",qe(()=>{var i=Z.forwardRef((a,o)=>h.jsx("div",Rl({className:"item-list-inner-element",ref:o},a)));return i.displayName="ItemListInnerElement",i})),At(this,"getItemData",qe((i,a,o)=>({items:i,selectedRanges:a,renderItem:o}))),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=Z.createRef(),this.listContainer=Z.createRef();var{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var{selectedRanges:n,itemCount:i}=this.props,{focusIndex:a,isStuckToBottom:o,scrollOffset:s,height:l,selectedRanges:d}=this.state;if(o&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(s!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==d)this.setSelectedRanges(n);else if(d!==t.selectedRanges){var{onSelectionChange:u}=this.props;u(d)}if(a!==t.focusIndex){var{onFocusChange:c}=this.props;c(a)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var{scrollOffset:e}=this.state;if(e!=null){var t;(t=this.listContainer.current)===null||t===void 0||t.scrollTo(0,e)}}getElement(e){if(this.listContainer.current==null)return null;var{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,i=this.listContainer.current.querySelectorAll(t),a=e-n;return i[a]}focusItem(e){var{disableSelect:t}=this.props;if(!t){this.setState({focusIndex:e});var n=this.getElement(e);n instanceof HTMLElement&&n.focus()}}scrollToItem(e){var t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var{selectedRanges:n}=this.state,i=Sn.isSelected(n,e),a=i||_t.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,a,!1)}handleItemDoubleClick(e,t){var{isDoubleClickSelect:n,onSelect:i}=this.props;n&&this.setState(a=>{var{selectedRanges:o}=a;return{selectedRanges:Sn.selectRange(o,[e,e])}},()=>{i(e,t)})}handleItemMouseDown(e,t){var{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){Ll.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){Ll.debug2("item focus",e,t.target),this.setState(n=>{var{focusIndex:i}=n;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:n,isMultiSelect:i,disableSelect:a}=this.props,{mouseDownIndex:o,selectedRanges:s,mouseX:l,mouseY:d}=this.state;if(!(o==null||a)){var u=Math.abs(t.clientX-(l??0)),c=Math.abs(t.clientY-(d??0));u>Al&&c>Al&&this.setState({isDragging:!0}),(n||o===e)&&(this.focusItem(e),i?(!n&&!this.getItemSelected(e,s)&&!_t.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(o,e),Math.max(o,e)])):this.toggleSelect(e,t.shiftKey,_t.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:n,isDoubleClickSelect:i,onSelect:a}=this.props,{mouseDownIndex:o,isDragging:s}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(o===e&&!s){var l=t.shiftKey,d=_t.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,d,n),!i&&!l&&!d&&a(e,t)}this.resetMouseState()}}handleItemsRendered(e){var{overscanStartIndex:t}=e;this.setState({overscanStartIndex:t})}handleResize(e){var{height:t}=e;this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var{isMultiSelect:t,itemCount:n,onSelect:i}=this.props,{focusIndex:a}=this.state,o=a;if(e.key==="Enter"||e.key===" "){!t&&o!=null&&this.setState({selectedRanges:[[o,o]]},()=>{o!=null&&i(o,e)});return}if(e.key==="ArrowUp")o!=null&&o>=0?o=Math.max(0,o-1):o=n-1;else if(e.key==="ArrowDown")o!=null&&o>=0?o=Math.min(o+1,n-1):o=0;else return;if(a!==o){e.stopPropagation(),e.preventDefault(),this.focusItem(o);var{selectedRanges:s}=this.state;if(e.shiftKey&&s.length>0){var l=s[s.length-1];this.selectRange([Math.min(o,l[0]),Math.max(o,l[1])])}else if(this.deselectAll(),o!==null)this.selectItem(o);else{var d;(d=this.listContainer.current)===null||d===void 0||d.focus()}this.scrollIntoView(o)}}handleScroll(e){var{scrollUpdateWasRequested:t,scrollOffset:n}=e;this.setState(i=>{if(t)return{scrollOffset:n};var{isStickyBottom:a}=this.props,{height:o}=i,s=a&&this.isListAtBottom({scrollOffset:n,height:o});return{isStuckToBottom:s,scrollOffset:n}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){var{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,{isMultiSelect:a}=this.props,{selectedRanges:o}=this.state;if(a&&t&&o.length>0){var s=o[o.length-1];this.selectRange([Math.min(s[0],e),Math.max(e,s[1])])}else a&&o.length===1&&o[0][0]===e&&o[0][1]===e?i&&this.deselectItem(e):a&&n?this.getItemSelected(e,o)?i&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){var{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){Sn.validateRange(e),this.setState(t=>{var{selectedRanges:n}=t;return{selectedRanges:Sn.deselectRange(n,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){Sn.validateRange(e),this.setState(t=>{var{selectedRanges:n}=t;return{selectedRanges:Sn.selectRange(n,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){var{onViewportChange:n,rowHeight:i}=this.props,a=Math.floor(e/i),o=a+Math.ceil(t/i);n(a,o)}}isListAtBottom(){var{scrollOffset:e,height:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state;if(t==null||e==null)return!1;var{itemCount:n,rowHeight:i}=this.props;return e+t>=n*i}renderInnerElement(e){var{index:t,style:n}=e,{items:i,offset:a,renderItem:o,disableSelect:s}=this.props,{focusIndex:l,selectedRanges:d}=this.state;if(t<a||t>=a+i.length)return null;var u=i[t-a];return this.getCachedItem(t,t,u,t===l&&!s,this.getItemSelected(t,d),o,n,s)}render(){var{items:e,itemCount:t,overscanCount:n,renderItem:i,rowHeight:a,"data-testid":o}=this.props,{selectedRanges:s,isStuckToBottom:l}=this.state;return h.jsx(gf,{className:"item-list-auto-sizer",onResize:this.handleResize,children:d=>{var{width:u,height:c}=d;return h.jsx(bf,{className:"item-list-scroll-pane",height:c,width:u,initialScrollOffset:l?t*a:0,itemCount:t,itemSize:a,itemData:this.getItemData(e,s,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:n,"data-testid":o,children:this.renderInnerElement})}})}}At(Ot,"CACHE_SIZE",1e3);At(Ot,"DEFAULT_ROW_HEIGHT",20);At(Ot,"DEFAULT_OVERSCAN",10);At(Ot,"defaultProps",{offset:0,items:[],rowHeight:Ot.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Ot.DEFAULT_OVERSCAN,renderItem:Ot.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});function ng(r){var{on:e,id:t,className:n,isInvalid:i,disabled:a=!1,onClick:o,"data-testid":s}=r;return h.jsx("button",{type:"button",className:J("btn","btn-switch",n,{active:e},{"is-invalid":i}),id:t,onClick:o,disabled:a,"data-testid":s,children:h.jsx("div",{className:"handle"})})}function rg(r){var{children:e,disabled:t=!1,name:n,onChange:i,value:a="","data-testid":o}=r,[s]=b.useState(n??Ue());return h.jsx(h.Fragment,{children:Z.Children.map(e,l=>{var d,u;return l?Z.cloneElement(l,{name:s,onChange:(d=l.props.onChange)!==null&&d!==void 0?d:i,checked:a===l.props.value,disabled:(u=l.props.disabled)!==null&&u!==void 0?u:t,"data-testid":o}):null})})}var Ps=Z.forwardRef((r,e)=>{var{checked:t,children:n,className:i="",disabled:a=!1,inputClassName:o="",isInvalid:s=!1,labelClassName:l="",name:d,onChange:u,value:c,"data-testid":m}=r,[f]=b.useState(Ue());return h.jsxs("div",{className:J("custom-control custom-radio",i),children:[h.jsx("input",{type:"radio",id:f,"data-testid":m,name:d,ref:e,className:J("custom-control-input",o,{"is-invalid":s}),checked:t,disabled:a,value:c,onChange:u}),h.jsx("label",{className:J("custom-control-label",l),htmlFor:f,children:n})]})});Ps.displayName="RadioItem";Ps.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const kl=Ps;var ig=z.module("ThemeProvider"),Qh=b.createContext(null);function BD(r){var{themes:e,defaultPreloadValues:t=kf,children:n}=r,i=b.useMemo(()=>If(),[]),[a,o]=b.useState(null),[s,l]=b.useState(()=>{var c,m;return(c=(m=Nf())===null||m===void 0?void 0:m.themeKey)!==null&&c!==void 0?c:xf}),d=b.useMemo(()=>e==null?null:Ff(s,{base:i,custom:e??[]}),[i,s,e]),u=b.useMemo(()=>[...i,...e??[]],[i,e]);return b.useEffect(function(){if(!(d==null||e==null)){Rf(t);var m=Lf(t);ig.debug2("updateThemePreloadData:",{active:d.map(f=>f.themeKey),custom:e.map(f=>f.themeKey),preloadStyleContent:m,selectedThemeKey:s}),Af({themeKey:s,preloadStyleContent:m})}},[d,s,e,t]),b.useEffect(()=>{o({activeThemes:d,selectedThemeKey:s,themes:u,setSelectedThemeKey:l})},[d,s,u]),h.jsxs(h.Fragment,{children:[d==null?null:h.jsx(h.Fragment,{children:d.map(c=>h.jsx("style",{"data-theme-key":c.themeKey,children:c.styleContent},c.themeKey))}),a==null?null:h.jsx(Qh.Provider,{value:a,children:h.jsx(Vh,{children:n})})]})}function Jh(){return Ua(Qh,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}var ag=["children","className","onChange","data-testid"];function jl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function $l(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jl(Object(t),!0).forEach(function(n){og(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):jl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function og(r,e,t){return e=sg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sg(r){var e=lg(r,"string");return typeof e=="symbol"?e:String(e)}function lg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function dg(r,e){if(r==null)return{};var t=ug(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function ug(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}var ec=Z.forwardRef((r,e)=>{var{children:t,className:n,onChange:i,"data-testid":a}=r,o=dg(r,ag),s=Bh(e),l=b.useCallback(d=>{i(d.target.value)},[i]);return h.jsx("select",$l($l({ref:s,className:J("custom-select",n),onChange:l,"data-testid":a},o),{},{children:t}))});ec.displayName="Select";const Vr=ec;var Ts=Z.forwardRef((r,e)=>{var{children:t,className:n,disabled:i,id:a,isLinked:o,isLinkedSource:s,isInvalid:l,onClick:d,onMouseEnter:u,onMouseLeave:c,style:m,"data-testid":f}=r;return h.jsxs("button",{ref:e,type:"button",className:J("btn-socketed",{"btn-socketed-linked":o!==void 0&&o||s},{"btn-socketed-linked-source":s},{"is-invalid":l},n),id:a,onClick:d,onMouseEnter:u,onMouseLeave:c,style:m,disabled:i,"data-testid":f,children:[t,h.jsx(ue,{icon:jf,className:"linked btn-socketed-icon",transform:"down-1"}),h.jsx(ue,{icon:$f,className:"is-invalid btn-socketed-icon"})]})});Ts.displayName="SocketedButton";Ts.defaultProps={children:void 0,className:"",disabled:!1,id:void 0,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const tc=Ts;function vr(){return Ua(Hf,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function nc(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.name!=null}function rc(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.id!=null}function WD(r){return nc(r)||rc(r)}var hg=b.createContext(null);function GD(r){if(rc(r))return{id:r.id,type:r.type};if(nc(r)){var e;return{name:(e=r.name)!==null&&e!==void 0?e:"",type:r.type}}throw new Error("Invalid descriptor: ".concat(r))}function cg(r){var e,t;return{type:(e=r.type)!==null&&e!==void 0?e:"",name:(t=r.title)!==null&&t!==void 0?t:r.name,id:r.id}}function mg(){return Ua(hg,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}function _s(r,e,t){return e=fg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fg(r){var e=vg(r,"string");return typeof e=="symbol"?e:String(e)}function vg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class qa{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,n){return{label:e,formatString:t,type:n}}format(e,t){return""}}_s(qa,"TYPE_GLOBAL","type-global");_s(qa,"TYPE_CONTEXT_PRESET","type-context-preset");_s(qa,"TYPE_CONTEXT_CUSTOM","type-context-custom");const ot=qa;class pg extends ot{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const gg=pg;class bg extends ot{format(e){return String.fromCharCode(e)}}const Cg=bg;function Wn(r,e,t){return e=yg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yg(r){var e=Sg(r,"string");return typeof e=="symbol"?e:String(e)}function Sg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Hl=z.module("DateTimeColumnFormatter");class kt extends ot{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ot.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var n=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(n,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var n=kt.makeGlobalFormatStringMap(e,t);return[...n.keys()]}static makeFormatStringMap(e,t){var n=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(n,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var n=kt.makeFormatStringMap(e,t);return[...n.keys()]}constructor(e){var{timeZone:t="",showTimeZone:n=!0,showTSeparator:i=!1,defaultDateTimeFormatString:a=kt.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Wn(this,"dh",void 0),Wn(this,"dhTimeZone",void 0),Wn(this,"defaultDateTimeFormatString",void 0),Wn(this,"showTimeZone",void 0),Wn(this,"showTSeparator",void 0),Wn(this,"formatStringMap",void 0);var o=t||kt.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(o)}catch{Hl.error("Unsupported time zone id",o),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(kt.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=a,this.showTimeZone=n,this.showTSeparator=i,this.formatStringMap=kt.makeFormatStringMap(n,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(n);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{Hl.error("Invalid format arguments")}return""}}Wn(kt,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Wn(kt,"DEFAULT_TIME_ZONE_ID","America/New_York");function ln(r,e,t){return e=wg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wg(r){var e=Eg(r,"string");return typeof e=="symbol"?e:String(e)}function Eg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Pg=z.module("DecimalColumnFormatter");class ze extends ot{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ot.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:n,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;return ze.makeFormat(e,t,ot.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return ze.makeFormat("Custom Format",e,ot.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=ze.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ln(this,"defaultFormatString",void 0),ln(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(n,i)}catch{Pg.error("Invalid format arguments")}return""}}ln(ze,"DEFAULT_FORMAT_STRING","###,##0.0000");ln(ze,"FORMAT_PERCENT",ze.makePresetFormat("Percent","##0.00%"));ln(ze,"FORMAT_BASIS_POINTS",ze.makePresetFormat("Basis Points","###,##0 bp",1e4));ln(ze,"FORMAT_MILLIONS",ze.makePresetFormat("Millions","###,##0.000 mm",1e-6));ln(ze,"FORMAT_SCIENTIFIC_NOTATION",ze.makePresetFormat("Scientific Notation","0.0000E0"));ln(ze,"FORMAT_ROUND",ze.makePresetFormat("Round","###,##0"));ln(ze,"FORMAT_ROUND_TWO_DECIMALS",ze.makePresetFormat("0.00","###,##0.00"));ln(ze,"FORMAT_ROUND_FOUR_DECIMALS",ze.makePresetFormat("0.0000","###,##0.0000"));class Tg extends ot{format(e){return"".concat(e)}}const _g=Tg;function Mi(r,e,t){return e=Og(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Og(r){var e=Dg(r,"string");return typeof e=="symbol"?e:String(e)}function Dg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Mg=z.module("IntegerColumnFormatter");class sn extends ot{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ot.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:n,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;return sn.makeFormat(e,t,ot.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return sn.makeFormat("Custom Format",e,ot.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=sn.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Mi(this,"dh",void 0),Mi(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(n,i)}catch{Mg.error("Invalid format arguments")}return""}}Mi(sn,"DEFAULT_FORMAT_STRING","###,##0");Mi(sn,"FORMAT_MILLIONS",sn.makePresetFormat("Millions","###,##0.000 mm",1e-6));Mi(sn,"FORMAT_SCIENTIFIC_NOTATION",sn.makePresetFormat("Scientific Notation","0.0000E0"));class Ig extends ot{format(e){return e}}function ic(r,e,t){return e=Ng(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ng(r){var e=xg(r,"string");return typeof e=="symbol"?e:String(e)}function xg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class He{static makeDateWrapper(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,d=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var u="".concat(n).padStart(4,"0"),c="".concat(i+1).padStart(2,"0"),m="".concat(a).padStart(2,"0"),f="".concat(o).padStart(2,"0"),g="".concat(s).padStart(2,"0"),v="".concat(l).padStart(2,"0"),p="".concat(d).padStart(9,"0"),C="".concat(u,"-").concat(c,"-").concat(m," ").concat(f,":").concat(g,":").concat(v,".").concat(p);return e.i18n.DateTimeFormat.parse(He.FULL_DATE_FORMAT,C,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),n="0".repeat(9-e.length),i="".concat(t+1).concat(n);return parseInt(i,10)}static getNextDate(e,t,n,i){var{year:a,month:o,date:s,hours:l,minutes:d,seconds:u,nanos:c}=n;if(t.nanos!=null){if(t.nanos.length===9)return null;c=He.getNextNanos(t.nanos),c>999999999&&(u+=1,c=0)}else t.seconds!=null?u+=1:t.minutes!=null?d+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?o+=1:a+=1;var m=new Date(a,o,s,l,d,u);return He.makeDateWrapper(e,i,m.getFullYear(),m.getMonth(),m.getDate(),m.getHours(),m.getMinutes(),m.getSeconds(),c)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var n=e.trim().toLowerCase();if(n.length>=3){for(var i=0;i<He.months.length;i+=1)if(He.months[i].startsWith(n))return i}return NaN}static parseDateValues(e,t,n,i,a,o,s){var l=parseInt(e,10),d=t!=null?this.parseMonth(t):0,u=n!=null?parseInt(n,10):1,c=i!=null?parseInt(i,10):0,m=a!=null?parseInt(a,10):0,f=o!=null?parseInt(o,10):0,g=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(d)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(m)||Number.isNaN(f)||Number.isNaN(g)?null:{year:l,month:d,date:u,hours:c,minutes:m,seconds:f,nanos:g}}static parseDateTimeString(e){var t=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/,n=t.exec(e);if(n==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,a,,o,,s,,l,,d,,u,c]=n;if(c!=null&&c.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(c));return{year:i,month:a,date:o,hours:s,minutes:l,seconds:d,nanos:u}}static parseDateRange(e,t,n){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var a=new Date(Date.now()),o=He.makeDateWrapper(e,n,a.getFullYear(),a.getMonth(),a.getDate()),s=new Date(a.getFullYear(),a.getMonth(),a.getDate()+1),l=He.makeDateWrapper(e,n,s.getFullYear(),s.getMonth(),s.getDate());return[o,l]}if(i==="yesterday"){var d=new Date(Date.now()),u=new Date(d.getFullYear(),d.getMonth(),d.getDate()-1),c=He.makeDateWrapper(e,n,u.getFullYear(),u.getMonth(),u.getDate()),m=He.makeDateWrapper(e,n,d.getFullYear(),d.getMonth(),d.getDate());return[c,m]}if(i==="now"){var f=new Date(Date.now()),g=e.DateWrapper.ofJsDate(f);return[g,null]}var v=He.parseDateTimeString(i);if(v.year==null&&v.month==null&&v.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var p=He.parseDateValues(v.year,v.month,v.date,v.hours,v.minutes,v.seconds,v.nanos);if(p==null)throw new Error("Unable to extract date values from ".concat(v));var C=He.makeDateWrapper(e,n,p.year,p.month,p.date,p.hours,p.minutes,p.seconds,p.nanos),S=He.getNextDate(e,v,p,n);return[C,S]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}ic(He,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");ic(He,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function zD(r,e){return r===e?{operator:"notEq",value:""}:{operator:"eq",value:r}}function KD(r,e,t){return function(i){var a=t.trim();if(a==="")return null;var o=ac(e,s=>s.filter().containsIgnoreCase(r.makeFilterValue(s.type,a)),"or");return o(i)}}function ac(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var a=i==null?void 0:i.findColumns(typeof r=="string"?[r]:r);if(a==null||a.length===0)return null;var o=a.map(e);return o.reduce((s,l)=>s[t](l))}}function Fg(r,e,t,n){return ac(e,i=>i.filter()[n](r.makeFilterValue(i.type,t)),"or")}function qD(r,e,t,n,i){return function(o){var s=o==null?void 0:o.findColumn(e),l=t==="all"||n&&t.size===0;return s==null||l?null:r.makeSelectValueFilter(s,[...t.keys()],i)}}function XD(r){return function(t){return t.filter().isNull().not().and(t.filter().notEq(r.makeFilterValue(t.type,"")))}}function ZD(r,e){return function(n){var i=n.filter(),a=r.makeFilterValue(n.type,""),o=i.eq(a);return e?i.isNull().or(o):o.or(i.notEq(a))}}function Os(r,e,t){return e=Rg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rg(r){var e=Lg(r,"string");return typeof e=="symbol"?e:String(e)}function Lg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ii{}Os(Ii,"not","not");Os(Ii,"and","and");Os(Ii,"or","or");function YD(r){if(!(r==="not"||r==="and"||r==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function Re(r,e,t){return e=Ag(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ag(r){var e=kg(r,"string");return typeof e=="symbol"?e:String(e)}function kg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class L{}Re(L,"eq","eq");Re(L,"eqIgnoreCase","eqIgnoreCase");Re(L,"notEq","notEq");Re(L,"notEqIgnoreCase","notEqIgnoreCase");Re(L,"greaterThan","greaterThan");Re(L,"greaterThanOrEqualTo","greaterThanOrEqualTo");Re(L,"lessThan","lessThan");Re(L,"lessThanOrEqualTo","lessThanOrEqualTo");Re(L,"in","in");Re(L,"inIgnoreCase","inIgnoreCase");Re(L,"notIn","notIn");Re(L,"notInIgnoreCase","notInIgnoreCase");Re(L,"isTrue","isTrue");Re(L,"isFalse","isFalse");Re(L,"isNull","isNull");Re(L,"invoke","invoke");Re(L,"contains","contains");Re(L,"notContains","notContains");Re(L,"containsIgnoreCase","containsIgnoreCase");Re(L,"startsWith","startsWith");Re(L,"endsWith","endsWith");Re(L,"containsAny","containsAny");function jg(r){switch(r){case L.eq:return"is exactly";case L.eqIgnoreCase:return"is exactly (ignore case)";case L.notEq:return"is not exactly";case L.notEqIgnoreCase:return"is not exactly (ignore case)";case L.contains:return"contains";case L.notContains:return"does not contain";case L.startsWith:return"starts with";case L.endsWith:return"ends with";default:throw new Error("Unrecognized text filter type ".concat(r))}}function $g(r){switch(r){case L.eq:return"is equal to";case L.notEq:return"is not equal to";case L.greaterThan:return"greater than";case L.greaterThanOrEqualTo:return"greater than or equal to";case L.lessThan:return"less than";case L.lessThanOrEqualTo:return"less than or equal to";default:throw new Error("Unrecognized number filter type ".concat(r))}}function Hg(r){switch(r){case L.eq:return"date is";case L.notEq:return"date is not";case L.notEqIgnoreCase:case L.greaterThan:return"date is after";case L.greaterThanOrEqualTo:return"date is after or equal";case L.lessThan:return"date is before";case L.lessThanOrEqualTo:return"date is before or equal";default:throw new Error("Unrecognized date filter type ".concat(r))}}function QD(r){switch(r){case L.isTrue:return"Is True";case L.isFalse:return"Is False";case L.isNull:return"Is Null";default:throw new Error("Unrecognized boolean filter type ".concat(r))}}var Vl=z.module("ViewportDataUtils");function Vg(r,e){return String(r.offsetInSnapshot+e)}function JD(r,e){var{bulkUpdate:t}=r;return function(i){var{columns:a,offset:o,rows:s}=i.detail;Vl.debug("table updated",i.detail);var l=new Map;s.forEach(d=>{var u=e(d,a),c=Vg(d,o);l.set(c,{key:c,item:u})}),Vl.debug("update keys",l),t(l)}}function eM(r,e){return e.reduce((t,n)=>(t[n.name]=r.get(n),t),{})}function*tM(r,e){for(var t=r;t<=e;++t)yield{key:String(t)}}function Ug(r){return r==null||Bg(r)?0:r.size}function Bg(r){return"isClosed"in r?r.isClosed:!1}function nM(r,e,t,n){var i=r+e-1,[a,o]=[0,n-1],s=Kt(r-t,a,o),l=Kt(i+t,a,o);return[s,l]}function Ul(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function $n(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Ul(a,n,i,o,s,"next",l)}function s(l){Ul(a,n,i,o,s,"throw",l)}o(void 0)})}}function pr(r,e,t){return e=Wg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Wg(r){var e=Gg(r,"string");return typeof e=="symbol"?e:String(e)}function Gg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var cn=z.module("TableUtils");function rM(r){return r===P.sortDirection.ascending||r===P.sortDirection.descending||r===P.sortDirection.reverse||r===P.sortDirection.none}class P{static copyTableAndApplyFilters(e){var t=arguments;return $n(function*(){if(e==null)return null;for(var n=yield e.copy(),i=t.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=t[o];return n.applyFilter(bo(...a.map(s=>s(n)))),n})()}static getSortIndex(e,t){for(var n=0;n<e.length;n+=1){var i,a=e[n];if(((i=a.column)===null||i===void 0?void 0:i.name)===t)return n}return null}static getSortForColumn(e,t){var n=P.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return P.isBooleanType(e)?[L.isTrue,L.isFalse,L.isNull]:P.isCharType(e)||P.isNumberType(e)||P.isDateType(e)?[L.eq,L.notEq,L.greaterThan,L.greaterThanOrEqualTo,L.lessThan,L.lessThanOrEqualTo]:P.isTextType(e)?[L.eq,L.eqIgnoreCase,L.notEq,L.notEqIgnoreCase,L.contains,L.notContains,L.startsWith,L.endsWith]:[]}static getNextSort(e,t,n){if(n<0||n>=e.length)return null;var i=P.getSortForColumn(t,e[n].name);return i===null?e[n].sort().asc():i.direction===P.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,n,i){if(t<0||t>=e.length||n===P.sortDirection.none)return null;var a=e[t].sort();switch(n){case P.sortDirection.ascending:a=a.asc();break;case P.sortDirection.descending:a=a.desc();break}return i&&(a=a.abs()),a}static toggleSortForColumn(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(n<0||n>=t.length)return[];var a=P.getNextSort(t,e,n);return P.setSortForColumn(e,t[n].name,a,i)}static sortColumn(e,t,n,i,a,o){if(n<0||n>=t.length)return[];var s=P.makeColumnSort(t,n,i,a);return P.setSortForColumn(e,t[n].name,s,o)}static setSortForColumn(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=P.getSortIndex(e,t),o=[];return i&&(o=o.concat(e.filter(s=>{var{direction:l}=s;return l!==P.sortDirection.reverse})),a!==null&&o.splice(a,1)),n!==null&&o.push(n),o}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case P.dataType.BOOLEAN:return P.dataType.BOOLEAN;case"char":case"java.lang.Character":case P.dataType.CHAR:return P.dataType.CHAR;case"java.lang.String":case P.dataType.STRING:return P.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case P.dataType.DATETIME:return P.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case P.dataType.DECIMAL:return P.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case P.dataType.INT:return P.dataType.INT;default:return P.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return P.isIntegerType(e)||P.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return P.getNormalizedType(e)===P.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return we.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a,o,s=!0,l=new Promise((d,u)=>{o=setTimeout(()=>{a(),s=!1,u(new mv('Event "'.concat(t,'" timed out.')))},n),a=e.addEventListener(t,c=>{if(i!=null&&!i(c)){cn.debug2("Event triggered, but matcher returned false.");return}cn.debug2("Event triggered, resolving."),a(),clearTimeout(o),s=!1,d(c)})});return l.cancel=()=>{if(s){cn.debug2("Pending promise cleanup."),a(),clearTimeout(o),s=!1;return}cn.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e==null?void 0:e.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var n=P.removeCommas(t);if(P.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case L.eq:return"=";case L.notEq:return"!=";case L.greaterThan:return">";case L.greaterThanOrEqualTo:return">=";case L.lessThan:return"<";case L.lessThanOrEqualTo:return"<=";case L.contains:return"~";case L.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((n,i)=>{var a=n.name.toUpperCase(),o=i.name.toUpperCase();return Lt.sort(a,o,t)})}constructor(e){pr(this,"dh",void 0),this.dh=e,ps(this)}createDistinctSortedColumnTable(e,t,n){var i=arguments,a=this;return $n(function*(){if(e==null)return null;for(var o=e,s=i.length,l=new Array(s>3?s-3:0),d=3;d<s;d++)l[d-3]=i[d];l.length>0&&(o=yield e.copy(),yield o.applyFilter(bo(...l.map(f=>f(o)))));var u=o.findColumn(t),c=yield o.selectDistinct([u]);o!==e&&o.close();var m=c.findColumn(t).sort()[n]();return a.applySort(c,[m])})()}doesColumnValueExist(e,t,n,i){var a=this;return $n(function*(){if(e==null)return null;var o=Fg(a,t,n,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield a.applyFilter(s,bo(o(s)));var l=Ug(s);return s.close(),l>0})()}makeQuickFilter(e,t,n){for(var i=t.split("||"),a=null,o=0;o<i.length;o+=1){for(var s=i[o],l=s.split("&&"),d=null,u=0;u<l.length;u+=1){var c=l[u].trim();if(c.length>0){var m=this.makeQuickFilterFromComponent(e,c,n);if(m)d?d=d.and(m):d=m;else throw new Error("Unable to parse quick filter from text ".concat(t))}}a&&d?a=a.or(d):a=d}return a}makeQuickFilterFromComponent(e,t,n){var{type:i}=e;return P.isNumberType(i)?this.makeQuickNumberFilter(e,t):P.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):n!=null&&P.isDateType(i)?this.makeQuickDateFilter(e,t,n):P.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var n=e.filter(),{dh:i}=this,a=null,o=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=o.exec(t),l=null,d=null,u=null,c=null,m=null;if(s!==null&&s.length>3&&([,l,d,u,c,m]=s),m!=null&&m.trim().length>0)return null;if(l==null&&(l="="),c!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":a=n.isNull();break;case"nan":a=i.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"∞":d!=null?a=i.FilterCondition.invoke("isInf",n).and(n.lessThan(i.FilterValue.ofNumber(0))):a=i.FilterCondition.invoke("isInf",n).and(n.greaterThan(i.FilterValue.ofNumber(0)));break}return a!==null&&(l==="!"||l==="!=")&&(a=a.not()),a}if(u==null)return null;if(u=P.removeCommas(u),P.isLongType(e.type))try{u=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(d!=null?"-":"").concat(u)))}catch(f){return cn.warn("Unable to create long filter",f),null}else{if(u=parseFloat(u),u==null||Number.isNaN(u))return null;u=i.FilterValue.ofNumber(d!=null?0-u:u)}return a=e.filter(),P.makeRangeFilterWithOperation(a,l,u)}static escapeQuickTextFilter(e){var t,n;if(e==null)return null;var i=/^(!~|!=|~|=|!)?(.*)/,a=/^\\*null$/,o=i.exec(e),s=null,l=null;if(o!==null&&o.length>2&&([,s,l]=o),s!=null){var d;return"\\".concat(s).concat((d=l)!==null&&d!==void 0?d:"")}return l!=null&&a.test(l.toLowerCase())||l!=null&&l.startsWith("*")?"\\".concat(l):l!=null&&l.endsWith("*")&&!l.endsWith("\\*")?(l=l.substring(0,l.length-1),"".concat(l,"\\*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((n=l)!==null&&n!==void 0?n:"")}static unescapeQuickTextFilter(e){var t,n,i=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,a=/^\\*null$/,o=i.exec(e),s=null,l=null;return o!==null&&o.length>2&&([,s,l]=o),s!=null&&(s=s.replace("\\","")),l!=null&&a.test(l.toLowerCase())&&(l=l.replace("\\","")),s==null&&l!=null&&l.startsWith("\\*")&&(l=l.substring(1)),s==null&&l!=null&&l.endsWith("\\*")?(l=l.substring(0,l.length-2),"".concat(l,"*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((n=l)!==null&&n!==void 0?n:"")}makeQuickTextFilter(e,t){var{dh:n}=this,i="".concat(t).trim(),a=/^(!~|!=|~|=|!)?(.*)/,o=a.exec(i),s=null,l=null;if(o!==null&&o.length>2&&([,s,l]=o,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var d=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return d.isNull();case"!=":case"!":return d.isNull().not()}var u=null,c=null;switch(l.startsWith("*")?(u="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(c="*",l=l.substring(0,l.length-1)),l=P.unescapeQuickTextFilter(l),s){case"~":return d.isNull().not().and(d.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return d.isNull().or(d.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return u==="*"?d.isNull().or(d.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):c==="*"?d.isNull().or(d.invoke("matches",n.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):d.notEqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()));case"=":return u==="*"?d.isNull().not().and(d.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):c==="*"?d.isNull().not().and(d.invoke("matches",n.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):d.eqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var n=/^(!=|=|!)?(.*)/,i=n.exec("".concat(t).trim());if(i===null)return null;var[,a,o]=i,s=a==="!"||a==="!=",l=o.trim().toLowerCase(),d=e.filter();try{var u=P.makeBooleanValue(l);return u!=null&&u?d=d.isTrue():u===null?d=d.isNull():d=d.isFalse(),s?d.not():d}catch{return null}}makeQuickDateFilter(e,t,n){var i=t.trim(),a=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,o=a.exec(i);if(o==null||o.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=o;var d=L.eq;switch(s){case"<":d=L.lessThan;break;case"<=":case"=<":d=L.lessThanOrEqualTo;break;case">":d=L.greaterThan;break;case">=":case"=>":d=L.greaterThanOrEqualTo;break;case"!=":case"!":d=L.notEq;break;case"=":case"==":default:d=L.eq;break}return this.makeQuickDateFilterWithOperation(e,l,d,n)}makeQuickDateFilterWithOperation(e,t,n,i){var{dh:a}=this,[o,s]=He.parseDateRange(a,t,i),l=o!=null?a.FilterValue.ofNumber(o):null,d=s!=null?a.FilterValue.ofNumber(s):null,u=e.filter();if(l==null)return n===L.notEq?u.isNull().not():u.isNull();switch(n){case L.eq:{if(d!=null){var c=u.greaterThanOrEqualTo(l),m=u.lessThan(d);return c.and(m)}return u.eq(l)}case L.lessThan:return u.lessThan(l);case L.lessThanOrEqualTo:return d!=null?u.lessThan(d):u.lessThanOrEqualTo(l);case L.greaterThan:return d!=null?u.greaterThanOrEqualTo(d):u.greaterThan(l);case L.greaterThanOrEqualTo:return u.greaterThanOrEqualTo(l);case L.notEq:{if(d!=null){var f=u.lessThan(l),g=u.greaterThanOrEqualTo(d);return f.or(g)}return u.notEq(l)}default:throw new Error("Invalid operator: ".concat(n))}}makeQuickCharFilter(e,t){var{dh:n}=this,i="".concat(t).trim(),a=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,o=a.exec(i),s=null,l=null,d=null;if(o!==null&&o.length>3&&([,s,l,d]=o),d!=null&&d.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var u=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return u.isNull();case"!=":case"!":return u.isNull().not();default:return null}var c=n.FilterValue.ofString(P.isRangeOperation(s)?P.quoteValue(l):l);return P.makeRangeFilterWithOperation(u,s,c)}makeAdvancedFilter(e,t,n){for(var{filterItems:i,filterOperators:a,invertSelection:o,selectedValues:s}=t,l=null,d=0;d<i.length;d+=1){var u=i[d],{selectedType:c,value:m}=u;if(c!=null&&c.length>0&&m!=null&&m.length>0)try{var f=this.makeAdvancedValueFilter(e,c,m,n);if(f!=null){if(d===0)l=f;else if(l!==null&&d-1<a.length){var g=a[d-1];if(g===Ii.and)l=l.and(f);else if(g===Ii.or)l=l.or(f);else{cn.error("Unexpected filter operator",g,f),l=null;break}}}else cn.debug2("Empty filter ignored for",c,m)}catch(p){cn.error("Unable to create filter",p),l=null;break}}var v=this.makeSelectValueFilter(e,s,o);return v!=null&&(l!=null?l=l.and(v):l=v),l}makeAdvancedValueFilter(e,t,n,i){var{dh:a}=this;if(P.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,n,t,i);if(P.isNumberType(e.type)||P.isCharType(e.type))return this.makeQuickFilter(e,"".concat(P.getFilterOperatorString(t)).concat(n));var o=this.makeFilterValue(e.type,n),s=e.filter();switch(t){case L.eq:return s.eq(o);case L.eqIgnoreCase:return s.eqIgnoreCase(o);case L.notEq:return s.notEq(o);case L.notEqIgnoreCase:return s.notEqIgnoreCase(o);case L.greaterThan:return s.greaterThan(o);case L.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(o);case L.lessThan:return s.lessThan(o);case L.lessThanOrEqualTo:return s.lessThanOrEqualTo(o);case L.isTrue:return s.isTrue();case L.isFalse:return s.isFalse();case L.isNull:return s.isNull();case L.contains:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E.*"))));case L.notContains:return s.isNull().or(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E.*"))).not());case L.startsWith:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i)^\\Q".concat(n,"\\E.*"))));case L.endsWith:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E$"))));case L.in:case L.inIgnoreCase:case L.notIn:case L.notInIgnoreCase:case L.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}applyNeverFilter(e,t){var n=arguments,i=this;return $n(function*(){var a=n.length>2&&n[2]!==void 0?n[2]:P.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var o=e.findColumn(t),s=[i.makeNeverFilter(o)];return yield i.applyFilter(e,s,a),e})()}applyCustomColumns(e,t){var n=arguments,i=this;return $n(function*(){var a=n.length>2&&n[2]!==void 0?n[2]:P.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return P.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,o.Table.EVENT_CUSTOMCOLUMNSCHANGED,a)})()}applyFilter(e,t){var n=arguments,i=this;return $n(function*(){var a=n.length>2&&n[2]!==void 0?n[2]:P.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return P.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,o.Table.EVENT_FILTERCHANGED,a)})()}applySort(e,t){var n=arguments,i=this;return $n(function*(){var a=n.length>2&&n[2]!==void 0?n[2]:P.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return P.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,o.Table.EVENT_SORTCHANGED,a)})()}makeNeverFilter(e){var{dh:t}=this,n=null;P.isTextType(e.type)?n=t.FilterValue.ofString("a"):P.isBooleanType(e.type)?n=t.FilterValue.ofBoolean(!0):P.isDateType(e.type)?n=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):n=t.FilterValue.ofNumber(0);var i=e.filter().eq(n),a=e.filter().notEq(n);return i.and(a)}makeFilterValue(e,t){var{dh:n}=this,i=P.getBaseType(e);return P.isTextType(i)?n.FilterValue.ofString(t):P.isLongType(i)?n.FilterValue.ofNumber(n.LongWrapper.ofString(P.removeCommas(t))):n.FilterValue.ofNumber(P.removeCommas(t))}makeFilterRawValue(e,t){var{dh:n}=this;return P.isCharType(e)?n.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):P.isTextType(e)?n.FilterValue.ofString(t):P.isBooleanType(e)?n.FilterValue.ofBoolean(t):n.FilterValue.ofNumber(t)}makeValue(e,t,n){var{dh:i}=this;if(t==="null")return null;if(P.isTextType(e))return t;if(P.isLongType(e))return i.LongWrapper.ofString(P.removeCommas(t));if(P.isBooleanType(e))return P.makeBooleanValue(t,!0);if(P.isDateType(e)){var[a]=He.parseDateRange(i,t,n);return a}return P.isNumberType(e)?P.makeNumberValue(t):(cn.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,n){var{dh:i}=this;if(t.length===0)return n?null:this.makeNeverFilter(e);for(var a=[],o=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?o=!0:P.isTextType(e.type)?a.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):P.isBooleanType(e.type)?a.push(i.FilterValue.ofBoolean(!!l)):a.push(i.FilterValue.ofNumber(l))}return o?a.length>0?n?e.filter().isNull().not().and(e.filter().notIn(a)):e.filter().isNull().or(e.filter().in(a)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(a):e.filter().in(a)}}pr(P,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});pr(P,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});pr(P,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);pr(P,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));pr(P,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);pr(P,"executeAndWaitForEvent",function(){var r=$n(function*(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:P.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var a=P.makeCancelableTableEventPromise(t,n,i);return e(t),yield a,t});return function(e,t,n){return r.apply(this,arguments)}}());function Pr(r,e,t){return e=zg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zg(r){var e=Kg(r,"string");return typeof e=="symbol"?e:String(e)}function Kg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Zt{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,n)=>{var i=P.getNormalizedType(n.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var a=t.get(i);return a==null||a.set(n.columnName,n.format),t},new Map)}static makeColumnFormattingRule(e,t,n){return{columnType:e,columnName:t,format:n}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!0;Pr(this,"defaultColumnFormatter",void 0),Pr(this,"typeFormatterMap",void 0),Pr(this,"columnFormatMap",void 0),Pr(this,"truncateNumbersWithPound",void 0),Pr(this,"showEmptyStrings",void 0),Pr(this,"showNullStrings",void 0),this.defaultColumnFormatter=new _g,this.typeFormatterMap=new Map([[P.dataType.BOOLEAN,new gg],[P.dataType.CHAR,new Cg],[P.dataType.DATETIME,new kt(e,n)],[P.dataType.DECIMAL,new ze(e,i)],[P.dataType.INT,new sn(e,a)],[P.dataType.STRING,new Ig]]),this.columnFormatMap=Zt.makeColumnFormatMap(t),this.truncateNumbersWithPound=o,this.showEmptyStrings=s,this.showNullStrings=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=P.getNormalizedType(e);if(n!==null)return t&&!this.columnFormatMap.has(n)&&this.columnFormatMap.set(n,new Map),this.columnFormatMap.get(n)}getColumnFormat(e,t){var n,i=this.getColumnFormatMapForType(e);return(n=i==null?void 0:i.get(t))!==null&&n!==void 0?n:null}getColumnTypeFormatter(e){var t=P.getNormalizedType(e),n=this.defaultColumnFormatter;if(t){var i;n=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:n}return n}getFormattedString(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var a=this.getColumnTypeFormatter(t),o=i||this.getColumnFormat(t,n);return a.format(e,o??void 0)}get timeZone(){var e,t=this.typeFormatterMap.get(P.dataType.DATETIME);return t==null||(e=t.dhTimeZone)===null||e===void 0?void 0:e.id}}function qg(r){if(r&&r.formatter){var{formatter:e}=r;return e}}function Xg(r){return{timeZone:r==null?void 0:r.timeZone,defaultDateTimeFormatString:r==null?void 0:r.defaultDateTimeFormat,showTimeZone:r==null?void 0:r.showTimeZone,showTSeparator:r==null?void 0:r.showTSeparator}}function Zg(r,e,t){var n=r.getColumnFormat(t,e);return n!=null&&(n.type===ot.TYPE_CONTEXT_PRESET||n.type===ot.TYPE_CONTEXT_CUSTOM)}const $o={getColumnFormats:qg,getDateTimeFormatterOptions:Xg,isCustomColumnFormatDefined:Zg};function Bl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Yg(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bl(Object(t),!0).forEach(function(n){Qg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Bl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Qg(r,e,t){return e=Jg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Jg(r){var e=eb(r,"string");return typeof e=="symbol"?e:String(e)}function eb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var tb=b.lazy(()=>Ai(()=>import("./Chart-c6b1304b.js"),["./Chart-c6b1304b.js","./vendor-3c001961.js","./helpers-de833af9.js","./vendor-a4479904.css","./index-02ac7b13.js","./index-7535fde1.css","./Plotly-6969cf7e.js","./plotly-581fca1a.js","./DownsamplingError-8e6bdb73.js","./usePlugins-2d06e38b.js","./Chart-b27697ef.css"],import.meta.url));function oc(r){return h.jsx(b.Suspense,{fallback:h.jsx(dn,{}),children:h.jsx(tb,Yg({},r))})}function Wl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ji(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wl(Object(t),!0).forEach(function(n){nt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Wl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function nt(r,e,t){return e=nb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nb(r){var e=rb(r,"string");return typeof e=="symbol"?e:String(e)}function rb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ii=z.module("ChartUtils"),Gl="io.deephaven.time.DateTime",ib=36e5,ab=1e6;function ob(r){return r.asDate!==void 0}function sb(r){return r.asNumber!==void 0}function zl(r){return r.dhTimeZone!==void 0}function lb(r){return r!=null&&r.range!=null&&(r.autorange===!1||r.autorange===void 0)}function db(){var r=document.createElement("canvas"),e=r.getContext("webgl")||r.getContext("experimental-webgl");return e!=null&&e instanceof WebGLRenderingContext}var ub=db();class K{static getPlotlyErrorBars(e,t,n){var i=n.map((o,s)=>o-e[s]),a=t.map((o,s)=>e[s]-o);return{type:"data",symmetric:!1,array:i,arrayminus:a}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,n){if(n==null||n==="")return null;var i=n.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);I(a);var[,o,s,l,,d,u,c,m,f]=a,g=l.replace(",","").length,v=s.indexOf(",")>=0||l.indexOf(",")>=0,p=v?",":"",C=c!=null&&c!==""?"e":"f",S=m!==""?m:C,y=d.length+u.length,w="",E="0".concat(g).concat(p,".").concat(y).concat(w).concat(S),D=K.convertNumberPrefix(o),M=K.convertNumberPrefix(f);return{tickformat:E,tickprefix:D,ticksuffix:M,automargin:!0}}static addTickSpacing(e,t,n){var{gapBetweenMajorTicks:i}=t;if(i!=null&&i>0){var a=e||{},o=i;return n&&(o=i/ab),t.log&&(o=Math.log(o)),a.tickmode="linear",a.dtick=o,a}return e}static getSourceForAxis(e,t){for(var n=0;n<e.series.length;n+=1)for(var i=e.series[n],a=0;a<i.sources.length;a+=1){var o=i.sources[a];if(o.axis===t)return o}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,n,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:K.ORIENTATION.VERTICAL;return{type:e,mode:t,name:n,orientation:a,showlegend:i??void 0}}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error("Unrecognized shape ".concat(e))}}static getAllAxes(e){return e.charts.reduce((t,n)=>[...t,...n.axes],[])}static getAxisTypeMap(e){var t=K.getAllAxes(e);return K.groupArray(t,"type")}static getChartForSeries(e,t){for(var{charts:n}=e,i=0;i<n.length;i+=1)for(var a=n[i],o=0;o<a.series.length;o+=1)if(t===a.series[o])return a;return null}static getLayoutRanges(e){for(var t={},n=Object.keys(e).filter(s=>s.indexOf("axis")>=0),i=0;i<n.length;i+=1){var a=n[i],o=e[a];lb(o)&&(t[a]=[...o.range])}return t}static getAxisLayoutProperty(e,t){var n=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(n)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((n,i)=>{var a,o=i[t],s=(a=n.get(o))!==null&&a!==void 0?a:[];return s.push(i),n.set(o,s),n},new Map)}static normalizeColorway(e){if(e!=null){if(Array.isArray(e))return e;if(typeof e=="string")return e.split(" ");ii.warn("Unexpected colorway format: ".concat(e))}}static titleFromSettings(e){var{series:t,xAxis:n,title:i="".concat((t??[]).join(", ")," by ").concat(n)}=e;return i}constructor(e){nt(this,"dh",void 0),nt(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values()),ps(this)}getAxisFormats(e,t){for(var n=this,i=new Map,a={tickformat:null,ticksuffix:null},o=K.getAllAxes(e),s=K.groupArray(o,"type"),{charts:l}=e,d=0;d<l.length;d+=1)for(var u=l[d],c=0;c<u.series.length;c+=1)for(var m=u.series[c],{sources:f}=m,g=f.filter(S=>S.axis),v=function(){var y=g[p],{axis:w}=y,{type:E}=w,D=s.get(E);I(D);var M=D.indexOf(w),_=n.getAxisPropertyName(E);if(_!=null){var T=K.getAxisLayoutProperty(_,M);if(i.has(T))ii.debug("".concat(T," already added."));else{ii.debug("Adding ".concat(T," to axisFormats."));var N=n.getPlotlyAxisFormat(y,t);if(N===null)i.set(T,a);else{i.set(T,N);var{businessCalendar:x}=w;if(x!=null){var F=[],{businessPeriods:k,businessDays:U,holidays:H,timeZone:W}=x,X=t==null?void 0:t.getColumnTypeFormatter(Gl),le;zl(X)&&(le=X.dhTimeZone);var me=le?(W.standardOffset-le.standardOffset)/60:0;H.length>0&&F.push(...n.createRangeBreakValuesFromHolidays(H,W,le)),k.forEach(ve=>F.push({pattern:"hour",bounds:[K.periodToDecimal(ve.close)+me,K.periodToDecimal(ve.open)+me]})),U.length<n.daysOfWeek.length&&n.createBoundsFromDays(U).forEach(ve=>F.push({pattern:"day of week",bounds:ve})),N.rangebreaks=F}if(i.size===u.axes.length)return{v:i}}}}},p=0;p<g.length;p+=1){var C=v();if(typeof C=="object")return C.v}return i}getPlotlyChartType(e,t){var{dh:n}=this;switch(e){case n.plot.SeriesPlotStyle.SCATTER:case n.plot.SeriesPlotStyle.LINE:return!t&&ub?"scattergl":"scatter";case n.plot.SeriesPlotStyle.BAR:case n.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case n.plot.SeriesPlotStyle.PIE:return"pie";case n.plot.SeriesPlotStyle.TREEMAP:return"treemap";case n.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case n.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,n){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(K.MODE_LINES),(n??!0)&&a.add(K.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(K.MODE_LINES),(n??!1)&&a.add(K.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:n}=this;switch(e){case n.plot.SeriesPlotStyle.PIE:switch(t){case n.plot.SourceType.X:return"labels";case n.plot.SourceType.Y:return"values"}break;case n.plot.SeriesPlotStyle.OHLC:switch(t){case n.plot.SourceType.TIME:return"x"}break;case n.plot.SeriesPlotStyle.TREEMAP:switch(t){case n.plot.SourceType.X:return"ids";case n.plot.SourceType.Y:return"values";case n.plot.SourceType.LABEL:return"labels";case n.plot.SourceType.PARENT:return"parents";case n.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case n.plot.SourceType.X:return"x";case n.plot.SourceType.Y:return"y";case n.plot.SourceType.Z:return"z";case n.plot.SourceType.X_LOW:return"xLow";case n.plot.SourceType.X_HIGH:return"xHigh";case n.plot.SourceType.Y_LOW:return"yLow";case n.plot.SourceType.Y_HIGH:return"yHigh";case n.plot.SourceType.TIME:return"time";case n.plot.SourceType.OPEN:return"open";case n.plot.SourceType.HIGH:return"high";case n.plot.SourceType.LOW:return"low";case n.plot.SourceType.CLOSE:return"close";case n.plot.SourceType.SHAPE:return"shape";case n.plot.SourceType.SIZE:return"size";case n.plot.SourceType.LABEL:return"label";case n.plot.SourceType.COLOR:return"color";case n.plot.SourceType.PARENT:return"parent";case n.plot.SourceType.HOVER_TEXT:return"hovertext";case n.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,n,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(n=t.axis)===null||n===void 0?void 0:n.type)===i.plot.AxisType.Y?K.ORIENTATION.HORIZONTAL:K.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,{name:a,isLinesVisible:o,isShapesVisible:s,plotStyle:l,lineColor:d,shapeColor:u,sources:c,shape:m,shapeSize:f}=e,g=c.some(y=>{var w;return(w=y.axis)===null||w===void 0?void 0:w.businessCalendar}),v=this.getChartType(l,g),p=this.getPlotlyChartMode(l,o??void 0,s??void 0),C=this.getPlotlySeriesOrientation(e),S=K.makeSeriesData(v,p,a,i,C);return this.addSourcesToSeriesData(S,l,c,t),this.addStylingToSeriesData(S,l,d,u,m,f,n),S}addSourcesToSeriesData(e,t,n,i){for(var a=e,o=0;o<n.length;o+=1){var s=n[o],{axis:l,type:d}=s,u=this.getPlotlyProperty(t,d);Eh(a,u,[]);var c=l!=null?this.getAxisPropertyName(l.type):null;if(c!=null){var m=i.get(l.type);if(m){var f=m.indexOf(l),g=f>0?"".concat(f+1):"";a["".concat(c,"axis")]="".concat(c).concat(g)}}}}addStylingToSeriesData(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,{dh:l}=this,d=e;if(d.marker={line:{}},d.line={width:1},t===l.plot.SeriesPlotStyle.AREA?d.fill="tozeroy":t===l.plot.SeriesPlotStyle.STACKED_AREA?d.stackgroup="stack":t===l.plot.SeriesPlotStyle.STEP?d.line.shape="hv":t===l.plot.SeriesPlotStyle.HISTOGRAM?d.width=[]:t===l.plot.SeriesPlotStyle.PIE?d.textinfo="label+percent":t===l.plot.SeriesPlotStyle.TREEMAP&&(d.hoverinfo="text",d.textinfo="label+text",d.tiling={packing:"squarify",pad:0},d.textposition="middle center"),n!=null&&(t===l.plot.SeriesPlotStyle.BAR?d.marker.color=n:d.line.color=n),i!=null&&(d.marker.color=i),a!=null&&a.length>0)try{d.marker.symbol=K.getMarkerSymbol(a)}catch(u){ii.warn("Unable to handle shape",a,":",u)}o!=null&&(d.marker.size=o*K.DEFAULT_MARKER_SIZE),s!=null&&t!==l.plot.SeriesPlotStyle.PIE&&(d.visible=s)}getChartType(e,t){var{dh:n}=this;switch(e){case n.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(e,t)}}getAxisPropertyName(e){var{dh:t}=this;switch(e){case t.plot.AxisType.X:return"x";case t.plot.AxisType.Y:return"y";default:return null}}getAxisSide(e){var{dh:t}=this;switch(e){case t.plot.AxisPosition.BOTTOM:return"bottom";case t.plot.AxisPosition.TOP:return"top";case t.plot.AxisPosition.LEFT:return"left";case t.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(e,t,n){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=e,s=K.getAllAxes(t),l=0;l<t.charts.length;l+=1){var d=t.charts[l],u=n==null?void 0:n(d),c=this.getChartBounds(t,d,i,a);this.updateLayoutAxes(o,d.axes,s,i,a,c,u)}this.removeStaleAxes(o,s)}getChartBounds(e,t,n,i){var a,{dh:o}=this,{cols:s,rows:l}=e,{column:d,colspan:u,row:c,rowspan:m}=t,f=d+u,g=c+m,v=1/s,p=1/l,C=K.AXIS_SIZE_PX/n,S=K.AXIS_SIZE_PX/i,y={bottom:(l-g)*p+(g<l?S/2:0),top:(l-c)*p-(c>0?S/2:0),left:d*v+(d>0?C/2:0),right:f*v-(f<s?C/2:0)},w=K.groupArray(t.axes,"position"),E=(a=w.get(o.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return E.length>0&&(n>0?y.right-=(y.right-y.left)*Math.max(0,Math.min(K.LEGEND_WIDTH_PX/n,K.MAX_LEGEND_SIZE)):y.right-=(y.right-y.left)*K.DEFAULT_AXIS_SIZE),y}getPlotlyDateFormat(e,t,n){var{dh:i}=this,a=n==null?void 0: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",""),o,s=e==null?void 0:e.getColumnTypeFormatter(t);return s!=null&&zl(s)&&s.dhTimeZone!=null&&s.showTimeZone&&(o=i.i18n.DateTimeFormat.format(" z",new Date,s.dhTimeZone)),{tickformat:a,ticksuffix:o,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:n}=this,{axis:i,columnType:a}=e,{formatPattern:o}=i,s=null;return P.isDateType(a)?(s=this.getPlotlyDateFormat(t,a,o),s=K.addTickSpacing(s,i,!0)):P.isNumberType(a)&&(s=K.getPlotlyNumberFormat(t,a,o),s=K.addTickSpacing(s,i,!1)),i.formatType===n.plot.AxisFormatType.CATEGORY&&(s?s.type="category":s={type:"category",tickformat:void 0,ticksuffix:void 0}),s}updateLayoutAxes(e,t,n){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{left:0,top:0,right:1,bottom:1},s=arguments.length>6?arguments[6]:void 0,{dh:l}=this,d=i>0?Math.max(K.MIN_AXIS_SIZE,Math.min(K.AXIS_SIZE_PX/a,K.MAX_AXIS_SIZE)):K.DEFAULT_AXIS_SIZE,u=a>0?Math.max(K.MIN_AXIS_SIZE,Math.min(K.AXIS_SIZE_PX/i,K.MAX_AXIS_SIZE)):K.DEFAULT_AXIS_SIZE,c=e,m=K.groupArray(t,"position"),f=K.groupArray(t,"type"),g=[...f.keys()],v=K.groupArray(n,"type"),p=0;p<g.length;p+=1){var C=g[p],S=this.getAxisPropertyName(C);if(S!=null){var y=f.get(C),w=v.get(C),E=C===l.plot.AxisType.Y,D=E?a:i;I(y),I(w);for(var M=0;M<y.length;M+=1){var _=y[M],T=w.indexOf(_),N=K.getAxisLayoutProperty(S,T);c[N]==null&&(c[N]={});var x=c[N];if(x!=null){this.updateLayoutAxis(x,_,M,m,d,u,o);var{range:F,autorange:k}=x;if(s!=null&&F!==void 0&&(k===void 0||k===!1)){var U=s(_),[H,W]=U(F);ii.debug("Setting downsample range",D,H,W),_.range(D,H,W)}else _.range(D)}}}}}removeStaleAxes(e,t){for(var n=e,i=K.groupArray(t,"type"),a=[...i.keys()],o=0;o<a.length;o+=1){var s=a[o],l=i.get(s);I(l);var d=l.length,u=this.getAxisPropertyName(s);if(u!=null)for(var c=K.getAxisLayoutProperty(u,d);n[c]!=null;)delete n[c],d+=1,c=K.getAxisLayoutProperty(u,d)}}updateLayoutAxis(e,t,n,i,a,o,s){var l,{dh:d}=this,u=t.type===d.plot.AxisType.Y,c=u?o:a,m=e,f=(l=t.label)!==null&&l!==void 0?l:"";if(m.title!==void 0&&typeof m.title!="string"?m.title.text=f:m.title={text:f},t.log&&(m.type="log"),m.side=this.getAxisSide(t.position),n>0){var g,v;m.overlaying=(g=this.getAxisPropertyName(t.type))!==null&&g!==void 0?g:void 0;var p=(v=i.get(t.position))!==null&&v!==void 0?v:[],C=p.indexOf(t);C>0&&(m.anchor="free",t.position===d.plot.AxisPosition.RIGHT?m.position=s.right+(C-p.length+1)*c:t.position===d.plot.AxisPosition.TOP?m.position=s.top+(C-p.length+1)*c:t.position===d.plot.AxisPosition.BOTTOM?m.position=s.bottom+(p.length-C+1)*c:t.position===d.plot.AxisPosition.LEFT&&(m.position=s.left+(p.length-C+1)*c))}else if(t.type===d.plot.AxisType.X){var S=i.get(d.plot.AxisPosition.LEFT)||[],y=i.get(d.plot.AxisPosition.RIGHT)||[],w=Math.max(s.left,s.left+(S.length-1)*o),E=Math.min(s.right-(y.length-1)*o,s.right);m.domain=[w,E]}else if(t.type===d.plot.AxisType.Y){var D=i.get(d.plot.AxisPosition.BOTTOM)||[],M=i.get(d.plot.AxisPosition.TOP)||[],_=Math.max(s.bottom,s.bottom+(D.length-1)*a),T=Math.min(s.top-(M.length-1)*a,s.top);m.domain=[_,T]}}createBoundsFromDays(e){var t=e.map(o=>this.daysOfWeek.indexOf(o)),n=this.daysOfWeek.filter(o=>!e.includes(o)).map(o=>this.daysOfWeek.indexOf(o)),i=new Set;n.forEach(o=>{for(var s=o+1;s<o+this.daysOfWeek.length;s+=1){var l=s%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(o=>{for(var s=o-1;s>o-this.daysOfWeek.length;s-=1){var l=s<0?s+this.daysOfWeek.length:s;if(t.includes(l)){var d=(l+1)%7;a.push([d,o]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,n){var i=[],a=[];return e.forEach(o=>{o.businessPeriods.length>0?a.push(...this.createPartialHoliday(o,t,n)):i.push(this.createFullHoliday(o,t,n))}),[{values:i},...a]}createFullHoliday(e,t,n){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,n)}createPartialHoliday(e,t,n){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(m=>{a.push(m.open),a.push(m.close)}),a.push("24:00");for(var o=[],s=0;s<a.length;s+=2){var l=a[s],d=a[s+1];if(l!==d){var u=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,n)],c=ib*(K.periodToDecimal(d)-K.periodToDecimal(l));o.push({values:u,dvalue:c})}}return o}adjustDateForTimeZone(e,t,n){return n&&n.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,Gl,t),n):e}makeFigureSettings(e,t){var{dh:n}=this,{series:i,xAxis:a,type:o}=e,s=K.titleFromSettings(e),l={formatType:"".concat(n.plot.AxisFormatType.NUMBER),type:"".concat(n.plot.AxisType.X),position:"".concat(n.plot.AxisPosition.BOTTOM)},d={formatType:"".concat(n.plot.AxisFormatType.NUMBER),type:"".concat(n.plot.AxisType.Y),position:"".concat(n.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(n.plot.ChartType.XY),axes:[l,d],series:(i??[]).map(u=>({plotStyle:"".concat(o),name:u,dataSources:[{type:"".concat(n.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(n.plot.SourceType.Y),columnName:u,axis:d,table:t}]}))}],title:s}}unwrapValue(e,t){var{dh:n}=this;if(e!=null){if(ob(e))return n.i18n.DateTimeFormat.format(K.DATE_FORMAT,e,t);if(sb(e))return e.asNumber()}return e}wrapValue(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(P.isDateType(t)&&typeof e=="string"){var a=e,o=K.DATE_FORMAT.substr(0,e.length),s=i.i18n.DateTimeFormat.parse(o,a);if(!n)return s;var l="".concat(o," Z"),d=i.i18n.DateTimeFormat.format("Z",s,n),u=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(d)),c=i.i18n.DateTimeFormat.format("Z",u,n);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(c))}return e}makeLayoutAxis(e,t){var{dh:n}=this,i={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticks:"outside",ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}},legend:{font:{color:t.legend_color}}};return e===n.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===n.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultTemplate(e){var{error_band_line_color:t,ohlc_increasing:n,ohlc_decreasing:i,title_color:a}=e;return{data:{bar:[{marker:{line:{color:"transparent"}}}],scatter:[{error_x:{color:t},error_y:{color:t}}],ohlc:[{increasing:{line:{color:n}},decreasing:{line:{color:i}}}],pie:[{outsidetextfont:{color:a}}],treemap:[{outsidetextfont:{color:a}}]},layout:this.makeDefaultLayout(e)}}makeDefaultLayout(e){var{dh:t}=this,{paper_bgcolor:n,plot_bgcolor:i,title_color:a,coastline_color:o,land_color:s,ocean_color:l,lake_color:d,river_color:u}=e,c={paper_bgcolor:n,plot_bgcolor:i,autosize:!0,colorway:K.normalizeColorway(e==null?void 0:e.colorway),font:{family:"'Fira Sans', sans-serif",color:a},title:{font:{color:a},xanchor:"center",xref:"paper",yanchor:"top",pad:Ji({},K.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:a}},margin:Ji({},K.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(null,e)},geo:{showcoastlines:!0,showframe:!1,showland:!0,showocean:!0,showlakes:!0,showrivers:!0,bgcolor:n,coastlinecolor:o,landcolor:s,oceancolor:l,lakecolor:d,rivercolor:u}};return c.datarevision=0,c}hydrateSettings(e){var{dh:t}=this;return Ji(Ji({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}nt(K,"DEFAULT_AXIS_SIZE",.15);nt(K,"MIN_AXIS_SIZE",.025);nt(K,"MAX_AXIS_SIZE",.2);nt(K,"AXIS_SIZE_PX",75);nt(K,"LEGEND_WIDTH_PX",50);nt(K,"MAX_LEGEND_SIZE",.25);nt(K,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));nt(K,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");nt(K,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));nt(K,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));nt(K,"SUBTITLE_LINE_HEIGHT",25);nt(K,"DEFAULT_MARKER_SIZE",6);nt(K,"MODE_MARKERS","markers");nt(K,"MODE_LINES","lines");const ut=K;function ft(r,e,t){return e=hb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hb(r){var e=cb(r,"string");return typeof e=="symbol"?e:String(e)}function cb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ge{constructor(e){ft(this,"dh",void 0),ft(this,"listeners",void 0),ft(this,"formatter",void 0),ft(this,"rect",void 0),ft(this,"isDownsamplingDisabled",void 0),ft(this,"title",void 0),this.dh=e,this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(var t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(Ge.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(Ge.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(Ge.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(Ge.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(Ge.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(Ge.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(Ge.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(Ge.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(Ge.EVENT_ERROR,{detail:e}))}}ft(Ge,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");ft(Ge,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");ft(Ge,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");ft(Ge,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");ft(Ge,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");ft(Ge,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");ft(Ge,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");ft(Ge,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");ft(Ge,"EVENT_ERROR","ChartModel.EVENT_ERROR");const mb=Ge;function Kl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ql(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Kl(Object(t),!0).forEach(function(n){ke(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Kl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ke(r,e,t){return e=fb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fb(r){var e=vb(r,"string");return typeof e=="symbol"?e:String(e)}function vb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ze=z.module("FigureChartModel");class Xa extends mb{constructor(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(e),n=this,ke(this,"chartUtils",void 0),ke(this,"dh",void 0),ke(this,"figure",void 0),ke(this,"settings",void 0),ke(this,"data",void 0),ke(this,"layout",void 0),ke(this,"seriesDataMap",void 0),ke(this,"pendingSeries",void 0),ke(this,"oneClicks",void 0),ke(this,"filterColumnMap",void 0),ke(this,"lastFilter",void 0),ke(this,"isConnected",void 0),ke(this,"seriesToProcess",void 0),ke(this,"addPendingSeries",It(()=>{for(var a=ut.getAxisTypeMap(this.figure),{pendingSeries:o}=this,s=function(){var u,c=o[l],m=n.figure.charts.find(f=>f.series.includes(c));n.addSeries(c,a,(u=m==null?void 0:m.showLegend)!==null&&u!==void 0?u:null),c.subscribe()},l=0;l<o.length;l+=1)s();this.pendingSeries=[]},Xa.ADD_SERIES_DEBOUNCE)),ke(this,"getTimeZone",qe((a,o)=>{if(o!=null){var s=o.getColumnTypeFormatter(a);if(s!=null)return s.dhTimeZone}})),ke(this,"getValueTranslator",qe((a,o)=>{var s=this.getTimeZone(a,o);return l=>this.chartUtils.unwrapValue(l,s)})),ke(this,"getValueParser",qe((a,o)=>{var s=this.getTimeZone(a,o);return l=>this.chartUtils.wrapValue(l,a,s)})),ke(this,"getRangeParser",qe((a,o)=>s=>{var[l,d]=s,u=this.getValueParser(a,o);return l=u(l),d=u(d),[l,d]})),ke(this,"getAxisRangeParser",qe((a,o)=>s=>{var l=ut.getSourceForAxis(a,s);return l!=null?this.getRangeParser(l.columnType,o):d=>d})),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.dh=e,this.chartUtils=new ut(e),this.figure=t,this.settings=i,this.data=[],this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"}},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){if(this.figure.title!=null&&this.figure.title.length>0)return this.figure.title;if(this.figure.charts.length===1){var e;return(e=this.figure.charts[0].title)!==null&&e!==void 0?e:""}return""}initAllSeries(){var e=this;this.oneClicks=[],this.filterColumnMap.clear();var{charts:t}=this.figure,n=ut.getAxisTypeMap(this.figure),i=[];this.seriesToProcess=new Set;for(var a=function(){for(var m=t[o],f=0;f<m.series.length;f+=1){var g=m.series[f];i.push(g.name),e.addSeries(g,n,m.showLegend)}var{axes:v,title:p}=m;if(p!=null&&p.length>0&&(t.length>1||e.figure.title!=null)){var C=v.find(N=>N.type===e.dh.plot.AxisType.X),S=v.find(N=>N.type===e.dh.plot.AxisType.Y);if(C==null||S==null)Ze.warn("Chart title provided, but unknown how to map to the correct axes for this chart type",m);else{var y,w,E,D,M=((y=(w=n.get(C.type))===null||w===void 0?void 0:w.findIndex(N=>N===C))!==null&&y!==void 0?y:0)+1,_=((E=(D=n.get(S.type))===null||D===void 0?void 0:D.findIndex(N=>N===S))!==null&&E!==void 0?E:0)+1,T={align:"center",x:.5,y:1,yshift:17,text:p,showarrow:!1,xref:"x".concat(M," domain"),yref:"y".concat(_," domain")};e.layout.annotations==null?e.layout.annotations=[T]:e.layout.annotations.push(T)}}},o=0;o<t.length;o+=1)a();for(var s=[...this.seriesDataMap.keys()],l=s.filter(c=>i.indexOf(c)<0),d=0;d<l.length;d+=1){var u=l[d];this.seriesDataMap.delete(u)}}addSeries(e,t,n){var{dh:i}=this,a=this.chartUtils.makeSeriesDataFromSeries(e,t,ut.getSeriesVisibility(e.name,this.settings),n);if(this.seriesDataMap.set(e.name,a),this.seriesToProcess.add(e.name),this.data=[...this.seriesDataMap.values()],e.plotStyle===i.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===i.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=ut.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?n??void 0:!1,e.oneClick!=null){for(var{oneClick:o}=e,{columns:s}=o,l=0;l<s.length;l+=1)this.filterColumnMap.set(s[l].name,s[l]);this.oneClicks.push(o)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){Ze.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?this.dh.plot.DownsampleOptions.DISABLE:this.dh.plot.DownsampleOptions.DEFAULT),this.figure.errors.length>0&&(Ze.error("Errors in figure",this.figure.errors),this.fireError(this.figure.errors))}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){var{dh:e}=this;this.figure.addEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){var{dh:e}=this;this.figure.removeEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){Ze.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){Ze.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){Ze.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){Ze.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:n}=t;Ze.debug2("handleFigureUpdated",n);for(var i=0;i<n.length;i+=1){var a=n[i];Ze.debug2("handleFigureUpdated updating series",a.name);for(var{sources:o}=a,s=0;s<o.length;s+=1){var l=o[s],{columnType:d,type:u}=l,c=this.getValueTranslator(d,this.formatter),m=t.getArray(a,u,c);this.setDataArrayForSeries(a,u,m)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:f}=this;this.fireUpdate(f)}handleRequestFailed(e){Ze.error("Request failed",e),this.fireError(["".concat(e.detail)])}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){Ze.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){Ze.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;Ze.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,n;super.setTitle(e);var i=(t=(n=(e??"").match(/<br>/g))===null||n===void 0?void 0:n.length)!==null&&t!==void 0?t:0,a=ut.DEFAULT_MARGIN.t+i*ut.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=a:this.layout.margin={t:a},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=ql({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=ql({},this.layout.title.pad),this.layout.title.pad.t=ut.DEFAULT_TITLE_PADDING.t+i*ut.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,n,i;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.l)!==null&&e!==void 0?e:0)-((n=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&n!==void 0?n:0),0)}getPlotHeight(){var e,t,n,i;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.t)!==null&&e!==void 0?e:0)-((n=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&n!==void 0?n:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,n=>this.getAxisRangeParser(n,this.formatter),e,t)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,n)=>{Ze.debug("Assigning ".concat(n),this.layout[n],t);var i=this.layout[n];i!=null?Object.assign(i,t):Ze.debug("Ignoring null layout.".concat(n))})}}setDataArrayForSeries(e,t,n){var{name:i,plotStyle:a}=e,o=this.seriesDataMap.get(i),s=this.chartUtils.getPlotlyProperty(a,t);o&&Eh(o,s,n)}cleanSeries(e){var{dh:t}=this,{name:n,plotStyle:i}=e,a=this.seriesDataMap.get(n);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:o,xHigh:s}=a;if(o&&s&&o.length===s.length){for(var l=[],d=0;d<o.length;d+=1)l.push(s[d]-o[d]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:u,xLow:c,xHigh:m,y:f,yLow:g,yHigh:v}=a;c&&m&&c!==u&&(a.error_x=ut.getPlotlyErrorBars(u,c,m)),g&&v&&g!==f&&(a.error_y=ut.getPlotlyErrorBars(f,g,v))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:p,labels:C}=a;p!==void 0&&C===void 0&&(a.labels=p)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){var t=this;if(this.oneClicks.length===0){Ze.warn("Trying to set a filter, but no one click!");return}Ze.debug("setFilter",e);for(var n=function(){var o=t.oneClicks[i],{columns:s}=o,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(d=>{var u=e.get(d);t.lastFilter.get(d)!==u&&s.find(c=>c.name===d)!=null&&o.setValueForColumn(d,u)})},i=0;i<this.oneClicks.length;i+=1)n();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}}ke(Xa,"ADD_SERIES_DEBOUNCE",50);const Xl=Xa;function Zl(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Co(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Zl(a,n,i,o,s,"next",l)}function s(l){Zl(a,n,i,o,s,"throw",l)}o(void 0)})}}class Ds{static makeModelFromSettings(e,t,n){return Co(function*(){var i=yield Ds.makeFigureFromSettings(e,t,n);return new Xl(e,i,t)})()}static makeFigureFromSettings(e,t,n){return Co(function*(){var i=yield n.copy();return i.applyCustomColumns(n.customColumns),i.applyFilter(n.filter),i.applySort(n.sort),e.plot.Figure.create(new ut(e).makeFigureSettings(t,i))})()}static makeModel(e,t,n){return Co(function*(){return new Xl(e,n,t)})()}}const Ti=Ds,pb="var(--dh-color-chart-colorway)",gb="var(--dh-color-chart-grid)",bb="var(--dh-color-chart-axis-line)",Cb="var(--dh-color-chart-axis-line-zero)",Yl={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)","legend-color":"var(--dh-color-chart-legend-fg)",colorway:pb,gridcolor:gb,linecolor:bb,zerolinecolor:Cb,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)"};var Ql=z.module("ChartTheme");function yb(){var r,e=Oh(Yl);return e.colorway=Vf((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return Uf.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),Ql.debug2("Chart theme:",Yl),Ql.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"]})}function Jl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Sb(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jl(Object(t),!0).forEach(function(n){wb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Jl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function wb(r,e,t){return e=Eb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Eb(r){var e=Pb(r,"string");return typeof e=="symbol"?e:String(e)}function Pb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Tb=b.lazy(()=>Ai(()=>import("./Plot-388bf0e3.js"),["./Plot-388bf0e3.js","./Plotly-6969cf7e.js","./plotly-581fca1a.js","./helpers-de833af9.js","./vendor-3c001961.js","./vendor-a4479904.css"],import.meta.url));function _b(r){return h.jsx(b.Suspense,{fallback:h.jsx(dn,{}),children:h.jsx(Tb,Sb({},r))})}var sc=b.createContext(null);function iM(r){var{children:e}=r,{activeThemes:t}=Jh(),n=b.useMemo(yb,[t]);return h.jsx(sc.Provider,{value:n,children:e})}function ed(r){return r.setFigure!==void 0}function Ob(){return Ua(sc,"No ChartThemeContext value found.")}var lc=Object.freeze({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"},content:[]});function dc(r){return r.componentName!==void 0}function Db(r){return r.component!==void 0}var uc=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Mb=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:lc,isGLComponentConfig:dc,isReactComponentConfig:Db,itemDefaultConfig:uc},Symbol.toStringTag,{value:"Module"}));function ya(r,e,t){return e=Ib(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ib(r){var e=Nb(r,"string");return typeof e=="symbol"?e:String(e)}function Nb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ni{constructor(){ya(this,"_mSubscriptions",void 0),ya(this,"off",this.unbind),ya(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Ni.ALL_EVENT]=[]}on(e,t,n){if(typeof t!="function")throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:n})}emit(e){for(var t=this._mSubscriptions[e],n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];if(t)for(var o=0;o<t.length;o++){var s=t[o].ctx||{};try{t[o].fn.apply(s,i)}catch(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[Ni.ALL_EVENT],d=0;d<l.length;d++){var u=l[d].ctx||{};try{l[d].fn.apply(u,i)}catch(c){console.error("Error while emitting event to allEventSubs:",c)}}}unbind(e,t,n){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,a=0;a<this._mSubscriptions[e].length;a++)(!t||this._mSubscriptions[e][a].fn===t)&&(!n||n===this._mSubscriptions[e][a].ctx)&&(this._mSubscriptions[e].splice(a,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}ya(Ni,"ALL_EVENT","__all");const Yt=Ni;function Vt(r,e,t){return e=xb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xb(r){var e=Fb(r,"string");return typeof e=="symbol"?e:String(e)}function Fb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ho extends Yt{constructor(e,t,n){super(),Vt(this,"width",void 0),Vt(this,"height",void 0),Vt(this,"title",void 0),Vt(this,"parent",void 0),Vt(this,"layoutManager",void 0),Vt(this,"tab",void 0),Vt(this,"_config",void 0),Vt(this,"isHidden",!1),Vt(this,"beforeCloseHandler",void 0),Vt(this,"_element",Q(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),Vt(this,"_contentElement",void 0),this.title=dc(e)?e.componentName:"",this.parent=t,this.layoutManager=n,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var n,i,a,o=this.parent,s=null;o&&!o.isColumn&&!o.isRow;){var l;if(s=o,o=o.parent,(l=o)!==null&&l!==void 0&&l.isRoot)return!1}if(!o||!s)return!1;for(var d=o.isColumn?"height":"width",u=d==="height"?t:e,c=((n=this[d])!==null&&n!==void 0?n:0)*(1/(((i=s.config[d])!==null&&i!==void 0?i:0)/100)),m=u/c*100,f=(((a=s.config[d])!==null&&a!==void 0?a:0)-m)/(o.contentItems.length-1),g=0;g<o.contentItems.length;g++)if(o.contentItems[g]===s)o.contentItems[g].config[d]=m;else{var v;o.contentItems[g].config[d]=((v=o.contentItems[g].config[d])!==null&&v!==void 0?v:0)+f}return o.callDownwards("setSize"),!0}close(e){var t,n;this._config.isClosable&&(!((t=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}extendState(e){this.setState(Q.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var n=this._contentElement[0],i=n.offsetWidth-n.clientWidth,a=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-a),this.emit("resize")}}}const Rb=Object.freeze(Object.defineProperty({__proto__:null,Container:Ho,ItemContainer:Ho},Symbol.toStringTag,{value:"Module"}));function hc(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function cc(r){if(window.location.hash)return hc(r);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},n,i;for(i=0;i<e.length;i++)n=e[i].split("="),t[n[0]]=n[1];return t[r]||null}function Ms(r){return window.requestAnimationFrame(r)}function Lb(r,e){var t=e.indexOf(r);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Is(){return(Math.random()*1e15).toString(36).replace(".","")}function Ab(r,e){var t=r.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return e===!0?t:t.replace(/>/g,">").replace(/</g,"<")}function Ns(r){return Q.trim(r.replace(/(<([^>]+)>)/gi,""))}function Ct(r,e,t){return e=kb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kb(r){var e=jb(r,"string");return typeof e=="symbol"?e:String(e)}function jb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class $b extends Yt{constructor(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),Ct(this,"_eElement",void 0),Ct(this,"_oDocument",void 0),Ct(this,"_eBody",void 0),Ct(this,"_destroyAfterMouseUp",void 0),Ct(this,"_nDelay",400),Ct(this,"_timeout",void 0),Ct(this,"timeout",void 0),Ct(this,"_nDistance",10),Ct(this,"_nX",0),Ct(this,"_nY",0),Ct(this,"_nOriginalX",0),Ct(this,"_nOriginalY",0),Ct(this,"_bDragging",!1),this._eElement=e,this._oDocument=Q(document),this._eBody=Q(document.body),this._destroyAfterMouseUp=n,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(t=this._eElement)===null||t===void 0||t.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,n,i,a,o=this._getCoordinates(e);this._nOriginalX=(t=o.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=o.y)!==null&&n!==void 0?n:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(a=this._oDocument)===null||a===void 0||a.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,n;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((n=i.y)!==null&&n!==void 0?n:0)-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,e)}}onMouseUp(e){if(this._timeout!=null){var t,n,i,a,o;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(n=this._oDocument)===null||n===void 0||n.unbind("mouseup",this.onMouseUp),(i=this._oDocument)===null||i===void 0||(a=i.find("iframe"))===null||a===void 0||a.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(o=this._eBody)===null||o===void 0||o.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,n,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(n=this._oDocument)===null||n===void 0||(i=n.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,n;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(n=e.pageY)!==null&&n!==void 0?n:0}}}const $i=$b;function Tr(r,e,t){return e=Hb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hb(r){var e=Vb(r,"string");return typeof e=="symbol"?e:String(e)}function Vb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class mc{constructor(e,t){Tr(this,"_container",void 0),Tr(this,"_reactComponent",null),Tr(this,"_portalComponent",null),Tr(this,"_originalComponentWillUpdate",null),Tr(this,"_initialState",void 0),Tr(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Ha.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var n;this._container.setState(t),(n=this._originalComponentWillUpdate)===null||n===void 0||n.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=Q.extend(e,this._container._config.props);return Z.createElement(this._reactClass,t)}}var Oa=["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"],Ub=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function xs(r){if(Oa.length>36)throw new Error("Too many keys in config minifier map");var e={};return Fs(r,e,"_min"),e}function Vo(r){if(Oa.length>36)throw new Error("Too many keys in config minifier map");var e={};return Fs(r,e,"_max"),e}function Fs(r,e,t){var n=t==="_min"?Bb:Wb;for(var i in r)if(r.hasOwnProperty(i)){var a=Array.isArray(r)?r[Number.parseInt(i,10)]:r[i];if(typeof a=="object"&&a!=null){var o=a instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=o;else{var s=n(i,Oa);e[s]=o}Fs(a,o,t)}else{var l=n(a,Ub);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=n(i,Oa);e[d]=l}}}}function Bb(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function Wb(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function yo(r,e,t){return e=Gb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gb(r){var e=zb(r,"string");return typeof e=="symbol"?e:String(e)}function zb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Uo{constructor(e,t){yo(this,"name",void 0),yo(this,"origin",void 0),yo(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function ea(r,e,t){return e=Kb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Kb(r){var e=qb(r,"string");return typeof e=="symbol"?e:String(e)}function qb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}let Xb=class extends Yt{constructor(e){super(),ea(this,"_layoutManager",void 0),ea(this,"_dontPropagateToParent",void 0),ea(this,"_childEventSource",void 0),ea(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Yt.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),Q(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var t,n="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(n,!0,!0),i.eventName=n,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var n=this._layoutManager.openPopouts[t].getGlInstance();n&&n!==this._childEventSource&&n.eventHub._$onEventFromParent(e)}}destroy(){Q(window).off("gl_child_event",this._boundOnEventFromChild)}};const fc=Xb,Zb=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:Uo,DragListener:$i,EventEmitter:Yt,EventHub:fc,ReactComponentHandler:mc,animFrame:Ms,filterXss:Ab,getHashValue:hc,getQueryStringParam:cc,getUniqueId:Is,minifyConfig:xs,removeFromArray:Lb,stripTags:Ns,unminifyConfig:Vo},Symbol.toStringTag,{value:"Module"}));function Nn(r,e,t){return e=Yb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Yb(r){var e=Qb(r,"string");return typeof e=="symbol"?e:String(e)}function Qb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class vc extends Yt{constructor(e,t,n,i,a){super(),Nn(this,"isInitialised",!1),Nn(this,"_config",void 0),Nn(this,"_dimensions",void 0),Nn(this,"_parentId",void 0),Nn(this,"_indexInParent",void 0),Nn(this,"_layoutManager",void 0),Nn(this,"_popoutWindow",null),Nn(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=i,this._layoutManager=a,this._createWindow()}toConfig(){var e,t,n,i,a,o,s,l,d,u,c;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(n=(i=(a=this._popoutWindow)===null||a===void 0?void 0:a.screenX)!==null&&i!==void 0?i:(o=this._popoutWindow)===null||o===void 0?void 0:o.screenLeft)!==null&&n!==void 0?n:0,top:(s=(l=(d=this._popoutWindow)===null||d===void 0?void 0:d.screenY)!==null&&l!==void 0?l:(u=this._popoutWindow)===null||u===void 0?void 0:u.screenTop)!==null&&s!==void 0?s:0},content:(c=this.getGlInstance())===null||c===void 0?void 0:c.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,n=null;if(this._parentId){var i;if(t=Q.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],n=this._layoutManager.root.getItemsById(this._parentId)[0],!n){var a;((a=this._layoutManager.root.contentItems.length)!==null&&a!==void 0?a:0)>0?n=this._layoutManager.root.contentItems[0]:n=this._layoutManager.root}}t&&((e=n)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),n=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(e,t,n),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;Q(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var a=window.setInterval(()=>{var o;(o=this._popoutWindow)!==null&&o!==void 0&&o.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(a))},10)}_serializeWindowOptions(e){var t=[],n;for(n in e)t.push(n+"="+e[n]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Is();e=xs(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var n=document.location.href.split("?");return n.length===1?n[0]+"?gl-window="+t:document.location.href+"&gl-window="+t}_positionWindow(){var e,t;(e=this._popoutWindow)===null||e===void 0||e.moveTo(this._dimensions.left,this._dimensions.top),(t=this._popoutWindow)===null||t===void 0||t.focus()}_onInitialised(){var e;this.isInitialised=!0,(e=this.getGlInstance())===null||e===void 0||e.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function Qe(r,e,t){return e=Jb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Jb(r){var e=eC(r,"string");return typeof e=="symbol"?e:String(e)}function eC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class gr extends Yt{constructor(e,t,n,i,a,o){var s,l,d,u,c,m,f,g;if(super(),Qe(this,"_dragListener",void 0),Qe(this,"_layoutManager",void 0),Qe(this,"_contentItem",void 0),Qe(this,"_originalParent",void 0),Qe(this,"_area",null),Qe(this,"_lastValidArea",null),Qe(this,"_minX",void 0),Qe(this,"_maxX",void 0),Qe(this,"_minY",void 0),Qe(this,"_maxY",void 0),Qe(this,"_width",void 0),Qe(this,"_height",void 0),Qe(this,"_sided",void 0),Qe(this,"element",void 0),Qe(this,"childElementContainer",void 0),Qe(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=i,this._contentItem=a,this._originalParent=o,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var v,p;this._layoutManager.tabDropPlaceholder.width((v=this._contentItem.tab.element.outerWidth(!0))!==null&&v!==void 0?v:0),this._layoutManager.tabDropPlaceholder.height((p=this._contentItem.tab.element.outerHeight(!0))!==null&&p!==void 0?p:0)}if(this.element=Q(gr._template),o&&o._side&&(this._sided=o._sided,this.element.addClass("lm_"+o._side),["right","bottom"].indexOf(o._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",Ns((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),this.element.find(".lm_title").html((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(a.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),Q(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var C,S;this._layoutManager.tabDropPlaceholder.width((C=this._proxyTab.outerWidth(!0))!==null&&C!==void 0?C:0),this._layoutManager.tabDropPlaceholder.height((S=this._proxyTab.outerHeight(!0))!==null&&S!==void 0?S:0)}var y=this._layoutManager.container.offset();this._minX=(d=y==null?void 0:y.left)!==null&&d!==void 0?d:0,this._minY=(u=y==null?void 0:y.top)!==null&&u!==void 0?u:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((m=this._layoutManager.container.height())!==null&&m!==void 0?m:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(g=this.element.height())!==null&&g!==void 0?g:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,n){var i,a,o=(i=n.pageX)!==null&&i!==void 0?i:0,s=(a=n.pageY)!==null&&a!==void 0?a:0,l=o>this._minX&&o<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(o,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.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(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,n=e.dragProxyHeight;this.element.width(t),this.element.height(n),t-=this._sided?e.headerHeight:0,n-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(n),this._contentItem.element.width(t),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Qe(gr,"_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>');function ta(r,e,t){return e=tC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tC(r){var e=nC(r,"string");return typeof e=="symbol"?e:String(e)}function nC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class pc{constructor(e,t,n){ta(this,"_element",void 0),ta(this,"_itemConfig",void 0),ta(this,"_layoutManager",void 0),ta(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new $i(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(Q.extend(!0,{},n));new gr(e,t,this._dragListener,this._layoutManager,i,null)}}function na(r,e,t){return e=rC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rC(r){var e=iC(r,"string");return typeof e=="symbol"?e:String(e)}function iC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class gc{constructor(e,t,n){na(this,"_element",Q(window)),na(this,"_itemConfig",void 0),na(this,"_layoutManager",void 0),na(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(n)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new $i(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(Q.extend(!0,{},n));new gr(e,t,this._dragListener,this._layoutManager,i,null)}}}function bc(r,e,t){return e=aC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function aC(r){var e=oC(r,"string");return typeof e=="symbol"?e:String(e)}function oC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Hi{constructor(){bc(this,"element",Q(Hi._template)),Q(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(e){this.element.css({left:e.x1,top:e.y1,width:Math.floor(e.x2-e.x1),height:Math.floor(e.y2-e.y1)}).show()}hide(){this.element.hide()}}bc(Hi,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function So(r,e,t){return e=sC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sC(r){var e=lC(r,"string");return typeof e=="symbol"?e:String(e)}function lC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class fi{constructor(e,t,n,i){So(this,"element",void 0),So(this,"_header",void 0),So(this,"_action",void 0),this._header=e,this.element=Q('<li class="'+n+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function dC(r,e,t){return e=uC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uC(r){var e=hC(r,"string");return typeof e=="symbol"?e:String(e)}function hC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class cC extends Error{constructor(e,t){super(),dC(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const dr=cC,mC=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:dr},Symbol.toStringTag,{value:"Module"}));function Xe(r,e,t){return e=fC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fC(r){var e=vC(r,"string");return typeof e=="symbol"?e:String(e)}function vC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function xi(r){return r.isStack}function Et(r){return r.isComponent}function Cc(r){return r.isRoot}class tt extends Yt{constructor(e,t,n,i){super(),Xe(this,"config",void 0),Xe(this,"type",void 0),Xe(this,"contentItems",void 0),Xe(this,"parent",void 0),Xe(this,"layoutManager",void 0),Xe(this,"element",void 0),Xe(this,"childElementContainer",void 0),Xe(this,"componentName",void 0),Xe(this,"isInitialised",!1),Xe(this,"isMaximised",!1),Xe(this,"isRoot",!1),Xe(this,"isRow",!1),Xe(this,"isColumn",!1),Xe(this,"isStack",!1),Xe(this,"isComponent",!1),Xe(this,"tab",void 0),Xe(this,"_pendingEventPropagations",void 0),Xe(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=n,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Yt.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;n!==!0&&i!==!0&&this[e].apply(this,t);for(var a=0;a<this.contentItems.length;a++)this.contentItems[a].callDownwards(e,t,n);n===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=this.contentItems.indexOf(e);if(i===-1)throw new Error("Can't remove child item. Unknown content item");if(n!==!0&&this.contentItems[i]._$destroy(),this.contentItems.splice(i,1),(t=this.config.content)===null||t===void 0||t.splice(i,1),this.contentItems.length>0)this.callDownwards("setSize");else if(this.type!=="root"&&this.config.isClosable){var a;(a=this.parent)===null||a===void 0||a.removeChild(this)}}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var i=this.contentItems.indexOf(e),a=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");a==null||a.replaceChild(t.element[0],e.element[0]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,xi(this)&&(this.header.tabs[i].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],n=function i(a){for(var o=0;o<a.contentItems.length;o++)e(a.contentItems[o])===!0&&t.push(a.contentItems[o]),i(a.contentItems[o])};return n(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),n=[],i=0;i<t.length;i++)n.push(t[i].instance);return n}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(n){return n[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,n){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(n)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),n=null,i=0;i<t.length;i++)n=t[i].getActiveContentItem(),n&&Et(n)&&n.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,n,i;e=e||this.element;var a=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},o=(n=e.width())!==null&&n!==void 0?n:0,s=(i=e.height())!==null&&i!==void 0?i:0;return{x1:a.left,y1:a.top,x2:a.left+o,y2:a.top+s,surface:o*s,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new Uo(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new dr("content must be an Array",e);for(var n=0;n<e.content.length;n++)t=this.layoutManager.createContentItem(e.content[n],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,n]of Object.entries(uc)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof Uo&&t.isPropagationStopped===!1&&this.isInitialised===!0&&(this.isRoot===!1&&this.parent?this.parent.emit.apply(this.parent,[e,t]):this._scheduleEventPropagationToLayoutManager(e,t))}_scheduleEventPropagationToLayoutManager(e,t){this._throttledEvents.indexOf(e)===-1?this.layoutManager.emit(e,t.origin):this._pendingEventPropagations[e]!==!0&&(this._pendingEventPropagations[e]=!0,Ms(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function ai(r,e,t){return e=pC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pC(r){var e=gC(r,"string");return typeof e=="symbol"?e:String(e)}function gC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yc extends tt{constructor(e,t,n){super(e,t,n,Q()),ai(this,"config",void 0),ai(this,"componentName",void 0),ai(this,"container",void 0),ai(this,"parent",void 0),ai(this,"instance",void 0),this.config=t,this.parent=n;var i=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=Q.extend(!0,{},this.config.componentState||{});if(i==null)throw new dr('Unknown component "'+this.config.componentName+'"');a.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new Ho(this.config,this,e),this.instance=new i(this.container,a),this.element=this.container._element}close(){this.parent.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){tt.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),tt.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),tt.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),tt.prototype._$destroy.call(this)}_$getArea(){return null}}function Nt(r,e,t){return e=bC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bC(r){var e=CC(r,"string");return typeof e=="symbol"?e:String(e)}function CC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Da extends tt{constructor(e,t,n,i){super(t,n,i,Q('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),Nt(this,"isRow",void 0),Nt(this,"isColumn",void 0),Nt(this,"childElementContainer",void 0),Nt(this,"parent",void 0),Nt(this,"_splitter",[]),Nt(this,"_splitterSize",void 0),Nt(this,"_splitterGrabSize",void 0),Nt(this,"_isColumn",void 0),Nt(this,"_dimension",void 0),Nt(this,"_splitterPosition",null),Nt(this,"_splitterMinPosition",null),Nt(this,"_splitterMaxPosition",null),this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,n){var i,a,o,s;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),tt.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(o=0;o<this.contentItems.length;o++)if(this.contentItems[o]===e)e.config[this._dimension]=i;else{var l;a=((l=this.contentItems[o].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[o].config[this._dimension]=a}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var n,i=(n=e.config[this._dimension])!==null&&n!==void 0?n:0,a=this.contentItems.indexOf(e),o=Math.max(a-1,0),s,l;if(a===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[o]&&(this._splitter[o]._$destroy(),this._splitter.splice(o,1)),s=0;s<this.contentItems.length;s++)if(this.contentItems[s]!==e){var d;this.contentItems[s].config[this._dimension]=((d=this.contentItems[s].config[this._dimension])!==null&&d!==void 0?d:0)+i/(this.contentItems.length-1)}tt.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0?(l=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,l,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))}replaceChild(e,t){var n=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=n,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(tt.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,n=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,a=(t=this.element.height())!==null&&t!==void 0?t:0,o=0,s=[];this._isColumn?a-=n:i-=n;for(var l=0;l<this.contentItems.length;l++){var d,u,c=this._isColumn?Math.floor(a*(((d=this.contentItems[l].config.height)!==null&&d!==void 0?d:0)/100)):Math.floor(i*(((u=this.contentItems[l].config.width)!==null&&u!==void 0?u:0)/100));o+=c,s.push(c)}var m=Math.floor((this._isColumn?a:i)-o);return{itemSizes:s,additionalPixel:m,totalWidth:i,totalHeight:a}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var a=this.contentItems[i].config[n];a!=null?e+=a:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var o=0;o<t.length;o++)t[o].config[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var d;this.contentItems[l].config[n]=((d=this.contentItems[l].config[n])!==null&&d!==void 0?d:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,n=[],i=0,a=0,o=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var d=this._calculateAbsoluteSizes(),u=0;u<this.contentItems.length;u++){this.contentItems[u];var c=d.itemSizes[u];c<t?(a+=t-c,l={width:t}):(i+=c-t,l={width:c},n.push(l)),s.push(l)}if(!(a===0||a>i)){var m=a/i;o=a;for(var f=0;f<n.length;f++){l=n[f];var g=Math.round((l.width-t)*m);o-=g,l.width-=g}o!==0&&(s[s.length-1].width-=o);for(var v=0;v<this.contentItems.length;v++)this.contentItems[v].config.width=s[v].width/d.totalWidth*100}}}_createSplitter(e){var t;return t=new Sc(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,n=0,i=0;i<e.length;++i){var a,o;t=Math.max((a=e[i].minWidth)!==null&&a!==void 0?a:0,t),n=Math.max((o=e[i].minHeight)!==null&&o!==void 0?o:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,i,a,o=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=o.before.config.content)!==null&&t!==void 0?t:[]),d=this._isColumn?l.vertical:l.horizontal,u=this._getMinimumDimensions((n=o.after.config.content)!==null&&n!==void 0?n:[]),c=this._isColumn?u.vertical:u.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=o.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(d||s)),this._splitterMaxPosition=((a=o.after.element[this._dimension]())!==null&&a!==void 0?a:0)-(c||s)}_onSplitterDrag(e,t,n){var i=this._isColumn?n:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,n,i,a,o,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(n=s.after.element[this._dimension]())!==null&&n!==void 0?n:0,u=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+d),c=((a=s.before.config[this._dimension])!==null&&a!==void 0?a:0)+((o=s.after.config[this._dimension])!==null&&o!==void 0?o:0);s.before.config[this._dimension]=u*c,s.after.config[this._dimension]=(1-u)*c,e.element.css({top:0,left:0}),Ms(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function td(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function nd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?td(Object(t),!0).forEach(function(n){Bo(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):td(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Bo(r,e,t){return e=yC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yC(r){var e=SC(r,"string");return typeof e=="symbol"?e:String(e)}function SC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Wo extends tt{constructor(e,t,n){super(e,nd(nd({},t),{},{type:"root"}),null,Q('<div class="lm_goldenlayout lm_item lm_root"></div>')),Bo(this,"childElementContainer",void 0),Bo(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=n,this._containerElement.append(this.element)}addChild(e,t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");e=this.layoutManager._$normalizeContentItem(e,this),this.childElementContainer.append(e.element),super.addChild(e,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(e,t){var n,i;e=typeof e>"u"?(n=this._containerElement.width())!==null&&n!==void 0?n:0:e,t=typeof t>"u"?(i=this._containerElement.height())!==null&&i!==void 0?i:0:t,this.element.width(e),this.element.height(t),this.contentItems[0]&&(this.contentItems[0].element.width(e),this.contentItems[0].element.height(t))}_$getArea(){var e=super._$getArea();if(e==null)throw new Error("Unable to get root area");return e}_$highlightDropZone(e,t,n){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,n)}_$onDrop(e,t){var n;if(Et(e)&&(n=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),n._$init(),n.addChild(e),e=n),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,a=i==="left"||i==="right"?"row":"column",o=i==="left"||i==="right"?"width":"height",s=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof Da)||l.type!=a){var d=this.layoutManager.createContentItem({type:a},this);this.replaceChild(l,d),d.addChild(e,s?0:void 0,!0),d.addChild(l,s?void 0:0,!0),l.config[o]=50,e.config[o]=50,d.callDownwards("setSize")}else{var u,c=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),c.config[o]=((u=c.config[o])!==null&&u!==void 0?u:0)*.5,e.config[o]=c.config[o],l.callDownwards("setSize")}}}}function rd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function _r(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?rd(Object(t),!0).forEach(function(n){bt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):rd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function bt(r,e,t){return e=wC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wC(r){var e=EC(r,"string");return typeof e=="symbol"?e:String(e)}function EC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Go extends tt{constructor(e,t,n){var i,a,o,s,l,d,u,c,m;super(e,t,n,Q('<div class="lm_item lm_stack"></div>')),bt(this,"_activeContentItem",null),bt(this,"_header",void 0),bt(this,"childElementContainer",Q('<div class="lm_items"></div>')),bt(this,"header",void 0),bt(this,"parent",void 0),bt(this,"isStack",!0),bt(this,"_dropZones",{}),bt(this,"_dropSegment",null),bt(this,"_contentAreaDimensions",null),bt(this,"_dropIndex",void 0),bt(this,"_side",void 0),bt(this,"_sided",!1),bt(this,"config",void 0),this.parent=n,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(a=f.settings)!==null&&a!==void 0&&a.showPopoutIcon?(o=f.labels)===null||o===void 0?void 0:o.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=f.settings)!==null&&d!==void 0&&d.showCloseIcon?(u=f.labels)===null||u===void 0?void 0:u.close:void 0,minimise:(c=(m=f.labels)===null||m===void 0?void 0:m.minimise)!==null&&c!==void 0?c:void 0},f.header&&(this._header=_r(_r({},this._header),f.header)),t.header&&(this._header=_r(_r({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=_r(_r({},this._header),t.content[0].header)),this.header=new Tn(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,i,a,o=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((n=this.element.width())!==null&&n!==void 0?n:0)-(this._sided?o:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:o);for(this.childElementContainer.width(s),this.childElementContainer.height(l),a=0;a<this.contentItems.length;a++)this.contentItems[a].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.contentItems.indexOf(e);super.removeChild(e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,n=this.contentItems.length;t<n;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){tt.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(e){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(e,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(e);return}var t=this._dropSegment==="top"||this._dropSegment==="bottom",n=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",a=t&&this.parent.isColumn||n&&this.parent.isRow,o=t?"column":"row",s=t?"height":"width";if(Et(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(a){var d,u=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?u:u+1,!0),this.config[s]=((d=this.config[s])!==null&&d!==void 0?d:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var c=this.layoutManager.createContentItem({type:o},this);this.parent.replaceChild(this,c),c.addChild(e,i?0:void 0,!0),c.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,c.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,i]of Object.entries(this._contentAreaDimensions)){var a=i.hoverArea;if(a.x1<e&&a.x2>e&&a.y1<t&&a.y2>t){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var n=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+n*.25,y1:t.y1,x2:t.x1+n*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+n*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+n*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+n*.25,y1:t.y1+i*.5,x2:t.x1+n*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,n,i,a,o,s,l,d,u,c,m,f,g,v,p,C,S=this.header.tabs.length;if(S===0){var y,w,E,D,M,_,T,N,x=this.header.element.offset();(y=this.layoutManager.dropTargetIndicator)===null||y===void 0||y.highlightArea({x1:(w=x==null?void 0:x.left)!==null&&w!==void 0?w:0,x2:((E=x==null?void 0:x.left)!==null&&E!==void 0?E:0)+100,y1:(D=(M=this.header.element.offset())===null||M===void 0?void 0:M.top)!==null&&D!==void 0?D:0,y2:((_=(T=this.header.element.offset())===null||T===void 0?void 0:T.top)!==null&&_!==void 0?_:0)+((N=this.header.element.innerHeight())!==null&&N!==void 0?N:0)});return}var F=this.header.tabsContainer,k=(t=F.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),U=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!k||!U)){e<k.left?e=k.left+1:e>k.right&&(e=k.right-1);var H,W;if(!(U.left<e&&e<U.right)){for(var X=0;X<S;X++){var le;if(H=this.header.tabs[X].element,W=(le=H.get(0))===null||le===void 0?void 0:le.getBoundingClientRect(),W&&W.left<e&&e<W.right){this._dropIndex=X;break}}if(H&&W&&e<W.left+W.width*.5)H.before(this.layoutManager.tabDropPlaceholder);else if(H){var me;this._dropIndex=Math.min(((me=this._dropIndex)!==null&&me!==void 0?me:0)+1,S),H.after(this.layoutManager.tabDropPlaceholder)}}var ve=(i=(a=this.layoutManager.tabDropPlaceholder.offset())===null||a===void 0?void 0:a.left)!==null&&i!==void 0?i:0;ve=Math.max(ve,(o=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&o!==void 0?o:0);var j=ve+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);j=Math.min(j,((d=(u=this.header.tabsContainer.offset())===null||u===void 0?void 0:u.left)!==null&&d!==void 0?d:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(m=this.layoutManager.dropTargetIndicator)===null||m===void 0||m.highlightArea({x1:ve,x2:j,y1:(f=(g=this.header.element.offset())===null||g===void 0?void 0:g.top)!==null&&f!==void 0?f:0,y2:((v=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&v!==void 0?v:0)+((C=this.header.element.innerHeight())!==null&&C!==void 0?C:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(n=>n===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=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 t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,n,i=(t=this._contentAreaDimensions)===null||t===void 0||(n=t[e])===null||n===void 0?void 0:n.highlightArea;if(i){var a;(a=this.layoutManager.dropTargetIndicator)===null||a===void 0||a.highlightArea(i)}this._dropSegment=e}}const PC=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:tt,Component:yc,ContentItem:tt,Root:Wo,RowOrColumn:Da,Stack:Go,isComponent:Et,isRoot:Cc,isStack:xi},Symbol.toStringTag,{value:"Module"}));function Cn(r,e,t){return e=TC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function TC(r){var e=_C(r,"string");return typeof e=="symbol"?e:String(e)}function _C(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Vi{constructor(e,t){var n;Cn(this,"header",void 0),Cn(this,"contentItem",void 0),Cn(this,"element",Q(Vi._template)),Cn(this,"titleElement",void 0),Cn(this,"closeElement",void 0),Cn(this,"isActive",!1),Cn(this,"_layoutManager",void 0),Cn(this,"_dragListener",void 0),this.header=e,this.contentItem=t,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[t.config.isClosable?"show":"hide"](),this.setTitle(t.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,(n=this._layoutManager.config.settings)!==null&&n!==void 0&&n.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new $i(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClick=this._onTabClick.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onTabContentFocusIn=this._onTabContentFocusIn.bind(this),this._onTabContentFocusOut=this._onTabContentFocusOut.bind(this),this.element.on("click",this._onTabClick),this.element.on("auxclick",this._onTabClick),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),Et(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))}setTitle(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.html(e)}setActive(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.closeElement.off("click",this._onCloseClick),Et(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var n;(n=this.contentItem.parent)!==null&&n!==void 0&&n.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new gr(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){Q(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){Et(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,n=this.header.parent.getActiveContentItem();this.contentItem!==n&&Et(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Et(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),Et(this.contentItem)&&this.contentItem.container.emit("tabClicked",e),this.header._hideAdditionalTabsDropdown(),(t=this.element.get(0))===null||t===void 0||t.scrollIntoView({inline:"nearest"})}else e.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(e)}_onCloseClick(e){e.stopPropagation(),Et(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}Cn(Vi,"_template",['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab" aria-label="Close tab"></div>',"</li>"].join(""));function ge(r,e,t){return e=OC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function OC(r){var e=DC(r,"string");return typeof e=="symbol"?e:String(e)}function DC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Tn extends Yt{constructor(e,t){var n,i;super(),ge(this,"layoutManager",void 0),ge(this,"element",Q(Tn._template)),ge(this,"tabsContainer",void 0),ge(this,"tabDropdownContainer",void 0),ge(this,"tabDropdownSearch",void 0),ge(this,"tabDropdownList",null),ge(this,"controlsContainer",void 0),ge(this,"parent",void 0),ge(this,"tabs",[]),ge(this,"activeContentItem",null),ge(this,"closeButton",null),ge(this,"tabDropdownButton",null),ge(this,"tabNextButton",Q(Tn._nextButtonTemplate)),ge(this,"tabPreviousButton",Q(Tn._previousButtonTemplate)),ge(this,"holdTimer",null),ge(this,"rAF",null),ge(this,"CLICK_TIMEOUT",500),ge(this,"START_SPEED",.01),ge(this,"ACCELERATION",5e-4),ge(this,"PADDING",10),ge(this,"SCROLL_LEFT","left"),ge(this,"SCROLL_RIGHT","right"),ge(this,"isDraggingTab",!1),ge(this,"isOverflowing",!1),ge(this,"isDropdownShown",!1),ge(this,"dropdownKeyIndex",0),ge(this,"_lastVisibleTabIndex",-1),ge(this,"_tabControlOffset",void 0),this.layoutManager=e,(n=this.layoutManager.config.settings)!==null&&n!==void 0&&n.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click",this._onHeaderClick.bind(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._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=t,this.parent.on("resize",this._updateTabSizes,this),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.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),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._tabControlOffset=(i=this.layoutManager.config.settings)===null||i===void 0?void 0:i.tabControlOffset,this._createControls()}createTab(e,t){for(var n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===e)return;var i=new Vi(this,e);if(this.tabs.length===0){this.tabs.push(i),this.tabsContainer.append(i.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(i.element):this.tabs[0].element.before(i.element),this.tabs.splice(t,0,i),this._updateTabSizes()}removeTab(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e){this.tabs[t]._$destroy(),this.tabs.splice(t,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(e){for(var t,n,i,a,o=0;o<this.tabs.length;o++)a=this.tabs[o].contentItem===e,this.tabs[o].setActive(a),a===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=o);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(n=t.scrollIntoView)===null||n===void 0||n.call(t,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),e!==void 0&&this.parent._header.show!==e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t}_attachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(e){var t=e.currentTarget;if(t instanceof HTMLElement){var n=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;n*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3);t.scrollLeft+=Math.round(n)}}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.isDropdownShown&&this._hideAdditionalTabsDropdown(),this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var e;this.isDraggingTab=!1,window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,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(){var e;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handlePreviousMouseEnter(){var e;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handleNextMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var e,t=0;t<this.tabs.length;t+=1){var n,i,a,o,s;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n:0)>((a=(o=this.tabsContainer.get(0))===null||o===void 0?void 0:o.offsetWidth)!==null&&a!==void 0?a:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var d,u;l.scrollLeft=(d=(u=this.tabsContainer.get(0))===null||u===void 0?void 0:u.scrollWidth)!==null&&d!==void 0?d:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var n,i,a;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n:0)<((a=this.tabsContainer.scrollLeft())!==null&&a!==void 0?a:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var o=this.tabsContainer.get(0);o&&(o.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,n;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((n=this.tabsContainer.get(0))===null||n===void 0?void 0:n.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3?arguments[3]:void 0,o=this.tabsContainer.get(0);if(o){var s=o.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,d;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((d=this.tabsContainer.innerWidth())!==null&&d!==void 0?d:0)===o.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(u=>{var c,m,f=a||u,g=u-f,v=this.START_SPEED*g+.5*this.ACCELERATION*(g*g);v=Math.min(v,(c=(m=this.tabsContainer.get(0))===null||m===void 0?void 0:m.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,v,f)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),Q(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(e){if(e in this.parent._header)return this.parent._header[e]}_createControls(){var e,t,n,i,a;if(a=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new fi(this,a,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(t=this._onPopoutClick.bind(this),n=this._getHeaderSetting("popout"),new fi(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var o=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new fi(this,o,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",o??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new fi(this,n,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),Q(document.body).append(this.tabDropdownContainer),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"),Q(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,d){if(d==null||d.length<2)return-1;for(var u=(s+l+d.length)%d.length;u!==s;){if(d.eq(u).css("display")!=="none")return u;u=(u+l+d.length)%d.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var n,i;e.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var a,o;e.preventDefault(),(a=this.tabDropdownList)===null||a===void 0||a.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var n,i;((n=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&n!==void 0?n:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,n;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),Q(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,n,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var a=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(a!==0){var o=this.tabDropdownContainer[0].getBoundingClientRect(),s=(n=Q(window).height())!==null&&n!==void 0?n:0,l=(i=Q(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var d=this.tabDropdownButton.element[0].getBoundingClientRect(),u=a<s-d.bottom,c=!u&&d.bottom>s*.6,m=Math.min(d.left+(c?d.width:0),l-o.width-this.PADDING),f=c?Math.max(d.top-a,this.PADDING):d.bottom,g=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":g,top:f,left:m})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}ge(Tn,"_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(""));ge(Tn,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));ge(Tn,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function oi(r,e,t){return e=MC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function MC(r){var e=IC(r,"string");return typeof e=="symbol"?e:String(e)}function IC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Sc{constructor(e,t,n){oi(this,"_isVertical",void 0),oi(this,"_size",void 0),oi(this,"_grabSize",void 0),oi(this,"_dragListener",void 0),oi(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new $i(this.element)}on(e,t,n){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,n)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=Q('<div class="lm_drag_handle"></div>'),t=Q('<div class="lm_splitter"></div>');t.append(e);var n=this._grabSize-this._size,i=n/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+n),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+n),t.addClass("lm_horizontal"),t.width(this._size)),t}}const NC=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:vc,DragProxy:gr,DragSource:pc,DragSourceFromEvent:gc,DropTargetIndicator:Hi,Header:Tn,HeaderButton:fi,Splitter:Sc,Tab:Vi},Symbol.toStringTag,{value:"Module"}));var xC={config:Mb,container:Rb,controls:NC,errors:mC,items:PC,utils:Zb};const FC=xC;function id(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function vt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?id(Object(t),!0).forEach(function(n){ye(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):id(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ye(r,e,t){return e=RC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function RC(r){var e=LC(r,"string");return typeof e=="symbol"?e:String(e)}function LC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class wc extends Yt{static minifyConfig(e){return xs(e)}static unminifyConfig(e){return Vo(e)}constructor(e,t){super(),ye(this,"isInitialised",!1),ye(this,"_isFullPage",!1),ye(this,"_resizeTimeoutId",void 0),ye(this,"_components",{"lm-react-component":mc}),ye(this,"_fallbackComponent",void 0),ye(this,"_itemAreas",[]),ye(this,"_maximisedItem",null),ye(this,"_maximisePlaceholder",Q('<div class="lm_maximise_place"></div>')),ye(this,"_creationTimeoutPassed",!1),ye(this,"_subWindowsCreated",!1),ye(this,"_dragSources",[]),ye(this,"_updatingColumnsResponsive",!1),ye(this,"_firstLoad",!0),ye(this,"_reactChildMap",new Map),ye(this,"_reactChildren",null),ye(this,"width",null),ye(this,"height",null),ye(this,"root",void 0),ye(this,"openPopouts",[]),ye(this,"selectedItem",null),ye(this,"isSubWindow",!1),ye(this,"eventHub",new fc(this)),ye(this,"config",void 0),ye(this,"container",void 0),ye(this,"_originalContainer",void 0),ye(this,"dropTargetIndicator",null),ye(this,"tabDropPlaceholder",Q('<div class="lm_drop_tab_placeholder"></div>')),ye(this,"_typeToItem",void 0),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this.isSubWindow&&Q("body").css("visibility","hidden"),this._typeToItem={column:Da.bind(this,!0),row:Da.bind(this,!1),stack:Go,component:yc}}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var n=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return n}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof tt))throw new Error("Root must be a ContentItem");var t={settings:vt({},this.config.settings),dimensions:vt({},this.config.dimensions),labels:vt({},this.config.labels),content:[]},n=function a(o,s){for(var l in s.config)l!=="content"&&(o[l]=s.config[l]);if(o.componentName==="lm-react-component"&&(o.type="react-component"),s.contentItems.length){o.content=[];for(var d=0;d<s.contentItems.length;d++)o.content[d]={},a(o.content[d],s.contentItems[d])}};e?n(t,{contentItems:[e]}):n(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){Q(document).ready(this.init.bind(this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(this.init.bind(this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new Hi,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(e,t){this._reactChildMap.set(e,t),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(e,t){var n=this._reactChildMap.get(e);n===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}updateSize(e,t){var n,i;if(this.width=(n=e??this.container.width())!==null&&n!==void 0?n:0,this.height=(i=t??this.container.height())!==null&&i!==void 0?i:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var a,o;this._maximisedItem.element.width((a=this.container.width())!==null&&a!==void 0?a:0),this._maximisedItem.element.height((o=this.container.height())!==null&&o!==void 0?o:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),Q(window).off("resize",this._onResize),Q(window).off("unload beforeunload",this._onUnload),Q(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var n,i;if(typeof e.type!="string")throw new dr("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw n="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new dr(n);return e.type==="component"&&!(t instanceof Go)&&t&&!(this.isSubWindow===!0&&t instanceof Wo)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),i=new this._typeToItem[e.type](this,e,t),i}createPopout(e,t,n,i){var a=[],o=e instanceof tt,s=this;if(o){var l;a=this.toConfig(e).content,n=Is();for(var d=e.parent,u=e;((c=d)===null||c===void 0?void 0:c.contentItems.length)===1&&!d.isRoot;){var c;u=d,d=d.parent}if((l=d)===null||l===void 0||l.addId(n),i==null||Number.isNaN(i)){var m;i=(m=d)===null||m===void 0?void 0:m.contentItems.indexOf(u)}}else e instanceof Array?a=e:a=[e];if(!t&&o){var f,g,v,p=window.screenX||window.screenLeft,C=window.screenY||window.screenTop,S=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:p+S.left,top:C+S.top,width:(g=e.element.width())!==null&&g!==void 0?g:0,height:(v=e.element.height())!==null&&v!==void 0?v:0}}if(!t&&!o&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),o&&e.remove(),!(!t||!n||i===void 0)){var y=new vc(a,t,n,i,this);return y.on("initialised",function(){s.emit("windowOpened",y)}),y.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(y),y}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new pc(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new gc(e,this,t)}selectItem(e,t){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&t!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var t,n;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((t=this.container.width())!==null&&t!==void 0?t:0),e.element.height((n=this.container.height())!==null&&n!==void 0?n:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var t;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(t=e.parent)===null||t===void 0||t.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,t){for(var n=1/0,i=null,a=0;a<this._itemAreas.length;a++){var o=this._itemAreas[a];e>o.x1&&e<o.x2&&t>o.y1&&t<o.y2&&n>o.surface&&(n=o.surface,i=o)}return i}_$createRootItemAreas(){var e=50,t=vt({},this.root._$getArea()),n=[vt(vt({},t),{},{side:"left",x2:t.x1+e}),vt(vt({},t),{},{side:"right",x1:t.x2-e}),vt(vt({},t),{},{side:"top",y2:t.y1+e}),vt(vt({},t),{},{side:"bottom",y1:t.y2-e})];n.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...n)}_$calculateItemAreas(){var e=this._getAllContentItems();if(this._itemAreas=[],e.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var t=0;t<e.length;t++){var n=e[t];if(xi(n)){var i=n._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var a;this._itemAreas.push(i);var o=vt(vt({},i),(a=i.contentItem._contentAreaDimensions)===null||a===void 0?void 0:a.header.highlightArea);o.surface=(o.x2-o.x1)*(o.y2-o.y1),this._itemAreas.push(o)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof tt)return e;if(Q.isPlainObject(e)&&e.type){var n=this.createContentItem(e,t);return n.callDownwards("_$init"),n}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var n;((n=this.openPopouts[t].getWindow())===null||n===void 0?void 0:n.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=n=>{if(e.push(n),n.contentItems instanceof Array)for(var i=0;i<n.contentItems.length;i++)t(n.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&Q(window).resize(this._onResize),Q(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,n=cc("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=Vo(e),localStorage.removeItem(n)),e=Q.extend(!0,{},lc,e);var i=function a(o){for(var s in o){var l=o[s];s!=="props"&&typeof l=="object"&&l!=null?a(l):s==="type"&&l==="react-component"&&(o.type="component",o.componentName="lm-react-component")}};return i(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=Q('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(()=>{this.emit("popIn")}),document.title=Ns((e=this.config.content[0].title)!==null&&e!==void 0?e:""),Q("head").append(Q("body link, body style, template, .gl_keep")),this.container=Q("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(this.config.openPopouts)for(var e=0;e<this.config.openPopouts.length;e++){var t=this.config.openPopouts[e];this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)}}_getContainer(){var e=this._originalContainer?Q(this._originalContainer):Q("body");if(e.length===0)throw new Error("GoldenLayout container not found");if(e.length>1)throw new Error("GoldenLayout more than one container element specified");return e}_setContainer(){var e=this._getContainer();e[0]===document.body&&(this._isFullPage=!0,Q("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=e}_create(e){var t;if(!(e.content instanceof Array))throw e.content===void 0?t="Missing setting 'content' on top level of configuration":t="Configuration parameter 'content' must be an array",new dr(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new dr(t,e);this.root=new Wo(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){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 e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth,n=e*t;if(!(this.width==null||n<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/t),1),a=e-i,o=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<a;l++){var d=o.contentItems[o.contentItems.length-1];this._addChildContentItemsToContainer(s,d)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(n){e.addChild(n),t.removeChild(n,!0)}):t.contentItems.forEach(n=>{this._addChildContentItemsToContainer(e,n)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(n=>{xi(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}ye(wc,"__lm",FC);const AC=wc,kC="_lm_dragging_k4a5m_1",jC="_lm_goldenlayout_k4a5m_1",$C="_lm_header_k4a5m_1",HC="_lm_controls_k4a5m_1",VC="_lm_tabpreviousbutton_k4a5m_1",UC="_lm_tabnextbutton_k4a5m_1",BC="_lm_tab_k4a5m_1",WC="_lm_active_k4a5m_1",GC="_lm_close_tab_k4a5m_1",zC="_lm_content_k4a5m_1",KC="_lm_dragProxy_k4a5m_1",qC="_lm_dropTargetIndicator_k4a5m_1",XC="_march_k4a5m_1",ZC="_lm_inner_k4a5m_1",YC="_lm_splitter_k4a5m_1",QC="_lm_selectable_k4a5m_1",JC="_lm_tabdropdown_list_k4a5m_1",ey="_lm_title_k4a5m_1",ty="_lm_title_before_k4a5m_1",ny="_lm_selected_k4a5m_1",ry="_lm_focusin_k4a5m_1",iy="_lm_window_blur_k4a5m_1",ay="_lm_popout_k4a5m_1",oy="_lm_maximise_k4a5m_1",sy="_lm_tabdropdown_k4a5m_1",ly="_lm_close_k4a5m_1",dy="_lm_tabdropdown_search_k4a5m_1",uy="_lm_tabs_k4a5m_1",hy="_lm_keyboard_active_k4a5m_1",cy="_lm_maximised_k4a5m_1",my="_lm_items_k4a5m_1",ad={"tab-height":"28px","drag-border-width":"5px",lm_dragging:kC,lm_goldenlayout:jC,lm_header:$C,lm_controls:HC,lm_tabpreviousbutton:VC,lm_tabnextbutton:UC,lm_tab:BC,lm_active:WC,lm_close_tab:GC,lm_content:zC,lm_dragProxy:KC,lm_dropTargetIndicator:qC,march:XC,lm_inner:ZC,lm_splitter:YC,lm_selectable:QC,lm_tabdropdown_list:JC,lm_title:ey,lm_title_before:ty,lm_selected:ny,lm_focusin:ry,lm_window_blur:iy,lm_popout:ay,lm_maximise:oy,lm_tabdropdown:sy,lm_close:ly,lm_tabdropdown_search:dy,lm_tabs:uy,lm_keyboard_active:hy,lm_maximised:cy,lm_items:my},od=Object.freeze({tabHeight:parseInt(ad["tab-height"],10),dragBorderWidth:parseInt(ad["drag-border-width"],10)});function sd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function mn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sd(Object(t),!0).forEach(function(n){Ec(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):sd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ec(r,e,t){return e=fy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fy(r){var e=vy(r,"string");return typeof e=="symbol"?e:String(e)}function vy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var xn=z.module("LayoutUtils");function Pc(r){return r.componentName!==void 0}function Rr(r){var e=r;return(Pc(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function ra(r){return r.focus!==void 0}function ld(r){return r.type==="stack"}class A{static activateTab(e,t){var n=A.getStackForRoot(e,t,!1);if(!n){xn.error("Could not find stack for config",t);return}var i=A.getContentItemInStack(n,t);i&&n.setActiveContentItem(i)}static isActiveTab(e,t){var n=A.getStackForRoot(e,t,!1);if(!n)return xn.error("Could not find stack for config",t),!1;var i=A.getContentItemInStack(n,t),a=n.getActiveContentItem();return a===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=t?"column":"row";if(Cc(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:n});var i=e.contentItems[0],a=t?i.isColumn:i.isRow;if(!a){e.removeChild(i,!0),e.addChild({type:n});var o=document.activeElement;e.contentItems[0].addChild(i),o&&o.focus!=null&&o.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(s,!0),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]),this.addStack(s,!t)}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n&&xi(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var a=e.contentItems[i];if(a.isComponent&&a.config!=null&&al(a.config,t))return e;var o=this.getStackForConfig(a,t,n);if(o)return o}return null}static getStackForRoot(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=this.getStackForConfig(e,t);return!o&&i&&(o=this.getStackForConfig(e,{component:t.component},a)),!o&&n&&(o=this.addStack(e)),o}static getStackForComponentTypes(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;o<t.length;o+=1){var s=t[o],l=o===t.length-1,d=A.getStackForRoot(e,{component:s},n&&l,i,a);if(d)return d}return null}static getContentItemInStack(e,t){if(!e)return null;for(var n=0;n<e.contentItems.length;n+=1){var i=e.contentItems[n];if(i.isComponent&&i.config!=null&&al(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],i=0;i<e.length;i+=1){var a=e[i],{component:o,content:s}=a;if(o){var l=t(o,a);l!=null?n.push(l):xn.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o,'"'))}else if(s){var d=mn(mn({},a),{},{content:A.dehydrateLayoutConfig(s,t)});n.push(d)}else n.push(a)}return n}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var n=t.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var n=e[t],{content:i}=n;i!==void 0?(ld(n)&&delete n.activeItemIndex,A.dropLayoutMinorChange(i)):Rr(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[],n.props.panelState.gridState.isStuckToBottom=!1,n.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=A.cloneLayout(e),a=A.cloneLayout(t);return n?(A.dropLayoutMinorChange(i),A.dropLayoutMinorChange(a),mr(i,a)):mr(i,a)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],i=0;i<e.length;i+=1){var a=e[i];if(Rr(a)){var o,{component:s,props:l={}}=a;n.push(mn(mn({},a),{},{id:(o=a==null?void 0:a.id)!==null&&o!==void 0?o:Ue(),props:t(s,l)}))}else if(a.content!==void 0){var d=A.hydrateLayoutConfig(a.content,t);ld(a)&&a.activeItemIndex!=null&&a.activeItemIndex>=d.length&&(xn.warn("Fixing bad activeItemIndex!",a.activeItemIndex,a),a.activeItemIndex=0),n.push(mn(mn({},a),{},{content:d}))}else n.push(a)}return n}static openComponent(){var{root:e,config:t,replaceExisting:n=!0,replaceConfig:i=void 0,createNewStack:a=!1,focusElement:o=void 0,dragEvent:s=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=document.activeElement,d=mn({},t);if(d.id==null&&(d.id=Ue.generate()),s!=null){e==null||e.layoutManager.createDragSourceFromEvent(d,s);return}var u=i||{id:d.id,component:d.component};I(e);var c=a?A.addStack(e):A.getStackForRoot(e,u);I(c);var m=A.getContentItemInStack(c,u);if(o!=null){var f=v=>{xn.debug("Component created, focusing element",o),c.off("componentCreated",f);var{element:p}=v.origin;requestAnimationFrame(()=>{A.focusElement(p[0],o)})};c.on("componentCreated",f)}if(n&&m){var g=c.contentItems.indexOf(m);c.addChild(d,g+1),c.removeChild(m),c.setActiveContentItem(c.contentItems[g])}else c.addChild(d);o==null&&l&&ra(l)&&l.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,a={id:t.id},o=A.getContentItemInStack(e,a);if(n&&o&&e){var s=e==null?void 0:e.contentItems.indexOf(o);e.addChild(t,s+1),e.removeChild(o),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&ra(i)&&i.focus()}static closeComponent(e,t,n){var i=A.getStackForRoot(e,t,!1,!1,!1);if(!i){xn.warn("Cannot find stack for component, ignoring close",t);return}var a=A.getContentItemInStack(i,t),o=document.activeElement;a&&(Et(a)?a.container.close(n):i.removeChild(a)),o&&document.contains(o)&&ra(o)&&o.focus()}static renameComponent(e,t,n){var i=A.getStackForRoot(e,t,!1);if(!i){xn.error("Could not find stack for config",t);return}var a=A.getContentItemInStack(i,t);a&&a.setTitle(n)}static cloneComponent(e,t){var n=A.getStackForRoot(e,t,!1);if(!n)return xn.error("Could not find stack for config",t),null;var{props:i={}}=t,a=A.getPanelComponentState(t),o={type:"react-component",component:t.component,props:mn(mn({},i),{},{panelState:a}),title:"".concat(t.title," Copy"),id:Ue.generate()};return A.openComponentInStack(n,o),o}static getPanelComponentState(e){if(Pc(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Rr(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:od.tabHeight,borderWidth:od.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(e){return e.layoutManager.root}static getComponentConfigFromContainer(e){return e?e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config:e._config:null}static getTitleFromContainer(e){return e!=null&&e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config.title:null}static getTitleFromTab(e){return e!=null&&e.contentItem!=null?e.contentItem.config.title:null}static getIdFromContainer(e){var t=A.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return A.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,n=A.getComponentConfigFromContainer(t);if(n&&Rr(n)){var i;return(i=n.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,n,i=(t=(n=e.WrappedComponent)===null||n===void 0?void 0:n.displayName)!==null&&t!==void 0?t:e.displayName;if(i==null)throw new Error("Component displayName not defined ".concat(e));return i}static focusElement(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:A.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var n=e.querySelector(t);return n==null?null:(ra(n)&&n.focus(),n)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var n=()=>{e.off("initialised",n),t()};e.on("initialised",n)})}}Ec(A,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var py=Z.forwardRef((r,e)=>{var t=A.getComponentNameFromPanel({props:r});return h.jsx("div",{ref:e,className:"panel-placeholder",children:h.jsxs("div",{children:['Component "',t,'" is not registered.']})})});py.displayName="PanelPlaceholder";const se=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",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"});function Ma(r){return(r==null?void 0:r.WrappedComponent)!==void 0}function gy(r){return typeof r.id=="string"&&r.layout instanceof AC&&r.panelManager instanceof Rs&&typeof r.registerComponent=="function"}function Yr(r){if(!gy(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function dd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ud(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dd(Object(t),!0).forEach(function(n){Gn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):dd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Gn(r,e,t){return e=by(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function by(r){var e=Cy(r,"string");return typeof e=="symbol"?e:String(e)}function Cy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var xt=z.module("PanelManager");class Rs{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};Gn(this,"layout",void 0),Gn(this,"hydrateComponent",void 0),Gn(this,"dehydrateComponent",void 0),Gn(this,"onPanelsUpdated",void 0),Gn(this,"closed",void 0),Gn(this,"openedMap",void 0),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=e,this.hydrateComponent=t,this.dehydrateComponent=n,this.onPanelsUpdated=o,this.openedMap=new Map(i),this.closed=[...a],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(se.FOCUS,this.handleFocus),e.on(se.MOUNT,this.handleMount),e.on(se.UNMOUNT,this.handleUnmount),e.on(se.REOPEN,this.handleReopen),e.on(se.DELETE,this.handleDeleted),e.on(se.CLOSED,this.handleClosed),e.on(se.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(se.FOCUS,this.handleFocus),e.off(se.MOUNT,this.handleMount),e.off(se.UNMOUNT,this.handleUnmount),e.off(se.REOPEN,this.handleReopen),e.off(se.DELETE,this.handleDeleted),e.off(se.CLOSED,this.handleClosed),e.off(se.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return A.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&Rr(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,n=A.getStackForConfig(this.layout.root,{id:e});return(t=n&&A.getContentItemInStack(n,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),n=t.length-1;n>=0;n-=1){var i=t[n];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(n=>Ma(n)&&t instanceof n.WrappedComponent||!Ma(n)&&t instanceof n))}updatePanel(e){var t=A.getIdFromPanel(e);if(t==null){xt.error("updatePanel Panel did not have an ID",e);return}xt.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=A.getIdFromPanel(e);if(t==null){xt.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){xt.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){xt.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}xt.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(n=>n===e||n.id!=null&&e.id!=null&&n.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){xt.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){xt.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){xt.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){xt.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:i}=e;i=this.hydrateComponent(n,i);var a=ud(ud({},e),{},{props:i}),{root:o}=this.layout;A.openComponent({root:o,config:a,replaceConfig:t})}handleDeleted(e){xt.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){xt.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:n}=this.layout;A.closeComponent(n,t)}addClosedPanel(e){var t=A.getComponentConfigFromContainer(e);if(t&&Rr(t)){var n=this.dehydrateComponent(t.component,t);n!=null&&this.closed.push(n)}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}Gn(Rs,"MAX_CLOSED_PANEL_COUNT",100);var yy=z.module("PanelErrorBoundary");class Sy extends b.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,n=A.getIdFromContainer(e);yy.debug("componentWillUnmount",n),t.emit(se.CLOSED,n,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?h.jsx("div",{className:"panel-error-boundary",children:h.jsx(dn,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function hd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ia(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hd(Object(t),!0).forEach(function(n){wy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function wy(r,e,t){return e=Ey(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ey(r){var e=Py(r,"string");return typeof e=="symbol"?e:String(e)}function Py(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Ls(r){var{props:e,componentState:t}=r,{metadata:n}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var a={};return n!=null&&(a.metadata=n),i!=null&&(a.panelState=i),Ia(Ia({},r),{},{componentState:null,props:a,type:"react-component"})}function As(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return Ia(Ia({},r),{},{localDashboardId:e})}function Tc(r){var e=Ma(r)&&r.WrappedComponent.prototype!=null&&r.WrappedComponent.prototype.isReactComponent!=null||r.prototype!=null&&r.prototype.isReactComponent!=null,t=!Ma(r)&&"$$typeof"in r&&r.$$typeof===Cf.ForwardRef;return e||t}const Ty={dehydrate:Ls,hydrate:As};var _y=Z.createContext(void 0),Oy=O.shape({on:O.func,off:O.func,isHidden:O.bool,tab:O.shape({header:O.shape({tabs:O.arrayOf(O.shape({contentItem:O.shape({})}))})}),title:O.string,setTitle:O.func,close:O.func}),_c=O.shape({on:O.func,off:O.func,emit:O.func}),Dy=O.shape({registerComponent:O.func,root:O.shape({addChild:O.func}),on:O.func,off:O.func,eventHub:_c}),ks=Object.freeze({Container:Oy,EventHub:_c,Layout:Dy});function Pe(r,e,t){b.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}function si(r,e,t,n){var i,a=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(a==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");Z.useEffect(()=>{var o=r(a,e,t,n);return()=>{o()}},[e,n,t,a,r])}function cd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function My(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cd(Object(t),!0).forEach(function(n){Iy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):cd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Iy(r,e,t){return e=Ny(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ny(r){var e=xy(r,"string");return typeof e=="symbol"?e:String(e)}function xy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Fy=Object.freeze({}),Ry=new Map,Oc=r=>r.api,Ly=r=>r.user,Dc=r=>r.storage,Mc=r=>Dc(r).commandHistoryStorage,Ic=r=>Dc(r).fileStorage,Ay=r=>r.defaultWorkspaceSettings,Nc=r=>{var{workspace:e}=r;return e},Ui=r=>{for(var e=Nc(r).data.settings,t=My({},Ay(r)),n=Object.keys(e),i=0;i<n.length;i+=1){var a=n[i];e[a]!==void 0&&(t[a]=e[a])}return t},js=r=>Ui(r).timeZone,ky=r=>{var e;return(e=Ui(r).defaultNotebookSettings)!==null&&e!==void 0?e:Fy},$s=r=>r.activeTool,jy=r=>{var e;return(e=r.plugins)!==null&&e!==void 0?e:Ry},xc="SET_ACTIVE_TOOL",$y="SET_API",Hy="SET_COMMAND_HISTORY_STORAGE",Vy="SET_FILE_STORAGE",Uy="SET_PLUGINS",By="SET_USER",Fc="SET_WORKSPACE",Wy="SET_DEFAULT_WORKSPACE_SETTINGS",Gy="SET_WORKSPACE_STORAGE",zy="SET_SERVER_CONFIG_VALUES";function md(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function rr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?md(Object(t),!0).forEach(function(n){Ky(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):md(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ky(r,e,t){return e=qy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qy(r){var e=Xy(r,"string");return typeof e=="symbol"?e:String(e)}function Xy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Zy=r=>({type:Fc,payload:r}),Yy=r=>(e,t)=>{e(Zy(r));var{storage:n}=t(),{workspaceStorage:i}=n;return i.save(r)},Qy=r=>(e,t)=>{var{workspace:n}=t(),{data:i}=n,a=rr(rr({},n),{},{data:rr(rr(rr({},i),r),{},{settings:rr(rr({},i.settings),r.settings)})});return e(Yy(a))},Jy=r=>e=>e(Qy({settings:r})),Rc=r=>({type:xc,payload:r});function fd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function wo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fd(Object(t),!0).forEach(function(n){eS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function eS(r,e,t){return e=tS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tS(r){var e=nS(r,"string");return typeof e=="symbol"?e:String(e)}function nS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Lc(r,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case r:{var i=n.payload;return i==null?null:t!=null?wo(wo({},t),i):wo({},i)}default:return t}}}function vd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vd(Object(t),!0).forEach(function(n){rS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function rS(r,e,t){return e=iS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function iS(r){var e=aS(r,"string");return typeof e=="symbol"?e:String(e)}function aS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function oS(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i.type){case r:{var{id:a,payload:o}=i;return t&&mr({payload:o},{payload:n[a]})?n:pd(pd({},n),{},{[a]:o})}default:return n}}}function Jn(r,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case r:return n.payload;default:return t}}}const sS=Jn($y,null),lS=Jn(xc,null),dS=Jn(Uy,null),uS=Jn(Hy,null),hS=Jn(Vy,null),cS=Jn(Gy,null),mS=ls({commandHistoryStorage:uS,fileStorage:hS,workspaceStorage:cS}),fS=Lc(By,null),vS=Lc(Fc,null),pS=Jn(Wy,null),gS=Jn(zy,null);var bS={activeTool:lS,api:sS,plugins:dS,storage:mS,user:fS,workspace:vS,defaultWorkspaceSettings:pS,serverConfigValues:gS};const CS=bS;function gd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function bd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gd(Object(t),!0).forEach(function(n){zo(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):gd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function zo(r,e,t){return e=yS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yS(r){var e=SS(r,"string");return typeof e=="symbol"?e:String(e)}function SS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class wS{constructor(){zo(this,"reducers",{}),zo(this,"listener",null)}register(e,t){var n;this.reducers=bd(bd({},this.reducers),{},{[e]:t}),(n=this.listener)===null||n===void 0||n.call(this,this.reducers)}setListener(e){this.listener=e}}var ES=new wS;const Za=ES;var Cd=z.module("redux-logger"),PS=r=>e=>t=>{Cd.debug("dispatching",t);var n=e(t);return Cd.debug("next state",r.getState()),n};const TS=PS;var _S=z.module("redux-crashReporter"),OS=r=>e=>t=>{try{return e(t)}catch(n){throw _S.error("Error executing",t," with state ",r.getState(),":",n),n}};const DS=OS,MS=[TS,DS,yf];var Eo;Object.entries(CS).map(r=>{var[e,t]=r;return Za.register(e,t)});var IS=(Eo=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&Eo!==void 0?Eo:Ef,Ac=Sf(ls(Za.reducers),IS(wf(...MS)));Za.setListener(r=>{Ac.replaceReducer(ls(r))});const NS=Ac;var kc="SET_DASHBOARD_DATA";const xS=oS(kc,{},!1),FS={dashboardData:xS};var RS=new Map,jc=Object.freeze({}),LS=Object.freeze([]),AS=r=>r.dashboardData,st=(r,e)=>{var t;return(t=AS(r)[e])!==null&&t!==void 0?t:jc},kS=(r,e)=>{var t;return(t=st(r,e).closed)!==null&&t!==void 0?t:LS},$c=(r,e)=>{var t;return(t=st(r,e).openedMap)!==null&&t!==void 0?t:RS},Hc=(r,e)=>{var t;return(t=st(r,e).pluginDataMap)!==null&&t!==void 0?t:jc},oM=(r,e,t)=>Hc(r,e)[t];function yd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Lr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yd(Object(t),!0).forEach(function(n){jS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):yd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function jS(r,e,t){return e=$S(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $S(r){var e=HS(r,"string");return typeof e=="symbol"?e:String(e)}function HS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Vc=(r,e)=>({type:kc,id:r,payload:e}),Dn=(r,e)=>(t,n)=>t(Vc(r,Lr(Lr({},st(n(),r)),e))),sM=(r,e,t)=>(n,i)=>n(Vc(r,Lr(Lr({},st(i(),r)),{},{pluginDataMap:Lr(Lr({},Hc(i(),r)),{},{[e]:t})})));Object.entries(FS).map(r=>{var[e,t]=r;return Za.register(e,t)});function VS(r){var{children:e}=r;return h.jsx(h.Fragment,{children:e})}function Sd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function li(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sd(Object(t),!0).forEach(function(n){US(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Sd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function US(r,e,t){return e=BS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function BS(r){var e=WS(r,"string");return typeof e=="symbol"?e:String(e)}function WS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ia=z.module("DashboardLayout"),GS=Object.freeze({}),zS=[],wd=()=>{},Ed=r=>r;function KS(r){var e,t,{id:n,children:i,emptyDashboard:a=h.jsx("div",{children:"Dashboard is empty."}),layout:o,layoutConfig:s=zS,onLayoutChange:l=wd,onLayoutInitialized:d=wd,hydrate:u=As,dehydrate:c=Ls,panelWrapper:m=VS}=r,f=ds(),g=(e=Pf(R=>st(R,n)))!==null&&e!==void 0?e:GS,[v,p]=b.useState(!1),[C,S]=b.useState(!1),[y,w]=b.useState(),[E]=b.useState((t=g==null?void 0:g.closed)!==null&&t!==void 0?t:[]),[D,M]=b.useState(!1),[_,T]=b.useState(o.getReactChildren()),N=b.useMemo(()=>new Map,[]),x=b.useMemo(()=>new Map,[]),F=b.useCallback(function(R,$){var G,te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:u,Me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;ia.debug2("registerComponent",R,$,te,Me);function V(de,Ee){var Le=$,ni=m,wr=Tc(Le),{glContainer:ri,glEventHub:nr}=de;return h.jsx(Sy,{glContainer:ri,glEventHub:nr,children:h.jsx(ni,li(li({},de),{},{children:wr?h.jsx(Le,li(li({},de),{},{ref:Ee})):h.jsx(Le,li({},de))}))})}V.displayName="DashboardWrapper(".concat((G=$.displayName)!==null&&G!==void 0?G:R,")");var ne=o.registerComponent(R,Z.forwardRef(V));return N.set(R,te),x.set(R,Me),ne},[u,c,N,x,o,m]),k=b.useCallback((R,$)=>{var G;return((G=N.get(R))!==null&&G!==void 0?G:Ed)($,n)},[N,n]),U=b.useCallback((R,$)=>{var G;return((G=x.get(R))!==null&&G!==void 0?G:Ed)($,n)},[x,n]),H=b.useMemo(()=>new Rs(o,k,U,new Map,E,R=>{var{closed:$,openedMap:G}=R;f(Dn(n,{closed:$,openedMap:G}))}),[U,f,k,n,E,o]),W=b.useCallback(()=>{if(!C){D||(d(),M(!0));var R=o.toConfig(),$=R.content,G=A.dehydrateLayoutConfig($,U),te=y==null||!A.isEqual(y,G);ia.debug("handleLayoutStateChanged",te,$,G),te&&(p(o.root.contentItems.length===0),w(G),l(G),T(o.getReactChildren()))}},[U,D,C,y,o,l,d]),X=b.useCallback(R=>{var $=A.getIdFromContainer(R);o.eventHub.emit(se.DRAGGING,$),S(!0)},[o.eventHub]),le=b.useCallback(R=>{var $=A.getIdFromContainer(R);o.eventHub.emit(se.DROPPED,$),S(!1)},[o.eventHub]),me=b.useCallback(R=>{if(ia.debug2("handleComponentCreated",R),!(R==null||R.config==null||R.config.component==null||R.element==null)){var $=R.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),G="".concat($,"-component");R.element.addClass(G)}},[]),ve=b.useCallback(()=>{T(o.getReactChildren())},[o]);Pe(o,"stateChanged",W),Pe(o,"itemPickedUp",X),Pe(o,"itemDropped",le),Pe(o,"componentCreated",me),Pe(o.eventHub,se.TITLE_CHANGED,W),Pe(o,"reactChildrenChanged",ve);var j=dp(s);return b.useEffect(function(){if(j!==s&&s!==y){ia.debug("Setting new layout content...");for(var $=A.hydrateLayoutConfig(s,k);o.root.contentItems.length>0;)o.root.contentItems[0].remove();for(var G=0;G<$.length;G+=1)o.root.addChild($[G]);p(o.root.contentItems.length===0)}},[k,o,s,y,H,j]),h.jsxs(h.Fragment,{children:[v&&a,_,Z.Children.map(i,R=>R!=null?Z.cloneElement(R,{id:n,layout:o,panelManager:H,registerComponent:F}):null)]})}KS.propTypes={id:O.string.isRequired,children:O.node,data:O.shape({}),emptyDashboard:O.node,layout:ks.Layout.isRequired,layoutConfig:O.arrayOf(O.shape({})),onLayoutChange:O.func,onLayoutInitialized:O.func};var qS="default";function Pd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function XS(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pd(Object(t),!0).forEach(function(n){ZS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Pd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ZS(r,e,t){return e=YS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function YS(r){var e=QS(r,"string");return typeof e=="symbol"?e:String(e)}function QS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var JS=b.lazy(()=>Ai(()=>import("./IrisGrid-a4f4ebc6.js"),["./IrisGrid-a4f4ebc6.js","./vendor-3c001961.js","./helpers-de833af9.js","./vendor-a4479904.css","./index-02ac7b13.js","./index-7535fde1.css","./usePlugins-2d06e38b.js","./IrisGridThemeProvider-005153c7.js","./IrisGridThemeProvider-ed25ee73.css","./IrisGrid-6e937433.css"],import.meta.url)),Uc=b.forwardRef((r,e)=>h.jsx(b.Suspense,{fallback:h.jsx(dn,{}),children:h.jsx(JS,XS({ref:e},r))}));Uc.displayName="LazyIrisGrid";const Ya=Uc;var Ko;(function(r){r.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS="filter-control-change-clears-all-filters",r.LINK_CHANGE_CLEARS_ALL_FILTERS="link-change-clears-all-filters"})(Ko||(Ko={}));const Td=Ko;var ew=Object.freeze([[Td.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS,!1],[Td.LINK_CHANGE_CLEARS_ALL_FILTERS,!1]]);const Bc={DEFAULTS:ew};var qo;(function(r){r.COUNT="Count",r.MIN="Min",r.MAX="Max",r.SUM="Sum",r.ABS_SUM="AbsSum",r.VAR="Var",r.AVG="Avg",r.STD="Std",r.FIRST="First",r.LAST="Last",r.SKIP="Skip",r.COUNT_DISTINCT="CountDistinct",r.DISTINCT="Distinct",r.UNIQUE="Unique"})(qo||(qo={}));const be=qo;var lM=[be.SUM,be.ABS_SUM,be.MIN,be.MAX,be.VAR,be.AVG,be.STD,be.FIRST,be.LAST,be.COUNT_DISTINCT,be.DISTINCT,be.COUNT,be.UNIQUE],tw=r=>{switch(r){default:return!1}},nw=(r,e)=>{switch(r){case be.COUNT:case be.FIRST:case be.LAST:case be.COUNT_DISTINCT:case be.DISTINCT:case be.UNIQUE:return!0;case be.MIN:case be.MAX:return P.isNumberType(e)||P.isDateType(e)||P.isTextType(e);case be.SUM:case be.ABS_SUM:case be.VAR:case be.AVG:case be.STD:return P.isNumberType(e);case be.SKIP:return!1}},Wc=(r,e)=>r.filter(t=>t.isProxy!==!0&&nw(e,t.type)),rw=(r,e,t,n)=>Wc(r,e).map(i=>{var{name:a}=i;return a}).filter(i=>t.includes(i)?!n:n);const _d={isRollupOperation:tw,filterValidColumns:Wc,getOperationColumnNames:rw};function iw(r,e,t){return e=aw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function aw(r){var e=ow(r,"string");return typeof e=="symbol"?e:String(e)}function ow(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class sw extends Error{constructor(){super(...arguments),iw(this,"isAssertionFailed",!0)}}const lw=sw;function Hn(r){return(r==null?void 0:r.isEditable)!==void 0}function dM(r){if(!Hn(r))throw new lw("Expected 'model' to be editable, but received ".concat(r))}function yn(r){return(r==null?void 0:r.hasExpandableRows)!==void 0}function vi(r,e,t){return e=dw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dw(r){var e=uw(r,"string");return typeof e=="symbol"?e:String(e)}function uw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Xo;(function(r){r.DOWN="DOWN",r.UP="UP",r.LEFT="LEFT",r.RIGHT="RIGHT"})(Xo||(Xo={}));class B{static normalize(e,t,n,i){var a=e,o=t,s=n,l=i;return a!=null&&s!=null&&s<a&&(a=s,s=e),o!=null&&l!=null&&l<o&&(o=l,l=t),[a,o,s,l]}static makeNormalized(e,t,n,i){return new B(...B.normalize(e,t,n,i))}static makeCell(e,t){return new B(e,t,e,t)}static makeColumn(e){return new B(e,null,e,null)}static makeRow(e){return new B(null,e,null,e)}static minOrNull(e,t){return e==null||t==null?null:Math.min(e,t)}static maxOrNull(e,t){return e==null||t==null?null:Math.max(e,t)}static consolidate(e){for(var t=e.slice(),n=!0;n;){n=!1;for(var i=0;i<t.length&&!n;i+=1)for(var a=t[i],o=t.length-1;o>i;o-=1){var s=t[o];if(a.contains(s))t.splice(o,1);else if(s.contains(a)){n=!0,t[i]=s,t.splice(o,1);break}else if(a.startRow===s.startRow&&a.endRow===s.endRow){if(a.touches(s)){var{startRow:l,endRow:d}=a,u=B.minOrNull(a.startColumn,s.startColumn),c=B.maxOrNull(a.endColumn,s.endColumn);n=!0,t[i]=new B(u,l,c,d),t.splice(o,1);break}}else if(a.startColumn===s.startColumn&&a.endColumn===s.endColumn&&a.touches(s)){var{startColumn:m,endColumn:f}=a,g=B.minOrNull(a.startRow,s.startRow),v=B.maxOrNull(a.endRow,s.endRow);n=!0,t[i]=new B(m,g,f,v),t.splice(o,1);break}}}return t}static isAxisRangeTouching(e,t,n,i){return e==null?t==null||n==null?!0:n<=t+1:t==null?i==null?!0:i>=e-1:n==null?i==null?!0:e<=i+1:i==null?t>=n-1:n>=e-1?n<=t+1:i>=e-1}static rangeArraysEqual(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(var n=0;n<e.length;n+=1)if(!e[n].equals(t[n]))return!1;return!0}static intersection(e,t){var n,i,a,o,s,l;if(e.equals(t))return e;var{startColumn:d,startRow:u,endColumn:c,endRow:m}=e;return d=d!=null&&t.startColumn!=null?Math.max(d,t.startColumn):(n=d)!==null&&n!==void 0?n:t.startColumn,c=c!=null&&t.endColumn!=null?Math.min(c,t.endColumn):(i=c)!==null&&i!==void 0?i:t.endColumn,u=u!=null&&t.startRow!=null?Math.max(u,t.startRow):(a=u)!==null&&a!==void 0?a:t.startRow,m=m!=null&&t.endRow!=null?Math.min(m,t.endRow):(o=m)!==null&&o!==void 0?o:t.endRow,d!=null&&d>((s=c)!==null&&s!==void 0?s:-1)||u!=null&&u>((l=m)!==null&&l!==void 0?l:-1)?null:new B(d,u,c,m)}static subtractFromRange(e,t){var n=[],i=B.intersection(e,t);return i==null?[e]:(i.startRow!=null&&(e.startRow==null||e.startRow<i.startRow)&&n.push(new B(e.startColumn,e.startRow,e.endColumn,i.startRow-1)),i.startColumn!=null&&(e.startColumn==null||e.startColumn<i.startColumn)&&n.push(new B(e.startColumn,i.startRow,i.startColumn-1,i.endRow)),i.endColumn!=null&&(e.endColumn==null||e.endColumn>i.endColumn)&&n.push(new B(i.endColumn+1,i.startRow,e.endColumn,i.endRow)),i.endRow!=null&&(e.endRow==null||e.endRow>i.endRow)&&n.push(new B(e.startColumn,i.endRow+1,e.endColumn,e.endRow)),n)}static subtractFromRanges(e,t){for(var n=[],i=0;i<e.length;i+=1)n.push(...B.subtractFromRange(e[i],t));return n}static subtractRangesFromRanges(e,t){for(var n=[...e],i=0;i<t.length;i+=1)n=B.subtractFromRanges(n,t[i]);return n}static isBounded(e){return e.startRow!=null&&e.startColumn!=null&&e.endRow!=null&&e.endColumn!=null}static boundedRange(e,t,n){var i,a,o,s;return B.isBounded(e)?e:new B((i=e.startColumn)!==null&&i!==void 0?i:0,(a=e.startRow)!==null&&a!==void 0?a:0,(o=e.endColumn)!==null&&o!==void 0?o:t-1,(s=e.endRow)!==null&&s!==void 0?s:n-1)}static boundedRanges(e,t,n){return e.map(i=>B.boundedRange(i,t,n))}static offset(e,t,n){return new B(e.startColumn!=null?e.startColumn+t:null,e.startRow!=null?e.startRow+n:null,e.endColumn!=null?e.endColumn+t:null,e.endRow!=null?e.endRow+n:null)}static nextCell(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:B.SELECTION_DIRECTION.DOWN;if(e.length===0)return null;var a=-1;if(t!=null&&n!=null&&(a=e.findIndex(m=>m.containsCell(t,n)),a>=0)){var o=e[a],s=o.nextCell(t,n,i);if(s!=null)return s}switch(i){case B.SELECTION_DIRECTION.DOWN:case B.SELECTION_DIRECTION.RIGHT:{var l=a<e.length-1?a+1:0,d=e[l];return d.startCell(i)}case B.SELECTION_DIRECTION.LEFT:case B.SELECTION_DIRECTION.UP:{var u=a>0?a-1:e.length-1,c=e[u];return c.startCell(i)}default:throw new Error("Invalid direction: ".concat(i))}}static cellCount(e){return e.reduce((t,n)=>{var i,a,o,s;return t+(((i=n.endRow)!==null&&i!==void 0?i:NaN)-((a=n.startRow)!==null&&a!==void 0?a:NaN)+1)*(((o=n.endColumn)!==null&&o!==void 0?o:NaN)-((s=n.startColumn)!==null&&s!==void 0?s:NaN)+1)},0)}static rowCount(e){return e.reduce((t,n)=>{var i,a;return t+((i=n.endRow)!==null&&i!==void 0?i:NaN)-((a=n.startRow)!==null&&a!==void 0?a:NaN)+1},0)}static columnCount(e){return e.reduce((t,n)=>{var i,a;return t+((i=n.endColumn)!==null&&i!==void 0?i:NaN)-((a=n.startColumn)!==null&&a!==void 0?a:NaN)+1},0)}static containsCell(e,t,n){for(var i=0;i<e.length;i+=1){var a=e[i];if(a.containsCell(t,n))return!0}return!1}static forEachCell(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:B.SELECTION_DIRECTION.RIGHT,i=0;i<e.length;i+=1)e[i].forEach(t,n)}constructor(e,t,n,i){vi(this,"startColumn",void 0),vi(this,"startRow",void 0),vi(this,"endColumn",void 0),vi(this,"endRow",void 0),this.startColumn=e,this.startRow=t,this.endColumn=n,this.endRow=i}equals(e){return this.startColumn===e.startColumn&&this.startRow===e.startRow&&this.endColumn===e.endColumn&&this.endRow===e.endRow}contains(e){return(this.startColumn==null||e.startColumn!=null&&this.startColumn<=e.startColumn)&&(this.startRow==null||e.startRow!=null&&this.startRow<=e.startRow)&&(this.endColumn==null||e.endColumn!=null&&this.endColumn>=e.endColumn)&&(this.endRow==null||e.endRow!=null&&this.endRow>=e.endRow)}containsCell(e,t){return e==null||t==null?!1:(this.startColumn==null||this.startColumn<=e)&&(this.endColumn==null||this.endColumn>=e)&&(this.startRow==null||this.startRow<=t)&&(this.endRow==null||this.endRow>=t)}touches(e){return B.isAxisRangeTouching(this.startRow,this.endRow,e.startRow,e.endRow)&&B.isAxisRangeTouching(this.startColumn,this.endColumn,e.startColumn,e.endColumn)}subtract(e){return B.subtractFromRange(this,e)}startCell(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B.SELECTION_DIRECTION.DOWN;if(!B.isBounded(this))throw new Error("Cannot get the startCell of an unbounded range");switch(e){case B.SELECTION_DIRECTION.DOWN:case B.SELECTION_DIRECTION.RIGHT:return{column:this.startColumn,row:this.startRow};case B.SELECTION_DIRECTION.LEFT:case B.SELECTION_DIRECTION.UP:return{column:this.endColumn,row:this.endRow};default:throw new Error("Invalid direction: ".concat(e))}}nextCell(e,t,n){if(!B.isBounded(this))throw new Error("Bounded range required");if(e==null||t==null)throw new Error("Require a non-null cursor");var{startColumn:i,endColumn:a,startRow:o,endRow:s}=this;switch(n){case B.SELECTION_DIRECTION.DOWN:if(t<s)return{column:e,row:Math.max(t+1,o)};if(e<a)return{column:Math.max(e+1,i),row:o};break;case B.SELECTION_DIRECTION.UP:if(t>o)return{column:e,row:Math.min(t-1,s)};if(e>i)return{column:Math.min(e-1,a),row:s};break;case B.SELECTION_DIRECTION.RIGHT:if(e<a)return{column:Math.max(e+1,i),row:t};if(t<s)return{column:i,row:Math.max(t+1,o)};break;case B.SELECTION_DIRECTION.LEFT:if(e>i)return{column:Math.min(e-1,a),row:t};if(t>o)return{column:a,row:Math.min(t-1,s)};break;default:throw new Error("Invalid direction: ".concat(n))}return null}forEach(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:B.SELECTION_DIRECTION.RIGHT,n=0,{column:i,row:a}=this.startCell(t);i!=null&&a!=null;){var o;e(i,a,n),n+=1,{column:i,row:a}=(o=this.nextCell(i,a,t))!==null&&o!==void 0?o:{}}}}vi(B,"SELECTION_DIRECTION",Xo);function hw(r){return Array.isArray(r)&&r.length===2&&(r[0]===null||typeof r[0]=="number")&&(r[1]===null||typeof r[1]=="number")}function aa(r){return hw(r)&&r[0]!=null&&r[1]!=null}function Od(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function oa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Od(Object(t),!0).forEach(function(n){Gc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Od(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Gc(r,e,t){return e=cw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cw(r){var e=mw(r,"string");return typeof e=="symbol"?e:String(e)}function mw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function uM(r){return(r==null?void 0:r.href)!==void 0}class ee{static getGridPointFromXY(e,t,n){var i=ee.getColumnAtX(e,n),a=ee.getRowAtY(t,n),o=ee.getColumnHeaderDepthAtY(t,n);return{x:e,y:t,row:a,column:i,columnHeaderDepth:o}}static getCellInfoFromXY(e,t,n){var{row:i,column:a}=ee.getGridPointFromXY(e,t,n),{allColumnWidths:o,allRowHeights:s,allColumnXs:l,allRowYs:d,modelColumns:u,modelRows:c}=n,m=i!==null?c.get(i):null,f=a!==null?u.get(a):null,g=a!==null?l.get(a):null,v=i!==null?d.get(i):null,p=a!==null?o.get(a):null,C=i!==null?s.get(i):null;return{row:i,column:a,modelRow:m??null,modelColumn:f??null,left:g??null,top:v??null,columnWidth:p??null,rowHeight:C??null}}static getColumnHeaderDepthAtY(e,t){var n=ee.getRowAtY(e,t),{columnHeaderHeight:i,columnHeaderMaxDepth:a}=t;if(n===null&&e<=i*a)return Kt(a-Math.ceil(e/i),0,a-1)}static iterateFloatingStart(e,t,n){for(var i=0;i<e&&i<t;i+=1){var a=n(i);if(a!==void 0)return a}}static iterateFloatingEnd(e,t,n){for(var i=0;i<e&&t-(e-i)>=0;i+=1){var a=n(t-(e-i));if(a!==void 0)return a}}static iterateFloating(e,t,n,i){var a=ee.iterateFloatingStart(e,n,i);return a!==void 0?a:ee.iterateFloatingEnd(t,n,i)}static iterateAllItems(e,t,n,i,a,o){var s=Math.max(e,n),l=Math.min(t,a-i-1),d=ee.iterateFloating(n,i,a,o);if(d!==void 0)return d;for(var u=s;u<=l;u+=1)if(d=o(u),d!==void 0)return d}static isInItem(e,t,n,i){var a,o,s=(a=t.get(e))!==null&&a!==void 0?a:0,l=(o=n.get(e))!==null&&o!==void 0?o:0;return s<=i&&i<=s+l}static getItemAtOffset(e,t,n,i,a,o,s){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,d=l?void 0:ee.iterateFloating(n,i,t,m=>{if(ee.isInItem(m,o,s,e))return m});if(!l&&d!==void 0)return d;for(var u=0;u<a.length;u+=1){var c=a[u];if(ee.isInItem(c,o,s,e))return c}return null}static getColumnAtX(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,{columnCount:i,floatingLeftColumnCount:a,floatingRightColumnCount:o,visibleColumns:s,allColumnXs:l,allColumnWidths:d,gridX:u}=t;return e<u?null:this.getItemAtOffset(e-u,i,a,o,s,l,d,n)}static getRowAtY(e,t){var{floatingTopRowCount:n,floatingBottomRowCount:i,rowCount:a,visibleRows:o,allRowYs:s,allRowHeights:l,gridY:d}=t;return e<d?null:this.getItemAtOffset(e-d,a,n,i,o,s,l)}static getNextShownItem(e,t,n,i){var a=n.findIndex(l=>l===e)||0;for(a-=1;a!=null&&a>=0;){var o=n[a],s=t.get(o);if(s!=null&&i.get(s)!==0)return o;a-=1}return null}static getNextShownColumn(e,t){var{modelColumns:n,visibleColumns:i,userColumnWidths:a}=t;return ee.getNextShownItem(e,n,i,a)}static getNextShownRow(e,t){var{modelRows:n,visibleRows:i,userRowHeights:a}=t;return ee.getNextShownItem(e,n,i,a)}static getColumnSeparatorIndex(e,t,n,i){var{rowHeaderWidth:a,columnHeaderHeight:o,floatingColumns:s,floatingLeftWidth:l,visibleColumns:d,allColumnXs:u,allColumnWidths:c,columnHeaderMaxDepth:m}=n,{allowColumnResize:f,headerSeparatorHandleSize:g}=i;if(m*o<t||!f||g<=0)return null;for(var v=e-a,p=g*.5,C=!1,S=s.length-1;S>=0;S-=1){var y,w,E=s[S],D=(y=u.get(E))!==null&&y!==void 0?y:0,M=(w=c.get(E))!==null&&w!==void 0?w:0,_=M===0;if(!C||!_){var T=D+M;_?T+=p:C&&(T-=p);var N=T-p,x=T+p;if(N<=v&&v<=x)return E;C=_}}C=!1;for(var F=d.length-1;F>=0;F-=1){var k,U,H=d[F],W=(k=u.get(H))!==null&&k!==void 0?k:0,X=(U=c.get(H))!==null&&U!==void 0?U:0,le=X===0;if(W<l-X)return null;if(!C||!le){var me=W+X;le?me+=p:C&&(me-=p);var ve=me-p,j=me+p;if(ve<=v&&v<=j)return H;C=le}}return null}static isItemHidden(e,t){return t.get(e)===0}static isColumnHidden(e,t){var{allColumnWidths:n}=t;return ee.isItemHidden(e,n)}static isFloatingRow(e,t){if(e==null)return!1;var{floatingTopRowCount:n,floatingBottomRowCount:i,rowCount:a}=t;return e<n||e>=a-i}static isFloatingColumn(e,t){if(e==null)return!1;var{floatingLeftColumnCount:n,floatingRightColumnCount:i,columnCount:a}=t;return e<n||e>=a-i}static getHiddenItems(e,t,n){if(!ee.isItemHidden(e,t))return[];for(var i=[e],a=n.findIndex(l=>l===e),o=a-1;o>=0;o-=1){var s=n[o];if(!ee.isItemHidden(s,t))break;i.push(s)}return i}static getHiddenColumns(e,t){var{visibleColumns:n,allColumnWidths:i}=t;return ee.getHiddenItems(e,i,n)}static getRowSeparatorIndex(e,t,n,i){var{rowHeaderWidth:a,columnHeaderHeight:o,visibleRows:s,allRowYs:l,allRowHeights:d}=n,{allowRowResize:u,headerSeparatorHandleSize:c}=i;if(a<e||!u||c<=0)return null;for(var m=t-o,f=c*.5,g=!1,v=s.length-1;v>=0;v-=1){var p,C,S=s[v],y=(p=l.get(S))!==null&&p!==void 0?p:0,w=(C=d.get(S))!==null&&C!==void 0?C:0,E=w===0;if(!g||!E){var D=y+w;E?D+=f:g&&(D-=f);var M=D-f,_=D+f;if(M<=m&&m<=_)return S;g=E}}return null}static isRowHidden(e,t){var{allRowHeights:n}=t;return ee.isItemHidden(e,n)}static getHiddenRows(e,t){var{visibleRows:n,allRowHeights:i}=t;return ee.getHiddenItems(e,i,n)}static moveItem(e,t,n){if(e===t)return[...n];var i=[...n],a=i[i.length-1];return a!=null&&!aa(a.from)&&a.to===e?a.from===t?i.pop():i[i.length-1]=oa(oa({},a),{},{to:t}):i.push({from:e,to:t}),i}static moveRange(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e[0]===e[1])return ee.moveItem(e[0],t,n);var a=t;if(i&&e[0]<t&&(a-=e[1]-e[0]),e[0]===a)return[...n];var o=[...n],s=o[o.length-1];s!=null&&aa(s.from)&&s.from[1]-s.from[0]===e[1]-e[0]&&s.to===e[0]?o[o.length-1]=oa(oa({},s),{},{to:a}):o.push({from:e,to:a});var l=o[o.length-1];return aa(l.from)&&l.from[0]===l.to&&o.pop(),o}static moveItemOrRange(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return Array.isArray(e)?ee.moveRange(e,t,n,i):ee.moveItem(e,t,n)}static applyItemMoves(e,t,n){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=[[e,t]],o=function(){var{from:d,to:u}=n[s],c=1,m;aa(d)?(c=d[1]-d[0]+1,[m]=d):m=d;for(var f=i?u:m,g=f+c-1,v=i?m:u,p=v-f,C=[],S=function(){var E,D,M=(E=a[y][0])!==null&&E!==void 0?E:Number.NEGATIVE_INFINITY,_=(D=a[y][1])!==null&&D!==void 0?D:Number.POSITIVE_INFINITY,T,N=[[M,f-1],[f,g],[g+1,_]].map(x=>{var[F,k]=x;return[Math.max(F,M),Math.min(k,_)]}).filter(x=>{var[F,k]=x;return F<=k}).map(x=>{var[F,k]=x;return f<=F&&g>=k?(T=[F+p,k+p],T):g<F?[F-c,k-c]:x}).map(x=>{var[F,k]=x;return v>F&&v<=k?[[F,v-1],[v+c,k+c]]:x===T?[x]:v<=F?[[F+c,k+c]]:[x]}).flat();C.push(...N)},y=0;y<a.length;y+=1)S();a=C.map(w=>{var[E,D]=w;return[Number.isFinite(E)?E:null,Number.isFinite(D)?D:null]})},s=i?n.length-1:0;i?s>=0:s<n.length;i?s-=1:s+=1)o();return a}static translateRange(e,t,n,i){for(var a=ee.applyItemMoves(e.startColumn,e.endColumn,t,i),o=ee.applyItemMoves(e.startRow,e.endRow,n,i),s=[],l=0;l<a.length;l+=1)for(var d=a[l],u=0;u<o.length;u+=1){var c=o[u];s.push(new B(d[0],c[0],d[1],c[1]))}return s}static getModelIndex(e,t){var n=ee.applyItemMoves(e,e,t,!0)[0][0];return n}static getModelIndexes(e,t){return e.map(n=>ee.getModelIndex(n,t))}static getModelRangeIndexes(e,t,n){return ee.applyItemMoves(e,t,n,!0)}static getModelRange(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oe,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe;return ee.translateRange(e,t,n,!0)}static getModelRanges(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oe,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe,i=[],a=0;a<e.length;a+=1)i.push(...ee.getModelRange(e[a],t,n));return i}static getVisibleRangeIndexes(e,t,n){return ee.applyItemMoves(e,t,n,!1)}static getVisibleRange(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oe,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe;return this.translateRange(e,t,n,!1)}static getVisibleRanges(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oe,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe,i=[],a=0;a<e.length;a+=1)i.push(...ee.getVisibleRange(e[a],t,n));return i}static getVisibleIndex(e,t){var n=ee.applyItemMoves(e,e,t)[0][0];return n}static getVisibleIndexes(e,t){return e.map(n=>ee.getVisibleIndex(n,t))}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return ee.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=ee.getModifierKey();return e[t]}static checkColumnHidden(e,t){return t.get(e)===0}static checkAllColumnsHidden(e,t){return t.size===0?!1:e.every(n=>t.get(n)===0)}static getScrollDragBounds(e,t,n){var{gridX:i,gridY:a,width:o,height:s,floatingTopRowCount:l,floatingBottomRowCount:d,floatingLeftColumnCount:u,floatingRightColumnCount:c,floatingLeftWidth:m,floatingRightWidth:f,floatingTopHeight:g,floatingBottomHeight:v,columnCount:p,rowCount:C}=e,S=i,y=a,w=o,E=s;return n!=null&&(n>u&&(S+=m),n<p-c&&(w-=f)),t!=null&&(t>l&&(y+=g),t<C-d&&(E-=v)),{x1:S,y1:y,x2:w,y2:E}}static getScrollDelta(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1024,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:768,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:20,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:20,{deltaX:o,deltaY:s}=e;return!ee.isMacPlatform()&&e.shiftKey&&e.deltaX===0&&e.deltaY!==0&&(o=e.deltaY,s=e.deltaX),(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_PAGE?(o*=t,s*=n):(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_LINE&&(ee.isMacPlatform()?(o=Math.round(o*i),s=Math.round(s*a)):(o=Math.round(o*this.PIXELS_PER_LINE),s=Math.round(s*this.PIXELS_PER_LINE))),{deltaX:o,deltaY:s}}static compareRanges(e,t){return e[0]==null||e[1]==null||t[0]==null||t[1]==null?0:e[0]!==t[0]?e[0]-t[0]:e[1]-t[1]}static mergeSortedRanges(e){for(var t=[],n=0;n<e.length;n+=1){var i=e[n],a=i[0],o=i[1];n===0?t.push([a,o]):a-1<=t[t.length-1][1]?t[t.length-1][1]=Math.max(t[t.length-1][1],o):t.push([a,o])}return t}static translateTokenBox(e,t){var{x1:n,y1:i,x2:a,y2:o}=e,{gridX:s,gridY:l,width:d,height:u,verticalBarWidth:c,horizontalBarHeight:m}=t,f=Kt(s+n,s,d-c),g=Kt(s+a,s,d-c),v=Kt(l+i,l,u-m),p=Kt(l+o,l,u-m);return{x1:f,y1:v,x2:g,y2:p,token:e.token}}static getTextRenderMetrics(e,t,n){var{metrics:i,model:a,theme:o}=e,{firstColumn:s,allColumnXs:l,allColumnWidths:d,allRowYs:u,allRowHeights:c,modelRows:m,modelColumns:f}=i,{cellHorizontalPadding:g,treeDepthIndent:v,treeHorizontalPadding:p}=o,C=Er(m,n),S=Er(f,t),y=a.textAlignForCell(S,C),w=Er(l,t),E=Er(u,n),D=Er(d,t),M=Er(c,n),_=t===s,T=0;yn(a)&&a.hasExpandableRows&&_&&(T=v*(a.depthForRow(n)+1)+p);var N=D-T,x=w+g,F=E+M*.5;return y==="right"?x=w+N-g:y==="center"&&(x=w+N*.5),x+=T,{width:N-g*2,x,y:F}}static findTokensWithProtocolInText(e){var t=Ph(e);return t.filter(n=>n.type==="url"?/^https?:\/\//.test(n.value):!0)}}Gc(ee,"PIXELS_PER_LINE",100/3);const Dd=ee;function Md(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Id(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Md(Object(t),!0).forEach(function(n){fw(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Md(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function fw(r,e,t){return e=vw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vw(r){var e=pw(r,"string");return typeof e=="symbol"?e:String(e)}function pw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var gw=(r,e)=>{var t=!1,n=qe(r,Id(Id({},e),{},{dispose:()=>{t||(t=!0,n.clear(),t=!1)}}));return n};const Zo=gw;function bw(r,e,t){return e=Cw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cw(r){var e=yw(r,"string");return typeof e=="symbol"?e:String(e)}function yw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Po=5e3;class Sw extends ss{constructor(){super(...arguments),bw(this,"getCachedTokensInText",Zo((e,t)=>{if(t>=e.length)return Dd.findTokensWithProtocolInText(e);var n=e.slice(t-1,Po).search(/\s/),i=t+n;n===-1&&(i=Math.min(Po,e.length));var a=e.substring(0,i);return Dd.findTokensWithProtocolInText(a)}))}get floatingTopRowCount(){return 0}get floatingBottomRowCount(){return 0}get floatingLeftColumnCount(){return 0}get floatingRightColumnCount(){return 0}get columnHeaderMaxDepth(){return 1}truncationCharForCell(e,t){}textAlignForCell(e,t){return"left"}colorForCell(e,t,n){return n.textColor}backgroundColorForCell(e,t,n){return null}colorForColumnHeader(e){return null}textForRowHeader(e){return""}textForRowFooter(e){return""}isColumnMovable(e){return!0}isRowMovable(e){return!0}getColumnHeaderGroup(e,t){}getColumnHeaderParentGroup(e,t){}tokensForCell(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Po,i=this.textForCell(e,t);return this.getCachedTokensInText(i,n)}renderTypeForCell(e,t){return"text"}}const ww=Sw;function Yo(r,e,t){return e=Ew(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ew(r){var e=Pw(r,"string");return typeof e=="symbol"?e:String(e)}function Pw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ir=[];class zc extends ww{constructor(e){super(),Yo(this,"dh",void 0),Yo(this,"listenerCount",void 0),this.dh=e,this.listenerCount=0}addEventListener(e,t,n){super.addEventListener(e,t,n),this.listenerCount+=1,this.listenerCount===1&&this.startListening()}removeEventListener(e,t,n){super.removeEventListener(e,t,n),this.listenerCount-=1,this.listenerCount===0&&this.stopListening()}startListening(){}stopListening(){}get groupedColumns(){return ir}get originalColumns(){return this.columns}sourceForCell(e,t){return{column:e,row:t}}getClearFilterRange(e){return this.isFilterable(e)?[e,e]:null}get initialMovedColumns(){return ir}get initialMovedRows(){return ir}get initialColumnHeaderGroups(){return ir}get layoutHints(){return null}get frontColumns(){return ir}get backColumns(){return ir}get frozenColumns(){return ir}isColumnFrozen(e){return!1}isColumnSortable(e){return!1}get isFilterRequired(){return!1}get isReversible(){return!0}get isColumnStatisticsAvailable(){return!1}get description(){return""}get isCustomColumnsAvailable(){return!1}get isFormatColumnsAvailable(){return!1}get isExportAvailable(){return!1}get isValuesTableAvailable(){return!1}get isChartBuilderAvailable(){return!1}get isRollupAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isTotalsAvailable(){return!1}isFilterable(e){return!1}close(){}isRowMovable(){return!1}get isSeekRowAvailable(){return!1}dataBarOptionsForCell(e,t,n){throw new Error("Method not implemented.")}}Yo(zc,"EVENT",Object.freeze({UPDATED:"UPDATED",FORMATTER_UPDATED:"FORMATTER_UPDATED",REQUEST_FAILED:"REQUEST_FAILED",COLUMNS_CHANGED:"COLUMNS_CHANGED",TABLE_CHANGED:"TABLE_CHANGED",FILTERS_CHANGED:"FILTERS_CHANGED",SORTS_CHANGED:"SORTS_CHANGED",DISCONNECT:"DISCONNECT",RECONNECT:"RECONNECT",TOTALS_UPDATED:"TOTALS_UPDATED",PENDING_DATA_UPDATED:"PENDING_DATA_UPDATED"}));const ce=zc;function Vn(r,e,t){return e=Tw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Tw(r){var e=_w(r,"string");return typeof e=="symbol"?e:String(e)}function _w(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ow=z.module("ColumnHeaderGroup");function To(r){return r instanceof Bi}class Bi{constructor(e){var{name:t,children:n,color:i,depth:a,childIndexes:o,parent:s}=e;Vn(this,"name",void 0),Vn(this,"children",void 0),Vn(this,"depth",void 0),Vn(this,"parent",void 0),Vn(this,"color",void 0),Vn(this,"childIndexes",void 0),Vn(this,"getVisibleRange",oe(l=>{var d=this.childIndexes.flat(),u=ee.getVisibleIndexes(d,l),c=Math.min(...u),m=Math.max(...u);return m-c!==d.length-1&&Ow.warn("Column header group ".concat(this.name," is not contiguous")),[c,m]})),this.name=t,this.children=n,this.color=i??void 0,this.depth=a,this.childIndexes=o,this.parent=s}setParent(e){this.parent=e}addChildren(e){var t=new Set(this.children.concat(e));this.children=[...t]}removeChildren(e){var t=new Set(this.children);e.forEach(n=>t.delete(n)),this.children=[...t]}get isNew(){return this.name.startsWith(Bi.NEW_GROUP_PREFIX)}}Vn(Bi,"NEW_GROUP_PREFIX",":newGroup");function nn(r){return(r==null?void 0:r.isPartitionRequired)!==void 0&&(r==null?void 0:r.partitionColumns)!==void 0&&(r==null?void 0:r.partitionKeysTable)!==void 0&&(r==null?void 0:r.partitionMergedTable)!==void 0&&(r==null?void 0:r.partitionTable)!==void 0}function hM(r){return nn(r)&&r.partitionConfig!==void 0}var Dw=["selectedValues"],Mw=["selectedValues"];function Nd(r,e){if(r==null)return{};var t=Iw(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function Iw(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function xd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function yt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xd(Object(t),!0).forEach(function(n){Qo(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Qo(r,e,t){return e=Nw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Nw(r){var e=xw(r,"string");return typeof e=="symbol"?e:String(e)}function xw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var di=z.module("IrisGridUtils");function cM(r){return r.partition!==void 0}function Fd(r){return Array.isArray(r.partitions)}function Fn(r,e){return r>=0&&r<e.length}function Fw(r){return(r==null?void 0:r.asDate)!=null}class _e{static dehydrateGridState(e,t){var{isStuckToBottom:n,isStuckToRight:i,movedColumns:a,movedRows:o}=t,{columns:s}=e;return{isStuckToBottom:n,isStuckToRight:i,movedColumns:[...a].filter(l=>{var{to:d,from:u}=l;return Fn(d,s)&&(typeof u=="number"&&Fn(u,s)||Array.isArray(u)&&Fn(u[0],s)&&Fn(u[1],s))}).map(l=>{var{to:d,from:u}=l;return{to:s[d].name,from:Array.isArray(u)?[s[u[0]].name,s[u[1]].name]:s[u].name}}),movedRows:[...o]}}static hydrateGridState(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],{isStuckToBottom:i,isStuckToRight:a,movedColumns:o,movedRows:s}=t,{columns:l}=e,d=_e.parseCustomColumnNames(n),u=l.map(c=>{var{name:m}=c;return m}).concat(d);return{isStuckToBottom:i,isStuckToRight:a,movedColumns:[...o].map(c=>{var{to:m,from:f}=c,g=v=>typeof v=="string"?u.findIndex(p=>p===v):v;return{to:g(m),from:Array.isArray(f)?[g(f[0]),g(f[1])]:g(f)}}).filter(c=>{var{to:m,from:f}=c;return Fn(m,u)&&(typeof f=="number"&&Fn(f,u)||Array.isArray(f)&&Fn(f[0],u)&&Fn(f[1],u))}),movedRows:[...s]}}static dehydrateIrisGridPanelState(e,t){var{isSelectingPartition:n,partitions:i,advancedSettings:a}=t;return{isSelectingPartition:n,partitions:i,advancedSettings:[...a]}}static hydrateIrisGridPanelState(e,t){var{isSelectingPartition:n,advancedSettings:i}=t,a=Fd(t)?t.partitions:[t.partition];return{isSelectingPartition:n,partitions:a,advancedSettings:new Map([...Bc.DEFAULTS,...i])}}static dehydrateQuickFilters(e){return[...e].map(t=>{var[n,i]=t,{text:a}=i;return[n,{text:a}]})}static dehydrateLong(e){return e!=null?"".concat(e):null}static dehydrateSort(e){return e.map(t=>{var{column:n,isAbs:i,direction:a}=t;return{column:n.name,isAbs:i,direction:a}})}static extractTableSettings(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],{irisGridPanelState:n,irisGridState:i}=e,a=Fd(n)?n.partitions:[n.partition],{advancedFilters:o,quickFilters:s,sorts:l}=i;return{advancedFilters:o,inputFilters:t,partitions:a,quickFilters:s,sorts:l}}static getInputFiltersForColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.filter(n=>{var{name:i,type:a}=n;return e.find(o=>{var{name:s,type:l}=o;return s===i&&l===a})})}static getFiltersFromFilterMap(e){for(var t=[],n=Array.from(e.keys()),i=0;i<n.length;i+=1){var a=n[i],o=e.get(a);(o==null?void 0:o.filter)!=null&&t.push(o.filter)}return t}static getHiddenColumns(e){return[...e.entries()].filter(t=>{var[,n]=t;return n===0}).map(t=>{var[n]=t;return n})}static parseCustomColumnNames(e){return e.map(t=>t.split("=")[0])}static getRemovedCustomColumnNames(e,t){var n=_e.parseCustomColumnNames(e),i=_e.parseCustomColumnNames(t);return n.filter(a=>!i.includes(a))}static removeSortsInColumns(e,t){return e.filter(n=>!t.includes(n.column.name))}static removeFiltersInColumns(e,t,n){var i=e.map(o=>{var{name:s}=o;return s}),a=new Map(t);return n.forEach(o=>a.delete(i.indexOf(o))),a}static removeColumnFromMovedColumns(e,t,n){for(var i=e.map(l=>{var{name:d}=l;return d}),a=[...t],o=function(){for(var d=n[s],u=i.findIndex(C=>C===d),c=[],m=0;m<a.length;m+=1){var f=a[m],g=yt({},f),[v,p]=Array.isArray(f.from)?f.from:[f.from,f.from];u<=f.to&&(g.to-=1),u<v&&(v-=1),u<=p&&(p-=1),v<=p&&v!==g.to&&(v===p?c.push(yt(yt({},g),{},{from:v})):c.push(yt(yt({},g),{},{from:[v,p]}))),u=ee.applyItemMoves(u,u,[f])[0][0]}a=c,i.splice(i.findIndex(C=>C===d),1)},s=0;s<n.length;s+=1)o();return a}static removeColumnsFromSelectDistinctColumns(e,t){return e.filter(n=>!t.includes(n))}static getVisibleColumnsInRange(e,t,n,i,a){for(var o=[],s=t;s<=n;s+=1){var l=ee.getModelIndex(s,i);l>=0&&l<e.length&&!a.includes(l)&&o.push(e[l])}return o}static getPrevVisibleColumns(e,t,n,i,a){for(var o=[],s=t;s>=0&&o.length<n;){var l=ee.getModelIndex(s,i);l>=0&&l<e.length&&!a.includes(l)&&o.unshift(e[l]),s-=1}return o}static getNextVisibleColumns(e,t,n,i,a){for(var o=[],s=t;s<e.length&&o.length<n;){var l=ee.getModelIndex(s,i);l>=0&&l<e.length&&!a.includes(l)&&o.push(e[l]),s+=1}return o}static getColumnsToFetch(e,t,n){var i=[...t];return n.forEach(a=>{var o=e.find(s=>{var{name:l}=s;return l===a});o!=null&&!t.includes(o)&&i.push(o)}),i}static getModelViewportColumns(e,t,n,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0;if(!(t==null||n==null)){var l=_e.getVisibleColumnsInRange(e,t,n,i,a),d=l.length*s,u=_e.getPrevVisibleColumns(e,t-1,d,i,a),c=_e.getNextVisibleColumns(e,n+1,d,i,a),m=[...u,...l,...c];return _e.getColumnsToFetch(e,m,o)}}static isValidSnapshotRanges(e){if(e==null||e.length===0)return!1;for(var t=new Map,n=0;n<e.length;n+=1){var i=e[n],a="".concat(i.startRow,":").concat(i.endRow),o="".concat(i.startColumn,":").concat(i.endColumn);t.has(a)||t.set(a,[]),t.get(a).push(o)}for(var s=[...t.keys()],l=t.get(s[0]).sort().join(","),d=1;d<s.length;d+=1)if(t.get(s[d]).sort().join(",")!==l)return!1;return!0}static isValidIndex(e){return!Number.isInteger(e)||typeof e!="number"?!1:e>=0}static columnsFromRanges(e,t){if(e==null||e.length===0)return[];if(e[0].startColumn===null&&e[0].endColumn===null)return[...t];for(var n=new Set,i=0;i<e.length;i+=1){var a=e[i];I(a.startColumn),I(a.endColumn);for(var o=(s=a.startColumn)!==null&&s!==void 0?s:0;o<=((l=a.endColumn)!==null&&l!==void 0?l:t.length-1);o+=1){var s,l;n.add(o)}}return[...n].map(d=>t[d])}static snapshotDataToMatrix(e){for(var{columns:t,rows:n}=e,i=[],a=0;a<n.length;a+=1){for(var o=n[a],s=[],l=0;l<t.length;l+=1){var d=t[l],u=o.get(d);s.push(u)}i.push(s)}return i}static getModelRollupConfig(e,t,n){var i,a;if(((i=t==null||(a=t.columns)===null||a===void 0?void 0:a.length)!==null&&i!==void 0?i:0)===0)return null;for(var{columns:o=[],showConstituents:s=!0,showNonAggregatedColumns:l=!0,includeDescriptions:d=!0}=t??{},{aggregations:u=[]}=n??{},c=u.map(C=>{var{operation:S,selected:y,invert:w}=C;return _d.isRollupOperation(S)?[]:_d.getOperationColumnNames(e,S,y,w)}),m={},f=0;f<u.length;f+=1)m[u[f].operation]=c[f];if(l){var g=new Set(e.map(C=>C.name).filter(C=>!o.includes(C)));if(c.forEach(C=>{C.forEach(S=>g.delete(S))}),g.size>0){var v,p=(v=m[be.FIRST])!==null&&v!==void 0?v:[];m[be.FIRST]=[...p,...g]}}return{groupingColumns:o,includeConstituents:s,includeDescriptions:d,aggregations:m}}static getPendingErrors(e){e.forEach((t,n)=>{if(!_e.isValidIndex(n))throw new Error("Invalid rowIndex ".concat(n));var{data:i}=t;i.forEach((a,o)=>{if(!_e.isValidIndex(o))throw new Error("Invalid columnIndex ".concat(o))})})}static getColumn(e,t){return t<e.length?e[t]:(di.error("Unable to retrieve column",t,">=",e.length),null)}static getColumnByName(e,t){var n=e.find(i=>{var{name:a}=i;return a===t});return n==null&&di.error("Unable to retrieve column by name",t,e.map(i=>{var{name:a}=i;return a})),n}static changeFilterColumnNamesToIndexes(e,t){return t.map(n=>{var{name:i,filter:a}=n,o=e.findIndex(s=>s.name===i);return o<0?null:[o,a]}).filter(n=>n!=null)}static combineFiltersFromList(e,t){t.sort((u,c)=>u.operator==="eq"&&c.operator!=="eq"?1:u.operator!=="eq"&&c.operator==="eq"?-1:u.startColumnIndex-c.startColumnIndex);for(var n="",i=0;i<t.length;i+=1){var{text:a,value:o,operator:s}=t[i];if(o!==void 0){var l="";s!==void 0&&(o==null&&s==="eq"?l="=":s!=="eq"&&(s==="startsWith"||s==="endsWith"?l="*":l=P.getFilterOperatorString(s)));var d="".concat(l).concat(a);s==="startsWith"&&(d="".concat(a).concat(l)),e!=null&&o!==null&&P.isCharType(e)&&(d="".concat(l).concat(String.fromCharCode(parseInt(a,10)))),i!==0&&(n+=s==="eq"?" || ":" && "),n+=d}}return n}static parseColumnHeaderGroups(e,t){var n=1,i=new Map,a=new Map,o=t==null?void 0:t.filter(c=>{var{children:m}=c;return m!=null&&m.length>0});if(o.length===0)return{groups:[],maxDepth:n,parentMap:i,groupMap:a};var s=new Map(o.map(c=>[c.name,c])),l=new Set,d=c=>{var m,{name:f}=c;if(I(f,"Column header group has no name"),e.getColumnIndexByName(f)!=null)throw new Error("Column header group has same name as column: ".concat(f));var g=a.get(f);if(g)return g;var v=[],p=1;if(c.children==null)throw new Error("Column header group ".concat(f," has no children"));c.children.forEach(S=>{if(l.has(S))throw new Error("Column group child ".concat(S," specified in multiple groups"));l.add(S);var y=s.get(S),w=e.getColumnIndexByName(S);if(y){var E=d(y);v.push(...E.childIndexes),p=Math.max(p,E.depth+1)}else if(w!=null)v.push(w),p=Math.max(p,1);else throw new Error("Unknown child ".concat(S," in group ").concat(f))});var C=new Bi(yt(yt({},c),{},{name:f,children:c.children,depth:p,childIndexes:v.flat()}));return a.set(f,C),(m=c.children)===null||m===void 0||m.forEach(S=>i.set(S,C)),n=Math.max(n,C.depth+1),C},u=new Set;return o.forEach(c=>{var{name:m}=c;if(u.has(m))throw new Error("Duplicate column group name: ".concat(m));u.add(m),d(c)}),a.forEach(c=>{var m;c.setParent((m=i.get(c.name))===null||m===void 0?void 0:m.name)}),{groups:[...a.values()],maxDepth:n,groupMap:a,parentMap:i}}static convertValueToText(e,t){if(t!=null&&P.isCharType(t)&&e!=null&&typeof e=="number")return String.fromCharCode(e);if(P.isDateType(t)&&Fw(e)){var n=new Date(e.asDate()),i=n.getTimezoneOffset(),a=new Date(n.getTime()-i*60*1e3),o=a.toISOString(),s=o.replace("T"," ").substring(0,23);return s}return e==null?"":"".concat(e)}constructor(e){Qo(this,"dh",void 0),Qo(this,"tableUtils",void 0),this.dh=e,this.tableUtils=new P(e),ps(this)}dehydrateIrisGridState(e,t){var{aggregationSettings:n={aggregations:Oe,showOnTop:!1},advancedFilters:i,customColumnFormatMap:a,isFilterBarShown:o,metrics:s,quickFilters:l,customColumns:d,conditionalFormats:u=Oe,reverseType:c,rollupConfig:m=void 0,showSearchBar:f,searchValue:g,selectDistinctColumns:v=Oe,selectedSearchColumns:p,sorts:C,invertSearchColumns:S,pendingDataMap:y=Ca,frozenColumns:w,columnHeaderGroups:E,partitionConfig:D=void 0}=t;I(s);var{userColumnWidths:M,userRowHeights:_}=s,{columns:T}=e,N=nn(e)?e.partitionColumns:[];return{advancedFilters:this.dehydrateAdvancedFilters(T,i),aggregationSettings:n,customColumnFormatMap:[...a],isFilterBarShown:o,quickFilters:_e.dehydrateQuickFilters(l),sorts:_e.dehydrateSort(C),userColumnWidths:[...M].filter(x=>{var[F]=x;return F!=null&&F>=0&&F<T.length}).map(x=>{var[F,k]=x;return[T[F].name,k]}),userRowHeights:[..._],customColumns:[...d],conditionalFormats:[...u],reverseType:c,rollupConfig:m,showSearchBar:f,searchValue:g,selectDistinctColumns:[...v],selectedSearchColumns:p,invertSearchColumns:S,pendingDataMap:this.dehydratePendingDataMap(T,y),frozenColumns:w,columnHeaderGroups:E==null?void 0:E.map(x=>{var F;return{name:x.name,children:x.children,color:(F=x.color)!==null&&F!==void 0?F:null}}),partitionConfig:this.dehydratePartitionConfig(N,D)}}hydrateIrisGridState(e,t){var n,i,{advancedFilters:a,aggregationSettings:o={aggregations:[],showOnTop:!1},customColumnFormatMap:s,isFilterBarShown:l,quickFilters:d,sorts:u,customColumns:c,conditionalFormats:m,userColumnWidths:f,userRowHeights:g,reverseType:v,rollupConfig:p=void 0,showSearchBar:C,searchValue:S,selectDistinctColumns:y,selectedSearchColumns:w,invertSearchColumns:E=!0,pendingDataMap:D=[],frozenColumns:M,columnHeaderGroups:_,partitionConfig:T}=t,{columns:N,formatter:x}=e,F=nn(e)?e.partitionColumns:[];return{advancedFilters:this.hydrateAdvancedFilters(N,a,x.timeZone),aggregationSettings:o,customColumnFormatMap:new Map(s),isFilterBarShown:l,quickFilters:this.hydrateQuickFilters(N,d,x.timeZone),sorts:this.hydrateSort(N,u),userColumnWidths:new Map(f.map(k=>{var[U,H]=k;return typeof U=="string"||U instanceof String?[N.findIndex(W=>{var{name:X}=W;return X===U}),H]:[U,H]}).filter(k=>{var[U]=k;return U!=null&&U>=0&&U<N.length})),customColumns:c,conditionalFormats:m,userRowHeights:new Map(g),reverseType:v,rollupConfig:p,showSearchBar:C,searchValue:S,selectDistinctColumns:y,selectedSearchColumns:w,invertSearchColumns:E,pendingDataMap:this.hydratePendingDataMap(N,D),frozenColumns:M,columnHeaderGroups:_e.parseColumnHeaderGroups(e,(n=_??((i=e.layoutHints)===null||i===void 0?void 0:i.columnGroups))!==null&&n!==void 0?n:[]).groups,partitionConfig:this.hydratePartitionConfig(F,T)}}hydrateQuickFilters(e,t,n){var i=t.map(a=>{var[o,s]=a,{text:l}=s,d=null;try{var u=_e.getColumn(e,o);u!=null&&(d=this.tableUtils.makeQuickFilter(u,l,n))}catch(c){di.error("hydrateQuickFilters error with",l,c)}return[o,{text:l,filter:d}]});return new Map(i)}dehydrateAdvancedFilters(e,t){return[...t].map(n=>{var[i,a]=n,o=_e.getColumn(e,i);I(o);var s=this.dehydrateAdvancedFilterOptions(o,a.options);return[i,{options:s}]})}hydrateAdvancedFilters(e,t,n){var i=t.map(a=>{var[o,s]=a,l=_e.getColumn(e,o);I(l);var d=this.hydrateAdvancedFilterOptions(l,s.options),u=null;try{var c=_e.getColumn(e,o);c!=null&&(u=this.tableUtils.makeAdvancedFilter(l,d,n))}catch(m){di.error("hydrateAdvancedFilters error with",d,m)}return[o,{options:d,filter:u}]});return new Map(i)}dehydrateAdvancedFilterOptions(e,t){var{selectedValues:n}=t,i=Nd(t,Dw);return yt({selectedValues:n==null?void 0:n.map(a=>this.dehydrateValue(a,e==null?void 0:e.type))},i)}hydrateAdvancedFilterOptions(e,t){var{selectedValues:n}=t,i=Nd(t,Mw);return yt({selectedValues:n==null?void 0:n.map(a=>this.hydrateValue(a,e==null?void 0:e.type))},i)}dehydratePendingDataMap(e,t){return[...t].map(n=>{var[i,{data:a}]=n;return[i,{data:[...a].map(o=>{var[s,l]=o;return[e[s].name,this.dehydrateValue(l,e[s].type)]})}]})}hydratePendingDataMap(e,t){var n=new Map,i=a=>(n.has(a)||n.set(a,e.findIndex(o=>{var{name:s}=o;return s===a})),n.get(a));return new Map(t.map(a=>{var[o,{data:s}]=a;return[o,{data:new Map(s.map(l=>{var d,[u,c]=l,m=i(u);return I(m),[(d=i(u))!==null&&d!==void 0?d:null,this.hydrateValue(c,e[m].type)]}))}]}))}dehydratePartitionConfig(e,t){return t==null?t:yt(yt({},t),{},{partitions:t.partitions.map((n,i)=>this.dehydrateValue(n,e[i].type))})}hydratePartitionConfig(e,t){return t==null?t:yt(yt({},t),{},{partitions:t.partitions.map((n,i)=>this.hydrateValue(n,e[i].type))})}dehydrateValue(e,t){return P.isDateType(t)?this.dehydrateDateTime(e):P.isLongType(t)?_e.dehydrateLong(e):e}hydrateValue(e,t){return P.isDateType(t)?this.hydrateDateTime(e):P.isLongType(t)?this.hydrateLong(e):e}dehydrateDateTime(e){return e!=null?this.dh.i18n.DateTimeFormat.format(He.FULL_DATE_FORMAT,e):null}hydrateDateTime(e){return e!=null?this.dh.i18n.DateTimeFormat.parse(He.FULL_DATE_FORMAT,e):null}hydrateLong(e){return e!=null?this.dh.LongWrapper.ofString(e):null}hydrateSort(e,t){var{dh:n}=this;return t.map(i=>{var{column:a,isAbs:o,direction:s}=i;if(s===P.sortDirection.reverse)return n.Table.reverse();var l=typeof a=="string"?_e.getColumnByName(e,a):_e.getColumn(e,a);if(l!=null){var d=l.sort();return o&&(d=d.abs()),s===P.sortDirection.descending?d=d.desc():d=d.asc(),d}return null}).filter(i=>i!=null&&i.direction!==P.sortDirection.reverse)}applyTableSettings(e,t,n){var{columns:i}=e,a=[];t.quickFilters&&(a=_e.getFiltersFromFilterMap(this.hydrateQuickFilters(i,t.quickFilters,n)));var o=[];t.advancedFilters&&(o=_e.getFiltersFromFilterMap(this.hydrateAdvancedFilters(i,t.advancedFilters,n)));var s=this.getFiltersFromInputFilters(i,t.inputFilters,n),l=[];t.sorts&&(l=this.hydrateSort(i,t.sorts));var d=[...a,...o],{partitions:u,partitionColumns:c}=t;if(u&&u.length&&c&&c!==null&&c!==void 0&&c.length){for(var m=c.map(v=>_e.getColumnByName(i,v)),f=0;f<m.length;f+=1)if(m[f]!==void 0&&u[f]!=null){var g=m[f].filter().eq(this.dh.FilterValue.ofString(u[f]));d=[g,...d]}}d=[...s,...d],e.applyFilter(d),e.applySort(l)}getFiltersFromInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return t.map(i=>{var{name:a,type:o,value:s}=i,l=e.find(d=>{var{name:u,type:c}=d;return u===a&&c===o});if(l)try{return this.tableUtils.makeQuickFilter(l,s,n)}catch(d){di.debug("Unable to create input filter",d)}return null}).filter(i=>i!=null)}rangeSetFromRanges(e){var{dh:t}=this,n=e.slice().sort((i,a)=>(I(i.startRow),I(a.startRow),i.startRow-a.startRow)).map(i=>{var{startRow:a,endRow:o}=i;return I(a),I(o),t.RangeSet.ofRange(a,o)});return t.RangeSet.ofRanges(n)}}const Ne=_e;function Rw(r){var{type:e}=r,t=vr();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return h.jsx(ue,{icon:fs});case t.VariableType.FIGURE:return h.jsx(ue,{icon:ms});case t.VariableType.PANDAS:return h.jsx(ue,{icon:Dh});default:return h.jsx(ue,{icon:Bf})}}function Rd(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Lw(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Rd(a,n,i,o,s,"next",l)}function s(l){Rd(a,n,i,o,s,"throw",l)}o(void 0)})}}function Kc(r){var{children:e,language:t}=r,[n,i]=b.useState(null),{activeThemes:a}=Jh();return b.useEffect(()=>{var o=!1;function s(){return l.apply(this,arguments)}function l(){return l=Lw(function*(){if(e!=null&&a!=null){var d=yield Gt.colorize(e.toString(),t,{});o||i(d)}}),l.apply(this,arguments)}return s(),()=>{o=!0}},[a,e,t]),h.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:n!=null?{__html:n}:void 0})}class Aw{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const qc=Aw;class Na{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:Tf.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:"".concat(t))}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;var t="".concat(e.getHours()).padStart(2,"0"),n="".concat(e.getMinutes()).padStart(2,"0"),i="".concat(e.getSeconds()).padStart(2,"0"),a="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(n,":").concat(i,".").concat(a)}static isTableType(e,t){return t===e.VariableType.TABLE||t===e.VariableType.TREETABLE||t===e.VariableType.HIERARCHICALTABLE||t===e.VariableType.PARTITIONEDTABLE}static isWidgetType(e,t){return t===e.VariableType.FIGURE||t===e.VariableType.OTHERWIDGET||t===e.VariableType.PANDAS}static isOpenableType(e,t){return Na.isTableType(e,t)||Na.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const Jo=Na;function Xc(r){var{children:e}=r;return h.jsxs("div",{className:"console-history-item-result",children:[h.jsx("div",{className:"console-history-gutter",children:"-"}),h.jsx("div",{className:"console-history-content",children:e})]})}Xc.propTypes={children:O.node.isRequired};function es(r,e,t){return e=kw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kw(r){var e=jw(r,"string");return typeof e=="symbol"?e:String(e)}function jw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Zc extends b.Component{constructor(e){super(e),es(this,"timer",void 0),es(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:n}=this.state;return h.jsx("div",{className:J("console-history-result-in-progress",{disabled:e}),children:h.jsxs("span",{className:"badge",children:[h.jsx(Mh,{className:"ml-2"}),"Running... ",Hh.formatElapsedTime(n)," ",h.jsx(Y,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Wf,tooltip:"Cancel",onClick:t,disabled:e})]})})}}es(Zc,"defaultProps",{disabled:!1});const $w=Zc;function _i(r,e,t){return e=Hw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hw(r){var e=Vw(r,"string");return typeof e=="symbol"?e:String(e)}function Vw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ur extends b.PureComponent{constructor(e){super(e),_i(this,"mouseX",void 0),_i(this,"mouseY",void 0),_i(this,"isClicking",void 0),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=Ur.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Ur.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){var{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;I(n);var i=n.indexOf(`
|
|
1
|
+
import{aZ as ff,r as b,M as Ue,D as h,a_ as vf,H as Z,a$ as pf,E as Pa,F as J,R as Ha,W as O,G as ue,b0 as ss,L as It,V as qe,b1 as gf,b2 as bf,Y as Kt,_ as Ai,b3 as Eh,b4 as Q,b5 as al,b6 as mr,b7 as Cf,b8 as ls,b9 as yf,ba as Sf,bb as wf,bc as Ef,aP as ds,aQ as Pf,bd as Ph,aS as oe,be as Gt,bf as Tf,bg as an,bh as wt,bi as Xn,bj as ol,bk as _f,bl as Si,aR as Ta,bm as Ht}from"./vendor-3c001961.js";import{T as _a,L as z,M as us,o as hs,b as cs,R as Th,U as Of,V as Df,X as Mf,Y as _h,y as If,B as Nf,D as xf,x as Ff,E as Rf,s as Lf,I as Af,m as kf,Z as jf,_ as $f,O as Hf,a as dn,h as I,r as Oh,z as Vf,$ as Uf,a0 as Er,a1 as Bf,a2 as Dh,a3 as ms,a4 as fs,n as Mh,e as Wf,a5 as xr,a6 as Gf,a7 as sl,a8 as zf,a9 as Kf,aa as qf,ab as Xf,v as ki,ac as vs,ad as Ih,c as wi,ae as Ao,af as Zf,ag as ll,ah as Nh,ai as dl,aj as xh,ak as Yf,al as Va,am as Qf,an as Jf,ao as ev,ap as tv,aq as nv,ar as rv,as as iv,at as Fh,au as av,av as Rh,aw as Lh,ax as ul,ay as ov,az as sv,aA as lv,aB as dv,aC as uv,aD as hv}from"./index-4a9bfe03.js";import{P as we,a as _t,t as go,b as cv,u as Ua,T as mv,s as fv,q as hl,g as vv,C as pv,c as Yn,r as Ah,n as gv,l as bv,p as Cv}from"./usePlugins-a4e842f0.js";var Oe=Object.freeze([]),Ca=new Map,VD=()=>{};function bo(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.filter(n=>n!=null)}function ps(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,t=yv(r,e);t.forEach(n=>{r[n]=r[n].bind(r)})}function yv(r,e){for(var t=new Set,n=r,i=0;n!=null&&n!==Object.prototype&&(i<=1||e);){for(var a of Object.getOwnPropertyNames(n))a!=="constructor"&&typeof n[a]=="function"&&t.add(a);n=Object.getPrototypeOf(n),i+=1}return[...t.keys()]}function cl(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Sv(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){cl(a,n,i,o,s,"next",l)}function s(l){cl(a,n,i,o,s,"throw",l)}o(void 0)})}}function gs(r){return ko.apply(this,arguments)}function ko(){return ko=Sv(function*(r){var{clipboard:e}=navigator;if(e!==void 0)try{return navigator.clipboard.writeText(r)}catch{return ml(r)}ml(r)}),ko.apply(this,arguments)}function ml(r){var e=document.activeElement,t=document.createElement("textarea");t.value=r,document.body.appendChild(t),t.focus(),t.select();var n=document.execCommand("copy");if(document.body.removeChild(t),e instanceof HTMLElement&&e.focus(),!n)throw new Error("Unable to execute copy command")}function Zr(r,e,t){return e=wv(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wv(r){var e=Ev(r,"string");return typeof e=="symbol"?e:String(e)}function Ev(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Pv="table_",kh="column_",Tv=new Set(["in","not","i","ii","k"]),_v=new Set(["abstract","continue","for","new","switch","assert","default","if","package","synchronized","boolean","do","goto","private","this","break","double","implements","protected","throw","byte","else","import","public","throws","case","enum","instanceof","return","transient","catch","extends","int","short","try","char","final","interface","static","void","class","finally","long","strictfp","volatile","const","float","native","super","while","null","true","false"]),Ov=/[^a-zA-Z0-9_$+@-]/g,Dv=/[^A-Za-z0-9_$]/g;class $t{}Zr($t,"legalize",(r,e,t,n,i)=>{var a=r.trim().replace(/[- ]/g,"_");return n&&(Tv.has(a)||_v.has(a))&&(a=e+a),a=a.replace(t,""),a||(a=e+i),Number.isNaN(Number(a.charAt(0)))||(a=e+a),a});Zr($t,"legalizeTableName",r=>$t.legalize(r,Pv,Ov,!1,0));Zr($t,"legalizeColumnNames",r=>{var e=[];return r.forEach((t,n)=>{var i=$t.legalizeColumnName(t,n);e.includes(i)&&(i=kh+n),e.push(i)}),e});Zr($t,"legalizeColumnName",function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return $t.legalize(r,kh,Dv,!0,e)});Zr($t,"isValidTableName",r=>$t.legalizeTableName(r)===r);Zr($t,"isValidColumnName",r=>$t.legalizeColumnName(r)===r);const jh=$t;class Te extends CustomEvent{constructor(e,t){super(e,t)}}function fl(r,e,t){return e=Mv(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Mv(r){var e=Iv(r,"string");return typeof e=="symbol"?e:String(e)}function Iv(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Nv{constructor(){fl(this,"pending",[]),fl(this,"resolved",[])}add(e,t){var n=we.makeCancelable(e,t);return this.pending.push(n),n.then(()=>{this.resolve(n)},()=>{this.resolve(n)}),n}remove(e){for(var t=0;t<this.pending.length;t+=1)if(this.pending[t]===e){this.pending.splice(t,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){for(var e=[...this.pending,...this.resolved],t=0;t<e.length;t+=1)e[t].cancel();this.pending=[],this.resolved=[]}}const Qn=Nv;class bs{static isValidRange(e){return e!=null&&e.length===2&&Number.isInteger(e[0])&&Number.isInteger(e[1])&&e[0]<=e[1]}static validateRange(e){if(!bs.isValidRange(e))throw new Error("Invalid range! ".concat(e))}static isSelected(e,t){for(var n=0;n<e.length;n+=1){var i=e[n],a=i[0],o=i[1];if(a<=t&&t<=o)return!0}return!1}static selectRange(e,t){for(var[n,i]=t,a=[...e],o=a.length-1;o>=0;o-=1){var s=a[o],l=s[0],d=s[1];if(l<=n&&i<=d)return a;n<=d&&l<=i&&(n=Math.min(n,l),i=Math.max(i,d),a.splice(o,1))}return a.push([n,i]),a}static deselectRange(e,t){for(var[n,i]=t,a=[...e],o=a.length-1;o>=0;o-=1){var s=a[o],l=s[0],d=s[1];if(!(i<l||d<n))if(l<n&&i<d){a[o]=[l,n-1],a.splice(o+1,0,[i+1,d]);break}else n<=l&&d<=i?a.splice(o,1):l<n?a[o]=[l,n-1]:a[o]=[i+1,d]}return a}static count(e){return e.reduce((t,n)=>t+(n[1]-n[0]+1),0)}static getItemsInRanges(e,t){return t.reduce((n,i)=>{for(var a=[...n],o=i[0];o<=i[1];o+=1)a.push(e[o]);return a},[])}}const Sn=bs;function*UD(r,e){for(var t=r;t<=e;++t)yield t}class xv{static join(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"and";if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return"".concat(e[0]," ").concat(t," ").concat(e[1]);var n=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return"".concat(n,", ").concat(t," ").concat(i)}static toLower(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e==null){if(t)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return e<t?n?-1:1:e>t?n?1:-1:0}}const Lt=xv;function $h(r,e,t){return e=Fv(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fv(r){var e=Rv(r,"string");return typeof e=="symbol"?e:String(e)}function Rv(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class ji{static formatElapsedTime(e){if(typeof e!="number"||!Number.isInteger(e))throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=Math.floor(e/3600),n=Math.floor(e%3600/60),i=e%60;return"".concat(t>0?"".concat(t,"h "):"")+"".concat(n>0||t>0?"".concat(n,"m "):"")+"".concat(e>=60?"".concat(i,"s").padStart(3,"0"):"".concat(i,"s"))}static formatTime(e){if(typeof e!="number"||!Number.isInteger(e)||e<0)throw new Error("".concat(e," is not a number that can be expressed as a formatted time"));var t=String(Math.floor(e/(60*60))).padStart(2,"0"),n=e%(60*60),i=String(Math.floor(n/60)).padStart(2,"0"),a=n%60,o=String(Math.ceil(a)).padStart(2,"0");return"".concat(t,":").concat(i,":").concat(o)}static isTimeString(e){return new RegExp(ji.TIME_PATTERN).test(e)}static parseTime(e){if(e==null||typeof e!="string")throw new Error("".concat(e," is not a valid string"));var t=e.split(":");if(t.length!==3)throw new Error("".concat(e," is not a time string that can be parsed"));return Number(t[0])*60*60+Number(t[1])*60+Number(t[2])}}$h(ji,"TIME_PATTERN","([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]");$h(ji,"TIME_ZONES",Object.freeze([{label:"Tokyo UTC+9 No DST",value:"Asia/Tokyo"},{label:"Seoul UTC+9 No DST",value:"Asia/Seoul"},{label:"Hong Kong UTC+8 No DST",value:"Asia/Hong_Kong"},{label:"Singapore UTC+8 No DST",value:"Asia/Singapore"},{label:"Kolkata UTC+5:30 No DST",value:"Asia/Kolkata"},{label:"Berlin UTC+1",value:"Europe/Berlin"},{label:"UTC UTC±0 No DST",value:"UTC"},{label:"London UTC±0",value:"Europe/London"},{label:"Sao Paulo UTC-2",value:"America/Sao_Paulo"},{label:"Newfoundland UTC-3:30",value:"America/St_Johns"},{label:"Halifax UTC-4",value:"America/Halifax"},{label:"New York UTC−5",value:"America/New_York"},{label:"Chicago UTC-6",value:"America/Chicago"},{label:"Denver UTC-7",value:"America/Denver"},{label:"Los Angeles UTC-8",value:"America/Los_Angeles"},{label:"Anchorage UTC-9",value:"America/Anchorage"},{label:"Honolulu UTC-10 No DST",value:"Pacific/Honolulu"},{label:"Zurich UTC+1",value:"Europe/Zurich"},{label:"Amsterdam UTC+1",value:"Europe/Amsterdam"},{label:"Taipei UTC+8 No DST",value:"Asia/Taipei"},{label:"Sydney UTC+10",value:"Australia/Sydney"}]));const Hh=ji;function Lv(r,e,t){return e=Av(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Av(r){var e=kv(r,"string");return typeof e=="symbol"?e:String(e)}function kv(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class jv extends Error{constructor(){super(...arguments),Lv(this,"isInvalid",!0)}}const Ei=jv;const $v={"dh-spectrum-palette":"_dh-spectrum-palette_llwuf_1"},Hv={"dh-spectrum-alias":"_dh-spectrum-alias_1906d_1"};function vl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pl(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vl(Object(t),!0).forEach(function(n){Vv(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Vv(r,e,t){return e=Uv(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Uv(r){var e=Bv(r,"string");return typeof e=="symbol"?e:String(e)}function Bv(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var gl=pl(pl({},$v),Hv);function bl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Yi(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bl(Object(t),!0).forEach(function(n){Wv(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):bl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Wv(r,e,t){return e=Gv(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gv(r){var e=zv(r,"string");return typeof e=="symbol"?e:String(e)}function zv(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var{global:Kv,light:qv,dark:Xv,medium:Zv,large:Yv}=ff,Qv={global:Kv,light:Yi(Yi({},qv),gl),dark:Yi(Yi({},Xv),gl),medium:Zv,large:Yv};function Vh(r){var{children:e,isPortal:t=!1,theme:n=Qv,colorScheme:i}=r,[a]=b.useState(t?Ue():null);return h.jsx(vf,{UNSAFE_className:"spectrum-theme-provider",theme:n,colorScheme:i,"data-unique-id":a,children:e})}function Cl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Jv(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Cl(Object(t),!0).forEach(function(n){Ar(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Cl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ar(r,e,t){return e=ep(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ep(r){var e=tp(r,"string");return typeof e=="symbol"?e:String(e)}function tp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var yl="popper";class Cs extends b.Component{constructor(e){super(e),Ar(this,"element",void 0),Ar(this,"container",void 0),Ar(this,"rAF",void 0),this.handleEnter=this.handleEnter.bind(this),this.handleExit=this.handleExit.bind(this),this.handleBlur=this.handleBlur.bind(this),this.element=document.createElement("div"),this.element.className="popper-container",this.container=Z.createRef(),this.rAF=0;var{isShown:t}=this.props;this.state={show:t,popper:null}}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t?(cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{this.show()})):this.hide())}componentWillUnmount(){this.destroyPopper(!1)}getVisibleElement(e){return e==null||e.clientHeight>0||e.clientWidth>0?e:this.getVisibleElement(e.parentElement)}initPopper(){var{popper:e}=this.state,{closeOnBlur:t,referenceObject:n}=this.props;if(!e&&this.container.current!==null){var{options:i}=this.props;i=Jv({placement:"auto",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},i),document.body.appendChild(this.element);var a=this.getVisibleElement(this.container.current);a==null&&(a=this.container.current),e=new pf(n||a,this.element,i),e.scheduleUpdate(),cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{if(t){var o=this.element.querySelector(".".concat(yl));o instanceof HTMLElement&&!o.contains(document.activeElement)&&o.focus()}}),this.setState({popper:e})}}destroyPopper(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;cancelAnimationFrame(this.rAF);var{popper:t}=this.state;t&&(t.destroy(),document.body.contains(this.element)&&document.body.removeChild(this.element),e&&this.setState({popper:null}))}show(){this.initPopper(),this.setState({show:!0})}hide(){this.setState({show:!1})}scheduleUpdate(){var{popper:e}=this.state;e&&e.scheduleUpdate()}handleBlur(e){e.relatedTarget instanceof HTMLElement&&(this.element.contains(e.relatedTarget)||this.hide())}handleEnter(){var{onEntered:e}=this.props;e()}handleExit(){var{onExited:e}=this.props,{show:t}=this.state;t||this.destroyPopper(),e()}renderContent(){var{className:e,children:t,timeout:n,interactive:i,closeOnBlur:a}=this.props,{show:o}=this.state;return h.jsx(Vh,{isPortal:!0,children:h.jsx(Pa,{in:o,timeout:n,classNames:"popper-transition",onEntered:this.handleEnter,onExited:this.handleExit,children:h.jsx("div",{onClick:s=>{s.stopPropagation()},onKeyDown:s=>{s.key==="Escape"&&this.hide()},className:J(yl,{interactive:i},e),onBlur:a?this.handleBlur:void 0,tabIndex:a?-1:void 0,role:"presentation",children:h.jsxs("div",{className:"popper-content",children:[t,h.jsx("div",{className:"popper-arrow","x-arrow":""})]})})})})}render(){var{popper:e}=this.state,{"data-testid":t}=this.props;return h.jsx("div",{className:"popper-parent-container",ref:this.container,style:{display:"none"},"data-testid":t,children:e&&Ha.createPortal(this.renderContent(),this.element)})}}Ar(Cs,"propTypes",{children:O.node.isRequired,options:O.shape({}),className:O.string,timeout:O.number,onEntered:O.func,onExited:O.func,isShown:O.bool,closeOnBlur:O.bool,interactive:O.bool,referenceObject:O.shape({}),"data-testid":O.string});Ar(Cs,"defaultProps",{options:{},className:"",timeout:_a.transitionMs,onEntered(){},onExited(){},isShown:!1,interactive:!1,closeOnBlur:!1,referenceObject:null,"data-testid":void 0});const ys=Cs;function Sl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function np(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sl(Object(t),!0).forEach(function(n){Xt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Sl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Xt(r,e,t){return e=rp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rp(r){var e=ip(r,"string");return typeof e=="symbol"?e:String(e)}function ip(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ap=z.module("Tooltip");class We extends b.Component{static handleHidden(){We.shownTooltipCount-=1,We.shownTooltipCount===0&&(We.lastHiddenTime=Date.now())}static handleShown(){We.shownTooltipCount+=1}constructor(e){super(e),Xt(this,"container",void 0),Xt(this,"popper",void 0),Xt(this,"parent",void 0),Xt(this,"timer",void 0),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleWindowMouseMove=this.handleWindowMouseMove.bind(this),this.handleWheel=this.handleWheel.bind(this),this.handleTimeout=this.handleTimeout.bind(this),this.handleExited=this.handleExited.bind(this),this.stopShowingTooltip=this.stopShowingTooltip.bind(this),this.container=Z.createRef(),this.popper=Z.createRef(),this.parent=null,this.timer=null,this.state={isShown:!1}}componentDidMount(){this.startListening();var{timeout:e}=this.props;e===0&&this.show()}componentDidUpdate(e,t){var{isShown:n}=t,{isShown:i}=this.state;i!==n&&(i?We.handleShown():We.handleHidden())}componentWillUnmount(){this.stopListening(),this.stopListeningWindow(),this.stopTimer();var{isShown:e}=this.state;e&&We.handleHidden()}startListening(){if(!this.container.current||!this.container.current.parentElement){ap.error("Tooltip doesn't have a container or a parent set!");return}this.parent=this.container.current.parentElement,this.parent.addEventListener("mousemove",this.handleMouseMove),this.parent.addEventListener("mouseleave",this.handleMouseLeave),this.parent.addEventListener("mousedown",this.stopShowingTooltip)}stopListening(){this.parent&&(this.parent.removeEventListener("mousemove",this.handleMouseMove),this.parent.removeEventListener("mouseleave",this.handleMouseLeave),this.parent.removeEventListener("mousedown",this.stopShowingTooltip))}startListeningWindow(){window.addEventListener("mousemove",this.handleWindowMouseMove,!0),window.addEventListener("contextmenu",this.stopShowingTooltip,!0),window.addEventListener("wheel",this.handleWheel)}stopListeningWindow(){window.removeEventListener("mousemove",this.handleWindowMouseMove,!0),window.removeEventListener("contextmenu",this.stopShowingTooltip,!0),window.removeEventListener("wheel",this.handleWheel)}handleMouseMove(){this.startTimer()}handleWheel(){var{isShown:e}=this.state;this.popper.current&&this.parent&&e&&!this.popper.current.element.matches(":hover")&&!this.parent.matches(":hover")&&(this.stopTimer(),this.hide())}handleMouseLeave(){var{isShown:e}=this.state;this.stopTimer();var{interactive:t}=this.props;!t&&e&&this.hide()}handleTimeout(){this.show()}handleWindowMouseMove(e){var t=e.clientX,n=e.clientY,{isShown:i}=this.state;if(!(!this.popper.current||!this.parent)){var a=this.popper.current.element.getBoundingClientRect(),o=this.parent.getBoundingClientRect();t>=a.left&&t<=a.left+a.width&&n>=a.top&&n<=a.top+a.height?this.handleMouseMove():t>=o.left&&t<=o.left+o.width&&n>=o.top&&n<=o.top+o.height?this.handleMouseMove():i&&(this.stopTimer(),this.hide())}}startTimer(){this.stopTimer();var{timeout:e,reshowTimeout:t}=this.props,n=e;(We.shownTooltipCount>0||Date.now()-We.lastHiddenTime<We.triggerReshowThreshold)&&(n=t),this.timer=window.setTimeout(this.handleTimeout,n)}stopTimer(){this.timer!=null&&(clearTimeout(this.timer),this.timer=null)}show(){var{isShown:e}=this.state;if(this.stopTimer(),!e){var t;(t=this.popper.current)===null||t===void 0||t.show(),this.setState({isShown:!0});var{interactive:n}=this.props;n&&this.startListeningWindow()}}hide(){var e;(e=this.popper.current)===null||e===void 0||e.hide(),this.stopListeningWindow()}update(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleExited(){this.setState({isShown:!1});var{onExited:e}=this.props;e()}stopShowingTooltip(){var{isShown:e}=this.state;this.stopTimer(),e&&this.hide()}render(){var{interactive:e,children:t,referenceObject:n,popperClassName:i,"data-testid":a,onEntered:o}=this.props,{isShown:s}=this.state,{options:l}=this.props;return l=np({placement:"bottom"},l),h.jsx("div",{ref:this.container,style:{display:"none"},"data-testid":a,children:h.jsx(ys,{className:J(i,"popper-tooltip"),options:l,ref:this.popper,onEntered:o,onExited:this.handleExited,interactive:e,referenceObject:n,children:h.jsxs("div",{className:"tooltip-content",children:[" ",s&&t]})})})}}Xt(We,"defaultTimeout",500);Xt(We,"defaultReshowTimeout",100);Xt(We,"triggerReshowThreshold",300);Xt(We,"shownTooltipCount",0);Xt(We,"lastHiddenTime",Date.now());Xt(We,"defaultProps",{interactive:!1,options:{},popperClassName:"",reshowTimeout:We.defaultReshowTimeout,timeout:We.defaultTimeout,onEntered:()=>{},onExited:()=>{},"data-testid":void 0});const On=We;function Uh(){var r=b.useRef(!1);return b.useEffect(()=>(r.current=!0,()=>{r.current=!1}),[]),r}function wl(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function op(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){wl(a,n,i,o,s,"next",l)}function s(l){wl(a,n,i,o,s,"throw",l)}o(void 0)})}}var sp=z.module("useAsyncInterval");function lp(r,e){var t=Uh(),n=b.useRef(0),i=b.useRef(0),a=b.useRef(null),o=b.useCallback(op(function*(){var s=Date.now();i.current+=1;var l=a.current==null?e:s-a.current;a.current=s;try{yield r()}catch(c){sp.error("A tick error occurred:",c)}if(t.current){l+=Date.now()-a.current;var d=Math.max(0,l-e),u=Math.max(0,e-d);n.current=window.setTimeout(o,u)}}),[r,t,e]);b.useEffect(()=>(a.current=null,o(),()=>{window.clearTimeout(n.current)}),[e,o])}function dp(r){var e=b.useRef();return b.useEffect(function(){e.current=r}),e.current}function Bh(r){var e=b.useRef(null);return b.useEffect(function(){r&&(typeof r=="function"?r(e.current):r.current=e.current)}),e}var up=3500,hp=z.module("useCopyToClipboard");function cp(){var[r,e]=b.useState(!1),t=b.useRef(null),n=b.useCallback(i=>{gs(i).then(()=>{e(!0)}).catch(a=>hp.error("Unable to copy ".concat(i),`
|
|
2
|
+
`,a))},[]);return b.useEffect(()=>(t.current&&clearTimeout(t.current),r&&(t.current=setTimeout(()=>{e(!1)},up)),()=>{t.current&&clearTimeout(t.current)}),[r]),[r,n]}function Ba(r){var{children:e,className:t,style:n,"data-testid":i}=r;return h.jsx("div",{className:J("btn-group",t),style:n,role:"group","data-testid":i,children:e})}Ba.displayName="ButtonGroup";Ba.propTypes={children:O.node.isRequired,className:O.string,style:O.object,"data-testid":O.string};Ba.defaultProps={className:null,style:{},"data-testid":void 0};var mp=["kind","variant","type","tooltip","icon","disabled","active","onClick","onContextMenu","onMouseDown","onMouseUp","onMouseEnter","onMouseLeave","onKeyDown","className","style","children","tabIndex","data-testid","aria-label"];function El(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Pl(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?El(Object(t),!0).forEach(function(n){fp(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):El(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function fp(r,e,t){return e=vp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vp(r){var e=pp(r,"string");return typeof e=="symbol"?e:String(e)}function pp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function gp(r,e){if(r==null)return{};var t=bp(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function bp(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}var Cp=["primary","secondary","tertiary","success","danger","inline","ghost"],yp=["group-end"];function Sp(r,e){switch(r){case"primary":return"btn-primary";case"secondary":return"btn-outline-primary";case"tertiary":return"btn-secondary";case"success":return"btn-success";case"danger":return"btn-danger";case"inline":return"btn-inline";case"ghost":return J("btn-link",{"btn-link-icon":e,"btn-link-icon-only":e})}}function wp(r){switch(r){case"group-end":return J("pl-2","pr-3")}}var Wa=Z.forwardRef((r,e)=>{var{kind:t,variant:n,type:i,tooltip:a,icon:o,disabled:s=!1,active:l,onClick:d,onContextMenu:u,onMouseDown:c,onMouseUp:m,onMouseEnter:f,onMouseLeave:g,onKeyDown:v,className:p,style:C,children:S,tabIndex:y,"data-testid":w,"aria-label":E}=r,D=gp(r,mp),M;n&&(M=wp(n));var _;o&&(_=Z.isValidElement(o)?o:h.jsx(ue,{icon:o}));var T=_!=null&&S==null,N=Sp(t,T),x;a!==void 0&&(x=typeof a=="string"?h.jsx(On,{children:a}):a);var F=E;E===void 0&&T&&a!=null&&typeof a=="string"&&(F=a);var k=h.jsxs("button",Pl(Pl({"data-testid":w,ref:e,type:i,className:J("btn",N,M,{active:l},p),onClick:d,onContextMenu:u,onMouseUp:m,onMouseDown:c,onMouseEnter:f,onMouseLeave:g,onKeyDown:v,style:C,disabled:s,tabIndex:y,"aria-label":F},D),{},{children:[o&&_,S,a!=null&&!s&&x]}));return s&&a!=null?h.jsxs("span",{className:"btn-disabled-wrapper",children:[k,x]}):k});Wa.displayName="Button";Wa.propTypes={kind:O.oneOf(Cp).isRequired,variant:O.oneOf(yp),type:O.oneOf(["submit","reset","button"]),tooltip(r){var{tooltip:e,icon:t,children:n}=r;return e===void 0&&t!=null&&n==null?new Error("Tooltip is required for icon only buttons"):null},icon(r){var{children:e,icon:t}=r;return t==null&&e==null?new Error("Icon is required if no children are provided"):e==null&&!Z.isValidElement(t)&&(t==null||t.iconName===""||t.iconName==null)?new Error("Icon must be react element or fontawesome IconDefinition"):null},disabled:O.bool,active:O.bool,onClick(r){var{onClick:e,type:t}=r;return t==="button"&&typeof e!="function"?new Error("type button requires an onClick function"):e!==void 0&&typeof e!="function"?new Error("onClick must be a function"):null},onContextMenu:O.func,onMouseUp:O.func,onMouseDown:O.func,onMouseEnter:O.func,onMouseLeave:O.func,onKeyDown:O.func,tabIndex:O.number,children:O.node,className:O.string,style:O.object,"data-testid":O.string};Wa.defaultProps={type:"button",onClick:void 0,onContextMenu:void 0,onMouseUp:void 0,onMouseDown:void 0,onMouseEnter:void 0,onMouseLeave:void 0,onKeyDown:void 0,variant:void 0,tooltip:void 0,icon:void 0,disabled:!1,active:void 0,tabIndex:void 0,children:void 0,className:void 0,style:{},"data-testid":void 0};const Y=Wa;function Ss(r){var{className:e="modal-footer",children:t,"data-testid":n}=r;return h.jsx("div",{className:e,"data-testid":n,children:t})}function fr(r){var{isOpen:e,headerText:t,bodyText:n,onCancel:i,onConfirm:a,onDiscard:o,onModalDisable:s,cancelButtonText:l="Cancel",confirmButtonText:d="Okay",discardButtonText:u="Discard",isConfirmDanger:c=!1,children:m,"data-testid":f}=r,g=b.useRef(null),v=b.useRef(null),p=b.useCallback(()=>{v.current!==null&&v.current.checked&&s&&s(),a()},[a,s]),C=b.useCallback(()=>{var y;(y=g.current)===null||y===void 0||y.focus()},[]),S="";return e&&(S=typeof n=="function"?n():n),h.jsxs(us,{isOpen:e,onOpened:C,children:[h.jsx(hs,{closeButton:!1,children:t}),h.jsx(cs,{children:S}),h.jsxs(Ss,{children:[s&&h.jsxs("div",{className:"custom-control custom-checkbox form-group mr-auto",children:[h.jsx("input",{type:"checkbox",className:"custom-control-input",id:"move-confirmation-checkbox",defaultChecked:!1,ref:v,"data-testid":f!==void 0?"".concat(f,"-checkbox-confirm"):void 0}),h.jsx("label",{className:"custom-control-label",htmlFor:"move-confirmation-checkbox",children:"Don't ask me again"})]}),o&&h.jsx(Y,{kind:"secondary",className:"mr-auto","data-dismiss":"modal",onClick:o,"data-testid":f!==void 0?"".concat(f,"-btn-discard"):void 0,children:u}),i&&h.jsx(Y,{kind:"secondary","data-dismiss":"modal",onClick:i,"data-testid":f!==void 0?"".concat(f,"-btn-cancel"):void 0,children:l}),h.jsxs(Ba,{children:[h.jsx(Y,{kind:c?"danger":"primary",onClick:p,ref:g,"data-testid":f!==void 0?"".concat(f,"-btn-confirm"):void 0,children:d}),m]})]})]})}fr.propTypes={isOpen:O.bool.isRequired,headerText:O.string.isRequired,bodyText:O.oneOfType([O.string,O.func]).isRequired,onCancel:O.func,onConfirm:O.func.isRequired,onDiscard:O.func,onModalDisable:O.func,cancelButtonText:O.string,confirmButtonText:O.string,discardButtonText:O.string,children:O.node,"data-testid":O.string};fr.defaultProps={children:void 0,cancelButtonText:"Cancel",confirmButtonText:"Okay",discardButtonText:"Discard",onCancel:void 0,onDiscard:void 0,onModalDisable:void 0,"data-testid":void 0};var Ga=Z.forwardRef((r,e)=>{var{children:t,className:n,disabled:i,onClick:a,style:o,id:s}=r;return h.jsx("button",{ref:e,type:"button",className:J("btn",n),onClick:a,style:o,disabled:i,id:s,children:t})});Ga.displayName="Button";Ga.propTypes={children:O.node,className:O.string,disabled:O.bool,onClick:O.func,style:O.shape({}),id:O.string};Ga.defaultProps={children:null,className:"",disabled:!1,onClick:()=>null,style:{},id:""};const Tl=Ga;function ws(r){var{className:e,isFlipped:t,children:n,"data-testid":i}=r,a=d=>{if(n.length!==2)throw new Error("CardFlip requires 2 children to function");return n[d]},o=b.useRef(null),s=b.useCallback(d=>{d.target===d.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=b.useCallback(d=>{d.target===d.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return b.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",s);var u=o.current;return function(){if(u!=null)return u.removeEventListener("transitionstart",s)}},[s]),h.jsxs("div",{className:J(e,{"card-flip--show-front":t,"card-flip--show-back":!t}),"data-testid":i,children:[h.jsx("div",{className:"card-flip--back",children:a(0)}),h.jsx("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:a(1)})]})}var _l=z.module("GlobalContextAction");class Ep extends b.Component{constructor(e){super(e),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.body.addEventListener("contextmenu",this.handleContextMenu),document.body.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.body.removeEventListener("contextmenu",this.handleContextMenu),document.body.removeEventListener("keydown",this.handleKeyDown)}handleContextMenu(e){var t=e;t.contextActions==null&&(t.contextActions=[]);var{action:n}=this.props;n.title==null&&!n.menuElement||(t.contextActions==null&&(t.contextActions=[]),t.contextActions.push(n),_l.debug("Received context menu event at global action! Menu items are now: ",t.contextActions))}handleKeyDown(e){var{action:t}=this.props;if(!_t.actionsDisabled&&t.shortcut!==void 0&&t.shortcut.matchesEvent(e)){var n;_l.debug("Global hotkey matched!",e),(n=t.action)===null||n===void 0||n.call(t,e),e.preventDefault(),e.stopPropagation()}}render(){return null}}const Pp=Ep;class Tp extends b.Component{render(){for(var{actions:e,"data-testid":t}=this.props,n=[],i=0;i<e.length;i+=1){var a=e[i],{shortcut:o}=a;if(a.title!=null||a.menuElement||o){var s=h.jsx(Pp,{action:a,"data-testid":t},"".concat(a.title,".").concat(o==null?void 0:o.id));n.push(s)}}return n}}const _p=Tp;function Wh(r,e,t){return e=Op(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Op(r){var e=Dp(r,"string");return typeof e=="symbol"?e:String(e)}function Dp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Qi=z.module("ContextActions");class Gh extends b.Component{static triggerMenu(e,t,n,i){if(i.length!==0){var a=new MouseEvent("contextmenu",{clientX:t,clientY:n,bubbles:!0,cancelable:!0});a.contextActions=i,e.dispatchEvent(a)}}constructor(e){super(e),Wh(this,"container",void 0),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.container=Z.createRef(),this.state={globalActions:[],keyboardActions:[]}}static getDerivedStateFromProps(e){if(e.actions==null||!Array.isArray(e.actions))return{globalActions:[],keyboardActions:[]};var t=e.actions.filter(i=>!go(i)&&typeof i!="function"&&i.isGlobal),n=e.actions.filter(i=>!go(i)&&typeof i!="function"&&(i.isGlobal===void 0||!i.isGlobal)&&i.shortcut!=null);return{globalActions:t,keyboardActions:n}}componentDidMount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.addEventListener("keydown",this.handleKeyDown))}componentWillUnmount(){var e;(e=this.container.current)!==null&&e!==void 0&&e.parentElement&&(this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu),this.container.current.parentElement.removeEventListener("keydown",this.handleKeyDown))}handleContextMenu(e){var{ignoreClassNames:t=[]}=this.props;if(t.length>0)for(var n=e.target,i=function(){var{classList:d}=n,u=t.find(c=>d.contains(c));if(u!==void 0)return Qi.debug2('Contextmenu event ignored based on the target className "'.concat(u,'"')),{v:void 0};n=n.parentElement};n!=null;){var a=i();if(typeof a=="object")return a.v}if(_t.isContextActionEvent(e)||(e.contextActions=[]),!!_t.isContextActionEvent(e)){var{actions:o}=this.props;if(o!=null){var s=o;Array.isArray(s)&&(s=s.filter(l=>go(l)||typeof l=="function"||l.isGlobal===void 0||!l.isGlobal)),e.contextActions=e.contextActions.concat(s)}Qi.debug("Received context menu event! Menu items are now: ",e.contextActions)}}handleKeyDown(e){for(var{keyboardActions:t}=this.state,n=0;n<t.length;n+=1){var i=t[n];if(!_t.actionsDisabled&&i.shortcut!=null&&i.shortcut.matchesEvent(e)){var a;Qi.debug("Context hotkey matched!",e),(a=i.action)===null||a===void 0||a.call(i,e),e.stopPropagation(),e.preventDefault(),Qi.debug2("Matched hotkey returned false, key event not consumed")}}}render(){var{"data-testid":e}=this.props,{globalActions:t}=this.state;return h.jsx("div",{className:"context-actions-listener",ref:this.container,"data-testid":e,children:h.jsx(_p,{actions:t})})}}Wh(Gh,"groups",{default:void 0,high:100,medium:5e3,low:1e4,global:1e5,edit:100});const fe=Gh;var za=Z.forwardRef((r,e)=>{var{checked:t=!1,children:n,className:i,disabled:a,inputClassName:o,isInvalid:s,labelClassName:l,name:d,onChange:u,"data-testid":c}=r,[m]=b.useState(Ue()),f=Bh(e);b.useEffect(function(){f.current&&(f.current.indeterminate=t===null)},[f,t]);var g=b.useCallback(v=>{f.current&&(f.current.indeterminate=t===null),u&&u(v)},[f,t,u]);return h.jsxs("div",{className:J("custom-control custom-checkbox",i),children:[h.jsx("input",{type:"checkbox",ref:f,checked:t??!1,className:J("custom-control-input",o,{"is-invalid":s}),disabled:a,id:m,name:d,onChange:g,"data-testid":c}),h.jsx("label",{className:J("custom-control-label",l),htmlFor:m,children:n})]})});za.displayName="Checkbox";za.propTypes={checked:(r,e)=>{var{[e]:t}=r;return t!==null&&typeof t!="boolean"?new Error("Checked must be a boolean or null for indeterminate"):null},children:O.node.isRequired,className:O.string,disabled:O.bool,inputClassName:O.string,isInvalid:O.bool,labelClassName:O.string,name:O.string,onChange:O.func,"data-testid":O.string};za.defaultProps={checked:!1,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const Mp=za;function Bn(r,e,t){return e=Ip(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ip(r){var e=Np(r,"string");return typeof e=="symbol"?e:String(e)}function Np(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ol=z.module("Shortcut"),re;(function(r){r.CTRL="MODIFIER_CTRL",r.CMD="MODIFIER_CMD",r.ALT="MODIFIER_ALT",r.OPTION="MODIFIER_OPTION",r.SHIFT="MODIFIER_SHIFT"})(re||(re={}));var q;(function(r){r.A="A",r.B="B",r.C="C",r.D="D",r.E="E",r.F="F",r.G="G",r.H="H",r.I="I",r.J="J",r.K="K",r.L="L",r.M="M",r.N="N",r.O="O",r.P="P",r.Q="Q",r.R="R",r.S="S",r.T="T",r.U="U",r.V="V",r.W="W",r.X="X",r.Y="Y",r.Z="Z",r.ZERO="0",r.ONE="1",r.TWO="2",r.THREE="3",r.FOUR="4",r.FIVE="5",r.SIX="6",r.SEVEN="7",r.EIGHT="8",r.NINE="9",r.BACKSPACE="Backspace",r.ESCAPE="Escape",r.ENTER="Enter",r.DELETE="Delete",r.SLASH="/",r.QUESTION_MARK="?",r.BACKSLASH="\\",r.PIPE="|",r.MINUS="-",r.UNDERSCORE="_",r.EQUALS="=",r.PLUS="+",r.BACKTICK="`",r.TILDE="~",r.COMMA=",",r.LEFT_CHEVRON="<",r.PERIOD=".",r.RIGHT_CHEVRON=">",r.SEMICOLON=";",r.COLON=":",r.SINGLE_QUOTE="'",r.DOUBLE_QUOTE='"',r.LEFT_BRACKET="[",r.RIGHT_BRACKET="]",r.LEFT_CURLY="{",r.RIGHT_CURLY="}",r.F1="F1",r.F2="F2",r.F3="F3",r.F4="F4",r.F5="F5",r.F6="F6",r.F7="F7",r.F8="F8",r.F9="F9",r.F10="F10",r.F11="F11",r.F12="F12"})(q||(q={}));var xp=new Set([q.ENTER,q.DELETE,q.F1,q.F2,q.F3,q.F4,q.F5,q.F6,q.F7,q.F8,q.F9,q.F10,q.F11,q.F12]);class je extends ss{static isAllowedKey(e){return Object.values(q).includes(e)}static isValidKeyState(e){var{keyValue:t}=e;if(t===null)return!0;if(!je.isMacPlatform&&e.metaKey||!je.isAllowedKey(t))return!1;var n=!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey;return!n||xp.has(t)}static createKeyState(e){var t={altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,keyValue:e[e.length-1]};return e.forEach(n=>{switch(n){case re.CTRL:t.ctrlKey=!0;break;case re.ALT:case re.OPTION:t.altKey=!0;break;case re.CMD:t.metaKey=!0;break;case re.SHIFT:t.shiftKey=!0;break}}),t}static getKeyStateFromEvent(e){var{key:t,keyCode:n}=e,i="";return t==="Shift"||t==="Meta"||t==="Control"||t==="Alt"?i="":!je.isAllowedKey(t)&&je.isAllowedKey(String.fromCharCode(n))?i=String.fromCharCode(n):i=t,{keyValue:i,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey}}static getWindowsDisplayText(e){var t="";return e.ctrlKey&&(t+="Ctrl+"),e.altKey&&(t+="Alt+"),e.shiftKey&&(t+="Shift+"),e.keyValue===q.ESCAPE?t+="Esc":e.keyValue!==null&&(t+=e.keyValue),t}static getMacDisplayText(e){var t="";switch(e.ctrlKey&&(t+="⌃"),e.altKey&&(t+="⌥"),e.shiftKey&&(t+="⇧"),e.metaKey&&(t+="⌘"),e.keyValue){case q.ENTER:t+="⏎";break;case q.ESCAPE:t+="⎋";break;case q.BACKSPACE:t+="⌫";break;case q.DELETE:t+="⌦";break;case null:break;default:t+=e.keyValue}return t}static doKeyStatesMatch(e,t){var n,i;return((n=e.keyValue)===null||n===void 0?void 0:n.toUpperCase())===((i=t.keyValue)===null||i===void 0?void 0:i.toUpperCase())&&e.altKey===t.altKey&&e.ctrlKey===t.ctrlKey&&e.metaKey===t.metaKey&&e.shiftKey===t.shiftKey}static getDisplayText(e){return e.keyValue===null?"":je.isMacPlatform?je.getMacDisplayText(e):je.getWindowsDisplayText(e)}constructor(e){var{id:t,shortcut:n,macShortcut:i,isEditable:a=!0,name:o,tooltip:s}=e;super(),Bn(this,"id",void 0),Bn(this,"name",void 0),Bn(this,"tooltip",void 0),Bn(this,"isEditable",void 0),Bn(this,"defaultKeyState",void 0),Bn(this,"keyState",void 0),this.id=t,this.name=o,this.tooltip=s,this.isEditable=a;var l=je.isMacPlatform,d=l?i:n;this.defaultKeyState=je.createKeyState(d),this.keyState=this.defaultKeyState}getDisplayText(){return je.getDisplayText(this.keyState)}getKeyState(){return this.keyState}setKeyState(e){je.isValidKeyState(e)?(Ol.debug2("Shortcut ".concat(this.id," updated to ").concat(JSON.stringify(e))),this.keyState=e,this.dispatchEvent(new Te("onUpdate",{detail:this}))):Ol.debug2("Shortcut ".concat(this.id," tried to update to invalid keyState ").concat(JSON.stringify(e)))}getDefaultKeyState(){return this.defaultKeyState}isDefault(){return je.doKeyStatesMatch(this.getDefaultKeyState(),this.getKeyState())}setToNull(){this.setKeyState(je.NULL_KEY_STATE)}isNull(){return je.doKeyStatesMatch(this.keyState,je.NULL_KEY_STATE)}setToDefault(){this.setKeyState(this.defaultKeyState)}matchesKeyState(e){return je.doKeyStatesMatch(e,this.keyState)}matchesEvent(e){return this.matchesKeyState(je.getKeyStateFromEvent(e))}}Bn(je,"NULL_KEY_STATE",{metaKey:!1,shiftKey:!1,altKey:!1,ctrlKey:!1,keyValue:null});Bn(je,"isMacPlatform",_t.isMacPlatform());function Dl(r,e,t){return e=Fp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Fp(r){var e=Rp(r,"string");return typeof e=="symbol"?e:String(e)}function Rp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ml=z.module("ShortcutRegistry");class Lp extends ss{constructor(){super(...arguments),Dl(this,"shortcutMap",new Map),Dl(this,"shortcutsByCategory",new Map)}createAndAdd(e){var t=new je(e);return this.add(t)}add(e){var t=this.shortcutMap.get(e.id);if(t)return Ml.warn("Skipping attempt to add duplicate shortcut ID to registry: ".concat(e.id)),t;Ml.debug2("Adding shortcut to registry: ".concat(e.id)),e.addEventListener("onUpdate",a=>{var{detail:o}=a;return this.dispatchEvent(new Te("onUpdate",{detail:o}))});var n=e.id.split(".")[0];if(this.shortcutMap.set(e.id,e),this.shortcutsByCategory.has(n)){var i;(i=this.shortcutsByCategory.get(n))===null||i===void 0||i.push(e)}else this.shortcutsByCategory.set(n,[e]);return e}get(e){return this.shortcutMap.get(e)}getConflictingShortcuts(e){return Array.from(this.shortcutMap.values()).filter(t=>!t.isNull()&&t.matchesKeyState(e))}}var Ap=Object.freeze(new Lp);const De=Ap;var kp={COPY:De.createAndAdd({id:"GLOBAL.COPY",name:"Copy",shortcut:[re.CTRL,q.C],macShortcut:[re.CMD,q.C],isEditable:!1}),PASTE:De.createAndAdd({id:"GLOBAL.PASTE",name:"Paste",shortcut:[re.CTRL,q.V],macShortcut:[re.CMD,q.V],isEditable:!1}),SAVE:De.createAndAdd({id:"GLOBAL.SAVE",name:"Save",shortcut:[re.CTRL,q.S],macShortcut:[re.CMD,q.S],isEditable:!1}),SELECT_ALL:De.createAndAdd({id:"GLOBAL.SELECT_ALL",name:"Select All",shortcut:[re.CTRL,q.A],macShortcut:[re.CMD,q.A],isEditable:!1}),LINKER:De.createAndAdd({id:"GLOBAL.LINKER",name:"Linker",shortcut:[re.CTRL,q.L],macShortcut:[re.CMD,q.L]}),LINKER_CLOSE:De.createAndAdd({id:"GLOBAL.LINKER_CLOSE",name:"Close Linker Overlay",shortcut:[q.ESCAPE],macShortcut:[q.ESCAPE],isEditable:!1}),COPY_VERSION_INFO:De.createAndAdd({id:"GLOBAL.COPY_VERSION_INFO",name:"Copy Version Info",shortcut:[re.CTRL,re.ALT,q.I],macShortcut:[re.CMD,re.SHIFT,q.I],isEditable:!0}),NEXT:De.createAndAdd({id:"GLOBAL.NEXT",name:"Next",shortcut:[q.ENTER],macShortcut:[q.ENTER],isEditable:!1}),PREVIOUS:De.createAndAdd({id:"GLOBAL.PREVIOUS",name:"Previous",shortcut:[re.SHIFT,q.ENTER],macShortcut:[re.SHIFT,q.ENTER],isEditable:!1})};const Pn=kp;function jo(r,e,t){return e=jp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jp(r){var e=$p(r,"string");return typeof e=="symbol"?e:String(e)}function $p(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class zh extends b.PureComponent{constructor(e){super(e),jo(this,"inputField",void 0),jo(this,"searchChangeSelection",void 0),this.inputField=Z.createRef(),this.searchChangeSelection=Z.createRef()}componentDidMount(){this.setInputPaddingRight()}componentDidUpdate(){this.setInputPaddingRight()}focus(){var e;(e=this.inputField.current)===null||e===void 0||e.focus()}setInputPaddingRight(){var e=this.inputField.current,t=this.searchChangeSelection.current;if(e&&t){var n=t.getBoundingClientRect().width;e.style.paddingRight="".concat(n,"px")}}render(){var{value:e,placeholder:t,onBlur:n,onChange:i,className:a,disabled:o,matchCount:s,id:l,onKeyDown:d,"data-testid":u,cursor:c}=this.props,m,f=[{action:()=>c==null?void 0:c.next("forward"),shortcut:Pn.NEXT},{action:()=>c==null?void 0:c.next("back"),shortcut:Pn.PREVIOUS}];return c&&s>1?m=h.jsxs(h.Fragment,{children:[h.jsx(Y,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("back")},icon:Th,tooltip:"Previous match (".concat(Pn.PREVIOUS.getDisplayText(),")")}),h.jsxs("span",{className:"search-change-text",children:[c.index!==void 0&&"".concat(c.index+1," of "),s]}),h.jsx(Y,{kind:"ghost",className:"search-change-button",type:"button",onClick:()=>{c.next("forward")},icon:Of,tooltip:"Next match (".concat(Pn.NEXT.getDisplayText(),")")})]}):m=s>0&&h.jsx("span",{className:"search-match",children:s}),h.jsxs("div",{className:J("search-group",a),children:[h.jsx("input",{type:"search",value:e,onBlur:n,onChange:i,onKeyDown:d,className:"form-control",disabled:o,placeholder:t,ref:this.inputField,id:l,"data-testid":u}),s!=null?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"search-change-selection",ref:this.searchChangeSelection,children:m}),h.jsx(fe,{actions:f})]}):h.jsx("span",{className:"search-icon",children:h.jsx(ue,{icon:Df})})]})}}jo(zh,"defaultProps",{placeholder:"Search",className:"",matchCount:null,onKeyDown(){},id:"","data-testid":void 0,cursor:void 0});const Es=zh;function Hp(r){var{copy:e,kind:t="ghost",tooltip:n="Copy",className:i,style:a,"data-testid":o,children:s}=r,[l,d]=cp();return h.jsx(Y,{kind:t,className:i,style:a,"data-testid":o,icon:l?Mf:_h,tooltip:l?"Copied":n,onClick:()=>{d(typeof e=="function"?e():e)},children:s})}function Il(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Vp(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Il(Object(t),!0).forEach(function(n){Pi(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Il(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Pi(r,e,t){return e=Up(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Up(r){var e=Bp(r,"string");return typeof e=="symbol"?e:String(e)}function Bp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Kh extends b.PureComponent{constructor(e){var t;super(e),Pi(this,"container",void 0),Pi(this,"oldFocus",void 0),Pi(this,"rAF",void 0),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMenuItemClick=this.handleMenuItemClick.bind(this),this.handleMenuItemMouseMove=this.handleMenuItemMouseMove.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.container=Z.createRef(),this.oldFocus=document.activeElement,this.rAF=0;var{options:n}=e,i=(t=n.initialKeyboardIndex)!==null&&t!==void 0?t:-1;this.state={menuItems:[],keyboardIndex:i,mouseIndex:-1}}componentDidMount(){this.initMenu(),this.rAF=window.requestAnimationFrame(()=>{var e;(e=this.container.current)===null||e===void 0||e.focus();var{onMenuOpened:t}=this.props;t(this)})}componentDidUpdate(e){var{actions:t}=this.props;e.actions!==t&&this.initMenu()}componentWillUnmount(){cancelAnimationFrame(this.rAF)}getKeyboardIndex(){var{options:e}=this.props;if(e.separateKeyboardMouse!==void 0&&e.separateKeyboardMouse){var{keyboardIndex:t}=this.state;return t}return this.getMouseIndex()}setKeyboardIndex(e){var{options:t}=this.props;t.separateKeyboardMouse!==void 0&&t.separateKeyboardMouse?this.setState({keyboardIndex:e}):this.setMouseIndex(e)}getMouseIndex(){var{mouseIndex:e}=this.state;return e}setMouseIndex(e){this.setState({mouseIndex:e})}initMenu(){cancelAnimationFrame(this.rAF),this.setState({menuItems:[]});var{actions:e}=this.props,t=_t.getMenuItems(e,!1);t.length>0&&this.setState(n=>({menuItems:_t.sortActions(n.menuItems.concat(t))}))}handleKeyDown(e){var{menuItems:t}=this.state,n=this.getKeyboardIndex(),i=n;if(e.key==="Enter"||e.key===" "){n!=null&&n>=0&&n<t.length&&this.handleMenuItemClick(t[n],e);return}if(e.key==="Escape")i=null;else if(e.key==="ArrowUp"||e.key==="Tab"&&e.shiftKey===!0){var a;i=_t.getNextMenuItem((a=i)!==null&&a!==void 0?a:0,-1,t)}else if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var o;i=_t.getNextMenuItem((o=i)!==null&&o!==void 0?o:0,1,t)}n!==i&&(i!==null?this.setKeyboardIndex(i):(this.closeMenu(),this.oldFocus instanceof HTMLElement&&this.oldFocus.focus()),e.preventDefault(),e.stopPropagation())}closeMenu(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{closeMenu:t,onMenuClosed:n}=this.props;cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(()=>{t(e),n(this)})}handleCloseMenu(){this.closeMenu()}handleMenuItemClick(e,t){t.preventDefault(),t.stopPropagation(),e!=null&&(e.disabled===void 0||!e.disabled)&&e.action!=null&&(e.action(t.nativeEvent),this.closeMenu(!0))}handleMenuItemMouseMove(e){var{menuItems:t}=this.state,n=t.indexOf(e);this.setMouseIndex(n)}handleMouseLeave(){this.setMouseIndex(-1)}render(){for(var e=[],{"data-testid":t}=this.props,{keyboardIndex:n,menuItems:i,mouseIndex:a}=this.state,o=0;o<i.length;o+=1){var s=i[o];o>0&&s.group!==i[o-1].group&&e.push(h.jsx("hr",{},"".concat(o,".separator")));var l=h.jsx(cv,{isKeyboardSelected:n===o,isMouseSelected:a===o,menuItem:s,closeMenu:this.handleCloseMenu,onMenuItemClick:this.handleMenuItemClick,onMenuItemMouseMove:this.handleMenuItemMouseMove,onMenuItemContextMenu:()=>!1},o);e.push(l)}var{menuStyle:d}=this.props;return h.jsx("div",{className:"context-menu-container",style:Vp({},d),ref:this.container,onKeyDown:this.handleKeyDown,onMouseLeave:this.handleMouseLeave,role:"menuitem",tabIndex:0,"data-testid":t,children:e})}}Pi(Kh,"defaultProps",{closeMenu(){},onMenuOpened(){},onMenuClosed(){},options:{},menuStyle:{},"data-testid":void 0});const Wp=Kh;function Nl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function xl(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Nl(Object(t),!0).forEach(function(n){Fr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Nl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Fr(r,e,t){return e=Gp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gp(r){var e=zp(r,"string");return typeof e=="symbol"?e:String(e)}function zp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class qh extends b.PureComponent{constructor(e){super(e),Fr(this,"container",void 0),Fr(this,"parent",void 0),Fr(this,"popper",void 0),Fr(this,"isOpen",void 0),this.handleClick=this.handleClick.bind(this),this.handleCloseMenu=this.handleCloseMenu.bind(this),this.handleExited=this.handleExited.bind(this),this.container=Z.createRef(),this.parent=null,this.popper=Z.createRef(),this.isOpen=!1}componentDidMount(){var{isShown:e}=this.props;if(e===null){var t;(t=this.container.current)!==null&&t!==void 0&&t.parentElement&&(this.parent=this.container.current.parentElement,this.parent.addEventListener("click",this.handleClick))}else e&&this.openMenu()}componentDidUpdate(e){var{isShown:t}=this.props;e.isShown!==t&&(t!==null&&t?window.requestAnimationFrame(()=>{this.openMenu()}):this.closeMenu())}componentWillUnmount(){this.parent&&this.parent.removeEventListener("click",this.handleClick)}closeMenu(){var e;(e=this.popper.current)===null||e===void 0||e.hide()}openMenu(){this.popper.current&&!this.isOpen&&(this.popper.current.show(),this.isOpen=!0)}scheduleUpdate(){var e;(e=this.popper.current)===null||e===void 0||e.scheduleUpdate()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.openMenu()}handleCloseMenu(){this.closeMenu()}handleExited(){this.isOpen=!1;var{onMenuClosed:e}=this.props;e()}render(){var{actions:e,onMenuOpened:t,popperClassName:n,"data-testid":i}=this.props,{menuStyle:a}=this.props,{options:o,popperOptions:s}=this.props;return s=xl({placement:"bottom"},s),o=xl({separateKeyboardMouse:!0},o),h.jsx("div",{className:"menu-actions-listener",ref:this.container,"data-testid":i,children:h.jsx(ys,{ref:this.popper,options:s,className:J("menu-popper",n),onExited:this.handleExited,closeOnBlur:!0,interactive:!0,children:h.jsx(Wp,{actions:e,closeMenu:this.handleCloseMenu,onMenuOpened:t,options:o,menuStyle:a})})})}}Fr(qh,"defaultProps",{isShown:null,onMenuClosed(){},onMenuOpened(){},options:{},popperOptions:{},popperClassName:"",menuStyle:{},"data-testid":void 0});const kr=qh;function Xh(r,e,t){return e=Kp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Kp(r){var e=qp(r,"string");return typeof e=="symbol"?e:String(e)}function qp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Zh extends b.PureComponent{constructor(e){super(e),Xh(this,"searchInput",void 0),this.searchInput=Z.createRef(),this.handleChange=this.handleChange.bind(this),this.sendUpdate=It(this.sendUpdate.bind(this),e.debounceMs),this.state={value:e.value}}componentDidUpdate(e){var{value:t}=this.props;e.value!==t&&this.setState({value:t})}focus(){var e;(e=this.searchInput.current)===null||e===void 0||e.focus()}handleChange(e){this.setState({value:e.target.value},this.sendUpdate)}sendUpdate(){var{onChange:e}=this.props,{value:t}=this.state;e(t)}render(){var{placeholder:e,className:t,matchCount:n,id:i,"data-testid":a}=this.props,{value:o}=this.state;return h.jsx(Es,{value:o,placeholder:e,onChange:this.handleChange,className:t,matchCount:n,ref:this.searchInput,id:i,"data-testid":a})}}Xh(Zh,"defaultProps",{placeholder:"Search",className:"",matchCount:null,debounceMs:250,id:"","data-testid":void 0});const Xp=Zh;function Yh(r,e,t){return e=Zp(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Zp(r){var e=Yp(r,"string");return typeof e=="symbol"?e:String(e)}function Yp(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Qp=z.module("ItemListItem");class Ka extends b.Component{static handleKeyDown(){return Qp.log("ItemListItem.handleKeyDown false"),!1}constructor(e){super(e),Yh(this,"itemRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleClick=this.handleClick.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDragOver=this.handleDragOver.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleDrop=this.handleDrop.bind(this),this.handleDoubleClick=this.handleDoubleClick.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.itemRef=Z.createRef()}handleBlur(e){var{itemIndex:t,onBlur:n}=this.props;n(t,e)}handleFocus(e){var{itemIndex:t,onFocus:n}=this.props;n(t,e)}handleClick(e){var{itemIndex:t,onClick:n}=this.props;n(t,e)}handleContextMenu(e){var{itemIndex:t,onContextMenu:n}=this.props;n(t,e)}handleDragStart(e){var{itemIndex:t,onDragStart:n}=this.props;n(t,e)}handleDrag(e){var{itemIndex:t,onDrag:n}=this.props;n(t,e)}handleDragOver(e){e.preventDefault();var{itemIndex:t,onDragOver:n}=this.props;n(t,e)}handleDragEnd(e){var{itemIndex:t,onDragEnd:n}=this.props;n(t,e)}handleDrop(e){var{itemIndex:t,onDrop:n}=this.props;n(t,e)}handleDoubleClick(e){var{itemIndex:t,onDoubleClick:n}=this.props;n(t,e)}handleMouseMove(e){var{itemIndex:t,onMouseMove:n}=this.props;n(t,e)}handleMouseDown(e){var{itemIndex:t,onMouseDown:n}=this.props;n(t,e)}handleMouseUp(e){var{itemIndex:t,onMouseUp:n}=this.props;n(t,e)}render(){var{isDraggable:e,isFocused:t,isSelected:n,style:i,children:a,"data-testid":o}=this.props;return h.jsx("div",{className:J("item-list-item",{active:n},{"is-focused":t},{"is-draggable":e}),onKeyDown:Ka.handleKeyDown,onContextMenuCapture:this.handleContextMenu,onClick:this.handleClick,onDrag:this.handleDrag,onDragStart:this.handleDragStart,onDragOver:this.handleDragOver,onDragEnd:this.handleDragEnd,onDrop:this.handleDrop,onDoubleClick:this.handleDoubleClick,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseUp:this.handleMouseUp,tabIndex:-1,ref:this.itemRef,role:"listitem",style:i,onFocus:this.handleFocus,onBlur:this.handleBlur,draggable:e,"data-testid":o,children:a})}}Yh(Ka,"defaultProps",{children:null,isDraggable:!1,isFocused:!1,isSelected:!1,itemIndex:0,"data-testid":void 0,onBlur(){},onClick(){},onContextMenu(){},onDragStart(){},onDrag(){},onDragOver(){},onDragEnd(){},onDrop(){},onDoubleClick(){},onFocus(){},onMouseDown(){},onMouseMove(){},onMouseUp(){},style:{}});const Jp=Ka;function Fl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Rl(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Fl(Object(t),!0).forEach(function(n){At(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Fl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function At(r,e,t){return e=eg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eg(r){var e=tg(r,"string");return typeof e=="symbol"?e:String(e)}function tg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ll=z.module("ItemList"),Al=5;class Ot extends b.PureComponent{static renderItem(e){var t,n,{item:i}=e;return h.jsx("div",{className:"item-list-item-content",children:i!=null&&((t=(n=i.displayValue)!==null&&n!==void 0?n:i.value)!==null&&t!==void 0?t:"".concat(i))})}constructor(e){super(e),At(this,"list",void 0),At(this,"listContainer",void 0),At(this,"getItemSelected",qe((i,a)=>Sn.isSelected(a,i),{max:Ot.CACHE_SIZE})),At(this,"getCachedItem",qe((i,a,o,s,l,d,u,c)=>{var m=d({item:o,itemIndex:i,isFocused:s,isSelected:l,style:u});return h.jsx(Jp,{onContextMenu:this.handleItemContextMenu,onDoubleClick:this.handleItemDoubleClick,onMouseDown:this.handleItemMouseDown,onFocus:this.handleItemFocus,onBlur:this.handleItemBlur,disableSelect:c,onMouseMove:this.handleItemMouseMove,onMouseUp:this.handleItemMouseUp,isFocused:s,isSelected:l,itemIndex:i,style:u,children:m},a)},{max:Ot.CACHE_SIZE})),At(this,"getOuterElement",qe(i=>{var a=Z.forwardRef((o,s)=>h.jsx("div",Rl({ref:s,tabIndex:-1,onKeyDown:i,role:"presentation"},o)));return a.displayName="ItemListOuterElement",a})),At(this,"getInnerElement",qe(()=>{var i=Z.forwardRef((a,o)=>h.jsx("div",Rl({className:"item-list-inner-element",ref:o},a)));return i.displayName="ItemListInnerElement",i})),At(this,"getItemData",qe((i,a,o)=>({items:i,selectedRanges:a,renderItem:o}))),this.handleItemBlur=this.handleItemBlur.bind(this),this.handleItemContextMenu=this.handleItemContextMenu.bind(this),this.handleItemFocus=this.handleItemFocus.bind(this),this.handleItemDoubleClick=this.handleItemDoubleClick.bind(this),this.handleItemMouseDown=this.handleItemMouseDown.bind(this),this.handleItemMouseMove=this.handleItemMouseMove.bind(this),this.handleItemMouseUp=this.handleItemMouseUp.bind(this),this.handleItemsRendered=this.handleItemsRendered.bind(this),this.handleWindowMouseUp=this.handleWindowMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleResize=this.handleResize.bind(this),this.renderInnerElement=this.renderInnerElement.bind(this),this.list=Z.createRef(),this.listContainer=Z.createRef();var{isStickyBottom:t,selectedRanges:n}=e;this.state={focusIndex:null,mouseDownIndex:null,selectedRanges:n,overscanStartIndex:0,height:null,isDragging:!1,isStuckToBottom:t,scrollOffset:null,mouseX:null,mouseY:null}}componentDidUpdate(e,t){var{selectedRanges:n,itemCount:i}=this.props,{focusIndex:a,isStuckToBottom:o,scrollOffset:s,height:l,selectedRanges:d}=this.state;if(o&&!this.isListAtBottom()&&i>0&&this.scrollToBottom(),(s!==t.scrollOffset||l!==t.height)&&this.sendViewportUpdate(),n!==e.selectedRanges&&n!==d)this.setSelectedRanges(n);else if(d!==t.selectedRanges){var{onSelectionChange:u}=this.props;u(d)}if(a!==t.focusIndex){var{onFocusChange:c}=this.props;c(a)}}componentWillUnmount(){window.removeEventListener("mouseup",this.handleWindowMouseUp)}focus(){var e;(e=this.listContainer.current)===null||e===void 0||e.focus()}restoreScrollPosition(){var{scrollOffset:e}=this.state;if(e!=null){var t;(t=this.listContainer.current)===null||t===void 0||t.scrollTo(0,e)}}getElement(e){if(this.listContainer.current==null)return null;var{focusSelector:t}=this.props,{overscanStartIndex:n}=this.state,i=this.listContainer.current.querySelectorAll(t),a=e-n;return i[a]}focusItem(e){var{disableSelect:t}=this.props;if(!t){this.setState({focusIndex:e});var n=this.getElement(e);n instanceof HTMLElement&&n.focus()}}scrollToItem(e){var t=this.getElement(e);t!=null&&t.scrollIntoView({block:"center"})}handleItemContextMenu(e,t){this.setState({focusIndex:e});var{selectedRanges:n}=this.state,i=Sn.isSelected(n,e),a=i||_t.isModifierKeyDown(t);this.toggleSelect(e,t.shiftKey,a,!1)}handleItemDoubleClick(e,t){var{isDoubleClickSelect:n,onSelect:i}=this.props;n&&this.setState(a=>{var{selectedRanges:o}=a;return{selectedRanges:Sn.selectRange(o,[e,e])}},()=>{i(e,t)})}handleItemMouseDown(e,t){var{selectedRanges:n}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(t.button===2&&n.length===0){this.focusItem(e),this.selectItem(e);return}t.button!=null&&t.button!==0||(this.setState({mouseDownIndex:e,mouseX:t.clientX,mouseY:t.clientY}),window.addEventListener("mouseup",this.handleWindowMouseUp))}}handleItemBlur(e,t){Ll.debug2("item blur",e,t.currentTarget,t.relatedTarget),(!t.relatedTarget||this.listContainer.current&&t.relatedTarget instanceof HTMLElement&&!this.listContainer.current.contains(t.relatedTarget))&&this.setState({focusIndex:null})}handleItemFocus(e,t){Ll.debug2("item focus",e,t.target),this.setState(n=>{var{focusIndex:i}=n;return i!==e?{focusIndex:e}:null})}handleItemMouseMove(e,t){var{isDragSelect:n,isMultiSelect:i,disableSelect:a}=this.props,{mouseDownIndex:o,selectedRanges:s,mouseX:l,mouseY:d}=this.state;if(!(o==null||a)){var u=Math.abs(t.clientX-(l??0)),c=Math.abs(t.clientY-(d??0));u>Al&&c>Al&&this.setState({isDragging:!0}),(n||o===e)&&(this.focusItem(e),i?(!n&&!this.getItemSelected(e,s)&&!_t.isModifierKeyDown(t)&&this.deselectAll(),this.selectRange([Math.min(o,e),Math.max(o,e)])):this.toggleSelect(e,t.shiftKey,_t.isModifierKeyDown(t),!1))}}handleItemMouseUp(e,t){var{isDeselectOnClick:n,isDoubleClickSelect:i,onSelect:a}=this.props,{mouseDownIndex:o,isDragging:s}=this.state;if(!(t.target instanceof HTMLElement&&["button","select","input","textarea"].indexOf(t.target.tagName.toLowerCase())!==-1)){if(o===e&&!s){var l=t.shiftKey,d=_t.isModifierKeyDown(t);this.focusItem(e),this.toggleSelect(e,l,d,n),!i&&!l&&!d&&a(e,t)}this.resetMouseState()}}handleItemsRendered(e){var{overscanStartIndex:t}=e;this.setState({overscanStartIndex:t})}handleResize(e){var{height:t}=e;this.setState({height:t})}handleMouseLeave(){this.setState({mouseDownIndex:null})}handleWindowMouseUp(){this.resetMouseState(),window.removeEventListener("mouseup",this.handleWindowMouseUp)}handleKeyDown(e){var{isMultiSelect:t,itemCount:n,onSelect:i}=this.props,{focusIndex:a}=this.state,o=a;if(e.key==="Enter"||e.key===" "){!t&&o!=null&&this.setState({selectedRanges:[[o,o]]},()=>{o!=null&&i(o,e)});return}if(e.key==="ArrowUp")o!=null&&o>=0?o=Math.max(0,o-1):o=n-1;else if(e.key==="ArrowDown")o!=null&&o>=0?o=Math.min(o+1,n-1):o=0;else return;if(a!==o){e.stopPropagation(),e.preventDefault(),this.focusItem(o);var{selectedRanges:s}=this.state;if(e.shiftKey&&s.length>0){var l=s[s.length-1];this.selectRange([Math.min(o,l[0]),Math.max(o,l[1])])}else if(this.deselectAll(),o!==null)this.selectItem(o);else{var d;(d=this.listContainer.current)===null||d===void 0||d.focus()}this.scrollIntoView(o)}}handleScroll(e){var{scrollUpdateWasRequested:t,scrollOffset:n}=e;this.setState(i=>{if(t)return{scrollOffset:n};var{isStickyBottom:a}=this.props,{height:o}=i,s=a&&this.isListAtBottom({scrollOffset:n,height:o});return{isStuckToBottom:s,scrollOffset:n}})}resetMouseState(){this.setState({mouseDownIndex:null,isDragging:!1})}scrollToBottom(){var{itemCount:e}=this.props;this.list.current&&this.list.current.scrollToItem(e)}scrollIntoView(e){this.list.current&&this.list.current.scrollToItem(e)}toggleSelect(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,{isMultiSelect:a}=this.props,{selectedRanges:o}=this.state;if(a&&t&&o.length>0){var s=o[o.length-1];this.selectRange([Math.min(s[0],e),Math.max(e,s[1])])}else a&&o.length===1&&o[0][0]===e&&o[0][1]===e?i&&this.deselectItem(e):a&&n?this.getItemSelected(e,o)?i&&this.deselectItem(e):this.selectItem(e):(this.deselectAll(),this.selectItem(e))}deselectAll(){var{itemCount:e}=this.props;this.deselectRange([0,e])}deselectItem(e){this.deselectRange([e,e])}deselectRange(e){Sn.validateRange(e),this.setState(t=>{var{selectedRanges:n}=t;return{selectedRanges:Sn.deselectRange(n,e)}})}selectItem(e){var{disableSelect:t}=this.props;t||this.selectRange([e,e])}selectRange(e){Sn.validateRange(e),this.setState(t=>{var{selectedRanges:n}=t;return{selectedRanges:Sn.selectRange(n,e)}})}setSelectedRanges(e){this.setState({selectedRanges:e})}sendViewportUpdate(){var{scrollOffset:e,height:t}=this.state;if(e!=null&&t!=null){var{onViewportChange:n,rowHeight:i}=this.props,a=Math.floor(e/i),o=a+Math.ceil(t/i);n(a,o)}}isListAtBottom(){var{scrollOffset:e,height:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state;if(t==null||e==null)return!1;var{itemCount:n,rowHeight:i}=this.props;return e+t>=n*i}renderInnerElement(e){var{index:t,style:n}=e,{items:i,offset:a,renderItem:o,disableSelect:s}=this.props,{focusIndex:l,selectedRanges:d}=this.state;if(t<a||t>=a+i.length)return null;var u=i[t-a];return this.getCachedItem(t,t,u,t===l&&!s,this.getItemSelected(t,d),o,n,s)}render(){var{items:e,itemCount:t,overscanCount:n,renderItem:i,rowHeight:a,"data-testid":o}=this.props,{selectedRanges:s,isStuckToBottom:l}=this.state;return h.jsx(gf,{className:"item-list-auto-sizer",onResize:this.handleResize,children:d=>{var{width:u,height:c}=d;return h.jsx(bf,{className:"item-list-scroll-pane",height:c,width:u,initialScrollOffset:l?t*a:0,itemCount:t,itemSize:a,itemData:this.getItemData(e,s,i),onScroll:this.handleScroll,onItemsRendered:this.handleItemsRendered,ref:this.list,outerElementType:this.getOuterElement(this.handleKeyDown),outerRef:this.listContainer,innerElementType:this.getInnerElement(),overscanCount:n,"data-testid":o,children:this.renderInnerElement})}})}}At(Ot,"CACHE_SIZE",1e3);At(Ot,"DEFAULT_ROW_HEIGHT",20);At(Ot,"DEFAULT_OVERSCAN",10);At(Ot,"defaultProps",{offset:0,items:[],rowHeight:Ot.DEFAULT_ROW_HEIGHT,isDeselectOnClick:!0,isDoubleClickSelect:!1,isDragSelect:!0,isMultiSelect:!1,isStickyBottom:!1,disableSelect:!1,onFocusChange(){},onSelect(){},onSelectionChange(){},onViewportChange(){},overscanCount:Ot.DEFAULT_OVERSCAN,renderItem:Ot.renderItem,selectedRanges:[],focusSelector:".item-list-item","data-testid":void 0});function ng(r){var{on:e,id:t,className:n,isInvalid:i,disabled:a=!1,onClick:o,"data-testid":s}=r;return h.jsx("button",{type:"button",className:J("btn","btn-switch",n,{active:e},{"is-invalid":i}),id:t,onClick:o,disabled:a,"data-testid":s,children:h.jsx("div",{className:"handle"})})}function rg(r){var{children:e,disabled:t=!1,name:n,onChange:i,value:a="","data-testid":o}=r,[s]=b.useState(n??Ue());return h.jsx(h.Fragment,{children:Z.Children.map(e,l=>{var d,u;return l?Z.cloneElement(l,{name:s,onChange:(d=l.props.onChange)!==null&&d!==void 0?d:i,checked:a===l.props.value,disabled:(u=l.props.disabled)!==null&&u!==void 0?u:t,"data-testid":o}):null})})}var Ps=Z.forwardRef((r,e)=>{var{checked:t,children:n,className:i="",disabled:a=!1,inputClassName:o="",isInvalid:s=!1,labelClassName:l="",name:d,onChange:u,value:c,"data-testid":m}=r,[f]=b.useState(Ue());return h.jsxs("div",{className:J("custom-control custom-radio",i),children:[h.jsx("input",{type:"radio",id:f,"data-testid":m,name:d,ref:e,className:J("custom-control-input",o,{"is-invalid":s}),checked:t,disabled:a,value:c,onChange:u}),h.jsx("label",{className:J("custom-control-label",l),htmlFor:f,children:n})]})});Ps.displayName="RadioItem";Ps.defaultProps={checked:void 0,className:"",disabled:!1,inputClassName:"",isInvalid:!1,labelClassName:"",name:void 0,onChange:void 0,"data-testid":void 0};const kl=Ps;var ig=z.module("ThemeProvider"),Qh=b.createContext(null);function BD(r){var{themes:e,defaultPreloadValues:t=kf,children:n}=r,i=b.useMemo(()=>If(),[]),[a,o]=b.useState(null),[s,l]=b.useState(()=>{var c,m;return(c=(m=Nf())===null||m===void 0?void 0:m.themeKey)!==null&&c!==void 0?c:xf}),d=b.useMemo(()=>e==null?null:Ff(s,{base:i,custom:e??[]}),[i,s,e]),u=b.useMemo(()=>[...i,...e??[]],[i,e]);return b.useEffect(function(){if(!(d==null||e==null)){Rf(t);var m=Lf(t);ig.debug2("updateThemePreloadData:",{active:d.map(f=>f.themeKey),custom:e.map(f=>f.themeKey),preloadStyleContent:m,selectedThemeKey:s}),Af({themeKey:s,preloadStyleContent:m})}},[d,s,e,t]),b.useEffect(()=>{o({activeThemes:d,selectedThemeKey:s,themes:u,setSelectedThemeKey:l})},[d,s,u]),h.jsxs(h.Fragment,{children:[d==null?null:h.jsx(h.Fragment,{children:d.map(c=>h.jsx("style",{"data-theme-key":c.themeKey,children:c.styleContent},c.themeKey))}),a==null?null:h.jsx(Qh.Provider,{value:a,children:h.jsx(Vh,{children:n})})]})}function Jh(){return Ua(Qh,"No ThemeContext value found. Component must be wrapped in a ThemeContext.Provider")}var ag=["children","className","onChange","data-testid"];function jl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function $l(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?jl(Object(t),!0).forEach(function(n){og(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):jl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function og(r,e,t){return e=sg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sg(r){var e=lg(r,"string");return typeof e=="symbol"?e:String(e)}function lg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function dg(r,e){if(r==null)return{};var t=ug(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function ug(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}var ec=Z.forwardRef((r,e)=>{var{children:t,className:n,onChange:i,"data-testid":a}=r,o=dg(r,ag),s=Bh(e),l=b.useCallback(d=>{i(d.target.value)},[i]);return h.jsx("select",$l($l({ref:s,className:J("custom-select",n),onChange:l,"data-testid":a},o),{},{children:t}))});ec.displayName="Select";const Vr=ec;var Ts=Z.forwardRef((r,e)=>{var{children:t,className:n,disabled:i,id:a,isLinked:o,isLinkedSource:s,isInvalid:l,onClick:d,onMouseEnter:u,onMouseLeave:c,style:m,"data-testid":f}=r;return h.jsxs("button",{ref:e,type:"button",className:J("btn-socketed",{"btn-socketed-linked":o!==void 0&&o||s},{"btn-socketed-linked-source":s},{"is-invalid":l},n),id:a,onClick:d,onMouseEnter:u,onMouseLeave:c,style:m,disabled:i,"data-testid":f,children:[t,h.jsx(ue,{icon:jf,className:"linked btn-socketed-icon",transform:"down-1"}),h.jsx(ue,{icon:$f,className:"is-invalid btn-socketed-icon"})]})});Ts.displayName="SocketedButton";Ts.defaultProps={children:void 0,className:"",disabled:!1,id:void 0,isLinked:!1,isLinkedSource:!1,isInvalid:!1,onClick:void 0,onMouseEnter:void 0,onMouseLeave:void 0,style:void 0,"data-testid":void 0};const tc=Ts;function vr(){return Ua(Hf,"No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?")}function nc(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.name!=null}function rc(r){return typeof r=="object"&&r!=null&&typeof r.type=="string"&&r.id!=null}function WD(r){return nc(r)||rc(r)}var hg=b.createContext(null);function GD(r){if(rc(r))return{id:r.id,type:r.type};if(nc(r)){var e;return{name:(e=r.name)!==null&&e!==void 0?e:"",type:r.type}}throw new Error("Invalid descriptor: ".concat(r))}function cg(r){var e,t;return{type:(e=r.type)!==null&&e!==void 0?e:"",name:(t=r.title)!==null&&t!==void 0?t:r.name,id:r.id}}function mg(){return Ua(hg,"No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?")}function _s(r,e,t){return e=fg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fg(r){var e=vg(r,"string");return typeof e=="symbol"?e:String(e)}function vg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class qa{static isValid(e,t){return!0}static isSameFormat(e,t){throw new Error("isSameFormat not implemented")}static makeFormat(e,t,n){return{label:e,formatString:t,type:n}}format(e,t){return""}}_s(qa,"TYPE_GLOBAL","type-global");_s(qa,"TYPE_CONTEXT_PRESET","type-context-preset");_s(qa,"TYPE_CONTEXT_CUSTOM","type-context-custom");const ot=qa;class pg extends ot{format(e){switch(e){case 1:case!0:return"true";case 0:case!1:return"false";default:return""}}}const gg=pg;class bg extends ot{format(e){return String.fromCharCode(e)}}const Cg=bg;function Wn(r,e,t){return e=yg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yg(r){var e=Sg(r,"string");return typeof e=="symbol"?e:String(e)}function Sg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Hl=z.module("DateTimeColumnFormatter");class kt extends ot{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.DateTimeFormat.format(t.formatString,new Date),!0}catch{return!1}}static makeFormat(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ot.TYPE_CONTEXT_PRESET;return{label:e,formatString:t,type:n}}static isSameFormat(e,t){return e===t||e!==null&&t!==null&&e.type===t.type&&e.formatString===t.formatString}static makeGlobalFormatStringMap(e,t){var n=t?"'T'":" ",i=e?" z":"";return new Map([["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(n,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getGlobalFormats(e,t){var n=kt.makeGlobalFormatStringMap(e,t);return[...n.keys()]}static makeFormatStringMap(e,t){var n=t!==void 0&&t?"'T'":" ",i=e!==void 0&&e?" z":"";return new Map([["yyyy-MM-dd","yyyy-MM-dd".concat(i)],["MM-dd-yyyy","MM-dd-yyyy".concat(i)],["HH:mm:ss","HH:mm:ss".concat(i)],["HH:mm:ss.SSS","HH:mm:ss.SSS".concat(i)],["HH:mm:ss.SSSSSSSSS","HH:mm:ss.SSSSSSSSS".concat(i)],["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd".concat(n,"HH:mm:ss").concat(i)],["yyyy-MM-dd HH:mm:ss.SSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSS").concat(i)],["yyyy-MM-dd HH:mm:ss.SSSSSSSSS","yyyy-MM-dd".concat(n,"HH:mm:ss.SSSSSSSSS").concat(i)]])}static getFormats(e,t){var n=kt.makeFormatStringMap(e,t);return[...n.keys()]}constructor(e){var{timeZone:t="",showTimeZone:n=!0,showTSeparator:i=!1,defaultDateTimeFormatString:a=kt.DEFAULT_DATETIME_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Wn(this,"dh",void 0),Wn(this,"dhTimeZone",void 0),Wn(this,"defaultDateTimeFormatString",void 0),Wn(this,"showTimeZone",void 0),Wn(this,"showTSeparator",void 0),Wn(this,"formatStringMap",void 0);var o=t||kt.DEFAULT_TIME_ZONE_ID;try{this.dhTimeZone=e.i18n.TimeZone.getTimeZone(o)}catch{Hl.error("Unsupported time zone id",o),this.dhTimeZone=e.i18n.TimeZone.getTimeZone(kt.DEFAULT_TIME_ZONE_ID)}this.dh=e,this.defaultDateTimeFormatString=a,this.showTimeZone=n,this.showTSeparator=i,this.formatStringMap=kt.makeFormatStringMap(n,i)}getEffectiveFormatString(e){var t;return(t=this.formatStringMap.get(e))!==null&&t!==void 0?t:e}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultDateTimeFormatString,i=this.getEffectiveFormatString(n);try{return this.dh.i18n.DateTimeFormat.format(i,e,this.dhTimeZone)}catch{Hl.error("Invalid format arguments")}return""}}Wn(kt,"DEFAULT_DATETIME_FORMAT_STRING","yyyy-MM-dd HH:mm:ss.SSS");Wn(kt,"DEFAULT_TIME_ZONE_ID","America/New_York");function ln(r,e,t){return e=wg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wg(r){var e=Eg(r,"string");return typeof e=="symbol"?e:String(e)}function Eg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Pg=z.module("DecimalColumnFormatter");class ze extends ot{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ot.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:n,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;return ze.makeFormat(e,t,ot.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return ze.makeFormat("Custom Format",e,ot.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=ze.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),ln(this,"defaultFormatString",void 0),ln(this,"dh",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(n,i)}catch{Pg.error("Invalid format arguments")}return""}}ln(ze,"DEFAULT_FORMAT_STRING","###,##0.0000");ln(ze,"FORMAT_PERCENT",ze.makePresetFormat("Percent","##0.00%"));ln(ze,"FORMAT_BASIS_POINTS",ze.makePresetFormat("Basis Points","###,##0 bp",1e4));ln(ze,"FORMAT_MILLIONS",ze.makePresetFormat("Millions","###,##0.000 mm",1e-6));ln(ze,"FORMAT_SCIENTIFIC_NOTATION",ze.makePresetFormat("Scientific Notation","0.0000E0"));ln(ze,"FORMAT_ROUND",ze.makePresetFormat("Round","###,##0"));ln(ze,"FORMAT_ROUND_TWO_DECIMALS",ze.makePresetFormat("0.00","###,##0.00"));ln(ze,"FORMAT_ROUND_FOUR_DECIMALS",ze.makePresetFormat("0.0000","###,##0.0000"));class Tg extends ot{format(e){return"".concat(e)}}const _g=Tg;function Mi(r,e,t){return e=Og(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Og(r){var e=Dg(r,"string");return typeof e=="symbol"?e:String(e)}function Dg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Mg=z.module("IntegerColumnFormatter");class sn extends ot{static isValid(e,t){if(t.formatString==null)return!1;try{return e.i18n.NumberFormat.format(t.formatString,0),!0}catch{return!1}}static makeFormat(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ot.TYPE_CONTEXT_PRESET,i=arguments.length>3?arguments[3]:void 0;return{label:e,type:n,formatString:t,multiplier:i}}static makePresetFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2?arguments[2]:void 0;return sn.makeFormat(e,t,ot.TYPE_CONTEXT_PRESET,n)}static makeCustomFormat(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;return sn.makeFormat("Custom Format",e,ot.TYPE_CONTEXT_CUSTOM,t)}static isSameFormat(e,t){return e===t||e!=null&&t!=null&&e.type===t.type&&e.formatString===t.formatString&&e.multiplier===t.multiplier}constructor(e){var{defaultFormatString:t=sn.DEFAULT_FORMAT_STRING}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Mi(this,"dh",void 0),Mi(this,"defaultFormatString",void 0),this.dh=e,this.defaultFormatString=t}format(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.formatString!=null&&t.formatString!==""?t.formatString:this.defaultFormatString,i=t.multiplier!=null&&t.multiplier!==0?e*t.multiplier:e;try{return this.dh.i18n.NumberFormat.format(n,i)}catch{Mg.error("Invalid format arguments")}return""}}Mi(sn,"DEFAULT_FORMAT_STRING","###,##0");Mi(sn,"FORMAT_MILLIONS",sn.makePresetFormat("Millions","###,##0.000 mm",1e-6));Mi(sn,"FORMAT_SCIENTIFIC_NOTATION",sn.makePresetFormat("Scientific Notation","0.0000E0"));class Ig extends ot{format(e){return e}}function ic(r,e,t){return e=Ng(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ng(r){var e=xg(r,"string");return typeof e=="symbol"?e:String(e)}function xg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class He{static makeDateWrapper(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:0,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,d=arguments.length>8&&arguments[8]!==void 0?arguments[8]:0;if(!t)throw new Error("No timezone provided");var u="".concat(n).padStart(4,"0"),c="".concat(i+1).padStart(2,"0"),m="".concat(a).padStart(2,"0"),f="".concat(o).padStart(2,"0"),g="".concat(s).padStart(2,"0"),v="".concat(l).padStart(2,"0"),p="".concat(d).padStart(9,"0"),C="".concat(u,"-").concat(c,"-").concat(m," ").concat(f,":").concat(g,":").concat(v,".").concat(p);return e.i18n.DateTimeFormat.parse(He.FULL_DATE_FORMAT,C,e.i18n.TimeZone.getTimeZone(t))}static getNextNanos(e){var t=parseInt(e,10),n="0".repeat(9-e.length),i="".concat(t+1).concat(n);return parseInt(i,10)}static getNextDate(e,t,n,i){var{year:a,month:o,date:s,hours:l,minutes:d,seconds:u,nanos:c}=n;if(t.nanos!=null){if(t.nanos.length===9)return null;c=He.getNextNanos(t.nanos),c>999999999&&(u+=1,c=0)}else t.seconds!=null?u+=1:t.minutes!=null?d+=1:t.hours!=null?l+=1:t.date!=null?s+=1:t.month!=null?o+=1:a+=1;var m=new Date(a,o,s,l,d,u);return He.makeDateWrapper(e,i,m.getFullYear(),m.getMonth(),m.getDate(),m.getHours(),m.getMinutes(),m.getSeconds(),c)}static parseMonth(e){var t=parseInt(e,10);if(!Number.isNaN(t))return t>=1&&t<=12?t-1:NaN;var n=e.trim().toLowerCase();if(n.length>=3){for(var i=0;i<He.months.length;i+=1)if(He.months[i].startsWith(n))return i}return NaN}static parseDateValues(e,t,n,i,a,o,s){var l=parseInt(e,10),d=t!=null?this.parseMonth(t):0,u=n!=null?parseInt(n,10):1,c=i!=null?parseInt(i,10):0,m=a!=null?parseInt(a,10):0,f=o!=null?parseInt(o,10):0,g=s!=null?parseInt(s.padEnd(9,"0"),10):0;return Number.isNaN(l)||Number.isNaN(d)||Number.isNaN(u)||Number.isNaN(c)||Number.isNaN(m)||Number.isNaN(f)||Number.isNaN(g)?null:{year:l,month:d,date:u,hours:c,minutes:m,seconds:f,nanos:g}}static parseDateTimeString(e){var t=/\s*(\d{4})([-./]([\da-z]+))?([-./](\d{1,2}))?([tT\s](\d{2})([:](\d{2}))?([:](\d{2}))?([.](\d{1,9}))?)?(.*)/,n=t.exec(e);if(n==null)throw new Error("Unexpected date string: ".concat(e));var[,i,,a,,o,,s,,l,,d,,u,c]=n;if(c!=null&&c.length>0)throw new Error("Unexpected characters after date string '".concat(e,"': ").concat(c));return{year:i,month:a,date:o,hours:s,minutes:l,seconds:d,nanos:u}}static parseDateRange(e,t,n){var i=t.trim().toLowerCase();if(i.length===0)throw new Error("Cannot parse date range from empty string");if(i==="null")return[null,null];if(i==="today"){var a=new Date(Date.now()),o=He.makeDateWrapper(e,n,a.getFullYear(),a.getMonth(),a.getDate()),s=new Date(a.getFullYear(),a.getMonth(),a.getDate()+1),l=He.makeDateWrapper(e,n,s.getFullYear(),s.getMonth(),s.getDate());return[o,l]}if(i==="yesterday"){var d=new Date(Date.now()),u=new Date(d.getFullYear(),d.getMonth(),d.getDate()-1),c=He.makeDateWrapper(e,n,u.getFullYear(),u.getMonth(),u.getDate()),m=He.makeDateWrapper(e,n,d.getFullYear(),d.getMonth(),d.getDate());return[c,m]}if(i==="now"){var f=new Date(Date.now()),g=e.DateWrapper.ofJsDate(f);return[g,null]}var v=He.parseDateTimeString(i);if(v.year==null&&v.month==null&&v.date==null)throw new Error("Unable to extract year, month, or day ".concat(i));var p=He.parseDateValues(v.year,v.month,v.date,v.hours,v.minutes,v.seconds,v.nanos);if(p==null)throw new Error("Unable to extract date values from ".concat(v));var C=He.makeDateWrapper(e,n,p.year,p.month,p.date,p.hours,p.minutes,p.seconds,p.nanos),S=He.getNextDate(e,v,p,n);return[C,S]}static getJsDate(e){return typeof e=="number"?new Date(e):e.asDate()}}ic(He,"FULL_DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSSSSS");ic(He,"months",["january","february","march","april","may","june","july","august","september","october","november","december"]);function zD(r,e){return r===e?{operator:"notEq",value:""}:{operator:"eq",value:r}}function KD(r,e,t){return function(i){var a=t.trim();if(a==="")return null;var o=ac(e,s=>s.filter().containsIgnoreCase(r.makeFilterValue(s.type,a)),"or");return o(i)}}function ac(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"or";return function(i){var a=i==null?void 0:i.findColumns(typeof r=="string"?[r]:r);if(a==null||a.length===0)return null;var o=a.map(e);return o.reduce((s,l)=>s[t](l))}}function Fg(r,e,t,n){return ac(e,i=>i.filter()[n](r.makeFilterValue(i.type,t)),"or")}function qD(r,e,t,n,i){return function(o){var s=o==null?void 0:o.findColumn(e),l=t==="all"||n&&t.size===0;return s==null||l?null:r.makeSelectValueFilter(s,[...t.keys()],i)}}function XD(r){return function(t){return t.filter().isNull().not().and(t.filter().notEq(r.makeFilterValue(t.type,"")))}}function ZD(r,e){return function(n){var i=n.filter(),a=r.makeFilterValue(n.type,""),o=i.eq(a);return e?i.isNull().or(o):o.or(i.notEq(a))}}function Os(r,e,t){return e=Rg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Rg(r){var e=Lg(r,"string");return typeof e=="symbol"?e:String(e)}function Lg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ii{}Os(Ii,"not","not");Os(Ii,"and","and");Os(Ii,"or","or");function YD(r){if(!(r==="not"||r==="and"||r==="or"))throw new Error("operator is not a valid FilterOperatorValue")}function Re(r,e,t){return e=Ag(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ag(r){var e=kg(r,"string");return typeof e=="symbol"?e:String(e)}function kg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class L{}Re(L,"eq","eq");Re(L,"eqIgnoreCase","eqIgnoreCase");Re(L,"notEq","notEq");Re(L,"notEqIgnoreCase","notEqIgnoreCase");Re(L,"greaterThan","greaterThan");Re(L,"greaterThanOrEqualTo","greaterThanOrEqualTo");Re(L,"lessThan","lessThan");Re(L,"lessThanOrEqualTo","lessThanOrEqualTo");Re(L,"in","in");Re(L,"inIgnoreCase","inIgnoreCase");Re(L,"notIn","notIn");Re(L,"notInIgnoreCase","notInIgnoreCase");Re(L,"isTrue","isTrue");Re(L,"isFalse","isFalse");Re(L,"isNull","isNull");Re(L,"invoke","invoke");Re(L,"contains","contains");Re(L,"notContains","notContains");Re(L,"containsIgnoreCase","containsIgnoreCase");Re(L,"startsWith","startsWith");Re(L,"endsWith","endsWith");Re(L,"containsAny","containsAny");function jg(r){switch(r){case L.eq:return"is exactly";case L.eqIgnoreCase:return"is exactly (ignore case)";case L.notEq:return"is not exactly";case L.notEqIgnoreCase:return"is not exactly (ignore case)";case L.contains:return"contains";case L.notContains:return"does not contain";case L.startsWith:return"starts with";case L.endsWith:return"ends with";default:throw new Error("Unrecognized text filter type ".concat(r))}}function $g(r){switch(r){case L.eq:return"is equal to";case L.notEq:return"is not equal to";case L.greaterThan:return"greater than";case L.greaterThanOrEqualTo:return"greater than or equal to";case L.lessThan:return"less than";case L.lessThanOrEqualTo:return"less than or equal to";default:throw new Error("Unrecognized number filter type ".concat(r))}}function Hg(r){switch(r){case L.eq:return"date is";case L.notEq:return"date is not";case L.notEqIgnoreCase:case L.greaterThan:return"date is after";case L.greaterThanOrEqualTo:return"date is after or equal";case L.lessThan:return"date is before";case L.lessThanOrEqualTo:return"date is before or equal";default:throw new Error("Unrecognized date filter type ".concat(r))}}function QD(r){switch(r){case L.isTrue:return"Is True";case L.isFalse:return"Is False";case L.isNull:return"Is Null";default:throw new Error("Unrecognized boolean filter type ".concat(r))}}var Vl=z.module("ViewportDataUtils");function Vg(r,e){return String(r.offsetInSnapshot+e)}function JD(r,e){var{bulkUpdate:t}=r;return function(i){var{columns:a,offset:o,rows:s}=i.detail;Vl.debug("table updated",i.detail);var l=new Map;s.forEach(d=>{var u=e(d,a),c=Vg(d,o);l.set(c,{key:c,item:u})}),Vl.debug("update keys",l),t(l)}}function eM(r,e){return e.reduce((t,n)=>(t[n.name]=r.get(n),t),{})}function*tM(r,e){for(var t=r;t<=e;++t)yield{key:String(t)}}function Ug(r){return r==null||Bg(r)?0:r.size}function Bg(r){return"isClosed"in r?r.isClosed:!1}function nM(r,e,t,n){var i=r+e-1,[a,o]=[0,n-1],s=Kt(r-t,a,o),l=Kt(i+t,a,o);return[s,l]}function Ul(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function $n(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Ul(a,n,i,o,s,"next",l)}function s(l){Ul(a,n,i,o,s,"throw",l)}o(void 0)})}}function pr(r,e,t){return e=Wg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Wg(r){var e=Gg(r,"string");return typeof e=="symbol"?e:String(e)}function Gg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var cn=z.module("TableUtils");function rM(r){return r===P.sortDirection.ascending||r===P.sortDirection.descending||r===P.sortDirection.reverse||r===P.sortDirection.none}class P{static copyTableAndApplyFilters(e){var t=arguments;return $n(function*(){if(e==null)return null;for(var n=yield e.copy(),i=t.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=t[o];return n.applyFilter(bo(...a.map(s=>s(n)))),n})()}static getSortIndex(e,t){for(var n=0;n<e.length;n+=1){var i,a=e[n];if(((i=a.column)===null||i===void 0?void 0:i.name)===t)return n}return null}static getSortForColumn(e,t){var n=P.getSortIndex(e,t);return n!=null?e[n]:null}static getFilterText(e){return e?e.toString():null}static getFilterTypes(e){return P.isBooleanType(e)?[L.isTrue,L.isFalse,L.isNull]:P.isCharType(e)||P.isNumberType(e)||P.isDateType(e)?[L.eq,L.notEq,L.greaterThan,L.greaterThanOrEqualTo,L.lessThan,L.lessThanOrEqualTo]:P.isTextType(e)?[L.eq,L.eqIgnoreCase,L.notEq,L.notEqIgnoreCase,L.contains,L.notContains,L.startsWith,L.endsWith]:[]}static getNextSort(e,t,n){if(n<0||n>=e.length)return null;var i=P.getSortForColumn(t,e[n].name);return i===null?e[n].sort().asc():i.direction===P.sortDirection.ascending?i.desc():null}static makeColumnSort(e,t,n,i){if(t<0||t>=e.length||n===P.sortDirection.none)return null;var a=e[t].sort();switch(n){case P.sortDirection.ascending:a=a.asc();break;case P.sortDirection.descending:a=a.desc();break}return i&&(a=a.abs()),a}static toggleSortForColumn(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(n<0||n>=t.length)return[];var a=P.getNextSort(t,e,n);return P.setSortForColumn(e,t[n].name,a,i)}static sortColumn(e,t,n,i,a,o){if(n<0||n>=t.length)return[];var s=P.makeColumnSort(t,n,i,a);return P.setSortForColumn(e,t[n].name,s,o)}static setSortForColumn(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=P.getSortIndex(e,t),o=[];return i&&(o=o.concat(e.filter(s=>{var{direction:l}=s;return l!==P.sortDirection.reverse})),a!==null&&o.splice(a,1)),n!==null&&o.push(n),o}static getNormalizedType(e){switch(e){case"boolean":case"java.lang.Boolean":case P.dataType.BOOLEAN:return P.dataType.BOOLEAN;case"char":case"java.lang.Character":case P.dataType.CHAR:return P.dataType.CHAR;case"java.lang.String":case P.dataType.STRING:return P.dataType.STRING;case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case P.dataType.DATETIME:return P.dataType.DATETIME;case"double":case"java.lang.Double":case"float":case"java.lang.Float":case"java.math.BigDecimal":case P.dataType.DECIMAL:return P.dataType.DECIMAL;case"int":case"java.lang.Integer":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":case"java.math.BigInteger":case P.dataType.INT:return P.dataType.INT;default:return P.dataType.UNKNOWN}}static isLongType(e){switch(e){case"long":case"java.lang.Long":return!0;default:return!1}}static isDateType(e){switch(e){case"io.deephaven.db.tables.utils.DBDateTime":case"io.deephaven.time.DateTime":case"java.time.Instant":case"java.time.ZonedDateTime":case"com.illumon.iris.db.tables.utils.DBDateTime":return!0;default:return!1}}static isNumberType(e){return P.isIntegerType(e)||P.isDecimalType(e)}static isIntegerType(e){switch(e){case"int":case"java.lang.Integer":case"java.math.BigInteger":case"long":case"java.lang.Long":case"short":case"java.lang.Short":case"byte":case"java.lang.Byte":return!0;default:return!1}}static isDecimalType(e){switch(e){case"double":case"java.lang.Double":case"java.math.BigDecimal":case"float":case"java.lang.Float":return!0;default:return!1}}static isBigDecimalType(e){switch(e){case"java.math.BigDecimal":return!0;default:return!1}}static isBigIntegerType(e){switch(e){case"java.math.BigInteger":return!0;default:return!1}}static isBooleanType(e){switch(e){case"boolean":case"java.lang.Boolean":return!0;default:return!1}}static isCharType(e){switch(e){case"char":case"java.lang.Character":return!0;default:return!1}}static isStringType(e){switch(e){case"java.lang.String":return!0;default:return!1}}static isTextType(e){return this.isStringType(e)||this.isCharType(e)}static getBaseType(e){return e.split("[]")[0]}static isCompatibleType(e,t){return P.getNormalizedType(e)===P.getNormalizedType(t)}static quoteValue(e){return e.length>=2&&(e.charAt(0)==='"'&&e.charAt(e.length-1)==='"'||e.charAt(0)==="'"&&e.charAt(e.length-1)==="'")?e:'"'.concat(e,'"')}static isRangeOperation(e){switch(e){case"<":case"<=":case"=<":case">":case">=":case"=>":return!0;default:return!1}}static makeRangeFilterWithOperation(e,t,n){switch(t){case"=":return e.eq(n);case"<":return e.lessThan(n);case"<=":case"=<":return e.lessThanOrEqualTo(n);case">":return e.greaterThan(n);case">=":case"=>":return e.greaterThanOrEqualTo(n);case"!=":case"!":return e.notEq(n);default:return null}}static makeCancelableTablePromise(e){return we.makeCancelable(e,t=>{t.close()})}static makeCancelableTableEventPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a,o,s=!0,l=new Promise((d,u)=>{o=setTimeout(()=>{a(),s=!1,u(new mv('Event "'.concat(t,'" timed out.')))},n),a=e.addEventListener(t,c=>{if(i!=null&&!i(c)){cn.debug2("Event triggered, but matcher returned false.");return}cn.debug2("Event triggered, resolving."),a(),clearTimeout(o),s=!1,d(c)})});return l.cancel=()=>{if(s){cn.debug2("Pending promise cleanup."),a(),clearTimeout(o),s=!1;return}cn.debug2("Ignoring non-pending promise cancel.")},l}static removeCommas(e){return e.replace(/[\s|,]/g,"")}static makeBooleanValue(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e===""&&t)return null;switch(e==null?void 0:e.toLowerCase()){case"null":return null;case"0":case"f":case"fa":case"fal":case"fals":case"false":case"n":case"no":return!1;case"1":case"t":case"tr":case"tru":case"true":case"y":case"ye":case"yes":return!0;default:throw new Error("Invalid boolean '".concat(e,"'"))}}static makeNumberValue(e){if(e==="null"||e==="")return null;var t=e.toLowerCase().trim();if(t==="∞"||t==="infinity"||t==="inf")return Number.POSITIVE_INFINITY;if(t==="-∞"||t==="-infinity"||t==="-inf")return Number.NEGATIVE_INFINITY;var n=P.removeCommas(t);if(P.NUMBER_REGEX.test(n))return parseFloat(n);throw new Error("Invalid number '".concat(e,"'"))}static getFilterOperatorString(e){switch(e){case L.eq:return"=";case L.notEq:return"!=";case L.greaterThan:return">";case L.greaterThanOrEqualTo:return">=";case L.lessThan:return"<";case L.lessThanOrEqualTo:return"<=";case L.contains:return"~";case L.notContains:return"!~";default:throw new Error("Unexpected filter type ".concat(e))}}static isPartitionedTable(e){return e!=null&&e.getMergedTable!==void 0&&e.getKeyTable!==void 0&&e.getKeys!==void 0}static isTreeTable(e){return e!=null&&e.expand!==void 0&&e.collapse!==void 0}static sortColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return[...e].sort((n,i)=>{var a=n.name.toUpperCase(),o=i.name.toUpperCase();return Lt.sort(a,o,t)})}constructor(e){pr(this,"dh",void 0),this.dh=e,ps(this)}createDistinctSortedColumnTable(e,t,n){var i=arguments,a=this;return $n(function*(){if(e==null)return null;for(var o=e,s=i.length,l=new Array(s>3?s-3:0),d=3;d<s;d++)l[d-3]=i[d];l.length>0&&(o=yield e.copy(),yield o.applyFilter(bo(...l.map(f=>f(o)))));var u=o.findColumn(t),c=yield o.selectDistinct([u]);o!==e&&o.close();var m=c.findColumn(t).sort()[n]();return a.applySort(c,[m])})()}doesColumnValueExist(e,t,n,i){var a=this;return $n(function*(){if(e==null)return null;var o=Fg(a,t,n,i?"eq":"eqIgnoreCase"),s=yield e.copy();yield a.applyFilter(s,bo(o(s)));var l=Ug(s);return s.close(),l>0})()}makeQuickFilter(e,t,n){for(var i=t.split("||"),a=null,o=0;o<i.length;o+=1){for(var s=i[o],l=s.split("&&"),d=null,u=0;u<l.length;u+=1){var c=l[u].trim();if(c.length>0){var m=this.makeQuickFilterFromComponent(e,c,n);if(m)d?d=d.and(m):d=m;else throw new Error("Unable to parse quick filter from text ".concat(t))}}a&&d?a=a.or(d):a=d}return a}makeQuickFilterFromComponent(e,t,n){var{type:i}=e;return P.isNumberType(i)?this.makeQuickNumberFilter(e,t):P.isBooleanType(i)?this.makeQuickBooleanFilter(e,t):n!=null&&P.isDateType(i)?this.makeQuickDateFilter(e,t,n):P.isCharType(i)?this.makeQuickCharFilter(e,t):this.makeQuickTextFilter(e,t)}makeQuickNumberFilter(e,t){var n=e.filter(),{dh:i}=this,a=null,o=/\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\s*-\s*)?(\s*\d*(?:,\d{3})*(?:\.\d*)?\s*)?(null|nan|infinity|inf|\u221E)?(.*)/i,s=o.exec(t),l=null,d=null,u=null,c=null,m=null;if(s!==null&&s.length>3&&([,l,d,u,c,m]=s),m!=null&&m.trim().length>0)return null;if(l==null&&(l="="),c!=null){if(!(l==="="||l==="!"||l==="!="))return null;switch(c=c.trim().toLowerCase(),c){case"null":a=n.isNull();break;case"nan":a=i.FilterCondition.invoke("isNaN",n);break;case"infinity":case"inf":case"∞":d!=null?a=i.FilterCondition.invoke("isInf",n).and(n.lessThan(i.FilterValue.ofNumber(0))):a=i.FilterCondition.invoke("isInf",n).and(n.greaterThan(i.FilterValue.ofNumber(0)));break}return a!==null&&(l==="!"||l==="!=")&&(a=a.not()),a}if(u==null)return null;if(u=P.removeCommas(u),P.isLongType(e.type))try{u=i.FilterValue.ofNumber(i.LongWrapper.ofString("".concat(d!=null?"-":"").concat(u)))}catch(f){return cn.warn("Unable to create long filter",f),null}else{if(u=parseFloat(u),u==null||Number.isNaN(u))return null;u=i.FilterValue.ofNumber(d!=null?0-u:u)}return a=e.filter(),P.makeRangeFilterWithOperation(a,l,u)}static escapeQuickTextFilter(e){var t,n;if(e==null)return null;var i=/^(!~|!=|~|=|!)?(.*)/,a=/^\\*null$/,o=i.exec(e),s=null,l=null;if(o!==null&&o.length>2&&([,s,l]=o),s!=null){var d;return"\\".concat(s).concat((d=l)!==null&&d!==void 0?d:"")}return l!=null&&a.test(l.toLowerCase())||l!=null&&l.startsWith("*")?"\\".concat(l):l!=null&&l.endsWith("*")&&!l.endsWith("\\*")?(l=l.substring(0,l.length-1),"".concat(l,"\\*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((n=l)!==null&&n!==void 0?n:"")}static unescapeQuickTextFilter(e){var t,n,i=/^(\\!~|\\!=|\\~|\\=|\\!)?(.*)/,a=/^\\*null$/,o=i.exec(e),s=null,l=null;return o!==null&&o.length>2&&([,s,l]=o),s!=null&&(s=s.replace("\\","")),l!=null&&a.test(l.toLowerCase())&&(l=l.replace("\\","")),s==null&&l!=null&&l.startsWith("\\*")&&(l=l.substring(1)),s==null&&l!=null&&l.endsWith("\\*")?(l=l.substring(0,l.length-2),"".concat(l,"*")):"".concat((t=s)!==null&&t!==void 0?t:"").concat((n=l)!==null&&n!==void 0?n:"")}makeQuickTextFilter(e,t){var{dh:n}=this,i="".concat(t).trim(),a=/^(!~|!=|~|=|!)?(.*)/,o=a.exec(i),s=null,l=null;if(o!==null&&o.length>2&&([,s,l]=o,l!=null&&(l=l.trim())),l==null||l.length===0&&!(s==="="||s==="!="))return null;s==null&&(s="=");var d=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return d.isNull();case"!=":case"!":return d.isNull().not()}var u=null,c=null;switch(l.startsWith("*")?(u="*",l=l.substring(1)):l.endsWith("*")&&!l.endsWith("\\*")&&(c="*",l=l.substring(0,l.length-1)),l=P.unescapeQuickTextFilter(l),s){case"~":return d.isNull().not().and(d.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))));case"!~":return d.isNull().or(d.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E.*"))).not());case"!=":return u==="*"?d.isNull().or(d.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$"))).not()):c==="*"?d.isNull().or(d.invoke("matches",n.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*"))).not()):d.notEqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()));case"=":return u==="*"?d.isNull().not().and(d.invoke("matches",n.FilterValue.ofString("(?s)(?i).*\\Q".concat(l,"\\E$")))):c==="*"?d.isNull().not().and(d.invoke("matches",n.FilterValue.ofString("(?s)(?i)^\\Q".concat(l,"\\E.*")))):d.eqIgnoreCase(n.FilterValue.ofString(l.toLowerCase()))}return null}makeQuickBooleanFilter(e,t){var n=/^(!=|=|!)?(.*)/,i=n.exec("".concat(t).trim());if(i===null)return null;var[,a,o]=i,s=a==="!"||a==="!=",l=o.trim().toLowerCase(),d=e.filter();try{var u=P.makeBooleanValue(l);return u!=null&&u?d=d.isTrue():u===null?d=d.isNull():d=d.isFalse(),s?d.not():d}catch{return null}}makeQuickDateFilter(e,t,n){var i=t.trim(),a=/\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/,o=a.exec(i);if(o==null||o.length<=2)throw new Error("Unable to parse date filter: ".concat(t));var s=null,l=null;[,s,l]=o;var d=L.eq;switch(s){case"<":d=L.lessThan;break;case"<=":case"=<":d=L.lessThanOrEqualTo;break;case">":d=L.greaterThan;break;case">=":case"=>":d=L.greaterThanOrEqualTo;break;case"!=":case"!":d=L.notEq;break;case"=":case"==":default:d=L.eq;break}return this.makeQuickDateFilterWithOperation(e,l,d,n)}makeQuickDateFilterWithOperation(e,t,n,i){var{dh:a}=this,[o,s]=He.parseDateRange(a,t,i),l=o!=null?a.FilterValue.ofNumber(o):null,d=s!=null?a.FilterValue.ofNumber(s):null,u=e.filter();if(l==null)return n===L.notEq?u.isNull().not():u.isNull();switch(n){case L.eq:{if(d!=null){var c=u.greaterThanOrEqualTo(l),m=u.lessThan(d);return c.and(m)}return u.eq(l)}case L.lessThan:return u.lessThan(l);case L.lessThanOrEqualTo:return d!=null?u.lessThan(d):u.lessThanOrEqualTo(l);case L.greaterThan:return d!=null?u.greaterThanOrEqualTo(d):u.greaterThan(l);case L.greaterThanOrEqualTo:return u.greaterThanOrEqualTo(l);case L.notEq:{if(d!=null){var f=u.lessThan(l),g=u.greaterThanOrEqualTo(d);return f.or(g)}return u.notEq(l)}default:throw new Error("Invalid operator: ".concat(n))}}makeQuickCharFilter(e,t){var{dh:n}=this,i="".concat(t).trim(),a=/^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/,o=a.exec(i),s=null,l=null,d=null;if(o!==null&&o.length>3&&([,s,l,d]=o),d!=null&&d.trim().length>0||l==null||l.length===0)return null;s==null&&(s="=");var u=e.filter();if(l.toLowerCase()==="null")switch(s){case"=":return u.isNull();case"!=":case"!":return u.isNull().not();default:return null}var c=n.FilterValue.ofString(P.isRangeOperation(s)?P.quoteValue(l):l);return P.makeRangeFilterWithOperation(u,s,c)}makeAdvancedFilter(e,t,n){for(var{filterItems:i,filterOperators:a,invertSelection:o,selectedValues:s}=t,l=null,d=0;d<i.length;d+=1){var u=i[d],{selectedType:c,value:m}=u;if(c!=null&&c.length>0&&m!=null&&m.length>0)try{var f=this.makeAdvancedValueFilter(e,c,m,n);if(f!=null){if(d===0)l=f;else if(l!==null&&d-1<a.length){var g=a[d-1];if(g===Ii.and)l=l.and(f);else if(g===Ii.or)l=l.or(f);else{cn.error("Unexpected filter operator",g,f),l=null;break}}}else cn.debug2("Empty filter ignored for",c,m)}catch(p){cn.error("Unable to create filter",p),l=null;break}}var v=this.makeSelectValueFilter(e,s,o);return v!=null&&(l!=null?l=l.and(v):l=v),l}makeAdvancedValueFilter(e,t,n,i){var{dh:a}=this;if(P.isDateType(e.type))return this.makeQuickDateFilterWithOperation(e,n,t,i);if(P.isNumberType(e.type)||P.isCharType(e.type))return this.makeQuickFilter(e,"".concat(P.getFilterOperatorString(t)).concat(n));var o=this.makeFilterValue(e.type,n),s=e.filter();switch(t){case L.eq:return s.eq(o);case L.eqIgnoreCase:return s.eqIgnoreCase(o);case L.notEq:return s.notEq(o);case L.notEqIgnoreCase:return s.notEqIgnoreCase(o);case L.greaterThan:return s.greaterThan(o);case L.greaterThanOrEqualTo:return s.greaterThanOrEqualTo(o);case L.lessThan:return s.lessThan(o);case L.lessThanOrEqualTo:return s.lessThanOrEqualTo(o);case L.isTrue:return s.isTrue();case L.isFalse:return s.isFalse();case L.isNull:return s.isNull();case L.contains:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E.*"))));case L.notContains:return s.isNull().or(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E.*"))).not());case L.startsWith:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i)^\\Q".concat(n,"\\E.*"))));case L.endsWith:return s.isNull().not().and(s.invoke("matches",a.FilterValue.ofString("(?s)(?i).*\\Q".concat(n,"\\E$"))));case L.in:case L.inIgnoreCase:case L.notIn:case L.notInIgnoreCase:case L.invoke:default:throw new Error("Unexpected filter operation: ".concat(t))}}applyNeverFilter(e,t){var n=arguments,i=this;return $n(function*(){var a=n.length>2&&n[2]!==void 0?n[2]:P.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(e==null)return null;var o=e.findColumn(t),s=[i.makeNeverFilter(o)];return yield i.applyFilter(e,s,a),e})()}applyCustomColumns(e,t){var n=arguments,i=this;return $n(function*(){var a=n.length>2&&n[2]!==void 0?n[2]:P.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return P.executeAndWaitForEvent(s=>s==null?void 0:s.applyCustomColumns(t),e,o.Table.EVENT_CUSTOMCOLUMNSCHANGED,a)})()}applyFilter(e,t){var n=arguments,i=this;return $n(function*(){var a=n.length>2&&n[2]!==void 0?n[2]:P.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return P.executeAndWaitForEvent(s=>s==null?void 0:s.applyFilter(t),e,o.Table.EVENT_FILTERCHANGED,a)})()}applySort(e,t){var n=arguments,i=this;return $n(function*(){var a=n.length>2&&n[2]!==void 0?n[2]:P.APPLY_TABLE_CHANGE_TIMEOUT_MS,{dh:o}=i;return P.executeAndWaitForEvent(s=>s==null?void 0:s.applySort(t),e,o.Table.EVENT_SORTCHANGED,a)})()}makeNeverFilter(e){var{dh:t}=this,n=null;P.isTextType(e.type)?n=t.FilterValue.ofString("a"):P.isBooleanType(e.type)?n=t.FilterValue.ofBoolean(!0):P.isDateType(e.type)?n=t.FilterValue.ofNumber(t.DateWrapper.ofJsDate(new Date)):n=t.FilterValue.ofNumber(0);var i=e.filter().eq(n),a=e.filter().notEq(n);return i.and(a)}makeFilterValue(e,t){var{dh:n}=this,i=P.getBaseType(e);return P.isTextType(i)?n.FilterValue.ofString(t):P.isLongType(i)?n.FilterValue.ofNumber(n.LongWrapper.ofString(P.removeCommas(t))):n.FilterValue.ofNumber(P.removeCommas(t))}makeFilterRawValue(e,t){var{dh:n}=this;return P.isCharType(e)?n.FilterValue.ofString(typeof t=="number"?String.fromCharCode(t):t):P.isTextType(e)?n.FilterValue.ofString(t):P.isBooleanType(e)?n.FilterValue.ofBoolean(t):n.FilterValue.ofNumber(t)}makeValue(e,t,n){var{dh:i}=this;if(t==="null")return null;if(P.isTextType(e))return t;if(P.isLongType(e))return i.LongWrapper.ofString(P.removeCommas(t));if(P.isBooleanType(e))return P.makeBooleanValue(t,!0);if(P.isDateType(e)){var[a]=He.parseDateRange(i,t,n);return a}return P.isNumberType(e)?P.makeNumberValue(t):(cn.error("Unexpected column type",e),null)}makeSelectValueFilter(e,t,n){var{dh:i}=this;if(t.length===0)return n?null:this.makeNeverFilter(e);for(var a=[],o=!1,s=0;s<t.length;s+=1){var l=t[s];l==null?o=!0:P.isTextType(e.type)?a.push(i.FilterValue.ofString(typeof l=="number"?String.fromCharCode(l):l)):P.isBooleanType(e.type)?a.push(i.FilterValue.ofBoolean(!!l)):a.push(i.FilterValue.ofNumber(l))}return o?a.length>0?n?e.filter().isNull().not().and(e.filter().notIn(a)):e.filter().isNull().or(e.filter().in(a)):n?e.filter().isNull().not():e.filter().isNull():n?e.filter().notIn(a):e.filter().in(a)}}pr(P,"dataType",{BOOLEAN:"boolean",CHAR:"char",DATETIME:"datetime",DECIMAL:"decimal",INT:"int",STRING:"string",UNKNOWN:"unknown"});pr(P,"sortDirection",{ascending:"ASC",descending:"DESC",reverse:"REVERSE",none:null});pr(P,"APPLY_TABLE_CHANGE_TIMEOUT_MS",3e4);pr(P,"REVERSE_TYPE",Object.freeze({NONE:"none",PRE_SORT:"pre-sort",POST_SORT:"post-sort"}));pr(P,"NUMBER_REGEX",/^-?\d+(\.\d+)?$/);pr(P,"executeAndWaitForEvent",function(){var r=$n(function*(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:P.APPLY_TABLE_CHANGE_TIMEOUT_MS;if(t==null)return null;var a=P.makeCancelableTableEventPromise(t,n,i);return e(t),yield a,t});return function(e,t,n){return r.apply(this,arguments)}}());function Pr(r,e,t){return e=zg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zg(r){var e=Kg(r,"string");return typeof e=="symbol"?e:String(e)}function Kg(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Zt{static makeColumnFormatMap(e){return e==null?new Map:e.reduce((t,n)=>{var i=P.getNormalizedType(n.columnType);if(i===null)return t;t.has(i)||t.set(i,new Map);var a=t.get(i);return a==null||a.set(n.columnName,n.format),t},new Map)}static makeColumnFormattingRule(e,t,n){return{columnType:e,columnName:t,format:n}}constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!1,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:!0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!0;Pr(this,"defaultColumnFormatter",void 0),Pr(this,"typeFormatterMap",void 0),Pr(this,"columnFormatMap",void 0),Pr(this,"truncateNumbersWithPound",void 0),Pr(this,"showEmptyStrings",void 0),Pr(this,"showNullStrings",void 0),this.defaultColumnFormatter=new _g,this.typeFormatterMap=new Map([[P.dataType.BOOLEAN,new gg],[P.dataType.CHAR,new Cg],[P.dataType.DATETIME,new kt(e,n)],[P.dataType.DECIMAL,new ze(e,i)],[P.dataType.INT,new sn(e,a)],[P.dataType.STRING,new Ig]]),this.columnFormatMap=Zt.makeColumnFormatMap(t),this.truncateNumbersWithPound=o,this.showEmptyStrings=s,this.showNullStrings=l}getColumnFormatMapForType(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=P.getNormalizedType(e);if(n!==null)return t&&!this.columnFormatMap.has(n)&&this.columnFormatMap.set(n,new Map),this.columnFormatMap.get(n)}getColumnFormat(e,t){var n,i=this.getColumnFormatMapForType(e);return(n=i==null?void 0:i.get(t))!==null&&n!==void 0?n:null}getColumnTypeFormatter(e){var t=P.getNormalizedType(e),n=this.defaultColumnFormatter;if(t){var i;n=(i=this.typeFormatterMap.get(t))!==null&&i!==void 0?i:n}return n}getFormattedString(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;if(e==null)return"";var a=this.getColumnTypeFormatter(t),o=i||this.getColumnFormat(t,n);return a.format(e,o??void 0)}get timeZone(){var e,t=this.typeFormatterMap.get(P.dataType.DATETIME);return t==null||(e=t.dhTimeZone)===null||e===void 0?void 0:e.id}}function qg(r){if(r&&r.formatter){var{formatter:e}=r;return e}}function Xg(r){return{timeZone:r==null?void 0:r.timeZone,defaultDateTimeFormatString:r==null?void 0:r.defaultDateTimeFormat,showTimeZone:r==null?void 0:r.showTimeZone,showTSeparator:r==null?void 0:r.showTSeparator}}function Zg(r,e,t){var n=r.getColumnFormat(t,e);return n!=null&&(n.type===ot.TYPE_CONTEXT_PRESET||n.type===ot.TYPE_CONTEXT_CUSTOM)}const $o={getColumnFormats:qg,getDateTimeFormatterOptions:Xg,isCustomColumnFormatDefined:Zg};function Bl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Yg(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bl(Object(t),!0).forEach(function(n){Qg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Bl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Qg(r,e,t){return e=Jg(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Jg(r){var e=eb(r,"string");return typeof e=="symbol"?e:String(e)}function eb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var tb=b.lazy(()=>Ai(()=>import("./Chart-a80a0169.js"),["./Chart-a80a0169.js","./vendor-3c001961.js","./helpers-de833af9.js","./vendor-a4479904.css","./index-4a9bfe03.js","./index-7535fde1.css","./Plotly-44e84d2b.js","./plotly-c434cf1f.js","./DownsamplingError-8e6bdb73.js","./usePlugins-a4e842f0.js","./Chart-b27697ef.css"],import.meta.url));function oc(r){return h.jsx(b.Suspense,{fallback:h.jsx(dn,{}),children:h.jsx(tb,Yg({},r))})}function Wl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ji(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Wl(Object(t),!0).forEach(function(n){nt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Wl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function nt(r,e,t){return e=nb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nb(r){var e=rb(r,"string");return typeof e=="symbol"?e:String(e)}function rb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ii=z.module("ChartUtils"),Gl="io.deephaven.time.DateTime",ib=36e5,ab=1e6;function ob(r){return r.asDate!==void 0}function sb(r){return r.asNumber!==void 0}function zl(r){return r.dhTimeZone!==void 0}function lb(r){return r!=null&&r.range!=null&&(r.autorange===!1||r.autorange===void 0)}function db(){var r=document.createElement("canvas"),e=r.getContext("webgl")||r.getContext("experimental-webgl");return e!=null&&e instanceof WebGLRenderingContext}var ub=db();class K{static getPlotlyErrorBars(e,t,n){var i=n.map((o,s)=>o-e[s]),a=t.map((o,s)=>e[s]-o);return{type:"data",symmetric:!1,array:i,arrayminus:a}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,n){if(n==null||n==="")return null;var i=n.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);I(a);var[,o,s,l,,d,u,c,m,f]=a,g=l.replace(",","").length,v=s.indexOf(",")>=0||l.indexOf(",")>=0,p=v?",":"",C=c!=null&&c!==""?"e":"f",S=m!==""?m:C,y=d.length+u.length,w="",E="0".concat(g).concat(p,".").concat(y).concat(w).concat(S),D=K.convertNumberPrefix(o),M=K.convertNumberPrefix(f);return{tickformat:E,tickprefix:D,ticksuffix:M,automargin:!0}}static addTickSpacing(e,t,n){var{gapBetweenMajorTicks:i}=t;if(i!=null&&i>0){var a=e||{},o=i;return n&&(o=i/ab),t.log&&(o=Math.log(o)),a.tickmode="linear",a.dtick=o,a}return e}static getSourceForAxis(e,t){for(var n=0;n<e.series.length;n+=1)for(var i=e.series[n],a=0;a<i.sources.length;a+=1){var o=i.sources[a];if(o.axis===t)return o}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,n,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:K.ORIENTATION.VERTICAL;return{type:e,mode:t,name:n,orientation:a,showlegend:i??void 0}}static getMarkerSymbol(e){switch(e){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error("Unrecognized shape ".concat(e))}}static getAllAxes(e){return e.charts.reduce((t,n)=>[...t,...n.axes],[])}static getAxisTypeMap(e){var t=K.getAllAxes(e);return K.groupArray(t,"type")}static getChartForSeries(e,t){for(var{charts:n}=e,i=0;i<n.length;i+=1)for(var a=n[i],o=0;o<a.series.length;o+=1)if(t===a.series[o])return a;return null}static getLayoutRanges(e){for(var t={},n=Object.keys(e).filter(s=>s.indexOf("axis")>=0),i=0;i<n.length;i+=1){var a=n[i],o=e[a];lb(o)&&(t[a]=[...o.range])}return t}static getAxisLayoutProperty(e,t){var n=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(n)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((n,i)=>{var a,o=i[t],s=(a=n.get(o))!==null&&a!==void 0?a:[];return s.push(i),n.set(o,s),n},new Map)}static normalizeColorway(e){if(e!=null){if(Array.isArray(e))return e;if(typeof e=="string")return e.split(" ");ii.warn("Unexpected colorway format: ".concat(e))}}static titleFromSettings(e){var{series:t,xAxis:n,title:i="".concat((t??[]).join(", ")," by ").concat(n)}=e;return i}constructor(e){nt(this,"dh",void 0),nt(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values()),ps(this)}getAxisFormats(e,t){for(var n=this,i=new Map,a={tickformat:null,ticksuffix:null},o=K.getAllAxes(e),s=K.groupArray(o,"type"),{charts:l}=e,d=0;d<l.length;d+=1)for(var u=l[d],c=0;c<u.series.length;c+=1)for(var m=u.series[c],{sources:f}=m,g=f.filter(S=>S.axis),v=function(){var y=g[p],{axis:w}=y,{type:E}=w,D=s.get(E);I(D);var M=D.indexOf(w),_=n.getAxisPropertyName(E);if(_!=null){var T=K.getAxisLayoutProperty(_,M);if(i.has(T))ii.debug("".concat(T," already added."));else{ii.debug("Adding ".concat(T," to axisFormats."));var N=n.getPlotlyAxisFormat(y,t);if(N===null)i.set(T,a);else{i.set(T,N);var{businessCalendar:x}=w;if(x!=null){var F=[],{businessPeriods:k,businessDays:U,holidays:H,timeZone:W}=x,X=t==null?void 0:t.getColumnTypeFormatter(Gl),le;zl(X)&&(le=X.dhTimeZone);var me=le?(W.standardOffset-le.standardOffset)/60:0;H.length>0&&F.push(...n.createRangeBreakValuesFromHolidays(H,W,le)),k.forEach(ve=>F.push({pattern:"hour",bounds:[K.periodToDecimal(ve.close)+me,K.periodToDecimal(ve.open)+me]})),U.length<n.daysOfWeek.length&&n.createBoundsFromDays(U).forEach(ve=>F.push({pattern:"day of week",bounds:ve})),N.rangebreaks=F}if(i.size===u.axes.length)return{v:i}}}}},p=0;p<g.length;p+=1){var C=v();if(typeof C=="object")return C.v}return i}getPlotlyChartType(e,t){var{dh:n}=this;switch(e){case n.plot.SeriesPlotStyle.SCATTER:case n.plot.SeriesPlotStyle.LINE:return!t&&ub?"scattergl":"scatter";case n.plot.SeriesPlotStyle.BAR:case n.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case n.plot.SeriesPlotStyle.PIE:return"pie";case n.plot.SeriesPlotStyle.TREEMAP:return"treemap";case n.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case n.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,n){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(K.MODE_LINES),(n??!0)&&a.add(K.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(K.MODE_LINES),(n??!1)&&a.add(K.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:n}=this;switch(e){case n.plot.SeriesPlotStyle.PIE:switch(t){case n.plot.SourceType.X:return"labels";case n.plot.SourceType.Y:return"values"}break;case n.plot.SeriesPlotStyle.OHLC:switch(t){case n.plot.SourceType.TIME:return"x"}break;case n.plot.SeriesPlotStyle.TREEMAP:switch(t){case n.plot.SourceType.X:return"ids";case n.plot.SourceType.Y:return"values";case n.plot.SourceType.LABEL:return"labels";case n.plot.SourceType.PARENT:return"parents";case n.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case n.plot.SourceType.X:return"x";case n.plot.SourceType.Y:return"y";case n.plot.SourceType.Z:return"z";case n.plot.SourceType.X_LOW:return"xLow";case n.plot.SourceType.X_HIGH:return"xHigh";case n.plot.SourceType.Y_LOW:return"yLow";case n.plot.SourceType.Y_HIGH:return"yHigh";case n.plot.SourceType.TIME:return"time";case n.plot.SourceType.OPEN:return"open";case n.plot.SourceType.HIGH:return"high";case n.plot.SourceType.LOW:return"low";case n.plot.SourceType.CLOSE:return"close";case n.plot.SourceType.SHAPE:return"shape";case n.plot.SourceType.SIZE:return"size";case n.plot.SourceType.LABEL:return"label";case n.plot.SourceType.COLOR:return"color";case n.plot.SourceType.PARENT:return"parent";case n.plot.SourceType.HOVER_TEXT:return"hovertext";case n.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,n,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(n=t.axis)===null||n===void 0?void 0:n.type)===i.plot.AxisType.Y?K.ORIENTATION.HORIZONTAL:K.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,{name:a,isLinesVisible:o,isShapesVisible:s,plotStyle:l,lineColor:d,shapeColor:u,sources:c,shape:m,shapeSize:f}=e,g=c.some(y=>{var w;return(w=y.axis)===null||w===void 0?void 0:w.businessCalendar}),v=this.getChartType(l,g),p=this.getPlotlyChartMode(l,o??void 0,s??void 0),C=this.getPlotlySeriesOrientation(e),S=K.makeSeriesData(v,p,a,i,C);return this.addSourcesToSeriesData(S,l,c,t),this.addStylingToSeriesData(S,l,d,u,m,f,n),S}addSourcesToSeriesData(e,t,n,i){for(var a=e,o=0;o<n.length;o+=1){var s=n[o],{axis:l,type:d}=s,u=this.getPlotlyProperty(t,d);Eh(a,u,[]);var c=l!=null?this.getAxisPropertyName(l.type):null;if(c!=null){var m=i.get(l.type);if(m){var f=m.indexOf(l),g=f>0?"".concat(f+1):"";a["".concat(c,"axis")]="".concat(c).concat(g)}}}}addStylingToSeriesData(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,{dh:l}=this,d=e;if(d.marker={line:{}},d.line={width:1},t===l.plot.SeriesPlotStyle.AREA?d.fill="tozeroy":t===l.plot.SeriesPlotStyle.STACKED_AREA?d.stackgroup="stack":t===l.plot.SeriesPlotStyle.STEP?d.line.shape="hv":t===l.plot.SeriesPlotStyle.HISTOGRAM?d.width=[]:t===l.plot.SeriesPlotStyle.PIE?d.textinfo="label+percent":t===l.plot.SeriesPlotStyle.TREEMAP&&(d.hoverinfo="text",d.textinfo="label+text",d.tiling={packing:"squarify",pad:0},d.textposition="middle center"),n!=null&&(t===l.plot.SeriesPlotStyle.BAR?d.marker.color=n:d.line.color=n),i!=null&&(d.marker.color=i),a!=null&&a.length>0)try{d.marker.symbol=K.getMarkerSymbol(a)}catch(u){ii.warn("Unable to handle shape",a,":",u)}o!=null&&(d.marker.size=o*K.DEFAULT_MARKER_SIZE),s!=null&&t!==l.plot.SeriesPlotStyle.PIE&&(d.visible=s)}getChartType(e,t){var{dh:n}=this;switch(e){case n.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(e,t)}}getAxisPropertyName(e){var{dh:t}=this;switch(e){case t.plot.AxisType.X:return"x";case t.plot.AxisType.Y:return"y";default:return null}}getAxisSide(e){var{dh:t}=this;switch(e){case t.plot.AxisPosition.BOTTOM:return"bottom";case t.plot.AxisPosition.TOP:return"top";case t.plot.AxisPosition.LEFT:return"left";case t.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(e,t,n){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=e,s=K.getAllAxes(t),l=0;l<t.charts.length;l+=1){var d=t.charts[l],u=n==null?void 0:n(d),c=this.getChartBounds(t,d,i,a);this.updateLayoutAxes(o,d.axes,s,i,a,c,u)}this.removeStaleAxes(o,s)}getChartBounds(e,t,n,i){var a,{dh:o}=this,{cols:s,rows:l}=e,{column:d,colspan:u,row:c,rowspan:m}=t,f=d+u,g=c+m,v=1/s,p=1/l,C=K.AXIS_SIZE_PX/n,S=K.AXIS_SIZE_PX/i,y={bottom:(l-g)*p+(g<l?S/2:0),top:(l-c)*p-(c>0?S/2:0),left:d*v+(d>0?C/2:0),right:f*v-(f<s?C/2:0)},w=K.groupArray(t.axes,"position"),E=(a=w.get(o.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return E.length>0&&(n>0?y.right-=(y.right-y.left)*Math.max(0,Math.min(K.LEGEND_WIDTH_PX/n,K.MAX_LEGEND_SIZE)):y.right-=(y.right-y.left)*K.DEFAULT_AXIS_SIZE),y}getPlotlyDateFormat(e,t,n){var{dh:i}=this,a=n==null?void 0: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",""),o,s=e==null?void 0:e.getColumnTypeFormatter(t);return s!=null&&zl(s)&&s.dhTimeZone!=null&&s.showTimeZone&&(o=i.i18n.DateTimeFormat.format(" z",new Date,s.dhTimeZone)),{tickformat:a,ticksuffix:o,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:n}=this,{axis:i,columnType:a}=e,{formatPattern:o}=i,s=null;return P.isDateType(a)?(s=this.getPlotlyDateFormat(t,a,o),s=K.addTickSpacing(s,i,!0)):P.isNumberType(a)&&(s=K.getPlotlyNumberFormat(t,a,o),s=K.addTickSpacing(s,i,!1)),i.formatType===n.plot.AxisFormatType.CATEGORY&&(s?s.type="category":s={type:"category",tickformat:void 0,ticksuffix:void 0}),s}updateLayoutAxes(e,t,n){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{left:0,top:0,right:1,bottom:1},s=arguments.length>6?arguments[6]:void 0,{dh:l}=this,d=i>0?Math.max(K.MIN_AXIS_SIZE,Math.min(K.AXIS_SIZE_PX/a,K.MAX_AXIS_SIZE)):K.DEFAULT_AXIS_SIZE,u=a>0?Math.max(K.MIN_AXIS_SIZE,Math.min(K.AXIS_SIZE_PX/i,K.MAX_AXIS_SIZE)):K.DEFAULT_AXIS_SIZE,c=e,m=K.groupArray(t,"position"),f=K.groupArray(t,"type"),g=[...f.keys()],v=K.groupArray(n,"type"),p=0;p<g.length;p+=1){var C=g[p],S=this.getAxisPropertyName(C);if(S!=null){var y=f.get(C),w=v.get(C),E=C===l.plot.AxisType.Y,D=E?a:i;I(y),I(w);for(var M=0;M<y.length;M+=1){var _=y[M],T=w.indexOf(_),N=K.getAxisLayoutProperty(S,T);c[N]==null&&(c[N]={});var x=c[N];if(x!=null){this.updateLayoutAxis(x,_,M,m,d,u,o);var{range:F,autorange:k}=x;if(s!=null&&F!==void 0&&(k===void 0||k===!1)){var U=s(_),[H,W]=U(F);ii.debug("Setting downsample range",D,H,W),_.range(D,H,W)}else _.range(D)}}}}}removeStaleAxes(e,t){for(var n=e,i=K.groupArray(t,"type"),a=[...i.keys()],o=0;o<a.length;o+=1){var s=a[o],l=i.get(s);I(l);var d=l.length,u=this.getAxisPropertyName(s);if(u!=null)for(var c=K.getAxisLayoutProperty(u,d);n[c]!=null;)delete n[c],d+=1,c=K.getAxisLayoutProperty(u,d)}}updateLayoutAxis(e,t,n,i,a,o,s){var l,{dh:d}=this,u=t.type===d.plot.AxisType.Y,c=u?o:a,m=e,f=(l=t.label)!==null&&l!==void 0?l:"";if(m.title!==void 0&&typeof m.title!="string"?m.title.text=f:m.title={text:f},t.log&&(m.type="log"),m.side=this.getAxisSide(t.position),n>0){var g,v;m.overlaying=(g=this.getAxisPropertyName(t.type))!==null&&g!==void 0?g:void 0;var p=(v=i.get(t.position))!==null&&v!==void 0?v:[],C=p.indexOf(t);C>0&&(m.anchor="free",t.position===d.plot.AxisPosition.RIGHT?m.position=s.right+(C-p.length+1)*c:t.position===d.plot.AxisPosition.TOP?m.position=s.top+(C-p.length+1)*c:t.position===d.plot.AxisPosition.BOTTOM?m.position=s.bottom+(p.length-C+1)*c:t.position===d.plot.AxisPosition.LEFT&&(m.position=s.left+(p.length-C+1)*c))}else if(t.type===d.plot.AxisType.X){var S=i.get(d.plot.AxisPosition.LEFT)||[],y=i.get(d.plot.AxisPosition.RIGHT)||[],w=Math.max(s.left,s.left+(S.length-1)*o),E=Math.min(s.right-(y.length-1)*o,s.right);m.domain=[w,E]}else if(t.type===d.plot.AxisType.Y){var D=i.get(d.plot.AxisPosition.BOTTOM)||[],M=i.get(d.plot.AxisPosition.TOP)||[],_=Math.max(s.bottom,s.bottom+(D.length-1)*a),T=Math.min(s.top-(M.length-1)*a,s.top);m.domain=[_,T]}}createBoundsFromDays(e){var t=e.map(o=>this.daysOfWeek.indexOf(o)),n=this.daysOfWeek.filter(o=>!e.includes(o)).map(o=>this.daysOfWeek.indexOf(o)),i=new Set;n.forEach(o=>{for(var s=o+1;s<o+this.daysOfWeek.length;s+=1){var l=s%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(o=>{for(var s=o-1;s>o-this.daysOfWeek.length;s-=1){var l=s<0?s+this.daysOfWeek.length:s;if(t.includes(l)){var d=(l+1)%7;a.push([d,o]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,n){var i=[],a=[];return e.forEach(o=>{o.businessPeriods.length>0?a.push(...this.createPartialHoliday(o,t,n)):i.push(this.createFullHoliday(o,t,n))}),[{values:i},...a]}createFullHoliday(e,t,n){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,n)}createPartialHoliday(e,t,n){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(m=>{a.push(m.open),a.push(m.close)}),a.push("24:00");for(var o=[],s=0;s<a.length;s+=2){var l=a[s],d=a[s+1];if(l!==d){var u=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,n)],c=ib*(K.periodToDecimal(d)-K.periodToDecimal(l));o.push({values:u,dvalue:c})}}return o}adjustDateForTimeZone(e,t,n){return n&&n.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,Gl,t),n):e}makeFigureSettings(e,t){var{dh:n}=this,{series:i,xAxis:a,type:o}=e,s=K.titleFromSettings(e),l={formatType:"".concat(n.plot.AxisFormatType.NUMBER),type:"".concat(n.plot.AxisType.X),position:"".concat(n.plot.AxisPosition.BOTTOM)},d={formatType:"".concat(n.plot.AxisFormatType.NUMBER),type:"".concat(n.plot.AxisType.Y),position:"".concat(n.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(n.plot.ChartType.XY),axes:[l,d],series:(i??[]).map(u=>({plotStyle:"".concat(o),name:u,dataSources:[{type:"".concat(n.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(n.plot.SourceType.Y),columnName:u,axis:d,table:t}]}))}],title:s}}unwrapValue(e,t){var{dh:n}=this;if(e!=null){if(ob(e))return n.i18n.DateTimeFormat.format(K.DATE_FORMAT,e,t);if(sb(e))return e.asNumber()}return e}wrapValue(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(P.isDateType(t)&&typeof e=="string"){var a=e,o=K.DATE_FORMAT.substr(0,e.length),s=i.i18n.DateTimeFormat.parse(o,a);if(!n)return s;var l="".concat(o," Z"),d=i.i18n.DateTimeFormat.format("Z",s,n),u=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(d)),c=i.i18n.DateTimeFormat.format("Z",u,n);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(c))}return e}makeLayoutAxis(e,t){var{dh:n}=this,i={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticks:"outside",ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}},legend:{font:{color:t.legend_color}}};return e===n.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===n.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultTemplate(e){var{error_band_line_color:t,ohlc_increasing:n,ohlc_decreasing:i,title_color:a}=e;return{data:{bar:[{marker:{line:{color:"transparent"}}}],scatter:[{error_x:{color:t},error_y:{color:t}}],ohlc:[{increasing:{line:{color:n}},decreasing:{line:{color:i}}}],pie:[{outsidetextfont:{color:a}}],treemap:[{outsidetextfont:{color:a}}]},layout:this.makeDefaultLayout(e)}}makeDefaultLayout(e){var{dh:t}=this,{paper_bgcolor:n,plot_bgcolor:i,title_color:a,coastline_color:o,land_color:s,ocean_color:l,lake_color:d,river_color:u}=e,c={paper_bgcolor:n,plot_bgcolor:i,autosize:!0,colorway:K.normalizeColorway(e==null?void 0:e.colorway),font:{family:"'Fira Sans', sans-serif",color:a},title:{font:{color:a},xanchor:"center",xref:"paper",yanchor:"top",pad:Ji({},K.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:a}},margin:Ji({},K.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(null,e)},geo:{showcoastlines:!0,showframe:!1,showland:!0,showocean:!0,showlakes:!0,showrivers:!0,bgcolor:n,coastlinecolor:o,landcolor:s,oceancolor:l,lakecolor:d,rivercolor:u}};return c.datarevision=0,c}hydrateSettings(e){var{dh:t}=this;return Ji(Ji({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}nt(K,"DEFAULT_AXIS_SIZE",.15);nt(K,"MIN_AXIS_SIZE",.025);nt(K,"MAX_AXIS_SIZE",.2);nt(K,"AXIS_SIZE_PX",75);nt(K,"LEGEND_WIDTH_PX",50);nt(K,"MAX_LEGEND_SIZE",.25);nt(K,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));nt(K,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");nt(K,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));nt(K,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));nt(K,"SUBTITLE_LINE_HEIGHT",25);nt(K,"DEFAULT_MARKER_SIZE",6);nt(K,"MODE_MARKERS","markers");nt(K,"MODE_LINES","lines");const ut=K;function ft(r,e,t){return e=hb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function hb(r){var e=cb(r,"string");return typeof e=="symbol"?e:String(e)}function cb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ge{constructor(e){ft(this,"dh",void 0),ft(this,"listeners",void 0),ft(this,"formatter",void 0),ft(this,"rect",void 0),ft(this,"isDownsamplingDisabled",void 0),ft(this,"title",void 0),this.dh=e,this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(var t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(Ge.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(Ge.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(Ge.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(Ge.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(Ge.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(Ge.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(Ge.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(Ge.EVENT_LOADFINISHED))}fireError(e){this.fireEvent(new CustomEvent(Ge.EVENT_ERROR,{detail:e}))}}ft(Ge,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");ft(Ge,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");ft(Ge,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");ft(Ge,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");ft(Ge,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");ft(Ge,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");ft(Ge,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");ft(Ge,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");ft(Ge,"EVENT_ERROR","ChartModel.EVENT_ERROR");const mb=Ge;function Kl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ql(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Kl(Object(t),!0).forEach(function(n){ke(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Kl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ke(r,e,t){return e=fb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fb(r){var e=vb(r,"string");return typeof e=="symbol"?e:String(e)}function vb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ze=z.module("FigureChartModel");class Xa extends mb{constructor(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(e),n=this,ke(this,"chartUtils",void 0),ke(this,"dh",void 0),ke(this,"figure",void 0),ke(this,"settings",void 0),ke(this,"data",void 0),ke(this,"layout",void 0),ke(this,"seriesDataMap",void 0),ke(this,"pendingSeries",void 0),ke(this,"oneClicks",void 0),ke(this,"filterColumnMap",void 0),ke(this,"lastFilter",void 0),ke(this,"isConnected",void 0),ke(this,"seriesToProcess",void 0),ke(this,"addPendingSeries",It(()=>{for(var a=ut.getAxisTypeMap(this.figure),{pendingSeries:o}=this,s=function(){var u,c=o[l],m=n.figure.charts.find(f=>f.series.includes(c));n.addSeries(c,a,(u=m==null?void 0:m.showLegend)!==null&&u!==void 0?u:null),c.subscribe()},l=0;l<o.length;l+=1)s();this.pendingSeries=[]},Xa.ADD_SERIES_DEBOUNCE)),ke(this,"getTimeZone",qe((a,o)=>{if(o!=null){var s=o.getColumnTypeFormatter(a);if(s!=null)return s.dhTimeZone}})),ke(this,"getValueTranslator",qe((a,o)=>{var s=this.getTimeZone(a,o);return l=>this.chartUtils.unwrapValue(l,s)})),ke(this,"getValueParser",qe((a,o)=>{var s=this.getTimeZone(a,o);return l=>this.chartUtils.wrapValue(l,a,s)})),ke(this,"getRangeParser",qe((a,o)=>s=>{var[l,d]=s,u=this.getValueParser(a,o);return l=u(l),d=u(d),[l,d]})),ke(this,"getAxisRangeParser",qe((a,o)=>s=>{var l=ut.getSourceForAxis(a,s);return l!=null?this.getRangeParser(l.columnType,o):d=>d})),this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.dh=e,this.chartUtils=new ut(e),this.figure=t,this.settings=i,this.data=[],this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"}},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){if(this.figure.title!=null&&this.figure.title.length>0)return this.figure.title;if(this.figure.charts.length===1){var e;return(e=this.figure.charts[0].title)!==null&&e!==void 0?e:""}return""}initAllSeries(){var e=this;this.oneClicks=[],this.filterColumnMap.clear();var{charts:t}=this.figure,n=ut.getAxisTypeMap(this.figure),i=[];this.seriesToProcess=new Set;for(var a=function(){for(var m=t[o],f=0;f<m.series.length;f+=1){var g=m.series[f];i.push(g.name),e.addSeries(g,n,m.showLegend)}var{axes:v,title:p}=m;if(p!=null&&p.length>0&&(t.length>1||e.figure.title!=null)){var C=v.find(N=>N.type===e.dh.plot.AxisType.X),S=v.find(N=>N.type===e.dh.plot.AxisType.Y);if(C==null||S==null)Ze.warn("Chart title provided, but unknown how to map to the correct axes for this chart type",m);else{var y,w,E,D,M=((y=(w=n.get(C.type))===null||w===void 0?void 0:w.findIndex(N=>N===C))!==null&&y!==void 0?y:0)+1,_=((E=(D=n.get(S.type))===null||D===void 0?void 0:D.findIndex(N=>N===S))!==null&&E!==void 0?E:0)+1,T={align:"center",x:.5,y:1,yshift:17,text:p,showarrow:!1,xref:"x".concat(M," domain"),yref:"y".concat(_," domain")};e.layout.annotations==null?e.layout.annotations=[T]:e.layout.annotations.push(T)}}},o=0;o<t.length;o+=1)a();for(var s=[...this.seriesDataMap.keys()],l=s.filter(c=>i.indexOf(c)<0),d=0;d<l.length;d+=1){var u=l[d];this.seriesDataMap.delete(u)}}addSeries(e,t,n){var{dh:i}=this,a=this.chartUtils.makeSeriesDataFromSeries(e,t,ut.getSeriesVisibility(e.name,this.settings),n);if(this.seriesDataMap.set(e.name,a),this.seriesToProcess.add(e.name),this.data=[...this.seriesDataMap.values()],e.plotStyle===i.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===i.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=ut.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?n??void 0:!1,e.oneClick!=null){for(var{oneClick:o}=e,{columns:s}=o,l=0;l<s.length;l+=1)this.filterColumnMap.set(s[l].name,s[l]);this.oneClicks.push(o)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){Ze.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?this.dh.plot.DownsampleOptions.DISABLE:this.dh.plot.DownsampleOptions.DEFAULT),this.figure.errors.length>0&&(Ze.error("Errors in figure",this.figure.errors),this.fireError(this.figure.errors))}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){var{dh:e}=this;this.figure.addEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){var{dh:e}=this;this.figure.removeEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){Ze.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){Ze.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){Ze.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){Ze.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:n}=t;Ze.debug2("handleFigureUpdated",n);for(var i=0;i<n.length;i+=1){var a=n[i];Ze.debug2("handleFigureUpdated updating series",a.name);for(var{sources:o}=a,s=0;s<o.length;s+=1){var l=o[s],{columnType:d,type:u}=l,c=this.getValueTranslator(d,this.formatter),m=t.getArray(a,u,c);this.setDataArrayForSeries(a,u,m)}this.seriesToProcess.delete(a.name),this.cleanSeries(a)}this.seriesToProcess.size===0&&this.fireLoadFinished();var{data:f}=this;this.fireUpdate(f)}handleRequestFailed(e){Ze.error("Request failed",e),this.fireError(["".concat(e.detail)])}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){Ze.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){Ze.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;Ze.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,n;super.setTitle(e);var i=(t=(n=(e??"").match(/<br>/g))===null||n===void 0?void 0:n.length)!==null&&t!==void 0?t:0,a=ut.DEFAULT_MARGIN.t+i*ut.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=a:this.layout.margin={t:a},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=ql({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=ql({},this.layout.title.pad),this.layout.title.pad.t=ut.DEFAULT_TITLE_PADDING.t+i*ut.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,n,i;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.l)!==null&&e!==void 0?e:0)-((n=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&n!==void 0?n:0),0)}getPlotHeight(){var e,t,n,i;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.t)!==null&&e!==void 0?e:0)-((n=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&n!==void 0?n:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,n=>this.getAxisRangeParser(n,this.formatter),e,t)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,n)=>{Ze.debug("Assigning ".concat(n),this.layout[n],t);var i=this.layout[n];i!=null?Object.assign(i,t):Ze.debug("Ignoring null layout.".concat(n))})}}setDataArrayForSeries(e,t,n){var{name:i,plotStyle:a}=e,o=this.seriesDataMap.get(i),s=this.chartUtils.getPlotlyProperty(a,t);o&&Eh(o,s,n)}cleanSeries(e){var{dh:t}=this,{name:n,plotStyle:i}=e,a=this.seriesDataMap.get(n);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:o,xHigh:s}=a;if(o&&s&&o.length===s.length){for(var l=[],d=0;d<o.length;d+=1)l.push(s[d]-o[d]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:u,xLow:c,xHigh:m,y:f,yLow:g,yHigh:v}=a;c&&m&&c!==u&&(a.error_x=ut.getPlotlyErrorBars(u,c,m)),g&&v&&g!==f&&(a.error_y=ut.getPlotlyErrorBars(f,g,v))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:p,labels:C}=a;p!==void 0&&C===void 0&&(a.labels=p)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){var t=this;if(this.oneClicks.length===0){Ze.warn("Trying to set a filter, but no one click!");return}Ze.debug("setFilter",e);for(var n=function(){var o=t.oneClicks[i],{columns:s}=o,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(d=>{var u=e.get(d);t.lastFilter.get(d)!==u&&s.find(c=>c.name===d)!=null&&o.setValueForColumn(d,u)})},i=0;i<this.oneClicks.length;i+=1)n();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}}ke(Xa,"ADD_SERIES_DEBOUNCE",50);const Xl=Xa;function Zl(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Co(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Zl(a,n,i,o,s,"next",l)}function s(l){Zl(a,n,i,o,s,"throw",l)}o(void 0)})}}class Ds{static makeModelFromSettings(e,t,n){return Co(function*(){var i=yield Ds.makeFigureFromSettings(e,t,n);return new Xl(e,i,t)})()}static makeFigureFromSettings(e,t,n){return Co(function*(){var i=yield n.copy();return i.applyCustomColumns(n.customColumns),i.applyFilter(n.filter),i.applySort(n.sort),e.plot.Figure.create(new ut(e).makeFigureSettings(t,i))})()}static makeModel(e,t,n){return Co(function*(){return new Xl(e,n,t)})()}}const Ti=Ds,pb="var(--dh-color-chart-colorway)",gb="var(--dh-color-chart-grid)",bb="var(--dh-color-chart-axis-line)",Cb="var(--dh-color-chart-axis-line-zero)",Yl={"paper-bgcolor":"var(--dh-color-chart-bg)","plot-bgcolor":"var(--dh-color-chart-plot-bg)","title-color":"var(--dh-color-chart-title)","legend-color":"var(--dh-color-chart-legend-fg)",colorway:pb,gridcolor:gb,linecolor:bb,zerolinecolor:Cb,"error-band-line-color":"var(--dh-color-chart-error-band-line)","ohlc-increasing":"var(--dh-color-chart-ohlc-increase)","ohlc-decreasing":"var(--dh-color-chart-ohlc-decrease)","coastline-color":"var(--dh-color-chart-geo-coastline)","land-color":"var(--dh-color-chart-geo-land)","ocean-color":"var(--dh-color-chart-geo-ocean)","lake-color":"var(--dh-color-chart-geo-lake)","river-color":"var(--dh-color-chart-geo-river)"};var Ql=z.module("ChartTheme");function yb(){var r,e=Oh(Yl);return e.colorway=Vf((r=e.colorway)!==null&&r!==void 0?r:"").map(t=>{var[n,i]=t;return Uf.normalizeCssColor(e.colorway.substring(n,i+1))}).join(" "),Ql.debug2("Chart theme:",Yl),Ql.debug2("Chart theme derived:",e),Object.freeze({paper_bgcolor:e["paper-bgcolor"],plot_bgcolor:e["plot-bgcolor"],title_color:e["title-color"],legend_color:e["legend-color"],colorway:e.colorway,gridcolor:e.gridcolor,linecolor:e.linecolor,zerolinecolor:e.zerolinecolor,error_band_line_color:e["error-band-line-color"],ohlc_increasing:e["ohlc-increasing"],ohlc_decreasing:e["ohlc-decreasing"],coastline_color:e["coastline-color"],land_color:e["land-color"],ocean_color:e["ocean-color"],lake_color:e["lake-color"],river_color:e["river-color"]})}function Jl(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Sb(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Jl(Object(t),!0).forEach(function(n){wb(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Jl(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function wb(r,e,t){return e=Eb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Eb(r){var e=Pb(r,"string");return typeof e=="symbol"?e:String(e)}function Pb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Tb=b.lazy(()=>Ai(()=>import("./Plot-d4ea1393.js"),["./Plot-d4ea1393.js","./Plotly-44e84d2b.js","./plotly-c434cf1f.js","./helpers-de833af9.js","./vendor-3c001961.js","./vendor-a4479904.css"],import.meta.url));function _b(r){return h.jsx(b.Suspense,{fallback:h.jsx(dn,{}),children:h.jsx(Tb,Sb({},r))})}var sc=b.createContext(null);function iM(r){var{children:e}=r,{activeThemes:t}=Jh(),n=b.useMemo(yb,[t]);return h.jsx(sc.Provider,{value:n,children:e})}function ed(r){return r.setFigure!==void 0}function Ob(){return Ua(sc,"No ChartThemeContext value found.")}var lc=Object.freeze({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"},content:[]});function dc(r){return r.componentName!==void 0}function Db(r){return r.component!==void 0}var uc=Object.freeze({type:"default",isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""});const Mb=Object.freeze(Object.defineProperty({__proto__:null,defaultConfig:lc,isGLComponentConfig:dc,isReactComponentConfig:Db,itemDefaultConfig:uc},Symbol.toStringTag,{value:"Module"}));function ya(r,e,t){return e=Ib(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ib(r){var e=Nb(r,"string");return typeof e=="symbol"?e:String(e)}function Nb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ni{constructor(){ya(this,"_mSubscriptions",void 0),ya(this,"off",this.unbind),ya(this,"trigger",this.emit),this._mSubscriptions={},this._mSubscriptions[Ni.ALL_EVENT]=[]}on(e,t,n){if(typeof t!="function")throw new Error("Tried to listen to event "+e+" with non-function callback "+t);this._mSubscriptions[e]||(this._mSubscriptions[e]=[]),this._mSubscriptions[e].push({fn:t,ctx:n})}emit(e){for(var t=this._mSubscriptions[e],n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];if(t)for(var o=0;o<t.length;o++){var s=t[o].ctx||{};try{t[o].fn.apply(s,i)}catch(c){console.error("Error while emitting event:",c)}}i.unshift(e);for(var l=this._mSubscriptions[Ni.ALL_EVENT],d=0;d<l.length;d++){var u=l[d].ctx||{};try{l[d].fn.apply(u,i)}catch(c){console.error("Error while emitting event to allEventSubs:",c)}}}unbind(e,t,n){if(!this._mSubscriptions[e])throw new Error("No subscriptions to unsubscribe for event "+e);for(var i=!1,a=0;a<this._mSubscriptions[e].length;a++)(!t||this._mSubscriptions[e][a].fn===t)&&(!n||n===this._mSubscriptions[e][a].ctx)&&(this._mSubscriptions[e].splice(a,1),i=!0);if(i===!1)throw new Error("Nothing to unbind for "+e)}}ya(Ni,"ALL_EVENT","__all");const Yt=Ni;function Vt(r,e,t){return e=xb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xb(r){var e=Fb(r,"string");return typeof e=="symbol"?e:String(e)}function Fb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ho extends Yt{constructor(e,t,n){super(),Vt(this,"width",void 0),Vt(this,"height",void 0),Vt(this,"title",void 0),Vt(this,"parent",void 0),Vt(this,"layoutManager",void 0),Vt(this,"tab",void 0),Vt(this,"_config",void 0),Vt(this,"isHidden",!1),Vt(this,"beforeCloseHandler",void 0),Vt(this,"_element",Q(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join(""))),Vt(this,"_contentElement",void 0),this.title=dc(e)?e.componentName:"",this.parent=t,this.layoutManager=n,this._config=e,this._contentElement=this._element.find(".lm_content"),this.beforeCloseHandler=null}getElement(){return this._contentElement}hide(){this.emit("hide"),this.isHidden=!0,this._element.hide()}show(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")}setSize(e,t){for(var n,i,a,o=this.parent,s=null;o&&!o.isColumn&&!o.isRow;){var l;if(s=o,o=o.parent,(l=o)!==null&&l!==void 0&&l.isRoot)return!1}if(!o||!s)return!1;for(var d=o.isColumn?"height":"width",u=d==="height"?t:e,c=((n=this[d])!==null&&n!==void 0?n:0)*(1/(((i=s.config[d])!==null&&i!==void 0?i:0)/100)),m=u/c*100,f=(((a=s.config[d])!==null&&a!==void 0?a:0)-m)/(o.contentItems.length-1),g=0;g<o.contentItems.length;g++)if(o.contentItems[g]===s)o.contentItems[g].config[d]=m;else{var v;o.contentItems[g].config[d]=((v=o.contentItems[g].config[d])!==null&&v!==void 0?v:0)+f}return o.callDownwards("setSize"),!0}close(e){var t,n;this._config.isClosable&&(!((t=(n=this.beforeCloseHandler)===null||n===void 0?void 0:n.call(this,e))!==null&&t!==void 0)||t)&&(this.emit("close"),this.parent.close())}beforeClose(e){this.beforeCloseHandler=e}getState(){return this._config.componentState}extendState(e){this.setState(Q.extend(!0,this.getState(),e))}setState(e){this._config.componentState=e,this.parent.emitBubblingEvent("stateChanged")}setTitle(e){this.parent.setTitle(e)}_$setSize(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==this.width||t!==this.height){this.width=e,this.height=t;var n=this._contentElement[0],i=n.offsetWidth-n.clientWidth,a=n.offsetHeight-n.clientHeight;this._contentElement.width(this.width-i).height(this.height-a),this.emit("resize")}}}const Rb=Object.freeze(Object.defineProperty({__proto__:null,Container:Ho,ItemContainer:Ho},Symbol.toStringTag,{value:"Module"}));function hc(r){var e=location.hash.match(new RegExp(r+"=([^&]*)"));return e?e[1]:null}function cc(r){if(window.location.hash)return hc(r);if(!window.location.search)return null;var e=window.location.search.substr(1).split("&"),t={},n,i;for(i=0;i<e.length;i++)n=e[i].split("="),t[n[0]]=n[1];return t[r]||null}function Ms(r){return window.requestAnimationFrame(r)}function Lb(r,e){var t=e.indexOf(r);if(t===-1)throw new Error("Can't remove item from array. Item is not in the array");e.splice(t,1)}function Is(){return(Math.random()*1e15).toString(36).replace(".","")}function Ab(r,e){var t=r.replace(/javascript/gi,"javascript").replace(/expression/gi,"expression").replace(/onload/gi,"onload").replace(/script/gi,"script").replace(/onerror/gi,"onerror");return e===!0?t:t.replace(/>/g,">").replace(/</g,"<")}function Ns(r){return Q.trim(r.replace(/(<([^>]+)>)/gi,""))}function Ct(r,e,t){return e=kb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kb(r){var e=jb(r,"string");return typeof e=="symbol"?e:String(e)}function jb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class $b extends Yt{constructor(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super(),Ct(this,"_eElement",void 0),Ct(this,"_oDocument",void 0),Ct(this,"_eBody",void 0),Ct(this,"_destroyAfterMouseUp",void 0),Ct(this,"_nDelay",400),Ct(this,"_timeout",void 0),Ct(this,"timeout",void 0),Ct(this,"_nDistance",10),Ct(this,"_nX",0),Ct(this,"_nY",0),Ct(this,"_nOriginalX",0),Ct(this,"_nOriginalY",0),Ct(this,"_bDragging",!1),this._eElement=e,this._oDocument=Q(document),this._eBody=Q(document.body),this._destroyAfterMouseUp=n,this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseDown=this.onMouseDown.bind(this),this._startDrag=this._startDrag.bind(this),(t=this._eElement)===null||t===void 0||t.on("mousedown",this.onMouseDown)}destroy(){var e,t;(e=this._eElement)===null||e===void 0||e.unbind("mousedown",this.onMouseDown),(t=this._oDocument)===null||t===void 0||t.unbind("mouseup",this.onMouseUp),this._eElement=void 0,this._oDocument=void 0,this._eBody=void 0,clearTimeout(this._timeout),this._timeout=void 0}onMouseDown(e){if(e.preventDefault(),e.button===0){var t,n,i,a,o=this._getCoordinates(e);this._nOriginalX=(t=o.x)!==null&&t!==void 0?t:0,this._nOriginalY=(n=o.y)!==null&&n!==void 0?n:0,(i=this._oDocument)===null||i===void 0||i.on("mousemove",this.onMouseMove),(a=this._oDocument)===null||a===void 0||a.on("mouseup",this.onMouseUp),this._timeout=window.setTimeout(this._startDrag,this._nDelay)}}onMouseMove(e){if(this._timeout!=null){var t,n;e.preventDefault();var i=this._getCoordinates(e);this._nX=((t=i.x)!==null&&t!==void 0?t:0)-this._nOriginalX,this._nY=((n=i.y)!==null&&n!==void 0?n:0)-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,e)}}onMouseUp(e){if(this._timeout!=null){var t,n,i,a,o;if(clearTimeout(this._timeout),(t=this._oDocument)===null||t===void 0||t.unbind("mousemove",this.onMouseMove),(n=this._oDocument)===null||n===void 0||n.unbind("mouseup",this.onMouseUp),(i=this._oDocument)===null||i===void 0||(a=i.find("iframe"))===null||a===void 0||a.css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",e,this._nOriginalX+this._nX)),(o=this._eBody)===null||o===void 0||o.removeClass("lm_dragging"),!(this._eElement instanceof Window)){var s;(s=this._eElement)===null||s===void 0||s.removeClass("lm_dragging")}this._destroyAfterMouseUp&&this.destroy()}}_startDrag(){var e,t,n,i;window.clearTimeout(this._timeout),this._bDragging=!0,(e=this._eBody)===null||e===void 0||e.addClass("lm_dragging"),(t=this._eElement)===null||t===void 0||t.addClass("lm_dragging"),(n=this._oDocument)===null||n===void 0||(i=n.find("iframe"))===null||i===void 0||i.css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)}_getCoordinates(e){var t,n;return{x:(t=e.pageX)!==null&&t!==void 0?t:0,y:(n=e.pageY)!==null&&n!==void 0?n:0}}}const $i=$b;function Tr(r,e,t){return e=Hb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hb(r){var e=Vb(r,"string");return typeof e=="symbol"?e:String(e)}function Vb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class mc{constructor(e,t){Tr(this,"_container",void 0),Tr(this,"_reactComponent",null),Tr(this,"_portalComponent",null),Tr(this,"_originalComponentWillUpdate",null),Tr(this,"_initialState",void 0),Tr(this,"_reactClass",void 0),this._reactComponent=null,this._portalComponent=null,this._originalComponentWillUpdate=null,this._container=e,this._initialState=t,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)}_key(){var e=this._container._config.id;if(!e)throw new Error("Cannot mount panel without id");return Array.isArray(e)?e.join(","):e}_render(){var e=this._key();this._portalComponent=Ha.createPortal(this._getReactComponent(),this._container.getElement()[0],e),this._container.layoutManager.addReactChild(e,this._portalComponent)}_gotReactComponent(e){if(e){this._reactComponent=e,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this);var t=this._container.getState();t&&this._reactComponent.setState(t)}}_destroy(){this._container.layoutManager.removeReactChild(this._key(),this._portalComponent),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)}_onUpdate(e,t){var n;this._container.setState(t),(n=this._originalComponentWillUpdate)===null||n===void 0||n.call(this._reactComponent,e,t)}_getReactClass(){var e=this._container._config.component;if(!e)throw new Error("No react component name. type: react-component needs a field `component`");var t=this._container.layoutManager.getComponent(e)||this._container.layoutManager.getFallbackComponent();if(!t)throw new Error('React component "'+e+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return t}_getReactComponent(){var e={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},t=Q.extend(e,this._container._config.props);return Z.createElement(this._reactClass,t)}}var Oa=["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"],Ub=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"];function xs(r){if(Oa.length>36)throw new Error("Too many keys in config minifier map");var e={};return Fs(r,e,"_min"),e}function Vo(r){if(Oa.length>36)throw new Error("Too many keys in config minifier map");var e={};return Fs(r,e,"_max"),e}function Fs(r,e,t){var n=t==="_min"?Bb:Wb;for(var i in r)if(r.hasOwnProperty(i)){var a=Array.isArray(r)?r[Number.parseInt(i,10)]:r[i];if(typeof a=="object"&&a!=null){var o=a instanceof Array?[]:{};if(Array.isArray(e))e[Number.parseInt(i,10)]=o;else{var s=n(i,Oa);e[s]=o}Fs(a,o,t)}else{var l=n(a,Ub);if(Array.isArray(e))e[Number.parseInt(i,10)]=l;else{var d=n(i,Oa);e[d]=l}}}}function Bb(r,e){if(typeof r=="string"&&r.length===1)return"___"+r;var t=e.indexOf(r);return t===-1?r:t.toString(36)}function Wb(r,e){return typeof r=="string"&&r.length===1?e[parseInt(r,36)]:typeof r=="string"&&r.substr(0,3)==="___"?r[3]:r}function yo(r,e,t){return e=Gb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Gb(r){var e=zb(r,"string");return typeof e=="symbol"?e:String(e)}function zb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Uo{constructor(e,t){yo(this,"name",void 0),yo(this,"origin",void 0),yo(this,"isPropagationStopped",void 0),this.name=e,this.origin=t,this.isPropagationStopped=!1}stopPropagation(){this.isPropagationStopped=!0}}function ea(r,e,t){return e=Kb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Kb(r){var e=qb(r,"string");return typeof e=="symbol"?e:String(e)}function qb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}let Xb=class extends Yt{constructor(e){super(),ea(this,"_layoutManager",void 0),ea(this,"_dontPropagateToParent",void 0),ea(this,"_childEventSource",void 0),ea(this,"_boundOnEventFromChild",void 0),this._layoutManager=e,this._dontPropagateToParent=null,this._childEventSource=null,this.on(Yt.ALL_EVENT,this._onEventFromThis.bind(this)),this._boundOnEventFromChild=this._onEventFromChild.bind(this),Q(window).on("gl_child_event",this._boundOnEventFromChild)}_onEventFromThis(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null}_$onEventFromParent(e){this._dontPropagateToParent=e[0],this.emit.apply(this,e)}_onEventFromChild(e){this._childEventSource=e.originalEvent.__gl,this.emit.apply(this,e.originalEvent.__glArgs)}_propagateToParent(e){var t,n="gl_child_event",i=(t=window.opener)===null||t===void 0?void 0:t.document.createEvent("HTMLEvents");i.initEvent(n,!0,!0),i.eventName=n,i.__glArgs=e,i.__gl=this._layoutManager,window.opener.dispatchEvent(i)}_propagateToChildren(e){for(var t=0;t<this._layoutManager.openPopouts.length;t++){var n=this._layoutManager.openPopouts[t].getGlInstance();n&&n!==this._childEventSource&&n.eventHub._$onEventFromParent(e)}}destroy(){Q(window).off("gl_child_event",this._boundOnEventFromChild)}};const fc=Xb,Zb=Object.freeze(Object.defineProperty({__proto__:null,BubblingEvent:Uo,DragListener:$i,EventEmitter:Yt,EventHub:fc,ReactComponentHandler:mc,animFrame:Ms,filterXss:Ab,getHashValue:hc,getQueryStringParam:cc,getUniqueId:Is,minifyConfig:xs,removeFromArray:Lb,stripTags:Ns,unminifyConfig:Vo},Symbol.toStringTag,{value:"Module"}));function Nn(r,e,t){return e=Yb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Yb(r){var e=Qb(r,"string");return typeof e=="symbol"?e:String(e)}function Qb(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class vc extends Yt{constructor(e,t,n,i,a){super(),Nn(this,"isInitialised",!1),Nn(this,"_config",void 0),Nn(this,"_dimensions",void 0),Nn(this,"_parentId",void 0),Nn(this,"_indexInParent",void 0),Nn(this,"_layoutManager",void 0),Nn(this,"_popoutWindow",null),Nn(this,"_id",null),this._config=e,this._dimensions=t,this._parentId=n,this._indexInParent=i,this._layoutManager=a,this._createWindow()}toConfig(){var e,t,n,i,a,o,s,l,d,u,c;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:(e=this.getGlInstance())===null||e===void 0?void 0:e.width,height:(t=this.getGlInstance())===null||t===void 0?void 0:t.height,left:(n=(i=(a=this._popoutWindow)===null||a===void 0?void 0:a.screenX)!==null&&i!==void 0?i:(o=this._popoutWindow)===null||o===void 0?void 0:o.screenLeft)!==null&&n!==void 0?n:0,top:(s=(l=(d=this._popoutWindow)===null||d===void 0?void 0:d.screenY)!==null&&l!==void 0?l:(u=this._popoutWindow)===null||u===void 0?void 0:u.screenTop)!==null&&s!==void 0?s:0},content:(c=this.getGlInstance())===null||c===void 0?void 0:c.toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}}getGlInstance(){var e;return(e=this._popoutWindow)===null||e===void 0?void 0:e.__glInstance}getWindow(){return this._popoutWindow}close(){if(this.getGlInstance()){var e;(e=this.getGlInstance())===null||e===void 0||e._$closeWindow()}else try{var t;(t=this.getWindow())===null||t===void 0||t.close()}catch{}}popIn(){var e;this._indexInParent;var t=null,n=null;if(this._parentId){var i;if(t=Q.extend(!0,{},(i=this.getGlInstance())===null||i===void 0?void 0:i.toConfig()).content[0],n=this._layoutManager.root.getItemsById(this._parentId)[0],!n){var a;((a=this._layoutManager.root.contentItems.length)!==null&&a!==void 0?a:0)>0?n=this._layoutManager.root.contentItems[0]:n=this._layoutManager.root}}t&&((e=n)===null||e===void 0||e.addChild(t,this._indexInParent),this.close())}_createWindow(){var e=this._createUrl(),t=Math.floor(Math.random()*1e6).toString(36),n=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(e,t,n),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var i=new Error("Popout blocked");throw i.type="popoutBlocked",i}else return;Q(this._popoutWindow).on("load",this._positionWindow.bind(this)).on("unload beforeunload",this._onClose.bind(this));var a=window.setInterval(()=>{var o;(o=this._popoutWindow)!==null&&o!==void 0&&o.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),window.clearInterval(a))},10)}_serializeWindowOptions(e){var t=[],n;for(n in e)t.push(n+"="+e[n]);return t.join(",")}_createUrl(){var e={content:this._config},t="gl-window-config-"+Is();e=xs(e);try{localStorage.setItem(t,JSON.stringify(e))}catch(i){throw new Error("Error while writing to localStorage "+i.toString())}var n=document.location.href.split("?");return n.length===1?n[0]+"?gl-window="+t:document.location.href+"&gl-window="+t}_positionWindow(){var e,t;(e=this._popoutWindow)===null||e===void 0||e.moveTo(this._dimensions.left,this._dimensions.top),(t=this._popoutWindow)===null||t===void 0||t.focus()}_onInitialised(){var e;this.isInitialised=!0,(e=this.getGlInstance())===null||e===void 0||e.on("popIn",this.popIn,this),this.emit("initialised")}_onClose(){setTimeout(this.emit.bind(this,"closed"),50)}}function Qe(r,e,t){return e=Jb(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Jb(r){var e=eC(r,"string");return typeof e=="symbol"?e:String(e)}function eC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class gr extends Yt{constructor(e,t,n,i,a,o){var s,l,d,u,c,m,f,g;if(super(),Qe(this,"_dragListener",void 0),Qe(this,"_layoutManager",void 0),Qe(this,"_contentItem",void 0),Qe(this,"_originalParent",void 0),Qe(this,"_area",null),Qe(this,"_lastValidArea",null),Qe(this,"_minX",void 0),Qe(this,"_maxX",void 0),Qe(this,"_minY",void 0),Qe(this,"_maxY",void 0),Qe(this,"_width",void 0),Qe(this,"_height",void 0),Qe(this,"_sided",void 0),Qe(this,"element",void 0),Qe(this,"childElementContainer",void 0),Qe(this,"_proxyTab",void 0),this._dragListener=n,this._layoutManager=i,this._contentItem=a,this._originalParent=o,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element){var v,p;this._layoutManager.tabDropPlaceholder.width((v=this._contentItem.tab.element.outerWidth(!0))!==null&&v!==void 0?v:0),this._layoutManager.tabDropPlaceholder.height((p=this._contentItem.tab.element.outerHeight(!0))!==null&&p!==void 0?p:0)}if(this.element=Q(gr._template),o&&o._side&&(this._sided=o._sided,this.element.addClass("lm_"+o._side),["right","bottom"].indexOf(o._side.toString())>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:e,top:t}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",Ns((s=this._contentItem.config.title)!==null&&s!==void 0?s:"")),this.element.find(".lm_title").html((l=this._contentItem.config.title)!==null&&l!==void 0?l:""),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(a.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),Q(document.body).append(this.element),this._setDimensions(),!this._contentItem.tab&&this._proxyTab.length){var C,S;this._layoutManager.tabDropPlaceholder.width((C=this._proxyTab.outerWidth(!0))!==null&&C!==void 0?C:0),this._layoutManager.tabDropPlaceholder.height((S=this._proxyTab.outerHeight(!0))!==null&&S!==void 0?S:0)}var y=this._layoutManager.container.offset();this._minX=(d=y==null?void 0:y.left)!==null&&d!==void 0?d:0,this._minY=(u=y==null?void 0:y.top)!==null&&u!==void 0?u:0,this._maxX=((c=this._layoutManager.container.width())!==null&&c!==void 0?c:0)+this._minX,this._maxY=((m=this._layoutManager.container.height())!==null&&m!==void 0?m:0)+this._minY,this._width=(f=this.element.width())!==null&&f!==void 0?f:0,this._height=(g=this.element.height())!==null&&g!==void 0?g:0,this._setDropPosition(e,t),this._layoutManager.emit("itemPickedUp",this._contentItem)}_onDrag(e,t,n){var i,a,o=(i=n.pageX)!==null&&i!==void 0?i:0,s=(a=n.pageY)!==null&&a!==void 0?a:0,l=o>this._minX&&o<this._maxX&&s>this._minY&&s<this._maxY;!l&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(o,s)}_setDropPosition(e,t){this.element.css({left:e,top:t}),this._area=this._layoutManager._$getArea(e,t),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(e,t,this._area))}_onDrop(){var e;(e=this._layoutManager.dropTargetIndicator)===null||e===void 0||e.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(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(null)}_setDimensions(){var e=this._layoutManager.config.dimensions,t=e.dragProxyWidth,n=e.dragProxyHeight;this.element.width(t),this.element.height(n),t-=this._sided?e.headerHeight:0,n-=this._sided?0:e.headerHeight,this.childElementContainer.width(t),this.childElementContainer.height(n),this._contentItem.element.width(t),this._contentItem.element.height(n),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}Qe(gr,"_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>');function ta(r,e,t){return e=tC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tC(r){var e=nC(r,"string");return typeof e=="symbol"?e:String(e)}function nC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class pc{constructor(e,t,n){ta(this,"_element",void 0),ta(this,"_itemConfig",void 0),ta(this,"_layoutManager",void 0),ta(this,"_dragListener",void 0),this._element=e,this._itemConfig=t,this._layoutManager=n,this._dragListener=this._createDragListener()}_createDragListener(){return this._dragListener=new $i(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this),this._dragListener}_onDragStart(e,t){var n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(Q.extend(!0,{},n));new gr(e,t,this._dragListener,this._layoutManager,i,null)}}function na(r,e,t){return e=rC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function rC(r){var e=iC(r,"string");return typeof e=="symbol"?e:String(e)}function iC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class gc{constructor(e,t,n){na(this,"_element",Q(window)),na(this,"_itemConfig",void 0),na(this,"_layoutManager",void 0),na(this,"_dragListener",void 0),this._itemConfig=e,this._layoutManager=t,this._createDragListener(n)}_createDragListener(e){this._dragListener&&this._dragListener.destroy(),this._element&&(this._dragListener=new $i(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener.onMouseDown(e),this._dragListener._startDrag())}_destroy(){this._dragListener=void 0,this._element=void 0,this._itemConfig=void 0,this._layoutManager=void 0}_onDragStart(e,t){if(!(!this._dragListener||!this._layoutManager)){var n=this._itemConfig;typeof n=="function"&&(n=n());var i=this._layoutManager._$normalizeContentItem(Q.extend(!0,{},n));new gr(e,t,this._dragListener,this._layoutManager,i,null)}}}function bc(r,e,t){return e=aC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function aC(r){var e=oC(r,"string");return typeof e=="symbol"?e:String(e)}function oC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Hi{constructor(){bc(this,"element",Q(Hi._template)),Q(document.body).append(this.element)}destroy(){this.element.remove()}highlightArea(e){this.element.css({left:e.x1,top:e.y1,width:Math.floor(e.x2-e.x1),height:Math.floor(e.y2-e.y1)}).show()}hide(){this.element.hide()}}bc(Hi,"_template",'<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>');function So(r,e,t){return e=sC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function sC(r){var e=lC(r,"string");return typeof e=="symbol"?e:String(e)}function lC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class fi{constructor(e,t,n,i){So(this,"element",void 0),So(this,"_header",void 0),So(this,"_action",void 0),this._header=e,this.element=Q('<li class="'+n+'" title="'+t+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=i,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)}_$destroy(){this.element.off(),this.element.remove()}}function dC(r,e,t){return e=uC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function uC(r){var e=hC(r,"string");return typeof e=="symbol"?e:String(e)}function hC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class cC extends Error{constructor(e,t){super(),dC(this,"node",void 0),this.name="Configuration Error",this.message=e,this.node=t}}const dr=cC,mC=Object.freeze(Object.defineProperty({__proto__:null,ConfigurationError:dr},Symbol.toStringTag,{value:"Module"}));function Xe(r,e,t){return e=fC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fC(r){var e=vC(r,"string");return typeof e=="symbol"?e:String(e)}function vC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function xi(r){return r.isStack}function Et(r){return r.isComponent}function Cc(r){return r.isRoot}class tt extends Yt{constructor(e,t,n,i){super(),Xe(this,"config",void 0),Xe(this,"type",void 0),Xe(this,"contentItems",void 0),Xe(this,"parent",void 0),Xe(this,"layoutManager",void 0),Xe(this,"element",void 0),Xe(this,"childElementContainer",void 0),Xe(this,"componentName",void 0),Xe(this,"isInitialised",!1),Xe(this,"isMaximised",!1),Xe(this,"isRoot",!1),Xe(this,"isRow",!1),Xe(this,"isColumn",!1),Xe(this,"isStack",!1),Xe(this,"isComponent",!1),Xe(this,"tab",void 0),Xe(this,"_pendingEventPropagations",void 0),Xe(this,"_throttledEvents",void 0),this.element=i,this.config=this._extendItemNode(t),this.type=t.type,this.contentItems=[],this.parent=n,this.layoutManager=e,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(Yt.ALL_EVENT,this._propagateEvent,this),t.content&&this._createContentItems(t)}callDownwards(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;n!==!0&&i!==!0&&this[e].apply(this,t);for(var a=0;a<this.contentItems.length;a++)this.contentItems[a].callDownwards(e,t,n);n===!0&&i!==!0&&this[e].apply(this,t)}removeChild(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=this.contentItems.indexOf(e);if(i===-1)throw new Error("Can't remove child item. Unknown content item");if(n!==!0&&this.contentItems[i]._$destroy(),this.contentItems.splice(i,1),(t=this.config.content)===null||t===void 0||t.splice(i,1),this.contentItems.length>0)this.callDownwards("setSize");else if(this.type!=="root"&&this.config.isClosable){var a;(a=this.parent)===null||a===void 0||a.removeChild(this)}}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.splice(t,0,e),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(t,0,e.config),e.parent=this,e.parent.isInitialised===!0&&e.isInitialised===!1&&e._$init()}replaceChild(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t=this.layoutManager._$normalizeContentItem(t);var i=this.contentItems.indexOf(e),a=e.element[0].parentNode;if(i===-1)throw new Error("Can't replace child. oldChild is not child of this");a==null||a.replaceChild(t.element[0],e.element[0]),n===!0&&(e.parent=null,e._$destroy()),this.contentItems[i]=t,t.parent=this,xi(this)&&(this.header.tabs[i].contentItem=t),t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init(),this.callDownwards("setSize")}remove(){var e;(e=this.parent)===null||e===void 0||e.removeChild(this)}popout(){var e=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),e}toggleMaximise(e){e&&e.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")}select(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))}deselect(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))}setTitle(e){this.config.title=e,this.emit("titleChanged",e),this.emitBubblingEvent("stateChanged")}hasId(e){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===e;if(this.config.id instanceof Array)return this.config.id.indexOf(e)!==-1}else return!1}addId(e){this.hasId(e)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,e]:this.config.id instanceof Array&&this.config.id.push(e):this.config.id=e)}removeId(e){if(!this.hasId(e))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var t=this.config.id.indexOf(e);this.config.id.splice(t,1)}}getItemsByFilter(e){var t=[],n=function i(a){for(var o=0;o<a.contentItems.length;o++)e(a.contentItems[o])===!0&&t.push(a.contentItems[o]),i(a.contentItems[o])};return n(this),t}getItemsById(e){return this.getItemsByFilter(function(t){return t.config.id instanceof Array?t.config.id.indexOf(e)!==-1:t.config.id===e})}getItemsByType(e){return this._$getItemsByProperty("type",e)}getComponentsByName(e){for(var t=this._$getItemsByProperty("componentName",e),n=[],i=0;i<t.length;i++)n.push(t[i].instance);return n}_$getItemsByProperty(e,t){return this.getItemsByFilter(function(n){return n[e]===t})}_$setParent(e){this.parent=e}_$highlightDropZone(e,t,n){var i;(i=this.layoutManager.dropTargetIndicator)===null||i===void 0||i.highlightArea(n)}_$onDrop(e,t){this.addChild(e)}_$hide(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()}_$show(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()}_callOnActiveComponents(e){for(var t=this.getItemsByType("stack"),n=null,i=0;i<t.length;i++)n=t[i].getActiveContentItem(),n&&Et(n)&&n.container[e]()}_$destroy(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")}_$getArea(e){var t,n,i;e=e||this.element;var a=(t=e.offset())!==null&&t!==void 0?t:{left:0,top:0},o=(n=e.width())!==null&&n!==void 0?n:0,s=(i=e.height())!==null&&i!==void 0?i:0;return{x1:a.left,y1:a.top,x2:a.left+o,y2:a.top+s,surface:o*s,contentItem:this,side:""}}_$init(){this.setSize();for(var e=0;e<this.contentItems.length;e++){var t;(t=this.childElementContainer)===null||t===void 0||t.append(this.contentItems[e].element)}this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")}emitBubblingEvent(e){var t=new Uo(e,this);this.emit(e,t)}_createContentItems(e){var t;if(!(e.content instanceof Array))throw new dr("content must be an Array",e);for(var n=0;n<e.content.length;n++)t=this.layoutManager.createContentItem(e.content[n],this),this.contentItems.push(t)}_extendItemNode(e){for(var[t,n]of Object.entries(uc)){var i=t;e[i]===void 0&&(e[i]=n)}return e}_propagateEvent(e,t){t instanceof Uo&&t.isPropagationStopped===!1&&this.isInitialised===!0&&(this.isRoot===!1&&this.parent?this.parent.emit.apply(this.parent,[e,t]):this._scheduleEventPropagationToLayoutManager(e,t))}_scheduleEventPropagationToLayoutManager(e,t){this._throttledEvents.indexOf(e)===-1?this.layoutManager.emit(e,t.origin):this._pendingEventPropagations[e]!==!0&&(this._pendingEventPropagations[e]=!0,Ms(this._propagateEventToLayoutManager.bind(this,e,t)))}_propagateEventToLayoutManager(e,t){this._pendingEventPropagations[e]=!1,this.layoutManager.emit(e,t)}}function ai(r,e,t){return e=pC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pC(r){var e=gC(r,"string");return typeof e=="symbol"?e:String(e)}function gC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yc extends tt{constructor(e,t,n){super(e,t,n,Q()),ai(this,"config",void 0),ai(this,"componentName",void 0),ai(this,"container",void 0),ai(this,"parent",void 0),ai(this,"instance",void 0),this.config=t,this.parent=n;var i=e.getComponent(this.config.componentName)||e.getFallbackComponent(),a=Q.extend(!0,{},this.config.componentState||{});if(i==null)throw new dr('Unknown component "'+this.config.componentName+'"');a.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new Ho(this.config,this,e),this.instance=new i(this.container,a),this.element=this.container._element}close(){this.parent.removeChild(this)}setSize(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())}_$init(){tt.prototype._$init.call(this),this.container.emit("open")}_$hide(){this.container.hide(),tt.prototype._$hide.call(this)}_$show(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),tt.prototype._$show.call(this)}_$destroy(){this.container.emit("destroy",this),tt.prototype._$destroy.call(this)}_$getArea(){return null}}function Nt(r,e,t){return e=bC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bC(r){var e=CC(r,"string");return typeof e=="symbol"?e:String(e)}function CC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Da extends tt{constructor(e,t,n,i){super(t,n,i,Q('<div class="lm_item lm_'+(e?"column":"row")+'"></div>')),Nt(this,"isRow",void 0),Nt(this,"isColumn",void 0),Nt(this,"childElementContainer",void 0),Nt(this,"parent",void 0),Nt(this,"_splitter",[]),Nt(this,"_splitterSize",void 0),Nt(this,"_splitterGrabSize",void 0),Nt(this,"_isColumn",void 0),Nt(this,"_dimension",void 0),Nt(this,"_splitterPosition",null),Nt(this,"_splitterMinPosition",null),Nt(this,"_splitterMaxPosition",null),this.parent=i,this.isRow=!e,this.isColumn=e,this.childElementContainer=this.element,this._splitterSize=t.config.dimensions.borderWidth,this._splitterGrabSize=t.config.dimensions.borderGrabWidth,this._isColumn=e,this._dimension=e?"height":"width",this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null}addChild(e,t,n){var i,a,o,s;if(e=this.layoutManager._$normalizeContentItem(e,this),t===void 0&&(t=this.contentItems.length),this.contentItems.length>0?(s=this._createSplitter(Math.max(0,t-1)).element,t>0?(this.contentItems[t-1].element.after(s),s.after(e.element)):(this.contentItems[0].element.before(s),s.before(e.element))):this.childElementContainer.append(e.element),tt.prototype.addChild.call(this,e,t),i=1/this.contentItems.length*100,n===!0){this.emitBubblingEvent("stateChanged");return}for(o=0;o<this.contentItems.length;o++)if(this.contentItems[o]===e)e.config[this._dimension]=i;else{var l;a=((l=this.contentItems[o].config[this._dimension])!==null&&l!==void 0?l:0)*(100-i)/100,this.contentItems[o].config[this._dimension]=a}this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}removeChild(e,t){var n,i=(n=e.config[this._dimension])!==null&&n!==void 0?n:0,a=this.contentItems.indexOf(e),o=Math.max(a-1,0),s,l;if(a===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[o]&&(this._splitter[o]._$destroy(),this._splitter.splice(o,1)),s=0;s<this.contentItems.length;s++)if(this.contentItems[s]!==e){var d;this.contentItems[s].config[this._dimension]=((d=this.contentItems[s].config[this._dimension])!==null&&d!==void 0?d:0)+i/(this.contentItems.length-1)}tt.prototype.removeChild.call(this,e,t),this.contentItems.length===1&&this.config.isClosable===!0?(l=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,l,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))}replaceChild(e,t){var n=e.config[this._dimension];super.replaceChild(e,t),t.config[this._dimension]=n,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")}_$init(){if(this.isInitialised!==!0){var e;for(tt.prototype._$init.call(this),e=0;e<this.contentItems.length-1;e++)this.contentItems[e].element.after(this._createSplitter(e).element)}}_setAbsoluteSizes(){var e,t=this._calculateAbsoluteSizes();for(e=0;e<this.contentItems.length;e++)t.additionalPixel-e>0&&t.itemSizes[e]++,this._isColumn?(this.contentItems[e].element.width(t.totalWidth),this.contentItems[e].element.height(t.itemSizes[e])):(this.contentItems[e].element.width(t.itemSizes[e]),this.contentItems[e].element.height(t.totalHeight))}_calculateAbsoluteSizes(){var e,t,n=(this.contentItems.length-1)*this._splitterSize,i=(e=this.element.width())!==null&&e!==void 0?e:0,a=(t=this.element.height())!==null&&t!==void 0?t:0,o=0,s=[];this._isColumn?a-=n:i-=n;for(var l=0;l<this.contentItems.length;l++){var d,u,c=this._isColumn?Math.floor(a*(((d=this.contentItems[l].config.height)!==null&&d!==void 0?d:0)/100)):Math.floor(i*(((u=this.contentItems[l].config.width)!==null&&u!==void 0?u:0)/100));o+=c,s.push(c)}var m=Math.floor((this._isColumn?a:i)-o);return{itemSizes:s,additionalPixel:m,totalWidth:i,totalHeight:a}}_calculateRelativeSizes(){for(var e=0,t=[],n=this._isColumn?"height":"width",i=0;i<this.contentItems.length;i++){var a=this.contentItems[i].config[n];a!=null?e+=a:t.push(this.contentItems[i])}if(Math.round(e)===100){this._respectMinItemWidth();return}if(Math.round(e)<100&&t.length>0){for(var o=0;o<t.length;o++)t[o].config[n]=(100-e)/t.length;this._respectMinItemWidth();return}if(Math.round(e)>100)for(var s=0;s<t.length;s++)t[s].config[n]=50,e+=50;for(var l=0;l<this.contentItems.length;l++){var d;this.contentItems[l].config[n]=((d=this.contentItems[l].config[n])!==null&&d!==void 0?d:0)/e*100}this._respectMinItemWidth()}_respectMinItemWidth(){var e,t=this.layoutManager.config.dimensions&&(e=this.layoutManager.config.dimensions.minItemWidth)!==null&&e!==void 0?e:0,n=[],i=0,a=0,o=0,s=[],l;if(!(this._isColumn||!t||this.contentItems.length<=1)){for(var d=this._calculateAbsoluteSizes(),u=0;u<this.contentItems.length;u++){this.contentItems[u];var c=d.itemSizes[u];c<t?(a+=t-c,l={width:t}):(i+=c-t,l={width:c},n.push(l)),s.push(l)}if(!(a===0||a>i)){var m=a/i;o=a;for(var f=0;f<n.length;f++){l=n[f];var g=Math.round((l.width-t)*m);o-=g,l.width-=g}o!==0&&(s[s.length-1].width-=o);for(var v=0;v<this.contentItems.length;v++)this.contentItems[v].config.width=s[v].width/d.totalWidth*100}}}_createSplitter(e){var t;return t=new Sc(this._isColumn,this._splitterSize,this._splitterGrabSize),t.on("drag",this._onSplitterDrag.bind(this,t),this),t.on("dragStop",this._onSplitterDragStop.bind(this,t),this),t.on("dragStart",this._onSplitterDragStart.bind(this,t),this),this._splitter.splice(e,0,t),t}_getItemsForSplitter(e){var t=this._splitter.indexOf(e);if(t<0)throw new Error("Splitter not found in RowOrColumn");return{before:this.contentItems[t],after:this.contentItems[t+1]}}_getMinimumDimensions(e){for(var t=0,n=0,i=0;i<e.length;++i){var a,o;t=Math.max((a=e[i].minWidth)!==null&&a!==void 0?a:0,t),n=Math.max((o=e[i].minHeight)!==null&&o!==void 0?o:0,n)}return{horizontal:t,vertical:n}}_onSplitterDragStart(e){var t,n,i,a,o=this._getItemsForSplitter(e),s=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],l=this._getMinimumDimensions((t=o.before.config.content)!==null&&t!==void 0?t:[]),d=this._isColumn?l.vertical:l.horizontal,u=this._getMinimumDimensions((n=o.after.config.content)!==null&&n!==void 0?n:[]),c=this._isColumn?u.vertical:u.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(((i=o.before.element[this._dimension]())!==null&&i!==void 0?i:0)-(d||s)),this._splitterMaxPosition=((a=o.after.element[this._dimension]())!==null&&a!==void 0?a:0)-(c||s)}_onSplitterDrag(e,t,n){var i=this._isColumn?n:t;this._splitterMaxPosition==null||this._splitterMinPosition==null||i>this._splitterMinPosition&&i<this._splitterMaxPosition&&(this._splitterPosition=i,e.element.css(this._isColumn?"top":"left",i))}_onSplitterDragStop(e){var t,n,i,a,o,s=this._getItemsForSplitter(e),l=(t=s.before.element[this._dimension]())!==null&&t!==void 0?t:0,d=(n=s.after.element[this._dimension]())!==null&&n!==void 0?n:0,u=(((i=this._splitterPosition)!==null&&i!==void 0?i:0)+l)/(l+d),c=((a=s.before.config[this._dimension])!==null&&a!==void 0?a:0)+((o=s.after.config[this._dimension])!==null&&o!==void 0?o:0);s.before.config[this._dimension]=u*c,s.after.config[this._dimension]=(1-u)*c,e.element.css({top:0,left:0}),Ms(this.callDownwards.bind(this,"setSize",void 0,void 0,void 0))}}function td(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function nd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?td(Object(t),!0).forEach(function(n){Bo(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):td(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Bo(r,e,t){return e=yC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yC(r){var e=SC(r,"string");return typeof e=="symbol"?e:String(e)}function SC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Wo extends tt{constructor(e,t,n){super(e,nd(nd({},t),{},{type:"root"}),null,Q('<div class="lm_goldenlayout lm_item lm_root"></div>')),Bo(this,"childElementContainer",void 0),Bo(this,"_containerElement",void 0),this.isRoot=!0,this.type="root",this.childElementContainer=this.element,this._containerElement=n,this._containerElement.append(this.element)}addChild(e,t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");e=this.layoutManager._$normalizeContentItem(e,this),this.childElementContainer.append(e.element),super.addChild(e,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")}setSize(e,t){var n,i;e=typeof e>"u"?(n=this._containerElement.width())!==null&&n!==void 0?n:0:e,t=typeof t>"u"?(i=this._containerElement.height())!==null&&i!==void 0?i:0:t,this.element.width(e),this.element.height(t),this.contentItems[0]&&(this.contentItems[0].element.width(e),this.contentItems[0].element.height(t))}_$getArea(){var e=super._$getArea();if(e==null)throw new Error("Unable to get root area");return e}_$highlightDropZone(e,t,n){this.layoutManager.tabDropPlaceholder.remove(),super._$highlightDropZone(e,t,n)}_$onDrop(e,t){var n;if(Et(e)&&(n=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this),n._$init(),n.addChild(e),e=n),!this.contentItems.length)this.addChild(e);else{var{side:i}=t,a=i==="left"||i==="right"?"row":"column",o=i==="left"||i==="right"?"width":"height",s=i==="left"||i==="top",l=this.contentItems[0];if(!(l instanceof Da)||l.type!=a){var d=this.layoutManager.createContentItem({type:a},this);this.replaceChild(l,d),d.addChild(e,s?0:void 0,!0),d.addChild(l,s?void 0:0,!0),l.config[o]=50,e.config[o]=50,d.callDownwards("setSize")}else{var u,c=l.contentItems[s?0:l.contentItems.length-1];l.addChild(e,s?0:void 0,!0),c.config[o]=((u=c.config[o])!==null&&u!==void 0?u:0)*.5,e.config[o]=c.config[o],l.callDownwards("setSize")}}}}function rd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function _r(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?rd(Object(t),!0).forEach(function(n){bt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):rd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function bt(r,e,t){return e=wC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function wC(r){var e=EC(r,"string");return typeof e=="symbol"?e:String(e)}function EC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Go extends tt{constructor(e,t,n){var i,a,o,s,l,d,u,c,m;super(e,t,n,Q('<div class="lm_item lm_stack"></div>')),bt(this,"_activeContentItem",null),bt(this,"_header",void 0),bt(this,"childElementContainer",Q('<div class="lm_items"></div>')),bt(this,"header",void 0),bt(this,"parent",void 0),bt(this,"isStack",!0),bt(this,"_dropZones",{}),bt(this,"_dropSegment",null),bt(this,"_contentAreaDimensions",null),bt(this,"_dropIndex",void 0),bt(this,"_side",void 0),bt(this,"_sided",!1),bt(this,"config",void 0),this.parent=n,this.config=t;var f=e.config;this._side=!1,this._header={show:((i=f.settings)===null||i===void 0?void 0:i.hasHeaders)&&t.hasHeaders!==!1,popout:(a=f.settings)!==null&&a!==void 0&&a.showPopoutIcon?(o=f.labels)===null||o===void 0?void 0:o.popout:void 0,maximise:(s=f.settings)!==null&&s!==void 0&&s.showMaximiseIcon?(l=f.labels)===null||l===void 0?void 0:l.maximise:void 0,close:(d=f.settings)!==null&&d!==void 0&&d.showCloseIcon?(u=f.labels)===null||u===void 0?void 0:u.close:void 0,minimise:(c=(m=f.labels)===null||m===void 0?void 0:m.minimise)!==null&&c!==void 0?c:void 0},f.header&&(this._header=_r(_r({},this._header),f.header)),t.header&&(this._header=_r(_r({},this._header),t.header)),t.content&&t.content[0]&&t.content[0].header&&(this._header=_r(_r({},this._header),t.content[0].header)),this.header=new Tn(e,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()}setSize(){var e,t,n,i,a,o=this._header.show&&(e=(t=this.layoutManager.config.dimensions)===null||t===void 0?void 0:t.headerHeight)!==null&&e!==void 0?e:0,s=((n=this.element.width())!==null&&n!==void 0?n:0)-(this._sided?o:0),l=((i=this.element.height())!==null&&i!==void 0?i:0)-(this._sided?0:o);for(this.childElementContainer.width(s),this.childElementContainer.height(l),a=0;a<this.contentItems.length;a++)this.contentItems[a].element.width(s).height(l);this.emit("resize"),this.emitBubblingEvent("stateChanged")}_$init(){if(this.isInitialised!==!0){this.header._attachWheelListener(),super._$init();for(var e=0;e<this.contentItems.length;e++)this.header.createTab(this.contentItems[e]),this.contentItems[e]._$hide();if(this.contentItems.length>0){var t=this.contentItems[this.config.activeItemIndex||0];if(!t)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(t)}}}setActiveContentItem(e){if(this.contentItems.indexOf(e)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=e,this.header.setActiveContentItem(e),e._$show(),this.emit("activeContentItemChanged",e),this.layoutManager.emit("activeContentItemChanged",e),this.emitBubblingEvent("stateChanged")}getActiveContentItem(){return this.header.activeContentItem}addChild(e,t){e=this.layoutManager._$normalizeContentItem(e,this),super.addChild(e,t),this.childElementContainer.append(e.element),this.header.createTab(e,t),this.setActiveContentItem(e),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}removeChild(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=this.contentItems.indexOf(e);super.removeChild(e,t),this.header.removeTab(e),this.header.activeContentItem===e&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(n-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")}_$validateClosability(){for(var e=this.header._isClosable(),t=0,n=this.contentItems.length;t<n;t++){var i;if(!e)break;e=(i=this.contentItems[t].config.isClosable)!==null&&i!==void 0?i:!1}this.header._$setClosable(e)}_$destroy(){tt.prototype._$destroy.call(this),this.header._$destroy()}_$onDrop(e){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(e,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(e);return}var t=this._dropSegment==="top"||this._dropSegment==="bottom",n=this._dropSegment==="left"||this._dropSegment==="right",i=this._dropSegment==="top"||this._dropSegment==="left",a=t&&this.parent.isColumn||n&&this.parent.isRow,o=t?"column":"row",s=t?"height":"width";if(Et(e)){var l=this.layoutManager.createContentItem({type:"stack",header:e.config.header||{}},this);l._$init(),l.addChild(e),e=l}if(a){var d,u=this.parent.contentItems.indexOf(this);this.parent.addChild(e,i?u:u+1,!0),this.config[s]=((d=this.config[s])!==null&&d!==void 0?d:0)*.5,e.config[s]=this.config[s],this.parent.callDownwards("setSize")}else{var c=this.layoutManager.createContentItem({type:o},this);this.parent.replaceChild(this,c),c.addChild(e,i?0:void 0,!0),c.addChild(this,i?void 0:0,!0),this.config[s]=50,e.config[s]=50,c.callDownwards("setSize")}}_$highlightDropZone(e,t){if(this._contentAreaDimensions)for(var[n,i]of Object.entries(this._contentAreaDimensions)){var a=i.hoverArea;if(a.x1<e&&a.x2>e&&a.y1<t&&a.y2>t){n==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(e)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(n));return}}}_$getArea(){if(this.element.is(":visible")===!1)return null;var e=super._$getArea(this.header.element),t=super._$getArea(this.childElementContainer);if(e==null||t==null)return null;var n=t.x2-t.x1,i=t.y2-t.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2},highlightArea:{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?e:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}},super._$getArea(this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.25,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x1+n*.5,y2:t.y2}},this._contentAreaDimensions.top={hoverArea:{x1:t.x1+n*.25,y1:t.y1,x2:t.x1+n*.75,y2:t.y1+i*.5},highlightArea:{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y1+i*.5}},this._contentAreaDimensions.right={hoverArea:{x1:t.x1+n*.75,y1:t.y1,x2:t.x2,y2:t.y2},highlightArea:{x1:t.x1+n*.5,y1:t.y1,x2:t.x2,y2:t.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:t.x1+n*.25,y1:t.y1+i*.5,x2:t.x1+n*.75,y2:t.y2},highlightArea:{x1:t.x1,y1:t.y1+i*.5,x2:t.x2,y2:t.y2}},super._$getArea(this.element))}_highlightHeaderDropZone(e){var t,n,i,a,o,s,l,d,u,c,m,f,g,v,p,C,S=this.header.tabs.length;if(S===0){var y,w,E,D,M,_,T,N,x=this.header.element.offset();(y=this.layoutManager.dropTargetIndicator)===null||y===void 0||y.highlightArea({x1:(w=x==null?void 0:x.left)!==null&&w!==void 0?w:0,x2:((E=x==null?void 0:x.left)!==null&&E!==void 0?E:0)+100,y1:(D=(M=this.header.element.offset())===null||M===void 0?void 0:M.top)!==null&&D!==void 0?D:0,y2:((_=(T=this.header.element.offset())===null||T===void 0?void 0:T.top)!==null&&_!==void 0?_:0)+((N=this.header.element.innerHeight())!==null&&N!==void 0?N:0)});return}var F=this.header.tabsContainer,k=(t=F.get(0))===null||t===void 0?void 0:t.getBoundingClientRect(),U=(n=this.layoutManager.tabDropPlaceholder.get(0))===null||n===void 0?void 0:n.getBoundingClientRect();if(!(!k||!U)){e<k.left?e=k.left+1:e>k.right&&(e=k.right-1);var H,W;if(!(U.left<e&&e<U.right)){for(var X=0;X<S;X++){var le;if(H=this.header.tabs[X].element,W=(le=H.get(0))===null||le===void 0?void 0:le.getBoundingClientRect(),W&&W.left<e&&e<W.right){this._dropIndex=X;break}}if(H&&W&&e<W.left+W.width*.5)H.before(this.layoutManager.tabDropPlaceholder);else if(H){var me;this._dropIndex=Math.min(((me=this._dropIndex)!==null&&me!==void 0?me:0)+1,S),H.after(this.layoutManager.tabDropPlaceholder)}}var ve=(i=(a=this.layoutManager.tabDropPlaceholder.offset())===null||a===void 0?void 0:a.left)!==null&&i!==void 0?i:0;ve=Math.max(ve,(o=(s=this.header.tabsContainer.offset())===null||s===void 0?void 0:s.left)!==null&&o!==void 0?o:0);var j=ve+((l=this.layoutManager.tabDropPlaceholder.width())!==null&&l!==void 0?l:0);j=Math.min(j,((d=(u=this.header.tabsContainer.offset())===null||u===void 0?void 0:u.left)!==null&&d!==void 0?d:0)+((c=this.header.tabsContainer.innerWidth())!==null&&c!==void 0?c:0)),(m=this.layoutManager.dropTargetIndicator)===null||m===void 0||m.highlightArea({x1:ve,x2:j,y1:(f=(g=this.header.element.offset())===null||g===void 0?void 0:g.top)!==null&&f!==void 0?f:0,y2:((v=(p=this.header.element.offset())===null||p===void 0?void 0:p.top)!==null&&v!==void 0?v:0)+((C=this.header.element.innerHeight())!==null&&C!==void 0?C:0)})}}_resetHeaderDropZone(){this.layoutManager.tabDropPlaceholder.remove()}_setupHeaderPosition(){var e=["right","left","bottom"].some(n=>n===this._header.show)?this._header.show:void 0;if(this.header.element.toggle(!!this._header.show),!!e&&(this._side=e,this._sided=["right","left"].indexOf(this._side.toString())>=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 t=["right","bottom"].indexOf(this._side.toString())>=0?"before":"after";this.header.element[t](this.childElementContainer),this.callDownwards("setSize")}}_highlightBodyDropZone(e){var t,n,i=(t=this._contentAreaDimensions)===null||t===void 0||(n=t[e])===null||n===void 0?void 0:n.highlightArea;if(i){var a;(a=this.layoutManager.dropTargetIndicator)===null||a===void 0||a.highlightArea(i)}this._dropSegment=e}}const PC=Object.freeze(Object.defineProperty({__proto__:null,AbstractContentItem:tt,Component:yc,ContentItem:tt,Root:Wo,RowOrColumn:Da,Stack:Go,isComponent:Et,isRoot:Cc,isStack:xi},Symbol.toStringTag,{value:"Module"}));function Cn(r,e,t){return e=TC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function TC(r){var e=_C(r,"string");return typeof e=="symbol"?e:String(e)}function _C(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Vi{constructor(e,t){var n;Cn(this,"header",void 0),Cn(this,"contentItem",void 0),Cn(this,"element",Q(Vi._template)),Cn(this,"titleElement",void 0),Cn(this,"closeElement",void 0),Cn(this,"isActive",!1),Cn(this,"_layoutManager",void 0),Cn(this,"_dragListener",void 0),this.header=e,this.contentItem=t,this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[t.config.isClosable?"show":"hide"](),this.setTitle(t.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,(n=this._layoutManager.config.settings)!==null&&n!==void 0&&n.reorderEnabled&&t.config.reorderEnabled&&(this._dragListener=new $i(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClick=this._onTabClick.bind(this),this._onCloseClick=this._onCloseClick.bind(this),this._onTabContentFocusIn=this._onTabContentFocusIn.bind(this),this._onTabContentFocusOut=this._onTabContentFocusOut.bind(this),this.element.on("click",this._onTabClick),this.element.on("auxclick",this._onTabClick),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClick),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),Et(this.contentItem)&&(this.contentItem.container._contentElement.on("focusin",this._onTabContentFocusIn).on("focusout",this._onTabContentFocusOut),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))}setTitle(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";this.titleElement.html(e)}setActive(e){e!==this.isActive&&(this.isActive=e,e?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))}_$destroy(){this.element.off("click",this._onTabClick),this.element.off("auxclick",this._onTabClick),this.closeElement.off("click",this._onCloseClick),Et(this.contentItem)&&(this.contentItem.container._contentElement.off(),this.contentItem.container._contentElement[0].removeEventListener("click",this._onTabContentFocusIn,!0)),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=void 0),this.element.remove()}_onDragStart(e,t){var n;(n=this.contentItem.parent)!==null&&n!==void 0&&n.isMaximised&&this.contentItem.parent.toggleMaximise(),this._dragListener&&new gr(e,t,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)}_onTabContentFocusIn(){Q(".lm_focusin",this._layoutManager.root.element).removeClass("lm_focusin"),this.element.addClass("lm_focusin")}_onTabContentFocusOut(){Et(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.element.removeClass("lm_focusin")}_onTabClick(e){if(!e||e.button===0){var t,n=this.header.parent.getActiveContentItem();this.contentItem!==n&&Et(this.contentItem)?this.header.parent.setActiveContentItem(this.contentItem):Et(this.contentItem)&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&this.contentItem.container._contentElement.focus(),Et(this.contentItem)&&this.contentItem.container.emit("tabClicked",e),this.header._hideAdditionalTabsDropdown(),(t=this.element.get(0))===null||t===void 0||t.scrollIntoView({inline:"nearest"})}else e.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(e)}_onCloseClick(e){e.stopPropagation(),Et(this.contentItem)?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)}_onCloseMousedown(e){e.stopPropagation()}}Cn(Vi,"_template",['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab" aria-label="Close tab"></div>',"</li>"].join(""));function ge(r,e,t){return e=OC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function OC(r){var e=DC(r,"string");return typeof e=="symbol"?e:String(e)}function DC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Tn extends Yt{constructor(e,t){var n,i;super(),ge(this,"layoutManager",void 0),ge(this,"element",Q(Tn._template)),ge(this,"tabsContainer",void 0),ge(this,"tabDropdownContainer",void 0),ge(this,"tabDropdownSearch",void 0),ge(this,"tabDropdownList",null),ge(this,"controlsContainer",void 0),ge(this,"parent",void 0),ge(this,"tabs",[]),ge(this,"activeContentItem",null),ge(this,"closeButton",null),ge(this,"tabDropdownButton",null),ge(this,"tabNextButton",Q(Tn._nextButtonTemplate)),ge(this,"tabPreviousButton",Q(Tn._previousButtonTemplate)),ge(this,"holdTimer",null),ge(this,"rAF",null),ge(this,"CLICK_TIMEOUT",500),ge(this,"START_SPEED",.01),ge(this,"ACCELERATION",5e-4),ge(this,"PADDING",10),ge(this,"SCROLL_LEFT","left"),ge(this,"SCROLL_RIGHT","right"),ge(this,"isDraggingTab",!1),ge(this,"isOverflowing",!1),ge(this,"isDropdownShown",!1),ge(this,"dropdownKeyIndex",0),ge(this,"_lastVisibleTabIndex",-1),ge(this,"_tabControlOffset",void 0),this.layoutManager=e,(n=this.layoutManager.config.settings)!==null&&n!==void 0&&n.selectionEnabled&&(this.element.addClass("lm_selectable"),this.element.on("click",this._onHeaderClick.bind(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._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=t,this.parent.on("resize",this._updateTabSizes,this),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.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),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._tabControlOffset=(i=this.layoutManager.config.settings)===null||i===void 0?void 0:i.tabControlOffset,this._createControls()}createTab(e,t){for(var n=0;n<this.tabs.length;n++)if(this.tabs[n].contentItem===e)return;var i=new Vi(this,e);if(this.tabs.length===0){this.tabs.push(i),this.tabsContainer.append(i.element);return}t===void 0&&(t=this.tabs.length),t>0?this.tabs[t-1].element.after(i.element):this.tabs[0].element.before(i.element),this.tabs.splice(t,0,i),this._updateTabSizes()}removeTab(e){for(var t=0;t<this.tabs.length;t++)if(this.tabs[t].contentItem===e){this.tabs[t]._$destroy(),this.tabs.splice(t,1);return}throw new Error("contentItem is not controlled by this header")}setActiveContentItem(e){for(var t,n,i,a,o=0;o<this.tabs.length;o++)a=this.tabs[o].contentItem===e,this.tabs[o].setActive(a),a===!0&&(this.activeContentItem=e,this.parent.config.activeItemIndex=o);(t=this.tabs[(i=this.parent.config.activeItemIndex)!==null&&i!==void 0?i:0].element.get(0))===null||t===void 0||(n=t.scrollIntoView)===null||n===void 0||n.call(t,{inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")}position(e){var t=this.parent._header.show;return t&&!this.parent._side&&(t="top"),e!==void 0&&this.parent._header.show!==e&&(this.parent._header.show=e,this.parent._setupHeaderPosition()),t}_attachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.addEventListener("wheel",this._handleWheelEvent,{passive:!0})}_detachWheelListener(){var e;(e=this.tabsContainer.get(0))===null||e===void 0||e.removeEventListener("wheel",this._handleWheelEvent)}_handleWheelEvent(e){var t=e.currentTarget;if(t instanceof HTMLElement){var n=Math.abs(e.deltaY)>Math.abs(e.deltaX)?e.deltaY:e.deltaX;if(e.deltaMode===WheelEvent.DOM_DELTA_PAGE){var i;n*=(i=this.tabsContainer.innerWidth())!==null&&i!==void 0?i:1}else e.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=100/3);t.scrollLeft+=Math.round(n)}}_handleScrollEvent(){this._checkScrollArrows()}_handleItemPickedUp(){this.isDraggingTab=!0,this.isDropdownShown&&this._hideAdditionalTabsDropdown(),this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)}_handleItemDropped(){var e;this.isDraggingTab=!1,window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,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(){var e;this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handlePreviousMouseEnter(){var e;this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,(e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)}_handleNextMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)}_handlePreviousMouseLeave(){var e;window.cancelAnimationFrame((e=this.rAF)!==null&&e!==void 0?e:-1),this.rAF=null,this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)}_handleNextButtonMouseDown(){for(var e,t=0;t<this.tabs.length;t+=1){var n,i,a,o,s;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n:0)>((a=(o=this.tabsContainer.get(0))===null||o===void 0?void 0:o.offsetWidth)!==null&&a!==void 0?a:0)+((s=this.tabsContainer.scrollLeft())!==null&&s!==void 0?s:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT);else{var l=this.tabsContainer.get(0);if(l){var d,u;l.scrollLeft=(d=(u=this.tabsContainer.get(0))===null||u===void 0?void 0:u.scrollWidth)!==null&&d!==void 0?d:0}}}_handlePreviousButtonMouseDown(){for(var e,t=this.tabs.length-1;t>=0;t-=1){var n,i,a;if(((n=(i=this.tabs[t].element.get(0))===null||i===void 0?void 0:i.offsetLeft)!==null&&n!==void 0?n:0)<((a=this.tabsContainer.scrollLeft())!==null&&a!==void 0?a:0)){e=this.tabs[t].element.get(0);break}}if(e)e.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT);else{var o=this.tabsContainer.get(0);o&&(o.scrollLeft=0)}}_handleScrollButtonMouseDown(e){this.holdTimer=window.setTimeout(()=>{var t;this._handleScrollRepeat(e,(t=this.tabsContainer.scrollLeft())!==null&&t!==void 0?t:0,100)},this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)}_handleScrollButtonMouseUp(){var e,t;clearTimeout((e=this.holdTimer)!==null&&e!==void 0?e:-1),this.holdTimer=null,cancelAnimationFrame((t=this.rAF)!==null&&t!==void 0?t:-1),this.rAF=null,window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)}_checkScrollArrows(){var e,t,n;this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().prop("disabled",!0):((e=this.tabsContainer.scrollLeft())!==null&&e!==void 0?e:0)+((t=this.tabsContainer.innerWidth())!==null&&t!==void 0?t:0)===((n=this.tabsContainer.get(0))===null||n===void 0?void 0:n.scrollWidth)?this.tabNextButton.prop("disabled",!0):(this.tabNextButton.prop("disabled",!1),this.tabPreviousButton.first().prop("disabled",!1))}_handleScrollRepeat(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3?arguments[3]:void 0,o=this.tabsContainer.get(0);if(o){var s=o.getBoundingClientRect();if(e===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(t-i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(e===this.SCROLL_RIGHT){var l,d;if(this.tabsContainer.scrollLeft(t+i),this.isDraggingTab&&this.parent._highlightHeaderDropZone(s.right+1),((l=this.tabsContainer.scrollLeft())!==null&&l!==void 0?l:0)+((d=this.tabsContainer.innerWidth())!==null&&d!==void 0?d:0)===o.scrollWidth){this._checkScrollArrows();return}}window.cancelAnimationFrame((n=this.rAF)!==null&&n!==void 0?n:-1),this.rAF=window.requestAnimationFrame(u=>{var c,m,f=a||u,g=u-f,v=this.START_SPEED*g+.5*this.ACCELERATION*(g*g);v=Math.min(v,(c=(m=this.tabsContainer.get(0))===null||m===void 0?void 0:m.scrollWidth)!==null&&c!==void 0?c:1/0),this._handleScrollRepeat(e,t,v,f)})}}_$setClosable(e){return this.closeButton&&this._isClosable()?(this.closeButton.element[e?"show":"hide"](),!0):!1}_$destroy(){this.emit("destroy",this);for(var e=0;e<this.tabs.length;e++)this.tabs[e]._$destroy();this._detachWheelListener(),this._handleItemDropped(),Q(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()}_getHeaderSetting(e){if(e in this.parent._header)return this.parent._header[e]}_createControls(){var e,t,n,i,a;if(a=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new fi(this,a,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(t=this._onPopoutClick.bind(this),n=this._getHeaderSetting("popout"),new fi(this,n,"lm_popout",t)),this._getHeaderSetting("maximise")){i=this.parent.toggleMaximise.bind(this.parent);var o=this._getHeaderSetting("maximise"),s=this._getHeaderSetting("minimise"),l=new fi(this,o,"lm_maximise",i);this.parent.on("maximised",function(){l.element.attr("title",s??"")}),this.parent.on("minimised",function(){l.element.attr("title",o??"")})}this._isClosable()&&(e=this.parent.remove.bind(this.parent),n=this._getHeaderSetting("close"),this.closeButton=new fi(this,n,"lm_close",e))}_showAdditionalTabsDropdown(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),Q(document.body).append(this.tabDropdownContainer),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"),Q(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()}_handleFilterKeydown(e){if(e.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(this.dropdownKeyIndex===-1)return;if(e.key==="Enter"||e.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function t(s,l,d){if(d==null||d.length<2)return-1;for(var u=(s+l+d.length)%d.length;u!==s;){if(d.eq(u).css("display")!=="none")return u;u=(u+l+d.length)%d.length}return s}if(e.key==="ArrowDown"||e.key==="Tab"&&e.shiftKey===!1){var n,i;e.preventDefault(),(n=this.tabDropdownList)===null||n===void 0||n.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,1,this.tabDropdownList),(i=this.tabDropdownList)===null||i===void 0||i.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}else if(e.key==="ArrowUp"||e.key==="Tab"){var a,o;e.preventDefault(),(a=this.tabDropdownList)===null||a===void 0||a.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=t(this.dropdownKeyIndex,-1,this.tabDropdownList),(o=this.tabDropdownList)===null||o===void 0||o.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_handleFilterInput(e){if(this.tabDropdownList!=null){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var t=0;t<this.tabDropdownList.length;t++){var n,i;((n=(i=this.tabs[t].contentItem.config.title)===null||i===void 0?void 0:i.toLowerCase().indexOf(e.target.value.toLowerCase()))!==null&&n!==void 0?n:-1)!==-1?(this.tabDropdownList.eq(t).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=t)):this.tabDropdownList.eq(t).css("display","none")}this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")}}_hideAdditionalTabsDropdown(e){var t,n;this.isDropdownShown&&(e&&(t=this.tabDropdownContainer.get(0))!==null&&t!==void 0&&t.contains(e.target)||e&&((n=this.tabDropdownButton)===null||n===void 0?void 0:n.element.get(0))===e.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.element.append(this.tabDropdownContainer),this.tabDropdownContainer.find(".lm_tabs").remove(),Q(document).off("mousedown",this._hideAdditionalTabsDropdown)))}_updateAdditionalTabsDropdown(){var e,t,n,i;if(this.isDropdownShown&&!(!this.tabDropdownList||this.tabDropdownList.length==0)){var a=(e=(t=this.tabDropdownContainer.get(0))===null||t===void 0?void 0:t.scrollHeight)!==null&&e!==void 0?e:0;if(a!==0){var o=this.tabDropdownContainer[0].getBoundingClientRect(),s=(n=Q(window).height())!==null&&n!==void 0?n:0,l=(i=Q(window).width())!==null&&i!==void 0?i:0;if(this.tabDropdownButton){var d=this.tabDropdownButton.element[0].getBoundingClientRect(),u=a<s-d.bottom,c=!u&&d.bottom>s*.6,m=Math.min(d.left+(c?d.width:0),l-o.width-this.PADDING),f=c?Math.max(d.top-a,this.PADDING):d.bottom,g=s-f-this.PADDING;this.tabDropdownContainer.css({"max-height":g,top:f,left:m})}}}}_isClosable(){return!!(this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon)}_onPopoutClick(){if(this.layoutManager.config.settings.popoutWholeStack===!0)this.parent.popout();else{var e;(e=this.activeContentItem)===null||e===void 0||e.popout()}}_onHeaderClick(e){e.target===this.element[0]&&this.parent.select()}_updateTabSizes(){if(this.tabs.length!==0){var e=this.tabsContainer.get(0);if(this.isDropdownShown&&this._updateAdditionalTabsDropdown(),!!e){if(!this.isOverflowing&&e.scrollWidth>e.clientWidth){var t;(t=this.tabDropdownButton)===null||t===void 0||t.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0}else if(this.isOverflowing&&e.scrollWidth<=e.clientWidth){var n;(n=this.tabDropdownButton)===null||n===void 0||n.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1}this.isOverflowing&&this._checkScrollArrows()}}}}ge(Tn,"_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(""));ge(Tn,"_previousButtonTemplate",['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""));ge(Tn,"_nextButtonTemplate",['<li class="lm_tabnextbutton"></li>'].join(""));function oi(r,e,t){return e=MC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function MC(r){var e=IC(r,"string");return typeof e=="symbol"?e:String(e)}function IC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Sc{constructor(e,t,n){oi(this,"_isVertical",void 0),oi(this,"_size",void 0),oi(this,"_grabSize",void 0),oi(this,"_dragListener",void 0),oi(this,"element",void 0),this._isVertical=e,this._size=t,this._grabSize=n<t?t:n,this.element=this._createElement(),this._dragListener=new $i(this.element)}on(e,t,n){var i;(i=this._dragListener)===null||i===void 0||i.on(e,t,n)}_$destroy(){var e;(e=this._dragListener)===null||e===void 0||e.destroy(),this._dragListener=null,this.element.remove()}_createElement(){var e=Q('<div class="lm_drag_handle"></div>'),t=Q('<div class="lm_splitter"></div>');t.append(e);var n=this._grabSize-this._size,i=n/2;return this._isVertical?(e.css("top",-i),e.css("height",this._size+n),t.addClass("lm_vertical"),t.height(this._size)):(e.css("left",-i),e.css("width",this._size+n),t.addClass("lm_horizontal"),t.width(this._size)),t}}const NC=Object.freeze(Object.defineProperty({__proto__:null,BrowserPopout:vc,DragProxy:gr,DragSource:pc,DragSourceFromEvent:gc,DropTargetIndicator:Hi,Header:Tn,HeaderButton:fi,Splitter:Sc,Tab:Vi},Symbol.toStringTag,{value:"Module"}));var xC={config:Mb,container:Rb,controls:NC,errors:mC,items:PC,utils:Zb};const FC=xC;function id(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function vt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?id(Object(t),!0).forEach(function(n){ye(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):id(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ye(r,e,t){return e=RC(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function RC(r){var e=LC(r,"string");return typeof e=="symbol"?e:String(e)}function LC(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class wc extends Yt{static minifyConfig(e){return xs(e)}static unminifyConfig(e){return Vo(e)}constructor(e,t){super(),ye(this,"isInitialised",!1),ye(this,"_isFullPage",!1),ye(this,"_resizeTimeoutId",void 0),ye(this,"_components",{"lm-react-component":mc}),ye(this,"_fallbackComponent",void 0),ye(this,"_itemAreas",[]),ye(this,"_maximisedItem",null),ye(this,"_maximisePlaceholder",Q('<div class="lm_maximise_place"></div>')),ye(this,"_creationTimeoutPassed",!1),ye(this,"_subWindowsCreated",!1),ye(this,"_dragSources",[]),ye(this,"_updatingColumnsResponsive",!1),ye(this,"_firstLoad",!0),ye(this,"_reactChildMap",new Map),ye(this,"_reactChildren",null),ye(this,"width",null),ye(this,"height",null),ye(this,"root",void 0),ye(this,"openPopouts",[]),ye(this,"selectedItem",null),ye(this,"isSubWindow",!1),ye(this,"eventHub",new fc(this)),ye(this,"config",void 0),ye(this,"container",void 0),ye(this,"_originalContainer",void 0),ye(this,"dropTargetIndicator",null),ye(this,"tabDropPlaceholder",Q('<div class="lm_drop_tab_placeholder"></div>')),ye(this,"_typeToItem",void 0),this._onResize=this._onResize.bind(this),this._onUnload=this._onUnload.bind(this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this.config=this._createConfig(e),this._originalContainer=t,this.container=this._getContainer(),this.isSubWindow&&Q("body").css("visibility","hidden"),this._typeToItem={column:Da.bind(this,!0),row:Da.bind(this,!1),stack:Go,component:yc}}registerComponent(e,t){if(typeof t!="function"&&(t==null||t.render==null||typeof t.render!="function"))throw new Error("Please register a constructor function");if(this._components[e]!==void 0)throw new Error("Component "+e+" is already registered");this._components[e]=t;var n=()=>{if(this._components[e]===void 0)throw new Error("Component "+e+" is not registered");delete this._components[e]};return n}setFallbackComponent(e){this._fallbackComponent=e}toConfig(e){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(e&&!(e instanceof tt))throw new Error("Root must be a ContentItem");var t={settings:vt({},this.config.settings),dimensions:vt({},this.config.dimensions),labels:vt({},this.config.labels),content:[]},n=function a(o,s){for(var l in s.config)l!=="content"&&(o[l]=s.config[l]);if(o.componentName==="lm-react-component"&&(o.type="react-component"),s.contentItems.length){o.content=[];for(var d=0;d<s.contentItems.length;d++)o.content[d]={},a(o.content[d],s.contentItems[d])}};e?n(t,{contentItems:[e]}):n(t,this.root),this._$reconcilePopoutWindows(),t.openPopouts=[];for(var i=0;i<this.openPopouts.length;i++)t.openPopouts.push(this.openPopouts[i].toConfig());return t.maximisedItemId=this._maximisedItem?"__glMaximised":void 0,t}getComponent(e){return this._components[e]}getFallbackComponent(){return this._fallbackComponent}init(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){Q(document).ready(this.init.bind(this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(this.init.bind(this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new Hi,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")}addReactChild(e,t){this._reactChildMap.set(e,t),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged")}removeReactChild(e,t){var n=this._reactChildMap.get(e);n===t&&(this._reactChildMap.delete(e),this._reactChildren=[...this._reactChildMap.values()],this.emit("reactChildrenChanged"))}getReactChildren(){return this._reactChildren}updateSize(e,t){var n,i;if(this.width=(n=e??this.container.width())!==null&&n!==void 0?n:0,this.height=(i=t??this.container.height())!==null&&i!==void 0?i:0,this.isInitialised===!0){if(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem){var a,o;this._maximisedItem.element.width((a=this.container.width())!==null&&a!==void 0?a:0),this._maximisedItem.element.height((o=this.container.height())!==null&&o!==void 0?o:0),this._maximisedItem.callDownwards("setSize")}this._adjustColumnsResponsive()}}destroy(){var e;this.isInitialised===!1||!this.root||(this._onUnload(),Q(window).off("resize",this._onResize),Q(window).off("unload beforeunload",this._onUnload),Q(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),(e=this.dropTargetIndicator)===null||e===void 0||e.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy()}),this._dragSources=[])}createContentItem(e,t){var n,i;if(typeof e.type!="string")throw new dr("Missing parameter 'type'",e);if(e.type==="react-component"&&(e.type="component",e.componentName="lm-react-component"),!this._typeToItem[e.type])throw n="Unknown type '"+e.type+"'. Valid types are "+Object.keys(this._typeToItem).join(","),new dr(n);return e.type==="component"&&!(t instanceof Go)&&t&&!(this.isSubWindow===!0&&t instanceof Wo)&&(e={type:"stack",width:e.width,height:e.height,content:[e]}),i=new this._typeToItem[e.type](this,e,t),i}createPopout(e,t,n,i){var a=[],o=e instanceof tt,s=this;if(o){var l;a=this.toConfig(e).content,n=Is();for(var d=e.parent,u=e;((c=d)===null||c===void 0?void 0:c.contentItems.length)===1&&!d.isRoot;){var c;u=d,d=d.parent}if((l=d)===null||l===void 0||l.addId(n),i==null||Number.isNaN(i)){var m;i=(m=d)===null||m===void 0?void 0:m.contentItems.indexOf(u)}}else e instanceof Array?a=e:a=[e];if(!t&&o){var f,g,v,p=window.screenX||window.screenLeft,C=window.screenY||window.screenTop,S=(f=e.element.offset())!==null&&f!==void 0?f:{left:0,top:0};t={left:p+S.left,top:C+S.top,width:(g=e.element.width())!==null&&g!==void 0?g:0,height:(v=e.element.height())!==null&&v!==void 0?v:0}}if(!t&&!o&&(t={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),o&&e.remove(),!(!t||!n||i===void 0)){var y=new vc(a,t,n,i,this);return y.on("initialised",function(){s.emit("windowOpened",y)}),y.on("closed",function(){s._$reconcilePopoutWindows()}),this.openPopouts.push(y),y}}createDragSource(e,t){this.config.settings.constrainDragToContainer=!1;var n=new pc(e,t,this);return this._dragSources.push(n),n}createDragSourceFromEvent(e,t){return this.config.settings.constrainDragToContainer=!1,new gc(e,this,t)}selectItem(e,t){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");e!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),e&&t!==!0&&e.select(),this.selectedItem=e,this.emit("selectionChanged",e))}_$maximiseItem(e){var t,n;this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=e,this._maximisedItem.addId("__glMaximised"),e.element.addClass("lm_maximised"),e.element.after(this._maximisePlaceholder),this.root.element.prepend(e.element),e.element.width((t=this.container.width())!==null&&t!==void 0?t:0),e.element.height((n=this.container.height())!==null&&n!==void 0?n:0),e.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")}_$minimiseItem(e){var t;e.element.removeClass("lm_maximised"),e.removeId("__glMaximised"),this._maximisePlaceholder.after(e.element),this._maximisePlaceholder.remove(),(t=e.parent)===null||t===void 0||t.callDownwards("setSize"),this._maximisedItem=null,e.emit("minimised"),this.emit("stateChanged")}_$closeWindow(){window.setTimeout(function(){window.close()},1)}_$getArea(e,t){for(var n=1/0,i=null,a=0;a<this._itemAreas.length;a++){var o=this._itemAreas[a];e>o.x1&&e<o.x2&&t>o.y1&&t<o.y2&&n>o.surface&&(n=o.surface,i=o)}return i}_$createRootItemAreas(){var e=50,t=vt({},this.root._$getArea()),n=[vt(vt({},t),{},{side:"left",x2:t.x1+e}),vt(vt({},t),{},{side:"right",x1:t.x2-e}),vt(vt({},t),{},{side:"top",y2:t.y1+e}),vt(vt({},t),{},{side:"bottom",y1:t.y2-e})];n.forEach(i=>{i.surface=(i.x2-i.x1)*(i.y2-i.y1)}),this._itemAreas.push(...n)}_$calculateItemAreas(){var e=this._getAllContentItems();if(this._itemAreas=[],e.length===1){this._itemAreas.push(this.root._$getArea());return}this._$createRootItemAreas();for(var t=0;t<e.length;t++){var n=e[t];if(xi(n)){var i=n._$getArea();if(i!==null)if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{var a;this._itemAreas.push(i);var o=vt(vt({},i),(a=i.contentItem._contentAreaDimensions)===null||a===void 0?void 0:a.header.highlightArea);o.surface=(o.x2-o.x1)*(o.y2-o.y1),this._itemAreas.push(o)}}}}_$normalizeContentItem(e,t){if(!e)throw new Error("No content item defined");if(typeof e=="function"&&(e=e()),e instanceof tt)return e;if(Q.isPlainObject(e)&&e.type){var n=this.createContentItem(e,t);return n.callDownwards("_$init"),n}else throw new Error("Invalid contentItem")}_$reconcilePopoutWindows(){for(var e=[],t=0;t<this.openPopouts.length;t++){var n;((n=this.openPopouts[t].getWindow())===null||n===void 0?void 0:n.closed)===!1?e.push(this.openPopouts[t]):this.emit("windowClosed",this.openPopouts[t])}this.openPopouts.length!==e.length&&(this.emit("stateChanged"),this.openPopouts=e)}_getAllContentItems(){var e=[],t=n=>{if(e.push(n),n.contentItems instanceof Array)for(var i=0;i<n.contentItems.length;i++)t(n.contentItems[i])};return t(this.root),e}_bindEvents(){this._isFullPage&&Q(window).resize(this._onResize),Q(window).on("unload beforeunload",this._onUnload).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)}_windowBlur(){this.root.element.addClass("lm_window_blur")}_windowFocus(){this.root.element.removeClass("lm_window_blur")}_onResize(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=window.setTimeout(this.updateSize.bind(this),100)}_createConfig(e){var t,n=cc("gl-window");n&&(this.isSubWindow=!0,e=JSON.parse(localStorage.getItem(n)||"{}"),e=Vo(e),localStorage.removeItem(n)),e=Q.extend(!0,{},lc,e);var i=function a(o){for(var s in o){var l=o[s];s!=="props"&&typeof l=="object"&&l!=null?a(l):s==="type"&&l==="react-component"&&(o.type="component",o.componentName="lm-react-component")}};return i(e),((t=e.settings)===null||t===void 0?void 0:t.hasHeaders)===!1&&(e.dimensions.headerHeight=0),e}_adjustToWindowMode(){var e,t=Q('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(()=>{this.emit("popIn")}),document.title=Ns((e=this.config.content[0].title)!==null&&e!==void 0?e:""),Q("head").append(Q("body link, body style, template, .gl_keep")),this.container=Q("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this}_createSubWindows(){if(this.config.openPopouts)for(var e=0;e<this.config.openPopouts.length;e++){var t=this.config.openPopouts[e];this.createPopout(t.content,t.dimensions,t.parentId,t.indexInParent)}}_getContainer(){var e=this._originalContainer?Q(this._originalContainer):Q("body");if(e.length===0)throw new Error("GoldenLayout container not found");if(e.length>1)throw new Error("GoldenLayout more than one container element specified");return e}_setContainer(){var e=this._getContainer();e[0]===document.body&&(this._isFullPage=!0,Q("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=e}_create(e){var t;if(!(e.content instanceof Array))throw e.content===void 0?t="Missing setting 'content' on top level of configuration":t="Configuration parameter 'content' must be an array",new dr(t,e);if(e.content.length>1)throw t="Top level content can't contain more then one element.",new dr(t,e);this.root=new Wo(this,{content:e.content},this.container),this.root.callDownwards("_$init"),e.maximisedItemId==="__glMaximised"&&this.root.getItemsById(e.maximisedItemId)[0].toggleMaximise()}_onUnload(){if(this.config.settings.closePopoutsOnUnload===!0)for(var e=0;e<this.openPopouts.length;e++)this.openPopouts[e].close()}_adjustColumnsResponsive(){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 e=this.root.contentItems[0].contentItems.length;if(!(e<=1)){var t=this.config.dimensions.minItemWidth,n=e*t;if(!(this.width==null||n<=this.width)){this._updatingColumnsResponsive=!0;for(var i=Math.max(Math.floor(this.width/t),1),a=e-i,o=this.root.contentItems[0],s=this._findAllStackContainers()[0],l=0;l<a;l++){var d=o.contentItems[o.contentItems.length-1];this._addChildContentItemsToContainer(s,d)}this._updatingColumnsResponsive=!1}}}_useResponsiveLayout(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)}_addChildContentItemsToContainer(e,t){t.type==="stack"?t.contentItems.forEach(function(n){e.addChild(n),t.removeChild(n,!0)}):t.contentItems.forEach(n=>{this._addChildContentItemsToContainer(e,n)})}_findAllStackContainers(){var e=[];return this._findAllStackContainersRecursive(e,this.root),e}_findAllStackContainersRecursive(e,t){t.contentItems.forEach(n=>{xi(n)?e.push(n):n.isComponent||this._findAllStackContainersRecursive(e,n)})}}ye(wc,"__lm",FC);const AC=wc,kC="_lm_dragging_k4a5m_1",jC="_lm_goldenlayout_k4a5m_1",$C="_lm_header_k4a5m_1",HC="_lm_controls_k4a5m_1",VC="_lm_tabpreviousbutton_k4a5m_1",UC="_lm_tabnextbutton_k4a5m_1",BC="_lm_tab_k4a5m_1",WC="_lm_active_k4a5m_1",GC="_lm_close_tab_k4a5m_1",zC="_lm_content_k4a5m_1",KC="_lm_dragProxy_k4a5m_1",qC="_lm_dropTargetIndicator_k4a5m_1",XC="_march_k4a5m_1",ZC="_lm_inner_k4a5m_1",YC="_lm_splitter_k4a5m_1",QC="_lm_selectable_k4a5m_1",JC="_lm_tabdropdown_list_k4a5m_1",ey="_lm_title_k4a5m_1",ty="_lm_title_before_k4a5m_1",ny="_lm_selected_k4a5m_1",ry="_lm_focusin_k4a5m_1",iy="_lm_window_blur_k4a5m_1",ay="_lm_popout_k4a5m_1",oy="_lm_maximise_k4a5m_1",sy="_lm_tabdropdown_k4a5m_1",ly="_lm_close_k4a5m_1",dy="_lm_tabdropdown_search_k4a5m_1",uy="_lm_tabs_k4a5m_1",hy="_lm_keyboard_active_k4a5m_1",cy="_lm_maximised_k4a5m_1",my="_lm_items_k4a5m_1",ad={"tab-height":"28px","drag-border-width":"5px",lm_dragging:kC,lm_goldenlayout:jC,lm_header:$C,lm_controls:HC,lm_tabpreviousbutton:VC,lm_tabnextbutton:UC,lm_tab:BC,lm_active:WC,lm_close_tab:GC,lm_content:zC,lm_dragProxy:KC,lm_dropTargetIndicator:qC,march:XC,lm_inner:ZC,lm_splitter:YC,lm_selectable:QC,lm_tabdropdown_list:JC,lm_title:ey,lm_title_before:ty,lm_selected:ny,lm_focusin:ry,lm_window_blur:iy,lm_popout:ay,lm_maximise:oy,lm_tabdropdown:sy,lm_close:ly,lm_tabdropdown_search:dy,lm_tabs:uy,lm_keyboard_active:hy,lm_maximised:cy,lm_items:my},od=Object.freeze({tabHeight:parseInt(ad["tab-height"],10),dragBorderWidth:parseInt(ad["drag-border-width"],10)});function sd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function mn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?sd(Object(t),!0).forEach(function(n){Ec(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):sd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ec(r,e,t){return e=fy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function fy(r){var e=vy(r,"string");return typeof e=="symbol"?e:String(e)}function vy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var xn=z.module("LayoutUtils");function Pc(r){return r.componentName!==void 0}function Rr(r){var e=r;return(Pc(r)&&r.componentName==="lm-react-component"||r.type==="react-component")&&e.component!==void 0}function ra(r){return r.focus!==void 0}function ld(r){return r.type==="stack"}class A{static activateTab(e,t){var n=A.getStackForRoot(e,t,!1);if(!n){xn.error("Could not find stack for config",t);return}var i=A.getContentItemInStack(n,t);i&&n.setActiveContentItem(i)}static isActiveTab(e,t){var n=A.getStackForRoot(e,t,!1);if(!n)return xn.error("Could not find stack for config",t),!1;var i=A.getContentItemInStack(n,t),a=n.getActiveContentItem();return a===i}static addStack(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=t?"column":"row";if(Cc(e)){(e.contentItems==null||e.contentItems.length===0)&&e.addChild({type:n});var i=e.contentItems[0],a=t?i.isColumn:i.isRow;if(!a){e.removeChild(i,!0),e.addChild({type:n});var o=document.activeElement;e.contentItems[0].addChild(i),o&&o.focus!=null&&o.focus()}return this.addStack(e.contentItems[0],t)}if(e.contentItems.length<2)return e.addChild({type:"stack"}),e.contentItems[e.contentItems.length-1];var s=e.contentItems[e.contentItems.length-1],l=t?s.isRow:s.isColumn;return l||(e.addChild({type:t?"row":"column"}),e.removeChild(s,!0),e.contentItems[e.contentItems.length-1].addChild(s),s=e.contentItems[e.contentItems.length-1]),this.addStack(s,!t)}static getStackForConfig(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(n&&xi(e)&&e.contentItems.length===0)return e;if(e.contentItems==null)return null;for(var i=0;i<e.contentItems.length;i+=1){var a=e.contentItems[i];if(a.isComponent&&a.config!=null&&al(a.config,t))return e;var o=this.getStackForConfig(a,t,n);if(o)return o}return null}static getStackForRoot(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=this.getStackForConfig(e,t);return!o&&i&&(o=this.getStackForConfig(e,{component:t.component},a)),!o&&n&&(o=this.addStack(e)),o}static getStackForComponentTypes(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=0;o<t.length;o+=1){var s=t[o],l=o===t.length-1,d=A.getStackForRoot(e,{component:s},n&&l,i,a);if(d)return d}return null}static getContentItemInStack(e,t){if(!e)return null;for(var n=0;n<e.contentItems.length;n+=1){var i=e.contentItems[n];if(i.isComponent&&i.config!=null&&al(i.config,t))return i}return null}static dehydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],i=0;i<e.length;i+=1){var a=e[i],{component:o,content:s}=a;if(o){var l=t(o,a);l!=null?n.push(l):xn.debug2('dehydrateLayoutConfig: skipping unmapped component "'.concat(o,'"'))}else if(s){var d=mn(mn({},a),{},{content:A.dehydrateLayoutConfig(s,t)});n.push(d)}else n.push(a)}return n}static getTabPoint(e){var{tab:t}=e;if(t==null)throw new Error("Cannot get tab for panel container ".concat(e));var n=t.element[0].getBoundingClientRect();return[n.left+n.width*.5,n.bottom-8]}static dropLayoutMinorChange(e){for(var t=0;t<e.length;t+=1){var n=e[t],{content:i}=n;i!==void 0?(ld(n)&&delete n.activeItemIndex,A.dropLayoutMinorChange(i)):Rr(n)&&n.component==="IrisGridPanel"&&n.props.panelState!=null&&(delete n.id,n.props.panelState.irisGridState.sorts=[],n.props.panelState.irisGridState.quickFilters=[],n.props.panelState.gridState.isStuckToBottom=!1,n.props.panelState.gridState.isStuckToRight=!1)}}static isEqual(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=A.cloneLayout(e),a=A.cloneLayout(t);return n?(A.dropLayoutMinorChange(i),A.dropLayoutMinorChange(a),mr(i,a)):mr(i,a)}static cloneLayout(e){return JSON.parse(JSON.stringify(e))}static hydrateLayoutConfig(e,t){if(e==null||!e.length)return[];for(var n=[],i=0;i<e.length;i+=1){var a=e[i];if(Rr(a)){var o,{component:s,props:l={}}=a;n.push(mn(mn({},a),{},{id:(o=a==null?void 0:a.id)!==null&&o!==void 0?o:Ue(),props:t(s,l)}))}else if(a.content!==void 0){var d=A.hydrateLayoutConfig(a.content,t);ld(a)&&a.activeItemIndex!=null&&a.activeItemIndex>=d.length&&(xn.warn("Fixing bad activeItemIndex!",a.activeItemIndex,a),a.activeItemIndex=0),n.push(mn(mn({},a),{},{content:d}))}else n.push(a)}return n}static openComponent(){var{root:e,config:t,replaceExisting:n=!0,replaceConfig:i=void 0,createNewStack:a=!1,focusElement:o=void 0,dragEvent:s=void 0}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=document.activeElement,d=mn({},t);if(d.id==null&&(d.id=Ue.generate()),s!=null){e==null||e.layoutManager.createDragSourceFromEvent(d,s);return}var u=i||{id:d.id,component:d.component};I(e);var c=a?A.addStack(e):A.getStackForRoot(e,u);I(c);var m=A.getContentItemInStack(c,u);if(o!=null){var f=v=>{xn.debug("Component created, focusing element",o),c.off("componentCreated",f);var{element:p}=v.origin;requestAnimationFrame(()=>{A.focusElement(p[0],o)})};c.on("componentCreated",f)}if(n&&m){var g=c.contentItems.indexOf(m);c.addChild(d,g+1),c.removeChild(m),c.setActiveContentItem(c.contentItems[g])}else c.addChild(d);o==null&&l&&ra(l)&&l.focus()}static openComponentInStack(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=document.activeElement,a={id:t.id},o=A.getContentItemInStack(e,a);if(n&&o&&e){var s=e==null?void 0:e.contentItems.indexOf(o);e.addChild(t,s+1),e.removeChild(o),e.setActiveContentItem(e.contentItems[s])}else e==null||e.addChild(t);i&&ra(i)&&i.focus()}static closeComponent(e,t,n){var i=A.getStackForRoot(e,t,!1,!1,!1);if(!i){xn.warn("Cannot find stack for component, ignoring close",t);return}var a=A.getContentItemInStack(i,t),o=document.activeElement;a&&(Et(a)?a.container.close(n):i.removeChild(a)),o&&document.contains(o)&&ra(o)&&o.focus()}static renameComponent(e,t,n){var i=A.getStackForRoot(e,t,!1);if(!i){xn.error("Could not find stack for config",t);return}var a=A.getContentItemInStack(i,t);a&&a.setTitle(n)}static cloneComponent(e,t){var n=A.getStackForRoot(e,t,!1);if(!n)return xn.error("Could not find stack for config",t),null;var{props:i={}}=t,a=A.getPanelComponentState(t),o={type:"react-component",component:t.component,props:mn(mn({},i),{},{panelState:a}),title:"".concat(t.title," Copy"),id:Ue.generate()};return A.openComponentInStack(n,o),o}static getPanelComponentState(e){if(Pc(e)){var t;return(t=e.componentState)===null||t===void 0?void 0:t.panelState}if(Rr(e)){var n;return(n=e.props)===null||n===void 0?void 0:n.panelState}return null}static makeDefaultLayout(){return{dimensions:{headerHeight:od.tabHeight,borderWidth:od.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(e){return e.layoutManager.root}static getComponentConfigFromContainer(e){return e?e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config:e._config:null}static getTitleFromContainer(e){return e!=null&&e.tab!=null&&e.tab.contentItem!=null?e.tab.contentItem.config.title:null}static getTitleFromTab(e){return e!=null&&e.contentItem!=null?e.contentItem.config.title:null}static getIdFromContainer(e){var t=A.getComponentConfigFromContainer(e);return t?t.id:null}static getIdFromPanel(e){var{glContainer:t}=e.props;return A.getIdFromContainer(t)}static getComponentNameFromPanel(e){var{glContainer:t}=e.props,n=A.getComponentConfigFromContainer(t);if(n&&Rr(n)){var i;return(i=n.component)!==null&&i!==void 0?i:null}return null}static getComponentName(e){var t,n,i=(t=(n=e.WrappedComponent)===null||n===void 0?void 0:n.displayName)!==null&&t!==void 0?t:e.displayName;if(i==null)throw new Error("Component displayName not defined ".concat(e));return i}static focusElement(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:A.DEFAULT_FOCUS_SELECTOR;if(e==null)return null;var n=e.querySelector(t);return n==null?null:(ra(n)&&n.focus(),n)}static onInitialized(e){return new Promise(t=>{if(e.isInitialised){t();return}var n=()=>{e.off("initialised",n),t()};e.on("initialised",n)})}}Ec(A,"DEFAULT_FOCUS_SELECTOR","input, select, textarea, button");var py=Z.forwardRef((r,e)=>{var t=A.getComponentNameFromPanel({props:r});return h.jsx("div",{ref:e,className:"panel-placeholder",children:h.jsxs("div",{children:['Component "',t,'" is not registered.']})})});py.displayName="PanelPlaceholder";const se=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",DRAGGING:"PanelEvent.DRAGGING",DROPPED:"PanelEvent.DROPPED"});function Ma(r){return(r==null?void 0:r.WrappedComponent)!==void 0}function gy(r){return typeof r.id=="string"&&r.layout instanceof AC&&r.panelManager instanceof Rs&&typeof r.registerComponent=="function"}function Yr(r){if(!gy(r))throw new Error("Expected dashboard plugin props, but instead received ".concat(r))}function dd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ud(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?dd(Object(t),!0).forEach(function(n){Gn(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):dd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Gn(r,e,t){return e=by(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function by(r){var e=Cy(r,"string");return typeof e=="symbol"?e:String(e)}function Cy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var xt=z.module("PanelManager");class Rs{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:(s,l)=>l,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:(s,l)=>l,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:new Map,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:()=>{};Gn(this,"layout",void 0),Gn(this,"hydrateComponent",void 0),Gn(this,"dehydrateComponent",void 0),Gn(this,"onPanelsUpdated",void 0),Gn(this,"closed",void 0),Gn(this,"openedMap",void 0),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=e,this.hydrateComponent=t,this.dehydrateComponent=n,this.onPanelsUpdated=o,this.openedMap=new Map(i),this.closed=[...a],this.startListening()}startListening(){var{eventHub:e}=this.layout;e.on(se.FOCUS,this.handleFocus),e.on(se.MOUNT,this.handleMount),e.on(se.UNMOUNT,this.handleUnmount),e.on(se.REOPEN,this.handleReopen),e.on(se.DELETE,this.handleDeleted),e.on(se.CLOSED,this.handleClosed),e.on(se.CLOSE,this.handleControlClose)}stopListening(){var{eventHub:e}=this.layout;e.off(se.FOCUS,this.handleFocus),e.off(se.MOUNT,this.handleMount),e.off(se.UNMOUNT,this.handleUnmount),e.off(se.REOPEN,this.handleReopen),e.off(se.DELETE,this.handleDeleted),e.off(se.CLOSED,this.handleClosed),e.off(se.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(e){return this.closed.filter(t=>t.component===e)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(e=>{var{glContainer:t}=e.props;return A.getComponentConfigFromContainer(t)})}getOpenedPanelConfigsOfType(e){return this.getOpenedPanelConfigs().filter(t=>t!=null&&Rr(t)&&t.component===e)}getOpenedPanelById(e){return this.openedMap.get(e)}getContainerByPanelId(e){var t,n=A.getStackForConfig(this.layout.root,{id:e});return(t=n&&A.getContentItemInStack(n,{id:e}))!==null&&t!==void 0?t:null}getLastUsedPanel(e){for(var t=this.getOpenedPanels(),n=t.length-1;n>=0;n-=1){var i=t[n];if(e==null||e(i))return i}}getLastUsedPanelOfType(e){return this.getLastUsedPanelOfTypes([e])}getLastUsedPanelOfTypes(e){return this.getLastUsedPanel(t=>e.some(n=>Ma(n)&&t instanceof n.WrappedComponent||!Ma(n)&&t instanceof n))}updatePanel(e){var t=A.getIdFromPanel(e);if(t==null){xt.error("updatePanel Panel did not have an ID",e);return}xt.debug2("Updating panel ID ".concat(t," in open panels map")),this.openedMap.delete(t),this.openedMap.set(t,e)}removePanel(e){var t=A.getIdFromPanel(e);if(t==null){xt.error("removePanel Panel did not have an ID",e);return}if(!this.openedMap.has(t)){xt.error("Missing panel ID ".concat(t," in open panels map"));return}if(this.openedMap.get(t)!==e){xt.debug("Panel argument doesn't match the open panels map entry for ".concat(t,", removePanel ignored"));return}xt.debug2("Removing panel ID ".concat(t," from open panels map")),this.openedMap.delete(t)}removeClosedPanelConfig(e){var t=this.closed.findIndex(n=>n===e||n.id!=null&&e.id!=null&&n.id===e.id);t>=0&&this.closed.splice(t,1)}handleFocus(e){xt.debug2("Focus: ",e),this.updatePanel(e)}handleMount(e){xt.debug2("Mount: ",e),this.updatePanel(e),this.sendUpdate()}handleUnmount(e){xt.debug2("Unmount: ",e),this.removePanel(e),this.sendUpdate()}handleReopen(e,t){xt.debug2("Reopen:",e,t),this.removeClosedPanelConfig(e);var{component:n}=e,{props:i}=e;i=this.hydrateComponent(n,i);var a=ud(ud({},e),{},{props:i}),{root:o}=this.layout;A.openComponent({root:o,config:a,replaceConfig:t})}handleDeleted(e){xt.debug2("Deleted:",e),this.removeClosedPanelConfig(e),this.sendUpdate()}handleClosed(e,t){xt.debug2("Closed: ",e),this.addClosedPanel(t),this.sendUpdate()}handleControlClose(e){var t={id:e},{root:n}=this.layout;A.closeComponent(n,t)}addClosedPanel(e){var t=A.getComponentConfigFromContainer(e);if(t&&Rr(t)){var n=this.dehydrateComponent(t.component,t);n!=null&&this.closed.push(n)}}sendUpdate(){var{closed:e,openedMap:t}=this;this.onPanelsUpdated({closed:[...e],openedMap:new Map(t)})}}Gn(Rs,"MAX_CLOSED_PANEL_COUNT",100);var yy=z.module("PanelErrorBoundary");class Sy extends b.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){this.setState({error:e})}componentWillUnmount(){var{glContainer:e,glEventHub:t}=this.props,n=A.getIdFromContainer(e);yy.debug("componentWillUnmount",n),t.emit(se.CLOSED,n,e)}render(){var{children:e}=this.props,{error:t}=this.state;return t!=null?h.jsx("div",{className:"panel-error-boundary",children:h.jsx(dn,{errorMessage:"".concat(t),isLoading:!1,isLoaded:!1})}):e}}function hd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ia(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hd(Object(t),!0).forEach(function(n){wy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function wy(r,e,t){return e=Ey(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ey(r){var e=Py(r,"string");return typeof e=="symbol"?e:String(e)}function Py(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Ls(r){var{props:e,componentState:t}=r,{metadata:n}=e,{panelState:i=null}=e;t&&({panelState:i}=t);var a={};return n!=null&&(a.metadata=n),i!=null&&(a.panelState=i),Ia(Ia({},r),{},{componentState:null,props:a,type:"react-component"})}function As(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return Ia(Ia({},r),{},{localDashboardId:e})}function Tc(r){var e=Ma(r)&&r.WrappedComponent.prototype!=null&&r.WrappedComponent.prototype.isReactComponent!=null||r.prototype!=null&&r.prototype.isReactComponent!=null,t=!Ma(r)&&"$$typeof"in r&&r.$$typeof===Cf.ForwardRef;return e||t}const Ty={dehydrate:Ls,hydrate:As};var _y=Z.createContext(void 0),Oy=O.shape({on:O.func,off:O.func,isHidden:O.bool,tab:O.shape({header:O.shape({tabs:O.arrayOf(O.shape({contentItem:O.shape({})}))})}),title:O.string,setTitle:O.func,close:O.func}),_c=O.shape({on:O.func,off:O.func,emit:O.func}),Dy=O.shape({registerComponent:O.func,root:O.shape({addChild:O.func}),on:O.func,off:O.func,eventHub:_c}),ks=Object.freeze({Container:Oy,EventHub:_c,Layout:Dy});function Pe(r,e,t){b.useEffect(function(){return r.on(e,t),()=>{r.off(e,t)}},[r,e,t])}function si(r,e,t,n){var i,a=(i=e.COMPONENT)!==null&&i!==void 0?i:e.displayName;if(a==null)throw new Error("ComponentType must have a `COMPONENT` or `displayName` attribute.");Z.useEffect(()=>{var o=r(a,e,t,n);return()=>{o()}},[e,n,t,a,r])}function cd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function My(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cd(Object(t),!0).forEach(function(n){Iy(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):cd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Iy(r,e,t){return e=Ny(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ny(r){var e=xy(r,"string");return typeof e=="symbol"?e:String(e)}function xy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Fy=Object.freeze({}),Ry=new Map,Oc=r=>r.api,Ly=r=>r.user,Dc=r=>r.storage,Mc=r=>Dc(r).commandHistoryStorage,Ic=r=>Dc(r).fileStorage,Ay=r=>r.defaultWorkspaceSettings,Nc=r=>{var{workspace:e}=r;return e},Ui=r=>{for(var e=Nc(r).data.settings,t=My({},Ay(r)),n=Object.keys(e),i=0;i<n.length;i+=1){var a=n[i];e[a]!==void 0&&(t[a]=e[a])}return t},js=r=>Ui(r).timeZone,ky=r=>{var e;return(e=Ui(r).defaultNotebookSettings)!==null&&e!==void 0?e:Fy},$s=r=>r.activeTool,jy=r=>{var e;return(e=r.plugins)!==null&&e!==void 0?e:Ry},xc="SET_ACTIVE_TOOL",$y="SET_API",Hy="SET_COMMAND_HISTORY_STORAGE",Vy="SET_FILE_STORAGE",Uy="SET_PLUGINS",By="SET_USER",Fc="SET_WORKSPACE",Wy="SET_DEFAULT_WORKSPACE_SETTINGS",Gy="SET_WORKSPACE_STORAGE",zy="SET_SERVER_CONFIG_VALUES";function md(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function rr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?md(Object(t),!0).forEach(function(n){Ky(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):md(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ky(r,e,t){return e=qy(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qy(r){var e=Xy(r,"string");return typeof e=="symbol"?e:String(e)}function Xy(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Zy=r=>({type:Fc,payload:r}),Yy=r=>(e,t)=>{e(Zy(r));var{storage:n}=t(),{workspaceStorage:i}=n;return i.save(r)},Qy=r=>(e,t)=>{var{workspace:n}=t(),{data:i}=n,a=rr(rr({},n),{},{data:rr(rr(rr({},i),r),{},{settings:rr(rr({},i.settings),r.settings)})});return e(Yy(a))},Jy=r=>e=>e(Qy({settings:r})),Rc=r=>({type:xc,payload:r});function fd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function wo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fd(Object(t),!0).forEach(function(n){eS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function eS(r,e,t){return e=tS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tS(r){var e=nS(r,"string");return typeof e=="symbol"?e:String(e)}function nS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Lc(r,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case r:{var i=n.payload;return i==null?null:t!=null?wo(wo({},t),i):wo({},i)}default:return t}}}function vd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vd(Object(t),!0).forEach(function(n){rS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function rS(r,e,t){return e=iS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function iS(r){var e=aS(r,"string");return typeof e=="symbol"?e:String(e)}function aS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function oS(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,i=arguments.length>1?arguments[1]:void 0;switch(i.type){case r:{var{id:a,payload:o}=i;return t&&mr({payload:o},{payload:n[a]})?n:pd(pd({},n),{},{[a]:o})}default:return n}}}function Jn(r,e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:e,n=arguments.length>1?arguments[1]:void 0;switch(n.type){case r:return n.payload;default:return t}}}const sS=Jn($y,null),lS=Jn(xc,null),dS=Jn(Uy,null),uS=Jn(Hy,null),hS=Jn(Vy,null),cS=Jn(Gy,null),mS=ls({commandHistoryStorage:uS,fileStorage:hS,workspaceStorage:cS}),fS=Lc(By,null),vS=Lc(Fc,null),pS=Jn(Wy,null),gS=Jn(zy,null);var bS={activeTool:lS,api:sS,plugins:dS,storage:mS,user:fS,workspace:vS,defaultWorkspaceSettings:pS,serverConfigValues:gS};const CS=bS;function gd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function bd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gd(Object(t),!0).forEach(function(n){zo(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):gd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function zo(r,e,t){return e=yS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yS(r){var e=SS(r,"string");return typeof e=="symbol"?e:String(e)}function SS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class wS{constructor(){zo(this,"reducers",{}),zo(this,"listener",null)}register(e,t){var n;this.reducers=bd(bd({},this.reducers),{},{[e]:t}),(n=this.listener)===null||n===void 0||n.call(this,this.reducers)}setListener(e){this.listener=e}}var ES=new wS;const Za=ES;var Cd=z.module("redux-logger"),PS=r=>e=>t=>{Cd.debug("dispatching",t);var n=e(t);return Cd.debug("next state",r.getState()),n};const TS=PS;var _S=z.module("redux-crashReporter"),OS=r=>e=>t=>{try{return e(t)}catch(n){throw _S.error("Error executing",t," with state ",r.getState(),":",n),n}};const DS=OS,MS=[TS,DS,yf];var Eo;Object.entries(CS).map(r=>{var[e,t]=r;return Za.register(e,t)});var IS=(Eo=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__)!==null&&Eo!==void 0?Eo:Ef,Ac=Sf(ls(Za.reducers),IS(wf(...MS)));Za.setListener(r=>{Ac.replaceReducer(ls(r))});const NS=Ac;var kc="SET_DASHBOARD_DATA";const xS=oS(kc,{},!1),FS={dashboardData:xS};var RS=new Map,jc=Object.freeze({}),LS=Object.freeze([]),AS=r=>r.dashboardData,st=(r,e)=>{var t;return(t=AS(r)[e])!==null&&t!==void 0?t:jc},kS=(r,e)=>{var t;return(t=st(r,e).closed)!==null&&t!==void 0?t:LS},$c=(r,e)=>{var t;return(t=st(r,e).openedMap)!==null&&t!==void 0?t:RS},Hc=(r,e)=>{var t;return(t=st(r,e).pluginDataMap)!==null&&t!==void 0?t:jc},oM=(r,e,t)=>Hc(r,e)[t];function yd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Lr(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?yd(Object(t),!0).forEach(function(n){jS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):yd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function jS(r,e,t){return e=$S(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $S(r){var e=HS(r,"string");return typeof e=="symbol"?e:String(e)}function HS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Vc=(r,e)=>({type:kc,id:r,payload:e}),Dn=(r,e)=>(t,n)=>t(Vc(r,Lr(Lr({},st(n(),r)),e))),sM=(r,e,t)=>(n,i)=>n(Vc(r,Lr(Lr({},st(i(),r)),{},{pluginDataMap:Lr(Lr({},Hc(i(),r)),{},{[e]:t})})));Object.entries(FS).map(r=>{var[e,t]=r;return Za.register(e,t)});function VS(r){var{children:e}=r;return h.jsx(h.Fragment,{children:e})}function Sd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function li(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sd(Object(t),!0).forEach(function(n){US(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Sd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function US(r,e,t){return e=BS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function BS(r){var e=WS(r,"string");return typeof e=="symbol"?e:String(e)}function WS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ia=z.module("DashboardLayout"),GS=Object.freeze({}),zS=[],wd=()=>{},Ed=r=>r;function KS(r){var e,t,{id:n,children:i,emptyDashboard:a=h.jsx("div",{children:"Dashboard is empty."}),layout:o,layoutConfig:s=zS,onLayoutChange:l=wd,onLayoutInitialized:d=wd,hydrate:u=As,dehydrate:c=Ls,panelWrapper:m=VS}=r,f=ds(),g=(e=Pf(R=>st(R,n)))!==null&&e!==void 0?e:GS,[v,p]=b.useState(!1),[C,S]=b.useState(!1),[y,w]=b.useState(),[E]=b.useState((t=g==null?void 0:g.closed)!==null&&t!==void 0?t:[]),[D,M]=b.useState(!1),[_,T]=b.useState(o.getReactChildren()),N=b.useMemo(()=>new Map,[]),x=b.useMemo(()=>new Map,[]),F=b.useCallback(function(R,$){var G,te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:u,Me=arguments.length>3&&arguments[3]!==void 0?arguments[3]:c;ia.debug2("registerComponent",R,$,te,Me);function V(de,Ee){var Le=$,ni=m,wr=Tc(Le),{glContainer:ri,glEventHub:nr}=de;return h.jsx(Sy,{glContainer:ri,glEventHub:nr,children:h.jsx(ni,li(li({},de),{},{children:wr?h.jsx(Le,li(li({},de),{},{ref:Ee})):h.jsx(Le,li({},de))}))})}V.displayName="DashboardWrapper(".concat((G=$.displayName)!==null&&G!==void 0?G:R,")");var ne=o.registerComponent(R,Z.forwardRef(V));return N.set(R,te),x.set(R,Me),ne},[u,c,N,x,o,m]),k=b.useCallback((R,$)=>{var G;return((G=N.get(R))!==null&&G!==void 0?G:Ed)($,n)},[N,n]),U=b.useCallback((R,$)=>{var G;return((G=x.get(R))!==null&&G!==void 0?G:Ed)($,n)},[x,n]),H=b.useMemo(()=>new Rs(o,k,U,new Map,E,R=>{var{closed:$,openedMap:G}=R;f(Dn(n,{closed:$,openedMap:G}))}),[U,f,k,n,E,o]),W=b.useCallback(()=>{if(!C){D||(d(),M(!0));var R=o.toConfig(),$=R.content,G=A.dehydrateLayoutConfig($,U),te=y==null||!A.isEqual(y,G);ia.debug("handleLayoutStateChanged",te,$,G),te&&(p(o.root.contentItems.length===0),w(G),l(G),T(o.getReactChildren()))}},[U,D,C,y,o,l,d]),X=b.useCallback(R=>{var $=A.getIdFromContainer(R);o.eventHub.emit(se.DRAGGING,$),S(!0)},[o.eventHub]),le=b.useCallback(R=>{var $=A.getIdFromContainer(R);o.eventHub.emit(se.DROPPED,$),S(!1)},[o.eventHub]),me=b.useCallback(R=>{if(ia.debug2("handleComponentCreated",R),!(R==null||R.config==null||R.config.component==null||R.element==null)){var $=R.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),G="".concat($,"-component");R.element.addClass(G)}},[]),ve=b.useCallback(()=>{T(o.getReactChildren())},[o]);Pe(o,"stateChanged",W),Pe(o,"itemPickedUp",X),Pe(o,"itemDropped",le),Pe(o,"componentCreated",me),Pe(o.eventHub,se.TITLE_CHANGED,W),Pe(o,"reactChildrenChanged",ve);var j=dp(s);return b.useEffect(function(){if(j!==s&&s!==y){ia.debug("Setting new layout content...");for(var $=A.hydrateLayoutConfig(s,k);o.root.contentItems.length>0;)o.root.contentItems[0].remove();for(var G=0;G<$.length;G+=1)o.root.addChild($[G]);p(o.root.contentItems.length===0)}},[k,o,s,y,H,j]),h.jsxs(h.Fragment,{children:[v&&a,_,Z.Children.map(i,R=>R!=null?Z.cloneElement(R,{id:n,layout:o,panelManager:H,registerComponent:F}):null)]})}KS.propTypes={id:O.string.isRequired,children:O.node,data:O.shape({}),emptyDashboard:O.node,layout:ks.Layout.isRequired,layoutConfig:O.arrayOf(O.shape({})),onLayoutChange:O.func,onLayoutInitialized:O.func};var qS="default";function Pd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function XS(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Pd(Object(t),!0).forEach(function(n){ZS(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Pd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function ZS(r,e,t){return e=YS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function YS(r){var e=QS(r,"string");return typeof e=="symbol"?e:String(e)}function QS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var JS=b.lazy(()=>Ai(()=>import("./IrisGrid-e6345e8d.js"),["./IrisGrid-e6345e8d.js","./vendor-3c001961.js","./helpers-de833af9.js","./vendor-a4479904.css","./index-4a9bfe03.js","./index-7535fde1.css","./usePlugins-a4e842f0.js","./IrisGridThemeProvider-5b2515b0.js","./IrisGridThemeProvider-ed25ee73.css","./IrisGrid-6e937433.css"],import.meta.url)),Uc=b.forwardRef((r,e)=>h.jsx(b.Suspense,{fallback:h.jsx(dn,{}),children:h.jsx(JS,XS({ref:e},r))}));Uc.displayName="LazyIrisGrid";const Ya=Uc;var Ko;(function(r){r.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS="filter-control-change-clears-all-filters",r.LINK_CHANGE_CLEARS_ALL_FILTERS="link-change-clears-all-filters"})(Ko||(Ko={}));const Td=Ko;var ew=Object.freeze([[Td.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS,!1],[Td.LINK_CHANGE_CLEARS_ALL_FILTERS,!1]]);const Bc={DEFAULTS:ew};var qo;(function(r){r.COUNT="Count",r.MIN="Min",r.MAX="Max",r.SUM="Sum",r.ABS_SUM="AbsSum",r.VAR="Var",r.AVG="Avg",r.STD="Std",r.FIRST="First",r.LAST="Last",r.SKIP="Skip",r.COUNT_DISTINCT="CountDistinct",r.DISTINCT="Distinct",r.UNIQUE="Unique"})(qo||(qo={}));const be=qo;var lM=[be.SUM,be.ABS_SUM,be.MIN,be.MAX,be.VAR,be.AVG,be.STD,be.FIRST,be.LAST,be.COUNT_DISTINCT,be.DISTINCT,be.COUNT,be.UNIQUE],tw=r=>{switch(r){default:return!1}},nw=(r,e)=>{switch(r){case be.COUNT:case be.FIRST:case be.LAST:case be.COUNT_DISTINCT:case be.DISTINCT:case be.UNIQUE:return!0;case be.MIN:case be.MAX:return P.isNumberType(e)||P.isDateType(e)||P.isTextType(e);case be.SUM:case be.ABS_SUM:case be.VAR:case be.AVG:case be.STD:return P.isNumberType(e);case be.SKIP:return!1}},Wc=(r,e)=>r.filter(t=>t.isProxy!==!0&&nw(e,t.type)),rw=(r,e,t,n)=>Wc(r,e).map(i=>{var{name:a}=i;return a}).filter(i=>t.includes(i)?!n:n);const _d={isRollupOperation:tw,filterValidColumns:Wc,getOperationColumnNames:rw};function iw(r,e,t){return e=aw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function aw(r){var e=ow(r,"string");return typeof e=="symbol"?e:String(e)}function ow(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class sw extends Error{constructor(){super(...arguments),iw(this,"isAssertionFailed",!0)}}const lw=sw;function Hn(r){return(r==null?void 0:r.isEditable)!==void 0}function dM(r){if(!Hn(r))throw new lw("Expected 'model' to be editable, but received ".concat(r))}function yn(r){return(r==null?void 0:r.hasExpandableRows)!==void 0}function vi(r,e,t){return e=dw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dw(r){var e=uw(r,"string");return typeof e=="symbol"?e:String(e)}function uw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Xo;(function(r){r.DOWN="DOWN",r.UP="UP",r.LEFT="LEFT",r.RIGHT="RIGHT"})(Xo||(Xo={}));class B{static normalize(e,t,n,i){var a=e,o=t,s=n,l=i;return a!=null&&s!=null&&s<a&&(a=s,s=e),o!=null&&l!=null&&l<o&&(o=l,l=t),[a,o,s,l]}static makeNormalized(e,t,n,i){return new B(...B.normalize(e,t,n,i))}static makeCell(e,t){return new B(e,t,e,t)}static makeColumn(e){return new B(e,null,e,null)}static makeRow(e){return new B(null,e,null,e)}static minOrNull(e,t){return e==null||t==null?null:Math.min(e,t)}static maxOrNull(e,t){return e==null||t==null?null:Math.max(e,t)}static consolidate(e){for(var t=e.slice(),n=!0;n;){n=!1;for(var i=0;i<t.length&&!n;i+=1)for(var a=t[i],o=t.length-1;o>i;o-=1){var s=t[o];if(a.contains(s))t.splice(o,1);else if(s.contains(a)){n=!0,t[i]=s,t.splice(o,1);break}else if(a.startRow===s.startRow&&a.endRow===s.endRow){if(a.touches(s)){var{startRow:l,endRow:d}=a,u=B.minOrNull(a.startColumn,s.startColumn),c=B.maxOrNull(a.endColumn,s.endColumn);n=!0,t[i]=new B(u,l,c,d),t.splice(o,1);break}}else if(a.startColumn===s.startColumn&&a.endColumn===s.endColumn&&a.touches(s)){var{startColumn:m,endColumn:f}=a,g=B.minOrNull(a.startRow,s.startRow),v=B.maxOrNull(a.endRow,s.endRow);n=!0,t[i]=new B(m,g,f,v),t.splice(o,1);break}}}return t}static isAxisRangeTouching(e,t,n,i){return e==null?t==null||n==null?!0:n<=t+1:t==null?i==null?!0:i>=e-1:n==null?i==null?!0:e<=i+1:i==null?t>=n-1:n>=e-1?n<=t+1:i>=e-1}static rangeArraysEqual(e,t){if(e===t)return!0;if(e==null||t==null||e.length!==t.length)return!1;for(var n=0;n<e.length;n+=1)if(!e[n].equals(t[n]))return!1;return!0}static intersection(e,t){var n,i,a,o,s,l;if(e.equals(t))return e;var{startColumn:d,startRow:u,endColumn:c,endRow:m}=e;return d=d!=null&&t.startColumn!=null?Math.max(d,t.startColumn):(n=d)!==null&&n!==void 0?n:t.startColumn,c=c!=null&&t.endColumn!=null?Math.min(c,t.endColumn):(i=c)!==null&&i!==void 0?i:t.endColumn,u=u!=null&&t.startRow!=null?Math.max(u,t.startRow):(a=u)!==null&&a!==void 0?a:t.startRow,m=m!=null&&t.endRow!=null?Math.min(m,t.endRow):(o=m)!==null&&o!==void 0?o:t.endRow,d!=null&&d>((s=c)!==null&&s!==void 0?s:-1)||u!=null&&u>((l=m)!==null&&l!==void 0?l:-1)?null:new B(d,u,c,m)}static subtractFromRange(e,t){var n=[],i=B.intersection(e,t);return i==null?[e]:(i.startRow!=null&&(e.startRow==null||e.startRow<i.startRow)&&n.push(new B(e.startColumn,e.startRow,e.endColumn,i.startRow-1)),i.startColumn!=null&&(e.startColumn==null||e.startColumn<i.startColumn)&&n.push(new B(e.startColumn,i.startRow,i.startColumn-1,i.endRow)),i.endColumn!=null&&(e.endColumn==null||e.endColumn>i.endColumn)&&n.push(new B(i.endColumn+1,i.startRow,e.endColumn,i.endRow)),i.endRow!=null&&(e.endRow==null||e.endRow>i.endRow)&&n.push(new B(e.startColumn,i.endRow+1,e.endColumn,e.endRow)),n)}static subtractFromRanges(e,t){for(var n=[],i=0;i<e.length;i+=1)n.push(...B.subtractFromRange(e[i],t));return n}static subtractRangesFromRanges(e,t){for(var n=[...e],i=0;i<t.length;i+=1)n=B.subtractFromRanges(n,t[i]);return n}static isBounded(e){return e.startRow!=null&&e.startColumn!=null&&e.endRow!=null&&e.endColumn!=null}static boundedRange(e,t,n){var i,a,o,s;return B.isBounded(e)?e:new B((i=e.startColumn)!==null&&i!==void 0?i:0,(a=e.startRow)!==null&&a!==void 0?a:0,(o=e.endColumn)!==null&&o!==void 0?o:t-1,(s=e.endRow)!==null&&s!==void 0?s:n-1)}static boundedRanges(e,t,n){return e.map(i=>B.boundedRange(i,t,n))}static offset(e,t,n){return new B(e.startColumn!=null?e.startColumn+t:null,e.startRow!=null?e.startRow+n:null,e.endColumn!=null?e.endColumn+t:null,e.endRow!=null?e.endRow+n:null)}static nextCell(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:B.SELECTION_DIRECTION.DOWN;if(e.length===0)return null;var a=-1;if(t!=null&&n!=null&&(a=e.findIndex(m=>m.containsCell(t,n)),a>=0)){var o=e[a],s=o.nextCell(t,n,i);if(s!=null)return s}switch(i){case B.SELECTION_DIRECTION.DOWN:case B.SELECTION_DIRECTION.RIGHT:{var l=a<e.length-1?a+1:0,d=e[l];return d.startCell(i)}case B.SELECTION_DIRECTION.LEFT:case B.SELECTION_DIRECTION.UP:{var u=a>0?a-1:e.length-1,c=e[u];return c.startCell(i)}default:throw new Error("Invalid direction: ".concat(i))}}static cellCount(e){return e.reduce((t,n)=>{var i,a,o,s;return t+(((i=n.endRow)!==null&&i!==void 0?i:NaN)-((a=n.startRow)!==null&&a!==void 0?a:NaN)+1)*(((o=n.endColumn)!==null&&o!==void 0?o:NaN)-((s=n.startColumn)!==null&&s!==void 0?s:NaN)+1)},0)}static rowCount(e){return e.reduce((t,n)=>{var i,a;return t+((i=n.endRow)!==null&&i!==void 0?i:NaN)-((a=n.startRow)!==null&&a!==void 0?a:NaN)+1},0)}static columnCount(e){return e.reduce((t,n)=>{var i,a;return t+((i=n.endColumn)!==null&&i!==void 0?i:NaN)-((a=n.startColumn)!==null&&a!==void 0?a:NaN)+1},0)}static containsCell(e,t,n){for(var i=0;i<e.length;i+=1){var a=e[i];if(a.containsCell(t,n))return!0}return!1}static forEachCell(e,t){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:B.SELECTION_DIRECTION.RIGHT,i=0;i<e.length;i+=1)e[i].forEach(t,n)}constructor(e,t,n,i){vi(this,"startColumn",void 0),vi(this,"startRow",void 0),vi(this,"endColumn",void 0),vi(this,"endRow",void 0),this.startColumn=e,this.startRow=t,this.endColumn=n,this.endRow=i}equals(e){return this.startColumn===e.startColumn&&this.startRow===e.startRow&&this.endColumn===e.endColumn&&this.endRow===e.endRow}contains(e){return(this.startColumn==null||e.startColumn!=null&&this.startColumn<=e.startColumn)&&(this.startRow==null||e.startRow!=null&&this.startRow<=e.startRow)&&(this.endColumn==null||e.endColumn!=null&&this.endColumn>=e.endColumn)&&(this.endRow==null||e.endRow!=null&&this.endRow>=e.endRow)}containsCell(e,t){return e==null||t==null?!1:(this.startColumn==null||this.startColumn<=e)&&(this.endColumn==null||this.endColumn>=e)&&(this.startRow==null||this.startRow<=t)&&(this.endRow==null||this.endRow>=t)}touches(e){return B.isAxisRangeTouching(this.startRow,this.endRow,e.startRow,e.endRow)&&B.isAxisRangeTouching(this.startColumn,this.endColumn,e.startColumn,e.endColumn)}subtract(e){return B.subtractFromRange(this,e)}startCell(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B.SELECTION_DIRECTION.DOWN;if(!B.isBounded(this))throw new Error("Cannot get the startCell of an unbounded range");switch(e){case B.SELECTION_DIRECTION.DOWN:case B.SELECTION_DIRECTION.RIGHT:return{column:this.startColumn,row:this.startRow};case B.SELECTION_DIRECTION.LEFT:case B.SELECTION_DIRECTION.UP:return{column:this.endColumn,row:this.endRow};default:throw new Error("Invalid direction: ".concat(e))}}nextCell(e,t,n){if(!B.isBounded(this))throw new Error("Bounded range required");if(e==null||t==null)throw new Error("Require a non-null cursor");var{startColumn:i,endColumn:a,startRow:o,endRow:s}=this;switch(n){case B.SELECTION_DIRECTION.DOWN:if(t<s)return{column:e,row:Math.max(t+1,o)};if(e<a)return{column:Math.max(e+1,i),row:o};break;case B.SELECTION_DIRECTION.UP:if(t>o)return{column:e,row:Math.min(t-1,s)};if(e>i)return{column:Math.min(e-1,a),row:s};break;case B.SELECTION_DIRECTION.RIGHT:if(e<a)return{column:Math.max(e+1,i),row:t};if(t<s)return{column:i,row:Math.max(t+1,o)};break;case B.SELECTION_DIRECTION.LEFT:if(e>i)return{column:Math.min(e-1,a),row:t};if(t>o)return{column:a,row:Math.min(t-1,s)};break;default:throw new Error("Invalid direction: ".concat(n))}return null}forEach(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:B.SELECTION_DIRECTION.RIGHT,n=0,{column:i,row:a}=this.startCell(t);i!=null&&a!=null;){var o;e(i,a,n),n+=1,{column:i,row:a}=(o=this.nextCell(i,a,t))!==null&&o!==void 0?o:{}}}}vi(B,"SELECTION_DIRECTION",Xo);function hw(r){return Array.isArray(r)&&r.length===2&&(r[0]===null||typeof r[0]=="number")&&(r[1]===null||typeof r[1]=="number")}function aa(r){return hw(r)&&r[0]!=null&&r[1]!=null}function Od(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function oa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Od(Object(t),!0).forEach(function(n){Gc(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Od(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Gc(r,e,t){return e=cw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cw(r){var e=mw(r,"string");return typeof e=="symbol"?e:String(e)}function mw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function uM(r){return(r==null?void 0:r.href)!==void 0}class ee{static getGridPointFromXY(e,t,n){var i=ee.getColumnAtX(e,n),a=ee.getRowAtY(t,n),o=ee.getColumnHeaderDepthAtY(t,n);return{x:e,y:t,row:a,column:i,columnHeaderDepth:o}}static getCellInfoFromXY(e,t,n){var{row:i,column:a}=ee.getGridPointFromXY(e,t,n),{allColumnWidths:o,allRowHeights:s,allColumnXs:l,allRowYs:d,modelColumns:u,modelRows:c}=n,m=i!==null?c.get(i):null,f=a!==null?u.get(a):null,g=a!==null?l.get(a):null,v=i!==null?d.get(i):null,p=a!==null?o.get(a):null,C=i!==null?s.get(i):null;return{row:i,column:a,modelRow:m??null,modelColumn:f??null,left:g??null,top:v??null,columnWidth:p??null,rowHeight:C??null}}static getColumnHeaderDepthAtY(e,t){var n=ee.getRowAtY(e,t),{columnHeaderHeight:i,columnHeaderMaxDepth:a}=t;if(n===null&&e<=i*a)return Kt(a-Math.ceil(e/i),0,a-1)}static iterateFloatingStart(e,t,n){for(var i=0;i<e&&i<t;i+=1){var a=n(i);if(a!==void 0)return a}}static iterateFloatingEnd(e,t,n){for(var i=0;i<e&&t-(e-i)>=0;i+=1){var a=n(t-(e-i));if(a!==void 0)return a}}static iterateFloating(e,t,n,i){var a=ee.iterateFloatingStart(e,n,i);return a!==void 0?a:ee.iterateFloatingEnd(t,n,i)}static iterateAllItems(e,t,n,i,a,o){var s=Math.max(e,n),l=Math.min(t,a-i-1),d=ee.iterateFloating(n,i,a,o);if(d!==void 0)return d;for(var u=s;u<=l;u+=1)if(d=o(u),d!==void 0)return d}static isInItem(e,t,n,i){var a,o,s=(a=t.get(e))!==null&&a!==void 0?a:0,l=(o=n.get(e))!==null&&o!==void 0?o:0;return s<=i&&i<=s+l}static getItemAtOffset(e,t,n,i,a,o,s){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,d=l?void 0:ee.iterateFloating(n,i,t,m=>{if(ee.isInItem(m,o,s,e))return m});if(!l&&d!==void 0)return d;for(var u=0;u<a.length;u+=1){var c=a[u];if(ee.isInItem(c,o,s,e))return c}return null}static getColumnAtX(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,{columnCount:i,floatingLeftColumnCount:a,floatingRightColumnCount:o,visibleColumns:s,allColumnXs:l,allColumnWidths:d,gridX:u}=t;return e<u?null:this.getItemAtOffset(e-u,i,a,o,s,l,d,n)}static getRowAtY(e,t){var{floatingTopRowCount:n,floatingBottomRowCount:i,rowCount:a,visibleRows:o,allRowYs:s,allRowHeights:l,gridY:d}=t;return e<d?null:this.getItemAtOffset(e-d,a,n,i,o,s,l)}static getNextShownItem(e,t,n,i){var a=n.findIndex(l=>l===e)||0;for(a-=1;a!=null&&a>=0;){var o=n[a],s=t.get(o);if(s!=null&&i.get(s)!==0)return o;a-=1}return null}static getNextShownColumn(e,t){var{modelColumns:n,visibleColumns:i,userColumnWidths:a}=t;return ee.getNextShownItem(e,n,i,a)}static getNextShownRow(e,t){var{modelRows:n,visibleRows:i,userRowHeights:a}=t;return ee.getNextShownItem(e,n,i,a)}static getColumnSeparatorIndex(e,t,n,i){var{rowHeaderWidth:a,columnHeaderHeight:o,floatingColumns:s,floatingLeftWidth:l,visibleColumns:d,allColumnXs:u,allColumnWidths:c,columnHeaderMaxDepth:m}=n,{allowColumnResize:f,headerSeparatorHandleSize:g}=i;if(m*o<t||!f||g<=0)return null;for(var v=e-a,p=g*.5,C=!1,S=s.length-1;S>=0;S-=1){var y,w,E=s[S],D=(y=u.get(E))!==null&&y!==void 0?y:0,M=(w=c.get(E))!==null&&w!==void 0?w:0,_=M===0;if(!C||!_){var T=D+M;_?T+=p:C&&(T-=p);var N=T-p,x=T+p;if(N<=v&&v<=x)return E;C=_}}C=!1;for(var F=d.length-1;F>=0;F-=1){var k,U,H=d[F],W=(k=u.get(H))!==null&&k!==void 0?k:0,X=(U=c.get(H))!==null&&U!==void 0?U:0,le=X===0;if(W<l-X)return null;if(!C||!le){var me=W+X;le?me+=p:C&&(me-=p);var ve=me-p,j=me+p;if(ve<=v&&v<=j)return H;C=le}}return null}static isItemHidden(e,t){return t.get(e)===0}static isColumnHidden(e,t){var{allColumnWidths:n}=t;return ee.isItemHidden(e,n)}static isFloatingRow(e,t){if(e==null)return!1;var{floatingTopRowCount:n,floatingBottomRowCount:i,rowCount:a}=t;return e<n||e>=a-i}static isFloatingColumn(e,t){if(e==null)return!1;var{floatingLeftColumnCount:n,floatingRightColumnCount:i,columnCount:a}=t;return e<n||e>=a-i}static getHiddenItems(e,t,n){if(!ee.isItemHidden(e,t))return[];for(var i=[e],a=n.findIndex(l=>l===e),o=a-1;o>=0;o-=1){var s=n[o];if(!ee.isItemHidden(s,t))break;i.push(s)}return i}static getHiddenColumns(e,t){var{visibleColumns:n,allColumnWidths:i}=t;return ee.getHiddenItems(e,i,n)}static getRowSeparatorIndex(e,t,n,i){var{rowHeaderWidth:a,columnHeaderHeight:o,visibleRows:s,allRowYs:l,allRowHeights:d}=n,{allowRowResize:u,headerSeparatorHandleSize:c}=i;if(a<e||!u||c<=0)return null;for(var m=t-o,f=c*.5,g=!1,v=s.length-1;v>=0;v-=1){var p,C,S=s[v],y=(p=l.get(S))!==null&&p!==void 0?p:0,w=(C=d.get(S))!==null&&C!==void 0?C:0,E=w===0;if(!g||!E){var D=y+w;E?D+=f:g&&(D-=f);var M=D-f,_=D+f;if(M<=m&&m<=_)return S;g=E}}return null}static isRowHidden(e,t){var{allRowHeights:n}=t;return ee.isItemHidden(e,n)}static getHiddenRows(e,t){var{visibleRows:n,allRowHeights:i}=t;return ee.getHiddenItems(e,i,n)}static moveItem(e,t,n){if(e===t)return[...n];var i=[...n],a=i[i.length-1];return a!=null&&!aa(a.from)&&a.to===e?a.from===t?i.pop():i[i.length-1]=oa(oa({},a),{},{to:t}):i.push({from:e,to:t}),i}static moveRange(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e[0]===e[1])return ee.moveItem(e[0],t,n);var a=t;if(i&&e[0]<t&&(a-=e[1]-e[0]),e[0]===a)return[...n];var o=[...n],s=o[o.length-1];s!=null&&aa(s.from)&&s.from[1]-s.from[0]===e[1]-e[0]&&s.to===e[0]?o[o.length-1]=oa(oa({},s),{},{to:a}):o.push({from:e,to:a});var l=o[o.length-1];return aa(l.from)&&l.from[0]===l.to&&o.pop(),o}static moveItemOrRange(e,t,n){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;return Array.isArray(e)?ee.moveRange(e,t,n,i):ee.moveItem(e,t,n)}static applyItemMoves(e,t,n){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,a=[[e,t]],o=function(){var{from:d,to:u}=n[s],c=1,m;aa(d)?(c=d[1]-d[0]+1,[m]=d):m=d;for(var f=i?u:m,g=f+c-1,v=i?m:u,p=v-f,C=[],S=function(){var E,D,M=(E=a[y][0])!==null&&E!==void 0?E:Number.NEGATIVE_INFINITY,_=(D=a[y][1])!==null&&D!==void 0?D:Number.POSITIVE_INFINITY,T,N=[[M,f-1],[f,g],[g+1,_]].map(x=>{var[F,k]=x;return[Math.max(F,M),Math.min(k,_)]}).filter(x=>{var[F,k]=x;return F<=k}).map(x=>{var[F,k]=x;return f<=F&&g>=k?(T=[F+p,k+p],T):g<F?[F-c,k-c]:x}).map(x=>{var[F,k]=x;return v>F&&v<=k?[[F,v-1],[v+c,k+c]]:x===T?[x]:v<=F?[[F+c,k+c]]:[x]}).flat();C.push(...N)},y=0;y<a.length;y+=1)S();a=C.map(w=>{var[E,D]=w;return[Number.isFinite(E)?E:null,Number.isFinite(D)?D:null]})},s=i?n.length-1:0;i?s>=0:s<n.length;i?s-=1:s+=1)o();return a}static translateRange(e,t,n,i){for(var a=ee.applyItemMoves(e.startColumn,e.endColumn,t,i),o=ee.applyItemMoves(e.startRow,e.endRow,n,i),s=[],l=0;l<a.length;l+=1)for(var d=a[l],u=0;u<o.length;u+=1){var c=o[u];s.push(new B(d[0],c[0],d[1],c[1]))}return s}static getModelIndex(e,t){var n=ee.applyItemMoves(e,e,t,!0)[0][0];return n}static getModelIndexes(e,t){return e.map(n=>ee.getModelIndex(n,t))}static getModelRangeIndexes(e,t,n){return ee.applyItemMoves(e,t,n,!0)}static getModelRange(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oe,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe;return ee.translateRange(e,t,n,!0)}static getModelRanges(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oe,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe,i=[],a=0;a<e.length;a+=1)i.push(...ee.getModelRange(e[a],t,n));return i}static getVisibleRangeIndexes(e,t,n){return ee.applyItemMoves(e,t,n,!1)}static getVisibleRange(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oe,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe;return this.translateRange(e,t,n,!1)}static getVisibleRanges(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oe,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe,i=[],a=0;a<e.length;a+=1)i.push(...ee.getVisibleRange(e[a],t,n));return i}static getVisibleIndex(e,t){var n=ee.applyItemMoves(e,e,t)[0][0];return n}static getVisibleIndexes(e,t){return e.map(n=>ee.getVisibleIndex(n,t))}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static getModifierKey(){return ee.isMacPlatform()?"metaKey":"ctrlKey"}static isModifierKeyDown(e){var t=ee.getModifierKey();return e[t]}static checkColumnHidden(e,t){return t.get(e)===0}static checkAllColumnsHidden(e,t){return t.size===0?!1:e.every(n=>t.get(n)===0)}static getScrollDragBounds(e,t,n){var{gridX:i,gridY:a,width:o,height:s,floatingTopRowCount:l,floatingBottomRowCount:d,floatingLeftColumnCount:u,floatingRightColumnCount:c,floatingLeftWidth:m,floatingRightWidth:f,floatingTopHeight:g,floatingBottomHeight:v,columnCount:p,rowCount:C}=e,S=i,y=a,w=o,E=s;return n!=null&&(n>u&&(S+=m),n<p-c&&(w-=f)),t!=null&&(t>l&&(y+=g),t<C-d&&(E-=v)),{x1:S,y1:y,x2:w,y2:E}}static getScrollDelta(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1024,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:768,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:20,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:20,{deltaX:o,deltaY:s}=e;return!ee.isMacPlatform()&&e.shiftKey&&e.deltaX===0&&e.deltaY!==0&&(o=e.deltaY,s=e.deltaX),(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_PAGE?(o*=t,s*=n):(e==null?void 0:e.deltaMode)===WheelEvent.DOM_DELTA_LINE&&(ee.isMacPlatform()?(o=Math.round(o*i),s=Math.round(s*a)):(o=Math.round(o*this.PIXELS_PER_LINE),s=Math.round(s*this.PIXELS_PER_LINE))),{deltaX:o,deltaY:s}}static compareRanges(e,t){return e[0]==null||e[1]==null||t[0]==null||t[1]==null?0:e[0]!==t[0]?e[0]-t[0]:e[1]-t[1]}static mergeSortedRanges(e){for(var t=[],n=0;n<e.length;n+=1){var i=e[n],a=i[0],o=i[1];n===0?t.push([a,o]):a-1<=t[t.length-1][1]?t[t.length-1][1]=Math.max(t[t.length-1][1],o):t.push([a,o])}return t}static translateTokenBox(e,t){var{x1:n,y1:i,x2:a,y2:o}=e,{gridX:s,gridY:l,width:d,height:u,verticalBarWidth:c,horizontalBarHeight:m}=t,f=Kt(s+n,s,d-c),g=Kt(s+a,s,d-c),v=Kt(l+i,l,u-m),p=Kt(l+o,l,u-m);return{x1:f,y1:v,x2:g,y2:p,token:e.token}}static getTextRenderMetrics(e,t,n){var{metrics:i,model:a,theme:o}=e,{firstColumn:s,allColumnXs:l,allColumnWidths:d,allRowYs:u,allRowHeights:c,modelRows:m,modelColumns:f}=i,{cellHorizontalPadding:g,treeDepthIndent:v,treeHorizontalPadding:p}=o,C=Er(m,n),S=Er(f,t),y=a.textAlignForCell(S,C),w=Er(l,t),E=Er(u,n),D=Er(d,t),M=Er(c,n),_=t===s,T=0;yn(a)&&a.hasExpandableRows&&_&&(T=v*(a.depthForRow(n)+1)+p);var N=D-T,x=w+g,F=E+M*.5;return y==="right"?x=w+N-g:y==="center"&&(x=w+N*.5),x+=T,{width:N-g*2,x,y:F}}static findTokensWithProtocolInText(e){var t=Ph(e);return t.filter(n=>n.type==="url"?/^https?:\/\//.test(n.value):!0)}}Gc(ee,"PIXELS_PER_LINE",100/3);const Dd=ee;function Md(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Id(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Md(Object(t),!0).forEach(function(n){fw(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Md(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function fw(r,e,t){return e=vw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function vw(r){var e=pw(r,"string");return typeof e=="symbol"?e:String(e)}function pw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var gw=(r,e)=>{var t=!1,n=qe(r,Id(Id({},e),{},{dispose:()=>{t||(t=!0,n.clear(),t=!1)}}));return n};const Zo=gw;function bw(r,e,t){return e=Cw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cw(r){var e=yw(r,"string");return typeof e=="symbol"?e:String(e)}function yw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Po=5e3;class Sw extends ss{constructor(){super(...arguments),bw(this,"getCachedTokensInText",Zo((e,t)=>{if(t>=e.length)return Dd.findTokensWithProtocolInText(e);var n=e.slice(t-1,Po).search(/\s/),i=t+n;n===-1&&(i=Math.min(Po,e.length));var a=e.substring(0,i);return Dd.findTokensWithProtocolInText(a)}))}get floatingTopRowCount(){return 0}get floatingBottomRowCount(){return 0}get floatingLeftColumnCount(){return 0}get floatingRightColumnCount(){return 0}get columnHeaderMaxDepth(){return 1}truncationCharForCell(e,t){}textAlignForCell(e,t){return"left"}colorForCell(e,t,n){return n.textColor}backgroundColorForCell(e,t,n){return null}colorForColumnHeader(e){return null}textForRowHeader(e){return""}textForRowFooter(e){return""}isColumnMovable(e){return!0}isRowMovable(e){return!0}getColumnHeaderGroup(e,t){}getColumnHeaderParentGroup(e,t){}tokensForCell(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Po,i=this.textForCell(e,t);return this.getCachedTokensInText(i,n)}renderTypeForCell(e,t){return"text"}}const ww=Sw;function Yo(r,e,t){return e=Ew(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ew(r){var e=Pw(r,"string");return typeof e=="symbol"?e:String(e)}function Pw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ir=[];class zc extends ww{constructor(e){super(),Yo(this,"dh",void 0),Yo(this,"listenerCount",void 0),this.dh=e,this.listenerCount=0}addEventListener(e,t,n){super.addEventListener(e,t,n),this.listenerCount+=1,this.listenerCount===1&&this.startListening()}removeEventListener(e,t,n){super.removeEventListener(e,t,n),this.listenerCount-=1,this.listenerCount===0&&this.stopListening()}startListening(){}stopListening(){}get groupedColumns(){return ir}get originalColumns(){return this.columns}sourceForCell(e,t){return{column:e,row:t}}getClearFilterRange(e){return this.isFilterable(e)?[e,e]:null}get initialMovedColumns(){return ir}get initialMovedRows(){return ir}get initialColumnHeaderGroups(){return ir}get layoutHints(){return null}get frontColumns(){return ir}get backColumns(){return ir}get frozenColumns(){return ir}isColumnFrozen(e){return!1}isColumnSortable(e){return!1}get isFilterRequired(){return!1}get isReversible(){return!0}get isColumnStatisticsAvailable(){return!1}get description(){return""}get isCustomColumnsAvailable(){return!1}get isFormatColumnsAvailable(){return!1}get isExportAvailable(){return!1}get isValuesTableAvailable(){return!1}get isChartBuilderAvailable(){return!1}get isRollupAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isTotalsAvailable(){return!1}isFilterable(e){return!1}close(){}isRowMovable(){return!1}get isSeekRowAvailable(){return!1}dataBarOptionsForCell(e,t,n){throw new Error("Method not implemented.")}}Yo(zc,"EVENT",Object.freeze({UPDATED:"UPDATED",FORMATTER_UPDATED:"FORMATTER_UPDATED",REQUEST_FAILED:"REQUEST_FAILED",COLUMNS_CHANGED:"COLUMNS_CHANGED",TABLE_CHANGED:"TABLE_CHANGED",FILTERS_CHANGED:"FILTERS_CHANGED",SORTS_CHANGED:"SORTS_CHANGED",DISCONNECT:"DISCONNECT",RECONNECT:"RECONNECT",TOTALS_UPDATED:"TOTALS_UPDATED",PENDING_DATA_UPDATED:"PENDING_DATA_UPDATED"}));const ce=zc;function Vn(r,e,t){return e=Tw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Tw(r){var e=_w(r,"string");return typeof e=="symbol"?e:String(e)}function _w(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ow=z.module("ColumnHeaderGroup");function To(r){return r instanceof Bi}class Bi{constructor(e){var{name:t,children:n,color:i,depth:a,childIndexes:o,parent:s}=e;Vn(this,"name",void 0),Vn(this,"children",void 0),Vn(this,"depth",void 0),Vn(this,"parent",void 0),Vn(this,"color",void 0),Vn(this,"childIndexes",void 0),Vn(this,"getVisibleRange",oe(l=>{var d=this.childIndexes.flat(),u=ee.getVisibleIndexes(d,l),c=Math.min(...u),m=Math.max(...u);return m-c!==d.length-1&&Ow.warn("Column header group ".concat(this.name," is not contiguous")),[c,m]})),this.name=t,this.children=n,this.color=i??void 0,this.depth=a,this.childIndexes=o,this.parent=s}setParent(e){this.parent=e}addChildren(e){var t=new Set(this.children.concat(e));this.children=[...t]}removeChildren(e){var t=new Set(this.children);e.forEach(n=>t.delete(n)),this.children=[...t]}get isNew(){return this.name.startsWith(Bi.NEW_GROUP_PREFIX)}}Vn(Bi,"NEW_GROUP_PREFIX",":newGroup");function nn(r){return(r==null?void 0:r.isPartitionRequired)!==void 0&&(r==null?void 0:r.partitionColumns)!==void 0&&(r==null?void 0:r.partitionKeysTable)!==void 0&&(r==null?void 0:r.partitionMergedTable)!==void 0&&(r==null?void 0:r.partitionTable)!==void 0}function hM(r){return nn(r)&&r.partitionConfig!==void 0}var Dw=["selectedValues"],Mw=["selectedValues"];function Nd(r,e){if(r==null)return{};var t=Iw(r,e),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(i=0;i<a.length;i++)n=a[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}function Iw(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,a;for(a=0;a<n.length;a++)i=n[a],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function xd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function yt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xd(Object(t),!0).forEach(function(n){Qo(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xd(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Qo(r,e,t){return e=Nw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Nw(r){var e=xw(r,"string");return typeof e=="symbol"?e:String(e)}function xw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var di=z.module("IrisGridUtils");function cM(r){return r.partition!==void 0}function Fd(r){return Array.isArray(r.partitions)}function Fn(r,e){return r>=0&&r<e.length}function Fw(r){return(r==null?void 0:r.asDate)!=null}class _e{static dehydrateGridState(e,t){var{isStuckToBottom:n,isStuckToRight:i,movedColumns:a,movedRows:o}=t,{columns:s}=e;return{isStuckToBottom:n,isStuckToRight:i,movedColumns:[...a].filter(l=>{var{to:d,from:u}=l;return Fn(d,s)&&(typeof u=="number"&&Fn(u,s)||Array.isArray(u)&&Fn(u[0],s)&&Fn(u[1],s))}).map(l=>{var{to:d,from:u}=l;return{to:s[d].name,from:Array.isArray(u)?[s[u[0]].name,s[u[1]].name]:s[u].name}}),movedRows:[...o]}}static hydrateGridState(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],{isStuckToBottom:i,isStuckToRight:a,movedColumns:o,movedRows:s}=t,{columns:l}=e,d=_e.parseCustomColumnNames(n),u=l.map(c=>{var{name:m}=c;return m}).concat(d);return{isStuckToBottom:i,isStuckToRight:a,movedColumns:[...o].map(c=>{var{to:m,from:f}=c,g=v=>typeof v=="string"?u.findIndex(p=>p===v):v;return{to:g(m),from:Array.isArray(f)?[g(f[0]),g(f[1])]:g(f)}}).filter(c=>{var{to:m,from:f}=c;return Fn(m,u)&&(typeof f=="number"&&Fn(f,u)||Array.isArray(f)&&Fn(f[0],u)&&Fn(f[1],u))}),movedRows:[...s]}}static dehydrateIrisGridPanelState(e,t){var{isSelectingPartition:n,partitions:i,advancedSettings:a}=t;return{isSelectingPartition:n,partitions:i,advancedSettings:[...a]}}static hydrateIrisGridPanelState(e,t){var{isSelectingPartition:n,advancedSettings:i}=t,a=Fd(t)?t.partitions:[t.partition];return{isSelectingPartition:n,partitions:a,advancedSettings:new Map([...Bc.DEFAULTS,...i])}}static dehydrateQuickFilters(e){return[...e].map(t=>{var[n,i]=t,{text:a}=i;return[n,{text:a}]})}static dehydrateLong(e){return e!=null?"".concat(e):null}static dehydrateSort(e){return e.map(t=>{var{column:n,isAbs:i,direction:a}=t;return{column:n.name,isAbs:i,direction:a}})}static extractTableSettings(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],{irisGridPanelState:n,irisGridState:i}=e,a=Fd(n)?n.partitions:[n.partition],{advancedFilters:o,quickFilters:s,sorts:l}=i;return{advancedFilters:o,inputFilters:t,partitions:a,quickFilters:s,sorts:l}}static getInputFiltersForColumns(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.filter(n=>{var{name:i,type:a}=n;return e.find(o=>{var{name:s,type:l}=o;return s===i&&l===a})})}static getFiltersFromFilterMap(e){for(var t=[],n=Array.from(e.keys()),i=0;i<n.length;i+=1){var a=n[i],o=e.get(a);(o==null?void 0:o.filter)!=null&&t.push(o.filter)}return t}static getHiddenColumns(e){return[...e.entries()].filter(t=>{var[,n]=t;return n===0}).map(t=>{var[n]=t;return n})}static parseCustomColumnNames(e){return e.map(t=>t.split("=")[0])}static getRemovedCustomColumnNames(e,t){var n=_e.parseCustomColumnNames(e),i=_e.parseCustomColumnNames(t);return n.filter(a=>!i.includes(a))}static removeSortsInColumns(e,t){return e.filter(n=>!t.includes(n.column.name))}static removeFiltersInColumns(e,t,n){var i=e.map(o=>{var{name:s}=o;return s}),a=new Map(t);return n.forEach(o=>a.delete(i.indexOf(o))),a}static removeColumnFromMovedColumns(e,t,n){for(var i=e.map(l=>{var{name:d}=l;return d}),a=[...t],o=function(){for(var d=n[s],u=i.findIndex(C=>C===d),c=[],m=0;m<a.length;m+=1){var f=a[m],g=yt({},f),[v,p]=Array.isArray(f.from)?f.from:[f.from,f.from];u<=f.to&&(g.to-=1),u<v&&(v-=1),u<=p&&(p-=1),v<=p&&v!==g.to&&(v===p?c.push(yt(yt({},g),{},{from:v})):c.push(yt(yt({},g),{},{from:[v,p]}))),u=ee.applyItemMoves(u,u,[f])[0][0]}a=c,i.splice(i.findIndex(C=>C===d),1)},s=0;s<n.length;s+=1)o();return a}static removeColumnsFromSelectDistinctColumns(e,t){return e.filter(n=>!t.includes(n))}static getVisibleColumnsInRange(e,t,n,i,a){for(var o=[],s=t;s<=n;s+=1){var l=ee.getModelIndex(s,i);l>=0&&l<e.length&&!a.includes(l)&&o.push(e[l])}return o}static getPrevVisibleColumns(e,t,n,i,a){for(var o=[],s=t;s>=0&&o.length<n;){var l=ee.getModelIndex(s,i);l>=0&&l<e.length&&!a.includes(l)&&o.unshift(e[l]),s-=1}return o}static getNextVisibleColumns(e,t,n,i,a){for(var o=[],s=t;s<e.length&&o.length<n;){var l=ee.getModelIndex(s,i);l>=0&&l<e.length&&!a.includes(l)&&o.push(e[l]),s+=1}return o}static getColumnsToFetch(e,t,n){var i=[...t];return n.forEach(a=>{var o=e.find(s=>{var{name:l}=s;return l===a});o!=null&&!t.includes(o)&&i.push(o)}),i}static getModelViewportColumns(e,t,n,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0;if(!(t==null||n==null)){var l=_e.getVisibleColumnsInRange(e,t,n,i,a),d=l.length*s,u=_e.getPrevVisibleColumns(e,t-1,d,i,a),c=_e.getNextVisibleColumns(e,n+1,d,i,a),m=[...u,...l,...c];return _e.getColumnsToFetch(e,m,o)}}static isValidSnapshotRanges(e){if(e==null||e.length===0)return!1;for(var t=new Map,n=0;n<e.length;n+=1){var i=e[n],a="".concat(i.startRow,":").concat(i.endRow),o="".concat(i.startColumn,":").concat(i.endColumn);t.has(a)||t.set(a,[]),t.get(a).push(o)}for(var s=[...t.keys()],l=t.get(s[0]).sort().join(","),d=1;d<s.length;d+=1)if(t.get(s[d]).sort().join(",")!==l)return!1;return!0}static isValidIndex(e){return!Number.isInteger(e)||typeof e!="number"?!1:e>=0}static columnsFromRanges(e,t){if(e==null||e.length===0)return[];if(e[0].startColumn===null&&e[0].endColumn===null)return[...t];for(var n=new Set,i=0;i<e.length;i+=1){var a=e[i];I(a.startColumn),I(a.endColumn);for(var o=(s=a.startColumn)!==null&&s!==void 0?s:0;o<=((l=a.endColumn)!==null&&l!==void 0?l:t.length-1);o+=1){var s,l;n.add(o)}}return[...n].map(d=>t[d])}static snapshotDataToMatrix(e){for(var{columns:t,rows:n}=e,i=[],a=0;a<n.length;a+=1){for(var o=n[a],s=[],l=0;l<t.length;l+=1){var d=t[l],u=o.get(d);s.push(u)}i.push(s)}return i}static getModelRollupConfig(e,t,n){var i,a;if(((i=t==null||(a=t.columns)===null||a===void 0?void 0:a.length)!==null&&i!==void 0?i:0)===0)return null;for(var{columns:o=[],showConstituents:s=!0,showNonAggregatedColumns:l=!0,includeDescriptions:d=!0}=t??{},{aggregations:u=[]}=n??{},c=u.map(C=>{var{operation:S,selected:y,invert:w}=C;return _d.isRollupOperation(S)?[]:_d.getOperationColumnNames(e,S,y,w)}),m={},f=0;f<u.length;f+=1)m[u[f].operation]=c[f];if(l){var g=new Set(e.map(C=>C.name).filter(C=>!o.includes(C)));if(c.forEach(C=>{C.forEach(S=>g.delete(S))}),g.size>0){var v,p=(v=m[be.FIRST])!==null&&v!==void 0?v:[];m[be.FIRST]=[...p,...g]}}return{groupingColumns:o,includeConstituents:s,includeDescriptions:d,aggregations:m}}static getPendingErrors(e){e.forEach((t,n)=>{if(!_e.isValidIndex(n))throw new Error("Invalid rowIndex ".concat(n));var{data:i}=t;i.forEach((a,o)=>{if(!_e.isValidIndex(o))throw new Error("Invalid columnIndex ".concat(o))})})}static getColumn(e,t){return t<e.length?e[t]:(di.error("Unable to retrieve column",t,">=",e.length),null)}static getColumnByName(e,t){var n=e.find(i=>{var{name:a}=i;return a===t});return n==null&&di.error("Unable to retrieve column by name",t,e.map(i=>{var{name:a}=i;return a})),n}static changeFilterColumnNamesToIndexes(e,t){return t.map(n=>{var{name:i,filter:a}=n,o=e.findIndex(s=>s.name===i);return o<0?null:[o,a]}).filter(n=>n!=null)}static combineFiltersFromList(e,t){t.sort((u,c)=>u.operator==="eq"&&c.operator!=="eq"?1:u.operator!=="eq"&&c.operator==="eq"?-1:u.startColumnIndex-c.startColumnIndex);for(var n="",i=0;i<t.length;i+=1){var{text:a,value:o,operator:s}=t[i];if(o!==void 0){var l="";s!==void 0&&(o==null&&s==="eq"?l="=":s!=="eq"&&(s==="startsWith"||s==="endsWith"?l="*":l=P.getFilterOperatorString(s)));var d="".concat(l).concat(a);s==="startsWith"&&(d="".concat(a).concat(l)),e!=null&&o!==null&&P.isCharType(e)&&(d="".concat(l).concat(String.fromCharCode(parseInt(a,10)))),i!==0&&(n+=s==="eq"?" || ":" && "),n+=d}}return n}static parseColumnHeaderGroups(e,t){var n=1,i=new Map,a=new Map,o=t==null?void 0:t.filter(c=>{var{children:m}=c;return m!=null&&m.length>0});if(o.length===0)return{groups:[],maxDepth:n,parentMap:i,groupMap:a};var s=new Map(o.map(c=>[c.name,c])),l=new Set,d=c=>{var m,{name:f}=c;if(I(f,"Column header group has no name"),e.getColumnIndexByName(f)!=null)throw new Error("Column header group has same name as column: ".concat(f));var g=a.get(f);if(g)return g;var v=[],p=1;if(c.children==null)throw new Error("Column header group ".concat(f," has no children"));c.children.forEach(S=>{if(l.has(S))throw new Error("Column group child ".concat(S," specified in multiple groups"));l.add(S);var y=s.get(S),w=e.getColumnIndexByName(S);if(y){var E=d(y);v.push(...E.childIndexes),p=Math.max(p,E.depth+1)}else if(w!=null)v.push(w),p=Math.max(p,1);else throw new Error("Unknown child ".concat(S," in group ").concat(f))});var C=new Bi(yt(yt({},c),{},{name:f,children:c.children,depth:p,childIndexes:v.flat()}));return a.set(f,C),(m=c.children)===null||m===void 0||m.forEach(S=>i.set(S,C)),n=Math.max(n,C.depth+1),C},u=new Set;return o.forEach(c=>{var{name:m}=c;if(u.has(m))throw new Error("Duplicate column group name: ".concat(m));u.add(m),d(c)}),a.forEach(c=>{var m;c.setParent((m=i.get(c.name))===null||m===void 0?void 0:m.name)}),{groups:[...a.values()],maxDepth:n,groupMap:a,parentMap:i}}static convertValueToText(e,t){if(t!=null&&P.isCharType(t)&&e!=null&&typeof e=="number")return String.fromCharCode(e);if(P.isDateType(t)&&Fw(e)){var n=new Date(e.asDate()),i=n.getTimezoneOffset(),a=new Date(n.getTime()-i*60*1e3),o=a.toISOString(),s=o.replace("T"," ").substring(0,23);return s}return e==null?"":"".concat(e)}constructor(e){Qo(this,"dh",void 0),Qo(this,"tableUtils",void 0),this.dh=e,this.tableUtils=new P(e),ps(this)}dehydrateIrisGridState(e,t){var{aggregationSettings:n={aggregations:Oe,showOnTop:!1},advancedFilters:i,customColumnFormatMap:a,isFilterBarShown:o,metrics:s,quickFilters:l,customColumns:d,conditionalFormats:u=Oe,reverseType:c,rollupConfig:m=void 0,showSearchBar:f,searchValue:g,selectDistinctColumns:v=Oe,selectedSearchColumns:p,sorts:C,invertSearchColumns:S,pendingDataMap:y=Ca,frozenColumns:w,columnHeaderGroups:E,partitionConfig:D=void 0}=t;I(s);var{userColumnWidths:M,userRowHeights:_}=s,{columns:T}=e,N=nn(e)?e.partitionColumns:[];return{advancedFilters:this.dehydrateAdvancedFilters(T,i),aggregationSettings:n,customColumnFormatMap:[...a],isFilterBarShown:o,quickFilters:_e.dehydrateQuickFilters(l),sorts:_e.dehydrateSort(C),userColumnWidths:[...M].filter(x=>{var[F]=x;return F!=null&&F>=0&&F<T.length}).map(x=>{var[F,k]=x;return[T[F].name,k]}),userRowHeights:[..._],customColumns:[...d],conditionalFormats:[...u],reverseType:c,rollupConfig:m,showSearchBar:f,searchValue:g,selectDistinctColumns:[...v],selectedSearchColumns:p,invertSearchColumns:S,pendingDataMap:this.dehydratePendingDataMap(T,y),frozenColumns:w,columnHeaderGroups:E==null?void 0:E.map(x=>{var F;return{name:x.name,children:x.children,color:(F=x.color)!==null&&F!==void 0?F:null}}),partitionConfig:this.dehydratePartitionConfig(N,D)}}hydrateIrisGridState(e,t){var n,i,{advancedFilters:a,aggregationSettings:o={aggregations:[],showOnTop:!1},customColumnFormatMap:s,isFilterBarShown:l,quickFilters:d,sorts:u,customColumns:c,conditionalFormats:m,userColumnWidths:f,userRowHeights:g,reverseType:v,rollupConfig:p=void 0,showSearchBar:C,searchValue:S,selectDistinctColumns:y,selectedSearchColumns:w,invertSearchColumns:E=!0,pendingDataMap:D=[],frozenColumns:M,columnHeaderGroups:_,partitionConfig:T}=t,{columns:N,formatter:x}=e,F=nn(e)?e.partitionColumns:[];return{advancedFilters:this.hydrateAdvancedFilters(N,a,x.timeZone),aggregationSettings:o,customColumnFormatMap:new Map(s),isFilterBarShown:l,quickFilters:this.hydrateQuickFilters(N,d,x.timeZone),sorts:this.hydrateSort(N,u),userColumnWidths:new Map(f.map(k=>{var[U,H]=k;return typeof U=="string"||U instanceof String?[N.findIndex(W=>{var{name:X}=W;return X===U}),H]:[U,H]}).filter(k=>{var[U]=k;return U!=null&&U>=0&&U<N.length})),customColumns:c,conditionalFormats:m,userRowHeights:new Map(g),reverseType:v,rollupConfig:p,showSearchBar:C,searchValue:S,selectDistinctColumns:y,selectedSearchColumns:w,invertSearchColumns:E,pendingDataMap:this.hydratePendingDataMap(N,D),frozenColumns:M,columnHeaderGroups:_e.parseColumnHeaderGroups(e,(n=_??((i=e.layoutHints)===null||i===void 0?void 0:i.columnGroups))!==null&&n!==void 0?n:[]).groups,partitionConfig:this.hydratePartitionConfig(F,T)}}hydrateQuickFilters(e,t,n){var i=t.map(a=>{var[o,s]=a,{text:l}=s,d=null;try{var u=_e.getColumn(e,o);u!=null&&(d=this.tableUtils.makeQuickFilter(u,l,n))}catch(c){di.error("hydrateQuickFilters error with",l,c)}return[o,{text:l,filter:d}]});return new Map(i)}dehydrateAdvancedFilters(e,t){return[...t].map(n=>{var[i,a]=n,o=_e.getColumn(e,i);I(o);var s=this.dehydrateAdvancedFilterOptions(o,a.options);return[i,{options:s}]})}hydrateAdvancedFilters(e,t,n){var i=t.map(a=>{var[o,s]=a,l=_e.getColumn(e,o);I(l);var d=this.hydrateAdvancedFilterOptions(l,s.options),u=null;try{var c=_e.getColumn(e,o);c!=null&&(u=this.tableUtils.makeAdvancedFilter(l,d,n))}catch(m){di.error("hydrateAdvancedFilters error with",d,m)}return[o,{options:d,filter:u}]});return new Map(i)}dehydrateAdvancedFilterOptions(e,t){var{selectedValues:n}=t,i=Nd(t,Dw);return yt({selectedValues:n==null?void 0:n.map(a=>this.dehydrateValue(a,e==null?void 0:e.type))},i)}hydrateAdvancedFilterOptions(e,t){var{selectedValues:n}=t,i=Nd(t,Mw);return yt({selectedValues:n==null?void 0:n.map(a=>this.hydrateValue(a,e==null?void 0:e.type))},i)}dehydratePendingDataMap(e,t){return[...t].map(n=>{var[i,{data:a}]=n;return[i,{data:[...a].map(o=>{var[s,l]=o;return[e[s].name,this.dehydrateValue(l,e[s].type)]})}]})}hydratePendingDataMap(e,t){var n=new Map,i=a=>(n.has(a)||n.set(a,e.findIndex(o=>{var{name:s}=o;return s===a})),n.get(a));return new Map(t.map(a=>{var[o,{data:s}]=a;return[o,{data:new Map(s.map(l=>{var d,[u,c]=l,m=i(u);return I(m),[(d=i(u))!==null&&d!==void 0?d:null,this.hydrateValue(c,e[m].type)]}))}]}))}dehydratePartitionConfig(e,t){return t==null?t:yt(yt({},t),{},{partitions:t.partitions.map((n,i)=>this.dehydrateValue(n,e[i].type))})}hydratePartitionConfig(e,t){return t==null?t:yt(yt({},t),{},{partitions:t.partitions.map((n,i)=>this.hydrateValue(n,e[i].type))})}dehydrateValue(e,t){return P.isDateType(t)?this.dehydrateDateTime(e):P.isLongType(t)?_e.dehydrateLong(e):e}hydrateValue(e,t){return P.isDateType(t)?this.hydrateDateTime(e):P.isLongType(t)?this.hydrateLong(e):e}dehydrateDateTime(e){return e!=null?this.dh.i18n.DateTimeFormat.format(He.FULL_DATE_FORMAT,e):null}hydrateDateTime(e){return e!=null?this.dh.i18n.DateTimeFormat.parse(He.FULL_DATE_FORMAT,e):null}hydrateLong(e){return e!=null?this.dh.LongWrapper.ofString(e):null}hydrateSort(e,t){var{dh:n}=this;return t.map(i=>{var{column:a,isAbs:o,direction:s}=i;if(s===P.sortDirection.reverse)return n.Table.reverse();var l=typeof a=="string"?_e.getColumnByName(e,a):_e.getColumn(e,a);if(l!=null){var d=l.sort();return o&&(d=d.abs()),s===P.sortDirection.descending?d=d.desc():d=d.asc(),d}return null}).filter(i=>i!=null&&i.direction!==P.sortDirection.reverse)}applyTableSettings(e,t,n){var{columns:i}=e,a=[];t.quickFilters&&(a=_e.getFiltersFromFilterMap(this.hydrateQuickFilters(i,t.quickFilters,n)));var o=[];t.advancedFilters&&(o=_e.getFiltersFromFilterMap(this.hydrateAdvancedFilters(i,t.advancedFilters,n)));var s=this.getFiltersFromInputFilters(i,t.inputFilters,n),l=[];t.sorts&&(l=this.hydrateSort(i,t.sorts));var d=[...a,...o],{partitions:u,partitionColumns:c}=t;if(u&&u.length&&c&&c!==null&&c!==void 0&&c.length){for(var m=c.map(v=>_e.getColumnByName(i,v)),f=0;f<m.length;f+=1)if(m[f]!==void 0&&u[f]!=null){var g=m[f].filter().eq(this.dh.FilterValue.ofString(u[f]));d=[g,...d]}}d=[...s,...d],e.applyFilter(d),e.applySort(l)}getFiltersFromInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0;return t.map(i=>{var{name:a,type:o,value:s}=i,l=e.find(d=>{var{name:u,type:c}=d;return u===a&&c===o});if(l)try{return this.tableUtils.makeQuickFilter(l,s,n)}catch(d){di.debug("Unable to create input filter",d)}return null}).filter(i=>i!=null)}rangeSetFromRanges(e){var{dh:t}=this,n=e.slice().sort((i,a)=>(I(i.startRow),I(a.startRow),i.startRow-a.startRow)).map(i=>{var{startRow:a,endRow:o}=i;return I(a),I(o),t.RangeSet.ofRange(a,o)});return t.RangeSet.ofRanges(n)}}const Ne=_e;function Rw(r){var{type:e}=r,t=vr();switch(e){case t.VariableType.TABLE:case t.VariableType.TABLEMAP:case t.VariableType.TREETABLE:case t.VariableType.HIERARCHICALTABLE:case t.VariableType.PARTITIONEDTABLE:return h.jsx(ue,{icon:fs});case t.VariableType.FIGURE:return h.jsx(ue,{icon:ms});case t.VariableType.PANDAS:return h.jsx(ue,{icon:Dh});default:return h.jsx(ue,{icon:Bf})}}function Rd(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Lw(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Rd(a,n,i,o,s,"next",l)}function s(l){Rd(a,n,i,o,s,"throw",l)}o(void 0)})}}function Kc(r){var{children:e,language:t}=r,[n,i]=b.useState(null),{activeThemes:a}=Jh();return b.useEffect(()=>{var o=!1;function s(){return l.apply(this,arguments)}function l(){return l=Lw(function*(){if(e!=null&&a!=null){var d=yield Gt.colorize(e.toString(),t,{});o||i(d)}}),l.apply(this,arguments)}return s(),()=>{o=!0}},[a,e,t]),h.jsx("div",{style:{pointerEvents:"none"},dangerouslySetInnerHTML:n!=null?{__html:n}:void 0})}class Aw{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}const qc=Aw;class Na{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:Tf.parse(e).filter(t=>!this.hasComment(t)).map(t=>this.hasPattern(t)?t.pattern:this.hasOp(t)?t.op:"".concat(t))}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;var t="".concat(e.getHours()).padStart(2,"0"),n="".concat(e.getMinutes()).padStart(2,"0"),i="".concat(e.getSeconds()).padStart(2,"0"),a="".concat(e.getMilliseconds()).padStart(3,"0");return"".concat(t,":").concat(n,":").concat(i,".").concat(a)}static isTableType(e,t){return t===e.VariableType.TABLE||t===e.VariableType.TREETABLE||t===e.VariableType.HIERARCHICALTABLE||t===e.VariableType.PARTITIONEDTABLE}static isWidgetType(e,t){return t===e.VariableType.FIGURE||t===e.VariableType.OTHERWIDGET||t===e.VariableType.PANDAS}static isOpenableType(e,t){return Na.isTableType(e,t)||Na.isWidgetType(e,t)}static isFigureType(e,t){return t===e.VariableType.FIGURE}static isPandas(e,t){return t===e.VariableType.PANDAS}}const Jo=Na;function Xc(r){var{children:e}=r;return h.jsxs("div",{className:"console-history-item-result",children:[h.jsx("div",{className:"console-history-gutter",children:"-"}),h.jsx("div",{className:"console-history-content",children:e})]})}Xc.propTypes={children:O.node.isRequired};function es(r,e,t){return e=kw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kw(r){var e=jw(r,"string");return typeof e=="symbol"?e:String(e)}function jw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Zc extends b.Component{constructor(e){super(e),es(this,"timer",void 0),es(this,"startTime",void 0),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){var{disabled:e,onCancelClick:t}=this.props,{elapsed:n}=this.state;return h.jsx("div",{className:J("console-history-result-in-progress",{disabled:e}),children:h.jsxs("span",{className:"badge",children:[h.jsx(Mh,{className:"ml-2"}),"Running... ",Hh.formatElapsedTime(n)," ",h.jsx(Y,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Wf,tooltip:"Cancel",onClick:t,disabled:e})]})})}}es(Zc,"defaultProps",{disabled:!1});const $w=Zc;function _i(r,e,t){return e=Hw(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hw(r){var e=Vw(r,"string");return typeof e=="symbol"?e:String(e)}function Vw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Ur extends b.PureComponent{constructor(e){super(e),_i(this,"mouseX",void 0),_i(this,"mouseY",void 0),_i(this,"isClicking",void 0),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(e){switch(e.key){case"Enter":case" ":this.handleToggleError(),e.stopPropagation(),e.preventDefault();break}}handleMouseDown(e){this.mouseX=e.clientX,this.mouseY=e.clientY,this.isClicking=!0}handleMouseMove(e){this.mouseX!=null&&this.mouseY!=null?(Math.abs(e.clientX-this.mouseX)>=Ur.mouseDragThreshold||Math.abs(e.clientY-this.mouseY)>=Ur.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(e){this.isClicking&&!e.shiftKey&&!e.metaKey&&!e.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(e=>({isExpanded:!e.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){var{isExpanded:e,isTriggerHovered:t}=this.state,{message:n}=this.props;I(n);var i=n.indexOf(`
|
|
3
3
|
`),a=i>-1,o=n;a&&(o=n.slice(0,i));var s=n.slice(i),l=t?"error-btn-link error-btn-link--active":"error-btn-link";return h.jsxs("div",{className:J("error-message",{expanded:e}),children:[a&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"error-gutter",children:h.jsx("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:h.jsx(ue,{icon:e?xr:Gf,transform:"left-3"})})}),h.jsxs("div",{className:"error-content",children:[h.jsx("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:o}),e?s:""]})]}),!a&&h.jsx("div",{className:"error-content",children:h.jsx("div",{className:"console-error-text",children:o})})]},"error")}}_i(Ur,"defaultProps",{message:""});_i(Ur,"mouseDragThreshold",5);const Uw=Ur;function Bw(r,e,t){return e=Ww(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ww(r){var e=Gw(r,"string");return typeof e=="symbol"?e:String(e)}function Gw(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ld=z.module("ConsoleHistoryItem");class Yc extends b.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){Ld.debug("handleObjectClick",e);var{openObject:t}=this.props;t(e)}handleCancelClick(){var{item:e}=this.props;e!=null&&e.cancelResult&&(Ld.debug("Cancelling command: ".concat(e.command)),e.cancelResult())}render(){var{disabled:e,item:t,language:n,iconForType:i}=this.props,{disabledObjects:a,result:o}=t,s=t.command!=null&&t.command!=="",l=null;s&&(l=h.jsxs("div",{className:"console-history-item-command",children:[h.jsx("div",{className:"console-history-gutter",children:">"}),h.jsx("div",{className:"console-history-content",children:h.jsx(Kc,{language:n,children:t.command})})]}));var d=[],u=!1;if(o){var{error:c,message:m,changes:f}=o;if(f){var{created:g,updated:v}=f;[...g,...v].forEach(D=>{u=!0;var{title:M}=D,_="".concat(M),T=e===void 0||e||(a??[]).indexOf(_)>=0,N=h.jsx(Y,{kind:"primary",onClick:()=>this.handleObjectClick(D),className:"btn-console-object",disabled:T,icon:i(D.type),children:M},_);d.push(N)})}if(c!=null&&!s){var p,C="".concat((p=c.message)!==null&&p!==void 0?p:c);C||(C=c);var S=h.jsx(Uw,{message:C},"result-error");d.push(S)}if(m!==void 0&&m!==""){var y=h.jsx("div",{className:"log-message",children:m},"log-message");d.push(y)}}else{u=!0;var w=h.jsx($w,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");d.push(w)}var E=null;return d.length>0&&(E=h.jsx(Xc,{children:d})),h.jsxs("div",{className:J("console-command-result",{"console-result-buttons":u}),children:[l,E]})}}Bw(Yc,"defaultProps",{disabled:!1});const zw=Yc;function Kw(r,e){return"".concat(r,".").concat(e.command,".").concat(e.result&&e.result.message,".").concat(e.result&&e.result.error)}function qw(r){for(var{disabled:e=!1,items:t,language:n,openObject:i,supportsType:a,iconForType:o}=r,s=[],l=0;l<t.length;l+=1){var d=t[l],u=h.jsx(zw,{disabled:e,item:d,openObject:i,language:n,supportsType:a,iconForType:o},Kw(l,d));s.push(u)}return h.jsx("div",{className:"container-fluid console-history",children:s})}var Xw={name:"Console",CLEAR:De.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[re.CTRL,q.L],macShortcut:[re.CTRL,q.C]}),FOCUS_HISTORY:De.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[re.CTRL,q.H],macShortcut:[re.CTRL,re.OPTION,q.H]})},Zw={name:"Command History",FOCUS_HISTORY:De.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[re.CTRL,q.H],macShortcut:[re.CTRL,re.OPTION,q.H]}),SEND_TO_CONSOLE:De.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[q.ENTER],macShortcut:[q.ENTER]}),SEND_TO_NOTEBOOK:De.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[re.CTRL,q.ENTER],macShortcut:[re.CMD,q.ENTER]}),RUN:De.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[re.ALT,q.R],macShortcut:[re.OPTION,q.R]})},Yw={name:"Notebook",RUN:De.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[re.ALT,q.R],macShortcut:[re.OPTION,q.R]}),RUN_SELECTED:De.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[re.ALT,re.SHIFT,q.R],macShortcut:[re.OPTION,re.SHIFT,q.R]}),FIND:De.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[re.CTRL,q.F],macShortcut:[re.CMD,q.F],isEditable:!1}),MINIMAP:De.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[re.ALT,q.M],macShortcut:[re.OPTION,q.M]}),WORDWRAP:De.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[re.ALT,q.Z],macShortcut:[re.OPTION,q.Z]})},Qw={CONSOLE:Xw,COMMAND_HISTORY:Zw,NOTEBOOK:Yw};const mt=Qw,et=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Jw="var(--dh-color-editor-bg)",eE="var(--dh-color-editor-fg)",tE="var(--dh-color-editor-string)",nE="var(--dh-color-editor-delimiter)",rE="var(--dh-color-editor-predefined)",iE="var(--dh-color-editor-keyword)",aE="var(--dh-color-editor-storage)",oE="var(--dh-color-editor-number)",sE="var(--dh-color-editor-operator)",lE="var(--dh-color-editor-identifier)",dE="var(--dh-color-editor-comment)",ts={"error-foreground":"var(--dh-color-editor-error-fg)",background:Jw,foreground:eE,"line-height":"19px",string:tE,"string-delim":"var(--dh-color-editor-string-delim)",delimiter:nE,predefined:rE,keyword:iE,storage:aE,number:oE,operator:sE,identifier:lE,"namespace-identifier":"var(--dh-color-editor-identifier-namespace)","identifier-js":"var(--dh-color-editor-identifier-js)",comment:dE,"editor-bracket-foreground1":"var(--dh-color-editor-bracket-fg1)","editor-bracket-foreground2":"var(--dh-color-editor-bracket-fg2)","editor-bracket-foreground3":"var(--dh-color-editor-bracket-fg3)","editor-bracket-foreground4":"var(--dh-color-editor-bracket-fg4)","editor-bracket-foreground5":"var(--dh-color-editor-bracket-fg5)","editor-bracket-foreground6":"var(--dh-color-editor-bracket-fg6)","editor-unexpected-bracket-foreground":"var(--dh-color-editor-unexpected-bracket-fg)","input-option-active-border":"var(--dh-color-editor-input-option-active-border)","focus-border":"var(--dh-color-editor-focus-border)","input-background":"var(--dh-color-editor-input-bg)","input-foreground":"var(--dh-color-editor-input-fg)","input-border":"var(--dh-color-editor-input-border)","editor-line-number-foreground":"var(--dh-color-editor-line-number-fg)","editor-line-number-active-foreground":"var(--dh-color-editor-line-number-active-fg)","editor-selection-background":"var(--dh-color-editor-selection-bg)","editor-inactive-selection-background":"var(--dh-color-editor-inactive-selection-bg)","editor-selection-highlight-background":"var(--dh-color-editor-selection-highlight-bg)","editor-line-highlight-background":"var(--dh-color-editor-line-highlight-bg)","editor-word-highlight-background":"var(--dh-color-editor-word-highlight-bg)","context-menu-background":"var(--dh-color-editor-context-menu-bg)","context-menu-foreground":"var(--dh-color-editor-context-menu-fg)","menu-selection-background":"var(--dh-color-editor-menu-selection-bg)","menu-selection-foreground":"var(--dh-color-editor-menu-selection-fg)","log-date":"var(--dh-color-editor-log-date)","log-error":"var(--dh-color-editor-log-error)","log-info":"var(--dh-color-editor-log-info)","log-stdout":"var(--dh-color-editor-log-stdout)","log-warn":"var(--dh-color-editor-log-warn)","log-debug":"var(--dh-color-editor-log-debug)","log-trace":"var(--dh-color-editor-log-trace)","editor-find-match-background":"var(--dh-color-editor-find-match-bg)","editor-find-match-highlight-background":"var(--dh-color-editor-find-match-highlight-bg)","editor-widget-background":"var(--dh-color-editor-find-bg)","input-option-active-background":"var(--dh-color-editor-find-option-active-bg)","input-option-active-foreground":"var(--dh-color-editor-find-option-active-fg)","editor-suggest-widget-background":"var(--dh-color-editor-suggest-bg)","editor-suggest-widget-border":"var(--dh-color-editor-suggest-border)","editor-suggest-widget-foreground":"var(--dh-color-editor-suggest-fg)","editor-suggest-widget-selected-background":"var(--dh-color-editor-suggest-selected-bg)","editor-suggest-widget-selected-foreground":"var(--dh-color-editor-suggest-selected-fg)","editor-suggest-widget-highlightForeground":"var(--dh-color-editor-suggest-highlight-fg)","editor-suggest-widget-focus-highlight-foreground":"var(--dh-color-editor-suggest-focus-highlight-fg)","list-hover-background":"var(--dh-color-editor-suggest-hover-bg)","text-link-foreground":"var(--dh-color-editor-link-foreground)","text-link-active-foreground":"var(--dh-color-editor-link-active-fg)","editor-link-active-foreground":"var(--dh-color-editor-link-active-fg)"};var uE="python",hE={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},cE={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","exec","in","raise","continue","finally","is","return","for","try",":","=","isinstance","__debug__"],storage:["class","def","async","lambda"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@storage":"storage","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],["\\*/","comment","@pop"],[/[/*]/,"comment"]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/\s+/,"white"],[/(^#.*$)/,"comment"],[/'''/,"string","@endDocString"],[/"""/,"string","@endDblDocString"]],endDocString:[[/[^']+/,"string"],[/\\'/,"string"],[/'''/,"string","@popall"],[/'/,"string"]],endDblDocString:[[/[^"]+/,"string"],[/\\"/,"string"],[/"""/,"string","@popall"],[/"/,"string"]]}},mE={id:uE,conf:hE,language:cE};const fE=mE;var vE="groovy",pE={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},gE={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","println","class","exec","in","raise","continue","finally","is","return","def","for","lambda","try",":","=","isinstance","__debug__"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@doccomment"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],doccomment:[[/[^/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[/*]/,"comment.doc"]]}},bE={id:vE,conf:pE,language:gE};const CE=bE;var yE="scala",SE={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},wE={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],softKeywords:["as","export","extension","end","derives","on"],constants:["true","false","null","this","super"],modifiers:["abstract","final","implicit","lazy","override","private","protected","sealed"],softModifiers:["inline","opaque","open","transparent","using"],name:/(?:[a-z_$][\w$]*|`[^`]+`)/,type:/(?:[A-Z][\w$]*)/,symbols:/[=><!~?:&|+\-*/^\\%@#]+/,digits:/\d+(_+\d+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,escapes:/\\(?:[btnfr\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,fstring_conv:/[bBhHsScCdoxXeEfgGaAt]|[Tn](?:[HIklMSLNpzZsQ]|[BbhAaCYyjmde]|[RTrDFC])/,tokenizer:{root:[[/\braw"""/,{token:"string.quote",bracket:"@open",next:"@rawstringt"}],[/\braw"/,{token:"string.quote",bracket:"@open",next:"@rawstring"}],[/\bs"""/,{token:"string.quote",bracket:"@open",next:"@sstringt"}],[/\bs"/,{token:"string.quote",bracket:"@open",next:"@sstring"}],[/\bf""""/,{token:"string.quote",bracket:"@open",next:"@fstringt"}],[/\bf"/,{token:"string.quote",bracket:"@open",next:"@fstring"}],[/"""/,{token:"string.quote",bracket:"@open",next:"@stringt"}],[/"/,{token:"string.quote",bracket:"@open",next:"@string"}],[/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/0[xX](@hexdigits)[Ll]?/,"number.hex","@allowMethod"],[/(@digits)[fFdD]/,"number.float","@allowMethod"],[/(@digits)[lL]?/,"number","@allowMethod"],[/\b_\*/,"key"],[/\b(_)\b/,"keyword","@allowMethod"],[/\bimport\b/,"keyword","@import"],[/\b(case)([ \t]+)(class)\b/,["keyword.modifier","white","keyword"]],[/\bcase\b/,"keyword","@case"],[/\bva[lr]\b/,"keyword","@vardef"],[/\b(def)([ \t]+)((?:unary_)?@symbols|@name(?:_=)|@name)/,["keyword","white","identifier"]],[/@name(?=[ \t]*:(?!:))/,"variable"],[/(\.)(@name|@symbols)/,[{token:"operator"},{token:"@rematch",next:"@allowMethod"}]],[/([{(])(\s*)(@name(?=\s*=>))/,["@brackets","white","variable"]],[/@name/,{cases:{"@keywords":"keyword","@softKeywords":"keyword","@modifiers":"keyword.modifier","@softModifiers":"keyword.modifier","@constants":{token:"constant",next:"@allowMethod"},"@default":{token:"identifier",next:"@allowMethod"}}}],[/@type/,"type","@allowMethod"],{include:"@whitespace"},[/@[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*/,"annotation"],[/[{(]/,"@brackets"],[/[})]/,"@brackets","@allowMethod"],[/\[/,"operator.square"],[/](?!\s*(?:va[rl]|def|type)\b)/,"operator.square","@allowMethod"],[/]/,"operator.square"],[/([=-]>|<-|>:|<:|:>|<%)(?=[\s\w()[\]{},."'`])/,"keyword"],[/@symbols/,"operator"],[/[;,.]/,"delimiter"],[/'[a-zA-Z$][\w$]*(?!')/,"attribute.name"],[/'[^\\']'/,"string","@allowMethod"],[/(')(@escapes)(')/,[{token:"string"},{token:"string.escape"},{token:"string",next:"@allowMethod"}]],[/'/,"string.invalid"]],import:[[/;/,"delimiter","@pop"],[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/@name|@type/,"type"],[/[(){}]/,"@brackets"],[/[[\]]/,"operator.square"],[/[.,]/,"delimiter"]],allowMethod:[[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/(?==>[\s\w([{])/,"keyword","@pop"],[/(@name|@symbols)(?=[ \t]*[[({"'`]|[ \t]+(?:[+-]?\.?\d|\w))/,{cases:{"@keywords":{token:"keyword",next:"@pop"},"->|<-|>:|<:|<%":{token:"keyword",next:"@pop"},"@default":{token:"@rematch",next:"@pop"}}}],["","","@pop"]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],case:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword","@allowMethod"],[/\bif\b|=>/,"keyword","@pop"],[/`[^`]+`/,"identifier","@allowMethod"],[/@name/,"variable","@allowMethod"],[/:::?|\||@(?![a-z_$])/,"keyword"],{include:"@root"}],vardef:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword"],[/@name/,"variable"],[/:::?|\||@(?![a-z_$])/,"keyword"],[/=|:(?!:)/,"operator","@pop"],[/$/,"white","@pop"],{include:"@root"}],string:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],stringt:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],fstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],fstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],sstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],sstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],interp:[[/{/,"operator","@push"],[/}/,"operator","@pop"],{include:"@root"}],rawstring:[[/[^"]/,"string"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],rawstringt:[[/[^"]/,"string"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]]}},EE={id:yE,conf:SE,language:wE};const PE=EE;var TE="deephavenDb",_E={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},OE={tokenPostfix:".js",keywords:["boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with"],builtins:["define","require","window","document","undefined"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[~!@#%\^&*-+=|\\:`<>.?\/]+/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,exponent:/[eE][\-+]?[0-9]+/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/([a-zA-Z_\$][\w\$]*)(\s*)(:?)/,{cases:{"$1@keywords":["keyword","white","delimiter"],$3:["key.identifier","white","delimiter"],"$1@builtins":["predefined.identifier","white","delimiter"],"@default":["identifier","white","delimiter"]}}],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash",bracket:"@open",next:"@regexp"}],[/[{}()\[\]]/,"@brackets"],[/[;,.]/,"delimiter"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d+\.\d*(@exponent)?/,"number.float"],[/\.\d+(@exponent)?/,"number.float"],[/\d+@exponent/,"number.float"],[/0[xX][\da-fA-F]+/,"number.hex"],[/0[0-7]+/,"number.octal"],[/\d+/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\/\*/,"comment.invalid"],["\\*/","comment","@pop"],[/[\/*]/,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["@brackets.regexp.escape.control","regexp.escape.control","@brackets.regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[{token:"@brackets.regexp.escape.control"},{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["@brackets.regexp.escape.control","regexp.escape.control"]],[/[()]/,"@brackets.regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],["/",{token:"regexp.slash",bracket:"@close"},"@pop"]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"@brackets.regexp.escape.control","@pop"]]}},DE={id:TE,conf:_E,language:OE};const ME=DE;var IE="log",NE={},xE={tokenizer:{root:[[/ FATAL[\s\S]*/,{token:"error",next:"@error"}],[/ ERROR[\s\S]*/,{token:"error",next:"@error"}],[/ STDERR[\s\S]*/,{token:"error",next:"@error"}],[/ STDOUT.*/,{token:"stdout",next:"@stdout"}],[/ INFO[\s\S]*/,{token:"info",next:"@info"}],[/ WARN.*/,{token:"warn",next:"@warn"}],[/ TRACE[\s\S]*/,{token:"trace",next:"@trace"}],[/ DEBUG[.\s\S]*/,{token:"debug",next:"@debug"}],[/^\d{2}:\d{2}:\d{2}.\d{3}/,"date"]],error:[{include:"@body"}],info:[{include:"@body"}],warn:[{include:"@body"}],stdout:[{include:"@body"}],trace:[{include:"@body"}],debug:[{include:"@body"}],body:[[/^\d{2}:\d{2}:\d{2}.\d{3}/,{token:"date",next:"@pop"}],[/[\s\S]*/,{token:"$S0"}]]}},FE={id:IE,conf:NE,language:xE};const RE=FE;function Ad(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function kd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ad(Object(t),!0).forEach(function(n){LE(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ad(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function LE(r,e,t){return e=AE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function AE(r){var e=kE(r,"string");return typeof e=="symbol"?e:String(e)}function kE(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var fn=z.module("MonacoUtils");class wn{static init(){var{getWorker:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};fn.debug("Initializing Monaco..."),e!==void 0&&wn.registerGetWorker(e);var{initTheme:t,registerLanguages:n}=wn;t(),n([ME,fE,CE,RE,PE]),wn.removeConflictingKeybindings(),fn.debug("Monaco initialized.")}static initTheme(){var e,t,{removeHashtag:n}=wn,i=Oh(ts);fn.debug2("Monaco theme:",ts),fn.debug2("Monaco theme derived:",i);var a=[{token:"",foreground:n(i.foreground)},{token:"string",foreground:n(i.string)},{token:"string.delim",foreground:n(i["string-delim"])},{token:"keyword",foreground:n(i.keyword)},{token:"identifier.js",foreground:n(i["identifier-js"])},{token:"delimiter",foreground:n(i.delimiter)},{token:"comment",foreground:n(i.comment)},{token:"number",foreground:n(i.number)},{token:"storage",foreground:n(i.storage)},{token:"identifier",foreground:n(i.identifier)},{token:"namespace.identifier",foreground:n(i["namespace-identifier"])},{token:"operator",foreground:n(i.operator)},{token:"predefined",foreground:n(i.predefined)},{token:"error.log",foreground:(e=(t=i["log-error"])===null||t===void 0?void 0:t.substring(1))!==null&&e!==void 0?e:""},{token:"warn.log",foreground:n(i["log-warn"])},{token:"info.log",foreground:n(i["log-info"])},{token:"stdout.log",foreground:n(i["log-stdout"])},{token:"trace.log",foreground:n(i["log-trace"])},{token:"debug.log",foreground:n(i["log-debug"])},{token:"date.log",foreground:n(i["log-date"])}],o={foreground:i.foreground,errorForeground:i["error-foreground"],"inputOption.activeBorder":i["input-option-active-border"],"editor.background":i.background,"editor.foreground":i.foreground,"editor.lineHighlightBackground":i["editor-line-highlight-background"],"editorLineNumber.foreground":i["editor-line-number-foreground"],"editorLineNumber.activeForeground":i["editor-line-number-active-foreground"],"editor.selectionBackground":i["editor-selection-background"],"editor.inactiveSelectionBackground":i["editor-inactive-selection-background"],"editor.selectionHighlightBackground":i["editor-selection-highlight-background"],"editor.wordHighlightBackground":i["editor-word-highlight-background"],"editor.findMatchBackground":i["editor-find-match-background"],"editor.findMatchHighlightBackground":i["editor-find-match-highlight-background"],"editorSuggestWidget.background":i["editor-suggest-widget-background"],"editorSuggestWidget.border":i["editor-suggest-widget-border"],"editorSuggestWidget.foreground":i["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":i["editor-suggest-widget-selected-background"],"list.activeSelectionBackground":i["editor-suggest-widget-selected-background"],"editorSuggestWidget.selectedForeground":i["editor-suggest-widget-selected-foreground"],"list.activeSelectionForeground":i["editor-suggest-widget-selected-foreground"],"editorSuggestWidget.highlightForeground":i["editor-suggest-widget-highlightForeground"],"editorSuggestWidget.focusHighlightForeground":i["editor-suggest-widget-focus-highlight-foreground"],"list.hoverBackground":i["list-hover-background"],"dropdown.background":i["context-menu-background"],"dropdown.foreground":i["context-menu-foreground"],"menu.selectionBackground":i["menu-selection-background"],"menu.selectionForeground":i["menu-selection-foreground"],"keybindingLabel.foreground":i["menu-selection-foreground"],"list.focusBackground":i["menu-selection-background"],"editorWidget.background":i["editor-widget-background"],"inputOption.activeBackground":i["input-option-active-background"],"inputOption.activeForeground":i["input-option-active-foreground"],focusBorder:i["focus-border"],"input.background":i["input-background"],"input.foreground":i["input-foreground"],"input.border":i["input-border"],"textLink.foreground":i["text-link-foreground"],"textLink.activeForeground":i["text-link-active-foreground"],"editorLink.activeForeground":i["editor-link-active-foreground"],"editorBracketHighlight.foreground1":i["editor-bracket-foreground1"],"editorBracketHighlight.foreground2":i["editor-bracket-foreground2"],"editorBracketHighlight.foreground3":i["editor-bracket-foreground3"],"editorBracketHighlight.foreground4":i["editor-bracket-foreground4"],"editorBracketHighlight.foreground5":i["editor-bracket-foreground5"],"editorBracketHighlight.foreground6":i["editor-bracket-foreground6"],"editorBracketHighlight.unexpectedBracket.foreground":i["editor-unexpected-bracket-foreground"]};Gt.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:a,colors:o});try{Gt.setTheme("dh-dark")}catch(s){fn.error("Failed to set 'dh-dark' Monaco theme, falling back to vs-dark",s),Gt.setTheme("vs-dark")}}static registerGetWorker(e){window.MonacoEnvironment=kd(kd({},window.MonacoEnvironment),{},{getWorker:e})}static removeHashtag(e){var t;return(t=e==null?void 0:e.substring(1))!==null&&t!==void 0?t:""}static registerLanguages(e){var t=e.map(n=>{var{id:i}=n;return i});an.getLanguages().filter(n=>{var{id:i}=n;return t.includes(i)}).forEach(n=>{var i=n;fn.debug2("Overriding default language loader:",i.id)}),e.forEach(n=>{wn.registerLanguage(n)})}static registerLanguage(e){fn.debug2("Registering language: ",e.id),an.register(e),an.onLanguage(e.id,()=>{an.setLanguageConfiguration(e.id,e.conf),an.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gt.EndOfLineSequence.LF;(t=e.getModel())===null||t===void 0||t.setEOL(n)}static openDocument(e,t){var n=e.getModel();I(n);var i={textDocument:{uri:"".concat(n.uri),languageId:n.getLanguageId(),version:n.getVersionId(),text:n.getValue()}};fn.debug2("didOpenDocumentParams: ",i),t.openDocument(i);var a=e.onDidChangeModelContent(o=>{for(var{changes:s,versionId:l}=o,d=[],u=0;u<s.length;u+=1){var c=s[u],{range:m,rangeLength:f,text:g}=c,v={range:{start:{line:m.startLineNumber-1,character:m.startColumn-1},end:{line:m.endLineNumber-1,character:m.endColumn-1}},rangeLength:f,text:g};d.push(v)}if(d.length>0){var p={textDocument:{version:l,uri:"".concat(n.uri)},contentChanges:d};fn.debug2("didChangeDocumentParams",p),t.changeDocument(p)}});return a}static closeDocument(e,t){var n=e.getModel();I(n);var i={textDocument:{uri:"".concat(n.uri)}};t.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(t=>{var n=/“|”/g,i=/\u200b/g,a=/\u00A0/g,o=e.getModel();I(o);var s=o.getValueInRange(t.range);(n.test(s)||i.test(s)||a.test(s))&&o.applyEdits([{range:t.range,text:s.replace(n,'"').replace(i,"").replace(a," ")}])})}static isMacPlatform(){var{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(){Gt.addKeybindingRule({keybinding:wt.CtrlCmd|Xn.KeyD,command:null}),wn.isMacPlatform()||Gt.addKeybindingRule({keybinding:wt.CtrlCmd|Xn.KeyH,command:null})}static disableKeyBindings(e,t){e.addAction({id:"disable-keybindings-".concat(Ue()),label:"",keybindings:t,run:()=>{}})}static getMonacoKeyCodeFromShortcut(e){var{keyState:t}=e,{keyValue:n}=t;if(n===null)return 0;var i=wn.isMacPlatform();return i?(t.metaKey?wt.CtrlCmd:0)|(t.shiftKey?wt.Shift:0)|(t.altKey?wt.Alt:0)|(t.ctrlKey?wt.WinCtrl:0)|ol.fromString(n):(t.ctrlKey?wt.CtrlCmd:0)|(t.shiftKey?wt.Shift:0)|(t.altKey?wt.Alt:0)|(t.metaKey?wt.WinCtrl:0)|ol.fromString(n)}static provideLinks(e){for(var t=[],n=function(o){var s=e.getLineContent(o),l=Ph(s),d=l.filter(u=>u.type==="url"?/^https?:\/\//.test(u.value):!0);d.forEach(u=>{t.push({url:u.href,range:new _f(o,u.start+1,o,u.end+1)})})},i=1;i<=e.getLineCount();i+=1)n(i);return{links:t}}}const Tt=wn;function _o(r,e,t){return e=jE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jE(r){var e=$E(r,"string");return typeof e=="symbol"?e:String(e)}function $E(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var vn=z.module("MonacoCompletionProvider");class lr extends b.PureComponent{static lspToMonacoKind(e){var t=an.CompletionItemKind;switch(e){case 1:return t.Text;case 2:return t.Method;case 3:return t.Function;case 4:return t.Constructor;case 5:return t.Field;case 6:return t.Variable;case 7:return t.Class;case 8:return t.Interface;case 9:return t.Module;case 10:return t.Property;case 11:return t.Unit;case 12:return t.Value;case 13:return t.Enum;case 14:return t.Keyword;case 15:return t.Snippet;case 16:return t.Color;case 17:return t.File;case 18:return t.Reference;case 19:return t.Folder;case 20:return t.EnumMember;case 21:return t.Constant;case 22:return t.Struct;case 23:return t.Event;case 24:return t.Operator;case 25:return t.TypeParameter;default:return t.Variable}}static lspToMonacoRange(e){var{start:t,end:n}=e;return{startLineNumber:t.line+1,startColumn:t.character+1,endLineNumber:n.line+1,endColumn:n.character+1}}static monacoToLspPosition(e){return{line:e.lineNumber-1,character:e.column-1}}constructor(e){super(e),_o(this,"registeredCompletionProvider",void 0),_o(this,"registeredSignatureProvider",void 0),_o(this,"registeredHoverProvider",void 0),this.handleCompletionRequest=this.handleCompletionRequest.bind(this),this.handleSignatureRequest=this.handleSignatureRequest.bind(this),this.handleHoverRequest=this.handleHoverRequest.bind(this)}componentDidMount(){var{language:e,session:t}=this.props;this.registeredCompletionProvider=an.registerCompletionItemProvider(e,{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:[".",'"',"'"]}),t.getSignatureHelp!=null&&(this.registeredSignatureProvider=an.registerSignatureHelpProvider(e,{provideSignatureHelp:this.handleSignatureRequest,signatureHelpTriggerCharacters:["(",","]})),t.getHover!=null&&(this.registeredHoverProvider=an.registerHoverProvider(e,{provideHover:this.handleHoverRequest}))}componentWillUnmount(){var e,t,n;(e=this.registeredCompletionProvider)===null||e===void 0||e.dispose(),(t=this.registeredSignatureProvider)===null||t===void 0||t.dispose(),(n=this.registeredHoverProvider)===null||n===void 0||n.dispose()}handleCompletionRequest(e,t,n){var{model:i,session:a}=this.props;if(e!==i)return null;var o={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:lr.monacoToLspPosition(t),context:n},s=a.getCompletionItems(o);vn.debug("Requested completion items",o);var l=s.then(d=>{vn.debug("Completion items received: ",o,d);var u=d.map(c=>{var{label:m,kind:f,detail:g,documentation:v,sortText:p,filterText:C,textEdit:S,insertTextFormat:y}=c;return{label:m,kind:lr.lspToMonacoKind(f),detail:g,documentation:(v==null?void 0:v.kind)==="markdown"?v:v==null?void 0:v.value,sortText:p,filterText:C,insertText:S.text,insertTextRules:y===2?4:y,range:lr.lspToMonacoRange(S.range)}});return{incomplete:!0,suggestions:u}}).catch(d=>(vn.error("There was an error retrieving completion items",d),{suggestions:[]}));return l}handleSignatureRequest(e,t,n,i){var a={value:{signatures:[],activeSignature:0,activeParameter:0},dispose:()=>{}},{model:o,session:s}=this.props;if(e!==o||s.getSignatureHelp==null)return null;var l={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:lr.monacoToLspPosition(t),context:i},d=s.getSignatureHelp(l);vn.debug("Requested signature help",l);var u=d.then(c=>{vn.debug("Signatures received: ",l,d);var m=c.map(g=>{var{label:v,documentation:p,parameters:C}=g;return{documentation:(p==null?void 0:p.kind)==="markdown"?p:p==null?void 0:p.value,label:v,parameters:C??[]}});if(m.length===0)return a;var f=0;return{value:{signatures:m,activeSignature:f,activeParameter:c[f].activeParameter},dispose:()=>{}}}).catch(c=>(vn.error("There was an error retrieving completion items",c),a));return u}handleHoverRequest(e,t){var{model:n,session:i}=this.props;if(e!==n||i.getHover==null)return null;var a={textDocument:{uri:"".concat(e.uri),version:e.getVersionId()},position:lr.monacoToLspPosition(t)},o=i.getHover(a);vn.debug("Requested hover",a);var s=o.then(l=>{vn.debug("Hover received: ",a,l);var{contents:d}=l;return{contents:d!=null?[d]:[]}}).catch(l=>(vn.error("There was an error retrieving hover",l),{contents:[]}));return s}render(){return null}}const Qc=lr;function jd(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function HE(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){jd(a,n,i,o,s,"next",l)}function s(l){jd(a,n,i,o,s,"throw",l)}o(void 0)})}}function St(r,e,t){return e=VE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function VE(r){var e=UE(r,"string");return typeof e=="symbol"?e:String(e)}function UE(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Oo=z.module("ConsoleInput"),xa=parseInt(ts["line-height"],10),Jc=6,em=6,BE=xa+Jc+em,Do=100;class Wi extends b.PureComponent{constructor(e){super(e),St(this,"cancelListener",void 0),St(this,"resizeObserver",void 0),St(this,"commandContainer",void 0),St(this,"commandEditor",void 0),St(this,"commandHistoryIndex",void 0),St(this,"commandSuggestionContainer",void 0),St(this,"loadingPromise",void 0),St(this,"timestamp",void 0),St(this,"bufferIndex",void 0),St(this,"history",void 0),St(this,"modifiedCommands",void 0),this.handleResize=this.handleResize.bind(this),this.commandContainer=Z.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.resizeObserver=new window.ResizeObserver(this.handleResize),this.state={commandEditorHeight:xa,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){this.resizeObserver.disconnect(),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(e){if(Oo.debug("Command received: ",e),!n){var i;this.commandHistoryIndex=null,(i=this.commandEditor)===null||i===void 0||i.setValue(e)}t&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(e)}}initCommandEditor(){var{language:e,session:t}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:e,lineHeight:xa,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:Jc,bottom:em},value:"",wordWrap:"on"},i=this.commandContainer.current;I(i),this.commandEditor=Gt.create(i,n),Tt.setEOL(this.commandEditor),Tt.openDocument(this.commandEditor,t),this.commandEditor.onDidChangeModelContent(()=>{var a,o=(a=this.commandEditor)===null||a===void 0?void 0:a.getValue();this.modifiedCommands.set(this.commandHistoryIndex,o??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(a=>{var{commandEditor:o,commandHistoryIndex:s}=this,l=o==null?void 0:o.getPosition();I(l);var{lineNumber:d}=l,u=o==null?void 0:o.getModel();if(a.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&d===1){s!=null?this.loadCommand(s+1):this.loadCommand(0),this.focusStart(),a.stopPropagation(),a.preventDefault();return}if(a.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&d===(u==null?void 0:u.getLineCount())){s!=null&&s>0?this.loadCommand(s-1):this.loadCommand(null),this.focusEnd(),a.stopPropagation(),a.preventDefault();return}if(!a.altKey&&!a.shiftKey&&!a.metaKey&&a.keyCode===Xn.Enter&&!this.isSuggestionMenuPopulated()){var c;a.stopPropagation(),a.preventDefault();var m=(c=this.commandEditor)===null||c===void 0?void 0:c.getValue().trim();if(m!==void 0){var f;this.processCommand(m),(f=this.commandEditor)===null||f===void 0||f.setValue("")}}}),Tt.disableKeyBindings(this.commandEditor,[wt.CtrlCmd|Xn.KeyF]),Tt.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.resizeObserver.observe(i),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){var{session:e}=this.props;this.commandEditor&&(Tt.closeDocument(this.commandEditor,e),this.commandEditor.dispose(),this.commandEditor=void 0)}handleResize(){this.updateDimensions()}isSuggestionMenuActive(){var e;if(!this.commandSuggestionContainer){var t,n;this.commandSuggestionContainer=(t=this.commandEditor)===null||t===void 0||(n=t.getDomNode())===null||n===void 0?void 0:n.querySelector(".suggest-widget")}return(e=this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))!==null&&e!==void 0?e:!1}isSuggestionMenuPopulated(){var e,t,n;return this.isSuggestionMenuActive()&&((e=(t=this.commandSuggestionContainer)===null||t===void 0||(n=t.querySelector(".monaco-list-rows"))===null||n===void 0?void 0:n.childElementCount)!==null&&e!==void 0?e:0)>0}focus(){var e;(e=this.commandEditor)===null||e===void 0||e.focus()}focusStart(){var e,t,n,i,a,o=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();I(o);var s=o.getLineLength(1)+1,l=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(1,s);I(l),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:1,column:s}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(l),(a=this.commandEditor)===null||a===void 0||a.focus()}focusEnd(){var e,t,n,i,a,o=(e=this.commandEditor)===null||e===void 0?void 0:e.getModel();I(o);var s=o.getLineCount(),l=o.getLineLength(s)+1,d=(t=this.commandEditor)===null||t===void 0?void 0:t.getTopForPosition(s,l);I(d),(n=this.commandEditor)===null||n===void 0||n.setPosition({lineNumber:s,column:l}),(i=this.commandEditor)===null||i===void 0||i.setScrollTop(d),(a=this.commandEditor)===null||a===void 0||a.focus()}clear(){var e,t,n;(e=this.commandEditor)===null||e===void 0||e.focus(),(t=this.commandEditor)===null||t===void 0||(n=t.getModel())===null||n===void 0||n.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(e){var t,n;if(!(e!==null&&e>=this.history.length)){var i=this.modifiedCommands.get(e),a=e===null?"":this.history[this.history.length-e-1];this.commandHistoryIndex=e,(t=this.commandEditor)===null||t===void 0||(n=t.getModel())===null||n===void 0||n.setValue(i??a),e!==null&&e>this.history.length-Do&&this.loadMoreHistory()}}loadMoreHistory(){var e=this;return HE(function*(){try{if(e.loadingPromise!=null||e.bufferIndex==null)return;var{commandHistoryStorage:t,language:n,scope:i}=e.props;e.loadingPromise=we.makeCancelable(t.getTable(n,i??"",e.timestamp),s=>s.close());var a=yield e.loadingPromise;a.setReversed(!0),a.setViewport({top:e.bufferIndex,bottom:e.bufferIndex+Do-1}),e.loadingPromise=we.makeCancelable(a.getViewportData(),()=>a.close());var o=yield e.loadingPromise;e.bufferIndex+=Do,e.bufferIndex>=a.size&&(e.bufferIndex=null),e.history=[...o.items.filter((s,l,d)=>{var{name:u}=s;return l===0||u!==d[l-1].name}).map(s=>{var{name:l}=s;return l}).reverse(),...e.history],e.loadingPromise=void 0,a.close()}catch(s){if(e.loadingPromise=void 0,we.isCanceled(s)){Oo.debug2("Promise canceled, not loading history");return}Oo.error("Error fetching history",s)}})()}processCommand(e){this.commandHistoryIndex=null,this.modifiedCommands.clear(),I(e),e!==""&&(this.history.length===0||e!==this.history[this.history.length-1])&&this.history.push(e),this.updateDimensions();var{onSubmit:t}=this.props;t(e)}updateDimensions(){if(this.commandEditor){var{maxHeight:e}=this.props;I(e);var t=this.commandEditor.getContentHeight(),n=Math.max(Math.min(t,e),BE),i=t>n,a={overviewRulerLanes:i?void 0:0};this.setState({commandEditorHeight:n},()=>{var o,s;(o=this.commandEditor)===null||o===void 0||o.updateOptions(a),(s=this.commandEditor)===null||s===void 0||s.layout()})}}render(){var{disabled:e,language:t,session:n}=this.props,{commandEditorHeight:i,isFocused:a,model:o}=this.state;return h.jsx("div",{className:J("console-input-wrapper",{disabled:e}),children:h.jsxs("div",{className:J("console-input-inner-wrapper",{focus:a}),children:[h.jsx("div",{className:Wi.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:i}}),o&&h.jsx(Qc,{model:o,language:t,session:n})]})})}}St(Wi,"defaultProps",{maxHeight:xa*10,scope:null,disabled:!1});St(Wi,"INPUT_CLASS_NAME","console-input");const $d=Wi;function Kn(r,e,t){return e=WE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function WE(r){var e=GE(r,"string");return typeof e=="symbol"?e:String(e)}function GE(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Hd="pasted values",zE=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],Mo=[".csv",".tsv",".tab",".psv",".dsv",".txt"],Vd=[".zip"];class on extends b.Component{static isValidDropItem(e){return e!=null&&e.kind==="file"&&!zE.find(t=>t.test(e.type))}static isValidExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Mo.some(n=>e.endsWith(n))||t&&Vd.some(n=>e.endsWith(n))}static handleDragOver(e){e.preventDefault(),e.stopPropagation()}static getIcon(e){return e===Hd?sl:e.endsWith(".csv")?zf:e.endsWith(".zip")?Kf:qf}constructor(e){super(e),Kn(this,"fileElem",void 0),Kn(this,"divElem",void 0),Kn(this,"getValidExtensions",oe(t=>t?[...Mo,...Vd]:[...Mo])),Kn(this,"getAcceptString",oe(t=>this.getValidExtensions(t).join(", "))),Kn(this,"getFileTypeErrorString",oe(t=>Lt.join(this.getValidExtensions(t),"or"))),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=Z.createRef(),this.divElem=Z.createRef(),this.state={selectedFileName:""}}componentDidMount(){var e,t;(e=this.divElem.current)===null||e===void 0||e.addEventListener("paste",this.handlePasteEvent),(t=this.divElem.current)===null||t===void 0||t.focus()}componentWillUnmount(){var e;(e=this.divElem.current)===null||e===void 0||e.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){if(this.fileElem.current){var e;this.fileElem.current.value="",(e=this.fileElem.current)===null||e===void 0||e.click()}}handleFiles(e){e.stopPropagation(),e.preventDefault();var{files:t}=e.target;t!=null&&this.handleFile(t[0])}handleDrop(e){var{allowZip:t,clearDragError:n,dragError:i}=this.props;if(e.preventDefault(),e.stopPropagation(),i!=null){n();return}if(!(e.dataTransfer==null||e.dataTransfer.items==null||e.dataTransfer.items.length===0)){var a=e.dataTransfer.items[0].getAsFile();I(a),on.isValidExtension(a.name,t)?this.handleFile(a):this.setState({dropError:on.FILE_TYPE_ERROR})}}unstageFile(e){var{onCancel:t}=this.props;e.stopPropagation(),e.preventDefault(),t(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(e){var{onFileOpened:t}=this.props;t(e),this.setState({selectedFileName:e.name,dropError:void 0})}handleMenuPaste(){var{onPaste:e,onError:t,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(i=>{e(i),this.setState({selectedFileName:Hd,dropError:void 0})}).catch(i=>t(i))}handlePasteEvent(e){e.stopPropagation(),e.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){var{uploadInProgress:e}=this.props;return[{title:"Paste",icon:sl,action:this.handleMenuPaste,shortcut:Pn.PASTE,disabled:e}]}render(){var{allowZip:e,dragError:t,uploadInProgress:n}=this.props,{selectedFileName:i,dropError:a}=this.state,o=t??a,s=this.makeContextMenuItems();return h.jsxs("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:on.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[h.jsx(fe,{actions:s}),h.jsx("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(e),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!i&&(o===void 0||o==="")&&h.jsxs("div",{className:"message-content",children:[h.jsx("div",{className:"message-icon",children:h.jsx(ue,{icon:Xf})}),h.jsx("label",{children:"Drop file (or paste values) here to import"}),h.jsx("div",{className:"message-small",children:h.jsx("label",{children:"or"})}),h.jsx(Y,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),i&&(o===void 0||o==="")&&h.jsxs("div",{className:"selected-content",children:[h.jsx("div",{className:"selected-icon",children:h.jsx(ue,{icon:on.getIcon(i)})}),h.jsxs("div",{className:"selected-text",children:[h.jsx("label",{children:"Selected File"}),h.jsxs("label",{className:"selected-name",children:[i,!n&&h.jsx(Y,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:ki,tooltip:"Remove"})]})]})]}),!!o&&h.jsxs("div",{className:"message-content",children:[h.jsx("div",{className:"message-icon",children:h.jsx(ue,{icon:vs})}),h.jsx("label",{children:o}),o===on.FILE_TYPE_ERROR&&h.jsx("div",{className:"message-small",children:h.jsx("label",{children:this.getFileTypeErrorString(e)})})]})]})}}Kn(on,"defaultProps",{allowZip:!1,dragError:null});Kn(on,"MULTIPLE_FILE_ERROR","Please select only one file");Kn(on,"FILE_TYPE_ERROR","Filetype not supported.");const Mr=on;function br(r,e,t){return e=KE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function KE(r){var e=qE(r,"string");return typeof e=="symbol"?e:String(e)}function qE(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class er{}br(er,"INTEGER","int");br(er,"LONG","long");br(er,"DOUBLE","double");br(er,"BOOLEAN","bool");br(er,"STRING","string");br(er,"DATE_TIME","datetime");br(er,"LOCAL_TIME","localtime");const Ce=er;function tm(r,e){var t=r.internalStream("string");return t.readable=!0,t.read=()=>!1,t.removeListener=()=>!1,t.on("data",(n,i)=>e(i)),t}function Ud(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Bd(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ud(Object(t),!0).forEach(function(n){dt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ud(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function dt(r,e,t){return e=XE(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function XE(r){var e=ZE(r,"string");return typeof e=="symbol"?e:String(e)}function ZE(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Wd="unknown",YE=2147483647,QE=-2147483648,Gd=/^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/,zd=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class it{static determineType(e,t,n){if(!e||e===n)return t;switch(t){case Ce.STRING:return Ce.STRING;case Ce.INTEGER:return it.checkInteger(e);case Ce.LONG:return it.checkLong(e);case Ce.DOUBLE:return it.checkDouble(e);case Ce.BOOLEAN:return it.checkBoolean(e);case Ce.DATE_TIME:return it.checkDateTime(e);case Ce.LOCAL_TIME:return it.checkLocalTime(e);default:return it.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){var t=e.replace(/,/g,"");return it.isNotParsableNumber(t)?Ce.STRING:it.getNumberType(t)}static checkLong(e){var t=e.replace(/,/g,"");return it.isNotParsableNumber(t)?Ce.STRING:t.includes(".")?Ce.DOUBLE:Ce.LONG}static checkDouble(e){var t=e.replace(/,/g,"");return it.isNotParsableNumber(t)?Ce.STRING:Ce.DOUBLE}static checkBoolean(e){var t=e.toLowerCase();return t==="true"||t==="false"?Ce.BOOLEAN:Ce.STRING}static checkDateTime(e){return Gd.test(e)?Ce.DATE_TIME:Ce.STRING}static checkLocalTime(e){return zd.test(e)?Ce.LOCAL_TIME:Ce.STRING}static getTypeFromUnknown(e){var t=e.replace(/,/g,"");if(it.isNotParsableNumber(t)){var n=e.toLowerCase();return n==="true"||n==="false"?Ce.BOOLEAN:Gd.test(e)&&e.includes(":")?Ce.DATE_TIME:zd.test(e)?Ce.LOCAL_TIME:Ce.STRING}return it.getNumberType(t)}static getNumberType(e){if(e.includes("."))return Ce.DOUBLE;var t=e.startsWith("-")?11:10;if(e.length>t)return Ce.LONG;var n=parseInt(e,10);return n>YE||n<QE?Ce.LONG:Ce.INTEGER}constructor(e,t,n,i,a,o,s,l,d,u){dt(this,"onFileCompleted",void 0),dt(this,"file",void 0),dt(this,"readHeaders",void 0),dt(this,"nullString",void 0),dt(this,"onProgress",void 0),dt(this,"onError",void 0),dt(this,"types",void 0),dt(this,"chunks",void 0),dt(this,"totalChunks",void 0),dt(this,"rowCount",void 0),dt(this,"isZip",void 0),dt(this,"shouldTrim",void 0),dt(this,"zipProgress",void 0),dt(this,"config",void 0),this.onFileCompleted=e,this.file=t,this.readHeaders=n,this.nullString=a,this.onProgress=o,this.onError=s,this.chunks=0,this.totalChunks=l,this.rowCount=0,this.isZip=d,this.shouldTrim=u,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config=Bd(Bd({},i),{},{error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete})}parse(){if(this.file instanceof File||this.file instanceof Blob)Si.parse(this.file,this.config);else{var e=tm(this.file,this.handleNodeUpdate);Si.parse(e,this.config),e.resume()}}handleChunk(e,t){var{data:n}=e;if(!this.types){if(n==null||n.length===0){t.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(n[0].length).fill(Wd),this.readHeaders&&(n=n.slice(1))}this.rowCount+=n.length,I(this.types);var i=[...this.types];n.forEach(s=>{if(s.length>=i.length){for(var l=0;l<i.length;l+=1)i[l]=it.determineType(this.shouldTrim?s[l].trim():s[l],i[l],this.nullString);this.types=i}else t.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
|
|
4
4
|
Expected length `.concat(i.length," but found ").concat(s.length,`.
|
|
5
5
|
Row = `).concat(s))}),this.chunks+=1;var a=0;this.totalChunks>0?a=Math.round(this.chunks/this.totalChunks*50):a=Math.round(this.zipProgress/2);var o=this.onProgress(a);o&&t.abort()}handleComplete(e){var{types:t,onFileCompleted:n}=this;I(t),(e==null||!e.meta.aborted)&&n(t.map(i=>i===Wd||i===Ce.LOCAL_TIME?Ce.STRING:i),this.rowCount)}handleError(e){var{onError:t}=this;t(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const JE=it;function Ie(r,e,t){return e=e0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function e0(r){var e=t0(r,"string");return typeof e=="symbol"?e:String(e)}function t0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var sa=z.module("CsvParser"),n0=650;class Br{static generateHeaderRecursive(e){var t="",n=e;return e>=26&&(t=t.concat(Br.generateHeaderRecursive(Math.floor(e/26)-1)),n=e%26),t.concat(String.fromCharCode(65+n))}constructor(e){var{onFileCompleted:t,session:n,file:i,type:a,readHeaders:o=!0,onProgress:s,onError:l,timeZone:d,isZip:u}=e;Ie(this,"onFileCompleted",void 0),Ie(this,"session",void 0),Ie(this,"file",void 0),Ie(this,"isZip",void 0),Ie(this,"type",void 0),Ie(this,"readHeaders",void 0),Ie(this,"timeZone",void 0),Ie(this,"onProgress",void 0),Ie(this,"onError",void 0),Ie(this,"tables",void 0),Ie(this,"headers",void 0),Ie(this,"types",void 0),Ie(this,"rowCount",void 0),Ie(this,"rowsProcessed",void 0),Ie(this,"chunks",void 0),Ie(this,"totalChunks",void 0),Ie(this,"isComplete",void 0),Ie(this,"zipProgress",void 0),Ie(this,"consolidatedChunks",void 0),Ie(this,"numConsolidated",void 0),Ie(this,"isCancelled",void 0),Ie(this,"config",void 0),this.onFileCompleted=t,this.session=n,this.file=i,this.isZip=u,this.type=a,this.readHeaders=o,this.timeZone=d,this.onProgress=s,this.onError=l,this.tables=[],this.rowCount=0,this.rowsProcessed=0,this.chunks=0,this.totalChunks=u?0:Math.ceil(i.size/Si.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:a.delimiter,newline:a.newline,escapeChar:a.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:a.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(e,t){for(var n=t.length,i=new Array(e).fill(null).map(()=>new Array(n)),a=0;a<n;a+=1){var o=t[a];if(o.length<e)throw new Error("Insufficient columns. Expected ".concat(e," but found ").concat(o.length,`
|
|
@@ -21,9 +21,9 @@ Row = `).concat(s))}),this.chunks+=1;var a=0;this.totalChunks>0?a=Math.round(thi
|
|
|
21
21
|
`)}this.bufferedMessages=[],this.appendLogText(e)}queue(e){this.bufferedMessages.push(e),this.bufferedMessages.length===1&&(this.flushTimer=setTimeout(this.handleFlushTimeout,$e.bufferTimeout))}stopFlushTimer(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=void 0)}updateDimensions(){this.editor&&this.editor.layout()}handleClearClick(){this.clearLogs()}clearLogs(){this.messages=[],this.refreshLogText()}handleFlushTimeout(){this.stopFlushTimer(),this.flush()}handleLogMessage(e){this.messages.push(e),this.editor&&this.isLogItemVisible(e)&&this.queue(e)}handleMenuItemClick(e){this.toggleLogLevel(e)}handleResetClick(){this.resetLogLevels()}handleResize(){this.updateDimensions()}handleToggleAllClick(){this.toggleAll()}render(){var e={placement:"bottom-end"},{shownLogLevels:t}=this.state,n=this.getMenuActions(t);return h.jsxs("div",{className:"log-pane h-100 w-100",children:[h.jsxs("div",{className:"log-pane-menu",children:[h.jsx(Y,{kind:"ghost",className:"btn-clear-logs",onClick:this.handleClearClick,icon:Yf,tooltip:"Clear log"}),h.jsx(Y,{kind:"ghost",className:"btn-link-icon btn-overflow",icon:Va,tooltip:"Log Settings",onClick:()=>{},children:h.jsx(kr,{actions:n,popperClassName:"log-level-menu-popper",popperOptions:e})})]}),h.jsx("div",{className:"log-pane-editor h-100 w-100",ref:i=>{this.editorContainer=i}})]})}}Pt($e,"DefaultLogLevels",[et.STDOUT,et.ERROR,et.FATAL,et.STDERR,et.WARN]);Pt($e,"AllLogLevels",[et.INFO,et.STDOUT,et.ERROR,et.FATAL,et.STDERR,et.WARN,et.DEBUG,et.TRACE]);Pt($e,"bufferTimeout",16);Pt($e,"maxLogSize",131072);Pt($e,"truncateSize",65536);const z0=$e;function iu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function K0(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){iu(a,n,i,o,s,"next",l)}function s(l){iu(a,n,i,o,s,"throw",l)}o(void 0)})}}var q0=z.module("HeapUsage");function X0(r){var e,{connection:t,defaultUpdateInterval:n,hoverUpdateInterval:i,bgMonitoring:a=!0,monitorDuration:o}=r,s=Ob(),[l,d]=b.useState({freeMemory:0,maximumHeapSize:999,totalHeapSize:0}),[u,c]=b.useState(!1),m=b.useRef({timestamps:[],usages:[]}),f=Uh(),g=b.useCallback(K0(function*(){try{var H=yield t.getWorkerHeapInfo();if(!f.current)return;if(d(H),a||u){for(var W=(H.totalHeapSize-H.freeMemory)/H.maximumHeapSize,X=Date.now(),{timestamps:le,usages:me}=m.current;le.length!==0&&X-le[0]>o*1.5;)le.shift(),me.shift();le.push(X),me.push(W)}else m.current={timestamps:[],usages:[]}}catch(ve){q0.warn("Unable to get heap usage",ve)}}),[t,f,a,u,o]);lp(g,u?i:n);var v=(H,W)=>Math.round(H*10**W)/10**W,p=2,C=1024**3,{freeMemory:S,totalHeapSize:y,maximumHeapSize:w}=l,E=v(S/C,p),D=v(y/C,p),M=v(w/C,p),_=D-E,T=function(W,X){var le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return h.jsxs("div",{className:J("heap-usage-info-row",{"heading-bottom-border":le}),children:[h.jsx("div",{className:"font-weight-bold",children:W}),h.jsx("div",{children:X})]})},{timestamps:N,usages:x}=m.current,F=(e=N[N.length-1])!==null&&e!==void 0?e:0,k=y/w,U=(y-S)/w;return h.jsxs("div",{className:"max-memory",children:[h.jsx("div",{className:"total-memory",style:{width:"calc(".concat(k*100,"% - ").concat(k*2,"px")}}),h.jsx("div",{className:J("used-memory",{"heap-overflow":(y-S)/w>.95}),style:{width:"calc(".concat(U*100,"% - ").concat(U*2,"px")}}),h.jsxs("div",{className:"memory-text",children:[M.toFixed(1)," GB"]}),h.jsx(On,{onEntered:()=>c(!0),onExited:()=>c(!1),interactive:!0,children:h.jsxs("div",{className:"heap-tooltip",children:[T("In use:","".concat(_.toFixed(p)," of ").concat(M.toFixed(p)," GB"),!0),T("Free:","".concat(E.toFixed(p)," GB")),T("Total:","".concat(D.toFixed(p)," GB")),T("Max:","".concat(M.toFixed(p)," GB")),h.jsx("div",{className:"heap-plot",children:h.jsx(_b,{data:[{x:[...N],y:[...x],type:"scatter",mode:"lines"}],config:{staticPlot:!0,responsive:!0},style:{width:"196px",height:"100px"},layout:{margin:{l:2,t:2,r:2,b:2},plot_bgcolor:"transparent",paper_bgcolor:"transparent",colorway:["#4878ea"],xaxis:{dtick:Math.round(o/6),gridcolor:s.linecolor,range:[F-o,F],linecolor:s.linecolor,linewidth:2,mirror:!0},yaxis:{dtick:.2,gridcolor:s.linecolor,range:[0,1],linecolor:s.linecolor,linewidth:2,mirror:!0}}})}),h.jsxs("div",{className:"heap-utilisation-text",children:["% utilization over ",Math.round(o/1e3/60)," min."]})]})})]})}function Z0(r,e,t){return e=Y0(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Y0(r){var e=Q0(r,"string");return typeof e=="symbol"?e:String(e)}function Q0(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class J0 extends Error{constructor(){super(...arguments),Z0(this,"isMissingPartitionError",!0)}}function eP(r){return(r==null?void 0:r.isMissingPartitionError)===!0}const au=J0;function Io(r,e,t){return e=tP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tP(r){var e=nP(r,"string");return typeof e=="symbol"?e:String(e)}function nP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class rP extends Error{constructor(e,t){super("".concat(t," can't be empty (on pending row ").concat(e+1,")")),Io(this,"isMissingKey",!0),Io(this,"rowIndex",void 0),Io(this,"columnName",void 0),this.rowIndex=e,this.columnName=t}}const iP=rP;function ou(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function da(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ou(Object(t),!0).forEach(function(n){he(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ou(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function su(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Ln(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){su(a,n,i,o,s,"next",l)}function s(l){su(a,n,i,o,s,"throw",l)}o(void 0)})}}function he(r,e,t){return e=aP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function aP(r){var e=oP(r,"string");return typeof e=="symbol"?e:String(e)}function oP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var xe=z.module("IrisGridTableModelTemplate"),sP=150,lP=0;function ur(r){return r.table!==void 0}class Fi extends ce{seekRow(e,t,n,i,a,o,s){throw new Error("Method not implemented.")}export(){throw new Error("Method not implemented.")}columnStatistics(e){throw new Error("Method not implemented.")}get customColumns(){return[]}set customColumns(e){throw new Error("Method not implemented.")}get formatColumns(){return[]}set formatColumns(e){throw new Error("Method not implemented.")}updateFrozenColumns(e){throw new Error("Method not implemented.")}get rollupConfig(){throw new Error("Method not implemented.")}set rollupConfig(e){throw new Error("Method not implemented.")}get selectDistinctColumns(){throw new Error("Method not implemented.")}set selectDistinctColumns(e){throw new Error("Method not implemented.")}get columns(){return this.table.columns}constructor(e,t){var n,i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Zt(e),o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;super(e),he(this,"dh",void 0),he(this,"irisGridUtils",void 0),he(this,"tableUtils",void 0),he(this,"irisFormatter",void 0),he(this,"inputTable",void 0),he(this,"subscription",void 0),he(this,"table",void 0),he(this,"viewport",void 0),he(this,"viewportData",void 0),he(this,"formattedStringData",void 0),he(this,"pendingStringData",void 0),he(this,"isSaveInProgress",void 0),he(this,"totalsTable",void 0),he(this,"totalsTablePromise",void 0),he(this,"totals",void 0),he(this,"totalsDataMap",void 0),he(this,"pendingNewDataMap",void 0),he(this,"pendingNewRowCount",0),he(this,"_columnHeaderGroupMap",new Map),he(this,"columnHeaderParentMap",new Map),he(this,"_columnHeaderMaxDepth",null),he(this,"_columnHeaderGroups",[]),he(this,"_movedColumns",null),he(this,"getMemoizedInitialMovedColumns",oe(s=>{var l,d,u,c;if(!s)return[];var m=[],{groupMap:f}=Ne.parseColumnHeaderGroups(this,(l=s==null?void 0:s.columnGroups)!==null&&l!==void 0?l:[]),g=(_,T)=>{var N=this.getColumnIndexByName(_);if(N==null)throw new Error("Unknown layout hint column: ".concat(_));var x=ee.getVisibleIndex(N,m);m=ee.moveItem(x,T,m)},v=(_,T)=>{var N=f.get(_);if(N==null)throw new Error("Unknown layout hint group: ".concat(_));var x=N.getVisibleRange(m);m=ee.moveRange(x,T,m)},p=(d=s.frontColumns)!==null&&d!==void 0?d:[],C=(u=s.backColumns)!==null&&u!==void 0?u:[],S=(c=s.frozenColumns)!==null&&c!==void 0?c:[];if(p.length>0||C.length>0||S.length>0){var y=new Set,w=0;S==null||S.forEach(_=>{if(y.has(_))throw new Error("Column specified in multiple layout hints: ".concat(_));g(_,w),w+=1}),p.forEach(_=>{if(y.has(_))throw new Error("Column specified in multiple layout hints: ".concat(_));g(_,w),w+=1});var E=this.columnMap.size-1;C==null||C.forEach(_=>{if(y.has(_))throw new Error("Column specified in multiple layout hints: ".concat(_));g(_,E),E-=1})}var D=s==null?void 0:s.columnGroups;if(D){var M=[...f.values()];M.sort((_,T)=>_.depth-T.depth),M.forEach(_=>{var T=_.children[0],N=this.getColumnIndexByName(T),x;if(N!=null)x=ee.getVisibleIndex(N,m);else{var F=f.get(T);if(!F)throw new Error("Unknown column ".concat(T," in group ").concat(_.name));var k=F.getVisibleRange(m);[,x]=k}for(var U=1;U<_.children.length;U+=1){var H=_.children[U],W=f.get(H),X=this.getColumnIndexByName(H);if(W){var le=W.getVisibleRange(m)[0]<x,me=le?x-W.childIndexes.length+1:x+1;v(H,me),x=me+W.childIndexes.length-1}else if(X!=null){var ve=ee.getVisibleIndex(X,m)<x,j=ve?x:x+1;g(H,j),x=j}}})}return this._movedColumns=m,m})),he(this,"getMemoizedInitialColumnHeaderGroups",oe(s=>{var l;return Ne.parseColumnHeaderGroups(this,(l=s==null?void 0:s.columnGroups)!==null&&l!==void 0?l:[]).groups})),he(this,"getMemoizedColumnMap",oe(s=>{var l=new Map;return s.forEach(d=>l.set(d.name,d)),l})),he(this,"getColumnIndicesByNameMap",oe(s=>{var l=new Map;return s.forEach((d,u)=>{var{name:c}=d;return l.set(c,u)}),l})),he(this,"setViewport",Ta((s,l,d)=>{if(l<s){xe.error("Invalid viewport",s,l);return}var{viewport:u}=this;if(u!=null&&u.top===s&&u.bottom===l&&u.columns===d){xe.debug2("Ignoring duplicate viewport",u);return}this.viewport={top:s,bottom:l,columns:d},xe.debug2("setViewport",this.viewport),this.applyViewport()},sP)),he(this,"applyViewport",Ta(()=>{if(this.viewport){xe.debug2("applyViewport",this.viewport);var{top:s,bottom:l,columns:d}=this.viewport,[u,c]=this.getCachedViewportRowRange(s,l);this.applyBufferedViewport(u,c,d)}},lP,{leading:!1})),he(this,"getCachedFormattedString",Zo((s,l,d,u,c)=>s.getFormattedString(l,d,u,c),{max:1e4})),he(this,"getCachedCustomColumnFormatFlag",Zo($o.isCustomColumnFormatDefined,{max:1e4})),he(this,"getCachedViewportRowRange",oe((s,l)=>{var d=l-s,u=Math.max(0,s-d*Fi.ROW_BUFFER_PAGES),c=l+d*Fi.ROW_BUFFER_PAGES;return[u,c]})),he(this,"getCachedPendingErrors",oe((s,l,d)=>{var u=new Map;return s.forEach((c,m)=>{for(var{data:f}=c,g=0;g<d;g+=1)if(!f.has(g)){var v;u.has(m)||u.set(m,[]),(v=u.get(m))===null||v===void 0||v.push(new iP(m,l[g].name))}}),u})),this.handleTableDisconnect=this.handleTableDisconnect.bind(this),this.handleTableReconnect=this.handleTableReconnect.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this),this.handleTotalsUpdate=this.handleTotalsUpdate.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.dh=e,this.irisFormatter=a,this.irisGridUtils=new Ne(e),this.inputTable=o,this.subscription=null,this.table=t,this.tableUtils=new P(e),this.viewport=null,this.viewportData=null,this.formattedStringData=[],this.pendingStringData=[],this.isSaveInProgress=!1,this.totalsTable=null,this.totalsTablePromise=null,this.totals=null,this.totalsDataMap=null,this.pendingNewDataMap=new Map,this.pendingNewRowCount=0,this.columnHeaderGroups=Ne.parseColumnHeaderGroups(this,(n=(i=this.layoutHints)===null||i===void 0?void 0:i.columnGroups)!==null&&n!==void 0?n:[]).groups}close(){this.table.close(),this.totalsTable!==null&&this.totalsTable.close(),this.totalsTablePromise!==null&&this.totalsTablePromise.cancel()}startListening(){super.startListening();var{dh:e}=this;this.table.addEventListener(e.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.addEventListener(e.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.addEventListener(e.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.addEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.addEventListener(e.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable),this.applyViewport()}stopListening(){super.stopListening();var{dh:e}=this;this.table.removeEventListener(e.Table.EVENT_DISCONNECT,this.handleTableDisconnect),this.table.removeEventListener(e.Table.EVENT_RECONNECT,this.handleTableReconnect),this.table.removeEventListener(e.Table.EVENT_UPDATED,this.handleTableUpdate),this.table.removeEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed),this.table.removeEventListener(e.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleCustomColumnsChanged),this.totalsTable!=null&&this.removeTotalsListeners(this.totalsTable),this.closeSubscription()}addTotalsListeners(e){var{dh:t}=this;e.addEventListener(t.Table.EVENT_UPDATED,this.handleTotalsUpdate),e.setViewport(0,0)}removeTotalsListeners(e){var{dh:t}=this;e.removeEventListener(t.Table.EVENT_UPDATED,this.handleTotalsUpdate)}handleTableDisconnect(){this.dispatchEvent(new Te(ce.EVENT.DISCONNECT))}handleTableReconnect(){this.dispatchEvent(new Te(ce.EVENT.RECONNECT))}handleTableUpdate(e){this.copyViewportData(e.detail),this.dispatchEvent(new Te(ce.EVENT.UPDATED))}handleTotalsUpdate(e){this.copyTotalsData(e.detail),this.dispatchEvent(new Te(ce.EVENT.UPDATED))}handleRequestFailed(e){this.dispatchEvent(new Te(ce.EVENT.REQUEST_FAILED,e))}handleCustomColumnsChanged(){this.dispatchEvent(new Te(ce.EVENT.COLUMNS_CHANGED,{detail:this.columns}))}get rowCount(){var e,t,n;return Math.max(this.table.size,0)+this.pendingNewRowCount+((e=(t=this.totals)===null||t===void 0||(n=t.operationOrder)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:0)}get pendingDataErrors(){var e,t;return this.getCachedPendingErrors(this.pendingNewDataMap,this.columns,(e=(t=this.inputTable)===null||t===void 0?void 0:t.keyColumns.length)!==null&&e!==void 0?e:0)}get pendingDataMap(){return this.pendingNewDataMap}set pendingDataMap(e){e!==this.pendingNewDataMap&&(e.forEach((t,n)=>{if(!Ne.isValidIndex(n))throw new Error("Invalid rowIndex ".concat(n));var{data:i}=t;i.forEach((a,o)=>{if(!Ne.isValidIndex(o))throw new Error("Invalid columnIndex ".concat(o))})}),this.pendingNewDataMap=e,this.pendingNewRowCount=Math.max(this.pendingNewRowCount,this.maxPendingDataRow),this.formattedStringData=[],this.dispatchEvent(new Te(ce.EVENT.PENDING_DATA_UPDATED)))}get pendingRowCount(){return this.pendingNewRowCount}set pendingRowCount(e){e!==this.pendingNewRowCount&&(this.pendingNewRowCount=Math.max(0,e,this.maxPendingDataRow),this.dispatchEvent(new Te(ce.EVENT.UPDATED)))}get maxPendingDataRow(){return this.pendingNewDataMap.size>0?Math.max(...this.pendingNewDataMap.keys())+1:0}get columnCount(){return this.columns.length}get floatingBottomRowCount(){var e,t,n;return this.totals!=null&&this.totals.showOnTop?0:(e=(t=this.totals)===null||t===void 0||(n=t.operationOrder)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:0}get floatingTopRowCount(){var e,t,n;return this.totals!=null&&this.totals.showOnTop&&(e=(t=this.totals)===null||t===void 0||(n=t.operationOrder)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:0}get isChartBuilderAvailable(){return!0}get isTotalsAvailable(){return this.table.getTotalsTable!=null}get isEditable(){return!this.isSaveInProgress&&this.inputTable!=null}cacheFormattedValue(e,t,n){this.formattedStringData[e]==null&&(this.formattedStringData[e]=[]),this.formattedStringData[e][t]=n}cachePendingValue(e,t,n){this.pendingStringData[e]==null&&(this.pendingStringData[e]=[]),this.pendingStringData[e][t]=n}clearPendingValue(e,t){var n=this.pendingStringData[e];n!=null&&delete n[t]}textValueForCell(e,t){var n,i;if(((n=this.pendingStringData[e])===null||n===void 0?void 0:n[t])!==void 0)return this.pendingStringData[e][t];if(((i=this.formattedStringData[e])===null||i===void 0?void 0:i[t])===void 0){var a=this.valueForCell(e,t);if(a===null)return null;if(a===void 0)return;var o=this.sourceColumn(e,t),s=this.getCachedCustomColumnFormatFlag(this.formatter,o.name,o.type),l;if(!s){var d=this.formatForCell(e,t);(d==null?void 0:d.formatString)!=null&&(l=d)}var u=this.displayString(a,o.type,o.name,l);this.cacheFormattedValue(e,t,u)}return this.formattedStringData[e][t]}textForCell(e,t){var n,i=this.textValueForCell(e,t);if(i==null&&this.isKeyColumn(e)){var a=this.pendingRow(t);if(a!=null&&this.pendingDataMap.has(a))return"*"}if(P.isTextType((n=this.columns[e])===null||n===void 0?void 0:n.type)){if(i===null)return this.formatter.showNullStrings?"null":"";if(i==="")return this.formatter.showEmptyStrings?"empty":""}return i??""}truncationCharForCell(e){var t=this.columns[e],{type:n}=t;if(P.isNumberType(n)&&this.formatter.truncateNumbersWithPound)return"#"}colorForCell(e,t,n){var i=this.dataForCell(e,t);if(i){var{format:a,value:o}=i;if(o==null||o==="")return I(n.nullStringColor),n.nullStringColor;if((a==null?void 0:a.color)!=null&&a.color!=="")return a.color;if(this.isPendingRow(t))return I(n.pendingTextColor),n.pendingTextColor;if(o!=null){var s=this.sourceColumn(e,t);if(P.isDateType(s.type)||s.name==="Date")return I(n.dateColor),n.dateColor;if(P.isNumberType(s.type))return o>0?(I(n.positiveNumberColor),n.positiveNumberColor):o<0?(I(n.negativeNumberColor),n.negativeNumberColor):(I(n.zeroNumberColor),n.zeroNumberColor)}}else if(this.isPendingRow(t)&&this.isKeyColumn(e))return I(n.errorTextColor),n.errorTextColor;return n.textColor}backgroundColorForCell(e,t,n){var i,a;return(i=(a=this.formatForCell(e,t))===null||a===void 0?void 0:a.backgroundColor)!==null&&i!==void 0?i:null}textAlignForCell(e){var t=this.columns[e],{type:n}=t;return P.isNumberType(n)?"right":P.isDateType(n)||t.name==="Date"?"center":"left"}textForColumnHeader(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=this.columnAtDepth(e,n);return To(i)?i.isNew?"":i.name:(t=i==null?void 0:i.displayName)!==null&&t!==void 0?t:i==null?void 0:i.name}colorForColumnHeader(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=this.columnAtDepth(e,t);if(To(n)){var i;return(i=n.color)!==null&&i!==void 0?i:null}return null}getColumnHeaderGroup(e,t){var n=this.columnAtDepth(e,t);if(To(n))return n}getColumnHeaderParentGroup(e,t){var n,i;return this.columnHeaderParentMap.get((n=(i=this.columnAtDepth(e,t))===null||i===void 0?void 0:i.name)!==null&&n!==void 0?n:"")}columnAtDepth(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(n===0)return this.columns[e];var i=(t=this.columns[e])===null||t===void 0?void 0:t.name,a=this.columnHeaderParentMap.get(i);if(a){for(var o=a.depth;o<n;){if(a=this.columnHeaderParentMap.get(a.name),!a)return;o=a.depth}if(a.depth===n)return a}}textForRowFooter(e){var t=this.totalsRow(e);return t!=null&&this.totals?this.totals.operationOrder[t]:""}get initialMovedColumns(){var e;return this.getMemoizedInitialMovedColumns((e=this.layoutHints)!==null&&e!==void 0?e:void 0)}get initialColumnHeaderGroups(){var e;return this.getMemoizedInitialColumnHeaderGroups((e=this.layoutHints)!==null&&e!==void 0?e:void 0)}get columnMap(){return this.getMemoizedColumnMap(this.table.columns)}get columnHeaderMaxDepth(){var e;return(e=this._columnHeaderMaxDepth)!==null&&e!==void 0?e:1}set columnHeaderMaxDepth(e){this._columnHeaderMaxDepth=e}get columnHeaderGroupMap(){return this._columnHeaderGroupMap}get columnHeaderGroups(){return this._columnHeaderGroups}set columnHeaderGroups(e){if(e!==this._columnHeaderGroups){var{groups:t,maxDepth:n,parentMap:i,groupMap:a}=Ne.parseColumnHeaderGroups(this,e??this.initialColumnHeaderGroups);this._columnHeaderGroups=t,this.columnHeaderMaxDepth=n,this.columnHeaderParentMap=i,this._columnHeaderGroupMap=a}}row(e){var t,n,i,a,o,s,l,d,u,c,m=(t=(n=this.totals)===null||n===void 0||(i=n.operationOrder)===null||i===void 0?void 0:i.length)!==null&&t!==void 0?t:0,f=(a=(o=this.totals)===null||o===void 0?void 0:o.showOnTop)!==null&&a!==void 0?a:!1,g=this.totalsRow(e);if(g!=null){var v,p,C,S=(v=this.totals)===null||v===void 0?void 0:v.operationOrder[g];return I(S),(p=(C=this.totalsDataMap)===null||C===void 0?void 0:C.get(S))!==null&&p!==void 0?p:null}var y=this.pendingRow(e);if(y!=null){var w;return(w=this.pendingNewDataMap.get(y))!==null&&w!==void 0?w:null}var E=(s=(l=this.viewportData)===null||l===void 0?void 0:l.offset)!==null&&s!==void 0?s:0,D=(f?e-m:e)-E;return(d=(u=this.viewportData)===null||u===void 0||(c=u.rows)===null||c===void 0?void 0:c[D])!==null&&d!==void 0?d:null}sourceColumn(e,t){var n=this.totalsRow(t);if(n!=null){var i,a,o,s,l=(i=this.totals)===null||i===void 0?void 0:i.operationOrder[n],d=(a=(o=this.totals)===null||o===void 0?void 0:o.defaultOperation)!==null&&a!==void 0?a:be.SUM,u=this.columns[e],c=(s=this.totalsTable)===null||s===void 0?void 0:s.columns.find(m=>{var f;return m.name==="".concat(u.name,"__").concat(l)||(l===d||((f=this.totals)===null||f===void 0?void 0:f.operationOrder.length)===1)&&m.name===u.name});if(c!=null)return c}return this.columns[e]}totalsRow(e){var t,n,i,a,o,s=(t=(n=this.totals)===null||n===void 0||(i=n.operationOrder)===null||i===void 0?void 0:i.length)!==null&&t!==void 0?t:0,l=(a=(o=this.totals)===null||o===void 0?void 0:o.showOnTop)!==null&&a!==void 0?a:!1,d=l?e:e-this.table.size;return d>=0&&d<s?d:null}pendingRow(e){var t=e-this.floatingTopRowCount-this.table.size;return t>=0&&t<this.pendingNewRowCount?t:null}isTotalsRow(e){return this.totalsRow(e)!=null}isPendingRow(e){return this.pendingRow(e)!=null}dataForCell(e,t){var n;return(n=this.row(t))===null||n===void 0?void 0:n.data.get(e)}formatForCell(e,t){var n;return(n=this.dataForCell(e,t))===null||n===void 0?void 0:n.format}valueForCell(e,t){var n=this.dataForCell(e,t);if(n){var i;return(i=n.value)!==null&&i!==void 0?i:null}}copyViewportData(e){if(e==null){xe.warn("invalid data!");return}this.viewportData=this.extractViewportData(e),this.formattedStringData=[]}copyTotalsData(e){var t,n,i,a=this;if(e==null){xe.warn("invalid data!");return}var{columns:o,rows:s}=e;if(s.length!==1){xe.error("Unexpected number of rows received for totals table, ignoring update");return}for(var l=new Map,d=s[0],u=(t=(n=this.totals)===null||n===void 0?void 0:n.defaultOperation)!==null&&t!==void 0?t:be.SUM,c=(i=this.totals)===null||i===void 0?void 0:i.operationMap,m=function(){var v,p,C=o[f],[S,y=(v=c==null||(p=c[S])===null||p===void 0?void 0:p[0])!==null&&v!==void 0?v:u]=C.name.split("__");l.has(y)||l.set(y,{data:new Map});var{data:w}=l.get(y),E=a.columns.findIndex(D=>D.name===S);w.set(E,{value:d.get(C),format:d.getFormat(C)})},f=0;f<o.length;f+=1)m();xe.debug2("copyTotalsData",l),this.totalsDataMap=l,this.formattedStringData=[]}getColumnIndexByName(e){return this.getColumnIndicesByNameMap(this.columns).get(e)}extractViewportData(e){for(var t={offset:e.offset,rows:[]},{columns:n}=e,i=0;i<e.rows.length;i+=1){var a=e.rows[i],o=this.extractViewportRow(a,n);t.rows.push(o)}return t}extractViewportRow(e,t){for(var n=new Map,i=0;i<t.length;i+=1){var a=t[i],o=this.getColumnIndexByName(a.name);I(o),n.set(o,{value:e.get(a),format:e.getFormat(a)})}return{data:n}}closeSubscription(){xe.debug2("closeSubscription",this.subscription),this.subscription&&(this.subscription.close(),this.subscription=null),this.setViewport.cancel(),this.applyViewport.cancel()}get filter(){return this.table.filter}set filter(e){this.closeSubscription(),this.table.applyFilter(e),this.applyViewport()}get formatter(){return this.irisFormatter}set formatter(e){this.irisFormatter=e,this.formattedStringData=[],this.dispatchEvent(new Te(ce.EVENT.FORMATTER_UPDATED))}displayString(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",i=arguments.length>3?arguments[3]:void 0;return this.getCachedFormattedString(this.formatter,e,t,n,i)}get sort(){return this.table.sort}set sort(e){this.closeSubscription(),this.table.applySort(e),this.applyViewport()}set totalsConfig(e){if(xe.debug("set totalsConfig",e),e!==this.totals){if(this.totals=e,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),e==null){this.dispatchEvent(new Te(ce.EVENT.UPDATED));return}this.totalsTablePromise=we.makeCancelable(this.table.getTotalsTable(e),t=>t.close()),this.totalsTablePromise.then(t=>{this.totalsTablePromise=null,this.setTotalsTable(t)}).catch(t=>{we.isCanceled(t)||(xe.error("Unable to set next totalsTable",t),this.totalsTablePromise=null,this.dispatchEvent(new Te(ce.EVENT.REQUEST_FAILED,{detail:t})))})}}setTotalsTable(e){xe.debug("setTotalsTable",e),this.totalsTable!==null&&(this.listenerCount>0&&this.removeTotalsListeners(this.totalsTable),this.totalsTable.close()),this.totalsTable=e,this.totalsDataMap=null,this.listenerCount>0&&this.totalsTable!=null&&this.addTotalsListeners(this.totalsTable)}applyBufferedViewport(e,t,n){if(xe.debug2("applyBufferedViewport",e,t,n),this.subscription==null){var i;xe.debug2("applyBufferedViewport creating new subscription"),this.subscription=(i=this.table.setViewport(e,t,n))!==null&&i!==void 0?i:null}else xe.debug2("applyBufferedViewport using existing subscription"),this.subscription.setViewport(e,t,n)}snapshot(e){var t=arguments,n=this;return Ln(function*(){var i=t.length>1&&t[1]!==void 0?t[1]:!1,a=t.length>2&&t[2]!==void 0?t[2]:T=>T,o=t.length>3&&t[3]!==void 0?t[3]:!0;if(n.subscription==null)throw new Error("No subscription available");var s=o?B.consolidate(e):e;if(!Ne.isValidSnapshotRanges(s))throw new Error("Invalid snapshot ranges ".concat(e));for(var l=new Set,d=[],u=new Set,c=0;c<s.length;c+=1){var m=s[c];I(m.endRow),I(m.startRow);for(var f=m.startRow;f<=m.endRow&&f<n.floatingTopRowCount;f+=1)l.add(f);m.endRow>=n.floatingTopRowCount&&m.startRow<=n.floatingTopRowCount+n.table.size&&d.push(new B(m.startColumn,Math.min(Math.max(0,m.startRow-n.floatingTopRowCount)),m.endColumn,Math.min(Math.max(0,m.endRow-n.floatingTopRowCount),n.table.size-n.floatingTopRowCount)));for(var g=Math.max(m.startRow,n.floatingTopRowCount+n.table.size);g<=m.endRow&&g<n.floatingTopRowCount+n.table.size+n.floatingBottomRowCount;g+=1)u.add(g)}var v=Ne.columnsFromRanges(s,n.columns),p=[];i&&p.push(v.map(T=>T.name));for(var C=[...l].sort(),S=function*(){var N=C[y],x=v.map(F=>{var k=n.getColumnIndexByName(F.name);return I(k),a(n.valueForCell(k,N),F)});i&&x.push(n.textForRowFooter(N)),p.push(x)},y=0;y<C.length;y+=1)yield*S();if(d.length>0){var w=n.irisGridUtils.rangeSetFromRanges(d),E=yield n.subscription.snapshot(w,v);p.push(...E.rows.map(T=>v.map(N=>a(T.get(N),N))))}for(var D=[...u].sort(),M=function*(){var N=D[_],x=v.map(F=>{var k=n.getColumnIndexByName(F.name);return I(k),a(n.valueForCell(k,N),F)});i&&x.push(n.textForRowFooter(N)),p.push(x)},_=0;_<D.length;_+=1)yield*M();return p})()}textSnapshot(e){var t=arguments,n=this;return Ln(function*(){var i=t.length>1&&t[1]!==void 0?t[1]:!1,a=t.length>2&&t[2]!==void 0?t[2]:s=>"".concat(s);xe.debug2("textSnapshot",e,i);var o=yield n.snapshot(e,i,a,!1);return o.map(s=>s.join(" ")).join(`
|
|
22
22
|
`)})()}valuesTable(e){var t=this;return Ln(function*(){var n=null;try{return n=yield t.table.copy(),n.applyFilter([]),n.applySort([]),n.selectDistinct(Array.isArray(e)?e:[e])}finally{n!=null&&n.close()}})()}isColumnMovable(e,t){if(e<0||e>=this.columnCount)return!1;if(t>0)return!0;var n=this.columns[e].name;return this.frontColumns.includes(n)||this.backColumns.includes(n)||this.frozenColumns.includes(n)||!n?!1:!this.isKeyColumn(e)}isColumnSortable(e){var t;return(t=this.columns[e].isSortable)!==null&&t!==void 0?t:!0}isKeyColumn(e){var t,n;return e<((t=(n=this.inputTable)===null||n===void 0?void 0:n.keyColumns.length)!==null&&t!==void 0?t:0)}isRowMovable(){return!1}isEditableRange(e){if(this.inputTable==null||!B.isBounded(e))return!1;var t=this.isPendingRow(e.startRow)&&this.isPendingRow(e.endRow);return!(!(t||this.inputTable.keyColumns.length!==0&&e.startColumn>=this.inputTable.keyColumns.length&&e.endColumn>=this.inputTable.keyColumns.length)||e.startRow<this.floatingTopRowCount||e.startRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount||e.endRow>=this.floatingTopRowCount+this.table.size+this.pendingRowCount)}isDeletableRange(e){return this.inputTable!=null&&e.startRow!=null&&e.endRow!=null&&e.startRow>=this.floatingTopRowCount&&e.startRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount&&e.endRow<this.floatingTopRowCount+this.table.size+this.pendingRowCount}isEditableRanges(e){return e.every(t=>this.isEditableRange(t))}isDeletableRanges(e){return e.every(t=>this.isDeletableRange(t))}getTableAreaRange(){return new B(null,this.floatingTopRowCount,null,this.floatingTopRowCount+this.table.size-1)}getPendingAreaRange(){return new B(null,this.floatingTopRowCount+this.table.size,null,this.floatingTopRowCount+this.table.size+this.pendingNewRowCount-1)}setValueForCell(e,t,n){var i=this;return Ln(function*(){return i.setValueForRanges([new B(e,t,e,t)],n)})()}setValueForRanges(e,t){var n=this;return Ln(function*(){if(!n.isEditableRanges(e))throw new Error("Uneditable ranges ".concat(e));try{var i=new Set,a=[];B.forEachCell(e,(v,p)=>{var C=n.columns[v];if(i.add(C),a[v]===void 0){var S=n.tableUtils.makeValue(C.type,t,n.formatter.timeZone);a[v]=S!=null?n.displayString(S,C.type,C.name):null}n.cachePendingValue(v,p,a[v])});var o=n.getPendingAreaRange(),s=e.map(v=>B.intersection(o,v)).filter(v=>v!=null).map(v=>(I(v),B.offset(v,0,-(n.floatingTopRowCount+n.table.size))));if(s.length>0){var l=new Map(n.pendingNewDataMap);B.forEachCell(s,(v,p)=>{l.has(p)||l.set(p,{data:new Map});var C=n.columns[v],S=l.get(p);I(S);var{data:y}=S,w=new Map(y),E=n.tableUtils.makeValue(C.type,t,n.formatter.timeZone);E!=null?w.set(v,{value:E}):w.delete(v),w.size>0?l.set(p,da(da({},S),{},{data:w})):l.delete(p)}),n.pendingDataMap=l}n.dispatchEvent(new Te(ce.EVENT.UPDATED));var d=n.getTableAreaRange(),u=e.map(v=>B.intersection(d,v)).filter(v=>v!=null);if(u.length>0){var c,m=yield n.snapshot(u.map(v=>{var p,C;return new B(null,(p=v==null?void 0:v.startRow)!==null&&p!==void 0?p:null,null,(C=v==null?void 0:v.endRow)!==null&&C!==void 0?C:null)})),f=m.map(v=>{for(var p={},C=0;C<n.columns.length;C+=1)p[n.columns[C].name]=v[C];return i.forEach(S=>{p[S.name]=n.tableUtils.makeValue(S.type,t,n.formatter.timeZone)}),p}),g=yield(c=n.inputTable)===null||c===void 0?void 0:c.addRows(f);xe.debug("setValueForRanges(",e,",",t,") set tableRanges",u,"result",g)}B.forEachCell(e,(v,p)=>{var C=a[v];I(C),n.cacheFormattedValue(v,p,C)})}catch(v){xe.error("Unable to set ranges",e,t,v)}finally{B.forEachCell(e,(v,p)=>{n.clearPendingValue(v,p)})}})()}setValues(){var e=arguments,t=this;return Ln(function*(){var n=e.length>0&&e[0]!==void 0?e[0]:[];if(xe.debug("setValues(",n,")"),!n.every(f=>{var g,v;return t.isEditableRange(B.makeCell((g=f.column)!==null&&g!==void 0?g:f.x,(v=f.row)!==null&&v!==void 0?v:f.y))}))throw new Error("Uneditable ranges ".concat(n));try{var i=new Map(t.pendingNewDataMap);n.forEach(f=>{var g,v,{text:p}=f,C=(g=f.column)!==null&&g!==void 0?g:f.x,S=(v=f.row)!==null&&v!==void 0?v:f.y,y=t.columns[C],w=t.tableUtils.makeValue(y.type,p,t.formatter.timeZone),E=w!=null?t.displayString(w,y.type,y.name):null;t.cachePendingValue(C,S,E);var D=t.pendingRow(S);if(D!=null){i.has(D)||i.set(D,{data:new Map});var M=i.get(D);I(M);var{data:_}=M,T=new Map(_);w!=null?T.set(C,{value:w}):T.delete(C),T.size>0?i.set(D,da(da({},M),{},{data:T})):i.delete(D)}}),t.pendingDataMap=i,t.dispatchEvent(new Te(ce.EVENT.UPDATED));var a=n.reduce((f,g)=>{var v,p,C=(v=g.row)!==null&&v!==void 0?v:g.y;return f.has(C)||f.set(C,[]),(p=f.get(C))===null||p===void 0||p.push(g),f},new Map),o=B.consolidate(n.map(f=>{var g,v;return B.makeCell((g=f.column)!==null&&g!==void 0?g:f.x,(v=f.row)!==null&&v!==void 0?v:f.y)})),s=t.getTableAreaRange(),l=o.map(f=>B.intersection(s,f)).filter(f=>f!=null);if(l.length>0){var d,u=yield t.snapshot(l.map(f=>(I(f),new B(null,f.startRow,null,f.endRow)))),c=u.map((f,g)=>{for(var v=null,p=g,C=0;C<l.length;C+=1){var S=l[C];I(S);var y=B.rowCount([S]);if(p<y){I(S.startRow),v=S.startRow+p;break}p-=y}for(var w={},E=0;E<t.columns.length;E+=1)w[t.columns[E].name]=f[E];I(v);var D=a.get(v);return D!=null&&D.forEach(M=>{var _,T=t.columns[(_=M.column)!==null&&_!==void 0?_:M.x];w[T.name]=t.tableUtils.makeValue(T.type,M.text,t.formatter.timeZone)}),w});xe.info("setValues setting tableRanges",l);var m=yield(d=t.inputTable)===null||d===void 0?void 0:d.addRows(c);xe.info("setValues set tableRanges",l,"SUCCESS",m)}n.forEach(f=>{var g,v,{text:p}=f,C=(g=f.column)!==null&&g!==void 0?g:f.x,S=(v=f.row)!==null&&v!==void 0?v:f.y,y=t.columns[C],w=t.tableUtils.makeValue(y.type,p,t.formatter.timeZone),E=w!=null?t.displayString(w,y.type,y.name):null;t.cacheFormattedValue(C,S,E)})}finally{n.forEach(f=>{t.clearPendingValue(f.column,f.row)})}})()}commitPending(){var e=this;return Ln(function*(){if(e.pendingNewDataMap.size<=0)throw new Error("No pending changes to commit");try{var t,n,i;e.isSaveInProgress=!0;var a=[];e.pendingNewDataMap.forEach(s=>{var l={};s.data.forEach((d,u)=>{var{value:c}=d,m=e.columns[u];l[m.name]=c}),a.push(l)});var o=yield(t=e.inputTable)===null||t===void 0?void 0:t.addRows(a);xe.debug("commitPending()",e.pendingNewDataMap,"result",o),e.pendingNewDataMap=new Map,e.pendingNewRowCount=Math.max(0,((n=(i=e.viewport)===null||i===void 0?void 0:i.bottom)!==null&&n!==void 0?n:0)-e.table.size),e.formattedStringData=[],e.dispatchEvent(new Te(ce.EVENT.PENDING_DATA_UPDATED))}finally{e.isSaveInProgress=!1}})()}editValueForCell(e,t){return this.textValueForCell(e,t)}delete(e){return Ln(function*(){throw new Error("Delete not implemented")})()}isValidForCell(e,t,n){try{var i=this.columns[e];return this.tableUtils.makeValue(i.type,n,this.formatter.timeZone),!0}catch{return!1}}}he(Fi,"ROW_BUFFER_PAGES",1);const dm=Fi;function lu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Or(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){lu(a,n,i,o,s,"next",l)}function s(l){lu(a,n,i,o,s,"throw",l)}o(void 0)})}}function pn(r,e,t){return e=dP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dP(r){var e=uP(r,"string");return typeof e=="symbol"?e:String(e)}function uP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var gn=z.module("IrisGridTableModel");class hP extends dm{constructor(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Zt(e),i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;super(e,t,n,i),pn(this,"userFrozenColumns",void 0),pn(this,"customColumnList",void 0),pn(this,"formatColumnList",void 0),pn(this,"initialFilters",[]),pn(this,"getMemoizedFrontColumns",oe(a=>a??[])),pn(this,"getMemoizedBackColumns",oe(a=>a??[])),pn(this,"getMemoizedFrozenColumns",oe((a,o)=>{var s;return(s=o??a)!==null&&s!==void 0?s:[]})),pn(this,"getCachedFilterableColumnSet",oe(a=>new Set(a.map((o,s)=>s)))),pn(this,"getCachedPartitionColumns",oe(a=>a.filter(o=>o.isPartitionColumn))),this.customColumnList=[],this.formatColumnList=[],this.initialFilters=t.filter}get isExportAvailable(){return this.table.freeze!=null}get isColumnStatisticsAvailable(){return this.table.getColumnStatistics!=null}get isValuesTableAvailable(){return this.table.selectDistinct!=null&&this.table.copy!=null}get isRollupAvailable(){return this.table.rollup!=null}get isSelectDistinctAvailable(){return this.table.selectDistinct!=null}get isCustomColumnsAvailable(){return this.table.applyCustomColumns!=null}get isFormatColumnsAvailable(){return this.table.applyCustomColumns!=null}get frontColumns(){var e,t;return this.getMemoizedFrontColumns((e=(t=this.layoutHints)===null||t===void 0?void 0:t.frontColumns)!==null&&e!==void 0?e:[])}get backColumns(){var e,t;return this.getMemoizedBackColumns((e=(t=this.layoutHints)===null||t===void 0?void 0:t.backColumns)!==null&&e!==void 0?e:void 0)}get frozenColumns(){var e,t;return this.getMemoizedFrozenColumns((e=(t=this.layoutHints)===null||t===void 0?void 0:t.frozenColumns)!==null&&e!==void 0?e:void 0,this.userFrozenColumns)}get layoutHints(){return this.table.layoutHints}get floatingLeftColumnCount(){return this.frozenColumns.length}get description(){var e;return(e=this.table.description)!==null&&e!==void 0?e:""}get customColumns(){return this.customColumnList}set customColumns(e){if(gn.debug2("set customColumns",e,this.customColumnList,e===this.customColumnList),this.customColumnList.length===0&&e.length===0){gn.debug("Ignore empty initial customColumns"),this.customColumnList=e;return}if(this.customColumnList===e){gn.debug("Ignore same customColumns");return}this.closeSubscription(),this.customColumnList=e,this.table.applyCustomColumns([...e,...this.formatColumns]),this.applyViewport()}get formatColumns(){return this.formatColumnList}set formatColumns(e){if(gn.debug2("set formatColumns",e,this.formatColumnList,e===this.formatColumnList),this.formatColumnList.length===0&&e.length===0){gn.debug("Ignore empty initial formatColumns"),this.formatColumnList=e;return}if(this.formatColumnList===e){gn.debug("Ignore same formatColumns");return}this.closeSubscription(),this.formatColumnList=e,this.table.applyCustomColumns([...this.customColumns,...e]),this.applyViewport()}updateFrozenColumns(e){this.userFrozenColumns=e,this.dispatchEvent(new Te(ce.EVENT.TABLE_CHANGED,{detail:this.table}))}get partitionColumns(){return this.getCachedPartitionColumns(this.columns)}partitionKeysTable(){var e=this;return Or(function*(){return e.valuesTable(e.partitionColumns)})()}partitionMergedTable(){var e=this;return Or(function*(){var t=yield e.table.copy();return t.applyFilter([]),t})()}partitionTable(e){var t=this;return Or(function*(){gn.debug("getting partition table for partitions",e);for(var n=[],i=0;i<t.partitionColumns.length;i+=1){var a=e[i],o=t.partitionColumns[i],s=t.tableUtils.makeFilterRawValue(o.type,a);n.push(o.filter().eq(s))}var l=yield t.table.copy();return l.applyFilter([...t.initialFilters,...n]),l})()}set filter(e){this.closeSubscription(),this.table.applyFilter([...this.initialFilters,...e]),this.applyViewport()}set totalsConfig(e){if(gn.debug("set totalsConfig",e),e!==this.totals){if(this.totals=e,this.formattedStringData=[],this.totalsTablePromise!=null&&this.totalsTablePromise.cancel(),this.setTotalsTable(null),e==null){this.dispatchEvent(new Te(ce.EVENT.UPDATED));return}this.totalsTablePromise=we.makeCancelable(this.table.getTotalsTable(e),t=>t.close()),this.totalsTablePromise.then(t=>{this.totalsTablePromise=null,this.setTotalsTable(t)}).catch(t=>{we.isCanceled(t)||(gn.error("Unable to set next totalsTable",t),this.totalsTablePromise=null,this.dispatchEvent(new Te(ce.EVENT.REQUEST_FAILED,{detail:t})))})}}get isFilterRequired(){return this.table.isUncoalesced}get isPartitionRequired(){return this.table.isUncoalesced&&this.isValuesTableAvailable&&this.partitionColumns.length>0}isFilterable(e){return this.getCachedFilterableColumnSet(this.columns).has(e)}export(){var e=this;return Or(function*(){return e.table.freeze()})()}columnStatistics(e){return this.table.getColumnStatistics(e)}isColumnMovable(e){var t=this.columns[e].name;return this.frontColumns.includes(t)||this.backColumns.includes(t)||this.frozenColumns.includes(t)?!1:!this.isKeyColumn(e)}isColumnFrozen(e){return this.frozenColumns.includes(this.columns[e].name)}delete(e){var t=()=>super.pendingDataMap,n=a=>super.pendingDataMap=a,i=this;return Or(function*(){var a;if(!i.isDeletableRanges(e))throw new Error("Undeletable ranges ".concat(e));I(i.inputTable);var{keyColumns:o}=i.inputTable;if(o.length===0)throw new Error("No key columns to allow deletion");var s=i.getPendingAreaRange(),l=e.map(y=>B.intersection(s,y)).filter(y=>y!=null).map(y=>(I(y),B.offset(y,0,-(i.floatingTopRowCount+i.table.size))));if(l.length>0){for(var d=new Map(t()),u=0;u<l.length;u+=1){var c=l[u];I(c.startRow),I(c.endRow);for(var m=c.startRow;m<=c.endRow;m+=1)d.delete(m)}n(d),i.formattedStringData=[],i.dispatchEvent(new Te(ce.EVENT.PENDING_DATA_UPDATED)),i.dispatchEvent(new Te(ce.EVENT.UPDATED))}var f=i.getTableAreaRange(),g=e.map(y=>B.intersection(f,y)).filter(y=>y!=null);if(!(g.length<=0)){var[v,p]=yield Promise.all([i.snapshot(g.map(y=>(I(y),o.map(w=>{var E=i.getColumnIndexByName(w.name);if(E==null)throw new Error("Key column ".concat(w.name," not found"));return new B(E,y.startRow,E,y.endRow)}))).flat()),i.table.copy()]),C=v.map(y=>{for(var w=[],E=0;E<o.length;E+=1){var D=o[E],M=y[E],_=i.tableUtils.makeFilterRawValue(D.type,M),T=D.filter().eq(_);w.push(T)}return w.reduce((N,x)=>{var F;return(F=N==null?void 0:N.and(x))!==null&&F!==void 0?F:x})}),S=C.reduce((y,w)=>{var E;return(E=y==null?void 0:y.or(w))!==null&&E!==void 0?E:w});p.applyFilter([S]),yield(a=i.inputTable)===null||a===void 0?void 0:a.deleteTable(p),p.close()}})()}seekRow(e,t,n,i,a,o,s){var l=this;return Or(function*(){return l.table.seekRow(e,t,n,i,a,o,s)})()}get isSeekRowAvailable(){return this.table.seekRow!=null}}const um=hP;function cP(r,e,t){return e=mP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mP(r){var e=fP(r,"string");return typeof e=="symbol"?e:String(e)}function fP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class vP extends ce{constructor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new Zt(e);super(e),cP(this,"modelFormatter",void 0),this.modelFormatter=t}get rowCount(){return 0}get columnCount(){return 0}textForCell(e,t){return""}textForColumnHeader(e,t){}get columns(){return Oe}getColumnIndexByName(e){}get initialMovedColumns(){return Oe}get initialMovedRows(){return Oe}get initialColumnHeaderGroups(){return Oe}get groupedColumns(){return Oe}formatForCell(e,t){}valueForCell(e,t){}get filter(){return Oe}set filter(e){}get partition(){return Oe}set partition(e){}get partitionColumns(){return Oe}get formatter(){return this.modelFormatter}set formatter(e){this.modelFormatter=e}displayString(e,t,n){return""}get sort(){return Oe}set sort(e){}get customColumns(){return Oe}set customColumns(e){}get formatColumns(){return Oe}updateFrozenColumns(e){}get rollupConfig(){return null}set rollupConfig(e){}get totalsConfig(){return null}set totalsConfig(e){}export(){throw new Error("Method not implemented.")}columnStatistics(e){throw new Error("Method not implemented.")}get selectDistinctColumns(){return Oe}set selectDistinctColumns(e){}get pendingDataMap(){return Ca}set pendingDataMap(e){}get pendingRowCount(){return 0}set pendingRowCount(e){}get pendingDataErrors(){return Ca}commitPending(){return Promise.resolve()}setViewport(e,t,n){}snapshot(e){return Promise.resolve([])}textSnapshot(e,t,n){return Promise.resolve("")}valuesTable(e){throw new Error("Method not implemented.")}delete(e){return Promise.resolve()}seekRow(e,t,n,i,a,o,s){return Promise.resolve(0)}get columnHeaderGroups(){return Oe}set columnHeaderGroups(e){}get columnHeaderGroupMap(){return Ca}getColumnHeaderParentGroup(e,t){}}const pP=vP;function du(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function No(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){du(a,n,i,o,s,"next",l)}function s(l){du(a,n,i,o,s,"throw",l)}o(void 0)})}}function gP(r,e,t){return e=bP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bP(r){var e=CP(r,"string");return typeof e=="symbol"?e:String(e)}function CP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yP extends pP{constructor(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Zt(e);super(e,n),gP(this,"partitionedTable",void 0),this.partitionedTable=t}get isPartitionRequired(){return!0}get isReversible(){return!1}displayString(e,t,n){return""}close(){this.partitionedTable.close()}get columns(){return this.partitionedTable.columns}get partitionColumns(){return this.partitionedTable.keyColumns}partitionKeysTable(){var e=this;return No(function*(){return e.partitionedTable.getKeyTable()})()}partitionMergedTable(){var e=this;return No(function*(){return e.partitionedTable.getMergedTable()})()}partitionTable(e){var t=this;return No(function*(){try{var n=yield t.partitionedTable.getTable(e);if(n==null)throw new au("Partition not found");return n}catch(i){throw eP(i)?i:new au("Unable to retrieve partition")}})()}}const SP=yP;function uu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function wP(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){uu(a,n,i,o,s,"next",l)}function s(l){uu(a,n,i,o,s,"throw",l)}o(void 0)})}}function hu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function cu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hu(Object(t),!0).forEach(function(n){Ir(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ir(r,e,t){return e=EP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function EP(r){var e=PP(r,"string");return typeof e=="symbol"?e:String(e)}function PP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var TP=z.module("IrisGridTreeTableModel");class _P extends dm{constructor(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Zt(e),i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;super(e,t,n,i),Ir(this,"virtualColumns",void 0),Ir(this,"getCachedColumns",oe((a,o)=>[...a,...o])),Ir(this,"getCachedGroupColumns",oe((a,o)=>[...a,...o])),Ir(this,"getCachedFilterableColumnSet",oe((a,o,s)=>new Set(((o==null?void 0:o.length)>0?o:a).filter(l=>!s.includes(l)).map(l=>a.findIndex(d=>l.name===d.name))))),Ir(this,"getCachedGroupedColumnSet",oe(a=>new Set(a.map(o=>this.columns.findIndex(s=>o.name===s.name))))),this.virtualColumns=t.groupedColumns.length>1?[{name:"__DH_UI_GROUP__",displayName:"Group",type:P.dataType.STRING,constituentType:P.dataType.STRING,isPartitionColumn:!1,isSortable:!1,isProxy:!0,description:"Key column",index:-1,filter:()=>{throw new Error("Filter not implemented for virtual column")},sort:()=>{throw new Error("Sort not implemented virtual column")},formatColor:()=>{throw new Error("Color not implemented for virtual column")},get:()=>{throw new Error("get not implemented for virtual column")},getFormat:()=>{throw new Error("getFormat not implemented for virtual column")},formatNumber:()=>{throw new Error("formatNumber not implemented for virtual column")},formatDate:()=>{throw new Error("formatDate not implemented for virtual column")}}]:[]}applyBufferedViewport(e,t,n){var i=[...this.table.groupedColumns,...n.filter(a=>!this.virtualColumns.includes(a)&&!this.groupedColumns.includes(a))];this.table.setViewport(e,t,i)}textForCell(e,t){var n=this.sourceColumn(e,t),i=this.row(t);if(i!=null&&n!=null){if(!i.hasChildren&&n.constituentType!=null){var a=this.valueForCell(e,t);return this.displayString(a,n.constituentType,n.name)}if(i.hasChildren&&i.depth<=e+1&&this.valueForCell(e,t)===null&&this.getCachedGroupedColumnSet(this.groupedColumns).has(e))return""}return super.textForCell(e,t)}extractViewportRow(e,t){var{isExpanded:n,hasChildren:i,depth:a}=e,o=super.extractViewportRow(e,t),s=new Map(o.data);if(i)for(var l=0;l<this.virtualColumns.length;l+=1){var d=l+(a-1)+(this.virtualColumns.length-1),u=s.get(d);u==null?TP.warn("Missing key data for virtual column",l,a,d,e):s.set(l,u)}return cu(cu({},o),{},{data:s,isExpanded:n,hasChildren:i,depth:a})}snapshot(e,t,n){var i=this;return wP(function*(){var a,o;I(i.viewport),I(i.viewportData);var s=(a=i.viewport.columns)!==null&&a!==void 0?a:i.columns,l=[];t!=null&&t&&l.push(s.map(C=>C.name));for(var d=new B(0,(o=i.viewportData)===null||o===void 0?void 0:o.offset,s.length,i.viewportData.offset+i.viewportData.rows.length),u=0;u<e.length;u+=1){var c=B.intersection(d,e[u]);I(c),I(c.startRow),I(c.endRow);for(var m=c.startRow;m<=c.endRow;m+=1){var f=[],g=i.viewportData.rows[m-i.viewportData.offset];I(c.startColumn),I(c.endColumn);for(var v=c.startColumn;v<=c.endColumn;v+=1){var p;I(n),f.push(n((p=g.data.get(v))===null||p===void 0?void 0:p.value,i.columns[v]))}l.push(f)}}return l})()}get columns(){return this.getCachedColumns(this.virtualColumns,super.columns)}get groupedColumns(){return this.getCachedGroupColumns(this.virtualColumns,this.table.groupedColumns)}sourceForCell(e,t){if(e>=this.virtualColumns.length)return{column:e,row:t};var n=this.depthForRow(t);return{column:e+n,row:t}}sourceColumn(e,t){if(e>=this.virtualColumns.length)return super.sourceColumn(e,t);var n=this.depthForRow(t);return this.columns[e+n]}getClearFilterRange(e){return e>=this.virtualColumns.length?super.getClearFilterRange(e):[this.virtualColumns.length,this.groupedColumns.length]}get hasExpandableRows(){return!0}get isExpandAllAvailable(){return this.table.expandAll!==void 0}get isChartBuilderAvailable(){return!1}get isSelectDistinctAvailable(){return!1}get isReversible(){return!1}isFilterable(e){return this.getCachedFilterableColumnSet(this.columns,this.groupedColumns,this.virtualColumns).has(e)}isColumnMovable(e){return e>=this.groupedColumns.length}isRowExpandable(e){var t,n=this.row(e);return(t=n==null?void 0:n.hasChildren)!==null&&t!==void 0?t:!1}isRowExpanded(e){var t,n=this.row(e);return(t=n==null?void 0:n.isExpanded)!==null&&t!==void 0?t:!1}setRowExpanded(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.isExpandAllAvailable?this.table.setExpanded(e,t,n):this.table.setExpanded(e,t)}expandAll(){this.table.expandAll!=null&&this.table.expandAll()}collapseAll(){this.table.collapseAll!=null&&this.table.collapseAll()}depthForRow(e){var t,n=this.row(e);return((t=n==null?void 0:n.depth)!==null&&t!==void 0?t:1)-1}updateFrozenColumns(e){if(e.length>0)throw new Error("Cannot freeze columns on a tree table")}}const OP=_P;function mu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function DP(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){mu(a,n,i,o,s,"next",l)}function s(l){mu(a,n,i,o,s,"throw",l)}o(void 0)})}}function ae(r,e,t){return e=MP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function MP(r){var e=IP(r,"string");return typeof e=="symbol"?e:String(e)}function IP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var bn=z.module("IrisGridProxyModel");function Dr(r,e,t,n){return P.isTreeTable(e)?new OP(r,e,t):P.isPartitionedTable(e)?new SP(r,e,t):new um(r,e,t,n)}class NP extends ce{constructor(e,t){var n,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Zt(e),a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;super(e),n=this,ae(this,"dh",void 0),ae(this,"originalModel",void 0),ae(this,"model",void 0),ae(this,"modelPromise",void 0),ae(this,"rollup",void 0),ae(this,"partition",void 0),ae(this,"selectDistinct",void 0),ae(this,"currentViewport",void 0),ae(this,"textForCell",function(){return n.model.textForCell(...arguments)}),ae(this,"truncationCharForCell",function(){return n.model.truncationCharForCell(...arguments)}),ae(this,"textAlignForCell",function(){return n.model.textAlignForCell(...arguments)}),ae(this,"colorForCell",function(){return n.model.colorForCell(...arguments)}),ae(this,"backgroundColorForCell",function(){return n.model.backgroundColorForCell(...arguments)}),ae(this,"textForColumnHeader",function(){return n.model.textForColumnHeader(...arguments)}),ae(this,"colorForColumnHeader",function(){return n.model.colorForColumnHeader(...arguments)}),ae(this,"textForRowHeader",function(){return n.model.textForRowHeader(...arguments)}),ae(this,"textForRowFooter",function(){return n.model.textForRowFooter(...arguments)}),ae(this,"isRowMovable",function(){return n.model.isRowMovable(...arguments)}),ae(this,"isColumnMovable",function(){return n.model.isColumnMovable(...arguments)}),ae(this,"isRowExpandable",function(){return yn(n.model)?n.model.isRowExpandable(...arguments):!1}),ae(this,"isRowExpanded",function(){return yn(n.model)?n.model.isRowExpanded(...arguments):!1}),ae(this,"setRowExpanded",function(){if(yn(n.model))return n.model.setRowExpanded(...arguments);throw Error("Function setRowExpanded does not exist on IrisGridTableModel")}),ae(this,"expandAll",()=>{if(yn(this.model))return this.model.expandAll();throw Error("Function expandAll does not exist on IrisGridTableModel")}),ae(this,"collapseAll",()=>{if(yn(this.model))return this.model.collapseAll();throw Error("Function collapseAll does not exist on IrisGridTableModel")}),ae(this,"depthForRow",function(){return yn(n.model)?n.model.depthForRow(...arguments):0}),ae(this,"getColumnHeaderGroup",function(){return n.model.getColumnHeaderGroup(...arguments)}),ae(this,"getColumnHeaderParentGroup",function(){return n.model.getColumnHeaderParentGroup(...arguments)}),ae(this,"sourceForCell",function(){return n.model.sourceForCell(...arguments)}),ae(this,"getClearFilterRange",function(){return n.model.getClearFilterRange(...arguments)}),ae(this,"formatForCell",function(){return n.model.formatForCell(...arguments)}),ae(this,"valueForCell",function(){return n.model.valueForCell(...arguments)}),ae(this,"renderTypeForCell",function(){return n.model.renderTypeForCell(...arguments)}),ae(this,"dataBarOptionsForCell",function(){return n.model.dataBarOptionsForCell(...arguments)}),ae(this,"displayString",function(){return n.model.displayString(...arguments)}),ae(this,"isEditableRange",function(){return Hn(n.model)?n.model.isEditableRange(...arguments):!1}),ae(this,"isFilterable",function(){return n.model.isFilterable(...arguments)}),ae(this,"setViewport",(s,l,d)=>{this.currentViewport={top:s,bottom:l,columns:d},this.model.setViewport(s,l,d)}),ae(this,"snapshot",function(){return n.model.snapshot(...arguments)}),ae(this,"textSnapshot",function(){return n.model.textSnapshot(...arguments)}),ae(this,"valuesTable",function(){return n.model.valuesTable(...arguments)}),ae(this,"editValueForCell",function(){return Hn(n.model)?n.model.editValueForCell(...arguments):""}),ae(this,"setValueForCell",function(){return Hn(n.model)?n.model.setValueForCell(...arguments):Promise.reject(new Error("Model is not editable"))}),ae(this,"setValueForRanges",function(){return Hn(n.model)?n.model.setValueForRanges(...arguments):Promise.reject(new Error("Model is not editable"))}),ae(this,"setValues",function(){return Hn(n.model)?n.model.setValues(...arguments):Promise.resolve()}),ae(this,"isValidForCell",function(){return Hn(n.model)?n.model.isValidForCell(...arguments):!1}),ae(this,"delete",function(){return n.model.delete(...arguments)}),ae(this,"commitPending",function(){return n.model.commitPending(...arguments)}),this.handleModelEvent=this.handleModelEvent.bind(this);var o=Dr(e,t,i,a);this.dh=e,this.originalModel=o,this.model=o,this.modelPromise=null,this.rollup=null,this.partition=null,this.selectDistinct=[]}close(){this.originalModel.close(),this.model!==this.originalModel&&this.model.close(),this.modelPromise!=null&&this.modelPromise.cancel()}handleModelEvent(e){bn.debug2("handleModelEvent",e);var{detail:t,type:n}=e;this.dispatchEvent(new Te(n,{detail:t}))}setModel(e){bn.debug("setModel",e);var t=this.model,{columns:n}=t;if(t!==this.originalModel&&t.close(),this.model=e,this.listenerCount>0&&this.addListeners(e),n!==e.columns)this.dispatchEvent(new Te(ce.EVENT.COLUMNS_CHANGED,{detail:e.columns}));else if(this.currentViewport!=null){var{top:i,bottom:a,columns:o}=this.currentViewport;e.setViewport(i,a,o)}ur(e)&&this.dispatchEvent(new Te(ce.EVENT.TABLE_CHANGED,{detail:e.table}))}setNextModel(e){bn.debug2("setNextModel"),this.modelPromise&&this.modelPromise.cancel(),this.listenerCount>0&&this.removeListeners(this.model),this.modelPromise=we.makeCancelable(e,t=>t.close()),this.modelPromise.then(t=>{this.modelPromise=null,this.setModel(t)}).catch(t=>{if(we.isCanceled(t)){bn.debug2("setNextModel cancelled");return}bn.error("Unable to set next model",t),this.modelPromise=null,this.dispatchEvent(new Te(ce.EVENT.REQUEST_FAILED,{detail:t}))})}startListening(){super.startListening(),this.addListeners(this.model)}stopListening(){super.stopListening(),this.removeListeners(this.model)}addListeners(e){for(var t=Object.keys(ce.EVENT),n=0;n<t.length;n+=1)e.addEventListener(t[n],this.handleModelEvent)}removeListeners(e){for(var t=Object.keys(ce.EVENT),n=0;n<t.length;n+=1)e.removeEventListener(t[n],this.handleModelEvent)}get rowCount(){return this.model.rowCount}get columnCount(){return this.model.columnCount}get floatingTopRowCount(){return this.model.floatingTopRowCount}get floatingBottomRowCount(){return this.model.floatingBottomRowCount}get floatingLeftColumnCount(){return this.model.floatingLeftColumnCount}get floatingRightColumnCount(){return this.model.floatingRightColumnCount}isColumnFrozen(e){return this.model.isColumnFrozen(e)}isColumnSortable(e){return this.model.isColumnSortable(e)}get hasExpandableRows(){return yn(this.model)?this.model.hasExpandableRows:!1}get isExpandAllAvailable(){if(yn(this.model)){var e;return(e=this.model.isExpandAllAvailable)!==null&&e!==void 0?e:!1}return!1}get isExportAvailable(){return this.model.isExportAvailable}get isColumnStatisticsAvailable(){return this.model.isColumnStatisticsAvailable}get isValuesTableAvailable(){return this.model.isValuesTableAvailable}get isCustomColumnsAvailable(){return this.model.isCustomColumnsAvailable&&!(this.isSelectDistinctAvailable&&this.selectDistinctColumns.length>0)}get isFormatColumnsAvailable(){return this.model.isFormatColumnsAvailable}get isChartBuilderAvailable(){return this.model.isChartBuilderAvailable}get isRollupAvailable(){return(this.originalModel.isRollupAvailable||this.rollup!=null)&&this.selectDistinct.length===0}get isSelectDistinctAvailable(){return(this.originalModel.isSelectDistinctAvailable||this.selectDistinct.length>0)&&this.rollup==null}get isTotalsAvailable(){return this.model.isTotalsAvailable}get isReversible(){return this.model.isReversible}get columns(){return this.model.columns}get initialMovedColumns(){return this.model.initialMovedColumns}get initialMovedRows(){return this.model.initialMovedRows}get layoutHints(){return this.model.layoutHints}get frontColumns(){return this.model.frontColumns}get backColumns(){return this.model.backColumns}get frozenColumns(){return this.model.frozenColumns}get columnHeaderGroups(){return this.model.columnHeaderGroups}set columnHeaderGroups(e){this.model.columnHeaderGroups=e}get initialColumnHeaderGroups(){return this.model.initialColumnHeaderGroups}get columnHeaderGroupMap(){return this.model.columnHeaderGroupMap}get columnHeaderMaxDepth(){return this.model.columnHeaderMaxDepth}updateFrozenColumns(e){return this.model.updateFrozenColumns(e)}get originalColumns(){return this.originalModel.columns}get groupedColumns(){return this.model.groupedColumns}get partitionColumns(){return nn(this.originalModel)?this.originalModel.partitionColumns:[]}get description(){return this.model.description}get filter(){return this.model.filter}set filter(e){this.model.filter=e}get partitionConfig(){return!nn(this.originalModel)||!this.originalModel.isPartitionRequired?null:this.partition}set partitionConfig(e){if(!this.isPartitionRequired)throw new Error("Partitions are not available");bn.debug("set partitionConfig",e),this.partition=e;var t=Promise.resolve(this.originalModel);e!=null&&nn(this.originalModel)&&(e.mode==="keys"?t=this.originalModel.partitionKeysTable().then(n=>Dr(this.dh,n,this.formatter)):e.mode==="merged"?t=this.originalModel.partitionMergedTable().then(n=>Dr(this.dh,n,this.formatter)):t=this.originalModel.partitionTable(e.partitions).then(n=>Dr(this.dh,n,this.formatter))),this.setNextModel(t)}partitionKeysTable(){if(!nn(this.originalModel))throw new Error("Partitions are not available");return this.originalModel.partitionKeysTable()}partitionMergedTable(){if(!nn(this.originalModel))throw new Error("Partitions are not available");return this.originalModel.partitionMergedTable()}partitionTable(e){if(!nn(this.originalModel))throw new Error("Partitions are not available");return this.originalModel.partitionTable(e)}get formatter(){return this.model.formatter}set formatter(e){this.model.formatter=e}get sort(){return this.model.sort}set sort(e){this.model.sort=e}get customColumns(){return this.model.customColumns}set customColumns(e){this.model.customColumns=e}get formatColumns(){return this.model.formatColumns}set formatColumns(e){this.model.formatColumns=e}get rollupConfig(){return this.rollup}set rollupConfig(e){if(bn.debug("set rollupConfig",e),!this.isRollupAvailable)throw new Error("Rollup Rows are not available");if(!mr(e,this.rollup)){this.rollup=e;var t=Promise.resolve(this.originalModel);ur(this.originalModel)&&e!=null&&(t=this.originalModel.table.rollup(e).then(n=>Dr(this.dh,n,this.formatter))),this.setNextModel(t)}}get selectDistinctColumns(){return this.selectDistinct}set selectDistinctColumns(e){if(bn.debug("set selectDistinctColumns",e),!this.isSelectDistinctAvailable)throw new Error("Select distinct is not available");if(e===this.selectDistinctColumns||e.length===0&&this.selectDistinctColumns.length===0){bn.debug("Ignore same selectDistinctColumns",e);return}this.selectDistinct=e;var t=e.map(i=>this.originalColumns.find(a=>a.name===i)).filter(i=>i!=null),n=Promise.resolve(this.originalModel);ur(this.originalModel)&&t.length>0&&(n=this.originalModel.table.selectDistinct(t).then(i=>Dr(this.dh,i,this.formatter))),this.setNextModel(n)}get table(){if(ur(this.model))return this.model.table}get totalsConfig(){return this.model.totalsConfig}set totalsConfig(e){this.model.totalsConfig=e}get isFilterRequired(){return this.originalModel.isFilterRequired}get isPartitionRequired(){return nn(this.originalModel)?this.originalModel.isPartitionRequired:!1}get isEditable(){return Hn(this.model)&&this.model.isEditable}export(){if(P.isTreeTable(this.model))throw new Error("TreeTable has no 'export' property");return this.model.export()}columnStatistics(e){if(P.isTreeTable(this.model))throw new Error("TreeTable has no 'columnStatistics' function");return this.model.columnStatistics(e)}get pendingDataMap(){return this.model.pendingDataMap}set pendingDataMap(e){this.model.pendingDataMap=e}get pendingRowCount(){return this.model.pendingRowCount}set pendingRowCount(e){this.model.pendingRowCount=e}get pendingDataErrors(){return this.model.pendingDataErrors}getColumnIndexByName(e){return this.model.getColumnIndexByName(e)}seekRow(e,t,n,i,a,o,s){var l=this;return DP(function*(){return l.model.seekRow(e,t,n,i,a,o,s)})()}get isSeekRowAvailable(){return this.model.isSeekRowAvailable}}const xP=NP;function fu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function FP(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){fu(a,n,i,o,s,"next",l)}function s(l){fu(a,n,i,o,s,"throw",l)}o(void 0)})}}class RP{static makeModel(e,t){var n=arguments;return FP(function*(){var i=n.length>2&&n[2]!==void 0?n[2]:new Zt(e),a=null;return!P.isTreeTable(t)&&!P.isPartitionedTable(t)&&t.hasInputTable&&(a=yield t.inputTable()),new xP(e,t,i,a)})()}}const Vs=RP;function Us(r,e,t){return e=LP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function LP(r){var e=AP(r,"string");return typeof e=="symbol"?e:String(e)}function AP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class eo{}Us(eo,"OPEN","ChartEvent.OPEN");Us(eo,"CLOSE","ChartEvent.CLOSE");Us(eo,"COLUMN_SELECTED","ChartEvent.COLUMN_SELECTED");const Aa=eo;function Gi(r,e,t){return e=kP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function kP(r){var e=jP(r,"string");return typeof e=="symbol"?e:String(e)}function jP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Qr{}Gi(Qr,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED");Gi(Qr,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED");Gi(Qr,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY");Gi(Qr,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND");Gi(Qr,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");const Dt=Qr;function tr(r,e,t){return e=$P(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $P(r){var e=HP(r,"string");return typeof e=="symbol"?e:String(e)}function HP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Mn{}tr(Mn,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED");tr(Mn,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED");tr(Mn,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED");tr(Mn,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS");tr(Mn,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED");tr(Mn,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN");tr(Mn,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT");tr(Mn,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");const Ve=Mn;function Jr(r,e,t){return e=VP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function VP(r){var e=UP(r,"string");return typeof e=="symbol"?e:String(e)}function UP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Cr{}Jr(Cr,"OPEN_GRID","IrisGridEvent.OPEN_GRID");Jr(Cr,"CLOSE_GRID","IrisGridEvent.CLOSE_GRID");Jr(Cr,"DATA_SELECTED","IrisGridEvent.DATA_SELECTED");Jr(Cr,"COLUMN_SELECTED","IrisGridEvent.COLUMN_SELECTED");Jr(Cr,"STATE_CHANGED","IrisGridEvent.STATE_CHANGED");Jr(Cr,"CREATE_CHART","IrisGridevent.CREATE_CHART");const jt=Cr,hm=Object.freeze({OPEN:"MarkdownEvent.OPEN"});function In(r,e,t){return e=BP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function BP(r){var e=WP(r,"string");return typeof e=="symbol"?e:String(e)}function WP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class un{}In(un,"CREATE_NOTEBOOK","NotebookEvent.createNotebook");In(un,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook");In(un,"CLOSE_FILE","NotebookEvent.closeFile");In(un,"RENAME","NotebookEvent.rename");In(un,"RENAME_FILE","NotebookEvent.renameFile");In(un,"REGISTER_FILE","NotebookEvent.registerFile");In(un,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook");In(un,"UNREGISTER_FILE","NotebookEvent.unregisterFile");In(un,"PROMOTE_FROM_PREVIEW","NotebookEvent.promoteFromPreview");const Se=un;function cm(r,e,t){return e=GP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function GP(r){var e=zP(r,"string");return typeof e=="symbol"?e:String(e)}function zP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Bs{}cm(Bs,"OPEN","PandasEvent.OPEN");cm(Bs,"CLOSE","PandasEvent.CLOSE");const KP=Bs;function ei(r,e,t){return e=qP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function qP(r){var e=XP(r,"string");return typeof e=="symbol"?e:String(e)}function XP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class yr{}ei(yr,"focus","TabEvent.focus");ei(yr,"blur","TabEvent.blur");ei(yr,"openPQObject","TabEvent.openPQObject");ei(yr,"openControl","TabEvent.openControl");ei(yr,"reload","TabEvent.reload");ei(yr,"clearAllFilters","TabEvent.clearAllFilters");const Ci=yr;function ZP(r,e,t){return e=YP(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function YP(r){var e=QP(r,"string");return typeof e=="symbol"?e:String(e)}function QP(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class mm extends b.PureComponent{constructor(e){super(e),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this)}getAllTabs(){var e,t,n,{glContainer:i}=this.props;return[...(e=i==null||(t=i.tab)===null||t===void 0||(n=t.header)===null||n===void 0?void 0:n.tabs)!==null&&e!==void 0?e:[]]}handleCloseTab(){var{glContainer:e}=this.props;e.close()}handleCloseTabsAll(){var e=this.getAllTabs();e.forEach(t=>{var n;return(n=(t==null?void 0:t.contentItem).container)===null||n===void 0?void 0:n.close()})}handleCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=t.length-1;n>0;n-=1){var i,a,o,s,l,d,u;if(((i=t[n].contentItem)===null||i===void 0||(a=i.config)===null||a===void 0?void 0:a.id)===((o=e.tab)===null||o===void 0||(s=o.contentItem)===null||s===void 0||(l=s.config)===null||l===void 0?void 0:l.id))break;(d=((u=t[n])===null||u===void 0?void 0:u.contentItem).container)===null||d===void 0||d.close()}}canCloseTabsRight(){for(var{glContainer:e}=this.props,t=this.getAllTabs(),n=!0,i=t.length-1;i>0;i-=1){var a,o,s,l,d,u,c,m;if(((a=t[i].contentItem)===null||a===void 0||(o=a.config)===null||o===void 0?void 0:o.id)===((s=e.tab)===null||s===void 0||(l=s.contentItem)===null||l===void 0||(d=l.config)===null||d===void 0?void 0:d.id))break;var f=!!(!((u=t[i])===null||u===void 0||(c=u.contentItem)===null||c===void 0||(m=c.config)===null||m===void 0)&&m.isClosable);if(f){n=!1;break}}return n}canCloseAny(){for(var e=this.getAllTabs(),t=!0,n=e.length-1;n>0;n-=1){var i,a,o,s=!!(!((i=e[n])===null||i===void 0||(a=i.contentItem)===null||a===void 0||(o=a.config)===null||o===void 0)&&o.isClosable);if(s){t=!1;break}}return t}render(){var e,t,n,{additionalActions:i,glContainer:a}=this.props,o=[...i],s=(e=a.tab)===null||e===void 0||(t=e.contentItem)===null||t===void 0||(n=t.config)===null||n===void 0?void 0:n.isClosable;return o.push({title:"Close",order:10,group:fe.groups.low,action:this.handleCloseTab,disabled:s===void 0||!s}),o.push(()=>({title:"Close Tabs to Right",order:20,group:fe.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),o.push(()=>({title:"Close All",order:30,group:fe.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),h.jsx(fe,{actions:o})}}ZP(mm,"defaultProps",{additionalActions:[]});const JP=mm;function fm(r,e,t){return e=eT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function eT(r){var e=tT(r,"string");return typeof e=="symbol"?e:String(e)}function tT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class vm extends b.PureComponent{constructor(e){super(e),fm(this,"renameInputRef",void 0),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=Z.createRef();var{value:t}=e;this.state={value:t,valueWasValidated:!1}}componentDidUpdate(e){var{isShown:t}=e,{isShown:n}=this.props;n&&!t&&this.resetState()}resetState(){var{value:e}=this.props;this.setState({value:e,valueWasValidated:!1})}handleRenameDialogOpened(){var e,t;(e=this.renameInputRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.focus()}handleRenameInputChange(e){this.setState({value:e.target.value})}handleRenameCancel(){var{onCancel:e}=this.props;e()}handleRenameSubmit(e){e.stopPropagation(),e.preventDefault();var{value:t}=this.state,n=t==null?void 0:t.trim();if(n!==void 0&&n!==""){var{onSubmit:i}=this.props;i(n)}else this.setState({value:n,valueWasValidated:!0})}renderRenameDialog(){var{isShared:e,isOwner:t,itemType:n}=this.props,{value:i,valueWasValidated:a}=this.state;return h.jsxs("form",{className:J("p-3",{"was-validated":a}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:o=>{o.stopPropagation()},onMouseUp:o=>{o.stopPropagation()},children:[h.jsxs("div",{className:"form-group",children:[h.jsxs("label",{htmlFor:"rename-dialog-".concat(n,"-input"),children:["Rename ",n]}),h.jsx("input",{type:"text",className:"form-control",id:"rename-dialog-".concat(n,"-input"),value:i??void 0,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),h.jsxs("div",{className:"invalid-feedback",children:[n," name cannot be empty"]}),(e||!t)&&h.jsxs("div",{className:"pt-2",children:["Renaming this ",n," will rename for all users."]})]}),h.jsxs("div",{className:"text-right",children:[h.jsx(Y,{kind:"secondary",className:"mr-2",onClick:this.handleRenameCancel,children:"Cancel"}),h.jsx(Y,{kind:"primary",type:"submit",children:"Rename"})]})]})}render(){var{isShown:e,onCancel:t}=this.props;return h.jsx(ys,{isShown:e,onEntered:this.handleRenameDialogOpened,onExited:t,options:{placement:"bottom"},interactive:!0,closeOnBlur:!0,children:this.renderRenameDialog()})}}fm(vm,"defaultProps",{isShared:!1,isOwner:!0,itemType:"Item",value:""});function rs(r,e,t){return e=nT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function nT(r){var e=rT(r,"string");return typeof e=="symbol"?e:String(e)}function rT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var iT=z.module("Panel");let pm=class extends b.PureComponent{constructor(e){super(e),rs(this,"ref",void 0),rs(this,"getAdditionActions",oe((n,i,a)=>{var o=[];return i&&o.push(this.getCloneAction()),a&&o.push(this.getRenameAction()),[...o,...n]})),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),this.ref=Z.createRef();var{glContainer:t}=this.props;this.state={title:A.getTitleFromContainer(t),showRenameDialog:!1,isWithinPanel:!0}}componentDidMount(){var e,t,{componentPanel:n,glContainer:i,glEventHub:a}=this.props;i.on("resize",this.handleResize),i.on("show",this.handleBeforeShow),i.on("shown",this.handleShow),i.on("hide",this.handleHide),i.on("tab",this.handleTab),i.on("tabClicked",this.handleTabClicked),a.on(Dt.SESSION_CLOSED,this.handleSessionClosed),a.on(Dt.SESSION_OPENED,this.handleSessionOpened),a.on(Ci.focus,this.handleTabFocus),a.on(Ci.blur,this.handleTabBlur),a.on(Ve.CLEAR_ALL_FILTERS,this.handleClearAllFilters),a.emit(se.MOUNT,n??this),this.setState({isWithinPanel:((e=this.ref.current)===null||e===void 0||(t=e.parentElement)===null||t===void 0?void 0:t.closest(".dh-panel"))!=null})}componentWillUnmount(){var{componentPanel:e,glContainer:t,glEventHub:n}=this.props;t.off("resize",this.handleResize),t.off("show",this.handleBeforeShow),t.off("shown",this.handleShow),t.off("hide",this.handleHide),t.off("tab",this.handleTab),t.off("tabClicked",this.handleTabClicked),n.off(Dt.SESSION_CLOSED,this.handleSessionClosed),n.off(Dt.SESSION_OPENED,this.handleSessionOpened),n.off(Ci.focus,this.handleTabFocus),n.off(Ci.blur,this.handleTabBlur),n.off(Ve.CLEAR_ALL_FILTERS,this.handleClearAllFilters),n.emit(se.UNMOUNT,e??this)}handleTab(e){e!=null&&this.setState({title:A.getTitleFromTab(e)}),this.forceUpdate();var{onTab:t}=this.props;t(e)}handleTabClicked(e){var{onTabClicked:t}=this.props;t(e)}handleClearAllFilters(){var{onClearAllFilters:e}=this.props;e(...arguments)}handleFocus(e){var{componentPanel:t,glEventHub:n}=this.props;n.emit(se.FOCUS,t??this);var{onFocus:i}=this.props;i(e)}handleBlur(e){var{onBlur:t}=this.props;t(e)}handleHide(){var{onHide:e}=this.props;e(...arguments)}handleResize(){var{onResize:e}=this.props;e(...arguments)}handleSessionClosed(e){var{onSessionClose:t}=this.props;t(e)}handleSessionOpened(e,t){var{onSessionOpen:n}=this.props;n(e,t)}handleBeforeShow(){var{onBeforeShow:e}=this.props;e(...arguments)}handleShow(){var{onShow:e}=this.props;e(...arguments)}handleTabBlur(){var{onTabBlur:e}=this.props;e(...arguments)}handleTabFocus(){var{onTabFocus:e}=this.props;e(...arguments)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){var{glContainer:t}=this.props;this.setState({showRenameDialog:!1,title:e});var n=A.getRootFromContainer(t),i=A.getComponentConfigFromContainer(t);I(i),A.renameComponent(n,i,e)}handleCopyPanel(){var{glContainer:e,glEventHub:t}=this.props,n=A.getRootFromContainer(e),i=A.getComponentConfigFromContainer(e);if(i==null){iT.error("Could not get component config from container",e);return}var a=A.cloneComponent(n,i);a!==null&&t.emit(se.CLONED,this,a)}getCloneAction(){return{title:"Copy Panel",order:10,group:fe.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:fe.groups.medium,action:this.handleShowRenameDialog}}render(){var{children:e,className:t,renderTabTooltip:n,glContainer:i,additionalActions:a,errorMessage:o,isLoaded:s,isLoading:l,isClonable:d,isRenamable:u}=this.props,{tab:c}=i,{showRenameDialog:m,title:f,isWithinPanel:g}=this.state;return h.jsxs("div",{className:J("h-100 w-100 dh-panel",t),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur,ref:this.ref,children:[e,h.jsx(dn,{errorMessage:o,isLoaded:s,isLoading:l}),!g&&c!=null&&Ha.createPortal(h.jsxs(h.Fragment,{children:[h.jsx(JP,{glContainer:i,additionalActions:this.getAdditionActions(a,d,u)}),u&&h.jsx(vm,{isShown:m,value:f,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),n!=null&&h.jsx(On,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper",children:n()})]}),c.element[0])]})}};rs(pm,"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 hn=pm;function zi(r){var{widgetType:e,widgetName:t,glContainer:n,description:i,children:a}=r,o=A.getTitleFromContainer(n);return h.jsxs("div",{className:"tab-tooltip-grid-container",children:[h.jsxs("span",{className:"tab-tooltip-title",children:[e," Name"]}),h.jsxs("div",{className:"tab-tooltip-name-wrapper",children:[h.jsx("span",{className:"tab-tooltip-name",children:t}),h.jsx(Hp,{className:"tab-tooltip-copy",tooltip:"Copy name",copy:t})]}),t!==o&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"tab-tooltip-title",children:"Display Name"}),h.jsx("span",{className:"tab-tooltip-name",children:o})]}),i&&h.jsx("div",{className:"tab-tooltip-description",children:i}),a]})}zi.propTypes={glContainer:ks.Container.isRequired,widgetType:O.string,widgetName:O.string,description:O.string,children:O.node};zi.defaultProps={widgetType:"",widgetName:"",description:null,children:null};function gm(r,e,t){return e=aT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function aT(r){var e=oT(r,"string");return typeof e=="symbol"?e:String(e)}function oT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class bm extends b.PureComponent{constructor(e){super(e),gm(this,"getCachedRenderTabTooltip",oe((t,n,i,a,o)=>t?()=>h.jsx(zi,{glContainer:n,widgetType:i,widgetName:a,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(){var{widgetName:e}=this.props;gs(e)}getErrorMessage(){var{errorMessage:e}=this.props,{isClientDisconnected:t,isPanelDisconnected:n,isWidgetDisconnected:i,isWaitingForReconnect:a}=this.state;if(e)return"".concat(e);if(t&&n&&a)return`Disconnected from server.
|
|
23
23
|
Check your internet connection.`;if(t&&n)return"Disconnected from server.";if(n){var{widgetName:o,widgetType:s}=this.props;return'Variable "'.concat(o,`" not set.
|
|
24
|
-
`).concat(s," does not exist yet.")}if(i){var{widgetName:l}=this.props;return"".concat(l," is unavailable.")}}handleSessionClosed(){var{onSessionClose:e}=this.props;this.setState({isPanelDisconnected:!0,isWaitingForReconnect:!1}),e(...arguments)}handleSessionOpened(){var{onSessionOpen:e}=this.props;e(...arguments)}render(){var{children:e,className:t,componentPanel:n,isLoaded:i,isLoading:a,glContainer:o,glEventHub:s,isDisconnected:l,isClonable:d,isRenamable:u,showTabTooltip:c,renderTabTooltip:m,widgetType:f,widgetName:g,description:v,onClearAllFilters:p,onHide:C,onFocus:S,onBlur:y,onResize:w,onShow:E,onTabBlur:D,onTabFocus:M,onTabClicked:_}=this.props,{isPanelDisconnected:T,isWidgetDisconnected:N,isPanelInactive:x}=this.state,F=this.getErrorMessage(),k=m??this.getCachedRenderTabTooltip(c,o,f,g,v),U=[{title:"Copy ".concat(f," Name"),group:fe.groups.medium,order:20,action:this.handleCopyName}];return h.jsxs(hn,{className:J(t,{disconnected:T||N||l,inactive:x}),componentPanel:n,glContainer:o,glEventHub:s,onClearAllFilters:p,onHide:C,onFocus:S,onBlur:y,onResize:w,onShow:E,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:D,onTabFocus:M,onTabClicked:_,renderTabTooltip:k,errorMessage:F,isLoaded:i,isLoading:a,isClonable:d,isRenamable:u,additionalActions:U,children:[e,x&&h.jsx("div",{className:"fill-parent-absolute"})]})}}gm(bm,"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 Ki=bm,zt=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var sT=Object.freeze({}),lT=new Map,to=Object.freeze([]),Ws=(r,e)=>{var t;return(t=st(r,e).columns)!==null&&t!==void 0?t:to},Cm=(r,e)=>{var t;return(t=st(r,e).filterSets)!==null&&t!==void 0?t:to},no=(r,e)=>{var t;return(t=st(r,e).filters)!==null&&t!==void 0?t:to},ro=(r,e)=>{var t;return(t=st(r,e).tableMap)!==null&&t!==void 0?t:lT},io=(r,e)=>st(r,e).isolatedLinkerPanelId,Sr=(r,e)=>{var t;return(t=st(r,e).links)!==null&&t!==void 0?t:to},ao=(r,e)=>st(r,e).columnSelectionValidator,dT=(r,e)=>{var t;return(t=st(r,e).consoleSettings)!==null&&t!==void 0?t:sT},uT=(r,e)=>st(r,e).connection,ti=(r,e)=>st(r,e).sessionWrapper,hT=(r,e)=>t=>t(Dn(r,{connection:e})),cT=(r,e)=>t=>t(Dn(r,{sessionWrapper:e})),oo=(r,e)=>t=>t(Dn(r,{links:e})),ym=(r,e)=>(t,n)=>{var i=Sr(n(),r),a=e.filter(o=>i.findIndex(s=>mr(s.start,o.start)&&mr(s.end,o.end))<0);return t(oo(r,i.concat(a)))},Sm=(r,e)=>(t,n)=>{var i=Sr(n(),r),a=i.filter(o=>!e.includes(o.id));return t(oo(r,a))},Gs=(r,e)=>t=>t(Dn(r,{isolatedLinkerPanelId:e})),wm=(r,e)=>t=>t(Dn(r,{columnSelectionValidator:e})),Em=(r,e)=>t=>t(Dn(r,{consoleSettings:e})),Pm=(r,e)=>t=>t(Dn(r,{filterSets:e}));function Tm(r){var{columnMap:e,inputFilterMap:t,linkedColumnMap:n,onAdd:i,onOpenLinker:a,waitingFilterMap:o,waitingInputMap:s}=r,l=b.useMemo(()=>{var g=Array.from(s.keys()),v=g.find(S=>t.get(S)!=null),p=g.find(S=>n.get(S)!=null),C=Lt.join(g.map(S=>'"'.concat(S,'"')));return v!=null&&v&&p!=null&&p?"Use a filter control or linked table to set a value for ".concat(C):v!=null&&v?"Set a filter control value for ".concat(C):"Double click a row in a linked table to set a value for ".concat(C)},[t,n,s]),d=b.useMemo(()=>Array.from(e.values()),[e]),u=b.useCallback(g=>{g.stopPropagation(),g.preventDefault(),i(Array.from(o.values()))},[i,o]),c=b.useCallback(g=>{g.stopPropagation(),g.preventDefault(),a()},[a]),m=o.size>0,f=!m&&s.size>0;return h.jsx("div",{className:"chart-panel-overlay chart-filter-overlay",children:h.jsxs("div",{className:J("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":m},{"chart-filter-waiting-input":f}),children:[m&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),h.jsx("div",{className:"waiting-filter-list",children:d.map(g=>{var v=o.has(g.name),p=v?vs:Qf;return h.jsxs("div",{className:J("waiting-filter-item",{"is-invalid":v}),children:[h.jsx(ue,{icon:p}),g.name]},g.name)})}),h.jsxs("div",{children:[h.jsx(Tl,{onClick:u,className:"btn-primary",children:"Add Input Filters"}),h.jsx(Tl,{onClick:c,className:"btn-primary",children:"Open Linker Tool"})]})]}),f&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"info-message",children:"Waiting for User Input"}),h.jsx("div",{className:"",children:l})]})]})})}Tm.propTypes={columnMap:O.instanceOf(Map).isRequired,inputFilterMap:O.instanceOf(Map).isRequired,linkedColumnMap:O.instanceOf(Map).isRequired,onAdd:O.func.isRequired,onOpenLinker:O.func.isRequired,waitingFilterMap:O.instanceOf(Map).isRequired,waitingInputMap:O.instanceOf(Map).isRequired};function Ri(r){var{columns:e,onColumnSelected:t,onMouseEnter:n,onMouseLeave:i}=r;return h.jsx("div",{className:"chart-panel-overlay chart-column-selector-overlay",children:h.jsxs("div",{className:J("chart-panel-overlay-content"),children:[h.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),h.jsx("div",{className:"waiting-column-select-list",children:e.map(a=>h.jsx(tc,{className:J("btn-chart-column-selector",Ri.makeButtonClassName(a.name)),onClick:()=>t(a.name),onMouseEnter:()=>{n&&n(a)},onMouseLeave:i,disabled:!a.isValid,isLinked:a.isActive,children:a.name},a.name))})]})})}Ri.makeButtonClassName=r=>"btn-chart-column-selector-".concat(r);Ri.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};function jr(r){return r.settings!==void 0}function zs(r){return r.figure!==void 0}function _m(r){if(r==null)return!1;var{settings:e,tableSettings:t}=r;return typeof e=="object"&&typeof t=="object"}function Om(r){return r!=null&&_m(r.panelState)}function vu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vu(Object(t),!0).forEach(function(n){Bt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Bt(r,e,t){return e=mT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mT(r){var e=fT(r,"string");return typeof e=="symbol"?e:String(e)}function fT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var pt=z.module("ChartPanel"),vT=150;function pT(r){return r.inputFilters!=null}function gT(r){return r.panelState!=null}class so extends b.Component{constructor(e){super(e),Bt(this,"panelContainer",void 0),Bt(this,"pending",void 0),Bt(this,"getWaitingInputMap",oe((o,s,l)=>{if(!o)return new Map;var d=new Map(s);return l.forEach((u,c)=>{d.delete(c)}),d})),Bt(this,"getWaitingFilterMap",oe((o,s,l,d,u)=>{if(!o)return new Map;var c=new Map(s);return l.forEach((m,f)=>{c.delete(f)}),u.forEach((m,f)=>{c.delete(f)}),d.forEach((m,f)=>{c.delete(f)}),c})),Bt(this,"getInputFilterColumnMap",oe((o,s)=>{for(var l=new Map,d=0;d<s.length;d+=1){var u=s[d],{name:c,type:m}=u,f=o.get(c);f!=null&&f.type===m&&l.set(c,u)}return l})),Bt(this,"getLinkedColumnMap",oe((o,s)=>{for(var l=new Map,d=A.getIdFromPanel(this),u=0;u<s.length;u+=1){var c=s[u],m=null;if(c.start!=null&&c.start.panelId===d&&o.has(c.start.columnName)?m=c.start.columnName:c.end&&c.end.panelId===d&&o.has(c.end.columnName)&&(m=c.end.columnName),m!=null&&o.has(m)){var f=o.get(m);I(f),l.set(m,f)}}return l})),Bt(this,"getSelectorColumns",oe((o,s,l)=>Array.from(o.values()).map(d=>({name:d.name,type:d.type,isValid:l?l(this,d):!1,isActive:s.has(d.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.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=It(this.updateModelFromSource.bind(this),vT),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=Z.createRef(),this.pending=new Qn;var{metadata:t,panelState:n}=e,{filterValueMap:i=[],settings:a={}}=n??{};this.state={settings:a,error:void 0,isActive:!1,isDisconnected:!1,isLoading:!1,isLoaded:!1,isLinked:t!=null&&jr(t)&&t.settings.isLinked,filterMap:new Map(i),filterValueMap:new Map(i),model:void 0,columnMap:new Map,panelState:n}}componentDidMount(){this.isHidden()||(this.setState({isActive:!0}),this.initModel())}componentDidUpdate(e,t){var{inputFilters:n,source:i,makeModel:a}=this.props,{columnMap:o,model:s,filterMap:l,filterValueMap:d,isLinked:u,settings:c}=this.state;s&&(a!==e.makeModel&&this.initModel(),o!==t.columnMap&&this.pruneFilterMaps(),n!==e.inputFilters&&this.updateChangedInputFilters(n,e.inputFilters),l!==t.filterMap?this.updateFilters():d!==t.filterValueMap&&this.updatePanelState(),c!==t.settings&&ed(s)&&(s.updateSettings(c),this.updatePanelState()),u!==t.isLinked?i&&(u?(this.startListeningToSource(i),this.updateModelFromSource()):this.stopListeningToSource(i)):u&&i!==e.source&&(e.source&&this.stopListeningToSource(e.source),i&&(this.startListeningToSource(i),this.updateModelFromSource())))}componentWillUnmount(){this.pending.cancel();var{model:e}=this.state,{source:t}=this.props;e!=null&&t&&this.stopListeningToSource(t)}initModel(){this.setState({isLoading:!0,isLoaded:!1,error:void 0});var{makeModel:e}=this.props;this.pending.add(e(),t=>{t.close()}).then(this.handleLoadSuccess,this.handleLoadError)}startListeningToSource(e){pt.debug("startListeningToSource",e);var{model:t}=this.state;I(t);var{dh:n}=t;e.addEventListener(n.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.addEventListener(n.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(n.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}stopListeningToSource(e){pt.debug("stopListeningToSource",e);var{model:t}=this.state;I(t);var{dh:n}=t;e.removeEventListener(n.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.removeEventListener(n.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(n.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}loadModelIfNecessary(){var{isActive:e,isLoaded:t,isLoading:n}=this.state;e&&!t&&!n&&this.initModel()}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}handleColumnSelected(e){var{glEventHub:t}=this.props,{columnMap:n}=this.state;t.emit(Aa.COLUMN_SELECTED,this,n.get(e))}handleColumnMouseEnter(e){var{type:t,name:n}=e,{columnSelectionValidator:i}=this.props;pt.debug("handleColumnMouseEnter",i,t,n),i&&i(this,{type:t,name:n})}handleColumnMouseLeave(){var{columnSelectionValidator:e}=this.props;pt.debug("handleColumnMouseLeave",e),e&&e(this,void 0)}handleDisconnect(){this.setState({error:new Error("Figure disconnected"),isDisconnected:!0})}handleFilterAdd(e){for(var t=0;t<e.length;t+=1)this.openInputFilter(e[t])}handleOpenLinker(){var{localDashboardId:e,setActiveTool:t,setDashboardIsolatedLinkerPanelId:n}=this.props;n(e,void 0),t(zt.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:void 0}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){pt.debug("handleLoadSuccess");var{model:t}=this.state;this.setState({model:e,isLoaded:!0},()=>{var{inputFilters:n,source:i}=this.props,{filterMap:a,isLinked:o}=this.state;e!==t&&(this.sendColumnChange(),this.updateColumnFilters(),this.updateInputFilters(n,a.size>0||e.isFilterRequired()),i&&o&&(this.startListeningToSource(i),this.updateModelFromSource()))})}handleLoadError(e){we.isCanceled(e)||(pt.error("handleLoadError",e),this.setState({error:e,isLoading:!1}))}handleSourceColumnChange(){this.updateModelFromSource()}handleSourceFilterChange(){this.updateModelFromSource()}handleSourceSortChange(){this.updateModelFromSource()}updateModelFromSource(){var{metadata:e,source:t}=this.props,{isLinked:n,model:i}=this.state;if(!n||!i||!t){pt.debug2("updateModelFromSource ignoring",n,i,t);return}var{dh:a}=i;if(this.pending.cancel(),jr(e)){var{settings:o}=e;this.pending.add(a.plot.Figure.create(new ut(a).makeFigureSettings(o,t))).then(s=>{ed(i)&&i.setFigure(s)}).catch(this.handleLoadError)}this.updatePanelState()}updatePanelState(){var{sourcePanel:e}=this.props,{panelState:t,filterValueMap:n,settings:i}=this.state,{tableSettings:a}=t??{};if(e&&pT(e.props)&&gT(e.state)){var{inputFilters:o}=e.props,{panelState:s}=e.state;s!=null&&(a=Ne.extractTableSettings(s,o))}this.setState({panelState:{settings:i,tableSettings:a,filterValueMap:Array.from(n)}})}handleError(){this.setState({isLoading:!1})}handleSettingsChanged(e){this.setState(t=>{var{settings:n}=t,i=pu(pu({},n),e);return pt.debug("Updated settings",i),{settings:i}})}handleHide(){this.setActive(!1)}handleShow(){this.setActive(!0)}handleTabBlur(){this.setActive(!1)}handleTabFocus(){var e=this.isHidden();this.setActive(!e)}handleUpdate(e){var{isLoading:t}=e;this.setState({isLoading:t})}handleClearAllFilters(){this.setState({filterValueMap:new Map,filterMap:new Map}),this.updatePanelState()}openInputFilter(e){var{glEventHub:t}=this.props,{name:n,type:i}=e;t.emit(Ve.OPEN_INPUT,{title:"".concat(n," Filter"),panelState:{name:n,type:i,isValueShown:!0},createNewStack:!0,focusElement:"input"})}setActive(e){this.setState({isActive:e},()=>{e&&this.loadModelIfNecessary()})}sendColumnChange(){var{model:e}=this.state;if(e){var{glEventHub:t}=this.props;t.emit(Ve.COLUMNS_CHANGED,this,Array.from(e.getFilterColumnMap().values()))}}getCoordinateForColumn(e){var t,n=Ri.makeButtonClassName(e);if(!this.panelContainer.current)return null;var i=this.panelContainer.current.querySelector(".".concat(n)),a=(t=i==null?void 0:i.getBoundingClientRect())!==null&&t!==void 0?t:null;if(a==null||a.width<=0||a.height<=0)return null;var o=a.left+a.width/2,s=a.bottom;return[o,s]}setFilterMap(e){pt.debug("setFilterMap",e),this.setState(t=>{var n,{columnMap:i,filterMap:a}=t,o=null,s=new Map(t.filterValueMap);return e.forEach((l,d)=>{var{columnType:u,filterList:c}=l,m=i.get(d);if(!(m==null||m.type!==u)){if(c.length<1){pt.debug("Ignoring empty filterList for column",d);return}var{value:f}=c[0];s.set(d,f),a.get(d)!==f&&(o===null&&(o=new Map(a)),o.set(d,f))}}),{filterValueMap:s,filterMap:(n=o)!==null&&n!==void 0?n:a}})}unsetFilterValue(e){this.setState(t=>{var{inputFilters:n}=this.props,{columnMap:i}=t,{filterMap:a,filterValueMap:o}=t;if(!o.has(e))return null;o=new Map(t.filterValueMap),o.delete(e);var s=this.getInputFilterColumnMap(i,n);if(s.has(e)){var l,d=a.get(e),u=(l=s.get(e))===null||l===void 0?void 0:l.value;u!=null&&d!==u&&(a=new Map(t.filterMap),u.length>0?a.set(e,u):a.delete(e))}else a=new Map(t.filterMap),a.delete(e);return{filterMap:a,filterValueMap:o}})}updateChangedInputFilters(e,t){var n=t.filter(a=>e.find(o=>o.name===a.name&&o.type===a.type)===void 0);n.length>0&&this.deleteInputFilters(n);var i=e.filter(a=>!t.includes(a));i.length>0&&this.updateInputFilters(i)}updateInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState(n=>{for(var{columnMap:i}=n,a=new Map(n.filterValueMap),o=new Map(n.filterMap),s=t?{filterMap:o,filterValueMap:a}:{},l=0;l<e.length;l+=1){var{name:d,type:u,value:c}=e[l],m=i.get(d);m!=null&&m.type===u&&(c!=null&&o.get(d)!==c&&(c===""?o.delete(d):o.set(d,c),s.filterMap=o),a.has(d)&&(a.delete(d),s.filterValueMap=a))}return pt.debug("updateInputFilters",s),s})}deleteInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState(n=>{for(var{columnMap:i,filterValueMap:a}=n,o=new Map(n.filterMap),s=t,l=0;l<e.length;l+=1){var{name:d,type:u}=e[l],c=i.get(d);if(c!=null&&c.type===u&&o.has(d)){var m=o.get(d);if(a.has(d)){var f=a.get(d);f!==m&&f!=null&&(s=!0,o.set(d,f))}else s=!0,o.delete(d)}}return pt.debug("deleteInputFilters",s),s?{filterMap:o}:null})}updateColumnFilters(){this.setState(e=>{var{model:t}=e;return t?{columnMap:t.getFilterColumnMap()}:null})}updateFilters(){var{columnMap:e,filterMap:t,model:n}=this.state;I(n);var i=this.getWaitingInputMap(n.isFilterRequired(),e,t);if(n.setFilter(t),t.size>0&&i.size===0){var a=n.getDefaultTitle(),o=Lt.join(Array.from(t.entries()).map(s=>{var[l,d]=s;return"".concat(l,": ").concat(d)}));a?n.setTitle("".concat(a,'<br><span style="font-size: smaller">').concat(o,"</span>")):n.setTitle(o),pt.debug2("updateFilters filters set",t),this.setState({isLoading:!0})}else pt.debug2("updateFilters waiting on inputs",i),n.setTitle(n.getDefaultTitle()),this.setState({isLoading:!1});this.updatePanelState()}pruneFilterMaps(){this.setState(e=>{var{columnMap:t}=e,n=new Map(e.filterMap),i=new Map(e.filterValueMap),a={};return e.filterValueMap.forEach((o,s)=>{t.has(s)||(i.delete(s),a.filterValueMap=i)}),e.filterMap.forEach((o,s)=>{t.has(s)||(n.delete(s),a.filterMap=n)}),a})}render(){var e,{columnSelectionValidator:t,glContainer:n,glEventHub:i,inputFilters:a,isLinkerActive:o,links:s,metadata:l,settings:d,Plotly:u,containerRef:c}=this.props,{columnMap:m,filterMap:f,error:g,model:v,isActive:p,isDisconnected:C,isLoaded:S,isLoading:y}=this.state,w;jr(l)?w=l.table:zs(l)?w=l.figure:w=l.name;var E=this.getInputFilterColumnMap(m,a),D=this.getLinkedColumnMap(m,s),M=v!=null?this.getWaitingInputMap(v.isFilterRequired(),m,f):new Map,_=v!=null?this.getWaitingFilterMap(v.isFilterRequired(),m,f,D,E):new Map,T=g!=null?"Unable to open chart. ".concat(g):void 0,N=M.size>0,x=m.size>0&&o;return h.jsx(Ki,{className:J("iris-chart-panel",{"input-required":N}),componentPanel:this,glContainer:n,glEventHub:i,onHide:this.handleHide,onClearAllFilters:this.handleClearAllFilters,onShow:this.handleShow,onTabBlur:this.handleTabBlur,onTabFocus:this.handleTabFocus,errorMessage:T,isDisconnected:C,isLoading:y,isLoaded:S,widgetName:(e=w)!==null&&e!==void 0?e:void 0,widgetType:"Chart",children:h.jsxs("div",{ref:this.panelContainer,className:"chart-panel-container h-100 w-100",children:[h.jsx("div",{className:"chart-container h-100 w-100",children:S&&v&&h.jsx(oc,{isActive:p,model:v,settings:d,onDisconnect:this.handleDisconnect,onReconnect:this.handleReconnect,onUpdate:this.handleUpdate,onError:this.handleError,onSettingsChanged:this.handleSettingsChanged,Plotly:u,containerRef:c})}),h.jsx(Pa,{in:N&&!x&&!y,timeout:_a.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h.jsx(Tm,{inputFilterMap:E,linkedColumnMap:D,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:m,waitingFilterMap:_,waitingInputMap:M})}),h.jsx(Pa,{in:x,timeout:_a.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h.jsx(Ri,{columns:this.getSelectorColumns(m,D,t),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}Bt(so,"defaultProps",{columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{},containerRef:null});Bt(so,"displayName","ChartPanel");Bt(so,"COMPONENT","ChartPanel");var bT=(r,e)=>{var{localDashboardId:t,metadata:n}=e,i;n!=null&&jr(n)&&(i=n.sourcePanelId);var a=ro(r,t),o=$c(r,t),s=$s(r),l=io(r,t),d=s===zt.LINKER&&l===void 0;return{columnSelectionValidator:ao(r,t),isLinkerActive:d,inputFilters:no(r,t),links:Sr(r,t),source:i!=null?a.get(i):void 0,sourcePanel:i!=null?o.get(i):void 0,settings:Ui(r)}},CT=Ht(bT,{setActiveTool:Rc,setDashboardIsolatedLinkerPanelId:Gs},null,{forwardRef:!0})(so);const qi=CT;function ka(r,e,t){return e=yT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yT(r){var e=ST(r,"string");return typeof e=="symbol"?e:String(e)}function ST(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ua=z.module("CommandHistoryPanel");class Xi extends b.Component{static handleError(e){ua.error(e)}constructor(e){super(e),ka(this,"container",void 0),ka(this,"pending",void 0),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=Z.createRef(),this.pending=new Qn;var{session:t,sessionId:n,language:i}=e;this.state={panelState:{},session:t,sessionId:n,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:mt.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(Dt.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Dt.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:n,sessionId:i}=t;this.setState({session:e,sessionId:i,language:n},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{session:n,language:i}=this.state;if(ua.debug("handleSendToNotebook",n,e),!n){ua.error("Session is not connected.");return}var{glEventHub:a}=this.props;a.emit(t?Se.CREATE_NOTEBOOK:Se.SEND_TO_NOTEBOOK,n,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;ua.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Dt.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;I(t),I(n),this.pending.add(e.getTable(t,n,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(Xi.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:i,contextActions:a,table:o}=this.state;return h.jsxs(hn,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!o&&h.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),o&&i!=null&&h.jsxs(h.Fragment,{children:[h.jsx(V0,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:o,commandHistoryStorage:n}),h.jsx(fe,{actions:a})]})]})}}ka(Xi,"COMPONENT","CommandHistoryPanel");ka(Xi,"TITLE","Command History");var wT=(r,e)=>{var t=Mc(r),n=ti(r,e.localDashboardId),{session:i,config:a}=n??{},{type:o,id:s}=a??{};return{commandHistoryStorage:t,language:o,session:i,sessionId:s}},ET=Ht(wT,null,null,{forwardRef:!0})(Xi);const Dm=ET;function gu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ha(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gu(Object(t),!0).forEach(function(n){hr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):gu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hr(r,e,t){return e=PT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function PT(r){var e=TT(r,"string");return typeof e=="symbol"?e:String(e)}function TT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ca=z.module("ConsolePanel"),_T=500,OT=Object.freeze({consoleSettings:{},itemIds:[]});class lo extends b.PureComponent{constructor(e){super(e),hr(this,"consoleRef",void 0),hr(this,"objectSubscriptionCleanup",void 0),hr(this,"savePanelState",It(()=>{var{consoleSettings:o,itemIds:s}=this.state,l={consoleSettings:o,itemIds:[...s]};ca.debug("Saving panel state",l),this.setState({panelState:l})},_T)),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.handlePanelMount=this.handlePanelMount.bind(this),this.supportsType=this.supportsType.bind(this),this.iconForType=this.iconForType.bind(this),this.consoleRef=Z.createRef();var{panelState:t}=e,n=ha(ha({},OT),t||{}),{consoleSettings:i,itemIds:a}=n;this.state={consoleSettings:i,itemIds:new Map(a),objectMap:new Map,error:void 0,panelState:n}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(se.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:n,itemIds:i}=this.state;(t.consoleSettings!==n||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(se.MOUNT,this.handlePanelMount),(e=this.objectSubscriptionCleanup)===null||e===void 0||e.call(this)}subscribeToFieldUpdates(){var{sessionWrapper:e}=this.props;if(e!=null){var{session:t}=e;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(n=>{ca.debug("Got updates",n),this.setState(i=>{var{objectMap:a}=i,{updated:o,created:s,removed:l}=n,d=[...o,...l],u=new Map(a);d.forEach(m=>{var{title:f}=m;f!==void 0&&u.delete(f)});var c=[...o,...s];return c.forEach(m=>{m.title!==void 0&&u.set(m.title,m)}),{objectMap:u}})})}}setItemId(e,t){this.setState(n=>{var{itemIds:i}=n,a=new Map(i);return a.set(e,t),{itemIds:a}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:n}=this.state,i=n.get(e);return i==null&&t&&(i=Ue.generate(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,n,i,{itemIds:a}=this.state,o=e==null||(t=e.props)===null||t===void 0?void 0:t.id,s=e==null||(n=e.props)===null||n===void 0||(i=n.metadata)===null||i===void 0?void 0:i.sourcePanelId;if(o&&s){var l=new Set(a.values());l.has(s)&&this.setItemId(o,o)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(Dt.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:n}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&A.getStackForRoot(n,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var n=this.getItemId(t,!1);if(n!=null){var{glEventHub:i}=this.props;i.emit(se.CLOSE,n)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;ca.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Dt.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:n}=this.props;I(n);var{config:i,session:a}=n,{title:o}=e;I(o);var s=this.getItemId(o),l={fetch:()=>a.getObject(e),panelId:s,widget:ha(ha({},cg(e)),{},{sessionId:i.id})};ca.debug("openWidget",l),t.emit(se.OPEN,l)}addCommand(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,n,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:n}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var a=[...n.values()],{glEventHub:o}=this.props;a.forEach(s=>{o.emit(se.CLOSE,s)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(n=>hl(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>hl(i,e));return n!=null?vv(n):h.jsx(Rw,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:a,unzip:o}=this.props;if(i==null)return h.jsx(dn,{isLoading:!1,errorMessage:"Console is disabled."});var{consoleSettings:s,error:l,objectMap:d}=this.state,{config:u,session:c,connection:m,details:f={},dh:g}=i,{workerName:v,processInfoId:p}=f,{id:C,type:S}=u;return h.jsx(hn,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:n,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:c!=null&&h.jsx(y0,{dh:g,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:S,statusBarChildren:h.jsxs(h.Fragment,{children:[h.jsx("div",{children:qc.LANGUAGE_MAP.get(S)}),v!=null&&h.jsxs(h.Fragment,{children:[h.jsx("div",{children:"•"}),v]}),p!=null&&h.jsxs(h.Fragment,{children:[h.jsx("div",{children:"•"}),p,h.jsx("div",{children:"•"})]}),h.jsx(X0,{connection:m,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),scope:C,timeZone:a,objectMap:d,unzip:o,supportsType:this.supportsType,iconForType:this.iconForType})})}}hr(lo,"COMPONENT","ConsolePanel");hr(lo,"TITLE","Console");hr(lo,"contextType",_y);var DT=(r,e)=>({commandHistoryStorage:Mc(r),sessionWrapper:ti(r,e.localDashboardId),timeZone:js(r),plugins:jy(r)}),MT=Ht(DT,null,null,{forwardRef:!0})(lo);const Sa=MT;function Wt(r,e,t){return e=IT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function IT(r){var e=NT(r,"string");return typeof e=="symbol"?e:String(e)}function NT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ma=z.module("DropdownFilter"),xT=150;class _n extends b.Component{constructor(e){super(e),Wt(this,"dropdownRef",void 0),Wt(this,"getCompatibleColumns",oe((a,o)=>a!=null?o.filter(s=>{var{type:l}=s;return l!==void 0&&P.isCompatibleType(l,a.columnType)}):[])),Wt(this,"getColumnOptions",oe((a,o)=>{var s=-1,l=[];return l.push(h.jsx("option",{value:"-1",children:"Select a column"},"placeholder")),a.forEach((d,u)=>{l.push(h.jsx("option",{value:u,children:this.getItemLabel(a,u)},"".concat(d.name,"/").concat(d.type))),o!==null&&d.name===o.name&&d.type===o.type&&(s=u)}),[l,s]})),Wt(this,"getSelectedOptionIndex",oe((a,o)=>a.indexOf(o))),Wt(this,"getValueOptions",oe(a=>[h.jsx("option",{value:"-1",children:_n.PLACEHOLDER},"-1"),...a.map((o,s)=>h.jsx("option",{value:s,children:o??"(null)"},"".concat(s,"/").concat(o)))])),Wt(this,"getItemLabel",qe((a,o)=>{var{name:s,type:l}=a[o];if(o>0&&a[o-1].name===s||o<a.length-1&&a[o+1].name===s){var d=l.substring(l.lastIndexOf(".")+1);return"".concat(s," (").concat(d,")")}return s})),Wt(this,"sendUpdate",It(()=>{var{onChange:a}=this.props,{column:o,value:s,isValueShown:l}=this.state;a({column:o,isValueShown:l,value:s??void 0})},xT)),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.dropdownRef=Z.createRef();var{column:t,isValueShown:n,value:i}=e;this.state={column:t,id:Ue(),selectedColumn:t,disableCancel:!n,isValueShown:n,value:i}}componentDidUpdate(e,t){var{source:n,values:i,isLoaded:a}=this.props,{column:o,value:s,isValueShown:l}=this.state;a&&(n!==e.source&&this.sourceUpdated(),i!==e.values&&s!==""&&!i.includes(s)&&this.resetValue(),l!==t.isValueShown&&l&&this.focusInput(),(o!==t.column||s!==t.value||l!==t.isValueShown)&&this.sendUpdate())}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){var t=e;if(ma.debug2("handleColumnChange",t),t!=null&&parseInt(t,10)<0){this.setState({selectedColumn:null});return}var{columns:n,source:i}=this.props,a=this.getCompatibleColumns(i,n);this.setState({selectedColumn:a[parseInt(t,10)]})}handleDropdownKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),ma.debug2("handleDropdownKeyPress"),this.sendUpdate(),this.sendUpdate.flush())}handleValueChange(e){var t=e,n=parseInt(t,10),i="",{values:a}=this.props;n>=0&&n<a.length?i=a[n]:ma.debug2("Selected default item"),ma.debug2("handleValueChange",i),this.setState({value:i})}handleSettingsCancel(){this.setState(e=>{var{column:t}=e;return{selectedColumn:t,isValueShown:!0}})}handleSettingsSave(){this.setState(e=>{var{column:t,selectedColumn:n,value:i}=e;return{column:n,value:t===n?i:"",isValueShown:!0,disableCancel:!1}})}handleSettingsClick(e){e.stopPropagation(),this.showSettings()}handleBackgroundClick(e){e.target!==this.dropdownRef.current&&this.focusInput()}sourceUpdated(){this.setState({column:null,selectedColumn:null,isValueShown:!1,disableCancel:!0,value:""})}showSettings(){var{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!1})}focusInput(){var e;(e=this.dropdownRef.current)===null||e===void 0||e.focus()}resetValue(){this.setState({value:""})}clearFilter(){this.resetValue()}setFilterState(e){var{name:t,type:n,value:i,isValueShown:a}=e,o=t!=null&&n!=null?{name:t,type:n}:null;this.setState(s=>{var{value:l,isValueShown:d}=s;return{column:o,value:i??l,isValueShown:a??d}})}render(){var e,{columns:t,disableLinking:n,isLinkerActive:i,isLoaded:a,source:o,onColumnSelected:s,onSourceMouseEnter:l,onSourceMouseLeave:d,values:u,settingsError:c}=this.props,{column:m,disableCancel:f,id:g,isValueShown:v,selectedColumn:p,value:C}=this.state,S=o===null,y=this.getCompatibleColumns(o,t),w=o!=null,E=(e=o==null?void 0:o.columnName)!==null&&e!==void 0?e:_n.SOURCE_BUTTON_PLACEHOLDER,D=m!=null?"".concat(m.name," Filter"):null,[M,_]=this.getColumnOptions(y,p),T=this.getValueOptions(u),N=this.getSelectedOptionIndex(u,C),x=!w||p==null,F=v&&!i,k="source-column-btn-".concat(g),U="filter-column-select-".concat(g);return h.jsxs(ws,{className:"dropdown-filter fill-parent-absolute",isFlipped:F,children:[h.jsx("div",{className:"dropdown-filter-settings-card",children:h.jsxs("div",{className:"dropdown-filter-card-content",children:[h.jsxs("div",{className:"dropdown-filter-settings-grid",children:[h.jsx("label",{htmlFor:k,children:"Source Column"}),h.jsx(tc,{id:k,isLinked:w,onClick:s,onMouseEnter:l,onMouseLeave:d,className:_n.SOURCE_BUTTON_CLASS_NAME,disabled:n,children:E}),h.jsx("div",{className:"text-muted small",children:"Select a source column for the list by linking to a table."}),h.jsx("label",{htmlFor:U,children:"Filter Column"}),h.jsx(Vr,{id:U,value:String(_),className:"custom-select",onChange:this.handleColumnChange,disabled:S,children:M}),h.jsx("div",{className:"text-muted small",children:"Dropdown filter control will apply its filter to all columns matching this name in this dashboard."})]}),c&&h.jsx("div",{className:"error-message text-center",children:c}),w&&h.jsxs("div",{className:"dropdown-filter-settings-buttons",children:[h.jsx(Y,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:f||v||i,tooltip:i?"Cancel disabled while linker open":void 0,children:"Cancel"}),h.jsx(Y,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:x||v||i,tooltip:i?"Save disabled while linker open":void 0,children:"Save"})]})]})}),h.jsx("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick,"data-testid":"dropdown-filter-value-background",children:a&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"dropdown-filter-column",children:h.jsx("div",{className:"dropdown-filter-column-title",children:D})}),h.jsxs("div",{className:"dropdown-filter-card-content",children:[h.jsx("div",{className:"dropdown-filter-value-input d-flex flex-column justify-content-center",children:h.jsx(Vr,{className:"custom-select",value:String(N),ref:this.dropdownRef,onChange:this.handleValueChange,onKeyDown:this.handleDropdownKeyPress,title:"Select Value",children:T})}),c&&h.jsx("div",{className:"error-message mt-3 text-center",children:c})]}),h.jsx("div",{className:"dropdown-filter-menu",children:h.jsx(Y,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h.jsx(ue,{icon:Va,transform:"grow-4"}),tooltip:"Dropdown Filter Settings"})})]})})]})}}Wt(_n,"defaultProps",{column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}});Wt(_n,"PLACEHOLDER","Select a value...");Wt(_n,"SOURCE_BUTTON_CLASS_NAME","btn-dropdown-filter-selector");Wt(_n,"SOURCE_BUTTON_PLACEHOLDER","Select a column");const bu=_n;function ht(r,e,t){return e=FT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function FT(r){var e=RT(r,"string");return typeof e=="symbol"?e:String(e)}function RT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Fe=z.module("DropdownFilterPanel"),LT=250,AT=(r,e)=>{var{localDashboardId:t}=e,n=A.getIdFromPanel({props:e}),i=ro(r,t),a=Sr(r,t),o=$s(r),s=io(r,t),l=o===zt.LINKER&&(s===void 0||s===n),d=o===zt.LINKER&&s!==void 0&&s!==n;return{columns:Ws(r,t),columnSelectionValidator:ao(r,t),dh:Oc(r),isLinkerActive:l,disableLinking:d,settings:Ui(r),panelTableMap:i,dashboardLinks:a}},kT=Ht(AT,null,null,{forwardRef:!0});class qt extends b.Component{constructor(e){super(e),ht(this,"dateTimeFormatter",void 0),ht(this,"dropdownFilterRef",void 0),ht(this,"panelContainer",void 0),ht(this,"pending",void 0),ht(this,"cleanup",void 0),ht(this,"columnFormats",void 0),ht(this,"getCachedValues",qe((c,m,f)=>{var{type:g,name:v}=m;return g!==void 0&&P.isDateType(g)?c.map(p=>this.dateTimeFormatter.format(p)):c.map(p=>p!=null&&g!=null?f.getFormattedString(p,g,v):null)})),ht(this,"getCachedPanelLinks",qe((c,m)=>{var f=A.getIdFromPanel(m);return Fe.debug("getCachedPanelLinks",c,f),c.filter(g=>{var v;return((v=g.end)===null||v===void 0?void 0:v.panelId)===f})})),ht(this,"getCachedSource",qe(c=>{Fe.debug("getCachedSource",c);var m;if(c.length>0){var[f]=c;m=f.start,c.length>1&&Fe.error("Filter has more that one link",c)}return m})),ht(this,"getCachedSourceTable",qe((c,m)=>{var f;if(Fe.debug("getCachedSourceTable",c,m),m==null)return null;var{panelId:g}=m;return(f=c.get(g))!==null&&f!==void 0?f:null})),ht(this,"getCachedSourceColumn",qe((c,m)=>{var f;return Fe.debug("getCachedSourceColumn",c,m),c==null||m==null?null:(f=c.columns.find(g=>{var{name:v,type:p}=g;return v===m.columnName&&p===m.columnType}))!==null&&f!==void 0?f:null})),this.handleChange=It(this.handleChange.bind(this),LT),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=Z.createRef(),this.panelContainer=Z.createRef(),this.pending=new Qn;var{dh:t,panelState:n,settings:i}=e;this.columnFormats=$o.getColumnFormats(i),this.dateTimeFormatter=new kt(t,{showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"});var{value:a="",isValueShown:o=!1,name:s,type:l,timestamp:d}=n??{},u=s!=null&&l!=null?{name:s,type:l}:void 0;this.state={column:u,formatter:new Zt(t,this.columnFormats),valuesTable:void 0,valuesColumn:void 0,sourceSize:0,value:a,timestamp:d,values:[],isValueShown:o,wasFlipped:!1,skipUpdate:!1,panelState:n,isDisconnected:!1,isLoading:!1,isLoaded:!1,error:null}}componentDidMount(){this.updateValuesTable();var{dashboardLinks:e,panelTableMap:t}=this.props,{column:n,value:i,timestamp:a}=this.state,o=this.getSourceTable(t,e);if(o!==null&&this.startListeningToSource(o),n!=null){var{name:s,type:l}=n;this.sendUpdate(s,l,i,a)}}componentDidUpdate(e,t){var{dashboardLinks:n,panelTableMap:i,settings:a}=this.props,{valuesTable:o}=this.state,s=this.getSource(n),l=this.getSourceTable(i,n),d=this.getSource(e.dashboardLinks),u=this.getSourceTable(e.panelTableMap,e.dashboardLinks);a!==e.settings&&a!==void 0&&this.updateFormatterSettings(a),o!==t.valuesTable&&t.valuesTable!=null&&(Fe.debug("Table in state modified, closing the old table."),t.valuesTable.close()),(l!==u||s!==d)&&this.updateValuesTable(),l!==u&&(u!==null&&this.stopListeningToSource(u),l!==null&&this.startListeningToSource(l))}componentWillUnmount(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);this.pending.cancel(),i!==null&&this.stopListeningToSource(i),this.cleanup&&this.cleanup(),n!=null&&n.close()}getCoordinateForColumn(){var e;if(this.panelContainer.current==null)return null;var t=this.panelContainer.current.querySelector(".".concat(bu.SOURCE_BUTTON_CLASS_NAME)),n=(e=t==null?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null;if(n==null||n.width<=0||n.height<=0)return null;var i=n.left+n.width/2,a=n.bottom;return[i,a]}getSettingsErrorMessage(){var{sourceSize:e}=this.state;if(e>qt.MAX_TABLE_SIZE)return"Table too large, must have fewer than ".concat(qt.MAX_TABLE_SIZE," options.")}getPanelErrorMessage(){var{error:e}=this.state;return e!=null?"".concat(e):void 0}getSource(e){var t=this.getCachedPanelLinks(e,this);return this.getCachedSource(t)}getSourceTable(e,t){var n=this.getSource(t);return this.getCachedSourceTable(e,n)}getValuesColumn(e,t){var n=this.getSource(t);return this.getCachedSourceColumn(e,n)}startListeningToSource(e){var{dh:t}=this.props;Fe.debug("startListeningToSource"),e.addEventListener(t.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(t.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.addEventListener(t.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.addEventListener(t.Table.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(t.Table.EVENT_RECONNECT,this.handleReconnect)}stopListeningToSource(e){var{dh:t}=this.props;Fe.debug("stopListeningToSource"),e.removeEventListener(t.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(t.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.removeEventListener(t.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.removeEventListener(t.Table.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(t.Table.EVENT_RECONNECT,this.handleReconnect)}handleChange(e){var{column:t,isValueShown:n=!1,value:i}=e,{name:a=void 0,type:o=void 0}=t??{},s=!0,l=Date.now();this.setState(d=>{var u,c,{panelState:m,timestamp:f,wasFlipped:g,skipUpdate:v}=d,p=m!=null&&n!==m.isValueShown&&a===m.name&&o===m.type&&i===m.value;return s=(u=!v&&n&&(!p||!g))!==null&&u!==void 0?u:!1,s||(l=f),{panelState:{isValueShown:n,name:a,type:o,value:i,timestamp:(c=l)!==null&&c!==void 0?c:void 0},timestamp:l,wasFlipped:p,skipUpdate:!1}},()=>{s&&this.sendUpdate(a??null,o,i,l)})}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(e){var{detail:t}=e;this.setState({sourceSize:t})}handleColumnSelected(){Fe.debug("handleColumnSelected");var{glEventHub:e}=this.props;e.emit(Ve.COLUMN_SELECTED,this,qt.SOURCE_COLUMN)}handleClearAllFilters(){var e,t;(e=this.dropdownFilterRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.clearFilter()}setPanelState(e){var t,n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{dashboardLinks:a}=this.props;if(this.getSource(a)==null){Fe.debug("Ignore state update for unlinked filter",e);return}this.setState({skipUpdate:!i}),(t=this.dropdownFilterRef)===null||t===void 0||(n=t.current)===null||n===void 0||n.setFilterState(e)}sendUpdate(e,t,n,i){var a,{dashboardLinks:o,glEventHub:s}=this.props,l=(a=this.getSource(o))===null||a===void 0?void 0:a.panelId,d=l===null?[]:[l];Fe.debug("sendUpdate",{name:e,type:t,value:n,timestamp:i,excludePanelIds:d}),s.emit(Ve.FILTERS_CHANGED,this,{name:e,type:t,value:n??"=null",timestamp:i,excludePanelIds:d})}updateValuesTable(){var{dashboardLinks:e,panelTableMap:t}=this.props,n=this.getSource(e),i=this.getSourceTable(t,e);if(Fe.debug("updateValuesTable",n,i),this.setState({values:[],valuesTable:void 0,error:null}),n==null){Fe.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),i!=null&&(this.setState({isLoaded:!1,sourceSize:i.size}),this.pending.add(i.copy(),a=>a.close()).then(a=>{this.updateViewportListener(a),this.setState({valuesTable:a})}).catch(a=>{we.isCanceled(a)||(Fe.error(a),this.setState({isLoading:!1,error:a}))}))}applySourceSorts(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);if(Fe.debug("applySourceSorts",i==null?void 0:i.sort),n==null||i==null){Fe.debug("Table not initialized");return}var a=[...i.sort];n.applySort(a),this.setViewport(n)}applySourceFilters(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);if(Fe.debug("applySourceFilters",i==null?void 0:i.filter),n==null||i==null){Fe.debug("Table not initialized");return}var a=[...i.filter];n.applyFilter(a),this.setViewport(n)}updateViewportListener(e){var{dh:t}=this.props;if(Fe.debug("updateViewportListener",e==null?void 0:e.size),this.cleanup&&this.cleanup(),e==null){this.cleanup=void 0;return}this.cleanup=e.addEventListener(t.Table.EVENT_UPDATED,this.handleValuesTableUpdate),this.setViewport(e)}setViewport(e){var{dashboardLinks:t}=this.props,n=this.getValuesColumn(e,t);if(!n){Fe.error("values column is null");return}e.setViewport(0,qt.MAX_TABLE_SIZE-1,[n])}updateFormatterSettings(e){var{dh:t}=this.props,n=$o.getColumnFormats(e);mr(this.columnFormats,n)||(this.columnFormats=n,this.setState({formatter:new Zt(t,n)}))}handleValuesTableUpdate(e){var{detail:t}=e,{rows:n}=t,{dashboardLinks:i}=this.props,{valuesTable:a}=this.state;if(!a){Fe.error("valuesTable is null");return}var o=this.getValuesColumn(a,i);if(!o){Fe.error("Values column not found");return}var s=n.map(l=>l.get(o));this.setState({values:s,isLoading:!1,isLoaded:!0,valuesColumn:o})}handleSourceMouseEnter(){var{columnSelectionValidator:e}=this.props;e&&e(this,qt.SOURCE_COLUMN)}handleSourceMouseLeave(){var{columnSelectionValidator:e}=this.props;e&&e(this,void 0)}render(){var{columns:e,dashboardLinks:t,disableLinking:n,glContainer:i,glEventHub:a,isLinkerActive:o}=this.props,{column:s,formatter:l,isDisconnected:d,isValueShown:u,value:c,values:m,valuesColumn:f,isLoading:g,isLoaded:v}=this.state,p=this.getSource(t),C=this.getSettingsErrorMessage(),S=this.getPanelErrorMessage(),y=v&&f!=null?this.getCachedValues(m,f,l):[];return h.jsx(Ki,{errorMessage:S,isLoading:g,isLoaded:v,isDisconnected:d,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:i,glEventHub:a,onClearAllFilters:this.handleClearAllFilters,widgetName:"Dropdown Filter",widgetType:"DropdownFilter",children:h.jsx("div",{ref:this.panelContainer,className:"dropdown-filter-container h-100 w-100 container",children:h.jsx(bu,{ref:this.dropdownFilterRef,column:s,columns:e,isValueShown:u,isLinkerActive:o,disableLinking:n,isLoaded:v,settingsError:C,source:p,value:c,values:y,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})})})}}ht(qt,"displayName","DropdownFilterPanel");ht(qt,"COMPONENT","DropdownFilterPanel");ht(qt,"MAX_TABLE_SIZE",256);ht(qt,"SOURCE_COLUMN",Object.freeze({name:"FilterSource",type:null}));var jT=kT(qt);const Zn=jT;function Mt(r){return r.type==="directory"}function $T(r,e,t){return e=HT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function HT(r){var e=VT(r,"string");return typeof e=="symbol"?e:String(e)}function VT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class UT extends Error{constructor(){super("No file exists at the path specified"),$T(this,"isFileNotFound",!0)}}const uo=UT;function Cu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function yu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Cu(a,n,i,o,s,"next",l)}function s(l){Cu(a,n,i,o,s,"throw",l)}o(void 0)})}}var En;(function(r){r.GROOVY="text/x-groovy",r.PLAIN_TEXT="text/plain",r.PYTHON="text/x-python",r.PYTHON_COMPILED="application/x-python-code",r.SCALA="text/x-scala",r.UNKNOWN=""})(En||(En={}));class tn{static fileExists(e,t){return yu(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof uo))throw n;return!1}})()}static fileExtensionToString(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e.length===0?"":".".concat(e)}static getDepth(e){var t;if(!tn.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var n=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return n.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var n;return(n=t.pop())!==null&&n!==void 0?n:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),n=null,i=null;t<0?i=e:(i=e.substring(0,t),n=e.substring(t+1));var a=i?"".concat(i,"-copy"):"Copy";return n!==null?"".concat(a,".").concat(n):a}static getUniqueCopyFileName(e,t){return yu(function*(){for(var n=tn.getCopyFileName(t);yield tn.fileExists(e,n);)n=tn.getCopyFileName(n);return n})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return En.GROOVY;case"py":return En.PYTHON;case"pyc":return En.PYTHON_COMPILED;case"scala":return En.SCALA;case"txt":return En.PLAIN_TEXT;default:return En.UNKNOWN}}static getParent(e){if(!tn.hasPath(e))throw new Error("Invalid name provided: ".concat(e));for(var t=e.split("/");t.pop()==="";);if(t.length===0)throw new Error("No parent for path provided: ".concat(e));return"".concat(t.join("/"),"/")}static getPath(e){if(!tn.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=e.lastIndexOf("."),i=n>-1?e.substring(0,n):e,a=tn.fileExtensionToString(t);return"".concat(i).concat(a)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Ei("Name cannot be empty");if(t.includes(e))throw new Ei('"'.concat(e,'" is a reserved name'));if(n.test(e)){var a,o;throw new Ei('Invalid characters in name: "'.concat((a=(o=e.match(n))===null||o===void 0?void 0:o.reduce((s,l)=>s.includes(l)?s:[...s,l],[]).map(s=>i.has(s)?i.get(s):s).join('", "'))!==null&&a!==void 0?a:"",'"'))}}static reducePaths(e){var t=e.filter(n=>tn.isPath(n));return e.filter(n=>!t.some(i=>n!==i&&n.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}const ie=tn;var Ks=26;function is(r){return Mt(r)?ie.makePath(r.filename):ie.getPath(r.filename)}function Su(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=is(e);if(r.some(n=>{var{filename:i}=n;return ie.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>Mt(n)&&t.startsWith(ie.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function BT(r){if(Mt(r))return r.isExpanded?Jf:ev;var e=ie.getMimeType(r.basename);switch(e){case En.PYTHON:return nv;default:return tv}}function as(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:a,isSelected:o,item:s,itemIndex:l,dropTargetItem:d,onDragStart:u,onDragOver:c,onDragEnd:m,onDrop:f}=r,g=(e=n==null?void 0:n.some(M=>M.id===s.id))!==null&&e!==void 0?e:!1,v=is(s),p=i&&d?is(d):null,C=i&&a&&Mt(s)&&p===v,S=i&&a&&p===v,y=i&&!a&&p===v,w=BT(s),E=ie.getDepth(s.filename),D=Array(E).fill(null).map((M,_)=>h.jsx("span",{className:"file-list-depth-line"},_));return h.jsxs("div",{className:J("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":C,"is-in-drop-target":S,"is-invalid-drop-target":y,"is-selected":o}),onDragStart:M=>u(l,M),onDragOver:M=>c(l,M),onDragEnd:M=>m(l,M),onDrop:M=>f(l,M),draggable:!0,role:"presentation","aria-label":s.basename,children:[D," ",h.jsx(ue,{icon:w,className:"item-icon",fixedWidth:!0})," ",h.jsx("span",{className:"truncation-wrapper",children:t??h.jsxs(h.Fragment,{children:[s.basename,h.jsx(On,{children:s.basename})]})})]})}function wu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function fa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wu(Object(t),!0).forEach(function(n){WT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function WT(r,e,t){return e=GT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function GT(r){var e=zT(r,"string");return typeof e=="symbol"?e:String(e)}function zT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var lt=z.module("FileList"),KT=500,Eu="item-list-scroll-pane";function qT(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:a,onSelectionChange:o=()=>{},renderItem:s=as,rowHeight:l=Ks,overscanCount:d=Ot.DEFAULT_OVERSCAN}=r,[u,c]=b.useState(()=>({items:[],offset:0,itemCount:0})),[m,f]=b.useState({top:0,bottom:0}),[g,v]=b.useState(),[p,C]=b.useState(),[S,y]=b.useState(),[w,E]=b.useState([]),D=b.useRef(),M=b.useRef(null),_=b.useRef(null),T=b.useCallback(V=>{if(V.length===0||u==null)return[];for(var ne=[],de=0;de<V.length;de+=1)for(var Ee=V[de],Le=Ee[0];Le<=Ee[1];Le+=1)Le>=u.offset&&Le<u.offset+u.items.length&&ne.push(u.items[Le-u.offset]);return ne},[u]),N=b.useCallback(V=>{var ne=T([[V,V]]);if(ne.length>0)return ne[0]},[T]),x=b.useCallback(()=>{var V=Sn.count(w);if(V===0)return null;if(V===1){var ne=w[0][0],de=N(ne);if(de!=null)return de.filename}return"".concat(V," items")},[N,w]),F=b.useCallback(V=>{if(!(!p||!g)){lt.debug("dropItems",p,"to",V);try{var{files:ne,targetPath:de}=Su(p,g);if(i==null||i(ne,de),V!=null){var Ee;E([[V,V]]),(Ee=M.current)===null||Ee===void 0||Ee.focusItem(V)}}catch(Le){lt.error("Unable to complete move",Le)}}},[p,g,i]),k=b.useCallback((V,ne)=>{var de=u.items[V-u.offset];de!==void 0&&(lt.debug("handleItemClick",de),a(de,ne),Mt(de)&&(t==null||t.setExpanded(de.filename,!de.isExpanded)))},[u,a,t]),U=b.useCallback((V,ne)=>{var de;lt.debug2("handleItemDragStart",V,w);var Ee=w;Sn.isSelected(w,V)||(Ee=[[V,V]],E(Ee)),C(T(Ee)),(de=M.current)===null||de===void 0||de.resetMouseState();var Le=document.createElement("div");Le.innerHTML='<div class="dnd-placeholder-content">'.concat(x(),"</div>"),Le.className="file-list-dnd-placeholder",document.body.appendChild(Le),ne.dataTransfer.setDragImage(Le,0,0),ne.dataTransfer.effectAllowed="move",y(Le)},[x,T,w]),H=b.useCallback((V,ne)=>{ne.preventDefault(),lt.debug2("handleItemDragOver",ne),v(N(V))},[N]),W=b.useCallback((V,ne)=>{lt.debug("handleItemDragEnd",V),S==null||S.remove(),C(void 0),v(void 0),y(void 0)},[S]),X=b.useCallback((V,ne)=>{F(V)},[F]),le=b.useCallback(()=>{lt.debug2("handleItemDragExit"),v(void 0)},[]),me=b.useCallback(V=>{V.target instanceof Element&&V.target.classList.contains(Eu)&&(V.preventDefault(),lt.debug2("handleListDragOver",V),v({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),ve=b.useCallback(V=>{V.target instanceof Element&&V.target.classList.contains(Eu)&&(lt.debug("handleListDrop"),F())},[F]),j=b.useCallback(function(V){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(lt.debug2("handleSelectionChange",V),ne===!0||V!==w){E(V);var de=T(V);o(de)}},[T,o,w]),R=b.useCallback(V=>{if(lt.debug2("handleFocusChange",V),V!=null){var[ne]=T([[V,V]]);n(ne)}else n();D.current=V},[T,n]),$=b.useCallback((V,ne)=>{lt.debug("handleViewportChange",V,ne),(V!==m.top||ne!==m.bottom)&&f({top:V,bottom:ne})},[m]),G=b.useMemo(()=>{if(!p||!g)return!1;try{return Su(p,g),lt.debug("handleValidateDropTarget true"),!0}catch{return lt.debug("handleValidateDropTarget false"),!1}},[p,g]),{focusedPath:te}=r;b.useEffect(()=>{te!==void 0&&(te==="/"?t.collapseAll():(t.setExpanded(te,!1),t.setExpanded(te,!0)))},[t,te]),b.useEffect(function(){lt.debug("updating table viewport",m),t==null||t.setViewport({top:Math.max(0,m.top-d),bottom:m.bottom+d})},[d,t,m]),b.useEffect(function(){var ne=t.onUpdate(de=>{c({items:de.items.map(Ee=>fa(fa({},Ee),{},{itemName:Ee.basename})),offset:de.offset,itemCount:t.size})});return()=>{ne()}},[t]),b.useEffect(function(){D.current!=null&&R(D.current),w.length>0&&j(w,!0)},[u,R,j,w]),b.useEffect(function(){if(g!=null&&Mt(g)&&g.filename!=="/"){var ne=setTimeout(()=>{g.isExpanded||t==null||t.setExpanded(g.filename,!0)},KT);return()=>clearTimeout(ne)}},[g,t]);var Me=b.useCallback(V=>s(fa(fa({},V),{},{isDragInProgress:p!=null,dropTargetItem:g,draggedItems:p,isDropTargetValid:G,onDragStart:U,onDragEnd:W,onDragOver:H,onDragExit:le,onDrop:X})),[W,le,H,U,X,p,g,G,s]);return h.jsx("div",{ref:_,className:J("file-list",{"is-dragging":p!=null}),onDragOver:me,onDrop:ve,children:h.jsx(Ot,{ref:M,items:u.items,itemCount:u.itemCount,offset:u.offset,onFocusChange:R,onSelect:k,onSelectionChange:j,onViewportChange:$,selectedRanges:w,renderItem:Me,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var XT={name:"File Explorer",DELETE:De.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[q.DELETE],macShortcut:[re.CMD,q.BACKSPACE]}),RENAME:De.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[q.ENTER],macShortcut:[q.ENTER]})};const Pu={FILE_EXPLORER:XT};var Tu=z.module("FileListItemEditor"),ZT=()=>Promise.resolve();function YT(r){var{item:e,onCancel:t,onSubmit:n,validate:i=ZT}=r,a=b.useRef(null),[o,s]=b.useState(e.basename),[l,d]=b.useState(),[u,c]=b.useState(Promise.resolve()),m=b.useCallback(()=>{var S;(S=a.current)===null||S===void 0||S.focus()},[a]),f=b.useCallback(S=>S.stopPropagation(),[]),g=b.useCallback(()=>{u.then(()=>{n(o)}).catch(S=>Tu.info("Unable to validate name",S))},[n,o,u]);b.useEffect(function(){var y=we.makeCancelable(i(o));return y.then(()=>d(void 0)).catch(w=>{we.isCanceled(w)||d(w)}),c(y),()=>y.cancel()},[i,o]),b.useEffect(function(){m()},[m]);var v=b.useCallback(()=>{Tu.debug2("handleBlur"),g()},[g]),p=b.useCallback(S=>{var{value:y}=S.target;s(y)},[]),C=b.useCallback(S=>{S.stopPropagation();var{key:y}=S;switch(y){case"Enter":{g();break}case"Escape":{t();break}}},[t,g]);return h.jsxs("div",{className:"file-list-item-editor",children:[h.jsx("input",{type:"text",className:J("form-control file-list-item-editor-input",{"is-invalid":l}),value:o,ref:a,onBlur:v,onKeyDown:C,onChange:p,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&h.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function _u(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function xo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_u(Object(t),!0).forEach(function(n){QT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_u(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function QT(r,e,t){return e=JT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function JT(r){var e=e_(r,"string");return typeof e=="symbol"?e:String(e)}function e_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Mm(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:a,onCopy:o,onDelete:s,onMove:l,onRename:d,onSelect:u,onSelectionChange:c,table:m,rowHeight:f=Ks,validateRename:g=()=>Promise.resolve()}=r,[v,p]=b.useState(),[C,S]=b.useState([]),[y,w]=b.useState(),E=b.useCallback(X=>{S(X),c==null||c(X)},[c]),D=b.useCallback(X=>{w(X)},[]),M=b.useCallback(()=>{y&&(o==null||o(y))},[y,o]),_=b.useCallback(()=>{C.length>0&&(s==null||s(C))},[s,C]),T=b.useCallback(()=>{i==null||i()},[i]),N=b.useCallback(()=>{y&&(a==null||a(ie.getPath(y.filename)))},[y,a]),x=b.useCallback(()=>{y&&p(y)},[y]),F=b.useCallback(()=>{p(void 0)},[]),k=b.useCallback(X=>{v&&(d==null||d(v,X),p(void 0))},[d,v]),U=b.useMemo(()=>{if(v)return[];var X=[];return i&&X.push({title:"New File",description:"Create new file",action:T,group:fe.groups.medium}),a&&X.push({title:"New Folder",description:"Create new folder",action:N,group:fe.groups.medium}),o&&X.push({title:"Copy File",description:"Copy the selected file",action:M,group:fe.groups.low,disabled:y==null||Mt(y)}),s&&C.length>0&&X.push({title:"Delete",description:"Delete",shortcut:Pu.FILE_EXPLORER.DELETE,action:_,group:fe.groups.low}),d&&X.push({title:"Rename",description:"Rename",shortcut:Pu.FILE_EXPLORER.RENAME,action:x,group:fe.groups.low,disabled:y==null}),X},[M,_,T,N,x,y,o,i,a,s,d,C,v]),H=b.useCallback(X=>(I(v),g(v,X)),[v,g]),W=b.useCallback(X=>{var{item:le}=X;return v&&v.filename===le.filename?h.jsx(as,xo(xo({},X),{},{children:h.jsx(YT,{item:le,validate:H,onSubmit:k,onCancel:F})})):h.jsx(as,xo({},X))},[F,k,v,H]);return h.jsxs("div",{className:"file-list-container",children:[m!=null&&h.jsx(qT,{onMove:l,onSelect:u,onSelectionChange:E,onFocusChange:D,renderItem:W,rowHeight:f,table:m,isMultiSelect:e,focusedPath:t}),n&&h.jsx(fe,{actions:U})]})}Mm.displayName="FileListContainer";function Ou(r,e,t){return e=t_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function t_(r){var e=n_(r,"string");return typeof e=="symbol"?e:String(e)}function n_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class r_ extends Ei{constructor(e){super("Name already exists"),Ou(this,"isExistingFile",!0),Ou(this,"info",void 0),this.info=e}}const wa=r_;function Du(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Mu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Du(a,n,i,o,s,"next",l)}function s(l){Du(a,n,i,o,s,"throw",l)}o(void 0)})}}var Jt=z.module("FileExplorer");function qs(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:a=()=>{},onRename:o=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:u,rowHeight:c=Ks}=r,[m,f]=b.useState([]),[g,v]=b.useState();b.useEffect(function(){var k;function U(){return H.apply(this,arguments)}function H(){return H=Mu(function*(){Jt.debug("initTable"),k=we.makeCancelable(e.getTable(),W=>W.close());try{v(yield k)}catch(W){we.isCanceled(W)||Jt.error("Unable to initialize table",W)}}),H.apply(this,arguments)}return U(),()=>{k.cancel()}},[e]);var p=b.useCallback(F=>{we.isCanceled(F)||Jt.error(F)},[]),C=b.useCallback(()=>{Jt.debug("handleCreateFile"),s()},[s]),S=b.useCallback(()=>{Jt.debug("handleCreateFolder"),l()},[l]),y=b.useCallback(F=>{Jt.debug("handleCopyFile",F.filename),i(F)},[i]),w=b.useCallback(F=>{Jt.debug("handleDelete, pending confirmation",F),f(F)},[]),E=b.useCallback(()=>{Jt.debug("handleDeleteConfirm",m),m.forEach(F=>e.deleteFile(Mt(F)?ie.makePath(F.filename):F.filename)),a(m),f([])},[m,a,e]),D=b.useCallback(()=>{Jt.debug("handleDeleteCancel"),f([])},[]),M=b.useCallback((F,k)=>{var U=ie.reducePaths(F.map(H=>Mt(H)?ie.makePath(H.filename):H.filename));U.forEach(H=>{var W=ie.isPath(H)?"".concat(k).concat(ie.getBaseName(H.substring(0,H.length-1)),"/"):"".concat(k).concat(ie.getBaseName(H));e.moveFile(H,W).then(()=>{o(H,W)}).catch(p)})},[p,o,e]),_=b.useCallback((F,k)=>{var U=F.filename,H=Mt(F);H&&!U.endsWith("/")&&(U="".concat(U,"/"));var W="".concat(ie.getParent(U)).concat(k);H&&!W.endsWith("/")&&(W="".concat(W,"/")),Jt.debug2("handleRename",U,W),e.moveFile(U,W).catch(p),o(U,W)},[p,o,e]),T=b.useCallback(function(){var F=Mu(function*(k,U){if(U!==k.basename){ie.validateName(U);var H="".concat(ie.getPath(k.filename)).concat(U);try{var W=yield e.info(H);throw new wa(W)}catch(X){if(!(X instanceof uo))throw X}}});return function(k,U){return F.apply(this,arguments)}}(),[e]),N=m.length>0,x=b.useMemo(()=>m.length===1?'Are you sure you want to delete "'.concat(m[0].filename,'"?'):"Are you sure you want to delete the selected files?",[m]);return h.jsxs("div",{className:"file-explorer",children:[g&&h.jsx(Mm,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:y,onCreateFolder:S,onCreateFile:C,onMove:M,onDelete:w,onRename:_,onSelect:d,onSelectionChange:u,rowHeight:c,table:g,validateRename:T}),h.jsx(fr,{isOpen:N,headerText:x,bodyText:"You cannot undo this action.",onCancel:D,onConfirm:E,confirmButtonText:"Delete"})]})}qs.displayName="FileExplorer";function Iu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function i_(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Iu(a,n,i,o,s,"next",l)}function s(l){Iu(a,n,i,o,s,"throw",l)}o(void 0)})}}function zn(r,e,t){return e=a_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function a_(r){var e=o_(r,"string");return typeof e=="symbol"?e:String(e)}function o_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ar=z.module("NewItemModal");class cr extends b.PureComponent{static getValidationMessage(e){return e instanceof wa&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){we.isCanceled(e)||ar.error(e)}constructor(e){super(e),zn(this,"inputRef",Z.createRef()),zn(this,"cancelableValidatePromise",void 0),zn(this,"cancelableExistingItemPromise",void 0),zn(this,"pending",new Qn),zn(this,"pathMap",new Map),zn(this,"isInitialLoad",!0),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),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,n=ie.hasPath(t)?ie.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:ie.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:ie.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:i}=e,{value:a,path:o}=this.state;!i&&n&&(this.resetValue(),this.isInitialLoad=!0),i&&n&&(!this.isInitialLoad&&(o!==t.path||a!==t.value)&&this.updateValidationStatus(o,a),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=ie.hasPath(e)?ie.getPath(e):"/";this.setState({path:t,value:ie.getBaseName(e),validationError:void 0,prevExtension:ie.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=we.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var i=this;return i_(function*(){ie.validateName(t);var{defaultValue:a,storage:o}=i.props;if(n){var s="".concat(e).concat(t);if(s!==a)try{var l=yield o.info(s);throw new wa(l)}catch(d){if(!(d instanceof uo))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(cr.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(ar.debug("handleSelect",e),e.type==="directory")this.setState({path:ie.makePath(e.filename)});else{var t=e.basename,n=ie.getPath(e.filename);this.setState({value:t,path:n},()=>{this.focusRenameInput()})}}handleKeyDown(e){var{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var{onCancel:n}=this.props;n();break}}}handleValidationError(e){if(!(e instanceof Ei))throw e;ar.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var{onSubmit:e}=this.props,{path:t,value:n}=this.state;ar.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){ar.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=ie.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){ar.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:n}=e,i=t==="directory"?n.length:n.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:n.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:n,value:i,path:a}=t,{notifyOnExtensionChange:o,type:s}=this.props;ar.debug("submitModal",n,i);var l=ie.getExtension(i);return o&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(a,i,!0).then(d=>{var{onSubmit:u}=this.props;u("".concat(a).concat(i))}).catch(d=>{if(d instanceof wa&&s!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw we.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(cr.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((n,i)=>{for(var a="",o=0;o<i;o+=1)a+="".concat(t[o],"/");return a+="".concat(n,"/"),h.jsxs(Z.Fragment,{children:[h.jsx(Y,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(a),"aria-label":i===0?"Home":void 0,icon:i===0?h.jsx(ue,{icon:rv,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:n}),"/"]},a)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:i,title:a,type:o}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:d,showOverwriteModal:u,validationError:c,value:m,prevExtension:f,newExtension:g}=this.state,v=o==="directory",p=ie.fileExtensionToString(f),C=ie.fileExtensionToString(g),S=v?"Create":"Save",y=v?"New folder name":"Save file as";return h.jsxs(h.Fragment,{children:[h.jsxs(us,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[h.jsx(hs,{toggle:n,children:a}),h.jsx(cs,{children:h.jsx("form",{children:h.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[h.jsxs("div",{className:"flex-grow-0 mb-4",children:[h.jsx("label",{htmlFor:"file-name-input",children:y}),h.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:J("form-control",{"is-invalid":c}),value:m,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&h.jsx("div",{className:"invalid-feedback",children:cr.getValidationMessage(c)})]}),h.jsxs("div",{className:"flex-grow-0",children:[h.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),h.jsx("div",{className:"flex-grow-1 file-explorer-container",children:h.jsx(qs,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),h.jsxs(Ss,{children:[h.jsx(Y,{kind:"secondary",onClick:n,children:"Cancel"}),h.jsx(Y,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:S})]})]}),h.jsx(fr,{isOpen:u,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"}),h.jsx(fr,{isOpen:d,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(p,'" to "').concat(C,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(p,'"'),confirmButtonText:'Use "'.concat(C,'"')})]})}}zn(cr,"propTypes",{isOpen:O.bool,title:O.string.isRequired,defaultValue:O.string,type:O.oneOf(["file","directory"]).isRequired,onSubmit:O.func,onCancel:O.func,placeholder:O.string,storage:O.shape({}).isRequired,notifyOnExtensionChange:O.bool});zn(cr,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});const Im=cr;function s_(r){var{createFile:e,createFolder:t,onSearchChange:n,defaultSearchText:i=""}=r;return h.jsxs("div",{className:"file-explorer-toolbar",children:[h.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[h.jsx(Y,{kind:"ghost",icon:xh,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),h.jsx(Y,{kind:"ghost",icon:iv,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&h.jsx("div",{className:"file-explorer-toolbar-search",children:h.jsx(Xp,{value:i,onChange:n,placeholder:"Search by name"})})]})}function Nu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function l_(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Nu(a,n,i,o,s,"next",l)}function s(l){Nu(a,n,i,o,s,"throw",l)}o(void 0)})}}function Nm(r,e,t){return e=d_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function d_(r){var e=u_(r,"string");return typeof e=="symbol"?e:String(e)}function u_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var or=z.module("FileExplorerPanel"),h_=(r,e)=>{var t=Ic(r),n=ti(r,e.localDashboardId),{session:i,config:a}=n??{},o=a==null?void 0:a.type;return{fileStorage:t,language:o,session:i}},c_=Ht(h_,null,null,{forwardRef:!0});function m_(r){var e=r;return e!=null&&typeof e.button=="number"}class Wr extends Z.Component{static handleError(e){or.error(e)}static isFocusEvent(e){return m_(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.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),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:n}=e;this.state={isShown:!1,language:n,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:n}=this.state,i={language:n,value:""};or.debug("handleCreateFile",t,n,i),e.emit(Se.CREATE_NOTEBOOK,t,n,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){or.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){or.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Wr.handleError)}handleCopyFile(e){var t=this;return l_(function*(){var{fileStorage:n}=t.props;if(Mt(e)){or.error("Invalid item in handleCopyItem",e);return}var i=yield ie.getUniqueCopyFileName(n,e.filename);yield n.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(Se.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=ie.makePath(e[0].filename):t=ie.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(or.debug("fileSelect",e),e.type!=="directory"){var n=Wr.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:a}=this.props,{session:o,language:s}=this.state,l={value:null,language:s};a.emit(Se.SELECT_NOTEBOOK,o,s,l,i,n)}}handleRename(e,t){var{glEventHub:n}=this.props;or.debug("handleRename",e,t),n.emit(Se.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,language:n})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){var{fileStorage:e,glContainer:t,glEventHub:n}=this.props,{isShown:i,showCreateFolder:a,focusedFilePath:o}=this.state;return h.jsxs(hn,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[h.jsx(s_,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&h.jsx(qs,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),h.jsx(Im,{isOpen:a,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:o})]})}}Nm(Wr,"COMPONENT","FileExplorerPanel");Nm(Wr,"TITLE","File Explorer");var f_=c_(Wr);const xm=f_;function xu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function va(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xu(Object(t),!0).forEach(function(n){yi(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function yi(r,e,t){return e=v_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function v_(r){var e=p_(r,"string");return typeof e=="symbol"?e:String(e)}function p_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ae=z.module("FilterSetManager"),g_="Enter name...",Fu="No Available Filter Sets";class ja extends b.Component{static animateScreenFlash(){var e,t=document.createElement("div");t.classList.add("screen-flash-overlay"),t.addEventListener("animationend",()=>{t.remove()}),(e=document.querySelector("body"))===null||e===void 0||e.appendChild(t)}constructor(e){super(e),yi(this,"renameInputRef",Z.createRef()),yi(this,"dropdownRef",Z.createRef()),yi(this,"editDropdownRef",Z.createRef()),yi(this,"isRenamingExistingSet",oe((t,n)=>n!==void 0&&t.some(i=>{var{id:a}=i;return a===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}}componentDidMount(){var{isValueShown:e}=this.props;e?this.updateSelectedId():this.initSettingsScreen()}componentDidUpdate(e,t){var{isValueShown:n,filterSets:i}=this.props,{modifiedFilterSets:a}=this.state;if(e.isValueShown&&!n&&this.initSettingsScreen(),this.isNameInputScreen()&&!this.isNameInputScreen(t)&&this.focusRenameInput(),i!==e.filterSets)if(!n&&i.length>0&&e.filterSets.length===0&&a.length===0){var{onChange:o}=this.props;o({isValueShown:!0,selectedId:i[0].id})}else this.updateSelectedId()}initSettingsScreen(){var{filterSets:e,selectedId:t}=this.props;Ae.debug("initSettingsScreen",e,t),this.setState({modifiedFilterSets:[...e],editId:t})}updateSelectedId(){var{isValueShown:e,filterSets:t,selectedId:n,onChange:i}=this.props;if(Ae.debug("updateSelectedId",t,n),!!e&&!t.some(o=>{var{id:s}=o;return s===n})){var a=t.length===0;i({isValueShown:!a,selectedId:a?void 0:t[0].id})}}handleEditDropdownChange(e){this.setState({editId:e})}handleFilterChange(e){var t=e,{isValueShown:n,onChange:i}=this.props;this.applyFilterSet(t),i({isValueShown:n,selectedId:t})}handleFilterApply(){var{selectedId:e}=this.props;this.applyFilterSet(e)}handleSettingsCancel(){var{onChange:e,selectedId:t,filterSets:n}=this.props;this.setState({modifiedFilterSets:[]}),n.length>0&&e({isValueShown:!0,selectedId:t})}handleSettingsSave(){var{onChange:e,onUpdateSets:t}=this.props,{modifiedFilterSets:n,editId:i}=this.state;this.setState({modifiedFilterSets:[]}),Ae.debug("Update sets",n,i),t(n),n.length>0&&e({isValueShown:!0,selectedId:i})}handleCaptureNewSet(){var{getFilterState:e}=this.props;ja.animateScreenFlash();var t=Ue(),n=e(),i={id:t,title:"",panels:n};Ae.debug("handleSetCreate",i),this.setState({nameInputValue:"",nameInputError:void 0,renameSet:i})}handleRenameCancel(){this.setState({renameSet:void 0})}handleRestoreFullStateChange(e){this.setState({restoreFullState:e.target.value==="true"})}getNameError(e){var t,{renameSet:n,modifiedFilterSets:i}=this.state,a=(t=e==null?void 0:e.trim())!==null&&t!==void 0?t:"";if(a.length===0)return Ae.debug("Name cannot be empty",a),"Name cannot be empty";if(n!==void 0&&i.some(o=>{var{title:s,id:l}=o;return s===a&&l!==n.id}))return Ae.debug("Set with this name already exists",a),"Set with this name already exists"}handleRenameConfirm(){var e,{nameInputValue:t,renameSet:n,modifiedFilterSets:i,restoreFullState:a}=this.state;if(n===void 0){Ae.error("Renamed set undefined.");return}var o=this.getNameError(t);if(Ae.debug("handleRenameConfirm",t,o),o!==void 0){this.setState({nameInputError:o});return}var s=(e=t==null?void 0:t.trim())!==null&&e!==void 0?e:"",l=va(va({},n),{},{title:s,restoreFullState:a}),d=i.findIndex(c=>{var{id:m}=c;return m===n.id}),u=[...i];d>=0?(u[d]=l,Ae.debug("Renamed existing set",u)):(u.push(l),Ae.debug("Added new set to modified sets",u)),this.setState({editId:l.id,modifiedFilterSets:u,renameSet:void 0})}handleSetDelete(){this.setState(e=>{var{editId:t,modifiedFilterSets:n}=e,i=n.findIndex(l=>{var{id:d}=l;return d===t});if(i<0)return Ae.error("Unable to find selected filterSet index",n,t),null;var a=n.filter(l=>{var{id:d}=l;return d!==t}),o=Math.max(0,Math.min(a.length-1,i-1)),s=a.length>0?a[o].id:void 0;return Ae.debug("Deleted selected set",t,n,a),Ae.debug("New selection",o,s),{modifiedFilterSets:a,editId:s}})}handleSetUpdate(){var{getFilterState:e}=this.props;ja.animateScreenFlash();var t=e();this.setState(n=>{var{modifiedFilterSets:i,editId:a}=n;if(a===void 0)return Ae.error("Filter for update not selected."),null;var o=[...i],s=o.findIndex(l=>{var{id:d}=l;return d===a});return s<0?(Ae.error("Selected set for update not found."),null):(o[s]=va(va({},o[s]),{},{panels:t}),Ae.debug("Update set",o,t),{modifiedFilterSets:o})})}handleSetEdit(){this.setState(e=>{var{editId:t,modifiedFilterSets:n}=e,i=n.find(s=>{var{id:l}=s;return l===t});if(i===void 0)return Ae.error("Could not find selected set",t,n),null;var{title:a,restoreFullState:o=!1}=i;return{nameInputValue:a,nameInputError:void 0,renameSet:i,restoreFullState:o}})}handleSettingsClick(e){e.stopPropagation();var{onChange:t,selectedId:n}=this.props;t({isValueShown:!1,selectedId:n})}handleBackgroundClick(e){Ae.debug("handleBackgroundClick"),e.target!==this.dropdownRef.current&&this.focusInput()}handleNameInputChange(e){var{value:t}=e.target,n=this.getNameError(t);this.setState({nameInputValue:t,nameInputError:n})}handleNameInputKeyPress(e){var{key:t}=e;t==="Enter"&&(e.preventDefault(),this.handleRenameConfirm())}isNameInputScreen(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state,{renameSet:t}=e;return t!==void 0}applyFilterSet(e){var{onApply:t,filterSets:n}=this.props;if(e===void 0){Ae.debug("No filter selected");return}var i=n.find(a=>{var{id:o}=a;return o===e});if(i===void 0){Ae.debug("Selected id not found in filterSets",e,n);return}Ae.debug("Apply filterSet",i),t(i)}focusInput(){var e;(e=this.dropdownRef.current)===null||e===void 0||e.focus()}focusRenameInput(){var e;(e=this.renameInputRef.current)===null||e===void 0||e.focus()}render(){var{nameInputValue:e,nameInputError:t,editId:n,renameSet:i,modifiedFilterSets:a,restoreFullState:o}=this.state,{isValueShown:s,filterSets:l,selectedId:d}=this.props,u=this.isNameInputScreen(),c=this.isRenamingExistingSet(a,i),m=a.length===0,f=!u&&m&&l.length===0,g=!u&&!f,v=h.jsxs("div",{className:"fa-layers mr-3",children:[h.jsx(ue,{icon:Ao,mask:ul,transform:"shrink-1 down-5 right-7"}),h.jsx(ue,{icon:ov,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),p=h.jsxs("div",{className:"fa-layers",children:[h.jsx(ue,{icon:Ao,mask:ul,transform:"shrink-1 down-5 right-7"}),h.jsx(ue,{icon:sv,transform:"shrink-1 down-5 right-7"})]});return h.jsx("div",{className:"filter-set-manager fill-parent-absolute",children:h.jsxs(ws,{className:"w-100 h-100",isFlipped:s,children:[h.jsx("div",{className:"filter-set-manager-settings-card fill-parent-absolute",children:h.jsxs("div",{className:"filter-set-manager-card-content",children:[f&&h.jsxs("div",{children:[h.jsx(Y,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:v,children:"Capture filter set"}),h.jsx("div",{className:"py-3 text-muted small",children:"Takes a snapshot of the currently applied filters on all panels, allowing you to restore saved filter sets later."})]}),u&&h.jsxs("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container",children:[h.jsxs("div",{className:"form-group",children:[h.jsx("label",{children:c?"Edit set":"Name captured set"}),h.jsxs("div",{className:"name-input-container",children:[h.jsx("input",{type:"text",className:"input-set-name form-control",placeholder:g_,value:e,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),h.jsx(Y,{"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:Fh}),h.jsx(Y,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:av})]}),t!==void 0&&h.jsx("div",{className:"error-message",children:t})]}),h.jsx("div",{className:"form-group",children:h.jsxs(rg,{onChange:this.handleRestoreFullStateChange,value:"".concat(o),children:[h.jsx(kl,{value:"false",children:"Restore only filters"}),h.jsx(kl,{value:"true",children:"Restore full table state"})]})})]}),g&&h.jsxs("div",{className:"filter-set-manager-settings-grid-1",children:[h.jsxs("div",{className:"form-group",children:[h.jsx("label",{children:"Edit filter sets"}),h.jsxs("div",{className:"filter-select-container",children:[h.jsxs(Vr,{"data-testid":"settings-card-filter-select",ref:this.editDropdownRef,value:n??"-1",className:"custom-select filter-value-select",onChange:this.handleEditDropdownChange,disabled:m,children:[m&&h.jsx("option",{value:"-1",disabled:!0,children:Fu}),a.map(C=>{var{id:S,title:y}=C;return h.jsx("option",{value:S,children:y},S)})]}),h.jsx(Y,{kind:"ghost",onClick:this.handleSetUpdate,disabled:m,icon:p,tooltip:"Update"}),h.jsx(Y,{kind:"ghost",onClick:this.handleSetEdit,disabled:m,icon:Rh,tooltip:"Edit"}),h.jsx(Y,{kind:"ghost",onClick:this.handleSetDelete,disabled:m,icon:ki,tooltip:"Delete"})]})]}),h.jsx("div",{children:h.jsx(Y,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:v,children:"Capture new filter set"})}),h.jsxs("div",{className:"py-3 text-right",children:[h.jsx(Y,{kind:"secondary",onClick:this.handleSettingsCancel,children:"Cancel"})," ",h.jsx(Y,{kind:"primary",onClick:this.handleSettingsSave,children:"Save"})]})]})]})},"front"),h.jsxs("div",{className:"filter-set-manager-value-card fill-parent-absolute",onClick:this.handleBackgroundClick,children:[h.jsx("div",{className:"filter-set-manager-column",children:h.jsx("div",{className:"filter-set-manager-column-title",children:"Filter sets"})}),h.jsx("div",{className:"filter-set-manager-card-content",children:h.jsx("div",{className:"filter-set-manager-value-input",children:h.jsxs("div",{className:"filter-select-container",children:[h.jsxs(Vr,{"data-testid":"value-card-filter-select",ref:this.dropdownRef,value:d??"-1",className:"custom-select filter-value-select",onChange:this.handleFilterChange,children:[l.length===0&&h.jsx("option",{value:"-1",disabled:!0,children:Fu}),l.map(C=>{var{id:S,title:y}=C;return h.jsx("option",{value:S,children:y},S)})]}),h.jsx(Y,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:Lh,tooltip:"Apply Filter Set"})]})})}),h.jsx("div",{className:"filter-set-manager-menu",children:h.jsx(Y,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:h.jsx(ue,{icon:Va,transform:"grow-4"})})})]},"back")]})})}}const Fm=ja;function Xs(r){var e,t,n,i,a,{model:o,widgetName:s,glContainer:l,description:d}=r,u=((e=o==null?void 0:o.rowCount)!==null&&e!==void 0?e:0)-((t=o==null?void 0:o.pendingRowCount)!==null&&t!==void 0?t:0)-((n=o==null?void 0:o.floatingBottomRowCount)!==null&&n!==void 0?n:0)-((i=o==null?void 0:o.floatingTopRowCount)!==null&&i!==void 0?i:0),c=o==null?void 0:o.displayString(u,"long"),m=(a=o==null?void 0:o.columnCount)!==null&&a!==void 0?a:0,f=o==null?void 0:o.displayString(m,"long");return h.jsxs(zi,{widgetType:"Table",widgetName:s,glContainer:l,description:d,children:[h.jsx("hr",{className:"tab-tooltip-divider"}),h.jsx("span",{children:"Number of Columns"}),h.jsx("span",{className:"tab-tooltip-statistic-value",children:f}),h.jsx("span",{children:"Number of Rows"}),h.jsx("span",{className:"tab-tooltip-statistic-value",children:c})]})}Xs.propTypes={glContainer:ks.Container.isRequired,widgetName:O.string.isRequired,description:O.string};Xs.defaultProps={description:null};function Rm(r){if(r==null)return!1;var e=r;return typeof e.table=="string"}function Lm(r){if(r==null)return!1;var e=r;return typeof e.name=="string"}function Ru(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function An(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ru(Object(t),!0).forEach(function(n){Ke(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ru(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ke(r,e,t){return e=b_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function b_(r){var e=C_(r,"string");return typeof e=="symbol"?e:String(e)}function C_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var en=z.module("IrisGridPanel"),y_=500,S_={IrisGrid:Ya,IrisGridTableModel:um,ContextMenuRoot:pv};function Lu(r){if(r==null)throw new Error("No metadata provided");if(Lm(r))return r.name;if(Rm(r))return r.table;throw new Error("Unable to determine table name from metadata: ".concat(JSON.stringify(r)))}class Gr extends b.PureComponent{constructor(e){super(e),Ke(this,"irisGrid",void 0),Ke(this,"pluginRef",void 0),Ke(this,"modelPromise",void 0),Ke(this,"irisGridState",void 0),Ke(this,"gridState",void 0),Ke(this,"pluginState",void 0),Ke(this,"irisGridUtils",void 0),Ke(this,"getGridInputFilters",oe((n,i)=>Ne.getInputFiltersForColumns(n,i.filter(a=>{var{value:o,excludePanelIds:s}=a,l=A.getIdFromPanel(this);return o!=null&&(s==null||l!=null&&!s.includes(l))})))),Ke(this,"getAlwaysFetchColumns",oe((n,i)=>{for(var a=A.getIdFromPanel(this),o=new Set(i),s=0;s<n.length;s+=1){var{start:l}=n[s];l!=null&&l.panelId===a&&o.add(l.columnName)}return[...o]})),Ke(this,"getPluginContent",oe((n,i,a,o,s)=>{if(!i||!ur(i)||n==null||i.table==null)return null;var l={panel:this,onFilter:this.handlePluginFilter,onFetchColumns:this.handlePluginFetchColumns,user:a,workspace:o,components:S_};return h.jsx("div",{className:"iris-grid-plugin",children:h.jsx(n,An({ref:this.pluginRef,filter:this.handlePluginFilter,fetchColumns:this.handlePluginFetchColumns,model:i,table:i.table,onStateChange:this.handlePluginStateChange,pluginState:s},l))})})),Ke(this,"getDehydratedIrisGridPanelState",oe((n,i,a,o)=>Ne.dehydrateIrisGridPanelState(n,{isSelectingPartition:i,partitions:a,advancedSettings:o}))),Ke(this,"getDehydratedIrisGridState",oe((n,i,a,o,s,l,d,u,c,m,f,g,v,p,C,S,y,w,E,D,M,_)=>(I(this.irisGridUtils),this.irisGridUtils.dehydrateIrisGridState(n,{advancedFilters:a,aggregationSettings:y,customColumnFormatMap:o,isFilterBarShown:s,metrics:{userColumnWidths:C,userRowHeights:S},quickFilters:l,customColumns:d,reverseType:u,rollupConfig:c,showSearchBar:m,searchValue:f,selectDistinctColumns:g,selectedSearchColumns:v,sorts:i,invertSearchColumns:p,pendingDataMap:w,frozenColumns:E,conditionalFormats:D,columnHeaderGroups:M,partitionConfig:_})))),Ke(this,"getDehydratedGridState",oe((n,i,a,o,s)=>Ne.dehydrateGridState(n,{isStuckToBottom:o,isStuckToRight:s,movedColumns:i,movedRows:a}))),Ke(this,"getCachedPanelState",oe((n,i,a,o)=>({irisGridPanelState:n,irisGridState:i,gridState:a,pluginState:o}))),Ke(this,"savePanelState",It(()=>{var{irisGridState:n,gridState:i,pluginState:a}=this;I(n);var{onPanelStateUpdate:o}=this.props,{model:s,panelState:l,isSelectingPartition:d,partitions:u,advancedSettings:c}=this.state,{advancedFilters:m,aggregationSettings:f,customColumnFormatMap:g,isFilterBarShown:v,quickFilters:p,customColumns:C,reverseType:S,rollupConfig:y,showSearchBar:w,searchValue:E,selectDistinctColumns:D,selectedSearchColumns:M,sorts:_,invertSearchColumns:T,metrics:N,pendingDataMap:x,frozenColumns:F,conditionalFormats:k,columnHeaderGroups:U,partitionConfig:H}=n;I(s),I(N);var{userColumnWidths:W,userRowHeights:X}=N;I(i);var{isStuckToBottom:le,isStuckToRight:me,movedColumns:ve,movedRows:j}=i,R=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(s,d,u,c),this.getDehydratedIrisGridState(s,_,m,g,v,p,C,S,y,w,E,D,M,T,W,X,f,x,F,k,U,H),this.getDehydratedGridState(s,ve,j,le,me),a);R!==l&&(en.debug("Saving panel state",this,R),this.setState({panelState:R}),o==null||o(R))},y_)),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.handleCreateChart=this.handleCreateChart.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=Z.createRef(),this.pluginRef=Z.createRef();var{panelState:t}=e;this.pluginState=null,this.irisGridUtils=null,this.state={error:null,isDisconnected:!1,isLoaded:!1,isLoading:!0,isModelReady:!1,model:void 0,advancedFilters:new Map,aggregationSettings:{aggregations:[],showOnTop:!1},advancedSettings:new Map(Bc.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:P.REVERSE_TYPE.NONE,movedColumns:[],movedRows:[],isSelectingPartition:!1,partitions:[],rollupConfig:void 0,showSearchBar:!1,searchValue:"",selectedSearchColumns:void 0,invertSearchColumns:!0,Plugin:void 0,pluginFilters:[],pluginFetchColumns:[],modelQueue:[],pendingDataMap:new Map,frozenColumns:void 0,panelState:t,irisGridStateOverrides:{},gridStateOverrides:{},isStuckToBottom:!1,isStuckToRight:!1,conditionalFormats:[],selectDistinctColumns:[]}}componentDidMount(){this.initModel()}componentDidUpdate(e,t){var{model:n}=this.state,{makeModel:i}=this.props;n!==t.model&&(t.model!=null&&(this.stopModelListening(t.model),t.model.close()),n!=null&&this.startModelListening(n)),i!==e.makeModel&&this.initModel()}componentWillUnmount(){this.savePanelState.cancel(),this.modelPromise!=null&&(this.modelPromise.cancel(),this.modelPromise=void 0);var{model:e}=this.state;e&&(this.stopModelListening(e),e.close())}getTableName(){var{metadata:e}=this.props;return Lu(e)}initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});var{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=we.makeCancelable(e(),t=>t.close()),this.modelPromise.then(this.handleLoadSuccess).catch(this.handleLoadError)}handleLoadSuccess(e){var t=e,{panelState:n,irisGridStateOverrides:i}=this.state,a=[];if(this.irisGridUtils=new Ne(t.dh),n!=null){var{irisGridState:o}=n,{aggregationSettings:s,customColumns:l,selectDistinctColumns:d=[],rollupConfig:u}=An(An({},o),i);l.length>0&&a.push(c=>{c.customColumns=l}),u!=null&&u.columns.length>0&&a.push(c=>{c.rollupConfig=Ne.getModelRollupConfig(c.originalColumns,u,s)}),d.length>0&&a.push(c=>{c.selectDistinctColumns=d})}this.setState({model:t,modelQueue:a}),this.initModelQueue(t,a)}initModelQueue(e,t){var n=e;if(t.length===0){this.modelInitialized(n);return}var i=t.shift();en.debug("initModelQueue",i),i&&i(n),this.setState({modelQueue:t})}handleAdvancedSettingsChange(e,t){en.debug("handleAdvancedSettingsChange",e,t),this.setState(n=>{var{advancedSettings:i}=n;return i.get(e)===t?null:{advancedSettings:new Map(i).set(e,t)}})}handlePluginFilter(e){var t,n,{model:i}=this.state;I(i);var{columns:a,formatter:o}=i,s=(t=(n=this.irisGridUtils)===null||n===void 0?void 0:n.getFiltersFromInputFilters(a,e,o.timeZone))!==null&&t!==void 0?t:[];this.setState({pluginFilters:s})}handlePluginFetchColumns(e){this.setState({pluginFetchColumns:e})}handleContextMenu(e){var t,n,i;return(t=(n=this.pluginRef.current)===null||n===void 0||(i=n.getMenu)===null||i===void 0?void 0:i.call(n,e))!==null&&t!==void 0?t:[]}isColumnSelectionValid(e){var{columnSelectionValidator:t}=this.props;return t&&e?t(this,e):!1}handleGridStateChange(e,t){this.irisGridState=e,this.gridState=t,this.setState({isLoaded:!0,isLoading:!1}),this.savePanelState();var{glEventHub:n,onStateChange:i}=this.props;n.emit(jt.STATE_CHANGED,this),i==null||i(e,t)}handlePluginStateChange(e){var{irisGridState:t,gridState:n}=this;this.pluginState=e,t!==null&&n!==null&&this.savePanelState()}handleColumnsChanged(e){var{isModelReady:t,model:n,modelQueue:i}=this.state;t?this.sendColumnsChange(e.detail):(I(n),this.initModelQueue(n,i))}handleTableChanged(e){en.debug("handleTableChanged",e);var{glEventHub:t}=this.props,{detail:n}=e;t.emit(Ve.TABLE_CHANGED,this,n)}handleCreateChart(e,t){this.savePanelState.flush(),this.setState(()=>null,()=>{var{glEventHub:n,inputFilters:i}=this.props,a=this.getTableName(),{panelState:o}=this.state,s=A.getIdFromPanel(this),l;o&&(l=Ne.extractTableSettings(o,i)),n.emit(jt.CREATE_CHART,{metadata:{settings:e,sourcePanelId:s,table:a,tableSettings:l},table:ur(t)?t.table:void 0})})}handleColumnSelected(e){var{glEventHub:t}=this.props;t.emit(jt.COLUMN_SELECTED,this,e)}handleDataSelected(e,t){var{glEventHub:n}=this.props;n.emit(jt.DATA_SELECTED,this,t)}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){en.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){we.isCanceled(e)||this.handleError(e)}modelInitialized(e){var{glEventHub:t,loadPlugin:n}=this.props;if(this.modelPromise=void 0,this.loadPanelState(e),this.setState({isModelReady:!0}),ur(e)){var{table:i}=e,{pluginName:a}=i;if(a!==""&&n!=null&&a!=null){var o=n(a);this.setState({Plugin:o})}t.emit(Ve.TABLE_CHANGED,this,i)}this.sendColumnsChange(e.columns)}handleClearAllFilters(){var e=this.irisGrid.current,{isDisconnected:t}=this.state;e!=null&&!t&&e.clearAllFilters()}sendColumnsChange(e){en.debug2("sendColumnsChange",e);var{glEventHub:t}=this.props;t.emit(Ve.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(ce.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(ce.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(ce.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(ce.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(ce.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(ce.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){var t,n,i,{model:a}=this.state;if(!a)return null;var o=this.irisGrid.current,{gridWrapper:s}=o||{},l=(t=s==null?void 0:s.getBoundingClientRect())!==null&&t!==void 0?t:null;if(l==null||l.width<=0||l.height<=0)return null;I(o);var{metrics:d}=o.state;I(d);var{columnHeaderHeight:u,allColumnXs:c,allColumnWidths:m,right:f,columnHeaderMaxDepth:g}=d,v=a.getColumnIndexByName(e);I(v);var p=o.getVisibleColumn(v),C=(n=c.get(p))!==null&&n!==void 0?n:0,S=(i=m.get(p))!==null&&i!==void 0?i:0,y=Math.max(l.left,Math.min(p>f?l.right:l.left+C+S*.5,l.right)),w=l.top+u*g;return[y,w]}setFilterMap(e){var t=this.irisGrid.current;t!=null&&t.setFilterMap(e)}setAdvancedFilterMap(e){var t=this.irisGrid.current;t!=null&&t.setAdvancedFilterMap(e)}setFilters(e){var{quickFilters:t,advancedFilters:n}=e;en.debug("setFilters",t,n);var{model:i,isDisconnected:a}=this.state,o=this.irisGrid.current;if(o==null||a){en.debug("Ignore setFilters, model disconnected");return}I(i);var{columns:s,formatter:l}=i,d=Ne.changeFilterColumnNamesToIndexes(i.columns,t).filter(c=>{var[m]=c;return i.isFilterable(m)}),u=Ne.changeFilterColumnNamesToIndexes(i.columns,n).filter(c=>{var[m]=c;return i.isFilterable(m)});I(this.irisGridUtils),o.clearAllFilters(),o.setFilters({quickFilters:this.irisGridUtils.hydrateQuickFilters(s,d,l.timeZone),advancedFilters:this.irisGridUtils.hydrateAdvancedFilters(s,u,l.timeZone)})}setStateOverrides(e){en.debug("setStateOverrides",e);var{irisGridState:t,gridState:n}=e;this.setState({irisGridStateOverrides:t,gridStateOverrides:n},()=>{this.initModel()})}unsetFilterValue(){}loadPanelState(e){var{panelState:t,irisGridStateOverrides:n,gridStateOverrides:i}=this.state;if(t!=null)try{var{gridState:a,irisGridState:o,irisGridPanelState:s}=t,l=An({},n),{quickFilters:d,advancedFilters:u}=l;d&&(l.quickFilters=Ne.changeFilterColumnNamesToIndexes(e.columns,d)),u&&(l.advancedFilters=Ne.changeFilterColumnNamesToIndexes(e.columns,u));var{isSelectingPartition:c,partitions:m,advancedSettings:f}=Ne.hydrateIrisGridPanelState(e,s);I(this.irisGridUtils);var{advancedFilters:g,customColumns:v,customColumnFormatMap:p,isFilterBarShown:C,quickFilters:S,reverseType:y,rollupConfig:w,aggregationSettings:E,sorts:D,userColumnWidths:M,userRowHeights:_,showSearchBar:T,searchValue:N,selectDistinctColumns:x,selectedSearchColumns:F,invertSearchColumns:k,pendingDataMap:U,frozenColumns:H,conditionalFormats:W,columnHeaderGroups:X,partitionConfig:le}=this.irisGridUtils.hydrateIrisGridState(e,An(An({},o),l)),{isStuckToBottom:me,isStuckToRight:ve,movedColumns:j,movedRows:R}=Ne.hydrateGridState(e,An(An({},a),i),o.customColumns);this.setState({advancedFilters:g,advancedSettings:f,conditionalFormats:W,customColumns:v,customColumnFormatMap:p,isFilterBarShown:C,isSelectingPartition:c,movedColumns:j,movedRows:R,partitions:m,quickFilters:S,reverseType:y,rollupConfig:w,aggregationSettings:E,sorts:D,userColumnWidths:M,userRowHeights:_,showSearchBar:T,searchValue:N,selectDistinctColumns:x,selectedSearchColumns:F,invertSearchColumns:k,pendingDataMap:U,frozenColumns:H,isStuckToBottom:me,isStuckToRight:ve,columnHeaderGroups:X,partitionConfig:le})}catch($){en.error("loadPanelState failed to load panelState",t,$)}}updateGrid(){var e,t,n=(e=(t=this.irisGrid.current)===null||t===void 0?void 0:t.grid)!==null&&e!==void 0?e:null;n&&n.handleResize()}render(){var e,t,{children:n,glContainer:i,glEventHub:a,columnSelectionValidator:o,getDownloadWorker:s,inputFilters:l,links:d,metadata:u,panelState:c,user:m,workspace:f,settings:g,theme:v}=this.props,{advancedFilters:p,aggregationSettings:C,advancedSettings:S,conditionalFormats:y,customColumns:w,customColumnFormatMap:E,error:D,isDisconnected:M,isFilterBarShown:_,isSelectingPartition:T,isStuckToBottom:N,isStuckToRight:x,isLoaded:F,isLoading:k,isModelReady:U,model:H,movedColumns:W,movedRows:X,partitions:le,partitionConfig:me,quickFilters:ve,reverseType:j,rollupConfig:R,sorts:$,userColumnWidths:G,userRowHeights:te,showSearchBar:Me,searchValue:V,selectDistinctColumns:ne,selectedSearchColumns:de,invertSearchColumns:Ee,Plugin:Le,pluginFilters:ni,pluginFetchColumns:wr,pendingDataMap:ri,frozenColumns:nr,columnHeaderGroups:sf}=this.state,lf=D!=null?"Unable to open table. ".concat(D):void 0,rl=Lu(u),il=(e=H==null?void 0:H.description)!==null&&e!==void 0?e:void 0,df=(t=c==null?void 0:c.pluginState)!==null&&t!==void 0?t:null,uf=n??this.getPluginContent(Le,H,m,f,df),{permissions:hf}=m,{canCopy:cf,canDownloadCsv:mf}=hf;return h.jsx(Ki,{errorMessage:lf,isDisconnected:M,isLoading:k,isLoaded:F,className:"iris-grid-panel",glContainer:i,glEventHub:a,onClearAllFilters:this.handleClearAllFilters,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:rl,widgetType:"Table",description:il,componentPanel:this,renderTabTooltip:()=>h.jsx(Xs,{model:H,widgetName:rl,glContainer:i,description:il}),children:U&&H&&h.jsx(Ya,{advancedFilters:p,aggregationSettings:C,advancedSettings:S,alwaysFetchColumns:this.getAlwaysFetchColumns(d,wr),columnAllowedCursor:"linker",columnNotAllowedCursor:"linker-not-allowed",copyCursor:"copy",customColumns:w,customColumnFormatMap:E,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:y,inputFilters:this.getGridInputFilters(H.columns,l),applyInputFiltersOnInit:c==null,isFilterBarShown:_,isSelectingColumn:o!=null,isSelectingPartition:T,isStuckToBottom:N,isStuckToRight:x,movedColumns:W,movedRows:X,partitions:le,partitionConfig:me,quickFilters:ve,reverseType:j,rollupConfig:R,settings:g,sorts:$,userColumnWidths:G,userRowHeights:te,model:H,showSearchBar:Me,searchValue:V,selectedSearchColumns:de,selectDistinctColumns:ne,invertSearchColumns:Ee,onColumnSelected:this.handleColumnSelected,onCreateChart:this.handleCreateChart,onDataSelected:this.handleDataSelected,onError:this.handleError,onStateChange:this.handleGridStateChange,onContextMenu:this.handleContextMenu,onAdvancedSettingsChange:this.handleAdvancedSettingsChange,customFilters:ni,pendingDataMap:ri,canCopy:cf,canDownloadCsv:mf,ref:this.irisGrid,getDownloadWorker:s,frozenColumns:nr,theme:v,columnHeaderGroups:sf,children:uf})})}}Ke(Gr,"defaultProps",{onStateChange:()=>{},onPanelStateUpdate:()=>{}});Ke(Gr,"displayName","IrisGridPanel");Ke(Gr,"COMPONENT","IrisGridPanel");var w_=(r,e)=>{var{localDashboardId:t=qS}=e;return{inputFilters:no(r,t),links:Sr(r,t),columnSelectionValidator:ao(r,t),user:Ly(r),workspace:Nc(r),settings:Ui(r)}},E_=Ht(w_,null,null,{forwardRef:!0})(Gr);const zr=E_;function Oi(r,e,t){return e=P_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function P_(r){var e=T_(r,"string");return typeof e=="symbol"?e:String(e)}function T_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Au=z.module("InputFilter"),__=150;class Kr extends b.Component{constructor(e){super(e),Oi(this,"inputRef",void 0),Oi(this,"getItemLabel",qe((a,o)=>{var{name:s,type:l}=a[o];if(o>0&&a[o-1].name===s||o<a.length-1&&a[o+1].name===s){var d=l.substring(l.lastIndexOf(".")+1);return"".concat(s," (").concat(d,")")}return s})),Oi(this,"sendUpdate",It(()=>{var{onChange:a}=this.props,{column:o,value:s,isValueShown:l}=this.state;a({column:o,isValueShown:l,value:s})},__)),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.inputRef=Z.createRef();var{column:t,isValueShown:n,value:i}=e;this.state={column:t,selectedColumn:t,value:i,isValueShown:n}}componentDidUpdate(e,t){var{column:n}=this.props,{column:i,value:a,isValueShown:o}=this.state;n!==e.column&&this.setState({column:n,selectedColumn:n}),o!==void 0&&o&&o!==t.isValueShown&&this.focusInput(),(i!==t.column||a!==t.value||o!==t.isValueShown)&&this.sendUpdate()}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){var{columns:t}=this.props,n=t[parseInt(e,10)];Au.debug2("handleColumnChange",n),this.setState({selectedColumn:n,value:void 0})}handleInputKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),this.setState(t=>{var{value:n}=t;return n==null?{value:""}:null},()=>{this.sendUpdate(),this.sendUpdate.flush()}))}handleValueChange(e){var{value:t}=e.target;Au.debug2("handleValueChange",t),this.setState({value:t})}handleSettingsCancel(){var{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!0})}handleSettingsSave(){var{selectedColumn:e}=this.state;this.setState({column:e,isValueShown:!0})}handleSettingsClick(e){var{column:t}=this.state;this.setState({selectedColumn:t,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(e){var{name:t,type:n,value:i,isValueShown:a}=e,o=t!=null&&n!=null?{name:t,type:n}:void 0,s=a===void 0?{column:o,value:i}:{column:o,value:i,isValueShown:a};this.setState(s)}render(){var{columns:e}=this.props,{column:t,isValueShown:n,selectedColumn:i,value:a}=this.state,o=a==null||a.length===0?Kr.PLACEHOLDER.length:a.length,s=null;if(t!=null){var l=e.findIndex(d=>d.name===t.name&&d.type===t.type);s=l>=0?this.getItemLabel(e,l):t.name}return h.jsxs(ws,{className:"input-filter fill-parent-absolute",isFlipped:n??!1,children:[h.jsx("div",{className:"input-filter-settings-card",children:h.jsxs("div",{className:"input-filter-settings-content",children:[h.jsxs("div",{className:"input-filter-settings-grid",children:[h.jsx("label",{children:"Filter Column"}),h.jsxs(Vr,{value:String(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,children:[e.map((d,u)=>h.jsx("option",{value:u,children:this.getItemLabel(e,u)},"".concat(d.name,"/").concat(d.type))),e.length===0&&h.jsx("option",{value:"-1",disabled:!0,children:"No Available Columns"})]}),h.jsx("div",{className:"text-muted small",children:"Input filter control will apply its filter to all columns matching this name in this dashboard."})]}),h.jsxs("div",{className:"input-filter-settings-buttons",children:[h.jsx(Y,{kind:"secondary",onClick:this.handleSettingsCancel,disabled:t==null,children:"Cancel"}),h.jsx(Y,{kind:"primary",className:"ml-2",onClick:this.handleSettingsSave,disabled:i==null,children:"Save"})]})]})}),h.jsxs("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick,children:[h.jsx("div",{className:"input-filter-column",children:h.jsxs("div",{className:"input-filter-column-title",children:[s," Filter"]})}),h.jsx("div",{className:"d-flex justify-content-center align-items-center h-100 w-100",children:h.jsx("div",{className:"input-filter-value-input d-flex flex-column justify-content-center",children:h.jsx("input",{type:"text",ref:this.inputRef,placeholder:Kr.PLACEHOLDER,value:a??"",onChange:this.handleValueChange,onKeyPress:this.handleInputKeyPress,style:{width:"".concat(o+3,"ch")},spellCheck:"false"})})}),h.jsx("div",{className:"input-filter-menu",children:h.jsx(Y,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h.jsx(ue,{icon:Va,transform:"grow-4"}),tooltip:"Input Filter Settings"})})]})]})}}Oi(Kr,"PLACEHOLDER","Enter value...");Oi(Kr,"defaultProps",{column:null,isValueShown:!1,value:null});const O_=Kr;function ho(r,e,t){return e=D_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function D_(r){var e=M_(r,"string");return typeof e=="symbol"?e:String(e)}function M_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var I_=250;class co extends b.Component{constructor(e){super(e),ho(this,"inputFilterRef",void 0),this.handleChange=It(this.handleChange.bind(this),I_),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=Z.createRef();var{panelState:t}=e,{value:n,isValueShown:i=!1,name:a,type:o,timestamp:s}=t??{};this.state={columns:[],column:a!=null&&o!=null?{name:a,type:o}:void 0,value:n,timestamp:s,isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:t}}componentDidMount(){this.updateColumns();var{column:e,value:t,timestamp:n}=this.state;if(e!=null){var{name:i,type:a}=e;this.sendUpdate(i,a,t,n)}}componentDidUpdate(e){var{columns:t}=this.props;t!==e.columns&&this.updateColumns()}handleChange(e){var{column:t,isValueShown:n=!1,value:i}=e,a,o;t!=null&&({name:a,type:o}=t);var s=!0,l=Date.now();this.setState(d=>{var u,{panelState:c,timestamp:m,wasFlipped:f,skipUpdate:g}=d,v=c!=null&&n!==c.isValueShown&&a===c.name&&o===c.type&&i===c.value;return s=(u=!g&&n&&(!v||!f))!==null&&u!==void 0?u:!1,s||(l=m),{panelState:{isValueShown:n,name:a,type:o,value:i,timestamp:l},timestamp:l,wasFlipped:v,skipUpdate:!1}},()=>{s&&this.sendUpdate(a,o,i,l)})}handleClearAllFilters(){var e;(e=this.inputFilterRef.current)===null||e===void 0||e.clearFilter()}sendUpdate(e,t,n,i){var{glEventHub:a}=this.props;a.emit(Ve.FILTERS_CHANGED,this,{name:e,type:t,value:n,timestamp:i})}setPanelState(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState({skipUpdate:!n}),(t=this.inputFilterRef.current)===null||t===void 0||t.setFilterState(e)}updateColumns(){var{columns:e}=this.props;e!=null&&this.setState(t=>{var{column:n}=t;return n==null&&e.length>0?{columns:[...e],column:e[0]}:n!=null&&!e.find(i=>{var{name:a,type:o}=i;return n.name===a&&n.type===o})?{columns:[...e,n]}:{columns:[...e]}})}render(){var{glContainer:e,glEventHub:t}=this.props,{column:n,columns:i,isValueShown:a,value:o}=this.state;return h.jsx(hn,{className:"iris-input-filter-panel",componentPanel:this,glContainer:e,glEventHub:t,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0,children:h.jsx(O_,{ref:this.inputFilterRef,column:n,columns:i,onChange:this.handleChange,isValueShown:a,value:o})})}}ho(co,"defaultProps",{panelState:null});ho(co,"COMPONENT","InputFilterPanel");ho(co,"displayName","InputFilterPanel");var N_=(r,e)=>{var{localDashboardId:t}=e;return{columns:Ws(r,t)}},x_=Ht(N_,null,null,{forwardRef:!0})(co);const $r=x_;function ku(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ku(Object(t),!0).forEach(function(n){Zs(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ku(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Zs(r,e,t){return e=F_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function F_(r){var e=R_(r,"string");return typeof e=="symbol"?e:String(e)}function R_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var rt=z.module("FilterSetManagerPanel");function L_(r){return r.setPanelState!=null}class qr extends b.Component{static changeFilterIndexesToColumnNames(e,t){return t.map(n=>{var[i,a]=n;if(i>=e.columns.length)return null;var{name:o}=e.columns[i];return{name:o,filter:a}}).filter(n=>n!=null)}constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleSetsUpdate=this.handleSetsUpdate.bind(this),this.handleGetFilterState=this.handleGetFilterState.bind(this);var{panelState:t,filterSets:n}=e,{selectedId:i=n.length>0?n[0].id:void 0,isValueShown:a=!1}=t??{};this.state={selectedId:i,isValueShown:a,panelState:t}}getFilterState(){var{dashboardOpenedPanelMap:e}=this.props,t=[];return[...e.keys()].forEach(n=>{var i=e.get(n);if(i===void 0){rt.error("Could not get panel",i);return}var a=A.getComponentNameFromPanel(i),o=A.getIdFromPanel(i);rt.debug("Panel:",i,a);var{glContainer:s=null}=i.props;if(s==null){rt.error("Could not get panel container",i);return}var l=A.getComponentConfigFromContainer(s);if(l==null){rt.error("Could not get component config from container",s);return}var d=A.getPanelComponentState(l);if(d==null){rt.debug("Panel state is null ".concat(o));return}switch(a){case A.getComponentName(Gr):{var u;o!=null&&(u=this.getIrisGridPanelFilters(o,d)),u!=null&&t.push({panelId:o,type:a,state:u});break}case A.getComponentName($r):case A.getComponentName(Zn):{var{isValueShown:c,name:m,type:f,value:g}=d;t.push({panelId:o,type:a,state:{isValueShown:c,name:m,type:f,value:g}});break}}}),t}getIrisGridPanelFilters(e,t){var{panelTableMap:n}=this.props,i=n.get(e);if(i==null)return rt.error("Unable to get table for panel ".concat(e,".")),null;var{irisGridState:a={advancedFilters:void 0,quickFilters:void 0},gridState:o={}}=t,{advancedFilters:s,quickFilters:l}=a,d;s&&(d=qr.changeFilterIndexesToColumnNames(i,s));var u;return l&&(u=qr.changeFilterIndexesToColumnNames(i,l)),{irisGridState:pa(pa({},a),{},{advancedFilters:d,quickFilters:u}),gridState:pa({},o)}}handleGetFilterState(){return this.getFilterState()}handleChange(e){var{isValueShown:t,selectedId:n}=e;rt.debug("handleChange",t,n),this.setState({isValueShown:t,selectedId:n}),this.updatePanelState()}handleFilterApply(e){var{dashboardOpenedPanelMap:t}=this.props,{panels:n,restoreFullState:i=!1}=e;rt.debug("Apply filters from filter set",e),n.forEach(a=>{var{panelId:o,type:s,state:l}=a;if(o==null){rt.debug("panel is null",o);return}if(!t.has(o)){rt.debug("Ignore closed panel",o);return}rt.debug("Apply panel filters",o,s,l);var d=t.get(o);switch(s){case A.getComponentName(Gr):this.restoreIrisGridFilters(d,l,i);break;case A.getComponentName($r):case A.getComponentName(Zn):this.restoreInputFilterState(d,l);break}})}handleSetsUpdate(e){var{setDashboardFilterSets:t,localDashboardId:n}=this.props;rt.debug("Saving updated sets",e),t(n,[...e])}updatePanelState(){this.setState(e=>{var{selectedId:t,isValueShown:n}=e;return{panelState:{selectedId:t,isValueShown:n}}})}restoreIrisGridFilters(e,t,n){var{irisGridState:i={},advancedFilters:a=[],quickFilters:o=[]}=t,{advancedFilters:s=a,quickFilters:l=o}=i,{panelTableMap:d}=this.props,u=A.getIdFromPanel(e);if(u==null){rt.error("Panel Id is null.");return}var c=d.get(u);if(c==null){rt.error("Unable to get table for panel ".concat(u,"."));return}rt.debug("restoreIrisGridFilters",u,t,n),n?e.setStateOverrides(t):e.setFilters({quickFilters:l,advancedFilters:s})}restoreInputFilterState(e,t){var n=pa({},t);delete n.isValueShown,rt.debug("restoreInputFilterState",e,n),e&&L_(e)&&e.setPanelState(n)}render(){var{glContainer:e,glEventHub:t,filterSets:n}=this.props,{isValueShown:i,selectedId:a}=this.state;return h.jsx(hn,{className:"filter-set-manager-panel",componentPanel:this,glContainer:e,glEventHub:t,isClonable:!0,isRenamable:!0,children:h.jsx("div",{className:"input-filter-container h-100 w-100 container",children:h.jsx(Fm,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:i,filterSets:n,selectedId:a,getFilterState:this.handleGetFilterState})})})}}Zs(qr,"defaultProps",{panelState:null});Zs(qr,"COMPONENT","FilterSetManagerPanel");var A_=(r,e)=>{var{localDashboardId:t}=e;return{filterSets:Cm(r,t),dashboardOpenedPanelMap:$c(r,t),dashboardInputFilters:no(r,t),panelTableMap:ro(r,t)}},k_=Ht(A_,{setDashboardFilterSets:Pm},null,{forwardRef:!0})(qr);const Ea=k_;function Li(r,e,t){return e=j_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function j_(r){var e=$_(r,"string");return typeof e=="symbol"?e:String(e)}function $_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ju=z.module("LogPanel");class mo extends b.PureComponent{constructor(e){super(e),Li(this,"isBottomVisible",void 0),Li(this,"logView",void 0),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;var{session:t}=this.props;this.state={session:t}}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(e){ju.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){ju.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:n}=this.state;return h.jsxs(hn,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[n==null&&h.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),n!=null&&h.jsx(z0,{session:n,ref:i=>{this.logView=i}})]})}}Li(mo,"defaultProps",{session:null});Li(mo,"COMPONENT","LogPanel");Li(mo,"TITLE","Log");var H_=(r,e)=>{var t;return{session:(t=ti(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},V_=Ht(H_,null,null,{forwardRef:!0})(mo);const Am=V_;function U_(r,e,t){return e=B_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function B_(r){var e=W_(r,"string");return typeof e=="symbol"?e:String(e)}function W_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class km extends b.PureComponent{render(){var{isEditing:e,children:t,onDoubleClick:n}=this.props;return h.jsxs("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:n,children:[h.jsx("div",{className:J("text-muted","edit-hint",{viewing:e===void 0||!e}),children:h.jsxs("span",{children:["double-click to edit ",h.jsx(ue,{icon:Rh})]})}),t]})}}U_(km,"defaultProps",{isEditing:!1});function G_(r,e,t){return e=z_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function z_(r){var e=K_(r,"string");return typeof e=="symbol"?e:String(e)}function K_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var q_=z.module("MarkdownStartPage");class jm extends b.PureComponent{constructor(e){super(e),this.handleDeleteButtonClick=this.handleDeleteButtonClick.bind(this),this.handleDeleteModalClose=this.handleDeleteModalClose.bind(this),this.state={isDeleteModalShown:!1}}handleDeleteButtonClick(e){this.setState({isDeleteModalShown:!0,toBeDeleted:e})}handleDeleteModalClose(){this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}handleDeleteMarkdown(e){if(q_.debug("delete markdown: ",e),e!==void 0){var{onDelete:t}=this.props;t(e)}this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}render(){var{closedMarkdowns:e,onOpen:t,onCreate:n}=this.props,{isDeleteModalShown:i,toBeDeleted:a}=this.state;return h.jsx("div",{className:"markdown-panel-start-page h-100 w-100",children:h.jsxs("div",{className:"markdown-panel-start-page-container",children:[h.jsxs("div",{className:"markdown-panel-start-list",children:[h.jsx("h3",{className:"list-title",children:"Start"}),h.jsx("div",{className:"list-item",children:h.jsx(Y,{kind:"ghost",className:"title",onClick:n,children:"New Markdown Note"})})]}),h.jsxs("div",{className:"markdown-panel-start-list",children:[h.jsx("h3",{className:"list-title",children:"Recently Closed from Dashboard"}),e.map(o=>h.jsxs("div",{className:"list-item",children:[h.jsx(Y,{kind:"ghost",className:"title",onClick:()=>t(o),children:o.title}),h.jsx("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(o)},children:h.jsx(ue,{icon:ki})})]},o.id)),h.jsxs(us,{isOpen:i,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal",children:[h.jsx(hs,{children:"Are you sure you want to permanently delete this note?"}),h.jsx(cs,{children:"You can't undo this action."}),h.jsxs(Ss,{children:[h.jsx(Y,{kind:"secondary",onClick:this.handleDeleteModalClose,children:"Cancel"}),h.jsx(Y,{kind:"danger",onClick:()=>{this.handleDeleteMarkdown(a)},children:"Delete"})]})]})]})]})})}}G_(jm,"defaultProps",{closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}});const X_=jm;function Di(r,e,t){return e=Z_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Z_(r){var e=Y_(r,"string");return typeof e=="symbol"?e:String(e)}function Y_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Q_=b.lazy(()=>Ai(()=>import("./MarkdownEditor-4b982230.js"),["./MarkdownEditor-4b982230.js","./vendor-3c001961.js","./helpers-de833af9.js","./vendor-a4479904.css","./index-02ac7b13.js","./index-7535fde1.css","./usePlugins-2d06e38b.js"],import.meta.url)),ga=z.module("MarkdownPanel");class Ys extends b.Component{constructor(e){super(e),Di(this,"markdownEditor",void 0),Di(this,"editor",void 0),Di(this,"getClosedMarkdowns",oe(i=>i.filter(a=>a.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);var{panelState:t}=e,n=null;t!=null&&t.content!=null&&({content:n}=t),this.state={isStartPageShown:n==null,isEditing:!1,content:n,panelState:t},this.markdownEditor=null}setEditorPosition(e){I(this.markdownEditor);var{container:t}=this.markdownEditor;if(this.editor&&t!=null){var n,i,a=t.getBoundingClientRect().top,o=t.scrollTop,s=t.scrollHeight,l=(n=(i=this.editor.getModel())===null||i===void 0?void 0:i.getLineCount())!==null&&n!==void 0?n:0,d=Math.round((o+e-a)/s*l);d>l&&(d=l),this.editor.revealLine(d),this.editor.setPosition({lineNumber:d,column:1}),this.editor.focus()}}handleContainerDoubleClick(e){var{isEditing:t}=this.state,n=e.clientY;t||this.setState({isEditing:!0},()=>{this.setEditorPosition(n)})}handleEditorInitialized(e){ga.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){ga.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor!=null&&this.editor.focus!=null&&this.editor.focus()})}handleOpenMarkdown(e){ga.debug("open markdown...",e);var{glContainer:t,glEventHub:n}=this.props,i=A.getComponentConfigFromContainer(t);n.emit(se.REOPEN,e,i)}handleDeleteMarkdown(e){var{glEventHub:t}=this.props;t.emit(se.DELETE,e)}handleEditorBlur(e){var t;ga.debug("markdown content changed, saving...");var{isEditing:n}=this.state;if(!(!n||this.markdownEditor!=null&&this.markdownEditor.container!=null&&this.markdownEditor.container.contains(e.relatedTarget))){var i=(t=this.editor)===null||t===void 0?void 0:t.getValue();this.setState({content:i,isEditing:!1,panelState:{content:i}})}}handleEditorResize(){var{isEditing:e}=this.state;e&&this.editor&&this.editor.layout()}render(){var{glContainer:e,glEventHub:t,closedPanels:n}=this.props,{isEditing:i,isStartPageShown:a,content:o}=this.state,s=this.getClosedMarkdowns(n);return h.jsx(hn,{glContainer:e,glEventHub:t,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0,children:a?h.jsx(X_,{closedMarkdowns:s,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):h.jsx(km,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick,children:h.jsx(b.Suspense,{fallback:h.jsx(dn,{}),children:h.jsx(Q_,{ref:l=>{this.markdownEditor=l},isEditing:i,content:o??void 0,onEditorInitialized:this.handleEditorInitialized})})})})}}Di(Ys,"defaultProps",{panelState:null});Di(Ys,"COMPONENT","MarkdownPanel");var J_=(r,e)=>{var{localDashboardId:t}=e;return{closedPanels:kS(r,t)}},eO=Ht(J_,null,null,{forwardRef:!0})(Ys);const Nr=eO;function $u(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Hu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){$u(a,n,i,o,s,"next",l)}function s(l){$u(a,n,i,o,s,"throw",l)}o(void 0)})}}function Vu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function gt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vu(Object(t),!0).forEach(function(n){at(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Vu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function at(r,e,t){return e=tO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tO(r){var e=nO(r,"string");return typeof e=="symbol"?e:String(e)}function nO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var rO=b.lazy(()=>Ai(()=>import("./MarkdownNotebook-fd9a4017.js"),["./MarkdownNotebook-fd9a4017.js","./vendor-3c001961.js","./helpers-de833af9.js","./vendor-a4479904.css","./index-02ac7b13.js","./index-7535fde1.css","./usePlugins-2d06e38b.js","./MarkdownNotebook-9207e775.css"],import.meta.url)),pe=z.module("NotebookPanel"),Uu=400;class Je extends b.Component{static handleError(e){we.isCanceled(e)||pe.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(Je.UNSAVED_INDICATOR_CLASS_NAME,".").concat(Je.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=ie.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),at(this,"pending",void 0),at(this,"debouncedSavePanelState",void 0),at(this,"debouncedLoad",void 0),at(this,"notebook",void 0),at(this,"tabTitleElement",void 0),at(this,"tabInitOnce",void 0),at(this,"editor",void 0),at(this,"getSettings",oe((m,f)=>gt(gt({},m),{},{minimap:{enabled:f}}))),at(this,"getOverflowActions",oe((m,f)=>[{title:"Find",icon:dv,action:this.handleFind,group:fe.groups.high,shortcut:mt.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:_h,action:this.handleCopy,group:fe.groups.medium,order:20},{title:"Rename File",icon:uv,action:this.handleShowRename,group:fe.groups.medium,order:30},{title:"Delete File",icon:ki,action:this.handleDelete,group:fe.groups.medium,order:40},{title:"Show Minimap",icon:m?wi:void 0,action:this.handleMinimapChange,group:fe.groups.low,shortcut:mt.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:f?wi:void 0,action:this.handleWordWrapChange,group:fe.groups.low,shortcut:mt.NOTEBOOK.WORDWRAP,order:30}])),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.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.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.handlePanelDropped=this.handlePanelDropped.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.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new Qn,this.debouncedSavePanelState=It(this.savePanelState.bind(this),Uu),this.debouncedLoad=It(this.load.bind(this),Uu),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,sessionLanguage:i,panelState:a}=e,o={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;a!=null&&({fileMetadata:s=s,isPreview:l=l,settings:o=o}=a);var d=s!=null&&ie.hasPath(s.itemName),u=d===!0&&o.value!=null||!d&&o.value!=null&&o.value.length>0,c=u?1:0;this.state={error:void 0,isDashboardActive:t,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:s,settings:o,session:n,sessionLanguage:i,panelState:{fileMetadata:s,settings:o},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:""},pe.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:n}=e;n!=null&&this.initTab(n),this.initNotebookContent(),t.on(Se.RENAME_FILE,this.handleRenameFile),t.on(se.DROPPED,this.handlePanelDropped),e.on(Se.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:n,settings:i}=this.state,{wordWrap:a}=i,{defaultNotebookSettings:o}=this.props;n!==t.isPreview&&this.setPreviewStatus(),a!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),o.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:n,isPreview:i}=this.state;e.off(Se.RENAME_FILE,this.handleRenameFile),e.off(se.DROPPED,this.handlePanelDropped),t.off(Se.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(Se.UNREGISTER_FILE,n,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if((t==null?void 0:t.force)===!0)return!0;var{changeCount:n,savedChangeCount:i}=this.state;return n!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);I(t);var n=t.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:n}=this.state,{value:i}=n;if(e!==t&&this.notebook){var a=this.notebook.getValue();return a??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){pe.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){pe.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(Se.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:i}=this.props,{id:a}=i;n.emit(Se.REGISTER_FILE,a,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(Se.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;I(e);var{id:n}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(n)).then(a=>{var o;pe.debug("Loaded file",a);var{filename:s}=a,{itemName:l}=this.state;if(s!==l){var{metadata:d}=this.props,{id:u}=d;this.renameTab(u,ie.getBaseName(s))}var c=gt(gt({},t),{},{language:(o=Je.languageFromFileName(s))!==null&&o!==void 0?o:""});t.value==null&&(c.value=a.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&ie.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){pe.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:n}=this.props;this.pending.add(n.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;pe.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:n,fileMetadata:i,isPreview:a,settings:o}=e,s=this.getNotebookValue(),l=t!==n?s:void 0,d=gt(gt({},o),{},{value:s}),u=gt(gt({},o),{},{value:l}),c={settings:u,fileMetadata:i,isPreview:a};return pe.debug("Saving panel state",c),{settings:d,panelState:c}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(Se.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return Hu(function*(){var{fileStorage:t,glEventHub:n,session:i}=e.props,{fileMetadata:a,settings:o}=e.state;I(a);var{language:s}=o,{itemName:l}=a,d=yield ie.getUniqueCopyFileName(t,l);pe.debug("handleCopy",a,l,d),yield t.copyFile(l,d);var u={id:d,itemName:d},c={value:null,language:s};n.emit(Se.SELECT_NOTEBOOK,i,s,c,u,!0)})()}handleDelete(){pe.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return Hu(function*(){var{fileStorage:t,glContainer:n,glEventHub:i}=e.props,{fileMetadata:a}=e.state;pe.debug("handleDeleteConfirm",a==null?void 0:a.itemName),e.setState({showDeleteModal:!1}),a&&(ie.hasPath(a.itemName)&&(yield ie.fileExists(t,a.itemName))?(i.emit(Se.CLOSE_FILE,a,{force:!0}),t.deleteFile(a.itemName)):n.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){pe.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:i}=t,{isUndoing:a,isRedoing:o}=e;return a?{changeCount:n-1,savedChangeCount:i}:!o&&n<i?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{defaultNotebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{defaultNotebookSettings:t,updateSettings:n}=this.props,i={defaultNotebookSettings:{isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)}};n(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,n=t.wordWrap==="on"?"off":"on";return{settings:gt(gt({},t),{},{wordWrap:n})}})}handleBlur(){pe.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){pe.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(e){var{notebooksUrl:t,session:n,sessionLanguage:i}=this.props,{href:a}=e.currentTarget;if(!(!a||!a.startsWith(t))){e.stopPropagation(),e.preventDefault();var o="/".concat(a.substring(t.length)).replace(/%20/g," ");if(o==="/"){pe.debug("Ignoring invalid notebook link",o);return}pe.debug("Notebook link clicked, opening",o);var{glEventHub:s}=this.props,l={value:null,language:i},d={id:o,itemName:o};s.emit(Se.SELECT_NOTEBOOK,n,i,l,d)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;we.isCanceled(t)||(we.isTimedOut(t)&&(t=new Error("File not found.")),pe.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){pe.debug("handleSave"),this.save()}handleSaveSuccess(e){var t,{fileStorage:n}=this.props,i={id:e.filename,itemName:e.filename},a=(t=Je.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(o=>{var{fileMetadata:s}=o,l=gt(gt({},o.settings),{},{language:a});return pe.debug("handleSaveSuccess",i,s,l),s&&ie.hasPath(s.itemName)&&s.itemName!==i.itemName&&(pe.debug("handleSaveSuccess deleting old file",s.itemName),n.deleteFile(s.itemName).catch(Je.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){we.isCanceled(e)||(this.setState({savedChangeCount:0}),pe.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n&&this.handleOverwrite(e),pe.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:a}=i,o=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),ie.getBaseName(a)!==ie.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,ie.getBaseName(e))}this.saveContent(e,o)}}handleRenameFile(e,t,n){var{fileMetadata:i,panelState:a}=this.state,{glContainer:o}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&n&&JSON.stringify(a)!==JSON.stringify(n)){o.close();return}i&&i.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)===null||e===void 0||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){var e;if(!this.notebook){pe.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){pe.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,sessionLanguage:n})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;pe.debug("handleShow"),(e=this.notebook)===null||e===void 0||e.updateDimensions()}handlePanelDropped(e){var{metadata:{id:t}}=this.props;e===t&&this.forceUpdate()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){pe.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];pe.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){pe.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){pe.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:n}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=n==null?void 0:n.itemName;if(i===void 0)return e;i.charAt(0)==="/"&&(i=i.substring(1));var a=new URL(i,t);return new URL(e,a).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:a,sessionLanguage:o,settings:s}=this.state,l=gt(gt({},s),{},{language:t,value:n}),d={id:null,itemName:e};pe.debug("handleCreateNotebook",a,o,l,d),i.emit(Se.CREATE_NOTEBOOK,a,o,l,d)}runCommand(e){if(e===void 0||e===""){pe.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(Dt.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:n}=this.state;return n&&this.registerFileMetadata(n,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var e,t,{defaultNotebookSettings:n}=this.props,{settings:i}=this.state;return this.getOverflowActions((e=n.isMinimapEnabled)!==null&&e!==void 0?e:!1,this.getSettings(i,(t=n.isMinimapEnabled)!==null&&t!==void 0?t:!1).wordWrap==="on")}render(){var e,t,n,{fileStorage:i,glContainer:a,glContainer:{tab:o},glEventHub:s,defaultNotebookSettings:l}=this.props,{changeCount:d,savedChangeCount:u,error:c,isDashboardActive:m,isLoaded:f,isLoading:g,isPreview:v,fileMetadata:p,session:C,sessionLanguage:S,settings:y,showCloseModal:w,showDeleteModal:E,showSaveAsModal:D}=this.state,M=m&&!a.isHidden&&!v,_=(e=p==null?void 0:p.itemName)!==null&&e!==void 0?e:Je.DEFAULT_NAME,T=_.endsWith(".md"),N=(p==null?void 0:p.id)!=null,x=this.getSettings(y,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),F=C!=null,k=S===x.language,U=!f||!F||!k,H=!f,W=[{action:this.handleSave,shortcut:Pn.SAVE},{action:this.handleMinimapChange,shortcut:mt.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:mt.NOTEBOOK.WORDWRAP}],X=ns.getDisabledRunTooltip(F,k,"Notebook extension","Run"),le=ns.getDisabledRunTooltip(F,k,"Notebook extension","Run Selected"),me=[{title:N?"Rename":"Save As…",order:10,group:fe.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:fe.groups.high,order:20}],ve=o==null?void 0:o.element.find(".lm_title_before").get(0);return h.jsxs(h.Fragment,{children:[ve!=null&&Ha.createPortal(h.jsx("span",{className:J(Je.UNSAVED_INDICATOR_CLASS_NAME,{[Je.UNSAVED_STATUS_CLASS_NAME]:d!==u})}),ve),h.jsxs(hn,{className:"notebook-container",componentPanel:this,glContainer:a,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:me,renderTabTooltip:()=>_,children:[!T&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"notebook-toolbar",children:[h.jsxs("span",{children:[h.jsx(Y,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:U,icon:h.jsx(ue,{icon:Nh,transform:"grow-4"}),tooltip:"Run ".concat(mt.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),X!=null&&h.jsx(On,{children:X})]}),h.jsxs("span",{children:[h.jsx(Y,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:U,icon:h.jsx(ue,{icon:lv,transform:"grow-4"}),tooltip:"Run Selected ".concat(mt.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),le!=null&&h.jsx(On,{children:le})]}),h.jsx(Y,{kind:"ghost",className:"mr-auto",disabled:H,onClick:this.handleSave,icon:Fh,tooltip:"Save ".concat(Pn.SAVE.getDisplayText()),"aria-label":"Save"}),h.jsx(Y,{kind:"ghost",className:"btn-overflow",disabled:H,icon:Ih,tooltip:"More Actions...",onClick:()=>{},children:h.jsx(kr,{actions:this.getDropdownOverflowActions,popperOptions:Je.POPPER_OPTIONS})})]}),h.jsx(M0,{isLoaded:f,isLoading:g,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:C,sessionLanguage:S,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:x,focusOnMount:M,ref:j=>{this.notebook=j}})]}),T&&h.jsx(b.Suspense,{fallback:h.jsx(dn,{}),children:h.jsx(rO,{content:(n=x.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),h.jsx(Im,{isOpen:D,type:"file",defaultValue:_,title:N?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),h.jsx(fr,{isOpen:E,headerText:'Are you sure you want to delete "'.concat(_,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),h.jsx(fr,{isOpen:w,headerText:"Do you want to save the changes you made to ".concat(_,"?"),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"}),h.jsx(fe,{actions:W})]})]})}}at(Je,"COMPONENT","NotebookPanel");at(Je,"POPPER_OPTIONS",{placement:"bottom-end"});at(Je,"DEFAULT_NAME","Untitled");at(Je,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");at(Je,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");at(Je,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:{isMinimapEnabled:!0}});var iO=(r,e)=>{var t=Ic(r),n=ky(r),i=ti(r,e.localDashboardId),{session:a,config:o}=i??{},{type:s}=o??{};return{fileStorage:t,defaultNotebookSettings:n,session:a,sessionLanguage:s}},aO=Ht(iO,{updateSettings:Jy},null,{forwardRef:!0})(Je);const Un=aO;function $m(r){var{onClick:e}=r,t=b.useRef(null),n=b.useCallback(i=>{var a;(a=t.current)===null||a===void 0||a.blur(),e(i)},[e]);return h.jsxs(Y,{ref:t,kind:"primary",className:"btn-pandas",onClick:n,tooltip:"Click to refresh pandas dataframe, updates do not occur automatically.",children:["pandas dataframe",h.jsxs("span",{children:[h.jsx(ue,{icon:Lh,transform:"shrink-1",className:"mr-1"}),"Reload"]})]})}function Bu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Wu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bu(Object(t),!0).forEach(function(n){fo(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Bu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function fo(r,e,t){return e=oO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function oO(r){var e=sO(r,"string");return typeof e=="symbol"?e:String(e)}function sO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Qs extends b.Component{constructor(e){super(e),fo(this,"irisGridRef",void 0),this.irisGridRef=Z.createRef(),this.handleReload=this.handleReload.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePanelStateUpdate=this.handlePanelStateUpdate.bind(this);var{panelState:t}=e;this.state={shouldFocusGrid:!1,panelState:t}}handleReload(){var e;(e=this.irisGridRef.current)===null||e===void 0||e.initModel(),this.setState({shouldFocusGrid:!0})}handleGridStateChange(){var e,t,n,{shouldFocusGrid:i}=this.state;i&&(e=this.irisGridRef.current)!==null&&e!==void 0&&(t=e.irisGrid)!==null&&t!==void 0&&(n=t.current)!==null&&n!==void 0&&n.grid&&(this.irisGridRef.current.irisGrid.current.grid.focus(),this.setState({shouldFocusGrid:!1}))}handlePanelStateUpdate(e){this.setState({panelState:e})}render(){return h.jsx(zr,Wu(Wu({ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate},this.props),{},{children:h.jsx($m,{onClick:this.handleReload})}))}}fo(Qs,"defaultProps",{panelState:null});fo(Qs,"COMPONENT","PandasPanel");const Hm=Qs;function Gu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function zu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Gu(a,n,i,o,s,"next",l)}function s(l){Gu(a,n,i,o,s,"throw",l)}o(void 0)})}}function Ku(r,e,t){return e=lO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lO(r){var e=dO(r,"string");return typeof e=="symbol"?e:String(e)}function dO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class uO{constructor(e){Ku(this,"items",void 0),Ku(this,"onUpdateCallback",void 0),this.items=e}setSearch(e){}setExpanded(e,t){if(e.charAt(e.length-1)==="/")for(var n=0;n<this.items.length;n+=1){var i=this.items[n];Mt(i)&&("".concat(i.filename,"/")===e||i.filename===e)&&(i.isExpanded=t)}return Promise.resolve()}collapseAll(){for(var e=0;e<this.items.length;e+=1){var t=this.items[e];Mt(t)&&(t.isExpanded=!1)}return Promise.resolve()}getViewportData(){return Promise.resolve({items:this.items,offset:0})}getSnapshot(e){return zu(function*(){throw new Error("Method not implemented.")})()}setViewport(e){var t=this;return zu(function*(){var n,i=yield t.getViewportData();(n=t.onUpdateCallback)===null||n===void 0||n.call(t,i)})()}setFilters(e){}setSorts(e){}setReversed(e){}close(){}onUpdate(e){return this.onUpdateCallback=e,jest.fn()}get size(){return this.items.length}}const hO=uO;function qu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function ui(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){qu(a,n,i,o,s,"next",l)}function s(l){qu(a,n,i,o,s,"throw",l)}o(void 0)})}}function cO(r,e,t){return e=mO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mO(r){var e=fO(r,"string");return typeof e=="symbol"?e:String(e)}function fO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class vO{constructor(e){cO(this,"items",void 0),this.items=e}getTable(){var e=this;return ui(function*(){return new hO(e.items)})()}saveFile(e){throw new Error("Method not implemented.")}loadFile(e){throw new Error("Method not implemented.")}copyFile(e,t){return ui(function*(){throw new Error("Method not implemented.")})()}deleteFile(e){var t=this;return ui(function*(){t.items=t.items.filter(n=>n.filename!==e)})()}moveFile(e,t){var n=this;return ui(function*(){for(var i=0;i<n.items.length;i+=1)if(n.items[i].filename===e){n.items[i].filename=t,n.items[i].basename=ie.getBaseName(t),n.items[i].id=t;break}})()}info(e){var t=this;return ui(function*(){var n=t.items.filter(a=>a.filename===e);if(n.length===0)throw new uo;if(n.length>1)throw new Error("More than one matching file found");var i=n[0];return{filename:i.filename,basename:i.basename,id:i.filename,type:i.type}})()}createDirectory(e){throw new Error("Method not implemented.")}}const pO=vO;function Xu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function $a(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Xu(Object(t),!0).forEach(function(n){gO(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Xu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function gO(r,e,t){return e=bO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bO(r){var e=CO(r,"string");return typeof e=="symbol"?e:String(e)}function CO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Zu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function yO(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Zu(a,n,i,o,s,"next",l)}function s(l){Zu(a,n,i,o,s,"throw",l)}o(void 0)})}}function SO(r,e,t,n,i){return os.apply(this,arguments)}function os(){return os=yO(function*(r,e,t,n,i){var a,o,s,l;if(jr(t)?(a=t.settings,o=t.table,s=void 0,l=t.tableSettings):(a={},o="",s=zs(t)?t.figure:t.name,l={}),i!=null&&(i.tableSettings!=null&&(l=i.tableSettings),i.table!=null&&(o=i.table),i.figure!=null&&(s=i.figure),i.settings!=null&&(a=$a($a({},a),i.settings))),s==null&&o==null){var d=yield n();return Ti.makeModel(r,a,d)}if(s!=null){var u;if(t.type===r.VariableType.FIGURE){var c={name:s,type:r.VariableType.FIGURE};u=yield e(c)}else u=yield n();return Ti.makeModel(r,a,u)}var m={name:o,type:r.VariableType.TABLE},f=yield e(m);return new Ne(r).applyTableSettings(f,l,js(NS.getState())),Ti.makeModelFromSettings(r,a,f)}),os.apply(this,arguments)}var Js=b.forwardRef((r,e)=>{var t=vr(),n=mg(),i=Om(r)?r.panelState:void 0,{fetch:a,metadata:o,localDashboardId:s}=r,l=b.useMemo(()=>({metadata:o,localDashboardId:s,makeModel:()=>{if(o==null)throw new Error("Metadata is required for chart panel");return SO(t,n,o,a,i)}}),[o,s,t,n,a,i]);return h.jsx(qi,$a($a({ref:e},r),l))});Js.displayName="ChartPanelPlugin";const wO=Js;function Yu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function EO(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Yu(a,n,i,o,s,"next",l)}function s(l){Yu(a,n,i,o,s,"throw",l)}o(void 0)})}}function Vm(r){var e=vr(),[t,n]=b.useState(),{fetch:i}=r;return b.useEffect(()=>{var a=!1;function o(){return s.apply(this,arguments)}function s(){return s=EO(function*(){var l=yield i(),d=yield Ti.makeModel(e,void 0,l);a||n(d)}),s.apply(this,arguments)}return o(),()=>{a=!0}},[e,i]),t?h.jsx(oc,{model:t}):null}var PO={name:"ChartPanel",title:"Chart",type:Yn.WIDGET_PLUGIN,component:Vm,panelComponent:Js,supportedTypes:"Figure",icon:ms};const TO=PO;function Um(r){Yr(r);var{id:e,layout:t}=r,n=vr(),i=b.useCallback(a=>{var{metadata:o,panelId:s=Ue.generate(),table:l}=a,{settings:d}=o,u=()=>Ti.makeModelFromSettings(n,d,l),c=ut.titleFromSettings(d),m={type:"react-component",component:qi.COMPONENT,props:{localDashboardId:e,id:s,metadata:o,makeModel:u},title:c,id:s},{root:f}=t;A.openComponent({root:f,config:m})},[n,e,t]);return Pe(t.eventHub,jt.CREATE_CHART,i),null}var _O={name:"ChartBuilderPlugin",type:Yn.DASHBOARD_PLUGIN,component:Um};const OO=_O;function Qu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ju(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qu(Object(t),!0).forEach(function(n){DO(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function DO(r,e,t){return e=MO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function MO(r){var e=IO(r,"string");return typeof e=="symbol"?e:String(e)}function IO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Be=z.module("ConsolePlugin");function eh(r){return r.notebook!==void 0}function NO(r){Yr(r)}function xO(r){NO(r);var{id:e,hydrateConsole:t,layout:n,panelManager:i,registerComponent:a,notebooksUrl:o}=r,s=b.useRef(0),[l,d]=b.useState(new Map),[u,c]=b.useState(new Map),m=ds(),f=b.useCallback(()=>i.getLastUsedPanelOfType(Sa),[i]),g=b.useCallback((j,R)=>{d($=>new Map($.set(j,R)))},[d]),v=b.useCallback(j=>{d(R=>(R.delete(j),new Map(R)))},[d]),p=b.useCallback((j,R)=>{c($=>new Map($.set(j,R)))},[c]),C=b.useCallback(j=>{c(R=>(R.delete(j),new Map(R)))},[c]),S=b.useCallback(function(j){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,G=j&&j.trim();if(!G)Be.info("Ignoring empty code");else{var te=f();if(!te||!(te instanceof Sa.WrappedComponent)){Be.error("Console panel not found");return}Be.debug("Send command: ",j,R,$),te.addCommand(j,R,$)}},[f]),y=b.useCallback(j=>{m(Em(e,j))},[m,e]),w=b.useCallback(j=>{var{language:R}=j,$=R==="python"?"py":R,G=null;return $==null?(Be.debug("No extension for language",R),G="Untitled-".concat(s.current)):G="Untitled-".concat(s.current,".").concat($),s.current+=1,G},[]),E=b.useCallback(function(j){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:$}=j;if($!=null&&l.has($))return l.get($);if($!=null&&u.has($))return u.get($);if(R)return Ue.generate()},[l,u]),D=b.useCallback((j,R)=>{A.renameComponent(n.root,{id:j},R)},[n.root]),M=b.useCallback((j,R)=>{Be.debug("Rename file panel",j,R);var $;if(l.has(j)&&($=l.get(j),v(j),$!=null&&g(R,$)),u.has(j)&&($=u.get(j),C(j),$!=null&&p(R,$)),$===void 0){Be.debug2("File ".concat(j," isn't open, no need to rename the tab"));return}D($,ie.getBaseName(R))},[l,u,D,g,p,v,C]),_=b.useCallback(j=>{var R=E(j,!1);if(R==null){Be.error("Could not find panel id for file metadata",j);return}A.activateTab(n.root,{id:R})},[E,n.root]),T=b.useCallback((j,R,$)=>{if(Be.debug("registerFilePanel",j,R,$),R==null||R.id==null){Be.debug("Ignore empty file id",R);return}var{id:G}=R;if($){p(G,j);return}if(l.has(G)){var te=l.get(G);if(j===te){Be.debug("Update tab title for file ".concat(G));var{itemName:Me}=R;M(G,Me)}else Be.error("File ".concat(G," already associated with a different tab ").concat(te));return}g(G,j),u.has(G)&&C(G)},[l,u,M,g,p,C]),N=b.useCallback((j,R)=>{if(Be.debug("unregisterFileTab",j,R),j==null||j.id==null){Be.debug("Ignore empty file id",j);return}var{id:$}=j;if(R){C($);return}v($)},[v,C]),x=b.useCallback((j,R)=>{Be.debug("closeFilePanel",j);var{id:$}=j,G=null,te=!1;if(l.has($))G=l.get($);else if(u.has($))G=u.get($),te=!0;else{Be.debug("File ".concat($," isn't open, ignore close event"));return}N(j,te),A.closeComponent(n.root,{id:G},R)},[n.root,l,u,N]),F=b.useCallback(j=>{var{itemName:R}=j;return ie.getBaseName(R)},[]),k=b.useCallback(j=>{var{id:R}=j;return Be.debug("fileIsOpen",j,R,l),R!=null&&l.has(R)},[l]),U=b.useCallback(j=>{var{id:R}=j;return Be.debug("fileIsOpenAsPreview",j,R,u),R!=null&&u.has(R)},[u]),H=b.useCallback(j=>{if(j!=null){var R=i.getOpenedPanelById(j);R&&eh(R)&&R.focus()}},[i]),W=b.useCallback(j=>{var{id:R,settings:$,fileMetadata:G,session:te,sessionLanguage:Me,isPreview:V=!1}=j,ne={settings:$,fileMetadata:G},de=F(G);return{type:"react-component",component:Un.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:R},session:te,sessionLanguage:Me,panelState:ne,isPreview:V,notebooksUrl:o},title:de,id:R}},[F,e,o]),X=b.useCallback(function(j,R,$){var G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:w($)},te=E(G);if(k(G)&&te!=null){Be.debug("File is already open, focus panel"),_(G),H(te);return}var Me=A.getStackForComponentTypes(n.root,[Un.COMPONENT]),V=W({id:te,settings:$,fileMetadata:G,session:j,sessionLanguage:R});Be.debug("createNotebook",V,l),A.openComponentInStack(Me,V)},[k,H,w,E,n.root,W,l,_]),le=b.useCallback(function(j,R,$,G){var te=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;Be.debug("selectNotebook",G,te);var Me=k(G),V=U(G),[ne]=[...u.values()],de=!te,Ee=de&&ne?ne:E(G);if(Ee==null||Ee==="")throw new Error("Unable to retrieve or create panelId for metadata",G);if(Me||V)_(G);else{var Le=A.getStackForComponentTypes(n.root,[Un.COMPONENT]),ni=W({id:Ee,settings:$,fileMetadata:G,session:j,sessionLanguage:R,isPreview:de});A.openComponentInStack(Le,ni)}if(V&&te){var wr=G.id,ri=A.getStackForConfig(n.root,{component:Un.COMPONENT,id:Ee}),nr=A.getContentItemInStack(ri,{component:Un.COMPONENT,id:Ee});nr&&Et(nr)&&(nr.container.emit(Se.PROMOTE_FROM_PREVIEW),C(wr),g(wr,Ee))}te&&H(Ee)},[_,k,U,H,E,n.root,W,u,C,g]),me=b.useCallback(function(j,R){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,te=i.getLastUsedPanelOfType(Un);te&&eh(te)?$!=null&&$.value!=null&&te.notebook!=null&&te.notebook.append($.value):G&&X(j,R,$)},[X,i]),ve=b.useCallback((j,R)=>Ty.hydrate(Ju(Ju({},j),{},{notebooksUrl:o}),R),[o]);return si(a,Sa,t),si(a,Dm),si(a,xm),si(a,Am),si(a,Un,ve),Pe(n.eventHub,Dt.SEND_COMMAND,S),Pe(n.eventHub,Dt.SETTINGS_CHANGED,y),Pe(n.eventHub,Se.CLOSE_FILE,x),Pe(n.eventHub,Se.CREATE_NOTEBOOK,X),Pe(n.eventHub,Se.SELECT_NOTEBOOK,le),Pe(n.eventHub,Se.RENAME,D),Pe(n.eventHub,Se.RENAME_FILE,M),Pe(n.eventHub,Se.SEND_TO_NOTEBOOK,me),Pe(n.eventHub,Se.REGISTER_FILE,T),Pe(n.eventHub,Se.UNREGISTER_FILE,N),null}var hi=z.module("FilterPlugin");function th(r,e){return r.concat(e)}function Bm(r){Yr(r);var{id:e,layout:t,registerComponent:n}=r,i=ds(),[a]=b.useState(()=>new Map),[o]=b.useState(()=>new Map),[s]=b.useState(()=>new Map),l=b.useCallback(()=>{var p=Array.from(a.values()).reduce(th,[]).sort((y,w)=>{var E=Lt.toLower(y.name),D=Lt.toLower(w.name);if(E!==D)return E>D?1:-1;var M=Lt.toLower(y.type),_=Lt.toLower(w.type);return M!==_?M>_?1:-1:0}).reduce((y,w)=>((y.length===0||Lt.toLower(y[y.length-1].name)!==Lt.toLower(w.name)||Lt.toLower(y[y.length-1].type)!==Lt.toLower(w.type))&&y.push(w),y),[]),C=Array.from(o.values()).reduce(th,[]).sort((y,w)=>y.timestamp-w.timestamp),S=new Map(s);hi.debug("sendUpdate",{columns:p,filters:C,tableMap:S}),i(Dn(e,{columns:p,filters:C,tableMap:S}))},[i,e,a,o,s]),d=b.useCallback((p,C)=>{hi.debug2("handleColumnsChanged",p,C),a.set(p,[].concat(C)),l()},[a,l]),u=b.useCallback((p,C)=>{hi.debug2("handleFiltersChanged",p,C),o.set(p,[].concat(C)),l()},[o,l]),c=b.useCallback((p,C)=>{hi.debug2("handleTableChanged",p,C),s.set(A.getIdFromPanel(p),C),l()},[s,l]),m=b.useCallback(p=>{hi.debug2("handlePanelUnmount",p),a.delete(p),o.delete(p),s.delete(A.getIdFromPanel(p)),l()},[a,o,s,l]),f=b.useCallback(p=>{var{title:C="DropdownFilter",metadata:S={},panelState:y=null,id:w=Ue.generate(),focusElement:E=A.DEFAULT_FOCUS_SELECTOR,createNewStack:D=!1,dragEvent:M=null}=p,_={type:"react-component",component:Zn.COMPONENT,props:{id:w,metadata:S,panelState:y,localDashboardId:e},title:C,id:w},{root:T}=t;A.openComponent({root:T,config:_,focusElement:E,createNewStack:D,dragEvent:M})},[t,e]),g=b.useCallback(p=>{var{title:C="InputFilter",metadata:S={},panelState:y=null,id:w=Ue.generate(),focusElement:E=A.DEFAULT_FOCUS_SELECTOR,createNewStack:D=!1,dragEvent:M=void 0}=p,_={type:"react-component",component:$r.COMPONENT,props:{id:w,metadata:S,panelState:y,localDashboardId:e},title:C,id:w},{root:T}=t;A.openComponent({root:T,config:_,focusElement:E,createNewStack:D,dragEvent:M})},[t,e]),v=b.useCallback(p=>{var{title:C="FilterSets",metadata:S={},panelState:y=null,id:w=Ue.generate(),focusElement:E=A.DEFAULT_FOCUS_SELECTOR,createNewStack:D=!1,dragEvent:M=null}=p,_={type:"react-component",component:Ea.COMPONENT,props:{id:w,metadata:S,panelState:y,localDashboardId:e},title:C,id:w},{root:T}=t;A.openComponent({root:T,config:_,focusElement:E,createNewStack:D,dragEvent:M})},[t,e]);return b.useEffect(function(){var C=[n(Zn.COMPONENT,Zn),n($r.COMPONENT,$r),n(Ea.COMPONENT,Ea)];return()=>{C.forEach(S=>S())}},[n]),Pe(t.eventHub,Ve.COLUMNS_CHANGED,d),Pe(t.eventHub,Ve.FILTERS_CHANGED,u),Pe(t.eventHub,Ve.TABLE_CHANGED,c),Pe(t.eventHub,Ve.OPEN_DROPDOWN,f),Pe(t.eventHub,Ve.OPEN_INPUT,g),Pe(t.eventHub,Ve.OPEN_FILTER_SET_MANAGER,v),Pe(t.eventHub,se.UNMOUNT,m),null}var FO={name:"FilterPlugin",type:Yn.DASHBOARD_PLUGIN,component:Bm};const RO=FO;var LO=z.module("@deephaven/app-utils/useTablePlugin");function Wm(){var r=Ah(),e=b.useCallback(t=>{var n=r.get(t);if(n!=null){if(gv(n))return n.component;if(bv(n))return n.TablePlugin}var i="Unable to find table plugin ".concat(t,".");throw LO.error(i),new Error(i)},[r]);return e}function nh(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function AO(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){nh(a,n,i,o,s,"next",l)}function s(l){nh(a,n,i,o,s,"throw",l)}o(void 0)})}}function Gm(r,e,t){var n=vr(),i=Wm(),a=b.useMemo(()=>({loadPlugin:i,localDashboardId:e,makeModel:function(){var o=AO(function*(){var l=yield r();return Vs.makeModel(n,l)});function s(){return o.apply(this,arguments)}return s}(),metadata:t}),[n,r,e,i,t]);return a}function rh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ih(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?rh(Object(t),!0).forEach(function(n){kO(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):rh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function kO(r,e,t){return e=jO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jO(r){var e=$O(r,"string");return typeof e=="symbol"?e:String(e)}function $O(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var el=b.forwardRef((r,e)=>{var{localDashboardId:t,fetch:n,metadata:i}=r,a=Gm(n,t,i);return h.jsx(zr,ih(ih({ref:e},r),a))});el.displayName="GridPanelPlugin";const HO=el;function ah(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function VO(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){ah(a,n,i,o,s,"next",l)}function s(l){ah(a,n,i,o,s,"throw",l)}o(void 0)})}}function zm(r){var e=vr(),[t,n]=b.useState(),{fetch:i}=r;return b.useEffect(()=>{var a=!1;function o(){return s.apply(this,arguments)}function s(){return s=VO(function*(){var l=yield i(),d=yield Vs.makeModel(e,l);a||n(d)}),s.apply(this,arguments)}return o(),()=>{a=!0}},[e,i]),t?h.jsx(Ya,{model:t}):null}var UO={name:"IrisGridPanel",title:"Table",type:Yn.WIDGET_PLUGIN,component:zm,panelComponent:el,supportedTypes:["Table","TreeTable","HierarchicalTable","PartitionedTable"],icon:fs};const BO=UO;function oh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function kn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oh(Object(t),!0).forEach(function(n){Km(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):oh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Km(r,e,t){return e=WO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function WO(r){var e=GO(r,"string");return typeof e=="symbol"?e:String(e)}function GO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function qm(r){var e=r;return typeof e.getCoordinateForColumn=="function"}function sh(r){var e=r;return qm(r)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}function lh(r){return r.description==null||!r.description.startsWith("Preview of type: ")}var ci=z.module("LinkerUtils");class vo{static getLinkType(e,t,n){var i;if((e==null?void 0:e.panelId)==null||(t==null?void 0:t.panelId)==null||e.panelId===t.panelId||n!=null&&n!==e.panelId&&n!==t.panelId)return ci.debug2("Incompatible panel ids",e,t,n),"invalid";if(e.panelComponent==null||t.panelComponent==null)return ci.error("PanelComponent should not be null",e,t),"invalid";var a=(i=vo.ALLOWED_LINKS.get(e.panelComponent))===null||i===void 0?void 0:i.includes(t.panelComponent);if(a===void 0||!a)return ci.debug2("Incompatible panel components",e,t),"invalid";var{columnType:o}=e,{columnType:s}=t,l=s===null||P.isCompatibleType(o,s);if(!l)return ci.debug2("Incompatible type",o,s),"invalid";switch(t.panelComponent){case A.getComponentName(qi):return"chartLink";case A.getComponentName(zr):return"tableLink";case A.getComponentName(Zn):return"filterSource"}return ci.debug2("Incompatible target panel component",t.panelComponent),"invalid"}static findColumn(e,t){var{columnName:n,columnType:i}=t;return e.find(a=>{var{name:o,type:s}=a;return o===n&&s===i})}static cloneLinksForPanel(e,t,n){var i=[];return e.forEach(a=>{var o;a.start.panelId===t&&a.type!=="filterSource"?i.push(kn(kn({},a),{},{id:Ue.generate(),start:kn(kn({},a.start),{},{panelId:n})})):((o=a.end)===null||o===void 0?void 0:o.panelId)===t&&i.push(kn(kn({},a),{},{id:Ue.generate(),end:kn(kn({},a.end),{},{panelId:n})}))}),i}}Km(vo,"ALLOWED_LINKS",new Map([[A.getComponentName(zr),[A.getComponentName(zr),A.getComponentName(qi),A.getComponentName(Zn)]]]));const sr=vo;function Xm(r,e,t){return e=zO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zO(r){var e=KO(r,"string");return typeof e=="symbol"?e:String(e)}function KO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var qO=z.module("LinkerLink"),dh=.015,uh=1.5,Zm=12,Ym=12,hh=2,ba=Math.sqrt((Ym*.5)**2+Zm**2),ch=Math.asin(Ym*.5/Zm),mh=15,jn=Math.PI*.5;class Hr extends b.Component{static makeCirclePath(e,t,n){return"M ".concat(e," ").concat(t," m -").concat(n,",0 a ").concat(n,",").concat(n," 0 1,0 ").concat(n*2,",0 a ").concat(n,",").concat(n," 0 1,0 -").concat(n*2,",0 z")}static getLabelForLinkFilter(e,t){try{if(P.isNumberType(e)||P.isCharType(e))return $g(t);if(P.isTextType(e))return jg(t);if(P.isDateType(e))return Hg(t);if(P.isBooleanType(e)){if(t===L.eq)return"is equal to";if(t===L.notEq)return"is not equal to"}throw new Error("Unrecognized column type: ".concat(e))}catch(n){return qO.warn(n),""}}constructor(e){super(e),Xm(this,"getOperators",oe((t,n)=>{var{onOperatorChanged:i}=this.props,a=P.getFilterTypes(n);return P.isBooleanType(n)&&(a=[L.eq,L.notEq]),a.flatMap((o,s)=>{if(o==="eqIgnoreCase"||o==="notEqIgnoreCase")return[];var l="";return o==="startsWith"?l="a*":o==="endsWith"?l="*z":l=P.getFilterOperatorString(o),[{title:Hr.getLabelForLinkFilter(n,o),icon:h.jsx("b",{children:l}),action:()=>i(t,o),order:s}]})})),this.handleClick=this.handleClick.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleDelete=this.handleDelete.bind(this),this.getDropdownActions=this.getDropdownActions.bind(this),this.state={isHovering:void 0}}handleClick(e){e.stopPropagation(),e.preventDefault();var{id:t,onClick:n,onDelete:i}=this.props;e.altKey?i(t):n(t)}handleMouseEnter(){this.setState({isHovering:!0})}handleMouseLeave(){this.setState({isHovering:!1})}handleDelete(){var{id:e,onDelete:t}=this.props;t(e)}getDropdownActions(){var{id:e,startColumnType:t}=this.props;return t!=null?this.getOperators(e,t):[]}render(){var{className:e,operator:t,isSelected:n,x1:i,y1:a,x2:o,y2:s,id:l,startColumnType:d,type:u}=this.props,{isHovering:c}=this.state,m=Math.sqrt((i-o)**2+(a-s)**2),f=Math.atan2(s-a,o-i),g=Math.sin(f),v=Math.cos(f)+2,p=window.innerWidth,C=window.innerHeight,S=0,y=0,w=Math.max(S,Math.min(i+(o-i)/2+g*(m*dh)**uh,p)),E=Math.max(y,Math.min(a+(s-a)/2+v*(m*dh)**uh,C)),D="M ".concat(i," ").concat(a," Q ").concat(w," ").concat(E," ").concat(o," ").concat(s),M="M ".concat(S," ").concat(y," L ").concat(S," ").concat(C," L ").concat(p," ").concat(C," L ").concat(p," ").concat(y,` z
|
|
24
|
+
`).concat(s," does not exist yet.")}if(i){var{widgetName:l}=this.props;return"".concat(l," is unavailable.")}}handleSessionClosed(){var{onSessionClose:e}=this.props;this.setState({isPanelDisconnected:!0,isWaitingForReconnect:!1}),e(...arguments)}handleSessionOpened(){var{onSessionOpen:e}=this.props;e(...arguments)}render(){var{children:e,className:t,componentPanel:n,isLoaded:i,isLoading:a,glContainer:o,glEventHub:s,isDisconnected:l,isClonable:d,isRenamable:u,showTabTooltip:c,renderTabTooltip:m,widgetType:f,widgetName:g,description:v,onClearAllFilters:p,onHide:C,onFocus:S,onBlur:y,onResize:w,onShow:E,onTabBlur:D,onTabFocus:M,onTabClicked:_}=this.props,{isPanelDisconnected:T,isWidgetDisconnected:N,isPanelInactive:x}=this.state,F=this.getErrorMessage(),k=m??this.getCachedRenderTabTooltip(c,o,f,g,v),U=[{title:"Copy ".concat(f," Name"),group:fe.groups.medium,order:20,action:this.handleCopyName}];return h.jsxs(hn,{className:J(t,{disconnected:T||N||l,inactive:x}),componentPanel:n,glContainer:o,glEventHub:s,onClearAllFilters:p,onHide:C,onFocus:S,onBlur:y,onResize:w,onShow:E,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:D,onTabFocus:M,onTabClicked:_,renderTabTooltip:k,errorMessage:F,isLoaded:i,isLoading:a,isClonable:d,isRenamable:u,additionalActions:U,children:[e,x&&h.jsx("div",{className:"fill-parent-absolute"})]})}}gm(bm,"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 Ki=bm,zt=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"});var sT=Object.freeze({}),lT=new Map,to=Object.freeze([]),Ws=(r,e)=>{var t;return(t=st(r,e).columns)!==null&&t!==void 0?t:to},Cm=(r,e)=>{var t;return(t=st(r,e).filterSets)!==null&&t!==void 0?t:to},no=(r,e)=>{var t;return(t=st(r,e).filters)!==null&&t!==void 0?t:to},ro=(r,e)=>{var t;return(t=st(r,e).tableMap)!==null&&t!==void 0?t:lT},io=(r,e)=>st(r,e).isolatedLinkerPanelId,Sr=(r,e)=>{var t;return(t=st(r,e).links)!==null&&t!==void 0?t:to},ao=(r,e)=>st(r,e).columnSelectionValidator,dT=(r,e)=>{var t;return(t=st(r,e).consoleSettings)!==null&&t!==void 0?t:sT},uT=(r,e)=>st(r,e).connection,ti=(r,e)=>st(r,e).sessionWrapper,hT=(r,e)=>t=>t(Dn(r,{connection:e})),cT=(r,e)=>t=>t(Dn(r,{sessionWrapper:e})),oo=(r,e)=>t=>t(Dn(r,{links:e})),ym=(r,e)=>(t,n)=>{var i=Sr(n(),r),a=e.filter(o=>i.findIndex(s=>mr(s.start,o.start)&&mr(s.end,o.end))<0);return t(oo(r,i.concat(a)))},Sm=(r,e)=>(t,n)=>{var i=Sr(n(),r),a=i.filter(o=>!e.includes(o.id));return t(oo(r,a))},Gs=(r,e)=>t=>t(Dn(r,{isolatedLinkerPanelId:e})),wm=(r,e)=>t=>t(Dn(r,{columnSelectionValidator:e})),Em=(r,e)=>t=>t(Dn(r,{consoleSettings:e})),Pm=(r,e)=>t=>t(Dn(r,{filterSets:e}));function Tm(r){var{columnMap:e,inputFilterMap:t,linkedColumnMap:n,onAdd:i,onOpenLinker:a,waitingFilterMap:o,waitingInputMap:s}=r,l=b.useMemo(()=>{var g=Array.from(s.keys()),v=g.find(S=>t.get(S)!=null),p=g.find(S=>n.get(S)!=null),C=Lt.join(g.map(S=>'"'.concat(S,'"')));return v!=null&&v&&p!=null&&p?"Use a filter control or linked table to set a value for ".concat(C):v!=null&&v?"Set a filter control value for ".concat(C):"Double click a row in a linked table to set a value for ".concat(C)},[t,n,s]),d=b.useMemo(()=>Array.from(e.values()),[e]),u=b.useCallback(g=>{g.stopPropagation(),g.preventDefault(),i(Array.from(o.values()))},[i,o]),c=b.useCallback(g=>{g.stopPropagation(),g.preventDefault(),a()},[a]),m=o.size>0,f=!m&&s.size>0;return h.jsx("div",{className:"chart-panel-overlay chart-filter-overlay",children:h.jsxs("div",{className:J("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":m},{"chart-filter-waiting-input":f}),children:[m&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),h.jsx("div",{className:"waiting-filter-list",children:d.map(g=>{var v=o.has(g.name),p=v?vs:Qf;return h.jsxs("div",{className:J("waiting-filter-item",{"is-invalid":v}),children:[h.jsx(ue,{icon:p}),g.name]},g.name)})}),h.jsxs("div",{children:[h.jsx(Tl,{onClick:u,className:"btn-primary",children:"Add Input Filters"}),h.jsx(Tl,{onClick:c,className:"btn-primary",children:"Open Linker Tool"})]})]}),f&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"info-message",children:"Waiting for User Input"}),h.jsx("div",{className:"",children:l})]})]})})}Tm.propTypes={columnMap:O.instanceOf(Map).isRequired,inputFilterMap:O.instanceOf(Map).isRequired,linkedColumnMap:O.instanceOf(Map).isRequired,onAdd:O.func.isRequired,onOpenLinker:O.func.isRequired,waitingFilterMap:O.instanceOf(Map).isRequired,waitingInputMap:O.instanceOf(Map).isRequired};function Ri(r){var{columns:e,onColumnSelected:t,onMouseEnter:n,onMouseLeave:i}=r;return h.jsx("div",{className:"chart-panel-overlay chart-column-selector-overlay",children:h.jsxs("div",{className:J("chart-panel-overlay-content"),children:[h.jsx("div",{className:"info-message",children:"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"}),h.jsx("div",{className:"waiting-column-select-list",children:e.map(a=>h.jsx(tc,{className:J("btn-chart-column-selector",Ri.makeButtonClassName(a.name)),onClick:()=>t(a.name),onMouseEnter:()=>{n&&n(a)},onMouseLeave:i,disabled:!a.isValid,isLinked:a.isActive,children:a.name},a.name))})]})})}Ri.makeButtonClassName=r=>"btn-chart-column-selector-".concat(r);Ri.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};function jr(r){return r.settings!==void 0}function zs(r){return r.figure!==void 0}function _m(r){if(r==null)return!1;var{settings:e,tableSettings:t}=r;return typeof e=="object"&&typeof t=="object"}function Om(r){return r!=null&&_m(r.panelState)}function vu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vu(Object(t),!0).forEach(function(n){Bt(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Bt(r,e,t){return e=mT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mT(r){var e=fT(r,"string");return typeof e=="symbol"?e:String(e)}function fT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var pt=z.module("ChartPanel"),vT=150;function pT(r){return r.inputFilters!=null}function gT(r){return r.panelState!=null}class so extends b.Component{constructor(e){super(e),Bt(this,"panelContainer",void 0),Bt(this,"pending",void 0),Bt(this,"getWaitingInputMap",oe((o,s,l)=>{if(!o)return new Map;var d=new Map(s);return l.forEach((u,c)=>{d.delete(c)}),d})),Bt(this,"getWaitingFilterMap",oe((o,s,l,d,u)=>{if(!o)return new Map;var c=new Map(s);return l.forEach((m,f)=>{c.delete(f)}),u.forEach((m,f)=>{c.delete(f)}),d.forEach((m,f)=>{c.delete(f)}),c})),Bt(this,"getInputFilterColumnMap",oe((o,s)=>{for(var l=new Map,d=0;d<s.length;d+=1){var u=s[d],{name:c,type:m}=u,f=o.get(c);f!=null&&f.type===m&&l.set(c,u)}return l})),Bt(this,"getLinkedColumnMap",oe((o,s)=>{for(var l=new Map,d=A.getIdFromPanel(this),u=0;u<s.length;u+=1){var c=s[u],m=null;if(c.start!=null&&c.start.panelId===d&&o.has(c.start.columnName)?m=c.start.columnName:c.end&&c.end.panelId===d&&o.has(c.end.columnName)&&(m=c.end.columnName),m!=null&&o.has(m)){var f=o.get(m);I(f),l.set(m,f)}}return l})),Bt(this,"getSelectorColumns",oe((o,s,l)=>Array.from(o.values()).map(d=>({name:d.name,type:d.type,isValid:l?l(this,d):!1,isActive:s.has(d.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.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=It(this.updateModelFromSource.bind(this),vT),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=Z.createRef(),this.pending=new Qn;var{metadata:t,panelState:n}=e,{filterValueMap:i=[],settings:a={}}=n??{};this.state={settings:a,error:void 0,isActive:!1,isDisconnected:!1,isLoading:!1,isLoaded:!1,isLinked:t!=null&&jr(t)&&t.settings.isLinked,filterMap:new Map(i),filterValueMap:new Map(i),model:void 0,columnMap:new Map,panelState:n}}componentDidMount(){this.isHidden()||(this.setState({isActive:!0}),this.initModel())}componentDidUpdate(e,t){var{inputFilters:n,source:i,makeModel:a}=this.props,{columnMap:o,model:s,filterMap:l,filterValueMap:d,isLinked:u,settings:c}=this.state;s&&(a!==e.makeModel&&this.initModel(),o!==t.columnMap&&this.pruneFilterMaps(),n!==e.inputFilters&&this.updateChangedInputFilters(n,e.inputFilters),l!==t.filterMap?this.updateFilters():d!==t.filterValueMap&&this.updatePanelState(),c!==t.settings&&ed(s)&&(s.updateSettings(c),this.updatePanelState()),u!==t.isLinked?i&&(u?(this.startListeningToSource(i),this.updateModelFromSource()):this.stopListeningToSource(i)):u&&i!==e.source&&(e.source&&this.stopListeningToSource(e.source),i&&(this.startListeningToSource(i),this.updateModelFromSource())))}componentWillUnmount(){this.pending.cancel();var{model:e}=this.state,{source:t}=this.props;e!=null&&t&&this.stopListeningToSource(t)}initModel(){this.setState({isLoading:!0,isLoaded:!1,error:void 0});var{makeModel:e}=this.props;this.pending.add(e(),t=>{t.close()}).then(this.handleLoadSuccess,this.handleLoadError)}startListeningToSource(e){pt.debug("startListeningToSource",e);var{model:t}=this.state;I(t);var{dh:n}=t;e.addEventListener(n.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.addEventListener(n.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(n.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}stopListeningToSource(e){pt.debug("stopListeningToSource",e);var{model:t}=this.state;I(t);var{dh:n}=t;e.removeEventListener(n.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.removeEventListener(n.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(n.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}loadModelIfNecessary(){var{isActive:e,isLoaded:t,isLoading:n}=this.state;e&&!t&&!n&&this.initModel()}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}handleColumnSelected(e){var{glEventHub:t}=this.props,{columnMap:n}=this.state;t.emit(Aa.COLUMN_SELECTED,this,n.get(e))}handleColumnMouseEnter(e){var{type:t,name:n}=e,{columnSelectionValidator:i}=this.props;pt.debug("handleColumnMouseEnter",i,t,n),i&&i(this,{type:t,name:n})}handleColumnMouseLeave(){var{columnSelectionValidator:e}=this.props;pt.debug("handleColumnMouseLeave",e),e&&e(this,void 0)}handleDisconnect(){this.setState({error:new Error("Figure disconnected"),isDisconnected:!0})}handleFilterAdd(e){for(var t=0;t<e.length;t+=1)this.openInputFilter(e[t])}handleOpenLinker(){var{localDashboardId:e,setActiveTool:t,setDashboardIsolatedLinkerPanelId:n}=this.props;n(e,void 0),t(zt.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:void 0}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){pt.debug("handleLoadSuccess");var{model:t}=this.state;this.setState({model:e,isLoaded:!0},()=>{var{inputFilters:n,source:i}=this.props,{filterMap:a,isLinked:o}=this.state;e!==t&&(this.sendColumnChange(),this.updateColumnFilters(),this.updateInputFilters(n,a.size>0||e.isFilterRequired()),i&&o&&(this.startListeningToSource(i),this.updateModelFromSource()))})}handleLoadError(e){we.isCanceled(e)||(pt.error("handleLoadError",e),this.setState({error:e,isLoading:!1}))}handleSourceColumnChange(){this.updateModelFromSource()}handleSourceFilterChange(){this.updateModelFromSource()}handleSourceSortChange(){this.updateModelFromSource()}updateModelFromSource(){var{metadata:e,source:t}=this.props,{isLinked:n,model:i}=this.state;if(!n||!i||!t){pt.debug2("updateModelFromSource ignoring",n,i,t);return}var{dh:a}=i;if(this.pending.cancel(),jr(e)){var{settings:o}=e;this.pending.add(a.plot.Figure.create(new ut(a).makeFigureSettings(o,t))).then(s=>{ed(i)&&i.setFigure(s)}).catch(this.handleLoadError)}this.updatePanelState()}updatePanelState(){var{sourcePanel:e}=this.props,{panelState:t,filterValueMap:n,settings:i}=this.state,{tableSettings:a}=t??{};if(e&&pT(e.props)&&gT(e.state)){var{inputFilters:o}=e.props,{panelState:s}=e.state;s!=null&&(a=Ne.extractTableSettings(s,o))}this.setState({panelState:{settings:i,tableSettings:a,filterValueMap:Array.from(n)}})}handleError(){this.setState({isLoading:!1})}handleSettingsChanged(e){this.setState(t=>{var{settings:n}=t,i=pu(pu({},n),e);return pt.debug("Updated settings",i),{settings:i}})}handleHide(){this.setActive(!1)}handleShow(){this.setActive(!0)}handleTabBlur(){this.setActive(!1)}handleTabFocus(){var e=this.isHidden();this.setActive(!e)}handleUpdate(e){var{isLoading:t}=e;this.setState({isLoading:t})}handleClearAllFilters(){this.setState({filterValueMap:new Map,filterMap:new Map}),this.updatePanelState()}openInputFilter(e){var{glEventHub:t}=this.props,{name:n,type:i}=e;t.emit(Ve.OPEN_INPUT,{title:"".concat(n," Filter"),panelState:{name:n,type:i,isValueShown:!0},createNewStack:!0,focusElement:"input"})}setActive(e){this.setState({isActive:e},()=>{e&&this.loadModelIfNecessary()})}sendColumnChange(){var{model:e}=this.state;if(e){var{glEventHub:t}=this.props;t.emit(Ve.COLUMNS_CHANGED,this,Array.from(e.getFilterColumnMap().values()))}}getCoordinateForColumn(e){var t,n=Ri.makeButtonClassName(e);if(!this.panelContainer.current)return null;var i=this.panelContainer.current.querySelector(".".concat(n)),a=(t=i==null?void 0:i.getBoundingClientRect())!==null&&t!==void 0?t:null;if(a==null||a.width<=0||a.height<=0)return null;var o=a.left+a.width/2,s=a.bottom;return[o,s]}setFilterMap(e){pt.debug("setFilterMap",e),this.setState(t=>{var n,{columnMap:i,filterMap:a}=t,o=null,s=new Map(t.filterValueMap);return e.forEach((l,d)=>{var{columnType:u,filterList:c}=l,m=i.get(d);if(!(m==null||m.type!==u)){if(c.length<1){pt.debug("Ignoring empty filterList for column",d);return}var{value:f}=c[0];s.set(d,f),a.get(d)!==f&&(o===null&&(o=new Map(a)),o.set(d,f))}}),{filterValueMap:s,filterMap:(n=o)!==null&&n!==void 0?n:a}})}unsetFilterValue(e){this.setState(t=>{var{inputFilters:n}=this.props,{columnMap:i}=t,{filterMap:a,filterValueMap:o}=t;if(!o.has(e))return null;o=new Map(t.filterValueMap),o.delete(e);var s=this.getInputFilterColumnMap(i,n);if(s.has(e)){var l,d=a.get(e),u=(l=s.get(e))===null||l===void 0?void 0:l.value;u!=null&&d!==u&&(a=new Map(t.filterMap),u.length>0?a.set(e,u):a.delete(e))}else a=new Map(t.filterMap),a.delete(e);return{filterMap:a,filterValueMap:o}})}updateChangedInputFilters(e,t){var n=t.filter(a=>e.find(o=>o.name===a.name&&o.type===a.type)===void 0);n.length>0&&this.deleteInputFilters(n);var i=e.filter(a=>!t.includes(a));i.length>0&&this.updateInputFilters(i)}updateInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState(n=>{for(var{columnMap:i}=n,a=new Map(n.filterValueMap),o=new Map(n.filterMap),s=t?{filterMap:o,filterValueMap:a}:{},l=0;l<e.length;l+=1){var{name:d,type:u,value:c}=e[l],m=i.get(d);m!=null&&m.type===u&&(c!=null&&o.get(d)!==c&&(c===""?o.delete(d):o.set(d,c),s.filterMap=o),a.has(d)&&(a.delete(d),s.filterValueMap=a))}return pt.debug("updateInputFilters",s),s})}deleteInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState(n=>{for(var{columnMap:i,filterValueMap:a}=n,o=new Map(n.filterMap),s=t,l=0;l<e.length;l+=1){var{name:d,type:u}=e[l],c=i.get(d);if(c!=null&&c.type===u&&o.has(d)){var m=o.get(d);if(a.has(d)){var f=a.get(d);f!==m&&f!=null&&(s=!0,o.set(d,f))}else s=!0,o.delete(d)}}return pt.debug("deleteInputFilters",s),s?{filterMap:o}:null})}updateColumnFilters(){this.setState(e=>{var{model:t}=e;return t?{columnMap:t.getFilterColumnMap()}:null})}updateFilters(){var{columnMap:e,filterMap:t,model:n}=this.state;I(n);var i=this.getWaitingInputMap(n.isFilterRequired(),e,t);if(n.setFilter(t),t.size>0&&i.size===0){var a=n.getDefaultTitle(),o=Lt.join(Array.from(t.entries()).map(s=>{var[l,d]=s;return"".concat(l,": ").concat(d)}));a?n.setTitle("".concat(a,'<br><span style="font-size: smaller">').concat(o,"</span>")):n.setTitle(o),pt.debug2("updateFilters filters set",t),this.setState({isLoading:!0})}else pt.debug2("updateFilters waiting on inputs",i),n.setTitle(n.getDefaultTitle()),this.setState({isLoading:!1});this.updatePanelState()}pruneFilterMaps(){this.setState(e=>{var{columnMap:t}=e,n=new Map(e.filterMap),i=new Map(e.filterValueMap),a={};return e.filterValueMap.forEach((o,s)=>{t.has(s)||(i.delete(s),a.filterValueMap=i)}),e.filterMap.forEach((o,s)=>{t.has(s)||(n.delete(s),a.filterMap=n)}),a})}render(){var e,{columnSelectionValidator:t,glContainer:n,glEventHub:i,inputFilters:a,isLinkerActive:o,links:s,metadata:l,settings:d,Plotly:u,containerRef:c}=this.props,{columnMap:m,filterMap:f,error:g,model:v,isActive:p,isDisconnected:C,isLoaded:S,isLoading:y}=this.state,w;jr(l)?w=l.table:zs(l)?w=l.figure:w=l.name;var E=this.getInputFilterColumnMap(m,a),D=this.getLinkedColumnMap(m,s),M=v!=null?this.getWaitingInputMap(v.isFilterRequired(),m,f):new Map,_=v!=null?this.getWaitingFilterMap(v.isFilterRequired(),m,f,D,E):new Map,T=g!=null?"Unable to open chart. ".concat(g):void 0,N=M.size>0,x=m.size>0&&o;return h.jsx(Ki,{className:J("iris-chart-panel",{"input-required":N}),componentPanel:this,glContainer:n,glEventHub:i,onHide:this.handleHide,onClearAllFilters:this.handleClearAllFilters,onShow:this.handleShow,onTabBlur:this.handleTabBlur,onTabFocus:this.handleTabFocus,errorMessage:T,isDisconnected:C,isLoading:y,isLoaded:S,widgetName:(e=w)!==null&&e!==void 0?e:void 0,widgetType:"Chart",children:h.jsxs("div",{ref:this.panelContainer,className:"chart-panel-container h-100 w-100",children:[h.jsx("div",{className:"chart-container h-100 w-100",children:S&&v&&h.jsx(oc,{isActive:p,model:v,settings:d,onDisconnect:this.handleDisconnect,onReconnect:this.handleReconnect,onUpdate:this.handleUpdate,onError:this.handleError,onSettingsChanged:this.handleSettingsChanged,Plotly:u,containerRef:c})}),h.jsx(Pa,{in:N&&!x&&!y,timeout:_a.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h.jsx(Tm,{inputFilterMap:E,linkedColumnMap:D,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:m,waitingFilterMap:_,waitingInputMap:M})}),h.jsx(Pa,{in:x,timeout:_a.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,children:h.jsx(Ri,{columns:this.getSelectorColumns(m,D,t),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave})})]})})}}Bt(so,"defaultProps",{columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{},containerRef:null});Bt(so,"displayName","ChartPanel");Bt(so,"COMPONENT","ChartPanel");var bT=(r,e)=>{var{localDashboardId:t,metadata:n}=e,i;n!=null&&jr(n)&&(i=n.sourcePanelId);var a=ro(r,t),o=$c(r,t),s=$s(r),l=io(r,t),d=s===zt.LINKER&&l===void 0;return{columnSelectionValidator:ao(r,t),isLinkerActive:d,inputFilters:no(r,t),links:Sr(r,t),source:i!=null?a.get(i):void 0,sourcePanel:i!=null?o.get(i):void 0,settings:Ui(r)}},CT=Ht(bT,{setActiveTool:Rc,setDashboardIsolatedLinkerPanelId:Gs},null,{forwardRef:!0})(so);const qi=CT;function ka(r,e,t){return e=yT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function yT(r){var e=ST(r,"string");return typeof e=="symbol"?e:String(e)}function ST(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ua=z.module("CommandHistoryPanel");class Xi extends b.Component{static handleError(e){ua.error(e)}constructor(e){super(e),ka(this,"container",void 0),ka(this,"pending",void 0),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=Z.createRef(),this.pending=new Qn;var{session:t,sessionId:n,language:i}=e;this.state={panelState:{},session:t,sessionId:n,language:i,contextActions:[{action:this.handleFocusHistory,shortcut:mt.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){var{glEventHub:e,session:t}=this.props;e.on(Dt.FOCUS_HISTORY,this.handleFocusHistory),t!=null&&this.loadTable()}componentWillUnmount(){var{glEventHub:e}=this.props;e.off(Dt.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleShow(){var e;(e=this.container.current)===null||e===void 0||e.restoreScrollPosition()}handleSessionOpened(e,t){var{language:n,sessionId:i}=t;this.setState({session:e,sessionId:i,language:n},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:void 0,language:void 0,table:void 0})}handleSendToNotebook(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{session:n,language:i}=this.state;if(ua.debug("handleSendToNotebook",n,e),!n){ua.error("Session is not connected.");return}var{glEventHub:a}=this.props;a.emit(t?Se.CREATE_NOTEBOOK:Se.SEND_TO_NOTEBOOK,n,i,e)}handleSendToConsole(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;ua.debug("handleSendToConsole",e);var{glEventHub:i}=this.props;i.emit(Dt.SEND_COMMAND,e,t,n)}loadTable(){var{commandHistoryStorage:e}=this.props,{language:t,sessionId:n}=this.state;I(t),I(n),this.pending.add(e.getTable(t,n,Date.now()),i=>i.close()).then(i=>{this.setState({table:i})}).catch(Xi.handleError)}render(){var{glContainer:e,glEventHub:t,commandHistoryStorage:n}=this.props,{language:i,contextActions:a,table:o}=this.state;return h.jsxs(hn,{className:"command-history-pane",componentPanel:this,glContainer:e,glEventHub:t,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[!o&&h.jsx("div",{className:"command-history-disconnected-message",children:"Waiting for console connection"}),o&&i!=null&&h.jsxs(h.Fragment,{children:[h.jsx(V0,{ref:this.container,language:i,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:o,commandHistoryStorage:n}),h.jsx(fe,{actions:a})]})]})}}ka(Xi,"COMPONENT","CommandHistoryPanel");ka(Xi,"TITLE","Command History");var wT=(r,e)=>{var t=Mc(r),n=ti(r,e.localDashboardId),{session:i,config:a}=n??{},{type:o,id:s}=a??{};return{commandHistoryStorage:t,language:o,session:i,sessionId:s}},ET=Ht(wT,null,null,{forwardRef:!0})(Xi);const Dm=ET;function gu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ha(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gu(Object(t),!0).forEach(function(n){hr(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):gu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hr(r,e,t){return e=PT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function PT(r){var e=TT(r,"string");return typeof e=="symbol"?e:String(e)}function TT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ca=z.module("ConsolePanel"),_T=500,OT=Object.freeze({consoleSettings:{},itemIds:[]});class lo extends b.PureComponent{constructor(e){super(e),hr(this,"consoleRef",void 0),hr(this,"objectSubscriptionCleanup",void 0),hr(this,"savePanelState",It(()=>{var{consoleSettings:o,itemIds:s}=this.state,l={consoleSettings:o,itemIds:[...s]};ca.debug("Saving panel state",l),this.setState({panelState:l})},_T)),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.handlePanelMount=this.handlePanelMount.bind(this),this.supportsType=this.supportsType.bind(this),this.iconForType=this.iconForType.bind(this),this.consoleRef=Z.createRef();var{panelState:t}=e,n=ha(ha({},OT),t||{}),{consoleSettings:i,itemIds:a}=n;this.state={consoleSettings:i,itemIds:new Map(a),objectMap:new Map,error:void 0,panelState:n}}componentDidMount(){var{glEventHub:e}=this.props;this.closeDisconnectedPanels(),e.on(se.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(e,t){var{consoleSettings:n,itemIds:i}=this.state;(t.consoleSettings!==n||t.itemIds!==i)&&this.savePanelState()}componentWillUnmount(){var e,{glEventHub:t}=this.props;this.savePanelState.flush(),t.off(se.MOUNT,this.handlePanelMount),(e=this.objectSubscriptionCleanup)===null||e===void 0||e.call(this)}subscribeToFieldUpdates(){var{sessionWrapper:e}=this.props;if(e!=null){var{session:t}=e;this.objectSubscriptionCleanup=t.subscribeToFieldUpdates(n=>{ca.debug("Got updates",n),this.setState(i=>{var{objectMap:a}=i,{updated:o,created:s,removed:l}=n,d=[...o,...l],u=new Map(a);d.forEach(m=>{var{title:f}=m;f!==void 0&&u.delete(f)});var c=[...o,...s];return c.forEach(m=>{m.title!==void 0&&u.set(m.title,m)}),{objectMap:u}})})}}setItemId(e,t){this.setState(n=>{var{itemIds:i}=n,a=new Map(i);return a.set(e,t),{itemIds:a}})}getItemId(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{itemIds:n}=this.state,i=n.get(e);return i==null&&t&&(i=Ue.generate(),this.setItemId(e,i)),i}handleTabFocus(){var e;(e=this.consoleRef.current)===null||e===void 0||e.focus()}handlePanelMount(e){var t,n,i,{itemIds:a}=this.state,o=e==null||(t=e.props)===null||t===void 0?void 0:t.id,s=e==null||(n=e.props)===null||n===void 0||(i=n.metadata)===null||i===void 0?void 0:i.sourcePanelId;if(o&&s){var l=new Set(a.values());l.has(s)&&this.setItemId(o,o)}}handleFocusCommandHistory(){var{glEventHub:e}=this.props;e.emit(Dt.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{root:n}=this.context,i=e.title!=null?this.getItemId(e.title,!1):null;(t||i!=null&&A.getStackForRoot(n,{id:i},!1,!1,!1)!=null)&&this.openWidget(e)}handleCloseObject(e){var{title:t}=e;if(t!==void 0){var n=this.getItemId(t,!1);if(n!=null){var{glEventHub:i}=this.props;i.emit(se.CLOSE,n)}}}handleSettingsChange(e){var{glEventHub:t}=this.props;ca.debug("handleSettingsChange",e),this.setState({consoleSettings:e}),t.emit(Dt.SETTINGS_CHANGED,e)}openWidget(e){var{glEventHub:t,sessionWrapper:n}=this.props;I(n);var{config:i,session:a}=n,{title:o}=e;I(o);var s=this.getItemId(o),l={fetch:()=>a.getObject(e),panelId:s,widget:ha(ha({},cg(e)),{},{sessionId:i.id})};ca.debug("openWidget",l),t.emit(se.OPEN,l)}addCommand(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;(t=this.consoleRef.current)===null||t===void 0||t.addCommand(e,n,i)}closeDisconnectedPanels(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,{consoleSettings:t,itemIds:n}=this.state,{isClosePanelsOnDisconnectEnabled:i=!0}=t;if(!(!i&&!e)){var a=[...n.values()],{glEventHub:o}=this.props;a.forEach(s=>{o.emit(se.CLOSE,s)}),this.setState({itemIds:new Map})}}updateDimensions(){var e;(e=this.consoleRef.current)===null||e===void 0||e.updateDimensions()}supportsType(e){var{plugins:t}=this.props;return[...t.values()].some(n=>hl(n,e))}iconForType(e){var{plugins:t}=this.props,n=[...t.values()].find(i=>hl(i,e));return n!=null?vv(n):h.jsx(Rw,{type:e})}render(){var{commandHistoryStorage:e,glContainer:t,glEventHub:n,sessionWrapper:i,timeZone:a,unzip:o}=this.props;if(i==null)return h.jsx(dn,{isLoading:!1,errorMessage:"Console is disabled."});var{consoleSettings:s,error:l,objectMap:d}=this.state,{config:u,session:c,connection:m,details:f={},dh:g}=i,{workerName:v,processInfoId:p}=f,{id:C,type:S}=u;return h.jsx(hn,{className:"iris-panel-console",componentPanel:this,glContainer:t,glEventHub:n,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,errorMessage:l!=null?"".concat(l):void 0,children:c!=null&&h.jsx(y0,{dh:g,ref:this.consoleRef,settings:s,session:c,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:e,onSettingsChange:this.handleSettingsChange,language:S,statusBarChildren:h.jsxs(h.Fragment,{children:[h.jsx("div",{children:qc.LANGUAGE_MAP.get(S)}),v!=null&&h.jsxs(h.Fragment,{children:[h.jsx("div",{children:"•"}),v]}),p!=null&&h.jsxs(h.Fragment,{children:[h.jsx("div",{children:"•"}),p,h.jsx("div",{children:"•"})]}),h.jsx(X0,{connection:m,defaultUpdateInterval:10*1e3,hoverUpdateInterval:3*1e3,monitorDuration:10*60*1e3})]}),scope:C,timeZone:a,objectMap:d,unzip:o,supportsType:this.supportsType,iconForType:this.iconForType})})}}hr(lo,"COMPONENT","ConsolePanel");hr(lo,"TITLE","Console");hr(lo,"contextType",_y);var DT=(r,e)=>({commandHistoryStorage:Mc(r),sessionWrapper:ti(r,e.localDashboardId),timeZone:js(r),plugins:jy(r)}),MT=Ht(DT,null,null,{forwardRef:!0})(lo);const Sa=MT;function Wt(r,e,t){return e=IT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function IT(r){var e=NT(r,"string");return typeof e=="symbol"?e:String(e)}function NT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ma=z.module("DropdownFilter"),xT=150;class _n extends b.Component{constructor(e){super(e),Wt(this,"dropdownRef",void 0),Wt(this,"getCompatibleColumns",oe((a,o)=>a!=null?o.filter(s=>{var{type:l}=s;return l!==void 0&&P.isCompatibleType(l,a.columnType)}):[])),Wt(this,"getColumnOptions",oe((a,o)=>{var s=-1,l=[];return l.push(h.jsx("option",{value:"-1",children:"Select a column"},"placeholder")),a.forEach((d,u)=>{l.push(h.jsx("option",{value:u,children:this.getItemLabel(a,u)},"".concat(d.name,"/").concat(d.type))),o!==null&&d.name===o.name&&d.type===o.type&&(s=u)}),[l,s]})),Wt(this,"getSelectedOptionIndex",oe((a,o)=>a.indexOf(o))),Wt(this,"getValueOptions",oe(a=>[h.jsx("option",{value:"-1",children:_n.PLACEHOLDER},"-1"),...a.map((o,s)=>h.jsx("option",{value:s,children:o??"(null)"},"".concat(s,"/").concat(o)))])),Wt(this,"getItemLabel",qe((a,o)=>{var{name:s,type:l}=a[o];if(o>0&&a[o-1].name===s||o<a.length-1&&a[o+1].name===s){var d=l.substring(l.lastIndexOf(".")+1);return"".concat(s," (").concat(d,")")}return s})),Wt(this,"sendUpdate",It(()=>{var{onChange:a}=this.props,{column:o,value:s,isValueShown:l}=this.state;a({column:o,isValueShown:l,value:s??void 0})},xT)),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.dropdownRef=Z.createRef();var{column:t,isValueShown:n,value:i}=e;this.state={column:t,id:Ue(),selectedColumn:t,disableCancel:!n,isValueShown:n,value:i}}componentDidUpdate(e,t){var{source:n,values:i,isLoaded:a}=this.props,{column:o,value:s,isValueShown:l}=this.state;a&&(n!==e.source&&this.sourceUpdated(),i!==e.values&&s!==""&&!i.includes(s)&&this.resetValue(),l!==t.isValueShown&&l&&this.focusInput(),(o!==t.column||s!==t.value||l!==t.isValueShown)&&this.sendUpdate())}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){var t=e;if(ma.debug2("handleColumnChange",t),t!=null&&parseInt(t,10)<0){this.setState({selectedColumn:null});return}var{columns:n,source:i}=this.props,a=this.getCompatibleColumns(i,n);this.setState({selectedColumn:a[parseInt(t,10)]})}handleDropdownKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),ma.debug2("handleDropdownKeyPress"),this.sendUpdate(),this.sendUpdate.flush())}handleValueChange(e){var t=e,n=parseInt(t,10),i="",{values:a}=this.props;n>=0&&n<a.length?i=a[n]:ma.debug2("Selected default item"),ma.debug2("handleValueChange",i),this.setState({value:i})}handleSettingsCancel(){this.setState(e=>{var{column:t}=e;return{selectedColumn:t,isValueShown:!0}})}handleSettingsSave(){this.setState(e=>{var{column:t,selectedColumn:n,value:i}=e;return{column:n,value:t===n?i:"",isValueShown:!0,disableCancel:!1}})}handleSettingsClick(e){e.stopPropagation(),this.showSettings()}handleBackgroundClick(e){e.target!==this.dropdownRef.current&&this.focusInput()}sourceUpdated(){this.setState({column:null,selectedColumn:null,isValueShown:!1,disableCancel:!0,value:""})}showSettings(){var{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!1})}focusInput(){var e;(e=this.dropdownRef.current)===null||e===void 0||e.focus()}resetValue(){this.setState({value:""})}clearFilter(){this.resetValue()}setFilterState(e){var{name:t,type:n,value:i,isValueShown:a}=e,o=t!=null&&n!=null?{name:t,type:n}:null;this.setState(s=>{var{value:l,isValueShown:d}=s;return{column:o,value:i??l,isValueShown:a??d}})}render(){var e,{columns:t,disableLinking:n,isLinkerActive:i,isLoaded:a,source:o,onColumnSelected:s,onSourceMouseEnter:l,onSourceMouseLeave:d,values:u,settingsError:c}=this.props,{column:m,disableCancel:f,id:g,isValueShown:v,selectedColumn:p,value:C}=this.state,S=o===null,y=this.getCompatibleColumns(o,t),w=o!=null,E=(e=o==null?void 0:o.columnName)!==null&&e!==void 0?e:_n.SOURCE_BUTTON_PLACEHOLDER,D=m!=null?"".concat(m.name," Filter"):null,[M,_]=this.getColumnOptions(y,p),T=this.getValueOptions(u),N=this.getSelectedOptionIndex(u,C),x=!w||p==null,F=v&&!i,k="source-column-btn-".concat(g),U="filter-column-select-".concat(g);return h.jsxs(ws,{className:"dropdown-filter fill-parent-absolute",isFlipped:F,children:[h.jsx("div",{className:"dropdown-filter-settings-card",children:h.jsxs("div",{className:"dropdown-filter-card-content",children:[h.jsxs("div",{className:"dropdown-filter-settings-grid",children:[h.jsx("label",{htmlFor:k,children:"Source Column"}),h.jsx(tc,{id:k,isLinked:w,onClick:s,onMouseEnter:l,onMouseLeave:d,className:_n.SOURCE_BUTTON_CLASS_NAME,disabled:n,children:E}),h.jsx("div",{className:"text-muted small",children:"Select a source column for the list by linking to a table."}),h.jsx("label",{htmlFor:U,children:"Filter Column"}),h.jsx(Vr,{id:U,value:String(_),className:"custom-select",onChange:this.handleColumnChange,disabled:S,children:M}),h.jsx("div",{className:"text-muted small",children:"Dropdown filter control will apply its filter to all columns matching this name in this dashboard."})]}),c&&h.jsx("div",{className:"error-message text-center",children:c}),w&&h.jsxs("div",{className:"dropdown-filter-settings-buttons",children:[h.jsx(Y,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:f||v||i,tooltip:i?"Cancel disabled while linker open":void 0,children:"Cancel"}),h.jsx(Y,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:x||v||i,tooltip:i?"Save disabled while linker open":void 0,children:"Save"})]})]})}),h.jsx("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick,"data-testid":"dropdown-filter-value-background",children:a&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"dropdown-filter-column",children:h.jsx("div",{className:"dropdown-filter-column-title",children:D})}),h.jsxs("div",{className:"dropdown-filter-card-content",children:[h.jsx("div",{className:"dropdown-filter-value-input d-flex flex-column justify-content-center",children:h.jsx(Vr,{className:"custom-select",value:String(N),ref:this.dropdownRef,onChange:this.handleValueChange,onKeyDown:this.handleDropdownKeyPress,title:"Select Value",children:T})}),c&&h.jsx("div",{className:"error-message mt-3 text-center",children:c})]}),h.jsx("div",{className:"dropdown-filter-menu",children:h.jsx(Y,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h.jsx(ue,{icon:Va,transform:"grow-4"}),tooltip:"Dropdown Filter Settings"})})]})})]})}}Wt(_n,"defaultProps",{column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}});Wt(_n,"PLACEHOLDER","Select a value...");Wt(_n,"SOURCE_BUTTON_CLASS_NAME","btn-dropdown-filter-selector");Wt(_n,"SOURCE_BUTTON_PLACEHOLDER","Select a column");const bu=_n;function ht(r,e,t){return e=FT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function FT(r){var e=RT(r,"string");return typeof e=="symbol"?e:String(e)}function RT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Fe=z.module("DropdownFilterPanel"),LT=250,AT=(r,e)=>{var{localDashboardId:t}=e,n=A.getIdFromPanel({props:e}),i=ro(r,t),a=Sr(r,t),o=$s(r),s=io(r,t),l=o===zt.LINKER&&(s===void 0||s===n),d=o===zt.LINKER&&s!==void 0&&s!==n;return{columns:Ws(r,t),columnSelectionValidator:ao(r,t),dh:Oc(r),isLinkerActive:l,disableLinking:d,settings:Ui(r),panelTableMap:i,dashboardLinks:a}},kT=Ht(AT,null,null,{forwardRef:!0});class qt extends b.Component{constructor(e){super(e),ht(this,"dateTimeFormatter",void 0),ht(this,"dropdownFilterRef",void 0),ht(this,"panelContainer",void 0),ht(this,"pending",void 0),ht(this,"cleanup",void 0),ht(this,"columnFormats",void 0),ht(this,"getCachedValues",qe((c,m,f)=>{var{type:g,name:v}=m;return g!==void 0&&P.isDateType(g)?c.map(p=>this.dateTimeFormatter.format(p)):c.map(p=>p!=null&&g!=null?f.getFormattedString(p,g,v):null)})),ht(this,"getCachedPanelLinks",qe((c,m)=>{var f=A.getIdFromPanel(m);return Fe.debug("getCachedPanelLinks",c,f),c.filter(g=>{var v;return((v=g.end)===null||v===void 0?void 0:v.panelId)===f})})),ht(this,"getCachedSource",qe(c=>{Fe.debug("getCachedSource",c);var m;if(c.length>0){var[f]=c;m=f.start,c.length>1&&Fe.error("Filter has more that one link",c)}return m})),ht(this,"getCachedSourceTable",qe((c,m)=>{var f;if(Fe.debug("getCachedSourceTable",c,m),m==null)return null;var{panelId:g}=m;return(f=c.get(g))!==null&&f!==void 0?f:null})),ht(this,"getCachedSourceColumn",qe((c,m)=>{var f;return Fe.debug("getCachedSourceColumn",c,m),c==null||m==null?null:(f=c.columns.find(g=>{var{name:v,type:p}=g;return v===m.columnName&&p===m.columnType}))!==null&&f!==void 0?f:null})),this.handleChange=It(this.handleChange.bind(this),LT),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=Z.createRef(),this.panelContainer=Z.createRef(),this.pending=new Qn;var{dh:t,panelState:n,settings:i}=e;this.columnFormats=$o.getColumnFormats(i),this.dateTimeFormatter=new kt(t,{showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"});var{value:a="",isValueShown:o=!1,name:s,type:l,timestamp:d}=n??{},u=s!=null&&l!=null?{name:s,type:l}:void 0;this.state={column:u,formatter:new Zt(t,this.columnFormats),valuesTable:void 0,valuesColumn:void 0,sourceSize:0,value:a,timestamp:d,values:[],isValueShown:o,wasFlipped:!1,skipUpdate:!1,panelState:n,isDisconnected:!1,isLoading:!1,isLoaded:!1,error:null}}componentDidMount(){this.updateValuesTable();var{dashboardLinks:e,panelTableMap:t}=this.props,{column:n,value:i,timestamp:a}=this.state,o=this.getSourceTable(t,e);if(o!==null&&this.startListeningToSource(o),n!=null){var{name:s,type:l}=n;this.sendUpdate(s,l,i,a)}}componentDidUpdate(e,t){var{dashboardLinks:n,panelTableMap:i,settings:a}=this.props,{valuesTable:o}=this.state,s=this.getSource(n),l=this.getSourceTable(i,n),d=this.getSource(e.dashboardLinks),u=this.getSourceTable(e.panelTableMap,e.dashboardLinks);a!==e.settings&&a!==void 0&&this.updateFormatterSettings(a),o!==t.valuesTable&&t.valuesTable!=null&&(Fe.debug("Table in state modified, closing the old table."),t.valuesTable.close()),(l!==u||s!==d)&&this.updateValuesTable(),l!==u&&(u!==null&&this.stopListeningToSource(u),l!==null&&this.startListeningToSource(l))}componentWillUnmount(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);this.pending.cancel(),i!==null&&this.stopListeningToSource(i),this.cleanup&&this.cleanup(),n!=null&&n.close()}getCoordinateForColumn(){var e;if(this.panelContainer.current==null)return null;var t=this.panelContainer.current.querySelector(".".concat(bu.SOURCE_BUTTON_CLASS_NAME)),n=(e=t==null?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null;if(n==null||n.width<=0||n.height<=0)return null;var i=n.left+n.width/2,a=n.bottom;return[i,a]}getSettingsErrorMessage(){var{sourceSize:e}=this.state;if(e>qt.MAX_TABLE_SIZE)return"Table too large, must have fewer than ".concat(qt.MAX_TABLE_SIZE," options.")}getPanelErrorMessage(){var{error:e}=this.state;return e!=null?"".concat(e):void 0}getSource(e){var t=this.getCachedPanelLinks(e,this);return this.getCachedSource(t)}getSourceTable(e,t){var n=this.getSource(t);return this.getCachedSourceTable(e,n)}getValuesColumn(e,t){var n=this.getSource(t);return this.getCachedSourceColumn(e,n)}startListeningToSource(e){var{dh:t}=this.props;Fe.debug("startListeningToSource"),e.addEventListener(t.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(t.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.addEventListener(t.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.addEventListener(t.Table.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(t.Table.EVENT_RECONNECT,this.handleReconnect)}stopListeningToSource(e){var{dh:t}=this.props;Fe.debug("stopListeningToSource"),e.removeEventListener(t.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(t.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.removeEventListener(t.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.removeEventListener(t.Table.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(t.Table.EVENT_RECONNECT,this.handleReconnect)}handleChange(e){var{column:t,isValueShown:n=!1,value:i}=e,{name:a=void 0,type:o=void 0}=t??{},s=!0,l=Date.now();this.setState(d=>{var u,c,{panelState:m,timestamp:f,wasFlipped:g,skipUpdate:v}=d,p=m!=null&&n!==m.isValueShown&&a===m.name&&o===m.type&&i===m.value;return s=(u=!v&&n&&(!p||!g))!==null&&u!==void 0?u:!1,s||(l=f),{panelState:{isValueShown:n,name:a,type:o,value:i,timestamp:(c=l)!==null&&c!==void 0?c:void 0},timestamp:l,wasFlipped:p,skipUpdate:!1}},()=>{s&&this.sendUpdate(a??null,o,i,l)})}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(e){var{detail:t}=e;this.setState({sourceSize:t})}handleColumnSelected(){Fe.debug("handleColumnSelected");var{glEventHub:e}=this.props;e.emit(Ve.COLUMN_SELECTED,this,qt.SOURCE_COLUMN)}handleClearAllFilters(){var e,t;(e=this.dropdownFilterRef)===null||e===void 0||(t=e.current)===null||t===void 0||t.clearFilter()}setPanelState(e){var t,n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{dashboardLinks:a}=this.props;if(this.getSource(a)==null){Fe.debug("Ignore state update for unlinked filter",e);return}this.setState({skipUpdate:!i}),(t=this.dropdownFilterRef)===null||t===void 0||(n=t.current)===null||n===void 0||n.setFilterState(e)}sendUpdate(e,t,n,i){var a,{dashboardLinks:o,glEventHub:s}=this.props,l=(a=this.getSource(o))===null||a===void 0?void 0:a.panelId,d=l===null?[]:[l];Fe.debug("sendUpdate",{name:e,type:t,value:n,timestamp:i,excludePanelIds:d}),s.emit(Ve.FILTERS_CHANGED,this,{name:e,type:t,value:n??"=null",timestamp:i,excludePanelIds:d})}updateValuesTable(){var{dashboardLinks:e,panelTableMap:t}=this.props,n=this.getSource(e),i=this.getSourceTable(t,e);if(Fe.debug("updateValuesTable",n,i),this.setState({values:[],valuesTable:void 0,error:null}),n==null){Fe.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),i!=null&&(this.setState({isLoaded:!1,sourceSize:i.size}),this.pending.add(i.copy(),a=>a.close()).then(a=>{this.updateViewportListener(a),this.setState({valuesTable:a})}).catch(a=>{we.isCanceled(a)||(Fe.error(a),this.setState({isLoading:!1,error:a}))}))}applySourceSorts(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);if(Fe.debug("applySourceSorts",i==null?void 0:i.sort),n==null||i==null){Fe.debug("Table not initialized");return}var a=[...i.sort];n.applySort(a),this.setViewport(n)}applySourceFilters(){var{dashboardLinks:e,panelTableMap:t}=this.props,{valuesTable:n}=this.state,i=this.getSourceTable(t,e);if(Fe.debug("applySourceFilters",i==null?void 0:i.filter),n==null||i==null){Fe.debug("Table not initialized");return}var a=[...i.filter];n.applyFilter(a),this.setViewport(n)}updateViewportListener(e){var{dh:t}=this.props;if(Fe.debug("updateViewportListener",e==null?void 0:e.size),this.cleanup&&this.cleanup(),e==null){this.cleanup=void 0;return}this.cleanup=e.addEventListener(t.Table.EVENT_UPDATED,this.handleValuesTableUpdate),this.setViewport(e)}setViewport(e){var{dashboardLinks:t}=this.props,n=this.getValuesColumn(e,t);if(!n){Fe.error("values column is null");return}e.setViewport(0,qt.MAX_TABLE_SIZE-1,[n])}updateFormatterSettings(e){var{dh:t}=this.props,n=$o.getColumnFormats(e);mr(this.columnFormats,n)||(this.columnFormats=n,this.setState({formatter:new Zt(t,n)}))}handleValuesTableUpdate(e){var{detail:t}=e,{rows:n}=t,{dashboardLinks:i}=this.props,{valuesTable:a}=this.state;if(!a){Fe.error("valuesTable is null");return}var o=this.getValuesColumn(a,i);if(!o){Fe.error("Values column not found");return}var s=n.map(l=>l.get(o));this.setState({values:s,isLoading:!1,isLoaded:!0,valuesColumn:o})}handleSourceMouseEnter(){var{columnSelectionValidator:e}=this.props;e&&e(this,qt.SOURCE_COLUMN)}handleSourceMouseLeave(){var{columnSelectionValidator:e}=this.props;e&&e(this,void 0)}render(){var{columns:e,dashboardLinks:t,disableLinking:n,glContainer:i,glEventHub:a,isLinkerActive:o}=this.props,{column:s,formatter:l,isDisconnected:d,isValueShown:u,value:c,values:m,valuesColumn:f,isLoading:g,isLoaded:v}=this.state,p=this.getSource(t),C=this.getSettingsErrorMessage(),S=this.getPanelErrorMessage(),y=v&&f!=null?this.getCachedValues(m,f,l):[];return h.jsx(Ki,{errorMessage:S,isLoading:g,isLoaded:v,isDisconnected:d,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:i,glEventHub:a,onClearAllFilters:this.handleClearAllFilters,widgetName:"Dropdown Filter",widgetType:"DropdownFilter",children:h.jsx("div",{ref:this.panelContainer,className:"dropdown-filter-container h-100 w-100 container",children:h.jsx(bu,{ref:this.dropdownFilterRef,column:s,columns:e,isValueShown:u,isLinkerActive:o,disableLinking:n,isLoaded:v,settingsError:C,source:p,value:c,values:y,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})})})}}ht(qt,"displayName","DropdownFilterPanel");ht(qt,"COMPONENT","DropdownFilterPanel");ht(qt,"MAX_TABLE_SIZE",256);ht(qt,"SOURCE_COLUMN",Object.freeze({name:"FilterSource",type:null}));var jT=kT(qt);const Zn=jT;function Mt(r){return r.type==="directory"}function $T(r,e,t){return e=HT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function HT(r){var e=VT(r,"string");return typeof e=="symbol"?e:String(e)}function VT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class UT extends Error{constructor(){super("No file exists at the path specified"),$T(this,"isFileNotFound",!0)}}const uo=UT;function Cu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function yu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Cu(a,n,i,o,s,"next",l)}function s(l){Cu(a,n,i,o,s,"throw",l)}o(void 0)})}}var En;(function(r){r.GROOVY="text/x-groovy",r.PLAIN_TEXT="text/plain",r.PYTHON="text/x-python",r.PYTHON_COMPILED="application/x-python-code",r.SCALA="text/x-scala",r.UNKNOWN=""})(En||(En={}));class tn{static fileExists(e,t){return yu(function*(){try{return yield e.info(t),!0}catch(n){if(!(n instanceof uo))throw n;return!1}})()}static fileExtensionToString(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e.length===0?"":".".concat(e)}static getDepth(e){var t;if(!tn.hasPath(e))throw new Error("Invalid path provided: ".concat(e));var n=(t=e.match(/\//g))!==null&&t!==void 0?t:[];return n.length-1}static getExtension(e){var t=this.getBaseName(e).split(".");if(t.length>1){var n;return(n=t.pop())!==null&&n!==void 0?n:""}return""}static getBaseName(e){var t;return(t=e.split("/").pop())!==null&&t!==void 0?t:""}static getCopyFileName(e){var t=e.lastIndexOf("."),n=null,i=null;t<0?i=e:(i=e.substring(0,t),n=e.substring(t+1));var a=i?"".concat(i,"-copy"):"Copy";return n!==null?"".concat(a,".").concat(n):a}static getUniqueCopyFileName(e,t){return yu(function*(){for(var n=tn.getCopyFileName(t);yield tn.fileExists(e,n);)n=tn.getCopyFileName(n);return n})()}static getMimeType(e){var t=this.getExtension(e).toLowerCase();switch(t){case"groovy":return En.GROOVY;case"py":return En.PYTHON;case"pyc":return En.PYTHON_COMPILED;case"scala":return En.SCALA;case"txt":return En.PLAIN_TEXT;default:return En.UNKNOWN}}static getParent(e){if(!tn.hasPath(e))throw new Error("Invalid name provided: ".concat(e));for(var t=e.split("/");t.pop()==="";);if(t.length===0)throw new Error("No parent for path provided: ".concat(e));return"".concat(t.join("/"),"/")}static getPath(e){if(!tn.hasPath(e))throw new Error("Invalid filename provided: ".concat(e));var t=e.split("/");return t.pop(),"".concat(t.join("/"),"/")}static hasPath(e){return e.startsWith("/")}static isPath(e){return e.startsWith("/")&&e.endsWith("/")}static makePath(e){return e.endsWith("/")?e:"".concat(e,"/")}static replaceExtension(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=e.lastIndexOf("."),i=n>-1?e.substring(0,n):e,a=tn.fileExtensionToString(t);return"".concat(i).concat(a)}static validateName(e){var t=[".",".."],n=/[\\/\0]/g,i=new Map([["\0","null"]]);if(!e)throw new Ei("Name cannot be empty");if(t.includes(e))throw new Ei('"'.concat(e,'" is a reserved name'));if(n.test(e)){var a,o;throw new Ei('Invalid characters in name: "'.concat((a=(o=e.match(n))===null||o===void 0?void 0:o.reduce((s,l)=>s.includes(l)?s:[...s,l],[]).map(s=>i.has(s)?i.get(s):s).join('", "'))!==null&&a!==void 0?a:"",'"'))}}static reducePaths(e){var t=e.filter(n=>tn.isPath(n));return e.filter(n=>!t.some(i=>n!==i&&n.startsWith(i)))}static removeRoot(e,t){if(e.length===0)return t;if(!t.startsWith(e))throw new Error("Filename ".concat(t," does not start with expected root ").concat(e));return t.substring(e.length)}static addRoot(e,t){return"".concat(e).concat(t)}}const ie=tn;var Ks=26;function is(r){return Mt(r)?ie.makePath(r.filename):ie.getPath(r.filename)}function Su(r,e){if(r.length===0||e==null)throw new Error("No items to move");var t=is(e);if(r.some(n=>{var{filename:i}=n;return ie.getPath(i)===t}))throw new Error("File already in the destination folder");if(r.some(n=>Mt(n)&&t.startsWith(ie.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:r,targetPath:t}}function BT(r){if(Mt(r))return r.isExpanded?Jf:ev;var e=ie.getMimeType(r.basename);switch(e){case En.PYTHON:return nv;default:return tv}}function as(r){var e,{children:t,draggedItems:n,isDragInProgress:i,isDropTargetValid:a,isSelected:o,item:s,itemIndex:l,dropTargetItem:d,onDragStart:u,onDragOver:c,onDragEnd:m,onDrop:f}=r,g=(e=n==null?void 0:n.some(M=>M.id===s.id))!==null&&e!==void 0?e:!1,v=is(s),p=i&&d?is(d):null,C=i&&a&&Mt(s)&&p===v,S=i&&a&&p===v,y=i&&!a&&p===v,w=BT(s),E=ie.getDepth(s.filename),D=Array(E).fill(null).map((M,_)=>h.jsx("span",{className:"file-list-depth-line"},_));return h.jsxs("div",{className:J("d-flex w-100 align-items-center","file-list-item",{"is-dragged":g,"is-exact-drop-target":C,"is-in-drop-target":S,"is-invalid-drop-target":y,"is-selected":o}),onDragStart:M=>u(l,M),onDragOver:M=>c(l,M),onDragEnd:M=>m(l,M),onDrop:M=>f(l,M),draggable:!0,role:"presentation","aria-label":s.basename,children:[D," ",h.jsx(ue,{icon:w,className:"item-icon",fixedWidth:!0})," ",h.jsx("span",{className:"truncation-wrapper",children:t??h.jsxs(h.Fragment,{children:[s.basename,h.jsx(On,{children:s.basename})]})})]})}function wu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function fa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?wu(Object(t),!0).forEach(function(n){WT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):wu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function WT(r,e,t){return e=GT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function GT(r){var e=zT(r,"string");return typeof e=="symbol"?e:String(e)}function zT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var lt=z.module("FileList"),KT=500,Eu="item-list-scroll-pane";function qT(r){var{isMultiSelect:e=!1,table:t,onFocusChange:n=()=>{},onMove:i,onSelect:a,onSelectionChange:o=()=>{},renderItem:s=as,rowHeight:l=Ks,overscanCount:d=Ot.DEFAULT_OVERSCAN}=r,[u,c]=b.useState(()=>({items:[],offset:0,itemCount:0})),[m,f]=b.useState({top:0,bottom:0}),[g,v]=b.useState(),[p,C]=b.useState(),[S,y]=b.useState(),[w,E]=b.useState([]),D=b.useRef(),M=b.useRef(null),_=b.useRef(null),T=b.useCallback(V=>{if(V.length===0||u==null)return[];for(var ne=[],de=0;de<V.length;de+=1)for(var Ee=V[de],Le=Ee[0];Le<=Ee[1];Le+=1)Le>=u.offset&&Le<u.offset+u.items.length&&ne.push(u.items[Le-u.offset]);return ne},[u]),N=b.useCallback(V=>{var ne=T([[V,V]]);if(ne.length>0)return ne[0]},[T]),x=b.useCallback(()=>{var V=Sn.count(w);if(V===0)return null;if(V===1){var ne=w[0][0],de=N(ne);if(de!=null)return de.filename}return"".concat(V," items")},[N,w]),F=b.useCallback(V=>{if(!(!p||!g)){lt.debug("dropItems",p,"to",V);try{var{files:ne,targetPath:de}=Su(p,g);if(i==null||i(ne,de),V!=null){var Ee;E([[V,V]]),(Ee=M.current)===null||Ee===void 0||Ee.focusItem(V)}}catch(Le){lt.error("Unable to complete move",Le)}}},[p,g,i]),k=b.useCallback((V,ne)=>{var de=u.items[V-u.offset];de!==void 0&&(lt.debug("handleItemClick",de),a(de,ne),Mt(de)&&(t==null||t.setExpanded(de.filename,!de.isExpanded)))},[u,a,t]),U=b.useCallback((V,ne)=>{var de;lt.debug2("handleItemDragStart",V,w);var Ee=w;Sn.isSelected(w,V)||(Ee=[[V,V]],E(Ee)),C(T(Ee)),(de=M.current)===null||de===void 0||de.resetMouseState();var Le=document.createElement("div");Le.innerHTML='<div class="dnd-placeholder-content">'.concat(x(),"</div>"),Le.className="file-list-dnd-placeholder",document.body.appendChild(Le),ne.dataTransfer.setDragImage(Le,0,0),ne.dataTransfer.effectAllowed="move",y(Le)},[x,T,w]),H=b.useCallback((V,ne)=>{ne.preventDefault(),lt.debug2("handleItemDragOver",ne),v(N(V))},[N]),W=b.useCallback((V,ne)=>{lt.debug("handleItemDragEnd",V),S==null||S.remove(),C(void 0),v(void 0),y(void 0)},[S]),X=b.useCallback((V,ne)=>{F(V)},[F]),le=b.useCallback(()=>{lt.debug2("handleItemDragExit"),v(void 0)},[]),me=b.useCallback(V=>{V.target instanceof Element&&V.target.classList.contains(Eu)&&(V.preventDefault(),lt.debug2("handleListDragOver",V),v({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),ve=b.useCallback(V=>{V.target instanceof Element&&V.target.classList.contains(Eu)&&(lt.debug("handleListDrop"),F())},[F]),j=b.useCallback(function(V){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(lt.debug2("handleSelectionChange",V),ne===!0||V!==w){E(V);var de=T(V);o(de)}},[T,o,w]),R=b.useCallback(V=>{if(lt.debug2("handleFocusChange",V),V!=null){var[ne]=T([[V,V]]);n(ne)}else n();D.current=V},[T,n]),$=b.useCallback((V,ne)=>{lt.debug("handleViewportChange",V,ne),(V!==m.top||ne!==m.bottom)&&f({top:V,bottom:ne})},[m]),G=b.useMemo(()=>{if(!p||!g)return!1;try{return Su(p,g),lt.debug("handleValidateDropTarget true"),!0}catch{return lt.debug("handleValidateDropTarget false"),!1}},[p,g]),{focusedPath:te}=r;b.useEffect(()=>{te!==void 0&&(te==="/"?t.collapseAll():(t.setExpanded(te,!1),t.setExpanded(te,!0)))},[t,te]),b.useEffect(function(){lt.debug("updating table viewport",m),t==null||t.setViewport({top:Math.max(0,m.top-d),bottom:m.bottom+d})},[d,t,m]),b.useEffect(function(){var ne=t.onUpdate(de=>{c({items:de.items.map(Ee=>fa(fa({},Ee),{},{itemName:Ee.basename})),offset:de.offset,itemCount:t.size})});return()=>{ne()}},[t]),b.useEffect(function(){D.current!=null&&R(D.current),w.length>0&&j(w,!0)},[u,R,j,w]),b.useEffect(function(){if(g!=null&&Mt(g)&&g.filename!=="/"){var ne=setTimeout(()=>{g.isExpanded||t==null||t.setExpanded(g.filename,!0)},KT);return()=>clearTimeout(ne)}},[g,t]);var Me=b.useCallback(V=>s(fa(fa({},V),{},{isDragInProgress:p!=null,dropTargetItem:g,draggedItems:p,isDropTargetValid:G,onDragStart:U,onDragEnd:W,onDragOver:H,onDragExit:le,onDrop:X})),[W,le,H,U,X,p,g,G,s]);return h.jsx("div",{ref:_,className:J("file-list",{"is-dragging":p!=null}),onDragOver:me,onDrop:ve,children:h.jsx(Ot,{ref:M,items:u.items,itemCount:u.itemCount,offset:u.offset,onFocusChange:R,onSelect:k,onSelectionChange:j,onViewportChange:$,selectedRanges:w,renderItem:Me,rowHeight:l,isMultiSelect:e,isDragSelect:!1,isDeselectOnClick:!1})})}var XT={name:"File Explorer",DELETE:De.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[q.DELETE],macShortcut:[re.CMD,q.BACKSPACE]}),RENAME:De.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[q.ENTER],macShortcut:[q.ENTER]})};const Pu={FILE_EXPLORER:XT};var Tu=z.module("FileListItemEditor"),ZT=()=>Promise.resolve();function YT(r){var{item:e,onCancel:t,onSubmit:n,validate:i=ZT}=r,a=b.useRef(null),[o,s]=b.useState(e.basename),[l,d]=b.useState(),[u,c]=b.useState(Promise.resolve()),m=b.useCallback(()=>{var S;(S=a.current)===null||S===void 0||S.focus()},[a]),f=b.useCallback(S=>S.stopPropagation(),[]),g=b.useCallback(()=>{u.then(()=>{n(o)}).catch(S=>Tu.info("Unable to validate name",S))},[n,o,u]);b.useEffect(function(){var y=we.makeCancelable(i(o));return y.then(()=>d(void 0)).catch(w=>{we.isCanceled(w)||d(w)}),c(y),()=>y.cancel()},[i,o]),b.useEffect(function(){m()},[m]);var v=b.useCallback(()=>{Tu.debug2("handleBlur"),g()},[g]),p=b.useCallback(S=>{var{value:y}=S.target;s(y)},[]),C=b.useCallback(S=>{S.stopPropagation();var{key:y}=S;switch(y){case"Enter":{g();break}case"Escape":{t();break}}},[t,g]);return h.jsxs("div",{className:"file-list-item-editor",children:[h.jsx("input",{type:"text",className:J("form-control file-list-item-editor-input",{"is-invalid":l}),value:o,ref:a,onBlur:v,onKeyDown:C,onChange:p,onClick:f,onDoubleClick:f,onMouseDown:f}),l&&h.jsx("div",{className:"invalid-feedback",children:"".concat(l)})]})}function _u(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function xo(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_u(Object(t),!0).forEach(function(n){QT(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_u(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function QT(r,e,t){return e=JT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function JT(r){var e=e_(r,"string");return typeof e=="symbol"?e:String(e)}function e_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Mm(r){var{isMultiSelect:e=!1,focusedPath:t,showContextMenu:n=!1,onCreateFile:i,onCreateFolder:a,onCopy:o,onDelete:s,onMove:l,onRename:d,onSelect:u,onSelectionChange:c,table:m,rowHeight:f=Ks,validateRename:g=()=>Promise.resolve()}=r,[v,p]=b.useState(),[C,S]=b.useState([]),[y,w]=b.useState(),E=b.useCallback(X=>{S(X),c==null||c(X)},[c]),D=b.useCallback(X=>{w(X)},[]),M=b.useCallback(()=>{y&&(o==null||o(y))},[y,o]),_=b.useCallback(()=>{C.length>0&&(s==null||s(C))},[s,C]),T=b.useCallback(()=>{i==null||i()},[i]),N=b.useCallback(()=>{y&&(a==null||a(ie.getPath(y.filename)))},[y,a]),x=b.useCallback(()=>{y&&p(y)},[y]),F=b.useCallback(()=>{p(void 0)},[]),k=b.useCallback(X=>{v&&(d==null||d(v,X),p(void 0))},[d,v]),U=b.useMemo(()=>{if(v)return[];var X=[];return i&&X.push({title:"New File",description:"Create new file",action:T,group:fe.groups.medium}),a&&X.push({title:"New Folder",description:"Create new folder",action:N,group:fe.groups.medium}),o&&X.push({title:"Copy File",description:"Copy the selected file",action:M,group:fe.groups.low,disabled:y==null||Mt(y)}),s&&C.length>0&&X.push({title:"Delete",description:"Delete",shortcut:Pu.FILE_EXPLORER.DELETE,action:_,group:fe.groups.low}),d&&X.push({title:"Rename",description:"Rename",shortcut:Pu.FILE_EXPLORER.RENAME,action:x,group:fe.groups.low,disabled:y==null}),X},[M,_,T,N,x,y,o,i,a,s,d,C,v]),H=b.useCallback(X=>(I(v),g(v,X)),[v,g]),W=b.useCallback(X=>{var{item:le}=X;return v&&v.filename===le.filename?h.jsx(as,xo(xo({},X),{},{children:h.jsx(YT,{item:le,validate:H,onSubmit:k,onCancel:F})})):h.jsx(as,xo({},X))},[F,k,v,H]);return h.jsxs("div",{className:"file-list-container",children:[m!=null&&h.jsx(qT,{onMove:l,onSelect:u,onSelectionChange:E,onFocusChange:D,renderItem:W,rowHeight:f,table:m,isMultiSelect:e,focusedPath:t}),n&&h.jsx(fe,{actions:U})]})}Mm.displayName="FileListContainer";function Ou(r,e,t){return e=t_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function t_(r){var e=n_(r,"string");return typeof e=="symbol"?e:String(e)}function n_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class r_ extends Ei{constructor(e){super("Name already exists"),Ou(this,"isExistingFile",!0),Ou(this,"info",void 0),this.info=e}}const wa=r_;function Du(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Mu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Du(a,n,i,o,s,"next",l)}function s(l){Du(a,n,i,o,s,"throw",l)}o(void 0)})}}var Jt=z.module("FileExplorer");function qs(r){var{storage:e,isMultiSelect:t=!1,focusedPath:n,onCopy:i=()=>{},onDelete:a=()=>{},onRename:o=()=>{},onCreateFile:s=()=>{},onCreateFolder:l=()=>{},onSelect:d,onSelectionChange:u,rowHeight:c=Ks}=r,[m,f]=b.useState([]),[g,v]=b.useState();b.useEffect(function(){var k;function U(){return H.apply(this,arguments)}function H(){return H=Mu(function*(){Jt.debug("initTable"),k=we.makeCancelable(e.getTable(),W=>W.close());try{v(yield k)}catch(W){we.isCanceled(W)||Jt.error("Unable to initialize table",W)}}),H.apply(this,arguments)}return U(),()=>{k.cancel()}},[e]);var p=b.useCallback(F=>{we.isCanceled(F)||Jt.error(F)},[]),C=b.useCallback(()=>{Jt.debug("handleCreateFile"),s()},[s]),S=b.useCallback(()=>{Jt.debug("handleCreateFolder"),l()},[l]),y=b.useCallback(F=>{Jt.debug("handleCopyFile",F.filename),i(F)},[i]),w=b.useCallback(F=>{Jt.debug("handleDelete, pending confirmation",F),f(F)},[]),E=b.useCallback(()=>{Jt.debug("handleDeleteConfirm",m),m.forEach(F=>e.deleteFile(Mt(F)?ie.makePath(F.filename):F.filename)),a(m),f([])},[m,a,e]),D=b.useCallback(()=>{Jt.debug("handleDeleteCancel"),f([])},[]),M=b.useCallback((F,k)=>{var U=ie.reducePaths(F.map(H=>Mt(H)?ie.makePath(H.filename):H.filename));U.forEach(H=>{var W=ie.isPath(H)?"".concat(k).concat(ie.getBaseName(H.substring(0,H.length-1)),"/"):"".concat(k).concat(ie.getBaseName(H));e.moveFile(H,W).then(()=>{o(H,W)}).catch(p)})},[p,o,e]),_=b.useCallback((F,k)=>{var U=F.filename,H=Mt(F);H&&!U.endsWith("/")&&(U="".concat(U,"/"));var W="".concat(ie.getParent(U)).concat(k);H&&!W.endsWith("/")&&(W="".concat(W,"/")),Jt.debug2("handleRename",U,W),e.moveFile(U,W).catch(p),o(U,W)},[p,o,e]),T=b.useCallback(function(){var F=Mu(function*(k,U){if(U!==k.basename){ie.validateName(U);var H="".concat(ie.getPath(k.filename)).concat(U);try{var W=yield e.info(H);throw new wa(W)}catch(X){if(!(X instanceof uo))throw X}}});return function(k,U){return F.apply(this,arguments)}}(),[e]),N=m.length>0,x=b.useMemo(()=>m.length===1?'Are you sure you want to delete "'.concat(m[0].filename,'"?'):"Are you sure you want to delete the selected files?",[m]);return h.jsxs("div",{className:"file-explorer",children:[g&&h.jsx(Mm,{isMultiSelect:t,focusedPath:n,showContextMenu:!0,onCopy:y,onCreateFolder:S,onCreateFile:C,onMove:M,onDelete:w,onRename:_,onSelect:d,onSelectionChange:u,rowHeight:c,table:g,validateRename:T}),h.jsx(fr,{isOpen:N,headerText:x,bodyText:"You cannot undo this action.",onCancel:D,onConfirm:E,confirmButtonText:"Delete"})]})}qs.displayName="FileExplorer";function Iu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function i_(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Iu(a,n,i,o,s,"next",l)}function s(l){Iu(a,n,i,o,s,"throw",l)}o(void 0)})}}function zn(r,e,t){return e=a_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function a_(r){var e=o_(r,"string");return typeof e=="symbol"?e:String(e)}function o_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ar=z.module("NewItemModal");class cr extends b.PureComponent{static getValidationMessage(e){return e instanceof wa&&e.info.type==="directory"?"Error: Cannot overwrite existing directory":"".concat(e)}static handleError(e){we.isCanceled(e)||ar.error(e)}constructor(e){super(e),zn(this,"inputRef",Z.createRef()),zn(this,"cancelableValidatePromise",void 0),zn(this,"cancelableExistingItemPromise",void 0),zn(this,"pending",new Qn),zn(this,"pathMap",new Map),zn(this,"isInitialLoad",!0),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),this.handleBreadcrumbSelect=this.handleBreadcrumbSelect.bind(this);var{defaultValue:t}=e,n=ie.hasPath(t)?ie.getPath(t):"/";this.state={isSubmitting:!1,path:n,prevExtension:ie.getExtension(t),showExtensionChangeModal:!1,showOverwriteModal:!1,value:ie.getBaseName(t)}}componentDidUpdate(e,t){var{isOpen:n}=this.props,{isOpen:i}=e,{value:a,path:o}=this.state;!i&&n&&(this.resetValue(),this.isInitialLoad=!0),i&&n&&(!this.isInitialLoad&&(o!==t.path||a!==t.value)&&this.updateValidationStatus(o,a),this.isInitialLoad=!1)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){var{defaultValue:e}=this.props,t=ie.hasPath(e)?ie.getPath(e):"/";this.setState({path:t,value:ie.getBaseName(e),validationError:void 0,prevExtension:ie.getExtension(e),isSubmitting:!1})}getValidationPromise(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=we.makeCancelable(this.validateName(e,t,n)),this.cancelableValidatePromise}validateName(e,t,n){var i=this;return i_(function*(){ie.validateName(t);var{defaultValue:a,storage:o}=i.props;if(n){var s="".concat(e).concat(t);if(s!==a)try{var l=yield o.info(s);throw new wa(l)}catch(d){if(!(d instanceof uo))throw d}}return t})()}updateValidationStatus(e,t){this.getValidationPromise(e,t).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(cr.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(e){var{value:t}=e.target;this.setState({value:t})}handleSelect(e){if(ar.debug("handleSelect",e),e.type==="directory")this.setState({path:ie.makePath(e.filename)});else{var t=e.basename,n=ie.getPath(e.filename);this.setState({value:t,path:n},()=>{this.focusRenameInput()})}}handleKeyDown(e){var{key:t}=e;switch(e.stopPropagation(),t){case"Enter":{e.preventDefault(),this.submitModal();break}case"Escape":{e.preventDefault();var{onCancel:n}=this.props;n();break}}}handleValidationError(e){if(!(e instanceof Ei))throw e;ar.debug("Validation error",e),this.setState({validationError:e})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});var{onSubmit:e}=this.props,{path:t,value:n}=this.state;ar.debug("handleOverwriteConfirm",t,n),e("".concat(t).concat(n),!0)}handleExtensionChangeCancel(){ar.debug("handleExtensionChangeCancel"),this.setState(e=>{var{value:t,prevExtension:n}=e,i=ie.replaceExtension(t,n);return{showExtensionChangeModal:!1,value:i}}),this.submitModal(!0)}handleExtensionChangeConfirm(){ar.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){var e=this.inputRef.current;if(e){var{type:t}=this.props,{value:n}=e,i=t==="directory"?n.length:n.lastIndexOf(".");e.focus(),e.setSelectionRange(0,i>0?i:n.length)}}submitModal(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.setState(t=>{var{prevExtension:n,value:i,path:a}=t,{notifyOnExtensionChange:o,type:s}=this.props;ar.debug("submitModal",n,i);var l=ie.getExtension(i);return o&&!e&&n!==null&&n!==l?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:l}:(this.getValidationPromise(a,i,!0).then(d=>{var{onSubmit:u}=this.props;u("".concat(a).concat(i))}).catch(d=>{if(d instanceof wa&&s!=="directory"&&d.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw d}).catch(d=>{throw we.isCanceled(d)&&this.setState({isSubmitting:!1}),d}).catch(this.handleValidationError).catch(cr.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}handleBreadcrumbSelect(e){this.setState({path:e})}renderPathButtons(e){var t=e.split("/");return t.pop(),t.map((n,i)=>{for(var a="",o=0;o<i;o+=1)a+="".concat(t[o],"/");return a+="".concat(n,"/"),h.jsxs(Z.Fragment,{children:[h.jsx(Y,{kind:"ghost",className:"directory-breadcrumbs",onClick:()=>this.handleBreadcrumbSelect(a),"aria-label":i===0?"Home":void 0,icon:i===0?h.jsx(ue,{icon:rv,transform:"right-1.6"}):void 0,tooltip:i===0?"Home":void 0,children:n}),"/"]},a)})}render(){var{storage:e,isOpen:t,onCancel:n,placeholder:i,title:a,type:o}=this.props,{isSubmitting:s,path:l,showExtensionChangeModal:d,showOverwriteModal:u,validationError:c,value:m,prevExtension:f,newExtension:g}=this.state,v=o==="directory",p=ie.fileExtensionToString(f),C=ie.fileExtensionToString(g),S=v?"Create":"Save",y=v?"New folder name":"Save file as";return h.jsxs(h.Fragment,{children:[h.jsxs(us,{isOpen:t,toggle:n,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal",children:[h.jsx(hs,{toggle:n,children:a}),h.jsx(cs,{children:h.jsx("form",{children:h.jsxs("div",{className:"d-flex flex-column new-file-modal-content",children:[h.jsxs("div",{className:"flex-grow-0 mb-4",children:[h.jsx("label",{htmlFor:"file-name-input",children:y}),h.jsx("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:J("form-control",{"is-invalid":c}),value:m,placeholder:i,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),c&&h.jsx("div",{className:"invalid-feedback",children:cr.getValidationMessage(c)})]}),h.jsxs("div",{className:"flex-grow-0",children:[h.jsx("label",{children:"Directory: /"}),this.renderPathButtons(l)]}),h.jsx("div",{className:"flex-grow-1 file-explorer-container",children:h.jsx(qs,{onSelect:this.handleSelect,storage:e,focusedPath:l})})]})})}),h.jsxs(Ss,{children:[h.jsx(Y,{kind:"secondary",onClick:n,children:"Cancel"}),h.jsx(Y,{kind:"primary",disabled:s,onClick:this.handleModalSubmit,children:S})]})]}),h.jsx(fr,{isOpen:u,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"}),h.jsx(fr,{isOpen:d,headerText:"Confirm extension change",bodyText:'Are you sure you want to change extension from "'.concat(p,'" to "').concat(C,'"?'),onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:'Keep "'.concat(p,'"'),confirmButtonText:'Use "'.concat(C,'"')})]})}}zn(cr,"propTypes",{isOpen:O.bool,title:O.string.isRequired,defaultValue:O.string,type:O.oneOf(["file","directory"]).isRequired,onSubmit:O.func,onCancel:O.func,placeholder:O.string,storage:O.shape({}).isRequired,notifyOnExtensionChange:O.bool});zn(cr,"defaultProps",{isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:(r,e)=>{},onCancel:()=>{}});const Im=cr;function s_(r){var{createFile:e,createFolder:t,onSearchChange:n,defaultSearchText:i=""}=r;return h.jsxs("div",{className:"file-explorer-toolbar",children:[h.jsxs("div",{className:"file-explorer-toolbar-buttons",children:[h.jsx(Y,{kind:"ghost",icon:xh,tooltip:"New notebook",onClick:e,"aria-label":"New notebook"}),h.jsx(Y,{kind:"ghost",icon:iv,tooltip:"New folder",onClick:t,"aria-label":"New folder"})]}),n&&h.jsx("div",{className:"file-explorer-toolbar-search",children:h.jsx(Xp,{value:i,onChange:n,placeholder:"Search by name"})})]})}function Nu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function l_(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Nu(a,n,i,o,s,"next",l)}function s(l){Nu(a,n,i,o,s,"throw",l)}o(void 0)})}}function Nm(r,e,t){return e=d_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function d_(r){var e=u_(r,"string");return typeof e=="symbol"?e:String(e)}function u_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var or=z.module("FileExplorerPanel"),h_=(r,e)=>{var t=Ic(r),n=ti(r,e.localDashboardId),{session:i,config:a}=n??{},o=a==null?void 0:a.type;return{fileStorage:t,language:o,session:i}},c_=Ht(h_,null,null,{forwardRef:!0});function m_(r){var e=r;return e!=null&&typeof e.button=="number"}class Wr extends Z.Component{static handleError(e){or.error(e)}static isFocusEvent(e){return m_(e)?e.detail>=2:!0}constructor(e){super(e),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCopyFile=this.handleCopyFile.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),this.handleSelectionChange=this.handleSelectionChange.bind(this);var{session:t,language:n}=e;this.state={isShown:!1,language:n,session:t,showCreateFolder:!1,focusedFilePath:"/"}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){var{glEventHub:e}=this.props,{session:t,language:n}=this.state,i={language:n,value:""};or.debug("handleCreateFile",t,n,i),e.emit(Se.CREATE_NOTEBOOK,t,n,i)}handleCreateDirectory(){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){or.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(e){or.debug("handleCreateDirectorySubmit",e),this.setState({showCreateFolder:!1});var{fileStorage:t}=this.props;t.createDirectory(e).catch(Wr.handleError)}handleCopyFile(e){var t=this;return l_(function*(){var{fileStorage:n}=t.props;if(Mt(e)){or.error("Invalid item in handleCopyItem",e);return}var i=yield ie.getUniqueCopyFileName(n,e.filename);yield n.copyFile(e.filename,i)})()}handleDelete(e){var{glEventHub:t}=this.props;e.forEach(n=>{t.emit(Se.CLOSE_FILE,{id:n.filename,itemName:n.filename})})}handleSelectionChange(e){var t="/";e.length===1&&(e[0].type==="directory"?t=ie.makePath(e[0].filename):t=ie.getPath(e[0].filename)),this.setState({focusedFilePath:t})}handleFileSelect(e,t){if(or.debug("fileSelect",e),e.type!=="directory"){var n=Wr.isFocusEvent(t),i={id:e.filename,itemName:e.filename},{glEventHub:a}=this.props,{session:o,language:s}=this.state,l={value:null,language:s};a.emit(Se.SELECT_NOTEBOOK,o,s,l,i,n)}}handleRename(e,t){var{glEventHub:n}=this.props;or.debug("handleRename",e,t),n.emit(Se.RENAME_FILE,e,t)}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,language:n})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){var{glContainer:e}=this.props,{isHidden:t}=e;return t}render(){var{fileStorage:e,glContainer:t,glEventHub:n}=this.props,{isShown:i,showCreateFolder:a,focusedFilePath:o}=this.state;return h.jsxs(hn,{className:"file-explorer-panel",componentPanel:this,glContainer:t,glEventHub:n,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow,children:[h.jsx(s_,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),i&&h.jsx(qs,{isMultiSelect:!0,storage:e,onCopy:this.handleCopyFile,onCreateFile:this.handleCreateFile,onCreateFolder:this.handleCreateDirectory,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect,onSelectionChange:this.handleSelectionChange}),h.jsx(Im,{isOpen:a,type:"directory",title:"Create New Folder",storage:e,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel,defaultValue:o})]})}}Nm(Wr,"COMPONENT","FileExplorerPanel");Nm(Wr,"TITLE","File Explorer");var f_=c_(Wr);const xm=f_;function xu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function va(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xu(Object(t),!0).forEach(function(n){yi(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):xu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function yi(r,e,t){return e=v_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function v_(r){var e=p_(r,"string");return typeof e=="symbol"?e:String(e)}function p_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ae=z.module("FilterSetManager"),g_="Enter name...",Fu="No Available Filter Sets";class ja extends b.Component{static animateScreenFlash(){var e,t=document.createElement("div");t.classList.add("screen-flash-overlay"),t.addEventListener("animationend",()=>{t.remove()}),(e=document.querySelector("body"))===null||e===void 0||e.appendChild(t)}constructor(e){super(e),yi(this,"renameInputRef",Z.createRef()),yi(this,"dropdownRef",Z.createRef()),yi(this,"editDropdownRef",Z.createRef()),yi(this,"isRenamingExistingSet",oe((t,n)=>n!==void 0&&t.some(i=>{var{id:a}=i;return a===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}}componentDidMount(){var{isValueShown:e}=this.props;e?this.updateSelectedId():this.initSettingsScreen()}componentDidUpdate(e,t){var{isValueShown:n,filterSets:i}=this.props,{modifiedFilterSets:a}=this.state;if(e.isValueShown&&!n&&this.initSettingsScreen(),this.isNameInputScreen()&&!this.isNameInputScreen(t)&&this.focusRenameInput(),i!==e.filterSets)if(!n&&i.length>0&&e.filterSets.length===0&&a.length===0){var{onChange:o}=this.props;o({isValueShown:!0,selectedId:i[0].id})}else this.updateSelectedId()}initSettingsScreen(){var{filterSets:e,selectedId:t}=this.props;Ae.debug("initSettingsScreen",e,t),this.setState({modifiedFilterSets:[...e],editId:t})}updateSelectedId(){var{isValueShown:e,filterSets:t,selectedId:n,onChange:i}=this.props;if(Ae.debug("updateSelectedId",t,n),!!e&&!t.some(o=>{var{id:s}=o;return s===n})){var a=t.length===0;i({isValueShown:!a,selectedId:a?void 0:t[0].id})}}handleEditDropdownChange(e){this.setState({editId:e})}handleFilterChange(e){var t=e,{isValueShown:n,onChange:i}=this.props;this.applyFilterSet(t),i({isValueShown:n,selectedId:t})}handleFilterApply(){var{selectedId:e}=this.props;this.applyFilterSet(e)}handleSettingsCancel(){var{onChange:e,selectedId:t,filterSets:n}=this.props;this.setState({modifiedFilterSets:[]}),n.length>0&&e({isValueShown:!0,selectedId:t})}handleSettingsSave(){var{onChange:e,onUpdateSets:t}=this.props,{modifiedFilterSets:n,editId:i}=this.state;this.setState({modifiedFilterSets:[]}),Ae.debug("Update sets",n,i),t(n),n.length>0&&e({isValueShown:!0,selectedId:i})}handleCaptureNewSet(){var{getFilterState:e}=this.props;ja.animateScreenFlash();var t=Ue(),n=e(),i={id:t,title:"",panels:n};Ae.debug("handleSetCreate",i),this.setState({nameInputValue:"",nameInputError:void 0,renameSet:i})}handleRenameCancel(){this.setState({renameSet:void 0})}handleRestoreFullStateChange(e){this.setState({restoreFullState:e.target.value==="true"})}getNameError(e){var t,{renameSet:n,modifiedFilterSets:i}=this.state,a=(t=e==null?void 0:e.trim())!==null&&t!==void 0?t:"";if(a.length===0)return Ae.debug("Name cannot be empty",a),"Name cannot be empty";if(n!==void 0&&i.some(o=>{var{title:s,id:l}=o;return s===a&&l!==n.id}))return Ae.debug("Set with this name already exists",a),"Set with this name already exists"}handleRenameConfirm(){var e,{nameInputValue:t,renameSet:n,modifiedFilterSets:i,restoreFullState:a}=this.state;if(n===void 0){Ae.error("Renamed set undefined.");return}var o=this.getNameError(t);if(Ae.debug("handleRenameConfirm",t,o),o!==void 0){this.setState({nameInputError:o});return}var s=(e=t==null?void 0:t.trim())!==null&&e!==void 0?e:"",l=va(va({},n),{},{title:s,restoreFullState:a}),d=i.findIndex(c=>{var{id:m}=c;return m===n.id}),u=[...i];d>=0?(u[d]=l,Ae.debug("Renamed existing set",u)):(u.push(l),Ae.debug("Added new set to modified sets",u)),this.setState({editId:l.id,modifiedFilterSets:u,renameSet:void 0})}handleSetDelete(){this.setState(e=>{var{editId:t,modifiedFilterSets:n}=e,i=n.findIndex(l=>{var{id:d}=l;return d===t});if(i<0)return Ae.error("Unable to find selected filterSet index",n,t),null;var a=n.filter(l=>{var{id:d}=l;return d!==t}),o=Math.max(0,Math.min(a.length-1,i-1)),s=a.length>0?a[o].id:void 0;return Ae.debug("Deleted selected set",t,n,a),Ae.debug("New selection",o,s),{modifiedFilterSets:a,editId:s}})}handleSetUpdate(){var{getFilterState:e}=this.props;ja.animateScreenFlash();var t=e();this.setState(n=>{var{modifiedFilterSets:i,editId:a}=n;if(a===void 0)return Ae.error("Filter for update not selected."),null;var o=[...i],s=o.findIndex(l=>{var{id:d}=l;return d===a});return s<0?(Ae.error("Selected set for update not found."),null):(o[s]=va(va({},o[s]),{},{panels:t}),Ae.debug("Update set",o,t),{modifiedFilterSets:o})})}handleSetEdit(){this.setState(e=>{var{editId:t,modifiedFilterSets:n}=e,i=n.find(s=>{var{id:l}=s;return l===t});if(i===void 0)return Ae.error("Could not find selected set",t,n),null;var{title:a,restoreFullState:o=!1}=i;return{nameInputValue:a,nameInputError:void 0,renameSet:i,restoreFullState:o}})}handleSettingsClick(e){e.stopPropagation();var{onChange:t,selectedId:n}=this.props;t({isValueShown:!1,selectedId:n})}handleBackgroundClick(e){Ae.debug("handleBackgroundClick"),e.target!==this.dropdownRef.current&&this.focusInput()}handleNameInputChange(e){var{value:t}=e.target,n=this.getNameError(t);this.setState({nameInputValue:t,nameInputError:n})}handleNameInputKeyPress(e){var{key:t}=e;t==="Enter"&&(e.preventDefault(),this.handleRenameConfirm())}isNameInputScreen(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.state,{renameSet:t}=e;return t!==void 0}applyFilterSet(e){var{onApply:t,filterSets:n}=this.props;if(e===void 0){Ae.debug("No filter selected");return}var i=n.find(a=>{var{id:o}=a;return o===e});if(i===void 0){Ae.debug("Selected id not found in filterSets",e,n);return}Ae.debug("Apply filterSet",i),t(i)}focusInput(){var e;(e=this.dropdownRef.current)===null||e===void 0||e.focus()}focusRenameInput(){var e;(e=this.renameInputRef.current)===null||e===void 0||e.focus()}render(){var{nameInputValue:e,nameInputError:t,editId:n,renameSet:i,modifiedFilterSets:a,restoreFullState:o}=this.state,{isValueShown:s,filterSets:l,selectedId:d}=this.props,u=this.isNameInputScreen(),c=this.isRenamingExistingSet(a,i),m=a.length===0,f=!u&&m&&l.length===0,g=!u&&!f,v=h.jsxs("div",{className:"fa-layers mr-3",children:[h.jsx(ue,{icon:Ao,mask:ul,transform:"shrink-1 down-5 right-7"}),h.jsx(ue,{icon:ov,className:"text-primary",transform:"shrink-6 down-5 right-7"})]}),p=h.jsxs("div",{className:"fa-layers",children:[h.jsx(ue,{icon:Ao,mask:ul,transform:"shrink-1 down-5 right-7"}),h.jsx(ue,{icon:sv,transform:"shrink-1 down-5 right-7"})]});return h.jsx("div",{className:"filter-set-manager fill-parent-absolute",children:h.jsxs(ws,{className:"w-100 h-100",isFlipped:s,children:[h.jsx("div",{className:"filter-set-manager-settings-card fill-parent-absolute",children:h.jsxs("div",{className:"filter-set-manager-card-content",children:[f&&h.jsxs("div",{children:[h.jsx(Y,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:v,children:"Capture filter set"}),h.jsx("div",{className:"py-3 text-muted small",children:"Takes a snapshot of the currently applied filters on all panels, allowing you to restore saved filter sets later."})]}),u&&h.jsxs("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container",children:[h.jsxs("div",{className:"form-group",children:[h.jsx("label",{children:c?"Edit set":"Name captured set"}),h.jsxs("div",{className:"name-input-container",children:[h.jsx("input",{type:"text",className:"input-set-name form-control",placeholder:g_,value:e,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),h.jsx(Y,{"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:Fh}),h.jsx(Y,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:av})]}),t!==void 0&&h.jsx("div",{className:"error-message",children:t})]}),h.jsx("div",{className:"form-group",children:h.jsxs(rg,{onChange:this.handleRestoreFullStateChange,value:"".concat(o),children:[h.jsx(kl,{value:"false",children:"Restore only filters"}),h.jsx(kl,{value:"true",children:"Restore full table state"})]})})]}),g&&h.jsxs("div",{className:"filter-set-manager-settings-grid-1",children:[h.jsxs("div",{className:"form-group",children:[h.jsx("label",{children:"Edit filter sets"}),h.jsxs("div",{className:"filter-select-container",children:[h.jsxs(Vr,{"data-testid":"settings-card-filter-select",ref:this.editDropdownRef,value:n??"-1",className:"custom-select filter-value-select",onChange:this.handleEditDropdownChange,disabled:m,children:[m&&h.jsx("option",{value:"-1",disabled:!0,children:Fu}),a.map(C=>{var{id:S,title:y}=C;return h.jsx("option",{value:S,children:y},S)})]}),h.jsx(Y,{kind:"ghost",onClick:this.handleSetUpdate,disabled:m,icon:p,tooltip:"Update"}),h.jsx(Y,{kind:"ghost",onClick:this.handleSetEdit,disabled:m,icon:Rh,tooltip:"Edit"}),h.jsx(Y,{kind:"ghost",onClick:this.handleSetDelete,disabled:m,icon:ki,tooltip:"Delete"})]})]}),h.jsx("div",{children:h.jsx(Y,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:v,children:"Capture new filter set"})}),h.jsxs("div",{className:"py-3 text-right",children:[h.jsx(Y,{kind:"secondary",onClick:this.handleSettingsCancel,children:"Cancel"})," ",h.jsx(Y,{kind:"primary",onClick:this.handleSettingsSave,children:"Save"})]})]})]})},"front"),h.jsxs("div",{className:"filter-set-manager-value-card fill-parent-absolute",onClick:this.handleBackgroundClick,children:[h.jsx("div",{className:"filter-set-manager-column",children:h.jsx("div",{className:"filter-set-manager-column-title",children:"Filter sets"})}),h.jsx("div",{className:"filter-set-manager-card-content",children:h.jsx("div",{className:"filter-set-manager-value-input",children:h.jsxs("div",{className:"filter-select-container",children:[h.jsxs(Vr,{"data-testid":"value-card-filter-select",ref:this.dropdownRef,value:d??"-1",className:"custom-select filter-value-select",onChange:this.handleFilterChange,children:[l.length===0&&h.jsx("option",{value:"-1",disabled:!0,children:Fu}),l.map(C=>{var{id:S,title:y}=C;return h.jsx("option",{value:S,children:y},S)})]}),h.jsx(Y,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:Lh,tooltip:"Apply Filter Set"})]})})}),h.jsx("div",{className:"filter-set-manager-menu",children:h.jsx(Y,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:h.jsx(ue,{icon:Va,transform:"grow-4"})})})]},"back")]})})}}const Fm=ja;function Xs(r){var e,t,n,i,a,{model:o,widgetName:s,glContainer:l,description:d}=r,u=((e=o==null?void 0:o.rowCount)!==null&&e!==void 0?e:0)-((t=o==null?void 0:o.pendingRowCount)!==null&&t!==void 0?t:0)-((n=o==null?void 0:o.floatingBottomRowCount)!==null&&n!==void 0?n:0)-((i=o==null?void 0:o.floatingTopRowCount)!==null&&i!==void 0?i:0),c=o==null?void 0:o.displayString(u,"long"),m=(a=o==null?void 0:o.columnCount)!==null&&a!==void 0?a:0,f=o==null?void 0:o.displayString(m,"long");return h.jsxs(zi,{widgetType:"Table",widgetName:s,glContainer:l,description:d,children:[h.jsx("hr",{className:"tab-tooltip-divider"}),h.jsx("span",{children:"Number of Columns"}),h.jsx("span",{className:"tab-tooltip-statistic-value",children:f}),h.jsx("span",{children:"Number of Rows"}),h.jsx("span",{className:"tab-tooltip-statistic-value",children:c})]})}Xs.propTypes={glContainer:ks.Container.isRequired,widgetName:O.string.isRequired,description:O.string};Xs.defaultProps={description:null};function Rm(r){if(r==null)return!1;var e=r;return typeof e.table=="string"}function Lm(r){if(r==null)return!1;var e=r;return typeof e.name=="string"}function Ru(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function An(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ru(Object(t),!0).forEach(function(n){Ke(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ru(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ke(r,e,t){return e=b_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function b_(r){var e=C_(r,"string");return typeof e=="symbol"?e:String(e)}function C_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var en=z.module("IrisGridPanel"),y_=500,S_={IrisGrid:Ya,IrisGridTableModel:um,ContextMenuRoot:pv};function Lu(r){if(r==null)throw new Error("No metadata provided");if(Lm(r))return r.name;if(Rm(r))return r.table;throw new Error("Unable to determine table name from metadata: ".concat(JSON.stringify(r)))}class Gr extends b.PureComponent{constructor(e){super(e),Ke(this,"irisGrid",void 0),Ke(this,"pluginRef",void 0),Ke(this,"modelPromise",void 0),Ke(this,"irisGridState",void 0),Ke(this,"gridState",void 0),Ke(this,"pluginState",void 0),Ke(this,"irisGridUtils",void 0),Ke(this,"getGridInputFilters",oe((n,i)=>Ne.getInputFiltersForColumns(n,i.filter(a=>{var{value:o,excludePanelIds:s}=a,l=A.getIdFromPanel(this);return o!=null&&(s==null||l!=null&&!s.includes(l))})))),Ke(this,"getAlwaysFetchColumns",oe((n,i)=>{for(var a=A.getIdFromPanel(this),o=new Set(i),s=0;s<n.length;s+=1){var{start:l}=n[s];l!=null&&l.panelId===a&&o.add(l.columnName)}return[...o]})),Ke(this,"getPluginContent",oe((n,i,a,o,s)=>{if(!i||!ur(i)||n==null||i.table==null)return null;var l={panel:this,onFilter:this.handlePluginFilter,onFetchColumns:this.handlePluginFetchColumns,user:a,workspace:o,components:S_};return h.jsx("div",{className:"iris-grid-plugin",children:h.jsx(n,An({ref:this.pluginRef,filter:this.handlePluginFilter,fetchColumns:this.handlePluginFetchColumns,model:i,table:i.table,onStateChange:this.handlePluginStateChange,pluginState:s},l))})})),Ke(this,"getDehydratedIrisGridPanelState",oe((n,i,a,o)=>Ne.dehydrateIrisGridPanelState(n,{isSelectingPartition:i,partitions:a,advancedSettings:o}))),Ke(this,"getDehydratedIrisGridState",oe((n,i,a,o,s,l,d,u,c,m,f,g,v,p,C,S,y,w,E,D,M,_)=>(I(this.irisGridUtils),this.irisGridUtils.dehydrateIrisGridState(n,{advancedFilters:a,aggregationSettings:y,customColumnFormatMap:o,isFilterBarShown:s,metrics:{userColumnWidths:C,userRowHeights:S},quickFilters:l,customColumns:d,reverseType:u,rollupConfig:c,showSearchBar:m,searchValue:f,selectDistinctColumns:g,selectedSearchColumns:v,sorts:i,invertSearchColumns:p,pendingDataMap:w,frozenColumns:E,conditionalFormats:D,columnHeaderGroups:M,partitionConfig:_})))),Ke(this,"getDehydratedGridState",oe((n,i,a,o,s)=>Ne.dehydrateGridState(n,{isStuckToBottom:o,isStuckToRight:s,movedColumns:i,movedRows:a}))),Ke(this,"getCachedPanelState",oe((n,i,a,o)=>({irisGridPanelState:n,irisGridState:i,gridState:a,pluginState:o}))),Ke(this,"savePanelState",It(()=>{var{irisGridState:n,gridState:i,pluginState:a}=this;I(n);var{onPanelStateUpdate:o}=this.props,{model:s,panelState:l,isSelectingPartition:d,partitions:u,advancedSettings:c}=this.state,{advancedFilters:m,aggregationSettings:f,customColumnFormatMap:g,isFilterBarShown:v,quickFilters:p,customColumns:C,reverseType:S,rollupConfig:y,showSearchBar:w,searchValue:E,selectDistinctColumns:D,selectedSearchColumns:M,sorts:_,invertSearchColumns:T,metrics:N,pendingDataMap:x,frozenColumns:F,conditionalFormats:k,columnHeaderGroups:U,partitionConfig:H}=n;I(s),I(N);var{userColumnWidths:W,userRowHeights:X}=N;I(i);var{isStuckToBottom:le,isStuckToRight:me,movedColumns:ve,movedRows:j}=i,R=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(s,d,u,c),this.getDehydratedIrisGridState(s,_,m,g,v,p,C,S,y,w,E,D,M,T,W,X,f,x,F,k,U,H),this.getDehydratedGridState(s,ve,j,le,me),a);R!==l&&(en.debug("Saving panel state",this,R),this.setState({panelState:R}),o==null||o(R))},y_)),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.handleCreateChart=this.handleCreateChart.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=Z.createRef(),this.pluginRef=Z.createRef();var{panelState:t}=e;this.pluginState=null,this.irisGridUtils=null,this.state={error:null,isDisconnected:!1,isLoaded:!1,isLoading:!0,isModelReady:!1,model:void 0,advancedFilters:new Map,aggregationSettings:{aggregations:[],showOnTop:!1},advancedSettings:new Map(Bc.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:P.REVERSE_TYPE.NONE,movedColumns:[],movedRows:[],isSelectingPartition:!1,partitions:[],rollupConfig:void 0,showSearchBar:!1,searchValue:"",selectedSearchColumns:void 0,invertSearchColumns:!0,Plugin:void 0,pluginFilters:[],pluginFetchColumns:[],modelQueue:[],pendingDataMap:new Map,frozenColumns:void 0,panelState:t,irisGridStateOverrides:{},gridStateOverrides:{},isStuckToBottom:!1,isStuckToRight:!1,conditionalFormats:[],selectDistinctColumns:[]}}componentDidMount(){this.initModel()}componentDidUpdate(e,t){var{model:n}=this.state,{makeModel:i}=this.props;n!==t.model&&(t.model!=null&&(this.stopModelListening(t.model),t.model.close()),n!=null&&this.startModelListening(n)),i!==e.makeModel&&this.initModel()}componentWillUnmount(){this.savePanelState.cancel(),this.modelPromise!=null&&(this.modelPromise.cancel(),this.modelPromise=void 0);var{model:e}=this.state;e&&(this.stopModelListening(e),e.close())}getTableName(){var{metadata:e}=this.props;return Lu(e)}initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});var{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=we.makeCancelable(e(),t=>t.close()),this.modelPromise.then(this.handleLoadSuccess).catch(this.handleLoadError)}handleLoadSuccess(e){var t=e,{panelState:n,irisGridStateOverrides:i}=this.state,a=[];if(this.irisGridUtils=new Ne(t.dh),n!=null){var{irisGridState:o}=n,{aggregationSettings:s,customColumns:l,selectDistinctColumns:d=[],rollupConfig:u}=An(An({},o),i);l.length>0&&a.push(c=>{c.customColumns=l}),u!=null&&u.columns.length>0&&a.push(c=>{c.rollupConfig=Ne.getModelRollupConfig(c.originalColumns,u,s)}),d.length>0&&a.push(c=>{c.selectDistinctColumns=d})}this.setState({model:t,modelQueue:a}),this.initModelQueue(t,a)}initModelQueue(e,t){var n=e;if(t.length===0){this.modelInitialized(n);return}var i=t.shift();en.debug("initModelQueue",i),i&&i(n),this.setState({modelQueue:t})}handleAdvancedSettingsChange(e,t){en.debug("handleAdvancedSettingsChange",e,t),this.setState(n=>{var{advancedSettings:i}=n;return i.get(e)===t?null:{advancedSettings:new Map(i).set(e,t)}})}handlePluginFilter(e){var t,n,{model:i}=this.state;I(i);var{columns:a,formatter:o}=i,s=(t=(n=this.irisGridUtils)===null||n===void 0?void 0:n.getFiltersFromInputFilters(a,e,o.timeZone))!==null&&t!==void 0?t:[];this.setState({pluginFilters:s})}handlePluginFetchColumns(e){this.setState({pluginFetchColumns:e})}handleContextMenu(e){var t,n,i;return(t=(n=this.pluginRef.current)===null||n===void 0||(i=n.getMenu)===null||i===void 0?void 0:i.call(n,e))!==null&&t!==void 0?t:[]}isColumnSelectionValid(e){var{columnSelectionValidator:t}=this.props;return t&&e?t(this,e):!1}handleGridStateChange(e,t){this.irisGridState=e,this.gridState=t,this.setState({isLoaded:!0,isLoading:!1}),this.savePanelState();var{glEventHub:n,onStateChange:i}=this.props;n.emit(jt.STATE_CHANGED,this),i==null||i(e,t)}handlePluginStateChange(e){var{irisGridState:t,gridState:n}=this;this.pluginState=e,t!==null&&n!==null&&this.savePanelState()}handleColumnsChanged(e){var{isModelReady:t,model:n,modelQueue:i}=this.state;t?this.sendColumnsChange(e.detail):(I(n),this.initModelQueue(n,i))}handleTableChanged(e){en.debug("handleTableChanged",e);var{glEventHub:t}=this.props,{detail:n}=e;t.emit(Ve.TABLE_CHANGED,this,n)}handleCreateChart(e,t){this.savePanelState.flush(),this.setState(()=>null,()=>{var{glEventHub:n,inputFilters:i}=this.props,a=this.getTableName(),{panelState:o}=this.state,s=A.getIdFromPanel(this),l;o&&(l=Ne.extractTableSettings(o,i)),n.emit(jt.CREATE_CHART,{metadata:{settings:e,sourcePanelId:s,table:a,tableSettings:l},table:ur(t)?t.table:void 0})})}handleColumnSelected(e){var{glEventHub:t}=this.props;t.emit(jt.COLUMN_SELECTED,this,e)}handleDataSelected(e,t){var{glEventHub:n}=this.props;n.emit(jt.DATA_SELECTED,this,t)}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){en.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){we.isCanceled(e)||this.handleError(e)}modelInitialized(e){var{glEventHub:t,loadPlugin:n}=this.props;if(this.modelPromise=void 0,this.loadPanelState(e),this.setState({isModelReady:!0}),ur(e)){var{table:i}=e,{pluginName:a}=i;if(a!==""&&n!=null&&a!=null){var o=n(a);this.setState({Plugin:o})}t.emit(Ve.TABLE_CHANGED,this,i)}this.sendColumnsChange(e.columns)}handleClearAllFilters(){var e=this.irisGrid.current,{isDisconnected:t}=this.state;e!=null&&!t&&e.clearAllFilters()}sendColumnsChange(e){en.debug2("sendColumnsChange",e);var{glEventHub:t}=this.props;t.emit(Ve.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(ce.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(ce.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(ce.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(ce.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(ce.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(ce.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(ce.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){var t,n,i,{model:a}=this.state;if(!a)return null;var o=this.irisGrid.current,{gridWrapper:s}=o||{},l=(t=s==null?void 0:s.getBoundingClientRect())!==null&&t!==void 0?t:null;if(l==null||l.width<=0||l.height<=0)return null;I(o);var{metrics:d}=o.state;I(d);var{columnHeaderHeight:u,allColumnXs:c,allColumnWidths:m,right:f,columnHeaderMaxDepth:g}=d,v=a.getColumnIndexByName(e);I(v);var p=o.getVisibleColumn(v),C=(n=c.get(p))!==null&&n!==void 0?n:0,S=(i=m.get(p))!==null&&i!==void 0?i:0,y=Math.max(l.left,Math.min(p>f?l.right:l.left+C+S*.5,l.right)),w=l.top+u*g;return[y,w]}setFilterMap(e){var t=this.irisGrid.current;t!=null&&t.setFilterMap(e)}setAdvancedFilterMap(e){var t=this.irisGrid.current;t!=null&&t.setAdvancedFilterMap(e)}setFilters(e){var{quickFilters:t,advancedFilters:n}=e;en.debug("setFilters",t,n);var{model:i,isDisconnected:a}=this.state,o=this.irisGrid.current;if(o==null||a){en.debug("Ignore setFilters, model disconnected");return}I(i);var{columns:s,formatter:l}=i,d=Ne.changeFilterColumnNamesToIndexes(i.columns,t).filter(c=>{var[m]=c;return i.isFilterable(m)}),u=Ne.changeFilterColumnNamesToIndexes(i.columns,n).filter(c=>{var[m]=c;return i.isFilterable(m)});I(this.irisGridUtils),o.clearAllFilters(),o.setFilters({quickFilters:this.irisGridUtils.hydrateQuickFilters(s,d,l.timeZone),advancedFilters:this.irisGridUtils.hydrateAdvancedFilters(s,u,l.timeZone)})}setStateOverrides(e){en.debug("setStateOverrides",e);var{irisGridState:t,gridState:n}=e;this.setState({irisGridStateOverrides:t,gridStateOverrides:n},()=>{this.initModel()})}unsetFilterValue(){}loadPanelState(e){var{panelState:t,irisGridStateOverrides:n,gridStateOverrides:i}=this.state;if(t!=null)try{var{gridState:a,irisGridState:o,irisGridPanelState:s}=t,l=An({},n),{quickFilters:d,advancedFilters:u}=l;d&&(l.quickFilters=Ne.changeFilterColumnNamesToIndexes(e.columns,d)),u&&(l.advancedFilters=Ne.changeFilterColumnNamesToIndexes(e.columns,u));var{isSelectingPartition:c,partitions:m,advancedSettings:f}=Ne.hydrateIrisGridPanelState(e,s);I(this.irisGridUtils);var{advancedFilters:g,customColumns:v,customColumnFormatMap:p,isFilterBarShown:C,quickFilters:S,reverseType:y,rollupConfig:w,aggregationSettings:E,sorts:D,userColumnWidths:M,userRowHeights:_,showSearchBar:T,searchValue:N,selectDistinctColumns:x,selectedSearchColumns:F,invertSearchColumns:k,pendingDataMap:U,frozenColumns:H,conditionalFormats:W,columnHeaderGroups:X,partitionConfig:le}=this.irisGridUtils.hydrateIrisGridState(e,An(An({},o),l)),{isStuckToBottom:me,isStuckToRight:ve,movedColumns:j,movedRows:R}=Ne.hydrateGridState(e,An(An({},a),i),o.customColumns);this.setState({advancedFilters:g,advancedSettings:f,conditionalFormats:W,customColumns:v,customColumnFormatMap:p,isFilterBarShown:C,isSelectingPartition:c,movedColumns:j,movedRows:R,partitions:m,quickFilters:S,reverseType:y,rollupConfig:w,aggregationSettings:E,sorts:D,userColumnWidths:M,userRowHeights:_,showSearchBar:T,searchValue:N,selectDistinctColumns:x,selectedSearchColumns:F,invertSearchColumns:k,pendingDataMap:U,frozenColumns:H,isStuckToBottom:me,isStuckToRight:ve,columnHeaderGroups:X,partitionConfig:le})}catch($){en.error("loadPanelState failed to load panelState",t,$)}}updateGrid(){var e,t,n=(e=(t=this.irisGrid.current)===null||t===void 0?void 0:t.grid)!==null&&e!==void 0?e:null;n&&n.handleResize()}render(){var e,t,{children:n,glContainer:i,glEventHub:a,columnSelectionValidator:o,getDownloadWorker:s,inputFilters:l,links:d,metadata:u,panelState:c,user:m,workspace:f,settings:g,theme:v}=this.props,{advancedFilters:p,aggregationSettings:C,advancedSettings:S,conditionalFormats:y,customColumns:w,customColumnFormatMap:E,error:D,isDisconnected:M,isFilterBarShown:_,isSelectingPartition:T,isStuckToBottom:N,isStuckToRight:x,isLoaded:F,isLoading:k,isModelReady:U,model:H,movedColumns:W,movedRows:X,partitions:le,partitionConfig:me,quickFilters:ve,reverseType:j,rollupConfig:R,sorts:$,userColumnWidths:G,userRowHeights:te,showSearchBar:Me,searchValue:V,selectDistinctColumns:ne,selectedSearchColumns:de,invertSearchColumns:Ee,Plugin:Le,pluginFilters:ni,pluginFetchColumns:wr,pendingDataMap:ri,frozenColumns:nr,columnHeaderGroups:sf}=this.state,lf=D!=null?"Unable to open table. ".concat(D):void 0,rl=Lu(u),il=(e=H==null?void 0:H.description)!==null&&e!==void 0?e:void 0,df=(t=c==null?void 0:c.pluginState)!==null&&t!==void 0?t:null,uf=n??this.getPluginContent(Le,H,m,f,df),{permissions:hf}=m,{canCopy:cf,canDownloadCsv:mf}=hf;return h.jsx(Ki,{errorMessage:lf,isDisconnected:M,isLoading:k,isLoaded:F,className:"iris-grid-panel",glContainer:i,glEventHub:a,onClearAllFilters:this.handleClearAllFilters,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,widgetName:rl,widgetType:"Table",description:il,componentPanel:this,renderTabTooltip:()=>h.jsx(Xs,{model:H,widgetName:rl,glContainer:i,description:il}),children:U&&H&&h.jsx(Ya,{advancedFilters:p,aggregationSettings:C,advancedSettings:S,alwaysFetchColumns:this.getAlwaysFetchColumns(d,wr),columnAllowedCursor:"linker",columnNotAllowedCursor:"linker-not-allowed",copyCursor:"copy",customColumns:w,customColumnFormatMap:E,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:y,inputFilters:this.getGridInputFilters(H.columns,l),applyInputFiltersOnInit:c==null,isFilterBarShown:_,isSelectingColumn:o!=null,isSelectingPartition:T,isStuckToBottom:N,isStuckToRight:x,movedColumns:W,movedRows:X,partitions:le,partitionConfig:me,quickFilters:ve,reverseType:j,rollupConfig:R,settings:g,sorts:$,userColumnWidths:G,userRowHeights:te,model:H,showSearchBar:Me,searchValue:V,selectedSearchColumns:de,selectDistinctColumns:ne,invertSearchColumns:Ee,onColumnSelected:this.handleColumnSelected,onCreateChart:this.handleCreateChart,onDataSelected:this.handleDataSelected,onError:this.handleError,onStateChange:this.handleGridStateChange,onContextMenu:this.handleContextMenu,onAdvancedSettingsChange:this.handleAdvancedSettingsChange,customFilters:ni,pendingDataMap:ri,canCopy:cf,canDownloadCsv:mf,ref:this.irisGrid,getDownloadWorker:s,frozenColumns:nr,theme:v,columnHeaderGroups:sf,children:uf})})}}Ke(Gr,"defaultProps",{onStateChange:()=>{},onPanelStateUpdate:()=>{}});Ke(Gr,"displayName","IrisGridPanel");Ke(Gr,"COMPONENT","IrisGridPanel");var w_=(r,e)=>{var{localDashboardId:t=qS}=e;return{inputFilters:no(r,t),links:Sr(r,t),columnSelectionValidator:ao(r,t),user:Ly(r),workspace:Nc(r),settings:Ui(r)}},E_=Ht(w_,null,null,{forwardRef:!0})(Gr);const zr=E_;function Oi(r,e,t){return e=P_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function P_(r){var e=T_(r,"string");return typeof e=="symbol"?e:String(e)}function T_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Au=z.module("InputFilter"),__=150;class Kr extends b.Component{constructor(e){super(e),Oi(this,"inputRef",void 0),Oi(this,"getItemLabel",qe((a,o)=>{var{name:s,type:l}=a[o];if(o>0&&a[o-1].name===s||o<a.length-1&&a[o+1].name===s){var d=l.substring(l.lastIndexOf(".")+1);return"".concat(s," (").concat(d,")")}return s})),Oi(this,"sendUpdate",It(()=>{var{onChange:a}=this.props,{column:o,value:s,isValueShown:l}=this.state;a({column:o,isValueShown:l,value:s})},__)),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.inputRef=Z.createRef();var{column:t,isValueShown:n,value:i}=e;this.state={column:t,selectedColumn:t,value:i,isValueShown:n}}componentDidUpdate(e,t){var{column:n}=this.props,{column:i,value:a,isValueShown:o}=this.state;n!==e.column&&this.setState({column:n,selectedColumn:n}),o!==void 0&&o&&o!==t.isValueShown&&this.focusInput(),(i!==t.column||a!==t.value||o!==t.isValueShown)&&this.sendUpdate()}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){var{columns:t}=this.props,n=t[parseInt(e,10)];Au.debug2("handleColumnChange",n),this.setState({selectedColumn:n,value:void 0})}handleInputKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),this.setState(t=>{var{value:n}=t;return n==null?{value:""}:null},()=>{this.sendUpdate(),this.sendUpdate.flush()}))}handleValueChange(e){var{value:t}=e.target;Au.debug2("handleValueChange",t),this.setState({value:t})}handleSettingsCancel(){var{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!0})}handleSettingsSave(){var{selectedColumn:e}=this.state;this.setState({column:e,isValueShown:!0})}handleSettingsClick(e){var{column:t}=this.state;this.setState({selectedColumn:t,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(e){var{name:t,type:n,value:i,isValueShown:a}=e,o=t!=null&&n!=null?{name:t,type:n}:void 0,s=a===void 0?{column:o,value:i}:{column:o,value:i,isValueShown:a};this.setState(s)}render(){var{columns:e}=this.props,{column:t,isValueShown:n,selectedColumn:i,value:a}=this.state,o=a==null||a.length===0?Kr.PLACEHOLDER.length:a.length,s=null;if(t!=null){var l=e.findIndex(d=>d.name===t.name&&d.type===t.type);s=l>=0?this.getItemLabel(e,l):t.name}return h.jsxs(ws,{className:"input-filter fill-parent-absolute",isFlipped:n??!1,children:[h.jsx("div",{className:"input-filter-settings-card",children:h.jsxs("div",{className:"input-filter-settings-content",children:[h.jsxs("div",{className:"input-filter-settings-grid",children:[h.jsx("label",{children:"Filter Column"}),h.jsxs(Vr,{value:String(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,children:[e.map((d,u)=>h.jsx("option",{value:u,children:this.getItemLabel(e,u)},"".concat(d.name,"/").concat(d.type))),e.length===0&&h.jsx("option",{value:"-1",disabled:!0,children:"No Available Columns"})]}),h.jsx("div",{className:"text-muted small",children:"Input filter control will apply its filter to all columns matching this name in this dashboard."})]}),h.jsxs("div",{className:"input-filter-settings-buttons",children:[h.jsx(Y,{kind:"secondary",onClick:this.handleSettingsCancel,disabled:t==null,children:"Cancel"}),h.jsx(Y,{kind:"primary",className:"ml-2",onClick:this.handleSettingsSave,disabled:i==null,children:"Save"})]})]})}),h.jsxs("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick,children:[h.jsx("div",{className:"input-filter-column",children:h.jsxs("div",{className:"input-filter-column-title",children:[s," Filter"]})}),h.jsx("div",{className:"d-flex justify-content-center align-items-center h-100 w-100",children:h.jsx("div",{className:"input-filter-value-input d-flex flex-column justify-content-center",children:h.jsx("input",{type:"text",ref:this.inputRef,placeholder:Kr.PLACEHOLDER,value:a??"",onChange:this.handleValueChange,onKeyPress:this.handleInputKeyPress,style:{width:"".concat(o+3,"ch")},spellCheck:"false"})})}),h.jsx("div",{className:"input-filter-menu",children:h.jsx(Y,{kind:"ghost",className:"m-2 px-2",onClick:this.handleSettingsClick,icon:h.jsx(ue,{icon:Va,transform:"grow-4"}),tooltip:"Input Filter Settings"})})]})]})}}Oi(Kr,"PLACEHOLDER","Enter value...");Oi(Kr,"defaultProps",{column:null,isValueShown:!1,value:null});const O_=Kr;function ho(r,e,t){return e=D_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function D_(r){var e=M_(r,"string");return typeof e=="symbol"?e:String(e)}function M_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var I_=250;class co extends b.Component{constructor(e){super(e),ho(this,"inputFilterRef",void 0),this.handleChange=It(this.handleChange.bind(this),I_),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=Z.createRef();var{panelState:t}=e,{value:n,isValueShown:i=!1,name:a,type:o,timestamp:s}=t??{};this.state={columns:[],column:a!=null&&o!=null?{name:a,type:o}:void 0,value:n,timestamp:s,isValueShown:i,wasFlipped:!1,skipUpdate:!1,panelState:t}}componentDidMount(){this.updateColumns();var{column:e,value:t,timestamp:n}=this.state;if(e!=null){var{name:i,type:a}=e;this.sendUpdate(i,a,t,n)}}componentDidUpdate(e){var{columns:t}=this.props;t!==e.columns&&this.updateColumns()}handleChange(e){var{column:t,isValueShown:n=!1,value:i}=e,a,o;t!=null&&({name:a,type:o}=t);var s=!0,l=Date.now();this.setState(d=>{var u,{panelState:c,timestamp:m,wasFlipped:f,skipUpdate:g}=d,v=c!=null&&n!==c.isValueShown&&a===c.name&&o===c.type&&i===c.value;return s=(u=!g&&n&&(!v||!f))!==null&&u!==void 0?u:!1,s||(l=m),{panelState:{isValueShown:n,name:a,type:o,value:i,timestamp:l},timestamp:l,wasFlipped:v,skipUpdate:!1}},()=>{s&&this.sendUpdate(a,o,i,l)})}handleClearAllFilters(){var e;(e=this.inputFilterRef.current)===null||e===void 0||e.clearFilter()}sendUpdate(e,t,n,i){var{glEventHub:a}=this.props;a.emit(Ve.FILTERS_CHANGED,this,{name:e,type:t,value:n,timestamp:i})}setPanelState(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.setState({skipUpdate:!n}),(t=this.inputFilterRef.current)===null||t===void 0||t.setFilterState(e)}updateColumns(){var{columns:e}=this.props;e!=null&&this.setState(t=>{var{column:n}=t;return n==null&&e.length>0?{columns:[...e],column:e[0]}:n!=null&&!e.find(i=>{var{name:a,type:o}=i;return n.name===a&&n.type===o})?{columns:[...e,n]}:{columns:[...e]}})}render(){var{glContainer:e,glEventHub:t}=this.props,{column:n,columns:i,isValueShown:a,value:o}=this.state;return h.jsx(hn,{className:"iris-input-filter-panel",componentPanel:this,glContainer:e,glEventHub:t,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0,children:h.jsx(O_,{ref:this.inputFilterRef,column:n,columns:i,onChange:this.handleChange,isValueShown:a,value:o})})}}ho(co,"defaultProps",{panelState:null});ho(co,"COMPONENT","InputFilterPanel");ho(co,"displayName","InputFilterPanel");var N_=(r,e)=>{var{localDashboardId:t}=e;return{columns:Ws(r,t)}},x_=Ht(N_,null,null,{forwardRef:!0})(co);const $r=x_;function ku(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function pa(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ku(Object(t),!0).forEach(function(n){Zs(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ku(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Zs(r,e,t){return e=F_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function F_(r){var e=R_(r,"string");return typeof e=="symbol"?e:String(e)}function R_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var rt=z.module("FilterSetManagerPanel");function L_(r){return r.setPanelState!=null}class qr extends b.Component{static changeFilterIndexesToColumnNames(e,t){return t.map(n=>{var[i,a]=n;if(i>=e.columns.length)return null;var{name:o}=e.columns[i];return{name:o,filter:a}}).filter(n=>n!=null)}constructor(e){super(e),this.handleChange=this.handleChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleSetsUpdate=this.handleSetsUpdate.bind(this),this.handleGetFilterState=this.handleGetFilterState.bind(this);var{panelState:t,filterSets:n}=e,{selectedId:i=n.length>0?n[0].id:void 0,isValueShown:a=!1}=t??{};this.state={selectedId:i,isValueShown:a,panelState:t}}getFilterState(){var{dashboardOpenedPanelMap:e}=this.props,t=[];return[...e.keys()].forEach(n=>{var i=e.get(n);if(i===void 0){rt.error("Could not get panel",i);return}var a=A.getComponentNameFromPanel(i),o=A.getIdFromPanel(i);rt.debug("Panel:",i,a);var{glContainer:s=null}=i.props;if(s==null){rt.error("Could not get panel container",i);return}var l=A.getComponentConfigFromContainer(s);if(l==null){rt.error("Could not get component config from container",s);return}var d=A.getPanelComponentState(l);if(d==null){rt.debug("Panel state is null ".concat(o));return}switch(a){case A.getComponentName(Gr):{var u;o!=null&&(u=this.getIrisGridPanelFilters(o,d)),u!=null&&t.push({panelId:o,type:a,state:u});break}case A.getComponentName($r):case A.getComponentName(Zn):{var{isValueShown:c,name:m,type:f,value:g}=d;t.push({panelId:o,type:a,state:{isValueShown:c,name:m,type:f,value:g}});break}}}),t}getIrisGridPanelFilters(e,t){var{panelTableMap:n}=this.props,i=n.get(e);if(i==null)return rt.error("Unable to get table for panel ".concat(e,".")),null;var{irisGridState:a={advancedFilters:void 0,quickFilters:void 0},gridState:o={}}=t,{advancedFilters:s,quickFilters:l}=a,d;s&&(d=qr.changeFilterIndexesToColumnNames(i,s));var u;return l&&(u=qr.changeFilterIndexesToColumnNames(i,l)),{irisGridState:pa(pa({},a),{},{advancedFilters:d,quickFilters:u}),gridState:pa({},o)}}handleGetFilterState(){return this.getFilterState()}handleChange(e){var{isValueShown:t,selectedId:n}=e;rt.debug("handleChange",t,n),this.setState({isValueShown:t,selectedId:n}),this.updatePanelState()}handleFilterApply(e){var{dashboardOpenedPanelMap:t}=this.props,{panels:n,restoreFullState:i=!1}=e;rt.debug("Apply filters from filter set",e),n.forEach(a=>{var{panelId:o,type:s,state:l}=a;if(o==null){rt.debug("panel is null",o);return}if(!t.has(o)){rt.debug("Ignore closed panel",o);return}rt.debug("Apply panel filters",o,s,l);var d=t.get(o);switch(s){case A.getComponentName(Gr):this.restoreIrisGridFilters(d,l,i);break;case A.getComponentName($r):case A.getComponentName(Zn):this.restoreInputFilterState(d,l);break}})}handleSetsUpdate(e){var{setDashboardFilterSets:t,localDashboardId:n}=this.props;rt.debug("Saving updated sets",e),t(n,[...e])}updatePanelState(){this.setState(e=>{var{selectedId:t,isValueShown:n}=e;return{panelState:{selectedId:t,isValueShown:n}}})}restoreIrisGridFilters(e,t,n){var{irisGridState:i={},advancedFilters:a=[],quickFilters:o=[]}=t,{advancedFilters:s=a,quickFilters:l=o}=i,{panelTableMap:d}=this.props,u=A.getIdFromPanel(e);if(u==null){rt.error("Panel Id is null.");return}var c=d.get(u);if(c==null){rt.error("Unable to get table for panel ".concat(u,"."));return}rt.debug("restoreIrisGridFilters",u,t,n),n?e.setStateOverrides(t):e.setFilters({quickFilters:l,advancedFilters:s})}restoreInputFilterState(e,t){var n=pa({},t);delete n.isValueShown,rt.debug("restoreInputFilterState",e,n),e&&L_(e)&&e.setPanelState(n)}render(){var{glContainer:e,glEventHub:t,filterSets:n}=this.props,{isValueShown:i,selectedId:a}=this.state;return h.jsx(hn,{className:"filter-set-manager-panel",componentPanel:this,glContainer:e,glEventHub:t,isClonable:!0,isRenamable:!0,children:h.jsx("div",{className:"input-filter-container h-100 w-100 container",children:h.jsx(Fm,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:i,filterSets:n,selectedId:a,getFilterState:this.handleGetFilterState})})})}}Zs(qr,"defaultProps",{panelState:null});Zs(qr,"COMPONENT","FilterSetManagerPanel");var A_=(r,e)=>{var{localDashboardId:t}=e;return{filterSets:Cm(r,t),dashboardOpenedPanelMap:$c(r,t),dashboardInputFilters:no(r,t),panelTableMap:ro(r,t)}},k_=Ht(A_,{setDashboardFilterSets:Pm},null,{forwardRef:!0})(qr);const Ea=k_;function Li(r,e,t){return e=j_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function j_(r){var e=$_(r,"string");return typeof e=="symbol"?e:String(e)}function $_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ju=z.module("LogPanel");class mo extends b.PureComponent{constructor(e){super(e),Li(this,"isBottomVisible",void 0),Li(this,"logView",void 0),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;var{session:t}=this.props;this.state={session:t}}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(e){ju.debug("Session opened",[e]),this.setState({session:e})}handleSessionClosed(e){ju.debug("Session closed",e)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){var{glContainer:e,glEventHub:t}=this.props,{session:n}=this.state;return h.jsxs(hn,{componentPanel:this,glContainer:e,glEventHub:t,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,children:[n==null&&h.jsx("div",{className:"log-panel-disconnected-message",children:"Waiting for session connection"}),n!=null&&h.jsx(z0,{session:n,ref:i=>{this.logView=i}})]})}}Li(mo,"defaultProps",{session:null});Li(mo,"COMPONENT","LogPanel");Li(mo,"TITLE","Log");var H_=(r,e)=>{var t;return{session:(t=ti(r,e.localDashboardId))===null||t===void 0?void 0:t.session}},V_=Ht(H_,null,null,{forwardRef:!0})(mo);const Am=V_;function U_(r,e,t){return e=B_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function B_(r){var e=W_(r,"string");return typeof e=="symbol"?e:String(e)}function W_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class km extends b.PureComponent{render(){var{isEditing:e,children:t,onDoubleClick:n}=this.props;return h.jsxs("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:n,children:[h.jsx("div",{className:J("text-muted","edit-hint",{viewing:e===void 0||!e}),children:h.jsxs("span",{children:["double-click to edit ",h.jsx(ue,{icon:Rh})]})}),t]})}}U_(km,"defaultProps",{isEditing:!1});function G_(r,e,t){return e=z_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function z_(r){var e=K_(r,"string");return typeof e=="symbol"?e:String(e)}function K_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var q_=z.module("MarkdownStartPage");class jm extends b.PureComponent{constructor(e){super(e),this.handleDeleteButtonClick=this.handleDeleteButtonClick.bind(this),this.handleDeleteModalClose=this.handleDeleteModalClose.bind(this),this.state={isDeleteModalShown:!1}}handleDeleteButtonClick(e){this.setState({isDeleteModalShown:!0,toBeDeleted:e})}handleDeleteModalClose(){this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}handleDeleteMarkdown(e){if(q_.debug("delete markdown: ",e),e!==void 0){var{onDelete:t}=this.props;t(e)}this.setState({isDeleteModalShown:!1,toBeDeleted:void 0})}render(){var{closedMarkdowns:e,onOpen:t,onCreate:n}=this.props,{isDeleteModalShown:i,toBeDeleted:a}=this.state;return h.jsx("div",{className:"markdown-panel-start-page h-100 w-100",children:h.jsxs("div",{className:"markdown-panel-start-page-container",children:[h.jsxs("div",{className:"markdown-panel-start-list",children:[h.jsx("h3",{className:"list-title",children:"Start"}),h.jsx("div",{className:"list-item",children:h.jsx(Y,{kind:"ghost",className:"title",onClick:n,children:"New Markdown Note"})})]}),h.jsxs("div",{className:"markdown-panel-start-list",children:[h.jsx("h3",{className:"list-title",children:"Recently Closed from Dashboard"}),e.map(o=>h.jsxs("div",{className:"list-item",children:[h.jsx(Y,{kind:"ghost",className:"title",onClick:()=>t(o),children:o.title}),h.jsx("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(o)},children:h.jsx(ue,{icon:ki})})]},o.id)),h.jsxs(us,{isOpen:i,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal",children:[h.jsx(hs,{children:"Are you sure you want to permanently delete this note?"}),h.jsx(cs,{children:"You can't undo this action."}),h.jsxs(Ss,{children:[h.jsx(Y,{kind:"secondary",onClick:this.handleDeleteModalClose,children:"Cancel"}),h.jsx(Y,{kind:"danger",onClick:()=>{this.handleDeleteMarkdown(a)},children:"Delete"})]})]})]})]})})}}G_(jm,"defaultProps",{closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}});const X_=jm;function Di(r,e,t){return e=Z_(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Z_(r){var e=Y_(r,"string");return typeof e=="symbol"?e:String(e)}function Y_(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Q_=b.lazy(()=>Ai(()=>import("./MarkdownEditor-568e6647.js"),["./MarkdownEditor-568e6647.js","./vendor-3c001961.js","./helpers-de833af9.js","./vendor-a4479904.css","./index-4a9bfe03.js","./index-7535fde1.css","./usePlugins-a4e842f0.js"],import.meta.url)),ga=z.module("MarkdownPanel");class Ys extends b.Component{constructor(e){super(e),Di(this,"markdownEditor",void 0),Di(this,"editor",void 0),Di(this,"getClosedMarkdowns",oe(i=>i.filter(a=>a.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);var{panelState:t}=e,n=null;t!=null&&t.content!=null&&({content:n}=t),this.state={isStartPageShown:n==null,isEditing:!1,content:n,panelState:t},this.markdownEditor=null}setEditorPosition(e){I(this.markdownEditor);var{container:t}=this.markdownEditor;if(this.editor&&t!=null){var n,i,a=t.getBoundingClientRect().top,o=t.scrollTop,s=t.scrollHeight,l=(n=(i=this.editor.getModel())===null||i===void 0?void 0:i.getLineCount())!==null&&n!==void 0?n:0,d=Math.round((o+e-a)/s*l);d>l&&(d=l),this.editor.revealLine(d),this.editor.setPosition({lineNumber:d,column:1}),this.editor.focus()}}handleContainerDoubleClick(e){var{isEditing:t}=this.state,n=e.clientY;t||this.setState({isEditing:!0},()=>{this.setEditorPosition(n)})}handleEditorInitialized(e){ga.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){ga.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor!=null&&this.editor.focus!=null&&this.editor.focus()})}handleOpenMarkdown(e){ga.debug("open markdown...",e);var{glContainer:t,glEventHub:n}=this.props,i=A.getComponentConfigFromContainer(t);n.emit(se.REOPEN,e,i)}handleDeleteMarkdown(e){var{glEventHub:t}=this.props;t.emit(se.DELETE,e)}handleEditorBlur(e){var t;ga.debug("markdown content changed, saving...");var{isEditing:n}=this.state;if(!(!n||this.markdownEditor!=null&&this.markdownEditor.container!=null&&this.markdownEditor.container.contains(e.relatedTarget))){var i=(t=this.editor)===null||t===void 0?void 0:t.getValue();this.setState({content:i,isEditing:!1,panelState:{content:i}})}}handleEditorResize(){var{isEditing:e}=this.state;e&&this.editor&&this.editor.layout()}render(){var{glContainer:e,glEventHub:t,closedPanels:n}=this.props,{isEditing:i,isStartPageShown:a,content:o}=this.state,s=this.getClosedMarkdowns(n);return h.jsx(hn,{glContainer:e,glEventHub:t,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0,children:a?h.jsx(X_,{closedMarkdowns:s,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):h.jsx(km,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick,children:h.jsx(b.Suspense,{fallback:h.jsx(dn,{}),children:h.jsx(Q_,{ref:l=>{this.markdownEditor=l},isEditing:i,content:o??void 0,onEditorInitialized:this.handleEditorInitialized})})})})}}Di(Ys,"defaultProps",{panelState:null});Di(Ys,"COMPONENT","MarkdownPanel");var J_=(r,e)=>{var{localDashboardId:t}=e;return{closedPanels:kS(r,t)}},eO=Ht(J_,null,null,{forwardRef:!0})(Ys);const Nr=eO;function $u(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Hu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){$u(a,n,i,o,s,"next",l)}function s(l){$u(a,n,i,o,s,"throw",l)}o(void 0)})}}function Vu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function gt(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vu(Object(t),!0).forEach(function(n){at(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Vu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function at(r,e,t){return e=tO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function tO(r){var e=nO(r,"string");return typeof e=="symbol"?e:String(e)}function nO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var rO=b.lazy(()=>Ai(()=>import("./MarkdownNotebook-b9d585db.js"),["./MarkdownNotebook-b9d585db.js","./vendor-3c001961.js","./helpers-de833af9.js","./vendor-a4479904.css","./index-4a9bfe03.js","./index-7535fde1.css","./usePlugins-a4e842f0.js","./MarkdownNotebook-9207e775.css"],import.meta.url)),pe=z.module("NotebookPanel"),Uu=400;class Je extends b.Component{static handleError(e){we.isCanceled(e)||pe.error(e)}static unsavedNotebookCount(){return document.querySelectorAll(".".concat(Je.UNSAVED_INDICATOR_CLASS_NAME,".").concat(Je.UNSAVED_STATUS_CLASS_NAME)).length}static languageFromFileName(e){var t=ie.getExtension(e).toLowerCase();switch(t){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}constructor(e){super(e),at(this,"pending",void 0),at(this,"debouncedSavePanelState",void 0),at(this,"debouncedLoad",void 0),at(this,"notebook",void 0),at(this,"tabTitleElement",void 0),at(this,"tabInitOnce",void 0),at(this,"editor",void 0),at(this,"getSettings",oe((m,f)=>gt(gt({},m),{},{minimap:{enabled:f}}))),at(this,"getOverflowActions",oe((m,f)=>[{title:"Find",icon:dv,action:this.handleFind,group:fe.groups.high,shortcut:mt.NOTEBOOK.FIND,order:10},{title:"Copy File",icon:_h,action:this.handleCopy,group:fe.groups.medium,order:20},{title:"Rename File",icon:uv,action:this.handleShowRename,group:fe.groups.medium,order:30},{title:"Delete File",icon:ki,action:this.handleDelete,group:fe.groups.medium,order:40},{title:"Show Minimap",icon:m?wi:void 0,action:this.handleMinimapChange,group:fe.groups.low,shortcut:mt.NOTEBOOK.MINIMAP,order:20},{title:"Word Wrap",icon:f?wi:void 0,action:this.handleWordWrapChange,group:fe.groups.low,shortcut:mt.NOTEBOOK.WORDWRAP,order:30}])),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.handleDelete=this.handleDelete.bind(this),this.handleDeleteConfirm=this.handleDeleteConfirm.bind(this),this.handleDeleteCancel=this.handleDeleteCancel.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorWillDestroy=this.handleEditorWillDestroy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleMinimapChange=this.handleMinimapChange.bind(this),this.handleWordWrapChange=this.handleWordWrapChange.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.handlePanelDropped=this.handlePanelDropped.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.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabClick=this.handleTabClick.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.handleOverwrite=this.handleOverwrite.bind(this),this.handlePreviewPromotion=this.handlePreviewPromotion.bind(this),this.getDropdownOverflowActions=this.getDropdownOverflowActions.bind(this),this.pending=new Qn,this.debouncedSavePanelState=It(this.savePanelState.bind(this),Uu),this.debouncedLoad=It(this.load.bind(this),Uu),this.notebook=null,this.tabTitleElement=null,this.tabInitOnce=!1;var{isDashboardActive:t,session:n,sessionLanguage:i,panelState:a}=e,o={value:"",language:"",wordWrap:"off"},s=null,{isPreview:l}=e;a!=null&&({fileMetadata:s=s,isPreview:l=l,settings:o=o}=a);var d=s!=null&&ie.hasPath(s.itemName),u=d===!0&&o.value!=null||!d&&o.value!=null&&o.value.length>0,c=u?1:0;this.state={error:void 0,isDashboardActive:t,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:l,savedChangeCount:0,changeCount:c,fileMetadata:s,settings:o,session:n,sessionLanguage:i,panelState:{fileMetadata:s,settings:o},showCloseModal:!1,showDeleteModal:!1,showSaveAsModal:!1,scriptCode:""},pe.debug("constructor",e,this.state)}componentDidMount(){var{glContainer:e,glEventHub:t}=this.props,{tab:n}=e;n!=null&&this.initTab(n),this.initNotebookContent(),t.on(Se.RENAME_FILE,this.handleRenameFile),t.on(se.DROPPED,this.handlePanelDropped),e.on(Se.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion)}componentDidUpdate(e,t){var{isPreview:n,settings:i}=this.state,{wordWrap:a}=i,{defaultNotebookSettings:o}=this.props;n!==t.isPreview&&this.setPreviewStatus(),a!==t.settings.wordWrap&&(this.updateEditorWordWrap(),this.debouncedSavePanelState()),o.isMinimapEnabled!==e.defaultNotebookSettings.isMinimapEnabled&&this.updateEditorMinimap()}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();var{glEventHub:e,glContainer:t}=this.props,{fileMetadata:n,isPreview:i}=this.state;e.off(Se.RENAME_FILE,this.handleRenameFile),e.off(se.DROPPED,this.handlePanelDropped),t.off(Se.PROMOTE_FROM_PREVIEW,this.handlePreviewPromotion),e.emit(Se.UNREGISTER_FILE,n,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){var{glContainer:e}=this.props;e.beforeClose(t=>{if((t==null?void 0:t.force)===!0)return!0;var{changeCount:n,savedChangeCount:i}=this.state;return n!==i?(this.setState({showCloseModal:!0}),!1):!0})}initTabClasses(e){var t=e.element.get(0);I(t);var n=t.querySelector(".lm_title");this.tabTitleElement=n,n==null||n.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){var{changeCount:e,savedChangeCount:t,settings:n}=this.state,{value:i}=n;if(e!==t&&this.notebook){var a=this.notebook.getValue();return a??i}return i}initNotebookContent(){var{fileMetadata:e,settings:t,isPreview:n}=this.state;if(e&&e.id){pe.debug("Init content from file"),this.registerFileMetadata(e,n),this.load();return}if(t.value!=null){pe.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){var{glEventHub:t}=this.props;t.emit(Se.CLOSE_FILE,{id:e})}registerFileMetadata(e,t){var{glEventHub:n,metadata:i}=this.props,{id:a}=i;n.emit(Se.REGISTER_FILE,a,e,t)}renameTab(e,t){var{glEventHub:n}=this.props;n.emit(Se.RENAME,e,t)}load(){var{fileMetadata:e,settings:t}=this.state;I(e);var{id:n}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(n)).then(a=>{var o;pe.debug("Loaded file",a);var{filename:s}=a,{itemName:l}=this.state;if(s!==l){var{metadata:d}=this.props,{id:u}=d;this.renameTab(u,ie.getBaseName(s))}var c=gt(gt({},t),{},{language:(o=Je.languageFromFileName(s))!==null&&o!==void 0?o:""});t.value==null&&(c.value=a.content),t.wordWrap===void 0&&(t.wordWrap="off"),this.setState({fileMetadata:{id:s,itemName:s},settings:c}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){var{fileMetadata:e}=this.state;if(e&&ie.hasPath(e.itemName)){var t=this.getNotebookValue();return t!==void 0?(this.saveContent(e.itemName,t),!0):!1}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,t){pe.debug("saveContent",e,t),this.updateSavedChangeCount();var{fileStorage:n}=this.props;this.pending.add(n.saveFile({filename:e,content:t,basename:e})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(e=>{var{changeCount:t}=e;return{savedChangeCount:t}})}setPreviewStatus(){if(this.tabTitleElement){var{isPreview:e}=this.state;pe.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}}handlePreviewPromotion(){this.removePreviewStatus()}savePanelState(){this.setState(e=>{var{changeCount:t,savedChangeCount:n,fileMetadata:i,isPreview:a,settings:o}=e,s=this.getNotebookValue(),l=t!==n?s:void 0,d=gt(gt({},o),{},{value:s}),u=gt(gt({},o),{},{value:l}),c={settings:u,fileMetadata:i,isPreview:a};return pe.debug("Saving panel state",c),{settings:d,panelState:c}})}handleCloseDiscard(){this.setState({showCloseModal:!1});var{glContainer:e}=this.props;e.close({force:!0})}handleCloseSave(){if(this.setState({showCloseModal:!1}),this.save()){var{glContainer:e}=this.props;e.close({force:!0})}}handleCloseCancel(){this.setState({showCloseModal:!1})}handleOverwrite(e){var{glEventHub:t}=this.props;t.emit(Se.CLOSE_FILE,{id:e,itemName:e},{force:!0}),this.focus()}handleCopy(){var e=this;return Hu(function*(){var{fileStorage:t,glEventHub:n,session:i}=e.props,{fileMetadata:a,settings:o}=e.state;I(a);var{language:s}=o,{itemName:l}=a,d=yield ie.getUniqueCopyFileName(t,l);pe.debug("handleCopy",a,l,d),yield t.copyFile(l,d);var u={id:d,itemName:d},c={value:null,language:s};n.emit(Se.SELECT_NOTEBOOK,i,s,c,u,!0)})()}handleDelete(){pe.debug("handleDelete, pending confirmation"),this.setState({showDeleteModal:!0})}handleDeleteConfirm(){var e=this;return Hu(function*(){var{fileStorage:t,glContainer:n,glEventHub:i}=e.props,{fileMetadata:a}=e.state;pe.debug("handleDeleteConfirm",a==null?void 0:a.itemName),e.setState({showDeleteModal:!1}),a&&(ie.hasPath(a.itemName)&&(yield ie.fileExists(t,a.itemName))?(i.emit(Se.CLOSE_FILE,a,{force:!0}),t.deleteFile(a.itemName)):n.close({force:!0}))})()}handleDeleteCancel(){this.setState({showDeleteModal:!1})}handleEditorInitialized(e){this.editor=e}handleEditorWillDestroy(){this.editor=void 0}handleEditorChange(e){pe.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(t=>{var{changeCount:n,savedChangeCount:i}=t,{isUndoing:a,isRedoing:o}=e;return a?{changeCount:n-1,savedChangeCount:i}:!o&&n<i?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1,savedChangeCount:i}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}updateEditorMinimap(){if(this.editor){var{defaultNotebookSettings:e}=this.props;this.editor.updateOptions({minimap:{enabled:e.isMinimapEnabled}})}}handleMinimapChange(){var e,{defaultNotebookSettings:t,updateSettings:n}=this.props,i={defaultNotebookSettings:{isMinimapEnabled:!((e=t.isMinimapEnabled)!==null&&e!==void 0&&e)}};n(i)}updateEditorWordWrap(){if(this.editor){var{settings:e}=this.state,{wordWrap:t}=e;this.editor.updateOptions({wordWrap:t})}}handleWordWrapChange(){this.editor&&this.setState(e=>{var{settings:t}=e,n=t.wordWrap==="on"?"off":"on";return{settings:gt(gt({},t),{},{wordWrap:n})}})}handleBlur(){pe.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){pe.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(e){var{notebooksUrl:t,session:n,sessionLanguage:i}=this.props,{href:a}=e.currentTarget;if(!(!a||!a.startsWith(t))){e.stopPropagation(),e.preventDefault();var o="/".concat(a.substring(t.length)).replace(/%20/g," ");if(o==="/"){pe.debug("Ignoring invalid notebook link",o);return}pe.debug("Notebook link clicked, opening",o);var{glEventHub:s}=this.props,l={value:null,language:i},d={id:o,itemName:o};s.emit(Se.SELECT_NOTEBOOK,n,i,l,d)}}handleLoadSuccess(){this.setState({error:void 0,isLoaded:!0,isLoading:!1})}handleLoadError(e){var t=e;we.isCanceled(t)||(we.isTimedOut(t)&&(t=new Error("File not found.")),pe.error(t),this.setState({error:t,isLoading:!1}))}handleSave(){pe.debug("handleSave"),this.save()}handleSaveSuccess(e){var t,{fileStorage:n}=this.props,i={id:e.filename,itemName:e.filename},a=(t=Je.languageFromFileName(e.filename))!==null&&t!==void 0?t:"";this.setState(o=>{var{fileMetadata:s}=o,l=gt(gt({},o.settings),{},{language:a});return pe.debug("handleSaveSuccess",i,s,l),s&&ie.hasPath(s.itemName)&&s.itemName!==i.itemName&&(pe.debug("handleSaveSuccess deleting old file",s.itemName),n.deleteFile(s.itemName).catch(Je.handleError)),{fileMetadata:i,settings:l,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(i,!1)}handleSaveError(e){we.isCanceled(e)||(this.setState({savedChangeCount:0}),pe.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n&&this.handleOverwrite(e),pe.debug("handleSaveAsSubmit",e);var{fileMetadata:i}=this.state;if(i){var{itemName:a}=i,o=(t=this.getNotebookValue())!==null&&t!==void 0?t:"";if(this.setState({showSaveAsModal:!1}),ie.getBaseName(a)!==ie.getBaseName(e)){var{metadata:s}=this.props,{id:l}=s;this.renameTab(l,ie.getBaseName(e))}this.saveContent(e,o)}}handleRenameFile(e,t,n){var{fileMetadata:i,panelState:a}=this.state,{glContainer:o}=this.props;if((i==null?void 0:i.itemName)==="/".concat(t)&&n&&JSON.stringify(a)!==JSON.stringify(n)){o.close();return}i&&i.id===e&&(this.setState({fileMetadata:{id:t,itemName:t}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)===null||e===void 0||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){var e;if(!this.notebook){pe.error("Editor is not initialized.");return}this.runCommand((e=this.notebook.getValue())!==null&&e!==void 0?e:void 0)}handleRunSelected(){if(!this.notebook){pe.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,t){var{language:n}=t;this.setState({session:e,sessionLanguage:n})}handleSessionClosed(){this.setState({session:void 0,sessionLanguage:void 0})}handleShow(){var e;pe.debug("handleShow"),(e=this.notebook)===null||e===void 0||e.updateDimensions()}handlePanelDropped(e){var{metadata:{id:t}}=this.props;e===t&&this.forceUpdate()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){pe.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];pe.debug("handleTabFocus",...t);var{glContainer:i}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!i.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){pe.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handleTabClick(e){pe.debug("handle NotebookPanel tab click"),this.focus(),e.detail===2&&this.removePreviewStatus()}handleTransformLinkUri(e){var{notebooksUrl:t}=this.props,{fileMetadata:n}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return"".concat(t).concat(e.substring(1));var i=n==null?void 0:n.itemName;if(i===void 0)return e;i.charAt(0)==="/"&&(i=i.substring(1));var a=new URL(i,t);return new URL(e,a).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{glEventHub:i}=this.props,{session:a,sessionLanguage:o,settings:s}=this.state,l=gt(gt({},s),{},{language:t,value:n}),d={id:null,itemName:e};pe.debug("handleCreateNotebook",a,o,l,d),i.emit(Se.CREATE_NOTEBOOK,a,o,l,d)}runCommand(e){if(e===void 0||e===""){pe.debug("Ignoring empty command.");return}this.removePreviewStatus();var{glEventHub:t}=this.props;t.emit(Dt.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(e=>{var{isPreview:t}=e;if(t){var{fileMetadata:n}=this.state;return n&&this.registerFileMetadata(n,!1),{isPreview:!1}}return null})}getDropdownOverflowActions(){var e,t,{defaultNotebookSettings:n}=this.props,{settings:i}=this.state;return this.getOverflowActions((e=n.isMinimapEnabled)!==null&&e!==void 0?e:!1,this.getSettings(i,(t=n.isMinimapEnabled)!==null&&t!==void 0?t:!1).wordWrap==="on")}render(){var e,t,n,{fileStorage:i,glContainer:a,glContainer:{tab:o},glEventHub:s,defaultNotebookSettings:l}=this.props,{changeCount:d,savedChangeCount:u,error:c,isDashboardActive:m,isLoaded:f,isLoading:g,isPreview:v,fileMetadata:p,session:C,sessionLanguage:S,settings:y,showCloseModal:w,showDeleteModal:E,showSaveAsModal:D}=this.state,M=m&&!a.isHidden&&!v,_=(e=p==null?void 0:p.itemName)!==null&&e!==void 0?e:Je.DEFAULT_NAME,T=_.endsWith(".md"),N=(p==null?void 0:p.id)!=null,x=this.getSettings(y,(t=l.isMinimapEnabled)!==null&&t!==void 0?t:!1),F=C!=null,k=S===x.language,U=!f||!F||!k,H=!f,W=[{action:this.handleSave,shortcut:Pn.SAVE},{action:this.handleMinimapChange,shortcut:mt.NOTEBOOK.MINIMAP},{action:this.handleWordWrapChange,shortcut:mt.NOTEBOOK.WORDWRAP}],X=ns.getDisabledRunTooltip(F,k,"Notebook extension","Run"),le=ns.getDisabledRunTooltip(F,k,"Notebook extension","Run Selected"),me=[{title:N?"Rename":"Save As…",order:10,group:fe.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:fe.groups.high,order:20}],ve=o==null?void 0:o.element.find(".lm_title_before").get(0);return h.jsxs(h.Fragment,{children:[ve!=null&&Ha.createPortal(h.jsx("span",{className:J(Je.UNSAVED_INDICATOR_CLASS_NAME,{[Je.UNSAVED_STATUS_CLASS_NAME]:d!==u})}),ve),h.jsxs(hn,{className:"notebook-container",componentPanel:this,glContainer:a,glEventHub:s,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabClicked:this.handleTabClick,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:me,renderTabTooltip:()=>_,children:[!T&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"notebook-toolbar",children:[h.jsxs("span",{children:[h.jsx(Y,{kind:"ghost",className:"btn-play",onClick:this.handleRunAll,disabled:U,icon:h.jsx(ue,{icon:Nh,transform:"grow-4"}),tooltip:"Run ".concat(mt.NOTEBOOK.RUN.getDisplayText()),"aria-label":"Run"}),X!=null&&h.jsx(On,{children:X})]}),h.jsxs("span",{children:[h.jsx(Y,{kind:"ghost",className:"btn-play",onClick:this.handleRunSelected,disabled:U,icon:h.jsx(ue,{icon:lv,transform:"grow-4"}),tooltip:"Run Selected ".concat(mt.NOTEBOOK.RUN_SELECTED.getDisplayText()),"aria-label":"Run Selected"}),le!=null&&h.jsx(On,{children:le})]}),h.jsx(Y,{kind:"ghost",className:"mr-auto",disabled:H,onClick:this.handleSave,icon:Fh,tooltip:"Save ".concat(Pn.SAVE.getDisplayText()),"aria-label":"Save"}),h.jsx(Y,{kind:"ghost",className:"btn-overflow",disabled:H,icon:Ih,tooltip:"More Actions...",onClick:()=>{},children:h.jsx(kr,{actions:this.getDropdownOverflowActions,popperOptions:Je.POPPER_OPTIONS})})]}),h.jsx(M0,{isLoaded:f,isLoading:g,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:C,sessionLanguage:S,onEditorInitialized:this.handleEditorInitialized,onEditorWillDestroy:this.handleEditorWillDestroy,settings:x,focusOnMount:M,ref:j=>{this.notebook=j}})]}),T&&h.jsx(b.Suspense,{fallback:h.jsx(dn,{}),children:h.jsx(rO,{content:(n=x.value)!==null&&n!==void 0?n:"",onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri})}),h.jsx(Im,{isOpen:D,type:"file",defaultValue:_,title:N?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:i}),h.jsx(fr,{isOpen:E,headerText:'Are you sure you want to delete "'.concat(_,'"?'),bodyText:"You cannot undo this action.",onCancel:this.handleDeleteCancel,onConfirm:this.handleDeleteConfirm,confirmButtonText:"Delete"}),h.jsx(fr,{isOpen:w,headerText:"Do you want to save the changes you made to ".concat(_,"?"),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"}),h.jsx(fe,{actions:W})]})]})}}at(Je,"COMPONENT","NotebookPanel");at(Je,"POPPER_OPTIONS",{placement:"bottom-end"});at(Je,"DEFAULT_NAME","Untitled");at(Je,"UNSAVED_INDICATOR_CLASS_NAME","editor-unsaved-indicator");at(Je,"UNSAVED_STATUS_CLASS_NAME","is-unsaved");at(Je,"defaultProps",{isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null,defaultNotebookSettings:{isMinimapEnabled:!0}});var iO=(r,e)=>{var t=Ic(r),n=ky(r),i=ti(r,e.localDashboardId),{session:a,config:o}=i??{},{type:s}=o??{};return{fileStorage:t,defaultNotebookSettings:n,session:a,sessionLanguage:s}},aO=Ht(iO,{updateSettings:Jy},null,{forwardRef:!0})(Je);const Un=aO;function $m(r){var{onClick:e}=r,t=b.useRef(null),n=b.useCallback(i=>{var a;(a=t.current)===null||a===void 0||a.blur(),e(i)},[e]);return h.jsxs(Y,{ref:t,kind:"primary",className:"btn-pandas",onClick:n,tooltip:"Click to refresh pandas dataframe, updates do not occur automatically.",children:["pandas dataframe",h.jsxs("span",{children:[h.jsx(ue,{icon:Lh,transform:"shrink-1",className:"mr-1"}),"Reload"]})]})}function Bu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Wu(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Bu(Object(t),!0).forEach(function(n){fo(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Bu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function fo(r,e,t){return e=oO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function oO(r){var e=sO(r,"string");return typeof e=="symbol"?e:String(e)}function sO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Qs extends b.Component{constructor(e){super(e),fo(this,"irisGridRef",void 0),this.irisGridRef=Z.createRef(),this.handleReload=this.handleReload.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePanelStateUpdate=this.handlePanelStateUpdate.bind(this);var{panelState:t}=e;this.state={shouldFocusGrid:!1,panelState:t}}handleReload(){var e;(e=this.irisGridRef.current)===null||e===void 0||e.initModel(),this.setState({shouldFocusGrid:!0})}handleGridStateChange(){var e,t,n,{shouldFocusGrid:i}=this.state;i&&(e=this.irisGridRef.current)!==null&&e!==void 0&&(t=e.irisGrid)!==null&&t!==void 0&&(n=t.current)!==null&&n!==void 0&&n.grid&&(this.irisGridRef.current.irisGrid.current.grid.focus(),this.setState({shouldFocusGrid:!1}))}handlePanelStateUpdate(e){this.setState({panelState:e})}render(){return h.jsx(zr,Wu(Wu({ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate},this.props),{},{children:h.jsx($m,{onClick:this.handleReload})}))}}fo(Qs,"defaultProps",{panelState:null});fo(Qs,"COMPONENT","PandasPanel");const Hm=Qs;function Gu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function zu(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Gu(a,n,i,o,s,"next",l)}function s(l){Gu(a,n,i,o,s,"throw",l)}o(void 0)})}}function Ku(r,e,t){return e=lO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lO(r){var e=dO(r,"string");return typeof e=="symbol"?e:String(e)}function dO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class uO{constructor(e){Ku(this,"items",void 0),Ku(this,"onUpdateCallback",void 0),this.items=e}setSearch(e){}setExpanded(e,t){if(e.charAt(e.length-1)==="/")for(var n=0;n<this.items.length;n+=1){var i=this.items[n];Mt(i)&&("".concat(i.filename,"/")===e||i.filename===e)&&(i.isExpanded=t)}return Promise.resolve()}collapseAll(){for(var e=0;e<this.items.length;e+=1){var t=this.items[e];Mt(t)&&(t.isExpanded=!1)}return Promise.resolve()}getViewportData(){return Promise.resolve({items:this.items,offset:0})}getSnapshot(e){return zu(function*(){throw new Error("Method not implemented.")})()}setViewport(e){var t=this;return zu(function*(){var n,i=yield t.getViewportData();(n=t.onUpdateCallback)===null||n===void 0||n.call(t,i)})()}setFilters(e){}setSorts(e){}setReversed(e){}close(){}onUpdate(e){return this.onUpdateCallback=e,jest.fn()}get size(){return this.items.length}}const hO=uO;function qu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function ui(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){qu(a,n,i,o,s,"next",l)}function s(l){qu(a,n,i,o,s,"throw",l)}o(void 0)})}}function cO(r,e,t){return e=mO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mO(r){var e=fO(r,"string");return typeof e=="symbol"?e:String(e)}function fO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class vO{constructor(e){cO(this,"items",void 0),this.items=e}getTable(){var e=this;return ui(function*(){return new hO(e.items)})()}saveFile(e){throw new Error("Method not implemented.")}loadFile(e){throw new Error("Method not implemented.")}copyFile(e,t){return ui(function*(){throw new Error("Method not implemented.")})()}deleteFile(e){var t=this;return ui(function*(){t.items=t.items.filter(n=>n.filename!==e)})()}moveFile(e,t){var n=this;return ui(function*(){for(var i=0;i<n.items.length;i+=1)if(n.items[i].filename===e){n.items[i].filename=t,n.items[i].basename=ie.getBaseName(t),n.items[i].id=t;break}})()}info(e){var t=this;return ui(function*(){var n=t.items.filter(a=>a.filename===e);if(n.length===0)throw new uo;if(n.length>1)throw new Error("More than one matching file found");var i=n[0];return{filename:i.filename,basename:i.basename,id:i.filename,type:i.type}})()}createDirectory(e){throw new Error("Method not implemented.")}}const pO=vO;function Xu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function $a(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Xu(Object(t),!0).forEach(function(n){gO(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Xu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function gO(r,e,t){return e=bO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function bO(r){var e=CO(r,"string");return typeof e=="symbol"?e:String(e)}function CO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function Zu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function yO(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Zu(a,n,i,o,s,"next",l)}function s(l){Zu(a,n,i,o,s,"throw",l)}o(void 0)})}}function SO(r,e,t,n,i){return os.apply(this,arguments)}function os(){return os=yO(function*(r,e,t,n,i){var a,o,s,l;if(jr(t)?(a=t.settings,o=t.table,s=void 0,l=t.tableSettings):(a={},o="",s=zs(t)?t.figure:t.name,l={}),i!=null&&(i.tableSettings!=null&&(l=i.tableSettings),i.table!=null&&(o=i.table),i.figure!=null&&(s=i.figure),i.settings!=null&&(a=$a($a({},a),i.settings))),s==null&&o==null){var d=yield n();return Ti.makeModel(r,a,d)}if(s!=null){var u;if(t.type===r.VariableType.FIGURE){var c={name:s,type:r.VariableType.FIGURE};u=yield e(c)}else u=yield n();return Ti.makeModel(r,a,u)}var m={name:o,type:r.VariableType.TABLE},f=yield e(m);return new Ne(r).applyTableSettings(f,l,js(NS.getState())),Ti.makeModelFromSettings(r,a,f)}),os.apply(this,arguments)}var Js=b.forwardRef((r,e)=>{var t=vr(),n=mg(),i=Om(r)?r.panelState:void 0,{fetch:a,metadata:o,localDashboardId:s}=r,l=b.useMemo(()=>({metadata:o,localDashboardId:s,makeModel:()=>{if(o==null)throw new Error("Metadata is required for chart panel");return SO(t,n,o,a,i)}}),[o,s,t,n,a,i]);return h.jsx(qi,$a($a({ref:e},r),l))});Js.displayName="ChartPanelPlugin";const wO=Js;function Yu(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function EO(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){Yu(a,n,i,o,s,"next",l)}function s(l){Yu(a,n,i,o,s,"throw",l)}o(void 0)})}}function Vm(r){var e=vr(),[t,n]=b.useState(),{fetch:i}=r;return b.useEffect(()=>{var a=!1;function o(){return s.apply(this,arguments)}function s(){return s=EO(function*(){var l=yield i(),d=yield Ti.makeModel(e,void 0,l);a||n(d)}),s.apply(this,arguments)}return o(),()=>{a=!0}},[e,i]),t?h.jsx(oc,{model:t}):null}var PO={name:"ChartPanel",title:"Chart",type:Yn.WIDGET_PLUGIN,component:Vm,panelComponent:Js,supportedTypes:"Figure",icon:ms};const TO=PO;function Um(r){Yr(r);var{id:e,layout:t}=r,n=vr(),i=b.useCallback(a=>{var{metadata:o,panelId:s=Ue.generate(),table:l}=a,{settings:d}=o,u=()=>Ti.makeModelFromSettings(n,d,l),c=ut.titleFromSettings(d),m={type:"react-component",component:qi.COMPONENT,props:{localDashboardId:e,id:s,metadata:o,makeModel:u},title:c,id:s},{root:f}=t;A.openComponent({root:f,config:m})},[n,e,t]);return Pe(t.eventHub,jt.CREATE_CHART,i),null}var _O={name:"ChartBuilderPlugin",type:Yn.DASHBOARD_PLUGIN,component:Um};const OO=_O;function Qu(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ju(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qu(Object(t),!0).forEach(function(n){DO(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qu(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function DO(r,e,t){return e=MO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function MO(r){var e=IO(r,"string");return typeof e=="symbol"?e:String(e)}function IO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Be=z.module("ConsolePlugin");function eh(r){return r.notebook!==void 0}function NO(r){Yr(r)}function xO(r){NO(r);var{id:e,hydrateConsole:t,layout:n,panelManager:i,registerComponent:a,notebooksUrl:o}=r,s=b.useRef(0),[l,d]=b.useState(new Map),[u,c]=b.useState(new Map),m=ds(),f=b.useCallback(()=>i.getLastUsedPanelOfType(Sa),[i]),g=b.useCallback((j,R)=>{d($=>new Map($.set(j,R)))},[d]),v=b.useCallback(j=>{d(R=>(R.delete(j),new Map(R)))},[d]),p=b.useCallback((j,R)=>{c($=>new Map($.set(j,R)))},[c]),C=b.useCallback(j=>{c(R=>(R.delete(j),new Map(R)))},[c]),S=b.useCallback(function(j){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,$=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,G=j&&j.trim();if(!G)Be.info("Ignoring empty code");else{var te=f();if(!te||!(te instanceof Sa.WrappedComponent)){Be.error("Console panel not found");return}Be.debug("Send command: ",j,R,$),te.addCommand(j,R,$)}},[f]),y=b.useCallback(j=>{m(Em(e,j))},[m,e]),w=b.useCallback(j=>{var{language:R}=j,$=R==="python"?"py":R,G=null;return $==null?(Be.debug("No extension for language",R),G="Untitled-".concat(s.current)):G="Untitled-".concat(s.current,".").concat($),s.current+=1,G},[]),E=b.useCallback(function(j){var R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,{id:$}=j;if($!=null&&l.has($))return l.get($);if($!=null&&u.has($))return u.get($);if(R)return Ue.generate()},[l,u]),D=b.useCallback((j,R)=>{A.renameComponent(n.root,{id:j},R)},[n.root]),M=b.useCallback((j,R)=>{Be.debug("Rename file panel",j,R);var $;if(l.has(j)&&($=l.get(j),v(j),$!=null&&g(R,$)),u.has(j)&&($=u.get(j),C(j),$!=null&&p(R,$)),$===void 0){Be.debug2("File ".concat(j," isn't open, no need to rename the tab"));return}D($,ie.getBaseName(R))},[l,u,D,g,p,v,C]),_=b.useCallback(j=>{var R=E(j,!1);if(R==null){Be.error("Could not find panel id for file metadata",j);return}A.activateTab(n.root,{id:R})},[E,n.root]),T=b.useCallback((j,R,$)=>{if(Be.debug("registerFilePanel",j,R,$),R==null||R.id==null){Be.debug("Ignore empty file id",R);return}var{id:G}=R;if($){p(G,j);return}if(l.has(G)){var te=l.get(G);if(j===te){Be.debug("Update tab title for file ".concat(G));var{itemName:Me}=R;M(G,Me)}else Be.error("File ".concat(G," already associated with a different tab ").concat(te));return}g(G,j),u.has(G)&&C(G)},[l,u,M,g,p,C]),N=b.useCallback((j,R)=>{if(Be.debug("unregisterFileTab",j,R),j==null||j.id==null){Be.debug("Ignore empty file id",j);return}var{id:$}=j;if(R){C($);return}v($)},[v,C]),x=b.useCallback((j,R)=>{Be.debug("closeFilePanel",j);var{id:$}=j,G=null,te=!1;if(l.has($))G=l.get($);else if(u.has($))G=u.get($),te=!0;else{Be.debug("File ".concat($," isn't open, ignore close event"));return}N(j,te),A.closeComponent(n.root,{id:G},R)},[n.root,l,u,N]),F=b.useCallback(j=>{var{itemName:R}=j;return ie.getBaseName(R)},[]),k=b.useCallback(j=>{var{id:R}=j;return Be.debug("fileIsOpen",j,R,l),R!=null&&l.has(R)},[l]),U=b.useCallback(j=>{var{id:R}=j;return Be.debug("fileIsOpenAsPreview",j,R,u),R!=null&&u.has(R)},[u]),H=b.useCallback(j=>{if(j!=null){var R=i.getOpenedPanelById(j);R&&eh(R)&&R.focus()}},[i]),W=b.useCallback(j=>{var{id:R,settings:$,fileMetadata:G,session:te,sessionLanguage:Me,isPreview:V=!1}=j,ne={settings:$,fileMetadata:G},de=F(G);return{type:"react-component",component:Un.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:e,metadata:{id:R},session:te,sessionLanguage:Me,panelState:ne,isPreview:V,notebooksUrl:o},title:de,id:R}},[F,e,o]),X=b.useCallback(function(j,R,$){var G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{id:null,itemName:w($)},te=E(G);if(k(G)&&te!=null){Be.debug("File is already open, focus panel"),_(G),H(te);return}var Me=A.getStackForComponentTypes(n.root,[Un.COMPONENT]),V=W({id:te,settings:$,fileMetadata:G,session:j,sessionLanguage:R});Be.debug("createNotebook",V,l),A.openComponentInStack(Me,V)},[k,H,w,E,n.root,W,l,_]),le=b.useCallback(function(j,R,$,G){var te=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;Be.debug("selectNotebook",G,te);var Me=k(G),V=U(G),[ne]=[...u.values()],de=!te,Ee=de&&ne?ne:E(G);if(Ee==null||Ee==="")throw new Error("Unable to retrieve or create panelId for metadata",G);if(Me||V)_(G);else{var Le=A.getStackForComponentTypes(n.root,[Un.COMPONENT]),ni=W({id:Ee,settings:$,fileMetadata:G,session:j,sessionLanguage:R,isPreview:de});A.openComponentInStack(Le,ni)}if(V&&te){var wr=G.id,ri=A.getStackForConfig(n.root,{component:Un.COMPONENT,id:Ee}),nr=A.getContentItemInStack(ri,{component:Un.COMPONENT,id:Ee});nr&&Et(nr)&&(nr.container.emit(Se.PROMOTE_FROM_PREVIEW),C(wr),g(wr,Ee))}te&&H(Ee)},[_,k,U,H,E,n.root,W,u,C,g]),me=b.useCallback(function(j,R){var $=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},G=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,te=i.getLastUsedPanelOfType(Un);te&&eh(te)?$!=null&&$.value!=null&&te.notebook!=null&&te.notebook.append($.value):G&&X(j,R,$)},[X,i]),ve=b.useCallback((j,R)=>Ty.hydrate(Ju(Ju({},j),{},{notebooksUrl:o}),R),[o]);return si(a,Sa,t),si(a,Dm),si(a,xm),si(a,Am),si(a,Un,ve),Pe(n.eventHub,Dt.SEND_COMMAND,S),Pe(n.eventHub,Dt.SETTINGS_CHANGED,y),Pe(n.eventHub,Se.CLOSE_FILE,x),Pe(n.eventHub,Se.CREATE_NOTEBOOK,X),Pe(n.eventHub,Se.SELECT_NOTEBOOK,le),Pe(n.eventHub,Se.RENAME,D),Pe(n.eventHub,Se.RENAME_FILE,M),Pe(n.eventHub,Se.SEND_TO_NOTEBOOK,me),Pe(n.eventHub,Se.REGISTER_FILE,T),Pe(n.eventHub,Se.UNREGISTER_FILE,N),null}var hi=z.module("FilterPlugin");function th(r,e){return r.concat(e)}function Bm(r){Yr(r);var{id:e,layout:t,registerComponent:n}=r,i=ds(),[a]=b.useState(()=>new Map),[o]=b.useState(()=>new Map),[s]=b.useState(()=>new Map),l=b.useCallback(()=>{var p=Array.from(a.values()).reduce(th,[]).sort((y,w)=>{var E=Lt.toLower(y.name),D=Lt.toLower(w.name);if(E!==D)return E>D?1:-1;var M=Lt.toLower(y.type),_=Lt.toLower(w.type);return M!==_?M>_?1:-1:0}).reduce((y,w)=>((y.length===0||Lt.toLower(y[y.length-1].name)!==Lt.toLower(w.name)||Lt.toLower(y[y.length-1].type)!==Lt.toLower(w.type))&&y.push(w),y),[]),C=Array.from(o.values()).reduce(th,[]).sort((y,w)=>y.timestamp-w.timestamp),S=new Map(s);hi.debug("sendUpdate",{columns:p,filters:C,tableMap:S}),i(Dn(e,{columns:p,filters:C,tableMap:S}))},[i,e,a,o,s]),d=b.useCallback((p,C)=>{hi.debug2("handleColumnsChanged",p,C),a.set(p,[].concat(C)),l()},[a,l]),u=b.useCallback((p,C)=>{hi.debug2("handleFiltersChanged",p,C),o.set(p,[].concat(C)),l()},[o,l]),c=b.useCallback((p,C)=>{hi.debug2("handleTableChanged",p,C),s.set(A.getIdFromPanel(p),C),l()},[s,l]),m=b.useCallback(p=>{hi.debug2("handlePanelUnmount",p),a.delete(p),o.delete(p),s.delete(A.getIdFromPanel(p)),l()},[a,o,s,l]),f=b.useCallback(p=>{var{title:C="DropdownFilter",metadata:S={},panelState:y=null,id:w=Ue.generate(),focusElement:E=A.DEFAULT_FOCUS_SELECTOR,createNewStack:D=!1,dragEvent:M=null}=p,_={type:"react-component",component:Zn.COMPONENT,props:{id:w,metadata:S,panelState:y,localDashboardId:e},title:C,id:w},{root:T}=t;A.openComponent({root:T,config:_,focusElement:E,createNewStack:D,dragEvent:M})},[t,e]),g=b.useCallback(p=>{var{title:C="InputFilter",metadata:S={},panelState:y=null,id:w=Ue.generate(),focusElement:E=A.DEFAULT_FOCUS_SELECTOR,createNewStack:D=!1,dragEvent:M=void 0}=p,_={type:"react-component",component:$r.COMPONENT,props:{id:w,metadata:S,panelState:y,localDashboardId:e},title:C,id:w},{root:T}=t;A.openComponent({root:T,config:_,focusElement:E,createNewStack:D,dragEvent:M})},[t,e]),v=b.useCallback(p=>{var{title:C="FilterSets",metadata:S={},panelState:y=null,id:w=Ue.generate(),focusElement:E=A.DEFAULT_FOCUS_SELECTOR,createNewStack:D=!1,dragEvent:M=null}=p,_={type:"react-component",component:Ea.COMPONENT,props:{id:w,metadata:S,panelState:y,localDashboardId:e},title:C,id:w},{root:T}=t;A.openComponent({root:T,config:_,focusElement:E,createNewStack:D,dragEvent:M})},[t,e]);return b.useEffect(function(){var C=[n(Zn.COMPONENT,Zn),n($r.COMPONENT,$r),n(Ea.COMPONENT,Ea)];return()=>{C.forEach(S=>S())}},[n]),Pe(t.eventHub,Ve.COLUMNS_CHANGED,d),Pe(t.eventHub,Ve.FILTERS_CHANGED,u),Pe(t.eventHub,Ve.TABLE_CHANGED,c),Pe(t.eventHub,Ve.OPEN_DROPDOWN,f),Pe(t.eventHub,Ve.OPEN_INPUT,g),Pe(t.eventHub,Ve.OPEN_FILTER_SET_MANAGER,v),Pe(t.eventHub,se.UNMOUNT,m),null}var FO={name:"FilterPlugin",type:Yn.DASHBOARD_PLUGIN,component:Bm};const RO=FO;var LO=z.module("@deephaven/app-utils/useTablePlugin");function Wm(){var r=Ah(),e=b.useCallback(t=>{var n=r.get(t);if(n!=null){if(gv(n))return n.component;if(bv(n))return n.TablePlugin}var i="Unable to find table plugin ".concat(t,".");throw LO.error(i),new Error(i)},[r]);return e}function nh(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function AO(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){nh(a,n,i,o,s,"next",l)}function s(l){nh(a,n,i,o,s,"throw",l)}o(void 0)})}}function Gm(r,e,t){var n=vr(),i=Wm(),a=b.useMemo(()=>({loadPlugin:i,localDashboardId:e,makeModel:function(){var o=AO(function*(){var l=yield r();return Vs.makeModel(n,l)});function s(){return o.apply(this,arguments)}return s}(),metadata:t}),[n,r,e,i,t]);return a}function rh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ih(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?rh(Object(t),!0).forEach(function(n){kO(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):rh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function kO(r,e,t){return e=jO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function jO(r){var e=$O(r,"string");return typeof e=="symbol"?e:String(e)}function $O(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var el=b.forwardRef((r,e)=>{var{localDashboardId:t,fetch:n,metadata:i}=r,a=Gm(n,t,i);return h.jsx(zr,ih(ih({ref:e},r),a))});el.displayName="GridPanelPlugin";const HO=el;function ah(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function VO(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){ah(a,n,i,o,s,"next",l)}function s(l){ah(a,n,i,o,s,"throw",l)}o(void 0)})}}function zm(r){var e=vr(),[t,n]=b.useState(),{fetch:i}=r;return b.useEffect(()=>{var a=!1;function o(){return s.apply(this,arguments)}function s(){return s=VO(function*(){var l=yield i(),d=yield Vs.makeModel(e,l);a||n(d)}),s.apply(this,arguments)}return o(),()=>{a=!0}},[e,i]),t?h.jsx(Ya,{model:t}):null}var UO={name:"IrisGridPanel",title:"Table",type:Yn.WIDGET_PLUGIN,component:zm,panelComponent:el,supportedTypes:["Table","TreeTable","HierarchicalTable","PartitionedTable"],icon:fs};const BO=UO;function oh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function kn(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?oh(Object(t),!0).forEach(function(n){Km(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):oh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Km(r,e,t){return e=WO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function WO(r){var e=GO(r,"string");return typeof e=="symbol"?e:String(e)}function GO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function qm(r){var e=r;return typeof e.getCoordinateForColumn=="function"}function sh(r){var e=r;return qm(r)&&typeof e.setFilterMap=="function"&&typeof e.unsetFilterValue=="function"}function lh(r){return r.description==null||!r.description.startsWith("Preview of type: ")}var ci=z.module("LinkerUtils");class vo{static getLinkType(e,t,n){var i;if((e==null?void 0:e.panelId)==null||(t==null?void 0:t.panelId)==null||e.panelId===t.panelId||n!=null&&n!==e.panelId&&n!==t.panelId)return ci.debug2("Incompatible panel ids",e,t,n),"invalid";if(e.panelComponent==null||t.panelComponent==null)return ci.error("PanelComponent should not be null",e,t),"invalid";var a=(i=vo.ALLOWED_LINKS.get(e.panelComponent))===null||i===void 0?void 0:i.includes(t.panelComponent);if(a===void 0||!a)return ci.debug2("Incompatible panel components",e,t),"invalid";var{columnType:o}=e,{columnType:s}=t,l=s===null||P.isCompatibleType(o,s);if(!l)return ci.debug2("Incompatible type",o,s),"invalid";switch(t.panelComponent){case A.getComponentName(qi):return"chartLink";case A.getComponentName(zr):return"tableLink";case A.getComponentName(Zn):return"filterSource"}return ci.debug2("Incompatible target panel component",t.panelComponent),"invalid"}static findColumn(e,t){var{columnName:n,columnType:i}=t;return e.find(a=>{var{name:o,type:s}=a;return o===n&&s===i})}static cloneLinksForPanel(e,t,n){var i=[];return e.forEach(a=>{var o;a.start.panelId===t&&a.type!=="filterSource"?i.push(kn(kn({},a),{},{id:Ue.generate(),start:kn(kn({},a.start),{},{panelId:n})})):((o=a.end)===null||o===void 0?void 0:o.panelId)===t&&i.push(kn(kn({},a),{},{id:Ue.generate(),end:kn(kn({},a.end),{},{panelId:n})}))}),i}}Km(vo,"ALLOWED_LINKS",new Map([[A.getComponentName(zr),[A.getComponentName(zr),A.getComponentName(qi),A.getComponentName(Zn)]]]));const sr=vo;function Xm(r,e,t){return e=zO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zO(r){var e=KO(r,"string");return typeof e=="symbol"?e:String(e)}function KO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var qO=z.module("LinkerLink"),dh=.015,uh=1.5,Zm=12,Ym=12,hh=2,ba=Math.sqrt((Ym*.5)**2+Zm**2),ch=Math.asin(Ym*.5/Zm),mh=15,jn=Math.PI*.5;class Hr extends b.Component{static makeCirclePath(e,t,n){return"M ".concat(e," ").concat(t," m -").concat(n,",0 a ").concat(n,",").concat(n," 0 1,0 ").concat(n*2,",0 a ").concat(n,",").concat(n," 0 1,0 -").concat(n*2,",0 z")}static getLabelForLinkFilter(e,t){try{if(P.isNumberType(e)||P.isCharType(e))return $g(t);if(P.isTextType(e))return jg(t);if(P.isDateType(e))return Hg(t);if(P.isBooleanType(e)){if(t===L.eq)return"is equal to";if(t===L.notEq)return"is not equal to"}throw new Error("Unrecognized column type: ".concat(e))}catch(n){return qO.warn(n),""}}constructor(e){super(e),Xm(this,"getOperators",oe((t,n)=>{var{onOperatorChanged:i}=this.props,a=P.getFilterTypes(n);return P.isBooleanType(n)&&(a=[L.eq,L.notEq]),a.flatMap((o,s)=>{if(o==="eqIgnoreCase"||o==="notEqIgnoreCase")return[];var l="";return o==="startsWith"?l="a*":o==="endsWith"?l="*z":l=P.getFilterOperatorString(o),[{title:Hr.getLabelForLinkFilter(n,o),icon:h.jsx("b",{children:l}),action:()=>i(t,o),order:s}]})})),this.handleClick=this.handleClick.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.handleDelete=this.handleDelete.bind(this),this.getDropdownActions=this.getDropdownActions.bind(this),this.state={isHovering:void 0}}handleClick(e){e.stopPropagation(),e.preventDefault();var{id:t,onClick:n,onDelete:i}=this.props;e.altKey?i(t):n(t)}handleMouseEnter(){this.setState({isHovering:!0})}handleMouseLeave(){this.setState({isHovering:!1})}handleDelete(){var{id:e,onDelete:t}=this.props;t(e)}getDropdownActions(){var{id:e,startColumnType:t}=this.props;return t!=null?this.getOperators(e,t):[]}render(){var{className:e,operator:t,isSelected:n,x1:i,y1:a,x2:o,y2:s,id:l,startColumnType:d,type:u}=this.props,{isHovering:c}=this.state,m=Math.sqrt((i-o)**2+(a-s)**2),f=Math.atan2(s-a,o-i),g=Math.sin(f),v=Math.cos(f)+2,p=window.innerWidth,C=window.innerHeight,S=0,y=0,w=Math.max(S,Math.min(i+(o-i)/2+g*(m*dh)**uh,p)),E=Math.max(y,Math.min(a+(s-a)/2+v*(m*dh)**uh,C)),D="M ".concat(i," ").concat(a," Q ").concat(w," ").concat(E," ").concat(o," ").concat(s),M="M ".concat(S," ").concat(y," L ").concat(S," ").concat(C," L ").concat(p," ").concat(C," L ").concat(p," ").concat(y,` z
|
|
25
25
|
`).concat(Hr.makeCirclePath(i,a,mh),`
|
|
26
26
|
`).concat(Hr.makeCirclePath(o,s,mh)),_="link-select-clip-".concat(l),T=Math.atan2(s-E,o-w),N=T-ch+Math.PI,x=T+ch+Math.PI,F=o+Math.cos(T)*hh,k=s+Math.sin(T)*hh,U=F+Math.cos(N)*ba,H=k+Math.sin(N)*ba,W=F+Math.cos(x)*ba,X=k+Math.sin(x)*ba,le="".concat(F,",").concat(k," ").concat(U,",").concat(H," ").concat(W,",").concat(X),me=.25*i+.5*w+.25*o,ve=.25*a+.5*E+.25*s,j=w-i+(o-w),R=E-a+(s-E),$=R/j,G=20,te=G/Math.sqrt(1+$**2),Me=te*$,V=te*-1,ne=Me*-1;Number.isFinite($)?$>0?(te*=-1,Me*=-1,V*=-1,ne*=-1,V-=50-10*(Math.abs(f)%jn),ne+=10*(Math.abs(f)%jn),te-=50-10*(Math.abs(f)%jn),Me+=10*(Math.abs(f)%jn)):$<0?(V+=10*(Math.abs(f)%jn),ne+=10*(Math.abs(f)%jn),te+=10*(Math.abs(f)%jn),Me+=10*(Math.abs(f)%jn)):(V=15,ne=10,te=-25,Me=10):(V=10,ne=5,te=10,Me=-35);var de="";t!==void 0&&(t==="startsWith"?de="a*":t==="endsWith"?de="*z":de=P.getFilterOperatorString(t));var Ee=u!=="chartLink"&&u!=="filterSource";return h.jsxs(h.Fragment,{children:[h.jsxs("svg",{className:J(e,{hovering:c}),children:[h.jsx("clipPath",{id:_,children:h.jsx("path",{d:M,clipRule:"evenodd"})}),h.jsx("path",{className:"link-select",d:D,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:"url(#".concat(_,")"),"data-testid":"link-select"}),h.jsx("path",{className:"link-background",d:D}),h.jsx("path",{className:"link-foreground",d:D}),h.jsx("circle",{className:"link-dot",cx:i,cy:a,r:"5"}),h.jsx("polygon",{className:"link-triangle",points:le})]}),d!=null&&n&&h.jsxs(h.Fragment,{children:[Ee&&h.jsx(Y,{kind:"primary",className:"btn-fab btn-operator",style:{top:ve+($>=0?Me:ne),left:me+($>=0?te:V)},onClick:()=>{},icon:h.jsxs("div",{className:"fa-md fa-layers",children:[h.jsx("b",{children:de}),h.jsx(ue,{icon:xr,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:h.jsx(kr,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),h.jsx(Y,{kind:"primary",className:"btn-fab btn-delete",style:{top:ve+($<0?Me:ne),left:me+($<0?te:V)},onClick:this.handleDelete,icon:ki,tooltip:"Delete"})]})]})}}Xm(Hr,"defaultProps",{className:"",isSelected:!1,onClick(){},onDelete(){}});const XO=Hr;function fh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function vh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fh(Object(t),!0).forEach(function(n){tl(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):fh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function tl(r,e,t){return e=ZO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ZO(r){var e=YO(r,"string");return typeof e=="symbol"?e:String(e)}function YO(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Fo=z.module("LinkerOverlayContent");class Qm extends b.Component{constructor(e){super(e),tl(this,"dialogRef",void 0),this.handleBlur=this.handleBlur.bind(this),this.handleResize=this.handleResize.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.handleOperatorChanged=this.handleOperatorChanged.bind(this),this.dialogRef=Z.createRef(),this.state={mouse:void 0,dialog:void 0,offset:{x:0,y:0},isDragging:!1,mode:"select"}}componentDidMount(){window.addEventListener("blur",this.handleBlur,!0),window.addEventListener("mousemove",this.handleMouseMove,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),window.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("keyup",this.handleKeyUp,!0),window.addEventListener("resize",this.handleResize,!0)}componentDidCatch(e,t){Fo.error("componentDidCatch",e,t)}componentWillUnmount(){window.removeEventListener("blur",this.handleBlur,!0),window.removeEventListener("mousemove",this.handleMouseMove,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("keyup",this.handleKeyUp,!0),window.removeEventListener("resize",this.handleResize,!0)}getPointFromLinkPoint(e){var{panelManager:t}=this.props,{panelId:n,columnName:i}=e,a=t.getOpenedPanelById(n);if(a!=null){if(!qm(a))throw new Error("Panel does not have getCoordinateForColumn method: ".concat(n));try{var o=a.getCoordinateForColumn(i);if(o!=null)return o}catch{Fo.error("Could not get coordinate for column",i,a)}}var s=t.getContainerByPanelId(n);if(s==null)throw new Error("Unable to find panel container for id: ".concat(n));return A.getTabPoint(s)}handleOperatorChanged(e,t){var{links:n,onLinksUpdated:i}=this.props,a=n.map(o=>o.id===e?vh(vh({},o),{},{operator:t}):o);i(a)}handleBlur(){this.setState({mode:"select"})}handleResize(){var{dialog:e}=this.state;if(e&&this.dialogRef.current){var t=this.dialogRef.current.getBoundingClientRect(),n=Kt(e.x,0,window.innerWidth-t.width),i=Kt(e.y,0,window.innerHeight-t.height);this.setState({dialog:{x:n,y:i}})}}handleMouseMove(e){var{offset:t,isDragging:n}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),n&&this.dialogRef.current){var i=this.dialogRef.current.getBoundingClientRect(),a=Kt(window.innerWidth-(e.clientX+i.width+t.x),0,window.innerWidth-i.width),o=Kt(window.innerHeight-(e.clientY+i.height+t.y),0,window.innerHeight-i.height);this.setState({dialog:{x:a,y:o}})}}handleMouseDown(e){e.preventDefault();var t={x:0,y:0};if(this.dialogRef.current){var n=this.dialogRef.current.getBoundingClientRect();t.x=n.right-(n.width+e.clientX),t.y=n.bottom-(n.height+e.clientY)}this.setState({isDragging:!0,offset:t})}handleMouseUp(){this.setState({isDragging:!1})}handleKeyDown(e){if(e.key==="Alt")e.preventDefault(),this.setState({mode:"delete"});else if(e.key==="Delete"||e.key==="Backspace"){var{selectedIds:t,onLinkDeleted:n}=this.props;e.preventDefault(),t.forEach(i=>n(i))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){var{onCancel:e}=this.props;e()}render(){var{disabled:e,links:t,selectedIds:n,messageText:i,onLinkSelected:a,onLinkDeleted:o,onAllLinksDeleted:s,onDone:l}=this.props,{mouse:d,dialog:u,isDragging:c,mode:m}=this.state,f=t.map(g=>{try{var v,p,{id:C,type:S,isReversed:y,start:w,end:E,operator:D}=g,M=w.columnType,[_,T]=this.getPointFromLinkPoint(w),N=(v=d==null?void 0:d.x)!==null&&v!==void 0?v:_,x=(p=d==null?void 0:d.y)!==null&&p!==void 0?p:T;if(E!=null&&([N,x]=this.getPointFromLinkPoint(E)),y!=null&&y){var[F,k]=[_,T];[_,T]=[N,x],[N,x]=[F,k]}var U=J("linker-link",{disabled:e},{"link-filter-source":S==="filterSource"},{"link-invalid":S==="invalid"},{interactive:g.end==null},{"link-is-selected":n.has(C)},{"danger-delete":m==="delete"});return{x1:_,y1:T,x2:N,y2:x,id:C,className:U,operator:D,startColumnType:M,type:S}}catch(H){return Fo.warn("Unable to get point for link",g,H),null}}).filter(g=>g!=null);return h.jsxs("div",{className:J("linker-overlay",{"danger-delete":m==="delete"}),children:[f.map(g=>{var{x1:v,y1:p,x2:C,y2:S,id:y,className:w,operator:E,startColumnType:D,type:M}=g;return h.jsx(XO,{className:w,id:y,x1:v,y1:p,x2:C,y2:S,onClick:a,onDelete:o,isSelected:n.has(y),operator:E,startColumnType:D,type:M,onOperatorChanged:this.handleOperatorChanged},y)}),h.jsxs("div",{className:J("linker-toast-dialog",{dragging:c}),ref:this.dialogRef,style:{bottom:u==null?void 0:u.y,right:u==null?void 0:u.x},"data-testid":"linker-toast-dialog",children:[h.jsx(Y,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:hv,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!c&&h.jsx(On,{children:"Drag to reposition"})}),h.jsx("div",{className:"toast-body",children:i}),h.jsxs("div",{className:"toast-footer",children:[h.jsx(Y,{kind:"secondary",onClick:s,children:"Clear All"}),h.jsx(Y,{kind:"primary",onClick:l,children:"Done"})]})]}),h.jsx(fe,{actions:[{action:this.handleEscapePressed,shortcut:Pn.LINKER_CLOSE,isGlobal:!0}]})]})}}tl(Qm,"defaultProps",{disabled:"false"});const QO=Qm;function ph(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function gh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ph(Object(t),!0).forEach(function(n){Jm(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ph(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Jm(r,e,t){return e=JO(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function JO(r){var e=eD(r,"string");return typeof e=="symbol"?e:String(e)}function eD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ye=z.module("Linker"),tD=(r,e)=>({activeTool:$s(r),dh:Oc(r),isolatedLinkerPanelId:io(r,e.localDashboardId),links:Sr(r,e.localDashboardId),timeZone:js(r)}),nD=Ht(tD,{setActiveTool:Rc,setDashboardLinks:oo,addDashboardLinks:ym,deleteDashboardLinks:Sm,setDashboardIsolatedLinkerPanelId:Gs,setDashboardColumnSelectionValidator:wm});class rD extends b.Component{constructor(e){super(e),Jm(this,"getCachedLinks",oe((t,n,i)=>{var a=[...t];return n!=null&&n.start!=null&&a.push(n),i!==void 0?a.filter(o=>{var s,l;return(o==null||(s=o.start)===null||s===void 0?void 0:s.panelId)===i||(o==null||(l=o.end)===null||l===void 0?void 0:l.panelId)===i||(o==null?void 0:o.end)==null}):a})),this.handleCancel=this.handleCancel.bind(this),this.handleDone=this.handleDone.bind(this),this.handlePanelCloned=this.handlePanelCloned.bind(this),this.handleFilterColumnSelect=this.handleFilterColumnSelect.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handlePanelClosed=this.handlePanelClosed.bind(this),this.handleLayoutStateChanged=this.handleLayoutStateChanged.bind(this),this.handleAllLinksDeleted=this.handleAllLinksDeleted.bind(this),this.handleLinkDeleted=this.handleLinkDeleted.bind(this),this.handleLinksUpdated=this.handleLinksUpdated.bind(this),this.handleChartColumnSelect=this.handleChartColumnSelect.bind(this),this.handleGridColumnSelect=this.handleGridColumnSelect.bind(this),this.handleUpdateValues=this.handleUpdateValues.bind(this),this.handleStateChange=this.handleStateChange.bind(this),this.handleExited=this.handleExited.bind(this),this.handleLinkSelected=this.handleLinkSelected.bind(this),this.handlePanelDragging=this.handlePanelDragging.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0,selectedIds:new Set,isDraggingPanel:!1}}componentDidMount(){var{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){var{activeTool:t,layout:n}=this.props;n!==e.layout&&(this.stopListening(e.layout),this.startListening(n)),t!==e.activeTool&&(this.updateSelectionValidators(),t===zt.DEFAULT&&this.reset())}componentDidCatch(e,t){Ye.error("componentDidCatch",e,t)}componentWillUnmount(){var{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);var{eventHub:t}=e;t.on(jt.COLUMN_SELECTED,this.handleGridColumnSelect),t.on(jt.DATA_SELECTED,this.handleUpdateValues),t.on(jt.STATE_CHANGED,this.handleStateChange),t.on(Aa.COLUMN_SELECTED,this.handleChartColumnSelect),t.on(se.CLONED,this.handlePanelCloned),t.on(Ve.COLUMN_SELECTED,this.handleFilterColumnSelect),t.on(Ve.COLUMNS_CHANGED,this.handleColumnsChanged),t.on(se.CLOSE,this.handlePanelClosed),t.on(se.CLOSED,this.handlePanelClosed),t.on(se.DRAGGING,this.handlePanelDragging),t.on(se.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);var{eventHub:t}=e;t.off(jt.COLUMN_SELECTED,this.handleGridColumnSelect),t.off(jt.DATA_SELECTED,this.handleUpdateValues),t.off(jt.STATE_CHANGED,this.handleStateChange),t.off(Aa.COLUMN_SELECTED,this.handleChartColumnSelect),t.off(se.CLONED,this.handlePanelCloned),t.off(Ve.COLUMN_SELECTED,this.handleFilterColumnSelect),t.off(Ve.COLUMNS_CHANGED,this.handleColumnsChanged),t.off(se.CLOSE,this.handlePanelClosed),t.off(se.CLOSED,this.handlePanelClosed),t.off(se.DRAGGING,this.handlePanelDragging),t.off(se.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){var{linkInProgress:e}=this.state;if(e==null){var{setActiveTool:t}=this.props;t(zt.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){var{setActiveTool:e}=this.props;e(zt.DEFAULT)}handleChartColumnSelect(e,t){this.columnSelected(e,t,!0)}handleFilterColumnSelect(e,t){Ye.debug("handleFilterColumnSelect",this.isOverlayShown());var{links:n,localDashboardId:i,setActiveTool:a,setDashboardIsolatedLinkerPanelId:o}=this.props,s=A.getIdFromPanel(e),l=n.filter(d=>{var u,c;return((u=d.start)===null||u===void 0?void 0:u.panelId)===s||((c=d.end)===null||c===void 0?void 0:c.panelId)===s});if(!this.isOverlayShown()&&s!=null){a(zt.LINKER),o(i,s),l.length===0&&this.columnSelected(e,t,!0,s);return}this.columnSelected(e,t,!0)}handleColumnsChanged(e,t){Ye.debug("handleColumnsChanged",e,t);var{links:n}=this.props,i=A.getIdFromPanel(e);if(i==null){Ye.error("Invalid panelId",e);return}var a=n.filter(o=>{var{start:s,end:l}=o;return s.panelId===i&&sr.findColumn(t,s)==null||l!=null&&l.panelId===i&&sr.findColumn(t,l)==null});this.deleteLinks(a)}handleGridColumnSelect(e,t){if(!lh(t)){Ye.debug2("Column is not filterable");return}this.columnSelected(e,t)}columnSelected(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3?arguments[3]:void 0;if(!(i===void 0&&!this.isOverlayShown())){var{isolatedLinkerPanelId:a}=this.props,{linkInProgress:o}=this.state,s=A.getIdFromPanel(e);if(s!=null){var l=A.getComponentNameFromPanel(e),{name:d,type:u}=t;if(o==null||o.start==null){var c={id:Ue.generate(),start:{panelId:s,panelComponent:l,columnName:d,columnType:u},type:"invalid",isReversed:n};Ye.debug("starting link",c),this.setState({linkInProgress:c})}else{var{links:m}=this.props,{start:f,id:g,isReversed:v}=o,p={panelId:s,panelComponent:l,columnName:d,columnType:u},C=sr.getLinkType(v!==void 0&&v?p:f,v!==void 0&&v?f:p,i??a);switch(C){case"invalid":Ye.debug("Ignore invalid link connection",o,p);return;case"filterSource":{var S=v!==void 0&&v?f.panelId:p.panelId,y=m.filter(_=>{var{end:T}=_;return(T==null?void 0:T.panelId)===S});this.deleteLinks(y);break}case"chartLink":{var w=v===!0?f:p,E=v===!0?p:f;Ye.debug("creating chartlink",{existingLinkEnd:w,start:f,end:p});var D=m.filter(_=>{var{end:T,start:N}=_;return(N==null?void 0:N.panelId)===E.panelId&&(T==null?void 0:T.panelId)===w.panelId&&(T==null?void 0:T.columnName)===w.columnName&&(T==null?void 0:T.columnType)===w.columnType});this.deleteLinks(D);break}}var M={start:v!==void 0&&v?p:f,end:v!==void 0&&v?f:p,id:g,type:C,operator:L.eq};Ye.info("creating link",M),this.setState({linkInProgress:void 0,selectedIds:new Set([g])},()=>{this.addLinks([M])})}}}}unsetFilterValueForLink(e){var{panelManager:t}=this.props;if(e.end){var{end:n}=e,{panelId:i,columnName:a,columnType:o}=n,s=t.getOpenedPanelById(i);s?sh(s)?s.unsetFilterValue(a,o):Ye.debug("endPanel.unsetFilterValue not implemented",s):Ye.debug("endPanel no longer exists, ignoring unsetFilterValue",i)}}setPanelFilterMap(e,t){Ye.debug("Set filter data for panel:",e,t);var{panelManager:n}=this.props,i=n.getOpenedPanelById(e);i?sh(i)?i.setFilterMap(t):Ye.debug("panel.setFilterMap not implemented",e,i):Ye.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){var{addDashboardLinks:t,localDashboardId:n}=this.props;t(n,e)}deleteLinks(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,{localDashboardId:n}=this.props;if(e.forEach(o=>this.unsetFilterValueForLink(o)),t){var{setDashboardLinks:i}=this.props;i(n,[])}else if(e.length>0){var{deleteDashboardLinks:a}=this.props;a(n,e.map(o=>{var{id:s}=o;return s}))}}handleAllLinksDeleted(){var{links:e,isolatedLinkerPanelId:t}=this.props;if(t===void 0)this.deleteLinks(e,!0);else{var n=e.filter(i=>{var a,o;return(i==null||(a=i.start)===null||a===void 0?void 0:a.panelId)===t||(i==null||(o=i.end)===null||o===void 0?void 0:o.panelId)===t});this.deleteLinks(n)}this.reset()}handleLinkDeleted(e){var{links:t}=this.props,n=t.find(i=>i.id===e);n?this.deleteLinks([n]):Ye.error("Unable to find link to delete",e)}handleUpdateValues(e,t){for(var n=A.getIdFromPanel(e),{dh:i,links:a,timeZone:o}=this.props,s=new Map,l=0;l<a.length;l+=1){var{start:d,end:u,operator:c}=a[l];if(d.panelId===n&&u!=null){var{panelId:m,columnName:f,columnType:g}=u,v=s.has(m)?s.get(m):new Map,p=v.has(f)===!0?v.get(f).filterList:[],{visibleIndex:C,isExpandable:S,isGrouped:y}=t[d.columnName],{value:w}=t[d.columnName],E="".concat(w);if(w===null&&S&&y&&(w=void 0),g!=null&&P.isDateType(g)){var D=new kt(i,{timeZone:o,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:He.FULL_DATE_FORMAT});E=D.format(w)}var M={operator:c,text:E,value:w,startColumnIndex:C};p.push(M),v.set(f,{columnType:g,filterList:p}),s.set(m,v)}}s.forEach((_,T)=>{this.setPanelFilterMap(T,_)})}handlePanelCloned(e,t){var{links:n}=this.props,i=A.getIdFromPanel(e),a=t.id;if(i!=null){var o=sr.cloneLinksForPanel(n,i,a);this.addLinks(o)}}handlePanelDragging(e){for(var{links:t}=this.props,n=0;n<t.length;n+=1){var i=t[n],{start:a,end:o}=i;if(a.panelId===e||(o==null?void 0:o.panelId)===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){Ye.debug("Panel ".concat(e," closed, deleting links.")),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){var{localDashboardId:t,setDashboardLinks:n}=this.props;n(t,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){var{localDashboardId:e,setDashboardIsolatedLinkerPanelId:t}=this.props;t(e,void 0)}deleteLinksForPanelId(e){for(var{links:t}=this.props,n=0;n<t.length;n+=1){var i=t[n],{start:a,end:o,id:s}=i;(a.panelId===e||(o==null?void 0:o.panelId)===e)&&this.handleLinkDeleted(s)}}isOverlayShown(){var{activeTool:e}=this.props;return e===zt.LINKER}updateSelectionValidators(){var{activeTool:e,setDashboardColumnSelectionValidator:t,localDashboardId:n}=this.props;switch(e){case zt.LINKER:t(n,this.isColumnSelectionValid);break;default:t(n,void 0);break}}updateLinkInProgressType(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"invalid";this.setState(t=>{var{linkInProgress:n}=t;return n!==void 0?{linkInProgress:gh(gh({},n),{},{type:e})}:null})}isColumnSelectionValid(e,t){var{linkInProgress:n}=this.state,{isolatedLinkerPanelId:i}=this.props;if(t==null)return(n==null?void 0:n.start)!=null&&this.updateLinkInProgressType(),!1;if(!lh(t))return Ye.debug2("Column is not filterable",t.description),(n==null?void 0:n.start)!=null&&this.updateLinkInProgressType("invalid"),!1;if((n==null?void 0:n.start)==null)return!0;var{isReversed:a,start:o}=n,s=A.getIdFromPanel(e);if(s==null)return!1;var l={panelId:s,panelComponent:A.getComponentNameFromPanel(e),columnName:t.name,columnType:t.type},d=a!==void 0&&a?sr.getLinkType(l,o,i):sr.getLinkType(o,l,i);return this.updateLinkInProgressType(d),d!=="invalid"}render(){var{links:e,isolatedLinkerPanelId:t,panelManager:n}=this.props,{linkInProgress:i,selectedIds:a,isDraggingPanel:o}=this.state,s=this.isOverlayShown(),l=i!=null&&i.start!=null,d=t===void 0?"Click a column source, then click a column target to create a filter link. The filter comparison operator used by a selected link can be changed. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.";return o?null:h.jsx(Pa,{in:s,timeout:_a.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:h.jsx(QO,{disabled:l,panelManager:n,links:this.getCachedLinks(e,i,t),selectedIds:a,messageText:d,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}var iD=nD(rD);const aD=iD;function ef(r){Yr(r);var{id:e,layout:t,panelManager:n}=r;return h.jsx(aD,{layout:t,localDashboardId:e,panelManager:n})}var oD={name:"LinkerPlugin",type:Yn.DASHBOARD_PLUGIN,component:ef};const sD=oD;function tf(r,e,t){return e=lD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lD(r){var e=dD(r,"string");return typeof e=="symbol"?e:String(e)}function dD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Xr{static getNewMarkdownTitle(e){for(var t="".concat(Xr.DEFAULT_TITLE),n=0;e.indexOf(t)>=0;)n+=1,t="".concat(Xr.DEFAULT_TITLE,"-").concat(n);return t}}tf(Xr,"DEFAULT_TITLE","Note");tf(Xr,"DEFAULT_CONTENT",`# Markdown Note
|
|
27
27
|
|
|
28
28
|
This note can be edited using **markdown** for styling.`);const Ro=Xr;function nf(r){Yr(r);var{id:e,layout:t,panelManager:n,registerComponent:i}=r,a=b.useCallback(s=>{var{title:l,componentState:d,props:u}=s,{panelState:c=null}=u;return d!=null&&({panelState:c=null}=d),l==null||c==null||c.content==null||c.content.length===0||c.content===Ro.DEFAULT_CONTENT?null:Ls(s)},[]),o=b.useCallback(function(){var{title:s="",metadata:l={},id:d=Ue.generate(),focusElement:u=A.DEFAULT_FOCUS_SELECTOR,createNewStack:c=!1,dragEvent:m=null}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},f=n.getOpenedPanelConfigsOfType(Nr.COMPONENT),g=n.getClosedPanelConfigsOfType(Nr.COMPONENT),v=f.map(w=>{var E;return(E=w.title)!==null&&E!==void 0?E:""}),p=s!=null&&s!==""?s:Ro.getNewMarkdownTitle(v),C=g.length>0?null:Ro.DEFAULT_CONTENT,S={type:"react-component",component:Nr.COMPONENT,props:{id:d,metadata:l,panelState:{content:C},localDashboardId:e},title:p,id:d},{root:y}=t;A.openComponent({root:y,config:S,focusElement:u,createNewStack:c,dragEvent:m})},[e,t,n]);return b.useEffect(function(){var l=[i(Nr.COMPONENT,Nr,As,a)];return()=>{l.forEach(d=>d())}},[a,i]),Pe(t.eventHub,hm.OPEN,o),null}var uD={name:"MarkdownPlugin",type:Yn.DASHBOARD_PLUGIN,component:nf};const hD=uD;function bh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ch(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?bh(Object(t),!0).forEach(function(n){cD(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):bh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function cD(r,e,t){return e=mD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mD(r){var e=fD(r,"string");return typeof e=="symbol"?e:String(e)}function fD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var nl=b.forwardRef((r,e)=>{var{localDashboardId:t,fetch:n,metadata:i}=r,a=Gm(n,t,i);return h.jsx(Hm,Ch(Ch({ref:e},r),a))});nl.displayName="PandasPanelPlugin";const vD=nl;function yh(r,e,t,n,i,a,o){try{var s=r[a](o),l=s.value}catch(d){t(d);return}s.done?e(l):Promise.resolve(l).then(n,i)}function Lo(r){return function(){var e=this,t=arguments;return new Promise(function(n,i){var a=r.apply(e,t);function o(l){yh(a,n,i,o,s,"next",l)}function s(l){yh(a,n,i,o,s,"throw",l)}o(void 0)})}}function rf(r){var e=vr(),[t,n]=b.useState(),[i,a]=b.useState(!0),[o,s]=b.useState(!1),{fetch:l}=r,d=b.useCallback(Lo(function*(){var c=yield l();return Vs.makeModel(e,c)}),[e,l]),u=b.useCallback(Lo(function*(){a(!0);var c=yield d();n(c),a(!1)}),[d]);return b.useEffect(()=>{var c=!1;function m(){return f.apply(this,arguments)}function f(){return f=Lo(function*(){var g=yield d();c||(n(g),s(!0),a(!1))}),f.apply(this,arguments)}return m(),a(!0),()=>{c=!0}},[d]),h.jsxs(h.Fragment,{children:[h.jsx(dn,{isLoaded:o,isLoading:i}),t&&h.jsx(Ya,{model:t,children:h.jsx($m,{onClick:u})})]})}var pD={name:"PandasPanel",title:"Pandas",type:Yn.WIDGET_PLUGIN,component:rf,panelComponent:nl,supportedTypes:"pandas.DataFrame",icon:Dh};const gD=pD;function Sh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function mi(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sh(Object(t),!0).forEach(function(n){bD(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Sh(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function bD(r,e,t){return e=CD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function CD(r){var e=yD(r,"string");return typeof e=="symbol"?e:String(e)}function yD(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var SD=z.module("WidgetLoaderPlugin");function wD(r){var e;function t(n,i){var a,o=r.component,{metadata:s}=n,l=Tc(o);return h.jsx(Ki,mi(mi({widgetName:(a=s==null?void 0:s.name)!==null&&a!==void 0?a:void 0,widgetType:r.title},n),{},{children:l?h.jsx(o,mi(mi({},n),{},{ref:i})):h.jsx(o,mi({},n))}))}return t.displayName="WidgetLoaderPlugin(".concat((e=r.component.displayName)!==null&&e!==void 0?e:r.name,")"),b.forwardRef(t)}function af(r){var e=Ah(),t=b.useMemo(()=>{var s=new Map;return e.forEach(l=>{Cv(l)&&[l.supportedTypes].flat().forEach(d=>{if(d!=null&&d!==""){if(s.has(d)){var u;SD.warn("Multiple WidgetPlugins handling type ".concat(d,". Replacing ").concat((u=s.get(d))===null||u===void 0?void 0:u.name," with ").concat(l.name," to handle ").concat(d))}s.set(d,l)}})}),s},[e]);Yr(r);var{id:n,layout:i,registerComponent:a}=r,o=b.useCallback(s=>{var l,{dragEvent:d,panelId:u=Ue.generate(),fetch:c,widget:m}=s,{type:f}=m,g=f!=null?t.get(f):null;if(g!=null){var v=(l=m.name)!==null&&l!==void 0?l:f,p={localDashboardId:n,metadata:m,fetch:c},C={type:"react-component",component:g.name,props:p,title:v,id:u},{root:S}=i;A.openComponent({root:S,config:C,dragEvent:d})}},[n,i,t]);return b.useEffect(()=>{var s=[...new Set(t.values())].map(l=>{var{panelComponent:d}=l;return d==null?a(l.name,wD(l)):a(l.name,d)});return()=>{s.forEach(l=>l())}},[a,t]),Pe(i.eventHub,se.OPEN,o),null}var ED={name:"WidgetLoaderPlugin",type:Yn.DASHBOARD_PLUGIN,component:af};const PD=ED;function po(r,e,t){return e=TD(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function TD(r){var e=_D(r,"string");return typeof e=="symbol"?e:String(e)}function _D(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}class Zi{}po(Zi,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER");po(Zi,"INPUT_FILTER","ControlType.INPUT_FILTER");po(Zi,"MARKDOWN","ControlType.MARKDOWN");po(Zi,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const OD=Zi;var DD=O.shape({state:O.shape({panelState:O.shape({})})}),MD=O.shape({panelId:O.string.isRequired,columnName:O.string.isRequired,columnType:O.string.isRequired}),wh=O.shape({panelId:O.string.isRequired,columnName:O.string.isRequired}),of=O.shape({start:wh,end:wh,id:O.string,isReversed:O.bool}),ID=O.arrayOf(of),ND=O.shape({name:O.string.isRequired,operateAs:O.string.isRequired,groups:O.arrayOf(O.string).isRequired,permissions:O.shape({canUsePanels:O.bool.isRequired,canCopy:O.bool.isRequired,canDownloadCsv:O.bool.isRequired,canLogout:O.bool.isRequired}).isRequired}),xD=Object.freeze({LinkPoint:MD,Link:of,Links:ID,Panel:DD,User:ND});const FD=xD;var RD=(r,e)=>r[e]===null?null:O.bool,LD=(r,e)=>r[e]===null?null:O.string,AD=Object.freeze({nullableBoolean:RD,nullableString:LD});const kD=AD,fM=Object.freeze(Object.defineProperty({__proto__:null,ChartBuilderPlugin:Um,ChartBuilderPluginConfig:OO,ChartEvent:Aa,ChartPanel:qi,ChartPanelPlugin:wO,ChartPluginConfig:TO,ChartWidgetPlugin:Vm,CommandHistoryPanel:Dm,CommonPropTypes:kD,ConsoleEvent:Dt,ConsolePanel:Sa,ConsolePlugin:xO,ControlType:OD,DropdownFilterPanel:Zn,FileExplorerPanel:xm,FilterPlugin:Bm,FilterPluginConfig:RO,FilterSetManager:Fm,FilterSetManagerPanel:Ea,GridPanelPlugin:HO,GridPluginConfig:BO,GridWidgetPlugin:zm,InputFilterEvent:Ve,InputFilterPanel:$r,IrisGridEvent:jt,IrisGridPanel:zr,LinkerPlugin:ef,LinkerPluginConfig:sD,LinkerUtils:sr,LogPanel:Am,MarkdownEvent:hm,MarkdownPanel:Nr,MarkdownPlugin:nf,MarkdownPluginConfig:hD,MockFileStorage:pO,NotebookEvent:Se,NotebookPanel:Un,PandasEvent:KP,PandasPanel:Hm,PandasPanelPlugin:vD,PandasPluginConfig:gD,PandasWidgetPlugin:rf,Panel:hn,TabEvent:Ci,ToolType:zt,UIPropTypes:FD,WidgetLoaderPlugin:af,WidgetLoaderPluginConfig:PD,WidgetPanel:Ki,WidgetPanelTooltip:zi,addDashboardLinks:ym,deleteDashboardLinks:Sm,getColumnSelectionValidatorForDashboard:ao,getColumnsForDashboard:Ws,getDashboardConnection:uT,getDashboardConsoleSettings:dT,getDashboardSessionWrapper:ti,getFilterSetsForDashboard:Cm,getInputFiltersForDashboard:no,getIsolatedLinkerPanelIdForDashboard:io,getLinksForDashboard:Sr,getTableMapForDashboard:ro,isChartPanelDehydratedProps:Om,isChartPanelFigureMetadata:zs,isChartPanelTableMetadata:jr,isGLChartPanelState:_m,isIrisGridPanelMetadata:Lm,isLegacyIrisGridPanelMetadata:Rm,setDashboardColumnSelectionValidator:wm,setDashboardConnection:hT,setDashboardConsoleSettings:Em,setDashboardFilterSets:Pm,setDashboardIsolatedLinkerPanelId:Gs,setDashboardLinks:oo,setDashboardSessionWrapper:cT,useLoadTablePlugin:Wm},Symbol.toStringTag,{value:"Module"}));export{$o as $,vr as A,Y as B,Mp as C,kr as D,cg as E,rc as F,Pn as G,nc as H,Ot as I,WD as J,q as K,GD as L,re as M,mg as N,hg as O,ys as P,gg as Q,Sn as R,Es as S,On as T,ng as U,Cg as V,kt as W,He as X,ze as Y,_g as Z,Zt as _,cp as a,Ma as a$,sn as a0,Ig as a1,ot as a2,P as a3,zD as a4,ac as a5,Vg as a6,XD as a7,JD as a8,KD as a9,si as aA,Pe as aB,se as aC,_y as aD,oM as aE,sM as aF,AC as aG,KS as aH,py as aI,qS as aJ,Qy as aK,Dn as aL,Ty as aM,ks as aN,Sy as aO,Rs as aP,kc as aQ,Yr as aR,Tc as aS,Ls as aT,AS as aU,kS as aV,st as aW,$c as aX,Hc as aY,As as aZ,gy as a_,qD as aa,ZD as ab,Fg as ac,eM as ad,tM as ae,qg as af,Xg as ag,Ug as ah,Bg as ai,Zg as aj,rM as ak,nM as al,VD as am,bo as an,mb as ao,yb as ap,ut as aq,oc as ar,Ti as as,sc as at,iM as au,Xl as av,_b as aw,ed as ax,Ob as ay,A as az,Bh as b,FS as b0,Vc as b1,Tt as b2,xP as b3,ee as b4,Ya as b5,Bc as b6,Td as b7,_d as b8,Bi as b9,lw as bA,uM as bB,Xo as bC,dM as bD,$g as bE,jg as bF,Hg as bG,QD as bH,Ii as bI,YD as bJ,gs as bK,Ca as bL,Qn as bM,L as bN,be as bO,eP as bP,Ei as bQ,ce as ba,Vs as bb,SP as bc,um as bd,dm as be,OP as bf,Ne as bg,ur as bh,cM as bi,Fd as bj,hM as bk,nn as bl,fM as bm,Oe as bn,lM as bo,Wc as bp,ps as bq,jh as br,yn as bs,Dd as bt,Zo as bu,Hn as bv,B as bw,Lt as bx,P0 as by,Kc as bz,Uh as c,dp as d,Hh as e,fe as f,UD as g,Jh as h,fr as i,Ba as j,Tl as k,ws as l,Hp as m,Xp as n,Jp as o,Ss as p,rg as q,kl as r,Vr as s,je as t,lp as u,De as v,tc as w,Qh as x,BD as y,Qv as z};
|
|
29
|
-
//# sourceMappingURL=index-
|
|
29
|
+
//# sourceMappingURL=index-f0554a8a.js.map
|