react-open-source-grid 1.2.4 → 1.2.6
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.
|
@@ -37,12 +37,12 @@ use chrome, FireFox or Internet Explorer 11`)}var a=e(`safe-buffer`),o=e(`random
|
|
|
37
37
|
`,n.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,n.NAME_CHAR=`-`+n.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,n.CHAR_RE=RegExp(`^[`+n.CHAR+`]$`,`u`),n.S_RE=RegExp(`^[`+n.S+`]+$`,`u`),n.NAME_START_CHAR_RE=RegExp(`^[`+n.NAME_START_CHAR+`]$`,`u`),n.NAME_CHAR_RE=RegExp(`^[`+n.NAME_CHAR+`]$`,`u`),n.NAME_RE=RegExp(`^[`+n.NAME_START_CHAR+`][`+n.NAME_CHAR+`]*$`,`u`),n.NMTOKEN_RE=RegExp(`^[`+n.NAME_CHAR+`]+$`,`u`);function r(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}n.S_LIST=[32,10,13,9],n.isChar=function(e){return e>=32&&e<=55295||e===10||e===13||e===9||e>=57344&&e<=65533||e>=65536&&e<=1114111},n.isS=function(e){return e===32||e===10||e===13||e===9},n.isNameStartChar=r,n.isNameChar=function(e){return r(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}},{}],544:[function(e,t,n){Object.defineProperty(n,`__esModule`,{value:!0}),n.CHAR=`--�𐀀-`,n.RESTRICTED_CHAR=`-\b\v\f---`,n.S=` \r
|
|
38
38
|
`,n.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,n.NAME_CHAR=`-`+n.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,n.CHAR_RE=RegExp(`^[`+n.CHAR+`]$`,`u`),n.RESTRICTED_CHAR_RE=RegExp(`^[`+n.RESTRICTED_CHAR+`]$`,`u`),n.S_RE=RegExp(`^[`+n.S+`]+$`,`u`),n.NAME_START_CHAR_RE=RegExp(`^[`+n.NAME_START_CHAR+`]$`,`u`),n.NAME_CHAR_RE=RegExp(`^[`+n.NAME_CHAR+`]$`,`u`),n.NAME_RE=RegExp(`^[`+n.NAME_START_CHAR+`][`+n.NAME_CHAR+`]*$`,`u`),n.NMTOKEN_RE=RegExp(`^[`+n.NAME_CHAR+`]+$`,`u`);function r(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}n.S_LIST=[32,10,13,9],n.isChar=function(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111},n.isRestrictedChar=function(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159},n.isCharAndNotRestricted=function(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111},n.isS=function(e){return e===32||e===10||e===13||e===9},n.isNameStartChar=r,n.isNameChar=function(e){return r(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}},{}],545:[function(e,t,n){function r(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}Object.defineProperty(n,`__esModule`,{value:!0}),n.NC_NAME_START_CHAR=`A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,n.NC_NAME_CHAR=`-`+n.NC_NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,n.NC_NAME_START_CHAR_RE=RegExp(`^[`+n.NC_NAME_START_CHAR+`]$`,`u`),n.NC_NAME_CHAR_RE=RegExp(`^[`+n.NC_NAME_CHAR+`]$`,`u`),n.NC_NAME_RE=RegExp(`^[`+n.NC_NAME_START_CHAR+`][`+n.NC_NAME_CHAR+`]*$`,`u`),n.isNCNameStartChar=r,n.isNCNameChar=function(e){return r(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}},{}]},{},[15])(15)}))}))(),1);const Vn=(e,t,n=`export.csv`)=>{let r=t.map(e=>e.headerName),i=e.map(e=>t.map(t=>{let n=e[t.field];if(n==null)return``;let r=String(n);return r.includes(`,`)||r.includes(`
|
|
39
39
|
`)||r.includes(`"`)?`"${r.replace(/"/g,`""`)}"`:r}).join(`,`)),a=[r.join(`,`),...i].join(`
|
|
40
|
-
`);Wn(new Blob([a],{type:`text/csv;charset=utf-8;`}),n)},Hn=async(e,t,n={})=>{let{filename:r=`export.xlsx`,styling:i=`basic`}=n,a=new Bn.default.Workbook,o=a.addWorksheet(`Sheet1`),s=t.map(e=>e.headerName);o.addRow(s),e.forEach(e=>{let n=t.map(t=>e[t.field]??``);o.addRow(n)}),o.columns=t.map(t=>{let n=t.headerName.length,r=Math.max(...e.map(e=>String(e[t.field]??``).length)),i=Math.max(n,r)+2;return{width:Math.min(i,50)}}),i===`professional`&&Un(o,t);let c=await a.xlsx.writeBuffer();Wn(new Blob([c],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}),r)};var Un=(e,t)=>{let n=e.getRow(1);n.font={bold:!0,color:{argb:`FFFFFFFF`},size:11},n.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:`FF2F5496`}},n.alignment={horizontal:`center`,vertical:`middle`,wrapText:!0},n.height=20,e.eachRow((e,t)=>{e.eachCell(e=>{e.border={top:{style:`thin`,color:{argb:`FFD3D3D3`}},left:{style:`thin`,color:{argb:`FFD3D3D3`}},bottom:{style:`thin`,color:{argb:`FFD3D3D3`}},right:{style:`thin`,color:{argb:`FFD3D3D3`}}},t>1&&t%2==0&&(e.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:`FFF2F2F2`}}),t>1&&(e.alignment={horizontal:`left`,vertical:`middle`})})}),e.views=[{state:`frozen`,ySplit:1}]},Wn=(e,t)=>{let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)};const Gn=(e,t)=>{let n=new Date().toISOString().replace(/[:.]/g,`-`).slice(0,-5);return`data_export_${t===`all`?`full`:t}_${n}.${e}`},Kn=async(e,t,n)=>{if(e.length===0){alert(`No data to export`);return}let r=n.filename||Gn(n.format,n.scope);n.format===`csv`?Vn(e,t,r):n.format===`xlsx`&&await Hn(e,t,{filename:r,styling:n.styling})},qn=({columns:e,fullDataset:t,filteredData:n,selectedRows:r,currentPageData:i,onExport:a})=>{let[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(`csv`),[u,d]=(0,b.useState)(`filtered`),[f,p]=(0,b.useState)(`basic`),[m,h]=(0,b.useState)(null),g=b.useRef(null),_=()=>{switch(u){case`all`:return t;case`filtered`:return n;case`selected`:return r.size>0?n.filter(e=>r.has(e.id)):[];case`page`:return i;default:return n}},v=()=>{let t=_();if(t.length===0){alert(`No ${u===`selected`?`selected`:u} data to export`);return}Kn(t,e,{format:c,scope:u,styling:c===`xlsx`?f:void 0}),a?.(!0),s(!1)},y=[{value:`all`,label:`Full Dataset`,disabled:!1},{value:`filtered`,label:`Filtered Data`,disabled:n.length===0},{value:`selected`,label:`Selected Rows (${r.size})`,disabled:r.size===0},{value:`page`,label:`Current Page`,disabled:i.length===0}];return(0,Z.jsxs)(`div`,{style:{position:`relative`},children:[(0,Z.jsxs)(`button`,{ref:g,onClick:()=>{if(!o){let e=g.current?.getBoundingClientRect();e&&h(e)}s(!o)},style:{padding:`8px 12px`,backgroundColor:`#2563eb`,color:`white`,borderRadius:`6px`,border:`none`,fontSize:`14px`,fontWeight:`500`,display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,transition:`background-color 0.2s`},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`#1d4ed8`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`#2563eb`},title:`Export data to CSV or XLSX format`,children:[(0,Z.jsx)(`svg`,{style:{width:`16px`,height:`16px`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 19l9 2-9-18-9 18 9-2m0 0v-8m0 8l-6-4m6 4l6-4`})}),`Export`]}),o&&m&&(0,Z.jsxs)(`div`,{style:{position:`fixed`,left:`${m.left}px`,top:`${m.bottom+8}px`,backgroundColor:`#ffffff`,border:`1px solid #e5e7eb`,borderRadius:`8px`,boxShadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05)`,zIndex:50,padding:`20px`,width:`420px`,minWidth:`420px`,maxWidth:`420px`,maxHeight:`90vh`,overflowY:`auto`},children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`20px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`14px`,fontWeight:`600`,color:`#1f2937`,marginBottom:`12px`},children:`Format`}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`16px`},children:[(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`},children:[(0,Z.jsx)(`input`,{type:`radio`,name:`format`,value:`csv`,checked:c===`csv`,onChange:e=>l(e.target.value),style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`14px`,color:`#374151`},children:`CSV`})]}),(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`},children:[(0,Z.jsx)(`input`,{type:`radio`,name:`format`,value:`xlsx`,checked:c===`xlsx`,onChange:e=>l(e.target.value),style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`14px`,color:`#374151`},children:`XLSX (Excel)`})]})]})]}),(0,Z.jsxs)(`div`,{style:{marginBottom:`20px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`14px`,fontWeight:`600`,color:`#1f2937`,marginBottom:`12px`},children:`Data Scope`}),(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`},children:y.map(e=>(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`10px`,padding:`10px 12px`,borderRadius:`6px`,cursor:e.disabled?`not-allowed`:`pointer`,opacity:e.disabled?.5:1,backgroundColor:`transparent`,transition:`background-color 0.15s`,userSelect:`none`},onMouseEnter:t=>{e.disabled||(t.currentTarget.style.backgroundColor=`#f3f4f6`)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`transparent`},children:[(0,Z.jsx)(`input`,{type:`radio`,name:`scope`,value:e.value,checked:u===e.value,onChange:e=>d(e.target.value),disabled:e.disabled,style:{width:`16px`,height:`16px`,cursor:e.disabled?`not-allowed`:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`14px`,color:`#374151`},children:e.label})]},e.value))})]}),c===`xlsx`&&(0,Z.jsxs)(`div`,{style:{marginBottom:`20px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`14px`,fontWeight:`600`,color:`#1f2937`,marginBottom:`12px`},children:`Styling`}),(0,Z.jsx)(`div`,{style:{marginBottom:`10px`},children:(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`16px`},children:[(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`},children:[(0,Z.jsx)(`input`,{type:`radio`,name:`styling`,value:`basic`,checked:f===`basic`,onChange:e=>p(e.target.value),style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`14px`,color:`#374151`},children:`Basic`})]}),(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`},children:[(0,Z.jsx)(`input`,{type:`radio`,name:`styling`,value:`professional`,checked:f===`professional`,onChange:e=>p(e.target.value),style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`14px`,color:`#374151`},children:`Professional`})]})]})}),(0,Z.jsx)(`p`,{style:{fontSize:`12px`,color:`#6b7280`,margin:`0`},children:`Professional adds colors, borders, and frozen header row`})]}),(0,Z.jsxs)(`div`,{style:{backgroundColor:`#f3f4f6`,borderRadius:`6px`,padding:`12px`,marginBottom:`20px`,fontSize:`13px`,color:`#4b5563`},children:[(0,Z.jsxs)(`p`,{style:{margin:`6px 0`},children:[(0,Z.jsx)(`strong`,{children:`Data to export:`}),` `,_().length,` row(s)`]}),(0,Z.jsxs)(`p`,{style:{margin:`6px 0`},children:[(0,Z.jsx)(`strong`,{children:`Columns:`}),` `,e.length]})]}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`10px`,justifyContent:`flex-end`},children:[(0,Z.jsx)(`button`,{onClick:()=>s(!1),style:{padding:`10px 16px`,border:`1px solid #d1d5db`,color:`#374151`,backgroundColor:`#ffffff`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`background-color 0.2s`},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`#f9fafb`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`#ffffff`},children:`Cancel`}),(0,Z.jsx)(`button`,{onClick:v,disabled:_().length===0,style:{padding:`10px 16px`,backgroundColor:_().length===0?`#9ca3af`:`#2563eb`,color:`#ffffff`,borderRadius:`6px`,border:`none`,fontSize:`14px`,fontWeight:`500`,cursor:_().length===0?`not-allowed`:`pointer`,opacity:_().length===0?.6:1,transition:`background-color 0.2s`},onMouseEnter:e=>{_().length>0&&(e.currentTarget.style.backgroundColor=`#1d4ed8`)},onMouseLeave:e=>{_().length>0&&(e.currentTarget.style.backgroundColor=`#2563eb`)},children:`Export Now`})]})]}),o&&(0,Z.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:40},onClick:()=>s(!1)})]})};var Jn=e=>{if(e.filterType)return e.filterType===`multi`?`set`:e.filterType;let t=e.field.toLowerCase();return t.includes(`date`)||t.includes(`time`)?`date`:t.includes(`salary`)||t.includes(`price`)||t.includes(`amount`)||t.includes(`count`)?`number`:t.includes(`status`)||t.includes(`department`)||t.includes(`category`)?`set`:`text`},Yn=e=>{switch(e){case`text`:return[{value:`contains`,label:`Contains`},{value:`notContains`,label:`Not Contains`},{value:`equals`,label:`Equals`},{value:`notEquals`,label:`Not Equals`},{value:`startsWith`,label:`Starts With`},{value:`endsWith`,label:`Ends With`},{value:`isEmpty`,label:`Is Empty`},{value:`isNotEmpty`,label:`Is Not Empty`}];case`number`:return[{value:`equals`,label:`Equals`},{value:`notEquals`,label:`Not Equals`},{value:`greaterThan`,label:`Greater Than`},{value:`greaterThanOrEqual`,label:`Greater Than or Equal`},{value:`lessThan`,label:`Less Than`},{value:`lessThanOrEqual`,label:`Less Than or Equal`},{value:`inRange`,label:`In Range`},{value:`isEmpty`,label:`Is Empty`},{value:`isNotEmpty`,label:`Is Not Empty`}];case`date`:return[{value:`equals`,label:`Equals`},{value:`before`,label:`Before`},{value:`after`,label:`After`},{value:`inRange`,label:`In Range`},{value:`isEmpty`,label:`Is Empty`},{value:`isNotEmpty`,label:`Is Not Empty`}];case`set`:return[{value:`in`,label:`In`},{value:`notIn`,label:`Not In`}];default:return[]}},Xn=e=>![`isEmpty`,`isNotEmpty`].includes(e),Zn=e=>e===`inRange`,Qn=e=>[`in`,`notIn`].includes(e);const $n=({column:e,filterValue:t,onApply:n,onClose:r,rows:i,anchorEl:a})=>{let o=Jn(e),s=Yn(o),c=t?.conditions||[{type:s[0]?.value||`contains`,value:``,value2:``,values:[]}],[l,u]=(0,b.useState)(t?.operator||`AND`),[d,f]=(0,b.useState)(c),[p,m]=(0,b.useState)({}),h=o===`set`?Array.from(new Set(i.map(t=>t[e.field]).filter(e=>e!=null))):[],g=()=>{f([...d,{type:s[0]?.value||`contains`,value:``,value2:``,values:[]}])},_=e=>{if(d.length>1){f(d.filter((t,n)=>n!==e));let t={...p};delete t[e],m(t)}},v=(e,t)=>{f(d.map((n,r)=>r===e?{...n,...t}:n))},y=(e,t)=>{m({...p,[e]:t})},x=()=>{let e=d.filter(e=>Xn(e.type)?Qn(e.type)?e.values&&e.values.length>0:Zn(e.type)?e.value!=null&&e.value!==``&&e.value2!=null&&e.value2!==``:e.value!=null&&e.value!==``:!0);e.length===0?n(null):n({operator:l,conditions:e}),r()},S=()=>{f([{type:s[0]?.value||`contains`,value:``,value2:``,values:[]}]),m({}),n(null)},C=()=>{f([{type:s[0]?.value||`contains`,value:``,value2:``,values:[]}]),u(`AND`),m({})},w=(e,t)=>{if(Qn(e.type)){let n=new Set(e.values||[]),r=p[t]?.searchTerm||``,i=h.filter(e=>String(e).toLowerCase().includes(r.toLowerCase())),a=e=>{let r=new Set(n);r.has(e)?r.delete(e):r.add(e),v(t,{values:Array.from(r)})};return(0,Z.jsxs)(`div`,{style:{marginTop:`8px`},children:[(0,Z.jsx)(`input`,{type:`text`,style:{width:`100%`,padding:`6px 10px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,fontSize:`var(--grid-font-size-sm, 12px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`,marginBottom:`8px`},value:r,onChange:e=>y(t,{searchTerm:e.target.value}),placeholder:`Search values...`}),(0,Z.jsxs)(`div`,{style:{maxHeight:`150px`,overflowY:`auto`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,padding:`4px`},children:[(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`6px`,cursor:`pointer`,padding:`4px 6px`,fontSize:`var(--grid-font-size-sm, 12px)`},children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n.size===i.length&&i.length>0,onChange:()=>{n.size===i.length?v(t,{values:[]}):v(t,{values:i})},style:{width:`14px`,height:`14px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontWeight:500,color:`var(--grid-text)`},children:`(Select All)`})]}),i.map((e,t)=>(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`6px`,cursor:`pointer`,padding:`4px 6px`,fontSize:`var(--grid-font-size-sm, 12px)`},children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n.has(e),onChange:()=>a(e),style:{width:`14px`,height:`14px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{color:`var(--grid-text)`},children:String(e)})]},t))]}),n.size>0&&(0,Z.jsxs)(`div`,{style:{marginTop:`6px`,fontSize:`var(--grid-font-size-sm, 12px)`,color:`var(--grid-primary)`,fontWeight:500},children:[n.size,` selected`]})]})}return Xn(e.type)?Zn(e.type)?(0,Z.jsxs)(`div`,{style:{marginTop:`8px`,display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,Z.jsx)(`input`,{type:o===`date`?`date`:o===`number`?`number`:`text`,style:{flex:1,padding:`6px 10px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,fontSize:`var(--grid-font-size-sm, 12px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:e.value||``,onChange:e=>v(t,{value:e.target.value}),placeholder:`From`}),(0,Z.jsx)(`span`,{style:{color:`var(--grid-text-secondary)`,fontSize:`var(--grid-font-size-sm, 12px)`},children:`to`}),(0,Z.jsx)(`input`,{type:o===`date`?`date`:o===`number`?`number`:`text`,style:{flex:1,padding:`6px 10px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,fontSize:`var(--grid-font-size-sm, 12px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:e.value2||``,onChange:e=>v(t,{value2:e.target.value}),placeholder:`To`})]}):(0,Z.jsx)(`div`,{style:{marginTop:`8px`},children:(0,Z.jsx)(`input`,{type:o===`date`?`date`:o===`number`?`number`:`text`,style:{width:`100%`,padding:`6px 10px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,fontSize:`var(--grid-font-size-sm, 12px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:e.value||``,onChange:e=>v(t,{value:e.target.value}),placeholder:`Enter ${o}...`})}):null};return(0,Z.jsxs)(`div`,{style:{position:`fixed`,top:a?a.getBoundingClientRect().bottom+5:0,left:a?a.getBoundingClientRect().left:0,minWidth:`380px`,maxWidth:`450px`,maxHeight:`600px`,backgroundColor:`var(--grid-bg)`,boxShadow:`0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.1)`,borderRadius:`var(--grid-border-radius, 8px)`,border:`1px solid var(--grid-border)`,padding:`16px`,zIndex:1001,display:`flex`,flexDirection:`column`,overflowY:`auto`},onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`16px`,paddingBottom:`12px`,borderBottom:`1px solid var(--grid-border)`},children:[(0,Z.jsxs)(`h4`,{style:{margin:0,fontSize:`var(--grid-font-size, 14px)`,fontWeight:600,color:`var(--grid-text)`},children:[`Advanced Filter: `,e.headerName]}),(0,Z.jsx)(`p`,{style:{margin:`4px 0 0 0`,fontSize:`var(--grid-font-size-sm, 12px)`,color:`var(--grid-text-secondary)`},children:`Add multiple conditions with AND/OR logic`})]}),d.length>1&&(0,Z.jsxs)(`div`,{style:{marginBottom:`16px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`6px`},children:`Combine Conditions`}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,Z.jsx)(`button`,{style:{flex:1,padding:`6px 12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:l===`AND`?`var(--grid-text-inverse)`:`var(--grid-text)`,backgroundColor:l===`AND`?`var(--grid-primary)`:`var(--grid-bg-alt)`,border:l===`AND`?`none`:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:()=>u(`AND`),children:`AND`}),(0,Z.jsx)(`button`,{style:{flex:1,padding:`6px 12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:l===`OR`?`var(--grid-text-inverse)`:`var(--grid-text)`,backgroundColor:l===`OR`?`var(--grid-primary)`:`var(--grid-bg-alt)`,border:l===`OR`?`none`:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:()=>u(`OR`),children:`OR`})]})]}),(0,Z.jsx)(`div`,{style:{flex:1,overflowY:`auto`,marginBottom:`12px`},children:d.map((e,t)=>(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`,padding:`12px`,backgroundColor:`var(--grid-bg-alt)`,borderRadius:`var(--grid-border-radius, 6px)`,border:`1px solid var(--grid-border)`},children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`8px`},children:[(0,Z.jsxs)(`label`,{style:{fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-text)`},children:[`Condition `,t+1]}),d.length>1&&(0,Z.jsx)(`button`,{style:{padding:`2px 8px`,fontSize:`var(--grid-font-size-sm, 12px)`,color:`var(--grid-danger, #dc2626)`,backgroundColor:`transparent`,border:`none`,cursor:`pointer`,borderRadius:`var(--grid-border-radius, 4px)`},onClick:()=>_(t),onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-danger-bg, rgba(220, 38, 38, 0.1))`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,title:`Remove condition`,children:`✕`})]}),(0,Z.jsx)(`select`,{style:{width:`100%`,padding:`6px 10px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,fontSize:`var(--grid-font-size-sm, 12px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:e.type,onChange:e=>v(t,{type:e.target.value,value:``,value2:``,values:[]}),children:s.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))}),w(e,t),t<d.length-1&&d.length>1&&(0,Z.jsx)(`div`,{style:{marginTop:`12px`,padding:`4px 8px`,textAlign:`center`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:600,color:`var(--grid-primary)`,backgroundColor:`var(--grid-primary-bg)`,borderRadius:`var(--grid-border-radius, 4px)`},children:l})]},t))}),(0,Z.jsx)(`button`,{style:{width:`100%`,padding:`8px 12px`,marginBottom:`12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-primary)`,backgroundColor:`var(--grid-primary-bg)`,border:`1px dashed var(--grid-primary)`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:g,onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover-bg)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-bg)`,children:`+ Add Condition`}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,paddingTop:`12px`,borderTop:`1px solid var(--grid-border)`},children:[(0,Z.jsx)(`button`,{style:{flex:1,padding:`8px 12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:C,onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Reset`}),(0,Z.jsx)(`button`,{style:{flex:1,padding:`8px 12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:S,onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Clear`}),(0,Z.jsx)(`button`,{style:{flex:1,padding:`8px 12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-text-inverse)`,backgroundColor:`var(--grid-primary)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:x,onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary)`,children:`Apply`})]})]})};var er=e=>e!=null&&`operator`in e&&`conditions`in e,tr=({filterValue:e,onApplyFilter:t,onClose:n,anchorEl:r,showAdvancedButton:i,onSwitchToAdvanced:a})=>{let o=er(e)?null:e,s=o?.type||`contains`,c=o?.value||``,[l,u]=(0,b.useState)(s),[d,f]=(0,b.useState)(c);return(0,Z.jsxs)(`div`,{style:{position:`fixed`,top:r?r.getBoundingClientRect().bottom+5:0,left:r?r.getBoundingClientRect().left:0,minWidth:`280px`,backgroundColor:`var(--grid-bg)`,boxShadow:`var(--grid-shadow-medium, 0 10px 15px -3px rgba(0, 0, 0, 0.1))`,borderRadius:`var(--grid-border-radius, 8px)`,border:`var(--grid-border-width, 1px) solid var(--grid-border)`,padding:`16px`,zIndex:1e3},onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Filter Type`}),(0,Z.jsxs)(`select`,{style:{width:`100%`,padding:`8px 12px`,border:`var(--grid-border-width, 1px) solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:l,onChange:e=>u(e.target.value),children:[(0,Z.jsx)(`option`,{value:`contains`,children:`Contains`}),(0,Z.jsx)(`option`,{value:`notContains`,children:`Not Contains`}),(0,Z.jsx)(`option`,{value:`equals`,children:`Equals`}),(0,Z.jsx)(`option`,{value:`startsWith`,children:`Starts With`}),(0,Z.jsx)(`option`,{value:`endsWith`,children:`Ends With`})]})]}),(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Value`}),(0,Z.jsx)(`input`,{type:`text`,style:{width:`100%`,padding:`8px 12px`,border:`var(--grid-border-width, 1px) solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:d,onChange:e=>f(e.target.value),placeholder:`Enter text...`,autoFocus:!0})]}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,justifyContent:`flex-end`},children:[(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{f(``),t(null),n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Clear`}),(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text-inverse)`,backgroundColor:`var(--grid-primary)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{t(d?{type:l,value:d}:null),n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary)`,children:`Apply`})]})]})},nr=({filterValue:e,onApplyFilter:t,onClose:n,anchorEl:r,showAdvancedButton:i,onSwitchToAdvanced:a})=>{let o=er(e)?null:e,s=o?.type||`equals`,c=o?.value||``,l=o?.value2||``,[u,d]=(0,b.useState)(s),[f,p]=(0,b.useState)(c),[m,h]=(0,b.useState)(l);return(0,Z.jsxs)(`div`,{style:{position:`fixed`,top:r?r.getBoundingClientRect().bottom+5:0,left:r?r.getBoundingClientRect().left:0,minWidth:`280px`,backgroundColor:`var(--grid-bg)`,boxShadow:`var(--grid-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))`,borderRadius:`var(--grid-border-radius, 8px)`,border:`1px solid var(--grid-border)`,padding:`16px`,zIndex:1e3},onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Filter Type`}),(0,Z.jsxs)(`select`,{style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:u,onChange:e=>d(e.target.value),children:[(0,Z.jsx)(`option`,{value:`equals`,children:`Equals`}),(0,Z.jsx)(`option`,{value:`notEquals`,children:`Not Equals`}),(0,Z.jsx)(`option`,{value:`greaterThan`,children:`Greater Than`}),(0,Z.jsx)(`option`,{value:`greaterThanOrEqual`,children:`Greater Than or Equal`}),(0,Z.jsx)(`option`,{value:`lessThan`,children:`Less Than`}),(0,Z.jsx)(`option`,{value:`lessThanOrEqual`,children:`Less Than or Equal`}),(0,Z.jsx)(`option`,{value:`inRange`,children:`In Range`})]})]}),(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Value`}),(0,Z.jsx)(`input`,{type:`number`,style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:f,onChange:e=>p(e.target.value),placeholder:`Enter number...`,autoFocus:!0})]}),u===`inRange`&&(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`To`}),(0,Z.jsx)(`input`,{type:`number`,style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:m,onChange:e=>h(e.target.value),placeholder:`Enter max value...`})]}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,justifyContent:`flex-end`},children:[(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{p(``),h(``),t(null),n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Clear`}),(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text-inverse)`,backgroundColor:`var(--grid-primary)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{if(f){let e={type:u,value:parseFloat(f)};u===`inRange`&&m&&(e.value2=parseFloat(m)),t(e)}else t(null);n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary)`,children:`Apply`})]})]})},rr=({filterValue:e,onApplyFilter:t,onClose:n,anchorEl:r,showAdvancedButton:i,onSwitchToAdvanced:a})=>{let o=er(e)?null:e,s=o?.type||`equals`,c=o?.value||``,l=o?.value2||``,[u,d]=(0,b.useState)(s),[f,p]=(0,b.useState)(c),[m,h]=(0,b.useState)(l);return(0,Z.jsxs)(`div`,{style:{position:`fixed`,top:r?r.getBoundingClientRect().bottom+5:0,left:r?r.getBoundingClientRect().left:0,minWidth:`280px`,backgroundColor:`var(--grid-bg)`,boxShadow:`var(--grid-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))`,borderRadius:`var(--grid-border-radius, 8px)`,border:`1px solid var(--grid-border)`,padding:`16px`,zIndex:1e3},onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Filter Type`}),(0,Z.jsxs)(`select`,{style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:u,onChange:e=>d(e.target.value),children:[(0,Z.jsx)(`option`,{value:`equals`,children:`Equals`}),(0,Z.jsx)(`option`,{value:`before`,children:`Before`}),(0,Z.jsx)(`option`,{value:`after`,children:`After`}),(0,Z.jsx)(`option`,{value:`inRange`,children:`In Range`})]})]}),(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Date`}),(0,Z.jsx)(`input`,{type:`date`,style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:f,onChange:e=>p(e.target.value),autoFocus:!0})]}),u===`inRange`&&(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`To`}),(0,Z.jsx)(`input`,{type:`date`,style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:m,onChange:e=>h(e.target.value)})]}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,justifyContent:`flex-end`},children:[(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{p(``),h(``),t(null),n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Clear`}),(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text-inverse)`,backgroundColor:`var(--grid-primary)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{if(f){let e={type:u,value:f};u===`inRange`&&m&&(e.value2=m),t(e)}else t(null);n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary)`,children:`Apply`})]})]})},ir=({column:e,filterValue:t,onApplyFilter:n,onClose:r,rows:i,anchorEl:a,showAdvancedButton:o,onSwitchToAdvanced:s})=>{let c=Array.from(new Set(i.map(t=>t[e.field]).filter(e=>e!=null))),l=er(t)?null:t,[u,d]=(0,b.useState)(l&&l.values?new Set(l.values):new Set),[f,p]=(0,b.useState)(``),m=c.filter(e=>String(e).toLowerCase().includes(f.toLowerCase())),h=e=>{let t=new Set(u);t.has(e)?t.delete(e):t.add(e),d(t)};return(0,Z.jsxs)(`div`,{style:{position:`fixed`,top:a?a.getBoundingClientRect().bottom+5:0,left:a?a.getBoundingClientRect().left:0,minWidth:`280px`,maxHeight:`400px`,backgroundColor:`var(--grid-bg)`,boxShadow:`var(--grid-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))`,borderRadius:`var(--grid-border-radius, 8px)`,border:`1px solid var(--grid-border)`,padding:`16px`,zIndex:1e3,display:`flex`,flexDirection:`column`},onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`div`,{style:{marginBottom:`12px`},children:(0,Z.jsx)(`input`,{type:`text`,style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:f,onChange:e=>p(e.target.value),placeholder:`Search values...`,autoFocus:!0})}),(0,Z.jsx)(`div`,{style:{marginBottom:`8px`},children:(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,padding:`8px`,borderRadius:`4px`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:u.size===m.length&&m.length>0,onChange:()=>{u.size===m.length?d(new Set):d(new Set(m))},style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`},children:`(Select All)`})]})}),(0,Z.jsx)(`div`,{style:{flex:1,overflowY:`auto`,marginBottom:`12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,maxHeight:`200px`},children:m.map((e,t)=>(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,padding:`8px`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:u.has(e),onChange:()=>h(e),style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text)`},children:String(e)})]},t))}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,justifyContent:`flex-end`,paddingTop:`8px`,borderTop:`1px solid var(--grid-border)`},children:[(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{d(new Set),n(null),r()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Clear`}),(0,Z.jsxs)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text-inverse)`,backgroundColor:`var(--grid-primary)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{u.size>0?n({type:`set`,values:Array.from(u)}):n(null),r()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary)`,children:[`Apply (`,u.size,`)`]})]})]})},ar=({column:e,filterValue:t,onApplyFilter:n,onClose:r,rows:i,anchorEl:a})=>(0,Z.jsx)(ir,{column:e,filterValue:t,onApplyFilter:n,onClose:r,rows:i,anchorEl:a});const or=({columns:e,displayColumnOrder:t,columnWidths:n,filterConfig:r,dispatch:i,pinnedLeft:a,pinnedRight:o,rows:s})=>{let[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)({}),[f,p]=(0,b.useState)(null),m=new Set(a),h=new Set(o),g={},_=0;a.forEach(e=>{g[e]=_,_+=n[e]||150});let v={},y=0;[...o].reverse().forEach(e=>{v[e]=y,y+=n[e]||150});let x=new Map(e.map(e=>[e.field,e])),S=e=>{let t={width:`${n[e]||150}px`};return m.has(e)?(t.position=`sticky`,t.left=`${g[e]}px`,t.zIndex=20,t.backgroundColor=`var(--grid-header-bg)`):h.has(e)&&(t.position=`sticky`,t.right=`${v[e]}px`,t.zIndex=20,t.backgroundColor=`var(--grid-header-bg)`),t},C=e=>{if(e.filterType)return e.filterType;let t=e.field.toLowerCase();return t.includes(`date`)||t.includes(`time`)?`date`:t.includes(`salary`)||t.includes(`price`)||t.includes(`amount`)||t.includes(`count`)?`number`:t.includes(`status`)||t.includes(`department`)||t.includes(`category`)?`set`:`text`},w=(e,t)=>{t.stopPropagation();let n=r[e];er(n)||t.shiftKey?(d({...u,[e]:t.currentTarget}),p(e),l(null)):(d({...u,[e]:t.currentTarget}),l(e),p(null))},T=()=>{l(null),p(null)},E=(e,t)=>{i({type:`SET_FILTER`,payload:{field:e,value:t}})},D=e=>{l(null),p(e)};(0,b.useEffect)(()=>{let e=()=>{c&&l(null)};if(c)return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[c]);let O=e=>{let t=C(e),n={column:e,filterValue:r[e.field],onApplyFilter:t=>E(e.field,t),onClose:T,rows:s,anchorEl:u[e.field],showAdvancedButton:!0,onSwitchToAdvanced:()=>D(e.field)};switch(t){case`number`:return(0,Z.jsx)(nr,{...n});case`date`:return(0,Z.jsx)(rr,{...n});case`set`:return(0,Z.jsx)(ir,{...n});case`multi`:return(0,Z.jsx)(ar,{...n});default:return(0,Z.jsx)(tr,{...n})}},k=e=>{let t=r[e.field],n=u[e.field];return(0,Z.jsx)($n,{column:e,filterValue:er(t)?t:null,onApply:t=>E(e.field,t),onClose:T,rows:s,anchorEl:n})},A=e=>{let t=r[e];if(!t)return``;if(er(t)){let e=t.conditions.length;return`${e} condition${e>1?`s`:``} (${t.operator})`}return t.type===`set`&&t.values?`${t.values.length} selected`:t.type===`inRange`?`${t.value} - ${t.value2}`:String(t.value||``)},j=e=>!!r[e];return(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(`div`,{style:{display:`flex`,minWidth:`100%`,borderBottom:`1px solid var(--grid-border)`,backgroundColor:`var(--grid-header-bg)`},children:t.map(e=>{let t=x.get(e);if(!t||t.filterable===!1)return(0,Z.jsx)(`div`,{style:{...S(e),borderRight:`1px solid var(--grid-border)`,flexShrink:0,minHeight:`38px`}},e);let n=j(e);return(0,Z.jsxs)(`div`,{style:{...S(e),borderRight:`1px solid var(--grid-border)`,flexShrink:0,padding:`6px 8px`,position:`relative`,display:`flex`,alignItems:`center`},children:[(0,Z.jsx)(`div`,{style:{width:`100%`,cursor:`pointer`},onClick:t=>w(e,t),title:`Click to filter, Shift+Click for advanced filter`,children:(0,Z.jsxs)(`div`,{style:{width:`100%`,padding:`4px 8px`,fontSize:`var(--grid-font-size-sm, 12px)`,border:`1px solid`,borderColor:n?`var(--grid-primary)`:`var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,backgroundColor:n?`var(--grid-primary-bg)`:`var(--grid-bg)`,color:n?`var(--grid-primary)`:`var(--grid-text-secondary)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`6px`,transition:`border-color 0.15s`},onMouseEnter:e=>{n||(e.currentTarget.style.borderColor=`var(--grid-border-hover)`)},onMouseLeave:e=>{n||(e.currentTarget.style.borderColor=`var(--grid-border)`)},children:[(0,Z.jsx)(`span`,{style:{flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n?A(e):`Filter...`}),(0,Z.jsx)(`svg`,{style:{flexShrink:0,color:n?`var(--grid-primary)`:`var(--grid-text-muted)`},width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,strokeWidth:`2.5`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 4h18v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V20l-4-2v-3.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z`})})]})}),c===e&&O(t),f===e&&k(t)]},e)})})})},sr=({manager:e,currentLayout:t,onLoadPreset:n,onResetLayout:r})=>{let[i,a]=(0,b.useState)([]),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)(``),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(null),v=(0,b.useCallback)(async()=>{try{h(!0),a((await e.listPresets()).filter(e=>e.id!==`__autosave__`)),_(null)}catch(e){_(`Failed to load presets`),console.error(e)}finally{h(!1)}},[e]);(0,b.useEffect)(()=>{v()},[v]);let y=async()=>{if(!u.trim()){_(`Please enter a preset name`);return}try{h(!0);let{createPreset:n}=await w(async()=>{let{createPreset:e}=await import(`./layoutPersistence-BQxLqTMm.js`);return{createPreset:e}},[]),r=n(u.trim(),t,f.trim());await e.savePreset(r),await v(),l(!1),d(``),p(``),_(null)}catch(e){_(`Failed to save preset`),console.error(e)}finally{h(!1)}},x=async t=>{try{h(!0);let r=await e.loadPreset(t);r&&(n(r.layout),s(!1),_(null))}catch(e){_(`Failed to load preset`),console.error(e)}finally{h(!1)}},S=async(t,n)=>{if(n.stopPropagation(),confirm(`Are you sure you want to delete this preset?`))try{h(!0),await e.deletePreset(t),await v(),_(null)}catch(e){_(`Failed to delete preset`),console.error(e)}finally{h(!1)}},C=async(n,r)=>{if(r.stopPropagation(),confirm(`Update this preset with current layout?`))try{h(!0);let r={...n,layout:t};await e.savePreset(r),await v(),_(null)}catch(e){_(`Failed to update preset`),console.error(e)}finally{h(!1)}},T=e=>new Date(e).toLocaleString();return(0,Z.jsxs)(`div`,{className:`relative inline-block`,children:[(0,Z.jsxs)(`button`,{onClick:()=>s(!o),style:{padding:`6px 12px`,fontSize:`14px`,backgroundColor:`white`,border:`1px solid #d1d5db`,borderRadius:`4px`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:`8px`},disabled:m,children:[(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`,flexShrink:0},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 7h16M4 12h16M4 17h16`})}),`Layout Presets`,(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`,flexShrink:0,transform:o?`rotate(180deg)`:`rotate(0deg)`,transition:`transform 0.2s`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 9l-7 7-7-7`})})]}),o&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:10},onClick:()=>s(!1)}),(0,Z.jsxs)(`div`,{style:{position:`absolute`,right:0,marginTop:`8px`,width:`320px`,backgroundColor:`white`,border:`1px solid #d1d5db`,borderRadius:`8px`,boxShadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1)`,zIndex:20,maxHeight:`384px`,overflowY:`auto`},children:[(0,Z.jsx)(`div`,{style:{padding:`12px`,borderBottom:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`},children:(0,Z.jsx)(`h3`,{style:{fontWeight:`600`,fontSize:`14px`,color:`#111827`},children:`Layout Presets`})}),g&&(0,Z.jsx)(`div`,{style:{padding:`12px`,backgroundColor:`#fef2f2`,borderBottom:`1px solid #fecaca`},children:(0,Z.jsx)(`p`,{style:{fontSize:`14px`,color:`#dc2626`},children:g})}),(0,Z.jsxs)(`div`,{style:{padding:`8px`,borderBottom:`1px solid #e5e7eb`,display:`flex`,gap:`8px`},children:[(0,Z.jsxs)(`button`,{onClick:()=>{l(!0),s(!1)},style:{flex:1,padding:`8px 12px`,fontSize:`14px`,backgroundColor:`#2563eb`,color:`white`,border:`none`,borderRadius:`4px`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`8px`},children:[(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`,flexShrink:0},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4`})}),`Save Current`]}),(0,Z.jsxs)(`button`,{onClick:()=>{r(),s(!1)},style:{flex:1,padding:`8px 12px`,fontSize:`14px`,backgroundColor:`#4b5563`,color:`white`,border:`none`,borderRadius:`4px`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`8px`},children:[(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`,flexShrink:0},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15`})}),`Reset`]})]}),(0,Z.jsx)(`div`,{style:{maxHeight:`256px`,overflowY:`auto`},children:m&&i.length===0?(0,Z.jsx)(`div`,{style:{padding:`16px`,textAlign:`center`,color:`#6b7280`,fontSize:`14px`},children:`Loading presets...`}):i.length===0?(0,Z.jsx)(`div`,{style:{padding:`16px`,textAlign:`center`,color:`#6b7280`,fontSize:`14px`},children:`No saved presets. Save your current layout to get started.`}):(0,Z.jsx)(`div`,{children:i.map(e=>(0,Z.jsx)(`div`,{style:{padding:`12px`,cursor:`pointer`,borderBottom:`1px solid #e5e7eb`},onClick:()=>x(e.id),onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`#f9fafb`;let t=e.currentTarget.querySelector(`.preset-actions`);t&&(t.style.opacity=`1`)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`transparent`;let t=e.currentTarget.querySelector(`.preset-actions`);t&&(t.style.opacity=`0`)},children:(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`},children:[(0,Z.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,Z.jsx)(`h4`,{style:{fontSize:`14px`,fontWeight:`500`,color:`#111827`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name}),e.description&&(0,Z.jsx)(`p`,{style:{fontSize:`12px`,color:`#6b7280`,marginTop:`4px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.description}),(0,Z.jsxs)(`p`,{style:{fontSize:`12px`,color:`#9ca3af`,marginTop:`4px`},children:[`Updated: `,T(e.updatedAt)]})]}),(0,Z.jsxs)(`div`,{className:`preset-actions`,style:{display:`flex`,gap:`4px`,marginLeft:`8px`,opacity:0,transition:`opacity 0.2s`},children:[(0,Z.jsx)(`button`,{onClick:t=>C(e,t),style:{padding:`4px`,color:`#2563eb`,backgroundColor:`transparent`,border:`none`,borderRadius:`4px`,cursor:`pointer`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`#eff6ff`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,title:`Update with current layout`,children:(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15`})})}),(0,Z.jsx)(`button`,{onClick:t=>S(e.id,t),style:{padding:`4px`,color:`#dc2626`,backgroundColor:`transparent`,border:`none`,borderRadius:`4px`,cursor:`pointer`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`#fef2f2`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,title:`Delete preset`,children:(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})})})]})]})},e.id))})})]})]}),c&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{style:{position:`fixed`,inset:0,backgroundColor:`rgba(0, 0, 0, 0.5)`,zIndex:30,display:`flex`,alignItems:`center`,justifyContent:`center`},onClick:()=>l(!1)}),(0,Z.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:40,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`16px`},children:(0,Z.jsxs)(`div`,{style:{backgroundColor:`white`,borderRadius:`8px`,boxShadow:`0 25px 50px -12px rgba(0, 0, 0, 0.25)`,maxWidth:`448px`,width:`100%`,padding:`24px`},onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`h2`,{style:{fontSize:`20px`,fontWeight:`600`,marginBottom:`16px`},children:`Save Layout Preset`}),g&&(0,Z.jsx)(`div`,{style:{marginBottom:`16px`,padding:`12px`,backgroundColor:`#fef2f2`,border:`1px solid #fecaca`,borderRadius:`4px`},children:(0,Z.jsx)(`p`,{style:{fontSize:`14px`,color:`#dc2626`},children:g})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`16px`},children:[(0,Z.jsx)(`label`,{htmlFor:`preset-name`,style:{display:`block`,fontSize:`14px`,fontWeight:`500`,color:`#374151`,marginBottom:`4px`},children:`Preset Name *`}),(0,Z.jsx)(`input`,{id:`preset-name`,type:`text`,value:u,onChange:e=>d(e.target.value),style:{width:`100%`,padding:`8px 12px`,border:`1px solid #d1d5db`,borderRadius:`4px`,fontSize:`14px`},placeholder:`e.g., Sales Dashboard Layout`,autoFocus:!0})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{htmlFor:`preset-description`,style:{display:`block`,fontSize:`14px`,fontWeight:`500`,color:`#374151`,marginBottom:`4px`},children:`Description (optional)`}),(0,Z.jsx)(`textarea`,{id:`preset-description`,value:f,onChange:e=>p(e.target.value),style:{width:`100%`,padding:`8px 12px`,border:`1px solid #d1d5db`,borderRadius:`4px`,fontSize:`14px`},placeholder:`Add a description...`,rows:3})]})]}),(0,Z.jsxs)(`div`,{style:{marginTop:`24px`,display:`flex`,gap:`12px`,justifyContent:`flex-end`},children:[(0,Z.jsx)(`button`,{onClick:()=>{l(!1),d(``),p(``),_(null)},style:{padding:`8px 16px`,fontSize:`14px`,color:`#374151`,backgroundColor:`#f3f4f6`,border:`none`,borderRadius:`4px`,cursor:`pointer`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`#e5e7eb`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`#f3f4f6`,disabled:m,children:`Cancel`}),(0,Z.jsx)(`button`,{onClick:y,style:{padding:`8px 16px`,fontSize:`14px`,color:`white`,backgroundColor:`#2563eb`,border:`none`,borderRadius:`4px`,cursor:`pointer`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`#1d4ed8`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`#2563eb`,disabled:m,children:m?`Saving...`:`Save Preset`})]})]})})]})]})},cr=({x:e,y:t,items:n,onClose:r})=>{let i=(0,b.useRef)(null);(0,b.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&r()},t=e=>{i.current&&!i.current.contains(e.target)&&(e.preventDefault(),r())},n=setTimeout(()=>{document.addEventListener(`mousedown`,e),document.addEventListener(`contextmenu`,t)},100);return()=>{clearTimeout(n),document.removeEventListener(`mousedown`,e),document.removeEventListener(`contextmenu`,t)}},[r]),(0,b.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[r]),(0,b.useEffect)(()=>{if(i.current){let n=i.current,r=n.getBoundingClientRect(),a=window.innerWidth,o=window.innerHeight,s=e,c=t;r.right>a&&(s=a-r.width-10),r.bottom>o&&(c=o-r.height-10),(s!==e||c!==t)&&(n.style.left=`${s}px`,n.style.top=`${c}px`)}},[e,t]);let a=(0,b.useCallback)(e=>{e.disabled||e.type===`separator`||(e.onClick&&e.onClick(),e.submenu||r())},[r]),o=(e,t)=>e.type===`separator`?(0,Z.jsx)(`div`,{className:`context-menu-separator`,role:`separator`},`separator-${t}`):(0,Z.jsxs)(`div`,{className:`context-menu-item ${e.disabled?`disabled`:``} ${e.danger?`danger`:``}`,onClick:()=>a(e),role:`menuitem`,"aria-disabled":e.disabled,tabIndex:e.disabled?-1:0,children:[e.icon&&(0,Z.jsx)(`span`,{className:`context-menu-icon`,children:e.icon}),(0,Z.jsx)(`span`,{className:`context-menu-label`,children:e.label}),e.shortcut&&(0,Z.jsx)(`span`,{className:`context-menu-shortcut`,children:e.shortcut}),e.submenu&&(0,Z.jsx)(`span`,{className:`context-menu-arrow`,children:`▶`})]},e.id||t);return(0,Z.jsx)(`div`,{ref:i,className:`context-menu`,style:{left:e,top:t},role:`menu`,"aria-label":`Context menu`,children:n.map((e,t)=>o(e,t))})},lr=async(e,t,n,r=!1)=>{let i=Array.from(e),a=n.filter(e=>i.includes(e.id));if(a.length===0)return;let o=``;r&&(o+=t.map(e=>e.headerName).join(` `)+`
|
|
40
|
+
`);Wn(new Blob([a],{type:`text/csv;charset=utf-8;`}),n)},Hn=async(e,t,n={})=>{let{filename:r=`export.xlsx`,styling:i=`basic`}=n,a=new Bn.default.Workbook,o=a.addWorksheet(`Sheet1`),s=t.map(e=>e.headerName);o.addRow(s),e.forEach(e=>{let n=t.map(t=>e[t.field]??``);o.addRow(n)}),o.columns=t.map(t=>{let n=t.headerName.length,r=Math.max(...e.map(e=>String(e[t.field]??``).length)),i=Math.max(n,r)+2;return{width:Math.min(i,50)}}),i===`professional`&&Un(o,t);let c=await a.xlsx.writeBuffer();Wn(new Blob([c],{type:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`}),r)};var Un=(e,t)=>{let n=e.getRow(1);n.font={bold:!0,color:{argb:`FFFFFFFF`},size:11},n.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:`FF2F5496`}},n.alignment={horizontal:`center`,vertical:`middle`,wrapText:!0},n.height=20,e.eachRow((e,t)=>{e.eachCell(e=>{e.border={top:{style:`thin`,color:{argb:`FFD3D3D3`}},left:{style:`thin`,color:{argb:`FFD3D3D3`}},bottom:{style:`thin`,color:{argb:`FFD3D3D3`}},right:{style:`thin`,color:{argb:`FFD3D3D3`}}},t>1&&t%2==0&&(e.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:`FFF2F2F2`}}),t>1&&(e.alignment={horizontal:`left`,vertical:`middle`})})}),e.views=[{state:`frozen`,ySplit:1}]},Wn=(e,t)=>{let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)};const Gn=(e,t)=>{let n=new Date().toISOString().replace(/[:.]/g,`-`).slice(0,-5);return`data_export_${t===`all`?`full`:t}_${n}.${e}`},Kn=async(e,t,n)=>{if(e.length===0){alert(`No data to export`);return}let r=n.filename||Gn(n.format,n.scope);n.format===`csv`?Vn(e,t,r):n.format===`xlsx`&&await Hn(e,t,{filename:r,styling:n.styling})},qn=({columns:e,fullDataset:t,filteredData:n,selectedRows:r,currentPageData:i,onExport:a})=>{let[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(`csv`),[u,d]=(0,b.useState)(`filtered`),[f,p]=(0,b.useState)(`basic`),[m,h]=(0,b.useState)(null),g=b.useRef(null),_=()=>{switch(u){case`all`:return t;case`filtered`:return n;case`selected`:return r.size>0?n.filter(e=>r.has(e.id)):[];case`page`:return i;default:return n}},v=()=>{let t=_();if(t.length===0){alert(`No ${u===`selected`?`selected`:u} data to export`);return}Kn(t,e,{format:c,scope:u,styling:c===`xlsx`?f:void 0}),a?.(!0),s(!1)},y=[{value:`all`,label:`Full Dataset`,disabled:!1},{value:`filtered`,label:`Filtered Data`,disabled:n.length===0},{value:`selected`,label:`Selected Rows (${r.size})`,disabled:r.size===0},{value:`page`,label:`Current Page`,disabled:i.length===0}];return(0,Z.jsxs)(`div`,{style:{position:`relative`},children:[(0,Z.jsxs)(`button`,{ref:g,onClick:()=>{if(!o){let e=g.current?.getBoundingClientRect();e&&h(e)}s(!o)},style:{padding:`8px 12px`,backgroundColor:`#2563eb`,color:`white`,borderRadius:`6px`,border:`none`,fontSize:`14px`,fontWeight:`500`,display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,transition:`background-color 0.2s`},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`#1d4ed8`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`#2563eb`},title:`Export data to CSV or XLSX format`,children:[(0,Z.jsx)(`svg`,{style:{width:`16px`,height:`16px`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M12 19l9 2-9-18-9 18 9-2m0 0v-8m0 8l-6-4m6 4l6-4`})}),`Export`]}),o&&m&&(0,Z.jsxs)(`div`,{style:{position:`fixed`,left:`${m.left}px`,top:`${m.bottom+8}px`,backgroundColor:`#ffffff`,border:`1px solid #e5e7eb`,borderRadius:`8px`,boxShadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05)`,zIndex:50,padding:`20px`,width:`420px`,minWidth:`420px`,maxWidth:`420px`,maxHeight:`90vh`,overflowY:`auto`},children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`20px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`14px`,fontWeight:`600`,color:`#1f2937`,marginBottom:`12px`},children:`Format`}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`16px`},children:[(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`},children:[(0,Z.jsx)(`input`,{type:`radio`,name:`format`,value:`csv`,checked:c===`csv`,onChange:e=>l(e.target.value),style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`14px`,color:`#374151`},children:`CSV`})]}),(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`},children:[(0,Z.jsx)(`input`,{type:`radio`,name:`format`,value:`xlsx`,checked:c===`xlsx`,onChange:e=>l(e.target.value),style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`14px`,color:`#374151`},children:`XLSX (Excel)`})]})]})]}),(0,Z.jsxs)(`div`,{style:{marginBottom:`20px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`14px`,fontWeight:`600`,color:`#1f2937`,marginBottom:`12px`},children:`Data Scope`}),(0,Z.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`10px`},children:y.map(e=>(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`10px`,padding:`10px 12px`,borderRadius:`6px`,cursor:e.disabled?`not-allowed`:`pointer`,opacity:e.disabled?.5:1,backgroundColor:`transparent`,transition:`background-color 0.15s`,userSelect:`none`},onMouseEnter:t=>{e.disabled||(t.currentTarget.style.backgroundColor=`#f3f4f6`)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`transparent`},children:[(0,Z.jsx)(`input`,{type:`radio`,name:`scope`,value:e.value,checked:u===e.value,onChange:e=>d(e.target.value),disabled:e.disabled,style:{width:`16px`,height:`16px`,cursor:e.disabled?`not-allowed`:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`14px`,color:`#374151`},children:e.label})]},e.value))})]}),c===`xlsx`&&(0,Z.jsxs)(`div`,{style:{marginBottom:`20px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`14px`,fontWeight:`600`,color:`#1f2937`,marginBottom:`12px`},children:`Styling`}),(0,Z.jsx)(`div`,{style:{marginBottom:`10px`},children:(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`16px`},children:[(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`},children:[(0,Z.jsx)(`input`,{type:`radio`,name:`styling`,value:`basic`,checked:f===`basic`,onChange:e=>p(e.target.value),style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`14px`,color:`#374151`},children:`Basic`})]}),(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`},children:[(0,Z.jsx)(`input`,{type:`radio`,name:`styling`,value:`professional`,checked:f===`professional`,onChange:e=>p(e.target.value),style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`14px`,color:`#374151`},children:`Professional`})]})]})}),(0,Z.jsx)(`p`,{style:{fontSize:`12px`,color:`#6b7280`,margin:`0`},children:`Professional adds colors, borders, and frozen header row`})]}),(0,Z.jsxs)(`div`,{style:{backgroundColor:`#f3f4f6`,borderRadius:`6px`,padding:`12px`,marginBottom:`20px`,fontSize:`13px`,color:`#4b5563`},children:[(0,Z.jsxs)(`p`,{style:{margin:`6px 0`},children:[(0,Z.jsx)(`strong`,{children:`Data to export:`}),` `,_().length,` row(s)`]}),(0,Z.jsxs)(`p`,{style:{margin:`6px 0`},children:[(0,Z.jsx)(`strong`,{children:`Columns:`}),` `,e.length]})]}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`10px`,justifyContent:`flex-end`},children:[(0,Z.jsx)(`button`,{onClick:()=>s(!1),style:{padding:`10px 16px`,border:`1px solid #d1d5db`,color:`#374151`,backgroundColor:`#ffffff`,borderRadius:`6px`,fontSize:`14px`,fontWeight:`500`,cursor:`pointer`,transition:`background-color 0.2s`},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`#f9fafb`},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`#ffffff`},children:`Cancel`}),(0,Z.jsx)(`button`,{onClick:v,disabled:_().length===0,style:{padding:`10px 16px`,backgroundColor:_().length===0?`#9ca3af`:`#2563eb`,color:`#ffffff`,borderRadius:`6px`,border:`none`,fontSize:`14px`,fontWeight:`500`,cursor:_().length===0?`not-allowed`:`pointer`,opacity:_().length===0?.6:1,transition:`background-color 0.2s`},onMouseEnter:e=>{_().length>0&&(e.currentTarget.style.backgroundColor=`#1d4ed8`)},onMouseLeave:e=>{_().length>0&&(e.currentTarget.style.backgroundColor=`#2563eb`)},children:`Export Now`})]})]}),o&&(0,Z.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:40},onClick:()=>s(!1)})]})};var Jn=e=>{if(e.filterType)return e.filterType===`multi`?`set`:e.filterType;let t=e.field.toLowerCase();return t.includes(`date`)||t.includes(`time`)?`date`:t.includes(`salary`)||t.includes(`price`)||t.includes(`amount`)||t.includes(`count`)?`number`:t.includes(`status`)||t.includes(`department`)||t.includes(`category`)?`set`:`text`},Yn=e=>{switch(e){case`text`:return[{value:`contains`,label:`Contains`},{value:`notContains`,label:`Not Contains`},{value:`equals`,label:`Equals`},{value:`notEquals`,label:`Not Equals`},{value:`startsWith`,label:`Starts With`},{value:`endsWith`,label:`Ends With`},{value:`isEmpty`,label:`Is Empty`},{value:`isNotEmpty`,label:`Is Not Empty`}];case`number`:return[{value:`equals`,label:`Equals`},{value:`notEquals`,label:`Not Equals`},{value:`greaterThan`,label:`Greater Than`},{value:`greaterThanOrEqual`,label:`Greater Than or Equal`},{value:`lessThan`,label:`Less Than`},{value:`lessThanOrEqual`,label:`Less Than or Equal`},{value:`inRange`,label:`In Range`},{value:`isEmpty`,label:`Is Empty`},{value:`isNotEmpty`,label:`Is Not Empty`}];case`date`:return[{value:`equals`,label:`Equals`},{value:`before`,label:`Before`},{value:`after`,label:`After`},{value:`inRange`,label:`In Range`},{value:`isEmpty`,label:`Is Empty`},{value:`isNotEmpty`,label:`Is Not Empty`}];case`set`:return[{value:`in`,label:`In`},{value:`notIn`,label:`Not In`}];default:return[]}},Xn=e=>![`isEmpty`,`isNotEmpty`].includes(e),Zn=e=>e===`inRange`,Qn=e=>[`in`,`notIn`].includes(e);const $n=({column:e,filterValue:t,onApply:n,onClose:r,rows:i,anchorEl:a})=>{let o=Jn(e),s=Yn(o),c=t?.conditions||[{type:s[0]?.value||`contains`,value:``,value2:``,values:[]}],[l,u]=(0,b.useState)(t?.operator||`AND`),[d,f]=(0,b.useState)(c),[p,m]=(0,b.useState)({}),h=o===`set`?Array.from(new Set(i.map(t=>t[e.field]).filter(e=>e!=null))):[],g=()=>{f([...d,{type:s[0]?.value||`contains`,value:``,value2:``,values:[]}])},_=e=>{if(d.length>1){f(d.filter((t,n)=>n!==e));let t={...p};delete t[e],m(t)}},v=(e,t)=>{f(d.map((n,r)=>r===e?{...n,...t}:n))},y=(e,t)=>{m({...p,[e]:t})},x=()=>{let e=d.filter(e=>Xn(e.type)?Qn(e.type)?e.values&&e.values.length>0:Zn(e.type)?e.value!=null&&e.value!==``&&e.value2!=null&&e.value2!==``:e.value!=null&&e.value!==``:!0);e.length===0?n(null):n({operator:l,conditions:e}),r()},S=()=>{f([{type:s[0]?.value||`contains`,value:``,value2:``,values:[]}]),m({}),n(null)},C=()=>{f([{type:s[0]?.value||`contains`,value:``,value2:``,values:[]}]),u(`AND`),m({})},w=(e,t)=>{if(Qn(e.type)){let n=new Set(e.values||[]),r=p[t]?.searchTerm||``,i=h.filter(e=>String(e).toLowerCase().includes(r.toLowerCase())),a=e=>{let r=new Set(n);r.has(e)?r.delete(e):r.add(e),v(t,{values:Array.from(r)})};return(0,Z.jsxs)(`div`,{style:{marginTop:`8px`},children:[(0,Z.jsx)(`input`,{type:`text`,style:{width:`100%`,padding:`6px 10px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,fontSize:`var(--grid-font-size-sm, 12px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`,marginBottom:`8px`},value:r,onChange:e=>y(t,{searchTerm:e.target.value}),placeholder:`Search values...`}),(0,Z.jsxs)(`div`,{style:{maxHeight:`150px`,overflowY:`auto`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,padding:`4px`},children:[(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`6px`,cursor:`pointer`,padding:`4px 6px`,fontSize:`var(--grid-font-size-sm, 12px)`},children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n.size===i.length&&i.length>0,onChange:()=>{n.size===i.length?v(t,{values:[]}):v(t,{values:i})},style:{width:`14px`,height:`14px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontWeight:500,color:`var(--grid-text)`},children:`(Select All)`})]}),i.map((e,t)=>(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`6px`,cursor:`pointer`,padding:`4px 6px`,fontSize:`var(--grid-font-size-sm, 12px)`},children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n.has(e),onChange:()=>a(e),style:{width:`14px`,height:`14px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{color:`var(--grid-text)`},children:String(e)})]},t))]}),n.size>0&&(0,Z.jsxs)(`div`,{style:{marginTop:`6px`,fontSize:`var(--grid-font-size-sm, 12px)`,color:`var(--grid-primary)`,fontWeight:500},children:[n.size,` selected`]})]})}return Xn(e.type)?Zn(e.type)?(0,Z.jsxs)(`div`,{style:{marginTop:`8px`,display:`flex`,gap:`8px`,alignItems:`center`},children:[(0,Z.jsx)(`input`,{type:o===`date`?`date`:o===`number`?`number`:`text`,style:{flex:1,padding:`6px 10px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,fontSize:`var(--grid-font-size-sm, 12px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:e.value||``,onChange:e=>v(t,{value:e.target.value}),placeholder:`From`}),(0,Z.jsx)(`span`,{style:{color:`var(--grid-text-secondary)`,fontSize:`var(--grid-font-size-sm, 12px)`},children:`to`}),(0,Z.jsx)(`input`,{type:o===`date`?`date`:o===`number`?`number`:`text`,style:{flex:1,padding:`6px 10px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,fontSize:`var(--grid-font-size-sm, 12px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:e.value2||``,onChange:e=>v(t,{value2:e.target.value}),placeholder:`To`})]}):(0,Z.jsx)(`div`,{style:{marginTop:`8px`},children:(0,Z.jsx)(`input`,{type:o===`date`?`date`:o===`number`?`number`:`text`,style:{width:`100%`,padding:`6px 10px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,fontSize:`var(--grid-font-size-sm, 12px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:e.value||``,onChange:e=>v(t,{value:e.target.value}),placeholder:`Enter ${o}...`})}):null};return(0,Z.jsxs)(`div`,{style:{position:`fixed`,top:a?a.getBoundingClientRect().bottom+5:0,left:a?a.getBoundingClientRect().left:0,minWidth:`380px`,maxWidth:`450px`,maxHeight:`600px`,backgroundColor:`var(--grid-bg)`,boxShadow:`0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.1)`,borderRadius:`var(--grid-border-radius, 8px)`,border:`1px solid var(--grid-border)`,padding:`16px`,zIndex:1001,display:`flex`,flexDirection:`column`,overflowY:`auto`},onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`16px`,paddingBottom:`12px`,borderBottom:`1px solid var(--grid-border)`},children:[(0,Z.jsxs)(`h4`,{style:{margin:0,fontSize:`var(--grid-font-size, 14px)`,fontWeight:600,color:`var(--grid-text)`},children:[`Advanced Filter: `,e.headerName]}),(0,Z.jsx)(`p`,{style:{margin:`4px 0 0 0`,fontSize:`var(--grid-font-size-sm, 12px)`,color:`var(--grid-text-secondary)`},children:`Add multiple conditions with AND/OR logic`})]}),d.length>1&&(0,Z.jsxs)(`div`,{style:{marginBottom:`16px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`6px`},children:`Combine Conditions`}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`},children:[(0,Z.jsx)(`button`,{style:{flex:1,padding:`6px 12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:l===`AND`?`var(--grid-text-inverse)`:`var(--grid-text)`,backgroundColor:l===`AND`?`var(--grid-primary)`:`var(--grid-bg-alt)`,border:l===`AND`?`none`:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:()=>u(`AND`),children:`AND`}),(0,Z.jsx)(`button`,{style:{flex:1,padding:`6px 12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:l===`OR`?`var(--grid-text-inverse)`:`var(--grid-text)`,backgroundColor:l===`OR`?`var(--grid-primary)`:`var(--grid-bg-alt)`,border:l===`OR`?`none`:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:()=>u(`OR`),children:`OR`})]})]}),(0,Z.jsx)(`div`,{style:{flex:1,overflowY:`auto`,marginBottom:`12px`},children:d.map((e,t)=>(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`,padding:`12px`,backgroundColor:`var(--grid-bg-alt)`,borderRadius:`var(--grid-border-radius, 6px)`,border:`1px solid var(--grid-border)`},children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:`8px`},children:[(0,Z.jsxs)(`label`,{style:{fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-text)`},children:[`Condition `,t+1]}),d.length>1&&(0,Z.jsx)(`button`,{style:{padding:`2px 8px`,fontSize:`var(--grid-font-size-sm, 12px)`,color:`var(--grid-danger, #dc2626)`,backgroundColor:`transparent`,border:`none`,cursor:`pointer`,borderRadius:`var(--grid-border-radius, 4px)`},onClick:()=>_(t),onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-danger-bg, rgba(220, 38, 38, 0.1))`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,title:`Remove condition`,children:`✕`})]}),(0,Z.jsx)(`select`,{style:{width:`100%`,padding:`6px 10px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,fontSize:`var(--grid-font-size-sm, 12px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:e.type,onChange:e=>v(t,{type:e.target.value,value:``,value2:``,values:[]}),children:s.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))}),w(e,t),t<d.length-1&&d.length>1&&(0,Z.jsx)(`div`,{style:{marginTop:`12px`,padding:`4px 8px`,textAlign:`center`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:600,color:`var(--grid-primary)`,backgroundColor:`var(--grid-primary-bg)`,borderRadius:`var(--grid-border-radius, 4px)`},children:l})]},t))}),(0,Z.jsx)(`button`,{style:{width:`100%`,padding:`8px 12px`,marginBottom:`12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-primary)`,backgroundColor:`var(--grid-primary-bg)`,border:`1px dashed var(--grid-primary)`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:g,onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover-bg)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-bg)`,children:`+ Add Condition`}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,paddingTop:`12px`,borderTop:`1px solid var(--grid-border)`},children:[(0,Z.jsx)(`button`,{style:{flex:1,padding:`8px 12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:C,onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Reset`}),(0,Z.jsx)(`button`,{style:{flex:1,padding:`8px 12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:S,onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Clear`}),(0,Z.jsx)(`button`,{style:{flex:1,padding:`8px 12px`,fontSize:`var(--grid-font-size-sm, 12px)`,fontWeight:500,color:`var(--grid-text-inverse)`,backgroundColor:`var(--grid-primary)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`,transition:`all 0.15s`},onClick:x,onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary)`,children:`Apply`})]})]})};var er=e=>e!=null&&`operator`in e&&`conditions`in e,tr=({filterValue:e,onApplyFilter:t,onClose:n,anchorEl:r,showAdvancedButton:i,onSwitchToAdvanced:a})=>{let o=er(e)?null:e,s=o?.type||`contains`,c=o?.value||``,[l,u]=(0,b.useState)(s),[d,f]=(0,b.useState)(c);return(0,Z.jsxs)(`div`,{style:{position:`fixed`,top:r?r.getBoundingClientRect().bottom+5:0,left:r?r.getBoundingClientRect().left:0,minWidth:`280px`,backgroundColor:`var(--grid-bg)`,boxShadow:`var(--grid-shadow-medium, 0 10px 15px -3px rgba(0, 0, 0, 0.1))`,borderRadius:`var(--grid-border-radius, 8px)`,border:`var(--grid-border-width, 1px) solid var(--grid-border)`,padding:`16px`,zIndex:1e3},onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Filter Type`}),(0,Z.jsxs)(`select`,{style:{width:`100%`,padding:`8px 12px`,border:`var(--grid-border-width, 1px) solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:l,onChange:e=>u(e.target.value),children:[(0,Z.jsx)(`option`,{value:`contains`,children:`Contains`}),(0,Z.jsx)(`option`,{value:`notContains`,children:`Not Contains`}),(0,Z.jsx)(`option`,{value:`equals`,children:`Equals`}),(0,Z.jsx)(`option`,{value:`startsWith`,children:`Starts With`}),(0,Z.jsx)(`option`,{value:`endsWith`,children:`Ends With`})]})]}),(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Value`}),(0,Z.jsx)(`input`,{type:`text`,style:{width:`100%`,padding:`8px 12px`,border:`var(--grid-border-width, 1px) solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:d,onChange:e=>f(e.target.value),placeholder:`Enter text...`,autoFocus:!0})]}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,justifyContent:`flex-end`},children:[(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{f(``),t(null),n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Clear`}),(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text-inverse)`,backgroundColor:`var(--grid-primary)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{t(d?{type:l,value:d}:null),n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary)`,children:`Apply`})]})]})},nr=({filterValue:e,onApplyFilter:t,onClose:n,anchorEl:r,showAdvancedButton:i,onSwitchToAdvanced:a})=>{let o=er(e)?null:e,s=o?.type||`equals`,c=o?.value||``,l=o?.value2||``,[u,d]=(0,b.useState)(s),[f,p]=(0,b.useState)(c),[m,h]=(0,b.useState)(l);return(0,Z.jsxs)(`div`,{style:{position:`fixed`,top:r?r.getBoundingClientRect().bottom+5:0,left:r?r.getBoundingClientRect().left:0,minWidth:`280px`,backgroundColor:`var(--grid-bg)`,boxShadow:`var(--grid-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))`,borderRadius:`var(--grid-border-radius, 8px)`,border:`1px solid var(--grid-border)`,padding:`16px`,zIndex:1e3},onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Filter Type`}),(0,Z.jsxs)(`select`,{style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:u,onChange:e=>d(e.target.value),children:[(0,Z.jsx)(`option`,{value:`equals`,children:`Equals`}),(0,Z.jsx)(`option`,{value:`notEquals`,children:`Not Equals`}),(0,Z.jsx)(`option`,{value:`greaterThan`,children:`Greater Than`}),(0,Z.jsx)(`option`,{value:`greaterThanOrEqual`,children:`Greater Than or Equal`}),(0,Z.jsx)(`option`,{value:`lessThan`,children:`Less Than`}),(0,Z.jsx)(`option`,{value:`lessThanOrEqual`,children:`Less Than or Equal`}),(0,Z.jsx)(`option`,{value:`inRange`,children:`In Range`})]})]}),(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Value`}),(0,Z.jsx)(`input`,{type:`number`,style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:f,onChange:e=>p(e.target.value),placeholder:`Enter number...`,autoFocus:!0})]}),u===`inRange`&&(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`To`}),(0,Z.jsx)(`input`,{type:`number`,style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:m,onChange:e=>h(e.target.value),placeholder:`Enter max value...`})]}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,justifyContent:`flex-end`},children:[(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{p(``),h(``),t(null),n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Clear`}),(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text-inverse)`,backgroundColor:`var(--grid-primary)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{if(f){let e={type:u,value:parseFloat(f)};u===`inRange`&&m&&(e.value2=parseFloat(m)),t(e)}else t(null);n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary)`,children:`Apply`})]})]})},rr=({filterValue:e,onApplyFilter:t,onClose:n,anchorEl:r,showAdvancedButton:i,onSwitchToAdvanced:a})=>{let o=er(e)?null:e,s=o?.type||`equals`,c=o?.value||``,l=o?.value2||``,[u,d]=(0,b.useState)(s),[f,p]=(0,b.useState)(c),[m,h]=(0,b.useState)(l);return(0,Z.jsxs)(`div`,{style:{position:`fixed`,top:r?r.getBoundingClientRect().bottom+5:0,left:r?r.getBoundingClientRect().left:0,minWidth:`280px`,backgroundColor:`var(--grid-bg)`,boxShadow:`var(--grid-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))`,borderRadius:`var(--grid-border-radius, 8px)`,border:`1px solid var(--grid-border)`,padding:`16px`,zIndex:1e3},onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Filter Type`}),(0,Z.jsxs)(`select`,{style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:u,onChange:e=>d(e.target.value),children:[(0,Z.jsx)(`option`,{value:`equals`,children:`Equals`}),(0,Z.jsx)(`option`,{value:`before`,children:`Before`}),(0,Z.jsx)(`option`,{value:`after`,children:`After`}),(0,Z.jsx)(`option`,{value:`inRange`,children:`In Range`})]})]}),(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`Date`}),(0,Z.jsx)(`input`,{type:`date`,style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:f,onChange:e=>p(e.target.value),autoFocus:!0})]}),u===`inRange`&&(0,Z.jsxs)(`div`,{style:{marginBottom:`12px`},children:[(0,Z.jsx)(`label`,{style:{display:`block`,fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`,marginBottom:`4px`},children:`To`}),(0,Z.jsx)(`input`,{type:`date`,style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:m,onChange:e=>h(e.target.value)})]}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,justifyContent:`flex-end`},children:[(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{p(``),h(``),t(null),n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Clear`}),(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text-inverse)`,backgroundColor:`var(--grid-primary)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{if(f){let e={type:u,value:f};u===`inRange`&&m&&(e.value2=m),t(e)}else t(null);n()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary)`,children:`Apply`})]})]})},ir=({column:e,filterValue:t,onApplyFilter:n,onClose:r,rows:i,anchorEl:a,showAdvancedButton:o,onSwitchToAdvanced:s})=>{let c=Array.from(new Set(i.map(t=>t[e.field]).filter(e=>e!=null))),l=er(t)?null:t,[u,d]=(0,b.useState)(l&&l.values?new Set(l.values):new Set),[f,p]=(0,b.useState)(``),m=c.filter(e=>String(e).toLowerCase().includes(f.toLowerCase())),h=e=>{let t=new Set(u);t.has(e)?t.delete(e):t.add(e),d(t)};return(0,Z.jsxs)(`div`,{style:{position:`fixed`,top:a?a.getBoundingClientRect().bottom+5:0,left:a?a.getBoundingClientRect().left:0,minWidth:`280px`,maxHeight:`400px`,backgroundColor:`var(--grid-bg)`,boxShadow:`var(--grid-shadow, 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05))`,borderRadius:`var(--grid-border-radius, 8px)`,border:`1px solid var(--grid-border)`,padding:`16px`,zIndex:1e3,display:`flex`,flexDirection:`column`},onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`div`,{style:{marginBottom:`12px`},children:(0,Z.jsx)(`input`,{type:`text`,style:{width:`100%`,padding:`8px 12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,fontSize:`var(--grid-font-size, 14px)`,outline:`none`,backgroundColor:`var(--grid-bg)`,color:`var(--grid-text)`},value:f,onChange:e=>p(e.target.value),placeholder:`Search values...`,autoFocus:!0})}),(0,Z.jsx)(`div`,{style:{marginBottom:`8px`},children:(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,padding:`8px`,borderRadius:`4px`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:u.size===m.length&&m.length>0,onChange:()=>{u.size===m.length?d(new Set):d(new Set(m))},style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`var(--grid-font-size, 14px)`,fontWeight:500,color:`var(--grid-text)`},children:`(Select All)`})]})}),(0,Z.jsx)(`div`,{style:{flex:1,overflowY:`auto`,marginBottom:`12px`,border:`1px solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,maxHeight:`200px`},children:m.map((e,t)=>(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,cursor:`pointer`,padding:`8px`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:u.has(e),onChange:()=>h(e),style:{width:`16px`,height:`16px`,cursor:`pointer`}}),(0,Z.jsx)(`span`,{style:{fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text)`},children:String(e)})]},t))}),(0,Z.jsxs)(`div`,{style:{display:`flex`,gap:`8px`,justifyContent:`flex-end`,paddingTop:`8px`,borderTop:`1px solid var(--grid-border)`},children:[(0,Z.jsx)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text)`,backgroundColor:`var(--grid-bg-alt)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{d(new Set),n(null),r()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-bg-alt)`,children:`Clear`}),(0,Z.jsxs)(`button`,{style:{padding:`6px 12px`,fontSize:`var(--grid-font-size, 14px)`,color:`var(--grid-text-inverse)`,backgroundColor:`var(--grid-primary)`,border:`none`,borderRadius:`var(--grid-border-radius, 6px)`,cursor:`pointer`},onClick:()=>{u.size>0?n({type:`set`,values:Array.from(u)}):n(null),r()},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary-hover)`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`var(--grid-primary)`,children:[`Apply (`,u.size,`)`]})]})]})},ar=({column:e,filterValue:t,onApplyFilter:n,onClose:r,rows:i,anchorEl:a})=>(0,Z.jsx)(ir,{column:e,filterValue:t,onApplyFilter:n,onClose:r,rows:i,anchorEl:a});const or=({columns:e,displayColumnOrder:t,columnWidths:n,filterConfig:r,dispatch:i,pinnedLeft:a,pinnedRight:o,rows:s})=>{let[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)({}),[f,p]=(0,b.useState)(null),m=new Set(a),h=new Set(o),g={},_=0;a.forEach(e=>{g[e]=_,_+=n[e]||150});let v={},y=0;[...o].reverse().forEach(e=>{v[e]=y,y+=n[e]||150});let x=new Map(e.map(e=>[e.field,e])),S=e=>{let t={width:`${n[e]||150}px`};return m.has(e)?(t.position=`sticky`,t.left=`${g[e]}px`,t.zIndex=20,t.backgroundColor=`var(--grid-header-bg)`):h.has(e)&&(t.position=`sticky`,t.right=`${v[e]}px`,t.zIndex=20,t.backgroundColor=`var(--grid-header-bg)`),t},C=e=>{if(e.filterType)return e.filterType;let t=e.field.toLowerCase();return t.includes(`date`)||t.includes(`time`)?`date`:t.includes(`salary`)||t.includes(`price`)||t.includes(`amount`)||t.includes(`count`)?`number`:t.includes(`status`)||t.includes(`department`)||t.includes(`category`)?`set`:`text`},w=(e,t)=>{t.stopPropagation();let n=r[e];er(n)||t.shiftKey?(d({...u,[e]:t.currentTarget}),p(e),l(null)):(d({...u,[e]:t.currentTarget}),l(e),p(null))},T=()=>{l(null),p(null)},E=(e,t)=>{i({type:`SET_FILTER`,payload:{field:e,value:t}})},D=e=>{l(null),p(e)};(0,b.useEffect)(()=>{let e=()=>{c&&l(null)};if(c)return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[c]);let O=e=>{let t=C(e),n={column:e,filterValue:r[e.field],onApplyFilter:t=>E(e.field,t),onClose:T,rows:s,anchorEl:u[e.field],showAdvancedButton:!0,onSwitchToAdvanced:()=>D(e.field)};switch(t){case`number`:return(0,Z.jsx)(nr,{...n});case`date`:return(0,Z.jsx)(rr,{...n});case`set`:return(0,Z.jsx)(ir,{...n});case`multi`:return(0,Z.jsx)(ar,{...n});default:return(0,Z.jsx)(tr,{...n})}},k=e=>{let t=r[e.field],n=u[e.field];return(0,Z.jsx)($n,{column:e,filterValue:er(t)?t:null,onApply:t=>E(e.field,t),onClose:T,rows:s,anchorEl:n})},A=e=>{let t=r[e];if(!t)return``;if(er(t)){let e=t.conditions.length;return`${e} condition${e>1?`s`:``} (${t.operator})`}return t.type===`set`&&t.values?`${t.values.length} selected`:t.type===`inRange`?`${t.value} - ${t.value2}`:String(t.value||``)},j=e=>!!r[e];return(0,Z.jsx)(Z.Fragment,{children:(0,Z.jsx)(`div`,{style:{display:`flex`,minWidth:`100%`,borderBottom:`1px solid var(--grid-border)`,backgroundColor:`var(--grid-header-bg)`},children:t.map(e=>{let t=x.get(e);if(!t||t.filterable===!1)return(0,Z.jsx)(`div`,{style:{...S(e),borderRight:`1px solid var(--grid-border)`,flexShrink:0,minHeight:`38px`}},e);let n=j(e);return(0,Z.jsxs)(`div`,{style:{...S(e),borderRight:`1px solid var(--grid-border)`,flexShrink:0,padding:`6px 8px`,position:`relative`,display:`flex`,alignItems:`center`},children:[(0,Z.jsx)(`div`,{style:{width:`100%`,cursor:`pointer`},onClick:t=>w(e,t),title:`Click to filter, Shift+Click for advanced filter`,children:(0,Z.jsxs)(`div`,{style:{width:`100%`,padding:`4px 8px`,fontSize:`var(--grid-font-size-sm, 12px)`,border:`1px solid`,borderColor:n?`var(--grid-primary)`:`var(--grid-border)`,borderRadius:`var(--grid-border-radius, 4px)`,backgroundColor:n?`var(--grid-primary-bg)`:`var(--grid-bg)`,color:n?`var(--grid-primary)`:`var(--grid-text-secondary)`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:`6px`,transition:`border-color 0.15s`},onMouseEnter:e=>{n||(e.currentTarget.style.borderColor=`var(--grid-border-hover)`)},onMouseLeave:e=>{n||(e.currentTarget.style.borderColor=`var(--grid-border)`)},children:[(0,Z.jsx)(`span`,{style:{flex:1,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:n?A(e):`Filter...`}),(0,Z.jsx)(`svg`,{style:{flexShrink:0,color:n?`var(--grid-primary)`:`var(--grid-text-muted)`},width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,strokeWidth:`2.5`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 4h18v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V20l-4-2v-3.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z`})})]})}),c===e&&O(t),f===e&&k(t)]},e)})})})},sr=({manager:e,currentLayout:t,onLoadPreset:n,onResetLayout:r})=>{let[i,a]=(0,b.useState)([]),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(``),[f,p]=(0,b.useState)(``),[m,h]=(0,b.useState)(!1),[g,_]=(0,b.useState)(null),v=(0,b.useCallback)(async()=>{try{h(!0),a((await e.listPresets()).filter(e=>e.id!==`__autosave__`)),_(null)}catch(e){_(`Failed to load presets`),console.error(e)}finally{h(!1)}},[e]);(0,b.useEffect)(()=>{v()},[v]);let y=async()=>{if(!u.trim()){_(`Please enter a preset name`);return}try{h(!0);let{createPreset:n}=await w(async()=>{let{createPreset:e}=await import(`./layoutPersistence-ieiR6LTK.js`);return{createPreset:e}},[]),r=n(u.trim(),t,f.trim());await e.savePreset(r),await v(),l(!1),d(``),p(``),_(null)}catch(e){_(`Failed to save preset`),console.error(e)}finally{h(!1)}},x=async t=>{try{h(!0);let r=await e.loadPreset(t);r&&(n(r.layout),s(!1),_(null))}catch(e){_(`Failed to load preset`),console.error(e)}finally{h(!1)}},S=async(t,n)=>{if(n.stopPropagation(),confirm(`Are you sure you want to delete this preset?`))try{h(!0),await e.deletePreset(t),await v(),_(null)}catch(e){_(`Failed to delete preset`),console.error(e)}finally{h(!1)}},C=async(n,r)=>{if(r.stopPropagation(),confirm(`Update this preset with current layout?`))try{h(!0);let r={...n,layout:t};await e.savePreset(r),await v(),_(null)}catch(e){_(`Failed to update preset`),console.error(e)}finally{h(!1)}},T=e=>new Date(e).toLocaleString();return(0,Z.jsxs)(`div`,{className:`relative inline-block`,children:[(0,Z.jsxs)(`button`,{onClick:()=>s(!o),style:{padding:`6px 12px`,fontSize:`14px`,backgroundColor:`white`,border:`1px solid #d1d5db`,borderRadius:`4px`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:`8px`},disabled:m,children:[(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`,flexShrink:0},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 7h16M4 12h16M4 17h16`})}),`Layout Presets`,(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`,flexShrink:0,transform:o?`rotate(180deg)`:`rotate(0deg)`,transition:`transform 0.2s`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 9l-7 7-7-7`})})]}),o&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:10},onClick:()=>s(!1)}),(0,Z.jsxs)(`div`,{style:{position:`absolute`,right:0,marginTop:`8px`,width:`320px`,backgroundColor:`white`,border:`1px solid #d1d5db`,borderRadius:`8px`,boxShadow:`0 10px 15px -3px rgba(0, 0, 0, 0.1)`,zIndex:20,maxHeight:`384px`,overflowY:`auto`},children:[(0,Z.jsx)(`div`,{style:{padding:`12px`,borderBottom:`1px solid #e5e7eb`,backgroundColor:`#f9fafb`},children:(0,Z.jsx)(`h3`,{style:{fontWeight:`600`,fontSize:`14px`,color:`#111827`},children:`Layout Presets`})}),g&&(0,Z.jsx)(`div`,{style:{padding:`12px`,backgroundColor:`#fef2f2`,borderBottom:`1px solid #fecaca`},children:(0,Z.jsx)(`p`,{style:{fontSize:`14px`,color:`#dc2626`},children:g})}),(0,Z.jsxs)(`div`,{style:{padding:`8px`,borderBottom:`1px solid #e5e7eb`,display:`flex`,gap:`8px`},children:[(0,Z.jsxs)(`button`,{onClick:()=>{l(!0),s(!1)},style:{flex:1,padding:`8px 12px`,fontSize:`14px`,backgroundColor:`#2563eb`,color:`white`,border:`none`,borderRadius:`4px`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`8px`},children:[(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`,flexShrink:0},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4`})}),`Save Current`]}),(0,Z.jsxs)(`button`,{onClick:()=>{r(),s(!1)},style:{flex:1,padding:`8px 12px`,fontSize:`14px`,backgroundColor:`#4b5563`,color:`white`,border:`none`,borderRadius:`4px`,cursor:`pointer`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`8px`},children:[(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`,flexShrink:0},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15`})}),`Reset`]})]}),(0,Z.jsx)(`div`,{style:{maxHeight:`256px`,overflowY:`auto`},children:m&&i.length===0?(0,Z.jsx)(`div`,{style:{padding:`16px`,textAlign:`center`,color:`#6b7280`,fontSize:`14px`},children:`Loading presets...`}):i.length===0?(0,Z.jsx)(`div`,{style:{padding:`16px`,textAlign:`center`,color:`#6b7280`,fontSize:`14px`},children:`No saved presets. Save your current layout to get started.`}):(0,Z.jsx)(`div`,{children:i.map(e=>(0,Z.jsx)(`div`,{style:{padding:`12px`,cursor:`pointer`,borderBottom:`1px solid #e5e7eb`},onClick:()=>x(e.id),onMouseEnter:e=>{e.currentTarget.style.backgroundColor=`#f9fafb`;let t=e.currentTarget.querySelector(`.preset-actions`);t&&(t.style.opacity=`1`)},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=`transparent`;let t=e.currentTarget.querySelector(`.preset-actions`);t&&(t.style.opacity=`0`)},children:(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,justifyContent:`space-between`},children:[(0,Z.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,Z.jsx)(`h4`,{style:{fontSize:`14px`,fontWeight:`500`,color:`#111827`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.name}),e.description&&(0,Z.jsx)(`p`,{style:{fontSize:`12px`,color:`#6b7280`,marginTop:`4px`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e.description}),(0,Z.jsxs)(`p`,{style:{fontSize:`12px`,color:`#9ca3af`,marginTop:`4px`},children:[`Updated: `,T(e.updatedAt)]})]}),(0,Z.jsxs)(`div`,{className:`preset-actions`,style:{display:`flex`,gap:`4px`,marginLeft:`8px`,opacity:0,transition:`opacity 0.2s`},children:[(0,Z.jsx)(`button`,{onClick:t=>C(e,t),style:{padding:`4px`,color:`#2563eb`,backgroundColor:`transparent`,border:`none`,borderRadius:`4px`,cursor:`pointer`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`#eff6ff`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,title:`Update with current layout`,children:(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15`})})}),(0,Z.jsx)(`button`,{onClick:t=>S(e.id,t),style:{padding:`4px`,color:`#dc2626`,backgroundColor:`transparent`,border:`none`,borderRadius:`4px`,cursor:`pointer`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`#fef2f2`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,title:`Delete preset`,children:(0,Z.jsx)(`svg`,{style:{width:`14px`,height:`14px`},fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`,children:(0,Z.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})})})]})]})},e.id))})})]})]}),c&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{style:{position:`fixed`,inset:0,backgroundColor:`rgba(0, 0, 0, 0.5)`,zIndex:30,display:`flex`,alignItems:`center`,justifyContent:`center`},onClick:()=>l(!1)}),(0,Z.jsx)(`div`,{style:{position:`fixed`,inset:0,zIndex:40,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`16px`},children:(0,Z.jsxs)(`div`,{style:{backgroundColor:`white`,borderRadius:`8px`,boxShadow:`0 25px 50px -12px rgba(0, 0, 0, 0.25)`,maxWidth:`448px`,width:`100%`,padding:`24px`},onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`h2`,{style:{fontSize:`20px`,fontWeight:`600`,marginBottom:`16px`},children:`Save Layout Preset`}),g&&(0,Z.jsx)(`div`,{style:{marginBottom:`16px`,padding:`12px`,backgroundColor:`#fef2f2`,border:`1px solid #fecaca`,borderRadius:`4px`},children:(0,Z.jsx)(`p`,{style:{fontSize:`14px`,color:`#dc2626`},children:g})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`16px`},children:[(0,Z.jsx)(`label`,{htmlFor:`preset-name`,style:{display:`block`,fontSize:`14px`,fontWeight:`500`,color:`#374151`,marginBottom:`4px`},children:`Preset Name *`}),(0,Z.jsx)(`input`,{id:`preset-name`,type:`text`,value:u,onChange:e=>d(e.target.value),style:{width:`100%`,padding:`8px 12px`,border:`1px solid #d1d5db`,borderRadius:`4px`,fontSize:`14px`},placeholder:`e.g., Sales Dashboard Layout`,autoFocus:!0})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{htmlFor:`preset-description`,style:{display:`block`,fontSize:`14px`,fontWeight:`500`,color:`#374151`,marginBottom:`4px`},children:`Description (optional)`}),(0,Z.jsx)(`textarea`,{id:`preset-description`,value:f,onChange:e=>p(e.target.value),style:{width:`100%`,padding:`8px 12px`,border:`1px solid #d1d5db`,borderRadius:`4px`,fontSize:`14px`},placeholder:`Add a description...`,rows:3})]})]}),(0,Z.jsxs)(`div`,{style:{marginTop:`24px`,display:`flex`,gap:`12px`,justifyContent:`flex-end`},children:[(0,Z.jsx)(`button`,{onClick:()=>{l(!1),d(``),p(``),_(null)},style:{padding:`8px 16px`,fontSize:`14px`,color:`#374151`,backgroundColor:`#f3f4f6`,border:`none`,borderRadius:`4px`,cursor:`pointer`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`#e5e7eb`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`#f3f4f6`,disabled:m,children:`Cancel`}),(0,Z.jsx)(`button`,{onClick:y,style:{padding:`8px 16px`,fontSize:`14px`,color:`white`,backgroundColor:`#2563eb`,border:`none`,borderRadius:`4px`,cursor:`pointer`},onMouseEnter:e=>e.currentTarget.style.backgroundColor=`#1d4ed8`,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`#2563eb`,disabled:m,children:m?`Saving...`:`Save Preset`})]})]})})]})]})},cr=({x:e,y:t,items:n,onClose:r})=>{let i=(0,b.useRef)(null);(0,b.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&r()},t=e=>{i.current&&!i.current.contains(e.target)&&(e.preventDefault(),r())},n=setTimeout(()=>{document.addEventListener(`mousedown`,e),document.addEventListener(`contextmenu`,t)},100);return()=>{clearTimeout(n),document.removeEventListener(`mousedown`,e),document.removeEventListener(`contextmenu`,t)}},[r]),(0,b.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[r]),(0,b.useEffect)(()=>{if(i.current){let n=i.current,r=n.getBoundingClientRect(),a=window.innerWidth,o=window.innerHeight,s=e,c=t;r.right>a&&(s=a-r.width-10),r.bottom>o&&(c=o-r.height-10),(s!==e||c!==t)&&(n.style.left=`${s}px`,n.style.top=`${c}px`)}},[e,t]);let a=(0,b.useCallback)(e=>{e.disabled||e.type===`separator`||(e.onClick&&e.onClick(),e.submenu||r())},[r]),o=(e,t)=>e.type===`separator`?(0,Z.jsx)(`div`,{className:`context-menu-separator`,role:`separator`},`separator-${t}`):(0,Z.jsxs)(`div`,{className:`context-menu-item ${e.disabled?`disabled`:``} ${e.danger?`danger`:``}`,onClick:()=>a(e),role:`menuitem`,"aria-disabled":e.disabled,tabIndex:e.disabled?-1:0,children:[e.icon&&(0,Z.jsx)(`span`,{className:`context-menu-icon`,children:e.icon}),(0,Z.jsx)(`span`,{className:`context-menu-label`,children:e.label}),e.shortcut&&(0,Z.jsx)(`span`,{className:`context-menu-shortcut`,children:e.shortcut}),e.submenu&&(0,Z.jsx)(`span`,{className:`context-menu-arrow`,children:`▶`})]},e.id||t);return(0,Z.jsx)(`div`,{ref:i,className:`context-menu`,style:{left:e,top:t},role:`menu`,"aria-label":`Context menu`,children:n.map((e,t)=>o(e,t))})},lr=async(e,t,n,r=!1)=>{let i=Array.from(e),a=n.filter(e=>i.includes(e.id));if(a.length===0)return;let o=``;r&&(o+=t.map(e=>e.headerName).join(` `)+`
|
|
41
41
|
`),o+=a.map(e=>t.map(t=>{let n=e[t.field];return n==null?``:typeof n==`object`?JSON.stringify(n):String(n)}).join(` `)).join(`
|
|
42
42
|
`);try{await navigator.clipboard.writeText(o)}catch(e){console.error(`Failed to copy to clipboard:`,e);let t=document.createElement(`textarea`);t.value=o,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}},ur=(e,t,n,r=`export.csv`)=>{let i=Array.from(e),a=n.filter(e=>i.includes(e.id));if(a.length===0)return;let o=``;o+=t.map(e=>`"${e.headerName}"`).join(`,`)+`
|
|
43
43
|
`,o+=a.map(e=>t.map(t=>{let n=e[t.field];return n==null?`""`:typeof n==`object`?`"${JSON.stringify(n).replace(/"/g,`""`)}"`:`"${String(n).replace(/"/g,`""`)}"`}).join(`,`)).join(`
|
|
44
44
|
`);let s=new Blob([o],{type:`text/csv;charset=utf-8;`}),c=document.createElement(`a`),l=URL.createObjectURL(s);c.setAttribute(`href`,l),c.setAttribute(`download`,r),c.style.visibility=`hidden`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(l)},dr=(e,t,n=60,r=500,i=32)=>{let a=document.createElement(`canvas`).getContext(`2d`);if(!a)return e.width||150;a.font=`14px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`;let o=a.measureText(e.headerName).width+i,s=Math.min(t.length,100),c=t.slice(0,s),l=0;for(let t of c){let n=t[e.field],r=n==null?``:String(n),o=a.measureText(r).width+i;l=Math.max(l,o)}let u=Math.max(o,l);return Math.max(n,Math.min(r,u))},fr=(e,t)=>{let n={};return e.forEach(e=>{n[e.field]=dr(e,t)}),n},pr=e=>({type:`equals`,value:e}),mr=(e,t,n=100)=>{let r=new Set;for(let i of t){let t=i[e.field];if(t!=null&&r.add(t),r.size>=n)break}return Array.from(r).sort((e,t)=>{if(typeof e==`string`&&typeof t==`string`)return e.localeCompare(t);if(typeof e==`number`&&typeof t==`number`)return e-t;let n=String(e),r=String(t);return n.localeCompare(r)})},hr=({config:e={},columns:t,rows:n,selectedRows:r,onPinColumn:i,onUnpinColumn:a,onToggleColumnVisibility:o,onResizeColumn:s,onAutoSizeAllColumns:c,onSetFilter:l,onPinRowTop:u,onPinRowBottom:d,onUnpinRow:f,pinnedColumnsLeft:p=[],pinnedColumnsRight:m=[],pinnedRowsTop:h=[],pinnedRowsBottom:g=[]})=>{let[_,v]=(0,b.useState)({isOpen:!1,x:0,y:0,items:[],contextType:null}),y=(0,b.useMemo)(()=>({enabled:e?.enabled!==!1,showCopy:e?.showCopy!==!1,showExport:e?.showExport!==!1,showColumnOptions:e?.showColumnOptions!==!1,showFilterByValue:e?.showFilterByValue!==!1,customItems:e?.customItems||[],onBeforeShow:e?.onBeforeShow}),[e?.enabled,e?.showCopy,e?.showExport,e?.showColumnOptions,e?.showFilterByValue,e?.customItems,e?.onBeforeShow]),x=(0,b.useCallback)((e,i)=>{let a=[],o=r.size>0,s=e.id,c=h.includes(s),p=g.includes(s);if(u&&d&&f&&(c||p?a.push({id:`unpin-row`,label:`Unpin Row`,icon:`📍`,onClick:()=>f(s)}):(a.push({id:`pin-row-top`,label:`Pin Row to Top`,icon:`📌`,onClick:()=>u(s)}),a.push({id:`pin-row-bottom`,label:`Pin Row to Bottom`,icon:`📌`,onClick:()=>d(s)})),a.push({type:`separator`})),y.showCopy&&(a.push({id:`copy`,label:`Copy`,icon:`📋`,shortcut:`Ctrl+C`,onClick:()=>{if(o)lr(r,t,n,!1);else{let t=e[i.field],n=t==null?``:String(t);navigator.clipboard.writeText(n)}}}),a.push({id:`copy-with-headers`,label:`Copy with Headers`,icon:`📋`,onClick:()=>{o&&lr(r,t,n,!0)},disabled:!o})),y.showExport&&o&&a.push({id:`export-selected`,label:`Export Selected Range`,icon:`📤`,onClick:()=>{ur(r,t,n)}}),a.length>0&&(y.showFilterByValue||y.customItems.length>0)&&a.push({type:`separator`}),y.showFilterByValue&&l){let t=e[i.field];a.push({id:`filter-by-value`,label:`Filter by "${String(t)}"`,icon:`🔍`,onClick:()=>{l(i.field,pr(t))},disabled:t==null})}return y.customItems.length>0&&(a.length>0&&a.push({type:`separator`}),a.push(...y.customItems)),a},[y,r,t,n,l,u,d,f,h,g]),S=(0,b.useCallback)(e=>{let r=[],u=p.includes(e.field),d=m.includes(e.field),f=u||d;if(y.showColumnOptions&&e.pinnable!==!1&&(f?r.push({id:`unpin`,label:`Unpin Column`,icon:`📍`,onClick:()=>a?.(e.field)}):(r.push({id:`pin-left`,label:`Pin Left`,icon:`📌`,onClick:()=>i?.(e.field,`left`)}),r.push({id:`pin-right`,label:`Pin Right`,icon:`📌`,onClick:()=>i?.(e.field,`right`)})),r.push({type:`separator`})),y.showColumnOptions&&(r.push({id:`auto-size`,label:`Auto-size This Column`,icon:`↔️`,onClick:()=>{let t=dr(e,n);s?.(e.field,t)}}),r.push({id:`resize-to-fit`,label:`Resize to Fit`,icon:`↔️`,onClick:()=>{let t=dr(e,n);s?.(e.field,t)}}),r.push({id:`auto-size-all`,label:`Auto-size All Columns`,icon:`⇔`,onClick:()=>{let e=fr(t,n);c?.(e)}}),r.push({type:`separator`})),y.showColumnOptions&&r.push({id:`hide`,label:`Hide Column`,icon:`👁️`,onClick:()=>o?.(e.field)}),y.showFilterByValue&&l&&e.filterable!==!1){r.push({type:`separator`});let t=mr(e,n,10);t.length>0&&r.push({id:`filter-by-value-header`,label:`Filter by Value`,icon:`🔍`,submenu:t.map((t,n)=>({id:`filter-value-${n}`,label:String(t),onClick:()=>{l(e.field,pr(t))}}))})}return y.customItems.length>0&&(r.push({type:`separator`}),r.push(...y.customItems)),r},[y,p,m,t,n,i,a,s,c,o,l]);return{contextMenu:_,handleContextMenu:(0,b.useCallback)(e=>{if(!y.enabled)return;e.event.preventDefault();let t=[];if(e.type===`cell`&&e.row&&e.column?t=x(e.row,e.column):e.type===`header`&&e.column&&(t=S(e.column)),y.onBeforeShow){let n=y.onBeforeShow(e);n!==null&&(t=n)}t.length>0&&v({isOpen:!0,x:e.event.clientX,y:e.event.clientY,items:t,contextType:e.type,targetRow:e.row,targetColumn:e.column,targetRowIndex:e.rowIndex,targetColumnIndex:e.columnIndex})},[y,x,S]),closeContextMenu:(0,b.useCallback)(()=>{v({isOpen:!1,x:0,y:0,items:[],contextType:null})},[])}};var gr=g();const _r=({state:e,maxWidth:t=300,offset:n=8})=>{let r=(0,b.useRef)(null),[i,a]=(0,b.useState)({x:0,y:0}),[o,s]=(0,b.useState)(e.placement);if((0,b.useLayoutEffect)(()=>{if(!e.isVisible||!r.current||!e.targetRect)return;let t=r.current.getBoundingClientRect(),i=window.innerWidth,o=window.innerHeight,c=e.targetRect,l=e.x,u=e.y,d=e.placement;if(e.placement===`auto`||e.placement===`top`||e.placement===`bottom`){let r=c.top,a=o-c.bottom,s=c.left,f=i-c.right;e.placement===`auto`&&(d=a>=t.height+n?`bottom`:r>=t.height+n?`top`:f>=t.width+n?`right`:s>=t.width+n?`left`:`bottom`),d===`top`?(l=c.left+c.width/2-t.width/2,u=c.top-t.height-n):d===`bottom`?(l=c.left+c.width/2-t.width/2,u=c.bottom+n):d===`left`?(l=c.left-t.width-n,u=c.top+c.height/2-t.height/2):d===`right`&&(l=c.right+n,u=c.top+c.height/2-t.height/2),l<10?l=10:l+t.width>i-10&&(l=i-t.width-10),u<10?u=10:u+t.height>o-10&&(u=o-t.height-10)}else e.placement===`left`?(l=c.left-t.width-n,u=c.top+c.height/2-t.height/2):e.placement===`right`&&(l=c.right+n,u=c.top+c.height/2-t.height/2),u<10?u=10:u+t.height>o-10&&(u=o-t.height-10),l<10?l=10:l+t.width>i-10&&(l=i-t.width-10);a({x:l,y:u}),s(d)},[e.isVisible,e.x,e.y,e.targetRect,e.placement,n]),!e.isVisible||!e.content)return null;let c=typeof e.content==`string`?{content:e.content}:e.content;return(0,gr.createPortal)((0,Z.jsxs)(`div`,{ref:r,role:`tooltip`,"aria-live":`polite`,style:{position:`fixed`,left:`${i.x}px`,top:`${i.y}px`,maxWidth:`${t}px`,zIndex:99999,pointerEvents:`none`,opacity:e.isVisible?1:0,transition:`opacity 0.15s ease-in-out`},children:[(0,Z.jsxs)(`div`,{style:{backgroundColor:`rgba(0, 0, 0, 0.9)`,color:`white`,padding:`8px 12px`,borderRadius:`6px`,fontSize:`13px`,lineHeight:`1.5`,boxShadow:`0 4px 12px rgba(0, 0, 0, 0.3)`,wordWrap:`break-word`},children:[c.title&&(0,Z.jsx)(`div`,{style:{fontWeight:`600`,marginBottom:`4px`,fontSize:`14px`},children:c.title}),(0,Z.jsx)(`div`,{children:c.content})]}),(0,Z.jsx)(`div`,{style:{position:`absolute`,width:0,height:0,borderStyle:`solid`,...o===`top`&&{bottom:`-6px`,left:`50%`,transform:`translateX(-50%)`,borderWidth:`6px 6px 0 6px`,borderColor:`rgba(0, 0, 0, 0.9) transparent transparent transparent`},...o===`bottom`&&{top:`-6px`,left:`50%`,transform:`translateX(-50%)`,borderWidth:`0 6px 6px 6px`,borderColor:`transparent transparent rgba(0, 0, 0, 0.9) transparent`},...o===`left`&&{right:`-6px`,top:`50%`,transform:`translateY(-50%)`,borderWidth:`6px 0 6px 6px`,borderColor:`transparent transparent transparent rgba(0, 0, 0, 0.9)`},...o===`right`&&{left:`-6px`,top:`50%`,transform:`translateY(-50%)`,borderWidth:`6px 6px 6px 0`,borderColor:`transparent rgba(0, 0, 0, 0.9) transparent transparent`}}})]}),document.body)},vr=({config:e={}}={})=>{let[t,n]=(0,b.useState)({isVisible:!1,x:0,y:0,placement:e.placement||`auto`,content:null,targetRect:null}),r=(0,b.useRef)(null),i=(0,b.useRef)(null),a=(0,b.useRef)(!1),{enabled:o=!0,showDelay:s=500,hideDelay:c=0,placement:l=`auto`,showCellTooltips:u=!1,showRowTooltips:d=!1,getCellTooltip:f,getRowTooltip:p}=e,m=(0,b.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null),i.current&&=(clearTimeout(i.current),null)},[]),h=(0,b.useCallback)((e,t)=>{if(!o||!t)return;m(),a.current=!0;let i=e.currentTarget.getBoundingClientRect(),c=typeof t==`string`?{content:t}:t;r.current=setTimeout(()=>{a.current&&n({isVisible:!0,x:i.left+i.width/2,y:i.top,placement:l,content:c,targetRect:i})},s)},[o,s,l,m]),g=(0,b.useCallback)(()=>{m(),a.current=!1,c>0?i.current=setTimeout(()=>{n(e=>({...e,isVisible:!1}))},c):n(e=>({...e,isVisible:!1}))},[c,m]),_=(0,b.useCallback)((e,t,n,r)=>{if(!o||!u||!f)return;let i=f(t,n,r);i&&h(e,i)},[o,u,f,h]),v=(0,b.useCallback)(()=>{g()},[g]),y=(0,b.useCallback)((e,t,n)=>{if(!o||!d||!p)return;let r=p(t,n);r&&h(e,r)},[o,d,p,h]),x=(0,b.useCallback)(()=>{g()},[g]);return(0,b.useEffect)(()=>()=>{m()},[m]),(0,b.useEffect)(()=>{let e=()=>{t.isVisible&&g()};return window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`scroll`,e,!0)}},[t.isVisible,g]),{tooltipState:t,tooltipHandlers:{onCellMouseEnter:_,onCellMouseLeave:v,onRowMouseEnter:y,onRowMouseLeave:x},hideTooltip:g}},yr={ultraCompact:{mode:`ultraCompact`,rowHeight:`24px`,cellPadding:`2px 6px`,headerPadding:`4px 6px`,fontSize:`12px`,fontSizeSmall:`10px`},compact:{mode:`compact`,rowHeight:`32px`,cellPadding:`4px 8px`,headerPadding:`6px 8px`,fontSize:`13px`,fontSizeSmall:`11px`},normal:{mode:`normal`,rowHeight:`44px`,cellPadding:`10px 12px`,headerPadding:`10px 12px`,fontSize:`14px`,fontSizeSmall:`12px`},comfortable:{mode:`comfortable`,rowHeight:`56px`,cellPadding:`14px 16px`,headerPadding:`14px 16px`,fontSize:`15px`,fontSizeSmall:`13px`}};function br(e=`normal`){return yr[e]}function xr(e){let t=br(e);return{"--grid-row-height":t.rowHeight,"--grid-cell-padding":t.cellPadding,"--grid-header-padding":t.headerPadding,"--grid-font-size":t.fontSize,"--grid-font-size-sm":t.fontSizeSmall}}function Sr(e){return{ultraCompact:`Ultra Compact`,compact:`Compact`,normal:`Normal`,comfortable:`Comfortable`}[e]}function Cr(e,t=`grid-density-mode`){try{localStorage.setItem(t,e)}catch(e){console.warn(`Failed to save density mode:`,e)}}function wr(e=`grid-density-mode`){try{let t=localStorage.getItem(e);if(t&&(t===`ultraCompact`||t===`compact`||t===`normal`||t===`comfortable`))return t}catch(e){console.warn(`Failed to load density mode:`,e)}return null}const Tr=({value:e,onChange:t,className:n=``,disabled:r=!1})=>{let i=[`ultraCompact`,`compact`,`normal`,`comfortable`];return(0,Z.jsx)(`div`,{className:`density-toggle ${n}`,style:{display:`inline-flex`,backgroundColor:`var(--grid-bg-alt, #f3f4f6)`,borderRadius:`6px`,padding:`2px`,border:`1px solid var(--grid-border, #e5e7eb)`,gap:`2px`},role:`group`,"aria-label":`Density mode selector`,children:i.map(n=>(0,Z.jsx)(`button`,{onClick:()=>t(n),disabled:r,className:`density-toggle-button ${e===n?`active`:``}`,style:{padding:`6px 14px`,fontSize:`13px`,fontWeight:e===n?`600`:`500`,color:e===n?`var(--grid-primary, #3b82f6)`:`var(--grid-text-secondary, #6b7280)`,backgroundColor:e===n?`var(--grid-bg, #ffffff)`:`transparent`,border:`none`,borderRadius:`4px`,cursor:r?`not-allowed`:`pointer`,transition:`all 0.2s ease`,opacity:r?.5:1,outline:`none`,whiteSpace:`nowrap`,boxShadow:e===n?`0 1px 2px rgba(0, 0, 0, 0.05)`:`none`},onMouseEnter:t=>{!r&&e!==n&&(t.currentTarget.style.color=`var(--grid-text, #111827)`,t.currentTarget.style.backgroundColor=`rgba(0, 0, 0, 0.02)`)},onMouseLeave:t=>{!r&&e!==n&&(t.currentTarget.style.color=`var(--grid-text-secondary, #6b7280)`,t.currentTarget.style.backgroundColor=`transparent`)},onFocus:e=>{e.currentTarget.style.boxShadow=`0 0 0 2px var(--grid-primary-light, #93c5fd)`},onBlur:t=>{t.currentTarget.style.boxShadow=e===n?`0 1px 2px rgba(0, 0, 0, 0.05)`:`none`},"aria-pressed":e===n,"aria-label":`${Sr(n)} density mode`,type:`button`,children:Sr(n)},n))})};function Er(e={}){let{initialMode:t=`normal`,persist:n=!0,persistenceKey:r=`grid-density-mode`,onChange:i}=e,[a,o]=(0,b.useState)(()=>{if(n){let e=wr(r);if(e)return e}return t});return{densityMode:a,setDensityMode:e=>{o(e),n&&Cr(e,r),i?.(e)},densityConfig:br(a),densityStyles:xr(a)}}var Dr=(e,t)=>{if(t.type===`isEmpty`)return e==null||String(e).trim()===``;if(t.type===`isNotEmpty`)return e!=null&&String(e).trim()!==``;if(e==null)return!1;let n=String(e).toLowerCase(),r=String(t.value||``).toLowerCase();switch(t.type){case`contains`:return n.includes(r);case`notContains`:return!n.includes(r);case`equals`:return n===r;case`notEquals`:return n!==r;case`startsWith`:return n.startsWith(r);case`endsWith`:return n.endsWith(r);default:return n.includes(r)}},Or=(e,t)=>{if(t.type===`isEmpty`)return e==null||typeof e==`number`&&isNaN(e);if(t.type===`isNotEmpty`)return e!=null&&!(typeof e==`number`&&isNaN(e));if(e==null)return!1;let n=typeof e==`number`?e:parseFloat(e);if(isNaN(n))return!1;let r=parseFloat(t.value);if(isNaN(r))return!1;switch(t.type){case`equals`:return n===r;case`notEquals`:return n!==r;case`greaterThan`:return n>r;case`greaterThanOrEqual`:return n>=r;case`lessThan`:return n<r;case`lessThanOrEqual`:return n<=r;case`inRange`:{let e=parseFloat(t.value2);return isNaN(e)?n>=r:n>=r&&n<=e}default:return n===r}},kr=(e,t)=>{if(t.type===`isEmpty`)return e==null;if(t.type===`isNotEmpty`)return e!=null;if(e==null)return!1;let n;if(n=e instanceof Date?e:new Date(e),isNaN(n.getTime()))return!1;let r=new Date(t.value);if(isNaN(r.getTime()))return!1;let i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),a=new Date(r.getFullYear(),r.getMonth(),r.getDate());switch(t.type){case`equals`:return i.getTime()===a.getTime();case`before`:return i.getTime()<a.getTime();case`after`:return i.getTime()>a.getTime();case`inRange`:{let e=new Date(t.value2);if(isNaN(e.getTime()))return i.getTime()>=a.getTime();let n=new Date(e.getFullYear(),e.getMonth(),e.getDate());return i.getTime()>=a.getTime()&&i.getTime()<=n.getTime()}default:return i.getTime()===a.getTime()}},Ar=(e,t)=>{if(!t.values||t.values.length===0)return!0;let n=t.values.includes(e);return t.type===`notIn`?!n:n},jr=e=>e.type===`set`||e.type===`in`||e.type===`notIn`||e.values?`set`:[`equals`,`notEquals`,`greaterThan`,`lessThan`,`greaterThanOrEqual`,`lessThanOrEqual`,`inRange`].includes(e.type||``)&&(typeof e.value==`number`||!isNaN(parseFloat(e.value)))?`number`:[`before`,`after`].includes(e.type||``)||e.value&&!isNaN(new Date(e.value).getTime())&&String(e.value).match(/\d{4}-\d{2}-\d{2}|\\d{1,2}\/\d{1,2}\/\d{4}/)?`date`:`text`,Mr=e=>e!=null&&`operator`in e&&`conditions`in e,Nr=(e,t,n)=>{let r=e[t];switch(jr(n)){case`number`:return Or(r,n);case`date`:return kr(r,n);case`set`:return Ar(r,n);default:return Dr(r,n)}},Pr=(e,t,n)=>{let{operator:r,conditions:i}=n;return!i||i.length===0?!0:r===`AND`?i.every(n=>Nr(e,t,n)):i.some(n=>Nr(e,t,n))},Fr=(e,t,n)=>{if(!n)return!0;if(Mr(n))return Pr(e,t,n);let r=e[t];switch(jr(n)){case`number`:return Or(r,n);case`date`:return kr(r,n);case`set`:return Ar(r,n);default:return Dr(r,n)}};const Ir=(e,t)=>!t||Object.keys(t).length===0?e:e.filter(e=>Object.entries(t).every(([t,n])=>n?Fr(e,t,n):!0)),Lr=e=>Object.values(e).some(e=>e!=null);var Rr=class{async save(e,t){try{let n=localStorage.getItem(e),r=n?JSON.parse(n):[],i=r.findIndex(e=>e.id===t.id);i===-1?r.push(t):r[i]=t,localStorage.setItem(e,JSON.stringify(r))}catch(e){throw console.error(`Failed to save preset to localStorage:`,e),e}}async load(e,t){try{let n=localStorage.getItem(e);if(!n)return null;let r=JSON.parse(n);return t?r.find(e=>e.id===t)||null:r}catch(e){throw console.error(`Failed to load preset from localStorage:`,e),e}}async delete(e,t){try{let n=localStorage.getItem(e);if(!n)return;let r=JSON.parse(n).filter(e=>e.id!==t);localStorage.setItem(e,JSON.stringify(r))}catch(e){throw console.error(`Failed to delete preset from localStorage:`,e),e}}async list(e){try{let t=localStorage.getItem(e);return t?JSON.parse(t):[]}catch(e){throw console.error(`Failed to list presets from localStorage:`,e),e}}},zr=class{constructor(e){this.config=e}async save(e,t){let n=this.config.saveEndpoint||`${this.config.baseUrl}/layouts`;try{let r=await fetch(n,{method:`POST`,headers:{"Content-Type":`application/json`,...this.config.headers},body:JSON.stringify({key:e,preset:t})});if(!r.ok)throw Error(`Server responded with ${r.status}`)}catch(e){throw console.error(`Failed to save preset to server:`,e),e}}async load(e,t){let n=this.config.loadEndpoint||`${this.config.baseUrl}/layouts`,r=t?`${n}/${e}/${t}`:`${n}/${e}`;try{let e=await fetch(r,{method:`GET`,headers:{"Content-Type":`application/json`,...this.config.headers}});if(e.status===404)return null;if(!e.ok)throw Error(`Server responded with ${e.status}`);return await e.json()}catch(e){throw console.error(`Failed to load preset from server:`,e),e}}async delete(e,t){let n=`${this.config.deleteEndpoint||`${this.config.baseUrl}/layouts`}/${e}/${t}`;try{let e=await fetch(n,{method:`DELETE`,headers:this.config.headers});if(!e.ok)throw Error(`Server responded with ${e.status}`)}catch(e){throw console.error(`Failed to delete preset from server:`,e),e}}async list(e){let t=`${this.config.listEndpoint||`${this.config.baseUrl}/layouts`}/${e}`;try{let e=await fetch(t,{method:`GET`,headers:{"Content-Type":`application/json`,...this.config.headers}});if(e.status===404)return[];if(!e.ok)throw Error(`Server responded with ${e.status}`);return await e.json()}catch(e){throw console.error(`Failed to list presets from server:`,e),e}}},Br=class{constructor(e){this.config=e,this.baseAdapter=e.adapter||new Rr}getUserKey(e){return`${this.config.profileKey||`user-layouts`}:${this.config.userId}:${e}`}async save(e,t){return this.baseAdapter.save(this.getUserKey(e),t)}async load(e,t){return this.baseAdapter.load(this.getUserKey(e),t)}async delete(e,t){return this.baseAdapter.delete(this.getUserKey(e),t)}async list(e){return this.baseAdapter.list(this.getUserKey(e))}};function Vr(e){if(e.customAdapter)return e.customAdapter;switch(e.strategy){case`server`:if(!e.serverConfig)throw Error(`Server configuration is required for server storage strategy`);return new zr(e.serverConfig);case`userProfile`:if(!e.userProfileConfig)throw Error(`User profile configuration is required for userProfile storage strategy`);return new Br(e.userProfileConfig);case`localStorage`:default:return new Rr}}function Hr(){return`preset_${Date.now()}_${Math.random().toString(36).substr(2,9)}`}function Ur(e,t,n,r){let i=Date.now();return{id:r||Hr(),name:e,description:n,createdAt:i,updatedAt:i,layout:t}}var Wr=class{constructor(e){this.adapter=Vr(e),this.storageKey=e.storageKey}async savePreset(e){let t={...e,updatedAt:Date.now()};await this.adapter.save(this.storageKey,t)}async loadPreset(e){let t=await this.adapter.load(this.storageKey,e);return Array.isArray(t)?t.find(t=>t.id===e)||null:t}async loadLastPreset(){let e=await this.listPresets();return e.length===0?null:e.reduce((e,t)=>t.updatedAt>e.updatedAt?t:e)}async deletePreset(e){await this.adapter.delete(this.storageKey,e)}async listPresets(){return await this.adapter.list(this.storageKey)}async hasPreset(e){return await this.loadPreset(e)!==null}async autoSave(e){let t=Ur(`Auto-saved Layout`,e,`Automatically saved layout`,`__autosave__`);await this.savePreset(t)}async loadAutoSave(){return await this.loadPreset(`__autosave__`)}};function Gr(e,t){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,r),n=null},t)}}const Kr={name:`quartz`,displayName:`Quartz (Modern White)`,colors:{background:`#ffffff`,backgroundAlt:`#f9fafb`,headerBackground:`#f3f4f6`,footerBackground:`#f9fafb`,border:`#e5e7eb`,borderLight:`#f3f4f6`,text:`#111827`,textSecondary:`#6b7280`,textInverse:`#ffffff`,headerText:`#374151`,hover:`#f3f4f6`,active:`#e5e7eb`,selected:`#dbeafe`,primary:`#3b82f6`,primaryHover:`#2563eb`,primaryLight:`#93c5fd`,primaryDark:`#1e40af`,primaryBackground:`#eff6ff`,textMuted:`#6b7280`,borderHover:`#9ca3af`,success:`#10b981`,warning:`#f59e0b`,error:`#ef4444`,info:`#3b82f6`},spacing:{cellPadding:`12px 16px`,headerPadding:`12px 16px`,rowHeight:`48px`},typography:{fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`,fontSize:`14px`,fontSizeSmall:`12px`,fontWeight:`400`,headerFontWeight:`600`},borders:{width:`1px`,radius:`8px`,style:`solid`},shadows:{light:`0 1px 2px 0 rgba(0, 0, 0, 0.05)`,medium:`0 4px 6px -1px rgba(0, 0, 0, 0.1)`,heavy:`0 10px 15px -3px rgba(0, 0, 0, 0.1)`}},qr={name:`alpine`,displayName:`Alpine (Classic Business)`,colors:{background:`#ffffff`,backgroundAlt:`#fafafa`,headerBackground:`#f5f5f5`,footerBackground:`#f5f5f5`,border:`#d9d9d9`,borderLight:`#e8e8e8`,text:`#262626`,textSecondary:`#595959`,textInverse:`#ffffff`,headerText:`#262626`,hover:`#f5f5f5`,active:`#e8e8e8`,selected:`#e6f7ff`,primary:`#1890ff`,primaryHover:`#096dd9`,primaryLight:`#91d5ff`,primaryDark:`#0050b3`,primaryBackground:`#e6f7ff`,textMuted:`#8c8c8c`,borderHover:`#bfbfbf`,success:`#52c41a`,warning:`#faad14`,error:`#f5222d`,info:`#1890ff`},spacing:{cellPadding:`10px 12px`,headerPadding:`10px 12px`,rowHeight:`44px`},typography:{fontFamily:`"Segoe UI", Tahoma, Geneva, Verdana, sans-serif`,fontSize:`13px`,fontSizeSmall:`11px`,fontWeight:`400`,headerFontWeight:`600`},borders:{width:`1px`,radius:`4px`,style:`solid`},shadows:{light:`0 1px 2px rgba(0, 0, 0, 0.08)`,medium:`0 2px 8px rgba(0, 0, 0, 0.12)`,heavy:`0 4px 12px rgba(0, 0, 0, 0.15)`}},Jr={name:`material`,displayName:`Material`,colors:{background:`#ffffff`,backgroundAlt:`#fafafa`,headerBackground:`#f5f5f5`,footerBackground:`#f5f5f5`,border:`#e0e0e0`,borderLight:`#eeeeee`,text:`#212121`,textSecondary:`#757575`,textInverse:`#ffffff`,headerText:`#424242`,hover:`#f5f5f5`,active:`#eeeeee`,selected:`#e3f2fd`,primary:`#2196f3`,primaryHover:`#1976d2`,primaryLight:`#90caf9`,primaryDark:`#0d47a1`,primaryBackground:`#e3f2fd`,textMuted:`#757575`,borderHover:`#bdbdbd`,success:`#4caf50`,warning:`#ff9800`,error:`#f44336`,info:`#2196f3`},spacing:{cellPadding:`14px 16px`,headerPadding:`14px 16px`,rowHeight:`52px`},typography:{fontFamily:`Roboto, "Helvetica Neue", Arial, sans-serif`,fontSize:`14px`,fontSizeSmall:`12px`,fontWeight:`400`,headerFontWeight:`500`},borders:{width:`1px`,radius:`4px`,style:`solid`},shadows:{light:`0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12)`,medium:`0 3px 3px -2px rgba(0,0,0,.2), 0 3px 4px 0 rgba(0,0,0,.14), 0 1px 8px 0 rgba(0,0,0,.12)`,heavy:`0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12)`}},Yr={name:`dark`,displayName:`Dark Mode`,colors:{background:`#1e1e1e`,backgroundAlt:`#252526`,headerBackground:`#2d2d30`,footerBackground:`#252526`,border:`#3e3e42`,borderLight:`#333333`,text:`#d4d4d4`,textSecondary:`#969696`,textInverse:`#1e1e1e`,headerText:`#e0e0e0`,hover:`#2a2d2e`,active:`#37373d`,selected:`#264f78`,primary:`#4a9eff`,primaryHover:`#6eb4ff`,primaryLight:`#80b9ff`,primaryDark:`#2d7dd2`,primaryBackground:`#1e3a5f`,textMuted:`#858585`,borderHover:`#505050`,success:`#4ec9b0`,warning:`#dcdcaa`,error:`#f48771`,info:`#4a9eff`},spacing:{cellPadding:`12px 16px`,headerPadding:`12px 16px`,rowHeight:`48px`},typography:{fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`,fontSize:`14px`,fontSizeSmall:`12px`,fontWeight:`400`,headerFontWeight:`600`},borders:{width:`1px`,radius:`6px`,style:`solid`},shadows:{light:`0 2px 4px rgba(0, 0, 0, 0.3)`,medium:`0 4px 8px rgba(0, 0, 0, 0.4)`,heavy:`0 8px 16px rgba(0, 0, 0, 0.5)`}},Xr={name:`nord`,displayName:`Nord (Arctic)`,colors:{background:`#eceff4`,backgroundAlt:`#e5e9f0`,headerBackground:`#d8dee9`,footerBackground:`#e5e9f0`,border:`#d8dee9`,borderLight:`#e5e9f0`,text:`#2e3440`,textSecondary:`#4c566a`,textInverse:`#eceff4`,headerText:`#2e3440`,hover:`#e5e9f0`,active:`#d8dee9`,selected:`#d8dee9`,primary:`#5e81ac`,primaryHover:`#81a1c1`,primaryLight:`#88c0d0`,primaryDark:`#5e81ac`,primaryBackground:`#d8dee9`,textMuted:`#4c566a`,borderHover:`#4c566a`,success:`#a3be8c`,warning:`#ebcb8b`,error:`#bf616a`,info:`#88c0d0`},spacing:{cellPadding:`12px 16px`,headerPadding:`12px 16px`,rowHeight:`48px`},typography:{fontFamily:`-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif`,fontSize:`14px`,fontSizeSmall:`12px`,fontWeight:`400`,headerFontWeight:`600`},borders:{width:`1px`,radius:`6px`,style:`solid`},shadows:{light:`0 1px 3px rgba(0, 0, 0, 0.12)`,medium:`0 3px 6px rgba(0, 0, 0, 0.15)`,heavy:`0 8px 16px rgba(0, 0, 0, 0.18)`}},Zr={name:`dracula`,displayName:`Dracula`,colors:{background:`#282a36`,backgroundAlt:`#21222c`,headerBackground:`#44475a`,footerBackground:`#21222c`,border:`#44475a`,borderLight:`#6272a4`,text:`#f8f8f2`,textSecondary:`#6272a4`,textInverse:`#282a36`,headerText:`#f8f8f2`,hover:`#44475a`,active:`#6272a4`,selected:`#44475a`,primary:`#bd93f9`,primaryHover:`#caa9fa`,primaryLight:`#d6bcfb`,primaryDark:`#9b72dd`,primaryBackground:`#44475a`,textMuted:`#6272a4`,borderHover:`#bd93f9`,success:`#50fa7b`,warning:`#f1fa8c`,error:`#ff5555`,info:`#8be9fd`},spacing:{cellPadding:`12px 16px`,headerPadding:`12px 16px`,rowHeight:`48px`},typography:{fontFamily:`"Fira Code", "Consolas", monospace, -apple-system, BlinkMacSystemFont, "Segoe UI"`,fontSize:`14px`,fontSizeSmall:`12px`,fontWeight:`400`,headerFontWeight:`600`},borders:{width:`1px`,radius:`8px`,style:`solid`},shadows:{light:`0 2px 4px rgba(0, 0, 0, 0.4)`,medium:`0 4px 8px rgba(0, 0, 0, 0.5)`,heavy:`0 8px 16px rgba(0, 0, 0, 0.6)`}},Qr={name:`solarized-light`,displayName:`Solarized Light`,colors:{background:`#fdf6e3`,backgroundAlt:`#eee8d5`,headerBackground:`#eee8d5`,footerBackground:`#eee8d5`,border:`#93a1a1`,borderLight:`#eee8d5`,text:`#657b83`,textSecondary:`#93a1a1`,textInverse:`#fdf6e3`,headerText:`#586e75`,hover:`#eee8d5`,active:`#93a1a1`,selected:`#d3cbb7`,primary:`#268bd2`,primaryHover:`#2aa198`,primaryLight:`#6c71c4`,primaryDark:`#073642`,primaryBackground:`#eee8d5`,textMuted:`#93a1a1`,borderHover:`#657b83`,success:`#859900`,warning:`#b58900`,error:`#dc322f`,info:`#268bd2`},spacing:{cellPadding:`12px 16px`,headerPadding:`12px 16px`,rowHeight:`48px`},typography:{fontFamily:`"Source Code Pro", "Menlo", "Monaco", monospace`,fontSize:`14px`,fontSizeSmall:`12px`,fontWeight:`400`,headerFontWeight:`600`},borders:{width:`1px`,radius:`4px`,style:`solid`},shadows:{light:`0 1px 3px rgba(0, 0, 0, 0.08)`,medium:`0 3px 6px rgba(0, 0, 0, 0.12)`,heavy:`0 8px 16px rgba(0, 0, 0, 0.15)`}},$r={name:`solarized-dark`,displayName:`Solarized Dark`,colors:{background:`#002b36`,backgroundAlt:`#073642`,headerBackground:`#073642`,footerBackground:`#073642`,border:`#586e75`,borderLight:`#073642`,text:`#839496`,textSecondary:`#657b83`,textInverse:`#002b36`,headerText:`#93a1a1`,hover:`#073642`,active:`#586e75`,selected:`#094757`,primary:`#268bd2`,primaryHover:`#2aa198`,primaryLight:`#6c71c4`,primaryDark:`#073642`,primaryBackground:`#073642`,textMuted:`#657b83`,borderHover:`#839496`,success:`#859900`,warning:`#b58900`,error:`#dc322f`,info:`#268bd2`},spacing:{cellPadding:`12px 16px`,headerPadding:`12px 16px`,rowHeight:`48px`},typography:{fontFamily:`"Source Code Pro", "Menlo", "Monaco", monospace`,fontSize:`14px`,fontSizeSmall:`12px`,fontWeight:`400`,headerFontWeight:`600`},borders:{width:`1px`,radius:`4px`,style:`solid`},shadows:{light:`0 2px 4px rgba(0, 0, 0, 0.3)`,medium:`0 4px 8px rgba(0, 0, 0, 0.4)`,heavy:`0 8px 16px rgba(0, 0, 0, 0.5)`}},ei={name:`monokai`,displayName:`Monokai`,colors:{background:`#272822`,backgroundAlt:`#1e1f1c`,headerBackground:`#3e3d32`,footerBackground:`#1e1f1c`,border:`#49483e`,borderLight:`#3e3d32`,text:`#f8f8f2`,textSecondary:`#75715e`,textInverse:`#272822`,headerText:`#f8f8f2`,hover:`#3e3d32`,active:`#49483e`,selected:`#49483e`,primary:`#66d9ef`,primaryHover:`#a6e22e`,primaryLight:`#e6db74`,primaryDark:`#ae81ff`,primaryBackground:`#3e3d32`,textMuted:`#75715e`,borderHover:`#66d9ef`,success:`#a6e22e`,warning:`#e6db74`,error:`#f92672`,info:`#66d9ef`},spacing:{cellPadding:`12px 16px`,headerPadding:`12px 16px`,rowHeight:`48px`},typography:{fontFamily:`"Fira Code", "Monaco", "Consolas", monospace`,fontSize:`14px`,fontSizeSmall:`12px`,fontWeight:`400`,headerFontWeight:`600`},borders:{width:`1px`,radius:`6px`,style:`solid`},shadows:{light:`0 2px 4px rgba(0, 0, 0, 0.5)`,medium:`0 4px 8px rgba(0, 0, 0, 0.6)`,heavy:`0 8px 16px rgba(0, 0, 0, 0.7)`}},ti={name:`one-dark`,displayName:`One Dark`,colors:{background:`#282c34`,backgroundAlt:`#21252b`,headerBackground:`#2c313c`,footerBackground:`#21252b`,border:`#3e4451`,borderLight:`#2c313c`,text:`#abb2bf`,textSecondary:`#5c6370`,textInverse:`#282c34`,headerText:`#abb2bf`,hover:`#2c313c`,active:`#3e4451`,selected:`#3e4451`,primary:`#61afef`,primaryHover:`#528bff`,primaryLight:`#84b9f0`,primaryDark:`#4e88c7`,primaryBackground:`#2c313c`,textMuted:`#5c6370`,borderHover:`#528bff`,success:`#98c379`,warning:`#e5c07b`,error:`#e06c75`,info:`#61afef`},spacing:{cellPadding:`12px 16px`,headerPadding:`12px 16px`,rowHeight:`48px`},typography:{fontFamily:`"Fira Code", "Menlo", "Monaco", "Consolas", monospace`,fontSize:`14px`,fontSizeSmall:`12px`,fontWeight:`400`,headerFontWeight:`600`},borders:{width:`1px`,radius:`6px`,style:`solid`},shadows:{light:`0 2px 4px rgba(0, 0, 0, 0.4)`,medium:`0 4px 8px rgba(0, 0, 0, 0.5)`,heavy:`0 8px 16px rgba(0, 0, 0, 0.6)`}},ni={quartz:Kr,alpine:qr,material:Jr,dark:Yr,nord:Xr,dracula:Zr,"solarized-light":Qr,"solarized-dark":$r,monokai:ei,"one-dark":ti};function ri(e){return ni[e]||Kr}function ii(e){return{"--grid-bg":e.colors.background,"--grid-bg-alt":e.colors.backgroundAlt,"--grid-header-bg":e.colors.headerBackground,"--grid-footer-bg":e.colors.footerBackground,"--grid-border":e.colors.border,"--grid-border-light":e.colors.borderLight,"--grid-text":e.colors.text,"--grid-text-secondary":e.colors.textSecondary,"--grid-text-inverse":e.colors.textInverse,"--grid-header-text":e.colors.headerText,"--grid-hover":e.colors.hover,"--grid-active":e.colors.active,"--grid-selected":e.colors.selected,"--grid-primary":e.colors.primary,"--grid-primary-hover":e.colors.primaryHover,"--grid-primary-light":e.colors.primaryLight,"--grid-primary-dark":e.colors.primaryDark,"--grid-primary-bg":e.colors.primaryBackground,"--grid-text-muted":e.colors.textMuted,"--grid-border-hover":e.colors.borderHover,"--grid-success":e.colors.success,"--grid-warning":e.colors.warning,"--grid-error":e.colors.error,"--grid-info":e.colors.info,"--grid-cell-padding":e.spacing.cellPadding,"--grid-header-padding":e.spacing.headerPadding,"--grid-row-height":e.spacing.rowHeight,"--grid-font-family":e.typography.fontFamily,"--grid-font-size":e.typography.fontSize,"--grid-font-size-sm":e.typography.fontSizeSmall,"--grid-font-weight":e.typography.fontWeight,"--grid-header-font-weight":e.typography.headerFontWeight,"--grid-border-width":e.borders.width,"--grid-border-radius":e.borders.radius,"--grid-border-style":e.borders.style,"--grid-shadow-light":e.shadows.light,"--grid-shadow-medium":e.shadows.medium,"--grid-shadow-heavy":e.shadows.heavy}}const ai=()=>{let e=(0,b.useRef)(``),t=(0,b.useRef)(null);(0,b.useEffect)(()=>()=>{t.current&&clearTimeout(t.current)},[]);let n=(0,b.useCallback)((n,r={})=>{let{delay:i=0}=r;t.current&&clearTimeout(t.current),i>0?t.current=setTimeout(()=>{e.current=n},i):e.current=n},[]);return{announcementRef:e,announce:n,announceSorting:(0,b.useCallback)((e,t)=>{n(t?`Sorted by ${e} ${t===`asc`?`ascending`:`descending`}`:`Sorting cleared`)},[n]),announceSelection:(0,b.useCallback)(e=>{n(e===0?`All rows deselected`:e===1?`1 row selected`:`${e} rows selected`)},[n]),announceFiltering:(0,b.useCallback)((e,t,r)=>{n(t?`Filter applied to ${e}${r===void 0?``:`, ${r} results found`}`:`Filter cleared from ${e}`)},[n]),announcePagination:(0,b.useCallback)((e,t,r)=>{n(`Page ${e+1} of ${t}, showing ${r} rows`)},[n]),announceFocus:(0,b.useCallback)((e,t,r)=>{let i=r==null?``:`, value: ${r}`;n(`Row ${e+1}, ${t}${i}`,{delay:100})},[n]),announceEditing:(0,b.useCallback)((e,t)=>{n(t?`Editing ${e}. Press Enter to save, Escape to cancel`:`Edit saved for ${e}`)},[n]),announceRowReorder:(0,b.useCallback)((e,t)=>{n(`Row moved from position ${e+1} to position ${t+1}`)},[n]),announceColumnVisibility:(0,b.useCallback)((e,t)=>{n(t?`${e} column shown`:`${e} column hidden`)},[n]),announceLoading:(0,b.useCallback)((e,t)=>{e?n(t||`Loading data...`,{priority:`assertive`}):n(`Data loaded`,{priority:`polite`})},[n])}},oi=({message:e,priority:t=`polite`})=>(0,Z.jsx)(`div`,{role:t===`assertive`?`alert`:`status`,"aria-live":t,"aria-atomic":`true`,style:{position:`absolute`,left:`-10000px`,width:`1px`,height:`1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`},children:e});var si=class{constructor(e,t,n,r,i,a,o){this.persistenceManager=null,this.destroyed=!1,this.eventListeners=new Map,this.state=e,this.dispatch=t,this.columns=n,this.rows=r,this.containerRef=i,this.persistenceManager=a||null,this.setInternalRows=o}updateState(e){this.state=e}updateData(e,t){this.columns=e,this.rows=t}updateCallbacks(e){this.setInternalRows=e}setRowData(e){this.ensureNotDestroyed(),this.rows=e,this.setInternalRows&&this.setInternalRows(e),this.dispatch({type:`SET_ROW_DATA`,payload:e}),this.fireEvent(`rowDataChanged`,{api:this,rows:e})}applyTransaction(e){this.ensureNotDestroyed();let t={add:[],remove:[],update:[]},n=[...this.rows];if(e.remove&&e.remove.length>0){let r=new Set(e.remove.map(e=>e.id)),i=n.filter(e=>r.has(e.id));n=n.filter(e=>!r.has(e.id)),t.remove=i.map((e,t)=>this.createRowNode(e,t))}if(e.update&&e.update.length>0){let r=new Map(e.update.map(e=>[e.id,e]));n=n.map(e=>{let n=r.get(e.id);return n?(t.update.push(this.createRowNode(n,0)),{...e,...n}):e})}if(e.add&&e.add.length>0){let r=e.addIndex??n.length;n.splice(r,0,...e.add),t.add=e.add.map((e,t)=>this.createRowNode(e,r+t))}return this.setRowData(n),this.fireEvent(`rowDataUpdated`,{api:this,transaction:t}),t}async applyTransactionAsync(e){return Promise.resolve(this.applyTransaction(e))}getModel(){return{getRowCount:()=>this.rows.length,getRow:e=>{let t=this.rows[e];return t?this.createRowNode(t,e):null},forEachNode:e=>{this.rows.forEach((t,n)=>{e(this.createRowNode(t,n),n)})}}}getDisplayedRowCount(){return this.ensureNotDestroyed(),this.getDisplayedRows().length}getDisplayedRowAtIndex(e){this.ensureNotDestroyed();let t=this.getDisplayedRows()[e];return t?this.createRowNode(t,e):null}forEachNode(e){this.ensureNotDestroyed(),this.rows.forEach((t,n)=>{e(this.createRowNode(t,n),n)})}forEachNodeAfterFilter(e){this.ensureNotDestroyed(),this.getFilteredRows().forEach((t,n)=>{e(this.createRowNode(t,n),n)})}forEachNodeAfterFilterAndSort(e){this.ensureNotDestroyed(),this.getDisplayedRows().forEach((t,n)=>{e(this.createRowNode(t,n),n)})}getFirstDisplayedRow(){return 0}getLastDisplayedRow(){return Math.max(0,this.getDisplayedRowCount()-1)}getColumnDefs(){return this.ensureNotDestroyed(),[...this.columns]}setColumnDefs(e){this.ensureNotDestroyed(),this.columns=e,this.dispatch({type:`SET_COLUMN_DEFS`,payload:e}),this.fireEvent(`columnDefsChanged`,{api:this,columnDefs:e})}getAllColumns(){return this.getColumnDefs()}getDisplayedCenterColumns(){this.ensureNotDestroyed();let e=new Set(this.state.pinnedColumnsLeft),t=new Set(this.state.pinnedColumnsRight),n=new Set(this.state.hiddenColumns);return this.state.columnOrder.filter(r=>!e.has(r)&&!t.has(r)&&!n.has(r)).map(e=>this.columns.find(t=>t.field===e)).filter(e=>e!==void 0)}getDisplayedLeftColumns(){this.ensureNotDestroyed();let e=new Set(this.state.hiddenColumns);return this.state.pinnedColumnsLeft.filter(t=>!e.has(t)).map(e=>this.columns.find(t=>t.field===e)).filter(e=>e!==void 0)}getDisplayedRightColumns(){this.ensureNotDestroyed();let e=new Set(this.state.hiddenColumns);return this.state.pinnedColumnsRight.filter(t=>!e.has(t)).map(e=>this.columns.find(t=>t.field===e)).filter(e=>e!==void 0)}setColumnVisible(e,t){this.ensureNotDestroyed();let n=this.resolveColKey(e);n&&(this.dispatch({type:`SET_COLUMN_VISIBILITY`,payload:{field:n,visible:t}}),this.fireEvent(`columnVisible`,{api:this,column:n,visible:t}))}setColumnsVisible(e,t){this.ensureNotDestroyed(),e.forEach(e=>this.setColumnVisible(e,t))}setColumnPinned(e,t){this.ensureNotDestroyed();let n=this.resolveColKey(e);n&&(t?this.dispatch({type:`PIN_COLUMN`,payload:{field:n,side:t}}):this.dispatch({type:`UNPIN_COLUMN`,payload:n}),this.fireEvent(`columnPinned`,{api:this,column:n,pinned:t}))}autoSizeColumns(e){if(this.ensureNotDestroyed(),!e||e.length===0){this.autoSizeAllColumns();return}e.forEach(e=>{let t=this.resolveColKey(e);if(t){let e=this.calculateColumnWidth(t);this.dispatch({type:`RESIZE_COLUMN`,payload:{field:t,width:e}})}}),this.fireEvent(`columnResized`,{api:this,columns:e})}autoSizeAllColumns(){this.ensureNotDestroyed();let e={};this.columns.forEach(t=>{e[t.field]=this.calculateColumnWidth(t.field)}),Object.entries(e).forEach(([e,t])=>{this.dispatch({type:`RESIZE_COLUMN`,payload:{field:e,width:t}})}),this.fireEvent(`columnResized`,{api:this,columns:Object.keys(e)})}moveColumn(e,t){this.ensureNotDestroyed();let n=this.resolveColKey(e);if(n){let e=this.state.columnOrder.indexOf(n);e!==-1&&(this.dispatch({type:`REORDER_COLUMNS`,payload:{fromIndex:e,toIndex:t}}),this.fireEvent(`columnMoved`,{api:this,column:n,toIndex:t}))}}moveColumns(e,t){this.ensureNotDestroyed(),e.forEach((e,n)=>{this.moveColumn(e,t+n)})}getColumnState(){this.ensureNotDestroyed();let e=new Set(this.state.pinnedColumnsLeft),t=new Set(this.state.pinnedColumnsRight);return this.state.columnOrder.map(n=>{let r=this.state.hiddenColumns.includes(n),i=this.state.sortConfig.field===n;return{colId:n,width:this.state.columnWidths[n],hide:r,pinned:e.has(n)?`left`:t.has(n)?`right`:null,sort:i?this.state.sortConfig.direction:null,sortIndex:i?0:void 0}})}applyColumnState(e){this.ensureNotDestroyed(),e.forEach(e=>{let{colId:t,width:n,hide:r,pinned:i,sort:a}=e;n!==void 0&&this.dispatch({type:`RESIZE_COLUMN`,payload:{field:t,width:n}}),r!==void 0&&r!==this.state.hiddenColumns.includes(t)&&this.dispatch({type:`TOGGLE_COLUMN_VISIBILITY`,payload:t}),i!==void 0&&this.setColumnPinned(t,i),a!=null&&this.dispatch({type:`SORT_COLUMN`,payload:t})}),this.fireEvent(`columnStateChanged`,{api:this,state:e})}resetColumnState(){this.ensureNotDestroyed(),this.dispatch({type:`RESET_COLUMN_STATE`}),this.fireEvent(`columnStateReset`,{api:this})}getColumn(e){let t=this.resolveColKey(e);return t&&this.columns.find(e=>e.field===t)||null}isAnyFilterPresent(){return this.ensureNotDestroyed(),Object.keys(this.state.filterConfig).length>0}getFilterModel(){return this.ensureNotDestroyed(),{...this.state.filterConfig}}setFilterModel(e){this.ensureNotDestroyed(),Object.entries(e).forEach(([e,t])=>{this.dispatch({type:`SET_FILTER`,payload:{field:e,value:t}})}),this.fireEvent(`filterChanged`,{api:this,filterModel:e})}onFilterChanged(){this.ensureNotDestroyed(),this.fireEvent(`filterChanged`,{api:this,filterModel:this.getFilterModel()})}destroyFilter(e){this.ensureNotDestroyed();let t=this.resolveColKey(e);t&&this.dispatch({type:`SET_FILTER`,payload:{field:t,value:null}})}getFilterInstance(e){return null}clearAllFilters(){this.ensureNotDestroyed(),this.dispatch({type:`CLEAR_FILTERS`}),this.fireEvent(`filterChanged`,{api:this,filterModel:{}})}getSortModel(){return this.ensureNotDestroyed(),this.state.sortConfig.field&&this.state.sortConfig.direction?[this.state.sortConfig]:[]}setSortModel(e){this.ensureNotDestroyed();let t=e.length>0?e[0]:{field:``,direction:null};this.dispatch({type:`SET_SORT`,payload:t}),this.fireEvent(`sortChanged`,{api:this,sortModel:e})}onSortChanged(){this.ensureNotDestroyed(),this.fireEvent(`sortChanged`,{api:this,sortModel:this.getSortModel()})}clearAllSorting(){this.ensureNotDestroyed(),this.dispatch({type:`SET_SORT`,payload:{field:``,direction:null}}),this.fireEvent(`sortChanged`,{api:this,sortModel:[]})}getSelectedNodes(){this.ensureNotDestroyed();let e=Array.from(this.state.selection.selectedRows);return this.rows.filter(t=>e.includes(t.id)).map((e,t)=>this.createRowNode(e,t,!0))}getSelectedRows(){this.ensureNotDestroyed();let e=Array.from(this.state.selection.selectedRows);return this.rows.filter(t=>e.includes(t.id))}selectAll(){this.ensureNotDestroyed();let e=this.rows.map(e=>e.id);this.dispatch({type:`SELECT_RANGE`,payload:{startIndex:0,endIndex:this.rows.length-1,rowIds:e}}),this.fireEvent(`selectionChanged`,{api:this})}deselectAll(){this.ensureNotDestroyed(),this.dispatch({type:`DESELECT_ALL_ROWS`}),this.fireEvent(`selectionChanged`,{api:this})}selectAllFiltered(){this.ensureNotDestroyed();let e=this.getFilteredRows(),t=e.map(e=>e.id);this.dispatch({type:`SELECT_RANGE`,payload:{startIndex:0,endIndex:e.length-1,rowIds:t}}),this.fireEvent(`selectionChanged`,{api:this})}deselectAllFiltered(){this.ensureNotDestroyed();let e=this.getFilteredRows(),t=new Set(e.map(e=>e.id));Array.from(this.state.selection.selectedRows).forEach(e=>{t.has(e)&&this.dispatch({type:`DESELECT_ROW`,payload:e})}),this.fireEvent(`selectionChanged`,{api:this})}getSelectedRowCount(){return this.state.selection.selectedRows.size}ensureIndexVisible(e,t){if(this.ensureNotDestroyed(),!this.containerRef.current)return;let n=this.containerRef.current.querySelector(`[data-row-index="${e}"]`);if(n){let e={behavior:`smooth`,block:t===`top`?`start`:t===`bottom`?`end`:`center`};n.scrollIntoView(e)}}ensureNodeVisible(e,t){this.ensureIndexVisible(e.rowIndex,t)}setFocusedCell(e,t){this.ensureNotDestroyed();let n=this.resolveColKey(t);if(n){let t=this.state.columnOrder.indexOf(n);t!==-1&&(this.dispatch({type:`SET_FOCUS`,payload:{rowIndex:e,columnIndex:t}}),this.fireEvent(`cellFocused`,{api:this,rowIndex:e,column:n}))}}clearFocusedCell(){this.ensureNotDestroyed(),this.dispatch({type:`CLEAR_FOCUS`}),this.fireEvent(`cellFocusCleared`,{api:this})}getFocusedCell(){if(!this.state.focusState)return null;let e=this.state.columnOrder[this.state.focusState.columnIndex],t=this.columns.find(t=>t.field===e);return t?{rowIndex:this.state.focusState.rowIndex,column:t}:null}startEditingCell(e){this.ensureNotDestroyed();let t=this.resolveColKey(e.colKey);if(t){let n=this.getDisplayedRowAtIndex(e.rowIndex);n&&(this.dispatch({type:`START_EDITING`,payload:{rowId:n.id,field:t,value:n.data[t]}}),this.fireEvent(`cellEditingStarted`,{api:this,...e}))}}stopEditing(e=!1){this.ensureNotDestroyed(),e?this.dispatch({type:`CANCEL_EDITING`}):this.dispatch({type:`SAVE_EDIT`}),this.fireEvent(`cellEditingStopped`,{api:this,cancel:e})}getEditingCells(){if(!this.state.editState.rowId)return[];let e=this.columns.find(e=>e.field===this.state.editState.field);if(!e)return[];let t=this.rows.findIndex(e=>e.id===this.state.editState.rowId);return t===-1?[]:[{rowIndex:t,column:e}]}refreshCells(e){this.ensureNotDestroyed(),this.dispatch({type:`REFRESH_CELLS`,payload:e}),this.fireEvent(`cellsRefreshed`,{api:this,params:e})}refreshHeader(){this.ensureNotDestroyed(),this.dispatch({type:`REFRESH_HEADER`}),this.fireEvent(`headerRefreshed`,{api:this})}refreshToolPanel(){this.ensureNotDestroyed(),this.fireEvent(`toolPanelRefreshed`,{api:this})}redrawRows(e){this.ensureNotDestroyed(),this.dispatch({type:`REDRAW_ROWS`,payload:e}),this.fireEvent(`rowsRedrawn`,{api:this,params:e})}sizeColumnsToFit(){if(this.ensureNotDestroyed(),!this.containerRef.current)return;let e=this.containerRef.current.clientWidth,t=this.getDisplayedCenterColumns().concat(this.getDisplayedLeftColumns()).concat(this.getDisplayedRightColumns());if(t.length===0)return;let n=e/t.reduce((e,t)=>e+(this.state.columnWidths[t.field]||t.width||150),0);t.forEach(e=>{let t=this.state.columnWidths[e.field]||e.width||150,r=Math.max(50,Math.floor(t*n));this.dispatch({type:`RESIZE_COLUMN`,payload:{field:e.field,width:r}})}),this.fireEvent(`columnResized`,{api:this,reason:`sizeColumnsToFit`})}doLayout(){this.ensureNotDestroyed(),this.dispatch({type:`RECALCULATE_LAYOUT`}),this.fireEvent(`layoutChanged`,{api:this})}exportDataAsCsv(e){this.ensureNotDestroyed();let t=this.getDataAsCsv(e),n=(e?.fileName||`export`)+`.csv`,r=new Blob([t],{type:`text/csv;charset=utf-8;`}),i=document.createElement(`a`),a=URL.createObjectURL(r);i.setAttribute(`href`,a),i.setAttribute(`download`,n),i.style.visibility=`hidden`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(a),this.fireEvent(`csvExported`,{api:this,params:e})}getDataAsCsv(e){this.ensureNotDestroyed();let t=e?.columnSeparator||`,`,n=e?.suppressQuotes||!1,r=this.columns;e?.columnKeys&&(r=e.columnKeys.map(e=>this.resolveColKey(e)).filter(Boolean).map(e=>this.columns.find(t=>t.field===e)).filter(e=>e!==void 0));let i=e?.onlySelected?this.getSelectedRows():e?.onlyFiltered?this.getFilteredRows():this.rows,a=[];if(!e?.skipHeader){let e=r.map(e=>this.formatCsvValue(e.headerName,n)).join(t);a.push(e)}return i.forEach((i,o)=>{let s=this.createRowNode(i,o),c=r.map(t=>{let r=i[t.field],a=r;return e?.processCellCallback&&(a=e.processCellCallback({value:r,column:t,node:s})),this.formatCsvValue(a,n)}).join(t);a.push(c)}),a.join(`
|
|
45
|
-
`)}exportDataAsExcel(e){this.ensureNotDestroyed(),console.warn(`Excel export not fully implemented, exporting as CSV instead`),this.exportDataAsCsv(e)}copySelectedRowsToClipboard(){this.ensureNotDestroyed();let e=this.getDataAsCsv({onlySelected:!0});this.copyToClipboard(e),this.fireEvent(`clipboardCopy`,{api:this,type:`selectedRows`})}copySelectedRangeToClipboard(){this.ensureNotDestroyed(),this.copySelectedRowsToClipboard()}showLoadingOverlay(){this.ensureNotDestroyed(),this.dispatch({type:`SHOW_OVERLAY`,payload:`loading`}),this.fireEvent(`overlayChanged`,{api:this,overlay:`loading`})}showNoRowsOverlay(){this.ensureNotDestroyed(),this.dispatch({type:`SHOW_OVERLAY`,payload:`noRows`}),this.fireEvent(`overlayChanged`,{api:this,overlay:`noRows`})}hideOverlay(){this.ensureNotDestroyed(),this.dispatch({type:`HIDE_OVERLAY`}),this.fireEvent(`overlayChanged`,{api:this,overlay:null})}paginationGetCurrentPage(){return this.state.currentPage}paginationGoToPage(e){this.ensureNotDestroyed(),this.dispatch({type:`
|
|
45
|
+
`)}exportDataAsExcel(e){this.ensureNotDestroyed(),console.warn(`Excel export not fully implemented, exporting as CSV instead`),this.exportDataAsCsv(e)}copySelectedRowsToClipboard(){this.ensureNotDestroyed();let e=this.getDataAsCsv({onlySelected:!0});this.copyToClipboard(e),this.fireEvent(`clipboardCopy`,{api:this,type:`selectedRows`})}copySelectedRangeToClipboard(){this.ensureNotDestroyed(),this.copySelectedRowsToClipboard()}showLoadingOverlay(){this.ensureNotDestroyed(),this.dispatch({type:`SHOW_OVERLAY`,payload:`loading`}),this.fireEvent(`overlayChanged`,{api:this,overlay:`loading`})}showNoRowsOverlay(){this.ensureNotDestroyed(),this.dispatch({type:`SHOW_OVERLAY`,payload:`noRows`}),this.fireEvent(`overlayChanged`,{api:this,overlay:`noRows`})}hideOverlay(){this.ensureNotDestroyed(),this.dispatch({type:`HIDE_OVERLAY`}),this.fireEvent(`overlayChanged`,{api:this,overlay:null})}paginationGetCurrentPage(){return this.state.currentPage}paginationGoToPage(e){this.ensureNotDestroyed(),this.dispatch({type:`SET_PAGE`,payload:e}),this.fireEvent(`paginationChanged`,{api:this,currentPage:e})}paginationGoToNextPage(){let e=this.paginationGetTotalPages(),t=this.paginationGetCurrentPage();t<e-1&&this.paginationGoToPage(t+1)}paginationGoToPreviousPage(){let e=this.paginationGetCurrentPage();e>0&&this.paginationGoToPage(e-1)}paginationGetTotalPages(){let e=this.paginationGetPageSize(),t=this.getFilteredRows().length;return Math.ceil(t/e)}paginationGetPageSize(){return this.state.pageSize}paginationSetPageSize(e){this.ensureNotDestroyed(),this.dispatch({type:`SET_PAGE_SIZE`,payload:e}),this.fireEvent(`paginationChanged`,{api:this,pageSize:e})}setRowGroupColumns(e){this.ensureNotDestroyed();let t=e.map(e=>this.resolveColKey(e)).filter(Boolean);this.dispatch({type:`SET_GROUP_BY`,payload:t}),this.fireEvent(`columnRowGroupChanged`,{api:this,columns:t})}addRowGroupColumn(e){this.ensureNotDestroyed();let t=this.resolveColKey(e);t&&!this.state.groupBy.includes(t)&&(this.dispatch({type:`SET_GROUP_BY`,payload:[...this.state.groupBy,t]}),this.fireEvent(`columnRowGroupChanged`,{api:this,columns:this.state.groupBy}))}removeRowGroupColumn(e){this.ensureNotDestroyed();let t=this.resolveColKey(e);if(t){let e=this.state.groupBy.filter(e=>e!==t);this.dispatch({type:`SET_GROUP_BY`,payload:e}),this.fireEvent(`columnRowGroupChanged`,{api:this,columns:e})}}getRowGroupColumns(){return this.state.groupBy.map(e=>this.columns.find(t=>t.field===e)).filter(e=>e!==void 0)}expandAll(){this.ensureNotDestroyed(),this.dispatch({type:`EXPAND_ALL_NODES`}),this.fireEvent(`expandedChanged`,{api:this,expanded:!0})}collapseAll(){this.ensureNotDestroyed(),this.dispatch({type:`COLLAPSE_ALL_NODES`}),this.fireEvent(`expandedChanged`,{api:this,expanded:!1})}onGroupExpandedOrCollapsed(e){this.ensureNotDestroyed(),this.fireEvent(`rowGroupOpened`,{api:this,node:e})}async saveLayout(e){if(this.ensureNotDestroyed(),!this.persistenceManager)throw Error(`Persistence not enabled`);let t=this.getLayoutState(),n={id:Date.now().toString(),name:e,createdAt:Date.now(),updatedAt:Date.now(),layout:t};await this.persistenceManager.savePreset(n),this.fireEvent(`layoutSaved`,{api:this,name:e})}async loadLayout(e){if(this.ensureNotDestroyed(),!this.persistenceManager)throw Error(`Persistence not enabled`);let t=await this.persistenceManager.loadPreset(e);t&&(this.applyLayoutState(t.layout),this.fireEvent(`layoutLoaded`,{api:this,name:e}))}getLayoutState(){return{columnOrder:this.state.columnOrder,columnWidths:this.state.columnWidths,pinnedColumnsLeft:this.state.pinnedColumnsLeft,pinnedColumnsRight:this.state.pinnedColumnsRight,hiddenColumns:this.state.hiddenColumns,sortConfig:this.state.sortConfig,filterConfig:this.state.filterConfig,pageSize:this.state.pageSize,groupBy:this.state.groupBy}}applyLayoutState(e){this.ensureNotDestroyed(),this.dispatch({type:`LOAD_LAYOUT_PRESET`,payload:e}),this.fireEvent(`layoutApplied`,{api:this,layout:e})}destroy(){this.destroyed||(this.destroyed=!0,this.eventListeners.clear(),this.fireEvent(`gridDestroyed`,{api:this}))}isDestroyed(){return this.destroyed}addEventListener(e,t){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e).add(t)}removeEventListener(e,t){let n=this.eventListeners.get(e);n&&n.delete(t)}ensureNotDestroyed(){if(this.destroyed)throw Error(`Grid API has been destroyed`)}createRowNode(e,t,n=!1){let r=n||this.state.selection.selectedRows.has(e.id);return{id:e.id,data:e,rowIndex:t,selected:r,setSelected:(t,n=!1)=>{n&&this.deselectAll(),t?this.dispatch({type:`SELECT_ROW`,payload:{rowId:e.id,ctrlKey:!0}}):this.dispatch({type:`DESELECT_ROW`,payload:e.id})}}}resolveColKey(e){return typeof e==`string`?e:typeof e==`number`&&this.state.columnOrder[e]||null}getDisplayedRows(){let e=this.getFilteredRows();return this.state.sortConfig.field&&this.state.sortConfig.direction&&(e=this.applySorting(e)),e}getFilteredRows(){return Object.keys(this.state.filterConfig).length===0?this.rows:this.rows.filter(e=>Object.entries(this.state.filterConfig).every(([t,n])=>{if(!n)return!0;let r=e[t];if(`operator`in n&&`conditions`in n)return!0;let i=n.value;return i==null?!0:r==null?!1:String(r).toLowerCase().includes(String(i).toLowerCase())}))}applySorting(e){let t=this.state.sortConfig;return!t.field||!t.direction?e:[...e].sort((e,n)=>{let r=e[t.field],i=n[t.field],a=0;return r<i&&(a=-1),r>i&&(a=1),t.direction===`asc`?a:-a})}calculateColumnWidth(e){let t=this.columns.find(t=>t.field===e);if(!t)return 150;let n=t.headerName.length*8+40,r=this.rows.slice(0,10).reduce((t,n)=>{let r=String(n[e]||``);return Math.max(t,r.length*8+20)},0);return Math.max(100,Math.min(400,Math.max(n,r)))}formatCsvValue(e,t){if(e==null)return``;let n=String(e);return t?n:n.includes(`,`)||n.includes(`"`)||n.includes(`
|
|
46
46
|
`)?`"${n.replace(/"/g,`""`)}"`:n}copyToClipboard(e){if(navigator.clipboard)navigator.clipboard.writeText(e).catch(e=>{console.error(`Failed to copy to clipboard:`,e)});else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}}fireEvent(e,t){let n=this.eventListeners.get(e);n&&n.forEach(n=>{try{n(t)}catch(t){console.error(`Error in ${e} listener:`,t)}})}};const ci=(0,b.forwardRef)(({columns:e,rows:t,pageSize:n=10,showColumnPinning:r=!0,footerConfig:i,virtualScrollConfig:a,persistenceConfig:o,treeConfig:s,dragRowConfig:c,rowPinConfig:l,contextMenuConfig:u,tooltipConfig:d,tableId:f,theme:p=`quartz`,densityMode:m=`normal`,showDensityToggle:h=!1,onDensityChange:g,onRowClick:_,onCellEdit:v,onSelectionChange:y,onLayoutChange:x,onRowReorder:S,onGridReady:C},w)=>{let[T,E]=(0,b.useReducer)(fn,{columns:e,pageSize:n},e=>dn(e.columns,e.pageSize)),[D,O]=(0,b.useState)(null),k=D===null?t:D,A=(0,b.useRef)(t);(0,b.useEffect)(()=>{t!==A.current&&(A.current=t,O(null))},[t]);let j=(0,b.useRef)(null),M=(0,b.useRef)(null),{densityMode:N,setDensityMode:P,densityStyles:F}=Er({initialMode:m,persist:!0,onChange:g});(0,b.useEffect)(()=>{m&&m!==N&&P(m)},[m,N,P]);let I=(0,b.useMemo)(()=>ii(ri(p)),[p]),{announcementRef:L,announceSorting:R,announceSelection:z,announcePagination:ee}=ai(),[B,V]=(0,b.useState)(null),te=(0,b.useRef)(null),H=(0,b.useRef)(null),{tooltipState:U,tooltipHandlers:ne}=vr({config:d}),{contextMenu:W,handleContextMenu:G,closeContextMenu:re}=hr({config:u,columns:e,rows:t,selectedRows:T.selection.selectedRows,onPinColumn:(e,t)=>E({type:`PIN_COLUMN`,payload:{field:e,side:t}}),onUnpinColumn:e=>E({type:`UNPIN_COLUMN`,payload:e}),onToggleColumnVisibility:e=>E({type:`TOGGLE_COLUMN_VISIBILITY`,payload:e}),onResizeColumn:(e,t)=>E({type:`RESIZE_COLUMN`,payload:{field:e,width:t}}),onAutoSizeAllColumns:e=>{Object.entries(e).forEach(([e,t])=>{E({type:`RESIZE_COLUMN`,payload:{field:e,width:t}})})},onSetFilter:(e,t)=>E({type:`SET_FILTER`,payload:{field:e,value:t}}),onPinRowTop:l?.enabled?e=>E({type:`PIN_ROW_TOP`,payload:e}):void 0,onPinRowBottom:l?.enabled?e=>E({type:`PIN_ROW_BOTTOM`,payload:e}):void 0,onUnpinRow:l?.enabled?e=>E({type:`UNPIN_ROW`,payload:e}):void 0,pinnedColumnsLeft:T.pinnedColumnsLeft,pinnedColumnsRight:T.pinnedColumnsRight,pinnedRowsTop:T.pinnedRowsTop,pinnedRowsBottom:T.pinnedRowsBottom});(0,b.useEffect)(()=>{if(o?.enabled){let e=new Wr(o);V(e),o.autoLoad&&e.loadAutoSave().then(e=>{e&&E({type:`LOAD_LAYOUT_PRESET`,payload:e.layout})}).catch(e=>{console.error(`Failed to load auto-saved layout:`,e)})}},[o]);let K=(0,b.useMemo)(()=>JSON.stringify(T.sortConfig),[T.sortConfig]),ie=(0,b.useMemo)(()=>JSON.stringify(T.filterConfig),[T.filterConfig]),ae=(0,b.useCallback)(()=>({columnOrder:T.columnOrder,columnWidths:T.columnWidths,pinnedColumnsLeft:T.pinnedColumnsLeft,pinnedColumnsRight:T.pinnedColumnsRight,hiddenColumns:T.hiddenColumns,sortConfig:T.sortConfig,filterConfig:T.filterConfig,pageSize:T.pageSize,groupBy:T.groupBy}),[T.columnOrder,T.columnWidths,T.pinnedColumnsLeft,T.pinnedColumnsRight,T.hiddenColumns,T.sortConfig,T.filterConfig,T.pageSize,T.groupBy]);(0,b.useEffect)(()=>{(!M.current||M.current.isDestroyed())&&(M.current=new si(T,E,e,k,j,B,O))},[]),M.current&&!M.current.isDestroyed()&&(M.current.updateState(T),M.current.updateData(e,k),M.current.updateCallbacks(O)),(0,b.useImperativeHandle)(w,()=>((!M.current||M.current.isDestroyed())&&(M.current=new si(T,E,e,k,j,B,O)),M.current),[T,e,k,B]);let oe=(0,b.useRef)(!1),q=(0,b.useRef)(C);(0,b.useEffect)(()=>{q.current=C},[C]),(0,b.useEffect)(()=>{M.current&&q.current&&!oe.current&&(oe.current=!0,q.current(M.current))},[]),(0,b.useEffect)(()=>()=>{M.current&&M.current.destroy()},[]),(0,b.useEffect)(()=>{if(!o?.enabled||!o.autoSave||!B)return;let e=Gr(()=>{let e=ae();B.autoSave(e).catch(e=>{console.error(`Failed to auto-save layout:`,e)})},o.autoSaveDelay||1e3);return te.current=e,e(),()=>{te.current=null}},[o,B,T.columnOrder,T.columnWidths,T.pinnedColumnsLeft,T.pinnedColumnsRight,T.hiddenColumns,K,ie,T.pageSize,T.groupBy]),(0,b.useEffect)(()=>{if(x){let e=ae(),t=JSON.stringify(e);H.current!==t&&(H.current=t,x(e))}},[x,T.columnOrder,T.columnWidths,T.pinnedColumnsLeft,T.pinnedColumnsRight,T.hiddenColumns,K,ie,T.pageSize,T.groupBy]);let se=new Set(T.hiddenColumns),ce=T.columnOrder.filter(e=>!se.has(e)),J=T.pinnedColumnsLeft.filter(e=>ce.includes(e)),le=T.pinnedColumnsRight.filter(e=>ce.includes(e)),ue=new Set(J),Y=new Set(le),de=ce.filter(e=>!ue.has(e)&&!Y.has(e)),fe=[...J,...de,...le];(0,b.useEffect)(()=>{E({type:`RESET_COLUMNS`,payload:e})},[e]),(0,b.useEffect)(()=>{y&&y(Array.from(T.selection.selectedRows)),z(T.selection.selectedRows.size)},[T.selection.selectedRows]),(0,b.useEffect)(()=>{l?.onPinChange&&l.onPinChange(T.pinnedRowsTop,T.pinnedRowsBottom)},[T.pinnedRowsTop,T.pinnedRowsBottom]),(0,b.useEffect)(()=>{if(T.sortConfig.field){let t=e.find(e=>e.field===T.sortConfig.field);t&&R(t.headerName,T.sortConfig.direction)}},[T.sortConfig.field,T.sortConfig.direction]);let X=(0,b.useMemo)(()=>{if(!T.sortConfig.field||!T.sortConfig.direction)return k;let e=[...k].sort((e,t)=>{let n=e[T.sortConfig.field],r=t[T.sortConfig.field];return n==null&&r==null?0:n==null?1:r==null?-1:typeof n==`string`&&typeof r==`string`?n.localeCompare(r):n<r?-1:n>r?1:0});return T.sortConfig.direction===`desc`&&e.reverse(),e},[k,T.sortConfig]),pe=(0,b.useMemo)(()=>Lr(T.filterConfig)?Ir(X,T.filterConfig):X,[X,T.filterConfig]),me=(0,b.useMemo)(()=>s?.enabled?Dn(En(pe,s),T.expandedNodes,s):pe,[pe,s,T.expandedNodes]),he=(0,b.useMemo)(()=>s?.enabled?me:T.groupBy.length===0?pe:Sn(pe,T.groupBy,T.expandedGroups),[pe,me,s,T.groupBy,T.expandedGroups]),ge=(0,b.useMemo)(()=>T.groupBy.length===0?he:Cn(he),[he,T.groupBy]);(0,b.useEffect)(()=>{let e=Math.ceil(ge.length/T.pageSize),t=Math.min(T.pageSize,ge.length-T.currentPage*T.pageSize);t>0&&ee(T.currentPage,e,t)},[T.currentPage,T.pageSize]);let{pinnedRowsTopData:_e,pinnedRowsBottomData:ve,unpinnedRows:ye}=(0,b.useMemo)(()=>{let e=new Set(T.pinnedRowsTop),t=new Set(T.pinnedRowsBottom),n=[],r=[],i=[];return ge.forEach(a=>{let o=`id`in a?a.id:`groupKey`in a?a.groupKey:null;o===null?i.push(a):e.has(o)?n.push(a):t.has(o)?r.push(a):i.push(a)}),{pinnedRowsTopData:T.pinnedRowsTop.map(e=>n.find(t=>(`id`in t?t.id:`groupKey`in t?t.groupKey:null)===e)).filter(e=>e!==void 0),pinnedRowsBottomData:T.pinnedRowsBottom.map(e=>r.find(t=>(`id`in t?t.id:`groupKey`in t?t.groupKey:null)===e)).filter(e=>e!==void 0),unpinnedRows:i}},[ge,T.pinnedRowsTop,T.pinnedRowsBottom]),be=(0,b.useMemo)(()=>{let e=T.currentPage*T.pageSize,t=e+T.pageSize;return ye.slice(e,t)},[ye,T.currentPage,T.pageSize]),xe=(0,b.useMemo)(()=>!i?.show||!i.aggregates?{}:hn(pe.filter(e=>!(`isGroup`in e)),i.aggregates),[pe,i]),Se=(0,b.useMemo)(()=>!i?.showGroupFooters||!i.aggregates||T.groupBy.length===0?new Map:gn(he,i.aggregates),[he,i,T.groupBy]);(0,b.useEffect)(()=>{let t={...T.columnWidths},n=!1;e.forEach(e=>{if(e.width)t[e.field]!==e.width&&(t[e.field]=e.width,n=!0);else{let r=e.headerName.length,i=Math.max(150,Math.min(300,r*10+50));t[e.field]||(t[e.field]=i,n=!0)}}),n&&e.forEach(e=>{E({type:`RESIZE_COLUMN`,payload:{field:e.field,width:t[e.field]}})})},[e]);let Ce=(0,b.useCallback)((e,n,r)=>{if(v){let i=be[e];`id`in i&&v(t.findIndex(e=>e.id===i.id),n,r)}},[v,be,t]);return(0,Z.jsxs)(`div`,{ref:j,"data-testid":`data-grid`,role:`grid`,"aria-label":`Data Grid`,"aria-rowcount":ge.length,"aria-colcount":fe.length,style:{...I,...F,border:`var(--grid-border-width, 1px) solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,overflow:`hidden`,backgroundColor:`var(--grid-bg)`,boxShadow:`var(--grid-shadow-light, 0 1px 3px 0 rgba(0, 0, 0, 0.08))`,fontFamily:`var(--grid-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif)`},className:`data-grid density-${N}`,children:[(0,Z.jsx)(oi,{message:L.current,priority:`polite`}),(0,Z.jsxs)(`div`,{style:{position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingLeft:`16px`,paddingRight:`16px`,paddingTop:`10px`,paddingBottom:`10px`,backgroundColor:`var(--grid-bg-alt)`,borderBottom:`var(--grid-border-width, 1px) solid var(--grid-border)`,zIndex:30},children:[(0,Z.jsxs)(`div`,{style:{position:`relative`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,Z.jsx)(zn,{columns:e,columnOrder:T.columnOrder,hiddenColumns:T.hiddenColumns,onToggleVisibility:e=>E({type:`TOGGLE_COLUMN_VISIBILITY`,payload:e}),onReorderColumns:(e,t)=>E({type:`REORDER_COLUMNS`,payload:{fromIndex:e,toIndex:t}}),onResetLayout:()=>E({type:`RESET_COLUMN_LAYOUT`})}),(0,Z.jsx)(qn,{columns:e,fullDataset:t,filteredData:pe.filter(e=>!(`isGroup`in e)),selectedRows:T.selection.selectedRows,currentPageData:be.filter(e=>!(`isGroup`in e))}),o?.enabled&&B&&(0,Z.jsx)(sr,{manager:B,currentLayout:ae(),onLoadPreset:e=>E({type:`LOAD_LAYOUT_PRESET`,payload:e}),onResetLayout:()=>E({type:`RESET_COLUMN_LAYOUT`})})]}),h&&(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,Z.jsx)(`span`,{style:{fontSize:`13px`,color:`var(--grid-text-secondary)`,fontWeight:`500`},children:`Density:`}),(0,Z.jsx)(Tr,{value:N,onChange:P})]})]}),(0,Z.jsx)(Ln,{columns:e,groupBy:T.groupBy,dispatch:E}),(0,Z.jsxs)(`div`,{role:`rowgroup`,style:{position:`sticky`,top:0,zIndex:20,width:`100%`},children:[(0,Z.jsx)(pn,{columns:e,columnOrder:T.columnOrder,displayColumnOrder:fe,columnWidths:T.columnWidths,sortConfig:T.sortConfig,dispatch:E,pinnedLeft:J,pinnedRight:le,showColumnPinning:r,onContextMenu:(e,t,n)=>G({type:`header`,column:t,columnIndex:n,event:e})}),(0,Z.jsx)(or,{columns:e,displayColumnOrder:fe,columnWidths:T.columnWidths,filterConfig:T.filterConfig,dispatch:E,pinnedLeft:J,pinnedRight:le,rows:pe})]}),(0,Z.jsx)(Fn,{columns:e,rows:a?.enabled?ye:be,pinnedRowsTop:_e,pinnedRowsBottom:ve,columnOrder:T.columnOrder,displayColumnOrder:fe,columnWidths:T.columnWidths,selectedRows:T.selection.selectedRows,editState:T.editState,focusState:T.focusState,dispatch:E,onRowClick:_,onCellEdit:Ce,pinnedLeft:J,pinnedRight:le,showGroupFooters:i?.showGroupFooters,groupAggregates:Se,aggregateConfigs:i?.aggregates,virtualScrollConfig:a,treeConfig:s,dragRowConfig:c,tableId:f,onRowReorder:S,currentPage:T.currentPage,pageSize:T.pageSize,totalRows:ye.length,onContextMenu:(e,t,n,r,i)=>G({type:`cell`,row:t,column:n,rowIndex:r,columnIndex:i,event:e}),...ne}),i?.show&&i.aggregates&&(0,Z.jsx)(Rn,{columns:e,displayColumnOrder:fe,columnWidths:T.columnWidths,aggregates:xe,aggregateConfigs:i.aggregates,pinnedLeft:J,pinnedRight:le}),!a?.enabled&&(0,Z.jsx)(In,{currentPage:T.currentPage,pageSize:T.pageSize,totalRows:ye.length,dispatch:E}),W.isOpen&&(0,Z.jsx)(cr,{x:W.x,y:W.y,items:W.items,onClose:re}),d?.enabled&&(0,Z.jsx)(_r,{state:U,maxWidth:d.maxWidth,offset:d.offset})]})});ci.displayName=`DataGrid`;const li=ci;var ui=()=>(0,Z.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Z.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,Z.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}),di=()=>(0,Z.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Z.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,Z.jsx)(`path`,{d:`m21 21-4.35-4.35`})]}),fi=()=>(0,Z.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,Z.jsx)(`polyline`,{points:`6 9 12 15 18 9`})}),pi=()=>(0,Z.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,Z.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),mi=()=>(0,Z.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,Z.jsx)(`polygon`,{points:`22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3`})}),hi=(e,t,n,r)=>{let i=new Map;return e.filter(e=>Object.entries(n).every(([t,n])=>{if(t===r||!n)return!0;if(n&&`values`in n&&n.values){let r=e[t];return n.values.includes(r)}return!0})).forEach(e=>{let n=e[t];if(n!=null){let e=i.get(n)||0;i.set(n,e+1)}}),i},gi=(e,t)=>{let n=[...e];switch(t){case`count`:n.sort((e,t)=>t.count===e.count?e.label.localeCompare(t.label):t.count-e.count);break;case`alpha`:n.sort((e,t)=>e.label.localeCompare(t.label));break;case`value`:n.sort((e,t)=>typeof e.value==`number`&&typeof t.value==`number`?e.value-t.value:String(e.value).localeCompare(String(t.value)));break}return n};const _i=({columns:e,rows:t,facetConfigs:n,filterConfig:r,onFilterChange:i,onClearAll:a,className:o=``,showSearch:s=!0,collapsible:c=!0})=>{let[l,u]=(0,b.useState)(new Map),d=(0,b.useMemo)(()=>n.map(n=>{let i=e.find(e=>e.field===n.field),a=n.label||i?.headerName||n.field,o=r[n.field],s=o&&`values`in o?new Set(o.values||[]):new Set,c=hi(t,n.field,r,n.field),u=[];c.forEach((e,t)=>{u.push({value:t,label:String(t),count:e,selected:s.has(t)})});let d=gi(u,n.sortBy||`count`),f=l.get(n.field)||{expanded:n.expanded!==!1,searchTerm:``,showAll:!1};return{field:n.field,label:a,values:d,expanded:f.expanded,searchTerm:f.searchTerm,showAll:f.showAll}}),[n,e,t,r,l]),f=(e,t)=>{u(n=>{let r=new Map(n),i=r.get(e)||{expanded:!0,searchTerm:``,showAll:!1};return r.set(e,{...i,...t}),r})},p=(e,t)=>{let n=r[e],a=n&&`values`in n?new Set(n.values||[]):new Set;a.has(t)?a.delete(t):a.add(t),a.size===0?i(e,null):i(e,Array.from(a))},m=(e,t)=>{i(e,t)},h=e=>{i(e,null)},g=(0,b.useMemo)(()=>Object.values(r).filter(e=>e?!!(`values`in e&&e.values&&e.values.length>0):!1).length,[r]);return(0,Z.jsxs)(`div`,{className:`faceted-search ${o||``}`,style:{backgroundColor:`#ffffff`,borderRight:`1px solid #e5e7eb`,display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,Z.jsx)(`div`,{style:{position:`sticky`,top:0,zIndex:10,backgroundColor:`#ffffff`,borderBottom:`1px solid #e5e7eb`,padding:`16px`,flexShrink:0},children:(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`8px`},children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,Z.jsx)(mi,{}),(0,Z.jsx)(`h3`,{style:{fontSize:`18px`,fontWeight:600,color:`#111827`,margin:0},children:`Filters`}),g>0&&(0,Z.jsx)(`span`,{style:{padding:`2px 8px`,fontSize:`12px`,fontWeight:500,backgroundColor:`#dbeafe`,color:`#1e40af`,borderRadius:`9999px`},children:g})]}),g>0&&a&&(0,Z.jsx)(`button`,{onClick:a,style:{fontSize:`14px`,color:`#2563eb`,fontWeight:500,background:`none`,border:`none`,cursor:`pointer`,padding:0},onMouseOver:e=>e.currentTarget.style.color=`#1d4ed8`,onMouseOut:e=>e.currentTarget.style.color=`#2563eb`,children:`Clear All`})]})}),(0,Z.jsxs)(`div`,{style:{overflowY:`auto`,flex:1},children:[d.map(e=>{let t=n.find(t=>t.field===e.field)?.maxItems||10,r=e.searchTerm?e.values.filter(t=>t.label.toLowerCase().includes(e.searchTerm.toLowerCase())):e.values,i=e.showAll?r:r.slice(0,t),a=r.length>t,o=e.values.filter(e=>e.selected).length;return(0,Z.jsxs)(`div`,{style:{borderBottom:`1px solid #e5e7eb`},children:[(0,Z.jsxs)(`div`,{style:{padding:`16px`,backgroundColor:`#f9fafb`},children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`},children:[(0,Z.jsxs)(`button`,{onClick:()=>f(e.field,{expanded:!e.expanded}),disabled:!c,style:{display:`flex`,alignItems:`center`,gap:`8px`,fontSize:`14px`,fontWeight:600,color:`#111827`,background:`none`,border:`none`,cursor:c?`pointer`:`default`,padding:0},onMouseOver:e=>c&&(e.currentTarget.style.color=`#374151`),onMouseOut:e=>c&&(e.currentTarget.style.color=`#111827`),children:[c&&(e.expanded?(0,Z.jsx)(fi,{}):(0,Z.jsx)(pi,{})),(0,Z.jsx)(`span`,{children:e.label}),o>0&&(0,Z.jsx)(`span`,{style:{padding:`2px 8px`,fontSize:`12px`,fontWeight:500,backgroundColor:`#dbeafe`,color:`#1e40af`,borderRadius:`9999px`},children:o})]}),o>0&&(0,Z.jsx)(`button`,{onClick:()=>h(e.field),style:{fontSize:`12px`,color:`#6b7280`,background:`none`,border:`none`,cursor:`pointer`,padding:0,display:`flex`,alignItems:`center`},onMouseOver:e=>e.currentTarget.style.color=`#374151`,onMouseOut:e=>e.currentTarget.style.color=`#6b7280`,children:(0,Z.jsx)(ui,{})})]}),s&&e.expanded&&e.values.length>5&&(0,Z.jsxs)(`div`,{style:{marginTop:`8px`,position:`relative`},children:[(0,Z.jsx)(`div`,{style:{position:`absolute`,left:`8px`,top:`8px`,color:`#9ca3af`},children:(0,Z.jsx)(di,{})}),(0,Z.jsx)(`input`,{type:`text`,value:e.searchTerm,onChange:t=>f(e.field,{searchTerm:t.target.value}),placeholder:`Search...`,style:{width:`100%`,paddingLeft:`32px`,paddingRight:`12px`,paddingTop:`6px`,paddingBottom:`6px`,fontSize:`14px`,border:`1px solid #d1d5db`,borderRadius:`4px`,outline:`none`},onFocus:e=>e.currentTarget.style.boxShadow=`0 0 0 2px #3b82f6`,onBlur:e=>e.currentTarget.style.boxShadow=`none`})]})]}),e.expanded&&(0,Z.jsx)(`div`,{style:{padding:`16px`,display:`flex`,flexDirection:`column`,gap:`4px`},children:i.length===0?(0,Z.jsx)(`div`,{style:{fontSize:`14px`,color:`#6b7280`,fontStyle:`italic`},children:`No values found`}):(0,Z.jsxs)(Z.Fragment,{children:[r.length>1&&o<r.length&&(0,Z.jsxs)(`button`,{onClick:()=>m(e.field,r.map(e=>e.value)),style:{width:`100%`,textAlign:`left`,fontSize:`14px`,color:`#2563eb`,fontWeight:500,padding:`4px 0`,background:`none`,border:`none`,cursor:`pointer`},onMouseOver:e=>e.currentTarget.style.color=`#1d4ed8`,onMouseOut:e=>e.currentTarget.style.color=`#2563eb`,children:[`Select All (`,r.length,`)`]}),i.map((t,n)=>(0,Z.jsxs)(`label`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingTop:`6px`,paddingBottom:`6px`,paddingLeft:`8px`,paddingRight:`8px`,borderRadius:`4px`,cursor:`pointer`},onMouseOver:e=>e.currentTarget.style.backgroundColor=`#f9fafb`,onMouseOut:e=>e.currentTarget.style.backgroundColor=`transparent`,children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,flex:1,minWidth:0},children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:t.selected,onChange:()=>p(e.field,t.value),style:{width:`16px`,height:`16px`,cursor:`pointer`,accentColor:`#2563eb`}}),(0,Z.jsx)(`span`,{style:{fontSize:`14px`,color:`#374151`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,flex:1},children:t.label})]}),(0,Z.jsx)(`span`,{style:{fontSize:`12px`,color:`#6b7280`,fontWeight:500,marginLeft:`8px`,flexShrink:0},children:t.count})]},`${t.value}-${n}`)),a&&!e.searchTerm&&(0,Z.jsx)(`button`,{onClick:()=>f(e.field,{showAll:!e.showAll}),style:{width:`100%`,textAlign:`left`,fontSize:`14px`,color:`#2563eb`,fontWeight:500,padding:`4px 0`,marginTop:`8px`,background:`none`,border:`none`,cursor:`pointer`},onMouseOver:e=>e.currentTarget.style.color=`#1d4ed8`,onMouseOut:e=>e.currentTarget.style.color=`#2563eb`,children:e.showAll?`Show Less`:`Show More (${r.length-t} more)`})]})})]},e.field)}),d.length===0&&(0,Z.jsxs)(`div`,{style:{padding:`32px`,textAlign:`center`,color:`#6b7280`},children:[(0,Z.jsx)(`div`,{style:{width:`48px`,height:`48px`,margin:`0 auto 12px`,color:`#9ca3af`},children:(0,Z.jsx)(`svg`,{width:`48`,height:`48`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,Z.jsx)(`polygon`,{points:`22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3`})})}),(0,Z.jsx)(`p`,{style:{fontSize:`14px`,margin:0},children:`No facets configured`})]})]})]})};var vi,yi=new Uint8Array(16);function bi(){if(!vi&&(vi=typeof crypto<`u`&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<`u`&&typeof msCrypto.getRandomValues==`function`&&msCrypto.getRandomValues.bind(msCrypto),!vi))throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);return vi(yi)}var xi=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Si(e){return typeof e==`string`&&xi.test(e)}for(var Ci=Si,wi=[],Ti=0;Ti<256;++Ti)wi.push((Ti+256).toString(16).substr(1));function Ei(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(wi[e[t+0]]+wi[e[t+1]]+wi[e[t+2]]+wi[e[t+3]]+`-`+wi[e[t+4]]+wi[e[t+5]]+`-`+wi[e[t+6]]+wi[e[t+7]]+`-`+wi[e[t+8]]+wi[e[t+9]]+`-`+wi[e[t+10]]+wi[e[t+11]]+wi[e[t+12]]+wi[e[t+13]]+wi[e[t+14]]+wi[e[t+15]]).toLowerCase();if(!Ci(n))throw TypeError(`Stringified UUID is invalid`);return n}var Di=Ei;function Oi(e,t,n){e||={};var r=e.random||(e.rng||bi)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n||=0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return Di(r)}var ki=Oi;const Ai=({filters:e,onSearch:t,placeholder:n=`Search or add filters...`,maxTokens:r=10})=>{let[i,a]=(0,b.useState)([]),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(null),f=b.useMemo(()=>{if(u){let t=e.find(e=>e.field===u);if(t?.type===`select`||t?.type===`multiselect`){let e=t.options?.filter(e=>e.toLowerCase().includes(o.toLowerCase()))||[];return[{...t,options:e}]}}else return e.filter(e=>e.label.toLowerCase().includes(o.toLowerCase())||e.field.toLowerCase().includes(o.toLowerCase()));return e},[o,u,e]),[p,m]=(0,b.useState)(0),h=(0,b.useRef)(null),g=(0,b.useRef)(null),_=(n,o)=>{let c=e.find(e=>e.field===n);if(!c||i.length>=r)return;let u={id:`${n}-${ki()}`,field:n,label:c.label,value:o,operator:Array.isArray(o)?`in`:`contains`,color:c.color||C(e.indexOf(c))},f=[...i,u];a(f),t(f),s(``),d(null),l(!1)},v=e=>{let n=i.filter(t=>t.id!==e);a(n),t(n)},y=e=>{(e.type===`text`||e.type===`number`||e.type===`date`||e.type===`select`)&&(d(e.field),s(``),l(!0))},x=e=>{u&&_(u,e)},S=e=>{if(e.key===`ArrowDown`)e.preventDefault(),m(e=>Math.min(e+1,(u?f[0]?.options?.length||0:f.length)-1));else if(e.key===`ArrowUp`)e.preventDefault(),m(e=>Math.max(e-1,0));else if(e.key===`Enter`)if(e.preventDefault(),u){let e=f[0]?.options||[];e[p]?x(e[p]):o.trim()&&_(u,o.trim())}else f[p]&&y(f[p]);else e.key===`Escape`?(l(!1),d(null),s(``)):e.key===`Backspace`&&!o&&i.length>0&&v(i[i.length-1].id)},C=e=>{let t=[`#3b82f6`,`#8b5cf6`,`#ec4899`,`#f59e0b`,`#10b981`,`#06b6d4`];return t[e%t.length]};return(0,b.useEffect)(()=>{let e=e=>{g.current&&!g.current.contains(e.target)&&h.current&&!h.current.contains(e.target)&&l(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,Z.jsxs)(`div`,{style:{position:`relative`,width:`100%`},children:[(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,flexWrap:`wrap`,gap:`6px`,padding:`8px 12px`,backgroundColor:`#ffffff`,border:`2px solid #e2e8f0`,borderRadius:`8px`,minHeight:`44px`,cursor:`text`,transition:`border-color 0.2s`,...c&&{borderColor:`#3b82f6`}},onClick:()=>h.current?.focus(),children:[i.map(e=>(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`6px`,padding:`4px 8px`,backgroundColor:e.color,color:`#ffffff`,borderRadius:`6px`,fontSize:`13px`,fontWeight:`500`},children:[(0,Z.jsxs)(`span`,{style:{fontWeight:`600`},children:[e.label,`:`]}),(0,Z.jsx)(`span`,{children:Array.isArray(e.value)?e.value.join(`, `):e.value}),(0,Z.jsx)(`button`,{onClick:t=>{t.stopPropagation(),v(e.id)},style:{background:`none`,border:`none`,color:`#ffffff`,cursor:`pointer`,padding:`0 2px`,fontSize:`16px`,lineHeight:`1`,opacity:.8},onMouseEnter:e=>e.currentTarget.style.opacity=`1`,onMouseLeave:e=>e.currentTarget.style.opacity=`0.8`,children:`×`})]},e.id)),(0,Z.jsx)(`input`,{ref:h,type:`text`,value:o,onChange:e=>s(e.target.value),onFocus:()=>l(!0),onKeyDown:S,placeholder:i.length===0?n:``,style:{flex:1,minWidth:`200px`,border:`none`,outline:`none`,fontSize:`14px`,padding:`4px`,backgroundColor:`transparent`},disabled:i.length>=r})]}),c&&(0,Z.jsx)(`div`,{ref:g,style:{position:`absolute`,top:`100%`,left:0,right:0,marginTop:`4px`,backgroundColor:`#ffffff`,border:`1px solid #e2e8f0`,borderRadius:`8px`,boxShadow:`0 4px 6px -1px rgba(0, 0, 0, 0.1)`,maxHeight:`300px`,overflowY:`auto`,zIndex:1e3},children:u?(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`div`,{style:{padding:`8px 12px`,fontSize:`12px`,fontWeight:`600`,color:`#64748b`,borderBottom:`1px solid #e2e8f0`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,Z.jsx)(`button`,{onClick:()=>{d(null),s(``)},style:{background:`none`,border:`none`,cursor:`pointer`,padding:`2px`,fontSize:`16px`,color:`#64748b`},children:`←`}),e.find(e=>e.field===u)?.label]}),f[0]?.options?.map((e,t)=>(0,Z.jsx)(`div`,{onClick:()=>x(e),style:{padding:`10px 16px`,cursor:`pointer`,fontSize:`14px`,backgroundColor:p===t?`#f1f5f9`:`transparent`,transition:`background-color 0.15s`},onMouseEnter:()=>m(t),children:e},e))]}):(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{style:{padding:`8px 12px`,fontSize:`12px`,fontWeight:`600`,color:`#64748b`,borderBottom:`1px solid #e2e8f0`},children:`Filter by`}),f.map((t,n)=>(0,Z.jsxs)(`div`,{onClick:()=>y(t),style:{padding:`10px 16px`,cursor:`pointer`,fontSize:`14px`,display:`flex`,alignItems:`center`,gap:`10px`,backgroundColor:p===n?`#f1f5f9`:`transparent`,transition:`background-color 0.15s`},onMouseEnter:()=>m(n),children:[(0,Z.jsx)(`div`,{style:{width:`8px`,height:`8px`,borderRadius:`50%`,backgroundColor:t.color||C(e.indexOf(t))}}),(0,Z.jsx)(`span`,{style:{fontWeight:`500`},children:t.label}),(0,Z.jsx)(`span`,{style:{marginLeft:`auto`,fontSize:`12px`,color:`#94a3b8`},children:t.type})]},t.field))]})})]})};var ji={LOADING:`loading`,LOADED:`loaded`,FAILED:`failed`},Mi=class{constructor(e){this.blockSize=e.blockSize||100,this.maxConcurrentRequests=e.maxConcurrentRequests||4,this.cacheBlockCount=e.cacheBlockCount||20,this.cacheTimeout=e.cacheTimeout||300*1e3,this.getRows=e.getRows,this.blockCache=new Map,this.blockStatus=new Map,this.activeRequests=0,this.requestQueue=[],this.totalRows=void 0,this.sortModel=[],this.filterModel={},this.observers=new Set}subscribe(e){return this.observers.add(e),()=>this.observers.delete(e)}notifyObservers(){this.observers.forEach(e=>e())}getBlockIndex(e){return Math.floor(e/this.blockSize)}getBlockStartRow(e){return e*this.blockSize}getBlockEndRow(e){return(e+1)*this.blockSize}isBlockCached(e){let t=this.blockCache.get(e);return t?Date.now()-t.timestamp>this.cacheTimeout?(this.blockCache.delete(e),this.blockStatus.delete(e),!1):!0:!1}purgeCache(){if(this.blockCache.size<=this.cacheBlockCount)return;let e=Array.from(this.blockCache.entries()).sort((e,t)=>e[1].timestamp-t[1].timestamp);e.slice(0,e.length-this.cacheBlockCount).forEach(([e])=>{this.blockCache.delete(e),this.blockStatus.delete(e)})}async fetchBlock(e){let t=this.getBlockStartRow(e),n=this.getBlockEndRow(e),r={startRow:t,endRow:n,sortModel:this.sortModel,filterModel:this.filterModel};try{let i=await this.getRows(r);this.blockCache.set(e,{startRow:t,endRow:n,rows:i.rows,timestamp:Date.now()}),this.blockStatus.set(e,{status:ji.LOADED,rows:i.rows}),i.lastRow===void 0?i.totalRows!==void 0&&(this.totalRows=i.totalRows):this.totalRows=i.lastRow,this.purgeCache(),this.notifyObservers()}catch(t){console.error(`Failed to fetch block ${e}:`,t),this.blockStatus.set(e,{status:ji.FAILED,error:t}),this.notifyObservers()}}queueBlockRequest(e){if(this.blockStatus.get(e)?.status===ji.LOADING||this.isBlockCached(e))return;let t=async()=>{this.activeRequests++,this.blockStatus.set(e,{status:ji.LOADING});try{await this.fetchBlock(e)}finally{this.activeRequests--,this.processQueue()}};this.activeRequests<this.maxConcurrentRequests?t():this.requestQueue.push(t)}processQueue(){for(;this.activeRequests<this.maxConcurrentRequests&&this.requestQueue.length>0;){let e=this.requestQueue.shift();e&&e()}}ensureBlocksLoaded(e,t){let n=this.getBlockIndex(e),r=this.getBlockIndex(t);for(let e=n;e<=r;e++)this.queueBlockRequest(e);this.queueBlockRequest(n-1),this.queueBlockRequest(r+1)}getRowsInRange(e,t){this.ensureBlocksLoaded(e,t);let n=[],r=this.getBlockIndex(e),i=this.getBlockIndex(t);for(let a=r;a<=i;a++){let r=this.blockCache.get(a);if(r){let i=this.getBlockStartRow(a);r.rows.forEach((r,a)=>{let o=i+a;o>=e&&o<t&&n.push(r)})}else{let r=this.getBlockStartRow(a),i=this.getBlockEndRow(a);for(let a=Math.max(e,r);a<Math.min(t,i);a++)n.push({id:`loading-${a}`,_loading:!0})}}return n}getRow(e){let t=this.getBlockIndex(e);if(!this.isBlockCached(t))return this.queueBlockRequest(t),{id:`loading-${e}`,_loading:!0};let n=this.blockCache.get(t);if(!n)return;let r=e-this.getBlockStartRow(t);return n.rows[r]}getTotalRows(){return this.totalRows}isBlockLoading(e){return this.blockStatus.get(e)?.status===ji.LOADING}setSortModel(e){this.sortModel=e,this.refresh()}setFilterModel(e){this.filterModel=e,this.refresh()}refresh(){this.blockCache.clear(),this.blockStatus.clear(),this.totalRows=void 0,this.notifyObservers()}purgeBlock(e){this.blockCache.delete(e),this.blockStatus.delete(e)}destroy(){this.blockCache.clear(),this.blockStatus.clear(),this.requestQueue=[],this.observers.clear()}};function Ni(e=1e6,t=300){return new Mi({blockSize:100,maxConcurrentRequests:2,cacheBlockCount:20,getRows:async n=>{await new Promise(e=>setTimeout(e,t));let{startRow:r,endRow:i,sortModel:a,filterModel:o}=n,s=[];for(let t=r;t<Math.min(i,e);t++)s.push({id:t,name:`User ${t}`,email:`user${t}@example.com`,age:20+t%50,country:[`USA`,`UK`,`Canada`,`Germany`,`France`][t%5],salary:3e4+t%100*1e3,department:[`Engineering`,`Sales`,`Marketing`,`HR`,`Finance`][t%5]});let c=s;if(o&&Object.keys(o).length>0&&(c=s.filter(e=>Object.entries(o).every(([t,n])=>{if(!n||`operator`in n)return!0;let r=e[t],i=n.value;return n.type===`contains`?String(r).toLowerCase().includes(String(i).toLowerCase()):n.type===`equals`?r===i:n.type===`greaterThan`?r>i:n.type===`lessThan`?r<i:!0}))),a&&a.length>0){let e=a[0];e.field&&e.direction&&c.sort((t,n)=>{let r=t[e.field],i=n[e.field];return r<i?e.direction===`asc`?-1:1:r>i?e.direction===`asc`?1:-1:0})}return{rows:c,totalRows:e,lastRow:s.length<i-r?r+s.length:void 0}}})}const Pi=({columns:e,dataSource:t,pageSize:n=100,showColumnPinning:r=!0,virtualScrollConfig:i,theme:a=`quartz`,onRowClick:o,onCellEdit:s,onSelectionChange:c})=>{let[l,u]=(0,b.useReducer)(fn,{columns:e,pageSize:n},e=>dn(e.columns,e.pageSize)),[d,f]=(0,b.useState)(null),[p,m]=(0,b.useState)(void 0),h=(0,b.useMemo)(()=>ii(ri(a)),[a]);(0,b.useEffect)(()=>{let e;e=t instanceof Mi?t:new Mi(t),f(e);let n=e.subscribe(()=>{m(e.getTotalRows())});return m(e.getTotalRows()),()=>{n(),t instanceof Mi||e.destroy()}},[t]),(0,b.useEffect)(()=>{d&&l.sortConfig.field&&d.setSortModel([l.sortConfig])},[d,l.sortConfig]),(0,b.useEffect)(()=>{d&&d.setFilterModel(l.filterConfig)},[d,l.filterConfig]);let g=new Set(l.hiddenColumns),_=l.columnOrder.filter(e=>!g.has(e)),v=l.pinnedColumnsLeft.filter(e=>_.includes(e)),y=l.pinnedColumnsRight.filter(e=>_.includes(e)),x=new Set(v),S=new Set(y),C=_.filter(e=>!x.has(e)&&!S.has(e)),w=[...v,...C,...y];(0,b.useEffect)(()=>{u({type:`RESET_COLUMNS`,payload:e})},[e]),(0,b.useEffect)(()=>{c&&c(Array.from(l.selection.selectedRows))},[l.selection.selectedRows]);let[T,E]=(0,b.useState)({start:0,end:n*15}),[D,O]=(0,b.useState)(0),k=(0,b.useMemo)(()=>d?d.getRowsInRange(T.start,T.end):[],[d,T,D]);(0,b.useEffect)(()=>{if(d)return d.subscribe(()=>{O(e=>e+1)})},[d]);let A=(0,b.useCallback)(e=>{if(!d||p===void 0)return;let t=i?.containerHeight||600,n=typeof i?.rowHeight==`number`?i.rowHeight:35,r=Math.ceil(t/n),a=Math.floor(e/n),o=r*5,s=Math.max(0,a-o),c=Math.min(p,a+r+o);(s<T.start||c>T.end)&&E({start:Math.max(0,Math.min(s,T.start)),end:Math.max(c,T.end)})},[d,p,i,T]);(0,b.useEffect)(()=>{let t={...l.columnWidths},n=!1;e.forEach(e=>{if(e.width)t[e.field]!==e.width&&(t[e.field]=e.width,n=!0);else{let r=e.headerName.length,i=Math.max(150,Math.min(300,r*10+50));t[e.field]||(t[e.field]=i,n=!0)}}),n&&e.forEach(e=>{u({type:`RESIZE_COLUMN`,payload:{field:e.field,width:t[e.field]}})})},[e]);let j=(0,b.useCallback)((e,t,r)=>{s&&s(l.currentPage*n+e,t,r)},[s,l.currentPage,n]);return d?(0,Z.jsxs)(`div`,{style:{...h,border:`var(--grid-border-width, 1px) solid var(--grid-border)`,borderRadius:`var(--grid-border-radius, 6px)`,backgroundColor:`var(--grid-bg)`,boxShadow:`var(--grid-shadow-light, 0 1px 3px 0 rgba(0, 0, 0, 0.08))`,fontFamily:`var(--grid-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif)`,display:`flex`,flexDirection:`column`,height:i?.containerHeight?`${i.containerHeight+150}px`:`auto`},children:[(0,Z.jsx)(`div`,{style:{position:`relative`,display:`flex`,alignItems:`center`,justifyContent:`space-between`,paddingLeft:`16px`,paddingRight:`16px`,paddingTop:`10px`,paddingBottom:`10px`,backgroundColor:`var(--grid-bg-alt)`,borderBottom:`var(--grid-border-width, 1px) solid var(--grid-border)`,zIndex:30},children:(0,Z.jsxs)(`div`,{style:{position:`relative`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,Z.jsx)(zn,{columns:e,columnOrder:l.columnOrder,hiddenColumns:l.hiddenColumns,onToggleVisibility:e=>u({type:`TOGGLE_COLUMN_VISIBILITY`,payload:e}),onReorderColumns:(e,t)=>u({type:`REORDER_COLUMNS`,payload:{fromIndex:e,toIndex:t}}),onResetLayout:()=>u({type:`RESET_COLUMN_LAYOUT`})}),(0,Z.jsx)(`div`,{style:{fontSize:`14px`,color:`#64748b`,marginLeft:`12px`},children:p===void 0?`Loading...`:`${p.toLocaleString()} total rows`})]})}),(0,Z.jsx)(Ln,{columns:e,groupBy:l.groupBy,dispatch:u}),(0,Z.jsxs)(`div`,{style:{position:`sticky`,top:0,zIndex:20},children:[(0,Z.jsx)(pn,{columns:e,columnOrder:l.columnOrder,displayColumnOrder:w,columnWidths:l.columnWidths,sortConfig:l.sortConfig,dispatch:u,pinnedLeft:v,pinnedRight:y,showColumnPinning:r}),(0,Z.jsx)(or,{columns:e,displayColumnOrder:w,columnWidths:l.columnWidths,filterConfig:l.filterConfig,dispatch:u,pinnedLeft:v,pinnedRight:y,rows:k})]}),(0,Z.jsx)(Fn,{columns:e,rows:k,columnOrder:l.columnOrder,displayColumnOrder:w,columnWidths:l.columnWidths,selectedRows:l.selection.selectedRows,editState:l.editState,focusState:l.focusState,dispatch:u,onRowClick:o,onCellEdit:j,pinnedLeft:v,pinnedRight:y,onScroll:A,virtualScrollConfig:{...i,enabled:!0}}),(0,Z.jsxs)(`div`,{style:{padding:`8px 16px`,backgroundColor:`var(--grid-footer-bg)`,borderTop:`var(--grid-border-width, 1px) solid var(--grid-border)`,fontSize:`var(--grid-font-size-sm, 12px)`,color:`var(--grid-text-secondary)`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,Z.jsx)(`div`,{children:`Server-side infinite scrolling enabled`}),(0,Z.jsxs)(`div`,{children:[`Rows loaded: `,k.length]})]})]}):(0,Z.jsx)(`div`,{style:{padding:`20px`,textAlign:`center`,border:`1px solid #e2e8f0`,borderRadius:`6px`},children:`Loading data source...`})},Fi=({currentTheme:e,onThemeChange:t})=>{let n=[{value:`quartz`,label:`Quartz (Modern White)`},{value:`alpine`,label:`Alpine (Classic Business)`},{value:`material`,label:`Material`},{value:`dark`,label:`Dark Mode`},{value:`nord`,label:`Nord (Arctic)`},{value:`dracula`,label:`Dracula`},{value:`solarized-light`,label:`Solarized Light`},{value:`solarized-dark`,label:`Solarized Dark`},{value:`monokai`,label:`Monokai`},{value:`one-dark`,label:`One Dark`}],r=e=>{t(e.target.value)},i=ri(e);return(0,Z.jsxs)(`div`,{style:{display:`inline-flex`,alignItems:`center`,gap:`8px`},children:[(0,Z.jsx)(`label`,{htmlFor:`theme-selector`,style:{fontSize:`14px`,fontWeight:`500`,color:i.colors.text},children:`Theme:`}),(0,Z.jsx)(`select`,{id:`theme-selector`,value:e,onChange:r,style:{padding:`6px 32px 6px 12px`,fontSize:`14px`,fontFamily:i.typography.fontFamily,color:i.colors.text,backgroundColor:i.colors.background,border:`1px solid ${i.colors.border}`,borderRadius:i.borders.radius,cursor:`pointer`,outline:`none`,appearance:`none`,backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E")`,backgroundRepeat:`no-repeat`,backgroundPosition:`right 8px center`,transition:`border-color 0.2s`},onMouseEnter:e=>{e.currentTarget.style.borderColor=i.colors.primary},onMouseLeave:e=>{e.currentTarget.style.borderColor=i.colors.border},children:n.map(e=>(0,Z.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})},Ii=({status:e})=>{let t=(e=>{switch(e.toLowerCase()){case`active`:return{bg:`#dcfce7`,text:`#15803d`,border:`#86efac`};case`inactive`:return{bg:`#fee2e2`,text:`#991b1b`,border:`#fca5a5`};case`pending`:return{bg:`#fef3c7`,text:`#92400e`,border:`#fde047`};case`completed`:return{bg:`#dbeafe`,text:`#1e40af`,border:`#93c5fd`};default:return{bg:`#f3f4f6`,text:`#374151`,border:`#d1d5db`}}})(e);return(0,Z.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,padding:`4px 10px`,borderRadius:`12px`,fontSize:`12px`,fontWeight:600,backgroundColor:t.bg,color:t.text,border:`1px solid ${t.border}`},children:e})},Li=({value:e,color:t=`#3b82f6`,showLabel:n=!0})=>{let r=Math.max(0,Math.min(100,e));return(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`,width:`100%`},children:[(0,Z.jsx)(`div`,{style:{flex:1,height:`8px`,backgroundColor:`#e5e7eb`,borderRadius:`4px`,overflow:`hidden`},children:(0,Z.jsx)(`div`,{style:{width:`${r}%`,height:`100%`,backgroundColor:t,transition:`width 0.3s ease`}})}),n&&(0,Z.jsxs)(`span`,{style:{fontSize:`12px`,fontWeight:500,color:`#6b7280`,minWidth:`35px`},children:[r,`%`]})]})},Ri=({src:e,alt:t,text:n,size:r=32})=>(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,Z.jsx)(`img`,{src:e,alt:t,style:{width:`${r}px`,height:`${r}px`,borderRadius:`50%`,objectFit:`cover`,border:`2px solid #e5e7eb`}}),n&&(0,Z.jsx)(`span`,{style:{fontSize:`13px`},children:n})]}),zi=({label:e,onClick:t,variant:n=`primary`,disabled:r=!1})=>{let i=(()=>{if(r)return{bg:`#e5e7eb`,text:`#9ca3af`,border:`#d1d5db`,cursor:`not-allowed`};switch(n){case`primary`:return{bg:`#3b82f6`,text:`#ffffff`,border:`#2563eb`,cursor:`pointer`};case`secondary`:return{bg:`#ffffff`,text:`#374151`,border:`#d1d5db`,cursor:`pointer`};case`danger`:return{bg:`#ef4444`,text:`#ffffff`,border:`#dc2626`,cursor:`pointer`}}})();return(0,Z.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r||t(e)},disabled:r,style:{padding:`6px 12px`,fontSize:`12px`,fontWeight:500,backgroundColor:i.bg,color:i.text,border:`1px solid ${i.border}`,borderRadius:`4px`,cursor:i.cursor,transition:`all 0.2s ease`},onMouseEnter:e=>{!r&&n===`primary`?e.currentTarget.style.backgroundColor=`#2563eb`:!r&&n===`secondary`?e.currentTarget.style.backgroundColor=`#f9fafb`:!r&&n===`danger`&&(e.currentTarget.style.backgroundColor=`#dc2626`)},onMouseLeave:e=>{r||(e.currentTarget.style.backgroundColor=i.bg)},children:e})},Bi=({text:e,color:t=`#1f2937`,backgroundColor:n=`#f3f4f6`})=>(0,Z.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,padding:`4px 8px`,borderRadius:`4px`,fontSize:`12px`,fontWeight:500,backgroundColor:n,color:t},children:e}),Vi=({priority:e})=>{let t=(()=>{switch(e){case`low`:return{icon:`●`,color:`#10b981`,text:`Low`};case`medium`:return{icon:`●`,color:`#f59e0b`,text:`Medium`};case`high`:return{icon:`●`,color:`#ef4444`,text:`High`};case`critical`:return{icon:`●`,color:`#991b1b`,text:`Critical`}}})();return(0,Z.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:t.color,fontSize:`18px`},children:t.icon}),(0,Z.jsx)(`span`,{style:{fontSize:`13px`,fontWeight:500},children:t.text})]})},Hi=({rating:e,maxRating:t=5})=>(0,Z.jsx)(`div`,{style:{display:`flex`,gap:`2px`,fontSize:`14px`,color:`#f59e0b`},children:Array.from({length:t},(t,n)=>n<e?`★`:`☆`).map((e,t)=>(0,Z.jsx)(`span`,{children:e},t))}),Ui=({amount:e,currency:t=`USD`,locale:n=`en-US`})=>{let r=new Intl.NumberFormat(n,{style:`currency`,currency:t}).format(e);return(0,Z.jsx)(`span`,{style:{fontWeight:500,color:e<0?`#ef4444`:`#059669`},children:r})},Wi=()=>{let e=(0,b.useRef)(null),[t,n]=(0,b.useState)([]),[r,i]=(0,b.useState)(!1),a=e=>{n(t=>[...t.slice(-9),`${new Date().toLocaleTimeString()}: ${e}`])},o=e=>{i(!0),a(`✅ Grid API is ready! You can now call API methods.`)},[s]=(0,b.useState)([{field:`id`,headerName:`ID`,width:80},{field:`name`,headerName:`Name`,width:150,sortable:!0,filterable:!0},{field:`email`,headerName:`Email`,width:200,sortable:!0,filterable:!0},{field:`role`,headerName:`Role`,width:120,sortable:!0,filterable:!0},{field:`status`,headerName:`Status`,width:100,sortable:!0,filterable:!0},{field:`score`,headerName:`Score`,width:100,sortable:!0,filterable:!0}]),[c]=(0,b.useState)(()=>{let e=[`Admin`,`User`,`Manager`],t=[`Active`,`Inactive`,`Pending`],n=`Alice Johnson.Bob Smith.Charlie Brown.Diana Prince.Eve Wilson.Frank Miller.Grace Lee.Henry Ford.Ivy Green.Jack Black.Karen White.Leo King.Mona Lisa.Nina Brown.Oscar Wilde.Paul Allen.Quinn Fox.Rita Ora.Sam Hunt.Tina Fey.Uma Thurman.Victor Hugo.Wendy Wu.Xander Cage.Yara Shahidi.Zane Grey`.split(`.`),r=[];for(let i=1;i<=100;i++){let a=n[i%n.length]+` `+i;r.push({id:i,name:a,email:a.replace(/\s+/g,``).toLowerCase()+`@example.com`,role:e[i%e.length],status:t[i%t.length],score:Math.floor(Math.random()*100)})}return r});return(0,Z.jsxs)(`div`,{style:{padding:`20px`,maxWidth:`1400px`,margin:`0 auto`},children:[(0,Z.jsxs)(`div`,{style:{marginBottom:`20px`},children:[(0,Z.jsx)(`h2`,{children:`Grid API Demo`}),(0,Z.jsx)(`p`,{style:{color:`#666`},children:`Demonstrates programmatic control of the DataGrid using the GridApi ref (AG Grid-inspired API)`})]}),(0,Z.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(200px, 1fr))`,gap:`10px`,marginBottom:`20px`,padding:`15px`,backgroundColor:`#f5f5f5`,borderRadius:`8px`},children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{style:{margin:`0 0 10px 0`,fontSize:`14px`,fontWeight:`600`},children:`Data Operations`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;if(!t)return;let n={id:Date.now(),name:`New User ${Math.floor(Math.random()*1e3)}`,email:`user${Date.now()}@example.com`,role:`User`,status:`Pending`,score:Math.floor(Math.random()*100)};t.applyTransaction({add:[n]}),a(`Added new row: ${n.name}`)},style:Gi,children:`Add Row`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;if(!t)return;let n=t.getSelectedRows();if(n.length===0){a(`No rows selected`);return}let r=n.map(e=>({...e,score:Math.floor(Math.random()*100)}));t.applyTransaction({update:r}),a(`Updated ${r.length} row(s)`)},style:Gi,children:`Update Selected`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;if(!t)return;let n=t.getSelectedRows();if(n.length===0){a(`No rows selected`);return}t.applyTransaction({remove:n}),a(`Removed ${n.length} row(s)`)},style:Gi,children:`Remove Selected`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{style:{margin:`0 0 10px 0`,fontSize:`14px`,fontWeight:`600`},children:`Column Operations`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.setColumnVisible(`email`,!1),a(`Hidden Email column`))},style:Gi,children:`Hide Email`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.setColumnVisible(`email`,!0),a(`Shown Email column`))},style:Gi,children:`Show Email`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.setColumnPinned(`name`,`left`),a(`Pinned Name column to left`))},style:Gi,children:`Pin Name`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.setColumnPinned(`name`,null),a(`Unpinned Name column`))},style:Gi,children:`Unpin Name`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.autoSizeAllColumns(),a(`Auto-sized all columns`))},style:Gi,children:`Auto-size Columns`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.sizeColumnsToFit(),a(`Resized columns to fit grid width`))},style:Gi,children:`Fit to Width`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{style:{margin:`0 0 10px 0`,fontSize:`14px`,fontWeight:`600`},children:`Filter & Sort`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.setFilterModel({status:{type:`equals`,value:`Active`}}),a(`Filtered by Status = Active`))},style:Gi,children:`Filter Active`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.clearAllFilters(),a(`Cleared all filters`))},style:Gi,children:`Clear Filters`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.setSortModel([{field:`score`,direction:`desc`}]),a(`Sorted by Score descending`))},style:Gi,children:`Sort by Score`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.clearAllSorting(),a(`Cleared sorting`))},style:Gi,children:`Clear Sort`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{style:{margin:`0 0 10px 0`,fontSize:`14px`,fontWeight:`600`},children:`Selection`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.selectAll(),a(`Selected all rows`))},style:Gi,children:`Select All`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.deselectAll(),a(`Deselected all rows`))},style:Gi,children:`Deselect All`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.selectAllFiltered(),a(`Selected all filtered rows`))},style:Gi,children:`Select Filtered`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&a(`Selected ${t.getSelectedRows().length} row(s)`)},style:Gi,children:`Get Selection`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{style:{margin:`0 0 10px 0`,fontSize:`14px`,fontWeight:`600`},children:`Export & Clipboard`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.exportDataAsCsv({fileName:`grid-export`,onlySelected:!1,onlyFiltered:!0}),a(`Exported to CSV`))},style:Gi,children:`Export CSV`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.copySelectedRowsToClipboard(),a(`Copied selected rows to clipboard`))},style:Gi,children:`Copy to Clipboard`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{style:{margin:`0 0 10px 0`,fontSize:`14px`,fontWeight:`600`},children:`Navigation`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;if(!t)return;let n=t.paginationGetCurrentPage(),r=t.paginationGetPageSize(),i=n*r,o=Math.min(r,t.getDisplayedRowCount()-i),s=Math.floor(o/2);t.ensureIndexVisible(s,`middle`),a(`Scrolled to row ${s} (middle of page ${n+1})`)},style:Gi,children:`Scroll to Middle`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.setFocusedCell(2,`name`),a(`Focused cell at row 2, column Name`))},style:Gi,children:`Focus Cell`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.paginationGoToNextPage(),a(`Navigated to page ${t.paginationGetCurrentPage()+1}`))},style:Gi,children:`Next Page`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.paginationGoToPreviousPage(),a(`Navigated to page ${t.paginationGetCurrentPage()+1}`))},style:Gi,children:`Previous Page`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;t&&(t.paginationSetPageSize(20),a(`Set page size to 20`))},style:Gi,children:`Page Size: 20`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{style:{margin:`0 0 10px 0`,fontSize:`14px`,fontWeight:`600`},children:`Info`}),(0,Z.jsx)(`button`,{onClick:()=>{let t=e.current;if(!t)return;let n=t.getDisplayedRowCount(),r=t.getSelectedRowCount(),i=t.isAnyFilterPresent(),o=t.paginationGetCurrentPage(),s=t.paginationGetTotalPages();a(`Rows: ${n}, Selected: ${r}, Filters: ${i}, Page: ${o+1}/${s}`)},style:Gi,children:`Get Grid Info`})]})]}),(0,Z.jsxs)(`div`,{style:{marginBottom:`20px`,padding:`10px`,backgroundColor:`#f9f9f9`,borderRadius:`4px`,border:`1px solid #ddd`,height:`120px`,overflow:`auto`,fontFamily:`monospace`,fontSize:`12px`},children:[(0,Z.jsx)(`div`,{style:{fontWeight:`600`,marginBottom:`5px`},children:`Activity Log:`}),t.length===0?(0,Z.jsx)(`div`,{style:{color:`#999`},children:`No actions yet. Click buttons above to interact with the grid.`}):t.map((e,t)=>(0,Z.jsx)(`div`,{style:{padding:`2px 0`},children:e},t))]}),(0,Z.jsxs)(`div`,{style:{marginBottom:`10px`,padding:`10px`,backgroundColor:r?`#d4edda`:`#f8d7da`,borderRadius:`4px`,border:`1px solid ${r?`#c3e6cb`:`#f5c6cb`}`},children:[(0,Z.jsx)(`strong`,{children:`Grid Status:`}),` `,r?`✅ Ready`:`⏳ Initializing...`]}),(0,Z.jsx)(ci,{ref:e,columns:s,rows:c,pageSize:10,theme:`quartz`,densityMode:`normal`,showDensityToggle:!0,onGridReady:o,onSelectionChange:e=>{a(`Selection changed: ${e.length} row(s)`)}}),(0,Z.jsxs)(`div`,{style:{marginTop:`30px`,padding:`20px`,backgroundColor:`#e8f5e9`,borderRadius:`8px`,marginBottom:`20px`},children:[(0,Z.jsx)(`h3`,{style:{marginTop:0},children:`📘 Using onGridReady Event`}),(0,Z.jsxs)(`p`,{style:{fontSize:`14px`,lineHeight:`1.6`},children:[`The `,(0,Z.jsx)(`code`,{children:`onGridReady`}),` callback is fired when the grid API is fully initialized and ready to use. This is similar to AG-Grid's `,(0,Z.jsx)(`code`,{children:`onGridReady`}),` event.`]}),(0,Z.jsx)(`pre`,{style:{backgroundColor:`#fff`,padding:`15px`,borderRadius:`4px`,overflow:`auto`,fontSize:`13px`},children:`// Example usage
|
|
47
47
|
const MyComponent = () => {
|
|
48
48
|
const gridRef = useRef<GridApi>(null);
|
|
@@ -61,7 +61,7 @@ const MyComponent = () => {
|
|
|
61
61
|
onGridReady={handleGridReady} // ✅ Called when API is ready
|
|
62
62
|
/>
|
|
63
63
|
);
|
|
64
|
-
};`})]}),(0,Z.jsxs)(`div`,{style:{marginTop:`30px`,padding:`20px`,backgroundColor:`#f5f5f5`,borderRadius:`8px`},children:[(0,Z.jsx)(`h3`,{children:`Grid API Methods Available`}),(0,Z.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(300px, 1fr))`,gap:`15px`},children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{children:`Data & Model`}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.6`},children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`setRowData(rows)`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`applyTransaction(tx)`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`getModel()`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`getDisplayedRowCount()`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`forEachNode(callback)`})})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{children:`Columns`}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.6`},children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`getColumnDefs()`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`setColumnVisible(key, visible)`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`setColumnPinned(key, pinned)`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`autoSizeColumns(keys?)`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`sizeColumnsToFit()`})})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{children:`Filtering & Sorting`}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.6`},children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`getFilterModel()`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`setFilterModel(model)`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`getSortModel()`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`setSortModel(model)`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`clearAllFilters()`})})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{children:`Selection`}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.6`},children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`getSelectedRows()`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`selectAll()`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`deselectAll()`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`selectAllFiltered()`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`getSelectedRowCount()`})})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{children:`Navigation`}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.6`},children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`ensureIndexVisible(index)`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`setFocusedCell(row, col)`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`clearFocusedCell()`})})]})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h4`,{children:`Export`}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.6`},children:[(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`exportDataAsCsv(params?)`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`getDataAsCsv(params?)`})}),(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{children:`copySelectedRowsToClipboard()`})})]})]})]})]})]})};var Gi={display:`block`,width:`100%`,padding:`6px 12px`,marginBottom:`6px`,fontSize:`13px`,backgroundColor:`#fff`,border:`1px solid #d1d5db`,borderRadius:`4px`,cursor:`pointer`,textAlign:`left`,transition:`all 0.15s`};const Ki=({columns:e,rows:t,config:n,className:r=``,onCellClick:i,onRowClick:a})=>{let o=(0,b.useRef)(null),s=(0,b.useRef)(t);(0,b.useEffect)(()=>{s.current=t},[t]);let c=(0,b.useMemo)(()=>e.map(e=>e.field===`price`||e.field===`bid`||e.field===`ask`?{...e,renderCell:t=>{let n=t[e.field];return h(n)}}:e.field===`change`||e.field===`changePercent`?{...e,renderCell:t=>{let n=t[e.field];return g(n,e.field===`changePercent`)}}:e.field===`volume`||e.field===`size`?{...e,renderCell:t=>{let n=t[e.field];return _(n)}}:e),[e]),l=(0,b.useCallback)((e,t,n)=>{i?.(e,t,n)},[i]),u=(0,b.useCallback)(e=>{a?.(e)},[a]),d=()=>(0,Z.jsx)(`div`,{className:`market-grid-header`,children:(0,Z.jsx)(`div`,{className:`market-grid-header-row`,children:c.map(e=>(0,Z.jsx)(`div`,{className:`market-grid-header-cell ${p(e.field)}`,style:{width:e.width||120},children:e.headerName},e.field))})}),f=()=>(0,Z.jsx)(`div`,{className:`market-grid-body`,children:t.map(e=>(0,Z.jsx)(`div`,{className:`market-grid-row`,onClick:()=>u(e),children:c.map(t=>{let n=e[t.field];return(0,Z.jsx)(`div`,{className:`market-grid-cell ${p(t.field)}`,style:{width:t.width||120},"data-row-id":e.id,"data-field":t.field,onClick:r=>{r.stopPropagation(),l(e.id,t.field,n)},children:t.renderCell?t.renderCell(e):m(n)},t.field)})},e.id))}),p=e=>[`price`,`bid`,`ask`,`size`,`volume`,`change`,`changePercent`,`high`,`low`,`open`].includes(e)?`numeric-cell`:``,m=e=>e==null?``:typeof e==`number`?e.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):String(e),h=e=>e==null?``:e.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}),g=(e,t)=>{if(e==null)return(0,Z.jsx)(`span`,{children:`-`});let n=t?`${e>=0?`+`:``}${e.toFixed(2)}%`:`${e>=0?`+`:``}${e.toFixed(2)}`;return(0,Z.jsx)(`span`,{className:e>=0?`change-positive`:`change-negative`,children:n})},_=e=>e==null?``:e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString();return(0,Z.jsxs)(`div`,{ref:o,className:`market-data-grid ${n?.densityMode?`density-compact`:``} ${r}`.trim(),"data-testid":`data-grid`,children:[d(),f()]})};var qi=class{constructor(e={}){this.config={flashDuration:e.flashDuration??500,batchInterval:e.batchInterval??16,enableFlash:e.enableFlash??!0,maxUpdatesPerFrame:e.maxUpdatesPerFrame??1e3,cpuThreshold:e.cpuThreshold??.8,enableLiveSorting:e.enableLiveSorting??!1,enableRankingMovement:e.enableRankingMovement??!1},this.rowCache=new Map,this.updateBuffer=[],this.flashAnimations=new Map,this.rafId=null,this.lastUpdateTime=0,this.isPaused=!1,this.isThrottled=!1,this.updateCallbacks=new Set,this.cellUpdateCallbacks=new Set,this.frameCount=0,this.lastFrameTime=performance.now(),this.avgFrameTime=16}initialize(e){this.rowCache.clear(),e.forEach(e=>{this.rowCache.set(e.id,{...e})})}processUpdate(e){if(this.isPaused)return;let t=this.rowCache.get(e.rowId);if(!t){console.warn(`Row ${e.rowId} not found in cache`);return}Object.entries(e.updates).forEach(([n,r])=>{let i=t[n];if(i!==r){let a={rowId:e.rowId,field:n,oldValue:i,newValue:r,timestamp:e.timestamp};if(this.updateBuffer.push(a),t[n]=r,this.cellUpdateCallbacks.forEach(e=>e(a)),this.config.enableFlash&&this.isNumericField(i,r)){let t=r>i?`up`:`down`,a=`${e.rowId}-${n}`;this.flashAnimations.set(a,{cellKey:a,direction:t,startTime:performance.now(),duration:this.config.flashDuration})}}}),this.rafId||=requestAnimationFrame(this.processFrame.bind(this))}processFrame(e){this.rafId=null;let t=e-this.lastFrameTime;if(this.lastFrameTime=e,this.frameCount++,this.avgFrameTime=this.avgFrameTime*.9+t*.1,this.avgFrameTime>16.67*this.config.cpuThreshold?this.isThrottled||=(console.warn(`MarketDataEngine: CPU threshold exceeded, enabling throttling`),!0):this.isThrottled&&this.avgFrameTime<16&&(console.log(`MarketDataEngine: CPU normalized, disabling throttling`),this.isThrottled=!1),this.isThrottled&&e-this.lastUpdateTime<this.config.batchInterval*2){this.rafId=requestAnimationFrame(this.processFrame.bind(this));return}if(e-this.lastUpdateTime<this.config.batchInterval){this.rafId=requestAnimationFrame(this.processFrame.bind(this));return}if(this.lastUpdateTime=e,this.updateBuffer.length>0){let e=this.updateBuffer.splice(0,this.config.maxUpdatesPerFrame);this.applyDOMUpdates(e)}if(this.cleanupFlashAnimations(e),this.updateCallbacks.size>0){let e=Array.from(this.rowCache.values());this.updateCallbacks.forEach(t=>t(e))}(this.updateBuffer.length>0||this.flashAnimations.size>0)&&(this.rafId=requestAnimationFrame(this.processFrame.bind(this)))}applyDOMUpdates(e){let t=new Map;e.forEach(e=>{t.has(e.rowId)||t.set(e.rowId,[]),t.get(e.rowId).push(e)}),t.forEach(e=>{e.forEach(e=>{let t=this.getCellElement(e.rowId,e.field);if(t){this.updateCellContent(t,e.newValue);let n=`${e.rowId}-${e.field}`,r=this.flashAnimations.get(n);r&&this.applyFlashAnimation(t,r.direction)}})})}getCellElement(e,t){let n=`[data-row-id="${e}"][data-field="${t}"]`;return document.querySelector(n)}updateCellContent(e,t){let n=this.formatCellValue(t);e.textContent!==n&&(e.textContent=n)}applyFlashAnimation(e,t){e.classList.remove(`cell-flash-up`,`cell-flash-down`),e.offsetWidth,e.classList.add(`cell-flash-${t}`)}cleanupFlashAnimations(e){let t=[];this.flashAnimations.forEach((n,r)=>{if(e-n.startTime>n.duration){t.push(r);let[e,n]=r.split(`-`),i=this.getCellElement(e,n);i&&i.classList.remove(`cell-flash-up`,`cell-flash-down`)}}),t.forEach(e=>this.flashAnimations.delete(e))}formatCellValue(e){return e==null?``:typeof e==`number`?e.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):String(e)}isNumericField(e,t){return typeof e==`number`&&typeof t==`number`}onUpdate(e){return this.updateCallbacks.add(e),()=>this.updateCallbacks.delete(e)}onCellUpdate(e){return this.cellUpdateCallbacks.add(e),()=>this.cellUpdateCallbacks.delete(e)}getRows(){return Array.from(this.rowCache.values())}getRow(e){return this.rowCache.get(e)}pause(){this.isPaused=!0,this.rafId&&=(cancelAnimationFrame(this.rafId),null)}resume(){this.isPaused=!1,this.updateBuffer.length>0&&!this.rafId&&(this.rafId=requestAnimationFrame(this.processFrame.bind(this)))}isPausedState(){return this.isPaused}isThrottledState(){return this.isThrottled}getMetrics(){return{avgFrameTime:this.avgFrameTime,fps:Math.round(1e3/this.avgFrameTime),pendingUpdates:this.updateBuffer.length,activeFlashes:this.flashAnimations.size,rowCount:this.rowCache.size,isThrottled:this.isThrottled}}clear(){this.rowCache.clear(),this.updateBuffer=[],this.flashAnimations.clear(),this.rafId&&=(cancelAnimationFrame(this.rafId),null)}destroy(){this.clear(),this.updateCallbacks.clear(),this.cellUpdateCallbacks.clear()}};function Ji(e){return new qi(e)}var Yi=class{constructor(e={}){this.config={symbols:e.symbols||this.generateDefaultSymbols(),updateFrequency:e.updateFrequency??10,priceVolatility:e.priceVolatility??.002,burstProbability:e.burstProbability??.1,burstSize:e.burstSize??5,port:e.port??8080},this.marketData=new Map,this.updateIntervals=new Map,this.clients=new Set,this.isRunning=!1,this.initializeMarketData()}generateDefaultSymbols(){return`AAPL.GOOGL.MSFT.AMZN.TSLA.META.NVDA.AMD.NFLX.DIS.BA.GS.JPM.V.MA.PYPL.SQ.SHOP.BABA.JD.PDD.NIO.XPEV.LI.BIDU.IBM.ORCL.SAP.ADBE.CRM.NOW.SNOW.PLTR.U.DDOG.ZS.CRWD.S.TWLO.NET.MDB.ESTC.FSLY.OKTA.ZM.DOCU.WORK.TEAM.ATLR.WDAY`.split(`.`).slice(0,50)}initializeMarketData(){this.config.symbols.forEach(e=>{let t=this.randomPrice(50,500),n=t*.001;this.marketData.set(e,{symbol:e,price:t,bid:t-n/2,ask:t+n/2,size:Math.floor(Math.random()*1e3)+100,volume:Math.floor(Math.random()*1e6)+1e5,change:0,changePercent:0,high:t*1.02,low:t*.98,open:t,lastUpdate:Date.now()})})}randomPrice(e,t){return Math.random()*(t-e)+e}updateSymbol(e){let t=this.marketData.get(e);if(!t)return;let n=this.config.priceVolatility,r=(Math.random()-.5)*2*n,i=t.price*r,a=Math.max(.01,t.price+i),o=a*.001,s=a-o/2,c=a+o/2,l=Math.floor((Math.random()-.5)*200),u=Math.max(10,t.size+l),d=a-t.open,f=d/t.open*100,p=Math.max(t.high,a),m=Math.min(t.low,a),h={...t,price:a,bid:s,ask:c,size:u,volume:t.volume+u,change:d,changePercent:f,high:p,low:m,lastUpdate:Date.now()};this.marketData.set(e,h),this.broadcastUpdate(e,h),Math.random()<this.config.burstProbability&&this.triggerBurst(e)}triggerBurst(e){let t=0,n=setInterval(()=>{if(t>=this.config.burstSize){clearInterval(n);return}this.updateSymbol(e),t++},10)}broadcastUpdate(e,t){let n={type:`tick`,symbol:e,timestamp:Date.now(),updates:{price:t.price,bid:t.bid,ask:t.ask,size:t.size,volume:t.volume,change:t.change,changePercent:t.changePercent,high:t.high,low:t.low}};this.clients.forEach(e=>{e.readyState===1&&e.onmessage&&e.onmessage({data:JSON.stringify(n)})})}start(){this.isRunning||(this.isRunning=!0,console.log(`Mock feed started with ${this.config.symbols.length} symbols`),this.config.symbols.forEach(e=>{let t=1e3/this.config.updateFrequency,n=setInterval(()=>{this.updateSymbol(e)},t);this.updateIntervals.set(e,n)}))}stop(){this.isRunning&&(this.isRunning=!1,console.log(`Mock feed stopped`),this.updateIntervals.forEach(e=>clearInterval(e)),this.updateIntervals.clear())}connect(e){this.clients.add(e),console.log(`Client connected (${this.clients.size} total)`);let t={type:`snapshot`,timestamp:Date.now(),data:Array.from(this.marketData.values()).map(e=>({id:e.symbol,symbol:e.symbol,price:e.price,bid:e.bid,ask:e.ask,size:e.size,volume:e.volume,change:e.change,changePercent:e.changePercent,high:e.high,low:e.low,open:e.open}))};e.onmessage&&e.onmessage({data:JSON.stringify(t)})}disconnect(e){this.clients.delete(e),console.log(`Client disconnected (${this.clients.size} total)`)}getSnapshot(){return Array.from(this.marketData.values())}getSymbolData(e){return this.marketData.get(e)}};function Xi(e){let t={readyState:0,onmessage:null,onopen:null,onclose:null,onerror:null,send(e){try{let n=JSON.parse(e);n.type===`subscribe`?(console.log(`Subscribed to:`,n.symbols),t.onmessage&&t.onmessage({data:JSON.stringify({type:`subscribed`,symbols:n.symbols})})):n.type===`unsubscribe`&&console.log(`Unsubscribed from:`,n.symbols)}catch(e){console.error(`Error handling message:`,e)}},close(){t.readyState===1&&(t.readyState=3,e.disconnect(t),t.onclose&&t.onclose())}};setTimeout(()=>{t.readyState=1,t.onopen&&t.onopen(),setTimeout(()=>{e.connect(t)},10)},100);let n=t.send.bind(t);return t.send=e=>{t.readyState===1&&n(e)},t}function Zi(e){let t=new Yi(e);return t.start(),{feed:t,createConnection:()=>Xi(t)}}function Qi(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function $i(e,t){if(e==null)return{};var n,r,i=Qi(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ea(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ta(e){if(Array.isArray(e))return ea(e)}function na(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function ra(e,t){if(e){if(typeof e==`string`)return ea(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ea(e,t):void 0}}function ia(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
64
|
+
};`})]}),(0,Z.jsxs)(`div`,{style:{marginTop:`30px`,padding:`24px`,background:`linear-gradient(to bottom right, #ffffff, #f9fafb)`,border:`1px solid #e5e7eb`,borderRadius:`12px`,boxShadow:`0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)`},children:[(0,Z.jsxs)(`h3`,{style:{fontSize:`20px`,fontWeight:`700`,marginBottom:`20px`,color:`#111827`,display:`flex`,alignItems:`center`,gap:`8px`},children:[(0,Z.jsx)(`span`,{style:{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:`32px`,height:`32px`,backgroundColor:`#3b82f6`,borderRadius:`8px`,color:`white`,fontSize:`18px`},children:`⚡`}),`Grid API Methods Available`]}),(0,Z.jsxs)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(auto-fit, minmax(280px, 1fr))`,gap:`16px`},children:[(0,Z.jsxs)(`div`,{style:{padding:`16px`,backgroundColor:`#ffffff`,borderRadius:`8px`,border:`1px solid #e5e7eb`,transition:`all 0.2s ease`,boxShadow:`0 1px 3px rgba(0,0,0,0.05)`},children:[(0,Z.jsxs)(`h4`,{style:{fontSize:`14px`,fontWeight:`600`,marginBottom:`12px`,color:`#3b82f6`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{children:`📊`}),` Data & Model`]}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.8`,listStyle:`none`,padding:0,margin:0},children:[(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#10b981`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`setRowData(rows)`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#10b981`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`applyTransaction(tx)`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#10b981`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`getModel()`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#10b981`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`getDisplayedRowCount()`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#10b981`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`forEachNode(callback)`})]})]})]}),(0,Z.jsxs)(`div`,{style:{padding:`16px`,backgroundColor:`#ffffff`,borderRadius:`8px`,border:`1px solid #e5e7eb`,transition:`all 0.2s ease`,boxShadow:`0 1px 3px rgba(0,0,0,0.05)`},children:[(0,Z.jsxs)(`h4`,{style:{fontSize:`14px`,fontWeight:`600`,marginBottom:`12px`,color:`#8b5cf6`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{children:`📋`}),` Columns`]}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.8`,listStyle:`none`,padding:0,margin:0},children:[(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#8b5cf6`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`getColumnDefs()`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#8b5cf6`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`setColumnVisible(key, visible)`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#8b5cf6`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`setColumnPinned(key, pinned)`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#8b5cf6`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`autoSizeColumns(keys?)`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#8b5cf6`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`sizeColumnsToFit()`})]})]})]}),(0,Z.jsxs)(`div`,{style:{padding:`16px`,backgroundColor:`#ffffff`,borderRadius:`8px`,border:`1px solid #e5e7eb`,transition:`all 0.2s ease`,boxShadow:`0 1px 3px rgba(0,0,0,0.05)`},children:[(0,Z.jsxs)(`h4`,{style:{fontSize:`14px`,fontWeight:`600`,marginBottom:`12px`,color:`#f59e0b`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{children:`🔍`}),` Filtering & Sorting`]}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.8`,listStyle:`none`,padding:0,margin:0},children:[(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#f59e0b`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`getFilterModel()`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#f59e0b`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`setFilterModel(model)`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#f59e0b`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`getSortModel()`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#f59e0b`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`setSortModel(model)`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#f59e0b`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`clearAllFilters()`})]})]})]}),(0,Z.jsxs)(`div`,{style:{padding:`16px`,backgroundColor:`#ffffff`,borderRadius:`8px`,border:`1px solid #e5e7eb`,transition:`all 0.2s ease`,boxShadow:`0 1px 3px rgba(0,0,0,0.05)`},children:[(0,Z.jsxs)(`h4`,{style:{fontSize:`14px`,fontWeight:`600`,marginBottom:`12px`,color:`#ec4899`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{children:`✅`}),` Selection`]}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.8`,listStyle:`none`,padding:0,margin:0},children:[(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#ec4899`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`getSelectedRows()`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#ec4899`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`selectAll()`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#ec4899`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`deselectAll()`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#ec4899`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`selectAllFiltered()`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#ec4899`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`getSelectedRowCount()`})]})]})]}),(0,Z.jsxs)(`div`,{style:{padding:`16px`,backgroundColor:`#ffffff`,borderRadius:`8px`,border:`1px solid #e5e7eb`,transition:`all 0.2s ease`,boxShadow:`0 1px 3px rgba(0,0,0,0.05)`},children:[(0,Z.jsxs)(`h4`,{style:{fontSize:`14px`,fontWeight:`600`,marginBottom:`12px`,color:`#14b8a6`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{children:`🧭`}),` Navigation`]}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.8`,listStyle:`none`,padding:0,margin:0},children:[(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#14b8a6`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`ensureIndexVisible(index)`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#14b8a6`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`setFocusedCell(row, col)`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#14b8a6`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`clearFocusedCell()`})]})]})]}),(0,Z.jsxs)(`div`,{style:{padding:`16px`,backgroundColor:`#ffffff`,borderRadius:`8px`,border:`1px solid #e5e7eb`,transition:`all 0.2s ease`,boxShadow:`0 1px 3px rgba(0,0,0,0.05)`},children:[(0,Z.jsxs)(`h4`,{style:{fontSize:`14px`,fontWeight:`600`,marginBottom:`12px`,color:`#06b6d4`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{children:`📤`}),` Export`]}),(0,Z.jsxs)(`ul`,{style:{fontSize:`13px`,lineHeight:`1.8`,listStyle:`none`,padding:0,margin:0},children:[(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#06b6d4`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`exportDataAsCsv(params?)`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#06b6d4`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`getDataAsCsv(params?)`})]}),(0,Z.jsxs)(`li`,{style:{padding:`4px 0`,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,Z.jsx)(`span`,{style:{color:`#06b6d4`,fontSize:`10px`},children:`●`}),(0,Z.jsx)(`code`,{style:{backgroundColor:`#f3f4f6`,padding:`2px 6px`,borderRadius:`4px`,fontSize:`12px`},children:`copySelectedRowsToClipboard()`})]})]})]})]})]})]})};var Gi={display:`block`,width:`100%`,padding:`6px 12px`,marginBottom:`6px`,fontSize:`13px`,backgroundColor:`#fff`,border:`1px solid #d1d5db`,borderRadius:`4px`,cursor:`pointer`,textAlign:`left`,transition:`all 0.15s`};const Ki=({columns:e,rows:t,config:n,className:r=``,onCellClick:i,onRowClick:a})=>{let o=(0,b.useRef)(null),s=(0,b.useRef)(t);(0,b.useEffect)(()=>{s.current=t},[t]);let c=(0,b.useMemo)(()=>e.map(e=>e.field===`price`||e.field===`bid`||e.field===`ask`?{...e,renderCell:t=>{let n=t[e.field];return h(n)}}:e.field===`change`||e.field===`changePercent`?{...e,renderCell:t=>{let n=t[e.field];return g(n,e.field===`changePercent`)}}:e.field===`volume`||e.field===`size`?{...e,renderCell:t=>{let n=t[e.field];return _(n)}}:e),[e]),l=(0,b.useCallback)((e,t,n)=>{i?.(e,t,n)},[i]),u=(0,b.useCallback)(e=>{a?.(e)},[a]),d=()=>(0,Z.jsx)(`div`,{className:`market-grid-header`,children:(0,Z.jsx)(`div`,{className:`market-grid-header-row`,children:c.map(e=>(0,Z.jsx)(`div`,{className:`market-grid-header-cell ${p(e.field)}`,style:{width:e.width||120},children:e.headerName},e.field))})}),f=()=>(0,Z.jsx)(`div`,{className:`market-grid-body`,children:t.map(e=>(0,Z.jsx)(`div`,{className:`market-grid-row`,onClick:()=>u(e),children:c.map(t=>{let n=e[t.field];return(0,Z.jsx)(`div`,{className:`market-grid-cell ${p(t.field)}`,style:{width:t.width||120},"data-row-id":e.id,"data-field":t.field,onClick:r=>{r.stopPropagation(),l(e.id,t.field,n)},children:t.renderCell?t.renderCell(e):m(n)},t.field)})},e.id))}),p=e=>[`price`,`bid`,`ask`,`size`,`volume`,`change`,`changePercent`,`high`,`low`,`open`].includes(e)?`numeric-cell`:``,m=e=>e==null?``:typeof e==`number`?e.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):String(e),h=e=>e==null?``:e.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}),g=(e,t)=>{if(e==null)return(0,Z.jsx)(`span`,{children:`-`});let n=t?`${e>=0?`+`:``}${e.toFixed(2)}%`:`${e>=0?`+`:``}${e.toFixed(2)}`;return(0,Z.jsx)(`span`,{className:e>=0?`change-positive`:`change-negative`,children:n})},_=e=>e==null?``:e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString();return(0,Z.jsxs)(`div`,{ref:o,className:`market-data-grid ${n?.densityMode?`density-compact`:``} ${r}`.trim(),"data-testid":`data-grid`,children:[d(),f()]})};var qi=class{constructor(e={}){this.config={flashDuration:e.flashDuration??500,batchInterval:e.batchInterval??16,enableFlash:e.enableFlash??!0,maxUpdatesPerFrame:e.maxUpdatesPerFrame??1e3,cpuThreshold:e.cpuThreshold??.8,enableLiveSorting:e.enableLiveSorting??!1,enableRankingMovement:e.enableRankingMovement??!1},this.rowCache=new Map,this.updateBuffer=[],this.flashAnimations=new Map,this.rafId=null,this.lastUpdateTime=0,this.isPaused=!1,this.isThrottled=!1,this.updateCallbacks=new Set,this.cellUpdateCallbacks=new Set,this.frameCount=0,this.lastFrameTime=performance.now(),this.avgFrameTime=16}initialize(e){this.rowCache.clear(),e.forEach(e=>{this.rowCache.set(e.id,{...e})})}processUpdate(e){if(this.isPaused)return;let t=this.rowCache.get(e.rowId);if(!t){console.warn(`Row ${e.rowId} not found in cache`);return}Object.entries(e.updates).forEach(([n,r])=>{let i=t[n];if(i!==r){let a={rowId:e.rowId,field:n,oldValue:i,newValue:r,timestamp:e.timestamp};if(this.updateBuffer.push(a),t[n]=r,this.cellUpdateCallbacks.forEach(e=>e(a)),this.config.enableFlash&&this.isNumericField(i,r)){let t=r>i?`up`:`down`,a=`${e.rowId}-${n}`;this.flashAnimations.set(a,{cellKey:a,direction:t,startTime:performance.now(),duration:this.config.flashDuration})}}}),this.rafId||=requestAnimationFrame(this.processFrame.bind(this))}processFrame(e){this.rafId=null;let t=e-this.lastFrameTime;if(this.lastFrameTime=e,this.frameCount++,this.avgFrameTime=this.avgFrameTime*.9+t*.1,this.avgFrameTime>16.67*this.config.cpuThreshold?this.isThrottled||=(console.warn(`MarketDataEngine: CPU threshold exceeded, enabling throttling`),!0):this.isThrottled&&this.avgFrameTime<16&&(console.log(`MarketDataEngine: CPU normalized, disabling throttling`),this.isThrottled=!1),this.isThrottled&&e-this.lastUpdateTime<this.config.batchInterval*2){this.rafId=requestAnimationFrame(this.processFrame.bind(this));return}if(e-this.lastUpdateTime<this.config.batchInterval){this.rafId=requestAnimationFrame(this.processFrame.bind(this));return}if(this.lastUpdateTime=e,this.updateBuffer.length>0){let e=this.updateBuffer.splice(0,this.config.maxUpdatesPerFrame);this.applyDOMUpdates(e)}if(this.cleanupFlashAnimations(e),this.updateCallbacks.size>0){let e=Array.from(this.rowCache.values());this.updateCallbacks.forEach(t=>t(e))}(this.updateBuffer.length>0||this.flashAnimations.size>0)&&(this.rafId=requestAnimationFrame(this.processFrame.bind(this)))}applyDOMUpdates(e){let t=new Map;e.forEach(e=>{t.has(e.rowId)||t.set(e.rowId,[]),t.get(e.rowId).push(e)}),t.forEach(e=>{e.forEach(e=>{let t=this.getCellElement(e.rowId,e.field);if(t){this.updateCellContent(t,e.newValue);let n=`${e.rowId}-${e.field}`,r=this.flashAnimations.get(n);r&&this.applyFlashAnimation(t,r.direction)}})})}getCellElement(e,t){let n=`[data-row-id="${e}"][data-field="${t}"]`;return document.querySelector(n)}updateCellContent(e,t){let n=this.formatCellValue(t);e.textContent!==n&&(e.textContent=n)}applyFlashAnimation(e,t){e.classList.remove(`cell-flash-up`,`cell-flash-down`),e.offsetWidth,e.classList.add(`cell-flash-${t}`)}cleanupFlashAnimations(e){let t=[];this.flashAnimations.forEach((n,r)=>{if(e-n.startTime>n.duration){t.push(r);let[e,n]=r.split(`-`),i=this.getCellElement(e,n);i&&i.classList.remove(`cell-flash-up`,`cell-flash-down`)}}),t.forEach(e=>this.flashAnimations.delete(e))}formatCellValue(e){return e==null?``:typeof e==`number`?e.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):String(e)}isNumericField(e,t){return typeof e==`number`&&typeof t==`number`}onUpdate(e){return this.updateCallbacks.add(e),()=>this.updateCallbacks.delete(e)}onCellUpdate(e){return this.cellUpdateCallbacks.add(e),()=>this.cellUpdateCallbacks.delete(e)}getRows(){return Array.from(this.rowCache.values())}getRow(e){return this.rowCache.get(e)}pause(){this.isPaused=!0,this.rafId&&=(cancelAnimationFrame(this.rafId),null)}resume(){this.isPaused=!1,this.updateBuffer.length>0&&!this.rafId&&(this.rafId=requestAnimationFrame(this.processFrame.bind(this)))}isPausedState(){return this.isPaused}isThrottledState(){return this.isThrottled}getMetrics(){return{avgFrameTime:this.avgFrameTime,fps:Math.round(1e3/this.avgFrameTime),pendingUpdates:this.updateBuffer.length,activeFlashes:this.flashAnimations.size,rowCount:this.rowCache.size,isThrottled:this.isThrottled}}clear(){this.rowCache.clear(),this.updateBuffer=[],this.flashAnimations.clear(),this.rafId&&=(cancelAnimationFrame(this.rafId),null)}destroy(){this.clear(),this.updateCallbacks.clear(),this.cellUpdateCallbacks.clear()}};function Ji(e){return new qi(e)}var Yi=class{constructor(e={}){this.config={symbols:e.symbols||this.generateDefaultSymbols(),updateFrequency:e.updateFrequency??10,priceVolatility:e.priceVolatility??.002,burstProbability:e.burstProbability??.1,burstSize:e.burstSize??5,port:e.port??8080},this.marketData=new Map,this.updateIntervals=new Map,this.clients=new Set,this.isRunning=!1,this.initializeMarketData()}generateDefaultSymbols(){return`AAPL.GOOGL.MSFT.AMZN.TSLA.META.NVDA.AMD.NFLX.DIS.BA.GS.JPM.V.MA.PYPL.SQ.SHOP.BABA.JD.PDD.NIO.XPEV.LI.BIDU.IBM.ORCL.SAP.ADBE.CRM.NOW.SNOW.PLTR.U.DDOG.ZS.CRWD.S.TWLO.NET.MDB.ESTC.FSLY.OKTA.ZM.DOCU.WORK.TEAM.ATLR.WDAY`.split(`.`).slice(0,50)}initializeMarketData(){this.config.symbols.forEach(e=>{let t=this.randomPrice(50,500),n=t*.001;this.marketData.set(e,{symbol:e,price:t,bid:t-n/2,ask:t+n/2,size:Math.floor(Math.random()*1e3)+100,volume:Math.floor(Math.random()*1e6)+1e5,change:0,changePercent:0,high:t*1.02,low:t*.98,open:t,lastUpdate:Date.now()})})}randomPrice(e,t){return Math.random()*(t-e)+e}updateSymbol(e){let t=this.marketData.get(e);if(!t)return;let n=this.config.priceVolatility,r=(Math.random()-.5)*2*n,i=t.price*r,a=Math.max(.01,t.price+i),o=a*.001,s=a-o/2,c=a+o/2,l=Math.floor((Math.random()-.5)*200),u=Math.max(10,t.size+l),d=a-t.open,f=d/t.open*100,p=Math.max(t.high,a),m=Math.min(t.low,a),h={...t,price:a,bid:s,ask:c,size:u,volume:t.volume+u,change:d,changePercent:f,high:p,low:m,lastUpdate:Date.now()};this.marketData.set(e,h),this.broadcastUpdate(e,h),Math.random()<this.config.burstProbability&&this.triggerBurst(e)}triggerBurst(e){let t=0,n=setInterval(()=>{if(t>=this.config.burstSize){clearInterval(n);return}this.updateSymbol(e),t++},10)}broadcastUpdate(e,t){let n={type:`tick`,symbol:e,timestamp:Date.now(),updates:{price:t.price,bid:t.bid,ask:t.ask,size:t.size,volume:t.volume,change:t.change,changePercent:t.changePercent,high:t.high,low:t.low}};this.clients.forEach(e=>{e.readyState===1&&e.onmessage&&e.onmessage({data:JSON.stringify(n)})})}start(){this.isRunning||(this.isRunning=!0,console.log(`Mock feed started with ${this.config.symbols.length} symbols`),this.config.symbols.forEach(e=>{let t=1e3/this.config.updateFrequency,n=setInterval(()=>{this.updateSymbol(e)},t);this.updateIntervals.set(e,n)}))}stop(){this.isRunning&&(this.isRunning=!1,console.log(`Mock feed stopped`),this.updateIntervals.forEach(e=>clearInterval(e)),this.updateIntervals.clear())}connect(e){this.clients.add(e),console.log(`Client connected (${this.clients.size} total)`);let t={type:`snapshot`,timestamp:Date.now(),data:Array.from(this.marketData.values()).map(e=>({id:e.symbol,symbol:e.symbol,price:e.price,bid:e.bid,ask:e.ask,size:e.size,volume:e.volume,change:e.change,changePercent:e.changePercent,high:e.high,low:e.low,open:e.open}))};e.onmessage&&e.onmessage({data:JSON.stringify(t)})}disconnect(e){this.clients.delete(e),console.log(`Client disconnected (${this.clients.size} total)`)}getSnapshot(){return Array.from(this.marketData.values())}getSymbolData(e){return this.marketData.get(e)}};function Xi(e){let t={readyState:0,onmessage:null,onopen:null,onclose:null,onerror:null,send(e){try{let n=JSON.parse(e);n.type===`subscribe`?(console.log(`Subscribed to:`,n.symbols),t.onmessage&&t.onmessage({data:JSON.stringify({type:`subscribed`,symbols:n.symbols})})):n.type===`unsubscribe`&&console.log(`Unsubscribed from:`,n.symbols)}catch(e){console.error(`Error handling message:`,e)}},close(){t.readyState===1&&(t.readyState=3,e.disconnect(t),t.onclose&&t.onclose())}};setTimeout(()=>{t.readyState=1,t.onopen&&t.onopen(),setTimeout(()=>{e.connect(t)},10)},100);let n=t.send.bind(t);return t.send=e=>{t.readyState===1&&n(e)},t}function Zi(e){let t=new Yi(e);return t.start(),{feed:t,createConnection:()=>Xi(t)}}function Qi(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function $i(e,t){if(e==null)return{};var n,r,i=Qi(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ea(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ta(e){if(Array.isArray(e))return ea(e)}function na(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function ra(e,t){if(e){if(typeof e==`string`)return ea(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ea(e,t):void 0}}function ia(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
65
65
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aa(e){return ta(e)||na(e)||ra(e)||ia()}function oa(e){"@babel/helpers - typeof";return oa=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},oa(e)}function sa(e,t){if(oa(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(oa(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function ca(e){var t=sa(e,`string`);return oa(t)==`symbol`?t:t+``}function la(e,t,n){return(t=ca(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ua(){return ua=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ua.apply(null,arguments)}function da(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fa(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?da(Object(n),!0).forEach(function(t){la(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):da(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function pa(e){var t=e.length;if(t===0||t===1)return e;if(t===2)return[e[0],e[1],`${e[0]}.${e[1]}`,`${e[1]}.${e[0]}`];if(t===3)return[e[0],e[1],e[2],`${e[0]}.${e[1]}`,`${e[0]}.${e[2]}`,`${e[1]}.${e[0]}`,`${e[1]}.${e[2]}`,`${e[2]}.${e[0]}`,`${e[2]}.${e[1]}`,`${e[0]}.${e[1]}.${e[2]}`,`${e[0]}.${e[2]}.${e[1]}`,`${e[1]}.${e[0]}.${e[2]}`,`${e[1]}.${e[2]}.${e[0]}`,`${e[2]}.${e[0]}.${e[1]}`,`${e[2]}.${e[1]}.${e[0]}`];if(t>=4)return[e[0],e[1],e[2],e[3],`${e[0]}.${e[1]}`,`${e[0]}.${e[2]}`,`${e[0]}.${e[3]}`,`${e[1]}.${e[0]}`,`${e[1]}.${e[2]}`,`${e[1]}.${e[3]}`,`${e[2]}.${e[0]}`,`${e[2]}.${e[1]}`,`${e[2]}.${e[3]}`,`${e[3]}.${e[0]}`,`${e[3]}.${e[1]}`,`${e[3]}.${e[2]}`,`${e[0]}.${e[1]}.${e[2]}`,`${e[0]}.${e[1]}.${e[3]}`,`${e[0]}.${e[2]}.${e[1]}`,`${e[0]}.${e[2]}.${e[3]}`,`${e[0]}.${e[3]}.${e[1]}`,`${e[0]}.${e[3]}.${e[2]}`,`${e[1]}.${e[0]}.${e[2]}`,`${e[1]}.${e[0]}.${e[3]}`,`${e[1]}.${e[2]}.${e[0]}`,`${e[1]}.${e[2]}.${e[3]}`,`${e[1]}.${e[3]}.${e[0]}`,`${e[1]}.${e[3]}.${e[2]}`,`${e[2]}.${e[0]}.${e[1]}`,`${e[2]}.${e[0]}.${e[3]}`,`${e[2]}.${e[1]}.${e[0]}`,`${e[2]}.${e[1]}.${e[3]}`,`${e[2]}.${e[3]}.${e[0]}`,`${e[2]}.${e[3]}.${e[1]}`,`${e[3]}.${e[0]}.${e[1]}`,`${e[3]}.${e[0]}.${e[2]}`,`${e[3]}.${e[1]}.${e[0]}`,`${e[3]}.${e[1]}.${e[2]}`,`${e[3]}.${e[2]}.${e[0]}`,`${e[3]}.${e[2]}.${e[1]}`,`${e[0]}.${e[1]}.${e[2]}.${e[3]}`,`${e[0]}.${e[1]}.${e[3]}.${e[2]}`,`${e[0]}.${e[2]}.${e[1]}.${e[3]}`,`${e[0]}.${e[2]}.${e[3]}.${e[1]}`,`${e[0]}.${e[3]}.${e[1]}.${e[2]}`,`${e[0]}.${e[3]}.${e[2]}.${e[1]}`,`${e[1]}.${e[0]}.${e[2]}.${e[3]}`,`${e[1]}.${e[0]}.${e[3]}.${e[2]}`,`${e[1]}.${e[2]}.${e[0]}.${e[3]}`,`${e[1]}.${e[2]}.${e[3]}.${e[0]}`,`${e[1]}.${e[3]}.${e[0]}.${e[2]}`,`${e[1]}.${e[3]}.${e[2]}.${e[0]}`,`${e[2]}.${e[0]}.${e[1]}.${e[3]}`,`${e[2]}.${e[0]}.${e[3]}.${e[1]}`,`${e[2]}.${e[1]}.${e[0]}.${e[3]}`,`${e[2]}.${e[1]}.${e[3]}.${e[0]}`,`${e[2]}.${e[3]}.${e[0]}.${e[1]}`,`${e[2]}.${e[3]}.${e[1]}.${e[0]}`,`${e[3]}.${e[0]}.${e[1]}.${e[2]}`,`${e[3]}.${e[0]}.${e[2]}.${e[1]}`,`${e[3]}.${e[1]}.${e[0]}.${e[2]}`,`${e[3]}.${e[1]}.${e[2]}.${e[0]}`,`${e[3]}.${e[2]}.${e[0]}.${e[1]}`,`${e[3]}.${e[2]}.${e[1]}.${e[0]}`]}var ma={};function ha(e){if(e.length===0||e.length===1)return e;var t=e.join(`.`);return ma[t]||(ma[t]=pa(e)),ma[t]}function ga(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return ha(e.filter(function(e){return e!==`token`})).reduce(function(e,t){return fa(fa({},e),n[t])},t)}function _a(e){return e.join(` `)}function va(e,t){var n=0;return function(r){return n+=1,r.map(function(r,i){return ya({node:r,stylesheet:e,useInlineStyles:t,key:`code-segment-${n}-${i}`})})}}function ya(e){var t=e.node,n=e.stylesheet,r=e.style,i=r===void 0?{}:r,a=e.useInlineStyles,o=e.key,s=t.properties,c=t.type,l=t.tagName,u=t.value;if(c===`text`)return u;if(l){var d=va(n,a),f;if(!a)f=fa(fa({},s),{},{className:_a(s.className)});else{var p=Object.keys(n).reduce(function(e,t){return t.split(`.`).forEach(function(t){e.includes(t)||e.push(t)}),e},[]),m=s.className&&s.className.includes(`token`)?[`token`]:[],h=s.className&&m.concat(s.className.filter(function(e){return!p.includes(e)}));f=fa(fa({},s),{},{className:_a(h)||void 0,style:ga(s.className,Object.assign({},s.style,i),n)})}var g=d(t.children);return b.createElement(l,ua({key:o},f),g)}}var ba=(function(e,t){return e.listLanguages().indexOf(t)!==-1}),xa=[`language`,`children`,`style`,`customStyle`,`codeTagProps`,`useInlineStyles`,`showLineNumbers`,`showInlineLineNumbers`,`startingLineNumber`,`lineNumberContainerStyle`,`lineNumberStyle`,`wrapLines`,`wrapLongLines`,`lineProps`,`renderer`,`PreTag`,`CodeTag`,`code`,`astGenerator`];function Sa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ca(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Sa(Object(n),!0).forEach(function(t){la(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Sa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var wa=/\n/g;function Ta(e){return e.match(wa)}function Ea(e){var t=e.lines,n=e.startingLineNumber,r=e.style;return t.map(function(e,t){var i=t+n;return b.createElement(`span`,{key:`line-${t}`,className:`react-syntax-highlighter-line-number`,style:typeof r==`function`?r(i):r},`${i}
|
|
66
66
|
`)})}function Da(e){var t=e.codeString,n=e.codeStyle,r=e.containerStyle,i=r===void 0?{float:`left`,paddingRight:`10px`}:r,a=e.numberStyle,o=a===void 0?{}:a,s=e.startingLineNumber;return b.createElement(`code`,{style:Object.assign({},n,i)},Ea({lines:t.replace(/\n$/,``).split(`
|
|
67
67
|
`),style:o,startingLineNumber:s}))}function Oa(e){return`${e.toString().length}.25em`}function ka(e,t){return{type:`element`,tagName:`span`,properties:{key:`line-number--${e}`,className:[`comment`,`linenumber`,`react-syntax-highlighter-line-number`],style:t},children:[{type:`text`,value:e}]}}function Aa(e,t,n){var r={display:`inline-block`,minWidth:Oa(n),paddingRight:`1em`,textAlign:`right`,userSelect:`none`},i=typeof e==`function`?e(t):e;return Ca(Ca({},r),i)}function ja(e){var t=e.children,n=e.lineNumber,r=e.lineNumberStyle,i=e.largestLineNumber,a=e.showInlineLineNumbers,o=e.lineProps,s=o===void 0?{}:o,c=e.className,l=c===void 0?[]:c,u=e.showLineNumbers,d=e.wrapLongLines,f=e.wrapLines,p=f!==void 0&&f?Ca({},typeof s==`function`?s(n):s):{};if(p.className=p.className?[].concat(aa(p.className.trim().split(/\s+/)),aa(l)):l,n&&a){var m=Aa(r,n,i);t.unshift(ka(n,m))}return d&u&&(p.style=Ca({display:`flex`},p.style)),{type:`element`,tagName:`span`,properties:p,children:t}}function Ma(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var r=0;r<e.length;r++){var i=e[r];if(i.type===`text`)n.push(ja({children:[i],className:aa(new Set(t))}));else if(i.children){var a=t.concat(i.properties?.className||[]);Ma(i.children,a).forEach(function(e){return n.push(e)})}}return n}function Na(e,t,n,r,i,a,o,s,c){var l,u=Ma(e.value),d=[],f=-1,p=0;function m(e,a){return ja({children:e,lineNumber:a,lineNumberStyle:s,largestLineNumber:o,showInlineLineNumbers:i,lineProps:n,className:arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],showLineNumbers:r,wrapLongLines:c,wrapLines:t})}function h(e,t){if(r&&t&&i){var n=Aa(s,t,o);e.unshift(ka(t,n))}return e}function g(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return t||r.length>0?m(e,n,r):h(e,n)}for(var _=function(){var e=u[p],t=e.children[0].value;if(Ta(t)){var n=t.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./index-
|
|
1
|
+
import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"./index-Bw3BL6AP.js";export{e as createPreset};
|
package/dist/index.html
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
}
|
|
69
69
|
}(window.location))
|
|
70
70
|
</script>
|
|
71
|
-
<script type="module" crossorigin src="/assets/index-
|
|
71
|
+
<script type="module" crossorigin src="/assets/index-Bw3BL6AP.js"></script>
|
|
72
72
|
<link rel="stylesheet" crossorigin href="/assets/index-DqLWhpvP.css">
|
|
73
73
|
</head>
|
|
74
74
|
<body>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-open-source-grid",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "A high-performance React DataGrid component with advanced features like virtual scrolling, infinite scrolling, tree data, market data mode, and more",
|
|
7
7
|
"main": "./dist/assets/index.js",
|