text: define(["exports","../../../@polymer/polymer/lib/utils/async.js","../../../@polymer/polymer/polymer-element.js"],function(_exports,_async,_polymerElement){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.SortMixin=void 0;_exports.SortMixin=superClass=>(class SortMixin extends superClass{static get properties(){return{multiSort:{type:Boolean,value:!1},_sorters:{type:Array,value:function(){return[]}},_previousSorters:{type:Array,value:function(){return[]}}}}ready(){super.ready(),this.addEventListener("sorter-changed",this._onSorterChanged),window.ShadyDOM&&_async.microTask.run(()=>{const sorters=this.querySelectorAll("vaadin-grid-sorter");Array.from(sorters).forEach(sorter=>{sorter instanceof _polymerElement.PolymerElement&&sorter.dispatchEvent(new CustomEvent("sorter-changed",{bubbles:!0,composed:!0}))})})}_onSorterChanged(e){const sorter=e.target;this._removeArrayItem(this._sorters,sorter),sorter._order=null,this.multiSort?(sorter.direction&&this._sorters.unshift(sorter),this._sorters.forEach((sorter,index)=>sorter._order=this._sorters.length>1?index:null,this)):sorter.direction&&(this._sorters.forEach(sorter=>{sorter._order=null,sorter.direction=null}),this._sorters=[sorter]),e.stopPropagation(),this.dataProvider&&JSON.stringify(this._previousSorters)!==JSON.stringify(this._mapSorters())&&this.clearCache(),this._a11yUpdateSorters(),this._previousSorters=this._mapSorters()}_mapSorters(){return this._sorters.map(sorter=>({path:sorter.path,direction:sorter.direction}))}_removeArrayItem(array,item){const index=array.indexOf(item);index>-1&&array.splice(index,1)}})});