m,position:"bottom"},{condition:lp,position:"right"}].forEach((e=>{let{condition:t,position:i}=e;t&&s.push(i)})),Object.assign(n,{top:d<=o-i,bottom:d<=r-i,left:c<=l,right:c<=u-l}),{canShow:n,parentPositions:s}}const Qs=(e,t,i,n)=>{if(e){const s="auto"===i?function(e,t){const i="left";if(!t||!e)return i;const{canShow:n,parentPositions:s}=Xs(e,t),r=n.left&&n.right;return(r&&n.bottom?"center":r&&n.top?["top","center"]:Array.isArray(s)?["bottom"===s[0]?"top":"bottom",...s.slice(1)]:s)||i}(e,t):i,r={top:-t.offsetHeight,bottom:e.offsetHeight,left:0,center:e.offsetWidth/2-t.offsetWidth/2,right:e.offsetWidth-t.offsetWidth},o=Array.isArray(s)?s[0]:"bottom",a=Array.isArray(s)?s[1]:s;"bottom"===o?(t.classList.remove(n.calendarToInputTop),t.classList.add(n.calendarToInputBottom)):(t.classList.remove(n.calendarToInputBottom),t.classList.add(n.calendarToInputTop));const{top:l,left:d}=Ys(e),c=l+r[o];let h=d+r[a];const{vw:u}=Ks();if(h+t.clientWidth>u){const e=window.innerWidth-document.body.clientWidth;h=u-t.clientWidth-e}else h<0&&(h=0);Object.assign(t.style,{left:`${h}px`,top:`${c}px`})}},Zs=(e,t)=>{var i;e.popups&&(null==(i=Object.entries(e.popups))||i.forEach((i=>{let[n,s]=i;return((e,t,i,n)=>{const s=e.CSSClasses.dayPopup,r=n.querySelector(`[data-calendar-day="${t}"]`);if(r&&((null==i?void 0:i.modifier)&&r.classList.add(...i.modifier.trim().split(" ")),null==i?void 0:i.html)){const t=r.parentElement,n=document.createElement("div");n.className=s,n.innerHTML=e.sanitizer(i.html),t.appendChild(n),setTimeout((()=>{if(n){const{canShow:e}=Xs(t,n),i=5;let s=t.offsetHeight,r=0;e.bottom||(s=-n.offsetHeight-i),e.left&&!e.right&&(r=t.offsetWidth-n.offsetWidth/2),!e.left&&e.right&&(r=n.offsetWidth/2),Object.assign(n.style,{left:`${r}px`,top:`${s}px`})}}))}})(e,n,s,t)})))},Js=(e,t,i,n,s)=>{const r=t[i].querySelector(`.${e.CSSClasses.dayBtn}`),o=Gs(null==r?void 0:r.dataset.calendarDay,e.settings.iso8601);if(!o)return;const a=n.cloneNode(!0);a.innerText=String(o.week),a.dataset.calendarYearWeek=String(o.year),s.appendChild(a)},er=(e,t,i,n,s,r,o,a)=>{const l=document.createElement("div");l.className=e.CSSClasses.day;const d=document.createElement("button");d.className=`${e.CSSClasses.dayBtn}${a?` ${a}`:""}`,d.type="button",d.innerText=String(n),d.dataset.calendarDay=r,e.settings.visibility.weekNumbers&&(()=>{const t=Gs(r,e.settings.iso8601);t&&(d.dataset.calendarWeekNumber=String(t.week))})(),o?e.settings.visibility.daysOutside&&l.appendChild(d):l.appendChild(d),((e,t,i)=>{var n,s,r,o,a;const l=null==(n=e.settings.range.disableWeekday)?void 0:n.includes(i),d=e.settings.range.disableAllDays&&!!(null==(s=e.rangeEnabled)?void 0:s[0]);!l&&!d||(null==(r=e.rangeEnabled)?void 0:r.includes(t))||(null==(o=e.rangeDisabled)?void 0:o.includes(t))||(e.rangeDisabled.push(t),null==(a=e.rangeDisabled)||a.sort(((e,t)=>+new Date(e)-+new Date(t))))})(e,r,s),((e,t,i,n,s,r,o)=>{var a,l,d;if((Fs(e.rangeMin)>Fs(r)||Fs(e.rangeMax)1&&"multiple-ranged"===e.settings.selection.day&&(e.selectedDates[0]===r&&i.classList.add(e.CSSClasses.daySelectedFirst),e.selectedDates[e.selectedDates.length-1]===r&&i.classList.add(e.CSSClasses.daySelectedLast),e.selectedDates[0]!==r&&e.selectedDates[e.selectedDates.length-1]!==r&&i.classList.add(e.CSSClasses.daySelectedIntermediate))),e.settings.range.edgesOnly&&e.selectedDates.length>1&&"multiple-ranged"===e.settings.selection.day){const t=+new Date(e.selectedDates[0]),s=+new Date(e.selectedDates[e.selectedDates.length-1]),o=+new Date(r);o>t&&o{const t=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.days}`),i=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.weekNumbers}`),n=new Date(e.selectedYear,e.selectedMonth,1);t.forEach(((t,s)=>{const r=new Date(n);r.setMonth(r.getMonth()+s);const o=r.getMonth(),a=r.getFullYear(),l=new Date(a,o,1),d=new Date(a,o+1,0).getDate(),c=e.settings.iso8601?(0!==l.getDay()?l.getDay():7)-1:l.getDay();e.settings.selection.day&&t.classList.add(e.CSSClasses.daysSelecting),t.textContent="",((e,t,i,n,s)=>{let r=new Date(i,n,0).getDate()-(s-1);const o=0===n?i-1:i,a=0===n?12:n<10?`0${n}`:n;for(let l=s;l>0;l--,r++){const n=`${o}-${a}-${r}`,s=Fs(n).getDay();er(e,i,t,r,s,n,!0,e.CSSClasses.dayBtnPrev)}})(e,t,a,o,c),((e,t,i,n,s)=>{for(let r=1;r<=i;r++){const i=new Date(n,s,r),o=Ps(i),a=i.getDay();er(e,n,t,r,a,o,!1,null)}})(e,t,d,a,o),((e,t,i,n,s,r)=>{const o=r+i,a=7*Math.ceil(o/7)-o,l=s+1===12?n+1:n,d=s+1===12?"01":s+2<10?`0${s+2}`:s+2;for(let c=1;c<=a;c++){const i=`${l}-${d}-${c<10?`0${c}`:String(c)}`,s=Fs(i).getDay();er(e,n,t,c,s,i,!0,e.CSSClasses.dayBtnNext)}})(e,t,d,a,o,c),((e,t,i,n,s)=>{if(!e.settings.visibility.weekNumbers)return;n.textContent="";const r=document.createElement("b");r.className=e.CSSClasses.weekNumbersTitle,r.innerText="#",n.appendChild(r);const o=document.createElement("div");o.className=e.CSSClasses.weekNumbersContent,n.appendChild(o);const a=document.createElement("button");a.type="button",a.className=e.CSSClasses.weekNumber;const l=s.querySelectorAll(`.${e.CSSClasses.day}`),d=Math.ceil((t+i)/7);for(let c=0;c{var t,i;const n=null==(t=e.HTMLElement)?void 0:t.querySelectorAll("[data-calendar-selected-month]"),s=null==(i=e.HTMLElement)?void 0:i.querySelectorAll("[data-calendar-selected-year]");if(!(null==n?void 0:n[0])&&(null==s?void 0:s[0]))return;const r=new Date(e.selectedYear,e.selectedMonth,1);null==n||n.forEach(((t,i)=>((e,t,i,n)=>{const s=new Date(n.setMonth(e.selectedMonth+i)).getMonth(),r=!1===e.settings.selection.month||"only-arrows"===e.settings.selection.month;t.tabIndex=r?-1:0,t.classList.toggle(e.CSSClasses.monthDisabled,r),t.setAttribute("data-calendar-selected-month",String(s)),t.innerText=e.locale.months[s]})(e,t,i,r))),null==s||s.forEach(((t,i)=>((e,t,i,n)=>{const s=new Date(n.setFullYear(e.selectedYear,e.selectedMonth+i)).getFullYear(),r=!1===e.settings.selection.year||"only-arrows"===e.settings.selection.year;t.tabIndex=r?-1:0,t.classList.toggle(e.CSSClasses.yearDisabled,r),t.setAttribute("data-calendar-selected-year",String(s)),t.innerText=String(s)})(e,t,i,r)))},nr=(e,t)=>{const i=Fs(Ps(new Date(e.selectedYear,e.selectedMonth,1)));({prev:()=>i.setMonth(i.getMonth()-e.jumpMonths),next:()=>i.setMonth(i.getMonth()+e.jumpMonths)})[t](),[e.selectedMonth,e.selectedYear]=[i.getMonth(),i.getFullYear()],ir(e),js(e),tr(e)},sr=Object.freeze(Object.defineProperty({__proto__:null,ArrowNext:e=>``,ArrowPrev:e=>``,ControlTime:e=>e.settings.selection.time?``:"",Days:e=>``,Month:e=>``,Months:e=>``,Week:e=>``,WeekNumbers:e=>e.settings.visibility.weekNumbers?``:"",Year:e=>``,Years:e=>``},Symbol.toStringTag,{value:"Module"})),rr=(e,t)=>t.replace(/[\n\t]/g,"").replace(/<#(?!\/?Multiple)(.*?)>/g,((t,i)=>{const n=(s=i.replace(/[/\s\n\t]/g,""),sr[s]);var s;const r=n?n(e):"";return e.sanitizer(r)})).replace(/[\n\t]/g,""),or=(e,t)=>{const{HTMLElement:i,CSSClasses:n,DOMTemplates:s,type:r,currentType:o,correctMonths:a}=e,l=(s,r)=>{if(!t)return;const o=i.querySelector(`.${n.controls}`);o&&i.removeChild(o),i.querySelector(`.${n.grid}`).classList.add(n.gridDisabled);const a=t.closest(`.${n.column}`);a.classList.add(s),a.innerHTML=rr(e,r)},d={default:()=>{i.classList.add(n.calendarDefault),i.classList.remove(n.calendarMonth,n.calendarYear),i.innerHTML=rr(e,s.default)},multiple:()=>{a&&(i.classList.add(n.calendarMultiple),i.classList.remove(n.calendarMonth,n.calendarYear),i.innerHTML=((e,t)=>t.replace(/<#Multiple>(.*?)<#\/Multiple>/g,((t,i)=>{let n="";for(let s=0;s{"multiple"!==r?(i.classList.add(n.calendarMonth),i.classList.remove(n.calendarDefault,n.calendarYear),i.innerHTML=rr(e,s.month)):l(n.columnMonth,s.month)},year:()=>{"multiple"!==r?(i.classList.add(n.calendarYear),i.classList.remove(n.calendarDefault,n.calendarMonth),i.innerHTML=rr(e,s.year)):l(n.columnYear,s.year)}};i.classList.add(n.calendar),d[o]()},ar=(e,t,i,n,s)=>{const r=t.cloneNode(!1);return r.className=`${e.CSSClasses.yearsYear}${i===s?` ${e.CSSClasses.yearsYearSelected}`:n?` ${e.CSSClasses.yearsYearDisabled}`:""}`,r.dataset.calendarYear=String(s),r.title=String(s),r.innerText=String(s),n&&(r.tabIndex=-1),r},lr=(e,t)=>{const i=(null==t?void 0:t.dataset.calendarSelectedYear)?Number(null==t?void 0:t.dataset.calendarSelectedYear):e.selectedYear;e.currentType="year",or(e,t),ir(e),js(e);const n=e.HTMLElement.querySelector(`.${e.CSSClasses.years}`);if(!e.settings.selection.year||!n)return;n.classList.add(e.CSSClasses.yearsSelecting);const s="multiple"!==e.type||e.selectedYear===i?0:1,r=document.createElement("button");r.type="button";for(let o=e.viewYear-7;oe.dateMax.getFullYear(),a=ar(e,r,i,t,o);n.appendChild(a),e.actions.getYears&&e.actions.getYears(o,a,e)}},dr=e=>`${e.charAt(0).toUpperCase()}${e.substring(1,e.length)}`.replace(/\./,""),cr=(e,t)=>{const i=new Date(`1978-01-0${t+1}T00:00:00.000Z`).toLocaleString(e.settings.lang,{weekday:"short",timeZone:"UTC"});e.locale.weekday.push(dr(i))},hr=(e,t)=>{const i=new Date(`1978-${t+1<=9?`0${t+1}`:t+1}-01T00:00:00.000Z`).toLocaleString(e.settings.lang,{month:"long",timeZone:"UTC"});e.locale.months.push(dr(i))},ur=e=>{if("multiple"!==e.type)return 0;const t=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`),i=Array.from(t).findIndex((t=>t.classList.contains(`${e.CSSClasses.columnMonth}`)));return i>0?i:0},pr=(e,t,i,n,s,r)=>{const o=t.cloneNode(!1);return o.className=`${e.CSSClasses.monthsMonth}${i===r?` ${e.CSSClasses.monthsMonthSelected}`:s?` ${e.CSSClasses.monthsMonthDisabled}`:""}`,o.title=n,o.innerText=`${e.settings.visibility.monthShort?n.substring(0,3):n}`,o.dataset.calendarMonth=String(r),s&&(o.tabIndex=-1),o},mr=(e,t)=>{var i,n;const s=(null==t?void 0:t.dataset.calendarSelectedMonth)?Number(t.dataset.calendarSelectedMonth):e.selectedMonth,r=null==(i=null==t?void 0:t.closest(`.${e.CSSClasses.column}`))?void 0:i.querySelector(`.${e.CSSClasses.year}`),o=r?Number(r.dataset.calendarSelectedYear):e.selectedYear;e.currentType="month",or(e,t),ir(e);const a=null==(n=e.HTMLElement)?void 0:n.querySelector(`.${e.CSSClasses.months}`);if(!e.settings.selection.month||!a)return;a.classList.add(e.CSSClasses.monthsSelecting);const l=e.jumpMonths>1?e.locale.months.map(((t,i)=>s-e.jumpMonths*i)).concat(e.locale.months.map(((t,i)=>s+e.jumpMonths*i))).filter((e=>e>=0&&e<=12)):Array.from(Array(12).keys()),d=document.createElement("button");d.type="button";for(let c=0;c<12;c++){const t=e.locale.months[c],i=ce.dateMax.getMonth()+ur(e)&&o>=e.dateMax.getFullYear()||c!==s&&!l.includes(c),n=pr(e,d,s,t,i,c);a.appendChild(n),e.actions.getMonths&&e.actions.getMonths(c,n,e)}},gr=(e,t)=>e&&t?{0:{AM:"00",PM:"12"},1:{AM:"01",PM:"13"},2:{AM:"02",PM:"14"},3:{AM:"03",PM:"15"},4:{AM:"04",PM:"16"},5:{AM:"05",PM:"17"},6:{AM:"06",PM:"18"},7:{AM:"07",PM:"19"},8:{AM:"08",PM:"20"},9:{AM:"09",PM:"21"},10:{AM:"10",PM:"22"},11:{AM:"11",PM:"23"},12:{AM:"12",PM:"12"}}[Number(e)][t]:"",fr=(e,t,i)=>e.querySelector(`.${t}${i?` input[name="${i}"]`:""}`),vr=(e,t,i)=>{e.addEventListener("mouseover",(()=>t.classList.add(i))),e.addEventListener("mouseout",(()=>t.classList.remove(i)))},br=(e,t,i,n)=>{({hours:()=>{e.selectedHours=i},minutes:()=>{e.selectedMinutes=i}})[n](),e.selectedTime=`${e.selectedHours}:${e.selectedMinutes}${e.selectedKeeping?` ${e.selectedKeeping}`:""}`,e.actions.changeTime&&e.actions.changeTime(t,e),e.input&&e.HTMLInputElement&&e.actions.changeToInput&&e.actions.changeToInput(t,e)},yr=(e,t,i,n,s,r)=>{t.addEventListener("input",(t=>{const o=t.target,a=Number(o.value),l=a<10?`0${a}`:`${a}`;if("hours"!==s||12!==r)return i.value=l,void br(e,t,l,s);a0?(i.value=l,e.selectedKeeping="AM",n.innerText=e.selectedKeeping,br(e,t,l,s)):(0===a?(e.selectedKeeping="AM",n.innerText="AM"):(e.selectedKeeping="PM",n.innerText="PM"),i.value=Ns(o.value),br(e,t,Ns(o.value),s))}))},_r=(e,t,i,n,s,r)=>{i.addEventListener("change",(i=>{const o=i.target,a=Number(o.value),l=a<10?`0${a}`:`${a}`;"hours"===s&&12===r?o.value&&a<=r&&a>0?(o.value=l,t.value=gr(l,e.selectedKeeping),br(e,i,l,s)):o.value&&a<24&&(a>r||0===a)?(0===a?(e.selectedKeeping="AM",n.innerText="AM"):(e.selectedKeeping="PM",n.innerText="PM"),o.value=Ns(o.value),t.value=l,br(e,i,Ns(o.value),s)):o.value=e.selectedHours:o.value&&a<=r&&a>=0?(o.value=l,t.value=l,br(e,i,l,s)):"hours"===s?o.value=e.selectedHours:"minutes"===s&&(o.value=e.selectedMinutes)}))},Sr=(e,t,i)=>{const n=24===i?23:i||12,s=fr(t,e.CSSClasses.timeRange,"hours"),r=fr(t,e.CSSClasses.timeRange,"minutes"),o=fr(t,e.CSSClasses.timeHours,"hours"),a=fr(t,e.CSSClasses.timeMinutes,"minutes"),l=t.querySelector(`.${e.CSSClasses.timeKeeping}`);vr(s,o,e.CSSClasses.isFocus),vr(r,a,e.CSSClasses.isFocus),yr(e,s,o,l,"hours",n),yr(e,r,a,l,"minutes",0),_r(e,s,o,l,"hours",n),_r(e,r,a,l,"minutes",59),l&&((e,t,i)=>{t.addEventListener("click",(n=>{e.selectedKeeping=t.innerText.includes("AM")?"PM":"AM",t.innerText=e.selectedKeeping,i.value=gr(e.selectedHours,e.selectedKeeping),br(e,n,e.selectedHours,"hours")}))})(e,l,s)},wr=(e,t,i,n)=>``,Cr=(e,t,i,n,s,r)=>``,Er=e=>{const t=[...e.locale.weekday];t[0]&&(e.settings.iso8601&&t.push(t.shift()),e.HTMLElement.querySelectorAll(`.${e.CSSClasses.week}`).forEach((i=>((e,t,i)=>{const n=document.createElement("b");t.textContent="";for(let s=0;s{xr.value=!0},check:()=>xr.value},Tr=(e,t)=>Or.find((i=>{var n;return"system"!==i&&(null==(n=e.getAttribute(t))?void 0:n.includes(i))})),kr=(e,t)=>{e.dataset.calendarTheme=t},Ir=(e,t)=>{var i;if(i=t,kr(e.HTMLElement,i.matches?"dark":"light"),"system"!==e.settings.visibility.theme||xr.check())return;const n=t=>{const i=document.querySelectorAll(`.${e.CSSClasses.calendar}`);null==i||i.forEach((e=>kr(e,t.matches?"dark":"light")))};t.addEventListener?t.addEventListener("change",n):t.addListener(n),xr.set()},Rr=(e,t)=>{const i=e.settings.visibility.themeDetect?document.querySelector(e.settings.visibility.themeDetect):null;if(!i)return void Ir(e,t);const n=e.settings.visibility.themeDetect.replace(/^.*\[(.+)\]/g,((e,t)=>t)),s=Tr(i,n);s?(kr(e.HTMLElement,s),((e,t,i)=>{new MutationObserver((n=>{for(let s=0;s{const t={default:()=>{Er(e),tr(e)},multiple:()=>{Er(e),tr(e)},month:()=>mr(e),year:()=>lr(e)};(e=>{if(!Or.includes(e.settings.visibility.theme))throw new Error($s);"not all"!==window.matchMedia("(prefers-color-scheme)").media?{light:()=>kr(e.HTMLElement,"light"),dark:()=>kr(e.HTMLElement,"dark"),system:()=>Rr(e,window.matchMedia("(prefers-color-scheme: dark)"))}[e.settings.visibility.theme]():kr(e.HTMLElement,"light")})(e),(e=>{if("define"!==e.settings.lang||!e.locale.weekday[6]||!e.locale.months[11]){if("define"===e.settings.lang)throw new Error(zs);e.locale.weekday=[],e.locale.months=[];for(let t=0;t<7;t++)cr(e,t);for(let t=0;t<12;t++)hr(e,t)}})(e),or(e),ir(e),js(e),(e=>{const t=e.HTMLElement.querySelector(`.${e.CSSClasses.time}`);if(!t)return;const i=!0===e.settings.selection.time?12:e.settings.selection.time,n="range"===e.settings.selection.controlTime,[s,r]=[0,23],[o,a]=[0,59];t.innerHTML=e.sanitizer(`${wr("hours",e.CSSClasses.timeHours,e.selectedHours,n)}${wr("minutes",e.CSSClasses.timeMinutes,e.selectedMinutes,n)}${12===i?``:""}
${Cr("hours",e.CSSClasses.timeRange,s,r,e.settings.selection.stepHours,e.selectedKeeping?gr(e.selectedHours,e.selectedKeeping):e.selectedHours)}${Cr("minutes",e.CSSClasses.timeRange,o,a,e.settings.selection.stepMinutes,e.selectedMinutes)}
`),Sr(e,t,i)})(e),t[e.currentType]()},Dr={self:null,rangeMin:void 0,rangeMax:void 0},Pr=()=>{var e;if(!(null==(e=Dr.self)?void 0:e.HTMLElement))return;const{CSSClasses:t}=Dr.self;Dr.self.HTMLElement.querySelectorAll(`.${Dr.self.CSSClasses.dayBtnHover}`).forEach((e=>{var i;e.classList.remove(Dr.self.CSSClasses.dayBtnHover),null==(i=e.parentElement)||i.classList.remove(t.dayHoverIntermediate,t.dayHoverFirst,t.dayHoverLast)}))},Fr=(e,t,i)=>{var n,s,r;if(!(null==(n=Dr.self)?void 0:n.selectedDates))return;const o=Ps(e),{CSSClasses:a}=Dr.self;if(null==(s=Dr.self.rangeDisabled)?void 0:s.includes(o))return;const l=null==(r=Dr.self.HTMLElement)?void 0:r.querySelectorAll(`[data-calendar-day="${o}"]`);null==l||l.forEach((e=>{var t;e.classList.add(a.dayBtnHover),null==(t=e.parentElement)||t.classList.add(a.dayHoverIntermediate)})),null==t||t.forEach((e=>{var t;return null==(t=e.parentElement)?void 0:t.classList.add(a.dayHoverFirst)})),null==i||i.forEach((e=>{var t;return null==(t=e.parentElement)?void 0:t.classList.add(a.dayHoverLast)}))},Mr=e=>{var t;if(!e.target||!(null==(t=Dr.self)?void 0:t.selectedDates))return;if(!e.target.closest(`.${Dr.self.CSSClasses.days}`))return void Pr();const i=e.target.closest("[data-calendar-day]");if(!i)return;const n=i.dataset.calendarDay,s=Fs(Dr.self.selectedDates[0]),r=Fs(n),o=Dr.self.HTMLElement.querySelectorAll(`[data-calendar-day="${Dr.self.selectedDates[0]}"]`),a=Dr.self.HTMLElement.querySelectorAll(`[data-calendar-day="${n}"]`),[l,d]=s{Dr.self&&"Escape"===e.key&&(Dr.self.selectedDates=[],Dr.self.HTMLElement.removeEventListener("mousemove",Mr),document.removeEventListener("keydown",Lr),Ar(Dr.self))},Nr=(e,t)=>{var i;if(t){const n=1===e.selectedDates.length&&e.selectedDates[0].includes(t);e.selectedDates=n&&!e.settings.selection.cancelableDay?[t,t]:n&&e.settings.selection.cancelableDay?[]:e.selectedDates.length>1?[t]:[...e.selectedDates,t],null==(i=e.selectedDates)||i.sort(((e,t)=>+new Date(e)-+new Date(t)))}e.settings.range.disableGaps&&(Dr.rangeMin=Dr.rangeMin?Dr.rangeMin:e.rangeMin,Dr.rangeMax=Dr.rangeMax?Dr.rangeMax:e.rangeMax),Dr.self=e,{set:()=>{e.HTMLElement.addEventListener("mousemove",Mr),document.addEventListener("keydown",Lr),e.settings.range.disableGaps&&(()=>{var e,t,i;if(!(null==(t=null==(e=Dr.self)?void 0:e.selectedDates)?void 0:t[0])||!(null==(i=Dr.self.rangeDisabled)?void 0:i[0]))return;const n=Fs(Dr.self.selectedDates[0]),[s,r]=Dr.self.rangeDisabled.map((e=>Fs(e))).reduce(((e,t)=>{let[i,s]=e;return[n>=t?t:i,n{const[t,i]=[e.selectedDates[0],e.selectedDates[e.selectedDates.length-1]];e.selectedDates=e.selectedDates[0]!==e.selectedDates[e.selectedDates.length-1]?e.settings.range.edgesOnly?[t,i]:Ms([`${t}:${i}`]):[e.selectedDates[0],e.selectedDates[0]],e.HTMLElement.removeEventListener("mousemove",Mr),document.removeEventListener("keydown",Lr),e.settings.range.disableGaps&&Dr.self&&(Dr.self.rangeMin=Dr.rangeMin,Dr.self.rangeMax=Dr.rangeMax)}}[1===e.selectedDates.length?"set":"reset"]()},Br=(e,t,i)=>{if(!t.dataset.calendarDay)return;const n=t.dataset.calendarDay,s=t.classList.contains(e.CSSClasses.dayBtnSelected);if(s&&!e.settings.selection.cancelableDay)return;let r=!0;void 0!==e.toggleSelected&&(r="function"==typeof e.toggleSelected?e.toggleSelected(e):e.toggleSelected),s&&!r||(e.selectedDates=s?e.selectedDates.filter((e=>e!==n)):i?[...e.selectedDates,n]:[n])},Hr=(e,t,i,n,s)=>{const r=e.HTMLElement.querySelectorAll(`.${e.CSSClasses.column}`),o=Array.from(r).findIndex((e=>e.classList.contains(t))),a=Number(r[o].querySelector(`.${i}`).getAttribute(s));return"month"===e.currentType&&o>=0?n-o:"year"===e.currentType&&e.selectedYear!==a?n-1:n},zr=(e,t,i,n)=>{if(!e.settings.selection[i])return;const s=t.target,r=e=>s.closest(`.${e}`),o=r(n.header),a=r(n.item),l=r(e.CSSClasses.grid),d=r(e.CSSClasses.column);e.currentType!==i&&o?{year:()=>lr(e,s),month:()=>mr(e,s)}[i]():a?((e,t,i,n,s)=>{const r={year:()=>{var i,n;return null==(n=(i=e.actions).clickYear)?void 0:n.call(i,t,e)},month:()=>{var i,n;return null==(n=(i=e.actions).clickMonth)?void 0:n.call(i,t,e)}};({year:()=>{if("multiple"===e.type){const t=Hr(e,e.CSSClasses.columnYear,e.CSSClasses.year,Number(s.dataset.calendarYear),"data-calendar-selected-year"),i=e.selectedMonthe.dateMax.getMonth()&&t>=e.dateMax.getFullYear(),r=te.dateMax.getFullYear();i||r?(e.selectedYear=e.dateMin.getFullYear(),e.selectedMonth=e.dateMin.getMonth()):n||o?(e.selectedYear=e.dateMax.getFullYear(),e.selectedMonth=e.dateMax.getMonth()):e.selectedYear=t}else e.selectedYear=Number(s.dataset.calendarYear)},month:()=>{if("multiple"===e.type){const t=Hr(e,e.CSSClasses.columnMonth,e.CSSClasses.month,Number(s.dataset.calendarMonth),"data-calendar-selected-month"),i=s.closest(`.${n.column}`).querySelector(`.${e.CSSClasses.year}`);e.selectedYear=Number(i.dataset.calendarSelectedYear);const r=te.dateMax.getMonth()&&e.selectedYear>=e.dateMax.getFullYear();e.selectedMonth=r?e.dateMin.getMonth():o?e.dateMax.getMonth():t}else e.selectedMonth=Number(s.dataset.calendarMonth)}})[i](),r[i](),e.currentType=e.type,Ar(e)})(e,t,i,n,a):(e.currentType===i&&o||"multiple"===e.type&&e.currentType===i&&l&&!d)&&(e.currentType=e.type,Ar(e))},$r=e=>{const t=t=>{((e,t)=>{const i=t.target.closest(`.${e.CSSClasses.arrow}`);i&&(["default","multiple"].includes(e.currentType)?nr(e,i.dataset.calendarArrow):"year"===e.currentType&&void 0!==e.viewYear&&(e.viewYear+={prev:-15,next:15}[i.dataset.calendarArrow],lr(e,t.target)),e.actions.clickArrow&&e.actions.clickArrow(t,e))})(e,t),((e,t)=>{var i;if(!e.settings.visibility.weekNumbers||!e.actions.clickWeekNumber)return;const n=t.target.closest(`.${e.CSSClasses.weekNumber}`),s=null==(i=e.HTMLElement)?void 0:i.querySelectorAll("[data-calendar-week-number]");if(!n||!s)return;const r=Number(n.innerText),o=Number(n.dataset.calendarYearWeek),a=Array.from(s).filter((e=>Number(e.dataset.calendarWeekNumber)===r));e.actions.clickWeekNumber(t,r,a,o,e)})(e,t),((e,t)=>{var i;const n=t.target,s=e=>n.closest(`.${e}`),r=s(e.CSSClasses.dayBtn);if(!e.settings.selection.day||!["single","multiple","multiple-ranged"].includes(e.settings.selection.day)||!r)return;({single:()=>Br(e,r,!1),multiple:()=>Br(e,r,!0),"multiple-ranged":()=>Nr(e,r.dataset.calendarDay)})[e.settings.selection.day](),null==(i=e.selectedDates)||i.sort(((e,t)=>+new Date(e)-+new Date(t))),e.actions.clickDay&&e.actions.clickDay(t,e),e.input&&e.HTMLInputElement&&e.HTMLElement&&e.actions.changeToInput&&e.actions.changeToInput(t,e);const o=s(e.CSSClasses.dayBtnPrev),a=s(e.CSSClasses.dayBtnNext);({prev:()=>nr(e,"prev"),next:()=>nr(e,"next"),default:()=>tr(e)})[o?"prev":a?"next":"default"]()})(e,t),zr(e,t,"month",{header:e.CSSClasses.month,item:e.CSSClasses.monthsMonth,column:e.CSSClasses.columnMonth}),zr(e,t,"year",{header:e.CSSClasses.year,item:e.CSSClasses.yearsYear,column:e.CSSClasses.columnYear})};return e.HTMLElement.addEventListener("click",t),()=>e.HTMLElement.removeEventListener("click",t)},Ur=function(e){let{year:t,month:i,dates:n,holidays:s,time:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var o;const a=xs({},e.settings.selected);e.settings.selected.year=t?a.year:e.selectedYear,e.settings.selected.month=i?a.month:e.selectedMonth,e.settings.selected.holidays=s?a.holidays:e.selectedHolidays,e.settings.selected.time=r?a.time:e.selectedTime,e.settings.selected.dates="only-first"===n&&(null==(o=e.selectedDates)?void 0:o[0])?[e.selectedDates[0]]:!0===n?a.dates:e.selectedDates,Vs(e),Ar(e),e.settings.selected=a,"multiple-ranged"===e.settings.selection.day&&n&&Nr(e)},Vr=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.isInputInit=!0;const i=document.createElement("div");return i.className=`${e.CSSClasses.calendar} ${e.CSSClasses.calendarToInput} ${e.CSSClasses.calendarHidden}`,e.HTMLElement=i,document.body.appendChild(e.HTMLElement),e.HTMLElement.style.visibility="hidden",t&&queueMicrotask((()=>{Qs(e.HTMLInputElement,i,e.settings.visibility.positionToInput,e.CSSClasses),e.HTMLElement.style.visibility="visible",e.show()})),Ur(e,{year:!0,month:!0,dates:!0,holidays:!0,time:!0}),e.actions.initCalendar&&e.actions.initCalendar(e),$r(e)},Wr=e=>{const t=[];e.HTMLInputElement=e.HTMLElement;const i=()=>Qs(e.HTMLInputElement,e.HTMLElement,e.settings.visibility.positionToInput,e.CSSClasses),n=t=>{"Escape"===t.key&&((null==e?void 0:e.HTMLInputElement)&&(null==e?void 0:e.HTMLElement)&&e.hide(),document.removeEventListener("keydown",n))},s=t=>{var n;e&&t.target!==e.HTMLInputElement&&!(null==(n=e.HTMLElement)?void 0:n.contains(t.target))&&(e.HTMLInputElement&&e.HTMLElement&&e.hide(),window.removeEventListener("resize",i),document.removeEventListener("click",s,{capture:!0}))},r=()=>{e.isInputInit?(Qs(e.HTMLInputElement,e.HTMLElement,e.settings.visibility.positionToInput,e.CSSClasses),e.HTMLElement.style.visibility="visible",e.show()):t.push(Vr(e)),window.addEventListener("resize",i),document.addEventListener("click",s,{capture:!0}),document.addEventListener("keydown",n)};return e.HTMLInputElement.addEventListener("click",r),e.HTMLInputElement.addEventListener("focus",r),()=>{t.forEach((e=>e()))}};class jr extends Ds{constructor(e,t){if(super(),Ts(this,"init",(()=>{return(e=this).HTMLOriginalElement=e.HTMLElement.cloneNode(!0),e.isInit=!0,e.input?Wr(e):(Vs(e),Ar(e),e.actions.initCalendar&&e.actions.initCalendar(e),$r(e));var e})),Ts(this,"update",(e=>function(e){let{year:t,month:i,dates:n,holidays:s,time:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e.isInit)throw new Error(Hs);e.input&&!e.isInputInit&&Vr(e,!1),Ur(e,{year:t,month:i,dates:n,holidays:s,time:r}),e.actions.updateCalendar&&e.actions.updateCalendar(e)}(this,e))),Ts(this,"destroy",(()=>(e=>{var t,i,n,s,r,o;if(!e.isInit)throw new Error(Hs);e.input?(null==(i=null==(t=e.HTMLElement)?void 0:t.parentElement)||i.removeChild(e.HTMLElement),null==(s=null==(n=e.HTMLInputElement)?void 0:n.replaceWith)||s.call(n,e.HTMLOriginalElement),e.HTMLInputElement=void 0):null==(o=null==(r=e.HTMLElement)?void 0:r.replaceWith)||o.call(r,e.HTMLOriginalElement),e.HTMLElement=e.HTMLOriginalElement,e.actions.destroyCalendar&&e.actions.destroyCalendar(e)})(this))),Ts(this,"show",(()=>{var e;(e=this).currentType?(e.HTMLElement.classList.remove(e.CSSClasses.calendarHidden),e.actions.showCalendar&&e.actions.showCalendar(e)):e.HTMLElement.click()})),Ts(this,"hide",(()=>{var e;(e=this).currentType&&(e.HTMLElement.classList.add(e.CSSClasses.calendarHidden),e.actions.hideCalendar&&e.actions.hideCalendar(e))})),this.HTMLElement="string"==typeof e?document.querySelector(e):e,!this.HTMLElement)throw new Error(Bs(e));if(!t)return;const i=(e,t)=>{Object.keys(t).forEach((n=>{"object"!=typeof e[n]||"object"!=typeof t[n]||t[n]instanceof Date?e[n]=t[n]:i(e[n],t[n])}))};i(this,t)}}class Gr{constructor(e){this.translaterService=e,this._clearFilterTriggered=!1,this._lastClickIsDate=!1,this._shouldTriggerQuery=!0,this.hasTimePicker=!1,this.inputFilterType="range",this.searchTerms=[],this._bindEventService=new Vt}get gridOptions(){return this.grid?.getOptions()??{}}get columnFilter(){return this.columnDef?.filter||{}}get currentDateOrDates(){return this._currentDateOrDates}get defaultOperator(){return"compound"===this.inputFilterType?C.empty:this.gridOptions.defaultFilterRangeOperator||C.rangeInclusive}get pickerOptions(){return this._pickerOptions||{}}get filterOptions(){return{...this.gridOptions.defaultFilterOptions?.date,...this.columnFilter?.filterOptions}}get operator(){return"compound"===this.inputFilterType?this._operator||this.columnFilter.operator||this.defaultOperator:this.columnFilter?.operator??this.defaultOperator}set operator(e){"compound"===this.inputFilterType?this._operator=e:this.columnFilter&&(this.columnFilter.operator=e)}init(e){if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,"compound"===this.inputFilterType&&(this.operator=e.operator||""),this.searchTerms=e?.searchTerms??[],this.filterContainerElm=e.filterContainerElm;const t="compound"===this.inputFilterType?Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"":this.searchTerms;this._filterElm=this.createDomFilterElement(t),this.updateFilterStyle(this.searchTerms.length>0),this._selectOperatorElm&&this._bindEventService.bind(this._selectOperatorElm,"change",this.onTriggerEvent.bind(this)),this._bindEventService.bind(document.body,"keydown",(e=>{"Escape"!==e.key&&"Tab"!==e.key||this.hide()})),this._bindEventService.bind(this._dateInputElm,"keydown",(e=>{"Backspace"===e.key&&this.clear(!0,!1)}))}clear(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.calendarInstance&&(this._clearFilterTriggered=t,this._shouldTriggerQuery=e,this._currentValue="",this.searchTerms=[],this._currentDateStrings=[],this._selectOperatorElm&&(this._selectOperatorElm.selectedIndex=0),this.calendarInstance&&Yt(this.calendarInstance)),this.onTriggerEvent(new Event("keyup")),this.updateFilterStyle(!1)}destroy(){this._bindEventService.unbindAll(),this.calendarInstance?.destroy(),ee(this.filterContainerElm),this.filterContainerElm?.remove(),this._selectOperatorElm?.remove(),this._filterElm?.remove()}hide(){"function"===typeof this.calendarInstance?.hide&&this.calendarInstance.hide()}show(){"function"===typeof this.calendarInstance?.show&&this.calendarInstance.show()}getValues(){return this._currentDateOrDates}setValues(e,t){let i,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"compound"===this.inputFilterType?i=Array.isArray(e)?e[0]:e:"string"===typeof e||Array.isArray(e)&&"string"===typeof e[0]&&e[0].indexOf("..")>0?i="string"===typeof e?[e]:e[0].split(".."):Array.isArray(e)&&(i=e),this.calendarInstance&&void 0!==i&&(Kt(this.columnFilter,this._dateInputElm,this.calendarInstance,{columnDef:this.columnDef,newVal:i,updatePickerUI:!0}),this._currentDateOrDates=e&&i?i:void 0);const s=this.getValues()||[],r=Array.isArray(s)?s:[s];if(this.updateFilterStyle(r.length>0),this.operator=t||this.defaultOperator,t&&this._selectOperatorElm){const e=W(this.operator);this._selectOperatorElm.value=e}n&&this.callback(void 0,{columnDef:this.columnDef,searchTerms:r,operator:this.operator,shouldTriggerQuery:!0})}buildDatePickerInput(e){const t=this.columnDef?.id??"",i=this.columnFilter.type||this.columnDef.type||y.dateIso,n=this.columnDef.outputType||this.columnFilter.type||this.columnDef.type||y.dateUtc,s=Pt(n),r=this.columnFilter.type||this.columnDef.type||y.dateIso;s&&"range"!==this.inputFilterType&&("ISO8601"===s||s.toLowerCase().includes("h"))&&(this.hasTimePicker=!0);const o=Pt(this.hasTimePicker?y.dateTimeIsoAM_PM:y.dateIso),a=(this.filterOptions?.locale??this.translaterService?.getCurrentLanguage?.())||this.gridOptions.locale||"en";let l;"compound"===this.inputFilterType?e&&(l=e,this._currentDateOrDates=e):("string"===typeof e||Array.isArray(e)&&"string"===typeof e[0]&&e[0].indexOf("..")>0?l="string"===typeof e?[e]:e[0].split(".."):Array.isArray(e)&&(l=e),Array.isArray(l)&&(this._currentDateOrDates=l,this._currentDateStrings=l.map((e=>Ft(e,void 0,r)))));const d={input:!0,jumpToSelectedDate:!0,type:"range"===this.inputFilterType?"multiple":"default",sanitizer:e=>this.grid.sanitizeHtmlString(e),toggleSelected:!1,actions:{clickDay:e=>{this._lastClickIsDate=!0},changeToInput:(e,t)=>{if(t.HTMLInputElement){let e=[],r="",a="";if(t.selectedDates[1]){t.selectedDates.sort(((e,t)=>+new Date(e)-+new Date(t))),r=t.selectedDates[0],a=t.selectedDates[t.selectedDates.length-1];const i=kt(t.selectedDates[0],s,"en-US"),n=kt(a,s,"en-US");t.HTMLInputElement.value=`${i} \u2014 ${n}`,e=[r,a]}else t.selectedDates[0]?(r=t.selectedDates[0],t.HTMLInputElement.value=Ft(r,y.dateIso,n),e=t.selectedDates):t.HTMLInputElement.value="";if(this.hasTimePicker&&r){const i=Dt(r,o);i.setHours(+(t.selectedHours||0)),i.setMinutes(+(t.selectedMinutes||0)),t.HTMLInputElement.value=Ft(i,void 0,n),e=[i]}if("compound"===this.inputFilterType?this._currentValue=Ft(e[0],void 0,i):Array.isArray(e)&&(this._currentDateStrings=e.map((e=>Ft(e,void 0,i))),this._currentValue=this._currentDateStrings.join("..")),this._currentDateOrDates=e.map((e=>e instanceof Date?e:Dt(e,o))),this._currentValue){const e=this.hasTimePicker?new Event("keyup"):void 0;this.onTriggerEvent(e)}"range"===this.inputFilterType&&t.selectedDates.length<2&&(this._lastClickIsDate=!1),this._lastClickIsDate&&(t.hide(),this._lastClickIsDate=!1)}}},settings:{lang:a,iso8601:!1,visibility:{theme:this.gridOptions?.darkMode?"dark":"light",positionToInput:"auto",weekend:!1}}};"range"===this.inputFilterType&&(d.type="multiple",d.months=2,d.jumpMonths=2,d.settings={...d.settings,range:{edgesOnly:!0},selection:{day:"multiple-ranged"},visibility:{...d.settings?.visibility,daysOutside:!1}}),this.hasTimePicker&&(d.settings.selection??={},d.settings.selection.time=24),this._pickerOptions=Se(!0,{},d,{settings:this.filterOptions});let c=this.gridOptions?.defaultFilterPlaceholder??"";this.columnFilter?.placeholder&&(c=this.columnFilter.placeholder),this._dateInputElm=Q("input",{type:"text",className:"form-control date-picker",placeholder:c,readOnly:!0,dataset:{input:"",columnid:`${t}`}}),this.calendarInstance=new jr(this._dateInputElm,this._pickerOptions),this.calendarInstance.init(),this._pickerOptions.settings?.selected?.dates&&(l=this._pickerOptions.settings.selected.dates),l&&Kt(this.columnFilter,this._dateInputElm,this.calendarInstance,{columnDef:this.columnDef,oldVal:void 0,newVal:l,updatePickerUI:!1})}getOperatorOptionValues(){let e;return e=this.columnFilter?.compoundOperatorList?this.columnFilter.compoundOperatorList:Zt(this.gridOptions,this.translaterService),Jt(this.gridOptions,e,"numeric"),e}createDomFilterElement(e){const t=this.columnDef?.id??"";if(ee(this.filterContainerElm),this.buildDatePickerInput(e),"range"===this.inputFilterType){const i=Q("div",{className:`date-picker form-group search-filter slick-filter filter-${t}`});return Array.isArray(e)&&e.length>0&&""!==e[0]&&(this._currentDateOrDates=e,this._currentValue=e[0]),i.appendChild(this._dateInputElm),i&&this.filterContainerElm.appendChild(i),i}{this._selectOperatorElm=qt(this.getOperatorOptionValues(),this.grid);const i=Q("div",{className:`date-picker form-group search-filter slick-filter filter-${t}`}),n=Q("div",{className:"input-group date-picker"},i);if(Q("div",{className:"input-group-addon input-group-prepend operator"},n).appendChild(this._selectOperatorElm),n.appendChild(this._dateInputElm),this.operator){const e=W(this.operator);this._selectOperatorElm.value=e}return this._currentDateOrDates=e,this._currentValue=e,i&&this.filterContainerElm.appendChild(i),i}}onTriggerEvent(e){if(this._clearFilterTriggered)this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:this._clearFilterTriggered,shouldTriggerQuery:this._shouldTriggerQuery}),this.updateFilterStyle(!1);else if("range"===this.inputFilterType){const t=this._currentDateStrings?this._currentDateStrings:[this._currentValue];this.updateFilterStyle(t.length>0),this.callback(e,{columnDef:this.columnDef,searchTerms:t,operator:this.operator||"",shouldTriggerQuery:this._shouldTriggerQuery})}else if("compound"===this.inputFilterType&&this._selectOperatorElm){const t=this._selectOperatorElm.value;this.updateFilterStyle(!!this._currentValue);const i=this.columnFilter.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput??void 0===this.gridOptions.skipCompoundOperatorFilterWithNullInput,n=i&&Re(this._currentDateOrDates)||""===this._currentDateOrDates&&Re(this._lastSearchValue);i&&i&&!n||this.callback(e,{columnDef:this.columnDef,searchTerms:this._currentValue?[this._currentValue]:null,operator:t||"",shouldTriggerQuery:this._shouldTriggerQuery})}this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this._lastSearchValue=this._currentValue}updateFilterStyle(e){e?this._filterElm.classList.add("filled"):this._filterElm.classList.remove("filled")}}class Yr{constructor(e){this.translaterService=e}filterCollection(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:S.chain,n=[];return Array.isArray(t)?(n=i===S.merge?[]:[...e],t.forEach((t=>{if(i===S.merge){const i=this.singleFilterCollection(e,t);n=je([...n,...i])}else n=this.singleFilterCollection(n,t)}))):n=this.singleFilterCollection(e,t),n}preParseByMutationDateItems(e,t,i){const n=[];t.getColumns().forEach((e=>{const t=this.getParseDateInfo(e,i);t&&n.push(t)})),e.forEach((e=>{n.forEach((t=>{let{columnId:i,dateFormat:n,queryFieldName:s}=t;this.reassignDateWhenValid(e,i,n,s)}))}))}parseSingleDateItem(e,t,i){i&&t.getColumns().forEach((t=>{const n=this.getParseDateInfo(t,i);n&&this.reassignDateWhenValid(e,t.id,n.dateFormat,n.queryFieldName)}))}singleFilterCollection(e,t){let i=[];if(t){const n=t.property,s=t.operator||C.equal,r="undefined"===typeof t.value?"":t.value;switch(s){case C.equal:i=n?e.filter((e=>e[n]===r)):e.filter((e=>e===r));break;case C.contains:i=n?e.filter((e=>-1!==e[n]?.toString().indexOf(r.toString()))):e.filter((e=>null!==e&&void 0!==e&&-1!==e.toString().indexOf(r.toString())));break;case C.notContains:i=n?e.filter((e=>-1===e[n]?.toString().indexOf(r.toString()))):e.filter((e=>null!==e&&void 0!==e&&-1===e.toString().indexOf(r.toString())));break;case C.notEqual:default:i=n?e.filter((e=>e[n]!==r)):e.filter((e=>e!==r))}}return i}sortCollection(e,t,i,n){if(n&&(!this.translaterService||!this.translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');let s=[];if(i)if(Array.isArray(i))s=t.sort(((t,s)=>{for(let r=0,o=i.length;r{const s=n?this.translaterService?.translate&&this.translaterService.translate(t[r]||" "):t[r],l=n?this.translaterService?.translate&&this.translaterService.translate(i[r]||" "):i[r],d=Ht(a,s,l,o,e);return d!==O.neutral?d:O.neutral}))}else if(i&&!i.property){const r=i.sortDesc?O.desc:O.asc,o=i?.fieldType??e?.type??y.string;s=t.sort(((t,i)=>{const s=n?this.translaterService?.translate&&this.translaterService.translate(t||" "):t,a=n?this.translaterService?.translate&&this.translaterService.translate(i||" "):i,l=Ht(o,s,a,r,e);return l!==O.neutral?l:O.neutral}))}return s}getParseDateInfo(e,t){const i=e.type||y.string,n=Pt(i);if(U(i)&&t){const i="string"===typeof t?`${t}${e.id}`:`${e.id}`;return{columnId:e.id,dateFormat:n,queryFieldName:i}}}reassignDateWhenValid(e,t,i,n){const s=Mt(e[t],i,!1);s&&(e[n]=s)}}function Kr(e,t,i,n){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=arguments.length>5?arguments[5]:void 0,o=arguments.length>6?arguments[6]:void 0;const a=i?.id??"",l=n.getOptions(),d=("editor"===e?i?.editor:i?.filter)??{},c=d?.collectionOptions??{},h=c?.separatorBetweenTextLabels??"",u=d?.enableTranslateLabel??!1,p=l?.enableTranslate??!1,m=d?.enableRenderHtml??!1,g=d?.customStructure?.label??"label",f=d?.customStructure?.labelPrefix??"labelPrefix",v=d?.customStructure?.labelSuffix??"labelSuffix",b=d?.customStructure?.optionLabel??"value",y=d?.customStructure?.value??"value",_=Q("select",{className:"ms-filter search-filter"}),S="filter"===e?["search-filter",`filter-${a}`]:["select-editor",`editor-${a}`];_.classList.add(...S),_.multiple=s;const w=[];let C=!1;return Array.isArray(t)&&(t.every((e=>"number"===typeof e||"string"===typeof e))?t.forEach((t=>{const i={text:String(t),value:t};"filter"===e&&Array.isArray(o)&&(i.selected=o.findIndex((e=>e===t))>=0),w.push(i),(i.selected&&s||i.selected&&!s&&""!==t)&&(C=!0)})):t.forEach((t=>{if(void 0===t||"object"===typeof t&&void 0===t[g]&&void 0===t.labelKey)throw new Error("[Slickgrid-Universal] Select Filter/Editor collection with value/label (or value/labelKey when using Locale) is required to populate the Select list, for example:: { filter: model: Filters.multipleSelect, collection: [ { value: '1', label: 'One' } ]')");const i=t.labelKey||t[g],a=(t.labelKey||u&&r)&&i&&p?r?.translate(i||" "):i;let l=t[f]||"",d=t[v]||"",c=t.hasOwnProperty(b)?t[b]:"";c?.toString&&(c=c.toString().replace(/"/g,"'")),l=u&&r&&l&&"string"===typeof l?r.translate(l||" "):l,d=u&&r&&d&&"string"===typeof d?r.translate(d||" "):d,c=u&&r&&c&&"string"===typeof c?r.translate(c||" "):c;let _=[l,"string"===typeof a||"number"===typeof a?a.toString():a,d].filter((e=>e)).join(h);const S={text:"",value:""};m&&(_=n.sanitizeHtmlString(_)),S.text=_;let E=t[y];void 0!==E&&null!==E||(E=""),"filter"===e&&Array.isArray(o)&&(S.selected=o.findIndex((e=>`${e}`===`${t[y]}`))>=0),S.value=`${E??""}`,w.push(S),(S.selected&&s||S.selected&&!s&&""!==t[y])&&(C=!0)}))),{selectElement:_,dataCollection:w,hasFoundSearchTerm:C}}class qr{constructor(e,t,i){this.sharedService=e,this.backendUtilities=t,this.translaterService=i}getPickerTitleOutputString(e,t){if(this.sharedService.gridOptions?.enableTranslate&&!this.translaterService?.translate)throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');let i="";const n=this.sharedService.gridOptions?.[t]??{},s=this.sharedService.gridOptions?.enableTranslate??!1,r=this.sharedService.gridOptions?.locales??g.locales,o=n?.[e],a=n?.[`${e}Key`],l=z(this.sharedService.gridOptions);if(a&&this.translaterService?.translate)i=this.translaterService.translate(a||" ");else switch(e){case"commandTitle":i=o||s&&this.translaterService?.getCurrentLanguage&&this.translaterService?.translate(`${l}COMMANDS`)||r?.TEXT_COMMANDS;break;case"columnTitle":i=o||s&&this.translaterService?.getCurrentLanguage&&this.translaterService?.translate(`${l}COLUMNS`)||r?.TEXT_COLUMNS;break;case"forceFitTitle":i=o||s&&this.translaterService?.getCurrentLanguage&&this.translaterService?.translate(`${l}FORCE_FIT_COLUMNS`)||r?.TEXT_FORCE_FIT_COLUMNS;break;case"syncResizeTitle":i=o||s&&this.translaterService?.getCurrentLanguage&&this.translaterService?.translate(`${l}SYNCHRONOUS_RESIZE`)||r?.TEXT_SYNCHRONOUS_RESIZE;break;default:i=o}return i}readjustFrozenColumnIndexWhenNeeded(e,t,i){if(e>=0){const n=i.findIndex((e=>e.id===this.sharedService.frozenVisibleColumnId));n>=0&&n!==e&&(this.sharedService.gridOptions.frozenColumn=n,this.sharedService.slickGrid.setOptions({frozenColumn:n})),Array.isArray(i)&&Array.isArray(t)&&i.length!==t.length&&this.sharedService.slickGrid.setColumns(i)}}refreshBackendDataset(e){let t=this.sharedService.gridOptions;e&&(t={...this.sharedService.gridOptions,...e},this.sharedService.gridOptions=t),this.backendUtilities?.refreshBackendDataset(t)}runOverrideFunctionWhenExists(e,t){return"function"!==typeof e||!!e.call(this,t)}sortItems(e,t){Array.isArray(e)&&e.sort(((e,i)=>e&&i&&e.hasOwnProperty(t)&&i.hasOwnProperty(t)?e[t]-i[t]:0))}translateItems(e,t,i){if(Array.isArray(e))for(const n of e)n.hasOwnProperty(t)&&(n[i]=this.translaterService?.translate?.(n[t]))}translateMenuItemsFromTitleKey(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"commandItems";for(const i of e)"object"===typeof i&&(i.titleKey&&(i.title=this.translateWhenEnabledAndServiceExist(`${i.titleKey}`,`TEXT_${i.titleKey}`)),i.subMenuTitleKey&&(i.subMenuTitle=this.translateWhenEnabledAndServiceExist(`${i.subMenuTitleKey}`,`TEXT_${i.subMenuTitleKey}`))),Array.isArray(i?.[t])&&this.translateMenuItemsFromTitleKey(i?.[t])}translateWhenEnabledAndServiceExist(e,t,i){let n="";const s=this.sharedService?.gridOptions,r=s?.locales??g.locales;return n=i||(s.enableTranslate&&this.translaterService?.translate?this.translaterService.translate(e||" "):t in r?r[t]:t),n}}class Xr{constructor(e){this.pluginName="AutoTooltips",this._defaults={enableForCells:!0,enableForHeaderCells:!1,maxToolTipLength:void 0,replaceExisting:!0},this._eventHandler=new ii,this._addonOptions=e}get addonOptions(){return this._addonOptions}get eventHandler(){return this._eventHandler}init(e){this._addonOptions={...this._defaults,...this.addonOptions},this._grid=e,this._addonOptions.enableForCells&&this._eventHandler.subscribe(this._grid.onMouseEnter,this.handleMouseEnter.bind(this)),this._addonOptions.enableForHeaderCells&&this._eventHandler.subscribe(this._grid.onHeaderMouseEnter,this.handleHeaderMouseEnter.bind(this))}destroy(){this.dispose()}dispose(){this._eventHandler?.unsubscribeAll()}handleMouseEnter(e){const t=this._grid.getCellFromEvent(e);if(t){let e,i=this._grid.getCellNode(t.row,t.cell);this._addonOptions&&i&&(!i.title||this._addonOptions?.replaceExisting)&&(i.clientWidththis._addonOptions?.maxToolTipLength&&(e=e.substring(0,this._addonOptions.maxToolTipLength-3)+"...")):e="",i.title=e),i=null}}handleHeaderMouseEnter(e,t){const i=t.column;let n;const s=e.target;if(s&&(n=s.closest(".slick-header-column"),n&&!i?.toolTip)){const e=s.clientWidth{this._addonOptions&&"function"===typeof this._addonOptions.onCopyCells&&this._addonOptions.onCopyCells(e,t)})),this._eventHandler.subscribe(this._cellExternalCopyManagerPlugin.onCopyCancelled,((e,t)=>{this._addonOptions&&"function"===typeof this._addonOptions.onCopyCancelled&&this._addonOptions.onCopyCancelled(e,t)})),this._eventHandler.subscribe(this._cellExternalCopyManagerPlugin.onPasteCells,((e,t)=>{this._addonOptions&&"function"===typeof this._addonOptions.onPasteCells&&this._addonOptions.onPasteCells(e,t)}))}dispose(){this._eventHandler.unsubscribeAll(),this._bindingEventService.unbindAll(),this._cellSelectionModel?.dispose(),this._cellExternalCopyManagerPlugin?.dispose()}createUndoRedoBuffer(){let e=0;this._commandQueue=[],this._undoRedoBuffer={queueAndExecuteCommand:t=>{this._commandQueue[e]=t,e++,t.execute()},undo:()=>{if(0===e)return;e--;const t=this._commandQueue[e];t&&li.cancelCurrentEdit()&&t.undo()},redo:()=>{if(e>=this._commandQueue.length)return;const t=this._commandQueue[e];e++,t&&li.cancelCurrentEdit()&&t.execute()}}}getDefaultOptions(){var e=this;let t=0;return{clipboardCommandHandler:e=>{this._undoRedoBuffer.queueAndExecuteCommand.call(this._undoRedoBuffer,e)},dataItemColumnValueExtractor:function(t,i){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const r=e._grid.getActiveCell(),o=e._grid.getCellEditor()&&r?.row===n&&r?.cell===s,a=e.addonOptions?.copyActiveEditorCell||!1;if(!e.gridOptions.editable||!i.editor||!o||a){const r=void 0!==i.exportWithFormatter?i.exportWithFormatter:e.gridOptions.textExportOptions?.exportWithFormatter;if(i.formatter&&r){const r=i.formatter(n,s,t[i.field],i,t,e._grid),o=Fe(r)?r:r.html||r.text;if(i.sanitizeDataExport||e.gridOptions.textExportOptions?.sanitizeDataExport){return Ze((o instanceof HTMLElement?o.innerHTML:o)??"")}return r}}return null},readOnlyMode:!1,includeHeaderWhenCopying:!1,newRowCreator:e=>{for(let i=0;i{};class eo{constructor(){this.pluginName="CellExternalCopyManager",this._bodyElement=document.body,this._copiedCellStyle="copied",this._copiedCellStyleLayerKey="copy-manager",this._copiedRanges=null,this._dataWrapper=new Zr,this.onCopyCells=new ti("onCopyCells"),this.onCopyCancelled=new ti("onCopyCancelled"),this.onPasteCells=new ti("onPasteCells"),this.onBeforePasteCell=new ti("onBeforePasteCell"),this._eventHandler=new ii}get addonOptions(){return this._addonOptions}get eventHandler(){return this._eventHandler}init(e,t){this._grid=e,this._dataWrapper.init(e),this._addonOptions={...this._addonOptions,...t},this._copiedCellStyleLayerKey=this._addonOptions.copiedCellStyleLayerKey||"copy-manager",this._copiedCellStyle=this._addonOptions.copiedCellStyle||"copied",this._bodyElement=this._addonOptions.bodyElement||document.body,this._onCopyInit=this._addonOptions.onCopyInit||void 0,this._onCopySuccess=this._addonOptions.onCopySuccess||void 0;const i=e.getPubSubService();i&&ai.addSlickEventPubSubWhenDefined(i,this),this._eventHandler.subscribe(this._grid.onKeyDown,this.handleKeyDown.bind(this));const n=e.getSelectionModel();if(!n)throw new Error("Selection model is mandatory for this plugin. Please set a selection model on the grid before adding this plugin: grid.setSelectionModel(new SlickCellSelectionModel())");this._eventHandler.subscribe(n.onSelectedRangesChanged,(()=>{this._grid.getEditorLock().isActive()||document.activeElement?.classList.contains("slick-filter")||this._grid.focus()})),e&&"function"===typeof this._addonOptions?.onBeforePasteCell&&this._eventHandler.subscribe(this.onBeforePasteCell,((t,i)=>{const n=e.getColumns()[i.cell],s={row:i.row,cell:i.cell,dataView:e.getData(),grid:e,columnDef:n,dataContext:e.getDataItem(i.row)};return this._addonOptions.onBeforePasteCell?.(t,s)}))}dispose(){this._eventHandler.unsubscribeAll()}clearCopySelection(){this._grid.removeCellCssStyles(this._copiedCellStyleLayerKey)}getHeaderValueForColumn(e){if("function"===typeof this._addonOptions.headerColumnValueExtractor){const t=te(this._addonOptions.headerColumnValueExtractor(e),"innerHTML");if(t)return Ze(t)}return te(e.name||"","innerHTML")}getDataItemValueForColumn(e,t,i,n,s){if("function"===typeof this._addonOptions.dataItemColumnValueExtractor){const s=this._addonOptions.dataItemColumnValueExtractor(e,t,i,n);if(s)return s instanceof HTMLElement?Ze(s.innerHTML):s}let r="";if(t)if(t.editorClass){const i=document.createElement("p"),n=new t.editorClass({container:i,column:t,event:s,position:{top:0,left:0},gridPosition:{top:0,left:0},grid:this._grid,cancelChanges:Jr,commitChanges:Jr});n.loadValue(e),r=n.serializeValue(),n.destroy(),i.remove()}else r=e[t.field||""];return r}setDataItemValueForColumn(e,t,i){if(!t?.denyPaste){if(this._addonOptions.dataItemColumnValueSetter){const n=this._addonOptions.dataItemColumnValueSetter(e,t,i);if(!0!==n)return n}if(t.editorClass){const n=document.createElement("div"),s=new t.editorClass({container:n,column:t,event:null,position:{top:0,left:0},gridPosition:{top:0,left:0},grid:this._grid,cancelChanges:Jr,commitChanges:Jr});s.loadValue(e);const r=s.validate(void 0,i);if(!r.valid){const e=this._grid.getActiveCell();this._grid.onValidationError.notify({editor:s,cellNode:this._grid.getActiveCellNode(),validationResults:r,row:e?.row,cell:e?.cell,column:t,grid:this._grid})}s.applyValue(e,i),s.destroy(),n.remove()}else e[t.field]=i}}setIncludeHeaderWhenCopying(e){this._addonOptions.includeHeaderWhenCopying=e}createTextBox(e){const t=Q("textarea",{value:e,style:{position:"absolute",opacity:"0",top:`${document.documentElement.scrollTop||document.body.scrollTop}px`}},this._bodyElement);return t.select(),t}decodeTabularData(e,t){const i=e.getColumns(),n=t.value.split(/[\n\f\r](?=(?:[^"]*"[^"]*")*[^"]*$)/);""===n[n.length-1]&&n.pop();let s=0;const r=[];this._bodyElement.removeChild(t);for(const f of n)f.startsWith('"')&&f.endsWith('"')?r[s++]=[f.replaceAll("\n",this._addonOptions.replaceNewlinesWith||"\n").replaceAll("\r","").replaceAll('"',this._addonOptions.removeDoubleQuotesOnPaste?"":'"')]:r[s++]=f.split("\t");const o=this._grid.getActiveCell(),a=this._grid.getSelectionModel()?.getSelectedRanges(),l=a?.length?a[0]:null;let d,c;if(l)d=l.fromRow,c=l.fromCell;else{if(!o)return;d=o.row,c=o.cell}let h=!1,u=r.length,p=r.length?r[0].length:0;1===r.length&&1===r[0].length&&l&&(h=!0,u=l.toRow-l.fromRow+1,p=l.toCell-l.fromCell+1);const m=this._dataWrapper.getDataLength()-d;if(mthis._dataWrapper.getDataLength()&&"function"===typeof this._addonOptions.newRowCreator){const e=d+u-this._dataWrapper.getDataLength();this._addonOptions.newRowCreator(e)}const g={isClipboardCommand:!0,clippedRange:r,oldValues:[],cellExternalCopyManager:this,_options:this._addonOptions,setDataItemValueForColumn:this.setDataItemValueForColumn,markCopySelection:this.markCopySelection,oneCellToMultiple:h,activeRow:d,activeCell:c,destH:u,destW:p,maxDestY:this._dataWrapper.getDataLength(),maxDestX:this._grid.getColumns().length,h:0,w:0,execute:()=>{g.h=0;for(let t=0;t{for(let t=0;t0&&!i[t].hidden&&e.push(this.getHeaderValueForColumn(i[t]))}o.push(e.join("\t"))}for(let o=r.fromCell;o0&&!i[o].hidden&&n.push(this.getDataItemValueForColumn(s,i[o],t,o,e))}o.push(n.join("\t"))}n+=o.join("\r\n")+"\r\n"}if(window.clipboardData)return window.clipboardData.setData("Text",n),!0;{const e=document.activeElement,i=this.createTextBox(n);if(i.focus(),window.setTimeout((()=>{this._bodyElement.removeChild(i),e?e.focus():console.log("No element to restore focus to after copy?")}),this.addonOptions?.clipboardPasteDelay??100),"function"===typeof this._onCopySuccess){const e=1===t.length?t[0].toRow+1-t[0].fromRow:t.length;this._onCopySuccess(e)}return!1}}if(!this._addonOptions.readOnlyMode&&("v"===e.key&&(e.ctrlKey||e.metaKey)&&!e.shiftKey||"Insert"===e.key&&e.shiftKey&&!e.ctrlKey)){const e=this.createTextBox("");return window.setTimeout((()=>this.decodeTabularData(this._grid,e)),this.addonOptions?.clipboardPasteDelay??100),!1}}}markCopySelection(e){this.clearCopySelection();const t=this._grid.getColumns(),i={};for(const n of e)for(let e=n.fromRow;e<=n.toRow;e++){i[e]={};for(let s=n.fromCell;s<=n.toCell&&sthis.clearCopySelection()),this.addonOptions?.clearCopySelectionDelay||2e3)}}class to{constructor(e,t,i){this.extensionUtility=e,this.pubSubService=t,this.sharedService=i,this._addonOptions={},this._camelPluginName="",this._gridUid="",this._menuCssPrefix="",this._menuPluginCssPrefix="",this._bindEventService=new Vt,this._eventHandler=new ii}get addonOptions(){return this._addonOptions}set addonOptions(e){this._addonOptions=e}get eventHandler(){return this._eventHandler}get grid(){return this.sharedService.slickGrid}get gridOptions(){return this.sharedService.gridOptions??{}}get gridUid(){return this._gridUid||(this.grid?.getUID()??"")}get gridUidSelector(){return this.gridUid?`.${this.gridUid}`:""}get menuCssClass(){return this._menuPluginCssPrefix||this._menuCssPrefix}get menuElement(){return this._menuElm||document.querySelector(`.${this.menuCssClass}${this.gridUidSelector}`)}dispose(){this._eventHandler?.unsubscribeAll(),this._bindEventService.unbindAll(),this.pubSubService.unsubscribeAll(),this._commandTitleElm?.remove(),this._optionTitleElm?.remove(),this.disposeAllMenus(),ee(this._menuElm),this.menuElement?.remove(),this._menuElm?.remove()}disposeAllMenus(){this.disposeSubMenus(),this._bindEventService.unbindAll("parent-menu"),document.querySelectorAll(`.${this.menuCssClass}${this.gridUidSelector}`).forEach((e=>e.remove()))}disposeSubMenus(){this._bindEventService.unbindAll("sub-menu"),document.querySelectorAll(`.${this.menuCssClass}.slick-submenu${this.gridUidSelector}`).forEach((e=>e.remove()))}setOptions(e){this._addonOptions={...this._addonOptions,...e}}addSubMenuTitleWhenExists(e,t){if("divider"!==e&&e?.subMenuTitle){const i=document.createElement("div");i.className="slick-menu-title",i.textContent=e.subMenuTitle;const n=e.subMenuTitleCssClass;n&&i.classList.add(...Z(n)),t.appendChild(i)}}populateCommandOrOptionItems(e,t,i,n,s,r,o){if(s&&n&&t)for(const a of n)this.populateSingleCommandOrOptionItem(e,t,i,a,s,r,o)}populateCommandOrOptionTitle(e,t,i,n){if(t){const s=n>0,r=this._menuElm?.querySelector(`.slick-${e}-header`)??Q("div",{className:`slick-${e}-header`}),o=`${e}Title`;s||(t?.[o]?(ee(r),this[`_${e}TitleElm`]=Q("span",{className:"slick-menu-title",textContent:t[o]}),r.appendChild(this[`_${e}TitleElm`]),r.classList.add("with-title")):r.classList.add("no-title"),i.appendChild(r))}}populateSingleCommandOrOptionItem(e,t,i,n,s,r,o){let a=null;if(s&&n&&t){const t=s?.level||0,l="headerButtons"===this._camelPluginName?"":"-item",d=`${this._menuCssPrefix}${l}`;let c=!0,h=!0;if("object"===typeof n&&(c=this.extensionUtility.runOverrideFunctionWhenExists(n.itemVisibilityOverride,s),h=this.extensionUtility.runOverrideFunctionWhenExists(n.itemUsabilityOverride,s)),!c)return null;if("object"===typeof n&&n.itemUsabilityOverride&&(n.disabled=!h),a=Q("li",{className:d,role:"menuitem"}),"object"===typeof n&&Re(n[e])&&(a.dataset[e]=n?.[e]),i&&i.appendChild(a),"object"===typeof n&&n.divider||"divider"===n)return a.classList.add(`${d}-divider`),a;if(n.disabled&&a.classList.add(`${d}-disabled`),(n.hidden||n.showOnHover)&&a.classList.add(`${d}-hidden`),n.cssClass&&a.classList.add(...Z(n.cssClass)),n.tooltip&&(a.title=n.tooltip),"headerButtons"!==this._camelPluginName){const e=Q("div",{className:`${this._menuCssPrefix}-icon`});a.appendChild(e),n.iconCssClass?e.classList.add(...Z(n.iconCssClass)):n.commandItems||n.optionItems||(e.textContent="\u25e6");const t=Q("span",{className:`${this._menuCssPrefix}-content`,textContent:"object"===typeof n&&n.title||""},a);n.textCssClass&&t.classList.add(...Z(n.textCssClass))}const u=t>0?"sub-menu":"parent-menu";if(this._bindEventService.bind(a,"click",(i=>r.call(this,i,e,n,t,s?.column)),void 0,u),"mouseover"===this._addonOptions?.subMenuOpenByEvent&&"function"===typeof o&&this._bindEventService.bind(a,"mouseover",(i=>o.call(this,i,e,n,t,s?.column)),void 0,u),n.commandItems||n.optionItems){const e=document.createElement("span");e.className="sub-item-chevron",this._addonOptions.subItemChevronClass?e.classList.add(...Z(this._addonOptions.subItemChevronClass)):e.textContent="\u2b9e",a.classList.add("slick-submenu-item"),a.appendChild(e)}}return a}}class io extends to{constructor(e,t,i){super(e,t,i),this.extensionUtility=e,this.pubSubService=t,this.sharedService=i,this._currentCell=-1,this._currentRow=-1,this._lastMenuTypeClicked="",this._subMenuParentId=""}createParentMenu(e){this.menuElement?.remove(),this._menuElm=void 0;const t=this.grid.getCellFromEvent(e);if(t){this._currentCell=t.cell??0,this._currentRow=t.row??0;const i=this._addonOptions?.commandItems||[],n=this._addonOptions?.optionItems||[],s={cell:this._currentCell,row:this._currentRow,grid:this.grid};if(this.closeMenu(e,s),"function"===typeof e.stopPropagation&&(this.pubSubService.publish(`on${ze(this._camelPluginName)}BeforeMenuShow`,s),"function"===typeof this.addonOptions?.onBeforeMenuShow&&!1===this.addonOptions.onBeforeMenuShow(e,s)))return;if(this._menuElm=this.createMenu(i,n),this._menuElm&&(this._menuElm.style.top=`${(e.pageY||0)+5}px`,this._menuElm.style.left=`${e.pageX}px`,this._menuElm.style.display="block",document.body.appendChild(this._menuElm)),this.pubSubService.publish(`on${ze(this._camelPluginName)}AfterMenuShow`,s),"function"===typeof this.addonOptions?.onAfterMenuShow&&!1===this.addonOptions.onAfterMenuShow(e,s))return}return this._menuElm}createMenu(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;const s=this.grid.getColumns()[this._currentCell],r=this.grid.getDataItem(this._currentRow),o=n?.command||n?.option;let a=1===i&&o?String(o).replace(/\s/g,""):"";a&&(this._subMenuParentId=a),i>1&&(a=this._subMenuParentId);let l=!0,d=!0;if("contextMenu"===this._camelPluginName){if(l=this.checkIsColumnAllowed(this._addonOptions?.optionShownOverColumnIds??[],s.id),d=this.checkIsColumnAllowed(this._addonOptions?.commandShownOverColumnIds??[],s.id),!s||(!d||!e.length)&&(!l||!t.length))return void this.hideMenu()}else if(!s||!s.cellMenu||!e.length&&!t.length)return;const c=`${this.menuCssClass} slick-menu-level-${i} ${this.gridUid}`,h=document.body.querySelector(`.${this.menuCssClass}.slick-menu-level-${i}${this.gridUidSelector}`);if(h){if(h.dataset.subMenuParent===a)return h;this.disposeSubMenus()}const u=document.createElement("div");u.className=c,i>0&&(u.classList.add("slick-submenu"),this.gridOptions?.darkMode&&u.classList.add("slick-dark-mode"),a&&(u.dataset.subMenuParent=a));const p=isNaN(this.addonOptions.maxHeight)?this.addonOptions.maxHeight:`${this.addonOptions.maxHeight??0}px`,m=isNaN(this.addonOptions.maxWidth)?this.addonOptions.maxWidth:`${this.addonOptions.maxWidth??0}px`;p&&(u.style.maxHeight=p),m&&(u.style.maxWidth=m),this.addonOptions?.width&&(u.style.width=ae(this.addonOptions?.width));const g=Q("button",{ariaLabel:"Close",className:"close",type:"button",textContent:"\xd7",dataset:{dismiss:this._menuCssPrefix}});if(!this.addonOptions.hideOptionSection&&l&&t.length>0){const e=Q("div",{className:`${this._menuCssPrefix}-option-list`,role:"menu"},u);this.populateCommandOrOptionTitle("option",this.addonOptions,e,i),!this.addonOptions.hideCloseButton&&i<1&&this.populateCommandOrOptionCloseBtn("option",g,e),n&&i>0&&this.addSubMenuTitleWhenExists(n,e),this.populateCommandOrOptionItems("option",this.addonOptions,e,t,{cell:this._currentCell,row:this._currentRow,column:s,dataContext:r,grid:this.grid,level:i},this.handleMenuItemCommandClick,this.handleMenuItemMouseOver)}if(!this.addonOptions.hideCommandSection&&d&&e.length>0){const o=Q("div",{className:`${this._menuCssPrefix}-command-list`,role:"menu"},u);this.populateCommandOrOptionTitle("command",this.addonOptions,o,i),!this.addonOptions.hideCloseButton&&i<1&&(!l||0===t.length||this.addonOptions.hideOptionSection)&&this.populateCommandOrOptionCloseBtn("command",g,o),n&&i>0&&this.addSubMenuTitleWhenExists(n,o),this.populateCommandOrOptionItems("command",this.addonOptions,o,e,{cell:this._currentCell,row:this._currentRow,column:s,dataContext:r,grid:this.grid,level:i},this.handleMenuItemCommandClick,this.handleMenuItemMouseOver)}return i++,u}closeMenu(e,t){if(this.menuElement){if("function"===typeof this.addonOptions?.onBeforeMenuClose&&!1===this.addonOptions.onBeforeMenuClose(e,t))return;this.hideMenu()}}hideMenu(){this.menuElement?.remove(),this._menuElm=null,this.disposeSubMenus()}checkIsColumnAllowed(e,t){return!(e?.length>0)||e.findIndex((e=>e===t))>=0}handleBodyMouseDown(e){if(this.menuElement){let t=!1;const i=e.target.closest(`.${this.menuCssClass}`);(this.menuElement.contains(e.target)||i)&&(t=!0),(this.menuElement!==e.target&&!t&&!e.defaultPrevented||"close"===e.target.className&&i)&&this.closeMenu(e,{cell:this._currentCell,row:this._currentRow,grid:this.grid})}}handleCloseButtonClicked(e){e.defaultPrevented||this.closeMenu(e,{cell:0,row:0,grid:this.grid})}handleMenuItemMouseOver(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;void 0===i?.[t]||"divider"===i||i.disabled||i.divider||(i.commandItems||i.optionItems?(this.repositionSubMenu(i,t,n,e),this._lastMenuTypeClicked=t):0===n&&this.disposeSubMenus())}handleMenuItemCommandClick(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(void 0!==i?.[t]&&"divider"!==i&&!i.disabled&&!i.divider&&void 0!==this._currentCell&&void 0!==this._currentRow){if("option"===t&&!this.grid.getEditorLock().commitCurrentEdit())return;const s=this._currentCell,r=this._currentRow,o=this.grid.getColumns()[this._currentCell],a=this.grid.getDataItem(this._currentRow),l=void 0!==i[t]?i[t]:"";if(void 0===l||i[`${t}Items`])(i.commandItems||i.optionItems)&&this.repositionSubMenu(i,t,n,e);else{const n={cell:this._currentCell,row:this._currentRow,grid:this.grid,[t]:l,item:i,column:o,dataContext:a},d="command"===t?"onCommand":"onOptionSelected",c=`${this._camelPluginName}:${d}`;this.pubSubService.publish(c,n),"function"===typeof this._addonOptions?.[d]&&this._addonOptions[d](e,n),"function"===typeof i.action&&i.action.call(this,e,n),e.defaultPrevented||this.closeMenu(e,{cell:s,row:r,grid:this.grid})}this._lastMenuTypeClicked=t}}populateCommandOrOptionCloseBtn(e,t,i){this._bindEventService.bind(t,"click",(e=>this.handleCloseButtonClicked(e)),void 0,"parent-menu");const n=i.querySelector(`.slick-${e}-header`)??Q("div",{className:`slick-${e}-header`});n?.appendChild(t),i.appendChild(n),n.classList.add("with-close")}repositionSubMenu(e,t,i,n){(n.target.classList.contains("slick-cell")||this._lastMenuTypeClicked!==t)&&this.disposeSubMenus();const s=this.createMenu(e?.commandItems||[],e?.optionItems||[],i+1,e);s&&(s.style.display="block",document.body.appendChild(s),this.repositionMenu(n,s))}repositionMenu(e,t){const i=t?.classList.contains("slick-submenu"),n=i?e.target.closest(`.${this._menuCssPrefix}-item`):e.target.closest(".slick-cell");if(t&&n){t.style.top="0px",t.style.left="0px";const s=e?.touches?.[0]??e,r=ne(n);let o=n&&"cellMenu"===this._camelPluginName?r.left:s.pageX,a=n&&"cellMenu"===this._camelPluginName?r.top:s.pageY;i&&"contextMenu"===this._camelPluginName&&(o=r.left,a=r.top);const l=n.offsetWidth||0,d=t?.offsetHeight||0,c=t?.offsetWidth||this._addonOptions.width||0,h=this.gridOptions.rowHeight||0,u=Number(this._addonOptions.autoAdjustDropOffset||0),p=Number(this._addonOptions.autoAlignSideOffset||0);if(this._addonOptions.autoAdjustDrop||this._addonOptions.dropDirection){const{bottom:e,top:s}=X(n),r=e+u-h;"top"===(rr?"top":"bottom")||"top"===this._addonOptions.dropDirection?(t.classList.remove("dropdown"),t.classList.add("dropup"),a-=i?d-u-n.clientHeight:d-u):(t.classList.remove("dropup"),t.classList.add("dropdown"),a+=u,"cellMenu"===this._camelPluginName&&(a+=i?u:h+u))}if(this._addonOptions.autoAlignSide||"left"===this._addonOptions.dropSide){const e=this.grid.getGridPosition();let s=o+Number(c);i&&(s+=n.clientWidth);const r=document.documentElement.clientWidth;"left"===(s>=e.width||s>=r?"left":"right")||!i&&"left"===this._addonOptions.dropSide?(t.classList.remove("dropright"),t.classList.add("dropleft"),"cellMenu"!==this._camelPluginName||i?o-=Number(c)-p:o-=Number(c)-l-p):(t.classList.remove("dropleft"),t.classList.add("dropright"),o+=i?p+n.offsetWidth:p)}t.style.top=`${a}px`,t.style.left=`${o}px`}}}class no extends io{constructor(e,t,i){super(e,t,i),this.extensionUtility=e,this.pubSubService=t,this.sharedService=i,this.pluginName="CellMenu",this._defaults={autoAdjustDrop:!0,autoAlignSide:!0,autoAdjustDropOffset:0,autoAlignSideOffset:0,hideMenuOnScroll:!0,subMenuOpenByEvent:"mouseover"},this._camelPluginName="cellMenu",this._menuCssPrefix="slick-menu",this._menuPluginCssPrefix="slick-cell-menu",this.init(i.gridOptions.cellMenu)}init(e){this._addonOptions={...this._defaults,...e},this.sortMenuItems(this.sharedService.allColumns),this._eventHandler.subscribe(this.grid.onClick,this.handleCellClick.bind(this)),this._addonOptions.hideMenuOnScroll&&this._eventHandler.subscribe(this.grid.onScroll,this.closeMenu.bind(this))}translateCellMenu(){const e=this.sharedService?.gridOptions,t=this.sharedService.allColumns;e?.enableTranslate&&Array.isArray(t)&&t.forEach((e=>{if(e?.cellMenu&&(Array.isArray(e.cellMenu.commandItems)||Array.isArray(e.cellMenu.optionItems))){const t=e.cellMenu.commandItems||[],i=e.cellMenu.optionItems||[];e.cellMenu.commandTitleKey&&(e.cellMenu.commandTitle=this.extensionUtility.translateWhenEnabledAndServiceExist(e.cellMenu.commandTitleKey,"TEXT_COMMANDS")||e.cellMenu.commandTitle),e.cellMenu.optionTitleKey&&(e.cellMenu.optionTitle=this.extensionUtility.translateWhenEnabledAndServiceExist(e.cellMenu.optionTitleKey,"TEXT_COMMANDS")||e.cellMenu.optionTitle),this.extensionUtility.translateMenuItemsFromTitleKey(t,"commandItems"),this.extensionUtility.translateMenuItemsFromTitleKey(i,"optionItems")}}))}handleCellClick(e,t){this.disposeAllMenus();const i=this.grid.getCellFromEvent(e);if(i){const n=this.grid.getDataItem(i.row),s=this.grid.getColumns()[i.cell];s?.cellMenu&&!this.gridOptions.cellMenu?.activateCellOnMenuClick&&e.preventDefault(),this._addonOptions={...this._addonOptions,...s.cellMenu};const r=t||{};if(r.column=s,r.dataContext=n,r.grid=this.grid,!this.extensionUtility.runOverrideFunctionWhenExists(this._addonOptions.menuUsabilityOverride,r))return;this._menuElm=this.createParentMenu(e),this._menuElm&&(this.repositionMenu(e,this._menuElm),this._menuElm.ariaExpanded="true",this._menuElm.style.display="block",this.gridOptions.darkMode&&this._menuElm.classList.add("slick-dark-mode")),this._bindEventService.bind(document.body,"mousedown",this.handleBodyMouseDown.bind(this))}}sortMenuItems(e){e.forEach((e=>{e?.cellMenu?.commandItems&&this.extensionUtility.sortItems(e.cellMenu.commandItems||[],"positionOrder"),e?.cellMenu?.optionItems&&this.extensionUtility.sortItems(e.cellMenu.optionItems||[],"positionOrder")}))}}class so{constructor(e,t){this.grid=e,this.pluginName="CellRangeDecorator",this._defaults={selectionCssClass:"slick-range-decorator",selectionCss:{border:"2px dashed red",zIndex:"9999"},offset:{top:-1,left:-1,height:-2,width:-2}},this._options=xe(this._defaults,t)}get addonOptions(){return this._options}get addonElement(){return this._elem}destroy(){this.hide()}init(){}hide(){this._elem?.remove(),this._elem=null}show(e){this._elem||(this._elem=Q("div",{className:this._options.selectionCssClass}),Object.keys(this._options.selectionCss).forEach((e=>{this._elem.style[e]=this._options.selectionCss[e]})),this._elem.style.position="absolute",this.grid.getActiveCanvasNode()?.appendChild(this._elem));const t=this.grid.getCellNodeBox(e.fromRow,e.fromCell),i=this.grid.getCellNodeBox(e.toRow,e.toCell);return t&&i&&this._options?.offset&&(this._elem.style.top=`${t.top+this._options.offset.top}px`,this._elem.style.left=`${t.left+this._options.offset.left}px`,this._elem.style.height=`${i.bottom-t.top+this._options.offset.height}px`,this._elem.style.width=`${i.right-t.left+this._options.offset.width}px`),this._elem}}class ro{constructor(e){this.pluginName="CellRangeSelector",this._currentlySelectedRange=null,this._canvas=null,this._dragging=!1,this._gridUid="",this._columnOffset=0,this._rowOffset=0,this._isRightCanvas=!1,this._isBottomCanvas=!1,this._xDelayForNextCell=0,this._yDelayForNextCell=0,this._viewportHeight=0,this._viewportWidth=0,this._isRowMoveRegistered=!1,this._scrollLeft=0,this._scrollTop=0,this._defaults={autoScroll:!0,minIntervalToShowNextCell:30,maxIntervalToShowNextCell:600,accelerateInterval:5,selectionCss:{border:"2px dashed blue"}},this.onBeforeCellRangeSelected=new ti("onBeforeCellRangeSelected"),this.onCellRangeSelecting=new ti("onCellRangeSelecting"),this.onCellRangeSelected=new ti("onCellRangeSelected"),this._eventHandler=new ii,this._options=xe(this._defaults,e)}get addonOptions(){return this._options}get eventHandler(){return this._eventHandler}get gridUid(){return this._gridUid||(this._grid?.getUID()??"")}get gridUidSelector(){return this.gridUid?`.${this.gridUid}`:""}init(e){this._grid=e,this._decorator=this._options.cellDecorator||new so(e,this._options),this._canvas=e.getCanvasNode(),this._gridOptions=e.getOptions(),this._gridUid=e.getUID();const t=e.getPubSubService();t&&ai.addSlickEventPubSubWhenDefined(t,this),this._eventHandler.subscribe(this._grid.onDrag,this.handleDrag.bind(this)).subscribe(this._grid.onDragInit,this.handleDragInit.bind(this)).subscribe(this._grid.onDragStart,this.handleDragStart.bind(this)).subscribe(this._grid.onDragEnd,this.handleDragEnd.bind(this)).subscribe(this._grid.onScroll,this.handleScroll.bind(this))}destroy(){this.dispose()}dispose(){this._eventHandler?.unsubscribeAll(),ee(this._activeCanvas),ee(this._canvas),this._decorator?.destroy(),this.stopIntervalTimer()}getCellDecorator(){return this._decorator}getCurrentRange(){return this._currentlySelectedRange}getMouseOffsetViewport(e,t){const i=e?.touches?.[0]??e,n=this._activeViewport.scrollLeft,s=this._activeViewport.scrollTop,r=n+this._viewportWidth,o=s+this._viewportHeight,a=ne(this._activeViewport),l=a.left,d=a.top,c=l+this._viewportWidth,h=d+this._viewportHeight,u={e:e,dd:t,viewport:{left:n,top:s,right:r,bottom:o,offset:{left:l,top:d,right:c,bottom:h}},offset:{x:0,y:0},isOutsideViewport:!1};return i.pageXc&&(u.offset.x=i.pageX-c),i.pageYh&&(u.offset.y=h-i.pageY),u.isOutsideViewport=!!u.offset.x||!!u.offset.y,u}stopIntervalTimer(){this._autoScrollTimerId&&(window.clearInterval(this._autoScrollTimerId),this._autoScrollTimerId=void 0)}handleDrag(e,t){if(!this._dragging&&!this._gridOptions.enableRowMoveManager)return;this._gridOptions.enableRowMoveManager||e.stopImmediatePropagation();const i=e.getNativeEvent();if(this.addonOptions.autoScroll&&(this._draggingMouseOffset=this.getMouseOffsetViewport(i,t),this._draggingMouseOffset.isOutsideViewport))return this.handleDragOutsideViewport();this.stopIntervalTimer(),this.handleDragTo(i,t)}handleDragOutsideViewport(){if(this._xDelayForNextCell=this.addonOptions.maxIntervalToShowNextCell-Math.abs(this._draggingMouseOffset.offset.x)*this.addonOptions.accelerateInterval,this._yDelayForNextCell=this.addonOptions.maxIntervalToShowNextCell-Math.abs(this._draggingMouseOffset.offset.y)*this.addonOptions.accelerateInterval,!this._autoScrollTimerId){let e=0,t=0;this._autoScrollTimerId=window.setInterval((()=>{let i=!1,n=!1;this._draggingMouseOffset.offset.x?(e+=this.addonOptions.minIntervalToShowNextCell,i=e>=this._xDelayForNextCell):e=0,this._draggingMouseOffset.offset.y?(t+=this.addonOptions.minIntervalToShowNextCell,n=t>=this._yDelayForNextCell):t=0,(i||n)&&(i&&(e=0),n&&(t=0),this.handleDragToNewPosition(i,n))}),this.addonOptions.minIntervalToShowNextCell)}}handleDragToNewPosition(e,t){let i=this._draggingMouseOffset.e.pageX,n=this._draggingMouseOffset.e.pageY;const s=this._draggingMouseOffset.offset.x,r=this._draggingMouseOffset.offset.y,o=this._draggingMouseOffset.viewport.offset;e&&s&&(i=s>0?o.right+this._moveDistanceForOneCell.x:o.left-this._moveDistanceForOneCell.x),t&&r&&(n=r>0?o.top-this._moveDistanceForOneCell.y:o.bottom+this._moveDistanceForOneCell.y),this.handleDragTo({pageX:i,pageY:n},this._draggingMouseOffset.dd)}handleDragTo(e,t){const i=e?.touches?.[0]??e,n=this._grid.getCellFromPoint(i.pageX-ne(this._activeCanvas).left+this._columnOffset,i.pageY-ne(this._activeCanvas).top+this._rowOffset);if(void 0!==n){if(this._gridOptions.frozenColumn>=0&&(!this._isRightCanvas&&n.cell>this._gridOptions.frozenColumn||this._isRightCanvas&&n.cell<=this._gridOptions.frozenColumn))return;if(this._gridOptions.frozenRow>=0&&(!this._isBottomCanvas&&n.row>=this._gridOptions.frozenRow||this._isBottomCanvas&&n.rowt.right||e.topt.bottom)&&this._grid.scrollCellIntoView(n.row,n.cell)}}if(!this._grid.canCellBeSelected(n.row,n.cell))return;if(t?.range){t.range.end=n;const e=new ni(t.range.start.row??0,t.range.start.cell??0,n.row,n.cell);this._decorator.show(e),this.onCellRangeSelecting.notify({range:e})}}}handleDragEnd(e,t){this._decorator.hide(),this._dragging&&(this._dragging=!1,e.stopImmediatePropagation(),this.stopIntervalTimer(),this.onCellRangeSelected.notify({range:new ni(t.range.start.row??0,t.range.start.cell??0,t.range.end.row,t.range.end.cell)}))}handleDragInit(e){this._activeCanvas=this._grid.getActiveCanvasNode(e),this._activeViewport=this._grid.getActiveViewportNode(e);const t=this._grid.getDisplayedScrollbarDimensions();if(this._viewportWidth=this._activeViewport.offsetWidth-t.width,this._viewportHeight=this._activeViewport.offsetHeight-t.height,this._moveDistanceForOneCell={x:this._grid.getAbsoluteColumnMinWidth()/2,y:this._gridOptions.rowHeight/2},this._rowOffset=0,this._columnOffset=0,this._isBottomCanvas=this._activeCanvas.classList.contains("grid-canvas-bottom"),this._gridOptions.frozenRow>-1&&this._isBottomCanvas){const e=`${this.gridUidSelector} .grid-canvas-${this._gridOptions.frozenBottom?"bottom":"top"}`;this._rowOffset=document.querySelector(e)?.clientHeight??0}this._isRightCanvas=this._activeCanvas.classList.contains("grid-canvas-right"),this._gridOptions.frozenColumn>-1&&this._isRightCanvas&&(this._columnOffset=document.querySelector(`${this.gridUidSelector} .grid-canvas-left`)?.clientWidth??0);const i=this._grid.getCellFromEvent(e),n=this._grid.getActiveCell();this._grid.getEditorLock().isActive()&&n&&i&&n.row===i.row&&n.cell===i.cell||(e.stopImmediatePropagation(),e.preventDefault())}handleDragStart(e,t){const i=this._grid.getCellFromEvent(e);if(i&&!1!==this.onBeforeCellRangeSelected.notify(i).getReturnValue()&&this._grid.canCellBeSelected(i.row,i.cell)&&(this._dragging=!0,e.stopImmediatePropagation()),!this._dragging)return;this._grid.focus();const n=ne(this._canvas);let s=t.startX-n.left;this._gridOptions.frozenColumn>=0&&this._isRightCanvas&&(s+=this._scrollLeft);let r=t.startY-n.top;this._gridOptions.frozenRow>=0&&this._isBottomCanvas&&(r+=this._scrollTop);const o=this._grid.getCellFromPoint(s,r);return t.range={start:o,end:{}},this._currentlySelectedRange=t.range,this._decorator.show(new ni(o.row,o.cell))}handleScroll(e,t){this._scrollTop=t.scrollTop,this._scrollLeft=t.scrollLeft}}class oo{constructor(e){this.pluginName="CellSelectionModel",this._cachedPageRowCount=0,this._prevKeyDown="",this._ranges=[],this._defaults={selectActiveCell:!0},this.onSelectedRangesChanged=new ti("onSelectedRangesChanged"),this._eventHandler=new ii,this._selector=void 0===e||void 0===e.cellRangeSelector?new ro({selectionCss:{border:"2px solid black"}}):e.cellRangeSelector,this._addonOptions=e}get addonOptions(){return this._addonOptions}get cellRangeSelector(){return this._selector}get eventHandler(){return this._eventHandler}init(e){this._grid=e,void 0!==this._addonOptions&&void 0!==this._addonOptions.cellRangeSelector||(this._selector=new ro({selectionCss:{border:"2px solid "+(this._grid.getOptions().darkMode?"white":"black")}})),e.hasDataView()&&(this._dataView=e.getData()),this._addonOptions={...this._defaults,...this._addonOptions};const t=e.getPubSubService();t&&this.onSelectedRangesChanged.setPubSubService(t),this._eventHandler.subscribe(this._grid.onActiveCellChanged,this.handleActiveCellChange.bind(this)).subscribe(this._grid.onKeyDown,this.handleKeyDown.bind(this)).subscribe(this._selector.onBeforeCellRangeSelected,this.handleBeforeCellRangeSelected.bind(this)).subscribe(this._selector.onCellRangeSelected,this.handleCellRangeSelected.bind(this)),e.registerPlugin(this._selector)}destroy(){this.dispose()}dispose(){this._selector&&(this._selector.onBeforeCellRangeSelected.unsubscribe(this.handleBeforeCellRangeSelected.bind(this)),this._selector.onCellRangeSelected.unsubscribe(this.handleCellRangeSelected.bind(this))),this._eventHandler.unsubscribeAll(),this._grid?.unregisterPlugin(this._selector),this._selector?.dispose()}getSelectedRanges(){return this._ranges}rangesAreEqual(e,t){let i=e.length!==t.length;if(!i)for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:"SlickCellSelectionModel.setSelectedRanges";if((!this._ranges||0===this._ranges.length)&&(!e||0===e.length))return;const i=!this.rangesAreEqual(this._ranges,e);if(this._ranges=this.removeInvalidRanges(e),i){const e=new ei(new CustomEvent("click",{detail:{caller:t}}),this._ranges);this.onSelectedRangesChanged.notify(this._ranges,e)}}handleActiveCellChange(e,t){this._prevSelectedRow=void 0;const i=Re(t.cell),n=Re(t.row);this._addonOptions?.selectActiveCell&&n&&i?this.setSelectedRanges([new ni(t.row,t.cell)]):this._addonOptions?.selectActiveCell&&(n||i)||this.setSelectedRanges([])}handleBeforeCellRangeSelected(e){const t=this._grid.getCellFromEvent(e),i=this._grid.getActiveCell();if(this._grid.getEditorLock().isActive()&&i&&t&&i.row===t.row&&i.cell===t.cell)return e.stopPropagation(),!1}handleCellRangeSelected(e,t){this._grid.setActiveCell(t.range.fromRow,t.range.fromCell,!1,!1,!0),this.setSelectedRanges([t.range])}isKeyAllowed(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","PageDown","PageUp","Home","End","a","A"].some((t=>t===e))}handleKeyDown(e){let t,i;const n=this._grid.getColumns().length,s=this._grid.getActiveCell();let r=0;if(r=this._dataView&&"getPagingInfo"in this._dataView?this._dataView?.getPagingInfo().pageSize||this._dataView.getLength():this._grid.getDataLength(),s&&(e.shiftKey||e.ctrlKey)&&!e.altKey&&this.isKeyAllowed(e.key)&&(t=this.getSelectedRanges().slice(),t.length||t.push(new ni(s.row,s.cell)),i=t.pop(),"function"===typeof i?.contains)){i.contains(s.row,s.cell)||(i=new ni(s.row,s.cell));let o,a=i.toRow-i.fromRow,l=i.toCell-i.fromCell,d=0;e.ctrlKey&&"a"===e.key?.toLowerCase()&&(this._grid.setActiveCell(0,0,!1,!1,!0),s.row=0,s.cell=0,o=n-1,d=r-1);const c=s.row===i.fromRow?1:-1,h=s.cell===i.fromCell?1:-1,u=e.key.startsWith("Arrow");u&&!e.ctrlKey?("ArrowLeft"===e.key?l-=h:"ArrowRight"===e.key?l+=h:"ArrowUp"===e.key?a-=c:"ArrowDown"===e.key&&(a+=c),d=s.row+c*a):(this._cachedPageRowCount<1&&(this._cachedPageRowCount=this._grid.getViewportRowCount()),void 0===this._prevSelectedRow&&(this._prevSelectedRow=s.row),!e.ctrlKey&&e.shiftKey&&"Home"===e.key||e.ctrlKey&&e.shiftKey&&"ArrowLeft"===e.key?(o=0,d=s.row):!e.ctrlKey&&e.shiftKey&&"End"===e.key||e.ctrlKey&&e.shiftKey&&"ArrowRight"===e.key?(o=n-1,d=s.row):e.ctrlKey&&e.shiftKey&&"ArrowUp"===e.key?d=0:e.ctrlKey&&e.shiftKey&&"ArrowDown"===e.key?d=r-1:e.ctrlKey&&e.shiftKey&&"Home"===e.key?(o=0,d=0):e.ctrlKey&&e.shiftKey&&"End"===e.key?(o=n-1,d=r-1):"PageUp"===e.key?(this._prevSelectedRow>=0&&(d=this._prevSelectedRow-this._cachedPageRowCount),d<0&&(d=0)):"PageDown"===e.key&&(this._prevSelectedRow<=r-1&&(d=this._prevSelectedRow+this._cachedPageRowCount),d>r-1&&(d=r-1)),this._prevSelectedRow=d),o??=s.cell+h*l;const p=new ni(s.row,s.cell,d,o);if(this.removeInvalidRanges([p]).length){t.push(p);const e=c>0?p.toRow:p.fromRow,i=h>0?p.toCell:p.fromCell;u?(this._grid.scrollRowIntoView(e),this._grid.scrollCellIntoView(e,i,!1)):(this._grid.scrollRowIntoView(d),this._grid.scrollCellIntoView(d,i,!1))}else t.push(i);this.setSelectedRanges(t),e.preventDefault(),e.stopPropagation(),this._prevKeyDown=e.key}}}class ao{constructor(e){this.pluginName="RowSelectionModel",this._inHandler=!1,this._ranges=[],this._defaults={autoScrollWhenDrag:!0,cellRangeSelector:void 0,dragToSelect:!1,selectActiveRow:!0},this.onSelectedRangesChanged=new ti("onSelectedRangesChanged"),this._eventHandler=new ii,this._options={...this._defaults,...e}}get addonOptions(){return this._options}get eventHandler(){return this._eventHandler}get gridOptions(){return this._grid?.getOptions()}init(e){this._grid=e,this._options={...this._defaults,...this._options},this._selector=this.addonOptions.cellRangeSelector;const t=e.getPubSubService();t&&this.onSelectedRangesChanged.setPubSubService(t),!this._selector&&this._options.dragToSelect&&(this._selector=new ro({selectionCss:{border:"none"},autoScroll:this._options.autoScrollWhenDrag}),this.addonOptions.cellRangeSelector=this._selector),this._eventHandler.subscribe(this._grid.onActiveCellChanged,this.handleActiveCellChange.bind(this)).subscribe(this._grid.onClick,this.handleClick.bind(this)).subscribe(this._grid.onKeyDown,this.handleKeyDown.bind(this)),this._selector&&(this._grid.registerPlugin(this._selector),this._selector.onCellRangeSelecting.subscribe(this.handleCellRangeSelected.bind(this)),this._selector.onCellRangeSelected.subscribe(this.handleCellRangeSelected.bind(this)),this._selector.onBeforeCellRangeSelected.subscribe(this.handleBeforeCellRangeSelected.bind(this)))}destroy(){this.dispose()}dispose(){this._eventHandler.unsubscribeAll(),this.disposeSelector()}disposeSelector(){this._selector&&(this._selector.onCellRangeSelecting.unsubscribe(this.handleCellRangeSelected.bind(this)),this._selector.onCellRangeSelected.unsubscribe(this.handleCellRangeSelected.bind(this)),this._selector.onBeforeCellRangeSelected.unsubscribe(this.handleBeforeCellRangeSelected.bind(this)),this._grid.unregisterPlugin(this._selector),this._selector?.destroy(),this._selector?.dispose())}getCellRangeSelector(){return this._selector}getSelectedRanges(){return this._ranges}getSelectedRows(){return this.rangesToRows(this._ranges)}refreshSelections(){this.setSelectedRows(this.getSelectedRows())}setSelectedRows(e){this.setSelectedRanges(this.rowsToRanges(e),"SlickRowSelectionModel.setSelectedRows")}setSelectedRanges(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"SlickRowSelectionModel.setSelectedRanges";if((!this._ranges||0===this._ranges.length)&&(!e||0===e.length))return;this._ranges=e;const i=new ei(new CustomEvent("click",{detail:{caller:t}}),this._ranges);this.onSelectedRangesChanged.notify(this._ranges,i)}getRowsRange(e,t){let i;const n=[];for(i=e;i<=t;i++)n.push(i);for(i=t;ie!==t.row)),this._grid.setActiveCell(t.row,t.cell);else if(i.length&&e.shiftKey){const e=i.pop(),n=Math.min(t.row,e),s=Math.max(t.row,e);i=[];for(let t=n;t<=s;t++)t!==e&&i.push(t);i.push(e),this._grid.setActiveCell(t.row,t.cell)}const s=this.rowsToRanges(i);return this.setSelectedRanges(s),e.stopImmediatePropagation(),!0}handleKeyDown(e){const t=this._grid.getActiveCell();if(this.gridOptions.multiSelect&&t&&e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&("ArrowUp"===e.key||"ArrowDown"===e.key)){let i,n=this.getSelectedRows();n.sort(((e,t)=>e-t)),n.length||(n=[t.row]);let s=n[0],r=n[n.length-1];if(i="ArrowDown"===e.key?t.row=0&&it.push(new ni(e,0,e,i)))),t}}const lo="mdi-icon-check",co="mdi-icon-uncheck";class ho{constructor(e,t){this.pubSubService=e,this.pluginName="CheckboxSelectColumn",this._defaults={columnId:"_checkbox_selector",cssClass:null,field:"_checkbox_selector",hideSelectAllCheckbox:!1,name:"",toolTip:"Select/Deselect All",width:30,reorderable:!1,applySelectOnAllPages:!0,hideInColumnTitleRow:!1,hideInFilterHeaderRow:!0},this._addonOptions=this._defaults,this._checkboxColumnCellIndex=null,this._isSelectAllChecked=!1,this._isUsingDataView=!1,this._selectedRowsLookup={},this._selectAll_UID=this.createUID(),this._bindEventService=new Vt,this._eventHandler=new ii,this._addonOptions={...this._defaults,...t}}get addonOptions(){return this._addonOptions}get headerRowNode(){return this._headerRowNode}get gridOptions(){return this._grid?.getOptions()??{}}get selectAllUid(){return this._selectAll_UID}set selectedRowsLookup(e){this._selectedRowsLookup=e}init(e){this._grid=e,this._isUsingDataView=!Array.isArray(e.getData()),this._isUsingDataView&&(this._dataView=e.getData()),this.gridOptions.backendServiceApi&&(this._addonOptions.applySelectOnAllPages=!1),this._eventHandler.subscribe(e.onSelectedRowsChanged,this.handleSelectedRowsChanged.bind(this)).subscribe(e.onClick,this.handleClick.bind(this)).subscribe(e.onKeyDown,this.handleKeyDown.bind(this)),this._isUsingDataView&&this._dataView&&(this._eventHandler.subscribe(e.onAfterSetColumns,this.handleDataViewSelectedIdsChanged.bind(this)),this._addonOptions.applySelectOnAllPages&&this._eventHandler.subscribe(this._dataView.onSelectedRowIdsChanged,this.handleDataViewSelectedIdsChanged.bind(this)).subscribe(this._dataView.onPagingInfoChanged,this.handleDataViewSelectedIdsChanged.bind(this))),this._addonOptions.hideInFilterHeaderRow||this.addCheckboxToFilterHeaderRow(e),this._addonOptions.hideInColumnTitleRow||this._eventHandler.subscribe(this._grid.onHeaderClick,this.handleHeaderClick.bind(this)),this._rowSelectionModel&&this._grid.getSelectionModel()||(this._rowSelectionModel=new ao(this.gridOptions.rowSelectionOptions),this._grid.setSelectionModel(this._rowSelectionModel)),this.gridOptions.preselectedRows&&this._rowSelectionModel&&this._grid.getSelectionModel()&&window.setTimeout((()=>this.selectRows(this.gridOptions.preselectedRows||[]))),"function"===typeof this._addonOptions.selectableOverride&&this.selectableOverride(this._addonOptions.selectableOverride)}dispose(){this._bindEventService.unbindAll(),this._eventHandler.unsubscribeAll()}create(e,t){if(this._addonOptions={...this._defaults,...t.checkboxSelector},Array.isArray(e)&&t){const i=this.getColumnDefinition();if(!e.some((e=>e.id===i.id))){const n=t?.checkboxSelector?.columnIndexPosition??0;n>0?e.splice(n,0,i):e.unshift(i),this.pubSubService.publish("onPluginColumnsChanged",{columns:e,pluginName:this.pluginName})}}return this}getOptions(){return this._addonOptions}setOptions(e){if(this._addonOptions={...this._addonOptions,...e},this._addonOptions.hideSelectAllCheckbox)this.hideSelectAllFromColumnHeaderTitleRow(),this.hideSelectAllFromColumnHeaderFilterRow();else if(this._addonOptions.hideInColumnTitleRow?(this.hideSelectAllFromColumnHeaderTitleRow(),this._addonOptions.name&&this._grid.updateColumnHeader(this._addonOptions.columnId||"",this._addonOptions.name,"")):(this.renderSelectAllCheckbox(this._isSelectAllChecked),this._eventHandler.subscribe(this._grid.onHeaderClick,this.handleHeaderClick.bind(this))),this._addonOptions.hideInFilterHeaderRow)this.hideSelectAllFromColumnHeaderFilterRow();else{const e=this.headerRowNode?.querySelector("#filter-checkbox-selectall-container");if(e){e.style.display="flex",e.ariaChecked=String(this._isSelectAllChecked);const t=e.querySelector('input[type="checkbox"]');t&&(t.ariaChecked=String(this._isSelectAllChecked),t.checked=this._isSelectAllChecked)}}}deSelectRows(e){const t=[];for(const i of e)this._selectedRowsLookup[i]&&(t[t.length]=i);this._grid.setSelectedRows(this._grid.getSelectedRows().filter((e=>t.indexOf(e)<0)),"SlickCheckboxSelectColumn.deSelectRows")}selectRows(e){const t=[];for(const n of e)this._selectedRowsLookup[n]&&(t[t.length]=n);const i=this._grid.getSelectedRows()?.concat(t);this._grid.setSelectedRows(i)}createCheckboxElement(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.gridOptions?.preventDocumentFragmentUsage?document.createElement("span"):new DocumentFragment,n=Q("label",{className:"checkbox-selector-label",htmlFor:e}),s=Q("div",{className:"icon-checkbox-container"});return s.appendChild(Q("input",{id:e,type:"checkbox",checked:t,ariaChecked:String(t)})),s.appendChild(Q("div",{className:`mdi ${t?lo:co}`})),n.appendChild(s),i.appendChild(n),i}getColumnDefinition(){const e=String(this._addonOptions?.columnId??this._defaults.columnId);return{id:e,name:this._addonOptions.hideSelectAllCheckbox||this._addonOptions.hideInColumnTitleRow?this._addonOptions.name||"":this.createCheckboxElement(`header-selector${this._selectAll_UID}`),toolTip:this._addonOptions.hideSelectAllCheckbox||this._addonOptions.hideInColumnTitleRow?"":this._addonOptions.toolTip,field:e,cssClass:this._addonOptions.cssClass,excludeFromExport:!0,excludeFromColumnPicker:!0,excludeFromGridMenu:!0,excludeFromQuery:!0,excludeFromHeaderMenu:!0,hideSelectAllCheckbox:this._addonOptions.hideSelectAllCheckbox,resizable:!1,reorderable:this._addonOptions.reorderable,sortable:!1,width:this._addonOptions.width||30,maxWidth:this._addonOptions.width||30,formatter:this.checkboxSelectionFormatter.bind(this)}}hideSelectAllFromColumnHeaderTitleRow(){this._grid.updateColumnHeader(this._addonOptions.columnId||"",this._addonOptions.name||"","")}hideSelectAllFromColumnHeaderFilterRow(){const e=this.headerRowNode?.querySelector("#filter-checkbox-selectall-container");e&&(e.style.display="none")}toggleRowSelection(e){this.toggleRowSelectionWithEvent(null,e)}toggleRowSelectionWithEvent(e,t){const i=this._grid.getDataItem(t);if(!this.checkSelectableOverride(t,i,this._grid))return;const n=this._grid.getSelectedRows();"function"===typeof this._addonOptions.onRowToggleStart&&this._addonOptions.onRowToggleStart(e,{row:t,previousSelectedRows:n});const s=this._selectedRowsLookup[t]?this._grid.getSelectedRows().filter((e=>e!==t)):this._grid.getSelectedRows().concat(t);this._grid.setSelectedRows(s,"click.toggle"),this._grid.setActiveCell(t,this.getCheckboxColumnCellIndex()),this._addonOptions.onRowToggleEnd&&this._addonOptions.onRowToggleEnd(e,{row:t,previousSelectedRows:n})}selectableOverride(e){this._selectableOverride=e}addCheckboxToFilterHeaderRow(e){this._eventHandler.subscribe(e.onHeaderRowCellRendered,((e,t)=>{if(t.column.field===(this._addonOptions.field||"_checkbox_selector")){ee(t.node);const e=`header-filter-selector${this._selectAll_UID}`,i=Q("label",{id:"filter-checkbox-selectall-container",htmlFor:e}),n=Q("div",{className:"icon-checkbox-container"});n.appendChild(Q("input",{id:e,type:"checkbox",ariaChecked:"false"})),n.appendChild(Q("div",{className:"mdi mdi-icon-uncheck"})),i.appendChild(n),t.node.appendChild(i),this._headerRowNode=t.node,this._headerRowNode.classList.add("checkbox-header"),this._bindEventService.bind(i,"click",(e=>this.handleHeaderClick(e,t)))}}))}checkboxSelectionFormatter(e,t,i,n,s,r){if(s&&this.checkSelectableOverride(e,s,r)){const t=this.createUID()+e;return this.createCheckboxElement(`selector${t}`,!!this._selectedRowsLookup[e])}return null}checkSelectableOverride(e,t,i){return"function"!==typeof this._selectableOverride||this._selectableOverride(e,t,i)}createUID(){return Math.round(1e7*Math.random())}getCheckboxColumnCellIndex(){if(null===this._checkboxColumnCellIndex){this._checkboxColumnCellIndex=0;const e=this._grid.getColumns();for(let t=0;t0)for(let n=0;ne[s]===r))>=0&&!this.checkSelectableOverride(n,e,this._grid)&&i++}if(this._isSelectAllChecked=e.length+i>=t.length,this._addonOptions.hideInColumnTitleRow||this._addonOptions.hideSelectAllCheckbox||this.renderSelectAllCheckbox(this._isSelectAllChecked),!this._addonOptions.hideInFilterHeaderRow){const e=this.headerRowNode?.querySelector(`#header-filter-selector${this._selectAll_UID}`),t=this.headerRowNode?.querySelector(".icon-checkbox-container .mdi");e&&(e.ariaChecked=String(this._isSelectAllChecked),e.checked=this._isSelectAllChecked),t&&(t.className=`mdi ${this._isSelectAllChecked?lo:co}`)}}handleClick(e,t){if(this._grid.getColumns()[t.cell].id===this._addonOptions.columnId&&"checkbox"===e.target.type){if(e.target.ariaChecked=String(e.target.checked),this._grid.getEditorLock().isActive()&&!this._grid.getEditorLock().commitCurrentEdit())return e.preventDefault(),void e.stopImmediatePropagation();this.toggleRowSelectionWithEvent(e,t.row),e.stopPropagation(),e.stopImmediatePropagation()}}handleHeaderClick(e,t){if(t.column.id===this._addonOptions.columnId&&"checkbox"===e.target.type){if(e.target.ariaChecked=String(e.target.checked),this._grid.getEditorLock().isActive()&&!this._grid.getEditorLock().commitCurrentEdit())return e.preventDefault(),void e.stopImmediatePropagation();let t=e.target.checked;const i=t?"click.selectAll":"click.unselectAll",n=this._grid.getSelectedRows();this._addonOptions.onSelectAllToggleStart&&this._addonOptions.onSelectAllToggleStart(e,{previousSelectedRows:n,caller:i});let s=[];if(t){const e=[];for(let t=0;t{void 0!==e&&this._grid.invalidateRow(+e)})),this._selectedRowsLookup=t,this._grid.render(),this._isSelectAllChecked=(e?.length??0)+r>=this._grid.getDataLength(),(!this._isUsingDataView||!this._addonOptions.applySelectOnAllPages)&&(this._addonOptions.hideInColumnTitleRow||this._addonOptions.hideSelectAllCheckbox||this.renderSelectAllCheckbox(this._isSelectAllChecked),!this._addonOptions.hideInFilterHeaderRow)){const e=this.headerRowNode?.querySelector(`#header-filter-selector${this._selectAll_UID}`);e&&(e.ariaChecked=String(this._isSelectAllChecked),e.checked=this._isSelectAllChecked)}if(o.length>0){for(const t of o){const i=e.indexOf(t);e.splice(i,1)}this._grid.setSelectedRows(e,"click.toggle")}}renderSelectAllCheckbox(e){const t=this._grid.updateColumnHeader(this._addonOptions.columnId||"",this.createCheckboxElement(`header-selector${this._selectAll_UID}`,!!e),this._addonOptions.toolTip);t?.classList.add("header-checkbox-selectall")}}class uo extends to{constructor(e,t,i,n,s){super(e,i,n),this.extensionUtility=e,this.filterService=t,this.pubSubService=i,this.sharedService=n,this.sortService=s,this._areVisibleColumnDifferent=!1,this._columns=[],this._columnCheckboxes=[],this._commandMenuElm=null,this._headerElm=null,this._isMenuOpen=!1,this._subMenuParentId="",this._defaults={dropSide:"left",showButton:!0,hideForceFitButton:!1,hideSyncResizeButton:!1,forceFitTitle:"Force fit columns",marginBottom:15,menuWidth:18,minHeight:150,contentMinWidth:0,resizeOnShowHeaderRow:!1,syncResizeTitle:"Synchronous resize",subMenuOpenByEvent:"mouseover",headerColumnValueExtractor:e=>te(e.columnPickerLabel||e.name||"","innerHTML")},this._menuCssPrefix="slick-menu",this._menuPluginCssPrefix="slick-grid-menu",this._camelPluginName="gridMenu",this._columns=this.sharedService.allColumns??[],this._gridUid=this.grid?.getUID()??"",this.onAfterMenuShow=new ti("onAfterMenuShow"),this.onBeforeMenuShow=new ti("onBeforeMenuShow"),this.onMenuClose=new ti("onMenuClose"),this.onCommand=new ti("onCommand"),this.onColumnsChanged=new ti("onColumnsChanged"),this.initEventHandlers(),this.init()}get addonOptions(){return this._addonOptions||{}}get columns(){return this._columns}set columns(e){this._columns=e}get gridOptions(){return this.grid?.getOptions()||{}}get gridUidSelector(){return this.gridUid?`.${this.gridUid}`:""}initEventHandlers(){this._eventHandler.subscribe(this.grid.onColumnsReordered,So.bind(this)),this._eventHandler.subscribe(this.grid.onClick,(e=>this.hideMenu(e))),this._eventHandler.subscribe(this.grid.onBeforeDestroy,this.dispose.bind(this)),this._eventHandler.subscribe(this.grid.onSetOptions,((e,t)=>{if(t&&t.optionsBefore&&t.optionsAfter){const e=t.optionsBefore.frozenColumn>=0&&-1===t.optionsAfter.frozenColumn,i=-1===t.optionsBefore.frozenColumn&&t.optionsAfter.frozenColumn>=0;(e||i)&&this.recreateGridMenu()}}))}init(){this._gridUid=this.grid.getUID()??"",ai.addSlickEventPubSubWhenDefined(this.pubSubService,this),this._userOriginalGridMenu={...this.sharedService.gridOptions.gridMenu},this._addonOptions={...this._defaults,...this.getDefaultGridMenuOptions(),...this.sharedService.gridOptions.gridMenu},this.sharedService.gridOptions.gridMenu=this._addonOptions;const e=this._userOriginalGridMenu.commandItems,t=this._userOriginalGridMenu&&Array.isArray(e)?e:[];this._addonOptions.commandItems=[...t,...this.addGridMenuCustomCommands(t)],this.extensionUtility.translateMenuItemsFromTitleKey(this._addonOptions.commandItems||[],"commandItems"),this.extensionUtility.sortItems(this._addonOptions.commandItems,"positionOrder"),this.createGridMenu()}dispose(){this.deleteMenu(),super.dispose()}deleteMenu(){this._bindEventService.unbindAll(),this._menuElm?.remove(),this._menuElm=null,this._gridMenuButtonElm?.remove(),this._headerElm&&(this._headerElm.style.width="100%")}createColumnPickerContainer(){this._menuElm&&(fo.call(this,this._menuElm),this._listElm=Q("div",{className:"slick-column-picker-list",role:"menu"}),this._bindEventService.bind(this._menuElm,"click",vo.bind(this),void 0,"parent-menu"))}createGridMenu(){const e=this._gridUid?`.${this._gridUid}`:"",t=this._addonOptions?.menuWidth||this._defaults.menuWidth,i=this.gridOptions.hasOwnProperty("frozenColumn")&&this.gridOptions.frozenColumn>=0?"right":"left",n=this.grid.getContainerNode();if(this._headerElm=n.querySelector(`.slick-header-${i}`),this._headerElm&&this._addonOptions){this._headerElm.style.width=`calc(100% - ${t}px)`;if((this._addonOptions.resizeOnShowHeaderRow??this._defaults.resizeOnShowHeaderRow)&&this.gridOptions.showHeaderRow){const i=n.querySelector(`${e} .slick-headerrow`);i&&(i.style.width=`calc(100% - ${t}px)`)}if(this._addonOptions.showButton??this._defaults.showButton){this._gridMenuButtonElm=Q("button",{className:"slick-grid-menu-button",ariaLabel:"Grid Menu"}),this._addonOptions?.iconCssClass&&this._gridMenuButtonElm.classList.add(...Z(this._addonOptions.iconCssClass));const e="preheader"===this._addonOptions.iconButtonContainer?"firstChild":"lastChild";this._headerElm.parentElement.insertBefore(this._gridMenuButtonElm,this._headerElm.parentElement[e]),this._bindEventService.bind(this._gridMenuButtonElm,"click",this.showGridMenu.bind(this))}this.sharedService.gridOptions.gridMenu={...this._defaults,...this._addonOptions},this.translateTitleLabels(this._addonOptions),this.translateTitleLabels(this.sharedService.gridOptions.gridMenu),this._bindEventService.bind(document.body,"mousedown",this.handleBodyMouseDown.bind(this)),this._bindEventService.bind(document.body,"beforeunload",this.dispose.bind(this))}}createCommandMenu(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;const n=i?.command;let s=1===t&&n?n.replace(/\s/g,""):"";s&&(this._subMenuParentId=s),t>1&&(s=this._subMenuParentId);const r=`${this.menuCssClass} slick-menu-level-${t} ${this._gridUid}`,o=document.body.querySelector(`.${this.menuCssClass}.slick-menu-level-${t}${this.gridUidSelector}`);if(o){if(o.dataset.subMenuParent===s)return o;this.disposeSubMenus()}const a=Q("div",{role:"menu",className:r,ariaLabel:t>1?"SubMenu":"Grid Menu"});t>0&&(a.classList.add("slick-submenu"),s&&(a.dataset.subMenuParent=s));const l={grid:this.grid,menu:this._menuElm,columns:this.columns,allColumns:this.getAllColumns(),visibleColumns:this.getVisibleColumns(),level:t};return this._commandMenuElm=this.recreateCommandList(e,a,l,i),t++,a}getAllColumns(){return this._columns}getVisibleColumns(){return this.grid.getColumns()}hideMenu(e){const t={grid:this.grid,menu:this._menuElm,allColumns:this.columns,visibleColumns:this.getVisibleColumns()};if(this.pubSubService.publish("onGridMenuMenuClose",t),("function"!==typeof this._addonOptions?.onMenuClose||!1!==this._addonOptions.onMenuClose(e,t))&&!1!==this.onMenuClose.notify(t,null,this).getReturnValue()){if(this._isMenuOpen=!1,"function"===typeof this.grid?.autosizeColumns){const e=this.grid.getUID()||"";this._areVisibleColumnDifferent&&e&&null!==document.querySelector(`.${e}`)&&(this.gridOptions.enableAutoSizeColumns&&this.grid.autosizeColumns(),this._areVisibleColumnDifferent=!1)}this.disposeSubMenus(),this._menuElm?.remove(),this._menuElm=null}}recreateGridMenu(){this.deleteMenu(),this.init()}repositionMenu(e,t,i,n){const s=e?.touches?.[0]??e,r=t.classList.contains("slick-submenu"),o=r?e.target.closest(".slick-menu-item"):s.target;if(o){const e=i||this._gridMenuButtonElm,s=ne(i),a=ne(o),l=n??this._addonOptions,d=getComputedStyle(e),c=parseInt(d?.width??this._defaults?.menuWidth,10),h=t?.offsetWidth??0,u=l?.contentMinWidth??this._defaults.contentMinWidth??0,p=(u>h?u:h)||0,m=s.top,g=s.right;let f,v;if(r?(v=a.top,f=a.left):(v=m+e.offsetHeight,f="right"===l?.dropSide?g-c:g-p),r){const e=t?.clientHeight||0,{bottom:i,top:n}=X(o);"top"===(ii?"top":"bottom")?(t.classList.remove("dropdown"),t.classList.add("dropup"),v-=e-o.clientHeight):(t.classList.remove("dropup"),t.classList.add("dropdown"))}const b=this.grid.getGridPosition();let y=f+Number(h);r&&(y+=o.clientWidth);const _=document.documentElement.clientWidth;"left"===(y>=b.width||y>=_?"left":"right")||!r&&"left"===l?.dropSide?(t.classList.remove("dropright"),t.classList.add("dropleft"),r&&(f-=Number(h))):(t.classList.remove("dropleft"),t.classList.add("dropright"),r&&(f+=o.offsetWidth)),t.style.top=`${v}px`,t.style.left=`${f}px`,u>0&&(t.style.minWidth=`${u}px`),t.style.opacity="1",t.style.display="block"}}openGridMenu(){const e=new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!1});Object.defineProperty(e,"target",{writable:!0,configurable:!0,value:Q("button",{className:"slick-grid-menu-button"})}),this.showGridMenu(e)}showGridMenu(e,t){const i=e?.touches?.[0]??e;if(e.preventDefault(),ee(this._menuElm),this._menuElm?.remove(),this._addonOptions){const n={grid:this.grid,menu:this._menuElm,columns:this.columns,allColumns:this.getAllColumns(),visibleColumns:this.getVisibleColumns()},s={...this._addonOptions,...t};if(s&&!this.extensionUtility.runOverrideFunctionWhenExists(s.menuUsabilityOverride,n))return;if("function"===typeof e.stopPropagation&&(this.pubSubService.publish("onGridMenuBeforeMenuShow",n),"function"===typeof s?.onBeforeMenuShow&&!1===s.onBeforeMenuShow(e,n)||!1===this.onBeforeMenuShow.notify(n,null,this).getReturnValue()))return;this._menuElm=this.createCommandMenu(this._addonOptions?.commandItems??[]),this.createColumnPickerContainer(),So.call(this),this._columnCheckboxes=[],_o.call(this,s),document.body.appendChild(this._menuElm),this.gridOptions.darkMode&&this._menuElm.classList.add("slick-dark-mode"),this._menuElm.style.opacity="0";const r=(void 0!==s?.marginBottom?s.marginBottom:this._defaults.marginBottom)||0;this._menuElm.style.minHeight=ae(s?.minHeight,""),void 0!==s?.height?this._menuElm.style.height=ae(s.height,""):this._menuElm.style.maxHeight=ae(s?.maxHeight,window.innerHeight-i.clientY-r+"px");let o="BUTTON"===e.target.nodeName?e.target:e.target.querySelector("button");o||(o=e.target.parentElement),this._menuElm.ariaExpanded="true",this._menuElm.appendChild(this._listElm),this.repositionMenu(e,this._menuElm,o,s),this._isMenuOpen=!0,this.pubSubService.publish("onGridMenuAfterMenuShow",n),"function"===typeof s?.onAfterMenuShow&&s.onAfterMenuShow(e,n),this.onAfterMenuShow.notify(n,null,this)}}translateGridMenu(){if(this.sharedService.gridOptions.gridMenu){this.sharedService.gridOptions.gridMenu.commandItems=[],this.sharedService.gridOptions.gridMenu.commandTitle="",this.sharedService.gridOptions.gridMenu.columnTitle="",this.sharedService.gridOptions.gridMenu.forceFitTitle="",this.sharedService.gridOptions.gridMenu.syncResizeTitle="";const e=this._userOriginalGridMenu&&Array.isArray(this._userOriginalGridMenu.commandItems)?this._userOriginalGridMenu.commandItems:[];this.sharedService.gridOptions.gridMenu.commandItems=[...e,...this.addGridMenuCustomCommands(e)],this.extensionUtility.translateMenuItemsFromTitleKey(this._addonOptions?.commandItems||[],"commandItems"),this.extensionUtility.sortItems(this.sharedService.gridOptions.gridMenu.commandItems,"positionOrder"),this.translateTitleLabels(this.sharedService.gridOptions.gridMenu),this.translateTitleLabels(this._addonOptions),this.extensionUtility.translateItems(this._columns,"nameKey","name")}}translateTitleLabels(e){e&&(e.commandTitle=this.extensionUtility.getPickerTitleOutputString("commandTitle","gridMenu"),e.columnTitle=this.extensionUtility.getPickerTitleOutputString("columnTitle","gridMenu"),e.forceFitTitle=this.extensionUtility.getPickerTitleOutputString("forceFitTitle","gridMenu"),e.syncResizeTitle=this.extensionUtility.getPickerTitleOutputString("syncResizeTitle","gridMenu"))}addGridMenuCustomCommands(e){const t=this.gridOptions.backendServiceApi||null,i=[],n=z(this.gridOptions),s=this._addonOptions?.commandLabels;if(this._addonOptions&&this.gridOptions){if(!this._addonOptions.hideClearFrozenColumnsCommand){const t="clear-pinning";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===t))||i.push({iconCssClass:this._addonOptions.iconClearFrozenColumnsCommand||"mdi mdi-pin-off-outline",titleKey:`${n}${s?.clearFrozenColumnsCommandKey??"CLEAR_PINNING"}`,disabled:!1,command:t,positionOrder:52})}if(this.gridOptions.enableFiltering&&!this.sharedService.hideHeaderRowAfterPageLoad){if(!this._addonOptions.hideClearAllFiltersCommand){const t="clear-filter";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===t))||i.push({iconCssClass:this._addonOptions.iconClearAllFiltersCommand||"mdi mdi-filter-remove-outline",titleKey:`${n}${s?.clearAllFiltersCommandKey??"CLEAR_ALL_FILTERS"}`,disabled:!1,command:t,positionOrder:50})}if(!this._addonOptions.hideToggleFilterCommand){const t="toggle-filter";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===t))||i.push({iconCssClass:this._addonOptions.iconToggleFilterCommand||"mdi mdi-flip-vertical",titleKey:`${n}${s?.toggleFilterCommandKey??"TOGGLE_FILTER_ROW"}`,disabled:!1,command:t,positionOrder:53})}if(t&&!this._addonOptions.hideRefreshDatasetCommand){const t="refresh-dataset";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===t))||i.push({iconCssClass:this._addonOptions.iconRefreshDatasetCommand||"mdi mdi-sync",titleKey:`${n}${s?.refreshDatasetCommandKey??"REFRESH_DATASET"}`,disabled:!1,command:t,positionOrder:58})}}if(!this._addonOptions.hideToggleDarkModeCommand){const t="toggle-dark-mode";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===t))||i.push({iconCssClass:this._addonOptions.iconToggleDarkModeCommand||"mdi mdi-brightness-4",titleKey:`${n}${s?.toggleDarkModeCommandKey??"TOGGLE_DARK_MODE"}`,disabled:!1,command:t,positionOrder:54})}if(this.gridOptions.showPreHeaderPanel&&!this._addonOptions.hideTogglePreHeaderCommand){const t="toggle-preheader";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===t))||i.push({iconCssClass:this._addonOptions.iconTogglePreHeaderCommand||"mdi mdi-flip-vertical",titleKey:`${n}${s?.togglePreHeaderCommandKey??"TOGGLE_PRE_HEADER_ROW"}`,disabled:!1,command:t,positionOrder:53})}if(this.gridOptions.enableSorting&&!this._addonOptions.hideClearAllSortingCommand){const t="clear-sorting";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===t))||i.push({iconCssClass:this._addonOptions.iconClearAllSortingCommand||"mdi mdi-sort-variant-off",titleKey:`${n}${s?.clearAllSortingCommandKey??"CLEAR_ALL_SORTING"}`,disabled:!1,command:t,positionOrder:51})}if(this.gridOptions.enableTextExport&&!this._addonOptions.hideExportCsvCommand){const t="export-csv";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===t))||i.push({iconCssClass:this._addonOptions.iconExportCsvCommand||"mdi mdi-download",titleKey:`${n}${s?.exportCsvCommandKey??"EXPORT_TO_CSV"}`,disabled:!1,command:t,positionOrder:55})}if(this.gridOptions.enableExcelExport&&!this._addonOptions.hideExportExcelCommand){const t="export-excel";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===t))||i.push({iconCssClass:this._addonOptions.iconExportExcelCommand||"mdi mdi-file-excel-outline text-success",titleKey:`${n}${s?.exportExcelCommandKey??"EXPORT_TO_EXCEL"}`,disabled:!1,command:t,positionOrder:56})}if(this.gridOptions.enableTextExport&&!this._addonOptions.hideExportTextDelimitedCommand){const t="export-text-delimited";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===t))||i.push({iconCssClass:this._addonOptions.iconExportTextDelimitedCommand||"mdi mdi-download",titleKey:`${n}${s?.exportTextDelimitedCommandKey??"EXPORT_TO_TAB_DELIMITED"}`,disabled:!1,command:t,positionOrder:57})}const r=this._addonOptions?.commandItems||[];(Array.isArray(i)&&i.length>0||Array.isArray(r)&&r.length>0)&&(this._addonOptions.commandTitle=this._addonOptions.commandTitle||this.extensionUtility.getPickerTitleOutputString("commandTitle","gridMenu"))}return i}executeGridMenuInternalCustomCommands(e,t){const i=this.sharedService?.externalRegisteredResources||[];if(t?.command)switch(t.command){case"clear-pinning":const e=[...this.sharedService.visibleColumns],t={frozenColumn:-1,frozenRow:-1,frozenBottom:!1,enableMouseWheelScrollHandler:!1};this.grid.setOptions(t),this.sharedService.gridOptions.frozenColumn=t.frozenColumn,this.sharedService.gridOptions.frozenRow=t.frozenRow,this.sharedService.gridOptions.frozenBottom=t.frozenBottom,this.sharedService.gridOptions.enableMouseWheelScrollHandler=t.enableMouseWheelScrollHandler,Array.isArray(e)&&this.grid.setColumns(e);this.gridOptions.enableAutoSizeColumns&&this.grid.autosizeColumns(),this.pubSubService.publish("onGridMenuClearAllPinning");break;case"clear-filter":this.filterService.clearFilters(),this.sharedService.dataView.refresh(),this.pubSubService.publish("onGridMenuClearAllFilters");break;case"clear-sorting":this.sortService.clearSorting(),this.sharedService.dataView.refresh(),this.pubSubService.publish("onGridMenuClearAllSorting");break;case"export-csv":const n=i.find((e=>"TextExportService"===e.className));n?.exportToFile?n.exportToFile({delimiter:v.comma,format:_.csv}):console.error("[Slickgrid-Universal] You must register the TextExportService to properly use Export to File in the Grid Menu. Example:: this.gridOptions = { enableTextExport: true, externalResources: [new TextExportService()] };");break;case"export-excel":const s=i.find((e=>"ExcelExportService"===e.className));s?.exportToExcel?s.exportToExcel():console.error("[Slickgrid-Universal] You must register the ExcelExportService to properly use Export to Excel in the Grid Menu. Example:: this.gridOptions = { enableExcelExport: true, externalResources: [new ExcelExportService()] };");break;case"export-text-delimited":const r=i.find((e=>"TextExportService"===e.className));r?.exportToFile?r.exportToFile({delimiter:v.tab,format:_.txt}):console.error("[Slickgrid-Universal] You must register the TextExportService to properly use Export to File in the Grid Menu. Example:: this.gridOptions = { enableTextExport: true, externalResources: [new TextExportService()] };");break;case"toggle-dark-mode":const o=this.sharedService.gridOptions.darkMode;this.grid.setOptions({darkMode:!o}),this.sharedService.gridOptions.darkMode=!o;break;case"toggle-filter":let a=this.gridOptions?.showHeaderRow??!1;a=!a,this.grid.setHeaderRowVisibility(a),!0===a&&(this.grid.setColumns(this.sharedService.columnDefinitions),this.grid.scrollColumnIntoView(0));break;case"toggle-preheader":const l=this.gridOptions?.showPreHeaderPanel??!1;this.grid.setPreHeaderPanelVisibility(!l);break;case"refresh-dataset":this.extensionUtility.refreshBackendDataset()}}getDefaultGridMenuOptions(){return{commandTitle:void 0,columnTitle:this.extensionUtility.getPickerTitleOutputString("columnTitle","gridMenu"),forceFitTitle:this.extensionUtility.getPickerTitleOutputString("forceFitTitle","gridMenu"),syncResizeTitle:this.extensionUtility.getPickerTitleOutputString("syncResizeTitle","gridMenu"),iconCssClass:"mdi mdi-menu",menuWidth:18,commandItems:[],hideClearAllFiltersCommand:!1,hideRefreshDatasetCommand:!1,hideToggleFilterCommand:!1}}handleBodyMouseDown(e){if(this.menuElement){let t=!1;const i=e.target.closest(`.${this.menuCssClass}`);(this.menuElement.contains(e.target)||i)&&(t=!0),(this._isMenuOpen&&this.menuElement!==e.target&&!t&&!e.defaultPrevented||"close"===e.target.className&&i)&&this.hideMenu(e)}}handleMenuItemCommandClick(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if("divider"!==i&&!i.disabled&&!i.divider){if((i.command||"")&&!i.commandItems){const t={grid:this.grid,command:i.command,item:i,allColumns:this.columns,visibleColumns:this.getVisibleColumns()};this.executeGridMenuInternalCustomCommands(e,t),this.pubSubService.publish("onGridMenuCommand",t),"function"===typeof this._addonOptions?.onCommand&&this._addonOptions.onCommand(e,t),this.onCommand.notify(t,null,this),"function"===typeof i.action&&i.action.call(this,e,t),this._addonOptions?.leaveOpen||e.defaultPrevented||this.hideMenu(e),e.preventDefault(),e.stopPropagation()}else i.commandItems&&this.repositionSubMenu(e,i,n)}}handleMenuItemMouseOver(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;"divider"===i||i.disabled||i.divider||(i.commandItems?this.repositionSubMenu(e,i,n):0===n&&this.disposeSubMenus())}recreateCommandList(e,t,i,n){const s=i.level||0;if(e.length>0){const r=Q("div",{className:`${this._menuCssPrefix}-command-list`,role:"menu"},t);if(0===s){this.populateCommandOrOptionTitle("command",this.addonOptions,r,s);const e=t.querySelector(".slick-command-header")??Q("div",{className:"slick-command-header"});e.classList.add("with-close"),go.call(this,e),r.appendChild(e)}return n&&s>0&&this.addSubMenuTitleWhenExists(n,r),this.populateCommandOrOptionItems("command",this._addonOptions,r,e,i,this.handleMenuItemCommandClick,this.handleMenuItemMouseOver),r}return null}repositionSubMenu(e,t,i){const n=t?.commandItems||[],s=this.createCommandMenu(n,i+1,t);s.style.display="block",document.body.appendChild(s),this.repositionMenu(e,s)}}const po="mdi-icon-picker-check",mo="mdi-icon-picker-uncheck";function go(e){const t=Q("button",{type:"button",className:"close",ariaLabel:"Close",textContent:"\xd7",dataset:{dismiss:this instanceof wo?"slick-column-picker":"slick-grid-menu"}});e.appendChild(t)}function fo(e){const t=this;t.addonOptions?.columnTitle&&(t._columnTitleElm=Q("div",{className:"slick-menu-title",textContent:t.addonOptions?.columnTitle??t._defaults.columnTitle},e))}function vo(e){const t=this,i=t instanceof wo?"columnPicker":"gridMenu",n=e.target?.closest(".icon-checkbox-container"),s=n?.querySelector(".mdi"),r=!!e.target.checked;if(e.target.ariaChecked=String(r),bo(s,r),"autoresize"===e.target.dataset.option){const e=t.getVisibleColumns();return t.grid.setOptions({forceFitColumns:r}),void t.grid.setColumns(e)}if("syncresize"!==e.target.dataset.option){if("checkbox"===e.target.type){t._areVisibleColumnDifferent=!0;const n=e.target.dataset.columnid||"",o=[];if(t._columnCheckboxes.forEach(((e,i)=>{e.checked&&o.push(t.columns[i])})),!o.length)return e.target.checked=!0,void bo(s,!0);if(t.grid.setColumns(o),(!t.sharedService.visibleColumns||Array.isArray(o)&&o.length!==t.sharedService.visibleColumns.length)&&(t.sharedService.visibleColumns=o),t.gridOptions.enableRowSelection&&r){const e=t.grid.getSelectedRows();t.grid.setSelectedRows(e)}const a=t.gridOptions.frozenColumn??-1;a>=0&&t.extensionUtility.readjustFrozenColumnIndexWhenNeeded(a,t.columns,o);const l={columnId:n,showing:r,allColumns:t.columns,visibleColumns:o,columns:o,grid:t.grid};t.pubSubService.publish(`on${ze(i)}ColumnsChanged`,l),"function"===typeof t.addonOptions?.onColumnsChanged&&t.addonOptions.onColumnsChanged(e,l),t.onColumnsChanged.notify(l,null,t)}}else t.grid.setOptions({syncColumnCellResize:r})}function bo(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e&&(e.className=`mdi ${t?po:mo}`)}function yo(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=Q("label",{className:"checkbox-picker-label",htmlFor:t}),r=Q("div",{className:"icon-checkbox-container"}),o=Q("input",{id:t,type:"checkbox",dataset:i}),a=Q("div",{className:`mdi ${n?po:mo}`}),l=Q("span",{className:"checkbox-label"});return r.appendChild(o),r.appendChild(a),s.appendChild(r),s.appendChild(l),e.appendChild(s),n&&(o.ariaChecked="true",o.checked=!0),{inputElm:o,labelElm:s,labelSpanElm:l}}function _o(e){const t=this,i=t instanceof uo,n=i?"gridmenu-":"";for(const s of t.columns){const r=s.id,o=document.createElement("li");(s.excludeFromColumnPicker&&!i||s.excludeFromGridMenu&&i)&&(o.className="hidden");const a=`${t._gridUid}-${n}colpicker-${r}`,l=t.grid.getColumnIndex(r)>=0,{inputElm:d,labelElm:c,labelSpanElm:h}=yo(o,a,{columnid:`${r}`},l);t._columnCheckboxes.push(d);const u=("function"===typeof e?.headerColumnValueExtractor?e.headerColumnValueExtractor:t._defaults.headerColumnValueExtractor)(s,t.gridOptions);this.grid.applyHtmlCode(h,u),o.appendChild(c),t._listElm.appendChild(o)}if(e.hideForceFitButton&&e.hideSyncResizeButton||t._listElm.appendChild(document.createElement("hr")),!e?.hideForceFitButton){const i=document.createElement("li"),s=`${t._gridUid}-${n}colpicker-forcefit`,{labelSpanElm:r}=yo(i,s,{option:"autoresize"},t.gridOptions.forceFitColumns);r.textContent=e?.forceFitTitle??"",t._listElm.appendChild(i)}if(!e?.hideSyncResizeButton){const i=document.createElement("li"),s=`${t._gridUid}-${n}colpicker-syncresize`,{labelSpanElm:r}=yo(i,s,{option:"syncresize"},t.gridOptions.forceFitColumns);r.textContent=e?.syncResizeTitle??"",t._listElm.appendChild(i)}}function So(){const e=this,t=e.grid.getColumns().slice(0),i=new Array(e.columns.length);for(let n=0;nte(e.columnPickerLabel||e.name||"","innerHTML")},this._bindEventService=new Vt,this.onColumnsChanged=new ti("onColumnsChanged"),this._eventHandler=new ii,this._columns=this.sharedService.allColumns??[],this._gridUid=this.grid?.getUID?.()??"",this.init()}get addonOptions(){return this.gridOptions.columnPicker||{}}get eventHandler(){return this._eventHandler}get columns(){return this._columns}set columns(e){this._columns=e}get gridOptions(){return this.sharedService.gridOptions??{}}get grid(){return this.sharedService.slickGrid}get menuElement(){return this._menuElm}init(){this._gridUid=this.grid.getUID()??"",this.gridOptions.columnPicker={...this._defaults,...this.gridOptions.columnPicker},this.onColumnsChanged.setPubSubService(this.pubSubService),this.addonOptions.columnTitle=this.extensionUtility.getPickerTitleOutputString("columnTitle","columnPicker"),this.addonOptions.forceFitTitle=this.extensionUtility.getPickerTitleOutputString("forceFitTitle","columnPicker"),this.addonOptions.syncResizeTitle=this.extensionUtility.getPickerTitleOutputString("syncResizeTitle","columnPicker"),this._eventHandler.subscribe(this.grid.onPreHeaderContextMenu,(e=>{["slick-column-name","slick-header-column"].some((t=>e.target?.classList.contains(t)))&&this.handleHeaderContextMenu(e)})),this._eventHandler.subscribe(this.grid.onHeaderContextMenu,this.handleHeaderContextMenu.bind(this)),this._eventHandler.subscribe(this.grid.onColumnsReordered,So.bind(this)),this._eventHandler.subscribe(this.grid.onClick,this.disposeMenu.bind(this)),this._bindEventService.bind(document.body,"mousedown",this.handleBodyMouseDown.bind(this),void 0,"body"),this._bindEventService.bind(document.body,"beforeunload",this.dispose.bind(this),void 0,"body")}dispose(){this._eventHandler.unsubscribeAll(),this._bindEventService.unbindAll(),this.disposeMenu()}disposeMenu(){this._bindEventService.unbindAll("parent-menu"),this._listElm?.remove(),this._menuElm?.remove(),this._menuElm=null}createPickerMenu(){const e=Q("div",{ariaExpanded:"true",className:`slick-column-picker ${this._gridUid}`,role:"menu"});return So.call(this),fo.call(this,e),go.call(this,e),this._listElm=Q("div",{className:"slick-column-picker-list",role:"menu"}),this._bindEventService.bind(e,"click",vo.bind(this),void 0,"parent-menu"),document.body.appendChild(e),e}getAllColumns(){return this._columns}getVisibleColumns(){return this.grid.getColumns()}translateColumnPicker(){this.addonOptions&&(this.addonOptions.columnTitle="",this.addonOptions.forceFitTitle="",this.addonOptions.syncResizeTitle="",this.addonOptions.columnTitle=this.extensionUtility.getPickerTitleOutputString("columnTitle","columnPicker"),this.addonOptions.forceFitTitle=this.extensionUtility.getPickerTitleOutputString("forceFitTitle","columnPicker"),this.addonOptions.syncResizeTitle=this.extensionUtility.getPickerTitleOutputString("syncResizeTitle","columnPicker")),this.extensionUtility.translateItems(this._columns,"nameKey","name"),this.translateTitleLabels(this.addonOptions)}handleBodyMouseDown(e){(this._menuElm!==e.target&&!this._menuElm?.contains(e.target)||"close"===e.target.className&&e.target.closest(".slick-column-picker"))&&this.disposeMenu()}handleHeaderContextMenu(e){e.preventDefault(),ee(this._menuElm),this._columnCheckboxes=[],this._menuElm=this.createPickerMenu(),this.gridOptions.darkMode&&this._menuElm.classList.add("slick-dark-mode"),_o.call(this,this.addonOptions),document.body.appendChild(this._menuElm),this.repositionMenu(e)}repositionMenu(e){const t=e?.touches?.[0]??e;if(this._menuElm){const e=this.grid.getGridPosition(),i=this._menuElm.clientWidth||0;let n=t.pageX||0;e?.width&&n+i>=e.width&&(n-=i),this._menuElm.style.top=t.pageY-10+"px",this._menuElm.style.left=`${n}px`,this._menuElm.style.minHeight=ae(this.addonOptions.minHeight,""),this._menuElm.style.maxHeight=ae(this.addonOptions.maxHeight,window.innerHeight-t.clientY+"px"),this._menuElm.style.display="block",this._menuElm.ariaExpanded="true",this._menuElm.appendChild(this._listElm)}}translateTitleLabels(e){e&&(e.columnTitle=this.extensionUtility.getPickerTitleOutputString("columnTitle","gridMenu"))}}const Co=(e,t,i,n,s,r)=>{const o=n.params||{};if(!o.formatters||!Array.isArray(o.formatters))throw new Error('[Slickgrid-Universal] The multiple formatter requires the "formatters" to be provided as a column params.\n For example: this.columnDefinitions = [{ id: title, field: title, formatter: Formatters.multiple, params: { formatters: [Formatters.lowercase, Formatters.uppercase] }');const a=o.formatters;let l=i;return a.forEach(((i,o)=>{if("function"!==typeof i)throw new Error(`[Slickgrid-Universal] the "params.formatters" at index(${o}) to be used by "Formatters.multiple" is invalid, please verify all formatter functions.`);l=i.call(void 0,e,t,l,n,s,r)})),l};function Eo(e,t){if(Array.isArray(e))for(const i of e)if(i.editor)if(i.formatter&&i.formatter!==Co&&i.formatter!==t){const e=i.formatter;i.formatter=Co,i.params={...i.params,formatters:[e,t]}}else i.formatter&&i.formatter===Co&&i.params?-1===i.params.formatters.findIndex((e=>e===t))&&(i.params.formatters=[...i.params.formatters,t]):i.formatter=t}function Oo(e,t,i,n){let s,r,o="",a="";switch(i){case"currency":s=g.DEFAULT_FORMATTER_CURRENCY_MIN_DECIMAL,r=g.DEFAULT_FORMATTER_CURRENCY_MAX_DECIMAL;break;case"decimal":s=g.DEFAULT_FORMATTER_NUMBER_MIN_DECIMAL,r=g.DEFAULT_FORMATTER_NUMBER_MAX_DECIMAL;break;case"percent":s=g.DEFAULT_FORMATTER_PERCENT_MIN_DECIMAL,r=g.DEFAULT_FORMATTER_PERCENT_MAX_DECIMAL}const l=t&&"function"===typeof t.getOptions?t.getOptions():{},d=xo("minDecimal",e,l,s),c=xo("maxDecimal",e,l,r),h=xo("decimalSeparator",e,l,g.DEFAULT_NUMBER_DECIMAL_SEPARATOR),u=xo("thousandSeparator",e,l,g.DEFAULT_NUMBER_THOUSAND_SEPARATOR),p=xo("displayNegativeNumberWithParentheses",e,l,g.DEFAULT_NEGATIVE_NUMBER_WRAPPED_IN_BRAQUET),m=xo("currencyPrefix",e,l,""),f=xo("currencySuffix",e,l,"");return"cell"===n&&(o=xo("numberPrefix",e,l,""),a=xo("numberSuffix",e,l,"")),{minDecimal:d,maxDecimal:c,decimalSeparator:h,thousandSeparator:u,wrapNegativeNumber:p,currencyPrefix:m,currencySuffix:f,numberPrefix:o,numberSuffix:a}}function xo(e,t,i,n){const s=t&&t.params;return s&&s.hasOwnProperty(e)?s[e]:i?.formatterOptions?.hasOwnProperty(e)?i.formatterOptions[e]:n}function To(e,t){const i=Pt(e,{withZeroPadding:!0});return(e,n,s,r,o,a)=>{const l=a&&"function"===typeof a.getOptions?a.getOptions():{},d=l?.formatterOptions?.dateSeparator??t,c=Pt(r?.type??y.date,{withDefaultIso8601:!0}),h=r?.params?.parseDateAsUtc??!1,u=Mt(s,c);let p=s;if(u){let e=u;h&&(e=Tt(m=u,Ct(m,"utc"))),p=kt(e,i,"en-US")}var m;if(p&&d!==t){const e=new RegExp(t,"ig");p=p.replace(e,d)}return p}}function ko(e,t,i,n,s,r){let o,a=!1;i?.hasOwnProperty("exportWithFormatter")?a=!!i.exportWithFormatter:r?.hasOwnProperty("exportWithFormatter")&&(a=!!r.exportWithFormatter),n&&i.exportCustomFormatter?o=i.exportCustomFormatter:a&&i.formatter&&(o=i.formatter);const l=Io(o,e,t,i,n,s);return r?.sanitizeDataExport&&"string"===typeof l?Ze(l):l}function Io(e,t,i,n,s,r){let o="";let a=n.field||n.id||"";if("string"===typeof n.field&&n.field.indexOf(".")>0){const e=n.field.split(".");a=e.length>0?e[0]:n.field}const l=s?.hasOwnProperty(a)?s[a]:null;if("function"===typeof e){const a=e(t,i,l,n,s,r);o=te(Fe(a)?a:a.html||a.text)}else o=s?.hasOwnProperty(a)?l:"";return null!==o&&void 0!==o||(o=""),"object"!==typeof o||o instanceof Date||0!==Object.entries(o).length||(o=""),o}class Ro extends io{constructor(e,t,i,n){super(e,t,i),this.extensionUtility=e,this.pubSubService=t,this.sharedService=i,this.treeDataService=n,this._defaults={autoAdjustDrop:!0,autoAlignSide:!0,autoAdjustDropOffset:0,autoAlignSideOffset:0,hideMenuOnScroll:!1,optionShownOverColumnIds:[],commandShownOverColumnIds:[],subMenuOpenByEvent:"mouseover"},this.pluginName="ContextMenu",this._camelPluginName="contextMenu",this._menuCssPrefix="slick-menu",this._menuPluginCssPrefix="slick-context-menu",this.init(i.gridOptions.contextMenu)}init(e){this._addonOptions={...this._defaults,...e};const t=this._addonOptions&&Array.isArray(this._addonOptions.commandItems)?this._addonOptions.commandItems:[];this._addonOptions.commandItems=[...t,...this.addMenuCustomCommands(t)],this._addonOptions={...this._addonOptions},this.sharedService.gridOptions.contextMenu=this._addonOptions,this.sortMenuItems(),this._eventHandler.subscribe(this.grid.onContextMenu,this.handleOnContextMenu.bind(this)),this._eventHandler.subscribe(this.grid.onClick,this.hideMenu.bind(this)),this._addonOptions.hideMenuOnScroll&&this._eventHandler.subscribe(this.grid.onScroll,this.closeMenu.bind(this))}translateContextMenu(){const e=this.sharedService?.gridOptions??{},t=this.sharedService.gridOptions.contextMenu;if(t&&e?.enableTranslate){const e=t.commandItems||[],i=t.optionItems||[];t.commandTitleKey&&(t.commandTitle=this.extensionUtility.translateWhenEnabledAndServiceExist(t.commandTitleKey,"TEXT_COMMANDS")||t.commandTitle),t.optionTitleKey&&(t.optionTitle=this.extensionUtility.translateWhenEnabledAndServiceExist(t.optionTitleKey,"TEXT_COMMANDS")||t.optionTitle),this.extensionUtility.translateMenuItemsFromTitleKey(e,"commandItems"),this.extensionUtility.translateMenuItemsFromTitleKey(i,"optionItems")}}handleOnContextMenu(e,t){this.disposeAllMenus();const i=this.grid.getCellFromEvent(e);if(i){const n=this.grid.getDataItem(i.row),s=this.grid.getColumns()[i.cell],r=t||{};if(r.cell=i.cell,r.row=i.row,r.column=s,r.dataContext=n,r.grid=this.grid,!this.extensionUtility.runOverrideFunctionWhenExists(this._addonOptions.menuUsabilityOverride,r))return;this._menuElm=this.createParentMenu(e),this._menuElm&&e.preventDefault(),this._menuElm&&this.gridOptions.darkMode&&this._menuElm.classList.add("slick-dark-mode"),this._menuElm&&(this.repositionMenu(e,this._menuElm),this._menuElm.ariaExpanded="true",this._menuElm.style.display="block"),this._bindEventService.bind(document.body,"mousedown",this.handleBodyMouseDown.bind(this))}}addMenuCustomCommands(e){const t=[],i=this.sharedService&&this.sharedService.gridOptions||{},n=i?.contextMenu,s=this.sharedService?.dataView,r=z(i);if(n&&!n.hideCopyCellValueCommand){const i="copy";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===i))||t.push({iconCssClass:n.iconCopyCellValueCommand||"mdi mdi-content-copy",titleKey:`${r}COPY`,disabled:!1,command:i,positionOrder:50,action:(e,t)=>{this.copyToClipboard(t)},itemUsabilityOverride:e=>{const t=e?.column,i=e?.dataContext;if("function"===typeof t.queryFieldNameGetterFn){const e=B(t,i,"");if(""!==e&&void 0!==e)return!0}else if(t&&i.hasOwnProperty(t.field))return""!==i[t.field]&&null!==i[t.field]&&void 0!==i[t.field];return!1}})}if(i?.enableTextExport&&n&&!n.hideExportCsvCommand){const i="export-csv";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===i))||t.push({iconCssClass:n.iconExportCsvCommand||"mdi mdi-download",titleKey:`${r}EXPORT_TO_CSV`,disabled:!1,command:i,positionOrder:51,action:()=>{const e=(this.sharedService?.externalRegisteredResources||[]).find((e=>"TextExportService"===e.className));if(!e?.exportToFile)throw new Error("[Slickgrid-Universal] You must register the TextExportService to properly use Export to File in the Context Menu. Example:: this.gridOptions = { enableTextExport: true, externalResources: [new TextExportService()] };");e.exportToFile({delimiter:v.comma,format:_.csv})}})}if(i&&i.enableExcelExport&&n&&!n.hideExportExcelCommand){const i="export-excel";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===i))||t.push({iconCssClass:n.iconExportExcelCommand||"mdi mdi-file-excel-outline text-success",titleKey:`${r}EXPORT_TO_EXCEL`,disabled:!1,command:i,positionOrder:52,action:()=>{const e=(this.sharedService?.externalRegisteredResources||[]).find((e=>"ExcelExportService"===e.className));if(!e?.exportToExcel)throw new Error("[Slickgrid-Universal] You must register the ExcelExportService to properly use Export to Excel in the Context Menu. Example:: this.gridOptions = { enableExcelExport: true, externalResources: [new ExcelExportService()] };");e.exportToExcel()}})}if(i?.enableTextExport&&n&&!n.hideExportTextDelimitedCommand){const i="export-text-delimited";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===i))||t.push({iconCssClass:n.iconExportTextDelimitedCommand||"mdi mdi-download",titleKey:`${r}EXPORT_TO_TAB_DELIMITED`,disabled:!1,command:i,positionOrder:53,action:()=>{const e=(this.sharedService?.externalRegisteredResources||[]).find((e=>"TextExportService"===e.className));if(!e?.exportToFile)throw new Error("[Slickgrid-Universal] You must register the TextExportService to properly use Export to File in the Context Menu. Example:: this.gridOptions = { enableTextExport: true, externalResources: [new TextExportService()] };");e.exportToFile({delimiter:v.tab,format:_.txt})}})}if(i&&(i.enableGrouping||i.enableDraggableGrouping||i.enableTreeData)){if(n&&!n.hideCopyCellValueCommand&&t.push({divider:!0,command:"",positionOrder:54}),i&&!i.enableTreeData&&n&&!n.hideClearAllGrouping){const i="clear-grouping";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===i))||t.push({iconCssClass:n.iconClearGroupingCommand||"mdi mdi-close",titleKey:`${r}CLEAR_ALL_GROUPING`,disabled:!1,command:i,positionOrder:55,action:()=>{s.setGrouping([]),this.pubSubService.publish("onContextMenuClearGrouping")},itemUsabilityOverride:()=>{const e=s&&s.getGrouping&&s.getGrouping();return Array.isArray(e)&&e.length>0}})}if(i&&n&&!n.hideCollapseAllGroups){const o="collapse-all-groups";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===o))||t.push({iconCssClass:n.iconCollapseAllGroupsCommand||"mdi mdi-arrow-collapse",titleKey:`${r}COLLAPSE_ALL_GROUPS`,disabled:!1,command:o,positionOrder:56,action:()=>{i.enableTreeData?this.treeDataService.toggleTreeDataCollapse(!0):s.collapseAllGroups(),this.pubSubService.publish("onContextMenuCollapseAllGroups")},itemUsabilityOverride:()=>{if(i.enableTreeData)return!0;const e=s&&s.getGrouping&&s.getGrouping();return Array.isArray(e)&&e.length>0}})}if(i&&n&&!n.hideExpandAllGroups){const o="expand-all-groups";e.some((e=>"divider"!==e&&e.hasOwnProperty("command")&&e.command===o))||t.push({iconCssClass:n.iconExpandAllGroupsCommand||"mdi mdi-arrow-expand",titleKey:`${r}EXPAND_ALL_GROUPS`,disabled:!1,command:o,positionOrder:57,action:()=>{i.enableTreeData?this.treeDataService.toggleTreeDataCollapse(!1):s.expandAllGroups(),this.pubSubService.publish("onContextMenuExpandAllGroups")},itemUsabilityOverride:()=>{if(i.enableTreeData)return!0;const e=s&&s.getGrouping&&s.getGrouping();return Array.isArray(e)&&e.length>0}})}}return this.extensionUtility.translateMenuItemsFromTitleKey(t),t}copyToClipboard(e){try{if(e&&e.grid&&e.command){const t=this.sharedService?.gridOptions??{},i=e?.cell??0,n=e?.row??0,s=e?.column,r=e?.dataContext,o=this.sharedService?.slickGrid;let a=ko(n,i,s,r,o,t&&(t.excelExportOptions||t.textExportOptions));"function"===typeof s.queryFieldNameGetterFn&&(a=B(s,r,""));let l=a;"string"===typeof a&&(l=a.replace(/^([\xb7|\u2b9e|\u2b9f]\s*)|([\xb7|\u2b9e|\u2b9f])\s*/gi,"").replace(/[\u00b7|\u034f]/gi,"").trim());const d=document.createElement("textarea");d&&document.body&&(d.style.position="absolute",d.style.opacity="0",d.value=l,document.body.appendChild(d),d.select(),document.execCommand("copy",!1,l)&&d.remove())}}catch(t){}}sortMenuItems(){const e=this.sharedService?.gridOptions?.contextMenu;e&&(this.extensionUtility.sortItems(e.commandItems||[],"positionOrder"),this.extensionUtility.sortItems(e.optionItems||[],"positionOrder"))}}class Ao{constructor(e,t,i){this.extensionUtility=e,this.pubSubService=t,this.sharedService=i,this.columnsGroupBy=[],this.pluginName="DraggableGrouping",this._gridColumns=[],this._gridUid="",this._isInitialized=!1,this._reorderedColumns=[],this._subscriptions=[],this._defaults={dropPlaceHolderText:"Drop a column header here to group by the column",hideGroupSortIcons:!1,hideToggleAllButton:!1,toggleAllButtonText:"",toggleAllPlaceholderText:"Toggle all Groups"},this._bindingEventService=new Vt,this.onGroupChanged=new ti("onGroupChanged"),this._eventHandler=new ii}get addonOptions(){return this._addonOptions}get dataView(){return this.grid?.getData()??{}}get dropboxElement(){return this._dropzoneElm}get droppableInstance(){return this._droppableInstance}get sortableLeftInstance(){return this._sortableLeftInstance}get sortableRightInstance(){return this._sortableRightInstance}get eventHandler(){return this._eventHandler}get grid(){return this._grid??this.sharedService.slickGrid??{}}get gridOptions(){return this.sharedService.gridOptions??{}}get gridUid(){return this._gridUid||(this.grid?.getUID()??"")}get gridContainer(){return this.grid.getContainerNode()}set isInitialized(e){this._isInitialized=e}init(e,t){if(this._addonOptions={...this._defaults,...t},this._grid=e,e){if(this._gridUid=e.getUID(),this._gridColumns=e.getColumns(),this._dropzoneElm=e.getTopHeaderPanel()||e.getPreHeaderPanel(),!this._dropzoneElm)throw new Error("[Slickgrid-Universal] Draggable Grouping requires the pre-header to be created and shown for the plugin to work correctly (use `createPreHeaderPanel` and `showPreHeaderPanel`).");if(this._dropzoneElm.classList.add("slick-dropzone"),this.onGroupChanged.setPubSubService(this.pubSubService),!this._addonOptions.hideToggleAllButton){this._groupToggler=Q("div",{className:"slick-group-toggle-all",title:this._addonOptions.toggleAllPlaceholderText??"",style:{display:"none"}});const e=Q("span",{className:"slick-group-toggle-all-icon"},this._groupToggler);this.gridOptions.enableTranslate&&this._addonOptions.toggleAllButtonTextKey&&(this._addonOptions.toggleAllButtonText=this.extensionUtility.translateWhenEnabledAndServiceExist(this._addonOptions.toggleAllButtonTextKey,"TEXT_TOGGLE_ALL_GROUPS")),this.gridOptions.enableTranslate&&this._addonOptions.toggleAllPlaceholderTextKey&&(this._addonOptions.toggleAllPlaceholderText=this.extensionUtility.translateWhenEnabledAndServiceExist(this._addonOptions.toggleAllPlaceholderTextKey,"TEXT_TOGGLE_ALL_GROUPS")),this._groupToggler.title=this._addonOptions.toggleAllPlaceholderText??"",this._addonOptions.toggleAllButtonText&&this._groupToggler.appendChild(Q("span",{className:"slick-group-toggle-all-text",textContent:this._addonOptions.toggleAllButtonText||""})),this._dropzoneElm.appendChild(this._groupToggler),this._subscriptions.push(this.pubSubService.subscribe("onContextMenuCollapseAllGroups",(()=>this.toggleGroupToggler(e,!0,!1))),this.pubSubService.subscribe("onContextMenuExpandAllGroups",(()=>this.toggleGroupToggler(e,!1,!1))))}this._dropzonePlaceholderElm=Q("div",{className:"slick-draggable-dropzone-placeholder"},this._dropzoneElm),this.gridOptions.enableTranslate&&this._addonOptions?.dropPlaceHolderTextKey&&(this._addonOptions.dropPlaceHolderText=this.extensionUtility.translateWhenEnabledAndServiceExist(this._addonOptions.dropPlaceHolderTextKey,"TEXT_TOGGLE_ALL_GROUPS")),this._dropzonePlaceholderElm.textContent=this._addonOptions?.dropPlaceHolderText??this._defaults.dropPlaceHolderText??"",this.setupColumnDropbox(),this._eventHandler.subscribe(e.onHeaderCellRendered,((e,t)=>{const i=t.node;if(!Ie(t.column?.grouping)&&i&&(i.style.cursor="pointer",this._addonOptions.groupIconCssClass)){const e=Q("span",{className:"slick-column-groupable"},i);this._addonOptions.groupIconCssClass&&e.classList.add(...Z(this._addonOptions.groupIconCssClass))}})),this._subscriptions.push(this.pubSubService.subscribe("onContextMenuClearGrouping",(()=>this.clearDroppedGroups())));for(const t of this._gridColumns){const i=t.field;e.updateColumnHeader(i)}}return this}dispose(){this.destroySortableInstances(),this._droppableInstance?.el&&this._droppableInstance?.destroy(),this.onGroupChanged.unsubscribe(),this._eventHandler.unsubscribeAll(),this.pubSubService.unsubscribeAll(this._subscriptions),this._bindingEventService.unbindAll(),ee(this.gridContainer.querySelector(`.${this.gridUid} .slick-preheader-panel,.${this.gridUid} .slick-topheader-panel`))}clearDroppedGroups(){this.columnsGroupBy=[],this.updateGroupBy("clear-all");const e=this._dropzoneElm.querySelectorAll(".slick-dropped-grouping");for(const t of Array.from(e)){const e=this._dropzoneElm.querySelector(".slick-groupby-remove");e?.remove(),t?.remove()}this._dropzonePlaceholderElm.style.display="inline-block",this._groupToggler&&(this._groupToggler.style.display="none")}destroySortableInstances(){this._sortableLeftInstance?.el&&this._sortableLeftInstance?.destroy(),this._sortableRightInstance?.el&&this._sortableRightInstance?.destroy()}setAddonOptions(e){this._addonOptions={...this._addonOptions,...e}}setColumns(e){this._gridColumns=e}setDroppedGroups(e){this._dropzonePlaceholderElm.style.display="none";const t=Array.isArray(e)?e:[e];for(const i of t){const e=this.grid.getHeaderColumn(i);this.handleGroupByDrop(this._dropzoneElm,e)}}setupColumnReorder(e,t,i,n,s,r,o,a,l){this.destroySortableInstances();const d=e.getTopHeaderPanel()||e.getPreHeaderPanel(),c=d.querySelector(".slick-draggable-dropzone-placeholder"),h=d.querySelector(".slick-group-toggle-all"),u={animation:50,ghostClass:"slick-sortable-placeholder",draggable:".slick-header-column",dataIdAttr:"data-id",group:{name:"shared",pull:"clone",put:!1},revertClone:!0,onStart:e=>{e.item.classList.add("slick-header-column-active"),c&&(c.style.display="inline-block");d.querySelectorAll(".slick-dropped-grouping").forEach((e=>e.style.display="none")),h&&(h.style.display="none")},onEnd:i=>{i.item.classList.remove("slick-header-column-active"),d?.classList.remove("slick-dropzone-hover"),c?.parentElement?.classList.remove("slick-dropzone-placeholder-hover");const r=d.querySelectorAll(".slick-dropped-grouping");if(r.forEach((e=>e.style.display="flex")),r.length&&(c&&(c.style.display="none"),h&&(h.style.display="inline-flex")),!e.getEditorLock().commitCurrentEdit())return;const a=this.sortableLeftInstance?.toArray()??[];if(t.length>1){const e=this._sortableRightInstance?.toArray()??[];for(const t of e)a.push(t)}const u=[],p=e.getColumns();for(const t of a)u.push(p[o.call(e,t)]);n.call(e,u),l.call(e,e.onColumnsReordered,{grid:e,impactedColumns:u}),i.stopPropagation(),s.call(e)}};return this._sortableLeftInstance=fs.create(this.gridContainer.querySelector(`.${e.getUID()} .slick-header-columns.slick-header-columns-left`),u),this._sortableRightInstance=fs.create(this.gridContainer.querySelector(`.${e.getUID()} .slick-header-columns.slick-header-columns-right`),u),this._addonOptions.initialGroupBy&&!this._isInitialized&&this.setDroppedGroups(this._addonOptions.initialGroupBy),this._isInitialized=!0,{sortableLeftInstance:this._sortableLeftInstance,sortableRightInstance:this._sortableRightInstance}}addColumnGroupBy(e){this.columnsGroupBy.push(e),this.updateGroupBy("add-group")}addGroupByRemoveClickHandler(e,t,i,n){this._bindingEventService.bind(t,"click",(()=>{const s=this._bindingEventService.boundedEvents.filter((e=>e.element===t));for(const e of s)this._bindingEventService.unbind(e.element,"click",e.listener);this.removeGroupBy(e,i,n)}))}addGroupSortClickHandler(e,t){const{grouping:i,type:n}=e;this._bindingEventService.bind(t,"click",(()=>{if(this.toggleGroupAll(e,!1),i){const s=i.sortAsc?O.desc:O.asc;i.comparer=(t,i)=>Ht(n||"text",t.value,i.value,s,e,this.gridOptions),this.getGroupBySortIcon(t,!i.sortAsc),this.updateGroupBy("sort-group"),i.sortAsc=!i.sortAsc,this.grid.invalidate()}}))}getGroupBySortIcon(e){!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?this._addonOptions.sortAscIconCssClass?(e.classList.remove(...Z(this._addonOptions.sortDescIconCssClass)),e.classList.add(...Z(this._addonOptions.sortAscIconCssClass))):(e.classList.add("slick-groupby-sort-asc-icon"),e.classList.remove("slick-groupby-sort-desc-icon")):this._addonOptions.sortDescIconCssClass?(e.classList.remove(...Z(this._addonOptions.sortAscIconCssClass)),e.classList.add(...Z(this._addonOptions.sortDescIconCssClass))):this._addonOptions.sortDescIconCssClass||(e.classList.add("slick-groupby-sort-desc-icon"),e.classList.remove("slick-groupby-sort-asc-icon"))}handleGroupByDrop(e,t){const i=t.getAttribute("data-id")?.replace(this._gridUid,"");let n=!0;for(const s of this.columnsGroupBy)s.id===i&&(n=!1);if(n){for(const n of this._gridColumns)if(n.id===i&&n.grouping&&!Ie(n.grouping)){const i=t.querySelector(".slick-column-name"),s=Q("div",{id:`${this._gridUid}_${n.id}_entry`,className:"slick-dropped-grouping",dataset:{id:`${n.id}`}});Q("div",{className:"slick-dropped-grouping-title",style:{display:"inline-flex"},textContent:i?i.textContent:t.textContent},s);const r=Q("div",{className:"slick-groupby-remove"});let o;this._addonOptions.deleteIconCssClass&&r.classList.add(...Z(this._addonOptions.deleteIconCssClass)),this._addonOptions.deleteIconCssClass||r.classList.add("slick-groupby-remove-icon"),!0!==this._addonOptions?.hideGroupSortIcons&&n.sortable&&(void 0===n.grouping?.sortAsc&&(n.grouping.sortAsc=!0),o=Q("div",{className:"slick-groupby-sort"},s),this.getGroupBySortIcon(o,n.grouping.sortAsc)),s.appendChild(r),s.appendChild(document.createElement("div")),e.appendChild(s),this._groupToggler&&0===this.columnsGroupBy.length&&this.toggleGroupAll(n),this.addColumnGroupBy(n),this.addGroupByRemoveClickHandler(n.id,r,t,s),o&&this.addGroupSortClickHandler(n,o)}this._groupToggler&&this.columnsGroupBy.length>0&&(this._groupToggler.style.display="inline-flex")}}toggleGroupAll(e,t){let{grouping:i}=e;const n=this._groupToggler?.querySelector(".slick-group-toggle-all-icon");!0===t||i?.collapsed?(n?.classList.add("collapsed"),n?.classList.remove("expanded")):(n?.classList.add("expanded"),n?.classList.remove("collapsed"))}removeFromArray(e,t){if(Array.isArray(e)){const i=e.findIndex((e=>e.id===t.id));i>=0&&e.splice(i,1)}return e}removeGroupBy(e,t,i){i.remove();const n=[];this._gridColumns.forEach((e=>n[e.id]=e)),this.removeFromArray(this.columnsGroupBy,n[e]),0===this.columnsGroupBy.length&&(this._dropzonePlaceholderElm.style.display="inline-block",this._groupToggler&&(this._groupToggler.style.display="none")),this.updateGroupBy("remove-group")}addDragOverDropzoneListeners(){const e=this._dropzoneElm.querySelector(".slick-draggable-dropzone-placeholder");e&&this._dropzoneElm&&(this._bindingEventService.bind(e,"dragover",(e=>e.preventDefault())),this._bindingEventService.bind(e,"dragenter",(()=>this._dropzoneElm.classList.add("slick-dropzone-hover"))),this._bindingEventService.bind(e,"dragleave",(()=>this._dropzoneElm.classList.remove("slick-dropzone-hover"))))}setupColumnDropbox(){const e=this._dropzoneElm;this._droppableInstance=fs.create(e,{group:"shared",ghostClass:"slick-droppable-sortitem-hover",draggable:".slick-dropped-grouping",dragoverBubble:!0,onAdd:t=>{const i=t.item;i.getAttribute("id")?.replace(this._gridUid,"")&&this.handleGroupByDrop(e,fs.utils.clone(t.item)),i.parentNode?.removeChild(i)},onUpdate:()=>{const e=this._droppableInstance?.toArray()??[],t=[];for(const i of e)for(const e of this.columnsGroupBy)if(e.id===i){t.push(e);break}this.columnsGroupBy=t,this.updateGroupBy("sort-group")}}),this.addDragOverDropzoneListeners(),this._groupToggler&&this._bindingEventService.bind(this._groupToggler,"click",(e=>{const t=e.target.classList.contains("slick-group-toggle-all-icon")?e.target:e.currentTarget.querySelector(".slick-group-toggle-all-icon");this.toggleGroupToggler(t,t?.classList.contains("expanded"))}))}toggleGroupToggler(e){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e&&(!0===(!(arguments.length>1&&void 0!==arguments[1])||arguments[1])?(e.classList.add("collapsed"),e.classList.remove("expanded"),t&&this.dataView.collapseAllGroups()):(e.classList.remove("collapsed"),e.classList.add("expanded"),t&&this.dataView.expandAllGroups()))}updateGroupBy(e){if(0===this.columnsGroupBy.length)return this.dataView.setGrouping([]),this._dropzonePlaceholderElm.style.display="inline-block",void this.triggerOnGroupChangedEvent({caller:e,groupColumns:[]});const t=[];this.columnsGroupBy.forEach((e=>t.push(e.grouping))),this.dataView.setGrouping(t),this._dropzonePlaceholderElm.style.display="none",this.triggerOnGroupChangedEvent({caller:e,groupColumns:t})}triggerOnGroupChangedEvent(e){this._addonOptions&&"function"===typeof this._addonOptions.onGroupChanged&&this._addonOptions.onGroupChanged(new ei,e),this.onGroupChanged.notify(e)}}class Do extends to{constructor(e,t,i){super(e,t,i),this.extensionUtility=e,this.pubSubService=t,this.sharedService=i,this._buttonElms=[],this._defaults={buttonCssClass:"slick-header-button"},this.pluginName="HeaderButtons",this._menuCssPrefix="slick-header-button",this._camelPluginName="headerButtons",this._bindEventService=new Vt,this._eventHandler=new ii,this.init(i.gridOptions.headerButton)}get addonOptions(){return this._addonOptions}set addonOptions(e){this._addonOptions=e}get eventHandler(){return this._eventHandler}get grid(){return this.sharedService.slickGrid}init(e){this._addonOptions={...this._defaults,...e},this._eventHandler.subscribe(this.grid.onHeaderCellRendered,this.handleHeaderCellRendered.bind(this)),this._eventHandler.subscribe(this.grid.onBeforeHeaderCellDestroy,this.handleBeforeHeaderCellDestroy.bind(this)),this.grid.setColumns(this.grid.getColumns())}dispose(){super.dispose(),this._buttonElms.forEach((e=>e.remove()))}handleHeaderCellRendered(e,t){const i=t.column;if(i.header?.buttons&&Array.isArray(i.header.buttons)){let e=i.header.buttons.length;for(;e--;){const n=i.header.buttons[e],s=this.populateSingleCommandOrOptionItem("command",this.addonOptions,null,n,t,this.handleButtonClick.bind(this));s&&n.handler&&!n.disabled&&this._bindEventService.bind(s,"click",(e=>n.handler.call(this,e))),s&&(this._buttonElms.push(s),t.node.appendChild(s))}}}handleBeforeHeaderCellDestroy(e,t){const i=t.column;if(i.header?.buttons&&this._addonOptions?.buttonCssClass){const e=(this._addonOptions?.buttonCssClass||"").replace(/(\s+)/g,".");e&&t.node.querySelectorAll(`.${e}`).forEach((e=>e.remove()))}}handleButtonClick(e,t,i,n,s){if(i.command&&!i.disabled){const t=i.command||"",n={grid:this.grid,column:s,button:i};t&&(n.command=t),"function"!==typeof i.action||i.disabled||i.action.call(this,e,n),null!==t&&!i.disabled&&this._addonOptions?.onCommand&&(this.pubSubService.publish("onHeaderButtonCommand",n),this._addonOptions.onCommand(e,n),s?.id&&this.grid.updateColumnHeader(s.id))}e.preventDefault(),e.stopPropagation()}}class Po extends to{constructor(e,t,i,n,s){super(e,i,n),this.extensionUtility=e,this.filterService=t,this.pubSubService=i,this.sharedService=n,this.sortService=s,this._subMenuParentId="",this._defaults={autoAlign:!0,autoAlignOffset:0,buttonCssClass:null,buttonImage:null,minWidth:100,hideColumnHideCommand:!1,hideSortCommands:!1,title:"",subMenuOpenByEvent:"mouseover"},this.pluginName="HeaderMenu",this._menuCssPrefix="slick-menu",this._menuPluginCssPrefix="slick-header-menu",this._camelPluginName="headerMenu",this.sharedService.gridOptions.headerMenu=this.addHeaderMenuCustomCommands(this.sharedService.columnDefinitions),this.init(n.gridOptions.headerMenu)}init(e){this._addonOptions={...this._defaults,...e},this._eventHandler.subscribe(this.grid.onBeforeSetColumns,((e,t)=>{this.sharedService.gridOptions.headerMenu=this.addHeaderMenuCustomCommands(t.newColumns)})),this._eventHandler.subscribe(this.grid.onHeaderCellRendered,this.handleHeaderCellRendered.bind(this)),this._eventHandler.subscribe(this.grid.onBeforeHeaderCellDestroy,this.handleBeforeHeaderCellDestroy.bind(this)),this._eventHandler.subscribe(this.grid.onClick,this.hideMenu.bind(this)),this.grid.setColumns(this.grid.getColumns()),this._bindEventService.bind(document.body,"mousedown",this.handleBodyMouseDown.bind(this))}dispose(){super.dispose(),this._menuElm=this._menuElm||document.body.querySelector(`.slick-header-menu${this.gridUidSelector}`),this._menuElm?.remove(),this._activeHeaderColumnElm=void 0}hideColumn(e){if(this.sharedService?.slickGrid?.getColumnIndex){const t=this.sharedService.slickGrid.getColumnIndex(e.id),i=this.sharedService.slickGrid.getColumns(),n=this.sharedService.gridOptions.frozenColumn??-1;n>=0&&n>=t&&(this.sharedService.gridOptions.frozenColumn=n-1,this.sharedService.slickGrid.setOptions({frozenColumn:this.sharedService.gridOptions.frozenColumn}));const s=Ee(i,t);this.sharedService.visibleColumns=s,this.sharedService.slickGrid.setColumns(s),this.pubSubService.publish("onHeaderMenuHideColumns",{columns:s,hiddenColumn:e})}}hideMenu(){this.disposeSubMenus(),this._menuElm?.remove(),this._menuElm=void 0}repositionSubMenu(e,t,i,n){const s=this.createCommandMenu(t.commandItems||[],n,i+1,t);document.body.appendChild(s),this.repositionMenu(e,s)}repositionMenu(e,t){const i=e.target,n=t.classList.contains("slick-submenu"),s=n?e.target.closest(".slick-menu-item"):i,r=ie(this.sharedService.gridContainerElement.querySelector(".slickgrid-container")??this.sharedService.gridContainerElement,i),o=this.grid.getGridPosition(),a=t.offsetWidth,l=ne(s);let d=n?l.left:r?.left??0,c=n?l.top:(r?.top??0)+(this.addonOptions?.menuOffsetTop??0)+i.clientHeight;if(n){const e=t?.clientHeight||0,{bottom:i,top:n}=X(s);"top"===(ii?"top":"bottom")?(t.classList.remove("dropdown"),t.classList.add("dropup"),c-=e-s.clientHeight):(t.classList.remove("dropup"),t.classList.add("dropdown"))}if(n&&s){const e=d+Number(a)+s.clientWidth,i=document.documentElement.clientWidth;"left"===(e>=o.width||e>=i?"left":"right")?(t.classList.remove("dropright"),t.classList.add("dropleft"),d-=a):(t.classList.remove("dropleft"),t.classList.add("dropright"),d+=s.offsetWidth)}else d=r?.left??0,this.addonOptions.autoAlign&&o?.width&&d+(t.clientWidth??0)>=o.width&&(d=d+i.clientWidth-t.clientWidth+(this.addonOptions?.autoAlignOffset||0));t.style.top=`${c}px`,t.style.left=`${d}px`}translateHeaderMenu(){this.sharedService.gridOptions?.headerMenu&&this.resetHeaderMenuTranslations(this.sharedService.visibleColumns)}handleHeaderCellRendered(e,t){const i=t.column,n=i.header?.menu;if(n&&t.node){if(!this.extensionUtility.runOverrideFunctionWhenExists(this.addonOptions.menuUsabilityOverride,t))return;const e=Q("div",{className:"slick-header-menu-button",ariaLabel:"Header Menu"},t.node);this.addonOptions.buttonCssClass&&e.classList.add(...Z(this.addonOptions.buttonCssClass)),this.addonOptions.tooltip&&(e.title=this.addonOptions.tooltip),this._bindEventService.bind(e,"click",(e=>{this.disposeAllMenus(),this.createParentMenu(e,t.column,n)}))}}handleBeforeHeaderCellDestroy(e,t){const i=t.column;i.header?.menu&&t.node.querySelectorAll(".slick-header-menu-button").forEach((e=>e.remove()))}handleBodyMouseDown(e){if(this.menuElement){let t=!1;const i=e.target.closest(`.${this.menuCssClass}`);(this.menuElement.contains(e.target)||i)&&(t=!0),(this._menuElm!==e.target&&!t&&!e.defaultPrevented||"close"===e.target.className&&i)&&this.hideMenu()}}handleMenuItemCommandClick(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0;if("divider"!==i&&!i.disabled&&!i.divider){if((i.command||"")&&!i.commandItems){const t={grid:this.grid,command:i.command,column:s,item:i};this.executeHeaderMenuInternalCommands(e,t),this.pubSubService.publish("onHeaderMenuCommand",t),"function"===typeof this.addonOptions?.onCommand&&this.addonOptions.onCommand(e,t),"function"===typeof i.action&&i.action.call(this,e,t),e.defaultPrevented||this.hideMenu(),e.preventDefault(),e.stopPropagation()}else i.commandItems&&this.repositionSubMenu(e,i,n,s)}}handleMenuItemMouseOver(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4?arguments[4]:void 0;"divider"===i||i.disabled||i.divider||(i.commandItems?this.repositionSubMenu(e,i,n,s):0===n&&this.disposeSubMenus())}addHeaderMenuCustomCommands(e){const t=this.sharedService.gridOptions,i=t.headerMenu||{},n=z(t);return Array.isArray(e)&&t.enableHeaderMenu&&e.forEach((e=>{if(e&&!e.excludeFromHeaderMenu){e.header?e.header.menu||(e.header.menu={commandItems:[]}):e.header={menu:{commandItems:[]}};const s=e?.header?.menu?.commandItems??[];let r=!1;if(i&&!i.hideFreezeColumnsCommand&&(r=!0,s.some((e=>"divider"!==e&&"freeze-columns"===e?.command))||s.push({iconCssClass:i.iconFreezeColumns||"mdi mdi-pin-outline",titleKey:`${n}FREEZE_COLUMNS`,command:"freeze-columns",positionOrder:45})),i&&!i.hideColumnResizeByContentCommand&&this.sharedService.gridOptions.enableColumnResizeOnDoubleClick&&(r=!0,s.some((e=>"divider"!==e&&"column-resize-by-content"===e?.command))||s.push({iconCssClass:i.iconColumnResizeByContentCommand||"mdi mdi-arrow-expand-horizontal",titleKey:`${n}COLUMN_RESIZE_BY_CONTENT`,command:"column-resize-by-content",positionOrder:47})),r&&!s.some((e=>"divider"!==e&&48===e.positionOrder))&&s.push({divider:!0,command:"",positionOrder:48}),t.enableSorting&&e.sortable&&i&&!i.hideSortCommands&&(s.some((e=>"divider"!==e&&"sort-asc"===e?.command))||s.push({iconCssClass:i.iconSortAscCommand||"mdi mdi-sort-ascending",titleKey:`${n}SORT_ASCENDING`,command:"sort-asc",positionOrder:50}),s.some((e=>"divider"!==e&&"sort-desc"===e?.command))||s.push({iconCssClass:i.iconSortDescCommand||"mdi mdi-sort-descending",titleKey:`${n}SORT_DESCENDING`,command:"sort-desc",positionOrder:51}),s.some((e=>"divider"!==e&&52===e.positionOrder))||s.push({divider:!0,command:"",positionOrder:52}),i.hideClearSortCommand||s.some((e=>"divider"!==e&&"clear-sort"===e?.command))||s.push({iconCssClass:i.iconClearSortCommand||"mdi mdi-sort-variant-off",titleKey:`${n}REMOVE_SORT`,command:"clear-sort",positionOrder:58})),e.filter?.filterShortcuts&&!s.some((e=>"divider"!==e&&"filter-shortcuts-root-menu"===e?.command))){const t=[];e.filter.filterShortcuts.forEach((e=>{const i=e.title?Ue(e.title):(e.titleKey||"").toLowerCase().replaceAll("_","-");t.push({...e,command:i,action:(t,i)=>{const n=this.filterService.getFiltersMetadata().find((e=>e.columnDef.id===i.column.id));n?.setValues(e.searchTerms,e.operator,!0)}})}));const o=i.filterShortcutsPositionOrder??55;s.push({iconCssClass:i.iconFilterShortcutSubMenu||"mdi mdi-filter-outline",titleKey:`${n}FILTER_SHORTCUTS`,command:"filter-shortcuts-root-menu",positionOrder:o,commandItems:t}),r&&!s.some((e=>"divider"!==e&&e.positionOrder===o+1))&&s.push({divider:!0,command:"",positionOrder:o+1})}t.enableFiltering&&e.filterable&&i&&!i.hideFilterCommand&&(i.hideClearFilterCommand||s.some((e=>"divider"!==e&&"clear-filter"===e?.command))||s.push({iconCssClass:i.iconClearFilterCommand||"mdi mdi-filter-remove-outline",titleKey:`${n}REMOVE_FILTER`,command:"clear-filter",positionOrder:57})),!i||i.hideColumnHideCommand||s.some((e=>"divider"!==e&&"hide-column"===e?.command))||s.push({iconCssClass:i.iconColumnHideCommand||"mdi mdi-close",titleKey:`${n}HIDE_COLUMN`,command:"hide-column",positionOrder:59}),this.extensionUtility.translateMenuItemsFromTitleKey(s),this.extensionUtility.sortItems(s,"positionOrder")}})),i}clearColumnFilter(e,t){t?.column&&this.filterService.clearFilterByColumnId(e,t.column.id)}clearColumnSort(e,t){t?.column&&this.sharedService&&this.sortService.clearSortByColumnId(e,t.column.id)}executeHeaderMenuInternalCommands(e,t){if(t?.command)switch(t.command){case"hide-column":this.hideColumn(t.column),this.sharedService.gridOptions?.enableAutoSizeColumns&&this.sharedService.slickGrid.autosizeColumns();break;case"clear-filter":this.clearColumnFilter(e,t);break;case"clear-sort":this.clearColumnSort(e,t);break;case"column-resize-by-content":this.pubSubService.publish("onHeaderMenuColumnResizeByContent",{columnId:t.column.id});break;case"freeze-columns":const i=[...this.sharedService.visibleColumns],n={frozenColumn:i.findIndex((e=>e.id===t.column.id)),enableMouseWheelScrollHandler:!0},s=this.sharedService.slickGrid.getColumns();this.sharedService.slickGrid.setOptions(n,!1,!0),this.sharedService.gridOptions.frozenColumn=n.frozenColumn,this.sharedService.gridOptions.enableMouseWheelScrollHandler=n.enableMouseWheelScrollHandler,this.sharedService.frozenVisibleColumnId=t.column.id,this.sharedService.hasColumnsReordered||Array.isArray(i)&&Array.isArray(this.sharedService.allColumns)&&i.length!==this.sharedService.allColumns.length?this.sharedService.slickGrid.setColumns(i):this.sharedService.slickGrid.setColumns(s);this.sharedService.slickGrid.getOptions().enableAutoSizeColumns&&this.sharedService.slickGrid.autosizeColumns();break;case"sort-asc":case"sort-desc":const r="sort-asc"===t.command;this.sortColumn(e,t,r)}}createParentMenu(e,t,i){const n={grid:this.grid,column:t,menu:i};"function"===typeof e.stopPropagation&&(this.pubSubService.publish("onHeaderMenuBeforeMenuShow",n),"function"===typeof this.addonOptions?.onBeforeMenuShow&&!1===this.addonOptions?.onBeforeMenuShow(e,n))||(this._menuElm=this.createCommandMenu(i.commandItems,t),this.grid.getContainerNode()?.appendChild(this._menuElm),this.repositionMenu(e,this._menuElm),this.pubSubService.publish("onHeaderMenuAfterMenuShow",n),"function"===typeof this.addonOptions?.onAfterMenuShow&&!1===this.addonOptions?.onAfterMenuShow(e,n)||(e.preventDefault(),e.stopPropagation()))}createCommandMenu(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3?arguments[3]:void 0;const s=n?.command;let r=1===i&&s?s.replace(/\s/g,""):"";r&&(this._subMenuParentId=r),i>1&&(r=this._subMenuParentId);const o=`${this.menuCssClass} slick-menu-level-${i} ${this.gridUid}`,a=document.body.querySelector(`.${this.menuCssClass}.slick-menu-level-${i}${this.gridUidSelector}`);if(a){if(a.dataset.subMenuParent===r)return a;this.disposeSubMenus()}const l=Q("div",{ariaExpanded:"true",ariaLabel:i>1?"SubMenu":"Header Menu",role:"menu",className:o,style:{minWidth:`${this.addonOptions.minWidth}px`}});i>0&&(l.classList.add("slick-submenu"),r&&(l.dataset.subMenuParent=r),this.gridOptions?.darkMode&&l.classList.add("slick-dark-mode"));const d=Q("div",{className:`${this._menuCssPrefix}-command-list`,role:"menu"},l),c={grid:this.grid,column:t,level:i,menu:{commandItems:e}};return n&&i>0&&this.addSubMenuTitleWhenExists(n,d),this.populateCommandOrOptionItems("command",this.addonOptions,d,e,c,this.handleMenuItemCommandClick,this.handleMenuItemMouseOver),i++,l}resetHeaderMenuTranslations(e){e.forEach((e=>{if(e?.header?.menu?.commandItems&&!e.excludeFromHeaderMenu){const t=e.header.menu.commandItems||[];this.extensionUtility.translateMenuItemsFromTitleKey(t)}}))}sortColumn(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(t?.column){const n=t.column,s=this.sharedService.gridOptions.multiColumnSort?this.sortService.getCurrentColumnSorts(n.id+""):[];let r=l.local;s.push({columnId:n.id,sortCol:n,sortAsc:i}),this.sharedService.gridOptions.backendServiceApi?(this.sortService.onBackendSortChanged(e,{multiColumnSort:!0,sortCols:s,grid:this.sharedService.slickGrid}),r=l.remote):this.sharedService.dataView?(this.sortService.onLocalSortChanged(this.sharedService.slickGrid,s),r=l.local):t.grid.onSort.notify(s);const o=s.map((e=>({columnId:e?.sortCol?.id??"",sortAsc:e?.sortAsc??!0})));if(this.sharedService.slickGrid.setSortColumns(o),r){const e=[];o.forEach((t=>{e.push({columnId:`${t.columnId}`,direction:t.sortAsc?"ASC":"DESC"})})),this.sortService.emitSortChanged(r,e)}}}}const Fo="slick-rbe-editmode",Mo="slick-rbe-unsaved-highlight",Lo="action-btns--delete",No="action-btns--edit",Bo="action-btns--update",Ho="action-btns--cancel";class zo{constructor(e,t,i){this.extensionUtility=e,this.pubSubService=t,this.pluginName="RowBasedEdit",this._defaults={actionsColumnLabel:"Actions",allowMultipleRows:!1,columnId:"_slick_rowbasededit_action",columnIndexPosition:-1,reorderable:!1},this._editedRows=new Map,this._currentLang="en",this._translations={},this.onBeforeEditCellHandler=(e,t)=>this._editedRows.has(t.item?.[this.gridOptions.datasetIdPropertyName??"id"]),this._eventHandler=new ii,this._addonOptions=i}get addonOptions(){return this._addonOptions}get gridOptions(){return this._grid.getOptions()||{}}get eventHandler(){return this._eventHandler}init(e,t){this._grid=e,this._gridService=t,this._addonOptions={...this._defaults,...this.addonOptions};const i=this._grid.getData();if(this._eventHandler.subscribe(this._grid.onBeforeEditCell,this.onBeforeEditCellHandler),this.checkOptionsRequirements(this.gridOptions),this.gridOptions.autoEdit||(this._grid.setOptions({autoEdit:!0}),console.warn('[Slickgrid-Universal] The Row Based Edit Plugin works best with the gridOption "autoEdit" enabled, the option has now been set automatically for you.')),this._existingEditCommandHandler=this.gridOptions.editCommandHandler,this._grid.setOptions({editCommandHandler:this.rowBasedEditCommandHandler.bind(this)}),!0===this.gridOptions.enableExcelCopyBuffer){const e=this.gridOptions.excelCopyBufferOptions?.onBeforePasteCell;this._grid.setOptions({excelCopyBufferOptions:{...this.gridOptions.excelCopyBufferOptions,onBeforePasteCell:(t,n)=>{let s=!0;if(e&&(s=e(t,n),!1===s))return!1;const r=i.getItem(n.row),o=this.gridOptions.datasetIdPropertyName??"id";return!(!this._editedRows.has(r[o])||!0!==s)}}})}const n=i.getItemMetadata;i.getItemMetadata=this.updateItemMetadata(n?.bind?.(i)),this._eventHandler.subscribe(this._grid.onSetOptions,this.optionsUpdatedHandler.bind(this)),this._eventHandler.subscribe(i.onRowsOrCountChanged,this.handleAllRowRerender.bind(this)),this.translate()}destroy(){this.dispose()}dispose(){this._eventHandler?.unsubscribeAll(),this.pubSubService?.unsubscribeAll()}create(e,t){if(this._addonOptions={...this._defaults,...t.rowBasedEditOptions},Array.isArray(e)&&t){const i=this.getColumnDefinition();if(!e.some((e=>e.id===i.id))){const n=t?.rowBasedEditOptions?.columnIndexPosition??-1;-1===n?e.push(i):n>0&&nvoid 0!==e.editor)),o=[],a=this.gridOptions.datasetIdPropertyName??"id";n.forEach(((l,d)=>{const c=n[d],h=s[d];if(c!==h||""===h){const n=Array.isArray(i.prevSerializedValue)?r?.[d]:t;if(!n)return;this._grid.invalidate(),i.execute(),this.renderUnsavedCellStyling(e[a],n),o.push(n)}}));const l=this._editedRows.get(e[a]),d=[...l?.editCommands||[]];o.length>0&&d.push(i),this._editedRows.set(e[a],{columns:[...l?.columns||[],...o],editCommands:d,cssStyleKeys:l?.cssStyleKeys||[]})}translate(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._currentLang=this.extensionUtility.translaterService?.getCurrentLanguage()??"en",this._translations[this._currentLang]&&!e||(this._translations[this._currentLang]={btnUpdateTitle:this.getTitleOrDefault("updateButtonTitle","Update the row"),btnEditTitle:this.getTitleOrDefault("editButtonTitle","Edit the Row"),btnDeleteTitle:this.getTitleOrDefault("deleteButtonTitle","Delete the Row"),btnCancelTitle:this.getTitleOrDefault("cancelButtonTitle","Cancel changes of the Row")}),this._translations[this._currentLang]}checkOptionsRequirements(e){if(!e?.enableCellNavigation)throw new Error("[Slickgrid-Universal] Row Based Edit Plugin requires the gridOption cell navigation (enableCellNavigation = true)");if(!e?.editable)throw new Error("[Slickgrid-Universal] Row Based Edit Plugin requires the gridOption editable (editable = true)")}undoRowEdit(e){const t=this.gridOptions.datasetIdPropertyName??"id",i=this._editedRows.get(e[t]),n=this._grid.getData().getRowByItem(e);if(void 0!==n&&i?.editCommands&&i.editCommands.length||li.cancelCurrentEdit()){for(;i.editCommands.length>0;){const e=i.editCommands.pop();e&&e.undo()}i.columns.forEach((e=>{this.removeUnsavedStylingFromCell(e,n)})),i.columns=[],this._grid.invalidate()}}renderUnsavedCellStyling(e,t){if(t){const i=this._grid.getData()?.getRowById(e);if(void 0!==i&&i>=0){const n={[i]:{[t.id]:"slick-rbe-unsaved-cell"}},s=`${Mo}_${[t.id]}${i}`;this._grid.setCellCssStyles(s,n),this._editedRows.get(e)?.cssStyleKeys.push(s)}}}handleAllRowRerender(e,t){this._editedRows.forEach(((e,t)=>{e.cssStyleKeys.forEach((e=>{this._grid.removeCellCssStyles(e)})),e.cssStyleKeys=[],e.columns.forEach((e=>{this.renderUnsavedCellStyling(t,e)}))}))}removeUnsavedStylingFromCell(e,t){const i=`${Mo}_${[e.id]}${t}`;this._grid.removeCellCssStyles(i)}removeUnsavedStylingFromRow(e){this._grid.getColumns().forEach((t=>{this.removeUnsavedStylingFromCell(t,e)}))}optionsUpdatedHandler(e,t){this._addonOptions={...this._defaults,...t.optionsAfter.rowBasedEditOptions}}async onCellClickHandler(e,t){const i=t.dataContext,n=e.target,s=this.gridOptions.datasetIdPropertyName??"id",r=this._editedRows.get(i[s]);if((n.classList.contains(Lo)||n.parentElement?.classList.contains(Lo))&&this._gridService){if(this._addonOptions?.actionButtons?.deleteButtonPrompt&&!window.confirm(this._addonOptions.actionButtons.deleteButtonPrompt))return;this.toggleEditmode(i,!1),this._gridService.deleteItem(i)}else if(n.classList.contains(No)||n.parentElement?.classList.contains(No)){if(!this._addonOptions?.allowMultipleRows&&this._editedRows.size>0)return;"function"===typeof this._addonOptions?.onBeforeEditMode&&this._addonOptions.onBeforeEditMode(t),this.toggleEditmode(i,!0)}else if(n.classList.contains(Bo)||n.parentElement?.classList.contains(Bo)){if(this._addonOptions?.actionButtons?.updateButtonPrompt&&(r?.editCommands.length||0)>0&&!window.confirm(this._addonOptions.actionButtons.updateButtonPrompt))return;if(this._grid.getCellEditor()&&this._grid.getActiveCell()?.row===t.row&&this._grid.getEditController()?.commitCurrentEdit(),this._addonOptions?.onBeforeRowUpdated){if(!0!==await this._addonOptions.onBeforeRowUpdated(t))return}this.removeUnsavedStylingFromRow(t.row),this.toggleEditmode(i,!1)}else if(n.classList.contains(Ho)||n.parentElement?.classList.contains(Ho)){if(this._addonOptions?.actionButtons?.cancelButtonPrompt&&(r?.editCommands.length||0)>0&&!window.confirm(this._addonOptions.actionButtons.cancelButtonPrompt))return;this.undoRowEdit(i),this.toggleEditmode(i,!1)}}actionColumnFormatter(e,t,i,n,s){const r=this.gridOptions,o=this._editedRows.has(s?.[r.datasetIdPropertyName??"id"]),a=this._translations[this._currentLang]??this.translate(),l=document.createDocumentFragment();return l.appendChild(Q("span",{className:`${r.rowBasedEditOptions?.actionButtons?.editButtonClassName||"button-style padding-1px mr-2"} action-btns `+No,title:a.btnEditTitle,style:{display:o?"none":""}})).appendChild(Q("span",{className:r.rowBasedEditOptions?.actionButtons?.iconEditButtonClassName||"mdi mdi-table-edit text-color-primary"})),l.appendChild(Q("span",{className:`${r.rowBasedEditOptions?.actionButtons?.deleteButtonClassName||"button-style padding-1px"} action-btns `+Lo,title:a.btnDeleteTitle,style:{display:o?"none":""}})).appendChild(Q("span",{className:r.rowBasedEditOptions?.actionButtons?.iconDeleteButtonClassName||"mdi mdi-close text-color-danger"})),l.appendChild(Q("span",{className:`${r.rowBasedEditOptions?.actionButtons?.updateButtonClassName||"button-style padding-1px mr-2"} action-btns `+Bo,title:a.btnUpdateTitle,style:{display:o?"":"none"}})).appendChild(Q("span",{className:r.rowBasedEditOptions?.actionButtons?.iconUpdateButtonClassName||"mdi mdi-check-bold text-color-success"})),l.appendChild(Q("span",{className:`${r.rowBasedEditOptions?.actionButtons?.cancelButtonClassName||"button-style padding-1px"} action-btns `+Ho,title:a.btnCancelTitle,style:{display:o?"":"none"}})).appendChild(Q("span",{className:r.rowBasedEditOptions?.actionButtons?.iconCancelButtonClassName||"mdi mdi-cancel text-color-danger"})),l}toggleEditmode(e,t){const i=this.gridOptions.datasetIdPropertyName??"id";t?this._editedRows.set(e[i],{columns:[],editCommands:[],cssStyleKeys:[]}):this._editedRows.delete(e[i]),this._grid.invalidate()}updateItemMetadata(e){return t=>{const i=this._grid.getData().getItem(t);let n={cssClasses:""};if("function"===typeof e){const i=e(t);i&&(n=i)}if(n&&i){const e=this.gridOptions.datasetIdPropertyName??"id";this._editedRows.has(i[e])&&!n.cssClasses.includes(Fo)?n.cssClasses=(n.cssClasses||"")+" "+Fo:!this._editedRows.has(i[e])&&n.cssClasses.includes(Fo)&&(n.cssClasses=n.cssClasses.replace(Fo,""))}return n}}getTitleOrDefault(e,t){const i=this.gridOptions.rowBasedEditOptions?.actionButtons;return i?.[e+"Key"]&&this.extensionUtility.translaterService?.translate?.(i?.[e+"Key"]||"")||i?.[e]||t}}class $o{constructor(e){this.pubSubService=e,this.pluginName="RowMoveManager",this._dragging=!1,this._defaults={autoScroll:!0,columnId:"_move",cssClass:"slick-row-move-column",cancelEditOnDrag:!1,disableRowSelection:!1,hideRowMoveShadow:!0,reorderable:!1,rowMoveShadowMarginTop:0,rowMoveShadowMarginLeft:0,rowMoveShadowOpacity:.9,rowMoveShadowScale:.75,singleRowMove:!1,width:40},this.onBeforeMoveRows=new ti("onBeforeMoveRows"),this.onMoveRows=new ti("onMoveRows"),this._eventHandler=new ii}get addonOptions(){return this._addonOptions}get eventHandler(){return this._eventHandler}get gridOptions(){return this._grid?.getOptions()??{}}init(e,t){this._addonOptions={...this._defaults,...t},this._grid=e,this._canvas=this._grid.getCanvasNode(),ai.addSlickEventPubSubWhenDefined(this.pubSubService,this),"function"===typeof this._addonOptions?.usabilityOverride&&this.usabilityOverride(this._addonOptions.usabilityOverride),this._eventHandler.subscribe(this._grid.onDragInit,this.handleDragInit.bind(this)).subscribe(this._grid.onDragStart,this.handleDragStart.bind(this)).subscribe(this._grid.onDrag,this.handleDrag.bind(this)).subscribe(this._grid.onDragEnd,this.handleDragEnd.bind(this))}dispose(){this._eventHandler?.unsubscribeAll()}create(e,t){if(this._addonOptions={...this._defaults,...t.rowMoveManager},Array.isArray(e)&&t){const i=this.getColumnDefinition();if(!e.some((e=>e.id===i.id))){const n=Array.isArray(e)&&e.find((e=>"selectAndMove"===e?.behavior)),s=n||i,r=t?.rowMoveManager?.columnIndexPosition??0;r>0?e.splice(r,0,s):e.unshift(s),this.pubSubService.publish("onPluginColumnsChanged",{columns:e,pluginName:this.pluginName})}}return this}getColumnDefinition(){const e=String(this._addonOptions?.columnId??this._defaults.columnId);return{id:e,name:"",behavior:"selectAndMove",excludeFromExport:!0,excludeFromColumnPicker:!0,excludeFromGridMenu:!0,excludeFromQuery:!0,excludeFromHeaderMenu:!0,field:e,reorderable:this._addonOptions.reorderable,resizable:!1,width:this._addonOptions.width||40,formatter:this.moveIconFormatter.bind(this)}}usabilityOverride(e){this._usabilityOverride=e}setOptions(e){this._addonOptions={...this._addonOptions,...e}}handleDragInit(e){e.stopImmediatePropagation()}handleDragEnd(e,t){if(this._dragging&&(this._dragging=!1,e.stopImmediatePropagation(),t.guide?.remove(),t.selectionProxy?.remove(),t.clonedSlickRow?.remove(),t.canMove)){const i={grid:this._grid,rows:t.selectedRows,insertBefore:t.insertBefore};"function"===typeof this._addonOptions.onMoveRows&&this._addonOptions.onMoveRows(e instanceof ei?e.getNativeEvent():e,i),this.onMoveRows.notify(i)}}handleDrag(e,t){if(this._dragging){e.stopImmediatePropagation();const i=e.getNativeEvent(),n=(i?.touches?.[0]??i).pageY-ne(this._canvas).top;t.selectionProxy.style.top=n-5+"px",t.selectionProxy.style.display="block",t.clonedSlickRow&&(t.clonedSlickRow.style.top=n-6+"px",t.clonedSlickRow.style.display="block");const s=Math.max(0,Math.min(Math.round(n/(this.gridOptions.rowHeight||0)),this._grid.getDataLength()));if(s!==t.insertBefore){const e={grid:this._grid,rows:t.selectedRows,insertBefore:s};if(!1===this._addonOptions?.onBeforeMoveRows?.(i,e)||!1===this.onBeforeMoveRows.notify(e).getReturnValue()?t.canMove=!1:t.canMove=!0,this._usabilityOverride&&t.canMove){const e=this._grid.getDataItem(s);t.canMove=this.checkUsabilityOverride(s,e,this._grid)}t.canMove?t.guide.style.top=s*(this.gridOptions.rowHeight||0)+"px":t.guide.style.top="-1000px",t.insertBefore=s}}}handleDragStart(e,t){const i=this._grid.getCellFromEvent(e)||{cell:-1,row:-1},n=i.row,s=this._grid.getDataItem(n);if(this.checkUsabilityOverride(n,s,this._grid)){if(this._addonOptions.cancelEditOnDrag&&this._grid.getEditorLock().isActive()&&this._grid.getEditorLock().cancelCurrentEdit(),this._grid.getEditorLock().isActive()||!/move|selectAndMove/.test(this._grid.getColumns()[i.cell].behavior||""))return!1;if(this._dragging=!0,e.stopImmediatePropagation(),!this.addonOptions.hideRowMoveShadow){const e=this._grid.getCellNode(i.row,i.cell)?.closest(".slick-row");e&&(t.clonedSlickRow=e.cloneNode(!0),t.clonedSlickRow.classList.add("slick-reorder-shadow-row"),t.clonedSlickRow.style.display="none",t.clonedSlickRow.style.marginLeft=ae(this._addonOptions?.rowMoveShadowMarginLeft,"0px"),t.clonedSlickRow.style.marginTop=ae(this._addonOptions?.rowMoveShadowMarginTop,"0px"),t.clonedSlickRow.style.opacity=`${this._addonOptions?.rowMoveShadowOpacity??.95}`,t.clonedSlickRow.style.transform=`scale(${this.addonOptions?.rowMoveShadowScale??.75})`,this._canvas.appendChild(t.clonedSlickRow))}let n=this._addonOptions.singleRowMove?[i.row]:this._grid.getSelectedRows();0!==n.length&&n.some((e=>e===i.row))||(n=[i.row],this._addonOptions.disableRowSelection||this._grid.setSelectedRows(n));const s=this.gridOptions.rowHeight;t.selectedRows=n,t.selectionProxy=Q("div",{className:"slick-reorder-proxy",style:{display:"none",position:"absolute",zIndex:"99999",width:`${this._canvas.clientWidth}px`,height:s*n.length+"px"}},this._canvas),t.guide=Q("div",{className:"slick-reorder-guide",style:{position:"absolute",zIndex:"99999",width:`${this._canvas.clientWidth}px`,top:"-1000px"}},this._canvas),t.insertBefore=-1}}checkUsabilityOverride(e,t,i){return"function"!==typeof this._usabilityOverride||this._usabilityOverride(e,t,i)}moveIconFormatter(e,t,i,n,s,r){return this.checkUsabilityOverride(e,s,r)?{addClasses:"cell-reorder dnd",html:Q("div",{className:this._addonOptions.cssClass||""})}:""}}class Uo{get extensionList(){return this._extensionList}get gridOptions(){return this.sharedService.gridOptions||{}}constructor(e,t,i,n,s,r,o,a){this.extensionUtility=e,this.filterService=t,this.pubSubService=i,this.sharedService=n,this.sortService=s,this.treeDataService=r,this.translaterService=o,this.lazyGridService=a,this._extensionCreatedList={},this._extensionList={},this._requireInitExternalExtensions=[]}dispose(){if(this.sharedService.visibleColumns=[],"object"===typeof this._extensionList){const e=Object.keys(this._extensionList);e.forEach((e=>{if(this._extensionList.hasOwnProperty(e)){const t=this._extensionList[e];"function"===typeof t?.instance?.dispose&&t.instance.dispose()}})),e.forEach((e=>{delete this._extensionList[e]}))}this._cellMenuPlugin=null,this._cellExcelCopyManagerPlugin=null,this._checkboxSelectColumn=null,this._contextMenuPlugin=null,this._columnPickerControl=null,this._draggleGroupingPlugin=null,this._gridMenuControl=null,this._groupItemMetadataProviderService=null,this._headerMenuPlugin=null,this._rowMoveManagerPlugin=null,this._rowSelectionModel=null,this._extensionCreatedList=null,this._extensionList={}}addExtensionToList(e,t){this._extensionList[e]=t}getAllColumns(){return this.sharedService.allColumns||[]}getVisibleColumns(){return this.sharedService.visibleColumns||[]}getCreatedExtensionByName(e){if(this._extensionCreatedList?.hasOwnProperty(e))return this._extensionCreatedList[e]}getExtensionByName(e){return this._extensionList?.[e]}getExtensionInstanceByName(e){return this.getExtensionByName(e)?.instance}autoResizeColumns(){this.sharedService.slickGrid.autosizeColumns()}bindDifferentExtensions(){if(this.gridOptions){if(this.gridOptions.enableTranslate&&this.translateItems(this.sharedService.allColumns,"nameKey","name"),this.gridOptions.enableRowBasedEdit){this._rowBasedEdit=this._rowBasedEdit||new zo(this.extensionUtility,this.pubSubService,this.gridOptions.rowBasedEditOptions);const e=this.lazyGridService?.();if(!e)throw new Error("[Slickgrid-Universal] the RowBasedEdit Plugin requires a GridService to be configured and available");this._rowBasedEdit.init(this.sharedService.slickGrid,e),this.gridOptions.rowBasedEditOptions?.onExtensionRegistered&&this.gridOptions.rowBasedEditOptions.onExtensionRegistered(this._rowBasedEdit),this._extensionList[b.rowBasedEdit]={name:b.rowBasedEdit,instance:this._rowBasedEdit}}if(this.gridOptions.enableAutoTooltip){const e=new Xr(this.gridOptions?.autoTooltipOptions);this.sharedService.slickGrid.registerPlugin(e),this._extensionList[b.autoTooltip]={name:b.autoTooltip,instance:e}}if(this.gridOptions.enableExcelCopyBuffer&&(this._cellExcelCopyManagerPlugin=new Qr,this._cellExcelCopyManagerPlugin.init(this.sharedService.slickGrid,this.sharedService.gridOptions.excelCopyBufferOptions),this.gridOptions.excelCopyBufferOptions?.onExtensionRegistered&&this.gridOptions.excelCopyBufferOptions.onExtensionRegistered(this._cellExcelCopyManagerPlugin),this._extensionList[b.cellExternalCopyManager]={name:b.cellExternalCopyManager,instance:this._cellExcelCopyManagerPlugin}),this.gridOptions.enableCellMenu&&(this._cellMenuPlugin=new no(this.extensionUtility,this.pubSubService,this.sharedService),this.gridOptions.cellMenu?.onExtensionRegistered&&this.gridOptions.cellMenu.onExtensionRegistered(this._cellMenuPlugin),this._extensionList[b.cellMenu]={name:b.cellMenu,instance:this._cellMenuPlugin}),!this._rowSelectionModel&&(this.gridOptions.enableRowSelection||this.gridOptions.enableCheckboxSelector||this.gridOptions.enableRowDetailView||this.gridOptions.enableRowMoveManager)){if(!this._rowSelectionModel||!this.sharedService.slickGrid.getSelectionModel()){const e=this.gridOptions.rowSelectionOptions??{};this.gridOptions.enableRowMoveManager&&!1!==this.gridOptions.rowMoveManager?.dragToSelect&&(e.dragToSelect=!0),this._rowSelectionModel=new ao(e),this.sharedService.slickGrid.setSelectionModel(this._rowSelectionModel)}this._extensionList[b.rowSelection]={name:b.rowSelection,instance:this._rowSelectionModel}}if(this.gridOptions.enableCheckboxSelector){this._checkboxSelectColumn=this._checkboxSelectColumn||new ho(this.pubSubService,this.gridOptions.checkboxSelector),this._checkboxSelectColumn.init(this.sharedService.slickGrid);const e=this.getCreatedExtensionByName(b.checkboxSelector),t=e?.instance;t&&(this.gridOptions.checkboxSelector?.onExtensionRegistered&&this.gridOptions.checkboxSelector.onExtensionRegistered(t),this._extensionList[b.checkboxSelector]={name:b.checkboxSelector,instance:this._checkboxSelectColumn})}if(this.gridOptions.enableColumnPicker&&(this._columnPickerControl=new wo(this.extensionUtility,this.pubSubService,this.sharedService),this.gridOptions.columnPicker?.onExtensionRegistered&&this.gridOptions.columnPicker.onExtensionRegistered(this._columnPickerControl),this._extensionList[b.columnPicker]={name:b.columnPicker,instance:this._columnPickerControl}),this.gridOptions.enableContextMenu&&(this._contextMenuPlugin=new Ro(this.extensionUtility,this.pubSubService,this.sharedService,this.treeDataService),this.gridOptions.contextMenu?.onExtensionRegistered&&this.gridOptions.contextMenu.onExtensionRegistered(this._contextMenuPlugin),this._extensionList[b.contextMenu]={name:b.contextMenu,instance:this._contextMenuPlugin}),this.gridOptions.enableDraggableGrouping&&(this._draggleGroupingPlugin&&(this._draggleGroupingPlugin.init(this.sharedService.slickGrid,this.gridOptions.draggableGrouping),this.gridOptions.draggableGrouping?.onExtensionRegistered&&this.gridOptions.draggableGrouping.onExtensionRegistered(this._draggleGroupingPlugin),this._extensionList[b.contextMenu]={name:b.contextMenu,instance:this._draggleGroupingPlugin}),this._extensionList[b.draggableGrouping]={name:b.draggableGrouping,instance:this._draggleGroupingPlugin}),this.gridOptions.enableGridMenu&&(this._gridMenuControl=new uo(this.extensionUtility,this.filterService,this.pubSubService,this.sharedService,this.sortService),this.gridOptions.gridMenu?.onExtensionRegistered&&this.gridOptions.gridMenu.onExtensionRegistered(this._gridMenuControl),this._extensionList[b.gridMenu]={name:b.gridMenu,instance:this._gridMenuControl}),this.gridOptions.enableHeaderButton){const e=new Do(this.extensionUtility,this.pubSubService,this.sharedService);this.gridOptions.headerButton?.onExtensionRegistered&&this.gridOptions.headerButton.onExtensionRegistered(e),this._extensionList[b.headerButton]={name:b.headerButton,instance:e}}if(this.gridOptions.enableHeaderMenu&&(this._headerMenuPlugin=new Po(this.extensionUtility,this.filterService,this.pubSubService,this.sharedService,this.sortService),this.gridOptions.headerMenu?.onExtensionRegistered&&this.gridOptions.headerMenu.onExtensionRegistered(this._headerMenuPlugin),this._extensionList[b.headerMenu]={name:b.headerMenu,instance:this._headerMenuPlugin}),this.gridOptions.enableRowMoveManager){this._rowMoveManagerPlugin=this._rowMoveManagerPlugin||new $o(this.pubSubService),this._rowMoveManagerPlugin.init(this.sharedService.slickGrid,this.gridOptions.rowMoveManager);const e=this.getCreatedExtensionByName(b.rowMoveManager),t=e?.instance;t&&(this._extensionList[b.rowMoveManager]={name:b.rowMoveManager,instance:this._rowMoveManagerPlugin})}this._requireInitExternalExtensions.length&&this._requireInitExternalExtensions.forEach((e=>{e.instance.init(this.sharedService.slickGrid,void 0)}))}}createExtensionsBeforeGridCreation(e,t){const i=[];if(t.enableCheckboxSelector&&(this.getCreatedExtensionByName(b.checkboxSelector)||(this._checkboxSelectColumn=new ho(this.pubSubService,this.sharedService.gridOptions.checkboxSelector),i.push({name:b.checkboxSelector,instance:this._checkboxSelectColumn,columnIndexPosition:t?.checkboxSelector?.columnIndexPosition??i.length}))),t.enableRowMoveManager&&(this.getCreatedExtensionByName(b.rowMoveManager)||(this._rowMoveManagerPlugin=new $o(this.pubSubService),i.push({name:b.rowMoveManager,instance:this._rowMoveManagerPlugin,columnIndexPosition:t?.rowMoveManager?.columnIndexPosition??i.length}))),t.enableRowBasedEdit&&(this.getCreatedExtensionByName(b.rowBasedEdit)||(this._rowBasedEdit=new zo(this.extensionUtility,this.pubSubService),i.push({name:b.rowBasedEdit,instance:this._rowBasedEdit,columnIndexPosition:t?.rowMoveManager?.columnIndexPosition??i.length}))),t.preRegisterExternalExtensions){t.preRegisterExternalExtensions(this.pubSubService).forEach((e=>{i.push(e),this._requireInitExternalExtensions.push(e),this._extensionList[e.name]||this.addExtensionToList(e.name,e)}))}this.createExtensionByTheirColumnIndex(i,e,t),t.enableDraggableGrouping&&(this.getCreatedExtensionByName(b.draggableGrouping)||(this._draggleGroupingPlugin=new Ao(this.extensionUtility,this.pubSubService,this.sharedService),this._draggleGroupingPlugin&&(t.enableColumnReorder=this._draggleGroupingPlugin.setupColumnReorder.bind(this._draggleGroupingPlugin),this._extensionCreatedList[b.draggableGrouping]={name:b.draggableGrouping,instance:this._draggleGroupingPlugin})))}hideColumn(e){if("function"===typeof this.sharedService?.slickGrid?.getColumns){const t=this.sharedService.slickGrid.getColumnIndex(e.id);this.sharedService.visibleColumns=this.removeColumnByIndex(this.sharedService.slickGrid.getColumns(),t),this.sharedService.slickGrid.setColumns(this.sharedService.visibleColumns)}}refreshBackendDataset(e){this.extensionUtility.refreshBackendDataset(e)}removeColumnByIndex(e,t){return Array.isArray(e)?e.filter(((e,i)=>t!==i)):e}translateAllExtensions(e){this.translateCellMenu(),this.translateContextMenu(),this.translateHeaderMenu(),this.translateRowEditPlugin(),this.translateColumnHeaders(e)}translateCellMenu(){this._cellMenuPlugin?.translateCellMenu()}translateColumnPicker(){this._columnPickerControl?.translateColumnPicker()}translateContextMenu(){this._contextMenuPlugin?.translateContextMenu()}translateGridMenu(){this._gridMenuControl?.translateGridMenu()}translateHeaderMenu(){this._headerMenuPlugin?.translateHeaderMenu()}translateRowEditPlugin(){this._rowBasedEdit?.translate()}translateColumnHeaders(e,t){if(this.sharedService&&this.gridOptions&&this.gridOptions.enableTranslate&&(!this.translaterService||!this.translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');e&&this.translaterService?.use&&this.translaterService.getCurrentLanguage()!==e&&this.translaterService.use(e);let i=t;i||(i=this.sharedService.columnDefinitions),this.translateItems(i,"nameKey","name"),this.translateItems(this.sharedService.allColumns,"nameKey","name"),this.translateItems(this.sharedService.allColumns,"columnGroupKey","columnGroup"),this.renderColumnHeaders(i,Array.isArray(t))}renderColumnHeaders(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e;i||(i=this.sharedService.columnDefinitions),Array.isArray(i)&&this.sharedService.slickGrid?.setColumns&&((i.length>this.sharedService.allColumns.length||t)&&(this.sharedService.allColumns=i),this.sharedService.slickGrid.setColumns(i)),this.gridOptions.enableColumnPicker&&this._columnPickerControl&&(this._columnPickerControl.columns=this.sharedService.allColumns,this._columnPickerControl.translateColumnPicker()),this.gridOptions.enableGridMenu&&this._gridMenuControl&&(this._gridMenuControl.columns=this.sharedService.allColumns??[],this._gridMenuControl.recreateGridMenu(),this._gridMenuControl.translateGridMenu())}createExtensionByTheirColumnIndex(e,t,i){e.sort(((e,t)=>(e?.columnIndexPosition??0)-(t?.columnIndexPosition??0))),e.forEach((e=>{const n=e.instance.create(t,i);n&&(this._extensionCreatedList[e.name]={name:e.name,instance:n})}))}translateItems(e,t,i){if(this.gridOptions?.enableTranslate&&!this.translaterService?.translate)throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');this.extensionUtility.translateItems(e,t,i)}}function Vo(e,t,i){if(i&&(e?.hasOwnProperty(i)||t?.hasOwnProperty(i)))return e[i]===t||e===t[i]||e[i]===t[i];if("object"===typeof e&&"object"===typeof t&&Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e.hasOwnProperty(n)&&e[n]!==t[n])return!1;return!0}const Wo=(e,t,i)=>{switch(e.toUpperCase()){case"<":case"LT":return t":case"GT":return t>i;case">=":case"GE":return t>=i;case"!=":case"<>":case"NE":return t!==i;case"=":case"==":case"EQ":return t===i;case"IN":return!(!i||!Array.isArray(i))&&i.includes(t);case"NIN":case"NOT_IN":return!(!i||!Array.isArray(i))&&!i.includes(t);case"IN_CONTAINS":return!(!i||!Array.isArray(i)||"string"!==typeof t)&&i.some((e=>t.split(/[,]+/).map((e=>e.trim())).includes(e)));case"NIN_CONTAINS":case"NOT_IN_CONTAINS":return!(!i||!Array.isArray(i)||"string"!==typeof t)&&!i.some((e=>t.split(/[,]+/).map((e=>e.trim())).includes(e)));case"IN_COLLECTION":return!!(t&&i&&Array.isArray(t)&&Array.isArray(i))&&i.some((e=>t.includes(e)));case"NOT_IN_COLLECTION":return!!(t&&i&&Array.isArray(t)&&Array.isArray(i))&&!i.some((e=>t.includes(e)))}return!0},jo=(e,t)=>{let[i,n]=t;if(void 0===i&&!e.operator)return!0;e.cellValue=void 0===e.cellValue||null===e.cellValue?"":e.cellValue.toString();const s=e?.ignoreAccentOnStringFilterAndSort?Be(e.cellValue,!0):e.cellValue.toLowerCase();if("string"===typeof i&&(i=e?.ignoreAccentOnStringFilterAndSort?Be(i,!0):i.toLowerCase()),"string"===typeof n&&(n=e?.ignoreAccentOnStringFilterAndSort?Be(n,!0):n.toLowerCase()),e.operator===C.startsWithEndsWith&&void 0!==i&&void 0!==n)return function(e,t){let[i,n]=t;return e.startsWith(i)&&e.endsWith(n)}(s,[i,n]);if(void 0!==i&&void 0!==n){let t=e?.operator??e.defaultFilterRangeOperator;t!==C.rangeInclusive&&t!==C.rangeExclusive&&(t=e.defaultFilterRangeOperator);const r=t===C.rangeInclusive,o=Go(r?">=":">",s,i,e.searchInputLastChar),a=Go(r?"<=":"<",s,n,e.searchInputLastChar);return o&&a}return Go(e.operator,s,i,e.searchInputLastChar)};function Go(e,t,i,n){return"*"===e||e===C.endsWith||"*z"===e?t.endsWith(i):""===e&&"*"===n||e===C.startsWith||"a*"===e?t.startsWith(i):""===e||e===C.contains?t.indexOf(i)>-1:"<>"===e||e===C.notContains?-1===t.indexOf(i):Wo(e||"==",t,i)}const Yo=(e,t)=>{const i=parseFloat(e.cellValue),[n,s]=t;if(void 0===n&&!e.operator)return!0;if(void 0!==n&&void 0!==s){let t=e?.operator??e.defaultFilterRangeOperator;t!==C.rangeInclusive&&t!==C.rangeExclusive&&(t=e.defaultFilterRangeOperator);const r=t===C.rangeInclusive,o=Wo(r?">=":">",i,+n),a=Wo(r?"<=":"<",i,+s);return o&&a}return Wo(e.operator||"==",i,+n)};const Ko=(e,t)=>Ne(e.cellValue)===Ne(t);const qo=e=>{const t=e.operator;let i;return i=!Array.isArray(e.cellValue)||"IN_COLLECTION"!==t&&"NOT_IN_COLLECTION"!==t?void 0===e.cellValue||null===e.cellValue?"":`${e.cellValue}`:e.cellValue.length?e.cellValue.map((e=>`${e}`)):[],Wo(t||"IN",i,e.searchTerms||[])};function Xo(e,t){let i;switch(Qo(t)){case"boolean":i=function(e){return Ne(Array.isArray(e)&&e[0]||!1)}(e);break;case"date":i=function(e,t){const i=Array.isArray(e)&&e||[],n=Pt(t||y.dateIso),s=[];if(2===i.length||"string"===typeof i[0]&&i[0].indexOf("..")>0){const e=2===i.length?i:i[0].split(".."),t=Array.isArray(e)&&e[0]||"",r=Array.isArray(e)&&e[1]||"",o=Mt(t,n,!0),a=Mt(r,n,!0);if(!o||!a)return[];s.push(o,a)}else{const e=Mt(i[0],n,!0);if(!e)return[];s.push(e)}return s}(e,t);break;case"number":i=function(e){const t=Array.isArray(e)&&e||[0],i=[];let n,s;if(2===t.length||"string"===typeof t[0]&&t[0].indexOf("..")>0){const e=2===t.length?t:t[0].split("..");n=parseFloat(Array.isArray(e)?e[0]:""),s=parseFloat(Array.isArray(e)?e[1]:"")}else n=parseFloat(t[0]);return Me(n,!0)&&Me(s,!0)?i.push(n,s):Me(n,!0)&&i.push(n),i}(e);break;case"object":i=function(e){return(Array.isArray(e)&&e.length>0?e[0]:"")||""}(e);break;case"string":i=function(e){let t=Array.isArray(e)&&e||[""];const i=[];let n,s;if(1===t.length&&"string"===typeof t[0]){const e=t[0];e.indexOf("..")>0?t=e.split(".."):e.indexOf("*")>0&&e.indexOf("*")0?e[0]:"";n=void 0===t||null===t?"":`${t}`}return void 0!==n&&void 0!==s?i.push(n,s):void 0!==n&&i.push(n),i}(e)}return i}function Qo(e){if(U(e))return"date";switch(e){case y.boolean:return"boolean";case y.integer:case y.float:case y.number:return"number";case y.object:return"object";case y.string:case y.text:case y.password:case y.readonly:default:return"string"}}const Zo=(e,t)=>{if(function(e){switch(e&&e.toUpperCase()||""){case"IN":case"NIN":case"NOT_IN":case"IN_CONTAINS":case"NIN_CONTAINS":case"NOT_IN_CONTAINS":case"IN_COLLECTION":case"NOT_IN_COLLECTION":return!0;default:return!1}}(e.operator))return qo(e);switch(Qo(e.filterSearchType||e.fieldType)){case"boolean":return Ko(e,t);case"date":return function(e,t){const i=Pt(e&&(e.filterSearchType||e.fieldType)||y.dateIso),[n,s]=t,r=Mt(e.cellValue,i,!0);if(!n&&!s||!r)return!1;const o="ISO8601"===i||i.toLowerCase().includes("h")?r.valueOf():Et(new Date(r)).valueOf();if(n&&s){let t=e?.operator??e.defaultFilterRangeOperator;t!==C.rangeInclusive&&t!==C.rangeExclusive&&(t=e.defaultFilterRangeOperator);const i=t===C.rangeInclusive,r=Wo(i?">=":">",o,n.valueOf()),a=Wo(i?"<=":"<",o,s.valueOf());return r&&a}const a="ISO8601"===i||i.toLowerCase().includes("h")?n.valueOf():Et(new Date(n)).valueOf();return Wo(e.operator||"==",o,a)}(e,t||[]);case"number":return Yo(e,t||[]);case"object":return((e,t)=>{if(void 0===t&&!e.operator)return!0;switch((e.operator||"").toUpperCase()){case"!=":case"<>":case"NE":return!Vo(e.cellValue,t,e.dataKey);default:return Vo(e.cellValue,t,e.dataKey)}})(e,t);default:return jo(e,t||[])}};class Jo{constructor(e,t,i,n,s){this.filterFactory=e,this.pubSubService=t,this.sharedService=i,this.backendUtilities=n,this.rxjs=s,this._isFilterFirstRender=!0,this._firstColumnIdRendered="",this._filtersMetadata=[],this._columnFilters={},this._isTreePresetExecuted=!1,this._previousFilters=[],this._onSearchChange=new ti,this._eventHandler=new ii,this.rxjs&&(this.httpCancelRequests$=this.rxjs.createSubject())}get eventHandler(){return this._eventHandler}get isFilterFirstRender(){return this._isFilterFirstRender}get onSearchChange(){return this._onSearchChange}get _gridOptions(){return this._grid?.getOptions()??{}}get _columnDefinitions(){return this._grid?.getColumns()??[]}get _dataView(){return this._grid?.getData()??{}}addRxJsResource(e){this.rxjs=e}init(e){this._grid=e,this._gridOptions&&this._gridOptions.enableTreeData&&this._gridOptions.treeDataOptions&&this._grid.setSortColumns([{columnId:this._gridOptions.treeDataOptions.columnId,sortAsc:!0}])}dispose(){this._eventHandler.unsubscribeAll(),this.httpCancelRequests$&&this.rxjs?.isObservable(this.httpCancelRequests$)&&(this.httpCancelRequests$.next(),this.httpCancelRequests$.complete()),this.disposeColumnFilters(),this._onSearchChange=null}disposeColumnFilters(){if(this.removeAllColumnFiltersProperties(),Array.isArray(this._filtersMetadata)){let e=this._filtersMetadata.pop();for(;e;)"function"===typeof e?.destroy&&e.destroy(),e=this._filtersMetadata.pop()}}bindBackendOnFilter(e){this._filtersMetadata=[],this._eventHandler.subscribe(e.onHeaderRowCellRendered,((e,t)=>{t.column.id===this._firstColumnIdRendered&&(this._isFilterFirstRender=!1),this.addFilterTemplateToHeaderRow(t,this._isFilterFirstRender),""===this._firstColumnIdRendered&&(this._firstColumnIdRendered=t.column.id)})),this.subscribeToOnHeaderRowCellRendered(e),this._onSearchChange&&this._eventHandler.subscribe(this._onSearchChange,this.onBackendFilterChange.bind(this))}bindLocalOnFilter(e){this._filtersMetadata=[],this._dataView.setFilterArgs({columnFilters:this._columnFilters,grid:this._grid,dataView:this._dataView}),this._dataView.setFilter(this.customLocalFilter.bind(this)),this._onSearchChange&&this._eventHandler.subscribe(this._onSearchChange,(async(e,t)=>{const i=t?.clearFilterTriggered??!1;i||await this.emitFilterChanged(l.local,!0),!0===this._gridOptions.enableTreeData&&(this._tmpPreFilteredData=this.preFilterTreeData(this._dataView.getItems(),this._columnFilters)),i||await this.emitFilterChanged(l.local),null!==t.columnId&&this._dataView.refresh(),this._previousFilters=this.extractBasicFilterDetails(this._columnFilters)})),this._eventHandler.subscribe(e.onHeaderRowCellRendered,((e,t)=>{this.addFilterTemplateToHeaderRow(t)})),this.subscribeToOnHeaderRowCellRendered(e)}async clearFilterByColumnId(e,t){await this.pubSubService.publish("onBeforeFilterClear",{columnId:t},0);const i=this._gridOptions.backendServiceApi??!1,n=i?l.remote:l.local,s=Object.keys(this._columnFilters);let r;Array.isArray(s)&&(r=s.find((e=>e===`${t}`)));const o=this._filtersMetadata.find((e=>e.columnDef.id===t));return o?.clear&&o.clear(!0),i&&void 0!==r&&this.onBackendFilterChange(e,{grid:this._grid,columnFilters:this._columnFilters}),await this.emitFilterChanged(n),!0}async clearFilters(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];e&&await this.pubSubService.publish("onBeforeFilterClear",!0,0),this._filtersMetadata.forEach((e=>{e?.clear&&e.clear(!1)})),this.removeAllColumnFiltersProperties(),Array.isArray(this._columnDefinitions)&&this._columnDefinitions.forEach((e=>{e.filter?.searchTerms&&delete e.filter.searchTerms})),this._dataView&&this._grid&&(this._dataView.refresh(),this._grid.invalidate());const t=this._gridOptions.backendServiceApi;if(t&&e){const i={clearFilterTriggered:!0,shouldTriggerQuery:e,grid:this._grid,columnFilters:this._columnFilters},n=t.service.processOnFilterChanged(void 0,i),s=this._gridOptions.pagination?.totalItems??0;this.backendUtilities?.executeBackendCallback(t,n,i,new Date,s,{errorCallback:this.resetToPreviousSearchFilters.bind(this),successCallback:e=>this._previousFilters=this.extractBasicFilterDetails(e.columnFilters),emitActionChangedCallback:this.emitFilterChanged.bind(this)})}else this._previousFilters=this.extractBasicFilterDetails(this._columnFilters);e&&this.pubSubService.publish("onFilterCleared",!0)}customLocalFilter(e,t){const i=t?.grid,n=t?.columnFilters??{},s=this._gridOptions.enableTreeData??!1,r=this._gridOptions.treeDataOptions;if(s&&r){const t=r.collapsedPropName??g.treeDataProperties.COLLAPSED_PROP,i=r.parentPropName??g.treeDataProperties.PARENT_PROP,n=r?.childrenPropName??g.treeDataProperties.CHILDREN_PROP,s=this._gridOptions.datasetIdPropertyName??"id",o=r.autoRecalcTotalsOnFilterChange??!1;let a=!1;if(null!==e[i]){let n=this._dataView.getItemById(e[i]);for(;n;){if(n[t]){if(!o)return!1;a=!0}n=this._dataView.getItemById(n[i])}}if(this._tmpPreFilteredData instanceof Set){const t=this._tmpPreFilteredData.has(e[s]);if(o){const i=M(this.sharedService.hierarchicalDataset,(t=>t[s]===e[s]),n);if(i&&(i.__filteredOut=!t),a)return!1}return t}}else if("object"===typeof n)for(const o of Object.keys(n)){const t=n[o],s=t.columnDef?.filter;if("function"===typeof s?.filterPredicate){if(!s.filterPredicate(e,t))return!1}else{const n=this.preProcessFilterConditionOnDataContext(e,t,i);if("boolean"===typeof n)return n;let s=t?.parsedSearchTerms;if(void 0===s&&(s=Xo(t.searchTerms,t.columnDef.type||y.string),void 0!==s&&(t.parsedSearchTerms=s)),!Zo(n,s))return!1}}return!0}parseFormInputFilterConditions(e,t){const i=Se(!0,[],e)||[];let n=Array.isArray(i)&&1===i.length?i[0]:"";const s=t.columnDef,r=s.filter?.type??s.type??y.string;let o=null;if(r!==y.object){n=void 0===n||null===n?"":`${n}`;o=!1!==(s.autoParseInputFilterOperator??this._gridOptions.autoParseInputFilterOperator)?n.match(/^((.*[^\\*\r\n])[*]{1}(.*[^*\r\n]))|^([<>!=*]{0,2})(.*[^<>!=*])([*]?)$/)||[]:[n,"","","","",n,""]}const a=o?.[2]||"",l=o?.[3]||"";let d=o?.[4]||t.operator,c=o?.[1]||o?.[5]||"";const h=o?.[6]||("*z"===d?"*":"");return"string"===typeof n&&(n=n.replace("'","''"),a&&l?(c=n,d=C.startsWithEndsWith):"*"===d||"*z"===d?d=C.endsWith:"a*"!==d&&"*"!==h||(d=C.startsWith)),Array.isArray(o)&&o.length>=1&&Array.isArray(i)&&1===i.length&&(i[0]=c.length>0&&" "===c.substring(0,1)?c.substring(1):c),{dataKey:s.dataKey,fieldType:r,searchTerms:i||[],operator:d,searchInputLastChar:h,filterSearchType:s.filterSearchType,defaultFilterRangeOperator:this._gridOptions.defaultFilterRangeOperator}}preProcessFilterConditionOnDataContext(e,t,i){const n=t.columnDef,s=t.columnId;let r=i.getColumnIndex(s);if(!n&&this.sharedService&&Array.isArray(this.sharedService.allColumns)&&(r=this.sharedService.allColumns.findIndex((e=>e.field===s))),!n)return!0;if(this._gridOptions.enableRowDetailView){const t=this._gridOptions.rowDetailView&&this._gridOptions.rowDetailView.keyPrefix||"__";e[`${t}isPadding`]&&e[`${t}parent`]&&(e=e[`${t}parent`])}let o=n.filter?.queryField||n.queryFieldFilter||n.queryField||n.field||"";"function"===typeof n.queryFieldNameGetterFn&&(o=n.queryFieldNameGetterFn(e));const a=n.filter?.type??n.type??y.string;let l=e[o];o?.indexOf(".")>=0&&(l=H(e,o));const d=t.operator,c=t.searchTerms||[];if(!c||Array.isArray(c)&&(0===c.length||1===c.length&&d===c[0]))return!0;if(c&&Array.isArray(c)&&a!==y.object)for(let h=0,u=c.length;h{u[e[o]]=e,delete u[e[o]].__used})),"object"===typeof t&&Object.keys(t).forEach((e=>{const i=t[e],n=i?.searchTerms?Se(!0,[],i.searchTerms):[],s=this.parseFormInputFilterConditions(n,i),r=i.columnDef,o=r?.filter?.type??r?.type??y.string,a=Xo(s.searchTerms,o);void 0!==a&&(i.parsedSearchTerms=a)})),e.forEach((e=>{const i=e[r];let g=!0;for(const n of Object.keys(t)){const r=t[n],a=this.preProcessFilterConditionOnDataContext(e,r,this._grid);if(a){const t=r?.parsedSearchTerms,n="boolean"===typeof a?a:Zo(a,t);if(n&&h&&i&&r.columnId===d){m.set(e[o],!0);break}if(n||!c&&!0===m.get(e[s])){if(i&&r.columnId===d&&m.set(e[o],!0),n||!c&&r.columnId===d)continue}else i&&!0!==m.get(e[s])&&r.columnId!==d&&m.set(e[o],!1)}g=!1}if(g){p.add(e[o]);let t=u[e[s]]??!1;const i=!l;for(!this._isTreePresetExecuted&&Array.isArray(a)&&a.some((e=>e.itemId===t.id&&e.isCollapsed===i))&&(t[n]=i);t;)t.__used??p.add(t[o]),u[t[o]].__used=!0,t=u[t[s]]??!1}}))),this._isTreePresetExecuted=!0,p}getColumnFilters(){return this._columnFilters}getPreviousFilters(){return this._previousFilters}getFiltersMetadata(){return this._filtersMetadata}getCurrentLocalFilters(){const e=[];if(this._columnFilters)for(const t of Object.keys(this._columnFilters)){const i=this._columnFilters[t],n={columnId:t||""},s=this.sharedService.allColumns.find((e=>e.id===n.columnId)),r=s?.filter?.emptySearchTermReturnAllValues??!0;i?.searchTerms&&(n.searchTerms=i.searchTerms),i.operator&&(n.operator=i.operator),i.targetSelector&&(n.targetSelector=i.targetSelector),Array.isArray(n.searchTerms)&&n.searchTerms.length>0&&(!r||""!==n.searchTerms[0])&&e.push(n)}return e}emitFilterChanged(e){const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"onBeforeFilterChange":"onFilterChanged";if(e===l.remote&&this._gridOptions.backendServiceApi){let e=[];const i=this._gridOptions.backendServiceApi.service;return i?.getCurrentFilters&&(e=i.getCurrentFilters()),this.pubSubService.publish(t,e)}if(e===l.local)return this.pubSubService.publish(t,this.getCurrentLocalFilters())}async onBackendFilterChange(e,t){const i=t?.shouldTriggerQuery;if(i&&await this.emitFilterChanged(l.remote,!0),!t||!t.grid)throw new Error('Something went wrong when trying to bind the "onBackendFilterChange(event, args)" function, it seems that "args" is not populated correctly');const n=this._gridOptions.backendServiceApi;if(!n||!n.process||!n.service)throw new Error('BackendServiceApi requires at least a "process" function and a "service" defined');const s=new Date;if(n.preProcess&&n.preProcess(),i){const i=await n.service.processOnFilterChanged(e,t),r=this._gridOptions.pagination?.totalItems??0;this.backendUtilities?.executeBackendCallback(n,i,t,s,r,{errorCallback:this.resetToPreviousSearchFilters.bind(this),successCallback:e=>this._previousFilters=this.extractBasicFilterDetails(e.columnFilters),emitActionChangedCallback:this.emitFilterChanged.bind(this),httpCancelRequestSubject:this.httpCancelRequests$})}}populateColumnFilterSearchTermPresets(e){return Array.isArray(e)&&(this._columnDefinitions.forEach((t=>{t.filter?.searchTerms&&delete t.filter.searchTerms;const i=e.find((e=>e.columnId===t.id));i&&Array.isArray(i?.searchTerms)&&(t.filter=t.filter||{},t.filter.operator=i.operator||t.filter.operator||"",t.filter.searchTerms=i.searchTerms)})),this._gridOptions.enableTreeData&&this.refreshTreeDataFilters(),this._previousFilters=this.extractBasicFilterDetails(this._columnFilters)),this._columnDefinitions}refreshTreeDataFilters(e){const t=e??this._dataView?.getItems()??[];this._dataView&&this._gridOptions.enableTreeData&&t.length>0?(this._tmpPreFilteredData=this.preFilterTreeData(t,this._columnFilters),this._dataView.refresh()):0===t.length&&Array.isArray(this.sharedService.hierarchicalDataset)&&this.sharedService.hierarchicalDataset.length>0&&queueMicrotask((()=>this.refreshTreeDataFilters()))}disableFilterFunctionality(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=!this._gridOptions.enableFiltering;i!==e&&(t&&e&&this.clearFilters(),this.disableAllFilteringCommands(e),this._grid.setOptions({enableFiltering:i},!1,!0),this._grid.setHeaderRowVisibility(i),this._gridOptions.enableFiltering=!e,this.sharedService.gridOptions=this._gridOptions,this._grid.setColumns(this.sharedService.columnDefinitions))}resetToPreviousSearchFilters(){this.updateFilters(this._previousFilters,!1,!1,!1)}toggleFilterFunctionality(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=this._gridOptions.enableFiltering;this.disableFilterFunctionality(t,e)}toggleHeaderFilterRow(){let e=this._gridOptions.showHeaderRow??!1;e=!e,this._grid.setHeaderRowVisibility(e),!0===e&&this._grid.setColumns(this.sharedService.columnDefinitions)}setSortColumnIcons(e){this._grid&&Array.isArray(e)&&this._grid.setSortColumns(e)}async updateFilters(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this._filtersMetadata||0===this._filtersMetadata.length||!this._gridOptions||!this._gridOptions.enableFiltering)throw new Error('[Slickgrid-Universal] in order to use "updateFilters" method, you need to have Filterable Columns defined in your grid and "enableFiltering" set in your Grid Options');if(Array.isArray(e)){this.clearFilters(!1),e.forEach((e=>{const t=this._filtersMetadata.find((t=>e.columnId===t.columnDef.id));if(e&&t){const i=e.operator||t.defaultOperator;this.updateColumnFilters(e.searchTerms,t.columnDef,i),t.setValues(e.searchTerms||[],i),(n||this._gridOptions.enableTreeData)&&this.callbackSearchEvent(void 0,{columnDef:t.columnDef,operator:i,searchTerms:e.searchTerms,shouldTriggerQuery:!0,forceOnSearchChangeEvent:!0})}}));const s=this._gridOptions.backendServiceApi,r=s?l.remote:l.local;if(t&&await this.emitFilterChanged(r,!0),this._dataView.refresh(),s){const t=s?.service;t?.updateFilters&&(t.updateFilters(e,!0),i&&this.backendUtilities?.refreshBackendDataset(this._gridOptions))}t&&await this.emitFilterChanged(r)}return!0}async updateSingleFilter(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=this.sharedService.allColumns.find((t=>t.id===e.columnId));if(n&&e.columnId){this._columnFilters={};const s=n.filter?.emptySearchTermReturnAllValues??!0;Array.isArray(e.searchTerms)&&(e.searchTerms.length>1||1===e.searchTerms.length&&(!s||""!==e.searchTerms[0]))&&(this._columnFilters[e.columnId]={columnId:e.columnId,operator:e.operator,searchTerms:e.searchTerms,columnDef:n,type:n.type??y.string});const r=this._gridOptions.backendServiceApi,o=r?l.remote:l.local;if(t&&await this.emitFilterChanged(o,!0),r){const e=r?.service;e?.updateFilters&&(e.updateFilters(this._columnFilters,!0),i&&this.backendUtilities?.refreshBackendDataset(this._gridOptions))}else this._dataView.setFilterArgs({columnFilters:this._columnFilters,grid:this._grid}),this._gridOptions.enableTreeData&&this.refreshTreeDataFilters(),this._dataView.refresh();t&&await this.emitFilterChanged(o)}return!0}drawFilterTemplate(e,t){let i;if("string"===typeof t){if(i=document.querySelector(t),null===i)return null}else i=t;const n="string"===typeof e?this.sharedService.allColumns.find((t=>t.id===e)):e;if("selector"!==(n?.id??"")&&n?.filterable){let e,t;const s=this.filterFactory.createFilter(n.filter);t=n&&n.filter&&n.filter.operator||s&&s.operator,this._columnFilters[n.id]?(e=this._columnFilters[n.id].searchTerms||void 0,t=this._columnFilters[n.id].operator||void 0):n.filter&&(e=n.filter.searchTerms||void 0,this.updateColumnFilters(e,n,t));const r={grid:this._grid,operator:t,searchTerms:e,columnDef:n,filterContainerElm:i,callback:this.callbackSearchEvent.bind(this)};return s&&(s.init(r),e&&s.setValues&&s.setValues(e,t)),s}return null}addFilterTemplateToHeaderRow(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=e.column;if("selector"!==(i?.id??"")&&i?.filterable&&!i?.hidden){let n,s;const r=this.filterFactory.createFilter(i.filter);s=i&&i.filter&&i.filter.operator||r&&r.operator,this._columnFilters[i.id]?(n=this._columnFilters[i.id].searchTerms||void 0,s=this._columnFilters[i.id].operator||void 0):i.filter&&(n=i.filter.searchTerms||void 0,this.updateColumnFilters(n,i,s));const o={grid:this._grid,operator:s,searchTerms:n,columnDef:i,filterContainerElm:e.node,callback:this.callbackSearchEvent.bind(this)};if(r&&o.filterContainerElm){r.init(o,t);const e=this._filtersMetadata.findIndex((e=>r.columnDef.id===e.columnDef.id));-1===e?this._filtersMetadata.push(r):this._filtersMetadata[e]=r,n&&r.setValues&&r.setValues(n,s)}}}callbackSearchEvent(e,t){if(t){const i=e?.target?e.target.value:void 0,n=t.searchTerms&&Array.isArray(t.searchTerms)?t.searchTerms:i?[i]:void 0,s=t.columnDef||null,r=s?.id??"",o=s?.filter?.type??s?.type??y.string,a=t.operator||void 0,l=n&&Array.isArray(n),d=l&&n&&n.length,c={...this._columnFilters},h=s.filter?.emptySearchTermReturnAllValues??!0;let u;if(s&&r)if(!l||0===d||1===d&&Array.isArray(n)&&h&&""===n[0])delete this._columnFilters[r];else{const t=`${r}`,i={columnId:t,columnDef:s,parsedSearchTerms:[],type:o,targetSelector:this.getSelectorStringFromElement(e?.target)},l=this.parseFormInputFilterConditions(n,i);i.operator=a||l.operator||j(o),u=Xo(l.searchTerms,o),void 0!==u&&(i.parsedSearchTerms=u),i.searchTerms=l.searchTerms||[],this._columnFilters[t]=i}const p=e&&"function"!==typeof e.isPropagationStopped?Se({},new ei,e):e,m=e?.key;if(this._onSearchChange&&(t.forceOnSearchChangeEvent||"Enter"===m||!jt(c,this._columnFilters))){const i={clearFilterTriggered:t.clearFilterTriggered,shouldTriggerQuery:t.shouldTriggerQuery,columnId:r,columnDef:s,columnFilters:this._columnFilters,operator:a||j(o),searchTerms:n,parsedSearchTerms:u,grid:this._grid,target:e?.target};!1===this.pubSubService.publish("onBeforeSearchChange",i)?this._gridOptions.resetFilterSearchValueAfterOnBeforeCancellation&&this.resetToPreviousSearchFilters():this._onSearchChange.notify(i,p)}}}disableAllFilteringCommands(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=this._grid.getColumns();t.forEach((t=>{t?.header?.menu&&t.header.menu.commandItems?.forEach((t=>{if(t&&"string"!==typeof t){"clear-filter"===t.command&&(t.hidden=e)}}))}));const i=this._gridOptions.gridMenu?.commandItems;return i&&i.forEach((t=>{if(t&&"string"!==typeof t){const i=t.command;"clear-filter"!==i&&"toggle-filter"!==i||(t.hidden=e)}})),t}extractBasicFilterDetails(e){const t=[];if(e&&"object"===typeof e)for(const i of Object.keys(e)){const{operator:n,searchTerms:s}=e[`${i}`];t.push({columnId:i,operator:n,searchTerms:s})}return t}getSelectorStringFromElement(e){return e?.localName?e?.className?`${e.localName}.${Array.from(e.classList).join(".")}`:e.localName:""}removeAllColumnFiltersProperties(){"object"===typeof this._columnFilters&&Object.keys(this._columnFilters).forEach((e=>{e&&this._columnFilters[e]&&delete this._columnFilters[e]}))}subscribeToOnHeaderRowCellRendered(e){this._eventHandler.subscribe(e.onBeforeHeaderRowCellDestroy,((e,t)=>{const i=this._filtersMetadata.find((e=>e.columnDef.id===t.column.id));i?.destroy?.()}))}updateColumnFilters(e,t,i){const n=t.filter?.type??t.type??y.string,s=Xo(e,n);e&&t&&(this._columnFilters[t.id]={columnId:t.id,columnDef:t,searchTerms:e,operator:i,parsedSearchTerms:s,type:n})}}const ea={skipError:!1,triggerEvent:!0},ta={highlightRow:!0,resortGrid:!1,selectRow:!1,scrollRowIntoView:!0,skipError:!1,triggerEvent:!0},ia={highlightRow:!1,selectRow:!1,scrollRowIntoView:!1,skipError:!1,triggerEvent:!0},na={applySetColumns:!0,autoResizeColumns:!0,triggerEvent:!0,hideFromColumnPicker:!1,hideFromGridMenu:!1},sa={autoResizeColumns:!0,triggerEvent:!0};class ra{constructor(e,t,i,n,s,r,o){this.gridStateService=e,this.filterService=t,this.pubSubService=i,this.paginationService=n,this.sharedService=s,this.sortService=r,this.treeDataService=o}get _dataView(){return this._grid?.getData()}get _gridOptions(){return this._grid?.getOptions()??{}}dispose(){this._rowSelectionPlugin?.dispose()}init(e){this._grid=e}clearAllFiltersAndSorts(){this.sortService&&this.sortService.clearSorting&&this.sortService.clearSorting(!1),this.filterService&&this.filterService.clearFilters&&this.filterService.clearFilters()}clearPinning(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=[...this.sharedService.visibleColumns];this.sharedService.slickGrid.setOptions({frozenColumn:-1,frozenRow:-1,frozenBottom:!1,enableMouseWheelScrollHandler:!1}),e&&Array.isArray(t)&&this.sharedService.slickGrid.setColumns(t)}setPinning(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];Le(e)?this.clearPinning():(this.sharedService.slickGrid.setOptions(e,i,n),this.sharedService.gridOptions={...this.sharedService.gridOptions,...e}),t&&this.sharedService.slickGrid.autosizeColumns()}getAllColumnDefinitions(){return this.sharedService.allColumns}getVisibleColumnDefinitions(){return this.sharedService.visibleColumns}getColumnFromEventArguments(e){if(!e||!e.grid||!e.grid.getColumns||!e.grid.getDataItem)throw new Error("[Slickgrid-Universal] To get the column definition and data, we need to have these arguments passed as objects (row, cell, grid)");return{row:e.row,cell:e.cell,columnDef:e.grid.getColumns()[e.cell],dataContext:e.grid.getDataItem(e.row),dataView:this._dataView,grid:this._grid}}getDataItemByRowNumber(e){if(!this._grid||"function"!==typeof this._grid.getDataItem)throw new Error('[Slickgrid-Universal] We could not find SlickGrid Grid object or it\'s "getDataItem" method');return this._grid.getDataItem(e)}getDataItemByRowIndex(e){if(!this._grid||"function"!==typeof this._grid.getDataItem)throw new Error('[Slickgrid-Universal] We could not find SlickGrid Grid object and/or "getDataItem" method');return this._grid.getDataItem(e)}getDataItemByRowIndexes(e){if(!this._grid||"function"!==typeof this._grid.getDataItem)throw new Error('[Slickgrid-Universal] We could not find SlickGrid Grid object and/or "getDataItem" method');const t=[];return Array.isArray(e)&&e.forEach((e=>{t.push(this._grid.getDataItem(e))})),t}getSelectedRows(){if(!this._grid||"function"!==typeof this._grid.getSelectedRows)throw new Error('[Slickgrid-Universal] We could not find SlickGrid Grid object and/or "getSelectedRows" method');return this._grid.getSelectedRows()}getSelectedRowsDataItem(){if(!this._grid||"function"!==typeof this._grid.getSelectedRows)throw new Error('[Slickgrid-Universal] We could not find SlickGrid Grid object and/or "getSelectedRows" method');const e=this._grid.getSelectedRows();return this.getDataItemByRowIndexes(e)}hideColumnById(e,t){if(this._grid){t={...na,...t};const i=this._grid.getColumns(),n=i.findIndex((t=>t.id===e));if(n>=0){const s=Ee(i,n);t?.applySetColumns&&(this.sharedService.visibleColumns=s,this._grid.setColumns(s));const r=this.sharedService.allColumns.findIndex((t=>t.id===e));return r&&(t?.hideFromColumnPicker&&(this.sharedService.allColumns[r].excludeFromColumnPicker=!0),t?.hideFromGridMenu&&(this.sharedService.allColumns[r].excludeFromGridMenu=!0)),this.executeVisibilityCommands(t,["onHeaderMenuHideColumns"],s),n}}return-1}hideColumnByIds(e,t){if(Array.isArray(e)){const i=this._grid.getColumns().filter((t=>!e.includes(t.id)));t={...na,...t};for(const n of e)this.hideColumnById(n,{...t,triggerEvent:!1,applySetColumns:!1,autoResizeColumns:!1});this.sharedService.visibleColumns=i,this._grid.setColumns(i),this.executeVisibilityCommands(t,["onHeaderMenuHideColumns","onHideColumns"],i)}}showColumnByIds(e,t){if(this._grid){t={...sa,...t};const i=this.sharedService.allColumns.filter((t=>e.includes(t.id)));this._grid.setColumns(i),this.sharedService.visibleColumns=i,this.executeVisibilityCommands(t,["onShowColumns"],this.sharedService.visibleColumns)}}executeVisibilityCommands(e,t,i){e?.autoResizeColumns&&this._grid.autosizeColumns(),e?.triggerEvent&&t.forEach((e=>this.pubSubService.publish(e,{columns:i})))}highlightRow(e,t){this._grid.getSelectionModel()||(this._rowSelectionPlugin=new ao(this._gridOptions.rowSelectionOptions),this._grid.setSelectionModel(this._rowSelectionPlugin)),t||=this._gridOptions.rowHighlightDuration,Array.isArray(e)?e.forEach((e=>this._grid.highlightRow(e))):this._grid.highlightRow(e,t)}setSelectedRow(e){this._grid?.setSelectedRows&&this._grid.setSelectedRows([e])}setSelectedRows(e){this._grid?.setSelectedRows&&this._grid.setSelectedRows(e)}renderGrid(){"function"===typeof this._grid?.invalidate&&this._grid.invalidate()}resetGrid(e){if(this.clearPinning(!1),this._grid){const t=this.sharedService.allColumns||[];Array.isArray(t)&&t.length>0&&(this._grid.setColumns(t),this._gridOptions?.enableAutoSizeColumns&&this._grid.autosizeColumns(),this.gridStateService.resetColumns(e))}"function"===typeof this.filterService?.clearFilters&&this.filterService.clearFilters(),"function"===typeof this.sortService?.clearSorting&&this.sortService.clearSorting()}addItem(e,t){const i={...ta,...t};if(!i?.skipError&&(!this._grid||!this._gridOptions||!this._dataView))throw new Error("[Slickgrid-Universal] We could not find SlickGrid Grid, DataView objects");const n=this._gridOptions.datasetIdPropertyName||"id";if(!i?.skipError&&(!e||!e.hasOwnProperty(n)))throw new Error(`[Slickgrid-Universal] Adding an item requires the item to include an "${n}" property`);if(this._gridOptions?.enableTreeData&&"top"===t?.position)throw new Error('[Slickgrid-Universal] Please note that `addItem({ position: "top" })` is not supported when used with Tree Data because of the extra complexity.');const s=i?.position;"bottom"===s||this._gridOptions?.enableTreeData?this._dataView.addItem(e):this._dataView.insertItem(0,e);let r=0;const o=e?.[n]??"";this._gridOptions?.enableTreeData?(this.invalidateHierarchicalDataset(),r=this._dataView.getRowById(o),i.scrollRowIntoView&&this._grid.scrollRowIntoView(r??0,!1)):i.resortGrid?(this._dataView.reSort(),r=this._dataView.getRowById(o)):(r="bottom"===s?this._dataView.getRowById(o):0,i.scrollRowIntoView&&this._grid.scrollRowIntoView(r??0)),i.highlightRow&&void 0!==r&&this.highlightRow(r),void 0!==r&&i.selectRow&&this._gridOptions&&(this._gridOptions.enableCheckboxSelector||this._gridOptions.enableRowSelection)&&this.setSelectedRow(r),i.triggerEvent&&this.pubSubService.publish("onItemAdded",e);return!this._gridOptions?.backendServiceApi&&this._gridOptions.enablePagination&&("bottom"===s?this.paginationService.goToLastPage():this.paginationService.goToFirstPage()),r}addItems(e,t){const i={...ta,...t},n=this._gridOptions.datasetIdPropertyName||"id",s=i?.position,r=[];if(!Array.isArray(e))return[this.addItem(e,i)||0];if(this._dataView.beginUpdate(!0),"bottom"===s||this._gridOptions?.enableTreeData?this._dataView.addItems(e):this._dataView.insertItems(0,e),this._dataView.endUpdate(),this._gridOptions?.enableTreeData){this.invalidateHierarchicalDataset();const t=e[0]?.[n]??"",s=this._dataView.getRowById(t);i.scrollRowIntoView&&this._grid.scrollRowIntoView(s??0,!1)}else i.resortGrid&&this._dataView.reSort();return s&&i.scrollRowIntoView&&!this._gridOptions?.enableTreeData&&("bottom"===s?this._grid.navigateBottom():this._grid.navigateTop()),e.forEach((e=>r.push(this._dataView.getRowById(e[n])))),i.highlightRow&&this.highlightRow(r),i.selectRow&&this._gridOptions&&(this._gridOptions.enableCheckboxSelector||this._gridOptions.enableRowSelection)&&this.setSelectedRows(r),i.triggerEvent&&this.pubSubService.publish("onItemAdded",e),r}deleteItem(e,t){t={...ea,...t};const i=this._gridOptions.datasetIdPropertyName||"id";if(!t?.skipError&&(!e||!e.hasOwnProperty(i)))throw new Error(`[Slickgrid-Universal] Deleting an item requires the item to include an "${i}" property`);return this.deleteItemById(e[i],t)}deleteItems(e,t){t={...ea,...t};const i=this._gridOptions.datasetIdPropertyName||"id";if(!Array.isArray(e))return this.deleteItem(e,t),[e[i]];this._dataView.beginUpdate(!0);const n=[];return e.forEach((e=>{void 0!==e?.[i]&&n.push(e[i])})),this._dataView.deleteItems(n),this._dataView.endUpdate(),t.triggerEvent&&this.pubSubService.publish("onItemDeleted",e),n}deleteItemById(e,t){if(t={...ea,...t},!t?.skipError&&(null===e||void 0===e))throw new Error('[Slickgrid-Universal] Cannot delete a row without a valid "id"');return!(this.gridStateService&&this.gridStateService.needToPreserveRowSelection()||!1)&&this._grid&&this._gridOptions&&(this._gridOptions.enableCheckboxSelector||this._gridOptions.enableRowSelection)&&this.setSelectedRows([]),this._dataView.deleteItem(e),t.triggerEvent&&this.pubSubService.publish("onItemDeleted",e),e}deleteItemByIds(e,t){if(t={...ea,...t},Array.isArray(e)){this._dataView.beginUpdate(!0);for(let t=0;t{const t=e&&e.hasOwnProperty(i)?e[i]:void 0;if(s.push(t),void 0!==this._dataView.getIdxById(t)){const e=this._dataView.getRowById(t);void 0!==e&&(n.push(e),this._grid.updateRow(e))}})),this._dataView.updateItems(s,e),this._dataView.endUpdate(),this._gridOptions?.enableTreeData&&this.invalidateHierarchicalDataset(),t.highlightRow&&this.highlightRow(n),t.selectRow&&this._gridOptions&&(this._gridOptions.enableCheckboxSelector||this._gridOptions.enableRowSelection)&&this.setSelectedRows(n),t.triggerEvent&&this.pubSubService.publish("onItemUpdated",e),n}updateItemById(e,t,i){if(i={...ia,...i},!i?.skipError&&void 0===e)throw new Error('[Slickgrid-Universal] Cannot update a row without a valid "id"');const n=this._dataView.getRowById(e);if(!i?.skipError&&!t&&!this._gridOptions.enablePagination)throw new Error(`[Slickgrid-Universal] The item to update in the grid was not found with id: ${e}`);return void 0!==this._dataView.getIdxById(e)&&(this._dataView.updateItem(e,t),void 0!==n&&this._grid.updateRow(n),this._gridOptions?.enableTreeData&&this.invalidateHierarchicalDataset(),i.scrollRowIntoView&&void 0!==n&&this._grid.scrollRowIntoView(n),i.highlightRow&&void 0!==n&&this.highlightRow(n),void 0!==n&&i.selectRow&&this._gridOptions&&(this._gridOptions.enableCheckboxSelector||this._gridOptions.enableRowSelection)&&this.setSelectedRow(n),i.triggerEvent&&this.pubSubService.publish("onItemUpdated",t)),n}upsertItem(e,t){t={...ta,...t};const i=this._gridOptions.datasetIdPropertyName||"id",n=e&&e.hasOwnProperty(i)?e[i]:void 0;if(!t?.skipError&&void 0===n)throw new Error(`[Slickgrid-Universal] Calling Upsert of an item requires the item to include an "${i}" property`);return this.upsertItemById(n,e,t)}upsertItems(e,t){if(t={...ta,...t},!Array.isArray(e))return[this.upsertItem(e,t)];this._dataView.beginUpdate(!0);const i=[];e.forEach((e=>{i.push(this.upsertItem(e,{...t,highlightRow:!1,resortGrid:!1,selectRow:!1,triggerEvent:!1}))})),this._dataView.endUpdate();const n=i.map((e=>void 0!==e.added?e.added:e.updated));if(t.highlightRow&&this.highlightRow(n),t.selectRow&&this._gridOptions&&(this._gridOptions.enableCheckboxSelector||this._gridOptions.enableRowSelection)&&this.setSelectedRows(n),t.triggerEvent){this.pubSubService.publish("onItemUpserted",e);const t=i.filter((e=>void 0!==e.added));Array.isArray(t)&&t.length>0&&this.pubSubService.publish("onItemAdded",t);const n=i.filter((e=>void 0!==e.updated));Array.isArray(n)&&n.length>0&&this.pubSubService.publish("onItemUpdated",n)}return i}upsertItemById(e,t,i){let n,s,r=!1;if(i={...ta,...i},!i?.skipError&&void 0===e&&!this.hasRowSelectionEnabled())throw new Error('[Slickgrid-Universal] Calling Upsert of an item requires the item to include a valid and unique "id" property');return void 0===this._dataView.getRowById(e)?(n=this.addItem(t,i),r=!0):(s=this.updateItem(t,{highlightRow:i.highlightRow,selectRow:i.selectRow,triggerEvent:i.triggerEvent}),r=!1),i.triggerEvent&&(this.pubSubService.publish("onItemUpserted",t),r?this.pubSubService.publish("onItemAdded",t):this.pubSubService.publish("onItemUpdated",t)),{added:n,updated:s}}invalidateHierarchicalDataset(e){if(this._gridOptions?.enableTreeData&&this.treeDataService){const t=e??this._dataView.getItems(),i=this.sortService.getCurrentColumnSorts(),n=this.treeDataService.convertFlatParentChildToTreeDatasetAndSort(t||[],this.sharedService.allColumns,this._gridOptions,i);this.sharedService.hierarchicalDataset=n.hierarchical,this.filterService.refreshTreeDataFilters(e),this._dataView.setItems(n.flat),this._grid.invalidate()}}hasRowSelectionEnabled(){const e=this._grid.getSelectionModel();return!(!this._gridOptions.enableRowSelection&&!this._gridOptions.enableCheckboxSelector)&&!!e}}class oa{get eventHandler(){return this._eventHandler}constructor(){this._eventHandler=new ii}dispose(){this._eventHandler.unsubscribeAll()}bindOnBeforeEditCell(e){const t=e?.getData();this._eventHandler.subscribe(e.onBeforeEditCell,((i,n)=>{if(!i||!n||!e||void 0===n.cell||!e.getColumns||!e.getDataItem)return;const s=e.getColumns()[n.cell];if("function"===typeof s.onBeforeEditCell){const r={row:n.row,cell:n.cell,dataView:t,grid:e,columnDef:s,dataContext:e.getDataItem(n.row)};s.onBeforeEditCell(i instanceof ei?i.getNativeEvent():i,r)}}))}bindOnCellChange(e){const t=e?.getData();this._eventHandler.subscribe(e.onCellChange,((i,n)=>{if(!i||!n||!e||void 0===n.cell||!e.getColumns||!e.getDataItem)return;const s=e.getColumns()[n.cell];if("function"===typeof s.onCellChange){const r={row:n.row,cell:n.cell,dataView:t,grid:e,columnDef:s,dataContext:e.getDataItem(n.row)};s.onCellChange(i instanceof ei?i.getNativeEvent():i,r)}}))}bindOnClick(e){const t=e?.getData();this._eventHandler.subscribe(e.onClick,((i,n)=>{if(!i||!n||!e||void 0===n.cell||!e.getColumns||!e.getDataItem)return;const s=e.getColumns()[n.cell];if("function"===typeof s.onCellClick){const r={row:n.row,cell:n.cell,dataView:t,grid:e,columnDef:s,dataContext:e.getDataItem(n.row)};s.onCellClick(i instanceof ei?i.getNativeEvent():i,r)}}))}}class aa{constructor(e,t,i,n,s,r){this.extensionService=e,this.filterService=t,this.pubSubService=i,this.sharedService=n,this.sortService=s,this.treeDataService=r,this._columns=[],this._subscriptions=[],this._selectedRowIndexes=[],this._selectedRowDataContextIds=[],this._wasRecheckedAfterPageChange=!0,this._eventHandler=new ii}get _dataView(){return this._grid?.getData()??{}}get _gridOptions(){return this._grid?.getOptions()??{}}get selectedRowDataContextIds(){return this._selectedRowDataContextIds}set selectedRowDataContextIds(e){this._selectedRowDataContextIds=e}init(e){this._grid=e,this.subscribeToAllGridChanges(e)}dispose(){this._columns=[],this._eventHandler.unsubscribeAll(),this.pubSubService.unsubscribeAll(this._subscriptions)}changeColumnsArrangement(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(Array.isArray(e)&&e.length>0){const n=this.getAssociatedGridColumns(this._grid,e);if(n&&Array.isArray(n)&&n.length>0){if(Array.isArray(this.sharedService.allColumns)){const e=[];if(this._gridOptions.enableCheckboxSelector){const t=this._gridOptions?.checkboxSelector?.columnIndexPosition??0;e.push({columnId:"_checkbox_selector",columnIndexPosition:t})}if(this._gridOptions.enableRowDetailView){const t=this._gridOptions?.rowDetailView?.columnIndexPosition??0;e.push({columnId:"_detail_selector",columnIndexPosition:t})}if(this._gridOptions.enableRowMoveManager){const t=this._gridOptions?.rowMoveManager?.columnIndexPosition??0;e.push({columnId:"_move",columnIndexPosition:t})}this.addColumnDynamicWhenFeatureEnabled(e,this.sharedService.allColumns,n)}n.forEach((e=>e.originalWidth=e.width||e.originalWidth)),this._grid.setColumns(n),this.sharedService.visibleColumns=n,t?this._grid.autosizeColumns():(i||this._gridOptions.enableAutoResizeColumnsByCellContent&&!this._gridOptions.autosizeColumnsByCellContentOnFirstLoad)&&this.pubSubService.publish("onFullResizeByContentRequested",{caller:"GridStateService"})}}}getCurrentGridState(){const{frozenColumn:e,frozenRow:t,frozenBottom:i}=this.sharedService.gridOptions,n={columns:this.getCurrentColumns(),filters:this.getCurrentFilters(),sorters:this.getCurrentSorters(),pinning:{frozenColumn:e,frozenRow:t,frozenBottom:i}},s=this.getCurrentPagination();if(s&&(n.pagination=s),this.hasRowSelectionEnabled()){const e=this.getCurrentRowSelections();e&&(n.rowSelection=e)}if(this._gridOptions?.enableTreeData){const e=this.getCurrentTreeDataToggleState();e&&(n.treeData=e)}return n}getColumns(){return this._columns}getAssociatedCurrentColumns(e){const t=[];return e&&Array.isArray(e)&&e.forEach((e=>{e?.id&&t.push({columnId:e.id,cssClass:e.cssClass||"",headerCssClass:e.headerCssClass||"",width:e.width||0})})),t}getAssociatedGridColumns(e,t){const i=[],n=this.sharedService.allColumns||e.getColumns();return t&&Array.isArray(t)&&t.forEach((e=>{const t=n.find((t=>t.id===e.columnId));t?.id&&i.push({...t,cssClass:e.cssClass||t.cssClass,headerCssClass:e.headerCssClass||t.headerCssClass,width:e.width})})),this._columns=i,i}getCurrentColumns(){return this.getAssociatedCurrentColumns(this._grid.getColumns()||[])}getCurrentFilters(){if(this._gridOptions?.backendServiceApi){const e=this._gridOptions.backendServiceApi.service;if(e?.getCurrentFilters)return e.getCurrentFilters()}else if(this.filterService?.getCurrentLocalFilters)return this.filterService.getCurrentLocalFilters();return null}getCurrentPagination(){if(this._gridOptions?.enablePagination){if(!this._gridOptions.backendServiceApi)return this.sharedService.currentPagination;{const e=this._gridOptions.backendServiceApi.service;if(e?.getCurrentPagination)return e.getCurrentPagination()}}return null}getCurrentRowSelections(){return this._grid&&this._dataView&&this.hasRowSelectionEnabled()?{gridRowIndexes:this._grid.getSelectedRows()||[],dataContextIds:this._dataView.getAllSelectedIds()||[],filteredDataContextIds:this._dataView.getAllSelectedFilteredIds()||[]}:null}getCurrentSorters(){if(this._gridOptions?.backendServiceApi){const e=this._gridOptions.backendServiceApi.service;if(e?.getCurrentSorters)return e.getCurrentSorters()}else if(this.sortService?.getCurrentLocalSorters)return this.sortService.getCurrentLocalSorters();return null}getCurrentTreeDataToggleState(){return this._gridOptions?.enableTreeData&&this.treeDataService?this.treeDataService.getCurrentToggleState():null}needToPreserveRowSelection(){let e=!1;if(this._gridOptions?.dataView&&this._gridOptions.dataView.hasOwnProperty("syncGridSelection")){const t=this._gridOptions.dataView.syncGridSelection;"boolean"===typeof t?e=this._gridOptions.dataView.syncGridSelection:"object"===typeof t&&(e=t.preserveHidden||t.preserveHiddenOnSelectionChange),e&&this._gridOptions.backendServiceApi&&this._gridOptions.dataView.hasOwnProperty("syncGridSelectionWithBackendService")&&(e=this._gridOptions.dataView.syncGridSelectionWithBackendService)}return e}resetColumns(e){const t=e||this._columns,i=this.getAssociatedCurrentColumns(t);this.pubSubService.publish("onGridStateChanged",{change:{newValues:i,type:w.columns},gridState:this.getCurrentGridState()})}resetToOriginalColumns(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._grid.setColumns(this.sharedService.allColumns),this.sharedService.visibleColumns=this.sharedService.allColumns,e&&this._grid.autosizeColumns()}resetRowSelectionWhenRequired(){if(!this.needToPreserveRowSelection()&&(this._gridOptions.enableRowSelection||this._gridOptions.enableCheckboxSelector)){const e=this.extensionService?.getExtensionByName?.(b.rowSelection);e?.instance&&this._grid.setSelectedRows([])}}subscribeToAllGridChanges(e){this._subscriptions.push(this.pubSubService.subscribe("onFilterChanged",(e=>{this.resetRowSelectionWhenRequired(),this.pubSubService.publish("onGridStateChanged",{change:{newValues:e,type:w.filter},gridState:this.getCurrentGridState()})}))),this._subscriptions.push(this.pubSubService.subscribe("onFilterCleared",(()=>{this.resetRowSelectionWhenRequired(),this.pubSubService.publish("onGridStateChanged",{change:{newValues:[],type:w.filter},gridState:this.getCurrentGridState()})}))),this._subscriptions.push(this.pubSubService.subscribe("onSortChanged",(e=>{this.resetRowSelectionWhenRequired(),this.pubSubService.publish("onGridStateChanged",{change:{newValues:e,type:w.sorter},gridState:this.getCurrentGridState()})}))),this._subscriptions.push(this.pubSubService.subscribe("onSortCleared",(()=>{this.resetRowSelectionWhenRequired(),this.pubSubService.publish("onGridStateChanged",{change:{newValues:[],type:w.sorter},gridState:this.getCurrentGridState()})}))),this.bindExtensionAddonEventToGridStateChange(b.columnPicker,"onColumnsChanged"),this.bindExtensionAddonEventToGridStateChange(b.gridMenu,"onColumnsChanged"),this.bindSlickGridColumnChangeEventToGridStateChange("onColumnsReordered",e),this.bindSlickGridColumnChangeEventToGridStateChange("onColumnsResized",e),this.bindSlickGridOnSetOptionsEventToGridStateChange(e),(this._gridOptions.enableRowSelection||this._gridOptions.enableCheckboxSelector)&&this._eventHandler.subscribe(this._dataView.onSelectedRowIdsChanged,((e,t)=>{const i=(this._selectedRowIndexes||[]).slice(),n=(this.selectedRowDataContextIds||[]).slice();if(this.selectedRowDataContextIds=t.filteredIds,this._selectedRowIndexes=t.rows,!jt(this.selectedRowDataContextIds,n)||!jt(this._selectedRowIndexes,i)){const e={gridRowIndexes:this._selectedRowIndexes||[],dataContextIds:t.selectedRowIds,filteredDataContextIds:t.filteredIds};this.pubSubService.publish("onGridStateChanged",{change:{newValues:e,type:w.rowSelection},gridState:this.getCurrentGridState()})}})),this._subscriptions.push(this.pubSubService.subscribe(["onHeaderMenuHideColumns","onHideColumns","onShowColumns"],(e=>{const t=this.getAssociatedCurrentColumns(e.columns);this.pubSubService.publish("onGridStateChanged",{change:{newValues:t,type:w.columns},gridState:this.getCurrentGridState()})}))),this._subscriptions.push(this.pubSubService.subscribe("onTreeItemToggled",(e=>{this.pubSubService.publish("onGridStateChanged",{change:{newValues:e,type:w.treeData},gridState:this.getCurrentGridState()})}))),this._subscriptions.push(this.pubSubService.subscribe("onTreeFullToggleEnd",(e=>{this.pubSubService.publish("onGridStateChanged",{change:{newValues:e,type:w.treeData},gridState:this.getCurrentGridState()})})))}addColumnDynamicWhenFeatureEnabled(e,t,i){e.sort(((e,t)=>e.columnIndexPosition-t.columnIndexPosition)),e.forEach((e=>{const n=t.findIndex((t=>t.id===e.columnId)),s=i.findIndex((t=>t.id===e.columnId));if(n>=0&&-1===s){const e=t[n];0===n?i.unshift(e):i.splice(n,0,e)}}))}bindExtensionAddonEventToGridStateChange(e,t){const i=this.extensionService?.getExtensionByName?.(e),n=i?.instance?.[t];n&&"function"===typeof n.subscribe&&this._eventHandler.subscribe(n,((e,t)=>{const i=t?.columns,n=this.getAssociatedCurrentColumns(i);this.pubSubService.publish("onGridStateChanged",{change:{newValues:n,type:w.columns},gridState:this.getCurrentGridState()})}))}bindSlickGridColumnChangeEventToGridStateChange(e,t){const i=t?.[e];i&&"function"===typeof i.subscribe&&this._eventHandler.subscribe(i,(()=>{const e=t.getColumns(),i=this.getAssociatedCurrentColumns(e);this.pubSubService.publish("onGridStateChanged",{change:{newValues:i,type:w.columns},gridState:this.getCurrentGridState()})}))}bindSlickGridOnSetOptionsEventToGridStateChange(e){const t=e.onSetOptions;this._eventHandler.subscribe(t,((e,t)=>{const{frozenBottom:i,frozenColumn:n,frozenRow:s}=t.optionsBefore,{frozenBottom:r,frozenColumn:o,frozenRow:a}=t.optionsAfter;if(i!==r||n!==o||s!==a){const e={frozenBottom:r,frozenColumn:o,frozenRow:a},t=this.getCurrentGridState();this.pubSubService.publish("onGridStateChanged",{change:{newValues:e,type:w.pinning},gridState:t})}}))}hasRowSelectionEnabled(){const e=this._grid.getSelectionModel();return!(!this._gridOptions.enableRowSelection&&!this._gridOptions.enableCheckboxSelector)&&!!e}}class la{constructor(e){this.extensionUtility=e,this._subscriptions=[],this._eventHandler=new ii}get _dataView(){return this._grid?.getData()??{}}get eventHandler(){return this._eventHandler}get _gridOptions(){return this._grid?.getOptions()??{}}get _columnDefinitions(){return this._grid?.getColumns()??[]}init(e){this._grid=e,e&&this._gridOptions&&this._gridOptions.createPreHeaderPanel&&(this._gridOptions.enableTranslate&&this.translateHeaderGrouping(),this._eventHandler.subscribe(e.onRendered,(()=>this.renderPreHeaderRowGroupingTitles())),this._eventHandler.subscribe(e.onAutosizeColumns,(()=>this.renderPreHeaderRowGroupingTitles())),this._eventHandler.subscribe(this._dataView.onRowCountChanged,(()=>this.delayRenderPreHeaderRowGroupingTitles(0))),this._eventHandler.subscribe(e.onSetOptions,((e,t)=>{t?.optionsBefore?.frozenColumn!==t?.optionsAfter?.frozenColumn&&this.delayRenderPreHeaderRowGroupingTitles(0)})),this.delayRenderPreHeaderRowGroupingTitles(75))}dispose(){this._eventHandler.unsubscribeAll()}delayRenderPreHeaderRowGroupingTitles(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;window.setTimeout((()=>this.renderPreHeaderRowGroupingTitles()),e)}renderPreHeaderRowGroupingTitles(){const e=this._columnDefinitions.length;if(void 0!==this._gridOptions?.frozenColumn&&this._gridOptions.frozenColumn>=0){const t=this._gridOptions.frozenColumn;this.renderHeaderGroups(this._grid.getPreHeaderPanelLeft(),0,t+1),this.renderHeaderGroups(this._grid.getPreHeaderPanelRight(),t+1,e)}else this.renderHeaderGroups(this._grid.getPreHeaderPanel(),0,e)}renderHeaderGroups(e,t,i){ee(e),e.className="slick-header-columns",e.style.left="-1000px",e.style.width=`${this._grid.getHeadersWidth()}px`,e.parentElement?.classList.add("slick-header");const n=this._grid.getHeaderColumnWidthDiff();let s,r=null,o="",a=0;const l=this._gridOptions?.frozenHeaderWidthCalcDifferential??0,d=void 0!==this._gridOptions?.frozenColumn&&this._gridOptions.frozenColumn>=0;for(let c=t;c0?(a+=s.width||0,r?.style&&(r.style.width=a-n-l+"px")):(a=s.width||0,r=Q("div",{className:"slick-state-default slick-header-column "+(d?"frozen":""),dataset:{group:s.columnGroup},style:{width:a-n+"px"}}),Q("span",{className:"slick-column-name",textContent:s.columnGroup||""},r),e.appendChild(r)),o=s.columnGroup||"")}translateHeaderGrouping(){const e=this._grid.getColumns();this.extensionUtility.translateItems(e,"columnGroupKey","columnGroup"),this._grid.setColumns(e),this.renderPreHeaderRowGroupingTitles()}}class da{constructor(e,t,i,n){this.pubSubService=e,this.sharedService=t,this.backendUtilities=i,this.rxjs=n,this._initialized=!1,this._isLocalGrid=!0,this._dataFrom=1,this._dataTo=1,this._itemsPerPage=0,this._pageCount=1,this._pageNumber=1,this._totalItems=0,this._availablePageSizes=[],this._subscriptions=[],this._isCursorBased=!1,this._eventHandler=new ii}get dataView(){return this.grid?.getData()??{}}set paginationOptions(e){this._paginationOptions=e}get paginationOptions(){return this._paginationOptions}get availablePageSizes(){return this._availablePageSizes}get dataFrom(){return this._dataFrom}get dataTo(){return this._dataTo}get itemsPerPage(){return this._itemsPerPage}get pageCount(){return this._pageCount}get pageNumber(){return this._pageNumber}get totalItems(){return this._totalItems}set totalItems(e){this._totalItems=e,this._initialized&&this.refreshPagination()}get isCursorBased(){return this._isCursorBased}addRxJsResource(e){this.rxjs=e}init(e,t,i){if(this._availablePageSizes=t.pageSizes||[],this.grid=e,this._backendServiceApi=i,this._paginationOptions=t,this._isLocalGrid=!i,this._pageNumber=t.pageNumber||1,this._isCursorBased=i?.options?.useCursor??!1,i&&(!i.service||!i.process))throw new Error('BackendServiceApi requires the following 2 properties "process" and "service" to be defined.');this._isLocalGrid&&this.dataView&&(this._eventHandler.subscribe(this.dataView.onPagingInfoChanged,((e,t)=>{this._totalItems!==t.totalRows&&(this.updateTotalItems(t.totalRows),this._previousPagination={pageNumber:t.pageNum,pageSize:t.pageSize,pageSizes:this.availablePageSizes,totalItems:t.totalRows})})),queueMicrotask((()=>{this.dataView&&(this.dataView.setRefreshHints({isFilterUnchanged:!0}),this.dataView.setPagingOptions({pageSize:this.paginationOptions.pageSize,pageNum:this._pageNumber-1}))}))),this._subscriptions.push(this.pubSubService.subscribe(["onFilterChanged","onFilterCleared"],(()=>this.resetPagination()))),i?.options?.infiniteScroll&&this._subscriptions.push(this.pubSubService.subscribe("onSortChanged",(()=>this.resetPagination()))),this.dataView&&(this._subscriptions.push(this.pubSubService.subscribe("onItemAdded",(e=>this.processOnItemAddedOrRemoved(e,!0)))),this._subscriptions.push(this.pubSubService.subscribe("onItemDeleted",(e=>this.processOnItemAddedOrRemoved(e,!1))))),this.refreshPagination(!1,!1,!0);const n=this.getFullPagination();this._previousPagination={pageNumber:n.pageNumber,pageSize:n.pageSize,pageSizes:n.pageSizes,totalItems:this.totalItems},this._initialized=!0,p(t,"totalItems",(e=>this._totalItems=e))}dispose(){this._initialized=!1,this._eventHandler.unsubscribeAll(),this.pubSubService.unsubscribeAll(this._subscriptions)}getCurrentPagination(){return{pageNumber:this._pageNumber,pageSize:this._itemsPerPage,pageSizes:this._availablePageSizes}}getFullPagination(){return{pageCount:this._pageCount,pageNumber:this._pageNumber,pageSize:this._itemsPerPage,pageSizes:this._availablePageSizes,totalItems:this._totalItems,dataFrom:this._dataFrom,dataTo:this._dataTo}}getCurrentPageNumber(){return this._pageNumber}getCurrentItemPerPage(){return this._itemsPerPage}changeItemPerPage(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this._pageNumber=1,this._pageCount=Math.ceil(this._totalItems/e),this._itemsPerPage=e,i?this.processOnPageChanged(this._pageNumber,t):Promise.resolve(this.getFullPagination())}goToFirstPage(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._pageNumber=1,t?this.isCursorBased&&this._cursorPageInfo?this.processOnPageChanged(this._pageNumber,e,{newPage:this._pageNumber,pageSize:this._itemsPerPage,first:this._itemsPerPage}):this.processOnPageChanged(this._pageNumber,e):Promise.resolve(this.getFullPagination())}goToLastPage(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._pageNumber=this._pageCount||1,t?this.isCursorBased&&this._cursorPageInfo?this.processOnPageChanged(this._pageNumber,e,{newPage:this._pageNumber,pageSize:this._itemsPerPage,last:this._itemsPerPage}):this.processOnPageChanged(this._pageNumber,e):Promise.resolve(this.getFullPagination())}goToNextPage(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._pageNumber2&&void 0!==arguments[2])||arguments[2];if(this.isCursorBased)return console.assert(!0,"Cursor based navigation cannot navigate to arbitrary page"),Promise.resolve(!1);const n=this._pageNumber;return e<1?this._pageNumber=1:e>this._pageCount?this._pageNumber=this._pageCount:this._pageNumber=e,this._pageNumber!==n?i?this.processOnPageChanged(this._pageNumber,t):Promise.resolve(this.getFullPagination()):Promise.resolve(!1)}goToPreviousPage(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._pageNumber>1?(this._pageNumber--,t?this.isCursorBased&&this._cursorPageInfo?this.processOnPageChanged(this._pageNumber,e,{newPage:this._pageNumber,pageSize:this._itemsPerPage,last:this._itemsPerPage,before:this._cursorPageInfo.startCursor}):this.processOnPageChanged(this._pageNumber,e):Promise.resolve(this.getFullPagination())):Promise.resolve(!1)}refreshPagination(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n={...this.getFullPagination()};if(this._paginationOptions){const t=this._paginationOptions;this._itemsPerPage||(this._isLocalGrid?this._itemsPerPage=t.pageSize:this._itemsPerPage=+(this._backendServiceApi?.options?.paginationOptions?.first?this._backendServiceApi.options.paginationOptions.first:t.pageSize)),(e||this._totalItems!==t.totalItems)&&(e?(this._pageNumber=1,this.paginationOptions.pageNumber=1):!this._initialized&&t.pageNumber&&t.pageNumber>1&&(this._pageNumber=t.pageNumber||1),1===this._pageNumber&&this._backendServiceApi&&this._backendServiceApi.service.resetPaginationOptions()),this._availablePageSizes=t.pageSizes||[],!this._totalItems&&t.totalItems&&(this._totalItems=t.totalItems),this.recalculateFromToIndexes()}this._pageCount=Math.ceil(this._totalItems/this._itemsPerPage),this.sharedService.currentPagination=this.getCurrentPagination(),this.pubSubService.publish("onPaginationRefreshed",this.getFullPagination()),t&&!jt(n,this.getFullPagination())&&this.pubSubService.publish("onPaginationChanged",this.getFullPagination()),i&&!jt(n,this.getFullPagination())&&this.pubSubService.publish("onPaginationPresetsInitialized",this.getFullPagination());const s=this.getFullPagination();this._previousPagination={pageNumber:s.pageNumber,pageSize:s.pageSize,pageSizes:s.pageSizes,totalItems:this.totalItems}}resetPagination(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._isLocalGrid&&this.dataView&&this.sharedService?.gridOptions?.enablePagination&&this.dataView.setPagingOptions({pageSize:this._itemsPerPage,pageNum:0}),this._cursorPageInfo=void 0,this.refreshPagination(!0,e),t&&this.grid.scrollTo(0)}togglePaginationVisibility(e){if(this.grid&&this.sharedService?.gridOptions){const t=void 0!==e?e:!this.sharedService.gridOptions.enablePagination;if(t&&this.goToFirstPage(),this._isLocalGrid&&this.dataView){const t=e?this._itemsPerPage:0;this.dataView.setPagingOptions({pageSize:t,pageNum:0})}this.sharedService.gridOptions.enablePagination=t,this.pubSubService.publish("onPaginationVisibilityChanged",{visible:t})}}processOnPageChanged(e,t,i){return console.assert(!this.isCursorBased||i,"Configured for cursor based pagination - cursorArgs expected"),!1===this.pubSubService.publish("onBeforePaginationChange",this.getFullPagination())?(this.resetToPreviousPagination(),Promise.resolve(this.getFullPagination())):new Promise(((n,s)=>{if(this.recalculateFromToIndexes(),this._isLocalGrid&&this.dataView)this.dataView.setPagingOptions({pageSize:this._itemsPerPage,pageNum:e-1}),this.pubSubService.publish("onPaginationChanged",this.getFullPagination()),this.pubSubService.publish("onPaginationRefreshed",this.getFullPagination()),n(this.getFullPagination());else{const r=+this._itemsPerPage,o=new Date;if(this._backendServiceApi?.preProcess&&this._backendServiceApi.preProcess(),this._backendServiceApi?.process){const a=this.isCursorBased&&i?this._backendServiceApi.service.processOnPaginationChanged(t,i):this._backendServiceApi.service.processOnPaginationChanged(t,{newPage:e,pageSize:r}),l=this._backendServiceApi.process(a);l instanceof Promise?l.then((e=>{this.backendUtilities?.executeBackendProcessesCallback(o,e,this._backendServiceApi,this._totalItems);const t=this.getFullPagination();this._previousPagination={pageNumber:t.pageNumber,pageSize:t.pageSize,pageSizes:t.pageSizes,totalItems:this.totalItems},n(this.getFullPagination())})).catch((e=>{this.resetToPreviousPagination(),this.backendUtilities?.onBackendError(e,this._backendServiceApi),this._backendServiceApi?.onError&&this.backendUtilities?.onBackendError||s(l)})):this.rxjs?.isObservable(l)&&this._subscriptions.push(l.subscribe((e=>{const t=this.getFullPagination();this._previousPagination={pageNumber:t.pageNumber,pageSize:t.pageSize,pageSizes:t.pageSizes,totalItems:this.totalItems},n(this.backendUtilities?.executeBackendProcessesCallback(o,e,this._backendServiceApi,this._totalItems))}),(e=>{this.resetToPreviousPagination(),this.backendUtilities?.onBackendError(e,this._backendServiceApi),this._backendServiceApi?.onError&&this.backendUtilities?.onBackendError||s(l)}))),this.pubSubService.publish("onPaginationRefreshed",this.getFullPagination()),this.pubSubService.publish("onPaginationChanged",this.getFullPagination())}}}))}recalculateFromToIndexes(){((this._pageNumber-1)*this._itemsPerPage>this._totalItems||this._totalItems>0&&0===this._pageNumber)&&(this._pageNumber=1),0===this._totalItems?(this._dataFrom=0,this._dataTo=1,this._pageNumber=0):(this._dataFrom=this._pageNumber>1?this._pageNumber*this._itemsPerPage-this._itemsPerPage+1:1,this._dataTo=this._totalItemsthis._totalItems&&(this._dataTo=this._totalItems)),(this._dataTo>this._totalItems||this._totalItems1&&void 0!==arguments[1]&&arguments[1];this._totalItems=e,this._paginationOptions&&(this._paginationOptions.totalItems=e,this.refreshPagination(!1,t))}processOnItemAddedOrRemoved(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(null!==e){const i=this._dataTo,n=Array.isArray(e)?e.length:1,s=t?+n:-n;this._totalItems+=s,this.recalculateFromToIndexes(),this._dataTo=i+s,this.pubSubService.publish("onPaginationChanged",this.getFullPagination())}}}class ca{get autoHeightRecalcRow(){return this._autoHeightRecalcRow||100}get isAutoHeightEnabled(){return!(!this.gridOptions.enableAutoResize||!this.gridOptions.autoResize?.autoHeight)}get eventHandler(){return this._eventHandler}get gridOptions(){return this._grid?.getOptions()??{}}get dataView(){return this._grid?.getData()}get gridUid(){return this._grid?.getUID()??""}get gridUidSelector(){return this.gridUid?`.${this.gridUid}`:""}get intervalRetryDelay(){return this._intervalRetryDelay}set intervalRetryDelay(e){this._intervalRetryDelay=e}get resizeByContentOptions(){return this.gridOptions?.resizeByContentOptions??{}}constructor(e){this.pubSubService=e,this._allHeaderHeight=0,this._autoHeightRecalcRow=0,this._intervalRetryDelay=200,this._isStopResizeIntervalRequested=!1,this._hasResizedByContentAtLeastOnce=!1,this._totalColumnsWidthByContent=0,this._resizePaused=!1,this._subscriptions=[],this._eventHandler=new ii,this._bindingEventService=new Vt}dispose(){this._eventHandler?.unsubscribeAll(),this.pubSubService.unsubscribeAll(this._subscriptions),window.clearInterval(this._intervalId),window.clearTimeout(this._timer),"container"===this.gridOptions.autoResize?.resizeDetection&&this._resizeObserver&&this._resizeObserver.disconnect(),this._bindingEventService.unbindAll()}init(e,t){if(!e||!this.gridOptions||!t)throw new Error('\n [Slickgrid-Universal] Resizer Service requires a valid Grid object and DOM Element Container to be provided.\n You can fix this by setting your gridOption to use "enableAutoResize" or create an instance of the ResizerService by calling bindAutoResizeDataGrid() once.');this._grid=e,this._gridContainerElm=t;const i=this.gridOptions?.gridHeight||this.gridOptions?.gridWidth?{height:this.gridOptions?.gridHeight,width:this.gridOptions?.gridWidth}:void 0;this._autoResizeOptions=this.gridOptions?.autoResize??{container:"grid1",bottomPadding:0},i?.width&&t?.style&&(t.style.width="string"===typeof i.width?i.width:`${i.width}px`),this._gridDomElm=e.getContainerNode(),"string"===typeof this._autoResizeOptions.container?this._pageContainerElm="string"===typeof this._autoResizeOptions.container?document.querySelector(this._autoResizeOptions.container):this._autoResizeOptions.container:this._pageContainerElm=this._autoResizeOptions.container,i&&(this._fixedHeight=i.height,this._fixedWidth=i.width),this.gridOptions.enableAutoResize&&(this._autoHeightRecalcRow=this.gridOptions.autoResize?.autoHeightRecalcRow??100,this.bindAutoResizeDataGrid()),this.gridOptions.autoResize&&this._subscriptions.push(this.pubSubService.subscribe("onFullResizeByContentRequested",(()=>this.resizeColumnsByCellContent(!0)))),this.gridOptions.enableColumnResizeOnDoubleClick&&(this._subscriptions.push(this.pubSubService.subscribe("onHeaderMenuColumnResizeByContent",(e=>{this.handleSingleColumnResizeByContent(e.columnId)}))),this._eventHandler.subscribe(this._grid.onColumnsResizeDblClick,((e,t)=>{this.handleSingleColumnResizeByContent(t.triggeredByColumn)})))}bindAutoResizeDataGrid(e){if("container"===this.gridOptions.autoResize?.resizeDetection){if(!this._pageContainerElm||!this._pageContainerElm)throw new Error('\n [Slickgrid-Universal] Resizer Service requires a container when gridOption.autoResize.resizeDetection="container"\n You can fix this by setting your gridOption.autoResize.container');this._resizeObserver||(this._resizeObserver=new ResizeObserver((()=>this.resizeObserverCallback()))),this._resizeObserver.observe(this._pageContainerElm)}else{if(void 0===this._gridDomElm)return null;this.resizeGrid().then((()=>this.resizeGridWhenStylingIsBrokenUntilCorrected())).catch((e=>console.log("Error:",e))),this.resizeGrid(10,e),this._bindingEventService.bind(window,"resize",(()=>{this.handleResizeGrid(e)}))}}handleResizeGrid(e){this.pubSubService.publish("onGridBeforeResize"),this._resizePaused||(this.resizeGrid(0,e),this.resizeGrid(0,e))}resizeObserverCallback(){this._resizePaused||this.resizeGrid()}cacheHeaderHeightTotal(){const e=this._gridContainerElm.querySelector(`${this.gridUidSelector} .slick-topheader-panel`),t=this._gridContainerElm.querySelector(`${this.gridUidSelector} .slick-pane-header`),i=this._gridContainerElm.querySelector(`${this.gridUidSelector} .slick-headerrow`);this._allHeaderHeight=(e?.offsetHeight||0)+(t?.offsetHeight||0)+(i?.offsetHeight||0)}calculateGridNewDimensions(e){const t=e?.autoResize??{},i=ne(this._gridDomElm);if(!window||!this._gridDomElm)return null;let n=void 0!==t?.bottomPadding?t.bottomPadding:20;if(n&&e.enablePagination&&(n+=35),n&&e.showCustomFooter){const e=this.gridOptions?.customFooterOptions?.footerHeight??25;n+=parseInt(`${e}`,10)}let s=0,r=0;"container"===t.calculateAvailableSizeBy?s=se(this._pageContainerElm,"height")||0:(s=window.innerHeight||0,r=i.top);const o=s-r-n,a=se(this._pageContainerElm,"width")||window.innerWidth||0,l=t?.maxHeight,d=t?.minHeight??180,c=t?.maxWidth,h=t?.minWidth??300;let u=o,p=t?.rightPadding?a-t.rightPadding:a;if(e.enableAutoResize&&this.isAutoHeightEnabled){const t=this.dataView.getLength();if(tl&&(u=l),pc&&(p=c),{height:this._fixedHeight||u,width:this._fixedWidth||p}}getLastResizeDimensions(){return this._lastDimensions}pauseResizer(e){this._resizePaused=e}resizeGrid(e,t){return new Promise((i=>{(e=e||0)>0?(window.clearTimeout(this._timer),this._timer=window.setTimeout((()=>i(this.resizeGridCallback(t))),e)):i(this.resizeGridCallback(t))}))}resizeGridCallback(e){const t=this.resizeGridWithDimensions(e);return this.pubSubService.publish("onGridAfterResize",t),!this.gridOptions.enableAutoResizeColumnsByCellContent||this._lastDimensions?.width&&t?.width===this._lastDimensions?.width||this.resizeColumnsByCellContent(!1),this._lastDimensions=t,t}resizeGridWithDimensions(e){const t=this.calculateGridNewDimensions(this.gridOptions);if((e||t)&&this._gridDomElm){const i=e?.height?e.height:t?.height,n=e?.width?e.width:t?.width;this.gridOptions.autoHeight||(this._gridDomElm.style.height=`${i}px`),this._gridDomElm.style.width=`${n}px`,this._gridContainerElm&&(this._gridContainerElm.style.width=`${n}px`),this._grid?.resizeCanvas&&this._gridContainerElm&&this._grid.resizeCanvas(),this._grid&&this.gridOptions?.enableAutoSizeColumns?this.gridUid&&document.querySelector(this.gridUidSelector)&&(this._lastDimensions&&this._lastDimensions.height===i&&this._lastDimensions.width===n||this._grid.autosizeColumns()):!this.gridOptions.enableAutoResizeColumnsByCellContent||this._lastDimensions?.width&&n===this._lastDimensions?.width||this.resizeColumnsByCellContent(!1),this._lastDimensions={height:i||0,width:n||0}}return this._lastDimensions}requestStopOfAutoFixResizeGrid(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._isStopResizeIntervalRequested=e}resizeColumnsByCellContent(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=this._grid.getColumns(),i=this.dataView.getItems(),n={};let s=!1,r=0;const o=this._gridContainerElm?.offsetWidth??0;if(!Array.isArray(i)||0===i.length||!e&&this._totalColumnsWidthByContent>0&&this._totalColumnsWidthByContento?this._grid.reRenderColumns(s):this._grid.autosizeColumns(),this.pubSubService.publish("onAfterResizeByContent",{readItemCount:r,calculateColumnWidths:a})}calculateCellWidthByReadingDataset(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,n=arguments.length>3?arguments[3]:void 0;const s=Array.isArray(e)?e:[e],r=this.dataView.getItems();let o=0;for(const[a,l]of r.entries()){if(a>i)break;Array.isArray(s)&&"object"===typeof t&&s.forEach(((e,i)=>{const s=this.calculateCellWidthByContent(l,e,a,n??i,t[e.id]);void 0!==s&&(t[e.id]=s)})),o=a+1}return o}calculateCellWidthByContent(e,t,i,n,s){const r=this.resizeByContentOptions.cellCharWidthInPx??7;if(!t.originalWidth){const o=t?.resizeCharWidthInPx??r,a=Io(t?.formatter,i,n,t,e,this._grid),l=Fe(a)?Ze(a):"",d=Math.ceil(l.length*o),c=t.resizeMaxWidthThreshold;t&&(void 0===s||d>s)&&(s=void 0!==c&&d>c?c:void 0!==t.maxWidth&&d>t.maxWidth?t.maxWidth:d)}return s}applyNewCalculatedColumnWidthByReference(e,t){const i=this.resizeByContentOptions.cellPaddingWidthInPx??6,n=this.resizeByContentOptions.formatterPaddingWidthInPx??6,s=e?.filter?.type??e?.type??y.string;let r=t;const o=e?.resizeCalcWidthRatio??this.resizeByContentOptions.defaultRatioForStringType??.9;r*="string"===s?o:1,r+=i,e.resizeExtraWidthPadding&&(r+=e.resizeExtraWidthPadding),e.editor&&this.gridOptions.editable&&(r+=n),void 0!==e.maxWidth&&r>e.maxWidth&&(r=e.maxWidth),void 0!==e.resizeMaxWidthThreshold&&r>e.resizeMaxWidthThreshold&&(r=e.resizeMaxWidthThreshold),r=Math.ceil(r),void 0!==e.originalWidth&&!0!==e.resizeAlwaysRecalculateWidth&&!0!==this.resizeByContentOptions.alwaysRecalculateColumnWidth||(e.width=this.readjustNewColumnWidthWhenOverLimit(e,r))}handleSingleColumnResizeByContent(e){const t=this._grid.getColumns(),i=t.findIndex((t=>t.id===e));if(i>=0){const n=t[i],s={[e]:n.originalWidth??n.minWidth??0};n.originalWidth=void 0,this.calculateCellWidthByReadingDataset(n,s,this.resizeByContentOptions.maxItemToInspectSingleColumnWidthByContent,i),this.applyNewCalculatedColumnWidthByReference(n,s[e]),this._grid.reRenderColumns(n?.rerenderOnResize??!1)}}readjustNewColumnWidthWhenOverLimit(e,t){const i=this.gridOptions.frozenColumn??-1,n=this._grid.getColumns().findIndex((t=>t.id===e.id))??0;let s=t;if(i>=0&&n<=i){const i=Array.from(this._grid.getViewports());if(i){const n=i.find((e=>e.classList.contains("slick-viewport-left")))?.clientWidth??0,r=i.find((e=>e.classList.contains("slick-viewport-right")))?.clientWidth??0,o=n+r,a=n-(e.width??0);if(a+t>o){s=n-a+r-(this.resizeByContentOptions.widthToRemoveFromExceededWidthReadjustment??50)}}}return Math.ceil(s)}checkIsGridShown(){return!!document.querySelector(`${this.gridUidSelector}`)?.offsetParent}resizeGridWhenStylingIsBrokenUntilCorrected(){const e=this.gridOptions?.autoFixResizeTimeout??18e3,t=this.gridOptions?.autoFixResizeRequiredGoodCount??5,i=this._gridContainerElm.querySelector(`${this.gridUidSelector} .slick-header`),n=this._gridContainerElm.querySelector(`${this.gridUidSelector} .slick-viewport`);let s=0,r=0;if(i&&n&&this.gridOptions.autoFixResizeWhenBrokenStyleDetected){const o=this.dataView.getItemCount(),a=this._grid.getColumns()||[];this._intervalId=window.setInterval((async()=>{const l=ne(i);let d=l.top;this.gridOptions?.enableFiltering&&this.gridOptions.headerRowHeight&&(d+=this.gridOptions.headerRowHeight),this.gridOptions?.createPreHeaderPanel&&this.gridOptions.showPreHeaderPanel&&this.gridOptions.preHeaderPanelHeight&&(d+=this.gridOptions.preHeaderPanelHeight),d+=44;const c=ne(n).top,h=ne(this._gridContainerElm);let u=0===l?.top||d-c>2||0===h.left&&0===h.top;const p=this._grid.getRenderedRange()?.rightPx??0;!u&&o>0&&0===p&&a.length>1&&(u=!0),this._isStopResizeIntervalRequested&&(u=!1,s=e),this.checkIsGridShown()&&(u||0===h.left||0===h.top)&&(await this.resizeGrid(),r<5&&this._grid.updateColumns(),this.checkIsGridShown()&&(u=!1)),this.checkIsGridShown()&&r++,this.checkIsGridShown()&&!u&&(r>=t||s++>=e)&&window.clearInterval(this._intervalId)}),this.intervalRetryDelay)}}}class ha{constructor(){this.currentPagination=null,this.isItemsDateParsed=!1,this.frozenVisibleColumnId="",this.hasColumnsReordered=!1,this.hideHeaderRowAfterPageLoad=!1}get allColumns(){return this._allColumns}set allColumns(e){this._allColumns=e}get columnDefinitions(){return this.slickGrid?.getColumns()??[]}get gridOptions(){return this._gridOptions||this.slickGrid?.getOptions()||{}}set gridOptions(e){this._gridOptions=e}get externalRegisteredResources(){return this._externalRegisteredResources}set externalRegisteredResources(e){this._externalRegisteredResources=e}get visibleColumns(){return this._visibleColumns}set visibleColumns(e){this._visibleColumns=e}get hierarchicalDataset(){return this._hierarchicalDataset}set hierarchicalDataset(e){this._hierarchicalDataset=e}}class ua{constructor(e,t,i,n,s){this.collectionService=e,this.sharedService=t,this.pubSubService=i,this.backendUtilities=n,this.rxjs=s,this._currentLocalSorters=[],this._isBackendGrid=!1,this._eventHandler=new ii,this.rxjs&&(this.httpCancelRequests$=this.rxjs.createSubject())}get eventHandler(){return this._eventHandler}get _gridOptions(){return this._grid?.getOptions()??{}}get _columnDefinitions(){return this._grid?.getColumns()??[]}dispose(){this._eventHandler?.unsubscribeAll&&this._eventHandler.unsubscribeAll(),this.httpCancelRequests$&&this.rxjs?.isObservable(this.httpCancelRequests$)&&(this.httpCancelRequests$.next(),this.httpCancelRequests$.complete())}addRxJsResource(e){this.rxjs=e}bindBackendOnSort(e){this._isBackendGrid=!0,this._grid=e,this._dataView=e?.getData(),this._eventHandler.subscribe(e.onSort,this.onBackendSortChanged.bind(this))}bindLocalOnSort(e){this._isBackendGrid=!1,this._grid=e,this._dataView=e?.getData(),this.processTreeDataInitialSort(),this._eventHandler.subscribe(e.onSort,this.handleLocalOnSort.bind(this)),this._gridOptions.preParseDateColumns&&(this._eventHandler.subscribe(e.onCellChange,((e,t)=>this.preParseSingleDateItem(t.item))),this.pubSubService.subscribe(["onItemAdded","onItemUpdated"],(e=>this.preParseSingleDateItem(e))))}preParseSingleDateItem(e){if(this._gridOptions.preParseDateColumns){(Array.isArray(e)?e:[e]).forEach((e=>this.collectionService.parseSingleDateItem(e,this._grid,this._gridOptions.preParseDateColumns)))}}preParseAllDateItems(){if(this._gridOptions.preParseDateColumns){const e=this._dataView?.getItems()||[];this.collectionService.preParseByMutationDateItems(e,this._grid,this._gridOptions.preParseDateColumns),this.sharedService.isItemsDateParsed=!0}}handleLocalOnSort(e,t){const i=t.multiColumnSort?t.sortCols:new Array({columnId:t.sortCol?.id??"",sortAsc:t.sortAsc,sortCol:t.sortCol});this._currentLocalSorters=[],Array.isArray(i)&&i.forEach((e=>{e.sortCol&&this._currentLocalSorters.push({columnId:e.sortCol.id,direction:e.sortAsc?E.ASC:E.DESC})})),this.onLocalSortChanged(this._grid,i),this.emitSortChanged(l.local)}clearSortByColumnId(e,t){const i=this.getCurrentColumnSorts(),n=this.getCurrentColumnSorts(`${t}`);if(Array.isArray(i)&&Array.isArray(n)&&i.length!==n.length){if(this._gridOptions.backendServiceApi)this.onBackendSortChanged(e,{multiColumnSort:!0,sortCols:n,grid:this._grid});else if(this._dataView)this.onLocalSortChanged(this._grid,n,!0,!0);else{const e=this._gridOptions.multiColumnSort||!1?n:n[0];this._grid.onSort.notify(e)}const t=n.map((e=>({columnId:e?.sortCol?.id??"",sortAsc:e?.sortAsc,sortCol:e?.sortCol})));this._grid.setSortColumns(t)}Array.isArray(n)&&0===n.length&&this.sortLocalGridByDefaultSortFieldId()}clearSorting(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._grid&&this._gridOptions&&this._dataView)if(this._grid.setSortColumns([]),e)this._isBackendGrid?this.onBackendSortChanged(void 0,{grid:this._grid,multiColumnSort:!0,sortCols:[],clearSortTriggered:!0}):this._columnDefinitions&&Array.isArray(this._columnDefinitions)&&this._columnDefinitions.length>0&&this.sortLocalGridByDefaultSortFieldId();else if(this._isBackendGrid){const e=this._gridOptions.backendServiceApi?.service;e?.clearSorters&&e.clearSorters()}this._currentLocalSorters=[],this.pubSubService.publish("onSortCleared",!0)}disableSortFunctionality(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=!this._gridOptions.enableSorting;let n;this._gridOptions.enableSorting=i,e?(t&&this.clearSorting(),this._eventHandler.unsubscribeAll(),n=this.disableAllSortingCommands(!0)):(n=this.disableAllSortingCommands(!1),this._eventHandler.subscribe(this._grid.onSort,((e,t)=>this.handleLocalOnSort(e,t)))),this._grid.setOptions({enableSorting:this._gridOptions.enableSorting},!1,!0),this.sharedService.gridOptions=this._gridOptions,this._grid.setColumns(n)}toggleSortFunctionality(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=this._gridOptions.enableSorting;this.disableSortFunctionality(t,e)}emitSortChanged(e,t){if(e===l.remote&&this._gridOptions.backendServiceApi){let e=[];const t=this._gridOptions.backendServiceApi.service;t?.getCurrentSorters&&(e=t.getCurrentSorters()),this.pubSubService.publish("onSortChanged",e)}else e===l.local&&(t&&(this._currentLocalSorters=t),this.pubSubService.publish("onSortChanged",this.getCurrentLocalSorters()))}getCurrentLocalSorters(){return this._currentLocalSorters}getCurrentColumnSorts(e){if(this._grid){const t=this._grid.getSortColumns();if(Array.isArray(t)){return t.reduce(((t,i)=>(!i||e&&i.columnId===e||t.push({columnId:i.columnId||"",sortCol:this._columnDefinitions[this._grid.getColumnIndex(i.columnId||"")],sortAsc:i.sortAsc}),t)),[])}}return[]}loadGridSorters(e){this._currentLocalSorters=[];const t=[];if(Array.isArray(e)){(this._gridOptions.multiColumnSort?e:e.slice(0,1)).forEach((e=>{const i=this._columnDefinitions.find((t=>t.id===e.columnId));if(i){if(!i.sortable){let e="[Slickgrid-Universal] Cannot add sort icon to a column that is not sortable, please add `sortable: true` to your column or remove it from your list of columns to sort.";throw this._gridOptions.enableTreeData&&(e+=" Also note that TreeData feature requires the column holding the tree (expand/collapse icons) to be sortable."),new Error(e)}t.push({columnId:i.id,sortAsc:e.direction.toUpperCase()===E.ASC,sortCol:i}),this._currentLocalSorters.push({columnId:String(i.id),direction:e.direction.toUpperCase()})}})),this.onLocalSortChanged(this._grid,t),this._grid.setSortColumns(t.map((e=>({columnId:e.columnId,sortAsc:e.sortAsc}))))}return t}processTreeDataInitialSort(){if(this._gridOptions.enableTreeData&&this._gridOptions.treeDataOptions){const e=this._gridOptions.treeDataOptions,t=this._columnDefinitions.find((t=>t.id===e.columnId));if(t){let i=E.ASC,n={columnId:e.columnId,sortCol:t,sortAsc:!0};if(e?.initialSort?.columnId){const t=e.initialSort.columnId,s=this._columnDefinitions.find((e=>e.id===t));i=(e.initialSort.direction||E.ASC).toUpperCase(),n={columnId:t,sortCol:s,sortAsc:i===E.ASC}}n?.columnId&&this.sharedService?.hierarchicalDataset&&this.updateSorting([{columnId:n.columnId||"",direction:i}])}}}onBackendSortChanged(e,t){if(!t||!t.grid)throw new Error('Something went wrong when trying to bind the "onBackendSortChanged(event, args)" function, it seems that "args" is not populated correctly');const i=t.grid?.getOptions()??{},n=i.backendServiceApi;if(!n||!n.process||!n.service)throw new Error('BackendServiceApi requires at least a "process" function and a "service" defined');const s=new Date;n.preProcess&&n.preProcess();const r=n.service.processOnSortChanged(e,t),o=i?.pagination?.totalItems||0;this.backendUtilities?.executeBackendCallback(n,r,t,s,o,{emitActionChangedCallback:this.emitSortChanged.bind(this),errorCallback:()=>{this._grid.setSortColumns(t.previousSortColumns||[]);const e=t.previousSortColumns?.map((e=>({columnId:e.columnId,sortAsc:e.sortAsc,sortCol:this._columnDefinitions.find((t=>t.id===e.columnId))})));n?.service?.updateSorters?.(e||[])},httpCancelRequestSubject:this.httpCancelRequests$})}async onLocalSortChanged(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const s=this._gridOptions.datasetIdPropertyName||"id",r=this._gridOptions.enableTreeData||!1,o=e.getData();if(await this.pubSubService.publish("onBeforeSortChange",{sortColumns:t},0),e&&o){if(this._gridOptions.preParseDateColumns&&!this.sharedService.isItemsDateParsed&&t.some((e=>U(e.sortCol?.type)))&&this.preParseAllDateItems(),i&&!r&&o.reSort(),r&&this._dataView&&this.sharedService&&Array.isArray(this.sharedService.hierarchicalDataset)){const e=this.sortHierarchicalDataset(this.sharedService.hierarchicalDataset,t);this._dataView.setItems(e.flat,s),this._dataView.onRowCountChanged.notify({previous:this._dataView.getFilteredItemCount(),current:this._dataView.getLength(),itemCount:this._dataView.getItemCount(),dataView:this._dataView,callingOnRowsChanged:!0})}else o.sort(this.sortComparers.bind(this,t));e.invalidate(),n&&this.emitSortChanged(l.local,t.map((e=>({columnId:e.sortCol?.id??"id",direction:e.sortAsc?E.ASC:E.DESC}))))}}sortHierarchicalDataset(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.sortTreeData(e,t);const n=this._gridOptions.datasetIdPropertyName||"id",s=this._gridOptions.treeDataOptions||{columnId:""},r=D(e,{...s,identifierPropName:s.identifierPropName??n,shouldAddTreeLevelNumber:!0});if(i){this._currentLocalSorters=[],t.forEach((e=>{this._currentLocalSorters.push({columnId:e.columnId,direction:e.sortAsc?"ASC":"DESC"})}));const e=this._gridOptions.backendServiceApi?l.remote:l.local;this.emitSortChanged(e)}return{hierarchical:e,flat:r}}sortLocalGridByDefaultSortFieldId(){const e=this._gridOptions&&this._gridOptions.defaultColumnSortFieldId||this._gridOptions.datasetIdPropertyName||"id",t={id:e,field:e};this.onLocalSortChanged(this._grid,new Array({columnId:t.id,sortAsc:!0,sortCol:t,clearSortTriggered:!0}),!1,!0)}sortComparers(e,t,i){if(Array.isArray(e))for(const n of e){const e=this.sortComparer(n,t,i);if(void 0!==e)return e}return O.neutral}sortComparer(e,t,i,n){if(e?.sortCol){const s=e.sortCol,r=s.type||y.string,o=e.sortAsc?O.asc:O.desc;let a=n||s.queryFieldSorter||s.queryField||s.field;this._gridOptions.preParseDateColumns&&U(r)&&e?.columnId&&(a="string"===typeof this._gridOptions.preParseDateColumns?`${this._gridOptions.preParseDateColumns}${e.columnId}`:`${e.columnId}`);let l=a;"function"===typeof s.queryFieldNameGetterFn&&(a=s.queryFieldNameGetterFn(t),l=s.queryFieldNameGetterFn(i));let d=t[a],c=i[l];if(a?.indexOf(".")>=0&&(d=H(t,a)),l?.indexOf(".")>=0&&(c=H(i,l)),s.sortComparer){const e=s.sortComparer(d,c,o,s,this._gridOptions);if(e!==O.neutral)return e}else{const e=Ht(r,d,c,o,s,this._gridOptions);if(e!==O.neutral)return e}}}sortTreeData(e,t){Array.isArray(t)&&t.forEach((t=>{this.sortTreeChildren(e,t,0)}))}sortTreeChildren(e,t,i){const n=this._gridOptions.treeDataOptions?.childrenPropName??"children";e.sort(((e,i)=>this.sortComparer(t,e,i)??O.neutral)),e.forEach((e=>{if(e){e.hasOwnProperty(n)&&Array.isArray(e[n])&&(i++,this.sortTreeChildren(e[n],t,i),i--)}}))}updateSorting(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this._gridOptions||!this._gridOptions.enableSorting)throw new Error('[Slickgrid-Universal] in order to use "updateSorting" method, you need to have Sortable Columns defined in your grid and "enableSorting" set in your Grid Options');if(Array.isArray(e)){const n=this._gridOptions.backendServiceApi;if(n){const t=n?.service;t?.updateSorters&&(t.updateSorters(void 0,e),i&&this.backendUtilities?.refreshBackendDataset(this._gridOptions))}else this.loadGridSorters(e);if(t){const e=n?l.remote:l.local;this.emitSortChanged(e)}}}disableAllSortingCommands(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=this._grid.getColumns();t.forEach((t=>{void 0!==t.sortable&&(t.sortable=!e),t?.header?.menu&&t.header.menu.commandItems?.forEach((t=>{if(t&&"string"!==typeof t){const i=t.command;"sort-asc"!==i&&"sort-desc"!==i&&"clear-sort"!==i||(t.hidden=e)}}))}));const i=this._gridOptions.gridMenu?.commandItems;return i&&i.forEach((t=>{t&&"string"!==typeof t&&"clear-sorting"===t.command&&(t.hidden=e)})),t}}class pa{constructor(e,t,i){this.pubSubService=e,this.sharedService=t,this.sortService=i,this._currentToggledItems=[],this._isLastFullToggleCollapsed=!1,this._isOneCpuCyclePassed=!1,this._isTreeDataEnabled=!1,this._subscriptions=[],this._treeDataRecalcHandler=null,this._eventHandler=new ii,window.setTimeout((()=>this._isOneCpuCyclePassed=!0))}set currentToggledItems(e){this._currentToggledItems=e}get dataset(){return this.dataView?.getItems()}get datasetHierarchical(){return this.sharedService.hierarchicalDataset}get dataView(){return this._grid?.getData()}get eventHandler(){return this._eventHandler}get gridOptions(){return this._grid?.getOptions()??{}}get treeDataOptions(){return this.gridOptions.treeDataOptions}dispose(){this._eventHandler.unsubscribeAll(),this.pubSubService.unsubscribeAll(this._subscriptions)}init(e){if(this._grid=e,this._isTreeDataEnabled=this.gridOptions?.enableTreeData??!1,this._isLastFullToggleCollapsed=this.treeDataOptions?.initiallyCollapsed??!1,this._currentToggledItems=this.gridOptions.presets?.treeData?.toggledItems??[],this._lastToggleStateChange={type:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",previousFullToggleType:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",toggledItems:this._currentToggledItems},this._isTreeDataEnabled){if(this.gridOptions?.multiColumnSort)throw new Error('[Slickgrid-Universal] It looks like you are trying to use Tree Data with multi-column sorting, unfortunately it is not supported because of its complexity, you can disable it via "multiColumnSort: false" grid option and/or help in providing support for this feature.');if(!this.gridOptions?.enableFiltering)throw new Error('[Slickgrid-Universal] It looks like you are trying to use Tree Data without using the filtering option, unfortunately that is not possible with Tree Data since it relies heavily on the filters to expand/collapse the tree. You need to enable it via "enableFiltering: true"');if(this.gridOptions?.backendServiceApi||this.gridOptions?.enablePagination)throw new Error("[Slickgrid-Universal] It looks like you are trying to use Tree Data with Pagination and/or a Backend Service (OData, GraphQL) but unfortunately that is simply not supported because of its complexity.");if(!this.gridOptions.treeDataOptions||!this.gridOptions.treeDataOptions.columnId)throw new Error('[Slickgrid-Universal] When enabling tree data, you must also provide the "treeDataOption" property in your Grid Options with "childrenPropName" or "parentPropName" (depending if your array is hierarchical or flat) for the Tree Data to work properly.')}this._eventHandler.subscribe(e.onClick,this.handleOnCellClick.bind(this)),this._subscriptions.push(this.pubSubService.subscribe("onGridMenuClearAllSorting",this.clearSorting.bind(this))),this._treeDataRecalcHandler=this.setAutoRecalcTotalsCallbackWhenFeatEnabled(this.gridOptions),this._eventHandler.subscribe(this.dataView.onRowCountChanged,(()=>{"function"===typeof this._treeDataRecalcHandler&&this._isOneCpuCyclePassed&&(window.clearTimeout(this._timer),this._timer=window.setTimeout((()=>this._treeDataRecalcHandler?.()),this.treeDataOptions?.autoRecalcTotalsDebounce??0))}))}applyToggledItemStateChanges(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(Array.isArray(e)){const s=P(this.treeDataOptions,"collapsedPropName"),r=P(this.treeDataOptions,"hasChildrenPropName");this.dataView.beginUpdate(!0);const o="full-collapse"===(t??this._lastToggleStateChange.previousFullToggleType);t&&(this._lastToggleStateChange.previousFullToggleType=t),i&&(this.dataView.getItems()||[]).forEach((e=>{e[r]&&(e[s]=o)})),this.dynamicallyToggleItemState(e,n)}}dynamicallyToggleItemState(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Array.isArray(e)&&(this.dataView.beginUpdate(!0),e.forEach((e=>{const i=this.dataView.getItemById(e.itemId);if(this.updateToggledItem(i,e.isCollapsed,!0),t){const t=this._currentToggledItems.findIndex((t=>t.itemId===e.itemId));t>=0?this._currentToggledItems[t].isCollapsed=e.isCollapsed:this._currentToggledItems.push({itemId:e.itemId,isCollapsed:e.isCollapsed}),this.pubSubService.publish("onTreeItemToggled",{...this._lastToggleStateChange,fromItemId:e.itemId,toggledItems:this._currentToggledItems,type:e.isCollapsed?x.toggleCollapse:x.toggleExpand})}})),this.dataView.endUpdate(),this.dataView.refresh())}getCurrentToggleState(){return this._lastToggleStateChange}getInitialSort(e,t){const i=t?.treeDataOptions,n=i?.initialSort??{columnId:i?.columnId??"",direction:"ASC"},s=e.find((e=>e.id===n.columnId));return{columnId:n.columnId,sortAsc:"DESC"!==n?.direction?.toUpperCase(),sortCol:s}}getItemCount(e){if(void 0!==e){const t=P(this.treeDataOptions,"levelPropName");return this.dataView.getItems().filter((i=>i[t]===e)).length}return this.dataView.getItemCount()}getToggledItems(){return this._currentToggledItems}clearSorting(){const e=this.getInitialSort(this.sharedService.columnDefinitions,this.sharedService.gridOptions);this.sortService.loadGridSorters([{columnId:e.columnId,direction:e.sortAsc?"ASC":"DESC"}])}convertFlatParentChildToTreeDatasetAndSort(e,t,i,n){const s=this.convertFlatParentChildToTreeDataset(e,i),r=Array.isArray(n)&&n.length?n[0]:this.getInitialSort(t,i),o=this.sortService.sortHierarchicalDataset(s,[r],!0);return this._grid?.setSortColumns([r]),o}convertFlatParentChildToTreeDataset(e,t){const i=t?.datasetIdPropertyName??"id",n=t?.treeDataOptions??{columnId:"id"};return F(e,{...n,identifierPropName:n.identifierPropName??i,initiallyCollapsed:this._isLastFullToggleCollapsed})}enableAutoRecalcTotalsFeature(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&this._isTreeDataEnabled?this._treeDataRecalcHandler=this.recalculateTreeTotals.bind(this,this.gridOptions):this._treeDataRecalcHandler=null}recalculateTreeTotals(e){const t=e.treeDataOptions,i=t?.childrenPropName??g.treeDataProperties.CHILDREN_PROP,n=t?.levelPropName??g.treeDataProperties.TREE_LEVEL_PROP;t?.aggregators&&(t.aggregators.forEach((e=>{A(this.sharedService.hierarchicalDataset||[],{childrenPropName:i,levelPropName:n,aggregator:e})})),this._grid.invalidate())}sortHierarchicalDataset(e,t){const i=t??this.getInitialSort(this.sharedService.allColumns,this.gridOptions),n=Array.isArray(i)?i:[i];return this.sortService.sortHierarchicalDataset(e,n)}async toggleTreeDataCollapse(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.gridOptions?.enableTreeData){const i=P(this.treeDataOptions,"hasChildrenPropName");t&&await this.pubSubService.publish("onTreeFullToggleStart",{collapsing:e}),this.dataView.beginUpdate(!0);const n=this.dataView.getItems()||[];n.forEach((t=>{t[i]&&this.updateToggledItem(t,e,!1)})),this.sharedService.hierarchicalDataset=this.convertFlatParentChildToTreeDataset(n,this.gridOptions),this.dataView.endUpdate(),this.dataView.refresh(),this._isLastFullToggleCollapsed=e}const i=e?x.fullCollapse:x.fullExpand;this._lastToggleStateChange={type:i,previousFullToggleType:i,toggledItems:null},t&&this.pubSubService.publish("onTreeFullToggleEnd",this._lastToggleStateChange)}handleOnCellClick(e,t){if(e&&t){const i=e.target||{},n=this.gridOptions.datasetIdPropertyName??"id",s=P(this.treeDataOptions,"collapsedPropName"),r=P(this.treeDataOptions,"childrenPropName");if("string"===typeof i?.className){if(i.className.indexOf("toggle")>=0||!1){const i=this.dataView.getItem(t.row);if(i){i[s]=!i[s];const e=i[s],t=i[n],o=this._currentToggledItems.findIndex((e=>e.itemId===t));o>=0?this._currentToggledItems[o].isCollapsed=e:this._currentToggledItems.push({itemId:t,isCollapsed:e}),this.dataView.updateItem(t,i);const a=e=>e[n]===t,l=M(this.sharedService.hierarchicalDataset||[],a,r);l&&(l[s]=e),this._grid.invalidate(),this._lastToggleStateChange={type:e?x.toggleCollapse:x.toggleExpand,previousFullToggleType:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",toggledItems:this._currentToggledItems},this.pubSubService.publish("onTreeItemToggled",{...this._lastToggleStateChange,fromItemId:t})}e.stopImmediatePropagation()}}}}updateToggledItem(e,t,i){const n=this.gridOptions?.datasetIdPropertyName??"id",s=P(this.treeDataOptions,"childrenPropName"),r=P(this.treeDataOptions,"collapsedPropName");if(e&&(e[r]=t,this.dataView.updateItem(e[n],e),i)){const i=t=>t[n]===e[n],o=M(this.sharedService.hierarchicalDataset||[],i,s);o&&(o[r]=t)}}setAutoRecalcTotalsCallbackWhenFeatEnabled(e){return e?.enableTreeData&&e?.treeDataOptions?.autoRecalcTotalsOnFilterChange&&e?.treeDataOptions?.aggregators?this.recalculateTreeTotals.bind(this,e):null}}class ma{constructor(e){this.translaterService=e,this._debounceTypingDelay=0,this._shouldTriggerQuery=!0,this._inputType="text",this.inputFilterType="single",this.searchTerms=[],this._bindEventService=new Vt}get columnFilter(){return this.columnDef?.filter??{}}get defaultOperator(){return C.empty}get inputType(){return this._inputType}set inputType(e){this._inputType=e}get operator(){return this.columnFilter?.operator??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}get gridOptions(){return this.grid?.getOptions()??{}}init(e){if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,"compound"===this.inputFilterType&&(this.operator=e.operator||""),this.searchTerms=e?.searchTerms??[],this._cellContainerElm=e.filterContainerElm;const t=this.gridOptions?.backendServiceApi;this._debounceTypingDelay=(t?t?.filterTypingDebounce??this.gridOptions?.defaultBackendServiceFilterTypingDebounce:this.gridOptions?.filterTypingDebounce)??0;const i=Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"";this.createDomFilterElement(i),this._bindEventService.bind(this._filterInputElm,["keyup","blur","change"],this.onTriggerEvent.bind(this)),this._bindEventService.bind(this._filterInputElm,"wheel",this.onTriggerEvent.bind(this),{passive:!0}),"compound"===this.inputFilterType&&this._selectOperatorElm&&this._bindEventService.bind(this._selectOperatorElm,"change",this.onTriggerEvent.bind(this))}clear(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._filterInputElm&&(this._shouldTriggerQuery=e,this.searchTerms=[],this._filterInputElm.value="",this._currentValue=void 0,this.updateFilterStyle(!1),"compound"===this.inputFilterType&&this._selectOperatorElm&&(this._selectOperatorElm.selectedIndex=0),this.onTriggerEvent(void 0,!0))}destroy(){this._bindEventService.unbindAll(),this._selectOperatorElm?.remove?.(),this._filterInputElm?.remove?.()}getValues(){return this._filterInputElm.value}setValues(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=Array.isArray(e)?e:[e];let s="";for(const r of n)s="single"===this.inputFilterType?t?this.addOptionalOperatorIntoSearchString(r,t):r:`${r}`,this._filterInputElm.value=`${s??""}`,this._currentValue=this._filterInputElm.value;if(this.updateFilterStyle(""!==this.getValues()),this.operator=t||this.defaultOperator,t&&this._selectOperatorElm){const e=W(this.operator);this._selectOperatorElm.value=e}i&&this.onTriggerEvent(void 0,!1)}addOptionalOperatorIntoSearchString(e,t){let i="",n="",s=void 0===e||null===e?"":`${e}`;if(t&&s){switch(t){case"<>":case"!=":case"=":case"==":case">":case">=":case"<":case"<=":i=t;break;case"EndsWith":case"*z":i="*";break;case"StartsWith":case"a*":n="*"}s=`${i}${s}${n}`}return s}getCompoundOperatorOptionValues(){const e=this.columnDef.type&&this.columnDef.type?this.columnDef.type:y.string;let t,i="text";if(this.columnFilter?.compoundOperatorList)t=this.columnFilter.compoundOperatorList;else switch(e){case y.string:case y.text:case y.readonly:case y.password:i="text",n=this.gridOptions,s=this.translaterService,t=[{operator:"",desc:Qt("CONTAINS","TEXT_CONTAINS","Contains",n,s)},{operator:"<>",desc:Qt("NOT_CONTAINS","TEXT_NOT_CONTAINS","Not Contains",n,s)},{operator:"=",desc:Qt("EQUALS","TEXT_EQUALS","Equals",n,s)},{operator:"!=",desc:Qt("NOT_EQUAL_TO","TEXT_NOT_EQUAL_TO","Not equal to",n,s)},{operator:"a*",desc:Qt("STARTS_WITH","TEXT_STARTS_WITH","Starts with",n,s)},{operator:"*z",desc:Qt("ENDS_WITH","TEXT_ENDS_WITH","Ends with",n,s)}];break;default:i="numeric",t=Zt(this.gridOptions,this.translaterService)}var n,s;return Jt(this.gridOptions,t,i),t}createDomFilterElement(e){const t=this.columnDef?.id??"";ee(this._cellContainerElm);let i=this.gridOptions?.defaultFilterPlaceholder??"";this.columnFilter?.placeholder&&(i=this.columnFilter.placeholder);const n=`${e??""}`;if(this._filterInputElm=Q("input",{type:this._inputType||"text",autocomplete:"off",ariaAutoComplete:"none",placeholder:i,ariaLabel:this.columnFilter?.ariaLabel??`${Ve(t+"")} Search Filter`,className:`form-control filter-${t}`,value:n,dataset:{columnid:`${t}`}}),this.updateFilterStyle(!!e),void 0!==e&&(this._currentValue=n),"single"===this.inputFilterType)this._filterContainerElm=this._filterInputElm,this._filterInputElm.classList.add("search-filter","slick-filter"),this._cellContainerElm.appendChild(this._filterInputElm),this._cellContainerElm.appendChild(document.createElement("span"));else{this._filterInputElm.classList.add("compound-input"),this._selectOperatorElm=qt(this.getCompoundOperatorOptionValues(),this.grid),this._filterContainerElm=Q("div",{className:`form-group search-filter slick-filter filter-${t}`});const e=Q("div",{className:"input-group"},this._filterContainerElm);Q("div",{className:"input-group-addon input-group-prepend operator"},e).appendChild(this._selectOperatorElm),e.appendChild(this._filterInputElm),e.appendChild(Q("span")),this.operator&&(this._selectOperatorElm.value=W(this.operator)),this._filterContainerElm&&this._cellContainerElm.appendChild(this._filterContainerElm)}}onTriggerEvent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t)this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:t,shouldTriggerQuery:this._shouldTriggerQuery}),this.updateFilterStyle(!1);else{const t=e?.type||"",i=this._selectOperatorElm?.value??this.operator;let n=this._filterInputElm.value;const s=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;"string"===typeof n&&s&&(n=n.trim()),"select"!==e?.target?.tagName.toLowerCase()&&(this._currentValue=n),this.updateFilterStyle(""!==n);const r={columnDef:this.columnDef,operator:i,searchTerms:n?[n]:null,shouldTriggerQuery:this._shouldTriggerQuery},o="keyup"===t&&"Enter"!==e?.key?this._debounceTypingDelay:0,a=this.columnFilter.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput,l=a&&Re(this._currentValue)||""===this._currentValue&&Re(this._lastSearchValue);"single"!==this.inputFilterType&&a&&!l||(o>0?(window.clearTimeout(this._timer),this._timer=window.setTimeout((()=>this.callback(e,r)),o)):this.callback(e,r)),this._lastSearchValue=n}this._shouldTriggerQuery=!0}updateFilterStyle(e){e?(this._filterContainerElm?.classList.add("filled"),this._filterInputElm.classList.add("filled")):(this._filterContainerElm?.classList.remove("filled"),this._filterInputElm.classList.remove("filled"))}}class ga extends ma{constructor(e){super(e),this.translaterService=e,this.inputType="text",this.inputFilterType="compound"}}const fa="#86bff8";class va{constructor(e){this.translaterService=e,this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this._sliderTrackFilledColor=fa,this.sliderType="double",this.searchTerms=[],this._bindEventService=new Vt}get columnFilter(){return this.columnDef?.filter??{}}get currentValue(){return this._currentValue}get currentValues(){return this._currentValues}get defaultOperator(){return"compound"===this.sliderType?C.empty:"single"===this.sliderType?C.greaterThanOrEqual:this.gridOptions.defaultFilterRangeOperator||C.rangeInclusive}get filterOptions(){return{...this.gridOptions.defaultFilterOptions?.slider,...this.columnFilter?.filterOptions}}get gridOptions(){return this.grid?.getOptions()??{}}get sliderOptions(){return this._sliderOptions}get operator(){return this._operator||(this.columnFilter.operator??this.defaultOperator)}set operator(e){this._operator=e}init(e){if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.operator=e.operator||"",this.searchTerms=e?.searchTerms??[],this._argFilterContainerElm=e.filterContainerElm,this._sliderTrackFilledColor=window.getComputedStyle(document.documentElement).getPropertyValue("--slick-slider-filter-filled-track-color")||fa,this._filterElm=this.createDomFilterElement(this.searchTerms)}clear(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this._filterElm){this._clearFilterTriggered=!0,this._shouldTriggerQuery=e,this.searchTerms=[];const t=+(this.filterOptions?.sliderStartValue??g.SLIDER_DEFAULT_MIN_VALUE),i=+(this.filterOptions?.sliderEndValue??g.SLIDER_DEFAULT_MAX_VALUE);"double"===this.sliderType?(this._sliderLeftInputElm&&(this._sliderLeftInputElm.value=`${t}`),this._sliderRightInputElm&&(this._sliderRightInputElm.value=`${i}`),this._currentValues=[t,i],this._sliderLeftInputElm?.dispatchEvent(new Event("change")),this._sliderRightInputElm?.dispatchEvent(new Event("change"))):(this._sliderRightInputElm&&(this._sliderRightInputElm.value=`${t}`),this._selectOperatorElm&&(this._selectOperatorElm.selectedIndex=0),this._currentValue=t,this._sliderRightInputElm?.dispatchEvent(new Event("change")));(this.filterOptions?.hideSliderNumber??this.filterOptions?.hideSliderNumbers)||("double"===this.sliderType?this.renderSliderValues(t,i):this.renderSliderValues(void 0,t)),this.updateFilterStyle(!1),this.callback(void 0,{columnDef:this.columnDef,clearFilterTriggered:!0,shouldTriggerQuery:e,searchTerms:[]})}}destroy(){this._bindEventService.unbindAll(),this._sliderTrackElm?.remove(),this._sliderLeftInputElm?.remove(),this._sliderRightInputElm?.remove()}renderSliderValues(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const n=e?.toString()||"",s=t?.toString()||"";this._leftSliderNumberElm?.textContent&&(this._leftSliderNumberElm.textContent=n),this._rightSliderNumberElm?.textContent&&(this._rightSliderNumberElm.textContent=s),this._sliderRangeContainElm.title="double"===this.sliderType?`${n} - ${s}`:`${s}`,i&&this.grid.onHeaderRowMouseLeave.notify({column:this.columnDef,grid:this.grid})}getValues(){return"double"===this.sliderType?this._currentValues:this._currentValue}setValues(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){let t=[];const i=Array.isArray(e)?e?.[0]:e;if(Array.isArray(e)&&2===e.length?t=e:"string"===typeof i&&i.indexOf("..")>0?(t=i.split(".."),this._currentValue=+(t?.[0]??0)):(Re(i)||""===i)&&(this._currentValue=null===i?void 0:+i,t=[i]),"double"!==this.sliderType&&this._sliderRightInputElm)this._sliderRightInputElm.value="string"===typeof e?e:`${i}`,this.renderSliderValues(void 0,this._sliderRightInputElm.value);else if(Array.isArray(t)&&2===t.length&&!this.filterOptions?.hideSliderNumbers){const[e,i]=t;this._sliderLeftInputElm&&(this._sliderLeftInputElm.value=String(e??g.SLIDER_DEFAULT_MIN_VALUE)),this._sliderRightInputElm&&(this._sliderRightInputElm.value=String(i??g.SLIDER_DEFAULT_MAX_VALUE)),this.renderSliderValues(...t)}}else this._currentValue=void 0,this._currentValues=void 0;const n=this.getValues(),s=void 0===n?[]:Array.isArray(n)?n:[n];if(this.updateFilterStyle(s.length>0),void 0!==t&&(this.operator=t),this.operator&&this._selectOperatorElm){const e=W(this.operator);this._selectOperatorElm.value=e}i&&this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:s,shouldTriggerQuery:!0})}createDomFilterElement(e){const t=this.columnDef?.id??"",i=+(this.columnFilter.minValue??g.SLIDER_DEFAULT_MIN_VALUE),n=+(this.columnFilter.maxValue??g.SLIDER_DEFAULT_MAX_VALUE),s=+(this.columnFilter.valueStep??g.SLIDER_DEFAULT_STEP);ee(this._argFilterContainerElm);const r=+((Array.isArray(e)&&e?.[0])??this.filterOptions?.sliderStartValue??i),o=+((Array.isArray(e)&&e?.[1])??this.filterOptions?.sliderEndValue??n);if(this._sliderRangeContainElm=Q("div",{className:`filter-input filter-${t} slider-input-container slider-values`,title:"double"===this.sliderType?`${r} - ${o}`:`${r}`}),this._sliderTrackElm=Q("div",{className:"slider-track"}),"compound"===this.sliderType){const e=Q("span",{className:"input-group-addon input-group-prepend operator"});this._selectOperatorElm=qt(this.getOperatorOptionValues(),this.grid),e.appendChild(this._selectOperatorElm)}"double"===this.sliderType&&(this._sliderLeftInputElm=Q("input",{type:"range",className:"slider-filter-input",ariaLabel:this.columnFilter.ariaLabel??`${Ve(t+"")} Search Filter`,defaultValue:`${r}`,value:`${r}`,min:`${i}`,max:`${n}`,step:`${s}`}));const a="double"===this.sliderType?o:r;this._sliderRightInputElm=Q("input",{type:"range",className:"slider-filter-input",ariaLabel:this.columnFilter.ariaLabel??`${Ve(t+"")} Search Filter`,defaultValue:`${a}`,value:`${a}`,min:`${i}`,max:`${n}`,step:`${s}`});const l=this.filterOptions?.hideSliderNumber??this.filterOptions?.hideSliderNumbers,d=l?"":"input-group";if(this._divContainerFilterElm=Q("div",{className:`${d} search-filter slick-filter slider-container slider-values filter-${t}`.trim()}),this._sliderRangeContainElm.appendChild(this._sliderTrackElm),"double"===this.sliderType&&this._sliderLeftInputElm&&this._sliderRangeContainElm.appendChild(this._sliderLeftInputElm),this._sliderRangeContainElm.appendChild(this._sliderRightInputElm),l)this._divContainerFilterElm.appendChild(this._sliderRangeContainElm);else{let e;"compound"===this.sliderType&&this._selectOperatorElm?(e=Q("span",{className:"input-group-addon input-group-prepend operator"}),e.appendChild(this._selectOperatorElm)):"double"===this.sliderType&&(e=Q("div",{className:"input-group-addon input-group-prepend slider-range-value"}),this._leftSliderNumberElm=Q("span",{className:`input-group-text lowest-range-${t}`,textContent:`${r}`}),e.appendChild(this._leftSliderNumberElm));const i=Q("div",{className:"input-group-addon input-group-append slider-range-value"});this._rightSliderNumberElm=Q("span",{className:`input-group-text highest-range-${t}`,textContent:`${a}`},i),e&&this._divContainerFilterElm.appendChild(e),this._divContainerFilterElm.appendChild(this._sliderRangeContainElm),this._divContainerFilterElm.appendChild(i)}return this._sliderOptions={minValue:i,maxValue:n,step:s},this._currentValues=[r,o],Array.isArray(e)&&e.length>0&&""!==e[0]&&(this.updateFilterStyle(!0),this._currentValue=r),void 0===this.filterOptions.sliderStartValue&&void 0===this.columnFilter.minValue||(this._currentValue=r),this._argFilterContainerElm.appendChild(this._divContainerFilterElm),this.updateTrackFilledColorWhenEnabled(),this._bindEventService.bind(this._sliderTrackElm,"click",this.sliderTrackClicked.bind(this)),this._bindEventService.bind(this._sliderRightInputElm,["input","change"],this.slideRightInputChanged.bind(this)),this._bindEventService.bind(this._sliderRightInputElm,["change","mouseup","touchend"],this.onValueChanged.bind(this)),"compound"===this.sliderType&&this._selectOperatorElm?this._bindEventService.bind(this._selectOperatorElm,["change"],this.onValueChanged.bind(this)):"double"===this.sliderType&&this._sliderLeftInputElm&&(this._bindEventService.bind(this._sliderLeftInputElm,["input","change"],this.slideLeftInputChanged.bind(this)),this._bindEventService.bind(this._sliderLeftInputElm,["change","mouseup","touchend"],this.onValueChanged.bind(this))),this._divContainerFilterElm}getOperatorOptionValues(){let e;return e=this.columnFilter.compoundOperatorList?this.columnFilter.compoundOperatorList:Zt(this.gridOptions,this.translaterService),Jt(this.gridOptions,e,"numeric"),e}onValueChanged(e){const t=parseInt(this._sliderRightInputElm?.value??"",10);let i,n;if("compound"===this.sliderType||"single"===this.sliderType)"select"!==e?.target?.tagName?.toLowerCase()&&(this._currentValue=+t),i=this._currentValue,n=[i||"0"];else if("double"===this.sliderType){const e=[parseInt(this._sliderLeftInputElm?.value??"",10),t];i=e.join(".."),n=e}if(this._clearFilterTriggered)this.updateFilterStyle(!1),this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:this._clearFilterTriggered,searchTerms:[],shouldTriggerQuery:this._shouldTriggerQuery});else{const t=this._selectOperatorElm?.value??this.operator;this.updateFilterStyle(""!==i);const s=this.columnFilter.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput,r=s&&Re(this._currentValue)||!Re(this._currentValue)&&Re(this._lastSearchValue);"compound"===this.sliderType&&s&&!r||this.callback(e,{columnDef:this.columnDef,operator:t||"",searchTerms:n,shouldTriggerQuery:this._shouldTriggerQuery})}this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this.changeBothSliderFocuses(!1),this.grid.onHeaderRowMouseEnter.notify({column:this.columnDef,grid:this.grid},new ei(e)),this._lastSearchValue=i}changeBothSliderFocuses(e){const t=e?"add":"remove";this._sliderLeftInputElm?.classList[t]("focus"),this._sliderRightInputElm?.classList[t]("focus")}slideLeftInputChanged(e){const t=parseInt(this._sliderLeftInputElm?.value??"",10),i=parseInt(this._sliderRightInputElm?.value??"",10);this._sliderLeftInputElm&&i-t<=(this.filterOptions?.stopGapBetweenSliderHandles??0)&&(this._sliderLeftInputElm.value=String(t-(this.filterOptions?.stopGapBetweenSliderHandles??0))),this._sliderLeftInputElm&&this._sliderRightInputElm&&(+this._sliderLeftInputElm.value>=+this._sliderRightInputElm.value-20?(this._sliderLeftInputElm.style.zIndex="1",this._sliderRightInputElm.style.zIndex="0"):(this._sliderLeftInputElm.style.zIndex="0",this._sliderRightInputElm.style.zIndex="1")),this.sliderLeftOrRightChanged(e,"left",t,i)}slideRightInputChanged(e){const t=parseInt(this._sliderLeftInputElm?.value??"",10),i=parseInt(this._sliderRightInputElm?.value??"",10);"double"===this.sliderType&&this._sliderRightInputElm&&i-t<=(this.filterOptions?.stopGapBetweenSliderHandles??0)&&(this._sliderRightInputElm.value=String(t+(this.filterOptions?.stopGapBetweenSliderHandles??0))),this.sliderLeftOrRightChanged(e,"right",t,i)}sliderLeftOrRightChanged(e,t,i,n){let s=!0;this.updateTrackFilledColorWhenEnabled(),this.changeBothSliderFocuses(!0),this._sliderRangeContainElm.title="double"===this.sliderType?`${i} - ${n}`:`${n}`,"double"===this.sliderType&&this._sliderLeftInputElm&&this._sliderRightInputElm&&("left"===t&&i>n?(this._sliderLeftInputElm.value=`${n}`,s=!1):"right"===t&&i>n&&(this._sliderRightInputElm.value=`${i}`,s=!1));(this.filterOptions?.hideSliderNumber??this.filterOptions?.hideSliderNumbers)||(this._leftSliderNumberElm?.textContent&&(this._leftSliderNumberElm.textContent=this._sliderLeftInputElm?.value??""),this._rightSliderNumberElm?.textContent&&(this._rightSliderNumberElm.textContent=this._sliderRightInputElm?.value??"")),s&&this.grid.onHeaderRowMouseEnter.notify({column:this.columnDef,grid:this.grid},new ei(e))}sliderTrackClicked(e){e.preventDefault();const t=100*(e.offsetX+0)/this._sliderTrackElm.offsetWidth;this._sliderRightInputElm&&"double"!==this.sliderType?(this._sliderRightInputElm.value=`${t}`,this._sliderRightInputElm.dispatchEvent(new Event("change"))):this._sliderLeftInputElm&&this._sliderRightInputElm&&(t<=50?(this._sliderLeftInputElm.value=`${t}`,this._sliderLeftInputElm.dispatchEvent(new Event("change"))):(this._sliderRightInputElm.value=`${t}`,this._sliderRightInputElm.dispatchEvent(new Event("change"))))}updateTrackFilledColorWhenEnabled(){if(this.filterOptions?.enableSliderTrackColoring&&this._sliderRightInputElm){let e=0;this._sliderLeftInputElm&&(e=(+this._sliderLeftInputElm.value-+this._sliderLeftInputElm.min)/(this.sliderOptions?.maxValue??0-+this._sliderLeftInputElm.min)*100);const t=(+this._sliderRightInputElm.value-+this._sliderRightInputElm.min)/(this.sliderOptions?.maxValue??0-+this._sliderRightInputElm.min)*100,i="linear-gradient(to right, %b %p1, %c %p1, %c %p2, %b %p2)".replace(/%b/g,"#eee").replace(/%c/g,this.filterOptions?.sliderTrackFilledColor||this._sliderTrackFilledColor||fa).replace(/%p1/g,`${e}%`).replace(/%p2/g,`${t}%`);this._sliderTrackElm.style.background=i,this._sliderOptions.sliderTrackBackground=i}}updateFilterStyle(e){e?(this._divContainerFilterElm.classList.add("filled"),this._filterElm?.classList.add("filled")):(this._divContainerFilterElm.classList.remove("filled"),this._filterElm?.classList.remove("filled"))}}var ba=Object.defineProperty,ya=(e,t,i)=>((e,t,i)=>t in e?ba(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),_a=class{constructor(e){ya(this,"_distinctEvent"),ya(this,"_boundedEvents",[]),this._distinctEvent=e?.distinctEvent??!1}get boundedEvents(){return this._boundedEvents}dispose(){this.unbindAll(),this._boundedEvents=[]}bind(e,t,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=Array.isArray(t)?t:[t];if("function"==typeof e?.forEach)e.forEach((e=>{for(let t of r)(!this._distinctEvent||this._distinctEvent&&!this.hasBinding(e,t))&&(e.addEventListener(t,i,n),this._boundedEvents.push({element:e,eventName:t,listener:i,groupName:s}))}));else for(let o of r)(!this._distinctEvent||this._distinctEvent&&!this.hasBinding(e,o))&&(e.addEventListener(o,i,n),this._boundedEvents.push({element:e,eventName:o,listener:i,groupName:s}))}hasBinding(e,t){return this._boundedEvents.some((i=>i.element===e&&(!t||i.eventName===t)))}unbind(e,t,i){if(e){let n=Array.isArray(e)?e:[e],s=Array.isArray(t)?t||"":[t||""];for(let e of n){i||(i=this._boundedEvents.find((i=>{if(i.element===e&&(!t||i.eventName===t))return i.listener})));for(let t of s)e?.removeEventListener?.(t,i)}}}unbindAll(e){if(e){let t=Array.isArray(e)?e:[e];for(let e=this._boundedEvents.length-1;e>=0;--e){let i=this._boundedEvents[e];if(t.some((e=>e===i.groupName))){let{element:t,eventName:n,listener:s}=i;this.unbind(t,n,s),this._boundedEvents.splice(e,1)}}}else for(;this._boundedEvents.length>0;){let e=this._boundedEvents.pop(),{element:t,eventName:i,listener:n}=e;this.unbind(t,i,n)}}},Sa=typeof window<"u"&&void 0!==window.multipleSelect?window.multipleSelect:{locales:{}},wa={formatSelectAll:()=>"[Select all]",formatAllSelected:()=>"All selected",formatCountSelected:(e,t)=>`${e} of ${t} selected`,formatNoMatchesFound:()=>"No matches found",formatOkButton:()=>"OK"};Sa.locales["en-US"]=wa;var Ca=Sa.locales,Ea={name:"",placeholder:"",classes:"",classPrefix:"",data:void 0,locale:void 0,selectAll:!0,single:void 0,singleRadio:!1,multiple:!1,hideOptgroupCheckboxes:!1,multipleWidth:80,width:void 0,dropWidth:void 0,maxHeight:250,maxHeightUnit:"px",position:"bottom",displayValues:!1,displayTitle:!1,displayDelimiter:", ",minimumCountSelected:3,ellipsis:!1,isOpen:!1,keepOpen:!1,openOnHover:!1,container:null,filter:!1,filterGroup:!1,filterPlaceholder:"",filterAcceptOnEnter:!1,filterByDataLength:void 0,customFilter(e){let{text:t,label:i,search:n}=e;return(i||t||"").includes(n)},showClear:!1,autoAdjustDropHeight:!1,autoAdjustDropPosition:!1,autoAdjustDropWidthByTextSize:!1,adjustedHeightPadding:10,useSelectOptionLabel:!1,useSelectOptionLabelToHtml:!1,navigationHighlight:!0,infiniteScroll:!1,virtualScroll:!0,cssStyler:()=>null,textTemplate:e=>e.innerHTML.trim(),labelTemplate:e=>e.label,onOpen:()=>!1,onClose:()=>!1,onCheckAll:()=>!1,onUncheckAll:()=>!1,onFocus:()=>!1,onBlur:()=>!1,onOptgroupClick:()=>!1,onBeforeClick:()=>!0,onClick:()=>!1,onFilter:()=>!1,onFilterClear:()=>!1,onClear:()=>!1,onAfterCreate:()=>!1,onDestroy:()=>!1,onAfterDestroy:()=>!1,onDestroyed:()=>!1};Object.assign(Ea,Ca["en-US"]);var Oa={BLOCK_ROWS:50,CLUSTER_BLOCKS:4,DEFAULTS:Ea,METHODS:["init","getOptions","refreshOptions","getSelects","setSelects","enable","disable","open","close","check","uncheck","checkAll","uncheckAll","checkInvert","focus","blur","refresh","destroy"]};function xa(e){let t=Object.prototype.toString.call(e).slice(8,-1).toLowerCase();return"object"===t?(()=>{let t={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=xa(e[i]));return t})():"array"===t?e.map((e=>xa(e))):e}function Ta(e){return null!=e&&""!==e}function ka(e,t,i){if(Array.isArray(e))for(let n of e){if(n[t]===i||n[t]===""+ +n[t]&&+n[t]===i)return n;if("optgroup"===n.type)for(let e of n.children)if(e&&(e[t]===i||e[t]===""+ +e[t]&&+e[t]===i))return e}}function Ia(e){return Object.keys(e).forEach((t=>void 0===e[t]?delete e[t]:"")),e}function Ra(e,t){if("string"!=typeof e)return e;if("function"==typeof t)return t(e);if("function"==typeof e.normalize)return e.normalize("NFD").replace(/[\u0300-\u036F]/g,"");throw new Error("[Multiple-Select-Vanilla] `normalize()` function is not defined, you can optionally provide a custom parser via the `diacriticParser` option.")}function Aa(e){let t=0,i=0,n=0,s=0,r=window.innerHeight??0,o=window.innerWidth??0,a={left:window.pageXOffset||document.documentElement.scrollLeft||0,top:window.pageYOffset||document.documentElement.scrollTop||0},l=a.top,d=a.left,c=Na(e);if(c){let e=c.top??0,a=c.left??0;i=e-l,t=r-(e-l),n=a-d,s=o-(a-d)}return{top:i,bottom:t,left:n,right:s}}function Da(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(" ").filter((e=>e))}function Pa(e,t,i){let n=document.createElement(e);return t&&Object.keys(t).forEach((e=>{let i=t[e];"object"==typeof i?Object.assign(n[e],i):n[e]=t[e]})),i?.appendChild&&i.appendChild(n),n}function Fa(e,t,i){let n=e.props?.innerHTML?function(e,t){let{[t]:i,...n}=e;return n}(e.props,"innerHTML"):e.props,s=Pa(e.tagName,function(e,t){return"object"==typeof e?Object.fromEntries(t?Object.entries(e).filter((e=>{let[i,n]=e;return!Ta(n)&&!t.includes(i)||Ta(n)})):Object.entries(e).filter((e=>{let[t,i]=e;return Ta(i)}))):e}(n,["className","title","style"]),t),r=i;if(r||(r=s),e.props.innerHTML&&(s.innerHTML=e.props.innerHTML),e.attrs)for(let o of Object.keys(e.attrs))s.setAttribute(o,e.attrs[o]);if(e.children)for(let o of e.children)Fa(o,s,r);return t?.appendChild(s),s}function Ma(e){return e.hasOwnProperty("tagName")?Fa(e):document.createElement("li")}function La(e){for(;e?.firstChild;)e.lastChild&&e.removeChild(e.lastChild);return e}function Na(e){if(!e)return;let t=e?.getBoundingClientRect?.(),i=0,n=0,s=0,r=0;return void 0!==t?.top&&void 0!==t.left&&(i=t.top+window.pageYOffset,n=t.left+window.pageXOffset,r=t.right,s=t.bottom),{top:i,left:n,bottom:s,right:r}}function Ba(e,t,i){if(!e)return 0;let n=Number.parseFloat(e.style[i]);if(!n||Number.isNaN(n)){switch(t){case"outer":n=e["width"===i?"offsetWidth":"offsetHeight"];break;case"scroll":n=e["width"===i?"scrollWidth":"scrollHeight"];break;default:n=e["width"===i?"clientWidth":"clientHeight"]}n=e.getBoundingClientRect()[i]}if(!n||Number.isNaN(n)){let t=e.style.display,s=e.style.position;e.style.display="block",e.style.position="absolute";let r=window.getComputedStyle(e)[i];n=Number.parseFloat(r),Number.isNaN(n)&&(n=0),e.style.display=t,e.style.position=s}return n||0}function Ha(e,t){let i=null,n=e?.parentElement;for(;n;){let[e,s,r,o]=t.match(/^([a-z]*)([#.]{1})([a-z\-]+)$/i)||[];if(r&&o)for(let t of o.replace(r,"").split(" "))n.classList.contains(t)&&(s?n?.tagName.toLowerCase()===s&&(i=n):i=n);n=n.parentElement}return i}function za(e,t){e?.style&&(e.style.display="none"===e.style.display&&!1!==t||!0===t?"block":"none")}var $a=class{constructor(e){ya(this,"clusterRows"),ya(this,"cache"),ya(this,"scrollEl"),ya(this,"blockHeight"),ya(this,"clusterHeight"),ya(this,"contentEl"),ya(this,"parentEl"),ya(this,"itemHeight"),ya(this,"lastCluster"),ya(this,"scrollTop"),ya(this,"dataStart"),ya(this,"dataEnd"),ya(this,"rows"),ya(this,"destroy"),ya(this,"callback"),ya(this,"sanitizer"),this.rows=e.rows,this.scrollEl=e.scrollEl,this.contentEl=e.contentEl,this.parentEl=e.contentEl?.parentElement,this.callback=e.callback,this.cache={},this.scrollTop=this.scrollEl.scrollTop,this.initDOM(this.rows),this.scrollEl.scrollTop=this.scrollTop,this.lastCluster=0;let t=()=>{this.lastCluster!==(this.lastCluster=this.getNum())&&(this.initDOM(this.rows),this.callback())};this.scrollEl.addEventListener("scroll",t,!1),this.destroy=()=>{this.scrollEl.removeEventListener("scroll",t,!1),La(this.contentEl)}}reset(e){this.lastCluster=0,this.cache={},La(this.contentEl),this.initDOM(e)}initDOM(e){if(typeof this.clusterHeight>"u"){this.cache.scrollTop=this.scrollEl.scrollTop;let t=Ma(e[0]);this.contentEl.appendChild(t),this.contentEl.appendChild(t),this.contentEl.appendChild(t),this.cache.data=[e[0]],this.getRowsHeight()}let t=this.initData(e,this.getNum()),i=this.checkChanges("data",t.rows),n=this.checkChanges("top",t.topOffset),s=this.checkChanges("bottom",t.bottomOffset);La(this.contentEl),i&&n?(t.topOffset&&this.contentEl.appendChild(this.getExtra("top",t.topOffset)),t.rows.forEach((e=>this.contentEl.appendChild(Ma(e)))),t.bottomOffset&&this.contentEl.appendChild(this.getExtra("bottom",t.bottomOffset))):s&&this.contentEl.lastChild&&(this.contentEl.lastChild.style.height=`${t.bottomOffset}px`)}getRowsHeight(){if(typeof this.itemHeight>"u"){let e=this.parentEl?.style.display||"";this.parentEl&&(""===e||"none"===e)&&(this.parentEl.style.display="block");let t=this.contentEl.children,i=t[Math.floor(t.length/2)];this.itemHeight=i.offsetHeight,this.parentEl&&(this.parentEl.style.display=e)}this.blockHeight=this.itemHeight*Oa.BLOCK_ROWS,this.clusterRows=Oa.BLOCK_ROWS*Oa.CLUSTER_BLOCKS,this.clusterHeight=this.blockHeight*Oa.CLUSTER_BLOCKS}getNum(){this.scrollTop=this.scrollEl.scrollTop;let e=(this.clusterHeight||0)-(this.blockHeight||0);return e&&Math.floor(this.scrollTop/e)||0}initData(e,t){if(e.length0&&void 0!==arguments[0])||arguments[0];this.elm&&this.parentElm&&(this.options.onDestroy({hardDestroy:e}),e&&this.options.onHardDestroy(),this.elm.parentElement&&this.parentElm.parentElement&&this.elm.parentElement.insertBefore(this.elm,this.parentElm.parentElement.firstChild),this.elm.classList.remove("ms-offscreen"),this._bindEventService.unbindAll(),this.virtualScroll?.destroy(),this.dropElm?.remove(),this.dropElm=void 0,this.parentElm.parentNode?.removeChild(this.parentElm),this.fromHtml&&(delete this.options.data,this.fromHtml=!1),this.options.onAfterDestroy({hardDestroy:e}),e&&(this.options.onAfterHardDestroy?.(),Object.keys(this.options).forEach((e=>delete this[e]))))}initLocale(){if(this.options.locale){if("object"==typeof this.options.locale)return void Object.assign(this.options,this.options.locale);let e=window.multipleSelect.locales,t=this.options.locale.split(/-|_/);if(t[0]=t[0].toLowerCase(),t[1]&&(t[1]=t[1].toUpperCase()),e[this.options.locale])Object.assign(this.options,e[this.options.locale]);else if(e[t.join("-")])Object.assign(this.options,e[t.join("-")]);else{if(!e[t[0]])throw new Error(`[multiple-select-vanilla] invalid locales "${this.options.locale}", make sure to import it before using it`);Object.assign(this.options,e[t[0]])}}}initContainer(){let e=this.elm.getAttribute("name")||this.options.name||"";this.options.classes&&this.elm.classList.add(this.options.classes),this.options.classPrefix&&(this.elm.classList.add(this.options.classPrefix),this.options.size&&this.elm.classList.add(`${this.options.classPrefix}-${this.options.size}`)),this.elm.style.display="none",this.labelElm=this.elm.closest("label"),!this.labelElm&&this.elm.id&&(this.labelElm=document.createElement("label"),this.labelElm.htmlFor=this.elm.id),this.labelElm?.querySelector("input")&&(this.labelElm=null),typeof this.options.single>"u"&&(this.options.single=!this.elm.multiple),this.parentElm=Pa("div",{className:Da(`ms-parent ${this.elm.className||""} ${this.options.classes}`).join(" "),dataset:{test:"sel"}}),this.options.darkMode&&this.parentElm.classList.add("ms-dark-mode");let t=this.elm.getAttribute("title")||"";t&&(this.parentElm.title=t),this.options.placeholder=this.options.placeholder||this.elm.getAttribute("placeholder")||"",this.choiceElm=Pa("button",{className:"ms-choice",type:"button"},this.parentElm),this.options.labelId&&(this.choiceElm.id=this.options.labelId,this.choiceElm.setAttribute("aria-labelledby",this.options.labelId)),this.choiceElm.appendChild(Pa("span",{className:"ms-placeholder",textContent:this.options.placeholder})),this.options.showClear&&(this.selectClearElm=Pa("div",{className:"ms-icon ms-icon-close"}),this.selectClearElm.style.display="none",this.choiceElm.appendChild(this.selectClearElm)),this.choiceElm.appendChild(Pa("div",{className:"ms-icon ms-icon-caret"})),this.dropElm=Pa("div",{className:`ms-drop ${this.options.position}`,ariaExpanded:"false"},this.parentElm),this.options.darkMode&&this.dropElm.classList.add("ms-dark-mode"),e&&(this.dropElm.dataset.name=e);let i=this.elm.getAttribute("data-test")||this.options.dataTest;i&&(this.parentElm.dataset.test=i,this.dropElm.dataset.test=i),this.closeElm=this.choiceElm.querySelector(".ms-icon-close"),this.options.dropWidth&&(this.dropElm.style.width="string"==typeof this.options.dropWidth?this.options.dropWidth:`${this.options.dropWidth}px`),function(e,t){e.parentNode?.insertBefore(t,e.nextSibling)}(this.elm,this.parentElm),this.elm.disabled&&(this.choiceElm.classList.add("disabled"),this.choiceElm.disabled=!0),this.selectAllName=`selectAll${e}`,this.selectGroupName=`selectGroup${e}`,this.selectItemName=`selectItem${e}`,this.options.keepOpen||(this._bindEventService.unbindAll("body-click"),this._bindEventService.bind(document.body,"click",(e=>{this.getEventTarget(e)===this.choiceElm||Ha(this.getEventTarget(e),".ms-choice")===this.choiceElm||(this.getEventTarget(e)===this.dropElm||Ha(this.getEventTarget(e),".ms-drop")!==this.dropElm&&this.getEventTarget(e)!==this.elm)&&this.options.isOpen&&this.close("body.click")}),void 0,"body-click"))}initData(){let e=[];if(this.options.data){if(Array.isArray(this.options.data))this.data=this.options.data.map((e=>"string"==typeof e||"number"==typeof e?{text:e,value:e}:e));else if("object"==typeof this.options.data){for(let[t,i]of Object.entries(this.options.data))e.push({value:t,text:`${i}`});this.data=e}}else this.elm.childNodes.forEach((t=>{let i=this.initRow(t);i&&e.push(i)})),this.options.data=e,this.data=e,this.fromHtml=!0;this.dataTotal=function(e){let t=0;return e.forEach(((e,i)=>{"optgroup"===e.type?(e._key=`group_${i}`,e.visible=typeof e.visible>"u"||e.visible,e.children.forEach(((e,n)=>{e&&(e.visible=typeof e?.visible>"u"||e.visible,e.divider||(e._key=`option_${i}_${n}`,t+=1))}))):(e.visible=typeof e.visible>"u"||e.visible,e.divider||(e._key=`option_${i}`,t+=1))})),t}(this.data||[])}initRow(e,t){let i={};return"option"===e.tagName?.toLowerCase()?(i.type="option",i.text=this.options.textTemplate(e),i.value=e.value,i.visible=!0,i.selected=!!e.selected,i.disabled=t||e.disabled,i.classes=e.getAttribute("class")||"",i.title=e.getAttribute("title")||"",e.dataset.value&&(i._value=e.dataset.value),Object.keys(e.dataset).length&&(i._data=e.dataset,i._data.divider&&(i.divider=i._data.divider)),i):"optgroup"===e.tagName?.toLowerCase()?(i.type="optgroup",i.label=this.options.labelTemplate(e),i.visible=!0,i.selected=!!e.selected,i.disabled=e.disabled,i.children=[],Object.keys(e.dataset).length&&(i._data=e.dataset),e.childNodes.forEach((e=>{i.children.push(this.initRow(e,i.disabled))})),i):null}initDrop(){this.initList(),this.update(!0),this.options.isOpen&&this.open(10),this.options.openOnHover&&this.parentElm&&(this._bindEventService.bind(this.parentElm,"mouseover",(()=>this.open(null))),this._bindEventService.bind(this.parentElm,"mouseout",(()=>this.close("hover.mouseout"))))}initFilter(){if(this.filterText="",this.options.filter||!this.options.filterByDataLength)return;let e=0;for(let t of this.data||[])"optgroup"===t.type?e+=t.children.length:e+=1;this.options.filter=e>this.options.filterByDataLength}initList(){if(this.options.filter&&(this.filterParentElm=Pa("div",{className:"ms-search"},this.dropElm),this.filterParentElm.appendChild(Pa("input",{autocomplete:"off",autocapitalize:"off",spellcheck:!1,type:"text",placeholder:this.options.filterPlaceholder||"\ud83d\udd0e\ufe0e"})),this.options.showSearchClear&&this.filterParentElm.appendChild(Pa("span",{className:"ms-icon ms-icon-close"}))),this.options.selectAll&&!this.options.single){let e=this.elm.getAttribute("name")||this.options.name||"";this.selectAllParentElm=Pa("div",{className:"ms-select-all",dataset:{key:"select_all"}});let t=document.createElement("label"),i="ms-icon "+(this.isAllSelected?"ms-icon-check":this.isPartiallyAllSelected?"ms-icon-minus":"ms-icon-uncheck"),n=Pa("div",{className:"icon-checkbox-container"},t);Pa("input",{type:"checkbox",ariaChecked:String(this.isAllSelected),checked:this.isAllSelected,dataset:{name:`selectAll${e}`}},n),Pa("div",{className:i},n),t.appendChild(Pa("span",{textContent:this.formatSelectAll()})),this.selectAllParentElm.appendChild(t),this.dropElm?.appendChild(this.selectAllParentElm)}this.ulElm=document.createElement("ul"),this.ulElm.role="combobox",this.ulElm.ariaExpanded="false",this.ulElm.ariaMultiSelectable=String(!this.options.single),this.dropElm?.appendChild(this.ulElm),this.options.showOkButton&&!this.options.single&&(this.okButtonElm=Pa("button",{className:"ms-ok-button",type:"button",textContent:this.formatOkButton()},this.dropElm)),this.initListItems()}initListItems(){let e=0,t=this.getListRows();if(this.options.selectAll&&!this.options.single&&(e=-1),t.length>Oa.BLOCK_ROWS*Oa.CLUSTER_BLOCKS){let i=this.dropElm&&"none"!==this.dropElm?.style.display;!i&&this.dropElm&&(this.dropElm.style.left="-10000",this.dropElm.style.display="block",this.dropElm.ariaExpanded="true");let n=()=>{if(this.virtualScroll){this._currentHighlightIndex=0,this.updateDataStart=this.virtualScroll.dataStart+e,this.updateDataEnd=this.virtualScroll.dataEnd+e,this.updateDataStart<0&&(this.updateDataStart=0,this._currentHighlightIndex=0);let t=this.getDataLength();this.updateDataEnd>t&&(this.updateDataEnd=t),this.ulElm&&(this.isMoveUpRecalcRequired?this.recalculateArrowMove("up"):this.virtualScroll.dataStart>this.updateDataStart&&this.recalculateArrowMove("down"))}};this.ulElm&&(this.virtualScroll?this.virtualScroll.reset(t):this.virtualScroll=new $a({rows:t,scrollEl:this.ulElm,contentEl:this.ulElm,sanitizer:this.options.sanitizer,callback:()=>{n(),this.events()}})),n(),!i&&this.dropElm&&(this.dropElm.style.left="0",this.dropElm.style.display="none",this.dropElm.ariaExpanded="false")}else this.ulElm&&(La(this.ulElm),t.forEach((e=>this.ulElm.appendChild(Ma(e))))),this.updateDataStart=0,this.updateDataEnd=this.updateData.length;return this.events(),t}getEventTarget(e){return e.composedPath?e.composedPath()[0]:e.target}getListRows(){let e=[];return this.updateData=[],this.data?.forEach((t=>e.push(...this.initListItem(t)))),this.options.infiniteScroll&&e.push({tagName:"li",props:{className:"ms-infinite-option",role:"option"}}),e.push({tagName:"li",props:{className:"ms-no-results",textContent:this.formatNoMatchesFound()}}),e}initListItem(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e?.title||"",n=this.options.multiple?"multiple":"",s=this.options.single?"radio":"checkbox",r=!!e?.selected,o=this.options.single&&!this.options.singleRadio,a="";if(!e?.visible)return[];if(this.updateData.push(e),o&&(a="hide-radio "),e.selected&&(a+="selected "),"optgroup"===e.type){let t,i=[];if(this.options.hideOptgroupCheckboxes||this.options.single)t={tagName:"span",props:{dataset:{name:this.selectGroupName,key:e._key}}};else{let i={tagName:"input",props:{type:"checkbox",dataset:{name:this.selectGroupName,key:e._key},checked:r,disabled:e.disabled}};t=o?i:{tagName:"div",props:{className:"icon-checkbox-container"+("radio"===s?" radio":"")},children:[i,{tagName:"div",props:{className:"ms-icon "+(r?"radio"===s?"ms-icon-radio":"ms-icon-check":"ms-icon-uncheck")}}]}}!a.includes("hide-radio")&&(this.options.hideOptgroupCheckboxes||this.options.single)&&(a+="hide-radio ");let n={tagName:"span",props:{}};this.applyAsTextOrHtmlWhenEnabled(n.props,e.label);let l={tagName:"li",props:{className:Da(`group${this.options.single||e.disabled?" disabled":""} ${a}`).join(" "),role:"option",ariaSelected:String(r),dataset:{key:e._key}},children:[{tagName:"label",props:{className:Da("optgroup"+(this.options.single||e.disabled?" disabled":"")).join(" ")},children:[t,n]}]},d=this.options.cssStyler(e);return d&&(l.props.style=d),i.push(l),e.children.forEach((e=>i.push(...this.initListItem(e,1)))),i}if(a+=e.classes||"",t&&this.options.single&&(a+=`option-level-${t} `),e.divider)return[{tagName:"li",props:{className:"option-divider"}}];let l=n||a?(n+a).trim():"";e.disabled&&(l+=" disabled");let d=""+(e.disabled?"disabled":""),c={tagName:"span",props:{}};this.applyAsTextOrHtmlWhenEnabled(c.props,e.text);let h={tagName:"input",props:{type:s,value:encodeURI(e.value),dataset:{key:e._key,name:this.selectItemName},checked:r,disabled:!!e.disabled}};e.selected&&(h.attrs={checked:"checked"});let u={tagName:"div",props:{className:"icon-checkbox-container"+("radio"===s?" radio":"")},children:[h,{tagName:"div",props:{className:"ms-icon "+(h.props.checked?"radio"===s?"ms-icon-radio":"ms-icon-check":"ms-icon-uncheck")}}]},p={tagName:"li",props:{role:"option",title:i,ariaSelected:String(r),dataset:{key:e._key}},children:[{tagName:"label",props:{className:d},children:[o?h:u,c]}]};l&&(p.props.className=l);let m=this.options.cssStyler(e);return m&&(p.props.style=m),[p]}initSelected(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=0;for(let i of this.data||[])if("optgroup"===i.type){let e=i.children.filter((e=>e?.selected&&!e.disabled&&e.visible)).length;i.children.length&&(i.selected=!this.options.single&&e&&e===i.children.filter((e=>e&&!e.disabled&&e.visible&&!e.divider)).length),t+=e}else t+=i.selected&&!i.disabled&&i.visible?1:0;this.isAllSelected=this.data?.filter((e=>e.selected&&!e.disabled&&e.visible)).length===this.data?.filter((e=>!e.disabled&&e.visible&&!e.divider)).length,this.isPartiallyAllSelected=!this.isAllSelected&&t>0,e||(this.isAllSelected?this.options.onCheckAll():0===t&&this.options.onUncheckAll())}initView(){let e;window.getComputedStyle?(e=window.getComputedStyle(this.elm).width,"auto"===e&&(e=Ba(this.dropElm,"outer","width")+20)):e=Ba(this.elm,"outer","width")+20,this.parentElm.style.width=`${this.options.width||e}px`,this.elm.classList.add("ms-offscreen")}events(){this._bindEventService.unbindAll(["ok-button","search-input","select-all-checkbox","input-checkbox-list","group-checkbox-list","hover-highlight","arrow-highlight","option-list-scroll"]),this.clearSearchIconElm=this.filterParentElm?.querySelector(".ms-icon-close"),this.searchInputElm=this.dropElm?.querySelector(".ms-search input"),this.selectAllElm=this.dropElm?.querySelector(`input[data-name="${this.selectAllName}"]`),this.selectGroupElms=this.dropElm?.querySelectorAll(`input[data-name="${this.selectGroupName}"],span[data-name="${this.selectGroupName}"]`),this.selectItemElms=this.dropElm?.querySelectorAll(`input[data-name="${this.selectItemName}"]:enabled`),this.noResultsElm=this.dropElm?.querySelector(".ms-no-results");let e=e=>{e.preventDefault(),!this.getEventTarget(e).classList.contains("ms-icon-close")&&(this.options.isOpen?this.close("toggle.close"):this.open())};this.labelElm&&this._bindEventService.bind(this.labelElm,"click",(t=>{"label"===this.getEventTarget(t).nodeName.toLowerCase()&&(e(t),(!this.options.filter||!this.options.isOpen)&&this.focus(),t.stopPropagation())})),this._bindEventService.bind(this.choiceElm,"click",e),this.options.onFocus&&this._bindEventService.bind(this.choiceElm,"focus",this.options.onFocus),this.options.onBlur&&this._bindEventService.bind(this.choiceElm,"blur",this.options.onBlur),this._bindEventService.bind(this.parentElm,"keydown",(e=>{"Escape"===e.code&&this.handleEscapeKey()})),this.closeElm&&this._bindEventService.bind(this.closeElm,"click",(e=>{e.preventDefault(),this._checkAll(!1,!0),this.initSelected(!1),this.updateSelected(),this.update(),this.options.onClear()})),this.clearSearchIconElm&&this._bindEventService.bind(this.clearSearchIconElm,"click",(e=>{e.preventDefault(),this.searchInputElm&&(this.searchInputElm.value="",this.searchInputElm.focus()),this._currentHighlightIndex=-1,this.moveHighlightDown(),this.filter(),this.options.onFilterClear()})),this.searchInputElm&&(this._bindEventService.bind(this.searchInputElm,"keydown",(e=>{"Tab"===e.code&&e.shiftKey&&this.close("key.shift+tab")}),void 0,"search-input"),this._bindEventService.bind(this.searchInputElm,"keyup",(e=>{if(this.options.filterAcceptOnEnter&&["Enter","Space"].includes(e.code)&&this.searchInputElm?.value){if(this.options.single){let e=[];this.selectItemElms?.forEach((t=>{"none"!==t.closest("li")?.style.display&&e.push(t)})),e.length&&e[0].hasAttribute("data-name")&&this.setSelects([e[0].value])}else this.selectAllElm?.click();return this.close(`key.${e.code.toLowerCase()}`),void this.focus()}this.filter()}),void 0,"search-input")),this.selectAllElm&&this._bindEventService.bind(this.selectAllElm,"click",(e=>this._checkAll(e.currentTarget?.checked)),void 0,"select-all-checkbox"),this.okButtonElm&&this._bindEventService.bind(this.okButtonElm,"click",(t=>{e(t),t.stopPropagation()}),void 0,"ok-button"),this.selectGroupElms&&this._bindEventService.bind(this.selectGroupElms,"click",(e=>{let t=e.currentTarget,i=t.checked,n=ka(this.data,"_key",t.dataset.key);this._checkGroup(n,i),this.options.onOptgroupClick(Ia({label:n.label,selected:n.selected,data:n._data,children:n.children.map((e=>{if(e)return Ia({text:e.text,value:e.value,selected:e.selected,disabled:e.disabled,data:e._data})}))}))}),void 0,"group-checkbox-list"),this.selectItemElms&&this._bindEventService.bind(this.selectItemElms,"click",(e=>{let t=e.currentTarget,i=t.checked,n=ka(this.data,"_key",t.dataset.key),s=()=>{this.options.single&&this.options.isOpen&&!this.options.keepOpen&&this.close("selection")};!1!==this.options.onBeforeClick(n)?(this._check(n,i),this.options.onClick(Ia({text:n.text,value:n.value,selected:n.selected,data:n._data})),s()):s()}),void 0,"input-checkbox-list"),this.lastFocusedItemKey&&this.dropElm&&this.dropElm.querySelector(`li[data-key=${this.lastFocusedItemKey}]`)?.focus(),this.options.navigationHighlight&&this.dropElm&&(this._bindEventService.bind(this.dropElm,"mouseover",(e=>{let t=this.getEventTarget(e).closest(".ms-select-all")||this.getEventTarget(e).closest("li");if(this.dropElm?.contains(t)&&this.lastMouseOverPosition!==`${e.clientX}:${e.clientY}`){let e=this.dropElm?.querySelectorAll(Ua)||[],i=Array.from(e).findIndex((e=>e.dataset.key===t.dataset.key));this._currentHighlightIndex!==i&&!t.classList.contains("disabled")&&(this._currentSelectedElm=t,this._currentHighlightIndex=i,this.changeCurrentOptionHighlight(t))}this.lastMouseOverPosition=`${e.clientX}:${e.clientY}`}),void 0,"hover-highlight"),this._bindEventService.bind(this.dropElm,"keydown",(e=>{switch(e.key){case"ArrowUp":e.preventDefault(),this.moveHighlightUp();break;case"ArrowDown":e.preventDefault(),this.moveHighlightDown();break;case"Escape":this.handleEscapeKey();break;case"Enter":case" ":if(document.activeElement!==this.okButtonElm){let t=this.getEventTarget(e).closest(".ms-select-all")||this.getEventTarget(e).closest("li");if(" "===e.key&&this.options.filter||this.options.filterAcceptOnEnter&&!t)return;e.preventDefault(),this._currentSelectedElm?.querySelector("input")?.click(),this.options.single&&(this.choiceElm.focus(),this.lastFocusedItemKey=this.choiceElm?.dataset.key||"")}break;case"Tab":e.preventDefault(),e.shiftKey?document.activeElement===this.okButtonElm?(this.focusSelectAllOrList(),this.highlightCurrentOption()):(this.close("key.shift+tab"),this.choiceElm.focus()):(this.changeCurrentOptionHighlight(),this.okButtonElm?.focus())}}),void 0,"arrow-highlight")),this.ulElm&&this.options.infiniteScroll&&this._bindEventService.bind(this.ulElm,"scroll",this.infiniteScrollHandler.bind(this),void 0,"option-list-scroll")}handleEscapeKey(){this.options.keepOpen||(this.close("key.escape"),this.choiceElm.focus())}infiniteScrollHandler(e,t,i){let n=!1;e&&this.getEventTarget(e)&&this.ulElm&&this.scrolledByMouse?this.getEventTarget(e).scrollTop+this.getEventTarget(e).clientHeight===this.ulElm.scrollHeight&&(n=!0):void 0!==t&&t+1===i&&(n=!0),n&&this.ulElm&&(this.virtualScroll?this.initListItems():this.ulElm.scrollTop=0,this._currentHighlightIndex=0,this.highlightCurrentOption())}open(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((t=>{null!==e&&e>=0?(window.clearTimeout(this.openDelayTimer),this.openDelayTimer=window.setTimeout((()=>{this.openDrop(),t()}),e)):(this.openDrop(),t())}))}openDrop(){if(!this.dropElm||this.choiceElm?.classList.contains("disabled"))return;if(this.options.isOpen=!0,this.parentElm.classList.add("ms-parent-open"),this.choiceElm?.querySelector("div.ms-icon-caret")?.classList.add("open"),this.dropElm.style.display="block",this.dropElm.ariaExpanded="true",this.selectAllElm?.parentElement&&(this.selectAllElm.parentElement.style.display="inline-flex"),this.noResultsElm&&(this.noResultsElm.style.display="none"),this.getDataLength()||(this.selectAllElm?.parentElement&&(this.selectAllElm.parentElement.style.display="none"),this.noResultsElm&&(this.noResultsElm.style.display="block")),this.options.container){let e,t=Na(this.dropElm);this.options.container instanceof Node?e=this.options.container:"string"==typeof this.options.container&&(e="body"===this.options.container?document.body:document.querySelector(this.options.container)),e.appendChild(this.dropElm),this.dropElm.style.top=`${t?.top??0}px`,this.dropElm.style.left=`${t?.left??0}px`,this.dropElm.style.minWidth="auto",this.dropElm.style.width=`${Ba(this.parentElm,"outer","width")}px`}let e=this.options.minHeight,t=this.options.maxHeight;"row"===this.options.maxHeightUnit&&(t=Ba(this.dropElm.querySelector("ul>li"),"outer","height")*this.options.maxHeight),this.ulElm??=this.dropElm.querySelector("ul"),this.ulElm&&(e&&(this.ulElm.style.minHeight=`${e}px`),this.ulElm.style.maxHeight=`${t}px`),this.dropElm.querySelectorAll(".multiple").forEach((e=>{e.style.width=`${this.options.multipleWidth}px`})),this.getDataLength()&&this.options.filter?(this.searchInputElm&&(this.searchInputElm.value="",this.searchInputElm.focus()),this.filter(!0)):this.focusSelectAllOrList(),this._currentHighlightIndex<0?this.moveHighlightDown():this.highlightCurrentOption(),this.options.autoAdjustDropWidthByTextSize&&this.adjustDropWidthByText();let i=this.options.position;if(this.options.autoAdjustDropHeight){if(this.options.autoAdjustDropPosition){let{bottom:e,top:t}=Aa(this.dropElm);i=ee?"top":"bottom"}this.adjustDropHeight(i)}this.options.autoAdjustDropPosition&&this.adjustDropPosition(!0),this.options.onOpen()}focusSelectAllOrList(){this.selectAllElm?this.selectAllElm.focus():this.ulElm&&(this.ulElm.tabIndex=0,this.ulElm.focus())}highlightCurrentOption(){let e=this.dropElm?.querySelectorAll(Ua)||[];if(this._currentHighlightIndex<=e.length){let t=e[this._currentHighlightIndex];t&&(this.lastFocusedItemKey=t.dataset.key||"",this._currentSelectedElm=t,this.scrolledByMouse=!1,t.scrollIntoView({block:"nearest"}),this.changeCurrentOptionHighlight(t),window.setTimeout((()=>this.scrolledByMouse=!0),10))}}changeCurrentOptionHighlight(e){e?.classList.add("highlighted"),(this.dropElm?.querySelectorAll(".ms-select-all.highlighted, ul li[data-key].highlighted")||[]).forEach((t=>{t!==e&&t.classList.remove("highlighted")}))}moveHighlightDown(){let e=this.dropElm?.querySelectorAll(Ua)||[],t=e.length;this._currentHighlightIndex0&&this.ulElm){let t=e[this._currentHighlightIndex+(this.options.single?0:1)],i=t?.dataset.key;return this.lastFocusedItemKey=i,this.ulElm.scrollTop=this.ulElm.scrollTop-t?.getBoundingClientRect().height||10,void(this.isMoveUpRecalcRequired=!0)}this._currentHighlightIndex>0&&(this._currentHighlightIndex--,e[this._currentHighlightIndex]?.classList.contains("disabled")&&this.moveHighlightUp()),this.highlightCurrentOption()}recalculateArrowMove(e){let t=this.dropElm?.querySelectorAll(Ua)||[],i=Array.from(t).findIndex((e=>e.dataset.key===this.lastFocusedItemKey));this._currentHighlightIndex=i-1,"down"===e?this.moveHighlightDown():"up"===e&&(this.moveHighlightUp(),this.isMoveUpRecalcRequired=!1)}close(e){this.options.isOpen=!1,this.parentElm.classList.remove("ms-parent-open"),this.choiceElm?.querySelector("div.ms-icon-caret")?.classList.remove("open"),this.dropElm&&(this.dropElm.style.display="none",this.dropElm.ariaExpanded="false",this.options.container&&(this.parentElm.appendChild(this.dropElm),this.dropElm.style.top="auto",this.dropElm.style.left="auto")),this.options.onClose(e)}applyAsTextOrHtmlWhenEnabled(e,t){e||(e={}),this.isRenderAsHtml?e.innerHTML="function"==typeof this.options.sanitizer?this.options.sanitizer(t):t:e.textContent=t}update(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.getSelects(),i=this.getSelects("text");this.options.displayValues&&(i=t);let n=this.choiceElm?.querySelector("span"),s=t.length,r=null,o=()=>{if(this.options.useSelectOptionLabel||this.options.useSelectOptionLabelToHtml){let e=t.join(this.options.displayDelimiter);return this.options.useSelectOptionLabelToHtml?e.replace(/(\b)(on[a-z]+)(\s*)=([^>]*)|javascript:([^>]*)[^>]*|(<\s*)(\/*)script([<>]*).*(<\s*)(\/*)script(>*)|(<|<)(\/*)(script|script defer)(.*)(>|>|>">)/gi,""):e}return i.join(this.options.displayDelimiter)};if(n){if(0===s){let e=this.options.placeholder||"";n.classList.add("ms-placeholder"),this.applyAsTextOrHtmlWhenEnabled(n,e)}else r=sthis.options.minimumCountSelected?`${i.slice(0,this.options.minimumCountSelected).join(this.options.displayDelimiter)}...`:this.formatCountSelected(s,this.dataTotal)&&s>this.options.minimumCountSelected?this.formatCountSelected(s,this.dataTotal):o();if(null!==r&&(n?.classList.remove("ms-placeholder"),this.applyAsTextOrHtmlWhenEnabled(n,r)),this.options.showClear&&this.selectClearElm){let e=r?"block":"none";this.selectClearElm.style.display=e}if(this.options.displayTitle){let e=this.options.useSelectOptionLabel||this.options.useSelectOptionLabelToHtml?"value":"text";n.title=this.getSelects(e).join(this.options.displayDelimiter)}}let a=this.getSelects();this.options.single?this.elm.value=a.length?a[0]:"":Array.from(this.elm.options).forEach((e=>{e.selected=a.some((t=>t===e.value))})),e||this.elm.dispatchEvent(new Event("change"))}updateSelected(e){for(let i=this.updateDataStart;ie.visible)).length;if(this.selectAllElm){this.selectAllElm.ariaChecked=String(this.isAllSelected);let e=this.dropElm?.querySelector(".ms-select-all .icon-checkbox-container div");if(e){let t="";t=this.isAllSelected?"ms-icon-check":this.isPartiallyAllSelected?"ms-icon-minus":"ms-icon-uncheck",e.className=`ms-icon ${t}`}this.selectAllElm.checked=this.isAllSelected,za(this.selectAllElm.closest("li"),!t)}za(this.noResultsElm,t),this.virtualScroll&&(this.virtualScroll.rows=e??this.getListRows())}getData(){return this.options.data}getDataLength(){return this.data?.length??0}getOptions(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=Object.assign({},this.options);return delete t.data,e?xa(t):this.options}refreshOptions(e){(function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=Object.keys(e),s=Object.keys(t);if(i&&n.length!==s.length)return!1;for(let r of n)if(s.includes(r)&&e[r]!==t[r])return!1;return!0})(this.options,e,!0)||(this.options=Object.assign(this.options,e),this.destroy(!1),this.init())}getDropElement(){return this.dropElm}getParentElement(){return this.parentElm}getSelects(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"value",t=[];for(let i of this.data||[])if("optgroup"===i.type){let n=i.children.filter((e=>e?.selected));if(!n.length)continue;if("value"===e||this.options.single)t.push(...n.map((t=>"value"===e&&t._value||t[e])));else{let s=[];s.push("["),s.push(i.label),s.push(`: ${n.map((t=>t[e])).join(", ")}`),s.push("]"),t.push(s.join(""))}}else i.selected&&t.push("value"===e&&i._value||i[e]);return t}setSelects(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!1,s=i=>{for(let s of i){let i=!1;if("text"===t){let t=document.createElement("div");this.applyAsTextOrHtmlWhenEnabled(t,s.text),i=e.includes(t.textContent?.trim()??"")}else i=e.includes(s._value||s.value),!i&&s.value===""+ +s.value&&(i=e.includes(+s.value));s.selected!==i&&(n=!0),s.selected=i}};for(let r of this.data||[])"optgroup"===r.type?s(r.children):s([r]);n&&(this.initSelected(i),this.updateSelected(),this.update(i))}enable(){this.choiceElm&&(this.choiceElm.classList.remove("disabled"),this.choiceElm.disabled=!1)}disable(){this.choiceElm&&(this.choiceElm?.classList.add("disabled"),this.choiceElm.disabled=!0)}check(e){let t=ka(this.data,"value",e);t&&this._check(t,!0)}uncheck(e){let t=ka(this.data,"value",e);t&&this._check(t,!1)}_check(e,t){this.options.single&&this._checkAll(!1,!0),e.selected=t,this.initSelected(),this.updateSelected(),this.update()}checkAll(){this._checkAll(!0)}uncheckAll(){this._checkAll(!1)}_checkAll(e,t){for(let i of this.data||[])"optgroup"===i.type?this._checkGroup(i,e,!0):!i.disabled&&!i.divider&&(t||i.visible)&&(i.selected=e);t||(this.initSelected(),this.updateSelected(),this.update())}_checkGroup(e,t,i){e.selected=t,e.children.forEach((e=>{e&&!e.disabled&&!e.divider&&(i||e.visible)&&(e.selected=t)})),i||(this.initSelected(),this.updateSelected(),this.update())}checkInvert(){if(!this.options.single){for(let e of this.data||[])if("optgroup"===e.type)for(let t of e.children)t&&(t.divider||(t.selected=!t.selected));else e&&!e.divider&&(e.selected=!e.selected);this.initSelected(),this.updateSelected(),this.update()}}focus(){this.choiceElm?.focus(),this.options.onFocus()}blur(){this.choiceElm?.blur(),this.options.onBlur()}refresh(){this.destroy(!1),this.init()}filter(e){let t=this.searchInputElm?.value.trim()??"",i=t.toLowerCase();if(this.filterText===i)return;this.filterText=i;for(let s of this.data||[])if("optgroup"===s.type)if(this.options.filterGroup){let e=`${s?.label??""}`;if(null!=s){let n=this.options.customFilter({label:Ra(e.toString().toLowerCase(),this.options.diacriticParser),search:Ra(i,this.options.diacriticParser),originalLabel:e,originalSearch:t,row:s});s.visible=n;for(let e of s.children)e&&(e.visible=n)}}else{for(let e of s.children)if(null!=e){let n=`${e?.text??""}`;e.visible=this.options.customFilter({text:Ra(n.toString().toLowerCase(),this.options.diacriticParser),search:Ra(i,this.options.diacriticParser),originalText:n,originalSearch:t,row:e,parent:s})}s.visible=s.children.filter((e=>e?.visible)).length>0}else{let e=`${s?.text??""}`;s.visible=this.options.customFilter({text:Ra(e.toString().toLowerCase(),this.options.diacriticParser),search:Ra(i,this.options.diacriticParser),originalText:e,originalSearch:t,row:s})}let n=this.initListItems();this.initSelected(e),this.updateSelected(n),e||this.options.onFilter(t)}adjustDropHeight(e){let t="top"!==e,i=(this.filterParentElm?.getBoundingClientRect().height??0)+(this.okButtonElm?.getBoundingClientRect().height??0)+(this.options.single?0:this.selectAllParentElm?.getBoundingClientRect().height??0)+5,{bottom:n,top:s}=Aa(this.parentElm),r=this.options.maxHeight;if(r=t?n-i-this.options.adjustedHeightPadding:s-i-this.options.adjustedHeightPadding,!this.options.maxHeight||this.options.maxHeight&&ro)t="bottom";else if(o>i&&n>i){if(this.options.container){let i=s-o;i<0&&(i=0),(i>0||e)&&(t="top",this.dropElm.style.top=`${i<0?0:i}px`)}else t="top",this.dropElm.classList.add(t);this.dropElm.classList.remove("bottom")}l-ai.clientHeight?this.getScrollbarWidth():0,o=0;this.dropElm.querySelectorAll("li label").forEach((e=>{e.scrollWidth>o&&(o=e.scrollWidth)})),o+=n+r,othis.options.maxWidth&&(o=this.options.maxWidth),this.options.minWidth&&o"string"==typeof e?ja(document.querySelectorAll(e),t):e instanceof Node?ja([e],t):ja(e,t);function ja(e,t){let i=Array.from(e),n=[];for(let r=0;rdelete e._multipleSelect,i.onAfterHardDestroyed=()=>n[r]=null,n.push(e._multipleSelect)}catch(s){console.error(s)}}return 1===n.length?n[0]:n}Wa.defaults=Oa.DEFAULTS,Wa.locales={...Ca},Wa.methods=Oa.METHODS,typeof window<"u"&&(window.multipleSelect=Wa);class Ga{constructor(e,t,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translaterService=e,this.collectionService=t,this.rxjs=i,this._isMultipleSelect=!0,this._collectionLength=0,this._collectionObservers=[],this._shouldTriggerQuery=!0,this.isFilled=!1,this.enableTranslateLabel=!1,this.subscriptions=[],this._isMultipleSelect=n}get collectionOptions(){return this.columnDef?.filter?.collectionOptions??{}}get columnFilter(){return this.columnDef?.filter??{}}get customStructure(){return this.columnDef?.filter?.customStructure}get gridOptions(){return this.grid?.getOptions()??{}}get defaultOperator(){return this.isMultipleSelect?C.in:C.equal}get filterOptions(){return{...this.gridOptions.defaultFilterOptions?.select,...this.columnFilter?.filterOptions}}get isMultipleSelect(){return this._isMultipleSelect}get msInstance(){return this._msInstance}get selectOptions(){return this.defaultOptions}get operator(){return this.columnFilter?.operator??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}init(e){if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');if(this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.searchTerms=(e.hasOwnProperty("searchTerms")?e.searchTerms:[])||[],this.filterContainerElm=e.filterContainerElm,!this.grid||!this.columnDef||!this.columnFilter||!this.columnFilter.collection&&!this.columnFilter.collectionAsync)throw new Error("[Slickgrid-Universal] You need to pass a \"collection\" (or \"collectionAsync\") for the MultipleSelect/SingleSelect Filter to work correctly. Also each option should include a value/label pair (or value/labelKey when using Locale). For example:: { filter: model: Filters.multipleSelect, collection: [{ value: true, label: 'True' }, { value: false, label: 'False'}] }");if(this.enableTranslateLabel=this.columnFilter?.enableTranslateLabel??!1,this.labelName=this.customStructure?.label??"label",this.labelPrefixName=this.customStructure?.labelPrefix??"labelPrefix",this.labelSuffixName=this.customStructure?.labelSuffix??"labelSuffix",this.optionLabel=this.customStructure?.optionLabel??"value",this.valueName=this.customStructure?.value??"value",this.enableTranslateLabel&&(!this.translaterService||"function"!==typeof this.translaterService.translate))throw new Error('[select-filter] The Translate Service is required for the Select Filter to work correctly when "enableTranslateLabel" is set.');this._locales=this.gridOptions?.locales??g.locales,this.initMultipleSelectTemplate();let t=this.gridOptions?.defaultFilterPlaceholder||"";this.columnFilter?.placeholder&&(t=this.columnFilter.placeholder),this.defaultOptions.placeholder=t||"",this._isMultipleSelect&&this.columnDef?.filter&&(this.columnDef.filter.emptySearchTermReturnAllValues=this.columnDef.filter?.emptySearchTermReturnAllValues??!1);const i=this.columnFilter.collection||[];return new Promise((async(e,t)=>{try{let t;this.columnFilter.collectionAsync&&!this.columnFilter.collection?(t=Xt(this.columnFilter.collectionAsync,this.columnDef,this.renderDomElement.bind(this),this.rxjs,this.subscriptions),e(t)):(t=i,this.renderDomElement(i),e(i)),(this.columnFilter.collectionAsync||this.columnFilter.enableCollectionWatch)&&(await(t??this.columnFilter.collectionAsync),this.watchCollectionChanges())}catch(n){t(n)}}))}clear(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._msInstance&&this._collectionLength>0&&(this._msInstance.setSelects([]),this.updateFilterStyle(!1),this.searchTerms=[],this._shouldTriggerQuery=e,this.callback(void 0,{columnDef:this.columnDef,clearFilterTriggered:!0,shouldTriggerQuery:this._shouldTriggerQuery}),this._shouldTriggerQuery=!0)}destroy(){"function"===typeof this._msInstance?.destroy&&this._msInstance.destroy(),this.filterElm?.remove(),q(this.subscriptions)}getValues(){return this._msInstance?.getSelects()??[]}setValues(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];void 0!==e&&this._msInstance&&(e=Array.isArray(e)?e.every((e=>Pe(e)))?e.map(String):e:[e],this._msInstance.setSelects(e)),this.updateFilterStyle(this.getValues().length>0),this.operator=t||this.defaultOperator,i&&this.onTriggerEvent()}filterCollection(e){let t=e;if(this.columnFilter&&this.columnFilter.collectionFilterBy){const e=this.columnFilter.collectionFilterBy,i=this.columnFilter.collectionOptions?.filterResultAfterEachPass||null;t=this.collectionService?.filterCollection(t,e,i)||[]}return t}sortCollection(e){let t=e;if(this.columnFilter&&this.columnFilter.collectionSortBy){const e=this.columnFilter.collectionSortBy;t=this.collectionService?.sortCollection(this.columnDef,t,e,this.enableTranslateLabel)||[]}return t}watchCollectionChanges(){this.columnFilter?.collection&&(this._collectionObservers.push(u(this.columnFilter.collection,this.watchCallback.bind(this))),p(this.columnFilter,"collection",this.propertyObserverCallback.bind(this)))}propertyObserverCallback(e){this.renderDomElement(e||[]),this.columnFilter.collection&&this._collectionObservers.push(u(this.columnFilter.collection,this.watchCallback.bind(this)))}watchCallback(e){this.renderDomElement(this.columnFilter.collection||e||[])}renderDomElement(e){if(!Array.isArray(e)&&this.collectionOptions?.collectionInsideObjectProperty){e=H(e,this.collectionOptions.collectionInsideObjectProperty||"")}if(!Array.isArray(e))throw new Error('The "collection" passed to the Select Filter is not a valid array.');let t=[];if(e.length>0&&(t=[...e]),this.collectionOptions?.addBlankEntry&&Array.isArray(t)&&t.length>0&&""!==t[0][this.valueName]&&t.unshift(this.createBlankEntry()),this.collectionOptions?.addCustomFirstEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==this.collectionOptions.addCustomFirstEntry[this.valueName]&&t.unshift(this.collectionOptions.addCustomFirstEntry),this.collectionOptions?.addCustomLastEntry&&Array.isArray(t)&&t.length>0){t[t.length-1][this.valueName]!==this.collectionOptions.addCustomLastEntry[this.valueName]&&t.push(this.collectionOptions.addCustomLastEntry)}let i=t;i=this.filterCollection(i),i=this.sortCollection(i);const n=Kr("filter",i,this.columnDef,this.grid,this.isMultipleSelect,this.translaterService,this.searchTerms||[]);this.isFilled=n.hasFoundSearchTerm,this.createFilterElement(n.selectElement,n.dataCollection),this._collectionLength=i.length}createBlankEntry(){const e={[this.labelName]:"",[this.valueName]:""};return this.labelPrefixName&&(e[this.labelPrefixName]=""),this.labelSuffixName&&(e[this.labelSuffixName]=""),e}createFilterElement(e,t){const i=this.columnDef?.id??"";this.elementName=`filter-${i}`,this.defaultOptions.name=this.elementName,ee(this.filterContainerElm),this.filterElm=e,this.filterElm.dataset.columnId=`${i}`,this.updateFilterStyle(this.isFilled),this.filterContainerElm.appendChild(e),this.filterElmOptions={...this.defaultOptions,...this.filterOptions,data:t},this._msInstance=Wa(e,this.filterElmOptions)}initMultipleSelectTemplate(){const e=this.gridOptions?.enableTranslate??!1,t={autoAdjustDropHeight:!0,autoAdjustDropPosition:!0,autoAdjustDropWidthByTextSize:!0,name:`${this.columnDef?.id??""}`,container:"body",darkMode:!!this.gridOptions.darkMode,filter:!1,maxHeight:275,single:!0,singleRadio:!0,showSearchClear:!0,renderOptionLabelAsHtml:this.columnFilter?.enableRenderHtml??!1,sanitizer:e=>this.grid.sanitizeHtmlString(e),onClose:()=>this.onTriggerEvent(),onClear:()=>this.clear()};if(this._isMultipleSelect){t.single=!1,t.singleRadio=!1,t.showOkButton=!0,t.displayTitle=!0;const i=z(this.gridOptions);t.countSelectedText=e&&this.translaterService?.translate?this.translaterService.translate(`${i}X_OF_Y_SELECTED`):this._locales?.TEXT_X_OF_Y_SELECTED,t.allSelectedText=e&&this.translaterService?.translate?this.translaterService.translate(`${i}ALL_SELECTED`):this._locales?.TEXT_ALL_SELECTED,t.noMatchesFoundText=e&&this.translaterService?.translate?this.translaterService.translate(`${i}NO_MATCHES_FOUND`):this._locales?.TEXT_NO_MATCHES_FOUND,t.okButtonText=e&&this.translaterService?.translate?this.translaterService.translate(`${i}OK`):this._locales?.TEXT_OK,t.selectAllText=e&&this.translaterService?.translate?this.translaterService.translate(`${i}SELECT_ALL`):this._locales?.TEXT_SELECT_ALL}this.defaultOptions=t}onTriggerEvent(){if(this._msInstance){const e=this.getValues();this.updateFilterStyle(Array.isArray(e)&&e.length>1||1===e.length&&""!==e[0]),this.searchTerms=e,this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:e,shouldTriggerQuery:this._shouldTriggerQuery}),this._shouldTriggerQuery=!0}}updateFilterStyle(e){e?(this.isFilled=!0,this.filterElm?.classList.add("filled"),this._msInstance?.getParentElement()?.classList.add("filled")):(this.isFilled=!1,this.filterElm?.classList.remove("filled"),this._msInstance?.getParentElement()?.classList.remove("filled"))}}const Ya={autocompleter:class{constructor(e,t,i){this.translaterService=e,this.collectionService=t,this.rxjs=i,this._clearFilterTriggered=!1,this._collectionObservers=[],this._shouldTriggerQuery=!0,this.searchTerms=[],this.isFilled=!1,this.isItemSelected=!1,this.valueName="label",this.enableTranslateLabel=!1,this.subscriptions=[],this._bindEventService=new Vt}get autocompleterOptions(){return this._autocompleterOptions||{}}get collectionOptions(){return this.columnDef?.filter?.collectionOptions??{}}get collection(){return this._collection}get columnFilter(){return this.columnDef?.filter||{}}get filterDomElement(){return this._filterElm}get filterOptions(){return{...this.gridOptions.defaultFilterOptions?.autocompleter,...this.columnFilter?.filterOptions}}get customStructure(){let e=this.columnFilter?.customStructure;const t=this.columnFilter?.type??this.columnDef?.type;return!e&&t===y.object&&this.columnDef?.dataKey&&this.columnDef?.labelKey&&(e={label:this.columnDef.labelKey,value:this.columnDef.dataKey}),e}get defaultOperator(){return C.equal}get gridOptions(){return this.grid?.getOptions()??{}}get instance(){return this._instance}get operator(){return this.columnFilter?.operator??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}init(e){if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');if(this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.searchTerms=(e.hasOwnProperty("searchTerms")?e.searchTerms:[])||[],this.filterContainerElm=e.filterContainerElm,!this.grid||!this.columnDef||!this.columnFilter||!this.columnFilter.collection&&!this.columnFilter.collectionAsync&&!this.columnFilter.filterOptions)throw new Error("[Slickgrid-Universal] You need to pass a \"collection\" (or \"collectionAsync\") for the AutoComplete Filter to work correctly. Also each option should include a value/label pair (or value/labelKey when using Locale). For example:: { filter: model: Filters.autocompleter, collection: [{ value: true, label: 'True' }, { value: false, label: 'False'}] }");this.enableTranslateLabel=this.columnFilter?.enableTranslateLabel??!1,this.labelName=this.customStructure?.label??"label",this.valueName=this.customStructure?.value??"value",this.labelPrefixName=this.customStructure?.labelPrefix??"labelPrefix",this.labelSuffixName=this.customStructure?.labelSuffix??"labelSuffix",this._locales=this.gridOptions?.locales??g.locales;const t=this.columnFilter.collection;return this._collection=t,this.renderDomElement(t),new Promise((async(e,i)=>{try{const i=this.columnFilter.collectionAsync;let n;i&&!this.columnFilter.collection?(n=Xt(i,this.columnDef,this.renderDomElement.bind(this),this.rxjs,this.subscriptions),e(n)):(n=t,e(t)),(i||this.columnFilter.enableCollectionWatch)&&(await(n??i),this.watchCollectionChanges())}catch(n){i(n)}}))}clear(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._filterElm&&(this._clearFilterTriggered=!0,this._shouldTriggerQuery=e,this.searchTerms=[],this._filterElm.value="",this._filterElm.dispatchEvent(new CustomEvent("input")),this.updateFilterStyle(!1))}destroy(){"function"===typeof this._instance?.destroy&&this._instance.destroy(),this._filterElm,this._filterElm?.remove?.(),this._collection=void 0,this._bindEventService.unbindAll(),this._collectionObservers.forEach((e=>e?.disconnect())),q(this.subscriptions)}getValues(){return this._filterElm?.value||""}setValues(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e&&this._filterElm&&(this._filterElm.value=e),this.updateFilterStyle(""!==this.getValues()),this.operator=t||this.defaultOperator,i&&this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:[this.getValues()],shouldTriggerQuery:!0})}filterCollection(e){let t=e;if(this.columnFilter&&this.columnFilter.collectionFilterBy){const e=this.columnFilter.collectionFilterBy,i=this.columnFilter.collectionOptions&&this.columnFilter.collectionOptions.filterResultAfterEachPass||null;t=this.collectionService?.filterCollection(t,e,i)||[]}return t}sortCollection(e){let t=e;if(this.columnFilter&&this.columnFilter.collectionSortBy){const e=this.columnFilter.collectionSortBy;t=this.collectionService?.sortCollection(this.columnDef,t,e,this.enableTranslateLabel)||[]}return t}watchCollectionChanges(){this.columnFilter?.collection&&(this._collectionObservers.push(u(this.columnFilter.collection,(e=>{this.renderDomElement(this.columnFilter.collection||e||[])}))),p(this.columnFilter,"collection",(e=>{this.renderDomElement(e||[]),this.columnFilter.collection&&this._collectionObservers.push(u(this.columnFilter.collection,(e=>{this.renderDomElement(this.columnFilter.collection||e||[])})))})))}renderDomElement(e){if(!Array.isArray(e)&&this.collectionOptions?.collectionInsideObjectProperty){e=H(e,this.collectionOptions.collectionInsideObjectProperty||"")}let t=e;t&&(t=this.filterCollection(t),t=this.sortCollection(t));const i=Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"";this._collection=t,this._filterElm=this.createFilterElement(t,i),this._bindEventService.bind(this._filterElm,"input",this.handleOnInputChange.bind(this)),this._bindEventService.bind(this._filterElm,"blur",(()=>{this.isItemSelected||this.clear()}))}createFilterElement(e,t){this._collection=e;const i=this.columnDef?.id??"";ee(this.filterContainerElm);let n=this.gridOptions?.defaultFilterPlaceholder??"";this.columnFilter?.placeholder&&(n=this.columnFilter.placeholder),this._filterElm=Q("input",{type:"text",ariaLabel:this.columnFilter?.ariaLabel??`${Ve(i+"")} Search Filter`,autocomplete:"off",ariaAutoComplete:"none",placeholder:n,className:`form-control search-filter slick-filter filter-${i} slick-autocomplete-container`,value:t??"",dataset:{columnid:`${i}`}});const s=t;Array.isArray(e)&&(e=e.every((e=>Pe(e)))?e.map((e=>({label:e,value:e}))):e.map((e=>({label:e?.[this.labelName],value:e?.[this.valueName],labelPrefix:e?.[this.labelPrefixName]??"",labelSuffix:e?.[this.labelSuffixName]??""})))),this._autocompleterOptions={input:this._filterElm,debounceWaitMs:200,className:`slick-autocomplete ${this.filterOptions?.className??""}`.trim(),emptyMsg:this.gridOptions.enableTranslate&&this.translaterService?.translate?this.translaterService.translate("NO_ELEMENTS_FOUND"):this._locales?.TEXT_NO_ELEMENTS_FOUND??"No elements found",customize:(e,t,i)=>{i.style.width=""},onSelect:e=>{this.isItemSelected=!0,this.handleSelect(e)},...this.filterOptions},this.gridOptions?.darkMode&&(this._autocompleterOptions.className+=" slick-dark-mode"),this.autocompleterOptions.className=Z(this.autocompleterOptions.className).join(" "),this._autocompleterOptions.renderItem?.layout?(this._autocompleterOptions.className+=` autocomplete-custom-${Ue(this._autocompleterOptions.renderItem.layout)}`,this._autocompleterOptions.render=this.renderCustomItem.bind(this)):Array.isArray(e)?this._autocompleterOptions.render=this._autocompleterOptions.render?.bind(this)??this.renderCollectionItem.bind(this):this._autocompleterOptions.render||(this._autocompleterOptions.render=this.renderRegularItem.bind(this)),this.filterOptions?.fetch?(Gt(this._filterElm,this._autocompleterOptions),this._instance=Ut(this._autocompleterOptions)):this._instance=Ut({...this._autocompleterOptions,fetch:(t,i)=>{e&&i(e.filter((e=>(("string"===typeof e?e:e?.label)||"").toLowerCase().includes(t.toLowerCase()))))}}),this._filterElm.value=s??"";const r=Q("div",{className:"autocomplete-filter-container"});return r.appendChild(this._filterElm),r.appendChild(Q("span")),t&&this._filterElm.classList.add("filled"),this.filterContainerElm.appendChild(r),this.filterContainerElm.appendChild(document.createElement("span")),this._filterElm}handleSelect(e){if(void 0!==e){const t=void 0,i=this.filterOptions?.renderItem??!1,n="string"===typeof e?e:i?e[this.labelName]:e.label;let s="string"===typeof e?e:i?e[this.valueName]:e.value;s=this.trimWhitespaceWhenEnabled(s),this.updateFilterStyle(""!==s),this.setValues(n),this.callback(t,{columnDef:this.columnDef,operator:this.operator,searchTerms:[s],shouldTriggerQuery:this._shouldTriggerQuery}),this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0}return!1}handleOnInputChange(e){let t=e?.target?.value??"";const i=this.filterOptions.triggerOnEveryKeyStroke??!1;if(t=this.trimWhitespaceWhenEnabled(t),this._clearFilterTriggered||""===t||i){const i={columnDef:this.columnDef,shouldTriggerQuery:this._shouldTriggerQuery};this._clearFilterTriggered?i.clearFilterTriggered=this._clearFilterTriggered:(i.operator=this.operator,i.searchTerms=[t]),this.updateFilterStyle(""!==t),this.callback(e,i)}this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0}renderRegularItem(e){return Q("div",{textContent:("string"===typeof e?e:e?.label??"")||""})}renderCustomItem(e){const t=this._autocompleterOptions?.renderItem?.templateCallback(e)??"",i=document.createElement("div");return this.grid.applyHtmlCode(i,t),i}renderCollectionItem(e){const t=this.columnFilter?.enableRenderHtml??!1,i=(e.labelPrefix||"")+(e.label||"")+(e.labelSuffix||""),n=this.grid.sanitizeHtmlString(i)||"",s=document.createElement("div");return s[t?"innerHTML":"textContent"]=n,s}trimWhitespaceWhenEnabled(e){let t=e;const i=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;return"string"===typeof e&&i&&(t=e.trim()),t}updateFilterStyle(e){this.isItemSelected=e,e?this._filterElm.classList.add("filled"):this._filterElm.classList.remove("filled")}},compoundDate:class extends Gr{constructor(e){super(e),this.translaterService=e,this.inputFilterType="compound"}},compoundInput:ga,compoundInputNumber:class extends ma{constructor(e){super(e),this.translaterService=e,this.inputType="number",this.inputFilterType="compound"}},compoundInputPassword:class extends ma{constructor(e){super(e),this.translaterService=e,this.inputType="password",this.inputFilterType="compound"}},compoundInputText:ga,compoundSlider:class extends va{constructor(e){super(e),this.translaterService=e,this.sliderType="compound"}},dateRange:class extends Gr{constructor(e){super(e),this.translaterService=e,this.inputFilterType="range"}},input:ma,inputMask:class extends ma{constructor(e){super(e),this.translaterService=e,this._inputMask="",this.inputType="text"}get inputMask(){return this._inputMask}init(e){if(!e)throw new Error('[Slickgrid-Universal] A filter must always have an "init()" with valid arguments.');if(this.grid=e.grid,this.callback=e.callback,this.columnDef=e.columnDef,this.searchTerms=(e.hasOwnProperty("searchTerms")?e.searchTerms:[])||[],this._cellContainerElm=e.filterContainerElm,this.columnDef?.params?.mask?this._inputMask=this.columnDef.params.mask:this.columnFilter?.params?.mask&&(this._inputMask=this.columnFilter.params.mask),!this._inputMask)throw new Error("[Slickgrid-Universal] The Filters.inputMask requires the mask to be passed in the filter params or the column definition params\n for example:: this.columnDefinitions: [{ id: 'phone', field: 'phone', filter: { model: Filters.inputMask, params: { mask: '000-000-0000' }}}]");const t=Array.isArray(this.searchTerms)&&this.searchTerms.length>=0?this.searchTerms[0]:"";this.createDomFilterElement(t),this._bindEventService.bind(this._filterInputElm,["keyup","blur","change"],this.onTriggerEvent.bind(this))}onTriggerEvent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i="";if(e?.target?.value){let t=e?.target?.value??"";const n=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;"string"===typeof t&&n&&(t=t.trim());const s=this.unmaskValue(t),r=this.maskValue(s);i=s,e?.keyCode>=48&&(this._filterInputElm.value=r,e.preventDefault())}t?(this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:t,shouldTriggerQuery:this._shouldTriggerQuery}),this._filterInputElm.classList.remove("filled")):(this._filterInputElm.classList.add("filled"),this.callback(e,{columnDef:this.columnDef,operator:this.operator,searchTerms:[i],shouldTriggerQuery:this._shouldTriggerQuery})),this._shouldTriggerQuery=!0}maskValue(e){let t=0,i="";return this._inputMask&&(i=this._inputMask.replace(/[09A]/gi,(i=>(("0"===i||"9"===i)&&/\d+/g.test(e[t])||"A"===i.toUpperCase()&&/[^\d]+/gi.test(e[t]))&&e[t++]||""))),i}unmaskValue(e){const t=e.replace(/[^0-9a-z]*/gi,""),i=this._inputMask.replace(/[^0-9a-z]*/gi,"");let n="";for(let s=0;s{if(Array.isArray(i)&&i.length>0){const e=i.join(", ");return Q("span",{title:e,textContent:e})}return i},Za=(e,t,i,n,s,r)=>{const{minDecimal:o,maxDecimal:a,numberPrefix:l,numberSuffix:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(n,r,"decimal","cell");return Me(i)?N(i,o,a,u,l,d,c,h):i},Ja=(e,t,i,n,s)=>{if(!n)return"";const r=n.params||{},o=r?.complexField??r?.complexFieldLabel??n.field;if(!o)throw new Error("For the Formatters.complexObject to work properly, you need to tell it which property of the complex object to use.\n There are 3 ways to provide it:\n 1- via the generic \"params\" with a \"complexField\" property on your Column Definition, example: this.columnDefs = [{ id: 'user', field: 'user', params: { complexField: 'user.firstName' } }]\n 2- via the generic \"params\" with a \"complexField\" and a \"labelKey\" property on your Column Definition, example: this.columnDefs = [{ id: 'user', field: 'user', labelKey: 'firstName', params: { complexField: 'user' } }]\n 3- via the field name that includes a dot notation, example: this.columnDefs = [{ id: 'user', field: 'user.firstName'}] ");if(n.labelKey&&s.hasOwnProperty(o))return s[o]?.[n.labelKey];if("string"===typeof o&&o.indexOf(".")>0){let e=o.split(".").reduce(((e,t)=>e?.hasOwnProperty(t)?e[t]:""),s);return void 0!==e&&null!==e&&("object"!==typeof e||0!==Object.entries(e).length||e instanceof Date)||(e=""),e}return i},el={arrayObjectToCsv:(e,t,i,n,s)=>{const r=n&&n.params||{},o=r.propertyNames,a=r?.includeTitle??!0;let l=r.dataContextProperty;if(l||(l=n?.field?.split(".")[0]||""),!o||!Array.isArray(o)||!l)throw new Error('Formatters.arrayObjectToCsv requires you to pass an array of "propertyNames" (declared in "params") that you want to pull the data from.\n For example, if we have an array of user objects that have the property of firstName & lastName then we need to pass in your column definition:: { params: { propertyNames: [\'firtName\'] }}.\n Optionally, you can also pass the "dataContextProperty" if you wish to run this on another completely different field of the dataContext object.');if(s[l]&&Array.isArray(s[l])&&Array.isArray(s[l])&&s[l].length>0){const e=[];s[l].forEach((t=>{const i=[];o.forEach((e=>{i.push(t[e])})),e.push(i.join(" "))}));const t=e.join(", "),i=Q("span",{textContent:t});return a&&(i.title=t),i}return i},arrayToCsv:Qa,checkmarkMaterial:(e,t,i)=>{let n=!1;const s=Me(i);return s&&(i=+i),(!0===i||s&&+i>0||"string"===typeof i&&i.length>0&&"false"!==i.toLowerCase()&&"0"!==i)&&(n=!0),n?Q("i",{className:"mdi mdi-18px mdi-check checkmark-icon",ariaHidden:"true"}):""},complex:Ja,complexObject:Ja,collection:(e,t,i,n,s,r)=>{if(!i||!n||!n.params||!n.params.collection||!n.params.collection.length)return i;const{params:o,params:{collection:a}}=n,l=o.customStructure?o.customStructure.label:"label",d=o.customStructure?o.customStructure.value:"value";return Array.isArray(i)?Qa(0,0,i.map((e=>K(a,(t=>t[d]===e))[l]))):K(a,(e=>e[d]===i))[l]||""},collectionEditor:(e,t,i,n,s,r)=>{if(!i||!n||!n.editor||!n.editor.collection||!n.editor.collection.length)return i;const{editor:o,editor:{collection:a}}=n,l=o.customStructure?o.customStructure.label:"label",d=o.customStructure?o.customStructure.value:"value";return Array.isArray(i)?a.every((e=>"string"===typeof e))?Qa(0,0,i.map((e=>K(a,(t=>t===e))))):Qa(0,0,i.map((e=>K(a,(t=>t[d]===e))[l]))):K(a,(e=>e[d]===i))[l]||""},currency:(e,t,i,n,s,r)=>{const{currencyPrefix:o,currencySuffix:a,minDecimal:l,maxDecimal:d,numberPrefix:c,numberSuffix:h,decimalSeparator:u,thousandSeparator:p,wrapNegativeNumber:m}=Oo(n,r,"decimal","cell");if(Me(i)){return`${c}${N(i,l,d,m,o,a,u,p)}${h}`}return i},dateIso:To(y.dateIso,"-"),dateTimeIso:To(y.dateTimeIso,"-"),dateTimeShortIso:To(y.dateTimeShortIso,"-"),dateTimeIsoAmPm:To(y.dateTimeIsoAmPm,"-"),dateTimeIsoAM_PM:To(y.dateTimeIsoAM_PM,"-"),dateEuro:To(y.dateEuro,"/"),dateEuroShort:To(y.dateEuroShort,"/"),dateTimeEuro:To(y.dateTimeEuro,"/"),dateTimeEuroShort:To(y.dateTimeEuroShort,"/"),dateTimeShortEuro:To(y.dateTimeShortEuro,"/"),dateTimeEuroAmPm:To(y.dateTimeEuroAmPm,"/"),dateTimeEuroAM_PM:To(y.dateTimeEuroAM_PM,"/"),dateTimeEuroShortAmPm:To(y.dateTimeEuroShortAmPm,"/"),dateTimeEuroShortAM_PM:To(y.dateTimeEuroShortAM_PM,"/"),dateUs:To(y.dateUs,"/"),dateTimeUs:To(y.dateTimeUs,"/"),dateTimeShortUs:To(y.dateTimeShortUs,"/"),dateTimeUsAmPm:To(y.dateTimeUsAmPm,"/"),dateTimeUsAM_PM:To(y.dateTimeUsAM_PM,"/"),dateTimeUsShort:To(y.dateTimeUsShort,"/"),dateTimeUsShortAmPm:To(y.dateTimeUsShortAmPm,"/"),dateTimeUsShortAM_PM:To(y.dateTimeUsShortAM_PM,"/"),dateUsShort:To(y.dateUsShort,"/"),dateUtc:To(y.dateUtc,"-"),decimal:Za,dollar:(e,t,i,n,s,r)=>{const{minDecimal:o,maxDecimal:a,decimalSeparator:l,thousandSeparator:d,wrapNegativeNumber:c}=Oo(n,r,"currency","cell");return Me(i)?N(i,o,a,c,"$","",l,d):i},dollarColored:(e,t,i,n,s,r)=>{const{minDecimal:o,maxDecimal:a,decimalSeparator:l,thousandSeparator:d,wrapNegativeNumber:c}=Oo(n,r,"currency","cell");if(Me(i)){const e=i>=0?"green":"red",t=Q("span",{ariaHidden:"true",textContent:N(i,o,a,c,"$","",l,d)});return t.style.color=e,t}return i},dollarColoredBold:(e,t,i,n,s,r)=>{const{minDecimal:o,maxDecimal:a,decimalSeparator:l,thousandSeparator:d,wrapNegativeNumber:c}=Oo(n,r,"currency","cell");if(Me(i)){const e=i>=0?"green":"red",t=Q("span",{ariaHidden:"true",textContent:N(i,o,a,c,"$","",l,d)});return t.style.color=e,t.style.fontWeight="bold",t}return i},hyperlink:(e,t,i,n,s,r)=>{const o=n&&n.params||{};let a=o.hyperlinkText?o.hyperlinkText:i;a=r.sanitizeHtmlString(a);let l=o.hyperlinkUrl?o.hyperlinkUrl:i;l=r.sanitizeHtmlString(l);const d=l.match(/^(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-.,@?^=%&:/~+#]*[\w\-@?^=%&/~+#])?/i);if(d&&Array.isArray(d)&&d.length>0){return Q("a",{href:d[0],textContent:a})}return i},icon:(e,t,i,n)=>{const s=n?.params??{},r=s.iconCssClass||s.icon||s.formatterIcon;if(!r)throw new Error('[Slickgrid-Universal] When using `Formatters.icon`, you must provide the "iconCssClass" via the generic "params". (e.g.: `{ formatter: Formatters.icon, params: { iconCssClass: "mdi mdi-magnify" }}`');return Q("i",{className:r,ariaHidden:"true",title:s.title||null})},iconBoolean:(e,t,i,n)=>{const s=(n?.params||{}).cssClass;if(!s)throw new Error('[Slickgrid-Universal] When using `Formatters.iconBoolean`, you must provide You must provide the "cssClass", e.g.: { formatter: Formatters.iconBoolean, params: { cssClass: "mdi mdi-check" }}');let r=!1;const o=!isNaN(i);return(!0===i||o&&parseFloat(i)>0||!o&&"string"===typeof i&&"false"!==i.toLowerCase()&&"0"!==i)&&(r=!0),r?Q("i",{className:s,ariaHidden:"true"}):""},mask:(e,t,i,n,s,r)=>{const o=(n.params||{}).mask;if(!o)throw new Error('You must provide a "mask" via the generic "params" options (e.g.: { formatter: Formatters.mask, params: { mask: \'000-000\' }}');if(i){let e=0;const t=i.toString(),n=r.getOptions()||{},s=n?.preventDocumentFragmentUsage?document.createElement("span"):new DocumentFragment;return s.textContent=o.replace(/[09A]/gi,(()=>t[e++]||"")),s}return i},multiple:Co,percent:(e,t,i,n,s,r)=>{const{minDecimal:o,maxDecimal:a,decimalSeparator:l,thousandSeparator:d,wrapNegativeNumber:c}=Oo(n,r,"percent","cell");if(Me(i)){return N(100*i,o,a,c,"","%",l,d)}return i},percentComplete:(e,t,i,n,s,r)=>{const{minDecimal:o,maxDecimal:a,decimalSeparator:l,thousandSeparator:d,wrapNegativeNumber:c}=Oo(n,r,"percent","cell");if(Me(i)){const e=i<50?"red":"green",t=N(i,o,a,c,"","%",l,d);return Q("span",{textContent:i>100?"100%":t,style:{color:e}})}return i},percentCompleteBar:(e,t,i)=>{if(!Me(i))return"";let n="",s=parseFloat(i);return s>100&&(s=100),n=s<30?"red":s<70?"silver":"green",Q("span",{className:"percent-complete-bar",title:`${s}%`,style:{background:n,width:`${s}%`}})},percentCompleteBarWithText:(e,t,i)=>{if(!Me(i))return"";let n="",s=parseFloat(i);return s>100&&(s=100),n=s<30?"red":s<70?"silver":"green",Q("div",{className:"percent-complete-bar-with-text",title:`${s}%`,textContent:`${s}%`,style:{background:n,width:`${s}%`}})},percentSymbol:(e,t,i,n,s,r)=>{const{minDecimal:o,maxDecimal:a,decimalSeparator:l,thousandSeparator:d,wrapNegativeNumber:c}=Oo(n,r,"percent","cell");return Me(i)?N(i,o,a,c,"","%",l,d):i},progressBar:(e,t,i)=>{if(!Me(i))return"";let n="",s=parseFloat(i);s>100&&(s=100),n=s<30?"danger":s<70?"warning":"success";const r=Q("div",{className:"progress"});return r.appendChild(Q("div",{className:`progress-bar progress-bar-${n} bg-${n}`,role:"progressbar",ariaValueNow:String(s),ariaValueMin:"0",ariaValueMax:"100",textContent:`${s}%`,style:{minWidth:"2em",width:`${s}%`}})),r},translate:(e,t,i,n,s,r)=>{const o=(r?.getOptions()??{}).translater||n&&n.params&&n.params.translater;if(!o||"function"!==typeof o.translate)throw new Error('"Formatters.translate" requires the Translate Service to be provided as a Grid Options "translater" (or "i18n" depending on which framework you use).\n For example: this.gridOptions = { enableTranslate: true, translater: this.translateService }');return void 0!==i&&null!==i&&"string"!==typeof i&&(i+=""),i?o.translate(i):""},translateBoolean:(e,t,i,n,s,r)=>{const o=(r?.getOptions()??{}).translater||n&&n.params&&n.params.translater;if(!o||"function"!==typeof o.translate)throw new Error('"Formatters.translateBoolean" requires the Translate Service to be provided as a Grid Options "translater" (or "i18n" depending on which framework you use).\n For example: this.gridOptions = { enableTranslate: true, translater: this.translateService }');return void 0!==i&&null!==i&&"string"!==typeof i&&(i+=""),i?o.translate(i.toUpperCase()):""},tree:(e,t,i,n,s,r)=>{const o=r.getOptions(),a=o?.treeDataOptions,l=a?.indentMarginLeft??15,d=a?.collapsedPropName??g.treeDataProperties.COLLAPSED_PROP,c=a?.hasChildrenPropName??g.treeDataProperties.HAS_CHILDREN_PROP,h=a?.levelPropName??g.treeDataProperties.TREE_LEVEL_PROP;let u=i;if(u=B(n,s,i),null===u||void 0===u||void 0===s)return"";if(!s.hasOwnProperty(h))throw new Error('[Slickgrid-Universal] You must provide valid "treeDataOptions" in your Grid Options, however it seems that we could not find any tree level info on the current item datacontext row.');const p=s?.[h]??0,m=document.createElement("span");m.style.display="inline-block",m.style.width=l*p+"px";const f=`slick-tree-level-${p}`;let v="";s[c]&&(v=s?.[d]?"collapsed":"expanded"),a?.titleFormatter&&(u=Io(a.titleFormatter,e,t,n,s,r));const b=Q("div",{className:`slick-group-toggle ${v}`.trim(),ariaExpanded:String("expanded"===v)}),y=Q("span",{className:"slick-tree-title"});r.applyHtmlCode(y,u),y.setAttribute("level",p);const _=o?.preventDocumentFragmentUsage?document.createElement("span"):new DocumentFragment;return _.appendChild(m),_.appendChild(b),_.appendChild(y),{addClasses:f,html:_}},treeParseTotals:(e,t,i,n,s,r)=>{const o=r.getOptions(),a=o?.treeDataOptions?.hasChildrenPropName??g.treeDataProperties.HAS_CHILDREN_PROP,{groupTotalsFormatter:l,treeTotalsFormatter:d,params:c}=n;if(!l&&!d)throw new Error('[Slickgrid-Universal] When using Formatters.treeParseTotals, you must provide a total formatter via "groupTotalsFormatter" or "treeTotalsFormatter".');if(s[a]&&s?.__treeTotals&&(l||d)){return(d??l)(s?.__treeTotals,n,r)}if(c.formatters){let o=i;for(const l of c.formatters)s[a]||s?.__treeTotals||"function"!==typeof l||(o=l(e,t,o,n,s,r)||i);return o}return i},treeExport:(e,t,i,n,s,r)=>{const o=r.getOptions(),a=o?.treeDataOptions,l=a?.collapsedPropName??g.treeDataProperties.COLLAPSED_PROP,d=a?.hasChildrenPropName??g.treeDataProperties.HAS_CHILDREN_PROP,c=a?.levelPropName??g.treeDataProperties.TREE_LEVEL_PROP,h=a?.exportIndentMarginLeft??5,u=a?.exportIndentationLeadingChar??".",p=a?.exportIndentationLeadingSpaceCount??3,m=o?.excelExportOptions?.groupCollapsedSymbol??"\u2b9e",f=o?.excelExportOptions?.groupExpandedSymbol??"\u2b9f";let v=i;if(v=B(n,s,i),null===v||void 0===v||void 0===s)return"";if(!s.hasOwnProperty(c))throw new Error('[Slickgrid-Universal] You must provide valid "treeDataOptions" in your Grid Options, however it seems that we could not find any tree level info on the current item datacontext row.');const b=s?.[c]??0;let y="",_=0;s[d]?(y=s?.[l]?m:f,_=0===b?0:h*b):_=h*(0===b?0:b+1);const S=Ce(_);a?.titleFormatter&&(v=Io(a.titleFormatter,e,t,n,s,r));v=`${0===b&&y?"":0===b?`${u}${Ce(p)}`:u}${S}${y} ${v}`;return Ze(v)}},tl=(e,t,i)=>{const n=t.field??"";let s=e.avg?.[n];const r=t?.params;let o=r?.groupFormatterPrefix||"";const a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"regular","group");if(Me(s)){if(s<0){if(s=Math.abs(s),u){if(isNaN(l)&&isNaN(d)){return`${o}(${Y(Math.round(s),h)})${a}`}return`${o}(${L(s,l,d,c,h)})${a}`}o+="-"}if(isNaN(l)&&isNaN(d)){return`${o}${Y(Math.round(s),h)}${a}`}return`${o}${L(s,l,d,c,h)}${a}`}return""},il=(e,t,i)=>{const n=t.field??"",s=e.avg?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",l=r?.groupFormatterCurrencyPrefix||"",d=r?.groupFormatterCurrencySuffix||"",{minDecimal:c,maxDecimal:h,decimalSeparator:u,thousandSeparator:p,wrapNegativeNumber:m}=Oo(t,i,"currency","group");if(Me(s)){return`${o}${N(s,c,h,m,l,d,u,p)}${a}`}return""},nl=(e,t,i)=>{const n=t.field??"",s=e.avg?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"currency","group");if(Me(s)){return`${o}${N(s,l,d,u,"$","",c,h)}${a}`}return""},sl=(e,t,i)=>{const n=t.field??"";let s=e.avg?.[n];const r=t?.params;let o=r?.groupFormatterPrefix||"";const a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"percent","group");if(Me(s)){if(s<0){if(s=Math.abs(s),u){if(isNaN(l)&&isNaN(d)){return`${o}(${Y(Math.round(s),h)}%)${a}`}return`${o}(${L(s,l,d,c,h)}%)${a}`}o+="-"}if(isNaN(l)&&isNaN(d)){return`${o}${Y(Math.round(s),h)}%${a}`}return`${o}${L(s,l,d,c,h)}%${a}`}return""},rl=(e,t,i)=>{const n=t.field??"",s=e.max?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"regular","group");if(Me(s)){return`${o}${N(s,l,d,u,"","",c,h)}${a}`}return""},ol=(e,t,i)=>{const n=t.field??"",s=e.min?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"regular","group");if(Me(s)){return`${o}${N(s,l,d,u,"","",c,h)}${a}`}return""},al=(e,t,i)=>{const n=t.field??"",s=e.sum?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"regular","group");if(Me(s)){return`${o}${N(s,l,d,u,"","",c,h)}${a}`}return""},ll=(e,t,i)=>{const n=t.field??"",s=e.sum?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"regular","group");if(Me(s)){return Q("span",{style:{fontWeight:"bold"},textContent:`${o}${N(s,l,d,u,"","",c,h)}${a}`})}return""},dl=(e,t,i)=>{const n=t.field??"",s=e.sum?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"regular","group");if(Me(s)){return Q("span",{style:{color:s>=0?"green":"red"},textContent:`${o}${N(s,l,d,u,"","",c,h)}${a}`})}return""},cl=(e,t,i)=>{const n=t.field??"",s=e.sum?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",l=r?.groupFormatterCurrencyPrefix||"",d=r?.groupFormatterCurrencySuffix||"",{minDecimal:c,maxDecimal:h,decimalSeparator:u,thousandSeparator:p,wrapNegativeNumber:m}=Oo(t,i,"currency","group");if(Me(s)){return`${o}${N(s,c,h,m,l,d,u,p)}${a}`}return""},hl=(e,t,i)=>{const n=t.field??"",s=e.sum?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",l=r?.groupFormatterCurrencyPrefix||"",d=r?.groupFormatterCurrencySuffix||"",{minDecimal:c,maxDecimal:h,decimalSeparator:u,thousandSeparator:p,wrapNegativeNumber:m}=Oo(t,i,"currency","group");if(Me(s)){return Q("span",{style:{color:s>=0?"green":"red"},textContent:`${o}${N(s,c,h,m,l,d,u,p)}${a}`})}return""},ul=(e,t,i)=>{const n=t.field??"",s=e.sum?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"currency","group");if(Me(s)){return`${o}${N(s,l,d,u,"$","",c,h)}${a}`}return""},pl=(e,t,i)=>{const n=t.field??"",s=e.sum?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"currency","group");if(Me(s)){return Q("span",{style:{fontWeight:"bold"},textContent:`${o}${N(s,l,d,u,"$","",c,h)}${a}`})}return""},ml=(e,t,i)=>{const n=t.field??"",s=e.sum?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"currency","group");if(Me(s)){return Q("span",{style:{color:s>=0?"green":"red"},textContent:`${o}${N(s,l,d,u,"$","",c,h)}${a}`})}return""},gl=(e,t,i)=>{const n=t.field??"",s=e.sum?.[n],r=t?.params,o=r?.groupFormatterPrefix||"",a=r?.groupFormatterSuffix||"",{minDecimal:l,maxDecimal:d,decimalSeparator:c,thousandSeparator:h,wrapNegativeNumber:u}=Oo(t,i,"currency","group");if(Me(s)){return Q("span",{style:{color:s>=0?"green":"red",fontWeight:"bold"},textContent:`${o}${N(s,l,d,u,"$","",c,h)}${a}`})}return""};class fl{constructor(){this.options=qa}}class vl{constructor(e){this._value=null,this._boundedEventWithListeners=[],this._elementBindings=[],this._binding=e,this._property=e.property||"",this._elementBindings=[],e.property&&e.variable&&(e.variable.hasOwnProperty(e.property)||e.property in e.variable)?this._value=e.variable[e.property]:this._value=e.variable,"object"===typeof e.variable&&Object.defineProperty(e.variable,e.property,{get:this.valueGetter.bind(this),set:this.valueSetter.bind(this)})}get boundedEventWithListeners(){return this._boundedEventWithListeners}get elementBindings(){return this._elementBindings}get property(){return this._property}dispose(){this.unbindAll(),this._boundedEventWithListeners=[],this._elementBindings=[]}valueGetter(){return this._value}valueSetter(e){if(this._value=e,Array.isArray(this._elementBindings))for(const t of this._elementBindings)t?.element&&t?.attribute&&(t.element[t.attribute]=e)}bind(e,t,i,n){return e&&e.forEach?e.forEach((e=>this.bindSingleElement(e,t,i,n))):e&&this.bindSingleElement(e,t,i,n),this}unbind(e,t,i,n,s){if(e){e.removeEventListener(t,i,n);const r=this._boundedEventWithListeners.findIndex((e=>e.uid===s));r>=0&&this._boundedEventWithListeners.splice(r,1)}}unbindAll(){let e=this._boundedEventWithListeners.pop();for(;e;){const{element:t,eventName:i,listener:n,uid:s}=e;this.unbind(t,i,n,void 0,s),e=this._boundedEventWithListeners.pop()}this._boundedEventWithListeners=[]}bindSingleElement(e,t,i,n){const s={element:e,attribute:t};if(e){if(i){const r=()=>{let i=e[t];if(this.hasData(i)&&"number"===e?.type&&(i=+i),this.valueSetter(i),(this._binding.variable.hasOwnProperty(this._binding.property)||this._binding.property in this._binding.variable)&&(this._binding.variable[this._binding.property]=this.valueGetter()),"function"===typeof n)return n(this.valueGetter())};s.event=i,s.listener=r,e.addEventListener(i,r),this._boundedEventWithListeners.push({element:e,eventName:i,listener:r,uid:this.generateUuidV4()})}this._elementBindings.push(s),e[t]=this._value}}generateUuidV4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}hasData(e){return void 0!==e&&null!==e&&""!==e}}class bl{constructor(){this._observers=[],this._querySelectorPrefix=""}get querySelectorPrefix(){return this._querySelectorPrefix||""}set querySelectorPrefix(e){this._querySelectorPrefix=e}get observers(){return this._observers}dispose(){let e=this._observers.pop();for(;e;)e.dispose(),e=this._observers.pop();this._observers=[]}addElementBinding(e,t,i,n,s,r){const o=document.querySelectorAll(`${this.querySelectorPrefix}${i}`);let a=this._observers.find((t=>t.property===e));a||(a=new vl({variable:e,property:t})),Array.isArray(s)?s.forEach((e=>a?.bind(o,n,e,r))):a?.bind(o,n,s,r),this._observers.push(a)}bindEventHandler(e,t,i,n){document.querySelectorAll(`${this.querySelectorPrefix}${e}`).forEach((e=>{e?.addEventListener&&e.addEventListener(t,i,n)}))}setElementAttributeValue(e,t,i){document.querySelectorAll(`${this.querySelectorPrefix}${e}`).forEach((e=>{e.textContent="",e&&t in e&&(e[t]=i)}))}}class yl{get eventHandler(){return this._eventHandler}get gridUid(){return this.grid?.getUID()??""}get gridUidSelector(){return this.gridUid?`.${this.gridUid}`:""}get gridOptions(){return this.grid?.getOptions()??{}}get locales(){return this.gridOptions?.locales??g.locales}set metrics(e){this.renderMetrics(e)}get leftFooterText(){return document.querySelector(`.slick-custom-footer${this.gridUidSelector} .left-footer`)?.textContent??""}set leftFooterText(e){this.renderLeftFooterText(e)}get rightFooterText(){return document.querySelector(`.slick-custom-footer${this.gridUidSelector} .right-footer`)?.textContent??""}set rightFooterText(e){this.renderRightFooterText(e)}constructor(e,t,i,n){if(this.grid=e,this.customFooterOptions=t,this.pubSubService=i,this.translaterService=n,this._enableTranslate=!1,this._isLeftFooterOriginallyEmpty=!0,this._isLeftFooterDisplayingSelectionRowCount=!1,this._isRightFooterOriginallyEmpty=!0,this._selectedRowCount=0,this._subscriptions=[],this._bindingHelper=new bl,this._bindingHelper.querySelectorPrefix=`.${this.gridUid} `,this._eventHandler=new ii,this._enableTranslate=this.gridOptions?.enableTranslate??!1,this._isLeftFooterOriginallyEmpty=!this.gridOptions.customFooterOptions?.leftFooterText,this._isRightFooterOriginallyEmpty=!this.gridOptions.customFooterOptions?.rightFooterText,this.registerOnSelectedRowsChangedWhenEnabled(t),this._enableTranslate&&(!this.translaterService||!this.translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');if(this.translateCustomFooterTexts(),this._enableTranslate&&this.pubSubService?.subscribe){const e=this.translaterService?.eventName??"onLanguageChange";this._subscriptions.push(this.pubSubService.subscribe(e,(()=>this.translateCustomFooterTexts())))}}dispose(){this._eventHandler.unsubscribeAll(),this.pubSubService.unsubscribeAll(this._subscriptions),this._bindingHelper.dispose(),this._footerElement?.remove()}renderFooter(e){this.translateCustomFooterTexts(),this.createFooterContainer(e)}renderMetrics(e){const t=e?.endTime?kt(e.endTime,this.customFooterOptions.dateFormat,"en-US"):"";this._bindingHelper.setElementAttributeValue("span.last-update-timestamp","textContent",t),this._bindingHelper.setElementAttributeValue("span.item-count","textContent",e.itemCount),this._bindingHelper.setElementAttributeValue("span.total-count","textContent",e.totalItemCount),this.customFooterOptions.metricTexts?.lastUpdate&&this._bindingHelper.addElementBinding(this.customFooterOptions.metricTexts,"lastUpdate","span.text-last-update","textContent"),this._bindingHelper.addElementBinding(this.customFooterOptions.metricTexts,"items","span.text-items","textContent"),this._bindingHelper.addElementBinding(this.customFooterOptions.metricTexts,"of","span.text-of","textContent")}renderLeftFooterText(e){this._bindingHelper.setElementAttributeValue("div.left-footer","textContent",e)}renderRightFooterText(e){this._bindingHelper.setElementAttributeValue("div.right-footer","textContent",e)}translateCustomFooterTexts(){if(this.gridOptions.enableTranslate&&this.translaterService?.translate){this.customFooterOptions.metricTexts=this.customFooterOptions.metricTexts||{};for(const e of Object.keys(this.customFooterOptions.metricTexts))if(e.lastIndexOf("Key")>0){const t=e.substring(0,e.lastIndexOf("Key"));this.customFooterOptions.metricTexts[t]=this.translaterService.translate(this.customFooterOptions.metricTexts[e]||" ")}this._isLeftFooterDisplayingSelectionRowCount&&(this.leftFooterText=`${this._selectedRowCount} ${this.customFooterOptions.metricTexts.itemsSelected}`)}else this.locales&&(this.customFooterOptions.metricTexts=this.customFooterOptions.metricTexts||{},this.customFooterOptions.metricTexts.lastUpdate=this.customFooterOptions.metricTexts.lastUpdate||this.locales?.TEXT_LAST_UPDATE||"TEXT_LAST_UPDATE",this.customFooterOptions.metricTexts.items=this.customFooterOptions.metricTexts.items||this.locales?.TEXT_ITEMS||"TEXT_ITEMS",this.customFooterOptions.metricTexts.itemsSelected=this.customFooterOptions.metricTexts.itemsSelected||this.locales?.TEXT_ITEMS_SELECTED||"TEXT_ITEMS_SELECTED",this.customFooterOptions.metricTexts.of=this.customFooterOptions.metricTexts.of||this.locales?.TEXT_OF||"TEXT_OF")}createFooterContainer(e){const t=Q("div",{className:`slick-custom-footer ${this.gridUid}`,style:{width:"100%",height:`${this.customFooterOptions.footerHeight||20}px`}}),i=Q("div",{className:`left-footer ${this.customFooterOptions.leftContainerClass}`});this.grid.applyHtmlCode(i,this.customFooterOptions.leftFooterText),t.appendChild(i),t.appendChild(this.createFooterRightContainer()),this._footerElement=t,e?.appendChild&&this._footerElement&&e.appendChild(this._footerElement)}createFooterRightContainer(){const e=Q("div",{className:`right-footer ${this.customFooterOptions.rightContainerClass||""}`});if(this._isRightFooterOriginallyEmpty){if(!this.customFooterOptions.hideMetrics){e.classList.add("metrics");const t=Q("span",{className:"timestamp"},e);if(!this.customFooterOptions.hideLastUpdateTimestamp){const e=this.createFooterLastUpdate();e&&t.appendChild(e)}e.appendChild(Q("span",{className:"item-count",textContent:`${this.metrics?.itemCount??"0"}`})),this.customFooterOptions.hideTotalItemCount||(e.appendChild(document.createTextNode("\r\n")),e.appendChild(Q("span",{className:"text-of",textContent:` ${this.customFooterOptions.metricTexts?.of??"of"} `})),e.appendChild(document.createTextNode("\r\n")),e.appendChild(Q("span",{className:"total-count",textContent:`${this.metrics?.totalItemCount??"0"}`}))),e.appendChild(document.createTextNode("\r\n")),e.appendChild(Q("span",{className:"text-items",textContent:` ${this.customFooterOptions.metricTexts?.items??"items"} `}))}}else this.grid.applyHtmlCode(e,this.customFooterOptions.rightFooterText);return e}createFooterLastUpdate(){const e=this.customFooterOptions?.metricTexts?.lastUpdate??"Last Update",t=this.metrics?.endTime?kt(this.metrics?.endTime,this.customFooterOptions.dateFormat,"en-US"):"",i=Q("span");return i.appendChild(Q("span",{className:"text-last-update",textContent:e})),i.appendChild(document.createTextNode("\r\n")),i.appendChild(Q("span",{className:"last-update-timestamp",textContent:t})),i.appendChild(Q("span",{className:"separator",textContent:` ${this.customFooterOptions.metricSeparator||""} `})),i}registerOnSelectedRowsChangedWhenEnabled(e){if((this.gridOptions.enableCheckboxSelector||this.gridOptions.enableRowSelection)&&e&&!e.hideRowSelectionCount&&this._isLeftFooterOriginallyEmpty){this._isLeftFooterDisplayingSelectionRowCount=!0;const t=e.metricTexts?.itemsSelected??this.locales?.TEXT_ITEMS_SELECTED??"TEXT_ITEMS_SELECTED";e.leftFooterText=`0 ${t}`,this._eventHandler.subscribe(this.grid.onSelectedRowsChanged,((t,i)=>{this._selectedRowCount=i.rows.length;const n=e.metricTexts?.itemsSelected??this.locales?.TEXT_ITEMS_SELECTED??"TEXT_ITEMS_SELECTED";this.leftFooterText=`${this._selectedRowCount} ${n}`}))}}}class _l{constructor(){this._isPreviouslyShown=!1,this._warningLeftElement=null,this._warningRightElement=null}get gridOptions(){return this._grid?.getOptions()??{}}init(e,t){this._grid=e,this._translaterService=t.get("TranslaterService")}dispose(){this._warningLeftElement?.remove(),this._warningRightElement?.remove(),this._warningLeftElement=null,this._warningRightElement=null}showEmptyDataMessage(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0;if(!this._grid||!this.gridOptions||this._isPreviouslyShown===e)return!1;this._isPreviouslyShown=e;const i=this._grid.getUID(),n={message:"No data to display.",...this.gridOptions.emptyDataWarning,...t},s=n?.className??"slick-empty-data-warning";this._warningLeftElement=document.querySelector(`.${i} .${s}`);const r=document.querySelector(`.${i} .grid-canvas.grid-canvas-left`),o=document.querySelector(`.${i} .grid-canvas.grid-canvas-right`),a=n.leftViewportMarginLeft??0,l=n.rightViewportMarginLeft??0,d=n.frozenLeftViewportMarginLeft??0,c=n.frozenRightViewportMarginLeft??0,h=void 0!==this.gridOptions?.frozenColumn&&this.gridOptions.frozenColumn>=0,u="string"===typeof a?a:`${a}px`,p="string"===typeof l?l:`${l}px`;if(this.gridOptions.autoHeight){const t=document.querySelector(`.${i} .slick-pane.slick-pane-top.slick-pane-left`);if(t&&t.style&&r&&r.style){const i=parseInt(t.style.height,10)||0,n=this.gridOptions?.rowHeight??0,s=this.gridOptions.enableFiltering?this.gridOptions?.headerRowHeight??0:0,o=this.gridOptions.createPreHeaderPanel?this.gridOptions?.preHeaderPanelHeight??0:0;if(e){let e=null!==i&&i<100?i:100;e+=s+o,t.style.minHeight=`${e}px`,r.style.minHeight=`${n}px`}}}let m=n.message;if(this.gridOptions.enableTranslate&&this._translaterService&&n?.messageKey&&(m=this._translaterService.translate(n.messageKey)),!this._warningLeftElement&&r&&o&&(this._warningLeftElement=document.createElement("div"),this._warningLeftElement.classList.add(...Z(s)),this._warningLeftElement.classList.add("left"),this._grid.applyHtmlCode(this._warningLeftElement,m),this._warningRightElement=this._warningLeftElement.cloneNode(!0),this._warningRightElement.classList.add("right"),o.appendChild(this._warningRightElement),r.appendChild(this._warningLeftElement)),this._warningLeftElement){let t=e?"flex":"none";h&&e&&(t=n.hideFrozenLeftWarning?"none":"flex"),this._warningLeftElement.style.display=t;const i="string"===typeof d?d:`${d}px`;this._warningLeftElement.style.marginLeft=h?i:u}if(this._warningRightElement){let t=e?"flex":"none";h&&e&&(t=n.hideFrozenRightWarning?"none":"flex"),this._warningRightElement.style.display=t;const i="string"===typeof c?c:`${c}px`;this._warningRightElement.style.marginLeft=h?i:p}return e}}class Sl{constructor(){this._enableTranslate=!1,this._subscriptions=[],this.currentPagination={},this.firstButtonClasses="",this.lastButtonClasses="",this.prevButtonClasses="",this.nextButtonClasses="",this.textItemsPerPage="items per page",this.textItems="items",this.textOf="of",this.textPage="Page",this._bindingHelper=new bl,this._bindingEventService=new Vt}get availablePageSizes(){return this._paginationService.availablePageSizes||[]}get dataFrom(){return this._paginationService.dataFrom}get dataTo(){return this._paginationService.dataTo}get itemsPerPage(){return this._paginationService.itemsPerPage}set itemsPerPage(e){this._paginationService.changeItemPerPage(e)}get pageCount(){return this._paginationService.pageCount}get pageNumber(){return this._paginationService.pageNumber}get gridOptions(){return this._grid?.getOptions()??{}}get gridUid(){return this._grid?.getUID()||""}get locales(){return this.gridOptions?.locales??g.locales}get totalItems(){return this._paginationService.totalItems}get isLeftPaginationDisabled(){return 1===this.pageNumber||0===this.totalItems}get isRightPaginationDisabled(){return this.pageNumber===this.pageCount||0===this.totalItems}init(e,t,i,n){if(this._grid=e,this._pubSubService=i,this._translaterService=n,this._paginationService=t,this.currentPagination=t.getFullPagination(),this._bindingHelper.querySelectorPrefix=this.gridUid?`.${this.gridUid} `:"",this._enableTranslate=this.gridOptions?.enableTranslate??!1,this._enableTranslate&&(!this._translaterService||!this._translaterService.translate))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');if(this.translatePaginationTexts(),this._enableTranslate&&this._pubSubService?.subscribe){const e=this._translaterService?.eventName??"onLanguageChange";this._subscriptions.push(this._pubSubService.subscribe(e,(()=>this.translatePaginationTexts())))}this._subscriptions.push(this._pubSubService.subscribe("onPaginationRefreshed",(e=>{Object.keys(e).forEach((t=>this.currentPagination[t]=e[t])),this.updatePageButtonsUsability(),this._spanInfoFromToElm?.style&&(this._spanInfoFromToElm.style.display=0===this.currentPagination.totalItems?"none":"")})),this._pubSubService.subscribe("onPaginationSetCursorBased",(()=>{this.disposeDom(),this.renderPagination(this._gridContainerElm)})))}dispose(){this._pubSubService.unsubscribeAll(this._subscriptions),this.disposeDom()}disposeDom(){this._bindingEventService.unbindAll(),this._bindingHelper.dispose(),this._paginationElement.remove()}renderPagination(e){this._gridContainerElm=e;const t=this.createPaginationContainer(),i=Q("div",{className:"slick-pagination-nav"}),n=Q("nav",{ariaLabel:"Page navigation"}),s=Q("ul",{className:"pagination"});this._seekFirstElm=Q("li",{className:"page-item seek-first"},s),this._seekFirstElm.appendChild(Q("a",{className:"page-link icon-seek-first",ariaLabel:"First Page",role:"button"})),this._seekPrevElm=Q("li",{className:"page-item seek-prev"},s),this._seekPrevElm.appendChild(Q("a",{className:"page-link icon-seek-prev",ariaLabel:"Previous Page",role:"button"})),n.appendChild(s);const r=this.createPageNumberSection(),o=Q("nav",{ariaLabel:"Page navigation"}),a=Q("ul",{className:"pagination"});this._seekNextElm=Q("li",{className:"page-item seek-next"},a),this._seekNextElm.appendChild(Q("a",{className:"page-link icon-seek-next",ariaLabel:"Next Page",role:"button"})),this._seekEndElm=Q("li",{className:"page-item seek-end"},a),this._seekEndElm.appendChild(Q("a",{className:"page-link icon-seek-end",ariaLabel:"Last Page",role:"button"})),o.appendChild(a),t.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(o);const l=this.createPaginationSettingsSection();t.appendChild(i),t.appendChild(l),this._paginationElement.appendChild(t),e?.appendChild&&this._paginationElement&&e.appendChild(this._paginationElement),this.renderPageSizes(),this.addBindings(),this.addEventListeners(),this.updatePageButtonsUsability()}renderPageSizes(){if(this._itemPerPageElm&&Array.isArray(this.availablePageSizes))for(const e of this.availablePageSizes)this._itemPerPageElm.appendChild(Q("option",{value:`${e}`,text:`${e}`}))}addBindings(){this._bindingHelper.addElementBinding(this,"firstButtonClasses","li.page-item.seek-first","className"),this._bindingHelper.addElementBinding(this,"prevButtonClasses","li.page-item.seek-prev","className"),this._bindingHelper.addElementBinding(this,"lastButtonClasses","li.page-item.seek-end","className"),this._bindingHelper.addElementBinding(this,"nextButtonClasses","li.page-item.seek-next","className"),this._bindingHelper.addElementBinding(this.currentPagination,"dataFrom","span.item-from","textContent"),this._bindingHelper.addElementBinding(this.currentPagination,"dataTo","span.item-to","textContent"),this._bindingHelper.addElementBinding(this.currentPagination,"totalItems","span.total-items","textContent"),this._bindingHelper.addElementBinding(this.currentPagination,"pageCount","span.page-count","textContent"),this._bindingHelper.addElementBinding(this.currentPagination,"pageSize","select.items-per-page","value"),this._paginationService.isCursorBased?this._bindingHelper.addElementBinding(this.currentPagination,"pageNumber","span.page-number","textContent"):this._bindingHelper.addElementBinding(this.currentPagination,"pageNumber","input.page-number","value","change",this.changeToCurrentPage.bind(this)),this._bindingHelper.addElementBinding(this,"textItems","span.text-items","textContent"),this._bindingHelper.addElementBinding(this,"textItemsPerPage","span.text-item-per-page","textContent"),this._bindingHelper.addElementBinding(this,"textOf","span.text-of","textContent"),this._bindingHelper.addElementBinding(this,"textPage","span.text-page","textContent")}addEventListeners(){this._bindingEventService.bind(this._seekFirstElm,"click",this.changeToFirstPage.bind(this)),this._bindingEventService.bind(this._seekEndElm,"click",this.changeToLastPage.bind(this)),this._bindingEventService.bind(this._seekNextElm,"click",this.changeToNextPage.bind(this)),this._bindingEventService.bind(this._seekPrevElm,"click",this.changeToPreviousPage.bind(this)),this._bindingEventService.bind(this._itemPerPageElm,"change",this.updateItemsPerPage.bind(this))}changeToFirstPage(e){this.isLeftPaginationDisabled||this._paginationService.goToFirstPage(e)}changeToLastPage(e){this.isRightPaginationDisabled||this._paginationService.goToLastPage(e)}changeToNextPage(e){this.isRightPaginationDisabled||this._paginationService.goToNextPage(e)}changeToPreviousPage(e){this.isLeftPaginationDisabled||this._paginationService.goToPreviousPage(e)}changeToCurrentPage(e){this._paginationService.goToPageNumber(+e)}updateItemsPerPage(e){this.itemsPerPage=+(e?.target?.value??0)}translatePaginationTexts(){if(this._enableTranslate&&this._translaterService?.translate){const e=z(this.gridOptions);this.textItemsPerPage=this._translaterService.translate(`${e}ITEMS_PER_PAGE`),this.textItems=this._translaterService.translate(`${e}ITEMS`),this.textOf=this._translaterService.translate(`${e}OF`),this.textPage=this._translaterService.translate(`${e}PAGE`)}else this.locales&&(this.textItemsPerPage=this.locales.TEXT_ITEMS_PER_PAGE||"TEXT_ITEMS_PER_PAGE",this.textItems=this.locales.TEXT_ITEMS||"TEXT_ITEMS",this.textOf=this.locales.TEXT_OF||"TEXT_OF",this.textPage=this.locales.TEXT_PAGE||"TEXT_PAGE")}createPaginationContainer(){const e=Q("div",{id:"pager",className:`slick-pagination-container ${this.gridUid} pager`,style:{width:"100%"}}),t=Q("div",{className:"slick-pagination"});return e.appendChild(t),this._paginationElement=e,t}createPageNumberSection(){const e=Q("div",{className:"slick-page-number"});return Q("span",{className:"text-page",textContent:"Page"},e),e.appendChild(document.createTextNode(" ")),this._paginationService.isCursorBased?Q("span",{className:"page-number",ariaLabel:"Page Number",dataset:{test:"page-number-label"},textContent:"1"},e):Q("input",{type:"text",className:"form-control page-number",ariaLabel:"Page Number",value:"1",size:1,dataset:{test:"page-number-input"}},e),e.appendChild(document.createTextNode(" ")),Q("span",{className:"text-of",textContent:"of"},e),e.appendChild(document.createTextNode(" ")),Q("span",{className:"page-count",dataset:{test:"page-count"}},e),e}createPaginationSettingsSection(){const e=Q("span",{className:"slick-pagination-settings"});this._itemPerPageElm=Q("select",{id:"items-per-page-label",ariaLabel:"Items per Page",className:"items-per-page"},e),e.appendChild(document.createTextNode(" ")),Q("span",{className:"text-item-per-page",textContent:"items per page"},e),e.appendChild(document.createTextNode(", "));const t=Q("span",{className:"slick-pagination-count"},e);this._spanInfoFromToElm=Q("span",{className:"page-info-from-to"},t),Q("span",{className:"item-from",ariaLabel:"Page Item From",dataset:{test:"item-from"}},this._spanInfoFromToElm),this._spanInfoFromToElm.appendChild(document.createTextNode("-")),Q("span",{className:"item-to",ariaLabel:"Page Item To",dataset:{test:"item-to"}},this._spanInfoFromToElm),this._spanInfoFromToElm.appendChild(document.createTextNode(" ")),Q("span",{className:"text-of",textContent:"of"},this._spanInfoFromToElm),this._spanInfoFromToElm.appendChild(document.createTextNode(" "));const i=Q("span",{className:"page-info-total-items"},t);return Q("span",{className:"total-items",ariaLabel:"Total Items",dataset:{test:"total-items"}},i),i.appendChild(document.createTextNode(" ")),Q("span",{className:"text-items",textContent:"items"},i),i.appendChild(document.createTextNode(" ")),e}updatePageButtonsUsability(){this.firstButtonClasses=this.isLeftPaginationDisabled?"page-item seek-first disabled":"page-item seek-first",this.prevButtonClasses=this.isLeftPaginationDisabled?"page-item seek-prev disabled":"page-item seek-prev",this.lastButtonClasses=this.isRightPaginationDisabled?"page-item seek-end disabled":"page-item seek-end",this.nextButtonClasses=this.isRightPaginationDisabled?"page-item seek-next disabled":"page-item seek-next"}}const wl=e=>"string"===typeof e,Cl=()=>{let e,t;const i=new Promise(((i,n)=>{e=i,t=n}));return i.resolve=e,i.reject=t,i},El=e=>null==e?"":""+e,Ol=/###/g,xl=e=>e&&e.indexOf("###")>-1?e.replace(Ol,"."):e,Tl=e=>!e||wl(e),kl=(e,t,i)=>{const n=wl(t)?t.split("."):t;let s=0;for(;s{const{obj:n,k:s}=kl(e,t,Object);if(void 0!==n||1===t.length)return void(n[s]=i);let r=t[t.length-1],o=t.slice(0,t.length-1),a=kl(e,o,Object);for(;void 0===a.obj&&o.length;)r=`${o[o.length-1]}.${r}`,o=o.slice(0,o.length-1),a=kl(e,o,Object),a&&a.obj&&"undefined"!==typeof a.obj[`${a.k}.${r}`]&&(a.obj=void 0);a.obj[`${a.k}.${r}`]=i},Rl=(e,t)=>{const{obj:i,k:n}=kl(e,t);if(i)return i[n]},Al=(e,t,i)=>{for(const n in t)"__proto__"!==n&&"constructor"!==n&&(n in e?wl(e[n])||e[n]instanceof String||wl(t[n])||t[n]instanceof String?i&&(e[n]=t[n]):Al(e[n],t[n],i):e[n]=t[n]);return e},Dl=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var Pl={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const Fl=e=>wl(e)?e.replace(/[&<>"'\/]/g,(e=>Pl[e])):e;const Ml=[" ",",","?","!",";"],Ll=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const i=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,i),this.regExpQueue.push(e),i}}(20),Nl=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t])return e[t];const n=t.split(i);let s=e;for(let r=0;r-1&&oe&&e.replace("_","-"),Hl={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class zl{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||Hl,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),i=0;i{this.observers[e]||(this.observers[e]=new Map);const i=this.observers[e].get(t)||0;this.observers[e].set(t,i+1)})),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n{let[t,n]=e;for(let s=0;s{let[n,s]=t;for(let r=0;r1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=void 0!==n.keySeparator?n.keySeparator:this.options.keySeparator,r=void 0!==n.ignoreJSONStructure?n.ignoreJSONStructure:this.options.ignoreJSONStructure;let o;e.indexOf(".")>-1?o=e.split("."):(o=[e,t],i&&(Array.isArray(i)?o.push(...i):wl(i)&&s?o.push(...i.split(s)):o.push(i)));const a=Rl(this.data,o);return!a&&!t&&!i&&e.indexOf(".")>-1&&(e=o[0],t=o[1],i=o.slice(2).join(".")),!a&&r&&wl(i)?Nl(this.data&&this.data[e]&&this.data[e][t],i,s):a}addResource(e,t,i,n){let s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const r=void 0!==s.keySeparator?s.keySeparator:this.options.keySeparator;let o=[e,t];i&&(o=o.concat(r?i.split(r):i)),e.indexOf(".")>-1&&(o=e.split("."),n=t,t=o[1]),this.addNamespaces(t),Il(this.data,o,n),s.silent||this.emit("added",e,t,i,n)}addResources(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const s in i)(wl(i[s])||Array.isArray(i[s]))&&this.addResource(e,t,s,i[s],{silent:!0});n.silent||this.emit("added",e,t,i)}addResourceBundle(e,t,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},o=[e,t];e.indexOf(".")>-1&&(o=e.split("."),n=i,i=t,t=o[1]),this.addNamespaces(t);let a=Rl(this.data,o)||{};r.skipCopy||(i=JSON.parse(JSON.stringify(i))),n?Al(a,i,s):a={...a,...i},Il(this.data,o,a),r.silent||this.emit("added",e,t,i)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),"v1"===this.options.compatibilityAPI?{...this.getResource(e,t)}:this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find((e=>t[e]&&Object.keys(t[e]).length>0))}toJSON(){return this.data}}var Wl={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,i,n,s){return e.forEach((e=>{this.processors[e]&&(t=this.processors[e].process(t,i,n,s))})),t}};const jl={};class Gl extends Ul{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),((e,t,i)=>{e.forEach((e=>{t[e]&&(i[e]=t[e])}))})(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],e,this),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=$l.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(void 0===e||null===e)return!1;const i=this.resolve(e,t);return i&&void 0!==i.res}extractFromKey(e,t){let i=void 0!==t.nsSeparator?t.nsSeparator:this.options.nsSeparator;void 0===i&&(i=":");const n=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator;let s=t.ns||this.options.defaultNS||[];const r=i&&e.indexOf(i)>-1,o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!((e,t,i)=>{t=t||"",i=i||"";const n=Ml.filter((e=>t.indexOf(e)<0&&i.indexOf(e)<0));if(0===n.length)return!0;const s=Ll.getRegExp(`(${n.map((e=>"?"===e?"\\?":e)).join("|")})`);let r=!s.test(e);if(!r){const t=e.indexOf(i);t>0&&!s.test(e.substring(0,t))&&(r=!0)}return r})(e,i,n);if(r&&!o){const t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:wl(s)?[s]:s};const r=e.split(i);(i!==n||i===n&&this.options.ns.indexOf(r[0])>-1)&&(s=r.shift()),e=r.join(n)}return{key:e,namespaces:wl(s)?[s]:s}}translate(e,t,i){if("object"!==typeof t&&this.options.overloadTranslationOptionHandler&&(t=this.options.overloadTranslationOptionHandler(arguments)),"object"===typeof t&&(t={...t}),t||(t={}),void 0===e||null===e)return"";Array.isArray(e)||(e=[String(e)]);const n=void 0!==t.returnDetails?t.returnDetails:this.options.returnDetails,s=void 0!==t.keySeparator?t.keySeparator:this.options.keySeparator,{key:r,namespaces:o}=this.extractFromKey(e[e.length-1],t),a=o[o.length-1],l=t.lng||this.language,d=t.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(l&&"cimode"===l.toLowerCase()){if(d){const e=t.nsSeparator||this.options.nsSeparator;return n?{res:`${a}${e}${r}`,usedKey:r,exactUsedKey:r,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:`${a}${e}${r}`}return n?{res:r,usedKey:r,exactUsedKey:r,usedLng:l,usedNS:a,usedParams:this.getUsedParamsDetails(t)}:r}const c=this.resolve(e,t);let h=c&&c.res;const u=c&&c.usedKey||r,p=c&&c.exactUsedKey||r,m=Object.prototype.toString.apply(h),g=void 0!==t.joinArrays?t.joinArrays:this.options.joinArrays,f=!this.i18nFormat||this.i18nFormat.handleAsObject,v=!wl(h)&&"boolean"!==typeof h&&"number"!==typeof h;if(!(f&&h&&v&&["[object Number]","[object Function]","[object RegExp]"].indexOf(m)<0)||wl(g)&&Array.isArray(h))if(f&&wl(g)&&Array.isArray(h))h=h.join(g),h&&(h=this.extendTranslation(h,e,t,i));else{let n=!1,o=!1;const d=void 0!==t.count&&!wl(t.count),u=Gl.hasDefaultValue(t),p=d?this.pluralResolver.getSuffix(l,t.count,t):"",m=t.ordinal&&d?this.pluralResolver.getSuffix(l,t.count,{ordinal:!1}):"",g=d&&!t.ordinal&&0===t.count&&this.pluralResolver.shouldUseIntlApi(),f=g&&t[`defaultValue${this.options.pluralSeparator}zero`]||t[`defaultValue${p}`]||t[`defaultValue${m}`]||t.defaultValue;!this.isValidLookup(h)&&u&&(n=!0,h=f),this.isValidLookup(h)||(o=!0,h=r);const v=(t.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&o?void 0:h,b=u&&f!==h&&this.options.updateMissing;if(o||n||b){if(this.logger.log(b?"updateKey":"missingKey",l,a,r,b?f:h),s){const e=this.resolve(r,{...t,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const i=this.languageUtils.getFallbackCodes(this.options.fallbackLng,t.lng||this.language);if("fallback"===this.options.saveMissingTo&&i&&i[0])for(let t=0;t{const s=u&&n!==h?n:v;this.options.missingKeyHandler?this.options.missingKeyHandler(e,a,i,s,b,t):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(e,a,i,s,b,t),this.emit("missingKey",e,a,i,h)};this.options.saveMissing&&(this.options.saveMissingPlurals&&d?e.forEach((e=>{const i=this.pluralResolver.getSuffixes(e,t);g&&t[`defaultValue${this.options.pluralSeparator}zero`]&&i.indexOf(`${this.options.pluralSeparator}zero`)<0&&i.push(`${this.options.pluralSeparator}zero`),i.forEach((i=>{n([e],r+i,t[`defaultValue${i}`]||f)}))})):n(e,r,f))}h=this.extendTranslation(h,e,t,c,i),o&&h===r&&this.options.appendNamespaceToMissingKey&&(h=`${a}:${r}`),(o||n)&&this.options.parseMissingKeyHandler&&(h="v1"!==this.options.compatibilityAPI?this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${a}:${r}`:r,n?h:void 0):this.options.parseMissingKeyHandler(h))}else{if(!t.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(u,h,{...t,ns:o}):`key '${r} (${this.language})' returned an object instead of string.`;return n?(c.res=e,c.usedParams=this.getUsedParamsDetails(t),c):e}if(s){const e=Array.isArray(h),i=e?[]:{},n=e?p:u;for(const r in h)if(Object.prototype.hasOwnProperty.call(h,r)){const e=`${n}${s}${r}`;i[r]=this.translate(e,{...t,joinArrays:!1,ns:o}),i[r]===e&&(i[r]=h[r])}h=i}}return n?(c.res=h,c.usedParams=this.getUsedParamsDetails(t),c):h}extendTranslation(e,t,i,n,s){var r=this;if(this.i18nFormat&&this.i18nFormat.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||n.usedLng,n.usedNS,n.usedKey,{resolved:n});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const o=wl(e)&&(i&&i.interpolation&&void 0!==i.interpolation.skipOnVariables?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let a;if(o){const t=e.match(this.interpolator.nestingRegexp);a=t&&t.length}let l=i.replace&&!wl(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(l={...this.options.interpolation.defaultVariables,...l}),e=this.interpolator.interpolate(e,l,i.lng||this.language||n.usedLng,i),o){const t=e.match(this.interpolator.nestingRegexp);a<(t&&t.length)&&(i.nest=!1)}!i.lng&&"v1"!==this.options.compatibilityAPI&&n&&n.res&&(i.lng=this.language||n.usedLng),!1!==i.nest&&(e=this.interpolator.nest(e,(function(){for(var e=arguments.length,n=new Array(e),o=0;o1&&void 0!==arguments[1]?arguments[1]:{};return wl(e)&&(e=[e]),e.forEach((e=>{if(this.isValidLookup(t))return;const a=this.extractFromKey(e,o),l=a.key;i=l;let d=a.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const c=void 0!==o.count&&!wl(o.count),h=c&&!o.ordinal&&0===o.count&&this.pluralResolver.shouldUseIntlApi(),u=void 0!==o.context&&(wl(o.context)||"number"===typeof o.context)&&""!==o.context,p=o.lngs?o.lngs:this.languageUtils.toResolveHierarchy(o.lng||this.language,o.fallbackLng);d.forEach((e=>{this.isValidLookup(t)||(r=e,!jl[`${p[0]}-${e}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(r)&&(jl[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${i}" for languages "${p.join(", ")}" won't get resolved as namespace "${r}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),p.forEach((i=>{if(this.isValidLookup(t))return;s=i;const r=[l];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(r,l,i,e,o);else{let e;c&&(e=this.pluralResolver.getSuffix(i,o.count,o));const t=`${this.options.pluralSeparator}zero`,n=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(c&&(r.push(l+e),o.ordinal&&0===e.indexOf(n)&&r.push(l+e.replace(n,this.options.pluralSeparator)),h&&r.push(l+t)),u){const i=`${l}${this.options.contextSeparator}${o.context}`;r.push(i),c&&(r.push(i+e),o.ordinal&&0===e.indexOf(n)&&r.push(i+e.replace(n,this.options.pluralSeparator)),h&&r.push(i+t))}}let a;for(;a=r.pop();)this.isValidLookup(t)||(n=a,t=this.getResource(i,e,a,o))})))}))})),{res:t,usedKey:i,exactUsedKey:n,usedLng:s,usedNS:r}}isValidLookup(e){return void 0!==e&&!(!this.options.returnNull&&null===e)&&!(!this.options.returnEmptyString&&""===e)}getResource(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(e,t,i,n):this.resourceStore.getResource(e,t,i,n)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!wl(e.replace);let n=i?e.replace:e;if(i&&"undefined"!==typeof e.count&&(n.count=e.count),this.options.interpolation.defaultVariables&&(n={...this.options.interpolation.defaultVariables,...n}),!i){n={...n};for(const e of t)delete n[e]}return n}static hasDefaultValue(e){const t="defaultValue";for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t===i.substring(0,12)&&void 0!==e[i])return!0;return!1}}const Yl=e=>e.charAt(0).toUpperCase()+e.slice(1);class Kl{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=$l.create("languageUtils")}getScriptPartFromCode(e){if(!(e=Bl(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=Bl(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(wl(e)&&e.indexOf("-")>-1){if("undefined"!==typeof Intl&&"undefined"!==typeof Intl.getCanonicalLocales)try{let t=Intl.getCanonicalLocales(e)[0];if(t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t)return t}catch(t){}const i=["hans","hant","latn","cyrl","cans","mong","arab"];let n=e.split("-");return this.options.lowerCaseLng?n=n.map((e=>e.toLowerCase())):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),i.indexOf(n[1].toLowerCase())>-1&&(n[1]=Yl(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),i.indexOf(n[1].toLowerCase())>-1&&(n[1]=Yl(n[1].toLowerCase())),i.indexOf(n[2].toLowerCase())>-1&&(n[2]=Yl(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach((e=>{if(t)return;const i=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(i)||(t=i)})),!t&&this.options.supportedLngs&&e.forEach((e=>{if(t)return;const i=this.getLanguagePartFromCode(e);if(this.isSupportedCode(i))return t=i;t=this.options.supportedLngs.find((e=>e===i?e:e.indexOf("-")<0&&i.indexOf("-")<0?void 0:e.indexOf("-")>0&&i.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===i||0===e.indexOf(i)&&i.length>1?e:void 0))})),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,t){if(!e)return[];if("function"===typeof e&&(e=e(t)),wl(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let i=e[t];return i||(i=e[this.getScriptPartFromCode(t)]),i||(i=e[this.formatLanguageCode(t)]),i||(i=e[this.getLanguagePartFromCode(t)]),i||(i=e.default),i||[]}toResolveHierarchy(e,t){const i=this.getFallbackCodes(t||this.options.fallbackLng||[],e),n=[],s=e=>{e&&(this.isSupportedCode(e)?n.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return wl(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&s(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&s(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&s(this.getLanguagePartFromCode(e))):wl(e)&&s(this.formatLanguageCode(e)),i.forEach((e=>{n.indexOf(e)<0&&s(this.formatLanguageCode(e))})),n}}let ql=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Xl={1:e=>Number(e>1),2:e=>Number(1!=e),3:e=>0,4:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),5:e=>Number(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5),6:e=>Number(1==e?0:e>=2&&e<=4?1:2),7:e=>Number(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2),8:e=>Number(1==e?0:2==e?1:8!=e&&11!=e?2:3),9:e=>Number(e>=2),10:e=>Number(1==e?0:2==e?1:e<7?2:e<11?3:4),11:e=>Number(1==e||11==e?0:2==e||12==e?1:e>2&&e<20?2:3),12:e=>Number(e%10!=1||e%100==11),13:e=>Number(0!==e),14:e=>Number(1==e?0:2==e?1:3==e?2:3),15:e=>Number(e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2),16:e=>Number(e%10==1&&e%100!=11?0:0!==e?1:2),17:e=>Number(1==e||e%10==1&&e%100!=11?0:1),18:e=>Number(0==e?0:1==e?1:2),19:e=>Number(1==e?0:0==e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3),20:e=>Number(1==e?0:0==e||e%100>0&&e%100<20?1:2),21:e=>Number(e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0),22:e=>Number(1==e?0:2==e?1:(e<0||e>10)&&e%10==0?2:3)};const Ql=["v1","v2","v3"],Zl=["v4"],Jl={zero:0,one:1,two:2,few:3,many:4,other:5};class ed{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=$l.create("pluralResolver"),this.options.compatibilityJSON&&!Zl.includes(this.options.compatibilityJSON)||"undefined"!==typeof Intl&&Intl.PluralRules||(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=(()=>{const e={};return ql.forEach((t=>{t.lngs.forEach((i=>{e[i]={numbers:t.nr,plurals:Xl[t.fc]}}))})),e})(),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.shouldUseIntlApi()){const i=Bl("dev"===e?"en":e),n=t.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:i,type:n});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let r;try{r=new Intl.PluralRules(i,{type:n})}catch($d){if(!e.match(/-|_/))return;const n=this.languageUtils.getLanguagePartFromCode(e);r=this.getRule(n,t)}return this.pluralRulesCache[s]=r,r}return this.rules[e]||this.rules[this.languageUtils.getLanguagePartFromCode(e)]}needsPlural(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=this.getRule(e,t);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}getPluralFormsOfKey(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,i).map((e=>`${t}${e}`))}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=this.getRule(e,t);return i?this.shouldUseIntlApi()?i.resolvedOptions().pluralCategories.sort(((e,t)=>Jl[e]-Jl[t])).map((e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`)):i.numbers.map((i=>this.getSuffix(e,i,t))):[]}getSuffix(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=this.getRule(e,i);return n?this.shouldUseIntlApi()?`${this.options.prepend}${i.ordinal?`ordinal${this.options.prepend}`:""}${n.select(t)}`:this.getSuffixRetroCompatible(n,t):(this.logger.warn(`no plural rule found for: ${e}`),"")}getSuffixRetroCompatible(e,t){const i=e.noAbs?e.plurals(t):e.plurals(Math.abs(t));let n=e.numbers[i];this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]&&(2===n?n="plural":1===n&&(n=""));const s=()=>this.options.prepend&&n.toString()?this.options.prepend+n.toString():n.toString();return"v1"===this.options.compatibilityJSON?1===n?"":"number"===typeof n?`_plural_${n.toString()}`:s():"v2"===this.options.compatibilityJSON||this.options.simplifyPluralSuffix&&2===e.numbers.length&&1===e.numbers[0]?s():this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString()}shouldUseIntlApi(){return!Ql.includes(this.options.compatibilityJSON)}}const td=function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=((e,t,i)=>{const n=Rl(e,i);return void 0!==n?n:Rl(t,i)})(e,t,i);return!r&&s&&wl(i)&&(r=Nl(e,i,n),void 0===r&&(r=Nl(t,i,n))),r},id=e=>e.replace(/\$/g,"$$$$");class nd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=$l.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:i,useRawValueToEscape:n,prefix:s,prefixEscaped:r,suffix:o,suffixEscaped:a,formatSeparator:l,unescapeSuffix:d,unescapePrefix:c,nestingPrefix:h,nestingPrefixEscaped:u,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:g,maxReplaces:f,alwaysFormat:v}=e.interpolation;this.escape=void 0!==t?t:Fl,this.escapeValue=void 0===i||i,this.useRawValueToEscape=void 0!==n&&n,this.prefix=s?Dl(s):r||"{{",this.suffix=o?Dl(o):a||"}}",this.formatSeparator=l||",",this.unescapePrefix=d?"":c||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=h?Dl(h):u||Dl("$t("),this.nestingSuffix=p?Dl(p):m||Dl(")"),this.nestingOptionsSeparator=g||",",this.maxReplaces=f||1e3,this.alwaysFormat=void 0!==v&&v,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e&&e.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,t,i,n){let s,r,o;const a=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},l=e=>{if(e.indexOf(this.formatSeparator)<0){const s=td(t,a,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(s,void 0,i,{...n,...t,interpolationkey:e}):s}const s=e.split(this.formatSeparator),r=s.shift().trim(),o=s.join(this.formatSeparator).trim();return this.format(td(t,a,r,this.options.keySeparator,this.options.ignoreJSONStructure),o,i,{...n,...t,interpolationkey:r})};this.resetRegExp();const d=n&&n.missingInterpolationHandler||this.options.missingInterpolationHandler,c=n&&n.interpolation&&void 0!==n.interpolation.skipOnVariables?n.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>id(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?id(this.escape(e)):id(e)}].forEach((t=>{for(o=0;s=t.regex.exec(e);){const i=s[1].trim();if(r=l(i),void 0===r)if("function"===typeof d){const t=d(e,s,n);r=wl(t)?t:""}else if(n&&Object.prototype.hasOwnProperty.call(n,i))r="";else{if(c){r=s[0];continue}this.logger.warn(`missed to pass in variable ${i} for interpolating ${e}`),r=""}else wl(r)||this.useRawValueToEscape||(r=El(r));const a=t.safeValue(r);if(e=e.replace(s[0],a),c?(t.regex.lastIndex+=r.length,t.regex.lastIndex-=s[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}})),e}nest(e,t){let i,n,s,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=(e,t)=>{const i=this.nestingOptionsSeparator;if(e.indexOf(i)<0)return e;const n=e.split(new RegExp(`${i}[ ]*{`));let r=`{${n[1]}`;e=n[0],r=this.interpolate(r,s);const o=r.match(/'/g),a=r.match(/"/g);(o&&o.length%2===0&&!a||a.length%2!==0)&&(r=r.replace(/'/g,'"'));try{s=JSON.parse(r),t&&(s={...t,...s})}catch(l){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,l),`${e}${i}${r}`}return s.defaultValue&&s.defaultValue.indexOf(this.prefix)>-1&&delete s.defaultValue,e};for(;i=this.nestingRegexp.exec(e);){let a=[];s={...r},s=s.replace&&!wl(s.replace)?s.replace:s,s.applyPostProcessor=!1,delete s.defaultValue;let l=!1;if(-1!==i[0].indexOf(this.formatSeparator)&&!/{.*}/.test(i[1])){const e=i[1].split(this.formatSeparator).map((e=>e.trim()));i[1]=e.shift(),a=e,l=!0}if(n=t(o.call(this,i[1].trim(),s),s),n&&i[0]===e&&!wl(n))return n;wl(n)||(n=El(n)),n||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),n=""),l&&(n=a.reduce(((e,t)=>this.format(e,t,r.lng,{...r,interpolationkey:i[1].trim()})),n.trim())),e=e.replace(i[0],n),this.regexp.lastIndex=0}return e}}const sd=e=>{const t={};return(i,n,s)=>{let r=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(r={...r,[s.interpolationkey]:void 0});const o=n+JSON.stringify(r);let a=t[o];return a||(a=e(Bl(n),s),t[o]=a),a(i)}};class rd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=$l.create("formatter"),this.options=e,this.formats={number:sd(((e,t)=>{const i=new Intl.NumberFormat(e,{...t});return e=>i.format(e)})),currency:sd(((e,t)=>{const i=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>i.format(e)})),datetime:sd(((e,t)=>{const i=new Intl.DateTimeFormat(e,{...t});return e=>i.format(e)})),relativetime:sd(((e,t)=>{const i=new Intl.RelativeTimeFormat(e,{...t});return e=>i.format(e,t.range||"day")})),list:sd(((e,t)=>{const i=new Intl.ListFormat(e,{...t});return e=>i.format(e)}))},this.init(e)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=sd(t)}format(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const s=t.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find((e=>e.indexOf(")")>-1))){const e=s.findIndex((e=>e.indexOf(")")>-1));s[0]=[s[0],...s.splice(1,e)].join(this.formatSeparator)}const r=s.reduce(((e,t)=>{const{formatName:s,formatOptions:r}=(e=>{let t=e.toLowerCase().trim();const i={};if(e.indexOf("(")>-1){const n=e.split("(");t=n[0].toLowerCase().trim();const s=n[1].substring(0,n[1].length-1);"currency"===t&&s.indexOf(":")<0?i.currency||(i.currency=s.trim()):"relativetime"===t&&s.indexOf(":")<0?i.range||(i.range=s.trim()):s.split(";").forEach((e=>{if(e){const[t,...n]=e.split(":"),s=n.join(":").trim().replace(/^'+|'+$/g,""),r=t.trim();i[r]||(i[r]=s),"false"===s&&(i[r]=!1),"true"===s&&(i[r]=!0),isNaN(s)||(i[r]=parseInt(s,10))}}))}return{formatName:t,formatOptions:i}})(t);if(this.formats[s]){let t=e;try{const o=n&&n.formatParams&&n.formatParams[n.interpolationkey]||{},a=o.locale||o.lng||n.locale||n.lng||i;t=this.formats[s](e,a,{...r,...n,...o})}catch(o){this.logger.warn(o)}return t}return this.logger.warn(`there was no format function for ${s}`),e}),e);return r}}class od extends Ul{constructor(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=i,this.languageUtils=i.languageUtils,this.options=n,this.logger=$l.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=n.maxParallelReads||10,this.readingCalls=0,this.maxRetries=n.maxRetries>=0?n.maxRetries:5,this.retryTimeout=n.retryTimeout>=1?n.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(i,n.backend,n)}queueLoad(e,t,i,n){const s={},r={},o={},a={};return e.forEach((e=>{let n=!0;t.forEach((t=>{const o=`${e}|${t}`;!i.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(1===this.state[o]?void 0===r[o]&&(r[o]=!0):(this.state[o]=1,n=!1,void 0===r[o]&&(r[o]=!0),void 0===s[o]&&(s[o]=!0),void 0===a[t]&&(a[t]=!0)))})),n||(o[e]=!0)})),(Object.keys(s).length||Object.keys(r).length)&&this.queue.push({pending:r,pendingCount:Object.keys(r).length,loaded:{},errors:[],callback:n}),{toLoad:Object.keys(s),pending:Object.keys(r),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(a)}}loaded(e,t,i){const n=e.split("|"),s=n[0],r=n[1];t&&this.emit("failedLoading",s,r,t),!t&&i&&this.store.addResourceBundle(s,r,i,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&i&&(this.state[e]=0);const o={};this.queue.forEach((i=>{((e,t,i)=>{const{obj:n,k:s}=kl(e,t,Object);n[s]=n[s]||[],n[s].push(i)})(i.loaded,[s],r),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(i,e),t&&i.errors.push(t),0!==i.pendingCount||i.done||(Object.keys(i.loaded).forEach((e=>{o[e]||(o[e]={});const t=i.loaded[e];t.length&&t.forEach((t=>{void 0===o[e][t]&&(o[e][t]=!0)}))})),i.done=!0,i.errors.length?i.callback(i.errors):i.callback())})),this.emit("loaded",o),this.queue=this.queue.filter((e=>!e.done))}read(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,r=arguments.length>5?arguments[5]:void 0;if(!e.length)return r(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:i,tried:n,wait:s,callback:r});this.readingCalls++;const o=(o,a)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}o&&a&&n{this.read.call(this,e,t,i,n+1,2*s,r)}),s):r(o,a)},a=this.backend[i].bind(this.backend);if(2!==a.length)return a(e,t,o);try{const i=a(e,t);i&&"function"===typeof i.then?i.then((e=>o(null,e))).catch(o):o(null,i)}catch($d){o($d)}}prepareLoading(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),n&&n();wl(e)&&(e=this.languageUtils.toResolveHierarchy(e)),wl(t)&&(t=[t]);const s=this.queueLoad(e,t,i,n);if(!s.toLoad.length)return s.pending.length||n(),null;s.toLoad.forEach((e=>{this.loadOne(e)}))}load(e,t,i){this.prepareLoading(e,t,{},i)}reload(e,t,i){this.prepareLoading(e,t,{reload:!0},i)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const i=e.split("|"),n=i[0],s=i[1];this.read(n,s,"read",void 0,void 0,((i,r)=>{i&&this.logger.warn(`${t}loading namespace ${s} for language ${n} failed`,i),!i&&r&&this.logger.log(`${t}loaded namespace ${s} for language ${n}`,r),this.loaded(e,i,r)}))}saveMissing(e,t,i,n,s){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(t))this.logger.warn(`did not save key "${i}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");else if(void 0!==i&&null!==i&&""!==i){if(this.backend&&this.backend.create){const a={...r,isUpdate:s},l=this.backend.create.bind(this.backend);if(l.length<6)try{let s;s=5===l.length?l(e,t,i,n,a):l(e,t,i,n),s&&"function"===typeof s.then?s.then((e=>o(null,e))).catch(o):o(null,s)}catch($d){o($d)}else l(e,t,i,n,o,a)}e&&e[0]&&this.store.addResource(e[0],t,i,n)}}}const ad=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if("object"===typeof e[1]&&(t=e[1]),wl(e[1])&&(t.defaultValue=e[1]),wl(e[2])&&(t.tDescription=e[2]),"object"===typeof e[2]||"object"===typeof e[3]){const i=e[3]||e[2];Object.keys(i).forEach((e=>{t[e]=i[e]}))}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),ld=e=>(wl(e.ns)&&(e.ns=[e.ns]),wl(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),wl(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),dd=()=>{};class cd extends Ul{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var i;if(super(),this.options=ld(e),this.services={},this.logger=$l,this.modules={external:[]},i=this,Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((e=>{"function"===typeof i[e]&&(i[e]=i[e].bind(i))})),t&&!this.isInitialized&&!e.isClone){if(!this.options.initImmediate)return this.init(e,t),this;setTimeout((()=>{this.init(e,t)}),0)}}init(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"===typeof t&&(i=t,t={}),!t.defaultNS&&!1!==t.defaultNS&&t.ns&&(wl(t.ns)?t.defaultNS=t.ns:t.ns.indexOf("translation")<0&&(t.defaultNS=t.ns[0]));const n=ad();this.options={...n,...this.options,...ld(t)},"v1"!==this.options.compatibilityAPI&&(this.options.interpolation={...n.interpolation,...this.options.interpolation}),void 0!==t.keySeparator&&(this.options.userDefinedKeySeparator=t.keySeparator),void 0!==t.nsSeparator&&(this.options.userDefinedNsSeparator=t.nsSeparator);const s=e=>e?"function"===typeof e?new e:e:null;if(!this.options.isClone){let t;this.modules.logger?$l.init(s(this.modules.logger),this.options):$l.init(null,this.options),this.modules.formatter?t=this.modules.formatter:"undefined"!==typeof Intl&&(t=rd);const i=new Kl(this.options);this.store=new Vl(this.options.resources,this.options);const r=this.services;r.logger=$l,r.resourceStore=this.store,r.languageUtils=i,r.pluralResolver=new ed(i,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==n.interpolation.format||(r.formatter=s(t),r.formatter.init(r,this.options),this.options.interpolation.format=r.formatter.format.bind(r.formatter)),r.interpolator=new nd(this.options),r.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},r.backendConnector=new od(s(this.modules.backend),r.resourceStore,r,this.options),r.backendConnector.on("*",(function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),s=1;s1?i-1:0),s=1;s{e.init&&e.init(this)}))}if(this.format=this.options.interpolation.format,i||(i=dd),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach((t=>{this[t]=function(){return e.store[t](...arguments)}}));["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach((t=>{this[t]=function(){return e.store[t](...arguments),e}}));const r=Cl(),o=()=>{const e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),r.resolve(t),i(e,t)};if(this.languages&&"v1"!==this.options.compatibilityAPI&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initImmediate?o():setTimeout(o,0),r}loadResources(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dd;const i=wl(e)?e:this.language;if("function"===typeof e&&(t=e),!this.options.resources||this.options.partialBundledLanguages){if(i&&"cimode"===i.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return t();const e=[],n=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach((t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)}))};if(i)n(i);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e=>n(e)))}this.options.preload&&this.options.preload.forEach((e=>n(e))),this.services.backendConnector.load(e,this.options.ns,(e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),t(e)}))}else t(null)}reloadResources(e,t,i){const n=Cl();return"function"===typeof e&&(i=e,e=void 0),"function"===typeof t&&(i=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),i||(i=dd),this.services.backendConnector.reload(e,t,(e=>{n.resolve(),i(e)})),n}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&Wl.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let t=0;t-1)&&this.store.hasLanguageSomeTranslations(e)){this.resolvedLanguage=e;break}}}changeLanguage(e,t){var i=this;this.isLanguageChangingTo=e;const n=Cl();this.emit("languageChanging",e);const s=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},r=(e,r)=>{r?(s(r),this.translator.changeLanguage(r),this.isLanguageChangingTo=void 0,this.emit("languageChanged",r),this.logger.log("languageChanged",r)):this.isLanguageChangingTo=void 0,n.resolve((function(){return i.t(...arguments)})),t&&t(e,(function(){return i.t(...arguments)}))},o=t=>{e||t||!this.services.languageDetector||(t=[]);const i=wl(t)?t:this.services.languageUtils.getBestMatchFromCodes(t);i&&(this.language||s(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(i)),this.loadResources(i,(e=>{r(e,i)}))};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(o):this.services.languageDetector.detect(o):o(e):o(this.services.languageDetector.detect()),n}getFixedT(e,t,i){var n=this;const s=function(e,t){let r;if("object"!==typeof t){for(var o=arguments.length,a=new Array(o>2?o-2:0),l=2;l`${r.keyPrefix}${d}${e}`)):r.keyPrefix?`${r.keyPrefix}${d}${e}`:e,n.t(c,r)};return wl(e)?s.lng=e:s.lngs=e,s.ns=t,s.keyPrefix=i,s}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const i=t.lng||this.resolvedLanguage||this.languages[0],n=!!this.options&&this.options.fallbackLng,s=this.languages[this.languages.length-1];if("cimode"===i.toLowerCase())return!0;const r=(e,t)=>{const i=this.services.backendConnector.state[`${e}|${t}`];return-1===i||0===i||2===i};if(t.precheck){const e=t.precheck(this,r);if(void 0!==e)return e}return!!this.hasResourceBundle(i,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!r(i,e)||n&&!r(s,e)))}loadNamespaces(e,t){const i=Cl();return this.options.ns?(wl(e)&&(e=[e]),e.forEach((e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)})),this.loadResources((e=>{i.resolve(),t&&t(e)})),i):(t&&t(),Promise.resolve())}loadLanguages(e,t){const i=Cl();wl(e)&&(e=[e]);const n=this.options.preload||[],s=e.filter((e=>n.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e)));return s.length?(this.options.preload=n.concat(s),this.loadResources((e=>{i.resolve(),t&&t(e)})),i):(t&&t(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services&&this.services.languageUtils||new Kl(ad());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new cd(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dd;const i=e.forkResourceStore;i&&delete e.forkResourceStore;const n={...this.options,...e,isClone:!0},s=new cd(n);void 0===e.debug&&void 0===e.prefix||(s.logger=s.logger.clone(e));return["store","services","language"].forEach((e=>{s[e]=this[e]})),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},i&&(s.store=new Vl(this.store.data,n),s.services.resourceStore=s.store),s.translator=new Gl(s.services,n),s.translator.on("*",(function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n{const r=(0,d.createRef)();null!==n&&void 0!==n||(n=(0,c.createRoot)(t)),n.render(d.createElement(e,{...i,ref:r})),queueMicrotask((()=>{s({component:r.current,root:n})}))}))}class fd extends d.Component{setStateValue(e,t,i){var n;if((null===(n=this.state)||void 0===n?void 0:n[e])!==t)return this._mounted?void this.setState((()=>{const i={};return i[e]=t,i}),i):(this.state=this.state||{},void(this.state[e]=t))}get gridOptions(){return this._gridOptions||{}}set gridOptions(e){var t,i,n;let s;s=(null===(t=this.grid)||void 0===t?void 0:t.getOptions)?Se(!0,{},this.grid.getOptions(),e):this.mergeGridOptions(e),(null===(i=this.sharedService)||void 0===i?void 0:i.gridOptions)&&(null===(n=this.grid)||void 0===n?void 0:n.setOptions)&&(this.sharedService.gridOptions=s,this.grid.setOptions(s,!1,!0),this.grid.reRenderColumns(!0)),this._gridOptions=s}get dataset(){var e;return(null===(e=this.dataView)||void 0===e?void 0:e.getItems())||[]}set dataset(e){var t,i;const n=this._currentDatasetLength,s=jt(e,this.dataset||[]);let r=!!(null===(t=this._gridOptions)||void 0===t?void 0:t.enableDeepCopyDatasetOnPageLoad)?Se(!0,[],e):e;this.grid&&(null===(i=this.gridOptions)||void 0===i?void 0:i.enableTreeData)&&Array.isArray(e)&&(e.length>0||e.length!==n||!s)&&(this._isDatasetHierarchicalInitialized=!1,r=this.sortTreeDataset(e,!s)),this.refreshGridData(r||[]),this._currentDatasetLength=(e||[]).length,this.grid&&this.gridOptions.autoFitColumnsOnFirstLoad&&0===n&&!this._isAutosizeColsCalled&&(this.grid.autosizeColumns(),this._isAutosizeColsCalled=!0)}get datasetHierarchical(){return this.sharedService.hierarchicalDataset}set datasetHierarchical(e){var t,i,n,s,r,o;const a=jt(e,null!==(i=null===(t=this.sharedService)||void 0===t?void 0:t.hierarchicalDataset)&&void 0!==i?i:[]),l=this._currentDatasetLength;this.sharedService&&(this.sharedService.hierarchicalDataset=e),e&&this.props.columnDefinitions&&(null===(n=this.filterService)||void 0===n?void 0:n.clearFilters)&&this.filterService.clearFilters(),this.dataView&&e&&this.grid&&(null===(s=this.sortService)||void 0===s?void 0:s.processTreeDataInitialSort)&&(this.dataView.setItems([],null!==(o=null===(r=this._gridOptions)||void 0===r?void 0:r.datasetIdPropertyName)&&void 0!==o?o:"id"),this.sortService.processTreeDataInitialSort(),queueMicrotask((()=>{var e,t;const i=null!==(t=null===(e=this.dataView)||void 0===e?void 0:e.getItemCount())&&void 0!==t?t:0;i>0&&(i!==l||!a)&&this.filterService.refreshTreeDataFilters()}))),this._isDatasetHierarchicalInitialized=!0}get paginationService(){var e;return null===(e=this.state)||void 0===e?void 0:e.paginationService}set paginationService(e){this.setStateValue("paginationService",e)}constructor(e){var t;super(e),this.props=e,this._mounted=!1,this._columnDefinitions=[],this._currentDatasetLength=0,this._dataset=null,this._collectionObservers=[],this._hideHeaderRowAfterPageLoad=!1,this._isAutosizeColsCalled=!1,this._isGridInitialized=!1,this._isDatasetInitialized=!1,this._isDatasetHierarchicalInitialized=!1,this._isPaginationInitialized=!1,this._isLocalGrid=!0,this._registeredResources=[],this._scrollEndCalled=!1,this._gridOptions={},this.showPagination=!1,this.serviceList=[],this.subscriptions=[],this.totalItems=0,this.instances=null;const i=new fl;this._eventHandler=new ii,this.showPagination=!1,this._hideHeaderRowAfterPageLoad=!1===(null===(t=e.gridOptions)||void 0===t?void 0:t.showHeaderRow),this._gridOptions=this.mergeGridOptions(e.gridOptions||{}),this._eventPubSubService=new $t,this._eventPubSubService.eventNamingStyle=zt.camelCase,this.backendUtilityService=new h,this.gridEventService=new oa,this.sharedService=new ha,this.collectionService=new Yr(this.props.translaterService),this.extensionUtility=new qr(this.sharedService,this.backendUtilityService,this.props.translaterService),this.filterFactory=new Ka(i,this.props.translaterService,this.collectionService),this.filterService=new Jo(this.filterFactory,this._eventPubSubService,this.sharedService,this.backendUtilityService),this.resizerService=new ca(this._eventPubSubService),this.sortService=new ua(this.collectionService,this.sharedService,this._eventPubSubService,this.backendUtilityService),this.treeDataService=new pa(this._eventPubSubService,this.sharedService,this.sortService),this.paginationService=new da(this._eventPubSubService,this.sharedService,this.backendUtilityService),this.extensionService=new Uo(this.extensionUtility,this.filterService,this._eventPubSubService,this.sharedService,this.sortService,this.treeDataService,this.props.translaterService,(()=>this.gridService)),this.gridStateService=new aa(this.extensionService,this.filterService,this._eventPubSubService,this.sharedService,this.sortService,this.treeDataService),this.gridService=new ra(this.gridStateService,this.filterService,this._eventPubSubService,this.paginationService,this.sharedService,this.sortService,this.treeDataService),this.headerGroupingService=new la(this.extensionUtility),this.serviceList=[this.extensionService,this.filterService,this.gridEventService,this.gridService,this.gridStateService,this.headerGroupingService,this.paginationService,this.resizerService,this.sortService,this.treeDataService],this.props.datasetHierarchical&&(this.sharedService.hierarchicalDataset=this.props.datasetHierarchical||[]),this.props.containerService.registerInstance("PubSubService",this._eventPubSubService),this.props.containerService.registerInstance("EventPubSubService",this._eventPubSubService),this.props.containerService.registerInstance("ExtensionUtility",this.extensionUtility),this.props.containerService.registerInstance("FilterService",this.filterService),this.props.containerService.registerInstance("CollectionService",this.collectionService),this.props.containerService.registerInstance("ExtensionService",this.extensionService),this.props.containerService.registerInstance("GridEventService",this.gridEventService),this.props.containerService.registerInstance("GridService",this.gridService),this.props.containerService.registerInstance("GridStateService",this.gridStateService),this.props.containerService.registerInstance("HeaderGroupingService",this.headerGroupingService),this.props.containerService.registerInstance("PaginationService",this.paginationService),this.props.containerService.registerInstance("ResizerService",this.resizerService),this.props.containerService.registerInstance("SharedService",this.sharedService),this.props.containerService.registerInstance("SortService",this.sortService),this.props.containerService.registerInstance("TranslaterService",this.props.translaterService),this.props.containerService.registerInstance("TreeDataService",this.treeDataService)}get backendService(){var e;return null===(e=this.gridOptions.backendServiceApi)||void 0===e?void 0:e.service}get eventHandler(){return this._eventHandler}get isDatasetInitialized(){return this._isDatasetInitialized}set isDatasetInitialized(e){this._isDatasetInitialized=e}set isDatasetHierarchicalInitialized(e){this._isDatasetHierarchicalInitialized=e}get registeredResources(){return this._registeredResources}componentDidMount(){var e,t,i;if(this._mounted=!0,this._elm&&this._eventPubSubService instanceof $t){this._eventPubSubService.elementSource=this._elm;for(const e in this.props)e.startsWith("on")&&this.subscriptions.push(this._eventPubSubService.subscribe(e,(t=>{const i=this.props[e],n=this._eventPubSubService.getEventNameByNamingConvention(e,"");"function"===typeof i&&i.call(null,new CustomEvent(n,{detail:t}))})))}if(this._registeredResources=(null===(e=this.gridOptions)||void 0===e?void 0:e.externalResources)||[],this.initialization(this._eventHandler),this._isGridInitialized=!0,this.hasBackendInfiniteScroll()||(this.gridOptions.enablePagination=!!(this.gridOptions.backendServiceApi&&void 0===this.gridOptions.enablePagination||this.gridOptions.enablePagination)),!this._isPaginationInitialized&&!this.props.datasetHierarchical&&(null===(t=this._gridOptions)||void 0===t?void 0:t.enablePagination)&&this._isLocalGrid&&(this.showPagination=!0,this.loadLocalGridPagination(this.dataset)),null===(i=this._gridOptions)||void 0===i?void 0:i.enableEmptyDataWarningMessage){const e=this.props.dataset||[];if(Array.isArray(e)){const t=e.length;this.displayEmptyDataWarning(t<1)}}this.gridOptions.darkMode&&this.setDarkMode(!0),this.suggestDateParsingWhenHelpful()}initialization(e){var t,i,n,s,r,o,a,l,d,c,h,u,p,m,g,f;if(!this._columnDefinitions)throw new Error("Using `` requires columnDefinitions, it seems that you might have forgot to provide the missing bindable model.");if(this._gridOptions.translater=this.props.translaterService,this._eventHandler=e,this._isAutosizeColsCalled=!1,this._gridOptions&&(void 0!==this._gridOptions.frozenRow&&this._gridOptions.frozenRow>=0||void 0!==this._gridOptions.frozenColumn&&this._gridOptions.frozenColumn>=0)&&void 0===this._gridOptions.enableMouseWheelScrollHandler&&(this._gridOptions.enableMouseWheelScrollHandler=!0),this._eventPubSubService.eventNamingStyle=null!==(i=null===(t=this._gridOptions)||void 0===t?void 0:t.eventNamingStyle)&&void 0!==i?i:zt.camelCase,this._eventPubSubService.publish("onBeforeGridCreate",!0),this._dataset||(this._dataset=this.props.dataset||[]),this._currentDatasetLength=this._dataset.length,this._gridOptions=this.mergeGridOptions(this._gridOptions),this._paginationOptions=null===(n=this._gridOptions)||void 0===n?void 0:n.pagination,this.backendServiceApi=null===(s=this._gridOptions)||void 0===s?void 0:s.backendServiceApi,this._isLocalGrid=!this.backendServiceApi,this.gridOptions.backendServiceApi&&!(null===(r=this.gridOptions.backendServiceApi)||void 0===r?void 0:r.disableInternalPostProcess)&&this.createBackendApiInternalPostProcessCallback(this._gridOptions),!this.props.customDataView){const e=this._gridOptions.dataView&&this._gridOptions.dataView.inlineFilters||!1;let t={...this._gridOptions.dataView,inlineFilters:e};(this._gridOptions.draggableGrouping||this._gridOptions.enableGrouping)&&(this.groupItemMetadataProvider=new di,this.sharedService.groupItemMetadataProvider=this.groupItemMetadataProvider,t={...t,groupItemMetadataProvider:this.groupItemMetadataProvider}),this.dataView=new ci(t,this._eventPubSubService),this._eventPubSubService.publish("onDataviewCreated",this.dataView)}this.preRegisterResources(),this._columnDefinitions=this.loadSlickGridEditors(this.props.columnDefinitions),this._gridOptions.autoAddCustomEditorFormatter&&Eo(this._columnDefinitions,this._gridOptions.autoAddCustomEditorFormatter),this.sharedService.allColumns=this._columnDefinitions,this.sharedService.visibleColumns=this._columnDefinitions,this.extensionService.createExtensionsBeforeGridCreation(this._columnDefinitions,this._gridOptions),(null===(o=this.gridOptions.presets)||void 0===o?void 0:o.pinning)&&(this.gridOptions={...this.gridOptions,...this.gridOptions.presets.pinning}),this.grid=new _s(`#${this.props.gridId}`,this.props.customDataView||this.dataView,this._columnDefinitions,this._gridOptions,this._eventPubSubService),this.sharedService.dataView=this.dataView,this.sharedService.slickGrid=this.grid,this.sharedService.gridContainerElement=this._elm,this.groupItemMetadataProvider&&this.grid.registerPlugin(this.groupItemMetadataProvider),this.extensionService.bindDifferentExtensions(),this.bindDifferentHooks(this.grid,this._gridOptions,this.dataView);const v=null!==(l=null===(a=this._gridOptions)||void 0===a?void 0:a.frozenColumn)&&void 0!==l?l:-1;v>=0&&v<=this._columnDefinitions.length&&this._columnDefinitions.length>0&&(this.sharedService.frozenVisibleColumnId=null!==(c=null===(d=this._columnDefinitions[v])||void 0===d?void 0:d.id)&&void 0!==c?c:""),this.registerResources(),this.grid.init();const b=this._elm;if(b&&this.resizerService.init(this.grid,b),!this._gridOptions.enablePagination&&this._gridOptions.showCustomFooter&&this._gridOptions.customFooterOptions&&b&&(this.slickFooter=new yl(this.grid,this._gridOptions.customFooterOptions,this._eventPubSubService,this.props.translaterService),this.slickFooter.renderFooter(b)),!this.props.customDataView&&this.dataView){const e=(null===(h=this._gridOptions)||void 0===h?void 0:h.enableTreeData)?this.sortTreeDataset(this.props.dataset):this.props.dataset;if(Array.isArray(e)&&this.dataView.setItems(e,null!==(u=this._gridOptions.datasetIdPropertyName)&&void 0!==u?u:"id"),(null===(p=this.grid)||void 0===p?void 0:p.getSelectionModel())&&(null===(m=this._gridOptions)||void 0===m?void 0:m.dataView)&&this._gridOptions.dataView.hasOwnProperty("syncGridSelection")){let e=!1;this._gridOptions.backendServiceApi&&this._gridOptions.dataView.hasOwnProperty("syncGridSelectionWithBackendService")&&(e=this._gridOptions.dataView.syncGridSelectionWithBackendService);const t=this._gridOptions.dataView.syncGridSelection;if("boolean"===typeof t){let i=t;this._isLocalGrid||(i=t&&e),this.dataView.syncGridSelection(this.grid,i)}else"object"===typeof t&&this.dataView.syncGridSelection(this.grid,t.preserveHidden,t.preserveHiddenOnSelectionChange)}this._dataset.length>0&&(this._isDatasetInitialized||!this._gridOptions.enableCheckboxSelector&&!this._gridOptions.enableRowSelection||this.loadRowSelectionPresetWhenExists(),this.loadFilterPresetsWhenDatasetInitialized(),this._isDatasetInitialized=!0)}this._hideHeaderRowAfterPageLoad&&(this.showHeaderRow(!1),this.sharedService.hideHeaderRowAfterPageLoad=this._hideHeaderRowAfterPageLoad),this._eventPubSubService.publish("onGridCreated",this.grid),this.props.customDataView||this.executeAfterDataviewCreated(this.grid,this._gridOptions),this.bindResizeHook(this.grid,this._gridOptions),(null===(g=this._gridOptions)||void 0===g?void 0:g.backendServiceApi)&&this.bindBackendCallbackFunctions(this._gridOptions);const y={element:this._elm,dataView:this.dataView,slickGrid:this.grid,dispose:this.dispose.bind(this),backendService:this.backendService,eventPubSubService:this._eventPubSubService,extensionService:this.extensionService,filterService:this.filterService,gridEventService:this.gridEventService,gridStateService:this.gridStateService,gridService:this.gridService,groupingService:this.headerGroupingService,headerGroupingService:this.headerGroupingService,paginationService:this.paginationService,resizerService:this.resizerService,sortService:this.sortService,treeDataService:this.treeDataService};this.extensions=null===(f=this.extensionService)||void 0===f?void 0:f.extensionList,this.instances=y,this.setStateValue("instances",y),this._eventPubSubService.publish("onReactGridCreated",y),this.observeColumnDefinitions()}componentWillUnmount(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];var t,i,n,s,r,o,a;if(this._eventPubSubService.publish("onBeforeGridDestroy",this.grid),null===(t=this._eventHandler)||void 0===t||t.unsubscribeAll(),hd.off("languageChanged"),e&&this.emptyGridContainerElm(),this._collectionObservers.forEach((e=>null===e||void 0===e?void 0:e.disconnect())),this._eventPubSubService.publish("onAfterGridDestroyed",!0),this.serviceList.forEach((e=>{(null===e||void 0===e?void 0:e.dispose)&&e.dispose()})),this.serviceList=[],null===(n=null===(i=this.backendService)||void 0===i?void 0:i.dispose)||void 0===n||n.call(i),this.disposeExternalResources(),null===(s=this.slickEmptyWarning)||void 0===s||s.dispose(),null===(r=this.slickFooter)||void 0===r||r.dispose(),null===(o=this.slickPagination)||void 0===o||o.dispose(),this.dataView&&(this.dataView.setItems&&this.dataView.setItems([]),this.dataView.destroy&&this.dataView.destroy()),(null===(a=this.grid)||void 0===a?void 0:a.destroy)&&this.grid.destroy(e),this.subscriptions=function(e){if(Array.isArray(e))for(;e.length>0;){const t=e.pop();(null===t||void 0===t?void 0:t.unsubscribe)&&t.unsubscribe()}return e}(this.subscriptions),this.backendServiceApi){for(const e of Object.keys(this.backendServiceApi))this.backendServiceApi[e]=null;this.backendServiceApi=void 0}for(const l of Object.keys(this.props.columnDefinitions))this.props.columnDefinitions[l]=null;for(const l of Object.keys(this.sharedService))this.sharedService[l]=null;this._dataset=null,this._columnDefinitions=[]}emptyGridContainerElm(){var e;const t=(null===(e=this._gridOptions)||void 0===e?void 0:e.gridContainerId)||"grid1";ee(document.querySelector(`#${t}`))}dispose(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.componentWillUnmount(e)}disposeExternalResources(){if(Array.isArray(this._registeredResources))for(;this._registeredResources.length>0;){const e=this._registeredResources.pop();(null===e||void 0===e?void 0:e.dispose)&&e.dispose()}this._registeredResources=[]}componentDidUpdate(e){this.props.gridOptions!==e.gridOptions&&(this._gridOptions={...ud,...this._gridOptions}),this.props.columnDefinitions!==e.columnDefinitions&&(this._columnDefinitions=this.props.columnDefinitions,this.columnDefinitionsChanged(this.props.columnDefinitions)),this.props.dataset!==e.dataset&&(this.dataset=this.props.dataset||e.dataset),this.props.datasetHierarchical&&this.props.datasetHierarchical!==e.datasetHierarchical&&(this.datasetHierarchical=this.props.datasetHierarchical),this.suggestDateParsingWhenHelpful()}columnDefinitionsChanged(e){e&&(this._columnDefinitions=e),this._isGridInitialized&&this.updateColumnDefinitionsList(this._columnDefinitions),this._columnDefinitions.length>0&&this.copyColumnWidthsReference(this._columnDefinitions)}createBackendApiInternalPostProcessCallback(e){const t=null===e||void 0===e?void 0:e.backendServiceApi;if(null===t||void 0===t?void 0:t.service){const e=t.service;"function"===typeof e.getDatasetName&&(t.internalPostProcess=i=>{const n=t&&e&&"function"===typeof e.getDatasetName?e.getDatasetName():"";if(null===i||void 0===i?void 0:i.data[n]){const e=i.data[n].hasOwnProperty("nodes")?i.data[n].nodes:i.data[n],t=i.data[n].hasOwnProperty("totalCount")?i.data[n].totalCount:i.data[n].length;this.refreshGridData(e,t||0)}})}}bindDifferentHooks(e,t,i){var n;if(t.enableTranslate&&this.extensionService.translateAllExtensions(),hd.on("languageChanged",(e=>{this._eventPubSubService.publish("onLanguageChange"),t.enableTranslate&&(this.extensionService.translateAllExtensions(e),(t.createPreHeaderPanel&&t.createTopHeaderPanel||t.createPreHeaderPanel&&!t.enableDraggableGrouping)&&this.headerGroupingService.translateHeaderGrouping())})),t.backendServiceApi){const e=t.backendServiceApi;(null===(n=null===e||void 0===e?void 0:e.service)||void 0===n?void 0:n.init)&&e.service.init(e.options,t.pagination,this.grid,this.sharedService)}i&&e&&(this.gridEventService.bindOnBeforeEditCell(e),this.gridEventService.bindOnCellChange(e),this.gridEventService.bindOnClick(e),i&&e&&(t.enableSorting&&(t.backendServiceApi&&!t.backendServiceApi.useLocalSorting?this.sortService.bindBackendOnSort(e):this.sortService.bindLocalOnSort(e)),t.enableFiltering&&(this.filterService.init(e),t.backendServiceApi&&!t.backendServiceApi.useLocalFiltering?this.filterService.bindBackendOnFilter(e):this.filterService.bindLocalOnFilter(e)),this._eventHandler.subscribe(e.onColumnsReordered,((e,t)=>{this.sharedService.hasColumnsReordered=!0,this.sharedService.visibleColumns=t.impactedColumns})),this._eventHandler.subscribe(e.onSetOptions,((e,t)=>{t.optionsBefore.darkMode!==t.optionsAfter.darkMode&&this.sharedService.gridContainerElement&&this.setDarkMode(t.optionsAfter.darkMode)})),this.loadColumnPresetsWhenDatasetInitialized(),this.loadFilterPresetsWhenDatasetInitialized(),this._eventHandler.subscribe(i.onRowCountChanged,(()=>{e.invalidate(),this.handleOnItemCountChanged(i.getFilteredItemCount()||0,i.getItemCount()||0)})),this._eventHandler.subscribe(i.onSetItemsCalled,((e,t)=>{var n;this.sharedService.isItemsDateParsed=!1,this.handleOnItemCountChanged(i.getFilteredItemCount()||0,t.itemCount),t.itemCount>0&&(this.gridOptions.autosizeColumnsByCellContentOnFirstLoad||this.gridOptions.enableAutoResizeColumnsByCellContent)&&this.resizerService.resizeColumnsByCellContent(!(null===(n=this._gridOptions)||void 0===n?void 0:n.resizeByContentOnlyOnFirstLoad))})),(null===t||void 0===t?void 0:t.enableFiltering)&&!t.enableRowDetailView&&this._eventHandler.subscribe(i.onRowsChanged,((t,i)=>{let{calledOnRowCountChanged:n,rows:s}=i;if(!n&&Array.isArray(s)){const t=e.getRenderedRange();s.filter((e=>e>=t.top&&e<=t.bottom)).forEach((t=>e.updateRow(t))),e.render()}})))),(null===t||void 0===t?void 0:t.colspanCallback)&&(null===i||void 0===i?void 0:i.getItem)&&(null===i||void 0===i?void 0:i.getItemMetadata)&&(i.getItemMetadata=e=>{let n=null;return t.colspanCallback&&(n=t.colspanCallback(i.getItem(e))),n})}bindBackendCallbackFunctions(e){var t,i,n,s,r,o;const a=e.backendServiceApi,l=null===a||void 0===a?void 0:a.service,d=(null===l||void 0===l?void 0:l.options)||{},c=!!d&&(!d||!d.hasOwnProperty("executeProcessCommandOnInit")||d.executeProcessCommandOnInit);if(l){if(null===e||void 0===e?void 0:e.presets){if(l.updateFilters&&Array.isArray(e.presets.filters)&&e.presets.filters.length>0&&l.updateFilters(e.presets.filters,!0),l.updateSorters&&Array.isArray(e.presets.sorters)&&e.presets.sorters.length>0){const i=(null===(t=this._gridOptions)||void 0===t?void 0:t.multiColumnSort)?e.presets.sorters:e.presets.sorters.slice(0,1);l.updateSorters(void 0,i)}if(l.updatePagination&&e.presets.pagination&&!this.hasBackendInfiniteScroll()){const{pageNumber:t,pageSize:i}=e.presets.pagination;l.updatePagination(t,i)}}else{const e=this.filterService.getColumnFilters();e&&l.updateFilters&&l.updateFilters(e,!1)}if(a&&l&&(a.onInit||c)){const e="function"===typeof l.buildQuery?l.buildQuery():"",t=c?null!==(n=null===(i=a.process)||void 0===i?void 0:i.call(a,e))&&void 0!==n?n:null:null!==(r=null===(s=a.onInit)||void 0===s?void 0:s.call(a,e))&&void 0!==r?r:null;queueMicrotask((()=>{var e,i,n,s;const r=this.backendUtilityService,o=new Date;a.preProcess&&a.preProcess();const l=null!==(n=null===(i=null===(e=this._gridOptions)||void 0===e?void 0:e.pagination)||void 0===i?void 0:i.totalItems)&&void 0!==n?n:0;t instanceof Promise?t.then((e=>r.executeBackendProcessesCallback(o,e,a,l))).catch((e=>r.onBackendError(e,a))):t&&(null===(s=this.rxjs)||void 0===s?void 0:s.isObservable(t))&&this.subscriptions.push(t.subscribe((e=>r.executeBackendProcessesCallback(o,e,a,l)),(e=>r.onBackendError(e,a))))}))}(null===(o=a.service.options)||void 0===o?void 0:o.infiniteScroll)&&this.addBackendInfiniteScrollCallback()}}addBackendInfiniteScrollCallback(){var e;if(this.grid&&this.gridOptions.backendServiceApi&&this.hasBackendInfiniteScroll()&&!(null===(e=this.gridOptions.backendServiceApi)||void 0===e?void 0:e.onScrollEnd)){const e=()=>{this.backendUtilityService.setInfiniteScrollBottomHit(!0),this.paginationService.goToNextPage().then((e=>{e||this.backendUtilityService.setInfiniteScrollBottomHit(!1)}))};this.gridOptions.backendServiceApi.onScrollEnd=e,this._eventHandler.subscribe(this.grid.onScroll,((t,i)=>{var n;const s=i.grid.getViewportNode();["mousewheel","scroll"].includes(i.triggeredBy||"")&&(null===(n=this.paginationService)||void 0===n?void 0:n.totalItems)&&i.scrollTop>0&&Math.ceil(s.offsetHeight+i.scrollTop)>=i.scrollHeight&&(this._scrollEndCalled||(e(),this._scrollEndCalled=!0))}));const t=this.gridOptions.backendServiceApi.postProcess;this.gridOptions.backendServiceApi.postProcess=e=>{this._scrollEndCalled=!1,t&&t(e)}}}bindResizeHook(e,t){if(t.autoFitColumnsOnFirstLoad&&t.autosizeColumnsByCellContentOnFirstLoad||t.enableAutoSizeColumns&&t.enableAutoResizeColumnsByCellContent)throw new Error('[Slickgrid-React] You cannot enable both autosize/fit viewport & resize by content, you must choose which resize technique to use. You can enable these 2 options ("autoFitColumnsOnFirstLoad" and "enableAutoSizeColumns") OR these other 2 options ("autosizeColumnsByCellContentOnFirstLoad" and "enableAutoResizeColumnsByCellContent").');t.gridHeight||t.gridWidth?this.resizerService.resizeGrid(0,{height:t.gridHeight,width:t.gridWidth}):this.resizerService.resizeGrid(),e&&(null===t||void 0===t?void 0:t.enableAutoResize)&&t.autoFitColumnsOnFirstLoad&&t.enableAutoSizeColumns&&!this._isAutosizeColsCalled&&(e.autosizeColumns(),this._isAutosizeColsCalled=!0)}executeAfterDataviewCreated(e,t){var i;if(t.enableSorting&&t.presets&&Array.isArray(t.presets.sorters)){const e=(null===(i=this._gridOptions)||void 0===i?void 0:i.multiColumnSort)?t.presets.sorters:t.presets.sorters.slice(0,1);this.sortService.loadGridSorters(e)}}paginationChanged(e){var t,i,n;const s=null!==(i=null===(t=this.gridStateService)||void 0===t?void 0:t.needToPreserveRowSelection())&&void 0!==i&&i;this.grid&&!s&&(null===(n=this.gridOptions)||void 0===n?void 0:n.backendServiceApi)&&(this.gridOptions.enableRowSelection||this.gridOptions.enableCheckboxSelector)&&this.grid.setSelectedRows([]);const{pageNumber:r,pageSize:o}=e;this.sharedService&&void 0!==o&&void 0!==r&&(this.sharedService.currentPagination={pageNumber:r,pageSize:o}),this._eventPubSubService.publish("onGridStateChanged",{change:{newValues:{pageNumber:r,pageSize:o},type:w.pagination},gridState:this.gridStateService.getCurrentGridState()})}paginationOptionsChanged(e){var t;e&&this._paginationOptions?this._paginationOptions={...this._paginationOptions,...e}:this._paginationOptions=e,this._gridOptions&&(this._gridOptions.pagination=this._paginationOptions,this.paginationService.updateTotalItems(null!==(t=null===e||void 0===e?void 0:e.totalItems)&&void 0!==t?t:0,!0))}refreshGridData(e,t){var i,n,s,r,o,a,l,d;if(this.grid&&this._gridOptions){if((null===(i=this._gridOptions)||void 0===i?void 0:i.enablePagination)&&this._isLocalGrid&&(this.showPagination=!0,this.loadLocalGridPagination(e)),(null===(n=this._gridOptions)||void 0===n?void 0:n.enableEmptyDataWarningMessage)&&Array.isArray(e)){const i=t||e.length;this.displayEmptyDataWarning(i<1)}if(Array.isArray(e)&&this.grid&&(null===(s=this.dataView)||void 0===s?void 0:s.setItems)){if(this.dataView.setItems(e,null!==(r=this._gridOptions.datasetIdPropertyName)&&void 0!==r?r:"id"),this._gridOptions.backendServiceApi||this._gridOptions.enableTreeData||this.dataView.reSort(),e.length>0&&(this._isDatasetInitialized||(this.loadFilterPresetsWhenDatasetInitialized(),this._gridOptions.enableCheckboxSelector&&this.loadRowSelectionPresetWhenExists()),this._isDatasetInitialized=!0),this.showPagination=!(!this._gridOptions||!(this._gridOptions.enablePagination||this._gridOptions.backendServiceApi&&void 0===this._gridOptions.enablePagination)),this._paginationOptions&&(null===(o=this._gridOptions)||void 0===o?void 0:o.pagination)&&(null===(a=this._gridOptions)||void 0===a?void 0:a.backendServiceApi)){const e=this.setPaginationOptionsWhenPresetDefined(this._gridOptions,this._paginationOptions),i=void 0!==t?t:null===(d=null===(l=this._gridOptions)||void 0===l?void 0:l.pagination)||void 0===d?void 0:d.totalItems;void 0!==i&&i!==this.totalItems&&(this.totalItems=+i),this._isPaginationInitialized?this.paginationService.updateTotalItems(this.totalItems):this.initializePaginationService(e)}if(this.grid&&this._gridOptions.enableAutoResize){const e=this._gridOptions.autoResize&&this._gridOptions.autoResize.delay;this.resizerService.resizeGrid(e||10)}}}}showHeaderRow(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.grid.setHeaderRowVisibility(e),!0===e&&this._isGridInitialized&&this.grid.setColumns(this.props.columnDefinitions),e}setPaginationOptionsWhenPresetDefined(e,t){var i;return(null===(i=e.presets)||void 0===i?void 0:i.pagination)&&e.pagination&&(this.hasBackendInfiniteScroll()?console.warn("[Slickgrid-React] `presets.pagination` is not supported with Infinite Scroll, reverting to first page."):(t.pageSize=e.presets.pagination.pageSize,t.pageNumber=e.presets.pagination.pageNumber)),t}setDarkMode(){var e,t;arguments.length>0&&void 0!==arguments[0]&&arguments[0]?null===(e=this.sharedService.gridContainerElement)||void 0===e||e.classList.add("slick-dark-mode"):null===(t=this.sharedService.gridContainerElement)||void 0===t||t.classList.remove("slick-dark-mode")}updateColumnDefinitionsList(e){var t,i,n;this.grid&&this._gridOptions&&Array.isArray(e)&&(e=this.loadSlickGridEditors(e),this._gridOptions.autoAddCustomEditorFormatter&&Eo(e,this._gridOptions.autoAddCustomEditorFormatter),this._gridOptions.enableTranslate?this.extensionService.translateColumnHeaders(void 0,e):this.extensionService.renderColumnHeaders(e,!0),(null===(t=this._gridOptions)||void 0===t?void 0:t.enableAutoSizeColumns)?this.grid.autosizeColumns():(null===(i=this._gridOptions)||void 0===i?void 0:i.enableAutoResizeColumnsByCellContent)&&(null===(n=this.resizerService)||void 0===n?void 0:n.resizeColumnsByCellContent)&&this.resizerService.resizeColumnsByCellContent())}observeColumnDefinitions(){this._collectionObservers.push(u(this._columnDefinitions,this.columnDefinitionsChanged.bind(this)))}copyColumnWidthsReference(e){e.forEach((e=>e.originalWidth=e.width))}displayEmptyDataWarning(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t;null===(t=this.slickEmptyWarning)||void 0===t||t.showEmptyDataMessage(e)}handleOnItemCountChanged(e,t){var i;this._currentDatasetLength=t,this.metrics={startTime:new Date,endTime:new Date,itemCount:e,totalItemCount:t},this.slickFooter&&(this.slickFooter.metrics=this.metrics),this._isLocalGrid&&(null===(i=this._gridOptions)||void 0===i?void 0:i.enableEmptyDataWarningMessage)&&this.displayEmptyDataWarning(0===e),this._gridOptions.enableAutoResize&&this.resizerService.isAutoHeightEnabled&&e>0&&this.resizerService.resizeGrid()}initializePaginationService(e){this.grid&&this.gridOptions&&(this.paginationService.totalItems=this.totalItems,this.paginationService.init(this.grid,e,this.backendServiceApi),this.subscriptions.push(this._eventPubSubService.subscribe("onPaginationChanged",(e=>this.paginationChanged(e))),this._eventPubSubService.subscribe("onPaginationOptionsChanged",(e=>this.paginationOptionsChanged(e))),this._eventPubSubService.subscribe("onPaginationVisibilityChanged",(e=>{var t,i,n;this.showPagination=null!==(t=null===e||void 0===e?void 0:e.visible)&&void 0!==t&&t,(null===(i=this.gridOptions)||void 0===i?void 0:i.backendServiceApi)&&(null===(n=this.backendUtilityService)||void 0===n||n.refreshBackendDataset(this.gridOptions)),this.renderPagination(this.showPagination)}))),this.renderPagination(),this._isPaginationInitialized=!0)}async renderPagination(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t,i;if(this.grid&&(null===(t=this._gridOptions)||void 0===t?void 0:t.enablePagination)&&!this._isPaginationInitialized&&e){if(this.gridOptions.customPaginationComponent){const e=document.createElement("section");this._elm.appendChild(e);const{component:t}=await gd(this.gridOptions.customPaginationComponent,e);this.slickPagination=t}else this.slickPagination=new Sl;this.slickPagination&&(this.slickPagination.init(this.grid,this.paginationService,this._eventPubSubService,this.props.translaterService),this.slickPagination.renderPagination(this._elm),this._isPaginationInitialized=!0)}else e||(null===(i=this.slickPagination)||void 0===i||i.dispose(),this._isPaginationInitialized=!1)}loadEditorCollectionAsync(e){var t;if(null===e||void 0===e?void 0:e.editor){const i=e.editor.collectionAsync;e.editor.disabled=!0,i instanceof Promise?i.then((t=>{Array.isArray(t)?this.updateEditorCollection(e,t):t instanceof Response&&"function"===typeof t.json?t.bodyUsed?console.warn("[SlickGrid-React] The response body passed to collectionAsync was already read.Either pass the dataset from the Response or clone the response first using response.clone()"):t.json().then((t=>this.updateEditorCollection(e,t))):(null===t||void 0===t?void 0:t.content)&&this.updateEditorCollection(e,t.content)})):(null===(t=this.rxjs)||void 0===t?void 0:t.isObservable(i))&&queueMicrotask((()=>{this.subscriptions.push(i.subscribe((t=>this.updateEditorCollection(e,t))))}))}}insertDynamicPresetColumns(e,t){if(this._columnDefinitions){const i=this._columnDefinitions.findIndex((t=>t.id===e));if(i>=0){const n=this._columnDefinitions[i];(null===n||void 0===n?void 0:n.id)!==e||t.some((t=>t.id===e))||(i>0?t.splice(i,0,n):t.unshift(n))}}}loadColumnPresetsWhenDatasetInitialized(){var e,t,i,n,s,r,o,a,l;if(this.grid&&this.gridOptions.presets&&Array.isArray(this.gridOptions.presets.columns)&&this.gridOptions.presets.columns.length>0){const d=this.gridStateService.getAssociatedGridColumns(this.grid,this.gridOptions.presets.columns);if(d&&Array.isArray(d)&&d.length>0&&Array.isArray(this._columnDefinitions)){if(this.gridOptions.enableRowMoveManager){const n=null!==(i=null===(t=null===(e=this.gridOptions)||void 0===e?void 0:e.rowMoveManager)||void 0===t?void 0:t.columnId)&&void 0!==i?i:"_move";this.insertDynamicPresetColumns(n,d)}if(this.gridOptions.enableCheckboxSelector){const e=null!==(r=null===(s=null===(n=this.gridOptions)||void 0===n?void 0:n.checkboxSelector)||void 0===s?void 0:s.columnId)&&void 0!==r?r:"_checkbox_selector";this.insertDynamicPresetColumns(e,d)}if(this.gridOptions.enableRowDetailView){const e=null!==(l=null===(a=null===(o=this.gridOptions)||void 0===o?void 0:o.rowDetailView)||void 0===a?void 0:a.columnId)&&void 0!==l?l:"_detail_selector";this.insertDynamicPresetColumns(e,d)}d.forEach((e=>e.originalWidth=e.width)),this.grid.setColumns(d),this.sharedService.visibleColumns=d}}}loadFilterPresetsWhenDatasetInitialized(){var e,t,i;this._gridOptions&&!this.props.customDataView&&this._gridOptions.presets&&(Array.isArray(this._gridOptions.presets.filters)||Array.isArray(null===(t=null===(e=this._gridOptions.presets)||void 0===e?void 0:e.treeData)||void 0===t?void 0:t.toggledItems))&&this.filterService.populateColumnFilterSearchTermPresets((null===(i=this._gridOptions.presets)||void 0===i?void 0:i.filters)||[])}loadLocalGridPagination(e){var t;if(this._gridOptions&&this._paginationOptions){if(this.totalItems=Array.isArray(e)?e.length:0,this._paginationOptions&&(null===(t=this.dataView)||void 0===t?void 0:t.getPagingInfo)){const e=this.dataView.getPagingInfo();(null===e||void 0===e?void 0:e.hasOwnProperty("totalRows"))&&this._paginationOptions.totalItems!==e.totalRows&&(this.totalItems=e.totalRows||0)}this._paginationOptions.totalItems=this.totalItems;const i=this.setPaginationOptionsWhenPresetDefined(this._gridOptions,this._paginationOptions);this.initializePaginationService(i)}}loadRowSelectionPresetWhenExists(){var e,t;const i=null===(e=this._gridOptions)||void 0===e?void 0:e.presets;if(this._gridOptions&&(this._gridOptions.enableCheckboxSelector||this._gridOptions.enableRowSelection)&&(null===(t=this.grid)||void 0===t?void 0:t.getSelectionModel())&&(null===i||void 0===i?void 0:i.rowSelection)&&(Array.isArray(i.rowSelection.gridRowIndexes)||Array.isArray(i.rowSelection.dataContextIds))){let e=i.rowSelection.dataContextIds,t=i.rowSelection.gridRowIndexes;Array.isArray(e)&&e.length>0?t=this.dataView.mapIdsToRows(e)||[]:Array.isArray(t)&&t.length>0&&(e=this.dataView.mapRowsToIds(t)||[]),this.grid&&Array.isArray(t)&&(this.grid.setSelectedRows(t),this.dataView.setSelectedIds(e||[],{isRowBeingAdded:!0,shouldTriggerEvent:!1,applyRowSelectionToGrid:!0}))}}hasBackendInfiniteScroll(e){var t,i;return!!(null===(i=null===(t=(e||this.gridOptions).backendServiceApi)||void 0===t?void 0:t.service.options)||void 0===i?void 0:i.infiniteScroll)}mergeGridOptions(e){const t=Se(!0,{},ud,e);return t.gridId=this.props.gridId,t.gridContainerId=`slickGridContainer-${this.props.gridId}`,t.enableFiltering&&!t.showHeaderRow&&(t.showHeaderRow=t.enableFiltering),(null===t||void 0===t?void 0:t.pagination)&&(e.enablePagination||e.backendServiceApi)&&e.pagination&&Array.isArray(e.pagination.pageSizes)&&(t.pagination.pageSizes=e.pagination.pageSizes),this.sharedService&&!t.enableFiltering&&t.enablePagination&&this._isLocalGrid&&(t.enableFiltering=!0,t.showHeaderRow=!1,this._hideHeaderRowAfterPageLoad=!0,this.sharedService.hideHeaderRowAfterPageLoad=!0),t}registerExternalResources(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&this.disposeExternalResources(),e.forEach((e=>this._registeredResources.push(e))),this.initializeExternalResources(e)}resetExternalResources(){this._registeredResources=[]}preRegisterResources(){if(this._registeredResources=this.gridOptions.externalResources||[],Array.isArray(this._registeredResources))for(const e of this._registeredResources)"RxJsResource"===(null===e||void 0===e?void 0:e.className)&&this.registerRxJsResource(e)}initializeExternalResources(e){if(Array.isArray(e))for(const t of e)this.grid&&"function"===typeof t.init&&t.init(this.grid,this.props.containerService)}registerResources(){Array.isArray(this._registeredResources)&&(this.sharedService.externalRegisteredResources=this._registeredResources),this._registeredResources.push(this.gridService,this.gridStateService),(this.gridOptions.createPreHeaderPanel&&this.gridOptions.createTopHeaderPanel||this.gridOptions.createPreHeaderPanel&&!this.gridOptions.enableDraggableGrouping)&&this._registeredResources.push(this.headerGroupingService),this.gridOptions.enableTreeData&&this._registeredResources.push(this.treeDataService),this.gridOptions.enableTranslate&&this.extensionService.translateColumnHeaders(),this.slickEmptyWarning=new _l,this._registeredResources.push(this.slickEmptyWarning),this.initializeExternalResources(this._registeredResources)}registerRxJsResource(e){this.rxjs=e,this.backendUtilityService.addRxJsResource(this.rxjs),this.filterFactory.addRxJsResource(this.rxjs),this.filterService.addRxJsResource(this.rxjs),this.sortService.addRxJsResource(this.rxjs),this.paginationService.addRxJsResource(this.rxjs),this.props.containerService.registerInstance("RxJsResource",this.rxjs)}sortTreeDataset(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this._currentDatasetLength;let n,s=[];return this._isDatasetHierarchicalInitialized&&this.datasetHierarchical?(n=this.treeDataService.sortHierarchicalDataset(this.datasetHierarchical),s=n.flat):this._gridOptions&&Array.isArray(e)&&e.length>0&&(n=this.treeDataService.convertFlatParentChildToTreeDatasetAndSort(e,this._columnDefinitions,this._gridOptions),this.sharedService.hierarchicalDataset=n.hierarchical,s=n.flat),e.length>0&&(t||e.length!==i)&&this.filterService.refreshTreeDataFilters(s),s}loadSlickGridEditors(e){return e.some((e=>`${null===e||void 0===e?void 0:e.id}`.includes(".")))&&console.error('[Slickgrid-React] Make sure that none of your Column Definition "id" property includes a dot in its name because that will cause some problems with the Editors. For example if your column definition "field" property is "user.firstName" then use "firstName" as the column "id".'),e.map((e=>{var t,i;if(e)return(null===(t=e.editor)||void 0===t?void 0:t.collectionAsync)&&this.loadEditorCollectionAsync(e),{...e,editorClass:null===(i=e.editor)||void 0===i?void 0:i.model}}))}suggestDateParsingWhenHelpful(){var e;(null===(e=this.dataView)||void 0===e?void 0:e.getItemCount())>1e4&&!this.gridOptions.silenceWarnings&&!this.gridOptions.preParseDateColumns&&this.grid.getColumns().some((e=>U(e.type)))&&console.warn("[Slickgrid-React] For getting better perf, we suggest you enable the `preParseDateColumns` grid option, for more info visit => https://ghiscoding.gitbook.io/slickgrid-react/column-functionalities/sorting#pre-parse-date-columns-for-better-perf")}updateEditorCollection(e,t){if(this.grid&&e.editor){e.editor.collection=t,e.editor.disabled=!1;const i=this.grid.getCellEditor();(null===i||void 0===i?void 0:i.disable)&&(null===i||void 0===i?void 0:i.renderDomElement)&&(i.destroy(),i.disable(!1),i.renderDomElement(t))}}render(){return d.createElement("div",{id:`slickGridContainer-${this.props.gridId}`,className:"grid-pane",ref:e=>this._elm=e},this.props.header&&d.createElement("div",{className:"header"},this.props.header),d.createElement("div",{id:`${this.props.gridId}`,className:"slickgrid-container"}),this.props.footer&&d.createElement("div",{className:"footer"},this.props.footer))}}fd.defaultProps={containerService:md,translaterService:new class{constructor(){this.i18n=hd}getCurrentLanguage(){return this.i18n.language}async use(e){return this.i18n.changeLanguage(e)}translate(e){return this.i18n.t(e)}},dataset:[],gridId:"",columnDefinitions:[]};var vd={},bd=Uint8Array,yd=Uint16Array,_d=Int32Array,Sd=new bd([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),wd=new bd([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Cd=new bd([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ed=function(e,t){for(var i=new yd(31),n=0;n<31;++n)i[n]=t+=1<>1|(21845&Ad)<<1;Dd=(61680&(Dd=(52428&Dd)>>2|(13107&Dd)<<2))>>4|(3855&Dd)<<4,Rd[Ad]=((65280&Dd)>>8|(255&Dd)<<8)>>1}var Pd=function(e,t,i){for(var n=e.length,s=0,r=new yd(t);s>l]=d}else for(o=new yd(n),s=0;s>15-e[s]);return o},Fd=new bd(288);for(Ad=0;Ad<144;++Ad)Fd[Ad]=8;for(Ad=144;Ad<256;++Ad)Fd[Ad]=9;for(Ad=256;Ad<280;++Ad)Fd[Ad]=7;for(Ad=280;Ad<288;++Ad)Fd[Ad]=8;var Md=new bd(32);for(Ad=0;Ad<32;++Ad)Md[Ad]=5;var Ld=Pd(Fd,9,0),Nd=Pd(Md,5,0),Bd=function(e){return(e+7)/8|0},Hd=function(e,t,i){return(null==t||t<0)&&(t=0),(null==i||i>e.length)&&(i=e.length),new bd(e.subarray(t,i))},zd=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],$d=function(e,t,i){var n=new Error(t||zd[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,$d),!i)throw n;return n},Ud=function(e,t,i){i<<=7&t;var n=t/8|0;e[n]|=i,e[n+1]|=i>>8},Vd=function(e,t,i){i<<=7&t;var n=t/8|0;e[n]|=i,e[n+1]|=i>>8,e[n+2]|=i>>16},Wd=function(e,t){for(var i=[],n=0;nu&&(u=r[n].s);var p=new yd(u+1),m=jd(i[c-1],p,0);if(m>t){n=0;var g=0,f=m-t,v=1<t))break;g+=v-(1<>=f;g>0;){var y=r[n].s;p[y]=0&&g;--n){var _=r[n].s;p[_]==t&&(--p[_],++g)}m=t}return{t:new bd(p),l:m}},jd=function(e,t,i){return-1==e.s?Math.max(jd(e.l,t,i+1),jd(e.r,t,i+1)):t[e.s]=i},Gd=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new yd(++t),n=0,s=e[0],r=1,o=function(e){i[n++]=e},a=1;a<=t;++a)if(e[a]==s&&a!=t)++r;else{if(!s&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(s),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(s);r=1,s=e[a]}return{c:i.subarray(0,n),n:t}},Yd=function(e,t){for(var i=0,n=0;n>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var r=0;r4&&!x[Cd[k-1]];--k);var I,R,A,D,P=d+5<<3,F=Yd(s,Fd)+Yd(r,Md)+o,M=Yd(s,u)+Yd(r,g)+o+14+3*k+Yd(C,x)+2*C[16]+3*C[17]+7*C[18];if(l>=0&&P<=F&&P<=M)return Kd(t,c,e.subarray(l,l+d));if(Ud(t,c,1+(M15&&(Ud(t,c,H[E]>>5&127),c+=H[E]>>12)}}}else I=Ld,R=Fd,A=Nd,D=Md;for(E=0;E255){Vd(t,c,I[(z=$>>18&31)+257]),c+=R[z+257],z>7&&(Ud(t,c,$>>23&31),c+=Sd[z]);var U=31&$;Vd(t,c,A[U]),c+=D[U],U>3&&(Vd(t,c,$>>5&8191),c+=wd[U])}else Vd(t,c,I[$]),c+=R[$]}return Vd(t,c,I[256]),c+R[256]},Xd=new _d([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Qd=new bd(0),Zd=function(e,t,i,n,s,r){var o=r.z||e.length,a=new bd(n+o+5*(1+Math.ceil(o/7e3))+s),l=a.subarray(n,a.length-s),d=r.l,c=7&(r.r||0);if(t){c&&(l[0]=r.r>>3);for(var h=Xd[t-1],u=h>>13,p=8191&h,m=(1<7e3||x>24576)&&(D>423||!d)){c=qd(e,l,0,_,S,w,E,x,k,O-k,c),x=C=E=0,k=O;for(var P=0;P<286;++P)S[P]=0;for(P=0;P<30;++P)w[P]=0}var F=2,M=0,L=p,N=R-A&32767;if(D>2&&I==y(O-N))for(var B=Math.min(u,D)-1,H=Math.min(32767,O),z=Math.min(258,D);N<=H&&--L&&R!=A;){if(e[O+F]==e[O+F-N]){for(var $=0;$F){if(F=$,M=N,$>B)break;var U=Math.min(N,$-2),V=0;for(P=0;PV&&(V=j,A=W)}}}N+=(R=A)-(A=g[R])&32767}if(M){_[x++]=268435456|Td[F]<<18|Id[M];var G=31&Td[F],Y=31&Id[M];E+=Sd[G]+wd[Y],++S[257+G],++w[Y],T=O+F,++C}else _[x++]=e[O],++S[e[O]]}}for(O=Math.max(O,T);O=o&&(l[c/8|0]=d,K=o),c=Kd(l,c+1,e.subarray(O,K))}r.i=o}return Hd(a,0,n+Bd(c)+s)},Jd=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,n=9;--n;)i=(1&i&&-306674912)^i>>>1;e[t]=i}return e}(),ec=function(){var e=-1;return{p:function(t){for(var i=e,n=0;n>>8;e=i},d:function(){return~e}}},tc=function(e,t,i,n,s){if(!s&&(s={l:1},t.dictionary)){var r=t.dictionary.subarray(-32768),o=new bd(r.length+e.length);o.set(r),o.set(e,r.length),e=o,s.w=r.length}return Zd(e,null==t.level?6:t.level,null==t.mem?s.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,n,s)},ic=function(e,t){var i={};for(var n in e)i[n]=e[n];for(var n in t)i[n]=t[n];return i},nc=function(e,t,i){for(var n=e(),s=e.toString(),r=s.slice(s.indexOf("[")+1,s.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o>>=8};function cc(e,t){return tc(e,t||{},0,0)}var hc=function(e,t,i,n){for(var s in e){var r=e[s],o=t+s,a=n;Array.isArray(r)&&(a=ic(n,r[1]),r=r[0]),r instanceof bd?i[o]=[r,a]:(i[o+="/"]=[new bd(0),a],hc(r,o,i,n))}},uc="undefined"!=typeof TextEncoder&&new TextEncoder,pc="undefined"!=typeof TextDecoder&&new TextDecoder;try{pc.decode(Qd,{stream:!0})}catch(_b){}function mc(e,t){if(t){for(var i=new bd(e.length),n=0;n>1)),o=0,a=function(e){r[o++]=e};for(n=0;nr.length){var l=new bd(o+8+(s-n<<1));l.set(r),r=l}var d=e.charCodeAt(n);d<128||t?a(d):d<2048?(a(192|d>>6),a(128|63&d)):d>55295&&d<57344?(a(240|(d=65536+(1047552&d)|1023&e.charCodeAt(++n))>>18),a(128|d>>12&63),a(128|d>>6&63),a(128|63&d)):(a(224|d>>12),a(128|d>>6&63),a(128|63&d))}return Hd(r,0,o)}var gc=function(e){var t=0;if(e)for(var i in e){var n=e[i].length;n>65535&&$d(9),t+=n+4}return t},fc=function(e,t,i,n,s,r,o,a){var l=n.length,d=i.extra,c=a&&a.length,h=gc(d);dc(e,t,null!=o?33639248:67324752),t+=4,null!=o&&(e[t++]=20,e[t++]=i.os),e[t]=20,t+=2,e[t++]=i.flag<<1|(r<0&&8),e[t++]=s&&8,e[t++]=255&i.compression,e[t++]=i.compression>>8;var u=new Date(null==i.mtime?Date.now():i.mtime),p=u.getFullYear()-1980;if((p<0||p>119)&&$d(10),dc(e,t,p<<25|u.getMonth()+1<<21|u.getDate()<<16|u.getHours()<<11|u.getMinutes()<<5|u.getSeconds()>>1),t+=4,-1!=r&&(dc(e,t,i.crc),dc(e,t+4,r<0?-r-2:r),dc(e,t+8,i.size)),dc(e,t+12,l),dc(e,t+14,h),t+=16,null!=o&&(dc(e,t,c),dc(e,t+6,i.attrs),dc(e,t+10,o),t+=14),e.set(n,t),t+=l,h)for(var m in d){var g=d[m],f=g.length;dc(e,t,+m),dc(e,t+2,f),e.set(g,t+4),t+=4+f}return c&&(e.set(a,t),t+=c),t},vc=function(e,t,i,n,s){dc(e,t,101010256),dc(e,t+8,i),dc(e,t+10,i),dc(e,t+12,n),dc(e,t+16,s)};function bc(e,t,i){i||(i=t,t={}),"function"!=typeof i&&$d(7);var n={};hc(e,"",n,t);var s=Object.keys(n),r=s.length,o=0,a=0,l=r,d=new Array(r),c=[],h=function(){for(var e=0;e65535&&E($d(11,0,1),null),C)if(f<16e4)try{E(null,cc(l,m))}catch(_b){E(_b,null)}else c.push(function(e,t,i){return i||(i=t,t={}),"function"!=typeof i&&$d(7),lc(e,t,[oc],(function(e){return ac(cc(e.data[0],e.data[1]))}),0,i)}(l,m,E));else E(null,l)},g=0;g((e,t,i)=>t in e?_c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i);function wc(e){const t=typeof e;return null!=e&&("object"===t||"function"===t)}function Cc(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);if(null===t)return!0;const i=Object.prototype.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&Function.prototype.call(i)===Function.prototype.call(e)}function Ec(e){return null!=e&&"string"==typeof e.valueOf()}const Oc={"&":"&","<":"<",">":">",'"':""","'":"'"},xc=e=>("string"!=typeof e&&(e=`${e}`),e.replace(/[&<>"']/g,(e=>Oc[e])));class Tc{constructor(e,t){Sc(this,"documentElement"),this.documentElement=this.createElement(t),this.documentElement.setAttribute("xmlns",e)}createElement(e){return new Ic({nodeName:e})}createTextNode(e){return new kc(e)}toString(){return this.documentElement.toString()}}Sc(Tc,"Node",{Create:e=>{switch(e.type){case"XML":return new Ic(e);case"TEXT":return new kc(e.nodeValue);default:return null}}});class kc{constructor(e){Sc(this,"nodeValue"),this.nodeValue=e}toJSON(){return{nodeValue:this.nodeValue,type:"TEXT"}}toString(){return xc(this.nodeValue)}}class Ic{constructor(e){if(Sc(this,"nodeName",""),Sc(this,"children"),Sc(this,"nodeValue"),Sc(this,"attributes"),Sc(this,"firstChild"),this.nodeName=e.nodeName,this.children=[],this.nodeValue=e.nodeValue||"",this.attributes={},e.children)for(let t=0,i=e.children.length;t${t}${this.nodeName}>`:"/>",e}toJSON(){const e=[];for(let t=0,i=this.children.length;t0;)r-=Math.pow(26,s-1),n=r%Math.pow(26,s),r-=n,n/=Math.pow(26,s-1),o="ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(n)+o,s+=1;return e.LETTER_REFS[t]=o,o.concat(String(i))}};Sc(Rc,"_idSpaces",{}),Sc(Rc,"LETTER_REFS",{}),Sc(Rc,"schemas",{worksheet:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",sharedStrings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",stylesheet:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",relationships:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",relationshipPackage:"http://schemas.openxmlformats.org/package/2006/relationships",contentTypes:"http://schemas.openxmlformats.org/package/2006/content-types",spreadsheetml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",markupCompat:"http://schemas.openxmlformats.org/markup-compatibility/2006",x14ac:"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac",officeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",package:"http://schemas.openxmlformats.org/package/2006/relationships",table:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",spreadsheetDrawing:"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",drawing:"http://schemas.openxmlformats.org/drawingml/2006/main",drawingRelationship:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",chart:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"});let Ac=Rc;const Dc={};function Pc(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"$lodash$";Dc[e]||(Dc[e]=0);const t=++Dc[e];return"$lodash$"===e?`${t}`:`${e}${t}`}const Fc={};class Mc{constructor(){Sc(this,"relations",{}),Sc(this,"lastId",1),Pc("rId")}importData(e){this.relations=e.relations,this.lastId=e.lastId}exportData(){return{relations:this.relations,lastId:this.lastId}}addRelation(e,t){return this.relations[e.id]={id:Pc("rId"),schema:Ac.schemas[t],object:e},this.relations[e.id].id}getRelationshipId(e){return this.relations[e.id]?this.relations[e.id].id:null}toXML(){const e=Ac.createXmlDoc(Ac.schemas.relationshipPackage,"Relationships"),t=e.documentElement;for(const[i,n]of Object.entries(this.relations)){const s=Ac.createElement(e,"Relationship",[["Id",n.id],["Type",n.schema],["Target",n.object.target||Fc[i]]]);n.object.targetMode&&s.setAttribute("TargetMode",n.object.targetMode),t.appendChild(s)}return e}}class Lc{constructor(){Sc(this,"state",null),Sc(this,"xSplit",null),Sc(this,"ySplit",null),Sc(this,"activePane","bottomRight"),Sc(this,"topLeftCell",null),Sc(this,"_freezePane")}freezePane(e,t,i){this._freezePane={xSplit:e,ySplit:t,cell:i}}exportXML(e){const t=e.createElement("pane");return null!==this.state&&(t.setAttribute("xSplit",this._freezePane.xSplit),t.setAttribute("ySplit",this._freezePane.ySplit),t.setAttribute("topLeftCell",this._freezePane.cell),t.setAttribute("activePane","bottomRight"),t.setAttribute("state","frozen")),t}}class Nc{constructor(){Sc(this,"strings",{}),Sc(this,"stringArray",[]),Sc(this,"id",Pc("SharedStrings"))}addString(e){return this.strings[e]=this.stringArray.length,this.stringArray[this.stringArray.length]=e,this.strings[e]}exportData(){return this.strings}toXML(){const e=Ac.createXmlDoc(Ac.schemas.spreadsheetml,"sst"),t=e.documentElement;this.stringArray.reverse();let i=this.stringArray.length;t.setAttribute("count",i),t.setAttribute("uniqueCount",i);const n=e.createElement("si"),s=e.createElement("t");s.appendChild(e.createTextNode("--placeholder--")),n.appendChild(s);const r=this.stringArray;for(;i--;){const e=n.cloneNode(!0);"string"==typeof r[i]&&r[i].match(/\s+/)&&e.firstChild.setAttribute("xml:space","preserve"),e.firstChild.firstChild.nodeValue=r[i],t.appendChild(e)}return e}}class Bc{constructor(e){Sc(this,"pane"),Sc(this,"showZeros",null),Sc(this,"defaultGridColor",null),Sc(this,"colorId",null),Sc(this,"rightToLeft",null),Sc(this,"showFormulas",null),Sc(this,"showGridLines",null),Sc(this,"showOutlineSymbols",null),Sc(this,"showRowColHeaders",null),Sc(this,"showRuler",null),Sc(this,"showWhiteSpace",null),Sc(this,"tabSelected",null),Sc(this,"topLeftCell",null),Sc(this,"viewType",null),Sc(this,"windowProtection",null),Sc(this,"zoomScale",null),Sc(this,"zoomScaleNormal",null),Sc(this,"zoomScalePageLayoutView",null),Sc(this,"zoomScaleSheetLayoutView",null);const t=e||{};this.pane=t.pane||new Lc}freezePane(e,t,i){this.pane.state="frozen",this.pane.xSplit=e,this.pane.ySplit=t,this.pane.topLeftCell=i}exportXML(e){const t=e.createElement("sheetViews"),i=e.createElement("sheetView");return Ac.setAttributesOnDoc(i,{workbookViewId:0,showZeros:{v:this.showZeros,type:Boolean},defaultGridColor:{v:this.defaultGridColor,type:Boolean},colorId:this.colorId,rightToLeft:{v:this.rightToLeft,type:Boolean},showFormulas:{v:this.showFormulas,type:Boolean},showGridLines:{v:this.showGridLines,type:Boolean},showOutlineSymbols:{v:this.showOutlineSymbols,type:Boolean},showRowColHeaders:{v:this.showRowColHeaders,type:Boolean},showRuler:{v:this.showRuler,type:Boolean},showWhiteSpace:{v:this.showWhiteSpace,type:Boolean},tabSelected:{v:this.tabSelected,type:Boolean},viewType:this.viewType,windowProtection:{v:this.windowProtection,type:Boolean},zoomScale:{v:this.zoomScale,type:Boolean},zoomScaleNormal:this.zoomScaleNormal,zoomScalePageLayoutView:this.zoomScalePageLayoutView,zoomScaleSheetLayoutView:this.zoomScaleSheetLayoutView}),i.appendChild(this.pane.exportXML(e)),t.appendChild(i),t}}class Hc{constructor(){Sc(this,"id",Pc("StyleSheet")),Sc(this,"cellStyles",[{name:"Normal",xfId:"0",builtinId:"0"}]),Sc(this,"defaultTableStyle",!1),Sc(this,"differentialStyles",[{}]),Sc(this,"masterCellFormats",[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfid:0}]),Sc(this,"masterCellStyles",[{numFmtId:0,fontId:0,fillId:0,borderId:0}]),Sc(this,"fonts",[{}]),Sc(this,"numberFormatters",[]),Sc(this,"fills",[{},{type:"pattern",patternType:"gray125",fgColor:"FF333333",bgColor:"FF333333"}]),Sc(this,"borders",[{top:{},left:{},right:{},bottom:{},diagonal:{}}]),Sc(this,"tableStyles",[])}createSimpleFormatter(e){const t={id:this.masterCellFormats.length};if("date"===e)t.numFmtId=14;return this.masterCellFormats.push(t),t}createFill(e){const t=this.fills.length,i=e;return i.id=t,this.fills.push(i),i}createNumberFormatter(e){const t={id:this.numberFormatters.length+100,formatCode:e};return this.numberFormatters.push(t),t}createFormat(e){const t={id:this.masterCellFormats.length};if(e.protection&&(t.protection=e.protection),e.font&&wc(e.font))t.fontId=this.createFontStyle(e.font).id;else if(e.font){if(Number.isNaN(Number.parseInt(e.font,10)))throw new Error("Passing a non-numeric font id is not supported");t.fontId=e.font}if(e.format&&Ec(e.format))t.numFmtId=this.createNumberFormatter(e.format).id;else if(e.format){if(Number.isNaN(Number.parseInt(e.format,10)))throw new Error("Invalid number formatter id");t.numFmtId=e.format}if(e.border&&wc(e.border))t.borderId=this.createBorderFormatter(e.border).id;else if(e.border){if(Number.isNaN(Number.parseInt(e.border,10)))throw new Error("Passing a non-numeric border id is not supported");t.borderId=e.border}if(e.fill&&wc(e.fill))t.fillId=this.createFill(e.fill).id;else if(e.fill){if(Number.isNaN(Number.parseInt(e.fill,10)))throw new Error("Passing a non-numeric fill id is not supported");t.fillId=e.fill}return e.alignment&&wc(e.alignment)&&(t.alignment=function(e,t){return t.reduce(((t,i)=>(null!=e&&e.hasOwnProperty(i)&&(t[i]=e[i]),t)),{})}(e.alignment,["horizontal","justifyLastLine","readingOrder","relativeIndent","shrinkToFit","textRotation","vertical","wrapText"])),this.masterCellFormats.push(t),t}createDifferentialStyle(e){const t=this.differentialStyles.length,i={id:t};return e.font&&wc(e.font)&&(i.font=e.font),e.border&&wc(e.border)&&(i.border=Object.assign({top:{},left:{},right:{},bottom:{},diagonal:{}},e.border)),e.fill&&wc(e.fill)&&(i.fill=e.fill),e.alignment&&wc(e.alignment)&&(i.alignment=e.alignment),e.format&&Ec(e.format)&&(i.numFmt=e.format),this.differentialStyles[t]=i,i}createTableStyle(e){this.tableStyles.push(e)}createBorderFormatter(e){return e={top:{},left:{},right:{},bottom:{},diagonal:{},id:this.borders.length,...e},this.borders.push(e),e}createFontStyle(e){const t={id:this.fonts.length};return e.bold&&(t.bold=!0),e.italic&&(t.italic=!0),e.superscript&&(t.vertAlign="superscript"),e.subscript&&(t.vertAlign="subscript"),e.underline&&("string"==typeof e.underline&&["double","singleAccounting","doubleAccounting"].includes(e.underline)?t.underline=e.underline:t.underline=!0),e.strike&&(t.strike=!0),e.outline&&(t.outline=!0),e.shadow&&(t.shadow=!0),e.size&&(t.size=e.size),e.color&&(t.color=e.color),e.fontName&&(t.fontName=e.fontName),this.fonts.push(t),t}exportBorders(e){const t=e.createElement("borders");t.setAttribute("count",this.borders.length);for(let i=0,n=this.borders.length;i{const n=e.createElement(i);return t[i].style&&n.setAttribute("style",t[i].style),t[i].color&&n.appendChild(this.exportColor(e,t[i].color)),n};return i.appendChild(n("left")),i.appendChild(n("right")),i.appendChild(n("top")),i.appendChild(n("bottom")),i.appendChild(n("diagonal")),i}exportColor(e,t){const i=e.createElement("color");return Ec(t)?(i.setAttribute("rgb",t),i):(void 0!==t.tint&&i.setAttribute("tint",t.tint),void 0!==t.auto&&i.setAttribute("auto",String(!!t.auto)),void 0!==t.theme&&i.setAttribute("theme",t.theme),i)}exportMasterCellFormats(e){const t=Ac.createElement(e,"cellXfs",[["count",this.masterCellFormats.length]]);for(let i=0,n=this.masterCellFormats.length;i-1!==n.indexOf(e)));if(t.alignment){const n=t.alignment;i.appendChild(this.exportAlignment(e,n))}t.protection&&(i.appendChild(this.exportProtection(e,t.protection)),i.setAttribute("applyProtection","1"));let r=s.length;for(;r--;)i.setAttribute(s[r],t[s[r]]);return t.fillId&&i.setAttribute("applyFill","1"),t.fontId&&i.setAttribute("applyFont","1"),t.borderId&&i.setAttribute("applyBorder","1"),t.alignment&&i.setAttribute("applyAlignment","1"),t.numFmtId&&i.setAttribute("applyNumberFormat","1"),void 0!==t.numFmtId&&void 0===t.xfId&&i.setAttribute("xfId","0"),i}exportAlignment(e,t){const i=e.createElement("alignment"),n=Object.keys(t);for(let s=0,r=n.length;s{let[s,r]=t;if("name"===s)return;n++;const o=e.createElement("tableStyleElement");o.setAttribute("type",s),o.setAttribute("dxfId",r),i.appendChild(o)})),i.setAttribute("count",String(n)),i}exportProtection(e,t){const i=e.createElement("protection");for(const n in t)n in t&&i.setAttribute(n,t[n]);return i}toXML(){const e=Ac.createXmlDoc(Ac.schemas.spreadsheetml,"styleSheet"),t=e.documentElement;return t.appendChild(this.exportNumberFormatters(e)),t.appendChild(this.exportFonts(e)),t.appendChild(this.exportFills(e)),t.appendChild(this.exportBorders(e)),t.appendChild(this.exportMasterCellStyles(e)),t.appendChild(this.exportMasterCellFormats(e)),t.appendChild(this.exportCellStyles(e)),t.appendChild(this.exportDifferentialStyles(e)),this.tableStyles.length&&t.appendChild(this.exportTableStyles(e)),e}}class zc{constructor(e){Sc(this,"name",""),Sc(this,"id",Pc("Worksheet")),Sc(this,"_timezoneOffset"),Sc(this,"relations",null),Sc(this,"columnFormats",[]),Sc(this,"data",[]),Sc(this,"mergedCells",[]),Sc(this,"columns",[]),Sc(this,"sheetProtection",!1),Sc(this,"_headers",[]),Sc(this,"_footers",[]),Sc(this,"_tables",[]),Sc(this,"_drawings",[]),Sc(this,"_orientation"),Sc(this,"_margin"),Sc(this,"_rowInstructions",{}),Sc(this,"_freezePane",{}),Sc(this,"sharedStrings",null),Sc(this,"hyperlinks",[]),Sc(this,"sheetView"),Sc(this,"showZeros",null),this._timezoneOffset=60*(new Date).getTimezoneOffset()*1e3,this.sheetView=e.sheetView||new Bc,this.initialize(e)}initialize(e){e=e||{},this.name=e.name,this.id=Pc("Worksheet"),this._timezoneOffset=60*(new Date).getTimezoneOffset()*1e3,e.columns&&this.setColumns(e.columns),this.relations=new Mc}exportData(){return{relations:this.relations.exportData(),columnFormats:this.columnFormats,data:this.data,columns:this.columns,mergedCells:this.mergedCells,_headers:this._headers,_footers:this._footers,_tables:this._tables,_rowInstructions:this._rowInstructions,_freezePane:this._freezePane,name:this.name,id:this.id}}importData(e){this.relations.importData(e.relations),delete e.relations,Object.assign(this,e)}setSharedStringCollection(e){this.sharedStrings=e}addTable(e){this._tables.push(e),this.relations.addRelation(e,"table")}addDrawings(e){this._drawings.push(e),this.relations.addRelation(e,"drawingRelationship")}setRowInstructions(e,t){this._rowInstructions[e]=t}setHeader(e){if(!Array.isArray(e))throw"Invalid argument type - setHeader expects an array of three instructions";this._headers=e}setFooter(e){if(!Array.isArray(e))throw"Invalid argument type - setFooter expects an array of three instructions";this._footers=e}compilePageDetailPackage(e){return e=e||"",["&L",this.compilePageDetailPiece(e[0]||""),"&C",this.compilePageDetailPiece(e[1]||""),"&R",this.compilePageDetailPiece(e[2]||"")].join("")}compilePageDetailPiece(e){if(Ec(e))return'&"-,Regular"'.concat(e);if(wc(e)&&!Array.isArray(e)){let t="";if(e.font||e.bold){const i=e.bold?"Bold":"Regular";t+=`&"${e.font||"-"}`,t+=`,${i}"`}else t+='&"-,Regular"';return e.underline&&(t+="&U"),e.fontSize&&(t+=`&${e.fontSize}`),t+=e.text,t}return Array.isArray(e)?e.reduce(((e,t)=>e.concat(this.compilePageDetailPiece(t))),""):void 0}exportHeader(e){const t=e.createElement("oddHeader");return t.appendChild(e.createTextNode(this.compilePageDetailPackage(this._headers))),t}exportFooter(e){const t=e.createElement("oddFooter");return t.appendChild(e.createTextNode(this.compilePageDetailPackage(this._footers))),t}_buildCache(e){const t=e.createElement("c"),i=e.createElement("v");i.appendChild(e.createTextNode("--temp--")),t.appendChild(i);const n=e.createElement("c"),s=e.createElement("f");s.appendChild(e.createTextNode("--temp--")),n.appendChild(s);const r=e.createElement("c");r.setAttribute("t","s");const o=e.createElement("v");return o.appendChild(e.createTextNode("--temp--")),r.appendChild(o),{number:t,date:t,string:r,formula:n}}collectSharedStrings(){const e=this.data,t={};for(let i=0,n=e.length;i"u"&&(t[i]=!0)}}return Object.keys(t)}toXML(){var e,t,i;const n=this.data,s=this.columns||[],r=Ac.createXmlDoc(Ac.schemas.spreadsheetml,"worksheet"),o=r.documentElement;let a,l,d;o.setAttribute("xmlns:r",Ac.schemas.relationships),o.setAttribute("xmlns:mc",Ac.schemas.markupCompat);let c=0;const h=Ac.createElement(r,"sheetData"),u=this._buildCache(r);for(d=0,l=n.length;dc?a:c;const l=r.createElement("row");for(let n=0;n0){const e=r.createElement("hyperlinks"),t=this.hyperlinks;for(a=0,l=t.length;a0){const e=r.createElement("mergeCells");for(a=0,l=this.mergedCells.length;a0||this._footers.length>0){const e=r.createElement("headerFooter");this._headers.length>0&&e.appendChild(this.exportHeader(r)),this._footers.length>0&&e.appendChild(this.exportFooter(r)),o.appendChild(e)}for(a=0,l=this._drawings.length;a0){const e=r.createElement("tableParts");for(e.setAttribute("count",this._tables.length),a=0,l=this._tables.length;a31&&console.log(`Microsoft Excel requires work sheet names to be less than 32 characters long, work sheet name "${this.worksheets[r].name}" is ${this.worksheets[r].name.length} characters long`),t.setAttribute("name",this.worksheets[r].name),t.setAttribute("sheetId",r+1),t.setAttribute("r:id",this.relations.getRelationshipId(this.worksheets[r])),i.appendChild(t)}t.appendChild(i);const n=Ac.createElement(e,"definedNames");let s=0;for(const r in this.printTitles)if(r in this.printTitles){const t=this.printTitles[r],i=e.createElement("definedName");i.setAttribute("name","_xlnm.Print_Titles"),i.setAttribute("localSheetId",s++);let o="";t.top&&(o+=`${r}!$1:$${t.top}`,t.left&&(o+=",")),t.left&&(o+=`${r}!$A:$${t.left}`),i.appendChild(e.createTextNode(o)),n.appendChild(i)}return t.appendChild(n),e}createWorkbookRelationship(){const e=Ac.createXmlDoc(Ac.schemas.relationshipPackage,"Relationships");return e.documentElement.appendChild(Ac.createElement(e,"Relationship",[["Id","rId1"],["Type",Ac.schemas.officeDocument],["Target","xl/workbook.xml"]])),e}_generateCorePaths(e){let t,i;for(Fc[this.styleSheet.id]="styles.xml",Fc[this.sharedStrings.id]="sharedStrings.xml",Fc[this.id]="/xl/workbook.xml",t=0,i=this.tables.length;t\n${n}`}}generateFiles(){return new Promise((e=>{const t={};this._generateCorePaths(t);for(let i=0,n=this.worksheets.length;i{e.generateFiles().then((e=>{for(const[t,i]of Object.entries(e))n[t.substr(1)]=mc(i);return bc(n,(null==i?void 0:i.zipOptions)||{},((e,n)=>{if(e)r(e);else if("Uint8Array"===t)s(n);else{const e=(null==i?void 0:i.fileFormat)??"xlsx";let t=null==i?void 0:i.mimeType;void 0===t&&(t="xls"===e?"application/vnd.ms-excel":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),s(new Blob([n],{type:t}))}}))}))}))}(e,"Blob",{...i,fileFormat:n}).then((e=>{!function(e,t){const i=document.createElement("a"),n=URL.createObjectURL(t);i&&document&&(i.textContent="download",i.href=n,i.setAttribute("download",e),i.style.visibility="hidden",document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n))}(t,e)}))}const Vc=(e,t)=>{let{excelFormatId:i}=t;return void 0!==i?{value:e,metadata:{style:i}}:e},Wc=(e,t)=>{let{columnDef:i,excelFormatId:n,gridOptions:s}=t;return{value:"string"===typeof e&&/\d/g.test(e)?jc(e,i,s):e,metadata:{style:n}}};function jc(e,t,i){let n=e;if("string"===typeof e&&e){const s=","===xo("decimalSeparator",t,i,g.DEFAULT_NUMBER_DECIMAL_SEPARATOR)?parseFloat(e.replace(/[^0-9,-]+/g,"").replace(",",".")):parseFloat(e.replace(/[^\d.-]/g,""));n=isNaN(s)?e:s}return n}function Gc(e,t,i,n){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const r=$(i);let o,a=Vc;return r===y.number&&s&&(o=qc(e,t,i,n,"cell").excelFormat.id,a=Wc),{excelFormatId:o,getDataValueParser:a}}function Yc(e,t){return e?.[t.groupType]?.[t.columnDef.field]??0}function Kc(e){let t;switch(e){case el.currency:case el.dollar:case el.dollarColored:case el.dollarColoredBold:t="currency";break;case el.percent:case el.percentComplete:case el.percentCompleteBar:case el.percentCompleteBarWithText:case el.percentSymbol:t="percent";break;default:t="decimal"}return t}function qc(e,t,i,n,s){let r,o="",a=i.groupTotalsExcelExportOptions?.groupType||"";const l=$(i);if("group"===s)switch(i.groupTotalsFormatter){case tl:case il:case nl:case sl:a="avg";break;case ol:a="min";break;case rl:a="max";break;case al:case ll:case dl:case cl:case hl:case ul:case gl:case ml:case pl:a="sum";break;default:r=t.numberFormat}else if(l===y.number)switch(i.formatter){case el.multiple:if(Array.isArray(i.params?.formatters))for(const o of i.params.formatters){const{excelFormat:a}=qc(e,t,{...i,formatter:o},n,s);if(a!==t.numberFormat){r=a;break}}r||(r=t.numberFormat);break;case el.currency:case el.decimal:case el.dollar:case el.dollarColored:case el.dollarColoredBold:case el.percent:case el.percentComplete:case el.percentCompleteBar:case el.percentCompleteBarWithText:case el.percentSymbol:o=Qc(i,n,"cell");break;default:r=t.numberFormat}return r||!i.formatter&&!i.groupTotalsFormatter||(o=Qc(i,n,s,a),t.hasOwnProperty(o)||(t[o]=e.createFormat({format:o})),r=t[o]),{excelFormat:r,groupType:a}}function Xc(e){const[t,i,n,s,r,o,a,l]=e?.match(/^([^\d(-]*)([(]?)([^\d]*)([-]?[\w]]?[\d\s]*[.,\d]*[\d]*[^)\s%]?)([^\d.,)]*)([)]?)([^\d]*)$/i)||[],d=(r||"").replace(/1/g,"0").replace(/[2]/g,"#");return[Zc(i??""),n??"",Zc(s??""),d,Zc(o??""),a??"",Zc(l??"")].join("").replace(",",",")}function Qc(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",s="",r="",o="";const{minDecimal:a,maxDecimal:l,thousandSeparator:d}=function(e,t,i){let n;if("group"===i)switch(e.groupTotalsFormatter){case il:case nl:case cl:case hl:case ul:case pl:case ml:case gl:n="currency";break;case sl:n="percent";break;default:n="decimal"}else if(e.formatter===el.multiple&&Array.isArray(e.params?.formatters)){n="decimal";for(const t of e.params.formatters)if(n=Kc(t),"decimal"!==n)break}else n=Kc(e.formatter);return Oo(e,t,n,i)}(e,t,i),c=parseFloat(`${d?"2220":"0"}.${function(e,t){return Jc("1",e)+Jc("2",t-e)}(a,l)}`);return"group"===i&&e.groupTotalsFormatter?(r=Ze(e.groupTotalsFormatter({[n]:{[e.field]:c}},e,t)),o=Ze(e.groupTotalsFormatter({[n]:{[e.field]:-c}},e,t))):e.formatter&&(r=Ze(e.formatter(0,0,c,e,{},t)),o=Ze(e.formatter(0,0,-c,e,{},t))),r&&o&&(s=Xc(r)+";"+Xc(o)),s}function Zc(e){return e?`"${e}"`:e}function Jc(e,t){let i="";for(let n=0;n>6*i)+n];i>0;){var r=t>>6*(i-1);s.push(128|63&r),i-=1}return s}}oh.prototype={encode:function(e,t){e=e?String(e):"",t=ih(t),this._streaming||(this._encoder=new ah(this._options)),this._streaming=Boolean(t.stream);for(var i,n=[],s=new nh(function(e){for(var t=String(e),i=t.length,n=0,s=[];n57343)s.push(r);else if(56320<=r&&r<=57343)s.push(65533);else if(55296<=r&&r<=56319)if(n===i-1)s.push(65533);else{var o=e.charCodeAt(n+1);if(56320<=o&&o<=57343){var a=1023&r,l=1023&o;s.push(65536+(a<<10)+l),n+=1}else s.push(65533)}n+=1}return s}(e));!s.endOfStream()&&(i=this._encoder.handler(s,s.read()))!==sh;)Array.isArray(i)?n.push.apply(n,i):n.push(i);if(!this._streaming){for(;(i=this._encoder.handler(s,s.read()))!==sh;)Array.isArray(i)?n.push.apply(n,i):n.push(i);this._encoder=null}return new Uint8Array(n)}};const lh={delimiter:v.comma,filename:"export",format:_.csv,useUtf8WithBom:!0};var dh,ch,hh,uh,ph,mh,gh,fh,vh,bh=i(219),yh=i.n(bh);!function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"}(dh||(dh={})),function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"}(ch||(ch={})),function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"}(hh||(hh={})),function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"}(uh||(uh={})),function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"}(ph||(ph={})),function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"}(mh||(mh={})),function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"}(gh||(gh={})),function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth"}(fh||(fh={})),function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"}(vh||(vh={}));const[_h,Sh]=(()=>{const e=()=>{throw new Error("BigInt is not available in this environment")};function t(){throw e()}return t.asIntN=()=>{throw e()},t.asUintN=()=>{throw e()},"undefined"!==typeof BigInt?[BigInt,!0]:[t,!1]})(),[wh,Ch]=(()=>{const e=()=>{throw new Error("BigInt64Array is not available in this environment")};return"undefined"!==typeof BigInt64Array?[BigInt64Array,!0]:[class{static get BYTES_PER_ELEMENT(){return 8}static of(){throw e()}static from(){throw e()}constructor(){throw e()}},!1]})(),[Eh,Oh]=(()=>{const e=()=>{throw new Error("BigUint64Array is not available in this environment")};return"undefined"!==typeof BigUint64Array?[BigUint64Array,!0]:[class{static get BYTES_PER_ELEMENT(){return 8}static of(){throw e()}static from(){throw e()}constructor(){throw e()}},!1]})(),xh=e=>"number"===typeof e,Th=e=>"boolean"===typeof e,kh=e=>"function"===typeof e,Ih=e=>null!=e&&Object(e)===e,Rh=e=>Ih(e)&&kh(e.then),Ah=e=>Ih(e)&&kh(e[Symbol.iterator]),Dh=e=>Ih(e)&&kh(e[Symbol.asyncIterator]),Ph=e=>Ih(e)&&Ih(e.schema),Fh=e=>Ih(e)&&"done"in e&&"value"in e,Mh=e=>Ih(e)&&kh(e.stat)&&xh(e.fd),Lh=e=>Ih(e)&&Bh(e.body),Nh=e=>"_getDOMStream"in e&&"_getNodeStream"in e,Bh=e=>Ih(e)&&kh(e.cancel)&&kh(e.getReader)&&!Nh(e),Hh=e=>Ih(e)&&kh(e.read)&&kh(e.pipe)&&Th(e.readable)&&!Nh(e);function zh(e){if(null===e)return"null";if(undefined===e)return"undefined";switch(typeof e){case"number":case"bigint":return`${e}`;case"string":return`"${e}"`}return"function"===typeof e[Symbol.toPrimitive]?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof wh||e instanceof Eh?`[${[...e].map((e=>zh(e)))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,((e,t)=>"bigint"===typeof t?`${t}`:t))}function $h(e,t,i,n){return new(i||(i=Promise))((function(s,r){function o(e){try{l(n.next(e))}catch(_b){r(_b)}}function a(e){try{l(n.throw(e))}catch(_b){r(_b)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}l((n=n.apply(e,t||[])).next())}))}Object.create;function Uh(e){var t="function"===typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"===typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Vh(e){return this instanceof Vh?(this.v=e,this):new Vh(e)}function Wh(e,t,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,s=i.apply(e,t||[]),r=[];return n=Object.create(("function"===typeof AsyncIterator?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",(function(e){return function(t){return Promise.resolve(t).then(e,d)}})),n[Symbol.asyncIterator]=function(){return this},n;function o(e,t){s[e]&&(n[e]=function(t){return new Promise((function(i,n){r.push([e,t,i,n])>1||a(e,t)}))},t&&(n[e]=t(n[e])))}function a(e,t){try{!function(e){e.value instanceof Vh?Promise.resolve(e.value.v).then(l,d):c(r[0][2],e)}(s[e](t))}catch(_b){c(r[0][3],_b)}}function l(e){a("next",e)}function d(e){a("throw",e)}function c(e,t){e(t),r.shift(),r.length&&a(r[0][0],r[0][1])}}function jh(e){var t,i;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,s){t[n]=e[n]?function(t){return(i=!i)?{value:Vh(e[n](t)),done:!1}:s?s(t):t}:s}}function Gh(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,i=e[Symbol.asyncIterator];return i?i.call(e):(e=Uh(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=e[i]&&function(t){return new Promise((function(n,s){(function(e,t,i,n){Promise.resolve(n).then((function(t){e({value:t,done:i})}),t)})(n,s,(t=e[i](t)).done,t.value)}))}}}Object.create;"function"===typeof SuppressedError&&SuppressedError;const Yh=new TextDecoder("utf-8"),Kh=e=>Yh.decode(e),qh=new TextEncoder,Xh=e=>qh.encode(e),Qh="undefined"!==typeof SharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;function Zh(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.byteLength;const s=e.byteLength,r=new Uint8Array(e.buffer,e.byteOffset,s),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,s));return r.set(o,i),e}function Jh(e,t){const i=function(e){const t=e[0]?[e[0]]:[];let i,n,s,r;for(let o,a,l=0,d=0,c=e.length;++le+t.byteLength),0);let s,r,o,a=0,l=-1;const d=Math.min(t||Number.POSITIVE_INFINITY,n);for(const c=i.length;++lIh(e)&&kh(e.clear)&&kh(e.bytes)&&kh(e.position)&&kh(e.setPosition)&&kh(e.capacity)&&kh(e.getBufferIdentifier)&&kh(e.createLong))(i)?eu(e,i.bytes()):ArrayBuffer.isView(i)?i.byteLength<=0?new e(0):new e(i.buffer,i.byteOffset,i.byteLength/e.BYTES_PER_ELEMENT):e.from(i)):new e(0)}const tu=e=>eu(Int32Array,e),iu=e=>eu(Uint8Array,e),nu=e=>(e.next(),e);function*su(e,t){const i=function*(e){yield e},n="string"===typeof t||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Qh?i(t):Ah(t)?t:i(t);return yield*nu(function*(t){let i=null;do{i=t.next(yield eu(e,i))}while(!i.done)}(n[Symbol.iterator]())),new e}function ru(e,t){return Wh(this,arguments,(function*(){if(Rh(t))return yield Vh(yield Vh(yield*jh(Gh(ru(e,yield Vh(t))))));const i=function(e){return Wh(this,arguments,(function*(){yield yield Vh(yield Vh(e))}))},n="string"===typeof t||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Qh?i(t):Ah(t)?function(e){return Wh(this,arguments,(function*(){yield Vh(yield*jh(Gh(nu(function*(e){let t=null;do{t=e.next(yield null===t||void 0===t?void 0:t.value)}while(!t.done)}(e[Symbol.iterator]())))))}))}(t):Dh(t)?t:i(t);return yield Vh(yield*jh(Gh(nu(function(t){return Wh(this,arguments,(function*(){let i=null;do{i=yield Vh(t.next(yield yield Vh(eu(e,i))))}while(!i.done)}))}(n[Symbol.asyncIterator]()))))),yield Vh(new e)}))}function ou(e,t,i){if(0!==e){i=i.slice(0,t+1);for(let n=-1;++n<=t;)i[n]+=e}return i}const au=Symbol.for("isArrowBigNum");function lu(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n0&&void 0!==arguments[0]?arguments[0]:"default"){case"number":return uu(this);case"string":return pu(this);case"default":return mu(this)}return pu(this)},Object.setPrototypeOf(du.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(cu.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(hu.prototype,Object.create(Uint32Array.prototype)),Object.assign(du.prototype,lu.prototype,{constructor:du,signed:!0,TypedArray:Int32Array,BigIntArray:wh}),Object.assign(cu.prototype,lu.prototype,{constructor:cu,signed:!1,TypedArray:Uint32Array,BigIntArray:Eh}),Object.assign(hu.prototype,lu.prototype,{constructor:hu,signed:!0,TypedArray:Uint32Array,BigIntArray:Eh}),Sh?(mu=e=>8===e.byteLength?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:gu(e),pu=e=>8===e.byteLength?`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`:gu(e)):(pu=gu,mu=pu);class fu{static new(e,t){switch(t){case!0:return new du(e);case!1:return new cu(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case wh:return new du(e)}return 16===e.byteLength?new hu(e):new cu(e)}static signed(e){return new du(e)}static unsigned(e){return new cu(e)}static decimal(e){return new hu(e)}constructor(e,t){return fu.new(e,t)}}var vu,bu,yu,_u,Su,wu,Cu,Eu,Ou,xu,Tu,ku,Iu,Ru,Au,Du,Pu,Fu,Mu,Lu;class Nu{static isNull(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Null}static isInt(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Int}static isFloat(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Float}static isBinary(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Binary}static isUtf8(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Utf8}static isBool(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Bool}static isDecimal(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Decimal}static isDate(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Date}static isTime(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Time}static isTimestamp(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Timestamp}static isInterval(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Interval}static isList(e){return(null===e||void 0===e?void 0:e.typeId)===fh.List}static isStruct(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Struct}static isUnion(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Union}static isFixedSizeBinary(e){return(null===e||void 0===e?void 0:e.typeId)===fh.FixedSizeBinary}static isFixedSizeList(e){return(null===e||void 0===e?void 0:e.typeId)===fh.FixedSizeList}static isMap(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Map}static isDictionary(e){return(null===e||void 0===e?void 0:e.typeId)===fh.Dictionary}static isDenseUnion(e){return Nu.isUnion(e)&&e.mode===ch.Dense}static isSparseUnion(e){return Nu.isUnion(e)&&e.mode===ch.Sparse}get typeId(){return fh.NONE}}vu=Symbol.toStringTag,Nu[vu]=((Lu=Nu.prototype).children=null,Lu.ArrayType=Array,Lu[Symbol.toStringTag]="DataType");class Bu extends Nu{toString(){return"Null"}get typeId(){return fh.Null}}bu=Symbol.toStringTag,Bu[bu]=(e=>e[Symbol.toStringTag]="Null")(Bu.prototype);class Hu extends Nu{constructor(e,t){super(),this.isSigned=e,this.bitWidth=t}get typeId(){return fh.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?wh:Eh}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}yu=Symbol.toStringTag,Hu[yu]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Hu.prototype);class zu extends Hu{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(class extends Hu{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(class extends Hu{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(zu.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(class extends Hu{constructor(){super(!0,64)}get ArrayType(){return wh}}.prototype,"ArrayType",{value:wh}),Object.defineProperty(class extends Hu{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(class extends Hu{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(class extends Hu{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(class extends Hu{constructor(){super(!1,64)}get ArrayType(){return Eh}}.prototype,"ArrayType",{value:Eh});class $u extends Nu{constructor(e){super(),this.precision=e}get typeId(){return fh.Float}get ArrayType(){switch(this.precision){case hh.HALF:return Uint16Array;case hh.SINGLE:return Float32Array;case hh.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}_u=Symbol.toStringTag,$u[_u]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))($u.prototype);Object.defineProperty(class extends $u{constructor(){super(hh.HALF)}}.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(class extends $u{constructor(){super(hh.SINGLE)}}.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(class extends $u{constructor(){super(hh.DOUBLE)}}.prototype,"ArrayType",{value:Float64Array});class Uu extends Nu{constructor(){super()}get typeId(){return fh.Binary}toString(){return"Binary"}}Su=Symbol.toStringTag,Uu[Su]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Uu.prototype);class Vu extends Nu{constructor(){super()}get typeId(){return fh.Utf8}toString(){return"Utf8"}}wu=Symbol.toStringTag,Vu[wu]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Vu.prototype);class Wu extends Nu{constructor(){super()}get typeId(){return fh.Bool}toString(){return"Bool"}}Cu=Symbol.toStringTag,Wu[Cu]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Wu.prototype);class ju extends Nu{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;super(),this.scale=e,this.precision=t,this.bitWidth=i}get typeId(){return fh.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}Eu=Symbol.toStringTag,ju[Eu]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(ju.prototype);class Gu extends Nu{constructor(e){super(),this.unit=e}get typeId(){return fh.Date}toString(){return`Date${32*(this.unit+1)}<${uh[this.unit]}>`}}Ou=Symbol.toStringTag,Gu[Ou]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Gu.prototype);class Yu extends Nu{constructor(e,t){super(),this.unit=e,this.bitWidth=t}get typeId(){return fh.Time}toString(){return`Time${this.bitWidth}<${ph[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return wh}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}xu=Symbol.toStringTag,Yu[xu]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Yu.prototype);class Ku extends Nu{constructor(e,t){super(),this.unit=e,this.timezone=t}get typeId(){return fh.Timestamp}toString(){return`Timestamp<${ph[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Tu=Symbol.toStringTag,Ku[Tu]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Ku.prototype);class qu extends Nu{constructor(e){super(),this.unit=e}get typeId(){return fh.Interval}toString(){return`Interval<${mh[this.unit]}>`}}ku=Symbol.toStringTag,qu[ku]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(qu.prototype);class Xu extends Nu{constructor(e){super(),this.children=[e]}get typeId(){return fh.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}Iu=Symbol.toStringTag,Xu[Iu]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Xu.prototype);class Qu extends Nu{constructor(e){super(),this.children=e}get typeId(){return fh.Struct}toString(){return`Struct<{${this.children.map((e=>`${e.name}:${e.type}`)).join(", ")}}>`}}Ru=Symbol.toStringTag,Qu[Ru]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Qu.prototype);class Zu extends Nu{constructor(e,t,i){super(),this.mode=e,this.children=i,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce(((e,t,i)=>(e[t]=i)&&e||e),Object.create(null))}get typeId(){return fh.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map((e=>`${e.type}`)).join(" | ")}>`}}Au=Symbol.toStringTag,Zu[Au]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Zu.prototype);class Ju extends Nu{constructor(e){super(),this.byteWidth=e}get typeId(){return fh.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}Du=Symbol.toStringTag,Ju[Du]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(Ju.prototype);class ep extends Nu{constructor(e,t){super(),this.listSize=e,this.children=[t]}get typeId(){return fh.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}Pu=Symbol.toStringTag,ep[Pu]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(ep.prototype);class tp extends Nu{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super(),this.children=[e],this.keysSorted=t}get typeId(){return fh.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map((e=>`${e.name}:${e.type}`)).join(", ")}}>`}}Fu=Symbol.toStringTag,tp[Fu]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(tp.prototype);const ip=(np=-1,()=>++np);var np;class sp extends Nu{constructor(e,t,i,n){super(),this.indices=t,this.dictionary=e,this.isOrdered=n||!1,this.id=null==i?ip():"number"===typeof i?i:i.low}get typeId(){return fh.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}function rp(e){const t=e;switch(e.typeId){case fh.Decimal:return e.bitWidth/32;case fh.Timestamp:return 2;case fh.Date:case fh.Interval:return 1+t.unit;case fh.FixedSizeList:return t.listSize;case fh.FixedSizeBinary:return t.byteWidth;default:return 1}}Mu=Symbol.toStringTag,sp[Mu]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(sp.prototype);class op{visitMany(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;nthis.visit(e,...i.map((e=>e[t])))))}visit(){for(var e=arguments.length,t=new Array(e),i=0;i2&&void 0!==arguments[2])||arguments[2];if("number"===typeof t)return ap(e,t,i);if("string"===typeof t&&t in fh)return ap(e,fh[t],i);if(t&&t instanceof Nu)return ap(e,lp(t),i);if((null===t||void 0===t?void 0:t.type)&&t.type instanceof Nu)return ap(e,lp(t.type),i);return ap(e,fh.NONE,i)}(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1])}getVisitFnByTypeId(e){return ap(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1])}visitNull(e){return null}visitBool(e){return null}visitInt(e){return null}visitFloat(e){return null}visitUtf8(e){return null}visitBinary(e){return null}visitFixedSizeBinary(e){return null}visitDate(e){return null}visitTimestamp(e){return null}visitTime(e){return null}visitDecimal(e){return null}visitList(e){return null}visitStruct(e){return null}visitUnion(e){return null}visitDictionary(e){return null}visitInterval(e){return null}visitFixedSizeList(e){return null}visitMap(e){return null}}function ap(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=null;switch(t){case fh.Null:n=e.visitNull;break;case fh.Bool:n=e.visitBool;break;case fh.Int:n=e.visitInt;break;case fh.Int8:n=e.visitInt8||e.visitInt;break;case fh.Int16:n=e.visitInt16||e.visitInt;break;case fh.Int32:n=e.visitInt32||e.visitInt;break;case fh.Int64:n=e.visitInt64||e.visitInt;break;case fh.Uint8:n=e.visitUint8||e.visitInt;break;case fh.Uint16:n=e.visitUint16||e.visitInt;break;case fh.Uint32:n=e.visitUint32||e.visitInt;break;case fh.Uint64:n=e.visitUint64||e.visitInt;break;case fh.Float:n=e.visitFloat;break;case fh.Float16:n=e.visitFloat16||e.visitFloat;break;case fh.Float32:n=e.visitFloat32||e.visitFloat;break;case fh.Float64:n=e.visitFloat64||e.visitFloat;break;case fh.Utf8:n=e.visitUtf8;break;case fh.Binary:n=e.visitBinary;break;case fh.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case fh.Date:n=e.visitDate;break;case fh.DateDay:n=e.visitDateDay||e.visitDate;break;case fh.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case fh.Timestamp:n=e.visitTimestamp;break;case fh.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case fh.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case fh.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case fh.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case fh.Time:n=e.visitTime;break;case fh.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case fh.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case fh.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case fh.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case fh.Decimal:n=e.visitDecimal;break;case fh.List:n=e.visitList;break;case fh.Struct:n=e.visitStruct;break;case fh.Union:n=e.visitUnion;break;case fh.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case fh.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case fh.Dictionary:n=e.visitDictionary;break;case fh.Interval:n=e.visitInterval;break;case fh.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case fh.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case fh.FixedSizeList:n=e.visitFixedSizeList;break;case fh.Map:n=e.visitMap}if("function"===typeof n)return n;if(!i)return()=>null;throw new Error(`Unrecognized type '${fh[t]}'`)}function lp(e){switch(e.typeId){case fh.Null:return fh.Null;case fh.Int:{const{bitWidth:t,isSigned:i}=e;switch(t){case 8:return i?fh.Int8:fh.Uint8;case 16:return i?fh.Int16:fh.Uint16;case 32:return i?fh.Int32:fh.Uint32;case 64:return i?fh.Int64:fh.Uint64}return fh.Int}case fh.Float:switch(e.precision){case hh.HALF:return fh.Float16;case hh.SINGLE:return fh.Float32;case hh.DOUBLE:return fh.Float64}return fh.Float;case fh.Binary:return fh.Binary;case fh.Utf8:return fh.Utf8;case fh.Bool:return fh.Bool;case fh.Decimal:return fh.Decimal;case fh.Time:switch(e.unit){case ph.SECOND:return fh.TimeSecond;case ph.MILLISECOND:return fh.TimeMillisecond;case ph.MICROSECOND:return fh.TimeMicrosecond;case ph.NANOSECOND:return fh.TimeNanosecond}return fh.Time;case fh.Timestamp:switch(e.unit){case ph.SECOND:return fh.TimestampSecond;case ph.MILLISECOND:return fh.TimestampMillisecond;case ph.MICROSECOND:return fh.TimestampMicrosecond;case ph.NANOSECOND:return fh.TimestampNanosecond}return fh.Timestamp;case fh.Date:switch(e.unit){case uh.DAY:return fh.DateDay;case uh.MILLISECOND:return fh.DateMillisecond}return fh.Date;case fh.Interval:switch(e.unit){case mh.DAY_TIME:return fh.IntervalDayTime;case mh.YEAR_MONTH:return fh.IntervalYearMonth}return fh.Interval;case fh.Map:return fh.Map;case fh.List:return fh.List;case fh.Struct:return fh.Struct;case fh.Union:switch(e.mode){case ch.Dense:return fh.DenseUnion;case ch.Sparse:return fh.SparseUnion}return fh.Union;case fh.FixedSizeBinary:return fh.FixedSizeBinary;case fh.FixedSizeList:return fh.FixedSizeList;case fh.Dictionary:return fh.Dictionary}throw new Error(`Unrecognized type '${fh[e.typeId]}'`)}op.prototype.visitInt8=null,op.prototype.visitInt16=null,op.prototype.visitInt32=null,op.prototype.visitInt64=null,op.prototype.visitUint8=null,op.prototype.visitUint16=null,op.prototype.visitUint32=null,op.prototype.visitUint64=null,op.prototype.visitFloat16=null,op.prototype.visitFloat32=null,op.prototype.visitFloat64=null,op.prototype.visitDateDay=null,op.prototype.visitDateMillisecond=null,op.prototype.visitTimestampSecond=null,op.prototype.visitTimestampMillisecond=null,op.prototype.visitTimestampMicrosecond=null,op.prototype.visitTimestampNanosecond=null,op.prototype.visitTimeSecond=null,op.prototype.visitTimeMillisecond=null,op.prototype.visitTimeMicrosecond=null,op.prototype.visitTimeNanosecond=null,op.prototype.visitDenseUnion=null,op.prototype.visitSparseUnion=null,op.prototype.visitIntervalDayTime=null,op.prototype.visitIntervalYearMonth=null;const dp=new Float64Array(1),cp=new Uint32Array(dp.buffer);function hp(e){const t=(31744&e)>>10,i=(1023&e)/1024,n=Math.pow(-1,(32768&e)>>15);switch(t){case 31:return n*(i?Number.NaN:1/0);case 0:return n*(i?6103515625e-14*i:0)}return n*Math.pow(2,t-15)*(1+i)}class up extends op{}function pp(e){return(t,i,n)=>{if(t.setValid(i,null!=n))return e(t,i,n)}}const mp=(e,t,i)=>{e[t]=Math.trunc(i%4294967296),e[t+1]=Math.trunc(i/4294967296)},gp=(e,t,i,n)=>{if(i+1{let{values:n}=e;n[t]=i},vp=(e,t,i)=>{let{values:n}=e;n[t]=i},bp=(e,t,i)=>{let{values:n}=e;n[t]=function(e){if(e!==e)return 32256;dp[0]=e;const t=(2147483648&cp[1])>>16&65535;let i=2146435072&cp[1],n=0;return i>=1089470464?cp[0]>0?i=31744:(i=(2080374784&i)>>16,n=(1048575&cp[1])>>10):i<=1056964608?(n=1048576+(1048575&cp[1]),n=1048576+(n<<(i>>20)-998)>>21,i=0):(i=i-1056964608>>10,n=512+(1048575&cp[1])>>10),t|i|65535&n}(i)},yp=(e,t,i)=>{let{values:n}=e;((e,t,i)=>{e[t]=Math.trunc(i/864e5)})(n,t,i.valueOf())},_p=(e,t,i)=>{let{values:n}=e;mp(n,2*t,i.valueOf())},Sp=(e,t,i)=>{let{values:n}=e;return mp(n,2*t,i/1e3)},wp=(e,t,i)=>{let{values:n}=e;return mp(n,2*t,i)},Cp=(e,t,i)=>{let{values:n}=e;return((e,t,i)=>{e[t]=Math.trunc(1e3*i%4294967296),e[t+1]=Math.trunc(1e3*i/4294967296)})(n,2*t,i)},Ep=(e,t,i)=>{let{values:n}=e;return((e,t,i)=>{e[t]=Math.trunc(1e6*i%4294967296),e[t+1]=Math.trunc(1e6*i/4294967296)})(n,2*t,i)},Op=(e,t,i)=>{let{values:n}=e;n[t]=i},xp=(e,t,i)=>{let{values:n}=e;n[t]=i},Tp=(e,t,i)=>{let{values:n}=e;n[t]=i},kp=(e,t,i)=>{let{values:n}=e;n[t]=i},Ip=(e,t,i)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[n];Pp.visit(s,e.valueOffsets[t],i)},Rp=(e,t,i)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],s=e.children[n];Pp.visit(s,t,i)},Ap=(e,t,i)=>{let{values:n}=e;n.set(i.subarray(0,2),2*t)},Dp=(e,t,i)=>{let{values:n}=e;n[t]=12*i[0]+i[1]%12};up.prototype.visitBool=pp(((e,t,i)=>{let{offset:n,values:s}=e;const r=n+t;i?s[r>>3]|=1<>3]&=~(1<{switch(e.type.precision){case hh.HALF:return bp(e,t,i);case hh.SINGLE:case hh.DOUBLE:return vp(e,t,i)}})),up.prototype.visitFloat16=pp(bp),up.prototype.visitFloat32=pp(vp),up.prototype.visitFloat64=pp(vp),up.prototype.visitUtf8=pp(((e,t,i)=>{let{values:n,valueOffsets:s}=e;gp(n,s,t,Xh(i))})),up.prototype.visitBinary=pp(((e,t,i)=>{let{values:n,valueOffsets:s}=e;return gp(n,s,t,i)})),up.prototype.visitFixedSizeBinary=pp(((e,t,i)=>{let{stride:n,values:s}=e;s.set(i.subarray(0,n),n*t)})),up.prototype.visitDate=pp(((e,t,i)=>{e.type.unit===uh.DAY?yp(e,t,i):_p(e,t,i)})),up.prototype.visitDateDay=pp(yp),up.prototype.visitDateMillisecond=pp(_p),up.prototype.visitTimestamp=pp(((e,t,i)=>{switch(e.type.unit){case ph.SECOND:return Sp(e,t,i);case ph.MILLISECOND:return wp(e,t,i);case ph.MICROSECOND:return Cp(e,t,i);case ph.NANOSECOND:return Ep(e,t,i)}})),up.prototype.visitTimestampSecond=pp(Sp),up.prototype.visitTimestampMillisecond=pp(wp),up.prototype.visitTimestampMicrosecond=pp(Cp),up.prototype.visitTimestampNanosecond=pp(Ep),up.prototype.visitTime=pp(((e,t,i)=>{switch(e.type.unit){case ph.SECOND:return Op(e,t,i);case ph.MILLISECOND:return xp(e,t,i);case ph.MICROSECOND:return Tp(e,t,i);case ph.NANOSECOND:return kp(e,t,i)}})),up.prototype.visitTimeSecond=pp(Op),up.prototype.visitTimeMillisecond=pp(xp),up.prototype.visitTimeMicrosecond=pp(Tp),up.prototype.visitTimeNanosecond=pp(kp),up.prototype.visitDecimal=pp(((e,t,i)=>{let{values:n,stride:s}=e;n.set(i.subarray(0,s),s*t)})),up.prototype.visitList=pp(((e,t,i)=>{const n=e.children[0],s=e.valueOffsets,r=Pp.getVisitFn(n);if(Array.isArray(i))for(let o=-1,a=s[t],l=s[t+1];a{const n=e.type.children.map((e=>Pp.getVisitFn(e.type))),s=i instanceof Map?((e,t)=>(i,n,s,r)=>n&&i(n,e,t.get(s.name)))(t,i):i instanceof Xm?((e,t)=>(i,n,s,r)=>n&&i(n,e,t.get(r)))(t,i):Array.isArray(i)?((e,t)=>(i,n,s,r)=>n&&i(n,e,t[r]))(t,i):((e,t)=>(i,n,s,r)=>n&&i(n,e,t[s.name]))(t,i);e.type.children.forEach(((t,i)=>s(n[i],e.children[i],t,i)))})),up.prototype.visitUnion=pp(((e,t,i)=>{e.type.mode===ch.Dense?Ip(e,t,i):Rp(e,t,i)})),up.prototype.visitDenseUnion=pp(Ip),up.prototype.visitSparseUnion=pp(Rp),up.prototype.visitDictionary=pp(((e,t,i)=>{var n;null===(n=e.dictionary)||void 0===n||n.set(e.values[t],i)})),up.prototype.visitInterval=pp(((e,t,i)=>{e.type.unit===mh.DAY_TIME?Ap(e,t,i):Dp(e,t,i)})),up.prototype.visitIntervalDayTime=pp(Ap),up.prototype.visitIntervalYearMonth=pp(Dp),up.prototype.visitFixedSizeList=pp(((e,t,i)=>{const{stride:n}=e,s=e.children[0],r=Pp.getVisitFn(s);if(Array.isArray(i))for(let o=-1,a=t*n;++o{const n=e.children[0],{valueOffsets:s}=e,r=Pp.getVisitFn(n);let{[t]:o,[t+1]:a}=s;const l=i instanceof Map?i.entries():Object.entries(i);for(const d of l)if(r(n,o,d),++o>=a)break}));const Pp=new up,Fp=Symbol.for("parent"),Mp=Symbol.for("rowIndex");class Lp{constructor(e,t){return this[Fp]=e,this[Mp]=t,new Proxy(this,new Bp)}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[Mp],t=this[Fp],i=t.type.children,n={};for(let s=-1,r=i.length;++s{let[t,i]=e;return`${zh(t)}: ${zh(i)}`})).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Np(this[Fp],this[Mp])}}class Np{constructor(e,t){this.childIndex=0,this.children=e.children,this.rowIndex=t,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const e=this.childIndex;return ee.name))}has(e,t){return-1!==e[Fp].type.children.findIndex((e=>e.name===t))}getOwnPropertyDescriptor(e,t){if(-1!==e[Fp].type.children.findIndex((e=>e.name===t)))return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];const i=e[Fp].type.children.findIndex((e=>e.name===t));if(-1!==i){const n=om.visit(e[Fp].children[i],e[Mp]);return Reflect.set(e,t,n),n}}set(e,t,i){const n=e[Fp].type.children.findIndex((e=>e.name===t));return-1!==n?(Pp.visit(e[Fp].children[n],e[Mp],i),Reflect.set(e,t,i)):!(!Reflect.has(e,t)&&"symbol"!==typeof t)&&Reflect.set(e,t,i)}}class Hp extends op{}function zp(e){return(t,i)=>t.getValid(i)?e(t,i):null}const $p=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),Up=e=>new Date(e),Vp=(e,t,i)=>{if(i+1>=t.length)return null;const n=t[i],s=t[i+1];return e.subarray(n,s)},Wp=(e,t)=>{let{values:i}=e;return((e,t)=>Up(((e,t)=>864e5*e[t])(e,t)))(i,t)},jp=(e,t)=>{let{values:i}=e;return((e,t)=>Up($p(e,t)))(i,2*t)},Gp=(e,t)=>{let{stride:i,values:n}=e;return n[i*t]},Yp=(e,t)=>{let{values:i}=e;return i[t]},Kp=(e,t)=>{let{values:i}=e;return 1e3*$p(i,2*t)},qp=(e,t)=>{let{values:i}=e;return $p(i,2*t)},Xp=(e,t)=>{let{values:i}=e;return((e,t)=>e[t+1]/1e3*4294967296+(e[t]>>>0)/1e3)(i,2*t)},Qp=(e,t)=>{let{values:i}=e;return((e,t)=>e[t+1]/1e6*4294967296+(e[t]>>>0)/1e6)(i,2*t)},Zp=(e,t)=>{let{values:i}=e;return i[t]},Jp=(e,t)=>{let{values:i}=e;return i[t]},em=(e,t)=>{let{values:i}=e;return i[t]},tm=(e,t)=>{let{values:i}=e;return i[t]},im=(e,t)=>{const i=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[i];return om.visit(n,e.valueOffsets[t])},nm=(e,t)=>{const i=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[i];return om.visit(n,t)},sm=(e,t)=>{let{values:i}=e;return i.subarray(2*t,2*(t+1))},rm=(e,t)=>{let{values:i}=e;const n=i[t],s=new Int32Array(2);return s[0]=Math.trunc(n/12),s[1]=Math.trunc(n%12),s};Hp.prototype.visitNull=zp(((e,t)=>null)),Hp.prototype.visitBool=zp(((e,t)=>{let{offset:i,values:n}=e;const s=i+t;return 0!==(n[s>>3]&1<{let{values:i}=e;return i[t]})),Hp.prototype.visitInt8=zp(Gp),Hp.prototype.visitInt16=zp(Gp),Hp.prototype.visitInt32=zp(Gp),Hp.prototype.visitInt64=zp(Yp),Hp.prototype.visitUint8=zp(Gp),Hp.prototype.visitUint16=zp(Gp),Hp.prototype.visitUint32=zp(Gp),Hp.prototype.visitUint64=zp(Yp),Hp.prototype.visitFloat=zp(((e,t)=>{let{type:i,values:n}=e;return i.precision!==hh.HALF?n[t]:hp(n[t])})),Hp.prototype.visitFloat16=zp(((e,t)=>{let{stride:i,values:n}=e;return hp(n[i*t])})),Hp.prototype.visitFloat32=zp(Gp),Hp.prototype.visitFloat64=zp(Gp),Hp.prototype.visitUtf8=zp(((e,t)=>{let{values:i,valueOffsets:n}=e;const s=Vp(i,n,t);return null!==s?Kh(s):null})),Hp.prototype.visitBinary=zp(((e,t)=>{let{values:i,valueOffsets:n}=e;return Vp(i,n,t)})),Hp.prototype.visitFixedSizeBinary=zp(((e,t)=>{let{stride:i,values:n}=e;return n.subarray(i*t,i*(t+1))})),Hp.prototype.visitDate=zp(((e,t)=>e.type.unit===uh.DAY?Wp(e,t):jp(e,t))),Hp.prototype.visitDateDay=zp(Wp),Hp.prototype.visitDateMillisecond=zp(jp),Hp.prototype.visitTimestamp=zp(((e,t)=>{switch(e.type.unit){case ph.SECOND:return Kp(e,t);case ph.MILLISECOND:return qp(e,t);case ph.MICROSECOND:return Xp(e,t);case ph.NANOSECOND:return Qp(e,t)}})),Hp.prototype.visitTimestampSecond=zp(Kp),Hp.prototype.visitTimestampMillisecond=zp(qp),Hp.prototype.visitTimestampMicrosecond=zp(Xp),Hp.prototype.visitTimestampNanosecond=zp(Qp),Hp.prototype.visitTime=zp(((e,t)=>{switch(e.type.unit){case ph.SECOND:return Zp(e,t);case ph.MILLISECOND:return Jp(e,t);case ph.MICROSECOND:return em(e,t);case ph.NANOSECOND:return tm(e,t)}})),Hp.prototype.visitTimeSecond=zp(Zp),Hp.prototype.visitTimeMillisecond=zp(Jp),Hp.prototype.visitTimeMicrosecond=zp(em),Hp.prototype.visitTimeNanosecond=zp(tm),Hp.prototype.visitDecimal=zp(((e,t)=>{let{values:i,stride:n}=e;return fu.decimal(i.subarray(n*t,n*(t+1)))})),Hp.prototype.visitList=zp(((e,t)=>{const{valueOffsets:i,stride:n,children:s}=e,{[t*n]:r,[t*n+1]:o}=i,a=s[0].slice(r,o-r);return new Xm([a])})),Hp.prototype.visitStruct=zp(((e,t)=>new Lp(e,t))),Hp.prototype.visitUnion=zp(((e,t)=>e.type.mode===ch.Dense?im(e,t):nm(e,t))),Hp.prototype.visitDenseUnion=zp(im),Hp.prototype.visitSparseUnion=zp(nm),Hp.prototype.visitDictionary=zp(((e,t)=>{var i;return null===(i=e.dictionary)||void 0===i?void 0:i.get(e.values[t])})),Hp.prototype.visitInterval=zp(((e,t)=>e.type.unit===mh.DAY_TIME?sm(e,t):rm(e,t))),Hp.prototype.visitIntervalDayTime=zp(sm),Hp.prototype.visitIntervalYearMonth=zp(rm),Hp.prototype.visitFixedSizeList=zp(((e,t)=>{const{stride:i,children:n}=e,s=n[0].slice(t*i,i);return new Xm([s])})),Hp.prototype.visitMap=zp(((e,t)=>{const{valueOffsets:i,children:n}=e,{[t]:s,[t+1]:r}=i,o=n[0];return new dm(o.slice(s,r-s))}));const om=new Hp,am=Symbol.for("keys"),lm=Symbol.for("vals");class dm{constructor(e){return this[am]=new Xm([e.children[0]]).memoize(),this[lm]=e.children[1],new Proxy(this,new hm)}[Symbol.iterator](){return new cm(this[am],this[lm])}get size(){return this[am].length}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[am],t=this[lm],i={};for(let n=-1,s=e.length;++n{let[t,i]=e;return`${zh(t)}: ${zh(i)}`})).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class cm{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){const e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),om.visit(this.vals,e)]})}}class hm{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[am].toArray().map(String)}has(e,t){return e[am].includes(t)}getOwnPropertyDescriptor(e,t){if(-1!==e[am].indexOf(t))return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];const i=e[am].indexOf(t);if(-1!==i){const n=om.visit(Reflect.get(e,lm),i);return Reflect.set(e,t,n),n}}set(e,t,i){const n=e[am].indexOf(t);return-1!==n?(Pp.visit(Reflect.get(e,lm),n,i),Reflect.set(e,t,i)):!!Reflect.has(e,t)&&Reflect.set(e,t,i)}}let um;function pm(e,t,i,n){const{length:s=0}=e;let r="number"!==typeof t?0:t,o="number"!==typeof i?s:i;return r<0&&(r=(r%s+s)%s),o<0&&(o=(o%s+s)%s),os&&(o=s),n?n(e,r,o):[r,o]}Object.defineProperties(dm.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[am]:{writable:!0,enumerable:!1,configurable:!1,value:null},[lm]:{writable:!0,enumerable:!1,configurable:!1,value:null}});const mm=e=>e!==e;function gm(e){if("object"!==typeof e||null===e)return mm(e)?mm:t=>t===e;if(e instanceof Date){const t=e.valueOf();return e=>e instanceof Date&&e.valueOf()===t}return ArrayBuffer.isView(e)?t=>!!t&&function(e,t){let i=0;const n=e.length;if(n!==t.length)return!1;if(n>0)do{if(e[i]!==t[i])return!1}while(++i1&&void 0!==arguments[1]&&arguments[1];const i=Object.keys(e);if(!t&&0===i.length)return()=>!1;const n=[];for(let s=-1,r=i.length;++s{if(!i||"object"!==typeof i)return!1;switch(i.constructor){case Array:return function(e,t){const i=e.length;if(t.length!==i)return!1;for(let n=-1;++n0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndexe+t.nullCount),0)}function _m(e){return e.reduce(((e,t,i)=>(e[i+1]=e[i]+t.length,e)),new Uint32Array(e.length+1))}function Sm(e,t,i,n){const s=[];for(let r=-1,o=e.length;++r=n)break;if(i>=a+l)continue;if(a>=i&&a+l<=n){s.push(o);continue}const d=Math.max(0,i-a),c=Math.min(n-a,l);s.push(o.slice(d,c-d))}return 0===s.length&&s.push(e[0].slice(0,0)),s}function wm(e,t,i,n){let s=0,r=0,o=t.length-1;do{if(s>=o-1)return i>n}function Im(e,t,i){const n=i.byteLength+7&-8;if(e>0||i.byteLength>3):Rm(new Am(i,e,t,null,Tm)).subarray(0,n)),s}return i}function Rm(e){const t=[];let i=0,n=0,s=0;for(const o of e)o&&(s|=1<0)&&(t[i++]=s);const r=new Uint8Array(t.length+7&-8);return r.set(t),r}class Am{constructor(e,t,i,n,s){this.bytes=e,this.length=i,this.context=n,this.get=s,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index>3<<3,s=t+(t%8===0?0:8-t%8);return Dm(e,t,s)+Dm(e,n,i)+function(e,t,i){let n=0,s=Math.trunc(t);const r=new DataView(e.buffer,e.byteOffset,e.byteLength),o=void 0===i?e.byteLength:s+i;for(;o-s>=4;)n+=Pm(r.getUint32(s)),s+=4;for(;o-s>=2;)n+=Pm(r.getUint16(s)),s+=2;for(;o-s>=1;)n+=Pm(r.getUint8(s)),s+=1;return n}(e,s>>3,n-s>>3)}function Pm(e){let t=Math.trunc(e);return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24}class Fm extends op{}function Mm(e,t,i){if(void 0===t)return-1;if(null===t)return function(e,t){const{nullBitmap:i}=e;if(!i||e.nullCount<=0)return-1;let n=0;for(const s of new Am(i,e.offset+(t||0),e.length,i,Tm)){if(!s)return n;++n}return-1}(e,i);const n=om.getVisitFn(e),s=gm(t);for(let r=(i||0)-1,o=e.length;++r0?0:-1},Fm.prototype.visitBool=Mm,Fm.prototype.visitInt=Mm,Fm.prototype.visitInt8=Mm,Fm.prototype.visitInt16=Mm,Fm.prototype.visitInt32=Mm,Fm.prototype.visitInt64=Mm,Fm.prototype.visitUint8=Mm,Fm.prototype.visitUint16=Mm,Fm.prototype.visitUint32=Mm,Fm.prototype.visitUint64=Mm,Fm.prototype.visitFloat=Mm,Fm.prototype.visitFloat16=Mm,Fm.prototype.visitFloat32=Mm,Fm.prototype.visitFloat64=Mm,Fm.prototype.visitUtf8=Mm,Fm.prototype.visitBinary=Mm,Fm.prototype.visitFixedSizeBinary=Mm,Fm.prototype.visitDate=Mm,Fm.prototype.visitDateDay=Mm,Fm.prototype.visitDateMillisecond=Mm,Fm.prototype.visitTimestamp=Mm,Fm.prototype.visitTimestampSecond=Mm,Fm.prototype.visitTimestampMillisecond=Mm,Fm.prototype.visitTimestampMicrosecond=Mm,Fm.prototype.visitTimestampNanosecond=Mm,Fm.prototype.visitTime=Mm,Fm.prototype.visitTimeSecond=Mm,Fm.prototype.visitTimeMillisecond=Mm,Fm.prototype.visitTimeMicrosecond=Mm,Fm.prototype.visitTimeNanosecond=Mm,Fm.prototype.visitDecimal=Mm,Fm.prototype.visitList=Mm,Fm.prototype.visitStruct=Mm,Fm.prototype.visitUnion=Mm,Fm.prototype.visitDenseUnion=Lm,Fm.prototype.visitSparseUnion=Lm,Fm.prototype.visitDictionary=Mm,Fm.prototype.visitInterval=Mm,Fm.prototype.visitIntervalDayTime=Mm,Fm.prototype.visitIntervalYearMonth=Mm,Fm.prototype.visitFixedSizeList=Mm,Fm.prototype.visitMap=Mm;const Nm=new Fm;class Bm extends op{}function Hm(e){const{type:t}=e;if(0===e.nullCount&&1===e.stride&&(t.typeId===fh.Timestamp||t instanceof Hu&&64!==t.bitWidth||t instanceof Yu&&64!==t.bitWidth||t instanceof $u&&t.precision!==hh.HALF))return new bm(e.data.length,(t=>{const i=e.data[t];return i.values.subarray(0,i.length)[Symbol.iterator]()}));let i=0;return new bm(e.data.length,(t=>{const n=e.data[t].length,s=e.slice(i,i+n);return i+=n,new zm(s)}))}class zm{constructor(e){this.vector=e,this.index=0}next(){return this.indexe+t;class Vm extends op{visitNull(e,t){return 0}visitInt(e,t){return e.type.bitWidth/8}visitFloat(e,t){return e.type.ArrayType.BYTES_PER_ELEMENT}visitBool(e,t){return 1/8}visitDecimal(e,t){return e.type.bitWidth/8}visitDate(e,t){return 4*(e.type.unit+1)}visitTime(e,t){return e.type.bitWidth/8}visitTimestamp(e,t){return e.type.unit===ph.SECOND?4:8}visitInterval(e,t){return 4*(e.type.unit+1)}visitStruct(e,t){return e.children.reduce(((e,i)=>e+Gm.visit(i,t)),0)}visitFixedSizeBinary(e,t){return e.type.byteWidth}visitMap(e,t){return 8+e.children.reduce(((e,i)=>e+Gm.visit(i,t)),0)}visitDictionary(e,t){var i;return e.type.indices.bitWidth/8+((null===(i=e.dictionary)||void 0===i?void 0:i.getByteLength(e.values[t]))||0)}}const Wm=(e,t)=>{let{type:i,children:n,typeIds:s,valueOffsets:r}=e;const o=i.typeIdToChildIndex[s[t]];return 8+Gm.visit(n[o],r[t])},jm=(e,t)=>{let{children:i}=e;return 4+Gm.visitMany(i,i.map((()=>t))).reduce(Um,0)};Vm.prototype.visitUtf8=(e,t)=>{let{valueOffsets:i}=e;return i[t+1]-i[t]+8},Vm.prototype.visitBinary=(e,t)=>{let{valueOffsets:i}=e;return i[t+1]-i[t]+8},Vm.prototype.visitList=(e,t)=>{let{valueOffsets:i,stride:n,children:s}=e;const r=s[0],{[t*n]:o}=i,{[t*n+1]:a}=i,l=Gm.getVisitFn(r.type),d=r.slice(o,a-o);let c=8;for(let h=-1,u=a-o;++h