@deephaven/code-studio 1.3.0 → 1.3.1-beta.1

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 (46) hide show
  1. package/build/assets/{AppRoot-CIGVojav.js → AppRoot-B3qZGmGT.js} +4 -4
  2. package/build/assets/{AppRoot-CIGVojav.js.map → AppRoot-B3qZGmGT.js.map} +1 -1
  3. package/build/assets/{Chart-DqkltY6C.js → Chart-CZegCl6N.js} +2 -2
  4. package/build/assets/{Chart-DqkltY6C.js.map → Chart-CZegCl6N.js.map} +1 -1
  5. package/build/assets/ControlType-CMNdrk88.css +1 -0
  6. package/build/assets/{ControlType-Bghd_fpi.js → ControlType-hjy35CfT.js} +13 -13
  7. package/build/assets/ControlType-hjy35CfT.js.map +1 -0
  8. package/build/assets/{FontBootstrap-DmXXTp_Y.js → FontBootstrap-BD0QC083.js} +2 -2
  9. package/build/assets/{FontBootstrap-DmXXTp_Y.js.map → FontBootstrap-BD0QC083.js.map} +1 -1
  10. package/build/assets/{FormatterUtils-Djwqw9fn.js → FormatterUtils-GsUZIKzO.js} +2 -2
  11. package/build/assets/{FormatterUtils-Djwqw9fn.js.map → FormatterUtils-GsUZIKzO.js.map} +1 -1
  12. package/build/assets/{Grid-DZKgb0xS.js → Grid-CW5VHZt0.js} +3 -3
  13. package/build/assets/{Grid-DZKgb0xS.js.map → Grid-CW5VHZt0.js.map} +1 -1
  14. package/build/assets/{GridTokenMouseHandler-CZSIU-NY.js → GridTokenMouseHandler-ykzjzLCm.js} +2 -2
  15. package/build/assets/{GridTokenMouseHandler-CZSIU-NY.js.map → GridTokenMouseHandler-ykzjzLCm.js.map} +1 -1
  16. package/build/assets/{IrisGrid-5b7rgg9a.js → IrisGrid-BLIrB6aP.js} +2 -2
  17. package/build/assets/{IrisGrid-5b7rgg9a.js.map → IrisGrid-BLIrB6aP.js.map} +1 -1
  18. package/build/assets/{IrisGridModel-CR_Fa0Fa.js → IrisGridModel-ClxZ5gUq.js} +3 -3
  19. package/build/assets/{IrisGridModel-CR_Fa0Fa.js.map → IrisGridModel-ClxZ5gUq.js.map} +1 -1
  20. package/build/assets/{IrisGridShortcuts-ivIcpczX.js → IrisGridShortcuts-B2qHIaCj.js} +2 -2
  21. package/build/assets/{IrisGridShortcuts-ivIcpczX.js.map → IrisGridShortcuts-B2qHIaCj.js.map} +1 -1
  22. package/build/assets/{IrisGridThemeProvider-Cmci0pcT.js → IrisGridThemeProvider-F_cBGwMh.js} +4 -4
  23. package/build/assets/{IrisGridThemeProvider-Cmci0pcT.js.map → IrisGridThemeProvider-F_cBGwMh.js.map} +1 -1
  24. package/build/assets/{LocalWorkspaceStorage-BXMd5cAF.css → LocalWorkspaceStorage-C_d9_CEf.css} +1 -1
  25. package/build/assets/{LocalWorkspaceStorage-CpXC4MYB.js → LocalWorkspaceStorage-Dr_rvjIH.js} +3 -3
  26. package/build/assets/LocalWorkspaceStorage-Dr_rvjIH.js.map +1 -0
  27. package/build/assets/{MarkdownEditor-TK8hO5ne.js → MarkdownEditor-BDXMzhuD.js} +2 -2
  28. package/build/assets/{MarkdownEditor-TK8hO5ne.js.map → MarkdownEditor-BDXMzhuD.js.map} +1 -1
  29. package/build/assets/{MarkdownNotebook-CUaOaFIy.js → MarkdownNotebook-Bs0WbxEL.js} +2 -2
  30. package/build/assets/{MarkdownNotebook-CUaOaFIy.js.map → MarkdownNotebook-Bs0WbxEL.js.map} +1 -1
  31. package/build/assets/{MissingPartitionError-HuyrcVjb.js → MissingPartitionError-FZmoFEc9.js} +2 -2
  32. package/build/assets/{MissingPartitionError-HuyrcVjb.js.map → MissingPartitionError-FZmoFEc9.js.map} +1 -1
  33. package/build/assets/{StyleGuideRoot-BqkNVpy3.js → StyleGuideRoot-CpKv0Nlw.js} +2 -2
  34. package/build/assets/{StyleGuideRoot-BqkNVpy3.js.map → StyleGuideRoot-CpKv0Nlw.js.map} +1 -1
  35. package/build/assets/{index-COIUswGh.js → index-CIwIIFAb.js} +6 -6
  36. package/build/assets/{index-COIUswGh.js.map → index-CIwIIFAb.js.map} +1 -1
  37. package/build/assets/index-DM5TKRGR.js +2 -0
  38. package/build/assets/{index-C87R7y2u.js.map → index-DM5TKRGR.js.map} +1 -1
  39. package/build/assets/{index-Dezj6bFJ.js → index-ZukTn3TM.js} +3 -3
  40. package/build/assets/{index-Dezj6bFJ.js.map → index-ZukTn3TM.js.map} +1 -1
  41. package/build/index.html +1 -1
  42. package/package.json +31 -31
  43. package/build/assets/ControlType-BX-XPEfP.css +0 -1
  44. package/build/assets/ControlType-Bghd_fpi.js.map +0 -1
  45. package/build/assets/LocalWorkspaceStorage-CpXC4MYB.js.map +0 -1
  46. package/build/assets/index-C87R7y2u.js +0 -2
@@ -1,4 +1,4 @@
1
- import{aQ as Si,B as M,S as cr,c as $,C as je,x as wi,aT as Oi,ab as Vt,D as Sr,Y as Kt,t as Xe,d as ji,P as Ti,df as Ke,bn as Qe,b as Re,a as Z,I as ge,v as Ee,ac as Pi,N as xi,au as k,dD as Di,dE as Ni,dF as Ei,u as rr,bz as Qt,by as Er,bC as Ii,bA as hr,bs as Ri,bx as ki,dG as Ai,bt as Fi,aN as Gi,G as Mi}from"./ControlType-Bghd_fpi.js";import{r as C,I as d,L as V,M as K,b1 as wr,b0 as Te,bw as Or,H as Fe,bv as Li,bx as qt,ac as Ir,_ as jr,a0 as ye,U as vr,a7 as Rr,aZ as _i,c4 as Ui,c5 as he,c6 as $i,c7 as Bi,c8 as Hi,c9 as Wi,ca as mr,cb as zi,cc as Vi,cd as Ki,ce as kr,cf as Qi,cg as Ar,ch as qi,ci as Xi,cj as Yi,ck as Zi,cl as Ji,cm as en,au as pr,bz as rn,bC as Ye}from"./vendor-DtjvbB9h.js";import{L as le,bS as Fr,aR as Xt,f as Ge,g as Tr,W as J,bT as Pr,bU as xr,aV as tn,aT as Yt,z as nn,bV as on,aW as Zt,aN as qe,aO as an,a3 as Jt,e as R,bk as fr,bW as sn,bG as Gr,p as ln,bX as ei,bY as ri,v as un,bZ as dn,U as cn,bL as hn,b_ as vn,b$ as mn,c0 as pn,c1 as fn,c2 as me,c3 as gn,c4 as bn,c5 as yn,c6 as Cn,c7 as Sn,d as Mr,bc as wn,aL as On,bz as oe,au as jn,ak as Tn,bp as Pn}from"./index-Dezj6bFJ.js";import{S as xn,b as Dn,c as nr,q as Nn,e as ti,C as we,j as ii}from"./MissingPartitionError-HuyrcVjb.js";import{l as fe,P as En,I as _e,t as In,O as Rn,k as kn,q as An}from"./IrisGridShortcuts-ivIcpczX.js";import{c as se,O as Fn,G as ue,n as ni,o as gr,p as Gn,q as Lr,r as Mn,s as Ln,T as _n,v as Un,l as $n,g as Bn}from"./GridTokenMouseHandler-CZSIU-NY.js";import{e as Hn}from"./monaco-CsU3t3B1.js";import{I as xe,G as q,d as U,m as oi,e as ke,f as Wn}from"./IrisGridModel-CR_Fa0Fa.js";import{F as zn,c as Vn}from"./FormatterUtils-Djwqw9fn.js";function Hl(t,e){var r=Si(e);(r===void 0||!e.every((i,n)=>i===r[n]))&&t()}function Kn(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=C.useRef(),n=C.useRef(0);return C.useCallback(o=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>{var a=Math.floor(o.target.scrollTop/t);n.current!==a&&(n.current=a,e(a))},r)},[r,t,e])}function Qn(){var{getKey:t=qn}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[e,r]=C.useState([]),[i,n]=C.useState(()=>new Set),o=C.useCallback(m=>g=>t(g)===m,[t]),a=C.useCallback(m=>{var g;return(g=e.find(o(m)))!==null&&g!==void 0?g:null},[e,o]),s=C.useCallback(m=>{var g=a(m);if(g==null)throw new Error("No item found matching key: ".concat(m));return g},[a]),l=C.useCallback(m=>{r(g=>[...g,...m])},[]),u=C.useCallback((m,g)=>{r(f=>[...f.slice(0,m),...g,...f.slice(m)])},[]),c=C.useCallback(m=>{var g=new Set(m);r(f=>f.filter(b=>!g.has(t(b))))},[t]),h=C.useCallback((m,g)=>{var f=e.findIndex(o(m));f!==-1&&r(b=>[...b.slice(0,f),g,...b.slice(f+1)])},[e,o]),p=C.useCallback(m=>{if(m.size!==0){var g=[],f=new Map;for(var b of m.keys()){var w=e.findIndex(o(b));g.push(w),f.set(w,b)}g.sort((O,P)=>O-P);var y=[];e.forEach((O,P)=>{if(g[0]===P){var D=f.get(g.shift()),E=m.get(D);y.push(E)}else y.push(O)}),r(y)}},[e,o]),v=C.useMemo(()=>({items:e,selectedKeys:i,append:l,bulkUpdate:p,findItem:a,getItem:s,insert:u,remove:c,setItems:r,setSelectedKeys:n,update:h}),[l,p,a,s,u,e,c,r,i,h]);return v}function qn(t){var e=t!=null&&typeof t=="object"&&"key"in t;if(!e)throw new Error("Item does not have a `key` prop.");return t.key}function _r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Ur(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?_r(Object(r),!0).forEach(function(i){Xn(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_r(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Xn(t,e,r){return(e=Yn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yn(t){var e=Zn(t,"string");return typeof e=="symbol"?e:e+""}function Zn(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $r=le.module("Aggregations");function Wl(t){var{isRollup:e,settings:r,onChange:i,onEdit:n,dh:o}=t,{aggregations:a,showOnTop:s}=r,l=C.useMemo(()=>xn.filter(T=>!a.some(x=>x.operation===T)&&!(T===Dn.MEDIAN&&o.AggregationOperation.MEDIAN===void 0)),[a,o]),[u,c]=C.useState(l[0]),[h,p]=C.useState([]),v=C.useCallback(function(T){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];i(Ur(Ur({},r),T),x,F)},[i,r]),m=C.useCallback(function(T){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];v({aggregations:T},x,F)},[v]),g=C.useCallback(T=>{v({showOnTop:T})},[v]),f=C.useCallback(()=>{$r.debug("handleDragStart"),fe.startDragging()},[]),b=C.useCallback(T=>{var{destination:x,source:F}=T;if($r.debug("handleDragEnd",x,F),fe.stopDragging(),x!==null){var G=x.index;F.index<x.index&&(G+=1);var A=[...a],B=fe.reorder(A,h,A,G),H=fe.adjustDestinationIndex(G,h),W=[[H,H+B.length-1]];m(A),p(W)}},[m,a,h,p]),w=C.useCallback(T=>{c(T)},[c]),y=C.useCallback(()=>{m([...a,{operation:u,selected:[],invert:!0}],[u])},[a,u,m]),O=C.useCallback(T=>{var[x,F]=a.reduce((G,A,B)=>{var[H,W]=G;return B===T?W.push(A.operation):H.push(A),[H,W]},[[],[]]);m(x,[],F)},[a,m]),P=C.useCallback(T=>{p(T)},[p]),D=C.useCallback(T=>{var x=a[T];nr.isRollupOperation(x.operation)||n(x)},[a,n]),E=C.useCallback(T=>{g(T==="true")},[g]);C.useEffect(function(){l.length>0&&!l.includes(u)&&c(l[0])},[l,u]);var I=C.useCallback(T=>{var{item:x,itemIndex:F,isClone:G=!1,selectedCount:A}=T,B=x.operation,H=G?"".concat(A):void 0,W=G?"item-list-item-clone":void 0,ve=nr.isRollupOperation(x.operation),Me=nr.isRollupProhibited(x.operation),Le=!G&&!ve;return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:V("item-list-item-content","draggable-item-list-item-content",W),children:[d.jsxs("span",{className:"title",children:[B,!e&&ve&&d.jsxs("span",{className:"small text-warning",children:[d.jsx(K,{icon:Fr})," Requires rollup"]}),e&&Me&&d.jsxs("span",{className:"small text-warning",children:[d.jsx(K,{icon:Fr})," Not available on rollups"]})]}),se.renderBadge({text:H}),se.renderHandle()]}),!G&&d.jsxs(d.Fragment,{children:[d.jsx(M,{kind:"ghost",className:"btn-edit",icon:Xt,tooltip:"Edit Columns",onClick:()=>n(x),disabled:!Le}),d.jsx(M,{kind:"ghost",className:"btn-delete",icon:Ge,tooltip:"Delete Aggregation",onClick:()=>O(F)})]})]})},[O,n,e]),j=l.length>0,N=a.length>0;return d.jsxs("div",{className:"aggregations",children:[j&&d.jsxs("div",{className:"form-inline",children:[d.jsx(cr,{onChange:w,value:u,children:l.map(T=>d.jsx(Fn,{value:T,children:T},T))}),d.jsxs("button",{type:"button",className:"btn btn-link btn-add",onClick:y,children:[d.jsx(K,{icon:Tr}),"Add Aggregation"]})]}),j&&N&&d.jsx("hr",{}),N&&d.jsxs(d.Fragment,{children:[!e&&d.jsxs("div",{children:[d.jsx("label",{id:"placement-options-label",children:"Placement: "}),d.jsxs(wr,{"aria-labelledby":"placement-options-label",marginStart:"size-125",orientation:"horizontal",onChange:E,value:"".concat(s),children:[d.jsx(Te,{value:"true",children:"Top"}),d.jsx(Te,{value:"false",children:"Bottom"})]})]}),d.jsx(Or,{onDragStart:f,onDragEnd:b,children:d.jsx(se,{className:"selected-aggregations",itemCount:a.length,items:a,renderItem:I,offset:0,onSelectionChange:P,onSelect:D,selectedRanges:h,isMultiSelect:!0})})]})]})}function Br(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function be(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Br(Object(r),!0).forEach(function(i){Jn(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Br(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Jn(t,e,r){return(e=eo(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eo(t){var e=ro(t,"string");return typeof e=="symbol"?e:e+""}function ro(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ae;(function(t){t[t.NONE=0]="NONE",t[t.ASCENDING=1]="ASCENDING",t[t.DESCENDING=2]="DESCENDING"})(ae||(ae={}));var to=30;function zl(t){var{aggregation:e,columns:r,onChange:i}=t,[n,o]=C.useState(-1),[a,s]=C.useState(-1),[l,u]=C.useState(ae.NONE),{invert:c,selected:h}=e,p=C.useRef(null),v=C.useCallback(D=>h.includes(D)?!c:c,[c,h]),m=C.useMemo(()=>{var D=Nn(r,e.operation);return l!==ae.NONE&&(D=$.sortColumns(D,l===ae.ASCENDING)),D},[r,e.operation,l]),g=C.useMemo(()=>n>=0?m.slice(n,a+1).map(D=>({value:D.name,displayValue:D.name,isSelected:v(D.name)})):[],[m,v,a,n]),f=C.useCallback(D=>{var{name:E}=m[D],I=h.indexOf(E),j=[...h],N=c;I>=0?j.splice(I,1):(j.push(E),j.length===m.length&&(j=[],N=!c)),i(be(be({},e),{},{selected:j,invert:N}))},[e,c,m,h,i]),b=C.useCallback(()=>{u(ae.NONE),i(be(be({},e),{},{selected:[],invert:!0}))},[e,i]),w=C.useCallback((D,E)=>{o(D),s(E)},[o,s]),y=C.useCallback(()=>{h.length===0?i(be(be({},e),{},{invert:!c})):i(be(be({},e),{},{selected:[],invert:!0}))},[e,c,i,h]),O=h.length===0?c:null,P=h.length!==0||!c||l!==ae.NONE;return d.jsxs("div",{role:"menu",className:"aggregation-edit",children:[d.jsx("div",{className:"top-menu",children:d.jsxs("div",{className:"form-inline",children:[d.jsx(je,{checked:O,onChange:y,children:"Toggle All"}),d.jsx("div",{className:"spacer"}),d.jsx(wi,{in:P,timeout:J.transitionSlowMs,mountOnEnter:!0,unmountOnExit:!0,children:d.jsx(M,{kind:"ghost",className:"btn-reset",onClick:b,children:"Reset"})}),d.jsx(M,{kind:"ghost",className:V({active:l===ae.ASCENDING}),icon:Pr,tooltip:"Sort ascending",onClick:()=>u(ae.ASCENDING)}),d.jsx(M,{kind:"ghost",className:V({active:l===ae.DESCENDING}),icon:xr,tooltip:"Sort descending",onClick:()=>u(ae.DESCENDING)})]})}),d.jsx("div",{className:"aggregation-edit-item-list",children:d.jsx(Oi,{itemCount:m.length,items:g,offset:n,renderItem:D=>{var{item:E}=D;return d.jsx(je,{checked:v(E.value),children:E.displayValue})},onSelect:f,onViewportChange:w,rowHeight:to,focusSelector:"input",ref:p})})]})}function Hr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Wr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Hr(Object(r),!0).forEach(function(i){io(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Hr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function io(t,e,r){return(e=no(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function no(t){var e=oo(t,"string");return typeof e=="symbol"?e:e+""}function oo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ao(t){return d.jsx("svg",Wr(Wr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:d.jsxs("g",{fill:"none",fillRule:"evenodd",children:[d.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),d.jsx("path",{fill:"#7DA4FF",d:"M8 26h4v15H8zM15 17h4v24h-4zM22 21h4v20h-4zM29 17h4v24h-4zM36 11h4v30h-4z"})]})}))}function zr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Vr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zr(Object(r),!0).forEach(function(i){so(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function so(t,e,r){return(e=lo(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function lo(t){var e=uo(t,"string");return typeof e=="symbol"?e:e+""}function uo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function co(t){return d.jsx("svg",Vr(Vr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:d.jsxs("g",{fill:"none",fillRule:"evenodd",children:[d.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),d.jsx("path",{fill:"#7DA4FF",d:"M7 34h4v8H7zM12 31h4v11h-4zM17 27h4v15h-4zM22 22h4v20h-4zM27 27h4v15h-4zM32 29h4v13h-4zM37 31h4v11h-4z"})]})}))}function Kr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Qr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Kr(Object(r),!0).forEach(function(i){ho(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Kr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function ho(t,e,r){return(e=vo(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vo(t){var e=mo(t,"string");return typeof e=="symbol"?e:e+""}function mo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function po(t){return d.jsx("svg",Qr(Qr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:d.jsxs("g",{fill:"none",fillRule:"evenodd",children:[d.jsx("path",{fill:"#C1C0C0",d:"M4 4h1v40H4zM44 43v1H5v-1z"}),d.jsx("path",{stroke:"#7DA4FF",d:"M7.984 32.44l7.982-11.378 5.273 3.739 9.952-10.838 2.826 1.894 7.45-5.802"}),d.jsx("path",{stroke:"#BECDEF",d:"M8.244 37.926L17 33.496l5 .87 10.637-10.35 10.615-1.381"})]})}))}function qr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Xr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qr(Object(r),!0).forEach(function(i){fo(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function fo(t,e,r){return(e=go(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function go(t){var e=bo(t,"string");return typeof e=="symbol"?e:e+""}function bo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yo(t){return d.jsx("svg",Xr(Xr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:d.jsxs("g",{fill:"none",fillRule:"evenodd",children:[d.jsx("path",{d:"M24 10c7.732 0 14 6.268 14 14s-6.268 14-14 14-14-6.268-14-14h14V10z",fill:"#80A6FF"}),d.jsx("path",{d:"M10 24c0-7.732 6.268-14 14-14v14H10z",fill:"#C1C0C0"})]})}))}function Yr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Zr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Yr(Object(r),!0).forEach(function(i){Co(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Yr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Co(t,e,r){return(e=So(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function So(t){var e=wo(t,"string");return typeof e=="symbol"?e:e+""}function wo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Oo(t){return d.jsx("svg",Zr(Zr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:d.jsxs("g",{fill:"none",fillRule:"evenodd",children:[d.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),d.jsx("path",{fill:"#939293",d:"M44 34v1H4v-1zM44 25v1H4v-1zM44 16v1H4v-1z"}),d.jsx("circle",{fill:"#7DA4FF",cx:9.5,cy:37.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:16.5,cy:30.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:22.5,cy:36.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:28.5,cy:30.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:15.5,cy:38.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:23.5,cy:25.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:19.5,cy:19.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:29.5,cy:19.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:32.5,cy:26.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:36.5,cy:13.5,r:1.5})]})}))}function Jr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function et(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Jr(Object(r),!0).forEach(function(i){jo(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Jr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function jo(t,e,r){return(e=To(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function To(t){var e=Po(t,"string");return typeof e=="symbol"?e:e+""}function Po(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Vl(t){return d.jsxs("svg",et(et({width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{},{children:[d.jsx("rect",{width:"48",height:"48",fill:"none"}),d.jsx("rect",{x:"26",y:"10",width:"15",height:"4",fill:"#9FDE70"}),d.jsx("rect",{x:"26",y:"22",width:"15",height:"4",fill:"#9FDE70"}),d.jsx("rect",{x:"26",y:"28",width:"15",height:"4",fill:"#FFD95C"}),d.jsx("rect",{x:"26",y:"34",width:"15",height:"4",fill:"#9FDE70"})]}))}function rt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function tt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?rt(Object(r),!0).forEach(function(i){xo(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):rt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function xo(t,e,r){return(e=Do(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Do(t){var e=No(t,"string");return typeof e=="symbol"?e:e+""}function No(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Kl(t){return d.jsxs("svg",tt(tt({width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{},{children:[d.jsx("rect",{width:"48",height:"48",fill:"none"}),d.jsx("rect",{x:"4",y:"16",width:"40",height:"4",fill:"#FFD95C"}),d.jsx("rect",{x:"4",y:"10",width:"40",height:"4",fill:"#78DCE8"}),d.jsx("rect",{x:"4",y:"34",width:"40",height:"4",fill:"#78DCE8"})]}))}var it=le.module("ChartBuilder");class de extends C.PureComponent{static getMaxSeriesCount(e,r){switch(r){case e.plot.SeriesPlotStyle.PIE:return 1;case e.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static makeSeriesItem(e){return{id:Fe(),value:e}}static makeDefaultSeriesItems(e,r,i){var n=de.getMaxSeriesCount(e,r);if(n===0||i==null||i.length===0)return[];var o=i.length>1?i[1].name:i[0].name;return[de.makeSeriesItem(o)]}static getDefaultXAxis(e,r){return r!=null&&r.length>0?r[0].name:null}constructor(e){super(e),Vt(this);var{model:r}=e,{columns:i,dh:n}=r,o=this.getTypes()[0],a=de.getDefaultXAxis(o,i),s=de.makeDefaultSeriesItems(n,o,i);this.state={type:o,seriesItems:s,xAxis:a,isLinked:!0}}getTypes(){var{model:e}=this.props,{dh:r}=e;return[r.plot.SeriesPlotStyle.LINE,r.plot.SeriesPlotStyle.BAR,r.plot.SeriesPlotStyle.SCATTER,r.plot.SeriesPlotStyle.PIE]}getTypeName(e){var{model:r}=this.props,{dh:i}=r;switch(e){case i.plot.SeriesPlotStyle.LINE:return"Line";case i.plot.SeriesPlotStyle.BAR:return"Bar";case i.plot.SeriesPlotStyle.SCATTER:return"Scatter";case i.plot.SeriesPlotStyle.PIE:return"Pie";case i.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return e}}getTypeIcon(e){var{model:r}=this.props,{dh:i}=r;switch(e){case i.plot.SeriesPlotStyle.LINE:return d.jsx(po,{});case i.plot.SeriesPlotStyle.BAR:return d.jsx(ao,{});case i.plot.SeriesPlotStyle.SCATTER:return d.jsx(Oo,{});case i.plot.SeriesPlotStyle.PIE:return d.jsx(yo,{});case i.plot.SeriesPlotStyle.HISTOGRAM:return d.jsx(co,{});default:return null}}getXAxisLabel(e){var{model:r}=this.props,{dh:i}=r;switch(e){case i.plot.SeriesPlotStyle.PIE:return"Labels";case i.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}getSeriesLabel(e){var{model:r}=this.props,{dh:i}=r;switch(e){case i.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}handleAddSeries(){this.setState(e=>{var{seriesItems:r}=e,i=[...r],{model:n}=this.props,{columns:o}=n;return i.push({id:Fe(),value:o[0].name}),{seriesItems:i}},this.sendChange)}handleLinkStateChange(e){this.setState({isLinked:e==="true"},this.sendChange)}handleReset(){var{model:e}=this.props,{columns:r,dh:i}=e,n=this.getTypes()[0],o=de.getDefaultXAxis(n,r),a=de.makeDefaultSeriesItems(i,n,r),s=!0;this.setState({type:n,seriesItems:a,xAxis:o,isLinked:s},this.sendChange)}handleSeriesChange(e,r){var i=e;this.setState(n=>{var{seriesItems:o}=n;return o=[...o],o[r].value=i,{seriesItems:o}},this.sendChange)}handleSeriesDeleteClick(e){this.setState(r=>{var{seriesItems:i}=r,n=[...i];return n.splice(e,1),{seriesItems:n}},this.sendChange)}handleSubmit(e){e.preventDefault();var{onSubmit:r}=this.props,{type:i,seriesItems:n,xAxis:o,isLinked:a}=this.state,s=n.map(l=>l.value);r({type:i,series:s,xAxis:o,isLinked:a})}handleTypeClick(e){var r=this.getTypes()[e];it.debug2("handleTypeSelect",r),this.setState(i=>{var{model:n}=this.props,{dh:o}=n,a=de.getMaxSeriesCount(o,r),{seriesItems:s}=i;if(s=s.slice(0,a),s.length===0&&a>0){var{columns:l}=n;s=de.makeDefaultSeriesItems(o,r,l)}return{type:r,seriesItems:s}},this.sendChange)}handleXAxisChange(e){var r=e;it.debug2("x-axis change",r),this.setState({xAxis:r},this.sendChange)}sendChange(){var{onChange:e}=this.props,{isLinked:r,type:i,seriesItems:n,xAxis:o}=this.state,a=n.map(s=>s.value);e({type:i,series:a,xAxis:o,isLinked:r})}render(){var{model:e}=this.props,{columns:r,dh:i}=e,{seriesItems:n,type:o,xAxis:a,isLinked:s}=this.state,l=de.getMaxSeriesCount(i,o),u=this.getXAxisLabel(o),c=this.getSeriesLabel(o),h=n.length>0,p=n.length<l;return d.jsx("div",{className:"chart-builder",children:d.jsxs("form",{onSubmit:this.handleSubmit,children:[d.jsxs("div",{className:"form-row",children:[d.jsx("label",{children:"Select Chart Type"}),d.jsx("div",{className:"form-row",children:this.getTypes().map((v,m)=>{var g=v;return d.jsx("div",{className:"col col-chart-type",children:d.jsxs("button",{type:"button",className:V("btn","btn-icon","btn-chart-type",{active:v===o}),onClick:()=>this.handleTypeClick(m),children:[this.getTypeIcon(v),this.getTypeName(v)]})},g)})})]}),d.jsx("hr",{}),d.jsxs("div",{className:"form-row form-inline",children:[d.jsx("label",{className:"col-2 label-left",children:u}),d.jsx(cr,{className:"form-control select-x-axis col",value:a,onChange:this.handleXAxisChange,children:r.map(v=>d.jsx("option",{value:v.name,children:v.name},v.name))})]}),h&&d.jsx("hr",{}),n.map((v,m)=>d.jsxs("div",{className:"form-row form-inline form-series-item","data-testid":"form-series-item-".concat(m),children:[d.jsx("label",{className:"col-2 label-left",children:m===0?c:""}),d.jsx(cr,{className:"form-control select-series col",value:v.value,onChange:g=>this.handleSeriesChange(g,m),"data-testid":"select-series-item-".concat(m),children:r.map(g=>d.jsx("option",{value:g.name,children:g.name},g.name))}),n.length>1&&d.jsx(M,{kind:"ghost",className:"btn-delete-series ml-2 px-2","data-testid":"delete-series-".concat(m),onClick:()=>{this.handleSeriesDeleteClick(m)},icon:Ge,tooltip:"Delete"})]},v.id)),p&&d.jsxs("div",{className:"form-row",children:[d.jsx("div",{className:"col-2"}),d.jsx(M,{kind:"ghost",className:"btn-add-series mt-1",onClick:this.handleAddSeries,icon:Tr,children:"Add Series"})]}),d.jsxs("div",{className:"form-row chart-builder-link",children:[d.jsx("label",{className:"col-2 label-right",children:d.jsxs("div",{className:"fa-md fa-layers",children:[d.jsx(K,{mask:tn,icon:Yt,transform:"right-5 down-5"}),d.jsx(K,{icon:s?nn:on,transform:"grow-2 right-8 down-6"})]})}),d.jsxs(wr,{"aria-label":"Link state options",orientation:"horizontal",onChange:this.handleLinkStateChange,value:"".concat(s),children:[d.jsx(Te,{value:"true",children:"Sync State"}),d.jsx(Te,{value:"false",children:"Freeze State"})]})]}),d.jsxs("div",{className:"form-row",children:[d.jsx("div",{className:"col-2 label-right"}),d.jsx("div",{className:"col chart-builder-link-info",children:s?"Charts with synced state will update to match any filters or user modifications applied to the parent table.":"Freeze State disconnects the chart state from the parent table. New filters or user modifications on the parent table will not be applied."})]}),d.jsxs("div",{className:V("form-row","justify-content-end","my-3"),children:[d.jsx(M,{kind:"secondary",className:"btn-reset",onClick:this.handleReset,children:"Reset"}),d.jsx(M,{kind:"primary",type:"submit",className:"btn-submit",children:"Create"})]})]})})}}function nt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Eo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nt(Object(r),!0).forEach(function(i){Ze(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Ze(t,e,r){return(e=Io(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Io(t){var e=Ro(t,"string");return typeof e=="symbol"?e:e+""}function Ro(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ai extends C.Component{constructor(e){super(e),Ze(this,"editorContainer",void 0),Ze(this,"editor",void 0),this.handleContentChanged=this.handleContentChanged.bind(this),this.handleEditorFocus=this.handleEditorFocus.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleContainerClick=this.handleContainerClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.state={isEditorFocused:!1,isEditorEmpty:!0},this.editorContainer=null}componentDidMount(){this.initEditor()}componentWillUnmount(){this.destroyEditor()}initEditor(){var e,{value:r,editorSettings:i}=this.props,n=Eo({copyWithSyntaxHighlighting:"false",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"groovyDB",lineDecorationsWidth:8,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},scrollBeyondLastLine:!1,padding:{top:6,bottom:6},tabCompletion:"off",useTabStops:!0,value:r,wordWrap:"on",automaticLayout:!0,autoClosingBrackets:"beforeWhitespace"},i);if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=Hn.create(this.editorContainer,n),this.editor.layout(),(e=this.editor.getModel())===null||e===void 0||e.updateOptions({tabSize:0}),this.editor.onKeyDown(this.handleKeyDown),this.editor.onDidChangeModelContent(this.handleContentChanged),this.editor.onDidFocusEditorText(this.handleEditorFocus),this.editor.onDidBlurEditorText(this.handleEditorBlur)}destroyEditor(){var e;(e=this.editor)===null||e===void 0||e.dispose(),this.editor=void 0}handleContentChanged(){var e,r,{onContentChanged:i}=this.props,n=(e=this.editor)===null||e===void 0||(r=e.getModel())===null||r===void 0?void 0:r.getValue();n!==void 0&&this.setState({isEditorEmpty:n.length===0}),i(n)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var e,r,i,n=(e=(r=this.editor)===null||r===void 0||(i=r.getModel())===null||i===void 0?void 0:i.getValue())!==null&&e!==void 0?e:"";this.setState({isEditorEmpty:n.length===0,isEditorFocused:!1})}handleContainerClick(){var e,{isEditorFocused:r}=this.state;r||(e=this.editor)===null||e===void 0||e.focus()}handleKeyDown(e){var{onTab:r,editorIndex:i}=this.props;e.code==="Tab"&&(e.stopPropagation(),e.preventDefault(),r(i,e.shiftKey))}render(){var{className:e,invalid:r,placeholder:i="",value:n}=this.props,{isEditorFocused:o,isEditorEmpty:a}=this.state;return d.jsxs("div",{className:V("input-editor-wrapper",{focused:o,invalid:r},e),role:"presentation",onClick:this.handleContainerClick,children:[d.jsx("div",{className:"editor-container",ref:s=>{this.editorContainer=s},"data-testid":"custom-column-formula"}),a&&!n&&i.length>0&&d.jsx("div",{className:"editor-placeholder text-muted",children:i})]})}}Ze(ai,"defaultProps",{value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1});function ot(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Ue(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ot(Object(r),!0).forEach(function(i){ko(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ot(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function ko(t,e,r){return(e=Ao(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ao(t){var e=Fo(t,"string");return typeof e=="symbol"?e:e+""}function Fo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var at=Object.freeze({NAME:"name",FORMULA:"formula"}),Go=()=>{};function Mo(t){var{eventKey:e,name:r,inputIndex:i,formula:n,onChange:o,onDeleteColumn:a,onTabInEditor:s,invalid:l,isDuplicate:u}=t,c=r===""||Sr.isValidColumnName(r),h=C.useCallback(p=>{p!==void 0&&(p.replace(/(\r\n|\n|\r)/gm,""),o(e,at.FORMULA,p))},[o,e]);return d.jsx(Li,{draggableId:e,index:i,disableInteractiveElementBlocking:!0,children:(p,v)=>d.jsxs("div",Ue(Ue({className:V("draggable-container",{dragging:v.isDragging}),ref:p.innerRef},p.draggableProps),{},{children:[d.jsxs("div",{className:"custom-column-input-container",children:[d.jsxs("div",{className:"pb-3",children:[d.jsxs("div",{className:"d-flex flex-row custom-column-name",children:[d.jsx("input",{className:V("form-control custom-column-input",{"is-invalid":l||!c||u}),placeholder:"Column Name",value:r,onChange:m=>{o(e,at.NAME,m.target.value)}}),d.jsx(M,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{a(e)},icon:Ge,tooltip:"Delete custom column"}),d.jsx(M,Ue(Ue({kind:"ghost",className:"btn-drag-handle",onClick:Go},p.dragHandleProps),{},{icon:Zt,tooltip:"Drag column to re-order"}))]}),(!c||u)&&d.jsx("p",{className:"validate-label-error text-danger mb-0 mt-2 pl-1",children:c?"Duplicate name":"Invalid name"})]}),d.jsx(ai,{editorSettings:{language:"deephavenDb"},editorIndex:i,placeholder:"Column Formula",value:n,onContentChanged:h,onTab:s,invalid:l})]}),d.jsx("hr",{})]}))})}function Lo(t){return(t==null?void 0:t.isDeletable)!==void 0}function st(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function or(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?st(Object(r),!0).forEach(function(i){Ne(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):st(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Ne(t,e,r){return(e=_o(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _o(t){var e=Uo(t,"string");return typeof e=="symbol"?e:e+""}function Uo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Oe extends C.Component{static makeCustomColumnInputEventKey(){return Fe()}static createCustomColumnInput(){return{eventKey:Fe(),name:"",formula:""}}constructor(e){super(e),Ne(this,"container",void 0),Ne(this,"successButtonTimer",void 0),Ne(this,"getInput",Ir((r,i)=>r.find(n=>n.eventKey===i))),Ne(this,"getInputIndex",Ir((r,i)=>r.findIndex(n=>n.eventKey===i))),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleSaveClick=this.handleSaveClick.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleCustomColumnUpdated=this.handleCustomColumnUpdated.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.resetRequestFailed=this.resetRequestFailed.bind(this),this.handleEditorTabNavigation=this.handleEditorTabNavigation.bind(this),this.state={inputs:[],isCustomColumnApplying:!1,errorMessage:null,hasRequestFailed:!1,isSuccessShowing:!1},this.container=null,this.successButtonTimer=null}componentDidMount(){var{customColumns:e}=this.props;this.parseCustomColumns(e),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){var{model:e}=this.props;e.addEventListener(xe.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.addEventListener(xe.EVENT.UPDATED,this.handleCustomColumnUpdated),e.addEventListener(xe.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){var{model:e}=this.props;e.removeEventListener(xe.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.removeEventListener(xe.EVENT.UPDATED,this.handleCustomColumnUpdated),e.removeEventListener(xe.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(e){if(e.length>0){var r=e.map(i=>{var n=i.split(/=(.+)/,2);return{eventKey:Oe.makeCustomColumnInputEventKey(),name:n[0],formula:n[1]}});this.setState({inputs:r})}else this.setState({inputs:[Oe.createCustomColumnInput()]})}handleAddColumnClick(){var{inputs:e}=this.state,r=[...e];r.push(Oe.createCustomColumnInput()),this.setState({inputs:r})}handleDeleteColumn(e){var{inputs:r}=this.state,i=this.getInputIndex(r,e),n=[...r];n.splice(i,1),n.length===0&&n.push(Oe.createCustomColumnInput()),this.setState({inputs:n})}handleInputChange(e,r,i){var{inputs:n}=this.state,o=this.getInputIndex(n,e),a=this.getInput(n,e),s=or({},a);s[r]=i;var l=[...n];l.splice(o,1,s),this.setState({inputs:l})}handleCustomColumnUpdated(){var{isCustomColumnApplying:e}=this.state;e&&this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),Oe.SUCCESS_SHOW_DURATION)})}handleRequestFailed(e){var r=e,{isCustomColumnApplying:i}=this.state;i&&this.setState({isCustomColumnApplying:!1,errorMessage:d.jsxs(d.Fragment,{children:[d.jsxs("p",{children:[d.jsx(K,{icon:qe})," Failed to apply custom columns."]}),d.jsxs("div",{className:"error-box",children:[r.detail.errorMessage,d.jsx("br",{}),"Table configuration:"," ",JSON.stringify(r.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(e){if(fe.stopDragging(),!!e.destination){var{inputs:r}=this.state,i=e.source.index,n=e.destination.index,o=[...r],a=r[i];o.splice(i,1),o.splice(n,0,a),this.setState({inputs:o})}}handleEditorTabNavigation(e,r){var{inputs:i}=this.state;if(r){var n;((n=this.container)===null||n===void 0?void 0:n.querySelectorAll(".btn-drag-handle")[e]).focus();return}if(e===i.length-1){var o,a;(o=this.container)===null||o===void 0||(a=o.querySelector(".btn-add-column"))===null||a===void 0||a.focus()}else{var s,l=e+1;((s=this.container)===null||s===void 0?void 0:s.querySelectorAll(".custom-column-input")[l]).focus()}}handleSaveClick(){var{onSave:e,customColumns:r}=this.props,{inputs:i,isCustomColumnApplying:n}=this.state;if(!n){var o=[];i.forEach(a=>{var{name:s,formula:l}=a;s&&l&&o.push("".concat(s,"=").concat(l))}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:o.length>0||r.length>0}),e(o)}}resetRequestFailed(){this.setState(e=>{var{hasRequestFailed:r}=e;return r?{hasRequestFailed:!1}:null})}renderInputs(){var{inputs:e,hasRequestFailed:r}=this.state,i=new Map;return e.forEach(n=>{var o,{name:a}=n;return i.set(a,((o=i.get(a))!==null&&o!==void 0?o:0)+1)}),e.map((n,o)=>{var a,{eventKey:s,name:l,formula:u}=n,c=((a=i.get(l))!==null&&a!==void 0?a:0)>1;return d.jsx(Mo,{inputIndex:o,eventKey:s,name:l,formula:u,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:r,isDuplicate:c},s)})}renderSaveButton(){var{inputs:e,isCustomColumnApplying:r,isSuccessShowing:i}=this.state,n=e.length>1?"Save Columns":"Save Column",o=e.every(l=>{var{name:u}=l;return u===""||Sr.isValidColumnName(u)}),a=e.filter(l=>{var{name:u}=l;return u!==""}).map(l=>{var{name:u}=l;return u}),s=new Set(a).size===a.length;return d.jsxs(M,{kind:i?"success":"primary",className:V("btn-apply",{"btn-spinner":r}),disabled:i||r||!o||!s,onClick:this.handleSaveClick,icon:i?an:void 0,children:[r&&d.jsxs("span",{children:[d.jsx(Jt,{className:"mr-2 loading-spinner-vertical-align"}),d.jsx("span",{className:"btn-normal-content",children:"Applying"})]}),!i&&!r&&n,i&&"Success"]})}render(){var{onCancel:e}=this.props,{errorMessage:r}=this.state;return d.jsxs("div",{role:"presentation",className:"custom-column-builder-container",ref:i=>{this.container=i},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[d.jsx("hr",{}),d.jsx(Or,{onDragStart:fe.startDragging,onDragEnd:this.handleDragEnd,children:d.jsx(qt,{droppableId:"droppable-custom-columns",children:(i,n)=>d.jsxs("div",or(or({ref:i.innerRef},i.droppableProps),{},{className:V("droppable-container",{dragging:n.draggingFromThisWith}),children:[this.renderInputs(),i.placeholder]}))})}),d.jsx("div",{className:"pt-1 px-3",children:d.jsx(M,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,icon:Tr,children:"Add Another Column"})}),d.jsxs("div",{className:"custom-column-builder-footer",children:[r&&d.jsx("div",{className:"error-message",children:r}),d.jsxs("div",{className:"d-flex justify-content-end",children:[d.jsx(M,{kind:"secondary",className:"mr-2",onClick:e,children:"Cancel"}),this.renderSaveButton()]})]})]})}}Ne(Oe,"SUCCESS_SHOW_DURATION",750);var br;(function(t){t.ADVANCED_SETTINGS="ADVANCED_SETTINGS",t.AGGREGATIONS="AGGREGATIONS",t.AGGREGATION_EDIT="AGGREGATIONS_EDIT",t.CHART_BUILDER="CHART_BUILDER",t.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",t.QUICK_FILTERS="QUICK_FILTERS",t.ROLLUP_ROWS="ROLLUP_ROWS",t.SEARCH_BAR="SEARCH_BAR",t.SELECT_DISTINCT="SELECT_DISTINCT",t.TABLE_EXPORTER="TABLE_EXPORTER",t.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",t.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",t.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",t.GOTO="GOTO"})(br||(br={}));const Ql=br;function lt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function ut(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?lt(Object(r),!0).forEach(function(i){Se(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Se(t,e,r){return(e=$o(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $o(t){var e=Bo(t,"string");return typeof e=="symbol"?e:e+""}function Bo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ie=le.module("RollupRows"),Ho=150,$e="grouped-rollup-rows",Be="ungrouped-rollup-rows";class re extends C.Component{static renderColumn(e){var{item:r,isClone:i,selectedCount:n}=e,o=r==null?void 0:r.name,a=i!==void 0&&i?"".concat(n):void 0,s=i!==void 0&&i?"item-list-item-clone":"";return se.renderTextItem({text:o,badgeText:a,className:s})}static addGroupings(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length;if(r==null||r.length===0)return e;var n=i,o=e.filter((a,s)=>r.includes(a)?(s<n&&(n-=1),!1):!0);return o.splice(n,0,...r),o}static isGroupable(e){return!$.isBigDecimalType(e.type)&&!$.isBigIntegerType(e.type)}constructor(e){super(e),Se(this,"ungroupedList",void 0),Se(this,"groupedList",void 0),Se(this,"search",jr(a=>{for(var s=this.getSortedUngroupedColumns(),l=[],u=null,c=0;c<s.length;c+=1){var h=s[c];h.name.toLowerCase().includes(a.toLowerCase())&&(u==null&&(u=c),l.push([c,c]))}R(u),this.setState({ungroupedSelectedRanges:l}),l.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(u)},Ho)),Se(this,"getCachedUngroupedColumns",ye((a,s)=>a.filter(l=>re.isGroupable(l)&&s.find(u=>u===l.name)==null),{max:100})),Se(this,"getCachedSortedColumns",ye((a,s)=>s==null?[...a]:$.sortColumns(a,s===re.SORT.ASCENDING),{max:100})),this.handleDeleteClicked=this.handleDeleteClicked.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUngroupedSelect=this.handleUngroupedSelect.bind(this),this.handleUngroupedSelectionChange=this.handleUngroupedSelectionChange.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupedSelectionChange=this.handleGroupedSelectionChange.bind(this),this.handleShowConstituentsChange=this.handleShowConstituentsChange.bind(this),this.handleShowNonAggregatedColumnsChange=this.handleShowNonAggregatedColumnsChange.bind(this),this.handleSortAscending=this.handleSortAscending.bind(this),this.handleSortDescending=this.handleSortDescending.bind(this),this.renderGroupedItem=this.renderGroupedItem.bind(this),this.ungroupedList=vr.createRef(),this.groupedList=vr.createRef();var{config:r}=e,{columns:i=[],showConstituents:n=!0,showNonAggregatedColumns:o=!0}=r??{};this.state={ungroupedSelectedRanges:[],columns:i,groupedSelectedRanges:[],searchFilter:"",showConstituents:n,showNonAggregatedColumns:o,dragSource:null,sort:null}}componentDidUpdate(e,r){var{config:i}=this.props,{columns:n,showConstituents:o,showNonAggregatedColumns:a}=this.state;i!==e.config?this.updateFromConfig():(n!==r.columns||o!==r.showConstituents||a!==r.showNonAggregatedColumns)&&(i==null||n!==i.columns||o!==i.showConstituents||a!==i.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(e){var r=e.target.value;if(this.setState({searchFilter:r}),!r){this.search.cancel(),this.resetSelection();return}this.search(r)}handleSortAscending(){this.setState(e=>{var{sort:r}=e;return{sort:r===re.SORT.ASCENDING?null:re.SORT.ASCENDING}})}handleSortDescending(){this.setState(e=>{var{sort:r}=e;return{sort:r===re.SORT.DESCENDING?null:re.SORT.DESCENDING}})}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(e){Ie.debug("handleDragStart",e),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:e.source})}handleDragEnd(e){Ie.debug("handleDragEnd",e),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});var{destination:r,source:i}=e;if(!(r==null||i==null)){if(r.droppableId===Be){this.setState(a=>{var{groupedSelectedRanges:s,columns:l}=a,u=[...l];return fe.reorder(u,s,[],0),{columns:u,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}var n=i.droppableId===$e,o=r.index;n&&i.index<r.index&&(o+=1),this.setState(a=>{var{columns:s,ungroupedSelectedRanges:l,groupedSelectedRanges:u}=a,c=[...s],h=n?c:this.getSortedUngroupedColumns().map(f=>f.name),p=n?u:l,v=fe.reorder(h,p,c,o),m=n?fe.adjustDestinationIndex(o,u):o,g=[[m,m+v.length-1]];return{columns:c,ungroupedSelectedRanges:[],groupedSelectedRanges:g}}),this.resetSelection()}}handleUngroupedSelect(e){Ie.debug("handleUngroupedSelect"),this.setState(r=>{var{columns:i}=r;return{columns:re.addGroupings(i,[this.getSortedUngroupedColumns()[e].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}})}handleUngroupedSelectionChange(e){Ie.debug2("handleUngroupedSelectionChange",e),this.setState(r=>{var{ungroupedSelectedRanges:i}=r;return e===i?null:{ungroupedSelectedRanges:e,groupedSelectedRanges:[]}})}handleGroupedSelectionChange(e){Ie.debug2("handleGroupedSelectedRanges",e),this.setState(r=>{var{groupedSelectedRanges:i}=r;return e===i?null:{groupedSelectedRanges:e,ungroupedSelectedRanges:[]}})}handleDeleteClicked(e){this.setState(r=>{var{columns:i}=r,n=i.slice();return n.splice(e,1),{columns:n}})}handleShowConstituentsChange(){this.setState(e=>{var{showConstituents:r}=e;return{showConstituents:!r}})}handleShowNonAggregatedColumnsChange(){this.setState(e=>{var{showNonAggregatedColumns:r}=e;return{showNonAggregatedColumns:!r}})}updateFromConfig(){var{config:e}=this.props,{columns:r=[],showConstituents:i=!0,showNonAggregatedColumns:n=!0}=e??{};this.setState({columns:r,showConstituents:i,showNonAggregatedColumns:n})}sendChange(){var{onChange:e}=this.props,{columns:r,showConstituents:i,showNonAggregatedColumns:n}=this.state;e({columns:r,showConstituents:i,showNonAggregatedColumns:n})}getUngroupedColumns(){var{model:e}=this.props,{columns:r}=this.state,{originalColumns:i}=e;return this.getCachedUngroupedColumns(i,r)}getSortedUngroupedColumns(){var{sort:e}=this.state,r=this.getUngroupedColumns();return this.getCachedSortedColumns(r,e)}renderGroupedItem(e){var{item:r,itemIndex:i,isClone:n,selectedCount:o}=e,a=n!==void 0&&n?"":"  ".repeat(i),s="".concat(a).concat(r),l=n!==void 0&&n?"".concat(o):void 0,u=n!==void 0&&n?"item-list-item-clone":"";return d.jsxs(d.Fragment,{children:[se.renderTextItem({text:s,badgeText:l,className:u}),(n===void 0||!n)&&d.jsx(M,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(i),children:d.jsx(K,{icon:Ge})})]})}render(){var{columns:e,dragSource:r,searchFilter:i,groupedSelectedRanges:n,ungroupedSelectedRanges:o,showConstituents:a,showNonAggregatedColumns:s,sort:l}=this.state,u=this.getSortedUngroupedColumns(),c=e.length*se.DEFAULT_ROW_HEIGHT;(r==null?void 0:r.droppableId)===Be&&(c+=se.DEFAULT_ROW_HEIGHT);var h=u.length*se.DEFAULT_ROW_HEIGHT+10,p=Math.min(3*se.DEFAULT_ROW_HEIGHT,h);return d.jsx("div",{role:"menu",className:V("rollup-rows",{"is-dragging":r!=null}),tabIndex:0,children:d.jsxs(Or,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[d.jsxs("div",{className:"rollup-rows-group-by",children:[d.jsx("div",{className:"section-title",children:"Group By"}),e.length===0&&d.jsx(qt,{droppableId:"placeholder",children:(v,m)=>d.jsx("div",ut(ut({className:V("placeholder","text-muted",{"is-dragging-from-this":m.draggingFromThisWith,"is-dragging-over":m.isDraggingOver,"is-dropping":m.draggingOverWith}),ref:v.innerRef},v.droppableProps),{},{children:"To create a rollup, drag columns from the list below and drop them into this area."}))}),e.length>0&&d.jsx(se,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:$e,droppableId:$e,itemCount:e.length,items:e,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:n,style:{height:c},isMultiSelect:!0})]}),d.jsxs("div",{className:"rollup-rows-available-columns",children:[d.jsx("div",{className:"section-title",children:"Available Grouping Columns"}),d.jsxs("div",{className:"top-menu",children:[d.jsx(Kt,{className:"w-100",value:i,matchCount:i?o.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),d.jsxs(M,{kind:"ghost",className:V("btn-link btn-link-icon",{active:l===re.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[d.jsx(K,{icon:Pr}),d.jsx(Xe,{children:"Sort ascending"})]}),d.jsxs(M,{kind:"ghost",className:V("btn-link btn-link-icon",{active:l===re.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[d.jsx(K,{icon:xr}),d.jsx(Xe,{children:"Sort descending"})]})]}),d.jsx(se,{className:"rollup-available-grouping-columns",draggablePrefix:Be,droppableId:Be,itemCount:u.length,items:u,renderItem:re.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:o,style:{maxHeight:h,minHeight:p},isDropDisabled:(r==null?void 0:r.droppableId)!==$e,isMultiSelect:!0}),d.jsxs("div",{className:"bottom-menu",children:[d.jsx("div",{className:"label",children:"Show:"}),d.jsx(je,{checked:a,onChange:this.handleShowConstituentsChange,children:"Constituents"}),d.jsx(je,{checked:s,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}}Se(re,"SORT",Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"}));Se(re,"defaultProps",{config:null,onChange:()=>{}});function dt(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(u){return void r(u)}s.done?e(l):Promise.resolve(l).then(i,n)}function Wo(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(l){dt(o,i,n,a,s,"next",l)}function s(l){dt(o,i,n,a,s,"throw",l)}a(void 0)})}}function ct(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function ht(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ct(Object(r),!0).forEach(function(i){Pe(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ct(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Pe(t,e,r){return(e=zo(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zo(t){var e=Vo(t,"string");return typeof e=="symbol"?e:e+""}function Vo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ko=le.module("TableCsvExporter");class L extends C.Component{static getDateString(e){return e.i18n.DateTimeFormat.format(L.FILENAME_DATE_FORMAT,new Date)}constructor(e){super(e),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadRowOptionChanged=this.handleDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowOptionChanged=this.handleCustomizedDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this),this.handleIncludeColumnHeadersChanged=this.handleIncludeColumnHeadersChanged.bind(this),this.handleIncludeHiddenColumnsChanged=this.handleIncludeHiddenColumnsChanged.bind(this),this.handleUseUnformattedValuesChanged=this.handleUseUnformattedValuesChanged.bind(this);var{model:r,name:i}=e;this.state={fileName:"".concat(i,"-").concat(L.getDateString(r.dh),".csv"),downloadRowOption:L.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,customizedDownloadRowOption:L.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:L.DEFAULT_DOWNLOAD_ROWS,includeColumnHeaders:!0,includeHiddenColumns:!1,useUnformattedValues:!1,errorMessage:null,id:Fe()}}getSnapshotRanges(){var{model:e,selectedRanges:r}=this.props,{downloadRowOption:i,customizedDownloadRowOption:n,customizedDownloadRows:o}=this.state,{rowCount:a,columnCount:s}=e,l=[];switch(i){case L.DOWNLOAD_ROW_OPTIONS.ALL_ROWS:l.push(new q(0,0,s-1,a-1));break;case L.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS:l=r.map(u=>ht(ht({},u),{},{startColumn:0,endColumn:s-1})).sort((u,c)=>u.startRow!=null&&c.startRow!=null?u.startRow-c.startRow:0);break;case L.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS:switch(n){case L.CUSTOMIZED_ROWS_OPTIONS.FIRST:l.push(new q(0,0,s-1,Math.min(o-1,a-1)));break;case L.CUSTOMIZED_ROWS_OPTIONS.LAST:l.push(new q(0,Math.max(0,a-o),s-1,a-1));break}break}return l}getModelRanges(e){var{userColumnWidths:r,movedColumns:i}=this.props,{includeHiddenColumns:n}=this.state,o=ti.getHiddenColumns(r),a=U.getModelRanges(e,i);if(!n&&o.length>0){var s=o.map(q.makeColumn);a=q.subtractRangesFromRanges(a,s)}return a}resetDownloadState(){this.setState({errorMessage:null})}handleDownloadClick(){var e=this;return Wo(function*(){var{model:r,isDownloading:i,onDownloadStart:n,onDownload:o,onCancel:a}=e.props,{fileName:s,includeColumnHeaders:l,useUnformattedValues:u}=e.state;if(i){a();return}e.resetDownloadState();var c=e.getSnapshotRanges(),h=e.getModelRanges(c);if(e.validateOptionInput()){n();try{var p=yield r.export(),v=p.setViewport(0,0);yield v.getViewportData(),o(s,p,v,c,h,l,u)}catch(m){Ko.error("CSV download failed",m),e.setState({errorMessage:d.jsxs("p",{children:[d.jsx(K,{icon:qe})," ","".concat(m)]})}),a()}}})()}handleDownloadRowOptionChanged(e){this.setState({downloadRowOption:e})}handleCustomizedDownloadRowOptionChanged(e){e!==null&&this.setState({customizedDownloadRowOption:String(e)})}handleCustomizedDownloadRowsChanged(e){this.setState({customizedDownloadRows:e})}handleIncludeColumnHeadersChanged(){this.setState(e=>{var{includeColumnHeaders:r}=e;return{includeColumnHeaders:!r}})}handleIncludeHiddenColumnsChanged(){this.setState(e=>{var{includeHiddenColumns:r}=e;return{includeHiddenColumns:!r}})}handleUseUnformattedValuesChanged(){this.setState(e=>{var{useUnformattedValues:r}=e;return{useUnformattedValues:!r}})}validateOptionInput(){var{selectedRanges:e}=this.props,{downloadRowOption:r,customizedDownloadRows:i}=this.state;return r===L.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS&&e.length===0?(this.setState({errorMessage:d.jsxs("p",{children:[d.jsx(K,{icon:qe})," No rows selected. Please select some rows in the table."]})}),!1):r===L.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS&&i<=0?(this.setState({errorMessage:d.jsxs("p",{children:[d.jsx(K,{icon:qe})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){var{model:e,isDownloading:r,tableDownloadProgress:i,tableDownloadEstimatedTime:n,selectedRanges:o,tableDownloadStatus:a}=this.props,{fileName:s,downloadRowOption:l,customizedDownloadRowOption:u,customizedDownloadRows:c,includeColumnHeaders:h,includeHiddenColumns:p,useUnformattedValues:v,errorMessage:m,id:g}=this.state,{rowCount:f}=e;return d.jsxs("div",{className:"table-csv-exporter",children:[d.jsx("div",{id:"download-rows-label",className:"section-title",children:"Download Rows"}),d.jsx("div",{className:"form-group",children:d.jsxs(wr,{"aria-labelledby":"download-rows-label",onChange:this.handleDownloadRowOptionChanged,value:l,isDisabled:r,children:[d.jsxs(Te,{value:L.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",d.jsx("span",{className:"text-muted ml-2",children:"(".concat(f.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")," rows)")})]}),d.jsxs(Te,{value:L.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",d.jsx("span",{className:"text-muted ml-2",children:o.length>0?"(".concat(q.rowCount(o).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")," rows)"):null})]}),d.jsxs("div",{className:"d-flex",children:[d.jsx(Te,{value:L.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",margin:"0","aria-label":"Download a custom number of rows"}),d.jsxs("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadRowOption:L.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS})},children:[d.jsxs(En,{selectedKey:u,"data-testid":"select-csv-exporter-customized-rows",isDisabled:r,onChange:this.handleCustomizedDownloadRowOptionChanged,"aria-label":"First or last number of rows",flex:!0,children:[d.jsx(Rr,{children:"First"},"FIRST"),d.jsx(Rr,{children:"Last"},"LAST")]}),d.jsx(_i,{id:"customizedRows-".concat(g),"data-testid":"input-csv-exporter-customized-rows",name:"customizedRows-".concat(g),minValue:1,defaultValue:100,value:c,width:"100%",minWidth:0,isDisabled:r,onChange:this.handleCustomizedDownloadRowsChanged,"aria-label":"Number of rows to download",flex:!0}),d.jsx("div",{children:"Rows"})]})]})]})}),d.jsxs("div",{className:"form-group",children:[d.jsx("label",{htmlFor:"customizedRows-".concat(g),children:"File Name"}),d.jsx("input",{type:"text",className:"form-control",id:"filename-".concat(g),"data-testid":"input-csv-exporter-file-name",name:"filename-".concat(g),value:s,onChange:b=>{this.setState({fileName:b.target.value})},disabled:r})]}),d.jsxs("div",{className:"checkbox-options",children:[d.jsx(je,{checked:h,onChange:this.handleIncludeColumnHeadersChanged,children:"Include column headers"}),d.jsx(je,{checked:p,onChange:this.handleIncludeHiddenColumnsChanged,children:"Include hidden columns"}),d.jsx(je,{checked:v,onChange:this.handleUseUnformattedValuesChanged,children:"Use unformatted values"})]}),d.jsxs("div",{className:"section-footer flex-column",children:[m!=null&&d.jsx("div",{className:"error-message",children:m}),a&&d.jsxs("div",{className:"download-status",children:[(a===L.DOWNLOAD_STATUS.DOWNLOADING||a===L.DOWNLOAD_STATUS.INITIATING)&&d.jsxs(d.Fragment,{children:[a===L.DOWNLOAD_STATUS.INITIATING&&d.jsx("div",{className:"text-muted",children:"Starting Download..."}),a===L.DOWNLOAD_STATUS.DOWNLOADING&&d.jsxs("div",{className:"text-muted d-flex justify-content-between",children:[d.jsx("span",{children:n||n===0?"Estimated time: ".concat(ji.formatElapsedTime(n)):null}),d.jsx("span",{children:"".concat(i,"%")})]})]}),a===L.DOWNLOAD_STATUS.FINISHED&&d.jsx("div",{className:"text-muted text-right",children:"Download Completed"}),a===L.DOWNLOAD_STATUS.CANCELED&&d.jsx("div",{className:"text-muted",children:"Download Canceled"}),(a===L.DOWNLOAD_STATUS.DOWNLOADING||a===L.DOWNLOAD_STATUS.INITIATING)&&d.jsx("div",{className:"progress",children:d.jsx("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:"".concat(i,"%")}})}),a===L.DOWNLOAD_STATUS.FINISHED&&d.jsx("div",{className:"progress",children:d.jsx("div",{className:"progress-bar bg-success",style:{width:"".concat(i,"%")}})})]}),d.jsxs(M,{kind:"primary","data-testid":"btn-csv-exporter-download",className:V("btn-downloading",{"btn-spinner btn-cancelable":r}),onClick:this.handleDownloadClick,children:[r&&d.jsxs("span",{children:[d.jsx(Jt,{className:"mr-2 loading-spinner-vertical-align"}),d.jsx("span",{className:"btn-normal-content",children:"Downloading"}),d.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!r&&"Download"]})]})]})}}Pe(L,"FILENAME_DATE_FORMAT","yyyy-MM-dd-HHmmss");Pe(L,"DOWNLOAD_STATUS",{INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"});Pe(L,"DOWNLOAD_ROW_OPTIONS",{ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"});Pe(L,"CUSTOMIZED_ROWS_OPTIONS",{FIRST:"FIRST",LAST:"LAST"});Pe(L,"DEFAULT_DOWNLOAD_ROWS",100);Pe(L,"defaultProps",{onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]});function _(t,e,r){return(e=Qo(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qo(t){var e=qo(t,"string");return typeof e=="symbol"?e:e+""}function qo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var pe=le.module("TableSaver"),Xo="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function Yo(t){return t.added!==void 0}function Zo(t){if(!Yo(t))throw new Error("event is not UpdateEventData")}class te extends C.PureComponent{static csvEscapeString(e){return'"'.concat(e.replace(/"/g,'""'),'"')}constructor(e){super(e),_(this,"sw",void 0),_(this,"port",void 0),_(this,"fileWriter",void 0),_(this,"table",void 0),_(this,"tableSubscription",void 0),_(this,"columns",void 0),_(this,"fileName",void 0),_(this,"includeColumnHeaders",void 0),_(this,"useUnformattedValues",void 0),_(this,"chunkRows",void 0),_(this,"gridRanges",void 0),_(this,"gridRangeCounter",void 0),_(this,"rangedSnapshotsTotal",void 0),_(this,"rangedSnapshotCounter",void 0),_(this,"snapshotsTotal",void 0),_(this,"snapshotCounter",void 0),_(this,"snapshotsBuffer",void 0),_(this,"currentSnapshotIndex",void 0),_(this,"snapshotPending",void 0),_(this,"cancelableSnapshots",void 0),_(this,"streamTimeout",void 0),_(this,"snapshotHandlerTimeout",void 0),_(this,"downloadStartTime",void 0),_(this,"iframe",void 0),_(this,"useBlobFallback",void 0),_(this,"getCachedCustomColumnFormatFlag",oi(zn.isCustomColumnFormatDefined,{max:1e4})),this.handlePortMessage=this.handlePortMessage.bind(this),this.handleSnapshotResolved=this.handleSnapshotResolved.bind(this),this.handleDownloadTimeout=this.handleDownloadTimeout.bind(this),this.state={},this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.useBlobFallback=!1}componentDidMount(){var{getDownloadWorker:e}=this.props;e().then(r=>{pe.info("found active service worker"),this.sw=r,this.sw.postMessage("ping")}).catch(r=>{pe.warn("Download csv is not optimized.",r),this.useBlobFallback=!0})}componentWillUnmount(){this.removeIframe(),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(e){var r=this.useBlobFallback,i=[],n=null;r&&(n=TextEncoder.prototype.encode.bind(new TextEncoder));var{fileName:o}=this,a={};return r?(a.write=s=>{R(n),s.header!==void 0&&i.push(n(s.header)),s.rows!==void 0&&i.push(n(s.rows))},a.close=()=>{R(o);var s=new Blob(i,{type:"application/octet-stream; charset=utf-8"}),l=document.createElement("a");l.href=URL.createObjectURL(s),l.download=o,l.click()},a.abort=()=>{e.postMessage({cancel:!0}),e.close()}):(a.write=s=>{e.postMessage(s)},a.close=()=>{e.postMessage({end:!0}),e.close()},a.abort=()=>{e.postMessage({cancel:!0}),e.close()}),new WritableStream(a)}startDownload(e,r,i,n,o,a,s){var{isDownloading:l}=this.props;if(!l){this.downloadStartTime=Date.now(),pe.info("start downloading ".concat(e)),this.table=r,this.columns=ti.columnsFromRanges(o,r.columns),this.tableSubscription=i,this.gridRanges=n,this.includeColumnHeaders=a,this.useUnformattedValues=s;var u=encodeURIComponent(e.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),c=new MessageChannel;if(this.port=c.port1,this.fileName=e,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable(a);return}this.sw&&this.sw.postMessage({encodedFileName:u},[c.port2]),this.port.onmessage=this.handlePortMessage}}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();var{onDownloadCompleted:e}=this.props;e(),this.resetTableSaver(),this.downloadStartTime!==void 0&&pe.info("download finished, total elapsed time ".concat((Date.now()-this.downloadStartTime)/1e3," seconds"))}cancelDownload(){var e,r,i;(e=this.table)===null||e===void 0||e.close(),(r=this.tableSubscription)===null||r===void 0||r.close(),(i=this.fileWriter)===null||i===void 0||i.abort(),this.cancelableSnapshots.forEach(o=>{o&&(o.catch(()=>null),o.cancel())});var{onDownloadCanceled:n}=this.props;n(),this.resetTableSaver()}resetTableSaver(){this.table=void 0,this.tableSubscription=void 0,this.columns=void 0,this.chunkRows=void 0,this.removeIframe(),this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout!=null&&clearTimeout(this.snapshotHandlerTimeout),this.streamTimeout=void 0,this.snapshotHandlerTimeout=void 0}handleDownloadTimeout(){pe.info("download canceled"),this.cancelDownload()}writeTableHeader(){var e,r="";if(this.columns)for(var i=0;i<this.columns.length;i+=1)r+=this.columns[i].name,r+=i===this.columns.length-1?`
1
+ import{aQ as Si,B as M,S as cr,c as $,C as je,x as wi,aT as Oi,ab as Vt,D as Sr,Y as Kt,t as Xe,d as ji,P as Pi,df as Ke,bn as Qe,b as Re,a as Z,I as ge,v as Ee,ac as Ti,N as xi,au as k,dD as Di,dE as Ni,dF as Ei,u as rr,bz as Qt,by as Er,bC as Ii,bA as hr,bs as Ri,bx as ki,dG as Ai,bt as Fi,aN as Gi,G as Mi}from"./ControlType-hjy35CfT.js";import{r as C,I as d,L as V,M as K,b1 as wr,b0 as Pe,bw as Or,H as Fe,bv as Li,bx as qt,ac as Ir,_ as jr,a0 as ye,U as vr,a7 as Rr,aZ as _i,c4 as Ui,c5 as he,c6 as $i,c7 as Bi,c8 as Hi,c9 as Wi,ca as mr,cb as zi,cc as Vi,cd as Ki,ce as kr,cf as Qi,cg as Ar,ch as qi,ci as Xi,cj as Yi,ck as Zi,cl as Ji,cm as en,au as pr,bz as rn,bC as Ye}from"./vendor-DtjvbB9h.js";import{L as le,bT as Fr,aS as Xt,f as Ge,g as Pr,W as J,bU as Tr,bV as xr,aW as tn,aU as Yt,z as nn,bW as on,aX as Zt,aO as qe,aP as an,a3 as Jt,e as R,bl as fr,bX as sn,bH as Gr,p as ln,bY as ei,bZ as ri,v as un,b_ as dn,U as cn,bM as hn,aL as vn,b$ as mn,c0 as pn,c1 as fn,c2 as me,c3 as gn,c4 as bn,c5 as yn,c6 as Cn,c7 as Sn,d as Mr,bd as wn,aM as On,bA as oe,au as jn,ak as Pn,bq as Tn}from"./index-ZukTn3TM.js";import{S as xn,b as Dn,c as nr,q as Nn,e as ti,C as we,j as ii}from"./MissingPartitionError-FZmoFEc9.js";import{l as fe,P as En,I as _e,t as In,O as Rn,k as kn,q as An}from"./IrisGridShortcuts-B2qHIaCj.js";import{c as se,O as Fn,G as ue,n as ni,o as gr,p as Gn,q as Lr,r as Mn,s as Ln,T as _n,v as Un,l as $n,g as Bn}from"./GridTokenMouseHandler-ykzjzLCm.js";import{e as Hn}from"./monaco-CsU3t3B1.js";import{I as xe,G as q,d as U,m as oi,e as ke,f as Wn}from"./IrisGridModel-ClxZ5gUq.js";import{F as zn,c as Vn}from"./FormatterUtils-GsUZIKzO.js";function Hl(t,e){var r=Si(e);(r===void 0||!e.every((i,n)=>i===r[n]))&&t()}function Kn(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=C.useRef(),n=C.useRef(0);return C.useCallback(o=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>{var a=Math.floor(o.target.scrollTop/t);n.current!==a&&(n.current=a,e(a))},r)},[r,t,e])}function Qn(){var{getKey:t=qn}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},[e,r]=C.useState([]),[i,n]=C.useState(()=>new Set),o=C.useCallback(m=>g=>t(g)===m,[t]),a=C.useCallback(m=>{var g;return(g=e.find(o(m)))!==null&&g!==void 0?g:null},[e,o]),s=C.useCallback(m=>{var g=a(m);if(g==null)throw new Error("No item found matching key: ".concat(m));return g},[a]),l=C.useCallback(m=>{r(g=>[...g,...m])},[]),u=C.useCallback((m,g)=>{r(f=>[...f.slice(0,m),...g,...f.slice(m)])},[]),c=C.useCallback(m=>{var g=new Set(m);r(f=>f.filter(b=>!g.has(t(b))))},[t]),h=C.useCallback((m,g)=>{var f=e.findIndex(o(m));f!==-1&&r(b=>[...b.slice(0,f),g,...b.slice(f+1)])},[e,o]),p=C.useCallback(m=>{if(m.size!==0){var g=[],f=new Map;for(var b of m.keys()){var w=e.findIndex(o(b));g.push(w),f.set(w,b)}g.sort((O,T)=>O-T);var y=[];e.forEach((O,T)=>{if(g[0]===T){var D=f.get(g.shift()),E=m.get(D);y.push(E)}else y.push(O)}),r(y)}},[e,o]),v=C.useMemo(()=>({items:e,selectedKeys:i,append:l,bulkUpdate:p,findItem:a,getItem:s,insert:u,remove:c,setItems:r,setSelectedKeys:n,update:h}),[l,p,a,s,u,e,c,r,i,h]);return v}function qn(t){var e=t!=null&&typeof t=="object"&&"key"in t;if(!e)throw new Error("Item does not have a `key` prop.");return t.key}function _r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Ur(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?_r(Object(r),!0).forEach(function(i){Xn(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_r(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Xn(t,e,r){return(e=Yn(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yn(t){var e=Zn(t,"string");return typeof e=="symbol"?e:e+""}function Zn(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $r=le.module("Aggregations");function Wl(t){var{isRollup:e,settings:r,onChange:i,onEdit:n,dh:o}=t,{aggregations:a,showOnTop:s}=r,l=C.useMemo(()=>xn.filter(P=>!a.some(x=>x.operation===P)&&!(P===Dn.MEDIAN&&o.AggregationOperation.MEDIAN===void 0)),[a,o]),[u,c]=C.useState(l[0]),[h,p]=C.useState([]),v=C.useCallback(function(P){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];i(Ur(Ur({},r),P),x,F)},[i,r]),m=C.useCallback(function(P){var x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];v({aggregations:P},x,F)},[v]),g=C.useCallback(P=>{v({showOnTop:P})},[v]),f=C.useCallback(()=>{$r.debug("handleDragStart"),fe.startDragging()},[]),b=C.useCallback(P=>{var{destination:x,source:F}=P;if($r.debug("handleDragEnd",x,F),fe.stopDragging(),x!==null){var G=x.index;F.index<x.index&&(G+=1);var A=[...a],B=fe.reorder(A,h,A,G),H=fe.adjustDestinationIndex(G,h),W=[[H,H+B.length-1]];m(A),p(W)}},[m,a,h,p]),w=C.useCallback(P=>{c(P)},[c]),y=C.useCallback(()=>{m([...a,{operation:u,selected:[],invert:!0}],[u])},[a,u,m]),O=C.useCallback(P=>{var[x,F]=a.reduce((G,A,B)=>{var[H,W]=G;return B===P?W.push(A.operation):H.push(A),[H,W]},[[],[]]);m(x,[],F)},[a,m]),T=C.useCallback(P=>{p(P)},[p]),D=C.useCallback(P=>{var x=a[P];nr.isRollupOperation(x.operation)||n(x)},[a,n]),E=C.useCallback(P=>{g(P==="true")},[g]);C.useEffect(function(){l.length>0&&!l.includes(u)&&c(l[0])},[l,u]);var I=C.useCallback(P=>{var{item:x,itemIndex:F,isClone:G=!1,selectedCount:A}=P,B=x.operation,H=G?"".concat(A):void 0,W=G?"item-list-item-clone":void 0,ve=nr.isRollupOperation(x.operation),Me=nr.isRollupProhibited(x.operation),Le=!G&&!ve;return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:V("item-list-item-content","draggable-item-list-item-content",W),children:[d.jsxs("span",{className:"title",children:[B,!e&&ve&&d.jsxs("span",{className:"small text-warning",children:[d.jsx(K,{icon:Fr})," Requires rollup"]}),e&&Me&&d.jsxs("span",{className:"small text-warning",children:[d.jsx(K,{icon:Fr})," Not available on rollups"]})]}),se.renderBadge({text:H}),se.renderHandle()]}),!G&&d.jsxs(d.Fragment,{children:[d.jsx(M,{kind:"ghost",className:"btn-edit",icon:Xt,tooltip:"Edit Columns",onClick:()=>n(x),disabled:!Le}),d.jsx(M,{kind:"ghost",className:"btn-delete",icon:Ge,tooltip:"Delete Aggregation",onClick:()=>O(F)})]})]})},[O,n,e]),j=l.length>0,N=a.length>0;return d.jsxs("div",{className:"aggregations",children:[j&&d.jsxs("div",{className:"form-inline",children:[d.jsx(cr,{onChange:w,value:u,children:l.map(P=>d.jsx(Fn,{value:P,children:P},P))}),d.jsxs("button",{type:"button",className:"btn btn-link btn-add",onClick:y,children:[d.jsx(K,{icon:Pr}),"Add Aggregation"]})]}),j&&N&&d.jsx("hr",{}),N&&d.jsxs(d.Fragment,{children:[!e&&d.jsxs("div",{children:[d.jsx("label",{id:"placement-options-label",children:"Placement: "}),d.jsxs(wr,{"aria-labelledby":"placement-options-label",marginStart:"size-125",orientation:"horizontal",onChange:E,value:"".concat(s),children:[d.jsx(Pe,{value:"true",children:"Top"}),d.jsx(Pe,{value:"false",children:"Bottom"})]})]}),d.jsx(Or,{onDragStart:f,onDragEnd:b,children:d.jsx(se,{className:"selected-aggregations",itemCount:a.length,items:a,renderItem:I,offset:0,onSelectionChange:T,onSelect:D,selectedRanges:h,isMultiSelect:!0})})]})]})}function Br(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function be(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Br(Object(r),!0).forEach(function(i){Jn(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Br(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Jn(t,e,r){return(e=eo(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function eo(t){var e=ro(t,"string");return typeof e=="symbol"?e:e+""}function ro(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ae;(function(t){t[t.NONE=0]="NONE",t[t.ASCENDING=1]="ASCENDING",t[t.DESCENDING=2]="DESCENDING"})(ae||(ae={}));var to=30;function zl(t){var{aggregation:e,columns:r,onChange:i}=t,[n,o]=C.useState(-1),[a,s]=C.useState(-1),[l,u]=C.useState(ae.NONE),{invert:c,selected:h}=e,p=C.useRef(null),v=C.useCallback(D=>h.includes(D)?!c:c,[c,h]),m=C.useMemo(()=>{var D=Nn(r,e.operation);return l!==ae.NONE&&(D=$.sortColumns(D,l===ae.ASCENDING)),D},[r,e.operation,l]),g=C.useMemo(()=>n>=0?m.slice(n,a+1).map(D=>({value:D.name,displayValue:D.name,isSelected:v(D.name)})):[],[m,v,a,n]),f=C.useCallback(D=>{var{name:E}=m[D],I=h.indexOf(E),j=[...h],N=c;I>=0?j.splice(I,1):(j.push(E),j.length===m.length&&(j=[],N=!c)),i(be(be({},e),{},{selected:j,invert:N}))},[e,c,m,h,i]),b=C.useCallback(()=>{u(ae.NONE),i(be(be({},e),{},{selected:[],invert:!0}))},[e,i]),w=C.useCallback((D,E)=>{o(D),s(E)},[o,s]),y=C.useCallback(()=>{h.length===0?i(be(be({},e),{},{invert:!c})):i(be(be({},e),{},{selected:[],invert:!0}))},[e,c,i,h]),O=h.length===0?c:null,T=h.length!==0||!c||l!==ae.NONE;return d.jsxs("div",{role:"menu",className:"aggregation-edit",children:[d.jsx("div",{className:"top-menu",children:d.jsxs("div",{className:"form-inline",children:[d.jsx(je,{checked:O,onChange:y,children:"Toggle All"}),d.jsx("div",{className:"spacer"}),d.jsx(wi,{in:T,timeout:J.transitionSlowMs,mountOnEnter:!0,unmountOnExit:!0,children:d.jsx(M,{kind:"ghost",className:"btn-reset",onClick:b,children:"Reset"})}),d.jsx(M,{kind:"ghost",className:V({active:l===ae.ASCENDING}),icon:Tr,tooltip:"Sort ascending",onClick:()=>u(ae.ASCENDING)}),d.jsx(M,{kind:"ghost",className:V({active:l===ae.DESCENDING}),icon:xr,tooltip:"Sort descending",onClick:()=>u(ae.DESCENDING)})]})}),d.jsx("div",{className:"aggregation-edit-item-list",children:d.jsx(Oi,{itemCount:m.length,items:g,offset:n,renderItem:D=>{var{item:E}=D;return d.jsx(je,{checked:v(E.value),children:E.displayValue})},onSelect:f,onViewportChange:w,rowHeight:to,focusSelector:"input",ref:p})})]})}function Hr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Wr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Hr(Object(r),!0).forEach(function(i){io(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Hr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function io(t,e,r){return(e=no(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function no(t){var e=oo(t,"string");return typeof e=="symbol"?e:e+""}function oo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ao(t){return d.jsx("svg",Wr(Wr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:d.jsxs("g",{fill:"none",fillRule:"evenodd",children:[d.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),d.jsx("path",{fill:"#7DA4FF",d:"M8 26h4v15H8zM15 17h4v24h-4zM22 21h4v20h-4zM29 17h4v24h-4zM36 11h4v30h-4z"})]})}))}function zr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Vr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zr(Object(r),!0).forEach(function(i){so(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function so(t,e,r){return(e=lo(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function lo(t){var e=uo(t,"string");return typeof e=="symbol"?e:e+""}function uo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function co(t){return d.jsx("svg",Vr(Vr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:d.jsxs("g",{fill:"none",fillRule:"evenodd",children:[d.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),d.jsx("path",{fill:"#7DA4FF",d:"M7 34h4v8H7zM12 31h4v11h-4zM17 27h4v15h-4zM22 22h4v20h-4zM27 27h4v15h-4zM32 29h4v13h-4zM37 31h4v11h-4z"})]})}))}function Kr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Qr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Kr(Object(r),!0).forEach(function(i){ho(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Kr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function ho(t,e,r){return(e=vo(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vo(t){var e=mo(t,"string");return typeof e=="symbol"?e:e+""}function mo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function po(t){return d.jsx("svg",Qr(Qr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:d.jsxs("g",{fill:"none",fillRule:"evenodd",children:[d.jsx("path",{fill:"#C1C0C0",d:"M4 4h1v40H4zM44 43v1H5v-1z"}),d.jsx("path",{stroke:"#7DA4FF",d:"M7.984 32.44l7.982-11.378 5.273 3.739 9.952-10.838 2.826 1.894 7.45-5.802"}),d.jsx("path",{stroke:"#BECDEF",d:"M8.244 37.926L17 33.496l5 .87 10.637-10.35 10.615-1.381"})]})}))}function qr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Xr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qr(Object(r),!0).forEach(function(i){fo(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function fo(t,e,r){return(e=go(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function go(t){var e=bo(t,"string");return typeof e=="symbol"?e:e+""}function bo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yo(t){return d.jsx("svg",Xr(Xr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:d.jsxs("g",{fill:"none",fillRule:"evenodd",children:[d.jsx("path",{d:"M24 10c7.732 0 14 6.268 14 14s-6.268 14-14 14-14-6.268-14-14h14V10z",fill:"#80A6FF"}),d.jsx("path",{d:"M10 24c0-7.732 6.268-14 14-14v14H10z",fill:"#C1C0C0"})]})}))}function Yr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Zr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Yr(Object(r),!0).forEach(function(i){Co(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Yr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Co(t,e,r){return(e=So(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function So(t){var e=wo(t,"string");return typeof e=="symbol"?e:e+""}function wo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Oo(t){return d.jsx("svg",Zr(Zr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:d.jsxs("g",{fill:"none",fillRule:"evenodd",children:[d.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),d.jsx("path",{fill:"#939293",d:"M44 34v1H4v-1zM44 25v1H4v-1zM44 16v1H4v-1z"}),d.jsx("circle",{fill:"#7DA4FF",cx:9.5,cy:37.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:16.5,cy:30.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:22.5,cy:36.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:28.5,cy:30.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:15.5,cy:38.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:23.5,cy:25.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:19.5,cy:19.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:29.5,cy:19.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:32.5,cy:26.5,r:1.5}),d.jsx("circle",{fill:"#7DA4FF",cx:36.5,cy:13.5,r:1.5})]})}))}function Jr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function et(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Jr(Object(r),!0).forEach(function(i){jo(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Jr(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function jo(t,e,r){return(e=Po(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Po(t){var e=To(t,"string");return typeof e=="symbol"?e:e+""}function To(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Vl(t){return d.jsxs("svg",et(et({width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{},{children:[d.jsx("rect",{width:"48",height:"48",fill:"none"}),d.jsx("rect",{x:"26",y:"10",width:"15",height:"4",fill:"#9FDE70"}),d.jsx("rect",{x:"26",y:"22",width:"15",height:"4",fill:"#9FDE70"}),d.jsx("rect",{x:"26",y:"28",width:"15",height:"4",fill:"#FFD95C"}),d.jsx("rect",{x:"26",y:"34",width:"15",height:"4",fill:"#9FDE70"})]}))}function rt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function tt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?rt(Object(r),!0).forEach(function(i){xo(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):rt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function xo(t,e,r){return(e=Do(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Do(t){var e=No(t,"string");return typeof e=="symbol"?e:e+""}function No(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Kl(t){return d.jsxs("svg",tt(tt({width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{},{children:[d.jsx("rect",{width:"48",height:"48",fill:"none"}),d.jsx("rect",{x:"4",y:"16",width:"40",height:"4",fill:"#FFD95C"}),d.jsx("rect",{x:"4",y:"10",width:"40",height:"4",fill:"#78DCE8"}),d.jsx("rect",{x:"4",y:"34",width:"40",height:"4",fill:"#78DCE8"})]}))}var it=le.module("ChartBuilder");class de extends C.PureComponent{static getMaxSeriesCount(e,r){switch(r){case e.plot.SeriesPlotStyle.PIE:return 1;case e.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static makeSeriesItem(e){return{id:Fe(),value:e}}static makeDefaultSeriesItems(e,r,i){var n=de.getMaxSeriesCount(e,r);if(n===0||i==null||i.length===0)return[];var o=i.length>1?i[1].name:i[0].name;return[de.makeSeriesItem(o)]}static getDefaultXAxis(e,r){return r!=null&&r.length>0?r[0].name:null}constructor(e){super(e),Vt(this);var{model:r}=e,{columns:i,dh:n}=r,o=this.getTypes()[0],a=de.getDefaultXAxis(o,i),s=de.makeDefaultSeriesItems(n,o,i);this.state={type:o,seriesItems:s,xAxis:a,isLinked:!0}}getTypes(){var{model:e}=this.props,{dh:r}=e;return[r.plot.SeriesPlotStyle.LINE,r.plot.SeriesPlotStyle.BAR,r.plot.SeriesPlotStyle.SCATTER,r.plot.SeriesPlotStyle.PIE]}getTypeName(e){var{model:r}=this.props,{dh:i}=r;switch(e){case i.plot.SeriesPlotStyle.LINE:return"Line";case i.plot.SeriesPlotStyle.BAR:return"Bar";case i.plot.SeriesPlotStyle.SCATTER:return"Scatter";case i.plot.SeriesPlotStyle.PIE:return"Pie";case i.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return e}}getTypeIcon(e){var{model:r}=this.props,{dh:i}=r;switch(e){case i.plot.SeriesPlotStyle.LINE:return d.jsx(po,{});case i.plot.SeriesPlotStyle.BAR:return d.jsx(ao,{});case i.plot.SeriesPlotStyle.SCATTER:return d.jsx(Oo,{});case i.plot.SeriesPlotStyle.PIE:return d.jsx(yo,{});case i.plot.SeriesPlotStyle.HISTOGRAM:return d.jsx(co,{});default:return null}}getXAxisLabel(e){var{model:r}=this.props,{dh:i}=r;switch(e){case i.plot.SeriesPlotStyle.PIE:return"Labels";case i.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}getSeriesLabel(e){var{model:r}=this.props,{dh:i}=r;switch(e){case i.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}handleAddSeries(){this.setState(e=>{var{seriesItems:r}=e,i=[...r],{model:n}=this.props,{columns:o}=n;return i.push({id:Fe(),value:o[0].name}),{seriesItems:i}},this.sendChange)}handleLinkStateChange(e){this.setState({isLinked:e==="true"},this.sendChange)}handleReset(){var{model:e}=this.props,{columns:r,dh:i}=e,n=this.getTypes()[0],o=de.getDefaultXAxis(n,r),a=de.makeDefaultSeriesItems(i,n,r),s=!0;this.setState({type:n,seriesItems:a,xAxis:o,isLinked:s},this.sendChange)}handleSeriesChange(e,r){var i=e;this.setState(n=>{var{seriesItems:o}=n;return o=[...o],o[r].value=i,{seriesItems:o}},this.sendChange)}handleSeriesDeleteClick(e){this.setState(r=>{var{seriesItems:i}=r,n=[...i];return n.splice(e,1),{seriesItems:n}},this.sendChange)}handleSubmit(e){e.preventDefault();var{onSubmit:r}=this.props,{type:i,seriesItems:n,xAxis:o,isLinked:a}=this.state,s=n.map(l=>l.value);r({type:i,series:s,xAxis:o,isLinked:a})}handleTypeClick(e){var r=this.getTypes()[e];it.debug2("handleTypeSelect",r),this.setState(i=>{var{model:n}=this.props,{dh:o}=n,a=de.getMaxSeriesCount(o,r),{seriesItems:s}=i;if(s=s.slice(0,a),s.length===0&&a>0){var{columns:l}=n;s=de.makeDefaultSeriesItems(o,r,l)}return{type:r,seriesItems:s}},this.sendChange)}handleXAxisChange(e){var r=e;it.debug2("x-axis change",r),this.setState({xAxis:r},this.sendChange)}sendChange(){var{onChange:e}=this.props,{isLinked:r,type:i,seriesItems:n,xAxis:o}=this.state,a=n.map(s=>s.value);e({type:i,series:a,xAxis:o,isLinked:r})}render(){var{model:e}=this.props,{columns:r,dh:i}=e,{seriesItems:n,type:o,xAxis:a,isLinked:s}=this.state,l=de.getMaxSeriesCount(i,o),u=this.getXAxisLabel(o),c=this.getSeriesLabel(o),h=n.length>0,p=n.length<l;return d.jsx("div",{className:"chart-builder",children:d.jsxs("form",{onSubmit:this.handleSubmit,children:[d.jsxs("div",{className:"form-row",children:[d.jsx("label",{children:"Select Chart Type"}),d.jsx("div",{className:"form-row",children:this.getTypes().map((v,m)=>{var g=v;return d.jsx("div",{className:"col col-chart-type",children:d.jsxs("button",{type:"button",className:V("btn","btn-icon","btn-chart-type",{active:v===o}),onClick:()=>this.handleTypeClick(m),children:[this.getTypeIcon(v),this.getTypeName(v)]})},g)})})]}),d.jsx("hr",{}),d.jsxs("div",{className:"form-row form-inline",children:[d.jsx("label",{className:"col-2 label-left",children:u}),d.jsx(cr,{className:"form-control select-x-axis col",value:a,onChange:this.handleXAxisChange,children:r.map(v=>d.jsx("option",{value:v.name,children:v.name},v.name))})]}),h&&d.jsx("hr",{}),n.map((v,m)=>d.jsxs("div",{className:"form-row form-inline form-series-item","data-testid":"form-series-item-".concat(m),children:[d.jsx("label",{className:"col-2 label-left",children:m===0?c:""}),d.jsx(cr,{className:"form-control select-series col",value:v.value,onChange:g=>this.handleSeriesChange(g,m),"data-testid":"select-series-item-".concat(m),children:r.map(g=>d.jsx("option",{value:g.name,children:g.name},g.name))}),n.length>1&&d.jsx(M,{kind:"ghost",className:"btn-delete-series ml-2 px-2","data-testid":"delete-series-".concat(m),onClick:()=>{this.handleSeriesDeleteClick(m)},icon:Ge,tooltip:"Delete"})]},v.id)),p&&d.jsxs("div",{className:"form-row",children:[d.jsx("div",{className:"col-2"}),d.jsx(M,{kind:"ghost",className:"btn-add-series mt-1",onClick:this.handleAddSeries,icon:Pr,children:"Add Series"})]}),d.jsxs("div",{className:"form-row chart-builder-link",children:[d.jsx("label",{className:"col-2 label-right",children:d.jsxs("div",{className:"fa-md fa-layers",children:[d.jsx(K,{mask:tn,icon:Yt,transform:"right-5 down-5"}),d.jsx(K,{icon:s?nn:on,transform:"grow-2 right-8 down-6"})]})}),d.jsxs(wr,{"aria-label":"Link state options",orientation:"horizontal",onChange:this.handleLinkStateChange,value:"".concat(s),children:[d.jsx(Pe,{value:"true",children:"Sync State"}),d.jsx(Pe,{value:"false",children:"Freeze State"})]})]}),d.jsxs("div",{className:"form-row",children:[d.jsx("div",{className:"col-2 label-right"}),d.jsx("div",{className:"col chart-builder-link-info",children:s?"Charts with synced state will update to match any filters or user modifications applied to the parent table.":"Freeze State disconnects the chart state from the parent table. New filters or user modifications on the parent table will not be applied."})]}),d.jsxs("div",{className:V("form-row","justify-content-end","my-3"),children:[d.jsx(M,{kind:"secondary",className:"btn-reset",onClick:this.handleReset,children:"Reset"}),d.jsx(M,{kind:"primary",type:"submit",className:"btn-submit",children:"Create"})]})]})})}}function nt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Eo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nt(Object(r),!0).forEach(function(i){Ze(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Ze(t,e,r){return(e=Io(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Io(t){var e=Ro(t,"string");return typeof e=="symbol"?e:e+""}function Ro(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ai extends C.Component{constructor(e){super(e),Ze(this,"editorContainer",void 0),Ze(this,"editor",void 0),this.handleContentChanged=this.handleContentChanged.bind(this),this.handleEditorFocus=this.handleEditorFocus.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleContainerClick=this.handleContainerClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.state={isEditorFocused:!1,isEditorEmpty:!0},this.editorContainer=null}componentDidMount(){this.initEditor()}componentWillUnmount(){this.destroyEditor()}initEditor(){var e,{value:r,editorSettings:i}=this.props,n=Eo({copyWithSyntaxHighlighting:"false",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"groovyDB",lineDecorationsWidth:8,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},scrollBeyondLastLine:!1,padding:{top:6,bottom:6},tabCompletion:"off",useTabStops:!0,value:r,wordWrap:"on",automaticLayout:!0,autoClosingBrackets:"beforeWhitespace"},i);if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=Hn.create(this.editorContainer,n),this.editor.layout(),(e=this.editor.getModel())===null||e===void 0||e.updateOptions({tabSize:0}),this.editor.onKeyDown(this.handleKeyDown),this.editor.onDidChangeModelContent(this.handleContentChanged),this.editor.onDidFocusEditorText(this.handleEditorFocus),this.editor.onDidBlurEditorText(this.handleEditorBlur)}destroyEditor(){var e;(e=this.editor)===null||e===void 0||e.dispose(),this.editor=void 0}handleContentChanged(){var e,r,{onContentChanged:i}=this.props,n=(e=this.editor)===null||e===void 0||(r=e.getModel())===null||r===void 0?void 0:r.getValue();n!==void 0&&this.setState({isEditorEmpty:n.length===0}),i(n)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var e,r,i,n=(e=(r=this.editor)===null||r===void 0||(i=r.getModel())===null||i===void 0?void 0:i.getValue())!==null&&e!==void 0?e:"";this.setState({isEditorEmpty:n.length===0,isEditorFocused:!1})}handleContainerClick(){var e,{isEditorFocused:r}=this.state;r||(e=this.editor)===null||e===void 0||e.focus()}handleKeyDown(e){var{onTab:r,editorIndex:i}=this.props;e.code==="Tab"&&(e.stopPropagation(),e.preventDefault(),r(i,e.shiftKey))}render(){var{className:e,invalid:r,placeholder:i="",value:n}=this.props,{isEditorFocused:o,isEditorEmpty:a}=this.state;return d.jsxs("div",{className:V("input-editor-wrapper",{focused:o,invalid:r},e),role:"presentation",onClick:this.handleContainerClick,children:[d.jsx("div",{className:"editor-container",ref:s=>{this.editorContainer=s},"data-testid":"custom-column-formula"}),a&&!n&&i.length>0&&d.jsx("div",{className:"editor-placeholder text-muted",children:i})]})}}Ze(ai,"defaultProps",{value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1});function ot(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Ue(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ot(Object(r),!0).forEach(function(i){ko(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ot(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function ko(t,e,r){return(e=Ao(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ao(t){var e=Fo(t,"string");return typeof e=="symbol"?e:e+""}function Fo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var at=Object.freeze({NAME:"name",FORMULA:"formula"}),Go=()=>{};function Mo(t){var{eventKey:e,name:r,inputIndex:i,formula:n,onChange:o,onDeleteColumn:a,onTabInEditor:s,invalid:l,isDuplicate:u}=t,c=r===""||Sr.isValidColumnName(r),h=C.useCallback(p=>{p!==void 0&&(p.replace(/(\r\n|\n|\r)/gm,""),o(e,at.FORMULA,p))},[o,e]);return d.jsx(Li,{draggableId:e,index:i,disableInteractiveElementBlocking:!0,children:(p,v)=>d.jsxs("div",Ue(Ue({className:V("draggable-container",{dragging:v.isDragging}),ref:p.innerRef},p.draggableProps),{},{children:[d.jsxs("div",{className:"custom-column-input-container",children:[d.jsxs("div",{className:"pb-3",children:[d.jsxs("div",{className:"d-flex flex-row custom-column-name",children:[d.jsx("input",{className:V("form-control custom-column-input",{"is-invalid":l||!c||u}),placeholder:"Column Name",value:r,onChange:m=>{o(e,at.NAME,m.target.value)}}),d.jsx(M,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{a(e)},icon:Ge,tooltip:"Delete custom column"}),d.jsx(M,Ue(Ue({kind:"ghost",className:"btn-drag-handle",onClick:Go},p.dragHandleProps),{},{icon:Zt,tooltip:"Drag column to re-order"}))]}),(!c||u)&&d.jsx("p",{className:"validate-label-error text-danger mb-0 mt-2 pl-1",children:c?"Duplicate name":"Invalid name"})]}),d.jsx(ai,{editorSettings:{language:"deephavenDb"},editorIndex:i,placeholder:"Column Formula",value:n,onContentChanged:h,onTab:s,invalid:l})]}),d.jsx("hr",{})]}))})}function Lo(t){return(t==null?void 0:t.isDeletable)!==void 0}function st(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function or(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?st(Object(r),!0).forEach(function(i){Ne(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):st(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Ne(t,e,r){return(e=_o(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _o(t){var e=Uo(t,"string");return typeof e=="symbol"?e:e+""}function Uo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Oe extends C.Component{static makeCustomColumnInputEventKey(){return Fe()}static createCustomColumnInput(){return{eventKey:Fe(),name:"",formula:""}}constructor(e){super(e),Ne(this,"container",void 0),Ne(this,"successButtonTimer",void 0),Ne(this,"getInput",Ir((r,i)=>r.find(n=>n.eventKey===i))),Ne(this,"getInputIndex",Ir((r,i)=>r.findIndex(n=>n.eventKey===i))),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleSaveClick=this.handleSaveClick.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleCustomColumnUpdated=this.handleCustomColumnUpdated.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.resetRequestFailed=this.resetRequestFailed.bind(this),this.handleEditorTabNavigation=this.handleEditorTabNavigation.bind(this),this.state={inputs:[],isCustomColumnApplying:!1,errorMessage:null,hasRequestFailed:!1,isSuccessShowing:!1},this.container=null,this.successButtonTimer=null}componentDidMount(){var{customColumns:e}=this.props;this.parseCustomColumns(e),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){var{model:e}=this.props;e.addEventListener(xe.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.addEventListener(xe.EVENT.UPDATED,this.handleCustomColumnUpdated),e.addEventListener(xe.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){var{model:e}=this.props;e.removeEventListener(xe.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.removeEventListener(xe.EVENT.UPDATED,this.handleCustomColumnUpdated),e.removeEventListener(xe.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(e){if(e.length>0){var r=e.map(i=>{var n=i.split(/=(.+)/,2);return{eventKey:Oe.makeCustomColumnInputEventKey(),name:n[0],formula:n[1]}});this.setState({inputs:r})}else this.setState({inputs:[Oe.createCustomColumnInput()]})}handleAddColumnClick(){var{inputs:e}=this.state,r=[...e];r.push(Oe.createCustomColumnInput()),this.setState({inputs:r})}handleDeleteColumn(e){var{inputs:r}=this.state,i=this.getInputIndex(r,e),n=[...r];n.splice(i,1),n.length===0&&n.push(Oe.createCustomColumnInput()),this.setState({inputs:n})}handleInputChange(e,r,i){var{inputs:n}=this.state,o=this.getInputIndex(n,e),a=this.getInput(n,e),s=or({},a);s[r]=i;var l=[...n];l.splice(o,1,s),this.setState({inputs:l})}handleCustomColumnUpdated(){var{isCustomColumnApplying:e}=this.state;e&&this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),Oe.SUCCESS_SHOW_DURATION)})}handleRequestFailed(e){var r=e,{isCustomColumnApplying:i}=this.state;i&&this.setState({isCustomColumnApplying:!1,errorMessage:d.jsxs(d.Fragment,{children:[d.jsxs("p",{children:[d.jsx(K,{icon:qe})," Failed to apply custom columns."]}),d.jsxs("div",{className:"error-box",children:[r.detail.errorMessage,d.jsx("br",{}),"Table configuration:"," ",JSON.stringify(r.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(e){if(fe.stopDragging(),!!e.destination){var{inputs:r}=this.state,i=e.source.index,n=e.destination.index,o=[...r],a=r[i];o.splice(i,1),o.splice(n,0,a),this.setState({inputs:o})}}handleEditorTabNavigation(e,r){var{inputs:i}=this.state;if(r){var n;((n=this.container)===null||n===void 0?void 0:n.querySelectorAll(".btn-drag-handle")[e]).focus();return}if(e===i.length-1){var o,a;(o=this.container)===null||o===void 0||(a=o.querySelector(".btn-add-column"))===null||a===void 0||a.focus()}else{var s,l=e+1;((s=this.container)===null||s===void 0?void 0:s.querySelectorAll(".custom-column-input")[l]).focus()}}handleSaveClick(){var{onSave:e,customColumns:r}=this.props,{inputs:i,isCustomColumnApplying:n}=this.state;if(!n){var o=[];i.forEach(a=>{var{name:s,formula:l}=a;s&&l&&o.push("".concat(s,"=").concat(l))}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:o.length>0||r.length>0}),e(o)}}resetRequestFailed(){this.setState(e=>{var{hasRequestFailed:r}=e;return r?{hasRequestFailed:!1}:null})}renderInputs(){var{inputs:e,hasRequestFailed:r}=this.state,i=new Map;return e.forEach(n=>{var o,{name:a}=n;return i.set(a,((o=i.get(a))!==null&&o!==void 0?o:0)+1)}),e.map((n,o)=>{var a,{eventKey:s,name:l,formula:u}=n,c=((a=i.get(l))!==null&&a!==void 0?a:0)>1;return d.jsx(Mo,{inputIndex:o,eventKey:s,name:l,formula:u,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:r,isDuplicate:c},s)})}renderSaveButton(){var{inputs:e,isCustomColumnApplying:r,isSuccessShowing:i}=this.state,n=e.length>1?"Save Columns":"Save Column",o=e.every(l=>{var{name:u}=l;return u===""||Sr.isValidColumnName(u)}),a=e.filter(l=>{var{name:u}=l;return u!==""}).map(l=>{var{name:u}=l;return u}),s=new Set(a).size===a.length;return d.jsxs(M,{kind:i?"success":"primary",className:V("btn-apply",{"btn-spinner":r}),disabled:i||r||!o||!s,onClick:this.handleSaveClick,icon:i?an:void 0,children:[r&&d.jsxs("span",{children:[d.jsx(Jt,{className:"mr-2 loading-spinner-vertical-align"}),d.jsx("span",{className:"btn-normal-content",children:"Applying"})]}),!i&&!r&&n,i&&"Success"]})}render(){var{onCancel:e}=this.props,{errorMessage:r}=this.state;return d.jsxs("div",{role:"presentation",className:"custom-column-builder-container",ref:i=>{this.container=i},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[d.jsx("hr",{}),d.jsx(Or,{onDragStart:fe.startDragging,onDragEnd:this.handleDragEnd,children:d.jsx(qt,{droppableId:"droppable-custom-columns",children:(i,n)=>d.jsxs("div",or(or({ref:i.innerRef},i.droppableProps),{},{className:V("droppable-container",{dragging:n.draggingFromThisWith}),children:[this.renderInputs(),i.placeholder]}))})}),d.jsx("div",{className:"pt-1 px-3",children:d.jsx(M,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,icon:Pr,children:"Add Another Column"})}),d.jsxs("div",{className:"custom-column-builder-footer",children:[r&&d.jsx("div",{className:"error-message",children:r}),d.jsxs("div",{className:"d-flex justify-content-end",children:[d.jsx(M,{kind:"secondary",className:"mr-2",onClick:e,children:"Cancel"}),this.renderSaveButton()]})]})]})}}Ne(Oe,"SUCCESS_SHOW_DURATION",750);var br;(function(t){t.ADVANCED_SETTINGS="ADVANCED_SETTINGS",t.AGGREGATIONS="AGGREGATIONS",t.AGGREGATION_EDIT="AGGREGATIONS_EDIT",t.CHART_BUILDER="CHART_BUILDER",t.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",t.QUICK_FILTERS="QUICK_FILTERS",t.ROLLUP_ROWS="ROLLUP_ROWS",t.SEARCH_BAR="SEARCH_BAR",t.SELECT_DISTINCT="SELECT_DISTINCT",t.TABLE_EXPORTER="TABLE_EXPORTER",t.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",t.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",t.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",t.GOTO="GOTO"})(br||(br={}));const Ql=br;function lt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function ut(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?lt(Object(r),!0).forEach(function(i){Se(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Se(t,e,r){return(e=$o(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $o(t){var e=Bo(t,"string");return typeof e=="symbol"?e:e+""}function Bo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ie=le.module("RollupRows"),Ho=150,$e="grouped-rollup-rows",Be="ungrouped-rollup-rows";class re extends C.Component{static renderColumn(e){var{item:r,isClone:i,selectedCount:n}=e,o=r==null?void 0:r.name,a=i!==void 0&&i?"".concat(n):void 0,s=i!==void 0&&i?"item-list-item-clone":"";return se.renderTextItem({text:o,badgeText:a,className:s})}static addGroupings(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length;if(r==null||r.length===0)return e;var n=i,o=e.filter((a,s)=>r.includes(a)?(s<n&&(n-=1),!1):!0);return o.splice(n,0,...r),o}static isGroupable(e){return!$.isBigDecimalType(e.type)&&!$.isBigIntegerType(e.type)}constructor(e){super(e),Se(this,"ungroupedList",void 0),Se(this,"groupedList",void 0),Se(this,"search",jr(a=>{for(var s=this.getSortedUngroupedColumns(),l=[],u=null,c=0;c<s.length;c+=1){var h=s[c];h.name.toLowerCase().includes(a.toLowerCase())&&(u==null&&(u=c),l.push([c,c]))}R(u),this.setState({ungroupedSelectedRanges:l}),l.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(u)},Ho)),Se(this,"getCachedUngroupedColumns",ye((a,s)=>a.filter(l=>re.isGroupable(l)&&s.find(u=>u===l.name)==null),{max:100})),Se(this,"getCachedSortedColumns",ye((a,s)=>s==null?[...a]:$.sortColumns(a,s===re.SORT.ASCENDING),{max:100})),this.handleDeleteClicked=this.handleDeleteClicked.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUngroupedSelect=this.handleUngroupedSelect.bind(this),this.handleUngroupedSelectionChange=this.handleUngroupedSelectionChange.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupedSelectionChange=this.handleGroupedSelectionChange.bind(this),this.handleShowConstituentsChange=this.handleShowConstituentsChange.bind(this),this.handleShowNonAggregatedColumnsChange=this.handleShowNonAggregatedColumnsChange.bind(this),this.handleSortAscending=this.handleSortAscending.bind(this),this.handleSortDescending=this.handleSortDescending.bind(this),this.renderGroupedItem=this.renderGroupedItem.bind(this),this.ungroupedList=vr.createRef(),this.groupedList=vr.createRef();var{config:r}=e,{columns:i=[],showConstituents:n=!0,showNonAggregatedColumns:o=!0}=r??{};this.state={ungroupedSelectedRanges:[],columns:i,groupedSelectedRanges:[],searchFilter:"",showConstituents:n,showNonAggregatedColumns:o,dragSource:null,sort:null}}componentDidUpdate(e,r){var{config:i}=this.props,{columns:n,showConstituents:o,showNonAggregatedColumns:a}=this.state;i!==e.config?this.updateFromConfig():(n!==r.columns||o!==r.showConstituents||a!==r.showNonAggregatedColumns)&&(i==null||n!==i.columns||o!==i.showConstituents||a!==i.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(e){var r=e.target.value;if(this.setState({searchFilter:r}),!r){this.search.cancel(),this.resetSelection();return}this.search(r)}handleSortAscending(){this.setState(e=>{var{sort:r}=e;return{sort:r===re.SORT.ASCENDING?null:re.SORT.ASCENDING}})}handleSortDescending(){this.setState(e=>{var{sort:r}=e;return{sort:r===re.SORT.DESCENDING?null:re.SORT.DESCENDING}})}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(e){Ie.debug("handleDragStart",e),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:e.source})}handleDragEnd(e){Ie.debug("handleDragEnd",e),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});var{destination:r,source:i}=e;if(!(r==null||i==null)){if(r.droppableId===Be){this.setState(a=>{var{groupedSelectedRanges:s,columns:l}=a,u=[...l];return fe.reorder(u,s,[],0),{columns:u,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}var n=i.droppableId===$e,o=r.index;n&&i.index<r.index&&(o+=1),this.setState(a=>{var{columns:s,ungroupedSelectedRanges:l,groupedSelectedRanges:u}=a,c=[...s],h=n?c:this.getSortedUngroupedColumns().map(f=>f.name),p=n?u:l,v=fe.reorder(h,p,c,o),m=n?fe.adjustDestinationIndex(o,u):o,g=[[m,m+v.length-1]];return{columns:c,ungroupedSelectedRanges:[],groupedSelectedRanges:g}}),this.resetSelection()}}handleUngroupedSelect(e){Ie.debug("handleUngroupedSelect"),this.setState(r=>{var{columns:i}=r;return{columns:re.addGroupings(i,[this.getSortedUngroupedColumns()[e].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}})}handleUngroupedSelectionChange(e){Ie.debug2("handleUngroupedSelectionChange",e),this.setState(r=>{var{ungroupedSelectedRanges:i}=r;return e===i?null:{ungroupedSelectedRanges:e,groupedSelectedRanges:[]}})}handleGroupedSelectionChange(e){Ie.debug2("handleGroupedSelectedRanges",e),this.setState(r=>{var{groupedSelectedRanges:i}=r;return e===i?null:{groupedSelectedRanges:e,ungroupedSelectedRanges:[]}})}handleDeleteClicked(e){this.setState(r=>{var{columns:i}=r,n=i.slice();return n.splice(e,1),{columns:n}})}handleShowConstituentsChange(){this.setState(e=>{var{showConstituents:r}=e;return{showConstituents:!r}})}handleShowNonAggregatedColumnsChange(){this.setState(e=>{var{showNonAggregatedColumns:r}=e;return{showNonAggregatedColumns:!r}})}updateFromConfig(){var{config:e}=this.props,{columns:r=[],showConstituents:i=!0,showNonAggregatedColumns:n=!0}=e??{};this.setState({columns:r,showConstituents:i,showNonAggregatedColumns:n})}sendChange(){var{onChange:e}=this.props,{columns:r,showConstituents:i,showNonAggregatedColumns:n}=this.state;e({columns:r,showConstituents:i,showNonAggregatedColumns:n})}getUngroupedColumns(){var{model:e}=this.props,{columns:r}=this.state,{originalColumns:i}=e;return this.getCachedUngroupedColumns(i,r)}getSortedUngroupedColumns(){var{sort:e}=this.state,r=this.getUngroupedColumns();return this.getCachedSortedColumns(r,e)}renderGroupedItem(e){var{item:r,itemIndex:i,isClone:n,selectedCount:o}=e,a=n!==void 0&&n?"":"  ".repeat(i),s="".concat(a).concat(r),l=n!==void 0&&n?"".concat(o):void 0,u=n!==void 0&&n?"item-list-item-clone":"";return d.jsxs(d.Fragment,{children:[se.renderTextItem({text:s,badgeText:l,className:u}),(n===void 0||!n)&&d.jsx(M,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(i),children:d.jsx(K,{icon:Ge})})]})}render(){var{columns:e,dragSource:r,searchFilter:i,groupedSelectedRanges:n,ungroupedSelectedRanges:o,showConstituents:a,showNonAggregatedColumns:s,sort:l}=this.state,u=this.getSortedUngroupedColumns(),c=e.length*se.DEFAULT_ROW_HEIGHT;(r==null?void 0:r.droppableId)===Be&&(c+=se.DEFAULT_ROW_HEIGHT);var h=u.length*se.DEFAULT_ROW_HEIGHT+10,p=Math.min(3*se.DEFAULT_ROW_HEIGHT,h);return d.jsx("div",{role:"menu",className:V("rollup-rows",{"is-dragging":r!=null}),tabIndex:0,children:d.jsxs(Or,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[d.jsxs("div",{className:"rollup-rows-group-by",children:[d.jsx("div",{className:"section-title",children:"Group By"}),e.length===0&&d.jsx(qt,{droppableId:"placeholder",children:(v,m)=>d.jsx("div",ut(ut({className:V("placeholder","text-muted",{"is-dragging-from-this":m.draggingFromThisWith,"is-dragging-over":m.isDraggingOver,"is-dropping":m.draggingOverWith}),ref:v.innerRef},v.droppableProps),{},{children:"To create a rollup, drag columns from the list below and drop them into this area."}))}),e.length>0&&d.jsx(se,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:$e,droppableId:$e,itemCount:e.length,items:e,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:n,style:{height:c},isMultiSelect:!0})]}),d.jsxs("div",{className:"rollup-rows-available-columns",children:[d.jsx("div",{className:"section-title",children:"Available Grouping Columns"}),d.jsxs("div",{className:"top-menu",children:[d.jsx(Kt,{className:"w-100",value:i,matchCount:i?o.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),d.jsxs(M,{kind:"ghost",className:V("btn-link btn-link-icon",{active:l===re.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[d.jsx(K,{icon:Tr}),d.jsx(Xe,{children:"Sort ascending"})]}),d.jsxs(M,{kind:"ghost",className:V("btn-link btn-link-icon",{active:l===re.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[d.jsx(K,{icon:xr}),d.jsx(Xe,{children:"Sort descending"})]})]}),d.jsx(se,{className:"rollup-available-grouping-columns",draggablePrefix:Be,droppableId:Be,itemCount:u.length,items:u,renderItem:re.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:o,style:{maxHeight:h,minHeight:p},isDropDisabled:(r==null?void 0:r.droppableId)!==$e,isMultiSelect:!0}),d.jsxs("div",{className:"bottom-menu",children:[d.jsx("div",{className:"label",children:"Show:"}),d.jsx(je,{checked:a,onChange:this.handleShowConstituentsChange,children:"Constituents"}),d.jsx(je,{checked:s,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}}Se(re,"SORT",Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"}));Se(re,"defaultProps",{config:null,onChange:()=>{}});function dt(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(u){return void r(u)}s.done?e(l):Promise.resolve(l).then(i,n)}function Wo(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(l){dt(o,i,n,a,s,"next",l)}function s(l){dt(o,i,n,a,s,"throw",l)}a(void 0)})}}function ct(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function ht(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ct(Object(r),!0).forEach(function(i){Te(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ct(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Te(t,e,r){return(e=zo(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function zo(t){var e=Vo(t,"string");return typeof e=="symbol"?e:e+""}function Vo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ko=le.module("TableCsvExporter");class L extends C.Component{static getDateString(e){return e.i18n.DateTimeFormat.format(L.FILENAME_DATE_FORMAT,new Date)}constructor(e){super(e),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadRowOptionChanged=this.handleDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowOptionChanged=this.handleCustomizedDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this),this.handleIncludeColumnHeadersChanged=this.handleIncludeColumnHeadersChanged.bind(this),this.handleIncludeHiddenColumnsChanged=this.handleIncludeHiddenColumnsChanged.bind(this),this.handleUseUnformattedValuesChanged=this.handleUseUnformattedValuesChanged.bind(this);var{model:r,name:i}=e;this.state={fileName:"".concat(i,"-").concat(L.getDateString(r.dh),".csv"),downloadRowOption:L.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,customizedDownloadRowOption:L.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:L.DEFAULT_DOWNLOAD_ROWS,includeColumnHeaders:!0,includeHiddenColumns:!1,useUnformattedValues:!1,errorMessage:null,id:Fe()}}getSnapshotRanges(){var{model:e,selectedRanges:r}=this.props,{downloadRowOption:i,customizedDownloadRowOption:n,customizedDownloadRows:o}=this.state,{rowCount:a,columnCount:s}=e,l=[];switch(i){case L.DOWNLOAD_ROW_OPTIONS.ALL_ROWS:l.push(new q(0,0,s-1,a-1));break;case L.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS:l=r.map(u=>ht(ht({},u),{},{startColumn:0,endColumn:s-1})).sort((u,c)=>u.startRow!=null&&c.startRow!=null?u.startRow-c.startRow:0);break;case L.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS:switch(n){case L.CUSTOMIZED_ROWS_OPTIONS.FIRST:l.push(new q(0,0,s-1,Math.min(o-1,a-1)));break;case L.CUSTOMIZED_ROWS_OPTIONS.LAST:l.push(new q(0,Math.max(0,a-o),s-1,a-1));break}break}return l}getModelRanges(e){var{userColumnWidths:r,movedColumns:i}=this.props,{includeHiddenColumns:n}=this.state,o=ti.getHiddenColumns(r),a=U.getModelRanges(e,i);if(!n&&o.length>0){var s=o.map(q.makeColumn);a=q.subtractRangesFromRanges(a,s)}return a}resetDownloadState(){this.setState({errorMessage:null})}handleDownloadClick(){var e=this;return Wo(function*(){var{model:r,isDownloading:i,onDownloadStart:n,onDownload:o,onCancel:a}=e.props,{fileName:s,includeColumnHeaders:l,useUnformattedValues:u}=e.state;if(i){a();return}e.resetDownloadState();var c=e.getSnapshotRanges(),h=e.getModelRanges(c);if(e.validateOptionInput()){n();try{var p=yield r.export(),v=p.setViewport(0,0);yield v.getViewportData(),o(s,p,v,c,h,l,u)}catch(m){Ko.error("CSV download failed",m),e.setState({errorMessage:d.jsxs("p",{children:[d.jsx(K,{icon:qe})," ","".concat(m)]})}),a()}}})()}handleDownloadRowOptionChanged(e){this.setState({downloadRowOption:e})}handleCustomizedDownloadRowOptionChanged(e){e!==null&&this.setState({customizedDownloadRowOption:String(e)})}handleCustomizedDownloadRowsChanged(e){this.setState({customizedDownloadRows:e})}handleIncludeColumnHeadersChanged(){this.setState(e=>{var{includeColumnHeaders:r}=e;return{includeColumnHeaders:!r}})}handleIncludeHiddenColumnsChanged(){this.setState(e=>{var{includeHiddenColumns:r}=e;return{includeHiddenColumns:!r}})}handleUseUnformattedValuesChanged(){this.setState(e=>{var{useUnformattedValues:r}=e;return{useUnformattedValues:!r}})}validateOptionInput(){var{selectedRanges:e}=this.props,{downloadRowOption:r,customizedDownloadRows:i}=this.state;return r===L.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS&&e.length===0?(this.setState({errorMessage:d.jsxs("p",{children:[d.jsx(K,{icon:qe})," No rows selected. Please select some rows in the table."]})}),!1):r===L.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS&&i<=0?(this.setState({errorMessage:d.jsxs("p",{children:[d.jsx(K,{icon:qe})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){var{model:e,isDownloading:r,tableDownloadProgress:i,tableDownloadEstimatedTime:n,selectedRanges:o,tableDownloadStatus:a}=this.props,{fileName:s,downloadRowOption:l,customizedDownloadRowOption:u,customizedDownloadRows:c,includeColumnHeaders:h,includeHiddenColumns:p,useUnformattedValues:v,errorMessage:m,id:g}=this.state,{rowCount:f}=e;return d.jsxs("div",{className:"table-csv-exporter",children:[d.jsx("div",{id:"download-rows-label",className:"section-title",children:"Download Rows"}),d.jsx("div",{className:"form-group",children:d.jsxs(wr,{"aria-labelledby":"download-rows-label",onChange:this.handleDownloadRowOptionChanged,value:l,isDisabled:r,children:[d.jsxs(Pe,{value:L.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",d.jsx("span",{className:"text-muted ml-2",children:"(".concat(f.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")," rows)")})]}),d.jsxs(Pe,{value:L.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",d.jsx("span",{className:"text-muted ml-2",children:o.length>0?"(".concat(q.rowCount(o).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")," rows)"):null})]}),d.jsxs("div",{className:"d-flex",children:[d.jsx(Pe,{value:L.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",margin:"0","aria-label":"Download a custom number of rows"}),d.jsxs("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadRowOption:L.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS})},children:[d.jsxs(En,{selectedKey:u,"data-testid":"select-csv-exporter-customized-rows",isDisabled:r,onChange:this.handleCustomizedDownloadRowOptionChanged,"aria-label":"First or last number of rows",flex:!0,children:[d.jsx(Rr,{children:"First"},"FIRST"),d.jsx(Rr,{children:"Last"},"LAST")]}),d.jsx(_i,{id:"customizedRows-".concat(g),"data-testid":"input-csv-exporter-customized-rows",name:"customizedRows-".concat(g),minValue:1,defaultValue:100,value:c,width:"100%",minWidth:0,isDisabled:r,onChange:this.handleCustomizedDownloadRowsChanged,"aria-label":"Number of rows to download",flex:!0}),d.jsx("div",{children:"Rows"})]})]})]})}),d.jsxs("div",{className:"form-group",children:[d.jsx("label",{htmlFor:"customizedRows-".concat(g),children:"File Name"}),d.jsx("input",{type:"text",className:"form-control",id:"filename-".concat(g),"data-testid":"input-csv-exporter-file-name",name:"filename-".concat(g),value:s,onChange:b=>{this.setState({fileName:b.target.value})},disabled:r})]}),d.jsxs("div",{className:"checkbox-options",children:[d.jsx(je,{checked:h,onChange:this.handleIncludeColumnHeadersChanged,children:"Include column headers"}),d.jsx(je,{checked:p,onChange:this.handleIncludeHiddenColumnsChanged,children:"Include hidden columns"}),d.jsx(je,{checked:v,onChange:this.handleUseUnformattedValuesChanged,children:"Use unformatted values"})]}),d.jsxs("div",{className:"section-footer flex-column",children:[m!=null&&d.jsx("div",{className:"error-message",children:m}),a&&d.jsxs("div",{className:"download-status",children:[(a===L.DOWNLOAD_STATUS.DOWNLOADING||a===L.DOWNLOAD_STATUS.INITIATING)&&d.jsxs(d.Fragment,{children:[a===L.DOWNLOAD_STATUS.INITIATING&&d.jsx("div",{className:"text-muted",children:"Starting Download..."}),a===L.DOWNLOAD_STATUS.DOWNLOADING&&d.jsxs("div",{className:"text-muted d-flex justify-content-between",children:[d.jsx("span",{children:n||n===0?"Estimated time: ".concat(ji.formatElapsedTime(n)):null}),d.jsx("span",{children:"".concat(i,"%")})]})]}),a===L.DOWNLOAD_STATUS.FINISHED&&d.jsx("div",{className:"text-muted text-right",children:"Download Completed"}),a===L.DOWNLOAD_STATUS.CANCELED&&d.jsx("div",{className:"text-muted",children:"Download Canceled"}),(a===L.DOWNLOAD_STATUS.DOWNLOADING||a===L.DOWNLOAD_STATUS.INITIATING)&&d.jsx("div",{className:"progress",children:d.jsx("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:"".concat(i,"%")}})}),a===L.DOWNLOAD_STATUS.FINISHED&&d.jsx("div",{className:"progress",children:d.jsx("div",{className:"progress-bar bg-success",style:{width:"".concat(i,"%")}})})]}),d.jsxs(M,{kind:"primary","data-testid":"btn-csv-exporter-download",className:V("btn-downloading",{"btn-spinner btn-cancelable":r}),onClick:this.handleDownloadClick,children:[r&&d.jsxs("span",{children:[d.jsx(Jt,{className:"mr-2 loading-spinner-vertical-align"}),d.jsx("span",{className:"btn-normal-content",children:"Downloading"}),d.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!r&&"Download"]})]})]})}}Te(L,"FILENAME_DATE_FORMAT","yyyy-MM-dd-HHmmss");Te(L,"DOWNLOAD_STATUS",{INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"});Te(L,"DOWNLOAD_ROW_OPTIONS",{ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"});Te(L,"CUSTOMIZED_ROWS_OPTIONS",{FIRST:"FIRST",LAST:"LAST"});Te(L,"DEFAULT_DOWNLOAD_ROWS",100);Te(L,"defaultProps",{onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]});function _(t,e,r){return(e=Qo(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qo(t){var e=qo(t,"string");return typeof e=="symbol"?e:e+""}function qo(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var pe=le.module("TableSaver"),Xo="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function Yo(t){return t.added!==void 0}function Zo(t){if(!Yo(t))throw new Error("event is not UpdateEventData")}class te extends C.PureComponent{static csvEscapeString(e){return'"'.concat(e.replace(/"/g,'""'),'"')}constructor(e){super(e),_(this,"sw",void 0),_(this,"port",void 0),_(this,"fileWriter",void 0),_(this,"table",void 0),_(this,"tableSubscription",void 0),_(this,"columns",void 0),_(this,"fileName",void 0),_(this,"includeColumnHeaders",void 0),_(this,"useUnformattedValues",void 0),_(this,"chunkRows",void 0),_(this,"gridRanges",void 0),_(this,"gridRangeCounter",void 0),_(this,"rangedSnapshotsTotal",void 0),_(this,"rangedSnapshotCounter",void 0),_(this,"snapshotsTotal",void 0),_(this,"snapshotCounter",void 0),_(this,"snapshotsBuffer",void 0),_(this,"currentSnapshotIndex",void 0),_(this,"snapshotPending",void 0),_(this,"cancelableSnapshots",void 0),_(this,"streamTimeout",void 0),_(this,"snapshotHandlerTimeout",void 0),_(this,"downloadStartTime",void 0),_(this,"iframe",void 0),_(this,"useBlobFallback",void 0),_(this,"getCachedCustomColumnFormatFlag",oi(zn.isCustomColumnFormatDefined,{max:1e4})),this.handlePortMessage=this.handlePortMessage.bind(this),this.handleSnapshotResolved=this.handleSnapshotResolved.bind(this),this.handleDownloadTimeout=this.handleDownloadTimeout.bind(this),this.state={},this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.useBlobFallback=!1}componentDidMount(){var{getDownloadWorker:e}=this.props;e().then(r=>{pe.info("found active service worker"),this.sw=r,this.sw.postMessage("ping")}).catch(r=>{pe.warn("Download csv is not optimized.",r),this.useBlobFallback=!0})}componentWillUnmount(){this.removeIframe(),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(e){var r=this.useBlobFallback,i=[],n=null;r&&(n=TextEncoder.prototype.encode.bind(new TextEncoder));var{fileName:o}=this,a={};return r?(a.write=s=>{R(n),s.header!==void 0&&i.push(n(s.header)),s.rows!==void 0&&i.push(n(s.rows))},a.close=()=>{R(o);var s=new Blob(i,{type:"application/octet-stream; charset=utf-8"}),l=document.createElement("a");l.href=URL.createObjectURL(s),l.download=o,l.click()},a.abort=()=>{e.postMessage({cancel:!0}),e.close()}):(a.write=s=>{e.postMessage(s)},a.close=()=>{e.postMessage({end:!0}),e.close()},a.abort=()=>{e.postMessage({cancel:!0}),e.close()}),new WritableStream(a)}startDownload(e,r,i,n,o,a,s){var{isDownloading:l}=this.props;if(!l){this.downloadStartTime=Date.now(),pe.info("start downloading ".concat(e)),this.table=r,this.columns=ti.columnsFromRanges(o,r.columns),this.tableSubscription=i,this.gridRanges=n,this.includeColumnHeaders=a,this.useUnformattedValues=s;var u=encodeURIComponent(e.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),c=new MessageChannel;if(this.port=c.port1,this.fileName=e,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable(a);return}this.sw&&this.sw.postMessage({encodedFileName:u},[c.port2]),this.port.onmessage=this.handlePortMessage}}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();var{onDownloadCompleted:e}=this.props;e(),this.resetTableSaver(),this.downloadStartTime!==void 0&&pe.info("download finished, total elapsed time ".concat((Date.now()-this.downloadStartTime)/1e3," seconds"))}cancelDownload(){var e,r,i;(e=this.table)===null||e===void 0||e.close(),(r=this.tableSubscription)===null||r===void 0||r.close(),(i=this.fileWriter)===null||i===void 0||i.abort(),this.cancelableSnapshots.forEach(o=>{o&&(o.catch(()=>null),o.cancel())});var{onDownloadCanceled:n}=this.props;n(),this.resetTableSaver()}resetTableSaver(){this.table=void 0,this.tableSubscription=void 0,this.columns=void 0,this.chunkRows=void 0,this.removeIframe(),this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout!=null&&clearTimeout(this.snapshotHandlerTimeout),this.streamTimeout=void 0,this.snapshotHandlerTimeout=void 0}handleDownloadTimeout(){pe.info("download canceled"),this.cancelDownload()}writeTableHeader(){var e,r="";if(this.columns)for(var i=0;i<this.columns.length;i+=1)r+=this.columns[i].name,r+=i===this.columns.length-1?`
2
2
  `:",";(e=this.fileWriter)===null||e===void 0||e.write({header:r}).then(()=>null)}startWriteTableBody(){this.columns&&this.gridRanges!=null&&(this.chunkRows=Math.floor(te.DOWNLOAD_CELL_CHUNK/this.columns.length),this.rangedSnapshotsTotal=this.gridRanges.map(e=>(R(e.endRow),R(e.startRow),R(this.chunkRows),Math.ceil((e.endRow-e.startRow+1)/this.chunkRows))),this.snapshotsTotal=this.rangedSnapshotsTotal.reduce((e,r)=>e+r),pe.info("start writing table, total snapshots: ",this.snapshotsTotal),this.makeSnapshot(Math.min(te.SNAPSHOT_BUFFER_SIZE,this.snapshotsTotal)))}writeCsvTable(e){e&&this.writeTableHeader(),this.startWriteTableBody()}writeSnapshot(e,r,i){if(this.currentSnapshotIndex===e&&this.fileWriter){for(;this.snapshotsBuffer.has(this.currentSnapshotIndex);){var n=this.snapshotsBuffer.get(this.currentSnapshotIndex);R(n),this.fileWriter.write({rows:this.convertSnapshotIntoCsv(n)}),this.snapshotsBuffer.delete(this.currentSnapshotIndex),this.currentSnapshotIndex+=1,this.updateDownloadProgress(e)}if(this.snapshotsTotal&&this.currentSnapshotIndex>=this.snapshotsTotal){this.finishDownload();return}}this.snapshotCounter&&this.snapshotsTotal&&this.snapshotCounter<this.snapshotsTotal&&(pe.debug2(`
3
3
  current range index: `.concat(this.gridRangeCounter,`,
4
4
  snapshotIndexCounter: `).concat(this.snapshotCounter,`,
@@ -7,6 +7,6 @@ import{aQ as Si,B as M,S as cr,c as $,C as je,x as wi,aT as Oi,ab as Vt,D as Sr,
7
7
  buffered `).concat(this.snapshotsBuffer.size,`
8
8
  making `).concat(Math.min(te.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter),` more snapshots
9
9
  `)),this.makeSnapshot(Math.min(te.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)))}updateDownloadProgress(e){if(e!=null&&this.snapshotsTotal!=null&&this.downloadStartTime!=null){var{onDownloadProgressUpdate:r}=this.props,i=Math.floor(e*100/this.snapshotsTotal),n=e>1?Math.floor((Date.now()-this.downloadStartTime)*(this.snapshotsTotal-e)/e/1e3):null;r(i,n)}}convertSnapshotIntoCsv(e){for(var r="",i=e.added.iterator(),{dh:n,formatter:o}=this.props,a=[];i.hasNext();)a.push(i.next().value);R(this.columns);for(var{useUnformattedValues:s}=this,l=0;l<a.length;l+=1)for(var u=a[l],c=0;c<this.columns.length;c+=1){var{type:h,name:p}=this.columns[c],v=null;if(s){var m,g=(m=e.getData(u,this.columns[c]))!==null&&m!==void 0?m:"";g!==""&&$.isDateType(h)&&(g=n.i18n.DateTimeFormat.format(Xo,g,n.i18n.TimeZone.getTimeZone(o.timeZone))),v=g.toString()}else{var f=this.getCachedCustomColumnFormatFlag(o,p,h),b=null;if(!f){var w=e.getFormat(u,this.columns[c]);b=(w==null?void 0:w.formatString)!=null?w:null}b?v=o.getFormattedString(e.getData(u,this.columns[c]),h,p,b):v=o.getFormattedString(e.getData(u,this.columns[c]),h,p)}r+=te.csvEscapeString(v),r+=c===this.columns.length-1?`
10
- `:","}return r}makeSnapshot(e){var r=this;if(!(e<=0)){var{dh:i}=this.props;R(this.gridRangeCounter);var n=0,o=this.gridRanges[this.gridRangeCounter];R(this.tableSubscription),R(this.columns);for(var a=function(){R(o),R(o.startRow),R(o.endRow),R(r.rangedSnapshotCounter),R(r.chunkRows);var l=o.startRow+r.rangedSnapshotCounter*r.chunkRows,u=Math.min(l+r.chunkRows-1,o.endRow),c=r.snapshotCounter;r.cancelableSnapshots.push(Ti.makeCancelable(r.tableSubscription.snapshot(i.RangeSet.ofRange(l,u),r.columns).then(h=>(Zo(h),r.handleSnapshotResolved(h,c,l,u),c)).catch(h=>{pe.error(h)}),h=>{pe.info("snapshot ".concat(h," has been canceled"))})),r.rangedSnapshotCounter+=1,r.snapshotCounter+=1,r.snapshotPending+=1,r.rangedSnapshotCounter>=r.rangedSnapshotsTotal[r.gridRangeCounter]&&(r.gridRangeCounter+=1,r.rangedSnapshotCounter=0,o=r.gridRanges[r.gridRangeCounter]),n+=1};n<e;)a()}}handlePortMessage(e){var{data:r}=e,{download:i,readableStreamPulling:n}=r;if(!this.useBlobFallback){if(i!=null){var{includeColumnHeaders:o}=this;this.makeIframe("".concat(i)),this.writeCsvTable(o)}n!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,te.STREAM_TIMEOUT)))}}handleSnapshotResolved(e,r,i,n){this.snapshotHandlerTimeout=setTimeout(()=>{this.snapshotsBuffer.set(r,e),this.snapshotPending-=1,this.writeSnapshot(r,i,n),this.cancelableSnapshots[r]=null},te.SNAPSHOT_HANDLER_TIMEOUT)}makeIframe(e){var r=document.createElement("iframe");r.hidden=!0,r.src=e,r.name="iframe",document.body.appendChild(r),this.iframe=r}removeIframe(){var e;(e=this.iframe)===null||e===void 0||e.remove(),this.iframe=void 0}render(){return null}}_(te,"DOWNLOAD_CELL_CHUNK",6e3);_(te,"SNAPSHOT_BUFFER_SIZE",5);_(te,"STREAM_TIMEOUT",8e3);_(te,"SNAPSHOT_HANDLER_TIMEOUT",5);_(te,"defaultProps",{isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}});function Jo(t){var e,{group:r,onDelete:i,onColorChange:n,onNameChange:o,validateName:a}=t,{isNew:s}=r,l=C.useRef(r),u=C.useRef(null),c=C.useRef(null),[h,p]=C.useState(!1),[v,m]=C.useState(s?"":r.name),[g,f]=C.useState(s),[b,w]=C.useState(!1),y=v!==r.name?a(v):"",O=s&&!b||y==="",P=C.useCallback(()=>{p(!1)},[]);C.useEffect(function(){g&&u.current&&(u.current.focus(),u.current.select())},[g]),C.useEffect(function(){return()=>{l.current.isNew&&i(l.current)}},[i]),C.useEffect(function(){if(h){var N,T;(N=c.current)===null||N===void 0||N.click(),(T=c.current)===null||T===void 0||T.focus(),window.addEventListener("click",P,!0)}return()=>window.removeEventListener("click",P,!0)},[h,P]);var D=()=>{O&&(o(r,v),f(!1))},E=()=>{if(s){i(r);return}m(r.name),f(!1)},I=j=>{w(!0),j.key==="Enter"&&(j.stopPropagation(),D()),j.key===" "&&j.stopPropagation(),j.key==="Escape"&&E()};return g?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"editing-container",children:[d.jsx("input",{ref:u,className:V("form-control",{"is-invalid":!O}),value:v,placeholder:"Group Name",onChange:j=>m(j.target.value),onKeyDown:I,onBlur:()=>w(!0)}),d.jsx(M,{kind:"ghost",icon:fr,tooltip:"Confirm",onClick:D}),d.jsx(M,{kind:"ghost",icon:sn,tooltip:"Cancel",onClick:E})]}),!O&&d.jsx("p",{className:"mb-0 validate-label-error text-danger",children:y})]}):d.jsxs("div",{className:"group-name-wrapper",children:[d.jsx("span",{className:"column-name",children:v}),d.jsx(M,{className:"p-1 mx-1",kind:"ghost",icon:Xt,tooltip:"Edit",onClick:()=>{f(!0)}}),d.jsxs("span",{className:"right-buttons",children:[d.jsx(M,{kind:"ghost",icon:Ge,tooltip:"Delete group",onClick:()=>i(r)}),d.jsx(M,{kind:"ghost",className:"color-swatch mr-1",icon:r.color!==void 0?d.jsxs("span",{className:"fa-layers",children:[d.jsx(K,{className:"color-swatch",icon:Gr,color:J.white,transform:"down-1"}),d.jsx(K,{className:"color-swatch",icon:Gr,color:r.color,transform:"shrink-2 down-1"})]}):ln,tooltip:"Set color",onClick:()=>p(j=>!j)}),h&&d.jsxs(d.Fragment,{children:[d.jsx("input",{"aria-label":"Color input",ref:c,type:"color",list:"presetColors",value:(e=r.color)!==null&&e!==void 0?e:J["content-bg"],style:{visibility:"hidden",width:0,height:0,padding:0,border:0},onChange:j=>{r.color=j.target.value,n(r,j.target.value)}}),d.jsxs("datalist",{id:"presetColors",children:[d.jsx("option",{children:J["content-bg"]}),d.jsx("option",{children:J.primary}),d.jsx("option",{children:J.foreground}),d.jsx("option",{children:J.green}),d.jsx("option",{children:J.yellow}),d.jsx("option",{children:J.orange}),d.jsx("option",{children:J.red}),d.jsx("option",{children:J.purple}),d.jsx("option",{children:J.blue}),d.jsx("option",{children:J["gray-400"]})]})]})]})]})}function vt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function mt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vt(Object(r),!0).forEach(function(i){ea(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function ea(t,e,r){return(e=ra(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ra(t){var e=ta(t,"string");return typeof e=="symbol"?e:e+""}function ta(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ia(){}var na=C.forwardRef(function(e,r){var{value:i,clone:n,childCount:o,item:a,onVisibilityChange:s,onClick:l,onGroupDelete:u,onGroupColorChange:c,onGroupNameChange:h,validateGroupName:p,handleProps:v}=e,{group:m,modelIndex:g,isVisible:f}=a.data,b=C.useRef(null),w=C.useCallback(O=>{if(O.buttons===1){var P;s([g].flat(),!f),(P=b.current)===null||P===void 0||P.focus()}},[s,g,f]),y=C.useCallback(O=>{l(i,O)},[l,i]);return d.jsxs("div",mt(mt({ref:r,className:V("tree-item",{isSelected:a.selected,"two-dragged":o===2,"multiple-dragged":o>2}),onClick:y},v),{},{children:[d.jsx(M,{ref:b,kind:"ghost",className:"px-1",onClick:ia,onMouseDown:w,onMouseEnter:w,icon:f?ei:ri,tooltip:"Toggle visibility"}),d.jsx("span",{className:V("column-name",m&&"column-group"),children:m&&!n?d.jsx(Jo,{group:m,onDelete:u,onColorChange:c,onNameChange:h,validateName:p}):i}),d.jsxs("div",{children:[n&&o>1&&d.jsx("span",{className:"item-count",children:o}),d.jsx(Xe,{children:"Drag to re-order"}),d.jsx(K,{icon:Zt})]})]}))});function oa(t){return t.parentId!==void 0}function pt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function ft(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?pt(Object(r),!0).forEach(function(i){aa(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function aa(t,e,r){return(e=sa(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function sa(t){var e=la(t,"string");return typeof e=="symbol"?e:e+""}function la(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ua(t,e){return Math.round(t/e)}function si(t,e,r,i,n,o){var a=t.findIndex(u=>u.name===i);if(a===-1){var s=r.get(i);if(s==null)throw new Error("Column or header group not found: ".concat(i));var l=s.childIndexes.flat();return{id:i,selected:o.has(i),children:s.children.map(u=>si(t,e,r,u,n,o)).sort((u,c)=>{var h=Array.isArray(u.data.visibleIndex)?u.data.visibleIndex[0]:u.data.visibleIndex,p=Array.isArray(c.data.visibleIndex)?c.data.visibleIndex[0]:c.data.visibleIndex;return h-p}),data:{modelIndex:l,visibleIndex:s.getVisibleRange(e),group:s,isVisible:l.some(u=>!n.has(u))}}}return{id:i,children:[],selected:o.has(i),data:{modelIndex:a,visibleIndex:U.getVisibleIndex(a,e),isVisible:!n.has(a)}}}function da(t,e,r,i,n){for(var o=[],a=new Set(n),s=new Map(r.map(h=>[h.name,h])),l=new Set(i),u=0,c=function(){for(var p=U.getModelIndex(u,e),v=t[p].name,m=r.find(f=>{var{children:b}=f;return b.includes(v)});m!==void 0&&m.parent!==void 0;)m=s.get(m.parent);var g=si(t,e,s,m?m.name:v,l,a);o.push(g),Array.isArray(g.data.visibleIndex)?u+=g.data.visibleIndex[1]-g.data.visibleIndex[0]+1:u+=1};u<t.length;)c();return o}function Je(t,e,r,i,n){var o=t.findIndex(b=>{var{id:w}=b;return w===r}),a=t.findIndex(b=>{var{id:w}=b;return w===e}),s=t[a],l=Ui(t,a,o),u=l[o-1],c=l[o+1],h=ua(i,n),p=s.depth+h,v=ca({previousItem:u,nextItem:c}),m=ha({nextItem:c}),g=p;return p>=v?g=v:p<m&&(g=m),{depth:g,maxDepth:v,minDepth:m,parentId:f()};function f(){var b;if(g===0||!u)return null;if(g===u.depth)return u.parentId;if(g>u.depth)return u.id;var w=(b=l.slice(0,o).reverse().find(y=>y.depth===g))===null||b===void 0?void 0:b.parentId;return w??null}}function ca(t){var e,r,{previousItem:i,nextItem:n}=t;return Math.max((e=i==null?void 0:i.depth)!==null&&e!==void 0?e:0,(r=n==null?void 0:n.depth)!==null&&r!==void 0?r:0)}function ha(t){var{nextItem:e}=t;return e?e.depth:0}function li(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return t.reduce((i,n,o)=>[...i,ft(ft({},n),{},{parentId:e,depth:r,index:o}),...li(n.children,n.id,r+1)],[])}function ee(t){return t.every(oa)?[...t]:li(t)}function ui(t,e){for(var r=0;r<t.length;r+=1){var i=t[r],{id:n,children:o}=i;if(n===e)return i;if(o.length){var a=ui(o,e);if(a)return a}}}function di(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return t.reduce((r,i)=>{var{children:n}=i;return n.length?di(n,r+1):r+1},e)}function va(t,e){var r=ui(t,e);return r?di(r.children):0}function gt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function He(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gt(Object(r),!0).forEach(function(i){ma(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function ma(t,e,r){return(e=pa(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pa(t){var e=fa(t,"string");return typeof e=="symbol"?e:e+""}function fa(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ga=[he.Down,he.Right,he.Up,he.Left],ba=[he.Left,he.Right];function ya(t,e,r){return(i,n)=>{var{currentCoordinates:o,context:{active:a,over:s,collisionRect:l,droppableRects:u,droppableContainers:c}}=n;if(ga.includes(i.code)){if(!a||!l)return;i.preventDefault();var{current:{items:h,offset:p}}=t;if(ba.includes(i.code)&&(s==null?void 0:s.id)!=null){var{depth:v,maxDepth:m,minDepth:g}=Je(h,a.id,s.id,p,r);switch(i.code){case he.Left:if(v>g)return He(He({},o),{},{x:o.x-r});break;case he.Right:if(v<m)return He(He({},o),{},{x:o.x+r});break}return}var f=[];c.forEach(A=>{if(!(A!=null&&A.disabled||A.id===(s==null?void 0:s.id))){var B=u.get(A.id);if(B)switch(i.code){case he.Down:l.top<B.top&&f.push(A);break;case he.Up:l.top>B.top&&f.push(A);break}}});var b=$i({active:a,collisionRect:l,pointerCoordinates:null,droppableRects:u,droppableContainers:f}),w=Bi(b,"id");if(w===(s==null?void 0:s.id)&&b.length>1&&(w=b[1].id),w!=null&&(s==null?void 0:s.id)!=null){var y=u.get(a.id),O=u.get(w),P=c.get(w);if(y&&O&&P){var D=h.findIndex(A=>{var{id:B}=A;return B===w}),E=h[D],I=h.findIndex(A=>{var{id:B}=A;return B===a.id}),j=h[I];if(E!=null&&j!=null){var{depth:N}=Je(h,a.id,w,(E.depth-j.depth)*r,r),T=D>I,x=T?1:-1,F=e?(l.height-y.height)/2:0,G={x:O.left+N*r,y:O.top+x*F};return G}}}}}}function Ca(t,e,r){return(e=Sa(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sa(t){var e=wa(t,"string");return typeof e=="symbol"?e:e+""}function wa(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ci extends Hi{}Ca(ci,"activators",[{eventName:"onPointerDown",handler:t=>{var{nativeEvent:e}=t;return!(!e.isPrimary||e.button!==0||ja(e.target))}}]);var Oa=["button","input","textarea","select","option"];function ja(t){return!!((t==null?void 0:t.tagName)!=null&&Oa.includes(t.tagName.toLowerCase()))}function hi(t){var{clone:e=!1,depth:r,disableInteraction:i=!1,ghost:n=!1,handleProps:o,value:a,dragRef:s=null,wrapperRef:l=null,renderItem:u,item:c,childCount:h}=t,p=C.useMemo(()=>Array(r).fill(0).map((m,g)=>d.jsx("span",{className:"depth-line"},"depth-line-".concat(g))),[r]),v=C.useMemo(()=>({ref:s,clone:e,value:a,item:c,childCount:h,handleProps:o}),[s,e,a,c,h,o]);return d.jsxs("li",{className:V("item-wrapper",{clone:e,ghost:n,disableInteraction:i}),ref:l,children:[!e&&p,u(v)]},a)}hi.displayName="TreeItem";var Ta=["id","depth"];function bt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function We(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bt(Object(r),!0).forEach(function(i){Pa(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Pa(t,e,r){return(e=xa(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xa(t){var e=Da(t,"string");return typeof e=="symbol"?e:e+""}function Da(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Na(t,e){if(t==null)return{};var r,i,n=Ea(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Ea(t,e){if(t==null)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;r[i]=t[i]}return r}var Ia=t=>{var{isSorting:e,wasDragging:r}=t;return!(e||r)};function yt(t){var{id:e,depth:r}=t,i=Na(t,Ta),{attributes:n,isDragging:o,isSorting:a,listeners:s,setDraggableNodeRef:l,setDroppableNodeRef:u,transform:c,transition:h}=Wi({id:e,animateLayoutChanges:Ia}),p=mr.Translate.toString(c),v=C.useMemo(()=>({transform:p,transition:h}),[p,h]),m=C.useMemo(()=>We(We(We({},n),s),{},{style:v}),[n,s,v]);return d.jsx(hi,We({dragRef:l,wrapperRef:u,depth:r,ghost:o,disableInteraction:a,handleProps:m},i))}function Ct(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function er(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ct(Object(r),!0).forEach(function(i){Ra(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ct(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Ra(t,e,r){return(e=ka(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ka(t){var e=Aa(t,"string");return typeof e=="symbol"?e:e+""}function Aa(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Fa={keyframes(t){var{transform:e}=t;return[{opacity:1,transform:mr.Transform.toString(e.initial)},{opacity:0,transform:mr.Transform.toString(er(er({},e.final),{},{x:e.final.x+5,y:e.final.y+5}))}]},easing:"ease-out",sideEffects(t){var{active:e}=t;e.node.animate([{opacity:0},{opacity:1}],{duration:kr.duration,easing:kr.easing})}},ze=null;function Ga(t){var e;return ze==null&&t.activeNodeRect&&t.activatorEvent instanceof PointerEvent&&(ze=Math.floor((t.activatorEvent.clientY-t.activeNodeRect.top)/t.activeNodeRect.height)*t.activeNodeRect.height),t.activeNodeRect||(ze=null),er(er({},t.transform),{},{y:t.transform.y+((e=ze)!==null&&e!==void 0?e:0)})}function Ma(t){var{items:e,renderItem:r,indentationWidth:i=30,indicator:n=!1,activeId:o,overId:a,offsetLeft:s}=t,l=zi(),u=C.useRef(l);C.useEffect(function(){u.current=l},[l]),C.useEffect(function(){u.current.measureDroppableContainers(e.map(m=>{var{id:g}=m;return g}))},[e]);var c=o!=null&&a!=null?Je(e,o,a,s,i):null,h=C.useRef({items:e,offset:s}),p=o!=null?e.find(v=>{var{id:m}=v;return m===o}):null;return C.useEffect(()=>{h.current={items:e,offset:s}},[e,s]),d.jsxs(d.Fragment,{children:[d.jsx("div",{className:V("tree-container",o!=null&&"marching-ants"),children:e.map(v=>{var{id:m,depth:g}=v;return d.jsx(yt,{id:m,value:m,depth:m===o&&c?c.depth:g,item:v,renderItem:r},m)})}),Vi.createPortal(d.jsx(Ki,{dropAnimation:Fa,modifiers:[Ga],className:"visibility-ordering-list",children:o!=null&&p?d.jsx(yt,{id:o,depth:p.depth,clone:!0,childCount:va(e,o)+1,value:o.toString(),renderItem:r,item:p}):null}),document.body)]})}function St(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Ve(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?St(Object(r),!0).forEach(function(i){La(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):St(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function La(t,e,r){return(e=_a(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _a(t){var e=Ua(t,"string");return typeof e=="symbol"?e:e+""}function Ua(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $a={droppable:{strategy:Ji.Always}},Ba={activationConstraint:{distance:5}};function Ha(t){var{items:e,indicator:r=!1,indentationWidth:i=30,onDragStart:n,onDragEnd:o,renderItem:a}=t,[s,l]=C.useState(null),[u,c]=C.useState(null),[h,p]=C.useState(0),v=C.useMemo(()=>{var j=ee(e);return s!=null?j.filter(N=>{var{id:T,selected:x}=N;return T===s||!x}):j},[s,e]),m=s!=null&&u!=null?Je(v,s,u,h,i):null,g=C.useRef({items:v,offset:h}),f=C.useMemo(()=>({coordinateGetter:ya(g,r,i)}),[i,r]),b=Qi(Ar(ci,Ba),Ar(en,f)),w=C.useMemo(()=>v.map(j=>{var{id:N}=j;return N}),[v]);C.useEffect(()=>{g.current={items:v,offset:h}},[v,h]);var y=C.useCallback(j=>{var{active:{id:N}}=j;l(N),c(N),n==null||n(N),document.body.style.setProperty("cursor","grabbing")},[n]),O=C.useCallback(j=>{var{delta:N}=j;p(N.x)},[]),P=C.useCallback(j=>{var N,{over:T}=j;c((N=T==null?void 0:T.id)!==null&&N!==void 0?N:null)},[]),D=C.useCallback(()=>{c(null),l(null),p(0),document.body.style.setProperty("cursor","")},[]),E=C.useCallback(j=>{var{active:N,over:T}=j;if(D(),m&&T){var{depth:x,parentId:F}=m,G=JSON.parse(JSON.stringify(ee(e))),A=G.findIndex(W=>{var{id:ve}=W;return ve===T.id}),B=G.findIndex(W=>{var{id:ve}=W;return ve===N.id}),H=G[B];G[B]=Ve(Ve({},H),{},{depth:x,parentId:F}),o==null||o(H,Ve(Ve({},G[A]),{},{parentId:m.parentId}))}},[e,o,m,D]),I=C.useCallback(()=>{D()},[D]);return d.jsx(qi,{sensors:b,collisionDetection:Xi,measuring:$a,onDragStart:y,onDragMove:O,onDragOver:P,onDragEnd:E,onDragCancel:I,children:d.jsx(Yi,{items:w,strategy:Zi,children:d.jsx(Ma,{items:v,renderItem:a,indicator:r,indentationWidth:i,activeId:s,overId:u,offsetLeft:h})})})}function wt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Ot(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?wt(Object(r),!0).forEach(function(i){Wa(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Wa(t,e,r){return(e=za(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function za(t){var e=Va(t,"string");return typeof e=="symbol"?e:e+""}function Va(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ka(t,e,r,i,n,o,a,s){var l=n.map((O,P)=>Ot(Ot({},O),{},{index:P})),u=[],c=i,h=o[0].data.visibleIndex,p=l.findIndex(O=>{var{id:P}=O;return P===t.id}),v=l.findIndex(O=>{var{id:P}=O;return P===e.id}),m=Array.isArray(h)?h[1]+1:h+1;c=Ce(o[0],e.parentId,c);for(var g=1;g<o.length;g+=1){var{data:{visibleIndex:f}}=o[g];u=U.moveItemOrRange(f,m,u,!0),m+=Array.isArray(f)?f[1]-f[0]+1:1,c=Ce(o[g],e.parentId,c)}var b=[Array.isArray(h)?h[0]:h,m-1],w=Array.isArray(e.data.visibleIndex)?e.data.visibleIndex[0]:e.data.visibleIndex,y=U.getVisibleIndex(w,u);return p>v&&y>w&&(y-=1),e.children.length>0&&(Array.isArray(h)?h[0]:h)<y&&(y-=1),b[0]<y&&(y-=b[1]-b[0]),u=U.moveItemOrRange(b,pr(y,a,s),u),{groups:c,movedColumns:r.concat(u)}}function Ce(t,e,r){if(t.parentId===e)return[...r];var i=r.map(f=>new we(f)),n=new Map(i.map(f=>[f.name,f])),o=i.find(f=>f.name===t.parentId),a=i.find(f=>f.name===e),s=i.find(f=>f.name===t.id);if(o!=null&&(o.children=o.children.filter(f=>f!==t.id),o.children.length===0)){var l,u=new Set([o.name]),{parent:c=""}=o,h=n.get(c);for((l=h)===null||l===void 0||l.removeChildren([o.name]);h&&h.children.length===0;){var p,v;u.add(h.name);var m=(p=(v=h)===null||v===void 0?void 0:v.parent)!==null&&p!==void 0?p:"",g=n.get(m);g==null||g.removeChildren([h.name]),h=g}i=i.filter(f=>{var{name:b}=f;return!u.has(b)})}return a!=null&&a.addChildren([t.id]),s==null||s.setParent(e??void 0),i}function jt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function De(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jt(Object(r),!0).forEach(function(i){ne(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function ne(t,e,r){return(e=Qa(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qa(t){var e=qa(t,"string");return typeof e=="symbol"?e:e+""}function qa(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Xa=150;class z extends C.PureComponent{static shouldRenderColumn(e){return e.isProxy!==!0}constructor(e){super(e),ne(this,"list",void 0),ne(this,"debouncedSearchColumns",jr(this.searchColumns,Xa)),ne(this,"handleGroupColorChange",rn((r,i)=>{var{columnHeaderGroups:n,onColumnHeaderGroupChanged:o}=this.props,a=[...n],s=new we(De(De({},r),{},{color:i}));a.splice(a.findIndex(l=>{var{name:u}=l;return u===r.name}),1,s),o(a)},250)),ne(this,"renderItem",ye(r=>{var{value:i,clone:n,item:o,ref:a,handleProps:s}=r,{onColumnVisibilityChanged:l}=this.props,{selectedColumns:u}=this.state,c=i;if(n){var h=this.getSelectedParentItems().map(p=>{var{id:v}=p;return v});c=h.join(", ")}return d.jsx(na,{ref:a,value:c,clone:n,item:o,childCount:u.size,onVisibilityChange:l,onClick:this.handleItemClick,onGroupDelete:this.handleGroupDelete,onGroupColorChange:this.handleGroupColorChange,onGroupNameChange:this.handleGroupNameChange,validateGroupName:this.validateGroupName,handleProps:s})},{max:1e3})),ne(this,"getMemoizedFirstMovableIndex",ye((r,i,n)=>{for(var o=0;o<i.length;o+=1){var a=U.getModelIndex(o,n);if(r.isColumnMovable(a))return o}return null},{max:10})),ne(this,"getMemoizedLastMovableIndex",ye((r,i,n)=>{for(var o=i.length-1;o>=0;o-=1){var a=U.getModelIndex(o,n);if(r.isColumnMovable(a))return o}return null},{max:10})),ne(this,"memoizedGetTreeItems",ye((r,i,n,o,a)=>da(r,i,n,o,[...a.values()]),{max:1e3})),ne(this,"makeVisibilityOrderingList",ye((r,i)=>{var{movedColumns:n}=this.props,o=[],a=this.getFirstMovableIndex(),s=this.getLastMovableIndex(),l=i.findIndex(O=>{var{data:P}=O;return Array.isArray(P.visibleIndex)?P.visibleIndex[0]===a:P.visibleIndex===a}),u=i.findIndex(O=>{var{data:P}=O;return Array.isArray(P.visibleIndex)?P.visibleIndex[1]===s:P.visibleIndex===s}),c=i.slice(l,u+1);if(a==null||s===null){for(var h=0;h<r.length;h+=1){var p=U.getModelIndex(h,n),v=r[p];z.shouldRenderColumn(v)&&o.push(this.renderImmovableItem(v.name))}return o}for(var m=0;m<a;m+=1){var g=U.getModelIndex(m,n),f=r[g];z.shouldRenderColumn(f)&&o.push(this.renderImmovableItem(f.name))}a!==null&&a>0&&o.push(d.jsx("hr",{},"top-horizontal-divider")),o.push(d.jsx(Ha,{items:c,renderItem:this.renderItem,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd},"movable-items")),s!=null&&s<r.length-1&&o.push(d.jsx("hr",{},"bottom-horizontal-divider"));for(var b=s+1;b<r.length;b+=1){var w=U.getModelIndex(b,n),y=r[w];z.shouldRenderColumn(y)&&o.push(this.renderImmovableItem(y.name))}return o},{max:10})),ne(this,"renderImmovableItem",ye(r=>d.jsx("div",{className:"visibility-ordering-list-item immovable",children:d.jsx("div",{className:"column-item",children:d.jsx("span",{className:"column-name",children:r})})},r),{max:1e3})),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupDelete=this.handleGroupDelete.bind(this),this.handleGroupNameChange=this.handleGroupNameChange.bind(this),this.handleGroupCreate=this.handleGroupCreate.bind(this),this.validateGroupName=this.validateGroupName.bind(this),this.addColumnToSelected=this.addColumnToSelected.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.state={selectedColumns:new Set,queriedColumnIndex:void 0,queriedColumnRange:void 0,prevQueriedColumns:void 0,lastSelectedColumn:"",searchFilter:""},this.list=null}componentDidUpdate(e){var{movedColumns:r}=this.props;if(r!==e.movedColumns){var{searchFilter:i}=this.state;this.searchColumns(i,!1)}}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){var{model:e,onReset:r,onMovedColumnsChanged:i,onColumnHeaderGroupChanged:n}=this.props;this.setState({selectedColumns:new Set,queriedColumnIndex:void 0,queriedColumnRange:void 0,prevQueriedColumns:void 0,lastSelectedColumn:"",searchFilter:""}),r(),n(e.initialColumnHeaderGroups),i(e.initialMovedColumns)}resetSelection(){this.setState({selectedColumns:new Set,lastSelectedColumn:""})}handleSearchInputChange(e){var r=e.target.value;if(this.setState({searchFilter:r}),!r){this.debouncedSearchColumns.cancel(),this.resetSelection();return}this.debouncedSearchColumns(r)}searchColumns(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=ee(this.getTreeItems()),n=i.filter(c=>{var h,p,{id:v,data:m}=c;return!((h=(p=m.group)===null||p===void 0?void 0:p.isNew)!==null&&h!==void 0&&h)&&v.toLowerCase().includes(e.toLowerCase())}),o=n.reduce((c,h)=>{var{id:p}=h,v=i.findIndex(m=>m.id===p);return De(De({},c),{},{[v]:p})},{});if(!r){this.setState({prevQueriedColumns:o});return}var a=n.map(c=>{var{id:h}=c;return h});if(this.addColumnToSelected(a,!1),a.length>0){var s,l=i.findIndex(c=>{var{id:h}=c;return h.toLowerCase().includes(e.toLowerCase())}),u=(s=this.list)===null||s===void 0?void 0:s.querySelectorAll(".item-wrapper")[l];u==null||u.scrollIntoView({block:"center"})}this.setState({prevQueriedColumns:o,queriedColumnIndex:void 0})}changeSelectedColumn(e){var r,{queriedColumnIndex:i,queriedColumnRange:n,prevQueriedColumns:o}=this.state,a=i;if(o!==void 0){var s=Object.keys(o).length;e==="forward"?n!==void 0?a=n.nextIndex:a===void 0||a>=s-1?a=0:a+=1:e==="back"&&(n!==void 0?a=n.prevIndex:a===void 0||a<=0?a=s-1:a-=1),this.addColumnToSelected([Object.values(o)[a]],!1);var l=parseInt(Object.keys(o)[a],10),u=(r=this.list)===null||r===void 0?void 0:r.querySelectorAll(".item-wrapper")[l];u==null||u.scrollIntoView({block:"center"}),this.setState({queriedColumnIndex:a,queriedColumnRange:void 0})}}adjustQueriedIndex(e){var{prevQueriedColumns:r}=this.state;if(r!==void 0){if(e in Object.values(r)){var i=Object.values(r).indexOf(e);this.setState({queriedColumnIndex:i,queriedColumnRange:void 0});return}for(var n=ee(this.getTreeItems()),o=n.findIndex(h=>h.id===e),a=Object.keys(r).map(h=>parseInt(h,10)),s=a.length-1,l=0,u=0;u<a.length;u+=1){var c=a[u];if(c<o)s=u;else if(c>o){l=u;break}}this.setState({queriedColumnRange:{prevIndex:s,nextIndex:l}})}}moveSelectedColumns(e){var{columnHeaderGroups:r}=this.props,{selectedColumns:i}=this.state,n=ee(this.getTreeItems()),o=this.getFirstMovableIndex(),a=this.getLastMovableIndex();R(o),R(a);var s=this.getSelectedParentItems(),l=e===z.MOVE_OPTIONS.UP||e===z.MOVE_OPTIONS.TOP;l||s.reverse();for(var u=[],c=r,h=function(){var{id:m,parentId:g,depth:f,data:{visibleIndex:b}}=s[p];switch(e){case z.MOVE_OPTIONS.TOP:{u=U.moveItemOrRange(b,o,u,!0);var w=Array.isArray(b)?b[1]-b[0]+1:1;o+=w,c=Ce(s[p],null,c);break}case z.MOVE_OPTIONS.BOTTOM:{u=U.moveItemOrRange(b,a,u,!0);var y=Array.isArray(b)?b[1]-b[0]+1:1;a-=y,c=Ce(s[p],null,c);break}case z.MOVE_OPTIONS.UP:{var O=n.findIndex(H=>H.id===m),P=n.map((H,W)=>W<O&&!i.has(H.id)).lastIndexOf(!0),D=n[P];if(D!=null&&D.parentId!==g)if(Math.abs(D.depth-f)>1){var E=n.map((H,W)=>W<P&&H.depth===f).lastIndexOf(!0),I=n[E];c=Ce(s[p],I.id,c)}else c=Ce(s[p],D.parentId,c);else{var j=pr(Array.isArray(b)?b[0]-1:b-1,o,a);u=U.moveItemOrRange(b,j,u,!1);var N=Array.isArray(b)?b[1]-b[0]+1:1;o+=N}break}case z.MOVE_OPTIONS.DOWN:{var T=n.findIndex(H=>H.id===m),x=n.find((H,W)=>W>T&&!i.has(H.id));if((x==null?void 0:x.parentId)!==g){var F,G=n.find(H=>H.id===g);c=Ce(s[p],(F=G==null?void 0:G.parentId)!==null&&F!==void 0?F:null,c);break}else if((x==null?void 0:x.children.length)>0){c=Ce(s[p],x.id,c);break}var A=pr(Array.isArray(b)?b[0]+1:b+1,o,a);u=U.moveItemOrRange(b,A,u,!1);var B=Array.isArray(b)?b[1]-b[0]+1:1;a-=B;break}}},p=0;p<s.length;p+=1)h();return{newMoves:u,groups:c}}handleMoveColumns(e){var{onMovedColumnsChanged:r,movedColumns:i,onColumnHeaderGroupChanged:n}=this.props,{newMoves:o,groups:a}=this.moveSelectedColumns(e),s;e===z.MOVE_OPTIONS.TOP&&(s=()=>{var l,u;(l=this.list)===null||l===void 0||(u=l.parentElement)===null||u===void 0||u.scroll({top:0})}),e===z.MOVE_OPTIONS.BOTTOM&&(s=()=>{var l,u;(l=this.list)===null||l===void 0||(u=l.parentElement)===null||u===void 0||u.scroll({top:this.list.parentElement.scrollHeight})}),n(a),o.length>0&&r(i.concat(o),s)}getSortMoves(e,r,i){var n=[...e],o=r===z.SORTING_OPTIONS.ASC;n.sort((p,v)=>{var m=p.id.toUpperCase(),g=v.id.toUpperCase();return Ke.sort(m,g,o)});for(var a=[...i],s=Math.min(...n.flatMap(p=>{var{modelIndex:v}=p.data;return Array.isArray(v)?U.getVisibleIndexes(v,a):U.getVisibleIndex(v,a)})),l=0;l<n.length;l+=1){var u=n[l],{modelIndex:c}=u.data,h=Array.isArray(c)?U.getVisibleIndexes(c,a):U.getVisibleIndex(c,a);a=Array.isArray(h)?U.moveRange([Math.min(...h),Math.max(...h)],s,a,!0):U.moveItem(h,s,a),Array.isArray(h)&&(a=this.getSortMoves(u.children,r,a)),s+=Array.isArray(c)?c.length:1}return a}handleSortColumns(e){for(var r,i,{model:n,onMovedColumnsChanged:o}=this.props,a=this.getTreeItems(),s=(r=this.getFirstMovableIndex())!==null&&r!==void 0?r:0,l=(i=this.getLastMovableIndex())!==null&&i!==void 0?i:a.length-1,u=a.slice(s,l+1),c=[...n.initialMovedColumns],h=0;h<n.frozenColumns.length;h+=1){var p,v=n.frozenColumns[h],m=U.getVisibleIndex((p=n.getColumnIndexByName(v))!==null&&p!==void 0?p:0,c);m!==h&&c.push({from:m,to:h})}var g=this.getSortMoves(u,e,c);o(g)}handleItemClick(e,r){if(r.stopPropagation(),!(r.target instanceof HTMLElement&&(r.target.tagName==="BUTTON"||r.target.tagName==="INPUT"))){r.currentTarget.focus();var{selectedColumns:i,lastSelectedColumn:n}=this.state,o=U.isModifierKeyDown(r),a=r.shiftKey,s=i.has(e),l=[e];if(s&&o){this.removeColumnFromSelected(e);return}var u=ee(this.getTreeItems());if(s&&!a&&n===e){var c=u.find(m=>{var{id:g}=m;return g===e});R(c);var h=ee(c.children).length;if(h+1===i.size){this.resetSelection();return}}if(a){var p=u.findIndex(m=>m.id===e),v=u.findIndex(m=>m.id===n);l.push(...u.slice(Math.min(v,p),Math.max(v,p)+1).map(m=>m.id))}this.addColumnToSelected(l,o||a),this.adjustQueriedIndex(e),this.setState({lastSelectedColumn:e})}}addColumnToSelected(e,r){var{selectedColumns:i}=this.state,n=new Set(r?[...i.values()].concat(e):e),o=ee(this.getTreeItems());o.forEach(a=>{var{id:s,children:l}=a;n.has(s)&&l.forEach(u=>n.add(u.id))}),this.setState({selectedColumns:n})}removeColumnFromSelected(e){var{selectedColumns:r}=this.state,i=ee(this.getTreeItems()),n=i.find(s=>{var{id:l}=s;return l===e});R(n);var o=i.find(s=>{var{id:l}=s;return l===n.parentId});ee(n==null?void 0:n.children).forEach(s=>r.delete(s.id));for(var a=function(){r.delete(o.id);var l=o.parentId;o=i.find(u=>{var{id:c}=u;return c===l})};o!=null;)a();r.delete(e),this.setState({selectedColumns:new Set(r)})}handleDragStart(e){var{selectedColumns:r}=this.state;r.has(e)||this.addColumnToSelected([e],!1)}handleDragEnd(e,r){var{movedColumns:i,onMovedColumnsChanged:n,columnHeaderGroups:o,onColumnHeaderGroupChanged:a}=this.props,s=this.getSelectedParentItems(),l=ee(this.getTreeItems()).map((v,m)=>De(De({},v),{},{index:m})),u=this.getFirstMovableIndex(),c=this.getLastMovableIndex();R(u),R(c);var{groups:h,movedColumns:p}=Ka(e,r,i,o,l,s,u,c);a(h),n(p)}handleGroupNameChange(e,r){var{columnHeaderGroups:i,onColumnHeaderGroupChanged:n}=this.props,o=[...i],a=e.name,s=o.findIndex(p=>{var{name:v}=p;return v===a}),l=o[s];R(l);var u=new we(l);u.name=r,o.splice(s,1,u);var c=o.findIndex(p=>{var{name:v}=p;return v===u.parent});if(c>=0){var h=new we(o[c]);h.removeChildren([a]),h.addChildren([r]),o.splice(c,1,h)}n(o)}handleGroupDelete(e){var{columnHeaderGroups:r,onColumnHeaderGroupChanged:i}=this.props,n=r.filter(s=>s.name!==e.name),o=n.findIndex(s=>s.name===e.parent);if(o>=0){var a=new we(n[o]);a.addChildren(e.children),a.removeChildren([e.name]),n.splice(o,1,a)}i(n)}handleGroupCreate(){var{movedColumns:e,onMovedColumnsChanged:r,onColumnHeaderGroupChanged:i}=this.props,{newMoves:n,groups:o}=this.moveSelectedColumns(z.MOVE_OPTIONS.TOP),a=o.filter(h=>!h.isNew),s=this.getSelectedParentItems(),l=s.map(h=>h.data.modelIndex).flat().filter(h=>h>=0),u="".concat(we.NEW_GROUP_PREFIX,"-").concat(Date.now()),c=new we({name:u,children:s.map(h=>{var{id:p}=h;return p}),depth:0,childIndexes:[...new Set(l)]});r(e.concat(n),()=>{var h,p;(h=this.list)===null||h===void 0||(p=h.parentElement)===null||p===void 0||p.scroll({top:0})}),i(a.concat([c])),this.resetSelection()}validateGroupName(e){var{model:r,columnHeaderGroups:i}=this.props,{columns:n}=r;return Sr.isValidColumnName(e)?n.some(o=>{var{name:a}=o;return a===e})||i.some(o=>{var{name:a}=o;return a===e})?"Duplicate name":"":"Invalid name"}getFirstMovableIndex(){var{model:e,movedColumns:r}=this.props;return this.getMemoizedFirstMovableIndex(e,e.columns,r)}getLastMovableIndex(){var{model:e,movedColumns:r}=this.props;return this.getMemoizedLastMovableIndex(e,e.columns,r)}getTreeItems(){var{model:e,movedColumns:r,hiddenColumns:i,columnHeaderGroups:n}=this.props,{selectedColumns:o}=this.state;return this.memoizedGetTreeItems(e.columns,r,n,i,o)}getSelectedParentItems(){var{selectedColumns:e}=this.state,r=ee(this.getTreeItems());return r.filter(i=>{var{id:n,parentId:o}=i;return e.has(n)&&!e.has(o??"")})}render(){var{model:e,hiddenColumns:r,onColumnVisibilityChanged:i}=this.props,{selectedColumns:n,searchFilter:o,prevQueriedColumns:a,queriedColumnIndex:s}=this.state,l=n.size>0,u=this.getTreeItems(),c=new Map(ee(u).map(y=>[y.id,y.data.modelIndex])),h=new Set(r),p=[...new Set(l?[...n.values()].map(y=>c.get(y)).filter(y=>y!=null).flat():u.map(y=>y.data.modelIndex).flat())],v=p.some(y=>!h.has(y)),m=v?"Hide All":"Show All",g=v?"Hide Selected":"Show Selected",f=this.makeVisibilityOrderingList(e.columns,u),b={index:s,next:y=>this.changeSelectedColumn(y)},w=Object.keys(a??{}).length;return d.jsxs("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,children:[d.jsxs("div",{className:"top-menu",children:[d.jsx(M,{kind:"ghost",className:"toggle-visibility-btn",onClick:()=>{i(p,!v)},icon:v?ei:ri,tooltip:"Toggle column visibility",children:l?g:m}),d.jsx(Kt,{className:"visibility-search",value:o,matchCount:o?w:void 0,onChange:this.handleSearchInputChange,cursor:b})]}),d.jsxs("div",{className:"top-menu",children:[d.jsx(M,{kind:"ghost",icon:un,className:"px-1",tooltip:"Reset to default",onClick:()=>{this.resetVisibilityOrdering()},children:"Reset"}),d.jsx("span",{className:"vertical-divider"}),d.jsx(M,{kind:"ghost",icon:Pr,className:"px-1",tooltip:"Sort ascending",onClick:()=>{this.handleSortColumns(z.SORTING_OPTIONS.ASC)}}),d.jsx(M,{kind:"ghost",icon:xr,className:"px-1",tooltip:"Sort descending",onClick:()=>{this.handleSortColumns(z.SORTING_OPTIONS.DSC)}}),d.jsx("span",{className:"vertical-divider"}),d.jsxs(M,{kind:"ghost",className:"px-1",tooltip:"Create group from selection",disabled:!l,onClick:this.handleGroupCreate,children:[d.jsxs("span",{className:"fa-layers",children:[d.jsx(K,{mask:dn,icon:Yt,transform:"right-7 down-5 shrink-6"}),d.jsx(K,{icon:cn,transform:"right-8 down-6 shrink-8"})]}),"Group"]}),d.jsx("span",{className:"vertical-divider"}),d.jsx(M,{kind:"ghost",icon:hn,className:"px-1",tooltip:"Move selection up",onClick:()=>{this.handleMoveColumns(z.MOVE_OPTIONS.UP)},disabled:!l}),d.jsx(M,{kind:"ghost",icon:vn,className:"px-1",tooltip:"Move selection down",onClick:()=>{this.handleMoveColumns(z.MOVE_OPTIONS.DOWN)},disabled:!l}),d.jsx(M,{kind:"ghost",icon:mn,className:"px-1",tooltip:"Move selection to top",onClick:()=>{this.handleMoveColumns(z.MOVE_OPTIONS.TOP)},disabled:!l}),d.jsx(M,{kind:"ghost",icon:pn,className:"px-1",tooltip:"Move selection to bottom",onClick:()=>{this.handleMoveColumns(z.MOVE_OPTIONS.BOTTOM)},disabled:!l})]}),d.jsx("div",{role:"menu",className:V("visibility-ordering-list"),children:d.jsx("div",{className:"column-list",ref:y=>{this.list=y},children:f})})]})}}ne(z,"SORTING_OPTIONS",{DSC:"DSC",ASC:"ASC"});ne(z,"MOVE_OPTIONS",{TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"});function Ya(t,e,r){return(e=Za(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Za(t){var e=Ja(t,"string");return typeof e=="symbol"?e:e+""}function Ja(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ql extends ue{constructor(e){super(850),Ya(this,"irisGrid",void 0),this.irisGrid=e}destroyColumnTooltip(){this.irisGrid.setState({overflowButtonTooltipProps:null})}setCursor(e){return this.isHoveringOverflowButton(e)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition(e){var{x:r,y:i,column:n,row:o}=e;if(n==null||o==null)return null;var{renderer:a,grid:s,state:l,props:u}=this.irisGrid;if(!s)return null;var{metrics:c}=l,{model:h}=u,{canvasContext:p}=s,v=this.irisGrid.getTheme(),m={context:p,mouseX:r,mouseY:i,metrics:c,model:h,theme:v},{left:g,top:f,width:b,height:w}=a.getCellOverflowButtonPosition(m);return g==null||b==null||f==null||w==null?null:{left:g,top:f,width:b,height:w}}isHoveringOverflowButton(e){var r,{x:i,y:n}=e,{left:o,top:a,width:s,height:l}=(r=this.getButtonPosition(e))!==null&&r!==void 0?r:{};if(o==null||s==null||a==null||l==null)return!1;var{renderer:u,grid:c,state:h,props:p}=this.irisGrid;if(!c)return!1;var{metrics:v}=h,{model:m}=p,{canvasContext:g}=c,f=c.getTheme(),b={context:g,mouseX:i,mouseY:n,metrics:v,model:m,theme:f};return u.shouldRenderOverflowButton(b)&&i>=o&&i<=o+s&&n>=a&&n<=a+l}onMove(e){if(this.isHoveringOverflowButton(e)){var{overflowButtonTooltipProps:r}=this.irisGrid.state,i=this.getButtonPosition(e);Ye(r,i)||this.irisGrid.setState({overflowButtonTooltipProps:i})}else this.destroyColumnTooltip();return this.setCursor(e)}onWheel(e){return this.destroyColumnTooltip(),this.onMove(e)}onDown(e){this.destroyColumnTooltip();var{column:r,row:i}=e;return this.isHoveringOverflowButton(e)&&this.irisGrid.setState({showOverflowModal:!0,overflowText:this.irisGrid.getValueForCell(r,i)}),!1}onContextMenu(){return this.destroyColumnTooltip(),!1}onLeave(){return this.destroyColumnTooltip(),!1}}function es(t,e,r){return(e=rs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rs(t){var e=ts(t,"string");return typeof e=="symbol"?e:e+""}function ts(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Xl extends ue{constructor(e){super(),es(this,"irisGrid",void 0),this.irisGrid=e,this.cursor=null}isActive(){var{isSelectingColumn:e}=this.irisGrid.props;return e}isValidColumn(e){if(e==null||e.isProxy===!0)return!1;var{columnSelectionValidator:r}=this.irisGrid.props;return r!=null?r(e):!0}updateColumnSelectionStatus(){var{columnSelectionValidator:e}=this.irisGrid.props;e!=null&&e(null)}getTableColumn(e){if(e==null)return null;var{model:r}=this.irisGrid.props,i=this.irisGrid.getModelColumn(e);return i==null?null:r.columns[i]}onMove(e){if(!this.isActive())return!1;var{columnAllowedCursor:r,columnNotAllowedCursor:i}=this.irisGrid.props,{column:n}=e,o=this.getTableColumn(n);return this.isValidColumn(o)?(this.cursor=r,this.irisGrid.setState({hoverSelectColumn:n})):(this.cursor=i,this.irisGrid.setState({hoverSelectColumn:null})),!0}onWheel(e){if(!this.isActive())return!1;var{columnAllowedCursor:r,columnNotAllowedCursor:i}=this.irisGrid.props,{column:n}=e,o=this.getTableColumn(n);return this.isValidColumn(o)?(this.cursor=r,this.irisGrid.setState({hoverSelectColumn:n})):(this.cursor=i,this.irisGrid.setState({hoverSelectColumn:null})),{preventDefault:!1,stopPropagation:!1}}onLeave(){return this.isActive()&&this.irisGrid.setState({hoverSelectColumn:null}),this.updateColumnSelectionStatus(),!1}onDown(){return this.isActive()}onClick(e){if(!this.isActive())return!1;var{column:r}=e,i=this.getTableColumn(r);return i!=null&&this.isValidColumn(i)&&this.irisGrid.selectColumn(i),!0}}function is(t,e,r){return(e=ns(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ns(t){var e=os(t,"string");return typeof e=="symbol"?e:e+""}function os(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Yl extends ue{constructor(e){super(),is(this,"irisGrid",void 0),this.irisGrid=e}hideColumnTooltip(){var{tooltip:e}=this.irisGrid;e&&(e.stopTimer(),e.hide())}onDown(){return this.hideColumnTooltip(),!1}onContextMenu(){return this.hideColumnTooltip(),!1}onWheel(){return this.hideColumnTooltip(),!1}onLeave(e,r,i){var{relatedTarget:n}=i instanceof MouseEvent?i:i.nativeEvent,{tooltip:o}=this.irisGrid;if(!o)return!1;var a=o.popper.current;return a&&n instanceof Element&&a.element.contains(n)||this.hideColumnTooltip(),!1}onMove(e){var{column:r,row:i,columnHeaderDepth:n}=e,{shownColumnTooltip:o}=this.irisGrid.state,a=null;return r!==null&&i===null&&n===0&&(a=r),a!==o&&this.irisGrid.setState({shownColumnTooltip:a}),!1}}function vi(t,e,r){return(e=as(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function as(t){var e=ss(t,"string");return typeof e=="symbol"?e:e+""}function ss(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class tr extends C.Component{constructor(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tr.defaultProps;super(e),vi(this,"inputRef",void 0),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.inputRef=vr.createRef()}handleInputChange(){var{onChange:e}=this.props;this.inputRef.current&&e(this.inputRef.current.value)}closeContextMenu(){var{forwardedProps:e}=this.props,{closeMenu:r}=e;r(!0)}revertToDefault(){var{onChange:e}=this.props;e(null)}returnFocusToContextMenu(){var e=fn.getClosestByClassName(this.inputRef.current,"context-menu-container");e instanceof HTMLElement&&e.focus()}handleKeyDown(e){switch(e.key){case"Enter":e.stopPropagation(),this.closeContextMenu();break;case"Escape":e.stopPropagation(),this.revertToDefault(),this.closeContextMenu();break;case"ArrowRight":case"ArrowLeft":e.stopPropagation();break;case"ArrowUp":case"ArrowDown":this.returnFocusToContextMenu();break;default:e.stopPropagation()}}render(){var{formatString:e,forwardedProps:r,placeholder:i,title:n}=this.props,{menuItem:{description:o},iconElement:a}=r;return d.jsxs("div",{className:"form-group flex-grow mb-0",children:[d.jsxs("div",{className:"custom-format-title",children:[d.jsx("span",{className:"icon",children:a}),d.jsxs("label",{className:"title mb-0",htmlFor:"custom-format-input",children:[n,o!=null&&d.jsx(Xe,{children:o})]})]}),d.jsx("div",{className:"pl-2 pr-2 pb-2",children:d.jsx("input",{id:"custom-format-input",className:"form-control text-right mb-0",type:"text",defaultValue:e,ref:this.inputRef,placeholder:i,onKeyDown:this.handleKeyDown,onChange:this.handleInputChange,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"})})]})}}vi(tr,"defaultProps",{formatString:"",forwardedProps:{menuItem:{},closeMenu(t){},iconElement:null},placeholder:"",title:"",onChange(t){}});class ie{static isDefaultSelected(e){return!e||![Qe.TYPE_CONTEXT_CUSTOM,Qe.TYPE_CONTEXT_PRESET].includes(e.type)}static isCustomSelected(e){return e!=null&&e.type===Qe.TYPE_CONTEXT_CUSTOM}static makeOption(e,r,i,n){return{title:e,description:e,group:i,format:r,isSelected:n}}static makeCustomFormatOption(e,r,i,n,o){var a;return{title:e.label,description:e.label,format:e,group:r,isSelected:n,menuElement:d.jsx(tr,{formatString:(a=e.formatString)!==null&&a!==void 0?a:void 0,title:e.label,placeholder:i,onChange:o})}}}function Dr(t,e,r){return(e=ls(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ls(t){var e=us(t,"string");return typeof e=="symbol"?e:e+""}function us(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class X{static getOptions(e,r){var i=new Date,n=[{group:X.dateGroup,formatString:"yyyy-MM-dd"},{group:X.dateGroup,formatString:"MM-dd-yyyy"},{group:X.timeGroup,formatString:"HH:mm:ss"},{group:X.timeGroup,formatString:"HH:mm:ss.SSS"},{group:X.timeGroup,formatString:"HH:mm:ss.SSSSSSSSS"},{group:X.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss"},{group:X.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSS"},{group:X.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"}],o=n.map(s=>{var l=Re.makeFormat("",s.formatString,Re.TYPE_CONTEXT_PRESET),u=e.getFormattedString(i,$.dataType.DATETIME,"",l);return ie.makeOption(u,l,s.group,Re.isSameFormat(l,r))}),a=ie.makeOption("Default",null,X.dateGroup,ie.isDefaultSelected(r));return[a,...o]}}Dr(X,"dateGroup",10);Dr(X,"timeGroup",20);Dr(X,"dateTimeGroup",30);function ir(t,e,r){return(e=ds(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ds(t){var e=cs(t,"string");return typeof e=="symbol"?e:e+""}function cs(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Q{static getOptions(e,r,i){var n=[{format:Z.FORMAT_PERCENT,group:Q.presetGroup},{format:Z.FORMAT_BASIS_POINTS,group:Q.presetGroup},{format:Z.FORMAT_THOUSANDS,group:Q.presetGroup},{format:Z.FORMAT_MILLIONS,group:Q.presetGroup},{format:Z.FORMAT_SCIENTIFIC_NOTATION,group:Q.presetGroup},{format:Z.FORMAT_ROUND,group:Q.presetRoundGroup},{format:Z.FORMAT_ROUND_TWO_DECIMALS,group:Q.presetRoundGroup},{format:Z.FORMAT_ROUND_FOUR_DECIMALS,group:Q.presetRoundGroup}],o=ie.makeOption("Default",null,Q.defaultGroup,ie.isDefaultSelected(r)),a=n.map(c=>ie.makeOption(c.format.label,c.format,c.group,Z.isSameFormat(c.format,r))),s=ie.isCustomSelected(r),l=s?r:Z.makeCustomFormat(),u=ie.makeCustomFormatOption(l,Q.customGroup,Z.DEFAULT_FORMAT_STRING,s,c=>{if(c!=null){var h=Z.makeCustomFormat(c);Z.isValid(e,h)&&i(h)}else i(null)});return[o,...a,u]}}ir(Q,"defaultGroup",10);ir(Q,"presetGroup",20);ir(Q,"presetRoundGroup",30);ir(Q,"customGroup",40);function Nr(t,e,r){return(e=hs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hs(t){var e=vs(t,"string");return typeof e=="symbol"?e:e+""}function vs(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ce{static getOptions(e,r,i){var n=[{format:ge.FORMAT_THOUSANDS,group:ce.presetGroup},{format:ge.FORMAT_MILLIONS,group:ce.presetGroup},{format:ge.FORMAT_SCIENTIFIC_NOTATION,group:ce.presetGroup}],o=ie.makeOption("Default",null,ce.defaultGroup,ie.isDefaultSelected(r)),a=n.map(c=>ie.makeOption(c.format.label,c.format,c.group,ge.isSameFormat(c.format,r))),s=ie.isCustomSelected(r),l=s?r:ge.makeCustomFormat(),u=ie.makeCustomFormatOption(l,ce.customGroup,ge.DEFAULT_FORMAT_STRING,s,c=>{if(c!=null){var h=ge.makeCustomFormat(c);ge.isValid(e,h)&&i(h)}else i(null)});return[o,...a,u]}}Nr(ce,"defaultGroup",10);Nr(ce,"presetGroup",20);Nr(ce,"customGroup",30);function Tt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Pt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Tt(Object(r),!0).forEach(function(i){Y(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function xt(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(u){return void r(u)}s.done?e(l):Promise.resolve(l).then(i,n)}function Dt(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(l){xt(o,i,n,a,s,"next",l)}function s(l){xt(o,i,n,a,s,"throw",l)}a(void 0)})}}function Y(t,e,r){return(e=ms(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ms(t){var e=ps(t,"string");return typeof e=="symbol"?e:e+""}function ps(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Nt=le.module("IrisGridContextMenuHandler"),fs=150,Et="yyyy-MM-dd HH:mm:ss.SSSSSSSSS",ar=1e3;class S extends ue{static getQuickFilterCondition(e,r,i){return e&&i==="&&"?e.and(r):e&&i==="||"?e.or(r):r}static getQuickFilterText(e,r,i){return i&&e!=null?"".concat(e," ").concat(i," ").concat(r):r}static getOperatorAsText(e){return e==="&&"?"And":"Or"}static getRowOptionFormatted(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:30;return"".concat(e,' "').concat(ni.truncate(r,i-e.length-3),'"')}constructor(e,r){super(),Y(this,"irisGrid",void 0),Y(this,"debouncedUpdateCustomFormat",void 0),Y(this,"dh",void 0),this.getNumberValueEqualsFilter=this.getNumberValueEqualsFilter.bind(this),this.getFilterValueForNumberOrChar=this.getFilterValueForNumberOrChar.bind(this),this.debouncedUpdateCustomFormat=jr(e.handleFormatSelection,fs),this.dh=r,this.irisGrid=e}componentWillUnmount(){this.debouncedUpdateCustomFormat.flush()}getHeaderActions(e,r){var{irisGrid:i}=this,{column:n}=r;R(n);var{model:o}=i.props,{columns:a}=o,s=a[e],l=[],{metrics:u,reverse:c,quickFilters:h,advancedFilters:p,searchFilter:v}=i.state,m=i.getTheme();R(u);var{filterIconColor:g,filterBarActiveColor:f,contextMenuSortIconColor:b,contextMenuReverseIconColor:w}=m,y=o.sort,O=$.getSortForColumn(y,s.name),{userColumnWidths:P}=u,D=[...P.values()].some(T=>T===0),E=o.getColumnHeaderParentGroup(e,0)===void 0&&!(ke(o)&&o.hasExpandableRows),I=o.isColumnFrozen(e),j=o.isColumnSortable(e);if(l.push({title:"Hide Column",group:S.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.hideColumnByVisibleIndex(n)}}),l.push({title:I?"Unfreeze Column":"Freeze Column",group:S.GROUP_HIDE_COLUMNS,disabled:!E,action:()=>{I?this.irisGrid.unFreezeColumnByColumnName(s.name):this.irisGrid.freezeColumnByColumnName(s.name)},order:30}),l.push({title:"Show All Columns",group:S.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.showAllColumns()},disabled:!D}),l.push({title:"Resize Column",group:S.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.handleResizeColumn(e)},order:10}),l.push({title:"Resize All Columns",group:S.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.handleResizeAllColumns()},order:20}),l.push({title:"Quick Filters",icon:me,iconColor:f,shortcut:_e.TABLE.TOGGLE_QUICK_FILTER,group:S.GROUP_FILTER,order:10,action:()=>{this.irisGrid.toggleFilterBar(n)}}),l.push({title:"Advanced Filters",icon:p.get(e)?gn:bn,iconColor:g,group:S.GROUP_FILTER,order:20,action:()=>{this.irisGrid.handleAdvancedMenuOpened(n)},disabled:!o.isFilterable(e)}),l.push({title:"Clear Table Filters",group:S.GROUP_FILTER,order:40,shortcut:_e.TABLE.CLEAR_FILTERS,action:()=>{this.irisGrid.clearAllFilters()},disabled:!(h.size>0||p.size>0||v!=null)}),l.push({title:"Sort by",icon:me,iconColor:b,group:S.GROUP_SORT,order:10,actions:this.sortByActions(s,e,O),disabled:!j}),l.push({title:"Add Additional Sort",disabled:O&&y.length===1||c&&y.length===1||O&&c&&y.length===2||y.length===0||!j,group:S.GROUP_SORT,order:20,actions:this.additionalSortActions(s,e)}),l.push({title:"Clear Table Sorting",disabled:y.length===0||c&&y.length===1,group:S.GROUP_SORT,action:()=>{this.irisGrid.sortColumn(n,S.COLUMN_SORT_DIRECTION.none)},order:30}),l.push({title:c?"Clear Reverse Table":"Reverse Table",icon:me,iconColor:w,group:S.GROUP_SORT,order:40,disabled:!o.isReversible,shortcut:_e.TABLE.REVERSE,action:()=>{this.irisGrid.reverse(!c)}}),l.push({title:"Copy Column Name",group:S.GROUP_COPY,shortcutText:Ee.isMacPlatform()?"⌥Click":"Alt+Click",action:()=>{var T;Pi((T=o.textForColumnHeader(e))!==null&&T!==void 0?T:"").catch(x=>Nt.error("Unable to copy header",x))}}),$.isDateType(s.type))l.push({title:"Date/Time Format",group:S.GROUP_FORMAT,actions:this.dateFormatActions(s)});else if($.isNumberType(s.type)){var N;l.push({title:"Number Format",group:S.GROUP_FORMAT,actions:(N=this.numberFormatActions(s))!==null&&N!==void 0?N:void 0})}return l}getCellActions(e,r,i){var{irisGrid:n}=this,{column:o,row:a}=i,{model:s,canCopy:l}=n.props,{columns:u}=s,c=n.getModelRow(a);R(c);var h=s.sourceForCell(e,c),{column:p,row:v}=h,m=s.valueForCell(p,v),{selectedRanges:g}=n.state,f=u[p],b=[],w=n.getTheme(),{filterIconColor:y}=w;if(f==null||a==null)return b;if(ke(s)&&s.isRowExpandable(v)){var O=0,P=s.valueForCell(O,v),D=P==null?"null":s.textForCell(O,v);b.push({title:S.getRowOptionFormatted(s.isRowExpanded(v)?"Collapse":"Expand",D),group:S.GROUP_EXPAND_COLLAPSE,order:10,action:()=>{s.setRowExpanded(v,!s.isRowExpanded(v))}}),s.isExpandAllAvailable===!0&&b.push({title:S.getRowOptionFormatted("Expand All in",D),group:S.GROUP_EXPAND_COLLAPSE,order:20,action:()=>{s.setRowExpanded(v,!0,!0)}})}ke(s)&&s.hasExpandableRows&&s.isExpandAllAvailable===!0&&(b.push({title:"Expand Entire Table",group:S.GROUP_EXPAND_COLLAPSE,order:30,action:()=>{s.expandAll()}}),b.push({title:"Collapse Entire Table",group:S.GROUP_EXPAND_COLLAPSE,order:40,action:()=>{s.collapseAll()}}));var E={title:"Go to",iconColor:y,shortcut:_e.TABLE.GOTO_ROW,group:S.GROUP_GOTO,order:10,action:()=>this.irisGrid.toggleGotoRow("".concat(a+1),"".concat(m),f.name)};if(b.push(E),l&&(b.push({title:"Copy Cell",group:S.GROUP_COPY,shortcutText:Ee.isMacPlatform()?"⌥Click":"Alt+Click",order:10,action:()=>{n.copyCell(o,a)}}),b.push({title:"Copy Cell Unformatted",group:S.GROUP_COPY,order:20,action:()=>{n.copyCell(o,a,!0)}})),gr(s)&&s.isEditable){var I=g.every(T=>s.isEditableRange(T)),j=q.containsCell(g,o,a),N=s.isEditableRange(q.makeCell(o,a));(I||!j)&&N&&b.push({title:"Paste",group:S.GROUP_COPY,order:50,action:function(){var T=Dt(function*(){try{var F=yield Di(),G=F.split(`
11
- `).map(A=>A.split(" "));yield r.pasteValue(G)}catch(A){if(A instanceof Ni)n.handleOpenNoPastePermissionModal("For security reasons your browser does not allow access to your clipboard on click.");else if(A instanceof Ei)n.handleOpenNoPastePermissionModal("Requested clipboard permissions have not been granted, please grant them and try again.");else throw A}});function x(){return T.apply(this,arguments)}return x}()})}return b.push({title:"View Cell Contents",group:S.GROUP_VIEW_CONTENTS,order:10,action:()=>{n.setState({showOverflowModal:!0,overflowText:n.getValueForCell(o,a)})}}),ii(s)&&!s.isPartitionAwareSourceTable&&b.push({title:"View Constituent Table",group:S.GROUP_VIEW_CONTENTS,order:40,action:()=>{n.selectPartitionKeyFromTable(a)}}),b}getCellFilterActions(e,r,i){var n=this;return Dt(function*(){var{dh:o,irisGrid:a}=n,{row:s}=i,{model:l}=a.props,{columns:u}=l,c=a.getModelRow(s),{getSelectedRanges:h}=r;R(c);var p=l.sourceForCell(e,c),{column:v,row:m}=p,g=u[v];if(g==null||s==null)return[];if(!l.isFilterable(v))return[];var{quickFilters:f}=a.state,b=a.getTheme(),{filterIconColor:w}=b,{settings:y}=a.props,O=[...h()];if(O.length===0&&O.push(new q(v,m,v,m)),q.containsCell(O,v,m))for(var P=q.rowCount(O);P>ar;){var D=O.pop();R(D,"Selected ranges should not be empty");var E=q.rowCount([D]);if(yn(E,"Selected ranges should not be unbounded"),P-E<ar){var I;O.push(new q(D.startColumn,D.startRow,D.endColumn,((I=D.endRow)!==null&&I!==void 0?I:0)-(P-ar)));break}P-=E}else O=[new q(v,m,v,m)];Cn(O);for(var j=yield l.snapshot(O),N=new Set,T=0;T<j.length;T+=1)j[T].length===1?j[T][0]!=null&&N.add(j[T][0]):j[T][v]!=null&&N.add(j[T][v]);var x={title:"Filter by Value".concat(N.size>1?"s":""),icon:me,iconColor:w,group:S.GROUP_FILTER,order:10,actions:[]};if(N.size===0)f.get(v)&&x.actions.push({title:"And",actions:n.nullFilterActions(g,f.get(v),"&&"),order:2,group:k.groups.high}),x.actions.push(...n.nullFilterActions(g));else if(N.size===1&&N.has(""))f.get(v)&&x.actions.push({title:"And",actions:n.emptyStringFilterActions(g,f.get(v),"&&"),order:2,group:k.groups.high}),x.actions.push(...n.emptyStringFilterActions(g));else if($.isBooleanType(g.type))f.get(v)&&x.actions.push({title:"Or",actions:n.booleanFilterActions(g,l.textForCell(v,m),f.get(v),"||"),order:2,group:k.groups.high}),x.actions.push(...n.booleanFilterActions(g,l.textForCell(v,m)));else if($.isNumberType(g.type)||$.isCharType(g.type))R(v),f.get(v)&&x.actions.push({title:"And",actions:n.numberFilterActions(g,N,f.get(v),"&&"),order:2,group:k.groups.high}),x.actions.push(...n.numberFilterActions(g,N,f.get(v)));else if($.isDateType(g.type)){var F=new Re(o,{timeZone:y==null?void 0:y.timeZone,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:Et}),G=new Re(o,{timeZone:y==null?void 0:y.timeZone,showTimeZone:y==null?void 0:y.showTimeZone,showTSeparator:y==null?void 0:y.showTSeparator,defaultDateTimeFormatString:Et});f.get(v)&&x.actions.push({title:"And",actions:n.dateFilterActions(g,N,F,G,f.get(v),"&&"),order:2,group:k.groups.high}),x.actions.push(...n.dateFilterActions(g,N,F,G,f.get(v)))}else f.get(v)&&x.actions.push({title:"And",actions:n.stringFilterActions(g,N,f.get(v),"&&"),order:2,group:k.groups.high}),x.actions.push(...n.stringFilterActions(g,N));return[x]})()}getNumberValueEqualsFilter(e,r){var{dh:i}=this,n=e.filter();if(r===Number.POSITIVE_INFINITY)return i.FilterCondition.invoke("isInf",n).and(n.greaterThan(i.FilterValue.ofNumber(0)));if(r===Number.NEGATIVE_INFINITY)return i.FilterCondition.invoke("isInf",n).and(n.lessThan(i.FilterValue.ofNumber(0)));if(Number.isNaN(r))return i.FilterCondition.invoke("isNaN",n);var o=this.getFilterValueForNumberOrChar(e.type,r);return n.eq(o)}getFilterValueForNumberOrChar(e,r){var{dh:i}=this;return $.isCharType(e)?i.FilterValue.ofString(String.fromCharCode(r)):i.FilterValue.ofNumber(r)}onContextMenu(e,r,i){var{irisGrid:n}=this,{y:o,column:a,row:s,columnHeaderDepth:l}=e,u=n.getModelColumn(a),c=n.getModelRow(s),{model:h,canCopy:p}=n.props,{columns:v}=h,{metrics:m,isFilterBarShown:g,quickFilters:f,advancedFilters:b,selectedRanges:w}=n.state,y=Gn.getLatestSelection(w,a,s);R(m);var{columnHeaderHeight:O,gridY:P,columnHeaderMaxDepth:D}=m,E=[];if(u!=null&&c!=null){var I=h.sourceForCell(u,c??0),{column:j,row:N}=I,T=h.valueForCell(j,N),x=h.textForCell(j,N),F=v[j],{onContextMenu:G}=n.props;F!=null&&E.push(...G({model:h,value:T,valueText:x,column:F,rowIndex:s,columnIndex:a,modelRow:c,modelColumn:u}))}if(u!=null){var A=h.getClearFilterRange(u);A!=null&&A.length>0&&E.push({title:A[1]-A[0]>0?"Clear Group Filter":"Clear Column Filter",group:S.GROUP_FILTER,order:30,action:()=>{this.irisGrid.removeColumnFilter(A)},disabled:!Array.from(f.keys()).some(B=>B>=A[0]&&B<=A[1])&&!Array.from(b.keys()).some(B=>B>=A[0]&&B<=A[1])})}return(g?o<=P:o<=O*D&&l===0)?u!=null&&E.push(...this.getHeaderActions(u,e)):(u!=null&&c!=null&&(E.push(...this.getCellActions(u,r,e)),E.push(this.getCellFilterActions(u,r,e))),p&&y.length>0&&(E.push({title:"Copy Selection",shortcut:xi.COPY,group:S.GROUP_COPY,order:30,action:()=>{n.copyRanges(y)}}),E.push({title:"Copy Selection w/ Headers",group:S.GROUP_COPY,order:40,action:()=>{n.copyRanges(y,!0)}})),gr(h)&&h.isEditable&&y.length>0&&Lo(h)&&h.isDeletable&&E.push({title:"Delete Selected Rows",group:S.GROUP_EDIT,disabled:!h.isDeletableRanges(y),order:50,action:()=>{this.irisGrid.deleteRanges(y)}})),E.length===0?!1:(R(n.gridWrapper),k.triggerMenu(n.gridWrapper,i.clientX,i.clientY,E),!0)}dateFormatActions(e){for(var r=this,{model:i}=this.irisGrid.props,{formatter:n}=i,o=n.getColumnFormat(e.type,e.name),a=X.getOptions(n,o),s=[],l=function(){var{description:h,format:p,group:v,isSelected:m,title:g}=a[u];s.push({title:g,description:h,icon:m?fr:void 0,group:v,order:u,action:()=>{var f=i.getColumnIndexByName(e.name);R(f),r.irisGrid.handleFormatSelection(f,p)}})},u=0;u<a.length;u+=1)l();return s}numberFormatActions(e){var r=this,{model:i}=this.irisGrid.props,{formatter:n}=i,{dh:o}=this,a=n.getColumnFormat(e.type,e.name),s,l=i.getColumnIndexByName(e.name);if($.isDecimalType(e.type))s=Q.getOptions(o,a,p=>{R(l),this.debouncedUpdateCustomFormat(l,p)});else if($.isIntegerType(e.type))s=ce.getOptions(o,a,p=>{R(l),this.debouncedUpdateCustomFormat(l,p)});else return Nt.error("Invalid column type in numberFormatActions"),null;for(var u=[],c=function(){var{format:v,isSelected:m}=s[h];u.push(Pt(Pt({},s[h]),{},{icon:m?fr:void 0,order:h,action:()=>{l===void 0&&v&&v.type===Qe.TYPE_CONTEXT_CUSTOM||(R(l),r.irisGrid.handleFormatSelection(l,v))}}))},h=0;h<s.length;h+=1)c();return u}stringFilterActions(e,r,i,n){var{dh:o}=this,a=Array.from(r.keys()),s=a.map(f=>o.FilterValue.ofString(f)),l=s.length===1?s[0]:"the selected values",u=i;u||(u={filter:null,text:null});var{filter:c,text:h}=u,p=[],{model:v}=this.irisGrid.props,m=v.getColumnIndexByName(e.name),g=f=>{var b;return(b=$.escapeQuickTextFilter(f))!==null&&b!==void 0?b:""};return R(m),p.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[n?S.getOperatorAsText(n):""," ",Ke.join(a.slice(0,20).map(f=>'"'.concat(g(f),'"'))),a.length>1&&d.jsxs("div",{className:"iris-grid-filter-menu-subtitle",children:["(",a.length," values selected)"]})]}),order:1,group:k.groups.high}),p.push({title:"text is exactly",description:"Show only rows where ".concat(e.name," is ").concat(l," (case sensitive)"),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,s.map(f=>e.filter().eq(f)).reduce((f,b)=>f.or(b)),n),S.getQuickFilterText(h,a.map(g).join(" || "),n))},order:10,group:k.groups.low}),p.push({title:"text is not exactly",description:"Show only rows where ".concat(e.name," is not ").concat(l," (case sensitive)"),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,s.map(f=>e.filter().notEq(f)).reduce((f,b)=>f.and(b)),n),S.getQuickFilterText(h,a.map(f=>"!=".concat(g(f))).join(" && "),n))},order:20,group:k.groups.low}),p.push({title:"text contains",description:"Show only rows where ".concat(e.name," contains ").concat(l),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,e.filter().isNull().not().and(s.map(f=>e.filter().contains(f)).reduce((f,b)=>f.or(b))),n),S.getQuickFilterText(h,a.map(f=>"~".concat(g(f))).join(" || "),n))},order:30,group:k.groups.low}),p.push({title:"text does not contain",description:"Show only rows where ".concat(e.name," does not contain ").concat(l),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,e.filter().isNull().or(s.map(f=>e.filter().contains(f).not()).reduce((f,b)=>f.and(b))),n),S.getQuickFilterText(h,a.map(f=>"!~".concat(g(f))).join(" && "),n))},order:40,group:k.groups.low}),p.push({title:"text starts with",description:"Show only rows where ".concat(e.name," starts with ").concat(l),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,e.filter().isNull().not().and(s.map(f=>e.filter().invoke("startsWith",f)).reduce((f,b)=>f.or(b))),n),S.getQuickFilterText(h,a.map(f=>"".concat(g(f),"*")).join(" || "),n))},order:50,group:k.groups.low}),p.push({title:"text ends with",description:"Show only rows where ".concat(e.name," ends with ").concat(l),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,e.filter().isNull().not().and(s.map(f=>e.filter().invoke("endsWith",f)).reduce((f,b)=>f.or(b))),n),S.getQuickFilterText(h,a.map(f=>"*".concat(g(f))).join(" || "),n))},order:60,group:k.groups.low}),p}numberFilterActions(e,r,i,n){var o=Array.from(r.keys()),a=o.length===1?"".concat(o):"the selected values",s=y=>$.isCharType(e.type)?String.fromCharCode(y):"".concat(y),l=null,u=null;i&&(l=i.filter,u=i.text);var c=[],{model:h}=this.irisGrid.props,p=h.getColumnIndexByName(e.name);if(R(p),c.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[n?S.getOperatorAsText(n):""," ",Ke.join(o.slice(0,20).map(y=>'"'.concat(s(y),'"'))),o.length>1&&d.jsxs("div",{className:"iris-grid-filter-menu-subtitle",children:["(",o.length," values selected)"]})]}),order:1,group:k.groups.high}),c.push({title:"is equal to",description:"Show only rows where ".concat(e.name," is ").concat(a),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,o.map(y=>this.getNumberValueEqualsFilter(e,y)).reduce((y,O)=>y.or(O)),n),S.getQuickFilterText(u,o.map(y=>"=".concat(s(y))).join(" || "),n))},order:10,group:k.groups.low}),c.push({title:"is not equal to",description:"Show only rows where ".concat(e.name," is not ").concat(a),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,o.map(y=>this.getNumberValueEqualsFilter(e,y).not()).reduce((y,O)=>y.and(O)),n),S.getQuickFilterText(u,o.map(y=>"!=".concat(s(y))).join(" && "),n))},order:20,group:k.groups.low}),!r.has(Number.NaN)&&!r.has(Number.POSITIVE_INFINITY)&&!r.has(Number.NEGATIVE_INFINITY)&&!$.isCharType(e.type)){var v=o.reduce((y,O)=>y>O?y:O),m=o.reduce((y,O)=>y<O?y:O),g=this.getFilterValueForNumberOrChar(e.type,v),f=this.getFilterValueForNumberOrChar(e.type,m),b="".concat(g),w="".concat(f);c.push({title:"greater than",description:"Show only rows where ".concat(e.name," is greater than ").concat(b),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,e.filter().greaterThan(g),n),S.getQuickFilterText(u,">".concat(s(v)),n))},order:30,group:k.groups.low}),c.push({title:"greater than or equal to",description:"Show only rows where ".concat(e.name," is greater than or equal to ").concat(b),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,e.filter().greaterThanOrEqualTo(g),n),S.getQuickFilterText(u,">=".concat(s(v)),n))},order:40,group:k.groups.low}),c.push({title:"less than",description:"Show only rows where ".concat(e.name," is less than ").concat(w),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,e.filter().lessThan(f),n),S.getQuickFilterText(u,"<".concat(s(m)),n))},order:50,group:k.groups.low}),c.push({title:"less than or equal to",description:"Show only rows where ".concat(e.name," is less than or equal to ").concat(w),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,e.filter().lessThanOrEqualTo(f),n),S.getQuickFilterText(u,"<=".concat(s(m)),n))},order:60,group:k.groups.low})}return c}booleanFilterActions(e,r,i,n){var o=[],{model:a}=this.irisGrid.props,{filter:s,text:l}=i||{},u=a.getColumnIndexByName(e.name);return R(u),o.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[n?S.getOperatorAsText(n):""," ",'"',r??"null",'"']}),order:1,group:k.groups.high}),o.push({title:"true",description:"Show only rows where ".concat(e.name," is true"),action:()=>{this.irisGrid.setQuickFilter(u,S.getQuickFilterCondition(s,e.filter().isTrue(),n),S.getQuickFilterText(l,"true",n))},order:10,group:k.groups.low}),o.push({title:"false",description:"Show only rows where ".concat(e.name," is false"),action:()=>{this.irisGrid.setQuickFilter(u,S.getQuickFilterCondition(s,e.filter().isFalse(),n),S.getQuickFilterText(l,"false",n))},order:20,group:k.groups.low}),o.push({title:"is null",description:"Show only rows where ".concat(e.name," is null"),action:()=>{this.irisGrid.setQuickFilter(u,S.getQuickFilterCondition(s,e.filter().isNull(),n),S.getQuickFilterText(l,"null",n))},order:30,group:k.groups.low}),o.push({title:"is not null",description:"Show only rows where ".concat(e.name," is not null"),action:()=>{this.irisGrid.setQuickFilter(u,S.getQuickFilterCondition(s,e.filter().isNull().not(),n),S.getQuickFilterText(l,"!null",n))},order:40,group:k.groups.low}),o}dateFilterActions(e,r,i,n,o,a){var{dh:s}=this,l=Array.from(r.keys()),u=l.map(I=>s.FilterValue.ofNumber(I)),c=u.length===1?n.format(l[0]):"the selected values",h=l.reduce((I,j)=>I>j?I:j),p=l.reduce((I,j)=>I<j?I:j),v=s.FilterValue.ofNumber(h),m=s.FilterValue.ofNumber(p),g=i.format(h),f=i.format(p),b=n.format(h),w=n.format(p),y=null,O=null;o&&(y=o.filter,O=o.text);var{model:P}=this.irisGrid.props,D=P.getColumnIndexByName(e.name);R(D);var E=[];return E.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[a?S.getOperatorAsText(a):""," ",Ke.join(l.slice(0,20).map(I=>'"'.concat(n.format(I),'"'))),l.length>1&&d.jsxs("div",{className:"iris-grid-filter-menu-subtitle",children:["(",l.length," values selected)"]})]}),order:1,group:k.groups.high}),E.push({title:"date is",description:"Show only rows where ".concat(e.name," is ").concat(c),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,u.map(I=>e.filter().eq(I)).reduce((I,j)=>I.or(j)),a),S.getQuickFilterText(O,l.map(I=>"=".concat(i.format(I))).join(" || "),a))},order:10,group:k.groups.low}),E.push({title:"date is not",description:"Show only rows where ".concat(e.name," is not ").concat(c),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,u.map(I=>e.filter().notEq(I)).reduce((I,j)=>I.and(j)),a),S.getQuickFilterText(O,l.map(I=>"!=".concat(i.format(I))).join(" && "),a))},order:20,group:k.groups.low}),E.push({title:"date is before",description:"Show only rows where ".concat(e.name," is before ").concat(w),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,e.filter().lessThan(m),a),S.getQuickFilterText(O,"<".concat(f),a))},order:30,group:k.groups.low}),E.push({title:"date is before or equal",description:"Show only rows where ".concat(e.name," is before or equal to ").concat(w),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,e.filter().lessThanOrEqualTo(m),a),S.getQuickFilterText(O,"<=".concat(f),a))},order:40,group:k.groups.low}),E.push({title:"date is after",description:"Show only rows where ".concat(e.name," is greater than ").concat(b),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,e.filter().greaterThan(v),a),S.getQuickFilterText(O,">".concat(g),a))},order:50,group:k.groups.low}),E.push({title:"date is after or equal",description:"Show only rows where ".concat(e.name," is after or equal to ").concat(b),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,e.filter().greaterThanOrEqualTo(v),a),S.getQuickFilterText(O,">=".concat(g),a))},order:60,group:k.groups.low}),E}emptyStringFilterActions(e,r,i){var{dh:n}=this,o=n.FilterValue.ofString(""),a=r;a||(a={filter:null,text:null});var{filter:s,text:l}=a,u=[],{model:c}=this.irisGrid.props,h=c.getColumnIndexByName(e.name);return R(h),u.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[i?S.getOperatorAsText(i):""," ",d.jsx("i",{className:"text-muted",children:"empty"})]}),order:1,group:k.groups.high}),u.push({title:"is empty string",description:"Show only rows where ".concat(e.name," is empty"),action:()=>{this.irisGrid.setQuickFilter(h,S.getQuickFilterCondition(s,e.filter().eq(o),i),S.getQuickFilterText(l,"=",i))},order:10,group:k.groups.low}),u.push({title:"is not empty string",description:"Show only rows where ".concat(e.name," is not empty"),action:()=>{this.irisGrid.setQuickFilter(h,S.getQuickFilterCondition(s,e.filter().notEq(o),i),S.getQuickFilterText(l,"!=",i))},order:20,group:k.groups.low}),u}nullFilterActions(e,r,i){var n=null,o=null;r&&(n=r.filter,o=r.text);var a=[],{model:s}=this.irisGrid.props,l=s.getColumnIndexByName(e.name);return R(l),a.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[i?S.getOperatorAsText(i):""," ",d.jsx("i",{className:"text-muted",children:"null"})]}),order:1,group:k.groups.high}),a.push({title:"is null",description:"Show only rows where ".concat(e.name," is null"),action:()=>{this.irisGrid.setQuickFilter(l,S.getQuickFilterCondition(n,e.filter().isNull(),i),S.getQuickFilterText(o,"null",i))},order:10,group:k.groups.low}),a.push({title:"is not null",description:"Show only rows where ".concat(e.name," is not null"),action:()=>{this.irisGrid.setQuickFilter(l,S.getQuickFilterCondition(n,e.filter().isNull().not(),i),S.getQuickFilterText(o,"!null",i))},order:20,group:k.groups.low}),a}sortByActions(e,r,i){var n=this.irisGrid.getTheme(),{contextMenuSortIconColor:o}=n,a=[{title:"".concat(e.name," Ascending"),order:10,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.ascending)},icon:this.checkColumnSort(i,S.COLUMN_SORT_DIRECTION.ascending)?me:void 0,iconColor:o},{title:"".concat(e.name," Descending"),order:20,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.descending)},icon:this.checkColumnSort(i,S.COLUMN_SORT_DIRECTION.descending)?me:void 0,iconColor:o},{title:"Remove Sort",order:50,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.none,!1,!0)},disabled:!i}];return $.isNumberType(e.type)&&(a.push({title:"ABS(".concat(e.name,") Ascending"),order:30,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.ascending,!0)},icon:this.checkColumnSort(i,S.COLUMN_SORT_DIRECTION.ascending,!0)?me:void 0,iconColor:o}),a.push({title:"ABS(".concat(e.name,") Descending"),order:40,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.descending,!0)},icon:this.checkColumnSort(i,S.COLUMN_SORT_DIRECTION.descending,!0)?me:void 0,iconColor:o})),a}additionalSortActions(e,r){var i=this.irisGrid.getTheme(),{contextMenuSortIconColor:n}=i,o=[{title:"Add Sort By",menuElement:d.jsxs("div",{className:"btn-context-menu menu-title",children:[d.jsx("span",{className:"icon",children:d.jsx(K,{icon:me,style:{color:n??void 0}})}),d.jsx("span",{className:"title",children:"Add Additional Sort"}),d.jsx("span",{className:"shortcut",children:Ee.isMacPlatform()?"⌘Click":"Ctrl+Click"})]}),order:1},{title:"".concat(e.name," Ascending"),order:10,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.ascending,!1,!0)}},{title:"".concat(e.name," Descending"),order:20,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.descending,!1,!0)}}];return $.isNumberType(e.type)&&(o.push({title:"ABS(".concat(e.name,") Ascending"),order:30,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.ascending,!0,!0)}}),o.push({title:"ABS(".concat(e.name,") Descending"),order:40,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.descending,!0,!0)}})),o}checkColumnSort(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return e?e.direction===r&&e.isAbs===i:!1}}Y(S,"GROUP_EDIT",k.groups.high+10);Y(S,"GROUP_HIDE_COLUMNS",k.groups.high+25);Y(S,"GROUP_FILTER",k.groups.high+50);Y(S,"GROUP_EXPAND_COLLAPSE",k.groups.high+55);Y(S,"GROUP_GOTO",k.groups.high+60);Y(S,"GROUP_SORT",k.groups.high+75);Y(S,"GROUP_COPY",k.groups.high+100);Y(S,"GROUP_FORMAT",k.groups.high+150);Y(S,"GROUP_VIEW_CONTENTS",k.groups.high+175);Y(S,"COLUMN_SORT_DIRECTION",{ascending:"ASC",descending:"DESC",none:null});function gs(t,e,r){return(e=bs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bs(t){var e=ys(t,"string");return typeof e=="symbol"?e:e+""}function ys(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Zl extends ue{constructor(e){super(250),gs(this,"irisGrid",void 0),this.irisGrid=e,this.cursor=null}onClick(e,r,i){return i.altKey&&!Ee.isModifierKeyDown(i)&&!i.shiftKey?(this.cursor=null,e.columnHeaderDepth!==void 0?this.irisGrid.copyColumnHeader(e.column,e.columnHeaderDepth):this.irisGrid.copyRanges([q.makeCell(e.column,e.row)]),!0):!1}onMove(e,r,i){return i.altKey&&!Ee.isModifierKeyDown(i)&&!i.shiftKey&&e.column!=null&&(e.row!=null||e.columnHeaderDepth!=null)?(this.cursor=this.irisGrid.props.copyCursor,!0):!1}}function Cs(t,e,r){return(e=Ss(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ss(t){var e=ws(t,"string");return typeof e=="symbol"?e:e+""}function ws(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Jl extends ue{constructor(e){super(880),Cs(this,"irisGrid",void 0),this.irisGrid=e}onDoubleClick(e,r){var{column:i,row:n}=e;return n==null||i==null||this.irisGrid.selectData(i,n),!1}}function Os(t,e,r){return(e=js(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function js(t){var e=Ts(t,"string");return typeof e=="symbol"?e:e+""}function Ts(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class eu extends ue{constructor(e){super(),Os(this,"irisGrid",void 0),this.irisGrid=e}onDown(e){var{y:r,column:i,row:n}=e;if(i!==null&&n===null){var{isFilterBarShown:o,metrics:a}=this.irisGrid.state;if(!a)throw new Error("Metrics not set");var{columnHeaderMaxDepth:s}=a,l=this.irisGrid.getTheme();if(o&&l.columnHeaderHeight!=null&&l.filterBarHeight!=null&&r>l.columnHeaderHeight*s&&r<=l.columnHeaderHeight*s+l.filterBarHeight)return this.irisGrid.focusFilterBar(i),!0}return!1}onMove(e){var{y:r,column:i}=e,{isFilterBarShown:n,hoverAdvancedFilter:o,metrics:a}=this.irisGrid.state;if(!a)throw new Error("Metrics not set");var{columnHeaderMaxDepth:s}=a,l=this.irisGrid.getTheme(),u=null;return n&&l.columnHeaderHeight!=null&&l.filterBarHeight!=null&&i!==null&&r>=l.columnHeaderHeight*s&&r<=l.columnHeaderHeight*s+l.filterBarHeight&&(u=i),u!==o&&this.irisGrid.setState({hoverAdvancedFilter:u}),!1}onLeave(e){var{column:r}=e,{hoverAdvancedFilter:i}=this.irisGrid.state;return i!==null&&r!==i&&this.irisGrid.setState({hoverAdvancedFilter:null}),!1}}function Ps(t,e,r){return(e=xs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xs(t){var e=Ds(t,"string");return typeof e=="symbol"?e:e+""}function Ds(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ru extends ue{constructor(e){super(750),Ps(this,"irisGrid",void 0),this.irisGrid=e}destroyTooltip(){this.irisGrid.setState({expandCellTooltipProps:null})}setCursor(e,r){return Lr.isInTreeBox(e,r)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition(e){var{x:r,y:i,column:n,row:o}=e;if(n==null||o==null)return null;var{renderer:a,grid:s,state:l,props:u}=this.irisGrid;if(!s)return null;var{metrics:c}=l,{model:h}=u,{canvasContext:p}=s,v=s.getTheme(),m={context:p,mouseX:r,mouseY:i,metrics:c,model:h,theme:v},g=ke(h)?h.depthForRow(o):null,{left:f,top:b,width:w,height:y}=a.getExpandButtonPosition(m,g);return f==null||w==null||b==null||y==null?null:{left:f,top:b,width:w,height:y}}onMove(e,r){if(Lr.isInTreeBox(e,r)){var{expandCellTooltipProps:i}=this.irisGrid.state,{model:n}=this.irisGrid.props,o=this.getButtonPosition(e),{row:a}=e;R(a);var s=ke(n)&&n.isRowExpanded(a);Ye(i,o)||this.irisGrid.setState({expandCellTooltipProps:o,expandTooltipDisplayValue:s?"collapse":"expand"})}else this.destroyTooltip();return this.setCursor(e,r)}onDown(){return this.destroyTooltip(),!1}onContextMenu(){return this.destroyTooltip(),!1}onWheel(){return this.destroyTooltip(),!1}onLeave(){return this.destroyTooltip(),!1}}function It(t,e,r){return(e=Ns(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ns(t){var e=Es(t,"string");return typeof e=="symbol"?e:e+""}function Es(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class tu extends ue{constructor(e){super(),It(this,"irisGrid",void 0),It(this,"column",void 0),this.column=null,this.irisGrid=e}getColumnFromGridPoint(e){var{column:r,row:i,columnHeaderDepth:n}=e;return r!==null&&i===null&&n===0?r:null}onDown(e){return this.column=this.getColumnFromGridPoint(e),!1}onClick(e,r,i){var n=this.getColumnFromGridPoint(e);if(n!=null&&n===this.column){var o=Ee.isModifierKeyDown(i);return this.irisGrid.toggleSort(n,o),!0}return!1}}class iu extends ue{constructor(e){super(),this.irisGrid=e}onWheel(e,r,i){var{irisGrid:n}=this,{model:o}=n.props,{metrics:a,pendingRowCount:s}=n.state;R(a);var{bottom:l,rowCount:u,rowHeight:c}=a,{deltaY:h}=U.getScrollDelta(i);return gr(o)&&o.isEditable&&l>=u-1&&h>0&&n.setState({pendingRowCount:s+Math.ceil(h/c)}),!1}}function sr(t,e,r){return(e=Is(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Is(t){var e=Rs(t,"string");return typeof e=="symbol"?e:e+""}function Rs(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class nu extends Mn{constructor(e){super(),sr(this,"irisGrid",void 0),sr(this,"lastColumn",void 0),sr(this,"lastRow",void 0),this.irisGrid=e,this.lastColumn=null,this.lastRow=null}destroyTooltip(){this.irisGrid.setState({hoverTooltipProps:null})}setCursor(e,r){return this.isHoveringLink(e,r)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}onMove(e,r){var{model:i}=this.irisGrid.props,n=this.isHoveringLink(e,r),o=i.tooltipForCell(e.column,e.row);if(n&&this.currentLinkBox!=null&&Wn(this.currentLinkBox.token)){var{hoverTooltipProps:a}=this.irisGrid.state,{x1:s,y1:l,x2:u,y2:c}=this.currentLinkBox,{href:h}=this.currentLinkBox.token,p=u-s,v=c-l,m={left:s,top:l+1,width:p,height:v};Ye(a,m)||this.irisGrid.setState({hoverTooltipProps:m,hoverDisplayValue:d.jsxs(d.Fragment,{children:[h," - Click once to follow.",d.jsx("br",{}),"Click and hold to select this cell."]})})}else if(o!==null){var{hoverTooltipProps:g}=this.irisGrid.state,f={left:e.x,top:e.y+1,width:1,height:1};Ye(g,f)||(g==null?this.irisGrid.setState({hoverTooltipProps:f,hoverDisplayValue:o}):(this.lastColumn!==e.column||this.lastRow!==e.row)&&this.irisGrid.setState({hoverTooltipProps:null},()=>this.irisGrid.setState({hoverTooltipProps:f,hoverDisplayValue:o})))}else this.destroyTooltip();return this.lastColumn=e.column,this.lastRow=e.row,this.setCursor(e,r)}onDown(){return this.destroyTooltip(),!1}onContextMenu(){return this.destroyTooltip(),!1}onWheel(){return this.destroyTooltip(),!1}onLeave(){return this.destroyTooltip(),!1}}function ks(t,e,r){return(e=As(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function As(t){var e=Fs(t,"string");return typeof e=="symbol"?e:e+""}function Fs(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ou extends ue{constructor(e){super(878),ks(this,"irisGrid",void 0),this.irisGrid=e}onDoubleClick(e,r){var{column:i,row:n}=e,{irisGrid:o}=this,{model:a}=o.props,{partitionConfig:s}=o.state;return n==null||i==null||!ii(a)||s==null||s.mode!=="keys"?!1:(this.irisGrid.selectPartitionKeyFromTable(n),!0)}}class au extends Ln{getGridY(e){var r=super.getGridY(e),{isFilterBarShown:i,theme:n,advancedFilters:o,quickFilters:a,sorts:s,reverse:l}=e;return i?r+=n.filterBarHeight:(a!=null&&a.size>0||o!=null&&o.size>0)&&(r+=n.filterBarCollapsedHeight),l&&s!=null&&s.length>0&&(r+=n.reverseHeaderBarHeight),r}getUserColumnWidths(){return this.userColumnWidths}getCalculatedColumnWidths(){return this.calculatedColumnWidths}}var Gs=new Map([["sortUp",Sn],["sortDown",Mr],["caretDown",Mr],["caretRight",wn],["cellOverflow",On]]),Ms=oi((t,e)=>{var r=Gs.get(t);if(r===void 0)throw new Error("Icon is undefined");var i=Array.isArray(r.icon[4])?r.icon[4][0]:r.icon[4],n=new Path2D(i),o=new Path2D,a={a:e/r.icon[0],d:e/r.icon[1]};return o.addPath(n,a),o},{max:1e3});function Ae(t,e){return Ms(t,e)}class mi{static drawTreeMarker(e,r,i,n,o,a,s){e.save();var{theme:l}=r,{iconSize:u}=l,{x1:c,x2:h,y1:p,y2:v}=o,m=Ae(s?"caretDown":"caretRight",u),g=i+(c+h)/2-u/2,f=n+(v-p-u)/2;e.fillStyle=a,e.textAlign="center",e.translate(g,f),e.fill(m),e.restore()}}class Ls extends _n{drawCellContent(e,r,i,n){var o,{metrics:a,model:s}=r,{modelColumns:l,modelRows:u}=a,c=oe(u,n),h=l.get(i);if(h!==void 0){var p=s.valueForCell(h,c);if($.isTextType((o=s.columns[h])===null||o===void 0?void 0:o.type)&&(p===null||p==="")){var v=e.font;e.font="italic ".concat(v),super.drawCellContent(e,r,i,n),e.font=v;return}super.drawCellContent(e,r,i,n)}}getTextRenderMetrics(e,r,i){var n=U.getTextRenderMetrics(e,r,i),{mouseX:o,mouseY:a,metrics:s,theme:l}=e;if(o==null||a==null)return n;var{column:u,row:c}=U.getGridPointFromXY(o,a,s);if(r===u&&i===c){var{left:h}=this.getCellOverflowButtonPosition(o,a,s,l);this.shouldRenderOverflowButton(e)&&h!=null&&(n.width=h-s.gridX-n.x)}return n}getCellOverflowButtonPosition(e,r,i,n){var o={left:null,top:null,width:null,height:null};if(e==null||r==null||i==null)return o;var{rowHeight:a,columnWidth:s,left:l,top:u}=U.getCellInfoFromXY(e,r,i);if(l==null||s==null||u==null)return o;var{width:c,verticalBarWidth:h}=i,{cellHorizontalPadding:p,iconSize:v}=n,m=v+2*p,g=a,f=Math.min(i.gridX+l+s,c-h),b=f-m,w=i.gridY+u;return{left:b,top:w,width:m,height:g}}shouldRenderOverflowButton(e){var r,{context:i,mouseX:n,mouseY:o,metrics:a,model:s,theme:l}=e;if(n==null||o==null)return!1;var{row:u,column:c,modelRow:h,modelColumn:p}=U.getCellInfoFromXY(n,o,a);if(u==null||c==null||h==null||p==null||!$.isStringType(s.columns[p].type))return!1;var v=(r=s.textForCell(p,h))!==null&&r!==void 0?r:"",{width:m}=U.getTextRenderMetrics(e,c,u),g=a.fontWidthsLower.get(l.font),f=a.fontWidthsUpper.get(l.font);i.save(),i.font=l.font;var b=this.getCachedTruncatedString(i,v,m,g,f,s.truncationCharForCell(p,h));return i.restore(),v!==""&&b!==v}drawTreeMarker(e,r,i,n,o,a,s){mi.drawTreeMarker(e,r,i,n,o,a,s)}}class _s extends Un{drawTreeMarker(e,r,i,n,o,a,s){mi.drawTreeMarker(e,r,i,n,o,a,s)}}function Rt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function kt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Rt(Object(r),!0).forEach(function(i){yr(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Rt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function yr(t,e,r){return(e=Us(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Us(t){var e=$s(t,"string");return typeof e=="symbol"?e:e+""}function $s(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var lr=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),At=10;class Cr extends ni{constructor(){super(...arguments),yr(this,"textCellRenderer",new Ls),yr(this,"dataBarCellRenderer",new _s)}static isFilterValid(e,r){var i=e==null||e.filter!=null,n=r==null||r.filter!=null;return i&&n}getSortIcon(e,r){return e?e.direction===$.sortDirection.ascending?Ae(lr.SORT_UP,r):e.direction===$.sortDirection.descending?Ae(lr.SORT_DOWN,r):null:null}drawCanvas(e){super.drawCanvas(e),this.drawScrim(e)}drawGrid(e,r){super.drawGrid(e,r),this.drawCellOverflowButton(r)}drawGridLines(e,r){super.drawGridLines(e,r),this.drawGroupedColumnLine(e,r),this.drawPendingRowLine(e,r)}drawCellContent(e,r,i,n){var{metrics:o,model:a}=r,{modelColumns:s,modelRows:l}=o,u=s.get(i),c=oe(l,n);if(u!==void 0){var h=a.renderTypeForCell(u,c),p=this.getCellRenderer(h);p.drawCellContent(e,r,i,n)}}getCellOverflowButtonPosition(e){var{mouseX:r,mouseY:i,metrics:n,theme:o}=e;return this.textCellRenderer.getCellOverflowButtonPosition(r,i,n,o)}shouldRenderOverflowButton(e){return this.textCellRenderer.shouldRenderOverflowButton(e)}drawCellOverflowButton(e){var{context:r,mouseX:i,mouseY:n,theme:o}=e;if(!(i==null||n==null)&&this.shouldRenderOverflowButton(e)){var{left:a,top:s,width:l,height:u}=this.getCellOverflowButtonPosition(e),{cellHorizontalPadding:c,overflowButtonColor:h,overflowButtonHoverColor:p,iconSize:v}=o;r.save(),p!=null&&a!=null&&l!=null&&s!=null&&u!=null&&i>=a&&i<=a+l&&n>=s&&n<=s+u?r.fillStyle=p:h!=null&&(r.fillStyle=h);var m=Ae(lr.CELL_OVERFLOW,v);a!=null&&s!=null&&u!=null&&r.translate(a+c,s+(u-v)/2),r.fill(m),r.restore()}}drawGroupedColumnLine(e,r){var{metrics:i,model:n,theme:o}=r,{groupedColumns:a}=n,{maxY:s,allColumnWidths:l,allColumnXs:u}=i;if(!(a.length===0||o.groupedColumnDividerColor==null)){var c=a.length-1,h=u.get(c),p=l.get(c);if(!(h==null||p==null)){var v=h+p+.5;e.strokeStyle=o.groupedColumnDividerColor,e.lineWidth=1,e.beginPath(),e.moveTo(v,0),e.lineTo(v,s),e.stroke()}}}drawPendingRowLine(e,r){var{metrics:i,model:n,theme:o}=r,{allRowYs:a,maxX:s}=i,{pendingRowCount:l}=n;if(!(l<=0)){var u=n.rowCount-n.pendingRowCount-n.floatingBottomRowCount,c=a.get(u);c!=null&&(c-=.5,e.save(),e.setLineDash([4,2]),e.strokeStyle=o.pendingTextColor,e.lineWidth=1,e.beginPath(),e.moveTo(0,c),e.lineTo(s,c),e.stroke(),e.restore())}}drawMouseColumnHover(e,r){var{theme:i,metrics:n,hoverSelectColumn:o}=r;if(!(o==null||i.linkerColumnHoverBackgroundColor==null)){var{allColumnWidths:a,allColumnXs:s,maxY:l}=n,u=oe(s,o),c=oe(a,o);e.fillStyle=i.linkerColumnHoverBackgroundColor,e.fillRect(u,0,c,l)}}drawMouseRowHover(e,r){var{isSelectingColumn:i}=r;i||super.drawMouseRowHover(e,r)}drawScrim(e){var{context:r,loadingScrimProgress:i,metrics:n,theme:o}=e;if(i!=null){var{width:a,height:s,gridY:l}=n,{scrimBlurSize:u,scrimColor:c}=o;r.save(),r.globalCompositeOperation="color",r.filter="blur(".concat(u,"px)"),c!=null&&(r.fillStyle=c),r.beginPath(),r.rect(0,l,a,s-l),r.clip(),r.fillRect(-u,-u+l,u*2+a,(u*2+(s-l))*i),r.globalCompositeOperation="source-over",r.filter="blur(".concat(u,"px) opacity(15%)"),r.fillRect(-u,-u+l,u*2+a,(u*2+(s-l))*i),r.restore()}}drawColumnHeaders(e,r){super.drawColumnHeaders(e,r);var{theme:i,metrics:n,model:o,reverse:a}=r,{columnHeaderHeight:s}=n;if(this.drawFilterHeaders(e,r),!(s<=0)){var{sort:l}=o;if(l.length===1){var u;a?u=i.headerReverseBarColor:u=i.headerSortBarColor,this.drawHeaderBar(e,r,u,a?i.reverseHeaderBarHeight:i.sortHeaderBarHeight)}else l.length>1&&(a&&this.drawHeaderBar(e,r,i.headerReverseBarColor,i.reverseHeaderBarHeight,!1),this.drawHeaderBar(e,r,i.headerSortBarColor,i.sortHeaderBarHeight))}}drawHeaderBar(e,r,i,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,{theme:a,metrics:s,model:l}=r,{columnHeaderHeight:u,width:c}=s,h=0;o||(h=n),e.fillStyle=a.headerBarCasingColor,e.fillRect(0,l.columnHeaderMaxDepth*u-n-2+h,c,n+2),e.fillStyle=i,e.fillRect(0,l.columnHeaderMaxDepth*u-n-1+h,c,n)}drawColumnHeadersAtDepth(e,r,i,n,o){var{metrics:a,model:s,isMenuShown:l,theme:u}=r,{columnHeaderMaxDepth:c}=s,{width:h}=a,{columnHeaderHeight:p}=u,v=kt(kt({},n),{},{maxX:o===c-1&&n.maxX===h?h-(l?0:p):n.maxX});super.drawColumnHeadersAtDepth(e,r,i,v,o)}drawColumnHeaderAtIndex(e,r,i,n){var o;super.drawColumnHeaderAtIndex(e,r,i,n);var{metrics:a,model:s,theme:l}=r,{modelColumns:u,allColumnWidths:c,allColumnXs:h,gridX:p,columnHeaderHeight:v}=a,{headerHorizontalPadding:m,iconSize:g}=l,f=Math.round(g*.75),b=oe(c,i,0),w=oe(h,i)+p,y=u.get(i);if(y!=null){var O=(o=s.columns[y])===null||o===void 0?void 0:o.name;if(O!=null){var P=$.getSortForColumn(s.sort,O);if(P){var D=this.getSortIcon(P,f);if(D){var E=s.textForColumnHeader(y);if(E!==void 0){var I=this.getCachedHeaderWidth(e,E),j=p+w+I+m,{maxX:N}=n;N-=m;var T=p+w+b-f,x=j>N?j+1:Math.min(N,T),F=(v-f)*.5;e.save(),e.beginPath(),e.rect(w,0,b,v),e.clip(),e.fillStyle=l.headerSortBarColor,e.translate(x,F),e.fill(D),e.restore()}}}}}}drawFilterHeaders(e,r){var{isFilterBarShown:i,quickFilters:n,advancedFilters:o}=r;i?this.drawExpandedFilterHeaders(e,r):(n!=null&&n.size>0||o!=null&&o.size>0)&&this.drawCollapsedFilterHeaders(e,r)}drawExpandedFilterHeaders(e,r){var{metrics:i,model:n,theme:o,quickFilters:a,advancedFilters:s}=r,{filterBarHeight:l}=o;if(!(l<=0)){var{gridX:u,gridY:c,maxX:h,modelColumns:p,visibleColumns:v,allColumnWidths:m,allColumnXs:g}=i,f=c-l;e.save(),e.font=o.filterBarFont,e.textAlign="left",a!=null&&a.size>0||s!=null&&s.size>0?e.fillStyle=o.filterBarExpandedActiveBackgroundColor:e.fillStyle=o.filterBarExpandedBackgroundColor,e.fillRect(u,f,h,l-1),e.fillStyle=o.headerBarCasingColor,e.fillRect(u,f+l-1,h,1);var b=f;e.strokeStyle=o.filterBarSeparatorColor,e.beginPath();for(var w=0;w<v.length;w+=1){var y=v[w],O=oe(p,y),P=oe(g,y),D=oe(m,y);if(n.isFilterable(O)&&D>0){var E=u+(P??0);e.rect(E+.5,b+.5,D,l-2)}}e.stroke();for(var I=0;I<v.length;I+=1){var j=v[I],N=oe(m,j),T=oe(g,j),x=T+u;this.drawExpandedFilterHeader(e,r,j,x,N)}e.restore()}}drawExpandedFilterHeader(e,r,i,n,o){if(!(o<=0)){var{metrics:a,theme:s,quickFilters:l,advancedFilters:u}=r,{modelColumns:c,gridY:h}=a,{filterBarHeight:p,filterBarExpandedActiveCellBackgroundColor:v,filterBarErrorColor:m,filterBarHorizontalPadding:g,headerColor:f}=s,b=h-p,w=c.get(i);if(w!==void 0){var y=l.get(w),O=u.get(w);if(!(y==null&&O==null)){var P=null;if(y!=null){var{text:D}=y;if(P=D,P||(P=$.getFilterText(y.filter)),P!=null){var{fontWidthsLower:E,fontWidthsUpper:I}=a,j=E.get(e.font),N=I.get(e.font),T=o-g*2;P=this.textCellRenderer.getCachedTruncatedString(e,P,T,j,N)}}e.save();var x=Cr.isFilterValid(O,y);if(x&&v!=null)e.fillStyle=v,e.fillRect(n+1,b+1,o-1,p-3);else if(m!=null){e.fillStyle=m,e.lineWidth=2,e.strokeStyle=m;var F=n+2,G=b+2,A=o-3,B=p-5;e.strokeRect(F,G,A,B)}if(P!=null&&P!==""){var H=n+g,W=b+p*.5+1;e.fillStyle=f,e.fillText(P,H,W)}e.restore()}}}}drawCollapsedFilterHeaders(e,r){var{metrics:i,theme:n}=r,{headerSeparatorColor:o,filterBarCollapsedHeight:a}=n;if(!(a<=0)){var{gridX:s,gridY:l,maxX:u,visibleColumns:c,allColumnWidths:h,allColumnXs:p}=i,v=l-a;e.save(),e.fillStyle=o,e.fillRect(s,v,u,a);for(var m=0;m<c.length;m+=1){var g=c[m],f=h.get(g),b=p.get(g);if(b!=null&&f!=null){var w=b+s;this.drawCollapsedFilterHeader(e,r,g,w,f)}}e.restore()}}drawCollapsedFilterHeader(e,r,i,n,o){if(!(o<=0)){var{metrics:a,theme:s,quickFilters:l,advancedFilters:u}=r,{modelColumns:c,gridY:h}=a,p=c.get(i);if(p!==void 0){var v=l.get(p),m=u.get(p),{filterBarCollapsedHeight:g,filterBarActiveColor:f,filterBarActiveBackgroundColor:b,filterBarErrorColor:w}=s;e.save();var y=Cr.isFilterValid(m,v);b!=null&&v==null&&m==null?e.fillStyle=b:f!=null&&y?e.fillStyle=f:w!=null&&(e.fillStyle=w);var O=n+1,P=h-g,D=o-1,E=g-1;e.fillRect(O,P,D,E),e.restore()}}}drawRowFooters(e,r){var{metrics:i,model:n,mouseX:o,mouseY:a,theme:s}=r,{gridY:l,gridX:u,maxX:c,modelRows:h,floatingTopHeight:p,floatingBottomHeight:v,floatingRows:m,rowFooterWidth:g,height:f,horizontalBarHeight:b,verticalBarWidth:w,allRowHeights:y,allRowYs:O,width:P}=i;if(!(g<=0||m.length===0)){var{cellHorizontalPadding:D,floatingGridRowColor:E,floatingRowBackgroundColors:I,headerColor:j,rowHoverBackgroundColor:N}=s;e.translate(u,l),e.beginPath();var T=Math.min(c,P-g-w-u);e.fillStyle=I,p>0&&e.rect(T,0,g,p),v>0&&e.rect(T,f-l-b-v,g,v),e.fill();var x=o!=null&&a!=null&&o>=u&&o<=c+g?U.getRowAtY(a,i):null;if(N!=null&&x!==null&&m.includes(x)){e.fillStyle=N;var F=O.get(x),G=y.get(x);R(F),R(G),e.fillRect(T,F,g,G)}if(e.beginPath(),E!=null&&(e.strokeStyle=E),p>0&&(e.moveTo(T+.5,.5),e.lineTo(T+.5,p-.5)),v>0){var A=f-l-b-v;e.moveTo(T-.5,A+.5),e.lineTo(T-.5,A+v-.5)}e.stroke(),e.fillStyle=j,e.textAlign="left";for(var B=T+D,H=0;H<m.length;H+=1){var W=m[H],ve=y.get(W),Me=O.get(W),Le=h.get(W);if(Me!=null&&ve!=null&&Le!=null){var Ci=Me+ve*.5;e.fillText(n.textForRowFooter(Le),B,Ci)}}e.translate(-u,-l)}}getExpandButtonPosition(e,r){var{mouseX:i,mouseY:n,metrics:o,theme:a}=e,s={left:null,top:null,width:null,height:null};if(i==null||n==null||r==null||!o)return s;var{rowHeight:l,left:u,top:c}=U.getCellInfoFromXY(i,n,o);R(u),R(l),R(c);var{cellHorizontalPadding:h}=a,p=At+2*h,v=Math.max(u+At*r,o.gridX),m=o.gridY+c;return{left:v,top:m,width:p,height:l}}}const Bs="12px Fira Sans, sans-serif",Hs="var(--dh-color-white)",Ws="var(--dh-color-black)",Ft={"grid-bg":"var(--dh-color-grid-bg)",font:Bs,white:Hs,black:Ws,"header-bg":"var(--dh-color-grid-header-bg)","header-color":"var(--dh-color-grid-header-text)","header-height":"30px","header-separator-color":"var(--dh-color-grid-header-separator)","header-separator-hover-color":"var(--dh-color-grid-header-separator-hover)","header-hidden-separator-hover-color":"var(--dh-color-grid-header-separator-hidden-hover)","header-sort-bar-color":"var(--dh-color-grid-header-sort-bar)","header-reverse-bar-color":"var(--dh-color-grid-header-reverse-bar)","header-bar-casing-color":"var(--dh-color-grid-header-bar-casing)","header-font":"600 12px Fira Sans, sans-serif","row-height":"19px","row-background-colors":"var(--dh-color-grid-row-0-bg) var(--dh-color-grid-row-1-bg)","active-cell-selection-border-width":"2px","selection-color":"var(--dh-color-grid-selection)","selection-outline-color":"var(--dh-color-grid-selection-outline)","selection-outline-casing-color":"var(--dh-color-grid-selection-outline-casing)","row-hover-bg":"var(--dh-color-grid-row-hover-bg)","row-shadow-alpha":"var(--dh-color-grid-row-shadow-alpha)","selected-row-hover-bg":"var(--dh-color-grid-row-hover-bg-selected)","scroll-bar-active-selection-tick-color":"var(--dh-color-grid-scroll-bar-active-selection-tick)","scroll-bar-bg":"var(--dh-color-grid-scroll-bar-bg)","scroll-bar-hover-bg":"var(--dh-color-grid-scroll-bar-hover-bg)","scroll-bar-casing-color":"var(--dh-color-grid-scroll-bar-casing)","scroll-bar-corner-color":"var(--dh-color-grid-scroll-bar-corner)","scroll-bar-color":"var(--dh-color-grid-scroll-bar)","scroll-bar-hover-color":"var(--dh-color-grid-scroll-bar-hover)","scroll-bar-active-color":"var(--dh-color-grid-scroll-bar-active)","text-color":"var(--dh-color-grid-text)","hyperlink-color":"var(--dh-color-grid-text-hyperlink)","positive-number-color":"var(--dh-color-grid-number-positive)","negative-number-color":"var(--dh-color-grid-number-negative)","zero-number-color":"var(--dh-color-grid-number-zero)","date-color":"var(--dh-color-grid-date)","pending-text-color":"var(--dh-color-grid-text-pending)","error-text-color":"var(--dh-color-grid-text-error)","null-string-color":"var(--dh-color-grid-string-null)","filter-bar-active-bg":"var(--dh-color-grid-filter-bar-active-bg)","filter-bar-active-color":"var(--dh-color-grid-filter-bar-active)","filter-bar-expanded-bg":"var(--dh-color-grid-filter-bar-expanded-bg)","filter-bar-expanded-active-bg":"var(--dh-color-grid-filter-bar-expanded-active-bg)","filter-bar-expanded-active-cell-bg":"var(--dh-color-grid-filter-bar-expanded-active-cell-bg)","filter-bar-separator-color":"var(--dh-color-grid-filter-bar-separator)","filter-bar-error-color":"var(--dh-color-grid-filter-bar-error)","filter-icon-color":"var(--dh-color-grid-filter-icon)","scrim-color":"var(--dh-color-grid-scrim)","context-menu-sort-icon-color":"var(--dh-color-grid-context-menu-sort-icon)","context-menu-reverse-icon-color":"var(--dh-color-grid-context-menu-reverse-icon)","linker-column-hover-bg":"var(--dh-color-grid-column-linker-hover-bg)","tree-line-color":"var(--dh-color-grid-tree-line)","tree-marker-color":"var(--dh-color-grid-tree-marker)","tree-marker-hover-color":"var(--dh-color-grid-tree-marker-hover)","grouped-column-divider-color":"var(--dh-color-grid-column-grouped-divider)","floating-grid-row-color":"var(--dh-color-grid-floating-row)","floating-row-background-colors":"var(--dh-color-grid-floating-row-bg)","floating-divider-inner-color":"var(--dh-color-grid-floating-divider-inner)","floating-divider-outer-color":"var(--dh-color-grid-floating-divider-outer)","overflow-button-color":"var(--dh-color-grid-overflow-button)","overflow-button-hover-color":"var(--dh-color-grid-overflow-button-hover)","zero-line-color":"var(--dh-color-grid-data-bar-zero-line)","positive-bar-color":"var(--dh-color-grid-data-bar-positive)","negative-bar-color":"var(--dh-color-grid-data-bar-negative)","marker-bar-color":"var(--dh-color-grid-data-bar-marker)"};function Gt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Mt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Gt(Object(r),!0).forEach(function(i){zs(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Gt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function zs(t,e,r){return(e=Vs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Vs(t){var e=Ks(t,"string");return typeof e=="symbol"?e:e+""}function Ks(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Lt=le.module("IrisGridTheme");function Qs(){var t,e=jn(Ft);return e["row-background-colors"]=Tn((t=e["row-background-colors"])!==null&&t!==void 0?t:"").map(r=>{var[i,n]=r;return Pn.normalizeCssColor(e["row-background-colors"].substring(i,n+1))}).join(" "),Lt.debug2("Iris grid theme:",Ft),Lt.debug2("Iris grid theme derived:",e),Object.freeze(Mt(Mt({},$n),{},{backgroundColor:e["grid-bg"],white:e.white,black:e.black,font:e.font,filterBarFont:e.font,headerBackgroundColor:e["header-bg"],headerColor:e["header-color"],headerSeparatorColor:e["header-separator-color"],headerSeparatorHoverColor:e["header-separator-hover-color"],headerHiddenSeparatorHoverColor:e["header-hidden-separator-hover-color"],headerSortBarColor:e["header-sort-bar-color"],headerReverseBarColor:e["header-reverse-bar-color"],headerBarCasingColor:e["header-bar-casing-color"],headerFont:e["header-font"],rowBackgroundColors:e["row-background-colors"],rowHoverBackgroundColor:e["row-hover-bg"],selectionColor:e["selection-color"],selectionOutlineColor:e["selection-outline-color"],selectionOutlineCasingColor:e["selection-outline-casing-color"],selectedRowHoverBackgroundColor:e["selected-row-hover-bg"],scrollBarBackgroundColor:e["scroll-bar-bg"],scrollBarHoverBackgroundColor:e["scroll-bar-hover-bg"],scrollBarCasingColor:e["scroll-bar-casing-color"],scrollBarCornerColor:e["scroll-bar-corner-color"],scrollBarColor:e["scroll-bar-color"],scrollBarHoverColor:e["scroll-bar-hover-color"],scrollBarActiveColor:e["scroll-bar-active-color"],scrollBarSelectionTickColor:e["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:e["scroll-bar-active-selection-tick-color"],textColor:e["text-color"],hyperlinkColor:e["hyperlink-color"],positiveNumberColor:e["positive-number-color"],negativeNumberColor:e["negative-number-color"],zeroNumberColor:e["zero-number-color"],dateColor:e["date-color"],pendingTextColor:e["pending-text-color"],errorTextColor:e["error-text-color"],nullStringColor:e["null-string-color"],filterBarActiveBackgroundColor:e["filter-bar-active-bg"],filterBarExpandedBackgroundColor:e["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:e["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:e["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:e["filter-bar-separator-color"],filterBarActiveColor:e["filter-bar-active-color"],filterBarErrorColor:e["filter-bar-error-color"],filterIconColor:e["filter-icon-color"],scrimColor:e["scrim-color"],contextMenuSortIconColor:e["context-menu-sort-icon-color"],contextMenuReverseIconColor:e["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:e["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(e["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:90,columnHeaderHeight:parseInt(e["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,iconSize:16,activeCellSelectionBorderWidth:parseInt(e["active-cell-selection-border-width"],10)||2,shadowAlpha:parseFloat(e["row-shadow-alpha"])||.15,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:e["linker-column-hover-bg"],treeLineColor:e["tree-line-color"],treeMarkerColor:e["tree-marker-color"],treeMarkerHoverColor:e["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:e["floating-grid-row-color"],floatingRowBackgroundColors:e["floating-row-background-colors"],floatingDividerInnerColor:e["floating-divider-inner-color"],floatingDividerOuterColor:e["floating-divider-outer-color"],overflowButtonColor:e["overflow-button-color"],overflowButtonHoverColor:e["overflow-button-hover-color"],zeroLineColor:e["zero-line-color"],positiveBarColor:e["positive-bar-color"],negativeBarColor:e["negative-bar-color"],markerBarColor:e["marker-bar-color"],density:{compact:{cellHorizontalPadding:5,headerHorizontalPadding:10,minColumnWidth:10,rowHeight:16,font:"11px Fira Sans, sans-serif",iconSize:14,columnHeaderHeight:26},spacious:{cellHorizontalPadding:7,headerHorizontalPadding:15,rowHeight:28}}}))}var _t=le.module("useTableListener"),pi=(t,e,r)=>C.useEffect(function(){if(t==null){_t.debug2("Emitter undefined, skipping addEventListener",e);return}return _t.debug2("Adding listener",e),t.addEventListener(e,r)},[t,e,r]);function fi(t,e){return e==null?t.columns[0]:t.findColumn(e)}function gi(t,e,r){return r==null?e:t.findColumn(r)}function qs(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:String(t)}function Xs(t,e){return String(t)}function Ys(t){var{table:e,descriptionColumnName:r,iconColumnName:i,keyColumnName:n,labelColumnName:o,formatValue:a=Xs}=t,s=C.useMemo(()=>e==null?null:fi(e,n),[n,e]),l=C.useMemo(()=>e==null||s==null?null:gi(e,s,o),[s,o,e]),u=C.useMemo(()=>e==null||r==null?null:e.findColumn(r),[r,e]),c=C.useMemo(()=>e==null||i==null?null:e.findColumn(i),[i,e]),h=C.useCallback(p=>{R(s,"keyColumn cannot be null."),R(l,"labelColumn cannot be null.");var v=qs(p.get(s)),m=a(p.get(l),l.type),g=u==null?void 0:a(p.get(u),u.type),f=c==null?void 0:p.get(c);return{key:v,content:m,textValue:m,description:g,icon:f}},[u,a,c,s,l]);return h}function Zs(t){var e=rr(),r=C.useMemo(()=>{var s=Vn(e,t);return Vt(s),s},[e,t]),{getColumnFormat:i,getColumnFormatMapForType:n,getColumnTypeFormatter:o,getFormattedString:a}=r;return{getColumnFormat:i,getColumnFormatMapForType:n,getColumnTypeFormatter:o,getFormattedString:a,timeZone:r.timeZone}}function bi(){var t=rr();return C.useMemo(()=>new $(t),[t])}function Ut(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(u){return void r(u)}s.done?e(l):Promise.resolve(l).then(i,n)}function Js(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(l){Ut(o,i,n,a,s,"next",l)}function s(l){Ut(o,i,n,a,s,"throw",l)}a(void 0)})}}function el(t){var{columnName:e,value:r,table:i}=t,n=bi();return C.useCallback(Js(function*(){if(i==null||r==null||e==null)return null;var o=i.findColumn(e),a=n.getValueType(o.type),s=yield i.seekRow(0,o,a,r);return s===-1?null:s}),[e,i,n,r])}function yi(t){var[,e]=C.useState(0),r=rr(),i=C.useCallback(()=>{e(n=>n+1)},[]);return pi(t,r.Table.EVENT_SIZECHANGED,i),Qt(t)}var rl=le.module("useInitializeViewportData");function tl(t){var{items:e,targetSize:r,reuseExistingItems:i}=t,n=e.length;return n===r?e:(rl.debug("size changed:",{currentSize:n,targetSize:r}),i?n>r?e.slice(0,r):[...e,...Er(n,r-1)]:Array.from(Er(0,r-1)))}function il(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=Qn({}),i=Math.max(0,yi(t));return C.useEffect(()=>{r.setItems(tl({items:r.items,targetSize:i,reuseExistingItems:e}))},[i,t]),r}function nl(t,e,r){return C.useCallback(function(n){var[o,a]=Ii(n,e,r,Qt(t));t==null||t.setViewport(o,a)},[t,r,e])}var ol=150,al=200,sl=250,ll=500,ur=le.module("useViewportData");function ul(t){var{table:e,itemHeight:r=1,scrollDebounce:i=ol,viewportSize:n=10,viewportPadding:o=50,deserializeRow:a=ki,reuseItemsOnTableResize:s=!1}=t,l=C.useRef(0),u=il(e,s),c=nl(e,n,o),h=C.useCallback(w=>{l.current=w,e&&!hr(e)?c(w):ur.debug("setViewport called on closed table.",e)},[e,c]),p=C.useCallback(w=>{e&&!hr(e)?(e.applyFilter(w),h(0)):ur.debug("applyFiltersAndRefresh called on closed table.",e)},[h,e]),v=rr(),m=C.useRef();m.current=C.useMemo(()=>Ri(u,a),[a,u]);var g=C.useCallback(w=>{var y;(y=m.current)===null||y===void 0||y.call(m,w)},[]);pi(e,v.Table.EVENT_UPDATED,g);var f=yi(e);C.useEffect(()=>{ur.debug("Initializing viewport"),h(0)},[e,h]),C.useEffect(()=>{h(l.current)},[h,f]);var b=Kn(r,h,i);return C.useMemo(()=>({viewportData:u,size:f,table:e,applyFiltersAndRefresh:p,setViewport:h,onScroll:b}),[p,b,h,f,e,u])}function dl(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return C.useMemo(()=>Ai(...r.map(n=>n(t))),[t,...r])}function cl(t,e){var{applyFiltersAndRefresh:r}=t;C.useEffect(()=>{r(e)},[r,e])}var hl=["additionalFilterConditionFactories","searchColumnNames","timeZone"];function $t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function dr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?$t(Object(r),!0).forEach(function(i){vl(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$t(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function vl(t,e,r){return(e=ml(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ml(t){var e=pl(t,"string");return typeof e=="symbol"?e:e+""}function pl(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fl(t,e){if(t==null)return{};var r,i,n=gl(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function gl(t,e){if(t==null)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;r[i]=t[i]}return r}function bl(t){var{additionalFilterConditionFactories:e=[],searchColumnNames:r,timeZone:i}=t,n=fl(t,hl),o=bi(),[a,s]=C.useState(""),l=C.useMemo(()=>Fi(o,r,a,i),[r,a,o,i]),u=Gi(s,al),c=ul(dr({itemHeight:In,viewportSize:ll,viewportPadding:sl},n)),h=dl(c.table,l,...e);return cl(c,h),dr(dr({},c),{},{onSearchTextChange:u})}function yl(t){C.useEffect(()=>()=>{t!=null&&(hr(t)||t.close())},[t])}var Cl=["table","keyColumn","labelColumn","iconColumn","settings","onChange","onSelectionChange"];function Bt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Ht(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Bt(Object(r),!0).forEach(function(i){Sl(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Bt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Sl(t,e,r){return(e=wl(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wl(t){var e=Ol(t,"string");return typeof e=="symbol"?e:e+""}function Ol(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Wt(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(u){return void r(u)}s.done?e(l):Promise.resolve(l).then(i,n)}function jl(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(l){Wt(o,i,n,a,s,"next",l)}function s(l){Wt(o,i,n,a,s,"throw",l)}a(void 0)})}}function Tl(t,e){if(t==null)return{};var r,i,n=Pl(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Pl(t,e){if(t==null)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;r[i]=t[i]}return r}var xl=le.module("jsapi-components.usePickerProps");function Dl(t){var e,{table:r,keyColumn:i,labelColumn:n,iconColumn:o,settings:a,onChange:s,onSelectionChange:l}=t,u=Tl(t,Cl),{itemHeight:c}=Rn(),{getFormattedString:h,timeZone:p}=Zs(a),v=u.selectedKey===void 0,[m,g]=C.useState(u.defaultSelectedKey),{data:f}=kn($.copyTableAndApplyFilters,[r]);yl(f);var b=C.useMemo(()=>f==null?null:fi(f,i),[i,f]),w=C.useMemo(()=>f==null||b==null?null:gi(f,b,n),[b,n,f]),y=C.useMemo(()=>w==null?[]:[w.name],[w]),O=Ys({table:f,iconColumnName:o,keyColumnName:i,labelColumnName:n,formatValue:h}),P=el({table:f,columnName:(e=b==null?void 0:b.name)!==null&&e!==void 0?e:null,value:v?m:u.selectedKey}),D=C.useCallback(jl(function*(){var x=yield P();return x==null?null:x*c+An}),[P,c]),{onScroll:E,onSearchTextChange:I,setViewport:j,viewportData:N}=bl({reuseItemsOnTableResize:!0,table:f,itemHeight:c,deserializeRow:O,searchColumnNames:y,timeZone:p});C.useEffect(function(){var F=!1;return P().then(G=>{G==null||F||j(G)}).catch(G=>{xl.error("Error setting viewport from selected key",G)}),()=>{F=!0}},[P,a,j]);var T=C.useCallback(x=>{var F;v&&g(x),(F=s??l)===null||F===void 0||F(x)},[v,s,l]);return Ht(Ht({},u),{},{normalizedItems:N.items,showItemIcons:o!=null,getInitialScrollPosition:D,onChange:T,onScroll:E,onSearchTextChange:I})}function zt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Nl(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zt(Object(r),!0).forEach(function(i){El(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function El(t,e,r){return(e=Il(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Il(t){var e=Rl(t,"string");return typeof e=="symbol"?e:e+""}function Rl(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function su(t){var e=Dl(t);return d.jsx(Bn,Nl({},e))}var kl=C.createContext({theme:null,density:"regular"});function lu(t){var{children:e,density:r="regular"}=t,{activeThemes:i}=Mi(),n=C.useMemo(()=>Qs(),[i]),o=C.useMemo(()=>({theme:n,density:r}),[n,r]);return d.jsx(kl.Provider,{value:o,children:e})}export{te as $,zl as A,Yl as B,de as C,S as D,Zl as E,Vl as F,Jl as G,eu as H,ai as I,au as J,ou as K,Cr as L,ru as M,tu as N,kl as O,su as P,lu as Q,nu as R,al as S,po as T,Ql as U,ll as V,iu as W,yo as X,re as Y,Oo as Z,L as _,Kn as a,z as a0,Qs as a1,Lo as a2,Qn as b,pi as c,qn as d,Dl as e,Zs as f,Ys as g,ul as h,bi as i,yl as j,dl as k,cl as l,sl as m,el as n,il as o,bl as p,nl as q,yi as r,Wl as s,ao as t,Hl as u,Oe as v,Kl as w,co as x,ql as y,Xl as z};
12
- //# sourceMappingURL=IrisGridThemeProvider-Cmci0pcT.js.map
10
+ `:","}return r}makeSnapshot(e){var r=this;if(!(e<=0)){var{dh:i}=this.props;R(this.gridRangeCounter);var n=0,o=this.gridRanges[this.gridRangeCounter];R(this.tableSubscription),R(this.columns);for(var a=function(){R(o),R(o.startRow),R(o.endRow),R(r.rangedSnapshotCounter),R(r.chunkRows);var l=o.startRow+r.rangedSnapshotCounter*r.chunkRows,u=Math.min(l+r.chunkRows-1,o.endRow),c=r.snapshotCounter;r.cancelableSnapshots.push(Pi.makeCancelable(r.tableSubscription.snapshot(i.RangeSet.ofRange(l,u),r.columns).then(h=>(Zo(h),r.handleSnapshotResolved(h,c,l,u),c)).catch(h=>{pe.error(h)}),h=>{pe.info("snapshot ".concat(h," has been canceled"))})),r.rangedSnapshotCounter+=1,r.snapshotCounter+=1,r.snapshotPending+=1,r.rangedSnapshotCounter>=r.rangedSnapshotsTotal[r.gridRangeCounter]&&(r.gridRangeCounter+=1,r.rangedSnapshotCounter=0,o=r.gridRanges[r.gridRangeCounter]),n+=1};n<e;)a()}}handlePortMessage(e){var{data:r}=e,{download:i,readableStreamPulling:n}=r;if(!this.useBlobFallback){if(i!=null){var{includeColumnHeaders:o}=this;this.makeIframe("".concat(i)),this.writeCsvTable(o)}n!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,te.STREAM_TIMEOUT)))}}handleSnapshotResolved(e,r,i,n){this.snapshotHandlerTimeout=setTimeout(()=>{this.snapshotsBuffer.set(r,e),this.snapshotPending-=1,this.writeSnapshot(r,i,n),this.cancelableSnapshots[r]=null},te.SNAPSHOT_HANDLER_TIMEOUT)}makeIframe(e){var r=document.createElement("iframe");r.hidden=!0,r.src=e,r.name="iframe",document.body.appendChild(r),this.iframe=r}removeIframe(){var e;(e=this.iframe)===null||e===void 0||e.remove(),this.iframe=void 0}render(){return null}}_(te,"DOWNLOAD_CELL_CHUNK",6e3);_(te,"SNAPSHOT_BUFFER_SIZE",5);_(te,"STREAM_TIMEOUT",8e3);_(te,"SNAPSHOT_HANDLER_TIMEOUT",5);_(te,"defaultProps",{isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}});function Jo(t){var e,{group:r,onDelete:i,onColorChange:n,onNameChange:o,validateName:a}=t,{isNew:s}=r,l=C.useRef(r),u=C.useRef(null),c=C.useRef(null),[h,p]=C.useState(!1),[v,m]=C.useState(s?"":r.name),[g,f]=C.useState(s),[b,w]=C.useState(!1),y=v!==r.name?a(v):"",O=s&&!b||y==="",T=C.useCallback(()=>{p(!1)},[]);C.useEffect(function(){g&&u.current&&(u.current.focus(),u.current.select())},[g]),C.useEffect(function(){return()=>{l.current.isNew&&i(l.current)}},[i]),C.useEffect(function(){if(h){var N,P;(N=c.current)===null||N===void 0||N.click(),(P=c.current)===null||P===void 0||P.focus(),window.addEventListener("click",T,!0)}return()=>window.removeEventListener("click",T,!0)},[h,T]);var D=()=>{O&&(o(r,v),f(!1))},E=()=>{if(s){i(r);return}m(r.name),f(!1)},I=j=>{w(!0),j.key==="Enter"&&(j.stopPropagation(),D()),j.key===" "&&j.stopPropagation(),j.key==="Escape"&&E()};return g?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"editing-container",children:[d.jsx("input",{ref:u,className:V("form-control",{"is-invalid":!O}),value:v,placeholder:"Group Name",onChange:j=>m(j.target.value),onKeyDown:I,onBlur:()=>w(!0)}),d.jsx(M,{kind:"ghost",icon:fr,tooltip:"Confirm",onClick:D}),d.jsx(M,{kind:"ghost",icon:sn,tooltip:"Cancel",onClick:E})]}),!O&&d.jsx("p",{className:"mb-0 validate-label-error text-danger",children:y})]}):d.jsxs("div",{className:"group-name-wrapper",children:[d.jsx("span",{className:"column-name",children:v}),d.jsx(M,{className:"p-1 mx-1",kind:"ghost",icon:Xt,tooltip:"Edit",onClick:()=>{f(!0)}}),d.jsxs("span",{className:"right-buttons",children:[d.jsx(M,{kind:"ghost",icon:Ge,tooltip:"Delete group",onClick:()=>i(r)}),d.jsx(M,{kind:"ghost",className:"color-swatch mr-1",icon:r.color!==void 0?d.jsxs("span",{className:"fa-layers",children:[d.jsx(K,{className:"color-swatch",icon:Gr,color:J.white,transform:"down-1"}),d.jsx(K,{className:"color-swatch",icon:Gr,color:r.color,transform:"shrink-2 down-1"})]}):ln,tooltip:"Set color",onClick:()=>p(j=>!j)}),h&&d.jsxs(d.Fragment,{children:[d.jsx("input",{"aria-label":"Color input",ref:c,type:"color",list:"presetColors",value:(e=r.color)!==null&&e!==void 0?e:J["content-bg"],style:{visibility:"hidden",width:0,height:0,padding:0,border:0},onChange:j=>{r.color=j.target.value,n(r,j.target.value)}}),d.jsxs("datalist",{id:"presetColors",children:[d.jsx("option",{children:J["content-bg"]}),d.jsx("option",{children:J.primary}),d.jsx("option",{children:J.foreground}),d.jsx("option",{children:J.green}),d.jsx("option",{children:J.yellow}),d.jsx("option",{children:J.orange}),d.jsx("option",{children:J.red}),d.jsx("option",{children:J.purple}),d.jsx("option",{children:J.blue}),d.jsx("option",{children:J["gray-400"]})]})]})]})]})}function vt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function mt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?vt(Object(r),!0).forEach(function(i){ea(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function ea(t,e,r){return(e=ra(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ra(t){var e=ta(t,"string");return typeof e=="symbol"?e:e+""}function ta(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ia(){}var na=C.forwardRef(function(e,r){var{value:i,clone:n,childCount:o,item:a,onVisibilityChange:s,onClick:l,onGroupDelete:u,onGroupColorChange:c,onGroupNameChange:h,validateGroupName:p,handleProps:v}=e,{group:m,modelIndex:g,isVisible:f}=a.data,b=C.useRef(null),w=C.useCallback(O=>{if(O.buttons===1){var T;s([g].flat(),!f),(T=b.current)===null||T===void 0||T.focus()}},[s,g,f]),y=C.useCallback(O=>{l(i,O)},[l,i]);return d.jsxs("div",mt(mt({ref:r,className:V("tree-item",{isSelected:a.selected,"two-dragged":o===2,"multiple-dragged":o>2}),onClick:y},v),{},{children:[d.jsx(M,{ref:b,kind:"ghost",className:"px-1",onClick:ia,onMouseDown:w,onMouseEnter:w,icon:f?ei:ri,tooltip:"Toggle visibility"}),d.jsx("span",{className:V("column-name",m&&"column-group"),children:m&&!n?d.jsx(Jo,{group:m,onDelete:u,onColorChange:c,onNameChange:h,validateName:p}):i}),d.jsxs("div",{children:[n&&o>1&&d.jsx("span",{className:"item-count",children:o}),d.jsx(Xe,{children:"Drag to re-order"}),d.jsx(K,{icon:Zt})]})]}))});function oa(t){return t.parentId!==void 0}function pt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function ft(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?pt(Object(r),!0).forEach(function(i){aa(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function aa(t,e,r){return(e=sa(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function sa(t){var e=la(t,"string");return typeof e=="symbol"?e:e+""}function la(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ua(t,e){return Math.round(t/e)}function si(t,e,r,i,n,o){var a=t.findIndex(u=>u.name===i);if(a===-1){var s=r.get(i);if(s==null)throw new Error("Column or header group not found: ".concat(i));var l=s.childIndexes.flat();return{id:i,selected:o.has(i),children:s.children.map(u=>si(t,e,r,u,n,o)).sort((u,c)=>{var h=Array.isArray(u.data.visibleIndex)?u.data.visibleIndex[0]:u.data.visibleIndex,p=Array.isArray(c.data.visibleIndex)?c.data.visibleIndex[0]:c.data.visibleIndex;return h-p}),data:{modelIndex:l,visibleIndex:s.getVisibleRange(e),group:s,isVisible:l.some(u=>!n.has(u))}}}return{id:i,children:[],selected:o.has(i),data:{modelIndex:a,visibleIndex:U.getVisibleIndex(a,e),isVisible:!n.has(a)}}}function da(t,e,r,i,n){for(var o=[],a=new Set(n),s=new Map(r.map(h=>[h.name,h])),l=new Set(i),u=0,c=function(){for(var p=U.getModelIndex(u,e),v=t[p].name,m=r.find(f=>{var{children:b}=f;return b.includes(v)});m!==void 0&&m.parent!==void 0;)m=s.get(m.parent);var g=si(t,e,s,m?m.name:v,l,a);o.push(g),Array.isArray(g.data.visibleIndex)?u+=g.data.visibleIndex[1]-g.data.visibleIndex[0]+1:u+=1};u<t.length;)c();return o}function Je(t,e,r,i,n){var o=t.findIndex(b=>{var{id:w}=b;return w===r}),a=t.findIndex(b=>{var{id:w}=b;return w===e}),s=t[a],l=Ui(t,a,o),u=l[o-1],c=l[o+1],h=ua(i,n),p=s.depth+h,v=ca({previousItem:u,nextItem:c}),m=ha({nextItem:c}),g=p;return p>=v?g=v:p<m&&(g=m),{depth:g,maxDepth:v,minDepth:m,parentId:f()};function f(){var b;if(g===0||!u)return null;if(g===u.depth)return u.parentId;if(g>u.depth)return u.id;var w=(b=l.slice(0,o).reverse().find(y=>y.depth===g))===null||b===void 0?void 0:b.parentId;return w??null}}function ca(t){var e,r,{previousItem:i,nextItem:n}=t;return Math.max((e=i==null?void 0:i.depth)!==null&&e!==void 0?e:0,(r=n==null?void 0:n.depth)!==null&&r!==void 0?r:0)}function ha(t){var{nextItem:e}=t;return e?e.depth:0}function li(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return t.reduce((i,n,o)=>[...i,ft(ft({},n),{},{parentId:e,depth:r,index:o}),...li(n.children,n.id,r+1)],[])}function ee(t){return t.every(oa)?[...t]:li(t)}function ui(t,e){for(var r=0;r<t.length;r+=1){var i=t[r],{id:n,children:o}=i;if(n===e)return i;if(o.length){var a=ui(o,e);if(a)return a}}}function di(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return t.reduce((r,i)=>{var{children:n}=i;return n.length?di(n,r+1):r+1},e)}function va(t,e){var r=ui(t,e);return r?di(r.children):0}function gt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function He(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?gt(Object(r),!0).forEach(function(i){ma(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):gt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function ma(t,e,r){return(e=pa(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pa(t){var e=fa(t,"string");return typeof e=="symbol"?e:e+""}function fa(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ga=[he.Down,he.Right,he.Up,he.Left],ba=[he.Left,he.Right];function ya(t,e,r){return(i,n)=>{var{currentCoordinates:o,context:{active:a,over:s,collisionRect:l,droppableRects:u,droppableContainers:c}}=n;if(ga.includes(i.code)){if(!a||!l)return;i.preventDefault();var{current:{items:h,offset:p}}=t;if(ba.includes(i.code)&&(s==null?void 0:s.id)!=null){var{depth:v,maxDepth:m,minDepth:g}=Je(h,a.id,s.id,p,r);switch(i.code){case he.Left:if(v>g)return He(He({},o),{},{x:o.x-r});break;case he.Right:if(v<m)return He(He({},o),{},{x:o.x+r});break}return}var f=[];c.forEach(A=>{if(!(A!=null&&A.disabled||A.id===(s==null?void 0:s.id))){var B=u.get(A.id);if(B)switch(i.code){case he.Down:l.top<B.top&&f.push(A);break;case he.Up:l.top>B.top&&f.push(A);break}}});var b=$i({active:a,collisionRect:l,pointerCoordinates:null,droppableRects:u,droppableContainers:f}),w=Bi(b,"id");if(w===(s==null?void 0:s.id)&&b.length>1&&(w=b[1].id),w!=null&&(s==null?void 0:s.id)!=null){var y=u.get(a.id),O=u.get(w),T=c.get(w);if(y&&O&&T){var D=h.findIndex(A=>{var{id:B}=A;return B===w}),E=h[D],I=h.findIndex(A=>{var{id:B}=A;return B===a.id}),j=h[I];if(E!=null&&j!=null){var{depth:N}=Je(h,a.id,w,(E.depth-j.depth)*r,r),P=D>I,x=P?1:-1,F=e?(l.height-y.height)/2:0,G={x:O.left+N*r,y:O.top+x*F};return G}}}}}}function Ca(t,e,r){return(e=Sa(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sa(t){var e=wa(t,"string");return typeof e=="symbol"?e:e+""}function wa(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ci extends Hi{}Ca(ci,"activators",[{eventName:"onPointerDown",handler:t=>{var{nativeEvent:e}=t;return!(!e.isPrimary||e.button!==0||ja(e.target))}}]);var Oa=["button","input","textarea","select","option"];function ja(t){return!!((t==null?void 0:t.tagName)!=null&&Oa.includes(t.tagName.toLowerCase()))}function hi(t){var{clone:e=!1,depth:r,disableInteraction:i=!1,ghost:n=!1,handleProps:o,value:a,dragRef:s=null,wrapperRef:l=null,renderItem:u,item:c,childCount:h}=t,p=C.useMemo(()=>Array(r).fill(0).map((m,g)=>d.jsx("span",{className:"depth-line"},"depth-line-".concat(g))),[r]),v=C.useMemo(()=>({ref:s,clone:e,value:a,item:c,childCount:h,handleProps:o}),[s,e,a,c,h,o]);return d.jsxs("li",{className:V("item-wrapper",{clone:e,ghost:n,disableInteraction:i}),ref:l,children:[!e&&p,u(v)]},a)}hi.displayName="TreeItem";var Pa=["id","depth"];function bt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function We(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?bt(Object(r),!0).forEach(function(i){Ta(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Ta(t,e,r){return(e=xa(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xa(t){var e=Da(t,"string");return typeof e=="symbol"?e:e+""}function Da(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Na(t,e){if(t==null)return{};var r,i,n=Ea(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Ea(t,e){if(t==null)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;r[i]=t[i]}return r}var Ia=t=>{var{isSorting:e,wasDragging:r}=t;return!(e||r)};function yt(t){var{id:e,depth:r}=t,i=Na(t,Pa),{attributes:n,isDragging:o,isSorting:a,listeners:s,setDraggableNodeRef:l,setDroppableNodeRef:u,transform:c,transition:h}=Wi({id:e,animateLayoutChanges:Ia}),p=mr.Translate.toString(c),v=C.useMemo(()=>({transform:p,transition:h}),[p,h]),m=C.useMemo(()=>We(We(We({},n),s),{},{style:v}),[n,s,v]);return d.jsx(hi,We({dragRef:l,wrapperRef:u,depth:r,ghost:o,disableInteraction:a,handleProps:m},i))}function Ct(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function er(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ct(Object(r),!0).forEach(function(i){Ra(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ct(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Ra(t,e,r){return(e=ka(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ka(t){var e=Aa(t,"string");return typeof e=="symbol"?e:e+""}function Aa(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Fa={keyframes(t){var{transform:e}=t;return[{opacity:1,transform:mr.Transform.toString(e.initial)},{opacity:0,transform:mr.Transform.toString(er(er({},e.final),{},{x:e.final.x+5,y:e.final.y+5}))}]},easing:"ease-out",sideEffects(t){var{active:e}=t;e.node.animate([{opacity:0},{opacity:1}],{duration:kr.duration,easing:kr.easing})}},ze=null;function Ga(t){var e;return ze==null&&t.activeNodeRect&&t.activatorEvent instanceof PointerEvent&&(ze=Math.floor((t.activatorEvent.clientY-t.activeNodeRect.top)/t.activeNodeRect.height)*t.activeNodeRect.height),t.activeNodeRect||(ze=null),er(er({},t.transform),{},{y:t.transform.y+((e=ze)!==null&&e!==void 0?e:0)})}function Ma(t){var{items:e,renderItem:r,indentationWidth:i=30,indicator:n=!1,activeId:o,overId:a,offsetLeft:s}=t,l=zi(),u=C.useRef(l);C.useEffect(function(){u.current=l},[l]),C.useEffect(function(){u.current.measureDroppableContainers(e.map(m=>{var{id:g}=m;return g}))},[e]);var c=o!=null&&a!=null?Je(e,o,a,s,i):null,h=C.useRef({items:e,offset:s}),p=o!=null?e.find(v=>{var{id:m}=v;return m===o}):null;return C.useEffect(()=>{h.current={items:e,offset:s}},[e,s]),d.jsxs(d.Fragment,{children:[d.jsx("div",{className:V("tree-container",o!=null&&"marching-ants"),children:e.map(v=>{var{id:m,depth:g}=v;return d.jsx(yt,{id:m,value:m,depth:m===o&&c?c.depth:g,item:v,renderItem:r},m)})}),Vi.createPortal(d.jsx(Ki,{dropAnimation:Fa,modifiers:[Ga],className:"visibility-ordering-list",children:o!=null&&p?d.jsx(yt,{id:o,depth:p.depth,clone:!0,childCount:va(e,o)+1,value:o.toString(),renderItem:r,item:p}):null}),document.body)]})}function St(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Ve(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?St(Object(r),!0).forEach(function(i){La(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):St(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function La(t,e,r){return(e=_a(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _a(t){var e=Ua(t,"string");return typeof e=="symbol"?e:e+""}function Ua(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $a={droppable:{strategy:Ji.Always}},Ba={activationConstraint:{distance:5}};function Ha(t){var{items:e,indicator:r=!1,indentationWidth:i=30,onDragStart:n,onDragEnd:o,renderItem:a}=t,[s,l]=C.useState(null),[u,c]=C.useState(null),[h,p]=C.useState(0),v=C.useMemo(()=>{var j=ee(e);return s!=null?j.filter(N=>{var{id:P,selected:x}=N;return P===s||!x}):j},[s,e]),m=s!=null&&u!=null?Je(v,s,u,h,i):null,g=C.useRef({items:v,offset:h}),f=C.useMemo(()=>({coordinateGetter:ya(g,r,i)}),[i,r]),b=Qi(Ar(ci,Ba),Ar(en,f)),w=C.useMemo(()=>v.map(j=>{var{id:N}=j;return N}),[v]);C.useEffect(()=>{g.current={items:v,offset:h}},[v,h]);var y=C.useCallback(j=>{var{active:{id:N}}=j;l(N),c(N),n==null||n(N),document.body.style.setProperty("cursor","grabbing")},[n]),O=C.useCallback(j=>{var{delta:N}=j;p(N.x)},[]),T=C.useCallback(j=>{var N,{over:P}=j;c((N=P==null?void 0:P.id)!==null&&N!==void 0?N:null)},[]),D=C.useCallback(()=>{c(null),l(null),p(0),document.body.style.setProperty("cursor","")},[]),E=C.useCallback(j=>{var{active:N,over:P}=j;if(D(),m&&P){var{depth:x,parentId:F}=m,G=JSON.parse(JSON.stringify(ee(e))),A=G.findIndex(W=>{var{id:ve}=W;return ve===P.id}),B=G.findIndex(W=>{var{id:ve}=W;return ve===N.id}),H=G[B];G[B]=Ve(Ve({},H),{},{depth:x,parentId:F}),o==null||o(H,Ve(Ve({},G[A]),{},{parentId:m.parentId}))}},[e,o,m,D]),I=C.useCallback(()=>{D()},[D]);return d.jsx(qi,{sensors:b,collisionDetection:Xi,measuring:$a,onDragStart:y,onDragMove:O,onDragOver:T,onDragEnd:E,onDragCancel:I,children:d.jsx(Yi,{items:w,strategy:Zi,children:d.jsx(Ma,{items:v,renderItem:a,indicator:r,indentationWidth:i,activeId:s,overId:u,offsetLeft:h})})})}function wt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Ot(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?wt(Object(r),!0).forEach(function(i){Wa(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):wt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Wa(t,e,r){return(e=za(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function za(t){var e=Va(t,"string");return typeof e=="symbol"?e:e+""}function Va(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ka(t,e,r,i,n,o,a,s){var l=n.map((O,T)=>Ot(Ot({},O),{},{index:T})),u=[],c=i,h=o[0].data.visibleIndex,p=l.findIndex(O=>{var{id:T}=O;return T===t.id}),v=l.findIndex(O=>{var{id:T}=O;return T===e.id}),m=Array.isArray(h)?h[1]+1:h+1;c=Ce(o[0],e.parentId,c);for(var g=1;g<o.length;g+=1){var{data:{visibleIndex:f}}=o[g];u=U.moveItemOrRange(f,m,u,!0),m+=Array.isArray(f)?f[1]-f[0]+1:1,c=Ce(o[g],e.parentId,c)}var b=[Array.isArray(h)?h[0]:h,m-1],w=Array.isArray(e.data.visibleIndex)?e.data.visibleIndex[0]:e.data.visibleIndex,y=U.getVisibleIndex(w,u);return p>v&&y>w&&(y-=1),e.children.length>0&&(Array.isArray(h)?h[0]:h)<y&&(y-=1),b[0]<y&&(y-=b[1]-b[0]),u=U.moveItemOrRange(b,pr(y,a,s),u),{groups:c,movedColumns:r.concat(u)}}function Ce(t,e,r){if(t.parentId===e)return[...r];var i=r.map(f=>new we(f)),n=new Map(i.map(f=>[f.name,f])),o=i.find(f=>f.name===t.parentId),a=i.find(f=>f.name===e),s=i.find(f=>f.name===t.id);if(o!=null&&(o.children=o.children.filter(f=>f!==t.id),o.children.length===0)){var l,u=new Set([o.name]),{parent:c=""}=o,h=n.get(c);for((l=h)===null||l===void 0||l.removeChildren([o.name]);h&&h.children.length===0;){var p,v;u.add(h.name);var m=(p=(v=h)===null||v===void 0?void 0:v.parent)!==null&&p!==void 0?p:"",g=n.get(m);g==null||g.removeChildren([h.name]),h=g}i=i.filter(f=>{var{name:b}=f;return!u.has(b)})}return a!=null&&a.addChildren([t.id]),s==null||s.setParent(e??void 0),i}function jt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function De(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jt(Object(r),!0).forEach(function(i){ne(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function ne(t,e,r){return(e=Qa(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qa(t){var e=qa(t,"string");return typeof e=="symbol"?e:e+""}function qa(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Xa=150;class z extends C.PureComponent{static shouldRenderColumn(e){return e.isProxy!==!0}constructor(e){super(e),ne(this,"list",void 0),ne(this,"debouncedSearchColumns",jr(this.searchColumns,Xa)),ne(this,"handleGroupColorChange",rn((r,i)=>{var{columnHeaderGroups:n,onColumnHeaderGroupChanged:o}=this.props,a=[...n],s=new we(De(De({},r),{},{color:i}));a.splice(a.findIndex(l=>{var{name:u}=l;return u===r.name}),1,s),o(a)},250)),ne(this,"renderItem",ye(r=>{var{value:i,clone:n,item:o,ref:a,handleProps:s}=r,{onColumnVisibilityChanged:l}=this.props,{selectedColumns:u}=this.state,c=i;if(n){var h=this.getSelectedParentItems().map(p=>{var{id:v}=p;return v});c=h.join(", ")}return d.jsx(na,{ref:a,value:c,clone:n,item:o,childCount:u.size,onVisibilityChange:l,onClick:this.handleItemClick,onGroupDelete:this.handleGroupDelete,onGroupColorChange:this.handleGroupColorChange,onGroupNameChange:this.handleGroupNameChange,validateGroupName:this.validateGroupName,handleProps:s})},{max:1e3})),ne(this,"getMemoizedFirstMovableIndex",ye((r,i,n)=>{for(var o=0;o<i.length;o+=1){var a=U.getModelIndex(o,n);if(r.isColumnMovable(a))return o}return null},{max:10})),ne(this,"getMemoizedLastMovableIndex",ye((r,i,n)=>{for(var o=i.length-1;o>=0;o-=1){var a=U.getModelIndex(o,n);if(r.isColumnMovable(a))return o}return null},{max:10})),ne(this,"memoizedGetTreeItems",ye((r,i,n,o,a)=>da(r,i,n,o,[...a.values()]),{max:1e3})),ne(this,"makeVisibilityOrderingList",ye((r,i)=>{var{movedColumns:n}=this.props,o=[],a=this.getFirstMovableIndex(),s=this.getLastMovableIndex(),l=i.findIndex(O=>{var{data:T}=O;return Array.isArray(T.visibleIndex)?T.visibleIndex[0]===a:T.visibleIndex===a}),u=i.findIndex(O=>{var{data:T}=O;return Array.isArray(T.visibleIndex)?T.visibleIndex[1]===s:T.visibleIndex===s}),c=i.slice(l,u+1);if(a==null||s===null){for(var h=0;h<r.length;h+=1){var p=U.getModelIndex(h,n),v=r[p];z.shouldRenderColumn(v)&&o.push(this.renderImmovableItem(v.name))}return o}for(var m=0;m<a;m+=1){var g=U.getModelIndex(m,n),f=r[g];z.shouldRenderColumn(f)&&o.push(this.renderImmovableItem(f.name))}a!==null&&a>0&&o.push(d.jsx("hr",{},"top-horizontal-divider")),o.push(d.jsx(Ha,{items:c,renderItem:this.renderItem,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd},"movable-items")),s!=null&&s<r.length-1&&o.push(d.jsx("hr",{},"bottom-horizontal-divider"));for(var b=s+1;b<r.length;b+=1){var w=U.getModelIndex(b,n),y=r[w];z.shouldRenderColumn(y)&&o.push(this.renderImmovableItem(y.name))}return o},{max:10})),ne(this,"renderImmovableItem",ye(r=>d.jsx("div",{className:"visibility-ordering-list-item immovable",children:d.jsx("div",{className:"column-item",children:d.jsx("span",{className:"column-name",children:r})})},r),{max:1e3})),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupDelete=this.handleGroupDelete.bind(this),this.handleGroupNameChange=this.handleGroupNameChange.bind(this),this.handleGroupCreate=this.handleGroupCreate.bind(this),this.validateGroupName=this.validateGroupName.bind(this),this.addColumnToSelected=this.addColumnToSelected.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.state={selectedColumns:new Set,queriedColumnIndex:void 0,queriedColumnRange:void 0,prevQueriedColumns:void 0,lastSelectedColumn:"",searchFilter:""},this.list=null}componentDidUpdate(e){var{movedColumns:r}=this.props;if(r!==e.movedColumns){var{searchFilter:i}=this.state;this.searchColumns(i,!1)}}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){var{model:e,onReset:r,onMovedColumnsChanged:i,onColumnHeaderGroupChanged:n}=this.props;this.setState({selectedColumns:new Set,queriedColumnIndex:void 0,queriedColumnRange:void 0,prevQueriedColumns:void 0,lastSelectedColumn:"",searchFilter:""}),r(),n(e.initialColumnHeaderGroups),i(e.initialMovedColumns)}resetSelection(){this.setState({selectedColumns:new Set,lastSelectedColumn:""})}handleSearchInputChange(e){var r=e.target.value;if(this.setState({searchFilter:r}),!r){this.debouncedSearchColumns.cancel(),this.resetSelection();return}this.debouncedSearchColumns(r)}searchColumns(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=ee(this.getTreeItems()),n=i.filter(c=>{var h,p,{id:v,data:m}=c;return!((h=(p=m.group)===null||p===void 0?void 0:p.isNew)!==null&&h!==void 0&&h)&&v.toLowerCase().includes(e.toLowerCase())}),o=n.reduce((c,h)=>{var{id:p}=h,v=i.findIndex(m=>m.id===p);return De(De({},c),{},{[v]:p})},{});if(!r){this.setState({prevQueriedColumns:o});return}var a=n.map(c=>{var{id:h}=c;return h});if(this.addColumnToSelected(a,!1),a.length>0){var s,l=i.findIndex(c=>{var{id:h}=c;return h.toLowerCase().includes(e.toLowerCase())}),u=(s=this.list)===null||s===void 0?void 0:s.querySelectorAll(".item-wrapper")[l];u==null||u.scrollIntoView({block:"center"})}this.setState({prevQueriedColumns:o,queriedColumnIndex:void 0})}changeSelectedColumn(e){var r,{queriedColumnIndex:i,queriedColumnRange:n,prevQueriedColumns:o}=this.state,a=i;if(o!==void 0){var s=Object.keys(o).length;e==="forward"?n!==void 0?a=n.nextIndex:a===void 0||a>=s-1?a=0:a+=1:e==="back"&&(n!==void 0?a=n.prevIndex:a===void 0||a<=0?a=s-1:a-=1),this.addColumnToSelected([Object.values(o)[a]],!1);var l=parseInt(Object.keys(o)[a],10),u=(r=this.list)===null||r===void 0?void 0:r.querySelectorAll(".item-wrapper")[l];u==null||u.scrollIntoView({block:"center"}),this.setState({queriedColumnIndex:a,queriedColumnRange:void 0})}}adjustQueriedIndex(e){var{prevQueriedColumns:r}=this.state;if(r!==void 0){if(e in Object.values(r)){var i=Object.values(r).indexOf(e);this.setState({queriedColumnIndex:i,queriedColumnRange:void 0});return}for(var n=ee(this.getTreeItems()),o=n.findIndex(h=>h.id===e),a=Object.keys(r).map(h=>parseInt(h,10)),s=a.length-1,l=0,u=0;u<a.length;u+=1){var c=a[u];if(c<o)s=u;else if(c>o){l=u;break}}this.setState({queriedColumnRange:{prevIndex:s,nextIndex:l}})}}moveSelectedColumns(e){var{columnHeaderGroups:r}=this.props,{selectedColumns:i}=this.state,n=ee(this.getTreeItems()),o=this.getFirstMovableIndex(),a=this.getLastMovableIndex();R(o),R(a);var s=this.getSelectedParentItems(),l=e===z.MOVE_OPTIONS.UP||e===z.MOVE_OPTIONS.TOP;l||s.reverse();for(var u=[],c=r,h=function(){var{id:m,parentId:g,depth:f,data:{visibleIndex:b}}=s[p];switch(e){case z.MOVE_OPTIONS.TOP:{u=U.moveItemOrRange(b,o,u,!0);var w=Array.isArray(b)?b[1]-b[0]+1:1;o+=w,c=Ce(s[p],null,c);break}case z.MOVE_OPTIONS.BOTTOM:{u=U.moveItemOrRange(b,a,u,!0);var y=Array.isArray(b)?b[1]-b[0]+1:1;a-=y,c=Ce(s[p],null,c);break}case z.MOVE_OPTIONS.UP:{var O=n.findIndex(H=>H.id===m),T=n.map((H,W)=>W<O&&!i.has(H.id)).lastIndexOf(!0),D=n[T];if(D!=null&&D.parentId!==g)if(Math.abs(D.depth-f)>1){var E=n.map((H,W)=>W<T&&H.depth===f).lastIndexOf(!0),I=n[E];c=Ce(s[p],I.id,c)}else c=Ce(s[p],D.parentId,c);else{var j=pr(Array.isArray(b)?b[0]-1:b-1,o,a);u=U.moveItemOrRange(b,j,u,!1);var N=Array.isArray(b)?b[1]-b[0]+1:1;o+=N}break}case z.MOVE_OPTIONS.DOWN:{var P=n.findIndex(H=>H.id===m),x=n.find((H,W)=>W>P&&!i.has(H.id));if((x==null?void 0:x.parentId)!==g){var F,G=n.find(H=>H.id===g);c=Ce(s[p],(F=G==null?void 0:G.parentId)!==null&&F!==void 0?F:null,c);break}else if((x==null?void 0:x.children.length)>0){c=Ce(s[p],x.id,c);break}var A=pr(Array.isArray(b)?b[0]+1:b+1,o,a);u=U.moveItemOrRange(b,A,u,!1);var B=Array.isArray(b)?b[1]-b[0]+1:1;a-=B;break}}},p=0;p<s.length;p+=1)h();return{newMoves:u,groups:c}}handleMoveColumns(e){var{onMovedColumnsChanged:r,movedColumns:i,onColumnHeaderGroupChanged:n}=this.props,{newMoves:o,groups:a}=this.moveSelectedColumns(e),s;e===z.MOVE_OPTIONS.TOP&&(s=()=>{var l,u;(l=this.list)===null||l===void 0||(u=l.parentElement)===null||u===void 0||u.scroll({top:0})}),e===z.MOVE_OPTIONS.BOTTOM&&(s=()=>{var l,u;(l=this.list)===null||l===void 0||(u=l.parentElement)===null||u===void 0||u.scroll({top:this.list.parentElement.scrollHeight})}),n(a),o.length>0&&r(i.concat(o),s)}getSortMoves(e,r,i){var n=[...e],o=r===z.SORTING_OPTIONS.ASC;n.sort((p,v)=>{var m=p.id.toUpperCase(),g=v.id.toUpperCase();return Ke.sort(m,g,o)});for(var a=[...i],s=Math.min(...n.flatMap(p=>{var{modelIndex:v}=p.data;return Array.isArray(v)?U.getVisibleIndexes(v,a):U.getVisibleIndex(v,a)})),l=0;l<n.length;l+=1){var u=n[l],{modelIndex:c}=u.data,h=Array.isArray(c)?U.getVisibleIndexes(c,a):U.getVisibleIndex(c,a);a=Array.isArray(h)?U.moveRange([Math.min(...h),Math.max(...h)],s,a,!0):U.moveItem(h,s,a),Array.isArray(h)&&(a=this.getSortMoves(u.children,r,a)),s+=Array.isArray(c)?c.length:1}return a}handleSortColumns(e){for(var r,i,{model:n,onMovedColumnsChanged:o}=this.props,a=this.getTreeItems(),s=(r=this.getFirstMovableIndex())!==null&&r!==void 0?r:0,l=(i=this.getLastMovableIndex())!==null&&i!==void 0?i:a.length-1,u=a.slice(s,l+1),c=[...n.initialMovedColumns],h=0;h<n.frozenColumns.length;h+=1){var p,v=n.frozenColumns[h],m=U.getVisibleIndex((p=n.getColumnIndexByName(v))!==null&&p!==void 0?p:0,c);m!==h&&c.push({from:m,to:h})}var g=this.getSortMoves(u,e,c);o(g)}handleItemClick(e,r){if(r.stopPropagation(),!(r.target instanceof HTMLElement&&(r.target.tagName==="BUTTON"||r.target.tagName==="INPUT"))){r.currentTarget.focus();var{selectedColumns:i,lastSelectedColumn:n}=this.state,o=U.isModifierKeyDown(r),a=r.shiftKey,s=i.has(e),l=[e];if(s&&o){this.removeColumnFromSelected(e);return}var u=ee(this.getTreeItems());if(s&&!a&&n===e){var c=u.find(m=>{var{id:g}=m;return g===e});R(c);var h=ee(c.children).length;if(h+1===i.size){this.resetSelection();return}}if(a){var p=u.findIndex(m=>m.id===e),v=u.findIndex(m=>m.id===n);l.push(...u.slice(Math.min(v,p),Math.max(v,p)+1).map(m=>m.id))}this.addColumnToSelected(l,o||a),this.adjustQueriedIndex(e),this.setState({lastSelectedColumn:e})}}addColumnToSelected(e,r){var{selectedColumns:i}=this.state,n=new Set(r?[...i.values()].concat(e):e),o=ee(this.getTreeItems());o.forEach(a=>{var{id:s,children:l}=a;n.has(s)&&l.forEach(u=>n.add(u.id))}),this.setState({selectedColumns:n})}removeColumnFromSelected(e){var{selectedColumns:r}=this.state,i=ee(this.getTreeItems()),n=i.find(s=>{var{id:l}=s;return l===e});R(n);var o=i.find(s=>{var{id:l}=s;return l===n.parentId});ee(n==null?void 0:n.children).forEach(s=>r.delete(s.id));for(var a=function(){r.delete(o.id);var l=o.parentId;o=i.find(u=>{var{id:c}=u;return c===l})};o!=null;)a();r.delete(e),this.setState({selectedColumns:new Set(r)})}handleDragStart(e){var{selectedColumns:r}=this.state;r.has(e)||this.addColumnToSelected([e],!1)}handleDragEnd(e,r){var{movedColumns:i,onMovedColumnsChanged:n,columnHeaderGroups:o,onColumnHeaderGroupChanged:a}=this.props,s=this.getSelectedParentItems(),l=ee(this.getTreeItems()).map((v,m)=>De(De({},v),{},{index:m})),u=this.getFirstMovableIndex(),c=this.getLastMovableIndex();R(u),R(c);var{groups:h,movedColumns:p}=Ka(e,r,i,o,l,s,u,c);a(h),n(p)}handleGroupNameChange(e,r){var{columnHeaderGroups:i,onColumnHeaderGroupChanged:n}=this.props,o=[...i],a=e.name,s=o.findIndex(p=>{var{name:v}=p;return v===a}),l=o[s];R(l);var u=new we(l);u.name=r,o.splice(s,1,u);var c=o.findIndex(p=>{var{name:v}=p;return v===u.parent});if(c>=0){var h=new we(o[c]);h.removeChildren([a]),h.addChildren([r]),o.splice(c,1,h)}n(o)}handleGroupDelete(e){var{columnHeaderGroups:r,onColumnHeaderGroupChanged:i}=this.props,n=r.filter(s=>s.name!==e.name),o=n.findIndex(s=>s.name===e.parent);if(o>=0){var a=new we(n[o]);a.addChildren(e.children),a.removeChildren([e.name]),n.splice(o,1,a)}i(n)}handleGroupCreate(){var{movedColumns:e,onMovedColumnsChanged:r,onColumnHeaderGroupChanged:i}=this.props,{newMoves:n,groups:o}=this.moveSelectedColumns(z.MOVE_OPTIONS.TOP),a=o.filter(h=>!h.isNew),s=this.getSelectedParentItems(),l=s.map(h=>h.data.modelIndex).flat().filter(h=>h>=0),u="".concat(we.NEW_GROUP_PREFIX,"-").concat(Date.now()),c=new we({name:u,children:s.map(h=>{var{id:p}=h;return p}),depth:0,childIndexes:[...new Set(l)]});r(e.concat(n),()=>{var h,p;(h=this.list)===null||h===void 0||(p=h.parentElement)===null||p===void 0||p.scroll({top:0})}),i(a.concat([c])),this.resetSelection()}validateGroupName(e){var{model:r,columnHeaderGroups:i}=this.props,{columns:n}=r;return Sr.isValidColumnName(e)?n.some(o=>{var{name:a}=o;return a===e})||i.some(o=>{var{name:a}=o;return a===e})?"Duplicate name":"":"Invalid name"}getFirstMovableIndex(){var{model:e,movedColumns:r}=this.props;return this.getMemoizedFirstMovableIndex(e,e.columns,r)}getLastMovableIndex(){var{model:e,movedColumns:r}=this.props;return this.getMemoizedLastMovableIndex(e,e.columns,r)}getTreeItems(){var{model:e,movedColumns:r,hiddenColumns:i,columnHeaderGroups:n}=this.props,{selectedColumns:o}=this.state;return this.memoizedGetTreeItems(e.columns,r,n,i,o)}getSelectedParentItems(){var{selectedColumns:e}=this.state,r=ee(this.getTreeItems());return r.filter(i=>{var{id:n,parentId:o}=i;return e.has(n)&&!e.has(o??"")})}render(){var{model:e,hiddenColumns:r,onColumnVisibilityChanged:i}=this.props,{selectedColumns:n,searchFilter:o,prevQueriedColumns:a,queriedColumnIndex:s}=this.state,l=n.size>0,u=this.getTreeItems(),c=new Map(ee(u).map(y=>[y.id,y.data.modelIndex])),h=new Set(r),p=[...new Set(l?[...n.values()].map(y=>c.get(y)).filter(y=>y!=null).flat():u.map(y=>y.data.modelIndex).flat())],v=p.some(y=>!h.has(y)),m=v?"Hide All":"Show All",g=v?"Hide Selected":"Show Selected",f=this.makeVisibilityOrderingList(e.columns,u),b={index:s,next:y=>this.changeSelectedColumn(y)},w=Object.keys(a??{}).length;return d.jsxs("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,children:[d.jsxs("div",{className:"top-menu",children:[d.jsx(M,{kind:"ghost",className:"toggle-visibility-btn",onClick:()=>{i(p,!v)},icon:v?ei:ri,tooltip:"Toggle column visibility",children:l?g:m}),d.jsx(Kt,{className:"visibility-search",value:o,matchCount:o?w:void 0,onChange:this.handleSearchInputChange,cursor:b})]}),d.jsxs("div",{className:"top-menu",children:[d.jsx(M,{kind:"ghost",icon:un,className:"px-1",tooltip:"Reset to default",onClick:()=>{this.resetVisibilityOrdering()},children:"Reset"}),d.jsx("span",{className:"vertical-divider"}),d.jsx(M,{kind:"ghost",icon:Tr,className:"px-1",tooltip:"Sort ascending",onClick:()=>{this.handleSortColumns(z.SORTING_OPTIONS.ASC)}}),d.jsx(M,{kind:"ghost",icon:xr,className:"px-1",tooltip:"Sort descending",onClick:()=>{this.handleSortColumns(z.SORTING_OPTIONS.DSC)}}),d.jsx("span",{className:"vertical-divider"}),d.jsxs(M,{kind:"ghost",className:"px-1",tooltip:"Create group from selection",disabled:!l,onClick:this.handleGroupCreate,children:[d.jsxs("span",{className:"fa-layers",children:[d.jsx(K,{mask:dn,icon:Yt,transform:"right-7 down-5 shrink-6"}),d.jsx(K,{icon:cn,transform:"right-8 down-6 shrink-8"})]}),"Group"]}),d.jsx("span",{className:"vertical-divider"}),d.jsx(M,{kind:"ghost",icon:hn,className:"px-1",tooltip:"Move selection up",onClick:()=>{this.handleMoveColumns(z.MOVE_OPTIONS.UP)},disabled:!l}),d.jsx(M,{kind:"ghost",icon:vn,className:"px-1",tooltip:"Move selection down",onClick:()=>{this.handleMoveColumns(z.MOVE_OPTIONS.DOWN)},disabled:!l}),d.jsx(M,{kind:"ghost",icon:mn,className:"px-1",tooltip:"Move selection to top",onClick:()=>{this.handleMoveColumns(z.MOVE_OPTIONS.TOP)},disabled:!l}),d.jsx(M,{kind:"ghost",icon:pn,className:"px-1",tooltip:"Move selection to bottom",onClick:()=>{this.handleMoveColumns(z.MOVE_OPTIONS.BOTTOM)},disabled:!l})]}),d.jsx("div",{role:"menu",className:V("visibility-ordering-list"),children:d.jsx("div",{className:"column-list",ref:y=>{this.list=y},children:f})})]})}}ne(z,"SORTING_OPTIONS",{DSC:"DSC",ASC:"ASC"});ne(z,"MOVE_OPTIONS",{TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"});function Ya(t,e,r){return(e=Za(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Za(t){var e=Ja(t,"string");return typeof e=="symbol"?e:e+""}function Ja(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ql extends ue{constructor(e){super(850),Ya(this,"irisGrid",void 0),this.irisGrid=e}destroyColumnTooltip(){this.irisGrid.setState({overflowButtonTooltipProps:null})}setCursor(e){return this.isHoveringOverflowButton(e)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition(e){var{x:r,y:i,column:n,row:o}=e;if(n==null||o==null)return null;var{renderer:a,grid:s,state:l,props:u}=this.irisGrid;if(!s)return null;var{metrics:c}=l,{model:h}=u,{canvasContext:p}=s,v=this.irisGrid.getTheme(),m={context:p,mouseX:r,mouseY:i,metrics:c,model:h,theme:v},{left:g,top:f,width:b,height:w}=a.getCellOverflowButtonPosition(m);return g==null||b==null||f==null||w==null?null:{left:g,top:f,width:b,height:w}}isHoveringOverflowButton(e){var r,{x:i,y:n}=e,{left:o,top:a,width:s,height:l}=(r=this.getButtonPosition(e))!==null&&r!==void 0?r:{};if(o==null||s==null||a==null||l==null)return!1;var{renderer:u,grid:c,state:h,props:p}=this.irisGrid;if(!c)return!1;var{metrics:v}=h,{model:m}=p,{canvasContext:g}=c,f=c.getTheme(),b={context:g,mouseX:i,mouseY:n,metrics:v,model:m,theme:f};return u.shouldRenderOverflowButton(b)&&i>=o&&i<=o+s&&n>=a&&n<=a+l}onMove(e){if(this.isHoveringOverflowButton(e)){var{overflowButtonTooltipProps:r}=this.irisGrid.state,i=this.getButtonPosition(e);Ye(r,i)||this.irisGrid.setState({overflowButtonTooltipProps:i})}else this.destroyColumnTooltip();return this.setCursor(e)}onWheel(e){return this.destroyColumnTooltip(),this.onMove(e)}onDown(e){this.destroyColumnTooltip();var{column:r,row:i}=e;return this.isHoveringOverflowButton(e)&&this.irisGrid.setState({showOverflowModal:!0,overflowText:this.irisGrid.getValueForCell(r,i)}),!1}onContextMenu(){return this.destroyColumnTooltip(),!1}onLeave(){return this.destroyColumnTooltip(),!1}}function es(t,e,r){return(e=rs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rs(t){var e=ts(t,"string");return typeof e=="symbol"?e:e+""}function ts(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Xl extends ue{constructor(e){super(),es(this,"irisGrid",void 0),this.irisGrid=e,this.cursor=null}isActive(){var{isSelectingColumn:e}=this.irisGrid.props;return e}isValidColumn(e){if(e==null||e.isProxy===!0)return!1;var{columnSelectionValidator:r}=this.irisGrid.props;return r!=null?r(e):!0}updateColumnSelectionStatus(){var{columnSelectionValidator:e}=this.irisGrid.props;e!=null&&e(null)}getTableColumn(e){if(e==null)return null;var{model:r}=this.irisGrid.props,i=this.irisGrid.getModelColumn(e);return i==null?null:r.columns[i]}onMove(e){if(!this.isActive())return!1;var{columnAllowedCursor:r,columnNotAllowedCursor:i}=this.irisGrid.props,{column:n}=e,o=this.getTableColumn(n);return this.isValidColumn(o)?(this.cursor=r,this.irisGrid.setState({hoverSelectColumn:n})):(this.cursor=i,this.irisGrid.setState({hoverSelectColumn:null})),!0}onWheel(e){if(!this.isActive())return!1;var{columnAllowedCursor:r,columnNotAllowedCursor:i}=this.irisGrid.props,{column:n}=e,o=this.getTableColumn(n);return this.isValidColumn(o)?(this.cursor=r,this.irisGrid.setState({hoverSelectColumn:n})):(this.cursor=i,this.irisGrid.setState({hoverSelectColumn:null})),{preventDefault:!1,stopPropagation:!1}}onLeave(){return this.isActive()&&this.irisGrid.setState({hoverSelectColumn:null}),this.updateColumnSelectionStatus(),!1}onDown(){return this.isActive()}onClick(e){if(!this.isActive())return!1;var{column:r}=e,i=this.getTableColumn(r);return i!=null&&this.isValidColumn(i)&&this.irisGrid.selectColumn(i),!0}}function is(t,e,r){return(e=ns(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ns(t){var e=os(t,"string");return typeof e=="symbol"?e:e+""}function os(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Yl extends ue{constructor(e){super(),is(this,"irisGrid",void 0),this.irisGrid=e}hideColumnTooltip(){var{tooltip:e}=this.irisGrid;e&&(e.stopTimer(),e.hide())}onDown(){return this.hideColumnTooltip(),!1}onContextMenu(){return this.hideColumnTooltip(),!1}onWheel(){return this.hideColumnTooltip(),!1}onLeave(e,r,i){var{relatedTarget:n}=i instanceof MouseEvent?i:i.nativeEvent,{tooltip:o}=this.irisGrid;if(!o)return!1;var a=o.popper.current;return a&&n instanceof Element&&a.element.contains(n)||this.hideColumnTooltip(),!1}onMove(e){var{column:r,row:i,columnHeaderDepth:n}=e,{shownColumnTooltip:o}=this.irisGrid.state,a=null;return r!==null&&i===null&&n===0&&(a=r),a!==o&&this.irisGrid.setState({shownColumnTooltip:a}),!1}}function vi(t,e,r){return(e=as(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function as(t){var e=ss(t,"string");return typeof e=="symbol"?e:e+""}function ss(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class tr extends C.Component{constructor(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tr.defaultProps;super(e),vi(this,"inputRef",void 0),this.handleInputChange=this.handleInputChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.inputRef=vr.createRef()}handleInputChange(){var{onChange:e}=this.props;this.inputRef.current&&e(this.inputRef.current.value)}closeContextMenu(){var{forwardedProps:e}=this.props,{closeMenu:r}=e;r(!0)}revertToDefault(){var{onChange:e}=this.props;e(null)}returnFocusToContextMenu(){var e=fn.getClosestByClassName(this.inputRef.current,"context-menu-container");e instanceof HTMLElement&&e.focus()}handleKeyDown(e){switch(e.key){case"Enter":e.stopPropagation(),this.closeContextMenu();break;case"Escape":e.stopPropagation(),this.revertToDefault(),this.closeContextMenu();break;case"ArrowRight":case"ArrowLeft":e.stopPropagation();break;case"ArrowUp":case"ArrowDown":this.returnFocusToContextMenu();break;default:e.stopPropagation()}}render(){var{formatString:e,forwardedProps:r,placeholder:i,title:n}=this.props,{menuItem:{description:o},iconElement:a}=r;return d.jsxs("div",{className:"form-group flex-grow mb-0",children:[d.jsxs("div",{className:"custom-format-title",children:[d.jsx("span",{className:"icon",children:a}),d.jsxs("label",{className:"title mb-0",htmlFor:"custom-format-input",children:[n,o!=null&&d.jsx(Xe,{children:o})]})]}),d.jsx("div",{className:"pl-2 pr-2 pb-2",children:d.jsx("input",{id:"custom-format-input",className:"form-control text-right mb-0",type:"text",defaultValue:e,ref:this.inputRef,placeholder:i,onKeyDown:this.handleKeyDown,onChange:this.handleInputChange,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"})})]})}}vi(tr,"defaultProps",{formatString:"",forwardedProps:{menuItem:{},closeMenu(t){},iconElement:null},placeholder:"",title:"",onChange(t){}});class ie{static isDefaultSelected(e){return!e||![Qe.TYPE_CONTEXT_CUSTOM,Qe.TYPE_CONTEXT_PRESET].includes(e.type)}static isCustomSelected(e){return e!=null&&e.type===Qe.TYPE_CONTEXT_CUSTOM}static makeOption(e,r,i,n){return{title:e,description:e,group:i,format:r,isSelected:n}}static makeCustomFormatOption(e,r,i,n,o){var a;return{title:e.label,description:e.label,format:e,group:r,isSelected:n,menuElement:d.jsx(tr,{formatString:(a=e.formatString)!==null&&a!==void 0?a:void 0,title:e.label,placeholder:i,onChange:o})}}}function Dr(t,e,r){return(e=ls(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ls(t){var e=us(t,"string");return typeof e=="symbol"?e:e+""}function us(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class X{static getOptions(e,r){var i=new Date,n=[{group:X.dateGroup,formatString:"yyyy-MM-dd"},{group:X.dateGroup,formatString:"MM-dd-yyyy"},{group:X.timeGroup,formatString:"HH:mm:ss"},{group:X.timeGroup,formatString:"HH:mm:ss.SSS"},{group:X.timeGroup,formatString:"HH:mm:ss.SSSSSSSSS"},{group:X.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss"},{group:X.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSS"},{group:X.dateTimeGroup,formatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"}],o=n.map(s=>{var l=Re.makeFormat("",s.formatString,Re.TYPE_CONTEXT_PRESET),u=e.getFormattedString(i,$.dataType.DATETIME,"",l);return ie.makeOption(u,l,s.group,Re.isSameFormat(l,r))}),a=ie.makeOption("Default",null,X.dateGroup,ie.isDefaultSelected(r));return[a,...o]}}Dr(X,"dateGroup",10);Dr(X,"timeGroup",20);Dr(X,"dateTimeGroup",30);function ir(t,e,r){return(e=ds(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ds(t){var e=cs(t,"string");return typeof e=="symbol"?e:e+""}function cs(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Q{static getOptions(e,r,i){var n=[{format:Z.FORMAT_PERCENT,group:Q.presetGroup},{format:Z.FORMAT_BASIS_POINTS,group:Q.presetGroup},{format:Z.FORMAT_THOUSANDS,group:Q.presetGroup},{format:Z.FORMAT_MILLIONS,group:Q.presetGroup},{format:Z.FORMAT_SCIENTIFIC_NOTATION,group:Q.presetGroup},{format:Z.FORMAT_ROUND,group:Q.presetRoundGroup},{format:Z.FORMAT_ROUND_TWO_DECIMALS,group:Q.presetRoundGroup},{format:Z.FORMAT_ROUND_FOUR_DECIMALS,group:Q.presetRoundGroup}],o=ie.makeOption("Default",null,Q.defaultGroup,ie.isDefaultSelected(r)),a=n.map(c=>ie.makeOption(c.format.label,c.format,c.group,Z.isSameFormat(c.format,r))),s=ie.isCustomSelected(r),l=s?r:Z.makeCustomFormat(),u=ie.makeCustomFormatOption(l,Q.customGroup,Z.DEFAULT_FORMAT_STRING,s,c=>{if(c!=null){var h=Z.makeCustomFormat(c);Z.isValid(e,h)&&i(h)}else i(null)});return[o,...a,u]}}ir(Q,"defaultGroup",10);ir(Q,"presetGroup",20);ir(Q,"presetRoundGroup",30);ir(Q,"customGroup",40);function Nr(t,e,r){return(e=hs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hs(t){var e=vs(t,"string");return typeof e=="symbol"?e:e+""}function vs(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ce{static getOptions(e,r,i){var n=[{format:ge.FORMAT_THOUSANDS,group:ce.presetGroup},{format:ge.FORMAT_MILLIONS,group:ce.presetGroup},{format:ge.FORMAT_SCIENTIFIC_NOTATION,group:ce.presetGroup}],o=ie.makeOption("Default",null,ce.defaultGroup,ie.isDefaultSelected(r)),a=n.map(c=>ie.makeOption(c.format.label,c.format,c.group,ge.isSameFormat(c.format,r))),s=ie.isCustomSelected(r),l=s?r:ge.makeCustomFormat(),u=ie.makeCustomFormatOption(l,ce.customGroup,ge.DEFAULT_FORMAT_STRING,s,c=>{if(c!=null){var h=ge.makeCustomFormat(c);ge.isValid(e,h)&&i(h)}else i(null)});return[o,...a,u]}}Nr(ce,"defaultGroup",10);Nr(ce,"presetGroup",20);Nr(ce,"customGroup",30);function Pt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Tt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Pt(Object(r),!0).forEach(function(i){Y(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Pt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function xt(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(u){return void r(u)}s.done?e(l):Promise.resolve(l).then(i,n)}function Dt(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(l){xt(o,i,n,a,s,"next",l)}function s(l){xt(o,i,n,a,s,"throw",l)}a(void 0)})}}function Y(t,e,r){return(e=ms(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ms(t){var e=ps(t,"string");return typeof e=="symbol"?e:e+""}function ps(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Nt=le.module("IrisGridContextMenuHandler"),fs=150,Et="yyyy-MM-dd HH:mm:ss.SSSSSSSSS",ar=1e3;class S extends ue{static getQuickFilterCondition(e,r,i){return e&&i==="&&"?e.and(r):e&&i==="||"?e.or(r):r}static getQuickFilterText(e,r,i){return i&&e!=null?"".concat(e," ").concat(i," ").concat(r):r}static getOperatorAsText(e){return e==="&&"?"And":"Or"}static getRowOptionFormatted(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:30;return"".concat(e,' "').concat(ni.truncate(r,i-e.length-3),'"')}constructor(e,r){super(),Y(this,"irisGrid",void 0),Y(this,"debouncedUpdateCustomFormat",void 0),Y(this,"dh",void 0),this.getNumberValueEqualsFilter=this.getNumberValueEqualsFilter.bind(this),this.getFilterValueForNumberOrChar=this.getFilterValueForNumberOrChar.bind(this),this.debouncedUpdateCustomFormat=jr(e.handleFormatSelection,fs),this.dh=r,this.irisGrid=e}componentWillUnmount(){this.debouncedUpdateCustomFormat.flush()}getHeaderActions(e,r){var{irisGrid:i}=this,{column:n}=r;R(n);var{model:o}=i.props,{columns:a}=o,s=a[e],l=[],{metrics:u,reverse:c,quickFilters:h,advancedFilters:p,searchFilter:v}=i.state,m=i.getTheme();R(u);var{filterIconColor:g,filterBarActiveColor:f,contextMenuSortIconColor:b,contextMenuReverseIconColor:w}=m,y=o.sort,O=$.getSortForColumn(y,s.name),{userColumnWidths:T}=u,D=[...T.values()].some(P=>P===0),E=o.getColumnHeaderParentGroup(e,0)===void 0&&!(ke(o)&&o.hasExpandableRows),I=o.isColumnFrozen(e),j=o.isColumnSortable(e);if(l.push({title:"Hide Column",group:S.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.hideColumnByVisibleIndex(n)}}),l.push({title:I?"Unfreeze Column":"Freeze Column",group:S.GROUP_HIDE_COLUMNS,disabled:!E,action:()=>{I?this.irisGrid.unFreezeColumnByColumnName(s.name):this.irisGrid.freezeColumnByColumnName(s.name)},order:30}),l.push({title:"Show All Columns",group:S.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.showAllColumns()},disabled:!D}),l.push({title:"Resize Column",group:S.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.handleResizeColumn(e)},order:10}),l.push({title:"Resize All Columns",group:S.GROUP_HIDE_COLUMNS,action:()=>{this.irisGrid.handleResizeAllColumns()},order:20}),l.push({title:"Quick Filters",icon:me,iconColor:f,shortcut:_e.TABLE.TOGGLE_QUICK_FILTER,group:S.GROUP_FILTER,order:10,action:()=>{this.irisGrid.toggleFilterBar(n)}}),l.push({title:"Advanced Filters",icon:p.get(e)?gn:bn,iconColor:g,group:S.GROUP_FILTER,order:20,action:()=>{this.irisGrid.handleAdvancedMenuOpened(n)},disabled:!o.isFilterable(e)}),l.push({title:"Clear Table Filters",group:S.GROUP_FILTER,order:40,shortcut:_e.TABLE.CLEAR_FILTERS,action:()=>{this.irisGrid.clearAllFilters()},disabled:!(h.size>0||p.size>0||v!=null)}),l.push({title:"Sort by",icon:me,iconColor:b,group:S.GROUP_SORT,order:10,actions:this.sortByActions(s,e,O),disabled:!j}),l.push({title:"Add Additional Sort",disabled:O&&y.length===1||c&&y.length===1||O&&c&&y.length===2||y.length===0||!j,group:S.GROUP_SORT,order:20,actions:this.additionalSortActions(s,e)}),l.push({title:"Clear Table Sorting",disabled:y.length===0||c&&y.length===1,group:S.GROUP_SORT,action:()=>{this.irisGrid.sortColumn(n,S.COLUMN_SORT_DIRECTION.none)},order:30}),l.push({title:c?"Clear Reverse Table":"Reverse Table",icon:me,iconColor:w,group:S.GROUP_SORT,order:40,disabled:!o.isReversible,shortcut:_e.TABLE.REVERSE,action:()=>{this.irisGrid.reverse(!c)}}),l.push({title:"Copy Column Name",group:S.GROUP_COPY,shortcutText:Ee.isMacPlatform()?"⌥Click":"Alt+Click",action:()=>{var P;Ti((P=o.textForColumnHeader(e))!==null&&P!==void 0?P:"").catch(x=>Nt.error("Unable to copy header",x))}}),$.isDateType(s.type))l.push({title:"Date/Time Format",group:S.GROUP_FORMAT,actions:this.dateFormatActions(s)});else if($.isNumberType(s.type)){var N;l.push({title:"Number Format",group:S.GROUP_FORMAT,actions:(N=this.numberFormatActions(s))!==null&&N!==void 0?N:void 0})}return l}getCellActions(e,r,i){var{irisGrid:n}=this,{column:o,row:a}=i,{model:s,canCopy:l}=n.props,{columns:u}=s,c=n.getModelRow(a);R(c);var h=s.sourceForCell(e,c),{column:p,row:v}=h,m=s.valueForCell(p,v),{selectedRanges:g}=n.state,f=u[p],b=[],w=n.getTheme(),{filterIconColor:y}=w;if(f==null||a==null)return b;if(ke(s)&&s.isRowExpandable(v)){var O=0,T=s.valueForCell(O,v),D=T==null?"null":s.textForCell(O,v);b.push({title:S.getRowOptionFormatted(s.isRowExpanded(v)?"Collapse":"Expand",D),group:S.GROUP_EXPAND_COLLAPSE,order:10,action:()=>{s.setRowExpanded(v,!s.isRowExpanded(v))}}),s.isExpandAllAvailable===!0&&b.push({title:S.getRowOptionFormatted("Expand All in",D),group:S.GROUP_EXPAND_COLLAPSE,order:20,action:()=>{s.setRowExpanded(v,!0,!0)}})}ke(s)&&s.hasExpandableRows&&s.isExpandAllAvailable===!0&&(b.push({title:"Expand Entire Table",group:S.GROUP_EXPAND_COLLAPSE,order:30,action:()=>{s.expandAll()}}),b.push({title:"Collapse Entire Table",group:S.GROUP_EXPAND_COLLAPSE,order:40,action:()=>{s.collapseAll()}}));var E={title:"Go to",iconColor:y,shortcut:_e.TABLE.GOTO_ROW,group:S.GROUP_GOTO,order:10,action:()=>this.irisGrid.toggleGotoRow("".concat(a+1),"".concat(m),f.name)};if(b.push(E),l&&(b.push({title:"Copy Cell",group:S.GROUP_COPY,shortcutText:Ee.isMacPlatform()?"⌥Click":"Alt+Click",order:10,action:()=>{n.copyCell(o,a)}}),b.push({title:"Copy Cell Unformatted",group:S.GROUP_COPY,order:20,action:()=>{n.copyCell(o,a,!0)}})),gr(s)&&s.isEditable){var I=g.every(P=>s.isEditableRange(P)),j=q.containsCell(g,o,a),N=s.isEditableRange(q.makeCell(o,a));(I||!j)&&N&&b.push({title:"Paste",group:S.GROUP_COPY,order:50,action:function(){var P=Dt(function*(){try{var F=yield Di(),G=F.split(`
11
+ `).map(A=>A.split(" "));yield r.pasteValue(G)}catch(A){if(A instanceof Ni)n.handleOpenNoPastePermissionModal("For security reasons your browser does not allow access to your clipboard on click.");else if(A instanceof Ei)n.handleOpenNoPastePermissionModal("Requested clipboard permissions have not been granted, please grant them and try again.");else throw A}});function x(){return P.apply(this,arguments)}return x}()})}return b.push({title:"View Cell Contents",group:S.GROUP_VIEW_CONTENTS,order:10,action:()=>{n.setState({showOverflowModal:!0,overflowText:n.getValueForCell(o,a)})}}),ii(s)&&!s.isPartitionAwareSourceTable&&b.push({title:"View Constituent Table",group:S.GROUP_VIEW_CONTENTS,order:40,action:()=>{n.selectPartitionKeyFromTable(a)}}),b}getCellFilterActions(e,r,i){var n=this;return Dt(function*(){var{dh:o,irisGrid:a}=n,{row:s}=i,{model:l}=a.props,{columns:u}=l,c=a.getModelRow(s),{getSelectedRanges:h}=r;R(c);var p=l.sourceForCell(e,c),{column:v,row:m}=p,g=u[v];if(g==null||s==null)return[];if(!l.isFilterable(v))return[];var{quickFilters:f}=a.state,b=a.getTheme(),{filterIconColor:w}=b,{settings:y}=a.props,O=[...h()];if(O.length===0&&O.push(new q(v,m,v,m)),q.containsCell(O,v,m))for(var T=q.rowCount(O);T>ar;){var D=O.pop();R(D,"Selected ranges should not be empty");var E=q.rowCount([D]);if(yn(E,"Selected ranges should not be unbounded"),T-E<ar){var I;O.push(new q(D.startColumn,D.startRow,D.endColumn,((I=D.endRow)!==null&&I!==void 0?I:0)-(T-ar)));break}T-=E}else O=[new q(v,m,v,m)];Cn(O);for(var j=yield l.snapshot(O),N=new Set,P=0;P<j.length;P+=1)j[P].length===1?j[P][0]!=null&&N.add(j[P][0]):j[P][v]!=null&&N.add(j[P][v]);var x={title:"Filter by Value".concat(N.size>1?"s":""),icon:me,iconColor:w,group:S.GROUP_FILTER,order:10,actions:[]};if(N.size===0)f.get(v)&&x.actions.push({title:"And",actions:n.nullFilterActions(g,f.get(v),"&&"),order:2,group:k.groups.high}),x.actions.push(...n.nullFilterActions(g));else if(N.size===1&&N.has(""))f.get(v)&&x.actions.push({title:"And",actions:n.emptyStringFilterActions(g,f.get(v),"&&"),order:2,group:k.groups.high}),x.actions.push(...n.emptyStringFilterActions(g));else if($.isBooleanType(g.type))f.get(v)&&x.actions.push({title:"Or",actions:n.booleanFilterActions(g,l.textForCell(v,m),f.get(v),"||"),order:2,group:k.groups.high}),x.actions.push(...n.booleanFilterActions(g,l.textForCell(v,m)));else if($.isNumberType(g.type)||$.isCharType(g.type))R(v),f.get(v)&&x.actions.push({title:"And",actions:n.numberFilterActions(g,N,f.get(v),"&&"),order:2,group:k.groups.high}),x.actions.push(...n.numberFilterActions(g,N,f.get(v)));else if($.isDateType(g.type)){var F=new Re(o,{timeZone:y==null?void 0:y.timeZone,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:Et}),G=new Re(o,{timeZone:y==null?void 0:y.timeZone,showTimeZone:y==null?void 0:y.showTimeZone,showTSeparator:y==null?void 0:y.showTSeparator,defaultDateTimeFormatString:Et});f.get(v)&&x.actions.push({title:"And",actions:n.dateFilterActions(g,N,F,G,f.get(v),"&&"),order:2,group:k.groups.high}),x.actions.push(...n.dateFilterActions(g,N,F,G,f.get(v)))}else f.get(v)&&x.actions.push({title:"And",actions:n.stringFilterActions(g,N,f.get(v),"&&"),order:2,group:k.groups.high}),x.actions.push(...n.stringFilterActions(g,N));return[x]})()}getNumberValueEqualsFilter(e,r){var{dh:i}=this,n=e.filter();if(r===Number.POSITIVE_INFINITY)return i.FilterCondition.invoke("isInf",n).and(n.greaterThan(i.FilterValue.ofNumber(0)));if(r===Number.NEGATIVE_INFINITY)return i.FilterCondition.invoke("isInf",n).and(n.lessThan(i.FilterValue.ofNumber(0)));if(Number.isNaN(r))return i.FilterCondition.invoke("isNaN",n);var o=this.getFilterValueForNumberOrChar(e.type,r);return n.eq(o)}getFilterValueForNumberOrChar(e,r){var{dh:i}=this;return $.isCharType(e)?i.FilterValue.ofString(String.fromCharCode(r)):i.FilterValue.ofNumber(r)}onContextMenu(e,r,i){var{irisGrid:n}=this,{y:o,column:a,row:s,columnHeaderDepth:l}=e,u=n.getModelColumn(a),c=n.getModelRow(s),{model:h,canCopy:p}=n.props,{columns:v}=h,{metrics:m,isFilterBarShown:g,quickFilters:f,advancedFilters:b,selectedRanges:w}=n.state,y=Gn.getLatestSelection(w,a,s);R(m);var{columnHeaderHeight:O,gridY:T,columnHeaderMaxDepth:D}=m,E=[];if(u!=null&&c!=null){var I=h.sourceForCell(u,c??0),{column:j,row:N}=I,P=h.valueForCell(j,N),x=h.textForCell(j,N),F=v[j],{onContextMenu:G}=n.props;F!=null&&E.push(...G({model:h,value:P,valueText:x,column:F,rowIndex:s,columnIndex:a,modelRow:c,modelColumn:u}))}if(u!=null){var A=h.getClearFilterRange(u);A!=null&&A.length>0&&E.push({title:A[1]-A[0]>0?"Clear Group Filter":"Clear Column Filter",group:S.GROUP_FILTER,order:30,action:()=>{this.irisGrid.removeColumnFilter(A)},disabled:!Array.from(f.keys()).some(B=>B>=A[0]&&B<=A[1])&&!Array.from(b.keys()).some(B=>B>=A[0]&&B<=A[1])})}return(g?o<=T:o<=O*D&&l===0)?u!=null&&E.push(...this.getHeaderActions(u,e)):(u!=null&&c!=null&&(E.push(...this.getCellActions(u,r,e)),E.push(this.getCellFilterActions(u,r,e))),p&&y.length>0&&(E.push({title:"Copy Selection",shortcut:xi.COPY,group:S.GROUP_COPY,order:30,action:()=>{n.copyRanges(y)}}),E.push({title:"Copy Selection w/ Headers",group:S.GROUP_COPY,order:40,action:()=>{n.copyRanges(y,!0)}})),gr(h)&&h.isEditable&&y.length>0&&Lo(h)&&h.isDeletable&&E.push({title:"Delete Selected Rows",group:S.GROUP_EDIT,disabled:!h.isDeletableRanges(y),order:50,action:()=>{this.irisGrid.deleteRanges(y)}})),E.length===0?!1:(R(n.gridWrapper),k.triggerMenu(n.gridWrapper,i.clientX,i.clientY,E),!0)}dateFormatActions(e){for(var r=this,{model:i}=this.irisGrid.props,{formatter:n}=i,o=n.getColumnFormat(e.type,e.name),a=X.getOptions(n,o),s=[],l=function(){var{description:h,format:p,group:v,isSelected:m,title:g}=a[u];s.push({title:g,description:h,icon:m?fr:void 0,group:v,order:u,action:()=>{var f=i.getColumnIndexByName(e.name);R(f),r.irisGrid.handleFormatSelection(f,p)}})},u=0;u<a.length;u+=1)l();return s}numberFormatActions(e){var r=this,{model:i}=this.irisGrid.props,{formatter:n}=i,{dh:o}=this,a=n.getColumnFormat(e.type,e.name),s,l=i.getColumnIndexByName(e.name);if($.isDecimalType(e.type))s=Q.getOptions(o,a,p=>{R(l),this.debouncedUpdateCustomFormat(l,p)});else if($.isIntegerType(e.type))s=ce.getOptions(o,a,p=>{R(l),this.debouncedUpdateCustomFormat(l,p)});else return Nt.error("Invalid column type in numberFormatActions"),null;for(var u=[],c=function(){var{format:v,isSelected:m}=s[h];u.push(Tt(Tt({},s[h]),{},{icon:m?fr:void 0,order:h,action:()=>{l===void 0&&v&&v.type===Qe.TYPE_CONTEXT_CUSTOM||(R(l),r.irisGrid.handleFormatSelection(l,v))}}))},h=0;h<s.length;h+=1)c();return u}stringFilterActions(e,r,i,n){var{dh:o}=this,a=Array.from(r.keys()),s=a.map(f=>o.FilterValue.ofString(f)),l=s.length===1?s[0]:"the selected values",u=i;u||(u={filter:null,text:null});var{filter:c,text:h}=u,p=[],{model:v}=this.irisGrid.props,m=v.getColumnIndexByName(e.name),g=f=>{var b;return(b=$.escapeQuickTextFilter(f))!==null&&b!==void 0?b:""};return R(m),p.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[n?S.getOperatorAsText(n):""," ",Ke.join(a.slice(0,20).map(f=>'"'.concat(g(f),'"'))),a.length>1&&d.jsxs("div",{className:"iris-grid-filter-menu-subtitle",children:["(",a.length," values selected)"]})]}),order:1,group:k.groups.high}),p.push({title:"text is exactly",description:"Show only rows where ".concat(e.name," is ").concat(l," (case sensitive)"),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,s.map(f=>e.filter().eq(f)).reduce((f,b)=>f.or(b)),n),S.getQuickFilterText(h,a.map(g).join(" || "),n))},order:10,group:k.groups.low}),p.push({title:"text is not exactly",description:"Show only rows where ".concat(e.name," is not ").concat(l," (case sensitive)"),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,s.map(f=>e.filter().notEq(f)).reduce((f,b)=>f.and(b)),n),S.getQuickFilterText(h,a.map(f=>"!=".concat(g(f))).join(" && "),n))},order:20,group:k.groups.low}),p.push({title:"text contains",description:"Show only rows where ".concat(e.name," contains ").concat(l),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,e.filter().isNull().not().and(s.map(f=>e.filter().contains(f)).reduce((f,b)=>f.or(b))),n),S.getQuickFilterText(h,a.map(f=>"~".concat(g(f))).join(" || "),n))},order:30,group:k.groups.low}),p.push({title:"text does not contain",description:"Show only rows where ".concat(e.name," does not contain ").concat(l),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,e.filter().isNull().or(s.map(f=>e.filter().contains(f).not()).reduce((f,b)=>f.and(b))),n),S.getQuickFilterText(h,a.map(f=>"!~".concat(g(f))).join(" && "),n))},order:40,group:k.groups.low}),p.push({title:"text starts with",description:"Show only rows where ".concat(e.name," starts with ").concat(l),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,e.filter().isNull().not().and(s.map(f=>e.filter().invoke("startsWith",f)).reduce((f,b)=>f.or(b))),n),S.getQuickFilterText(h,a.map(f=>"".concat(g(f),"*")).join(" || "),n))},order:50,group:k.groups.low}),p.push({title:"text ends with",description:"Show only rows where ".concat(e.name," ends with ").concat(l),action:()=>{this.irisGrid.setQuickFilter(m,S.getQuickFilterCondition(c,e.filter().isNull().not().and(s.map(f=>e.filter().invoke("endsWith",f)).reduce((f,b)=>f.or(b))),n),S.getQuickFilterText(h,a.map(f=>"*".concat(g(f))).join(" || "),n))},order:60,group:k.groups.low}),p}numberFilterActions(e,r,i,n){var o=Array.from(r.keys()),a=o.length===1?"".concat(o):"the selected values",s=y=>$.isCharType(e.type)?String.fromCharCode(y):"".concat(y),l=null,u=null;i&&(l=i.filter,u=i.text);var c=[],{model:h}=this.irisGrid.props,p=h.getColumnIndexByName(e.name);if(R(p),c.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[n?S.getOperatorAsText(n):""," ",Ke.join(o.slice(0,20).map(y=>'"'.concat(s(y),'"'))),o.length>1&&d.jsxs("div",{className:"iris-grid-filter-menu-subtitle",children:["(",o.length," values selected)"]})]}),order:1,group:k.groups.high}),c.push({title:"is equal to",description:"Show only rows where ".concat(e.name," is ").concat(a),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,o.map(y=>this.getNumberValueEqualsFilter(e,y)).reduce((y,O)=>y.or(O)),n),S.getQuickFilterText(u,o.map(y=>"=".concat(s(y))).join(" || "),n))},order:10,group:k.groups.low}),c.push({title:"is not equal to",description:"Show only rows where ".concat(e.name," is not ").concat(a),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,o.map(y=>this.getNumberValueEqualsFilter(e,y).not()).reduce((y,O)=>y.and(O)),n),S.getQuickFilterText(u,o.map(y=>"!=".concat(s(y))).join(" && "),n))},order:20,group:k.groups.low}),!r.has(Number.NaN)&&!r.has(Number.POSITIVE_INFINITY)&&!r.has(Number.NEGATIVE_INFINITY)&&!$.isCharType(e.type)){var v=o.reduce((y,O)=>y>O?y:O),m=o.reduce((y,O)=>y<O?y:O),g=this.getFilterValueForNumberOrChar(e.type,v),f=this.getFilterValueForNumberOrChar(e.type,m),b="".concat(g),w="".concat(f);c.push({title:"greater than",description:"Show only rows where ".concat(e.name," is greater than ").concat(b),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,e.filter().greaterThan(g),n),S.getQuickFilterText(u,">".concat(s(v)),n))},order:30,group:k.groups.low}),c.push({title:"greater than or equal to",description:"Show only rows where ".concat(e.name," is greater than or equal to ").concat(b),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,e.filter().greaterThanOrEqualTo(g),n),S.getQuickFilterText(u,">=".concat(s(v)),n))},order:40,group:k.groups.low}),c.push({title:"less than",description:"Show only rows where ".concat(e.name," is less than ").concat(w),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,e.filter().lessThan(f),n),S.getQuickFilterText(u,"<".concat(s(m)),n))},order:50,group:k.groups.low}),c.push({title:"less than or equal to",description:"Show only rows where ".concat(e.name," is less than or equal to ").concat(w),action:()=>{this.irisGrid.setQuickFilter(p,S.getQuickFilterCondition(l,e.filter().lessThanOrEqualTo(f),n),S.getQuickFilterText(u,"<=".concat(s(m)),n))},order:60,group:k.groups.low})}return c}booleanFilterActions(e,r,i,n){var o=[],{model:a}=this.irisGrid.props,{filter:s,text:l}=i||{},u=a.getColumnIndexByName(e.name);return R(u),o.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[n?S.getOperatorAsText(n):""," ",'"',r??"null",'"']}),order:1,group:k.groups.high}),o.push({title:"true",description:"Show only rows where ".concat(e.name," is true"),action:()=>{this.irisGrid.setQuickFilter(u,S.getQuickFilterCondition(s,e.filter().isTrue(),n),S.getQuickFilterText(l,"true",n))},order:10,group:k.groups.low}),o.push({title:"false",description:"Show only rows where ".concat(e.name," is false"),action:()=>{this.irisGrid.setQuickFilter(u,S.getQuickFilterCondition(s,e.filter().isFalse(),n),S.getQuickFilterText(l,"false",n))},order:20,group:k.groups.low}),o.push({title:"is null",description:"Show only rows where ".concat(e.name," is null"),action:()=>{this.irisGrid.setQuickFilter(u,S.getQuickFilterCondition(s,e.filter().isNull(),n),S.getQuickFilterText(l,"null",n))},order:30,group:k.groups.low}),o.push({title:"is not null",description:"Show only rows where ".concat(e.name," is not null"),action:()=>{this.irisGrid.setQuickFilter(u,S.getQuickFilterCondition(s,e.filter().isNull().not(),n),S.getQuickFilterText(l,"!null",n))},order:40,group:k.groups.low}),o}dateFilterActions(e,r,i,n,o,a){var{dh:s}=this,l=Array.from(r.keys()),u=l.map(I=>s.FilterValue.ofNumber(I)),c=u.length===1?n.format(l[0]):"the selected values",h=l.reduce((I,j)=>I>j?I:j),p=l.reduce((I,j)=>I<j?I:j),v=s.FilterValue.ofNumber(h),m=s.FilterValue.ofNumber(p),g=i.format(h),f=i.format(p),b=n.format(h),w=n.format(p),y=null,O=null;o&&(y=o.filter,O=o.text);var{model:T}=this.irisGrid.props,D=T.getColumnIndexByName(e.name);R(D);var E=[];return E.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[a?S.getOperatorAsText(a):""," ",Ke.join(l.slice(0,20).map(I=>'"'.concat(n.format(I),'"'))),l.length>1&&d.jsxs("div",{className:"iris-grid-filter-menu-subtitle",children:["(",l.length," values selected)"]})]}),order:1,group:k.groups.high}),E.push({title:"date is",description:"Show only rows where ".concat(e.name," is ").concat(c),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,u.map(I=>e.filter().eq(I)).reduce((I,j)=>I.or(j)),a),S.getQuickFilterText(O,l.map(I=>"=".concat(i.format(I))).join(" || "),a))},order:10,group:k.groups.low}),E.push({title:"date is not",description:"Show only rows where ".concat(e.name," is not ").concat(c),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,u.map(I=>e.filter().notEq(I)).reduce((I,j)=>I.and(j)),a),S.getQuickFilterText(O,l.map(I=>"!=".concat(i.format(I))).join(" && "),a))},order:20,group:k.groups.low}),E.push({title:"date is before",description:"Show only rows where ".concat(e.name," is before ").concat(w),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,e.filter().lessThan(m),a),S.getQuickFilterText(O,"<".concat(f),a))},order:30,group:k.groups.low}),E.push({title:"date is before or equal",description:"Show only rows where ".concat(e.name," is before or equal to ").concat(w),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,e.filter().lessThanOrEqualTo(m),a),S.getQuickFilterText(O,"<=".concat(f),a))},order:40,group:k.groups.low}),E.push({title:"date is after",description:"Show only rows where ".concat(e.name," is greater than ").concat(b),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,e.filter().greaterThan(v),a),S.getQuickFilterText(O,">".concat(g),a))},order:50,group:k.groups.low}),E.push({title:"date is after or equal",description:"Show only rows where ".concat(e.name," is after or equal to ").concat(b),action:()=>{this.irisGrid.setQuickFilter(D,S.getQuickFilterCondition(y,e.filter().greaterThanOrEqualTo(v),a),S.getQuickFilterText(O,">=".concat(g),a))},order:60,group:k.groups.low}),E}emptyStringFilterActions(e,r,i){var{dh:n}=this,o=n.FilterValue.ofString(""),a=r;a||(a={filter:null,text:null});var{filter:s,text:l}=a,u=[],{model:c}=this.irisGrid.props,h=c.getColumnIndexByName(e.name);return R(h),u.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[i?S.getOperatorAsText(i):""," ",d.jsx("i",{className:"text-muted",children:"empty"})]}),order:1,group:k.groups.high}),u.push({title:"is empty string",description:"Show only rows where ".concat(e.name," is empty"),action:()=>{this.irisGrid.setQuickFilter(h,S.getQuickFilterCondition(s,e.filter().eq(o),i),S.getQuickFilterText(l,"=",i))},order:10,group:k.groups.low}),u.push({title:"is not empty string",description:"Show only rows where ".concat(e.name," is not empty"),action:()=>{this.irisGrid.setQuickFilter(h,S.getQuickFilterCondition(s,e.filter().notEq(o),i),S.getQuickFilterText(l,"!=",i))},order:20,group:k.groups.low}),u}nullFilterActions(e,r,i){var n=null,o=null;r&&(n=r.filter,o=r.text);var a=[],{model:s}=this.irisGrid.props,l=s.getColumnIndexByName(e.name);return R(l),a.push({menuElement:d.jsxs("div",{className:"iris-grid-filter-menu-item-value",children:[i?S.getOperatorAsText(i):""," ",d.jsx("i",{className:"text-muted",children:"null"})]}),order:1,group:k.groups.high}),a.push({title:"is null",description:"Show only rows where ".concat(e.name," is null"),action:()=>{this.irisGrid.setQuickFilter(l,S.getQuickFilterCondition(n,e.filter().isNull(),i),S.getQuickFilterText(o,"null",i))},order:10,group:k.groups.low}),a.push({title:"is not null",description:"Show only rows where ".concat(e.name," is not null"),action:()=>{this.irisGrid.setQuickFilter(l,S.getQuickFilterCondition(n,e.filter().isNull().not(),i),S.getQuickFilterText(o,"!null",i))},order:20,group:k.groups.low}),a}sortByActions(e,r,i){var n=this.irisGrid.getTheme(),{contextMenuSortIconColor:o}=n,a=[{title:"".concat(e.name," Ascending"),order:10,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.ascending)},icon:this.checkColumnSort(i,S.COLUMN_SORT_DIRECTION.ascending)?me:void 0,iconColor:o},{title:"".concat(e.name," Descending"),order:20,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.descending)},icon:this.checkColumnSort(i,S.COLUMN_SORT_DIRECTION.descending)?me:void 0,iconColor:o},{title:"Remove Sort",order:50,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.none,!1,!0)},disabled:!i}];return $.isNumberType(e.type)&&(a.push({title:"ABS(".concat(e.name,") Ascending"),order:30,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.ascending,!0)},icon:this.checkColumnSort(i,S.COLUMN_SORT_DIRECTION.ascending,!0)?me:void 0,iconColor:o}),a.push({title:"ABS(".concat(e.name,") Descending"),order:40,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.descending,!0)},icon:this.checkColumnSort(i,S.COLUMN_SORT_DIRECTION.descending,!0)?me:void 0,iconColor:o})),a}additionalSortActions(e,r){var i=this.irisGrid.getTheme(),{contextMenuSortIconColor:n}=i,o=[{title:"Add Sort By",menuElement:d.jsxs("div",{className:"btn-context-menu menu-title",children:[d.jsx("span",{className:"icon",children:d.jsx(K,{icon:me,style:{color:n??void 0}})}),d.jsx("span",{className:"title",children:"Add Additional Sort"}),d.jsx("span",{className:"shortcut",children:Ee.isMacPlatform()?"⌘Click":"Ctrl+Click"})]}),order:1},{title:"".concat(e.name," Ascending"),order:10,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.ascending,!1,!0)}},{title:"".concat(e.name," Descending"),order:20,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.descending,!1,!0)}}];return $.isNumberType(e.type)&&(o.push({title:"ABS(".concat(e.name,") Ascending"),order:30,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.ascending,!0,!0)}}),o.push({title:"ABS(".concat(e.name,") Descending"),order:40,action:()=>{this.irisGrid.sortColumn(r,S.COLUMN_SORT_DIRECTION.descending,!0,!0)}})),o}checkColumnSort(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return e?e.direction===r&&e.isAbs===i:!1}}Y(S,"GROUP_EDIT",k.groups.high+10);Y(S,"GROUP_HIDE_COLUMNS",k.groups.high+25);Y(S,"GROUP_FILTER",k.groups.high+50);Y(S,"GROUP_EXPAND_COLLAPSE",k.groups.high+55);Y(S,"GROUP_GOTO",k.groups.high+60);Y(S,"GROUP_SORT",k.groups.high+75);Y(S,"GROUP_COPY",k.groups.high+100);Y(S,"GROUP_FORMAT",k.groups.high+150);Y(S,"GROUP_VIEW_CONTENTS",k.groups.high+175);Y(S,"COLUMN_SORT_DIRECTION",{ascending:"ASC",descending:"DESC",none:null});function gs(t,e,r){return(e=bs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bs(t){var e=ys(t,"string");return typeof e=="symbol"?e:e+""}function ys(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Zl extends ue{constructor(e){super(250),gs(this,"irisGrid",void 0),this.irisGrid=e,this.cursor=null}onClick(e,r,i){return i.altKey&&!Ee.isModifierKeyDown(i)&&!i.shiftKey?(this.cursor=null,e.columnHeaderDepth!==void 0?this.irisGrid.copyColumnHeader(e.column,e.columnHeaderDepth):this.irisGrid.copyRanges([q.makeCell(e.column,e.row)]),!0):!1}onMove(e,r,i){return i.altKey&&!Ee.isModifierKeyDown(i)&&!i.shiftKey&&e.column!=null&&(e.row!=null||e.columnHeaderDepth!=null)?(this.cursor=this.irisGrid.props.copyCursor,!0):!1}}function Cs(t,e,r){return(e=Ss(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ss(t){var e=ws(t,"string");return typeof e=="symbol"?e:e+""}function ws(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Jl extends ue{constructor(e){super(880),Cs(this,"irisGrid",void 0),this.irisGrid=e}onDoubleClick(e,r){var{column:i,row:n}=e;return n==null||i==null||this.irisGrid.selectData(i,n),!1}}function Os(t,e,r){return(e=js(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function js(t){var e=Ps(t,"string");return typeof e=="symbol"?e:e+""}function Ps(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class eu extends ue{constructor(e){super(),Os(this,"irisGrid",void 0),this.irisGrid=e}onDown(e){var{y:r,column:i,row:n}=e;if(i!==null&&n===null){var{isFilterBarShown:o,metrics:a}=this.irisGrid.state;if(!a)throw new Error("Metrics not set");var{columnHeaderMaxDepth:s}=a,l=this.irisGrid.getTheme();if(o&&l.columnHeaderHeight!=null&&l.filterBarHeight!=null&&r>l.columnHeaderHeight*s&&r<=l.columnHeaderHeight*s+l.filterBarHeight)return this.irisGrid.focusFilterBar(i),!0}return!1}onMove(e){var{y:r,column:i}=e,{isFilterBarShown:n,hoverAdvancedFilter:o,metrics:a}=this.irisGrid.state;if(!a)throw new Error("Metrics not set");var{columnHeaderMaxDepth:s}=a,l=this.irisGrid.getTheme(),u=null;return n&&l.columnHeaderHeight!=null&&l.filterBarHeight!=null&&i!==null&&r>=l.columnHeaderHeight*s&&r<=l.columnHeaderHeight*s+l.filterBarHeight&&(u=i),u!==o&&this.irisGrid.setState({hoverAdvancedFilter:u}),!1}onLeave(e){var{column:r}=e,{hoverAdvancedFilter:i}=this.irisGrid.state;return i!==null&&r!==i&&this.irisGrid.setState({hoverAdvancedFilter:null}),!1}}function Ts(t,e,r){return(e=xs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function xs(t){var e=Ds(t,"string");return typeof e=="symbol"?e:e+""}function Ds(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ru extends ue{constructor(e){super(750),Ts(this,"irisGrid",void 0),this.irisGrid=e}destroyTooltip(){this.irisGrid.setState({expandCellTooltipProps:null})}setCursor(e,r){return Lr.isInTreeBox(e,r)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}getButtonPosition(e){var{x:r,y:i,column:n,row:o}=e;if(n==null||o==null)return null;var{renderer:a,grid:s,state:l,props:u}=this.irisGrid;if(!s)return null;var{metrics:c}=l,{model:h}=u,{canvasContext:p}=s,v=s.getTheme(),m={context:p,mouseX:r,mouseY:i,metrics:c,model:h,theme:v},g=ke(h)?h.depthForRow(o):null,{left:f,top:b,width:w,height:y}=a.getExpandButtonPosition(m,g);return f==null||w==null||b==null||y==null?null:{left:f,top:b,width:w,height:y}}onMove(e,r){if(Lr.isInTreeBox(e,r)){var{expandCellTooltipProps:i}=this.irisGrid.state,{model:n}=this.irisGrid.props,o=this.getButtonPosition(e),{row:a}=e;R(a);var s=ke(n)&&n.isRowExpanded(a);Ye(i,o)||this.irisGrid.setState({expandCellTooltipProps:o,expandTooltipDisplayValue:s?"collapse":"expand"})}else this.destroyTooltip();return this.setCursor(e,r)}onDown(){return this.destroyTooltip(),!1}onContextMenu(){return this.destroyTooltip(),!1}onWheel(){return this.destroyTooltip(),!1}onLeave(){return this.destroyTooltip(),!1}}function It(t,e,r){return(e=Ns(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ns(t){var e=Es(t,"string");return typeof e=="symbol"?e:e+""}function Es(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class tu extends ue{constructor(e){super(),It(this,"irisGrid",void 0),It(this,"column",void 0),this.column=null,this.irisGrid=e}getColumnFromGridPoint(e){var{column:r,row:i,columnHeaderDepth:n}=e;return r!==null&&i===null&&n===0?r:null}onDown(e){return this.column=this.getColumnFromGridPoint(e),!1}onClick(e,r,i){var n=this.getColumnFromGridPoint(e);if(n!=null&&n===this.column){var o=Ee.isModifierKeyDown(i);return this.irisGrid.toggleSort(n,o),!0}return!1}}class iu extends ue{constructor(e){super(),this.irisGrid=e}onWheel(e,r,i){var{irisGrid:n}=this,{model:o}=n.props,{metrics:a,pendingRowCount:s}=n.state;R(a);var{bottom:l,rowCount:u,rowHeight:c}=a,{deltaY:h}=U.getScrollDelta(i);return gr(o)&&o.isEditable&&l>=u-1&&h>0&&n.setState({pendingRowCount:s+Math.ceil(h/c)}),!1}}function sr(t,e,r){return(e=Is(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Is(t){var e=Rs(t,"string");return typeof e=="symbol"?e:e+""}function Rs(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class nu extends Mn{constructor(e){super(),sr(this,"irisGrid",void 0),sr(this,"lastColumn",void 0),sr(this,"lastRow",void 0),this.irisGrid=e,this.lastColumn=null,this.lastRow=null}destroyTooltip(){this.irisGrid.setState({hoverTooltipProps:null})}setCursor(e,r){return this.isHoveringLink(e,r)?(this.cursor="pointer",{stopPropagation:!1,preventDefault:!1}):(this.cursor=null,!1)}onMove(e,r){var{model:i}=this.irisGrid.props,n=this.isHoveringLink(e,r),o=i.tooltipForCell(e.column,e.row);if(n&&this.currentLinkBox!=null&&Wn(this.currentLinkBox.token)){var{hoverTooltipProps:a}=this.irisGrid.state,{x1:s,y1:l,x2:u,y2:c}=this.currentLinkBox,{href:h}=this.currentLinkBox.token,p=u-s,v=c-l,m={left:s,top:l+1,width:p,height:v};Ye(a,m)||this.irisGrid.setState({hoverTooltipProps:m,hoverDisplayValue:d.jsxs(d.Fragment,{children:[h," - Click once to follow.",d.jsx("br",{}),"Click and hold to select this cell."]})})}else if(o!==null){var{hoverTooltipProps:g}=this.irisGrid.state,f={left:e.x,top:e.y+1,width:1,height:1};Ye(g,f)||(g==null?this.irisGrid.setState({hoverTooltipProps:f,hoverDisplayValue:o}):(this.lastColumn!==e.column||this.lastRow!==e.row)&&this.irisGrid.setState({hoverTooltipProps:null},()=>this.irisGrid.setState({hoverTooltipProps:f,hoverDisplayValue:o})))}else this.destroyTooltip();return this.lastColumn=e.column,this.lastRow=e.row,this.setCursor(e,r)}onDown(){return this.destroyTooltip(),!1}onContextMenu(){return this.destroyTooltip(),!1}onWheel(){return this.destroyTooltip(),!1}onLeave(){return this.destroyTooltip(),!1}}function ks(t,e,r){return(e=As(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function As(t){var e=Fs(t,"string");return typeof e=="symbol"?e:e+""}function Fs(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ou extends ue{constructor(e){super(878),ks(this,"irisGrid",void 0),this.irisGrid=e}onDoubleClick(e,r){var{column:i,row:n}=e,{irisGrid:o}=this,{model:a}=o.props,{partitionConfig:s}=o.state;return n==null||i==null||!ii(a)||s==null||s.mode!=="keys"?!1:(this.irisGrid.selectPartitionKeyFromTable(n),!0)}}class au extends Ln{getGridY(e){var r=super.getGridY(e),{isFilterBarShown:i,theme:n,advancedFilters:o,quickFilters:a,sorts:s,reverse:l}=e;return i?r+=n.filterBarHeight:(a!=null&&a.size>0||o!=null&&o.size>0)&&(r+=n.filterBarCollapsedHeight),l&&s!=null&&s.length>0&&(r+=n.reverseHeaderBarHeight),r}getUserColumnWidths(){return this.userColumnWidths}getCalculatedColumnWidths(){return this.calculatedColumnWidths}}var Gs=new Map([["sortUp",Sn],["sortDown",Mr],["caretDown",Mr],["caretRight",wn],["cellOverflow",On]]),Ms=oi((t,e)=>{var r=Gs.get(t);if(r===void 0)throw new Error("Icon is undefined");var i=Array.isArray(r.icon[4])?r.icon[4][0]:r.icon[4],n=new Path2D(i),o=new Path2D,a={a:e/r.icon[0],d:e/r.icon[1]};return o.addPath(n,a),o},{max:1e3});function Ae(t,e){return Ms(t,e)}class mi{static drawTreeMarker(e,r,i,n,o,a,s){e.save();var{theme:l}=r,{iconSize:u}=l,{x1:c,x2:h,y1:p,y2:v}=o,m=Ae(s?"caretDown":"caretRight",u),g=i+(c+h)/2-u/2,f=n+(v-p-u)/2;e.fillStyle=a,e.textAlign="center",e.translate(g,f),e.fill(m),e.restore()}}class Ls extends _n{drawCellContent(e,r,i,n){var o,{metrics:a,model:s}=r,{modelColumns:l,modelRows:u}=a,c=oe(u,n),h=l.get(i);if(h!==void 0){var p=s.valueForCell(h,c);if($.isTextType((o=s.columns[h])===null||o===void 0?void 0:o.type)&&(p===null||p==="")){var v=e.font;e.font="italic ".concat(v),super.drawCellContent(e,r,i,n),e.font=v;return}super.drawCellContent(e,r,i,n)}}getTextRenderMetrics(e,r,i){var n=U.getTextRenderMetrics(e,r,i),{mouseX:o,mouseY:a,metrics:s,theme:l}=e;if(o==null||a==null)return n;var{column:u,row:c}=U.getGridPointFromXY(o,a,s);if(r===u&&i===c){var{left:h}=this.getCellOverflowButtonPosition(o,a,s,l);this.shouldRenderOverflowButton(e)&&h!=null&&(n.width=h-s.gridX-n.x)}return n}getCellOverflowButtonPosition(e,r,i,n){var o={left:null,top:null,width:null,height:null};if(e==null||r==null||i==null)return o;var{rowHeight:a,columnWidth:s,left:l,top:u}=U.getCellInfoFromXY(e,r,i);if(l==null||s==null||u==null)return o;var{width:c,verticalBarWidth:h}=i,{cellHorizontalPadding:p,iconSize:v}=n,m=v+2*p,g=a,f=Math.min(i.gridX+l+s,c-h),b=f-m,w=i.gridY+u;return{left:b,top:w,width:m,height:g}}shouldRenderOverflowButton(e){var r,{context:i,mouseX:n,mouseY:o,metrics:a,model:s,theme:l}=e;if(n==null||o==null)return!1;var{row:u,column:c,modelRow:h,modelColumn:p}=U.getCellInfoFromXY(n,o,a);if(u==null||c==null||h==null||p==null||!$.isStringType(s.columns[p].type))return!1;var v=(r=s.textForCell(p,h))!==null&&r!==void 0?r:"",{width:m}=U.getTextRenderMetrics(e,c,u),g=a.fontWidthsLower.get(l.font),f=a.fontWidthsUpper.get(l.font);i.save(),i.font=l.font;var b=this.getCachedTruncatedString(i,v,m,g,f,s.truncationCharForCell(p,h));return i.restore(),v!==""&&b!==v}drawTreeMarker(e,r,i,n,o,a,s){mi.drawTreeMarker(e,r,i,n,o,a,s)}}class _s extends Un{drawTreeMarker(e,r,i,n,o,a,s){mi.drawTreeMarker(e,r,i,n,o,a,s)}}function Rt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function kt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Rt(Object(r),!0).forEach(function(i){yr(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Rt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function yr(t,e,r){return(e=Us(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Us(t){var e=$s(t,"string");return typeof e=="symbol"?e:e+""}function $s(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var lr=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),At=10;class Cr extends ni{constructor(){super(...arguments),yr(this,"textCellRenderer",new Ls),yr(this,"dataBarCellRenderer",new _s)}static isFilterValid(e,r){var i=e==null||e.filter!=null,n=r==null||r.filter!=null;return i&&n}getSortIcon(e,r){return e?e.direction===$.sortDirection.ascending?Ae(lr.SORT_UP,r):e.direction===$.sortDirection.descending?Ae(lr.SORT_DOWN,r):null:null}drawCanvas(e){super.drawCanvas(e),this.drawScrim(e)}drawGrid(e,r){super.drawGrid(e,r),this.drawCellOverflowButton(r)}drawGridLines(e,r){super.drawGridLines(e,r),this.drawGroupedColumnLine(e,r),this.drawPendingRowLine(e,r)}drawCellContent(e,r,i,n){var{metrics:o,model:a}=r,{modelColumns:s,modelRows:l}=o,u=s.get(i),c=oe(l,n);if(u!==void 0){var h=a.renderTypeForCell(u,c),p=this.getCellRenderer(h);p.drawCellContent(e,r,i,n)}}getCellOverflowButtonPosition(e){var{mouseX:r,mouseY:i,metrics:n,theme:o}=e;return this.textCellRenderer.getCellOverflowButtonPosition(r,i,n,o)}shouldRenderOverflowButton(e){return this.textCellRenderer.shouldRenderOverflowButton(e)}drawCellOverflowButton(e){var{context:r,mouseX:i,mouseY:n,theme:o}=e;if(!(i==null||n==null)&&this.shouldRenderOverflowButton(e)){var{left:a,top:s,width:l,height:u}=this.getCellOverflowButtonPosition(e),{cellHorizontalPadding:c,overflowButtonColor:h,overflowButtonHoverColor:p,iconSize:v}=o;r.save(),p!=null&&a!=null&&l!=null&&s!=null&&u!=null&&i>=a&&i<=a+l&&n>=s&&n<=s+u?r.fillStyle=p:h!=null&&(r.fillStyle=h);var m=Ae(lr.CELL_OVERFLOW,v);a!=null&&s!=null&&u!=null&&r.translate(a+c,s+(u-v)/2),r.fill(m),r.restore()}}drawGroupedColumnLine(e,r){var{metrics:i,model:n,theme:o}=r,{groupedColumns:a}=n,{maxY:s,allColumnWidths:l,allColumnXs:u}=i;if(!(a.length===0||o.groupedColumnDividerColor==null)){var c=a.length-1,h=u.get(c),p=l.get(c);if(!(h==null||p==null)){var v=h+p+.5;e.strokeStyle=o.groupedColumnDividerColor,e.lineWidth=1,e.beginPath(),e.moveTo(v,0),e.lineTo(v,s),e.stroke()}}}drawPendingRowLine(e,r){var{metrics:i,model:n,theme:o}=r,{allRowYs:a,maxX:s}=i,{pendingRowCount:l}=n;if(!(l<=0)){var u=n.rowCount-n.pendingRowCount-n.floatingBottomRowCount,c=a.get(u);c!=null&&(c-=.5,e.save(),e.setLineDash([4,2]),e.strokeStyle=o.pendingTextColor,e.lineWidth=1,e.beginPath(),e.moveTo(0,c),e.lineTo(s,c),e.stroke(),e.restore())}}drawMouseColumnHover(e,r){var{theme:i,metrics:n,hoverSelectColumn:o}=r;if(!(o==null||i.linkerColumnHoverBackgroundColor==null)){var{allColumnWidths:a,allColumnXs:s,maxY:l}=n,u=oe(s,o),c=oe(a,o);e.fillStyle=i.linkerColumnHoverBackgroundColor,e.fillRect(u,0,c,l)}}drawMouseRowHover(e,r){var{isSelectingColumn:i}=r;i||super.drawMouseRowHover(e,r)}drawScrim(e){var{context:r,loadingScrimProgress:i,metrics:n,theme:o}=e;if(i!=null){var{width:a,height:s,gridY:l}=n,{scrimBlurSize:u,scrimColor:c}=o;r.save(),r.globalCompositeOperation="color",r.filter="blur(".concat(u,"px)"),c!=null&&(r.fillStyle=c),r.beginPath(),r.rect(0,l,a,s-l),r.clip(),r.fillRect(-u,-u+l,u*2+a,(u*2+(s-l))*i),r.globalCompositeOperation="source-over",r.filter="blur(".concat(u,"px) opacity(15%)"),r.fillRect(-u,-u+l,u*2+a,(u*2+(s-l))*i),r.restore()}}drawColumnHeaders(e,r){super.drawColumnHeaders(e,r);var{theme:i,metrics:n,model:o,reverse:a}=r,{columnHeaderHeight:s}=n;if(this.drawFilterHeaders(e,r),!(s<=0)){var{sort:l}=o;if(l.length===1){var u;a?u=i.headerReverseBarColor:u=i.headerSortBarColor,this.drawHeaderBar(e,r,u,a?i.reverseHeaderBarHeight:i.sortHeaderBarHeight)}else l.length>1&&(a&&this.drawHeaderBar(e,r,i.headerReverseBarColor,i.reverseHeaderBarHeight,!1),this.drawHeaderBar(e,r,i.headerSortBarColor,i.sortHeaderBarHeight))}}drawHeaderBar(e,r,i,n){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,{theme:a,metrics:s,model:l}=r,{columnHeaderHeight:u,width:c}=s,h=0;o||(h=n),e.fillStyle=a.headerBarCasingColor,e.fillRect(0,l.columnHeaderMaxDepth*u-n-2+h,c,n+2),e.fillStyle=i,e.fillRect(0,l.columnHeaderMaxDepth*u-n-1+h,c,n)}drawColumnHeadersAtDepth(e,r,i,n,o){var{metrics:a,model:s,isMenuShown:l,theme:u}=r,{columnHeaderMaxDepth:c}=s,{width:h}=a,{columnHeaderHeight:p}=u,v=kt(kt({},n),{},{maxX:o===c-1&&n.maxX===h?h-(l?0:p):n.maxX});super.drawColumnHeadersAtDepth(e,r,i,v,o)}drawColumnHeaderAtIndex(e,r,i,n){var o;super.drawColumnHeaderAtIndex(e,r,i,n);var{metrics:a,model:s,theme:l}=r,{modelColumns:u,allColumnWidths:c,allColumnXs:h,gridX:p,columnHeaderHeight:v}=a,{headerHorizontalPadding:m,iconSize:g}=l,f=Math.round(g*.75),b=oe(c,i,0),w=oe(h,i)+p,y=u.get(i);if(y!=null){var O=(o=s.columns[y])===null||o===void 0?void 0:o.name;if(O!=null){var T=$.getSortForColumn(s.sort,O);if(T){var D=this.getSortIcon(T,f);if(D){var E=s.textForColumnHeader(y);if(E!==void 0){var I=this.getCachedHeaderWidth(e,E),j=p+w+I+m,{maxX:N}=n;N-=m;var P=p+w+b-f,x=j>N?j+1:Math.min(N,P),F=(v-f)*.5;e.save(),e.beginPath(),e.rect(w,0,b,v),e.clip(),e.fillStyle=l.headerSortBarColor,e.translate(x,F),e.fill(D),e.restore()}}}}}}drawFilterHeaders(e,r){var{isFilterBarShown:i,quickFilters:n,advancedFilters:o}=r;i?this.drawExpandedFilterHeaders(e,r):(n!=null&&n.size>0||o!=null&&o.size>0)&&this.drawCollapsedFilterHeaders(e,r)}drawExpandedFilterHeaders(e,r){var{metrics:i,model:n,theme:o,quickFilters:a,advancedFilters:s}=r,{filterBarHeight:l}=o;if(!(l<=0)){var{gridX:u,gridY:c,maxX:h,modelColumns:p,visibleColumns:v,allColumnWidths:m,allColumnXs:g}=i,f=c-l;e.save(),e.font=o.filterBarFont,e.textAlign="left",a!=null&&a.size>0||s!=null&&s.size>0?e.fillStyle=o.filterBarExpandedActiveBackgroundColor:e.fillStyle=o.filterBarExpandedBackgroundColor,e.fillRect(u,f,h,l-1),e.fillStyle=o.headerBarCasingColor,e.fillRect(u,f+l-1,h,1);var b=f;e.strokeStyle=o.filterBarSeparatorColor,e.beginPath();for(var w=0;w<v.length;w+=1){var y=v[w],O=oe(p,y),T=oe(g,y),D=oe(m,y);if(n.isFilterable(O)&&D>0){var E=u+(T??0);e.rect(E+.5,b+.5,D,l-2)}}e.stroke();for(var I=0;I<v.length;I+=1){var j=v[I],N=oe(m,j),P=oe(g,j),x=P+u;this.drawExpandedFilterHeader(e,r,j,x,N)}e.restore()}}drawExpandedFilterHeader(e,r,i,n,o){if(!(o<=0)){var{metrics:a,theme:s,quickFilters:l,advancedFilters:u}=r,{modelColumns:c,gridY:h}=a,{filterBarHeight:p,filterBarExpandedActiveCellBackgroundColor:v,filterBarErrorColor:m,filterBarHorizontalPadding:g,headerColor:f}=s,b=h-p,w=c.get(i);if(w!==void 0){var y=l.get(w),O=u.get(w);if(!(y==null&&O==null)){var T=null;if(y!=null){var{text:D}=y;if(T=D,T||(T=$.getFilterText(y.filter)),T!=null){var{fontWidthsLower:E,fontWidthsUpper:I}=a,j=E.get(e.font),N=I.get(e.font),P=o-g*2;T=this.textCellRenderer.getCachedTruncatedString(e,T,P,j,N)}}e.save();var x=Cr.isFilterValid(O,y);if(x&&v!=null)e.fillStyle=v,e.fillRect(n+1,b+1,o-1,p-3);else if(m!=null){e.fillStyle=m,e.lineWidth=2,e.strokeStyle=m;var F=n+2,G=b+2,A=o-3,B=p-5;e.strokeRect(F,G,A,B)}if(T!=null&&T!==""){var H=n+g,W=b+p*.5+1;e.fillStyle=f,e.fillText(T,H,W)}e.restore()}}}}drawCollapsedFilterHeaders(e,r){var{metrics:i,theme:n}=r,{headerSeparatorColor:o,filterBarCollapsedHeight:a}=n;if(!(a<=0)){var{gridX:s,gridY:l,maxX:u,visibleColumns:c,allColumnWidths:h,allColumnXs:p}=i,v=l-a;e.save(),e.fillStyle=o,e.fillRect(s,v,u,a);for(var m=0;m<c.length;m+=1){var g=c[m],f=h.get(g),b=p.get(g);if(b!=null&&f!=null){var w=b+s;this.drawCollapsedFilterHeader(e,r,g,w,f)}}e.restore()}}drawCollapsedFilterHeader(e,r,i,n,o){if(!(o<=0)){var{metrics:a,theme:s,quickFilters:l,advancedFilters:u}=r,{modelColumns:c,gridY:h}=a,p=c.get(i);if(p!==void 0){var v=l.get(p),m=u.get(p),{filterBarCollapsedHeight:g,filterBarActiveColor:f,filterBarActiveBackgroundColor:b,filterBarErrorColor:w}=s;e.save();var y=Cr.isFilterValid(m,v);b!=null&&v==null&&m==null?e.fillStyle=b:f!=null&&y?e.fillStyle=f:w!=null&&(e.fillStyle=w);var O=n+1,T=h-g,D=o-1,E=g-1;e.fillRect(O,T,D,E),e.restore()}}}drawRowFooters(e,r){var{metrics:i,model:n,mouseX:o,mouseY:a,theme:s}=r,{gridY:l,gridX:u,maxX:c,modelRows:h,floatingTopHeight:p,floatingBottomHeight:v,floatingRows:m,rowFooterWidth:g,height:f,horizontalBarHeight:b,verticalBarWidth:w,allRowHeights:y,allRowYs:O,width:T}=i;if(!(g<=0||m.length===0)){var{cellHorizontalPadding:D,floatingGridRowColor:E,floatingRowBackgroundColors:I,headerColor:j,rowHoverBackgroundColor:N}=s;e.translate(u,l),e.beginPath();var P=Math.min(c,T-g-w-u);e.fillStyle=I,p>0&&e.rect(P,0,g,p),v>0&&e.rect(P,f-l-b-v,g,v),e.fill();var x=o!=null&&a!=null&&o>=u&&o<=c+g?U.getRowAtY(a,i):null;if(N!=null&&x!==null&&m.includes(x)){e.fillStyle=N;var F=O.get(x),G=y.get(x);R(F),R(G),e.fillRect(P,F,g,G)}if(e.beginPath(),E!=null&&(e.strokeStyle=E),p>0&&(e.moveTo(P+.5,.5),e.lineTo(P+.5,p-.5)),v>0){var A=f-l-b-v;e.moveTo(P-.5,A+.5),e.lineTo(P-.5,A+v-.5)}e.stroke(),e.fillStyle=j,e.textAlign="left";for(var B=P+D,H=0;H<m.length;H+=1){var W=m[H],ve=y.get(W),Me=O.get(W),Le=h.get(W);if(Me!=null&&ve!=null&&Le!=null){var Ci=Me+ve*.5;e.fillText(n.textForRowFooter(Le),B,Ci)}}e.translate(-u,-l)}}getExpandButtonPosition(e,r){var{mouseX:i,mouseY:n,metrics:o,theme:a}=e,s={left:null,top:null,width:null,height:null};if(i==null||n==null||r==null||!o)return s;var{rowHeight:l,left:u,top:c}=U.getCellInfoFromXY(i,n,o);R(u),R(l),R(c);var{cellHorizontalPadding:h}=a,p=At+2*h,v=Math.max(u+At*r,o.gridX),m=o.gridY+c;return{left:v,top:m,width:p,height:l}}}const Bs="12px Fira Sans, sans-serif",Hs="var(--dh-color-white)",Ws="var(--dh-color-black)",Ft={"grid-bg":"var(--dh-color-grid-bg)",font:Bs,white:Hs,black:Ws,"header-bg":"var(--dh-color-grid-header-bg)","header-color":"var(--dh-color-grid-header-text)","header-height":"30px","header-separator-color":"var(--dh-color-grid-header-separator)","header-separator-hover-color":"var(--dh-color-grid-header-separator-hover)","header-hidden-separator-hover-color":"var(--dh-color-grid-header-separator-hidden-hover)","header-sort-bar-color":"var(--dh-color-grid-header-sort-bar)","header-reverse-bar-color":"var(--dh-color-grid-header-reverse-bar)","header-bar-casing-color":"var(--dh-color-grid-header-bar-casing)","header-font":"600 12px Fira Sans, sans-serif","row-height":"19px","row-background-colors":"var(--dh-color-grid-row-0-bg) var(--dh-color-grid-row-1-bg)","active-cell-selection-border-width":"2px","selection-color":"var(--dh-color-grid-selection)","selection-outline-color":"var(--dh-color-grid-selection-outline)","selection-outline-casing-color":"var(--dh-color-grid-selection-outline-casing)","row-hover-bg":"var(--dh-color-grid-row-hover-bg)","row-shadow-alpha":"var(--dh-color-grid-row-shadow-alpha)","selected-row-hover-bg":"var(--dh-color-grid-row-hover-bg-selected)","scroll-bar-active-selection-tick-color":"var(--dh-color-grid-scroll-bar-active-selection-tick)","scroll-bar-bg":"var(--dh-color-grid-scroll-bar-bg)","scroll-bar-hover-bg":"var(--dh-color-grid-scroll-bar-hover-bg)","scroll-bar-casing-color":"var(--dh-color-grid-scroll-bar-casing)","scroll-bar-corner-color":"var(--dh-color-grid-scroll-bar-corner)","scroll-bar-color":"var(--dh-color-grid-scroll-bar)","scroll-bar-hover-color":"var(--dh-color-grid-scroll-bar-hover)","scroll-bar-active-color":"var(--dh-color-grid-scroll-bar-active)","text-color":"var(--dh-color-grid-text)","hyperlink-color":"var(--dh-color-grid-text-hyperlink)","positive-number-color":"var(--dh-color-grid-number-positive)","negative-number-color":"var(--dh-color-grid-number-negative)","zero-number-color":"var(--dh-color-grid-number-zero)","date-color":"var(--dh-color-grid-date)","pending-text-color":"var(--dh-color-grid-text-pending)","error-text-color":"var(--dh-color-grid-text-error)","null-string-color":"var(--dh-color-grid-string-null)","filter-bar-active-bg":"var(--dh-color-grid-filter-bar-active-bg)","filter-bar-active-color":"var(--dh-color-grid-filter-bar-active)","filter-bar-expanded-bg":"var(--dh-color-grid-filter-bar-expanded-bg)","filter-bar-expanded-active-bg":"var(--dh-color-grid-filter-bar-expanded-active-bg)","filter-bar-expanded-active-cell-bg":"var(--dh-color-grid-filter-bar-expanded-active-cell-bg)","filter-bar-separator-color":"var(--dh-color-grid-filter-bar-separator)","filter-bar-error-color":"var(--dh-color-grid-filter-bar-error)","filter-icon-color":"var(--dh-color-grid-filter-icon)","scrim-color":"var(--dh-color-grid-scrim)","context-menu-sort-icon-color":"var(--dh-color-grid-context-menu-sort-icon)","context-menu-reverse-icon-color":"var(--dh-color-grid-context-menu-reverse-icon)","linker-column-hover-bg":"var(--dh-color-grid-column-linker-hover-bg)","tree-line-color":"var(--dh-color-grid-tree-line)","tree-marker-color":"var(--dh-color-grid-tree-marker)","tree-marker-hover-color":"var(--dh-color-grid-tree-marker-hover)","grouped-column-divider-color":"var(--dh-color-grid-column-grouped-divider)","floating-grid-row-color":"var(--dh-color-grid-floating-row)","floating-row-background-colors":"var(--dh-color-grid-floating-row-bg)","floating-divider-inner-color":"var(--dh-color-grid-floating-divider-inner)","floating-divider-outer-color":"var(--dh-color-grid-floating-divider-outer)","overflow-button-color":"var(--dh-color-grid-overflow-button)","overflow-button-hover-color":"var(--dh-color-grid-overflow-button-hover)","zero-line-color":"var(--dh-color-grid-data-bar-zero-line)","positive-bar-color":"var(--dh-color-grid-data-bar-positive)","negative-bar-color":"var(--dh-color-grid-data-bar-negative)","marker-bar-color":"var(--dh-color-grid-data-bar-marker)"};function Gt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Mt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Gt(Object(r),!0).forEach(function(i){zs(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Gt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function zs(t,e,r){return(e=Vs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Vs(t){var e=Ks(t,"string");return typeof e=="symbol"?e:e+""}function Ks(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Lt=le.module("IrisGridTheme");function Qs(){var t,e=jn(Ft);return e["row-background-colors"]=Pn((t=e["row-background-colors"])!==null&&t!==void 0?t:"").map(r=>{var[i,n]=r;return Tn.normalizeCssColor(e["row-background-colors"].substring(i,n+1))}).join(" "),Lt.debug2("Iris grid theme:",Ft),Lt.debug2("Iris grid theme derived:",e),Object.freeze(Mt(Mt({},$n),{},{backgroundColor:e["grid-bg"],white:e.white,black:e.black,font:e.font,filterBarFont:e.font,headerBackgroundColor:e["header-bg"],headerColor:e["header-color"],headerSeparatorColor:e["header-separator-color"],headerSeparatorHoverColor:e["header-separator-hover-color"],headerHiddenSeparatorHoverColor:e["header-hidden-separator-hover-color"],headerSortBarColor:e["header-sort-bar-color"],headerReverseBarColor:e["header-reverse-bar-color"],headerBarCasingColor:e["header-bar-casing-color"],headerFont:e["header-font"],rowBackgroundColors:e["row-background-colors"],rowHoverBackgroundColor:e["row-hover-bg"],selectionColor:e["selection-color"],selectionOutlineColor:e["selection-outline-color"],selectionOutlineCasingColor:e["selection-outline-casing-color"],selectedRowHoverBackgroundColor:e["selected-row-hover-bg"],scrollBarBackgroundColor:e["scroll-bar-bg"],scrollBarHoverBackgroundColor:e["scroll-bar-hover-bg"],scrollBarCasingColor:e["scroll-bar-casing-color"],scrollBarCornerColor:e["scroll-bar-corner-color"],scrollBarColor:e["scroll-bar-color"],scrollBarHoverColor:e["scroll-bar-hover-color"],scrollBarActiveColor:e["scroll-bar-active-color"],scrollBarSelectionTickColor:e["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:e["scroll-bar-active-selection-tick-color"],textColor:e["text-color"],hyperlinkColor:e["hyperlink-color"],positiveNumberColor:e["positive-number-color"],negativeNumberColor:e["negative-number-color"],zeroNumberColor:e["zero-number-color"],dateColor:e["date-color"],pendingTextColor:e["pending-text-color"],errorTextColor:e["error-text-color"],nullStringColor:e["null-string-color"],filterBarActiveBackgroundColor:e["filter-bar-active-bg"],filterBarExpandedBackgroundColor:e["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:e["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:e["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:e["filter-bar-separator-color"],filterBarActiveColor:e["filter-bar-active-color"],filterBarErrorColor:e["filter-bar-error-color"],filterIconColor:e["filter-icon-color"],scrimColor:e["scrim-color"],contextMenuSortIconColor:e["context-menu-sort-icon-color"],contextMenuReverseIconColor:e["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:e["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(e["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:90,columnHeaderHeight:parseInt(e["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,iconSize:16,activeCellSelectionBorderWidth:parseInt(e["active-cell-selection-border-width"],10)||2,shadowAlpha:parseFloat(e["row-shadow-alpha"])||.15,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:e["linker-column-hover-bg"],treeLineColor:e["tree-line-color"],treeMarkerColor:e["tree-marker-color"],treeMarkerHoverColor:e["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:e["floating-grid-row-color"],floatingRowBackgroundColors:e["floating-row-background-colors"],floatingDividerInnerColor:e["floating-divider-inner-color"],floatingDividerOuterColor:e["floating-divider-outer-color"],overflowButtonColor:e["overflow-button-color"],overflowButtonHoverColor:e["overflow-button-hover-color"],zeroLineColor:e["zero-line-color"],positiveBarColor:e["positive-bar-color"],negativeBarColor:e["negative-bar-color"],markerBarColor:e["marker-bar-color"],density:{compact:{cellHorizontalPadding:5,headerHorizontalPadding:10,minColumnWidth:10,rowHeight:16,font:"11px Fira Sans, sans-serif",iconSize:14,columnHeaderHeight:26},spacious:{cellHorizontalPadding:7,headerHorizontalPadding:15,rowHeight:28}}}))}var _t=le.module("useTableListener"),pi=(t,e,r)=>C.useEffect(function(){if(t==null){_t.debug2("Emitter undefined, skipping addEventListener",e);return}return _t.debug2("Adding listener",e),t.addEventListener(e,r)},[t,e,r]);function fi(t,e){return e==null?t.columns[0]:t.findColumn(e)}function gi(t,e,r){return r==null?e:t.findColumn(r)}function qs(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:String(t)}function Xs(t,e){return String(t)}function Ys(t){var{table:e,descriptionColumnName:r,iconColumnName:i,keyColumnName:n,labelColumnName:o,formatValue:a=Xs}=t,s=C.useMemo(()=>e==null?null:fi(e,n),[n,e]),l=C.useMemo(()=>e==null||s==null?null:gi(e,s,o),[s,o,e]),u=C.useMemo(()=>e==null||r==null?null:e.findColumn(r),[r,e]),c=C.useMemo(()=>e==null||i==null?null:e.findColumn(i),[i,e]),h=C.useCallback(p=>{R(s,"keyColumn cannot be null."),R(l,"labelColumn cannot be null.");var v=qs(p.get(s)),m=a(p.get(l),l.type),g=u==null?void 0:a(p.get(u),u.type),f=c==null?void 0:p.get(c);return{key:v,content:m,textValue:m,description:g,icon:f}},[u,a,c,s,l]);return h}function Zs(t){var e=rr(),r=C.useMemo(()=>{var s=Vn(e,t);return Vt(s),s},[e,t]),{getColumnFormat:i,getColumnFormatMapForType:n,getColumnTypeFormatter:o,getFormattedString:a}=r;return{getColumnFormat:i,getColumnFormatMapForType:n,getColumnTypeFormatter:o,getFormattedString:a,timeZone:r.timeZone}}function bi(){var t=rr();return C.useMemo(()=>new $(t),[t])}function Ut(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(u){return void r(u)}s.done?e(l):Promise.resolve(l).then(i,n)}function Js(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(l){Ut(o,i,n,a,s,"next",l)}function s(l){Ut(o,i,n,a,s,"throw",l)}a(void 0)})}}function el(t){var{columnName:e,value:r,table:i}=t,n=bi();return C.useCallback(Js(function*(){if(i==null||r==null||e==null)return null;var o=i.findColumn(e),a=n.getValueType(o.type),s=yield i.seekRow(0,o,a,r);return s===-1?null:s}),[e,i,n,r])}function yi(t){var[,e]=C.useState(0),r=rr(),i=C.useCallback(()=>{e(n=>n+1)},[]);return pi(t,r.Table.EVENT_SIZECHANGED,i),Qt(t)}var rl=le.module("useInitializeViewportData");function tl(t){var{items:e,targetSize:r,reuseExistingItems:i}=t,n=e.length;return n===r?e:(rl.debug("size changed:",{currentSize:n,targetSize:r}),i?n>r?e.slice(0,r):[...e,...Er(n,r-1)]:Array.from(Er(0,r-1)))}function il(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=Qn({}),i=Math.max(0,yi(t));return C.useEffect(()=>{r.setItems(tl({items:r.items,targetSize:i,reuseExistingItems:e}))},[i,t]),r}function nl(t,e,r){return C.useCallback(function(n){var[o,a]=Ii(n,e,r,Qt(t));t==null||t.setViewport(o,a)},[t,r,e])}var ol=150,al=200,sl=250,ll=500,ur=le.module("useViewportData");function ul(t){var{table:e,itemHeight:r=1,scrollDebounce:i=ol,viewportSize:n=10,viewportPadding:o=50,deserializeRow:a=ki,reuseItemsOnTableResize:s=!1}=t,l=C.useRef(0),u=il(e,s),c=nl(e,n,o),h=C.useCallback(w=>{l.current=w,e&&!hr(e)?c(w):ur.debug("setViewport called on closed table.",e)},[e,c]),p=C.useCallback(w=>{e&&!hr(e)?(e.applyFilter(w),h(0)):ur.debug("applyFiltersAndRefresh called on closed table.",e)},[h,e]),v=rr(),m=C.useRef();m.current=C.useMemo(()=>Ri(u,a),[a,u]);var g=C.useCallback(w=>{var y;(y=m.current)===null||y===void 0||y.call(m,w)},[]);pi(e,v.Table.EVENT_UPDATED,g);var f=yi(e);C.useEffect(()=>{ur.debug("Initializing viewport"),h(0)},[e,h]),C.useEffect(()=>{h(l.current)},[h,f]);var b=Kn(r,h,i);return C.useMemo(()=>({viewportData:u,size:f,table:e,applyFiltersAndRefresh:p,setViewport:h,onScroll:b}),[p,b,h,f,e,u])}function dl(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return C.useMemo(()=>Ai(...r.map(n=>n(t))),[t,...r])}function cl(t,e){var{applyFiltersAndRefresh:r}=t;C.useEffect(()=>{r(e)},[r,e])}var hl=["additionalFilterConditionFactories","searchColumnNames","timeZone"];function $t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function dr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?$t(Object(r),!0).forEach(function(i){vl(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$t(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function vl(t,e,r){return(e=ml(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ml(t){var e=pl(t,"string");return typeof e=="symbol"?e:e+""}function pl(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fl(t,e){if(t==null)return{};var r,i,n=gl(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function gl(t,e){if(t==null)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;r[i]=t[i]}return r}function bl(t){var{additionalFilterConditionFactories:e=[],searchColumnNames:r,timeZone:i}=t,n=fl(t,hl),o=bi(),[a,s]=C.useState(""),l=C.useMemo(()=>Fi(o,r,a,i),[r,a,o,i]),u=Gi(s,al),c=ul(dr({itemHeight:In,viewportSize:ll,viewportPadding:sl},n)),h=dl(c.table,l,...e);return cl(c,h),dr(dr({},c),{},{onSearchTextChange:u})}function yl(t){C.useEffect(()=>()=>{t!=null&&(hr(t)||t.close())},[t])}var Cl=["table","keyColumn","labelColumn","iconColumn","settings","onChange","onSelectionChange"];function Bt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Ht(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Bt(Object(r),!0).forEach(function(i){Sl(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Bt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Sl(t,e,r){return(e=wl(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wl(t){var e=Ol(t,"string");return typeof e=="symbol"?e:e+""}function Ol(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Wt(t,e,r,i,n,o,a){try{var s=t[o](a),l=s.value}catch(u){return void r(u)}s.done?e(l):Promise.resolve(l).then(i,n)}function jl(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(l){Wt(o,i,n,a,s,"next",l)}function s(l){Wt(o,i,n,a,s,"throw",l)}a(void 0)})}}function Pl(t,e){if(t==null)return{};var r,i,n=Tl(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Tl(t,e){if(t==null)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(e.indexOf(i)!==-1)continue;r[i]=t[i]}return r}var xl=le.module("jsapi-components.usePickerProps");function Dl(t){var e,{table:r,keyColumn:i,labelColumn:n,iconColumn:o,settings:a,onChange:s,onSelectionChange:l}=t,u=Pl(t,Cl),{itemHeight:c}=Rn(),{getFormattedString:h,timeZone:p}=Zs(a),v=u.selectedKey===void 0,[m,g]=C.useState(u.defaultSelectedKey),{data:f}=kn($.copyTableAndApplyFilters,[r]);yl(f);var b=C.useMemo(()=>f==null?null:fi(f,i),[i,f]),w=C.useMemo(()=>f==null||b==null?null:gi(f,b,n),[b,n,f]),y=C.useMemo(()=>w==null?[]:[w.name],[w]),O=Ys({table:f,iconColumnName:o,keyColumnName:i,labelColumnName:n,formatValue:h}),T=el({table:f,columnName:(e=b==null?void 0:b.name)!==null&&e!==void 0?e:null,value:v?m:u.selectedKey}),D=C.useCallback(jl(function*(){var x=yield T();return x==null?null:x*c+An}),[T,c]),{onScroll:E,onSearchTextChange:I,setViewport:j,viewportData:N}=bl({reuseItemsOnTableResize:!0,table:f,itemHeight:c,deserializeRow:O,searchColumnNames:y,timeZone:p});C.useEffect(function(){var F=!1;return T().then(G=>{G==null||F||j(G)}).catch(G=>{xl.error("Error setting viewport from selected key",G)}),()=>{F=!0}},[T,a,j]);var P=C.useCallback(x=>{var F;v&&g(x),(F=s??l)===null||F===void 0||F(x)},[v,s,l]);return Ht(Ht({},u),{},{normalizedItems:N.items,showItemIcons:o!=null,getInitialScrollPosition:D,onChange:P,onScroll:E,onSearchTextChange:I})}function zt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Nl(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?zt(Object(r),!0).forEach(function(i){El(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zt(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function El(t,e,r){return(e=Il(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Il(t){var e=Rl(t,"string");return typeof e=="symbol"?e:e+""}function Rl(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function su(t){var e=Dl(t);return d.jsx(Bn,Nl({},e))}var kl=C.createContext({theme:null,density:"regular"});function lu(t){var{children:e,density:r="regular"}=t,{activeThemes:i}=Mi(),n=C.useMemo(()=>Qs(),[i]),o=C.useMemo(()=>({theme:n,density:r}),[n,r]);return d.jsx(kl.Provider,{value:o,children:e})}export{te as $,zl as A,Yl as B,de as C,S as D,Zl as E,Vl as F,Jl as G,eu as H,ai as I,au as J,ou as K,Cr as L,ru as M,tu as N,kl as O,su as P,lu as Q,nu as R,al as S,po as T,Ql as U,ll as V,iu as W,yo as X,re as Y,Oo as Z,L as _,Kn as a,z as a0,Qs as a1,Lo as a2,Qn as b,pi as c,qn as d,Dl as e,Zs as f,Ys as g,ul as h,bi as i,yl as j,dl as k,cl as l,sl as m,el as n,il as o,bl as p,nl as q,yi as r,Wl as s,ao as t,Hl as u,Oe as v,Kl as w,co as x,ql as y,Xl as z};
12
+ //# sourceMappingURL=IrisGridThemeProvider-F_cBGwMh.js.map