text: define(["exports","../../../@polymer/polymer/polymer-legacy.js","../../../@polymer/polymer/lib/utils/async.js","../../../@polymer/polymer/lib/utils/flattened-nodes-observer.js","./vaadin-grid-column.js","../../../@polymer/polymer/polymer-element.js"],(function(e,i,t,o,l,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GridColumnGroupElement=void 0;
  /**
    @license
    Copyright (c) 2017 Vaadin Ltd.
    This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
    */
  class GridColumnGroupElement extends((0,l.ColumnBaseMixin)(r.PolymerElement)){static get is(){return"vaadin-grid-column-group"}static get properties(){return{_childColumns:{value:function(){return this._getChildColumns(this)}},flexGrow:{type:Number,readOnly:!0},width:{type:String,readOnly:!0},_visibleChildColumns:Array,_colSpan:Number,_rootColumns:Array}}static get observers(){return["_updateVisibleChildColumns(_childColumns)","_childColumnsChanged(_childColumns)","_groupFrozenChanged(frozen, _rootColumns)","_groupHiddenChanged(hidden, _rootColumns)","_visibleChildColumnsChanged(_visibleChildColumns)","_colSpanChanged(_colSpan, _headerCell, _footerCell)","_groupOrderChanged(_order, _rootColumns)","_groupReorderStatusChanged(_reorderStatus, _rootColumns)","_groupResizableChanged(resizable, _rootColumns)"]}connectedCallback(){super.connectedCallback(),this._addNodeObserver(),this._updateFlexAndWidth()}disconnectedCallback(){super.disconnectedCallback(),this._observer&&this._observer.disconnect()}_columnPropChanged(e,i){"hidden"===e&&(this._preventHiddenCascade=!0,this._updateVisibleChildColumns(this._childColumns),this._preventHiddenCascade=!1),/flexGrow|width|hidden|_childColumns/.test(e)&&this._updateFlexAndWidth(),"frozen"===e&&(this.frozen=this.frozen||i),"lastFrozen"===e&&(this._lastFrozen=this._lastFrozen||i)}_groupOrderChanged(e,i){if(i){const t=i.slice(0);if(!e)return void t.forEach(e=>e._order=0);const o=/(0+)$/.exec(e).pop().length,l=1+~~(Math.log(i.length)/Math.log(Math.LN10)),r=Math.pow(10,o-l);t[0]&&t[0]._order&&t.sort((e,i)=>e._order-i._order),t.forEach((i,t)=>i._order=e+(t+1)*r)}}_groupReorderStatusChanged(e,i){void 0!==e&&void 0!==i&&i.forEach(i=>i._reorderStatus=e)}_groupResizableChanged(e,i){void 0!==e&&void 0!==i&&i.forEach(i=>i.resizable=e)}_updateVisibleChildColumns(e){this._visibleChildColumns=Array.prototype.filter.call(e,e=>!e.hidden)}_childColumnsChanged(e){!this._autoHidden&&this.hidden&&(Array.prototype.forEach.call(e,e=>e.hidden=!0),this._updateVisibleChildColumns(e))}_updateFlexAndWidth(){this._visibleChildColumns&&(this._visibleChildColumns.length?this._setWidth("calc("+Array.prototype.reduce.call(this._visibleChildColumns,(e,i)=>e+" + "+(i.width||"0px").replace("calc",""),"").substring(3)+")"):this._setWidth("0px"),this._setFlexGrow(Array.prototype.reduce.call(this._visibleChildColumns,(e,i)=>e+i.flexGrow,0)))}_groupFrozenChanged(e,i){void 0!==i&&void 0!==e&&!1!==e&&Array.from(i).forEach(i=>i.frozen=e)}_groupHiddenChanged(e,i){i&&!this._preventHiddenCascade&&(this._ignoreVisibleChildColumns=!0,i.forEach(i=>i.hidden=e),this._ignoreVisibleChildColumns=!1),this._columnPropChanged("hidden")}_visibleChildColumnsChanged(e){this._colSpan=e.length,this._ignoreVisibleChildColumns||(0===e.length?this._autoHidden=this.hidden=!0:this.hidden&&this._autoHidden&&(this._autoHidden=this.hidden=!1))}_colSpanChanged(e,i,t){i&&(i.setAttribute("colspan",e),this._grid&&this._grid._a11yUpdateCellColspan(i,e)),t&&(t.setAttribute("colspan",e),this._grid&&this._grid._a11yUpdateCellColspan(t,e))}_getChildColumns(e){return o.FlattenedNodesObserver.getFlattenedNodes(e).filter(this._isColumnElement)}_addNodeObserver(){this._observer=new o.FlattenedNodesObserver(this,e=>{(e.addedNodes.filter(this._isColumnElement).length>0||e.removedNodes.filter(this._isColumnElement).length>0)&&(this._preventHiddenCascade=!0,this._rootColumns=this._getChildColumns(this),this._childColumns=this._rootColumns,this._preventHiddenCascade=!1,t.microTask.run(()=>{this._grid&&this._grid._updateColumnTree&&this._grid._updateColumnTree()}))}),this._observer.flush()}_isColumnElement(e){return e.nodeType===Node.ELEMENT_NODE&&/\bcolumn\b/.test(e.localName)}}e.GridColumnGroupElement=GridColumnGroupElement,customElements.define(GridColumnGroupElement.is,GridColumnGroupElement)}));