try{var k='qs_self_heal_count';var c=parseInt(localStorage.getItem(k)||'0',10);if(isNaN(c)||c<0){c=0}c++;localStorage.setItem(k,String(c));if(c>=3){try{document.documentElement.innerHTML='<style>body{font-family:sans-serif;background:#0b1b3a;color:#fff;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;text-align:center}p{color:#cbd5e1}button{padding:14px 28px;font-size:16px;border-radius:10px;border:none;background:linear-gradient(135deg,#f5c242,#f39c12);color:#000;cursor:pointer;margin-top:20px}</style><div><h2>正在更新到最新版本</h2><p>自动恢复未成功，请点击下方按钮清理缓存重进</p><button onclick="try{localStorage.clear();if(navigator.serviceWorker){navigator.serviceWorker.getRegistrations().then(function(r){r.forEach(function(s){s.unregister()})})}if(window.caches){caches.keys().then(function(k3){k3.forEach(function(c3){caches.delete(c3)})})}setTimeout(function(){location.href=location.origin+'/?_fresh='+Date.now()},300)}catch(e){location.href=location.origin+'/?_fresh='+Date.now()}">清理缓存并重新进入</button></div>';return}catch(e){}}var clean=Promise.resolve();if('serviceWorker'in navigator){clean=clean.then(function(){return navigator.serviceWorker.getRegistrations().then(function(rs){return Promise.all(rs.map(function(r){return r.unregister()}))}).catch(function(){})})}if(window.caches){clean=clean.then(function(){return caches.keys().then(function(ks){return Promise.all(ks.map(function(k2){return caches.delete(k2)}))}).catch(function(){})})}clean.then(function(){location.replace(location.origin+'/?_heal='+Date.now())}).catch(function(){location.replace(location.origin+'/?_heal='+Date.now())})}catch(e){location.replace(location.origin+'/?_heal='+Date.now())}