/**
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
import"./boot.js";let e=0,t=0,n=[],o=0,c=!1,a=document.createTextNode("");new window.MutationObserver((function microtaskFlush(){c=!1;const e=n.length;for(let t=0;t<e;t++){let e=n[t];if(e)try{e()}catch(e){setTimeout((()=>{throw e}))}}n.splice(0,e),t+=e})).observe(a,{characterData:!0});const i={after:e=>({run:t=>window.setTimeout(t,e),cancel(e){window.clearTimeout(e)}}),run:(e,t)=>window.setTimeout(e,t),cancel(e){window.clearTimeout(e)}};export{i as timeOut};const l={run:e=>window.requestAnimationFrame(e),cancel(e){window.cancelAnimationFrame(e)}};export{l as animationFrame};const r={run:e=>window.requestIdleCallback?window.requestIdleCallback(e):window.setTimeout(e,16),cancel(e){window.cancelIdleCallback?window.cancelIdleCallback(e):window.clearTimeout(e)}};export{r as idlePeriod};const w={run:t=>(c||(c=!0,a.textContent=o++),n.push(t),e++),cancel(e){const o=e-t;if(o>=0){if(!n[o])throw new Error("invalid async handle: "+e);n[o]=null}}};export{w as microTask};