{"version":3,"file":"pebula-ngrid.mjs","sources":["../../../../libs/ngrid/src/lib/grid/bind-grid-to-datasource.ts","../../../../libs/ngrid/src/lib/ext/grid-ext-api.ts","../../../../libs/ngrid/src/lib/grid/meta-rows/meta-row.service.ts","../../../../libs/ngrid/src/lib/grid/meta-rows/meta-row-container.ts","../../../../libs/ngrid/src/lib/grid/utils/unique-column-css.ts","../../../../libs/ngrid/src/lib/grid/column/model/utils.ts","../../../../libs/ngrid/src/lib/grid/column/model/meta-column.ts","../../../../libs/ngrid/src/lib/grid/column/model/group-column.ts","../../../../libs/ngrid/src/lib/grid/column/model/column.ts","../../../../libs/ngrid/src/lib/grid/column/model/factory.ts","../../../../libs/ngrid/src/lib/grid/column/model/column-size-info.ts","../../../../libs/ngrid/src/lib/grid/column/width-logic/dynamic-column-width.ts","../../../../libs/ngrid/src/lib/grid/column/directives/column-def.ts","../../../../libs/ngrid/src/lib/grid/cell/cell-def/utils.ts","../../../../libs/ngrid/src/lib/grid/column/width-logic/static-column-width.ts","../../../../libs/ngrid/src/lib/grid/utils/width.ts","../../../../libs/ngrid/src/lib/grid/column/management/hidden-columns.ts","../../../../libs/ngrid/src/lib/grid/column/management/meta-rows-store.ts","../../../../libs/ngrid/src/lib/grid/column/management/column-store.ts","../../../../libs/ngrid/src/lib/grid/column/management/column-api.ts","../../../../libs/ngrid/src/lib/grid/row/utils.ts","../../../../libs/ngrid/src/lib/grid/row/rows-api.ts","../../../../libs/ngrid/src/lib/tokens.ts","../../../../libs/ngrid/src/lib/ext/grid-plugin.ts","../../../../libs/ngrid/src/lib/ext/plugin-control.ts","../../../../libs/ngrid/src/lib/grid/row/base-row.component.ts","../../../../libs/ngrid/src/lib/grid/row/row-to-repeater-bridge.ts","../../../../libs/ngrid/src/lib/grid/row/row.component.ts","../../../../libs/ngrid/src/lib/grid/row/columns-row.component.ts","../../../../libs/ngrid/src/lib/grid/row/meta-row.component.ts","../../../../libs/ngrid/src/lib/grid/row/cell-factory.service.ts","../../../../libs/ngrid/src/lib/grid/registry/registry.service.ts","../../../../libs/ngrid/src/lib/grid/row/row-def.directive.ts","../../../../libs/ngrid/src/lib/grid/context/cell.ts","../../../../libs/ngrid/src/lib/grid/context/row.ts","../../../../libs/ngrid/src/lib/grid/context/utils.ts","../../../../libs/ngrid/src/lib/grid/context/api.ts","../../../../libs/ngrid/src/lib/grid/registry/directives/multi-template.directives.ts","../../../../libs/ngrid/src/lib/grid/registry/directives/data-header-extensions.ts","../../../../libs/ngrid/src/lib/grid/registry/directives/multi-component.ts","../../../../libs/ngrid/src/lib/grid/registry/directives/single-template.directives.ts","../../../../libs/ngrid/src/lib/grid/registry/directives/no-data-ref.directive.ts","../../../../libs/ngrid/src/lib/grid/registry/directives/paginator-ref.directive.ts","../../../../libs/ngrid/src/lib/grid/cell/cell-styling.directive.ts","../../../../libs/ngrid/src/lib/grid/cell/utils.ts","../../../../libs/ngrid/src/lib/grid/cell/base-cell.ts","../../../../libs/ngrid/src/lib/grid/features/column-size-observer/column-size-observer-group.ts","../../../../libs/ngrid/src/lib/grid/features/column-size-observer/column-size-observer.ts","../../../../libs/ngrid/src/lib/grid/cell/header-cell.component.ts","../../../../libs/ngrid/src/lib/grid/cell/cell.component.ts","../../../../libs/ngrid/src/lib/grid/cell/footer-cell.component.ts","../../../../libs/ngrid/src/lib/grid/cell/meta-cell.component.ts","../../../../libs/ngrid/src/lib/grid/cell/cell-def/base-cell-def.directive.ts","../../../../libs/ngrid/src/lib/grid/cell/cell-def/header-cell-def.directive.ts","../../../../libs/ngrid/src/lib/grid/cell/cell-def/cell-def.directive.ts","../../../../libs/ngrid/src/lib/grid/cell/cell-def/edit-cell-def.directive.ts","../../../../libs/ngrid/src/lib/grid/cell/cell-def/footer-cell-def.directive.ts","../../../../libs/ngrid/src/lib/grid/cell/cell-edit-auto-focus.directive.ts","../../../../libs/ngrid/src/lib/grid/pbl-cdk-table/ngrid-base-row-view-repeater-strategy.ts","../../../../libs/ngrid/src/lib/grid/pbl-cdk-table/ngrid-cached-row-view-repeater-strategy.ts","../../../../libs/ngrid/src/lib/grid/pbl-cdk-table/pbl-cdk-table.component.ts","../../../../libs/ngrid/src/lib/grid/column/width-logic/column-width-calc.ts","../../../../libs/ngrid/src/lib/grid/logicap/no-data-view.ts","../../../../libs/ngrid/src/lib/grid/logicap/bind-registry.ts","../../../../libs/ngrid/src/lib/grid/logicap/pagination-view.ts","../../../../libs/ngrid/src/lib/grid/logicap/index.ts","../../../../libs/ngrid/src/lib/grid/api-factory.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/base-v-scroll.directive.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/utils.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/meta-row-sticky-scroll.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/virtual-scroll-for-of.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/scroll-logic/virtual-scroll-watcher.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/cdk-wrappers/auto-size-cdk.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/cdk-wrappers/auto-size.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/row-intersection.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/virtual-scroll-height-paging.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/virtual-scroll-viewport.component.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/virtual-scroll-viewport.component.html","../../../../libs/ngrid/src/lib/grid/ngrid.component.ts","../../../../libs/ngrid/src/lib/grid/ngrid.component.html","../../../../libs/ngrid/src/lib/grid/directives/directives.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/noop.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/dynamic-size/size-group.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/dynamic-size/size-group-collection.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/dynamic-size/sizer.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/dynamic-size/dynamic-size.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/v-scroll.directive.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/scrolling-plugin.directive.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/cdk-wrappers/fixed-size-cdk.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/cdk-wrappers/fixed-size.ts","../../../../libs/ngrid/src/lib/grid/features/hide-columns.directive.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/cdk-wrappers/v-scroll-auto.directive.ts","../../../../libs/ngrid/src/lib/grid/features/virtual-scroll/strategies/cdk-wrappers/v-scroll-fixed.directive.ts","../../../../libs/ngrid/src/lib/di-factories.ts","../../../../libs/ngrid/src/lib/ngrid.module.ts","../../../../libs/ngrid/src/index.ts","../../../../libs/ngrid/src/pebula-ngrid.ts"],"sourcesContent":["import { PblNgridInternalExtensionApi } from '../ext/grid-ext-api';\nimport { PblNgridComponent } from './ngrid.component';\n\ndeclare module '@pebula/ngrid/core/lib/data-source/data-source' {\n  interface PblDataSource<T = any, TData = any> {\n    hostGrid: PblNgridComponent<T>;\n  }\n}\n\nexport function bindGridToDataSource(extApi: PblNgridInternalExtensionApi): void {\n  extApi.events.subscribe( event => {\n    if (event.kind === 'onDataSource') {\n      const { curr, prev } = event;\n      if (prev && prev.hostGrid === extApi.grid) {\n        prev.hostGrid = undefined;\n      }\n      if (curr) {\n        curr.hostGrid = extApi.grid;\n      }\n    } else if (event.kind === 'onDestroy') {\n      const ds = extApi.grid.ds;\n      if (ds.hostGrid === extApi.grid) {\n        ds.hostGrid = undefined;\n      }\n    }\n  });\n}\n","import { Observable } from 'rxjs';\nimport { InjectionToken } from '@angular/core';\nimport { Direction } from '@angular/cdk/bidi';\n\nimport { PblNgridConfigService, PblNgridEvents } from '@pebula/ngrid/core';\nimport { _PblNgridComponent } from '../tokens';\nimport { PblCdkTableComponent } from '../grid/pbl-cdk-table/pbl-cdk-table.component';\nimport { ContextApi } from '../grid/context/api';\nimport { PblNgridRegistryService } from '../grid/registry/registry.service';\nimport { ColumnApi, PblColumnStore } from '../grid/column/management';\nimport { PblNgridColumnWidthCalc } from '../grid/column/width-logic/column-width-calc';\nimport { PblCdkVirtualScrollViewportComponent } from '../grid/features/virtual-scroll/virtual-scroll-viewport.component'\nimport { NotifyPropChangeMethod, OnPropChangedEvent } from './types';\nimport { RowsApi, PblRowsApi } from '../grid/row';\nimport { PblNgridPluginContext, PblNgridPluginController } from './plugin-control';\nimport { Logicaps } from '../grid/logicap/index';\n\nexport const EXT_API_TOKEN = new InjectionToken('PBL_NGRID_EXTERNAL_API');\n\nexport interface PblNgridExtensionApi<T = any> {\n  grid: _PblNgridComponent<T>;\n  element: HTMLElement;\n  config: PblNgridConfigService;\n  /**\n   * The registry instance bound to the current instance.\n   * This registry instance lifespan is similar to the grid's component, it will get destroyed when the grid gets destroyed.\n   */\n  registry: PblNgridRegistryService;\n  propChanged: Observable<OnPropChangedEvent>;\n  cdkTable: PblCdkTableComponent<T>;\n  columnStore: PblColumnStore;\n  contextApi: ContextApi<T>;\n  columnApi: ColumnApi<T>;\n  rowsApi: RowsApi<T>;\n  events: Observable<PblNgridEvents>;\n  pluginCtrl: PblNgridPluginController<T>;\n  widthCalc: PblNgridColumnWidthCalc;\n  onConstructed(fn: () => void): void;\n  onInit(fn: () => void): void;\n  getDirection(): Direction;\n  directionChange(): Observable<Direction>;\n}\n\nexport interface PblNgridInternalExtensionApi<T = any> extends PblNgridExtensionApi<T> {\n  viewport: PblCdkVirtualScrollViewportComponent;\n  plugin: PblNgridPluginContext;\n  rowsApi: PblRowsApi<T>;\n  setViewport(viewport: PblCdkVirtualScrollViewportComponent): void;\n  setCdkTable(cdkTable: PblCdkTableComponent<T>): void;\n  notifyPropChanged: NotifyPropChangeMethod;\n  logicaps: Logicaps;\n}\n","import { animationFrameScheduler, Observable, Subject, asapScheduler } from 'rxjs';\nimport { auditTime, filter, take, debounceTime } from 'rxjs/operators';\nimport { Injectable, Inject } from '@angular/core';\nimport { PblMetaRowDefinitions } from '@pebula/ngrid/core';\n\nimport { PblNgridExtensionApi, EXT_API_TOKEN } from '../../ext/grid-ext-api';\n\nfunction metaRowSectionFactory(): MetaRowSection {\n  return { fixed: [], row: [], sticky: [], all: [] };\n}\n\nexport interface PblMetaRow {\n  element: HTMLElement;\n  meta: PblMetaRowDefinitions;\n  gridWidthRow: any;\n}\n\nexport interface MetaRowSection {\n  fixed: Array<{ index: number, rowDef: PblMetaRowDefinitions; el?: HTMLElement; }>;\n  row: Array<{ index: number, rowDef: PblMetaRowDefinitions; el?: HTMLElement; }>;\n  sticky: Array<{ index: number, rowDef: PblMetaRowDefinitions; el?: HTMLElement; }>;\n  all: PblMetaRowDefinitions[];\n}\n\n@Injectable()\nexport class PblNgridMetaRowService<T = any> {\n  gridWidthRow: { rowDef: PblMetaRowDefinitions; el: HTMLElement; };\n  header: MetaRowSection = metaRowSectionFactory();\n  footer: MetaRowSection = metaRowSectionFactory();\n\n  /**\n   * Notifies that changes occured in one or more meta rows (added/removed)\n   * Multiple changes are aggregated (using asapScheduler)\n   */\n  readonly sync: Observable<void>;\n  readonly hzScroll: Observable<number>;\n  private sync$ = new Subject<void>();\n  private hzScroll$ = new Subject<number>();\n\n  constructor(@Inject(EXT_API_TOKEN) public readonly extApi: PblNgridExtensionApi<T>) {\n    this.sync = this.sync$ // TODO: complete\n      .pipe(debounceTime(0, asapScheduler));\n\n    this.hzScroll = this.hzScroll$.asObservable();\n\n    extApi.onInit(() => {\n      const { grid } = extApi;\n      let hzOffset = grid.viewport.measureScrollOffset('start');\n      let trackScroll = true;\n      grid.viewport.elementScrolled()\n        .pipe(\n          filter( () => trackScroll ),\n          auditTime(0, animationFrameScheduler),\n        )\n        .subscribe({\n          next: () => {\n            const newOffset = grid.viewport.measureScrollOffset('start');\n            if (hzOffset !== newOffset) {\n              this.hzScroll$.next(hzOffset = newOffset);\n            } else if (grid.viewport.isScrolling) {\n              trackScroll = false;\n              grid.viewport.scrolling\n                .pipe(take(1))\n                .subscribe( () => trackScroll = true );\n            }\n          },\n          complete: () => this.hzScroll$.complete(),\n        });\n    });\n  }\n\n  addMetaRow(metaRow: PblMetaRow): void {\n    const { columnStore } = this.extApi;\n    const header = columnStore.metaHeaderRows;\n    const footer = columnStore.metaFooterRows;\n\n    const rowDef = metaRow.meta;\n    if (rowDef === columnStore.headerColumnDef) {\n      if (metaRow.gridWidthRow === true) {\n        // This is a dummy row used to measure width and get width resize notifications\n        this.gridWidthRow = { rowDef, el: metaRow.element };\n      } else {\n        // This is the main header column row, it doesn't have an index but we will assign as if it's the last\n        // so other features will be able to sort by physical location\n        this.addToSection(this.header, metaRow, columnStore.metaHeaderRows.length);\n      }\n    } else if (rowDef === columnStore.footerColumnDef) {\n      // This is the main footer column row\n      this.addToSection(this.footer, metaRow, 0);\n    } else {\n      // All meta rows\n      let index = header.findIndex( h => h.rowDef === rowDef );\n      if (index > -1) {\n        this.addToSection(this.header, metaRow, index);\n      } else {\n        index = footer.findIndex( h => h.rowDef === rowDef );\n        if (index > -1) {\n          this.addToSection(this.footer, metaRow, index);\n        } else {\n          if (typeof ngDevMode === 'undefined' || ngDevMode) {\n            throw new Error('Invalid operation');\n          }\n        }\n      }\n    }\n    this.sync$.next();\n  }\n\n  removeMetaRow(metaRow: PblMetaRow): void {\n    const rowDef = metaRow.meta;\n    let index = this.header.all.indexOf(metaRow.meta);\n    if (index > -1) {\n      this.header.all.splice(index, 1);\n      index = this.header[rowDef.type].findIndex( h => h.rowDef === rowDef );\n      this.header[rowDef.type].splice(index, 1);\n      this.sync$.next();\n    } else if ( (index = this.footer.all.indexOf(metaRow.meta)) > -1) {\n      this.footer.all.splice(index, 1);\n      index = this.footer[rowDef.type].findIndex( h => h.rowDef === rowDef );\n      this.footer[rowDef.type].splice(index, 1);\n      this.sync$.next();\n    }\n  }\n\n  private addToSection(section: MetaRowSection, metaRow: PblMetaRow, index: number): void {\n    const rowDef = metaRow.meta;\n    section[rowDef.type].push( { index, rowDef, el: metaRow.element } );\n    section.all.push(rowDef);\n  }\n}\n","import { Subject } from 'rxjs';\nimport { Component, Input, ElementRef, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';\nimport { ON_RESIZE_ROW, unrx } from '@pebula/ngrid/core';\n\nimport { PblNgridMetaRowService } from './meta-row.service';\n\n@Component({\n  selector: 'div[pbl-ngrid-fixed-meta-row-container]',\n  template: `<div class=\"pbl-cdk-table\" style=\"height: 0px; overflow: hidden;\" [style.width.px]=\"_width\"></div><div class=\"pbl-cdk-table\" [style.width.px]=\"_width$ | async\"></div>`,\n  host: { // tslint:disable-line:no-host-metadata-property\n    style: 'flex: 0 0 auto; overflow: hidden;',\n    '[style.width.px]': '_innerWidth',\n  },\n})\nexport class PblNgridMetaRowContainerComponent implements OnChanges, OnDestroy {\n\n  @Input('pbl-ngrid-fixed-meta-row-container') type: 'header' | 'footer';\n\n  /**\n   * The inner width of the grid, the viewport width of a row.\n   * The width of the grid minus scroll bar.\n   */\n  _innerWidth: number;\n  _minWidth: number;\n  _width: number;\n  readonly _width$ = new Subject<number>();\n\n  private _totalColumnWidth = 0;\n  private element: HTMLElement;\n  private _hzScrollDir: -1 | 1 = 1;\n\n  constructor(public readonly metaRows: PblNgridMetaRowService, elRef: ElementRef<HTMLElement>) {\n    this.element = elRef.nativeElement;\n\n    metaRows.sync.pipe(unrx(this)).subscribe( () => this.syncRowDefinitions() );\n\n    this.metaRows.extApi.events\n      .pipe(ON_RESIZE_ROW, unrx(this))\n      .subscribe( event => this.updateWidths() );\n\n    this.metaRows.extApi.grid.columnApi.totalColumnWidthChange\n      .pipe(unrx(this))\n      .subscribe( width => {\n        this._totalColumnWidth = width;\n        this.updateWidths();\n      });\n\n    this._hzScrollDir = this.metaRows.extApi.getDirection() === 'rtl' ? -1 : 1\n    this.metaRows.extApi.directionChange()\n      .pipe(unrx(this))\n      .subscribe( dir => this._hzScrollDir = dir === 'rtl' ? -1 : 1 );\n  }\n\n  ngOnChanges(changes: SimpleChanges): void {\n    if ('type' in changes) {\n      const scrollContainerElement = this.element;\n      scrollContainerElement.scrollLeft = this.metaRows.extApi.grid.viewport.measureScrollOffset('start') * this._hzScrollDir;\n\n      if (changes.type.isFirstChange) {\n        this.metaRows.hzScroll\n          .pipe(unrx(this))\n          .subscribe( offset => scrollContainerElement.scrollLeft = offset * this._hzScrollDir);\n\n        this.metaRows.extApi.cdkTable.onRenderRows\n          .pipe(unrx(this))\n          .subscribe( () => { this.updateWidths() });\n      }\n    }\n  }\n\n  ngOnDestroy(): void {\n    this._width$.complete();\n    unrx.kill(this);\n  }\n\n  private updateWidths(): void {\n    this._innerWidth = this.metaRows.extApi.grid.viewport.innerWidth;\n    this._minWidth = this.metaRows.extApi.cdkTable.minWidth;\n    this._width = Math.max(this._innerWidth, this._minWidth);\n    this._width$.next(Math.max(this._innerWidth, this._totalColumnWidth))\n  }\n\n  private syncRowDefinitions(): void {\n    const isHeader = this.type === 'header';\n    const section = isHeader ? this.metaRows.header : this.metaRows.footer;\n\n    const widthContainer = this.element.firstElementChild;\n    const container = widthContainer.nextElementSibling;\n\n    if (isHeader) {\n      widthContainer.appendChild(this.metaRows.gridWidthRow.el);\n    }\n\n    for (const def of section.fixed) {\n      container.appendChild(def.el);\n    }\n  }\n}\n","import { CdkColumnDef } from '@angular/cdk/table';\nimport { PblColumnTypeDefinition } from '@pebula/ngrid/core';\n\nconst COLUMN_NAME_CSS_PREFIX = 'pbl-ngrid-column';\n\n/**\n * Returns a css class unique to the column\n */\nexport function uniqueColumnCss(columnDef: CdkColumnDef): string {\n  return `${COLUMN_NAME_CSS_PREFIX}-${columnDef.cssClassFriendlyName}`;\n}\n\n/**\n * Returns a css class unique to the type of the column (columns might share types)\n */\nexport function uniqueColumnTypeCss(type: PblColumnTypeDefinition): string {\n  return `${COLUMN_NAME_CSS_PREFIX}-type-${type.name}`;\n}\n","import { PblBaseColumnDefinition } from '@pebula/ngrid/core';\n\nconst RE_PARSE_STYLE_LENGTH_UNIT = /((?:\\d*\\.)?\\d+)(%|px)$/;\n\nexport function parseStyleWidth(exp: string): { value: number, type: 'px' | '%'} | undefined {\n  const match = RE_PARSE_STYLE_LENGTH_UNIT.exec(exp);\n  if (match) {\n    return { value: Number(match[1]), type: <any> match[2] };\n  }\n}\n\nexport function initDefinitions<T extends PblBaseColumnDefinition>(def: PblBaseColumnDefinition, target: T): void {\n  const copyKeys: Array<keyof PblBaseColumnDefinition> = ['id', 'label', 'css', 'minWidth', 'width', 'maxWidth', 'type'];\n  copyKeys.forEach( k => k in def && (target[k as keyof T] = def[k]) );\n  if (def.data) {\n    target.data = Object.assign(target.data || {}, def.data);\n  }\n}\n","import { TemplateRef } from '@angular/core';\nimport { PblMetaColumnDefinition, PblColumnTypeDefinition } from '@pebula/ngrid/core';\n\nimport { PblNgridColumnDef } from '../directives/column-def';\nimport { PblNgridMetaCellContext } from '../../context/types';\nimport { parseStyleWidth, initDefinitions } from './utils';\n\nconst PBL_NGRID_META_COLUMN_MARK = Symbol('PblMetaColumn');\nconst CLONE_PROPERTIES: Array<keyof PblMetaColumn> = ['kind', 'rowIndex'];\n\nexport function isPblMetaColumn(def: any): def is PblMetaColumn {\n  return def instanceof PblMetaColumn || (def && def[PBL_NGRID_META_COLUMN_MARK] === true);\n}\n\nexport class PblMetaColumn implements PblMetaColumnDefinition {\n  //#region PblCdkVirtualScrollViewportComponentBaseColumnDefinition\n\n   /**\n   * A Unique ID for the column.\n   * The ID must be unique across all columns, regardless of the type.\n   * Columns with identical ID will share result in identical template.\n   *\n   * For example, having a header column and a footer column with the same id will result in the same cell presentation for both.\n   */\n  id: string;\n\n  label?: string;\n\n  /**\n   * The type of the values in this column.\n   * This is an additional level for matching columns to templates, grouping templates for a type.\n   */\n  type?: PblColumnTypeDefinition;\n\n  /**\n   * CSS class that get applied on the header and cell.\n   * You can apply unique header/cell styles using the element name.\n   */\n  css?: string;\n\n  /**\n   * The width in px or % in the following format: ##% or ##px\n   * Examples: '50%', '50px'\n   */\n  get width(): string { return this._width; }\n  set width(value: string) {\n    if (value !== this._width) {\n      this._parsedWidth = parseStyleWidth(this._width = value);\n\n      // Error in dev, on prod just let it be unset\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        if (!this._parsedWidth && value) {\n          throw new Error(`Invalid width \"${value}\" in column ${this.id}. Valid values are ##% or ##px (50% / 50px)`);\n        }\n      }\n\n      const isFixedWidth = this._parsedWidth && this._parsedWidth.type === 'px';\n      Object.defineProperty(this, 'isFixedWidth', { value: isFixedWidth, configurable: true });\n    }\n  }\n  /**\n   * This minimum width in pixels\n   * This is an absolute value, thus a number.\n   */\n  minWidth?: number;\n  /**\n   * This maximum width in pixels\n   * This is an absolute value, thus a number.\n   */\n  maxWidth?: number;\n\n  /**\n   * A place to store things...\n   * This must be an object, values are shadow-copied so persist data between multiple plugins.\n   */\n  data: any = {};\n  //#endregion PblCdkVirtualScrollViewportComponentBaseColumnDefinition\n\n  //#region PblMetaColumnDefinition\n\n  kind: 'header' | 'footer';\n\n  /**\n   * The index (zero based) of the header row this column is attached to, used for multi-header setup.\n   * When not set (undefined) the index is considered the LAST index.\n   *\n   * If you want to setup a multi header grid with 2 header rows, set this to 0 for the first header row and for the 2nd header\n   * row do not set a rowIndex.\n   */\n  rowIndex: number;\n//#endregion PblMetaColumnDefinition\n\n  get parsedWidth(): { value: number; type: 'px' | '%' } | undefined { return this._parsedWidth; }\n\n  /**\n   * Used by pbl-ngrid to apply a custom header/footer cell template, or the default when not set.\n   * @internal\n   */\n  template: TemplateRef<PblNgridMetaCellContext<any>>;\n\n  /**\n   * When true indicates that the width is set with type pixels.\n   * @internal\n   */\n  readonly isFixedWidth?: boolean;\n\n  /**\n   * The column def for this column.\n   */\n  get columnDef(): PblNgridColumnDef<PblMetaColumn> { return this._columnDef; }\n\n  private _width?: string;\n  private _parsedWidth: ReturnType<typeof parseStyleWidth>;\n  private _columnDef: PblNgridColumnDef<PblMetaColumn>;\n  private defaultWidth = '';\n\n  constructor(def: PblMetaColumnDefinition) {\n    this[PBL_NGRID_META_COLUMN_MARK] = true;\n    initDefinitions(def, this);\n\n    for (const prop of CLONE_PROPERTIES) {\n      if (prop in def) {\n        this[prop as any] = def[prop]\n      }\n    }\n\n    if (!isPblMetaColumn(def)) {\n      if (typeof def.type === 'string') {\n        this.type = { name: def.type } as any;\n      }\n    }\n  }\n\n  static extendProperty(name: keyof PblMetaColumn): void {\n    if (CLONE_PROPERTIES.indexOf(name) === -1) {\n      CLONE_PROPERTIES.push(name);\n    }\n  }\n\n  attach(columnDef: PblNgridColumnDef<PblMetaColumn>): void {\n    this.detach();\n    this._columnDef = columnDef;\n    this.columnDef.updateWidth(this.width || this.defaultWidth, 'attach');\n  }\n\n  detach(): void {\n    this._columnDef = undefined;\n  }\n\n  updateWidth(fallbackDefault: string): void {\n    this.defaultWidth = fallbackDefault || '';\n    if (this.columnDef) {\n      this.columnDef.updateWidth(this.width || fallbackDefault, 'update');\n    }\n  }\n}\n","import { PblColumnGroupDefinition } from '@pebula/ngrid/core';\nimport { PblMetaColumn } from './meta-column';\nimport { PblColumn } from './column';\n\nconst PBL_NGRID_COLUMN_GROUP_MARK = Symbol('PblColumnGroup');\nconst CLONE_PROPERTIES: Array<keyof PblColumnGroup> = [];\n\nexport function isPblColumnGroup(def: any): def is PblColumnGroup {\n  return def instanceof PblColumnGroup || (def && def[PBL_NGRID_COLUMN_GROUP_MARK] === true);\n}\n\nfunction getId(value: string | { id: string }): string {\n  return typeof value === 'string' ? value : value.id;\n}\n\nexport class PblColumnGroupStore {\n  get all(): PblColumnGroup[] { return this._all; }\n\n  private store = new Map<string, { group: PblColumnGroup; activeColumns: Set<string>; }>();\n  private _all: PblColumnGroup[] = [];\n\n  /**\n   * Attach a column to a group.\n   */\n  attach(group: string | PblColumnGroup, column: string | PblColumn): boolean {\n    const g = this._find(group);\n    if (g) {\n      g.activeColumns.add(getId(column));\n      return true;\n    }\n    return false;\n  }\n\n  /**\n   * Detach a column from a group.\n   */\n  detach(group: string | PblColumnGroup, column: string | PblColumn): boolean {\n    const g = this._find(group);\n    if (g) {\n      return g.activeColumns.delete(getId(column));\n    }\n    return false;\n  }\n\n  /**\n   * Returns a list of `PblColumnGroup` that does not have columns attached.\n   */\n  findGhosts(): PblColumnGroup[] {\n    return Array.from(this.store.values())\n      .filter( item => item.activeColumns.size === 0 )\n      .map( item => item.group );\n  }\n\n  add(group: PblColumnGroup): void {\n    this.store.set(group.id, { group, activeColumns: new Set<string>() });\n    this.updateAll();\n  }\n\n  remove(group: string | PblColumnGroup): boolean {\n    const g = this.find(group);\n    if (g && this.store.delete(g.id)) {\n      this.updateAll();\n      return true;\n    }\n    return false;\n  }\n\n  find(group: string | PblColumnGroup): PblColumnGroup | undefined {\n    const g = this._find(group);\n    if (g) {\n      return g.group;\n    }\n  }\n\n  clone(): PblColumnGroupStore {\n    const c = new PblColumnGroupStore();\n    c.store = new Map<string, { group: PblColumnGroup; activeColumns: Set<string>; }>(this.store);\n    c.updateAll();\n    return c;\n  }\n\n  private _find(group: string | PblColumnGroup): { group: PblColumnGroup; activeColumns: Set<string>; } | undefined {\n    return this.store.get(getId(group));\n  }\n\n  private updateAll(): void {\n    this._all = Array.from(this.store.values()).map( item => item.group );\n  }\n}\n\nexport class PblColumnGroup extends PblMetaColumn implements PblColumnGroupDefinition {\n\n  columnIds: string[];\n  //#endregion PblColumnGroupDefinition\n\n  /**\n   * Returns the visible state of the column.\n   * The column is visible if AT LEAST ONE child column is visible (i.e. not hidden)\n   */\n  get isVisible(): boolean {\n    return this.columns.some( c => !c.hidden );\n  }\n\n  /**\n   * When set, this column is a cloned column of an existing column caused by a split.\n   * @internal\n   */\n  slaveOf?: PblColumnGroup;\n\n  /** @internal */\n  readonly columns: PblColumn[];\n\n  constructor(def: PblColumnGroup | PblColumnGroupDefinition, columns: PblColumn[], public readonly placeholder = false) {\n    super(isPblColumnGroup(def)\n      ? def\n      : { id: `group-${def.columnIds.join('.')}-row-${def.rowIndex}`, kind: 'header' as 'header', ...(def as any) }\n    );\n    this[PBL_NGRID_COLUMN_GROUP_MARK] = true;\n    this.columnIds = def.columnIds;\n    this.columns = columns;\n\n    for (const c of columns) {\n      c.markInGroup(this);\n    }\n\n    for (const prop of CLONE_PROPERTIES) {\n      if (prop in def) {\n        this[prop as any] = def[prop]\n      }\n    }\n  }\n\n  static extendProperty(name: keyof PblColumnGroup): void {\n    if (CLONE_PROPERTIES.indexOf(name) === -1) {\n      CLONE_PROPERTIES.push(name);\n    }\n  }\n\n  createSlave(columns: PblColumn[] = []): PblColumnGroup {\n    const slave = new PblColumnGroup({...this, id: this.id + '-slave' + Date.now()}, columns);\n    slave.slaveOf = this;\n    Object.defineProperty(slave, 'template', { get: function() { return this.slaveOf.template; }, set: function(value) {} } );\n    return slave;\n  }\n\n  replace(newColumn: PblColumn): boolean {\n    const { id } = newColumn;\n    const idx = this.columns.findIndex( c => c.id === id );\n    if (idx > -1) {\n      this.columns.splice(idx, 1, newColumn);\n      return true;\n    }\n    return false;\n  }\n}\n","import { TemplateRef } from '@angular/core';\nimport {\n  DataSourceColumnPredicate, PblNgridSorter,\n  PblColumnDefinition, PblColumnTypeDefinition,\n  getValue, deepPathSet,\n} from '@pebula/ngrid/core';\n\nimport { PblNgridMetaCellContext, PblNgridCellContext } from '../../context/types';\nimport { PblNgridColumnDef } from '../directives/column-def';\nimport { PblColumnSizeInfo } from './types';\nimport { initDefinitions, parseStyleWidth } from './utils';\nimport { PblColumnGroup, PblColumnGroupStore } from './group-column';\n\nconst PBL_NGRID_COLUMN_MARK = Symbol('PblColumn');\nconst CLONE_PROPERTIES: Array<keyof PblColumn> = ['pIndex', 'transform', 'filter', 'sort', 'alias', 'headerType', 'footerType', 'pin'];\n\nexport function isPblColumn(def: any): def is PblColumn {\n  return def instanceof PblColumn || (def && def[PBL_NGRID_COLUMN_MARK] === true);\n}\n\nexport class PblColumn implements PblColumnDefinition {\n  id: string;\n\n  /**\n   * When set, defines this column as the primary index of the data-set with all values in this column being unique.\n   */\n  pIndex?: boolean;\n\n  label?: string;\n\n  /**\n   * CSS class that get applied on the header and cell.\n   * You can apply unique header/cell styles using the element name.\n   */\n  css?: string;\n\n  /**\n   * The width in px or % in the following format: ##% or ##px\n   * Examples: '50%', '50px'\n   */\n  get width(): string { return this._width; }\n  set width(value: string) {\n    if (value !== this._width) {\n      this._parsedWidth = parseStyleWidth(this._width = value);\n\n      // Error in dev, on prod just let it be unset\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        if (!this._parsedWidth && value) {\n          throw new Error(`Invalid width \"${value}\" in column ${this.prop}. Valid values are ##% or ##px (50% / 50px)`);\n        }\n      }\n\n      const isFixedWidth = this._parsedWidth?.type === 'px';\n      Object.defineProperty(this, 'isFixedWidth', { value: isFixedWidth, configurable: true });\n    }\n  }\n  /**\n   * This minimum width in pixels\n   * This is an absolute value, thus a number.\n   */\n  minWidth?: number;\n  /**\n   * This maximum width in pixels\n   * This is an absolute value, thus a number.\n   */\n  maxWidth?: number;\n\n  /**\n   * A place to store things...\n   * This must be an object, values are shadow-copied so persist data between multiple plugins.\n   */\n  data: any = {};\n\n  get parsedWidth(): { value: number; type: 'px' | '%' } | undefined { return this._parsedWidth; }\n\n  /**\n   * The property to display (from the row element)\n   * You can use dot notation to display deep paths.\n   */\n  prop: string;\n\n  /**\n   * A path to a nested object, relative to the row element.\n   * The table will display `prop` from the object referenced by `path`.\n   *\n   * You can also use dot notation directly from `prop`.\n   *\n   * Example:\n   * prop: \"street\"\n   * path: [ \"myInstance\", \"user\", \"address\"\n   *\n   * is identical to:\n   * prop: \"myInstance.user.address.street\"\n   *\n   */\n  path?: string[];\n\n  /**\n   * The type of the values in this column.\n   * This is an additional level for matching columns to templates, grouping templates for a type.\n   */\n  type?: PblColumnTypeDefinition;\n  headerType?: PblColumnTypeDefinition;\n  footerType?: PblColumnTypeDefinition;\n\n  sort?: boolean | PblNgridSorter;\n\n  /**\n   * A custom predicate function to filter rows using the current column.\n   *\n   * Valid only when filtering by value.\n   * See `PblDataSource.setFilter` for more information.\n   */\n  filter?: DataSourceColumnPredicate;\n\n  /**\n   * Marks the table as editable. An editable column also requires an edit template to qualify as editable, this flag alone is not enough.\n   *\n   * Note that this flag only effect the CSS class added to the cell.\n   */\n  editable: boolean;\n\n  pin: 'start' | 'end' | undefined;\n\n  /**\n   * An alias used to identify the column.\n   * Useful when the server provides sort/filter metadata that does not have a 1:1 match with the column names.\n   * e.g. Deep path props, property name convention mismatch, etc...\n   */\n  alias?: string;\n\n  /**\n   * Optional transformer that control the value output from the combination of a column and a row.\n   * The value returned from this transformer will be returned from `PblColumn.getValue`\n   */\n  transform?: (value: any, row?: any, col?: PblColumnDefinition) => any;\n\n  /**\n   * The original value of `prop`.\n   * @internal\n   */\n  orgProp: string;\n\n  /**\n   * Used by pbl-ngrid to apply custom cell template, or the default when not set.\n   * @internal\n   */\n  cellTpl: TemplateRef<PblNgridCellContext<any>>;\n    /**\n   * Used by pbl-ngrid to apply custom cell template, or the default when not set.\n   * @internal\n   */\n  editorTpl: TemplateRef<PblNgridCellContext<any>>;\n  /**\n   * Used by pbl-ngrid to apply a custom header cell template, or the default when not set.\n   * @internal\n   */\n  headerCellTpl: TemplateRef<PblNgridMetaCellContext<any>>;\n  /**\n   * Used by pbl-ngrid to apply a custom footer cell template, or the default when not set.\n   * @internal\n   */\n  footerCellTpl: TemplateRef<PblNgridMetaCellContext<any>>;\n\n  /**\n   * Used by the library as a logical flag representing the column hidden state.\n   * This flag does not effect the UI, changing it will not change he hidden state in the UI.\n   * Do not set this value manually.\n   * @internal\n   */\n  hidden: boolean;\n\n  /**\n   * When true indicates that the width is set with type pixels.\n   * @internal\n   */\n  readonly isFixedWidth?: boolean;\n\n  /**\n   * An on-demand size info object, populated by `PblColumnSizeObserver`\n   * @internal\n   */\n  sizeInfo?: PblColumnSizeInfo;\n\n  /** @internal */\n  maxWidthLock: boolean;\n\n  /**\n   * The column def for this column.\n   */\n  get columnDef(): PblNgridColumnDef<PblColumn> { return this._columnDef; }\n\n  get groups(): string[] { return Array.from(this._groups.values()); }\n\n  /** @internal */\n  public readonly groupStore: PblColumnGroupStore;\n\n  private _width?: string;\n  private _parsedWidth: ReturnType<typeof parseStyleWidth>;\n\n  private _columnDef: PblNgridColumnDef<PblColumn>;\n  private defaultWidth = '';\n\n  /**\n   * Groups that this column belongs to.\n   * WARNING: DO NOT ADD/REMOVE GROUPS DIRECTLY, USE markInGroup/markNotInGroup.\n   */\n  private _groups = new Set<string>();\n\n  constructor(def: PblColumn | PblColumnDefinition, groupStore?: PblColumnGroupStore) {\n    this[PBL_NGRID_COLUMN_MARK] = true;\n\n    if (isPblColumn(def)) {\n      initDefinitions(def, this);\n      this.prop = def.prop;\n      this.path = def.path;\n      this.orgProp = def.orgProp;\n      this.groupStore = groupStore || def.groupStore;\n      this._groups = new Set<string>(def._groups);\n      for (const id of Array.from(def._groups.values())) {\n        const g = this.groupStore.find(id);\n        if (g) {\n          this.markInGroup(g);\n          g.replace(this);\n        }\n      }\n    } else {\n      const path = def.path || def.prop.split('.');\n      const prop = def.path ? def.prop : path.pop();\n\n      def = Object.create(def);\n      def.id = def.id || def.prop || def.label;\n      def.label = 'label' in def ? def.label : prop;\n\n      if (typeof def.type === 'string') {\n        def.type = { name: def.type } as any;\n      }\n      if (typeof def.headerType === 'string') {\n        def.headerType = { name: def.headerType } as any;\n      }\n      if (typeof def.footerType === 'string') {\n        def.footerType = { name: def.footerType } as any;\n      }\n\n      initDefinitions(def, this);\n\n      this.groupStore = groupStore || new PblColumnGroupStore();\n      this.prop = prop;\n      this.orgProp = def.prop;\n      if (path.length) {\n        this.path = path;\n      }\n    }\n\n    for (const prop of CLONE_PROPERTIES) {\n      if (prop in def) {\n        this[prop as any] = def[prop]\n      }\n    }\n  }\n\n  static extendProperty(name: keyof PblColumn): void {\n    if (CLONE_PROPERTIES.indexOf(name) === -1) {\n      CLONE_PROPERTIES.push(name);\n    }\n  }\n\n  attach(columnDef: PblNgridColumnDef<PblColumn>): void {\n    this.detach();\n    this._columnDef = columnDef;\n    if (this.defaultWidth) {\n      this.columnDef.updateWidth(this.width || this.defaultWidth, 'attach');\n    }\n  }\n\n  detach(): void {\n    this._columnDef = undefined;\n  }\n\n  setDefaultWidth(defaultWidth: string): void {\n    this.defaultWidth = defaultWidth;\n  }\n\n  updateWidth(width?: string): void {\n    if (width) {\n      this.width = width;\n    }\n    const { columnDef } = this;\n    if (columnDef) {\n      columnDef.updateWidth(this.width || this.defaultWidth || '', 'update');\n    }\n  }\n\n  /**\n   * Get the value this column points to in the provided row\n   */\n  getValue<T = any>(row: any): T { return getValue(this, row); }\n\n  /**\n   * Set a value in the provided row where this column points to\n   */\n  setValue(row: any, value: any): void { return deepPathSet(row, this, value); }\n\n  /**\n   * Mark's that this column belong to the provided group.\n   * \\> Note that this internal to the column and does not effect the group in any way.\n   */\n  markInGroup(g: PblColumnGroup): void {\n    this.groupStore.attach(g, this);\n    this._groups.add(g.id);\n  }\n\n  /**\n   * Mark's that this column does not belong to the provided group.\n   * \\> Note that this internal to the column and does not effect the group in any way.\n   */\n  markNotInGroup(g: PblColumnGroup): boolean {\n    this.groupStore.detach(g, this);\n    return this._groups.delete(g.id);\n  }\n\n  isInGroup(g: PblColumnGroup): boolean {\n    return this._groups.has(g.id);\n  }\n\n  getGroupOfRow(rowIndex: number): PblColumnGroup | undefined {\n    const groupIds = this.groups;\n    for (const id of groupIds) {\n      const g = this.groupStore.find(id);\n      if (g && g.rowIndex === rowIndex) {\n        return g;\n      }\n    }\n  }\n\n  groupLogic(columnGroups: [PblColumnGroup, PblColumnGroup, PblColumnGroup], groupExists: boolean): PblColumnGroup {\n    const [gPrev, gCurr, gNext] = columnGroups;\n\n    // STATE: This column has same group of previous column, nothing to do.\n    if (gCurr === gPrev) {\n      return gCurr;\n    }\n\n    // STATE: The group exists in one of the columns BUT NOT in the LAST COLUMN (i.e: Its a slave split)\n    if (groupExists) {\n      // If the previous sibling group is a slave and this group is the origin of the slave, convert this group to the slave.\n      if (gPrev && gCurr === gPrev.slaveOf) {\n        return gPrev;\n      }\n      if (gNext && gCurr === gNext.slaveOf) {\n        return gNext;\n      }\n      // Otherwise create the slave.\n      const g = gCurr.createSlave([this]);\n      this.groupStore.add(g);\n\n      // If the current group is a placeholder and either the previous OR next sibling group is a placeholder as well\n      // we want to group them together, although they are not related, because they both have identical headers (empty header).\n      // Note that we still create the salve, we just don't use it.\n      if (gCurr.placeholder) {\n        const prevPH = gPrev && gPrev.placeholder;\n        const nextPH = gNext && gNext.slaveOf && gNext.placeholder;\n        const groupWithPlaceholder = prevPH ? gPrev : nextPH ? gNext : undefined;\n        // const groupWithPlaceholder = prevPH && gPrev;\n        if (groupWithPlaceholder) {\n          return groupWithPlaceholder;\n        }\n      }\n\n      return g;\n    } else if (gCurr?.slaveOf) {\n      // STATE: The group IS a slave and it is set AFTER an item that belongs to the group it is slave of.\n      if (gCurr.slaveOf === gPrev) {\n        return gCurr.slaveOf;\n      }\n      if (gCurr.slaveOf === gPrev?.slaveOf) {\n        return gPrev;\n      }\n      // STATE: The group IS a slave and it is set BEFORE an item that belongs to the group it is slave of.\n      if (gCurr.slaveOf === gNext) {\n        return gCurr.slaveOf;\n      }\n    } else {\n      if (gPrev?.placeholder && gCurr?.placeholder) {\n        return gPrev;\n      }\n    }\n    return gCurr;\n  }\n\n  /**\n   * Calculates if the column width is locked by a maximum by checking if the given width is equal to the max width.\n   * If the result of the calculation (true/false) does not equal the previous lock state it will set the new lock state\n   * and return true.\n   * Otherwise return false.\n   * @internal\n   */\n  checkMaxWidthLock(actualWidth: number): boolean {\n    if (actualWidth === this.maxWidth) {\n      if (!this.maxWidthLock) {\n        this.maxWidthLock = true;\n        return true;\n      }\n    } else if (this.maxWidthLock) {\n      this.maxWidthLock = false;\n      return true;\n    }\n    return false;\n  }\n\n}\n","import {\n  PblBaseColumnDefinition,\n  PblColumnDefinition,\n  PblColumnGroupDefinition,\n  PblMetaColumnDefinition,\n  PblNgridColumnDefinitionSet,\n  PblMetaRowDefinitions,\n  deprecatedWarning\n} from '@pebula/ngrid/core';\nimport { PblNgridColumnSet } from './types';\nimport { PblMetaColumn } from './meta-column';\nimport { PblColumn } from './column';\nimport { PblColumnGroup, PblColumnGroupStore } from './group-column';\n\nexport type COLUMN = PblMetaColumn | PblColumn | PblColumnGroup;\n\nexport class PblColumnFactory {\n  private _raw: PblNgridColumnDefinitionSet = { table: { cols: [] }, header: [], footer: [], headerGroup: [] };\n  private _defaults = {\n    table: {} as Partial<PblColumnDefinition>,\n    header: {} as Partial<PblMetaColumnDefinition>,\n    footer: {} as Partial<PblMetaColumnDefinition>,\n  };\n\n  private _currentHeaderRow = 0;\n  private _currentFooterRow = 0;\n\n  get currentHeaderRow(): number { return this._currentHeaderRow; }\n  get currentFooterRow(): number { return this._currentFooterRow; }\n\n  static fromDefinitionSet(defs: PblNgridColumnDefinitionSet): PblColumnFactory {\n    const f = new PblColumnFactory();\n    Object.assign(f._raw, defs);\n    return f;\n  }\n\n  build(): PblNgridColumnSet {\n    const { _defaults, _raw } = this;\n\n    const groupStore = new PblColumnGroupStore();\n\n    const table: PblNgridColumnSet['table'] = {\n      header: _raw.table.header,\n      footer: _raw.table.footer,\n      cols: _raw.table.cols.map( d => new PblColumn({ ..._defaults.table, ...d }, groupStore)),\n    };\n    const header = _raw.header.map( h => ({\n      rowIndex: h.rowIndex,\n      rowClassName: h.rowClassName,\n      type: h.type || 'fixed',\n      cols: h.cols.map( c => new PblMetaColumn( { ..._defaults.header, ...c } )),\n    }));\n    const footer = _raw.footer.map( f => ({\n      rowIndex: f.rowIndex,\n      rowClassName: f.rowClassName,\n      type: f.type || 'fixed',\n      cols: f.cols.map( c => new PblMetaColumn({ ..._defaults.footer, ...c }) )\n    }));\n    const headerGroup = _raw.headerGroup.map( hg => ({\n      rowIndex: hg.rowIndex,\n      rowClassName: hg.rowClassName,\n      type: hg.type || 'fixed',\n      cols: this.buildHeaderGroups(hg.rowIndex, hg.cols, table.cols).map( g => {\n        groupStore.add(g);\n        return g;\n      }),\n    }));\n\n    return {\n      groupStore,\n      table,\n      header,\n      footer,\n      headerGroup,\n    };\n  }\n\n  /**\n   * Set the default column definition for header/footer columns.\n   */\n  default(def: Partial<PblMetaColumnDefinition>, type: 'header' | 'footer'): this;\n  /**\n   * Set the default column definition for table columns.\n   */\n  default(def: Partial<PblColumnDefinition>, type?: 'table'): this;\n  default(def: Partial<PblColumnDefinition> | Partial<PblMetaColumnDefinition>, type: 'table' | 'header' | 'footer' = 'table'): this {\n    this._defaults[type] = def;\n    return this;\n  }\n\n  /**\n   * Add grid columns.\n   *\n   * Table columns are mandatory, they are the columns that define the structure of the data source.\n   *\n   * Each column will usually point to property on the row, although you can create columns that does not\n   * exist on the row and handle their rendering with a cell template.\n   *\n   * Each grid column is also a header column and a footer column that display.\n   * The header and footer are automatically created, If you wish not to show them set headerRow/footerRow to false in PblTable.\n   *\n   */\n  table(rowOptions: { header?: PblMetaRowDefinitions; footer?: PblMetaRowDefinitions }, ...defs: PblColumnDefinition[]): this;\n  table(...defs: PblColumnDefinition[]): this;\n  table(...defs: Array<{ header?: PblMetaRowDefinitions; footer?: PblMetaRowDefinitions } | PblColumnDefinition>): this {\n    const rowOptions: { header?: PblMetaRowDefinitions; footer?: PblMetaRowDefinitions } = (defs[0] as any).prop ? {} : defs.shift() as any;\n    const { header, footer } = rowOptions;\n    Object.assign(this._raw.table, { header, footer });\n    this._raw.table.cols.push(...defs as PblColumnDefinition[]);\n    return this;\n  }\n\n  /**\n   * Add a new header row with header columns.\n   * Creates an additional header row in position `currentHeaderRow` using the provided header column definitions.\n   * Each definition represent a cell, the cell's does not have to align with the layout of grid columns.\n   *\n   * All header row will position BEFORE the grid column header row.\n   * Header columns are optional.\n   * Each call to `header()` will create a new row, incrementing the `currentHeaderRow`.\n   *\n   * @remarks\n   * Example:\n   * ```js\n   *   factory.table(1, 2, 3)\n   *     .header(a, b, c).header(d, e, f);\n   * ```\n   *\n   * will result in:\n   *   header1 -\\>  a b c\n   *   header2 -\\>  d e f\n   *   table   -\\>  1 2 3\n   */\n  header(rowOptions: PblMetaRowDefinitions, ...defs: Array<Pick<PblMetaColumnDefinition, 'id'> & Partial<PblMetaColumnDefinition> & PblBaseColumnDefinition>): this;\n  header(...defs: Array<Pick<PblMetaColumnDefinition, 'id'> & Partial<PblMetaColumnDefinition> & PblBaseColumnDefinition>): this;\n  header(...defs: Array<PblMetaRowDefinitions | Pick<PblMetaColumnDefinition, 'id'> & Partial<PblMetaColumnDefinition> & PblBaseColumnDefinition>): this {\n    const rowIndex = this._currentHeaderRow++;\n    const rowOptions = this.processRowOptions(defs);\n    const rowClassName = this.genRowClass(rowOptions, rowIndex);\n\n    const headers = defs.map( (d: Pick<PblMetaColumnDefinition, 'id'> & Partial<PblMetaColumnDefinition> & PblBaseColumnDefinition) => {\n      const def: PblMetaColumnDefinition = {\n        id: d.id,\n        kind: 'header',\n        rowIndex\n      };\n      return Object.assign(def, d);\n    });\n\n    this._raw.header.push({\n      rowIndex,\n      rowClassName,\n      cols: headers,\n      type: (rowOptions && rowOptions.type) || 'fixed',\n    });\n    return this;\n  }\n\n  /**\n   * Add a new footer row with footer columns.\n   * Creates an additional footer row in position `currentFooterRow` using the provided footer column definitions.\n   * Each definition represent a cell, the cell's does not have to align with the layout of grid columns.\n   *\n   * All footer row will position AFTER the grid column footer row.\n   * Footer columns are optional.\n   * Each call to `footer()` will create a new row, incrementing the `currentFooterRow`.\n   *\n   * @remarks\n   * Example:\n   * ```js\n   *   factory.table(1, 2, 3)\n   *     .footer(a, b, c).footer(d, e, f);\n   * ```\n   *\n   * will result in:\n   *   table   -\\>  1 2 3\n   *   footer1 -\\>  a b c\n   *   footer2 -\\>  d e f\n   */\n  footer(rowOptions: PblMetaRowDefinitions, ...defs: Array<Pick<PblMetaColumnDefinition, 'id'> & Partial<PblMetaColumnDefinition> & PblBaseColumnDefinition>): this;\n  footer(...defs: Array<Pick<PblMetaColumnDefinition, 'id'> & Partial<PblMetaColumnDefinition> & PblBaseColumnDefinition>): this;\n  footer(...defs: Array<PblMetaRowDefinitions | Pick<PblMetaColumnDefinition, 'id'> & Partial<PblMetaColumnDefinition> & PblBaseColumnDefinition>): this {\n    const rowIndex = this._currentFooterRow++;\n    const rowOptions = this.processRowOptions(defs);\n    const rowClassName = this.genRowClass(rowOptions, rowIndex);\n\n    const footers = defs.map( (d: Pick<PblMetaColumnDefinition, 'id'> & Partial<PblMetaColumnDefinition> & PblBaseColumnDefinition) => {\n      const def: PblMetaColumnDefinition = {\n        id: d.id,\n        kind: 'footer',\n        rowIndex\n      };\n      return Object.assign(def, d);\n    });\n\n    this._raw.footer.push({\n      rowIndex,\n      rowClassName,\n      cols: footers,\n      type: (rowOptions && rowOptions.type) || 'fixed',\n    });\n    return this;\n  }\n\n  /**\n   * Add a new header row with header group columns.\n   * A header group column is a columns is a header columns that spans one or more columns.\n   *\n   * Create an additional header row in position `currentHeaderRow` using the provided header column definitions.\n   * Each definition represent a cell, the cell's does not have to align with the layout of grid columns.\n   *\n   * All header row will position BEFORE the grid column header row.\n   * Header columns are optional.\n   * Each call to `header()` will create a new row, incrementing the `currentHeaderRow`.\n   *\n   * @remarks\n   * Example:\n   * ```js\n   *   factory.table(1, 2, 3)\n   *     .header(a, b, c).header(d, e, f);\n   * ```\n   *\n   * will result in:\n   *   header1 -\\>  a b c\n   *   header2 -\\>  d e f\n   *   table   -\\>  1 2 3\n   */\n  headerGroup(rowOptions: PblMetaRowDefinitions, ...defs: Array<Partial<Omit<PblColumnGroupDefinition, 'rowIndex' | 'kind'>>>): this;\n  headerGroup(...defs: Array<Partial<Omit<PblColumnGroupDefinition, 'rowIndex' | 'kind'>>>): this;\n  headerGroup(...defs: Array<PblMetaRowDefinitions | ( Partial<Omit<PblColumnGroupDefinition, 'rowIndex' | 'kind'>> ) >): this {\n    const rowIndex = this._currentHeaderRow++;\n    const rowOptions = this.processRowOptions(defs, 'columnIds', 'prop');\n    const rowClassName = this.genRowClass(rowOptions, rowIndex);\n\n    const headerGroups: any = defs.map( d => Object.assign({ rowIndex }, d) );\n\n    this._raw.headerGroup.push({\n      rowIndex,\n      rowClassName,\n      cols: headerGroups,\n      type: (rowOptions && rowOptions.type) || 'fixed',\n    });\n\n    return this;\n  }\n\n  private processRowOptions(defs: any[], ...mustHaveProperty: string[]): PblMetaRowDefinitions {\n    if (mustHaveProperty.length === 0) {\n      mustHaveProperty = ['id'];\n    }\n    for (const prop of mustHaveProperty) {\n      if (prop in defs[0]) {\n        return;\n      }\n    }\n    return defs.shift();\n  }\n\n  private genRowClass(rowOptions: { rowClassName?: string }, fallbackRowIndex: number): string {\n    return (rowOptions && rowOptions.rowClassName) || `pbl-ngrid-row-index-${fallbackRowIndex.toString()}`;\n  }\n\n  private buildHeaderGroups(rowIndex: number, headerGroupDefs: PblColumnGroupDefinition[], table: PblColumn[]): PblColumnGroup[] {\n    const headerGroup: PblColumnGroup[] = [];\n\n    // Building of header group rows requires some work.\n    // The user defined groups might not cover all columns, creating gaps between group columns so we need to add placeholder groups to cover these gaps.\n    // Moreover, the user might not specify a `prop`, which we might need to complete.\n    // We do that for each header group row.\n    //\n    // The end goal is to return a list of `PblColumnGroup` that span over the entire columns of the grid.\n    //\n    // The logic is as follows:\n    // For each column in the grid, find a matching column group - a group pointing at the column by having the same `prop`\n    // If found, check it's span and skip X amount of columns where X is the span.\n    // If a span is not defined then treat it as a greedy group that spans over all columns ahead until the next column that has a matching group column.\n    //\n    // If a column does not have a matching group column, search for group columns without a `prop` specified and when found set their `prop` to the current\n    // column so we will now use them as if it's a user provided group for this column...\n    //\n    // If no group columns exists (or left), we create an ad-hoc group column and we will now use them as if it's a user provided group for this column...\n    //\n    const tableDefs = table.slice();\n    const defs = headerGroupDefs.slice();\n\n    for (const d of defs) {\n      // TODO: remove in V5, when prop & span are deprecated\n      // @deprecated Will be removed in v5\n      if (d.prop) {\n        if (typeof ngDevMode === 'undefined' || ngDevMode) {\n          deprecatedWarning('PblColumnGroupDefinition.prop', '4', 'PblColumnGroupDefinition.columnIds');\n          deprecatedWarning('PblColumnGroupDefinition.span', '4', 'PblColumnGroupDefinition.columnIds');\n        }\n        const start = tableDefs.findIndex( c => c.orgProp === d.prop );\n        d.columnIds = tableDefs.slice(start, start + d.span + 1).map( c => c.id );\n        delete d.prop;\n        delete d.span;\n      }\n      d.rowIndex = rowIndex;\n      const group = new PblColumnGroup(d, tableDefs.filter( c => d.columnIds.indexOf(c.orgProp) > -1 ), false);\n      headerGroup.push(group);\n    }\n\n    let marker = 0;\n    while (tableDefs.length) {\n      const column = tableDefs.shift();\n      const orgProp = column.orgProp;\n      const existingGroupIndex = headerGroup.findIndex( hg => hg.columnIds.indexOf(orgProp) > -1 );\n      if (existingGroupIndex > -1) {\n        const hg = headerGroup[existingGroupIndex];\n        if (existingGroupIndex < marker) {\n          const columns = [column];\n          while (hg.columnIds.indexOf(tableDefs[0]?.orgProp) > -1) {\n            columns.push(tableDefs.shift());\n          }\n          headerGroup[marker] = hg.createSlave(columns);\n          marker += 1;\n        } else {\n          while (hg.columnIds.indexOf(tableDefs[0]?.orgProp) > -1) {\n            tableDefs.shift();\n          }\n          marker += 1;\n        }\n      } else {\n        const prev = headerGroup[marker - 1];\n        if (prev?.placeholder) {\n          const clone = Object.keys(prev).reduce( (p, c) => {\n            p[c] = prev[c];\n            return p;\n          }, {} as PblColumnGroupDefinition);\n          clone.columnIds = [...clone.columnIds, orgProp];\n          delete clone.id;\n          headerGroup[marker - 1] = new PblColumnGroup(clone, [...prev.columns, column], true);\n        } else {\n          const d: PblColumnGroupDefinition = { rowIndex, kind: 'header', columnIds: [orgProp]};\n          headerGroup.splice(marker, 0, new PblColumnGroup(d, [column], true))\n          marker += 1;\n        }\n      }\n    }\n    return headerGroup;\n  }\n}\n\nexport function columnFactory(): PblColumnFactory {\n  return new PblColumnFactory()\n}\n","import { PblColumnSizeInfo } from './types';\nimport { PblColumn } from './column';\n\n/**\n * A class that represents the dimensions and style of a column cell.\n * The class is bound to an element and a column.\n *\n * Calling `updateSize()` will sync the layout from the DOM element to the class properties\n * and trigger a resize event on the column's column definition object.\n *\n * > Note that `updateSize()` only works when a column is attached\n *\n * This class shouldn't be used directly. In NGrid, it is wrapped by `PblColumnSizeObserver` which automatically triggers\n * update size events using the `ResizeObserver` API.\n */\nexport class ColumnSizeInfo implements PblColumnSizeInfo {\n  get column(): PblColumn { return this._column; }\n  set column(value: PblColumn) { this.attachColumn(value); }\n\n  /**\n   * The height of the column (subpixel resolution)\n   */\n  height: number;\n  /**\n   * The width of the column (subpixel resolution)\n   * Note that this is the not the content width.\n   */\n  width: number;\n\n  /**\n   * The computed style for this cell.\n   */\n  style: CSSStyleDeclaration;\n\n  protected _column: PblColumn;\n\n  constructor(public readonly target: HTMLElement) { }\n\n  protected attachColumn(column: PblColumn): void {\n    this.detachColumn();\n\n    if (column) {\n      column.sizeInfo = this;\n    }\n\n    this._column = column;\n  }\n\n  protected detachColumn(): void {\n    if (this._column) {\n      this._column.sizeInfo = undefined;\n      this._column = undefined;\n    }\n  }\n\n  updateSize(): void {\n    if (this.column && !this.column.columnDef.isDragging) {\n      const el = this.target;\n      const rect = el.getBoundingClientRect();\n      this.width = rect.width;\n      this.height = rect.height;\n      this.style = getComputedStyle(el);\n      this.column.columnDef.onResize();\n    }\n  }\n}\n","import { Direction } from '@angular/cdk/bidi';\nimport { PblColumnSizeInfo } from '../../column/model/types'\n\nexport interface BoxModelSpaceStrategy {\n  cell(col: PblColumnSizeInfo): number;\n  groupCell(col: PblColumnSizeInfo): number;\n  group(cols: PblColumnSizeInfo[], dir?: Direction): number;\n}\n\n/**\n * A column width calculator that calculates column width for a specific column or a group of columns.\n * It also provide the minimum required row width for the total columns added up to that point.\n *\n * The `DynamicColumnWidthLogic` takes into account real-time DOM measurements (especially box-model metadata), hence \"dynamic\".\n * It performs the calculation based on `PblColumn` and actual DOM size metadata.\n *\n * The `DynamicColumnWidthLogic` has 3 responsibilities:\n *\n * - It is responsible for enforcing the `maxWidth` boundary constraint for every column it processes by calculating the actual width\n * of a column and calling `PblColumn.checkMaxWidthLock` to verify if max width lock has changed due to the new actual width.\n *\n * - It calculates the absolute width for a group of columns, so `PblCdkVirtualScrollViewportComponentGroupColumn` can have an exact size that wraps it's children.\n *\n * - It calculates the `minimumRowWidth`, which represents the minimum width required width of the row, i.e. table.\n *\n * > Note that an instance of `DynamicColumnWidthLogic` represents a one-time pass for all columns, for every run a new instance is required.\n */\nexport class DynamicColumnWidthLogic {\n  /**\n   * When true, it indicates that one (or more) columns has changed the max width lock state.\n   * @readonly\n   */\n  maxWidthLockChanged: boolean;\n\n  get minimumRowWidth(): number { return this._minimumRowWidth; };\n\n  private readonly cols = new Map<PblColumnSizeInfo, number>();\n  private _minimumRowWidth = 0;\n\n  constructor(public readonly strategy: BoxModelSpaceStrategy, public dir?: Direction) { }\n\n  reset() {\n    this.maxWidthLockChanged = false;\n    this._minimumRowWidth = 0;\n    this.cols.clear();\n  }\n\n  /**\n   * Returns a breakout of the width of the column, breaking it into the width of the content and the rest of the width\n   */\n  widthBreakout(columnInfo: PblColumnSizeInfo): { content: number, nonContent: number } {\n    return widthBreakout(this.strategy, columnInfo);\n  }\n\n  /**\n   * Add a column to the calculation.\n   *\n   * The operation will update the minimum required width and trigger a `checkMaxWidthLock` on the column.\n   * If the max width lock has changed the `maxWidthLockChanged` is set to true.\n   *\n   * A column that was previously added is ignored.\n   *\n   * Note that once `maxWidthLockChanged` is set to true it will never change.\n   */\n  addColumn(columnInfo: PblColumnSizeInfo): void {\n    if (!this.cols.has(columnInfo)) {\n      const { column } = columnInfo;\n      let minWidth = column.minWidth || 0;\n      if (column.isFixedWidth) {\n        minWidth = Math.max(column.parsedWidth.value, minWidth);\n      }\n      const nonContent = this.strategy.cell(columnInfo);\n      const width = minWidth + nonContent;\n      this.cols.set(columnInfo, width);\n      this._minimumRowWidth += width;\n\n      if (column.maxWidth) {\n        const actualWidth = columnInfo.width - nonContent;\n        if (column.checkMaxWidthLock(actualWidth)) {\n          this.maxWidthLockChanged = true;\n        }\n      }\n    }\n  }\n\n  /**\n   * Run each of the columns through `addColumn` and returns the sum of the width all columns using\n   * the box model space strategy.\n   *\n   * The result represents the absolute width to be used in a `PblColumnGroup`.\n   *\n   * > Note that when a table has multiple column-group rows each column is the child of multiple group column, hence calling `addColumn` with the\n   * same group more then once. However, since `addColumn()` ignores columns it already processed it is safe.\n   */\n  addGroup(columnInfos: PblColumnSizeInfo[]): number {\n    let sum = 0;\n    for (const c of columnInfos) {\n      this.addColumn(c);\n      sum += c.width;\n    }\n   sum -= this.strategy.group(columnInfos, this.dir);\n   return sum;\n  }\n\n}\n\n/**\n* Returns a breakout of the width of the column, breaking it into the width of the content and the rest of the width\n*/\nexport function widthBreakout(strategy: BoxModelSpaceStrategy, columnInfo: PblColumnSizeInfo): { content: number, nonContent: number } {\n const nonContent = strategy.cell(columnInfo);\n return {\n   content: columnInfo.width - nonContent,\n   nonContent,\n };\n}\n\nexport const DYNAMIC_PADDING_BOX_MODEL_SPACE_STRATEGY: BoxModelSpaceStrategy = {\n  cell(col: PblColumnSizeInfo): number {\n    const style = col.style;\n    return parseInt(style.paddingLeft, 10) + parseInt(style.paddingRight, 10)\n  },\n  groupCell(col: PblColumnSizeInfo): number {\n    return 0;\n  },\n  group(cols: PblColumnSizeInfo[], dir?: Direction): number {\n    const len = cols.length;\n    return len > 0 ? parseInt(cols[0].style[dir === 'rtl' ? 'paddingRight' : 'paddingLeft'], 10) + parseInt(cols[len - 1].style[dir === 'rtl' ? 'paddingLeft' : 'paddingRight'], 10) : 0;\n  }\n};\n","// tslint:disable:use-host-property-decorator\n// tslint:disable:directive-class-suffix\nimport {\n  Directive,\n  Input,\n  Inject,\n  OnDestroy,\n  Output,\n  EventEmitter,\n} from '@angular/core';\nimport { CdkColumnDef } from '@angular/cdk/table';\n\nimport { _PblNgridComponent } from '../../../tokens';\nimport { uniqueColumnCss } from '../../utils/unique-column-css';\nimport { EXT_API_TOKEN, PblNgridInternalExtensionApi } from '../../../ext/grid-ext-api';\nimport { COLUMN, PblColumnSizeInfo, isPblColumn } from '../model';\nimport { widthBreakout } from '../width-logic/dynamic-column-width';\n\nexport type UpdateWidthReason = 'attach' | 'update' | 'resize';\n\nexport type WidthSet = [string, string, string];\n\nexport interface WidthChangeEvent {\n  reason: UpdateWidthReason;\n}\n\n/**\n * Represents a runtime column definition for a user-defined column definitions.\n *\n * User defined column definitions are `PblColumn`, `PblMetaColumn`, `PblColumnGroup` etc...\n * They represent static column definitions and `PblNgridColumnDef` is the runtime instance of them.\n *\n */\n@Directive({\n  selector: '[pblNgridColumnDef]',\n  providers: [\n    { provide: CdkColumnDef, useExisting: PblNgridColumnDef },\n    { provide: 'MAT_SORT_HEADER_COLUMN_DEF', useExisting: PblNgridColumnDef }\n  ],\n})\nexport class PblNgridColumnDef<T extends COLUMN = COLUMN> extends CdkColumnDef implements OnDestroy {\n  @Input('pblNgridColumnDef') get column(): T { return this._column; };\n  set column(value: T) { this.attach(value); }\n\n  /**\n   * The absolute width definitions, as currently set in the DOM (getBoundingClientRect()).\n   * If no measurements exists yet, return the user defined width's.\n   *\n   * The tuple represents them in that order, i.e: [ MIN-WIDTH, WIDTH, MAX-WIDTH ]\n   */\n  get widths(): WidthSet { return this._widths[1]; }\n\n  /**\n   * The last net width of the column.\n   * The net width is the absolute width of the column, without padding, border etc...\n   */\n  get netWidth(): number { return this._netWidth; }\n\n  isDragging = false;\n\n  readonly grid: _PblNgridComponent<any>;\n\n  /**\n   * An event emitted when width of this column has changed.\n   */\n  @Output('pblNgridColumnDefWidthChange') widthChange = new EventEmitter<WidthChangeEvent>();\n\n  private _column: T;\n\n  /**\n   * The complete width definition for the column.\n   *\n   * There are 2 width sets (tuple):\n   * - [0]: The source width definitions as set in static column definition instance\n   * - [1]: The absolute width definitions, as currently set in the DOM (getBoundingClientRect())\n   *\n   * Each set is made up of 3 primitive width definitions: MIN-WIDTH, WIDTH and MAX-WIDTH.\n   * The tuple represents them in that order, i.e: [ MIN-WIDTH, WIDTH, MAX-WIDTH ]\n   */\n  private _widths: [WidthSet?, WidthSet?] = [];\n\n  /**\n   * The last net width of the column.\n   * The net width is the absolute width of the column, without padding, border etc...\n   */\n  private _netWidth: number;\n\n  private widthBreakout: (columnInfo: PblColumnSizeInfo) => ReturnType<typeof widthBreakout>;\n\n  constructor(@Inject(EXT_API_TOKEN) protected extApi: PblNgridInternalExtensionApi<any>) {\n    super();\n    this.grid = extApi.grid;\n\n    const { strategy } = extApi.widthCalc.dynamicColumnWidth;\n    this.widthBreakout = c => widthBreakout(strategy, c);\n  }\n\n  /**\n   * Update the \"widths\" for this column and when width has changed.\n   *\n   * The \"widths\" are the 3 values representing a width of a cell: [minWidth, width, maxWidth],\n   * this method is given the width and will calculate the minWidth and maxWidth based on the column definitions.\n   *\n   * If at least one value of \"widths\" has changed, fires the `widthChange` event with the `reason` provided.\n   *\n   * The reason can be used to optionally update the relevant cells, based on the source (reason) of the update.\n   * - attach: This runtime column definition instance was attached to a static column definition instance.\n   * - update: The width value was updated in the static column definition instance , which triggered a width update to the runtime column definition instance\n   * - resize: A resize event to the header PblColumn cell was triggered, the width of the static column definition is not updated, only the runtime value is.\n   *\n   * Note that this updates the width of the column-def instance, not the column definitions width itself.\n   * Only when `reason === 'update'` it means that the column definition was updated and triggered this update\n   *\n   * @param width The new width\n   * @param reason The reason for this change\n   */\n  updateWidth(width: string, reason: UpdateWidthReason): void {\n    const { isFixedWidth, parsedWidth } = this._column;\n\n    /*  Setting the minimum width is based on the input.\n        If the original width is pixel fixed we will take the maximum between it and the min width.\n        If not, we will the take minWidth.\n        If none of the above worked we will try to see if the current width is set with %, if so it will be our min width.\n    */\n    const minWidthPx = isFixedWidth\n      ? Math.max(this._column.parsedWidth.value, this._column.minWidth || 0)\n      : this._column.minWidth\n    ;\n\n    let minWidth = minWidthPx && `${minWidthPx}px`;\n    if (!minWidth && parsedWidth?.type === '%') {\n      minWidth = width;\n    }\n\n    const maxWidth = isFixedWidth\n      ? Math.min(this._column.parsedWidth.value, this._column.maxWidth || this._column.parsedWidth.value)\n      : this._column.maxWidth\n    ;\n\n    const newWidths = [minWidth || '',  width, maxWidth ? `${maxWidth}px` : width] as WidthSet;\n    if (reason === 'resize') {\n      this._widths[1] = newWidths;\n      this.widthChange.emit({ reason });\n    } else {\n      const prev = this._widths[0] || [];\n      this._widths[0] = newWidths;\n      if (!this._widths[1]) {\n        this._widths[1] = newWidths;\n      }\n      for (let i = 0; i < 3; i++) {\n        if (prev[i] !== newWidths[i]) {\n          this.widthChange.emit({ reason });\n          break;\n        }\n      }\n    }\n  }\n\n  /**\n   * Apply the current absolute width definitions (minWidth, width, maxWidth) onto an element.\n   */\n  applyWidth(element: HTMLElement): void { setWidth(element, this.widths); }\n\n  /**\n   * Apply the source width definitions )set in static column definition instance) onto an element.\n   */\n  applySourceWidth(element: HTMLElement): void { setWidth(element, this._widths[0]); }\n\n  /**\n   * Query for cell elements related to this column definition.\n   *\n   * This query is not cached - cache in implementation.\n   */\n  queryCellElements(...filter: Array<'table' | 'header' | 'headerGroup' | 'footer' | 'footerGroup'>): HTMLElement[] {\n    const cssId = `.${uniqueColumnCss(this)}`;\n\n    const query: string[] = [];\n\n    if (filter.length === 0) {\n      query.push(cssId);\n    } else {\n      for (const f of filter) {\n        switch (f) {\n          case 'table':\n           query.push(`.pbl-ngrid-cell${cssId}`);\n           break;\n          case 'header':\n           query.push(`.pbl-ngrid-header-cell${cssId}:not(.pbl-header-group-cell)`);\n           break;\n          case 'headerGroup':\n           query.push(`.pbl-header-group-cell${cssId}`);\n           break;\n          case 'footer':\n           query.push(`.pbl-ngrid-footer-cell${cssId}:not(.pbl-footer-group-cell)`);\n           break;\n          case 'footerGroup':\n           query.push(`.pbl-footer-group-cell${cssId}`);\n           break;\n        }\n      }\n    }\n    // we query from the master table container and not CDKTable because of fixed meta rows\n    return query.length === 0 ? [] : Array.from(this.extApi.element.querySelectorAll(query.join(', '))) as any;\n  }\n\n  /** @internal */\n  ngOnDestroy(): void {\n    this.detach();\n    this.widthChange.complete();\n  }\n\n  onResize(): void {\n    if (isPblColumn(this.column)) {\n      const prevNetWidth = this._netWidth;\n      this._netWidth = this.widthBreakout(this.column.sizeInfo).content;\n\n      if (prevNetWidth !== this._netWidth) {\n        const width = `${this._netWidth}px`;\n        this.updateWidth(width, 'resize');\n      }\n    }\n  }\n\n  updatePin(pin?: 'start' | 'end'): void {\n    this.sticky = this.stickyEnd = false;\n    switch(pin) {\n      case 'start':\n        this.sticky = true;\n        break;\n      case 'end':\n        this.stickyEnd = true;\n        break;\n    }\n    if (this.grid.isInit) {\n      this.extApi.cdkTable.updateStickyColumnStyles();\n    }\n  }\n\n  private attach(column: T): void {\n    if (this._column !== column) {\n      this.detach();\n      if (column) {\n        this._column = column;\n        (column as any).attach(this);\n        this.name = column.id.replace(/ /g, '_');\n        if (isPblColumn(column)) {\n          this.updatePin(column.pin);\n        }\n      }\n    }\n  }\n\n  private detach(): void {\n    if (this._column) {\n      const col = this._column;\n      this._column = undefined;\n      col.detach();\n    }\n  }\n}\n\n/**\n * Set the widths of an HTMLElement\n * @param el The element to set widths to\n * @param widths The widths, a tuple of 3 strings [ MIN-WIDTH, WIDTH, MAX-WIDTH ]\n */\nfunction setWidth(el: HTMLElement, widths: WidthSet) {\n  el.style.minWidth = widths[0];\n  el.style.width = widths[1];\n  el.style.maxWidth = widths[2];\n\n  // TODO(shlomiassaf)[perf, 4]: Instead of using a tuple for width, use a CSSStyleDeclaration object and just assign the props\n  // This will avoid the additional check for %\n  // We will need to implement it in all places that `_widths` is updated in `PblNgridColumnDef`\n  // Another TODO is to cache the previous `boxSizing` in any case the column definition changes.\n\n  // When the column does not have an explicit `minWidth` set and when the `width` is set explicitly to a % value\n  // the logic in `PblNgridColumnDef.updateWidth` will set `minWidth` to the same value in `width`\n  // This will cause an overflow unless we apply the border-box model\n  if (widths[0] && widths[0].endsWith('%')) {\n    el.style.boxSizing = 'border-box';\n  } else {\n    el.style.boxSizing = 'content-box';\n  }\n}\n","import { PblNgridRegistryService } from '../../registry/registry.service';\nimport { PblColumn, PblMetaColumn, COLUMN, isPblColumn } from '../../column/model';\nimport { PblNgridHeaderCellDefDirective } from './header-cell-def.directive';\nimport { PblNgridCellDefDirective } from './cell-def.directive';\nimport { PblNgridFooterCellDefDirective } from './footer-cell-def.directive';\nimport { PblNgridCellDefDirectiveBase } from './types';\n\nexport function findCellDefById<T extends PblNgridCellDefDirectiveBase>(cellDefs: Array<T>, colDef: Pick<PblMetaColumn, 'id' | 'type'>, searchParent?: boolean): T {\n  for (const cellDef of cellDefs) {\n    if (cellDef.type) {\n      if (colDef.type && cellDef.type === colDef.type.name) {\n        return cellDef;\n      }\n    } else {\n      const id = cellDef.name;\n      if (id === colDef.id) {\n        return cellDef;\n      }\n    }\n  }\n}\n\nexport function findCellDef<T = any>(registry: PblNgridRegistryService, colDef: PblColumn, kind: 'tableCell' | 'editorCell',  searchParent?: boolean): PblNgridCellDefDirective<T>;\nexport function findCellDef<T = any>(registry: PblNgridRegistryService, colDef: PblMetaColumn | PblColumn, kind: 'headerCell', searchParent?: boolean): PblNgridHeaderCellDefDirective<T>;\nexport function findCellDef<T = any>(registry: PblNgridRegistryService, colDef: PblMetaColumn | PblColumn, kind: 'footerCell', searchParent?: boolean): PblNgridFooterCellDefDirective<T>;\nexport function findCellDef<T = any>(registry: PblNgridRegistryService, colDef: COLUMN, kind: 'headerCell' | 'footerCell' | 'tableCell' | 'editorCell', searchParent?: boolean): PblNgridCellDefDirective<T> | PblNgridHeaderCellDefDirective<T> | PblNgridFooterCellDefDirective <T> {\n  const cellDefs: PblNgridCellDefDirectiveBase[] = registry.getMulti(kind);\n\n  if (cellDefs) {\n    let type: Pick<PblMetaColumn, 'id' | 'type'>;\n    if (isPblColumn(colDef)) {\n      switch (kind) {\n        case 'headerCell':\n          if (colDef.headerType) {\n            type = { id: colDef.id, type: colDef.headerType };\n          }\n          break;\n        case 'footerCell':\n          if (colDef.footerType) {\n            type = { id: colDef.id, type: colDef.footerType };\n          }\n          break;\n      }\n    }\n    if (!type) {\n      type = colDef;\n    }\n    const match: any = findCellDefById(cellDefs, type);\n    if (match) {\n      return match;\n    }\n  }\n\n  if (searchParent && registry.parent) {\n    return findCellDef(registry.parent, colDef as any, kind as any, searchParent);\n  }\n}\n\n","import { PblColumn } from '../../column/model';\n\n/**\n * A column width object representing the relative column using a combination of percentage and pixels.\n *\n * The percentage represent the total width of the column\n * The pixels represent the total fixed width, in pixels, that other columns occupy (these are columns with absolute width set).\n *\n * In a DOM element, the `ColumnWidth` object is represented via the `width` style property\n * and the value is set using the `calc()` CSS function: `width: calc({pct}% - {px}px);`.\n *\n * For example, the `ColumnWidth` object  `{ pct: 33, px: 25 }` is translated to `width: calc(33% - 25px);`\n *\n * @internal\n */\nexport interface ColumnWidth {\n  pct: number;\n  px: number;\n}\n\n/**\n * A column width calculator that, based on all of the columns, calculates the default column width\n * and minimum required row width.\n *\n * The default column width is the width for all columns that does not have a width setting defined.\n * In addition, a `minimumRowWidth` is calculated, which represents the minimum width required width of the row, i.e. table.\n *\n * The `StaticColumnWidthLogic` does not take into account real-time DOM measurements (especially box-model metadata), hence \"static\".\n * It performs the calculation based on \"dry\" `PblColumn` metadata input from the user.\n *\n * The `StaticColumnWidthLogic` is less accurate and best used as a measurement baseline followed by a more accurate calculation.\n * This is why it outputs a default column width and not a column specific width.\n */\nexport class StaticColumnWidthLogic {\n  private _agg = {\n    pct: 0,          // total agg fixed %\n    px: 0,           // total agg fixed px\n    minRowWidth: 0,  // total agg of min width\n    pctCount: 0,     // total columns with fixed %\n    pxCount: 0,      // total columns with fixed px\n    count: 0         // total columns without a fixed value\n  }\n\n  get minimumRowWidth(): number { return this._agg.minRowWidth; }\n\n  /**\n   * Returns the calculated default width for a column.\n   * This is the width for columns that does not have a specific width, adjusting them to fit the table.\n   * It's important to run this method AFTER aggregating all columns through `addColumn()`.\n   * The result contains 2 values, pct and px.\n   * pct is the total width in percent that the column should spread taking into account columns with fixed % width.\n   * px is the total width in pixels that the column should shrink taking into account columns with fixed pixel width.\n   *\n   * The algorithm is simple:\n   *  1) Sum all columns with fixed percent width\n   *  2) From the entire row width (100%) deduct the total fixed width (step 1).\n   *     This result represents the % left for all columns without a fixed width (percent and pixel).\n   *  3) Sum all columns with fixed pixel width.\n   *     The result represent the total amount of width in pixel taken by columns with fixed width.\n   *  4) Count all the columns without a fixed width.\n   *\n   *  For 2 & 3 we get values that we need to spread even between all of the columns without fixed width (percent and pixel).\n   *  The exact width is the total percent left (2) minus the total width in pixel taken by columns with fixed with.\n   *  We now need to divide the result from 2 & 3 by the result from 4.\n   *\n   * Both values should be used together on the `width` style property using the `calc` function:\n   * e.g.: `calc(${pct}% - ${px}px)`\n   *\n   * This value is calculated every time it is called, use it once all columns are added.\n   */\n  get defaultColumnWidth(): ColumnWidth {\n    const agg = this._agg;\n    const pct = (100 - agg.pct) / agg.count;\n    const px = agg.px / agg.count;\n    return { pct, px };\n  }\n\n  addColumn(column: PblColumn): void {\n    const agg = this._agg;\n    const width = column.parsedWidth;\n\n    let minWidth = column.minWidth || 0;\n\n    if (width) {\n      switch (width.type) {\n        case '%':\n          agg.pctCount += 1;\n          agg.pct += width.value;\n          break;\n        case 'px':\n          agg.pxCount += 1;\n          agg.px += width.value;\n          minWidth = width.value;\n          break;\n        default:\n          if (typeof ngDevMode === 'undefined' || ngDevMode) {\n            throw new Error(`Invalid width \"${column.width}\" in column ${column.prop}. Valid values are ##% or ##px (50% / 50px)`);\n          }\n          return;\n          \n      }\n    } else if (column.maxWidthLock) {\n      agg.pxCount += 1;\n      agg.px += column.maxWidth;\n    } else {\n      agg.count += 1;\n    }\n    agg.minRowWidth += minWidth;\n  }\n\n}\n","import { PblColumn } from '../column/model';\nimport { PblMetaColumnStore } from '../column/management';\nimport { StaticColumnWidthLogic } from '../column/width-logic/static-column-width';\n\n/**\n * Updates the column sizes of the columns provided based on the column definition metadata for each column.\n * The final width represent a static width, it is the value as set in the definition (except column without width, where the calculated global width is set).\n */\nexport function resetColumnWidths(rowWidth: StaticColumnWidthLogic,\n                                  tableColumns: PblColumn[],\n                                  metaColumns: PblMetaColumnStore[]): void {\n  const { pct, px } = rowWidth.defaultColumnWidth;\n  const defaultWidth = `calc(${pct}% - ${px}px)`;\n\n  for (const c of tableColumns) {\n    c.setDefaultWidth(defaultWidth);\n    c.updateWidth();\n  }\n\n  for (const m of metaColumns) {\n    for (const c of [m.header, m.footer]) {\n      if (c) {\n        c.updateWidth('');\n      }\n    }\n    // We don't handle groups because they are handled by `PblNgridComponent.resizeRows()`\n    // which set the width for each.\n  }\n}\n","import { PblColumn } from '../model';\n\nexport class HiddenColumns {\n  readonly hidden = new Set<string>();\n  readonly allHidden = new Set<string>();\n  private readonly indirect = new Map<string, Set<string>>();\n\n  constructor() {\n    this.clear(false);\n  }\n\n  add(columns: PblColumn[] | string[], indirect?: string) {\n    let collection: Set<string>;\n    if (indirect) {\n      collection = this.indirect.get(indirect);\n      if (!collection) {\n        this.indirect.set(indirect, collection = new Set<string>());\n      }\n    } else {\n      collection = this.hidden;\n    }\n    const size = collection.size;\n    if (columns[0] instanceof PblColumn) {\n      for(const c of columns as PblColumn[]) {\n        collection.add(c.id);\n      }\n    } else {\n      for(const c of columns as string[]) {\n        collection.add(c);\n      }\n    }\n    return collection.size !== size;\n  }\n\n  /**\n   * Show the column.\n   */\n  remove(columns: PblColumn[] | string[], indirect?: string) {\n    let collection: Set<string>;\n    if (indirect) {\n      collection = this.indirect.get(indirect);\n      if (!collection) {\n        this.indirect.set(indirect, collection = new Set<string>());\n      }\n    } else {\n      collection = this.hidden;\n    }\n    const size = collection.size;\n    if (columns[0] instanceof PblColumn) {\n      for(const c of columns as PblColumn[]) {\n        collection.delete(c.id);\n      }\n    } else {\n      for(const c of columns as string[]) {\n        collection.delete(c);\n      }\n    }\n    return collection.size !== size;\n  }\n\n  clear(onlyHidden: boolean) {\n    this.hidden.clear();\n    if (!onlyHidden) {\n      this.indirect.clear();\n      this.allHidden.clear();\n    } else {\n      this.syncAllHidden();\n    }\n  }\n\n  syncAllHidden() {\n    this.allHidden.clear();\n    for (const id of this.hidden) {\n      this.allHidden.add(id);\n    }\n    for (const indirect of this.indirect.values()) {\n      for (const id of indirect) {\n        this.allHidden.add(id);\n      }\n    }\n    return this;\n  }\n}\n","import { Subject } from 'rxjs';\nimport { IterableChanges, IterableDiffer, IterableDiffers } from '@angular/core';\nimport { PblColumnStoreMetaRow } from './types';\n\nexport interface PblMetaRowColumnsChangeEvent {\n  metaRow: PblColumnStoreMetaRow;\n  changes: IterableChanges<string>;\n}\n\nexport class MetaRowsStore {\n  headers: Array<PblColumnStoreMetaRow & { allKeys?: string[] }>;\n  footers: Array<PblColumnStoreMetaRow & { allKeys?: string[] }>;\n\n  readonly visibleChanged$ = new Subject<PblMetaRowColumnsChangeEvent>();\n\n  private hDiffers: IterableDiffer<string>[] = [];\n  private fDiffers: IterableDiffer<string>[] = [];\n\n  constructor(private readonly differs: IterableDiffers) {\n  }\n\n  setHeader(value: PblColumnStoreMetaRow & { allKeys?: string[] }) {\n    const index = value.rowDef.rowIndex;\n    this.headers[index] = value;\n    if (this.hDiffers[index]) {\n      const diff = this.hDiffers[index].diff(value.keys);\n      if (diff) {\n        this.visibleChanged$.next({ metaRow: value, changes: diff });\n      }\n    } else {\n      this.hDiffers[index] = this.differs.find([]).create<string>();\n      this.hDiffers[index].diff(value.keys);\n    }\n  }\n\n  setFooter(value: PblColumnStoreMetaRow & { allKeys?: string[] }) {\n    const index = value.rowDef.rowIndex;\n    this.footers[index] = value;\n    if (this.fDiffers[index]) {\n      const diff = this.fDiffers[index].diff(value.keys);\n      if (diff) {\n        this.visibleChanged$.next({ metaRow: value, changes: diff });\n      }\n    } else {\n      this.fDiffers[index] = this.differs.find([]).create<string>();\n      this.fDiffers[index].diff(value.keys);\n    }\n  }\n\n  updateHeader(value: PblColumnStoreMetaRow & { allKeys?: string[] }): void {\n    this.setHeader(Object.assign(this.headers[value.rowDef.rowIndex] || {}, value));\n  }\n\n  updateFooter(value: PblColumnStoreMetaRow & { allKeys?: string[] }): void {\n    this.setFooter(Object.assign(this.footers[value.rowDef.rowIndex] || {}, value));\n  }\n\n  clear() {\n    this.headers = [];\n    this.footers = [];\n  }\n\n  dispose() {\n    this.visibleChanged$.complete();\n  }\n}\n","import { Subject, Observable } from 'rxjs';\nimport { isDevMode, IterableDiffer, IterableDiffers } from '@angular/core';\nimport { PblNgridColumnDefinitionSet, PblColumnSet, PblMetaRowDefinitions } from '@pebula/ngrid/core';\n\nimport { _PblNgridComponent } from '../../../tokens';\nimport { PblNgridInternalExtensionApi } from '../../../ext/grid-ext-api';\nimport { findCellDef } from '../../cell/cell-def/utils';\nimport {\n  PblColumnFactory,\n  PblColumnGroup, PblColumnGroupStore,\n  isPblColumn, PblColumn, PblMetaColumn,\n  PblNgridColumnSet,\n} from '../model';\nimport { GridRowType } from '../../row/types';\nimport { PblNgridBaseRowComponent } from '../../row/base-row.component';\nimport { StaticColumnWidthLogic } from '../width-logic/static-column-width';\nimport { resetColumnWidths } from '../../utils/width';\nimport { PblMetaColumnStore, PblRowColumnsChangeEvent, PblRowTypeToColumnTypeMap } from './types';\nimport { HiddenColumns } from './hidden-columns';\nimport { MetaRowsStore } from './meta-rows-store';\n\nexport class PblColumnStore {\n  metaColumns: PblMetaColumnStore[];\n  get metaHeaderRows() { return this.metaRowsStore.headers; }\n  get metaFooterRows() { return this.metaRowsStore.footers; }\n  columnIds: string[];\n  visibleColumnIds: string[];\n  hiddenColumnIds: string[];\n  visibleColumns: PblColumn[];\n  allColumns: PblColumn[];\n  headerColumnDef: PblMetaRowDefinitions;\n  footerColumnDef: PblMetaRowDefinitions;\n\n  get primary(): PblColumn | undefined { return this._primary; }\n  get groupStore(): PblColumnGroupStore { return this._groupStore; }\n\n  private _primary: PblColumn | undefined;\n  private byId = new Map<string, PblMetaColumnStore & { data?: PblColumn }>();\n  private _groupStore: PblColumnGroupStore;\n  private lastSet: PblNgridColumnSet;\n  private hiddenColumns = new HiddenColumns();\n  private differ: IterableDiffer<PblColumn>;\n  private _visibleChanged$ = new Subject<PblRowColumnsChangeEvent<PblColumn>>();\n  private metaRowsStore: MetaRowsStore;\n  private grid: _PblNgridComponent;\n\n  constructor(private readonly extApi: PblNgridInternalExtensionApi, private readonly differs: IterableDiffers) {\n    this.grid = extApi.grid;\n    this.metaRowsStore = new MetaRowsStore(differs);\n    this.resetIds();\n    this.resetColumns();\n\n    this.metaRowsStore.visibleChanged$\n      .subscribe(event => {\n        event.changes.forEachOperation((record, previousIndex, currentIndex) => {\n          if (record.previousIndex == null) {\n            const columns = this.find(record.item);\n            const col = event.metaRow.kind === 'header' ?\n              event.metaRow.isGroup ? columns.headerGroup : columns.header\n              : event.metaRow.isGroup ? columns.footerGroup : columns.footer;\n            event.metaRow.rowDef.cols.splice(currentIndex, 0, col);\n          } else if (currentIndex == null) {\n            event.metaRow.rowDef.cols.splice(previousIndex, 1);\n          } else {\n            moveItemInArray(event.metaRow.rowDef.cols, previousIndex, currentIndex);\n          }\n        });\n      });\n  }\n\n  getColumnsOf<TRowType extends GridRowType>(row: PblNgridBaseRowComponent<TRowType>): PblRowTypeToColumnTypeMap<TRowType>[] {\n    switch (row.rowType) {\n      case 'data':\n      case 'header':\n      case 'footer':\n        return this.visibleColumns as any;\n      case 'meta-header':\n      case 'meta-footer':\n        return (row as any)._row.rowDef.cols;\n    }\n    return [];\n  }\n\n  columnRowChange(): Observable<PblRowColumnsChangeEvent<PblRowTypeToColumnTypeMap<'data'>>> {\n    return this._visibleChanged$ as any;\n  }\n\n  metaRowChange() {\n    return this.metaRowsStore.visibleChanged$.asObservable();\n  }\n\n  isColumnHidden(column: PblColumn) {\n    return this.hiddenColumns.hidden.has(column.id);\n  }\n\n  clearColumnVisibility() {\n    this.updateColumnVisibility(undefined, this.allColumns);\n  }\n\n  updateColumnVisibility(hide?: PblColumn[] | string[], show?: PblColumn[] | string[]) {\n    const didHide = hide && this.hiddenColumns.add(hide);\n    const didShow = show && this.hiddenColumns.remove(show);\n    if (didShow || didHide) {\n      this.setHidden();\n      if (didShow) {\n        // TODO(shlomiassaf) [perf, 4]: Right now we attach all columns, we can improve it by attaching only those \"added\" (we know them from \"changes\")\n        this.attachCustomCellTemplates();\n        this.attachCustomHeaderCellTemplates();\n      }\n      this.checkVisibleChanges();\n      // This is mostly required when we un-hide things (didShow === true)\n      // However, when we hide, we only need it when the event comes from any are not in the view\n      // i.e. areas outside of the grid or areas which are CONTENT of the grid\n      this.grid.rowsApi.syncRows();\n    }\n  }\n\n  addGroupBy(...columns: PblColumn[] | string[]): void {\n    if (this.hiddenColumns.add(columns, 'groupBy')) {\n      this.setHidden();\n      this.checkVisibleChanges();\n    }\n  }\n\n  removeGroupBy(...columns: PblColumn[] | string[]): void {\n    if (this.hiddenColumns.remove(columns, 'groupBy')) {\n      this.setHidden();\n      this.checkVisibleChanges();\n    }\n  }\n\n  /**\n   * Move the provided `column` to the position of the `anchor` column.\n   * The new location of the anchor column will be it's original location plus or minus 1, depending on the delta between\n   * the columns. If the origin of the `column` is before the `anchor` then the anchor's new position is minus one, otherwise plus 1.\n   */\n  moveColumn(column: PblColumn, anchor: PblColumn): boolean {\n    const { visibleColumns, allColumns } = this;\n    let anchorIndex = visibleColumns.indexOf(anchor);\n    let columnIndex = visibleColumns.indexOf(column);\n    if (anchorIndex > -1 && columnIndex > -1) {\n      moveItemInArray(visibleColumns, columnIndex, anchorIndex);\n      if (this.hiddenColumns.allHidden.size > 0) {\n        anchorIndex = allColumns.indexOf(anchor);\n        columnIndex = allColumns.indexOf(column);\n      }\n      moveItemInArray(allColumns, columnIndex, anchorIndex);\n      this.checkVisibleChanges();\n      return true;\n    }\n  }\n\n  swapColumns(col1: PblColumn, col2: PblColumn): boolean {\n    let col1Index = this.visibleColumns.indexOf(col1);\n    let col2Index = this.visibleColumns.indexOf(col2);\n    if (col1Index > -1 && col2Index > -1) {\n      const { visibleColumns, allColumns } = this;\n      visibleColumns[col1Index] = col2;\n      visibleColumns[col2Index] = col1;\n\n      if (this.hiddenColumns.allHidden.size) {\n        col1Index = allColumns.indexOf(col1);\n        col2Index = allColumns.indexOf(col2);\n      }\n      allColumns[col1Index] = col2;\n      allColumns[col2Index] = col1;\n      this.checkVisibleChanges();\n      return true;\n    }\n    return false;\n  }\n\n  find(id: string): PblMetaColumnStore & { data?: PblColumn } | undefined {\n    return this.byId.get(id);\n  }\n\n  getAllHeaderGroup(): PblColumnGroup[] {\n    return this._groupStore ? this._groupStore.all : [];\n  }\n\n  getStaticWidth(): StaticColumnWidthLogic {\n    const rowWidth = new StaticColumnWidthLogic();\n    for (const column of this.visibleColumns) {\n      rowWidth.addColumn(column);\n    }\n    return rowWidth;\n  }\n\n  invalidate(columnOrDefinitionSet: PblNgridColumnDefinitionSet | PblNgridColumnSet): void {\n    const columnSet: PblNgridColumnSet = this.lastSet = 'groupStore' in columnOrDefinitionSet\n      ? columnOrDefinitionSet\n      : PblColumnFactory.fromDefinitionSet(columnOrDefinitionSet).build()\n    ;\n    const { groupStore, table, header, footer, headerGroup } = columnSet;\n\n    this._groupStore = groupStore.clone();\n\n    const rowWidth = new StaticColumnWidthLogic();\n    this.resetColumns();\n    this.resetIds();\n\n    this.headerColumnDef = {\n      rowClassName: (table.header && table.header.rowClassName) || '',\n      type: (table.header && table.header.type) || 'fixed',\n    }\n    this.footerColumnDef = {\n      rowClassName: (table.footer && table.footer.rowClassName) || '',\n      type: (table.footer && table.footer.type) || 'fixed',\n    }\n\n    this._primary = undefined;\n\n    this.hiddenColumnIds = Array.from(this.hiddenColumns.hidden);\n    const hidden = this.hiddenColumns.syncAllHidden().allHidden;\n\n    for (const def of table.cols) {\n      let column: PblColumn;\n      column = new PblColumn(def, this.groupStore);\n      const columnRecord = this.getColumnRecord(column.id);\n      columnRecord.data = column;\n      this.allColumns.push(column);\n      this.columnIds.push(column.id);\n\n      column.hidden = hidden.has(column.id);\n      if (!column.hidden) {\n        this.visibleColumns.push(column);\n        this.visibleColumnIds.push(column.id);\n        rowWidth.addColumn(column);\n      }\n\n      if (column.pIndex) {\n        if (this._primary && isDevMode()) {\n          console.warn(`Multiple primary index columns defined: previous: \"${this._primary.id}\", current: \"${column.id}\"`);\n        }\n        this._primary = column;\n      }\n    }\n\n    for (const rowDef of header) {\n      // TODO: this is shady, if we add objects to reoDef type later they will be copied by ref, need proper class with clone() method\n      const newRowDef = { ...rowDef };\n      newRowDef.cols = [];\n      const keys: string[] = [];\n      for (const def of rowDef.cols) {\n        const metaCol = this.getColumnRecord(def.id, this.metaColumns);\n        const column = metaCol.header || (metaCol.header = new PblMetaColumn(def));\n        keys.push(column.id);\n        newRowDef.cols.push(column);\n      }\n      this.metaRowsStore.setHeader({ rowDef: newRowDef, keys, kind: 'header' });\n    }\n\n    for (const rowDef of headerGroup) {\n      this._updateGroup(rowDef);\n    }\n\n    for (const rowDef of footer) {\n      // TODO: this is shady, if we add objects to reoDef type later they will be copied by ref, need proper class with clone() method\n      const newRowDef = { ...rowDef };\n      newRowDef.cols = [];\n      const keys: string[] = [];\n      for (const def of rowDef.cols) {\n        const metaCol = this.getColumnRecord(def.id, this.metaColumns);\n        const column = metaCol.footer || (metaCol.footer = new PblMetaColumn(def));\n        keys.push(column.id);\n        newRowDef.cols.push(column);\n      }\n      this.metaRowsStore.setFooter({ rowDef: newRowDef, keys, kind: 'footer' });\n    }\n    resetColumnWidths(rowWidth, this.visibleColumns, this.metaColumns);\n    this.differ = this.differs.find(this.visibleColumns).create((i, c) => c.id);\n    this.differ.diff(this.visibleColumns);\n  }\n\n  updateGroups(...rowIndex: number[]): void {\n    if (rowIndex.length === 0) {\n      for (const rowDef of this.lastSet.headerGroup) {\n        this._updateGroup(rowDef);\n      }\n    } else {\n      const rows = rowIndex.slice();\n      for (const rowDef of this.lastSet.headerGroup) {\n        const idx = rows.indexOf(rowDef.rowIndex);\n        if (idx > -1) {\n          rows.splice(idx, 1);\n          this._updateGroup(rowDef);\n          if (rows.length === 0) {\n            return;\n          }\n        }\n      }\n    }\n  }\n\n  attachCustomCellTemplates(columns?: PblColumn[]): void {\n    const { registry } = this.grid;\n\n    if (!columns) {\n      columns = this.visibleColumns;\n    }\n\n    for (const col of this.visibleColumns) {\n      const cell = findCellDef(registry, col, 'tableCell', true);\n      if ( cell ) {\n        col.cellTpl = cell.tRef;\n      } else {\n        const defaultCellTemplate = registry.getMultiDefault('tableCell');\n        col.cellTpl = defaultCellTemplate ? defaultCellTemplate.tRef : this.grid._fbTableCell;\n      }\n\n      const editorCell = findCellDef(registry, col, 'editorCell', true);\n      if ( editorCell ) {\n        col.editorTpl = editorCell.tRef;\n      } else {\n        const defaultCellTemplate = registry.getMultiDefault('editorCell');\n        col.editorTpl = defaultCellTemplate ? defaultCellTemplate.tRef : undefined;\n      }\n    }\n  }\n\n  attachCustomHeaderCellTemplates(columns?: Array<PblColumn | PblMetaColumnStore>): void {\n    const { registry } = this.grid;\n\n    if (!columns) {\n      columns = [].concat(this.visibleColumns, this.metaColumns);\n    }\n\n    const defaultHeaderCellTemplate = registry.getMultiDefault('headerCell') || { tRef: this.grid._fbHeaderCell };\n    const defaultFooterCellTemplate = registry.getMultiDefault('footerCell') || { tRef: this.grid._fbFooterCell };\n    for (const col of columns) {\n      if (isPblColumn(col)) {\n        const headerCellDef = findCellDef(registry, col, 'headerCell', true) || defaultHeaderCellTemplate;\n        const footerCellDef = findCellDef(registry, col, 'footerCell', true) || defaultFooterCellTemplate;\n        col.headerCellTpl = headerCellDef.tRef;\n        col.footerCellTpl = footerCellDef.tRef;\n      } else {\n        if (col.header) {\n          const headerCellDef = findCellDef(registry, col.header, 'headerCell', true) || defaultHeaderCellTemplate;\n          col.header.template = headerCellDef.tRef;\n        }\n        if (col.headerGroup) {\n          const headerCellDef = findCellDef(registry, col.headerGroup, 'headerCell', true) || defaultHeaderCellTemplate;\n          col.headerGroup.template = headerCellDef.tRef;\n        }\n        if (col.footer) {\n          const footerCellDef = findCellDef(registry, col.footer, 'footerCell', true) || defaultFooterCellTemplate;\n          col.footer.template = footerCellDef.tRef;\n        }\n      }\n    }\n  }\n\n  dispose() {\n    this._visibleChanged$.complete();\n    this.metaRowsStore.dispose();\n  }\n\n  private _updateGroup(columnSet: PblColumnSet<PblColumnGroup>): void {\n    const keys: string[] = [];\n    const allKeys: string[] = [];\n\n    const groups: PblColumnGroup[] = [];\n\n    for (let tIndex = 0; tIndex < this.visibleColumns.length; tIndex++) {\n      const columns = [this.visibleColumns[tIndex - 1], this.visibleColumns[tIndex], this.visibleColumns[tIndex + 1]];\n      const columnGroups = columns.map( c => c ? c.getGroupOfRow(columnSet.rowIndex) : undefined );\n      // true when the group exists in one of the columns BUT NOT in the LAST COLUMN (i.e: Its a slave split)\n      const groupExists = groups.lastIndexOf(columnGroups[1]) !== -1;\n\n      const column = columns[1];\n      const gColumn = column.groupLogic(columnGroups as any, groupExists);\n      if (gColumn !== columnGroups[1]) {\n        column.markNotInGroup(columnGroups[1]);\n        column.markInGroup(gColumn);\n      }\n\n      const metaCol = this.getColumnRecord(gColumn.id, this.metaColumns);\n      if (!metaCol.headerGroup) {\n        metaCol.headerGroup = gColumn;\n      }\n\n      if (groups.lastIndexOf(gColumn) === -1) {\n        allKeys.push(gColumn.id);\n        if (gColumn.isVisible) {\n          keys.push(gColumn.id);\n        }\n      }\n\n      gColumn.replace(column);\n      groups.push(gColumn);\n    }\n\n    for (const ghost of this._groupStore.findGhosts()) {\n      if (ghost.rowIndex === columnSet.rowIndex) {\n        const { id } = ghost;\n        let idx = allKeys.indexOf(id);\n        if (idx !== -1) {\n          allKeys.splice(idx, 1);\n          idx = keys.indexOf(id);\n          if (idx !== -1) {\n            keys.splice(idx, 1);\n          }\n          this.metaColumns.splice(this.metaColumns.findIndex( m => m.id === id), 1);\n        }\n        this._groupStore.remove(ghost);\n      }\n    }\n    this.metaRowsStore.updateHeader({ rowDef: columnSet, keys, allKeys, isGroup: true, kind: 'header' });\n  }\n\n  private getColumnRecord<T extends PblMetaColumnStore & { data?: PblColumn }>(id: string, collection?: T[]): T  {\n    let columnRecord: PblMetaColumnStore & { data?: PblColumn } = this.byId.get(id);\n    if (!columnRecord) {\n      this.byId.set(id, columnRecord = { id });\n      if (collection) {\n        collection.push(columnRecord as T);\n      }\n    }\n    return columnRecord as T;\n  }\n\n  private setHidden(): void {\n    const hidden = this.hiddenColumns.syncAllHidden().allHidden;\n    this.visibleColumns = [];\n    for (const c of this.allColumns) {\n      c.hidden = hidden.has(c.id);\n      if (!c.hidden) {\n        this.visibleColumns.push(c);\n      }\n    }\n    for (const h of this.metaRowsStore.headers) {\n      if (h.isGroup) {\n        h.keys = h.allKeys.filter( key => this.find(key).headerGroup.isVisible );\n      }\n    }\n    resetColumnWidths(this.getStaticWidth(), this.visibleColumns, this.metaColumns);\n  }\n\n  private resetColumns(): void {\n    this.allColumns = [];\n    this.visibleColumns = [];\n    this.metaColumns = [];\n    this.byId.clear();\n  }\n\n  private resetIds(): void {\n    this.columnIds = [];\n    this.visibleColumnIds = [];\n    this.hiddenColumnIds = [];\n    this.metaRowsStore.clear();\n  }\n\n  private columnUpdateInProgress: boolean;\n  private checkVisibleChanges() {\n    if (this.differ) {\n      if (!this.columnUpdateInProgress) {\n        this.columnUpdateInProgress = true;\n        Promise.resolve()\n          .then(() => {\n            this.columnUpdateInProgress = false;\n            const changes = this.differ.diff(this.visibleColumns);\n            if (changes) {\n              this.hiddenColumnIds = Array.from(this.hiddenColumns.hidden);\n              this.visibleColumnIds = Array.from(this.visibleColumns).map( c => c.id );\n              this.columnIds = Array.from(this.allColumns).map( c => c.id );\n              this._visibleChanged$.next({ columns: this.visibleColumns, changes });\n              this.afterColumnPositionChange();\n            }\n          });\n      }\n    }\n    // no differ means we did not invalidate yet, so nothing will change until it start showing\n  }\n\n  private afterColumnPositionChange(): void {\n    // TODO: This shouldn't be here, it should be the responsibility of the caller to clear the context\n    // Because now there is not option to control it.\n    this.extApi.contextApi.clear(true);\n    this.updateGroups();\n    this.extApi.widthCalc.resetColumnsWidth();\n    // now, any newly added column cells must first spin up to get a size\n    // and most importantly have their ngAfterViewInit fired so the resize column will update the sizeInfo of the column!\n    this.extApi.rowsApi.syncRows('header', true);\n    this.extApi.widthCalc.calcColumnWidth();\n  }\n}\n\n/**\n * Moves an item one index in an array to another.\n * @param array Array in which to move the item.\n * @param fromIndex Starting index of the item.\n * @param toIndex Index to which the item should be moved.\n */\nexport function moveItemInArray<T = any>(array: T[], fromIndex: number, toIndex: number): void {\n  const from = clamp(fromIndex, array.length - 1);\n  const to = clamp(toIndex, array.length - 1);\n\n  if (from === to) {\n    return;\n  }\n\n  const target = array[from];\n  const delta = to < from ? -1 : 1;\n\n  for (let i = from; i !== to; i += delta) {\n    array[i] = array[i + delta];\n  }\n\n  array[to] = target;\n}\n\nexport function moveItemInArrayExt<T = any>(array: T[],\n                                            fromIndex: number,\n                                            toIndex: number,\n                                            fn: (previousItem: T, currentItem: T, previousIndex: number, currentIndex: number) => void): void {\n  const from = clamp(fromIndex, array.length - 1);\n  const to = clamp(toIndex, array.length - 1);\n\n  if (from === to) {\n    return;\n  }\n\n  const target = array[from];\n  const delta = to < from ? -1 : 1;\n\n  for (let i = from; i !== to; i += delta) {\n    const next = i + delta;\n    fn(array[i], array[next], i, next);\n    array[i] = array[next];\n  }\n\n  fn(array[to], target, to, from);\n  array[to] = target;\n}\n\n\n/** Clamps a number between zero and a maximum. */\nfunction clamp(value: number, max: number): number {\n  return Math.max(0, Math.min(max, value));\n}\n","import { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nimport { ON_RESIZE_ROW } from '@pebula/ngrid/core';\nimport { _PblNgridComponent } from '../../../tokens';\nimport { PblNgridExtensionApi } from '../../../ext/grid-ext-api';\nimport { PblNgridColumnRowComponent } from '../../row/columns-row.component';\nimport { PblColumn, isPblColumn } from '../model/column';\nimport { PblColumnStore } from './column-store';\nimport { AutoSizeToFitOptions } from './types';\n\nexport class ColumnApi<T> {\n\n  // workaround, we need a parameter-less constructor since @ngtools/webpack@8.0.4\n  // Non @Injectable classes are now getting addded with hard reference to the ctor params which at the class creation point are undefined\n  // forwardRef() will not help since it's not inject by angular, we instantiate the class..\n  // probably due to https://github.com/angular/angular-cli/commit/639198499973e0f437f059b3c933c72c733d93d8\n  static create<T>(extApi: PblNgridExtensionApi): ColumnApi<T> {\n    const instance = new ColumnApi<T>();\n\n    instance.grid = extApi.grid;\n    instance.store = extApi.columnStore;\n    instance.extApi = extApi;\n\n    return instance;\n  }\n\n  get visibleColumnIds(): string[] { return this.store.visibleColumnIds; }\n  get hiddenColumnIds(): string[] { return this.store.hiddenColumnIds; }\n  get visibleColumns(): PblColumn[] { return this.store.visibleColumns; }\n  get columns(): PblColumn[] { return this.store.allColumns; }\n  get columnIds(): string[] { return this.store.columnIds; }\n\n  get totalColumnWidthChange(): Observable<number> {\n    if (!this._totalColumnWidthChange) {\n      this._totalColumnWidthChange = this.extApi.events\n        .pipe(\n          ON_RESIZE_ROW,\n          // We might get a null sizeInfo when a new column is added - see syncColumnGroupsSize()\n          map( e => this.grid.columnApi.visibleColumns.reduce( (p, c) => p + c.sizeInfo?.width ?? 0, 0 ) ),\n        );\n    }\n    return this._totalColumnWidthChange;\n  }\n\n  private grid: _PblNgridComponent<T>;\n  private store: PblColumnStore;\n  private extApi: PblNgridExtensionApi;\n  private _totalColumnWidthChange: Observable<number>;\n\n  private constructor() { }\n\n  /**\n   * Returns the `PblColumn` at the specified index from the list of rendered columns (i.e. not hidden).\n   */\n  findColumnAt(renderColumnIndex: number): PblColumn | undefined {\n    return this.store.visibleColumns[renderColumnIndex];\n  }\n\n  /**\n   * Returns the column matching provided `id`.\n   *\n   * The search is performed on all known columns.\n   */\n  findColumn(id: string): PblColumn | undefined {\n    const result = this.store.find(id);\n    if (result) {\n      return result.data;\n    }\n  }\n\n  /**\n  * Returns the render index of column or -1 if not found.\n  *\n  * The render index represents the current location of the column in the group of visible columns.\n  */\n  renderIndexOf(column: string | PblColumn): number {\n    const c = typeof column === 'string' ? this.findColumn(column) : column;\n    return this.store.visibleColumns.indexOf(c);\n  }\n\n  /**\n   * Returns the index of a column or -1 if not found.\n   */\n  indexOf(column: string | PblColumn): number {\n    const c = typeof column === 'string' ? this.findColumn(column) : column;\n    return this.store.allColumns.indexOf(c);\n  }\n\n  isColumnHidden(column: PblColumn) {\n    return this.store.isColumnHidden(column);\n  }\n\n  /**\n   * Hide columns in the table\n   */\n  hideColumns(column: PblColumn | string,  ...columns: PblColumn[] | string[]): void {\n    this.store.updateColumnVisibility([column, ...columns] as PblColumn[] | string[]);\n  }\n\n  /**\n   * Change the visibility state of the provided columns to visible.\n   * If no columns are provided all columns\n   */\n  showColumns(showAll: true): void;\n  showColumns(column: PblColumn | string,  ...columns: PblColumn[] | string[]): void;\n  showColumns(columnOrShowAll: PblColumn | string | true,  ...columns: PblColumn[] | string[]): void {\n    if (columnOrShowAll === true) {\n      this.store.clearColumnVisibility();\n    } else {\n      this.store.updateColumnVisibility(undefined, [columnOrShowAll, ...columns] as PblColumn[] | string[]);\n    }\n  }\n\n  /**\n   * Update the width of the column with the provided width.\n   *\n   * The width is set in px or % in the following format: ##% or ##px\n   * Examples: '50%', '50px'\n   *\n   * Resizing the column will trigger a table width resizing event, updating column group if necessary.\n   */\n  resizeColumn(column: PblColumn, width: string): void {\n    column.updateWidth(width);\n    // this.grid.resetColumnsWidth();\n    // this.grid.resizeColumns();\n  }\n\n  /**\n   * Resize the column to best fit it's content.\n   *\n   * - Content: All of the cells rendered for this column (header, data and footer cells).\n   * - Best fit: The width of the cell with the height width measured.\n   *\n   * The best fit found (width) is then used to call `resizeColumn()`.\n   */\n  autoSizeColumn(column: PblColumn): void {\n    const size = this.findColumnAutoSize(column);\n    this.resizeColumn(column, `${size}px`);\n  }\n\n  /**\n   * For each visible column in the table, resize to best fit it's content.\n   *\n   * This method will simply run `autoSizeColumn()` on the visible columns in the table.\n   */\n  autoSizeColumns(): void;\n  /**\n   * For each column in the list of column provided, resize to best fit it's content.\n   *\n   * Make sure you are not resizing an hidden column.\n   * This method will simply run `autoSizeColumn()` on the columns provided.\n   */\n  autoSizeColumns(...columns: PblColumn[]): void; // tslint:disable-line:unified-signatures\n  autoSizeColumns(...columns: PblColumn[]): void {\n    const cols = columns.length > 0 ? columns : this.visibleColumns;\n    for (const column of cols) {\n      const size = this.findColumnAutoSize(column);\n      column.updateWidth(`${size}px`);\n    }\n    // this.grid.resetColumnsWidth();\n    // this.grid.resizeColumns();\n  }\n\n  /**\n   * For each visible column in the table, resize the width to a proportional width relative to the total width provided.\n   */\n  autoSizeToFit(totalWidth: number, options: AutoSizeToFitOptions = {}): void {\n    const wLogic = this.extApi.widthCalc.dynamicColumnWidth;\n    const { visibleColumns } = this;\n    const columnBehavior: AutoSizeToFitOptions['columnBehavior'] = options.columnBehavior || ( () => options ) as any;\n\n    let overflowTotalWidth = 0;\n    let totalMinWidth = 0;\n\n    const withMinWidth: number[] = [];\n\n    const widthBreakouts = visibleColumns.map( (column, index) => {\n      const widthBreakout = wLogic.widthBreakout(column.sizeInfo);\n      const instructions = { ...(columnBehavior(column) || {}), ...options };\n\n      overflowTotalWidth += widthBreakout.content;\n      totalWidth -= widthBreakout.nonContent;\n\n      if (instructions.keepMinWidth && column.minWidth) {\n        totalMinWidth += column.minWidth;\n        withMinWidth.push(index);\n      }\n\n      return { ...widthBreakout, instructions };\n    });\n\n    const p = totalMinWidth / totalWidth;\n    const level = (overflowTotalWidth * p  - totalMinWidth) / (1 - p);\n    for (const i of withMinWidth) {\n      const addition = level * (visibleColumns[i].minWidth / totalMinWidth)\n      widthBreakouts[i].content += addition;\n      overflowTotalWidth += addition;\n    }\n\n    for (let i = 0; i < visibleColumns.length; i++) {\n      const widthBreakout = widthBreakouts[i];\n      const instructions = widthBreakout.instructions;\n      const column = visibleColumns[i];\n\n      const r = widthBreakout.content / overflowTotalWidth;\n\n      if (!instructions.keepMinWidth || !column.minWidth) {\n        column.minWidth = undefined;\n      }\n      if (!instructions.keepMaxWidth || !column.maxWidth) {\n        column.maxWidth = undefined;\n        column.checkMaxWidthLock(column.sizeInfo.width); // if its locked, we need to release...\n      }\n\n      // There are 3 scenarios when updating the column\n      // 1) if it's a fixed width or we're force into fixed width\n      // 2) Not fixed width and width is set (%)\n      // 3) Not fixed width an width is not set ( the width depends on the calculated `defaultWidth` done in `this.grid.resetColumnsWidth()` )\n      let width: string;\n      const { forceWidthType } = instructions;\n      if (forceWidthType === 'px' || (!forceWidthType && column.isFixedWidth)) { // (1)\n        width = `${totalWidth * r}px`;\n      } else if (forceWidthType === '%' || (!forceWidthType && column.width)) { // (2)\n        width = `${100 * r}%`;\n      } // else (3) -> the update is skipped and it will run through resetColumnsWidth\n\n      if (width) {\n        column.updateWidth(width);\n      }\n\n    }\n    // we now reset the column widths, this will calculate a new `defaultWidth` and set it in all columns but the relevant ones are column from (3)\n    // It will also mark all columnDefs for check\n    this.extApi.widthCalc.resetColumnsWidth();\n    this.extApi.widthCalc.calcColumnWidth();\n  }\n\n  /**\n   * Move the provided `column` to the position of the `anchor` column.\n   * The new location of the anchor column will be it's original location plus or minus 1, depending on the delta between\n   * the columns. If the origin of the `column` is before the `anchor` then the anchor's new position is minus one, otherwise plus 1.\n   */\n  moveColumn(column: PblColumn, anchor: PblColumn): boolean;\n    /**\n   * Move the provided `column` to the position of the column at `renderColumnIndex`.\n   * `renderColumnIndex` must be a visible column (i.e. not hidden)\n   */\n  moveColumn(column: PblColumn, renderColumnIndex: number): boolean; // tslint:disable-line:unified-signatures\n  moveColumn(column: PblColumn, anchor: PblColumn | number): boolean {\n    if (isPblColumn(anchor)) {\n      return column === anchor ? false : this.store.moveColumn(column, anchor);\n    } else {\n      const a = this.findColumnAt(anchor);\n      return a ? this.moveColumn(column, a) : false;\n    }\n  }\n\n  /**\n   * Swap positions between 2 existing columns.\n   */\n  swapColumns(col1: PblColumn, col2: PblColumn): boolean {\n    return this.store.swapColumns(col1, col2);\n  }\n\n  addGroupBy(...column: PblColumn[]): void { this.store.addGroupBy(...column); }\n  removeGroupBy(...column: PblColumn[]): void { this.store.removeGroupBy(...column); }\n\n  private findColumnAutoSize(column: PblColumn): number {\n    const { columnDef } = column;\n    const cells = columnDef.queryCellElements();\n    for (let i = 0, len = cells.length; i < len; i++) {\n      const parentRow = this.extApi.rowsApi.findRowByElement(cells[i].parentElement);\n      if (parentRow.rowType === 'header' && (parentRow as unknown as PblNgridColumnRowComponent).gridWidthRow) {\n        cells.splice(i, 1);\n        break;\n      }\n    }\n\n    let size = 0;\n    let internalWidth: number;\n    for (const c of cells) {\n      if (c.childElementCount <= 1) {\n        const element = (c.firstElementChild || c) as HTMLElement;\n        internalWidth = element.scrollWidth;\n      } else {\n        internalWidth = 0;\n        let el: Element = c.firstElementChild;\n        do {\n          switch (getComputedStyle(el).position) {\n            case 'sticky':\n            case 'absolute':\n            case 'fixed':\n              break;\n            default:\n              internalWidth += el.scrollWidth;\n              break;\n          }\n        } while (el = el.nextElementSibling)\n      }\n      if (internalWidth > size) {\n        size = internalWidth + 1;\n        // we add 1 pixel because `element.scrollWidth` does not support subpixel values, the width is converted to an integer removing subpixel values (fractions).\n      }\n    }\n    return size;\n  }\n}\n","import { PblMetaRowDefinitions } from '@pebula/ngrid/core';\nimport { PblNgridMetaRowService, PblMetaRow } from '../meta-rows/meta-row.service';\n\nexport function initColumnOrMetaRow(element: HTMLElement, isFooter: boolean) {\n  element.classList.add(...(isFooter ? ['cdk-footer-row', 'pbl-ngrid-footer-row'] : ['cdk-header-row', 'pbl-ngrid-header-row']));\n}\n\nexport function setRowVisibility(element: HTMLElement, visible: boolean) {\n  if (visible) {\n    element.classList.remove('pbl-ngrid-row-hidden');\n  } else {\n    element.classList.add('pbl-ngrid-row-hidden');\n  }\n}\n\nexport function applyMetaRowClass(metaRowsService: PblNgridMetaRowService,\n                                  metaRows: PblMetaRow,\n                                  element: HTMLElement,\n                                  oldMetaRow: PblMetaRowDefinitions,\n                                  newMetaRow: PblMetaRowDefinitions) {\n  if (oldMetaRow) {\n    if (oldMetaRow.rowClassName) {\n      element.classList.remove(oldMetaRow.rowClassName);\n    }\n    metaRowsService.removeMetaRow(metaRows);\n  }\n  metaRows.meta = newMetaRow;\n  if (newMetaRow) {\n    if (newMetaRow.rowClassName) {\n      element.classList.add(newMetaRow.rowClassName);\n    }\n    metaRowsService.addMetaRow(metaRows);\n  }\n}\n\nconst FIRST_LAST_ROW_SELECTORS = {\n  header: {\n    selector: 'pbl-ngrid-header-row',\n    first: 'pbl-ngrid-first-header-row',\n    last: 'pbl-ngrid-last-header-row',\n  },\n  footer: {\n    selector: 'pbl-ngrid-footer-row',\n    first: 'pbl-ngrid-first-footer-row',\n    last: 'pbl-ngrid-last-footer-row',\n  }\n};\n\nexport function updateMetaRowFirstLastClass(section: keyof typeof FIRST_LAST_ROW_SELECTORS,\n                                            root: Element,\n                                            prev: { first?: Element; last?: Element }): { first?: Element; last?: Element } {\n  const sectionCss = FIRST_LAST_ROW_SELECTORS[section];\n  const rows = root.querySelectorAll(`.${sectionCss.selector}:not(.pbl-ngrid-row-visually-hidden):not(.pbl-ngrid-row-hidden)`);\n\n  const first = rows[0];\n  if (prev.first !== first) {\n    prev.first?.classList.remove(sectionCss.first);\n    first?.classList.add(sectionCss.first);\n  }\n  const last = rows[rows.length - 1];\n  if (prev.last !== last) {\n    prev.last?.classList.remove(sectionCss.last);\n    last?.classList.add(sectionCss.last);\n  }\n  return { first, last };\n}\n","import { NgZone } from '@angular/core';\nimport { ON_INVALIDATE_HEADERS, unrx } from '@pebula/ngrid/core';\nimport { PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\nimport { RowIntersectionTracker } from '../features/virtual-scroll/row-intersection';\nimport { PblNgridMetaRowService } from '../meta-rows/meta-row.service';\nimport { PblCdkTableComponent } from '../pbl-cdk-table/pbl-cdk-table.component';\nimport { PblNgridBaseRowComponent } from './base-row.component';\nimport { PblNgridCellFactoryResolver } from './cell-factory.service';\nimport { PblNgridColumnRowComponent } from './columns-row.component';\nimport { PblNgridMetaRowComponent } from './meta-row.component';\nimport { PblNgridRowComponent } from './row.component';\nimport { GridRowType } from './types';\nimport { updateMetaRowFirstLastClass } from './utils';\n\nexport interface RowsApi<T = any> {\n  readonly metaRowService: PblNgridMetaRowService<T>;\n\n  syncRows(rowType?: 'all' | boolean, detectChanges?: boolean): void;\n  syncRows(rowType: 'header' | 'data' | 'footer', detectChanges: boolean, ...rows: number[]): void;\n  syncRows(rowType: 'header' | 'data' | 'footer', ...rows: number[]): void;\n\n  findDataRowByIndex(index: number): PblNgridRowComponent<T> | undefined;\n  findDataRowByDsIndex(index: number): PblNgridRowComponent<T> | undefined;\n  findDataRowByIdentity(identity: string | number): PblNgridRowComponent<T> | undefined;\n  findRowByElement(element: Element): PblNgridBaseRowComponent<GridRowType, T> | undefined;\n\n}\n\nfunction isPblNgridRowComponent<T = any>(row: PblNgridBaseRowComponent<GridRowType, T>): row is PblNgridRowComponent {\n  return row.rowType === 'data';\n}\n\nexport class PblRowsApi<T = any> implements RowsApi<T> {\n\n  cdkTable: PblCdkTableComponent<T>;\n\n  readonly metaRowService: PblNgridMetaRowService<T>;\n\n  private allByElement = new Map<Element, PblNgridBaseRowComponent<GridRowType, T>>();\n  private allRows = new Set<PblNgridBaseRowComponent<GridRowType, T>>();\n  private rows = new Map<GridRowType, Set<PblNgridBaseRowComponent<any, T>>>();\n  private columnRows = new Set<PblNgridRowComponent<T> | PblNgridColumnRowComponent>();\n  private metaHeaderRows = new Set<PblNgridMetaRowComponent>();\n  private metaFooterRows = new Set<PblNgridMetaRowComponent>();\n  private gridWidthRow: PblNgridColumnRowComponent;\n  private intersection?: RowIntersectionTracker;\n\n  private firstLast = {\n    header: {} as { first?: Element; last?: Element },\n    footer: {} as { first?: Element; last?: Element },\n  };\n\n  constructor(private readonly extApi: PblNgridInternalExtensionApi<T>,\n              private readonly zone: NgZone,\n              public readonly cellFactory: PblNgridCellFactoryResolver) {\n\n    this.metaRowService = new PblNgridMetaRowService<T>(extApi);\n    extApi.onConstructed(() => this.cdkTable = extApi.cdkTable);\n\n    for (const type of ['header', 'data', 'footer', 'meta-header', 'meta-footer'] as GridRowType[]) {\n      this.rows.set(type, new Set<PblNgridBaseRowComponent<any, T>>());\n    }\n\n    /* List to sync events which notify about changes in meta rows and update the first/last rows to have the class marking it is the first/last */\n    this.metaRowService.sync\n      .pipe(unrx(this))\n      .subscribe(() => {\n        this.firstLast.header = updateMetaRowFirstLastClass('header', this.extApi.element, this.firstLast.header);\n        this.firstLast.footer = updateMetaRowFirstLastClass('footer', this.extApi.element, this.firstLast.footer);\n      });\n\n    extApi.columnStore.columnRowChange()\n      .pipe(unrx(this))\n      .subscribe( event => {\n        const gridWidthRow = this.gridWidthRow;\n        let requireSizeUpdate = false;\n\n        event.changes.forEachOperation((record, previousIndex, currentIndex) => {\n          if (record.previousIndex == null) {\n            for (const r of this.columnRows) {\n              r._createCell(record.item, currentIndex);\n            }\n          } else if (currentIndex == null) {\n            for (const r of this.columnRows) {\n              r._destroyCell(previousIndex);\n            }\n          } else {\n            for (const r of this.columnRows) {\n              r._moveCell(previousIndex, currentIndex);\n            }\n            if (!requireSizeUpdate && gridWidthRow) {\n              const lastIndex = gridWidthRow.cellsLength - 1;\n              requireSizeUpdate = currentIndex === lastIndex || previousIndex === lastIndex;\n            }\n          }\n        });\n      if (requireSizeUpdate) {\n        this.gridWidthRow.updateSize();\n      }\n    });\n\n    extApi.columnStore.metaRowChange()\n      .pipe(unrx(this))\n      .subscribe( event => {\n        const rows = event.metaRow.kind === 'header' ? this.metaHeaderRows : this.metaFooterRows;\n        for (const r of rows) {\n          if (r.row.rowDef.rowIndex === event.metaRow.rowDef.rowIndex) {\n            event.changes.forEachOperation((record, previousIndex, currentIndex) => {\n              if (record.previousIndex == null) {\n                const columns = this.extApi.columnStore.find(record.item);\n                const col = event.metaRow.kind === 'header' ?\n                  event.metaRow.isGroup ? columns.headerGroup : columns.header\n                  : event.metaRow.isGroup ? columns.footerGroup : columns.footer;\n                r._createCell(col as any, currentIndex);\n              } else if (currentIndex == null) {\n                r._destroyCell(previousIndex);\n              } else {\n                r._moveCell(previousIndex, currentIndex);\n              }\n            });\n            break;\n          }\n        }\n      });\n\n    extApi.onConstructed(() => {\n      this.intersection = extApi.viewport.intersection;\n      if (this.intersection.observerMode) {\n        this.intersection.intersectionChanged\n          .subscribe(entries => {\n            for (const e of entries) {\n              const row = this.allByElement.get(e.target);\n              if (isPblNgridRowComponent(row)) {\n                row._setOutOfViewState(!e.isIntersecting);\n              }\n            }\n          });\n      } else {\n        // only needed for non intersection observer mode\n        // TODO: remove when IntersectionObserver is required\n        let lastScrollState = extApi.viewport.isScrolling;\n        extApi.viewport.scrolling\n          .subscribe( scrolling => {\n            if (scrolling === 0 && lastScrollState) {\n              // TODO: be smarter here, start from edges, stop when both edge hit in view row\n              // use isOutOfView location (top/bottom) to speed up\n              this.forceUpdateOutOfView(...this.dataRows());\n            }\n            lastScrollState = !!scrolling;\n          });\n      }\n    });\n\n    extApi.events\n      .pipe(ON_INVALIDATE_HEADERS)\n      .subscribe( event => {\n        const dataRows = this.dataRows();\n        for (const row of dataRows) {\n          row._rebuildCells();\n        }\n        // TODO: reset viewport and virtual scroll state/cache/calculations\n      });\n\n    // Handle item moves to update the context with the new index\n    extApi.events\n      .subscribe(event => {\n        if (event.kind === 'onBeforeMoveItem') {\n          try {\n            const { fromIndex, toIndex } = event;\n            const main = extApi.grid.rowsApi.findDataRowByDsIndex(fromIndex);\n            if (fromIndex < toIndex) {\n              for (let i = fromIndex + 1; i <= toIndex; i++) {\n                extApi.grid.rowsApi.findDataRowByDsIndex(i).context.dsIndex -= 1;\n              }\n            } else {\n              for (let i = fromIndex - 1; i >= toIndex; i--) {\n                extApi.grid.rowsApi.findDataRowByDsIndex(i).context.dsIndex += 1;\n              }\n            }\n            main.context.dsIndex = toIndex;\n          } catch (err) {\n\n          }\n        }\n      });\n  }\n\n  forceUpdateOutOfView(...rows: PblNgridRowComponent<T>[]) {\n    if (this.intersection.observerMode) {\n      const entries = this.intersection.snapshot();\n      for (const e of entries) {\n        const row = this.allByElement.get(e.target);\n        if (isPblNgridRowComponent(row)) {\n          row._setOutOfViewState(!e.isIntersecting);\n        }\n      }\n    } else {\n      const { clientRect } = this.extApi.viewport.getBoundingClientRects;\n      for (const row of rows) {\n        row._setOutOfViewState(isOutOfView(row, clientRect));\n      }\n    }\n  }\n\n  addRow(row: PblNgridBaseRowComponent<GridRowType, T>) {\n    this.allRows.add(row);\n    this.allByElement.set(row.element, row);\n    const rows = this.rows.get(row.rowType);\n    rows.add(row);\n\n    switch (row.rowType) {\n      case 'header':\n        if ((row as unknown as PblNgridColumnRowComponent).gridWidthRow) {\n          this.gridWidthRow = row as unknown as PblNgridColumnRowComponent;\n        }\n      case 'data': // tslint:disable-line: no-switch-case-fall-through\n        this.intersection.track(row.element);\n      case 'footer': // tslint:disable-line: no-switch-case-fall-through\n        this.columnRows.add(row as any);\n        break;\n      case 'meta-header':\n        this.metaHeaderRows.add(row as any);\n        break;\n      case 'meta-footer':\n        this.metaFooterRows.add(row as any);\n        break;\n    }\n  }\n\n  removeRow(row: PblNgridBaseRowComponent<any, T>) {\n    this.allRows.delete(row);\n    this.allByElement.delete(row.element);\n    const rows = this.rows.get(row.rowType);\n    if (rows) {\n      rows.delete(row);\n    }\n\n    switch (row.rowType) {\n      case 'header':\n        if ((row as unknown as PblNgridColumnRowComponent).gridWidthRow && (row as unknown as PblNgridColumnRowComponent) === this.gridWidthRow) {\n          this.gridWidthRow = undefined;\n        }\n      case 'data': // tslint:disable-line: no-switch-case-fall-through\n        this.intersection.untrack(row.element);\n      case 'footer': // tslint:disable-line: no-switch-case-fall-through\n        this.columnRows.delete(row as any);\n        break;\n      case 'meta-header':\n        this.metaHeaderRows.delete(row as any);\n        break;\n      case 'meta-footer':\n        this.metaFooterRows.delete(row as any);\n        break;\n    }\n  }\n\n  dataRows() {\n    return Array.from(this.rows.get('data')) as PblNgridRowComponent<T>[];\n  }\n\n  findRowByElement(element: Element): PblNgridBaseRowComponent<GridRowType, T> | undefined {\n    return this.allByElement.get(element);\n  }\n\n  findDataRowByDsIndex(index: number): PblNgridRowComponent<T> | undefined {\n    for (const r of this.dataRows()) {\n      if (r.context?.dsIndex === index) {\n        return r;\n      }\n    }\n  }\n\n  findDataRowByIndex(index: number): PblNgridRowComponent<T> | undefined {\n    for (const r of this.dataRows()) {\n      if (r.rowIndex === index) {\n        return r;\n      }\n    }\n  }\n\n  findDataRowByIdentity(identity: string | number): PblNgridRowComponent<T> | undefined {\n    for (const r of this.dataRows()) {\n      if (r.context?.identity === identity) {\n        return r as PblNgridRowComponent<T>;\n      }\n    }\n  }\n\n  findColumnRow(type: 'header' | 'footer'): PblNgridColumnRowComponent {\n    return Array.from(this.rows.get(type))\n      .find( r => (r as unknown as PblNgridColumnRowComponent).gridWidthRow === false) as unknown as PblNgridColumnRowComponent;\n  }\n\n  /**\n   * Force run change detection for rows.\n   * You can run it for specific groups or for all rows.\n   */\n  syncRows(rowType?: 'all' | boolean, detectChanges?: boolean): void;\n  syncRows(rowType: GridRowType, detectChanges: boolean, ...rowsIndex: number[]): void;\n  syncRows(rowType: GridRowType, ...rowsIndex: number[]): void;\n  syncRows(rowType: GridRowType | 'all' | boolean = false, ...rowsIndex: any[]): void {\n    if (!NgZone.isInAngularZone()) {\n      this.zone.run(() => this.syncRows(rowType as any, ...rowsIndex));\n      return;\n    }\n\n    const detectChanges: boolean = typeof rowType === 'boolean'\n      ? rowType\n      : typeof rowsIndex[0] === 'boolean'\n        ? rowsIndex.shift()\n        : false\n    ;\n\n    let rows: Set<PblNgridBaseRowComponent<GridRowType, T>>;\n    let useSpecificRows = rowsIndex.length > 0;\n    switch(rowType) {\n      case 'header':\n      case 'data':\n      case 'footer':\n      case 'meta-header':\n      case 'meta-footer':\n        rows = this.rows.get(rowType);\n        break;\n      default: // boolean or 'all'\n        useSpecificRows = false;\n        rows = this.allRows;\n        break;\n    }\n\n    if (!useSpecificRows) {\n      for (const r of Array.from(rows)) {\n        r.ngDoCheck();\n      }\n    } else {\n      for (const index of rowsIndex) {\n        for (const r of Array.from(rows)) {\n          if (r.rowIndex === index) {\n            r.ngDoCheck();\n          }\n        }\n      }\n    }\n  }\n}\n\nfunction isOutOfView(row: PblNgridRowComponent, viewPortRect: ClientRect | DOMRect, location?: 'top' | 'bottom'): boolean {\n  const elRect = row.element.getBoundingClientRect();\n\n  let isInsideOfView: boolean;\n  switch (location){\n    case 'top':\n      isInsideOfView = elRect.bottom >= viewPortRect.top;\n      break;\n    case 'bottom':\n      isInsideOfView = elRect.top <= viewPortRect.bottom;\n      break;\n    default:\n      isInsideOfView = (elRect.bottom >= viewPortRect.top && elRect.top <= viewPortRect.bottom)\n      break;\n  }\n\n  return !isInsideOfView;\n}\n","/**\n * Tokens for symboles that will cause cyclic dependencies.\n */\n\nimport { InjectionToken } from '@angular/core';\n\nexport type _PblNgridComponent<T = any> = import('./grid/ngrid.component').PblNgridComponent<T>;\nexport const PBL_NGRID_COMPONENT = new InjectionToken<import('./grid/ngrid.component').PblNgridComponent>('PblNgridComponent');\n","import { Type } from '@angular/core';\nimport { PblNgridPluginExtension, PblNgridPluginExtensionFactories } from './types';\n\n/** @internal */\nexport const PLUGIN_STORE = new Map<keyof PblNgridPluginExtension, NgridPluginMetadata & { target: any }>();\n\nexport interface NgridPluginMetadata<P extends keyof PblNgridPluginExtension = keyof PblNgridPluginExtension> {\n  id: P;\n  factory?: P extends keyof PblNgridPluginExtensionFactories\n    ? PblNgridPluginExtensionFactories[P]\n    : never\n  ;\n  runOnce?: () => void;\n}\n\nexport function ngridPlugin(metadata: NgridPluginMetadata, target: Type<any>) {\n  if (metadata.runOnce) {\n    metadata.runOnce();\n  }\n  PLUGIN_STORE.set(metadata.id, { ...metadata, target });\n  return metadata.id;\n}\n","import { Observable, of, Subject } from 'rxjs';\nimport { mapTo } from 'rxjs/operators';\nimport { InjectFlags, Injector } from '@angular/core';\n\nimport { PblNgridEvents, ON_INIT, PblNgridEventEmitter } from '@pebula/ngrid/core';\nimport { _PblNgridComponent } from '../tokens';\nimport {\n  PblNgridPlugin,\n  PblNgridPluginExtension,\n  PblNgridPluginExtensionFactories,\n} from './types';\nimport { PblNgridExtensionApi } from './grid-ext-api';\nimport { PLUGIN_STORE } from './grid-plugin';\n\nconst NGRID_PLUGIN_CONTEXT = new WeakMap<_PblNgridComponent, PblNgridPluginContext>();\n\nconst CREATED$ = new Subject<{ table: _PblNgridComponent, controller: PblNgridPluginController<any> }>();\n\nconst REGISTERED_TO_CREATE = new WeakSet<any>();\n\n/** @internal */\nexport class PblNgridPluginContext<T = any> implements PblNgridEventEmitter {\n\n  // workaround, we need a parameter-less constructor since @ngtools/webpack@8.0.4\n  // Non @Injectable classes are now getting addded with hard reference to the ctor params which at the class creation point are undefined\n  // forwardRef() will not help since it's not inject by angular, we instantiate the class..\n  // probably due to https://github.com/angular/angular-cli/commit/639198499973e0f437f059b3c933c72c733d93d8\n  static create<T = any>(injector: Injector, extApi: PblNgridExtensionApi) {\n    if (NGRID_PLUGIN_CONTEXT.has(extApi.grid)) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error(`Grid instance is already registered for extensions.`);\n      }\n      return;\n    }\n\n    const instance = new PblNgridPluginContext<T>();\n    NGRID_PLUGIN_CONTEXT.set(extApi.grid, instance);\n\n    instance.grid = extApi.grid;\n    instance.injector = injector;\n    instance.extApi = extApi;\n\n    instance.controller = new PblNgridPluginController<T>(instance);\n\n    return {\n      plugin: instance,\n      init: () => CREATED$.next({ table: instance.grid, controller: instance.controller }),\n    };\n  }\n\n  grid: _PblNgridComponent;\n  injector: Injector;\n  extApi: PblNgridExtensionApi;\n  controller: PblNgridPluginController<T>;\n  readonly events: Observable<PblNgridEvents>;\n  private _events = new Subject<PblNgridEvents>();\n\n  private constructor() {\n    this.events = this._events.asObservable();\n  }\n\n  emitEvent(event: PblNgridEvents): void {\n    this._events.next(event);\n  }\n\n  destroy(): void  {\n    if (!NGRID_PLUGIN_CONTEXT.has(this.grid)) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error(`Grid is not registered.`);\n      }\n      return;\n    }\n    this._events.complete();\n    NGRID_PLUGIN_CONTEXT.delete(this.grid);\n  }\n}\n\nexport class PblNgridPluginController<T = any> {\n\n  static readonly created = CREATED$.asObservable();\n\n  static onCreatedSafe(token: any, fn: (grid: _PblNgridComponent, controller: PblNgridPluginController<any>) => void) {\n    if (!REGISTERED_TO_CREATE.has(token)) {\n      REGISTERED_TO_CREATE.add(token);\n      PblNgridPluginController.created.subscribe( event => fn(event.table, event.controller));\n    }\n  }\n\n  static find<T = any>(grid: _PblNgridComponent<T>): PblNgridPluginController<T> | undefined {\n    const context = NGRID_PLUGIN_CONTEXT.get(grid);\n    if (context) {\n      return context.controller;\n    }\n  }\n\n  static findPlugin<P extends keyof PblNgridPluginExtension, T = any>(grid: _PblNgridComponent<T>, name: P): PblNgridPluginExtension[P] | undefined {\n    return PblNgridPluginController.find(grid)?.getPlugin(name);\n  }\n\n  get injector(): Injector { return this.context.injector; }\n\n  readonly extApi: PblNgridExtensionApi\n  readonly events: Observable<PblNgridEvents>;\n  private readonly grid: _PblNgridComponent<T>\n  private readonly plugins = new Map<keyof PblNgridPluginExtension, PblNgridPlugin>();\n\n  constructor(private context: PblNgridPluginContext) {\n    this.grid = context.grid;\n    this.extApi = context.extApi;\n    this.events = context.events;\n  }\n\n  /**\n   * A Simple shortcut to the `onInit` event which is fired once.\n   * If the grid has already been init the event will fire immediately, otherwise it will emit once when `onInit`\n   * occurs and cleanup the subscription.\n   *\n   * The boolean value emitted reflects the state it was emitted on.\n   * false - grid was already initialized\n   * true - grid was just initialized\n   *\n   * In other words, if you get false, it means you called this method when the grid was already initialized.\n   */\n  onInit() {\n    return this.grid.isInit ? of(false) : this.events.pipe(ON_INIT, mapTo(true));\n  }\n\n  hasPlugin<P extends keyof PblNgridPluginExtension>(name: P): boolean {\n    return this.plugins.has(name);\n  }\n\n  getPlugin<P extends keyof PblNgridPluginExtension>(name: P): PblNgridPluginExtension[P] | undefined  {\n    return this.plugins.get(name) as any;\n  }\n\n  ensurePlugin<P extends keyof PblNgridPluginExtension>(name: P): PblNgridPluginExtension[P]  {\n    return this.getPlugin(name) || this.createPlugin(name);\n  }\n\n  /**\n   * Registers the `plugin` with the `name` with the `table`\n   */\n  setPlugin<P extends keyof PblNgridPluginExtension>(name: P, plugin: PblNgridPluginExtension[P]): (table: _PblNgridComponent<any>) => void {\n    if (!PLUGIN_STORE.has(name)) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error(`Unknown plugin ${name}.`);\n      }\n      return;\n    }\n    if (this.plugins.has(name)) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error(`Plugin ${name} is already registered for this grid.`);\n      }\n      return;\n    }\n    this.plugins.set(name, plugin);\n    return (tbl: _PblNgridComponent<any>) => this.grid === tbl && this.plugins.delete(name);\n  }\n\n  /**\n   * Checks if the grid is declared in a location within the DI that has access to an ancestor token.\n   * For example, if we want to use `createPlugin()` only if the grid is defined in a module that has a specific parent module imported into it\n   * we will use `hasAncestor(MyParentModule)`\n   */\n  hasAncestor(token: any) {\n    return !!this.injector.get(token, null, InjectFlags.Optional);\n  }\n\n  createPlugin<P extends keyof PblNgridPluginExtensionFactories>(name: P): PblNgridPluginExtension[P];\n  createPlugin<P extends keyof PblNgridPluginExtension>(name: P): PblNgridPluginExtension[P];\n  createPlugin<P extends (keyof PblNgridPluginExtensionFactories & keyof PblNgridPluginExtension)>(name: P): PblNgridPluginExtension[P] {\n    if (!PLUGIN_STORE.has(name)) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error(`Unknown plugin ${name}.`);\n      }\n      return;\n    }\n    const metadata = PLUGIN_STORE.get(name);\n    const methodName = metadata.factory;\n    if (!methodName) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error(`Invalid plugin configuration for ${name}, no factory metadata.`);\n      }\n      return;\n    } else if (typeof metadata.target[methodName] !== 'function') {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error(`Invalid plugin configuration for ${name}, factory metadata does not point to a function.`);\n      }\n      return;\n    }\n    return metadata.target[methodName](this.grid, this.context.injector);\n  }\n}\n","import {\n  AfterViewInit, ChangeDetectorRef, Injector, OnInit,\n  Directive,\n  ElementRef,\n  Optional,\n  DoCheck,\n  OnDestroy,\n  ViewContainerRef,\n  ViewChild,\n  ComponentRef,\n  Inject,\n} from '@angular/core';\nimport { unrx } from '@pebula/ngrid/core';\n\nimport { _PblNgridComponent, PBL_NGRID_COMPONENT } from '../../tokens';\nimport { PblNgridPluginController } from '../../ext/plugin-control';\nimport { EXT_API_TOKEN, PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\nimport { moveItemInArrayExt } from '../column/management/column-store';\nimport { GridRowType, PblRowTypeToCellTypeMap } from './types';\nimport { PblRowTypeToColumnTypeMap } from '../column/management';\n\nexport const PBL_NGRID_BASE_ROW_TEMPLATE  = `<ng-container #viewRef></ng-container>`;\n\n// tslint:disable-next-line: no-conflicting-lifecycle\n@Directive()\nexport abstract class PblNgridBaseRowComponent<TRowType extends GridRowType, T = any> implements OnInit, DoCheck, AfterViewInit, OnDestroy {\n\n  grid: _PblNgridComponent<T>;\n\n  @ViewChild('viewRef', { read: ViewContainerRef, static: true }) _viewRef: ViewContainerRef;\n\n  readonly element: HTMLElement;\n\n  get height() {\n    return this.element.getBoundingClientRect().height;\n  }\n\n  get cellsLength() { return this._cells.length; }\n\n  /**\n   * An attached row will run change detection on it's children.\n   * All rows are attached by default.\n   */\n  get attached(): boolean { return this._attached; }\n\n  abstract readonly rowType: TRowType;\n\n  abstract get rowIndex(): number;\n\n  protected _extApi: PblNgridInternalExtensionApi<T>;\n  protected _cells: ComponentRef<PblRowTypeToCellTypeMap<TRowType>>[] = [];\n\n  protected cellInjector: Injector;\n\n  private _attached = true;\n\n  constructor(@Inject(PBL_NGRID_COMPONENT) @Optional() grid: _PblNgridComponent<T>,\n              readonly cdRef: ChangeDetectorRef,\n              elementRef: ElementRef<HTMLElement>) {\n    this.element = elementRef.nativeElement;\n    if (grid) {\n      this.grid = grid;\n    }\n    this.onCtor();\n  }\n\n  ngOnInit() {\n    if (!this.grid) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error(`When a grid row is used outside the scope of a grid, you must provide the grid instance.`);\n      }\n    }\n    this.resolveTokens();\n    this.element.setAttribute('data-rowtype', this.rowType);\n    this._extApi.rowsApi.addRow(this)\n  }\n\n  ngAfterViewInit(): void {\n    for (const c of this._extApi.columnStore.getColumnsOf(this)) {\n      this._createCell(c);\n    }\n    this.detectChanges();\n  }\n\n  ngDoCheck(): void {\n    if (this._attached && this.grid) {\n      this.detectChanges();\n    }\n  }\n\n  ngOnDestroy(): void {\n    unrx.kill(this);\n    this._extApi?.rowsApi.removeRow(this);\n  }\n\n  /**\n   * Marks the row as attached.\n   * Rows are attached by default.\n   * An attached row takes part in the change detection process\n   */\n  _attach(): boolean {\n    if (!this._attached) {\n      this._attached = true;\n      return true;\n    }\n    return false;\n  }\n\n  /**\n   * Marks the row as detached.\n   * A detached row DOWS NOT take part in the change detection process.\n   *\n   * Usually when the rendering engine cache row elements for performance, these should be detached when cached and re-attached when returned into view.\n   */\n  _detach(): boolean {\n    if (this._attached) {\n      this._attached = false;\n      return true;\n    }\n    return false;\n  }\n\n  _createCell(column: PblRowTypeToColumnTypeMap<TRowType>, atIndex?: number) {\n    if (!this.canCreateCell || this.canCreateCell(column, atIndex)) {\n      const cell = this.createComponent(column, atIndex);\n      cell.instance.setOwner(this);\n      if (this.cellCreated) {\n        this.cellCreated(column, cell);\n      }\n    }\n  }\n\n  _destroyCell(cellOrCellIndex: number | ComponentRef<PblRowTypeToCellTypeMap<TRowType>>) {\n    const cell = typeof cellOrCellIndex === 'number' ? this._cells[cellOrCellIndex] : cellOrCellIndex;\n    if (cell) {\n      const index = this._cells.indexOf(cell);\n      if (!this.canDestroyCell || this.canDestroyCell(cell)) {\n        const len = this._cells.length;\n        this._viewRef.remove(index);\n        if (len === this._cells.length) {\n          this._cells.splice(index, 1);\n        }\n        if (this.cellDestroyed) {\n          this.cellDestroyed(cell, index);\n        }\n      }\n    }\n  }\n\n  _moveCell(fromIndex: number, toIndex: number) {\n    const cmp = this._cells[fromIndex];\n    if (cmp) {\n      if (!this.canMoveCell || this.canMoveCell(fromIndex, toIndex, cmp)) {\n        this._viewRef.move(cmp.hostView, toIndex);\n        moveItemInArrayExt(this._cells, fromIndex, toIndex, (previousItem, currentItem, previousIndex, currentIndex) => {\n          if (this.cellMoved) {\n            this.cellMoved(previousItem, currentItem, previousIndex, currentIndex);\n          }\n        });\n      }\n    }\n  }\n\n  protected abstract detectChanges();\n  protected abstract onCtor();\n\n  protected canCreateCell?(column: PblRowTypeToColumnTypeMap<TRowType>, atIndex?: number): boolean;\n  protected canDestroyCell?(cell: ComponentRef<PblRowTypeToCellTypeMap<TRowType>>): boolean;\n  protected canMoveCell?(fromIndex: number, toIndex: number, cell: ComponentRef<PblRowTypeToCellTypeMap<TRowType>>): boolean;\n  protected cellCreated?(column: PblRowTypeToColumnTypeMap<TRowType>, cell: ComponentRef<PblRowTypeToCellTypeMap<TRowType>>);\n  protected cellDestroyed?(cell: ComponentRef<PblRowTypeToCellTypeMap<TRowType>>, previousIndex: number);\n  protected cellMoved?(previousItem: ComponentRef<PblRowTypeToCellTypeMap<TRowType>>, currentItem: ComponentRef<PblRowTypeToCellTypeMap<TRowType>>, previousIndex: number, currentIndex: number);\n\n  protected createComponent(column: PblRowTypeToColumnTypeMap<TRowType>, atIndex?: number) {\n    const viewRefLength = this._viewRef.length;\n    if (!atIndex && atIndex !== 0) {\n      atIndex = viewRefLength;\n    }\n    atIndex = Math.min(viewRefLength, atIndex);\n    const cell = this._viewRef.createComponent(this._extApi.rowsApi.cellFactory.getComponentFactory(this), atIndex, this.cellInjector);\n    this._cells.splice(atIndex, 0, cell);\n    cell.onDestroy(() => this._cells.splice(this._cells.indexOf(cell), 1));\n    return cell;\n  }\n\n  /**\n   * Resolves the extensions API and the injector to be used when creating cells.\n   */\n  protected resolveTokens() {\n    // The cells require the extApi and grid to live on the DI tree.\n    // In the case of row it might not be there since the row is defined outside of the grid somewhere\n    // Row's are defined view templates so their DI tree depended on their location hence we need to verify\n    // that we can get the extApi from the viewRef's injector, if so, great if not we need to extend the injector we use\n    // to build cells.\n    const injector = this._viewRef?.injector;\n\n    const extApi = injector?.get<PblNgridInternalExtensionApi<T>>(EXT_API_TOKEN, null);\n    if (!extApi) {\n      // _extApi might be here already...\n      this._extApi = this._extApi || PblNgridPluginController.find(this.grid).extApi as PblNgridInternalExtensionApi<T>;\n      this.cellInjector = Injector.create({\n        providers: [\n          { provide: PBL_NGRID_COMPONENT, useValue: this.grid },\n          { provide: this.grid.constructor, useValue: this.grid },\n          { provide: EXT_API_TOKEN, useValue: this._extApi },\n        ],\n        parent: injector,\n      });\n    } else {\n      this._extApi = this._extApi || extApi;\n      this.cellInjector = injector;\n    }\n  }\n\n}\n","import { EmbeddedViewRef } from '@angular/core';\nimport { _ViewRepeaterItemInsertArgs } from '@angular/cdk/collections';\nimport { PblRowContext } from '../context/row';\nimport { PblNgridRowComponent } from './row.component';\n\nlet currentItemArgs: _ViewRepeaterItemInsertArgs<PblRowContext<any>>;\nlet currentRow: PblNgridRowComponent;\n\nclass RowToRepeaterBridge {\n\n  bridgeRow(row: PblNgridRowComponent): Omit<_ViewRepeaterItemInsertArgs<PblRowContext<any>>, 'templateRef'> {\n    const itemArgs = currentItemArgs;\n    currentItemArgs = undefined;\n    currentRow = row;\n    return itemArgs;\n  }\n\n  bridgeContext<C extends PblRowContext<any>>(itemArgs: _ViewRepeaterItemInsertArgs<PblRowContext<any>>, createView: () => EmbeddedViewRef<C>): EmbeddedViewRef<C> {\n    currentRow = undefined;\n    currentItemArgs = itemArgs;\n    const view = createView();\n    if (view.rootNodes[0] !== currentRow.element) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error(`Invalid view state, current row element is not the current rendered element!`);\n      }\n    }\n    currentRow = currentItemArgs = undefined;\n    return view;\n  }\n}\n\nexport const rowContextBridge = new RowToRepeaterBridge();\n","import { ChangeDetectionStrategy, Component, ComponentRef, ViewChild, ViewContainerRef, ViewEncapsulation, OnDestroy, OnInit } from '@angular/core';\nimport { CdkRow } from '@angular/cdk/table';\n\nimport { StylingDiffer, StylingDifferOptions, unrx } from '@pebula/ngrid/core';\n\nimport { PblRowContext } from '../context/index';\nimport { PblNgridCellComponent } from '../cell/cell.component';\nimport { PblColumn } from '../column/model';\nimport { PblNgridBaseRowComponent } from './base-row.component';\nimport { PblNgridColumnDef } from '../column/directives/column-def';\nimport { rowContextBridge } from './row-to-repeater-bridge';\nimport { PblNgridPluginController } from '../../ext/plugin-control';\nimport { PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\n\nexport const PBL_NGRID_ROW_TEMPLATE = '<ng-content select=\".pbl-ngrid-row-prefix\"></ng-content><ng-container #viewRef></ng-container><ng-content select=\".pbl-ngrid-row-suffix\"></ng-content>';\n\n@Component({\n  selector: 'pbl-ngrid-row[row]',\n  template: PBL_NGRID_ROW_TEMPLATE,\n  host: { // tslint:disable-line:no-host-metadata-property\n    'class': 'cdk-row pbl-ngrid-row',\n    'role': 'row',\n  },\n  providers: [\n    { provide: CdkRow, useExisting: PblNgridRowComponent }\n  ],\n  exportAs: 'pblNgridRow',\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n})\nexport class PblNgridRowComponent<T = any> extends PblNgridBaseRowComponent<'data', T> implements OnInit, OnDestroy {\n\n  @ViewChild('viewRef', { read: ViewContainerRef, static: true }) _viewRef: ViewContainerRef;\n\n  readonly rowType = 'data' as const;\n\n  get rowIndex(): number { return this._rowIndex; }\n  /** Indicates if intersection observer is on, detecting outOfView state for us */\n  private observerMode = true;\n\n  context: PblRowContext<T>;\n\n  protected prevRow: T | undefined;\n  protected currRow: T | undefined;\n\n  private _classDiffer: StylingDiffer<{ [klass: string]: true }>;\n  private _lastClass: Set<string>;\n  private _rowIndex: number;\n  private outOfView = false;\n\n  ngOnInit(): void {\n    super.ngOnInit();\n    this.updateRow();\n    // Doing nothing if IntersectionObserver is enable, otherwise updates the initial state\n    this.updateOutOfView();\n  }\n\n  ngOnDestroy(): void {\n    super.ngOnDestroy();\n    this.context?.detachRow(this);\n  }\n\n  updateRow() {\n    if (this.currRow !== this.context.$implicit) {\n      this.prevRow = this.currRow;\n      this.currRow = this.context.$implicit;\n\n      if (this.currRow) {\n        if (this.grid.rowClassUpdate && this.grid.rowClassUpdateFreq === 'item') {\n          this.updateHostClass();\n        }\n        this.identityUpdated();\n      }\n      return true;\n    }\n    return false;\n  }\n\n  getCell(index: number): PblNgridCellComponent | undefined {\n    return this._cells[index]?.instance;\n  }\n\n  getCellById(id: string): PblNgridCellComponent | undefined {\n    const cellViewIndex = this._extApi.columnApi.renderIndexOf(id);\n    return this._cells[cellViewIndex]?.instance;\n  }\n\n  /**\n   * Rebuild the cells rendered.\n   * This should be called when the columns have changed and new columns created in the column store.\n   *\n   * The new columns are new instances, clones of the previous columns and they DONT have a column definition!\n   * This method will iterate over existing cells, updating each cell with the new column now in it's location and creating a column def for it.\n   * If there are more cells rendered then in the store, it will remove those extra cells\n   * If there are less cells rendered then in the store, it will create new ones.\n   * This will ensure we don't create or remove cells unless we need to, saving on DOM operations.\n   */\n  _rebuildCells() {\n    const columns = this._extApi.columnStore.getColumnsOf(this);\n    this.context._rebuildCells(this._extApi.columnStore.allColumns);\n    const targetLen = columns.length;\n    for (let i = 0; i < targetLen; i++) {\n      const cellCmpRef = this._cells[i];\n      if (!cellCmpRef) {\n        this._createCell(columns[i]);\n      } else {\n        this.attachColumn(columns[i], cellCmpRef);\n      }\n    }\n\n    let currentLen = this.cellsLength;\n    while (currentLen > targetLen) {\n      this._destroyCell(--currentLen);\n    }\n\n    this.detectChanges();\n\n  }\n\n  /**\n   * Updates the outOfView state of this row and sync it with the context\n   * If the context's state is different from the new outOfView state, will invoke a change detection cycle.\n   * @internal\n   */\n  _setOutOfViewState(outOfView: boolean) {\n    if (this.outOfView !== outOfView) {\n      this.outOfView = outOfView;\n      if (this.context?.outOfView !== outOfView) {\n        this.context.outOfView = outOfView;\n        // TODO: If scrolling, mark the row for check and update only after scroll is done\n        this.ngDoCheck();\n      }\n    }\n  }\n\n  /**\n   * Updates the `outOfView` flag of the context attached to this row\n   *\n   * This method is backward compatible to support browser without the IntersectionObservable API.\n   *\n   * If the browser DOES NOT support IntersectionObserver it will calculate the state using bounding rect APIs (force param has no effect, always true).\n   * If the browser support IntersectionObserver it will do nothing when force is not set to true but when * set to true it will use\n   * the IntersectionObserver `takeRecords` method to update the outOfView state.\n   *\n   * > NOTE that this method has a direct impact on performance as it uses DOM apis that trigger layout reflows.\n   * Use with caution.\n   */\n  updateOutOfView(force?: boolean): void {\n    if (!this.observerMode || force) {\n      this._extApi.rowsApi.forceUpdateOutOfView(this);\n    }\n  }\n\n  protected onCtor() {\n    const { context, index } = rowContextBridge.bridgeRow(this);\n    this.grid = context.grid;\n    this._extApi = PblNgridPluginController.find(this.grid).extApi as PblNgridInternalExtensionApi<T>;\n    this._rowIndex = index;\n    this.context = context;\n    this.context.attachRow(this);\n  }\n\n  protected detectChanges() {\n    if (this.grid.rowClassUpdate && this.grid.rowClassUpdateFreq === 'ngDoCheck') {\n      this.updateHostClass();\n    }\n    for (const cell of this._cells) {\n      // TODO: the cells are created through code which mean's that they don't belong\n      // to the CD tree and we need to manually mark them for checking\n      // We can customize the diffing, detect context changes internally and only trigger these cells which have changed!\n      cell.instance.setContext(this.context);\n      cell.changeDetectorRef.detectChanges();\n    }\n  }\n\n  protected updateHostClass(): void {\n    const el = this.element;\n\n    // if there is an updater, work with it\n    // otherwise, clear previous classes that got applied (assumed a live binding change of the updater function)\n    // users should be aware to tear down the updater only when they want to stop this feature, if the goal is just to toggle on/off\n    // it's better to set the frequency to `none` and return nothing from the function (replace it) so the differ is not nuked.\n    if (this.grid.rowClassUpdate) {\n      if (!this._classDiffer) {\n        this._classDiffer = new StylingDiffer<{ [klass: string]: true }>(\n          'NgClass',\n          StylingDifferOptions.TrimProperties | StylingDifferOptions.AllowSubKeys | StylingDifferOptions.AllowStringValue | StylingDifferOptions.ForceAsMap,\n        );\n        this._lastClass = new Set<string>();\n      }\n\n      const newValue = this.grid.rowClassUpdate(this.context);\n      this._classDiffer.setInput(newValue);\n\n      if (this._classDiffer.updateValue()) {\n        const lastClass = this._lastClass;\n        this._lastClass = new Set<string>();\n\n        const value = this._classDiffer.value || {};\n\n        for (const key of Object.keys(value)) {\n          if (value[key]) {\n            el.classList.add(key);\n            this._lastClass.add(key);\n          } else {\n            el.classList.remove(key);\n          }\n          lastClass.delete(key);\n        }\n        if (lastClass.size > 0) {\n          for (const key of lastClass.values()) {\n            el.classList.remove(key);\n          }\n        }\n      }\n    } else if (this._classDiffer) {\n      const value = this._classDiffer.value || {};\n      this._classDiffer = this._lastClass = undefined;\n\n      for (const key of Object.keys(value)) {\n        el.classList.remove(key);\n      }\n    }\n  }\n\n  protected cellCreated(column: PblColumn, cell: ComponentRef<PblNgridCellComponent>) {\n    this.attachColumn(column, cell);\n  }\n\n  protected cellDestroyed(cell: ComponentRef<PblNgridCellComponent>, previousIndex: number) {\n    unrx.kill(this, cell.instance.column);\n  }\n\n  protected cellMoved(previousItem: ComponentRef<PblNgridCellComponent>, currentItem: ComponentRef<PblNgridCellComponent>, previousIndex: number, currentIndex: number) {\n    currentItem.instance.syncColumn();\n    this.context.updateCell(previousItem.instance.cellCtx.clone(currentItem.instance.column));\n    currentItem.changeDetectorRef.markForCheck();\n  }\n\n  protected identityUpdated() {\n    this.element.setAttribute('row-id', this.context.dsIndex as any);\n    this.element.setAttribute('row-key', this.context.identity);\n  }\n\n  protected attachColumn(column: PblColumn, cell: ComponentRef<PblNgridCellComponent>) {\n    if (!column.columnDef) {\n      new PblNgridColumnDef(this._extApi).column = column;\n      column.columnDef.name = column.id;\n    }\n    cell.instance.setColumn(column);\n    cell.instance.setContext(this.context);\n  }\n}\n","import { ChangeDetectionStrategy, Component, ElementRef, Input, ViewEncapsulation, Optional, ComponentRef, Attribute, ChangeDetectorRef, OnDestroy, OnInit, Inject } from '@angular/core';\nimport { CdkHeaderRow } from '@angular/cdk/table';\nimport { PblMetaRowDefinitions, unrx } from '@pebula/ngrid/core';\n\nimport { _PblNgridComponent, PBL_NGRID_COMPONENT } from '../../tokens';\nimport { PblNgridBaseRowComponent, PBL_NGRID_BASE_ROW_TEMPLATE } from './base-row.component';\nimport { PblColumn } from '../column/model';\nimport { PblNgridMetaRowService, PblMetaRow } from '../meta-rows/meta-row.service';\nimport { PblNgridHeaderCellComponent } from '../cell/header-cell.component';\nimport { applyMetaRowClass, initColumnOrMetaRow, setRowVisibility } from './utils';\nimport { PblNgridColumnDef } from '../column/directives/column-def';\n\n/**\n * The row that represents the columns of the grid.\n * There are only 2 column rows in a grid, the top (header) and bottom (footer), both optional.\n */\n@Component({\n  selector: 'pbl-ngrid-column-row',\n  template: PBL_NGRID_BASE_ROW_TEMPLATE,\n  host: { // tslint:disable-line:no-host-metadata-property\n    'role': 'row',\n  },\n  providers: [\n    { provide: CdkHeaderRow, useExisting: PblNgridColumnRowComponent }\n  ],\n  changeDetection: ChangeDetectionStrategy.Default,\n  encapsulation: ViewEncapsulation.None,\n})\nexport class PblNgridColumnRowComponent extends PblNgridBaseRowComponent<'header' | 'footer', PblMetaRowDefinitions> implements PblMetaRow, OnInit, OnDestroy {\n\n  @Input() set row(value: PblMetaRowDefinitions) { this.updateRow(value); }\n\n  get rowIndex(): number { return 0; }\n\n  get meta(): PblMetaRowDefinitions { return this._meta; }\n  set meta(value: PblMetaRowDefinitions) { this._meta = value; } // TODO: remove when removing pblMetaRow\n\n  readonly rowType: 'header' | 'footer';\n  readonly element: HTMLElement;\n  readonly isFooter: boolean;\n  readonly gridWidthRow: boolean;\n  private _meta: PblMetaRowDefinitions;\n\n  constructor(@Inject(PBL_NGRID_COMPONENT) @Optional() grid: _PblNgridComponent,\n              cdRef: ChangeDetectorRef,\n              el: ElementRef<HTMLElement>,\n              private readonly metaRows: PblNgridMetaRowService,\n              @Attribute('footer') isFooter: any,\n              @Attribute('gridWidthRow') gridWidthRow: any) {\n    super(grid, cdRef, el);\n    this.gridWidthRow = gridWidthRow !== null;\n    this.isFooter = isFooter !== null;\n    this.rowType = this.isFooter ? 'footer' : 'header';\n  }\n\n  ngOnInit(): void {\n    super.ngOnInit();\n    this.handleVisibility();\n  }\n\n  ngOnDestroy(): void {\n    this.metaRows.removeMetaRow(this);\n    super.ngOnDestroy();\n  }\n\n  updateSize() {\n    if (this.gridWidthRow) {\n      for (const c of this._cells as ComponentRef<PblNgridHeaderCellComponent>[]) {\n        c.instance.updateSize();\n      }\n    }\n  }\n\n  protected onCtor() { }\n\n  protected detectChanges() {\n    for (const cell of this._cells) {\n      // TODO: the cells are created through code which mean's that they don't belong\n      // to the CD tree and we need to manually mark them for checking\n      // We can customize the diffing, detect context changes internally and only trigger these cells which have changed!\n      cell.changeDetectorRef.markForCheck();\n    }\n  }\n\n  protected updateRow(value: PblMetaRowDefinitions) {\n    if (value !== this._meta) {\n      applyMetaRowClass(this.metaRows, this, this.element, this._meta, value);\n    }\n  }\n\n  protected cellCreated(column: PblColumn, cell: ComponentRef<PblNgridHeaderCellComponent>) {\n    if (!column.columnDef) {\n      new PblNgridColumnDef(this._extApi).column = column;\n      column.columnDef.name = column.id;\n    }\n    cell.instance.setColumn(column, this.gridWidthRow);\n  }\n\n  protected cellDestroyed(cell: ComponentRef<PblNgridHeaderCellComponent>, previousIndex: number) {\n    unrx.kill(this, cell.instance.column);\n  }\n\n  private handleVisibility() {\n    initColumnOrMetaRow(this.element, this.isFooter);\n    const key = this.isFooter ? 'showFooter' : 'showHeader';\n    if (!this._extApi.grid[key]) {\n      setRowVisibility(this.element, false);\n    }\n\n    this._extApi.propChanged\n      .pipe(unrx(this))\n      .subscribe( event => {\n        if (event.source === this._extApi.grid && event.key === key) {\n          setRowVisibility(this.element, event.prev === false)\n        }\n      });\n  }\n}\n","import {\n  ChangeDetectionStrategy,\n  Component,\n  ElementRef,\n  Inject,\n  Input,\n  ViewEncapsulation,\n  Optional,\n  Attribute,\n  ComponentRef,\n  ChangeDetectorRef,\n  OnInit,\n  OnDestroy,\n} from '@angular/core';\nimport { CdkHeaderRow } from '@angular/cdk/table';\nimport { PblMetaRowDefinitions } from '@pebula/ngrid/core';\n\nimport { _PblNgridComponent, PBL_NGRID_COMPONENT } from '../../tokens';\nimport { PblNgridMetaCellComponent } from '../cell/meta-cell.component';\nimport { PblNgridBaseRowComponent, PBL_NGRID_BASE_ROW_TEMPLATE } from './base-row.component';\nimport { PblColumnGroup, PblMetaColumn } from '../column/model';\nimport { PblNgridMetaRowService, PblMetaRow } from '../meta-rows/meta-row.service';\nimport { PblColumnStoreMetaRow } from '../column/management';\nimport { applyMetaRowClass, initColumnOrMetaRow } from './utils';\n\n@Component({\n  selector: 'pbl-ngrid-meta-row',\n  template: PBL_NGRID_BASE_ROW_TEMPLATE,\n  // tslint:disable-next-line: no-host-metadata-property\n  host: {\n    'role': 'row',\n  },\n  providers: [\n    { provide: CdkHeaderRow, useExisting: PblNgridMetaRowComponent }\n  ],\n  changeDetection: ChangeDetectionStrategy.Default,\n  encapsulation: ViewEncapsulation.None,\n})\nexport class PblNgridMetaRowComponent extends PblNgridBaseRowComponent<'meta-header' | 'meta-footer'> implements PblMetaRow, OnInit, OnDestroy {\n\n  get row() { return this._row; }\n  @Input() set row(value: PblColumnStoreMetaRow) { this.updateRow(value); }\n\n  get rowIndex(): number { return this._row.rowDef.rowIndex; }\n\n  get meta(): PblMetaRowDefinitions { return this._meta; }\n  set meta(value: PblMetaRowDefinitions) { this._meta = value; } // TODO: remove when removing pblMetaRow\n\n  readonly rowType: 'meta-header' | 'meta-footer';\n  readonly element: HTMLElement;\n  readonly isFooter: boolean;\n  readonly gridWidthRow: boolean = false;\n  private _meta: PblMetaRowDefinitions;\n  private _row: PblColumnStoreMetaRow;\n\n  constructor(@Inject(PBL_NGRID_COMPONENT) @Optional() grid: _PblNgridComponent,\n              cdRef: ChangeDetectorRef,\n               el: ElementRef<HTMLElement>,\n              private readonly metaRows: PblNgridMetaRowService,\n              @Attribute('footer') isFooter: any) {\n    super(grid, cdRef, el);\n    this.isFooter = isFooter !== null;\n    this.rowType = this.isFooter ? 'meta-footer' : 'meta-header';\n  }\n\n  ngOnInit(): void {\n    super.ngOnInit();\n    this.handleVisibility();\n  }\n\n  ngOnDestroy(): void {\n    this.metaRows.removeMetaRow(this);\n    super.ngOnDestroy();\n  }\n\n  protected onCtor() { }\n\n  protected detectChanges() {\n    for (const cell of this._cells) {\n      // TODO: the cells are created through code which mean's that they don't belong\n      // to the CD tree and we need to manually mark them for checking\n      // We can customize the diffing, detect context changes internally and only trigger these cells which have changed!\n      cell.changeDetectorRef.markForCheck();\n    }\n  }\n\n  protected cellCreated(column: PblMetaColumn | PblColumnGroup, cell: ComponentRef<PblNgridMetaCellComponent>) {\n    cell.instance.setColumn(column, this.isFooter);\n  }\n\n  protected cellDestroyed?(cell: ComponentRef<PblNgridMetaCellComponent>, previousIndex: number) {\n\n  }\n\n  protected cellMoved?(previousItem: ComponentRef<PblNgridMetaCellComponent>, currentItem: ComponentRef<PblNgridMetaCellComponent>, previousIndex: number, currentIndex: number) {\n\n  }\n\n  protected updateRow(value: PblColumnStoreMetaRow) {\n    if (value !== this._row) {\n      applyMetaRowClass(this.metaRows, this, this.element, this._meta, value?.rowDef);\n      if (this._row?.isGroup) {\n        this.element.classList.remove('pbl-meta-group-row');\n      }\n      if (value?.isGroup) {\n        this.element.classList.add('pbl-meta-group-row');\n      }\n      this._row = value;\n    }\n  }\n\n  private handleVisibility() {\n    initColumnOrMetaRow(this.element, this.isFooter);\n    // TODO: add row visibility API like in columns and react to changes\n    // - Remove showHeader showFooter inputs and move them to directives and inside let them use the API\n  }\n}\n","import { ComponentFactory, Injectable, InjectionToken, Inject } from '@angular/core';\nimport { PblNgridBaseRowComponent } from './base-row.component';\nimport { GridRowType, PblRowTypeToCellTypeMap } from './types';\n\nexport const NGRID_CELL_FACTORY = new InjectionToken<PblNgridCellFactoryResolver>('PblNgridCellFactoryResolver');\n\nexport type PblNgridCellFactoryMap = { [P in GridRowType]: ComponentFactory<PblRowTypeToCellTypeMap<P>>; };\n\n@Injectable()\nexport class PblNgridCellFactoryResolver<T = any> {\n  private readonly factoryMap: PblNgridCellFactoryMap;\n\n  constructor(@Inject(NGRID_CELL_FACTORY) factoryMap: any) {\n    this.factoryMap = factoryMap;\n  }\n\n  getComponentFactory<TRowType extends GridRowType>(row: PblNgridBaseRowComponent<TRowType, T>): ComponentFactory<PblRowTypeToCellTypeMap<TRowType>> {\n    return this.factoryMap[row.rowType] as any;\n  }\n}\n","import { Subject, Observable } from 'rxjs';\nimport { Injectable, Optional, SkipSelf, OnDestroy } from '@angular/core';\n\nimport {\n  unrx,\n  PblNgridMultiRegistryMap,\n  PblNgridSingleRegistryMap,\n  RegistryChangedEvent,\n}  from '@pebula/ngrid/core';\n\n/**\n * A Registry for templates of table parts.\n *\n * The registry is hierarchical, where each instance of a registry has a parent which allows cascading templates.\n * The hierarchy is manged by angular DI.\n *\n * > The root registry does not have a parent.\n *\n * Each instance of a registry (including root) is a hierarchy by itself, composed of 2 internal levels.\n * The first level (L1 below) is used for fixed templates, the second level (L2 below) is used for dynamic templates.\n *\n * - Root Registry\n *   - Child Registry\n *     - ChildOfChild Registry\n *\n * In the example above there are 3 registries: Root, Child and ChildOfChild.\n *\n * When searching for a template in `ChildOfChild` it will search in the following order (top to bottom):\n *   - ChildOfChild\n *   - Child\n *   - Root\n *\n * If a registry does not contain the template the search will move to the next one.\n */\n@Injectable({ providedIn: 'root' })\nexport class PblNgridRegistryService implements OnDestroy {\n\n  readonly changes: Observable<RegistryChangedEvent[]>;\n  get parent(): PblNgridRegistryService | undefined { return this._parent; }\n\n  protected root: PblNgridRegistryService & { bufferedData?: RegistryChangedEvent[] };\n\n  protected _multi: { [K in keyof PblNgridMultiRegistryMap]: Array<PblNgridMultiRegistryMap[K]> } = { } as any;\n  protected _multiDefaults: PblNgridMultiRegistryMap = {}  as any;\n  protected _singles: PblNgridSingleRegistryMap = {}  as any;\n\n  protected readonly changes$: Subject<RegistryChangedEvent[]>;\n\n  constructor(@Optional() @SkipSelf() private _parent?: PblNgridRegistryService) {\n    this.changes$ = new Subject();\n    this.changes = this.changes$.asObservable();\n    if (this._parent) {\n      this._parent.changes.pipe(unrx(this)).subscribe(this.changes$);\n      this.root = this._parent.root;\n    } else {\n      this.root = this;\n    }\n  }\n\n  getRoot(): PblNgridRegistryService { return this.root; }\n\n  /**\n   * Returns the registered value for the single `kind`.\n   * If not found will try to search the parent.\n   */\n  getSingle<P extends keyof PblNgridSingleRegistryMap>(kind: P): PblNgridSingleRegistryMap[P] | undefined {\n    return this._singles[kind] || (this._parent && this._parent.getSingle(kind));\n  }\n\n  setSingle<P extends keyof PblNgridSingleRegistryMap>(kind: P, value: PblNgridSingleRegistryMap[P] | undefined): void {\n    const previous = this.getSingle(kind);\n    if (value !== previous) {\n      this._singles[kind] = value;\n      this.emitChanges({ op: value ? 'add' : 'remove', type: kind, value });\n    }\n  }\n\n  /**\n   * Returns the registered default value for the multi `kind`.\n   * If not found will try to search the parent.\n   */\n  getMultiDefault<P extends keyof PblNgridMultiRegistryMap>(kind: P): PblNgridMultiRegistryMap[P] | undefined {\n    return this._multiDefaults[kind] || (this._parent && this._parent.getMultiDefault(kind));\n  }\n\n  setMultiDefault<P extends keyof PblNgridMultiRegistryMap>(kind: P, value: PblNgridMultiRegistryMap[P] | undefined): void {\n    const previous = this.getMultiDefault(kind);\n    if (value !== previous) {\n      this._multiDefaults[kind] = value;\n      this.emitChanges({ op: value ? 'add' : 'remove', type: kind, value });\n    }\n  }\n\n  /**\n   * Returns the registered values for the multi `kind`.\n   * If not found WILL NOT search the parent.\n   */\n  getMulti<T extends keyof PblNgridMultiRegistryMap>(kind: T): Array<PblNgridMultiRegistryMap[T]> | undefined {\n    return this._multi[kind] as Array<PblNgridMultiRegistryMap[T]>;\n  }\n\n  addMulti<T extends keyof PblNgridMultiRegistryMap>(kind: T, cellDef: PblNgridMultiRegistryMap[T]): void {\n    const multi = this.getMulti(kind) || (this._multi[kind] = []);\n    multi.push(cellDef);\n    if (cellDef.name === '*') {\n      this.setMultiDefault(kind, cellDef);\n    }\n    this.emitChanges({ op: 'add', type: kind, value: cellDef })\n  }\n\n  removeMulti<T extends keyof PblNgridMultiRegistryMap>(kind: T, cellDef: PblNgridMultiRegistryMap[T]): void {\n    const multi = this.getMulti(kind);\n    if (multi) {\n      const idx = multi.indexOf(cellDef);\n      if (idx > -1) {\n        multi.splice(idx, 1);\n      }\n      this.emitChanges({ op: 'remove', type: kind, value: cellDef })\n    }\n  }\n\n  /**\n   * Iterate over all multi-registry value of the provided `kind` ascending order, starting from the last ancestor (this registry) up to\n   * the root parent.\n   *\n   * Each time a collection for the `kind` is found the handler is invoked and then repeating the process on the parent.\n   * If the `kind` does not exist the handler is not called moving on to the next parent.\n   *\n   * To bail out (stop the process and don't iterate to the next parent), return true from the handler.\n   *\n   * @returns The number of times that handler was invoked, i.e 0 means no matches.\n   */\n  forMulti<T extends keyof PblNgridMultiRegistryMap>(kind: T,\n                                                     handler: ( (values: Array<PblNgridMultiRegistryMap[T]>) => boolean | void)): number {\n    let registry: PblNgridRegistryService = this;\n    let hasSome = 0;\n    while (registry) {\n      const values = registry.getMulti(kind);\n      if (values) {\n        hasSome++;\n        if (handler(values) === true) {\n          return;\n        }\n      }\n      registry = registry.parent;\n    }\n    return hasSome;\n  }\n\n  ngOnDestroy(): void {\n    this.changes$.complete();\n    unrx.kill(this);\n  }\n\n  /**\n   * Delay all notifications sent through `changes` and buffer then until next call to `bufferEnd()`.\n   * When `bufferEnd()` is called it will flush all changes.\n   *\n   * > It's important to note that buffering does not freeze the registry, adding and removing templates will change the\n   * registry and will effect queries. Buffering block the `changes` event stream and nothing more.\n   */\n  bufferStart(): void {\n    if (!this.root.bufferedData) {\n      this.root.bufferedData = [];\n    }\n  }\n\n  bufferEnd(): void {\n    if (this.root.bufferedData) {\n      const data = this.root.bufferedData;\n      this.root.bufferedData = undefined;\n      this.emitChanges(data);\n    }\n  }\n\n  private emitChanges(events: RegistryChangedEvent | RegistryChangedEvent[]): void {\n    const e = Array.isArray(events) ? events : [events];\n    if (this.root.bufferedData) {\n      this.root.bufferedData.push(...e)\n    } else {\n      this.changes$.next(e);\n    }\n  }\n}\n","import { Directive, Inject, IterableDiffers, Optional, TemplateRef, OnInit } from '@angular/core';\nimport { CdkRowDef, CDK_TABLE } from '@angular/cdk/table';\n\nimport { _PblNgridComponent } from '../../tokens';\nimport { PblNgridRegistryService } from '../registry/registry.service';\nimport { PblNgridRowContext } from '../context/types';\nimport { PblNgridPluginController } from '../../ext/plugin-control';\nimport { EXT_API_TOKEN, PblNgridExtensionApi } from '../../ext/grid-ext-api';\n\n@Directive({\n  selector: '[pblNgridRowDef]',\n  inputs: ['columns: pblNgridRowDefColumns', 'when: pblNgridRowDefWhen'],\n  providers: [\n    {provide: CdkRowDef, useExisting: PblNgridRowDef},\n  ]\n})\nexport class PblNgridRowDef<T> extends CdkRowDef<T> {\n\n  /**\n   * Empty rows.\n   * We don't supply column rows to the CdkTable so it will not render them.\n   * We render internally.\n   */\n  columns: Iterable<string> = [];\n\n  constructor(template: TemplateRef<PblNgridRowContext<T>>,\n              _differs: IterableDiffers,\n              protected registry: PblNgridRegistryService,\n              @Inject(CDK_TABLE) @Optional() public _table?: any) {\n    super(template, _differs, _table);\n  }\n\n  getColumnsDiff() {\n    return null;\n  }\n\n  clone(): this {\n    const clone = Object.create(this);\n    // Provide 0 column so CdkTable will not render.\n    this.columns = [];\n    return clone;\n  }\n}\n\n/**\n * A directive for quick replacements of the row container component.\n *\n * When used inside the content of the grid:\n *\n * ```html\n * <pbl-ngrid [dataSource]=\"ds\" [columns]=\"columns\">\n *   <pbl-ngrid-row *pblNgridRowOverride=\"let row;\" row></pbl-ngrid-row>\n * </pbl-ngrid>\n * ```\n *\n * However, when used outside of the grid you must provide a reference to the grid so it can register as a template:\n *\n * ```html\n * <pbl-ngrid-row *pblNgridRowOverride=\"let row; grid: myGrid\" row></pbl-ngrid-row>\n * <pbl-ngrid #myGrid [dataSource]=\"ds\" [columns]=\"columns\"></pbl-ngrid>\n * ```\n */\n@Directive({\n  selector: '[pblNgridRowOverride]',\n  inputs: ['columns: pblNgridRowDefColumns', 'when: pblNgridRowDefWhen', 'grid: pblNgridRowDefGrid'],\n  providers: [\n    {provide: CdkRowDef, useExisting: PblNgridRowDef},\n  ]\n})\nexport class PblNgridRowOverride<T> extends PblNgridRowDef<T> implements OnInit {\n\n  grid: _PblNgridComponent<T>;\n\n  constructor(template: TemplateRef<PblNgridRowContext<T>>,\n              _differs: IterableDiffers,\n              registry: PblNgridRegistryService,\n              @Inject(EXT_API_TOKEN) @Optional() private extApi?: PblNgridExtensionApi<T>) {\n    super(template, _differs, registry, extApi?.cdkTable);\n    this.when = () => true;\n  }\n\n  ngOnInit() {\n    if (!this.extApi && this.grid) {\n      this.extApi = PblNgridPluginController.find(this.grid).extApi;\n    }\n    this.extApi?.cdkTable.addRowDef(this);\n  }\n}\n","import { _PblNgridComponent } from '../../tokens';\nimport { PblNgridExtensionApi } from '../../ext/grid-ext-api';\nimport { CellContextState, ExternalCellContextState, PblNgridCellContext, PblNgridMetaCellContext, PblNgridRowContext } from './types';\nimport { PblColumn, PblMetaColumn } from '../column/model';\nimport { PblRowContext } from './row';\n\nexport class MetaCellContext<T = any, TCol extends PblMetaColumn | PblColumn = PblMetaColumn> implements PblNgridMetaCellContext<T, TCol> {\n  col: TCol;\n  grid: _PblNgridComponent<any>;\n  get $implicit(): MetaCellContext<T, TCol> { return this; }\n\n  protected constructor() {}\n\n  // workaround, we need a parameter-less constructor since @ngtools/webpack@8.0.4\n  // Non @Injectable classes are now getting addded with hard reference to the ctor params which at the class creation point are undefined\n  // forwardRef() will not help since it's not inject by angular, we instantiate the class..\n  // probably due to https://github.com/angular/angular-cli/commit/639198499973e0f437f059b3c933c72c733d93d8\n  static create<T = any, TCol extends PblMetaColumn | PblColumn = PblMetaColumn>(col: TCol, grid: _PblNgridComponent<T>): MetaCellContext<T, TCol> {\n    const instance = new MetaCellContext<T, TCol>();\n    instance.col = col;\n    instance.grid = grid;\n    return instance;\n  }\n\n}\n\nexport class PblCellContext<T = any> implements PblNgridCellContext<T> {\n  get $implicit(): PblCellContext<T> { return this; }\n  get row(): T { return this.rowContext.$implicit; };\n  get value(): any { return this.col.getValue(this.row); }\n  set value(v: any) { this.col.setValue(this.row, v); }\n\n  get rowContext(): PblNgridRowContext<T> { return this._rowContext; }\n  get editing(): boolean { return this._editing; }\n  get focused(): boolean { return this._focused; }\n  get selected(): boolean { return this._selected; }\n\n  readonly grid: _PblNgridComponent<any>;\n  readonly index: number;\n\n  private _editing = false;\n  private _focused = false;\n  private _selected = false;\n  private _external = {};\n\n  private _rowContext: PblRowContext<T>;\n  public col: PblColumn;\n  private extApi: PblNgridExtensionApi<T>;\n\n  protected constructor() { }\n\n  // workaround, we need a parameter-less constructor since @ngtools/webpack@8.0.4\n  // Non @Injectable classes are now getting addded with hard reference to the ctor params which at the class creation point are undefined\n  // forwardRef() will not help since it's not inject by angular, we instantiate the class..\n  // probably due to https://github.com/angular/angular-cli/commit/639198499973e0f437f059b3c933c72c733d93d8\n  static create<T = any>(rowContext: PblRowContext<T>, col: PblColumn, extApi: PblNgridExtensionApi<T>): PblCellContext<T> {\n    const instance = new PblCellContext<T>();\n\n    instance._rowContext = rowContext;\n    instance.col = col;\n    instance.extApi = extApi;\n\n    Object.defineProperties(instance, {\n      grid: { value: extApi.grid },\n      index: { value: extApi.grid.columnApi.indexOf(col) },\n    });\n\n    return instance;\n  }\n\n  static defaultState<T = any>(): CellContextState<T> {\n    return { editing: false, focused: false, selected: false, external: {} };\n  }\n\n  clone(col?: PblColumn): PblCellContext<T> {\n    const ctx = PblCellContext.create<T>(this._rowContext, col || this.col, this.extApi);\n    ctx.fromState(this.getState(), this._rowContext, true);\n    return ctx;\n  }\n\n  getExternal<P extends keyof ExternalCellContextState>(key: P): ExternalCellContextState[P] {\n    return this._external[key];\n  }\n\n  setExternal<P extends keyof ExternalCellContextState>(key: P, value: ExternalCellContextState[P], saveState = false) {\n    this._external[key] = value;\n    if (saveState) {\n      this._rowContext.saveState();\n    }\n  }\n\n  getState(): CellContextState<T> {\n    return {\n      editing: this._editing,\n      focused: this._focused,\n      selected: this._selected,\n      external: this._external,\n    };\n  }\n\n  fromState(state: CellContextState<T>, rowContext: PblRowContext<T>, skipRowUpdate?: boolean): void {\n    const requiresReset = !skipRowUpdate && this._editing === state.editing;\n\n    this._rowContext = rowContext;\n    this._editing = state.editing;\n    this._focused = state.focused;\n    this._selected = state.selected;\n    this._external = state.external;\n\n    if (requiresReset) {\n      rowContext.updateCell(this);\n    }\n  }\n\n  startEdit(markForCheck?: boolean): void {\n    if (this.col.editorTpl && !this.editing) {\n      this._editing = true;\n      this._rowContext.updateCell(this);\n      if (markForCheck) {\n        this.grid.rowsApi.syncRows('data', true, this.rowContext.index);\n      }\n    }\n  }\n\n  stopEdit(markForCheck?: boolean): void {\n    if (this.editing && !this.grid.viewport.isScrolling) {\n      this._editing = false;\n      this._rowContext.updateCell(this);\n      if (markForCheck) {\n        this.grid.rowsApi.syncRows('data', this.rowContext.index);\n      }\n    }\n  }\n}\n","import { _PblNgridComponent } from '../../tokens';\nimport { PblColumn } from '../column/model';\nimport { PblNgridExtensionApi } from '../../ext/grid-ext-api';\nimport { CellContextState, RowContextState, PblNgridRowContext, ExternalRowContextState } from './types';\nimport { PblCellContext } from './cell';\nimport { PblNgridRowComponent } from '../row/row.component';\n\nexport class PblRowContext<T> implements PblNgridRowContext<T> {\n  /** Data for the row that this cell is located within. */\n  get $implicit(): T | undefined { return this._$implicit; }\n  set $implicit(value: T | undefined) {\n    if (this._$implicit !== value) {\n      this._$implicit = value;\n      this.updateRowData();\n    }\n  };\n\n  /** Index of the data object in the provided data array. */\n  index?: number;\n  /** Index of the data object in the provided data array. */\n  get dataIndex() { return this.index; }\n  set dataIndex(value: number) { this.index = value; }\n\n  /** Index location of the rendered row that this cell is located within. */\n  renderIndex?: number;\n  /** Length of the number of total rows. */\n  count?: number;\n  /** True if this cell is contained in the first row. */\n  first?: boolean;\n  /** True if this cell is contained in the last row. */\n  last?: boolean;\n  /** True if this cell is contained in a row with an even-numbered index. */\n  even?: boolean;\n  /** True if this cell is contained in a row with an odd-numbered index. */\n  odd?: boolean;\n\n  /** The index at the datasource */\n  dsIndex: number;\n  identity: any;\n  firstRender: boolean;\n  outOfView: boolean;\n\n  readonly grid: _PblNgridComponent<T>;\n  private _attachedRow: PblNgridRowComponent<T>;\n  private external: any = {};\n\n  /**\n   * Returns the length of cells context stored in this row\n   */\n  get length(): number { return this.cells?.length ?? 0; }\n\n  private cells: PblCellContext<T>[];\n\n  private _$implicit?: T;\n  private _updatePending: boolean;\n\n  constructor(_data: T, dsIndex: number, private extApi: PblNgridExtensionApi<T>) {\n    this.dsIndex = dsIndex;\n    this._$implicit = _data;\n    this.identity = this.extApi.contextApi.getRowIdentity(dsIndex, _data);\n\n    this.grid = extApi.grid;\n    this._rebuildCells(this.extApi.grid.columnApi.columns);\n  }\n\n  static defaultState<T = any>(identity: any, dsIndex: number, cellsCount: number): RowContextState<T> {\n    const cells: CellContextState<T>[] = [];\n    for (let i = 0; i < cellsCount; i++) {\n      cells.push(PblCellContext.defaultState());\n    }\n    return { identity, dsIndex, cells, firstRender: true, external: {} };\n  }\n\n  getExternal<P extends keyof ExternalRowContextState>(key: P): ExternalRowContextState[P] {\n    return this.external[key];\n  }\n\n  setExternal<P extends keyof ExternalRowContextState>(key: P, value: ExternalRowContextState[P], saveState = false) {\n    this.external[key] = value;\n    if (saveState) {\n      this.saveState();\n    }\n  }\n\n  getState(): RowContextState<T> {\n    return {\n      identity: this.identity,\n      dsIndex: this.dsIndex,\n      firstRender: this.firstRender,\n      cells: this.cells.map( c => c.getState() ),\n      external: this.external,\n    };\n  }\n\n  fromState(state: RowContextState<T>): void {\n    this.firstRender = state.firstRender;\n    this.dsIndex = state.dsIndex;\n    this.external = state.external;\n    for (let i = 0, len = this.cells.length; i < len; i++) {\n      this.cells[i].fromState(state.cells[i], this);\n    }\n  }\n\n  saveState() {\n    this.extApi.contextApi.saveState(this);\n  }\n\n  /**\n   * Returns the cell context for the column at the specified position.\n   * > The position is relative to ALL columns (NOT RENDERED COLUMNS)\n   */\n  cell(index: number | PblColumn): PblCellContext<T> | undefined {\n    const idx = typeof index === 'number' ? index : this.grid.columnApi.indexOf(index);\n    return this.cells[idx];\n  }\n\n  getCells(): PblCellContext<T>[] {\n    return (this.cells && this.cells.slice()) || [];\n  }\n\n  updateCell(cell: PblCellContext<T>): void {\n    this.cells[cell.index] = cell.clone();\n  }\n\n  attachRow(row: PblNgridRowComponent<T>) {\n    this.detachRow(this._attachedRow);\n    this._attachedRow = row;\n    if (this._updatePending) {\n      this.updateRowData();\n    }\n  }\n\n  detachRow(row: PblNgridRowComponent<T>) {\n    if (row && this._attachedRow === row) {\n      this.saveState();\n      this._attachedRow = undefined;\n    }\n  }\n\n  _rebuildCells(columns: PblColumn[]) {\n    const cells = this.cells = [];\n    const len = columns.length;\n\n    for (let columnIndex = 0; columnIndex < len; columnIndex++) {\n      const cellContext = PblCellContext.create<T>(this, columns[columnIndex], this.extApi);\n      cells.push(cellContext);\n    }\n  }\n\n  private updateRowData() {\n    if (this._attachedRow) {\n      this._updatePending = false;\n      this.extApi.contextApi._updateRowContext(this, this._attachedRow.rowIndex);\n      this._attachedRow.updateRow();\n    } else {\n      this._updatePending = !!this._$implicit;\n    }\n  }\n}\n","import { PblNgridExtensionApi } from '../../ext/grid-ext-api';\nimport { ColumnApi } from '../column/management';\nimport { RowContextState, PblNgridCellContext, CellReference, GridDataPoint } from './types';\nimport { PblRowContext } from './row';\nimport { PblCellContext } from './cell';\n\n/** IE 11 compatible matches implementation. */\nexport function matches(element: Element, selector: string): boolean {\n  return element.matches ?\n      element.matches(selector) :\n      (element as any)['msMatchesSelector'](selector);\n}\n\n/** IE 11 compatible closest implementation. */\nexport function closest(element: EventTarget|Element|null|undefined, selector: string): Element | null {\n  if (!(element instanceof Node)) { return null; }\n\n  let curr: Node|null = element;\n  while (curr != null && !(curr instanceof Element && matches(curr, selector))) {\n    curr = curr.parentNode;\n  }\n\n  return (curr || null) as Element|null;\n}\n\nexport function findRowRenderedIndex(el: HTMLElement): number {\n  const rows = Array.from(closest(el, 'pbl-cdk-table').querySelectorAll('pbl-ngrid-row'));\n  return rows.indexOf(el);\n}\n\nexport function findCellRenderedIndex(el: HTMLElement): [number, number] {\n  const rowEl = closest(el, 'pbl-ngrid-row') as HTMLElement;\n  const cells = Array.from(rowEl.querySelectorAll('pbl-ngrid-cell'));\n  return [ findRowRenderedIndex(rowEl), cells.indexOf(el) ];\n}\n\n/**\n * Resolves the context from one of the possible types in `CellReference`.\n * If the context is within the view it will return the `PblCellContext instance, otherwise it will\n * return a tuple with the first item being the row context state and the seconds item pointing to the cell index.\n *\n * If no context is found, returns undefined.\n */\nexport function resolveCellReference(cellRef: CellReference,\n                                     context: { viewCache: Map<number, PblRowContext<any>>, cache: Map<any, RowContextState>, columnApi: ColumnApi<any>, extApi: PblNgridExtensionApi }): PblCellContext | [RowContextState, number] | undefined {\n  let rowIdent: any;\n  let colIndex: number;\n\n  if (isGridDataPoint(cellRef)) {\n    rowIdent = cellRef.rowIdent;\n    colIndex = cellRef.colIndex;\n  } else if (isCellContext(cellRef)) {\n    rowIdent = cellRef.rowContext.identity;\n    colIndex = cellRef.index;\n  } else {\n    const [ r, c ] = findCellRenderedIndex(cellRef);\n    const rowContext = context.viewCache.get(r);\n    if (rowContext) {\n      const column = context.columnApi.findColumnAt(c);\n      const columnIndex = context.columnApi.indexOf(column);\n      return rowContext.cell(columnIndex);\n    } else {\n      return;\n    }\n  }\n\n  const rowState = context.cache.get(rowIdent);\n  if (rowState) {\n     const rowContext = context.extApi.grid.contextApi.findRowInView(rowState.identity);\n     if (rowContext) {\n       return rowContext.cell(colIndex);\n     } else {\n       const cellState = rowState.cells[colIndex];\n       if (cellState) {\n         return [ rowState, colIndex ];\n       }\n     }\n  }\n}\n\nfunction isGridDataPoint(obj: any): obj is GridDataPoint {\n  return 'rowIdent' in obj && 'colIndex' in obj;\n}\n\nfunction isCellContext(obj: any): obj is PblNgridCellContext {\n  return 'rowContext' in obj && 'index' in obj;\n}\n","import { BehaviorSubject, Subject, Observable, asapScheduler } from 'rxjs';\nimport { debounceTime, buffer, map, filter, take } from 'rxjs/operators';\nimport { ViewContainerRef } from '@angular/core';\n\nimport { ON_DESTROY, removeFromArray } from '@pebula/ngrid/core';\nimport { PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\nimport { PblColumn } from '../column/model';\nimport { ColumnApi } from '../column/management';\nimport {\n  RowContextState,\n  CellContextState,\n  PblNgridCellContext,\n  PblNgridRowContext,\n  CellReference,\n  GridDataPoint,\n  PblNgridFocusChangedEvent,\n  PblNgridSelectionChangedEvent\n} from './types';\nimport { findRowRenderedIndex, resolveCellReference } from './utils';\nimport { PblRowContext } from './row';\nimport { PblCellContext } from './cell';\n\nexport class ContextApi<T = any> {\n  private viewCache = new Map<number, PblRowContext<T>>();\n  private viewCacheGhost = new Set<any>();\n  private cache = new Map<any, RowContextState<T>>();\n  private vcRef: ViewContainerRef;\n  private columnApi: ColumnApi<T>;\n\n  private activeFocused: GridDataPoint;\n  private activeSelected: GridDataPoint[] = [];\n  private focusChanged$ = new BehaviorSubject<PblNgridFocusChangedEvent>({ prev: undefined, curr: undefined });\n  private selectionChanged$ = new Subject<PblNgridSelectionChangedEvent>();\n\n  /**\n   * Notify when the focus has changed.\n   *\n   * > Note that the notification is not immediate, it will occur on the closest micro-task after the change.\n   */\n  readonly focusChanged: Observable<PblNgridFocusChangedEvent> = this.focusChanged$\n    .pipe(\n      buffer<PblNgridFocusChangedEvent>(this.focusChanged$.pipe(debounceTime(0, asapScheduler))),\n      map( events => ({ prev: events[0].prev, curr: events[events.length - 1].curr }) )\n    );\n\n  /**\n   * Notify when the selected cells has changed.\n   */\n  readonly selectionChanged: Observable<PblNgridSelectionChangedEvent> = this.selectionChanged$.asObservable();\n\n  /**\n   * The reference to currently focused cell context.\n   * You can retrieve the actual context or context cell using `findRowInView` and / or `findRowInCache`.\n   *\n   * > Note that when virtual scroll is enabled the currently focused cell does not have to exist in the view.\n   * If this is the case `findRowInView` will return undefined, use `findRowInCache` instead.\n   */\n  get focusedCell(): GridDataPoint | undefined {\n    return this.activeFocused ? {...this.activeFocused } : undefined;\n  }\n\n  /**\n   * The reference to currently selected range of cell's context.\n   * You can retrieve the actual context or context cell using `findRowInView` and / or `findRowInCache`.\n   *\n   * > Note that when virtual scroll is enabled the currently selected cells does not have to exist in the view.\n   * If this is the case `findRowInView` will return undefined, use `findRowInCache` instead.\n   */\n  get selectedCells(): GridDataPoint[] {\n    return this.activeSelected.slice();\n  }\n\n  constructor(private extApi: PblNgridInternalExtensionApi<T>) {\n    this.columnApi = extApi.columnApi;\n    extApi.events\n      .pipe(\n        filter( e => e.kind === 'onDataSource'),\n        take(1),\n      ).subscribe(() => {\n        this.vcRef = extApi.cdkTable._rowOutlet.viewContainer;\n        this.syncViewAndContext();\n        extApi.cdkTable.onRenderRows.subscribe(() => this.syncViewAndContext());\n      });\n\n    extApi.events.pipe(ON_DESTROY).subscribe( e => this.destroy() );\n  }\n\n  /**\n   * Focus the provided cell.\n   * If a cell is not provided will un-focus (blur) the currently focused cell (if there is one).\n   * @param cellRef A Reference to the cell\n   */\n  focusCell(cellRef?: CellReference): void {\n    if (!cellRef) {\n      if (this.activeFocused) {\n        const { rowIdent, colIndex } = this.activeFocused;\n        this.activeFocused = undefined;\n        this.updateState(rowIdent, colIndex, { focused: false });\n        this.emitFocusChanged(this.activeFocused);\n        const rowContext = this.findRowInView(rowIdent);\n        if (rowContext) {\n          this.extApi.grid.rowsApi.syncRows('data', rowContext.index);\n        }\n      }\n    } else {\n      const ref = resolveCellReference(cellRef, this as any);\n      if (ref) {\n        this.focusCell();\n        if (ref instanceof PblCellContext) {\n          if (!ref.focused && !this.extApi.grid.viewport.isScrolling) {\n            this.updateState(ref.rowContext.identity, ref.index, { focused: true });\n\n            this.activeFocused = { rowIdent: ref.rowContext.identity, colIndex: ref.index };\n\n            this.selectCells( [ this.activeFocused ], true);\n\n            this.extApi.grid.rowsApi.syncRows('data', ref.rowContext.index);\n          }\n        } else {\n          this.updateState(ref[0].identity, ref[1], { focused: true });\n          this.activeFocused = { rowIdent: ref[0].identity, colIndex: ref[1] };\n        }\n        this.emitFocusChanged(this.activeFocused);\n      }\n    }\n  }\n\n  /**\n   * Select all provided cells.\n   * @param cellRef A Reference to the cell\n   * @param clearCurrent Clear the current selection before applying the new selection.\n   * Default to false (add to current).\n   */\n  selectCells(cellRefs: CellReference[], clearCurrent?: boolean): void {\n    const toMarkRendered = new Set<number>();\n\n    if (clearCurrent) {\n      this.unselectCells();\n    }\n\n    const added: GridDataPoint[] = [];\n\n    for (const cellRef of cellRefs) {\n      const ref = resolveCellReference(cellRef, this as any);\n      if (ref instanceof PblCellContext) {\n        if (!ref.selected && !this.extApi.grid.viewport.isScrolling) {\n          const rowIdent = ref.rowContext.identity\n          const colIndex = ref.index;\n          this.updateState(rowIdent, colIndex, { selected: true });\n\n          const dataPoint = { rowIdent, colIndex };\n          this.activeSelected.push(dataPoint);\n          added.push(dataPoint);\n\n          toMarkRendered.add(ref.rowContext.index);\n        }\n      } else if (ref) {\n        const [ rowState, colIndex ] = ref;\n        if (!rowState.cells[colIndex].selected) {\n          this.updateState(rowState.identity, colIndex, { selected: true });\n          this.activeSelected.push( { rowIdent: rowState.identity, colIndex } );\n        }\n      }\n    }\n\n    if (toMarkRendered.size > 0) {\n      this.extApi.grid.rowsApi.syncRows('data', ...Array.from(toMarkRendered.values()));\n    }\n\n    this.selectionChanged$.next({ added, removed: [] });\n  }\n\n  /**\n   * Unselect all provided cells.\n   * If cells are not provided will un-select all currently selected cells.\n   * @param cellRef A Reference to the cell\n   */\n  unselectCells(cellRefs?: CellReference[]): void {\n    const toMarkRendered = new Set<number>();\n    let toUnselect: CellReference[] = this.activeSelected;\n    let removeAll = true;\n\n    if(Array.isArray(cellRefs)) {\n      toUnselect = cellRefs;\n      removeAll = false;\n    } else {\n      this.activeSelected = [];\n    }\n\n    const removed: GridDataPoint[] = [];\n\n    for (const cellRef of toUnselect) {\n      const ref = resolveCellReference(cellRef, this as any);\n      if (ref instanceof PblCellContext) {\n        if (ref.selected) {\n          const rowIdent = ref.rowContext.identity\n          const colIndex = ref.index;\n          this.updateState(rowIdent, colIndex, { selected: false });\n          if (!removeAll) {\n            const wasRemoved = removeFromArray(this.activeSelected, item => item.colIndex === colIndex && item.rowIdent === rowIdent);\n            if (wasRemoved) {\n              removed.push({ rowIdent, colIndex })\n            }\n          }\n          toMarkRendered.add(ref.rowContext.index);\n        }\n      } else if (ref) {\n        const [ rowState, colIndex ] = ref;\n        if (rowState.cells[colIndex].selected) {\n          this.updateState(rowState.identity, colIndex, { selected: false });\n          if (!removeAll) {\n            const wasRemoved = removeFromArray(this.activeSelected, item => item.colIndex === colIndex && item.rowIdent === rowState.identity);\n            if (wasRemoved) {\n              removed.push({ rowIdent: rowState.identity, colIndex })\n            }\n          }\n        }\n      }\n    }\n\n    if (toMarkRendered.size > 0) {\n      this.extApi.grid.rowsApi.syncRows('data', ...Array.from(toMarkRendered.values()));\n    }\n\n    this.selectionChanged$.next({ added: [], removed });\n  }\n\n  /**\n   * Clears the entire context, including view cache and memory cache (rows out of view)\n   * @param syncView If true will sync the view and the context right after clearing which will ensure the view cache is hot and synced with the actual rendered rows\n   * Some plugins will expect a row to have a context so this might be required.\n   * The view and context are synced every time rows are rendered so make sure you set this to true only when you know there is no rendering call coming down the pipe.\n   */\n  clear(syncView?: boolean): void {\n    this.viewCache.clear();\n    this.viewCacheGhost.clear();\n    this.cache.clear();\n    if (syncView === true) {\n      for (const r of this.extApi.rowsApi.dataRows()) {\n        this.viewCache.set(r.rowIndex, r.context);\n        // we're clearing the existing view state on the component\n        // If in the future we want to update state and not clear, remove this one\n        // and instead just take the state and put it in the cache.\n        // e.g. if on column swap we want to swap cells in the context...\n        r.context.fromState(this.getCreateState(r.context));\n        this.syncViewAndContext();\n      }\n    }\n  }\n\n  saveState(context: PblNgridRowContext<T>) {\n    if (context instanceof PblRowContext) {\n      this.cache.set(context.identity, context.getState());\n    }\n  }\n\n  getRow(row: number | HTMLElement): PblNgridRowContext<T> | undefined {\n    const index = typeof row === 'number' ? row : findRowRenderedIndex(row);\n    return this.rowContext(index);\n  }\n\n  getCell(cell: HTMLElement | GridDataPoint): PblNgridCellContext | undefined\n  /**\n   * Return the cell context for the cell at the point specified\n   * @param row\n   * @param col\n   */\n  getCell(row: number, col: number): PblNgridCellContext | undefined;\n  getCell(rowOrCellElement: number | HTMLElement | GridDataPoint, col?: number): PblNgridCellContext | undefined {\n    if (typeof rowOrCellElement === 'number') {\n      const rowContext = this.rowContext(rowOrCellElement);\n      if (rowContext) {\n        return rowContext.cell(col);\n      }\n    } else {\n      const ref = resolveCellReference(rowOrCellElement, this as any);\n      if (ref instanceof PblCellContext) {\n        return ref;\n      }\n    }\n  }\n\n  getDataItem(cell: CellReference): any {\n    const ref = resolveCellReference(cell, this as any);\n    if (ref instanceof PblCellContext) {\n      return ref.col.getValue(ref.rowContext.$implicit);\n    } else if (ref) {\n      const row = this.extApi.grid.ds.source[ref[0].dsIndex];\n      const column = this.extApi.grid.columnApi.findColumnAt(ref[1]);\n      return column.getValue(row);\n    }\n  }\n\n  createCellContext(renderRowIndex: number, column: PblColumn): PblCellContext<T> {\n    const rowContext = this.rowContext(renderRowIndex);\n    const colIndex = this.columnApi.indexOf(column);\n    return rowContext.cell(colIndex);\n  }\n\n  rowContext(renderRowIndex: number): PblRowContext<T> | undefined {\n    return this.viewCache.get(renderRowIndex);\n  }\n\n  updateState(rowIdentity: any, columnIndex: number, cellState: Partial<CellContextState<T>>): void;\n  updateState(rowIdentity: any, rowState: Partial<RowContextState<T>>): void;\n  updateState(rowIdentity: any, rowStateOrCellIndex: Partial<RowContextState<T>> | number, cellState?: Partial<CellContextState<T>>): void {\n    const currentRowState = this.cache.get(rowIdentity);\n    if (currentRowState) {\n      if (typeof rowStateOrCellIndex === 'number') {\n        const currentCellState = currentRowState.cells[rowStateOrCellIndex];\n        if (currentCellState) {\n          Object.assign(currentCellState, cellState);\n        }\n      } else {\n        Object.assign(currentRowState, rowStateOrCellIndex);\n      }\n      const rowContext = this.findRowInView(rowIdentity);\n      if (rowContext) {\n        rowContext.fromState(currentRowState);\n      }\n    }\n  }\n\n  /**\n   * Try to find a specific row, using the row identity, in the current view.\n   * If the row is not in the view (or even not in the cache) it will return undefined, otherwise returns the row's context instance (`PblRowContext`)\n   * @param rowIdentity The row's identity. If a specific identity is used, please provide it otherwise provide the index of the row in the datasource.\n   */\n  findRowInView(rowIdentity: any): PblRowContext<T> | undefined {\n    const rowState = this.cache.get(rowIdentity);\n    if (rowState) {\n      const renderRowIndex = rowState.dsIndex - this.extApi.grid.ds.renderStart;\n      const rowContext = this.viewCache.get(renderRowIndex);\n      if (rowContext && rowContext.identity === rowIdentity) {\n        return rowContext;\n      }\n    }\n  }\n\n  /**\n   * Try to find a specific row context, using the row identity, in the context cache.\n   * Note that the cache does not hold the context itself but only the state that can later be used to retrieve a context instance. The context instance\n   * is only used as context for rows in view.\n   * @param rowIdentity The row's identity. If a specific identity is used, please provide it otherwise provide the index of the row in the datasource.\n   */\n  findRowInCache(rowIdentity: any): RowContextState<T> | undefined;\n  /**\n   * Try to find a specific row context, using the row identity, in the context cache.\n   * Note that the cache does not hold the context itself but only the state that can later be used to retrieve a context instance. The context instance\n   * is only used as context for rows in view.\n   * @param rowIdentity The row's identity. If a specific identity is used, please provide it otherwise provide the index of the row in the datasource.\n   * @param offset When set, returns the row at the offset from the row with the provided row identity. Can be any numeric value (e.g 5, -6, 4).\n   * @param create Whether to create a new state if the current state does not exist.\n   */\n  findRowInCache(rowIdentity: any, offset: number, create: boolean): RowContextState<T> | undefined;\n  findRowInCache(rowIdentity: any, offset?: number, create?: boolean): RowContextState<T> | undefined {\n    const rowState = this.cache.get(rowIdentity);\n\n    if (!offset) {\n      return rowState;\n    } else {\n      const dsIndex = rowState.dsIndex + offset;\n      const identity = this.getRowIdentity(dsIndex);\n      if (identity !== null) {\n        let result = this.findRowInCache(identity);\n        if (!result && create && dsIndex < this.extApi.grid.ds.length) {\n          result = PblRowContext.defaultState(identity, dsIndex, this.columnApi.columns.length);\n          this.cache.set(identity, result);\n        }\n        return result;\n      }\n    }\n  }\n\n  getRowIdentity(dsIndex: number, rowData?: T): string | number | null {\n    const { ds } = this.extApi.grid;\n    const { primary } = this.extApi.columnStore;\n\n    const row = rowData || ds.source[dsIndex];\n    if (!row) {\n      return null;\n    } else {\n      return primary ? primary.getValue(row) : dsIndex;\n    }\n  }\n\n  /** @internal */\n  _createRowContext(data: T, renderRowIndex: number): PblRowContext<T> {\n    const context = new PblRowContext<T>(data, this.extApi.grid.ds.renderStart + renderRowIndex, this.extApi);\n    context.fromState(this.getCreateState(context));\n    this.addToViewCache(renderRowIndex, context);\n    return context;\n  }\n\n  _updateRowContext(rowContext: PblRowContext<T>, renderRowIndex: number) {\n    const dsIndex = this.extApi.grid.ds.renderStart + renderRowIndex;\n    const identity = this.getRowIdentity(dsIndex, rowContext.$implicit);\n    if (rowContext.identity !== identity) {\n      rowContext.saveState();\n      rowContext.dsIndex = dsIndex;\n      rowContext.identity = identity;\n      rowContext.fromState(this.getCreateState(rowContext));\n      this.addToViewCache(renderRowIndex, rowContext)\n    }\n  }\n\n  private addToViewCache(rowIndex: number, rowContext: PblRowContext<T>) {\n    this.viewCache.set(rowIndex, rowContext);\n    this.viewCacheGhost.delete(rowContext.identity);\n  }\n\n  private getCreateState(context: PblRowContext<T>) {\n    let state = this.cache.get(context.identity);\n    if (!state) {\n      state = PblRowContext.defaultState(context.identity, context.dsIndex, this.columnApi.columns.length);\n      this.cache.set(context.identity, state);\n    }\n    return state;\n  }\n\n  private emitFocusChanged(curr: PblNgridFocusChangedEvent['curr']): void {\n    this.focusChanged$.next({\n      prev: this.focusChanged$.value.curr,\n      curr,\n    });\n  }\n\n  private destroy(): void {\n    this.focusChanged$.complete();\n    this.selectionChanged$.complete();\n  }\n\n  private syncViewAndContext() {\n    this.viewCacheGhost.forEach( ident => {\n      if (!this.findRowInView(ident)) {\n        this.cache.get(ident).firstRender = false\n      }\n    });\n    this.viewCacheGhost = new Set(Array.from(this.viewCache.values()).filter( v => v.firstRender ).map( v => v.identity ));\n  }\n}\n\n","import { Directive, TemplateRef, OnInit, OnDestroy } from '@angular/core';\nimport { PblNgridMultiRegistryMap } from '@pebula/ngrid/core';\n\nimport { PblNgridRegistryService } from '../registry.service';\n\n@Directive()\nexport abstract class PblNgridMultiTemplateRegistry<T, TKind extends keyof PblNgridMultiRegistryMap> implements OnInit, OnDestroy {\n  abstract readonly name: string;\n  abstract readonly kind: TKind;\n\n  constructor(public tRef: TemplateRef<T>, protected registry: PblNgridRegistryService) { }\n\n  ngOnInit(): void {\n    this.registry.addMulti(this.kind, this as any);\n  }\n\n  ngOnDestroy(): void {\n    this.registry.removeMulti(this.kind, this as any);\n  }\n}\n","import { Directive, TemplateRef, Injector, Input } from '@angular/core';\n\nimport { PblNgridRegistryService } from '../../registry/registry.service';\nimport { PblColumn } from '../../column/model';\nimport { MetaCellContext } from '../../context/index';\nimport { PblNgridHeaderCellComponent } from '../../cell/header-cell.component'\nimport { PblNgridMultiTemplateRegistry } from './multi-template.directives';\nimport { PblNgridMultiComponentRegistry } from './multi-component';\n\nexport class PblNgridDataHeaderExtensionContext<T = any> extends MetaCellContext<T, PblColumn> {\n  readonly injector: Injector\n\n  protected constructor() { super(); }\n\n  // workaround, we need a parameter-less constructor since @ngtools/webpack@8.0.4\n  // Non @Injectable classes are now getting addded with hard reference to the ctor params which at the class creation point are undefined\n  // forwardRef() will not help since it's not inject by angular, we instantiate the class..\n  // probably due to https://github.com/angular/angular-cli/commit/639198499973e0f437f059b3c933c72c733d93d8\n  static createDateHeaderCtx<T = any>(headerCell: PblNgridHeaderCellComponent<PblColumn>, injector: Injector): PblNgridDataHeaderExtensionContext<T> {\n    const instance = new PblNgridDataHeaderExtensionContext<T>();\n\n    instance.col = headerCell.columnDef.column;\n    instance.grid = headerCell.grid;\n    Object.defineProperty(instance, 'injector', { value: injector });\n    return instance;\n  }\n}\n\nexport interface PblNgridDataHeaderExtensionRef<T = any> {\n  shouldRender?(context: PblNgridDataHeaderExtensionContext<T>): boolean;\n}\n\n\n/**\n * A generic, multi-purpose template reference for data header extensions.\n * The template's context is `PblNgridDataHeaderExtensionContext`:\n *\n * ```ts\n * interface PblNgridDataHeaderExtensionContext {\n *   col: PblMetaColumn;\n *   grid: PblNgridComponent<any>;\n *   injector: Injector;\n * }\n * ```\n *\n * By default it will render if registered but it is possible to provide a predicate to conditionally load it.\n *\n * ```html\n * <div *pblNgridHeaderExtensionRef=\"let ctx\"></div>\n * ````\n *\n * Or with a `shouldRender` predicate:\n *\n * ```html\n * <div *pblNgridHeaderExtensionRef=\"shouldRender; let ctx\"></div>\n * ```\n *\n * And in the component the template is defined on:\n *\n * ```ts\n * class MyComponent {\n *\n *   shouldRender = (context: PblNgridDataHeaderExtensionContext) => {\n *     // Some code returning true or false\n *   }\n * }\n * ```\n *\n * Note that the `shouldRender` predicate is run once when the header initialize.\n */\n@Directive({ selector: '[pblNgridHeaderExtensionRef]' })\nexport class PblNgridHeaderExtensionRefDirective extends PblNgridMultiTemplateRegistry<PblNgridDataHeaderExtensionContext, 'dataHeaderExtensions'> implements PblNgridDataHeaderExtensionRef {\n  private static _id = 0;\n\n  readonly name: string = 'genericHeaderExtension-' + PblNgridHeaderExtensionRefDirective._id++;\n  readonly kind: 'dataHeaderExtensions' = 'dataHeaderExtensions';\n\n  @Input('pblNgridHeaderExtensionRef') shouldRender?: (context: PblNgridDataHeaderExtensionContext) => boolean;\n\n  constructor(tRef: TemplateRef<PblNgridDataHeaderExtensionContext>, registry: PblNgridRegistryService) { super(tRef, registry); }\n\n  static ngAcceptInputType_shouldRender: string | ( (context: PblNgridDataHeaderExtensionContext) => boolean );\n}\n\ndeclare module '@pebula/ngrid/core/lib/registry/types' {\n  interface PblNgridMultiRegistryMap {\n    dataHeaderExtensions?: (PblNgridMultiTemplateRegistry<PblNgridDataHeaderExtensionContext, 'dataHeaderExtensions'> & PblNgridDataHeaderExtensionRef)\n      | (PblNgridMultiComponentRegistry<any, 'dataHeaderExtensions'> & PblNgridDataHeaderExtensionRef);\n  }\n}\n","import { ComponentFactory, ComponentRef } from '@angular/core';\nimport { PblNgridMultiRegistryMap } from '@pebula/ngrid/core';\n\nimport { PblColumn } from '../../column/model';\nimport { PblNgridMetaCellContext } from '../../context/index';\n\nexport abstract class PblNgridMultiComponentRegistry<T, TKind extends keyof PblNgridMultiRegistryMap> {\n  abstract readonly name: string;\n  abstract readonly kind: TKind;\n\n  /**\n   * When set to true the component will be created with projected content.\n   * Setting to true does not ensure projection, the projection is determined by the context creating the component.\n   *\n   * For example, In the context of `dataHeaderExtensions` the projection will be the content of the cell, other implementations\n   * might not include a projection.\n   */\n  readonly projectContent?: boolean;\n\n  abstract getFactory(context: PblNgridMetaCellContext<any, PblColumn>): ComponentFactory<T>;\n  onCreated?(context: PblNgridMetaCellContext<any, PblColumn>, cmpRef: ComponentRef<T>): void;\n}\n","import { Directive, TemplateRef, OnInit, OnDestroy } from '@angular/core';\nimport { PblNgridSingleRegistryMap } from '@pebula/ngrid/core';\n\nimport { PblNgridRegistryService } from '../registry.service';\n\n@Directive()\nexport abstract class PblNgridSingleTemplateRegistry<T, TKind extends keyof PblNgridSingleRegistryMap> implements OnInit, OnDestroy {\n  abstract readonly kind: TKind;\n\n  constructor(public tRef: TemplateRef<T>, protected registry: PblNgridRegistryService) { }\n\n  ngOnInit(): void {\n    this.registry.setSingle(this.kind, this as any);\n  }\n\n  ngOnDestroy(): void {\n    this.registry.setSingle(this.kind,  undefined);\n  }\n}\n","import { Directive, TemplateRef } from '@angular/core';\n\nimport { _PblNgridComponent } from '../../../tokens';\nimport { PblNgridRegistryService } from '../registry.service';\nimport { PblNgridSingleTemplateRegistry } from './single-template.directives';\n\n/**\n * Marks the element as the display element when grid has no data.\n *\n * @example\n * ```html\n *   <pbl-ngrid>\n *     <div *pblNgridNoDataRef style=\"height: 100%; display: flex; align-items: center; justify-content: center\">\n *       <span>No Data</span>\n *     </div>\n *   </pbl-ngrid>\n * ```\n */\n@Directive({ selector: '[pblNgridNoDataRef]' })\nexport class PblNgridNoDataRefDirective extends PblNgridSingleTemplateRegistry<{ $implicit: _PblNgridComponent<any> }, 'noData'> {\n  readonly kind: 'noData' = 'noData';\n  constructor(tRef: TemplateRef<{ $implicit: _PblNgridComponent<any> }>, registry: PblNgridRegistryService) { super(tRef, registry); }\n}\n\ndeclare module '@pebula/ngrid/core/lib/registry/types' {\n  interface PblNgridSingleRegistryMap {\n    noData?: PblNgridNoDataRefDirective;\n  }\n}\n","import { Directive, TemplateRef } from '@angular/core';\n\nimport { _PblNgridComponent } from '../../../tokens';\nimport { PblNgridRegistryService } from '../registry.service';\nimport { PblNgridSingleTemplateRegistry } from './single-template.directives';\n\n/**\n * Marks the element as the display element for pagination\n */\n@Directive({ selector: '[pblNgridPaginatorRef]' })\nexport class PblNgridPaginatorRefDirective extends PblNgridSingleTemplateRegistry<{ $implicit: _PblNgridComponent<any> }, 'paginator'> {\n  readonly kind: 'paginator' = 'paginator';\n  constructor(tRef: TemplateRef<{ $implicit: _PblNgridComponent<any> }>, registry: PblNgridRegistryService) { super(tRef, registry); }\n}\n\ndeclare module '@pebula/ngrid/core/lib/registry/types' {\n  interface PblNgridSingleRegistryMap {\n    paginator?: PblNgridPaginatorRefDirective;\n  }\n}\n","import { Directive, Input, ElementRef } from '@angular/core';\nimport { StylingDiffer, StylingDifferOptions } from '@pebula/ngrid/core';\n\n/*\n    We're using `StylingDiffer`, which is an exact copy of the style differ used for `ngStyle` and `ngClass`.\n    The class is not exposed so we use a hard-copy.\n    `StylingDiffer` is used only when IVY is enabled but here we've adopted it to be used in both modes. (pre IVY and IVY)\n*/\n\n\n/**\n * Bind to the class / style attributes of the container of a cell template.\n * For class bindings use [ngridCellClass] and for style bindings use [ngridCellStyle].\n *\n * This is like [ngClass] or [ngStyle] but not for the host of the directive but to it's parent.\n *\n * - [ngridCellClass] accepts the same type of values that [ngClass] does.\n * - [ngridCellStyle] accepts the same type of values that [ngStyle] does.\n *\n * ## Example\n *\n * We want to create a new cell type called \"balance\" that represents the balance of a bank account.\n * We also want to have different background color, green if the account balance if positive and red if it's negative.\n *\n * ```html\n * <div *pblNgridCellTypeDef=\"'balance'; value as value\"\n *      [ngClass]=\"value < 0 ? 'balance-negative' : 'balance-positive'\">{{ value  }}\n * </div>\n * ```\n *\n * The example above will work but the background will not fill the entire cell, only the `div` it is applied on.\n * This is because the container of the `div` has internal styling that apply padding (among other styles) to the cell.\n *\n * The container is controlled internally by ngrid, but you can access it's style / class attributes using this directive.\n *\n * ```html\n * <div *pblNgridCellTypeDef=\"'balance'; value as value\"\n *      [ngridCellClass]=\"value < 0 ? 'balance-negative' : 'balance-positive'\">{{ value  }}\n * </div>\n * ```\n *\n * > Because style / class is applied on the parent and the parent can have multiple children it is possible to apply this directive\n * on multiple children, do not do this as it will have unexpected results.\n */\n@Directive({ selector: '[ngridCellStyle], [ngridCellClass]' })\nexport class PblNgridCellStyling {\n\n  @Input('ngridCellStyle') set style(value: { [key: string]: string }) {\n    if (!this._styleDiffer) {\n      this._styleDiffer = new StylingDiffer<{ [key: string]: string | null }>('NgStyle', StylingDifferOptions.AllowUnits);\n    }\n    this._styleDiffer.setInput(value);\n  }\n\n  @Input('ngridCellClass') set klass(value: string | string[] | Set<string> | { [klass: string]: any }) {\n    if (!this._classDiffer) {\n      this._classDiffer = new StylingDiffer<{ [klass: string]: true }>(\n        'NgClass',\n        StylingDifferOptions.TrimProperties | StylingDifferOptions.AllowSubKeys | StylingDifferOptions.AllowStringValue | StylingDifferOptions.ForceAsMap,\n      );\n    }\n    this._classDiffer.setInput(value);\n  }\n\n  private _styleDiffer: StylingDiffer<{ [key: string]: string | null }>;\n  private _classDiffer: StylingDiffer<{ [klass: string]: true }>;\n  private _parent: HTMLElement;\n  private _lastStyle = new Set<string>();\n  private _lastClass = new Set<string>();\n\n  constructor(private elRef: ElementRef<HTMLElement>) { }\n\n  ngAfterViewInit(): void {\n    this._parent = this.elRef.nativeElement.parentElement;\n    this.updateParent();\n  }\n\n  ngDoCheck(): void { this,this.updateParent(); }\n\n  private updateParent(): void {\n    if (this._parent) {\n      if (this._styleDiffer?.updateValue()) {\n        const lastStyle = this._lastStyle;\n        this._lastStyle = new Set<string>();\n        for (const key of Object.keys(this._styleDiffer.value)) {\n          this._parent.style[key] = this._styleDiffer.value[key];\n          lastStyle.delete(key);\n          this._lastStyle.add(key);\n        }\n        if (lastStyle.size > 0) {\n          for (const key of lastStyle.values()) {\n            this._parent.style[key] = null;\n          }\n        }\n      }\n\n      if (this._classDiffer?.updateValue()) {\n        const lastClass = this._lastClass;\n        this._lastClass = new Set<string>();\n        for (const key of Object.keys(this._classDiffer.value)) {\n          if (this._classDiffer.value[key]) {\n            this._parent.classList.add(key);\n            this._lastClass.add(key);\n          } else {\n            this._parent.classList.remove(key);\n          }\n          lastClass.delete(key);\n        }\n        if (lastClass.size > 0) {\n          for (const key of lastClass.values()) {\n            this._parent.classList.remove(key);\n          }\n        }\n      }\n    }\n  }\n}\n","import { uniqueColumnCss, uniqueColumnTypeCss } from '../utils/unique-column-css';\nimport { PblNgridColumnDef } from '../column/directives/column-def';\nimport { COLUMN } from '../column/model';\n\nexport function initCellElement(el: HTMLElement, column: COLUMN, prev?: COLUMN): void {\n  if (prev) {\n    // If IE 11 is dropped before we switch to setting a single class name, change to multi param\n    // with destructuring.\n    const classList = el.classList;\n    for (const className of prev.columnDef._columnCssClassName) {\n      classList.add(className);\n    }\n\n    el.classList.remove(uniqueColumnCss(prev.columnDef));\n    if (prev.type) {\n      el.classList.remove(uniqueColumnTypeCss(prev.type));\n    }\n    if (prev.css) {\n      const css = prev.css.split(' ');\n      for (const c of css) {\n        el.classList.remove(c);\n      }\n    }\n  }\n\n  // If IE 11 is dropped before we switch to setting a single class name, change to multi param\n  // with destructuring.\n  const classList = el.classList;\n  for (const className of column.columnDef._columnCssClassName) {\n    classList.add(className);\n  }\n  el.classList.add(uniqueColumnCss(column.columnDef));\n  if (column.type) {\n    el.classList.add(uniqueColumnTypeCss(column.type));\n  }\n  if (column.css) {\n    const css = column.css.split(' ');\n    for (const c of css) {\n      el.classList.add(c);\n    }\n  }\n}\n\nexport function initCellHeaderFooter(element: HTMLElement, isFooter: boolean) {\n  element.classList.add(...(isFooter ? ['cdk-footer-cell', 'pbl-ngrid-footer-cell'] : ['cdk-header-cell', 'pbl-ngrid-header-cell']));\n}\n\nexport function applyWidth(this: { columnDef: PblNgridColumnDef; el: HTMLElement }) {\n  this.columnDef.applyWidth(this.el);\n}\n\nexport function applySourceWidth(this: { columnDef: PblNgridColumnDef; el: HTMLElement }) {\n  this.columnDef.applySourceWidth(this.el);\n}\n","import { OnDestroy, ElementRef, Directive, Inject } from '@angular/core';\nimport { unrx } from '@pebula/ngrid/core';\n\nimport { EXT_API_TOKEN, PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\nimport { PblNgridBaseRowComponent } from '../row/base-row.component';\nimport { GridRowType } from '../row/types';\n\n@Directive()\nexport class PblNgridBaseCell<TRow extends PblNgridBaseRowComponent<GridRowType> = PblNgridBaseRowComponent<GridRowType>> implements OnDestroy {\n  el: HTMLElement;\n\n  get owner() { return this._owner; }\n\n  private _owner: TRow;\n\n  constructor(@Inject(EXT_API_TOKEN) protected extApi: PblNgridInternalExtensionApi, elementRef: ElementRef<HTMLElement>) {\n    this.el = elementRef.nativeElement;\n  }\n\n  setOwner(owner: TRow) {\n    this._owner = owner;\n  }\n\n  focus() {\n    this.el.focus({ preventScroll: true });\n    this.extApi.viewport._scrollIntoView(this.el);\n  }\n\n  ngOnDestroy(): void {\n    unrx.kill(this);\n  }\n}\n","import { _PblNgridComponent } from '../../../tokens';\nimport { PblNgridInternalExtensionApi } from '../../../ext/grid-ext-api';\nimport { PblColumn } from '../../column/model/column';\nimport { PblColumnSizeObserver } from './column-size-observer';\n\nconst PBL_NGRID_MAP = new Map<_PblNgridComponent<any>, PblNgridColumnSizeObserverGroup>();\n\n/**\n * A controller that groups columns of a grid and listens to resize events\n * and will notify the grid once resize occurs\n */\nexport class PblNgridColumnSizeObserverGroup {\n  private entries: WeakMap<any, PblColumnSizeObserver>;\n  private ro: ResizeObserver;\n  private columns: PblColumnSizeObserver[] = [];\n\n  constructor(private extApi: PblNgridInternalExtensionApi) {\n    this.entries = new WeakMap<any, PblColumnSizeObserver>();\n    this.ro = new ResizeObserver( entries => {\n      requestAnimationFrame(() => this.onResize(entries) );\n    });\n  }\n\n  static get(extApi: PblNgridInternalExtensionApi): PblNgridColumnSizeObserverGroup {\n    let controller = PBL_NGRID_MAP.get(extApi.grid);\n    if (!controller) {\n      controller = new PblNgridColumnSizeObserverGroup(extApi);\n      PBL_NGRID_MAP.set(extApi.grid, controller);\n    }\n    return controller;\n  }\n\n  has(col: PblColumnSizeObserver): boolean {\n    return this.columns.indexOf(col) !== -1;\n  }\n\n  hasColumn(column: PblColumn): boolean {\n    return this.columns.some( c => c.column === column );\n  }\n\n  add(col: PblColumnSizeObserver): void {\n    this.entries.set(col.target, col);\n    this.ro.observe(col.target);\n    this.columns.push(col);\n  }\n\n  remove(col: PblColumnSizeObserver): void {\n    this.ro.unobserve(col.target);\n    this.entries.delete(col.target);\n    const idx = this.columns.indexOf(col);\n    if (idx > -1) {\n      this.columns.splice(idx, 1);\n    }\n    if (this.columns.length === 0) {\n      this.ro.disconnect();\n      PBL_NGRID_MAP.delete(this.extApi.grid);\n    }\n  }\n\n  private onResize(entries: ResizeObserverEntry[] | readonly ResizeObserverEntry[]): void {\n    const resized: PblColumnSizeObserver[] = [];\n    for (const entry of entries) {\n      const o = this.entries.get(entry.target);\n      if (o) {\n        resized.push(o);\n      }\n    }\n    if (resized.length > 0) {\n      let isDragging = false;\n      for (const c of resized) {\n        isDragging = isDragging || c.column.columnDef.isDragging;\n        c.updateSize();\n      }\n      if (!isDragging) {\n        this.extApi.widthCalc.calcColumnWidth(this.columns.map( c => c.column ));\n      }\n    }\n  }\n}\n","import { PblNgridInternalExtensionApi } from '../../../ext/grid-ext-api';\nimport { ColumnSizeInfo } from '../../column/model/column-size-info';\nimport { PblColumn } from '../../column/model/column';\nimport { PblNgridColumnSizeObserverGroup } from './column-size-observer-group';\n\n/**\n * A wrapper around `ColumnSizeInfo` that listen to size changes from the element of a cell, using the `ResizeObserver` API.\n * When a resize event is triggered it will call `updateSize()` which in turn update the layout and notify the column about the resize event.\n *\n * In other words, all cell element of the grid, attached to a column, which are wrapped with this observer will trigger resize events.\n *\n * Because most of the size changes concern all columns of a row and because ResizeObserver will emit them all in the same event\n * an entire row should emit once, with all columns.\n *\n * > This class can be extended by a Directive class to be used by declarative markup in angular templates.\n */\nexport class PblColumnSizeObserver extends ColumnSizeInfo {\n  private controller: PblNgridColumnSizeObserverGroup;\n\n  constructor(element: HTMLElement, extApi: PblNgridInternalExtensionApi) {\n    super(element);\n    this.controller = PblNgridColumnSizeObserverGroup.get(extApi);\n  }\n\n  protected attachColumn(column: PblColumn): void {\n    super.attachColumn(column);\n    if (!column) {\n      this.controller.remove(this);\n    } else if (!this.controller.has(this)) {\n      this.updateSize();\n      this.controller.add(this);\n    }\n  }\n\n  destroy() {\n    this.controller.remove(this);\n    this.detachColumn();\n  }\n}\n","// tslint:disable:use-host-property-decorator\n// tslint:disable:directive-selector\nimport { first, filter } from 'rxjs/operators';\nimport {\n  AfterViewInit,\n  OnDestroy,\n  Component,\n  ElementRef,\n  ChangeDetectionStrategy,\n  ViewEncapsulation,\n  ViewContainerRef,\n  ViewChild,\n  NgZone,\n  EmbeddedViewRef,\n  Inject,\n} from '@angular/core';\nimport { unrx, PblNgridMultiRegistryMap } from '@pebula/ngrid/core';\n\nimport { _PblNgridComponent } from '../../tokens';\nimport { EXT_API_TOKEN, PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\nimport { COLUMN, PblMetaColumn, PblColumn } from '../column/model';\nimport { MetaCellContext, PblNgridMetaCellContext } from '../context/index';\nimport { PblNgridDataHeaderExtensionContext, PblNgridMultiComponentRegistry, PblNgridMultiTemplateRegistry } from '../registry';\nimport { PblNgridColumnDef, WidthChangeEvent } from '../column/directives/column-def';\nimport { applySourceWidth, applyWidth, initCellElement } from './utils';\nimport { PblNgridBaseCell } from './base-cell';\nimport { PblColumnSizeObserver } from '../features/column-size-observer/column-size-observer';\n\nconst lastDataHeaderExtensions = new Map<_PblNgridComponent, PblNgridMultiRegistryMap['dataHeaderExtensions'][]>();\n\n/**\n * Header cell component.\n * The header cell component will render the header cell template and add the proper classes and role.\n *\n * It is also responsible for creating and managing the any `dataHeaderExtensions` registered in the registry.\n * These extensions add features to the cells either as a template instance or as a component instance.\n * Examples: Sorting behavior, drag&drop/resize handlers, menus etc...\n */\n@Component({\n  selector: 'pbl-ngrid-header-cell',\n  // tslint:disable-next-line: no-host-metadata-property\n  host: {\n    class: 'cdk-header-cell pbl-ngrid-header-cell',\n    role: 'columnheader',\n  },\n  exportAs: 'ngridHeaderCell',\n  template: `<ng-container #vcRef></ng-container>`,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n})\nexport class PblNgridHeaderCellComponent<T extends COLUMN = COLUMN> extends PblNgridBaseCell implements AfterViewInit, OnDestroy {\n  @ViewChild('vcRef', { read: ViewContainerRef, static: true }) vcRef: ViewContainerRef;\n\n  column: PblColumn;\n  cellCtx: PblNgridDataHeaderExtensionContext | MetaCellContext;\n\n  get columnDef(): PblNgridColumnDef<PblColumn> { return this.column?.columnDef; }\n  get grid(): _PblNgridComponent { return this.extApi.grid; }\n\n  private resizeObserver: PblColumnSizeObserver;\n\n  constructor(@Inject(EXT_API_TOKEN) extApi: PblNgridInternalExtensionApi,\n              elementRef: ElementRef,\n              private zone: NgZone) {\n    super(extApi, elementRef);\n  }\n\n  setColumn(column: PblColumn, gridWidthRow: boolean) {\n    const prev = this.column;\n    if (prev !== column) {\n      if (prev) {\n        unrx.kill(this, prev);\n      }\n\n      this.column = column;\n\n      let predicate: (event: WidthChangeEvent) => boolean;\n      let view: EmbeddedViewRef<PblNgridMetaCellContext<any, PblMetaColumn | PblColumn>>\n      let widthUpdater: (...args: any[]) => void;\n\n      widthUpdater = gridWidthRow ? applySourceWidth : applyWidth;\n      predicate = event => (!gridWidthRow && event.reason !== 'update') || (gridWidthRow && event.reason !== 'resize');\n      view = !gridWidthRow ? this.initMainHeaderColumnView(column) : undefined;\n      if (gridWidthRow && !this.resizeObserver) {\n        this.resizeObserver = new PblColumnSizeObserver(this.el, this.extApi);\n      }\n\n      this.columnDef.widthChange\n        .pipe(filter(predicate), unrx(this, column))\n        .subscribe(widthUpdater.bind(this));\n\n      if (view) {\n        view.detectChanges();\n      }\n\n      widthUpdater.call(this);\n      initCellElement(this.el, column);\n    }\n  }\n\n  updateSize() {\n    if (this.resizeObserver) {\n      this.resizeObserver.updateSize();\n    }\n  }\n\n  ngAfterViewInit() {\n    if (this.resizeObserver) {\n      this.resizeObserver.column = this.column;\n    }\n  }\n\n  ngOnDestroy() {\n    this.resizeObserver?.destroy();\n    if (this.column) {\n      unrx(this, this.column);\n    }\n    super.ngOnDestroy();\n  }\n\n  protected initMainHeaderColumnView(col: PblColumn) {\n    this.cellCtx = PblNgridDataHeaderExtensionContext.createDateHeaderCtx(this as PblNgridHeaderCellComponent<PblColumn>, this.vcRef.injector);\n    const context = this.cellCtx as PblNgridDataHeaderExtensionContext;\n    const view = this.vcRef.createEmbeddedView(col.headerCellTpl, context);\n    this.zone.onStable\n      .pipe(first())\n      .subscribe( () => {\n        this.runHeaderExtensions(context, view as EmbeddedViewRef<PblNgridMetaCellContext<any, PblColumn>>);\n        const v = this.vcRef.get(0);\n        // at this point the view might get destroyed, its possible...\n        if (!v.destroyed) {\n          v.detectChanges();\n        }\n      });\n    return view;\n  }\n\n  protected runHeaderExtensions(context: PblNgridDataHeaderExtensionContext, view: EmbeddedViewRef<PblNgridMetaCellContext<any, PblColumn>>): void {\n    // we collect the first header extension for each unique name only once per grid instance\n    let extensions = lastDataHeaderExtensions.get(this.grid);\n    if (!extensions) {\n      const dataHeaderExtensions = new Map<string, any>();\n\n      this.grid.registry.forMulti('dataHeaderExtensions', values => {\n        for (const value of values) {\n          if (!dataHeaderExtensions.has(value.name)) {\n            dataHeaderExtensions.set(value.name, value);\n          }\n        }\n      });\n\n      extensions = Array.from(dataHeaderExtensions.values());\n      lastDataHeaderExtensions.set(this.grid, extensions);\n      // destroy it on the next turn, we know all cells will render on the same turn.\n      this.zone.onStable.pipe(first()).subscribe( () => lastDataHeaderExtensions.delete(this.grid) );\n    }\n\n    let { rootNodes } = view;\n\n    for (const ext of extensions) {\n      if (!ext.shouldRender || ext.shouldRender(context)) {\n        if (ext instanceof PblNgridMultiTemplateRegistry) {\n          const extView = this.vcRef.createEmbeddedView(ext.tRef, context);\n          extView.markForCheck();\n        } else if (ext instanceof PblNgridMultiComponentRegistry) {\n          rootNodes = this.createComponent(ext, context, rootNodes);\n        }\n      }\n    }\n  }\n\n  protected createComponent(ext: PblNgridMultiComponentRegistry<any, \"dataHeaderExtensions\">, context: PblNgridDataHeaderExtensionContext, rootNodes: any[]): any[] {\n    const factory = ext.getFactory(context);\n    const projectedContent: any[][] = [];\n\n    if (ext.projectContent) {\n      projectedContent.push(rootNodes);\n    }\n\n    const cmpRef = this.vcRef.createComponent(factory, this.vcRef.length, null, projectedContent);\n\n    if (ext.projectContent) {\n      rootNodes = [ cmpRef.location.nativeElement ];\n    }\n\n    if (ext.onCreated) {\n      ext.onCreated(context, cmpRef);\n    }\n\n    return rootNodes;\n  }\n}\n","import { filter } from 'rxjs/operators';\nimport { Component, DoCheck, TemplateRef } from '@angular/core';\nimport { unrx } from '@pebula/ngrid/core';\n\nimport { PblRowContext, PblCellContext } from '../context/index';\nimport { PblColumn } from '../column/model';\nimport { initCellElement } from './utils';\nimport { PblNgridBaseCell } from './base-cell';\n\nconst COLUMN_EDITABLE_CELL_CLASS = 'pbl-ngrid-editable-cell';\n\nfunction initDataCellElement(el: HTMLElement, column: PblColumn, prev?: PblColumn): void {\n  if (prev?.editable && prev.editorTpl) {\n    el.classList.remove(COLUMN_EDITABLE_CELL_CLASS);\n  }\n  if (column.editable && column.editorTpl) {\n    el.classList.add(COLUMN_EDITABLE_CELL_CLASS);\n  }\n}\n\n/** Cell template container that adds the right classes and role. */\n@Component({\n  selector: 'pbl-ngrid-cell',\n  template: `<ng-container *ngTemplateOutlet=\"template; context: cellCtx\"></ng-container>`,\n  // tslint:disable-next-line: no-host-metadata-property\n  host: {\n    'class': 'pbl-ngrid-cell',\n    'role': 'gridcell',\n    '[attr.id]': 'column?.id',\n    '[attr.tabindex]': 'column?.columnDef?.grid.cellFocus'\n  },\n  exportAs: 'pblNgridCell',\n})\nexport class PblNgridCellComponent extends PblNgridBaseCell implements DoCheck {\n\n  column: PblColumn;\n  cellCtx: PblCellContext | undefined;\n  template: TemplateRef<any>;\n\n  private _rowCtx: PblRowContext<any>;\n\n  /**\n   * The position of the column def among all columns regardless of visibility.\n   */\n  private colIndex: number;\n  private focused = false;\n  private selected = false;\n\n  syncColumn() {\n    if (this.column) {\n      this.colIndex = this.column.columnDef.grid.columnApi.indexOf(this.column);\n    }\n  }\n\n  setContext(context: PblRowContext<any>) {\n    this._rowCtx = context;\n  }\n\n  setColumn(column: PblColumn) {\n    const prev = this.column;\n    if (prev !== column) {\n      if (prev) {\n        unrx.kill(this, prev);\n      }\n\n      this.column = column;\n      this.colIndex = this.column.columnDef.grid.columnApi.indexOf(column);\n\n      column.columnDef.applyWidth(this.el);\n      initCellElement(this.el, column, prev);\n      initDataCellElement(this.el, column, prev);\n\n      /*  Apply width changes to this data cell\n          We don't update \"update\" events because they are followed by a resize event which will update the absolute value (px) */\n      column.columnDef.widthChange\n        .pipe(\n          filter( event => event.reason !== 'update'),\n          unrx(this, column),\n        )\n        .subscribe(event => this.column.columnDef.applyWidth(this.el));\n    }\n  }\n\n  ngDoCheck(): void {\n    if (this._rowCtx) {\n      const cellContext = this.cellCtx = this._rowCtx.cell(this.colIndex);\n\n      this.template = cellContext.editing ? this.column.editorTpl : this.column.cellTpl;\n\n      if (cellContext.focused !== this.focused) {\n\n        if (this.focused = cellContext.focused) {\n          this.el.classList.add('pbl-ngrid-cell-focused');\n        } else {\n          this.el.classList.remove('pbl-ngrid-cell-focused');\n        }\n      }\n      if (this.cellCtx.selected !== this.selected) {\n        if (this.selected = cellContext.selected) {\n          this.el.classList.add('pbl-ngrid-cell-selected');\n        } else {\n          this.el.classList.remove('pbl-ngrid-cell-selected');\n        }\n      }\n    }\n  }\n}\n","import { filter } from 'rxjs/operators';\nimport {\n  Component,\n  ChangeDetectionStrategy,\n  ViewEncapsulation,\n} from '@angular/core';\nimport { unrx } from '@pebula/ngrid/core';\n\nimport { _PblNgridComponent } from '../../tokens';\nimport { PblColumn } from '../column/model';\nimport { MetaCellContext } from '../context/index';\nimport { PblNgridColumnDef } from '../column/directives/column-def';\nimport { applyWidth, initCellElement } from './utils';\nimport { PblNgridBaseCell } from './base-cell';\n\n @Component({\n  selector: 'pbl-ngrid-footer-cell',\n  template: `<ng-container *ngTemplateOutlet=\"column?.footerCellTpl; context: cellCtx\"></ng-container>`,\n  host: {\n    class: 'cdk-footer-cell pbl-ngrid-footer-cell',\n    role: 'gridcell',\n  },\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n})\nexport class PblNgridFooterCellComponent extends PblNgridBaseCell {\n\n  column: PblColumn;\n  cellCtx: MetaCellContext<any, PblColumn>;\n  get columnDef(): PblNgridColumnDef { return this.column?.columnDef; }\n  get grid(): _PblNgridComponent { return this.extApi.grid; }\n\n  setColumn(column: PblColumn) {\n    const prev = this.column;\n    if (prev !== column) {\n      if (prev) {\n        unrx.kill(this, prev);\n      }\n\n      this.column = column;\n\n      this.cellCtx = MetaCellContext.create(column, this.grid);\n\n      applyWidth.call(this);\n      initCellElement(this.el, column);\n\n      this.columnDef.widthChange\n      .pipe(\n        filter( event => event.reason !== 'update'),\n        unrx(this, column),\n      )\n      .subscribe(applyWidth.bind(this));\n    }\n  }\n\n  ngOnDestroy() {\n    if (this.column) {\n      unrx(this, this.column);\n    }\n    super.ngOnDestroy();\n  }\n}\n","import { filter } from 'rxjs/operators';\nimport {\n  Component,\n  ChangeDetectionStrategy,\n  ViewEncapsulation,\n  ViewContainerRef,\n  ViewChild,\n} from '@angular/core';\nimport { unrx } from '@pebula/ngrid/core';\n\nimport { _PblNgridComponent } from '../../tokens';\nimport { PblMetaColumn, PblColumnGroup, isPblColumnGroup } from '../column/model';\nimport { MetaCellContext } from '../context/index';\nimport { PblNgridColumnDef } from '../column/directives/column-def';\nimport { applySourceWidth, initCellElement, initCellHeaderFooter } from './utils';\nimport { PblNgridBaseCell } from './base-cell';\n\nconst HEADER_GROUP_CSS = `pbl-header-group-cell`;\nconst HEADER_GROUP_PLACE_HOLDER_CSS = `pbl-header-group-cell-placeholder`;\n\n/**\n * Header cell component.\n * The header cell component will render the header cell template and add the proper classes and role.\n *\n * It is also responsible for creating and managing the any `dataHeaderExtensions` registered in the registry.\n * These extensions add features to the cells either as a template instance or as a component instance.\n * Examples: Sorting behavior, drag&drop/resize handlers, menus etc...\n */\n@Component({\n  selector: 'pbl-ngrid-meta-cell',\n  // tslint:disable-next-line: no-host-metadata-property\n  host: {\n    role: 'cell',\n  },\n  exportAs: 'ngridMetaCell',\n  template: `<ng-container *ngTemplateOutlet=\"column?.template; context: cellCtx\"></ng-container>`,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n})\nexport class PblNgridMetaCellComponent<T extends PblMetaColumn | PblColumnGroup = PblMetaColumn | PblColumnGroup> extends PblNgridBaseCell {\n  @ViewChild('vcRef', { read: ViewContainerRef, static: true }) vcRef: ViewContainerRef;\n\n  column: T;\n  cellCtx: MetaCellContext<any, PblMetaColumn>;\n\n  get columnDef(): PblNgridColumnDef<PblMetaColumn> { return this.column.columnDef; }\n  get grid(): _PblNgridComponent { return this.extApi.grid; }\n\n  setColumn(column: T, isFooter: boolean) {\n    const prev = this.column;\n    if (prev !== column) {\n      if (prev) {\n        unrx.kill(this, prev);\n      }\n\n      this.column = column;\n\n      if (column) {\n        if (!column.columnDef) {\n          new PblNgridColumnDef(this.extApi).column = column;\n          column.columnDef.name = column.id;\n        }\n\n        this.cellCtx = MetaCellContext.create(column, this.grid);\n\n        if (isPblColumnGroup(column)) {\n          this.el.classList.add(HEADER_GROUP_CSS);\n          if (column.placeholder) {\n            this.el.classList.add(HEADER_GROUP_PLACE_HOLDER_CSS);\n          }\n        }\n        this.columnDef.widthChange\n          .pipe(\n            filter( event => event.reason !== 'resize'),\n            unrx(this, column),\n          )\n          .subscribe( event => this.columnDef.applySourceWidth(this.el));\n\n        applySourceWidth.call(this);\n        initCellElement(this.el, column);\n        initCellHeaderFooter(this.el, isFooter);\n      }\n    }\n  }\n\n  ngOnDestroy() {\n    if (this.column) {\n      unrx(this, this.column);\n    }\n    super.ngOnDestroy();\n  }\n}\n","// tslint:disable:use-input-property-decorator\nimport {\n  Directive,\n  TemplateRef,\n  OnInit,\n  OnDestroy,\n} from '@angular/core';\nimport { PblColumnTypeDefinitionDataMap } from '@pebula/ngrid/core';\nimport { PblNgridRegistryService } from '../../registry/registry.service';\nimport { PblNgridCellDefDirectiveBase } from './types';\n\n@Directive()\nexport abstract class PblNgridBaseCellDef<Z> implements OnInit, OnDestroy, PblNgridCellDefDirectiveBase {\n  name: string;\n  type: keyof PblColumnTypeDefinitionDataMap;\n\n  constructor(public tRef: TemplateRef<Z>,\n              protected registry: PblNgridRegistryService) { }\n\n  abstract ngOnInit(): void;\n  abstract ngOnDestroy(): void;\n}\n","// tslint:disable:use-input-property-decorator\nimport { Directive, TemplateRef } from '@angular/core';\n\nimport { PblNgridRegistryService } from '../../registry/registry.service';\nimport { PblNgridMetaCellContext } from '../../context/index';\nimport { PblNgridBaseCellDef } from './base-cell-def.directive';\n\n/**\n * Header Cell definition for the pbl-ngrid.\n * Captures the template of a column's data row header cell as well as header cell-specific properties.\n *\n * `pblNgridHeaderCellDef` does the same thing that `matHeaderCellDef` and `cdkHeaderCellDef` do with one difference,\n * `pblNgridHeaderCellDef` is independent and does not require a column definition parent, instead it accept the ID of\n * the header cell.\n *\n * NOTE: Defining '*' as id will declare the header cell template as default, replacing the table's default header cell template.\n *\n * Make sure you set the proper id of the property you want to override.\n * When the `id` is set explicitly in the table column definition, this is not a problem but when if it's not set\n * the table generates a unique id based on a logic. If `name` is set the name is used, if no name is set\n * the `prop` is used (full with dot notation).\n */\n@Directive({\n  selector: '[pblNgridHeaderCellDef], [pblNgridHeaderCellTypeDef]',\n  inputs: [\n    'name:pblNgridHeaderCellDef',\n    'type:pblNgridHeaderCellTypeDef',\n  ]\n})\nexport class PblNgridHeaderCellDefDirective<T> extends PblNgridBaseCellDef<PblNgridMetaCellContext<T>> {\n  constructor(tRef: TemplateRef<PblNgridMetaCellContext<T>>, registry: PblNgridRegistryService) { super(tRef, registry); }\n\n  ngOnInit(): void {\n    // TODO: listen to property changes (name) and re-register cell\n    this.registry.addMulti('headerCell', this);\n  }\n\n  ngOnDestroy(): void {\n    this.registry.removeMulti('headerCell', this);\n  }\n}\n\ndeclare module '@pebula/ngrid/core/lib/registry/types' {\n  interface PblNgridMultiRegistryMap {\n    headerCell?: PblNgridHeaderCellDefDirective<any>;\n  }\n}\n","// tslint:disable:use-input-property-decorator\nimport { Directive, TemplateRef } from '@angular/core';\nimport { PblColumnTypeDefinitionDataMap } from '@pebula/ngrid/core';\n\nimport { PblNgridRegistryService } from '../../registry/registry.service';\nimport { PblNgridCellContext } from '../../context/index';\nimport { PblNgridBaseCellDef } from './base-cell-def.directive';\n\n/**\n * Cell definition for the pbl-ngrid.\n * Captures the template of a column's data row cell as well as cell-specific properties.\n *\n * `pblNgridCellDef` does the same thing that `matCellDef` and `cdkCellDef` do with one difference, `pblNgridCellDef` is\n * independent and does not require a column definition parent, instead it accept the ID of the cell.\n *\n * NOTE: Defining '*' as id will declare the cell template as default, replacing the table's default cell template.\n *\n * Make sure you set the proper id of the property you want to override.\n * When the `id` is set explicitly in the table column definition, this is not a problem but when if it's not set\n * the table generates a unique id based on a logic. If `name` is set the name is used, if no name is set\n * the `prop` is used (full with dot notation).\n */\n@Directive({\n  selector: '[pblNgridCellDef], [pblNgridCellTypeDef]',\n  inputs: [\n    'name:pblNgridCellDef',\n    'type:pblNgridCellTypeDef',\n  ]\n})\nexport class PblNgridCellDefDirective<T, P extends keyof PblColumnTypeDefinitionDataMap = any> extends PblNgridBaseCellDef<PblNgridCellContext<T, P>> {\n  type: P;\n  constructor(tRef: TemplateRef<PblNgridCellContext<any, P>>, registry: PblNgridRegistryService) { super(tRef, registry); }\n\n  ngOnInit(): void {\n    // TODO: listen to property changes (name) and re-register cell\n    this.registry.addMulti('tableCell', this);\n  }\n\n  ngOnDestroy(): void {\n    this.registry.removeMulti('tableCell', this);\n  }\n}\n\ndeclare module '@pebula/ngrid/core/lib/registry/types' {\n  interface PblNgridMultiRegistryMap {\n    tableCell?: PblNgridCellDefDirective<any>;\n  }\n}\n","import { Directive, TemplateRef } from '@angular/core';\nimport { PblColumnTypeDefinitionDataMap } from '@pebula/ngrid/core';\n\nimport { PblNgridRegistryService } from '../../registry/registry.service';\nimport { PblNgridCellContext } from '../../context/index';\nimport { PblNgridBaseCellDef } from './base-cell-def.directive';\n\n@Directive({\n  selector: '[pblNgridCellEditorDef], [pblNgridCellEditorTypeDef]',\n  inputs: [\n    'name:pblNgridCellEditorDef',\n    'type:pblNgridCellEditorTypeDef',\n  ]\n})\nexport class PblNgridEditorCellDefDirective<T, P extends keyof PblColumnTypeDefinitionDataMap = any> extends PblNgridBaseCellDef<PblNgridCellContext<T, P>> {\n  type: P;\n  constructor(tRef: TemplateRef<PblNgridCellContext<any, P>>, registry: PblNgridRegistryService) { super(tRef, registry); }\n\n  ngOnInit(): void {\n    // TODO: listen to property changes (name) and re-register cell\n    this.registry.addMulti('editorCell', this);\n  }\n\n  ngOnDestroy(): void {\n    this.registry.removeMulti('editorCell', this);\n  }\n}\n\ndeclare module '@pebula/ngrid/core/lib/registry/types' {\n  interface PblNgridMultiRegistryMap {\n    editorCell?: PblNgridEditorCellDefDirective<any>;\n  }\n}\n","import { Directive, TemplateRef } from '@angular/core';\n\nimport { PblNgridRegistryService } from '../../registry/registry.service';\nimport { PblNgridMetaCellContext } from '../../context/index';\nimport { PblNgridBaseCellDef } from './base-cell-def.directive';\n\n@Directive({\n  selector: '[pblNgridFooterCellDef], [pblNgridFooterCellTypeDef]',\n  inputs: [\n    'name:pblNgridFooterCellDef',\n    'type:pblNgridFooterCellTypeDef',\n  ]\n})\nexport class PblNgridFooterCellDefDirective<T> extends PblNgridBaseCellDef<PblNgridMetaCellContext<T>> {\n  constructor(tRef: TemplateRef<PblNgridMetaCellContext<T>>, registry: PblNgridRegistryService) { super(tRef, registry); }\n\n  ngOnInit(): void {\n    // TODO: listen to property changes (name) and re-register cell\n    this.registry.addMulti('footerCell', this);\n  }\n\n  ngOnDestroy(): void {\n    this.registry.removeMulti('footerCell', this);\n  }\n}\n\ndeclare module '@pebula/ngrid/core/lib/registry/types' {\n  interface PblNgridMultiRegistryMap {\n    footerCell?: PblNgridFooterCellDefDirective<any>;\n  }\n}\n","import { take } from 'rxjs/operators';\n\nimport { Directive, AfterViewInit, ElementRef, Input, NgZone, OnDestroy } from '@angular/core';\nimport { PblNgridCellContext } from '../context/index';\n\n@Directive({ selector: '[pblCellEditAutoFocus]' })\nexport class PblNgridCellEditAutoFocusDirective implements AfterViewInit, OnDestroy {\n\n  // tslint:disable-next-line:no-input-rename\n  @Input('pblCellEditAutoFocus') context: PblNgridCellContext<any>;\n\n  private _destroyed: boolean;\n\n  constructor(private elRef: ElementRef<HTMLElement>, private ngZone: NgZone) { }\n\n  ngAfterViewInit(): void {\n    const doFocus = () => {\n      const context = this.context;\n      if (context.editing && !context.rowContext.outOfView) {\n        this.elRef.nativeElement.focus();\n      }\n    };\n\n    this.ngZone.runOutsideAngular(() => {\n      Promise.resolve().then(() => {\n        if (!this._destroyed) {\n          const { viewport } = this.context.grid;\n          if (viewport && viewport.isScrolling) {\n            viewport.scrolling.pipe(take(1)).subscribe(doFocus);\n          } else {\n            doFocus();\n          }\n        }\n      });\n    });\n  }\n\n  ngOnDestroy(): void {\n    this._destroyed = true;\n  }\n}\n","import { EmbeddedViewRef, Inject, Injectable, IterableChangeRecord, IterableChanges, ViewContainerRef } from '@angular/core';\nimport {\n  _ViewRepeater,\n  _ViewRepeaterItemChange,\n  _ViewRepeaterItemChanged,\n  _ViewRepeaterItemContext,\n  _ViewRepeaterItemContextFactory,\n  _ViewRepeaterItemInsertArgs,\n  _ViewRepeaterItemValueResolver,\n  _ViewRepeaterOperation,\n} from '@angular/cdk/collections';\nimport { CdkRowDef, RenderRow, BaseRowDef, RowContext } from '@angular/cdk/table';\n\nimport { EXT_API_TOKEN, PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\nimport { PblRowContext } from '../context/row';\nimport { rowContextBridge } from '../row/row-to-repeater-bridge';\n\nexport interface BaseChangeOperationState<T, R extends RenderRow<T>, C extends PblRowContext<T>> {\n  vcRef: ViewContainerRef;\n  createEmbeddedView: (record: IterableChangeRecord<R>, adjustedPreviousIndex: number | null, currentIndex: number | null) => EmbeddedViewRef<C>;\n  itemValueResolver: _ViewRepeaterItemValueResolver<T, R>;\n}\n\nexport interface ChangeOperationState<T, R extends RenderRow<T>, C extends PblRowContext<T>> extends BaseChangeOperationState<T, R, C> {\n  record: IterableChangeRecord<R>;\n  view?: EmbeddedViewRef<C> | undefined;\n  op?: _ViewRepeaterOperation;\n}\n\n@Injectable()\nexport class PblNgridBaseRowViewRepeaterStrategy<T, R extends RenderRow<T>, C extends PblRowContext<T>> implements _ViewRepeater<T, R, C> {\n  protected workaroundEnabled = false;\n  protected renderer: { _renderCellTemplateForItem: (rowDef: BaseRowDef, context: RowContext<T>) => void; };\n  protected _cachedRenderDefMap = new Map<number, CdkRowDef<T>>();\n\n  constructor(@Inject(EXT_API_TOKEN) protected extApi: PblNgridInternalExtensionApi<T>) {\n    extApi\n      .onConstructed(() => {\n        const cdkTable = extApi.cdkTable;\n        this.renderer = cdkTable as any;\n        this.workaroundEnabled = !cdkTable['_cachedRenderDefMap'] && typeof this.renderer._renderCellTemplateForItem === 'function';\n      });\n  }\n\n  applyChanges(changes: IterableChanges<R>,\n               vcRef: ViewContainerRef,\n               itemContextFactory: _ViewRepeaterItemContextFactory<T, R, C>,\n               itemValueResolver: _ViewRepeaterItemValueResolver<T, R>,\n               itemViewChanged?: _ViewRepeaterItemChanged<R, C>) {\n\n    const createEmbeddedView = (record: IterableChangeRecord<R>,\n                                adjustedPreviousIndex: number | null,\n                                currentIndex: number | null) => {\n      const itemArgs = itemContextFactory(record, adjustedPreviousIndex, currentIndex);\n      itemArgs.context = this.extApi.contextApi._createRowContext(itemArgs.context.$implicit, itemArgs.index) as any;\n      return rowContextBridge.bridgeContext<C>(itemArgs, () => vcRef.createEmbeddedView(itemArgs.templateRef, itemArgs.context, itemArgs.index));\n    };\n\n    const baseState: BaseChangeOperationState<T, R, C> = { vcRef, createEmbeddedView, itemValueResolver };\n    changes.forEachOperation((record: IterableChangeRecord<R>, adjustedPreviousIndex: number | null, currentIndex: number | null) => {\n      const state: ChangeOperationState<T, R, C> = Object.create(baseState);\n      state.record = record;\n      if (record.previousIndex == null) {\n        this.addItem(adjustedPreviousIndex, currentIndex, state);\n        if (state.op === _ViewRepeaterOperation.INSERTED) {\n\n        }\n      } else if (currentIndex == null) {\n        this.removeItem(adjustedPreviousIndex, state);\n      } else {\n        this.moveItem(adjustedPreviousIndex, currentIndex, state);\n      }\n\n      if (this.workaroundEnabled) {\n        this.patch20765afterOp(state);\n      }\n\n      this.afterOperation(state);\n    });\n\n    if (this.workaroundEnabled) {\n      this.patch20765(changes, baseState);\n    }\n  }\n\n  detach(): void { }\n\n  protected addItem(adjustedPreviousIndex: number | null, currentIndex: number | null, state: ChangeOperationState<T, R, C>) { }\n\n  protected removeItem(removeAt: number, state: ChangeOperationState<T, R, C>) { }\n\n  protected moveItem(moveFrom: number, moveTo: number, state: ChangeOperationState<T, R, C>) { }\n\n  protected afterOperation(state: ChangeOperationState<T, R, C>) {  }\n\n  // See https://github.com/angular/components/pull/20765\n  protected patch20765(changes: IterableChanges<R>, baseState: BaseChangeOperationState<T, R, C>) {\n    changes.forEachIdentityChange = (fn: (record: IterableChangeRecord<R>) => void) => {\n      changes.constructor.prototype.forEachIdentityChange.call(changes, (record: IterableChangeRecord<R>) => {\n        fn(record);\n        if (this._cachedRenderDefMap.get(record.currentIndex) !== record.item.rowDef) {\n          baseState.vcRef.remove(record.currentIndex);\n          baseState.createEmbeddedView(record, null, record.currentIndex);\n          this._cachedRenderDefMap.set(record.currentIndex, record.item.rowDef);\n        }\n      });\n    }\n  }\n\n  protected patch20765afterOp(state: ChangeOperationState<T, R, C>) {\n    switch (state.op) {\n      case _ViewRepeaterOperation.REPLACED:\n      case _ViewRepeaterOperation.INSERTED:\n      case _ViewRepeaterOperation.MOVED:\n        this._cachedRenderDefMap.set(state.record.currentIndex, state.record.item.rowDef);\n        break;\n      case _ViewRepeaterOperation.REMOVED:\n        this._cachedRenderDefMap.delete(state.record.previousIndex);\n        break;\n    }\n  }\n\n}\n","import { EmbeddedViewRef, Injectable, ViewContainerRef } from '@angular/core';\nimport { _ViewRepeaterItemInsertArgs, _ViewRepeaterOperation } from '@angular/cdk/collections';\nimport { RenderRow } from '@angular/cdk/table';\n\nimport { ChangeOperationState, PblNgridBaseRowViewRepeaterStrategy } from './ngrid-base-row-view-repeater-strategy';\nimport { PblRowContext } from '../context/row';\n\n/**\n * This is a noop strategy that simply prevents the CDK from rendering cells for each row and instead the logic for it is now\n * handled within the row itself.\n *\n * This is very powerful and eliminate the need to use column declaration in strings.\n * Since we have a column store we can take it directly from there.\n *\n * Additionally, a temp fix for a bug is applied (see `workaroundEnabled`\n * Remove when and if PR https://github.com/angular/components/pull/20765 is accepted and the old version not supporting the solution is not supported by ngrid.\n */\n@Injectable()\nexport class PblNgridCachedRowViewRepeaterStrategy<T, R extends RenderRow<T>, C extends PblRowContext<T>> extends PblNgridBaseRowViewRepeaterStrategy<T, R, C> {\n\n  /**\n   * The size of the cache used to store unused views.\n   * Setting the cache size to `0` will disable caching. Defaults to 20 views.\n   */\n  viewCacheSize = 20;\n\n  /**\n   * View cache that stores embedded view instances that have been previously stamped out,\n   * but don't are not currently rendered. The view repeater will reuse these views rather than\n   * creating brand new ones.\n   */\n  private _viewCache: EmbeddedViewRef<C>[] = [];\n\n  detach(): void {\n    for (const view of this._viewCache) {\n      view.destroy();\n    }\n  }\n\n\n  protected addItem(adjustedPreviousIndex: number | null, currentIndex: number | null, state: ChangeOperationState<T, R, C>) {\n     /* Inserts a view for a new item, either from the cache or by creating a new one.\n        Returns `undefined` if the item was inserted into a cached view. */\n    state.view = this._insertViewFromCache(currentIndex, state.vcRef);\n    if (state.view) {\n      state.view.context.$implicit = state.itemValueResolver(state.record);\n      state.op = _ViewRepeaterOperation.REPLACED;\n    } else {\n      state.view = state.createEmbeddedView(state.record, adjustedPreviousIndex, currentIndex);\n      state.op = _ViewRepeaterOperation.INSERTED;\n    }\n  }\n\n  protected removeItem(removeAt: number, state: ChangeOperationState<T, R, C>) {\n      /** Detaches the view at the given index and inserts into the view cache. */\n    const detachedView = this._detachView(removeAt, state.vcRef);\n    this._maybeCacheView(detachedView, state.vcRef);\n    state.op = _ViewRepeaterOperation.REMOVED;\n  }\n\n  protected moveItem(moveFrom: number, moveTo: number, state: ChangeOperationState<T, R, C>) {\n    state.view = state.vcRef.get(moveFrom) as EmbeddedViewRef<C>;\n    state.vcRef.move(state.view, moveTo);\n    state.view.context.$implicit = state.itemValueResolver(state.record);\n    state.op = _ViewRepeaterOperation.MOVED;\n  }\n\n\n  /**\n   * Cache the given detached view. If the cache is full, the view will be\n   * destroyed.\n   */\n  private _maybeCacheView(view: EmbeddedViewRef<C>, viewContainerRef: ViewContainerRef) {\n    if (this._viewCache.length < this.viewCacheSize) {\n      this._viewCache.push(view);\n      this.extApi.rowsApi.findRowByElement(view.rootNodes[0])._detach();\n      // Notify this row is not part of the view, its cached (however, the component and any child component is not destroyed)\n    } else {\n      const index = viewContainerRef.indexOf(view);\n\n      // The host component could remove views from the container outside of\n      // the view repeater. It's unlikely this will occur, but just in case,\n      // destroy the view on its own, otherwise destroy it through the\n      // container to ensure that all the references are removed.\n      if (index === -1) {\n        view.destroy();\n      } else {\n        viewContainerRef.remove(index);\n      }\n    }\n  }\n\n  /** Inserts a recycled view from the cache at the given index. */\n  private _insertViewFromCache(index: number, viewContainerRef: ViewContainerRef): EmbeddedViewRef<C> | null {\n    const cachedView = this._viewCache.pop();\n    if (cachedView) {\n      // Notify that the items is not longer cached, now live and playing the game\n      this.extApi.rowsApi.findRowByElement(cachedView.rootNodes[0])._attach();\n      viewContainerRef.insert(cachedView, index);\n    }\n    return cachedView || null;\n  }\n\n  /** Detaches the embedded view at the given index. */\n  private _detachView(index: number, viewContainerRef: ViewContainerRef): EmbeddedViewRef<C> {\n    return viewContainerRef.detach(index) as EmbeddedViewRef<C>;\n  }\n}\n","import { Observable, Subject, of as observableOf, } from 'rxjs';\nimport {\n  Attribute,\n  ChangeDetectionStrategy,\n  ChangeDetectorRef,\n  Component,\n  Inject,\n  ElementRef,\n  IterableDiffers,\n  OnDestroy,\n  Optional,\n  ViewEncapsulation,\n  Injector,\n  SkipSelf,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { Platform } from '@angular/cdk/platform';\nimport { _DisposeViewRepeaterStrategy, _ViewRepeater, _VIEW_REPEATER_STRATEGY } from '@angular/cdk/collections';\nimport { ViewportRuler } from '@angular/cdk/scrolling';\nimport {\n  CDK_TABLE_TEMPLATE,\n  CdkTable,\n  DataRowOutlet,\n  CdkHeaderRowDef,\n  CdkFooterRowDef,\n  RowContext,\n  CDK_TABLE,\n  _COALESCED_STYLE_SCHEDULER,\n  _CoalescedStyleScheduler,\n  RenderRow,\n  STICKY_POSITIONING_LISTENER,\n  StickyPositioningListener,\n  StickyStyler,\n} from '@angular/cdk/table';\nimport { Direction, Directionality } from '@angular/cdk/bidi';\n\nimport { unrx } from '@pebula/ngrid/core';\nimport { PBL_NGRID_COMPONENT, _PblNgridComponent } from '../../tokens';\nimport { EXT_API_TOKEN, PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\n\nimport { PblNgridDisposedRowViewRepeaterStrategy } from './ngrid-disposed-row-view-repeater-strategy';\nimport { PblNgridCachedRowViewRepeaterStrategy } from './ngrid-cached-row-view-repeater-strategy';\n\n/**\n * Wrapper for the CdkTable that extends it's functionality to support various table features.\n * This wrapper also applies Material Design table styles (i.e. `MatTable` styles).\n *\n * Most of the extensions are done using mixins, this is mostly for clarity and separation of the features added.\n * This approach will allow easy removal when a feature is no longer required/implemented natively.\n */\n@Component({\n  selector: 'pbl-cdk-table',\n  exportAs: 'pblCdkTable',\n  template: CDK_TABLE_TEMPLATE,\n  host: { // tslint:disable-line: no-host-metadata-property\n    'class': 'pbl-cdk-table',\n  },\n  providers: [\n    {provide: CDK_TABLE, useExisting: PblCdkTableComponent},\n    {provide: _VIEW_REPEATER_STRATEGY, useClass: PblNgridCachedRowViewRepeaterStrategy},\n    {provide: _COALESCED_STYLE_SCHEDULER, useClass: _CoalescedStyleScheduler},\n    // Prevent nested tables from seeing this table's StickyPositioningListener.\n    {provide: STICKY_POSITIONING_LISTENER, useValue: null},\n  ],\n  encapsulation: ViewEncapsulation.None,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class PblCdkTableComponent<T> extends CdkTable<T> implements OnDestroy {\n\n  get _element(): HTMLElement { return this._elementRef.nativeElement; }\n\n  get beforeRenderRows(): Observable<void> {\n    if (!this.beforeRenderRows$) {\n      this.beforeRenderRows$ = new Subject<void>();\n    }\n    return this.beforeRenderRows$.asObservable();\n  }\n\n  get onRenderRows(): Observable<DataRowOutlet> {\n    if (!this.onRenderRows$) {\n      this.onRenderRows$ = new Subject<DataRowOutlet>();\n    }\n    return this.onRenderRows$.asObservable();\n  }\n\n  get minWidth(): number | null { return this._minWidth; }\n  set minWidth(value: number | null) {\n    this._minWidth = value || null;\n    this._element.style.minWidth = value ? value + 'px' : null;\n  }\n\n  readonly cdRef: ChangeDetectorRef;\n\n  private _minWidth: number | null = null;\n  private beforeRenderRows$: Subject<void>;\n  private onRenderRows$: Subject<DataRowOutlet>;\n  private _isStickyPending: boolean;\n  private pblStickyStyler: StickyStyler;\n  private pblStickyColumnStylesNeedReset = false;\n\n  constructor(_differs: IterableDiffers,\n              _changeDetectorRef: ChangeDetectorRef,\n              _elementRef: ElementRef<HTMLElement>,\n              @Attribute('role') role: string,\n              @Optional() _dir: Directionality,\n              protected injector: Injector,\n              @Inject(PBL_NGRID_COMPONENT) protected grid: _PblNgridComponent<T>,\n              @Inject(EXT_API_TOKEN) protected extApi: PblNgridInternalExtensionApi<T>,\n              @Inject(DOCUMENT) _document: any,\n              protected platform: Platform,\n              @Inject(_VIEW_REPEATER_STRATEGY) _viewRepeater: _ViewRepeater<T, RenderRow<T>, RowContext<T>>,\n              @Inject(_COALESCED_STYLE_SCHEDULER) _coalescedStyleScheduler: _CoalescedStyleScheduler,\n              _viewportRuler: ViewportRuler,\n              @Optional() @SkipSelf() @Inject(STICKY_POSITIONING_LISTENER) _stickyPositioningListener?: StickyPositioningListener) {\n    super(_differs, _changeDetectorRef, _elementRef, role, _dir, _document, platform, _viewRepeater, _coalescedStyleScheduler, _viewportRuler, _stickyPositioningListener);\n\n    this.cdRef = _changeDetectorRef;\n    extApi.setCdkTable(this);\n    this.trackBy = this.grid.trackBy;\n  }\n\n  ngOnInit(): void {\n    // We implement our own sticky styler because we don't have access to the one at CdkTable (private)\n    // We need it because our CdkRowDef classes does not expose columns, it's always an empty array\n    // This is to prevent CdkTable from rendering cells, we do that.\n    // This is why the styler will not work on columns, cause internall in CdkTable it sees nothing.\n    this.pblStickyStyler = new StickyStyler(this._isNativeHtmlTable,\n                                            this.stickyCssClass,\n                                            this._dir?.value || 'ltr',\n                                            this._coalescedStyleScheduler,\n                                            this.platform.isBrowser,\n                                            this.needsPositionStickyOnElement,\n                                            this._stickyPositioningListener);\n\n    // This will also run from CdkTable and `updateStickyColumnStyles()` is invoked multiple times\n    // but we don't care, we have a window\n    (this._dir?.change ?? observableOf<Direction>())\n      .pipe(unrx(this))\n      .subscribe(value => {\n        this.pblStickyStyler.direction = value;\n        this.pblStickyColumnStylesNeedReset = true;\n        this.updateStickyColumnStyles();\n      });\n\n    // It's imperative we register to dir changes before super.ngOnInit because it register there as well\n    // and it will come first and make sticky state pending, cancelling our pblStickyStyler.\n    super.ngOnInit();\n  }\n\n  updateStickyColumnStyles() {\n    if (this._isStickyPending) {\n      return;\n    }\n\n    this._isStickyPending = true;\n    Promise.resolve()\n      .then( () => {\n        this._isStickyPending = false;\n        this._updateStickyColumnStyles();\n      });\n  }\n\n  ngOnDestroy(): void {\n    super.ngOnDestroy();\n    unrx.kill(this);\n    if (this.onRenderRows$) {\n      this.onRenderRows$.complete();\n    }\n  }\n\n  //#region CSS-CLASS-CONTROL\n  addClass(cssClassName: string): void {\n    this._element.classList.add(cssClassName);\n  }\n\n  removeClass(cssClassName: string): void {\n    this._element.classList.remove(cssClassName);\n  }\n  //#endregion CSS-CLASS-CONTROL\n\n  //#region CLEAR-ROW-DEFS\n\n  // TODO: remove if https://github.com/angular/material2/pull/13000 is pushed\n  private _cachedRowDefs = { header: new Set<CdkHeaderRowDef>(), footer: new Set<CdkFooterRowDef>() }; //tslint:disable-line\n\n  // TODO: remove if https://github.com/angular/material2/pull/13000 is pushed\n  addHeaderRowDef(headerRowDef: CdkHeaderRowDef): void {\n    super.addHeaderRowDef(headerRowDef);\n    this._cachedRowDefs.header.add(headerRowDef);\n  }\n\n  // TODO: remove if https://github.com/angular/material2/pull/13000 is pushed\n  clearHeaderRowDefs(): void {\n    const { header } = this._cachedRowDefs;\n    for (const rowDef of Array.from(header.values())) {\n      this.removeHeaderRowDef(rowDef);\n    }\n    header.clear();\n  }\n\n  // TODO: remove if https://github.com/angular/material2/pull/13000 is pushed\n  addFooterRowDef(footerRowDef: CdkFooterRowDef): void {\n    super.addFooterRowDef(footerRowDef);\n    this._cachedRowDefs.footer.add(footerRowDef);\n  }\n\n  // TODO: remove if https://github.com/angular/material2/pull/13000 is pushed\n  clearFooterRowDefs(): void {\n    const { footer } = this._cachedRowDefs;\n    for (const rowDef of Array.from(footer.values())) {\n      this.removeFooterRowDef(rowDef);\n    }\n    footer.clear();\n  }\n  //#endregion CLEAR-ROW-DEFS\n\n  /**\n   * An alias for `_cacheRowDefs()`\n   */\n  updateRowDefCache(): void {\n    (this as any)._cacheRowDefs();\n  }\n\n  renderRows(): void {\n    if (this.beforeRenderRows$) {\n      this.beforeRenderRows$.next();\n    }\n    super.renderRows();\n    if (this.onRenderRows$) {\n      this.onRenderRows$.next(this._rowOutlet);\n    }\n  }\n\n  pblForceRenderDataRows(): void {\n    try{\n      (this as any)._forceRenderDataRows();\n    } catch (ex) {\n      this.multiTemplateDataRows = this.multiTemplateDataRows;\n    }\n  }\n\n  private _updateStickyColumnStyles() {\n    // We let the parent do the work on rows, it will see 0 columns so then we act.\n    super.updateStickyColumnStyles();\n\n    const stickyStartStates = this.extApi.columnApi.visibleColumns.map( c => c.columnDef?.sticky ?? false );\n    const stickyEndStates = this.extApi.columnApi.visibleColumns.map( c => c.columnDef?.stickyEnd ?? false );\n    const headerRow = this.extApi.rowsApi.findColumnRow('header');\n    const footerRow = this.extApi.rowsApi.findColumnRow('footer');\n    const rows = this.extApi.rowsApi.dataRows().map(r => r.element);\n    if (headerRow) {\n      rows.unshift(headerRow.element);\n    }\n    if (footerRow) {\n      rows.push(footerRow.element);\n    }\n\n    // internal reset, coming from Dir change\n    // It will probably get added to CDK ask well, remove when addedd\n    if (this.pblStickyColumnStylesNeedReset) {\n      this.pblStickyStyler.clearStickyPositioning(rows, ['left', 'right']);\n      this.pblStickyColumnStylesNeedReset = false;\n    }\n\n    this.pblStickyStyler.updateStickyColumns(rows, stickyStartStates, stickyEndStates, true);\n\n    // Reset the dirty state of the sticky input change since it has been used.\n    this.extApi.columnApi.columns.forEach(c => c.columnDef?.resetStickyChanged());\n  }\n\n}\n","import { animationFrameScheduler, fromEventPattern, Subject } from 'rxjs';\nimport { debounceTime, skip, takeUntil } from 'rxjs/operators';\nimport { ON_DESTROY } from '@pebula/ngrid/core';\nimport { PblNgridInternalExtensionApi } from '../../../ext/grid-ext-api';\nimport { resetColumnWidths } from '../../utils/width';\nimport { PblColumn } from '../model/column';\nimport { PblColumnStore } from '../management/column-store';\nimport { DynamicColumnWidthLogic, DYNAMIC_PADDING_BOX_MODEL_SPACE_STRATEGY } from './dynamic-column-width';\n\nexport class PblNgridColumnWidthCalc {\n\n  readonly dynamicColumnWidth: DynamicColumnWidthLogic;\n  readonly onWidthCalc = new Subject<DynamicColumnWidthLogic>();\n  private readonly columnStore: PblColumnStore\n\n  constructor(private readonly extApi: PblNgridInternalExtensionApi) {\n    this.columnStore = extApi.columnStore;\n    this.dynamicColumnWidth = new DynamicColumnWidthLogic(DYNAMIC_PADDING_BOX_MODEL_SPACE_STRATEGY, extApi.getDirection());\n    extApi.directionChange()\n      .pipe(takeUntil(extApi.events.pipe(ON_DESTROY)))\n      .subscribe( dir => this.dynamicColumnWidth.dir = dir );\n\n    extApi.events.pipe(ON_DESTROY).subscribe(() => this.onWidthCalc.complete() );\n\n    extApi.onInit(() => this.listenToResize() );\n  }\n\n  /**\n   * Updates the column sizes for all columns in the grid based on the column definition metadata for each column.\n   * The final width represent a static width, it is the value as set in the definition (except column without width, where the calculated global width is set).\n   */\n  resetColumnsWidth(): void {\n    resetColumnWidths(this.columnStore.getStaticWidth(), this.columnStore.visibleColumns, this.columnStore.metaColumns);\n  }\n\n  calcColumnWidth(columns?: PblColumn[]): void {\n    if (!columns) {\n      columns = this.columnStore.visibleColumns;\n    }\n\n    // protect from per-mature resize.\n    // Will happen on additional header/header-group rows AND ALSO when vScrollNone is set\n    // This will cause size not to populate because it takes time to render the rows, since it's not virtual and happens immediately.\n    // TODO: find a better protection.\n    if (!columns[0]?.sizeInfo) {\n      return;\n    }\n\n    // stores and calculates width for columns added to it. Aggregate's the total width of all added columns.\n    const rowWidth = this.dynamicColumnWidth;\n    rowWidth.reset();\n    this.syncColumnGroupsSize();\n\n    // if this is a grid without groups\n    if (rowWidth.minimumRowWidth === 0) {\n      // - We filter at the end because on add column we will have a column that still didn't get the resize event hence not having the size info\n      // We will ignore it because once it will get it a new resize event is triggered\n      rowWidth.addGroup(columns.map( c => c.sizeInfo ).filter( c => !!c ));\n    }\n\n    // if the max lock state has changed we need to update re-calculate the static width's again.\n    if (rowWidth.maxWidthLockChanged) {\n      this.resetColumnsWidth();\n      this.calcColumnWidth(columns);\n      return;\n    }\n\n    this.onWidthCalc.next(rowWidth);\n  }\n\n  /**\n   * Update the size of all group columns in the grid based on the size of their visible children (not hidden).\n   * @param dynamicWidthLogic - Optional logic container, if not set a new one is created.\n   */\n  private syncColumnGroupsSize(): void {\n    // From all meta columns (header/footer/headerGroup) we filter only `headerGroup` columns.\n    // For each we calculate it's width from all of the columns that the headerGroup \"groups\".\n    // We use the same strategy and the same RowWidthDynamicAggregator instance which will prevent duplicate calculations.\n    // Note that we might have multiple header groups, i.e. same columns on multiple groups with different row index.\n    for (const g of this.columnStore.getAllHeaderGroup()) {\n      // - We go over all columns because g.columns does not represent the current owned columns of the group it is static, representing the initial state.\n      // Only columns hold their group owners.\n      // - We filter at the end because on add column we will have a column that still didn't get the resize event hence not having the size info\n      // We will ignore it because once it will get it a new resize event is triggered\n      // TODO: find way to improve iteration\n      const colSizeInfos = this.columnStore.visibleColumns.filter( c => !c.hidden && c.isInGroup(g)).map( c => c.sizeInfo ).filter( c => !!c );\n      if (colSizeInfos.length > 0) {\n        const groupWidth = this.dynamicColumnWidth.addGroup(colSizeInfos);\n        g.minWidth = groupWidth;\n        g.updateWidth(`${groupWidth}px`);\n      } else {\n        g.minWidth = undefined;\n        g.updateWidth(`0px`);\n      }\n    }\n  }\n\n  private listenToResize(): void {\n    const { element } = this.extApi;\n    let resizeObserver: ResizeObserver;\n    const ro$ = fromEventPattern<[ResizeObserverEntry[], ResizeObserver]>(\n      handler => {\n        if (!resizeObserver) {\n          resizeObserver = new ResizeObserver(handler);\n          resizeObserver.observe(element);\n        }\n      },\n      handler => {\n        if (resizeObserver) {\n          resizeObserver.unobserve(element);\n          resizeObserver.disconnect();\n          resizeObserver = undefined;\n        }\n      }\n    );\n\n    // Skip the first emission\n    // Debounce all resizes until the next complete animation frame without a resize\n    // finally maps to the entries collection\n    // SKIP:  We should skip the first emission (`skip(1)`) before we debounce, since its called upon calling \"observe\" on the resizeObserver.\n    //        The problem is that some grid might require this because they do change size.\n    //        An example is a grid in a mat-tab that is hidden, the grid will hit the resize one when we focus the tab\n    //        which will require a resize handling because it's initial size is 0\n    //        To workaround this, we only skip elements not yet added to the DOM, which means they will not trigger a resize event.\n    let skipValue = document.body.contains(element) ? 1 : 0;\n\n    ro$\n      .pipe(\n        skip(skipValue),\n        debounceTime(0, animationFrameScheduler),\n        takeUntil(this.extApi.events.pipe(ON_DESTROY)),\n      )\n      .subscribe( (args: [ResizeObserverEntry[], ResizeObserver]) => {\n        if (skipValue === 0) {\n          skipValue = 1;\n          this.extApi.columnStore.visibleColumns.forEach( c => c.sizeInfo.updateSize() );\n        }\n        this.onResize(args[0]);\n      });\n  }\n\n  private onResize(entries: ResizeObserverEntry[]): void {\n    this.extApi.viewport?.checkViewportSize();\n    this.calcColumnWidth();\n  }\n}\n","import { EmbeddedViewRef } from '@angular/core';\nimport { PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\n\ninterface NoDataViewLogicap {\n  (force?: boolean): void;\n  viewActive?: boolean;\n}\n\nexport function noDataViewLogicap(extApi: PblNgridInternalExtensionApi): NoDataViewLogicap {\n  let noDateEmbeddedVRef: EmbeddedViewRef<any>;\n\n  const logicap: NoDataViewLogicap = (force?: boolean) => {\n    if (noDateEmbeddedVRef) {\n      extApi.grid.removeView(noDateEmbeddedVRef, 'beforeContent');\n      noDateEmbeddedVRef = undefined;\n      logicap.viewActive = false;\n    }\n\n    if (force === false) {\n      return;\n    }\n\n\n    const noData = extApi.grid.ds && extApi.grid.ds.renderLength === 0;\n    if (noData) {\n      extApi.grid.addClass('pbl-ngrid-empty');\n    } else {\n      extApi.grid.removeClass('pbl-ngrid-empty');\n    }\n\n    if (noData || force === true) {\n      const noDataTemplate = extApi.registry.getSingle('noData');\n      if (noDataTemplate) {\n        noDateEmbeddedVRef = extApi.grid.createView('beforeContent', noDataTemplate.tRef, { $implicit: extApi.grid }, 0);\n        logicap.viewActive = true;\n      }\n    }\n  };\n\n  return logicap;\n}\n","import { PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\n\n/**\n * Listens to registry changes and update the grid\n * Must run when the grid in at content init\n */\nexport function bindRegistryLogicap(extApi: PblNgridInternalExtensionApi) {\n  return () => {\n    // no need to unsubscribe, the reg service is per grid instance and it will destroy when this grid destroy.\n    // Also, at this point initial changes from templates provided in the content are already inside so they will not trigger\n    // the order here is very important, because component top of this grid will fire life cycle hooks AFTER this component\n    // so if we have a top level component registering a template on top it will not show unless we listen.\n    extApi.registry.changes\n      .subscribe( changes => {\n        let gridCell = false;\n        let headerFooterCell = false;\n        for (const c of changes) {\n          switch (c.type) {\n            case 'tableCell':\n              gridCell = true;\n              break;\n            case 'headerCell':\n            case 'footerCell':\n              headerFooterCell = true;\n              break;\n            case 'noData':\n              extApi.logicaps.noData();\n              break;\n            case 'paginator':\n              extApi.logicaps.pagination();\n              break;\n          }\n        }\n        if (gridCell) {\n          extApi.columnStore.attachCustomCellTemplates();\n        }\n        if (headerFooterCell) {\n          extApi.columnStore.attachCustomHeaderCellTemplates();\n        }\n      });\n  }\n}\n","import { EmbeddedViewRef } from '@angular/core';\nimport { unrx } from '@pebula/ngrid/core';\nimport { PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\n\nexport function paginationViewLogicap(extApi: PblNgridInternalExtensionApi) {\n  const paginationKillKey = 'pblPaginationKillKey';\n  let paginatorEmbeddedVRef: EmbeddedViewRef<any>;\n\n  return () => {\n    const ds = extApi.grid.ds;\n    const usePagination = ds && extApi.grid.usePagination;\n\n    if (usePagination) {\n      ds.pagination = extApi.grid.usePagination || false;\n      if (ds.paginator) {\n        ds.paginator.noCacheMode = extApi.grid.noCachePaginator;\n      }\n    }\n\n    if (extApi.grid.isInit) {\n      unrx.kill(extApi.grid, paginationKillKey);\n      if (paginatorEmbeddedVRef) {\n        extApi.grid.removeView(paginatorEmbeddedVRef, 'beforeContent');\n        paginatorEmbeddedVRef = undefined;\n      }\n      if (usePagination) {\n        const paginatorTemplate = extApi.registry.getSingle('paginator');\n        if (paginatorTemplate) {\n          paginatorEmbeddedVRef = extApi.grid.createView('beforeContent', paginatorTemplate.tRef, { $implicit: extApi.grid });\n        }\n      }\n    }\n  }\n}\n","import { PblNgridInternalExtensionApi } from '../../ext/grid-ext-api';\nimport { noDataViewLogicap } from './no-data-view';\nimport { bindRegistryLogicap } from './bind-registry';\nimport { paginationViewLogicap } from './pagination-view';\n\nexport interface Logicaps {\n  bindRegistry: ReturnType<typeof bindRegistryLogicap>;\n  noData: ReturnType<typeof noDataViewLogicap>;\n  pagination: ReturnType<typeof paginationViewLogicap>;\n}\n\nexport function logicap(extApi: PblNgridInternalExtensionApi): Logicaps {\n  return {\n    bindRegistry: bindRegistryLogicap(extApi),\n    noData: noDataViewLogicap(extApi),\n    pagination: paginationViewLogicap(extApi),\n  };\n}\n","import { Observable, of, Subject, EMPTY } from 'rxjs';\nimport { ChangeDetectorRef, ElementRef, Injector, IterableDiffers, NgZone, ViewContainerRef } from '@angular/core';\nimport { Direction, Directionality } from '@angular/cdk/bidi';\n\nimport { PblNgridConfigService, PblNgridEvents, ON_DESTROY, ON_CONSTRUCTED } from '@pebula/ngrid/core';\nimport { PblNgridRegistryService } from './registry/registry.service';\nimport { PblNgridInternalExtensionApi } from '../ext/grid-ext-api';\nimport { PblNgridPluginContext } from '../ext/plugin-control';\nimport { OnPropChangedEvent } from '../ext/types';\nimport { ColumnApi, PblColumnStore } from './column/management';\nimport { PblNgridColumnWidthCalc } from './column/width-logic/column-width-calc';\nimport { PblNgridComponent } from './ngrid.component';\nimport { PblCdkTableComponent } from './pbl-cdk-table/pbl-cdk-table.component';\nimport { PblRowsApi } from './row/rows-api';\nimport { PblNgridCellFactoryResolver } from './row/cell-factory.service';\nimport { ContextApi } from './context/api';\nimport { PblNgridMetaRowService } from './meta-rows/meta-row.service';\nimport { PblCdkVirtualScrollViewportComponent } from './features/virtual-scroll/virtual-scroll-viewport.component';\nimport { bindGridToDataSource } from './bind-grid-to-datasource';\nimport { logicap, Logicaps } from './logicap/index';\n\nexport interface RequiredAngularTokens {\n  ngZone: NgZone;\n  injector: Injector;\n  vcRef: ViewContainerRef;\n  cdRef: ChangeDetectorRef;\n  elRef: ElementRef<HTMLElement>;\n  config: PblNgridConfigService;\n  registry: PblNgridRegistryService;\n  dir?: Directionality;\n}\n\nexport function createApis<T>(grid: PblNgridComponent<T>, tokens: RequiredAngularTokens) {\n  return new InternalExtensionApi(grid, tokens);\n}\n\nclass InternalExtensionApi<T = any> implements PblNgridInternalExtensionApi<T> {\n  readonly config: PblNgridConfigService;\n  readonly registry: PblNgridRegistryService;\n  readonly element: HTMLElement;\n  readonly propChanged: Observable<OnPropChangedEvent>;\n  readonly columnStore: PblColumnStore;\n  readonly columnApi: ColumnApi<T>;\n  readonly rowsApi: PblRowsApi<T>;\n  readonly events: Observable<PblNgridEvents>;\n  readonly plugin: PblNgridPluginContext;\n  readonly widthCalc: PblNgridColumnWidthCalc;\n  readonly logicaps: Logicaps;\n\n  get cdkTable() { return this._cdkTable; }\n  get contextApi() { return this._contextApi || (this._contextApi = new ContextApi<T>(this)); }\n  get viewport(): PblCdkVirtualScrollViewportComponent { return this._viewPort; }\n  get pluginCtrl() { return this.plugin.controller; }\n\n  private _cdkTable: PblCdkTableComponent<T>;\n  private _contextApi: ContextApi<T>;\n  private _viewPort: PblCdkVirtualScrollViewportComponent;\n  private _create: () => void;\n  private dir?: Directionality;\n  private readonly _propChanged: Subject<OnPropChangedEvent>;\n\n  constructor(public readonly grid: PblNgridComponent<T>, tokens: RequiredAngularTokens) {\n    this.propChanged = this._propChanged = new Subject<OnPropChangedEvent>();\n\n    this.config = tokens.config;\n    this.registry = tokens.registry;\n    this.element = tokens.elRef.nativeElement;\n    if (tokens.dir) {\n      this.dir = tokens.dir;\n    }\n\n    const { plugin, init } = this.createPlugin(tokens);\n    this._create = init;\n    this.plugin = plugin;\n    this.events = plugin.events;\n    this.columnStore = new PblColumnStore(this, tokens.injector.get(IterableDiffers));\n    this.widthCalc = new PblNgridColumnWidthCalc(this);\n\n    const cellFactory = tokens.injector.get(PblNgridCellFactoryResolver);\n    this.rowsApi = new PblRowsApi<T>(this, tokens.ngZone, cellFactory);\n\n    this.columnApi = ColumnApi.create<T>(this);\n    this._contextApi = new ContextApi<T>(this);\n    this.logicaps = logicap(this);\n\n    bindGridToDataSource(this);\n\n    this.events.pipe(ON_DESTROY).subscribe( e => this._propChanged.complete() );\n\n    this.widthCalc\n      .onWidthCalc\n      .subscribe( rowWidth => {\n        this._cdkTable.minWidth = rowWidth.minimumRowWidth;\n\n        tokens.ngZone.run( () => {\n          this.rowsApi.syncRows('header');\n          this.plugin.emitEvent({ source: 'grid', kind: 'onResizeRow' });\n        });\n      });\n  }\n\n  getDirection() {\n    return this.dir?.value ?? 'ltr';\n  }\n\n  directionChange(): Observable<Direction> {\n    return this.dir?.change.asObservable() ?? EMPTY;\n  }\n\n  onConstructed(fn: () => void) {\n    if (!this._create) {\n      of(false);\n    } else {\n      this.events.pipe(ON_CONSTRUCTED).subscribe(fn);\n    }\n  }\n\n  onInit(fn: () => void) {\n    this.plugin.controller.onInit().subscribe(fn);\n  }\n\n  setCdkTable(cdkTable: PblCdkTableComponent<T>) {\n    this._cdkTable = cdkTable;\n    const globalCreateEvent = this._create;\n    delete this._create;\n    this.plugin.emitEvent({ source: 'grid', kind: 'onConstructed' });\n    globalCreateEvent();\n  }\n\n  setViewport(viewport: PblCdkVirtualScrollViewportComponent) {\n    this._viewPort = viewport;\n  }\n\n  notifyPropChanged(source, key, prev, curr) {\n    if (prev !== curr) {\n      this._propChanged.next({source, key, prev, curr} as any);\n    }\n  }\n\n  private createPlugin(tokens: RequiredAngularTokens) {\n    // Create an injector for the extensions/plugins\n    // This injector allow plugins (that choose so) to provide a factory function for runtime use.\n    // I.E: as if they we're created by angular via template...\n    // This allows seamless plugin-to-plugin dependencies without requiring specific template syntax.\n    // And also allows auto plugin binding (app wide) without the need for template syntax.\n    const pluginInjector = Injector.create({\n      providers: [\n        { provide: ViewContainerRef, useValue: tokens.vcRef },\n        { provide: ElementRef, useValue: tokens.elRef },\n        { provide: ChangeDetectorRef, useValue: tokens.cdRef },\n      ],\n      parent: tokens.injector,\n    });\n    return PblNgridPluginContext.create(pluginInjector, this);\n  }\n}\n","import { Observable } from 'rxjs';\nimport { coerceNumberProperty, NumberInput } from '@angular/cdk/coercion';\nimport { _PblNgridComponent } from '../../../../tokens';\nimport { PblNgridExtensionApi } from '../../../../ext/grid-ext-api';\nimport { PblCdkVirtualScrollViewportComponent } from '../virtual-scroll-viewport.component';\nimport { PblNgridVirtualScrollStrategy, PblNgridVirtualScrollStrategyMap } from './types';\n\nexport abstract class PblNgridBaseVirtualScrollDirective<T extends keyof PblNgridVirtualScrollStrategyMap = keyof PblNgridVirtualScrollStrategyMap> implements PblNgridVirtualScrollStrategy<T> {\n\n  /**\n   * The minimum amount of buffer rendered beyond the viewport (in pixels).\n   * If the amount of buffer dips below this number, more items will be rendered. Defaults to 100px.\n   *\n   * Default: 100\n   */\n  get minBufferPx(): NumberInput { return this._minBufferPx; }\n  set minBufferPx(value: NumberInput) { this._minBufferPx = coerceNumberProperty(value); }\n\n  /**\n   * The number of pixels worth of buffer to render for when rendering new items. Defaults to 200px.\n   *\n   * Default: 200\n   */\n  get maxBufferPx(): NumberInput { return this._maxBufferPx; }\n  set maxBufferPx(value: NumberInput) { this._maxBufferPx = coerceNumberProperty(value); }\n\n  get wheelMode(): 'passive' | 'blocking' | number { return this._wheelMode; }\n  set wheelMode(value: 'passive' | 'blocking' | number) {\n    switch (value) {\n      case 'passive':\n      case 'blocking':\n       this._wheelMode = value;\n       break;\n      default:\n        const wheelMode = coerceNumberProperty(value);\n        if (wheelMode && wheelMode >= 1 && wheelMode <= 60) {\n          this._wheelMode = wheelMode;\n        }\n        break;\n    }\n  }\n\n  protected _wheelMode: 'passive' | 'blocking' | number;\n  protected _maxBufferPx = 200;\n  protected _minBufferPx = 100;\n\n  constructor(protected grid: _PblNgridComponent, public readonly type: T) { }\n\n  /** The scroll strategy used by this directive. */\n  _scrollStrategy: PblNgridVirtualScrollStrategyMap[T];\n\n  get scrolledIndexChange(): Observable<number> { return this._scrollStrategy.scrolledIndexChange; }\n  set scrolledIndexChange(value: Observable<number>) { this._scrollStrategy.scrolledIndexChange = value; }\n  attachExtApi(extApi: PblNgridExtensionApi): void { this._scrollStrategy.attachExtApi(extApi); }\n  attach(viewport: PblCdkVirtualScrollViewportComponent): void { this._scrollStrategy.attach(viewport); }\n  detach(): void { this._scrollStrategy.detach(); }\n  onContentScrolled(): void { this._scrollStrategy.onContentScrolled(); }\n  onDataLengthChanged(): void { this._scrollStrategy.onDataLengthChanged(); }\n  onContentRendered(): void { this._scrollStrategy.onContentRendered(); }\n  onRenderedOffsetChanged(): void { this._scrollStrategy.onRenderedOffsetChanged(); }\n  scrollToIndex(index: number, behavior: ScrollBehavior): void { this._scrollStrategy.scrollToIndex(index, behavior); }\n}\n","import { EmbeddedViewRef, ViewContainerRef } from '@angular/core';\nimport { ListRange } from '@angular/cdk/collections';\nimport { PblNgridConfigService } from '@pebula/ngrid/core';\nimport { PblNgridVirtualScrollStrategy } from './strategies/types';\n\nexport type StickyDirectionVt = 'top' | 'bottom';\nexport type StickyDirectionHz = 'left' | 'right';\n\nexport function resolveScrollStrategy(config: PblNgridConfigService,\n                                      scrollStrategy: PblNgridVirtualScrollStrategy,\n                                      fallback: () => PblNgridVirtualScrollStrategy): PblNgridVirtualScrollStrategy {\n  if (!scrollStrategy && config.has('virtualScroll')) {\n    const virtualScrollConfig = config.get('virtualScroll');\n    if (typeof virtualScrollConfig.defaultStrategy === 'function') {\n      scrollStrategy = virtualScrollConfig.defaultStrategy();\n    }\n  }\n  return scrollStrategy || fallback();\n}\n\n/**\n * Returns the split range from an aggregated range.\n * An aggregated range describes the range of header, data and footer rows currently in view.\n * This function will split the range into core section, each having it's own range.\n *\n * Note that an aggregated range can span over a single section, all sections or just 2 sections.\n * If a section is not part of the aggregated range it's range is invalid, i.e: ListRange.start >= ListRange.end.\n *\n * @param range The aggregated range\n * @param headerLen The total length of header rows in the grid\n * @param dataLen The total length of data rows in the grid\n * @returns A tuple containing the ranges [header, data, footer].\n */\nexport function splitRange(range: ListRange, headerLen: number, dataLen: number): [ListRange, ListRange, ListRange] {\n  return [\n    { start: range.start, end: headerLen },\n    { start: Math.max(0, range.start - headerLen), end: Math.max(0, range.end - headerLen) },\n    { start: 0, end: Math.max(0, range.end - (dataLen + headerLen)) },\n  ];\n}\n\n/**\n * Update sticky positioning values to the rows to match virtual scroll content offset.\n * This function should run after `CdkTable` updated the sticky rows.\n *\n * ## Why\n * `CdkTable` applies sticky positioning to rows by setting top/bottom value to `0px`.\n * Virtual scroll use's a container with an offset to simulate the scrolling.\n *\n * The 2 does not work together, the virtual scroll offset will throw the sticky row out of bound, thus the top/bottom value must be compensated\n * based on the offset.\n */\nexport function updateStickyRows(offset: number, rows: HTMLElement[], stickyState: boolean[], type: StickyDirectionVt): void {\n  const coeff = type === 'top' ? -1 : 1;\n  let agg = 0;\n\n  if (coeff === 1) {\n    rows = rows.slice().reverse();\n  }\n  for (const i in rows) {\n    if (stickyState[i]) {\n      const row = rows[i];\n      row.style[type] = `${coeff * (offset + (coeff * agg))}px`;\n      agg += row.getBoundingClientRect().height; // TODO: cache this and update cache actively (size change)\n      row.style.display = null;\n    }\n  }\n}\n\n/**\n * Measures the combined size (width for horizontal orientation, height for vertical) of all items\n * in the specified view within the specified range.\n * Throws an error if the range includes items that are not currently rendered.\n *\n * > This is function is identical to `CdkVirtualForOf.measureRangeSize` with minor adjustments\n */\nexport function measureRangeSize(viewContainer: ViewContainerRef,\n                                 range: ListRange,\n                                 renderedRange: ListRange,\n                                 stickyState: boolean[] = []): number {\n  if (range.start >= range.end) {\n    return 0;\n  }\n\n  if (range.start < renderedRange.start || range.end > renderedRange.end) {\n    if (typeof ngDevMode === 'undefined' || ngDevMode) {\n      throw Error(`Attempt to measure an item that isn't rendered.`);\n    }\n    return;\n  }\n\n  // The index into the list of rendered views for the first item in the range.\n  const renderedStartIndex = range.start - renderedRange.start;\n  // The length of the range we're measuring.\n  const rangeLen = range.end - range.start;\n\n  // Loop over all the views, find the first and land node and compute the size by subtracting\n  // the top of the first node from the bottom of the last one.\n  let firstNode: HTMLElement | undefined;\n  let lastNode: HTMLElement | undefined;\n\n  // Find the first node by starting from the beginning and going forwards.\n  for (let i = 0; i < rangeLen; i++) {\n    const view = viewContainer.get(i + renderedStartIndex) as EmbeddedViewRef<any> | null;\n    if (view && view.rootNodes.length) {\n      firstNode = lastNode = view.rootNodes[0];\n      break;\n    }\n  }\n\n  // Find the last node by starting from the end and going backwards.\n  for (let i = rangeLen - 1; i > -1; i--) {\n    const view = viewContainer.get(i + renderedStartIndex) as EmbeddedViewRef<any> | null;\n    if (view && view.rootNodes.length) {\n      lastNode = view.rootNodes[view.rootNodes.length - 1];\n      break;\n    }\n  }\n\n  return firstNode && lastNode ? getOffset('end', lastNode) - getOffset('start', firstNode) : 0;\n}\n\n/** Helper to extract the offset of a DOM Node in a certain direction. */\nfunction getOffset(direction: 'start' | 'end', node: Node) {\n  const el = node as Element;\n  if (!el.getBoundingClientRect) {\n    return 0;\n  }\n  const rect = el.getBoundingClientRect();\n\n  return direction === 'start' ? rect.top : rect.bottom;\n}\n\nexport function calculateBrowserPxLimit() {\n  try {\n    const div = document.createElement('div');\n    div.style.position = 'absolute';\n    div.style.top = '9999999999999999px';\n    document.body.appendChild(div);\n\n    const size = Math.abs(div.getBoundingClientRect().top) * 0.85;\n    document.body.removeChild(div);\n    // We return 85% of the limit, rounded down to the closes million.\n    // E.G: if the limit is 33,554,428 then 85% is 28,521,263.8 which is rounded down to 28,000,000\n    return size - (size % 1000000)\n  } catch (err) {\n    // TODO: Either return null, or return a value based on the browser implementation which we might get as a param.\n    return 10000000;\n  }\n}\n","\nimport { PblCdkVirtualScrollViewportComponent } from './virtual-scroll-viewport.component';\nimport { updateStickyRows } from './utils';\n\n/**\n * A class that manages the life cycle of sticky meta rows (header & footer) while scrolling.\n * Sticky meta rows are moved to containers outside of the table so they do not depend on the `position: sticky` property.\n *\n * For `position: sticky` to work, a reference position is required (`top` for header, `bottom` for footer) which must reflect the current\n * offset measured by the virtual scroll viewport (this position compensate the offset of virtual scroll so the position is leveled, i.e. like top 0)\n *\n * When the user scroll's:\n * - The offset changes by the browser\n * - The virtual scroll will detect the new offset and update the wrapper with the new offset.\n *\n * There is a time gap between the operations above which causes rows to flicker in and out of view, this is why we move them to a fixed location.\n */\nexport class MetaRowStickyScroll {\n\n  private runningHeader = false;\n  private runningFooter = false;\n  private canMoveHeader = true;\n  private canMoveFooter = true;\n  private movedFooterRows: Array<[HTMLElement, HTMLElement, number]> = [];\n  private movedHeaderRows: Array<[HTMLElement, HTMLElement, number]> = [];\n\n  constructor(private viewport: PblCdkVirtualScrollViewportComponent,\n              private viewPortEl: HTMLElement,\n              private metaRows: Record<'header' | 'footer', { rows: HTMLElement[]; sticky: boolean[]; rendered: boolean[] }>) { }\n\n  canMove(): boolean {\n    return this.canMoveHeader || this.canMoveFooter;\n  }\n\n  isRunning(): boolean {\n    return this.runningHeader || this.runningFooter;\n  }\n\n  move(offset: number, viewPortElRect: ClientRect | DOMRect): boolean {\n    this.moveHeader(offset, viewPortElRect);\n    this.moveFooter(offset, viewPortElRect);\n    return this.isRunning() && !this.canMoveHeader && !this.canMoveFooter;\n  }\n\n\n  restore(renderedContentOffset: number): void {\n    const { header, footer } = this.metaRows;\n    if (this.restoreHeader()) {\n      updateStickyRows(renderedContentOffset, header.rows, header.sticky, 'top');\n    }\n    if (this.restoreFooter()) {\n      updateStickyRows(renderedContentOffset, footer.rows, footer.sticky, 'bottom');\n    }\n  }\n\n  private moveHeader(offset: number, viewPortElRect: ClientRect | DOMRect): void {\n    if (!this.runningHeader || this.canMoveHeader) {\n      this.runningHeader = true;\n      this.canMoveHeader = false;\n\n      const stickyAndRendered: number[] = [];\n      const headerRows = this.metaRows.header;\n      let mostTopRect: ClientRect | DOMRect;\n      for (let i = 0, len = headerRows.rows.length; i < len; i++) {\n        const rowEl = headerRows.rows[i];\n        if (headerRows.sticky[i]) {\n          const elRect = rowEl.getBoundingClientRect();\n          if (headerRows.rendered[i]) {\n            const calc = elRect.top - viewPortElRect.top - offset;\n\n            // if after the scroll the element is still in view, return\n            if (calc >= 0 || -calc < viewPortElRect.height) {\n              this.canMoveHeader = true;\n              return;\n            }\n          }\n          if (!mostTopRect) {\n            mostTopRect = elRect;\n          }\n          stickyAndRendered.push(i);\n        }\n      }\n\n      if (stickyAndRendered.length) {\n        this.viewport.stickyRowHeaderContainer.style.top = mostTopRect.top + 'px';\n        this.cloneAndMoveRow(this.viewport.stickyRowHeaderContainer,  headerRows.rows, stickyAndRendered, this.movedHeaderRows);\n      }\n    }\n  }\n\n  private moveFooter(offset: number, viewPortElRect: ClientRect | DOMRect): void {\n    if (!this.runningFooter || this.canMoveFooter) {\n      this.runningFooter = true;\n      this.canMoveFooter = false;\n\n      const stickyAndRendered: number[] = [];\n      const footerRows = this.metaRows.footer;\n      let mostTopRect: ClientRect | DOMRect;\n      for (let i = 0, len = footerRows.rows.length; i < len; i++) {\n        const rowEl = footerRows.rows[i];\n        if (footerRows.sticky[i]) {\n          const elRect = rowEl.getBoundingClientRect();\n          if (footerRows.rendered[i]) {\n            const calc = elRect.bottom - viewPortElRect.bottom + offset;\n\n            // if after the scroll the element is still in view, return\n            if (calc >= 0 && calc < viewPortElRect.height) {\n              this.canMoveFooter = true;\n              return;\n            }\n          }\n          mostTopRect = elRect;\n          stickyAndRendered.push(i);\n        }\n      }\n\n      if (stickyAndRendered.length) {\n        this.viewport.stickyRowFooterContainer.style.bottom = `calc(100% - ${mostTopRect.bottom}px)`\n        this.cloneAndMoveRow(this.viewport.stickyRowFooterContainer, footerRows.rows, stickyAndRendered, this.movedFooterRows);\n      }\n    }\n  }\n\n  private restoreHeader(): boolean {\n    if (this.runningHeader) {\n      const movedHeaderRows = this.movedHeaderRows;\n      this.movedHeaderRows = [];\n      this.restoreRows(movedHeaderRows, this.metaRows.header.rows);\n      this.runningHeader = false;\n      this.canMoveHeader = true;\n      return true;\n    }\n    return false;\n  }\n\n  private restoreFooter(): boolean {\n    if (this.runningFooter) {\n      const movedFooterRows = this.movedFooterRows;\n      this.movedFooterRows = [];\n      this.restoreRows(movedFooterRows, this.metaRows.footer.rows);\n      this.runningFooter = false;\n      this.canMoveFooter = true;\n      return true;\n    }\n    return false;\n  }\n\n  private cloneAndMoveRow(stickyRowContainer: HTMLElement,\n                          rows: HTMLElement[],\n                          stickyAndRendered: number[],\n                          restoreRef: Array<[HTMLElement, HTMLElement, number]>): void {\n    const innerRowContainer = stickyRowContainer.firstElementChild as HTMLElement;\n    stickyRowContainer.style.width = this.viewport.innerWidth + 'px';\n    innerRowContainer.style.transform = `translateX(-${this.viewPortEl.scrollLeft}px)`;\n    for (const i of stickyAndRendered) {\n      const rowEl = rows[i];\n      const clone = rowEl.cloneNode() as HTMLElement;\n      clone.style.width = '0';\n      rowEl.style.top = rowEl.style.bottom = rowEl.style.position = '';\n      rowEl.parentElement.insertBefore(clone, rowEl);\n      innerRowContainer.appendChild(rowEl);\n      restoreRef.push([rowEl, clone, i]);\n      // Assign the clone to be the sticky row element, this will ensure that stick row updates\n      // will set the `top` on an actual element in the viewport, thus updating with each layout reflow.\n      // if not set, when we return the original row it's `top` value will be true but will not show because it will not trigger a reflow.\n      rows[i] = clone;\n    }\n  }\n\n  private restoreRows(restoreRef: Array<[HTMLElement, HTMLElement, number]>, rows: HTMLElement[]): void {\n    for (const [rowEl, clone, index] of restoreRef) {\n      rowEl.style.position = clone.style.position;\n      rowEl.style.zIndex = clone.style.zIndex;\n      rowEl.style.top = clone.style.top;\n      rowEl.style.bottom = clone.style.bottom;\n\n      clone.parentElement.insertBefore(rowEl, clone);\n      clone.parentElement.removeChild(clone);\n      rows[index] = rowEl;\n    }\n  }\n}\n","import { Observable, Subject, fromEvent, race, timer } from 'rxjs';\nimport { filter, startWith, pairwise, take, takeUntil, map, debounceTime } from 'rxjs/operators';\n\nimport { NgZone, ViewContainerRef } from '@angular/core';\nimport { CollectionViewer, ListRange } from '@angular/cdk/collections';\nimport { PblDataSource } from '@pebula/ngrid/core';\n\nimport { _PblNgridComponent } from '../../../tokens';\nimport { PblNgridInternalExtensionApi } from '../../../ext/grid-ext-api';\nimport { PblCdkTableComponent } from '../../pbl-cdk-table/pbl-cdk-table.component';\nimport { PblCdkVirtualScrollViewportComponent } from './virtual-scroll-viewport.component';\nimport { splitRange, updateStickyRows, measureRangeSize } from './utils';\nimport { MetaRowStickyScroll } from './meta-row-sticky-scroll';\n\nfunction sortByIndex(a: { index: number }, b: { index: number }) { return a.index - b.index };\n\nexport interface NgeVirtualTableRowInfo {\n  readonly headerLength: number;\n  readonly rowLength: number;\n  readonly footerLength: number;\n}\n\nexport class PblVirtualScrollForOf<T> implements CollectionViewer, NgeVirtualTableRowInfo {\n  viewChange: Observable<ListRange>;\n\n  dataStream: Observable<T[] | ReadonlyArray<T>>;\n\n  get headerLength(): number { return this.header.rows.length  }\n  get rowLength(): number { return this.vcRefs.data.length  }\n  get footerLength(): number { return this.footer.rows.length  }\n\n  readonly wheelControl: { wheelListen: () => void; wheelUnListen: () => void; readonly listening: boolean; };\n\n  private destroyed = new Subject<void>();\n  private ds: PblDataSource<T>;\n\n  private get vcRefs(): Record<'header' | 'data' | 'footer', ViewContainerRef> {\n    const value = {\n      header: this.cdkTable._headerRowOutlet.viewContainer,\n      data: this.cdkTable._rowOutlet.viewContainer,\n      footer: this.cdkTable._footerRowOutlet.viewContainer,\n    };\n    Object.defineProperty(this, 'vcRefs', { value, configurable: true });\n    return value;\n  }\n\n  private renderedContentOffset = 0;\n  /** A tuple containing the last known ranges [header, data, footer] */\n  private _renderedRanges: [ListRange, ListRange, ListRange];\n  /** The length of meta rows [0] = header [1] = footer */\n  private metaRows: [number, number] = [0, 0];\n\n  private header = { rows: [] as HTMLElement[], sticky: [] as boolean[], rendered: [] as boolean[] };\n  private footer = { rows: [] as HTMLElement[], sticky: [] as boolean[], rendered: [] as boolean[] };\n\n  private grid: _PblNgridComponent<T>;\n  private cdkTable: PblCdkTableComponent<T>;\n  private viewport: PblCdkVirtualScrollViewportComponent;\n\n  constructor(extApi: PblNgridInternalExtensionApi<T>, private ngZone: NgZone) {\n    this.grid = extApi.grid;\n    this.cdkTable = extApi.cdkTable;\n    this.viewport = extApi.viewport;\n\n    this.viewChange = this.cdkTable.viewChange;\n\n    extApi.events\n      .pipe( takeUntil(this.destroyed) )\n      .subscribe( event => {\n        if (event.kind === 'onDataSource') {\n          this.detachView();\n          this.attachView(event.curr);\n        }\n      });\n    this.attachView(extApi.grid.ds);\n\n    const { metaRowService } = extApi.rowsApi;\n    metaRowService.sync\n      .pipe( takeUntil(this.destroyed) )\n      .subscribe( () => {\n        const headers = metaRowService.header.row.concat(metaRowService.header.sticky).sort(sortByIndex);\n        const footers = metaRowService.footer.row.concat(metaRowService.footer.sticky).sort(sortByIndex);\n\n        this.header.rows = headers.map( h => h.el );\n        this.header.sticky = headers.map( h => h.rowDef.type === 'sticky' );\n        this.footer.rows = footers.map( h => h.el );\n        this.footer.sticky = footers.map( h => h.rowDef.type === 'sticky' );\n\n        updateStickyRows(this.renderedContentOffset, this.header.rows, this.header.sticky, 'top');\n        updateStickyRows(this.renderedContentOffset, this.footer.rows, this.footer.sticky, 'bottom');\n      });\n\n    this.viewport.offsetChange\n      .pipe( takeUntil(this.destroyed) )\n      .subscribe( offset => {\n        if (this.renderedContentOffset !== offset) {\n          this.renderedContentOffset = offset;\n          updateStickyRows(offset, this.header.rows, this.header.sticky, 'top');\n          updateStickyRows(offset, this.footer.rows, this.footer.sticky, 'bottom');\n        }\n      });\n\n    this.wheelControl = this.initWheelControl();\n  }\n\n  /**\n   * Measures the combined size (width for horizontal orientation, height for vertical) of all items\n   * in the specified range. Throws an error if the range includes items that are not currently\n   * rendered.\n   */\n  measureRangeSize(range: ListRange, orientation: 'horizontal' | 'vertical'): number {\n    if (range.start >= range.end) {\n      return 0;\n    }\n\n    const renderedRanges = this._renderedRanges;\n    const ranges = splitRange(range, this.metaRows[0], this.ds.length);\n    const stickyStates = [ this.header.sticky, [], this.footer.sticky ];\n\n    const vcRefs = [this.vcRefs.header, this.vcRefs.data, this.vcRefs.footer];\n    const vcRefSizeReducer = (total: number, vcRef: ViewContainerRef, index: number): number => {\n      return total + measureRangeSize(vcRef, ranges[index], renderedRanges[index], stickyStates[index]);\n    };\n\n    return vcRefs.reduce(vcRefSizeReducer, 0);\n  }\n\n  destroy(): void {\n    this.detachView();\n    this.destroyed.next();\n    this.destroyed.complete();\n  }\n\n  private initWheelControl() {\n    let listening = false;\n    let offset = 0;\n    const viewPort = this.viewport.element;\n    const metaRowStickyScroll = new MetaRowStickyScroll(this.viewport, viewPort, { header: this.header, footer: this.footer });\n    let scrollPosition: number;\n\n    const wheelListen = () => {\n      if (!listening) {\n        viewPort.addEventListener('wheel', handler, true);\n        listening = true;\n      }\n    };\n    const wheelUnListen = () => {\n      if (listening) {\n        viewPort.removeEventListener('wheel', handler, true);\n        listening = false;\n      }\n    };\n    const updateScrollPosition = () => scrollPosition = (this.viewport.measureScrollOffset()) / (this.viewport.scrollHeight - this.viewport.getViewportSize());\n    const scrollEnd$ = this.viewport.scrolling.pipe(filter( s => !s ));\n\n    const handler = (event: WheelEvent) => {\n      if (event.deltaY) {\n        if ( (scrollPosition === 1 && event.deltaY > 0) || (offset === 0 && event.deltaY < 0)) {\n          return;\n        }\n        let newOffset = offset + event.deltaY;\n        newOffset = Math.min(this.viewport.scrollHeight, Math.max(0, newOffset));\n\n        if (newOffset !== offset) {\n          offset = newOffset;\n          if (metaRowStickyScroll.canMove() && metaRowStickyScroll.move(event.deltaY, viewPort.getBoundingClientRect())) {\n\n            const restore = () => {\n              metaRowStickyScroll.restore(this.renderedContentOffset);\n              updateScrollPosition();\n            };\n\n            switch (this.viewport.wheelMode) {\n              case 'passive':\n                wheelUnListen();\n                this.viewport.scrolling\n                  .pipe(\n                    debounceTime(150),\n                    filter( s => !s ),\n                    take(1)\n                  ).subscribe( () => {\n                    restore();\n                    wheelListen();\n                  });\n                break;\n              case 'blocking':\n                scrollEnd$.pipe(take(1)).subscribe(restore);\n                break;\n              default:\n                const threshold = this.viewport.wheelMode;\n                let removedEvent = false;\n\n                this.viewport.scrollFrameRate\n                  .pipe(takeUntil(scrollEnd$.pipe(take(1))))\n                  .subscribe(\n                    {\n                      next: frameRate => {\n                        if (!removedEvent && frameRate < threshold) {\n                          wheelUnListen();\n                          removedEvent = true;\n                        }\n                      },\n                      complete: () => {\n                        const lastWheel$ = fromEvent(viewPort, 'wheel').pipe(debounceTime(50), take(1));\n                        race(lastWheel$, timer(51) as any)\n                          .subscribe( () => {\n                            restore();\n                            if (removedEvent) {\n                              wheelListen();\n                            }\n                          });\n                          // we restore back after 100 ms, for some reason, if it's immediate, we hit a cycle of wheel/scroll/no-scroll and not wheel/scroll/WAIIIIIT/no-scrol\n                          // TODO: maybe we can measure time between no-scrolling and wheel to find this MS value\n                          //        OR, register a temp `wheel` listener that will detect wheel end and re-register the original handler.\n                      }\n                    }\n                  );\n            }\n          }\n        }\n        this.viewport.scrollToOffset(offset);\n        event.preventDefault();\n        event.stopPropagation();\n        return true;\n      }\n    };\n    updateScrollPosition();\n    // We don't auto enable, the virtual scroll viewport component will decide\n    // wheelListen();\n\n    this.viewport\n      .scrolling\n      .subscribe(isScrolling => {\n        if (!isScrolling) {\n          offset = this.viewport.measureScrollOffset();\n        }\n      });\n\n    return { wheelListen, wheelUnListen, get listening() { return listening } };\n  }\n\n  private attachView(ds: PblDataSource<T>): void {\n    if (ds) {\n      this.ds = ds;\n      this._renderedRanges = [ { start: 0, end: 0 }, this.cdkTable.viewChange.value, { start: 0, end: 0 } ];\n\n      this.viewport.renderedRangeStream\n        .pipe( takeUntil(this.destroyed) )\n        .subscribe( range => {\n          if (this.headerLength + this.footerLength === 0) { // if no row/sticky meta rows, move on...\n            this._renderedRanges = [ { start: 0, end: 0 }, range, { start: 0, end: 0 } ];\n            return this.cdkTable.viewChange.next(range);\n          }\n\n          /*  WHAT IS GOING ON HERE? */\n\n          /*  Table rows are split into 3 sections: Header, Data, Footer.\n              In the virtual playground only DATA rows are dynamic. Header & Footer rows are fixed.\n\n              The `CdkTable` works the same, also have the same sections with a stream API for DATA rows only.\n              `CdkTable.viewChange.next(RANGE)` will emit to the datasource which will result in a new data section from the datasource.\n\n              `CdkTable` alone does not support virtual scrolling, to achieve it we use a virtual scroll viewport which wraps the entire `CdkTable`.\n              This means that ALL sections are wrapped (hence scrolled over) but only DATA rows are moving...\n\n              Each emission of `ListRange` in `renderedRangeStream` is based on size calculation of ALL sections (see `measureRangeSize` above)\n              and we need to extract the relevant range for DATA rows only and pass it on to the grid.\n\n              To make this work we need to extract Header/Footer rows based on the starting position of the range and handle them as well.\n              Because the grid will only handle the scrolling of DATA rows we need to update HEADER/FOOTER rows to show/hide based on the range.\n\n              Because Header/Footer rows are fixed we do this by hiding them with `display: none`, unless they are sticky / pinned.\n              One exception is the main header row, which we hide virtually because we need it to render and reflect the cell size.\n\n              We first extract the actual ranges for each section and update the `CdkTable` with the DATA row range.\n              We then wait for the rows to render, which is the time for us to also \"render\" Header/Footer rows...\n              We don't \"render\" them per-se, they are already rendered, we just show/hide them based on the range and state (sticky).\n              This is important, hiding will cause the total height of the scroll container to shrink to the size it should be.\n              We defer this operation to run AFTER the rows are rendered (not immediately) because an immediate change will trigger\n              a change in the scroll container size resulting in a scroll event that will bring us back here but this time with\n              a height that does not fit the range. Immediate change removes rows (Header/Footer) before the new range is applied.\n              Only after the rows are rendered we can show/hide the Header/Footer rows.\n          */\n\n          // Extracting actual ranges for each section.\n          this._renderedRanges = splitRange(range, this.metaRows[0], ds.length);\n          const [ header, data, footer ] = this._renderedRanges;\n\n          this.cdkTable.onRenderRows.pipe(take(1)).subscribe(() => {\n            // We update the header DOM elements in reverse, skipping the last (first when reversed) DOM element.\n            // The skipped element is the grid's header row that must keep track of the layout for internal size calculation (e.g. group header rows).\n            // An hidden row is one that is out of range AND not sticky\n            if (this.headerLength > 0) {\n              const htmlRows = this.header.rows;\n              const renderedRows = this.header.rendered;\n              const stickyRows = this.header.sticky;\n              let rowIndex = 0;\n              for (const len = this.header.sticky.length - 1; rowIndex < len; rowIndex++) {\n                // assign rendered state + if not rendered and not sticky, set display to \"none\"\n                htmlRows[rowIndex].style.display = !(renderedRows[rowIndex] = rowIndex >= header.start) && !stickyRows[rowIndex]\n                  ? 'none'\n                  : null\n                ;\n              }\n\n              // Here we update the main header row, when we need to hide it we apply a class that will hide it virtually, i.e. not showing but keeping internal layout.\n              if (!(renderedRows[rowIndex] = rowIndex >= header.start) && !stickyRows[rowIndex]) {\n                htmlRows[rowIndex].classList.add('pbl-ngrid-row-visually-hidden');\n              } else if (this.grid.showHeader && htmlRows[rowIndex]) {\n                htmlRows[rowIndex].classList.remove('pbl-ngrid-row-visually-hidden');\n              }\n            }\n\n            if (this.footerLength > 0) {\n              const htmlRows = this.footer.rows;\n              const renderedRows = this.footer.rendered;\n              const stickyRows = this.footer.sticky;\n              let rowIndex = 0;\n              for (const len = this.footer.sticky.length; rowIndex < len; rowIndex++) {\n                // assign rendered state + if not rendered and not sticky, set display to \"none\"\n                htmlRows[rowIndex].style.display = !(renderedRows[rowIndex] = rowIndex < footer.end) && !stickyRows[rowIndex]\n                  ? 'none'\n                  : null\n                ;\n              }\n            }\n          });\n\n          this.cdkTable.viewChange.next(data);\n        });\n\n      // add meta rows to the total row count.\n      this.dataStream = ds.onRenderDataChanging\n        .pipe(\n          takeUntil(this.destroyed),\n          map( ({data}) => {\n            const metaRows = this.metaRows = [ this.header.rows.length, this.footer.rows.length ];\n            return new Array( data.length + metaRows[0] + metaRows[1] );\n          }),\n        );\n\n      ds.onRenderedDataChanged\n        .pipe(\n          takeUntil(this.destroyed),\n          map( () => ds.length ),\n          startWith(0),\n          pairwise(),\n          filter( ([prev, curr]) => prev !== curr ),\n        )\n        .subscribe( ([prev, curr]) => {\n          this.ngZone.onStable.pipe(take(1)).subscribe( () => this.viewport.onSourceLengthChange(prev, curr) );\n        });\n\n      this.viewport.attach(this as any);\n    }\n  }\n\n  private detachView(): void {\n    this.ds = undefined;\n    this.viewport.detach();\n  }\n}\n","import { PblCdkVirtualScrollViewportComponent } from '../virtual-scroll-viewport.component';\n\n/**\n * Returns an handler (function) that should be called when an element starts scrolling.\n * The handler will track the scrolling until done emitting 2 events in the process:\n *\n * - `PblCdkVirtualScrollViewportComponent.scrolling`: Update the state of scrolling\n * - `PblCdkVirtualScrollViewportComponent.scrollFrameRate`: Update the estimated frame rate while scrolling\n *\n * `scrollFrameRate` is measured based on the frequency `requestAnimationFrame` is fired on.\n * The event will fire every 500ms, starting after 500ms of scrolling have passed which will allow decent sampling time.\n */\nexport function createScrollWatcherFn(vScrollViewport: PblCdkVirtualScrollViewportComponent) {\n  let scrolling = 0;\n  let lastOffset = vScrollViewport.measureScrollOffset();\n\n  return () => {\n    /*  `scrolling` is a boolean flag that turns on with the first `scroll` events and ends after 2 browser animation frames have passed without a `scroll` event.\n        This is an attempt to detect a scroll end event, which does not exist.\n\n        `scrollFrameRate` is a number that represent a rough estimation of the frame rate by measuring the time passed between each request animation frame\n        while the `scrolling` state is true. The frame rate value is the average frame rate from all measurements since the scrolling began.\n        To estimate the frame rate, a significant number of measurements is required so value is emitted every 500 ms.\n        This means that a single scroll or short scroll bursts will not result in a `scrollFrameRate` emissions.\n\n    */\n    if (scrolling === 0) {\n      /*  The measure array holds values required for frame rate measurements.\n          [0] Storage for last timestamp taken\n          [1] The sum of all measurements taken (a measurement is the time between 2 snapshots)\n          [2] The count of all measurements\n          [3] The sum of all measurements taken WITHIN the current buffer window. This buffer is flushed into [1] every X ms (see buggerWindow const).\n      */\n      const bufferWindow = 499;\n      const measure = [ performance.now(), 0, 0, 0 ];\n      const offset = vScrollViewport.measureScrollOffset();\n      if (lastOffset === offset) { return; }\n      const delta = lastOffset < offset ? 1 : -1;\n\n      vScrollViewport.scrolling.next(delta);\n\n      const raf = () => {\n        const time = -measure[0] + (measure[0] = performance.now());\n        if (time > 5) {\n          measure[1] += time;\n          measure[2] += 1;\n        }\n        if (scrolling === -1) {\n          scrolling = 0;\n          lastOffset = vScrollViewport.measureScrollOffset();\n          vScrollViewport.scrolling.next(0);\n        }\n        else {\n          if (measure[1] > bufferWindow) {\n            measure[3] += measure[1];\n            measure[1] = 0;\n            vScrollViewport.scrollFrameRate.emit(1000 / (measure[3]/measure[2]));\n          }\n          scrolling = scrolling === 1 ? -1 : 1;\n          requestAnimationFrame(raf);\n        }\n      };\n      requestAnimationFrame(raf);\n    }\n    scrolling++;\n  }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ListRange} from '@angular/cdk/collections';\nimport {\n  CdkVirtualScrollViewport,\n  VIRTUAL_SCROLL_STRATEGY,\n  VirtualScrollStrategy\n} from '@angular/cdk/scrolling';\nimport {Observable} from 'rxjs';\n\n/**\n * A class that tracks the size of items that have been seen and uses it to estimate the average\n * item size.\n */\nexport class ItemSizeAverager {\n  /** The total amount of weight behind the current average. */\n  private _totalWeight = 0;\n\n  /** The current average item size. */\n  private _averageItemSize: number;\n\n  /** The default size to use for items when no data is available. */\n  private _defaultItemSize: number;\n\n  /** @param defaultItemSize The default size to use for items when no data is available. */\n  constructor(defaultItemSize = 50) {\n    this._defaultItemSize = defaultItemSize;\n    this._averageItemSize = defaultItemSize;\n  }\n\n  /** Returns the average item size. */\n  getAverageItemSize(): number {\n    return this._averageItemSize;\n  }\n\n  /**\n   * Adds a measurement sample for the estimator to consider.\n   * @param range The measured range.\n   * @param size The measured size of the given range in pixels.\n   */\n  addSample(range: ListRange, size: number) {\n    const newTotalWeight = this._totalWeight + range.end - range.start;\n    if (newTotalWeight) {\n      const newAverageItemSize =\n          (size + this._averageItemSize * this._totalWeight) / newTotalWeight;\n      if (newAverageItemSize) {\n        this._averageItemSize = newAverageItemSize;\n        this._totalWeight = newTotalWeight;\n      }\n    }\n  }\n\n  /** Resets the averager. */\n  reset() {\n    this._averageItemSize = this._defaultItemSize;\n    this._totalWeight = 0;\n  }\n}\n\n\n/** Virtual scrolling strategy for lists with items of unknown or dynamic size. */\nexport class AutoSizeVirtualScrollStrategy implements VirtualScrollStrategy {\n  /** @docs-private Implemented as part of VirtualScrollStrategy. */\n  scrolledIndexChange = new Observable<number>(() => {\n    // TODO(mmalerba): Implement.\n    if (typeof ngDevMode === 'undefined' || ngDevMode) {\n      throw Error('cdk-virtual-scroll: scrolledIndexChange is currently not supported for the' +\n          ' autosize scroll strategy');\n    }\n  });\n\n  /** The attached viewport. */\n  private _viewport: CdkVirtualScrollViewport | null = null;\n\n  /** The minimum amount of buffer rendered beyond the viewport (in pixels). */\n  private _minBufferPx: number;\n\n  /** The number of buffer items to render beyond the edge of the viewport (in pixels). */\n  private _maxBufferPx: number;\n\n  /** The estimator used to estimate the size of unseen items. */\n  private _averager: ItemSizeAverager;\n\n  /** The last measured scroll offset of the viewport. */\n  private _lastScrollOffset: number;\n\n  /** The last measured size of the rendered content in the viewport. */\n  private _lastRenderedContentSize: number;\n\n  /** The last measured size of the rendered content in the viewport. */\n  private _lastRenderedContentOffset: number;\n\n  /**\n   * The number of consecutive cycles where removing extra items has failed. Failure here means that\n   * we estimated how many items we could safely remove, but our estimate turned out to be too much\n   * and it wasn't safe to remove that many elements.\n   */\n  private _removalFailures = 0;\n\n  /**\n   * @param minBufferPx The minimum amount of buffer rendered beyond the viewport (in pixels).\n   *     If the amount of buffer dips below this number, more items will be rendered.\n   * @param maxBufferPx The number of pixels worth of buffer to shoot for when rendering new items.\n   *     If the actual amount turns out to be less it will not necessarily trigger an additional\n   *     rendering cycle (as long as the amount of buffer is still greater than `minBufferPx`).\n   * @param averager The averager used to estimate the size of unseen items.\n   */\n  constructor(minBufferPx: number, maxBufferPx: number, averager = new ItemSizeAverager()) {\n    this._minBufferPx = minBufferPx;\n    this._maxBufferPx = maxBufferPx;\n    this._averager = averager;\n  }\n\n  /**\n   * Attaches this scroll strategy to a viewport.\n   * @param viewport The viewport to attach this strategy to.\n   */\n  attach(viewport: CdkVirtualScrollViewport) {\n    this._averager.reset();\n    this._viewport = viewport;\n    this._renderContentForCurrentOffset();\n  }\n\n  /** Detaches this scroll strategy from the currently attached viewport. */\n  detach() {\n    this._viewport = null;\n  }\n\n  /** @docs-private Implemented as part of VirtualScrollStrategy. */\n  onContentScrolled() {\n    if (this._viewport) {\n      this._updateRenderedContentAfterScroll();\n    }\n  }\n\n  /** @docs-private Implemented as part of VirtualScrollStrategy. */\n  onDataLengthChanged() {\n    if (this._viewport) {\n      this._renderContentForCurrentOffset();\n      this._checkRenderedContentSize();\n    }\n  }\n\n  /** @docs-private Implemented as part of VirtualScrollStrategy. */\n  onContentRendered() {\n    if (this._viewport) {\n      this._checkRenderedContentSize();\n    }\n  }\n\n  /** @docs-private Implemented as part of VirtualScrollStrategy. */\n  onRenderedOffsetChanged() {\n    if (this._viewport) {\n      this._checkRenderedContentOffset();\n    }\n  }\n\n  /** Scroll to the offset for the given index. */\n  scrollToIndex(): void {\n    if (typeof ngDevMode === 'undefined' || ngDevMode) {\n      // TODO(mmalerba): Implement.\n      throw Error('cdk-virtual-scroll: scrollToIndex is currently not supported for the autosize'\n          + ' scroll strategy');\n    }\n  }\n\n  /**\n   * Update the buffer parameters.\n   * @param minBufferPx The minimum amount of buffer rendered beyond the viewport (in pixels).\n   * @param maxBufferPx The number of buffer items to render beyond the edge of the viewport (in\n   *     pixels).\n   */\n  updateBufferSize(minBufferPx: number, maxBufferPx: number) {\n    if (maxBufferPx < minBufferPx) {\n      throw('CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx');\n    }\n    this._minBufferPx = minBufferPx;\n    this._maxBufferPx = maxBufferPx;\n  }\n\n  /** Update the rendered content after the user scrolls. */\n  private _updateRenderedContentAfterScroll() {\n    const viewport = this._viewport!;\n\n    // The current scroll offset.\n    const scrollOffset = viewport.measureScrollOffset();\n    // The delta between the current scroll offset and the previously recorded scroll offset.\n    let scrollDelta = scrollOffset - this._lastScrollOffset;\n    // The magnitude of the scroll delta.\n    let scrollMagnitude = Math.abs(scrollDelta);\n\n    // The currently rendered range.\n    const renderedRange = viewport.getRenderedRange();\n\n    // If we're scrolling toward the top, we need to account for the fact that the predicted amount\n    // of content and the actual amount of scrollable space may differ. We address this by slowly\n    // correcting the difference on each scroll event.\n    let offsetCorrection = 0;\n    if (scrollDelta < 0) {\n      // The content offset we would expect based on the average item size.\n      const predictedOffset = renderedRange.start * this._averager.getAverageItemSize();\n      // The difference between the predicted size of the unrendered content at the beginning and\n      // the actual available space to scroll over. We need to reduce this to zero by the time the\n      // user scrolls to the top.\n      // - 0 indicates that the predicted size and available space are the same.\n      // - A negative number that the predicted size is smaller than the available space.\n      // - A positive number indicates the predicted size is larger than the available space\n      const offsetDifference = predictedOffset - this._lastRenderedContentOffset;\n      // The amount of difference to correct during this scroll event. We calculate this as a\n      // percentage of the total difference based on the percentage of the distance toward the top\n      // that the user scrolled.\n      offsetCorrection = Math.round(offsetDifference *\n          Math.max(0, Math.min(1, scrollMagnitude / (scrollOffset + scrollMagnitude))));\n\n      // Based on the offset correction above, we pretend that the scroll delta was bigger or\n      // smaller than it actually was, this way we can start to eliminate the difference.\n      scrollDelta = scrollDelta - offsetCorrection;\n      scrollMagnitude = Math.abs(scrollDelta);\n    }\n\n    // The current amount of buffer past the start of the viewport.\n    const startBuffer = this._lastScrollOffset - this._lastRenderedContentOffset;\n    // The current amount of buffer past the end of the viewport.\n    const endBuffer = (this._lastRenderedContentOffset + this._lastRenderedContentSize) -\n        (this._lastScrollOffset + viewport.getViewportSize());\n    // The amount of unfilled space that should be filled on the side the user is scrolling toward\n    // in order to safely absorb the scroll delta.\n    const underscan = scrollMagnitude + this._minBufferPx -\n        (scrollDelta < 0 ? startBuffer : endBuffer);\n\n    // Check if there's unfilled space that we need to render new elements to fill.\n    if (underscan > 0) {\n      // Check if the scroll magnitude was larger than the viewport size. In this case the user\n      // won't notice a discontinuity if we just jump to the new estimated position in the list.\n      // However, if the scroll magnitude is smaller than the viewport the user might notice some\n      // jitteriness if we just jump to the estimated position. Instead we make sure to scroll by\n      // the same number of pixels as the scroll magnitude.\n      if (scrollMagnitude >= viewport.getViewportSize()) {\n        this._renderContentForCurrentOffset();\n      } else {\n        // The number of new items to render on the side the user is scrolling towards. Rather than\n        // just filling the underscan space, we actually fill enough to have a buffer size of\n        // `maxBufferPx`. This gives us a little wiggle room in case our item size estimate is off.\n        const addItems = Math.max(0, Math.ceil((underscan - this._minBufferPx + this._maxBufferPx) /\n            this._averager.getAverageItemSize()));\n        // The amount of filled space beyond what is necessary on the side the user is scrolling\n        // away from.\n        const overscan = (scrollDelta < 0 ? endBuffer : startBuffer) - this._minBufferPx +\n            scrollMagnitude;\n        // The number of currently rendered items to remove on the side the user is scrolling away\n        // from. If removal has failed in recent cycles we are less aggressive in how much we try to\n        // remove.\n        const unboundedRemoveItems = Math.floor(\n            overscan / this._averager.getAverageItemSize() / (this._removalFailures + 1));\n        const removeItems =\n            Math.min(renderedRange.end - renderedRange.start, Math.max(0, unboundedRemoveItems));\n\n        // The new range we will tell the viewport to render. We first expand it to include the new\n        // items we want rendered, we then contract the opposite side to remove items we no longer\n        // want rendered.\n        const range = this._expandRange(\n            renderedRange, scrollDelta < 0 ? addItems : 0, scrollDelta > 0 ? addItems : 0);\n        if (scrollDelta < 0) {\n          range.end = Math.max(range.start + 1, range.end - removeItems);\n        } else {\n          range.start = Math.min(range.end - 1, range.start + removeItems);\n        }\n\n        // The new offset we want to set on the rendered content. To determine this we measure the\n        // number of pixels we removed and then adjust the offset to the start of the rendered\n        // content or to the end of the rendered content accordingly (whichever one doesn't require\n        // that the newly added items to be rendered to calculate.)\n        let contentOffset: number;\n        let contentOffsetTo: 'to-start' | 'to-end';\n        if (scrollDelta < 0) {\n          let removedSize = viewport.measureRangeSize({\n            start: range.end,\n            end: renderedRange.end,\n          });\n          // Check that we're not removing too much.\n          if (removedSize <= overscan) {\n            contentOffset =\n                this._lastRenderedContentOffset + this._lastRenderedContentSize - removedSize;\n            this._removalFailures = 0;\n          } else {\n            // If the removal is more than the overscan can absorb just undo it and record the fact\n            // that the removal failed so we can be less aggressive next time.\n            range.end = renderedRange.end;\n            contentOffset = this._lastRenderedContentOffset + this._lastRenderedContentSize;\n            this._removalFailures++;\n          }\n          contentOffsetTo = 'to-end';\n        } else {\n          const removedSize = viewport.measureRangeSize({\n            start: renderedRange.start,\n            end: range.start,\n          });\n          // Check that we're not removing too much.\n          if (removedSize <= overscan) {\n            contentOffset = this._lastRenderedContentOffset + removedSize;\n            this._removalFailures = 0;\n          } else {\n            // If the removal is more than the overscan can absorb just undo it and record the fact\n            // that the removal failed so we can be less aggressive next time.\n            range.start = renderedRange.start;\n            contentOffset = this._lastRenderedContentOffset;\n            this._removalFailures++;\n          }\n          contentOffsetTo = 'to-start';\n        }\n\n        // Set the range and offset we calculated above.\n        viewport.setRenderedRange(range);\n        viewport.setRenderedContentOffset(contentOffset + offsetCorrection, contentOffsetTo);\n      }\n    } else if (offsetCorrection) {\n      // Even if the rendered range didn't change, we may still need to adjust the content offset to\n      // simulate scrolling slightly slower or faster than the user actually scrolled.\n      viewport.setRenderedContentOffset(this._lastRenderedContentOffset + offsetCorrection);\n    }\n\n    // Save the scroll offset to be compared to the new value on the next scroll event.\n    this._lastScrollOffset = scrollOffset;\n  }\n\n  /**\n   * Checks the size of the currently rendered content and uses it to update the estimated item size\n   * and estimated total content size.\n   */\n  private _checkRenderedContentSize() {\n    const viewport = this._viewport!;\n    this._lastRenderedContentSize = viewport.measureRenderedContentSize();\n    this._averager.addSample(viewport.getRenderedRange(), this._lastRenderedContentSize);\n    this._updateTotalContentSize(this._lastRenderedContentSize);\n  }\n\n  /** Checks the currently rendered content offset and saves the value for later use. */\n  private _checkRenderedContentOffset() {\n    const viewport = this._viewport!;\n    this._lastRenderedContentOffset = viewport.getOffsetToRenderedContentStart()!;\n  }\n\n  /**\n   * Recalculates the rendered content based on our estimate of what should be shown at the current\n   * scroll offset.\n   */\n  private _renderContentForCurrentOffset() {\n    const viewport = this._viewport!;\n    const scrollOffset = viewport.measureScrollOffset();\n    this._lastScrollOffset = scrollOffset;\n    this._removalFailures = 0;\n\n    const itemSize = this._averager.getAverageItemSize();\n    const firstVisibleIndex =\n        Math.min(viewport.getDataLength() - 1, Math.floor(scrollOffset / itemSize));\n    const bufferSize = Math.ceil(this._maxBufferPx / itemSize);\n    const range = this._expandRange(\n        this._getVisibleRangeForIndex(firstVisibleIndex), bufferSize, bufferSize);\n\n    viewport.setRenderedRange(range);\n    viewport.setRenderedContentOffset(itemSize * range.start);\n  }\n\n  // TODO: maybe move to base class, can probably share with fixed size strategy.\n  /**\n   * Gets the visible range of data for the given start index. If the start index is too close to\n   * the end of the list it may be backed up to ensure the estimated size of the range is enough to\n   * fill the viewport.\n   * Note: must not be called if `this._viewport` is null\n   * @param startIndex The index to start the range at\n   * @return a range estimated to be large enough to fill the viewport when rendered.\n   */\n  private _getVisibleRangeForIndex(startIndex: number): ListRange {\n    const viewport = this._viewport!;\n    const range: ListRange = {\n      start: startIndex,\n      end: startIndex +\n          Math.ceil(viewport.getViewportSize() / this._averager.getAverageItemSize())\n    };\n    const extra = range.end - viewport.getDataLength();\n    if (extra > 0) {\n      range.start = Math.max(0, range.start - extra);\n    }\n    return range;\n  }\n\n  // TODO: maybe move to base class, can probably share with fixed size strategy.\n  /**\n   * Expand the given range by the given amount in either direction.\n   * Note: must not be called if `this._viewport` is null\n   * @param range The range to expand\n   * @param expandStart The number of items to expand the start of the range by.\n   * @param expandEnd The number of items to expand the end of the range by.\n   * @return The expanded range.\n   */\n  private _expandRange(range: ListRange, expandStart: number, expandEnd: number): ListRange {\n    const viewport = this._viewport!;\n    const start = Math.max(0, range.start - expandStart);\n    const end = Math.min(viewport.getDataLength(), range.end + expandEnd);\n    return {start, end};\n  }\n\n  /** Update the viewport's total content size. */\n  private _updateTotalContentSize(renderedContentSize: number) {\n    const viewport = this._viewport!;\n    const renderedRange = viewport.getRenderedRange();\n    const totalSize = renderedContentSize +\n        (viewport.getDataLength() - (renderedRange.end - renderedRange.start)) *\n        this._averager.getAverageItemSize();\n    viewport.setTotalContentSize(totalSize);\n  }\n}\n","import { ListRange } from '@angular/cdk/collections';\nimport { AutoSizeVirtualScrollStrategy, ItemSizeAverager } from './auto-size-cdk';\nimport { PblNgridExtensionApi } from '../../../../../ext/grid-ext-api';\nimport { NgeVirtualTableRowInfo } from '../../virtual-scroll-for-of';\nimport { PblCdkVirtualScrollViewportComponent } from '../../virtual-scroll-viewport.component';\nimport { PblNgridVirtualScrollStrategy } from '../types';\n\ndeclare module '../types' {\n  interface PblNgridVirtualScrollStrategyMap {\n    vScrollAuto: PblNgridAutoSizeVirtualScrollStrategy;\n  }\n}\n\nexport class PblNgridAutoSizeVirtualScrollStrategy extends AutoSizeVirtualScrollStrategy implements PblNgridVirtualScrollStrategy<'vScrollAuto'> {\n\n  get type() { return 'vScrollAuto' as const; }\n\n  protected extApi: PblNgridExtensionApi;\n\n  constructor(minBufferPx: number, maxBufferPx: number, public readonly averager = new PblNgridItemSizeAverager()) {\n    super(minBufferPx, maxBufferPx, averager);\n  }\n\n  attachExtApi(extApi: PblNgridExtensionApi): void {\n    this.extApi = extApi;\n  }\n\n  attach(viewport: PblCdkVirtualScrollViewportComponent): void {\n    if (!this.extApi) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error('Invalid use of attach, you must first attach `PblNgridExtensionApi`');\n      }\n    }\n    super.attach(viewport);\n  }\n}\n\nexport class PblNgridItemSizeAverager extends ItemSizeAverager {\n  private rowInfo: NgeVirtualTableRowInfo;\n\n  addSample(range: ListRange, size: number) {\n    if (this.rowInfo && this.rowInfo.rowLength === 0) {\n      this.reset();\n    } else {\n      super.addSample(range, size);\n    }\n  }\n\n  /**\n   * A temp workaround to solve the actual vs wanted rendered row issue in `CdkVirtualScrollViewport`\n   *\n   * `CdkVirtualScrollViewport.getRenderedRange()` return the rows that the virtual container want's the grid to render\n   * however, the actual rendered rows might be different. This is a problem especially in init, when the rendered rows are actually 0\n   * but `CdkVirtualScrollViewport.getRenderedRange()` return the initial range of rows that should be rendered. This results in a wrong\n   * calculation of the average item size in `ItemSizeAverager`\n   *\n   * SEE: https://github.com/angular/material2/blob/a9e550e5bf93cd68c342d1a50d8576d8f3812ebe/src/cdk/scrolling/virtual-scroll-viewport.ts#L212-L220\n   */\n  setRowInfo(rowInfo: NgeVirtualTableRowInfo): void {\n    this.rowInfo = rowInfo;\n  }\n}\n","import { Observable, Subject } from 'rxjs';\n\nexport class RowIntersectionTracker {\n  get observerMode() { return !!this.intersectionObserver; }\n\n  readonly intersectionChanged: Observable<IntersectionObserverEntry[]>;\n  private readonly intersectionObserver: IntersectionObserver;\n\n  constructor(rootElement: HTMLElement, forceManual?: boolean) {\n    const intersectionChanged = this.intersectionChanged = new Subject<IntersectionObserverEntry[]>();\n\n    if (!forceManual && !!IntersectionObserver) {\n      this.intersectionObserver = new IntersectionObserver(entries => intersectionChanged.next(entries), {\n        root: rootElement,\n        rootMargin: '0px',\n        threshold: 0.0,\n      });\n    }\n\n  }\n\n  snapshot() {\n    return this.intersectionObserver?.takeRecords() ?? [];\n  }\n\n  track(element: HTMLElement) {\n    this.intersectionObserver?.observe(element);\n  }\n\n  untrack(element: HTMLElement) {\n    this.intersectionObserver?.unobserve(element);\n  }\n\n  destroy() {\n    (this.intersectionChanged as Subject<any>).complete();\n    this.intersectionObserver?.disconnect();\n  }\n}\n","import { Subject } from 'rxjs';\nimport { calculateBrowserPxLimit } from './utils';\nimport { PblCdkVirtualScrollViewportComponent } from './virtual-scroll-viewport.component';\n\n/**\n * Logic for height paging:\n *\n * The whole logic is here to workaround browser issues with PX limit.\n * With virtual scroll we simulate the height by rendering a small viewport size box that inside\n * we create a fake element that simulate the height of the total items we need to render.\n * When the user scrolls we calculate the items that should be rendered for that scroll position.\n *\n * This is ok, until we reach a limit of maximum height/width a browser can handle which is implementation based.\n * Chrome will break on 34m PX, same for safari but firefox (OSX) it's 17m.\n *\n * What paging does is set a fixed height, which is below the limit of the browser.\n * Then fit the total height required into the fixed height we defined using math.\n *\n * This is done via pages. We split the scroll area into pages, each page we go over will offset the scroll bar a bit\n * to compensate for the gap between the total height and the fixed height.\n *\n * For example, if the total items height is 1000px and the fixed height is 600px, we have a 400px height to compensate while scrolling.\n * If we have 11 pages, that's 10 pages we swap, each swap should compensate 40px so we will in total compensate 400px.\n * When the user scroll's down and reaches the \"page\" we slightly shift the scroll bar up 40px, giving us 40px more to scroll down, 10 times like this and we get 400px additional scroll area\n * which is what we need for all of our items.\n *\n * This is the theory, in practice this depends on the scroll delta, on large scrolls we can't change the actual scroll position, we just recalculate the current page/offset\n * On small delta's we do calculate and if a fix is required we will do it.\n *\n * This \"fix\" only happen when the scroll position + delta moves us from a page to the next/prev page.\n * Since we're talking large scale here, the pages are quite big so getting to that point should be rare.\n *\n * The logic here is incomplete, especially when switching from location based calculation where we set the page/offset based on the scroll offset\n * To page based calculation where we calculate the location (scroll offset) based on the page/offset we're in.\n *\n * The 2 methods can't work together because if you do a paged based calc you push the scroll offset which will reflect on the next location based calc.\n *\n * The 2 methods run based on the scroll delta, on large scroll gaps we want to do location based calc because we don't really scroll it might be wheel but also might be dragging the bar.\n * On small incremental wheel events we want to determine when the page shifts.\n *\n * In general, we want to have lower page height which means more offset points.\n * This means more places where the user can \"see\" these jumps but each jump is minimal.\n * However, if we do large page height, less jumps, we probably be in a situation where the user never see these jumps.\n * The problem is, when the jumps occurs the whole math is useless, and this happens on MOST up scrolls.\n *\n * This is to say, we need to refactor this process to use only one method and find the sweet spot for the page height.\n * Maybe 3 X ViewPort size...\n */\n\n// const LOG = msg => console.log(msg) ;\n\n/* Height limits: Chrome,  Safari: ~34m | FireFox: ~17m\n*/\nconst MAX_SCROLL_HEIGHT = calculateBrowserPxLimit();\n\nexport class VirtualScrollHightPaging {\n  totalHeight: number;\n  pageHeight: number;\n  pageCount: number;\n  coff: number;\n  prevScrollOffset: number;\n  offset: number;\n  page: number;\n  afterToEnd = false;\n\n  active = false;\n\n  activeChanged = new Subject<void>();\n\n  constructor(private viewport: PblCdkVirtualScrollViewportComponent) {\n    const onContentScrolled = viewport.pblScrollStrategy.onContentScrolled;\n    viewport.pblScrollStrategy.onContentScrolled = () => {\n      if (this.active) {\n        const scrollOffset = viewport.element.scrollTop;\n        const delta = scrollOffset - this.prevScrollOffset;\n        const viewportSize =  delta > 0 ? viewport.getViewportSize() : 80;\n\n        if (Math.abs(delta) > viewportSize) {\n          // LOG(`DELTA#BEFORE ${scrollOffset} - ${this.page}`);\n          this.page = Math.floor(scrollOffset * ((this.totalHeight - viewportSize) / (MAX_SCROLL_HEIGHT - viewportSize)) * (1 / this.pageHeight));\n          // LOG(`DELTA ${scrollOffset} - ${this.page}`);\n          this.offset = Math.round(this.page * this.coff);\n          this.prevScrollOffset = scrollOffset;\n        } else if (this.prevScrollOffset !== scrollOffset) {\n          // next page\n          if (delta > 0 && scrollOffset + this.offset > (this.page + 1) * this.pageHeight) {\n            // LOG(`NEXT ${scrollOffset}`);\n            this.page += 1;\n            this.offset += this.coff;\n            viewport.element.scrollTop = this.prevScrollOffset = Math.floor(scrollOffset - this.coff);\n            // LOG(`NEXT# 2 ${viewport.element.scrollTop}`);\n            return;\n          }\n          // prev page\n          else if (delta < 0 && scrollOffset + this.offset < this.page * this.pageHeight) {\n            // LOG(`PREV ${scrollOffset}`);\n            this.page -= 1;\n            this.offset -= this.coff;\n            viewport.element.scrollTop = this.prevScrollOffset = Math.floor(scrollOffset + this.coff);\n            // LOG(`PREV# 2 ${viewport.element.scrollTop}`);\n            return;\n          }\n          else {\n            // LOG(`SKIP ${scrollOffset}`);\n            this.prevScrollOffset = scrollOffset;\n          }\n        }\n      }\n      onContentScrolled.call(viewport.pblScrollStrategy);\n    }\n  }\n\n  transformScrollOffset(originalOffset: number): number {\n    return originalOffset + (this.active ? this.offset : 0);\n  }\n\n  transformOffsetToRenderedContentStart(originalRenderContentStart: number | null): number | null {\n    return (!originalRenderContentStart || !this.active)\n     ? originalRenderContentStart\n     : originalRenderContentStart + this.offset\n    ;\n  }\n\n  transformRenderedContentOffset(offset: number, to: 'to-start' | 'to-end' = 'to-start'): number {\n    if (this.active) {\n      if (!this.afterToEnd) {\n        offset -= this.offset;\n      }\n      this.afterToEnd = to === 'to-end';\n    }\n    return offset;\n  }\n\n  transformTotalContentSize(totalHeight: number, scrollOffset: number): number {\n    const wasActive = !!this.active;\n    if (totalHeight <= MAX_SCROLL_HEIGHT) {\n      this.active = false;\n    } else if (this.totalHeight !== totalHeight) {\n      this.active = true;\n      this.totalHeight = totalHeight;\n      this.pageHeight = MAX_SCROLL_HEIGHT / 100;\n      this.pageCount = Math.ceil(totalHeight / this.pageHeight);\n      this.coff = Math.floor((totalHeight - MAX_SCROLL_HEIGHT) / (this.pageCount - 1));\n      this.prevScrollOffset = scrollOffset;\n      this.offset = this.offset || 0;\n      this.page = this.page || 0;\n      this.afterToEnd = !!this.afterToEnd;\n      totalHeight = MAX_SCROLL_HEIGHT;\n    }\n    if (wasActive !== this.active) {\n      this.activeChanged.next();\n    }\n    return totalHeight;\n  }\n\n  shouldTransformTotalContentSize(totalHeight: number): boolean {\n    if (totalHeight <= MAX_SCROLL_HEIGHT) {\n      this.active = false;\n    } else if (this.totalHeight !== totalHeight) {\n      return true;\n    }\n    return false;\n  }\n\n  dispose() {\n    this.activeChanged.complete();\n  }\n}\n","import { Observable, Subject } from 'rxjs';\nimport { filter, take } from 'rxjs/operators';\nimport {\n  AfterViewInit,\n  Component,\n  ChangeDetectionStrategy,\n  ElementRef,\n  EventEmitter,\n  Inject,\n  InjectionToken,\n  Input,\n  ChangeDetectorRef,\n  ViewChild,\n  ViewEncapsulation,\n  NgZone,\n  Output,\n  Optional,\n  OnInit,\n  OnDestroy,\n} from '@angular/core';\n\nimport { Directionality } from '@angular/cdk/bidi';\nimport { ListRange } from '@angular/cdk/collections';\nimport {\n  CdkVirtualScrollViewport,\n  VIRTUAL_SCROLL_STRATEGY,\n  VIRTUAL_SCROLLABLE,\n  ScrollDispatcher,\n  CdkVirtualForOf,\n  ViewportRuler,\n  CdkVirtualScrollable,\n} from '@angular/cdk/scrolling';\nimport { PblNgridConfigService, unrx } from '@pebula/ngrid/core';\n\nimport { _PblNgridComponent } from '../../../tokens';\nimport { PblNgridBaseVirtualScrollDirective } from './strategies/base-v-scroll.directive'\nimport { PblNgridVirtualScrollStrategy } from './strategies/types';\nimport { NgeVirtualTableRowInfo, PblVirtualScrollForOf } from './virtual-scroll-for-of';\nimport { EXT_API_TOKEN, PblNgridInternalExtensionApi } from '../../../ext/grid-ext-api';\nimport { createScrollWatcherFn } from './scroll-logic/virtual-scroll-watcher';\nimport { PblNgridAutoSizeVirtualScrollStrategy } from './strategies/cdk-wrappers/auto-size';\nimport { RowIntersectionTracker } from './row-intersection';\nimport { resolveScrollStrategy } from './utils';\nimport { VirtualScrollHightPaging } from './virtual-scroll-height-paging';\n\ndeclare module '@pebula/ngrid/core/lib/configuration/type' {\n  interface PblNgridConfig {\n    virtualScroll?: {\n      wheelMode?: PblNgridBaseVirtualScrollDirective['wheelMode'];\n      defaultStrategy?(): PblNgridVirtualScrollStrategy;\n    }\n  }\n}\n\nexport const DISABLE_INTERSECTION_OBSERVABLE = new InjectionToken<boolean>('When found in the DI tree and resolves to true, disable the use of IntersectionObserver');\nconst APP_DEFAULT_VIRTUAL_SCROLL_STRATEGY = () => new PblNgridAutoSizeVirtualScrollStrategy(100, 200);\n\n@Component({\n  selector: 'pbl-cdk-virtual-scroll-viewport',\n  templateUrl: 'virtual-scroll-viewport.component.html',\n  styleUrls: [ 'virtual-scroll-viewport.component.scss' ],\n  host: {\n    class: 'cdk-virtual-scroll-viewport',\n    '[class.cdk-virtual-scroll-disabled]': '!enabled',\n    '[class.cdk-virtual-scroll-orientation-horizontal]': 'orientation === \"horizontal\"',\n    '[class.cdk-virtual-scroll-orientation-vertical]': 'orientation === \"vertical\"'\n  },\n  encapsulation: ViewEncapsulation.None,\n  changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class PblCdkVirtualScrollViewportComponent extends CdkVirtualScrollViewport implements OnInit, AfterViewInit, OnDestroy {\n\n  get isScrolling(): boolean { return this._isScrolling; }\n  readonly enabled: boolean;\n\n  /** @internal */\n  @ViewChild('innerBoxHelper', { static: true }) _innerBoxHelper: ElementRef<HTMLElement>;\n\n  /**\n   * Emits the offset (in pixels) of the rendered content every time it changes.\n   * The emission is done OUTSIDE of angular (i.e. no change detection cycle is triggered).\n   *\n   * Note that when not enabled (i.e `NoVirtualScrollStrategy` is used) there are no emissions.\n   */\n  readonly offsetChange: Observable<number>;\n\n  @Input() stickyRowHeaderContainer: HTMLElement;\n  @Input() stickyRowFooterContainer: HTMLElement;\n\n  /**\n   * Event emitted when the scrolling state of rows in the grid changes.\n   * When scrolling starts `true` is emitted and when the scrolling ends `false` is emitted.\n   *\n   * The grid is in \"scrolling\" state from the first scroll event and until 2 animation frames\n   * have passed without a scroll event.\n   *\n   * When scrolling, the emitted value is the direction: -1 or 1\n   * When not scrolling, the emitted value is 0.\n   *\n   * NOTE: This event runs outside the angular zone.\n   */\n  @Output() scrolling = new EventEmitter< -1 | 0 | 1 >();\n\n  /**\n   * Emits an estimation of the current frame rate while scrolling, in a 500ms interval.\n   *\n   * The frame rate value is the average frame rate from all measurements since the scrolling began.\n   * To estimate the frame rate, a significant number of measurements is required so value is emitted every 500 ms.\n   * This means that a single scroll or short scroll bursts will not result in a `scrollFrameRate` emissions.\n   *\n   * Valid on when virtual scrolling is enabled.\n   *\n   * NOTE: This event runs outside the angular zone.\n   *\n   * In the future the measurement logic might be replaced with the Frame Timing API\n   * See:\n   * - https://developers.google.com/web/updates/2014/11/frame-timing-api\n   * - https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver\n   * - https://github.com/googlearchive/frame-timing-polyfill/wiki/Explainer\n   */\n  @Output() scrollFrameRate = new EventEmitter<number>();\n\n  /**\n   * The `scrollHeight` of the virtual scroll viewport.\n   * The `scrollHeight` is updated by the virtual scroll (update logic and frequency depends on the strategy implementation) through\n   * the `setTotalContentSize(size)` method. The input size is used to position a dummy spacer element at a position that mimics the `scrollHeight`.\n   *\n   * In theory, the size sent to `setTotalContentSize` should equal the `scrollHeight` value, once the browser update's the layout.\n   * In reality it does not happen, sometimes they are not equal. Setting a size will result in a different `scrollHeight`.\n   * This might be due to changes in measurements when handling sticky meta rows (moving back and forth)\n   *\n   * Because the position of the dummy spacer element is set through DI the layout will run in the next micro-task after the call to `setTotalContentSize`.\n   */\n  scrollHeight = 0;\n\n  ngeRenderedContentSize = 0;\n  pblFillerHeight: string;\n\n  get wheelMode(): PblNgridBaseVirtualScrollDirective['wheelMode'] {\n    return (this.pblScrollStrategy as PblNgridBaseVirtualScrollDirective).wheelMode || this.wheelModeDefault || 'passive';\n  }\n\n  /**\n   * Get the current bounding client rectangle boxes for the virtual scroll container\n   * Since performing these measurements impact performance the values are are cached between request animation frames.\n   * I.E 2 subsequent measurements will always return the same value, the next measurement will only take place after\n   * the next animation frame (using `requestAnimationFrame` API)\n   */\n  get getBoundingClientRects(): { clientRect: DOMRect; innerWidth: number; innerHeight: number; scrollBarWidth: number; scrollBarHeight: number; } {\n    if (!this._boundingClientRects) {\n      const innerBox = this._innerBoxHelper.nativeElement.getBoundingClientRect();\n      const clientRect = this.element.getBoundingClientRect();\n      this._boundingClientRects = {\n        clientRect,\n        innerWidth: innerBox.width,\n        innerHeight: innerBox.height,\n        scrollBarWidth: clientRect.width - innerBox.width,\n        scrollBarHeight: clientRect.height - innerBox.height,\n      }\n\n      const resetCurrentBox = () => this._boundingClientRects = undefined;\n      if (this._isScrolling) {\n        this.scrolling.pipe(filter(scrolling => scrolling === 0), take(1)).subscribe(resetCurrentBox);\n      } else {\n        requestAnimationFrame(resetCurrentBox);\n      }\n    }\n\n    return this._boundingClientRects;\n  }\n\n  get innerWidth(): number {\n    return this.getBoundingClientRects.innerWidth;\n  }\n\n  get outerWidth(): number {\n    return this.getBoundingClientRects.clientRect.width;\n  }\n\n  get innerHeight(): number {\n    return this.getBoundingClientRects.innerWidth;\n  }\n\n  get outerHeight(): number {\n    return this.getBoundingClientRects.clientRect.height;\n  }\n\n  get scrollWidth(): number {\n    return this.element.scrollWidth;\n  }\n\n  /**\n   * When true, the virtual paging feature is enabled because the virtual content size exceed the supported height of the browser so paging is enable.\n   */\n  get virtualPagingActive() { return this.heightPaging?.active ?? false; }\n\n  readonly intersection: RowIntersectionTracker;\n  readonly element: HTMLElement;\n  readonly _minWidth$: Observable<number>;\n\n  private offsetChange$ = new Subject<number>();\n  private offset = 0;\n  private isCDPending: boolean;\n  private _isScrolling = false;\n\n  private wheelModeDefault:  PblNgridBaseVirtualScrollDirective['wheelMode'];\n  private grid: _PblNgridComponent<any>;\n  private forOf?: PblVirtualScrollForOf<any>;\n  private _boundingClientRects: PblCdkVirtualScrollViewportComponent['getBoundingClientRects'];\n  private heightPaging: VirtualScrollHightPaging;\n\n  constructor(elRef: ElementRef<HTMLElement>,\n              private cdr: ChangeDetectorRef,\n              ngZone: NgZone,\n              config: PblNgridConfigService,\n              @Optional() @Inject(VIRTUAL_SCROLL_STRATEGY) public pblScrollStrategy: PblNgridVirtualScrollStrategy,\n              @Optional() dir: Directionality,\n              scrollDispatcher: ScrollDispatcher,\n              viewportRuler: ViewportRuler,\n              @Inject(EXT_API_TOKEN) private extApi: PblNgridInternalExtensionApi,\n              @Optional() @Inject(DISABLE_INTERSECTION_OBSERVABLE) disableIntersectionObserver?: boolean,\n              @Optional() @Inject(VIRTUAL_SCROLLABLE) scrollable?: CdkVirtualScrollable,) {\n    super(elRef,\n          cdr,\n          ngZone,\n            // TODO: Replace with `PblNgridDynamicVirtualScrollStrategy` in v4\n          pblScrollStrategy = resolveScrollStrategy(config, pblScrollStrategy, APP_DEFAULT_VIRTUAL_SCROLL_STRATEGY),\n          dir,\n          scrollDispatcher,\n          viewportRuler,\n          scrollable);\n    this.element = elRef.nativeElement;\n    this.grid = extApi.grid;\n\n    if (config.has('virtualScroll')) {\n      this.wheelModeDefault = config.get('virtualScroll').wheelMode;\n    }\n    config.onUpdate('virtualScroll').pipe(unrx(this)).subscribe( change => this.wheelModeDefault = change.curr.wheelMode);\n\n    this.enabled = pblScrollStrategy.type && pblScrollStrategy.type !== 'vScrollNone';\n\n    extApi.setViewport(this);\n    this.offsetChange = this.offsetChange$.asObservable();\n\n    this._minWidth$ = this.grid.columnApi.totalColumnWidthChange;\n\n    this.intersection = new RowIntersectionTracker(this.element, !!disableIntersectionObserver);\n  }\n\n  ngOnInit(): void {\n    this.pblScrollStrategy.attachExtApi(this.extApi);\n    if (this.enabled) {\n      // Enabling virtual scroll event with browser height limit\n      // Based on: http://jsfiddle.net/SDa2B/263/\n      this.heightPaging = new VirtualScrollHightPaging(this);\n    }\n    super.ngOnInit();\n\n    // Init the scrolling watcher which track scroll events an emits `scrolling` and `scrollFrameRate` events.\n    this.ngZone.runOutsideAngular( () => this.elementScrolled().subscribe(createScrollWatcherFn(this)) );\n  }\n\n  ngAfterViewInit(): void {\n    // If virtual scroll is disabled (`NoVirtualScrollStrategy`) we need to disable any effect applied\n    // by the viewport, wrapping the content injected to it.\n    // The main effect is the grid having height 0 at all times, unless the height is explicitly set.\n    // This happens because the content taking out of the layout, wrapped in absolute positioning.\n    // Additionally, the host itself (viewport) is set to contain: strict.\n    const { grid } = this;\n    if (this.enabled) {\n      this.forOf = new PblVirtualScrollForOf<any>(this.extApi, this.ngZone);\n      if (!this.heightPaging.active) {\n        this.forOf.wheelControl.wheelListen();\n      }\n\n      // `wheel` mode does not work well with the workaround to fix height limit, so we disable it when it's on\n      this.heightPaging.activeChanged\n        .subscribe( () => {\n          if (this.heightPaging.active) {\n            this.forOf.wheelControl.wheelUnListen();\n          } else {\n            this.forOf.wheelControl.wheelListen();\n          }\n        });\n    }\n\n    this.scrolling\n      .pipe(unrx(this))\n      .subscribe( isScrolling => {\n        this._isScrolling = !!isScrolling;\n        if (isScrolling) {\n          grid.addClass('pbl-ngrid-scrolling');\n        } else {\n          grid.removeClass('pbl-ngrid-scrolling');\n        }\n      });\n  }\n\n  ngOnDestroy(): void {\n    this.intersection.destroy();\n    this.heightPaging?.dispose();\n    super.ngOnDestroy();\n    this.detachViewPort();\n    this.offsetChange$.complete();\n    unrx.kill(this);\n  }\n\n  reMeasureCurrentRenderedContent() {\n    this.pblScrollStrategy.onContentRendered();\n  }\n\n  measureScrollOffset(from?: 'top' | 'left' | 'right' | 'bottom' | 'start' | 'end'): number {\n    const scrollOffset = super.measureScrollOffset(from);\n    return (!from || from === 'top') && this.heightPaging ? this.heightPaging.transformScrollOffset(scrollOffset) : scrollOffset;\n  }\n\n  getOffsetToRenderedContentStart(): number | null {\n    const renderedContentStart = super.getOffsetToRenderedContentStart();\n    return this.heightPaging?.transformOffsetToRenderedContentStart(renderedContentStart) ?? renderedContentStart;\n  }\n\n  setRenderedContentOffset(offset: number, to: 'to-start' | 'to-end' = 'to-start') {\n    if (this.heightPaging?.active) {\n      offset = this.heightPaging.transformRenderedContentOffset(offset, to);\n    }\n    super.setRenderedContentOffset(offset, to);\n    if (this.enabled) {\n      if (this.offset !== offset) {\n        this.offset = offset;\n        if (!this.isCDPending) {\n          this.isCDPending = true;\n\n          this.ngZone.runOutsideAngular(() => Promise.resolve()\n            .then( () => {\n              this.isCDPending = false;\n              this.offsetChange$.next(this.offset);\n            })\n          );\n        }\n      }\n    }\n  }\n\n  setTotalContentSize(size: number) {\n    if (this.heightPaging?.shouldTransformTotalContentSize(size)) {\n      size = this.heightPaging.transformTotalContentSize(size, super.measureScrollOffset());\n    }\n    super.setTotalContentSize(size);\n\n    // TODO(shlomiassaf)[perf, 3]: run this once... (aggregate all calls within the same animation frame)\n    requestAnimationFrame(() => {\n      this.scrollHeight = this.element.scrollHeight; //size;\n      this.updateFiller();\n      // We must trigger a change detection cycle because the filler div element is updated through bindings\n      this.cdr.markForCheck();\n    })\n  }\n\n  /** Measure the combined size of all of the rendered items. */\n  measureRenderedContentSize(): number {\n    let size = super.measureRenderedContentSize();\n    if (this.orientation === 'vertical') {\n      size -= this.stickyRowHeaderContainer.offsetHeight + this.stickyRowFooterContainer.offsetHeight;\n\n      // Compensate for hz scroll bar, if exists, only in non virtual scroll mode.\n      if (!this.enabled) {\n        size += this.outerHeight - this.innerHeight;\n      }\n    }\n    return this.ngeRenderedContentSize = size;\n  }\n\n  checkViewportSize() {\n    // TODO: Check for changes in `CdkVirtualScrollViewport` source code, when resizing is handled!\n    // see https://github.com/angular/material2/blob/28fb3abe77c5336e4739c820584ec99c23f1ae38/src/cdk/scrolling/virtual-scroll-viewport.ts#L341\n    const prev = this.getViewportSize();\n    super.checkViewportSize();\n    if (prev !== this.getViewportSize()) {\n      this.updateFiller();\n    }\n  }\n\n  detachViewPort(): void {\n    if (this.forOf) {\n      this.forOf.destroy();\n      this.forOf = undefined;\n    }\n  }\n\n  /**\n   * TODO(REFACTOR_REF 1): Move to use rowApi so we can accept rows/cells and not html elements.\n   * It will allow us to bring into view rows as well.\n   * This will change the methods signature!\n   * @internal\n   */\n  _scrollIntoView(cellElement: HTMLElement) {\n    const container = this.element;\n    const elBox = cellElement.getBoundingClientRect();\n    const containerBox = this.getBoundingClientRects.clientRect;\n\n    // Vertical handling.\n    // We have vertical virtual scroll, so here we use the virtual scroll API to scroll into the target\n    if (elBox.top < containerBox.top) { // out from top\n      const offset = elBox.top - containerBox.top;\n      this.scrollToOffset(this.measureScrollOffset() + offset);\n    } else if (elBox.bottom > containerBox.bottom) { // out from bottom\n      const offset = elBox.bottom - (containerBox.bottom - this.getScrollBarThickness('horizontal'));\n      this.scrollToOffset(this.measureScrollOffset() + offset);\n    }\n\n    // Horizontal handling.\n    // We DON'T have horizontal virtual scroll, so here we use the DOM API to scroll into the target\n    // TODO: When implementing horizontal virtual scroll, refactor this as well.\n    if (elBox.left < containerBox.left) { // out from left\n      const offset = elBox.left - containerBox.left;\n      container.scroll(container.scrollLeft + offset, container.scrollTop);\n    } else if (elBox.right > containerBox.right) { // out from right\n      const offset = elBox.right - (containerBox.right - this.getScrollBarThickness('vertical'));\n      container.scroll(container.scrollLeft + offset, container.scrollTop);\n    }\n  }\n\n  onSourceLengthChange(prev: number, curr: number): void {\n    this.checkViewportSize();\n    this.updateFiller();\n  }\n\n  attach(forOf: CdkVirtualForOf<any> & NgeVirtualTableRowInfo) {\n    super.attach(forOf);\n    const scrollStrategy = this.pblScrollStrategy instanceof PblNgridBaseVirtualScrollDirective\n      ? this.pblScrollStrategy._scrollStrategy\n      : this.pblScrollStrategy\n    ;\n    if (scrollStrategy instanceof PblNgridAutoSizeVirtualScrollStrategy) {\n      scrollStrategy.averager.setRowInfo(forOf);\n    }\n  }\n\n  setRenderedRange(range: ListRange) {\n    super.setRenderedRange(range);\n  }\n\n  getScrollBarThickness(location: 'horizontal' | 'vertical') {\n    switch (location) {\n      case 'horizontal':\n        return this.outerHeight - this.innerHeight;\n      case 'vertical':\n        return this.outerWidth - this.innerWidth;\n    }\n  }\n\n  private updateFiller(): void {\n    this.measureRenderedContentSize();\n    if (this.grid.noFiller) {\n      this.pblFillerHeight = undefined;\n    } else {\n      this.pblFillerHeight = this.getViewportSize() >= this.ngeRenderedContentSize ?\n        `calc(100% - ${this.ngeRenderedContentSize}px)`\n        : undefined\n      ;\n    }\n  }\n\n}\n\ndeclare global {\n  interface CSSStyleDeclaration {\n    contain: string;\n  }\n}\n","<p #innerBoxHelper class=\"cdk-virtual-scroll-inner-width\"></p>\n<ng-content select=\".cdk-virtual-scroll-before-content-wrapper\"></ng-content>\n<!--\n  Wrap the rendered content in an element that will be used to offset it based on the scroll\n  position.\n-->\n<div #contentWrapper [class.cdk-virtual-scroll-content-wrapper]=\"enabled\" style=\"width: 100%\" [style.minWidth.px]=\"_minWidth$ | async\">\n  <ng-content></ng-content>\n</div>\n\n<!--\n  Spacer used to force the scrolling container to the correct size for the *total* number of items\n  so that the scrollbar captures the size of the entire data set.\n-->\n<div *ngIf=\"enabled\" class=\"cdk-virtual-scroll-spacer\"\n     [style.width]=\"_totalContentWidth\" [style.height]=\"_totalContentHeight\"></div>\n<div *ngIf=\"pblFillerHeight && enabled\"\n    class=\"pbl-ngrid-space-fill\"\n    [style.minWidth.px]=\"_minWidth$ | async\"\n    [style.top.px]=\"ngeRenderedContentSize\"\n    [style.height]=\"pblFillerHeight\"></div>\n","import { asapScheduler, animationFrameScheduler } from 'rxjs';\nimport { filter, take, tap, observeOn, switchMap, map, mapTo, startWith, pairwise } from 'rxjs/operators';\nimport {\n  AfterViewInit,\n  Component,\n  ElementRef,\n  Input,\n  Injector,\n  ChangeDetectionStrategy,\n  ViewChild,\n  ViewChildren,\n  QueryList,\n  AfterContentInit,\n  ViewEncapsulation,\n  OnChanges,\n  OnDestroy,\n  SimpleChanges,\n  ChangeDetectorRef,\n  TemplateRef,\n  ViewContainerRef,\n  EmbeddedViewRef,\n  NgZone,\n  isDevMode, forwardRef, Attribute, Optional,\n} from '@angular/core';\n\nimport { Direction, Directionality } from '@angular/cdk/bidi';\nimport { BooleanInput, coerceBooleanProperty, coerceNumberProperty, NumberInput } from '@angular/cdk/coercion';\nimport { CdkHeaderRowDef, CdkFooterRowDef, CdkRowDef } from '@angular/cdk/table';\n\nimport {\n  PblNgridConfigService,\n\n  PblNgridPaginatorKind,\n\n  DataSourcePredicate, DataSourceFilterToken, PblNgridSortDefinition, PblDataSource, DataSourceOf, createDS, PblNgridOnDataSourceEvent,\n\n  PblNgridColumnDefinitionSet,\n  PblMetaRowDefinitions,\n\n  deprecatedWarning, unrx,\n} from '@pebula/ngrid/core';\n\nimport { PBL_NGRID_COMPONENT } from '../tokens';\nimport { EXT_API_TOKEN, PblNgridExtensionApi, PblNgridInternalExtensionApi } from '../ext/grid-ext-api';\nimport { PblNgridPluginController, PblNgridPluginContext } from '../ext/plugin-control';\nimport { PblNgridRegistryService } from './registry/registry.service';\nimport { PblCdkTableComponent } from './pbl-cdk-table/pbl-cdk-table.component';\nimport { PblColumn, PblNgridColumnSet,  } from './column/model';\nimport { PblColumnStore, ColumnApi, AutoSizeToFitOptions } from './column/management';\nimport { PblNgridCellContext, PblNgridMetaCellContext, PblNgridContextApi, PblNgridRowContext } from './context/index';\nimport { PblCdkVirtualScrollViewportComponent } from './features/virtual-scroll/virtual-scroll-viewport.component';\nimport { PblNgridMetaRowService } from './meta-rows/meta-row.service';\n\nimport { RowsApi } from './row';\nimport { createApis } from './api-factory';\n\nexport function internalApiFactory(grid: { _extApi: PblNgridExtensionApi; }) { return grid._extApi; }\nexport function pluginControllerFactory(grid: { _plugin: PblNgridPluginContext; }) { return grid._plugin.controller; }\nexport function metaRowServiceFactory(grid: { _extApi: PblNgridExtensionApi; }) { return grid._extApi.rowsApi.metaRowService; }\n\ndeclare module '../ext/types' {\n  interface OnPropChangedSources {\n    grid: PblNgridComponent;\n  }\n  interface OnPropChangedProperties {\n    grid: Pick<PblNgridComponent, 'showFooter' | 'showHeader' | 'rowClassUpdate' | 'rowClassUpdateFreq'>;\n  }\n}\n\n@Component({\n  selector: 'pbl-ngrid',\n  templateUrl: './ngrid.component.html',\n  providers: [\n    {provide: PBL_NGRID_COMPONENT, useExisting: PblNgridComponent},\n    PblNgridRegistryService,\n    {\n      provide: PblNgridPluginController,\n      useFactory: pluginControllerFactory,\n      deps: [forwardRef(() => PblNgridComponent)],\n    },\n    {\n      provide: EXT_API_TOKEN,\n      useFactory: internalApiFactory,\n      deps: [forwardRef(() => PblNgridComponent)],\n    },\n    {\n      provide: PblNgridMetaRowService,\n      useFactory: metaRowServiceFactory,\n      deps: [forwardRef(() => PblNgridComponent)],\n    }\n  ],\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  encapsulation: ViewEncapsulation.None,\n})\nexport class PblNgridComponent<T = any> implements AfterContentInit, AfterViewInit, OnChanges, OnDestroy {\n\n  /**\n   * Show/Hide the header row.\n   * Default: true\n   */\n  @Input() get showHeader(): boolean { return this._showHeader; };\n  set showHeader(value: boolean) {\n    this._extApi.notifyPropChanged(this, 'showHeader', this._showHeader, this._showHeader = coerceBooleanProperty(value));\n  }\n  _showHeader: boolean;\n\n  /**\n   * Show/Hide the footer row.\n   * Default: false\n   */\n  @Input() get showFooter(): boolean { return this._showFooter; };\n  set showFooter(value: boolean) {\n    this._extApi.notifyPropChanged(this, 'showFooter', this._showFooter, this._showFooter = coerceBooleanProperty(value));\n  }\n  _showFooter: boolean;\n\n  /**\n   * When true, the filler is disabled.\n   */\n  @Input() get noFiller(): boolean { return this._noFiller; };\n  set noFiller(value: boolean) {\n    this._noFiller = coerceBooleanProperty(value);\n  }\n  _noFiller: boolean;\n\n  /**\n   * Set's the behavior of the grid when tabbing.\n   * The default behavior is none (rows and cells are not focusable)\n   *\n   * Note that the focus mode has an effect on other functions, for example a detail row will toggle (open/close) using\n   * ENTER / SPACE only when focusMode is set to `row`.\n   */\n  @Input() focusMode: 'row' | 'cell' | 'none' | '' | false | undefined;\n\n  /**\n   * The grid's source of data\n   *\n   * @remarks\n   * The grid's source of data, which can be provided in 2 ways:\n   *\n   * - DataSourceOf<T>\n   * - PblDataSource<T>\n   *\n   * The grid only works with `PblDataSource<T>`, `DataSourceOf<T>` is a shortcut for providing\n   * the data array directly.\n   *\n   * `DataSourceOf<T>` can be:\n   *\n   * - Simple data array (each object represents one grid row)\n   * - Promise for a data array\n   * - Stream that emits a data array each time the array changes\n   *\n   * When a `DataSourceOf<T>` is provided it is converted into an instance of `PblDataSource<T>`.\n   *\n   * To access the `PblDataSource<T>` instance use the `ds` property (readonly).\n   *\n   * It is highly recommended to use `PblDataSource<T>` directly, the datasource factory makes it easy.\n   * For example, when an array is provided the factory is used to convert it to a datasource:\n   *\n   * ```typescript\n   * const collection: T[] = [];\n   * const pblDataSource = createDS<T>().onTrigger( () => collection ).create();\n   * ```\n   *\n   * > This is a write-only (setter) property that triggers the `setDataSource` method.\n   */\n  @Input() set dataSource(value: PblDataSource<T> | DataSourceOf<T>) {\n    if (value instanceof PblDataSource) {\n      this.setDataSource(value);\n    } else {\n      this.setDataSource(createDS<T>().onTrigger( () => value || [] ).create());\n    }\n  }\n\n  get ds(): PblDataSource<T> { return this._dataSource; };\n\n  @Input() get usePagination(): PblNgridPaginatorKind | false | '' { return this._pagination; }\n  set usePagination(value: PblNgridPaginatorKind | false | '') {\n    if ((value as any) === '') {\n      value = 'pageNumber';\n    }\n    if ( value !== this._pagination ) {\n      this._pagination = value as any;\n      this._extApi.logicaps.pagination();\n    }\n  }\n\n  @Input() get noCachePaginator(): boolean { return this._noCachePaginator; }\n  set noCachePaginator(value: boolean) {\n    value = coerceBooleanProperty(value);\n    if (this._noCachePaginator !== value) {\n      this._noCachePaginator = value;\n      if (this.ds && this.ds.paginator) {\n        this.ds.paginator.noCacheMode = value;\n      }\n    }\n  }\n\n  /**\n   * The column definitions for this grid.\n   */\n  @Input() columns: PblNgridColumnSet | PblNgridColumnDefinitionSet;\n\n  @Input() rowClassUpdate: undefined | ( (context: PblNgridRowContext<T>) => ( string | string[] | Set<string> | { [klass: string]: any } ));\n  @Input() rowClassUpdateFreq: 'item' | 'ngDoCheck' | 'none' = 'item';\n\n  rowFocus: 0 | '' = '';\n  cellFocus: 0 | '' = '';\n\n  /**\n   * The minimum height to assign to the data viewport (where data rows are shown)\n   *\n   * The data viewport is the scrollable area where all data rows are visible, and some metadata rows might also be there\n   * depending on their type (fixed/row/sticky) as well as outer section items.\n   *\n   * By default, the data viewport has no size and it will grow based on the available space it has left within the container.\n   * The container will first assign height to any fixed rows and dynamic content (before/after) provided.\n   *\n   * If the container height is fixed (e.g. `<pbl-ngrid style=\"height: 500px\"></pbl-ngrid>`) and there is no height left\n   * for the data viewport then it will get no height (0 height).\n   *\n   * To deal with this issue there are 2 options:\n   *\n   * 1. Do not limit the height of the container\n   * 2. Provide a default minimum height for the data viewport\n   *\n   * Option number 1 is not practical, it will disable all scrolling in the table, making it a long box scrollable by the host container.\n   *\n   * This is where we use option number 2.\n   * By defining a default minimum height we ensure visibility and since there's a scroll there, the user can view all of the data.\n   *\n   * There are 2 types of inputs:\n   *\n   * A. Default minimum height in PX\n   * B. Default minimum height in ROW COUNT\n   *\n   * For A, provide a positive value, for B provide a negative value.\n   *\n   * For example:\n   *\n   *  - Minimum data viewport of 100 pixels: `<pbl-ngrid minDataViewHeight=\"100\"></pbl-ngrid>`\n   *  - Minimum data viewport of 2 ros: `<pbl-ngrid minDataViewHeight=\"-2\"></pbl-ngrid>`\n   *\n   * Notes when using rows:\n   *  - The row height is calculated based on an initial row pre-loaded by the grid, this row will get it's height from the CSS theme defined.\n   *  - The ROW COUNT is the lower value between the actual row count provided and the total rows to render.\n   *\n   * ## Container Overflow:\n   *\n   * Note that when using a default minimum height, if the minimum height of the data viewport PLUS the height of all other elements in the container EXCEEDS any fixed\n   * height assigned to the container, the container will render a scrollbar which results in the possibility of 2 scrollbars, 1 for the container and the seconds\n   * for the data viewport, if it has enough data rows.\n   */\n  @Input() get minDataViewHeight(): number { return this.minDataViewHeight; }\n  set minDataViewHeight(value: number) {\n    value = coerceNumberProperty(value);\n    if (this._minDataViewHeight !== value) {\n      this._minDataViewHeight = value;\n    }\n  }\n\n  /**\n   * @deprecated Will be removed in v5, see `minDataViewHeight`\n   */\n  @Input() get fallbackMinHeight(): number {\n    if (typeof ngDevMode === 'undefined' || ngDevMode) {\n      deprecatedWarning('PblNgridComponent.fallbackMinHeight', '4', 'PblNgridComponent.minDataViewHeight');\n    }\n    return this._minDataViewHeight > 0 ? this._minDataViewHeight : undefined;\n  }\n  set fallbackMinHeight(value: number) {\n    if (typeof ngDevMode === 'undefined' || ngDevMode) {\n      deprecatedWarning('PblNgridComponent.fallbackMinHeight', '4', 'PblNgridComponent.minDataViewHeight');\n    }\n    this.minDataViewHeight = value;\n  }\n\n  get dir(): Direction { return this._dir };\n\n  private _dir: Direction = 'ltr';\n  private _minDataViewHeight = 0;\n  private _dataSource: PblDataSource<T>;\n\n  @ViewChild('beforeTable', { read: ViewContainerRef, static: true }) _vcRefBeforeTable: ViewContainerRef;\n  @ViewChild('beforeContent', { read: ViewContainerRef, static: true }) _vcRefBeforeContent: ViewContainerRef;\n  @ViewChild('afterContent', { read: ViewContainerRef, static: true }) _vcRefAfterContent: ViewContainerRef;\n  @ViewChild('fbTableCell', { read: TemplateRef, static: true }) _fbTableCell: TemplateRef<PblNgridCellContext<T>>;\n  @ViewChild('fbHeaderCell', { read: TemplateRef, static: true }) _fbHeaderCell: TemplateRef<PblNgridMetaCellContext<T>>;\n  @ViewChild('fbFooterCell', { read: TemplateRef, static: true }) _fbFooterCell: TemplateRef<PblNgridMetaCellContext<T>>;\n  @ViewChild(CdkRowDef, { static: true }) _tableRowDef: CdkRowDef<T>;\n  @ViewChildren(CdkHeaderRowDef) _headerRowDefs: QueryList<CdkHeaderRowDef>;\n  @ViewChildren(CdkFooterRowDef) _footerRowDefs: QueryList<CdkFooterRowDef>;\n\n  /**\n   * When true, the virtual paging feature is enabled because the virtual content size exceed the supported height of the browser so paging is enable.\n   */\n  get virtualPagingActive() { return this.viewport.virtualPagingActive; }\n\n  get metaHeaderRows() { return this._store.metaHeaderRows; }\n  get metaFooterRows() { return this._store.metaFooterRows; }\n  get metaColumns(): PblColumnStore['metaColumns'] { return this._store.metaColumns; }\n  get columnRowDef(): { header: PblMetaRowDefinitions; footer: PblMetaRowDefinitions; } {\n    return {\n      header: this._store.headerColumnDef,\n      footer: this._store.footerColumnDef\n    };\n  }\n\n  /**\n   * True when the component is initialized (after AfterViewInit)\n   */\n  readonly isInit: boolean;\n  readonly columnApi: ColumnApi<T>;\n  readonly rowsApi: RowsApi<T>;\n  readonly contextApi: PblNgridContextApi<T>;\n\n  get viewport() { return this._viewport; }\n  get innerTableMinWidth() { return this._cdkTable?.minWidth }\n\n  private _store: PblColumnStore;\n  private _pagination: PblNgridPaginatorKind | false;\n  private _noCachePaginator = false;\n  private _plugin: PblNgridPluginContext;\n  private _extApi: PblNgridInternalExtensionApi<T>;\n  private _cdkTable: PblCdkTableComponent<T>;\n  private _viewport: PblCdkVirtualScrollViewportComponent;\n\n  constructor(injector: Injector,\n              vcRef: ViewContainerRef,\n              private elRef: ElementRef<HTMLElement>,\n              private ngZone: NgZone,\n              private cdr: ChangeDetectorRef,\n              private config: PblNgridConfigService,\n              // TODO: Make private in v5\n              /** @deprecated Will be removed in v5 */\n              public registry: PblNgridRegistryService,\n              @Attribute('id') public readonly id: string,\n              @Optional() dir?: Directionality) {\n    this._extApi = createApis(this, { config, registry, ngZone, injector, vcRef, elRef, cdRef: cdr, dir });\n\n    dir?.change\n      .pipe(\n        unrx(this, 'dir'),\n        startWith(dir.value)\n      )\n      .subscribe(value => this._dir = value);\n\n    const gridConfig = config.get('table');\n    this.showHeader = gridConfig.showHeader;\n    this.showFooter = gridConfig.showFooter;\n    this.noFiller = gridConfig.noFiller;\n\n    this._extApi.onConstructed(() => {\n      this._viewport = this._extApi.viewport;\n      this._cdkTable = this._extApi.cdkTable;\n    });\n    this.contextApi = this._extApi.contextApi;\n    this._store = this._extApi.columnStore;\n    this._plugin = this._extApi.plugin;\n    this.columnApi = this._extApi.columnApi;\n    this.rowsApi = this._extApi.rowsApi;\n  }\n\n  ngAfterContentInit(): void {\n    this._extApi.logicaps.bindRegistry();\n  }\n\n  ngAfterViewInit(): void {\n    this.invalidateColumns();\n\n    Object.defineProperty(this, 'isInit', { value: true });\n    this._plugin.emitEvent({ source: 'grid', kind: 'onInit' });\n\n    this._extApi.logicaps.pagination();\n\n    this.contextApi.focusChanged\n      .subscribe( event => {\n        if (event.curr) {\n          this.rowsApi\n            .findDataRowByIdentity(event.curr.rowIdent)\n            ?.getCellById(this.columnApi.columnIds[event.curr.colIndex])\n            ?.focus();\n        }\n      });\n  }\n\n  ngOnChanges(changes: SimpleChanges): void {\n    let processColumns = false;\n\n    if (changes.focusMode) {\n      this.rowFocus = this.focusMode === 'row' ? 0 : '';\n      this.cellFocus = this.focusMode === 'cell' ? 0 : '';\n    }\n\n    if ( changes.columns && this.isInit ) {\n      processColumns = true;\n    }\n\n    if ( processColumns === true ) {\n      this.invalidateColumns();\n      this.ngZone.onStable.pipe(take(1)).subscribe(() => this.rowsApi.syncRows('all', true));\n    }\n  }\n\n  ngOnDestroy(): void {\n    this._store.dispose();\n    const destroy = () => {\n      this._plugin.destroy();\n      this.viewport.detachViewPort();\n      unrx.kill(this);\n    };\n\n    let p: Promise<void>;\n    this._plugin.emitEvent({ source: 'grid', kind: 'onDestroy', wait: (_p: Promise<void>) => p = _p });\n    if (p) {\n      p.then(destroy).catch(destroy);\n    } else {\n      destroy();\n    }\n  }\n\n  trackBy(index: number, item: T): any {\n    return index;\n  }\n\n  /**\n   * Clear the current sort definitions.\n   * This method is a proxy to `PblDataSource.setSort`, For more information see `PblDataSource.setSort`\n   *\n   * @param skipUpdate When true will not update the datasource, use this when the data comes sorted and you want to sync the definitions with the current data set.\n   * default to false.\n   */\n  setSort(skipUpdate?: boolean): void;\n  /**\n   * Set the sorting definition for the current data set.\n   *\n   * This method is a proxy to `PblDataSource.setSort` with the added sugar of providing column by string that match the `id` or `alias` properties.\n   * For more information see `PblDataSource.setSort`\n   *\n   * @param columnOrAlias A column instance or a string matching `PblColumn.alias` or `PblColumn.id`.\n   * @param skipUpdate When true will not update the datasource, use this when the data comes sorted and you want to sync the definitions with the current data set.\n   * default to false.\n   */\n  setSort(columnOrAlias: PblColumn | string, sort: PblNgridSortDefinition, skipUpdate?: boolean): void;\n  setSort(columnOrAlias?: PblColumn | string | boolean, sort?: PblNgridSortDefinition, skipUpdate = false): void {\n    if (!columnOrAlias || typeof columnOrAlias === 'boolean') {\n      this.ds.setSort(!!columnOrAlias);\n      return;\n    }\n\n    let column: PblColumn;\n    if (typeof columnOrAlias === 'string') {\n      column = this._store.visibleColumns.find( c => c.alias ? c.alias === columnOrAlias : (c.sort && c.id === columnOrAlias) );\n      if (!column && isDevMode()) {\n        console.warn(`Could not find column with alias \"${columnOrAlias}\".`);\n        return;\n      }\n    } else {\n      column = columnOrAlias;\n    }\n    this.ds.setSort(column, sort, skipUpdate);\n  }\n\n  /**\n   * Clear the filter definition for the current data set.\n   *\n   * This method is a proxy to `PblDataSource.setFilter`, For more information see `PblDataSource.setFilter`.\n   */\n  setFilter(): void;\n  /**\n   * Set the filter definition for the current data set using a function predicate.\n   *\n  * This method is a proxy to `PblDataSource.setFilter` with the added sugar of providing column by string that match the `id` property.\n   * For more information see `PblDataSource.setFilter`\n   */\n  setFilter(value: DataSourcePredicate, columns?: PblColumn[] | string[]): void;\n  /**\n   * Set the filter definition for the current data set using a value to compare with and a list of columns with the values to compare to.\n   *\n   * This method is a proxy to `PblDataSource.setFilter` with the added sugar of providing column by string that match the `id` property.\n   * For more information see `PblDataSource.setFilter`\n   */\n  setFilter(value: any, columns: PblColumn[] | string[]): void;\n  setFilter(value?: DataSourceFilterToken, columns?: PblColumn[] | string[]): void {\n    if (arguments.length > 0) {\n      let columnInstances: PblColumn[];\n      if (Array.isArray(columns) && typeof columns[0] === 'string') {\n        columnInstances = [];\n        for (const colId of columns) {\n          const column = this._store.visibleColumns.find( c => c.alias ? c.alias === colId : (c.id === colId) );\n          if (!column && isDevMode()) {\n            console.warn(`Could not find column with alias ${colId} \"${colId}\".`);\n            return;\n          }\n          columnInstances.push(column);\n        }\n      } else {\n        columnInstances = columns as any;\n      }\n      this.ds.setFilter(value, columnInstances);\n    } else {\n      this.ds.setFilter();\n    }\n  }\n\n  setDataSource(value: PblDataSource<T>): void {\n    if (this._dataSource !== value) {\n      // KILL ALL subscriptions for the previous datasource.\n      if (this._dataSource) {\n        unrx.kill(this, this._dataSource);\n      }\n\n      const prev = this._dataSource;\n      this._dataSource = value;\n      this._cdkTable.dataSource = value as any;\n\n      this._extApi.logicaps.pagination();\n      this._extApi.logicaps.noData(false);\n\n      if (prev?.hostGrid === this) {\n        prev._detachEmitter();\n      }\n\n      this._dataSource._attachEmitter(this._plugin);\n      this._plugin.emitEvent({\n        source: 'ds',\n        kind: 'onDataSource',\n        prev,\n        curr: value\n      } as PblNgridOnDataSourceEvent);\n\n      // clear the context, new datasource\n      this._extApi.contextApi.clear();\n\n      if ( value ) {\n        if (isDevMode()) {\n          value.onError.pipe(unrx(this, value)).subscribe(console.error.bind(console));\n        }\n\n        // We register to this event because it fires before the entire data-changing process starts.\n        // This is required because `onRenderDataChanging` is fired async, just before the data is emitted.\n        // Its not enough to clear the context when `setDataSource` is called, we also need to handle `refresh` calls which will not\n        // trigger this method.\n        value.onSourceChanging\n          .pipe(unrx(this, value))\n          .subscribe( () => {\n            if (this.config.get('table').clearContextOnSourceChanging) {\n              this._extApi.contextApi.clear();\n            }\n          });\n\n        // Run CD, scheduled as a micro-task, after each rendering\n        value.onRenderDataChanging\n          .pipe(\n            filter( ({event}) => !event.isInitial && (event.pagination.changed || event.sort.changed || event.filter.changed)),\n            // Context between the operations are not supported at the moment\n            // Event for client side operations...\n            // TODO: can we remove this? we clear the context with `onSourceChanging`\n            tap( () => !this._store.primary && this._extApi.contextApi.clear() ),\n            switchMap( () => value.onRenderedDataChanged.pipe(take(1), mapTo(this.ds.renderLength)) ),\n            observeOn(asapScheduler),\n            unrx(this, value)\n          )\n          .subscribe( previousRenderLength => {\n            // If the number of rendered items has changed the grid will update the data and run CD on it.\n            // so we only update the rows.\n            if (previousRenderLength === this.ds.renderLength) {\n              this.rowsApi.syncRows(true);\n            } else {\n              this.rowsApi.syncRows('header', true);\n              this.rowsApi.syncRows('footer', true);\n            }\n          });\n\n        // Handling no data overlay\n        // Handling fallback minimum height.\n        value.onRenderedDataChanged\n          .pipe(\n            map( () => this.ds.renderLength ),\n            startWith(null),\n            pairwise(),\n            tap( ([prev, curr]) => {\n              const noDataShowing = !!this._extApi.logicaps.noData.viewActive;\n              if ( (curr > 0 && noDataShowing) || (curr === 0 && !noDataShowing) ) {\n                this._extApi.logicaps.noData();\n              }\n            }),\n            observeOn(animationFrameScheduler), // ww want to give the browser time to remove/add rows\n            unrx(this, value)\n          )\n          .subscribe(() => {\n            const el = this.viewport.element;\n            if (this.ds.renderLength > 0 && this._minDataViewHeight) {\n              let h: number;\n              if (this._minDataViewHeight > 0) {\n                h = Math.min(this._minDataViewHeight, this.viewport.measureRenderedContentSize());\n              } else {\n                const rowHeight = this.findInitialRowHeight();\n                const rowCount = Math.min(this.ds.renderLength, this._minDataViewHeight * -1);\n                h = rowHeight * rowCount;\n              }\n              el.style.minHeight = h + 'px';\n              // We need to trigger CD when not using virtual scroll or else the rows won't show on initial load, only after user interactions\n              if (!this.viewport.enabled) {\n                this.rowsApi.syncRows(true);\n              }\n            }\n          });\n      }\n    }\n  }\n\n  /**\n   * Invalidates the header, including a full rebuild of column headers\n   */\n  invalidateColumns(): void {\n    this._plugin.emitEvent({ source: 'grid', kind: 'beforeInvalidateHeaders' });\n\n    this._extApi.contextApi.clear();\n    this._store.invalidate(this.columns);\n\n    this._store.attachCustomCellTemplates();\n    this._store.attachCustomHeaderCellTemplates();\n    this._cdkTable.clearHeaderRowDefs();\n    this._cdkTable.clearFooterRowDefs();\n    // this.cdr.markForCheck();\n    this.cdr.detectChanges();\n\n    // after invalidating the headers we now have optional header/headerGroups/footer rows added\n    // we need to update the template with this data which will create new rows (header/footer)\n    this.resetHeaderRowDefs();\n    this.resetFooterRowDefs();\n    this.cdr.markForCheck();\n\n    // Each row will rebuild it's own cells.\n    // This will be done in the RowsApi, which listens to `onInvalidateHeaders`\n    this._plugin.emitEvent({ source: 'grid', kind: 'onInvalidateHeaders' });\n  }\n\n  /**\n   * Create an embedded view before or after the user projected content.\n   */\n  createView<C>(location: 'beforeTable' | 'beforeContent' | 'afterContent', templateRef: TemplateRef<C>, context?: C, index?: number): EmbeddedViewRef<C> {\n    const vcRef = this.getInternalVcRef(location);\n    const view = vcRef.createEmbeddedView(templateRef, context, index);\n    view.detectChanges();\n    return view;\n  }\n\n  /**\n   * Remove an already created embedded view.\n   * @param view - The view to remove\n   * @param location - The location, if not set defaults to `before`\n   * @returns true when a view was removed, false when not. (did not exist in the view container for the provided location)\n   */\n  removeView(view: EmbeddedViewRef<any>, location: 'beforeTable' | 'beforeContent' | 'afterContent'): boolean {\n    const vcRef = this.getInternalVcRef(location);\n    const idx = vcRef.indexOf(view);\n    if (idx === -1) {\n      return false;\n    } else {\n      vcRef.remove(idx);\n      return true;\n    }\n  }\n\n  /**\n   * Resize all visible columns to fit content of the grid.\n   * @param forceFixedWidth - When true will resize all columns with absolute pixel values, otherwise will keep the same format as originally set (% or none)\n   */\n  autoSizeColumnToFit(options?: AutoSizeToFitOptions): void {\n    const { innerWidth, outerWidth } = this.viewport;\n\n    // calculate auto-size on the width without scroll bar and take box model gaps into account\n    // TODO: if no scroll bar exists the calc will not include it, next if more rows are added a scroll bar will appear...\n    this.columnApi.autoSizeToFit(outerWidth - (outerWidth - innerWidth), options);\n  }\n\n  findInitialRowHeight(): number {\n    let rowElement: HTMLElement;\n    const row = this.rowsApi.findDataRowByIndex(0);\n    if (row) {\n      const height = getComputedStyle(row.element).height;\n      return parseInt(height, 10);\n    } else if (this._vcRefBeforeContent) {\n      rowElement = this._vcRefBeforeContent.length > 0\n        ? (this._vcRefBeforeContent.get(0) as EmbeddedViewRef<any>).rootNodes[0]\n        : this._vcRefBeforeContent.element.nativeElement\n      ;\n      rowElement = rowElement.previousElementSibling as HTMLElement;\n      rowElement.style.display = '';\n      const height = getComputedStyle(rowElement).height;\n      rowElement.style.display = 'none';\n      return parseInt(height, 10);\n    }\n  }\n\n  addClass(...cls: string[]): void {\n    for (const c of cls) {\n      this.elRef.nativeElement.classList.add(c);\n    }\n  }\n\n  removeClass(...cls: string[]): void {\n    for (const c of cls) {\n      this.elRef.nativeElement.classList.remove(c);\n    }\n  }\n\n  private getInternalVcRef(location: 'beforeTable' | 'beforeContent' | 'afterContent'): ViewContainerRef {\n    return location === 'beforeTable'\n      ? this._vcRefBeforeTable\n      : location === 'beforeContent' ? this._vcRefBeforeContent : this._vcRefAfterContent\n    ;\n  }\n\n  private resetHeaderRowDefs(): void {\n    if (this._headerRowDefs) {\n      // The grid header (main, with column names) is always the last row def (index 0)\n      // Because we want it to show last (after custom headers, group headers...) we first need to pull it and then push.\n\n      this._cdkTable.clearHeaderRowDefs();\n      const arr = this._headerRowDefs.toArray();\n      arr.push(arr.shift());\n\n      for (const rowDef of arr) {\n        this._cdkTable.addHeaderRowDef(rowDef);\n      }\n    }\n  }\n\n  private resetFooterRowDefs(): void {\n    if (this._footerRowDefs) {\n      this._cdkTable.clearFooterRowDefs();\n      for (const rowDef of this._footerRowDefs.toArray()) {\n        this._cdkTable.addFooterRowDef(rowDef);\n      }\n    }\n  }\n\n  static ngAcceptInputType_showHeader: BooleanInput;\n  static ngAcceptInputType_showFooter: BooleanInput;\n  static ngAcceptInputType_noFiller: BooleanInput;\n  static ngAcceptInputType_noCachePaginator: BooleanInput;\n  static ngAcceptInputType_minDataViewHeight: NumberInput;\n}\n","<!-- GRID HEADER ROW DEF - THE MAIN HEADER OF THE GRID -->\n<pbl-ngrid-column-row *cdkHeaderRowDef=\"[]; sticky: columnRowDef.header?.type === 'sticky'\"\n                      [row]=\"columnRowDef.header\"\n                      class=\"pbl-ngrid-header-row-main\"></pbl-ngrid-column-row>\n\n<!-- DUPLICATE HEADER FOR THE MAIN HEADER, NEVER SEEN (NOT VISUAL), USED FOR RESIZING -->\n<pbl-ngrid-column-row *cdkHeaderRowDef=\"[];\"\n                      [row]=\"columnRowDef.header\"\n                      gridWidthRow\n                      style=\"visibility: hidden !important;\"\n                      class=\"pbl-ngrid-row-visually-hidden\"></pbl-ngrid-column-row>\n\n<!-- MULTI-HEADER ROW DEF & MULTI-HEADER GROUP ROW DEFINITION TEMPLATES -->\n<ng-container *ngFor=\"let row of metaHeaderRows;\">\n  <pbl-ngrid-meta-row *cdkHeaderRowDef=\"[]; sticky: row.rowDef.type === 'sticky'\" [row]=\"row\"></pbl-ngrid-meta-row>\n</ng-container>\n\n<!-- GRID FOOTER ROW DEF -->\n<pbl-ngrid-column-row *cdkFooterRowDef=\"[]; sticky: columnRowDef.footer?.type === 'sticky'\"\n                      footer [row]=\"columnRowDef.footer\"></pbl-ngrid-column-row>\n<!-- GRID FOOTER ROW DEF -->\n<!-- MULTI-FOOTER ROW DEF -->\n<ng-container *ngFor=\"let row of metaFooterRows;\">\n  <pbl-ngrid-meta-row footer *cdkFooterRowDef=\"[]; sticky: row.rowDef.type === 'sticky'\" [row]=\"row\"></pbl-ngrid-meta-row>\n</ng-container>\n\n<div class=\"pbl-ngrid-container\">\n  <ng-container #beforeTable></ng-container>\n  <div pbl-ngrid-fixed-meta-row-container=\"header\"></div>\n  <pbl-cdk-virtual-scroll-viewport class=\"pbl-ngrid-scroll-container\"\n                                   [stickyRowHeaderContainer]=\"stickyRowHeaderContainer\" [stickyRowFooterContainer]=\"stickyRowFooterContainer\">\n    <pbl-cdk-table tabindex=\"-1\">\n      <!-- Row templates. The columns used are set at the row template level -->\n\n      <!-- GRID RECORD ROW DEFINITION TEMPLATES -->\n      <!-- We dont need columns because we implement them internally -->\n      <pbl-ngrid-row *pblNgridRowDef=\"let row;\" row></pbl-ngrid-row>\n      <!-- GRID RECORD ROW DEFINITION TEMPLATES -->\n    </pbl-cdk-table>\n  </pbl-cdk-virtual-scroll-viewport>\n  <div pbl-ngrid-fixed-meta-row-container=\"footer\"></div>\n\n  <ng-container #beforeContent>\n    <!-- This dummy row is used to extract an initial row height -->\n    <div role=\"row\" row=\"\" class=\"pbl-ngrid-row cdk-row\" style=\"display: none;\"></div>\n  </ng-container>\n  <ng-content></ng-content>\n  <ng-container #afterContent></ng-container>\n\n  <!-- Placeholder for header/footer scroll containers that will get populated with header/meta roles when the following conditions are met:\n       - Virtual scrolling is enabled\n       - Rows are rendered in the viewport\n       - Container is scrolling\n\n       The placeholder is fixed so the browsers does not use sticky positioning while scrolling, which takes the rows out of view while scrolling.\n       While scrolling the rows are moved into this placeholder and when scrolling ends they return to their original positioning.\n\n       The actual rows are added into the internal div, within the placeholder.\n       The top container get the proper width and the internal header gets the scroll offset (horizontal) that matches the current offset.\n       This has an effect only when scrolling with the wheel within a long scrolling session.\n\n       Implementation is in the virtual scroll viewport (more precisely in `PblVirtualScrollForOf`)\n  -->\n  <div #stickyRowHeaderContainer class=\"pbl-ngrid-sticky-row-scroll-container\"><div [style.minWidth.px]=\"innerTableMinWidth\"></div></div> <!-- HEADERS -->\n  <div #stickyRowFooterContainer class=\"pbl-ngrid-sticky-row-scroll-container\"><div [style.minWidth.px]=\"innerTableMinWidth\"></div></div> <!-- FOOTERS -->\n</div>\n\n<ng-template #fbTableCell let-value=\"value\"><div>{{value}}</div></ng-template>\n<ng-template #fbHeaderCell let-column=\"col\"><div>{{column.label}}</div></ng-template>\n<ng-template #fbFooterCell let-column=\"col\"><div>{{column.label}}</div></ng-template>\n","// tslint:disable:use-host-property-decorator\nimport { Directive, TemplateRef, AfterViewInit } from '@angular/core';\n\nimport { PblNgridComponent } from '../ngrid.component';\n\n/**\n * A directive that marks the template as a projected section inside the grid.\n * The location of the project content is set by the position input.\n *\n * Note that this directive can only be set as the content inside the grid.\n */\n@Directive({\n  selector: '[pblNgridOuterSection]',\n  inputs: [ 'position:pblNgridOuterSection' ] // tslint:disable-line:use-input-property-decorator\n})\nexport class PblNgridOuterSectionDirective implements AfterViewInit {\n\n  position: 'top' | 'bottom'; // tslint:disable-line:no-input-rename\n\n  constructor(private grid: PblNgridComponent<any>, private tRef: TemplateRef<{ $implicit: PblNgridComponent<any> }>) { }\n\n  ngAfterViewInit(): void {\n    this.grid.createView(this.position === 'bottom' ? 'beforeContent' : 'beforeTable', this.tRef);\n  }\n}\n","import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';\nimport { PblNgridExtensionApi } from '../../../../ext/grid-ext-api';\nimport { PblNgridVirtualScrollStrategy } from './types';\n\nconst noop = function() { };\n\ndeclare module './types' {\n  interface PblNgridVirtualScrollStrategyMap {\n    vScrollNone: NoVirtualScrollStrategy;\n  }\n}\n\nexport class NoVirtualScrollStrategy implements PblNgridVirtualScrollStrategy<'vScrollNone'> {\n  get type() { return 'vScrollNone' as const; }\n\n  scrolledIndexChange: any;\n  attachExtApi: (extApi: PblNgridExtensionApi) => void = noop;\n  attach: (viewport: CdkVirtualScrollViewport) => void = noop;\n  detach: () => void = noop;\n  onContentScrolled: () => void = noop;\n  onDataLengthChanged: () => void = noop;\n  onContentRendered: () => void = noop;\n  onRenderedOffsetChanged: () => void = noop;\n  scrollToIndex: (index: number, behavior: ScrollBehavior) => void = noop;\n}\n","export class SizeGroup {\n  readonly dsStart: number;\n  readonly dsEnd: number;\n  rawTotal = 0;\n  length = 0;\n  items: number[] = [];\n\n  constructor(public readonly groupIndex: number, private readonly maxItems: number) {\n    this.dsStart = groupIndex * maxItems;\n    this.dsEnd = this.dsStart + maxItems - 1;\n  }\n\n  set(dsIndex: number, height: number): void {\n    const index = dsIndex - this.dsStart;\n    const prev = this.items[index];\n    this.items[index] = height;\n    this.rawTotal += height - (prev || 0);\n    if (!prev && height) {\n      this.length += 1;\n    }\n  }\n\n  remove(dsIndex: number): boolean {\n    const index = dsIndex - this.dsStart;\n    const prev = this.items[index];\n    if (prev) {\n      this.rawTotal -= prev;\n      this.items[index] = undefined;\n      this.length -= 1;\n      return true;\n    }\n    return false;\n  }\n\n  has(dsIndex: number): boolean {\n    const index = dsIndex - this.dsStart;\n    return !!this.items[index];\n  }\n\n  clear() {\n    this.rawTotal = this.length = 0;\n    this.items = [];\n  }\n\n  getItemSize(dsIndex: number) {\n    const index = dsIndex - this.dsStart;\n    return this.items[index];\n  }\n\n  getSizeBefore(dsIndex: number, itemSize: number) {\n    const index = dsIndex - this.dsStart;\n\n    let total = index * itemSize;\n    for (let i = 0; i < index; i++) {\n      const size = this.items[i];\n      if (size) {\n        total += size - itemSize;\n      }\n    }\n\n    return total;\n  }\n\n  getSize(itemSize: number) {\n    return (itemSize * (this.maxItems - this.length)) + this.rawTotal;\n  }\n\n  getSubSize(dsIndexStart: number, dsIndexEnd: number, itemSize: number) {\n    const indexStart = Math.max(dsIndexStart, this.dsStart) - this.dsStart;\n    const indexEnd = this.maxItems - (this.dsEnd - Math.min(dsIndexEnd, this.dsEnd)) - 1;\n    let total = 0;\n\n    for (let i = indexStart; i <= indexEnd; i++) {\n      total += this.items[i] || itemSize;\n    }\n\n    return total;\n  }\n\n  getSizeAfter(dsIndex: number, itemSize: number) {\n    const index = this.dsEnd - dsIndex;\n\n    let total = index * itemSize;\n    for (let i = (this.maxItems - index); i < this.maxItems; i++) {\n      const size = this.items[i];\n      if (size) {\n        total += size - itemSize;\n      }\n    }\n\n    return total;\n  }\n\n  getRawDiffSize(itemSize: number) {\n    return this.rawTotal - itemSize - this.length;\n  }\n}\n","import { SizeGroup } from './size-group';\n\nexport class SizeGroupCollection {\n\n  get collection() { return this._groups; }\n\n  get length() { return this._groups.length; }\n\n  private _groups: SizeGroup[] = [];\n\n  set(group: SizeGroup) {\n    const groupIndex = group.groupIndex;\n    const index = this.findGroupIndexIndex(groupIndex, true);\n    if (index === -1) {\n      this._groups.push(group);\n    } else {\n      const closestGroup = this._groups[index];\n      if (closestGroup.groupIndex === groupIndex) {\n        this._groups[groupIndex] = group;\n      } else if (closestGroup.groupIndex < groupIndex) {\n        this._groups.splice(index + 1, 0, group);\n      } else {\n        this._groups.splice(index, 0, group);\n      }\n    }\n  }\n\n  remove(groupIndex: number) {\n    const index = this.findGroupIndexIndex(groupIndex);\n    if (index > -1) {\n      this._groups.splice(index, 1);\n      return true;\n    }\n    return false;\n  }\n\n  get(groupIndex: number): SizeGroup | undefined {\n    return this._groups[this.findGroupIndexIndex(groupIndex)];\n  }\n\n  has(groupIndex: number) {\n    return this.findGroupIndexIndex(groupIndex) > -1;\n  }\n\n  clear() {\n    this._groups = [];\n  }\n\n  protected findGroupIndexIndex(groupIndex: number, matchClosest?: boolean) {\n    let start = 0;\n    let end = this._groups.length - 1;\n    let mid = -1;\n\n    while (start <= end){\n      mid = Math.floor((start + end) / 2);\n\n      if (this._groups[mid].groupIndex === groupIndex) {\n        return mid;\n      } else if (this._groups[mid].groupIndex < groupIndex) {\n        start = mid + 1;\n      } else {\n        end = mid - 1;\n      }\n    }\n\n    return matchClosest ? mid : -1;\n  }\n}\n","import { SizeGroup } from './size-group';\nimport { SizeGroupCollection } from './size-group-collection';\n\nexport class Sizer {\n\n  itemSize: number;\n  itemsLength: number;\n  protected groupSize = 50;\n  private groups = new SizeGroupCollection();\n\n  constructor(groupSize?: number) {\n    if (groupSize > 0) {\n      this.groupSize = groupSize;\n    }\n  }\n\n  clear() {\n    this.groups.clear();\n  }\n\n  setSize(dsIndex: number, height: number) {\n    const groupIndex = this.getGroupIndex(dsIndex);\n\n    if (height === this.itemSize) {\n      const group = this.groups.get(groupIndex);\n      if (group) {\n        group.remove(dsIndex);\n        if (group.length === 0) {\n          this.groups.remove(groupIndex);\n        }\n      }\n    } else {\n      let group = this.groups.get(groupIndex);\n      if (!group) {\n        group = new SizeGroup(groupIndex, this.groupSize);\n        this.groups.set(group);\n      }\n      group.set(dsIndex, height);\n    }\n  }\n\n  getTotalContentSize() {\n    const itemSize = this.itemSize;\n\n    let total = this.itemsLength * itemSize;\n    for (const g of this.groups.collection) {\n      total += g.getRawDiffSize(itemSize);\n    }\n\n    return total;\n  }\n\n  getSizeForItem(dsIndex: number) {\n    const groupIndex = this.getGroupIndex(dsIndex);\n    return this.groups.get(groupIndex)?.getItemSize(dsIndex) || this.itemSize;\n  }\n\n  getSizeBefore(dsIndex: number) {\n    const itemSize = this.itemSize;\n\n    // We want all items before `dsIndex`\n    // If dsIndex is 0 we want nothing\n    // If dsIndex is 1 we want only 0 so `dsIndex` is also the \"count\" here.\n    let total = dsIndex * itemSize;\n    for (const g of this.groups.collection) {\n      if (g.dsStart < dsIndex) {\n        if (g.dsEnd > dsIndex) {\n          total += g.getSizeBefore(dsIndex, itemSize) - itemSize * (dsIndex - g.dsStart);\n        } else {\n          total += g.getRawDiffSize(itemSize);\n        }\n      } else {\n        break;\n      }\n    }\n\n    return total;\n  }\n\n  getSizeForRange(dsIndexStart: number, dsIndexEnd: number) {\n    const groupSize = this.groupSize;\n    const itemSize = this.itemSize;\n    let total = 0;\n\n    const startGroupIndex = this.getGroupIndex(dsIndexStart);\n    const endGroupIndex = this.getGroupIndex(dsIndexEnd);\n    const startGroup = this.groups.get(startGroupIndex);\n\n    if (startGroupIndex === endGroupIndex) {\n      if (startGroup) {\n        total += startGroup.getSubSize(dsIndexStart, dsIndexEnd, itemSize);\n      } else {\n        total += (dsIndexEnd - dsIndexStart + 1) * itemSize;\n      }\n    } else {\n      for (let i = startGroupIndex + 1; i < endGroupIndex; i++) {\n        const g = this.groups.get(i);\n        total += g ? g.getSize(itemSize) : itemSize * groupSize;\n      }\n\n      if (startGroup) {\n        total += startGroup.getSizeAfter(dsIndexStart - 1, itemSize);\n      } else {\n        total += ((startGroupIndex + 1) * groupSize - dsIndexStart + 1) * itemSize;\n      }\n\n      const endGroup = this.groups.get(endGroupIndex);\n      if (endGroup) {\n        total += endGroup.getSizeBefore(dsIndexEnd + 1, itemSize);\n      } else {\n        total += (dsIndexEnd - (endGroupIndex * groupSize) + 1) * itemSize;\n      }\n    }\n\n    return total;\n  }\n\n  getSizeAfter(dsIndex: number) {\n    const itemSize = this.itemSize;\n    const groups = this.groups.collection;\n\n    let total = (this.itemsLength - dsIndex - 1) * itemSize;\n    for (let i = groups.length - 1; i > -1; i--) {\n      const g = groups[i];\n      if (g.dsEnd > dsIndex) {\n        if (g.dsStart > dsIndex) {\n          total += g.getRawDiffSize(itemSize);\n        } else {\n          total += g.getSizeAfter(dsIndex, itemSize) - itemSize * (g.dsEnd - dsIndex);\n        }\n      } else {\n        break;\n      }\n    }\n    return total;\n  }\n\n  findRenderItemAtOffset(offset: number) {\n    const { itemSize, groupSize } = this;\n    const maxGroupIndex = this.getGroupIndex(this.itemsLength);\n    const firstVisibleIndex = Math.floor(offset / itemSize);\n    let groupIndex = this.getGroupIndex(firstVisibleIndex);\n    let groupStartPos = this.getSizeBefore(groupSize * groupIndex);\n\n    while (true) {\n      if (groupStartPos < offset) {\n        if (groupIndex >= maxGroupIndex) {\n          groupIndex = maxGroupIndex;\n          break;\n        }\n        groupIndex += 1;\n        groupStartPos += this.getSizeForRange(groupSize * groupIndex, groupSize * (groupIndex + 1) - 1);\n        if (groupStartPos >= offset) {\n          groupStartPos -= this.getSizeForRange(groupSize * groupIndex, groupSize * (groupIndex + 1) - 1);\n          groupIndex -=1;\n          break;\n        }\n      } else if (groupStartPos > offset) {\n        if (groupIndex <= 0) {\n          groupIndex = 0;\n          break;\n        }\n        groupIndex -= 1;\n        groupStartPos -= this.getSizeForRange(groupSize * groupIndex, groupSize * (groupIndex + 1) - 1);\n        if (groupStartPos <= offset) {\n          break;\n        }\n      } else {\n        break;\n      }\n    }\n\n    let index = groupSize * groupIndex;\n    const group = this.groups.get(groupIndex);\n    if (!group) {\n      while (groupStartPos < offset) {\n        groupStartPos += itemSize;\n        index += 1;\n      }\n    } else {\n      while (groupStartPos < offset) {\n        groupStartPos += group.getItemSize(index) || itemSize;\n        index += 1;\n      }\n    }\n    return index;\n  }\n\n  protected getGroupIndex(dsIndex: number) {\n    return Math.floor(dsIndex / this.groupSize);\n  }\n}\n","import { Observable, Subject } from 'rxjs';\nimport { distinctUntilChanged } from 'rxjs/operators';\nimport { PblDataSource, unrx } from '@pebula/ngrid/core';\n\nimport { PblNgridInternalExtensionApi, PblNgridExtensionApi } from '../../../../../ext/grid-ext-api';\nimport { PblCdkVirtualScrollViewportComponent } from '../../virtual-scroll-viewport.component';\nimport { PblNgridVirtualScrollStrategy } from '../types';\nimport { Sizer } from './sizer';\n\ndeclare module '../types' {\n  interface PblNgridVirtualScrollStrategyMap {\n    vScrollDynamic: PblNgridDynamicVirtualScrollStrategy;\n  }\n}\n\nexport class PblNgridDynamicVirtualScrollStrategy implements PblNgridVirtualScrollStrategy<'vScrollDynamic'> {\n\n  readonly type: 'vScrollDynamic' = 'vScrollDynamic';\n\n  protected _scrolledIndexChange = new Subject<number>();\n\n  /** @docs-private Implemented as part of VirtualScrollStrategy. */\n  scrolledIndexChange: Observable<number> = this._scrolledIndexChange.pipe(distinctUntilChanged());\n\n  /** The attached viewport. */\n  protected _viewport: PblCdkVirtualScrollViewportComponent | null = null;\n\n  /** The minimum amount of buffer rendered beyond the viewport (in pixels). */\n  protected _minBufferPx: number;\n\n  /** The number of buffer items to render beyond the edge of the viewport (in pixels). */\n  protected _maxBufferPx: number;\n\n  protected _lastRenderedContentOffset: number;\n  protected _lastExcessHeight = 0;\n\n  protected sizer: Sizer;\n\n  private extApi: PblNgridInternalExtensionApi;\n\n  /**\n   * @param itemSize The size of the items in the virtually scrolling list.\n   * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more\n   * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.\n   */\n  constructor(itemSize: number, minBufferPx: number, maxBufferPx: number) {\n    this.sizer = new Sizer();\n    this.sizer.itemSize = itemSize;\n    this._minBufferPx = minBufferPx;\n    this._maxBufferPx = maxBufferPx;\n  }\n\n  /**\n   * Update the item size and buffer size.\n   * @param itemSize The size of the items in the virtually scrolling list.\n   * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more\n   * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.\n   */\n  updateItemAndBufferSize(itemSize: number, minBufferPx: number, maxBufferPx: number) {\n    if (maxBufferPx < minBufferPx && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n      throw Error('CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx');\n    }\n    this.sizer.itemSize = itemSize;\n    this._minBufferPx = minBufferPx;\n    this._maxBufferPx = maxBufferPx;\n    this._updateTotalContentSize();\n    this._updateRenderedRange();\n  }\n\n  attachExtApi(extApi: PblNgridExtensionApi): void {\n    this.extApi = extApi as PblNgridInternalExtensionApi;\n    this.extApi.events\n      .subscribe( event => {\n        if (event.kind === 'onDataSource') {\n          this.onDatasource(event.curr, event.prev);\n        }\n      });\n    if (this.extApi.grid.ds) {\n      this.onDatasource(this.extApi.grid.ds);\n    }\n  }\n\n  attach(viewport: PblCdkVirtualScrollViewportComponent): void {\n    if (!this.extApi) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error('Invalid use of attach, you must first attach `PblNgridExtensionApi`');\n      }\n    }\n\n    this._viewport = viewport;\n    this._updateSizeAndRange();\n  }\n\n  detach(): void {\n    this._scrolledIndexChange.complete();\n    this._viewport = null;\n  }\n\n  onContentScrolled() {\n    this._updateRenderedRange();\n  }\n\n  onDataLengthChanged() {\n    this.sizer.itemsLength = this._viewport.getDataLength();\n    this._updateSizeAndRange();\n  }\n\n  onContentRendered() {\n    this._checkRenderedContentSize();\n  }\n\n  onRenderedOffsetChanged() {\n    if (this._viewport) {\n      this._lastRenderedContentOffset = this._viewport.getOffsetToRenderedContentStart();\n    }\n  }\n\n  /**\n   * Scroll to the offset for the given index.\n   * @param index The index of the element to scroll to.\n   * @param behavior The ScrollBehavior to use when scrolling.\n   */\n  scrollToIndex(index: number, behavior: ScrollBehavior): void {\n    if (this._viewport) {\n      this._viewport.scrollToOffset(this.sizer.getSizeBefore(index), behavior);\n    }\n  }\n\n  protected onDatasource(curr: PblDataSource, prev?: PblDataSource) {\n    if (prev) {\n      unrx.kill(this, prev);\n    }\n    if (curr) {\n      curr.onSourceChanging\n        .pipe(unrx(this, curr))\n        .subscribe(() => {\n          this.sizer.clear();\n        });\n    }\n  }\n\n  protected _updateSizeAndRange() {\n    this._updateTotalContentSize();\n    this._updateRenderedRange(true);\n  }\n\n  /** Update the viewport's total content size. */\n  protected _updateTotalContentSize() {\n    if (!this._viewport) {\n      return;\n    }\n\n    for (const row of this.extApi.rowsApi.dataRows()) {\n      if (row.context) {\n        this.sizer.setSize(row.context.dsIndex, row.height);\n      }\n    }\n\n    this._viewport.setTotalContentSize(this.sizer.getTotalContentSize());\n  }\n\n  protected _checkRenderedContentSize() {\n    this._updateTotalContentSize();\n  }\n\n  /** Update the viewport's rendered range. */\n  protected _updateRenderedRange(skipSizeSync?: boolean) {\n    if (!this._viewport) {\n      return;\n    }\n\n    const renderedRange = this._viewport.getRenderedRange();\n\n    // if (!skipSizeSync) {\n    //   for (let i = renderedRange.start; i <= renderedRange.end; i++) {\n    //     this.sizer.setSize(i, this.extApi.rowsApi.findDataRowByDsIndex(i)?.height ?? this.sizer.itemSize);\n    //   }\n    // }\n\n    const newRange = {start: renderedRange.start, end: renderedRange.end};\n    const viewportSize = this._viewport.getViewportSize();\n    const dataLength = this._viewport.getDataLength();\n    let scrollOffset = this._viewport.measureScrollOffset();\n    let firstVisibleIndex = this.sizer.findRenderItemAtOffset(scrollOffset);\n    let excessHeight = 0;\n\n    // When user scrolls to the top, rows change context, sometimes new rows are added etc.\n    // With dynamic size, rows with additional size payload will cause the scroll offset to change because they are added\n    // before the visible rows, this will throw the entire scroll out of sync.\n    // To solve this we use a 2 step process.\n    // 1) For each `_updateRenderRange` cycle of scrolling to the TOP, we sum up excess all height and save them.\n    // 2) If we had excess height it will create a scroll change which will lead us back here. Now we check if we\n    // have previously saved access height, if so we reduce the scroll offset back to what it was supposed to be, like adding the height did not effect the offset.\n    // Since the first step causes a scroll offset flicker, the grid will jump forward and show rows not in the range we want, if we just move back on the 2nd tick\n    // it will cause a flicker in the grid. To prevent it we compensate by pushing in the 1st tick, the rendered content offset forward to match the offset change.\n    // In the second tick we revet it and restore the offset.\n    if (this._lastExcessHeight) {\n      const lastExcessHeight = this._lastExcessHeight;\n      this._lastExcessHeight = 0;\n      this._viewport.setRenderedContentOffset(this._lastRenderedContentOffset - lastExcessHeight);\n      this._viewport.scrollToOffset(scrollOffset - lastExcessHeight);\n      return;\n    }\n\n    // If user scrolls to the bottom of the list and data changes to a smaller list\n    if (newRange.end > dataLength) {\n      // We have to recalculate the first visible index based on new data length and viewport size.\n      let spaceToFill = viewportSize;\n      let expandEnd = firstVisibleIndex;\n      while (spaceToFill > 0) {\n        spaceToFill -= this.sizer.getSizeForItem(++expandEnd);\n      }\n      const maxVisibleItems = expandEnd - firstVisibleIndex;\n      const newVisibleIndex = Math.max(0, Math.min(firstVisibleIndex, dataLength - maxVisibleItems));\n\n      // If first visible index changed we must update scroll offset to handle start/end buffers\n      // Current range must also be adjusted to cover the new position (bottom of new list).\n      if (firstVisibleIndex !== newVisibleIndex) {\n        firstVisibleIndex = newVisibleIndex;\n        scrollOffset =  this.sizer.getSizeBefore(firstVisibleIndex);\n        newRange.start = firstVisibleIndex;\n      }\n\n      newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n    }\n\n    let contentOffset = this.sizer.getSizeBefore(newRange.start);\n    const currentStartBuffer = scrollOffset - contentOffset;\n\n    if (currentStartBuffer < this._minBufferPx && newRange.start !== 0) {\n      let spaceToFill = this._maxBufferPx - currentStartBuffer;\n      if (spaceToFill < 0) {\n        spaceToFill = Math.abs(spaceToFill) + this._maxBufferPx;\n      }\n      let expandStart = newRange.start;\n      while (spaceToFill > 0) {\n        const newSize = this.sizer.getSizeForItem(--expandStart);\n        spaceToFill -= newSize;\n        excessHeight += newSize - this.sizer.itemSize;\n      }\n\n      expandStart = Math.max(0, expandStart);\n      if (expandStart !== newRange.start) {\n        newRange.start = expandStart;\n        contentOffset = this.sizer.getSizeBefore(expandStart);\n      }\n\n      spaceToFill = viewportSize + this._minBufferPx;\n      let expandEnd = firstVisibleIndex;\n      while (spaceToFill > 0) {\n        spaceToFill -= this.sizer.getSizeForItem(++expandEnd);\n      }\n      newRange.end = Math.min(dataLength, expandEnd);\n    } else {\n      const renderDataEnd = contentOffset + this.sizer.getSizeForRange(newRange.start, newRange.end);\n      const currentEndBuffer = renderDataEnd - (scrollOffset + viewportSize);\n      if (currentEndBuffer < this._minBufferPx && newRange.end !== dataLength) {\n        let spaceToFill = this._maxBufferPx - currentEndBuffer;\n        if (spaceToFill < 0) {\n          spaceToFill = Math.abs(spaceToFill) + this._maxBufferPx;\n        }\n        let expandEnd = newRange.end;\n        while (spaceToFill > 0) {\n          spaceToFill -= this.sizer.getSizeForItem(++expandEnd);\n        }\n        if (expandEnd > 0) {\n          newRange.end = Math.min(dataLength, expandEnd);\n\n          spaceToFill = this._minBufferPx;\n          let expandStart = firstVisibleIndex;\n          while (spaceToFill > 0) {\n            spaceToFill -= this.sizer.getSizeForItem(--expandStart);\n          }\n\n          expandStart = Math.max(0, expandStart);\n          if (expandStart !== newRange.start) {\n            newRange.start = expandStart;\n            contentOffset = this.sizer.getSizeBefore(expandStart);\n          }\n        }\n      }\n    }\n\n     this._lastExcessHeight = excessHeight;\n    this._viewport.setRenderedRange(newRange);\n    this._viewport.setRenderedContentOffset(contentOffset + excessHeight);\n    this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n  }\n\n}\n","import { Directive, Input, OnInit, OnChanges, Attribute } from '@angular/core';\nimport { coerceNumberProperty, NumberInput } from '@angular/cdk/coercion';\nimport { VIRTUAL_SCROLL_STRATEGY } from '@angular/cdk/scrolling';\nimport { PblNgridComponent } from '../../../ngrid.component';\nimport { NoVirtualScrollStrategy } from './noop';\nimport { PblNgridDynamicVirtualScrollStrategy } from './dynamic-size/dynamic-size';\nimport { PblNgridBaseVirtualScrollDirective } from './base-v-scroll.directive';\n\n/** A virtual scroll strategy that supports unknown or dynamic size items. */\n@Directive({\n  selector: 'pbl-ngrid[vScrollDynamic], pbl-ngrid[vScrollNone]', // tslint:disable-line: directive-selector\n  inputs: [ 'minBufferPx', 'maxBufferPx', 'wheelMode' ], // tslint:disable-line: no-inputs-metadata-property\n  providers: [{\n    provide: VIRTUAL_SCROLL_STRATEGY,\n    useExisting: PblCdkVirtualScrollDirective,\n  }],\n})\nexport class PblCdkVirtualScrollDirective extends PblNgridBaseVirtualScrollDirective<'vScrollDynamic' | 'vScrollNone'> implements OnInit, OnChanges {\n\n  /**\n   * The size of the items in the list (in pixels).\n   * If this value is not set the height is calculated from the first rendered row item.\n   */\n  @Input() get vScrollDynamic(): NumberInput { return this._vScrollDynamic; }\n  set vScrollDynamic(value: NumberInput) { this._vScrollDynamic = coerceNumberProperty(value); }\n\n  private _vScrollDynamic: number;\n\n  constructor(@Attribute('vScrollDynamic') vScrollDynamic: any,\n              @Attribute('vScrollNone') vScrollNone: any,\n              grid: PblNgridComponent<any>) {\n    super(grid, vScrollDynamic === null ? 'vScrollNone' : 'vScrollDynamic');\n    if (vScrollDynamic !== null && vScrollNone !== null) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error(`Invalid vScroll instruction, only one value is allow.`);\n      }\n    }\n  }\n\n  ngOnInit(): void {\n    switch (this.type) {\n      case 'vScrollDynamic':\n        if (!this._vScrollDynamic) {\n          this.vScrollDynamic  = this.grid.findInitialRowHeight() || 48;\n        }\n        this._scrollStrategy = new PblNgridDynamicVirtualScrollStrategy(this._vScrollDynamic, this._minBufferPx, this._maxBufferPx);\n        break;\n      default:\n        this._scrollStrategy = new NoVirtualScrollStrategy();\n        break;\n    }\n  }\n\n  ngOnChanges() {\n    if (this._scrollStrategy) {\n      switch (this.type) {\n        case 'vScrollDynamic':\n          (this._scrollStrategy as PblNgridDynamicVirtualScrollStrategy)?.updateItemAndBufferSize(this._vScrollDynamic, this._minBufferPx, this._maxBufferPx);\n          break;\n        default:\n          break;\n      }\n    }\n  }\n\n}\n","import { Directive, EventEmitter, Output, NgZone } from '@angular/core';\nimport { PblNgridPluginController } from '../../../ext/plugin-control';\nimport { PblNgridComponent } from '../../ngrid.component';\n\n@Directive({\n  selector: 'pbl-ngrid[scrolling]' // tslint:disable-line: directive-selector\n})\nexport class PblNgridScrolling<T = any> {\n\n  /**\n   * Event emitted when the scrolling state of rows in the table changes.\n   * When scrolling starts `true` is emitted and when the scrolling ends `false` is emitted.\n   *\n   * The table is in \"scrolling\" state from the first scroll event and until 2 animation frames\n   * have passed without a scroll event.\n   *\n   * When scrolling, the emitted value is the direction: -1 or 1\n   * When not scrolling, the emitted value is 0.\n   *\n   * NOTE: This event runs outside the angular zone.\n   */\n  @Output() scrolling = new EventEmitter< -1 | 0 | 1 >();\n\n  constructor(table: PblNgridComponent<T>, pluginCtrl: PblNgridPluginController, zone: NgZone) {\n    pluginCtrl.onInit()\n      .subscribe(() => {\n        const { viewport } = table;\n        if (viewport) {\n          viewport.scrolling.subscribe( isScrolling => zone.run( () => this.scrolling.next(isScrolling) ) );\n        }\n      });\n  }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {Observable, Subject} from 'rxjs';\nimport {distinctUntilChanged} from 'rxjs/operators';\nimport { VirtualScrollStrategy, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';\n\n/** Virtual scrolling strategy for lists with items of known fixed size. */\nexport class FixedSizeVirtualScrollStrategy implements VirtualScrollStrategy {\n  private _scrolledIndexChange = new Subject<number>();\n\n  /** @docs-private Implemented as part of VirtualScrollStrategy. */\n  scrolledIndexChange: Observable<number> = this._scrolledIndexChange.pipe(distinctUntilChanged());\n\n  /** The attached viewport. */\n  private _viewport: CdkVirtualScrollViewport | null = null;\n\n  /** The size of the items in the virtually scrolling list. */\n  private _itemSize: number;\n\n  /** The minimum amount of buffer rendered beyond the viewport (in pixels). */\n  private _minBufferPx: number;\n\n  /** The number of buffer items to render beyond the edge of the viewport (in pixels). */\n  private _maxBufferPx: number;\n\n  /**\n   * @param itemSize The size of the items in the virtually scrolling list.\n   * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more\n   * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.\n   */\n  constructor(itemSize: number, minBufferPx: number, maxBufferPx: number) {\n    this._itemSize = itemSize;\n    this._minBufferPx = minBufferPx;\n    this._maxBufferPx = maxBufferPx;\n  }\n\n  /**\n   * Attaches this scroll strategy to a viewport.\n   * @param viewport The viewport to attach this strategy to.\n   */\n  attach(viewport: CdkVirtualScrollViewport) {\n    this._viewport = viewport;\n    this._updateTotalContentSize();\n    this._updateRenderedRange();\n  }\n\n  /** Detaches this scroll strategy from the currently attached viewport. */\n  detach() {\n    this._scrolledIndexChange.complete();\n    this._viewport = null;\n  }\n\n  /**\n   * Update the item size and buffer size.\n   * @param itemSize The size of the items in the virtually scrolling list.\n   * @param minBufferPx The minimum amount of buffer (in pixels) before needing to render more\n   * @param maxBufferPx The amount of buffer (in pixels) to render when rendering more.\n   */\n  updateItemAndBufferSize(itemSize: number, minBufferPx: number, maxBufferPx: number) {\n    if (maxBufferPx < minBufferPx && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n      throw Error('CDK virtual scroll: maxBufferPx must be greater than or equal to minBufferPx');\n    }\n    this._itemSize = itemSize;\n    this._minBufferPx = minBufferPx;\n    this._maxBufferPx = maxBufferPx;\n    this._updateTotalContentSize();\n    this._updateRenderedRange();\n  }\n\n  /** @docs-private Implemented as part of VirtualScrollStrategy. */\n  onContentScrolled() {\n    this._updateRenderedRange();\n  }\n\n  /** @docs-private Implemented as part of VirtualScrollStrategy. */\n  onDataLengthChanged() {\n    this._updateTotalContentSize();\n    this._updateRenderedRange();\n  }\n\n  /** @docs-private Implemented as part of VirtualScrollStrategy. */\n  onContentRendered() { /* no-op */ }\n\n  /** @docs-private Implemented as part of VirtualScrollStrategy. */\n  onRenderedOffsetChanged() { /* no-op */ }\n\n  /**\n   * Scroll to the offset for the given index.\n   * @param index The index of the element to scroll to.\n   * @param behavior The ScrollBehavior to use when scrolling.\n   */\n  scrollToIndex(index: number, behavior: ScrollBehavior): void {\n    if (this._viewport) {\n      this._viewport.scrollToOffset(index * this._itemSize, behavior);\n    }\n  }\n\n  /** Update the viewport's total content size. */\n  private _updateTotalContentSize() {\n    if (!this._viewport) {\n      return;\n    }\n\n    this._viewport.setTotalContentSize(this._viewport.getDataLength() * this._itemSize);\n  }\n\n  /** Update the viewport's rendered range. */\n  private _updateRenderedRange() {\n    if (!this._viewport) {\n      return;\n    }\n\n    const renderedRange = this._viewport.getRenderedRange();\n    const newRange = {start: renderedRange.start, end: renderedRange.end};\n    const viewportSize = this._viewport.getViewportSize();\n    const dataLength = this._viewport.getDataLength();\n    let scrollOffset = this._viewport.measureScrollOffset();\n    let firstVisibleIndex = scrollOffset / this._itemSize;\n\n    // If user scrolls to the bottom of the list and data changes to a smaller list\n    if (newRange.end > dataLength) {\n      // We have to recalculate the first visible index based on new data length and viewport size.\n      const maxVisibleItems = Math.ceil(viewportSize / this._itemSize);\n      const newVisibleIndex = Math.max(0,\n          Math.min(firstVisibleIndex, dataLength - maxVisibleItems));\n\n      // If first visible index changed we must update scroll offset to handle start/end buffers\n      // Current range must also be adjusted to cover the new position (bottom of new list).\n      if (firstVisibleIndex != newVisibleIndex) {\n        firstVisibleIndex = newVisibleIndex;\n        scrollOffset = newVisibleIndex * this._itemSize;\n        newRange.start = Math.floor(firstVisibleIndex);\n      }\n\n      newRange.end = Math.max(0, Math.min(dataLength, newRange.start + maxVisibleItems));\n    }\n\n    const startBuffer = scrollOffset - newRange.start * this._itemSize;\n    if (startBuffer < this._minBufferPx && newRange.start != 0) {\n      const expandStart = Math.ceil((this._maxBufferPx - startBuffer) / this._itemSize);\n      newRange.start = Math.max(0, newRange.start - expandStart);\n      newRange.end = Math.min(dataLength,\n          Math.ceil(firstVisibleIndex + (viewportSize + this._minBufferPx) / this._itemSize));\n    } else {\n      const endBuffer = newRange.end * this._itemSize - (scrollOffset + viewportSize);\n      if (endBuffer < this._minBufferPx && newRange.end != dataLength) {\n        const expandEnd = Math.ceil((this._maxBufferPx - endBuffer) / this._itemSize);\n        if (expandEnd > 0) {\n          newRange.end = Math.min(dataLength, newRange.end + expandEnd);\n          newRange.start = Math.max(0,\n              Math.floor(firstVisibleIndex - this._minBufferPx / this._itemSize));\n        }\n      }\n    }\n\n    this._viewport.setRenderedRange(newRange);\n    this._viewport.setRenderedContentOffset(this._itemSize * newRange.start);\n    this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n  }\n}\n","import { PblNgridExtensionApi } from '../../../../../ext/grid-ext-api';\nimport { PblCdkVirtualScrollViewportComponent } from '../../virtual-scroll-viewport.component';\nimport { PblNgridVirtualScrollStrategy } from '../types';\nimport { FixedSizeVirtualScrollStrategy } from './fixed-size-cdk';\n\ndeclare module '../types' {\n  interface PblNgridVirtualScrollStrategyMap {\n    vScrollFixed: PblNgridFixedSizeVirtualScrollStrategy;\n  }\n}\n\nexport class PblNgridFixedSizeVirtualScrollStrategy extends FixedSizeVirtualScrollStrategy implements PblNgridVirtualScrollStrategy<'vScrollFixed'> {\n\n  get type() { return 'vScrollFixed' as const; }\n\n  private viewport: PblCdkVirtualScrollViewportComponent;\n  protected extApi: PblNgridExtensionApi;\n\n  constructor(private itemSize: number, minBufferPx: number, maxBufferPx: number) {\n    super(itemSize, minBufferPx, maxBufferPx);\n  }\n\n  attachExtApi(extApi: PblNgridExtensionApi): void {\n    this.extApi = extApi;\n  }\n\n  attach(viewport: PblCdkVirtualScrollViewportComponent): void {\n    if (!this.extApi) {\n      if (typeof ngDevMode === 'undefined' || ngDevMode) {\n        throw new Error('Invalid use of attach, you must first attach `PblNgridExtensionApi`');\n      }\n    }\n    super.attach(this.viewport = viewport);\n  }\n\n\n  onContentScrolled() {\n    // https://github.com/shlomiassaf/ngrid/issues/11\n\n    // This is a workaround an issue with FixedSizeVirtualScrollStrategy\n    // When:\n    //    - The rendered data is changed so the data length is now LOWER then the current range (end - start)\n    //    - The rendering direction is towards the top (start > end)\n    //\n    // For the issue to occur a big gap between the data length and the range length (gap), which does not happen on normal scrolling\n    // but only when the data source is replaced (e.g. filtering).\n    //\n    // In such cases `onDataLengthChanged` is called which will call `_updateRenderedRange` which will calculate a new range\n    // that is big, it will give the `start` a new value which creates the big gap.\n    // It will then calculate a new \"end\" and leave the \"start\" so we have a big gap, larger then the viewport size.\n    // After that it will create the new offset which is the itemSize * start, which is a bit lower then the offset but is large and again does not fit the viewport size\n    // The scroll change will trigger `onContentScrolled` which will call `_updateRenderedRange` again,\n    // with the same outcome, reducing the offset slightly, calling `onContentScrolled` again.\n    // It will repeat until reaching the proper offset.\n    //\n    // The amount of offset reduced each time is approx the size of the buffers. (mix/max Buffer).\n    //\n    // This strategy is here only because of this error, it will let the initial update run and catch it's subsequent scroll event.\n    if (!this.viewport) {\n      return;\n    }\n    let { start, end } = this.viewport.getRenderedRange();\n    const rangeLength = end - start;\n    const dataLength = this.viewport.getDataLength();\n    if (rangeLength < 0 && dataLength < -rangeLength) {\n      start = dataLength - end;\n      this.viewport.setRenderedRange({ start, end });\n      this.viewport.setRenderedContentOffset(this.itemSize * start);\n      // this._scrolledIndexChange.next(Math.floor(firstVisibleIndex));\n    } else {\n      super.onContentScrolled();\n    }\n  }\n}\n","import { Directive, Input, DoCheck, IterableDiffer, IterableDiffers } from '@angular/core';\nimport { PblNgridPluginController } from '../../ext/plugin-control';\nimport { PblColumnStore } from '../column/management';\n\n@Directive({\n  selector: 'pbl-ngrid[hideColumns]'\n})\nexport class PblNgridHideColumns implements DoCheck {\n\n  @Input('hideColumns') set hideColumns(value: string[]) {\n    this.hidden = value;\n    this.dirty = true;\n  }\n\n  private dirty: boolean;\n  private hidden: string[];\n  private differ: IterableDiffer<string>;\n  private readonly columnStore: PblColumnStore;\n\n  constructor(private readonly pluginCtrl: PblNgridPluginController, private readonly differs: IterableDiffers) {\n    this.columnStore = pluginCtrl.extApi.columnStore;\n  }\n\n  ngDoCheck(): void {\n    if (this.dirty) {\n      this.dirty = false;\n      const value = this.hidden;\n      if (!this.differ && value) {\n        try {\n          this.differ = this.differs.find(value).create();\n        } catch (e) {\n          if (typeof ngDevMode === 'undefined' || ngDevMode) {\n            throw new Error(`Cannot find a differ supporting object '${value}. hideColumns only supports binding to Iterables such as Arrays.`);\n          }\n          return;\n        }\n      }\n    }\n    if (this.differ) {\n      const hideColumns = this.hidden || [];\n      const changes = this.differ.diff(hideColumns);\n      if (changes) {\n        const hide: string[] = [];\n        const show: string[] = [];\n        changes.forEachOperation((record, previousIndex, currentIndex) => {\n          if (record.previousIndex == null) {\n            hide.push(record.item);\n          } else if (currentIndex == null) {\n            show.push(record.item);\n          }\n        });\n        this.columnStore.updateColumnVisibility(hide, show);\n      }\n      if (!this.hidden) {\n        this.differ = undefined;\n      }\n    }\n  }\n}\n","import { VIRTUAL_SCROLL_STRATEGY } from '@angular/cdk/scrolling';\nimport { Directive, Input, OnInit, OnChanges } from '@angular/core';\nimport { coerceNumberProperty, NumberInput } from '@angular/cdk/coercion';\nimport { PblNgridComponent } from '../../../../ngrid.component';\nimport { PblNgridBaseVirtualScrollDirective } from '../base-v-scroll.directive';\nimport { PblNgridAutoSizeVirtualScrollStrategy, PblNgridItemSizeAverager } from './auto-size';\n\n/**\n * @deprecated Will be removed in v5\n * `vScrollAuto` will move to an independent package in v5. Note that the recommended dynamic strategy for nGrid is `vScrollDynamic`\n * Note that the default virtual scroll strategy will also change from `vScrollAuto` to `vScrollDynamic`\n */\n@Directive({\n  selector: 'pbl-ngrid[vScrollAuto]', // tslint:disable-line: directive-selector\n  inputs: [ 'minBufferPx', 'maxBufferPx', 'wheelMode' ], // tslint:disable-line: no-inputs-metadata-property\n  providers: [{\n    provide: VIRTUAL_SCROLL_STRATEGY,\n    useExisting: PblCdkAutoSizeVirtualScrollDirective,\n  }],\n})\nexport class PblCdkAutoSizeVirtualScrollDirective extends PblNgridBaseVirtualScrollDirective<'vScrollAuto'> implements OnInit, OnChanges {\n\n  /**\n   * The size of the items in the list (in pixels).\n   * If this value is not set the height is calculated from the first rendered row item.\n   *\n   * @deprecated Will be removed in v5: `vScrollAuto` will move to an independent package in v5. Note that the recommended dynamic strategy for nGrid is `vScrollDynamic`\n   */\n  @Input() get vScrollAuto(): NumberInput { return this._vScrollAuto; }\n  set vScrollAuto(value: NumberInput) { this._vScrollAuto = coerceNumberProperty(value); }\n\n  private _vScrollAuto: number;\n  constructor(grid: PblNgridComponent<any>) { super(grid, 'vScrollAuto'); }\n\n  ngOnInit(): void {\n    if (!this._vScrollAuto) {\n      this._vScrollAuto  = this.grid.findInitialRowHeight() || 48;\n    }\n    this._scrollStrategy = new PblNgridAutoSizeVirtualScrollStrategy(this._minBufferPx, this._maxBufferPx, new PblNgridItemSizeAverager(this._vScrollAuto));\n  }\n\n  ngOnChanges() {\n    this._scrollStrategy?.updateBufferSize(this._minBufferPx, this._maxBufferPx);\n  }\n}\n","import { VIRTUAL_SCROLL_STRATEGY } from '@angular/cdk/scrolling';\nimport { Directive, Input, OnInit, OnChanges } from '@angular/core';\nimport { coerceNumberProperty, NumberInput } from '@angular/cdk/coercion';\nimport { PblNgridComponent } from '../../../../ngrid.component';\nimport { PblNgridBaseVirtualScrollDirective } from '../base-v-scroll.directive';\nimport { PblNgridFixedSizeVirtualScrollStrategy } from './fixed-size';\n\n/**\n * @deprecated Will be removed in v5\n * `vScrollFixed` will move to an independent package in v5.\n * Note that the recommended dynamic strategy for nGrid is `vScrollDynamic`\n */\n@Directive({\n  selector: 'pbl-ngrid[vScrollFixed]', // tslint:disable-line: directive-selector\n  inputs: [ 'minBufferPx', 'maxBufferPx', 'wheelMode' ], // tslint:disable-line: no-inputs-metadata-property\n  providers: [{\n    provide: VIRTUAL_SCROLL_STRATEGY,\n    useExisting: PblCdkFixedSizedVirtualScrollDirective,\n  }],\n})\nexport class PblCdkFixedSizedVirtualScrollDirective extends PblNgridBaseVirtualScrollDirective<'vScrollFixed'> implements OnInit, OnChanges {\n\n  /**\n   * The size of the items in the list (in pixels).\n   * If this value is not set the height is calculated from the first rendered row item.\n   *\n   * @deprecated Will be removed in v5: `vScrollFixed` will move to an independent package in v5. Note that the recommended dynamic strategy for nGrid is `vScrollDynamic`\n   */\n  @Input() get vScrollFixed(): NumberInput { return this._vScrollFixed; }\n  set vScrollFixed(value: NumberInput) { this._vScrollFixed = coerceNumberProperty(value); }\n\n  private _vScrollFixed: number;\n\n  constructor(grid: PblNgridComponent) { super(grid, 'vScrollFixed'); }\n\n  ngOnInit(): void {\n    if (!this._vScrollFixed) {\n      this.vScrollFixed  = this.grid.findInitialRowHeight() || 48;\n    }\n    this._scrollStrategy = new PblNgridFixedSizeVirtualScrollStrategy(this._vScrollFixed, this._minBufferPx, this._maxBufferPx);\n  }\n\n  ngOnChanges() {\n    this._scrollStrategy?.updateItemAndBufferSize(this._vScrollFixed, this._minBufferPx, this._maxBufferPx);\n  }\n}\n","import { ComponentFactoryResolver } from '@angular/core';\nimport {\n  PblNgridHeaderCellComponent,\n  PblNgridCellComponent,\n  PblNgridFooterCellComponent,\n  PblNgridMetaCellComponent,\n} from './grid/cell';\nimport { NGRID_CELL_FACTORY, PblNgridCellFactoryMap, PblNgridCellFactoryResolver } from './grid/row/cell-factory.service';\n\nexport function ngridCellFactory(cfr: ComponentFactoryResolver): PblNgridCellFactoryMap {\n  return {\n    'data': cfr.resolveComponentFactory(PblNgridCellComponent),\n    'header': cfr.resolveComponentFactory(PblNgridHeaderCellComponent),\n    'footer': cfr.resolveComponentFactory(PblNgridFooterCellComponent),\n    'meta-header': cfr.resolveComponentFactory(PblNgridMetaCellComponent),\n    'meta-footer': cfr.resolveComponentFactory(PblNgridMetaCellComponent),\n  }\n}\n\nexport const PROVIDERS = [\n  {\n    provide: NGRID_CELL_FACTORY,\n    useFactory: ngridCellFactory,\n    deps: [ComponentFactoryResolver],\n  },\n  PblNgridCellFactoryResolver,\n]\n","import {\n  ComponentRef,\n  Inject,\n  InjectionToken,\n  Injector,\n  Type,\n  Optional,\n  NgModule,\n  NgModuleRef,\n  ModuleWithProviders,\n  Self,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { ScrollingModule as ScrollingModuleExp } from '@angular/cdk-experimental/scrolling';\nimport { ScrollingModule } from '@angular/cdk/scrolling';\nimport { CdkTableModule } from '@angular/cdk/table';\nimport { PEB_NGRID_CONFIG, PblNgridConfig, PblNgridConfigService } from '@pebula/ngrid/core';\n\n\n/**\n * NOTE ABOUT IMPORTS\n *\n * DO NOT IMPORT FROM BARREL MODULES OR ANY MODULE THAT AGGREGATE AND EXPORT SYMBOLS\n * THE ANGULAR NGC COMPILER DOES NOT HANDLE IT WELL AND THE EXPORTED CODE MIGHT NOT WORK (METADATA ISSUE)\n *\n * THE CIRCULAR RUNTIME DETECTION DOES NOT WORK IN THIS CASE BECAUSE THERE IS NO ACTUAL CIRCULAR REFERENCE\n * IT HAPPENS BECAUSE OF THE WAY ANGULAR RE-BUILDS THE D.TS FILES AND METADATA FILES\n */\nimport { PblNgridRegistryService } from './grid/registry/registry.service';\nimport { PblCdkTableComponent }  from './grid/pbl-cdk-table/pbl-cdk-table.component';\nimport { PblNgridRowDef, PblNgridRowOverride } from './grid/row/row-def.directive';\nimport { PblNgridRowComponent } from './grid/row/row.component';\nimport { PblNgridColumnRowComponent } from './grid/row/columns-row.component';\nimport { PblNgridMetaRowComponent } from './grid/row/meta-row.component';\nimport { PblNgridMetaRowContainerComponent } from './grid/meta-rows/meta-row-container';\nimport { PblNgridColumnDef } from './grid/column/directives/column-def';\nimport { PblNgridHeaderCellDefDirective } from './grid/cell/cell-def/header-cell-def.directive';\nimport { PblNgridFooterCellDefDirective } from './grid/cell/cell-def/footer-cell-def.directive';\nimport { PblNgridCellDefDirective } from './grid/cell/cell-def/cell-def.directive';\nimport { PblNgridEditorCellDefDirective } from './grid/cell/cell-def/edit-cell-def.directive';\nimport { PblNgridHeaderCellComponent } from './grid/cell/header-cell.component';\nimport { PblNgridCellComponent } from './grid/cell/cell.component';\nimport { PblNgridFooterCellComponent } from './grid/cell/footer-cell.component';\nimport { PblNgridMetaCellComponent } from './grid/cell/meta-cell.component';\nimport { PblNgridCellEditAutoFocusDirective } from './grid/cell/cell-edit-auto-focus.directive';\nimport { PblNgridCellStyling } from './grid/cell/cell-styling.directive';\nimport { PblNgridOuterSectionDirective } from './grid/directives/directives';\nimport { PblNgridHeaderExtensionRefDirective } from './grid/registry/directives/data-header-extensions';\nimport { PblNgridNoDataRefDirective } from './grid/registry/directives/no-data-ref.directive';\nimport { PblNgridPaginatorRefDirective } from './grid/registry/directives/paginator-ref.directive';\nimport { PblNgridHideColumns } from './grid/features/hide-columns.directive';\nimport { PblCdkVirtualScrollViewportComponent } from './grid/features/virtual-scroll/virtual-scroll-viewport.component';\nimport { PblCdkVirtualScrollDirective } from './grid/features/virtual-scroll/strategies/v-scroll.directive';\n// TODO: Move to an independent package in v4\nimport { PblCdkAutoSizeVirtualScrollDirective }  from './grid/features/virtual-scroll/strategies/cdk-wrappers/v-scroll-auto.directive';\nimport { PblCdkFixedSizedVirtualScrollDirective }  from './grid/features/virtual-scroll/strategies/cdk-wrappers/v-scroll-fixed.directive';\nimport { PblNgridScrolling } from './grid/features/virtual-scroll/scrolling-plugin.directive';\nimport { PblNgridComponent } from './grid/ngrid.component';\nimport { PROVIDERS } from './di-factories';\n\nexport const COMMON_TABLE_TEMPLATE_INIT = new InjectionToken('COMMON TABLE TEMPLATE INIT');\n\nexport interface CommonTemplateInit {\n  component: Type<any>;\n  /**\n   * When true will use the root registry service (for templates).\n   * Otherwise, uses the provided registry from the dependency tree.\n   */\n  root?: boolean;\n}\n\nexport function provideCommon(components: CommonTemplateInit[]): any {\n  return [\n    { provide: COMMON_TABLE_TEMPLATE_INIT, multi: true, useValue: components },\n  ];\n}\n\n@NgModule({\n    imports: [\n        CommonModule,\n        ScrollingModule, ScrollingModuleExp,\n        CdkTableModule,\n    ],\n    declarations: [\n        PblNgridMetaRowContainerComponent,\n        PblCdkTableComponent,\n        PblNgridColumnDef,\n        PblNgridRowDef, PblNgridRowOverride, PblNgridRowComponent, PblNgridColumnRowComponent, PblNgridMetaRowComponent,\n        PblNgridCellStyling,\n        PblNgridOuterSectionDirective,\n        PblNgridHeaderExtensionRefDirective,\n        PblNgridNoDataRefDirective,\n        PblNgridPaginatorRefDirective,\n        PblNgridHeaderCellDefDirective,\n        PblNgridFooterCellDefDirective,\n        PblNgridCellDefDirective, PblNgridEditorCellDefDirective,\n        PblNgridHeaderCellComponent,\n        PblNgridCellComponent,\n        PblNgridFooterCellComponent,\n        PblNgridMetaCellComponent,\n        PblNgridHideColumns,\n        PblCdkVirtualScrollViewportComponent, PblNgridScrolling,\n        PblCdkVirtualScrollDirective,\n        // TODO: Move to an independent package in v4\n        PblCdkAutoSizeVirtualScrollDirective, PblCdkFixedSizedVirtualScrollDirective,\n        PblNgridCellEditAutoFocusDirective,\n        PblNgridComponent,\n    ],\n    providers: [\n        ...PROVIDERS,\n    ],\n    exports: [\n        PblNgridRowDef, PblNgridRowOverride, PblNgridRowComponent, PblNgridColumnRowComponent, PblNgridMetaRowComponent,\n        PblNgridCellStyling,\n        PblNgridOuterSectionDirective,\n        PblNgridHeaderExtensionRefDirective,\n        PblNgridNoDataRefDirective,\n        PblNgridPaginatorRefDirective,\n        PblNgridHeaderCellDefDirective,\n        PblNgridFooterCellDefDirective,\n        PblNgridCellDefDirective, PblNgridEditorCellDefDirective, PblNgridScrolling,\n        PblNgridHeaderCellComponent,\n        PblNgridCellComponent,\n        PblNgridFooterCellComponent,\n        PblNgridMetaCellComponent,\n        PblNgridHideColumns,\n        PblCdkVirtualScrollDirective,\n        // TODO: Move to an independent package in v4\n        PblCdkAutoSizeVirtualScrollDirective, PblCdkFixedSizedVirtualScrollDirective,\n        PblNgridCellEditAutoFocusDirective,\n        PblNgridComponent,\n    ]\n})\nexport class PblNgridModule {\n\n  constructor(ngRef: NgModuleRef<any>,\n              registry: PblNgridRegistryService,\n              @Inject(COMMON_TABLE_TEMPLATE_INIT) @Optional() @Self() components: CommonTemplateInit[][]) {\n\n    if (components) {\n      for (const multi of components) {\n        for (const c of multi) {\n          if (c.root) {\n            registry = registry.getRoot();\n          }\n          PblNgridModule.loadCommonTemplates(ngRef, c.component, { registry, destroy: true });\n        }\n      }\n    }\n  }\n\n  static forRoot(config: PblNgridConfig, components: CommonTemplateInit[]): ModuleWithProviders<PblNgridModule> {\n    return {\n      ngModule: PblNgridModule,\n      providers: [\n        { provide: PEB_NGRID_CONFIG, useValue: config },\n        PblNgridConfigService,\n        provideCommon(components),\n      ]\n    };\n  }\n\n  static withCommon(components: CommonTemplateInit[]): ModuleWithProviders<PblNgridModule> {\n    return {\n      ngModule: PblNgridModule,\n      providers: provideCommon(components),\n    };\n  }\n\n  static loadCommonTemplates<T>(ngRef: NgModuleRef<any>,\n                                component: Type<T>,\n                                options?: {\n                                 /** When set will use it as first registry in the DI tree */\n                                 registry?: PblNgridRegistryService;\n                                 /** When set will destroy the component when the module is destroyed. */\n                                 destroy?: boolean;\n                                }): ComponentRef<T> {\n    let injector: Injector = ngRef.injector;\n    const { registry, destroy } = options || ({} as any);\n\n    if (registry) {\n      injector = Injector.create({\n        providers: [ { provide: PblNgridRegistryService, useValue: registry } ],\n        parent: ngRef.injector\n      });\n    }\n\n    const cmpRef = ngRef.componentFactoryResolver.resolveComponentFactory<T>(component).create(injector);\n    cmpRef.changeDetectorRef.detectChanges();\n    if (destroy) {\n      ngRef.onDestroy( () => {\n        try {\n          cmpRef.destroy();\n        } catch( err) {}\n      });\n    }\n\n    return cmpRef;\n  }\n}\n","/* LEAVE THIS, WE NEED IT SO THE AUGMENTATION IN THE FILE WILL LOAD. */\nimport './lib/grid/bind-grid-to-datasource';\nimport { isPblColumn, isPblMetaColumn, isPblColumnGroup } from './lib/grid/index';\n\n/* Some symbols in `@pebula/ngrid/core` are also used by \"regular\" users of ngrid (as opposed to internal/plugin use) so we need to re-export them\n   from the main package so \"regular\" user will not have to specifically address `@pebula/ngrid/core` */\nexport {\n  // Configuration\n  PEB_NGRID_CONFIG, PblNgridConfig, PblNgridConfigService,\n\n  // Pagination\n  PblNgridPaginatorKind, PblPaginator, PblPaginatorChangeEvent,\n\n  // Data Source\n  PblDataSourceConfigurableTriggers,\n  PblDataSourceTriggers,\n  PblDataSourceTriggerChange, PblDataSourceTriggerChangedEvent, PblDataSourceTriggerChangedEventSource, PblDataSourceTriggerChangeHandler,\n  PblDataSourceAdapter,\n  PblDataSource, PblDataSourceOptions,\n  PblNgridSortInstructions, PblNgridSortDefinition, PblNgridSorter, PblNgridSortOrder,\n  PblDataSourceFactory, DataSourceOf,\n  DataSourceFilterToken, DataSourcePredicate, DataSourceColumnPredicate,\n  PblDataSourceAdapterProcessedResult,\n  createDS, applySort,\n\n  // Models: Column\n  PblColumnTypeDefinitionDataMap,\n  PblColumnTypeDefinition,\n  PblColumnDefinition,\n  PblMetaColumnDefinition,\n  PblColumnGroupDefinition,\n  PblColumnSet,\n  PblMetaRowDefinitions,\n  PblNgridColumnDefinitionSet,\n} from '@pebula/ngrid/core';\n\nexport {\n  PblColumn, PblMetaColumn, PblColumnGroup, PblColumnFactory, COLUMN, columnFactory,\n  isPblMetaColumn, isPblColumnGroup, isPblColumn,\n\n  GridRowType,\n  RowsApi,\n  NGRID_CELL_FACTORY,\n  PBL_NGRID_ROW_TEMPLATE,\n  PblNgridRowDef, PblNgridRowOverride, PblNgridRowComponent, PblNgridColumnRowComponent, PblNgridMetaRowComponent,\n\n  PblNgridComponent,\n  AutoSizeToFitOptions, ColumnApi,\n\n  PblNgridRegistryService,\n  PblNgridSingleTemplateRegistry, PblNgridMultiTemplateRegistry, PblNgridMultiComponentRegistry,\n  PblNgridDataHeaderExtensionRef, PblNgridDataHeaderExtensionContext,\n  PblNgridCellDefDirective,\n  PblNgridHeaderCellDefDirective,\n  PblNgridFooterCellDefDirective,\n  PblNgridCellStyling,\n  PblNgridNoDataRefDirective,\n  PblNgridColumnSet,\n\n  DISABLE_INTERSECTION_OBSERVABLE,\n  PblNgridVirtualScrollStrategy, PblNgridBaseVirtualScrollDirective,\n  NoVirtualScrollStrategy, PblNgridDynamicVirtualScrollStrategy,\n  // TODO: Move to an independent package in v4\n  PblNgridFixedSizeVirtualScrollStrategy, PblNgridAutoSizeVirtualScrollStrategy,\n\n  PblNgridFocusChangedEvent, PblNgridSelectionChangedEvent,\n  PblNgridMetaCellContext, PblNgridCellContext, PblNgridRowContext, PblRowContext, PblNgridContextApi,\n  CellReference, GridDataPoint,\n} from './lib/grid/index';\n\nexport { PblNgridPlugin, PblNgridPluginExtension } from './lib/ext/types';\n\nexport { EXT_API_TOKEN, PblNgridExtensionApi } from './lib/ext/grid-ext-api';\nexport { ngridPlugin, NgridPluginMetadata } from './lib/ext/grid-plugin';\nexport { PblNgridPluginController } from './lib/ext/plugin-control';\n\nexport const utils = {\n  isPblColumn,\n  isPblMetaColumn,\n  isPblColumnGroup,\n};\n\nexport { PblNgridModule, provideCommon } from './lib/ngrid.module';\n\nexport { PblCdkAutoSizeVirtualScrollDirective } from './lib/grid/features/virtual-scroll/strategies/cdk-wrappers/v-scroll-auto.directive';\nexport { PblCdkFixedSizedVirtualScrollDirective } from './lib/grid/features/virtual-scroll/strategies/cdk-wrappers/v-scroll-fixed.directive';\nexport {\n  PblNgridOuterSectionDirective, PblNgridCellComponent, PblNgridFooterCellComponent, PblNgridMetaCellComponent, PblNgridHeaderCellComponent, PblNgridScrolling,\n  PblNgridPaginatorRefDirective, PblNgridHeaderExtensionRefDirective, PblNgridHideColumns, PblCdkVirtualScrollDirective,\n  PblNgridCellEditAutoFocusDirective, PblNgridEditorCellDefDirective,\n} from './lib/grid/index';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.PblNgridMetaRowService","i2","CLONE_PROPERTIES","i1.PblNgridRegistryService","observableOf","i1","i4","i3","i5","i6.PblNgridMetaRowContainerComponent","i7.PblCdkTableComponent","i8.PblNgridRowDef","i9.PblNgridRowComponent","i10.PblNgridColumnRowComponent","i11.PblNgridMetaRowComponent","i12.PblCdkVirtualScrollViewportComponent","i1.PblNgridComponent","i2.PblNgridPluginController","i1.PblNgridPluginController","ScrollingModuleExp"],"mappings":";;;;;;;;;;;;;;;;;;;AASM,SAAU,oBAAoB,CAAC,MAAoC,EAAA;AACvE,IAAA,MAAM,CAAC,MAAM,CAAC,SAAS,CAAE,KAAK,IAAG;AAC/B,QAAA,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE;AACjC,YAAA,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;YAC7B,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,IAAI,EAAE;AACzC,gBAAA,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;AAC3B,aAAA;AACD,YAAA,IAAI,IAAI,EAAE;AACR,gBAAA,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC;AAC7B,aAAA;AACF,SAAA;AAAM,aAAA,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE;AACrC,YAAA,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1B,YAAA,IAAI,EAAE,CAAC,QAAQ,KAAK,MAAM,CAAC,IAAI,EAAE;AAC/B,gBAAA,EAAE,CAAC,QAAQ,GAAG,SAAS,CAAC;AACzB,aAAA;AACF,SAAA;AACH,KAAC,CAAC,CAAC;AACL;;MCTa,aAAa,GAAG,IAAI,cAAc,CAAC,wBAAwB;;ACVxE,SAAS,qBAAqB,GAAA;AAC5B,IAAA,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,E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