@deephaven/code-studio 1.22.2-alpha-pivot-builder.0730ba6.0 → 1.23.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.
Files changed (49) hide show
  1. package/build/assets/{AppRoot-BYG9QxmH.js → AppRoot-DbQCWZTt.js} +7 -7
  2. package/build/assets/{AppRoot-BYG9QxmH.js.map → AppRoot-DbQCWZTt.js.map} +1 -1
  3. package/build/assets/{Chart-C4BfvN_4.js → Chart-DcAu2C8r.js} +2 -2
  4. package/build/assets/{Chart-C4BfvN_4.js.map → Chart-DcAu2C8r.js.map} +1 -1
  5. package/build/assets/{ControlType-CR2gupu4.js → ControlType-Befg12ds.js} +5 -5
  6. package/build/assets/{ControlType-CR2gupu4.js.map → ControlType-Befg12ds.js.map} +1 -1
  7. package/build/assets/{FormatterUtils-Cy1uCPlz.js → FormatterUtils-MUBvtVZH.js} +2 -2
  8. package/build/assets/{FormatterUtils-Cy1uCPlz.js.map → FormatterUtils-MUBvtVZH.js.map} +1 -1
  9. package/build/assets/{Grid-B_xvYHhV.js → Grid-NISpLPEC.js} +2 -2
  10. package/build/assets/{Grid-B_xvYHhV.js.map → Grid-NISpLPEC.js.map} +1 -1
  11. package/build/assets/{GridTokenMouseHandler-4RU6zt9D.js → GridTokenMouseHandler-DYoFGIB4.js} +2 -2
  12. package/build/assets/{GridTokenMouseHandler-4RU6zt9D.js.map → GridTokenMouseHandler-DYoFGIB4.js.map} +1 -1
  13. package/build/assets/{IrisGrid-DejYZq4M.js → IrisGrid-DNjLcT3l.js} +2 -2
  14. package/build/assets/{IrisGrid-DejYZq4M.js.map → IrisGrid-DNjLcT3l.js.map} +1 -1
  15. package/build/assets/{IrisGridModel-BC8le8y5.js → IrisGridModel-DR8-Pxhc.js} +4 -4
  16. package/build/assets/{IrisGridModel-BC8le8y5.js.map → IrisGridModel-DR8-Pxhc.js.map} +1 -1
  17. package/build/assets/{IrisGridShortcuts-DjQ7t-H7.js → IrisGridShortcuts-CvKofD7x.js} +2 -2
  18. package/build/assets/{IrisGridShortcuts-DjQ7t-H7.js.map → IrisGridShortcuts-CvKofD7x.js.map} +1 -1
  19. package/build/assets/{IrisGridThemeProvider-CWwyBa0t.js → IrisGridThemeProvider-5LSst4dQ.js} +2 -2
  20. package/build/assets/IrisGridThemeProvider-5LSst4dQ.js.map +1 -0
  21. package/build/assets/{LocalWorkspaceStorage-DGbuiTvD.js → LocalWorkspaceStorage-BnIfiumx.js} +2 -2
  22. package/build/assets/{LocalWorkspaceStorage-DGbuiTvD.js.map → LocalWorkspaceStorage-BnIfiumx.js.map} +1 -1
  23. package/build/assets/{MarkdownEditor-BSoSMC_6.js → MarkdownEditor-CE0PRr71.js} +2 -2
  24. package/build/assets/{MarkdownEditor-BSoSMC_6.js.map → MarkdownEditor-CE0PRr71.js.map} +1 -1
  25. package/build/assets/{MarkdownNotebook-CcU9eRO5.js → MarkdownNotebook-_mAIkamc.js} +2 -2
  26. package/build/assets/{MarkdownNotebook-CcU9eRO5.js.map → MarkdownNotebook-_mAIkamc.js.map} +1 -1
  27. package/build/assets/{MissingPartitionError-Cm71FD9Y.js → MissingPartitionError-COQPMoCk.js} +2 -2
  28. package/build/assets/{MissingPartitionError-Cm71FD9Y.js.map → MissingPartitionError-COQPMoCk.js.map} +1 -1
  29. package/build/assets/{MockChartModel-BZvT03u4.js → MockChartModel-B1CLYsnL.js} +2 -2
  30. package/build/assets/{MockChartModel-BZvT03u4.js.map → MockChartModel-B1CLYsnL.js.map} +1 -1
  31. package/build/assets/Plot-DMjw9GWc.js +2 -0
  32. package/build/assets/{Plot-TfxZDgHj.js.map → Plot-DMjw9GWc.js.map} +1 -1
  33. package/build/assets/{Plotly-FpWpXJKa.js → Plotly-ef0IRrqv.js} +2 -2
  34. package/build/assets/{Plotly-FpWpXJKa.js.map → Plotly-ef0IRrqv.js.map} +1 -1
  35. package/build/assets/{StyleGuideRoot-xBfU_7zC.js → StyleGuideRoot-dA2xCRM4.js} +2 -2
  36. package/build/assets/{StyleGuideRoot-xBfU_7zC.js.map → StyleGuideRoot-dA2xCRM4.js.map} +1 -1
  37. package/build/assets/{index--Fycg9W2.js → index-CNYwQhEi.js} +3 -3
  38. package/build/assets/{index--Fycg9W2.js.map → index-CNYwQhEi.js.map} +1 -1
  39. package/build/assets/{index-M_YcjWjf.js → index-CeeM9lsZ.js} +4 -4
  40. package/build/assets/{index-M_YcjWjf.js.map → index-CeeM9lsZ.js.map} +1 -1
  41. package/build/assets/{index-CUibpClD.js → index-CjKdwP8V.js} +2 -2
  42. package/build/assets/{index-CUibpClD.js.map → index-CjKdwP8V.js.map} +1 -1
  43. package/build/assets/plotly-2vlwy6OF.js +7 -0
  44. package/build/assets/{plotly-nqq5FPz9.js.map → plotly-2vlwy6OF.js.map} +1 -1
  45. package/build/index.html +2 -2
  46. package/package.json +31 -31
  47. package/build/assets/IrisGridThemeProvider-CWwyBa0t.js.map +0 -1
  48. package/build/assets/Plot-TfxZDgHj.js +0 -2
  49. package/build/assets/plotly-nqq5FPz9.js +0 -7
