@slickgrid-universal/vanilla-force-bundle 5.3.1 → 5.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
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=(s=this.gridOptions)!=null&&s.gridHeight||(n=this.gridOptions)!=null&&n.gridWidth?{height:(o=this.gridOptions)==null?void 0:o.gridHeight,width:(l=this.gridOptions)==null?void 0:l.gridWidth}:void 0;this._autoResizeOptions=((a=this.gridOptions)==null?void 0:a.autoResize)??{container:"grid1",bottomPadding:0},i!=null&&i.width&&(t!=null&&t.style)&&(t.style.width=typeof i.width=="string"?i.width:`${i.width}px`),this._gridDomElm=e.getContainerNode(),typeof this._autoResizeOptions.container=="string"?this._pageContainerElm=typeof this._autoResizeOptions.container=="string"?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.bindAutoResizeDataGrid(),this.gridOptions.autoResize&&this._subscriptions.push(this.pubSubService.subscribe("onFullResizeByContentRequested",()=>this.resizeColumnsByCellContent(!0))),this.gridOptions.enableColumnResizeOnDoubleClick&&(this._subscriptions.push(this.pubSubService.subscribe("onHeaderMenuColumnResizeByContent",h=>{this.handleSingleColumnResizeByContent(h.columnId)})),this._eventHandler.subscribe(this._grid.onColumnsResizeDblClick,(h,d)=>{this.handleSingleColumnResizeByContent(d.triggeredByColumn)}))}bindAutoResizeDataGrid(e){var t;if(((t=this.gridOptions.autoResize)==null?void 0:t.resizeDetection)==="container"){if(!this._pageContainerElm||!this._pageContainerElm)throw new Error(`
|
|
15
15
|
[Slickgrid-Universal] Resizer Service requires a container when gridOption.autoResize.resizeDetection="container"
|
|
16
16
|
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(this._gridDomElm===void 0||me(this._gridDomElm)===void 0)return null;this.resizeGrid().then(()=>this.resizeGridWhenStylingIsBrokenUntilCorrected()).catch(i=>console.log("Error:",i)),this.resizeGrid(10,e),this._bindingEventService.bind(window,"resize",this.handleResizeGrid.bind(this,e))}}handleResizeGrid(e){this.pubSubService.publish("onGridBeforeResize"),this._resizePaused||(this.resizeGrid(0,e),this.resizeGrid(0,e))}resizeObserverCallback(){this._resizePaused||this.resizeGrid()}calculateGridNewDimensions(e){var f,g;const t=(e==null?void 0:e.autoResize)??{},i=me(this._gridDomElm);if(!window||i===void 0)return null;let s=(t==null?void 0:t.bottomPadding)!==void 0?t.bottomPadding:bu;if(s&&e.enablePagination&&(s+=yu),s&&e.showCustomFooter){const _=((g=(f=this.gridOptions)==null?void 0:f.customFooterOptions)==null?void 0:g.footerHeight)??Su;s+=parseInt(`${_}`,10)}let n=0,o=0;t.calculateAvailableSizeBy==="container"?n=ds(this._pageContainerElm,"height")||0:(n=window.innerHeight||0,o=(i==null?void 0:i.top)??0);const l=n-o-s,a=ds(this._pageContainerElm,"width")||window.innerWidth||0,h=t==null?void 0:t.maxHeight,d=(t==null?void 0:t.minHeight)??Eu,c=t==null?void 0:t.maxWidth,u=(t==null?void 0:t.minWidth)??wu;let p=l,m=t!=null&&t.rightPadding?a-t.rightPadding:a;return p<d&&(p=d),h&&p>h&&(p=h),m<u&&(m=u),c&&m>c&&(m=c),{height:this._fixedHeight||p,width:this._fixedWidth||m}}getLastResizeDimensions(){return this._lastDimensions}pauseResizer(e){this._resizePaused=e}resizeGrid(e,t){return new Promise(i=>{e=e||0,e>0?(clearTimeout(this._timer),this._timer=setTimeout(()=>i(this.resizeGridCallback(t)),e)):i(this.resizeGridCallback(t))})}resizeGridCallback(e){var i,s;const t=this.resizeGridWithDimensions(e);return this.pubSubService.publish("onGridAfterResize",t),this.gridOptions.enableAutoResizeColumnsByCellContent&&(!((i=this._lastDimensions)!=null&&i.width)||(t==null?void 0:t.width)!==((s=this._lastDimensions)==null?void 0:s.width))&&this.resizeColumnsByCellContent(!1),this._lastDimensions=t,t}resizeGridWithDimensions(e){var i,s,n,o;const t=this.calculateGridNewDimensions(this.gridOptions);if((e||t)&&this._gridDomElm){const l=e!=null&&e.height?e.height:t==null?void 0:t.height,a=e!=null&&e.width?e.width:t==null?void 0:t.width;this.gridOptions.autoHeight||(this._gridDomElm.style.height=`${l}px`),this._gridDomElm.style.width=`${a}px`,this._gridContainerElm&&(this._gridContainerElm.style.width=`${a}px`),(i=this._grid)!=null&&i.resizeCanvas&&this._gridContainerElm&&this._grid.resizeCanvas(),this._grid&&((s=this.gridOptions)!=null&&s.enableAutoSizeColumns)?this.gridUid&&document.querySelector(this.gridUidSelector)&&(!this._lastDimensions||this._lastDimensions.height!==l||this._lastDimensions.width!==a)&&this._grid.autosizeColumns():this.gridOptions.enableAutoResizeColumnsByCellContent&&(!((n=this._lastDimensions)!=null&&n.width)||a!==((o=this._lastDimensions)==null?void 0:o.width))&&this.resizeColumnsByCellContent(!1),this._lastDimensions={height:l||0,width:a||0}}return this._lastDimensions}requestStopOfAutoFixResizeGrid(e=!0){this._isStopResizeIntervalRequested=e}resizeColumnsByCellContent(e=!1){var h,d;const t=this._grid.getColumns(),i=this.dataView.getItems(),s={};let n=!1,o=0;const l=((h=this._gridContainerElm)==null?void 0:h.offsetWidth)??0;if(!Array.isArray(i)||i.length===0||!e&&this._totalColumnsWidthByContent>0&&this._totalColumnsWidthByContent<l){this._grid.autosizeColumns();return}if(this._hasResizedByContentAtLeastOnce&&((d=this.gridOptions)!=null&&d.resizeByContentOnlyOnFirstLoad)&&!e)return;if(this.pubSubService.publish("onBeforeResizeByContent",void 0,0),this._totalColumnsWidthByContent===0||e){for(const u of t)s[u.id]=u.originalWidth??u.minWidth??0;o=this.calculateCellWidthByReadingDataset(t,s,this.resizeByContentOptions.maxItemToInspectCellContentWidth);let c=0;for(const u of t){const p=u.resizeAlwaysRecalculateWidth??this.resizeByContentOptions.alwaysRecalculateColumnWidth??!1;u.originalWidth&&!p?u.width=u.originalWidth:s[u.id]!==void 0&&(u.rerenderOnResize&&(n=!0),this.applyNewCalculatedColumnWidthByReference(u,s[u.id])),c+=u.width||0,this._totalColumnsWidthByContent=c}}this._grid.setColumns(t),this._hasResizedByContentAtLeastOnce=!0;const a={};for(const c of t)a[c.id]=c.width;this._totalColumnsWidthByContent>l?this._grid.reRenderColumns(n):this._grid.autosizeColumns(),this.pubSubService.publish("onAfterResizeByContent",{readItemCount:o,calculateColumnWidths:a})}calculateCellWidthByReadingDataset(e,t,i=1e3,s){const n=Array.isArray(e)?e:[e],o=this.dataView.getItems();let l=0;for(const[a,h]of o.entries()){if(a>i)break;Array.isArray(n)&&typeof t=="object"&&n.forEach((d,c)=>{const u=this.calculateCellWidthByContent(h,d,a,s??c,t[d.id]);u!==void 0&&(t[d.id]=u)}),l=a+1}return l}calculateCellWidthByContent(e,t,i,s,n){const o=this.resizeByContentOptions.cellCharWidthInPx??7;if(!t.originalWidth){const l=(t==null?void 0:t.resizeCharWidthInPx)??o,a=zs(t==null?void 0:t.formatter,i,s,t,e,this._grid),h=Zt(a)?we(a):"",d=Math.ceil(h.length*l),c=t.resizeMaxWidthThreshold;t&&(n===void 0||d>n)&&(n=c!==void 0&&d>c?c:t.maxWidth!==void 0&&d>t.maxWidth?t.maxWidth:d)}return n}applyNewCalculatedColumnWidthByReference(e,t){var a;const i=this.resizeByContentOptions.cellPaddingWidthInPx??6,s=this.resizeByContentOptions.formatterPaddingWidthInPx??6,n=((a=e==null?void 0:e.filter)==null?void 0:a.type)??(e==null?void 0:e.type)??S.string;let o=t;const l=(e==null?void 0:e.resizeCalcWidthRatio)??this.resizeByContentOptions.defaultRatioForStringType??.9;o*=n==="string"?l:1,o+=i,e.resizeExtraWidthPadding&&(o+=e.resizeExtraWidthPadding),e.editor&&this.gridOptions.editable&&(o+=s),e.maxWidth!==void 0&&o>e.maxWidth&&(o=e.maxWidth),e.resizeMaxWidthThreshold!==void 0&&o>e.resizeMaxWidthThreshold&&(o=e.resizeMaxWidthThreshold),o=Math.ceil(o),(e.originalWidth===void 0||e.resizeAlwaysRecalculateWidth===!0||this.resizeByContentOptions.alwaysRecalculateColumnWidth===!0)&&(e.width=this.readjustNewColumnWidthWhenOverLimit(e,o))}handleSingleColumnResizeByContent(e){const t=this._grid.getColumns(),i=t.findIndex(s=>s.id===e);if(i>=0){const s=t[i],n={[e]:s.originalWidth??s.minWidth??0};s.originalWidth=void 0,this.calculateCellWidthByReadingDataset(s,n,this.resizeByContentOptions.maxItemToInspectSingleColumnWidthByContent,i),this.applyNewCalculatedColumnWidthByReference(s,n[e]),this._grid.reRenderColumns((s==null?void 0:s.rerenderOnResize)??!1)}}readjustNewColumnWidthWhenOverLimit(e,t){var o,l;const i=this.gridOptions.frozenColumn??-1,s=this._grid.getColumns().findIndex(a=>a.id===e.id)??0;let n=t;if(i>=0&&s<=i){const a=Array.from(this._grid.getViewports());if(a){const h=((o=a.find(m=>m.classList.contains("slick-viewport-left")))==null?void 0:o.clientWidth)??0,d=((l=a.find(m=>m.classList.contains("slick-viewport-right")))==null?void 0:l.clientWidth)??0,c=h+d,u=h-(e.width??0);if(u+t>c){const m=this.resizeByContentOptions.widthToRemoveFromExceededWidthReadjustment??50;n=h-u+d-m}}}return Math.ceil(n)}checkIsGridShown(){var e;return!!(((e=document.querySelector(`${this.gridUidSelector}`))==null?void 0:e.offsetParent)??!1)}resizeGridWhenStylingIsBrokenUntilCorrected(){var l,a;const e=((l=this.gridOptions)==null?void 0:l.autoFixResizeTimeout)??18e3,t=((a=this.gridOptions)==null?void 0:a.autoFixResizeRequiredGoodCount)??5,i=this._gridContainerElm.querySelector(`${this.gridUidSelector} .slick-header`),s=this._gridContainerElm.querySelector(`${this.gridUidSelector} .slick-viewport`);let n=0,o=0;if(i&&s&&this.gridOptions.autoFixResizeWhenBrokenStyleDetected){const h=this.dataView.getItemCount(),d=this._grid.getColumns()||[];this._intervalId=setInterval(async()=>{var C,E,y;const u=me(i);let p=(u==null?void 0:u.top)??0;(C=this.gridOptions)!=null&&C.enableFiltering&&this.gridOptions.headerRowHeight&&(p+=this.gridOptions.headerRowHeight),(E=this.gridOptions)!=null&&E.createPreHeaderPanel&&this.gridOptions.showPreHeaderPanel&&this.gridOptions.preHeaderPanelHeight&&(p+=this.gridOptions.preHeaderPanelHeight),p+=44;const m=me(s),f=(m==null?void 0:m.top)??0,g=me(this._gridContainerElm);let _=(u==null?void 0:u.top)===0||p-f>2||(g==null?void 0:g.left)===0&&(g==null?void 0:g.top)===0;const b=((y=this._grid.getRenderedRange())==null?void 0:y.rightPx)??0;!_&&h>0&&b===0&&d.length>1&&(_=!0),this._isStopResizeIntervalRequested&&(_=!1,n=e),this.checkIsGridShown()&&(_||(g==null?void 0:g.left)===0||(g==null?void 0:g.top)===0)&&(await this.resizeGrid(),o<5&&this._grid.updateColumns(),this.checkIsGridShown()&&(_=!1)),this.checkIsGridShown()&&o++,this.checkIsGridShown()&&!_&&(o>=t||n++>=e)&&clearInterval(this._intervalId)},this.intervalRetryDelay)}}}class xu{constructor(){this._hasColumnsReordered=!1,this._hideHeaderRowAfterPageLoad=!1}get allColumns(){return this._allColumns}set allColumns(e){this._allColumns=e}get columnDefinitions(){var e;return((e=this._grid)==null?void 0:e.getColumns())??[]}get currentPagination(){return this._currentPagination}set currentPagination(e){this._currentPagination=e}get dataView(){return this._dataView}set dataView(e){this._dataView=e}get frozenVisibleColumnId(){return this._frozenVisibleColumnId}set frozenVisibleColumnId(e){this._frozenVisibleColumnId=e}get hasColumnsReordered(){return this._hasColumnsReordered}set hasColumnsReordered(e){this._hasColumnsReordered=e}get slickGrid(){return this._grid}set slickGrid(e){this._grid=e}get gridContainerElement(){return this._gridContainerElm}set gridContainerElement(e){this._gridContainerElm=e}get gridOptions(){var e;return this._gridOptions||((e=this._grid)==null?void 0:e.getOptions())||{}}set gridOptions(e){this._gridOptions=e}get groupItemMetadataProvider(){return this._groupItemMetadataProvider}set groupItemMetadataProvider(e){this._groupItemMetadataProvider=e}get hideHeaderRowAfterPageLoad(){return this._hideHeaderRowAfterPageLoad}set hideHeaderRowAfterPageLoad(e){this._hideHeaderRowAfterPageLoad=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 Iu{constructor(e,t,i,s){this.sharedService=e,this.pubSubService=t,this.backendUtilities=i,this.rxjs=s,this._currentLocalSorters=[],this._isBackendGrid=!1,this._eventHandler=new pe,this.rxjs&&(this.httpCancelRequests$=this.rxjs.createSubject())}get eventHandler(){return this._eventHandler}get _gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())??{}}get _columnDefinitions(){var e;return((e=this._grid)==null?void 0:e.getColumns())??[]}dispose(){var e,t;(e=this._eventHandler)!=null&&e.unsubscribeAll&&this._eventHandler.unsubscribeAll(),this.httpCancelRequests$&&((t=this.rxjs)!=null&&t.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==null?void 0:e.getData(),this._eventHandler.subscribe(e.onSort,this.onBackendSortChanged.bind(this))}bindLocalOnSort(e){this._isBackendGrid=!1,this._grid=e,this._dataView=e==null?void 0:e.getData(),this.processTreeDataInitialSort(),this._eventHandler.subscribe(e.onSort,this.handleLocalOnSort.bind(this))}handleLocalOnSort(e,t){var s;const i=t.multiColumnSort?t.sortCols:new Array({columnId:((s=t.sortCol)==null?void 0:s.id)??"",sortAsc:t.sortAsc,sortCol:t.sortCol});this._currentLocalSorters=[],Array.isArray(i)&&i.forEach(n=>{n.sortCol&&this._currentLocalSorters.push({columnId:n.sortCol.id,direction:n.sortAsc?dt.ASC:dt.DESC})}),this.onLocalSortChanged(this._grid,i),this.emitSortChanged(oe.local)}clearSortByColumnId(e,t){var n;const i=this.getCurrentColumnSorts(),s=this.getCurrentColumnSorts(`${t}`);if(Array.isArray(i)&&Array.isArray(s)&&i.length!==s.length){if(this._gridOptions.backendServiceApi)this.onBackendSortChanged(e,{multiColumnSort:!0,sortCols:s,grid:this._grid});else if(this._dataView)this.onLocalSortChanged(this._grid,s,!0,!0);else{const a=((n=this._gridOptions)==null?void 0:n.multiColumnSort)??!1?s:s[0];this._grid.onSort.notify(a)}const o=s.map(l=>{var a;return{columnId:((a=l==null?void 0:l.sortCol)==null?void 0:a.id)??"",sortAsc:l==null?void 0:l.sortAsc,sortCol:l==null?void 0:l.sortCol}});this._grid.setSortColumns(o)}Array.isArray(s)&&s.length===0&&this.sortLocalGridByDefaultSortFieldId()}clearSorting(e=!0){var t,i;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 s=(i=(t=this._gridOptions)==null?void 0:t.backendServiceApi)==null?void 0:i.service;s!=null&&s.clearSorters&&s.clearSorters()}}this._currentLocalSorters=[],this.pubSubService.publish("onSortCleared",!0)}disableSortFunctionality(e=!0,t=!0){const s=!this._gridOptions.enableSorting;this._gridOptions.enableSorting=s;let n;e?(t&&this.clearSorting(),this._eventHandler.unsubscribeAll(),n=this.disableAllSortingCommands(!0)):(n=this.disableAllSortingCommands(!1),this._eventHandler.subscribe(this._grid.onSort,(o,l)=>this.handleLocalOnSort(o,l))),this._grid.setOptions({enableSorting:this._gridOptions.enableSorting},!1,!0),this.sharedService.gridOptions=this._gridOptions,this._grid.setColumns(n)}toggleSortFunctionality(e=!0){const t=this._gridOptions.enableSorting;this.disableSortFunctionality(t,e)}emitSortChanged(e,t){var i;if(e===oe.remote&&((i=this._gridOptions)!=null&&i.backendServiceApi)){let s=[];const n=this._gridOptions.backendServiceApi.service;n!=null&&n.getCurrentSorters&&(s=n.getCurrentSorters()),this.pubSubService.publish("onSortChanged",s)}else e===oe.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((s,n)=>(n&&(!e||n.columnId!==e)&&s.push({columnId:n.columnId||"",sortCol:this._columnDefinitions[this._grid.getColumnIndex(n.columnId||"")],sortAsc:n.sortAsc}),s),[])}return[]}loadGridSorters(e){this._currentLocalSorters=[];const t=[];return Array.isArray(e)&&((this._gridOptions.multiColumnSort?e:e.slice(0,1)).forEach(s=>{const n=this._columnDefinitions.find(o=>o.id===s.columnId);if(n){if(!n.sortable){let o="[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&&(o+=" Also note that TreeData feature requires the column holding the tree (expand/collapse icons) to be sortable."),new Error(o)}t.push({columnId:n.id,sortAsc:s.direction.toUpperCase()===dt.ASC,sortCol:n}),this._currentLocalSorters.push({columnId:String(n.id),direction:s.direction.toUpperCase()})}}),this.onLocalSortChanged(this._grid,t),this._grid.setSortColumns(t.map(s=>({columnId:s.columnId,sortAsc:s.sortAsc})))),t}processTreeDataInitialSort(){var e,t,i;if((e=this._gridOptions)!=null&&e.enableTreeData&&this._gridOptions.treeDataOptions){const s=this._gridOptions.treeDataOptions,n=this._columnDefinitions.find(o=>o.id===s.columnId);if(n){let o=dt.ASC,l={columnId:s.columnId,sortCol:n,sortAsc:!0};if((t=s==null?void 0:s.initialSort)!=null&&t.columnId){const a=s.initialSort.columnId,h=this._columnDefinitions.find(d=>d.id===a);o=(s.initialSort.direction||dt.ASC).toUpperCase(),l={columnId:a,sortCol:h,sortAsc:o===dt.ASC}}l!=null&&l.columnId&&((i=this.sharedService)!=null&&i.hierarchicalDataset)&&this.updateSorting([{columnId:l.columnId||"",direction:o}])}}}onBackendSortChanged(e,t){var a,h,d;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=((a=t.grid)==null?void 0:a.getOptions())??{},s=i.backendServiceApi;if(!s||!s.process||!s.service)throw new Error('BackendServiceApi requires at least a "process" function and a "service" defined');const n=new Date;s.preProcess&&s.preProcess();const o=s.service.processOnSortChanged(e,t),l=((h=i==null?void 0:i.pagination)==null?void 0:h.totalItems)||0;(d=this.backendUtilities)==null||d.executeBackendCallback(s,o,t,n,l,{emitActionChangedCallback:this.emitSortChanged.bind(this),errorCallback:()=>{var u,p,m;this._grid.setSortColumns(t.previousSortColumns||[]);const c=(u=t.previousSortColumns)==null?void 0:u.map(f=>({columnId:f.columnId,sortAsc:f.sortAsc,sortCol:this._columnDefinitions.find(g=>g.id===f.columnId)}));(m=(p=s==null?void 0:s.service)==null?void 0:p.updateSorters)==null||m.call(p,c||[])},httpCancelRequestSubject:this.httpCancelRequests$})}async onLocalSortChanged(e,t,i=!1,s=!1){var a,h;const n=((a=this._gridOptions)==null?void 0:a.datasetIdPropertyName)??"id",o=((h=this._gridOptions)==null?void 0:h.enableTreeData)??!1,l=e.getData();if(await this.pubSubService.publish("onBeforeSortChange",{sortColumns:t},0),e&&l){if(i&&!o&&l.reSort(),o&&this.sharedService&&Array.isArray(this.sharedService.hierarchicalDataset)){const d=this.sortHierarchicalDataset(this.sharedService.hierarchicalDataset,t);this._dataView.setItems(d.flat,n),this._dataView.onRowCountChanged.notify({previous:this._dataView.getFilteredItemCount(),current:this._dataView.getLength(),itemCount:this._dataView.getItemCount(),dataView:this._dataView,callingOnRowsChanged:!0})}else l.sort(this.sortComparers.bind(this,t));e.invalidate(),s&&this.emitSortChanged(oe.local,t.map(d=>{var c;return{columnId:((c=d.sortCol)==null?void 0:c.id)??"id",direction:d.sortAsc?dt.ASC:dt.DESC}}))}}sortHierarchicalDataset(e,t,i=!1){var a,h,d;this.sortTreeData(e,t);const s=((a=this._gridOptions)==null?void 0:a.datasetIdPropertyName)??"id",n=((h=this._gridOptions)==null?void 0:h.treeDataOptions)??{columnId:""},o={...n,identifierPropName:n.identifierPropName??s,shouldAddTreeLevelNumber:!0},l=to(e,o);if(i){this._currentLocalSorters=[],t.forEach(u=>{this._currentLocalSorters.push({columnId:u.columnId,direction:u.sortAsc?"ASC":"DESC"})});const c=(d=this._gridOptions)!=null&&d.backendServiceApi?oe.remote:oe.local;this.emitSortChanged(c)}return{hierarchical:e,flat:l}}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 s of e){const n=this.sortComparer(s,t,i);if(n!==void 0)return n}return ae.neutral}sortComparer(e,t,i,s){if(e!=null&&e.sortCol){const n=e.sortCol,o=e.sortAsc?ae.asc:ae.desc;let l=s||n.queryFieldSorter||n.queryField||n.field,a=l;const h=n.type||S.string;typeof n.queryFieldNameGetterFn=="function"&&(l=n.queryFieldNameGetterFn(t),a=n.queryFieldNameGetterFn(i));let d=t[l],c=i[a];if((l==null?void 0:l.indexOf("."))>=0&&(d=Ee(t,l)),(a==null?void 0:a.indexOf("."))>=0&&(c=Ee(i,a)),n.sortComparer){const u=n.sortComparer(d,c,o,n,this._gridOptions);if(u!==ae.neutral)return u}else{const u=mi(h,d,c,o,n,this._gridOptions);if(u!==ae.neutral)return u}}}sortTreeData(e,t){Array.isArray(t)&&t.forEach(i=>{this.sortTreeChildren(e,i,0)})}sortTreeChildren(e,t,i){var o;const s=(o=this._gridOptions)==null?void 0:o.treeDataOptions,n=(s==null?void 0:s.childrenPropName)??"children";e.sort((l,a)=>this.sortComparer(t,l,a)??ae.neutral),e.forEach(l=>{l&&l.hasOwnProperty(n)&&Array.isArray(l[n])&&(i++,this.sortTreeChildren(l[n],t,i),i--)})}updateSorting(e,t=!0,i=!0){var s,n;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 o=(s=this._gridOptions)==null?void 0:s.backendServiceApi;if(o){const l=o==null?void 0:o.service;l!=null&&l.updateSorters&&(l.updateSorters(void 0,e),i&&((n=this.backendUtilities)==null||n.refreshBackendDataset(this._gridOptions)))}else this.loadGridSorters(e);if(t){const l=o?oe.remote:oe.local;this.emitSortChanged(l)}}}disableAllSortingCommands(e=!0){var s,n;const t=this._grid.getColumns();t.forEach(o=>{var l,a;o.sortable!==void 0&&(o.sortable=!e),(l=o==null?void 0:o.header)!=null&&l.menu&&((a=o.header.menu.commandItems)==null||a.forEach(h=>{if(h&&typeof h!="string"){const d=h.command;(d==="sort-asc"||d==="sort-desc"||d==="clear-sort")&&(h.hidden=e)}}))});const i=(n=(s=this._gridOptions)==null?void 0:s.gridMenu)==null?void 0:n.commandItems;return i&&i.forEach(o=>{o&&typeof o!="string"&&o.command==="clear-sorting"&&(o.hidden=e)}),t}}class Ru{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 pe,setTimeout(()=>this._isOneCpuCyclePassed=!0)}set currentToggledItems(e){this._currentToggledItems=e}get dataset(){var e;return(e=this.dataView)==null?void 0:e.getItems()}get datasetHierarchical(){return this.sharedService.hierarchicalDataset}get dataView(){var e;return(e=this._grid)==null?void 0:e.getData()}get eventHandler(){return this._eventHandler}get gridOptions(){var e;return((e=this._grid)==null?void 0:e.getOptions())??{}}get treeDataOptions(){return this.gridOptions.treeDataOptions}dispose(){this._eventHandler.unsubscribeAll(),this.pubSubService.unsubscribeAll(this._subscriptions)}init(e){var t,i,s,n,o,l,a,h;if(this._grid=e,this._isTreeDataEnabled=((t=this.gridOptions)==null?void 0:t.enableTreeData)??!1,this._isLastFullToggleCollapsed=((i=this.treeDataOptions)==null?void 0:i.initiallyCollapsed)??!1,this._currentToggledItems=((n=(s=this.gridOptions.presets)==null?void 0:s.treeData)==null?void 0:n.toggledItems)??[],this._lastToggleStateChange={type:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",previousFullToggleType:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",toggledItems:this._currentToggledItems},this._isTreeDataEnabled){if((o=this.gridOptions)!=null&&o.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(!((l=this.gridOptions)!=null&&l.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((a=this.gridOptions)!=null&&a.backendServiceApi||(h=this.gridOptions)!=null&&h.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,()=>{var d;typeof this._treeDataRecalcHandler=="function"&&this._isOneCpuCyclePassed&&(clearTimeout(this._timer),this._timer=setTimeout(()=>{var c;return(c=this._treeDataRecalcHandler)==null?void 0:c.call(this)},((d=this.treeDataOptions)==null?void 0:d.autoRecalcTotalsDebounce)??0))})}applyToggledItemStateChanges(e,t,i=!0,s=!1){if(Array.isArray(e)){const n=this.getTreeDataOptionPropName("collapsedPropName"),o=this.getTreeDataOptionPropName("hasChildrenPropName");this.dataView.beginUpdate(!0);const a=(t??this._lastToggleStateChange.previousFullToggleType)==="full-collapse";t&&(this._lastToggleStateChange.previousFullToggleType=t),i&&(this.dataView.getItems()||[]).forEach(h=>{h[o]&&(h[n]=a)}),this.dynamicallyToggleItemState(e,s)}}dynamicallyToggleItemState(e,t=!0){Array.isArray(e)&&(this.dataView.beginUpdate(!0),e.forEach(i=>{const s=this.dataView.getItemById(i.itemId);if(this.updateToggledItem(s,i.isCollapsed),t){const n=this._currentToggledItems.findIndex(o=>o.itemId===i.itemId);n>=0?this._currentToggledItems[n].isCollapsed=i.isCollapsed:this._currentToggledItems.push({itemId:i.itemId,isCollapsed:i.isCollapsed}),this.pubSubService.publish("onTreeItemToggled",{...this._lastToggleStateChange,fromItemId:i.itemId,toggledItems:this._currentToggledItems,type:i.isCollapsed?Tt.toggleCollapse:Tt.toggleExpand})}}),this.dataView.endUpdate(),this.dataView.refresh())}getCurrentToggleState(){return this._lastToggleStateChange}getInitialSort(e,t){var o;const i=t==null?void 0:t.treeDataOptions,s=(i==null?void 0:i.initialSort)??{columnId:(i==null?void 0:i.columnId)??"",direction:"ASC"},n=e.find(l=>l.id===s.columnId);return{columnId:s.columnId,sortAsc:((o=s==null?void 0:s.direction)==null?void 0:o.toUpperCase())!=="DESC",sortCol:n}}getItemCount(e){if(e!==void 0){const t=this.getTreeDataOptionPropName("levelPropName");return this.dataView.getItems().filter(i=>i[t]===e).length}return this.dataView.getItemCount()}getToggledItems(){return this._currentToggledItems}getTreeDataOptionPropName(e){var i,s,n,o,l,a,h;let t="";switch(e){case"childrenPropName":t=((i=this.treeDataOptions)==null?void 0:i.childrenPropName)??R.treeDataProperties.CHILDREN_PROP;break;case"collapsedPropName":t=((s=this.treeDataOptions)==null?void 0:s.collapsedPropName)??R.treeDataProperties.COLLAPSED_PROP;break;case"hasChildrenPropName":t=((n=this.treeDataOptions)==null?void 0:n.hasChildrenPropName)??R.treeDataProperties.HAS_CHILDREN_PROP;break;case"identifierPropName":t=((o=this.treeDataOptions)==null?void 0:o.identifierPropName)??((l=this.gridOptions)==null?void 0:l.datasetIdPropertyName)??"id";break;case"levelPropName":t=((a=this.treeDataOptions)==null?void 0:a.levelPropName)??R.treeDataProperties.TREE_LEVEL_PROP;break;case"parentPropName":t=((h=this.treeDataOptions)==null?void 0:h.parentPropName)??R.treeDataProperties.PARENT_PROP;break}return t}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,s){var a;const n=this.convertFlatParentChildToTreeDataset(e,i),o=Array.isArray(s)&&s.length?s[0]:this.getInitialSort(t,i),l=this.sortService.sortHierarchicalDataset(n,[o],!0);return(a=this._grid)==null||a.setSortColumns([o]),l}convertFlatParentChildToTreeDataset(e,t){const i=(t==null?void 0:t.datasetIdPropertyName)??"id",s=(t==null?void 0:t.treeDataOptions)??{columnId:"id"},n={...s,identifierPropName:s.identifierPropName??i,initiallyCollapsed:this._isLastFullToggleCollapsed};return io(e,n)}enableAutoRecalcTotalsFeature(e=!0){e&&this._isTreeDataEnabled?this._treeDataRecalcHandler=this.recalculateTreeTotals.bind(this,this.gridOptions):this._treeDataRecalcHandler=null}recalculateTreeTotals(e){const t=e.treeDataOptions,i=(t==null?void 0:t.childrenPropName)??R.treeDataProperties.CHILDREN_PROP,s=(t==null?void 0:t.levelPropName)??R.treeDataProperties.TREE_LEVEL_PROP;t!=null&&t.aggregators&&(t.aggregators.forEach(n=>{Fi(this.sharedService.hierarchicalDataset||[],{childrenPropName:i,levelPropName:s,aggregator:n})}),this._grid.invalidate())}sortHierarchicalDataset(e,t){const i=t??this.getInitialSort(this.sharedService.allColumns,this.gridOptions),s=Array.isArray(i)?i:[i];return this.sortService.sortHierarchicalDataset(e,s)}async toggleTreeDataCollapse(e,t=!0){var s;if((s=this.gridOptions)!=null&&s.enableTreeData){const n=this.getTreeDataOptionPropName("hasChildrenPropName");t&&await this.pubSubService.publish("onTreeFullToggleStart",{collapsing:e}),this.dataView.beginUpdate(!0),(this.dataView.getItems()||[]).forEach(o=>{o[n]&&this.updateToggledItem(o,e)}),this.dataView.endUpdate(),this.dataView.refresh(),this._isLastFullToggleCollapsed=e}const i=e?Tt.fullCollapse:Tt.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||{},s=this.gridOptions.datasetIdPropertyName??"id",n=this.getTreeDataOptionPropName("collapsedPropName"),o=this.getTreeDataOptionPropName("childrenPropName");if(typeof(i==null?void 0:i.className)=="string"&&(i.className.indexOf("toggle")>=0||!1)){const a=this.dataView.getItem(t.row);if(a){a[n]=!a[n];const h=a[n],d=a[s],c=this._currentToggledItems.findIndex(m=>m.itemId===d);c>=0?this._currentToggledItems[c].isCollapsed=h:this._currentToggledItems.push({itemId:d,isCollapsed:h}),this.dataView.updateItem(d,a);const u=m=>m[s]===d,p=Di(this.sharedService.hierarchicalDataset||[],u,o);p&&(p[n]=h),this._grid.invalidate(),this._lastToggleStateChange={type:h?Tt.toggleCollapse:Tt.toggleExpand,previousFullToggleType:this._isLastFullToggleCollapsed?"full-collapse":"full-expand",toggledItems:this._currentToggledItems},this.pubSubService.publish("onTreeItemToggled",{...this._lastToggleStateChange,fromItemId:d})}e.stopImmediatePropagation()}}}updateToggledItem(e,t){var o;const i=((o=this.gridOptions)==null?void 0:o.datasetIdPropertyName)??"id",s=this.getTreeDataOptionPropName("childrenPropName"),n=this.getTreeDataOptionPropName("collapsedPropName");if(e){e[n]=t,this.dataView.updateItem(e[i],e);const l=h=>h[i]===e[i],a=Di(this.sharedService.hierarchicalDataset||[],l,s);a&&(a[n]=t)}}setAutoRecalcTotalsCallbackWhenFeatEnabled(e){var t,i;return e!=null&&e.enableTreeData&&((t=e==null?void 0:e.treeDataOptions)!=null&&t.autoRecalcTotalsOnFilterChange)&&((i=e==null?void 0:e.treeDataOptions)!=null&&i.aggregators)?this.recalculateTreeTotals.bind(this,e):null}}class Ut{constructor(e){this.translaterService=e,this._debounceTypingDelay=0,this._shouldTriggerQuery=!0,this._inputType="text",this.inputFilterType="single",this.searchTerms=[],this._bindEventService=new Ae}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)??{}}get defaultOperator(){return H.empty}get inputType(){return this._inputType}set inputType(e){this._inputType=e}get operator(){var e;return((e=this.columnFilter)==null?void 0:e.operator)??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}init(e){var s,n,o;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.inputFilterType==="compound"&&(this.operator=e.operator||""),this.searchTerms=(e==null?void 0:e.searchTerms)??[],this._cellContainerElm=e.filterContainerElm;const t=(s=this.gridOptions)==null?void 0:s.backendServiceApi;this._debounceTypingDelay=(t?(t==null?void 0:t.filterTypingDebounce)??((n=this.gridOptions)==null?void 0:n.defaultBackendServiceFilterTypingDebounce):(o=this.gridOptions)==null?void 0:o.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}),this.inputFilterType==="compound"&&this._selectOperatorElm&&this._bindEventService.bind(this._selectOperatorElm,"change",this.onTriggerEvent.bind(this))}clear(e=!0){this._filterInputElm&&(this._shouldTriggerQuery=e,this.searchTerms=[],this._filterInputElm.value="",this._currentValue=void 0,this.updateFilterStyle(!1),this.inputFilterType==="compound"&&this._selectOperatorElm&&(this._selectOperatorElm.selectedIndex=0),this.onTriggerEvent(void 0,!0))}destroy(){var e,t,i,s;this._bindEventService.unbindAll(),(t=(e=this._selectOperatorElm)==null?void 0:e.remove)==null||t.call(e),(s=(i=this._filterInputElm)==null?void 0:i.remove)==null||s.call(i)}getValues(){return this._filterInputElm.value}setValues(e,t,i=!1){const s=Array.isArray(e)?e:[e];let n="";for(const o of s)this.inputFilterType==="single"?n=t?this.addOptionalOperatorIntoSearchString(o,t):o:n=`${o}`,this._filterInputElm.value=`${n??""}`,this._currentValue=this._filterInputElm.value;if(this.updateFilterStyle(this.getValues()!==""),this.operator=t||this.defaultOperator,t&&this._selectOperatorElm){const o=di(this.operator);this._selectOperatorElm.value=o}i&&this.onTriggerEvent(void 0,!1)}addOptionalOperatorIntoSearchString(e,t){let i="",s="",n=e==null?"":`${e}`;if(t&&n){switch(t){case"<>":case"!=":case"=":case"==":case">":case">=":case"<":case"<=":i=t;break;case"EndsWith":case"*z":i="*";break;case"StartsWith":case"a*":s="*";break}n=`${i}${n}${s}`}return n}getCompoundOperatorOptionValues(){var s;const e=this.columnDef.type&&this.columnDef.type?this.columnDef.type:S.string;let t,i="text";if((s=this.columnFilter)!=null&&s.compoundOperatorList)t=this.columnFilter.compoundOperatorList;else switch(e){case S.string:case S.text:case S.readonly:case S.password:i="text",t=qh(this.gridOptions,this.translaterService);break;default:i="numeric",t=Dn(this.gridOptions,this.translaterService);break}return Mn(this.gridOptions,t,i),t}createDomFilterElement(e){var n,o,l,a;const t=((n=this.columnDef)==null?void 0:n.id)??"";J(this._cellContainerElm);let i=((o=this.gridOptions)==null?void 0:o.defaultFilterPlaceholder)??"";(l=this.columnFilter)!=null&&l.placeholder&&(i=this.columnFilter.placeholder);const s=`${e??""}`;if(this._filterInputElm=v("input",{type:this._inputType||"text",autocomplete:"off",ariaAutoComplete:"none",placeholder:i,ariaLabel:((a=this.columnFilter)==null?void 0:a.ariaLabel)??`${_t(t+"")} Search Filter`,className:`form-control filter-${t}`,value:s,dataset:{columnid:`${t}`}}),this.updateFilterStyle(!!e),e!==void 0&&(this._currentValue=s),this.inputFilterType==="single")this._filterContainerElm=this._filterInputElm,this._filterInputElm.classList.add("search-filter"),this._cellContainerElm.appendChild(this._filterInputElm),this._cellContainerElm.appendChild(document.createElement("span"));else{this._filterInputElm.classList.add("compound-input"),this._selectOperatorElm=Fn(this.getCompoundOperatorOptionValues(),this.grid),this._filterContainerElm=v("div",{className:`form-group search-filter filter-${t}`});const h=v("div",{className:"input-group"},this._filterContainerElm);v("div",{className:"input-group-addon input-group-prepend operator"},h).appendChild(this._selectOperatorElm),h.appendChild(this._filterInputElm),h.appendChild(v("span")),this.operator&&(this._selectOperatorElm.value=di(this.operator)),this._filterContainerElm&&this._cellContainerElm.appendChild(this._filterContainerElm)}}onTriggerEvent(e,t=!1){var i,s;if(t)this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:t,shouldTriggerQuery:this._shouldTriggerQuery}),this.updateFilterStyle(!1);else{const n=(e==null?void 0:e.type)??"",o=((i=this._selectOperatorElm)==null?void 0:i.value)??this.operator;let l=this._filterInputElm.value;const a=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;typeof l=="string"&&a&&(l=l.trim()),((s=e==null?void 0:e.target)==null?void 0:s.tagName.toLowerCase())!=="select"&&(this._currentValue=l),this.updateFilterStyle(l!=="");const h={columnDef:this.columnDef,operator:o,searchTerms:l?[l]:null,shouldTriggerQuery:this._shouldTriggerQuery},d=n==="keyup"&&(e==null?void 0:e.key)!=="Enter"?this._debounceTypingDelay:0,c=this.columnFilter.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput,u=c&&ie(this._currentValue)||this._currentValue===""&&ie(this._lastSearchValue);(this.inputFilterType==="single"||!c||u)&&(d>0?(clearTimeout(this._timer),this._timer=setTimeout(()=>this.callback(e,h),d)):this.callback(e,h)),this._lastSearchValue=l}this._shouldTriggerQuery=!0}updateFilterStyle(e){var t,i;e?((t=this._filterContainerElm)==null||t.classList.add("filled"),this._filterInputElm.classList.add("filled")):((i=this._filterContainerElm)==null||i.classList.remove("filled"),this._filterInputElm.classList.remove("filled"))}}class ba extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="text",this.inputFilterType="compound"}}class Au extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="number",this.inputFilterType="compound"}}class Pu extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="password",this.inputFilterType="compound"}}const vr="#86bff8",Us=0,ku=20;class br{constructor(e){this.translaterService=e,this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this._sliderTrackFilledColor=vr,this.sliderType="double",this.searchTerms=[],this._bindEventService=new Ae}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)??{}}get currentValue(){return this._currentValue}get currentValues(){return this._currentValues}get defaultOperator(){return this.sliderType==="compound"?H.empty:this.sliderType==="single"?H.greaterThanOrEqual:this.gridOptions.defaultFilterRangeOperator||H.rangeInclusive}get filterOptions(){var e,t;return{...(e=this.gridOptions.defaultFilterOptions)==null?void 0:e.slider,...(t=this.columnFilter)==null?void 0:t.filterOptions}}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.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==null?void 0:e.searchTerms)??[],this._argFilterContainerElm=e.filterContainerElm,this._sliderTrackFilledColor=window.getComputedStyle(document.documentElement).getPropertyValue("--slick-slider-filter-filled-track-color")||vr,this._filterElm=this.createDomFilterElement(this.searchTerms)}clear(e=!0){var t,i,s,n,o,l,a;if(this._filterElm){this._clearFilterTriggered=!0,this._shouldTriggerQuery=e,this.searchTerms=[];const h=+(((t=this.filterOptions)==null?void 0:t.sliderStartValue)??R.SLIDER_DEFAULT_MIN_VALUE),d=+(((i=this.filterOptions)==null?void 0:i.sliderEndValue)??R.SLIDER_DEFAULT_MAX_VALUE);this.sliderType==="double"?(this._sliderLeftInputElm&&(this._sliderLeftInputElm.value=`${h}`),this._sliderRightInputElm&&(this._sliderRightInputElm.value=`${d}`),this._currentValues=[h,d],(s=this._sliderLeftInputElm)==null||s.dispatchEvent(new Event("change")),(n=this._sliderRightInputElm)==null||n.dispatchEvent(new Event("change"))):(this._sliderRightInputElm&&(this._sliderRightInputElm.value=`${h}`),this._selectOperatorElm&&(this._selectOperatorElm.selectedIndex=0),this._currentValue=h,(o=this._sliderRightInputElm)==null||o.dispatchEvent(new Event("change"))),(((l=this.filterOptions)==null?void 0:l.hideSliderNumber)??((a=this.filterOptions)==null?void 0:a.hideSliderNumbers))||(this.sliderType==="double"?this.renderSliderValues(h,d):this.renderSliderValues(void 0,h)),this.updateFilterStyle(!1),this.callback(void 0,{columnDef:this.columnDef,clearFilterTriggered:!0,shouldTriggerQuery:e,searchTerms:[]})}}destroy(){var e,t,i;this._bindEventService.unbindAll(),(e=this._sliderTrackElm)==null||e.remove(),(t=this._sliderLeftInputElm)==null||t.remove(),(i=this._sliderRightInputElm)==null||i.remove()}renderSliderValues(e,t,i=!0){var o,l;const s=(e==null?void 0:e.toString())||"",n=(t==null?void 0:t.toString())||"";(o=this._leftSliderNumberElm)!=null&&o.textContent&&(this._leftSliderNumberElm.textContent=s),(l=this._rightSliderNumberElm)!=null&&l.textContent&&(this._rightSliderNumberElm.textContent=n),this._sliderRangeContainElm.title=this.sliderType==="double"?`${s} - ${n}`:`${n}`,i&&this.grid.onHeaderRowMouseLeave.notify({column:this.columnDef,grid:this.grid})}getValues(){return this.sliderType==="double"?this._currentValues:this._currentValue}setValues(e,t,i=!1){var o;if(e){let l=[];const a=Array.isArray(e)?e==null?void 0:e[0]:e;if(Array.isArray(e)&&e.length===2?l=e:typeof a=="string"&&a.indexOf("..")>0?(l=a.split(".."),this._currentValue=+((l==null?void 0:l[0])??0)):(ie(a)||a==="")&&(this._currentValue=a===null?void 0:+a,l=[a]),this.sliderType!=="double"&&this._sliderRightInputElm)this._sliderRightInputElm.value=typeof e=="string"?e:`${a}`,this.renderSliderValues(void 0,this._sliderRightInputElm.value);else if(Array.isArray(l)&&l.length===2&&!((o=this.filterOptions)!=null&&o.hideSliderNumbers)){const[h,d]=l;this._sliderLeftInputElm&&(this._sliderLeftInputElm.value=String(h??R.SLIDER_DEFAULT_MIN_VALUE)),this._sliderRightInputElm&&(this._sliderRightInputElm.value=String(d??R.SLIDER_DEFAULT_MAX_VALUE)),this.renderSliderValues(...l)}}else this._currentValue=void 0,this._currentValues=void 0;const s=this.getValues(),n=s===void 0?[]:Array.isArray(s)?s:[s];if(this.updateFilterStyle(n.length>0),t!==void 0&&(this.operator=t),this.operator&&this._selectOperatorElm){const l=di(this.operator);this._selectOperatorElm.value=l}i&&this.callback(void 0,{columnDef:this.columnDef,operator:this.operator,searchTerms:n,shouldTriggerQuery:!0})}createDomFilterElement(e){var c,u,p,m,f;const t=((c=this.columnDef)==null?void 0:c.id)??"",i=+(this.columnFilter.minValue??R.SLIDER_DEFAULT_MIN_VALUE),s=+(this.columnFilter.maxValue??R.SLIDER_DEFAULT_MAX_VALUE),n=+(this.columnFilter.valueStep??R.SLIDER_DEFAULT_STEP);J(this._argFilterContainerElm);const o=+((Array.isArray(e)&&(e==null?void 0:e[0]))??((u=this.filterOptions)==null?void 0:u.sliderStartValue)??i),l=+((Array.isArray(e)&&(e==null?void 0:e[1]))??((p=this.filterOptions)==null?void 0:p.sliderEndValue)??s);if(this._sliderRangeContainElm=v("div",{className:`filter-input filter-${t} slider-input-container slider-values`,title:this.sliderType==="double"?`${o} - ${l}`:`${o}`}),this._sliderTrackElm=v("div",{className:"slider-track"}),this.sliderType==="compound"){const g=v("span",{className:"input-group-addon input-group-prepend operator"});this._selectOperatorElm=Fn(this.getOperatorOptionValues(),this.grid),g.appendChild(this._selectOperatorElm)}this.sliderType==="double"&&(this._sliderLeftInputElm=v("input",{type:"range",className:"slider-filter-input",ariaLabel:this.columnFilter.ariaLabel??`${_t(t+"")} Search Filter`,defaultValue:`${o}`,value:`${o}`,min:`${i}`,max:`${s}`,step:`${n}`}));const a=this.sliderType==="double"?l:o;this._sliderRightInputElm=v("input",{type:"range",className:"slider-filter-input",ariaLabel:this.columnFilter.ariaLabel??`${_t(t+"")} Search Filter`,defaultValue:`${a}`,value:`${a}`,min:`${i}`,max:`${s}`,step:`${n}`});const h=((m=this.filterOptions)==null?void 0:m.hideSliderNumber)??((f=this.filterOptions)==null?void 0:f.hideSliderNumbers),d=h?"":"input-group";if(this._divContainerFilterElm=v("div",{className:`${d} search-filter slider-container slider-values filter-${t}`.trim()}),this._sliderRangeContainElm.appendChild(this._sliderTrackElm),this.sliderType==="double"&&this._sliderLeftInputElm&&this._sliderRangeContainElm.appendChild(this._sliderLeftInputElm),this._sliderRangeContainElm.appendChild(this._sliderRightInputElm),h)this._divContainerFilterElm.appendChild(this._sliderRangeContainElm);else{let g;this.sliderType==="compound"&&this._selectOperatorElm?(g=v("span",{className:"input-group-addon input-group-prepend operator"}),g.appendChild(this._selectOperatorElm)):this.sliderType==="double"&&(g=v("div",{className:"input-group-addon input-group-prepend slider-range-value"}),this._leftSliderNumberElm=v("span",{className:`input-group-text lowest-range-${t}`,textContent:`${o}`}),g.appendChild(this._leftSliderNumberElm));const _=v("div",{className:"input-group-addon input-group-append slider-range-value"});this._rightSliderNumberElm=v("span",{className:`input-group-text highest-range-${t}`,textContent:`${a}`},_),g&&this._divContainerFilterElm.appendChild(g),this._divContainerFilterElm.appendChild(this._sliderRangeContainElm),this._divContainerFilterElm.appendChild(_)}return this._sliderOptions={minValue:i,maxValue:s,step:n},this._currentValues=[o,l],Array.isArray(e)&&e.length>0&&e[0]!==""&&(this.updateFilterStyle(!0),this._currentValue=o),(this.filterOptions.sliderStartValue!==void 0||this.columnFilter.minValue!==void 0)&&(this._currentValue=o),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)),this.sliderType==="compound"&&this._selectOperatorElm?this._bindEventService.bind(this._selectOperatorElm,["change"],this.onValueChanged.bind(this)):this.sliderType==="double"&&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 this.columnFilter.compoundOperatorList?e=this.columnFilter.compoundOperatorList:e=Dn(this.gridOptions,this.translaterService),Mn(this.gridOptions,e,"numeric"),e}onValueChanged(e){var n,o,l,a,h;const t=parseInt(((n=this._sliderRightInputElm)==null?void 0:n.value)??"",10);let i,s;if(this.sliderType==="compound"||this.sliderType==="single")((l=(o=e==null?void 0:e.target)==null?void 0:o.tagName)==null?void 0:l.toLowerCase())!=="select"&&(this._currentValue=+t),i=this._currentValue,s=[i||"0"];else if(this.sliderType==="double"){const c=[parseInt(((a=this._sliderLeftInputElm)==null?void 0:a.value)??"",10),t];i=c.join(".."),s=c}if(this._clearFilterTriggered)this.updateFilterStyle(!1),this.callback(e,{columnDef:this.columnDef,clearFilterTriggered:this._clearFilterTriggered,searchTerms:[],shouldTriggerQuery:this._shouldTriggerQuery});else{const d=((h=this._selectOperatorElm)==null?void 0:h.value)??this.operator;this.updateFilterStyle(i!=="");const c=this.columnFilter.skipCompoundOperatorFilterWithNullInput??this.gridOptions.skipCompoundOperatorFilterWithNullInput,u=c&&ie(this._currentValue)||!ie(this._currentValue)&&ie(this._lastSearchValue);(this.sliderType!=="compound"||!c||u)&&this.callback(e,{columnDef:this.columnDef,operator:d||"",searchTerms:s,shouldTriggerQuery:this._shouldTriggerQuery})}this._clearFilterTriggered=!1,this._shouldTriggerQuery=!0,this.changeBothSliderFocuses(!1),this.grid.onHeaderRowMouseEnter.notify({column:this.columnDef,grid:this.grid},new le(e)),this._lastSearchValue=i}changeBothSliderFocuses(e){var i,s;const t=e?"add":"remove";(i=this._sliderLeftInputElm)==null||i.classList[t]("focus"),(s=this._sliderRightInputElm)==null||s.classList[t]("focus")}slideLeftInputChanged(e){var s,n,o,l;const t=parseInt(((s=this._sliderLeftInputElm)==null?void 0:s.value)??"",10),i=parseInt(((n=this._sliderRightInputElm)==null?void 0:n.value)??"",10);this._sliderLeftInputElm&&i-t<=(((o=this.filterOptions)==null?void 0:o.stopGapBetweenSliderHandles)??Us)&&(this._sliderLeftInputElm.value=String(t-(((l=this.filterOptions)==null?void 0:l.stopGapBetweenSliderHandles)??Us))),this._sliderLeftInputElm&&this._sliderRightInputElm&&(+this._sliderLeftInputElm.value>=+this._sliderRightInputElm.value-ku?(this._sliderLeftInputElm.style.zIndex="1",this._sliderRightInputElm.style.zIndex="0"):(this._sliderLeftInputElm.style.zIndex="0",this._sliderRightInputElm.style.zIndex="1")),this.sliderLeftOrRightChanged(e,t,i)}slideRightInputChanged(e){var s,n,o,l;const t=parseInt(((s=this._sliderLeftInputElm)==null?void 0:s.value)??"",10),i=parseInt(((n=this._sliderRightInputElm)==null?void 0:n.value)??"",10);this.sliderType==="double"&&this._sliderRightInputElm&&i-t<=(((o=this.filterOptions)==null?void 0:o.stopGapBetweenSliderHandles)??Us)&&(this._sliderRightInputElm.value=String(t+(((l=this.filterOptions)==null?void 0:l.stopGapBetweenSliderHandles)??Us))),this.sliderLeftOrRightChanged(e,t,i)}sliderLeftOrRightChanged(e,t,i){var n,o,l,a,h,d;this.updateTrackFilledColorWhenEnabled(),this.changeBothSliderFocuses(!0),this._sliderRangeContainElm.title=this.sliderType==="double"?`${t} - ${i}`:`${i}`,(((n=this.filterOptions)==null?void 0:n.hideSliderNumber)??((o=this.filterOptions)==null?void 0:o.hideSliderNumbers))||((l=this._leftSliderNumberElm)!=null&&l.textContent&&(this._leftSliderNumberElm.textContent=((a=this._sliderLeftInputElm)==null?void 0:a.value)??""),(h=this._rightSliderNumberElm)!=null&&h.textContent&&(this._rightSliderNumberElm.textContent=((d=this._sliderRightInputElm)==null?void 0:d.value)??"")),this.grid.onHeaderRowMouseEnter.notify({column:this.columnDef,grid:this.grid},new le(e))}sliderTrackClicked(e){e.preventDefault();const t=e.offsetX,i=this._sliderTrackElm.offsetWidth,s=(t+0)*100/i;this._sliderRightInputElm&&this.sliderType!=="double"?(this._sliderRightInputElm.value=`${s}`,this._sliderRightInputElm.dispatchEvent(new Event("change"))):this._sliderLeftInputElm&&this._sliderRightInputElm&&(s<=50?(this._sliderLeftInputElm.value=`${s}`,this._sliderLeftInputElm.dispatchEvent(new Event("change"))):(this._sliderRightInputElm.value=`${s}`,this._sliderRightInputElm.dispatchEvent(new Event("change"))))}updateTrackFilledColorWhenEnabled(){var e,t,i,s;if((e=this.filterOptions)!=null&&e.enableSliderTrackColoring&&this._sliderRightInputElm){let n=0;this._sliderLeftInputElm&&(n=(+this._sliderLeftInputElm.value-+this._sliderLeftInputElm.min)/(((t=this.sliderOptions)==null?void 0:t.maxValue)??0-+this._sliderLeftInputElm.min)*100);const o=(+this._sliderRightInputElm.value-+this._sliderRightInputElm.min)/(((i=this.sliderOptions)==null?void 0:i.maxValue)??0-+this._sliderRightInputElm.min)*100,l="linear-gradient(to right, %b %p1, %c %p1, %c %p2, %b %p2)".replace(/%b/g,"#eee").replace(/%c/g,((s=this.filterOptions)==null?void 0:s.sliderTrackFilledColor)||this._sliderTrackFilledColor||vr).replace(/%p1/g,`${n}%`).replace(/%p2/g,`${o}%`);this._sliderTrackElm.style.background=l,this._sliderOptions.sliderTrackBackground=l}}updateFilterStyle(e){var t,i;e?(this._divContainerFilterElm.classList.add("filled"),(t=this._filterElm)==null||t.classList.add("filled")):(this._divContainerFilterElm.classList.remove("filled"),(i=this._filterElm)==null||i.classList.remove("filled"))}}class Fu extends br{constructor(e){super(e),this.translaterService=e,this.sliderType="compound"}}class Du extends _l{constructor(e){super(e),this.translaterService=e,this.inputFilterType="range"}}class Mu extends Ut{constructor(e){super(e),this.translaterService=e,this._inputMask="",this.inputType="text"}get inputMask(){return this._inputMask}init(e){var i,s,n,o;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,(s=(i=this.columnDef)==null?void 0:i.params)!=null&&s.mask?this._inputMask=this.columnDef.params.mask:(o=(n=this.columnFilter)==null?void 0:n.params)!=null&&o.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
|
|
17
|
-
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,t=!1){var s,n;let i="";if((s=e==null?void 0:e.target)!=null&&s.value){let o=((n=e==null?void 0:e.target)==null?void 0:n.value)??"";const l=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;typeof o=="string"&&l&&(o=o.trim());const a=this.unmaskValue(o),h=this.maskValue(a);i=a,(e==null?void 0:e.keyCode)>=48&&(this._filterInputElm.value=h,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,s=>((s==="0"||s==="9")&&/\d+/g.test(e[t])||s.toUpperCase()==="A"&&/[^\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 s="";for(let n=0;n<i.length;n++)t[n]&&((i[n]==="0"||i[n]==="9")&&/\d+/g.test(t[n])||i[n].toUpperCase()==="A"&&/[^\d]+/gi.test(t[n]))&&(s+=t[n]);return s}}class Nu extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="number"}}class Lu extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="password"}}var Hu=Object.defineProperty,Vu=(r,e,t)=>e in r?Hu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,V=(r,e,t)=>Vu(r,typeof e!="symbol"?e+"":e,t),Bu=class{constructor(r){V(this,"_distinctEvent"),V(this,"_boundedEvents",[]),this._distinctEvent=(r==null?void 0:r.distinctEvent)??!1}get boundedEvents(){return this._boundedEvents}dispose(){this.unbindAll(),this._boundedEvents=[]}bind(r,e,t,i,s=""){let n=Array.isArray(e)?e:[e];if(typeof(r==null?void 0:r.forEach)=="function")r.forEach(o=>{for(let l of n)(!this._distinctEvent||this._distinctEvent&&!this.hasBinding(o,l))&&(o.addEventListener(l,t,i),this._boundedEvents.push({element:o,eventName:l,listener:t,groupName:s}))});else for(let o of n)(!this._distinctEvent||this._distinctEvent&&!this.hasBinding(r,o))&&(r.addEventListener(o,t,i),this._boundedEvents.push({element:r,eventName:o,listener:t,groupName:s}))}hasBinding(r,e){return this._boundedEvents.some(t=>t.element===r&&(!e||t.eventName===e))}unbind(r,e,t){var i;if(r){let s=Array.isArray(r)?r:[r],n=Array.isArray(e)?e||"":[e||""];for(let o of s){t||(t=this._boundedEvents.find(l=>{if(l.element===o&&(!e||l.eventName===e))return l.listener}));for(let l of n)(i=o==null?void 0:o.removeEventListener)==null||i.call(o,l,t)}}}unbindAll(r){if(r){let e=Array.isArray(r)?r:[r];for(let t=this._boundedEvents.length-1;t>=0;--t){let i=this._boundedEvents[t];if(e.some(s=>s===i.groupName)){let{element:s,eventName:n,listener:o}=i;this.unbind(s,n,o),this._boundedEvents.splice(t,1)}}}else for(;this._boundedEvents.length>0;){let e=this._boundedEvents.pop(),{element:t,eventName:i,listener:s}=e;this.unbind(t,i,s)}}},Sa=typeof window<"u"&&window.multipleSelect!==void 0?window.multipleSelect:{locales:{}},zu={formatSelectAll(){return"[Select all]"},formatAllSelected(){return"All selected"},formatCountSelected(r,e){return`${r} of ${e} selected`},formatNoMatchesFound(){return"No matches found"},formatOkButton(){return"OK"}};Sa.locales["en-US"]=zu;var ya=Sa.locales,$u=50,Wu=4,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(r){let{text:e,label:t,search:i}=r;return(t||e||"").includes(i)},showClear:!1,autoAdjustDropHeight:!1,autoAdjustDropPosition:!1,autoAdjustDropWidthByTextSize:!1,adjustedHeightPadding:10,useSelectOptionLabel:!1,useSelectOptionLabelToHtml:!1,navigationHighlight:!0,infiniteScroll:!1,virtualScroll:!0,cssStyler:()=>null,textTemplate:r=>r.innerHTML.trim(),labelTemplate:r=>r.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},Gu=["init","getOptions","refreshOptions","getSelects","setSelects","enable","disable","open","close","check","uncheck","checkAll","uncheckAll","checkInvert","focus","blur","refresh","destroy"];Object.assign(Ea,ya["en-US"]);var Uu={BLOCK_ROWS:$u,CLUSTER_BLOCKS:Wu,DEFAULTS:Ea,METHODS:Gu},ft=Uu;function ju(r,e,t=!1){let i=Object.keys(r),s=Object.keys(e);if(t&&i.length!==s.length)return!1;for(let n of i)if(s.includes(n)&&r[n]!==e[n])return!1;return!0}function Sr(r){let e=()=>{let s={};for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=Sr(r[n]));return s},t=()=>r.map(s=>Sr(s)),i=Object.prototype.toString.call(r).slice(8,-1).toLowerCase();return i==="object"?e():i==="array"?t():r}function yr(r){return r!=null&&r!==""}function Yu(r,e){return typeof r=="object"?Object.fromEntries(e?Object.entries(r).filter(([t,i])=>!yr(i)&&!e.includes(t)||yr(i)):Object.entries(r).filter(([t,i])=>yr(i))):r}function Xu(r){let e=0;return r.forEach((t,i)=>{t.type==="optgroup"?(t._key=`group_${i}`,t.visible=typeof t.visible>"u"?!0:t.visible,t.children.forEach((s,n)=>{s&&(s.visible=typeof(s==null?void 0:s.visible)>"u"?!0:s.visible,s.divider||(s._key=`option_${i}_${n}`,e+=1))})):(t.visible=typeof t.visible>"u"?!0:t.visible,t.divider||(t._key=`option_${i}`,e+=1))}),e}function js(r,e,t){if(Array.isArray(r))for(let i of r){if(i[e]===t||i[e]===`${+i[e]}`&&+i[e]===t)return i;if(i.type==="optgroup"){for(let s of i.children)if(s&&(s[e]===t||s[e]===`${+s[e]}`&&+s[e]===t))return s}}}function qu(r){return r.replace(/(\b)(on[a-z]+)(\s*)=([^>]*)|javascript:([^>]*)[^>]*|(<\s*)(\/*)script([<>]*).*(<\s*)(\/*)script(>*)|(<|<)(\/*)(script|script defer)(.*)(>|>|>">)/gi,"")}function Er(r){return Object.keys(r).forEach(e=>r[e]===void 0?delete r[e]:""),r}function Ei(r,e){if(typeof r!="string")return r;if(typeof e=="function")return e(r);if(typeof r.normalize=="function")return r.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 wr(r){let e=0,t=0,i=0,s=0,n=window.innerHeight??0,o=window.innerWidth??0,l=Zu(),a=l.top,h=l.left,d=xr(r);if(d){let c=d.top??0,u=d.left??0;t=c-a,e=n-(c-a),i=u-h,s=o-(u-h)}return{top:t,bottom:e,left:i,right:s}}function Tr(r=""){return r.split(" ").filter(e=>e)}function Ge(r,e,t){let i=document.createElement(r);return e&&Object.keys(e).forEach(s=>{let n=e[s];typeof n=="object"?Object.assign(i[s],n):i[s]=e[s]}),t!=null&&t.appendChild&&t.appendChild(i),i}function wa(r,e,t){var n;let i=(n=r.props)!=null&&n.innerHTML?Qu(r.props,"innerHTML"):r.props,s=Ge(r.tagName,Yu(i,["className","title","style"]),e);if(r.props.innerHTML&&(s.innerHTML=r.props.innerHTML),r.attrs)for(let o of Object.keys(r.attrs))s.setAttribute(o,r.attrs[o]);if(r.children)for(let o of r.children)wa(o,s);return e==null||e.appendChild(s),s}function Or(r){return r.hasOwnProperty("tagName")?wa(r):document.createElement("li")}function Ys(r){for(;r!=null&&r.firstChild;)r.lastChild&&r.removeChild(r.lastChild);return r}function xr(r){var o;if(!r)return;let e=(o=r==null?void 0:r.getBoundingClientRect)==null?void 0:o.call(r),t=0,i=0,s=0,n=0;return(e==null?void 0:e.top)!==void 0&&e.left!==void 0&&(t=e.top+window.pageYOffset,i=e.left+window.pageXOffset,n=e.right,s=e.bottom),{top:t,left:i,bottom:s,right:n}}function Xs(r,e,t){if(!r)return 0;let i=Number.parseFloat(r.style[t]);if(!i||Number.isNaN(i)){switch(e){case"outer":i=r[t==="width"?"offsetWidth":"offsetHeight"];break;case"scroll":i=r[t==="width"?"scrollWidth":"scrollHeight"];break;case"inner":default:i=r[t==="width"?"clientWidth":"clientHeight"];break}i=r.getBoundingClientRect()[t]}if(!i||Number.isNaN(i)){let s=r.style.display,n=r.style.position;r.style.display="block",r.style.position="absolute";let o=window.getComputedStyle(r)[t];i=Number.parseFloat(o),Number.isNaN(i)&&(i=0),r.style.display=s,r.style.position=n}return i||0}function Ta(r,e){let t=null,i=r==null?void 0:r.parentElement;for(;i;){let[s,n,o,l]=e.match(/^([a-z]*)([#.]{1})([a-z\-]+)$/i)||[];if(o&&l)for(let a of l.replace(o,"").split(" "))i.classList.contains(a)&&(n?(i==null?void 0:i.tagName.toLowerCase())===n&&(t=i):t=i);i=i.parentElement}return t}function Ku(r,e){var t;(t=r.parentNode)==null||t.insertBefore(e,r.nextSibling)}function Qu(r,e){let{[e]:t,...i}=r;return i}function Oa(r,e){r!=null&&r.style&&(r.style.display=r.style.display==="none"&&e!==!1||e===!0?"block":"none")}function Zu(){return{left:window.pageXOffset||document.documentElement.scrollLeft||0,top:window.pageYOffset||document.documentElement.scrollTop||0}}var Ju=class{constructor(e){var i;V(this,"clusterRows"),V(this,"cache"),V(this,"scrollEl"),V(this,"blockHeight"),V(this,"clusterHeight"),V(this,"contentEl"),V(this,"parentEl"),V(this,"itemHeight"),V(this,"lastCluster"),V(this,"scrollTop"),V(this,"dataStart"),V(this,"dataEnd"),V(this,"rows"),V(this,"destroy"),V(this,"callback"),V(this,"sanitizer"),this.rows=e.rows,this.scrollEl=e.scrollEl,this.contentEl=e.contentEl,this.parentEl=(i=e.contentEl)==null?void 0:i.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),Ys(this.contentEl)}}reset(e){this.lastCluster=0,this.cache={},Ys(this.contentEl),this.initDOM(e)}initDOM(e){if(typeof this.clusterHeight>"u"){this.cache.scrollTop=this.scrollEl.scrollTop;let o=Or(e[0]);this.contentEl.appendChild(o),this.contentEl.appendChild(o),this.contentEl.appendChild(o),this.cache.data=[e[0]],this.getRowsHeight()}let t=this.initData(e,this.getNum()),i=this.checkChanges("data",t.rows),s=this.checkChanges("top",t.topOffset),n=this.checkChanges("bottom",t.bottomOffset);Ys(this.contentEl),i&&s?(t.topOffset&&this.contentEl.appendChild(this.getExtra("top",t.topOffset)),t.rows.forEach(o=>this.contentEl.appendChild(Or(o))),t.bottomOffset&&this.contentEl.appendChild(this.getExtra("bottom",t.bottomOffset))):n&&this.contentEl.lastChild&&(this.contentEl.lastChild.style.height=`${t.bottomOffset}px`)}getRowsHeight(){var e;if(typeof this.itemHeight>"u"){let t=((e=this.parentEl)==null?void 0:e.style.display)||"";this.parentEl&&(t===""||t==="none")&&(this.parentEl.style.display="block");let i=this.contentEl.children,s=i[Math.floor(i.length/2)];this.itemHeight=s.offsetHeight,this.parentEl&&(this.parentEl.style.display=t)}this.blockHeight=this.itemHeight*ft.BLOCK_ROWS,this.clusterRows=ft.BLOCK_ROWS*ft.CLUSTER_BLOCKS,this.clusterHeight=this.blockHeight*ft.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.length<ft.BLOCK_ROWS)return{topOffset:0,bottomOffset:0,rowsAbove:0,rows:e};let i=Math.max((this.clusterRows-ft.BLOCK_ROWS)*t,0),s=i+this.clusterRows,n=Math.max(i*this.itemHeight,0),o=Math.max((e.length-s)*this.itemHeight,0),l=[],a=i;n<1&&a++;for(let h=i;h<s;h++)e[h]&&l.push(e[h]);return this.dataStart=i,this.dataEnd=s,{topOffset:n,bottomOffset:o,rowsAbove:a,rows:l}}checkChanges(e,t){let i=t!==this.cache[e];return this.cache[e]=t,i}getExtra(e,t){let i=document.createElement("li");return i.className=`virtual-scroll-${e}`,t&&(i.style.height=`${t}px`),i}},ns=".ms-select-all, ul li[data-key]",ep=".ms-select-all.highlighted, ul li[data-key].highlighted",tp=class{constructor(e,t){this.elm=e,V(this,"_bindEventService"),V(this,"isAllSelected",!1),V(this,"isPartiallyAllSelected",!1),V(this,"fromHtml",!1),V(this,"choiceElm"),V(this,"selectClearElm"),V(this,"closeElm"),V(this,"clearSearchIconElm"),V(this,"filterText",""),V(this,"updateData",[]),V(this,"data",[]),V(this,"dataTotal"),V(this,"dropElm"),V(this,"okButtonElm"),V(this,"filterParentElm"),V(this,"lastFocusedItemKey",""),V(this,"lastMouseOverPosition",""),V(this,"ulElm"),V(this,"parentElm"),V(this,"labelElm"),V(this,"selectAllParentElm"),V(this,"selectAllElm"),V(this,"searchInputElm"),V(this,"selectGroupElms"),V(this,"selectItemElms"),V(this,"noResultsElm"),V(this,"options"),V(this,"selectAllName",""),V(this,"selectGroupName",""),V(this,"selectItemName",""),V(this,"scrolledByMouse",!1),V(this,"openDelayTimer"),V(this,"updateDataStart"),V(this,"updateDataEnd"),V(this,"virtualScroll"),V(this,"_currentHighlightIndex",-1),V(this,"_currentSelectedElm"),V(this,"isMoveUpRecalcRequired",!1),V(this,"locales",{}),this.options=Object.assign({},ft.DEFAULTS,this.elm.dataset,t),this._bindEventService=new Bu({distinctEvent:!0})}get isRenderAsHtml(){return this.options.renderOptionLabelAsHtml||this.options.useSelectOptionLabelToHtml}init(){this.initLocale(),this.initContainer(),this.initData(),this.initSelected(!0),this.initFilter(),this.initDrop(),this.initView(),this.options.onAfterCreate()}destroy(e=!0){var t,i,s,n,o;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(),(t=this.virtualScroll)==null||t.destroy(),(i=this.dropElm)==null||i.remove(),this.dropElm=void 0,(s=this.parentElm.parentNode)==null||s.removeChild(this.parentElm),this.fromHtml&&(delete this.options.data,this.fromHtml=!1),this.options.onAfterDestroy({hardDestroy:e}),e&&((o=(n=this.options).onAfterHardDestroy)==null||o.call(n),Object.keys(this.options).forEach(l=>delete this[l])))}initLocale(){if(this.options.locale){if(typeof this.options.locale=="object"){Object.assign(this.options,this.options.locale);return}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]])Object.assign(this.options,e[t[0]]);else throw new Error(`[multiple-select-vanilla] invalid locales "${this.options.locale}", make sure to import it before using it`)}}initContainer(){var s;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),(s=this.labelElm)!=null&&s.querySelector("input")&&(this.labelElm=null),typeof this.options.single>"u"&&(this.options.single=!this.elm.multiple),this.parentElm=Ge("div",{className:Tr(`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=Ge("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(Ge("span",{className:"ms-placeholder",textContent:this.options.placeholder})),this.options.showClear&&(this.selectClearElm=Ge("div",{className:"ms-icon ms-icon-close"}),this.selectClearElm.style.display="none",this.choiceElm.appendChild(this.selectClearElm)),this.choiceElm.appendChild(Ge("div",{className:"ms-icon ms-icon-caret"})),this.dropElm=Ge("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=typeof this.options.dropWidth=="string"?this.options.dropWidth:`${this.options.dropWidth}px`),Ku(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",n=>{this.getEventTarget(n)===this.choiceElm||Ta(this.getEventTarget(n),".ms-choice")===this.choiceElm||(this.getEventTarget(n)===this.dropElm||Ta(this.getEventTarget(n),".ms-drop")!==this.dropElm&&this.getEventTarget(n)!==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(t=>typeof t=="string"||typeof t=="number"?{text:t,value:t}:t);else if(typeof this.options.data=="object"){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=Xu(this.data||[])}initRow(e,t){var s,n;let i={};return((s=e.tagName)==null?void 0:s.toLowerCase())==="option"?(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):((n=e.tagName)==null?void 0:n.toLowerCase())==="optgroup"?(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(o=>{i.children.push(this.initRow(o,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||[])t.type==="optgroup"?e+=t.children.length:e+=1;this.options.filter=e>this.options.filterByDataLength}initList(){var e,t;if(this.options.filter&&(this.filterParentElm=Ge("div",{className:"ms-search"},this.dropElm),this.filterParentElm.appendChild(Ge("input",{autocomplete:"off",autocapitalize:"off",spellcheck:!1,type:"text",placeholder:this.options.filterPlaceholder||"🔎︎"})),this.options.showSearchClear&&this.filterParentElm.appendChild(Ge("span",{className:"ms-icon ms-icon-close"}))),this.options.selectAll&&!this.options.single){let i=this.elm.getAttribute("name")||this.options.name||"";this.selectAllParentElm=Ge("div",{className:"ms-select-all",dataset:{key:"select_all"}});let s=document.createElement("label"),n=`ms-icon ${this.isAllSelected?"ms-icon-check":this.isPartiallyAllSelected?"ms-icon-minus":"ms-icon-uncheck"}`,o=Ge("div",{className:"icon-checkbox-container"},s);Ge("input",{type:"checkbox",ariaChecked:String(this.isAllSelected),checked:this.isAllSelected,dataset:{name:`selectAll${i}`}},o),Ge("div",{className:n},o),s.appendChild(Ge("span",{textContent:this.formatSelectAll()})),this.selectAllParentElm.appendChild(s),(e=this.dropElm)==null||e.appendChild(this.selectAllParentElm)}this.ulElm=document.createElement("ul"),this.ulElm.role="combobox",this.ulElm.ariaExpanded="false",this.ulElm.ariaMultiSelectable=String(!this.options.single),(t=this.dropElm)==null||t.appendChild(this.ulElm),this.options.showOkButton&&!this.options.single&&(this.okButtonElm=Ge("button",{className:"ms-ok-button",type:"button",textContent:this.formatOkButton()},this.dropElm)),this.initListItems()}initListItems(){var i;let e=0,t=this.getListRows();if(this.options.selectAll&&!this.options.single&&(e=-1),t.length>ft.BLOCK_ROWS*ft.CLUSTER_BLOCKS){let s=this.dropElm&&((i=this.dropElm)==null?void 0:i.style.display)!=="none";!s&&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 o=this.getDataLength();this.updateDataEnd>o&&(this.updateDataEnd=o),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 Ju({rows:t,scrollEl:this.ulElm,contentEl:this.ulElm,sanitizer:this.options.sanitizer,callback:()=>{n(),this.events()}})),n(),!s&&this.dropElm&&(this.dropElm.style.left="0",this.dropElm.style.display="none",this.dropElm.ariaExpanded="false")}else this.ulElm&&(Ys(this.ulElm),t.forEach(s=>this.ulElm.appendChild(Or(s)))),this.updateDataStart=0,this.updateDataEnd=this.updateData.length;return this.events(),t}getEventTarget(e){return e.composedPath?e.composedPath()[0]:e.target}getListRows(){var t;let e=[];return this.updateData=[],(t=this.data)==null||t.forEach(i=>e.push(...this.initListItem(i))),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,t=0){let i=(e==null?void 0:e.title)||"",s=this.options.multiple?"multiple":"",n=this.options.single?"radio":"checkbox",o=!!(e!=null&&e.selected),l=this.options.single&&!this.options.singleRadio,a="";if(!(e!=null&&e.visible))return[];if(this.updateData.push(e),l&&(a="hide-radio "),e.selected&&(a+="selected "),e.type==="optgroup"){let g=[],_;if(this.options.hideOptgroupCheckboxes||this.options.single)_={tagName:"span",props:{dataset:{name:this.selectGroupName,key:e._key}}};else{let y={tagName:"input",props:{type:"checkbox",dataset:{name:this.selectGroupName,key:e._key},checked:o,disabled:e.disabled}};l?_=y:_={tagName:"div",props:{className:`icon-checkbox-container${n==="radio"?" radio":""}`},children:[y,{tagName:"div",props:{className:`ms-icon ${o?n==="radio"?"ms-icon-radio":"ms-icon-check":"ms-icon-uncheck"}`}}]}}!a.includes("hide-radio")&&(this.options.hideOptgroupCheckboxes||this.options.single)&&(a+="hide-radio ");let b={tagName:"span",props:{}};this.applyAsTextOrHtmlWhenEnabled(b.props,e.label);let C={tagName:"li",props:{className:Tr(`group${this.options.single||e.disabled?" disabled":""} ${a}`).join(" "),role:"option",ariaSelected:String(o),dataset:{key:e._key}},children:[{tagName:"label",props:{className:Tr(`optgroup${this.options.single||e.disabled?" disabled":""}`).join(" ")},children:[_,b]}]},E=this.options.cssStyler(e);return E&&(C.props.style=E),g.push(C),e.children.forEach(y=>g.push(...this.initListItem(y,1))),g}if(a+=e.classes||"",t&&this.options.single&&(a+=`option-level-${t} `),e.divider)return[{tagName:"li",props:{className:"option-divider"}}];let h=s||a?(s+a).trim():"";e.disabled&&(h+=" disabled");let d=`${e.disabled?"disabled":""}`,c={tagName:"span",props:{}};this.applyAsTextOrHtmlWhenEnabled(c.props,e.text);let u={tagName:"input",props:{type:n,value:encodeURI(e.value),dataset:{key:e._key,name:this.selectItemName},checked:o,disabled:!!e.disabled}};e.selected&&(u.attrs={checked:"checked"});let p={tagName:"div",props:{className:`icon-checkbox-container${n==="radio"?" radio":""}`},children:[u,{tagName:"div",props:{className:`ms-icon ${u.props.checked?n==="radio"?"ms-icon-radio":"ms-icon-check":"ms-icon-uncheck"}`}}]},m={tagName:"li",props:{role:"option",title:i,ariaSelected:String(o),dataset:{key:e._key}},children:[{tagName:"label",props:{className:d},children:[l?u:p,c]}]};h&&(m.props.className=h);let f=this.options.cssStyler(e);return f&&(m.props.style=f),[m]}initSelected(e=!1){var i,s;let t=0;for(let n of this.data||[])if(n.type==="optgroup"){let o=n.children.filter(l=>(l==null?void 0:l.selected)&&!l.disabled&&l.visible).length;n.children.length&&(n.selected=!this.options.single&&o&&o===n.children.filter(l=>l&&!l.disabled&&l.visible&&!l.divider).length),t+=o}else t+=n.selected&&!n.disabled&&n.visible?1:0;this.isAllSelected=((i=this.data)==null?void 0:i.filter(n=>n.selected&&!n.disabled&&n.visible).length)===((s=this.data)==null?void 0:s.filter(n=>!n.disabled&&n.visible&&!n.divider).length),this.isPartiallyAllSelected=!this.isAllSelected&&t>0,e||(this.isAllSelected?this.options.onCheckAll():t===0&&this.options.onUncheckAll())}initView(){let e;window.getComputedStyle?(e=window.getComputedStyle(this.elm).width,e==="auto"&&(e=Xs(this.dropElm,"outer","width")+20)):e=Xs(this.elm,"outer","width")+20,this.parentElm.style.width=`${this.options.width||e}px`,this.elm.classList.add("ms-offscreen")}events(){var t,i,s,n,o,l,a;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=(t=this.filterParentElm)==null?void 0:t.querySelector(".ms-icon-close"),this.searchInputElm=(i=this.dropElm)==null?void 0:i.querySelector(".ms-search input"),this.selectAllElm=(s=this.dropElm)==null?void 0:s.querySelector(`input[data-name="${this.selectAllName}"]`),this.selectGroupElms=(n=this.dropElm)==null?void 0:n.querySelectorAll(`input[data-name="${this.selectGroupName}"],span[data-name="${this.selectGroupName}"]`),this.selectItemElms=(o=this.dropElm)==null?void 0:o.querySelectorAll(`input[data-name="${this.selectItemName}"]:enabled`),this.noResultsElm=(l=this.dropElm)==null?void 0:l.querySelector(".ms-no-results");let e=h=>{h.preventDefault(),!this.getEventTarget(h).classList.contains("ms-icon-close")&&(this.options.isOpen?this.close("toggle.close"):this.open())};this.labelElm&&this._bindEventService.bind(this.labelElm,"click",h=>{this.getEventTarget(h).nodeName.toLowerCase()==="label"&&(e(h),(!this.options.filter||!this.options.isOpen)&&this.focus(),h.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",h=>{h.code==="Escape"&&this.handleEscapeKey()}),this.closeElm&&this._bindEventService.bind(this.closeElm,"click",h=>{h.preventDefault(),this._checkAll(!1,!0),this.initSelected(!1),this.updateSelected(),this.update(),this.options.onClear()}),this.clearSearchIconElm&&this._bindEventService.bind(this.clearSearchIconElm,"click",h=>{h.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",h=>{h.code==="Tab"&&h.shiftKey&&this.close("key.shift+tab")},void 0,"search-input"),this._bindEventService.bind(this.searchInputElm,"keyup",h=>{var d,c,u;if(this.options.filterAcceptOnEnter&&["Enter","Space"].includes(h.code)&&((d=this.searchInputElm)!=null&&d.value)){if(this.options.single){let p=[];(c=this.selectItemElms)==null||c.forEach(m=>{var f;((f=m.closest("li"))==null?void 0:f.style.display)!=="none"&&p.push(m)}),p.length&&p[0].hasAttribute("data-name")&&this.setSelects([p[0].value])}else(u=this.selectAllElm)==null||u.click();this.close(`key.${h.code.toLowerCase()}`),this.focus();return}this.filter()},void 0,"search-input")),this.selectAllElm&&this._bindEventService.bind(this.selectAllElm,"click",h=>{var d;return this._checkAll((d=h.currentTarget)==null?void 0:d.checked)},void 0,"select-all-checkbox"),this.okButtonElm&&this._bindEventService.bind(this.okButtonElm,"click",h=>{e(h),h.stopPropagation()},void 0,"ok-button"),this.selectGroupElms&&this._bindEventService.bind(this.selectGroupElms,"click",h=>{let d=h.currentTarget,c=d.checked,u=js(this.data,"_key",d.dataset.key);this._checkGroup(u,c),this.options.onOptgroupClick(Er({label:u.label,selected:u.selected,data:u._data,children:u.children.map(p=>{if(p)return Er({text:p.text,value:p.value,selected:p.selected,disabled:p.disabled,data:p._data})})}))},void 0,"group-checkbox-list"),this.selectItemElms&&this._bindEventService.bind(this.selectItemElms,"click",h=>{let d=h.currentTarget,c=d.checked,u=js(this.data,"_key",d.dataset.key),p=()=>{this.options.single&&this.options.isOpen&&!this.options.keepOpen&&this.close("selection")};if(this.options.onBeforeClick(u)===!1){p();return}this._check(u,c),this.options.onClick(Er({text:u.text,value:u.value,selected:u.selected,data:u._data})),p()},void 0,"input-checkbox-list"),this.lastFocusedItemKey&&this.dropElm&&((a=this.dropElm.querySelector(`li[data-key=${this.lastFocusedItemKey}]`))==null||a.focus()),this.options.navigationHighlight&&this.dropElm&&(this._bindEventService.bind(this.dropElm,"mouseover",h=>{var c,u;let d=this.getEventTarget(h).closest(".ms-select-all")||this.getEventTarget(h).closest("li");if((c=this.dropElm)!=null&&c.contains(d)&&this.lastMouseOverPosition!==`${h.clientX}:${h.clientY}`){let p=((u=this.dropElm)==null?void 0:u.querySelectorAll(ns))||[],m=Array.from(p).findIndex(f=>f.dataset.key===d.dataset.key);this._currentHighlightIndex!==m&&!d.classList.contains("disabled")&&(this._currentSelectedElm=d,this._currentHighlightIndex=m,this.changeCurrentOptionHighlight(d))}this.lastMouseOverPosition=`${h.clientX}:${h.clientY}`},void 0,"hover-highlight"),this._bindEventService.bind(this.dropElm,"keydown",h=>{var d,c,u,p;switch(h.key){case"ArrowUp":h.preventDefault(),this.moveHighlightUp();break;case"ArrowDown":h.preventDefault(),this.moveHighlightDown();break;case"Escape":this.handleEscapeKey();break;case"Enter":case" ":{if(document.activeElement!==this.okButtonElm){let m=this.getEventTarget(h).closest(".ms-select-all")||this.getEventTarget(h).closest("li");if(h.key===" "&&this.options.filter||this.options.filterAcceptOnEnter&&!m)return;h.preventDefault(),(c=(d=this._currentSelectedElm)==null?void 0:d.querySelector("input"))==null||c.click(),this.options.single&&(this.choiceElm.focus(),this.lastFocusedItemKey=((u=this.choiceElm)==null?void 0:u.dataset.key)||"")}break}case"Tab":{h.preventDefault(),h.shiftKey?document.activeElement===this.okButtonElm?(this.focusSelectAllOrList(),this.highlightCurrentOption()):(this.close("key.shift+tab"),this.choiceElm.focus()):(this.changeCurrentOptionHighlight(),(p=this.okButtonElm)==null||p.focus());break}}},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 s=!1;e&&this.getEventTarget(e)&&this.ulElm&&this.scrolledByMouse?this.getEventTarget(e).scrollTop+this.getEventTarget(e).clientHeight===this.ulElm.scrollHeight&&(s=!0):t!==void 0&&t+1===i&&(s=!0),s&&this.ulElm&&(this.virtualScroll?this.initListItems():this.ulElm.scrollTop=0,this._currentHighlightIndex=0,this.highlightCurrentOption())}open(e=0){return new Promise(t=>{e!==null&&e>=0?(clearTimeout(this.openDelayTimer),this.openDelayTimer=setTimeout(()=>{this.openDrop(),t()},e)):(this.openDrop(),t())})}openDrop(){var s,n,o,l,a;if(!this.dropElm||(s=this.choiceElm)!=null&&s.classList.contains("disabled"))return;if(this.options.isOpen=!0,this.parentElm.classList.add("ms-parent-open"),(o=(n=this.choiceElm)==null?void 0:n.querySelector("div.ms-icon-caret"))==null||o.classList.add("open"),this.dropElm.style.display="block",this.dropElm.ariaExpanded="true",(l=this.selectAllElm)!=null&&l.parentElement&&(this.selectAllElm.parentElement.style.display="inline-flex"),this.noResultsElm&&(this.noResultsElm.style.display="none"),this.getDataLength()||((a=this.selectAllElm)!=null&&a.parentElement&&(this.selectAllElm.parentElement.style.display="none"),this.noResultsElm&&(this.noResultsElm.style.display="block")),this.options.container){let h=xr(this.dropElm),d;this.options.container instanceof Node?d=this.options.container:typeof this.options.container=="string"&&(d=this.options.container==="body"?document.body:document.querySelector(this.options.container)),d.appendChild(this.dropElm),this.dropElm.style.top=`${(h==null?void 0:h.top)??0}px`,this.dropElm.style.left=`${(h==null?void 0:h.left)??0}px`,this.dropElm.style.minWidth="auto",this.dropElm.style.width=`${Xs(this.parentElm,"outer","width")}px`}let e=this.options.minHeight,t=this.options.maxHeight;this.options.maxHeightUnit==="row"&&(t=Xs(this.dropElm.querySelector("ul>li"),"outer","height")*this.options.maxHeight),this.ulElm??(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(h=>{h.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:h,top:d}=wr(this.dropElm),c=this.dropElm.getBoundingClientRect().height;i=h<c&&d>h?"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(){var t;let e=((t=this.dropElm)==null?void 0:t.querySelectorAll(ns))||[];if(this._currentHighlightIndex<=e.length){let i=e[this._currentHighlightIndex];i&&(this.lastFocusedItemKey=i.dataset.key||"",this._currentSelectedElm=i,this.scrolledByMouse=!1,i.scrollIntoView({block:"nearest"}),this.changeCurrentOptionHighlight(i),setTimeout(()=>this.scrolledByMouse=!0,10))}}changeCurrentOptionHighlight(e){var t;e==null||e.classList.add("highlighted"),(((t=this.dropElm)==null?void 0:t.querySelectorAll(ep))||[]).forEach(i=>{i!==e&&i.classList.remove("highlighted")})}moveHighlightDown(){var i,s;let e=((i=this.dropElm)==null?void 0:i.querySelectorAll(ns))||[],t=e.length;this._currentHighlightIndex<t-1?(this._currentHighlightIndex++,(s=e[this._currentHighlightIndex])!=null&&s.classList.contains("disabled")&&this.moveHighlightDown()):this.options.infiniteScroll&&this.infiniteScrollHandler(null,this._currentHighlightIndex,t),this.highlightCurrentOption()}moveHighlightUp(){var i,s;let e=((i=this.dropElm)==null?void 0:i.querySelectorAll(ns))||[],t=this.options.single?0:1;if(this.virtualScroll&&this._currentHighlightIndex<=t&&this.updateDataStart>0&&this.ulElm){let n=e[this._currentHighlightIndex+(this.options.single?0:1)],o=n==null?void 0:n.dataset.key;this.lastFocusedItemKey=o,this.ulElm.scrollTop=this.ulElm.scrollTop-(n==null?void 0:n.getBoundingClientRect().height)||10,this.isMoveUpRecalcRequired=!0;return}this._currentHighlightIndex>0&&(this._currentHighlightIndex--,(s=e[this._currentHighlightIndex])!=null&&s.classList.contains("disabled")&&this.moveHighlightUp()),this.highlightCurrentOption()}recalculateArrowMove(e){var s;let t=((s=this.dropElm)==null?void 0:s.querySelectorAll(ns))||[],i=Array.from(t).findIndex(n=>n.dataset.key===this.lastFocusedItemKey);this._currentHighlightIndex=i-1,e==="down"?this.moveHighlightDown():e==="up"&&(this.moveHighlightUp(),this.isMoveUpRecalcRequired=!1)}close(e){var t,i;this.options.isOpen=!1,this.parentElm.classList.remove("ms-parent-open"),(i=(t=this.choiceElm)==null?void 0:t.querySelector("div.ms-icon-caret"))==null||i.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=typeof this.options.sanitizer=="function"?this.options.sanitizer(t):t:e.textContent=t}update(e=!1){var h;let t=this.getSelects(),i=this.getSelects("text");this.options.displayValues&&(i=t);let s=(h=this.choiceElm)==null?void 0:h.querySelector("span"),n=t.length,o=null,l=()=>{if(this.options.useSelectOptionLabel||this.options.useSelectOptionLabelToHtml){let d=t.join(this.options.displayDelimiter);return this.options.useSelectOptionLabelToHtml?qu(d):d}return i.join(this.options.displayDelimiter)};if(s){if(n===0){let d=this.options.placeholder||"";s.classList.add("ms-placeholder"),this.applyAsTextOrHtmlWhenEnabled(s,d)}else n<this.options.minimumCountSelected?o=l():this.formatAllSelected()&&n===this.dataTotal?o=this.formatAllSelected():this.options.ellipsis&&n>this.options.minimumCountSelected?o=`${i.slice(0,this.options.minimumCountSelected).join(this.options.displayDelimiter)}...`:this.formatCountSelected(n,this.dataTotal)&&n>this.options.minimumCountSelected?o=this.formatCountSelected(n,this.dataTotal):o=l();if(o!==null&&(s==null||s.classList.remove("ms-placeholder"),this.applyAsTextOrHtmlWhenEnabled(s,o)),this.options.showClear&&this.selectClearElm){let d=o?"block":"none";this.selectClearElm.style.display=d}if(this.options.displayTitle){let d=this.options.useSelectOptionLabel||this.options.useSelectOptionLabelToHtml?"value":"text";s.title=this.getSelects(d).join(this.options.displayDelimiter)}}let a=this.getSelects();this.options.single?this.elm.value=a.length?a[0]:"":Array.from(this.elm.options).forEach(d=>{d.selected=a.some(c=>c===d.value)}),e||this.elm.dispatchEvent(new Event("change"))}updateSelected(e){var i,s,n;for(let o=this.updateDataStart;o<this.updateDataEnd;o++){let l=this.updateData[o],a=(i=this.dropElm)==null?void 0:i.querySelector(`input[data-key=${l._key}]`);if(a){a.checked=l.selected;let h=a.closest("li"),d=h==null?void 0:h.querySelector(".icon-checkbox-container div");h&&(l.selected&&!h.classList.contains("selected")?(h.classList.add("selected"),h.ariaSelected="true",d&&(d.className=`ms-icon ms-icon-${a.type==="radio"?"radio":"check"}`)):l.selected||(h.classList.remove("selected"),h.ariaSelected="false",d&&(d.className="ms-icon ms-icon-uncheck")))}}let t=((s=this.data)==null?void 0:s.filter(o=>o.visible).length)===0;if(this.selectAllElm){this.selectAllElm.ariaChecked=String(this.isAllSelected);let o=(n=this.dropElm)==null?void 0:n.querySelector(".ms-select-all .icon-checkbox-container div");if(o){let l="";this.isAllSelected?l="ms-icon-check":this.isPartiallyAllSelected?l="ms-icon-minus":l="ms-icon-uncheck",o.className=`ms-icon ${l}`}this.selectAllElm.checked=this.isAllSelected,Oa(this.selectAllElm.closest("li"),!t)}Oa(this.noResultsElm,t),this.virtualScroll&&(this.virtualScroll.rows=e??this.getListRows())}getData(){return this.options.data}getDataLength(){var e;return((e=this.data)==null?void 0:e.length)??0}getOptions(e=!0){let t=Object.assign({},this.options);return delete t.data,e?Sr(t):this.options}refreshOptions(e){ju(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(e="value"){let t=[];for(let i of this.data||[])if(i.type==="optgroup"){let s=i.children.filter(n=>n==null?void 0:n.selected);if(!s.length)continue;if(e==="value"||this.options.single)t.push(...s.map(n=>e==="value"&&n._value||n[e]));else{let n=[];n.push("["),n.push(i.label),n.push(`: ${s.map(o=>o[e]).join(", ")}`),n.push("]"),t.push(n.join(""))}}else i.selected&&t.push(e==="value"&&i._value||i[e]);return t}setSelects(e,t="value",i=!1){let s=!1,n=o=>{var l;for(let a of o){let h=!1;if(t==="text"){let d=document.createElement("div");this.applyAsTextOrHtmlWhenEnabled(d,a.text),h=e.includes(((l=d.textContent)==null?void 0:l.trim())??"")}else h=e.includes(a._value||a.value),!h&&a.value===`${+a.value}`&&(h=e.includes(+a.value));a.selected!==h&&(s=!0),a.selected=h}};for(let o of this.data||[])o.type==="optgroup"?n(o.children):n([o]);s&&(this.initSelected(i),this.updateSelected(),this.update(i))}enable(){this.choiceElm&&(this.choiceElm.classList.remove("disabled"),this.choiceElm.disabled=!1)}disable(){var e;this.choiceElm&&((e=this.choiceElm)==null||e.classList.add("disabled"),this.choiceElm.disabled=!0)}check(e){let t=js(this.data,"value",e);t&&this._check(t,!0)}uncheck(e){let t=js(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||[])i.type==="optgroup"?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(s=>{s&&!s.disabled&&!s.divider&&(i||s.visible)&&(s.selected=t)}),i||(this.initSelected(),this.updateSelected(),this.update())}checkInvert(){if(!this.options.single){for(let e of this.data||[])if(e.type==="optgroup")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(){var e;(e=this.choiceElm)==null||e.focus(),this.options.onFocus()}blur(){var e;(e=this.choiceElm)==null||e.blur(),this.options.onBlur()}refresh(){this.destroy(!1),this.init()}filter(e){var n;let t=((n=this.searchInputElm)==null?void 0:n.value.trim())??"",i=t.toLowerCase();if(this.filterText===i)return;this.filterText=i;for(let o of this.data||[])if(o.type==="optgroup")if(this.options.filterGroup){let l=`${(o==null?void 0:o.label)??""}`;if(o!=null){let a=this.options.customFilter({label:Ei(l.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalLabel:l,originalSearch:t,row:o});o.visible=a;for(let h of o.children)h&&(h.visible=a)}}else{for(let l of o.children)if(l!=null){let a=`${(l==null?void 0:l.text)??""}`;l.visible=this.options.customFilter({text:Ei(a.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalText:a,originalSearch:t,row:l,parent:o})}o.visible=o.children.filter(l=>l==null?void 0:l.visible).length>0}else{let l=`${(o==null?void 0:o.text)??""}`;o.visible=this.options.customFilter({text:Ei(l.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalText:l,originalSearch:t,row:o})}let s=this.initListItems();this.initSelected(e),this.updateSelected(s),e||this.options.onFilter(t)}adjustDropHeight(e){var d,c,u,p;let t=e!=="top",i=((d=this.filterParentElm)==null?void 0:d.getBoundingClientRect().height)??0,s=((c=this.okButtonElm)==null?void 0:c.getBoundingClientRect().height)??0,n=this.options.single?0:((u=this.selectAllParentElm)==null?void 0:u.getBoundingClientRect().height)??0,o=i+s+n+5,{bottom:l,top:a}=wr(this.parentElm),h=this.options.maxHeight;if(t?h=l-o-this.options.adjustedHeightPadding:h=a-o-this.options.adjustedHeightPadding,!this.options.maxHeight||this.options.maxHeight&&h<this.options.maxHeight){let m=(p=this.dropElm)==null?void 0:p.querySelector("ul");return m&&(m.style.maxHeight=`${h}px`),!0}return!1}adjustDropPosition(e){let t="bottom";if(this.dropElm&&this.parentElm){let{bottom:i,top:s}=wr(this.dropElm),{top:n,left:o}=xr(this.parentElm),l=this.dropElm.getBoundingClientRect().height,a=this.dropElm.getBoundingClientRect().width,h=document.body.offsetWidth||window.innerWidth,d=this.parentElm.getBoundingClientRect().width;if(i>l)t="bottom";else if(l>i&&s>i){if(this.options.container){let c=n-l;c<0&&(c=0),(c>0||e)&&(t="top",this.dropElm.style.top=`${c<0?0:c}px`)}else t="top",this.dropElm.classList.add(t);this.dropElm.classList.remove("bottom")}h-a<o&&(this.dropElm.style.left=`${o-(a-d)}px`)}return t}adjustDropWidthByText(){if(this.dropElm){let e=this.parentElm.scrollWidth;(this.options.dropWidth||this.options.width)&&(e=this.options.dropWidth||this.options.width||0);let t=this.dropElm.querySelector(".ms-select-all span"),i=this.dropElm.querySelector("ul"),s=26,n=(t==null?void 0:t.clientWidth)??0+s,o=i.scrollHeight>i.clientHeight?this.getScrollbarWidth():0,l=0;this.dropElm.querySelectorAll("li label").forEach(a=>{a.scrollWidth>l&&(l=a.scrollWidth)}),l+=s+o,l<n&&(l=n),this.options.maxWidth&&l>this.options.maxWidth&&(l=this.options.maxWidth),this.options.minWidth&&l<this.options.minWidth&&(l=this.options.minWidth),(e==="100%"||+e<l)&&(this.dropElm.style.width=`${l}px`,this.dropElm.style.maxWidth=`${l}px`)}}getScrollbarWidth(){var n;let e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",document.body.appendChild(e);let t=e.offsetWidth;e.style.overflow="scroll";let i=document.createElement("div");i.style.width="100%",e.appendChild(i);let s=i.offsetWidth;return(n=e.parentNode)==null||n.removeChild(e),t-s}formatAllSelected(){return this.options.allSelectedText||this.options.formatAllSelected()}formatCountSelected(e,t){return this.options.countSelectedText?this.options.countSelectedText.replace("#",`${e}`).replace("%",`${t}`):this.options.formatCountSelected(e,t)}formatNoMatchesFound(){return this.options.noMatchesFoundText||this.options.formatNoMatchesFound()}formatOkButton(){return this.options.okButtonText||this.options.formatOkButton()}formatSelectAll(){return this.options.selectAllText||this.options.formatSelectAll()}},wi=(r,e)=>typeof r=="string"?Ir(document.querySelectorAll(r),e):r instanceof Node?Ir([r],e):Ir(r,e);function Ir(r,e){let t=Array.from(r),i=[];for(let s=0;s<t.length;s++){let n=t[s];try{n._multipleSelect!==void 0&&(n._multipleSelect.destroy(),delete n._multipleSelect),n._multipleSelect=new tp(n,e||{}),n._multipleSelect.init();let o=n._multipleSelect.getOptions(!1);o.onHardDestroy=()=>delete n._multipleSelect,o.onAfterHardDestroyed=()=>i[s]=null,i.push(n._multipleSelect)}catch(o){console.error(o)}}return i.length===1?i[0]:i}wi.defaults=ft.DEFAULTS,wi.locales={...ya},wi.methods=ft.METHODS,typeof window<"u"&&(window.multipleSelect=wi);class xa{constructor(e,t,i,s=!0){this.translaterService=e,this.collectionService=t,this.rxjs=i,this._isMultipleSelect=!0,this._collectionLength=0,this._shouldTriggerQuery=!0,this.isFilled=!1,this.enableTranslateLabel=!1,this.subscriptions=[],this._isMultipleSelect=s}get collectionOptions(){var e,t;return((t=(e=this.columnDef)==null?void 0:e.filter)==null?void 0:t.collectionOptions)??{}}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)??{}}get customStructure(){var e,t;return(t=(e=this.columnDef)==null?void 0:e.filter)==null?void 0:t.customStructure}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get defaultOperator(){return this.isMultipleSelect?H.in:H.equal}get filterOptions(){var e,t;return{...(e=this.gridOptions.defaultFilterOptions)==null?void 0:e.select,...(t=this.columnFilter)==null?void 0:t.filterOptions}}get isMultipleSelect(){return this._isMultipleSelect}get msInstance(){return this._msInstance}get selectOptions(){return this.defaultOptions}get operator(){var e;return((e=this.columnFilter)==null?void 0:e.operator)??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}init(e){var s,n,o,l,a,h,d,c,u,p,m;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=((s=this.columnFilter)==null?void 0:s.enableTranslateLabel)??!1,this.labelName=((n=this.customStructure)==null?void 0:n.label)??"label",this.labelPrefixName=((o=this.customStructure)==null?void 0:o.labelPrefix)??"labelPrefix",this.labelSuffixName=((l=this.customStructure)==null?void 0:l.labelSuffix)??"labelSuffix",this.optionLabel=((a=this.customStructure)==null?void 0:a.optionLabel)??"value",this.valueName=((h=this.customStructure)==null?void 0:h.value)??"value",this.enableTranslateLabel&&(!this.translaterService||typeof this.translaterService.translate!="function"))throw new Error('[select-filter] The Translate Service is required for the Select Filter to work correctly when "enableTranslateLabel" is set.');this._locales=((d=this.gridOptions)==null?void 0:d.locales)??R.locales,this.initMultipleSelectTemplate();let t=((c=this.gridOptions)==null?void 0:c.defaultFilterPlaceholder)||"";(u=this.columnFilter)!=null&&u.placeholder&&(t=this.columnFilter.placeholder),this.defaultOptions.placeholder=t||"",this._isMultipleSelect&&((p=this.columnDef)!=null&&p.filter)&&(this.columnDef.filter.emptySearchTermReturnAllValues=((m=this.columnDef.filter)==null?void 0:m.emptySearchTermReturnAllValues)??!1);const i=this.columnFilter.collection||[];return new Promise(async(f,g)=>{try{let _;this.columnFilter.collectionAsync&&!this.columnFilter.collection?(_=zo(this.columnFilter.collectionAsync,this.columnDef,this.renderDomElement.bind(this),this.rxjs,this.subscriptions),f(_)):(_=i,this.renderDomElement(i),f(i)),(this.columnFilter.collectionAsync||this.columnFilter.enableCollectionWatch)&&(await(_??this.columnFilter.collectionAsync),this.watchCollectionChanges())}catch(_){g(_)}})}clear(e=!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(){var e,t;typeof((e=this._msInstance)==null?void 0:e.destroy)=="function"&&this._msInstance.destroy(),(t=this.filterElm)==null||t.remove(),hs(this.subscriptions)}getValues(){var e;return((e=this._msInstance)==null?void 0:e.getSelects())??[]}setValues(e,t,i=!1){e!==void 0&&this._msInstance&&(e=Array.isArray(e)?e.every(s=>Bi(s))?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){var i,s;let t=e;if(this.columnFilter&&this.columnFilter.collectionFilterBy){const n=this.columnFilter.collectionFilterBy,o=((i=this.columnFilter.collectionOptions)==null?void 0:i.filterResultAfterEachPass)||null;t=((s=this.collectionService)==null?void 0:s.filterCollection(t,n,o))||[]}return t}sortCollection(e){var i;let t=e;if(this.columnFilter&&this.columnFilter.collectionSortBy){const s=this.columnFilter.collectionSortBy;t=((i=this.collectionService)==null?void 0:i.sortCollection(this.columnDef,t,s,this.enableTranslateLabel))||[]}return t}watchCollectionChanges(){var e;(e=this.columnFilter)!=null&&e.collection&&(Pi(this.columnFilter.collection,this.watchCallback.bind(this)),ls(this.columnFilter,"collection",this.propertyObserverCallback.bind(this)))}propertyObserverCallback(e){this.renderDomElement(e||[]),this.columnFilter.collection&&Pi(this.columnFilter.collection,this.watchCallback.bind(this))}watchCallback(e){this.renderDomElement(this.columnFilter.collection||e||[])}renderDomElement(e){var n,o,l,a;if(!Array.isArray(e)&&((n=this.collectionOptions)!=null&&n.collectionInsideObjectProperty)){const h=this.collectionOptions.collectionInsideObjectProperty;e=Ee(e,h||"")}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]),(o=this.collectionOptions)!=null&&o.addBlankEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==""&&t.unshift(this.createBlankEntry()),(l=this.collectionOptions)!=null&&l.addCustomFirstEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==this.collectionOptions.addCustomFirstEntry[this.valueName]&&t.unshift(this.collectionOptions.addCustomFirstEntry),(a=this.collectionOptions)!=null&&a.addCustomLastEntry&&Array.isArray(t)&&t.length>0){const h=t.length-1;t[h][this.valueName]!==this.collectionOptions.addCustomLastEntry[this.valueName]&&t.push(this.collectionOptions.addCustomLastEntry)}let i=t;i=this.filterCollection(i),i=this.sortCollection(i);const s=vl("filter",i,this.columnDef,this.grid,this.isMultipleSelect,this.translaterService,this.searchTerms||[]);this.isFilled=s.hasFoundSearchTerm,this.createFilterElement(s.selectElement,s.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){var s;const i=((s=this.columnDef)==null?void 0:s.id)??"";this.elementName=`filter-${i}`,this.defaultOptions.name=this.elementName,J(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=wi(e,this.filterElmOptions)}initMultipleSelectTemplate(){var s,n,o,l,a,h,d,c,u,p,m,f,g;const e=((s=this.gridOptions)==null?void 0:s.enableTranslate)??!1,i={autoAdjustDropHeight:!0,autoAdjustDropPosition:!0,autoAdjustDropWidthByTextSize:!0,name:`${((n=this.columnDef)==null?void 0:n.id)??""}`,container:"body",darkMode:!!this.gridOptions.darkMode,filter:!1,maxHeight:275,single:!0,singleRadio:!0,showSearchClear:!0,renderOptionLabelAsHtml:((o=this.columnFilter)==null?void 0:o.enableRenderHtml)??!1,sanitizer:_=>this.grid.sanitizeHtmlString(_),onClose:()=>this.onTriggerEvent(),onClear:()=>this.clear()};if(this._isMultipleSelect){i.single=!1,i.singleRadio=!1,i.showOkButton=!0,i.displayTitle=!0;const _=ot(this.gridOptions);i.countSelectedText=e&&((l=this.translaterService)!=null&&l.translate)?this.translaterService.translate(`${_}X_OF_Y_SELECTED`):(a=this._locales)==null?void 0:a.TEXT_X_OF_Y_SELECTED,i.allSelectedText=e&&((h=this.translaterService)!=null&&h.translate)?this.translaterService.translate(`${_}ALL_SELECTED`):(d=this._locales)==null?void 0:d.TEXT_ALL_SELECTED,i.noMatchesFoundText=e&&((c=this.translaterService)!=null&&c.translate)?this.translaterService.translate(`${_}NO_MATCHES_FOUND`):(u=this._locales)==null?void 0:u.TEXT_NO_MATCHES_FOUND,i.okButtonText=e&&((p=this.translaterService)!=null&&p.translate)?this.translaterService.translate(`${_}OK`):(m=this._locales)==null?void 0:m.TEXT_OK,i.selectAllText=e&&((f=this.translaterService)!=null&&f.translate)?this.translaterService.translate(`${_}SELECT_ALL`):(g=this._locales)==null?void 0:g.TEXT_SELECT_ALL}this.defaultOptions=i}onTriggerEvent(){if(this._msInstance){const e=this.getValues();this.updateFilterStyle(Array.isArray(e)&&e.length>1||e.length===1&&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){var t,i,s,n,o,l;e?(this.isFilled=!0,(t=this.filterElm)==null||t.classList.add("filled"),(s=(i=this._msInstance)==null?void 0:i.getParentElement())==null||s.classList.add("filled")):(this.isFilled=!1,(n=this.filterElm)==null||n.classList.remove("filled"),(l=(o=this._msInstance)==null?void 0:o.getParentElement())==null||l.classList.remove("filled"))}}class ip extends xa{constructor(e,t,i){super(e,t,i,!0),this.translaterService=e,this.collectionService=t,this.rxjs=i}}class sp extends xa{constructor(e,t,i){super(e,t,i,!1),this.translaterService=e,this.collectionService=t,this.rxjs=i}}class np extends br{constructor(e){super(e),this.translaterService=e,this.sliderType="single"}}class rp extends br{constructor(e){super(e),this.translaterService=e,this.sliderType="double"}}const qs={autocompleter:Kh,compoundDate:uc,compoundInput:ba,compoundInputNumber:Au,compoundInputPassword:Pu,compoundInputText:ba,compoundSlider:Fu,dateRange:Du,input:Ut,inputMask:Mu,inputNumber:Nu,inputPassword:Lu,inputText:Ut,multipleSelect:ip,singleSelect:sp,slider:np,sliderRange:rp};class op{constructor(e,t,i,s){var n;this.config=e,this.translaterService=t,this.collectionService=i,this.rxjs=s,this._options=((n=this.config)==null?void 0:n.options)??{}}addRxJsResource(e){this.rxjs=e}createFilter(e){let t;return e!=null&&e.model&&(t=typeof e.model=="function"?new e.model(this.translaterService,this.collectionService,this.rxjs):e.model),!t&&this._options.defaultFilter&&(t=new this._options.defaultFilter(this.translaterService,this.collectionService,this.rxjs)),t}}const Rr={alwaysShowVerticalScroll:!0,autoEdit:!1,asyncEditorLoading:!1,autoFitColumnsOnFirstLoad:!0,autoFixResizeTimeout:5*60*5,autoFixResizeRequiredGoodCount:2,autoFixResizeWhenBrokenStyleDetected:!1,autoParseInputFilterOperator:!0,autoResize:{applyResizeToContainer:!0,calculateAvailableSizeBy:"window",bottomPadding:20,minHeight:180,minWidth:300,rightPadding:0},cellHighlightCssClass:"slick-cell-modified",checkboxSelector:{cssClass:"slick-cell-checkboxsel",width:40},columnGroupSeparator:" - ",columnPicker:{hideForceFitButton:!1,hideSyncResizeButton:!0,headerColumnValueExtractor:Ia},cellMenu:{autoAdjustDrop:!0,autoAlignSide:!0,hideCloseButton:!0,hideCommandSection:!1,hideOptionSection:!1,showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},compositeEditorOptions:{labels:{cancelButtonKey:"CANCEL",cloneButtonKey:"CLONE",resetEditorButtonTooltipKey:"RESET_INPUT_VALUE",resetFormButtonKey:"RESET_FORM",massSelectionButtonKey:"APPLY_TO_SELECTION",massSelectionStatusKey:"X_OF_Y_MASS_SELECTED",massUpdateButtonKey:"APPLY_MASS_UPDATE",massUpdateStatusKey:"ALL_X_RECORDS_SELECTED",saveButtonKey:"SAVE"}},contextMenu:{autoAdjustDrop:!0,autoAlignSide:!0,hideCloseButton:!0,hideClearAllGrouping:!1,hideCollapseAllGroups:!1,hideCommandSection:!1,hideCopyCellValueCommand:!1,hideExpandAllGroups:!1,hideExportCsvCommand:!1,hideExportExcelCommand:!1,hideExportTextDelimitedCommand:!0,hideMenuOnScroll:!0,hideOptionSection:!1,iconCollapseAllGroupsCommand:"mdi mdi-arrow-collapse",iconExpandAllGroupsCommand:"mdi mdi-arrow-expand",iconClearGroupingCommand:"mdi mdi-close",iconCopyCellValueCommand:"mdi mdi-content-copy",iconExportCsvCommand:"mdi mdi-download",iconExportExcelCommand:"mdi mdi-file-excel-outline",iconExportTextDelimitedCommand:"mdi mdi-download",showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},customFooterOptions:{dateFormat:"YYYY-MM-DD, hh:mm a",hideRowSelectionCount:!1,hideTotalItemCount:!1,hideLastUpdateTimestamp:!0,footerHeight:25,leftContainerClass:"col-xs-12 col-sm-5",rightContainerClass:"col-xs-6 col-sm-7",metricSeparator:"|",metricTexts:{itemsKey:"ITEMS",ofKey:"OF",itemsSelectedKey:"ITEMS_SELECTED"}},customTooltip:{tooltipTextMaxLength:700,maxWidth:500},dataView:{syncGridSelection:{preserveHidden:!1,preserveHiddenOnSelectionChange:!0},syncGridSelectionWithBackendService:!1},datasetIdPropertyName:"id",defaultFilter:qs.input,defaultBackendServiceFilterTypingDebounce:500,enableFilterTrimWhiteSpace:!1,defaultFilterPlaceholder:"🔎︎",defaultFilterRangeOperator:H.rangeInclusive,defaultColumnSortFieldId:"id",draggableGrouping:{hideToggleAllButton:!1,toggleAllButtonText:"",dropPlaceHolderTextKey:"DROP_COLUMN_HEADER_TO_GROUP_BY"},editable:!1,editorTypingDebounce:450,filterTypingDebounce:0,enableEmptyDataWarningMessage:!0,emptyDataWarning:{className:"slick-empty-data-warning",messageKey:"EMPTY_DATA_WARNING_MESSAGE",hideFrozenLeftWarning:!1,hideFrozenRightWarning:!1,leftViewportMarginLeft:"40%",rightViewportMarginLeft:"40%",frozenLeftViewportMarginLeft:"0px",frozenRightViewportMarginLeft:"40%"},enableAutoResize:!0,enableAutoSizeColumns:!0,enableCellNavigation:!1,enableColumnPicker:!0,enableColumnReorder:!0,enableColumnResizeOnDoubleClick:!0,enableContextMenu:!0,enableExcelExport:!1,enableTextExport:!1,enableGridMenu:!0,enableHeaderMenu:!0,enableMouseHoverHighlightRow:!0,enableSorting:!0,enableTextSelectionOnCells:!0,explicitInitialization:!0,excelExportOptions:{addGroupIndentation:!0,autoDetectCellFormat:!0,exportWithFormatter:!1,filename:"export",format:ve.xlsx,groupingColumnHeaderTitle:"Group By",groupCollapsedSymbol:"⮞",groupExpandedSymbol:"⮟",groupingAggregatorRowText:"",sanitizeDataExport:!0},textExportOptions:{delimiter:wt.comma,exportWithFormatter:!1,filename:"export",format:ve.csv,groupingColumnHeaderTitle:"Group By",groupingAggregatorRowText:"",sanitizeDataExport:!0,useUtf8WithBom:!0},eventNamingStyle:ct.lowerCase,forceFitColumns:!1,frozenHeaderWidthCalcDifferential:1,gridMenu:{dropSide:"left",commandLabels:{clearAllFiltersCommandKey:"CLEAR_ALL_FILTERS",clearAllSortingCommandKey:"CLEAR_ALL_SORTING",clearFrozenColumnsCommandKey:"CLEAR_PINNING",exportCsvCommandKey:"EXPORT_TO_CSV",exportExcelCommandKey:"EXPORT_TO_EXCEL",exportTextDelimitedCommandKey:"EXPORT_TO_TAB_DELIMITED",refreshDatasetCommandKey:"REFRESH_DATASET",toggleDarkModeCommandKey:"TOGGLE_DARK_MODE",toggleFilterCommandKey:"TOGGLE_FILTER_ROW",togglePreHeaderCommandKey:"TOGGLE_PRE_HEADER_ROW"},hideClearAllFiltersCommand:!1,hideClearAllSortingCommand:!1,hideClearFrozenColumnsCommand:!0,hideExportCsvCommand:!1,hideExportExcelCommand:!1,hideExportTextDelimitedCommand:!0,hideForceFitButton:!1,hideRefreshDatasetCommand:!1,hideSyncResizeButton:!0,hideToggleFilterCommand:!1,hideToggleDarkModeCommand:!0,hideTogglePreHeaderCommand:!1,iconCssClass:"mdi mdi-menu",iconClearAllFiltersCommand:"mdi mdi-filter-remove-outline",iconClearAllSortingCommand:"mdi mdi-sort-variant-off",iconClearFrozenColumnsCommand:"mdi mdi-pin-off-outline",iconExportCsvCommand:"mdi mdi-download",iconExportExcelCommand:"mdi mdi-file-excel-outline",iconExportTextDelimitedCommand:"mdi mdi-download",iconRefreshDatasetCommand:"mdi mdi-sync",iconToggleDarkModeCommand:"mdi mdi-brightness-4",iconToggleFilterCommand:"mdi mdi-flip-vertical",iconTogglePreHeaderCommand:"mdi mdi-flip-vertical",menuWidth:16,resizeOnShowHeaderRow:!0,showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270",headerColumnValueExtractor:Ia},headerMenu:{autoAlign:!0,autoAlignOffset:4,minWidth:140,iconClearFilterCommand:"mdi mdi-filter-remove-outline",iconClearSortCommand:"mdi mdi-sort-variant-off",iconFilterShortcutSubMenu:"mdi mdi-filter-outline",iconFreezeColumns:"mdi mdi-pin-outline",iconSortAscCommand:"mdi mdi-sort-ascending",iconSortDescCommand:"mdi mdi-sort-descending",iconColumnHideCommand:"mdi mdi-close",iconColumnResizeByContentCommand:"mdi mdi-arrow-expand-horizontal",hideColumnResizeByContentCommand:!1,hideColumnHideCommand:!1,hideClearFilterCommand:!1,hideClearSortCommand:!1,hideFreezeColumnsCommand:!0,hideSortCommands:!1,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},ignoreAccentOnStringFilterAndSort:!1,multiColumnSort:!0,numberedMultiColumnSort:!0,tristateMultiColumnSort:!1,sortColNumberInSeparateSpan:!0,suppressActiveCellChangeOnEdit:!1,pagination:{pageSizes:[10,15,20,25,30,40,50,75,100],pageSize:25,totalItems:0},headerRowHeight:35,rowHeight:35,topPanelHeight:30,translationNamespaceSeparator:":",resetFilterSearchValueAfterOnBeforeCancellation:!0,resizeByContentOnlyOnFirstLoad:!0,resizeByContentOptions:{alwaysRecalculateColumnWidth:!1,cellCharWidthInPx:7.8,cellPaddingWidthInPx:14,defaultRatioForStringType:.88,formatterPaddingWidthInPx:0,maxItemToInspectCellContentWidth:1e3,maxItemToInspectSingleColumnWidthByContent:5e3,widthToRemoveFromExceededWidthReadjustment:50},treeDataOptions:{exportIndentMarginLeft:5,exportIndentationLeadingChar:"͏͏͏͏͏͏͏͏͏·"}};function Ia(r,e){const t=(r==null?void 0:r.columnGroup)||"",i=(e==null?void 0:e.columnGroupSeparator)??" - ";return t?t+i+r.name:(r==null?void 0:r.name)??""}class lp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._sum=0,this._itemCount=0,this._type="sum",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._isTreeAggregator=t,this._isInitialized=!0,this._sum=0,this._itemCount=0,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={},e.__treeTotals.count={}),e.__treeTotals.count[this._field]=0,e.__treeTotals[this._type][this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator?t?(e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals),this._sum=parseFloat(e.__treeTotals[this._type][this._field]??0),this._itemCount=e.__treeTotals.count[this._field]??0):U(i)&&(this._sum=parseFloat(i),this._itemCount=1):U(i)&&(this._sum+=parseFloat(i))}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),this.addGroupTotalPropertiesWhenNotExist(e);let t=this._sum,i=this._itemCount;this._isTreeAggregator&&(t+=e[this._type][this._field],i+=e.count[this._field],e.count[this._field]=i),e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={}),this._isTreeAggregator&&e.count===void 0&&(e.count={})}}class ap{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._max=null,this._type="max",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._max=null,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=null)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;if(!this._isTreeAggregator)this.keepMaxValueWhenFound(i);else if(t){e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals);const s=e.__treeTotals[this._type][this._field]!==null?parseFloat(e.__treeTotals[this._type][this._field]):null;s!==null&&U(s)&&(this._max===null||s>this._max)&&(this._max=s)}else U(i)&&this.keepMaxValueWhenFound(i)}storeResult(e){let t=this._max;if(this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&t!==null){const i=e[this._type][this._field];U(i)&&i>t&&(t=i)}e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={})}keepMaxValueWhenFound(e){U(e)&&(this._max===null||e>this._max)&&(this._max=parseFloat(e))}}class hp{constructor(e){this._isInitialized=!1,this._distinctValues=[],this._type="distinct",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){if(this._distinctValues=[],this._isInitialized=!0,t)throw new Error("[Slickgrid-Universal] CloneAggregator is not currently supported for use with Tree Data")}accumulate(e){const t=e&&e.hasOwnProperty(this._field)?e[this._field]:void 0;this._distinctValues.indexOf(t)===-1&&t!==void 0&&this._distinctValues.push(t)}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),e[this._type][this._field]=this._distinctValues}}class dp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._min=null,this._type="min",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._min=null,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=null)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;if(!this._isTreeAggregator)this.keepMinValueWhenFound(i);else if(t){e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals);const s=e.__treeTotals[this._type][this._field]!==null?parseFloat(e.__treeTotals[this._type][this._field]):null;s!==null&&U(s)&&(this._min===null||s<this._min)&&(this._min=s)}else U(i)&&this.keepMinValueWhenFound(i)}storeResult(e){let t=this._min;if(this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&t!==null){const i=e[this._type][this._field];U(i)&&i<t&&(t=i)}e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={})}keepMinValueWhenFound(e){U(e)&&(this._min===null||e<this._min)&&(this._min=parseFloat(e))}}class cp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._count=0,this._type="count",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._count=0,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator&&(t?(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),this._count=e.__treeTotals[this._type][this._field]??0):U(i)&&(this._count=1))}storeResult(e){var i;(!e||e[this._type]===void 0)&&(e[this._type]={});let t=this._count;this._isTreeAggregator?t+=e[this._type][this._field]:t=((i=e.group)==null?void 0:i.rows.length)??0,e[this._type][this._field]=t}}class up{constructor(e){this._isInitialized=!1,this._data="",this._type="clone",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){if(this._data="",this._isInitialized=!0,t)throw new Error("[Slickgrid-Universal] CloneAggregator is not currently supported for use with Tree Data")}accumulate(e){const t=e&&e.hasOwnProperty(this._field)?e[this._field]:null;t!==null&&t!==""&&(this._data=t)}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),e[this._type][this._field]=this._data}}class pp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._nonNullCount=0,this._sum=0,this._type="avg",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._sum=0,this._nonNullCount=0,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={},e.__treeTotals.sum={},e.__treeTotals.count={}),e.__treeTotals[this._type][this._field]=0,e.__treeTotals.count[this._field]=0,e.__treeTotals.sum[this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator?t?(e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals),this._sum=parseFloat(e.__treeTotals.sum[this._field]??0),this._nonNullCount=e.__treeTotals.count[this._field]??0):U(i)&&(this._sum=parseFloat(i),this._nonNullCount=1):U(i)&&(this._nonNullCount++,this._sum+=parseFloat(i))}storeResult(e){let t=this._sum,i=this._nonNullCount;this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&(t+=e.sum[this._field],i+=e.count[this._field],e.sum[this._field]=t,e.count[this._field]=i),i!==0&&(e[this._type][this._field]=i===0?t:t/i)}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={}),this._isTreeAggregator&&e.sum===void 0&&(e.sum={}),this._isTreeAggregator&&e.count===void 0&&(e.count={})}}const Ar={Avg:pp,Clone:up,Count:cp,Distinct:hp,Min:dp,Max:ap,Sum:lp};function Ks(r,e){const t=e.errorMessage,i=e.required,s=e.minLength,n=e.maxLength,o=e.operatorConditionalType||"inclusive",l={"{{minLength}}":s,"{{maxLength}}":n};let a=!0,h="";const d=(r==null?void 0:r.length)??0;if(e.validator)return e.validator(r,e.editorArgs);if(i&&r==="")a=!1,h=t||R.VALIDATION_REQUIRED_FIELD;else if(s!==void 0&&n!==void 0&&(o==="exclusive"&&(d<=s||d>=n)||o==="inclusive"&&(d<s||d>n)))a=!1,h=t||R.VALIDATION_EDITOR_TEXT_LENGTH_BETWEEN.replace(/{{minLength}}|{{maxLength}}/gi,c=>l[c]);else if(s!==void 0&&d!==null&&(o==="exclusive"&&d<=s||o==="inclusive"&&d!==null&&d<s)){a=!1;const c=o==="inclusive"?R.VALIDATION_EDITOR_TEXT_MIN_LENGTH_INCLUSIVE:R.VALIDATION_EDITOR_TEXT_MIN_LENGTH;h=t||c.replace(/{{minLength}}/gi,u=>l[u])}else if(n!==void 0&&d!==null&&(o==="exclusive"&&d>=n||o==="inclusive"&&d!==null&&d>n)){a=!1;const c=o==="inclusive"?R.VALIDATION_EDITOR_TEXT_MAX_LENGTH_INCLUSIVE:R.VALIDATION_EDITOR_TEXT_MAX_LENGTH;h=t||c.replace(/{{maxLength}}/gi,u=>l[u])}return{valid:a,msg:h}}const mp=3;class fp{constructor(e){var t;if(this.args=e,this._isValueTouched=!1,this._lastTriggeredByClearInput=!1,this.disabled=!1,this.forceUserInput=!1,this.finalCollection=[],!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this._bindEventService=new Ae,(t=this.gridOptions)!=null&&t.translater&&(this._translater=this.gridOptions.translater),this._locales=this.gridOptions&&this.gridOptions.locales||R.locales,this.init()}get autocompleterOptions(){return this._autocompleterOptions||{}}get collection(){var e;return((e=this.columnEditor)==null?void 0:e.collection)??[]}get editorDomElement(){return this._inputElm}get elementCollection(){return this._elementCollection}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get customStructure(){var i,s,n,o,l;let e=(i=this.columnEditor)==null?void 0:i.customStructure;const t=((s=this.columnEditor)==null?void 0:s.type)??((n=this.columnDef)==null?void 0:n.type);return!e&&t===S.object&&((o=this.columnDef)!=null&&o.dataKey)&&((l=this.columnDef)!=null&&l.labelKey)&&(e={label:this.columnDef.labelKey,value:this.columnDef.dataKey}),e}get dataContext(){return this.args.item}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.autocompleter,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get instance(){return this._instance}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var t,i,s,n,o,l;this.labelName=((t=this.customStructure)==null?void 0:t.label)??"label",this.valueName=((i=this.customStructure)==null?void 0:i.value)??"value",this.labelPrefixName=((s=this.customStructure)==null?void 0:s.labelPrefix)??"labelPrefix",this.labelSuffixName=((n=this.customStructure)==null?void 0:n.labelSuffix)??"labelSuffix";let e=this.columnEditor.collection;(o=this.columnEditor)!=null&&o.collectionAsync&&!e&&(e=[]),this.renderDomElement(e),(this.disabled||(l=this.columnEditor)!=null&&l.collectionAsync&&Array.isArray(e)&&e.length===0)&&this.disable(!0)}destroy(){var e,t,i;this._bindEventService.unbindAll(),typeof((e=this._instance)==null?void 0:e.destroy)=="function"&&this._instance.destroy(),(i=(t=this._inputElm)==null?void 0:t.remove)==null||i.call(t),this._elementCollection=null}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._inputElm)if(e){this._inputElm.disabled=!0;const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.clear(!0)}else this._inputElm.disabled=!1}focus(){this.grid.focus(),this._inputElm&&(this._inputElm.focus(),this._inputElm.select())}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){return this._inputElm.value}setValue(e,t=!1,i=!0){if(this._inputElm.value=e!=null&&e.hasOwnProperty(this.labelName)?e[this.labelName]:e,t){this._currentValue=e,this._defaultTextValue=typeof e=="string"?e:(e==null?void 0:e[this.labelName])??"",this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var n,o;let i=t;const s=(n=this.columnDef)==null?void 0:n.field;if(s!==void 0){Array.isArray(this.collection)&&this.collection.length>0&&(i=xt(this.collection,h=>h&&Ht(t)&&h.hasOwnProperty(this.valueName)?h[this.valueName].toString()===(t.hasOwnProperty(this.valueName)&&t[this.valueName].toString()):h&&typeof t=="string"&&h.hasOwnProperty(this.valueName)?h[this.valueName].toString()===t:(h==null?void 0:h.toString())===t,""));const l=(s==null?void 0:s.indexOf("."))>0,a=this.validate(null,i);if(i=a!=null&&a.valid?i:"",l){const h=((o=this.columnEditor)==null?void 0:o.complexObjectPath)??s??"";$e(e,h,i)}else e[s]=i}}isValueChanged(){var s,n;const e=this._inputElm.value,t=(s=this._lastInputKeyEvent)==null?void 0:s.key;if((n=this.columnEditor)!=null&&n.alwaysSaveOnEnterKey&&t==="Enter")return!0;const i=!(e===""&&(this._defaultTextValue===null||this._defaultTextValue===void 0))&&e!==this._defaultTextValue;return this._lastTriggeredByClearInput||i}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._currentValue=n,this._originalValue=n,this._defaultTextValue=typeof n=="string"?n:(n==null?void 0:n[this.labelName])??"",this._inputElm.value=this._defaultTextValue,this._inputElm.select()}}clear(e=!1){this._inputElm&&(this._currentValue="",this._defaultTextValue="",this.setValue("",!0)),this._isValueTouched=!0,this._lastTriggeredByClearInput=!0;const t=this.args.compositeEditorOptions;if(t){const i=!e;this.handleChangeOnCompositeEditor(null,t,"user",i)}else this.save()}reset(e,t=!0,i=!1){const s=e??this._originalValue??"";this._inputElm&&(this._currentValue=s,this._defaultTextValue=typeof s=="string"?s:(s==null?void 0:s[this.labelName])??"",this._inputElm.value=this._defaultTextValue),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e,t,i,s,n;if(this._inputElm&&this.editorOptions.forceUserInput){const o=((e=this.editorOptions)==null?void 0:e.minLength)??mp;this._currentValue=this._inputElm.value.length>o?this._inputElm.value:this._currentValue}return this.customStructure&&this._currentValue&&this._currentValue.hasOwnProperty(this.valueName)&&((t=this.columnDef)==null?void 0:t.type)!==S.object&&((i=this.columnEditor)==null?void 0:i.type)!==S.object?this._currentValue[this.valueName]:this._currentValue&&this._currentValue.value!==void 0?((s=this.columnDef)==null?void 0:s.type)===S.object||((n=this.columnEditor)==null?void 0:n.type)===S.object?{[this.labelName]:this._currentValue.label,[this.valueName]:this._currentValue.value}:this._currentValue.value:this._currentValue}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._inputElm)==null?void 0:s.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleSelect(e){var t;if(e!==void 0){const s=e;this._currentValue=s,this._isValueTouched=!0;const n=this.args.compositeEditorOptions,o=((t=this.editorOptions)==null?void 0:t.renderItem)??!1,l=typeof s=="string"?s:o?s[this.labelName]:s.label;if(this.setValue(l),n?this.handleChangeOnCompositeEditor(null,n):this.save(),typeof this.editorOptions.onSelectItem=="function"){const{row:a,cell:h}=this.grid.getActiveCell()||{};this.editorOptions.onSelectItem(e,a,h,this.args.column,this.args.item)}setTimeout(()=>this._lastTriggeredByClearInput=!1)}return!1}renderRegularItem(e){const t=typeof e=="string"?e:(e==null?void 0:e.label)??"";return v("div",{textContent:t||""})}renderCustomItem(e){var s,n;const t=((n=(s=this._autocompleterOptions)==null?void 0:s.renderItem)==null?void 0:n.templateCallback(e))??"",i=document.createElement("div");return this.grid.applyHtmlCode(i,t),i}renderCollectionItem(e){var h;const t=((h=this.columnEditor)==null?void 0:h.enableRenderHtml)??!1,i=e.labelPrefix||"",s=e.label||"",n=e.labelSuffix||"",o=i+s+n,l=this.grid.sanitizeHtmlString(o)||"",a=document.createElement("div");return a[t?"innerHTML":"textContent"]=l,a}renderDomElement(e){var l,a,h,d,c,u,p,m,f,g,_,b;const t=((l=this.columnDef)==null?void 0:l.id)??"",i=((a=this.columnEditor)==null?void 0:a.placeholder)??"",s=((h=this.columnEditor)==null?void 0:h.title)??"";this._editorInputGroupElm=v("div",{className:"autocomplete-container input-group"});const n=v("span",{className:"input-group-btn input-group-append",dataset:{clear:""}});this._clearButtonElm=v("button",{type:"button",className:"btn btn-default btn-clear"}),this._clearButtonElm.appendChild(v("i",{className:"icon-clear"})),this._inputElm=v("input",{type:"text",placeholder:i,title:s,autocomplete:"off",ariaAutoComplete:"none",className:`autocomplete form-control editor-text input-group-editor editor-${t}`,dataset:{input:""}},this._editorInputGroupElm),this._editorInputGroupElm.appendChild(document.createElement("span")),(d=this.editorOptions)!=null&&d.hideClearButton||(n.appendChild(this._clearButtonElm),this._editorInputGroupElm.appendChild(n),this._bindEventService.bind(this._clearButtonElm,"click",()=>this.clear())),this._bindEventService.bind(this._inputElm,"focus",()=>{var C;return(C=this._inputElm)==null?void 0:C.select()}),this._bindEventService.bind(this._inputElm,"keydown",C=>{this._lastInputKeyEvent=C,(C.key==="ArrowLeft"||C.key==="ArrowRight")&&C.stopImmediatePropagation(),C.key==="Enter"&&C.target.value===""&&this.columnEditor.alwaysSaveOnEnterKey&&(this._currentValue=null)});let o=e;if(o&&((c=this.columnEditor)!=null&&c.collectionOverride)){const C={column:this.columnDef,dataContext:this.dataContext,grid:this.grid,originalCollections:this.collection};if(this.args.compositeEditorOptions){const{formValues:E,modalType:y}=this.args.compositeEditorOptions;C.compositeEditorOptions={formValues:E,modalType:y}}o=this.columnEditor.collectionOverride(o,C)}o&&(this.finalCollection=o),Array.isArray(o)&&(this.collection.every(C=>Bi(C))?o=o.map(C=>({label:C,value:C})):o=o.map(C=>({label:C==null?void 0:C[this.labelName],value:C==null?void 0:C[this.valueName],labelPrefix:(C==null?void 0:C[this.labelPrefixName])??"",labelSuffix:(C==null?void 0:C[this.labelSuffixName])??""})),this._elementCollection=o),this._autocompleterOptions={input:this._inputElm,debounceWaitMs:200,className:`slick-autocomplete ${((u=this.editorOptions)==null?void 0:u.className)??""}`.trim(),emptyMsg:this.gridOptions.enableTranslate&&((p=this._translater)!=null&&p.translate)?this._translater.translate("NO_ELEMENTS_FOUND"):((m=this._locales)==null?void 0:m.TEXT_NO_ELEMENTS_FOUND)??"No elements found",customize:(C,E,y)=>{y.style.width=""},onSelect:this.handleSelect.bind(this),...this.editorOptions},(f=this.gridOptions)!=null&&f.darkMode&&(this._autocompleterOptions.className+=" slick-dark-mode"),this.autocompleterOptions.className=he(this.autocompleterOptions.className).join(" "),(g=this._autocompleterOptions.renderItem)!=null&&g.layout?(this._autocompleterOptions.className+=` autocomplete-custom-${ui(this._autocompleterOptions.renderItem.layout)}`,this._autocompleterOptions.render=this.renderCustomItem.bind(this)):Array.isArray(e)?this._autocompleterOptions.render=((_=this._autocompleterOptions.render)==null?void 0:_.bind(this))??this.renderCollectionItem.bind(this):this._autocompleterOptions.render||(this._autocompleterOptions.render=this.renderRegularItem.bind(this)),(b=this._autocompleterOptions)!=null&&b.fetch?(Bo(this._inputElm,this._autocompleterOptions),this._instance=fs(this._autocompleterOptions)):this._instance=fs({...this._autocompleterOptions,fetch:(C,E)=>{o&&E(o.filter(y=>((typeof y=="string"?y:y==null?void 0:y.label)||"").toLowerCase().includes(C.toLowerCase())))}}),this.args.container.appendChild(this._editorInputGroupElm),this.args.compositeEditorOptions||setTimeout(()=>this.focus(),50)}}class gp{constructor(e){if(this.args=e,this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._input}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var s,n,o,l;const e=((s=this.columnDef)==null?void 0:s.id)??"",t=this.args.compositeEditorOptions;this._checkboxContainerElm=v("div",{className:`checkbox-editor-container editor-${e}`}),this._input=v("input",{type:"checkbox",value:"true",ariaLabel:((n=this.columnEditor)==null?void 0:n.ariaLabel)??`${_t(e+"")} Checkbox Editor`,className:`editor-checkbox editor-${e}`,title:((o=this.columnEditor)==null?void 0:o.title)??""});const i=(l=this.args)==null?void 0:l.container;i&&typeof i.appendChild=="function"&&(t?(this._checkboxContainerElm.appendChild(this._input),i.appendChild(this._checkboxContainerElm)):i.appendChild(this._input)),this.hasAutoCommitEdit&&!t&&this._bindEventService.bind(this._input,"click",()=>{this._isValueTouched=!0,this.save()}),t?this._bindEventService.bind(this._input,"change",a=>{this._isValueTouched=!0,this.handleChangeOnCompositeEditor(a,t)}):this.focus()}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._input)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._input)if(e){this._input.setAttribute("disabled","disabled"),this._checkboxContainerElm.classList.add("disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==!1&&this.reset(!1,!0,!0)}else this._input.removeAttribute("disabled"),this._checkboxContainerElm.classList.remove("disabled")}focus(){var e;this.grid.focus(),(e=this._input)==null||e.focus()}preClick(){this._input&&(this._input.checked=!this._input.checked)}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){var e;return((e=this._input)==null?void 0:e.checked)??!1}setValue(e,t=!1,i=!0){const s=!!e;if(this._input&&(this._input.checked=s),t){this.applyValue(this.args.item,this.serializeValue());const n=this.args.compositeEditorOptions;n&&i&&this.handleChangeOnCompositeEditor(null,n,"system")}}applyValue(e,t){var s;const i=this.columnDef&&this.columnDef.field;if(i!==void 0){const n=(i==null?void 0:i.indexOf("."))>0,o=this.validate(null,t),l=o&&o.valid?t:"";if(n){const a=((s=this.columnEditor)==null?void 0:s.complexObjectPath)??i??"";$e(e,a,l)}else e[i]=l}}isValueChanged(){return this.serializeValue()!==this._originalValue}isValueTouched(){return this._isValueTouched}loadValue(e){const t=this.columnDef&&this.columnDef.field;if(e&&t!==void 0&&this._input){const s=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=s,this._input.checked=!!this._originalValue}}reset(e,t=!0,i=!1){const s=e??this._originalValue??!1;this._input&&(this._originalValue=s,this._input.checked=!!s),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=e&&e.valid||!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e;return((e=this._input)==null?void 0:e.checked)??!1}validate(e,t){var o,l;const i=(o=this.args)!=null&&o.compositeEditorOptions?!1:this.columnEditor.required,s=t!==void 0?t:(l=this._input)==null?void 0:l.checked,n=this.columnEditor.errorMessage;return this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled?{valid:!0,msg:""}:this.validator?this.validator(s,this.args):i&&!s?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:{valid:!0,msg:null}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}}class _p{constructor(e){var t;if(this.args=e,this._isValueTouched=!1,this._lastClickIsDate=!1,this._lastTriggeredByClearDate=!1,this.hasTimePicker=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},(t=this.gridOptions)!=null&&t.translater&&(this._translaterService=this.gridOptions.translater),this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._inputElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.date,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get pickerOptions(){return this._pickerMergedOptions}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}async init(){var e,t,i,s,n,o,l;if(this.args&&this.columnDef){const a=this.args.compositeEditorOptions,h=((e=this.columnDef)==null?void 0:e.id)??"",d=this.args.grid.getOptions()||{};this.defaultDate=(t=this.args.item)==null?void 0:t[this.columnDef.field];const c=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,u=Ze(c),p=((s=(i=this._translaterService)==null?void 0:i.getCurrentLanguage)==null?void 0:s.call(i))||d.locale||"en";u&&(u==="ISO8601"||u.toLowerCase().includes("h"))&&(this.hasTimePicker=!0);const m=Ze(this.hasTimePicker?S.dateTimeIsoAM_PM:S.dateIso),f={input:!0,jumpToSelectedDate:!0,sanitizer:b=>this.grid.sanitizeHtmlString(b),toggleSelected:!1,actions:{clickDay:()=>{this._lastClickIsDate=!0},changeToInput:(b,C)=>{if(C.HTMLInputElement){let E="";if(C.selectedDates[0]?(E=C.selectedDates[0],C.HTMLInputElement.value=Ct(C.selectedDates[0],void 0,c)):C.HTMLInputElement.value="",E&&this.hasTimePicker){const y=ms(E,m);y.setHours(+(C.selectedHours||0)),y.setMinutes(+(C.selectedMinutes||0)),C.HTMLInputElement.value=Ct(y,void 0,c)}this._lastClickIsDate&&(this.handleOnDateChange(),C.hide())}}},settings:{lang:p,iso8601:!1,visibility:{theme:(n=this.gridOptions)!=null&&n.darkMode?"dark":"light",positionToInput:"auto",weekend:!1}}};this.hasTimePicker&&(f.settings.selection={time:24}),this._pickerMergedOptions=de(!0,{},f,{settings:this.editorOptions,type:"default"});const g=`.editor-text.date-picker.editor-${h}.form-control.input-group-editor`;this._editorInputGroupElm=v("div",{className:"vanilla-picker input-group"});const _=v("span",{className:"input-group-btn input-group-append",dataset:{clear:""}});this._clearButtonElm=v("button",{type:"button",className:"btn btn-default btn-clear"}),this._clearButtonElm.appendChild(v("i",{className:"icon-clear"})),this._inputElm=v("input",{placeholder:((o=this.columnEditor)==null?void 0:o.placeholder)??"",title:this.columnEditor&&this.columnEditor.title||"",className:g.replace(/\./g," "),dataset:{input:"",defaultdate:this.defaultDate},readOnly:!0},this._editorInputGroupElm),this.args.container.appendChild(this._editorInputGroupElm),(l=this.columnEditor.editorOptions)!=null&&l.hideClearButton||(_.appendChild(this._clearButtonElm),this._editorInputGroupElm.appendChild(_),this._bindEventService.bind(this._clearButtonElm,"click",()=>{this.clear(),this.handleOnDateChange()})),queueMicrotask(()=>{this.calendarInstance=new gl(this._inputElm,this._pickerMergedOptions),this.calendarInstance.init(),a||(this.show(),this.focus()),this.calendarInstance&&$i(this.columnEditor,this._inputElm,this.calendarInstance,{columnDef:this.columnDef,oldVal:this.getValue(),newVal:this.defaultDate,updatePickerUI:!0})})}}destroy(){queueMicrotask(()=>{var e,t,i;this.hide(),(e=this.calendarInstance)==null||e.destroy(),J(this._editorInputGroupElm),J(this._inputElm),(t=this._editorInputGroupElm)==null||t.remove(),(i=this._inputElm)==null||i.remove()}),this._bindEventService.unbindAll()}clear(){this._lastTriggeredByClearDate=!0,this.calendarInstance&&(this.calendarInstance.settings.selected.dates=[],this._inputElm.value="")}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._inputElm)if(e){this._inputElm.setAttribute("disabled","disabled"),this._clearButtonElm.disabled=!0;const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._inputElm.removeAttribute("disabled"),this._clearButtonElm.disabled=!1}changeEditorOption(e,t){this.columnEditor.editorOptions||(this.columnEditor.editorOptions={}),this.columnEditor.editorOptions[e]=t,this._pickerMergedOptions=de(!0,{},this._pickerMergedOptions,{settings:{[e]:t}})}focus(){var e;this.grid.focus(),this.show(),(e=this._inputElm)==null||e.focus()}hide(){var e;(e=this.calendarInstance)==null||e.hide()}show(){var t;const e=!!((t=this.args)!=null&&t.compositeEditorOptions);!e&&this.calendarInstance?this.calendarInstance.show():e&&this.applyInputUsabilityState()}getValue(){return this._inputElm.value}setValue(e,t=!1,i=!0){if(this.calendarInstance&&$i(this.columnEditor,this._inputElm,this.calendarInstance,{columnDef:this.columnDef,oldVal:this.getValue(),newVal:e,updatePickerUI:!0}),t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(s,"system")}}applyValue(e,t){var s,n;const i=(s=this.columnDef)==null?void 0:s.field;if(this.columnDef&&i!==void 0){const o=this.columnDef.saveOutputType||this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,l=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,a=i.indexOf(".")>0,h=this.validate(null,t),d=t&&(h!=null&&h.valid)?Ct(t,l,o):"";if(a){const c=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??i;$e(e,c,d)}else e[i]=d}}isValueChanged(){let e=!1;const t=this.getValue();return this.columnDef&&(e=this._lastTriggeredByClearDate||!(t===""&&this._originalDate==="")&&t!==this._originalDate),e}isValueTouched(){return this._isValueTouched}loadValue(e){var i,s;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&this.columnDef&&t!==void 0){const o=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t],l=this.columnEditor.type||((s=this.columnDef)==null?void 0:s.type)||S.dateIso,a=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateIso;this._originalDate=Ct(o,l,a),this._inputElm.value=this._originalDate}}reset(e,t=!0,i=!1){const s=e??this._originalDate??"";this.calendarInstance&&(this._originalDate=s,this.calendarInstance.settings.selected.dates=[s],s||(this.calendarInstance.settings.selected.dates=[],this._inputElm.value="")),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){const e=this.getValue();return e||""}validate(e,t){var o,l;const i=(o=this.args)!=null&&o.compositeEditorOptions?!1:this.columnEditor.required,s=t??((l=this._inputElm)==null?void 0:l.value),n=this.columnEditor.errorMessage;return this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled?{valid:!0,msg:""}:this.validator?this.validator(s,this.args):i&&s===""?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:{valid:!0,msg:null}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleOnDateChange(){if(this._isValueTouched=!0,this.args){const e=this.args.compositeEditorOptions;e?this.handleChangeOnCompositeEditor(e):this.save()}setTimeout(()=>this._lastTriggeredByClearDate=!1)}handleChangeOnCompositeEditor(e,t="user",i=!1){var c,u,p;const s=this.grid.getActiveCell(),n=this.args.column,o=((c=this.columnDef)==null?void 0:c.id)??"",l=this.dataContext,a=this.grid,h=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,h),this.applyValue(e.formValues,h);const d=((p=(u=this.gridOptions)==null?void 0:u.compositeEditorOptions)==null?void 0:p.excludeDisabledFieldFormValues)??!1;(i||this.disabled&&d&&e.formValues.hasOwnProperty(o))&&delete e.formValues[o],a.onCompositeEditorChange.notify({...s,item:l,grid:a,column:n,formValues:e.formValues,editors:e.editors,triggeredBy:t},new le)}}function Ra(r,e){const t=isNaN(r)?null:parseFloat(r),i=e.decimal||0,s=e.required,n=e.minValue,o=e.maxValue,l=e.operatorConditionalType||"inclusive",a=e.errorMessage,h={"{{minValue}}":n,"{{maxValue}}":o,"{{minDecimal}}":0,"{{maxDecimal}}":i};let d=!0,c="";if(typeof e.validator=="function")return e.validator(r,e.editorArgs);if(s&&r==="")d=!1,c=a||R.VALIDATION_REQUIRED_FIELD;else if(r!==""&&(isNaN(r)||i===0&&!/^[-+]?(\d*(\.)?(\d)*)$/.test(r)))d=!1,c=a||R.VALIDATION_EDITOR_VALID_NUMBER;else if(n!==void 0&&o!==void 0&&t!==null&&(l==="exclusive"&&(t<=+n||t>=+o)||l==="inclusive"&&(t<+n||t>+o)))d=!1,c=a||R.VALIDATION_EDITOR_NUMBER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,u=>h[u]);else if(n!==void 0&&t!==null&&(l==="exclusive"&&t<=+n||l==="inclusive"&&t<+n)){d=!1;const u=l==="inclusive"?R.VALIDATION_EDITOR_NUMBER_MIN_INCLUSIVE:R.VALIDATION_EDITOR_NUMBER_MIN;c=a||u.replace(/{{minValue}}/gi,p=>h[p])}else if(o!==void 0&&t!==null&&(l==="exclusive"&&t>=+o||l==="inclusive"&&t>+o)){d=!1;const u=l==="inclusive"?R.VALIDATION_EDITOR_NUMBER_MAX_INCLUSIVE:R.VALIDATION_EDITOR_NUMBER_MAX;c=a||u.replace(/{{maxValue}}/gi,p=>h[p])}else i>0&&!new RegExp(`^[-+]?(\\d*(\\.)?(\\d){0,${i}})$`).test(r)&&(d=!1,c=a||R.VALIDATION_EDITOR_DECIMAL_BETWEEN.replace(/{{minDecimal}}|{{maxDecimal}}/gi,u=>h[u]));return{valid:d,msg:c}}function Aa(r,e){let t=isNaN(r)?null:parseInt(r,10);t!==null&&isNaN(t)&&(t=null);const i=e.errorMessage,s=e.required,n=e.minValue,o=e.maxValue,l=e.operatorConditionalType||"inclusive",a={"{{minValue}}":n,"{{maxValue}}":o};let h=!0,d="";if(e.validator)return e.validator(r,e.editorArgs);if(s&&r==="")h=!1,d=i||R.VALIDATION_REQUIRED_FIELD;else if(r!==""&&(isNaN(r)||!/^[+-]?\d+$/.test(r)))h=!1,d=i||R.VALIDATION_EDITOR_VALID_INTEGER;else if(n!==void 0&&o!==void 0&&t!==null&&(l==="exclusive"&&(t<=+n||t>=+o)||l==="inclusive"&&(t<+n||t>+o)))h=!1,d=i||R.VALIDATION_EDITOR_INTEGER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,c=>a[c]);else if(n!==void 0&&t!==null&&(l==="exclusive"&&t<=+n||l==="inclusive"&&t!==null&&t<+n)){h=!1;const c=l==="inclusive"?R.VALIDATION_EDITOR_INTEGER_MIN_INCLUSIVE:R.VALIDATION_EDITOR_INTEGER_MIN;d=i||c.replace(/{{minValue}}/gi,u=>a[u])}else if(o!==void 0&&t!==null&&(l==="exclusive"&&t>=+o||l==="inclusive"&&t!==null&&t>+o)){h=!1;const c=l==="inclusive"?R.VALIDATION_EDITOR_INTEGER_MAX_INCLUSIVE:R.VALIDATION_EDITOR_INTEGER_MAX;d=i||c.replace(/{{maxValue}}/gi,u=>a[u])}return{valid:h,msg:d}}function Cp(r,e){const t=e.required,i=e.minValue,s=e.maxValue,n=e.errorMessage,o={"{{minValue}}":i,"{{maxValue}}":s};return e.validator?e.validator(r,e.editorArgs):t&&r===""?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:i!==void 0&&s!==void 0&&r!==null&&(r<i||r>s)?{valid:!1,msg:n||R.VALIDATION_EDITOR_NUMBER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,l=>o[l])}:{valid:!0,msg:null}}class vp{constructor(e){if(this.args=e,this._isValueSaveCalled=!1,this._isLeftValueTouched=!1,this._isRightValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},this._eventHandler=new pe,this._bindEventService=new Ae,this.init(),this._eventHandler.subscribe(this.grid.onValidationError,()=>this._isValueSaveCalled=!0)}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return{leftInput:this._leftInput,rightInput:this._rightInput}}get editorParams(){return this.columnEditor.params||{}}get eventHandler(){return this._eventHandler}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get isValueSaveCalled(){return this._isValueSaveCalled}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var i,s,n,o;if(!this.editorParams||!this.editorParams.leftInput||!this.editorParams.leftInput.field||!this.editorParams.rightInput||!this.editorParams.rightInput.field)throw new Error(`[Slickgrid-Universal] Please make sure that your Combo Input Editor has params defined with "leftInput" and "rightInput" (example: { editor: { model: Editors.comboInput, params: { leftInput: { field: 'firstName' }, { rightSide: { field: 'lastName' } }}}`);this._leftFieldName=(i=this.editorParams.leftInput)==null?void 0:i.field,this._rightFieldName=(s=this.editorParams.rightInput)==null?void 0:s.field,this._leftInput=this.createInput("leftInput"),this._rightInput=this.createInput("rightInput");const e=(n=this.args)==null?void 0:n.container;e&&typeof e.appendChild=="function"&&(e.appendChild(this._leftInput),e.appendChild(this._rightInput)),this._bindEventService.bind(this._leftInput,"keydown",l=>this.handleKeyDown(l,"leftInput")),this._bindEventService.bind(this._rightInput,"keydown",l=>this.handleKeyDown(l,"rightInput")),this.hasAutoCommitEdit&&(this._bindEventService.bind(this._leftInput,"focusout",l=>this.handleFocusOut(l,"leftInput")),this._bindEventService.bind(this._rightInput,"focusout",l=>this.handleFocusOut(l,"rightInput"))),((o=this.args)==null?void 0:o.compositeEditorOptions)?(this._bindEventService.bind(this._leftInput,"input",this.handleChangeOnCompositeEditorDebounce.bind(this)),this._bindEventService.bind(this._rightInput,"input",this.handleChangeOnCompositeEditorDebounce.bind(this))):setTimeout(()=>this._leftInput.select(),50)}handleFocusOut(e,t){var o;const i=((o=e.relatedTarget)==null?void 0:o.className)||"";!this.args.compositeEditorOptions&&i.indexOf("dual-editor")===-1&&this._lastEventType!=="focusout-right"&&(t==="rightInput"||t==="leftInput"&&this._lastEventType!=="focusout-left")&&(t==="leftInput"?this._isLeftValueTouched=!0:this._isRightValueTouched=!0,this.save());const n=t==="leftInput"?"left":"right";this._lastEventType=`${e==null?void 0:e.type}-${n}`}handleKeyDown(e,t){t==="leftInput"?this._isLeftValueTouched=!0:this._isRightValueTouched=!0,this._lastInputKeyEvent=e,(e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="Tab")&&e.stopImmediatePropagation()}destroy(){var e,t,i,s;this._eventHandler.unsubscribeAll(),this._bindEventService.unbindAll(),(t=(e=this._leftInput)==null?void 0:e.remove)==null||t.call(e),(s=(i=this._rightInput)==null?void 0:i.remove)==null||s.call(i)}createInput(e){var a,h,d,c;const t=this.editorParams[e],i=((a=this.columnDef)==null?void 0:a.id)??"",s=this.gridOptions.datasetIdPropertyName||"id",n=((d=(h=this.args)==null?void 0:h.item)==null?void 0:d[s])??"";let o=t.type||"text";(o==="float"||o==="integer")&&(o="number");const l=v("input",{type:o||"text",id:`item-${n}-${e}`,ariaLabel:((c=this.columnEditor)==null?void 0:c.ariaLabel)??`${_t(i+"")} Input Editor`,className:`dual-editor-text editor-${i} ${e.replace(/input/gi,"")}`,autocomplete:"off",ariaAutoComplete:"none",placeholder:t.placeholder||"",title:t.title||""});return o==="readonly"&&(l.readOnly=!0,o="text"),o==="number"&&(l.step=this.getInputDecimalSteps(e)),l}disable(e=!0){var i;const t=this.disabled;this.disabled=e,this._leftInput&&this._rightInput&&(e?(this._leftInput.setAttribute("disabled","disabled"),this._rightInput.setAttribute("disabled","disabled"),t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&this.reset("",!0,!0)):(this._leftInput.removeAttribute("disabled"),this._rightInput.removeAttribute("disabled")))}focus(){this.grid.focus()}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValues(){const e={},t=this._leftInput.value,i=this._rightInput.value,s=this.editorParams.leftInput&&(this.editorParams.leftInput.type==="float"||this.editorParams.leftInput.type==="integer"),n=this.editorParams.rightInput&&(this.editorParams.rightInput.type==="float"||this.editorParams.rightInput.type==="integer"),o=t!==""&&s?+this._leftInput.value:t||"",l=i!==""&&n?+this._rightInput.value:i||"";return $e(e,this._leftFieldName,o),$e(e,this._rightFieldName,l),e}setValues(e){Array.isArray(e)&&e.length===2&&(this._leftInput.value=`${e[0]}`,this._rightInput.value=`${e[1]}`)}applyValue(e,t){this.applyValueByPosition(e,t,"leftInput"),this.applyValueByPosition(e,t,"rightInput")}applyValueByPosition(e,t,i){var n;const s=i==="leftInput"?this._leftFieldName:this._rightFieldName;if(s!==void 0){const o=(s==null?void 0:s.indexOf("."))>0;let l=s;if(o){const d=s.split(/\.(.*)/);l=d.length>1?d[1]:d}const a=o?Ee(t,l):t[s],h=this.validate(null,{position:i,inputValue:a});if(o){const d=Ee(t,l),c=h&&h.valid?d:"",u=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??s??"";$e(e,u,c)}else s&&(e[s]=h&&h.valid?t[s]:"")}}isValueChanged(){var a,h,d;const e=this._leftInput.value,t=this._rightInput.value,i=(a=this.editorParams)==null?void 0:a.leftInput,s=(h=this.editorParams)==null?void 0:h.rightInput,n=(d=this._lastInputKeyEvent)==null?void 0:d.key;if((i&&i.alwaysSaveOnEnterKey||s&&s.alwaysSaveOnEnterKey)&&n==="Enter")return!0;const o=!(e===""&&(this._originalLeftValue===null||this._originalLeftValue===void 0))&&e!==this._originalLeftValue,l=!(t===""&&(this._originalRightValue===null||this._originalRightValue===void 0))&&t!==this._originalRightValue;return o||l}isValueTouched(){return this._isLeftValueTouched||this._isRightValueTouched}loadValue(e){this.loadValueByPosition(e,"leftInput"),this.loadValueByPosition(e,"rightInput"),this._leftInput.select()}loadValueByPosition(e,t){const i=t==="leftInput"?this._leftFieldName:this._rightFieldName,s=t==="leftInput"?"_originalLeftValue":"_originalRightValue",n=t==="leftInput"?"_leftInput":"_rightInput";if(e&&i!==void 0){const l=(i==null?void 0:i.indexOf("."))>0?Ee(e,i):e.hasOwnProperty(i)?e[i]:"";if(this[s]=l,this.editorParams[t].type==="float"){const a=this.getDecimalPlaces(t);a!==null&&(this[s]||this[s]===0)&&this[s]!==void 0&&(this[s]=(+this[s]).toFixed(a))}this[n]&&(this[n].value=`${this[s]}`)}}reset(e,t=!0,i=!1){const s=e??this._originalLeftValue??"",n=e??this._originalRightValue??"";this._leftInput&&this._rightInput&&(this._originalLeftValue=s,this._originalRightValue=n,this._leftInput.value=`${s}`,this._rightInput.value=`${n}`),this._isLeftValueTouched=!1,this._isRightValueTouched=!1;const o=this.args.compositeEditorOptions;if(o&&t){const l=!i;this.handleChangeOnCompositeEditor(null,o,"user",l)}}save(){const e=this.validate(),t=e&&e.valid||!1;this._isValueSaveCalled||(this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges(),this._isValueSaveCalled=!0)}serializeValue(){const e={},t=this.serializeValueByPosition("leftInput"),i=this.serializeValueByPosition("rightInput");return $e(e,this._leftFieldName,t),$e(e,this._rightFieldName,i),e}serializeValueByPosition(e){const t=e==="leftInput"?this._leftInput.value:this._rightInput.value;if(t===""||isNaN(+t))return t;let i=parseFloat(t);const s=this.getDecimalPlaces(e);return s!==null&&(i||i===0)&&i.toFixed&&(i=parseFloat(i.toFixed(s))),i}getDecimalPlaces(e){const i=e==="leftInput"?"leftInput":"rightInput",s=this.editorParams[i],n=s==null?void 0:s.decimal;return n===void 0?0:n}getInputDecimalSteps(e){const t=this.getDecimalPlaces(e);let i="";for(let s=1;s<t;s++)i+="0";return t>0?`0.${i}1`:"1"}validate(e,t){if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};if(t){const i=this.validateByPosition(t.position,t.inputValue);if(!i.valid)return t.position==="leftInput"?this._leftInput.select():this._rightInput.select(),i}else{const i=this.validateByPosition("leftInput"),s=this.validateByPosition("rightInput");if(!i.valid)return this._leftInput.select(),i;if(!s.valid)return this._rightInput.select(),s}return{valid:!0,msg:""}}validateByPosition(e,t){var l;const i=this.editorParams[e];let s="";if(t)s=t;else{const a=e==="leftInput"?this._leftInput:this._rightInput;s=a&&a.value}const n=this.validator;s=typeof n=="function"?this.getValues():s;const o={editorArgs:this.args,errorMessage:i.errorMessage,required:(l=this.args)!=null&&l.compositeEditorOptions?!1:i.required,validator:typeof n=="function"?n:i.validator};switch(i.type){case"float":return Ra(s,{...o,decimal:this.getDecimalPlaces(e),minValue:i.minValue,maxValue:i.maxValue,operatorConditionalType:i.operatorConditionalType});case"integer":return Aa(s,{...o,minValue:i.minValue,maxValue:i.maxValue,operatorConditionalType:i.operatorConditionalType});case"text":case"password":default:return Ks(s,o)}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var p,m,f,g,_,b;const n=this.grid.getActiveCell(),o=this.args.column,l=((m=(p=this.columnEditor.params)==null?void 0:p.leftInput)==null?void 0:m.field)??"",a=((g=(f=this.columnEditor.params)==null?void 0:f.rightInput)==null?void 0:g.field)??"",h=this.dataContext,d=this.grid,c=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,c),this.applyValue(t.formValues,c);const u=((b=(_=this.gridOptions)==null?void 0:_.compositeEditorOptions)==null?void 0:b.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&u&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],(s||this.disabled&&u&&t.formValues.hasOwnProperty(a))&&delete t.formValues[a],d.onCompositeEditorChange.notify({...n,item:h,grid:d,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleChangeOnCompositeEditorDebounce(e){var i,s;const t=(i=this.args)==null?void 0:i.compositeEditorOptions;if(t){const n=((s=this.gridOptions)==null?void 0:s.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),n)}}}const bp=0;class Qs{constructor(e,t="text"){if(this.args=e,this._inputType="text",this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=e.grid&&e.grid.getOptions(),this._bindEventService=new Ae,this.inputType=t,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._input}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get inputType(){return this._inputType}set inputType(e){this._inputType=e}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var s,n,o,l;const e=((s=this.columnDef)==null?void 0:s.id)??"",t=this.args.compositeEditorOptions;this._input=v("input",{type:this._inputType||"text",autocomplete:"off",ariaAutoComplete:"none",ariaLabel:((n=this.columnEditor)==null?void 0:n.ariaLabel)??`${_t(e+"")} Input Editor`,className:`editor-text editor-${e}`,placeholder:((o=this.columnEditor)==null?void 0:o.placeholder)??"",title:((l=this.columnEditor)==null?void 0:l.title)??""}),this.inputType==="number"&&(this._input.step=`${this.columnEditor.valueStep!==void 0?this.columnEditor.valueStep:this.getInputDecimalSteps()}`);const i=this.args.container;i&&typeof i.appendChild=="function"&&i.appendChild(this._input),this._bindEventService.bind(this._input,"focus",()=>{var a;return(a=this._input)==null?void 0:a.select()}),this._bindEventService.bind(this._input,"keydown",a=>{this._isValueTouched=!0,this._lastInputKeyEvent=a,(a.key==="ArrowLeft"||a.key==="ArrowRight")&&a.stopImmediatePropagation()}),this.hasAutoCommitEdit&&!t&&this._bindEventService.bind(this._input,["focusout","blur"],()=>{this._isValueTouched=!0,this.save()}),t&&(this._bindEventService.bind(this._input,["input","paste"],this.handleOnInputChange.bind(this)),this.inputType==="number"&&this._bindEventService.bind(this._input,"wheel",this.handleOnMouseWheel.bind(this),{passive:!0}))}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._input)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._input)if(e){this._input.setAttribute("disabled","disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._input.removeAttribute("disabled")}focus(){var e;this.grid.focus(),(e=this._input)==null||e.focus()}getDecimalPlaces(){var t,i,s;let e=((t=this.columnEditor)==null?void 0:t.decimal)??((s=(i=this.columnEditor)==null?void 0:i.params)==null?void 0:s.decimalPlaces)??void 0;return e===void 0&&(e=bp),!e&&e!==0?null:e}getInputDecimalSteps(){const e=this.getDecimalPlaces();let t="";for(let i=1;i<e;i++)t+="0";return e>0?`0.${t}1`:"1"}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){var e;return((e=this._input)==null?void 0:e.value)||""}setValue(e,t=!1,i=!0){if(this._input&&(this._input.value=`${e}`,t)){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var s;const i=this.columnDef&&this.columnDef.field;if(i!==void 0){const n=(i==null?void 0:i.indexOf("."))>0,o=this.validate(null,t),l=o!=null&&o.valid?t:"";if(n){const a=((s=this.columnEditor)==null?void 0:s.complexObjectPath)??i??"";$e(e,a,l)}else i&&(e[i]=l)}}isValueChanged(){var i,s,n;const e=(i=this._input)==null?void 0:i.value,t=(s=this._lastInputKeyEvent)==null?void 0:s.key;return(n=this.columnEditor)!=null&&n.alwaysSaveOnEnterKey&&t==="Enter"?!0:!(e===""&&(this._originalValue===null||this._originalValue===void 0))&&e!==this._originalValue}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0&&this._input){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e.hasOwnProperty(t)&&e[t]||"";this._originalValue=n,this._input.value=this._originalValue,this._input.select()}}reset(e,t=!0,i=!1){const s=e??this._originalValue??"";this._input&&(this._originalValue=s,this._input.value=`${s}`),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=e&&e.valid||!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e;return((e=this._input)==null?void 0:e.value)??""}validate(e,t){var s;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:this._input&&this._input.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(s=this.args)!=null&&s.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleOnInputChange(e){var i;this._isValueTouched=!0;const t=this.args.compositeEditorOptions;if(t){const s=((i=this.gridOptions)==null?void 0:i.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),s)}}handleOnMouseWheel(e){this._isValueTouched=!0;const t=this.args.compositeEditorOptions;t&&this.handleChangeOnCompositeEditor(e,t)}}class Sp extends Qs{constructor(e){super(e,"number"),this.args=e}loadValue(e){const t=this.columnDef&&this.columnDef.field;if(t!==void 0&&e&&t!==void 0&&this._input){const s=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=s;const n=this.getDecimalPlaces();n!==null&&(this._originalValue||this._originalValue===0)&&this._originalValue!==void 0&&(this._originalValue=(+this._originalValue).toFixed(n)),this._input.value=`${this._originalValue}`,this._input.select()}}serializeValue(){var s;const e=(s=this._input)==null?void 0:s.value;if(e===void 0||e===""||isNaN(+e))return e;let t=parseFloat(e);const i=this.getDecimalPlaces();return i!==null&&(t||t===0)&&t.toFixed&&(t=parseFloat(t.toFixed(i))),t}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._input)==null?void 0:s.value;return Ra(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,decimal:this.getDecimalPlaces(),minValue:this.columnEditor.minValue,maxValue:this.columnEditor.maxValue,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}}class yp extends Qs{constructor(e){super(e,"password"),this.args=e}}class Ep extends Qs{constructor(e){super(e,"number"),this.args=e}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(t!==void 0&&e&&t!==void 0&&this._input){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=isNaN(n)||n===null||n===void 0?n:`${n}`,this._input.value=`${this._originalValue}`,this._input.select()}}serializeValue(){var i;const e=(i=this._input)==null?void 0:i.value;if(e===void 0||e===""||isNaN(+e))return e;const t=isNaN(+e)?e:parseInt(e,10);return isNaN(+t)?e:t}validate(e,t){var s;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:this.getValue();return Aa(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minValue:this.columnEditor.minValue,maxValue:this.columnEditor.maxValue,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(s=this.args)!=null&&s.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}handleOnMouseWheel(e){this._isValueTouched=!0;const t=this.args.compositeEditorOptions;t&&this.handleChangeOnCompositeEditor(e,t)}}class wp{constructor(e){var i,s;if(this.args=e,this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=(i=e.grid)==null?void 0:i.getOptions();const t=this.gridOptions||this.args.column.params||{};t!=null&&t.translater&&(this._translater=t.translater),this._locales=((s=this.gridOptions)==null?void 0:s.locales)||R.locales,this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)??{}}get dataContext(){return this.args.item}get editorDomElement(){return this._textareaElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.longText,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get hasAutoCommitEdit(){var e;return((e=this.gridOptions)==null?void 0:e.autoCommitEdit)??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var d,c,u,p,m,f,g,_,b,C,E,y,T,x,O;let e="",t="";if(this._translater&&this._translater.translate&&this.gridOptions.enableTranslate){const I=ot(this.gridOptions),A=((d=this.editorOptions.buttonTexts)==null?void 0:d.cancelKey)??`${I}CANCEL`,k=((c=this.editorOptions.buttonTexts)==null?void 0:c.saveKey)??`${I}SAVE`;e=this._translater.translate(`${I}${A}`),t=this._translater.translate(`${I}${k}`)}else e=((u=this.editorOptions.buttonTexts)==null?void 0:u.cancel)??((p=this._locales)==null?void 0:p.TEXT_CANCEL)??"Cancel",t=((m=this.editorOptions.buttonTexts)==null?void 0:m.save)??((f=this._locales)==null?void 0:f.TEXT_SAVE)??"Save";const i=this.args.compositeEditorOptions,s=((g=this.columnDef)==null?void 0:g.id)??"",n=(_=this.columnEditor)==null?void 0:_.maxLength,o=((b=this.editorOptions)==null?void 0:b.rows)??4,l=i?this.args.container:document.body;this._wrapperElm=v("div",{className:`slick-large-editor-text editor-${s}`,style:{position:i?"relative":"absolute"}}),(C=this.gridOptions)!=null&&C.darkMode&&this._wrapperElm.classList.add("slick-dark-mode"),l.appendChild(this._wrapperElm),this._textareaElm=v("textarea",{ariaLabel:((E=this.columnEditor)==null?void 0:E.ariaLabel)??`${_t(s+"")} Text Editor`,cols:((y=this.editorOptions)==null?void 0:y.cols)??40,rows:i&&o>3?3:o,placeholder:((T=this.columnEditor)==null?void 0:T.placeholder)??"",title:((x=this.columnEditor)==null?void 0:x.title)??""},this._wrapperElm);const a=v("div",{className:"editor-footer"}),h=v("span",{className:"counter"});if(this._currentLengthElm=v("span",{className:"text-length",textContent:"0"}),h.appendChild(this._currentLengthElm),n!==void 0&&(h.appendChild(v("span",{className:"separator",textContent:"/"})),h.appendChild(v("span",{className:"max-length",textContent:`${n}`}))),a.appendChild(h),!i){const I=v("button",{className:"btn btn-cancel btn-default btn-xs",textContent:e},a),A=v("button",{className:"btn btn-save btn-primary btn-xs",textContent:t},a);this._bindEventService.bind(I,"click",this.cancel.bind(this)),this._bindEventService.bind(A,"click",this.save.bind(this)),this.position((O=this.args)==null?void 0:O.position),this._textareaElm.focus(),this._textareaElm.select()}this._wrapperElm.appendChild(a),this._bindEventService.bind(this._textareaElm,"keydown",this.handleKeyDown.bind(this)),this._bindEventService.bind(this._textareaElm,"input",this.handleOnInputChange.bind(this)),this._bindEventService.bind(this._textareaElm,"paste",this.handleOnInputChange.bind(this))}cancel(){var t;const e=this._defaultTextValue||"";this._textareaElm.value=e,this._currentLengthElm.textContent=`${e.length}`,(t=this.args)!=null&&t.cancelChanges&&this.args.cancelChanges()}hide(){this._wrapperElm.style.display="none"}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)?this.applyInputUsabilityState():this._wrapperElm.style.display="block"}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._wrapperElm)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._textareaElm&&this._wrapperElm)if(e){this._textareaElm.disabled=!0,this._wrapperElm.classList.add("disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._textareaElm.disabled=!1,this._wrapperElm.classList.remove("disabled")}focus(){this.grid.focus(),this._textareaElm&&(this._textareaElm.focus(),this._textareaElm.select())}getValue(){return this._textareaElm.value}setValue(e,t=!1,i=!0){if(this._textareaElm.value=e,this._currentLengthElm.textContent=`${e.length}`,t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var s,n;const i=(s=this.columnDef)==null?void 0:s.field;if(i!==void 0){const o=(i==null?void 0:i.indexOf("."))>0,l=this.validate(void 0,t),a=l!=null&&l.valid?t:"";if(o){const h=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??i??"";$e(e,h,a)}else e[i]=a}}isValueChanged(){const e=this._textareaElm.value;return!(e===""&&(this._defaultTextValue===null||this._defaultTextValue===void 0))&&e!==this._defaultTextValue}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._defaultTextValue=n||"",this._textareaElm.value=this._defaultTextValue,this._currentLengthElm.textContent=this._defaultTextValue.length,this._textareaElm.defaultValue=this._defaultTextValue,this._textareaElm.select()}}position(e){var u,p;const t=me(this.args.container),i=this.args.container.offsetHeight,s=this.args.container.offsetWidth,n=this._wrapperElm.getBoundingClientRect().height||this.args.position.height,o=this._wrapperElm.getBoundingClientRect().width||this.args.position.width,l=document.body.offsetHeight||window.innerHeight,a=document.body.offsetWidth||window.innerWidth;let h=(t==null?void 0:t.top)??e.top??0,d=(t==null?void 0:t.left)??e.left??0;const c=((u=this.editorOptions)==null?void 0:u.position)??"auto";if(c==="left"||c==="auto"&&d+o>a){const m=((p=this.editorOptions)==null?void 0:p.marginRight)??0;d-=o-s+m}(c==="top"||c==="auto"&&h+n>l)&&(h-=n-i),this._wrapperElm.style.top=`${h}px`,this._wrapperElm.style.left=`${d}px`}reset(e,t=!0,i=!1){const s=e??this._defaultTextValue??"";this._textareaElm&&(this._defaultTextValue=s,this._textareaElm.value=s,this._currentLengthElm.textContent=s.length),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){return this._textareaElm.value}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._textareaElm)==null?void 0:s.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleKeyDown(e){const t=e.key;this._isValueTouched=!0,this.args.compositeEditorOptions||(t==="Enter"&&e.ctrlKey||e.ctrlKey&&e.key.toUpperCase()==="S"?(e.preventDefault(),this.save()):t==="Escape"?(e.preventDefault(),this.cancel()):t==="Tab"&&e.shiftKey?(e.preventDefault(),this.args&&this.grid&&this.grid.navigatePrev()):t==="Tab"&&(e.preventDefault(),this.args&&this.grid&&this.grid.navigateNext()))}handleOnInputChange(e){var n,o;const t=this.args.compositeEditorOptions,i=(n=this.columnEditor)==null?void 0:n.maxLength;let s=!1;if(i&&(s=this.truncateText(this._textareaElm,i)),s)this._currentLengthElm.textContent=`${i}`;else{const l=e.type==="paste"?e.clipboardData.getData("text"):e.target.value;this._currentLengthElm.textContent=`${l.length}`}if(t){const l=((o=this.gridOptions)==null?void 0:o.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),l)}}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}truncateText(e,t){const i=e.value+"";return i.length>t?(e.value=i.substring(0,t),!0):!1}}class Pa{constructor(e,t,i=-1){var l,a,h,d,c,u,p,m,f;if(this.args=e,this.isMultipleSelect=t,this.delayOpening=i,this._isValueTouched=!1,this._isDisposingOrCallingSave=!1,this.disabled=!1,this.enableTranslateLabel=!1,this.finalCollection=[],!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},(l=this.gridOptions)!=null&&l.translater&&(this._translaterService=this.gridOptions.translater),this._locales=this.gridOptions.locales||R.locales;const s=((a=this.columnDef)==null?void 0:a.id)??"";this.elementName=`editor-${s}`;const n=this.args.compositeEditorOptions,o={autoAdjustDropHeight:!0,autoAdjustDropPosition:!0,autoAdjustDropWidthByTextSize:!0,container:"body",darkMode:!!this.gridOptions.darkMode,filter:!1,maxHeight:275,minHeight:25,name:this.elementName,single:!0,singleRadio:!0,renderOptionLabelAsHtml:((h=this.columnEditor)==null?void 0:h.enableRenderHtml)??!1,sanitizer:g=>this.grid.sanitizeHtmlString(g),onClick:()=>this._isValueTouched=!0,onCheckAll:()=>this._isValueTouched=!0,onUncheckAll:()=>this._isValueTouched=!0,onClose:g=>{if(g==="key.escape"||g==="body.click"||!this.hasAutoCommitEdit&&!this.isValueChanged()){g==="key.escape"&&this.cancel();return}n?this.handleChangeOnCompositeEditor(n):(this._isDisposingOrCallingSave=!0,this.save(this.hasAutoCommitEdit))}};if(t)if(o.single=!1,o.singleRadio=!1,o.displayTitle=!0,o.showOkButton=!0,(d=this._translaterService)!=null&&d.getCurrentLanguage()){const g=ot(this.gridOptions);o.countSelectedText=this._translaterService.translate(`${g}X_OF_Y_SELECTED`),o.allSelectedText=this._translaterService.translate(`${g}ALL_SELECTED`),o.selectAllText=this._translaterService.translate(`${g}SELECT_ALL`),o.okButtonText=this._translaterService.translate(`${g}OK`),o.noMatchesFoundText=this._translaterService.translate(`${g}NO_MATCHES_FOUND`)}else o.countSelectedText=(c=this._locales)==null?void 0:c.TEXT_X_OF_Y_SELECTED,o.allSelectedText=(u=this._locales)==null?void 0:u.TEXT_ALL_SELECTED,o.selectAllText=(p=this._locales)==null?void 0:p.TEXT_SELECT_ALL,o.okButtonText=(m=this._locales)==null?void 0:m.TEXT_OK,o.noMatchesFoundText=(f=this._locales)==null?void 0:f.TEXT_NO_MATCHES_FOUND;this.defaultOptions=o,this.init()}get collection(){var e;return((e=this.columnEditor)==null?void 0:e.collection)??[]}get collectionOptions(){var e;return(e=this.columnEditor)==null?void 0:e.collectionOptions}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)??{}}get dataContext(){return this.args.item}get editorDomElement(){return this.editorElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.select,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get isCompositeEditor(){var e;return!!((e=this.args)!=null&&e.compositeEditorOptions)}get customStructure(){var e,t;return(t=(e=this.columnDef)==null?void 0:e.editor)==null?void 0:t.customStructure}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get msInstance(){return this._msInstance}get selectOptions(){return this.defaultOptions}get currentValues(){var s,n,o;const e=((s=this._msInstance)==null?void 0:s.getSelects())??[];if(this.collection.every(l=>typeof l=="number"||typeof l=="string"))return this.collection.filter(l=>e==null?void 0:e.some(a=>`${a}`===(l==null?void 0:l.toString())));const t=((n=this.collectionOptions)==null?void 0:n.separatorBetweenTextLabels)??"",i=((o=this.collectionOptions)==null?void 0:o.includePrefixSuffixToSelectedValues)??!1;return this.collection.filter(l=>e.some(a=>{var h;return`${a}`===((h=l==null?void 0:l[this.valueName])==null?void 0:h.toString())})).map(l=>{var m,f;const a=l[this.valueName];let h=l[this.labelPrefixName]||"",d=l[this.labelSuffixName]||"";const c=((m=this.columnDef)==null?void 0:m.field)??"",u=(c==null?void 0:c.indexOf("."))>0,p=((f=this.columnEditor)==null?void 0:f.serializeComplexValueFormat)??"object";return u&&typeof l=="object"&&p==="object"?l:(h=this.enableTranslateLabel&&this._translaterService&&h&&typeof h=="string"?this._translaterService.translate(h||" "):h,d=this.enableTranslateLabel&&this._translaterService&&d&&typeof d=="string"?this._translaterService.translate(d||" "):d,i?[h,a,d].filter(_=>_).join(t):a)})}get currentValue(){var s,n,o,l,a;const e=((s=this._msInstance)==null?void 0:s.getSelects())??[],t=e.length?e[0]:"",i=(n=this.columnDef)==null?void 0:n.field;if(i!==void 0){if(this.collection.every(m=>typeof m=="number"||typeof m=="string"))return xt(this.collection,m=>{var f;return((f=m==null?void 0:m.toString)==null?void 0:f.call(m))===`${t}`});const h=((o=this.collectionOptions)==null?void 0:o.separatorBetweenTextLabels)??"",d=((l=this.collectionOptions)==null?void 0:l.includePrefixSuffixToSelectedValues)??!1,c=xt(this.collection,m=>{var f;return m.hasOwnProperty(this.valueName)&&((f=m[this.valueName])==null?void 0:f.toString())===`${t}`}),u=(i==null?void 0:i.indexOf("."))>0,p=((a=this.columnEditor)==null?void 0:a.serializeComplexValueFormat)??"object";if(u&&typeof c=="object"&&p==="object")return c;if(c&&c.hasOwnProperty(this.valueName)){const m=c[this.valueName];if(d){let f=c[this.labelPrefixName]||"",g=c[this.labelSuffixName]||"";return f=this.enableTranslateLabel&&this._translaterService&&f&&typeof f=="string"?this._translaterService.translate(f||" "):f,g=this.enableTranslateLabel&&this._translaterService&&g&&typeof g=="string"?this._translaterService.translate(g||" "):g,[f,m,g].filter(b=>b).join(h)}return m}}return""}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var e,t,i,s,n,o,l;if(!this.columnDef||!this.columnDef.editor||!this.columnDef.editor.collection&&!this.columnDef.editor.collectionAsync)throw new Error(`[Slickgrid-Universal] You need to pass a "collection" (or "collectionAsync") inside Column Definition Editor for the MultipleSelect/SingleSelect Editor to work correctly.
|
|
17
|
+
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,t=!1){var s,n;let i="";if((s=e==null?void 0:e.target)!=null&&s.value){let o=((n=e==null?void 0:e.target)==null?void 0:n.value)??"";const l=this.gridOptions.enableFilterTrimWhiteSpace||this.columnFilter.enableTrimWhiteSpace;typeof o=="string"&&l&&(o=o.trim());const a=this.unmaskValue(o),h=this.maskValue(a);i=a,(e==null?void 0:e.keyCode)>=48&&(this._filterInputElm.value=h,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,s=>((s==="0"||s==="9")&&/\d+/g.test(e[t])||s.toUpperCase()==="A"&&/[^\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 s="";for(let n=0;n<i.length;n++)t[n]&&((i[n]==="0"||i[n]==="9")&&/\d+/g.test(t[n])||i[n].toUpperCase()==="A"&&/[^\d]+/gi.test(t[n]))&&(s+=t[n]);return s}}class Nu extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="number"}}class Lu extends Ut{constructor(e){super(e),this.translaterService=e,this.inputType="password"}}var Hu=Object.defineProperty,Vu=(r,e,t)=>e in r?Hu(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,V=(r,e,t)=>Vu(r,typeof e!="symbol"?e+"":e,t),Bu=class{constructor(r){V(this,"_distinctEvent"),V(this,"_boundedEvents",[]),this._distinctEvent=(r==null?void 0:r.distinctEvent)??!1}get boundedEvents(){return this._boundedEvents}dispose(){this.unbindAll(),this._boundedEvents=[]}bind(r,e,t,i,s=""){let n=Array.isArray(e)?e:[e];if(typeof(r==null?void 0:r.forEach)=="function")r.forEach(o=>{for(let l of n)(!this._distinctEvent||this._distinctEvent&&!this.hasBinding(o,l))&&(o.addEventListener(l,t,i),this._boundedEvents.push({element:o,eventName:l,listener:t,groupName:s}))});else for(let o of n)(!this._distinctEvent||this._distinctEvent&&!this.hasBinding(r,o))&&(r.addEventListener(o,t,i),this._boundedEvents.push({element:r,eventName:o,listener:t,groupName:s}))}hasBinding(r,e){return this._boundedEvents.some(t=>t.element===r&&(!e||t.eventName===e))}unbind(r,e,t){var i;if(r){let s=Array.isArray(r)?r:[r],n=Array.isArray(e)?e||"":[e||""];for(let o of s){t||(t=this._boundedEvents.find(l=>{if(l.element===o&&(!e||l.eventName===e))return l.listener}));for(let l of n)(i=o==null?void 0:o.removeEventListener)==null||i.call(o,l,t)}}}unbindAll(r){if(r){let e=Array.isArray(r)?r:[r];for(let t=this._boundedEvents.length-1;t>=0;--t){let i=this._boundedEvents[t];if(e.some(s=>s===i.groupName)){let{element:s,eventName:n,listener:o}=i;this.unbind(s,n,o),this._boundedEvents.splice(t,1)}}}else for(;this._boundedEvents.length>0;){let e=this._boundedEvents.pop(),{element:t,eventName:i,listener:s}=e;this.unbind(t,i,s)}}},Sa=typeof window<"u"&&window.multipleSelect!==void 0?window.multipleSelect:{locales:{}},zu={formatSelectAll(){return"[Select all]"},formatAllSelected(){return"All selected"},formatCountSelected(r,e){return`${r} of ${e} selected`},formatNoMatchesFound(){return"No matches found"},formatOkButton(){return"OK"}};Sa.locales["en-US"]=zu;var ya=Sa.locales,$u=50,Wu=4,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(r){let{text:e,label:t,search:i}=r;return(t||e||"").includes(i)},showClear:!1,autoAdjustDropHeight:!1,autoAdjustDropPosition:!1,autoAdjustDropWidthByTextSize:!1,adjustedHeightPadding:10,useSelectOptionLabel:!1,useSelectOptionLabelToHtml:!1,navigationHighlight:!0,infiniteScroll:!1,virtualScroll:!0,cssStyler:()=>null,textTemplate:r=>r.innerHTML.trim(),labelTemplate:r=>r.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},Gu=["init","getOptions","refreshOptions","getSelects","setSelects","enable","disable","open","close","check","uncheck","checkAll","uncheckAll","checkInvert","focus","blur","refresh","destroy"];Object.assign(Ea,ya["en-US"]);var Uu={BLOCK_ROWS:$u,CLUSTER_BLOCKS:Wu,DEFAULTS:Ea,METHODS:Gu},ft=Uu;function ju(r,e,t=!1){let i=Object.keys(r),s=Object.keys(e);if(t&&i.length!==s.length)return!1;for(let n of i)if(s.includes(n)&&r[n]!==e[n])return!1;return!0}function Sr(r){let e=()=>{let s={};for(let n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=Sr(r[n]));return s},t=()=>r.map(s=>Sr(s)),i=Object.prototype.toString.call(r).slice(8,-1).toLowerCase();return i==="object"?e():i==="array"?t():r}function yr(r){return r!=null&&r!==""}function Yu(r,e){return typeof r=="object"?Object.fromEntries(e?Object.entries(r).filter(([t,i])=>!yr(i)&&!e.includes(t)||yr(i)):Object.entries(r).filter(([t,i])=>yr(i))):r}function Xu(r){let e=0;return r.forEach((t,i)=>{t.type==="optgroup"?(t._key=`group_${i}`,t.visible=typeof t.visible>"u"?!0:t.visible,t.children.forEach((s,n)=>{s&&(s.visible=typeof(s==null?void 0:s.visible)>"u"?!0:s.visible,s.divider||(s._key=`option_${i}_${n}`,e+=1))})):(t.visible=typeof t.visible>"u"?!0:t.visible,t.divider||(t._key=`option_${i}`,e+=1))}),e}function js(r,e,t){if(Array.isArray(r))for(let i of r){if(i[e]===t||i[e]===`${+i[e]}`&&+i[e]===t)return i;if(i.type==="optgroup"){for(let s of i.children)if(s&&(s[e]===t||s[e]===`${+s[e]}`&&+s[e]===t))return s}}}function qu(r){return r.replace(/(\b)(on[a-z]+)(\s*)=([^>]*)|javascript:([^>]*)[^>]*|(<\s*)(\/*)script([<>]*).*(<\s*)(\/*)script(>*)|(<|<)(\/*)(script|script defer)(.*)(>|>|>">)/gi,"")}function Er(r){return Object.keys(r).forEach(e=>r[e]===void 0?delete r[e]:""),r}function Ei(r,e){if(typeof r!="string")return r;if(typeof e=="function")return e(r);if(typeof r.normalize=="function")return r.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 wr(r){let e=0,t=0,i=0,s=0,n=window.innerHeight??0,o=window.innerWidth??0,l=Zu(),a=l.top,h=l.left,d=xr(r);if(d){let c=d.top??0,u=d.left??0;t=c-a,e=n-(c-a),i=u-h,s=o-(u-h)}return{top:t,bottom:e,left:i,right:s}}function Tr(r=""){return r.split(" ").filter(e=>e)}function Ge(r,e,t){let i=document.createElement(r);return e&&Object.keys(e).forEach(s=>{let n=e[s];typeof n=="object"?Object.assign(i[s],n):i[s]=e[s]}),t!=null&&t.appendChild&&t.appendChild(i),i}function wa(r,e,t){var n;let i=(n=r.props)!=null&&n.innerHTML?Qu(r.props,"innerHTML"):r.props,s=Ge(r.tagName,Yu(i,["className","title","style"]),e);if(r.props.innerHTML&&(s.innerHTML=r.props.innerHTML),r.attrs)for(let o of Object.keys(r.attrs))s.setAttribute(o,r.attrs[o]);if(r.children)for(let o of r.children)wa(o,s);return e==null||e.appendChild(s),s}function Or(r){return r.hasOwnProperty("tagName")?wa(r):document.createElement("li")}function Ys(r){for(;r!=null&&r.firstChild;)r.lastChild&&r.removeChild(r.lastChild);return r}function xr(r){var o;if(!r)return;let e=(o=r==null?void 0:r.getBoundingClientRect)==null?void 0:o.call(r),t=0,i=0,s=0,n=0;return(e==null?void 0:e.top)!==void 0&&e.left!==void 0&&(t=e.top+window.pageYOffset,i=e.left+window.pageXOffset,n=e.right,s=e.bottom),{top:t,left:i,bottom:s,right:n}}function Xs(r,e,t){if(!r)return 0;let i=Number.parseFloat(r.style[t]);if(!i||Number.isNaN(i)){switch(e){case"outer":i=r[t==="width"?"offsetWidth":"offsetHeight"];break;case"scroll":i=r[t==="width"?"scrollWidth":"scrollHeight"];break;case"inner":default:i=r[t==="width"?"clientWidth":"clientHeight"];break}i=r.getBoundingClientRect()[t]}if(!i||Number.isNaN(i)){let s=r.style.display,n=r.style.position;r.style.display="block",r.style.position="absolute";let o=window.getComputedStyle(r)[t];i=Number.parseFloat(o),Number.isNaN(i)&&(i=0),r.style.display=s,r.style.position=n}return i||0}function Ta(r,e){let t=null,i=r==null?void 0:r.parentElement;for(;i;){let[s,n,o,l]=e.match(/^([a-z]*)([#.]{1})([a-z\-]+)$/i)||[];if(o&&l)for(let a of l.replace(o,"").split(" "))i.classList.contains(a)&&(n?(i==null?void 0:i.tagName.toLowerCase())===n&&(t=i):t=i);i=i.parentElement}return t}function Ku(r,e){var t;(t=r.parentNode)==null||t.insertBefore(e,r.nextSibling)}function Qu(r,e){let{[e]:t,...i}=r;return i}function Oa(r,e){r!=null&&r.style&&(r.style.display=r.style.display==="none"&&e!==!1||e===!0?"block":"none")}function Zu(){return{left:window.pageXOffset||document.documentElement.scrollLeft||0,top:window.pageYOffset||document.documentElement.scrollTop||0}}var Ju=class{constructor(e){var i;V(this,"clusterRows"),V(this,"cache"),V(this,"scrollEl"),V(this,"blockHeight"),V(this,"clusterHeight"),V(this,"contentEl"),V(this,"parentEl"),V(this,"itemHeight"),V(this,"lastCluster"),V(this,"scrollTop"),V(this,"dataStart"),V(this,"dataEnd"),V(this,"rows"),V(this,"destroy"),V(this,"callback"),V(this,"sanitizer"),this.rows=e.rows,this.scrollEl=e.scrollEl,this.contentEl=e.contentEl,this.parentEl=(i=e.contentEl)==null?void 0:i.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),Ys(this.contentEl)}}reset(e){this.lastCluster=0,this.cache={},Ys(this.contentEl),this.initDOM(e)}initDOM(e){if(typeof this.clusterHeight>"u"){this.cache.scrollTop=this.scrollEl.scrollTop;let o=Or(e[0]);this.contentEl.appendChild(o),this.contentEl.appendChild(o),this.contentEl.appendChild(o),this.cache.data=[e[0]],this.getRowsHeight()}let t=this.initData(e,this.getNum()),i=this.checkChanges("data",t.rows),s=this.checkChanges("top",t.topOffset),n=this.checkChanges("bottom",t.bottomOffset);Ys(this.contentEl),i&&s?(t.topOffset&&this.contentEl.appendChild(this.getExtra("top",t.topOffset)),t.rows.forEach(o=>this.contentEl.appendChild(Or(o))),t.bottomOffset&&this.contentEl.appendChild(this.getExtra("bottom",t.bottomOffset))):n&&this.contentEl.lastChild&&(this.contentEl.lastChild.style.height=`${t.bottomOffset}px`)}getRowsHeight(){var e;if(typeof this.itemHeight>"u"){let t=((e=this.parentEl)==null?void 0:e.style.display)||"";this.parentEl&&(t===""||t==="none")&&(this.parentEl.style.display="block");let i=this.contentEl.children,s=i[Math.floor(i.length/2)];this.itemHeight=s.offsetHeight,this.parentEl&&(this.parentEl.style.display=t)}this.blockHeight=this.itemHeight*ft.BLOCK_ROWS,this.clusterRows=ft.BLOCK_ROWS*ft.CLUSTER_BLOCKS,this.clusterHeight=this.blockHeight*ft.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.length<ft.BLOCK_ROWS)return{topOffset:0,bottomOffset:0,rowsAbove:0,rows:e};let i=Math.max((this.clusterRows-ft.BLOCK_ROWS)*t,0),s=i+this.clusterRows,n=Math.max(i*this.itemHeight,0),o=Math.max((e.length-s)*this.itemHeight,0),l=[],a=i;n<1&&a++;for(let h=i;h<s;h++)e[h]&&l.push(e[h]);return this.dataStart=i,this.dataEnd=s,{topOffset:n,bottomOffset:o,rowsAbove:a,rows:l}}checkChanges(e,t){let i=t!==this.cache[e];return this.cache[e]=t,i}getExtra(e,t){let i=document.createElement("li");return i.className=`virtual-scroll-${e}`,t&&(i.style.height=`${t}px`),i}},ns=".ms-select-all, ul li[data-key]",ep=".ms-select-all.highlighted, ul li[data-key].highlighted",tp=class{constructor(e,t){this.elm=e,V(this,"_bindEventService"),V(this,"isAllSelected",!1),V(this,"isPartiallyAllSelected",!1),V(this,"fromHtml",!1),V(this,"choiceElm"),V(this,"selectClearElm"),V(this,"closeElm"),V(this,"clearSearchIconElm"),V(this,"filterText",""),V(this,"updateData",[]),V(this,"data",[]),V(this,"dataTotal"),V(this,"dropElm"),V(this,"okButtonElm"),V(this,"filterParentElm"),V(this,"lastFocusedItemKey",""),V(this,"lastMouseOverPosition",""),V(this,"ulElm"),V(this,"parentElm"),V(this,"labelElm"),V(this,"selectAllParentElm"),V(this,"selectAllElm"),V(this,"searchInputElm"),V(this,"selectGroupElms"),V(this,"selectItemElms"),V(this,"noResultsElm"),V(this,"options"),V(this,"selectAllName",""),V(this,"selectGroupName",""),V(this,"selectItemName",""),V(this,"scrolledByMouse",!1),V(this,"openDelayTimer"),V(this,"updateDataStart"),V(this,"updateDataEnd"),V(this,"virtualScroll"),V(this,"_currentHighlightIndex",-1),V(this,"_currentSelectedElm"),V(this,"isMoveUpRecalcRequired",!1),V(this,"locales",{}),this.options=Object.assign({},ft.DEFAULTS,this.elm.dataset,t),this._bindEventService=new Bu({distinctEvent:!0})}get isRenderAsHtml(){return this.options.renderOptionLabelAsHtml||this.options.useSelectOptionLabelToHtml}init(){this.initLocale(),this.initContainer(),this.initData(),this.initSelected(!0),this.initFilter(),this.initDrop(),this.initView(),this.options.onAfterCreate()}destroy(e=!0){var t,i,s,n,o;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(),(t=this.virtualScroll)==null||t.destroy(),(i=this.dropElm)==null||i.remove(),this.dropElm=void 0,(s=this.parentElm.parentNode)==null||s.removeChild(this.parentElm),this.fromHtml&&(delete this.options.data,this.fromHtml=!1),this.options.onAfterDestroy({hardDestroy:e}),e&&((o=(n=this.options).onAfterHardDestroy)==null||o.call(n),Object.keys(this.options).forEach(l=>delete this[l])))}initLocale(){if(this.options.locale){if(typeof this.options.locale=="object"){Object.assign(this.options,this.options.locale);return}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]])Object.assign(this.options,e[t[0]]);else throw new Error(`[multiple-select-vanilla] invalid locales "${this.options.locale}", make sure to import it before using it`)}}initContainer(){var s;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),(s=this.labelElm)!=null&&s.querySelector("input")&&(this.labelElm=null),typeof this.options.single>"u"&&(this.options.single=!this.elm.multiple),this.parentElm=Ge("div",{className:Tr(`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=Ge("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(Ge("span",{className:"ms-placeholder",textContent:this.options.placeholder})),this.options.showClear&&(this.selectClearElm=Ge("div",{className:"ms-icon ms-icon-close"}),this.selectClearElm.style.display="none",this.choiceElm.appendChild(this.selectClearElm)),this.choiceElm.appendChild(Ge("div",{className:"ms-icon ms-icon-caret"})),this.dropElm=Ge("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=typeof this.options.dropWidth=="string"?this.options.dropWidth:`${this.options.dropWidth}px`),Ku(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",n=>{this.getEventTarget(n)===this.choiceElm||Ta(this.getEventTarget(n),".ms-choice")===this.choiceElm||(this.getEventTarget(n)===this.dropElm||Ta(this.getEventTarget(n),".ms-drop")!==this.dropElm&&this.getEventTarget(n)!==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(t=>typeof t=="string"||typeof t=="number"?{text:t,value:t}:t);else if(typeof this.options.data=="object"){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=Xu(this.data||[])}initRow(e,t){var s,n;let i={};return((s=e.tagName)==null?void 0:s.toLowerCase())==="option"?(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):((n=e.tagName)==null?void 0:n.toLowerCase())==="optgroup"?(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(o=>{i.children.push(this.initRow(o,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||[])t.type==="optgroup"?e+=t.children.length:e+=1;this.options.filter=e>this.options.filterByDataLength}initList(){var e,t;if(this.options.filter&&(this.filterParentElm=Ge("div",{className:"ms-search"},this.dropElm),this.filterParentElm.appendChild(Ge("input",{autocomplete:"off",autocapitalize:"off",spellcheck:!1,type:"text",placeholder:this.options.filterPlaceholder||"🔎︎"})),this.options.showSearchClear&&this.filterParentElm.appendChild(Ge("span",{className:"ms-icon ms-icon-close"}))),this.options.selectAll&&!this.options.single){let i=this.elm.getAttribute("name")||this.options.name||"";this.selectAllParentElm=Ge("div",{className:"ms-select-all",dataset:{key:"select_all"}});let s=document.createElement("label"),n=`ms-icon ${this.isAllSelected?"ms-icon-check":this.isPartiallyAllSelected?"ms-icon-minus":"ms-icon-uncheck"}`,o=Ge("div",{className:"icon-checkbox-container"},s);Ge("input",{type:"checkbox",ariaChecked:String(this.isAllSelected),checked:this.isAllSelected,dataset:{name:`selectAll${i}`}},o),Ge("div",{className:n},o),s.appendChild(Ge("span",{textContent:this.formatSelectAll()})),this.selectAllParentElm.appendChild(s),(e=this.dropElm)==null||e.appendChild(this.selectAllParentElm)}this.ulElm=document.createElement("ul"),this.ulElm.role="combobox",this.ulElm.ariaExpanded="false",this.ulElm.ariaMultiSelectable=String(!this.options.single),(t=this.dropElm)==null||t.appendChild(this.ulElm),this.options.showOkButton&&!this.options.single&&(this.okButtonElm=Ge("button",{className:"ms-ok-button",type:"button",textContent:this.formatOkButton()},this.dropElm)),this.initListItems()}initListItems(){var i;let e=0,t=this.getListRows();if(this.options.selectAll&&!this.options.single&&(e=-1),t.length>ft.BLOCK_ROWS*ft.CLUSTER_BLOCKS){let s=this.dropElm&&((i=this.dropElm)==null?void 0:i.style.display)!=="none";!s&&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 o=this.getDataLength();this.updateDataEnd>o&&(this.updateDataEnd=o),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 Ju({rows:t,scrollEl:this.ulElm,contentEl:this.ulElm,sanitizer:this.options.sanitizer,callback:()=>{n(),this.events()}})),n(),!s&&this.dropElm&&(this.dropElm.style.left="0",this.dropElm.style.display="none",this.dropElm.ariaExpanded="false")}else this.ulElm&&(Ys(this.ulElm),t.forEach(s=>this.ulElm.appendChild(Or(s)))),this.updateDataStart=0,this.updateDataEnd=this.updateData.length;return this.events(),t}getEventTarget(e){return e.composedPath?e.composedPath()[0]:e.target}getListRows(){var t;let e=[];return this.updateData=[],(t=this.data)==null||t.forEach(i=>e.push(...this.initListItem(i))),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,t=0){let i=(e==null?void 0:e.title)||"",s=this.options.multiple?"multiple":"",n=this.options.single?"radio":"checkbox",o=!!(e!=null&&e.selected),l=this.options.single&&!this.options.singleRadio,a="";if(!(e!=null&&e.visible))return[];if(this.updateData.push(e),l&&(a="hide-radio "),e.selected&&(a+="selected "),e.type==="optgroup"){let g=[],_;if(this.options.hideOptgroupCheckboxes||this.options.single)_={tagName:"span",props:{dataset:{name:this.selectGroupName,key:e._key}}};else{let y={tagName:"input",props:{type:"checkbox",dataset:{name:this.selectGroupName,key:e._key},checked:o,disabled:e.disabled}};l?_=y:_={tagName:"div",props:{className:`icon-checkbox-container${n==="radio"?" radio":""}`},children:[y,{tagName:"div",props:{className:`ms-icon ${o?n==="radio"?"ms-icon-radio":"ms-icon-check":"ms-icon-uncheck"}`}}]}}!a.includes("hide-radio")&&(this.options.hideOptgroupCheckboxes||this.options.single)&&(a+="hide-radio ");let b={tagName:"span",props:{}};this.applyAsTextOrHtmlWhenEnabled(b.props,e.label);let C={tagName:"li",props:{className:Tr(`group${this.options.single||e.disabled?" disabled":""} ${a}`).join(" "),role:"option",ariaSelected:String(o),dataset:{key:e._key}},children:[{tagName:"label",props:{className:Tr(`optgroup${this.options.single||e.disabled?" disabled":""}`).join(" ")},children:[_,b]}]},E=this.options.cssStyler(e);return E&&(C.props.style=E),g.push(C),e.children.forEach(y=>g.push(...this.initListItem(y,1))),g}if(a+=e.classes||"",t&&this.options.single&&(a+=`option-level-${t} `),e.divider)return[{tagName:"li",props:{className:"option-divider"}}];let h=s||a?(s+a).trim():"";e.disabled&&(h+=" disabled");let d=`${e.disabled?"disabled":""}`,c={tagName:"span",props:{}};this.applyAsTextOrHtmlWhenEnabled(c.props,e.text);let u={tagName:"input",props:{type:n,value:encodeURI(e.value),dataset:{key:e._key,name:this.selectItemName},checked:o,disabled:!!e.disabled}};e.selected&&(u.attrs={checked:"checked"});let p={tagName:"div",props:{className:`icon-checkbox-container${n==="radio"?" radio":""}`},children:[u,{tagName:"div",props:{className:`ms-icon ${u.props.checked?n==="radio"?"ms-icon-radio":"ms-icon-check":"ms-icon-uncheck"}`}}]},m={tagName:"li",props:{role:"option",title:i,ariaSelected:String(o),dataset:{key:e._key}},children:[{tagName:"label",props:{className:d},children:[l?u:p,c]}]};h&&(m.props.className=h);let f=this.options.cssStyler(e);return f&&(m.props.style=f),[m]}initSelected(e=!1){var i,s;let t=0;for(let n of this.data||[])if(n.type==="optgroup"){let o=n.children.filter(l=>(l==null?void 0:l.selected)&&!l.disabled&&l.visible).length;n.children.length&&(n.selected=!this.options.single&&o&&o===n.children.filter(l=>l&&!l.disabled&&l.visible&&!l.divider).length),t+=o}else t+=n.selected&&!n.disabled&&n.visible?1:0;this.isAllSelected=((i=this.data)==null?void 0:i.filter(n=>n.selected&&!n.disabled&&n.visible).length)===((s=this.data)==null?void 0:s.filter(n=>!n.disabled&&n.visible&&!n.divider).length),this.isPartiallyAllSelected=!this.isAllSelected&&t>0,e||(this.isAllSelected?this.options.onCheckAll():t===0&&this.options.onUncheckAll())}initView(){let e;window.getComputedStyle?(e=window.getComputedStyle(this.elm).width,e==="auto"&&(e=Xs(this.dropElm,"outer","width")+20)):e=Xs(this.elm,"outer","width")+20,this.parentElm.style.width=`${this.options.width||e}px`,this.elm.classList.add("ms-offscreen")}events(){var t,i,s,n,o,l,a;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=(t=this.filterParentElm)==null?void 0:t.querySelector(".ms-icon-close"),this.searchInputElm=(i=this.dropElm)==null?void 0:i.querySelector(".ms-search input"),this.selectAllElm=(s=this.dropElm)==null?void 0:s.querySelector(`input[data-name="${this.selectAllName}"]`),this.selectGroupElms=(n=this.dropElm)==null?void 0:n.querySelectorAll(`input[data-name="${this.selectGroupName}"],span[data-name="${this.selectGroupName}"]`),this.selectItemElms=(o=this.dropElm)==null?void 0:o.querySelectorAll(`input[data-name="${this.selectItemName}"]:enabled`),this.noResultsElm=(l=this.dropElm)==null?void 0:l.querySelector(".ms-no-results");let e=h=>{h.preventDefault(),!this.getEventTarget(h).classList.contains("ms-icon-close")&&(this.options.isOpen?this.close("toggle.close"):this.open())};this.labelElm&&this._bindEventService.bind(this.labelElm,"click",h=>{this.getEventTarget(h).nodeName.toLowerCase()==="label"&&(e(h),(!this.options.filter||!this.options.isOpen)&&this.focus(),h.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",h=>{h.code==="Escape"&&this.handleEscapeKey()}),this.closeElm&&this._bindEventService.bind(this.closeElm,"click",h=>{h.preventDefault(),this._checkAll(!1,!0),this.initSelected(!1),this.updateSelected(),this.update(),this.options.onClear()}),this.clearSearchIconElm&&this._bindEventService.bind(this.clearSearchIconElm,"click",h=>{h.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",h=>{h.code==="Tab"&&h.shiftKey&&this.close("key.shift+tab")},void 0,"search-input"),this._bindEventService.bind(this.searchInputElm,"keyup",h=>{var d,c,u;if(this.options.filterAcceptOnEnter&&["Enter","Space"].includes(h.code)&&((d=this.searchInputElm)!=null&&d.value)){if(this.options.single){let p=[];(c=this.selectItemElms)==null||c.forEach(m=>{var f;((f=m.closest("li"))==null?void 0:f.style.display)!=="none"&&p.push(m)}),p.length&&p[0].hasAttribute("data-name")&&this.setSelects([p[0].value])}else(u=this.selectAllElm)==null||u.click();this.close(`key.${h.code.toLowerCase()}`),this.focus();return}this.filter()},void 0,"search-input")),this.selectAllElm&&this._bindEventService.bind(this.selectAllElm,"click",h=>{var d;return this._checkAll((d=h.currentTarget)==null?void 0:d.checked)},void 0,"select-all-checkbox"),this.okButtonElm&&this._bindEventService.bind(this.okButtonElm,"click",h=>{e(h),h.stopPropagation()},void 0,"ok-button"),this.selectGroupElms&&this._bindEventService.bind(this.selectGroupElms,"click",h=>{let d=h.currentTarget,c=d.checked,u=js(this.data,"_key",d.dataset.key);this._checkGroup(u,c),this.options.onOptgroupClick(Er({label:u.label,selected:u.selected,data:u._data,children:u.children.map(p=>{if(p)return Er({text:p.text,value:p.value,selected:p.selected,disabled:p.disabled,data:p._data})})}))},void 0,"group-checkbox-list"),this.selectItemElms&&this._bindEventService.bind(this.selectItemElms,"click",h=>{let d=h.currentTarget,c=d.checked,u=js(this.data,"_key",d.dataset.key),p=()=>{this.options.single&&this.options.isOpen&&!this.options.keepOpen&&this.close("selection")};if(this.options.onBeforeClick(u)===!1){p();return}this._check(u,c),this.options.onClick(Er({text:u.text,value:u.value,selected:u.selected,data:u._data})),p()},void 0,"input-checkbox-list"),this.lastFocusedItemKey&&this.dropElm&&((a=this.dropElm.querySelector(`li[data-key=${this.lastFocusedItemKey}]`))==null||a.focus()),this.options.navigationHighlight&&this.dropElm&&(this._bindEventService.bind(this.dropElm,"mouseover",h=>{var c,u;let d=this.getEventTarget(h).closest(".ms-select-all")||this.getEventTarget(h).closest("li");if((c=this.dropElm)!=null&&c.contains(d)&&this.lastMouseOverPosition!==`${h.clientX}:${h.clientY}`){let p=((u=this.dropElm)==null?void 0:u.querySelectorAll(ns))||[],m=Array.from(p).findIndex(f=>f.dataset.key===d.dataset.key);this._currentHighlightIndex!==m&&!d.classList.contains("disabled")&&(this._currentSelectedElm=d,this._currentHighlightIndex=m,this.changeCurrentOptionHighlight(d))}this.lastMouseOverPosition=`${h.clientX}:${h.clientY}`},void 0,"hover-highlight"),this._bindEventService.bind(this.dropElm,"keydown",h=>{var d,c,u,p;switch(h.key){case"ArrowUp":h.preventDefault(),this.moveHighlightUp();break;case"ArrowDown":h.preventDefault(),this.moveHighlightDown();break;case"Escape":this.handleEscapeKey();break;case"Enter":case" ":{if(document.activeElement!==this.okButtonElm){let m=this.getEventTarget(h).closest(".ms-select-all")||this.getEventTarget(h).closest("li");if(h.key===" "&&this.options.filter||this.options.filterAcceptOnEnter&&!m)return;h.preventDefault(),(c=(d=this._currentSelectedElm)==null?void 0:d.querySelector("input"))==null||c.click(),this.options.single&&(this.choiceElm.focus(),this.lastFocusedItemKey=((u=this.choiceElm)==null?void 0:u.dataset.key)||"")}break}case"Tab":{h.preventDefault(),h.shiftKey?document.activeElement===this.okButtonElm?(this.focusSelectAllOrList(),this.highlightCurrentOption()):(this.close("key.shift+tab"),this.choiceElm.focus()):(this.changeCurrentOptionHighlight(),(p=this.okButtonElm)==null||p.focus());break}}},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 s=!1;e&&this.getEventTarget(e)&&this.ulElm&&this.scrolledByMouse?this.getEventTarget(e).scrollTop+this.getEventTarget(e).clientHeight===this.ulElm.scrollHeight&&(s=!0):t!==void 0&&t+1===i&&(s=!0),s&&this.ulElm&&(this.virtualScroll?this.initListItems():this.ulElm.scrollTop=0,this._currentHighlightIndex=0,this.highlightCurrentOption())}open(e=0){return new Promise(t=>{e!==null&&e>=0?(clearTimeout(this.openDelayTimer),this.openDelayTimer=setTimeout(()=>{this.openDrop(),t()},e)):(this.openDrop(),t())})}openDrop(){var s,n,o,l,a;if(!this.dropElm||(s=this.choiceElm)!=null&&s.classList.contains("disabled"))return;if(this.options.isOpen=!0,this.parentElm.classList.add("ms-parent-open"),(o=(n=this.choiceElm)==null?void 0:n.querySelector("div.ms-icon-caret"))==null||o.classList.add("open"),this.dropElm.style.display="block",this.dropElm.ariaExpanded="true",(l=this.selectAllElm)!=null&&l.parentElement&&(this.selectAllElm.parentElement.style.display="inline-flex"),this.noResultsElm&&(this.noResultsElm.style.display="none"),this.getDataLength()||((a=this.selectAllElm)!=null&&a.parentElement&&(this.selectAllElm.parentElement.style.display="none"),this.noResultsElm&&(this.noResultsElm.style.display="block")),this.options.container){let h=xr(this.dropElm),d;this.options.container instanceof Node?d=this.options.container:typeof this.options.container=="string"&&(d=this.options.container==="body"?document.body:document.querySelector(this.options.container)),d.appendChild(this.dropElm),this.dropElm.style.top=`${(h==null?void 0:h.top)??0}px`,this.dropElm.style.left=`${(h==null?void 0:h.left)??0}px`,this.dropElm.style.minWidth="auto",this.dropElm.style.width=`${Xs(this.parentElm,"outer","width")}px`}let e=this.options.minHeight,t=this.options.maxHeight;this.options.maxHeightUnit==="row"&&(t=Xs(this.dropElm.querySelector("ul>li"),"outer","height")*this.options.maxHeight),this.ulElm??(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(h=>{h.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:h,top:d}=wr(this.dropElm),c=this.dropElm.getBoundingClientRect().height;i=h<c&&d>h?"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(){var t;let e=((t=this.dropElm)==null?void 0:t.querySelectorAll(ns))||[];if(this._currentHighlightIndex<=e.length){let i=e[this._currentHighlightIndex];i&&(this.lastFocusedItemKey=i.dataset.key||"",this._currentSelectedElm=i,this.scrolledByMouse=!1,i.scrollIntoView({block:"nearest"}),this.changeCurrentOptionHighlight(i),setTimeout(()=>this.scrolledByMouse=!0,10))}}changeCurrentOptionHighlight(e){var t;e==null||e.classList.add("highlighted"),(((t=this.dropElm)==null?void 0:t.querySelectorAll(ep))||[]).forEach(i=>{i!==e&&i.classList.remove("highlighted")})}moveHighlightDown(){var i,s;let e=((i=this.dropElm)==null?void 0:i.querySelectorAll(ns))||[],t=e.length;this._currentHighlightIndex<t-1?(this._currentHighlightIndex++,(s=e[this._currentHighlightIndex])!=null&&s.classList.contains("disabled")&&this.moveHighlightDown()):this.options.infiniteScroll&&this.infiniteScrollHandler(null,this._currentHighlightIndex,t),this.highlightCurrentOption()}moveHighlightUp(){var i,s;let e=((i=this.dropElm)==null?void 0:i.querySelectorAll(ns))||[],t=this.options.single?0:1;if(this.virtualScroll&&this._currentHighlightIndex<=t&&this.updateDataStart>0&&this.ulElm){let n=e[this._currentHighlightIndex+(this.options.single?0:1)],o=n==null?void 0:n.dataset.key;this.lastFocusedItemKey=o,this.ulElm.scrollTop=this.ulElm.scrollTop-(n==null?void 0:n.getBoundingClientRect().height)||10,this.isMoveUpRecalcRequired=!0;return}this._currentHighlightIndex>0&&(this._currentHighlightIndex--,(s=e[this._currentHighlightIndex])!=null&&s.classList.contains("disabled")&&this.moveHighlightUp()),this.highlightCurrentOption()}recalculateArrowMove(e){var s;let t=((s=this.dropElm)==null?void 0:s.querySelectorAll(ns))||[],i=Array.from(t).findIndex(n=>n.dataset.key===this.lastFocusedItemKey);this._currentHighlightIndex=i-1,e==="down"?this.moveHighlightDown():e==="up"&&(this.moveHighlightUp(),this.isMoveUpRecalcRequired=!1)}close(e){var t,i;this.options.isOpen=!1,this.parentElm.classList.remove("ms-parent-open"),(i=(t=this.choiceElm)==null?void 0:t.querySelector("div.ms-icon-caret"))==null||i.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=typeof this.options.sanitizer=="function"?this.options.sanitizer(t):t:e.textContent=t}update(e=!1){var h;let t=this.getSelects(),i=this.getSelects("text");this.options.displayValues&&(i=t);let s=(h=this.choiceElm)==null?void 0:h.querySelector("span"),n=t.length,o=null,l=()=>{if(this.options.useSelectOptionLabel||this.options.useSelectOptionLabelToHtml){let d=t.join(this.options.displayDelimiter);return this.options.useSelectOptionLabelToHtml?qu(d):d}return i.join(this.options.displayDelimiter)};if(s){if(n===0){let d=this.options.placeholder||"";s.classList.add("ms-placeholder"),this.applyAsTextOrHtmlWhenEnabled(s,d)}else n<this.options.minimumCountSelected?o=l():this.formatAllSelected()&&n===this.dataTotal?o=this.formatAllSelected():this.options.ellipsis&&n>this.options.minimumCountSelected?o=`${i.slice(0,this.options.minimumCountSelected).join(this.options.displayDelimiter)}...`:this.formatCountSelected(n,this.dataTotal)&&n>this.options.minimumCountSelected?o=this.formatCountSelected(n,this.dataTotal):o=l();if(o!==null&&(s==null||s.classList.remove("ms-placeholder"),this.applyAsTextOrHtmlWhenEnabled(s,o)),this.options.showClear&&this.selectClearElm){let d=o?"block":"none";this.selectClearElm.style.display=d}if(this.options.displayTitle){let d=this.options.useSelectOptionLabel||this.options.useSelectOptionLabelToHtml?"value":"text";s.title=this.getSelects(d).join(this.options.displayDelimiter)}}let a=this.getSelects();this.options.single?this.elm.value=a.length?a[0]:"":Array.from(this.elm.options).forEach(d=>{d.selected=a.some(c=>c===d.value)}),e||this.elm.dispatchEvent(new Event("change"))}updateSelected(e){var i,s,n;for(let o=this.updateDataStart;o<this.updateDataEnd;o++){let l=this.updateData[o],a=(i=this.dropElm)==null?void 0:i.querySelector(`input[data-key=${l._key}]`);if(a){a.checked=l.selected;let h=a.closest("li"),d=h==null?void 0:h.querySelector(".icon-checkbox-container div");h&&(l.selected&&!h.classList.contains("selected")?(h.classList.add("selected"),h.ariaSelected="true",d&&(d.className=`ms-icon ms-icon-${a.type==="radio"?"radio":"check"}`)):l.selected||(h.classList.remove("selected"),h.ariaSelected="false",d&&(d.className="ms-icon ms-icon-uncheck")))}}let t=((s=this.data)==null?void 0:s.filter(o=>o.visible).length)===0;if(this.selectAllElm){this.selectAllElm.ariaChecked=String(this.isAllSelected);let o=(n=this.dropElm)==null?void 0:n.querySelector(".ms-select-all .icon-checkbox-container div");if(o){let l="";this.isAllSelected?l="ms-icon-check":this.isPartiallyAllSelected?l="ms-icon-minus":l="ms-icon-uncheck",o.className=`ms-icon ${l}`}this.selectAllElm.checked=this.isAllSelected,Oa(this.selectAllElm.closest("li"),!t)}Oa(this.noResultsElm,t),this.virtualScroll&&(this.virtualScroll.rows=e??this.getListRows())}getData(){return this.options.data}getDataLength(){var e;return((e=this.data)==null?void 0:e.length)??0}getOptions(e=!0){let t=Object.assign({},this.options);return delete t.data,e?Sr(t):this.options}refreshOptions(e){ju(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(e="value"){let t=[];for(let i of this.data||[])if(i.type==="optgroup"){let s=i.children.filter(n=>n==null?void 0:n.selected);if(!s.length)continue;if(e==="value"||this.options.single)t.push(...s.map(n=>e==="value"&&n._value||n[e]));else{let n=[];n.push("["),n.push(i.label),n.push(`: ${s.map(o=>o[e]).join(", ")}`),n.push("]"),t.push(n.join(""))}}else i.selected&&t.push(e==="value"&&i._value||i[e]);return t}setSelects(e,t="value",i=!1){let s=!1,n=o=>{var l;for(let a of o){let h=!1;if(t==="text"){let d=document.createElement("div");this.applyAsTextOrHtmlWhenEnabled(d,a.text),h=e.includes(((l=d.textContent)==null?void 0:l.trim())??"")}else h=e.includes(a._value||a.value),!h&&a.value===`${+a.value}`&&(h=e.includes(+a.value));a.selected!==h&&(s=!0),a.selected=h}};for(let o of this.data||[])o.type==="optgroup"?n(o.children):n([o]);s&&(this.initSelected(i),this.updateSelected(),this.update(i))}enable(){this.choiceElm&&(this.choiceElm.classList.remove("disabled"),this.choiceElm.disabled=!1)}disable(){var e;this.choiceElm&&((e=this.choiceElm)==null||e.classList.add("disabled"),this.choiceElm.disabled=!0)}check(e){let t=js(this.data,"value",e);t&&this._check(t,!0)}uncheck(e){let t=js(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||[])i.type==="optgroup"?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(s=>{s&&!s.disabled&&!s.divider&&(i||s.visible)&&(s.selected=t)}),i||(this.initSelected(),this.updateSelected(),this.update())}checkInvert(){if(!this.options.single){for(let e of this.data||[])if(e.type==="optgroup")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(){var e;(e=this.choiceElm)==null||e.focus(),this.options.onFocus()}blur(){var e;(e=this.choiceElm)==null||e.blur(),this.options.onBlur()}refresh(){this.destroy(!1),this.init()}filter(e){var n;let t=((n=this.searchInputElm)==null?void 0:n.value.trim())??"",i=t.toLowerCase();if(this.filterText===i)return;this.filterText=i;for(let o of this.data||[])if(o.type==="optgroup")if(this.options.filterGroup){let l=`${(o==null?void 0:o.label)??""}`;if(o!=null){let a=this.options.customFilter({label:Ei(l.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalLabel:l,originalSearch:t,row:o});o.visible=a;for(let h of o.children)h&&(h.visible=a)}}else{for(let l of o.children)if(l!=null){let a=`${(l==null?void 0:l.text)??""}`;l.visible=this.options.customFilter({text:Ei(a.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalText:a,originalSearch:t,row:l,parent:o})}o.visible=o.children.filter(l=>l==null?void 0:l.visible).length>0}else{let l=`${(o==null?void 0:o.text)??""}`;o.visible=this.options.customFilter({text:Ei(l.toString().toLowerCase(),this.options.diacriticParser),search:Ei(i,this.options.diacriticParser),originalText:l,originalSearch:t,row:o})}let s=this.initListItems();this.initSelected(e),this.updateSelected(s),e||this.options.onFilter(t)}adjustDropHeight(e){var d,c,u,p;let t=e!=="top",i=((d=this.filterParentElm)==null?void 0:d.getBoundingClientRect().height)??0,s=((c=this.okButtonElm)==null?void 0:c.getBoundingClientRect().height)??0,n=this.options.single?0:((u=this.selectAllParentElm)==null?void 0:u.getBoundingClientRect().height)??0,o=i+s+n+5,{bottom:l,top:a}=wr(this.parentElm),h=this.options.maxHeight;if(t?h=l-o-this.options.adjustedHeightPadding:h=a-o-this.options.adjustedHeightPadding,!this.options.maxHeight||this.options.maxHeight&&h<this.options.maxHeight){let m=(p=this.dropElm)==null?void 0:p.querySelector("ul");return m&&(m.style.maxHeight=`${h}px`),!0}return!1}adjustDropPosition(e){let t="bottom";if(this.dropElm&&this.parentElm){let{bottom:i,top:s}=wr(this.dropElm),{top:n,left:o}=xr(this.parentElm),l=this.dropElm.getBoundingClientRect().height,a=this.dropElm.getBoundingClientRect().width,h=document.body.offsetWidth||window.innerWidth,d=this.parentElm.getBoundingClientRect().width;if(i>l)t="bottom";else if(l>i&&s>i){if(this.options.container){let c=n-l;c<0&&(c=0),(c>0||e)&&(t="top",this.dropElm.style.top=`${c<0?0:c}px`)}else t="top",this.dropElm.classList.add(t);this.dropElm.classList.remove("bottom")}h-a<o&&(this.dropElm.style.left=`${o-(a-d)}px`)}return t}adjustDropWidthByText(){if(this.dropElm){let e=this.parentElm.scrollWidth;(this.options.dropWidth||this.options.width)&&(e=this.options.dropWidth||this.options.width||0);let t=this.dropElm.querySelector(".ms-select-all span"),i=this.dropElm.querySelector("ul"),s=26,n=(t==null?void 0:t.clientWidth)??0+s,o=i.scrollHeight>i.clientHeight?this.getScrollbarWidth():0,l=0;this.dropElm.querySelectorAll("li label").forEach(a=>{a.scrollWidth>l&&(l=a.scrollWidth)}),l+=s+o,l<n&&(l=n),this.options.maxWidth&&l>this.options.maxWidth&&(l=this.options.maxWidth),this.options.minWidth&&l<this.options.minWidth&&(l=this.options.minWidth),(e==="100%"||+e<l)&&(this.dropElm.style.width=`${l}px`,this.dropElm.style.maxWidth=`${l}px`)}}getScrollbarWidth(){var n;let e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",document.body.appendChild(e);let t=e.offsetWidth;e.style.overflow="scroll";let i=document.createElement("div");i.style.width="100%",e.appendChild(i);let s=i.offsetWidth;return(n=e.parentNode)==null||n.removeChild(e),t-s}formatAllSelected(){return this.options.allSelectedText||this.options.formatAllSelected()}formatCountSelected(e,t){return this.options.countSelectedText?this.options.countSelectedText.replace("#",`${e}`).replace("%",`${t}`):this.options.formatCountSelected(e,t)}formatNoMatchesFound(){return this.options.noMatchesFoundText||this.options.formatNoMatchesFound()}formatOkButton(){return this.options.okButtonText||this.options.formatOkButton()}formatSelectAll(){return this.options.selectAllText||this.options.formatSelectAll()}},wi=(r,e)=>typeof r=="string"?Ir(document.querySelectorAll(r),e):r instanceof Node?Ir([r],e):Ir(r,e);function Ir(r,e){let t=Array.from(r),i=[];for(let s=0;s<t.length;s++){let n=t[s];try{n._multipleSelect!==void 0&&(n._multipleSelect.destroy(),delete n._multipleSelect),n._multipleSelect=new tp(n,e||{}),n._multipleSelect.init();let o=n._multipleSelect.getOptions(!1);o.onHardDestroy=()=>delete n._multipleSelect,o.onAfterHardDestroyed=()=>i[s]=null,i.push(n._multipleSelect)}catch(o){console.error(o)}}return i.length===1?i[0]:i}wi.defaults=ft.DEFAULTS,wi.locales={...ya},wi.methods=ft.METHODS,typeof window<"u"&&(window.multipleSelect=wi);class xa{constructor(e,t,i,s=!0){this.translaterService=e,this.collectionService=t,this.rxjs=i,this._isMultipleSelect=!0,this._collectionLength=0,this._shouldTriggerQuery=!0,this.isFilled=!1,this.enableTranslateLabel=!1,this.subscriptions=[],this._isMultipleSelect=s}get collectionOptions(){var e,t;return((t=(e=this.columnDef)==null?void 0:e.filter)==null?void 0:t.collectionOptions)??{}}get columnFilter(){var e;return((e=this.columnDef)==null?void 0:e.filter)??{}}get customStructure(){var e,t;return(t=(e=this.columnDef)==null?void 0:e.filter)==null?void 0:t.customStructure}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get defaultOperator(){return this.isMultipleSelect?H.in:H.equal}get filterOptions(){var e,t;return{...(e=this.gridOptions.defaultFilterOptions)==null?void 0:e.select,...(t=this.columnFilter)==null?void 0:t.filterOptions}}get isMultipleSelect(){return this._isMultipleSelect}get msInstance(){return this._msInstance}get selectOptions(){return this.defaultOptions}get operator(){var e;return((e=this.columnFilter)==null?void 0:e.operator)??this.defaultOperator}set operator(e){this.columnFilter&&(this.columnFilter.operator=e)}init(e){var s,n,o,l,a,h,d,c,u,p,m;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=((s=this.columnFilter)==null?void 0:s.enableTranslateLabel)??!1,this.labelName=((n=this.customStructure)==null?void 0:n.label)??"label",this.labelPrefixName=((o=this.customStructure)==null?void 0:o.labelPrefix)??"labelPrefix",this.labelSuffixName=((l=this.customStructure)==null?void 0:l.labelSuffix)??"labelSuffix",this.optionLabel=((a=this.customStructure)==null?void 0:a.optionLabel)??"value",this.valueName=((h=this.customStructure)==null?void 0:h.value)??"value",this.enableTranslateLabel&&(!this.translaterService||typeof this.translaterService.translate!="function"))throw new Error('[select-filter] The Translate Service is required for the Select Filter to work correctly when "enableTranslateLabel" is set.');this._locales=((d=this.gridOptions)==null?void 0:d.locales)??R.locales,this.initMultipleSelectTemplate();let t=((c=this.gridOptions)==null?void 0:c.defaultFilterPlaceholder)||"";(u=this.columnFilter)!=null&&u.placeholder&&(t=this.columnFilter.placeholder),this.defaultOptions.placeholder=t||"",this._isMultipleSelect&&((p=this.columnDef)!=null&&p.filter)&&(this.columnDef.filter.emptySearchTermReturnAllValues=((m=this.columnDef.filter)==null?void 0:m.emptySearchTermReturnAllValues)??!1);const i=this.columnFilter.collection||[];return new Promise(async(f,g)=>{try{let _;this.columnFilter.collectionAsync&&!this.columnFilter.collection?(_=zo(this.columnFilter.collectionAsync,this.columnDef,this.renderDomElement.bind(this),this.rxjs,this.subscriptions),f(_)):(_=i,this.renderDomElement(i),f(i)),(this.columnFilter.collectionAsync||this.columnFilter.enableCollectionWatch)&&(await(_??this.columnFilter.collectionAsync),this.watchCollectionChanges())}catch(_){g(_)}})}clear(e=!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(){var e,t;typeof((e=this._msInstance)==null?void 0:e.destroy)=="function"&&this._msInstance.destroy(),(t=this.filterElm)==null||t.remove(),hs(this.subscriptions)}getValues(){var e;return((e=this._msInstance)==null?void 0:e.getSelects())??[]}setValues(e,t,i=!1){e!==void 0&&this._msInstance&&(e=Array.isArray(e)?e.every(s=>Bi(s))?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){var i,s;let t=e;if(this.columnFilter&&this.columnFilter.collectionFilterBy){const n=this.columnFilter.collectionFilterBy,o=((i=this.columnFilter.collectionOptions)==null?void 0:i.filterResultAfterEachPass)||null;t=((s=this.collectionService)==null?void 0:s.filterCollection(t,n,o))||[]}return t}sortCollection(e){var i;let t=e;if(this.columnFilter&&this.columnFilter.collectionSortBy){const s=this.columnFilter.collectionSortBy;t=((i=this.collectionService)==null?void 0:i.sortCollection(this.columnDef,t,s,this.enableTranslateLabel))||[]}return t}watchCollectionChanges(){var e;(e=this.columnFilter)!=null&&e.collection&&(Pi(this.columnFilter.collection,this.watchCallback.bind(this)),ls(this.columnFilter,"collection",this.propertyObserverCallback.bind(this)))}propertyObserverCallback(e){this.renderDomElement(e||[]),this.columnFilter.collection&&Pi(this.columnFilter.collection,this.watchCallback.bind(this))}watchCallback(e){this.renderDomElement(this.columnFilter.collection||e||[])}renderDomElement(e){var n,o,l,a;if(!Array.isArray(e)&&((n=this.collectionOptions)!=null&&n.collectionInsideObjectProperty)){const h=this.collectionOptions.collectionInsideObjectProperty;e=Ee(e,h||"")}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]),(o=this.collectionOptions)!=null&&o.addBlankEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==""&&t.unshift(this.createBlankEntry()),(l=this.collectionOptions)!=null&&l.addCustomFirstEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==this.collectionOptions.addCustomFirstEntry[this.valueName]&&t.unshift(this.collectionOptions.addCustomFirstEntry),(a=this.collectionOptions)!=null&&a.addCustomLastEntry&&Array.isArray(t)&&t.length>0){const h=t.length-1;t[h][this.valueName]!==this.collectionOptions.addCustomLastEntry[this.valueName]&&t.push(this.collectionOptions.addCustomLastEntry)}let i=t;i=this.filterCollection(i),i=this.sortCollection(i);const s=vl("filter",i,this.columnDef,this.grid,this.isMultipleSelect,this.translaterService,this.searchTerms||[]);this.isFilled=s.hasFoundSearchTerm,this.createFilterElement(s.selectElement,s.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){var s;const i=((s=this.columnDef)==null?void 0:s.id)??"";this.elementName=`filter-${i}`,this.defaultOptions.name=this.elementName,J(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=wi(e,this.filterElmOptions)}initMultipleSelectTemplate(){var s,n,o,l,a,h,d,c,u,p,m,f,g;const e=((s=this.gridOptions)==null?void 0:s.enableTranslate)??!1,i={autoAdjustDropHeight:!0,autoAdjustDropPosition:!0,autoAdjustDropWidthByTextSize:!0,name:`${((n=this.columnDef)==null?void 0:n.id)??""}`,container:"body",darkMode:!!this.gridOptions.darkMode,filter:!1,maxHeight:275,single:!0,singleRadio:!0,showSearchClear:!0,renderOptionLabelAsHtml:((o=this.columnFilter)==null?void 0:o.enableRenderHtml)??!1,sanitizer:_=>this.grid.sanitizeHtmlString(_),onClose:()=>this.onTriggerEvent(),onClear:()=>this.clear()};if(this._isMultipleSelect){i.single=!1,i.singleRadio=!1,i.showOkButton=!0,i.displayTitle=!0;const _=ot(this.gridOptions);i.countSelectedText=e&&((l=this.translaterService)!=null&&l.translate)?this.translaterService.translate(`${_}X_OF_Y_SELECTED`):(a=this._locales)==null?void 0:a.TEXT_X_OF_Y_SELECTED,i.allSelectedText=e&&((h=this.translaterService)!=null&&h.translate)?this.translaterService.translate(`${_}ALL_SELECTED`):(d=this._locales)==null?void 0:d.TEXT_ALL_SELECTED,i.noMatchesFoundText=e&&((c=this.translaterService)!=null&&c.translate)?this.translaterService.translate(`${_}NO_MATCHES_FOUND`):(u=this._locales)==null?void 0:u.TEXT_NO_MATCHES_FOUND,i.okButtonText=e&&((p=this.translaterService)!=null&&p.translate)?this.translaterService.translate(`${_}OK`):(m=this._locales)==null?void 0:m.TEXT_OK,i.selectAllText=e&&((f=this.translaterService)!=null&&f.translate)?this.translaterService.translate(`${_}SELECT_ALL`):(g=this._locales)==null?void 0:g.TEXT_SELECT_ALL}this.defaultOptions=i}onTriggerEvent(){if(this._msInstance){const e=this.getValues();this.updateFilterStyle(Array.isArray(e)&&e.length>1||e.length===1&&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){var t,i,s,n,o,l;e?(this.isFilled=!0,(t=this.filterElm)==null||t.classList.add("filled"),(s=(i=this._msInstance)==null?void 0:i.getParentElement())==null||s.classList.add("filled")):(this.isFilled=!1,(n=this.filterElm)==null||n.classList.remove("filled"),(l=(o=this._msInstance)==null?void 0:o.getParentElement())==null||l.classList.remove("filled"))}}class ip extends xa{constructor(e,t,i){super(e,t,i,!0),this.translaterService=e,this.collectionService=t,this.rxjs=i}}class sp extends xa{constructor(e,t,i){super(e,t,i,!1),this.translaterService=e,this.collectionService=t,this.rxjs=i}}class np extends br{constructor(e){super(e),this.translaterService=e,this.sliderType="single"}}class rp extends br{constructor(e){super(e),this.translaterService=e,this.sliderType="double"}}const qs={autocompleter:Kh,compoundDate:uc,compoundInput:ba,compoundInputNumber:Au,compoundInputPassword:Pu,compoundInputText:ba,compoundSlider:Fu,dateRange:Du,input:Ut,inputMask:Mu,inputNumber:Nu,inputPassword:Lu,inputText:Ut,multipleSelect:ip,singleSelect:sp,slider:np,sliderRange:rp};class op{constructor(e,t,i,s){var n;this.config=e,this.translaterService=t,this.collectionService=i,this.rxjs=s,this._options=((n=this.config)==null?void 0:n.options)??{}}addRxJsResource(e){this.rxjs=e}createFilter(e){let t;return e!=null&&e.model&&(t=typeof e.model=="function"?new e.model(this.translaterService,this.collectionService,this.rxjs):e.model),!t&&this._options.defaultFilter&&(t=new this._options.defaultFilter(this.translaterService,this.collectionService,this.rxjs)),t}}const Rr={alwaysShowVerticalScroll:!0,autoEdit:!1,asyncEditorLoading:!1,autoFitColumnsOnFirstLoad:!0,autoFixResizeTimeout:5*60*5,autoFixResizeRequiredGoodCount:2,autoFixResizeWhenBrokenStyleDetected:!1,autoParseInputFilterOperator:!0,autoResize:{applyResizeToContainer:!0,calculateAvailableSizeBy:"window",bottomPadding:20,minHeight:180,minWidth:300,rightPadding:0},cellHighlightCssClass:"slick-cell-modified",checkboxSelector:{cssClass:"slick-cell-checkboxsel",width:40},columnGroupSeparator:" - ",columnPicker:{hideForceFitButton:!1,hideSyncResizeButton:!0,headerColumnValueExtractor:Ia},cellMenu:{autoAdjustDrop:!0,autoAlignSide:!0,hideCloseButton:!0,hideCommandSection:!1,hideOptionSection:!1,showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},compositeEditorOptions:{labels:{cancelButtonKey:"CANCEL",cloneButtonKey:"CLONE",resetEditorButtonTooltipKey:"RESET_INPUT_VALUE",resetFormButtonKey:"RESET_FORM",massSelectionButtonKey:"APPLY_TO_SELECTION",massSelectionStatusKey:"X_OF_Y_MASS_SELECTED",massUpdateButtonKey:"APPLY_MASS_UPDATE",massUpdateStatusKey:"ALL_X_RECORDS_SELECTED",saveButtonKey:"SAVE"}},contextMenu:{autoAdjustDrop:!0,autoAlignSide:!0,hideCloseButton:!0,hideClearAllGrouping:!1,hideCollapseAllGroups:!1,hideCommandSection:!1,hideCopyCellValueCommand:!1,hideExpandAllGroups:!1,hideExportCsvCommand:!1,hideExportExcelCommand:!1,hideExportTextDelimitedCommand:!0,hideMenuOnScroll:!0,hideOptionSection:!1,iconCollapseAllGroupsCommand:"mdi mdi-arrow-collapse",iconExpandAllGroupsCommand:"mdi mdi-arrow-expand",iconClearGroupingCommand:"mdi mdi-close",iconCopyCellValueCommand:"mdi mdi-content-copy",iconExportCsvCommand:"mdi mdi-download",iconExportExcelCommand:"mdi mdi-file-excel-outline",iconExportTextDelimitedCommand:"mdi mdi-download",showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},customFooterOptions:{dateFormat:"YYYY-MM-DD, hh:mm a",hideRowSelectionCount:!1,hideTotalItemCount:!1,hideLastUpdateTimestamp:!0,footerHeight:25,leftContainerClass:"col-xs-12 col-sm-5",rightContainerClass:"col-xs-6 col-sm-7",metricSeparator:"|",metricTexts:{itemsKey:"ITEMS",ofKey:"OF",itemsSelectedKey:"ITEMS_SELECTED"}},customTooltip:{tooltipTextMaxLength:700,maxWidth:500},dataView:{syncGridSelection:{preserveHidden:!1,preserveHiddenOnSelectionChange:!0},syncGridSelectionWithBackendService:!1},datasetIdPropertyName:"id",defaultFilter:qs.input,defaultBackendServiceFilterTypingDebounce:500,enableFilterTrimWhiteSpace:!1,defaultFilterPlaceholder:"🔎︎",defaultFilterRangeOperator:H.rangeInclusive,defaultColumnSortFieldId:"id",draggableGrouping:{hideToggleAllButton:!1,toggleAllButtonText:"",dropPlaceHolderTextKey:"DROP_COLUMN_HEADER_TO_GROUP_BY"},editable:!1,editorTypingDebounce:450,filterTypingDebounce:0,enableEmptyDataWarningMessage:!0,emptyDataWarning:{className:"slick-empty-data-warning",messageKey:"EMPTY_DATA_WARNING_MESSAGE",hideFrozenLeftWarning:!1,hideFrozenRightWarning:!1,leftViewportMarginLeft:"40%",rightViewportMarginLeft:"40%",frozenLeftViewportMarginLeft:"0px",frozenRightViewportMarginLeft:"40%"},enableAutoResize:!0,enableAutoSizeColumns:!0,enableCellNavigation:!1,enableColumnPicker:!0,enableColumnReorder:!0,enableColumnResizeOnDoubleClick:!0,enableContextMenu:!0,enableExcelExport:!1,enableTextExport:!1,enableGridMenu:!0,enableHeaderMenu:!0,enableMouseHoverHighlightRow:!0,enableSorting:!0,enableTextSelectionOnCells:!0,explicitInitialization:!0,excelExportOptions:{addGroupIndentation:!0,autoDetectCellFormat:!0,exportWithFormatter:!1,filename:"export",format:ve.xlsx,groupingColumnHeaderTitle:"Group By",groupCollapsedSymbol:"⮞",groupExpandedSymbol:"⮟",groupingAggregatorRowText:"",sanitizeDataExport:!0},textExportOptions:{delimiter:wt.comma,exportWithFormatter:!1,filename:"export",format:ve.csv,groupingColumnHeaderTitle:"Group By",groupingAggregatorRowText:"",sanitizeDataExport:!0,useUtf8WithBom:!0},eventNamingStyle:ct.lowerCase,forceFitColumns:!1,frozenHeaderWidthCalcDifferential:1,gridMenu:{dropSide:"left",commandLabels:{clearAllFiltersCommandKey:"CLEAR_ALL_FILTERS",clearAllSortingCommandKey:"CLEAR_ALL_SORTING",clearFrozenColumnsCommandKey:"CLEAR_PINNING",exportCsvCommandKey:"EXPORT_TO_CSV",exportExcelCommandKey:"EXPORT_TO_EXCEL",exportTextDelimitedCommandKey:"EXPORT_TO_TAB_DELIMITED",refreshDatasetCommandKey:"REFRESH_DATASET",toggleDarkModeCommandKey:"TOGGLE_DARK_MODE",toggleFilterCommandKey:"TOGGLE_FILTER_ROW",togglePreHeaderCommandKey:"TOGGLE_PRE_HEADER_ROW"},hideClearAllFiltersCommand:!1,hideClearAllSortingCommand:!1,hideClearFrozenColumnsCommand:!0,hideExportCsvCommand:!1,hideExportExcelCommand:!1,hideExportTextDelimitedCommand:!0,hideForceFitButton:!1,hideRefreshDatasetCommand:!1,hideSyncResizeButton:!0,hideToggleFilterCommand:!1,hideToggleDarkModeCommand:!0,hideTogglePreHeaderCommand:!1,iconCssClass:"mdi mdi-menu",iconClearAllFiltersCommand:"mdi mdi-filter-remove-outline",iconClearAllSortingCommand:"mdi mdi-sort-variant-off",iconClearFrozenColumnsCommand:"mdi mdi-pin-off-outline",iconExportCsvCommand:"mdi mdi-download",iconExportExcelCommand:"mdi mdi-file-excel-outline",iconExportTextDelimitedCommand:"mdi mdi-download",iconRefreshDatasetCommand:"mdi mdi-sync",iconToggleDarkModeCommand:"mdi mdi-brightness-4",iconToggleFilterCommand:"mdi mdi-flip-vertical",iconTogglePreHeaderCommand:"mdi mdi-flip-vertical",menuWidth:16,resizeOnShowHeaderRow:!0,showBulletWhenIconMissing:!0,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270",headerColumnValueExtractor:Ia},headerMenu:{autoAlign:!0,autoAlignOffset:4,minWidth:140,iconClearFilterCommand:"mdi mdi-filter-remove-outline",iconClearSortCommand:"mdi mdi-sort-variant-off",iconFilterShortcutSubMenu:"mdi mdi-filter-outline",iconFreezeColumns:"mdi mdi-pin-outline",iconSortAscCommand:"mdi mdi-sort-ascending",iconSortDescCommand:"mdi mdi-sort-descending",iconColumnHideCommand:"mdi mdi-close",iconColumnResizeByContentCommand:"mdi mdi-arrow-expand-horizontal",hideColumnResizeByContentCommand:!1,hideColumnHideCommand:!1,hideClearFilterCommand:!1,hideClearSortCommand:!1,hideFreezeColumnsCommand:!0,hideSortCommands:!1,subItemChevronClass:"mdi mdi-chevron-down mdi-rotate-270"},ignoreAccentOnStringFilterAndSort:!1,multiColumnSort:!0,numberedMultiColumnSort:!0,tristateMultiColumnSort:!1,sortColNumberInSeparateSpan:!0,suppressActiveCellChangeOnEdit:!1,pagination:{pageSizes:[10,15,20,25,30,40,50,75,100],pageSize:25,totalItems:0},headerRowHeight:35,rowHeight:35,topPanelHeight:30,translationNamespaceSeparator:":",resetFilterSearchValueAfterOnBeforeCancellation:!0,resizeByContentOnlyOnFirstLoad:!0,resizeByContentOptions:{alwaysRecalculateColumnWidth:!1,cellCharWidthInPx:7.8,cellPaddingWidthInPx:14,defaultRatioForStringType:.88,formatterPaddingWidthInPx:0,maxItemToInspectCellContentWidth:1e3,maxItemToInspectSingleColumnWidthByContent:5e3,widthToRemoveFromExceededWidthReadjustment:50},treeDataOptions:{exportIndentMarginLeft:5,exportIndentationLeadingChar:"͏͏͏͏͏͏͏͏͏·"}};function Ia(r,e){const t=(r==null?void 0:r.columnGroup)||"",i=(e==null?void 0:e.columnGroupSeparator)??" - ";return t?t+i+r.name:(r==null?void 0:r.name)??""}class lp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._sum=0,this._itemCount=0,this._type="sum",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._isTreeAggregator=t,this._isInitialized=!0,this._sum=0,this._itemCount=0,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={},e.__treeTotals.count={}),e.__treeTotals.count[this._field]=0,e.__treeTotals[this._type][this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator?t?(e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals),this._sum=parseFloat(e.__treeTotals[this._type][this._field]??0),this._itemCount=e.__treeTotals.count[this._field]??0):U(i)&&(this._sum=parseFloat(i),this._itemCount=1):U(i)&&(this._sum+=parseFloat(i))}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),this.addGroupTotalPropertiesWhenNotExist(e);let t=this._sum,i=this._itemCount;this._isTreeAggregator&&(t+=e[this._type][this._field],i+=e.count[this._field],e.count[this._field]=i),e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={}),this._isTreeAggregator&&e.count===void 0&&(e.count={})}}class ap{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._max=null,this._type="max",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._max=null,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=null)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;if(!this._isTreeAggregator)this.keepMaxValueWhenFound(i);else if(t){e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals);const s=e.__treeTotals[this._type][this._field]!==null?parseFloat(e.__treeTotals[this._type][this._field]):null;s!==null&&U(s)&&(this._max===null||s>this._max)&&(this._max=s)}else U(i)&&this.keepMaxValueWhenFound(i)}storeResult(e){let t=this._max;if(this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&t!==null){const i=e[this._type][this._field];U(i)&&i>t&&(t=i)}e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={})}keepMaxValueWhenFound(e){U(e)&&(this._max===null||e>this._max)&&(this._max=parseFloat(e))}}class hp{constructor(e){this._isInitialized=!1,this._distinctValues=[],this._type="distinct",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){if(this._distinctValues=[],this._isInitialized=!0,t)throw new Error("[Slickgrid-Universal] CloneAggregator is not currently supported for use with Tree Data")}accumulate(e){const t=e&&e.hasOwnProperty(this._field)?e[this._field]:void 0;this._distinctValues.indexOf(t)===-1&&t!==void 0&&this._distinctValues.push(t)}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),e[this._type][this._field]=this._distinctValues}}class dp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._min=null,this._type="min",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._min=null,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=null)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;if(!this._isTreeAggregator)this.keepMinValueWhenFound(i);else if(t){e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals);const s=e.__treeTotals[this._type][this._field]!==null?parseFloat(e.__treeTotals[this._type][this._field]):null;s!==null&&U(s)&&(this._min===null||s<this._min)&&(this._min=s)}else U(i)&&this.keepMinValueWhenFound(i)}storeResult(e){let t=this._min;if(this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&t!==null){const i=e[this._type][this._field];U(i)&&i<t&&(t=i)}e[this._type][this._field]=t}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={})}keepMinValueWhenFound(e){U(e)&&(this._min===null||e<this._min)&&(this._min=parseFloat(e))}}class cp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._count=0,this._type="count",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._count=0,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),e.__treeTotals[this._type][this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator&&(t?(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={}),this._count=e.__treeTotals[this._type][this._field]??0):U(i)&&(this._count=1))}storeResult(e){var i;(!e||e[this._type]===void 0)&&(e[this._type]={});let t=this._count;this._isTreeAggregator?t+=e[this._type][this._field]:t=((i=e.group)==null?void 0:i.rows.length)??0,e[this._type][this._field]=t}}class up{constructor(e){this._isInitialized=!1,this._data="",this._type="clone",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){if(this._data="",this._isInitialized=!0,t)throw new Error("[Slickgrid-Universal] CloneAggregator is not currently supported for use with Tree Data")}accumulate(e){const t=e&&e.hasOwnProperty(this._field)?e[this._field]:null;t!==null&&t!==""&&(this._data=t)}storeResult(e){(!e||e[this._type]===void 0)&&(e[this._type]={}),e[this._type][this._field]=this._data}}class pp{constructor(e){this._isInitialized=!1,this._isTreeAggregator=!1,this._nonNullCount=0,this._sum=0,this._type="avg",this._field=e}get field(){return this._field}get isInitialized(){return this._isInitialized}get type(){return this._type}init(e,t=!1){this._sum=0,this._nonNullCount=0,this._isInitialized=!0,this._isTreeAggregator=t,t&&(e.__treeTotals||(e.__treeTotals={}),e.__treeTotals[this._type]===void 0&&(e.__treeTotals[this._type]={},e.__treeTotals.sum={},e.__treeTotals.count={}),e.__treeTotals[this._type][this._field]=0,e.__treeTotals.count[this._field]=0,e.__treeTotals.sum[this._field]=0)}accumulate(e,t=!1){const i=e!=null&&e.hasOwnProperty(this._field)?e[this._field]:null;this._isTreeAggregator?t?(e.__treeTotals||(e.__treeTotals={}),this.addGroupTotalPropertiesWhenNotExist(e.__treeTotals),this._sum=parseFloat(e.__treeTotals.sum[this._field]??0),this._nonNullCount=e.__treeTotals.count[this._field]??0):U(i)&&(this._sum=parseFloat(i),this._nonNullCount=1):U(i)&&(this._nonNullCount++,this._sum+=parseFloat(i))}storeResult(e){let t=this._sum,i=this._nonNullCount;this.addGroupTotalPropertiesWhenNotExist(e),this._isTreeAggregator&&(t+=e.sum[this._field],i+=e.count[this._field],e.sum[this._field]=t,e.count[this._field]=i),i!==0&&(e[this._type][this._field]=i===0?t:t/i)}addGroupTotalPropertiesWhenNotExist(e){e[this._type]===void 0&&(e[this._type]={}),this._isTreeAggregator&&e.sum===void 0&&(e.sum={}),this._isTreeAggregator&&e.count===void 0&&(e.count={})}}const Ar={Avg:pp,Clone:up,Count:cp,Distinct:hp,Min:dp,Max:ap,Sum:lp};function Ks(r,e){const t=e.errorMessage,i=e.required,s=e.minLength,n=e.maxLength,o=e.operatorConditionalType||"inclusive",l={"{{minLength}}":s,"{{maxLength}}":n};let a=!0,h="";const d=(r==null?void 0:r.length)??0;if(e.validator)return e.validator(r,e.editorArgs);if(i&&r==="")a=!1,h=t||R.VALIDATION_REQUIRED_FIELD;else if(s!==void 0&&n!==void 0&&(o==="exclusive"&&(d<=s||d>=n)||o==="inclusive"&&(d<s||d>n)))a=!1,h=t||R.VALIDATION_EDITOR_TEXT_LENGTH_BETWEEN.replace(/{{minLength}}|{{maxLength}}/gi,c=>l[c]);else if(s!==void 0&&d!==null&&(o==="exclusive"&&d<=s||o==="inclusive"&&d!==null&&d<s)){a=!1;const c=o==="inclusive"?R.VALIDATION_EDITOR_TEXT_MIN_LENGTH_INCLUSIVE:R.VALIDATION_EDITOR_TEXT_MIN_LENGTH;h=t||c.replace(/{{minLength}}/gi,u=>l[u])}else if(n!==void 0&&d!==null&&(o==="exclusive"&&d>=n||o==="inclusive"&&d!==null&&d>n)){a=!1;const c=o==="inclusive"?R.VALIDATION_EDITOR_TEXT_MAX_LENGTH_INCLUSIVE:R.VALIDATION_EDITOR_TEXT_MAX_LENGTH;h=t||c.replace(/{{maxLength}}/gi,u=>l[u])}return{valid:a,msg:h}}const mp=3;class fp{constructor(e){var t;if(this.args=e,this._isValueTouched=!1,this._lastTriggeredByClearInput=!1,this.disabled=!1,this.forceUserInput=!1,this.finalCollection=[],!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this._bindEventService=new Ae,(t=this.gridOptions)!=null&&t.translater&&(this._translater=this.gridOptions.translater),this._locales=this.gridOptions&&this.gridOptions.locales||R.locales,this.init()}get autocompleterOptions(){return this._autocompleterOptions||{}}get collection(){var e;return((e=this.columnEditor)==null?void 0:e.collection)??[]}get editorDomElement(){return this._inputElm}get elementCollection(){return this._elementCollection}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get customStructure(){var i,s,n,o,l;let e=(i=this.columnEditor)==null?void 0:i.customStructure;const t=((s=this.columnEditor)==null?void 0:s.type)??((n=this.columnDef)==null?void 0:n.type);return!e&&t===S.object&&((o=this.columnDef)!=null&&o.dataKey)&&((l=this.columnDef)!=null&&l.labelKey)&&(e={label:this.columnDef.labelKey,value:this.columnDef.dataKey}),e}get dataContext(){return this.args.item}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.autocompleter,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get gridOptions(){var e;return((e=this.grid)==null?void 0:e.getOptions())??{}}get instance(){return this._instance}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var t,i,s,n,o,l;this.labelName=((t=this.customStructure)==null?void 0:t.label)??"label",this.valueName=((i=this.customStructure)==null?void 0:i.value)??"value",this.labelPrefixName=((s=this.customStructure)==null?void 0:s.labelPrefix)??"labelPrefix",this.labelSuffixName=((n=this.customStructure)==null?void 0:n.labelSuffix)??"labelSuffix";let e=this.columnEditor.collection;(o=this.columnEditor)!=null&&o.collectionAsync&&!e&&(e=[]),this.renderDomElement(e),(this.disabled||(l=this.columnEditor)!=null&&l.collectionAsync&&Array.isArray(e)&&e.length===0)&&this.disable(!0)}destroy(){var e,t,i;this._bindEventService.unbindAll(),typeof((e=this._instance)==null?void 0:e.destroy)=="function"&&this._instance.destroy(),(i=(t=this._inputElm)==null?void 0:t.remove)==null||i.call(t),this._elementCollection=null}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._inputElm)if(e){this._inputElm.disabled=!0;const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.clear(!0)}else this._inputElm.disabled=!1}focus(){this.grid.focus(),this._inputElm&&(this._inputElm.focus(),this._inputElm.select())}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){return this._inputElm.value}setValue(e,t=!1,i=!0){if(this._inputElm.value=e!=null&&e.hasOwnProperty(this.labelName)?e[this.labelName]:e,t){this._currentValue=e,this._defaultTextValue=typeof e=="string"?e:(e==null?void 0:e[this.labelName])??"",this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var n,o;let i=t;const s=(n=this.columnDef)==null?void 0:n.field;if(s!==void 0){Array.isArray(this.collection)&&this.collection.length>0&&(i=xt(this.collection,h=>h&&Ht(t)&&h.hasOwnProperty(this.valueName)?h[this.valueName].toString()===(t.hasOwnProperty(this.valueName)&&t[this.valueName].toString()):h&&typeof t=="string"&&h.hasOwnProperty(this.valueName)?h[this.valueName].toString()===t:(h==null?void 0:h.toString())===t,""));const l=(s==null?void 0:s.indexOf("."))>0,a=this.validate(null,i);if(i=a!=null&&a.valid?i:"",l){const h=((o=this.columnEditor)==null?void 0:o.complexObjectPath)??s??"";$e(e,h,i)}else e[s]=i}}isValueChanged(){var s,n;const e=this._inputElm.value,t=(s=this._lastInputKeyEvent)==null?void 0:s.key;if((n=this.columnEditor)!=null&&n.alwaysSaveOnEnterKey&&t==="Enter")return!0;const i=!(e===""&&(this._defaultTextValue===null||this._defaultTextValue===void 0))&&e!==this._defaultTextValue;return this._lastTriggeredByClearInput||i}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._currentValue=n,this._originalValue=n,this._defaultTextValue=typeof n=="string"?n:(n==null?void 0:n[this.labelName])??"",this._inputElm.value=this._defaultTextValue,this._inputElm.select()}}clear(e=!1){this._inputElm&&(this._currentValue="",this._defaultTextValue="",this.setValue("",!0)),this._isValueTouched=!0,this._lastTriggeredByClearInput=!0;const t=this.args.compositeEditorOptions;if(t){const i=!e;this.handleChangeOnCompositeEditor(null,t,"user",i)}else this.save()}reset(e,t=!0,i=!1){const s=e??this._originalValue??"";this._inputElm&&(this._currentValue=s,this._defaultTextValue=typeof s=="string"?s:(s==null?void 0:s[this.labelName])??"",this._inputElm.value=this._defaultTextValue),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e,t,i,s,n;if(this._inputElm&&this.editorOptions.forceUserInput){const o=((e=this.editorOptions)==null?void 0:e.minLength)??mp;this._currentValue=this._inputElm.value.length>o?this._inputElm.value:this._currentValue}return this.customStructure&&this._currentValue&&this._currentValue.hasOwnProperty(this.valueName)&&((t=this.columnDef)==null?void 0:t.type)!==S.object&&((i=this.columnEditor)==null?void 0:i.type)!==S.object?this._currentValue[this.valueName]:this._currentValue&&this._currentValue.value!==void 0?((s=this.columnDef)==null?void 0:s.type)===S.object||((n=this.columnEditor)==null?void 0:n.type)===S.object?{[this.labelName]:this._currentValue.label,[this.valueName]:this._currentValue.value}:this._currentValue.value:this._currentValue}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._inputElm)==null?void 0:s.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleSelect(e){var t;if(e!==void 0){const s=e;this._currentValue=s,this._isValueTouched=!0;const n=this.args.compositeEditorOptions,o=((t=this.editorOptions)==null?void 0:t.renderItem)??!1,l=typeof s=="string"?s:o?s[this.labelName]:s.label;if(this.setValue(l),n?this.handleChangeOnCompositeEditor(null,n):this.save(),typeof this.editorOptions.onSelectItem=="function"){const{row:a,cell:h}=this.grid.getActiveCell()||{};this.editorOptions.onSelectItem(e,a,h,this.args.column,this.args.item)}setTimeout(()=>this._lastTriggeredByClearInput=!1)}return!1}renderRegularItem(e){const t=typeof e=="string"?e:(e==null?void 0:e.label)??"";return v("div",{textContent:t||""})}renderCustomItem(e){var s,n;const t=((n=(s=this._autocompleterOptions)==null?void 0:s.renderItem)==null?void 0:n.templateCallback(e))??"",i=document.createElement("div");return this.grid.applyHtmlCode(i,t),i}renderCollectionItem(e){var h;const t=((h=this.columnEditor)==null?void 0:h.enableRenderHtml)??!1,i=e.labelPrefix||"",s=e.label||"",n=e.labelSuffix||"",o=i+s+n,l=this.grid.sanitizeHtmlString(o)||"",a=document.createElement("div");return a[t?"innerHTML":"textContent"]=l,a}renderDomElement(e){var l,a,h,d,c,u,p,m,f,g,_,b;const t=((l=this.columnDef)==null?void 0:l.id)??"",i=((a=this.columnEditor)==null?void 0:a.placeholder)??"",s=((h=this.columnEditor)==null?void 0:h.title)??"";this._editorInputGroupElm=v("div",{className:"autocomplete-container input-group"});const n=v("span",{className:"input-group-btn input-group-append",dataset:{clear:""}});this._clearButtonElm=v("button",{type:"button",className:"btn btn-default btn-clear"}),this._clearButtonElm.appendChild(v("i",{className:"icon-clear"})),this._inputElm=v("input",{type:"text",placeholder:i,title:s,autocomplete:"off",ariaAutoComplete:"none",className:`autocomplete form-control editor-text input-group-editor editor-${t}`,dataset:{input:""}},this._editorInputGroupElm),this._editorInputGroupElm.appendChild(document.createElement("span")),(d=this.editorOptions)!=null&&d.hideClearButton||(n.appendChild(this._clearButtonElm),this._editorInputGroupElm.appendChild(n),this._bindEventService.bind(this._clearButtonElm,"click",()=>this.clear())),this._bindEventService.bind(this._inputElm,"focus",()=>{var C;return(C=this._inputElm)==null?void 0:C.select()}),this._bindEventService.bind(this._inputElm,"keydown",C=>{this._lastInputKeyEvent=C,(C.key==="ArrowLeft"||C.key==="ArrowRight")&&C.stopImmediatePropagation(),C.key==="Enter"&&C.target.value===""&&this.columnEditor.alwaysSaveOnEnterKey&&(this._currentValue=null)});let o=e;if(o&&((c=this.columnEditor)!=null&&c.collectionOverride)){const C={column:this.columnDef,dataContext:this.dataContext,grid:this.grid,originalCollections:this.collection};if(this.args.compositeEditorOptions){const{formValues:E,modalType:y}=this.args.compositeEditorOptions;C.compositeEditorOptions={formValues:E,modalType:y}}o=this.columnEditor.collectionOverride(o,C)}o&&(this.finalCollection=o),Array.isArray(o)&&(this.collection.every(C=>Bi(C))?o=o.map(C=>({label:C,value:C})):o=o.map(C=>({label:C==null?void 0:C[this.labelName],value:C==null?void 0:C[this.valueName],labelPrefix:(C==null?void 0:C[this.labelPrefixName])??"",labelSuffix:(C==null?void 0:C[this.labelSuffixName])??""})),this._elementCollection=o),this._autocompleterOptions={input:this._inputElm,debounceWaitMs:200,className:`slick-autocomplete ${((u=this.editorOptions)==null?void 0:u.className)??""}`.trim(),emptyMsg:this.gridOptions.enableTranslate&&((p=this._translater)!=null&&p.translate)?this._translater.translate("NO_ELEMENTS_FOUND"):((m=this._locales)==null?void 0:m.TEXT_NO_ELEMENTS_FOUND)??"No elements found",customize:(C,E,y)=>{y.style.width=""},onSelect:this.handleSelect.bind(this),...this.editorOptions},(f=this.gridOptions)!=null&&f.darkMode&&(this._autocompleterOptions.className+=" slick-dark-mode"),this.autocompleterOptions.className=he(this.autocompleterOptions.className).join(" "),(g=this._autocompleterOptions.renderItem)!=null&&g.layout?(this._autocompleterOptions.className+=` autocomplete-custom-${ui(this._autocompleterOptions.renderItem.layout)}`,this._autocompleterOptions.render=this.renderCustomItem.bind(this)):Array.isArray(e)?this._autocompleterOptions.render=((_=this._autocompleterOptions.render)==null?void 0:_.bind(this))??this.renderCollectionItem.bind(this):this._autocompleterOptions.render||(this._autocompleterOptions.render=this.renderRegularItem.bind(this)),(b=this._autocompleterOptions)!=null&&b.fetch?(Bo(this._inputElm,this._autocompleterOptions),this._instance=fs(this._autocompleterOptions)):this._instance=fs({...this._autocompleterOptions,fetch:(C,E)=>{o&&E(o.filter(y=>((typeof y=="string"?y:y==null?void 0:y.label)||"").toLowerCase().includes(C.toLowerCase())))}}),this.args.container.appendChild(this._editorInputGroupElm),this.args.compositeEditorOptions||setTimeout(()=>this.focus(),50)}}class gp{constructor(e){if(this.args=e,this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._input}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var s,n,o,l;const e=((s=this.columnDef)==null?void 0:s.id)??"",t=this.args.compositeEditorOptions;this._checkboxContainerElm=v("div",{className:`checkbox-editor-container editor-${e}`}),this._input=v("input",{type:"checkbox",value:"true",ariaLabel:((n=this.columnEditor)==null?void 0:n.ariaLabel)??`${_t(e+"")} Checkbox Editor`,className:`editor-checkbox editor-${e}`,title:((o=this.columnEditor)==null?void 0:o.title)??""});const i=(l=this.args)==null?void 0:l.container;i&&typeof i.appendChild=="function"&&(t?(this._checkboxContainerElm.appendChild(this._input),i.appendChild(this._checkboxContainerElm)):i.appendChild(this._input)),this.hasAutoCommitEdit&&!t&&this._bindEventService.bind(this._input,"click",()=>{this._isValueTouched=!0,this.save()}),t?this._bindEventService.bind(this._input,"change",a=>{this._isValueTouched=!0,this.handleChangeOnCompositeEditor(a,t)}):this.focus()}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._input)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._input)if(e){this._input.setAttribute("disabled","disabled"),this._checkboxContainerElm.classList.add("disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==!1&&this.reset(!1,!0,!0)}else this._input.removeAttribute("disabled"),this._checkboxContainerElm.classList.remove("disabled")}focus(){var e;this.grid.focus(),(e=this._input)==null||e.focus()}preClick(){this._input&&(this._input.checked=!this._input.checked)}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){var e;return((e=this._input)==null?void 0:e.checked)??!1}setValue(e,t=!1,i=!0){const s=!!e;if(this._input&&(this._input.checked=s),t){this.applyValue(this.args.item,this.serializeValue());const n=this.args.compositeEditorOptions;n&&i&&this.handleChangeOnCompositeEditor(null,n,"system")}}applyValue(e,t){var s;const i=this.columnDef&&this.columnDef.field;if(i!==void 0){const n=(i==null?void 0:i.indexOf("."))>0,o=this.validate(null,t),l=o&&o.valid?t:"";if(n){const a=((s=this.columnEditor)==null?void 0:s.complexObjectPath)??i??"";$e(e,a,l)}else e[i]=l}}isValueChanged(){return this.serializeValue()!==this._originalValue}isValueTouched(){return this._isValueTouched}loadValue(e){const t=this.columnDef&&this.columnDef.field;if(e&&t!==void 0&&this._input){const s=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=s,this._input.checked=!!this._originalValue}}reset(e,t=!0,i=!1){const s=e??this._originalValue??!1;this._input&&(this._originalValue=s,this._input.checked=!!s),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=e&&e.valid||!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e;return((e=this._input)==null?void 0:e.checked)??!1}validate(e,t){var o,l;const i=(o=this.args)!=null&&o.compositeEditorOptions?!1:this.columnEditor.required,s=t!==void 0?t:(l=this._input)==null?void 0:l.checked,n=this.columnEditor.errorMessage;return this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled?{valid:!0,msg:""}:this.validator?this.validator(s,this.args):i&&!s?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:{valid:!0,msg:null}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}}class _p{constructor(e){var t;if(this.args=e,this._isValueTouched=!1,this._lastClickIsDate=!1,this._lastTriggeredByClearDate=!1,this.hasTimePicker=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},(t=this.gridOptions)!=null&&t.translater&&(this._translaterService=this.gridOptions.translater),this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._inputElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.date,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get pickerOptions(){return this._pickerMergedOptions}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}async init(){var e,t,i,s,n,o,l;if(this.args&&this.columnDef){const a=this.args.compositeEditorOptions,h=((e=this.columnDef)==null?void 0:e.id)??"",d=this.args.grid.getOptions()||{};this.defaultDate=(t=this.args.item)==null?void 0:t[this.columnDef.field];const c=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,u=Ze(c),p=((s=(i=this._translaterService)==null?void 0:i.getCurrentLanguage)==null?void 0:s.call(i))||d.locale||"en";u&&(u==="ISO8601"||u.toLowerCase().includes("h"))&&(this.hasTimePicker=!0);const m=Ze(this.hasTimePicker?S.dateTimeIsoAM_PM:S.dateIso),f={input:!0,jumpToSelectedDate:!0,sanitizer:b=>this.grid.sanitizeHtmlString(b),toggleSelected:!1,actions:{clickDay:()=>{this._lastClickIsDate=!0},changeToInput:(b,C)=>{if(C.HTMLInputElement){let E="";if(C.selectedDates[0]?(E=C.selectedDates[0],C.HTMLInputElement.value=Ct(C.selectedDates[0],void 0,c)):C.HTMLInputElement.value="",E&&this.hasTimePicker){const y=ms(E,m);y.setHours(+(C.selectedHours||0)),y.setMinutes(+(C.selectedMinutes||0)),C.HTMLInputElement.value=Ct(y,void 0,c)}this._lastClickIsDate&&(this.handleOnDateChange(),C.hide())}}},settings:{lang:p,iso8601:!1,visibility:{theme:(n=this.gridOptions)!=null&&n.darkMode?"dark":"light",positionToInput:"auto",weekend:!1}}};this.hasTimePicker&&(f.settings.selection={time:24}),this._pickerMergedOptions=de(!0,{},f,{settings:this.editorOptions,type:"default"});const g=`.editor-text.date-picker.editor-${h}.form-control.input-group-editor`;this._editorInputGroupElm=v("div",{className:"vanilla-picker input-group"});const _=v("span",{className:"input-group-btn input-group-append",dataset:{clear:""}});this._clearButtonElm=v("button",{type:"button",className:"btn btn-default btn-clear"}),this._clearButtonElm.appendChild(v("i",{className:"icon-clear"})),this._inputElm=v("input",{placeholder:((o=this.columnEditor)==null?void 0:o.placeholder)??"",title:this.columnEditor&&this.columnEditor.title||"",className:g.replace(/\./g," "),dataset:{input:"",defaultdate:this.defaultDate},readOnly:!0},this._editorInputGroupElm),this.args.container.appendChild(this._editorInputGroupElm),(l=this.columnEditor.editorOptions)!=null&&l.hideClearButton||(_.appendChild(this._clearButtonElm),this._editorInputGroupElm.appendChild(_),this._bindEventService.bind(this._clearButtonElm,"click",()=>{this.clear(),this.handleOnDateChange()})),queueMicrotask(()=>{this.calendarInstance=new gl(this._inputElm,this._pickerMergedOptions),this.calendarInstance.init(),a||(this.show(),this.focus()),this.calendarInstance&&$i(this.columnEditor,this._inputElm,this.calendarInstance,{columnDef:this.columnDef,newVal:this.defaultDate,updatePickerUI:!0})})}}destroy(){queueMicrotask(()=>{var e,t,i;this.hide(),(e=this.calendarInstance)==null||e.destroy(),J(this._editorInputGroupElm),J(this._inputElm),(t=this._editorInputGroupElm)==null||t.remove(),(i=this._inputElm)==null||i.remove()}),this._bindEventService.unbindAll()}clear(){this._lastTriggeredByClearDate=!0,this.calendarInstance&&(this.calendarInstance.settings.selected.dates=[],this._inputElm.value="")}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._inputElm)if(e){this._inputElm.setAttribute("disabled","disabled"),this._clearButtonElm.disabled=!0;const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._inputElm.removeAttribute("disabled"),this._clearButtonElm.disabled=!1}changeEditorOption(e,t){this.columnEditor.editorOptions||(this.columnEditor.editorOptions={}),this.columnEditor.editorOptions[e]=t,this._pickerMergedOptions=de(!0,{},this._pickerMergedOptions,{settings:{[e]:t}})}focus(){var e;this.grid.focus(),this.show(),(e=this._inputElm)==null||e.focus()}hide(){var e;(e=this.calendarInstance)==null||e.hide()}show(){var t;const e=!!((t=this.args)!=null&&t.compositeEditorOptions);!e&&this.calendarInstance?this.calendarInstance.show():e&&this.applyInputUsabilityState()}getValue(){return this._inputElm.value}setValue(e,t=!1,i=!0){if(this.calendarInstance&&$i(this.columnEditor,this._inputElm,this.calendarInstance,{columnDef:this.columnDef,newVal:e,updatePickerUI:!0}),t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(s,"system")}}applyValue(e,t){var s,n;const i=(s=this.columnDef)==null?void 0:s.field;if(this.columnDef&&i!==void 0){const o=this.columnDef.saveOutputType||this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,l=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateUtc,a=i.indexOf(".")>0,h=this.validate(null,t),d=t&&(h!=null&&h.valid)?Ct(t,l,o):"";if(a){const c=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??i;$e(e,c,d)}else e[i]=d}}isValueChanged(){let e=!1;const t=this.getValue();return this.columnDef&&(e=this._lastTriggeredByClearDate||!(t===""&&this._originalDate==="")&&t!==this._originalDate),e}isValueTouched(){return this._isValueTouched}loadValue(e){var i,s;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&this.columnDef&&t!==void 0){const o=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t],l=this.columnEditor.type||((s=this.columnDef)==null?void 0:s.type)||S.dateIso,a=this.columnDef.outputType||this.columnEditor.type||this.columnDef.type||S.dateIso;this._originalDate=Ct(o,l,a),this._inputElm.value=this._originalDate}}reset(e,t=!0,i=!1){const s=e??this._originalDate??"";this.calendarInstance&&(this._originalDate=s,this.calendarInstance.settings.selected.dates=[s],s||(this.calendarInstance.settings.selected.dates=[],this._inputElm.value="")),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){const e=this.getValue();return e||""}validate(e,t){var o,l;const i=(o=this.args)!=null&&o.compositeEditorOptions?!1:this.columnEditor.required,s=t??((l=this._inputElm)==null?void 0:l.value),n=this.columnEditor.errorMessage;return this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled?{valid:!0,msg:""}:this.validator?this.validator(s,this.args):i&&s===""?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:{valid:!0,msg:null}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleOnDateChange(){if(this._isValueTouched=!0,this.args){const e=this.args.compositeEditorOptions;e?this.handleChangeOnCompositeEditor(e):this.save()}setTimeout(()=>this._lastTriggeredByClearDate=!1)}handleChangeOnCompositeEditor(e,t="user",i=!1){var c,u,p;const s=this.grid.getActiveCell(),n=this.args.column,o=((c=this.columnDef)==null?void 0:c.id)??"",l=this.dataContext,a=this.grid,h=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,h),this.applyValue(e.formValues,h);const d=((p=(u=this.gridOptions)==null?void 0:u.compositeEditorOptions)==null?void 0:p.excludeDisabledFieldFormValues)??!1;(i||this.disabled&&d&&e.formValues.hasOwnProperty(o))&&delete e.formValues[o],a.onCompositeEditorChange.notify({...s,item:l,grid:a,column:n,formValues:e.formValues,editors:e.editors,triggeredBy:t},new le)}}function Ra(r,e){const t=isNaN(r)?null:parseFloat(r),i=e.decimal||0,s=e.required,n=e.minValue,o=e.maxValue,l=e.operatorConditionalType||"inclusive",a=e.errorMessage,h={"{{minValue}}":n,"{{maxValue}}":o,"{{minDecimal}}":0,"{{maxDecimal}}":i};let d=!0,c="";if(typeof e.validator=="function")return e.validator(r,e.editorArgs);if(s&&r==="")d=!1,c=a||R.VALIDATION_REQUIRED_FIELD;else if(r!==""&&(isNaN(r)||i===0&&!/^[-+]?(\d*(\.)?(\d)*)$/.test(r)))d=!1,c=a||R.VALIDATION_EDITOR_VALID_NUMBER;else if(n!==void 0&&o!==void 0&&t!==null&&(l==="exclusive"&&(t<=+n||t>=+o)||l==="inclusive"&&(t<+n||t>+o)))d=!1,c=a||R.VALIDATION_EDITOR_NUMBER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,u=>h[u]);else if(n!==void 0&&t!==null&&(l==="exclusive"&&t<=+n||l==="inclusive"&&t<+n)){d=!1;const u=l==="inclusive"?R.VALIDATION_EDITOR_NUMBER_MIN_INCLUSIVE:R.VALIDATION_EDITOR_NUMBER_MIN;c=a||u.replace(/{{minValue}}/gi,p=>h[p])}else if(o!==void 0&&t!==null&&(l==="exclusive"&&t>=+o||l==="inclusive"&&t>+o)){d=!1;const u=l==="inclusive"?R.VALIDATION_EDITOR_NUMBER_MAX_INCLUSIVE:R.VALIDATION_EDITOR_NUMBER_MAX;c=a||u.replace(/{{maxValue}}/gi,p=>h[p])}else i>0&&!new RegExp(`^[-+]?(\\d*(\\.)?(\\d){0,${i}})$`).test(r)&&(d=!1,c=a||R.VALIDATION_EDITOR_DECIMAL_BETWEEN.replace(/{{minDecimal}}|{{maxDecimal}}/gi,u=>h[u]));return{valid:d,msg:c}}function Aa(r,e){let t=isNaN(r)?null:parseInt(r,10);t!==null&&isNaN(t)&&(t=null);const i=e.errorMessage,s=e.required,n=e.minValue,o=e.maxValue,l=e.operatorConditionalType||"inclusive",a={"{{minValue}}":n,"{{maxValue}}":o};let h=!0,d="";if(e.validator)return e.validator(r,e.editorArgs);if(s&&r==="")h=!1,d=i||R.VALIDATION_REQUIRED_FIELD;else if(r!==""&&(isNaN(r)||!/^[+-]?\d+$/.test(r)))h=!1,d=i||R.VALIDATION_EDITOR_VALID_INTEGER;else if(n!==void 0&&o!==void 0&&t!==null&&(l==="exclusive"&&(t<=+n||t>=+o)||l==="inclusive"&&(t<+n||t>+o)))h=!1,d=i||R.VALIDATION_EDITOR_INTEGER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,c=>a[c]);else if(n!==void 0&&t!==null&&(l==="exclusive"&&t<=+n||l==="inclusive"&&t!==null&&t<+n)){h=!1;const c=l==="inclusive"?R.VALIDATION_EDITOR_INTEGER_MIN_INCLUSIVE:R.VALIDATION_EDITOR_INTEGER_MIN;d=i||c.replace(/{{minValue}}/gi,u=>a[u])}else if(o!==void 0&&t!==null&&(l==="exclusive"&&t>=+o||l==="inclusive"&&t!==null&&t>+o)){h=!1;const c=l==="inclusive"?R.VALIDATION_EDITOR_INTEGER_MAX_INCLUSIVE:R.VALIDATION_EDITOR_INTEGER_MAX;d=i||c.replace(/{{maxValue}}/gi,u=>a[u])}return{valid:h,msg:d}}function Cp(r,e){const t=e.required,i=e.minValue,s=e.maxValue,n=e.errorMessage,o={"{{minValue}}":i,"{{maxValue}}":s};return e.validator?e.validator(r,e.editorArgs):t&&r===""?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:i!==void 0&&s!==void 0&&r!==null&&(r<i||r>s)?{valid:!1,msg:n||R.VALIDATION_EDITOR_NUMBER_BETWEEN.replace(/{{minValue}}|{{maxValue}}/gi,l=>o[l])}:{valid:!0,msg:null}}class vp{constructor(e){if(this.args=e,this._isValueSaveCalled=!1,this._isLeftValueTouched=!1,this._isRightValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},this._eventHandler=new pe,this._bindEventService=new Ae,this.init(),this._eventHandler.subscribe(this.grid.onValidationError,()=>this._isValueSaveCalled=!0)}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return{leftInput:this._leftInput,rightInput:this._rightInput}}get editorParams(){return this.columnEditor.params||{}}get eventHandler(){return this._eventHandler}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get isValueSaveCalled(){return this._isValueSaveCalled}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var i,s,n,o;if(!this.editorParams||!this.editorParams.leftInput||!this.editorParams.leftInput.field||!this.editorParams.rightInput||!this.editorParams.rightInput.field)throw new Error(`[Slickgrid-Universal] Please make sure that your Combo Input Editor has params defined with "leftInput" and "rightInput" (example: { editor: { model: Editors.comboInput, params: { leftInput: { field: 'firstName' }, { rightSide: { field: 'lastName' } }}}`);this._leftFieldName=(i=this.editorParams.leftInput)==null?void 0:i.field,this._rightFieldName=(s=this.editorParams.rightInput)==null?void 0:s.field,this._leftInput=this.createInput("leftInput"),this._rightInput=this.createInput("rightInput");const e=(n=this.args)==null?void 0:n.container;e&&typeof e.appendChild=="function"&&(e.appendChild(this._leftInput),e.appendChild(this._rightInput)),this._bindEventService.bind(this._leftInput,"keydown",l=>this.handleKeyDown(l,"leftInput")),this._bindEventService.bind(this._rightInput,"keydown",l=>this.handleKeyDown(l,"rightInput")),this.hasAutoCommitEdit&&(this._bindEventService.bind(this._leftInput,"focusout",l=>this.handleFocusOut(l,"leftInput")),this._bindEventService.bind(this._rightInput,"focusout",l=>this.handleFocusOut(l,"rightInput"))),((o=this.args)==null?void 0:o.compositeEditorOptions)?(this._bindEventService.bind(this._leftInput,"input",this.handleChangeOnCompositeEditorDebounce.bind(this)),this._bindEventService.bind(this._rightInput,"input",this.handleChangeOnCompositeEditorDebounce.bind(this))):setTimeout(()=>this._leftInput.select(),50)}handleFocusOut(e,t){var o;const i=((o=e.relatedTarget)==null?void 0:o.className)||"";!this.args.compositeEditorOptions&&i.indexOf("dual-editor")===-1&&this._lastEventType!=="focusout-right"&&(t==="rightInput"||t==="leftInput"&&this._lastEventType!=="focusout-left")&&(t==="leftInput"?this._isLeftValueTouched=!0:this._isRightValueTouched=!0,this.save());const n=t==="leftInput"?"left":"right";this._lastEventType=`${e==null?void 0:e.type}-${n}`}handleKeyDown(e,t){t==="leftInput"?this._isLeftValueTouched=!0:this._isRightValueTouched=!0,this._lastInputKeyEvent=e,(e.key==="ArrowLeft"||e.key==="ArrowRight"||e.key==="Tab")&&e.stopImmediatePropagation()}destroy(){var e,t,i,s;this._eventHandler.unsubscribeAll(),this._bindEventService.unbindAll(),(t=(e=this._leftInput)==null?void 0:e.remove)==null||t.call(e),(s=(i=this._rightInput)==null?void 0:i.remove)==null||s.call(i)}createInput(e){var a,h,d,c;const t=this.editorParams[e],i=((a=this.columnDef)==null?void 0:a.id)??"",s=this.gridOptions.datasetIdPropertyName||"id",n=((d=(h=this.args)==null?void 0:h.item)==null?void 0:d[s])??"";let o=t.type||"text";(o==="float"||o==="integer")&&(o="number");const l=v("input",{type:o||"text",id:`item-${n}-${e}`,ariaLabel:((c=this.columnEditor)==null?void 0:c.ariaLabel)??`${_t(i+"")} Input Editor`,className:`dual-editor-text editor-${i} ${e.replace(/input/gi,"")}`,autocomplete:"off",ariaAutoComplete:"none",placeholder:t.placeholder||"",title:t.title||""});return o==="readonly"&&(l.readOnly=!0,o="text"),o==="number"&&(l.step=this.getInputDecimalSteps(e)),l}disable(e=!0){var i;const t=this.disabled;this.disabled=e,this._leftInput&&this._rightInput&&(e?(this._leftInput.setAttribute("disabled","disabled"),this._rightInput.setAttribute("disabled","disabled"),t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&this.reset("",!0,!0)):(this._leftInput.removeAttribute("disabled"),this._rightInput.removeAttribute("disabled")))}focus(){this.grid.focus()}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValues(){const e={},t=this._leftInput.value,i=this._rightInput.value,s=this.editorParams.leftInput&&(this.editorParams.leftInput.type==="float"||this.editorParams.leftInput.type==="integer"),n=this.editorParams.rightInput&&(this.editorParams.rightInput.type==="float"||this.editorParams.rightInput.type==="integer"),o=t!==""&&s?+this._leftInput.value:t||"",l=i!==""&&n?+this._rightInput.value:i||"";return $e(e,this._leftFieldName,o),$e(e,this._rightFieldName,l),e}setValues(e){Array.isArray(e)&&e.length===2&&(this._leftInput.value=`${e[0]}`,this._rightInput.value=`${e[1]}`)}applyValue(e,t){this.applyValueByPosition(e,t,"leftInput"),this.applyValueByPosition(e,t,"rightInput")}applyValueByPosition(e,t,i){var n;const s=i==="leftInput"?this._leftFieldName:this._rightFieldName;if(s!==void 0){const o=(s==null?void 0:s.indexOf("."))>0;let l=s;if(o){const d=s.split(/\.(.*)/);l=d.length>1?d[1]:d}const a=o?Ee(t,l):t[s],h=this.validate(null,{position:i,inputValue:a});if(o){const d=Ee(t,l),c=h&&h.valid?d:"",u=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??s??"";$e(e,u,c)}else s&&(e[s]=h&&h.valid?t[s]:"")}}isValueChanged(){var a,h,d;const e=this._leftInput.value,t=this._rightInput.value,i=(a=this.editorParams)==null?void 0:a.leftInput,s=(h=this.editorParams)==null?void 0:h.rightInput,n=(d=this._lastInputKeyEvent)==null?void 0:d.key;if((i&&i.alwaysSaveOnEnterKey||s&&s.alwaysSaveOnEnterKey)&&n==="Enter")return!0;const o=!(e===""&&(this._originalLeftValue===null||this._originalLeftValue===void 0))&&e!==this._originalLeftValue,l=!(t===""&&(this._originalRightValue===null||this._originalRightValue===void 0))&&t!==this._originalRightValue;return o||l}isValueTouched(){return this._isLeftValueTouched||this._isRightValueTouched}loadValue(e){this.loadValueByPosition(e,"leftInput"),this.loadValueByPosition(e,"rightInput"),this._leftInput.select()}loadValueByPosition(e,t){const i=t==="leftInput"?this._leftFieldName:this._rightFieldName,s=t==="leftInput"?"_originalLeftValue":"_originalRightValue",n=t==="leftInput"?"_leftInput":"_rightInput";if(e&&i!==void 0){const l=(i==null?void 0:i.indexOf("."))>0?Ee(e,i):e.hasOwnProperty(i)?e[i]:"";if(this[s]=l,this.editorParams[t].type==="float"){const a=this.getDecimalPlaces(t);a!==null&&(this[s]||this[s]===0)&&this[s]!==void 0&&(this[s]=(+this[s]).toFixed(a))}this[n]&&(this[n].value=`${this[s]}`)}}reset(e,t=!0,i=!1){const s=e??this._originalLeftValue??"",n=e??this._originalRightValue??"";this._leftInput&&this._rightInput&&(this._originalLeftValue=s,this._originalRightValue=n,this._leftInput.value=`${s}`,this._rightInput.value=`${n}`),this._isLeftValueTouched=!1,this._isRightValueTouched=!1;const o=this.args.compositeEditorOptions;if(o&&t){const l=!i;this.handleChangeOnCompositeEditor(null,o,"user",l)}}save(){const e=this.validate(),t=e&&e.valid||!1;this._isValueSaveCalled||(this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges(),this._isValueSaveCalled=!0)}serializeValue(){const e={},t=this.serializeValueByPosition("leftInput"),i=this.serializeValueByPosition("rightInput");return $e(e,this._leftFieldName,t),$e(e,this._rightFieldName,i),e}serializeValueByPosition(e){const t=e==="leftInput"?this._leftInput.value:this._rightInput.value;if(t===""||isNaN(+t))return t;let i=parseFloat(t);const s=this.getDecimalPlaces(e);return s!==null&&(i||i===0)&&i.toFixed&&(i=parseFloat(i.toFixed(s))),i}getDecimalPlaces(e){const i=e==="leftInput"?"leftInput":"rightInput",s=this.editorParams[i],n=s==null?void 0:s.decimal;return n===void 0?0:n}getInputDecimalSteps(e){const t=this.getDecimalPlaces(e);let i="";for(let s=1;s<t;s++)i+="0";return t>0?`0.${i}1`:"1"}validate(e,t){if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};if(t){const i=this.validateByPosition(t.position,t.inputValue);if(!i.valid)return t.position==="leftInput"?this._leftInput.select():this._rightInput.select(),i}else{const i=this.validateByPosition("leftInput"),s=this.validateByPosition("rightInput");if(!i.valid)return this._leftInput.select(),i;if(!s.valid)return this._rightInput.select(),s}return{valid:!0,msg:""}}validateByPosition(e,t){var l;const i=this.editorParams[e];let s="";if(t)s=t;else{const a=e==="leftInput"?this._leftInput:this._rightInput;s=a&&a.value}const n=this.validator;s=typeof n=="function"?this.getValues():s;const o={editorArgs:this.args,errorMessage:i.errorMessage,required:(l=this.args)!=null&&l.compositeEditorOptions?!1:i.required,validator:typeof n=="function"?n:i.validator};switch(i.type){case"float":return Ra(s,{...o,decimal:this.getDecimalPlaces(e),minValue:i.minValue,maxValue:i.maxValue,operatorConditionalType:i.operatorConditionalType});case"integer":return Aa(s,{...o,minValue:i.minValue,maxValue:i.maxValue,operatorConditionalType:i.operatorConditionalType});case"text":case"password":default:return Ks(s,o)}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var p,m,f,g,_,b;const n=this.grid.getActiveCell(),o=this.args.column,l=((m=(p=this.columnEditor.params)==null?void 0:p.leftInput)==null?void 0:m.field)??"",a=((g=(f=this.columnEditor.params)==null?void 0:f.rightInput)==null?void 0:g.field)??"",h=this.dataContext,d=this.grid,c=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,c),this.applyValue(t.formValues,c);const u=((b=(_=this.gridOptions)==null?void 0:_.compositeEditorOptions)==null?void 0:b.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&u&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],(s||this.disabled&&u&&t.formValues.hasOwnProperty(a))&&delete t.formValues[a],d.onCompositeEditorChange.notify({...n,item:h,grid:d,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleChangeOnCompositeEditorDebounce(e){var i,s;const t=(i=this.args)==null?void 0:i.compositeEditorOptions;if(t){const n=((s=this.gridOptions)==null?void 0:s.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),n)}}}const bp=0;class Qs{constructor(e,t="text"){if(this.args=e,this._inputType="text",this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=e.grid&&e.grid.getOptions(),this._bindEventService=new Ae,this.inputType=t,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)||{}}get dataContext(){return this.args.item}get editorDomElement(){return this._input}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get inputType(){return this._inputType}set inputType(e){this._inputType=e}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var s,n,o,l;const e=((s=this.columnDef)==null?void 0:s.id)??"",t=this.args.compositeEditorOptions;this._input=v("input",{type:this._inputType||"text",autocomplete:"off",ariaAutoComplete:"none",ariaLabel:((n=this.columnEditor)==null?void 0:n.ariaLabel)??`${_t(e+"")} Input Editor`,className:`editor-text editor-${e}`,placeholder:((o=this.columnEditor)==null?void 0:o.placeholder)??"",title:((l=this.columnEditor)==null?void 0:l.title)??""}),this.inputType==="number"&&(this._input.step=`${this.columnEditor.valueStep!==void 0?this.columnEditor.valueStep:this.getInputDecimalSteps()}`);const i=this.args.container;i&&typeof i.appendChild=="function"&&i.appendChild(this._input),this._bindEventService.bind(this._input,"focus",()=>{var a;return(a=this._input)==null?void 0:a.select()}),this._bindEventService.bind(this._input,"keydown",a=>{this._isValueTouched=!0,this._lastInputKeyEvent=a,(a.key==="ArrowLeft"||a.key==="ArrowRight")&&a.stopImmediatePropagation()}),this.hasAutoCommitEdit&&!t&&this._bindEventService.bind(this._input,["focusout","blur"],()=>{this._isValueTouched=!0,this.save()}),t&&(this._bindEventService.bind(this._input,["input","paste"],this.handleOnInputChange.bind(this)),this.inputType==="number"&&this._bindEventService.bind(this._input,"wheel",this.handleOnMouseWheel.bind(this),{passive:!0}))}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._input)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._input)if(e){this._input.setAttribute("disabled","disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._input.removeAttribute("disabled")}focus(){var e;this.grid.focus(),(e=this._input)==null||e.focus()}getDecimalPlaces(){var t,i,s;let e=((t=this.columnEditor)==null?void 0:t.decimal)??((s=(i=this.columnEditor)==null?void 0:i.params)==null?void 0:s.decimalPlaces)??void 0;return e===void 0&&(e=bp),!e&&e!==0?null:e}getInputDecimalSteps(){const e=this.getDecimalPlaces();let t="";for(let i=1;i<e;i++)t+="0";return e>0?`0.${t}1`:"1"}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){var e;return((e=this._input)==null?void 0:e.value)||""}setValue(e,t=!1,i=!0){if(this._input&&(this._input.value=`${e}`,t)){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var s;const i=this.columnDef&&this.columnDef.field;if(i!==void 0){const n=(i==null?void 0:i.indexOf("."))>0,o=this.validate(null,t),l=o!=null&&o.valid?t:"";if(n){const a=((s=this.columnEditor)==null?void 0:s.complexObjectPath)??i??"";$e(e,a,l)}else i&&(e[i]=l)}}isValueChanged(){var i,s,n;const e=(i=this._input)==null?void 0:i.value,t=(s=this._lastInputKeyEvent)==null?void 0:s.key;return(n=this.columnEditor)!=null&&n.alwaysSaveOnEnterKey&&t==="Enter"?!0:!(e===""&&(this._originalValue===null||this._originalValue===void 0))&&e!==this._originalValue}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0&&this._input){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e.hasOwnProperty(t)&&e[t]||"";this._originalValue=n,this._input.value=this._originalValue,this._input.select()}}reset(e,t=!0,i=!1){const s=e??this._originalValue??"";this._input&&(this._originalValue=s,this._input.value=`${s}`),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=e&&e.valid||!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var e;return((e=this._input)==null?void 0:e.value)??""}validate(e,t){var s;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:this._input&&this._input.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(s=this.args)!=null&&s.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}handleOnInputChange(e){var i;this._isValueTouched=!0;const t=this.args.compositeEditorOptions;if(t){const s=((i=this.gridOptions)==null?void 0:i.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),s)}}handleOnMouseWheel(e){this._isValueTouched=!0;const t=this.args.compositeEditorOptions;t&&this.handleChangeOnCompositeEditor(e,t)}}class Sp extends Qs{constructor(e){super(e,"number"),this.args=e}loadValue(e){const t=this.columnDef&&this.columnDef.field;if(t!==void 0&&e&&t!==void 0&&this._input){const s=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=s;const n=this.getDecimalPlaces();n!==null&&(this._originalValue||this._originalValue===0)&&this._originalValue!==void 0&&(this._originalValue=(+this._originalValue).toFixed(n)),this._input.value=`${this._originalValue}`,this._input.select()}}serializeValue(){var s;const e=(s=this._input)==null?void 0:s.value;if(e===void 0||e===""||isNaN(+e))return e;let t=parseFloat(e);const i=this.getDecimalPlaces();return i!==null&&(t||t===0)&&t.toFixed&&(t=parseFloat(t.toFixed(i))),t}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._input)==null?void 0:s.value;return Ra(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,decimal:this.getDecimalPlaces(),minValue:this.columnEditor.minValue,maxValue:this.columnEditor.maxValue,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}}class yp extends Qs{constructor(e){super(e,"password"),this.args=e}}class Ep extends Qs{constructor(e){super(e,"number"),this.args=e}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(t!==void 0&&e&&t!==void 0&&this._input){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._originalValue=isNaN(n)||n===null||n===void 0?n:`${n}`,this._input.value=`${this._originalValue}`,this._input.select()}}serializeValue(){var i;const e=(i=this._input)==null?void 0:i.value;if(e===void 0||e===""||isNaN(+e))return e;const t=isNaN(+e)?e:parseInt(e,10);return isNaN(+t)?e:t}validate(e,t){var s;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:this.getValue();return Aa(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minValue:this.columnEditor.minValue,maxValue:this.columnEditor.maxValue,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(s=this.args)!=null&&s.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}handleOnMouseWheel(e){this._isValueTouched=!0;const t=this.args.compositeEditorOptions;t&&this.handleChangeOnCompositeEditor(e,t)}}class wp{constructor(e){var i,s;if(this.args=e,this._isValueTouched=!1,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=(i=e.grid)==null?void 0:i.getOptions();const t=this.gridOptions||this.args.column.params||{};t!=null&&t.translater&&(this._translater=t.translater),this._locales=((s=this.gridOptions)==null?void 0:s.locales)||R.locales,this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)??{}}get dataContext(){return this.args.item}get editorDomElement(){return this._textareaElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.longText,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get hasAutoCommitEdit(){var e;return((e=this.gridOptions)==null?void 0:e.autoCommitEdit)??!1}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var d,c,u,p,m,f,g,_,b,C,E,y,T,x,O;let e="",t="";if(this._translater&&this._translater.translate&&this.gridOptions.enableTranslate){const I=ot(this.gridOptions),A=((d=this.editorOptions.buttonTexts)==null?void 0:d.cancelKey)??`${I}CANCEL`,k=((c=this.editorOptions.buttonTexts)==null?void 0:c.saveKey)??`${I}SAVE`;e=this._translater.translate(`${I}${A}`),t=this._translater.translate(`${I}${k}`)}else e=((u=this.editorOptions.buttonTexts)==null?void 0:u.cancel)??((p=this._locales)==null?void 0:p.TEXT_CANCEL)??"Cancel",t=((m=this.editorOptions.buttonTexts)==null?void 0:m.save)??((f=this._locales)==null?void 0:f.TEXT_SAVE)??"Save";const i=this.args.compositeEditorOptions,s=((g=this.columnDef)==null?void 0:g.id)??"",n=(_=this.columnEditor)==null?void 0:_.maxLength,o=((b=this.editorOptions)==null?void 0:b.rows)??4,l=i?this.args.container:document.body;this._wrapperElm=v("div",{className:`slick-large-editor-text editor-${s}`,style:{position:i?"relative":"absolute"}}),(C=this.gridOptions)!=null&&C.darkMode&&this._wrapperElm.classList.add("slick-dark-mode"),l.appendChild(this._wrapperElm),this._textareaElm=v("textarea",{ariaLabel:((E=this.columnEditor)==null?void 0:E.ariaLabel)??`${_t(s+"")} Text Editor`,cols:((y=this.editorOptions)==null?void 0:y.cols)??40,rows:i&&o>3?3:o,placeholder:((T=this.columnEditor)==null?void 0:T.placeholder)??"",title:((x=this.columnEditor)==null?void 0:x.title)??""},this._wrapperElm);const a=v("div",{className:"editor-footer"}),h=v("span",{className:"counter"});if(this._currentLengthElm=v("span",{className:"text-length",textContent:"0"}),h.appendChild(this._currentLengthElm),n!==void 0&&(h.appendChild(v("span",{className:"separator",textContent:"/"})),h.appendChild(v("span",{className:"max-length",textContent:`${n}`}))),a.appendChild(h),!i){const I=v("button",{className:"btn btn-cancel btn-default btn-xs",textContent:e},a),A=v("button",{className:"btn btn-save btn-primary btn-xs",textContent:t},a);this._bindEventService.bind(I,"click",this.cancel.bind(this)),this._bindEventService.bind(A,"click",this.save.bind(this)),this.position((O=this.args)==null?void 0:O.position),this._textareaElm.focus(),this._textareaElm.select()}this._wrapperElm.appendChild(a),this._bindEventService.bind(this._textareaElm,"keydown",this.handleKeyDown.bind(this)),this._bindEventService.bind(this._textareaElm,"input",this.handleOnInputChange.bind(this)),this._bindEventService.bind(this._textareaElm,"paste",this.handleOnInputChange.bind(this))}cancel(){var t;const e=this._defaultTextValue||"";this._textareaElm.value=e,this._currentLengthElm.textContent=`${e.length}`,(t=this.args)!=null&&t.cancelChanges&&this.args.cancelChanges()}hide(){this._wrapperElm.style.display="none"}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)?this.applyInputUsabilityState():this._wrapperElm.style.display="block"}destroy(){var e,t;this._bindEventService.unbindAll(),(t=(e=this._wrapperElm)==null?void 0:e.remove)==null||t.call(e)}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._textareaElm&&this._wrapperElm)if(e){this._textareaElm.disabled=!0,this._wrapperElm.classList.add("disabled");const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset("",!0,!0)}else this._textareaElm.disabled=!1,this._wrapperElm.classList.remove("disabled")}focus(){this.grid.focus(),this._textareaElm&&(this._textareaElm.focus(),this._textareaElm.select())}getValue(){return this._textareaElm.value}setValue(e,t=!1,i=!0){if(this._textareaElm.value=e,this._currentLengthElm.textContent=`${e.length}`,t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var s,n;const i=(s=this.columnDef)==null?void 0:s.field;if(i!==void 0){const o=(i==null?void 0:i.indexOf("."))>0,l=this.validate(void 0,t),a=l!=null&&l.valid?t:"";if(o){const h=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??i??"";$e(e,h,a)}else e[i]=a}}isValueChanged(){const e=this._textareaElm.value;return!(e===""&&(this._defaultTextValue===null||this._defaultTextValue===void 0))&&e!==this._defaultTextValue}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=(i=this.columnDef)==null?void 0:i.field;if(e&&t!==void 0){const n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e[t];this._defaultTextValue=n||"",this._textareaElm.value=this._defaultTextValue,this._currentLengthElm.textContent=this._defaultTextValue.length,this._textareaElm.defaultValue=this._defaultTextValue,this._textareaElm.select()}}position(e){var u,p;const t=me(this.args.container),i=this.args.container.offsetHeight,s=this.args.container.offsetWidth,n=this._wrapperElm.getBoundingClientRect().height||this.args.position.height,o=this._wrapperElm.getBoundingClientRect().width||this.args.position.width,l=document.body.offsetHeight||window.innerHeight,a=document.body.offsetWidth||window.innerWidth;let h=(t==null?void 0:t.top)??e.top??0,d=(t==null?void 0:t.left)??e.left??0;const c=((u=this.editorOptions)==null?void 0:u.position)??"auto";if(c==="left"||c==="auto"&&d+o>a){const m=((p=this.editorOptions)==null?void 0:p.marginRight)??0;d-=o-s+m}(c==="top"||c==="auto"&&h+n>l)&&(h-=n-i),this._wrapperElm.style.top=`${h}px`,this._wrapperElm.style.left=`${d}px`}reset(e,t=!0,i=!1){const s=e??this._defaultTextValue??"";this._textareaElm&&(this._defaultTextValue=s,this._textareaElm.value=s,this._currentLengthElm.textContent=s.length),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=(e==null?void 0:e.valid)??!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){return this._textareaElm.value}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._textareaElm)==null?void 0:s.value;return Ks(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minLength:this.columnEditor.minLength,maxLength:this.columnEditor.maxLength,operatorConditionalType:this.columnEditor.operatorConditionalType,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleKeyDown(e){const t=e.key;this._isValueTouched=!0,this.args.compositeEditorOptions||(t==="Enter"&&e.ctrlKey||e.ctrlKey&&e.key.toUpperCase()==="S"?(e.preventDefault(),this.save()):t==="Escape"?(e.preventDefault(),this.cancel()):t==="Tab"&&e.shiftKey?(e.preventDefault(),this.args&&this.grid&&this.grid.navigatePrev()):t==="Tab"&&(e.preventDefault(),this.args&&this.grid&&this.grid.navigateNext()))}handleOnInputChange(e){var n,o;const t=this.args.compositeEditorOptions,i=(n=this.columnEditor)==null?void 0:n.maxLength;let s=!1;if(i&&(s=this.truncateText(this._textareaElm,i)),s)this._currentLengthElm.textContent=`${i}`;else{const l=e.type==="paste"?e.clipboardData.getData("text"):e.target.value;this._currentLengthElm.textContent=`${l.length}`}if(t){const l=((o=this.gridOptions)==null?void 0:o.editorTypingDebounce)??500;clearTimeout(this._timer),this._timer=setTimeout(()=>this.handleChangeOnCompositeEditor(e,t),l)}}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}truncateText(e,t){const i=e.value+"";return i.length>t?(e.value=i.substring(0,t),!0):!1}}class Pa{constructor(e,t,i=-1){var l,a,h,d,c,u,p,m,f;if(this.args=e,this.isMultipleSelect=t,this.delayOpening=i,this._isValueTouched=!1,this._isDisposingOrCallingSave=!1,this.disabled=!1,this.enableTranslateLabel=!1,this.finalCollection=[],!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},(l=this.gridOptions)!=null&&l.translater&&(this._translaterService=this.gridOptions.translater),this._locales=this.gridOptions.locales||R.locales;const s=((a=this.columnDef)==null?void 0:a.id)??"";this.elementName=`editor-${s}`;const n=this.args.compositeEditorOptions,o={autoAdjustDropHeight:!0,autoAdjustDropPosition:!0,autoAdjustDropWidthByTextSize:!0,container:"body",darkMode:!!this.gridOptions.darkMode,filter:!1,maxHeight:275,minHeight:25,name:this.elementName,single:!0,singleRadio:!0,renderOptionLabelAsHtml:((h=this.columnEditor)==null?void 0:h.enableRenderHtml)??!1,sanitizer:g=>this.grid.sanitizeHtmlString(g),onClick:()=>this._isValueTouched=!0,onCheckAll:()=>this._isValueTouched=!0,onUncheckAll:()=>this._isValueTouched=!0,onClose:g=>{if(g==="key.escape"||g==="body.click"||!this.hasAutoCommitEdit&&!this.isValueChanged()){g==="key.escape"&&this.cancel();return}n?this.handleChangeOnCompositeEditor(n):(this._isDisposingOrCallingSave=!0,this.save(this.hasAutoCommitEdit))}};if(t)if(o.single=!1,o.singleRadio=!1,o.displayTitle=!0,o.showOkButton=!0,(d=this._translaterService)!=null&&d.getCurrentLanguage()){const g=ot(this.gridOptions);o.countSelectedText=this._translaterService.translate(`${g}X_OF_Y_SELECTED`),o.allSelectedText=this._translaterService.translate(`${g}ALL_SELECTED`),o.selectAllText=this._translaterService.translate(`${g}SELECT_ALL`),o.okButtonText=this._translaterService.translate(`${g}OK`),o.noMatchesFoundText=this._translaterService.translate(`${g}NO_MATCHES_FOUND`)}else o.countSelectedText=(c=this._locales)==null?void 0:c.TEXT_X_OF_Y_SELECTED,o.allSelectedText=(u=this._locales)==null?void 0:u.TEXT_ALL_SELECTED,o.selectAllText=(p=this._locales)==null?void 0:p.TEXT_SELECT_ALL,o.okButtonText=(m=this._locales)==null?void 0:m.TEXT_OK,o.noMatchesFoundText=(f=this._locales)==null?void 0:f.TEXT_NO_MATCHES_FOUND;this.defaultOptions=o,this.init()}get collection(){var e;return((e=this.columnEditor)==null?void 0:e.collection)??[]}get collectionOptions(){var e;return(e=this.columnEditor)==null?void 0:e.collectionOptions}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)??{}}get dataContext(){return this.args.item}get editorDomElement(){return this.editorElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.select,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get isCompositeEditor(){var e;return!!((e=this.args)!=null&&e.compositeEditorOptions)}get customStructure(){var e,t;return(t=(e=this.columnDef)==null?void 0:e.editor)==null?void 0:t.customStructure}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get msInstance(){return this._msInstance}get selectOptions(){return this.defaultOptions}get currentValues(){var s,n,o;const e=((s=this._msInstance)==null?void 0:s.getSelects())??[];if(this.collection.every(l=>typeof l=="number"||typeof l=="string"))return this.collection.filter(l=>e==null?void 0:e.some(a=>`${a}`===(l==null?void 0:l.toString())));const t=((n=this.collectionOptions)==null?void 0:n.separatorBetweenTextLabels)??"",i=((o=this.collectionOptions)==null?void 0:o.includePrefixSuffixToSelectedValues)??!1;return this.collection.filter(l=>e.some(a=>{var h;return`${a}`===((h=l==null?void 0:l[this.valueName])==null?void 0:h.toString())})).map(l=>{var m,f;const a=l[this.valueName];let h=l[this.labelPrefixName]||"",d=l[this.labelSuffixName]||"";const c=((m=this.columnDef)==null?void 0:m.field)??"",u=(c==null?void 0:c.indexOf("."))>0,p=((f=this.columnEditor)==null?void 0:f.serializeComplexValueFormat)??"object";return u&&typeof l=="object"&&p==="object"?l:(h=this.enableTranslateLabel&&this._translaterService&&h&&typeof h=="string"?this._translaterService.translate(h||" "):h,d=this.enableTranslateLabel&&this._translaterService&&d&&typeof d=="string"?this._translaterService.translate(d||" "):d,i?[h,a,d].filter(_=>_).join(t):a)})}get currentValue(){var s,n,o,l,a;const e=((s=this._msInstance)==null?void 0:s.getSelects())??[],t=e.length?e[0]:"",i=(n=this.columnDef)==null?void 0:n.field;if(i!==void 0){if(this.collection.every(m=>typeof m=="number"||typeof m=="string"))return xt(this.collection,m=>{var f;return((f=m==null?void 0:m.toString)==null?void 0:f.call(m))===`${t}`});const h=((o=this.collectionOptions)==null?void 0:o.separatorBetweenTextLabels)??"",d=((l=this.collectionOptions)==null?void 0:l.includePrefixSuffixToSelectedValues)??!1,c=xt(this.collection,m=>{var f;return m.hasOwnProperty(this.valueName)&&((f=m[this.valueName])==null?void 0:f.toString())===`${t}`}),u=(i==null?void 0:i.indexOf("."))>0,p=((a=this.columnEditor)==null?void 0:a.serializeComplexValueFormat)??"object";if(u&&typeof c=="object"&&p==="object")return c;if(c&&c.hasOwnProperty(this.valueName)){const m=c[this.valueName];if(d){let f=c[this.labelPrefixName]||"",g=c[this.labelSuffixName]||"";return f=this.enableTranslateLabel&&this._translaterService&&f&&typeof f=="string"?this._translaterService.translate(f||" "):f,g=this.enableTranslateLabel&&this._translaterService&&g&&typeof g=="string"?this._translaterService.translate(g||" "):g,[f,m,g].filter(b=>b).join(h)}return m}}return""}get validator(){var e,t;return((e=this.columnEditor)==null?void 0:e.validator)??((t=this.columnDef)==null?void 0:t.validator)}init(){var e,t,i,s,n,o,l;if(!this.columnDef||!this.columnDef.editor||!this.columnDef.editor.collection&&!this.columnDef.editor.collectionAsync)throw new Error(`[Slickgrid-Universal] You need to pass a "collection" (or "collectionAsync") inside Column Definition Editor for the MultipleSelect/SingleSelect Editor to work correctly.
|
|
18
18
|
Also each option should include a value/label pair (or value/labelKey when using Locale).
|
|
19
19
|
For example: { editor: { collection: [{ value: true, label: 'True' },{ value: false, label: 'False'}] } }`);if(this._collectionService=new Cl(this._translaterService),this.enableTranslateLabel=((e=this.columnEditor)==null?void 0:e.enableTranslateLabel)??!1,this.labelName=((t=this.customStructure)==null?void 0:t.label)??"label",this.labelPrefixName=((i=this.customStructure)==null?void 0:i.labelPrefix)??"labelPrefix",this.labelSuffixName=((s=this.customStructure)==null?void 0:s.labelSuffix)??"labelSuffix",this.optionLabel=((n=this.customStructure)==null?void 0:n.optionLabel)??"value",this.valueName=((o=this.customStructure)==null?void 0:o.value)??"value",this.enableTranslateLabel&&(!this._translaterService||typeof this._translaterService.translate!="function"))throw new Error('[Slickgrid-Universal] requires a Translate Service to be installed and configured when the grid option "enableTranslate" is enabled.');this.renderDomElement(this.collection),(this.disabled||(l=this.columnEditor)!=null&&l.collectionAsync&&Array.isArray(this.collection)&&this.collection.length===0)&&this.disable(!0)}getValue(){return this.isMultipleSelect?this.currentValues:this.currentValue}setValue(e,t=!1,i=!0){if(this.isMultipleSelect&&Array.isArray(e)?this.loadMultipleValues(e):this.loadSingleValue(e),t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(s,"system")}}cancel(){var e;(e=this.args)!=null&&e.cancelChanges&&this.args.cancelChanges()}hide(){this._msInstance&&this._msInstance.close()}show(e){!this.isCompositeEditor&&this._msInstance?this._msInstance.open(e):this.isCompositeEditor&&this.applyInputUsabilityState()}applyValue(e,t){var o,l,a;const i=(o=this.columnDef)==null?void 0:o.field,s=(l=this.columnDef)==null?void 0:l.type;let n=t;if(i!==void 0){(s===S.number||s===S.integer||s===S.boolean)&&!isNaN(parseFloat(t))&&(n=parseFloat(t)),this.isMultipleSelect&&typeof t=="string"&&t.indexOf(",")>=0&&(n=t.split(","));const h=(i==null?void 0:i.indexOf("."))>0,d=this.validate(null,n);if(n=d!=null&&d.valid?n:"",h){const c=((a=this.columnEditor)==null?void 0:a.complexObjectPath)??i??"";$e(e,c,n)}else e[i]=n}}destroy(){var e,t;this._msInstance&&this.hasAutoCommitEdit&&this.isValueChanged()&&!this._isDisposingOrCallingSave&&!this.isCompositeEditor&&(this._isDisposingOrCallingSave=!0,this.save(!0)),this._isDisposingOrCallingSave=!0,typeof((e=this._msInstance)==null?void 0:e.destroy)=="function"&&this._msInstance.destroy(),(t=this.editorElm)==null||t.remove(),this._msInstance=void 0}loadValue(e){var s,n;const t=(s=this.columnDef)==null?void 0:s.field,i=t!==void 0&&(t==null?void 0:t.indexOf("."))>0;if(e&&t!==void 0){const o=((n=this.columnEditor)==null?void 0:n.complexObjectPath)??t,l=i?Ee(e,o):e.hasOwnProperty(t)&&e[t],a=i&&(l!=null&&l.hasOwnProperty(this.valueName))?l[this.valueName]:l;this.isMultipleSelect&&Array.isArray(a)?this.loadMultipleValues(a):this.loadSingleValue(a)}}loadMultipleValues(e){var t;if(Array.isArray(e)){this.originalValue=e.map(s=>typeof s=="number"||typeof s=="boolean"?`${s}`:s),(t=this._msInstance)==null||t.setSelects(this.originalValue);const i=this.args.compositeEditorOptions;i&&this.handleChangeOnCompositeEditor(i)}}loadSingleValue(e){var t;this.originalValue=typeof e=="number"||typeof e=="boolean"?`${e}`:e,(t=this._msInstance)==null||t.setSelects([this.originalValue])}serializeValue(){return this.isMultipleSelect?this.currentValues:this.currentValue}changeEditorOption(e,t){var i;this.columnEditor&&(this.columnEditor.editorOptions||(this.columnEditor.editorOptions={}),this.columnEditor.editorOptions[e]=t,this.editorElmOptions={...this.editorElmOptions,[e]:t},(i=this._msInstance)==null||i.refreshOptions(this.editorElmOptions))}disable(e=!0){const t=this.disabled;if(this.disabled=e,this._msInstance)if(e){this._msInstance.disable();const i=this.getValue(),s=Array.isArray(i)&&this.isMultipleSelect?(i==null?void 0:i[0])==="":i==="";t!==e&&this.isCompositeEditor&&!s&&this.reset("",!0,!0)}else this._msInstance.enable()}focus(){var e;this.grid.focus(),(e=this._msInstance)==null||e.focus()}isValueChanged(){var i;const e=(i=this._msInstance)==null?void 0:i.getSelects();if(this.isMultipleSelect)return!ut(e,this.originalValue);const t=Array.isArray(e)&&e.length>0?e[0]:void 0;return t!==void 0&&t!==this.originalValue}isValueTouched(){return this._isValueTouched}reset(e,t=!0,i=!1){const s=e??this.originalValue;if(this._msInstance){this.originalValue=this.isMultipleSelect?s!==void 0?[s]:[]:s;const o=this.originalValue===void 0?[]:[this.originalValue];this._msInstance.setSelects(o)}this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(n,"user",o)}}save(e=!1){const t=this.validate(),i=(t==null?void 0:t.valid)??!1;(!this._isDisposingOrCallingSave||e)&&this.hasAutoCommitEdit&&i?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}validate(e,t){var o,l;const i=this.isCompositeEditor?!1:(o=this.columnEditor)==null?void 0:o.required,s=t!==void 0?t:(l=this._msInstance)==null?void 0:l.getSelects(),n=this.columnEditor&&this.columnEditor.errorMessage;if(this.isCompositeEditor&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};if(this.validator){const a=t!==void 0?t:this.isMultipleSelect?this.currentValues:this.currentValue;return this.validator(a,this.args)}return i&&(s===""||Array.isArray(s)&&s.length===0)?{valid:!1,msg:n||R.VALIDATION_REQUIRED_FIELD}:{valid:!0,msg:null}}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}filterCollection(e){var i;let t=e;if(this.columnEditor&&this.columnEditor.collectionFilterBy){const s=this.columnEditor.collectionFilterBy,n=((i=this.columnEditor.collectionOptions)==null?void 0:i.filterResultAfterEachPass)??null;t=this._collectionService.filterCollection(t,s,n)}return t}sortCollection(e){let t=e;if(this.columnDef&&this.columnEditor&&this.columnEditor.collectionSortBy){const i=this.columnEditor.collectionSortBy;t=this._collectionService.sortCollection(this.columnDef,t,i,this.enableTranslateLabel)}return t}renderDomElement(e){var n,o,l,a,h;if(!Array.isArray(e)&&((n=this.collectionOptions)!=null&&n.collectionInsideObjectProperty)){const d=this.collectionOptions.collectionInsideObjectProperty;e=Ee(e,d)}if(!Array.isArray(e))throw new Error('The "collection" passed to the Select Editor is not a valid array.');let t=[];if(e.length>0&&(t=[...e]),(o=this.collectionOptions)!=null&&o.addBlankEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==""&&(t.unshift(this.createBlankEntry()),this.collection.unshift(this.createBlankEntry())),(l=this.collectionOptions)!=null&&l.addCustomFirstEntry&&Array.isArray(t)&&t.length>0&&t[0][this.valueName]!==this.collectionOptions.addCustomFirstEntry[this.valueName]&&(t.unshift(this.collectionOptions.addCustomFirstEntry),this.collection.unshift(this.collectionOptions.addCustomFirstEntry)),(a=this.collectionOptions)!=null&&a.addCustomLastEntry&&Array.isArray(t)&&t.length>0){const d=t.length-1;t[d][this.valueName]!==this.collectionOptions.addCustomLastEntry[this.valueName]&&t.push(this.collectionOptions.addCustomLastEntry)}let i=t;if(i=this.filterCollection(i),i=this.sortCollection(i),(h=this.columnEditor)!=null&&h.collectionOverride){const d={column:this.columnDef,dataContext:this.dataContext,grid:this.grid,originalCollections:this.collection};if(this.args.compositeEditorOptions){const{formValues:c,modalType:u}=this.args.compositeEditorOptions;d.compositeEditorOptions={formValues:c,modalType:u}}i=this.columnEditor.collectionOverride(i,d)}this.finalCollection=i;const s=vl("editor",i,this.columnDef,this.grid,this.isMultipleSelect,this._translaterService);this.createDomElement(s.selectElement,s.dataCollection)}createBlankEntry(){const e={[this.labelName]:"",[this.valueName]:""};return this.labelPrefixName&&(e[this.labelPrefixName]=""),this.labelSuffixName&&(e[this.labelSuffixName]=""),e}createDomElement(e,t){var n;const i=this.args.container;e&&i&&typeof i.appendChild=="function"&&(J(i),i.appendChild(e));const s=((n=this.columnEditor)==null?void 0:n.placeholder)??"";this.defaultOptions.placeholder=s||"",this.editorElmOptions={...this.defaultOptions,...this.editorOptions,data:t},this._msInstance=wi(e,this.editorElmOptions),this.editorElm=this._msInstance.getParentElement(),this.isCompositeEditor||this.show(this.delayOpening)}handleChangeOnCompositeEditor(e,t="user",i=!1){var c,u,p;const s=this.grid.getActiveCell(),n=this.args.column,o=((c=this.columnDef)==null?void 0:c.id)??"",l=this.dataContext,a=this.grid,h=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,h),this.applyValue(e.formValues,h);const d=((p=(u=this.gridOptions)==null?void 0:u.compositeEditorOptions)==null?void 0:p.excludeDisabledFieldFormValues)??!1;(i||this.disabled&&d&&e.formValues.hasOwnProperty(o))&&delete e.formValues[o],a.onCompositeEditorChange.notify({...s,item:l,grid:a,column:n,formValues:e.formValues,editors:e.editors,triggeredBy:t},new le)}}class Tp extends Pa{constructor(e,t=0){super(e,!0,t),this.args=e,this.delayOpening=t}}class Op extends Pa{constructor(e,t=0){super(e,!1,t),this.args=e,this.delayOpening=t}}class xp{constructor(e){if(this.args=e,this._defaultValue=0,this._isValueTouched=!1,this._sliderNumberElm=null,this.disabled=!1,!e)throw new Error("[Slickgrid-Universal] Something is wrong with this grid, an Editor must always have valid arguments.");this.grid=e.grid,this.gridOptions=this.grid.getOptions()||{},this._bindEventService=new Ae,this.init()}get columnDef(){return this.args.column}get columnEditor(){var e;return((e=this.columnDef)==null?void 0:e.editor)??{}}get dataContext(){return this.args.item}get editorDomElement(){return this._editorElm}get editorInputDomElement(){return this._inputElm}get editorOptions(){var e,t;return{...(e=this.gridOptions.defaultEditorOptions)==null?void 0:e.slider,...(t=this.columnEditor)==null?void 0:t.editorOptions}}get hasAutoCommitEdit(){return this.gridOptions.autoCommitEdit??!1}get sliderOptions(){return this._sliderOptions}get validator(){var e;return this.columnEditor.validator??((e=this.columnDef)==null?void 0:e.validator)}init(){var e;if(this._cellContainerElm=(e=this.args)==null?void 0:e.container,this._cellContainerElm&&this.columnDef){const t=this.args.compositeEditorOptions;this._editorElm=this.buildDomElement(),t||this.focus(),this._cellContainerElm.appendChild(this._editorElm),this._bindEventService.bind(this._sliderTrackElm,["click","mouseup"],this.sliderTrackClicked.bind(this)),this._bindEventService.bind(this._inputElm,["change","mouseup","touchend"],this.handleChangeEvent.bind(this)),this._bindEventService.bind(this._inputElm,["input","change"],this.handleChangeSliderNumber.bind(this))}}cancel(){this._inputElm&&(this._inputElm.value=`${this._originalValue}`),this.args.cancelChanges()}destroy(){var e,t,i;this._bindEventService.unbindAll(),(e=this._inputElm)==null||e.remove(),(t=this._editorElm)==null||t.remove(),(i=this._sliderTrackElm)==null||i.remove()}disable(e=!0){var i;const t=this.disabled;if(this.disabled=e,this._inputElm)if(e){this._inputElm.disabled=!0;const s=this.getValue();t!==e&&((i=this.args)!=null&&i.compositeEditorOptions)&&s!==""&&this.reset(0,!0,!0)}else this._inputElm.disabled=!1}focus(){var e;this.grid.focus(),(e=this._inputElm)==null||e.focus()}show(){var t;!!((t=this.args)!=null&&t.compositeEditorOptions)&&this.applyInputUsabilityState()}getValue(){var e;return((e=this._inputElm)==null?void 0:e.value)??""}setValue(e,t=!1,i=!0){if(this._inputElm&&(this._inputElm.value=`${e}`),this._sliderNumberElm&&(this._sliderNumberElm.textContent=`${e}`),t){this.applyValue(this.args.item,this.serializeValue());const s=this.args.compositeEditorOptions;s&&i&&this.handleChangeOnCompositeEditor(null,s,"system")}}applyValue(e,t){var s;const i=((s=this.columnDef)==null?void 0:s.field)??"";if(i!==void 0){const n=(i==null?void 0:i.indexOf("."))>0,o=this.validate(void 0,t),l=o&&o.valid?t:"";if(n){const a=this.columnEditor.complexObjectPath??i??"";$e(e,a,l)}else e&&(e[i]=l)}}isValueChanged(){var t;const e=((t=this._inputElm)==null?void 0:t.value)??"";return!(e===""&&this._originalValue===void 0)&&+e!==this._originalValue}isValueTouched(){return this._isValueTouched}loadValue(e){var i;const t=((i=this.columnDef)==null?void 0:i.field)??"";if(e&&t!==void 0){let n=(t==null?void 0:t.indexOf("."))>0?Ee(e,t):e.hasOwnProperty(t)?e[t]:this._defaultValue;(n===""||n===null||n===void 0)&&(n=this._defaultValue),this._originalValue=+n,this._inputElm&&(this._inputElm.value=`${n}`,this._inputElm.title=`${n}`),this._sliderNumberElm&&(this._sliderNumberElm.textContent=`${n}`)}this.updateTrackFilledColorWhenEnabled()}reset(e,t=!0,i=!1){const s=e??this._originalValue??0;this._inputElm&&(this._inputElm.value=`${s}`),this._sliderNumberElm&&(this._sliderNumberElm.textContent=`${s}`),this._isValueTouched=!1;const n=this.args.compositeEditorOptions;if(n&&t){const o=!i;this.handleChangeOnCompositeEditor(null,n,"user",o)}}save(){const e=this.validate(),t=e&&e.valid||!1;this.hasAutoCommitEdit&&t?this.grid.getEditorLock().commitCurrentEdit():this.args.commitChanges()}serializeValue(){var t;const e=((t=this._inputElm)==null?void 0:t.value)??"";return e!==""?parseInt(e,10):this._originalValue}validate(e,t){var s,n;if(this.args.compositeEditorOptions&&this.applyInputUsabilityState(),this.disabled)return{valid:!0,msg:""};const i=t!==void 0?t:(s=this._inputElm)==null?void 0:s.value;return Cp(i,{editorArgs:this.args,errorMessage:this.columnEditor.errorMessage,minValue:this.columnEditor.minValue,maxValue:this.columnEditor.maxValue,required:(n=this.args)!=null&&n.compositeEditorOptions?!1:this.columnEditor.required,validator:this.validator})}buildDomElement(){var h;const e=((h=this.columnDef)==null?void 0:h.id)??"",t=this.columnEditor.title??"",i=+(this.columnEditor.minValue??R.SLIDER_DEFAULT_MIN_VALUE),s=+(this.columnEditor.maxValue??R.SLIDER_DEFAULT_MAX_VALUE),n=+(this.columnEditor.valueStep??R.SLIDER_DEFAULT_STEP),o=this.editorOptions.sliderStartValue??i;this._defaultValue=+o,this._sliderTrackElm=v("div",{className:"slider-track"}),this._inputElm=v("input",{type:"range",title:t,defaultValue:`${o}`,value:`${o}`,min:`${i}`,max:`${s}`,step:`${this.columnEditor.valueStep??R.SLIDER_DEFAULT_STEP}`,ariaLabel:this.columnEditor.ariaLabel??`${_t(e+"")} Slider Editor`,className:`slider-editor-input editor-${e}`});const l=v("div",{className:"slider-container slider-editor"}),a=v("div",{className:"slider-input-container slider-editor"});if(a.appendChild(this._sliderTrackElm),a.appendChild(this._inputElm),l.appendChild(a),!this.editorOptions.hideSliderNumber){l.classList.add("input-group");const d=v("div",{className:"input-group-addon input-group-append slider-value"});this._sliderNumberElm=v("span",{className:"input-group-text",textContent:`${o}`}),d.appendChild(this._sliderNumberElm),l.appendChild(d)}return this._sliderOptions={minValue:i,maxValue:s,step:n},l}applyInputUsabilityState(){const e=this.grid.getActiveCell(),t=this.grid.onBeforeEditCell.notify({...e,item:this.dataContext,column:this.args.column,grid:this.grid,target:"composite",compositeEditorOptions:this.args.compositeEditorOptions}).getReturnValue();this.disable(t===!1)}handleChangeEvent(e){this._isValueTouched=!0;const t=this.args.compositeEditorOptions;t?this.handleChangeOnCompositeEditor(e,t):this.save()}handleChangeSliderNumber(e){var i,s;const t=((i=e.target)==null?void 0:i.value)??"";t!==""&&(!this.editorOptions.hideSliderNumber&&this._sliderNumberElm&&(this._sliderNumberElm.textContent=t),this._inputElm.title=t,(s=this.args)!=null&&s.compositeEditorOptions||this.grid.onMouseEnter.notify({column:this.columnDef,grid:this.grid},new le(e))),this.updateTrackFilledColorWhenEnabled()}handleChangeOnCompositeEditor(e,t,i="user",s=!1){var u,p,m;const n=this.grid.getActiveCell(),o=this.args.column,l=((u=this.columnDef)==null?void 0:u.id)??"",a=this.dataContext,h=this.grid,d=this.serializeValue();this.validate().valid&&this.applyValue(this.dataContext,d),this.applyValue(t.formValues,d);const c=((m=(p=this.gridOptions)==null?void 0:p.compositeEditorOptions)==null?void 0:m.excludeDisabledFieldFormValues)??!1;(s||this.disabled&&c&&t.formValues.hasOwnProperty(l))&&delete t.formValues[l],h.onCompositeEditorChange.notify({...n,item:a,grid:h,column:o,formValues:t.formValues,editors:t.editors,triggeredBy:i},new le(e))}sliderTrackClicked(e){e.preventDefault();const t=e.offsetX,i=this._sliderTrackElm.offsetWidth,s=(t+0)*100/i;this._inputElm&&(this._inputElm.value=`${s}`,this._inputElm.dispatchEvent(new Event("change")))}updateTrackFilledColorWhenEnabled(){var e,t;if(this.editorOptions.enableSliderTrackColoring&&this._inputElm){const s=(+this.getValue()-+this._inputElm.min)/(((e=this.sliderOptions)==null?void 0:e.maxValue)??0-+this._inputElm.min)*100,n="linear-gradient(to right, %b %p1, %c %p1, %c %p2, %b %p2)".replace(/%b/g,"#eee").replace(/%c/g,((t=this.editorOptions)==null?void 0:t.sliderTrackFilledColor)??"var(--slick-slider-filter-thumb-color, #86bff8)").replace(/%p1/g,"0%").replace(/%p2/g,`${s}%`);this._sliderTrackElm.style.background=n,this._sliderOptions.sliderTrackBackground=n}}}const Pr={autocompleter:fp,checkbox:gp,date:_p,dualInput:vp,float:Sp,integer:Ep,longText:wp,multipleSelect:Tp,password:yp,singleSelect:Op,slider:xp,text:Qs},Ip=(r,e,t,i,s)=>{var h;const n=i&&i.params||{},o=n.propertyNames,l=(n==null?void 0:n.includeTitle)??!0;let a=n.dataContextProperty;if(a||(a=((h=i==null?void 0:i.field)==null?void 0:h.split(".")[0])||""),!o||!Array.isArray(o)||!a)throw new Error(`Formatters.arrayObjectToCsv requires you to pass an array of "propertyNames" (declared in "params") that you want to pull the data from.
|
|
20
20
|
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'] }}.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slickgrid-universal/vanilla-force-bundle",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.2",
|
|
4
4
|
"description": "Vanilla Slick Grid Bundle (mostly exist for our Salesforce implementation) - Similar to Vanilla Bundle, the only difference is that it adds extra packages within its bundle (CustomTooltip, CompositeEditor & TextExport)",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -39,18 +39,18 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@slickgrid-universal/binding": "~5.3.0",
|
|
42
|
-
"@slickgrid-universal/common": "~5.3.
|
|
43
|
-
"@slickgrid-universal/composite-editor-component": "~5.3.
|
|
44
|
-
"@slickgrid-universal/custom-footer-component": "~5.3.
|
|
45
|
-
"@slickgrid-universal/custom-tooltip-plugin": "~5.3.
|
|
46
|
-
"@slickgrid-universal/empty-warning-component": "~5.3.
|
|
42
|
+
"@slickgrid-universal/common": "~5.3.2",
|
|
43
|
+
"@slickgrid-universal/composite-editor-component": "~5.3.2",
|
|
44
|
+
"@slickgrid-universal/custom-footer-component": "~5.3.2",
|
|
45
|
+
"@slickgrid-universal/custom-tooltip-plugin": "~5.3.2",
|
|
46
|
+
"@slickgrid-universal/empty-warning-component": "~5.3.2",
|
|
47
47
|
"@slickgrid-universal/event-pub-sub": "~5.3.0",
|
|
48
|
-
"@slickgrid-universal/excel-export": "~5.3.
|
|
49
|
-
"@slickgrid-universal/pagination-component": "~5.3.
|
|
50
|
-
"@slickgrid-universal/text-export": "~5.3.
|
|
48
|
+
"@slickgrid-universal/excel-export": "~5.3.2",
|
|
49
|
+
"@slickgrid-universal/pagination-component": "~5.3.2",
|
|
50
|
+
"@slickgrid-universal/text-export": "~5.3.2",
|
|
51
51
|
"@slickgrid-universal/utils": "~5.3.0",
|
|
52
|
-
"@slickgrid-universal/vanilla-bundle": "~5.3.
|
|
52
|
+
"@slickgrid-universal/vanilla-bundle": "~5.3.2",
|
|
53
53
|
"whatwg-fetch": "^3.6.20"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "67d606c4d8b0672332cc5828236ce54ddbd2d432"
|
|
56
56
|
}
|