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