function e(e){return class extends e{_playedRanges=[];_currentPlayedRange=null;_RANGE_EPSILON=.5;_seeking=!1;connectedCallback(){super.connectedCallback&&super.connectedCallback(),this.addEventListener(`play`,()=>this.onPlaybackStart({time:this.currentTime})),this.addEventListener(`pause`,()=>this.onPlaybackStop({time:this.currentTime})),this.addEventListener(`ended`,()=>this.onPlaybackStop({time:this.currentTime})),this.addEventListener(`seeking`,()=>this.onSeeking()),this.addEventListener(`seeked`,()=>this.onSeeked({time:this.currentTime}))}onPlaybackStart(e={}){this._seeking=!1;let{time:t}=e,n=typeof t==`number`?t:this.currentTime;this._currentPlayedRange||={start:n,end:n}}onSeeking(){this._seeking=!0,this._commitCurrentRange()}onSeeked(e={}){this._seeking=!1;let{time:t}=e,n=typeof t==`number`?t:this.currentTime;this._currentPlayedRange={start:n,end:n}}onPlaybackStop(e={}){let{time:t}=e,n=typeof t==`number`?t:this.currentTime;this._commitCurrentRange(n)}_commitCurrentRange(e){if(!this._currentPlayedRange)return;typeof e==`number`&&(this._currentPlayedRange.end=e);let{start:t,end:n}=this._currentPlayedRange;this._currentPlayedRange=null,this.addPlayedRange(t,n)}addPlayedRange(e,t){if(e>=t)return;let n=this._RANGE_EPSILON,r=[...this._playedRanges,{start:e,end:t}];r.sort((e,t)=>e.start-t.start);let i=[];for(let e of r){if(!i.length){i.push({...e});continue}let t=i[i.length-1];e.start<=t.end+n?(t.start=Math.min(t.start,e.start),t.end=Math.max(t.end,e.end)):i.push({...e})}this._playedRanges=i}get played(){let e=this.currentTime;return!this.paused&&!this._currentPlayedRange&&typeof e==`number`&&(this._currentPlayedRange={start:e,end:e}),this._currentPlayedRange&&typeof e==`number`&&(e>this._currentPlayedRange.end&&(this._currentPlayedRange.end=e),this.addPlayedRange(this._currentPlayedRange.start,this._currentPlayedRange.end)),this._playedRanges.length?t(this._playedRanges.map(e=>[e.start,e.end])):t([[0,0]])}}}function t(e){return Object.defineProperties(e,{start:{value:t=>e[t][0]},end:{value:t=>e[t][1]}}),e}export{e as t};