@@ -1,4 +1,4 @@
1
- import{r as b,I as s,K,ad as xi,H as ln,U as Oe,M as ie,L as dn,a0 as ut,a1 as ne,bJ as Ve,bD as Va,bE as $a,bC as Ga,bk as Wn,a9 as zn,bG as qn,aw as Qt}from"./vendor-CLIsHur_.js";import{f as vn,L as fe,a3 as Lt,e as W,g as pn,cf as Kn,cg as Ba,ch as Ha,W as un,aO as Wa,aP as za,c8 as Oi,c9 as cn,ci as qa,cj as Ka,ck as Qn,aT as Qa,cl as Yn,cm as Yt,bI as Xn,cn as Ya,aU as Xa,co as Za,aK as Ja,cp as er,cq as tr,aX as nr,br as ir,bm as ar,M as Ri,b as Ii,cr as rr,cs as or,c as Di,k as Li,G as sr,ct as lr,cu as dr,bZ as ur,aS as cr,cv as hr,w as mr,cw as gr,cx as vr,cy as pr,t as fr,b2 as Cr,cz as Sr,bB as Xt,bM as br}from"./index--Fycg9W2.js";import{c as T,S as Ye,B as Y,y as fn,P as Ae,O as nt,e9 as yr,v as mt,bh as Cn,aS as ji,af as Pi,dq as Tr,at as de,dC as Ne,V as Mi,_ as Er,t as De,au as ki,C as wr,dM as Ui,Y as Ar,c0 as Fr,T as Te,U as _r,b0 as Nr,F as Zt,aw as xr,bA as Or,ea as Rr}from"./ControlType-CR2gupu4.js";import{o as Ir,p as Dr,q as Lr,s as jr,I as le,g as Pr,k as lt,a as Rt,f as Mr,c as Jt,n as kr,i as Ur}from"./MissingPartitionError-Cm71FD9Y.js";import{G as Xe,d as Ee,e as hn,I as me}from"./IrisGridModel-BC8le8y5.js";import{u as ye,P as Vr,B as $r,F as Gr,_ as Z,a6 as Br,R as Hr,a3 as ke,E as Wr,T as zr,Y as qr,H as Kr,J as Qr,U as Yr,N as Xr,K as Zr,M as Jr,$ as eo,Q as to,L as no,a7 as en,a8 as io,A as ao,x as ro,a1 as oo,z as so,a5 as lo,C as uo,a4 as co,W as ho,O as mo}from"./IrisGridThemeProvider-CWwyBa0t.js";import{S as go,o as Re,e as Vi,C as $i,b as vo,h as po,P as Zn}from"./GridTokenMouseHandler-4RU6zt9D.js";import{I as $e,p as Jn,S as fo,D as Co}from"./IrisGridShortcuts-DjQ7t-H7.js";import{K as jt,G as So}from"./Grid-B_xvYHhV.js";import{F as ei}from"./FormatterUtils-Cy1uCPlz.js";import"./helpers-BosuxZz1.js";import"./monaco-DaE0jI-i.js";import"./useMergeRef-BO8MVMb8.js";function ti(n,e,t){return(e=bo(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bo(n){var e=yo(n,"string");return typeof e=="symbol"?e:e+""}function yo(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var wt=fe.module("AdvancedFilterCreatorFilterItem");class Sn extends b.PureComponent{static getLabelForFilter(e,t){try{if(T.isNumberType(e)||T.isCharType(e))return Ir(t);if(T.isTextType(e))return Dr(t);if(T.isDateType(e))return Lr(t);if(T.isBooleanType(e))return jr(t);throw new Error("Unrecognized column type: ".concat(e))}catch(i){return wt.warn(i),""}}constructor(e){super(e),ti(this,"typeDropdown",void 0),ti(this,"getCachedIsValid",xi((d,l,u,c,m)=>{try{return!u||m.makeAdvancedValueFilter(d,l,u,c)!=null}catch{return!1}})),this.handleDelete=this.handleDelete.bind(this),this.handleTypeChange=this.handleTypeChange.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.typeDropdown=null;var t=e.value,i=t===void 0?"":t,a=e.filterTypes,o=e.selectedType,r=o===void 0?a[0]:o;this.state={selectedType:r,value:i}}componentDidMount(){var e;(e=this.typeDropdown)===null||e===void 0||e.focus()}componentDidUpdate(e){var t=this.props,i=t.value,a=t.selectedType;a!==void 0&&e.selectedType!==a&&this.setState({selectedType:a}),i!==void 0&&e.value!==i&&this.setState({value:i})}handleTypeChange(e){var t=e;wt.debug2("typeChange",t),this.setState({selectedType:t});var i=this.props.onChange,a=this.state.value;a!=null&&a.length>0&&i(t,a)}handleValueChange(e){wt.debug2("valueChange");var t=e.target.value;this.setState({value:t});var i=this.props.onChange,a=this.state.selectedType;a!=null&&i(a,t)}handleDelete(){wt.debug("delete");var e=this.props.onDelete;e()}render(){for(var e=this.props,t=e.column,i=e.filterTypes,a=e.formatter,o=e.tableUtils,r=this.state,d=r.selectedType,l=r.value,u=!T.isBooleanType(t.type),c=[],m=this.getCachedIsValid(t,d,l,a.timeZone,o),v=0;v<i.length;v+=1){var h=i[v],f=Sn.getLabelForFilter(t.type,h),C=s.jsx("option",{value:h,children:f},h);c.push(C)}return s.jsx("div",{className:"advanced-filter-creator-filter-item",children:s.jsxs("div",{className:"form-row",children:[s.jsx("div",{className:"form-group col",children:s.jsx(Ye,{className:"form-control",value:d,onChange:this.handleTypeChange,ref:S=>{this.typeDropdown=S},children:c})}),u&&s.jsx("div",{className:"form-group col",children:s.jsx("div",{className:"input-group",children:s.jsx("input",{type:"text",className:K("form-control",{error:!m}),placeholder:"Enter value",value:l,onChange:this.handleValueChange})})}),s.jsx("div",{className:"form-group col-1 px-0",children:s.jsx(Y,{kind:"ghost",className:"w-100 h-100 p-0 m-0",onClick:this.handleDelete,icon:vn,tooltip:"Remove Filter"})})]})})}}function mn(n,e,t){return(e=To(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function To(n){var e=Eo(n,"string");return typeof e=="symbol"?e:e+""}function Eo(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ni=fe.module("AdvancedFilterCreatorSelectValueList");class gt extends b.PureComponent{static indexOf(e,t){for(var i=0;i<t.length;i+=1){var a=t[i];if(a===e||a!=null&&a.valueOf!=null&&e!=null&&e.valueOf!=null&&a.valueOf()===e.valueOf())return i}return-1}constructor(e){super(e),mn(this,"dh",void 0),mn(this,"list",void 0),this.handleSelect=this.handleSelect.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this);var t=this.props,i=t.selectedValues,a=t.dh;this.dh=a,this.list=null,this.state={itemCount:0,items:[],offset:0,selectedValues:i,isLoading:!0}}componentDidMount(){var e=this.props.table;e&&this.startListening(e)}componentDidUpdate(e){var t=this.props,i=t.filters,a=t.invertSelection,o=t.selectedValues,r=t.table;e.table!==r&&(e.table&&this.stopListening(e.table),r&&this.startListening(r),this.resetViewport()),e.invertSelection!==a&&this.setState({selectedValues:[]},this.handleSelectionUpdate),e.selectedValues!==o&&this.setState({selectedValues:o},this.handleSelectionUpdate),e.filters!==i&&(r==null||r.applyFilter(i),this.resetViewport())}componentWillUnmount(){var e=this.props.table;e&&this.stopListening(e)}handleSelect(e,t){var i=this.props.invertSelection,a=this.state.selectedValues;a=[...a];var o=gt.indexOf(t,a);o>=0?a.splice(o,1):a.push(t);var r=o<0;i&&(r=!r);var d=this.state.offset,l=this.state.items;l=[...l];var u=e-d;u>=0&&u<l.length&&(l[u].isSelected=r),this.setState({items:l,selectedValues:a});var c=this.props.onChange;c(a,i)}handleViewportChange(e,t){this.updateViewport(e,t)}handleSelectionUpdate(){this.updateItemSelection()}handleTableUpdate(e){var t=this.props,i=t.table,a=t.formatter;if(i){for(var o=e.detail,r=o.offset,d=[],l=i.columns[0],u=0;u<o.rows.length;u+=1){var c=o.rows[u],m=c.get(l),v=void 0;m==null?v=s.jsx("i",{className:"text-muted",children:"null"}):m===""?v=s.jsx("i",{className:"text-muted",children:"empty"}):v=a.getFormattedString(m,l.type,l.name);var h=this.isValueSelected(m);d.push({displayValue:v,value:m,isSelected:h})}ni.debug2("Received table update:",r,d.length);var f=i.size;this.setState({itemCount:f,items:d,offset:r,isLoading:!1})}}isValueSelected(e){var t=this.props.invertSelection,i=this.state.selectedValues,a=gt.indexOf(e,i);return t?a<0:a>=0}startListening(e){e.addEventListener(this.dh.Table.EVENT_UPDATED,this.handleTableUpdate)}stopListening(e){e.removeEventListener(this.dh.Table.EVENT_UPDATED,this.handleTableUpdate)}resetViewport(){this.list&&this.list.topRow!=null&&this.list.bottomRow!=null&&this.updateViewport(this.list.topRow,this.list.bottomRow,!0)}updateItemSelection(){var e=this.state.items;e=[...e];for(var t=0;t<e.length;t+=1){var i=e[t],a=i.value;i.isSelected=this.isValueSelected(a)}this.setState({items:e})}updateViewport(e,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=this.props.table;if(a!=null){i&&this.setState({isLoading:!0});var o=t-e+1,r=Math.max(0,e-o*3),d=Math.max(r,t+o*3);ni.debug2("Setting viewport",r,",",d),a.setViewport(r,d)}}render(){var e=this.state,t=e.offset,i=e.isLoading,a=e.items,o=e.itemCount;return s.jsxs("div",{className:"select-value-list-wrapper",children:[s.jsx(go,{itemCount:o,items:a,offset:t,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:r=>{this.list=r}}),s.jsx(fn,{in:i,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx("div",{className:"loading-list",children:s.jsx(Lt,{className:"loading-spinner-large"})})})]})}}mn(gt,"defaultProps",{invertSelection:!0,selectedValues:[],onChange:()=>{}});function ct(n,e,t){return(e=wo(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wo(n){var e=Ao(n,"string");return typeof e=="symbol"?e:e+""}function Ao(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class pt extends b.PureComponent{constructor(e){super(e),ct(this,"searchTablePromise",void 0),ct(this,"tableUtils",void 0),ct(this,"updateFilterTimer",void 0),this.handleSelectAllClick=this.handleSelectAllClick.bind(this),this.handleClearAllClick=this.handleClearAllClick.bind(this),this.handleListChange=this.handleListChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUpdateFilterTimeout=this.handleUpdateFilterTimeout.bind(this);var t=e.dh,i=e.invertSelection,a=e.selectedValues;this.tableUtils=new T(t),this.state={filters:[],invertSelection:i,selectedValues:a,searchText:""}}componentDidMount(){this.initSearchTable()}componentDidUpdate(e,t){var i=this.props,a=i.invertSelection,o=i.selectedValues,r=i.table;e.table!==r&&this.initSearchTable(),e.invertSelection!==a&&this.setState({invertSelection:a}),e.selectedValues!==o&&this.setState({selectedValues:o});var d=this.state,l=d.table,u=d.searchText;l!==t.table&&(t.table!=null&&t.table.close(),l!=null&&this.startUpdateFilterTimer()),u!==t.searchText&&this.startUpdateFilterTimer()}componentWillUnmount(){var e=this.state.table;e!=null&&e.close(),this.searchTablePromise=void 0,this.stopUpdateFilterTimer()}getColumnName(){var e=this.props.table;return e!=null?e.columns[0].name:""}getDisplayedValuesCount(){var e=this.state,t=e.invertSelection,i=e.selectedValues,a=e.table;return a==null?null:t?a.totalSize-i.length:i.length}getDisplayedValueText(){var e=this.getDisplayedValuesCount(),t=this.state.table,i=this.props.formatter;if(e!=null&&t!=null){var a=i.getFormattedString(e,"long"),o=i.getFormattedString(t.totalSize,"long"),r="";return e<1e6&&(r="Displaying "),"".concat(r).concat(a," of ").concat(o)}return null}initSearchTable(){var e=this.props.table;if(e!=null){var t=e.copy();this.searchTablePromise=t,this.searchTablePromise.then(i=>{this.searchTablePromise===t?(this.setState({table:i}),this.searchTablePromise=void 0):i.close()})}}handleListChange(e,t){this.setState({selectedValues:e,invertSelection:t});var i=this.props.onChange;i(e,t)}handleSearchChange(e){var t=e.target.value;this.setState({searchText:t})}handleSelectAllClick(){this.resetSelection(!0)}handleClearAllClick(){this.resetSelection(!1)}handleUpdateFilterTimeout(){this.updateFilterTimer=void 0,this.updateTableFilter()}resetSelection(e){var t=[];this.setState({invertSelection:e,selectedValues:t});var i=this.props.onChange;i(t,e)}startUpdateFilterTimer(){this.stopUpdateFilterTimer(),this.updateFilterTimer=setTimeout(this.handleUpdateFilterTimeout,pt.searchDebounceTime)}stopUpdateFilterTimer(){this.updateFilterTimer!=null&&(clearTimeout(this.updateFilterTimer),this.updateFilterTimer=void 0)}updateTableFilter(){var e=this.state,t=e.table,i=e.searchText,a=this.props.timeZone,o=this.tableUtils,r=t==null?void 0:t.columns[0],d=[];if(r!=null){var l;if(i.length>0){var u=null;T.isCharType(r.type)?u=o.makeQuickFilter(r,i):T.isTextType(r.type)?u=o.makeQuickFilter(r,"~".concat(i),a):u=o.makeQuickFilter(r,">=".concat(i),a),u!=null?d.push(u):l="Invalid search text"}this.setState({filters:d,error:l})}}render(){var e=this.state,t=e.error,i=e.filters,a=e.invertSelection,o=e.selectedValues,r=e.searchText,d=e.table,l=this.props,u=l.dh,c=l.formatter,m=l.showSearch,v=this.getColumnName(),h=this.getDisplayedValueText(),f=v?"Find ".concat(v,"..."):"";return s.jsxs("div",{className:"advanced-filter-creator-select-value",children:[s.jsxs("div",{className:m?"form-group":"",children:[s.jsx("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),m&&s.jsx("input",{type:"text",className:K("form-control",{"is-invalid":t!=null}),id:"advanced-filter-creator-select-value-input",placeholder:f,value:r,onChange:this.handleSearchChange})]}),s.jsx(gt,{dh:u,table:d,filters:i,invertSelection:a,selectedValues:o,formatter:c,onChange:this.handleListChange}),s.jsxs("div",{className:"advanced-filter-creator-select-meta-row",children:[s.jsxs("div",{children:[s.jsx(Y,{kind:"ghost",onClick:this.handleSelectAllClick,children:"Select All"}),s.jsx(Y,{kind:"ghost",onClick:this.handleClearAllClick,children:"Clear"})]}),s.jsx(fn,{in:h!=null,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx("div",{className:"row-count-info",children:h})})]})]})}}ct(pt,"searchDebounceTime",250);ct(pt,"defaultProps",{invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0});function Qe(n,e,t){return(e=Fo(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fo(n){var e=_o(n,"string");return typeof e=="symbol"?e:e+""}function _o(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var it=fe.module("AdvancedFilterCreator");class xe extends b.PureComponent{static makeFilterItem(){return{key:ln()}}constructor(e){var t,i;super(e),Qe(this,"focusTrapContainer",void 0),Qe(this,"debounceTimeout",void 0),Qe(this,"valuesTablePromise",void 0),Qe(this,"getFilterTypes",xi(h=>T.getFilterTypes(h))),this.handleAddAnd=this.handleAddAnd.bind(this),this.handleAddOr=this.handleAddOr.bind(this),this.handleChangeFilterOperator=this.handleChangeFilterOperator.bind(this),this.handleDone=this.handleDone.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterDelete=this.handleFilterDelete.bind(this),this.handleSelectValueChange=this.handleSelectValueChange.bind(this),this.handleReset=this.handleReset.bind(this),this.handleSortDown=this.handleSortDown.bind(this),this.handleSortUp=this.handleSortUp.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleFocusTrapStart=this.handleFocusTrapStart.bind(this),this.handleFocusTrapEnd=this.handleFocusTrapEnd.bind(this),this.handleUpdateTimeout=this.handleUpdateTimeout.bind(this),this.focusTrapContainer=Oe.createRef();var a=e.model,o=e.column,r=e.options,d=r.filterOperators,l=r.invertSelection,u=r.selectedValues,c=(t=(i=r.filterItems)===null||i===void 0?void 0:i.map(h=>{var f=h.selectedType,C=h.value;return{selectedType:f,value:C,key:ln()}}))!==null&&t!==void 0?t:[];c.length===0&&c.push(xe.makeFilterItem()),d==null&&(d=[]),l==null&&(l=!0),u==null&&(u=[]);var m=a.getColumnIndexByName(o.name);W(m);var v=a.isColumnSortable(m);this.state={filterItems:c,filterOperators:d,invertSelection:l,selectedValues:u,valuesTableError:null,valuesTable:void 0,isSortable:v}}componentDidMount(){this.initValuesTable()}componentWillUnmount(){this.debounceTimeout!=null&&(clearTimeout(this.debounceTimeout),this.sendUpdate()),this.valuesTablePromise!=null&&this.valuesTablePromise.cancel()}getFilterChangeHandler(e){return this.handleFilterChange.bind(this,e)}getFilterDeleteHandler(e){return this.handleFilterDelete.bind(this,e)}initValuesTable(){var e=this.props,t=e.model,i=e.column;if(!t.isValuesTableAvailable){it.debug("No values table for this model, just ignore");return}this.valuesTablePromise=T.makeCancelableTablePromise(t.valuesTable(i)),this.valuesTablePromise.then(a=>{var o;if(!((o=a.columns[0].isSortable)!==null&&o!==void 0)||o){var r=a.columns[0].sort().asc();a.applySort([r])}this.setState({valuesTable:a})}).catch(a=>{Ae.isCanceled(a)||(it.error("Unable to open values table",a),this.setState({valuesTableError:a}))})}handleFocusTrapEnd(){var e;((e=this.focusTrapContainer)===null||e===void 0||(e=e.current)===null||e===void 0?void 0:e.querySelector("button,select,input,textarea")).focus()}handleFocusTrapStart(){var e,t=(e=this.focusTrapContainer)===null||e===void 0||(e=e.current)===null||e===void 0?void 0:e.querySelectorAll("button,select,input,textarea");if(t&&t.length>0){var i=t[t.length-1];i.focus()}}handleAddAnd(){var e=this.state,t=e.filterItems,i=e.filterOperators;t=t.concat(xe.makeFilterItem()),i=i.concat(nt.and),this.setState({filterItems:t,filterOperators:i})}handleAddOr(){var e=this.state,t=e.filterItems,i=e.filterOperators;t=t.concat(xe.makeFilterItem()),i=i.concat(nt.or),this.setState({filterItems:t,filterOperators:i})}handleChangeFilterOperator(e,t){var i=this.state.filterOperators;i=[...i],yr(t),i[e]=t,this.setState({filterOperators:i}),this.startUpdateTimer()}handleFilterChange(e,t,i){var a=this.state.filterItems;a=[...a];var o=a[e].key;a[e]={key:o,selectedType:t,value:i},this.setState({filterItems:a}),this.startUpdateTimer()}handleFilterDelete(e){var t=this.state,i=t.filterItems,a=t.filterOperators;i=[...i],a=[...a],e<i.length&&i.splice(e,1),e<a.length?a.splice(e,1):e===a.length&&a.splice(a.length-1,1),i.length===0&&i.push(xe.makeFilterItem()),this.setState({filterItems:i,filterOperators:a}),this.startUpdateTimer()}handleSelectValueChange(e,t){this.setState({selectedValues:e,invertSelection:t}),this.startUpdateTimer()}handleReset(){it.debug("Resetting Advanced Filter"),this.setState({filterItems:[xe.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(e){var t=mt.isModifierKeyDown(e);this.sortTable(T.sortDirection.descending,t)}handleSortUp(e){var t=mt.isModifierKeyDown(e);this.sortTable(T.sortDirection.ascending,t)}handleSubmit(e){it.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),e.preventDefault()}handleDone(e){it.debug("Submitting and Closing Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate();var t=this.props.onDone;t(),e.preventDefault()}handleUpdateTimeout(){this.debounceTimeout=void 0,this.sendUpdate()}shouldShowAddFilter(){var e=this.state.filterItems;if(e.length===0)return!1;var t=e[e.length-1],i=t.selectedType,a=t.value;return i!=null&&i.length>0&&a!=null&&a.length>0}sortTable(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=this.props,a=i.column,o=i.onSortChange,r=this.state.isSortable;r&&o(a,e,t)}startUpdateTimer(){this.stopUpdateTimer(),this.debounceTimeout=setTimeout(this.handleUpdateTimeout,xe.debounceFilterUpdate)}stopUpdateTimer(){this.debounceTimeout!==void 0&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0)}sendUpdate(){var e=this.state,t=e.filterItems,i=e.filterOperators,a=e.invertSelection,o=e.selectedValues,r=this.props,d=r.column,l=r.onFilterChange,u=r.model,c=r.tableUtils,m=u.formatter,v=t.filter(S=>{var y=S.selectedType,E=S.value;return y!=null&&E!=null&&E!==""}),h=i.filter((S,y)=>S!=null&&t[y].selectedType!=null&&t[y].value!=null&&t[y].value!=="").slice(0,v.length-1),f={filterItems:v,filterOperators:h,invertSelection:a,selectedValues:o},C=c.makeAdvancedFilter(d,f,m.timeZone);l(d,C,f)}render(){var e=this,t=this.props,i=t.column,a=t.model,o=t.sortDirection,r=t.formatter,d=t.tableUtils,l=t.isMaximized,u=t.onToggleMaximize,c=this.state,m=c.filterItems,v=c.filterOperators,h=c.invertSelection,f=c.selectedValues,C=c.valuesTable,S=c.valuesTableError,y=c.isSortable,E=a.dh,D=a.isValuesTableAvailable,_=T.isBooleanType(i.type),O=T.isDateType(i.type),p=this.getFilterTypes(i.type),B=i.type.substring(i.type.lastIndexOf(".")+1),w=[];if(!_&&p.length)for(var P=function(M){var J=m[M],U=J.key,X=J.selectedType,V=J.value,he=s.jsx(Sn,{column:i,filterTypes:p,onChange:e.getFilterChangeHandler(M),onDelete:e.getFilterDeleteHandler(M),selectedType:X,value:V,formatter:r,tableUtils:d},U);if(w.push(he),M<v.length){var Fe=v[M],ee=Fe===nt.and,te=s.jsxs("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[s.jsx(Y,{kind:"ghost",className:K("filter-operator",{active:ee}),onClick:()=>e.handleChangeFilterOperator(M,nt.and),children:"AND"}),s.jsx(Y,{kind:"ghost",className:K("filter-operator",{active:!ee}),onClick:()=>e.handleChangeFilterOperator(M,nt.or),children:"OR"})]},"filterOperator".concat(U));w.push(te)}},j=0;j<m.length;j+=1)P(j);var Q=this.shouldShowAddFilter(),x=s.jsxs("div",{className:K("form-row justify-content-end add-filter-item",{hidden:!Q}),children:[s.jsx("span",{className:"text-muted",children:s.jsx(ie,{icon:pn})}),s.jsx(Y,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddAnd,disabled:!Q,tooltip:"Add filter with AND",children:"AND"}),s.jsx(Y,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddOr,disabled:!Q,tooltip:"Add filter with OR",children:"OR"})]},"addFilterItem");return w.push(x),s.jsxs("div",{className:"advanced-filter-creator",role:"presentation",children:[s.jsx("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),s.jsxs("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[s.jsxs("div",{className:"title-bar",children:[s.jsx("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),s.jsxs("div",{className:"advanced-filter-menu-buttons",children:[s.jsx(Y,{kind:"ghost",className:K("sort-operator",{active:o===T.sortDirection.descending}),onClick:this.handleSortDown,icon:Kn,tooltip:y?"Sort ".concat(i.name," Descending"):"Not sortable",disabled:!y}),s.jsx(Y,{kind:"ghost",className:K("sort-operator",{active:o===T.sortDirection.ascending}),onClick:this.handleSortUp,icon:s.jsx(ie,{icon:Kn,rotation:180}),tooltip:y?"Sort ".concat(i.name," Ascending"):"Not sortable",disabled:!y}),s.jsx(Y,{kind:"ghost",className:K("sort-operator",{active:l}),onClick:u,icon:l?Ba:Ha,tooltip:l?"Restore dialog size":"Maximize dialog"})]})]}),s.jsx("hr",{}),s.jsxs("div",{className:"advanced-filter-column-name",children:[i.name," ",s.jsxs("span",{className:"column-type",children:["(",B,")"]})]}),w,D&&S==null&&s.jsxs(s.Fragment,{children:[!_&&s.jsx("hr",{}),s.jsx("div",{className:"form-group advanced-filter-values-group",children:s.jsx(pt,{dh:E,table:C,onChange:this.handleSelectValueChange,invertSelection:h,selectedValues:f,formatter:r,showSearch:!O,timeZone:r.timeZone})})]}),s.jsxs("div",{className:"form-row justify-content-end",children:[s.jsx(Y,{kind:"secondary",className:"mr-2",onClick:this.handleReset,children:"Reset"}),s.jsx(Y,{kind:"primary",onClick:this.handleDone,children:"Done"})]})]}),s.jsx("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}}Qe(xe,"debounceFilterUpdate",250);Qe(xe,"defaultProps",{options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null});function No(n,e,t){var i=Lo(e);if(i!==void 0){var a=Vo(n,e);return"".concat(a," ? ").concat(i," : ").concat(t)}}function xo(n,e){return n.Column.formatRowColor(e)}function Oo(n,e){return n.formatColor(e)}function Ro(n,e){return Wi(n)||Io(n,e)||Hi(n,e)||Bi()}function Io(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,a,o,r,d=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(i=o.call(t)).done)&&(d.push(i.value),d.length!==e);l=!0);}catch(c){u=!0,a=c}finally{try{if(!l&&t.return!=null&&(r=t.return(),Object(r)!==r))return}finally{if(u)throw a}}return d}}function Gi(n){return Wi(n)||Do(n)||Hi(n)||Bi()}function Bi(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as b,I as s,K,ad as xi,H as ln,U as Oe,M as ie,L as dn,a0 as ut,a1 as ne,bJ as Ve,bD as Va,bE as $a,bC as Ga,bk as Wn,a9 as zn,bG as qn,aw as Qt}from"./vendor-CLIsHur_.js";import{f as vn,L as fe,a3 as Lt,e as W,g as pn,cf as Kn,cg as Ba,ch as Ha,W as un,aO as Wa,aP as za,c8 as Oi,c9 as cn,ci as qa,cj as Ka,ck as Qn,aT as Qa,cl as Yn,cm as Yt,bI as Xn,cn as Ya,aU as Xa,co as Za,aK as Ja,cp as er,cq as tr,aX as nr,br as ir,bm as ar,M as Ri,b as Ii,cr as rr,cs as or,c as Di,k as Li,G as sr,ct as lr,cu as dr,bZ as ur,aS as cr,cv as hr,w as mr,cw as gr,cx as vr,cy as pr,t as fr,b2 as Cr,cz as Sr,bB as Xt,bM as br}from"./index-CNYwQhEi.js";import{c as T,S as Ye,B as Y,y as fn,P as Ae,O as nt,e9 as yr,v as mt,bh as Cn,aS as ji,af as Pi,dq as Tr,at as de,dC as Ne,V as Mi,_ as Er,t as De,au as ki,C as wr,dM as Ui,Y as Ar,c0 as Fr,T as Te,U as _r,b0 as Nr,F as Zt,aw as xr,bA as Or,ea as Rr}from"./ControlType-Befg12ds.js";import{o as Ir,p as Dr,q as Lr,s as jr,I as le,g as Pr,k as lt,a as Rt,f as Mr,c as Jt,n as kr,i as Ur}from"./MissingPartitionError-COQPMoCk.js";import{G as Xe,d as Ee,e as hn,I as me}from"./IrisGridModel-DR8-Pxhc.js";import{u as ye,P as Vr,B as $r,F as Gr,_ as Z,a6 as Br,R as Hr,a3 as ke,E as Wr,T as zr,Y as qr,H as Kr,J as Qr,U as Yr,N as Xr,K as Zr,M as Jr,$ as eo,Q as to,L as no,a7 as en,a8 as io,A as ao,x as ro,a1 as oo,z as so,a5 as lo,C as uo,a4 as co,W as ho,O as mo}from"./IrisGridThemeProvider-5LSst4dQ.js";import{S as go,o as Re,e as Vi,C as $i,b as vo,h as po,P as Zn}from"./GridTokenMouseHandler-DYoFGIB4.js";import{I as $e,p as Jn,S as fo,D as Co}from"./IrisGridShortcuts-CvKofD7x.js";import{K as jt,G as So}from"./Grid-NISpLPEC.js";import{F as ei}from"./FormatterUtils-MUBvtVZH.js";import"./helpers-BosuxZz1.js";import"./monaco-DaE0jI-i.js";import"./useMergeRef-BO8MVMb8.js";function ti(n,e,t){return(e=bo(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bo(n){var e=yo(n,"string");return typeof e=="symbol"?e:e+""}function yo(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var wt=fe.module("AdvancedFilterCreatorFilterItem");class Sn extends b.PureComponent{static getLabelForFilter(e,t){try{if(T.isNumberType(e)||T.isCharType(e))return Ir(t);if(T.isTextType(e))return Dr(t);if(T.isDateType(e))return Lr(t);if(T.isBooleanType(e))return jr(t);throw new Error("Unrecognized column type: ".concat(e))}catch(i){return wt.warn(i),""}}constructor(e){super(e),ti(this,"typeDropdown",void 0),ti(this,"getCachedIsValid",xi((d,l,u,c,m)=>{try{return!u||m.makeAdvancedValueFilter(d,l,u,c)!=null}catch{return!1}})),this.handleDelete=this.handleDelete.bind(this),this.handleTypeChange=this.handleTypeChange.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.typeDropdown=null;var t=e.value,i=t===void 0?"":t,a=e.filterTypes,o=e.selectedType,r=o===void 0?a[0]:o;this.state={selectedType:r,value:i}}componentDidMount(){var e;(e=this.typeDropdown)===null||e===void 0||e.focus()}componentDidUpdate(e){var t=this.props,i=t.value,a=t.selectedType;a!==void 0&&e.selectedType!==a&&this.setState({selectedType:a}),i!==void 0&&e.value!==i&&this.setState({value:i})}handleTypeChange(e){var t=e;wt.debug2("typeChange",t),this.setState({selectedType:t});var i=this.props.onChange,a=this.state.value;a!=null&&a.length>0&&i(t,a)}handleValueChange(e){wt.debug2("valueChange");var t=e.target.value;this.setState({value:t});var i=this.props.onChange,a=this.state.selectedType;a!=null&&i(a,t)}handleDelete(){wt.debug("delete");var e=this.props.onDelete;e()}render(){for(var e=this.props,t=e.column,i=e.filterTypes,a=e.formatter,o=e.tableUtils,r=this.state,d=r.selectedType,l=r.value,u=!T.isBooleanType(t.type),c=[],m=this.getCachedIsValid(t,d,l,a.timeZone,o),v=0;v<i.length;v+=1){var h=i[v],f=Sn.getLabelForFilter(t.type,h),C=s.jsx("option",{value:h,children:f},h);c.push(C)}return s.jsx("div",{className:"advanced-filter-creator-filter-item",children:s.jsxs("div",{className:"form-row",children:[s.jsx("div",{className:"form-group col",children:s.jsx(Ye,{className:"form-control",value:d,onChange:this.handleTypeChange,ref:S=>{this.typeDropdown=S},children:c})}),u&&s.jsx("div",{className:"form-group col",children:s.jsx("div",{className:"input-group",children:s.jsx("input",{type:"text",className:K("form-control",{error:!m}),placeholder:"Enter value",value:l,onChange:this.handleValueChange})})}),s.jsx("div",{className:"form-group col-1 px-0",children:s.jsx(Y,{kind:"ghost",className:"w-100 h-100 p-0 m-0",onClick:this.handleDelete,icon:vn,tooltip:"Remove Filter"})})]})})}}function mn(n,e,t){return(e=To(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function To(n){var e=Eo(n,"string");return typeof e=="symbol"?e:e+""}function Eo(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var ni=fe.module("AdvancedFilterCreatorSelectValueList");class gt extends b.PureComponent{static indexOf(e,t){for(var i=0;i<t.length;i+=1){var a=t[i];if(a===e||a!=null&&a.valueOf!=null&&e!=null&&e.valueOf!=null&&a.valueOf()===e.valueOf())return i}return-1}constructor(e){super(e),mn(this,"dh",void 0),mn(this,"list",void 0),this.handleSelect=this.handleSelect.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.handleTableUpdate=this.handleTableUpdate.bind(this);var t=this.props,i=t.selectedValues,a=t.dh;this.dh=a,this.list=null,this.state={itemCount:0,items:[],offset:0,selectedValues:i,isLoading:!0}}componentDidMount(){var e=this.props.table;e&&this.startListening(e)}componentDidUpdate(e){var t=this.props,i=t.filters,a=t.invertSelection,o=t.selectedValues,r=t.table;e.table!==r&&(e.table&&this.stopListening(e.table),r&&this.startListening(r),this.resetViewport()),e.invertSelection!==a&&this.setState({selectedValues:[]},this.handleSelectionUpdate),e.selectedValues!==o&&this.setState({selectedValues:o},this.handleSelectionUpdate),e.filters!==i&&(r==null||r.applyFilter(i),this.resetViewport())}componentWillUnmount(){var e=this.props.table;e&&this.stopListening(e)}handleSelect(e,t){var i=this.props.invertSelection,a=this.state.selectedValues;a=[...a];var o=gt.indexOf(t,a);o>=0?a.splice(o,1):a.push(t);var r=o<0;i&&(r=!r);var d=this.state.offset,l=this.state.items;l=[...l];var u=e-d;u>=0&&u<l.length&&(l[u].isSelected=r),this.setState({items:l,selectedValues:a});var c=this.props.onChange;c(a,i)}handleViewportChange(e,t){this.updateViewport(e,t)}handleSelectionUpdate(){this.updateItemSelection()}handleTableUpdate(e){var t=this.props,i=t.table,a=t.formatter;if(i){for(var o=e.detail,r=o.offset,d=[],l=i.columns[0],u=0;u<o.rows.length;u+=1){var c=o.rows[u],m=c.get(l),v=void 0;m==null?v=s.jsx("i",{className:"text-muted",children:"null"}):m===""?v=s.jsx("i",{className:"text-muted",children:"empty"}):v=a.getFormattedString(m,l.type,l.name);var h=this.isValueSelected(m);d.push({displayValue:v,value:m,isSelected:h})}ni.debug2("Received table update:",r,d.length);var f=i.size;this.setState({itemCount:f,items:d,offset:r,isLoading:!1})}}isValueSelected(e){var t=this.props.invertSelection,i=this.state.selectedValues,a=gt.indexOf(e,i);return t?a<0:a>=0}startListening(e){e.addEventListener(this.dh.Table.EVENT_UPDATED,this.handleTableUpdate)}stopListening(e){e.removeEventListener(this.dh.Table.EVENT_UPDATED,this.handleTableUpdate)}resetViewport(){this.list&&this.list.topRow!=null&&this.list.bottomRow!=null&&this.updateViewport(this.list.topRow,this.list.bottomRow,!0)}updateItemSelection(){var e=this.state.items;e=[...e];for(var t=0;t<e.length;t+=1){var i=e[t],a=i.value;i.isSelected=this.isValueSelected(a)}this.setState({items:e})}updateViewport(e,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=this.props.table;if(a!=null){i&&this.setState({isLoading:!0});var o=t-e+1,r=Math.max(0,e-o*3),d=Math.max(r,t+o*3);ni.debug2("Setting viewport",r,",",d),a.setViewport(r,d)}}render(){var e=this.state,t=e.offset,i=e.isLoading,a=e.items,o=e.itemCount;return s.jsxs("div",{className:"select-value-list-wrapper",children:[s.jsx(go,{itemCount:o,items:a,offset:t,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange,ref:r=>{this.list=r}}),s.jsx(fn,{in:i,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx("div",{className:"loading-list",children:s.jsx(Lt,{className:"loading-spinner-large"})})})]})}}mn(gt,"defaultProps",{invertSelection:!0,selectedValues:[],onChange:()=>{}});function ct(n,e,t){return(e=wo(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function wo(n){var e=Ao(n,"string");return typeof e=="symbol"?e:e+""}function Ao(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class pt extends b.PureComponent{constructor(e){super(e),ct(this,"searchTablePromise",void 0),ct(this,"tableUtils",void 0),ct(this,"updateFilterTimer",void 0),this.handleSelectAllClick=this.handleSelectAllClick.bind(this),this.handleClearAllClick=this.handleClearAllClick.bind(this),this.handleListChange=this.handleListChange.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUpdateFilterTimeout=this.handleUpdateFilterTimeout.bind(this);var t=e.dh,i=e.invertSelection,a=e.selectedValues;this.tableUtils=new T(t),this.state={filters:[],invertSelection:i,selectedValues:a,searchText:""}}componentDidMount(){this.initSearchTable()}componentDidUpdate(e,t){var i=this.props,a=i.invertSelection,o=i.selectedValues,r=i.table;e.table!==r&&this.initSearchTable(),e.invertSelection!==a&&this.setState({invertSelection:a}),e.selectedValues!==o&&this.setState({selectedValues:o});var d=this.state,l=d.table,u=d.searchText;l!==t.table&&(t.table!=null&&t.table.close(),l!=null&&this.startUpdateFilterTimer()),u!==t.searchText&&this.startUpdateFilterTimer()}componentWillUnmount(){var e=this.state.table;e!=null&&e.close(),this.searchTablePromise=void 0,this.stopUpdateFilterTimer()}getColumnName(){var e=this.props.table;return e!=null?e.columns[0].name:""}getDisplayedValuesCount(){var e=this.state,t=e.invertSelection,i=e.selectedValues,a=e.table;return a==null?null:t?a.totalSize-i.length:i.length}getDisplayedValueText(){var e=this.getDisplayedValuesCount(),t=this.state.table,i=this.props.formatter;if(e!=null&&t!=null){var a=i.getFormattedString(e,"long"),o=i.getFormattedString(t.totalSize,"long"),r="";return e<1e6&&(r="Displaying "),"".concat(r).concat(a," of ").concat(o)}return null}initSearchTable(){var e=this.props.table;if(e!=null){var t=e.copy();this.searchTablePromise=t,this.searchTablePromise.then(i=>{this.searchTablePromise===t?(this.setState({table:i}),this.searchTablePromise=void 0):i.close()})}}handleListChange(e,t){this.setState({selectedValues:e,invertSelection:t});var i=this.props.onChange;i(e,t)}handleSearchChange(e){var t=e.target.value;this.setState({searchText:t})}handleSelectAllClick(){this.resetSelection(!0)}handleClearAllClick(){this.resetSelection(!1)}handleUpdateFilterTimeout(){this.updateFilterTimer=void 0,this.updateTableFilter()}resetSelection(e){var t=[];this.setState({invertSelection:e,selectedValues:t});var i=this.props.onChange;i(t,e)}startUpdateFilterTimer(){this.stopUpdateFilterTimer(),this.updateFilterTimer=setTimeout(this.handleUpdateFilterTimeout,pt.searchDebounceTime)}stopUpdateFilterTimer(){this.updateFilterTimer!=null&&(clearTimeout(this.updateFilterTimer),this.updateFilterTimer=void 0)}updateTableFilter(){var e=this.state,t=e.table,i=e.searchText,a=this.props.timeZone,o=this.tableUtils,r=t==null?void 0:t.columns[0],d=[];if(r!=null){var l;if(i.length>0){var u=null;T.isCharType(r.type)?u=o.makeQuickFilter(r,i):T.isTextType(r.type)?u=o.makeQuickFilter(r,"~".concat(i),a):u=o.makeQuickFilter(r,">=".concat(i),a),u!=null?d.push(u):l="Invalid search text"}this.setState({filters:d,error:l})}}render(){var e=this.state,t=e.error,i=e.filters,a=e.invertSelection,o=e.selectedValues,r=e.searchText,d=e.table,l=this.props,u=l.dh,c=l.formatter,m=l.showSearch,v=this.getColumnName(),h=this.getDisplayedValueText(),f=v?"Find ".concat(v,"..."):"";return s.jsxs("div",{className:"advanced-filter-creator-select-value",children:[s.jsxs("div",{className:m?"form-group":"",children:[s.jsx("label",{htmlFor:"advanced-filter-creator-select-value-input",children:"Select Values"}),m&&s.jsx("input",{type:"text",className:K("form-control",{"is-invalid":t!=null}),id:"advanced-filter-creator-select-value-input",placeholder:f,value:r,onChange:this.handleSearchChange})]}),s.jsx(gt,{dh:u,table:d,filters:i,invertSelection:a,selectedValues:o,formatter:c,onChange:this.handleListChange}),s.jsxs("div",{className:"advanced-filter-creator-select-meta-row",children:[s.jsxs("div",{children:[s.jsx(Y,{kind:"ghost",onClick:this.handleSelectAllClick,children:"Select All"}),s.jsx(Y,{kind:"ghost",onClick:this.handleClearAllClick,children:"Clear"})]}),s.jsx(fn,{in:h!=null,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx("div",{className:"row-count-info",children:h})})]})]})}}ct(pt,"searchDebounceTime",250);ct(pt,"defaultProps",{invertSelection:!0,selectedValues:[],onChange:()=>{},showSearch:!0});function Qe(n,e,t){return(e=Fo(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Fo(n){var e=_o(n,"string");return typeof e=="symbol"?e:e+""}function _o(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var it=fe.module("AdvancedFilterCreator");class xe extends b.PureComponent{static makeFilterItem(){return{key:ln()}}constructor(e){var t,i;super(e),Qe(this,"focusTrapContainer",void 0),Qe(this,"debounceTimeout",void 0),Qe(this,"valuesTablePromise",void 0),Qe(this,"getFilterTypes",xi(h=>T.getFilterTypes(h))),this.handleAddAnd=this.handleAddAnd.bind(this),this.handleAddOr=this.handleAddOr.bind(this),this.handleChangeFilterOperator=this.handleChangeFilterOperator.bind(this),this.handleDone=this.handleDone.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterDelete=this.handleFilterDelete.bind(this),this.handleSelectValueChange=this.handleSelectValueChange.bind(this),this.handleReset=this.handleReset.bind(this),this.handleSortDown=this.handleSortDown.bind(this),this.handleSortUp=this.handleSortUp.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleFocusTrapStart=this.handleFocusTrapStart.bind(this),this.handleFocusTrapEnd=this.handleFocusTrapEnd.bind(this),this.handleUpdateTimeout=this.handleUpdateTimeout.bind(this),this.focusTrapContainer=Oe.createRef();var a=e.model,o=e.column,r=e.options,d=r.filterOperators,l=r.invertSelection,u=r.selectedValues,c=(t=(i=r.filterItems)===null||i===void 0?void 0:i.map(h=>{var f=h.selectedType,C=h.value;return{selectedType:f,value:C,key:ln()}}))!==null&&t!==void 0?t:[];c.length===0&&c.push(xe.makeFilterItem()),d==null&&(d=[]),l==null&&(l=!0),u==null&&(u=[]);var m=a.getColumnIndexByName(o.name);W(m);var v=a.isColumnSortable(m);this.state={filterItems:c,filterOperators:d,invertSelection:l,selectedValues:u,valuesTableError:null,valuesTable:void 0,isSortable:v}}componentDidMount(){this.initValuesTable()}componentWillUnmount(){this.debounceTimeout!=null&&(clearTimeout(this.debounceTimeout),this.sendUpdate()),this.valuesTablePromise!=null&&this.valuesTablePromise.cancel()}getFilterChangeHandler(e){return this.handleFilterChange.bind(this,e)}getFilterDeleteHandler(e){return this.handleFilterDelete.bind(this,e)}initValuesTable(){var e=this.props,t=e.model,i=e.column;if(!t.isValuesTableAvailable){it.debug("No values table for this model, just ignore");return}this.valuesTablePromise=T.makeCancelableTablePromise(t.valuesTable(i)),this.valuesTablePromise.then(a=>{var o;if(!((o=a.columns[0].isSortable)!==null&&o!==void 0)||o){var r=a.columns[0].sort().asc();a.applySort([r])}this.setState({valuesTable:a})}).catch(a=>{Ae.isCanceled(a)||(it.error("Unable to open values table",a),this.setState({valuesTableError:a}))})}handleFocusTrapEnd(){var e;((e=this.focusTrapContainer)===null||e===void 0||(e=e.current)===null||e===void 0?void 0:e.querySelector("button,select,input,textarea")).focus()}handleFocusTrapStart(){var e,t=(e=this.focusTrapContainer)===null||e===void 0||(e=e.current)===null||e===void 0?void 0:e.querySelectorAll("button,select,input,textarea");if(t&&t.length>0){var i=t[t.length-1];i.focus()}}handleAddAnd(){var e=this.state,t=e.filterItems,i=e.filterOperators;t=t.concat(xe.makeFilterItem()),i=i.concat(nt.and),this.setState({filterItems:t,filterOperators:i})}handleAddOr(){var e=this.state,t=e.filterItems,i=e.filterOperators;t=t.concat(xe.makeFilterItem()),i=i.concat(nt.or),this.setState({filterItems:t,filterOperators:i})}handleChangeFilterOperator(e,t){var i=this.state.filterOperators;i=[...i],yr(t),i[e]=t,this.setState({filterOperators:i}),this.startUpdateTimer()}handleFilterChange(e,t,i){var a=this.state.filterItems;a=[...a];var o=a[e].key;a[e]={key:o,selectedType:t,value:i},this.setState({filterItems:a}),this.startUpdateTimer()}handleFilterDelete(e){var t=this.state,i=t.filterItems,a=t.filterOperators;i=[...i],a=[...a],e<i.length&&i.splice(e,1),e<a.length?a.splice(e,1):e===a.length&&a.splice(a.length-1,1),i.length===0&&i.push(xe.makeFilterItem()),this.setState({filterItems:i,filterOperators:a}),this.startUpdateTimer()}handleSelectValueChange(e,t){this.setState({selectedValues:e,invertSelection:t}),this.startUpdateTimer()}handleReset(){it.debug("Resetting Advanced Filter"),this.setState({filterItems:[xe.makeFilterItem()],filterOperators:[],selectedValues:[],invertSelection:!0}),this.startUpdateTimer()}handleSortDown(e){var t=mt.isModifierKeyDown(e);this.sortTable(T.sortDirection.descending,t)}handleSortUp(e){var t=mt.isModifierKeyDown(e);this.sortTable(T.sortDirection.ascending,t)}handleSubmit(e){it.debug("Submitting Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate(),e.preventDefault()}handleDone(e){it.debug("Submitting and Closing Advanced Filter"),this.stopUpdateTimer(),this.sendUpdate();var t=this.props.onDone;t(),e.preventDefault()}handleUpdateTimeout(){this.debounceTimeout=void 0,this.sendUpdate()}shouldShowAddFilter(){var e=this.state.filterItems;if(e.length===0)return!1;var t=e[e.length-1],i=t.selectedType,a=t.value;return i!=null&&i.length>0&&a!=null&&a.length>0}sortTable(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=this.props,a=i.column,o=i.onSortChange,r=this.state.isSortable;r&&o(a,e,t)}startUpdateTimer(){this.stopUpdateTimer(),this.debounceTimeout=setTimeout(this.handleUpdateTimeout,xe.debounceFilterUpdate)}stopUpdateTimer(){this.debounceTimeout!==void 0&&(clearTimeout(this.debounceTimeout),this.debounceTimeout=void 0)}sendUpdate(){var e=this.state,t=e.filterItems,i=e.filterOperators,a=e.invertSelection,o=e.selectedValues,r=this.props,d=r.column,l=r.onFilterChange,u=r.model,c=r.tableUtils,m=u.formatter,v=t.filter(S=>{var y=S.selectedType,E=S.value;return y!=null&&E!=null&&E!==""}),h=i.filter((S,y)=>S!=null&&t[y].selectedType!=null&&t[y].value!=null&&t[y].value!=="").slice(0,v.length-1),f={filterItems:v,filterOperators:h,invertSelection:a,selectedValues:o},C=c.makeAdvancedFilter(d,f,m.timeZone);l(d,C,f)}render(){var e=this,t=this.props,i=t.column,a=t.model,o=t.sortDirection,r=t.formatter,d=t.tableUtils,l=t.isMaximized,u=t.onToggleMaximize,c=this.state,m=c.filterItems,v=c.filterOperators,h=c.invertSelection,f=c.selectedValues,C=c.valuesTable,S=c.valuesTableError,y=c.isSortable,E=a.dh,D=a.isValuesTableAvailable,_=T.isBooleanType(i.type),O=T.isDateType(i.type),p=this.getFilterTypes(i.type),B=i.type.substring(i.type.lastIndexOf(".")+1),w=[];if(!_&&p.length)for(var P=function(M){var J=m[M],U=J.key,X=J.selectedType,V=J.value,he=s.jsx(Sn,{column:i,filterTypes:p,onChange:e.getFilterChangeHandler(M),onDelete:e.getFilterDeleteHandler(M),selectedType:X,value:V,formatter:r,tableUtils:d},U);if(w.push(he),M<v.length){var Fe=v[M],ee=Fe===nt.and,te=s.jsxs("div",{className:"form-row justify-content-end advanced-filter-creator-filter-operator",children:[s.jsx(Y,{kind:"ghost",className:K("filter-operator",{active:ee}),onClick:()=>e.handleChangeFilterOperator(M,nt.and),children:"AND"}),s.jsx(Y,{kind:"ghost",className:K("filter-operator",{active:!ee}),onClick:()=>e.handleChangeFilterOperator(M,nt.or),children:"OR"})]},"filterOperator".concat(U));w.push(te)}},j=0;j<m.length;j+=1)P(j);var Q=this.shouldShowAddFilter(),x=s.jsxs("div",{className:K("form-row justify-content-end add-filter-item",{hidden:!Q}),children:[s.jsx("span",{className:"text-muted",children:s.jsx(ie,{icon:pn})}),s.jsx(Y,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddAnd,disabled:!Q,tooltip:"Add filter with AND",children:"AND"}),s.jsx(Y,{kind:"ghost",className:"btn-filter-item",onClick:this.handleAddOr,disabled:!Q,tooltip:"Add filter with OR",children:"OR"})]},"addFilterItem");return w.push(x),s.jsxs("div",{className:"advanced-filter-creator",role:"presentation",children:[s.jsx("div",{tabIndex:0,onFocus:this.handleFocusTrapStart}),s.jsxs("form",{onSubmit:this.handleSubmit,ref:this.focusTrapContainer,children:[s.jsxs("div",{className:"title-bar",children:[s.jsx("h6",{className:"advanced-filter-title",children:"Advanced Filters"}),s.jsxs("div",{className:"advanced-filter-menu-buttons",children:[s.jsx(Y,{kind:"ghost",className:K("sort-operator",{active:o===T.sortDirection.descending}),onClick:this.handleSortDown,icon:Kn,tooltip:y?"Sort ".concat(i.name," Descending"):"Not sortable",disabled:!y}),s.jsx(Y,{kind:"ghost",className:K("sort-operator",{active:o===T.sortDirection.ascending}),onClick:this.handleSortUp,icon:s.jsx(ie,{icon:Kn,rotation:180}),tooltip:y?"Sort ".concat(i.name," Ascending"):"Not sortable",disabled:!y}),s.jsx(Y,{kind:"ghost",className:K("sort-operator",{active:l}),onClick:u,icon:l?Ba:Ha,tooltip:l?"Restore dialog size":"Maximize dialog"})]})]}),s.jsx("hr",{}),s.jsxs("div",{className:"advanced-filter-column-name",children:[i.name," ",s.jsxs("span",{className:"column-type",children:["(",B,")"]})]}),w,D&&S==null&&s.jsxs(s.Fragment,{children:[!_&&s.jsx("hr",{}),s.jsx("div",{className:"form-group advanced-filter-values-group",children:s.jsx(pt,{dh:E,table:C,onChange:this.handleSelectValueChange,invertSelection:h,selectedValues:f,formatter:r,showSearch:!O,timeZone:r.timeZone})})]}),s.jsxs("div",{className:"form-row justify-content-end",children:[s.jsx(Y,{kind:"secondary",className:"mr-2",onClick:this.handleReset,children:"Reset"}),s.jsx(Y,{kind:"primary",onClick:this.handleDone,children:"Done"})]})]}),s.jsx("div",{tabIndex:0,onFocus:this.handleFocusTrapEnd})]})}}Qe(xe,"debounceFilterUpdate",250);Qe(xe,"defaultProps",{options:{filterItems:null,filterOperators:null,invertSelection:!0,selectedValues:[]},sortDirection:null});function No(n,e,t){var i=Lo(e);if(i!==void 0){var a=Vo(n,e);return"".concat(a," ? ").concat(i," : ").concat(t)}}function xo(n,e){return n.Column.formatRowColor(e)}function Oo(n,e){return n.formatColor(e)}function Ro(n,e){return Wi(n)||Io(n,e)||Hi(n,e)||Bi()}function Io(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,a,o,r,d=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(i=o.call(t)).done)&&(d.push(i.value),d.length!==e);l=!0);}catch(c){u=!0,a=c}finally{try{if(!l&&t.return!=null&&(r=t.return(),Object(r)!==r))return}finally{if(u)throw a}}return d}}function Gi(n){return Wi(n)||Do(n)||Hi(n)||Bi()}function Bi(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hi(n,e){if(n){if(typeof n=="string")return ii(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?ii(n,e):void 0}}function ii(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function Do(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function Wi(n){if(Array.isArray(n))return n}var ht=fe.module("ConditionalFormattingUtils"),we=function(n){return n.CONDITIONAL="conditional",n.ROWS="rows",n}({}),R=function(n){return n.IS_EQUAL="is-equal",n.IS_NOT_EQUAL="is-not-equal",n.IS_BETWEEN="is-between",n.GREATER_THAN="greater-than",n.GREATER_THAN_OR_EQUAL="greater-than-or-equal",n.LESS_THAN="less-than",n.LESS_THAN_OR_EQUAL="less-than-or-equal",n.IS_NULL="is-null",n.IS_NOT_NULL="is-not-null",n}({}),H=function(n){return n.IS_EXACTLY="is-exactly",n.IS_NOT_EXACTLY="is-not-exactly",n.CONTAINS="contains",n.DOES_NOT_CONTAIN="does-not-contain",n.STARTS_WITH="starts-with",n.ENDS_WITH="ends-with",n.IS_NULL="is-null",n.IS_NOT_NULL="is-not-null",n}({}),k=function(n){return n.IS_EXACTLY="is-exactly",n.IS_NOT_EXACTLY="is-not-exactly",n.IS_BEFORE="is-before",n.IS_BEFORE_OR_EQUAL="is-before-or-equal",n.IS_AFTER="is-after",n.IS_AFTER_OR_EQUAL="is-after-or-equal",n.IS_NULL="is-null",n.IS_NOT_NULL="is-not-null",n}({}),ve=function(n){return n.IS_TRUE="is-true",n.IS_FALSE="is-false",n.IS_NULL="is-null",n.IS_NOT_NULL="is-not-null",n}({}),ce=function(n){return n.IS_EQUAL="is-equal",n.IS_NOT_EQUAL="is-not-equal",n.IS_NULL="is-null",n.IS_NOT_NULL="is-not-null",n}({}),q=function(n){return n.NO_FORMATTING="no-formatting",n.POSITIVE="positive",n.NEGATIVE="negative",n.WARN="warn",n.NEUTRAL="neutral",n.ACCENT_1="accent-1",n.ACCENT_2="accent-2",n.CUSTOM="custom",n}({});function ai(n){switch(n){case q.NO_FORMATTING:return"No formatting";case q.POSITIVE:return"Positive";case q.NEGATIVE:return"Negative";case q.WARN:return"Warn";case q.NEUTRAL:return"Neutral";case q.ACCENT_1:return"Accent 1";case q.ACCENT_2:return"Accent 2";case q.CUSTOM:return"Custom..."}}function It(n){var e=n.type,t=n.customConfig;switch(e){case q.NO_FORMATTING:return;case q.POSITIVE:return"#9fde6f";case q.NEGATIVE:return"#ff6087";case q.WARN:return"#f67f40";case q.NEUTRAL:return"#ffd95c";case q.ACCENT_1:return"#78dce8";case q.ACCENT_2:return"#ab9bf5";case q.CUSTOM:return t==null?void 0:t.background;default:return}}function Dt(n){var e=n.type,t=n.customConfig;switch(e){case q.NO_FORMATTING:return;case q.POSITIVE:return"#526a3f";case q.NEGATIVE:return"#802f44";case q.WARN:return"#663318";case q.NEUTRAL:return"#63562b";case q.ACCENT_1:return"#3f6469";case q.ACCENT_2:return"#554d72";case q.CUSTOM:return t==null?void 0:t.color;default:return}}function Lo(n){var e=Dt(n.style),t=It(n.style);if(!(e===void 0||t===void 0))return"bgfg(`".concat(t,"`, `").concat(e,"`)")}function jo(n){var e=n.column,t=n.value,i=n.start,a=n.end;return Xo(e.name,n.condition,t,i,a)}function Po(n){var e=n.column,t=n.value;return Zo(e.name,n.condition,t)}function Mo(n,e){var t=e.column,i=e.value;return Jo(n,t.name,e.condition,i)}function ko(n){var e=n.column;return es(e.name,n.condition)}function Uo(n){var e=n.column,t=n.value;return ts(e.name,n.condition,t)}function Vo(n,e){var t=e.column;if(T.isNumberType(t.type))return jo(e);if(T.isCharType(t.type))return Uo(e);if(T.isStringType(t.type))return Po(e);if(T.isDateType(t.type))return Mo(n,e);if(T.isBooleanType(t.type))return ko(e);throw new Error("Invalid column type")}function $o(n){switch(n){case R.IS_EQUAL:return"is equal to";case R.IS_NOT_EQUAL:return"is not equal to";case R.IS_BETWEEN:return"is between";case R.GREATER_THAN:return"greater than";case R.GREATER_THAN_OR_EQUAL:return"greater than or equal to";case R.LESS_THAN:return"less than";case R.LESS_THAN_OR_EQUAL:return"less than or equal to";case R.IS_NULL:return"is null";case R.IS_NOT_NULL:return"is not null"}}function Go(n){switch(n){case H.IS_EXACTLY:return"is exactly";case H.IS_NOT_EXACTLY:return"is not exactly";case H.CONTAINS:return"contains";case H.DOES_NOT_CONTAIN:return"does not contain";case H.STARTS_WITH:return"starts with";case H.ENDS_WITH:return"ends with";case H.IS_NULL:return"is null";case H.IS_NOT_NULL:return"is not null"}}function Bo(n){switch(n){case k.IS_EXACTLY:return"is";case k.IS_NOT_EXACTLY:return"is not";case k.IS_BEFORE:return"is before";case k.IS_BEFORE_OR_EQUAL:return"is before or equal";case k.IS_AFTER:return"is after";case k.IS_AFTER_OR_EQUAL:return"is after or equal";case k.IS_NULL:return"is null";case k.IS_NOT_NULL:return"is not null"}}function Ho(n){switch(n){case ve.IS_TRUE:return"is true";case ve.IS_FALSE:return"is false";case ve.IS_NULL:return"is null";case ve.IS_NOT_NULL:return"is not null"}}function Wo(n){switch(n){case ce.IS_EQUAL:return"is";case ce.IS_NOT_EQUAL:return"is not";case ce.IS_NULL:return"is null";case ce.IS_NOT_NULL:return"is not null"}}function zi(n){if(T.isNumberType(n))return R.IS_EQUAL;if(T.isCharType(n))return ce.IS_EQUAL;if(T.isStringType(n))return H.IS_EXACTLY;if(T.isDateType(n))return k.IS_EXACTLY;if(T.isBooleanType(n))return ve.IS_TRUE;throw new Error("Invalid column type")}function qi(n){if(T.isCharType(n)||T.isStringType(n))return""}function Ki(n){var e=n.condition,t=n.value,i=n.start,a=n.end;return{condition:e,value:t,start:i,end:a}}function Pt(n){return{condition:zi(n),value:qi(n),start:void 0,end:void 0}}function Qi(){return{type:q.NO_FORMATTING}}function zo(n){switch(n){case H.IS_EXACTLY:return"==";case H.IS_NOT_EXACTLY:return"!=";case H.CONTAINS:return"contains";case H.DOES_NOT_CONTAIN:return"does not contain";case H.STARTS_WITH:return"starts with";case H.ENDS_WITH:return"ends with";case H.IS_NULL:return"is null";case H.IS_NOT_NULL:return"is not null"}}function qo(n){switch(n){case k.IS_EXACTLY:return"==";case k.IS_NOT_EXACTLY:return"!=";case k.IS_BEFORE:return"<";case k.IS_BEFORE_OR_EQUAL:return"<=";case k.IS_AFTER:return">";case k.IS_AFTER_OR_EQUAL:return">=";case k.IS_NULL:return"is null";case k.IS_NOT_NULL:return"is not null"}}function Ko(n){switch(n){case ve.IS_TRUE:return"is true";case ve.IS_FALSE:return"is false";case ve.IS_NULL:return"is null";case ve.IS_NOT_NULL:return"is not null"}}function Qo(n){switch(n){case ce.IS_EQUAL:return"==";case ce.IS_NOT_EQUAL:return"!=";case ce.IS_NULL:return"is null";case ce.IS_NOT_NULL:return"is not null"}}function Yo(n){switch(n){case R.IS_EQUAL:return"==";case R.IS_NOT_EQUAL:return"!=";case R.IS_BETWEEN:return"==";case R.GREATER_THAN:return">";case R.GREATER_THAN_OR_EQUAL:return">=";case R.LESS_THAN:return"<";case R.LESS_THAN_OR_EQUAL:return"<=";case R.IS_NULL:return"is null";case R.IS_NOT_NULL:return"is not null"}}function Xo(n,e,t,i,a){switch(e){case R.IS_EQUAL:return"".concat(n," == ").concat(t);case R.IS_NOT_EQUAL:return"".concat(n," != ").concat(t);case R.IS_BETWEEN:return"".concat(n," > ").concat(i," && ").concat(n," < ").concat(a);case R.GREATER_THAN:return"".concat(n," > ").concat(t);case R.GREATER_THAN_OR_EQUAL:return"".concat(n," >= ").concat(t);case R.LESS_THAN:return"".concat(n," < ").concat(t);case R.LESS_THAN_OR_EQUAL:return"".concat(n," <= ").concat(t);case R.IS_NULL:return"".concat(n," == null");case R.IS_NOT_NULL:return"".concat(n," != null")}}function Zo(n,e,t){switch(e){case H.IS_EXACTLY:return"".concat(n,' == "').concat(t,'"');case H.IS_NOT_EXACTLY:return"".concat(n,' != "').concat(t,'"');case H.CONTAINS:return"".concat(n," != null && ").concat(n,'.contains("').concat(t,'")');case H.DOES_NOT_CONTAIN:return"".concat(n," != null && !").concat(n,'.contains("').concat(t,'")');case H.STARTS_WITH:return"".concat(n," != null && ").concat(n,'.startsWith("').concat(t,'")');case H.ENDS_WITH:return"".concat(n," != null && ").concat(n,'.endsWith("').concat(t,'")');case H.IS_NULL:return"".concat(n," == null");case H.IS_NOT_NULL:return"".concat(n," != null")}}function Jo(n,e,t,i){var a=i;if(typeof i=="string"){var o=i.split(" "),r=Gi(o),d=r[0],l=r.slice(1),u=l.join(" "),c=n.i18n.TimeZone.getTimeZone(u);a="".concat(d," ").concat(c.id)}switch(t){case k.IS_EXACTLY:return"".concat(e," == '").concat(a,"'");case k.IS_NOT_EXACTLY:return"".concat(e," != '").concat(a,"'");case k.IS_BEFORE:return"".concat(e," < '").concat(a,"'");case k.IS_BEFORE_OR_EQUAL:return"".concat(e," <= '").concat(a,"'");case k.IS_AFTER:return"".concat(e," > '").concat(a,"'");case k.IS_AFTER_OR_EQUAL:return"".concat(e," >= '").concat(a,"'");case k.IS_NULL:return"".concat(e," == null");case k.IS_NOT_NULL:return"".concat(e," != null")}}function es(n,e){switch(e){case ve.IS_TRUE:return"".concat(n," == true");case ve.IS_FALSE:return"".concat(n," == false");case ve.IS_NULL:return"".concat(n," == null");case ve.IS_NOT_NULL:return"".concat(n," != null")}}function ts(n,e,t){switch(e){case ce.IS_EQUAL:return"".concat(n," == '").concat(t,"'");case ce.IS_NOT_EQUAL:return"".concat(n," != '").concat(t,"'");case ce.IS_NULL:return"isNull(".concat(n,")");case ce.IS_NOT_NULL:return"!isNull(".concat(n,")")}}function ns(n,e){if(T.isNumberType(n))return Yo(e);if(T.isCharType(n))return Qo(e);if(T.isStringType(n))return zo(e);if(T.isDateType(n))return qo(e);if(T.isBooleanType(n))return Ko(e);throw new Error("Invalid column type")}function is(n,e,t){if(t===void 0)return ht.debug("no rules passed."),[];var i=[],a,o=new Map;return t.forEach(r=>{var d,l=r.config,u=r.type,c=l.column,m=e.find(D=>{var _=D.name,O=D.type;return _===c.name&&O===c.type});if(m===void 0){ht.debug("Column ".concat(c.name,":").concat(c.type," not found. Ignoring format rule."),l);return}var v=(d=u===we.CONDITIONAL?o.get(m.name):a)!==null&&d!==void 0?d:["null",void 0],h=Ro(v,2),f=h[0],C=h[1],S=No(n,l,f);if(S===void 0){ht.debug("Ignoring format rule.",l);return}var y=C===void 0?-1:i.indexOf(C);y>-1&&i.splice(y,1);var E=u===we.CONDITIONAL?Oo(m,S):xo(n,S);i.push(E),u===we.CONDITIONAL?o.set(m.name,[S,E]):a=[S,E]}),i}function as(n,e,t){switch(e){case k.IS_NULL:case k.IS_NOT_NULL:return!0;default:{var i=(t??"").split(" "),a=Gi(i),o=a[0],r=a.slice(1),d=r.join(" ");try{Cn.parseDateTimeString(o)}catch{return ht.debug("Invalid datetime string",o),!1}try{n.i18n.TimeZone.getTimeZone(d)}catch{return ht.debug("Invalid timezone string",d),!1}return!0}}}function rs(n){var e=n.type;return T.isNumberType(e)||T.isCharType(e)||T.isStringType(e)||T.isDateType(e)||T.isBooleanType(e)}function Mt(n){var e=n.animation,t=e===void 0?"iris-grid-bottom-bar-slide-up":e,i=n.children,a=n.className,o=n.isShown,r=n.onClick,d=n.onEntering,l=n.onEntered,u=n.onExiting,c=n.onExited,m=b.useRef(null);return s.jsx(dn,{in:o,timeout:un.transitionMs,classNames:t,onEntering:d,onEntered:l,onExiting:u,onExited:c,mountOnEnter:!0,unmountOnExit:!0,nodeRef:m,children:s.jsx("div",{ref:m,className:K("iris-grid-bottom-bar",a),role:"presentation",onClick:r,onKeyPress:r,children:i})})}function ri(n,e){return ds(n)||ls(n,e)||ss(n,e)||os()}function os(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ss(n,e){if(n){if(typeof n=="string")return oi(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?oi(n,e):void 0}}function oi(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function ls(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,a,o,r,d=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(i=o.call(t)).done)&&(d.push(i.value),d.length!==e);l=!0);}catch(c){u=!0,a=c}finally{try{if(!l&&t.return!=null&&(r=t.return(),Object(r)!==r))return}finally{if(u)throw a}}return d}}function ds(n){if(Array.isArray(n))return n}var us=3e3,cs=5;function hs(n){var e=n.isSaving,t=e===void 0?!1:e,i=n.onSave,a=n.onDiscard,o=n.discardTooltip,r=n.saveTooltip,d=n.error,l=n.pendingDataErrors,u=n.pendingDataMap,c=n.onEntering,m=n.onEntered,v=n.onExiting,h=n.onExited,f=b.useState(!1),C=ri(f,2),S=C[0],y=C[1],E=b.useState(!1),D=ri(E,2),_=D[0],O=D[1],p=b.useRef(),B=ji(t),w=b.useMemo(()=>l.size===0?d:l.size<=cs?"Key can't be empty (on pending row".concat(l.size>1?"s":""," ").concat(Array.from(l.keys()).join(", ").trim(),")"):"Key can't be empty (on ".concat(l.size," rows)"),[d,l]);b.useEffect(function(){B!=null&&B&&!t&&w==null&&(y(!0),O(!0),p.current=setTimeout(()=>{y(!1)},us))},[w,t,B]),b.useEffect(function(){p.current&&u.size>0&&(clearTimeout(p.current),y(!1),O(!1))},[u]),b.useEffect(function(){return()=>p.current?clearTimeout(p.current):void 0},[]);var P=u.size,j;return t?j=s.jsx(Lt,{className:"loading-spinner-vertical-align"}):_&&(j=za),s.jsxs(Mt,{className:"pending-data-bottom-bar",isShown:P>0||S||w!=null,onEntering:c,onEntered:m,onExiting:v,onExited:()=>{O(!1),h&&h()},children:[w!=null&&w!==""&&s.jsxs("div",{className:"error-message",children:[s.jsx(ie,{icon:Wa}),s.jsx("span",{children:"".concat(w)})]}),(w==null||w==="")&&s.jsx("div",{className:"status-message",children:P>0&&s.jsx("span",{children:"".concat(P," row").concat(P>1?"s":""," pending")})}),s.jsxs("div",{className:"buttons-container",children:[!t&&!_&&s.jsx(Y,{kind:"secondary",onClick:a,tooltip:o,children:"Discard"}),s.jsxs(Y,{kind:_?"success":"primary",onClick:i,icon:j,disabled:t||_||w!=null,tooltip:r,children:[t&&"Committing...",!t&&_&&"Success",!t&&!_&&"Commit"]})]})]})}function si(n,e,t,i,a,o,r){try{var d=n[o](r),l=d.value}catch(u){return void t(u)}d.done?e(l):Promise.resolve(l).then(i,a)}function tn(n){return function(){var e=this,t=arguments;return new Promise(function(i,a){var o=n.apply(e,t);function r(l){si(o,i,a,r,d,"next",l)}function d(l){si(o,i,a,r,d,"throw",l)}r(void 0)})}}function Le(n,e,t){return(e=ms(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ms(n){var e=gs(n,"string");return typeof e=="symbol"?e:e+""}function gs(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var be=fe.module("IrisGridCopyHandler");function vs(n){return n.ranges!=null}function ps(n){return n.columnIndex!=null}class G extends b.Component{static getStatusMessageText(e,t){switch(e){case G.COPY_STATES.CONFIRMATION_REQUIRED:return"Are you sure you want to copy ".concat(t.toLocaleString()," rows to your clipboard?");case G.COPY_STATES.CLICK_REQUIRED:return"Fetched ".concat(t.toLocaleString()," rows!");case G.COPY_STATES.FETCH_ERROR:return"Unable to copy data.";case G.COPY_STATES.FETCH_RANGES_IN_PROGRESS:return"Fetching ".concat(t.toLocaleString()," rows for clipboard...");case G.COPY_STATES.FETCH_HEADER_IN_PROGRESS:return"Fetching header for clipboard...";case G.COPY_STATES.DONE:return"Copied to Clipboard!";default:return""}}static getCopyButtonText(e){switch(e){case G.BUTTON_STATES.FETCH_IN_PROGRESS:return"Fetching";case G.BUTTON_STATES.CLICK_TO_COPY:return"Click to Copy";case G.BUTTON_STATES.RETRY:return"Retry";default:return"Copy"}}constructor(e){super(e),Le(this,"textData",void 0),Le(this,"hideTimer",void 0),Le(this,"fetchPromise",void 0),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleCopyClick=this.handleCopyClick.bind(this),this.handleHideTimeout=this.handleHideTimeout.bind(this),this.state={error:void 0,copyState:G.COPY_STATES.IDLE,buttonState:G.BUTTON_STATES.COPY,isShown:!1,rowCount:0}}componentDidMount(){var e=this.props.copyOperation;e!=null&&this.startCopy()}componentDidUpdate(e){var t=this.props.copyOperation;e.copyOperation!==t&&this.startCopy()}componentWillUnmount(){this.stopCopy()}startCopy(){be.debug2("startCopy"),this.stopCopy();var e=this.props.copyOperation;if(e==null){be.debug2("No copy operation set, cancelling out"),this.setState({isShown:!1});return}var t=e.error;if(t!=null){be.debug("Showing copy error",t),this.setState({isShown:!0,copyState:G.COPY_STATES.DONE,error:t}),this.startHideTimer();return}if(this.setState({isShown:!0,error:void 0}),vs(e)){var i=e.ranges,a=Xe.rowCount(i);if(this.setState({rowCount:a}),a>G.NO_PROMPT_THRESHOLD){this.setState({buttonState:G.BUTTON_STATES.COPY,copyState:G.COPY_STATES.CONFIRMATION_REQUIRED});return}}this.startFetch()}stopCopy(){this.textData=void 0,this.stopFetch(),this.stopHideTimer()}handleBackgroundClick(){be.debug2("handleBackgroundClick");var e=this.state.copyState;e===G.COPY_STATES.DONE&&this.setState({isShown:!1})}handleCancelClick(){be.debug2("handleCancelClick"),this.stopFetch(),this.setState({isShown:!1})}handleCopyClick(){var e=this;return tn(function*(){if(be.debug2("handleCopyClick"),e.textData!=null)try{yield e.copyText(e.textData),e.showCopyDone()}catch(t){be.error("Error copying text",t),e.setState({error:"Unable to copy. Verify your browser permissions."})}else e.startFetch()})()}handleHideTimeout(){be.debug2("handleHideTimeout"),this.stopHideTimer(),this.setState({isShown:!1})}copyText(e){var t=this;return tn(function*(){be.debug2("copyText",e),t.textData=e,yield Pi(e)})()}showCopyDone(){this.setState({copyState:G.COPY_STATES.DONE}),this.startHideTimer()}startFetch(){var e=this;return tn(function*(){e.stopFetch();var t=e.props,i=t.model,a=t.copyOperation;if(ps(a)){var o=a.columnIndex,r=a.columnDepth,d=a.movedColumns;be.debug("startFetch copyHeader",o,r),e.setState({buttonState:G.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:G.COPY_STATES.FETCH_HEADER_IN_PROGRESS});var l=Ee.getModelIndex(o,d),u=i.textForColumnHeader(l,r);if(u===void 0){e.fetchPromise=void 0,e.setState({error:"Invalid column header selected.",copyState:G.COPY_STATES.DONE});return}e.fetchPromise=Ae.makeCancelable(u)}else{var c=a.ranges,m=a.includeHeaders,v=a.userColumnWidths,h=a.movedColumns,f=a.formatValues;be.debug("startFetch copyRanges",c),e.setState({buttonState:G.BUTTON_STATES.FETCH_IN_PROGRESS,copyState:G.COPY_STATES.FETCH_RANGES_IN_PROGRESS});var C=le.getHiddenColumns(v),S=Ee.getModelRanges(c,h);if(C.length>0){var y=C.map(Xe.makeColumn);S=Xe.subtractRangesFromRanges(S,y)}var E=f!=null&&f?(_,O)=>i.displayString(_,O.type,O.name):_=>"".concat(_);e.fetchPromise=Ae.makeCancelable(i.textSnapshot(S,m,E))}try{var D=yield e.fetchPromise;e.fetchPromise=void 0;try{yield e.copyText(D),e.showCopyDone()}catch(_){be.error("Error copying text",_),e.setState({buttonState:G.BUTTON_STATES.CLICK_TO_COPY,copyState:G.COPY_STATES.CLICK_REQUIRED})}}catch(_){_ instanceof Tr?be.debug("User cancelled copy."):(be.error("Error fetching contents",_),e.fetchPromise=void 0,e.setState({buttonState:G.BUTTON_STATES.RETRY,copyState:G.COPY_STATES.FETCH_ERROR}))}})()}stopFetch(){this.fetchPromise&&(be.debug2("stopFetch"),this.fetchPromise.cancel(),this.fetchPromise=void 0)}startHideTimer(){this.stopHideTimer(),this.hideTimer=setTimeout(this.handleHideTimeout,G.HIDE_TIMEOUT)}stopHideTimer(){this.hideTimer!=null&&(clearTimeout(this.hideTimer),this.hideTimer=void 0)}render(){var e=this.props,t=e.onEntering,i=e.onEntered,a=e.onExiting,o=e.onExited,r=this.state,d=r.buttonState,l=r.copyState,u=r.isShown,c=r.rowCount,m=r.error,v=l===G.COPY_STATES.DONE?"fade":"copy-slide-up",h=G.getCopyButtonText(d),f=m??G.getStatusMessageText(l,c),C=l!==G.COPY_STATES.DONE,S=d===G.BUTTON_STATES.FETCH_IN_PROGRESS,y=l===G.COPY_STATES.DONE;return s.jsxs(Mt,{animation:v,isShown:u,className:K("iris-grid-copy-handler",{"copy-done":y}),onClick:this.handleBackgroundClick,onEntering:t,onEntered:i,onExiting:a,onExited:o,children:[s.jsx("div",{className:"status-message",children:s.jsx("span",{children:f})}),s.jsx(fn,{in:C,mountOnEnter:!0,unmountOnExit:!0,children:s.jsxs("div",{className:"buttons-container",children:[s.jsx("button",{type:"button",className:"btn btn-outline-secondary btn-cancel",onClick:this.handleCancelClick,children:"Cancel"}),s.jsxs(Y,{kind:S?"tertiary":"primary",className:K("btn-copy",{"btn-spinner":S}),onClick:this.handleCopyClick,disabled:S,children:[S&&s.jsx(Lt,{className:"loading-spinner-vertical-align"}),h]})]})})]})}}Le(G,"NO_PROMPT_THRESHOLD",1e4);Le(G,"HIDE_TIMEOUT",3e3);Le(G,"COPY_STATES",{IDLE:"IDLE",CONFIRMATION_REQUIRED:"CONFIRMATION_REQUIRED",FETCH_RANGES_IN_PROGRESS:"FETCH_RANGES_IN_PROGRESS",FETCH_HEADER_IN_PROGRESS:"FETCH_HEADER_IN_PROGRESS",FETCH_ERROR:"FETCH_ERROR",CLICK_REQUIRED:"CLICK_REQUIRED",DONE:"DONE"});Le(G,"BUTTON_STATES",{COPY:"COPY",FETCH_IN_PROGRESS:"FETCH_IN_PROGRESS",CLICK_TO_COPY:"CLICK_TO_COPY",RETRY:"RETRY"});Le(G,"defaultProps",{copyOperation:null,onEntering:()=>{},onEntered:()=>{},onExiting:()=>{},onExited:()=>{}});function Ot(n,e,t){return(e=fs(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function fs(n){var e=Cs(n,"string");return typeof e=="symbol"?e:e+""}function Cs(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Yi extends b.PureComponent{constructor(e){super(e),Ot(this,"inputField",void 0),Ot(this,"initialValue",void 0),Ot(this,"debouncedSendUpdate",void 0);var t=e.debounceMs;this.debouncedSendUpdate=ut(this.sendUpdate.bind(this),t),this.handleCancel=this.handleCancel.bind(this),this.handleChange=this.handleChange.bind(this),this.handleCommit=this.handleCommit.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.inputField=null;var i=e.value;this.initialValue=i,this.state={isChanged:!1,value:i}}componentDidMount(){var e;(e=this.inputField)===null||e===void 0||e.focus()}componentDidUpdate(e){var t=this.props.debounceMs;e.debounceMs!==t&&(this.debouncedSendUpdate.flush(),this.debouncedSendUpdate=ut(this.sendUpdate.bind(this),t))}componentWillUnmount(){this.debouncedSendUpdate.cancel()}setValue(e){this.initialValue=e,this.setState({value:e})}focus(){var e;(e=this.inputField)===null||e===void 0||e.focus()}handleChange(e){var t=e.target.value;this.setState({value:t,isChanged:!0}),this.debouncedSendUpdate(t)}handleCancel(){this.debouncedSendUpdate.cancel();var e=this.initialValue,t=this.state.isChanged;t&&this.sendUpdate(e);var i=this.props.onDone;i()}handleCommit(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;this.debouncedSendUpdate.flush();var i=this.props.onDone;i(e,t)}handleFocus(){var e;(e=this.inputField)===null||e===void 0||e.select()}handleBlur(e){var t=e.relatedTarget;t!=null&&t.classList.contains("context-menu-container")?this.handleCommit(!1,!0):t!=null&&t.classList.contains("advanced-filter-button")?this.handleCommit(!1,!1):this.handleCommit(!0,!0)}handleTab(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.debouncedSendUpdate.flush();var t=this.props.onTab;t(e)}handleKeyDown(e){switch(e.key){case"Escape":e.stopPropagation(),e.preventDefault(),this.handleCancel();break;case"Enter":e.stopPropagation(),e.preventDefault(),this.handleCommit();break;case"Tab":e.stopPropagation(),e.preventDefault(),this.handleTab(e.shiftKey);break}}handleContextMenu(e){var t=this.props.onContextMenu;t(e)}sendUpdate(e){var t=this.props.onChange;t(e)}render(){var e=this.props,t=e.className,i=e.style,a=e.showAdvancedFilterButton,o=e.isAdvancedFilterSet,r=e.onAdvancedFiltersTriggered,d=this.state.value;return s.jsxs("div",{style:i,className:"iris-grid-input-autosized-wrapper","data-value":d,children:[s.jsx("input",{ref:l=>{this.inputField=l},className:K("iris-grid-input-field",t),type:"text",value:d,onBlur:this.handleBlur,onFocus:this.handleFocus,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onContextMenu:this.handleContextMenu,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"}),a&&s.jsx("div",{className:"advanced-filter-button-container",children:s.jsx(Y,{kind:"ghost",className:K("btn-link-icon advanced-filter-button",{"filter-set":o}),onClick:r,onContextMenu:this.handleContextMenu,children:s.jsxs("div",{className:"fa-layers ",children:[s.jsx(ie,{icon:Oi,className:"filter-solid"}),s.jsx(ie,{icon:cn,className:"filter-light"})]})})})]})}}Ot(Yi,"defaultProps",{style:{},className:"",value:"",showAdvancedFilterButton:!1,isAdvancedFilterSet:!1,onAdvancedFiltersTriggered:()=>{},onChange:()=>{},onDone:()=>{},onTab:()=>{},onContextMenu:()=>{},debounceMs:150});function Ss(n,e,t){return(e=bs(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function bs(n){var e=ys(n,"string");return typeof e=="symbol"?e:e+""}function ys(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ts extends jt{constructor(e){super(),Ss(this,"irisGrid",void 0),this.irisGrid=e,this.cursor=null}onDown(e,t){if(e.altKey&&!mt.isModifierKeyDown(e)&&!e.shiftKey){var i=t.state,a=i.mouseX,o=i.mouseY;if(a==null||o==null)return!1;var r=t.getGridPointFromXY(a,o);if(r.column!=null&&r.row!=null)return this.cursor=this.irisGrid.props.copyCursor,!0}return!1}onUp(e,t){return this.cursor===this.irisGrid.props.copyCursor?(this.cursor=null,!0):!1}}function Es(n,e,t){return(e=ws(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ws(n){var e=As(n,"string");return typeof e=="symbol"?e:e+""}function As(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Fs extends jt{constructor(e){super(),Es(this,"irisGrid",void 0),this.irisGrid=e}onDown(e){var t=this.irisGrid.state.selectedRanges;return e.key==="c"&&mt.isModifierKeyDown(e)?(le.isValidSnapshotRanges(t)?this.irisGrid.copyRanges(t):this.irisGrid.copyRanges(t,!1,!1,"Invalid copy ranges"),!0):!1}}function _s(n,e,t){return(e=Ns(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Ns(n){var e=xs(n,"string");return typeof e=="symbol"?e:e+""}function xs(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Os extends jt{constructor(e){super(),_s(this,"irisGrid",void 0),this.irisGrid=e}onDown(e){if($e.TABLE.REVERSE.matchesEvent(e)){if(!this.irisGrid.isReversible())return!1;var t=this.irisGrid.state.reverse;return this.irisGrid.reverse(!t),!0}return!1}}function Rs(n,e,t){return(e=Is(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Is(n){var e=Ds(n,"string");return typeof e=="symbol"?e:e+""}function Ds(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class Ls extends jt{constructor(e){super(),Rs(this,"irisGrid",void 0),this.irisGrid=e}onDown(e){return $e.TABLE.CLEAR_FILTERS.matchesEvent(e)?(this.irisGrid.clearAllFilters(),!0):!1}}function js(n,e){return Us(n)||ks(n,e)||Ms(n,e)||Ps()}function Ps(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
4
4
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ms(n,e){if(n){if(typeof n=="string")return li(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?li(n,e):void 0}}function li(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function ks(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,a,o,r,d=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(i=o.call(t)).done)&&(d.push(i.value),d.length!==e);l=!0);}catch(c){u=!0,a=c}finally{try{if(!l&&t.return!=null&&(r=t.return(),Object(r)!==r))return}finally{if(u)throw a}}return d}}function Us(n){if(Array.isArray(n))return n}var Vs=3e3;function $s(n){var e=n.children,t=e===void 0?null:e,i=n.onEntering,a=n.onEntered,o=n.onExiting,r=n.onExited,d=b.useState(!1),l=js(d,2),u=l[0],c=l[1],m=b.useRef(),v=ji(t),h=b.useCallback(()=>{c(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{c(!1)},Vs)},[c,m]);return b.useEffect(()=>{v!==t&&t!=null&&h()},[t,v,c,h]),b.useEffect(()=>()=>m.current?clearTimeout(m.current):void 0,[]),s.jsx(Mt,{className:"toast-bottom-bar",isShown:u,onEntering:i,onEntered:a,onExiting:o,onExited:r,children:t})}var Gs=1;function Xi(n){var e=n.model,t=n.top,i=n.bottom,a=n.left,o=n.right,r=n.filter,d=n.formatter,l=n.columnAlignmentMap,u=n.reverse,c=u===void 0?!1:u,m=n.sorts,v=n.customColumns,h=n.movedColumns,f=n.hiddenColumns,C=n.alwaysFetchColumns,S=n.rollupConfig,y=S===void 0?null:S,E=n.totalsConfig,D=E===void 0?null:E,_=n.selectDistinctColumns,O=_===void 0?de:_,p=n.pendingRowCount,B=p===void 0?0:p,w=n.pendingDataMap,P=w===void 0?Ne:w,j=n.frozenColumns,Q=n.formatColumns,x=n.columnHeaderGroups,I=n.partitionConfig,M=n.showExtraGroupColumn,J=e.isTotalsAvailable,U=e.isRollupAvailable;ye(()=>{Pr(e)&&M!=null&&(e.showExtraGroupColumn=M)},[e,M]);var X=b.useMemo(()=>le.getModelViewportColumns(e.columns,a,o,h,f,C,Gs),[e.columns,a,o,h,f,C]);return ye(function(){e.filter=r},[e,r]),ye(function(){var he=[...m];c&&he.push(e.dh.Table.reverse()),e.sort=he},[e,m,c]),ye(function(){e.formatter=d},[e,d]),ye(function(){e.columnAlignmentMap=l},[e,l]),ye(function(){e.isCustomColumnsAvailable&&(e.customColumns=v)},[e,v]),ye(function(){e.isFormatColumnsAvailable&&(e.formatColumns=Q)},[e,Q]),ye(function(){e.setViewport(t,i,X)},[e,t,i,X]),ye(function(){U&&(e.rollupConfig=y)},[e,U,y]),ye(function(){e.isSelectDistinctAvailable&&(e.selectDistinctColumns=O)},[e,O]),ye(function(){J&&(e.totalsConfig=D)},[e,J,D]),ye(function(){e.columnHeaderGroups=x},[e,x]),ye(function(){I&&lt(e)&&(e.partitionConfig=I)},[e,I]),b.useEffect(function(){j&&e.updateFrozenColumns(j)},[e,j]),b.useEffect(function(){e.pendingRowCount=B},[e,B]),b.useEffect(function(){e.pendingDataMap=P},[e,P]),null}Xi.displayName="IrisGridModelUpdater";function Zi(n,e,t){return(e=Bs(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Bs(n){var e=Hs(n,"string");return typeof e=="symbol"?e:e+""}function Hs(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var nn=fe.module("ColumnStatistics"),Ws={SIZE:"Number of Rows"};class vt extends b.Component{static getStatsLabel(e){var t;return(t=Ws[e])!==null&&t!==void 0?t:e.split(" ").map(i=>i[0].toUpperCase()+i.substr(1).toLowerCase()).join(" ")}constructor(e){super(e),Zi(this,"cancelablePromise",void 0),this.handleError=this.handleError.bind(this),this.handleGenerateStatistics=this.handleGenerateStatistics.bind(this),this.handleStatistics=this.handleStatistics.bind(this),this.cancelablePromise=null,this.state={error:null,loading:!1,statistics:null,numRows:0}}componentDidMount(){this.maybeGenerateStatistics()}componentWillUnmount(){this.cancelablePromise&&this.cancelablePromise.cancel()}maybeGenerateStatistics(){var e=this.props,t=e.column,i=e.model,a=i.rowCount-i.pendingRowCount-i.floatingBottomRowCount-i.floatingTopRowCount;this.setState({numRows:a}),!i.isColumnStatisticsAvailable||t.isProxy===!0?this.setState({loading:!1}):a<vt.AUTO_GENERATE_LIMIT&&this.handleGenerateStatistics()}handleGenerateStatistics(){this.setState({loading:!0});var e=this.props,t=e.column,i=e.model;this.cancelablePromise=Ae.makeCancelable(i.columnStatistics(t)),this.cancelablePromise.then(this.handleStatistics).catch(this.handleError)}handleStatistics(e){nn.debug("Received statistics",e);var t=this.props,i=t.model,a=t.onStatistics,o=[];e.statisticsMap.forEach((r,d)=>{o.push({operation:vt.getStatsLabel(d),value:r,type:e.getType(d)})}),e.uniqueValues.forEach((r,d)=>{o.push({operation:d,className:"column-statistics-unique-value",value:r,type:"long"})}),this.setState({loading:!1,statistics:o,numRows:i.rowCount-i.pendingRowCount-i.floatingBottomRowCount-i.floatingTopRowCount}),a()}handleError(e){if(e!=null&&Ae.isCanceled(e)){nn.debug("Called handleError on a cancelled promise result");return}nn.error("Error generating statistics",e),this.setState({error:e,loading:!1,statistics:null})}render(){var e,t=this.props,i=t.column,a=t.model,o=this.state,r=o.error,d=o.loading,l=o.statistics,u=o.numRows,c=!d&&r==null&&l==null&&a.isColumnStatisticsAvailable,m=[],v=i.type.substring(i.type.lastIndexOf(".")+1),h=i.description===null?null:i.description;if(l!=null)for(var f=0;f<l.length;f+=1){var C=l[f],S=C.operation,y=C.className,E=C.value,D=C.type,_=D?a.displayString(E,D):a.displayString(E,i.type,i.name),O=s.jsxs(Oe.Fragment,{children:[s.jsx("div",{className:K("column-statistic-operation",y),children:S}),s.jsx("div",{className:"column-statistic-value",children:_})]},S);m.push(O)}var p=hn(a)&&a.hasExpandableRows?"Expanded Rows":"Number of Rows",B=a.displayString(u,"long"),w=a.getColumnIndexByName(i.name);return s.jsxs("div",{className:"column-statistics",children:[s.jsxs("div",{className:"column-statistics-title",children:[(e=i.displayName)!==null&&e!==void 0?e:i.name,s.jsxs("span",{className:"column-statistics-type",children:[" (",v,")"]}),s.jsx(Mi,{tooltip:"Copy column name",copy:i.name,isQuiet:!0})]}),h!=null&&s.jsx("div",{className:"column-statistics-description",children:h}),w!=null&&!a.isColumnSortable(w)&&s.jsxs("div",{className:"column-statistics-status",children:[s.jsx(ie,{icon:qa,className:"mr-1"}),"Not sortable"]}),w!=null&&!a.isColumnMovable(w)&&s.jsxs("div",{className:"column-statistics-status",children:[s.jsx(ie,{icon:a.isColumnFrozen(w)?Ka:Qn,className:"mr-1"}),a.isColumnFrozen(w)?"Frozen":"Not movable"]}),w!=null&&Re(a)&&a.isEditable&&!a.keyColumnSet.has(i.name)&&!a.valueColumnSet.has(i.name)&&s.jsxs("div",{className:"column-statistics-status",children:[s.jsx(ie,{icon:Qn,className:"mr-1"}),"Not editable"]}),s.jsxs("div",{className:"column-statistics-grid",children:[l==null&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"column-statistic-operation",children:p}),s.jsx("div",{className:"column-statistic-value",children:B})]}),m]}),c&&s.jsx(Y,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,children:"Generate Stats"}),r!=null&&s.jsx("div",{className:"error-message",children:"".concat(r)}),l&&!d&&s.jsx(Y,{kind:"ghost",className:"px-0",onClick:this.handleGenerateStatistics,icon:Qa,children:"Refresh"}),d&&s.jsxs("div",{className:"column-statistics-loading",children:[s.jsx(Lt,{className:"loading-spinner-vertical-align"}),"Calculating Stats..."]})]})}}Zi(vt,"AUTO_GENERATE_LIMIT",1e5);function zs(n,e,t){return(e=qs(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function qs(n){var e=Ks(n,"string");return typeof e=="symbol"?e:e+""}function Ks(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}class At extends b.PureComponent{static createSearchFilter(e,t,i,a,o){var r=o?a.filter(u=>!i.includes(u.name)).map(u=>u.name):i;if(t&&r.length>0){var d=e.FilterValue.ofString(t),l=r.length===a.length?e.FilterCondition.search(d):e.FilterCondition.search(d,a.filter(u=>r.includes(u.name)).map(u=>u.filter()));return l}}constructor(e){super(e),zs(this,"searchField",void 0),this.handleSearchValueChange=this.handleSearchValueChange.bind(this),this.toggleColumn=this.toggleColumn.bind(this),this.selectAll=this.selectAll.bind(this),this.clear=this.clear.bind(this),this.selectNumbers=this.selectNumbers.bind(this),this.searchField=Oe.createRef(),this.state={isConfigureColumnsShown:!1}}focus(){var e;(e=this.searchField.current)===null||e===void 0||e.focus()}handleSearchValueChange(e){var t=this.props,i=t.onChange,a=t.selectedColumns,o=t.invertSelection;i(e.target.value,a,o)}sendColumnChange(e,t){var i=this.props,a=i.onChange,o=i.value;a(o,e,t)}setInvertSelection(e){var t=this.props,i=t.onChange,a=t.value;i(a,[],e)}toggleColumn(e){var t=this.props,i=t.selectedColumns,a=t.invertSelection;if(i.includes(e))this.sendColumnChange(i.filter(r=>r!==e),a);else{var o=i.slice();o.push(e),this.sendColumnChange(o,a)}}selectAll(){this.setInvertSelection(!0)}clear(){this.setInvertSelection(!1)}selectNumbers(){var e=this.props.columns;this.sendColumnChange(e.filter(t=>T.isNumberType(t.type)).map(t=>t.name),!1)}render(){var e=this.props,t=e.value,i=e.selectedColumns,a=e.invertSelection,o=e.columns,r=this.state.isConfigureColumnsShown,d=i.length===0&&a===!0||i.length===o.length&&a===!1,l=i.length===0&&a===!1||i.length===o.length&&a===!0,u;return d?u=s.jsxs(s.Fragment,{children:[s.jsx(ie,{icon:Xn,mask:Yt,transform:"shrink-2 down-5 right-7"}),s.jsx(ie,{icon:Ya,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}):l?u=s.jsxs(s.Fragment,{children:[s.jsx(ie,{icon:Xa,mask:Yt,transform:"shrink-1 down-5 right-7"}),s.jsx(ie,{icon:Yn,className:"text-danger",transform:"shrink-4 down-5 right-7"})]}):u=s.jsxs(s.Fragment,{children:[s.jsx(ie,{icon:Xn,mask:Yt,transform:"shrink-2 down-5 right-7"}),s.jsx(ie,{icon:Za,className:"text-primary",transform:"shrink-4 down-5 right-7"})]}),s.jsxs("div",{className:"cross-column-container",children:[s.jsx(Er,{className:"cross-column-search",placeholder:"Search Data...","data-testid":"cross-column-search",value:t,onChange:this.handleSearchValueChange,ref:this.searchField}),s.jsxs("button",{type:"button",className:"btn btn-link btn-link-icon px-2",onClick:()=>{r?this.setState({isConfigureColumnsShown:!1}):this.setState({isConfigureColumnsShown:!0})},children:[s.jsx("div",{className:"fa-layers",children:u}),s.jsx(De,{children:"Configure Columns"}),s.jsx(ki,{isShown:r,className:"cross-column-popper",onExited:()=>{this.setState({isConfigureColumnsShown:!1})},closeOnBlur:!0,interactive:!0,children:s.jsxs("div",{className:"cross-column-popup",children:["Searched Columns",s.jsx("div",{className:"cross-column-scroll",children:o.map(c=>c.isProxy===!0?null:s.jsxs(Oe.Fragment,{children:[s.jsx(wr,{className:"cross-column-checkbox",checked:a?!i.includes(c.name):i.includes(c.name),onChange:()=>this.toggleColumn(c.name),children:c.name}),c.type.substring(c.type.lastIndexOf(".")+1)]},c.name))}),s.jsxs("div",{className:"cross-column-button-bar",children:[s.jsx("button",{type:"button",className:"btn btn-link",onClick:this.selectAll,children:"Select All"}),s.jsx("button",{type:"button",className:"btn btn-link",onClick:this.clear,children:"Clear"}),s.jsx("button",{type:"button",className:"btn btn-link",onClick:this.selectNumbers,children:"Numbers Only"})]}),l&&s.jsxs("p",{className:"text-danger",children:[s.jsx(ie,{icon:Yn})," Select at least one column to search."]})]})})]})]})}}function di(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable})),t.push.apply(t,i)}return t}function ui(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?di(Object(t),!0).forEach(function(i){dt(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):di(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function ci(n,e,t,i,a,o,r){try{var d=n[o](r),l=d.value}catch(u){return void t(u)}d.done?e(l):Promise.resolve(l).then(i,a)}function Ft(n){return function(){var e=this,t=arguments;return new Promise(function(i,a){var o=n.apply(e,t);function r(l){ci(o,i,a,r,d,"next",l)}function d(l){ci(o,i,a,r,d,"throw",l)}r(void 0)})}}function dt(n,e,t){return(e=Qs(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Qs(n){var e=Ys(n,"string");return typeof e=="symbol"?e:e+""}function Ys(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var We=fe.module("IrisGridPartitionSelector");class Xs extends b.Component{constructor(e){super(e),dt(this,"pending",void 0),dt(this,"tableUtils",void 0),dt(this,"getCachedChangeCallback",ne(i=>a=>this.handlePartitionSelect(i,a),{max:100})),dt(this,"getCachedFormatValueCallback",ne(i=>a=>this.getDisplayValue(i,a),{max:100})),this.handlePartitionTableClick=this.handlePartitionTableClick.bind(this),this.handleMergeClick=this.handleMergeClick.bind(this),this.handlePartitionSelect=this.handlePartitionSelect.bind(this);var t=e.model;this.tableUtils=new T(t.dh),this.pending=new Ui,this.state={isLoading:!0,baseTable:null,keysTable:null,partitionTables:null}}componentDidMount(){var e=this;return Ft(function*(){var t=e.props.model;try{var i=yield e.pending.add(t.partitionKeysTable().then(o=>o),o=>o.close()),a=yield e.pending.add(t.partitionBaseTable(),o=>o.close());e.setState({keysTable:i,baseTable:a,isLoading:!1},e.updatePartitionOptions)}catch(o){if(!Ae.isCanceled(o))throw o}})()}componentDidUpdate(e){var t=e.partitionConfig,i=this.props.partitionConfig;t!==i&&this.updatePartitionOptions()}componentWillUnmount(){this.pending.cancel();var e=this.state,t=e.keysTable,i=e.baseTable,a=e.partitionTables;i==null||i.close(),t==null||t.close(),a==null||a.forEach(o=>o.close())}handlePartitionTableClick(){We.debug2("handlePartitionTableClick");var e=this.props.partitionConfig;W(e);var t=ui({},e);t.mode=e.mode==="keys"?"partition":"keys",this.sendUpdate(t)}handleMergeClick(){We.debug2("handleMergeClick");var e=this.props.partitionConfig;W(e);var t=ui({},e);t.mode=e.mode==="merged"?"partition":"merged",this.sendUpdate(t)}handlePartitionSelect(e,t){var i=this;return Ft(function*(){var a=i.props.partitionConfig;W(a),We.debug("handlePartitionSelect",e,t,a);var o=[...a.partitions];o[e]=t;var r=i.state.baseTable,d=i.state.keysTable;W(r),W(d);try{i.setState({isLoading:!0});var l=yield i.pending.add(r.copy(),v=>v.close()),u=o.slice(0,e+1).map((v,h)=>{var f=l.columns[h];return i.tableUtils.makeNullableEqFilter(f,v)});l.applyFilter(u),l.setViewport(0,0,l.columns);var c=yield i.pending.add(l.getViewportData()),m={partitions:d.columns.map(v=>c.rows[0].get(v)),mode:"partition"};l.close(),i.sendUpdate(m)}catch(v){Ae.isCanceled(v)||We.error("Unable to get partition tables",v)}finally{i.setState({isLoading:!1})}})()}sendUpdate(e){We.debug2("sendUpdate",e);var t=this.props.onChange;t(e)}getDisplayValue(e,t){var i=this.props.model;if(t===null)return"(null)";if(t===void 0||t==="")return"";var a=i.partitionColumns[e];return T.isCharType(a.type)&&t.toString().length>0?String.fromCharCode(parseInt(t.toString(),10)):i.displayString(t,a.type,a.name)}updatePartitionOptions(){var e=this;return Ft(function*(){var t=e.props.model,i=e.props.partitionConfig;if(i!=null){var a=e.state.keysTable;W(a);var o=[...i.partitions].map((d,l)=>{var u=a.columns[l];return e.tableUtils.makeNullableEqFilter(u,d)}),r=yield Promise.all(t.partitionColumns.map(function(){var d=Ft(function*(l,u){return a.applyFilter(o.slice(0,u)),a.selectDistinct(t.partitionColumns.slice(0,u+1))});return function(l,u){return d.apply(this,arguments)}}()));e.setState({partitionTables:r})}})()}getPartitionFilters(e){var t=this.props,i=t.model,a=t.partitionConfig;W(a);var o=a.partitions;if(We.debug("getPartitionFilters",a),o.length!==e.length)throw new Error("Invalid partition config set. Expected ".concat(e.length," partitions, but got ").concat(o.length));for(var r=[],d=0;d<o.length;d+=1)if(d===0)r.push([]);else{var l=r[d-1],u=o[d-1],c=i.partitionColumns[d-1],m=[...l,this.tableUtils.makeNullableEqFilter(c,u)];r.push(m)}return r}render(){var e=this.props,t=e.model,i=e.partitionConfig,a=this.state,o=a.isLoading,r=a.partitionTables,d=t.partitionColumns.map((l,u)=>s.jsxs("div",{className:"column-selector",children:[(r==null?void 0:r[u])&&s.jsx(Vr,{label:l.name,labelPosition:"side",table:r[u],direction:"bottom",shouldFlip:!1,keyColumn:r[u].columns[u].name,selectedKey:(i==null?void 0:i.mode)==="partition"?i.partitions[u]:null,placeholder:"Select a key",labelColumn:r[u].columns[u].name,onChange:this.getCachedChangeCallback(u),isDisabled:o||i==null}),t.partitionColumns.length-1===u||s.jsx(ie,{icon:Ja})]},"selector-".concat(l.name)));return s.jsxs("div",{className:"iris-grid-partition-selector",children:[s.jsxs("div",{className:"partition-button-group",children:[s.jsx(Y,{onClick:this.handlePartitionTableClick,kind:"inline",tooltip:t.isPartitionAwareSourceTable?"View keys as table":"View underlying partition table",icon:er,active:(i==null?void 0:i.mode)==="keys",disabled:o||i==null,children:"Partitions"}),s.jsx(Y,{onClick:this.handleMergeClick,kind:"inline",tooltip:"View all partitions as one merged table",icon:s.jsx(ie,{icon:tr,rotation:90}),active:(i==null?void 0:i.mode)==="merged",disabled:o||i==null,children:t.isPartitionAwareSourceTable?"Coalesce":"Merge"})]}),d]})}}function Zs(n,e,t){return(e=Js(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Js(n){var e=el(n,"string");return typeof e=="symbol"?e:e+""}function el(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var tl=fe.module("SelectDistinctBuilder");class Ji extends b.Component{constructor(e){super(e),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleDropdownChanged=this.handleDropdownChanged.bind(this);var t=this.props,i=t.model,a=t.selectDistinctColumns;this.state={inputs:a.length>0?[...a]:[""],columns:i.originalColumns}}componentDidUpdate(e,t){var i=this.state.inputs,a=this.props.onChange;if(t.inputs!==i){var o=i.filter(r=>r!=="");Ve(t.inputs.filter(r=>r!==""),o)||a(o)}}handleAddColumnClick(){this.setState(e=>{var t=e.inputs;return{inputs:[...t,""]}})}handleDeleteColumn(e){this.setState(t=>{var i=t.inputs;return{inputs:i.length===1&&e===0?[""]:i.filter((a,o)=>e!==o)}})}handleDropdownChanged(e,t){tl.debug("handleDropdownChanged",e,t),this.setState(i=>{var a=i.inputs,o=[...a];return o[e]=t,{inputs:o}})}renderInputs(){var e=this.state,t=e.columns,i=e.inputs;return i.map((a,o)=>{var r=t.filter(d=>{var l=d.name;return l===a||!i.includes(l)}).map(d=>{var l=d.name;return s.jsx("option",{value:l,children:l},l)});return s.jsxs("div",{className:"form-inline px-3 pb-3",children:[s.jsxs(Ye,{className:"form-control custom-select col",value:a,onChange:d=>this.handleDropdownChanged(o,d),children:[s.jsx("option",{value:"",children:"Select a column"}),r]}),(i.length>1||a!=="")&&s.jsx(Y,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{this.handleDeleteColumn(o)},icon:s.jsx(ie,{icon:vn,transform:"grow-3"}),tooltip:"Delete column"})]},o)})}render(){var e=this.state,t=e.columns,i=e.inputs,a=i.length>=t.length;return s.jsxs("div",{role:"presentation",className:"select-distinct-builder-container h-100",children:[s.jsx("div",{className:"select-distinct-title",children:"Display Unique Values From"}),this.renderInputs(),s.jsx("hr",{}),s.jsx("div",{className:"pt-1 px-3",children:s.jsx(Y,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,disabled:a,icon:pn,children:"Add Additional Column"})}),s.jsx("div",{className:"select-distinct-builder-footer",children:s.jsx("div",{className:"select-distinct-builder-hint",children:"Display only unique values from the selected table columns. Note that this will reset any filters and display only the selected columns."})})]})}}Zs(Ji,"defaultProps",{selectDistinctColumns:[],onChange:()=>{}});var nl=fe.module("PluginTableOptionsErrorBoundary");class il extends Oe.Component{static getDerivedStateFromError(e){return{error:e}}constructor(e){super(e),this.state={error:null}}componentDidCatch(e,t){var i=this.props.itemType;nl.error('Plugin sidebar page "'.concat(i,'" threw during render; suppressing.'),e,t)}render(){var e=this.state.error,t=this.props,i=t.children,a=t.itemType;return e==null?i:s.jsxs("div",{className:"plugin-sidebar-error",role:"alert","data-testid":"plugin-sidebar-error",children:[s.jsxs("p",{children:[a," failed to render:"]}),s.jsx("p",{children:e.message})]})}}function al(n,e){return ll(n)||sl(n,e)||ol(n,e)||rl()}function rl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
@@ -12,4 +12,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
12
12
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vd(n,e){if(n){if(typeof n=="string")return Ei(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ei(n,e):void 0}}function Ei(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function pd(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,a,o,r,d=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(i=o.call(t)).done)&&(d.push(i.value),d.length!==e);l=!0);}catch(c){u=!0,a=c}finally{try{if(!l&&t.return!=null&&(r=t.return(),Object(r)!==r))return}finally{if(u)throw a}}return d}}function fd(n){if(Array.isArray(n))return n}function Cd(n){var e,t,i=n.text,a=n.isOpen,o=n.onClose,r=b.useState(!1),d=ot(r,2),l=d[0],u=d[1],c=b.useState(0),m=ot(c,2),v=m[0],h=m[1],f=b.useState(!1),C=ot(f,2),S=C[0],y=C[1],E=b.useState(!1),D=ot(E,2),_=D[0],O=D[1],p=b.useState(!1),B=ot(p,2),w=B[0],P=B[1],j=b.useRef();b.useEffect(function(){if(a){try{JSON.parse(i),P(!0)}catch{P(!1)}O(!1)}},[a,i]),b.useEffect(function(){j.current&&j.current.layout()},[v]),b.useEffect(function(){j.current&&j.current.updateOptions({lineNumbers:S?"on":"off"})},[S]);function Q(){y(!S)}function x(){var U,X=(U=j.current)===null||U===void 0?void 0:U.getModel();!w||!X||(_?(X.setValue(i),O(!1)):(X.setValue(JSON.stringify(JSON.parse(i),void 0,2)),O(!0)),I())}function I(){var U,X,V=j.current;V&&y(((U=(X=V.getModel())===null||X===void 0?void 0:X.getLineCount())!==null&&U!==void 0?U:0)>1)}function M(){l&&(j.current=void 0,o())}function J(U){var X;j.current=U,h(U.getContentHeight()),U.onDidContentSizeChange(V=>{var he=V.contentHeight;return h(he)}),I(),(X=document.activeElement)===null||X===void 0||X.blur()}return!a&&!l?null:s.jsxs(Ri,{isOpen:a,centered:!0,keyboard:!0,toggle:M,onOpened:()=>u(!0),onClosed:()=>{u(!1),h(0)},className:"cell-overflow-modal",size:"xl",children:[s.jsxs(Ii,{toggle:o,children:[s.jsx("h5",{className:"overflow-modal-title",children:"Cell Contents"}),s.jsx(Mi,{tooltip:"Copy cell contents",copy:(e=(t=j.current)===null||t===void 0?void 0:t.getValue())!==null&&e!==void 0?e:i}),s.jsxs(Wn,{isSelected:S,"aria-label":"Toggle line numbers",onChange:Q,children:[s.jsx(zn,{UNSAFE_className:"action-button-icon-with-tooltip",children:s.jsx(ie,{icon:rr})}),s.jsx(De,{children:"Toggle line numbers"})]}),w&&s.jsxs(Wn,{isSelected:_,"aria-label":"Format as JSON",onChange:x,children:[s.jsx(zn,{UNSAFE_className:"action-button-icon-with-tooltip",children:s.jsx(ie,{icon:or})}),s.jsx(De,{children:"Format as JSON"})]})]}),s.jsx(Di,{style:{height:v},children:s.jsx(Fr,{onEditorInitialized:J,settings:{value:i,readOnly:!0,wordWrap:"on",language:w?"typescript":"plaintext",folding:w,padding:{bottom:16},lineNumbers:S?"on":"off",overviewRulerLanes:0,renderLineHighlight:"none",find:{seedSearchStringFromSelection:"never"}}})})]})}function Sd(n,e){return Ed(n)||Td(n,e)||yd(n,e)||bd()}function bd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
13
13
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yd(n,e){if(n){if(typeof n=="string")return wi(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?wi(n,e):void 0}}function wi(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function Td(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,a,o,r,d=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e!==0)for(;!(l=(i=o.call(t)).done)&&(d.push(i.value),d.length!==e);l=!0);}catch(c){u=!0,a=c}finally{try{if(!l&&t.return!=null&&(r=t.return(),Object(r)!==r))return}finally{if(u)throw a}}return d}}function Ed(n){if(Array.isArray(n))return n}var wd="###,##0",aa=b.forwardRef((n,e)=>{var t=n.gotoRow,i=n.gotoRowError,a=n.gotoValueError,o=n.onGotoRowSubmit,r=n.isShown,d=n.onEntering,l=n.onEntered,u=n.onExiting,c=n.onExited,m=n.model,v=n.onGotoRowNumberChanged,h=n.onClose,f=n.gotoValueSelectedColumnName,C=n.gotoValue,S=n.gotoValueFilter,y=n.onGotoValueSelectedColumnNameChanged,E=n.onGotoValueSelectedFilterChanged,D=n.onGotoValueChanged,_=n.onGotoValueSubmit,O=b.useRef(null),p=b.useRef(null),B=b.useState(!1),w=Sd(B,2),P=w[0],j=w[1],Q=[];Mr(m)&&(Q=m.table.columns);var x=m.dh,I=m.rowCount,M=b.useMemo(()=>"goto-row-input-".concat(ln()),[]),J=g=>{g.key==="Enter"?(g.stopPropagation(),g.preventDefault(),_()):(g.key==="Backspace"||g.key==="Delete")&&(C==="".concat(Number.POSITIVE_INFINITY)||C==="".concat(Number.NEGATIVE_INFINITY))&&ee("")},U=g=>{g.key==="Enter"&&(g.stopPropagation(),g.preventDefault(),_(g.shiftKey))},X=m.getColumnIndexByName(f),V=Q[X??0],he=V==null?void 0:V.type,Fe=T.getNormalizedType(he),ee=g=>{D(g??"")};b.useImperativeHandle(e,()=>({focus(){var g;j(!0),(g=O.current)===null||g===void 0||g.select()}}));var te=()=>{if(P&&document.activeElement!==O.current){var g;(g=O.current)===null||g===void 0||g.select()}else if(!P&&document.activeElement!==p.current){var F;(F=p.current)===null||F===void 0||F.select()}};b.useEffect(te,[P]);var Ge=()=>{switch(Fe){case T.dataType.DECIMAL:case T.dataType.INT:return s.jsx("div",{className:"goto-row-input",children:s.jsx("input",{ref:p,className:K("form-control",{"is-invalid":a!==""}),onKeyDown:J,placeholder:"value",onChange:g=>{var F=g.target.value.toLowerCase();/^-?[0-9]*\.?[0-9]*$/.test(g.target.value)?ee(g.target.value):F==="-i"||F==="-infinity"?ee("".concat(Number.NEGATIVE_INFINITY)):(F==="i"||F==="infinity")&&ee("".concat(Number.POSITIVE_INFINITY))},value:C,"aria-label":"Value Input"})});case T.dataType.DATETIME:return s.jsx("div",{className:"goto-value-date-time-input",children:s.jsx(vo,{ref:p,className:K("form-control","goto-value-date-time-input",{"is-invalid":a!==""}),defaultValue:C,onChange:ee,onSubmit:U,"aria-label":"Value Input"})});case T.dataType.STRING:return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"goto-row-input",children:s.jsxs(Ye,{className:"custom-select",onChange:g=>{E(g)},value:S,"aria-label":"filter-type-select",children:[s.jsx("option",{value:Te.eqIgnoreCase,children:"Equals (case-insensitive)"},Te.eqIgnoreCase),s.jsx("option",{value:Te.containsIgnoreCase,children:"Contains (case-insensitive)"},Te.containsIgnoreCase),s.jsx("option",{value:Te.eq,children:"Equals"},Te.eq),s.jsx("option",{value:Te.contains,children:"Contains"},Te.contains)]})}),s.jsx("div",{className:"goto-row-input",children:s.jsx("input",{ref:p,className:K("form-control",{"is-invalid":a!==""}),onKeyDown:U,placeholder:"value",onChange:g=>ee(g.target.value),value:C,"aria-label":"Value Input"})})]});case T.dataType.BOOLEAN:return s.jsx("div",{className:"goto-row-input",children:s.jsxs(Ye,{className:"custom-select",onChange:g=>{ee(g)},value:C,"aria-label":"Value Input",children:[s.jsx("option",{"aria-label":"null value",value:""},"null"),s.jsx("option",{value:"true",children:"true"},"true"),s.jsx("option",{value:"false",children:"false"},"false")]})});default:return s.jsx("div",{className:"goto-row-input",children:s.jsx("input",{ref:p,className:"form-control",onKeyDown:U,placeholder:"value",onChange:g=>ee(g.target.value),value:C,"aria-label":"Value Input"})})}};return s.jsx(Mt,{isShown:r,className:K("goto-row"),onEntering:d,onEntered:()=>{l(),te()},onExiting:u,onExited:c,children:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"goto-row-row",children:[s.jsxs("div",{className:K("goto-row-wrapper",{"is-inactive":!P}),onClick:()=>j(!0),onFocus:()=>j(!0),role:"group",children:[s.jsx("label",{className:"goto-row-text",htmlFor:M,children:"Go to row"}),s.jsx("div",{className:"goto-row-input",children:s.jsx("input",{ref:O,"data-testid":"goto-row-input",type:"number",onKeyDown:g=>{g.key==="Enter"&&(g.stopPropagation(),g.preventDefault(),o())},className:K("form-control",{"is-invalid":i!==""}),placeholder:"Row number",onChange:g=>{v(g)},value:t,id:M})}),s.jsxs("div",{className:"goto-row-text",children:["of"," ",x.i18n.NumberFormat.format(wd,I)]}),i&&s.jsx("div",{className:"text-danger",children:i})]}),s.jsx("div",{className:"goto-row-close",children:s.jsx(Y,{kind:"ghost",onClick:h,children:s.jsx(ie,{icon:Li,style:{marginRight:"0"}})})})]}),m.isSeekRowAvailable&&s.jsx("div",{className:"goto-row-row",children:s.jsxs("div",{className:K("goto-row-wrapper",{"is-inactive":P}),onClick:()=>j(!1),onFocus:()=>j(!1),role:"group",children:[s.jsx("div",{className:"goto-row-text",children:"Go to value"}),s.jsx("div",{className:"goto-row-input",children:s.jsx(Ye,{className:"custom-select",onChange:g=>{var F=g;y(F)},value:f,"aria-label":"column-name-select",id:"column-name-select",children:Q.map(g=>s.jsx("option",{value:g.name,children:g.name},g.name))})}),Ge(),s.jsxs("div",{children:[s.jsx(Y,{tooltip:"Previous match",icon:sr,kind:"ghost",disabled:C==="",onClick:()=>{_(!0)}}),s.jsx(Y,{tooltip:"Next match",icon:lr,kind:"ghost",disabled:C==="",onClick:()=>{_(!1)}})]}),a&&s.jsx("div",{className:"text-danger",children:a})]})})]})})});aa.displayName="GotoRow";function Ad(n){var e=n.isOpen,t=n.onClose,i=n.errorMessage,a=_r.PASTE.getDisplayText();return s.jsxs(Ri,{isOpen:e,toggle:t,centered:!0,children:[s.jsx(Ii,{closeButton:!1,children:"No Paste Permission"}),s.jsxs(Di,{children:[s.jsx("p",{children:i}),s.jsxs("p",{children:["You can still use ",a," to paste."]})]}),s.jsx(Nr,{children:s.jsx(Y,{kind:"primary",onClick:t,children:"Dismiss"})})]})}function Ke(n,e){return xd(n)||Nd(n,e)||_d(n,e)||Fd()}function Fd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
14
14
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _d(n,e){if(n){if(typeof n=="string")return Ai(n,e);var t={}.toString.call(n).slice(8,-1);return t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set"?Array.from(n):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ai(n,e):void 0}}function Ai(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);t<e;t++)i[t]=n[t];return i}function Nd(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var i,a,o,r,d=[],l=!0,u=!1;try{if(o=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(i=o.call(t)).done)&&(d.push(i.value),d.length!==e);l=!0);}catch(c){u=!0,a=c}finally{try{if(!l&&t.return!=null&&(r=t.return(),Object(r)!==r))return}finally{if(u)throw a}}return d}}function xd(n){if(Array.isArray(n))return n}function Fi(n,e,t,i,a,o,r){try{var d=n[o](r),l=d.value}catch(u){return void t(u)}d.done?e(l):Promise.resolve(l).then(i,a)}function st(n){return function(){var e=this,t=arguments;return new Promise(function(i,a){var o=n.apply(e,t);function r(l){Fi(o,i,a,r,d,"next",l)}function d(l){Fi(o,i,a,r,d,"throw",l)}r(void 0)})}}function _i(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(a){return Object.getOwnPropertyDescriptor(n,a).enumerable})),t.push.apply(t,i)}return t}function se(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_i(Object(t),!0).forEach(function(i){A(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):_i(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function A(n,e,t){return(e=Od(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function Od(n){var e=Rd(n,"string");return typeof e=="symbol"?e:e+""}function Rd(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}var N=fe.module("IrisGrid"),Id=500,Dd=500,Ld=250,jd=250,Pd=250,gn=Object.freeze({aggregations:de,showOnTop:!1}),Md="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function Ni(n){var e=n.advancedFilters,t=n.aggregationSettings,i=n.customColumns,a=n.quickFilters,o=n.reverse,r=n.rollupConfig,d=n.searchFilter,l=n.selectDistinctColumns,u=n.sorts;return e.size===0&&t.aggregations.length===0&&i.length===0&&a.size===0&&!o&&r==null&&d==null&&l.length===0&&u.length===0}class Ie extends b.Component{constructor(e){var t,i,a;super(e),A(this,"grid",void 0),A(this,"lastFocusedFilterBarColumn",void 0),A(this,"lastLoadedConfig",void 0),A(this,"tooltip",void 0),A(this,"pending",void 0),A(this,"globalColumnFormats",void 0),A(this,"dateTimeFormatterOptions",void 0),A(this,"decimalFormatOptions",void 0),A(this,"integerFormatOptions",void 0),A(this,"truncateNumbersWithPound",void 0),A(this,"showEmptyStrings",void 0),A(this,"showNullStrings",void 0),A(this,"showExtraGroupColumn",void 0),A(this,"loadingScrimStartTime",void 0),A(this,"loadingScrimFinishTime",void 0),A(this,"animationFrame",void 0),A(this,"loadingTimer",void 0),A(this,"tableSaver",void 0),A(this,"crossColumnRef",void 0),A(this,"isAnimating",void 0),A(this,"filterInputRef",void 0),A(this,"gotoRowRef",void 0),A(this,"isCopying",void 0),A(this,"toggleFilterBarAction",void 0),A(this,"toggleSearchBarAction",void 0),A(this,"toggleGotoRowAction",void 0),A(this,"discardAction",void 0),A(this,"commitAction",void 0),A(this,"contextActions",void 0),A(this,"tableUtils",void 0),A(this,"keyHandlers",void 0),A(this,"mouseHandlers",void 0),A(this,"lastMetricCalculatorFactory",void 0),A(this,"slideTransitionRef",Oe.createRef()),A(this,"bottomTransitionRef",Oe.createRef()),A(this,"getAdvancedMenuOpenedHandler",ne(g=>this.handleAdvancedMenuOpened.bind(this,g),{max:100})),A(this,"getAdvancedMenuToggleMaximizeHandler",ne(g=>this.handleAdvancedFilterToggleMaximize.bind(this,g),{max:100})),A(this,"getCachedAdvancedFilterMenuActions",ne((g,F,L,z,ae,$,re)=>s.jsx(xe,{model:g,column:F,onFilterChange:this.handleAdvancedFilterChange,onSortChange:this.handleAdvancedFilterSortChange,onDone:this.handleAdvancedFilterDone,options:L,sortDirection:z,formatter:ae,tableUtils:this.tableUtils,isMaximized:$,onToggleMaximize:re}),{max:50})),A(this,"getCachedOptionItems",ne((g,F,L,z,ae,$,re,ge,ue,Ce,_e,Ze,ft,Ct,St,kt,Ut)=>{var pe=[];return g&&pe.push({type:Z.CHART_BUILDER,title:"Chart Builder",icon:dr,order:100}),z&&pe.push({type:Z.VISIBILITY_ORDERING_BUILDER,title:"Organize Columns",icon:ur,order:200}),L&&pe.push({type:Z.CONDITIONAL_FORMATTING,title:"Conditional Formatting",icon:cr,order:300}),F&&pe.push({type:Z.CUSTOM_COLUMN_BUILDER,title:"Custom Columns",icon:hr,order:400}),ae&&pe.push({type:Z.ROLLUP_ROWS,title:"Rollup Rows",icon:mr,order:500}),$&&pe.push({type:Z.AGGREGATIONS,title:"Aggregate Columns",icon:gr,order:600}),re&&pe.push({type:Z.SELECT_DISTINCT,title:"Select Distinct Values",icon:vr,order:700}),ge&&Ct&&pe.push({type:Z.TABLE_EXPORTER,title:"Download CSV",icon:pr,order:800}),Ut&&pe.push({type:Z.ADVANCED_SETTINGS,title:"Advanced Settings",icon:fr,order:900}),pe.push({type:Z.QUICK_FILTERS,title:"Quick Filters",subtitle:ue.shortcut.getDisplayText(),icon:cn,isOn:Ze,onChange:ue.action,order:1e3}),St&&pe.push({type:Z.SEARCH_BAR,title:"Search Bar",subtitle:Ce.shortcut.getDisplayText(),icon:Cr,isOn:ft,onChange:Ce.action,order:1100}),pe.push({type:Z.GOTO,title:"Go to",subtitle:_e.shortcut.getDisplayText(),icon:Sr,isOn:kt,onChange:_e.action,order:1200}),Object.freeze(pe)},{max:1})),A(this,"getCachedTransformedOptionItems",ne((g,F)=>{if(F==null)return g;var L;try{L=F(g)}catch($){return N.error("transformTableOptions threw an error; falling back to defaults.",$),g}var z=new Map;L.forEach($=>{z.set(String($.type),$)});var ae=[...z.values()].map(($,re)=>({item:$,index:re})).sort(($,re)=>{var ge,ue;return((ge=$.item.order)!==null&&ge!==void 0?ge:1/0)-((ue=re.item.order)!==null&&ue!==void 0?ue:1/0)||$.index-re.index}).map($=>{var re=$.item;return re});return Object.freeze(ae)},{max:1})),A(this,"getCachedHiddenColumns",ne((g,F)=>le.getHiddenColumns(new Map([...g.initialColumnWidths,...F])),{max:1})),A(this,"getCachedHiddenColumnNames",ne((g,F)=>Object.freeze(g.map(L=>{var z;return(z=F[L])===null||z===void 0?void 0:z.name}).filter(L=>L!=null)),{max:1})),A(this,"getCachedViewState",ne(g=>Object.freeze({hiddenColumns:g}),{max:1})),A(this,"getAggregationMap",ne((g,F)=>{var L={};return F.forEach(z=>{var ae=z.operation,$=z.selected,re=z.invert;L[ae]=Jt.getOperationColumnNames(g,ae,$,re)}),L},{max:1})),A(this,"getOperationMap",ne((g,F)=>le.getOperationMap(g,F),{max:1})),A(this,"getOperationOrder",ne(g=>le.getOperationOrder(g),{max:1})),A(this,"getCachedFormatColumns",ne((g,F,L)=>is(g,F,L),{max:1e3})),A(this,"getCachedPreviewFormatColumns",ne((g,F,L,z,ae)=>{if(N.debug("getCachedPreviewFormatColumns",L,z,ae),z!==void 0&&ae!==void 0){var $=[...L];return $[ae]=z,this.getCachedFormatColumns(g,F,$)}return this.getCachedFormatColumns(g,F,L)},{max:1})),A(this,"getModelRollupConfig",ne((g,F,L)=>le.getModelRollupConfig(g,F,L),{max:1})),A(this,"getModelTotalsConfig",ne((g,F,L)=>le.getModelTotalsConfig(g,F,L),{max:1})),A(this,"getCachedStateOverride",ne((g,F,L,z,ae,$,re,ge,ue,Ce,_e,Ze)=>({model:g,theme:F,hoverSelectColumn:L,isFilterBarShown:z,isSelectingColumn:ae,loadingScrimProgress:$,quickFilters:re,advancedFilters:ge,sorts:ue,reverse:Ce,rollupConfig:_e,isMenuShown:Ze}),{max:1})),A(this,"getCachedFilter",ne((g,F,L,z)=>[...g??[],...le.getFiltersFromFilterMap(F),...le.getFiltersFromFilterMap(L),...z!==void 0?[z]:[]],{max:1})),A(this,"getCachedTheme",ne((g,F,L,z,ae)=>{var $,re=g??Br(),ge=z>0?($=F==null?void 0:F.rowFooterWidth)!==null&&$!==void 0?$:re.rowFooterWidth:0,ue=this.state.metricCalculator;ue!=null&&(ue.resetCalculatedColumnWidths(),ue.resetCalculatedRowHeights());var Ce={};return ae==="compact"?Ce=re.density.compact:ae==="spacious"&&(Ce=re.density.spacious),se(se(se(se({},re),Ce),F),{},{autoSelectRow:!L,rowFooterWidth:ge})},{max:1})),A(this,"getCachedKeyHandlers",ne(g=>[...g,...this.keyHandlers].sort((F,L)=>F.order-L.order),{max:1})),A(this,"getCachedMouseHandlers",ne(g=>[...g,...this.mouseHandlers].map(F=>typeof F=="function"?F(this):F),{max:1})),A(this,"getCachedRenderer",ne(g=>g??new Hr,{max:1})),A(this,"getAlwaysFetchColumns",ne((g,F,L,z,ae,$)=>{for(var re=[],ge=0;ge<z;ge+=1)re.push(F[Ee.getModelIndex(ge,L)].name);for(var ue=0;ue<ae;ue+=1)re.push(F[Ee.getModelIndex(F.length-1-ue,L)].name);if($)for(var Ce=$[0];Ce<=$[1];Ce+=1)re.push(F[Ee.getModelIndex(Ce,L)].name);var _e=new Set([...g,...re]);return Object.freeze([..._e])},{max:1})),A(this,"updateSearchFilter",ut((g,F,L,z)=>{var ae=this.props.model,$=At.createSearchFilter(ae.dh,g,F,L,z);this.setState({searchFilter:$})},Ld)),A(this,"showViewportLoading",qn(()=>{var g=this.props.model,F=this.state.loadingSpinnerShown;g.isViewportPending&&!F&&this.startLoading("Waiting for viewport...",{loadingCancelShown:!1,loadingBlocksGrid:!1})},Id,{leading:!1,trailing:!0})),A(this,"handleConditionalFormatEditorUpdate",ut(g=>{this.setState({conditionalFormatPreview:g})},Pd)),A(this,"handleDownloadProgressUpdate",qn((g,F)=>{var L=this.state.tableDownloadStatus;L===ke.DOWNLOAD_STATUS.DOWNLOADING&&this.setState({tableDownloadProgress:g,tableDownloadEstimatedTime:F})},Dd)),A(this,"getOverflowButtonTooltip",ne(g=>{if(g==null)return null;var F=se(se({position:"absolute"},g),{},{pointerEvents:"none"}),L={placement:"left",modifiers:{flip:{behavior:["left","right"]}}};return s.jsx("div",{style:F,children:s.jsx(De,{options:L,ref:this.handleTooltipRef,children:"View full contents"},Date.now())})},{max:1})),A(this,"getExpandCellTooltip",ne(g=>{if(g==null)return null;var F=this.state.expandTooltipDisplayValue,L=this.props.model,z=hn(L)&&L.isExpandAllAvailable,ae=se(se({position:"absolute"},g),{},{pointerEvents:"none"}),$={placement:"bottom-start"};return s.jsx("div",{style:ae,children:s.jsx(De,{options:$,ref:this.handleTooltipRef,children:s.jsxs("div",{style:{textAlign:"left"},children:["Click to ",F," row",z&&s.jsxs(s.Fragment,{children:[s.jsx("br",{}),mt.isMacPlatform()?"⌘":"Ctrl+","Click to expand row and all children"]})]})},Date.now())})},{max:1})),A(this,"getHoverTooltip",ne(g=>{if(g==null)return null;var F=this.state.hoverDisplayValue,L=se(se({position:"absolute"},g),{},{pointerEvents:"none"}),z={placement:"bottom"};return s.jsx("div",{style:L,children:s.jsx(De,{options:z,ref:this.handleTooltipRef,children:s.jsx("div",{className:"link-hover-tooltip",children:F})})})},{max:1})),A(this,"handleGotoValueChanged",g=>{this.setState({gotoValue:g,gotoValueManuallyChanged:!0}),this.debouncedSeekRow(g)}),A(this,"debouncedSeekRow",ut(g=>{this.seekRow(g)},jd)),this.handleAdvancedFilterChange=this.handleAdvancedFilterChange.bind(this),this.handleAdvancedFilterSortChange=this.handleAdvancedFilterSortChange.bind(this),this.handleAdvancedFilterDone=this.handleAdvancedFilterDone.bind(this),this.handleAdvancedFilterToggleMaximize=this.handleAdvancedFilterToggleMaximize.bind(this),this.handleAdvancedMenuOpened=this.handleAdvancedMenuOpened.bind(this),this.handleGotoRowOpened=this.handleGotoRowOpened.bind(this),this.handleGotoRowClosed=this.handleGotoRowClosed.bind(this),this.handleAdvancedMenuClosed=this.handleAdvancedMenuClosed.bind(this),this.handleAggregationChange=this.handleAggregationChange.bind(this),this.handleAggregationsChange=this.handleAggregationsChange.bind(this),this.handleAggregationEdit=this.handleAggregationEdit.bind(this),this.handleAnimationLoop=this.handleAnimationLoop.bind(this),this.handleAnimationStart=this.handleAnimationStart.bind(this),this.handleAnimationEnd=this.handleAnimationEnd.bind(this),this.handleChartChange=this.handleChartChange.bind(this),this.handleChartCreate=this.handleChartCreate.bind(this),this.handleGridError=this.handleGridError.bind(this),this.handleFilterBarChange=this.handleFilterBarChange.bind(this),this.handleFilterBarDone=this.handleFilterBarDone.bind(this),this.handleFilterBarTab=this.handleFilterBarTab.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleMenu=this.handleMenu.bind(this),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleMenuSelect=this.handleMenuSelect.bind(this),this.handleMenuBack=this.handleMenuBack.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handlePending=this.handlePending.bind(this),this.handlePendingCleared=this.handlePendingCleared.bind(this),this.handleSelectionChanged=this.handleSelectionChanged.bind(this),this.handleMovedColumnsChanged=this.handleMovedColumnsChanged.bind(this),this.handleHeaderGroupsChanged=this.handleHeaderGroupsChanged.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.handleTableChanged=this.handleTableChanged.bind(this),this.handleSchemaChanged=this.handleSchemaChanged.bind(this),this.handleTooltipRef=this.handleTooltipRef.bind(this),this.handleViewChanged=this.handleViewChanged.bind(this),this.handleFormatSelection=this.handleFormatSelection.bind(this),this.handleColumnAlignmentChange=this.handleColumnAlignmentChange.bind(this),this.handleConditionalFormatCreate=this.handleConditionalFormatCreate.bind(this),this.handleConditionalFormatEdit=this.handleConditionalFormatEdit.bind(this),this.handleConditionalFormatsChange=this.handleConditionalFormatsChange.bind(this),this.handleConditionalFormatEditorSave=this.handleConditionalFormatEditorSave.bind(this),this.handleConditionalFormatEditorCancel=this.handleConditionalFormatEditorCancel.bind(this),this.handleUpdateCustomColumns=this.handleUpdateCustomColumns.bind(this),this.handleCustomColumnsChanged=this.handleCustomColumnsChanged.bind(this),this.handleSelectDistinctChanged=this.handleSelectDistinctChanged.bind(this),this.handlePendingDataUpdated=this.handlePendingDataUpdated.bind(this),this.handleViewportUpdated=this.handleViewportUpdated.bind(this),this.handlePendingCommitClicked=this.handlePendingCommitClicked.bind(this),this.handlePendingDiscardClicked=this.handlePendingDiscardClicked.bind(this),this.handleGotoRowSelectedRowNumberSubmit=this.handleGotoRowSelectedRowNumberSubmit.bind(this),this.focusRowInGrid=this.focusRowInGrid.bind(this),this.handleDownloadTable=this.handleDownloadTable.bind(this),this.handleDownloadTableStart=this.handleDownloadTableStart.bind(this),this.handleCancelDownloadTable=this.handleCancelDownloadTable.bind(this),this.handleDownloadCanceled=this.handleDownloadCanceled.bind(this),this.handleDownloadCompleted=this.handleDownloadCompleted.bind(this),this.handlePartitionChange=this.handlePartitionChange.bind(this),this.handleColumnVisibilityChanged=this.handleColumnVisibilityChanged.bind(this),this.handleColumnVisibilityReset=this.handleColumnVisibilityReset.bind(this),this.handleCrossColumnSearch=this.handleCrossColumnSearch.bind(this),this.handleRollupChange=this.handleRollupChange.bind(this),this.handleOverflowClose=this.handleOverflowClose.bind(this),this.handleCloseNoPastePermissionModal=this.handleCloseNoPastePermissionModal.bind(this),this.getColumnBoundingRect=this.getColumnBoundingRect.bind(this),this.handleGotoRowSelectedRowNumberChanged=this.handleGotoRowSelectedRowNumberChanged.bind(this),this.handleGotoValueSelectedColumnNameChanged=this.handleGotoValueSelectedColumnNameChanged.bind(this),this.handleGotoValueSelectedFilterChanged=this.handleGotoValueSelectedFilterChanged.bind(this),this.handleGotoValueChanged=this.handleGotoValueChanged.bind(this),this.handleGotoValueSubmitted=this.handleGotoValueSubmitted.bind(this),this.handleViewportUpdated=this.handleViewportUpdated.bind(this),this.makeQuickFilter=this.makeQuickFilter.bind(this),this.setFilterMap=this.setFilterMap.bind(this),this.handleFrozenColumnsChanged=this.handleFrozenColumnsChanged.bind(this),this.grid=null,this.lastLoadedConfig=null,this.pending=new Ui,this.globalColumnFormats=de,this.decimalFormatOptions={},this.integerFormatOptions={},this.truncateNumbersWithPound=!1,this.showEmptyStrings=!0,this.showNullStrings=!0,this.showExtraGroupColumn=!0,this.tableSaver=null,this.crossColumnRef=Oe.createRef(),this.isAnimating=!1,this.filterInputRef=Oe.createRef(),this.gotoRowRef=Oe.createRef(),this.isCopying=!1,this.toggleFilterBarAction={action:()=>this.toggleFilterBar(),shortcut:$e.TABLE.TOGGLE_QUICK_FILTER},this.toggleSearchBarAction={action:()=>this.toggleSearchBar(),shortcut:$e.TABLE.TOGGLE_SEARCH},this.toggleGotoRowAction={action:()=>this.toggleGotoRow(),shortcut:$e.TABLE.GOTO_ROW},this.discardAction={action:()=>{var g=this.props.model;Re(g)&&g.isEditable&&g.pendingDataMap.size>0&&this.discardPending().catch(N.error)},shortcut:$e.INPUT_TABLE.DISCARD},this.commitAction={action:()=>{var g=this.props.model;Re(g)&&g.isEditable&&g.pendingDataMap.size>0&&g.pendingDataErrors.size===0&&this.commitPending().catch(N.error)},shortcut:$e.INPUT_TABLE.COMMIT},this.contextActions=[this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,this.discardAction,this.commitAction];var o=e.aggregationSettings,r=e.conditionalFormats,d=e.customColumnFormatMap,l=e.columnAlignmentMap,u=e.isFilterBarShown,c=e.isSelectingPartition,m=e.partitions,v=e.partitionConfig,h=e.model,f=e.movedColumns,C=e.movedRows,S=e.rollupConfig,y=e.userColumnWidths,E=e.userColumnWidthsByName,D=e.userRowHeights,_=e.showSearchBar,O=e.searchValue,p=e.selectedSearchColumns,B=e.invertSearchColumns,w=e.advancedFilters,P=e.quickFilters,j=e.selectDistinctColumns,Q=e.pendingDataMap,x=e.canCopy,I=e.frozenColumns,M=e.columnHeaderGroups,J=e.getMetricCalculator,U=h.dh,X=[new Ts(this),new Os(this),new Ls(this)],V=[new Wr(this),new zr(this),new qr(this),new Kr(this),new Qr(this),new Yr(this),new Xr(this),new Zr(this,U),new Jr(this),new eo(this),new to(this),...x?[new no(this)]:[]];x&&X.push(new Fs(this));var he=f.length>0?f:h.initialMovedColumns,Fe=C.length>0?C:h.initialMovedRows,ee=J({userColumnWidths:new Map(y),userColumnWidthsByName:E!=null?new Map(E):void 0,userRowHeights:new Map(D),movedColumns:he,initialColumnWidths:new Map(h==null||(t=h.layoutHints)===null||t===void 0||(t=t.hiddenColumns)===null||t===void 0?void 0:t.map(g=>[h.getColumnIndexByName(g),0]))});this.lastMetricCalculatorFactory=J;var te=p??[],Ge=At.createSearchFilter(U,O,te,h.columns,B);this.tableUtils=new T(U),this.mouseHandlers=V,this.keyHandlers=X,this.state={isFilterBarShown:u,isSelectingPartition:c,focusedFilterBarColumn:null,metricCalculator:ee,metrics:void 0,partitionConfig:v??(m&&m.length?{partitions:m,mode:"partition"}:void 0),quickFilters:P?new Map(P):new Map,advancedFilters:new Map(w),shownAdvancedFilter:null,maximizedAdvancedFilter:null,hoverAdvancedFilter:null,sorts:[],reverse:!1,customColumns:[],selectDistinctColumns:j,selectedRanges:[],copyOperation:null,loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,loadingCancelShown:!1,loadingBlocksGrid:!1,movedColumns:he,movedRows:Fe,shownColumnTooltip:null,formatter:new Zt(U),isMenuShown:!1,customColumnFormatMap:new Map(d),columnAlignmentMap:new Map(l),conditionalFormats:r,conditionalFormatEditIndex:null,conditionalFormatPreview:void 0,hoverSelectColumn:null,isTableDownloading:!1,isReady:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:0,showSearchBar:_,searchFilter:Ge,searchValue:O,selectedSearchColumns:te,invertSearchColumns:B,rollupConfig:S,rollupSelectedColumns:[],aggregationSettings:Re(h)&&h.isEditable?se(se({},o),{},{showOnTop:!0}):o,selectedAggregation:null,openOptions:[],pendingRowCount:0,pendingDataMap:Q??new Map,pendingDataErrors:new Map,pendingSavePromise:null,pendingSaveError:null,toastMessage:null,frozenColumns:I,showOverflowModal:!1,showNoPastePermissionModal:!1,noPastePermissionError:"",overflowText:"",overflowButtonTooltipProps:null,expandCellTooltipProps:null,expandTooltipDisplayValue:"expand",hoverTooltipProps:null,hoverDisplayValue:"",isGotoShown:!1,gotoRow:"",gotoRowError:"",gotoValueError:"",gotoValueSelectedColumnName:(i=(a=h.columns[0])===null||a===void 0?void 0:a.name)!==null&&i!==void 0?i:"",gotoValueSelectedFilter:Te.eqIgnoreCase,gotoValue:"",gotoValueManuallyChanged:!1,columnHeaderGroups:M??h.initialColumnHeaderGroups}}componentDidMount(){var e=this.props.model;this.initState(),this.startListening(e)}componentDidUpdate(e,t){var i=this.props,a=i.inputFilters,o=i.isSelectingColumn,r=i.settings,d=i.model,l=i.customFilters,u=i.sorts,c=i.getMetricCalculator;d!==e.model&&(this.stopListening(e.model),this.startListening(d)),c!==e.getMetricCalculator&&this.maybeRebuildMetricCalculator();var m=a!==e.inputFilters?a.filter(_=>!e.inputFilters.includes(_)):[];if(m.length>0){var v,h=this.props.advancedSettings,f=(v=h.get(Rt.FILTER_CONTROL_CHANGE_CLEARS_ALL_FILTERS))!==null&&v!==void 0?v:!1;f&&(this.clearGridInputField(),this.clearCrossColumSearch());var C=this.applyInputFilters(m,f);C&&this.startLoading("Filtering...",{resetRanges:!0})}o!==e.isSelectingColumn&&this.resetColumnSelection(),r!==e.settings&&this.updateFormatterSettings(r),l!==e.customFilters&&this.startLoading("Filtering...",{resetRanges:!0}),u!==e.sorts&&this.updateSorts(u);var S=this.loadingScrimStartTime,y=this.loadingScrimFinishTime;S!=null&&y!=null&&window.requestAnimationFrame(()=>{var _=Date.now(),O=_-S,p=y-S,B=Math.min(O/p,1);y<_&&(this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0),this.setState(w=>w.loadingScrimProgress==null?(N.debug2("Ignoring scrim update because loading cancelled."),null):{loadingScrimProgress:B})});var E=this.state.openOptions;if(E!==t.openOptions){var D=_=>_.type===Z.AGGREGATION_EDIT;!E.some(D)&&t.openOptions.some(D)&&this.removeEmptyAggregations()}this.sendStateChange()}componentWillUnmount(){var e=this.props.model;this.stopListening(e),this.pending.cancel(),this.updateSearchFilter.cancel(),this.loadingTimer&&clearTimeout(this.loadingTimer),this.handleDownloadProgressUpdate.cancel(),this.animationFrame!==void 0&&cancelAnimationFrame(this.animationFrame),this.showViewportLoading.cancel()}get gridWrapper(){var e,t;return(e=(t=this.grid)===null||t===void 0?void 0:t.canvasWrapper.current)!==null&&e!==void 0?e:null}getKeyHandlers(){var e=this.props.keyHandlers;return this.getCachedKeyHandlers(e)}getMetricState(){var e,t=(e=this.grid)===null||e===void 0?void 0:e.getMetricState();if(t!=null){var i=this.state,a=i.advancedFilters,o=i.hoverSelectColumn,r=i.isFilterBarShown,d=i.isMenuShown,l=i.loadingScrimProgress,u=i.quickFilters,c=i.sorts,m=i.reverse,v=i.rollupConfig,h=this.props,f=h.model,C=h.isSelectingColumn;return se(se({},t),this.getCachedStateOverride(f,this.getTheme(),o,r,C,l,u,a,c,m,v,d))}}get renderer(){var e=this.props.renderer;return this.getCachedRenderer(e)}getMouseHandlers(){var e=this.props.mouseHandlers;return this.getCachedMouseHandlers(e)}getValueForCell(e,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=this.props.model,o=a.dh,r=this.getModelColumn(e),d=this.getModelRow(t);if(i&&r!=null&&d!=null){var l=a.valueForCell(r,d);if(T.isDateType(a.columns[r].type)){var u=a.formatter;return o.i18n.DateTimeFormat.format(Md,l,o.i18n.TimeZone.getTimeZone(u.timeZone))}return l}return i?null:r!=null&&d!=null?a.textForCell(r,d):""}getModelColumn(e){var t=this.state.metrics;W(t);var i=t.modelColumns;return i==null?null:e!=null&&e<0?e:e!=null?i.get(e):null}getModelRow(e){var t=this.state.metrics;W(t);var i=t.modelRows;return i==null?null:e!=null?i.get(e):null}getTheme(){var e,t=this.props,i=t.model,a=t.theme,o=t.density,r=this.context,d=r.theme,l=r.density;return this.getCachedTheme(d,a,(e=Re(i)&&i.isEditable)!==null&&e!==void 0?e:!1,i.floatingTopRowCount+i.floatingBottomRowCount,o??l)}getVisibleColumn(e){var t=this.state.movedColumns;return Ee.getVisibleIndex(e,t)}makeQuickFilter(e,t,i){try{return this.tableUtils.makeQuickFilter(e,t,i)}catch(a){N.error("Error creating quick filter",a)}return null}applyInputFilters(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=this.props.model,a=this.state,o=a.advancedFilters,r=a.quickFilters,d=t?new Map:new Map(o),l=t?new Map:new Map(r),u=t&&o.size>0;return e.forEach(c=>{var m=c.name,v=c.type,h=c.value,f=i.columns.findIndex(C=>{var S=C.name,y=C.type;return S===m&&y===v});f>=0?(u=d.delete(f)||u,u=this.applyQuickFilter(f,h,l)||u):N.error("Unable to find column for inputFilter",m,v,h)}),u&&this.setState({quickFilters:l,advancedFilters:d}),u}applyQuickFilter(e,t,i){var a=this.props.model,o=a.formatter,r=a.columns[e];if(t!=null&&"".concat(t).trim().length>0){var d=i.get(e);if(d!=null){var l=d.text;if(l===t)return N.debug2("Ignoring change to existing filter"),!1}return i.set(e,{text:t,filter:this.makeQuickFilter(r,t,o.timeZone)}),!0}return i.delete(e)}setAdvancedFilterMap(e){this.setState({advancedFilters:e})}setAdvancedFilter(e,t,i){N.debug("Setting advanced filter",e,t),this.startLoading("Filtering...",{resetRanges:!0}),this.setState(a=>{var o=a.advancedFilters,r=new Map(o);return t==null?r.delete(e):r.set(e,{filter:t,options:i}),{advancedFilters:r}})}setQuickFilter(e,t,i){N.debug("Setting quick filter",e,t,i),this.startLoading("Filtering...",{resetRanges:!0}),this.setState(a=>{var o=a.quickFilters,r=new Map(o);return r.set(e,{filter:t,text:i}),{quickFilters:r}})}setFilterMap(e){var t;N.debug("setFilterMap",e);var i=this.props.advancedSettings,a=(t=i.get(Rt.LINK_CHANGE_CLEARS_ALL_FILTERS))!==null&&t!==void 0?t:!1;a&&this.clearAllFilters();var o=this.props.model;e.forEach((r,d)=>{var l=r.columnType,u=r.filterList,c=o.columns.find(f=>f.name===d&&f.type===l);if(c!=null){var m=o.getColumnIndexByName(c.name);W(m);var v=le.combineFiltersFromList(l,u);if(v.length===0)this.removeQuickFilter(m);else{var h=o.formatter;this.setQuickFilter(m,this.makeQuickFilter(c,v,h.timeZone),"".concat(v))}}})}removeColumnFilter(e){this.startLoading("Filtering...",{resetRanges:!0});var t=Array.isArray(e)?e:[e,e];this.setState(i=>{var a=i.advancedFilters,o=i.quickFilters,r=a?new Map(a):new Map,d=o?new Map(o):new Map;return r.forEach((l,u)=>{u>=t[0]&&u<=t[1]&&r.delete(u)}),d.forEach((l,u)=>{u>=t[0]&&u<=t[1]&&d.delete(u)}),{quickFilters:d,advancedFilters:r}})}removeQuickFilter(e){this.startLoading("Clearing Filter...",{resetRanges:!0}),this.setState(t=>{var i=t.quickFilters,a=new Map(i);return a.delete(e),{quickFilters:a}})}clearAllFilters(){N.debug("Clearing all filters");var e=this.state,t=e.advancedFilters,i=e.quickFilters,a=e.searchFilter;i.size===0&&t.size===0&&a===null||(this.clearGridInputField(),this.startLoading("Clearing Filters...",{resetRanges:!0}),this.setState({quickFilters:new Map,advancedFilters:new Map,searchValue:"",searchFilter:void 0}))}clearAllAggregations(){N.debug("Clearing all aggregations"),this.setState({aggregationSettings:gn})}clearCrossColumSearch(){N.debug("Clearing cross-column search"),this.setState({searchValue:"",searchFilter:void 0})}clearGridInputField(){this.filterInputRef.current!=null&&this.filterInputRef.current.setValue("")}rebuildFilters(){var e=this.props.model,t=this.state,i=t.advancedFilters,a=t.quickFilters;if(i.size===0&&a.size===0){N.debug("No filters to rebuild");return}var o=e.columns,r=e.formatter;N.debug("Rebuilding filters");var d=new Map,l=new Map;i.forEach((u,c)=>{var m=u.options,v=o[c],h=this.tableUtils.makeAdvancedFilter(v,m,r.timeZone);d.set(c,{options:m,filter:h})}),a.forEach((u,c)=>{var m=u.text,v=o[c];l.set(c,{text:m,filter:this.makeQuickFilter(v,m,r.timeZone)})}),this.startLoading("Rebuilding filters...",{resetRanges:!0}),this.setState({quickFilters:l,advancedFilters:d})}setFilters(e){var t=e.quickFilters,i=e.advancedFilters;this.setState({quickFilters:t,advancedFilters:i})}updateFormatterSettings(e){var t,i,a,o,r,d,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,u=ei.getColumnFormats(e),c=ei.getDateTimeFormatterOptions(e),m=(t=e==null?void 0:e.defaultDecimalFormatOptions)!==null&&t!==void 0?t:{},v=(i=e==null?void 0:e.defaultIntegerFormatOptions)!==null&&i!==void 0?i:{},h=(a=e==null?void 0:e.truncateNumbersWithPound)!==null&&a!==void 0?a:!1,f=(o=e==null?void 0:e.showEmptyStrings)!==null&&o!==void 0?o:!0,C=(r=e==null?void 0:e.showNullStrings)!==null&&r!==void 0?r:!0,S=(d=e==null?void 0:e.showExtraGroupColumn)!==null&&d!==void 0?d:!0,y=!Ve(this.globalColumnFormats,u),E=!Ve(this.dateTimeFormatterOptions,c),D=!Ve(this.decimalFormatOptions,e==null?void 0:e.defaultDecimalFormatOptions),_=!Ve(this.integerFormatOptions,v),O=this.truncateNumbersWithPound!==h,p=this.showEmptyStrings!==f,B=this.showNullStrings!==C,w=this.showExtraGroupColumn!==S;(y||E||D||_||O||p||B||w)&&(this.globalColumnFormats=u,this.dateTimeFormatterOptions=c,this.decimalFormatOptions=m,this.integerFormatOptions=v,this.truncateNumbersWithPound=h,this.showEmptyStrings=f,this.showNullStrings=C,this.showExtraGroupColumn=S,this.updateFormatter({},l),E&&l&&this.rebuildFilters())}updateFormatter(e){var t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this.state.customColumnFormatMap,o=this.props.model,r=se({customColumnFormatMap:a},e),d=[...(t=this.globalColumnFormats)!==null&&t!==void 0?t:[],...r.customColumnFormatMap.values()],l=new Zt(o.dh,d,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions,this.truncateNumbersWithPound,this.showEmptyStrings,this.showNullStrings);N.debug("updateFormatter",this.globalColumnFormats,d),this.setState(se(se({},r),{},{formatter:l}),()=>{i&&this.grid&&this.grid.forceUpdate()})}initFormatter(){var e=this.props.settings;this.updateFormatterSettings(e)}initState(){var e=this.props.model;try{lt(e)&&e.isPartitionRequired?this.loadPartitionsTable(e):this.loadTableState()}catch(t){this.handleTableLoadError(t)}}loadTableState(){var e=this.props,t=e.applyInputFiltersOnInit,i=e.inputFilters,a=e.sorts,o=e.model,r=e.reverse,d=e.reverseType,l=e.customColumns,u=e.searchValue,c=e.selectedSearchColumns,m=e.invertSearchColumns,v=c??[],h=At.createSearchFilter(o.dh,u,v,o.columns,m);if(t){var f=i.filter(C=>C.value!=null);this.applyInputFilters(f)}this.setState({sorts:a,reverse:r||d===T.REVERSE_TYPE.POST_SORT,customColumns:l,isReady:!0,searchFilter:h}),this.initFormatter()}loadPartitionsTable(e){var t=this;return st(function*(){try{var i=t.state.partitionConfig;i||(t.startLoading("Loading partitions...",{loadingCancelShown:!1,resetRanges:!0}),t.initializePartitionConfig(e)),t.setState({isSelectingPartition:!0},t.loadTableState)}catch(a){Ae.isCanceled(a)||t.handleTableLoadError(a)}})()}initializePartitionConfig(e){var t=this;return st(function*(){var i=yield t.pending.add(e.partitionKeysTable(),r=>r.close()),a=e.dh,o=i.columns.map(r=>r.sort().desc());i.applySort(o),i.setViewport(0,0),i.addEventListener(a.Table.EVENT_UPDATED,r=>{try{var d=r.detail;if(d.rows.length===0){t.stopLoading();return}var l=d.rows[0],u=i.columns.map(m=>l.get(m)),c={partitions:u,mode:e.isPartitionAwareSourceTable?"partition":"keys"};i.close(),t.setState({loadingSpinnerShown:!1,partitionConfig:c})}catch(m){i.close(),N.error("Error getting initial partition config",m)}})})()}selectPartitionKeyFromTable(e){var t=this.props.model;if(W(e),lt(t)){var i=this.getRowDataMap(e),a=new Set(t.partitionColumns.map(d=>d.name)),o=Object.entries(i).filter(d=>{var l=Ke(d,2),u=l[0];return l[1],a.has(u)}).map(d=>{var l=Ke(d,2);l[0];var u=l[1];return u.value}),r={partitions:o,mode:"partition"};this.setState({isSelectingPartition:!0,partitionConfig:r})}}copyCell(e,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=this.props.canCopy;if(a){var o=String(this.getValueForCell(e,t,i));Pi(o).catch(r=>N.error("Unable to copy cell",r))}else N.error("Attempted to copyCell for user without copy permission.")}copyColumnHeader(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(e!==null){var i=this.props.canCopy,a=this.state.movedColumns;if(i){var o={columnIndex:e,columnDepth:t,movedColumns:a};this.setState({copyOperation:o})}else N.error("Attempted copyColumnHeader for user without copy permission.")}}copyRanges(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3?arguments[3]:void 0,o=this.props,r=o.model,d=o.canCopy,l=this.state,u=l.metricCalculator,c=l.movedColumns,m=u.getUserColumnWidths();if(d){var v={ranges:Xe.boundedRanges(e,r.columnCount,r.rowCount),includeHeaders:t,formatValues:i,movedColumns:c,userColumnWidths:m,error:a};this.setState({copyOperation:v})}else N.error("Attempted copyRanges for user without copy permission.")}startLoading(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=t.resetRanges,a=i===void 0?!1:i,o=t.loadingCancelShown,r=o===void 0?!0:o,d=t.loadingBlocksGrid,l=d===void 0?!0:d;this.setState({loadingText:e,loadingCancelShown:r,loadingBlocksGrid:l});var u=this.getTheme();if(a&&this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({top:0},!0)),this.loadingScrimStartTime==null){var c,m,v=u.minScrimTransitionTime,h=u.maxScrimTransitionTime;W(v),W(h);var f=(c=(m=this.gridWrapper)===null||m===void 0?void 0:m.getBoundingClientRect().height)!==null&&c!==void 0?c:0,C=Math.max(v,Math.min(f/2,h));this.loadingScrimStartTime=Date.now(),this.loadingScrimFinishTime=this.loadingScrimStartTime+C,this.setState({loadingScrimProgress:0}),this.loadingTimer=setTimeout(()=>{this.setState({loadingSpinnerShown:!0})},Ie.loadingSpinnerDelay)}}stopLoading(){this.showViewportLoading.cancel(),this.loadingScrimStartTime=void 0,this.loadingScrimFinishTime=void 0,this.setState({loadingText:null,loadingScrimProgress:null,loadingSpinnerShown:!1,loadingCancelShown:!1}),this.loadingTimer!=null&&(clearTimeout(this.loadingTimer),this.loadingTimer=void 0)}rollback(){if(this.lastLoadedConfig){N.debug("loading last loading config",this.lastLoadedConfig);var e=this.lastLoadedConfig,t=e.advancedFilters,i=e.aggregationSettings,a=e.customColumns,o=e.quickFilters,r=e.reverse,d=e.rollupConfig,l=e.searchFilter,u=e.selectDistinctColumns,c=e.sorts;this.lastLoadedConfig=null,this.setState({advancedFilters:t,aggregationSettings:i,customColumns:a,quickFilters:o,reverse:r,rollupConfig:d,searchFilter:l,selectDistinctColumns:u,sorts:c})}else N.debug("remove all sorts, filters, and custom columns"),this.setState({advancedFilters:new Map,aggregationSettings:gn,customColumns:[],quickFilters:new Map,reverse:!1,rollupConfig:void 0,selectDistinctColumns:[],sorts:[]})}canRollback(){return this.lastLoadedConfig!=null||!Ni(this.state)}startListening(e){e.addEventListener(me.EVENT.UPDATED,this.handleUpdate),e.addEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.addEventListener(me.EVENT.PENDING,this.handlePending),e.addEventListener(me.EVENT.PENDING_CLEARED,this.handlePendingCleared),e.addEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.addEventListener(me.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated),e.addEventListener(me.EVENT.VIEWPORT_UPDATED,this.handleViewportUpdated),e.addEventListener(me.EVENT.TABLE_CHANGED,this.handleTableChanged),e.addEventListener(me.EVENT.SCHEMA_CHANGED,this.handleSchemaChanged)}stopListening(e){e.removeEventListener(me.EVENT.UPDATED,this.handleUpdate),e.removeEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed),e.removeEventListener(me.EVENT.PENDING,this.handlePending),e.removeEventListener(me.EVENT.PENDING_CLEARED,this.handlePendingCleared),e.removeEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnsChanged),e.removeEventListener(me.EVENT.PENDING_DATA_UPDATED,this.handlePendingDataUpdated),e.removeEventListener(me.EVENT.VIEWPORT_UPDATED,this.handleViewportUpdated),e.removeEventListener(me.EVENT.TABLE_CHANGED,this.handleTableChanged),e.removeEventListener(me.EVENT.SCHEMA_CHANGED,this.handleSchemaChanged)}focus(){var e;(e=this.grid)===null||e===void 0||e.focus()}focusFilterBar(e){var t=this.state.movedColumns,i=this.props.model,a=i.columnCount,o=Ee.getModelIndex(e,t);if(e==null||a<=e||!i.isFilterable(o)){this.setState({focusedFilterBarColumn:null});return}var r=this.state,d=r.metricCalculator,l=r.metrics;W(l);var u=this.getMetricState();W(u);var c=d.getScrollLeftForColumn(e,u,l);if(c!=null){var m;(m=this.grid)===null||m===void 0||m.setViewState({left:c,leftOffset:0},!0)}this.lastFocusedFilterBarColumn=e,this.setState({focusedFilterBarColumn:e,isFilterBarShown:!0})}hideColumnByVisibleIndex(e){var t,i=this.state,a=i.metricCalculator,o=i.movedColumns;a.setColumnWidth(Ee.getModelIndex(e,o),0),(t=this.grid)===null||t===void 0||t.forceUpdate()}freezeColumnByColumnName(e){var t=this.state,i=t.frozenColumns,a=t.movedColumns,o=this.props.model;N.debug2("freezing column",e);var r=i==null?new Set(o.frozenColumns):new Set(i);r.add(e);var d=o.getColumnIndexByName(e);W(d);var l=Ee.getVisibleIndex(d,a),u=Ee.moveItem(l,r.size-1,a);this.setState({frozenColumns:[...r],movedColumns:u})}unFreezeColumnByColumnName(e){var t=this.state,i=t.frozenColumns,a=t.movedColumns,o=this.props.model;N.debug2("unfreezing column",e);var r=i==null?new Set(o.frozenColumns):new Set(i);r.delete(e);var d=o.getColumnIndexByName(e);W(d);var l=Ee.getVisibleIndex(d,a),u=Ee.moveItem(l,r.size+o.frontColumns.length,a);this.setState({frozenColumns:[...r],movedColumns:u})}handleFrozenColumnsChanged(e){this.setState({frozenColumns:e})}toggleExpandColumn(e,t){N.debug2("Toggle expand column",e);var i=this.props.model;en(i)&&i.hasExpandableColumns&&i.setColumnExpanded(e,!i.isColumnExpanded(e),t)}expandAllColumns(){N.debug2("Expand all columns");var e=this.props.model;en(e)&&e.isExpandAllColumnsAvailable&&e.expandAllColumns()}collapseAllColumns(){N.debug2("Collapse all columns");var e=this.props.model;en(e)&&e.isExpandAllColumnsAvailable&&e.collapseAllColumns()}handleColumnVisibilityChanged(e,t){var i,a=this.state,o=a.metricCalculator,r=a.metrics;W(r),t?e.forEach(d=>{var l=o.initialColumnWidths.get(d),u=r.calculatedColumnWidths.get(d);l!==u&&u!=null?o.setColumnWidth(d,u):o.resetColumnWidth(d)}):e.forEach(d=>{o.setColumnWidth(d,0)}),(i=this.grid)===null||i===void 0||i.forceUpdate()}handleColumnVisibilityReset(){var e,t,i=this.state.metricCalculator,a=this.props.model;i.resetAllColumnWidths(),this.handleMovedColumnsChanged(a.initialMovedColumns),this.handleHeaderGroupsChanged(a.initialColumnHeaderGroups),this.setState({frozenColumns:(e=(t=a.layoutHints)===null||t===void 0?void 0:t.frozenColumns)!==null&&e!==void 0?e:de})}handleCrossColumnSearch(e,t,i){var a=this.props.model;this.startLoading("Searching..."),this.updateSearchFilter(e,t,a.columns,i),this.setState({searchValue:e,selectedSearchColumns:t,invertSearchColumns:i})}handleAnimationLoop(){var e;(e=this.grid)===null||e===void 0||e.updateCanvas(),this.isAnimating&&(this.animationFrame=requestAnimationFrame(this.handleAnimationLoop))}handleAnimationStart(){N.debug2("handleAnimationStart"),this.isAnimating=!0,this.animationFrame=requestAnimationFrame(this.handleAnimationLoop)}handleAnimationEnd(){N.debug2("handleAnimationEnd"),this.isAnimating=!1}handlePartitionChange(e){this.startLoading("Partitioning...");var t=this.state.partitionConfig;t!==e&&this.setState({partitionConfig:e})}handleTableLoadError(e){if(!Ae.isCanceled(e)){N.error(e);var t=this.props.onError;t(e)}}handleViewportUpdated(){var e=this.props.model,t=this.state,i=t.loadingText,a=t.loadingSpinnerShown,o="Waiting for viewport...";e.isViewportPending&&!a?this.showViewportLoading():i===o&&!e.isViewportPending&&this.stopLoading()}showAllColumns(){for(var e,t=this.state.metricCalculator,i=t.getUserColumnWidths(),a=[...i.entries()],o=0;o<a.length;o+=1){var r=Ke(a[o],2),d=r[0],l=r[1];l===0&&t.resetColumnWidth(d)}(e=this.grid)===null||e===void 0||e.forceUpdate()}updateMetrics(){var e;this.setState({metrics:(e=this.grid)===null||e===void 0?void 0:e.updateMetrics()})}toggleSort(e,t){N.info("Toggling sort for column",e);var i=this.props.model,a=this.getModelColumn(e);if(W(a),i.isColumnSortable(e)){var o=this.state.sorts,r=T.toggleSortForColumn(o,i.columns,a,t);this.updateSorts(r)}else N.debug("Column type was not sortable",i.columns[e])}updateSorts(e){var t;this.startLoading("Sorting..."),this.setState({sorts:e}),(t=this.grid)===null||t===void 0||t.forceUpdate()}sortColumn(e){var t,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:T.sortDirection.none,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;W(e);var r=this.props.model,d=T.sortColumn(r.sort,r.columns,e,i,a,o);this.startLoading("Sorting..."),this.setState({sorts:d}),(t=this.grid)===null||t===void 0||t.forceUpdate()}reverse(e){var t;this.startLoading("Reversing..."),this.setState({reverse:e}),(t=this.grid)===null||t===void 0||t.forceUpdate()}isReversible(){var e=this.props.model;return e.isReversible}toggleFilterBar(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.lastFocusedFilterBarColumn,t=this.state.isFilterBarShown;if(t=!t,this.setState({isFilterBarShown:t}),t)if(e!=null)this.focusFilterBar(e);else{for(var i=0,a=this.props.model,o=a.columnCount,r=0;r<o;r+=1){var d=this.getModelColumn(r);if(d!=null){var l=a.columns[d];if(l!=null&&T.isTextType(l.type)){i=r;break}}}this.focusFilterBar(i)}else{var u;(u=this.grid)===null||u===void 0||u.focus()}}isTableSearchAvailable(){var e,t,i,a=this.props,o=a.model,r=a.canToggleSearch,d=o.dh,l=o==null||(e=o.layoutHints)===null||e===void 0?void 0:e.searchDisplayMode;return l===((t=d.SearchDisplayMode)===null||t===void 0?void 0:t.SEARCH_DISPLAY_HIDE)?!1:l===((i=d.SearchDisplayMode)===null||i===void 0?void 0:i.SEARCH_DISPLAY_SHOW)?!0:r}toggleSearchBar(){var e=this.state.showSearchBar;if(this.isTableSearchAvailable()){var t=!e;this.setState({showSearchBar:t},()=>{var i;if(t&&(i=this.crossColumnRef)!==null&&i!==void 0&&i.current){var a;(a=this.crossColumnRef)===null||a===void 0||a.current.focus()}else{var o;(o=this.grid)===null||o===void 0||o.focus()}})}}toggleGotoRow(){var e,t,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",r=this.state.isGotoShown;if(i||a){var d;this.setState({isGotoShown:!0,gotoValue:a,gotoValueSelectedColumnName:o,gotoRowError:"",gotoValueError:"",gotoValueManuallyChanged:!1}),this.focusRowInGrid(i),(d=this.gotoRowRef.current)===null||d===void 0||d.focus();return}var l=(e=this.grid)===null||e===void 0?void 0:e.state.cursorRow,u=(t=this.grid)===null||t===void 0?void 0:t.state.cursorColumn;if(l==null||u==null){this.setState({isGotoShown:!r,gotoRow:"",gotoValue:"",gotoRowError:"",gotoValueError:"",gotoValueManuallyChanged:!1});return}var c=this.props.model,m=c.columns[u].name,v=String(this.getValueForCell(u,l,!0));this.setState({isGotoShown:!r,gotoRow:"".concat(l+1),gotoValue:v,gotoValueSelectedColumnName:m,gotoRowError:"",gotoValueError:"",gotoValueManuallyChanged:!1})}commitPending(){var e=this;return st(function*(){var t,i=e.props.model;if(!Re(i)||!i.isEditable)throw new Error("Cannot save, table is not editable");var a=e.state.pendingSavePromise;if(a!=null)throw new Error("Save already in progress");var o=(t=document)===null||t===void 0||(t=t.activeElement)===null||t===void 0?void 0:t.classList.contains("grid-cell-input-field");if(o!=null&&o){var r;if(document.activeElement!=null&&document.activeElement.classList.contains("error"))throw new Rr("Current input is invalid");(r=e.grid)===null||r===void 0||r.focus()}var d=e.pending.add(i.commitPending()).then(()=>{e.setState({pendingSaveError:null,pendingSavePromise:null})}).catch(l=>{Ae.isCanceled(l)||e.setState({pendingSaveError:l,pendingSavePromise:null})});return e.setState({pendingSavePromise:d}),d})()}discardPending(){var e=this;return st(function*(){var t=e.state.pendingSavePromise;if(t!=null)throw new Error("Cannot cancel a save in progress");e.setState({pendingSavePromise:null,pendingSaveError:null,pendingDataMap:new Map,pendingDataErrors:new Map})})()}selectColumn(e){var t=this.props.onColumnSelected;t(e)}selectData(e,t){var i=this.getRowDataMap(t),a=this.props.onDataSelected;a(t,i)}getRowDataMap(e){for(var t=this,i=this.props.model,a=i.columns,o=i.groupedColumns,r={},d=function(){var c=a[l],m=c.name,v=c.type,h=i.valueForCell(l,e),f=i.textForCell(l,e),C=t.getVisibleColumn(l),S=hn(i)&&i.isRowExpandable(e),y=o.find(E=>E.name===m)!=null;r[m]={value:h,text:f,type:v,isGrouped:y,isExpandable:S,visibleIndex:C}},l=0;l<a.length;l+=1)d();return r}handleAdvancedFilterChange(e,t,i){var a=this.props.model,o=a.getColumnIndexByName(e.name);W(o),this.setAdvancedFilter(o,t,i)}handleAdvancedFilterSortChange(e,t){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,o=this.props.model,r=o.getColumnIndexByName(e.name);W(r);var d=o.columns[r].name,l=T.getSortForColumn(o.sort,d),u=null;(l==null||l.direction!==t)&&(t===T.sortDirection.descending?u=e.sort().desc():u=e.sort().asc());var c=T.setSortForColumn(o.sort,d,u,a);N.info("Setting table sorts",c),this.startLoading("Sorting..."),this.setState({sorts:c}),(i=this.grid)===null||i===void 0||i.forceUpdate()}handleAdvancedFilterDone(){var e;(e=this.grid)===null||e===void 0||e.focus()}handleAdvancedFilterToggleMaximize(e){this.setState(t=>{var i=t.maximizedAdvancedFilter;return{maximizedAdvancedFilter:i===e?null:e}})}handleAdvancedMenuOpened(e){this.setState({shownAdvancedFilter:e,maximizedAdvancedFilter:null})}handleGotoRowOpened(){this.setState({isGotoShown:!0,gotoValueManuallyChanged:!1})}handleGotoRowClosed(){this.setState({isGotoShown:!1,gotoValueManuallyChanged:!1})}handleAdvancedMenuClosed(e){var t,i=this.state,a=i.focusedFilterBarColumn,o=i.isFilterBarShown;if(o&&a===e&&((t=this.filterInputRef)===null||t===void 0?void 0:t.current)!==null){var r;(r=this.filterInputRef)===null||r===void 0||r.current.focus(),this.setState({shownAdvancedFilter:null,maximizedAdvancedFilter:null})}else this.setState({focusedFilterBarColumn:null,shownAdvancedFilter:null,maximizedAdvancedFilter:null})}handleCancel(){this.rollback()}handleChartChange(){}handleChartCreate(e){var t=this.props,i=t.model,a=t.onCreateChart;a(e,i)}handleGridError(e){N.warn("Grid Error",e),this.setState({toastMessage:s.jsx("div",{className:"error-message",children:"".concat(e)})})}handleFilterBarChange(e){this.startLoading("Filtering...",{resetRanges:!0}),this.setState(t=>{var i=t.focusedFilterBarColumn,a=t.quickFilters,o=new Map(a);if(i!=null){var r=this.getModelColumn(i);W(r),this.applyQuickFilter(r,e,o)}return{quickFilters:o}})}handleFilterBarDone(){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){var i;(i=this.grid)===null||i===void 0||i.focus()}t&&this.setState({focusedFilterBarColumn:null})}handleFilterBarTab(e){var t=this.state.focusedFilterBarColumn;W(t),e?this.focusFilterBar(t-1):this.focusFilterBar(t+1)}handleFormatSelection(e,t){var i=this.props.model,a=i.columns[e],o=this.state.customColumnFormatMap,r=new Map(o);if(t!=null){var d=T.getNormalizedType(a.type);W(d);var l=Zt.makeColumnFormattingRule(d,a.name,t);r.set(a.name,l)}else r.delete(a.name);this.updateFormatter({customColumnFormatMap:r})}handleColumnAlignmentChange(e,t){var i=this.props.model,a=i.columns[e];this.setState(o=>{var r=o.columnAlignmentMap,d=r===void 0?Ne:r,l=new Map(d);return t!=null?l.set(a.name,t):l.delete(a.name),{columnAlignmentMap:l}})}handleMenu(e){e.stopPropagation(),this.setState({isMenuShown:!0})}handleMenuClose(){this.setState({isMenuShown:!1,openOptions:[]})}handleMenuBack(){this.setState(e=>{var t=e.openOptions,i=[...t];return i.pop(),{openOptions:i}})}handleMenuSelect(e){this.setState(t=>{var i=t.openOptions;return{openOptions:[...i,e]}})}handleRequestFailed(e){var t=e,i=t.detail;N.error("request failed:",i),this.stopLoading();var a=this.state.partitionConfig;if(kr(i)&&a!=null)this.startLoading("Reloading partition...",{resetRanges:!0}),this.setState({partitionConfig:void 0},()=>{this.initState()});else if(this.canRollback())this.startLoading("Rolling back changes...",{resetRanges:!0}),this.rollback();else{N.error("Table failed and unable to rollback");var o=this.props.onError;o(new Error("Error displaying table: ".concat(i)))}}handlePending(e){var t=e,i=t.detail,a=i??{},o=a.text,r=a.options;this.loadingScrimStartTime==null&&this.startLoading(o??"Loading...",se({loadingCancelShown:!1},r))}handlePendingCleared(){this.stopLoading()}handleUpdate(){var e;N.debug2("Received model update");var t=this.state,i=t.advancedFilters,a=t.aggregationSettings,o=t.customColumns,r=t.quickFilters,d=t.reverse,l=t.rollupConfig,u=t.searchFilter,c=t.selectDistinctColumns,m=t.sorts,v={advancedFilters:i,aggregationSettings:a,customColumns:o,quickFilters:r,reverse:d,rollupConfig:l,searchFilter:u,selectDistinctColumns:c,sorts:m};Ni(v)?this.lastLoadedConfig=null:this.lastLoadedConfig=v,(e=this.grid)===null||e===void 0||e.forceUpdate(),this.stopLoading()}handleTableChanged(){var e=this.props.model,t=this.state.partitionConfig;lt(e)&&(t==null?void 0:t.mode)!=="keys"&&this.rebuildFilters()}handleSchemaChanged(){var e=this.props.model;this.setState({movedColumns:e.initialMovedColumns})}handleViewChanged(e){var t,i,a=this.props.model,o=(t=(i=this.grid)===null||i===void 0?void 0:i.state)!==null&&t!==void 0?t:{},r=o.selectionEndRow,d=r===void 0?0:r,l=0;if(Re(a)&&a.isEditable){W(e);var u=e.bottomViewport,c=a.rowCount-a.floatingBottomRowCount;d===c-1?l=a.pendingRowCount+1:d===c-2?l=a.pendingRowCount:l=Math.max(0,u-(a.rowCount-a.pendingRowCount)-a.floatingTopRowCount-a.floatingBottomRowCount-1)}this.setState({metrics:e,pendingRowCount:l})}handleSelectionChanged(e){W(e);var t=this.props.onSelectionChanged,i=this.state.copyOperation;this.setState({selectedRanges:e}),i!=null&&this.setState({copyOperation:null}),Xe.rowCount(Xe.consolidate(e))===1&&e[0].startRow!=null&&this.setState({gotoRow:"".concat(e[0].startRow+1)}),t(e)}handleMovedColumnsChanged(e,t){this.setState({movedColumns:e},t)}handleHeaderGroupsChanged(e){var t=this.props.model,i=this.state.columnHeaderGroups;i!==e&&this.setState({columnHeaderGroups:e.every(a=>Ur(a)&&a.isValid())?e:le.parseColumnHeaderGroups(t,e).groups},()=>{var a;return(a=this.grid)===null||a===void 0?void 0:a.forceUpdate()})}handleTooltipRef(e){e!=null&&e.startTimer(),this.tooltip=e}handleConditionalFormatsChange(e){N.debug("Updated conditional formats",e),this.setState({conditionalFormats:e})}handleConditionalFormatCreate(){N.debug("Create new conditional format");var e=this.state,t=e.openOptions,i=e.conditionalFormats;this.setState({openOptions:[...t,{type:Z.CONDITIONAL_FORMATTING_EDIT,title:"Create Formatting Rule"}],conditionalFormatEditIndex:i.length,conditionalFormatPreview:void 0})}handleConditionalFormatEdit(e){N.debug("Edit conditional format",e);var t=this.state,i=t.openOptions,a=t.conditionalFormats;this.setState({openOptions:[...i,{type:Z.CONDITIONAL_FORMATTING_EDIT,title:"Edit Formatting Rule"}],conditionalFormatEditIndex:e,conditionalFormatPreview:se({},a[e])})}handleConditionalFormatEditorSave(e){N.debug("Save conditional format changes",e),this.setState(t=>{if(t.conditionalFormatEditIndex===null)return N.debug("Invalid format index"),null;var i=[...t.conditionalFormats];return i[t.conditionalFormatEditIndex]=e,{conditionalFormats:i}},()=>{this.handleMenuBack()})}handleConditionalFormatEditorCancel(){this.handleMenuBack(),this.setState({conditionalFormatEditIndex:null})}handleUpdateCustomColumns(e){N.info("handleUpdateCustomColumns:",e);var t=this.props.model,i=this.state,a=i.movedColumns,o=i.sorts,r=i.quickFilters,d=i.advancedFilters,l=i.selectDistinctColumns,u=t.columns,c=t.customColumns.map(y=>"".concat(y)),m=le.getRemovedCustomColumnNames(c,e);if(m.length>0){var v=le.removeSortsInColumns(o,m),h=le.removeFiltersInColumns(u,r,m),f=le.removeFiltersInColumns(u,d,m),C=le.removeColumnFromMovedColumns(u,a,m),S=le.removeColumnsFromSelectDistinctColumns(l,m);v.length!==o.length&&(N.debug("removing sorts from removed custom columns..."),this.setState({sorts:v})),(h.size!==r.size||f.size!==d.size)&&(N.debug("removing filters from removed custom columns..."),this.setState({quickFilters:h,advancedFilters:f})),Ve(a,C)||(N.debug("change moved columns for removed custom columns",C),this.setState({movedColumns:C})),Ve(l,S)||(N.debug("change selectDistinct columns for removed custom columns",C),this.setState({selectDistinctColumns:S}))}this.setState({customColumns:e}),e.length>0&&this.startLoading("Applying custom columns...")}handleCustomColumnsChanged(){N.debug("Model columns changed");var e=this.state.isReady;e?(this.updateMetrics(),this.stopLoading()):this.loadTableState()}maybeRebuildMetricCalculator(){var e,t=this.props.getMetricCalculator;if(t!==this.lastMetricCalculatorFactory){var i=this.props.model,a=this.state.movedColumns,o=t({userColumnWidths:new Map,userRowHeights:new Map,movedColumns:a,initialColumnWidths:new Map(i==null||(e=i.layoutHints)===null||e===void 0||(e=e.hiddenColumns)===null||e===void 0?void 0:e.map(r=>[i.getColumnIndexByName(r),0]))});this.lastMetricCalculatorFactory=t,N.debug("Swapping metric calculator",o),this.grid!=null&&(this.grid.metricCalculator=o),this.setState({metricCalculator:o})}}handlePendingCommitClicked(){return this.commitPending()}handlePendingDiscardClicked(){return this.discardPending()}handlePendingDataUpdated(){var e;N.debug("pending data updated");var t=this.props.model,i=t.pendingDataMap,a=t.pendingDataErrors;this.setState({pendingDataMap:i,pendingDataErrors:a,pendingSaveError:null}),(e=this.grid)===null||e===void 0||e.forceUpdate()}handleResizeColumn(e){var t,i=this.state,a=i.metrics,o=i.metricCalculator;if(!a)throw new Error("Metrics not set");var r=Xt(a.contentColumnWidths,e),d=o.getUserColumnWidths();d.has(e)?(o.resetColumnWidth(e),o.setCalculatedColumnWidth(e,r)):o.setColumnWidth(e,r),(t=this.grid)===null||t===void 0||t.forceUpdate()}handleResizeAllColumns(){var e,t=this.state,i=t.metrics,a=t.metricCalculator;if(!i)throw new Error("Metrics not set");var o=[...i.allColumnWidths.entries()],r=o.filter(S=>{var y=Ke(S,2);y[0];var E=y[1];return E!==0}).map(S=>{var y=Ke(S,1),E=y[0];return E}),d=i.contentColumnWidths,l=a.getUserColumnWidths(),u=r.filter(S=>l.has(S));if(r.length===u.length)for(var c=0;c<r.length;c+=1){var m=r[c],v=Xt(d,m);a.resetColumnWidth(m),a.setCalculatedColumnWidth(m,v)}else for(var h=0;h<r.length;h+=1){var f=r[h],C=Xt(d,f);a.setColumnWidth(f,C)}(e=this.grid)===null||e===void 0||e.forceUpdate()}handleAggregationsChange(e){var t,i,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];N.debug("handleAggregationsChange",e,a,o);var r=this.state.rollupConfig,d=((t=r==null||(i=r.columns)===null||i===void 0?void 0:i.length)!==null&&t!==void 0?t:0)>0,l=[...a,...o],u=!(d&&l.length>0&&l.every(c=>Jt.isRollupProhibited(c)));u&&this.startLoading("Aggregating ".concat(e.aggregations.map(c=>c.operation).join(", "),"...")),this.setState({aggregationSettings:e})}handleAggregationChange(e){var t,i;N.debug("handleAggregationChange",e);var a=this.state.rollupConfig,o=((t=a==null||(i=a.columns)===null||i===void 0?void 0:i.length)!==null&&t!==void 0?t:0)>0,r=!(o&&Jt.isRollupProhibited(e.operation));r&&this.startLoading("Aggregating ".concat(e.operation,"...")),this.setState(d=>{var l=d.aggregationSettings;return{selectedAggregation:e,aggregationSettings:se(se({},l),{},{aggregations:l.aggregations.map(u=>u.operation===e.operation?e:u)})}})}handleAggregationEdit(e){N.debug("handleAggregationEdit",e);var t=this.state.openOptions;this.setState({openOptions:[...t,{type:Z.AGGREGATION_EDIT,title:"Edit Columns to ".concat(e.operation)}],selectedAggregation:e})}handleRollupChange(e){var t,i;if(N.info("Rollup change",e),(e==null?void 0:e.columns)!=null&&e.columns.length>0){var a=this.state.metricCalculator,o=a.getUserColumnWidthsByName();e.columns.forEach(r=>{o.get(r)===0&&a.resetColumnWidthByName(r)})}this.resetGridViewState(),this.clearAllFilters(),this.startLoading("Grouping by columns ".concat((t=e==null||(i=e.columns)===null||i===void 0?void 0:i.join(", "))!==null&&t!==void 0?t:"","...")),this.setState({rollupConfig:e,movedColumns:de,frozenColumns:de,sorts:de,reverse:!1,selectDistinctColumns:de})}handleSelectDistinctChanged(e){N.debug("SelectDistinct change",e),this.resetGridViewState(),this.showAllColumns(),this.clearAllFilters(),this.clearAllAggregations(),this.startLoading("Selecting distinct values in ".concat(e.length>0?e.join(", "):"","...")),this.setState({selectDistinctColumns:e,movedColumns:[],sorts:[],reverse:!1})}handleDownloadTableStart(){var e=this.props.canDownloadCsv;e?this.setState({isTableDownloading:!0,tableDownloadProgress:0,tableDownloadEstimatedTime:null,tableDownloadStatus:ke.DOWNLOAD_STATUS.INITIATING}):N.error("Attempted to handleDownloadTableStart for user without download CSV permission.")}handleDownloadTable(e,t,i,a,o,r,d){var l=this.props.canDownloadCsv;l?(N.info("start table downloading",e,t,i,a,o,r,d),this.setState(()=>(this.tableSaver&&this.tableSaver.startDownload(e,t,i,a,o,r,d),{tableDownloadStatus:ke.DOWNLOAD_STATUS.DOWNLOADING}))):N.error("Attempted to handleDownloadTable for user without download CSV permission.")}removeEmptyAggregations(){N.debug("removeEmptyAggregations"),this.setState(e=>{var t=e.aggregationSettings,i=t.aggregations,a=i.filter(o=>o.selected.length>0||o.invert);return a.length!==i.length?{selectedAggregation:null,aggregationSettings:se(se({},t),{},{aggregations:a})}:{selectedAggregation:null,aggregationSettings:t}})}seekRow(e){var t=arguments,i=this;return st(function*(){var a,o=t.length>1&&t[1]!==void 0?t[1]:!1,r=i.state,d=r.gotoValueSelectedColumnName,l=r.gotoValueSelectedFilter,u=i.props.model,c=u.dh;if(u.isSeekRowAvailable&&e!==""){var m=le.getColumnByName(u.columns,d);if(m!==void 0){var v=(a=i.grid)===null||a===void 0?void 0:a.state.cursorRow;v==null&&(v=0);var h=l===Te.contains||l===Te.containsIgnoreCase,f=l===Te.eqIgnoreCase||l===Te.containsIgnoreCase;try{var C,S=u.formatter,y=T.getNormalizedType(m.type),E;switch(y){case T.dataType.CHAR:case T.dataType.STRING:{E=yield u.seekRow(v,m,c.ValueType.STRING,e,f,h,o??!1);break}case T.dataType.DATETIME:{var D=Cn.parseDateRange(c,e,S.timeZone),_=Ke(D,1),O=_[0];E=yield u.seekRow(v,m,c.ValueType.DATETIME,O,void 0,void 0,o??!1);break}case T.dataType.DECIMAL:case T.dataType.INT:{if(!T.isBigDecimalType(m.type)&&!T.isBigIntegerType(m.type)){var p=parseInt(e,10);e==="-Infinity"?p=Number.NEGATIVE_INFINITY:e==="Infinity"&&(p=Number.POSITIVE_INFINITY),E=yield u.seekRow(v,m,c.ValueType.NUMBER,p,void 0,void 0,o??!1)}else E=yield u.seekRow(v,m,c.ValueType.STRING,e,void 0,void 0,o??!1);break}default:E=yield u.seekRow(v,m,c.ValueType.STRING,i.tableUtils.makeValue(m.type,e,S.timeZone),void 0,void 0,o??!1)}(C=i.grid)===null||C===void 0||C.setFocusRow(E),i.setState({gotoValueError:""})}catch{i.setState({gotoValueError:"invalid input"})}}}})()}handleCancelDownloadTable(){var e;(e=this.tableSaver)===null||e===void 0||e.cancelDownload(),this.setState({isTableDownloading:!1})}handleDownloadCompleted(){this.setState({isTableDownloading:!1,tableDownloadProgress:100,tableDownloadStatus:ke.DOWNLOAD_STATUS.FINISHED})}handleDownloadCanceled(){this.setState({isTableDownloading:!1,tableDownloadProgress:0,tableDownloadStatus:ke.DOWNLOAD_STATUS.CANCELED})}deleteRanges(e){var t=this.props.model;if(!io(t)||!t.isDeletable)throw new Error("Model does not support deleting ranges");this.pending.add(t.delete(e)).catch(i=>{Ae.isCanceled(i)||N.error("Unable to delete ranges",e,i)})}resetColumnSelection(){if(this.grid!=null){var e=this.props.isSelectingColumn;if(e){var t=this.props.columnAllowedCursor;this.grid.setState({cursor:t})}else this.grid.setState({cursor:null}),this.setState({hoverSelectColumn:null})}}resetGridViewState(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.grid&&(this.grid.clearSelectedRanges(),this.grid.setViewState({left:0,top:0,topOffset:0,leftOffset:0},e))}sendStateChange(){if(this.grid){var e=this.state,t=this.grid.state,i=this.props.onStateChange;i(e,t)}}handleOverflowClose(){var e;this.setState({showOverflowModal:!1}),(e=this.grid)===null||e===void 0||e.focus()}handleOpenNoPastePermissionModal(e){this.setState({showNoPastePermissionModal:!0,noPastePermissionError:e})}handleCloseNoPastePermissionModal(){this.setState({showNoPastePermissionModal:!1})}getColumnBoundingRect(){var e,t=this.state,i=t.metrics,a=t.shownColumnTooltip;W(i),W(a);var o=(e=this.gridWrapper)===null||e===void 0?void 0:e.getBoundingClientRect(),r=20;W(o);var d=i.columnHeaderHeight,l=i.allColumnXs,u=i.allColumnWidths,c=i.width,m=i.columnHeaderMaxDepth,v=l.get(a),h=u.get(a);W(v),W(h);var f=o.left+Qt(v+h/2,r,c-r);return{top:o.top+(m-1)*d,left:o.left+Qt(v+h/2,r,c-r),bottom:o.top+m*d,right:o.left+Qt(v+h/2,r,c-r)+1,width:1,height:d,x:f,y:o.top,toJSON:()=>{throw new Error("not implemented")}}}handleGotoRowSelectedRowNumberSubmit(){var e=this.state.gotoRow;this.focusRowInGrid(e)}focusRowInGrid(e){var t=this.props.model,i=t.rowCount;if(this.setState({gotoRow:e}),e===""){this.setState({gotoRowError:"",gotoValueError:""});return}var a=parseInt(e,10);if(a>i||a<-i)this.setState({gotoRowError:"Invalid row index"});else if(a===0){var o;this.setState({gotoRowError:"",gotoValueError:""}),(o=this.grid)===null||o===void 0||o.setFocusRow(0)}else if(a<0){var r;this.setState({gotoRowError:"",gotoValueError:""}),(r=this.grid)===null||r===void 0||r.setFocusRow(a+i)}else{var d;(d=this.grid)===null||d===void 0||d.setFocusRow(a-1),this.setState({gotoRowError:"",gotoValueError:""})}}handleGotoRowSelectedRowNumberChanged(e){var t=e.target.value;this.focusRowInGrid(t)}getColumnTooltip(e,t,i){var a=t.columnHeaderHeight,o=t.columnHeaderMaxDepth,r=t.allColumnXs,d=t.allColumnWidths,l=t.width,u=r.get(e),c=d.get(e);if(u==null||c==null)return null;var m=Math.max(0,u),v=c;u+c>l?v=l-u:u<0&&(v=c-Math.abs(u));var h={position:"absolute",top:(o-1)*a,left:m,width:v,height:a,pointerEvents:"none"},f={clientWidth:1,clientHeight:a,getBoundingClientRect:this.getColumnBoundingRect},C={placement:"bottom",modifiers:{flip:{behavior:["bottom","top"]}}},S=this.getModelColumn(e);if(S==null)return null;var y=i.columns[S];return y==null?null:s.jsx("div",{style:h,children:s.jsx(De,{timeout:400,interactive:!0,options:C,ref:this.handleTooltipRef,referenceObject:f,onExited:()=>{this.setState({shownColumnTooltip:null})},children:s.jsx(vt,{model:i,column:y,onStatistics:()=>{var E;(E=this.tooltip)===null||E===void 0||E.update()}})},y.name)})}handleGotoValueSelectedColumnNameChanged(e){var t,i=this.props.model,a=(t=this.grid)===null||t===void 0?void 0:t.state.cursorRow,o=this.state,r=o.gotoValueSelectedColumnName,d=o.gotoValueManuallyChanged;if(a!=null){var l=i.getColumnIndexByName(e),u=le.getColumnByName(i.columns,e),c=le.getColumnByName(i.columns,r);if(l==null||u==null)return;var m=i.valueForCell(l,a),v=le.convertValueToText(m,u.type);d&&u.type===(c==null?void 0:c.type)?this.setState({gotoValueSelectedColumnName:e,gotoValueError:""}):this.setState({gotoValueSelectedColumnName:e,gotoValue:v,gotoValueError:"",gotoValueManuallyChanged:!1})}this.setState({gotoValueSelectedColumnName:e,gotoValueError:""})}handleGotoValueSelectedFilterChanged(e){this.setState({gotoValueSelectedFilter:e,gotoValueError:""})}handleGotoValueSubmitted(e){var t=this.state.gotoValue;this.seekRow(t,e)}getFilterBarInput(e,t,i,a,o){var r;if(e==null||i==null)return null;var d=this.getMetricState();if(d==null)return null;var l=t.getFilterInputCoordinates(i,d,e);if(l==null)return null;var u=Math.min(Math.max(Ie.minDebounce,Math.round(e.rowCount/200)),Ie.maxDebounce),c=l.x,m=l.y,v=l.width,h=l.height,f=e.width,C={top:m,left:c,minWidth:Math.min(v,f-c),height:h},S="",y=!0,E=this.getModelColumn(i);W(E);var D=a.get(E),_=o.get(E);D!=null&&(S=D.text,y=D.filter!=null);var O=a.size!==0||o.size!==0,p=t.getAdvancedFilterButtonCoordinates(i,d,e)!=null;return s.jsx(Yi,{ref:this.filterInputRef,style:C,className:K({error:!y,active:S!==""||_!=null,"iris-grid-has-filter":O}),showAdvancedFilterButton:p,isAdvancedFilterSet:_!=null,onAdvancedFiltersTriggered:()=>{this.setState({shownAdvancedFilter:i})},onChange:this.handleFilterBarChange,onDone:this.handleFilterBarDone,onTab:this.handleFilterBarTab,onContextMenu:(r=this.grid)===null||r===void 0?void 0:r.handleContextMenu,debounceMs:u,value:S},i)}render(){var e,t,i=this,a,o,r=this.props,d=r.children,l=r.customFilters,u=r.getDownloadWorker,c=r.isSelectingColumn,m=r.isStuckToBottom,v=r.isStuckToRight,h=r.model,f=r.name,C=r.onlyFetchVisibleColumns,S=r.alwaysFetchColumns,y=r.advancedSettings,E=r.onAdvancedSettingsChange,D=r.canDownloadCsv,_=r.onCreateChart,O=r.transformTableOptions,p=this.state,B=p.metricCalculator,w=p.metrics,P=p.isFilterBarShown,j=p.isSelectingPartition,Q=p.isMenuShown,x=p.isReady,I=p.copyOperation,M=p.focusedFilterBarColumn,J=p.loadingText,U=p.loadingScrimProgress,X=p.loadingSpinnerShown,V=p.loadingCancelShown,he=p.loadingBlocksGrid,Fe=p.shownColumnTooltip,ee=p.hoverAdvancedFilter,te=p.shownAdvancedFilter,Ge=p.maximizedAdvancedFilter,g=p.hoverSelectColumn,F=p.quickFilters,L=p.advancedFilters,z=p.searchFilter,ae=p.selectDistinctColumns,$=p.movedColumns,re=p.movedRows,ge=p.formatter,ue=p.conditionalFormats,Ce=p.conditionalFormatPreview,_e=p.conditionalFormatEditIndex,Ze=p.columnAlignmentMap,ft=p.sorts,Ct=p.reverse,St=p.customColumns,kt=p.selectedRanges,Ut=p.isTableDownloading,pe=p.tableDownloadStatus,ra=p.tableDownloadProgress,Vt=p.tableDownloadEstimatedTime,yn=p.showSearchBar,oa=p.searchValue,sa=p.selectedSearchColumns,la=p.invertSearchColumns,$t=p.aggregationSettings,Tn=p.selectedAggregation,je=p.rollupConfig,Je=p.openOptions,da=p.pendingSavePromise,ua=p.pendingSaveError,ca=p.pendingRowCount,ha=p.pendingDataErrors,En=p.pendingDataMap,ma=p.toastMessage,ga=p.frozenColumns,wn=p.columnHeaderGroups,va=p.showOverflowModal,pa=p.showNoPastePermissionModal,fa=p.noPastePermissionError,Ca=p.overflowText,An=p.overflowButtonTooltipProps,Fn=p.expandCellTooltipProps,_n=p.hoverTooltipProps,Nn=p.isGotoShown,Sa=p.gotoRow,ba=p.gotoRowError,ya=p.gotoValueError,Ta=p.gotoValueSelectedColumnName,Ea=p.gotoValue,wa=p.gotoValueSelectedFilter,xn=p.partitionConfig;if(!x)return null;var bt=this.getTheme(),On=bt.columnHeaderHeight,Aa=this.getCachedFilter(l,F,L,z),Rn=B.getUserColumnWidths(),Fa=this.getCachedStateOverride(h,bt,g,P,c,U,F,L,ft,Ct,je,Q),_a=w?w.top:0,Na=w?w.bottomViewport:0,In=null,Dn=null;C&&(In=w?w.left:0,Dn=w?w.right:0);var xa=w!=null&&w.width>0&&w.height>0,Ln=((e=je==null||(t=je.columns)===null||t===void 0?void 0:t.length)!==null&&e!==void 0?e:0)>0,Oa=P?this.getFilterBarInput(w,B,M,F,L):null,jn=null;if(J!=null){var Ra=s.jsxs("div",{className:"iris-grid-loading-status",children:[s.jsx("div",{className:K("iris-grid-loading-status-bar",{show:X}),children:J}),s.jsxs("button",{type:"button",onClick:this.handleCancel,className:K("iris-grid-btn-cancel",{show:V}),children:[s.jsx(ie,{icon:Li,transform:"down-1"}),"Cancel"]})]}),Ia=w?w.gridY:0;jn=s.jsx("div",{className:"iris-grid-loading",style:he?{top:Ia}:{},children:Ra})}var Pn=null;if(Fe!=null&&w){var Gt;Pn=this.getColumnTooltip(Fe,w,h),(Gt=this.tooltip)===null||Gt===void 0||Gt.update()}var Mn=[];if(w&&P)for(var kn=this.getMetricState(),Un=w.visibleColumns,Da=function(){var oe=Un[Bt],Pe=i.getModelColumn(oe);if(Pe!=null){var Be=h.isFilterable(Pe),et=Be&&kn?B.getAdvancedFilterButtonCoordinates(oe,kn,w):null;if(et!=null){var zt=et.x,qt=et.y,He={position:"absolute",top:qt,left:zt},tt=L.get(Pe),yt=tt!=null,Tt=oe===ee||oe===M||yt,Kt=s.jsx("div",{className:K("advanced-filter-button-container",{hidden:!Tt}),style:He,children:Tt&&s.jsx(Y,{kind:"ghost",className:K("btn-link-icon advanced-filter-button",{"filter-set":yt}),onClick:()=>{i.setState({shownAdvancedFilter:oe,maximizedAdvancedFilter:null})},onContextMenu:Et=>{var Me;(Me=i.grid)===null||Me===void 0||Me.handleContextMenu(Et)},onMouseEnter:()=>{i.setState({hoverAdvancedFilter:oe})},onMouseLeave:()=>{i.setState({hoverAdvancedFilter:null})},children:s.jsxs("div",{className:"fa-layers",children:[s.jsx(ie,{icon:Oi,className:"filter-solid"}),s.jsx(ie,{icon:cn,className:"filter-light"})]})})},oe);Mn.push(Kt)}}},Bt=0;Bt<Un.length;Bt+=1)Da();var Vn=[];if(w)for(var $n=w.gridX,Gn=w.visibleColumns,La=w.allColumnXs,ja=w.allColumnWidths,Bn=w.columnHeaderHeight,Pa=function(){var oe=Gn[Ht],Pe=La.get(oe),Be=ja.get(oe);if(Pe!=null&&Be!=null&&Be>0){var et=$n+Pe,zt=$n+Pe+Be-20,qt=P?{position:"absolute",top:Bn,left:zt,width:20,height:bt.filterBarHeight}:{position:"absolute",top:0,left:et,width:Be,height:Bn},He=i.getModelColumn(oe);if(He!=null){var tt=h.columns[He];if(tt==null)return N.warn("Column does not exist at index ".concat(He," for column array of length ").concat(h.columns.length)),1;var yt=L.get(He),Tt=yt||{},Kt=Tt.options,Et=T.getSortForColumn(h.sort,tt.name),Me=Et?Et.direction:null;if(!Or(Me))throw new Error("Invalid sort direction: ".concat(Me));var Ua=s.jsx("div",{className:"advanced-filter-menu-container",style:qt,children:s.jsx(ki,{className:"advanced-filter-menu-popper",isMaximized:te===oe&&Ge===oe,onEntered:i.getAdvancedMenuOpenedHandler(oe),onExited:()=>{i.handleAdvancedMenuClosed(oe)},isShown:te===oe,interactive:!0,closeOnBlur:!0,options:{positionFixed:!0},children:i.getCachedAdvancedFilterMenuActions(h,tt,Kt,Me,ge,te===oe&&Ge===oe,i.getAdvancedMenuToggleMaximizeHandler(oe))})},oe);Vn.push(Ua)}}},Ht=0;Ht<Gn.length;Ht+=1)Pa();var Ma=this.getCachedOptionItems(_!==void 0&&h.isChartBuilderAvailable,h.isCustomColumnsAvailable,h.isFormatColumnsAvailable,h.isOrganizeColumnsAvailable,h.isRollupAvailable,h.isTotalsAvailable||Ln,h.isSelectDistinctAvailable,h.isExportAvailable,this.toggleFilterBarAction,this.toggleSearchBarAction,this.toggleGotoRowAction,P,yn,D,this.isTableSearchAvailable(),Nn,y.size>0),Hn=this.getCachedTransformedOptionItems(Ma,O),Wt=this.getCachedHiddenColumns(B,Rn),ka=Je.map(Se=>{switch(Se.type){case Z.CHART_BUILDER:return s.jsx(uo,{model:h,onChange:this.handleChartChange,onSubmit:this.handleChartCreate},Z.CHART_BUILDER);case Z.VISIBILITY_ORDERING_BUILDER:return s.jsx(lo,{model:h,movedColumns:$,hiddenColumns:Wt,columnHeaderGroups:wn,onColumnVisibilityChanged:this.handleColumnVisibilityChanged,onReset:this.handleColumnVisibilityReset,onMovedColumnsChanged:this.handleMovedColumnsChanged,onColumnHeaderGroupChanged:this.handleHeaderGroupsChanged,onFrozenColumnsChanged:this.handleFrozenColumnsChanged},Z.VISIBILITY_ORDERING_BUILDER);case Z.CONDITIONAL_FORMATTING:return s.jsx(gl,{rules:ue,onChange:this.handleConditionalFormatsChange,onCreate:this.handleConditionalFormatCreate,onSelect:this.handleConditionalFormatEdit});case Z.CONDITIONAL_FORMATTING_EDIT:return W(h.columns),W(this.handleConditionalFormatEditorUpdate),s.jsx(md,{dh:h.dh,columns:h.columns,rule:Ce,onUpdate:this.handleConditionalFormatEditorUpdate,onSave:this.handleConditionalFormatEditorSave,onCancel:this.handleConditionalFormatEditorCancel});case Z.CUSTOM_COLUMN_BUILDER:return s.jsx(so,{model:h,customColumns:St,onSave:this.handleUpdateCustomColumns,onCancel:this.handleMenuBack},Z.CUSTOM_COLUMN_BUILDER);case Z.ROLLUP_ROWS:return s.jsx(oo,{model:h,onChange:this.handleRollupChange,config:je},Z.ROLLUP_ROWS);case Z.AGGREGATIONS:return s.jsx(ro,{settings:$t,isRollup:Ln,availablePlacements:Re(h)&&h.isEditable?["top"]:["top","bottom"],onChange:this.handleAggregationsChange,onEdit:this.handleAggregationEdit,dh:h.dh});case Z.AGGREGATION_EDIT:return Tn&&s.jsx(ao,{aggregation:Tn,columns:h.originalColumns,onChange:this.handleAggregationChange});case Z.TABLE_EXPORTER:return s.jsx(ke,{model:h,name:f,userColumnWidths:Rn,movedColumns:$,isDownloading:Ut,tableDownloadStatus:pe,tableDownloadProgress:ra,tableDownloadEstimatedTime:Vt??void 0,onDownload:this.handleDownloadTable,onDownloadStart:this.handleDownloadTableStart,onCancel:this.handleCancelDownloadTable,selectedRanges:kt},Z.TABLE_EXPORTER);case Z.SELECT_DISTINCT:return s.jsx(Ji,{model:h,selectDistinctColumns:ae,onChange:this.handleSelectDistinctChanged});case Z.ADVANCED_SETTINGS:return s.jsx(bn,{items:y,onChange:E});default:{var oe=Se.configPage;if(oe==null)throw Error("Unexpected option type ".concat(Se.type));return s.jsx(il,{itemType:String(Se.type),children:s.jsx(oe,{model:h,viewState:this.getCachedViewState(this.getCachedHiddenColumnNames(Wt,h.columns)),onBack:this.handleMenuBack})},String(Se.type))}}});return s.jsxs("div",{className:"iris-grid",role:"presentation",children:[s.jsxs("div",{className:"iris-grid-column",children:[d!=null&&s.jsx("div",{className:"iris-grid-bar",children:d}),s.jsx(dn,{in:j,timeout:un.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,nodeRef:this.slideTransitionRef,children:s.jsx("div",{ref:this.slideTransitionRef,className:"iris-grid-partition-selector-wrapper iris-grid-bar iris-grid-bar-primary",children:lt(h)&&h.isPartitionRequired&&s.jsx(Xs,{model:h,partitionConfig:xn,onChange:this.handlePartitionChange})})}),s.jsx(dn,{in:yn,timeout:un.transitionSlowMs,classNames:"iris-grid-bar-horizontal",onEnter:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExit:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,nodeRef:this.bottomTransitionRef,children:s.jsx("div",{ref:this.bottomTransitionRef,className:"iris-grid-bar",children:s.jsx(At,{value:oa,selectedColumns:sa,invertSelection:la,onChange:this.handleCrossColumnSearch,columns:h.columns,ref:this.crossColumnRef})})}),s.jsxs(So,{ref:Se=>{this.grid=Se},isStickyBottom:!Re(h)||!h.isEditable,isStuckToBottom:m,isStuckToRight:v,metricCalculator:B,model:h,keyHandlers:this.getKeyHandlers(),mouseHandlers:this.getMouseHandlers(),movedColumns:$,movedRows:re,onError:this.handleGridError,onViewChanged:this.handleViewChanged,onSelectionChanged:this.handleSelectionChanged,onMovedColumnsChanged:this.handleMovedColumnsChanged,renderer:this.renderer,stateOverride:Fa,theme:bt,children:[s.jsx(Cd,{isOpen:va,text:Ca,onClose:this.handleOverflowClose}),xa&&s.jsx(Xi,{model:h,top:_a,bottom:Na,left:In,right:Dn,filter:Aa,formatter:ge,columnAlignmentMap:Ze,sorts:ft,reverse:Ct,movedColumns:$,customColumns:St,hiddenColumns:Wt,alwaysFetchColumns:this.getAlwaysFetchColumns(S,h.columns,$,h.floatingLeftColumnCount,h.floatingRightColumnCount,(a=this.grid)===null||a===void 0||(a=a.state.draggingColumn)===null||a===void 0?void 0:a.range),formatColumns:this.getCachedPreviewFormatColumns(h.dh,h.columns,ue,Ce,((o=Je[Je.length-1])===null||o===void 0?void 0:o.type)===Z.CONDITIONAL_FORMATTING_EDIT?_e??void 0:void 0),rollupConfig:this.getModelRollupConfig(h.originalColumns,je,$t),totalsConfig:this.getModelTotalsConfig(h.columns,je,$t),selectDistinctColumns:ae,pendingRowCount:ca,pendingDataMap:En,frozenColumns:ga,columnHeaderGroups:wn,partitionConfig:xn,showExtraGroupColumn:this.showExtraGroupColumn}),!Q&&s.jsx("div",{className:"grid-settings-button",style:{height:"".concat(On,"px"),width:"".concat(On,"px")},children:s.jsx(Y,{kind:"ghost","data-testid":"btn-iris-grid-settings-button-".concat(f),onClick:this.handleMenu,icon:s.jsx(ie,{icon:br,transform:"up-1"}),tooltip:"Table Options"})}),Oa,jn,Mn,Pn,Vn,An&&this.getOverflowButtonTooltip(An),Fn&&this.getExpandCellTooltip(Fn),_n&&this.getHoverTooltip(_n)]}),s.jsx(aa,{ref:this.gotoRowRef,model:h,isShown:Nn,gotoRow:Sa,gotoRowError:ba,gotoValueError:ya,onGotoRowSubmit:this.handleGotoRowSelectedRowNumberSubmit,onGotoRowNumberChanged:this.handleGotoRowSelectedRowNumberChanged,onClose:this.handleGotoRowClosed,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:()=>{this.handleAnimationStart(),this.focus()},onExited:this.handleAnimationEnd,gotoValueSelectedColumnName:Ta,gotoValue:Ea,gotoValueFilter:wa,onGotoValueSelectedColumnNameChanged:this.handleGotoValueSelectedColumnNameChanged,onGotoValueSelectedFilterChanged:this.handleGotoValueSelectedFilterChanged,onGotoValueChanged:this.handleGotoValueChanged,onGotoValueSubmit:this.handleGotoValueSubmitted}),s.jsx(hs,{error:ua,isSaving:da!=null,saveTooltip:"Commit (".concat(this.commitAction.shortcut.getDisplayText(),")"),discardTooltip:"Discard (".concat(this.discardAction.shortcut.getDisplayText(),")"),pendingDataErrors:ha,pendingDataMap:En,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,onSave:this.handlePendingCommitClicked,onDiscard:this.handlePendingDiscardClicked}),s.jsx($s,{children:ma}),s.jsx(G,{model:h,copyOperation:I??void 0,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd}),s.jsx(co,{dh:h.dh,ref:Se=>{this.tableSaver=Se},getDownloadWorker:u,onDownloadCompleted:this.handleDownloadCompleted,onDownloadCanceled:this.handleDownloadCanceled,onDownloadProgressUpdate:this.handleDownloadProgressUpdate,isDownloading:pe===ke.DOWNLOAD_STATUS.DOWNLOADING,formatter:ge})]}),s.jsx(fo,{in:Q,onEntering:this.handleAnimationStart,onEntered:this.handleAnimationEnd,onExiting:this.handleAnimationStart,onExited:this.handleAnimationEnd,mountOnEnter:!0,unmountOnExit:!0,children:s.jsx("div",{className:"table-sidebar",children:s.jsx(po,{children:[s.jsx(Zn,{title:"Table Options",onClose:this.handleMenuClose,children:s.jsx(Vi,{onSelect:Se=>this.handleMenuSelect(Hn[Se]),items:Hn})},"table-options"),...ka.map((Se,oe)=>s.jsx(Zn,{title:Je[oe].title,onBack:this.handleMenuBack,onClose:this.handleMenuClose,children:Se},Je[oe].type))]})})}),s.jsx(xr,{actions:this.contextActions}),s.jsx(Ad,{isOpen:pa,onClose:this.handleCloseNoPastePermissionModal,errorMessage:fa})]})}}A(Ie,"contextType",ho);A(Ie,"minDebounce",150);A(Ie,"maxDebounce",500);A(Ie,"loadingSpinnerDelay",800);A(Ie,"defaultProps",{advancedFilters:Ne,advancedSettings:Ne,alwaysFetchColumns:de,conditionalFormats:de,customColumnFormatMap:Ne,columnAlignmentMap:Ne,isFilterBarShown:!1,applyInputFiltersOnInit:!1,movedColumns:de,movedRows:de,inputFilters:de,customFilters:de,onCreateChart:void 0,onColumnSelected:()=>{},onDataSelected:()=>{},onError:()=>{},onStateChange:()=>{},onAdvancedSettingsChange:()=>{},partitions:void 0,partitionConfig:void 0,quickFilters:Ne,selectDistinctColumns:de,sorts:de,reverse:!1,customColumns:de,aggregationSettings:gn,rollupConfig:void 0,userColumnWidths:Ne,userColumnWidthsByName:void 0,userRowHeights:Ne,onSelectionChanged:()=>{},isSelectingColumn:!1,isSelectingPartition:!1,isStuckToBottom:!1,isStuckToRight:!1,columnAllowedCursor:"linker",columnNotAllowedCursor:"linker-not-allowed",copyCursor:"copy",name:"table",onlyFetchVisibleColumns:!0,showSearchBar:!1,searchValue:"",invertSearchColumns:!0,onContextMenu:()=>de,pendingDataMap:Ne,getDownloadWorker:Co.getServiceWorker,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Cn.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,truncateNumbersWithPound:!1,showEmptyStrings:!0,showNullStrings:!0,showExtraGroupColumn:!0,formatter:de},canCopy:!0,canDownloadCsv:!0,frozenColumns:void 0,density:void 0,canToggleSearch:!0,mouseHandlers:de,keyHandlers:de,getMetricCalculator:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return new mo(...t)}});export{Ie as default};
15
- //# sourceMappingURL=IrisGrid-DejYZq4M.js.map
15
+ //# sourceMappingURL=IrisGrid-DNjLcT3l.js.map