@alaarab/ogrid-core 2.7.1 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
2
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}function j(t){return t.map(e=>k(e.name)).join(",")}function
|
|
3
|
-
`);Y(a,r??`export_${new Date().toISOString().slice(0,10)}.csv`);}function Y(t,e){let n=new Blob([t],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(n),o=document.createElement("a");try{o.setAttribute("href",r),o.setAttribute("download",e),o.style.visibility="hidden",document.body.appendChild(o),o.click();}finally{try{document.body.removeChild(o);}catch{}URL.revokeObjectURL(r);}}function x(t,e){return e.valueGetter?e.valueGetter(t):t[e.columnId]}function h(t,e){return t.editable===true||typeof t.editable=="function"&&t.editable(e)}function pe(t,e){return {getCellValue:(n,r)=>r<0||r>=t.length||n<0||n>=e.length?null:x(t[r],e[n]),getRowCount:()=>t.length,getColumnCount:()=>e.length}}function L(t){return "children"in t&&Array.isArray(t.children)}function Z(t){let e=[];for(let n of t)L(n)?e.push(...Z(n.children)):e.push(n);return e}function ge(t,e){function n(m,c){let d=c;for(let s of m)L(s)&&(d=Math.max(d,n(s.children,c+1)));return d}let r=n(t,0);if(r===0){let m=[];for(let c of t)if(!L(c)){if(e&&!e.has(c.columnId))continue;m.push({label:c.name,colSpan:1,isGroup:false,columnDef:c,depth:0});}return [m]}let o=r+1,l=Array.from({length:o},()=>[]),i=new Map;function a(m){let c=i.get(m);if(c!==void 0)return c;let d=0;for(let s of m)L(s)?d+=a(s.children):(!e||e.has(s.columnId))&&d++;return i.set(m,d),d}function u(m,c){for(let d of m)if(L(d)){let s=a(d.children);if(s===0)continue;l[c].push({label:d.headerName,colSpan:s,isGroup:true,depth:c}),u(d.children,c+1);}else {if(e&&!e.has(d.columnId))continue;l[c].push({label:d.name,colSpan:1,isGroup:false,columnDef:d,depth:c});}}return u(t,0),l.filter(m=>m.length>0)}function v(t){return t!=null&&typeof t=="object"&&"type"in t}function w(t){return (v(t.filterable)?t.filterable:null)?.filterField??t.columnId}function Ce(t,e,n){if(n===void 0||n.type==="text"&&n.value.trim()===""||n.type==="multiSelect"&&n.value.length===0||n.type==="date"&&!n.value.from&&!n.value.to||n.type==="people"&&!n.value){let{[e]:o,...l}=t;return l}return {...t,[e]:n}}function Ie(t,e){let n=[];for(let l=0;l<e.length;l++){let i=e[l];(v(i.filterable)?i.filterable:null)?.type==="multiSelect"&&n.push({col:i,field:w(i)});}if(n.length===0)return {};let r=new Map;for(let l=0;l<n.length;l++)r.set(n[l].field,new Set);for(let l=0;l<t.length;l++){let i=t[l];for(let a=0;a<n.length;a++){let u=x(i,n[a].col),m=r.get(n[a].field);u!=null&&u!==""&&m&&m.add(String(u));}}let o={};for(let l=0;l<n.length;l++){let i=r.get(n[l].field);o[n[l].field]=i?Array.from(i).sort():[];}return o}function be(t){let e=[];for(let n of t)(v(n.filterable)?n.filterable:null)?.type==="multiSelect"&&e.push(w(n));return e}function xe(t){let{totalCount:e,filteredCount:n,selectedCount:r,selectedCellCount:o,aggregation:l,suppressRowCount:i}=t,a=[];return i||a.push({key:"total",label:"Rows:",value:e}),n!==void 0&&n!==e&&a.push({key:"filtered",label:"Filtered:",value:n}),r!==void 0&&r>0&&a.push({key:"selected",label:"Selected:",value:r}),o!==void 0&&o>1&&a.push({key:"cells",label:"Cells:",value:o}),l&&(a.push({key:"sum",label:"Sum:",value:l.sum}),a.push({key:"avg",label:"Avg:",value:Math.round(l.avg*100)/100}),a.push({key:"min",label:"Min:",value:l.min}),a.push({key:"max",label:"Max:",value:l.max}),a.push({key:"count",label:"Count:",value:l.count})),a}function he(t,e,n,r){return t?typeof t=="object"?t:{totalCount:e,selectedCount:n>0?n:void 0,filteredCount:r!==void 0&&r!==e?r:void 0}:null}var Q=[10,25,50,100];function Ht(t,e){return e.includes(t)?e:[...e,t].sort((n,r)=>n-r)}var J=5;function Re(t,e,n,r){if(n<=0)return null;let o=r?.maxPageButtons??J,l=Math.ceil(n/e),i,a,u;if(l<=o){i=[];for(let d=1;d<=l;d++)i.push(d);a=false,u=false;}else {let d=Math.max(1,t-2),s=Math.min(l,t+2);s-d+1<o&&(d===1?s=Math.min(l,d+o-1):s===l&&(d=Math.max(1,s-o+1))),i=[];for(let f=d;f<=s;f++)i.push(f);a=d>1,u=s<l;}let m=Math.max(1,(t-1)*e+1),c=Math.min(t*e,n);return {totalPages:l,pageNumbers:i,showStartEllipsis:a,showEndEllipsis:u,startItem:m,endItem:c,pageSizeOptions:Ht(e,r?.pageSizeOptions??Q)}}var ye=[{id:"undo",label:"Undo",shortcut:"Ctrl+Z"},{id:"redo",label:"Redo",shortcut:"Ctrl+Y"},{id:"copy",label:"Copy",shortcut:"Ctrl+C",disabledWhenNoSelection:true,dividerBefore:true},{id:"cut",label:"Cut",shortcut:"Ctrl+X",disabledWhenNoSelection:true},{id:"paste",label:"Paste",shortcut:"Ctrl+V"},{id:"selectAll",label:"Select all",shortcut:"Ctrl+A",dividerBefore:true}];function Te(t){return typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?t.replace("Ctrl","\u2318"):t}function Se(t){let{onCopy:e,onCut:n,onPaste:r,onSelectAll:o,onUndo:l,onRedo:i,onClose:a}=t;return {undo:()=>{l(),a();},redo:()=>{i(),a();},copy:()=>{e(),a();},cut:()=>{n(),a();},paste:()=>{r(),a();},selectAll:()=>{o(),a();}}}var we=[{id:"pinLeft",label:"Pin left"},{id:"pinRight",label:"Pin right"},{id:"unpin",label:"Unpin"}];function De(t){let{canPinLeft:e,canPinRight:n,canUnpin:r,currentSort:o,isSortable:l=true,isResizable:i=true}=t,a=[];if(a.push({id:"pinLeft",label:"Pin left",disabled:!e},{id:"pinRight",label:"Pin right",disabled:!n},{id:"unpin",label:"Unpin",disabled:!r,divider:l||i}),l)if(!o)a.push({id:"sortAsc",label:"Sort ascending"},{id:"sortDesc",label:"Sort descending",divider:i});else {let u=o==="asc"?"desc":"asc",m=o==="asc"?"Sort descending":"Sort ascending";a.push({id:`sort${u==="asc"?"Asc":"Desc"}`,label:m},{id:"clearSort",label:"Clear sort",divider:i});}return i&&a.push({id:"autosizeThis",label:"Autosize this column"},{id:"autosizeAll",label:"Autosize all columns"}),a}function T(t,e,n,r){if(r.valueParser){let l={newValue:t,oldValue:e,data:n,column:r},i=r.valueParser(l);return i===void 0?{valid:false,value:void 0}:{valid:true,value:i}}if(r.cellEditor==="select"&&r.cellEditorParams?.values!=null&&Array.isArray(r.cellEditorParams.values)){let l=r.cellEditorParams.values,i=typeof t=="string"?t:String(t??"");if(i==="")return {valid:true,value:""};let a=l.find(u=>String(u).toLowerCase()===i.toLowerCase());return a!==void 0?{valid:true,value:a}:{valid:false,value:void 0}}let o=r.type;if(o==="date"){let l=te({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}if(o==="boolean"){let l=ne({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}if(o==="numeric"){let l=ee({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}return {valid:true,value:t}}function ee(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).replace(/[\s,]/g,""),r=Number(n);return Number.isNaN(r)?void 0:r}function ve(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).replace(/[$\u20AC\u00A3\u00A5]/g,"").replace(/[\s,]/g,""),r=Number(n);return Number.isNaN(r)?void 0:r}function te(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim(),r=new Date(n);if(!Number.isNaN(r.getTime()))return r.toISOString().substring(0,10)}function Ee(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim();return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?n:void 0}function ne(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim().toLowerCase();if(["true","yes","1"].includes(n))return true;if(["false","no","0"].includes(n))return false}function Fe(t,e,n){if(!n)return null;let r=R(n),o=0,l=0,i=1/0,a=-1/0,u=0;for(let m=r.startRow;m<=r.endRow;m++)for(let c=r.startCol;c<=r.endCol;c++){if(m>=t.length||c>=e.length)continue;o++;let d=t[m],s=e[c],f=x(d,s),g=typeof f=="number"?f:Number(f);!isNaN(g)&&isFinite(g)&&(l+=g,g<i&&(i=g),g>a&&(a=g),u++);}return o<2||u===0?null:{sum:l,avg:l/u,min:i,max:a,count:u}}var Me=new WeakMap;function M(t,e,n,r,o){let l=Me.get(e);if(!l){l=new Map;for(let m=0;m<e.length;m++)l.set(e[m].columnId,e[m]);Me.set(e,l);}let i=[];for(let m=0;m<e.length;m++){let c=e[m],d=w(c),s=n[d];if(s)switch(s.type){case "multiSelect":if(s.value.length>0){let f=new Set(s.value);i.push(g=>f.has(String(x(g,c))));}break;case "text":{let f=s.value.trim();if(f){let g=f.toLowerCase(),p=new Map;for(let I=0;I<t.length;I++)p.set(t[I],String(x(t[I],c)??"").toLowerCase());i.push(I=>(p.get(I)??"").includes(g));}break}case "people":{let f=s.value.email.toLowerCase(),g=new Map;for(let p=0;p<t.length;p++)g.set(t[p],String(x(t[p],c)??"").toLowerCase());i.push(p=>(g.get(p)??"")===f);break}case "date":{let f=s.value,g=f.from?new Date(f.from+"T00:00:00").getTime():NaN,p=f.to?new Date(f.to+"T23:59:59.999").getTime():NaN,I=new Map;for(let C=0;C<t.length;C++){let b=x(t[C],c);if(b==null)I.set(t[C],NaN);else {let y=new Date(String(b)).getTime();I.set(t[C],Number.isNaN(y)?NaN:y);}}i.push(C=>{let b=I.get(C)??NaN;return !(Number.isNaN(b)||!Number.isNaN(g)&&b<g||!Number.isNaN(p)&&b>p)});break}}}let a=i.length>0,u=a?t.filter(m=>{for(let c=0;c<i.length;c++)if(!i[c](m))return false;return true}):t;if(r){let m=a?u:u.slice(),c=l.get(r),d=c?.compare,s=o==="asc"?1:-1;if(c?.type==="date"&&!d){let g=new Map;for(let p=0;p<m.length;p++){let I=m[p],C=c?x(I,c):I[r];if(C==null)g.set(I,NaN);else {let b=new Date(String(C)).getTime();g.set(I,Number.isNaN(b)?0:b);}}m.sort((p,I)=>{let C=g.get(p)??NaN,b=g.get(I)??NaN;return Number.isNaN(C)&&Number.isNaN(b)?0:Number.isNaN(C)?-1*s:Number.isNaN(b)?1*s:C===b?0:C>b?s:-s});}else if(d)m.sort((g,p)=>d(g,p)*s);else {let g=new Map;for(let p=0;p<m.length;p++){let I=m[p],C=c?x(I,c):I[r];C==null?g.set(I,void 0):typeof C=="number"?g.set(I,C):g.set(I,String(C).toLowerCase());}m.sort((p,I)=>{let C=g.get(p),b=g.get(I);return C===void 0&&b===void 0?0:C===void 0?-1*s:b===void 0?1*s:C===b?0:C>b?s:-s});}return m}return u}function D(t,e){if(!t)return false;let n=Math.min(t.startRow,t.endRow),r=Math.max(t.startRow,t.endRow);return e>=n&&e<=r}function Ae(t,e){if(t.item!==e.item||t.isSelected!==e.isSelected||t.hasCheckboxCol!==e.hasCheckboxCol||t.visibleCols!==e.visibleCols||t.columnMeta!==e.columnMeta||t.cellClassMap!==e.cellClassMap||t.columnLayouts!==e.columnLayouts)return false;let n=t.rowIndex;if(t.editingRowId!==e.editingRowId&&(t.editingRowId===t.rowId||e.editingRowId===e.rowId))return false;let r=t.activeCell?.rowIndex===n,o=e.activeCell?.rowIndex===n;if(r!==o||r&&o&&t.activeCell?.columnIndex!==e.activeCell?.columnIndex)return false;let l=D(t.selectionRange,n),i=D(e.selectionRange,n);if(l!==i||l&&i&&(t.selectionRange?.startCol!==e.selectionRange?.startCol||t.selectionRange?.endCol!==e.selectionRange?.endCol))return false;let a=t.selectionRange?.endRow===n,u=e.selectionRange?.endRow===n;return !(a!==u||(a||u)&&t.isDragging!==e.isDragging||t.cutRange!==e.cutRange&&(D(t.cutRange,n)||D(e.cutRange,n))||t.copyRange!==e.copyRange&&(D(t.copyRange,n)||D(e.copyRange,n)))}function re(t,e){return e?e.left?.includes(t)?"left":e.right?.includes(t)?"right":"unpinned":"unpinned"}function Pe(t,e,n){let r=t.filter(i=>i!==e),o=Math.max(0,Math.min(n,r.length)),l=[...r];return l.splice(o,0,e),l}function Ne(t){let{mouseX:e,columnOrder:n,draggedColumnId:r,draggedPinState:o,tableElement:l,pinnedColumns:i}=t,a=l.querySelectorAll("[data-column-id]");if(a.length===0)return null;let u=[];if(a.forEach(s=>{let f=s.getAttribute("data-column-id");if(!f||re(f,i)!==o)return;let p=s.getBoundingClientRect(),I=n.indexOf(f);I!==-1&&u.push({columnId:f,left:p.left,right:p.right,midX:p.left+p.width/2,orderIndex:I});}),u.length===0)return null;u.sort((s,f)=>s.left-f.left);let m,c;if(e<=u[0].midX)m=u[0].orderIndex,c=u[0].left;else if(e>=u[u.length-1].midX){let s=u[u.length-1];m=s.orderIndex+1,c=s.right;}else {let s=-1;for(let f=0;f<u.length-1;f++)if(e>=u[f].midX&&e<u[f+1].midX){s=f;break}if(s===-1)return null;m=u[s].orderIndex+1,c=u[s].right;}let d=n.indexOf(r);return d===m||d+1===m?{targetIndex:m,indicatorX:null}:{targetIndex:m,indicatorX:c}}function Oe(t,e,n,r=2){if(e.length===0||n<=0)return {startIndex:0,endIndex:-1,leftOffset:0,rightOffset:0};let o=0,l=e.length,i=-1;for(let d=0;d<e.length;d++){let s=o;o+=e[d],o>t&&l===e.length&&(l=d),s<t+n&&(i=d);}if(l>i)return {startIndex:0,endIndex:-1,leftOffset:0,rightOffset:0};let a=Math.max(0,l-r),u=Math.min(e.length-1,i+r),m=0;for(let d=0;d<a;d++)m+=e[d];let c=0;for(let d=u+1;d<e.length;d++)c+=e[d];return {startIndex:a,endIndex:u,leftOffset:m,rightOffset:c}}function _e(t,e,n){let r=[],o=[],l=[];for(let a of t){let u=n?.[a.columnId];u==="left"?r.push(a):u==="right"?o.push(a):l.push(a);}if(!e||e.endIndex<0)return {pinnedLeft:r,virtualizedUnpinned:l,pinnedRight:o,leftSpacerWidth:0,rightSpacerWidth:0};let i=l.slice(e.startIndex,e.endIndex+1);return {pinnedLeft:r,virtualizedUnpinned:i,pinnedRight:o,leftSpacerWidth:e.leftOffset,rightSpacerWidth:e.rightOffset}}function ke(t,e,n,r,o=5){if(r<=0||e<=0||n<=0)return {startIndex:0,endIndex:0,offsetTop:0,offsetBottom:0};let l=Math.max(0,Math.floor(t/e)-o),i=Math.min(r-1,Math.ceil((t+n)/e)+o),a=l*e,u=Math.max(0,(r-i-1)*e);return {startIndex:l,endIndex:i,offsetTop:a,offsetBottom:u}}function Le(t,e){return t*e}function Ve(t,e,n,r="start"){let o=t*e;switch(r){case "start":return o;case "center":return Math.max(0,o-(n-e)/2);case "end":return Math.max(0,o-n+e)}}function Ue(){let t=self;t.onmessage=e=>{let n=e.data;if(n.type!=="sort-filter")return;let{requestId:r,values:o,filters:l,sort:i}=n,a=o.length,u=[],m=Object.entries(l);if(m.length===0){u=new Array(a);for(let d=0;d<a;d++)u[d]=d;}else for(let d=0;d<a;d++){let s=true;for(let f=0;f<m.length;f++){let g=Number(m[f][0]),p=m[f][1],I=o[d][g];switch(p.type){case "text":{let C=p.value.trim().toLowerCase();C&&!String(I??"").toLowerCase().includes(C)&&(s=false);break}case "multiSelect":{p.value.length>0&&(new Set(p.value).has(String(I??""))||(s=false));break}case "date":{if(I==null){s=false;break}let C=new Date(String(I)).getTime();if(isNaN(C)){s=false;break}if(p.value.from){let b=new Date(p.value.from+"T00:00:00").getTime();if(C<b){s=false;break}}if(p.value.to){let b=new Date(p.value.to+"T23:59:59.999").getTime();if(C>b){s=false;break}}break}}if(!s)break}s&&u.push(d);}if(i){let{columnIndex:d,direction:s}=i,f=s==="asc"?1:-1;u.sort((g,p)=>{let I=o[g][d],C=o[p][d];if(I==null&&C==null)return 0;if(I==null)return -1*f;if(C==null)return 1*f;if(typeof I=="number"&&typeof C=="number")return I===C?0:I>C?f:-f;let b=String(I).toLowerCase(),y=String(C).toLowerCase();return b===y?0:b>y?f:-f});}let c={type:"sort-filter-result",requestId:r,indices:u};t.postMessage(c);};}var S=null,Bt=0,E=new Map;function oe(){if(S)return S;if(typeof Worker>"u"||typeof Blob>"u"||typeof URL>"u")return null;try{let t=Ue.toString(),e=new Blob([`(${t})()`],{type:"application/javascript"}),n=URL.createObjectURL(e);return S=new Worker(n),URL.revokeObjectURL(n),S.onmessage=r=>{let{requestId:o,indices:l}=r.data,i=E.get(o);i&&(E.delete(o),i.resolve(l));},S.onerror=r=>{for(let[o,l]of E)l.reject(new Error(r.message||"Worker error")),E.delete(o);},S}catch{return null}}function He(){S&&(S.terminate(),S=null);for(let[t,e]of E)e.reject(new Error("Worker terminated")),E.delete(t);}function le(t,e){let n=new Array(t.length);for(let r=0;r<t.length;r++){let o=new Array(e.length);for(let l=0;l<e.length;l++){let i=x(t[r],e[l]);i==null?o[l]=null:typeof i=="string"||typeof i=="number"||typeof i=="boolean"?o[l]=i:o[l]=String(i);}n[r]=o;}return n}function Be(t,e,n,r,o){if(r&&e.find(f=>f.columnId===r)?.compare)return Promise.resolve(M(t,e,n,r,o));let l=oe();if(!l)return Promise.resolve(M(t,e,n,r,o));let i=new Map;for(let s=0;s<e.length;s++)i.set(e[s].columnId,s);let a=le(t,e),u=e.map((s,f)=>({type:s.type??"text",index:f})),m={};for(let s of e){let f=w(s),g=n[f];if(!g)continue;let p=i.get(s.columnId);if(p!==void 0)switch(g.type){case "text":m[p]={type:"text",value:g.value};break;case "multiSelect":m[p]={type:"multiSelect",value:g.value};break;case "date":m[p]={type:"date",value:{from:g.value.from,to:g.value.to}};break;case "people":return Promise.resolve(M(t,e,n,r,o))}}let c;if(r){let s=i.get(r);s!==void 0&&(c={columnIndex:s,direction:o??"asc"});}let d=++Bt;return new Promise((s,f)=>{E.set(d,{resolve:p=>{let I=new Array(p.length);for(let C=0;C<p.length;C++)I[C]=t[p[C]];s(I);},reject:f});let g={type:"sort-filter",requestId:d,values:a,columnMeta:u,filters:m,sort:c};l.postMessage(g);})}var We=5e3;function Ge(t,e,n){return !(!(t===true||t==="auto"&&e>5e3)||n?.filters&&Object.values(n.filters).some(o=>o?.type==="people")||n?.sortBy&&n.columns&&n.columns.find(l=>l.columnId===n.sortBy)?.compare)}var B="YYYY-MM-DD";function W(t,e,n="UTC"){if(t==null)return null;let r=t instanceof Date?t:new Date(String(t));if(Number.isNaN(r.getTime()))return null;let o,l,i;if(n==="UTC")o=r.getUTCFullYear(),l=r.getUTCMonth()+1,i=r.getUTCDate();else {let d=new Intl.DateTimeFormat("en-CA",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(r);o=parseInt(d.find(s=>s.type==="year")?.value??"0",10),l=parseInt(d.find(s=>s.type==="month")?.value??"0",10),i=parseInt(d.find(s=>s.type==="day")?.value??"0",10);}let a=String(o).padStart(4,"0"),u=String(l).padStart(2,"0"),m=String(i).padStart(2,"0");return e.replace("YYYY",a).replace("MM",u).replace("DD",m)}function $e(t,e){if(!t||!t.trim())return null;let r=t.trim().split(/[/\-.\s]+/).filter(Boolean);if(r.length===0)return null;let o=new Date().getUTCFullYear(),l=Wt(e),i,a,u;if(r.length===3){let[c,d,s]=r.map(Number);l==="YMD"?(i=c,a=d,u=s):l==="DMY"?(u=c,a=d,i=s):(a=c,u=d,i=s),i!==void 0&&i<100&&(i=i<50?2e3+i:1900+i);}else if(r.length===2){let[c,d]=r.map(Number);l==="DMY"?(u=c,a=d):(a=c,u=d),i=o;}else if(r.length===1){let c=r[0];if(/^\d+$/.test(c))if(c.length===8)i=parseInt(c.slice(0,4),10),a=parseInt(c.slice(4,6),10),u=parseInt(c.slice(6,8),10);else if(c.length===4)a=parseInt(c.slice(0,2),10),u=parseInt(c.slice(2,4),10),i=o;else return null;else return null}else return null;if(!Gt(i,a,u))return null;let m=new Date(Date.UTC(i,a-1,u));return m.getUTCFullYear()!==i||m.getUTCMonth()+1!==a||m.getUTCDate()!==u?null:m}function Xe(t){return t}function Wt(t){let e=t.indexOf("Y"),n=t.indexOf("M"),r=t.indexOf("D");return e===-1||n===-1||r===-1?"MDY":e<n&&n<r?"YMD":r<n&&n<e?"DMY":"MDY"}function Gt(t,e,n){return !(t==null||e==null||n==null||!Number.isFinite(t)||!Number.isFinite(e)||!Number.isFinite(n)||e<1||e>12||n<1||n>31)}var V=class{constructor(e,n){this.type=e;this.message=n;}toString(){return this.type}};function je(t,e){let n=v(t.filterable)?t.filterable:null,r=n?.type??"none",o=n?.filterField??t.columnId,l=t.sortable!==false,i=e.filters[o],a={columnKey:t.columnId,columnName:t.name,filterType:r,isSorted:e.sortBy===t.columnId,isSortedDescending:e.sortBy===t.columnId&&e.sortDirection==="desc",onSort:l?()=>e.onColumnSort(t.columnId):void 0};return r==="text"?{...a,textValue:i?.type==="text"?i.value:"",onTextChange:u=>e.onFilterChange(o,u.trim()?{type:"text",value:u}:void 0)}:r==="people"?{...a,selectedUser:i?.type==="people"?i.value:void 0,onUserChange:u=>e.onFilterChange(o,u?{type:"people",value:u}:void 0),peopleSearch:e.peopleSearch}:r==="multiSelect"?{...a,options:e.filterOptions[o]??[],isLoadingOptions:e.loadingFilterOptions[o]??false,selectedValues:i?.type==="multiSelect"?i.value:[],onFilterChange:u=>e.onFilterChange(o,u.length?{type:"multiSelect",value:u}:void 0)}:r==="date"?{...a,dateValue:i?.type==="date"?i.value:void 0,onDateChange:u=>e.onFilterChange(o,u?{type:"date",value:u}:void 0)}:a}function qe(t){return t!=null&&typeof t!="string"}var $=class ${constructor(){this.cache=new Map;this.lastVersion="";}static computeVersion(e){let n=e.editingCell,r=e.activeCell,o=e.selectionRange,l=e.cutRange,i=e.copyRange;return (n?`${String(n.rowId)}\0${n.columnId}`:"")+""+(r?`${r.rowIndex}\0${r.columnIndex}`:"")+""+(o?`${o.startRow}\0${o.startCol}\0${o.endRow}\0${o.endCol}`:"")+""+(l?`${l.startRow}\0${l.startCol}\0${l.endRow}\0${l.endCol}`:"")+""+(i?`${i.startRow}\0${i.startCol}\0${i.endRow}\0${i.endCol}`:"")+""+(e.isDragging?"1":"0")+""+(e.editable!==false?"1":"0")+""+(e.onCellValueChanged?"1":"0")+""+(e.formulaVersion??0)}get(e,n,r,o){let l=e*$.MAX_COL_STRIDE+n,i=this.cache.get(l);if(i!==void 0&&i.version===r)return i.descriptor;let a=o();return this.cache.set(l,{version:r,descriptor:a}),a}updateVersion(e){this.lastVersion=e;}get currentVersion(){return this.lastVersion}clear(){this.cache.clear();}};$.MAX_COL_STRIDE=1024;var G=$;function Ke(t,e,n,r,o,l){return l!==void 0?l.get(n,r,l.currentVersion,()=>ze(t,e,n,r,o)):ze(t,e,n,r,o)}function ze(t,e,n,r,o){let l=o.getRowId(t),i=r+o.colOffset,a=h(e,t),u=o.editable!==false&&a&&!!o.onCellValueChanged&&!qe(e.cellEditor),m=o.editable!==false&&a&&!!o.onCellValueChanged&&qe(e.cellEditor)&&e.cellEditorPopup!==false,c=u||m,d=o.editingCell?.rowId===l&&o.editingCell?.columnId===e.columnId,s=!o.isDragging&&o.activeCell?.rowIndex===n&&o.activeCell?.columnIndex===i,f=o.selectionRange!=null&&o.selectionRange.startRow===o.selectionRange.endRow&&o.selectionRange.startCol===o.selectionRange.endCol,g=o.selectionRange!=null&&!f&&F(o.selectionRange,n,r),p=o.cutRange!=null&&F(o.cutRange,n,r),I=o.copyRange!=null&&F(o.copyRange,n,r),C=!o.isDragging&&o.copyRange==null&&o.cutRange==null&&o.selectionRange!=null&&n===o.selectionRange.endRow&&r===o.selectionRange.endCol,b=e.pinned!=null,y=e.pinned??void 0,P=x(t,e),H=o.hasFormula?.(r,n)??false,N=H?o.getFormulaValue?.(r,n):void 0,O="display",_;d&&u?(O="editing-inline",e.cellEditor==="text"||e.cellEditor==="select"||e.cellEditor==="checkbox"||e.cellEditor==="richSelect"||e.cellEditor==="date"?_=e.cellEditor:e.type==="date"?_="date":e.type==="boolean"?_="checkbox":_="text"):d&&m&&(O="editing-popover");let Ut=d&&H?o.getFormula?.(r,n)??P:P;return {mode:O,editorType:_,value:Ut,isActive:s,isInRange:g,isInCutRange:p,isInCopyRange:I,isSelectionEndCell:C,canEditAny:c,isPinned:b,pinnedSide:y,globalColIndex:i,rowId:l,rowIndex:n,displayValue:N!==void 0?N:P,columnType:e.type}}function Ye(t,e,n){if(n instanceof V)return n.toString();let r=t;if(r.renderCell&&typeof r.renderCell=="function")return r.renderCell(e);if(t.valueFormatter)return t.valueFormatter(n,e);if(n==null)return null;if(t.type==="date"){let o=t.dateFormat??B,l=W(n,o);if(l!==null)return l}return t.type==="boolean"?n?"True":"False":String(n)}function Ze(t,e,n){let r=t,o=n instanceof V,l=r.cellStyle?typeof r.cellStyle=="function"?r.cellStyle(e):r.cellStyle:void 0;return o?{...l,color:"var(--ogrid-formula-error-color, #d32f2f)"}:l}function Qe(t,e,n,r){let o=n.editorType??"text";return {value:n.value,item:t,column:e,rowIndex:n.rowIndex,editorType:o,onCommit:l=>r.commitCellEdit(t,e.columnId,n.value,l,n.rowIndex,n.globalColIndex,o==="checkbox"?{skipAdvance:true}:void 0),onCancel:()=>r.setEditingCell(null)}}function Je(t,e,n,r,o){let l=n.value,i=r!==void 0?r:l,a=r;return {value:i,onValueChange:u=>{a=u,o.setPendingEditorValue(u);},onCommit:()=>{let u=a!==void 0?a:l;o.commitCellEdit(t,e.columnId,l,u,n.rowIndex,n.globalColIndex);},onCancel:o.cancelPopoverEdit,item:t,column:e,cellEditorParams:e.cellEditorParams}}function et(t,e){let n=null,r=((...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{t(...o),n=null;},e);});return r.cancel=()=>{n!==null&&(clearTimeout(n),n=null);},r}function tt(t,e,n){let r=e.startCol+n,o=e.endCol+n,l=t.querySelector(`[data-row-index="${e.startRow}"][data-col-index="${r}"]`),i=t.querySelector(`[data-row-index="${e.endRow}"][data-col-index="${o}"]`);if(!l||!i)return null;let a=t.getBoundingClientRect(),u=l.getBoundingClientRect(),m=i.getBoundingClientRect();return {top:u.top-a.top,left:u.left-a.left,width:m.right-u.left,height:m.bottom-u.top}}function nt(t){let e=new Map;if(!t)return e;let n=t.querySelectorAll("[data-row-index][data-col-index]");for(let r=0;r<n.length;r++){let o=n[r],l=o.getAttribute("data-row-index")??"",i=o.getAttribute("data-col-index")??"";e.set(`${l},${i}`,o);}return e}function rt(t,e){if(typeof document>"u"||document.getElementById(t))return;let n=document.createElement("style");n.id=t,n.textContent=e,document.head.appendChild(n);}function ot(t,e,n){return n===null?{field:"",direction:"asc"}:n?{field:e,direction:n}:{field:e,direction:t.field===e&&t.direction==="asc"?"desc":"asc"}}var lt=48,it=50,X=80,at=16,st=30,ut="__row_number__",dt=6;var ie=16,ae=520,$t=44,Xt=8;function ct(t){return Math.max(80,Math.ceil(t.length*Xt+$t))}function qt(t){let e=getComputedStyle(t),n=(parseFloat(e.paddingLeft)||0)+(parseFloat(e.paddingRight)||0),r=(parseFloat(e.borderLeftWidth)||0)+(parseFloat(e.borderRightWidth)||0),o=0;for(let d=0;d<t.children.length;d++){let s=t.children[d],f=s.className||"";if(f.includes("resizeHandle")||f.includes("resize-handle")||f.includes("ogrid-resize-handle")){o=s.offsetWidth;break}}let l=t.firstElementChild;if(!l)return t.offsetWidth;let i=[],a=d=>{for(let s=0;s<d.children.length;s++){let f=d.children[s],g=getComputedStyle(f);(g.overflow==="hidden"||g.flexShrink!=="0")&&(i.push({el:f,overflow:f.style.overflow,flexShrink:f.style.flexShrink,width:f.style.width,minWidth:f.style.minWidth,maxWidth:f.style.maxWidth}),f.style.overflow="visible",f.style.flexShrink="0",f.style.width="max-content",f.style.minWidth="max-content",f.style.maxWidth="none"),a(f);}},u=l.style.position,m=l.style.width;l.style.position="absolute",l.style.width="max-content",a(l);let c=l.offsetWidth;l.style.position=u,l.style.width=m;for(let d of i)d.el.style.overflow=d.overflow,d.el.style.flexShrink=d.flexShrink,d.el.style.width=d.width,d.el.style.minWidth=d.minWidth,d.el.style.maxWidth=d.maxWidth;return c+o+n+r}function mt(t,e,n){let r=e??80,l=(n??document).querySelectorAll(`[data-column-id="${t}"]`);if(l.length===0)return r;let i=r,a=[],u=[],m=[];if(l.forEach(c=>{let d=c;if(!!d.querySelector?.("[data-header-label]"))i=Math.max(i,qt(d));else {let f=d.firstElementChild??d;a.push(f);}}),a.length>0){for(let c=0;c<a.length;c++){let d=a[c];u.push(d.style.position),m.push(d.style.width),d.style.position="absolute",d.style.width="max-content";}for(let c=0;c<a.length;c++)i=Math.max(i,a[c].offsetWidth+ie);for(let c=0;c<a.length;c++)a[c].style.position=u[c],a[c].style.width=m[c];}return Math.min(ae,Math.max(r,Math.ceil(i)))}function A(t,e,n,r){if(t===e)return t;let o=t+n;if(!r(t)&&!r(o)){let i=o;for(;i!==e;){if(r(i+n))return i;i+=n;}return e}let l=o;for(;l!==e;){if(!r(l))return l;l+=n;}return e}function ft(t,e,n,r,o,l){let i=t,a=e;return l?e>o?a=e-1:t>0&&(i=t-1,a=r):e<r?a=e+1:t<n&&(i=t+1,a=o),{rowIndex:i,columnIndex:a}}function pt(t){let{direction:e,rowIndex:n,columnIndex:r,dataColIndex:o,colOffset:l,maxRowIndex:i,maxColIndex:a,visibleColCount:u,isCtrl:m,isShift:c,selectionRange:d,isEmptyAt:s}=t,f=n,g=r;e==="ArrowDown"?f=m?A(n,i,1,b=>s(b,Math.max(0,o))):Math.min(n+1,i):e==="ArrowUp"?f=m?A(n,0,-1,b=>s(b,Math.max(0,o))):Math.max(n-1,0):e==="ArrowRight"?m&&o>=0?g=A(o,u-1,1,b=>s(n,b))+l:g=Math.min(r+1,a):m&&o>=0?g=A(o,0,-1,b=>s(n,b))+l:g=Math.max(r-1,l);let p=g-l,I=e==="ArrowDown"||e==="ArrowUp",C;return c?I?C=R({startRow:d?.startRow??n,startCol:d?.startCol??o,endRow:f,endCol:d?.endCol??o}):C=R({startRow:d?.startRow??n,startCol:d?.startCol??o,endRow:d?.endRow??n,endCol:p}):C={startRow:f,startCol:p,endRow:f,endCol:p},{newRowIndex:f,newColumnIndex:g,newDataColIndex:p,newRange:C}}function gt(t,e,n){let r=R(t),o=[];for(let l=r.startRow;l<=r.endRow;l++)for(let i=r.startCol;i<=r.endCol;i++){if(l>=e.length||i>=n.length)continue;let a=e[l],u=n[i];if(!h(u,a))continue;let m=x(a,u),c=T("",m,a,u);c.valid&&o.push({item:a,columnId:u.columnId,oldValue:m,newValue:c.value,rowIndex:l});}return o}function Ct(t,e){return t===e?true:!t||!e?false:t.startRow===e.startRow&&t.endRow===e.endRow&&t.startCol===e.startCol&&t.endCol===e.endCol}function It(t,e,n){return e<0||n<0?null:{startRow:Math.max(0,Math.min(t.startRow,e)),endRow:Math.max(0,Math.min(t.endRow,e)),startCol:Math.max(0,Math.min(t.startCol,n)),endCol:Math.max(0,Math.min(t.endCol,n))}}function bt(t,e=40,n=2,r=20){let o=Math.min(t/e,1);return n+o*(r-n)}function xt(t,e,n,r,o,l){let i=new Set(l),a=Math.min(t,e),u=Math.max(t,e);for(let m=a;m<=u;m++)if(m<r.length){let c=o(r[m]);n?i.add(c):i.delete(c);}return i}function ht(t,e,n){if(t.size===0||e.length===0)return {allSelected:false,someSelected:false};let r=t.size>=e.length&&e.every(l=>t.has(n(l))),o=!r&&t.size>0;return {allSelected:r,someSelected:o}}function se(t,e){let n=e!=null&&e!==""?e:t;if(n==null||n==="")return "";try{return String(n).replace(/[\t\n]/g," ")}catch{return "[Object]"}}function Rt(t,e,n,r){let o=R(n),l=[];for(let i=o.startRow;i<=o.endRow;i++){let a=[];for(let u=o.startCol;u<=o.endCol&&!(i>=t.length||u>=e.length);u++){let m=t[i],c=e[u];if(r?.hasFormula&&r?.getFormula){let g=r.flatColumns.findIndex(p=>p.columnId===c.columnId);if(g>=0&&r.hasFormula(g,i)){let p=r.getFormula(g,i);if(p){a.push(p);continue}}}let d=x(m,c),f=(c.clipboardFormatter?c.clipboardFormatter(d,m):null)??(c.valueFormatter?c.valueFormatter(d,m):d);a.push(se(d,f));}l.push(a.join(" "));}return l.join(`\r
|
|
4
|
-
`)}function
|
|
1
|
+
function fe(t){if(t)return {id:t.id,displayName:t.displayName,email:"email"in t&&t.email?t.email:t.mail||t.userPrincipalName||"",photo:t.photo}}function F(t,e,n){let r=Math.min(t.startRow,t.endRow),o=Math.max(t.startRow,t.endRow),l=Math.min(t.startCol,t.endCol),i=Math.max(t.startCol,t.endCol);return e>=r&&e<=o&&n>=l&&n<=i}function R(t){return {startRow:Math.min(t.startRow,t.endRow),endRow:Math.max(t.startRow,t.endRow),startCol:Math.min(t.startCol,t.endCol),endCol:Math.max(t.startCol,t.endCol)}}function k(t){if(t==null)return "";let e=String(t);return e.includes(",")||e.includes('"')||e.includes(`
|
|
2
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}function j(t){return t.map(e=>k(e.name)).join(",")}function Y(t,e,n,r){return t.map((o,l)=>e.map(i=>{if(r?.exportMode==="formulas"&&r.hasFormula&&r.getFormula&&r.columnIdToIndex){let s=r.columnIdToIndex.get(i.columnId);if(s!==void 0&&r.hasFormula(s,l)){let a=r.getFormula(s,l);if(a)return k(a)}}return k(n(o,i.columnId))}).join(","))}function pe(t,e,n,r,o){let l=j(e),i=Y(t,e,n,o),s=[l,...i].join(`
|
|
3
|
+
`);Z(s,r??`export_${new Date().toISOString().slice(0,10)}.csv`);}function Z(t,e){let n=new Blob([t],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(n),o=document.createElement("a");try{o.setAttribute("href",r),o.setAttribute("download",e),o.style.visibility="hidden",document.body.appendChild(o),o.click();}finally{try{document.body.removeChild(o);}catch{}URL.revokeObjectURL(r);}}function x(t,e){return e.valueGetter?e.valueGetter(t):t[e.columnId]}function h(t,e){return t.editable===true||typeof t.editable=="function"&&t.editable(e)}function ge(t,e){return {getCellValue:(n,r)=>r<0||r>=t.length||n<0||n>=e.length?null:x(t[r],e[n]),getRowCount:()=>t.length,getColumnCount:()=>e.length}}function V(t){return "children"in t&&Array.isArray(t.children)}function Q(t){let e=[];for(let n of t)V(n)?e.push(...Q(n.children)):e.push(n);return e}function Ce(t,e){function n(m,c){let d=c;for(let u of m)V(u)&&(d=Math.max(d,n(u.children,c+1)));return d}let r=n(t,0);if(r===0){let m=[];for(let c of t)if(!V(c)){if(e&&!e.has(c.columnId))continue;m.push({label:c.name,colSpan:1,isGroup:false,columnDef:c,depth:0});}return [m]}let o=r+1,l=Array.from({length:o},()=>[]),i=new Map;function s(m){let c=i.get(m);if(c!==void 0)return c;let d=0;for(let u of m)V(u)?d+=s(u.children):(!e||e.has(u.columnId))&&d++;return i.set(m,d),d}function a(m,c){for(let d of m)if(V(d)){let u=s(d.children);if(u===0)continue;l[c].push({label:d.headerName,colSpan:u,isGroup:true,depth:c}),a(d.children,c+1);}else {if(e&&!e.has(d.columnId))continue;l[c].push({label:d.name,colSpan:1,isGroup:false,columnDef:d,depth:c});}}return a(t,0),l.filter(m=>m.length>0)}function v(t){return t!=null&&typeof t=="object"&&"type"in t}function w(t){return (v(t.filterable)?t.filterable:null)?.filterField??t.columnId}function Ie(t,e,n){if(n===void 0||n.type==="text"&&n.value.trim()===""||n.type==="multiSelect"&&n.value.length===0||n.type==="date"&&!n.value.from&&!n.value.to||n.type==="people"&&!n.value){let{[e]:o,...l}=t;return l}return {...t,[e]:n}}function be(t,e){let n=[];for(let l=0;l<e.length;l++){let i=e[l];(v(i.filterable)?i.filterable:null)?.type==="multiSelect"&&n.push({col:i,field:w(i)});}if(n.length===0)return {};let r=new Map;for(let l=0;l<n.length;l++)r.set(n[l].field,new Set);for(let l=0;l<t.length;l++){let i=t[l];for(let s=0;s<n.length;s++){let a=x(i,n[s].col),m=r.get(n[s].field);a!=null&&a!==""&&m&&m.add(String(a));}}let o={};for(let l=0;l<n.length;l++){let i=r.get(n[l].field);o[n[l].field]=i?Array.from(i).sort():[];}return o}function xe(t){let e=[];for(let n of t)(v(n.filterable)?n.filterable:null)?.type==="multiSelect"&&e.push(w(n));return e}function he(t){let{totalCount:e,filteredCount:n,selectedCount:r,selectedCellCount:o,aggregation:l,suppressRowCount:i}=t,s=[];return i||s.push({key:"total",label:"Rows:",value:e}),n!==void 0&&n!==e&&s.push({key:"filtered",label:"Filtered:",value:n}),r!==void 0&&r>0&&s.push({key:"selected",label:"Selected:",value:r}),o!==void 0&&o>1&&s.push({key:"cells",label:"Cells:",value:o}),l&&(s.push({key:"sum",label:"Sum:",value:l.sum}),s.push({key:"avg",label:"Avg:",value:Math.round(l.avg*100)/100}),s.push({key:"min",label:"Min:",value:l.min}),s.push({key:"max",label:"Max:",value:l.max}),s.push({key:"count",label:"Count:",value:l.count})),s}function Re(t,e,n,r){return t?typeof t=="object"?t:{totalCount:e,selectedCount:n>0?n:void 0,filteredCount:r!==void 0&&r!==e?r:void 0}:null}var J=[10,25,50,100];function Wt(t,e){return e.includes(t)?e:[...e,t].sort((n,r)=>n-r)}var ee=5;function ye(t,e,n,r){if(n<=0)return null;let o=r?.maxPageButtons??ee,l=Math.ceil(n/e),i,s,a;if(l<=o){i=[];for(let d=1;d<=l;d++)i.push(d);s=false,a=false;}else {let d=Math.max(1,t-2),u=Math.min(l,t+2);u-d+1<o&&(d===1?u=Math.min(l,d+o-1):u===l&&(d=Math.max(1,u-o+1))),i=[];for(let f=d;f<=u;f++)i.push(f);s=d>1,a=u<l;}let m=Math.max(1,(t-1)*e+1),c=Math.min(t*e,n);return {totalPages:l,pageNumbers:i,showStartEllipsis:s,showEndEllipsis:a,startItem:m,endItem:c,pageSizeOptions:Wt(e,r?.pageSizeOptions??J)}}var Te=[{id:"undo",label:"Undo",shortcut:"Ctrl+Z"},{id:"redo",label:"Redo",shortcut:"Ctrl+Y"},{id:"copy",label:"Copy",shortcut:"Ctrl+C",disabledWhenNoSelection:true,dividerBefore:true},{id:"cut",label:"Cut",shortcut:"Ctrl+X",disabledWhenNoSelection:true},{id:"paste",label:"Paste",shortcut:"Ctrl+V"},{id:"selectAll",label:"Select all",shortcut:"Ctrl+A",dividerBefore:true}];function Se(t){return typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?t.replace("Ctrl","\u2318"):t}function we(t){let{onCopy:e,onCut:n,onPaste:r,onSelectAll:o,onUndo:l,onRedo:i,onClose:s}=t;return {undo:()=>{l(),s();},redo:()=>{i(),s();},copy:()=>{e(),s();},cut:()=>{n(),s();},paste:()=>{r(),s();},selectAll:()=>{o(),s();}}}var De=[{id:"pinLeft",label:"Pin left"},{id:"pinRight",label:"Pin right"},{id:"unpin",label:"Unpin"}];function ve(t){let{canPinLeft:e,canPinRight:n,canUnpin:r,currentSort:o,isSortable:l=true,isResizable:i=true}=t,s=[];if(s.push({id:"pinLeft",label:"Pin left",disabled:!e},{id:"pinRight",label:"Pin right",disabled:!n},{id:"unpin",label:"Unpin",disabled:!r,divider:l||i}),l)if(!o)s.push({id:"sortAsc",label:"Sort ascending"},{id:"sortDesc",label:"Sort descending",divider:i});else {let a=o==="asc"?"desc":"asc",m=o==="asc"?"Sort descending":"Sort ascending";s.push({id:`sort${a==="asc"?"Asc":"Desc"}`,label:m},{id:"clearSort",label:"Clear sort",divider:i});}return i&&s.push({id:"autosizeThis",label:"Autosize this column"},{id:"autosizeAll",label:"Autosize all columns"}),s}function T(t,e,n,r){if(r.valueParser){let l={newValue:t,oldValue:e,data:n,column:r},i=r.valueParser(l);return i===void 0?{valid:false,value:void 0}:{valid:true,value:i}}if(r.cellEditor==="select"&&r.cellEditorParams?.values!=null&&Array.isArray(r.cellEditorParams.values)){let l=r.cellEditorParams.values,i=typeof t=="string"?t:String(t??"");if(i==="")return {valid:true,value:""};let s=l.find(a=>String(a).toLowerCase()===i.toLowerCase());return s!==void 0?{valid:true,value:s}:{valid:false,value:void 0}}let o=r.type;if(o==="date"){let l=ne({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}if(o==="boolean"){let l=re({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}if(o==="numeric"){let l=te({newValue:t});return l===void 0?{valid:false,value:void 0}:{valid:true,value:l}}return {valid:true,value:t}}function te(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).replace(/[\s,]/g,""),r=Number(n);return Number.isNaN(r)?void 0:r}function Ee(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).replace(/[$\u20AC\u00A3\u00A5]/g,"").replace(/[\s,]/g,""),r=Number(n);return Number.isNaN(r)?void 0:r}function ne(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim(),r=new Date(n);if(!Number.isNaN(r.getTime()))return r.toISOString().substring(0,10)}function Fe(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim();return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?n:void 0}function re(t){let{newValue:e}=t;if(e===""||e==null)return null;let n=String(e).trim().toLowerCase();if(["true","yes","1"].includes(n))return true;if(["false","no","0"].includes(n))return false}function Me(t,e,n){if(!n)return null;let r=R(n),o=0,l=0,i=1/0,s=-1/0,a=0;for(let m=r.startRow;m<=r.endRow;m++)for(let c=r.startCol;c<=r.endCol;c++){if(m>=t.length||c>=e.length)continue;o++;let d=t[m],u=e[c],f=x(d,u),g=typeof f=="number"?f:Number(f);!isNaN(g)&&isFinite(g)&&(l+=g,g<i&&(i=g),g>s&&(s=g),a++);}return o<2||a===0?null:{sum:l,avg:l/a,min:i,max:s,count:a}}var Ae=new WeakMap;function M(t,e,n,r,o){let l=Ae.get(e);if(!l){l=new Map;for(let m=0;m<e.length;m++)l.set(e[m].columnId,e[m]);Ae.set(e,l);}let i=[];for(let m=0;m<e.length;m++){let c=e[m],d=w(c),u=n[d];if(u)switch(u.type){case "multiSelect":if(u.value.length>0){let f=new Set(u.value),g=new Map;for(let p=0;p<t.length;p++)g.set(t[p],String(x(t[p],c)));i.push(p=>f.has(g.get(p)));}break;case "text":{let f=u.value.trim();if(f){let g=f.toLowerCase(),p=new Map;for(let I=0;I<t.length;I++)p.set(t[I],String(x(t[I],c)??"").toLowerCase());i.push(I=>(p.get(I)??"").includes(g));}break}case "people":{let f=u.value.email.toLowerCase(),g=new Map;for(let p=0;p<t.length;p++)g.set(t[p],String(x(t[p],c)??"").toLowerCase());i.push(p=>(g.get(p)??"")===f);break}case "date":{let f=u.value,g=f.from?new Date(f.from+"T00:00:00").getTime():NaN,p=f.to?new Date(f.to+"T23:59:59.999").getTime():NaN,I=new Map;for(let C=0;C<t.length;C++){let b=x(t[C],c);if(b==null)I.set(t[C],NaN);else {let y=new Date(String(b)).getTime();I.set(t[C],Number.isNaN(y)?NaN:y);}}i.push(C=>{let b=I.get(C)??NaN;return !(Number.isNaN(b)||!Number.isNaN(g)&&b<g||!Number.isNaN(p)&&b>p)});break}}}let s=i.length>0,a=s?t.filter(m=>{for(let c=0;c<i.length;c++)if(!i[c](m))return false;return true}):t;if(r){let m=s?a:a.slice(),c=l.get(r),d=c?.compare,u=o==="asc"?1:-1;if(c?.type==="date"&&!d){let g=new Map;for(let p=0;p<m.length;p++){let I=m[p],C=c?x(I,c):I[r];if(C==null)g.set(I,NaN);else {let b=new Date(String(C)).getTime();g.set(I,Number.isNaN(b)?0:b);}}m.sort((p,I)=>{let C=g.get(p)??NaN,b=g.get(I)??NaN;return Number.isNaN(C)&&Number.isNaN(b)?0:Number.isNaN(C)?-1*u:Number.isNaN(b)?1*u:C===b?0:C>b?u:-u});}else if(d)m.sort((g,p)=>d(g,p)*u);else {let g=new Map;for(let p=0;p<m.length;p++){let I=m[p],C=c?x(I,c):I[r];C==null?g.set(I,void 0):typeof C=="number"?g.set(I,C):g.set(I,String(C).toLowerCase());}m.sort((p,I)=>{let C=g.get(p),b=g.get(I);return C===void 0&&b===void 0?0:C===void 0?-1*u:b===void 0?1*u:C===b?0:C>b?u:-u});}return m}return a}function D(t,e){if(!t)return false;let n=Math.min(t.startRow,t.endRow),r=Math.max(t.startRow,t.endRow);return e>=n&&e<=r}function Ne(t,e){if(t.item!==e.item||t.isSelected!==e.isSelected||t.hasCheckboxCol!==e.hasCheckboxCol||t.visibleCols!==e.visibleCols||t.columnMeta!==e.columnMeta||t.cellClassMap!==e.cellClassMap||t.columnLayouts!==e.columnLayouts)return false;let n=t.rowIndex;if(t.editingRowId!==e.editingRowId&&(t.editingRowId===t.rowId||e.editingRowId===e.rowId))return false;let r=t.activeCell?.rowIndex===n,o=e.activeCell?.rowIndex===n;if(r!==o||r&&o&&t.activeCell?.columnIndex!==e.activeCell?.columnIndex)return false;let l=D(t.selectionRange,n),i=D(e.selectionRange,n);if(l!==i||l&&i&&(t.selectionRange?.startCol!==e.selectionRange?.startCol||t.selectionRange?.endCol!==e.selectionRange?.endCol))return false;let s=t.selectionRange?.endRow===n,a=e.selectionRange?.endRow===n;return !(s!==a||(s||a)&&t.isDragging!==e.isDragging||t.cutRange!==e.cutRange&&(D(t.cutRange,n)||D(e.cutRange,n))||t.copyRange!==e.copyRange&&(D(t.copyRange,n)||D(e.copyRange,n)))}function oe(t,e){return e?e.left?.includes(t)?"left":e.right?.includes(t)?"right":"unpinned":"unpinned"}function Pe(t,e,n){let r=t.filter(i=>i!==e),o=Math.max(0,Math.min(n,r.length)),l=[...r];return l.splice(o,0,e),l}function _e(t){let{mouseX:e,columnOrder:n,draggedColumnId:r,draggedPinState:o,tableElement:l,pinnedColumns:i}=t,s=l.querySelectorAll("[data-column-id]");if(s.length===0)return null;let a=[];if(s.forEach(u=>{let f=u.getAttribute("data-column-id");if(!f||oe(f,i)!==o)return;let p=u.getBoundingClientRect(),I=n.indexOf(f);I!==-1&&a.push({columnId:f,left:p.left,right:p.right,midX:p.left+p.width/2,orderIndex:I});}),a.length===0)return null;a.sort((u,f)=>u.left-f.left);let m,c;if(e<=a[0].midX)m=a[0].orderIndex,c=a[0].left;else if(e>=a[a.length-1].midX){let u=a[a.length-1];m=u.orderIndex+1,c=u.right;}else {let u=-1;for(let f=0;f<a.length-1;f++)if(e>=a[f].midX&&e<a[f+1].midX){u=f;break}if(u===-1)return null;m=a[u].orderIndex+1,c=a[u].right;}let d=n.indexOf(r);return d===m||d+1===m?{targetIndex:m,indicatorX:null}:{targetIndex:m,indicatorX:c}}function Oe(t,e,n,r=2){if(e.length===0||n<=0)return {startIndex:0,endIndex:-1,leftOffset:0,rightOffset:0};let o=0,l=e.length,i=-1;for(let d=0;d<e.length;d++){let u=o;o+=e[d],o>t&&l===e.length&&(l=d),u<t+n&&(i=d);}if(l>i)return {startIndex:0,endIndex:-1,leftOffset:0,rightOffset:0};let s=Math.max(0,l-r),a=Math.min(e.length-1,i+r),m=0;for(let d=0;d<s;d++)m+=e[d];let c=0;for(let d=a+1;d<e.length;d++)c+=e[d];return {startIndex:s,endIndex:a,leftOffset:m,rightOffset:c}}function Le(t,e,n){let r=[],o=[],l=[];for(let s of t){let a=n?.[s.columnId];a==="left"?r.push(s):a==="right"?o.push(s):l.push(s);}if(!e||e.endIndex<0)return {pinnedLeft:r,virtualizedUnpinned:l,pinnedRight:o,leftSpacerWidth:0,rightSpacerWidth:0};let i=l.slice(e.startIndex,e.endIndex+1);return {pinnedLeft:r,virtualizedUnpinned:i,pinnedRight:o,leftSpacerWidth:e.leftOffset,rightSpacerWidth:e.rightOffset}}function ke(t,e,n,r,o=5){if(r<=0||e<=0||n<=0)return {startIndex:0,endIndex:0,offsetTop:0,offsetBottom:0};let l=Math.max(0,Math.floor(t/e)-o),i=Math.min(r-1,Math.ceil((t+n)/e)+o),s=l*e,a=Math.max(0,(r-i-1)*e);return {startIndex:l,endIndex:i,offsetTop:s,offsetBottom:a}}function Ve(t,e){return t*e}function Ue(t,e,n,r="start"){let o=t*e;switch(r){case "start":return o;case "center":return Math.max(0,o-(n-e)/2);case "end":return Math.max(0,o-n+e)}}function He(){let t=self;t.onmessage=e=>{let n=e.data;if(n.type!=="sort-filter")return;let{requestId:r,values:o,filters:l,sort:i}=n,s=o.length,a=[],m=Object.entries(l);if(m.length===0){a=new Array(s);for(let d=0;d<s;d++)a[d]=d;}else {let d=m.map(([u,f])=>{let g=Number(u);return f.type==="text"?{colIdx:g,type:"text",trimmed:f.value.trim().toLowerCase()}:f.type==="multiSelect"?{colIdx:g,type:"multiSelect",set:new Set(f.value),empty:f.value.length===0}:{colIdx:g,type:"date",from:f.value.from,to:f.value.to}});for(let u=0;u<s;u++){let f=true;for(let g=0;g<d.length;g++){let p=d[g],I=o[u][p.colIdx];switch(p.type){case "text":{p.trimmed&&!String(I??"").toLowerCase().includes(p.trimmed)&&(f=false);break}case "multiSelect":{!p.empty&&!p.set.has(String(I??""))&&(f=false);break}case "date":{if(I==null){f=false;break}let C=new Date(String(I)).getTime();if(isNaN(C)){f=false;break}if(p.from){let b=new Date(p.from+"T00:00:00").getTime();if(C<b){f=false;break}}if(p.to){let b=new Date(p.to+"T23:59:59.999").getTime();if(C>b){f=false;break}}break}}if(!f)break}f&&a.push(u);}}if(i){let{columnIndex:d,direction:u}=i,f=u==="asc"?1:-1;a.sort((g,p)=>{let I=o[g][d],C=o[p][d];if(I==null&&C==null)return 0;if(I==null)return -1*f;if(C==null)return 1*f;if(typeof I=="number"&&typeof C=="number")return I===C?0:I>C?f:-f;let b=String(I).toLowerCase(),y=String(C).toLowerCase();return b===y?0:b>y?f:-f});}let c={type:"sort-filter-result",requestId:r,indices:a};t.postMessage(c);};}var S=null,Gt=0,E=new Map;function le(){if(S)return S;if(typeof Worker>"u"||typeof Blob>"u"||typeof URL>"u")return null;try{let t=He.toString(),e=new Blob([`(${t})()`],{type:"application/javascript"}),n=URL.createObjectURL(e);return S=new Worker(n),URL.revokeObjectURL(n),S.onmessage=r=>{let{requestId:o,indices:l}=r.data,i=E.get(o);i&&(E.delete(o),i.resolve(l));},S.onerror=r=>{for(let[o,l]of E)l.reject(new Error(r.message||"Worker error")),E.delete(o);},S}catch{return null}}function Be(){S&&(S.terminate(),S=null);for(let[t,e]of E)e.reject(new Error("Worker terminated")),E.delete(t);}function ie(t,e){let n=new Array(t.length);for(let r=0;r<t.length;r++){let o=new Array(e.length);for(let l=0;l<e.length;l++){let i=x(t[r],e[l]);i==null?o[l]=null:typeof i=="string"||typeof i=="number"||typeof i=="boolean"?o[l]=i:o[l]=String(i);}n[r]=o;}return n}function We(t,e,n,r,o){if(r&&e.find(f=>f.columnId===r)?.compare)return Promise.resolve(M(t,e,n,r,o));let l=le();if(!l)return Promise.resolve(M(t,e,n,r,o));let i=new Map;for(let u=0;u<e.length;u++)i.set(e[u].columnId,u);let s=ie(t,e),a=e.map((u,f)=>({type:u.type??"text",index:f})),m={};for(let u of e){let f=w(u),g=n[f];if(!g)continue;let p=i.get(u.columnId);if(p!==void 0)switch(g.type){case "text":m[p]={type:"text",value:g.value};break;case "multiSelect":m[p]={type:"multiSelect",value:g.value};break;case "date":m[p]={type:"date",value:{from:g.value.from,to:g.value.to}};break;case "people":return Promise.resolve(M(t,e,n,r,o))}}let c;if(r){let u=i.get(r);u!==void 0&&(c={columnIndex:u,direction:o??"asc"});}let d=++Gt;return new Promise((u,f)=>{E.set(d,{resolve:p=>{let I=new Array(p.length);for(let C=0;C<p.length;C++)I[C]=t[p[C]];u(I);},reject:f});let g={type:"sort-filter",requestId:d,values:s,columnMeta:a,filters:m,sort:c};l.postMessage(g);})}var Ge=5e3;function $e(t,e,n){return !(!(t===true||t==="auto"&&e>5e3)||n?.filters&&Object.values(n.filters).some(o=>o?.type==="people")||n?.sortBy&&n.columns&&n.columns.find(l=>l.columnId===n.sortBy)?.compare)}var W="YYYY-MM-DD";function G(t,e,n="UTC"){if(t==null)return null;let r=t instanceof Date?t:new Date(String(t));if(Number.isNaN(r.getTime()))return null;let o,l,i;if(n==="UTC")o=r.getUTCFullYear(),l=r.getUTCMonth()+1,i=r.getUTCDate();else {let d=new Intl.DateTimeFormat("en-CA",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(r);o=parseInt(d.find(u=>u.type==="year")?.value??"0",10),l=parseInt(d.find(u=>u.type==="month")?.value??"0",10),i=parseInt(d.find(u=>u.type==="day")?.value??"0",10);}let s=String(o).padStart(4,"0"),a=String(l).padStart(2,"0"),m=String(i).padStart(2,"0");return e.replace("YYYY",s).replace("MM",a).replace("DD",m)}function Xe(t,e){if(!t||!t.trim())return null;let r=t.trim().split(/[/\-.\s]+/).filter(Boolean);if(r.length===0)return null;let o=new Date().getUTCFullYear(),l=$t(e),i,s,a;if(r.length===3){let[c,d,u]=r.map(Number);l==="YMD"?(i=c,s=d,a=u):l==="DMY"?(a=c,s=d,i=u):(s=c,a=d,i=u),i!==void 0&&i<100&&(i=i<50?2e3+i:1900+i);}else if(r.length===2){let[c,d]=r.map(Number);l==="DMY"?(a=c,s=d):(s=c,a=d),i=o;}else if(r.length===1){let c=r[0];if(/^\d+$/.test(c))if(c.length===8)i=parseInt(c.slice(0,4),10),s=parseInt(c.slice(4,6),10),a=parseInt(c.slice(6,8),10);else if(c.length===4)s=parseInt(c.slice(0,2),10),a=parseInt(c.slice(2,4),10),i=o;else return null;else return null}else return null;if(!Xt(i,s,a))return null;let m=new Date(Date.UTC(i,s-1,a));return m.getUTCFullYear()!==i||m.getUTCMonth()+1!==s||m.getUTCDate()!==a?null:m}function qe(t){return t}function $t(t){let e=t.indexOf("Y"),n=t.indexOf("M"),r=t.indexOf("D");return e===-1||n===-1||r===-1?"MDY":e<n&&n<r?"YMD":r<n&&n<e?"DMY":"MDY"}function Xt(t,e,n){return !(t==null||e==null||n==null||!Number.isFinite(t)||!Number.isFinite(e)||!Number.isFinite(n)||e<1||e>12||n<1||n>31)}var U=class{constructor(e,n){this.type=e;this.message=n;}toString(){return this.type}};function je(t,e){let n=v(t.filterable)?t.filterable:null,r=n?.type??"none",o=n?.filterField??t.columnId,l=t.sortable!==false,i=e.filters[o],s={columnKey:t.columnId,columnName:t.name,filterType:r,isSorted:e.sortBy===t.columnId,isSortedDescending:e.sortBy===t.columnId&&e.sortDirection==="desc",onSort:l?()=>e.onColumnSort(t.columnId):void 0};return r==="text"?{...s,textValue:i?.type==="text"?i.value:"",onTextChange:a=>e.onFilterChange(o,a.trim()?{type:"text",value:a}:void 0)}:r==="people"?{...s,selectedUser:i?.type==="people"?i.value:void 0,onUserChange:a=>e.onFilterChange(o,a?{type:"people",value:a}:void 0),peopleSearch:e.peopleSearch}:r==="multiSelect"?{...s,options:e.filterOptions[o]??[],isLoadingOptions:e.loadingFilterOptions[o]??false,selectedValues:i?.type==="multiSelect"?i.value:[],onFilterChange:a=>e.onFilterChange(o,a.length?{type:"multiSelect",value:a}:void 0)}:r==="date"?{...s,dateValue:i?.type==="date"?i.value:void 0,onDateChange:a=>e.onFilterChange(o,a?{type:"date",value:a}:void 0)}:s}function ze(t){return t!=null&&typeof t!="string"}var A=class A{constructor(){this.cache=new Map;this.lastVersion="";}static computeVersion(e){let n=e.editingCell,r=e.activeCell,o=e.selectionRange,l=e.cutRange,i=e.copyRange;return (n?`${String(n.rowId)}\0${n.columnId}`:"")+""+(r?`${r.rowIndex}\0${r.columnIndex}`:"")+""+(o?`${o.startRow}\0${o.startCol}\0${o.endRow}\0${o.endCol}`:"")+""+(l?`${l.startRow}\0${l.startCol}\0${l.endRow}\0${l.endCol}`:"")+""+(i?`${i.startRow}\0${i.startCol}\0${i.endRow}\0${i.endCol}`:"")+""+(e.isDragging?"1":"0")+""+(e.editable!==false?"1":"0")+""+(e.onCellValueChanged?"1":"0")+""+(e.formulaVersion??0)}get(e,n,r,o){let l=e*A.MAX_COL_STRIDE+n,i=this.cache.get(l);if(i!==void 0&&i.version===r)return i.descriptor;let s=o();return this.cache.size>=A.MAX_ENTRIES&&this.cache.clear(),this.cache.set(l,{version:r,descriptor:s}),s}updateVersion(e){this.lastVersion=e;}get currentVersion(){return this.lastVersion}clear(){this.cache.clear();}};A.MAX_COL_STRIDE=1024,A.MAX_ENTRIES=1e5;var $=A;function Ye(t,e,n,r,o,l){return l!==void 0?l.get(n,r,l.currentVersion,()=>Ke(t,e,n,r,o)):Ke(t,e,n,r,o)}function Ke(t,e,n,r,o){let l=o.getRowId(t),i=r+o.colOffset,s=h(e,t),a=o.editable!==false&&s&&!!o.onCellValueChanged&&!ze(e.cellEditor),m=o.editable!==false&&s&&!!o.onCellValueChanged&&ze(e.cellEditor)&&e.cellEditorPopup!==false,c=a||m,d=o.editingCell?.rowId===l&&o.editingCell?.columnId===e.columnId,u=!o.isDragging&&o.activeCell?.rowIndex===n&&o.activeCell?.columnIndex===i,f=o.selectionRange!=null&&o.selectionRange.startRow===o.selectionRange.endRow&&o.selectionRange.startCol===o.selectionRange.endCol,g=o.selectionRange!=null&&!f&&F(o.selectionRange,n,r),p=o.cutRange!=null&&F(o.cutRange,n,r),I=o.copyRange!=null&&F(o.copyRange,n,r),C=!o.isDragging&&o.copyRange==null&&o.cutRange==null&&o.selectionRange!=null&&n===o.selectionRange.endRow&&r===o.selectionRange.endCol,b=e.pinned!=null,y=e.pinned??void 0,P=x(t,e),B=o.hasFormula?.(r,n)??false,_=B?o.getFormulaValue?.(r,n):void 0,O="display",L;d&&a?(O="editing-inline",e.cellEditor==="text"||e.cellEditor==="select"||e.cellEditor==="checkbox"||e.cellEditor==="richSelect"||e.cellEditor==="date"?L=e.cellEditor:e.type==="date"?L="date":e.type==="boolean"?L="checkbox":L="text"):d&&m&&(O="editing-popover");let Bt=d&&B?o.getFormula?.(r,n)??P:P;return {mode:O,editorType:L,value:Bt,isActive:u,isInRange:g,isInCutRange:p,isInCopyRange:I,isSelectionEndCell:C,canEditAny:c,isPinned:b,pinnedSide:y,globalColIndex:i,rowId:l,rowIndex:n,displayValue:_!==void 0?_:P,columnType:e.type}}function Ze(t,e,n){if(n instanceof U)return n.toString();let r=t;if(r.renderCell&&typeof r.renderCell=="function")return r.renderCell(e);if(t.valueFormatter)return t.valueFormatter(n,e);if(n==null)return null;if(t.type==="date"){let o=t.dateFormat??W,l=G(n,o);if(l!==null)return l}return t.type==="boolean"?n?"True":"False":String(n)}function Qe(t,e,n){let r=t,o=n instanceof U,l=r.cellStyle?typeof r.cellStyle=="function"?r.cellStyle(e):r.cellStyle:void 0;return o?{...l,color:"var(--ogrid-formula-error-color, #d32f2f)"}:l}function Je(t,e,n,r){let o=n.editorType??"text";return {value:n.value,item:t,column:e,rowIndex:n.rowIndex,editorType:o,onCommit:l=>r.commitCellEdit(t,e.columnId,n.value,l,n.rowIndex,n.globalColIndex,o==="checkbox"?{skipAdvance:true}:void 0),onCancel:()=>r.setEditingCell(null)}}function et(t,e,n,r,o){let l=n.value,i=r!==void 0?r:l,s=r;return {value:i,onValueChange:a=>{s=a,o.setPendingEditorValue(a);},onCommit:()=>{let a=s!==void 0?s:l;o.commitCellEdit(t,e.columnId,l,a,n.rowIndex,n.globalColIndex);},onCancel:o.cancelPopoverEdit,item:t,column:e,cellEditorParams:e.cellEditorParams}}function tt(t,e){let n=null,r=((...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{t(...o),n=null;},e);});return r.cancel=()=>{n!==null&&(clearTimeout(n),n=null);},r}function nt(t,e,n){let r=e.startCol+n,o=e.endCol+n,l=t.querySelector(`[data-row-index="${e.startRow}"][data-col-index="${r}"]`),i=t.querySelector(`[data-row-index="${e.endRow}"][data-col-index="${o}"]`);if(!l||!i)return null;let s=t.getBoundingClientRect(),a=l.getBoundingClientRect(),m=i.getBoundingClientRect();return {top:a.top-s.top,left:a.left-s.left,width:m.right-a.left,height:m.bottom-a.top}}var X=2048;function rt(t,e){return t*X+e}function ot(t){let e=new Map;if(!t)return e;let n=t.querySelectorAll("[data-row-index][data-col-index]");for(let r=0;r<n.length;r++){let o=n[r],l=parseInt(o.getAttribute("data-row-index")??"",10),i=parseInt(o.getAttribute("data-col-index")??"",10);l===l&&i===i&&e.set(l*X+i,o);}return e}function lt(t,e){if(typeof document>"u"||document.getElementById(t))return;let n=document.createElement("style");n.id=t,n.textContent=e,document.head.appendChild(n);}function it(t,e,n){return n===null?{field:"",direction:"asc"}:n?{field:e,direction:n}:{field:e,direction:t.field===e&&t.direction==="asc"?"desc":"asc"}}var st=48,at=50,q=80,ut=16,dt=30,ct="__row_number__",mt=6;var se=16,ae=520,qt=44,zt=8;function ft(t){return Math.max(80,Math.ceil(t.length*zt+qt))}function Kt(t){let e=getComputedStyle(t),n=(parseFloat(e.paddingLeft)||0)+(parseFloat(e.paddingRight)||0),r=(parseFloat(e.borderLeftWidth)||0)+(parseFloat(e.borderRightWidth)||0),o=0;for(let d=0;d<t.children.length;d++){let u=t.children[d],f=u.className||"";if(f.includes("resizeHandle")||f.includes("resize-handle")||f.includes("ogrid-resize-handle")){o=u.offsetWidth;break}}let l=t.firstElementChild;if(!l)return t.offsetWidth;let i=[],s=d=>{for(let u=0;u<d.children.length;u++){let f=d.children[u],g=getComputedStyle(f);(g.overflow==="hidden"||g.flexShrink!=="0")&&(i.push({el:f,overflow:f.style.overflow,flexShrink:f.style.flexShrink,width:f.style.width,minWidth:f.style.minWidth,maxWidth:f.style.maxWidth}),f.style.overflow="visible",f.style.flexShrink="0",f.style.width="max-content",f.style.minWidth="max-content",f.style.maxWidth="none"),s(f);}},a=l.style.position,m=l.style.width;l.style.position="absolute",l.style.width="max-content",s(l);let c=l.offsetWidth;l.style.position=a,l.style.width=m;for(let d of i)d.el.style.overflow=d.overflow,d.el.style.flexShrink=d.flexShrink,d.el.style.width=d.width,d.el.style.minWidth=d.minWidth,d.el.style.maxWidth=d.maxWidth;return c+o+n+r}function pt(t,e,n){let r=e??80,l=(n??document).querySelectorAll(`[data-column-id="${t}"]`);if(l.length===0)return r;let i=r,s=[],a=[],m=[];if(l.forEach(c=>{let d=c;if(!!d.querySelector?.("[data-header-label]"))i=Math.max(i,Kt(d));else {let f=d.firstElementChild??d;s.push(f);}}),s.length>0){for(let c=0;c<s.length;c++){let d=s[c];a.push(d.style.position),m.push(d.style.width),d.style.position="absolute",d.style.width="max-content";}for(let c=0;c<s.length;c++)i=Math.max(i,s[c].offsetWidth+se);for(let c=0;c<s.length;c++)s[c].style.position=a[c],s[c].style.width=m[c];}return Math.min(ae,Math.max(r,Math.ceil(i)))}function N(t,e,n,r){if(t===e)return t;let o=t+n;if(!r(t)&&!r(o)){let i=o;for(;i!==e;){if(r(i+n))return i;i+=n;}return e}let l=o;for(;l!==e;){if(!r(l))return l;l+=n;}return e}function gt(t,e,n,r,o,l){let i=t,s=e;return l?e>o?s=e-1:t>0&&(i=t-1,s=r):e<r?s=e+1:t<n&&(i=t+1,s=o),{rowIndex:i,columnIndex:s}}function Ct(t){let{direction:e,rowIndex:n,columnIndex:r,dataColIndex:o,colOffset:l,maxRowIndex:i,maxColIndex:s,visibleColCount:a,isCtrl:m,isShift:c,selectionRange:d,isEmptyAt:u}=t,f=n,g=r;e==="ArrowDown"?f=m?N(n,i,1,b=>u(b,Math.max(0,o))):Math.min(n+1,i):e==="ArrowUp"?f=m?N(n,0,-1,b=>u(b,Math.max(0,o))):Math.max(n-1,0):e==="ArrowRight"?m&&o>=0?g=N(o,a-1,1,b=>u(n,b))+l:g=Math.min(r+1,s):m&&o>=0?g=N(o,0,-1,b=>u(n,b))+l:g=Math.max(r-1,l);let p=g-l,I=e==="ArrowDown"||e==="ArrowUp",C;return c?I?C=R({startRow:d?.startRow??n,startCol:d?.startCol??o,endRow:f,endCol:d?.endCol??o}):C=R({startRow:d?.startRow??n,startCol:d?.startCol??o,endRow:d?.endRow??n,endCol:p}):C={startRow:f,startCol:p,endRow:f,endCol:p},{newRowIndex:f,newColumnIndex:g,newDataColIndex:p,newRange:C}}function It(t,e,n){let r=R(t),o=[];for(let l=r.startRow;l<=r.endRow;l++)for(let i=r.startCol;i<=r.endCol;i++){if(l>=e.length||i>=n.length)continue;let s=e[l],a=n[i];if(!h(a,s))continue;let m=x(s,a),c=T("",m,s,a);c.valid&&o.push({item:s,columnId:a.columnId,oldValue:m,newValue:c.value,rowIndex:l});}return o}function bt(t,e){return t===e?true:!t||!e?false:t.startRow===e.startRow&&t.endRow===e.endRow&&t.startCol===e.startCol&&t.endCol===e.endCol}function xt(t,e,n){return e<0||n<0?null:{startRow:Math.max(0,Math.min(t.startRow,e)),endRow:Math.max(0,Math.min(t.endRow,e)),startCol:Math.max(0,Math.min(t.startCol,n)),endCol:Math.max(0,Math.min(t.endCol,n))}}function ht(t,e=40,n=2,r=20){let o=Math.min(t/e,1);return n+o*(r-n)}function Rt(t,e,n,r,o,l){let i=new Set(l),s=Math.min(t,e),a=Math.max(t,e);for(let m=s;m<=a;m++)if(m<r.length){let c=o(r[m]);n?i.add(c):i.delete(c);}return i}function yt(t,e,n){if(t.size===0||e.length===0)return {allSelected:false,someSelected:false};let r=t.size>=e.length&&e.every(l=>t.has(n(l))),o=!r&&t.size>0;return {allSelected:r,someSelected:o}}function ue(t,e){let n=e!=null&&e!==""?e:t;if(n==null||n==="")return "";try{return String(n).replace(/[\t\n]/g," ")}catch{return "[Object]"}}function Tt(t,e,n,r){let o=R(n),l=[];for(let i=o.startRow;i<=o.endRow;i++){let s=[];for(let a=o.startCol;a<=o.endCol&&!(i>=t.length||a>=e.length);a++){let m=t[i],c=e[a];if(r?.hasFormula&&r?.getFormula){let g=r.flatColumns.findIndex(p=>p.columnId===c.columnId);if(g>=0&&r.hasFormula(g,i)){let p=r.getFormula(g,i);if(p){s.push(p);continue}}}let d=x(m,c),f=(c.clipboardFormatter?c.clipboardFormatter(d,m):null)??(c.valueFormatter?c.valueFormatter(d,m):d);s.push(ue(d,f));}l.push(s.join(" "));}return l.join(`\r
|
|
4
|
+
`)}function St(t){return t.trim()?t.split(/\r?\n/).filter(n=>n.length>0).map(n=>n.split(" ")):[]}function wt(t,e,n,r,o,l){let i=[];for(let s=0;s<t.length;s++){let a=t[s];for(let m=0;m<a.length;m++){let c=e+s,d=n+m;if(c>=r.length||d>=o.length)continue;let u=r[c],f=o[d];if(!h(f,u))continue;let g=a[m]??"";if(g.startsWith("=")&&l?.setFormula){let C=l.flatColumns.findIndex(b=>b.columnId===f.columnId);if(C>=0){l.setFormula(C,c,g);continue}}let p=x(u,f),I=T(g,p,u,f);I.valid&&i.push({item:u,columnId:f.columnId,oldValue:p,newValue:I.value,rowIndex:c});}}return i}function Dt(t,e,n){let r=[];for(let o=t.startRow;o<=t.endRow;o++)for(let l=t.startCol;l<=t.endCol;l++){if(o>=e.length||l>=n.length)continue;let i=e[o],s=n[l];if(!h(s,i))continue;let a=x(i,s),m=T("",a,i,s);m.valid&&r.push({item:i,columnId:s.columnId,oldValue:a,newValue:m.value,rowIndex:o});}return r}function H(t){let e="",n=t;for(;n>=0;)e=String.fromCharCode(n%26+65)+e,n=Math.floor(n/26)-1;return e}function z(t){let e=0,n=t.toUpperCase();for(let r=0;r<n.length;r++)e=e*26+(n.charCodeAt(r)-64);return e-1}function vt(t,e){return `${H(t)}${e}`}var Et=/(?:'[^']*'!|[A-Za-z_]\w*!)?(\$?)([A-Z]+)(\$?)(\d+)/g;function Ft(t,e,n){return Et.lastIndex=0,t.replace(Et,(r,o,l,i,s)=>{let a=r.indexOf(o+l),m=a>0?r.substring(0,a):"",c=l,d=s;if(o!=="$"){let u=z(l)+e;if(u<0)return "#REF!";c=H(u);}if(i!=="$"){let u=parseInt(s,10)+n;if(u<1)return "#REF!";d=String(u);}return `${m}${o}${c}${i}${d}`})}function de(t,e){if(t.columnId===e.columnId)return true;let n=t.type??"text",r=e.type??"text";return !(n!==r||t.cellEditor!==e.cellEditor)}function Mt(t,e,n,r,o,l){let i=[],s=r[t.startRow],a=o[t.startCol];if(!s||!a)return i;let m=x(s,a),c=l?l.flatColumns.findIndex(u=>u.columnId===a.columnId):-1,d=new Set;for(let u=t.startCol;u<=t.endCol;u++)u<o.length&&de(a,o[u])&&d.add(u);for(let u=t.startRow;u<=t.endRow;u++)for(let f=t.startCol;f<=t.endCol;f++){if(u===e&&f===n||u>=r.length||!d.has(f))continue;let g=r[u],p=o[f];if(!h(p,g))continue;if(l&&l.hasFormula&&l.getFormula&&l.setFormula&&c>=0&&l.hasFormula(c,e)){let b=l.getFormula(c,e);if(b){let y=u-e,P=f-n,B=Ft(b,P,y),_=l.flatColumns.findIndex(O=>O.columnId===p.columnId);if(_>=0){l.setFormula(_,u,B);continue}}}let I=x(g,p),C=T(m,I,g,p);C.valid&&i.push({item:g,columnId:p.columnId,oldValue:I,newValue:C.value,rowIndex:u});}return i}var K=class{constructor(e=100){this.history=[];this.redoStack=[];this.batch=null;this.maxDepth=e;}get canUndo(){return this.history.length>0}get canRedo(){return this.redoStack.length>0}get historyLength(){return this.history.length}get redoLength(){return this.redoStack.length}get isBatching(){return this.batch!==null}push(e){e.length!==0&&(this.batch!==null?this.batch.push(...e):(this.history.push(e),this.history.length>this.maxDepth&&this.history.splice(0,this.history.length-this.maxDepth),this.redoStack.length=0));}record(e){this.push([e]);}beginBatch(){this.batch===null&&(this.batch=[]);}endBatch(){let e=this.batch;this.batch=null,!(!e||e.length===0)&&(this.history.push(e),this.history.length>this.maxDepth&&this.history.splice(0,this.history.length-this.maxDepth),this.redoStack.length=0);}undo(){let e=this.history.pop();return e?(this.redoStack.push(e),e):null}redo(){let e=this.redoStack.pop();return e?(this.history.push(e),e):null}clear(){this.history=[],this.redoStack=[];}};function At(t){if(!Array.isArray(t)||t.length===0){console.warn("[OGrid] columns prop is empty or not an array");return}let e=typeof process<"u"&&process.env?.NODE_ENV!=="production",n=new Set;for(let r of t)r.columnId||console.warn("[OGrid] Column missing columnId:",r),n.has(r.columnId)&&console.warn(`[OGrid] Duplicate columnId: "${r.columnId}"`),n.add(r.columnId),e&&r.editable===true&&r.cellEditor==null&&console.warn(`[OGrid] Column "${r.columnId}" has editable=true but no cellEditor defined. Cells will not open an editor on double-click. Set cellEditor to 'text', 'select', 'checkbox', 'date', or a custom component.`);}function Nt(t){typeof process<"u"&&process.env?.NODE_ENV==="production"||t.enabled===true&&(!t.rowHeight||t.rowHeight<=0)&&console.warn("[OGrid] virtualScroll.enabled is true but rowHeight is missing or <= 0. Set a positive rowHeight (e.g. virtualScroll: { enabled: true, rowHeight: 36 }) for correct virtual scrolling behavior.");}function Pt(t,e){if(typeof process<"u"&&process.env.NODE_ENV==="production"||!e)return;let n=new Set,r=Math.min(t.length,100);for(let o=0;o<r;o++){let l=e(t[o]);if(l==null){console.warn(`[OGrid] getRowId returned null/undefined for row ${o}`);return}if(n.has(l)){console.warn(`[OGrid] Duplicate row ID "${l}" at index ${o}. getRowId must return unique values.`);return}n.add(l);}}var ce=[{minWidth:0,maxPriority:0},{minWidth:576,maxPriority:1},{minWidth:768,maxPriority:2},{minWidth:992,maxPriority:3},{minWidth:1200,maxPriority:1/0}];function me(t,e,n){let r=n?.breakpoints??ce,o=new Set;if(t<=0||e.length===0)return o;let l=1/0;for(let i=r.length-1;i>=0;i--)if(t>=r[i].minWidth){l=r[i].maxPriority;break}if(l===1/0)return o;for(let i of e)i.responsivePriority!=null&&(i.required||i.responsivePriority>l&&o.add(i.columnId));return o}function _t(t){return t===true?{}:t||void 0}function Ot(t,e,n){if(!n||e<=0)return t;let r=me(e,t,n);return r.size===0?t:t.filter(o=>!r.has(o.columnId))}function Lt(t,e,n,r,o){t.stopPropagation();let l=n-r;o.setActiveCell({rowIndex:e,columnIndex:n}),o.setSelectionRange({startRow:e,startCol:l,endRow:e,endCol:l});}var kt=300,Vt=300,Ut=300;var Ht={RESIZE_HANDLE:1,ACTIVE_CELL:2,FILL_HANDLE:3,SELECTION_OVERLAY:4,ROW_NUMBER:5,CLIPBOARD_OVERLAY:5,PINNED:6,SELECTION_CELL:7,THEAD:8,PINNED_HEADER:10,HEADER_FOCUS:11,SELECTION_HEADER_PINNED:12,LOADING:2,DROP_INDICATOR:100,DROPDOWN:1e3,FILTER_POPOVER:1e3,MODAL:2e3,FULLSCREEN:9999,CONTEXT_MENU:1e4};export{se as AUTOSIZE_EXTRA_PX,ae as AUTOSIZE_MAX_PX,X as CELL_INDEX_STRIDE,ut as CELL_PADDING,st as CHECKBOX_COLUMN_WIDTH,De as COLUMN_HEADER_MENU_ITEMS,$ as CellDescriptorCache,W as DEFAULT_DATE_FORMAT,kt as DEFAULT_DEBOUNCE_MS,q as DEFAULT_MIN_COLUMN_WIDTH,Ge as DEFAULT_WORKER_SORT_AUTO_THRESHOLD,mt as GRID_BORDER_RADIUS,Te as GRID_CONTEXT_MENU_ITEMS,ee as MAX_PAGE_BUTTONS,J as PAGE_SIZE_OPTIONS,Vt as PEOPLE_SEARCH_DEBOUNCE_MS,ce as RESPONSIVE_BREAKPOINTS,ct as ROW_NUMBER_COLUMN_ID,dt as ROW_NUMBER_COLUMN_MIN_WIDTH,at as ROW_NUMBER_COLUMN_WIDTH,Ut as SIDEBAR_TRANSITION_MS,K as UndoRedoStack,Ht as Z_INDEX,It as applyCellDeletion,Dt as applyCutClear,Mt as applyFillValues,wt as applyPastedValues,Rt as applyRangeRowSelection,Ot as applyResponsiveHiding,de as areFillCompatible,Ne as areGridRowPropsEqual,re as booleanParser,ot as buildCellIndex,j as buildCsvHeader,Y as buildCsvRows,Ce as buildHeaderRows,Je as buildInlineEditorProps,et as buildPopoverEditorProps,_e as calculateDropTarget,rt as cellIndexKey,xt as clampSelectionToBounds,z as columnLetterToIndex,Me as computeAggregations,Ct as computeArrowNavigation,ht as computeAutoScrollSpeed,it as computeNextSortState,yt as computeRowSelectionState,gt as computeTabNavigation,Ve as computeTotalHeight,Oe as computeVisibleColumnRange,ke as computeVisibleRange,ge as createGridDataAccessor,le as createSortFilterWorker,Ee as currencyParser,ne as dateParser,tt as debounce,be as deriveFilterOptionsFromData,Fe as emailParser,k as escapeCsvValue,ft as estimateHeaderMinWidth,pe as exportToCsv,ie as extractValueMatrix,N as findCtrlArrowTarget,Q as flattenColumns,vt as formatCellReference,ue as formatCellValueForTsv,G as formatDateForDisplay,Tt as formatSelectionAsTsv,Se as formatShortcut,Ye as getCellRenderDescriptor,x as getCellValue,ve as getColumnHeaderMenuItems,we as getContextMenuHandlers,Re as getDataGridStatusBarConfig,qe as getDateInputPlaceholder,w as getFilterField,je as getHeaderFilterConfig,xe as getMultiSelectFilterFields,ye as getPaginationViewModel,oe as getPinStateForColumn,me as getResponsiveHiddenColumns,Ue as getScrollTopForRow,he as getStatusBarParts,Lt as handleBooleanCellPointerDown,H as indexToColumnLetter,lt as injectGlobalStyles,h as isColumnEditable,v as isFilterConfig,F as isInSelectionRange,D as isRowInRange,pt as measureColumnContentWidth,nt as measureRange,Ie as mergeFilter,R as normalizeSelectionRange,te as numberParser,St as parseTsvClipboard,Xe as parseUserInputDate,T as parseValue,Le as partitionColumnsForVirtualization,M as processClientSideData,We as processClientSideDataAsync,bt as rangesEqual,Pe as reorderColumnArray,Ze as resolveCellDisplayContent,Qe as resolveCellStyle,_t as resolveResponsiveConfig,$e as shouldUseWorkerSort,Be as terminateSortFilterWorker,fe as toUserLike,Z as triggerCsvDownload,At as validateColumns,Pt as validateRowIds,Nt as validateVirtualScrollConfig};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type { SortFilterRequest, SortFilterResponse } from './utils';
|
|
|
31
31
|
export { getHeaderFilterConfig, getCellRenderDescriptor, CellDescriptorCache, resolveCellDisplayContent, resolveCellStyle, buildInlineEditorProps, buildPopoverEditorProps, } from './utils';
|
|
32
32
|
export type { HeaderFilterConfigInput, HeaderFilterConfig, CellRenderDescriptorInput, CellRenderDescriptor, CellRenderMode, } from './utils';
|
|
33
33
|
export { debounce } from './utils';
|
|
34
|
-
export { measureRange, buildCellIndex, injectGlobalStyles } from './utils';
|
|
34
|
+
export { measureRange, buildCellIndex, cellIndexKey, CELL_INDEX_STRIDE, injectGlobalStyles } from './utils';
|
|
35
35
|
export type { OverlayRect } from './utils';
|
|
36
36
|
export { computeNextSortState } from './utils';
|
|
37
37
|
export type { ISortState } from './utils';
|
|
@@ -131,6 +131,12 @@ export declare class CellDescriptorCache {
|
|
|
131
131
|
* Using a power-of-2 stride lets the JS engine optimize the multiplication.
|
|
132
132
|
*/
|
|
133
133
|
private static readonly MAX_COL_STRIDE;
|
|
134
|
+
/**
|
|
135
|
+
* Safety limit: if the cache grows past this many entries (e.g. after heavy
|
|
136
|
+
* data swaps without a clear()), wipe it to prevent unbounded memory growth.
|
|
137
|
+
* The cache rebuilds organically during the next render pass.
|
|
138
|
+
*/
|
|
139
|
+
private static readonly MAX_ENTRIES;
|
|
134
140
|
private readonly cache;
|
|
135
141
|
/** Last seen volatile version string. Used to detect when to skip per-cell version checks. */
|
|
136
142
|
private lastVersion;
|
|
@@ -36,8 +36,16 @@ export declare function measureRange(container: HTMLElement, range: ISelectionRa
|
|
|
36
36
|
* ```
|
|
37
37
|
*/
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* Stride for numeric cell index keys. Must exceed the maximum column count.
|
|
40
|
+
* Power-of-2 enables fast JS engine optimisation of the multiplication.
|
|
41
|
+
*/
|
|
42
|
+
export declare const CELL_INDEX_STRIDE = 2048;
|
|
43
|
+
/** Compute a numeric key for cell index lookups: `row * CELL_INDEX_STRIDE + col`. */
|
|
44
|
+
export declare function cellIndexKey(row: number, col: number): number;
|
|
45
|
+
/**
|
|
46
|
+
* Build a Map of numeric key → HTMLElement for O(1) cell lookups during drag operations.
|
|
47
|
+
* Numeric keys avoid per-lookup string allocation that template-literal keys incur.
|
|
40
48
|
* Scans the container once via querySelectorAll instead of per-frame DOM queries.
|
|
41
49
|
*/
|
|
42
|
-
export declare function buildCellIndex(container: HTMLElement | null): Map<
|
|
50
|
+
export declare function buildCellIndex(container: HTMLElement | null): Map<number, HTMLElement>;
|
|
43
51
|
export declare function injectGlobalStyles(id: string, css: string): void;
|
|
@@ -27,7 +27,7 @@ export type { SortFilterRequest, SortFilterResponse } from '../workers/sortFilte
|
|
|
27
27
|
export { getHeaderFilterConfig, getCellRenderDescriptor, CellDescriptorCache, resolveCellDisplayContent, resolveCellStyle, buildInlineEditorProps, buildPopoverEditorProps, } from './dataGridViewModel';
|
|
28
28
|
export type { HeaderFilterConfigInput, HeaderFilterConfig, CellRenderDescriptorInput, CellRenderDescriptor, CellRenderMode, } from './dataGridViewModel';
|
|
29
29
|
export { debounce } from './debounce';
|
|
30
|
-
export { measureRange, buildCellIndex, injectGlobalStyles } from './dom';
|
|
30
|
+
export { measureRange, buildCellIndex, cellIndexKey, CELL_INDEX_STRIDE, injectGlobalStyles } from './dom';
|
|
31
31
|
export type { OverlayRect } from './dom';
|
|
32
32
|
export { computeNextSortState } from './sortHelpers';
|
|
33
33
|
export type { ISortState } from './sortHelpers';
|
package/package.json
CHANGED