(function(){
  function ready(fn){document.readyState!=='loading'?fn():document.addEventListener('DOMContentLoaded',fn)}
  ready(function(){
    var bar=document.createElement('div');bar.className='stc-progress';document.body.appendChild(bar);
    function progress(){var h=document.documentElement;var max=h.scrollHeight-h.clientHeight;bar.style.width=max>0?((h.scrollTop/max)*100)+'%':'0%'}
    progress();document.addEventListener('scroll',progress,{passive:true});window.addEventListener('resize',progress);
    document.addEventListener('click',function(e){var btn=e.target.closest('[data-stc-copy]');if(!btn)return;e.preventDefault();var txt=btn.getAttribute('data-stc-copy')||location.href;navigator.clipboard&&navigator.clipboard.writeText(txt).then(function(){btn.textContent='Copied';setTimeout(function(){btn.textContent=btn.getAttribute('data-label')||'Copy link'},1400)});});
  });
})();
