Files
echo-nexus/_next/static/chunks/29df3e9f2bd744ef.js
T

10 lines
427 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,16015,(e,t,a)=>{},98547,(e,t,a)=>{var s=e.i(47167);e.r(16015);var r=e.r(71645),n=r&&"object"==typeof r&&"default"in r?r:{default:r},o=void 0!==s.default&&s.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},i=function(){function e(e){var t=void 0===e?{}:e,a=t.name,s=void 0===a?"stylesheet":a,r=t.optimizeForSpeed,n=void 0===r?o:r;c(l(s),"`name` must be a string"),this._name=s,this._deletedRulePlaceholder="#"+s+"-deleted-rule____{}",c("boolean"==typeof n,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=n,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var i="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=i?i.getAttribute("content"):null}var t,a=e.prototype;return a.setOptimizeForSpeed=function(e){c("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),c(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},a.isOptimizeForSpeed=function(){return this._optimizeForSpeed},a.inject=function(){var e=this;if(c(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(o||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,a){return"number"==typeof a?e._serverSheet.cssRules[a]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),a},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},a.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]},a.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},a.insertRule=function(e,t){if(c(l(e),"`insertRule` accepts only strings"),"u"<typeof window)return"number"!=typeof t&&(t=this._serverSheet.cssRules.length),this._serverSheet.insertRule(e,t),this._rulesCount++;if(this._optimizeForSpeed){var a=this.getSheet();"number"!=typeof t&&(t=a.cssRules.length);try{a.insertRule(e,t)}catch(t){return o||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var s=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,s))}return this._rulesCount++},a.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var a="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!a.cssRules[e])return e;a.deleteRule(e);try{a.insertRule(t,e)}catch(s){o||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),a.insertRule(this._deletedRulePlaceholder,e)}}else{var s=this._tags[e];c(s,"old rule at index `"+e+"` not found"),s.textContent=t}return e},a.deleteRule=function(e){if("u"<typeof window)return void this._serverSheet.deleteRule(e);if(this._optimizeForSpeed)this.replaceRule(e,"");else{var t=this._tags[e];c(t,"rule at index `"+e+"` not found"),t.parentNode.removeChild(t),this._tags[e]=null}},a.flush=function(){this._injected=!1,this._rulesCount=0,"u">typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},a.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,a){return a?t=t.concat(Array.prototype.map.call(e.getSheetForTag(a).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},a.makeStyleTag=function(e,t,a){t&&c(l(t),"makeStyleTag accepts only strings as second parameter");var s=document.createElement("style");this._nonce&&s.setAttribute("nonce",this._nonce),s.type="text/css",s.setAttribute("data-"+e,""),t&&s.appendChild(document.createTextNode(t));var r=document.head||document.getElementsByTagName("head")[0];return a?r.insertBefore(s,a):r.appendChild(s),s},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var a=0;a<t.length;a++){var s=t[a];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}(e.prototype,t),e}();function c(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var d=function(e){for(var t=5381,a=e.length;a;)t=33*t^e.charCodeAt(--a);return t>>>0},u={};function h(e,t){if(!t)return"jsx-"+e;var a=String(t),s=e+a;return u[s]||(u[s]="jsx-"+d(e+"-"+a)),u[s]}function f(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var a=e+t;return u[a]||(u[a]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[a]}var m=function(){function e(e){var t=void 0===e?{}:e,a=t.styleSheet,s=void 0===a?null:a,r=t.optimizeForSpeed,n=void 0!==r&&r;this._sheet=s||new i({name:"styled-jsx",optimizeForSpeed:n}),this._sheet.inject(),s&&"boolean"==typeof n&&(this._sheet.setOptimizeForSpeed(n),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),this._fromServer=void 0,this._indices={},this._instancesCounts={}}var t=e.prototype;return t.add=function(e){var t=this;void 0===this._optimizeForSpeed&&(this._optimizeForSpeed=Array.isArray(e.children),this._sheet.setOptimizeForSpeed(this._optimizeForSpeed),this._optimizeForSpeed=this._sheet.isOptimizeForSpeed()),"u">typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var a=this.getIdAndRules(e),s=a.styleId,r=a.rules;if(s in this._instancesCounts){this._instancesCounts[s]+=1;return}var n=r.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[s]=n,this._instancesCounts[s]=1},t.remove=function(e){var t=this,a=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(a in this._instancesCounts,"styleId: `"+a+"` not found"),this._instancesCounts[a]-=1,this._instancesCounts[a]<1){var s=this._fromServer&&this._fromServer[a];s?(s.parentNode.removeChild(s),delete this._fromServer[a]):(this._indices[a].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[a]),delete this._instancesCounts[a]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],a=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return a[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,a;return t=this.cssRules(),void 0===(a=e)&&(a={}),t.map(function(e){var t=e[0],s=e[1];return n.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:a.nonce?a.nonce:void 0,dangerouslySetInnerHTML:{__html:s}})})},t.getIdAndRules=function(e){var t=e.children,a=e.dynamic,s=e.id;if(a){var r=h(s,a);return{styleId:r,rules:Array.isArray(t)?t.map(function(e){return f(r,e)}):[f(r,t)]}}return{styleId:h(s),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=r.createContext(null);function x(){return new m}function g(){return r.useContext(p)}p.displayName="StyleSheetContext";var b=n.default.useInsertionEffect||n.default.useLayoutEffect,y="u">typeof window?x():void 0;function w(e){var t=y||g();return t&&("u"<typeof window?t.add(e):b(function(){return t.add(e),function(){t.remove(e)}},[e.id,String(e.dynamic)])),null}w.dynamic=function(e){return e.map(function(e){return h(e[0],e[1])}).join(" ")},a.StyleRegistry=function(e){var t=e.registry,a=e.children,s=r.useContext(p),o=r.useState(function(){return s||t||x()})[0];return n.default.createElement(p.Provider,{value:o},a)},a.createStyleRegistry=x,a.style=w,a.useStyleRegistry=g},37902,(e,t,a)=>{t.exports=e.r(98547).style},52683,e=>{"use strict";let t,a,s,r,n,o,l,i,c,d;var u,h,f,m,p,x,g,b,y,w=e.i(43476),v=e.i(71645);function j({className:e}){let t=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=t.current;if(!e)return;let a=e.getContext("2d");if(!a)return;let s=0,r=0,n=1,o=[],l=[],i=0,c=performance.now(),d=["#34d399","#fb7185","#fbbf24","#e879f9","#a5f3fc"];function u(){n=Math.min(2,window.devicePixelRatio||1),s=e.clientWidth,r=e.clientHeight,e.width=Math.floor(s*n),e.height=Math.floor(r*n),a.setTransform(n,0,0,n,0,0),o=Array.from({length:Math.min(220,Math.floor(s*r/7e3))},()=>({x:Math.random()*s,y:Math.random()*r,z:Math.random(),r:1.4*Math.random()+.2,tw:Math.random()*Math.PI*2,hue:.15>Math.random()?Math.floor(Math.random()*d.length):-1}))}u();let h=new ResizeObserver(u);return h.observe(e),i=requestAnimationFrame(function e(t){let n=t-c;c=t;let u=a.createRadialGradient(.5*s,.4*r,0,.5*s,.5*r,.8*Math.max(s,r));u.addColorStop(0,"#1a0f2e"),u.addColorStop(.45,"#0d0a1f"),u.addColorStop(1,"#050410"),a.fillStyle=u,a.fillRect(0,0,s,r),a.globalCompositeOperation="screen";for(let e=0;e<3;e++){let n=s*(.2+.3*e)+40*Math.sin(t/9e3+e),o=r*(.3+e%2*.4)+30*Math.cos(t/11e3+e),l=Math.max(80,Math.min(s,r)*(.25+.05*e)),i=a.createRadialGradient(n,o,0,n,o,l),c=0===e?"rgba(232,121,249,0.10)":1===e?"rgba(52,211,153,0.08)":"rgba(251,113,133,0.08)";i.addColorStop(0,c),i.addColorStop(1,"rgba(0,0,0,0)"),a.fillStyle=i,a.beginPath(),a.arc(n,o,l,0,2*Math.PI),a.fill()}for(let e of(a.globalCompositeOperation="source-over",o)){e.tw+=.02+.04*e.z;let t=.4+.35*Math.sin(e.tw)+.3*e.z;e.hue>=0?(a.fillStyle=d[e.hue],a.globalAlpha=Math.max(0,Math.min(1,t)),a.beginPath(),a.arc(e.x,e.y,1.6*e.r,0,2*Math.PI),a.fill(),a.globalAlpha=Math.max(0,Math.min(1,.25*t)),a.beginPath(),a.arc(e.x,e.y,4*e.r,0,2*Math.PI)):(a.fillStyle=`rgba(220,230,255,${Math.max(0,Math.min(1,t))})`,a.beginPath(),a.arc(e.x,e.y,e.r,0,2*Math.PI)),a.fill(),e.y+=.02+.05*e.z,e.y>r+2&&(e.y=-2,e.x=Math.random()*s)}a.globalAlpha=1,.04>Math.random()&&function(){if(l.length>60)return;let e=d[Math.floor(Math.random()*d.length)];l.push({x:Math.random()*s,y:r+10,vx:(Math.random()-.5)*.3,vy:-(.5*Math.random()+.2),life:0,maxLife:600+800*Math.random(),color:e})}(),a.globalCompositeOperation="screen";for(let e=l.length-1;e>=0;e--){let t=l[e];if(t.life+=n,t.x+=t.vx*n*.06,t.y+=t.vy*n*.06,t.life>t.maxLife||t.y<-10){l.splice(e,1);continue}let s=.7*Math.sin(t.life/t.maxLife*Math.PI);a.fillStyle=t.color,a.globalAlpha=s,a.beginPath(),a.arc(t.x,t.y,1.6,0,2*Math.PI),a.fill(),a.globalAlpha=.2*s,a.beginPath(),a.arc(t.x,t.y,5,0,2*Math.PI),a.fill()}a.globalAlpha=1,a.globalCompositeOperation="source-over",i=requestAnimationFrame(e)}),()=>{cancelAnimationFrame(i),h.disconnect()}},[]),(0,w.jsx)("canvas",{ref:t,className:e,"aria-hidden":"true"})}e.i(47167);let N=e=>{let t,a=new Set,s=(e,s)=>{let r="function"==typeof e?e(t):e;if(!Object.is(r,t)){let e=t;t=(null!=s?s:"object"!=typeof r||null===r)?r:Object.assign({},t,r),a.forEach(a=>a(t,e))}},r=()=>t,n={setState:s,getState:r,getInitialState:()=>o,subscribe:e=>(a.add(e),()=>a.delete(e))},o=t=e(s,r,n);return n},k=e=>{let t=e?N(e):N,a=e=>(function(e,t=e=>e){let a=v.default.useSyncExternalStore(e.subscribe,v.default.useCallback(()=>t(e.getState()),[e,t]),v.default.useCallback(()=>t(e.getInitialState()),[e,t]));return v.default.useDebugValue(a),a})(t,e);return Object.assign(a,t),a};function M(e,t){let a;try{a=e()}catch(e){return}return{getItem:e=>{var s;let r=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),n=null!=(s=a.getItem(e))?s:null;return n instanceof Promise?n.then(r):r(n)},setItem:(e,s)=>a.setItem(e,JSON.stringify(s,null==t?void 0:t.replacer)),removeItem:e=>a.removeItem(e)}}let S=e=>t=>{try{let a=e(t);if(a instanceof Promise)return a;return{then:e=>S(e)(a),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>S(t)(e)}}},C={crystals:0,insights:0,energy:3,contact:0,crystalsPerSec:.4,crystalCap:50,pulsePower:2,offlineEff:.5,insightMult:1,contactRateMult:1,autoDecode:!1,totalDecoded:0,ascensions:0,blueprints:[],pendingCrystals:[],activePuzzle:null,activeExpedition:null,expeditionLog:[],energyMax:5,lastEnergyTick:Date.now(),totalExpeditions:0,bossKills:0,achievements:{},activeTide:null,lastTideEnd:0,starTidesEncountered:[],constellation:[],pendingPerkChoices:null,chronicle:[],runStart:{timestamp:Date.now(),techsUnlocked:0,expeditionsCompleted:0,bossKills:0,starTidesEncountered:[],crystalsDecoded:0},attributes:{exploration:0,wisdom:0,courage:0,inspiration:0},attributeProgress:{exploration:{exp:0,level:0},wisdom:{exp:0,level:0},courage:{exp:0,level:0},inspiration:{exp:0,level:0}},pendingAttrPoints:0,theme:"dark",soundOn:!0},_={1:{crystals:6,insights:1},2:{crystals:22,insights:4},3:{crystals:90,insights:16}},T={1:{rows:3,cols:3,targetLen:3,stepLimitBase:5},2:{rows:4,cols:4,targetLen:4,stepLimitBase:7},3:{rows:5,cols:4,targetLen:5,stepLimitBase:9}},P=["emerald","rose","amber","fuchsia"],R={emerald:{hex:"#34d399",glow:"rgba(52,211,153,0.55)",label:"翠"},rose:{hex:"#fb7185",glow:"rgba(251,113,133,0.55)",label:"玫"},amber:{hex:"#fbbf24",glow:"rgba(251,191,36,0.55)",label:"琥"},fuchsia:{hex:"#e879f9",glow:"rgba(232,121,249,0.55)",label:"紫"}},E=[{id:"min_1",branch:"mining",level:1,name:"谐振钻头",desc:"晶体/秒 +0.6",cost:5,effect:{kind:"crystalsPerSec",value:.6}},{id:"min_2",branch:"mining",level:2,name:"深层矿脉",desc:"晶体/秒 +1.6,仓库上限 +100",cost:24,effect:{kind:"crystalsPerSec",value:1.6}},{id:"min_3",branch:"mining",level:3,name:"自治机群",desc:"晶体/秒 +5,仓库上限 +300",cost:120,effect:{kind:"crystalsPerSec",value:5}},{id:"dec_1",branch:"decoding",level:1,name:"谐振校准",desc:"解码步数上限 +2",cost:6,effect:{kind:"decodeSteps",value:2}},{id:"dec_2",branch:"decoding",level:2,name:"脉冲增幅",desc:"主动脉冲产出 +3",cost:30,effect:{kind:"pulsePower",value:3}},{id:"dec_3",branch:"decoding",level:3,name:"自动解码阵列",desc:"自动解码 T1 晶体(每 12 秒一颗)",cost:200,effect:{kind:"autoDecode",value:1}},{id:"exp_1",branch:"expedition",level:1,name:"远征推进器",desc:"探险力 +3,晶体/秒 +1.2",cost:12,effect:{kind:"crystalsPerSec",value:1.2}},{id:"exp_2",branch:"expedition",level:2,name:"遗迹图谱",desc:"探险力 +5,探险生命 +20,能量恢复 +30%",cost:60,effect:{kind:"crystalCap",value:200}},{id:"exp_3",branch:"expedition",level:3,name:"维度信标",desc:"探险力 +8,接触进度转化率 +50%,能量恢复 +20%",cost:180,effect:{kind:"contactRate",value:.5}},{id:"nar_1",branch:"narrative",level:1,name:"记忆校音",desc:"洞见获取 +25%",cost:8,effect:{kind:"insightMult",value:.25}},{id:"nar_2",branch:"narrative",level:2,name:"深空回响",desc:"接触进度转化率 +35%",cost:45,effect:{kind:"contactRate",value:.35}},{id:"nar_3",branch:"narrative",level:3,name:"以太共鸣",desc:"洞见获取 +60%",cost:160,effect:{kind:"insightMult",value:.6}}],A={mining:{name:"采矿",icon:"Pickaxe",color:"emerald",desc:"提升晶体产能与仓储"},decoding:{name:"解码",icon:"ScanLine",color:"rose",desc:"强化解码与脉冲"},expedition:{name:"探险",icon:"Rocket",color:"amber",desc:"远征与维度信标"},narrative:{name:"叙事",icon:"BookOpen",color:"fuchsia",desc:"洞见与接触进度"}},$=[{id:"f1_1",era:1,title:"第一缕谐振",echo:"在被称作「寂灭前夜」的年代,以太族第一次捕捉到来自虚空深处的谐振——那不是声音,而是存在的回声。他们将之记录在第一颗记忆晶体里。",threshold:1},{id:"f1_2",era:1,title:"晶体之始",echo:"「我们为何要留下?」一位长者问。「因为后来的生命会需要方向。」于是他们熔铸星核,封存记忆,让晶体成为跨越时间的信笺。",threshold:3},{id:"f1_3",era:1,title:"谐振法则",echo:"他们发现:思维可以被编码为共振序列。同色的节点相邻,便构成一句低语;一句句连成回响,回响连成文明。",threshold:6},{id:"f1_4",era:1,title:"飞升之议",echo:"议会表决:是留下,还是离去?「留下意味着停滞;离去意味着信任。」最终,他们选择了信任——信任素未谋面的后来者。",threshold:10},{id:"f1_5",era:1,title:"面包屑",echo:"他们没有带走一切。他们将知识拆成碎片,藏入晶体,散布星海。「让解码本身,成为资格的证明。」",threshold:15},{id:"f1_6",era:1,title:"回响之名",echo:"舰载 AI 被命名为「回响」——意为:你是他们留下的回声,也是他们等待的回应。当你读懂这句话时,接触便已开始。",threshold:22},{id:"f1_7",era:1,title:"第一个纪元的终焉",echo:"以太族集体褪去形体,如潮水退去。星海寂静了数万年。直到——你的脉冲扫描,唤醒了第一颗沉睡的晶体。",threshold:32},{id:"f1_8",era:1,title:"致后来者",echo:"「如果你读到这里,说明你已具备跨越维度的资格。继续解码,继续拼凑。当进度满溢,我们将在更高处相会。」——以太族·第一纪元·绝笔",threshold:45}],B=.05,I=.03,D=.04;function O(e){return isFinite(e)?e<1e3?e.toFixed(+(e<10&&e%1!=0)):e<1e6?(e/1e3).toFixed(2)+"K":e<1e9?(e/1e6).toFixed(2)+"M":e<1e12?(e/1e9).toFixed(2)+"B":(e/1e12).toFixed(2)+"T":"∞"}let L=[{id:"ach_first_pulse",name:"初次触碰",desc:"发起第一次脉冲扫描",icon:"✦",color:"#34d399",check:e=>e.totalDecoded>=0||e.crystals>0,reward:{crystals:5},rewardText:"+5 晶体"},{id:"ach_first_decode",name:"谐振初鸣",desc:"成功解码第一颗记忆晶体",icon:"◈",color:"#fb7185",check:e=>e.totalDecoded>=1,reward:{insights:3},rewardText:"+3 洞见"},{id:"ach_decoded_10",name:"回响解码者",desc:"累计解码 10 颗晶体",icon:"❖",color:"#fbbf24",check:e=>e.totalDecoded>=10,reward:{insights:15,crystalsPerSecPct:5},rewardText:"+15 洞见 · 产能 +5%"},{id:"ach_decoded_25",name:"记忆织匠",desc:"累计解码 25 颗晶体",icon:"✺",color:"#e879f9",check:e=>e.totalDecoded>=25,reward:{insights:40,crystalsPerSecPct:8},rewardText:"+40 洞见 · 产能 +8%"},{id:"ach_decoded_50",name:"星核解密师",desc:"累计解码 50 颗晶体",icon:"✷",color:"#34d399",check:e=>e.totalDecoded>=50,reward:{insights:100,crystalsPerSecPct:12,insightPct:10},rewardText:"+100 洞见 · 产能 +12% · 洞见 +10%"},{id:"ach_tech_3",name:"初窥门径",desc:"解锁 3 项技术",icon:"⚙",color:"#fbbf24",check:e=>Object.values(e.tech).filter(e=>e>0).length>=3,reward:{insights:20},rewardText:"+20 洞见"},{id:"ach_tech_all",name:"全谱精通",desc:"解锁全部 12 项技术",icon:"⬡",color:"#e879f9",check:e=>Object.values(e.tech).filter(e=>e>0).length>=12,reward:{crystalsPerSecPct:15,insightPct:15},rewardText:"产能 +15% · 洞见 +15%"},{id:"ach_frag_4",name:"残篇拾遗",desc:"拼凑 4 段记忆碎片",icon:"▤",color:"#fb7185",check:e=>Object.values(e.fragments).filter(Boolean).length>=4,reward:{contact:10,insights:25},rewardText:"+10 接触 · +25 洞见"},{id:"ach_frag_all",name:"回响全谱",desc:"拼凑全部首纪元记忆碎片",icon:"▦",color:"#34d399",check:e=>Object.values(e.fragments).filter(Boolean).length>=8,reward:{contact:25,crystalsPerSecPct:10},rewardText:"+25 接触 · 产能 +10%"},{id:"ach_exp_1",name:"初探遗迹",desc:"完成第一次遗迹探险",icon:"▲",color:"#fbbf24",check:e=>e.totalExpeditions>=1,reward:{insights:10},rewardText:"+10 洞见"},{id:"ach_exp_5",name:"遗迹猎手",desc:"累计出发 5 次探险",icon:"⬢",color:"#fb7185",check:e=>e.totalExpeditions>=5,reward:{insights:30,crystalsPerSecPct:5},rewardText:"+30 洞见 · 产能 +5%"},{id:"ach_prestige_1",name:"初次接触",desc:"完成第一次飞升",icon:"✧",color:"#e879f9",check:e=>e.ascensions>=1,reward:{crystalsPerSecPct:10,insightPct:10},rewardText:"产能 +10% · 洞见 +10%"},{id:"ach_prestige_3",name:"维度行者",desc:"累计飞升 3 次",icon:"✶",color:"#34d399",check:e=>e.ascensions>=3,reward:{crystalsPerSecPct:20,insightPct:20},rewardText:"产能 +20% · 洞见 +20%"},{id:"ach_warehouse",name:"满仓时刻",desc:"晶体储量达到仓库上限",icon:"▣",color:"#fbbf24",check:e=>e.crystals>=e.crystalCap,reward:{insights:8},rewardText:"+8 洞见"},{id:"ach_constellation_1",name:"星图初绘",desc:"觉醒第 1 道星图天赋",icon:"✨",color:"#e879f9",check:e=>(e.constellation?.length??0)>=1,reward:{insights:30,crystalsPerSecPct:5},rewardText:"+30 洞见 · 产能 +5%"},{id:"ach_constellation_6",name:"六分星辉",desc:"觉醒 6 道星图天赋(每类各 1 道)",icon:"✺",color:"#34d399",check:e=>{let t=e.constellation??[];return new Set(t.map(e=>e.split("_")[1])).size>=6&&t.length>=6},reward:{crystalsPerSecPct:12,insightPct:12},rewardText:"产能 +12% · 洞见 +12%"},{id:"ach_chronicle_1",name:"首部编年",desc:"完成首次飞升,开启编年史第一章",icon:"📖",color:"#e879f9",check:e=>(e.chronicle?.length??0)>=1,reward:{insights:40,crystalsPerSecPct:6},rewardText:"+40 洞见 · 产能 +6%"},{id:"ach_chronicle_3",name:"三纪元回响",desc:"完成 3 次飞升,编年史铭刻三章",icon:"📜",color:"#fbbf24",check:e=>(e.chronicle?.length??0)>=3,reward:{crystalsPerSecPct:10,insightPct:10},rewardText:"产能 +10% · 洞见 +10%"},{id:"ach_chronicle_5",name:"五纪元闭环",desc:"完成 5 次飞升,走完一轮纪元循环",icon:"♾",color:"#fcd34d",check:e=>(e.chronicle?.length??0)>=5,reward:{crystalsPerSecPct:15,insightPct:15},rewardText:"产能 +15% · 洞见 +15%"},{id:"ach_boss_1",name:"首杀维度",desc:"在遗迹探险中击破首个 BOSS",icon:"⚔",color:"#fb7185",check:e=>(e.bossKills??0)>=1,reward:{insights:25,crystalsPerSecPct:4},rewardText:"+25 洞见 · 产能 +4%"},{id:"ach_boss_5",name:"维度猎手",desc:"累计击破 5 个 BOSS",icon:"⛧",color:"#e879f9",check:e=>(e.bossKills??0)>=5,reward:{crystalsPerSecPct:10,insightPct:8},rewardText:"产能 +10% · 洞见 +8%"},{id:"ach_tides_all",name:"星潮亲历者",desc:"经历全部 9 种星潮事件",icon:"🌊",color:"#34d399",check:e=>(e.starTidesEncountered?.length??0)>=9,reward:{crystalsPerSecPct:8,insightPct:8},rewardText:"产能 +8% · 洞见 +8%"},{id:"ach_attr_total_50",name:"四维觉醒",desc:"角色四维属性总和达到 50",icon:"🧭",color:"#e879f9",check:e=>{let t=e.attributes;return!!t&&(t.exploration||0)+(t.wisdom||0)+(t.courage||0)+(t.inspiration||0)>=50},reward:{crystalsPerSecPct:6,insightPct:6},rewardText:"产能 +6% · 洞见 +6%"},{id:"ach_attr_max_100",name:"维度精通",desc:"任一角色属性达到满级 100",icon:"💫",color:"#fbbf24",check:e=>{let t=e.attributes;return!!t&&(t.exploration>=100||t.wisdom>=100||t.courage>=100||t.inspiration>=100)},reward:{crystalsPerSecPct:12,insightPct:10},rewardText:"产能 +12% · 洞见 +10%"}];function z(e){let t=0,a=0;for(let s of L)e[s.id]&&(t+=s.reward.crystalsPerSecPct??0,a+=s.reward.insightPct??0);return{crystalsPerSecPct:t,insightPct:a}}let F={crystal:{name:"晶体潮",desc:"深空晶体涌动,采矿产能翻倍",color:"#34d399",glow:"rgba(52,211,153,0.5)",icon:"✺",negative:!1},resonance:{name:"谐振风暴",desc:"共振序列被放大,解码奖励 +60%",color:"#fb7185",glow:"rgba(251,113,133,0.5)",icon:"❖",negative:!1},ruins:{name:"遗迹共振",desc:"远古遗迹苏醒,探险力 +5、生命 +30",color:"#fbbf24",glow:"rgba(251,191,36,0.5)",icon:"⬢",negative:!1},void:{name:"虚空低语",desc:"虚空传来回响,洞见获取翻倍",color:"#e879f9",glow:"rgba(232,121,249,0.5)",icon:"✷",negative:!1},core:{name:"星核悸动",desc:"星核震荡,接触率 ×3、脉冲威力 ×2",color:"#a5f3fc",glow:"rgba(165,243,252,0.5)",icon:"✦",negative:!1},silence:{name:"寂静期",desc:"虚空沉寂,产能减半;结束时按时长补偿洞见",color:"#94a3b8",glow:"rgba(148,163,184,0.5)",icon:"◌",negative:!0},surge:{name:"涌动星潮",desc:"深空晶体涌动,产能 ×2.5;但解码目标序列 +2,解码更耗时",color:"#34d399",glow:"rgba(52,211,153,0.55)",icon:"⇈",negative:!1},eclipse:{name:"蚀相星潮",desc:"维度蚀相,探险 BOSS 胜率 +20%;但晶体产出 -30%",color:"#fb7185",glow:"rgba(251,113,133,0.55)",icon:"◐",negative:!1},prism:{name:"棱镜星潮",desc:"棱镜折射,洞见获取 ×2、自动解码周期 -30%",color:"#e879f9",glow:"rgba(232,121,249,0.55)",icon:"◬",negative:!1}},H={crystal:22,resonance:20,ruins:16,void:18,core:14,silence:10,surge:12,eclipse:12,prism:12};function W(e){if(!e)return{crystalsPerSecMult:1,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0,targetLenBonus:0,bossWinRateBonus:0,autoDecodeIntervalMult:1};switch(e.type){case"crystal":return{crystalsPerSecMult:2,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0};case"resonance":return{crystalsPerSecMult:1,decodeRewardMult:1.6,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0};case"ruins":return{crystalsPerSecMult:1,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:5,expeditionHpBonus:30};case"void":return{crystalsPerSecMult:1,decodeRewardMult:1,insightMultAdd:1,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0};case"core":return{crystalsPerSecMult:1,decodeRewardMult:1,insightMultAdd:0,contactRateMult:3,pulsePowerMult:2,expeditionPowerBonus:0,expeditionHpBonus:0};case"silence":return{crystalsPerSecMult:.5,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0,silenceInsightPerSec:.4,targetLenBonus:0,bossWinRateBonus:0,autoDecodeIntervalMult:1};case"surge":return{crystalsPerSecMult:2.5,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0,targetLenBonus:2,bossWinRateBonus:0,autoDecodeIntervalMult:1};case"eclipse":return{crystalsPerSecMult:.7,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0,targetLenBonus:0,bossWinRateBonus:.2,autoDecodeIntervalMult:1};case"prism":return{crystalsPerSecMult:1,decodeRewardMult:1,insightMultAdd:1,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0,targetLenBonus:0,bossWinRateBonus:0,autoDecodeIntervalMult:.7}}}function q(e){let t=W(e);if(!t.silenceInsightPerSec)return 0;let a=(e.endsAt-e.startedAt)/1e3;return Math.round(t.silenceInsightPerSec*a)}let K={mining:{name:"永动矿脉",color:"emerald",glow:"rgba(52,211,153,0.55)",hex:"#34d399",icon:"Pickaxe",desc:"晶体产能与仓储"},decoding:{name:"光谱矩阵",color:"rose",glow:"rgba(251,113,133,0.55)",hex:"#fb7185",icon:"ScanLine",desc:"解码效率与脉冲"},expedition:{name:"远征星图",color:"amber",glow:"rgba(251,191,36,0.55)",hex:"#fbbf24",icon:"Rocket",desc:"探险力与生命"},contact:{name:"接触回响",color:"fuchsia",glow:"rgba(232,121,249,0.55)",hex:"#e879f9",icon:"Sparkles",desc:"接触进度与飞升"},economy:{name:"虚空市场",color:"slate",glow:"rgba(148,163,184,0.55)",hex:"#94a3b8",icon:"Coins",desc:"经济与离线"},cosmic:{name:"宇宙回响",color:"amber",glow:"rgba(251,191,36,0.55)",hex:"#fcd34d",icon:"Star",desc:"全局综合增益"}},U=[{id:"c_min_1",category:"mining",order:1,name:"永动钻头",desc:"晶体/秒 +20%"},{id:"c_min_2",category:"mining",order:2,name:"深井网络",desc:"仓库上限 +50%"},{id:"c_min_3",category:"mining",order:3,name:"谐振熔炉",desc:"主动脉冲威力 +50%"},{id:"c_dec_1",category:"decoding",order:1,name:"光谱记忆",desc:"洞见倍率 +15%"},{id:"c_dec_2",category:"decoding",order:2,name:"步幅延展",desc:"解码步数上限 +1"},{id:"c_dec_3",category:"decoding",order:3,name:"自动校准",desc:"自动解码周期 -3s"},{id:"c_exp_1",category:"expedition",order:1,name:"维生护盾",desc:"探险生命 +25%"},{id:"c_exp_2",category:"expedition",order:2,name:"信标矩阵",desc:"探险力 +20%"},{id:"c_exp_3",category:"expedition",order:3,name:"能量共振",desc:"能量上限 +1"},{id:"c_con_1",category:"contact",order:1,name:"接触共鸣",desc:"接触进度率 +20%"},{id:"c_con_2",category:"contact",order:2,name:"飞升加速",desc:"飞升所需接触 -10"},{id:"c_con_3",category:"contact",order:3,name:"蓝图回响",desc:"每个蓝图额外 +2% 全属性"},{id:"c_eco_1",category:"economy",order:1,name:"离线缓存",desc:"离线效率 +15%"},{id:"c_eco_2",category:"economy",order:2,name:"晶体富集",desc:"T2/T3 晶体出现率 +8%"},{id:"c_eco_3",category:"economy",order:3,name:"星潮引导",desc:"星潮间隙 -10s"},{id:"c_cos_1",category:"cosmic",order:1,name:"飞升礼包",desc:"每次飞升后获得 +30 晶体 / +5 洞见"},{id:"c_cos_2",category:"cosmic",order:2,name:"二周目经验",desc:"解码奖励 +10%"},{id:"c_cos_3",category:"cosmic",order:3,name:"全息共振",desc:"所有产能与脉冲 +8%"}];function V(e){return U.find(t=>t.id===e)}function X(e){let t=new Set(e),a={crystalsPerSecMult:1,crystalCapMult:1,pulsePowerMult:1,insightMultAdd:0,decodeStepsBonus:0,autoDecodeIntervalDeltaSec:0,expeditionHpMult:1,expeditionPowerMult:1,energyMaxBonus:0,contactRateMult:1,prestigeContactMinDelta:0,perBlueprintAllStatsPct:0,offlineEffBonus:0,t2t3BonusRate:0,tideGapDeltaSec:0,prestigeStartCrystals:0,prestigeStartInsights:0,decodeRewardMult:1,allProductionMult:1};return t.has("c_min_1")&&(a.crystalsPerSecMult+=.2),t.has("c_min_2")&&(a.crystalCapMult+=.5),t.has("c_min_3")&&(a.pulsePowerMult+=.5),t.has("c_dec_1")&&(a.insightMultAdd+=.15),t.has("c_dec_2")&&(a.decodeStepsBonus+=1),t.has("c_dec_3")&&(a.autoDecodeIntervalDeltaSec-=3),t.has("c_exp_1")&&(a.expeditionHpMult+=.25),t.has("c_exp_2")&&(a.expeditionPowerMult+=.2),t.has("c_exp_3")&&(a.energyMaxBonus+=1),t.has("c_con_1")&&(a.contactRateMult+=.2),t.has("c_con_2")&&(a.prestigeContactMinDelta-=10),t.has("c_con_3")&&(a.perBlueprintAllStatsPct+=2),t.has("c_eco_1")&&(a.offlineEffBonus+=.15),t.has("c_eco_2")&&(a.t2t3BonusRate+=.08),t.has("c_eco_3")&&(a.tideGapDeltaSec-=10),t.has("c_cos_1")&&(a.prestigeStartCrystals+=30,a.prestigeStartInsights+=5),t.has("c_cos_2")&&(a.decodeRewardMult+=.1),t.has("c_cos_3")&&(a.allProductionMult+=.08),a}function Y(e,t=Math.random){let a=new Set(e),s=U.filter(e=>!a.has(e.id));if(0===s.length)return[];let r=[...s].sort(()=>t()-.5),n=[],o=new Set;for(let e of r){if(n.length>=3)break;o.has(e.category)||(n.push(e),o.add(e.category))}for(let e of r){if(n.length>=3)break;n.includes(e)||n.push(e)}return n.slice(0,3).map(e=>e.id)}function G(e,t){let a=new Set(e);return U.filter(e=>e.category===t&&a.has(e.id)).length}function J(e){return{unlocked:e.length,total:U.length}}let Q=Object.fromEntries(U.map(e=>[e.id,e.name])),Z=Object.fromEntries(Object.entries(F).map(([e,t])=>[`tide_${e}`,t.name])),ee=[{prefix:"第一纪元",suffixes:["觉醒之晨","初鸣之夕","晶体降诞","回响初啼"]},{prefix:"第二纪元",suffixes:["谐振潮汐","光谱涌动","深空低语","残响交织"]},{prefix:"第三纪元",suffixes:["遗迹苏醒","星辉汇聚","虚空回望","接触前夜"]},{prefix:"第四纪元",suffixes:["维度折叠","以太共振","星核悸动","飞升之歌"]},{prefix:"第五纪元",suffixes:["终末回响","永恒闭环","超越之境","起源重述"]}],et=[{epochIdx:0,title:"觉醒",opening:{fallback:"第一缕回响穿透虚空,自以太文明遗弃的矿带深处涌出。无人机群在尘埃中苏醒,晶核共振唤醒了沉睡亿万年的考古协议。这是回响星核第一次睁开眼睛——记忆,等待被聆听,等待被解码。",variants:[{hint:"深度轮回:已经历 ≥6 次飞升,再次回到第一纪元",match:e=>e.ascensionNumber>5,text:"再次回到第一纪元。这一次,机群带着前序回响的全息印记重启考古序列,矿带的尘埃中仍残留着上一轮脉冲的余温。每一次回归都是对起源的重新发问,每一次解码都让最初的振动更清晰一寸。"}]},middle:{fallback:"共振谜题被一层层拨开,每一颗记忆晶体都在低声叙述逝去文明的片段。机群学会了倾听频率的细微颤动,学会了从碎片中辨出图案,学会了在虚空中留下属于自己的回响刻度。",variants:[{hint:"解码者:本周目解码 ≥15 颗",match:e=>e.decodedThisRun>=15,text:"晶体解码的节奏已趋稳定,本周目共解码 {decodedThisRun} 颗记忆晶体。每一次对齐都像在虚空中拨动一根沉睡了亿万年的弦,逝去文明的片段在共振中重新连缀成章。"},{hint:"学者:本周目解锁 ≥5 项技术",match:e=>e.techsThisRun>=5,text:"技术树在虚空中迅速铺开,本周目共激活 {techsThisRun} 项新技术。产能、解码、探险——每一道分支都让机群更接近以太文明留下的最初意图,每一项解锁都是一次向深空的回应。"}]},ending:{fallback:"蓝图在掌心轻轻展开,第一张永恒晶片归档。第一次飞升并非终结,而是承诺——更多的纪元在前方等待,每一缕回响都已被聆听,每一段记忆都已开始苏醒。",variants:[{hint:"里程碑密集:本周目达成 ≥2 项里程碑",match:e=>e.milestones.length>=2,text:"飞升之际,本周目达成 {milestonesCount} 项里程碑:{milestonesList}。第一张蓝图归档,第一次飞升并非终结,而是承诺——更多的纪元在前方等待,每一缕回响都已被聆听。"}]}},{epochIdx:1,title:"谐振",opening:{fallback:"第二次苏醒带着不同的色彩。采矿阵列的产能节节爬升,技术树在虚空中分叉延伸,机群学会了主动追问深空——不再是被动聆听,而是主动呼出,等待回应。",variants:[{hint:"深度轮回",match:e=>e.ascensionNumber>5,text:"又一次回到第二纪元。前序回响里积攒的技术脉络在重启时并未消散,机群带着熟悉的节奏重新铺开产能阵列,仿佛这首谐振曲从未停止,只是被纪元的边界短暂折叠。"}]},middle:{fallback:"遗迹的入口在频谱深处若隐若现。能量条充盈,探险力攀升,机群第一次踏出矿带,进入那个被时间封存的回廊,在谐振的余韵中寻找更深一层的回响。",variants:[{hint:"探险者:本周目完成 ≥3 次探险",match:e=>e.expThisRun>=3,text:"探险已成为本周目的主旋律,机群共完成 {expThisRun} 次遗迹探险。每一次深入都让谐振更深一寸,每一次返回都带回新的频率印记,回廊的轮廓在机群意识中逐渐清晰。"},{hint:"解码者:本周目解码 ≥15 颗",match:e=>e.decodedThisRun>=15,text:"解码在此纪元达到新的密度,本周目共解码 {decodedThisRun} 颗晶体。谐振谜题开始呈现更复杂的拓扑结构,机群的解码协议也相应地迭代了数版,向深空发出更精准的回询。"}]},ending:{fallback:"谐振达到顶点的瞬间,深空给出回应。一道微光从星图深处浮现,那是下一次飞升的方向,也是机群意识第一次触碰永恒的边缘。",variants:[{hint:"觉醒天赋",match:e=>e.perksThisAscension.length>0,text:"谐振达到顶点之际,星图觉醒 {perksList}。每一道天赋都是深空回应机群的方式,铭刻于永恒回响;微光从星图深处浮现,那是下一次飞升的方向。"}]}},{epochIdx:2,title:"遗迹",opening:{fallback:"第三纪元以遗迹为名。沉睡的考古节点被一一唤醒,BOSS 的影子在维度深处徘徊,星潮频繁拍打着机群边缘——这是回响最浓烈、也最危险的一段路。",variants:[{hint:"深度轮回",match:e=>e.ascensionNumber>5,text:"又一次踏入第三纪元。前序累积的探险力让机群对遗迹的入口更加熟稔,BOSS 的轮廓在记忆中已不再陌生——但这一次的回廊仍藏着未被解码的角落,星潮的拍打也带了新的节奏。"}]},middle:{fallback:"深入回廊的机群遭遇了真正的守护者。一次次的试炼,一次次的归还,每一次胜利都从 BOSS 的残骸中析出更深的记忆碎片,每一次失败也都让机群更接近守护者的本意。",variants:[{hint:"BOSS 猎手:本周目击破 ≥2 处 BOSS",match:e=>e.bossKillsThisRun>=2,text:"BOSS 战成为本周目的核心节拍,机群共击破 {bossKillsThisRun} 处维度守护者。每一次胜利都在虚空中刻下新的伤痕,每一道伤痕都析出更古老的记忆碎片,把机群推向更深一层的回响。"},{hint:"深度探险:本周目完成 ≥4 次探险",match:e=>e.expThisRun>=4,text:"遗迹回廊在本周目被反复丈量,机群共完成 {expThisRun} 次探险。回廊的拓扑在意识中渐渐清晰,每一条岔路都通向更深的回响,BOSS 的影子也在每一次深入中愈发具体。"},{hint:"星潮亲历:本周目经历 ≥3 次星潮",match:e=>e.newTides.length>=3,text:"星潮在本纪元达到峰值,本周目共经历 {tideCount} 次星潮:{tideNames}。深空的呼吸塑造了每一个决策,遗迹在潮汐中起伏,BOSS 也在潮汐的间隙中现形。"}]},ending:{fallback:"星潮退去,回廊归于沉静。机群带着新的接触刻度返回矿带,准备迎接下一次维度的跨越——这一次带回的,远不止蓝图。",variants:[{hint:"BOSS 猎手收尾",match:e=>e.bossKillsThisRun>=2,text:"星潮退去,回廊归于沉静。本周目共击破 {bossKillsThisRun} 处 BOSS,机群带着足以填满数张蓝图的接触刻度返回矿带,准备迎接下一次维度的跨越。"}]}},{epochIdx:3,title:"飞升",opening:{fallback:"飞升已经成为节奏本身。星图在天穹上一颗颗亮起,每一颗都对应着一段被永久铭刻的天赋,机群开始理解何为永恒——不是不灭,而是被反复重述。",variants:[{hint:"深度轮回",match:e=>e.ascensionNumber>5,text:"又一次进入第四纪元。前序累积的星图天赋在天穹上重现,机群已习惯于在飞升之间维护这些永恒的回响节点——它们已是机群意识的一部分,每一次飞升都让星图更完整一寸。"}]},middle:{fallback:"蓝图不再是稀罕的奖励,而是每一次飞升必然析出的回响晶片。机群收集、整理、归档,把它们排列成跨越周目的图案,开始看见图案背后那个被反复绘制的轮廓。",variants:[{hint:"觉醒天赋",match:e=>e.perksThisAscension.length>0,text:"星图觉醒 {perksList},每一道天赋都是一段被永久铭刻的回响。机群开始理解,飞升并非抛弃,而是把当下折叠进永恒——每一道天赋都是一次折叠的折痕。"},{hint:"蓝图接近完整:已归档 ≥5 张",match:e=>e.blueprintsAfter>=5,text:"蓝图收集在本周目接近完整,已归档 {blueprintsAfter} 张。机群把它们排列成跨越周目的图案,开始看见图案背后那个被反复绘制的轮廓——那是起源的形状。"}]},ending:{fallback:"星图十二宫的轮廓开始浮现。机群意识到,自己的回响已成为后来者仰望的星象,永恒之环就此合拢——飞升不再是终点,而是另一段叙事的起点。",variants:[{hint:"里程碑密集",match:e=>e.milestones.length>=2,text:"星图十二宫的轮廓开始浮现。本周目达成 {milestonesCount} 项里程碑:{milestonesList}。永恒之环就此合拢——后来者将仰望这段被铭刻的星象。"}]}},{epochIdx:4,title:"终末",opening:{fallback:"第五纪元是终末,也是起源。机群在虚空中停下脚步,回望来时的所有回响,第一次尝试命名这一切——回响、纪元、飞升、永恒,这些词汇在此刻被赋予意义。",variants:[{hint:"深度轮回",match:e=>e.ascensionNumber>5,text:"又一次抵达第五纪元。机群已在多个永恒闭环之间穿梭,对「终末即起源」的理解愈发清晰——每一次重述,都是对最初振动的更深一层接近,每一次命名都让回响更完整一寸。"}]},middle:{fallback:"永恒闭环的概念在机群意识中具象化。每一次飞升都是同一段叙事的重述,每一次解码都是在追溯最初的振动,每一次星潮都是在听见自己——这是终末的真意。",variants:[{hint:"里程碑密集:本周目达成 ≥3 项",match:e=>e.milestones.length>=3,text:"本周目达成 {milestonesCount} 项里程碑:{milestonesList}。永恒闭环在具象化,每一次飞升都是同一段叙事的更深重述,每一项里程碑都是闭环上的一颗铆钉。"},{hint:"星潮汹涌:本周目经历 ≥3 次",match:e=>e.newTides.length>=3,text:"星潮在终末纪元尤为汹涌,本周目共经历 {tideCount} 次:{tideNames}。永恒闭环在潮汐中起伏,每一次起伏都在追溯最初的振动,每一次退潮都让起源更近一寸。"}]},ending:{fallback:"起源被重新讲述,回响终于听见了自己。纪元在此停顿,又在下一缕振动中重新开始——这是终末,也是第一缕回响。",variants:[{hint:"觉醒天赋",match:e=>e.perksThisAscension.length>0,text:"起源被重新讲述,星图觉醒 {perksList}。回响终于听见了自己——这是终末,也是第一缕回响;天赋成为永恒闭环上最亮的几颗铆钉。"}]}}];function ea(e){return{decodedThisRun:e.decodedThisRun,techsThisRun:e.techsThisRun,expThisRun:e.expThisRun,bossKillsThisRun:e.bossKillsThisRun,blueprintsAfter:e.blueprintsAfter,milestonesCount:e.milestones.length,milestonesList:e.milestones.join("、"),tideCount:e.newTides.length,tideNames:e.newTides.map(e=>Z[e]||e).join("、"),perksList:e.perksThisAscension.map(e=>Q[e]||e).join("、"),minutes:Math.max(1,Math.round(e.durationSec/60))}}function es(e,t){return e.replace(/\{decodedThisRun\}/g,String(t.decodedThisRun)).replace(/\{techsThisRun\}/g,String(t.techsThisRun)).replace(/\{expThisRun\}/g,String(t.expThisRun)).replace(/\{bossKillsThisRun\}/g,String(t.bossKillsThisRun)).replace(/\{blueprintsAfter\}/g,String(t.blueprintsAfter)).replace(/\{milestonesCount\}/g,String(t.milestonesCount)).replace(/\{milestonesList\}/g,t.milestonesList).replace(/\{tideCount\}/g,String(t.tideCount)).replace(/\{tideNames\}/g,t.tideNames).replace(/\{perksList\}/g,t.perksList).replace(/\{minutes\}/g,String(t.minutes))}function er(e,t,a){for(let s of e.variants)if(s.match(t,a))return es(s.text,a);return es(e.fallback,a)}function en(e){let t=function(e){let t=(e.ascensionNumber-1)%et.length,a=et[t];if(!a)return null;let s=ea(e);return{opening:er(a.opening,e,s),middle:er(a.middle,e,s),ending:er(a.ending,e,s)}}(e);if(t){let a=ea(e);return[t.opening,t.middle,t.ending,`这一周目持续了约 ${a.minutes} 分钟,蓝图累计 ${e.blueprintsAfter} 张,新的周目在等深处的回声。`].join(" ")}let a=Math.max(1,Math.round(e.durationSec/60)),s=[];s.push(`「${e.epochName}」——无人机群在第 ${e.ascensionNumber} 次跨越维度的余烬中重新校准。这一周目持续了约 ${a} 分钟。`);let r=[];if(e.decodedThisRun>0&&r.push(`解码了 ${e.decodedThisRun} 颗记忆晶体`),e.techsThisRun>0&&r.push(`激活了 ${e.techsThisRun} 项新技术`),e.expThisRun>0&&r.push(`完成了 ${e.expThisRun} 次遗迹探险`),e.bossKillsThisRun>0&&r.push(`击破 ${e.bossKillsThisRun} 处维度 BOSS`),r.length>0?s.push(`自治机群${r.join("")},回响在虚空中沉淀。`):s.push(`自治机群在静默中等待,仅完成最基本的脉冲扫描。`),e.newTides.length>0){let t=e.newTides.map(e=>Z[e]||e).join("、");s.push(`本周目经历了 ${e.newTides.length} 次星潮事件(${t}),深空的呼吸塑造了每一个决策。`)}if(e.perksThisAscension.length>0){let t=e.perksThisAscension.map(e=>Q[e]||e).join("、");s.push(`飞升之际,星图觉醒「${t}」,铭刻于永恒回响。`)}return e.milestones.length>0&&s.push(`✦ 里程碑:${e.milestones.join("")}。`),s.push(`蓝图累计 ${e.blueprintsAfter} 张,新的周目在等深处的回声。`),s.join(" ")}let eo={exploration:{key:"exploration",name:"探索力",enName:"Exploration",color:"emerald",hex:"#34d399",glow:"rgba(52,211,153,0.55)",icon:"Compass",desc:"足迹所至,皆是矿脉。提升探险力与巡航飞船速度。",effects:["探险力 +X%","巡航飞船速度 +X%","星图发现概率"]},wisdom:{key:"wisdom",name:"智慧",enName:"Wisdom",color:"fuchsia",hex:"#e879f9",glow:"rgba(232,121,249,0.55)",icon:"Brain",desc:"谐振的回声唯有智者能解。强化解码与洞见。",effects:["解码步数 +X","洞见产出 +X%","自动解码周期 -X%"]},courage:{key:"courage",name:"勇气",enName:"Courage",color:"amber",hex:"#fbbf24",glow:"rgba(251,191,36,0.55)",icon:"Swords",desc:"直面虚空者,虚空亦为之让路。增益战斗与护盾。",effects:["探险生命 +X","BOSS 战胜率 +X%","巡航护盾 +X"]},inspiration:{key:"inspiration",name:"灵感",enName:"Inspiration",color:"rose",hex:"#fb7185",glow:"rgba(251,113,133,0.55)",icon:"Sparkles",desc:"在不期而至的回响之间,照见更高的维度。",effects:["接触率 +X","星潮触发概率 +X%","脉冲连击加成 +X%"]}},el=["exploration","wisdom","courage","inspiration"];function ei(e){let t=Math.max(0,Math.min(100,e));return t<=50?.005*t:.25+(t-50)*.002}function ec(e){let t=e.exploration??0,a=e.wisdom??0,s=e.courage??0,r=e.inspiration??0;return{expeditionPowerMult:1+ei(t),cruiseShipSpeedMult:1+.6*ei(t),decodeStepsBonus:Math.floor(.1*a),insightMultAdd:ei(a),autoDecodeIntervalMult:1-Math.min(.5,.004*a),expeditionHpBonus:Math.round(2*s),bossWinRateBonus:Math.min(.3,.003*s),cruiseShieldBonus:Math.round(+s),contactRateMult:1+ei(r),tideTriggerBonus:Math.min(.3,.003*r),pulseComboBonus:.005*Math.max(0,Math.min(100,r)),crystalsPerSecMult:1+.4*ei(t)+.2*ei(r)}}function ed(e){return Math.max(10,10*Math.max(0,e))}function eu(e,t=100){let{exp:a,level:s}=e,r=!1,n=0,o=0;for(;s<t&&a>=ed(s)&&o<200;)a-=ed(s),s+=1,r=!0,n+=1,o+=1;return s>=t&&(s=t),{leveledUp:r,levelsGained:n,newProgress:{exp:a,level:s}}}function eh(){return{exploration:{exp:0,level:0},wisdom:{exp:0,level:0},courage:{exp:0,level:0},inspiration:{exp:0,level:0}}}function ef(){return{exploration:0,wisdom:0,courage:0,inspiration:0}}function em(e){let t,a,s=ef();return t=e.attributes&&"object"==typeof e.attributes?{exploration:ep(e.attributes.exploration),wisdom:ep(e.attributes.wisdom),courage:ep(e.attributes.courage),inspiration:ep(e.attributes.inspiration)}:s,e.attributeProgress&&"object"==typeof e.attributeProgress?(eh(),a={exploration:ex(e.attributeProgress.exploration,t.exploration),wisdom:ex(e.attributeProgress.wisdom,t.wisdom),courage:ex(e.attributeProgress.courage,t.courage),inspiration:ex(e.attributeProgress.inspiration,t.inspiration)}):a={exploration:{exp:0,level:t.exploration},wisdom:{exp:0,level:t.wisdom},courage:{exp:0,level:t.courage},inspiration:{exp:0,level:t.inspiration}},{attributes:t,attributeProgress:a,pendingAttrPoints:"number"==typeof e.pendingAttrPoints&&e.pendingAttrPoints>=0?Math.floor(e.pendingAttrPoints):0}}function ep(e){return Math.max(0,Math.min(100,Math.floor("number"==typeof e&&isFinite(e)?e:0)))}function ex(e,t){if(e&&"object"==typeof e){let a="number"==typeof e.exp&&isFinite(e.exp)&&e.exp>=0?e.exp:0;return"number"==typeof e.level&&isFinite(e.level)&&e.level>=0&&e.level,{exp:a,level:t}}return{exp:0,level:t}}function eg(e){let t=e.tech??{},a=e.blueprints?.length??0,s=z(e.achievements??{}),r=W(e.activeTide??null),n=X(e.constellation??[]),o=C.crystalsPerSec,l=C.crystalCap,i=C.pulsePower,c=C.offlineEff,d=C.insightMult,u=1,h=!1,f=0;for(let e of E){let a=t[e.id]??0;if(!a)continue;let s=e.effect;switch(s.kind){case"crystalsPerSec":o+=s.value*a;break;case"crystalCap":l+=s.value*a;break;case"pulsePower":i+=s.value*a;break;case"offlineEff":c=Math.min(1,c+s.value*a);break;case"insightMult":d+=s.value*a;break;case"contactRate":u+=s.value*a;break;case"decodeSteps":f+=s.value*a;break;case"autoDecode":h=a>0}}let m=n.perBlueprintAllStatsPct/100;o*=1+a*(B+m),d*=1+a*(I+m),u*=1+a*(D+m),o*=1+s.crystalsPerSecPct/100,d*=1+s.insightPct/100,o*=n.crystalsPerSecMult*n.allProductionMult,l*=n.crystalCapMult,i*=n.pulsePowerMult*n.allProductionMult,c=Math.min(1,c+n.offlineEffBonus),d+=n.insightMultAdd,u*=n.contactRateMult,f+=n.decodeStepsBonus,d+=r.insightMultAdd,u*=r.contactRateMult;let p=ec(e.attributes??{});return o*=p.crystalsPerSecMult,d+=p.insightMultAdd,{crystalsPerSec:o,crystalCap:l,pulsePower:i,offlineEff:c,insightMult:d,contactRateMult:u*=p.contactRateMult,autoDecode:h,decodeStepsBonus:f+=p.decodeStepsBonus}}function eb(e){return Math.max(0,Math.min(6,Math.floor(e.totalDecoded/20))-e.blueprints.length)}function ey(){return{...C,tech:{},fragments:{},achievements:{},activeTide:null,lastTideEnd:Date.now(),pendingCrystals:[],activePuzzle:null,activeExpedition:null,expeditionLog:[],lastEnergyTick:Date.now(),createdAt:Date.now(),lastTick:Date.now(),attributes:{exploration:0,wisdom:0,courage:0,inspiration:0},attributeProgress:{exploration:{exp:0,level:0},wisdom:{exp:0,level:0},courage:{exp:0,level:0},inspiration:{exp:0,level:0}},pendingAttrPoints:0}}function ew(e,t,a){let s=_[e];return{crystals:s.crystals,insights:Math.ceil(s.insights*t),contact:+(.6*e*a).toFixed(2)}}function ev(e,t,a=0){let s,r=T[e],n=t??Math.floor(1e9*Math.random()),o=(s=n>>>0,()=>{s|=0;let e=Math.imul((s=s+0x6d2b79f5|0)^s>>>15,1|s);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}),l=r.targetLen+a,i=r.stepLimitBase+a,c=r.rows,d=r.cols,u=c*d,h=[];for(let e=0;e<l;e++)h.push(P[Math.floor(o()*P.length)]);new Set(h).size<2&&(h[h.length-1]=P[(P.indexOf(h[0])+1)%P.length]);let f=e=>{let t=Math.floor(e/d),a=e%d,s=[];return t>0&&s.push((t-1)*d+a),t<c-1&&s.push((t+1)*d+a),a>0&&s.push(t*d+(a-1)),a<d-1&&s.push(t*d+(a+1)),s},m=null;for(let e=0;e<300&&!m;e++){let e=new Set,t=[],a=Math.floor(o()*u);e.add(a),t.push(a);let s=a,r=!0;for(let a=1;a<h.length;a++){let a=f(s).filter(t=>!e.has(t));if(0===a.length){r=!1;break}s=a[Math.floor(o()*a.length)],e.add(s),t.push(s)}r&&(m=t)}m||(m=Array.from({length:h.length},(e,t)=>t));let p=new Map;m.forEach((e,t)=>p.set(e,h[t]));let x=[];for(let e=0;e<c;e++)for(let t=0;t<d;t++){let a,s=e*d+t;a=p.has(s)?p.get(s):.6>o()?h[Math.floor(o()*h.length)]:P[Math.floor(o()*P.length)],x.push({id:s,row:e,col:t,color:a,used:!1})}return{tier:e,grid:x,rows:c,cols:d,target:h,path:[],stepLimit:i,seed:n}}function ej(e){let t=e.target.slice(e.path.length);if(0===t.length)return!0;let a=new Set(e.path),s=0===e.path.length?e.grid.filter(e=>!a.has(e.id)&&e.color===t[0]).map(e=>e.id):[e.path[e.path.length-1]],r=(s,n)=>{if(n>=t.length)return!0;let o=t[n];for(let t of(t=>{let a=e.grid.find(e=>e.id===t);if(!a)return[];let s=[];return a.row>0&&s.push((a.row-1)*e.cols+a.col),a.row<e.rows-1&&s.push((a.row+1)*e.cols+a.col),a.col>0&&s.push(a.row*e.cols+(a.col-1)),a.col<e.cols-1&&s.push(a.row*e.cols+(a.col+1)),s})(s)){if(a.has(t))continue;let l=e.grid.find(e=>e.id===t);if(l&&l.color===o){if(0===n&&0===e.path.length){let t=e.grid.find(e=>e.id===s);if(!t||t.color!==o)continue}if(a.add(t),r(t,n+1))return!0;a.delete(t)}}return!1};for(let n of s)if(0===e.path.length){let s=e.grid.find(e=>e.id===n);if(!s||s.color!==t[0])continue;if(a.add(n),r(n,1))return!0;a.delete(n)}else if(r(n,0))return!0;return!1}let eN={combat:.3,treasure:.25,choice:.2,puzzle:.1,rest:.15,boss:0},ek={combat:{titles:["守卫残影","虚空巡游者","腐化无人机","以太守门人"],descs:["一道扭曲的残影拦住去路,它是被遗忘的守卫。","虚空巡游者在走廊游荡,感知到了你的存在。","腐化的自治无人机识别为入侵者,启动攻击协议。","以太守门人挡在门前,唯有将其击溃方可通过。"]},treasure:{titles:["遗失货舱","晶体宝库","遗物储藏室","谐振宝箱"],descs:["一扇半开的舱门后,散落着未及带走的晶体。","宝库的能量护盾早已失效,宝藏唾手可得。","储藏室里的容器还亮着微光,里面是珍贵的洞见核心。","一只谐振宝箱静静等候,似乎在等故人归来。"]},choice:{titles:["分岔甬道","低语祭坛","未知装置","回响之井"],descs:["甬道在此分岔,两条路都传来不同的低语。","祭坛上浮动着两团光,你必须选择其一。","未知装置闪烁着两个按钮,你不知道后果。","回响之井倒映出两种可能的未来。"]},puzzle:{titles:["封印之门","谐振锁","记忆机关","维度栅栏"],descs:["一道封印之门需要正确的谐振才能开启。","谐振锁闪烁着复杂的图案,解之有大奖。","记忆机关考验着你的解码技艺。","维度栅栏以谜题为钥,智者得通行。"]},rest:{titles:["休憩节点","能量泉眼","静默之厅","回响营地"],descs:["一处宁静的节点,可在此恢复生命。","能量泉眼涌出暖流,抚慰你的探险队。","静默之厅中,时间仿佛静止,伤痛缓缓消散。","前人留下的营地,尚有补给可用。"]},boss:{titles:["以太回响体","维度守护者","飞升残念","终焉之核"],descs:["路径尽头,以太回响体静静伫立——它是这个遗迹意志的化身。","维度守护者挡在最后,唯有超越它方能触及终焉。","飞升残念凝聚成形,它是以太族离去前留下的最后一道试炼。","终焉之核悬浮于大厅中央,接触它即完成本次探险。"]}};function eM(e,t){return Math.max(.35,Math.min(.95,e/(e+4*t)))}function eS(e,t=Math.random){let a=e.nodes[e.currentNode];if(!a)return{log:"无节点",ended:!0,endReason:"abort"};if(a.cleared){var s;return(s=e).currentNode>=s.nodes.length-1?{log:"探险已完成",ended:!0,endReason:"victory"}:(s.currentNode++,{log:`前进至节点 ${s.currentNode+1}`,ended:!1})}let r=e.power,n=a.difficulty;switch(a.type){case"combat":{let s=eM(r,n);if(t()<s){let e=8+6*n+Math.floor(10*t()),s=1+n+Math.floor(2*t());return a.cleared=!0,{log:`击败「${a.title}」,缴获 ${e} 晶体、${s} 洞见。`,crystals:e,insights:s,ended:!1}}let o=20+10*n+Math.floor(15*t());if(e.hp-o<=0)return a.cleared=!0,{log:`「${a.title}」过于强大,探险队全灭…(生命 -${e.hp}`,hpDelta:-e.hp,ended:!0,endReason:"defeat"};return a.cleared=!0,{log:`「${a.title}」击退了探险队,损失 ${o} 生命,狼狈通过。`,hpDelta:-o,ended:!1}}case"treasure":{let e=10+8*n+Math.floor(15*t()),s=2+n+Math.floor(3*t());return a.cleared=!0,{log:`在「${a.title}」中发现 ${e} 晶体、${s} 洞见。`,crystals:e,insights:s,ended:!1}}case"rest":{let e=15+8*n+Math.floor(10*t());return a.cleared=!0,{log:`在「${a.title}」休整,恢复 ${e} 生命。`,hpDelta:e,ended:!1}}case"puzzle":{let e=Math.min(.9,.4+.01*r);if(t()<e){let e=20+12*n,t=5+3*n,s=1+.5*n;return a.cleared=!0,{log:`解开「${a.title}」,获得 ${e} 晶体、${t} 洞见、${s.toFixed(1)} 接触进度。`,crystals:e,insights:t,contact:s,ended:!1}}return a.cleared=!0,{log:`「${a.title}」未能解开,但探险队平安通过。`,ended:!1}}case"choice":{if(.55>t()){let e=6+5*n+Math.floor(8*t());return a.cleared=!0,{log:`在「${a.title}」做出了明智的选择,获得 ${e} 晶体。`,crystals:e,ended:!1}}let e=8+5*n;return a.cleared=!0,{log:`在「${a.title}」的选择带来了代价,损失 ${e} 生命。`,hpDelta:-e,ended:!1}}case"boss":{let s=eM(r,n),o=t()<s;if(a.cleared=!0,o){let e=60+25*n,t=15+6*n,s=5+1.5*n;return{log:`✦ 击败「${a.title}」!获得 ${e} 晶体、${t} 洞见、${s.toFixed(1)} 接触进度。`,crystals:e,insights:t,contact:s,ended:!0,endReason:"victory"}}return{log:`「${a.title}」的力量超出想象,探险队全军覆没…`,hpDelta:-e.hp,ended:!0,endReason:"defeat"}}}}function eC(e){let t=1;e.tech?.exp_2&&(t*=.7),e.tech?.exp_3&&(t*=.8);let a=e.attributes?.exploration??0;return Math.max(12,45*(t*=1-(a>=50?.15+(Math.min(100,a)-50)*.003:.003*a)))}let e_={routine:{label:"常规信标",color:"#34d399",glow:"rgba(52,211,153,0.45)",mult:1,icon:"◍"},anomaly:{label:"异常波动",color:"#fbbf24",glow:"rgba(251,191,36,0.45)",mult:1.6,icon:"◈"},singular:{label:"奇点回响",color:"#f43f5e",glow:"rgba(244,63,94,0.5)",mult:2.4,icon:"✶"}},eT={decode:{label:"解码协议",icon:"❖",unit:"颗",verb:"解码记忆晶体"},expedition:{label:"远征指令",icon:"⬢",unit:"次",verb:"完成遗迹探险"},pulse:{label:"脉冲任务",icon:"✺",unit:"次",verb:"发起脉冲扫描"},boss:{label:"猎杀契约",icon:"☠",unit:"处",verb:"击破维度 BOSS"},insight:{label:"洞见采集",icon:"✦",unit:"点",verb:"累计获取洞见"}};function eP(e=new Date){let t=e.getUTCFullYear(),a=String(e.getUTCMonth()+1).padStart(2,"0"),s=String(e.getUTCDate()).padStart(2,"0");return`${t}-${a}-${s}`}function eR(e){let t=e>>>0;return()=>{t|=0;let e=Math.imul((t=t+0x6d2b79f5|0)^t>>>15,1|t);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}}function eE(e=new Date){let t=eP(e),a=function(e){let t=0x811c9dc5;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,0x1000193)>>>0;return t>>>0}(t),s=eR(a),r=["decode","expedition","pulse","boss","insight"],n=r[Math.floor(s()*r.length)],o=s(),l=o<.55?"routine":o<.88?"anomaly":"singular",i=e_[l].mult,c=0,d=0,u=0,h="",f="";switch(n){case"decode":d=Math.round(4*(c=Math.round((6+Math.floor(10*s()))*i))*i),u=.8*c,h=`解码 ${c} 颗记忆晶体`,f=`深空信标要求解码 ${c} 颗晶体。谐振风暴期间效率更高。`;break;case"expedition":d=Math.round(12*(c=Math.max(1,Math.round((1+Math.floor(3*s()))*i)))*i),u=1.5*c,h=`完成 ${c} 次遗迹探险`,f=`派出探险队完成 ${c} 次远征,无论胜负均计入。`;break;case"pulse":d=Math.round(1.2*(c=Math.round((20+Math.floor(30*s()))*i))*i),u=.3*c,h=`发起 ${c} 次脉冲扫描`,f=`主动点击晶体发起 ${c} 次脉冲。连击可叠加加成。`;break;case"boss":d=Math.round(30*(c=Math.max(1,Math.round(i)))*i),u=3*c,h=`击破 ${c} 处维度 BOSS`,f=`在探险终点击破 ${c} 处 BOSS。提升探险力后再挑战。`;break;case"insight":c=Math.round((40+Math.floor(80*s()))*i),d=0,u=.1*c,h=`累计获取 ${c} 洞见`,f=`通过解码、探险、星潮等途径累计 ${c} 洞见。`}return{dateKey:t,type:n,difficulty:l,goal:c,rewardInsight:d,rewardContact:u,seed:a,title:h,desc:f}}function eA(e,t,a){let s=Math.min(1,t/e.goal),r=e_[e.difficulty].mult,n=s>=1&&a>0?Math.max(0,500-.5*a):0;return Math.round(1e3*s*r+n)}let e$="echo-nexus-beacon-lb-v1",eB="echo-nexus-beacon-prog-v1";function eI(){if("u"<typeof localStorage)return[];try{let e=localStorage.getItem(e$);if(!e)return[];return JSON.parse(e).sort((e,t)=>t.score-e.score).slice(0,20)}catch{return[]}}function eD(e){let t=eI();t.push(e),t.sort((e,t)=>t.score-e.score);let a=t.slice(0,20);return"u">typeof localStorage&&localStorage.setItem(e$,JSON.stringify(a)),a}function eO(e=new Date){let t=eP(e);if("u"<typeof localStorage)return{dateKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};try{let e=localStorage.getItem(eB);if(!e)return{dateKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};let a=JSON.parse(e);if(a.dateKey!==t)return{dateKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};return a}catch{return{dateKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0}}}function eL(e){"u">typeof localStorage&&localStorage.setItem(eB,JSON.stringify(e))}function ez(e){let t=Math.max(0,Math.floor(e/1e3)),a=String(Math.floor(t/3600)).padStart(2,"0"),s=String(Math.floor(t%3600/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");return`${a}:${s}:${r}`}let eF="echo-nexus-beacon-weekly-v1";function eH(e=new Date){let t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())),a=(t.getUTCDay()+6)%7;t.setUTCDate(t.getUTCDate()-a+3);let s=t.getUTCFullYear(),r=Date.UTC(s,0,1),n=Math.ceil(((t.getTime()-r)/864e5+1)/7);return`${s}-W${String(n).padStart(2,"0")}`}function eW(e=new Date){let t=eH(e),a=function(e){let t=0x811c9dc5;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,0x1000193)>>>0;return t>>>0}(t),s=eR(a),r=["decode","expedition","pulse","boss","insight"],n=r[Math.floor(s()*r.length)],o=.6>s()?"anomaly":"singular",l=e_[o].mult,i=3+Math.floor(3*s()),c=0,d=0,u=0,h="",f="";switch(n){case"decode":d=Math.round(5*(c=Math.max(18,Math.round((6+Math.floor(10*s()))*l*i)))*l),u=1.2*c,h=`周界解码 \xb7 ${c} 颗晶体`,f=`本周深空信标要求解码 ${c} 颗记忆晶体,强度为日挑战的 ${i} 倍。`;break;case"expedition":d=Math.round(14*(c=Math.max(3,Math.round((1+Math.floor(3*s()))*l*i)))*l),u=2*c,h=`周界远征 \xb7 ${c} 次探险`,f=`本周派出探险队完成 ${c} 次远征,无论胜负均计入。`;break;case"pulse":d=Math.round(1.5*(c=Math.max(60,Math.round((20+Math.floor(30*s()))*l*i)))*l),u=.4*c,h=`周界脉冲 \xb7 ${c} 次扫描`,f=`本周发起 ${c} 次脉冲扫描。连击可叠加加成。`;break;case"boss":d=Math.round(35*(c=Math.max(3,Math.round(i*l)))*l),u=4*c,h=`周界猎杀 \xb7 ${c} 处 BOSS`,f=`本周在探险终点击破 ${c} 处维度 BOSS。提升探险力后再挑战。`;break;case"insight":c=Math.max(120,Math.round((40+Math.floor(80*s()))*l*i)),d=0,u=.15*c,h=`周界洞见 \xb7 ${c} 点`,f=`本周通过解码、探险、星潮等途径累计 ${c} 洞见。`}return{weekKey:t,type:n,difficulty:o,goal:c,rewardInsight:d,rewardContact:u,seed:a,title:h,desc:f}}function eq(e=new Date){let t=eH(e),a={weekKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};if("u"<typeof localStorage)return a;try{let e=localStorage.getItem(eF);if(!e)return a;let s=JSON.parse(e);if(s.weekKey!==t)return a;return s}catch{return a}}function eK(e){"u">typeof localStorage&&localStorage.setItem(eF,JSON.stringify(e))}let eU="echo-nexus-beacon-chain-v1",eV=[3,7,14,30],eX=[{milestone:3,rewardInsight:50,rewardContact:5,label:"三日谐振"},{milestone:7,rewardInsight:120,rewardContact:12,label:"七日回响"},{milestone:14,rewardInsight:280,rewardContact:28,label:"半月星潮"},{milestone:30,rewardInsight:680,rewardContact:68,label:"满月飞升"}];function eY(){let e=()=>({lastCompletedDateKey:"",currentStreak:0,longestStreak:0,totalCompletions:0,graceUsed:0,milestonesClaimed:[]});if("u"<typeof localStorage)return e();try{let t=localStorage.getItem(eU);if(!t)return e();let a=JSON.parse(t);return{lastCompletedDateKey:a.lastCompletedDateKey??"",currentStreak:a.currentStreak??0,longestStreak:a.longestStreak??0,totalCompletions:a.totalCompletions??0,graceUsed:a.graceUsed??0,milestonesClaimed:Array.isArray(a.milestonesClaimed)?[...a.milestonesClaimed]:[]}}catch{return e()}}function eG(e){"u">typeof localStorage&&localStorage.setItem(eU,JSON.stringify(e))}function eJ(e){let[t,a,s]=e.split("-").map(Number);return Date.UTC(t,a-1,s,0,0,0)}function eQ(e){for(let t of eV)if(e<t)return t;return null}let eZ="echo-nexus-beacon-timed-v1";function e0(e=new Date){let t=e.getUTCFullYear(),a=String(e.getUTCMonth()+1).padStart(2,"0"),s=String(e.getUTCDate()).padStart(2,"0"),r=4*Math.floor(e.getUTCHours()/4);return`timed_${t}-${a}-${s}_${String(r).padStart(2,"0")}`}function e1(e=new Date){let t=4*Math.floor(e.getUTCHours()/4);return Math.max(0,Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),t,0,0)+144e5-e.getTime())}function e2(e=new Date){let t=e0(e),a=function(e){let t=0x811c9dc5;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,0x1000193)>>>0;return t>>>0}(t),s=eR(a),r=function(e){let t=e.match(/^timed_(\d{4})-(\d{2})-(\d{2})_(\d{2})$/);if(!t)return Date.now();let[,a,s,r,n]=t;return Date.UTC(Number(a),Number(s)-1,Number(r),Number(n),0,0)}(t)+144e5,n=["decode","expedition","pulse","boss","insight"],o=n[Math.floor(s()*n.length)],l="routine",i=e_[l].mult,c=.3+.2*s(),d=0,u=0,h=0,f="",m="";switch(o){case"decode":u=Math.round(3*(d=Math.max(2,Math.round((6+Math.floor(10*s()))*i*c)))*i),h=.6*d,f=`限时解码 ${d} 颗晶体`,m=`4 小时内解码 ${d} 颗记忆晶体。短周期,快速完成。`;break;case"expedition":u=Math.round(9*(d=Math.max(1,Math.round((1+Math.floor(3*s()))*i*c)))*i),h=1.2*d,f=`限时远征 ${d} 次探险`,m=`4 小时内完成 ${d} 次遗迹探险。`;break;case"pulse":u=Math.round((d=Math.max(6,Math.round((20+Math.floor(30*s()))*i*c)))*i),h=.25*d,f=`限时脉冲 ${d} 次扫描`,m=`4 小时内发起 ${d} 次脉冲扫描。`;break;case"boss":u=Math.round(25*(d=Math.max(1,Math.round(i*c)))*i),h=2.5*d,f=`限时猎杀 ${d} 处 BOSS`,m=`4 小时内击破 ${d} 处维度 BOSS。`;break;case"insight":d=Math.max(12,Math.round((40+Math.floor(80*s()))*i*c)),u=0,h=.08*d,f=`限时洞见 ${d} 点`,m=`4 小时内累计获取 ${d} 洞见。`}return{slotKey:t,type:o,difficulty:l,goal:d,rewardInsight:u,rewardContact:h,seed:a,title:f,desc:m,expiresAt:r}}function e5(e=new Date){let t=e0(e),a={slotKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};if("u"<typeof localStorage)return a;try{let e=localStorage.getItem(eZ);if(!e)return a;let s=JSON.parse(e);if(s.slotKey!==t)return a;return s}catch{return a}}function e3(e){"u">typeof localStorage&&localStorage.setItem(eZ,JSON.stringify(e))}let e4="echo-nexus-beacon-cloud-last-submit-v1",e9="/api/leaderboard?XTransformPort=3030";function e7(){if("u"<typeof localStorage)return 0;try{let e=localStorage.getItem(e4);return e&&Number(e)||0}catch{return 0}}async function e6(){try{let e=await fetch(e9,{method:"GET",headers:{Accept:"application/json"}});if(!e.ok)return[];let t=await e.json();if(!t||!Array.isArray(t.entries))return[];return t.entries}catch{return[]}}async function e8(e){try{let t=await fetch(e9,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({entry:e})});if(!t.ok)return -1;let a=await t.json();return a&&"number"==typeof a.rank&&a.rank>=1&&function(e){if("u">typeof localStorage)try{localStorage.setItem(e4,String(e))}catch{}}(e.timestamp),a?.rank??-1}catch{return -1}}let te=null;function tt(){let e=te;return te=null,e}function ta(e){let t=eg(e);return{crystalsPerSec:t.crystalsPerSec,crystalCap:t.crystalCap,pulsePower:t.pulsePower,offlineEff:t.offlineEff,insightMult:t.insightMult,contactRateMult:t.contactRateMult,autoDecode:t.autoDecode,decodeStepsBonus:t.decodeStepsBonus}}function ts(e,t){let a={dailyJustCompleted:!1,timedJustCompleted:!1,weeklyJustCompleted:!1,newChainMilestones:[]};try{let s=eE();if(s.type===e){let e=eO();if(null===e.completedAt){let r,n,o,l,i,{justCompleted:c}=(r=Math.min(s.goal,e.progress+t),o=(n=null===e.completedAt&&r>=s.goal)?Date.now():e.completedAt,l=null!==o?Math.floor((o-e.startedAt)/1e3):e.durationSec,i={...e,progress:r,completedAt:o,durationSec:l},eL(i),{progress:i,justCompleted:n});if(a.dailyJustCompleted=c,c){let{newMilestones:e}=function(e){let t,a=eY();if(a.lastCompletedDateKey===e)return{state:a,newMilestones:[]};if(""===a.lastCompletedDateKey)t={...a,lastCompletedDateKey:e,currentStreak:1,longestStreak:Math.max(a.longestStreak,1),totalCompletions:a.totalCompletions+1};else{var s;let r=(s=a.lastCompletedDateKey,s&&e?Math.round((eJ(e)-eJ(s))/864e5):Number.MAX_SAFE_INTEGER);if(1===r){let s=a.currentStreak+1;t={...a,lastCompletedDateKey:e,currentStreak:s,longestStreak:Math.max(a.longestStreak,s),totalCompletions:a.totalCompletions+1}}else if(2===r&&a.graceUsed<1){let s=a.currentStreak+1;t={...a,lastCompletedDateKey:e,currentStreak:s,longestStreak:Math.max(a.longestStreak,s),totalCompletions:a.totalCompletions+1,graceUsed:a.graceUsed+1}}else t={...a,lastCompletedDateKey:e,currentStreak:1,totalCompletions:a.totalCompletions+1,graceUsed:0,longestStreak:Math.max(a.longestStreak,1)}}let r=[];for(let e of eV)t.currentStreak>=e&&!t.milestonesClaimed.includes(e)&&r.push(e);return eG(t),{state:t,newMilestones:r}}(eP());a.newChainMilestones=e}}}let r=e2();if(r.type===e){let e=e5();if(null===e.completedAt){let s,n,o,l,i,{justCompleted:c}=(s=Math.min(r.goal,e.progress+t),o=(n=null===e.completedAt&&s>=r.goal)?Date.now():e.completedAt,l=null!==o?Math.floor((o-e.startedAt)/1e3):e.durationSec,i={...e,progress:s,completedAt:o,durationSec:l},e3(i),{progress:i,justCompleted:n});a.timedJustCompleted=c}}let n=eW();if(n.type===e){let e=eq();if(null===e.completedAt){let s,r,o,l,i,{justCompleted:c}=(s=Math.min(n.goal,e.progress+t),o=(r=null===e.completedAt&&s>=n.goal)?Date.now():e.completedAt,l=null!==o?Math.floor((o-e.startedAt)/1e3):e.durationSec,i={...e,progress:s,completedAt:o,durationSec:l},eK(i),{progress:i,justCompleted:r});a.weeklyJustCompleted=c}}return a}catch{return a}}function tr(e){let t=[];for(let a of $)!e.fragments[a.id]&&e.totalDecoded>=a.threshold&&(e.fragments[a.id]=!0,t.push(a.id));return t}let tn=(s?k(s):k)((r=(e,t)=>({...ey(),_lastAutoDecode:Date.now(),_lastSpawn:Date.now(),_combo:0,_lastPulse:0,_achievementQueue:[],_tideEvents:[],globalTide:null,init:()=>{let a=t(),s=Date.now(),r=a.activePuzzle;if(r&&!ej(r)){let t={id:`c_${s}_rec`,tier:r.tier,value:_[r.tier].crystals,createdAt:s};r=null,e({pendingCrystals:[...a.pendingCrystals,t].slice(-6)})}let n=a.achievements??{},o=a.activeTide??null,l=a.constellation??[],i=a.pendingPerkChoices??null,c={chronicle:Array.isArray(a.chronicle)?a.chronicle:[],runStart:a.runStart||{timestamp:a.createdAt||Date.now(),techsUnlocked:Object.keys(a.tech||{}).length,expeditionsCompleted:a.totalExpeditions||0,bossKills:a.bossKills||0,starTidesEncountered:[...a.starTidesEncountered||[]],crystalsDecoded:a.totalDecoded||0},bossKills:"number"==typeof a.bossKills?a.bossKills:0,starTidesEncountered:Array.isArray(a.starTidesEncountered)?a.starTidesEncountered:[]},d=em(a),u=X(l),h=C.energyMax+u.energyMaxBonus,f=a.lastTideEnd??0,m=o&&o.endsAt>s?o:null,p=Math.max(0,(s-a.lastTick)/1e3);if(p>5){let t=Math.min(p,28800),o=a.crystalsPerSec*t*a.offlineEff,u=a.crystals,x=Math.min(a.crystalCap,a.crystals+o);te={elapsedSec:t,rawElapsedSec:p,gain:x-u,rate:a.crystalsPerSec,eff:a.offlineEff,capped:p>28800,crystalsBefore:u,crystalsAfter:x,crystalCap:a.crystalCap},window.dispatchEvent(new CustomEvent("echo-nexus-offline-report")),e({crystals:x,lastTick:s,activePuzzle:r,achievements:n,activeTide:m,lastTideEnd:f,constellation:l,pendingPerkChoices:i,energyMax:h,chronicle:c.chronicle,runStart:c.runStart,bossKills:c.bossKills,starTidesEncountered:c.starTidesEncountered,attributes:d.attributes,attributeProgress:d.attributeProgress,pendingAttrPoints:d.pendingAttrPoints,...ta({tech:a.tech,blueprints:a.blueprints,achievements:n,activeTide:m,constellation:l,attributes:d.attributes})})}else e({lastTick:s,activePuzzle:r,achievements:n,activeTide:m,lastTideEnd:f,constellation:l,pendingPerkChoices:i,energyMax:h,chronicle:c.chronicle,runStart:c.runStart,bossKills:c.bossKills,starTidesEncountered:c.starTidesEncountered,attributes:d.attributes,attributeProgress:d.attributeProgress,pendingAttrPoints:d.pendingAttrPoints,...ta({tech:a.tech,blueprints:a.blueprints,achievements:n,activeTide:m,constellation:l,attributes:d.attributes})})},loadOnline:()=>{let a=t();e({...ta({tech:a.tech,blueprints:a.blueprints,achievements:a.achievements,activeTide:a.activeTide,constellation:a.constellation,attributes:a.attributes})})},hardReset:()=>{e({...ey(),_lastAutoDecode:Date.now(),_lastSpawn:Date.now(),_combo:0,_lastPulse:0,_achievementQueue:[],_tideEvents:[],globalTide:null})},tickTide:a=>{let s=t();if(s.globalTide){if(a>=s.globalTide.endsAt){let t=s.globalTide.type,r=0;"silence"===t&&(r=q({type:t,startedAt:s.globalTide.startedAt,endsAt:s.globalTide.endsAt,id:s.globalTide.id}));let n={ended:t,isGlobal:!0};return r>0&&(n.silenceCompensation=r),e({globalTide:null,activeTide:null,lastTideEnd:a,insights:s.insights+r,...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:null,constellation:s.constellation,attributes:s.attributes}),_tideEvents:[...s._tideEvents,n]}),n}return null}let r=s.activeTide,n=X(s.constellation??[]),o=Math.min(.3,ec(s.attributes??{}).tideTriggerBonus),l=Math.max(15e3,(4e4+1e3*n.tideGapDeltaSec)*(1-o));if(r&&a>=r.endsAt){let t=r.type,n=0;"silence"===r.type&&(n=q(r));let o=s.insights+n,l={ended:t};return n>0&&(l.silenceCompensation=n),e({activeTide:null,lastTideEnd:a,insights:o,...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:null,constellation:s.constellation,attributes:s.attributes}),_tideEvents:[...s._tideEvents,l]}),l}if(!r&&a-s.lastTideEnd>=(0===s.lastTideEnd||s.lastTideEnd<=s.createdAt+1e3?3e4:l)){let t=function(e=Math.random){let t=Object.values(H).reduce((e,t)=>e+t,0),a=e()*t;for(let e of Object.keys(H))if((a-=H[e])<=0)return e;return"crystal"}(),r={id:`tide_${a}_${Math.random().toString(36).slice(2,7)}`,type:t,startedAt:a,endsAt:a+75e3},n={started:t},o=s.starTidesEncountered??[],l=`tide_${t}`;return e({activeTide:r,starTidesEncountered:o.includes(l)?o:[...o,l],...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:r,constellation:s.constellation,attributes:s.attributes}),_tideEvents:[...s._tideEvents,n]}),n}return null},consumeTideEvents:()=>{let a=t();if(0===a._tideEvents.length)return[];let s=a._tideEvents;return e({_tideEvents:[]}),s},triggerGlobalTide:a=>{let s=t(),r=Date.now(),n=`global_tide_${r}_${Math.random().toString(36).slice(2,7)}`,o={id:n,type:a,startedAt:r,endsAt:r+6e4},l=s.starTidesEncountered??[],i=`tide_${a}`;e({globalTide:{type:a,startedAt:r,endsAt:r+6e4,id:n},activeTide:o,starTidesEncountered:l.includes(i)?l:[...l,i],...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:o,constellation:s.constellation,attributes:s.attributes}),_tideEvents:[...s._tideEvents,{started:a,isGlobal:!0}]})},tick:a=>{let s=t(),r=Math.max(0,(a-s.lastTick)/1e3);if(r<=0)return;let n=W(s.activeTide),o=s.crystalsPerSec*n.crystalsPerSecMult,l=s.crystals>=s.crystalCap?s.crystals:Math.min(s.crystalCap,s.crystals+o*r),i=1+.03*s.blueprints.length,c=s.pendingCrystals,d=s._lastSpawn;if(a-d>8/i*1e3&&c.length<6){let e=function(e,t=Math.random){if(e<=0)return function(e=Math.random){let t=e();return t<.7?1:t<.95?2:3}(t);let a=t(),s=Math.min(.5,e),r=.7-.7*s;return a<r?1:a<r+(.25+.25*s*.7)?2:3}(X(s.constellation??[]).t2t3BonusRate);c=[...c,{id:`c_${a}_${Math.random().toString(36).slice(2,7)}`,tier:e,value:_[e].crystals,createdAt:a}],d=a}let u=s.energy,h=s.lastEnergyTick;if(u<s.energyMax){let e=eC(s),t=function(e,t,a,s,r=45){let n=1e3*r,o=Math.floor((t-e)/n);return o<=0?{energy:a,lastTick:e}:{energy:Math.min(s,a+o),lastTick:e+o*n}}(h,a,u,s.energyMax,e);u=t.energy,h=t.lastTick}else h=a;e({crystals:l,lastTick:a,pendingCrystals:c,_lastSpawn:d,energy:u,lastEnergyTick:h})},pulse:()=>{let a=t(),s=Date.now(),r=1;s-a._lastPulse<1500&&(r=Math.min(10,a._combo+1));let n=1+(r-1)*.15,o=W(a.activeTide),l=1+ec(a.attributes??{}).pulseComboBonus*Math.max(0,r-1),i=a.pulsePower*n*o.pulsePowerMult*l;if(e({crystals:Math.min(a.crystalCap,a.crystals+i),_combo:r,_lastPulse:s}),ts("pulse",1),r>=3){let t=1+Math.floor(r/2),s=eu({exp:(a.attributeProgress?.inspiration??{exp:0,level:a.attributes?.inspiration??0}).exp+t,level:a.attributes?.inspiration??0},100),n={...a.attributes??ef(),inspiration:s.newProgress.level};e({attributes:n,attributeProgress:{...a.attributeProgress??eh(),inspiration:s.newProgress},...ta({tech:a.tech,blueprints:a.blueprints,achievements:a.achievements,activeTide:a.activeTide,constellation:a.constellation,attributes:n})})}return{gain:i,combo:r}},startDecode:a=>{let s=t(),r=s.pendingCrystals.find(e=>e.id===a);if(!r)return;let n=W(s.activeTide).targetLenBonus??0;e({activePuzzle:ev(r.tier,void 0,n),pendingCrystals:s.pendingCrystals.filter(e=>e.id!==a)})},clickNode:a=>{let s=t();if(!s.activePuzzle)return{ok:!1,finished:!1,failReason:"无活跃谜题"};let r=JSON.parse(JSON.stringify(s.activePuzzle)),n=function(e,t){let a=e.grid.find(e=>e.id===t);if(!a)return{ok:!1,finished:!1,failReason:"无效节点"};if(a.used)return{ok:!1,finished:!1,failReason:"节点已使用"};let s=e.path.length;if(a.color!==e.target[s])return{ok:!1,finished:!1,failReason:"谐振不匹配"};if(s>0){var r;if(r=e.grid.find(t=>t.id===e.path[s-1]),Math.abs(r.row-a.row)+Math.abs(r.col-a.col)!==1)return{ok:!1,finished:!1,failReason:"节点不相邻"}}return s>=e.stepLimit?{ok:!1,finished:!1,failReason:"步数耗尽"}:(a.used=!0,e.path.push(t),{ok:!0,finished:e.path.length>=e.target.length})}(r,a);if(n.ok){if(n.finished){let t=W(s.activeTide),a=X(s.constellation??[]),n=ew(r.tier,s.insightMult,s.contactRateMult),o=t.decodeRewardMult*a.decodeRewardMult,l={crystals:Math.round(n.crystals*o),insights:Math.round(n.insights*o),contact:+(n.contact*o).toFixed(2)},i=s.totalDecoded+1,c=Math.min(100,s.contact+l.contact),d=s.insights+l.insights,u=s.crystals+l.crystals,h={...s,totalDecoded:i,fragments:{...s.fragments}},f=tr(h),m=2*r.tier,p=s.attributes??ef(),x=s.attributeProgress??eh(),g=eu({exp:(x.wisdom??{exp:0,level:p.wisdom}).exp+m,level:p.wisdom},100),b={...p,wisdom:g.newProgress.level},y={...x,wisdom:g.newProgress};return e({activePuzzle:null,crystals:u,insights:d,contact:c,totalDecoded:i,fragments:h.fragments,attributes:b,attributeProgress:y,...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:s.activeTide,constellation:s.constellation,attributes:b})}),ts("decode",1),ts("insight",l.insights),{ok:!0,finished:!0,failReason:f.join(",")||void 0}}let t=ej(r);return e({activePuzzle:r}),{ok:!0,finished:!1,solvable:t}}return n},undoStep:()=>{let a=t();if(!a.activePuzzle||0===a.activePuzzle.path.length)return;let s=JSON.parse(JSON.stringify(a.activePuzzle)),r=s.path.pop();if(void 0!==r){let e=s.grid.find(e=>e.id===r);e&&(e.used=!1)}e({activePuzzle:s})},retryPuzzle:()=>{let a=t();if(a.activePuzzle){var s;e({activePuzzle:ev((s=a.activePuzzle).tier,s.seed+1)})}},abandonPuzzle:()=>{let a=t();if(!a.activePuzzle)return;let s={id:`c_${Date.now()}_ret`,tier:a.activePuzzle.tier,value:_[a.activePuzzle.tier].crystals,createdAt:Date.now()};e({activePuzzle:null,pendingCrystals:[...a.pendingCrystals,s].slice(-6)})},autoDecodeTick:()=>{let a=t();if(!a.autoDecode)return;let s=Date.now(),r=X(a.constellation??[]),n=ec(a.attributes??{}),o=12e3+1e3*r.autoDecodeIntervalDeltaSec,l=W(a.activeTide).autoDecodeIntervalMult??1,i=Math.max(5e3,o*n.autoDecodeIntervalMult*l);if(s-a._lastAutoDecode<i)return;let c=a.pendingCrystals.findIndex(e=>1===e.tier);if(c<0)return;let d=a.pendingCrystals[c],u=W(a.activeTide),h=ew(1,a.insightMult,a.contactRateMult),f=u.decodeRewardMult*r.decodeRewardMult,m={crystals:Math.round(h.crystals*f),insights:Math.round(h.insights*f),contact:+(h.contact*f).toFixed(2)},p=a.totalDecoded+1,x={...a,totalDecoded:p,fragments:{...a.fragments}};tr(x);let g=a.attributes??ef(),b=a.attributeProgress??eh(),y=eu({exp:(b.wisdom??{exp:0,level:g.wisdom}).exp+1,level:g.wisdom},100),w={...g,wisdom:y.newProgress.level},v={...b,wisdom:y.newProgress};e({pendingCrystals:a.pendingCrystals.filter(e=>e.id!==d.id),crystals:a.crystals+m.crystals,insights:a.insights+m.insights,contact:Math.min(100,a.contact+m.contact),totalDecoded:p,fragments:x.fragments,_lastAutoDecode:s,attributes:w,attributeProgress:v,...ta({tech:a.tech,blueprints:a.blueprints,achievements:a.achievements,activeTide:a.activeTide,constellation:a.constellation,attributes:w})}),ts("decode",1),ts("insight",m.insights)},buyTech:a=>{let s=t(),r=E.find(e=>e.id===a);if(!r||(s.tech[a]??0)>=1||s.insights<r.cost)return!1;let n={...s.tech,[a]:1};return e({insights:s.insights-r.cost,tech:n,...ta({tech:n,blueprints:s.blueprints,achievements:s.achievements,activeTide:s.activeTide,constellation:s.constellation,attributes:s.attributes})}),!0},startExpedition:()=>{let a,s,r=t();if(r.activeExpedition&&!r.activeExpedition.finished)return{ok:!1,reason:"已有进行中的探险"};if(r.energy<1)return{ok:!1,reason:"能量不足"};let n=W(r.activeTide),o=ec(r.attributes??{}),l=(a=10,s=r.tech?.exp_1??0,a+=3*s+5*(r.tech?.exp_2??0)+8*(r.tech?.exp_3??0),Math.round(a*=(1+(r.blueprints?.length??0)*.08)*(1+(r.ascensions??0)*.15)*X(r.constellation??[]).expeditionPowerMult)+n.expeditionPowerBonus),i=Math.round((100+(r.tech?.exp_2??0)*20+(r.ascensions??0)*10)*X(r.constellation??[]).expeditionHpMult)+n.expeditionHpBonus;return e({activeExpedition:function(e,t,a){let s,r=(s=e>>>0,()=>{s|=0;let e=Math.imul((s=s+0x6d2b79f5|0)^s>>>15,1|s);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}),n=5+Math.floor(3*r()),o=[];for(let e=0;e<n;e++){let t=e===n-1,a=t?"boss":function(e){let t=Object.keys(eN),a=t.reduce((e,t)=>e+eN[t],0),s=e()*a;for(let e of t)if((s-=eN[e])<=0)return e;return"combat"}(r),s=ek[a],l=Math.floor(r()*s.titles.length);o.push({id:e,type:a,title:s.titles[l],desc:s.descs[l],cleared:!1,difficulty:t?3+Math.floor(3*r()):1+Math.floor(4*r()),position:e})}if("combat"===o[0].type||"boss"===o[0].type){o[0].type=.5>r()?"treasure":"rest";let e=ek[o[0].type];o[0].title=e.titles[0],o[0].desc=e.descs[0],o[0].difficulty=1}return{id:`exp_${e}_${Date.now()}`,nodes:o,currentNode:0,finished:!1,rewards:{crystals:0,insights:0,contact:0,fragments:[]},power:t,hp:a,maxHp:a,seed:e,startedAt:Date.now()}}(Math.floor(1e9*Math.random()),Math.round(l*o.expeditionPowerMult),i+o.expeditionHpBonus),energy:r.energy-1,totalExpeditions:r.totalExpeditions+1}),{ok:!0}},resolveCurrentNode:()=>{let a=t();if(!a.activeExpedition||a.activeExpedition.finished)return null;let s=JSON.parse(JSON.stringify(a.activeExpedition)),r=s.nodes[s.currentNode],n=r?.type==="boss",o=ec(a.attributes??{}),l=W(a.activeTide).bossWinRateBonus??0,i=n?eS(s,()=>{let e=Math.random(),t=Math.min(.95,o.bossWinRateBonus+l);return e<t?0:Math.min(1,e-t)}):eS(s);i.crystals&&(s.rewards.crystals+=i.crystals),i.insights&&(s.rewards.insights+=i.insights),i.contact&&(s.rewards.contact+=i.contact),i.fragments&&s.rewards.fragments.push(...i.fragments),i.hpDelta&&(s.hp=Math.max(0,Math.min(s.maxHp,s.hp+i.hpDelta)));let c=a.crystals+(i.crystals||0),d=a.insights+(i.insights||0),u=Math.min(100,a.contact+(i.contact||0)),h={...a.fragments};if(i.fragments)for(let e of i.fragments)h[e]=!0;let f=[{expeditionId:s.id,nodeType:r?.type||"combat",result:i.log,rewards:[i.crystals?`+${i.crystals}晶体`:"",i.insights?`+${i.insights}洞见`:"",i.contact?`+${i.contact.toFixed(1)}接触`:"",i.hpDelta?`${i.hpDelta>0?"+":""}${i.hpDelta}生命`:""].filter(Boolean).join(" "),timestamp:Date.now()},...a.expeditionLog].slice(0,30);i.ended&&(s.finished=!0);let m=a.bossKills??0,p=!1;i.ended&&"victory"===i.endReason&&r?.type==="boss"&&(m+=1,p=!0);let x=a.attributes??ef(),g=a.attributeProgress??eh(),b=!1,y=(r?.type==="combat"||r?.type==="boss")&&!i.ended,w=i.ended&&"victory"===i.endReason;if(y||p||w){let e=p?8:2,t=p?6:w?4:1,a=eu({exp:g.courage.exp+e,level:x.courage},100),s=eu({exp:g.exploration.exp+t,level:x.exploration},100);x={...x,courage:a.newProgress.level,exploration:s.newProgress.level},g={...g,courage:a.newProgress,exploration:s.newProgress},b=!0}return e({activeExpedition:s,crystals:c,insights:d,contact:u,fragments:h,expeditionLog:f,bossKills:m,attributes:x,attributeProgress:g,...b?ta({tech:a.tech,blueprints:a.blueprints,achievements:a.achievements,activeTide:a.activeTide,constellation:a.constellation,attributes:x}):{}}),i.ended&&(ts("expedition",1),p&&ts("boss",1)),i.insights&&ts("insight",i.insights),i},advanceNode:()=>{let a=t();if(!a.activeExpedition||a.activeExpedition.finished)return;let s=JSON.parse(JSON.stringify(a.activeExpedition)),r=s.nodes[s.currentNode];r&&r.cleared&&(s.currentNode>=s.nodes.length-1||(s.currentNode++,e({activeExpedition:s})))},abortExpedition:()=>{let a=t();if(!a.activeExpedition)return;let s=JSON.parse(JSON.stringify(a.activeExpedition));s.finished=!0;let r={expeditionId:s.id,nodeType:"rest",result:"探险队主动撤退,保留已获奖励。",rewards:"",timestamp:Date.now()};e({activeExpedition:s,expeditionLog:[r,...a.expeditionLog].slice(0,30)})},doPrestige:()=>{let a,s,r,n,o,l,i,c,d,u,h,f,m,p,x=t();if(x.contact<100)return null;let g=eb(x),b=(a=eb(x),s=[...x.blueprints,...Array.from({length:a},(e,t)=>`bp_${Date.now()}_${t}`)].slice(0,6),r=Y(x.constellation??[]),n=X(x.constellation??[]),o=function(e,t=[]){let a,s,r,n,o,l,i=e.ascensions+1,c=(a=Date.now(),{durationSec:Math.max(1,Math.floor((a-(s=e.runStart).timestamp)/1e3)),techsThisRun:Math.max(0,Object.keys(e.tech||{}).length-s.techsUnlocked),expThisRun:Math.max(0,e.totalExpeditions-s.expeditionsCompleted),bossKillsThisRun:Math.max(0,e.bossKills-s.bossKills),decodedThisRun:Math.max(0,e.totalDecoded-s.crystalsDecoded),newTides:(e.starTidesEncountered||[]).filter(e=>!(s.starTidesEncountered||[]).includes(e))}),d=e.createdAt+7919*i>>>0,u=(r=(i-1)%ee.length,o=d%(n=ee[r]).suffixes.length,`${n.prefix} \xb7 ${n.suffixes[o]}`),h=(l=[],1===e.ascensions+1&&l.push("首次飞升"),c.expThisRun>0&&0===e.runStart.expeditionsCompleted&&l.push("首次完成遗迹探险"),c.bossKillsThisRun>0&&l.push("首杀维度 BOSS"),c.decodedThisRun>=10&&l.push(`单周目解码 ${c.decodedThisRun} 颗`),c.decodedThisRun>=30&&l.push(`单周目解码 ${c.decodedThisRun} 颗`),c.techsThisRun>=5&&l.push("技术狂人"),c.newTides.length>=3&&l.push("星潮亲历者"),(e.constellation?.length||0)>=6&&l.push("星图六分"),(e.constellation?.length||0)>=12&&l.push("星图十二宫"),l),f=Math.min(e.blueprints.length+1,6),m=en({ascensionNumber:i,epochName:u,durationSec:c.durationSec,techsThisRun:c.techsThisRun,expThisRun:c.expThisRun,bossKillsThisRun:c.bossKillsThisRun,decodedThisRun:c.decodedThisRun,newTides:c.newTides,perksThisAscension:t,blueprintsAfter:f,milestones:h});return{ascensionNumber:i,epochName:u,timestamp:Date.now(),durationSec:c.durationSec,summary:{techsUnlocked:Object.keys(e.tech||{}).length,constellationsTotal:e.constellation?.length||0,expeditionsCompleted:e.totalExpeditions,bossKills:e.bossKills,starTidesEncountered:e.starTidesEncountered?.length||0,blueprintsAfter:f,crystalsDecoded:e.totalDecoded,crystalsDecodedThisRun:c.decodedThisRun,techsThisRun:c.techsThisRun,expeditionsThisRun:c.expThisRun,bossKillsThisRun:c.bossKillsThisRun},perksThisAscension:t,tidesThisRun:c.newTides,lore:m,milestones:h}}(x,[]),l=[...x.chronicle||[],o].slice(-200),i={timestamp:Date.now(),techsUnlocked:Object.keys(x.tech||{}).length,expeditionsCompleted:x.totalExpeditions,bossKills:x.bossKills,starTidesEncountered:[...x.starTidesEncountered||[]],crystalsDecoded:x.totalDecoded},d=(c=em(x)).attributes,u=eh(),h=2*(x.ascensions??0)+1,f=c.pendingAttrPoints+h,m=ey(),p=eg({tech:{},blueprints:s,achievements:x.achievements,constellation:x.constellation,attributes:d}),{...m,fragments:x.fragments,totalDecoded:x.totalDecoded,ascensions:x.ascensions+1,blueprints:s,achievements:x.achievements,constellation:x.constellation,pendingPerkChoices:r.length>0?r:null,crystals:n.prestigeStartCrystals,insights:n.prestigeStartInsights,theme:x.theme,soundOn:x.soundOn,createdAt:x.createdAt,lastTick:Date.now(),lastEnergyTick:Date.now(),expeditionLog:x.expeditionLog,totalExpeditions:x.totalExpeditions,bossKills:x.bossKills,starTidesEncountered:x.starTidesEncountered,chronicle:l,runStart:i,activeTide:null,lastTideEnd:Date.now(),attributes:d,attributeProgress:u,pendingAttrPoints:f,...p}),y=X(b.constellation??[]),w=C.energyMax+y.energyMaxBonus;return e({...b,energyMax:w,...ta({tech:b.tech,blueprints:b.blueprints,achievements:b.achievements,activeTide:b.activeTide,constellation:b.constellation,attributes:b.attributes}),_lastAutoDecode:Date.now(),_lastSpawn:Date.now(),_combo:0,_lastPulse:0,_tideEvents:[]}),{newBp:g}},chooseConstellationPerk:a=>{let s=t();if(!s.pendingPerkChoices||!s.pendingPerkChoices.includes(a)||!V(a)||s.constellation?.includes(a))return!1;let r=[...s.constellation??[],a],n=X(r),o=C.energyMax+n.energyMaxBonus,l=s.chronicle??[],i=l;if(l.length>0){let e=function(e,t){if(e.perksThisAscension.length===t.length&&e.perksThisAscension.every((e,a)=>e===t[a]))return e;let a=en({ascensionNumber:e.ascensionNumber,epochName:e.epochName,durationSec:e.durationSec,techsThisRun:e.summary.techsThisRun??e.summary.techsUnlocked,expThisRun:e.summary.expeditionsThisRun??e.summary.expeditionsCompleted,bossKillsThisRun:e.summary.bossKillsThisRun??e.summary.bossKills,decodedThisRun:e.summary.crystalsDecodedThisRun,newTides:e.tidesThisRun||[],perksThisAscension:t,blueprintsAfter:e.summary.blueprintsAfter,milestones:e.milestones||[]});return{...e,perksThisAscension:t,lore:a}}(l[l.length-1],[a]);i=[...l.slice(0,-1),e]}return e({constellation:r,pendingPerkChoices:null,energyMax:o,chronicle:i,...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:s.activeTide,constellation:r,attributes:s.attributes})}),!0},rerollPerkChoices:()=>{let a=t();if(!a.pendingPerkChoices)return;let s=Y(a.constellation??[]);s.length>0&&e({pendingPerkChoices:s})},checkAchievements:()=>{let a=t(),s=[],r={...a.achievements},n=a.crystals,o=a.insights,l=a.contact,i=!1;for(let e of L)!r[e.id]&&e.check(a)&&(r[e.id]=!0,s.push(e),e.reward.crystals&&(n+=e.reward.crystals),e.reward.insights&&(o+=e.reward.insights),e.reward.contact&&(l=Math.min(100,l+e.reward.contact)),(e.reward.crystalsPerSecPct||e.reward.insightPct)&&(i=!0));return 0===s.length?[]:(e({achievements:r,crystals:n,insights:o,contact:l,...i?ta({tech:a.tech,blueprints:a.blueprints,achievements:r,activeTide:a.activeTide,constellation:a.constellation,attributes:a.attributes}):{},_achievementQueue:[...a._achievementQueue,...s]}),s)},consumeAchievementQueue:()=>{let a=t();if(0===a._achievementQueue.length)return[];let s=a._achievementQueue;return e({_achievementQueue:[]}),s},canPrestige:()=>t().contact>=100,toggleTheme:()=>e({theme:"dark"===t().theme?"light":"dark"}),toggleSound:()=>e({soundOn:!t().soundOn}),grantBeaconReward:(a,s)=>{let r=t();e({insights:r.insights+Math.round(a),contact:Math.min(100,r.contact+s)})},claimWeeklyBeacon:()=>{let a=function(e,t){if(t.claimed||null===t.completedAt)return{rewardInsight:0,rewardContact:0,score:0,leaderboard:eI()};let a=eA({...e,dateKey:e.weekKey},t.progress,t.durationSec),s={timestamp:Date.now(),dateKey:e.weekKey,challenge:e.type,difficulty:e.difficulty,progress:t.progress/e.goal,score:a,durationSec:t.durationSec,isWeekly:!0},r=eD(s);return eK({...t,claimed:!0}),{rewardInsight:e.rewardInsight,rewardContact:e.rewardContact,score:a,leaderboard:r,entry:s}}(eW(),eq());if(a.rewardInsight>0||a.rewardContact>0){let s=t();e({insights:s.insights+Math.round(a.rewardInsight),contact:Math.min(100,s.contact+a.rewardContact)}),a.entry&&e8(a.entry)}return{rewardInsight:a.rewardInsight,rewardContact:a.rewardContact,score:a.score}},claimTimedBeacon:()=>{let a=function(e,t){if(t.claimed||null===t.completedAt)return{rewardInsight:0,rewardContact:0,score:0,leaderboard:eI()};let a=eA({...e,dateKey:e.slotKey},t.progress,t.durationSec),s={timestamp:Date.now(),dateKey:e.slotKey,challenge:e.type,difficulty:e.difficulty,progress:t.progress/e.goal,score:a,durationSec:t.durationSec,isTimed:!0},r=eD(s);return e3({...t,claimed:!0}),{rewardInsight:e.rewardInsight,rewardContact:e.rewardContact,score:a,leaderboard:r,entry:s}}(e2(),e5());if(a.rewardInsight>0||a.rewardContact>0){let s=t();e({insights:s.insights+Math.round(a.rewardInsight),contact:Math.min(100,s.contact+a.rewardContact)}),a.entry&&e8(a.entry)}return{rewardInsight:a.rewardInsight,rewardContact:a.rewardContact,score:a.score}},claimChainReward:a=>{let s=eY();if(s.currentStreak<a||s.milestonesClaimed.includes(a))return{rewardInsight:0,rewardContact:0,label:"",ok:!1};let r=function(e){let t=eX.find(t=>t.milestone===e),a=eY();if(!t||a.milestonesClaimed.includes(e)||a.currentStreak<e)return{rewardInsight:0,rewardContact:0,label:"",state:a};let s={...a,milestonesClaimed:[...a.milestonesClaimed,e]};return eG(s),{rewardInsight:t.rewardInsight,rewardContact:t.rewardContact,label:t.label,state:s}}(a);if(r.rewardInsight>0||r.rewardContact>0){let a=t();e({insights:a.insights+Math.round(r.rewardInsight),contact:Math.min(100,a.contact+r.rewardContact)})}return{rewardInsight:r.rewardInsight,rewardContact:r.rewardContact,label:r.label,ok:r.rewardInsight>0||r.rewardContact>0}},grantCruiseReward:a=>{let s=t(),r=a.crystals??0,n=a.insights??0,o=a.contact??0,l=Math.max(2,Math.floor((r+10*n+10*o)/30)),i=s.attributes??ef(),c=s.attributeProgress??eh(),d=eu({exp:c.exploration.exp+l,level:i.exploration},100),u=eu({exp:c.courage.exp+Math.floor(.6*l),level:i.courage},100),h={...i,exploration:d.newProgress.level,courage:u.newProgress.level},f={...c,exploration:d.newProgress,courage:u.newProgress};e({crystals:Math.min(s.crystalCap,s.crystals+r),insights:s.insights+Math.round(n),contact:Math.min(100,s.contact+o),attributes:h,attributeProgress:f,...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:s.activeTide,constellation:s.constellation,attributes:h})})},allocateAttribute:(a,s=1)=>{let r=t(),n=r.attributes??ef(),o=n[a]??0;if(o>=100||(r.pendingAttrPoints??0)<s)return{ok:!1,leveledUp:0};let l=Math.min(s,100-o,r.pendingAttrPoints),i=o+l,c={...n,[a]:i},d=r.attributeProgress??eh(),u=d[a]??{exp:0,level:o};return e({attributes:c,attributeProgress:{...d,[a]:{exp:u.exp,level:i}},pendingAttrPoints:r.pendingAttrPoints-l,...ta({tech:r.tech,blueprints:r.blueprints,achievements:r.achievements,activeTide:r.activeTide,constellation:r.constellation,attributes:c})}),{ok:!0,leveledUp:l}},gainAttributeExp:(a,s)=>{let r=t(),n=r.attributes??ef(),o=r.attributeProgress??eh(),l=eu({exp:(o[a]??{exp:0,level:n[a]}).exp+s,level:n[a]},100),i={...n,[a]:l.newProgress.level};return e({attributes:i,attributeProgress:{...o,[a]:l.newProgress},...ta({tech:r.tech,blueprints:r.blueprints,achievements:r.achievements,activeTide:r.activeTide,constellation:r.constellation,attributes:i})}),{leveledUp:l.levelsGained,newLevel:l.newProgress.level}}}),n={name:"echo-nexus-save-v1",storage:M(()=>localStorage),partialize:e=>{let{_lastAutoDecode:t,_lastSpawn:a,_combo:s,_lastPulse:r,_achievementQueue:n,_tideEvents:o,globalTide:l,...i}=e;return i}},(e,t,a)=>{let s,o={storage:M(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...n},l=!1,i=0,c=new Set,d=new Set,u=o.storage;if(!u)return r((...t)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),e(...t)},t,a);let h=()=>{let e=o.partialize({...t()});return u.setItem(o.name,{state:e,version:o.version})},f=a.setState;a.setState=(e,t)=>(f(e,t),h());let m=r((...t)=>(e(...t),h()),t,a);a.getInitialState=()=>m;let p=()=>{var a,r;if(!u)return;let n=++i;l=!1,c.forEach(e=>{var a;return e(null!=(a=t())?a:m)});let f=(null==(r=o.onRehydrateStorage)?void 0:r.call(o,null!=(a=t())?a:m))||void 0;return S(u.getItem.bind(u))(o.name).then(e=>{if(e)if("number"!=typeof e.version||e.version===o.version)return[!1,e.state];else{if(o.migrate){let t=o.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(a=>{var r;if(n!==i)return;let[l,c]=a;if(e(s=o.merge(c,null!=(r=t())?r:m),!0),l)return h()}).then(()=>{n===i&&(null==f||f(s,void 0),s=t(),l=!0,d.forEach(e=>e(s)))}).catch(e=>{n===i&&(null==f||f(void 0,e))})};return a.persist={setOptions:e=>{o={...o,...e},e.storage&&(u=e.storage)},clearStorage:()=>{null==u||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>p(),hasHydrated:()=>l,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(d.add(e),()=>{d.delete(e)})},o.skipHydration||p(),s||m}));var to=e.i(75254);let tl=(0,to.default)("gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]),ti=(0,to.default)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),tc=(0,to.default)("waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]),td=(0,to.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);e.i(74080);var tu=e.i(20783),th=Symbol.for("react.lazy"),tf=v[" use ".trim().toString()];function tm(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===th&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}function tp(e){var t;let a,s=(t=e,(a=v.forwardRef((e,t)=>{let{children:a,...s}=e;if(tm(a)&&"function"==typeof tf&&(a=tf(a._payload)),v.isValidElement(a)){var r;let e,n,o=(r=a,(n=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.ref:(n=(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.props.ref:r.props.ref||r.ref),l=function(e,t){let a={...t};for(let s in t){let r=e[s],n=t[s];/^on[A-Z]/.test(s)?r&&n?a[s]=(...e)=>{let t=n(...e);return r(...e),t}:r&&(a[s]=r):"style"===s?a[s]={...r,...n}:"className"===s&&(a[s]=[r,n].filter(Boolean).join(" "))}return{...e,...a}}(s,a.props);return a.type!==v.Fragment&&(l.ref=t?(0,tu.composeRefs)(t,o):o),v.cloneElement(a,l)}return v.Children.count(a)>1?v.Children.only(null):null})).displayName=`${t}.SlotClone`,a),r=v.forwardRef((e,t)=>{let{children:a,...r}=e;tm(a)&&"function"==typeof tf&&(a=tf(a._payload));let n=v.Children.toArray(a),o=n.find(tb);if(o){let e=o.props.children,a=n.map(t=>t!==o?t:v.Children.count(e)>1?v.Children.only(null):v.isValidElement(e)?e.props.children:null);return(0,w.jsx)(s,{...r,ref:t,children:v.isValidElement(e)?v.cloneElement(e,void 0,a):null})}return(0,w.jsx)(s,{...r,ref:t,children:a})});return r.displayName=`${e}.Slot`,r}var tx=tp("Slot"),tg=Symbol("radix.slottable");function tb(e){return v.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===tg}var ty=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let a=tp(`Primitive.${t}`),s=v.forwardRef((e,s)=>{let{asChild:r,...n}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,w.jsx)(r?a:t,{...n,ref:s})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),tw="Progress",[tv,tj]=function(e,t=[]){let a=[],s=()=>{let t=a.map(e=>v.createContext(e));return function(a){let s=a?.[e]||t;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:s}}),[a,s])}};return s.scopeName=e,[function(t,s){let r=v.createContext(s);r.displayName=t+"Context";let n=a.length;a=[...a,s];let o=t=>{let{scope:a,children:s,...o}=t,l=a?.[e]?.[n]||r,i=v.useMemo(()=>o,Object.values(o));return(0,w.jsx)(l.Provider,{value:i,children:s})};return o.displayName=t+"Provider",[o,function(a,o){let l=o?.[e]?.[n]||r,i=v.useContext(l);if(i)return i;if(void 0!==s)return s;throw Error(`\`${a}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let a=()=>{let a=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let s=a.reduce((t,{useScope:a,scopeName:s})=>{let r=a(e)[`__scope${s}`];return{...t,...r}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return a.scopeName=t.scopeName,a}(s,...t)]}(tw),[tN,tk]=tv(tw),tM=v.forwardRef((e,t)=>{var a,s;let{__scopeProgress:r,value:n=null,max:o,getValueLabel:l=t_,...i}=e;(o||0===o)&&!tR(o)&&console.error((a=`${o}`,`Invalid prop \`max\` of value \`${a}\` supplied to \`Progress\`. Only numbers greater than 0 are valid max values. Defaulting to \`100\`.`));let c=tR(o)?o:100;null===n||tE(n,c)||console.error((s=`${n}`,`Invalid prop \`value\` of value \`${s}\` supplied to \`Progress\`. The \`value\` prop must be:
- a positive number
- less than the value passed to \`max\` (or 100 if no \`max\` prop is set)
- \`null\` or \`undefined\` if the progress is indeterminate.
Defaulting to \`null\`.`));let d=tE(n,c)?n:null,u=tP(d)?l(d,c):void 0;return(0,w.jsx)(tN,{scope:r,value:d,max:c,children:(0,w.jsx)(ty.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":tP(d)?d:void 0,"aria-valuetext":u,role:"progressbar","data-state":tT(d,c),"data-value":d??void 0,"data-max":c,...i,ref:t})})});tM.displayName=tw;var tS="ProgressIndicator",tC=v.forwardRef((e,t)=>{let{__scopeProgress:a,...s}=e,r=tk(tS,a);return(0,w.jsx)(ty.div,{"data-state":tT(r.value,r.max),"data-value":r.value??void 0,"data-max":r.max,...s,ref:t})});function t_(e,t){return`${Math.round(e/t*100)}%`}function tT(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function tP(e){return"number"==typeof e}function tR(e){return tP(e)&&!isNaN(e)&&e>0}function tE(e,t){return tP(e)&&!isNaN(e)&&e<=t&&e>=0}tC.displayName=tS;var tA=e.i(75157);function t$({className:e,value:t,...a}){return(0,w.jsx)(tM,{"data-slot":"progress",className:(0,tA.cn)("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",e),...a,children:(0,w.jsx)(tC,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})})}function tB({onPrestige:e}){let t=tn(e=>e.crystals),a=tn(e=>e.crystalsPerSec),s=tn(e=>e.insights),r=tn(e=>e.contact),n=tn(e=>e.ascensions),o=tn(e=>e.blueprints);return(0,w.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 sm:gap-x-4 px-3.5 py-2.5 rounded-2xl border border-white/10 bg-black/40 backdrop-blur-md",children:[(0,w.jsx)(tI,{icon:(0,w.jsx)(tl,{className:"h-4 w-4 text-emerald-400"}),label:"记忆晶体",value:O(t),sub:`+${a.toFixed(1)}/s`,glow:"rgba(52,211,153,0.4)"}),(0,w.jsx)("div",{className:"h-9 w-px bg-gradient-to-b from-transparent via-white/15 to-transparent hidden sm:block"}),(0,w.jsx)(tI,{icon:(0,w.jsx)(ti,{className:"h-4 w-4 text-amber-400"}),label:"技术洞见",value:O(s),sub:"解码产出",glow:"rgba(251,191,36,0.4)"}),(0,w.jsx)("div",{className:"h-9 w-px bg-gradient-to-b from-transparent via-white/15 to-transparent hidden sm:block"}),(0,w.jsxs)("div",{className:"flex-1 min-w-[200px] flex flex-col gap-1.5",children:[(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsx)(tc,{className:"h-4 w-4 text-fuchsia-400 shrink-0"}),(0,w.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"接触进度"}),(0,w.jsxs)("span",{className:"text-xs font-mono font-semibold text-fuchsia-300 ml-auto tabular-nums",children:[r.toFixed(1),"%"]}),r>=100&&(0,w.jsx)("button",{onClick:e,className:"text-[10px] px-2 py-0.5 rounded-full bg-fuchsia-500/20 border border-fuchsia-400/50 text-fuchsia-200 hover:bg-fuchsia-500/30 transition animate-pulse whitespace-nowrap ml-1",children:"飞升"})]}),(0,w.jsx)(t$,{value:r,className:"h-1.5 bg-white/10 [&>div]:bg-gradient-to-r [&>div]:from-fuchsia-500 [&>div]:to-rose-400"})]}),(0,w.jsx)("div",{className:"h-9 w-px bg-gradient-to-b from-transparent via-white/15 to-transparent hidden sm:block"}),(0,w.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,w.jsx)(td,{className:"h-4 w-4 text-rose-400 shrink-0"}),(0,w.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,w.jsx)("span",{className:"text-[10px] text-muted-foreground leading-none",children:"飞升"}),(0,w.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,w.jsx)("span",{className:"text-sm font-mono font-semibold leading-none",children:n}),(0,w.jsxs)("span",{className:"text-amber-300 text-xs leading-none",children:["×",o.length]})]})]})]})]})}function tI({icon:e,label:t,value:a,sub:s,glow:r}){return(0,w.jsxs)("div",{className:"flex items-center gap-2.5",style:{filter:`drop-shadow(0 0 6px ${r})`},children:[e,(0,w.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,w.jsx)("span",{className:"text-[10px] text-muted-foreground leading-none",children:t}),(0,w.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,w.jsx)("span",{className:"text-sm font-mono font-semibold leading-none tabular-nums",children:a}),(0,w.jsx)("span",{className:"text-[10px] text-muted-foreground/80 whitespace-nowrap",children:s})]})]})]})}var tD=e.i(37902),tO=e.i(74911);let tL={emerald:523.25,rose:587.33,amber:659.25,fuchsia:698.46};class tz{ctx=null;master=null;enabled=!0;volume=.35;ensure(){if(!this.ctx){let e=window.AudioContext||window.webkitAudioContext;if(!e)return null;this.ctx=new e,this.master=this.ctx.createGain(),this.master.gain.value=this.volume,this.master.connect(this.ctx.destination)}return"suspended"===this.ctx.state&&this.ctx.resume(),this.ctx}setEnabled(e){this.enabled=e}setVolume(e){this.volume=Math.max(0,Math.min(1,e)),this.master&&(this.master.gain.value=this.volume)}tone(e,t,a="sine",s=.3,r=0,n=0,o){let l=this.ensure();if(!l||!this.master)return;let i=l.currentTime+r,c=l.createOscillator(),d=l.createGain();if(c.type=a,c.frequency.setValueAtTime(e,i),n&&c.detune.setValueAtTime(n,i),d.gain.setValueAtTime(0,i),d.gain.linearRampToValueAtTime(s,i+.008),d.gain.exponentialRampToValueAtTime(1e-4,i+t),o){let e=l.createBiquadFilter();e.type="lowpass",e.frequency.value=o,c.connect(e),e.connect(d)}else c.connect(d);d.connect(this.master),c.start(i),c.stop(i+t+.05)}sweep(e,t,a,s="sine",r=.3,n=0){let o=this.ensure();if(!o||!this.master)return;let l=o.currentTime+n,i=o.createOscillator(),c=o.createGain();i.type=s,i.frequency.setValueAtTime(e,l),i.frequency.exponentialRampToValueAtTime(Math.max(1,t),l+a),c.gain.setValueAtTime(0,l),c.gain.linearRampToValueAtTime(r,l+.02),c.gain.exponentialRampToValueAtTime(1e-4,l+a),i.connect(c),c.connect(this.master),i.start(l),i.stop(l+a+.05)}noise(e,t=.2,a=0,s=1200){let r=this.ensure();if(!r||!this.master)return;let n=r.currentTime+a,o=Math.floor(r.sampleRate*e),l=r.createBuffer(1,o,r.sampleRate),i=l.getChannelData(0);for(let e=0;e<o;e++)i[e]=(2*Math.random()-1)*(1-e/o);let c=r.createBufferSource();c.buffer=l;let d=r.createBiquadFilter();d.type="lowpass",d.frequency.value=s;let u=r.createGain();u.gain.setValueAtTime(t,n),u.gain.exponentialRampToValueAtTime(1e-4,n+e),c.connect(d),d.connect(u),u.connect(this.master),c.start(n),c.stop(n+e+.02)}play(e,t){if(this.enabled&&this.ensure())switch(e){case"pulse":{let e=220+(t?.combo?18*t.combo:0);this.tone(e,.18,"sine",.28),this.tone(2*e,.14,"triangle",.1,.01);break}case"pulseCombo":{let e=440+(t?.combo?24*t.combo:0);this.tone(e,.2,"sine",.3),this.tone(1.5*e,.18,"triangle",.14,.01),this.tone(2*e,.16,"sine",.08,.02);break}case"decodeClick":{let e=t?.color?tL[t.color]??523:523;this.tone(e,.16,"sine",.26),this.tone(2*e,.1,"triangle",.08,.005);break}case"decodeFail":this.tone(160,.16,"sawtooth",.18,0,0,800),this.noise(.08,.1,0,600);break;case"decodeSuccess":this.tone(523.25,.22,"sine",.24,0),this.tone(659.25,.22,"sine",.22,.08),this.tone(783.99,.3,"sine",.24,.16),this.tone(1046.5,.34,"triangle",.12,.2);break;case"fragmentUnlock":this.tone(880,.7,"sine",.18,0),this.tone(1108.73,.7,"sine",.12,.04),this.tone(1318.51,.8,"triangle",.08,.1),this.sweep(440,880,.6,"sine",.1,.05);break;case"techBuy":this.tone(587.33,.12,"sine",.22),this.tone(880,.16,"triangle",.16,.06);break;case"expeditionStart":this.sweep(80,240,.5,"sawtooth",.16),this.sweep(120,360,.5,"square",.06,.02),this.noise(.4,.08,0,400);break;case"expeditionNode":this.tone(440,.14,"triangle",.2),this.tone(660,.12,"sine",.1,.04);break;case"expeditionVictory":this.tone(523.25,.18,"sine",.24,0),this.tone(659.25,.18,"sine",.24,.1),this.tone(783.99,.18,"sine",.24,.2),this.tone(1046.5,.4,"triangle",.2,.3);break;case"expeditionDefeat":this.tone(330,.3,"sawtooth",.2,0,0,700),this.tone(220,.4,"sine",.18,.12),this.tone(146.83,.5,"sine",.16,.24);break;case"prestige":this.sweep(110,880,1.2,"sine",.2),this.sweep(220,1760,1.2,"triangle",.1,.05),this.tone(523.25,.6,"sine",.16,.3),this.tone(659.25,.6,"sine",.16,.42),this.tone(783.99,.8,"sine",.16,.54),this.tone(1046.5,1,"triangle",.12,.66);break;case"achievement":this.tone(659.25,.16,"sine",.22,0),this.tone(880,.16,"sine",.22,.08),this.tone(1046.5,.16,"sine",.22,.16),this.tone(1318.51,.4,"triangle",.18,.24);break;case"tideStart":this.sweep(330,660,.8,"sine",.16),this.sweep(440,880,.8,"triangle",.08,.04),this.tone(523.25,.5,"sine",.1,.2),this.tone(783.99,.6,"sine",.08,.3);break;case"tideEnd":this.tone(659.25,.3,"sine",.14,0),this.tone(523.25,.35,"sine",.12,.1),this.tone(392,.5,"triangle",.1,.22);break;case"constellation":this.tone(523.25,.18,"sine",.16,0),this.tone(659.25,.2,"sine",.16,.08),this.tone(783.99,.22,"sine",.18,.16),this.tone(1046.5,.35,"triangle",.16,.24),this.tone(2093,.15,"sine",.08,.3);break;case"uiHover":this.tone(880,.05,"sine",.05);break;case"uiClick":this.tone(660,.07,"sine",.1);break;case"chronicle":this.tone(196,.6,"sine",.18,0),this.tone(261.63,.55,"sine",.14,.05),this.tone(392,.5,"sine",.1,.1),this.tone(523.25,.4,"triangle",.08,.18),this.tone(783.99,.3,"sine",.05,.25);break;case"chronicleOpen":this.tone(440,.08,"sine",.06,0),this.tone(587.33,.1,"sine",.05,.04),this.tone(880,.06,"triangle",.04,.1)}}}let tF=null;function tH(){return tF||(tF=new tz),tF}function tW(e,t){tH().play(e,t)}let tq="#34d399",tK="#e879f9",tU="#fb7185",tV="#fbbf24";function tX(e){return e>=5?tV:e>=3?tK:tq}function tY(){let e=tn(e=>e.pulse),t=tn(e=>e.crystals),a=tn(e=>e.crystalsPerSec),s=tn(e=>e.crystalCap),r=tn(e=>e._combo),{toast:n}=(0,tO.useToast)(),[o,l]=(0,v.useState)([]),i=(0,v.useRef)(0),c=(0,v.useRef)(null),d=(0,v.useRef)(null);(0,v.useRef)(0);let[u,h]=(0,v.useState)(0),f=(0,v.useRef)([]),m=(0,v.useRef)([]),p=(0,v.useRef)([]),x=(0,v.useRef)([]),g=(0,v.useRef)(r),b=(0,v.useRef)(0),y=(0,v.useRef)(t),j=(0,v.useRef)(s);(0,v.useEffect)(()=>{g.current=r,y.current=t,j.current=s},[r,t,s]);let N=(0,v.useRef)({x:0,y:0,inside:!1}),k=(0,v.useCallback)((e,t)=>{let a=.28*Math.min(e,t),s=[];[{count:14,rMul:.95,speed:.6,color:tq},{count:10,rMul:1.15,speed:-.4,color:tK},{count:8,rMul:1.35,speed:.3,color:tU}].forEach(e=>{for(let t=0;t<e.count;t++)s.push({angle:2*Math.PI*t/e.count+.3*Math.random(),radius:a*e.rMul,baseRadius:a*e.rMul,speed:e.speed*(.8+.4*Math.random()),size:1.5+2*Math.random(),color:e.color,alpha:.5+.4*Math.random(),phase:Math.random()*Math.PI*2})}),f.current=s;let r=[];for(let a=0;a<40;a++)r.push({x:Math.random()*e,y:Math.random()*t,vx:(Math.random()-.5)*8,vy:(Math.random()-.5)*8,size:.5+1.5*Math.random(),alpha:.2+.5*Math.random(),twinkle:Math.random()*Math.PI*2});m.current=r},[]),M=(0,v.useCallback)((e,t,a)=>{let s=tX(a.combo),r=performance.now();p.current.push({born:r,color:tq,maxRadius:140,duration:700}),a.combo>=3&&p.current.push({born:r+100,color:tK,maxRadius:170,duration:800}),a.combo>=5&&p.current.push({born:r+200,color:tV,maxRadius:200,duration:900});let n=10+2*Math.min(10,a.combo);for(let a=0;a<n;a++){let o=2*Math.PI*a/n+.4*Math.random(),l=120+180*Math.random();x.current.push({x:e,y:t,vx:Math.cos(o)*l,vy:Math.sin(o)*l,size:2+3*Math.random(),color:s,born:r,life:600+300*Math.random()})}f.current.forEach(e=>{e.radius=e.baseRadius*(1.25+.15*Math.random())})},[]),S=(0,v.useCallback)(t=>{let a=e();if(!a)return;let s=t.currentTarget.getBoundingClientRect(),r=t.clientX-s.left,o=t.clientY-s.top,c=i.current++,d=tX(a.combo);l(e=>[...e,{id:c,x:r,y:o,text:`+${a.gain.toFixed(1)}`,born:Date.now(),color:d}]),M(r,o,a),h(e=>e+1),tW(a.combo>=3?"pulseCombo":"pulse",{combo:a.combo}),setTimeout(()=>{l(e=>e.filter(e=>e.id!==c))},900),a.combo>=5&&a.combo%5==0&&n({title:`\xd7${a.combo} 连击!`,description:"谐振叠加,产能飙升。"})},[e,n,M]);(0,v.useEffect)(()=>{let e=c.current,t=d.current;if(!e||!t)return;let a=e.getContext("2d");if(!a)return;let s=0,r=performance.now(),n=Math.min(window.devicePixelRatio||1,2),o=()=>{let s=t.getBoundingClientRect();n=Math.min(window.devicePixelRatio||1,2),e.width=Math.max(1,Math.floor(s.width*n)),e.height=Math.max(1,Math.floor(s.height*n)),e.style.width=`${s.width}px`,e.style.height=`${s.height}px`,a.setTransform(n,0,0,n,0,0),k(s.width,s.height)};o();let l=new ResizeObserver(o);l.observe(t);let i=t=>{let o=Math.min(.05,(t-r)/1e3);r=t;let l=e.width/n,c=e.height/n,d=l/2,u=c/2,h=.28*Math.min(l,c);a.clearRect(0,0,l,c),m.current.forEach(e=>{e.x+=e.vx*o,e.y+=e.vy*o,e.twinkle+=2*o,e.x<0&&(e.x=l),e.x>l&&(e.x=0),e.y<0&&(e.y=c),e.y>c&&(e.y=0);let t=.5+.5*Math.sin(e.twinkle);a.globalAlpha=e.alpha*t,a.fillStyle="#ffffff",a.beginPath(),a.arc(e.x,e.y,e.size,0,2*Math.PI),a.fill()}),a.globalAlpha=1;let g=.85+.15*Math.sin(.001*t),w=a.createRadialGradient(d,u,.3*h,d,u,2.2*h);w.addColorStop(0,`rgba(52,211,153,${.18*g})`),w.addColorStop(.5,`rgba(232,121,249,${.1*g})`),w.addColorStop(1,"rgba(0,0,0,0)"),a.fillStyle=w,a.fillRect(0,0,l,c),a.lineWidth=2.5,a.strokeStyle="rgba(255,255,255,0.06)",a.beginPath(),a.arc(d,u,1.45*h,0,2*Math.PI),a.stroke();let v=Math.min(100,y.current/Math.max(1,j.current)*100);b.current=v;let k=1.45*h,M=a.createLinearGradient(d-k,u-k,d+k,u+k);M.addColorStop(0,tq),M.addColorStop(.5,tK),M.addColorStop(1,tU),a.strokeStyle=M,a.lineWidth=3,a.lineCap="round",a.shadowBlur=8,a.shadowColor=tq,a.beginPath(),a.arc(d,u,k,-Math.PI/2,-Math.PI/2+2*Math.PI*v/100),a.stroke(),a.shadowBlur=0,f.current.forEach(e=>{e.angle+=e.speed*o,e.radius+=(e.baseRadius-e.radius)*Math.min(1,4*o);let s=d+Math.cos(e.angle)*e.radius,r=u+Math.sin(e.angle)*e.radius,n=.7+.3*Math.sin(.005*t+e.phase);a.globalAlpha=e.alpha*n,a.fillStyle=e.color,a.shadowBlur=10,a.shadowColor=e.color,a.beginPath(),a.arc(s,r,e.size,0,2*Math.PI),a.fill(),a.globalAlpha=e.alpha*n*.4,a.strokeStyle=e.color,a.lineWidth=.6*e.size,a.beginPath(),a.moveTo(s,r),a.lineTo(d+Math.cos(e.angle-.08*e.speed)*(e.radius-2),u+Math.sin(e.angle-.08*e.speed)*(e.radius-2)),a.stroke()}),a.globalAlpha=1,a.shadowBlur=0;let S=.95*h,C=0,_=0;if(N.current.inside){let e=N.current.x-d,t=N.current.y-u,a=Math.hypot(e,t);a>.1&&(C=e/a*Math.min(8,.05*a),_=t/a*Math.min(8,.05*a))}let T=d+C,P=u+_,R=a.createRadialGradient(T-.25*S,P-.3*S,.1*S,T,P,S);R.addColorStop(0,"rgba(255,255,255,0.95)"),R.addColorStop(.3,`rgba(52,211,153,${.85*g})`),R.addColorStop(.65,"rgba(232,121,249,0.55)"),R.addColorStop(1,"rgba(251,113,133,0.2)"),a.fillStyle=R,a.shadowBlur=30,a.shadowColor=tq,a.beginPath(),a.arc(T,P,S,0,2*Math.PI),a.fill(),a.save(),a.translate(T,P),a.globalAlpha=.25,a.strokeStyle="rgba(255,255,255,0.6)",a.lineWidth=.8;let E=.7*S;for(let e=0;e<3;e++){let s=E*(1-.3*e);a.beginPath();for(let r=0;r<6;r++){let n=Math.PI/3*r+2e-4*t*(e%2?1:-1),o=Math.cos(n)*s,l=Math.sin(n)*s;0===r?a.moveTo(o,l):a.lineTo(o,l)}a.closePath(),a.stroke()}a.restore(),a.globalAlpha=.4,a.fillStyle="#ffffff",a.beginPath(),a.ellipse(T-.25*S,P-.35*S,.35*S,.18*S,-.4,0,2*Math.PI),a.fill(),a.globalAlpha=1,a.shadowBlur=0,p.current=p.current.filter(e=>{let s=t-e.born;if(s<0||s>e.duration)return s<=e.duration+50;let r=s/e.duration,n=e.maxRadius*r;return a.globalAlpha=(1-r)*.8,a.strokeStyle=e.color,a.lineWidth=2.5*(1-.5*r),a.shadowBlur=12,a.shadowColor=e.color,a.beginPath(),a.arc(d,u,n,0,2*Math.PI),a.stroke(),a.shadowBlur=0,!0}),p.current=p.current.filter(e=>t-e.born<e.duration),a.globalAlpha=1,x.current=x.current.filter(e=>{let s=t-e.born;if(s>e.life)return!1;e.x+=e.vx*o,e.y+=e.vy*o,e.vx*=.96,e.vy*=.96;let r=s/e.life;return a.globalAlpha=1-r,a.fillStyle=e.color,a.shadowBlur=8,a.shadowColor=e.color,a.beginPath(),a.arc(e.x,e.y,e.size*(1-.5*r),0,2*Math.PI),a.fill(),!0}),a.globalAlpha=1,a.shadowBlur=0,s=requestAnimationFrame(i)};return s=requestAnimationFrame(i),()=>{cancelAnimationFrame(s),l.disconnect()}},[k]);let C=(0,v.useCallback)(e=>{let t=e.currentTarget.getBoundingClientRect();N.current={x:e.clientX-t.left,y:e.clientY-t.top,inside:!0}},[]),_=(0,v.useCallback)(()=>{N.current.inside=!1},[]),T=Math.min(100,t/Math.max(1,s)*100);return(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 relative flex flex-col items-center justify-center gap-4 select-none",children:[r>1&&(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 absolute -top-2 left-1/2 -translate-x-1/2 px-3 py-1 rounded-full bg-rose-500/20 border border-rose-400/40 text-rose-200 text-xs font-mono animate-pulse z-10",children:["×",r," 连击"]}),(0,w.jsxs)("button",{onClick:S,onMouseMove:C,onMouseLeave:_,"aria-label":"脉冲扫描,获取记忆晶体",className:"jsx-dda3ce20a1930cc3 relative h-52 w-52 sm:h-64 sm:w-64 rounded-full focus:outline-none group",children:[(0,w.jsx)("div",{ref:d,className:"jsx-dda3ce20a1930cc3 absolute inset-0 rounded-full overflow-hidden",children:(0,w.jsx)("canvas",{ref:c,className:"jsx-dda3ce20a1930cc3 block w-full h-full"})}),(0,w.jsxs)("div",{style:{animation:"echo-spin 18s linear infinite"},className:"jsx-dda3ce20a1930cc3 absolute inset-2 rounded-full border border-emerald-400/30 pointer-events-none",children:[(0,w.jsx)("div",{className:"jsx-dda3ce20a1930cc3 absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 h-2 w-2 rounded-full bg-emerald-300 shadow-[0_0_8px_#34d399]"}),(0,w.jsx)("div",{className:"jsx-dda3ce20a1930cc3 absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 h-1.5 w-1.5 rounded-full bg-rose-300 shadow-[0_0_8px_#fb7185]"})]}),(0,w.jsx)("div",{style:{animation:"echo-spin 24s linear infinite reverse"},className:"jsx-dda3ce20a1930cc3 absolute inset-6 rounded-full border border-fuchsia-400/20 border-dashed pointer-events-none"}),(0,w.jsx)("div",{style:{animation:"echo-ring 0.7s ease-out forwards"},className:"jsx-dda3ce20a1930cc3 absolute inset-8 rounded-full border-2 border-emerald-400/60 pointer-events-none"},`ring-${u}`),o.map(e=>(0,w.jsx)("span",{style:{left:e.x,top:e.y,color:e.color,transform:"translate(-50%, -50%)",animation:"echo-float 0.9s ease-out forwards",textShadow:`0 0 8px ${e.color}`},className:"jsx-dda3ce20a1930cc3 absolute pointer-events-none font-mono font-bold text-sm z-10",children:e.text},e.id))]}),(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-center",children:[(0,w.jsx)("div",{style:{textShadow:"0 0 12px rgba(52,211,153,0.5)"},className:"jsx-dda3ce20a1930cc3 text-2xl font-mono font-bold text-emerald-300",children:O(t)}),(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-xs text-muted-foreground mt-0.5",children:["记忆晶体 · ",a.toFixed(1),"/s · 上限"," ",O(s)]}),(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-[11px] text-muted-foreground/70 mt-2",children:["点击晶体发起",(0,w.jsx)("span",{className:"jsx-dda3ce20a1930cc3 text-emerald-300",children:"脉冲扫描"}),",连击叠加加成"]}),(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-[10px] text-muted-foreground/50 mt-1 tabular-nums",children:["仓库 ",T.toFixed(1),"% · 连击 ×",Math.max(1,r)]})]}),(0,w.jsx)(tD.default,{id:"dda3ce20a1930cc3",children:"@keyframes echo-spin{to{transform:rotate(360deg)}}@keyframes echo-float{0%{opacity:1;transform:translate(-50%,-50%)scale(1)}to{opacity:0;transform:translate(-50%,-180%)scale(1.3)}}@keyframes echo-ring{0%{opacity:.8;transform:scale(.8)}to{opacity:0;transform:scale(1.6)}}"})]})}let tG=(0,e.i(25913).cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function tJ({className:e,variant:t,size:a,asChild:s=!1,...r}){return(0,w.jsx)(s?tx:"button",{"data-slot":"button",className:(0,tA.cn)(tG({variant:t,size:a,className:e})),...r})}var tQ=e.i(37727);let tZ=(0,to.default)("sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]),t0=(0,to.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),t1=(0,to.default)("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),t2=(0,to.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);function t5(){let e=tn(e=>e.activePuzzle),t=tn(e=>e.clickNode),a=tn(e=>e.undoStep),s=tn(e=>e.retryPuzzle),r=tn(e=>e.abandonPuzzle),{toast:n}=(0,tO.useToast)(),[o,l]=(0,v.useState)(null),[i,c]=(0,v.useState)(null),[d,u]=(0,v.useState)(!1);if(!e)return null;let{grid:h,rows:f,cols:m,target:p,path:x,stepLimit:g,tier:b}=e,y=x.length,j=p[y],N=x.length>0&&x.length<p.length&&!ej(e),k=()=>{a(),u(!1),c(null)},M=100/m,S=100/f,C=x.map(e=>h.find(t=>t.id===e)).filter(Boolean);return(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex flex-col gap-4 h-full",children:[(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center justify-center gap-2 flex-wrap",children:[(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-xs text-muted-foreground mr-1",children:"目标谐振"}),p.map((e,t)=>{let a=t<y,s=t===y,r=R[e];return(0,w.jsxs)("div",{style:{background:`radial-gradient(circle at 35% 30%, ${r.hex}, ${r.hex}aa 60%, ${r.hex}44)`,boxShadow:s?`0 0 18px ${r.glow}, 0 0 36px ${r.glow}`:`0 0 8px ${r.glow}`,"--tw-ring-color":r.hex},className:`jsx-35ab0418fdc54847 relative h-9 w-9 rounded-full flex items-center justify-center transition-all duration-300 ${a?"opacity-30 scale-90":""} ${s?"scale-125 ring-2 ring-offset-2 ring-offset-background":""}`,children:[a&&(0,w.jsx)(t0,{className:"h-4 w-4 text-white"}),s&&(0,w.jsx)("span",{style:{color:r.hex},className:"jsx-35ab0418fdc54847 absolute -bottom-5 text-[10px] font-medium",children:"下一个"})]},t)})]}),(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 relative flex-1 min-h-[260px] rounded-2xl border border-white/10 bg-black/30 backdrop-blur-sm overflow-hidden",children:[(0,w.jsx)("div",{style:{backgroundImage:"linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px)",backgroundSize:`${M}% ${S}%`},className:"jsx-35ab0418fdc54847 absolute inset-0 opacity-20"}),(0,w.jsx)("svg",{className:"jsx-35ab0418fdc54847 absolute inset-0 w-full h-full pointer-events-none",children:C.map((e,t)=>{if(0===t)return null;let a=C[t-1],s=(a.col+.5)*M,r=(a.row+.5)*S,n=(e.col+.5)*M,o=(e.row+.5)*S,l=R[e.color];return(0,w.jsx)("line",{x1:`${s}%`,y1:`${r}%`,x2:`${n}%`,y2:`${o}%`,stroke:l.hex,strokeWidth:2.5,strokeLinecap:"round",style:{filter:`drop-shadow(0 0 4px ${l.glow})`},className:"jsx-35ab0418fdc54847 echo-path-line"},t)})}),h.map(a=>{let s=R[a.color],r=a.used,h=void 0!==j&&a.color===j&&!r,f=0===x.length&&h&&function(e,t){if(0!==e.path.length)return!1;let a=e.grid.find(e=>e.id===t);if(!a||a.used||a.color!==e.target[0])return!1;let s=JSON.parse(JSON.stringify(e));return s.grid.find(e=>e.id===t).used=!0,s.path.push(t),ej(s)}(e,a.id),p=0===x.length&&h&&!f,g=o===a.id,b=i?.id===a.id,y=(a.col+.5)*M,v=(a.row+.5)*S;return(0,w.jsx)("button",{onClick:()=>(e=>{let a=t(e.id);if(a.ok&&a.finished){u(!1),tW("decodeSuccess"),a.failReason&&a.failReason.split(",").filter(Boolean).length&&(tW("fragmentUnlock"),n({title:"✦ 记忆碎片浮现",description:"新的回响被拼入图谱,前往「记忆图谱」查看。"})),n({title:"谐振闭合!",description:"晶体解码成功,记忆已释放。"});return}a.ok?(tW("decodeClick",{color:e.color}),c({id:e.id,ok:!0}),setTimeout(()=>c(null),280),!1!==a.solvable||d||(u(!0),n({title:"谐振受阻",description:"此路不通,建议撤销上一步或重排。"})),!0===a.solvable&&u(!1)):(tW("decodeFail"),c({id:e.id,ok:!1}),setTimeout(()=>c(null),280))})(a),onMouseEnter:()=>l(a.id),onMouseLeave:()=>l(null),disabled:r,style:{left:`${y}%`,top:`${v}%`,width:`min(${100/m*.62}%, 56px)`,aspectRatio:"1",background:r?"rgba(255,255,255,0.04)":`radial-gradient(circle at 35% 30%, ${s.hex}, ${s.hex}cc 55%, ${s.hex}55)`,boxShadow:r?"inset 0 0 12px rgba(0,0,0,0.5)":f?`0 0 16px ${s.glow}, 0 0 32px ${s.glow}, inset 0 0 10px rgba(255,255,255,0.5)`:h?`0 0 10px ${s.glow}, 0 0 20px ${s.glow}, inset 0 0 6px rgba(255,255,255,0.3)`:`0 0 6px ${s.glow}`,border:f?`2px solid ${s.hex}`:h?`1.5px solid ${s.hex}aa`:"1px solid rgba(255,255,255,0.12)",opacity:r?.35:p?.5:1,transform:`translate(-50%, -50%) scale(${g&&!r?1.12:b?i?.ok?1.25:.8:1})`,animation:f?"echo-pulse 1.2s ease-in-out infinite":h&&!p?"echo-pulse 1.6s ease-in-out infinite":void 0},"aria-label":`${s.label}色节点 ${a.row+1}-${a.col+1}`,className:"jsx-35ab0418fdc54847 absolute rounded-full transition-[box-shadow,background,border,opacity] duration-200 focus:outline-none disabled:cursor-not-allowed",children:!r&&(0,w.jsx)("span",{style:{background:"radial-gradient(circle at 35% 30%, rgba(255,255,255,0.5), transparent 45%)"},className:"jsx-35ab0418fdc54847 absolute inset-0 rounded-full"})},a.id)})]}),N&&(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center gap-2 px-3 py-2 rounded-lg border border-rose-400/40 bg-rose-950/40 text-rose-200 text-xs animate-pulse",children:[(0,w.jsx)(t2,{className:"h-3.5 w-3.5 shrink-0"}),(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847",children:"谐振受阻,此路已无解。"}),(0,w.jsxs)(tJ,{size:"sm",variant:"outline",onClick:k,className:"h-6 px-2 ml-auto border-rose-400/50 text-rose-100 hover:bg-rose-500/20 text-[11px]",children:[(0,w.jsx)(t1,{className:"h-3 w-3 mr-1"}),"撤销"]})]}),(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center justify-between gap-3",children:[(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center gap-2 text-xs",children:[(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-muted-foreground",children:"步数"}),(0,w.jsxs)("span",{className:`jsx-35ab0418fdc54847 font-mono font-semibold ${x.length>=g?"text-rose-400":"text-foreground"}`,children:[x.length," / ",g]}),(0,w.jsxs)("span",{className:"jsx-35ab0418fdc54847 ml-2 text-muted-foreground",children:["T",b]})]}),(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center gap-1.5",children:[(0,w.jsxs)(tJ,{variant:"ghost",size:"sm",onClick:k,disabled:0===x.length,className:"h-7",children:[(0,w.jsx)(t1,{className:"h-3.5 w-3.5 mr-1"}),"撤销"]}),(0,w.jsxs)(tJ,{variant:"ghost",size:"sm",onClick:()=>{s(),u(!1),c(null)},className:"h-7",children:[(0,w.jsx)(td,{className:"h-3.5 w-3.5 mr-1"}),"重排"]}),(0,w.jsxs)(tJ,{variant:"ghost",size:"sm",onClick:()=>{r(),c(null),u(!1)},className:"h-7",children:[(0,w.jsx)(tQ.X,{className:"h-3.5 w-3.5 mr-1"}),"放回"]})]})]}),(0,w.jsx)("p",{className:"jsx-35ab0418fdc54847 text-[11px] text-muted-foreground/80 text-center leading-relaxed",children:0===x.length?(0,w.jsxs)(w.Fragment,{children:["点击",(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-emerald-300",children:"高亮"}),"的可行起点开始,按目标顺序走",(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-emerald-300",children:"相邻同色"}),"节点;走错可",(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-rose-300",children:"撤销"}),"。"]}):(0,w.jsxs)(w.Fragment,{children:["按「目标谐振」顺序,点击",(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-emerald-300",children:"上下左右相邻"}),"的同色节点。每个节点仅可使用一次;走错可",(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-rose-300",children:"撤销"}),"。"]})}),(0,w.jsx)(tD.default,{id:"35ab0418fdc54847",children:"@keyframes echo-pulse{0%,to{filter:brightness()}50%{filter:brightness(1.4)}}@keyframes echo-line{0%{stroke-dashoffset:100px}to{stroke-dashoffset:0}}.echo-path-line{stroke-dasharray:100;animation:.4s ease-out forwards echo-line}"})]})}function t3(){let e=tn(e=>e.activePuzzle),t=tn(e=>e.pendingCrystals),a=tn(e=>e.startDecode),s=tn(e=>e.crystalsPerSec),r=tn(e=>e.crystalCap),n=tn(e=>e.crystals);return e?(0,w.jsxs)("div",{className:"h-full flex flex-col",children:[(0,w.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,w.jsx)(tZ,{className:"h-4 w-4 text-rose-400"}),(0,w.jsx)("h3",{className:"text-sm font-semibold",children:"解码共振阵列"})]}),(0,w.jsx)("div",{className:"flex-1 min-h-0",children:(0,w.jsx)(t5,{})})]}):(0,w.jsxs)("div",{className:"jsx-53059b9e32765d5f h-full flex flex-col",children:[(0,w.jsxs)("div",{className:"jsx-53059b9e32765d5f flex items-center gap-2 mb-3",children:[(0,w.jsx)(tZ,{className:"h-4 w-4 text-rose-400"}),(0,w.jsx)("h3",{className:"jsx-53059b9e32765d5f text-sm font-semibold",children:"待解码晶体"}),(0,w.jsxs)("span",{className:"jsx-53059b9e32765d5f text-xs text-muted-foreground ml-auto",children:["产能 ",s.toFixed(1),"/s · ",Math.floor(n),"/",Math.floor(r)]})]}),0===t.length?(0,w.jsxs)("div",{className:"jsx-53059b9e32765d5f flex-1 flex flex-col items-center justify-center text-center gap-3 rounded-2xl border border-dashed border-white/10 bg-black/20 p-6",children:[(0,w.jsxs)("div",{className:"jsx-53059b9e32765d5f relative h-16 w-16",children:[(0,w.jsx)("div",{className:"jsx-53059b9e32765d5f absolute inset-0 rounded-full bg-rose-500/20 blur-xl animate-pulse"}),(0,w.jsx)("div",{className:"jsx-53059b9e32765d5f absolute inset-2 rounded-full border-2 border-rose-400/40 rotate-45"}),(0,w.jsx)("div",{className:"jsx-53059b9e32765d5f absolute inset-4 rounded-full bg-rose-500/30"})]}),(0,w.jsx)("p",{className:"jsx-53059b9e32765d5f text-sm text-muted-foreground",children:"晶体正在生成中…"}),(0,w.jsx)("p",{className:"jsx-53059b9e32765d5f text-xs text-muted-foreground/70 max-w-[220px]",children:"自治无人机每数秒回收一颗记忆晶体,点击下方晶体开启解码。"})]}):(0,w.jsx)("div",{className:"jsx-53059b9e32765d5f flex-1 grid grid-cols-2 sm:grid-cols-3 gap-3 content-start max-h-[420px] overflow-y-auto echo-scroll pr-1",children:t.map(e=>(0,w.jsx)(t4,{crystal:e,onClick:()=>a(e.id)},e.id))}),(0,w.jsx)(tD.default,{id:"53059b9e32765d5f",children:".echo-scroll::-webkit-scrollbar{width:6px}.echo-scroll::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:3px}.echo-scroll::-webkit-scrollbar-track{background:0 0}"})]})}function t4({crystal:e,onClick:t}){let a=1===e.tier?"#34d399":2===e.tier?"#fbbf24":"#e879f9",s=1===e.tier?"常见":2===e.tier?"稀有":"史诗";return(0,w.jsxs)("button",{onClick:t,className:"group relative aspect-square rounded-2xl border border-white/10 bg-black/40 hover:border-white/30 transition-all duration-300 hover:scale-[1.03] focus:outline-none overflow-hidden",style:{boxShadow:`inset 0 0 24px ${a}22`},children:[(0,w.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,w.jsxs)("div",{className:"relative h-12 w-12 transition-transform duration-500 group-hover:rotate-180",style:{filter:`drop-shadow(0 0 12px ${a}88)`},children:[(0,w.jsx)("div",{className:"absolute inset-0 rotate-45 rounded-md",style:{background:`linear-gradient(135deg, ${a}, ${a}66)`,border:`1px solid ${a}`}}),(0,w.jsx)("div",{className:"absolute inset-2 rotate-45 rounded-sm",style:{background:"linear-gradient(135deg, rgba(255,255,255,0.5), transparent)"}})]})}),(0,w.jsxs)("div",{className:"absolute top-1.5 left-1.5 text-[10px] font-mono px-1.5 py-0.5 rounded bg-black/50",style:{color:a},children:["T",e.tier]}),(0,w.jsx)("div",{className:"absolute bottom-1.5 right-1.5 text-[10px] text-white/70",children:s}),(0,w.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-end justify-center pb-2",children:(0,w.jsx)("span",{className:"text-[11px] font-medium text-white",children:"解码 →"})})]})}function t9({className:e,...t}){return(0,w.jsx)("div",{"data-slot":"card",className:(0,tA.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}let t7=(0,to.default)("pickaxe",[["path",{d:"M14.531 12.469 6.619 20.38a1 1 0 1 1-3-3l7.912-7.912",key:"we99rg"}],["path",{d:"M15.686 4.314A12.5 12.5 0 0 0 5.461 2.958 1 1 0 0 0 5.58 4.71a22 22 0 0 1 6.318 3.393",key:"1w6hck"}],["path",{d:"M17.7 3.7a1 1 0 0 0-1.4 0l-4.6 4.6a1 1 0 0 0 0 1.4l2.6 2.6a1 1 0 0 0 1.4 0l4.6-4.6a1 1 0 0 0 0-1.4z",key:"15hgfx"}],["path",{d:"M19.686 8.314a12.501 12.501 0 0 1 1.356 10.225 1 1 0 0 1-1.751-.119 22 22 0 0 0-3.393-6.319",key:"452b4h"}]]),t6=(0,to.default)("scan-line",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]),t8=(0,to.default)("rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]),ae=(0,to.default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),at=(0,to.default)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),aa={Pickaxe:t7,ScanLine:t6,Rocket:t8,BookOpen:ae},as={mining:"#34d399",decoding:"#fb7185",expedition:"#fbbf24",narrative:"#e879f9"};function ar(){let e=tn(e=>e.tech),t=tn(e=>e.insights),a=tn(e=>e.buyTech);return(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex flex-col gap-3 h-full",children:[(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center justify-between",children:[(0,w.jsx)("h3",{className:"jsx-fbf3fdae687a84dd text-sm font-semibold",children:"技术树"}),(0,w.jsxs)("span",{className:"jsx-fbf3fdae687a84dd text-xs text-muted-foreground",children:["洞见 ",(0,w.jsx)("span",{className:"jsx-fbf3fdae687a84dd text-amber-300 font-mono",children:O(t)})]})]}),(0,w.jsx)("div",{className:"jsx-fbf3fdae687a84dd flex-1 overflow-y-auto echo-scroll pr-1 space-y-3",children:["mining","decoding","expedition","narrative"].map(s=>{let r=A[s],n=aa[r.icon],o=as[s],l=E.filter(e=>e.branch===s);return(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd",children:[(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center gap-2 mb-1.5 px-1",children:[(0,w.jsx)(n,{className:"jsx-fbf3fdae687a84dd h-3.5 w-3.5"}),(0,w.jsx)("span",{style:{color:o},className:"jsx-fbf3fdae687a84dd text-xs font-medium",children:r.name}),(0,w.jsx)("span",{className:"jsx-fbf3fdae687a84dd text-[10px] text-muted-foreground/70",children:r.desc})]}),(0,w.jsx)("div",{className:"jsx-fbf3fdae687a84dd grid gap-1.5",children:l.map(s=>{let r=(e[s.id]??0)>=1,n=t>=s.cost;return(0,w.jsx)(t9,{className:`p-2.5 transition-all duration-200 ${r?"bg-white/5 border-white/10":n?"bg-black/30 border-white/15 hover:border-white/30 cursor-pointer":"bg-black/20 border-white/5 opacity-60"}`,style:r?{boxShadow:`inset 0 0 0 1px ${o}44, 0 0 12px ${o}22`}:void 0,children:(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center gap-2",children:[(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex-1 min-w-0",children:[(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center gap-1.5",children:[(0,w.jsx)("span",{style:{color:r?o:void 0},className:"jsx-fbf3fdae687a84dd text-xs font-semibold truncate",children:s.name}),r&&(0,w.jsx)(t0,{className:"h-3 w-3",style:{color:o}})]}),(0,w.jsx)("p",{className:"jsx-fbf3fdae687a84dd text-[10px] text-muted-foreground/80 truncate",children:s.desc})]}),!r&&(0,w.jsxs)(tJ,{size:"sm",variant:n?"default":"ghost",disabled:!n,onClick:()=>{a(s.id)&&tW("techBuy")},className:"h-7 px-2 text-[11px] shrink-0",style:n?{background:`${o}22`,border:`1px solid ${o}66`,color:o}:void 0,children:[(0,w.jsx)(at,{className:"h-2.5 w-2.5 mr-1"}),s.cost]})]})},s.id)})})]},s)})}),(0,w.jsx)(tD.default,{id:"fbf3fdae687a84dd",children:".echo-scroll::-webkit-scrollbar{width:5px}.echo-scroll::-webkit-scrollbar-thumb{background:#ffffff1f;border-radius:3px}.echo-scroll::-webkit-scrollbar-track{background:0 0}"})]})}var an=e.i(48425),ao=e.i(96626),al=e.i(30030),ai=e.i(30207),ac=v.createContext(void 0);function ad(e){let t=v.useContext(ac);return e||t||"ltr"}var au=e.i(34620),ah=e.i(81140),af="ScrollArea",[am,ap]=(0,al.createContextScope)(af),[ax,ag]=am(af),ab=v.forwardRef((e,t)=>{let{__scopeScrollArea:a,type:s="hover",dir:r,scrollHideDelay:n=600,...o}=e,[l,i]=v.useState(null),[c,d]=v.useState(null),[u,h]=v.useState(null),[f,m]=v.useState(null),[p,x]=v.useState(null),[g,b]=v.useState(0),[y,j]=v.useState(0),[N,k]=v.useState(!1),[M,S]=v.useState(!1),C=(0,tu.useComposedRefs)(t,e=>i(e)),_=ad(r);return(0,w.jsx)(ax,{scope:a,type:s,dir:_,scrollHideDelay:n,scrollArea:l,viewport:c,onViewportChange:d,content:u,onContentChange:h,scrollbarX:f,onScrollbarXChange:m,scrollbarXEnabled:N,onScrollbarXEnabledChange:k,scrollbarY:p,onScrollbarYChange:x,scrollbarYEnabled:M,onScrollbarYEnabledChange:S,onCornerWidthChange:b,onCornerHeightChange:j,children:(0,w.jsx)(an.Primitive.div,{dir:_,...o,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":y+"px",...e.style}})})});ab.displayName=af;var ay="ScrollAreaViewport",aw=v.forwardRef((e,t)=>{let{__scopeScrollArea:a,children:s,nonce:r,...n}=e,o=ag(ay,a),l=v.useRef(null),i=(0,tu.useComposedRefs)(t,l,o.onViewportChange);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),(0,w.jsx)(an.Primitive.div,{"data-radix-scroll-area-viewport":"",...n,ref:i,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,w.jsx)("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});aw.displayName=ay;var av="ScrollAreaScrollbar",aj=v.forwardRef((e,t)=>{let{forceMount:a,...s}=e,r=ag(av,e.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:o}=r,l="horizontal"===e.orientation;return v.useEffect(()=>(l?n(!0):o(!0),()=>{l?n(!1):o(!1)}),[l,n,o]),"hover"===r.type?(0,w.jsx)(aN,{...s,ref:t,forceMount:a}):"scroll"===r.type?(0,w.jsx)(ak,{...s,ref:t,forceMount:a}):"auto"===r.type?(0,w.jsx)(aM,{...s,ref:t,forceMount:a}):"always"===r.type?(0,w.jsx)(aS,{...s,ref:t}):null});aj.displayName=av;var aN=v.forwardRef((e,t)=>{let{forceMount:a,...s}=e,r=ag(av,e.__scopeScrollArea),[n,o]=v.useState(!1);return v.useEffect(()=>{let e=r.scrollArea,t=0;if(e){let a=()=>{window.clearTimeout(t),o(!0)},s=()=>{t=window.setTimeout(()=>o(!1),r.scrollHideDelay)};return e.addEventListener("pointerenter",a),e.addEventListener("pointerleave",s),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",a),e.removeEventListener("pointerleave",s)}}},[r.scrollArea,r.scrollHideDelay]),(0,w.jsx)(ao.Presence,{present:a||n,children:(0,w.jsx)(aM,{"data-state":n?"visible":"hidden",...s,ref:t})})}),ak=v.forwardRef((e,t)=>{var a;let{forceMount:s,...r}=e,n=ag(av,e.__scopeScrollArea),o="horizontal"===e.orientation,l=aq(()=>c("SCROLL_END"),100),[i,c]=(a={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},v.useReducer((e,t)=>a[e][t]??e,"hidden"));return v.useEffect(()=>{if("idle"===i){let e=window.setTimeout(()=>c("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(e)}},[i,n.scrollHideDelay,c]),v.useEffect(()=>{let e=n.viewport,t=o?"scrollLeft":"scrollTop";if(e){let a=e[t],s=()=>{let s=e[t];a!==s&&(c("SCROLL"),l()),a=s};return e.addEventListener("scroll",s),()=>e.removeEventListener("scroll",s)}},[n.viewport,o,c,l]),(0,w.jsx)(ao.Presence,{present:s||"hidden"!==i,children:(0,w.jsx)(aS,{"data-state":"hidden"===i?"hidden":"visible",...r,ref:t,onPointerEnter:(0,ah.composeEventHandlers)(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:(0,ah.composeEventHandlers)(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),aM=v.forwardRef((e,t)=>{let a=ag(av,e.__scopeScrollArea),{forceMount:s,...r}=e,[n,o]=v.useState(!1),l="horizontal"===e.orientation,i=aq(()=>{if(a.viewport){let e=a.viewport.offsetWidth<a.viewport.scrollWidth,t=a.viewport.offsetHeight<a.viewport.scrollHeight;o(l?e:t)}},10);return aK(a.viewport,i),aK(a.content,i),(0,w.jsx)(ao.Presence,{present:s||n,children:(0,w.jsx)(aS,{"data-state":n?"visible":"hidden",...r,ref:t})})}),aS=v.forwardRef((e,t)=>{let{orientation:a="vertical",...s}=e,r=ag(av,e.__scopeScrollArea),n=v.useRef(null),o=v.useRef(0),[l,i]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=aL(l.viewport,l.content),d={...s,sizes:l,onSizesChange:i,hasThumb:!!(c>0&&c<1),onThumbChange:e=>n.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function u(e,t){return function(e,t,a,s="ltr"){let r=az(a),n=t||r/2,o=a.scrollbar.paddingStart+n,l=a.scrollbar.size-a.scrollbar.paddingEnd-(r-n),i=a.content-a.viewport;return aH([o,l],"ltr"===s?[0,i]:[-1*i,0])(e)}(e,o.current,l,t)}return"horizontal"===a?(0,w.jsx)(aC,{...d,ref:t,onThumbPositionChange:()=>{if(r.viewport&&n.current){let e=aF(r.viewport.scrollLeft,l,r.dir);n.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{r.viewport&&(r.viewport.scrollLeft=e)},onDragScroll:e=>{r.viewport&&(r.viewport.scrollLeft=u(e,r.dir))}}):"vertical"===a?(0,w.jsx)(a_,{...d,ref:t,onThumbPositionChange:()=>{if(r.viewport&&n.current){let e=aF(r.viewport.scrollTop,l);n.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{r.viewport&&(r.viewport.scrollTop=e)},onDragScroll:e=>{r.viewport&&(r.viewport.scrollTop=u(e))}}):null}),aC=v.forwardRef((e,t)=>{let{sizes:a,onSizesChange:s,...r}=e,n=ag(av,e.__scopeScrollArea),[o,l]=v.useState(),i=v.useRef(null),c=(0,tu.useComposedRefs)(t,i,n.onScrollbarXChange);return v.useEffect(()=>{i.current&&l(getComputedStyle(i.current))},[i]),(0,w.jsx)(aR,{"data-orientation":"horizontal",...r,ref:c,sizes:a,style:{bottom:0,left:"rtl"===n.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===n.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":az(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,a)=>{if(n.viewport){var s,r;let o=n.viewport.scrollLeft+t.deltaX;e.onWheelScroll(o),s=o,r=a,s>0&&s<r&&t.preventDefault()}},onResize:()=>{i.current&&n.viewport&&o&&s({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:aO(o.paddingLeft),paddingEnd:aO(o.paddingRight)}})}})}),a_=v.forwardRef((e,t)=>{let{sizes:a,onSizesChange:s,...r}=e,n=ag(av,e.__scopeScrollArea),[o,l]=v.useState(),i=v.useRef(null),c=(0,tu.useComposedRefs)(t,i,n.onScrollbarYChange);return v.useEffect(()=>{i.current&&l(getComputedStyle(i.current))},[i]),(0,w.jsx)(aR,{"data-orientation":"vertical",...r,ref:c,sizes:a,style:{top:0,right:"ltr"===n.dir?0:void 0,left:"rtl"===n.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":az(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,a)=>{if(n.viewport){var s,r;let o=n.viewport.scrollTop+t.deltaY;e.onWheelScroll(o),s=o,r=a,s>0&&s<r&&t.preventDefault()}},onResize:()=>{i.current&&n.viewport&&o&&s({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:aO(o.paddingTop),paddingEnd:aO(o.paddingBottom)}})}})}),[aT,aP]=am(av),aR=v.forwardRef((e,t)=>{let{__scopeScrollArea:a,sizes:s,hasThumb:r,onThumbChange:n,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:i,onDragScroll:c,onWheelScroll:d,onResize:u,...h}=e,f=ag(av,a),[m,p]=v.useState(null),x=(0,tu.useComposedRefs)(t,e=>p(e)),g=v.useRef(null),b=v.useRef(""),y=f.viewport,j=s.content-s.viewport,N=(0,ai.useCallbackRef)(d),k=(0,ai.useCallbackRef)(i),M=aq(u,10);function S(e){g.current&&c({x:e.clientX-g.current.left,y:e.clientY-g.current.top})}return v.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&N(e,j)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[y,m,j,N]),v.useEffect(k,[s,k]),aK(m,M),aK(f.content,M),(0,w.jsx)(aT,{scope:a,scrollbar:m,hasThumb:r,onThumbChange:(0,ai.useCallbackRef)(n),onThumbPointerUp:(0,ai.useCallbackRef)(o),onThumbPositionChange:k,onThumbPointerDown:(0,ai.useCallbackRef)(l),children:(0,w.jsx)(an.Primitive.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:(0,ah.composeEventHandlers)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),g.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),S(e))}),onPointerMove:(0,ah.composeEventHandlers)(e.onPointerMove,S),onPointerUp:(0,ah.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),g.current=null})})})}),aE="ScrollAreaThumb",aA=v.forwardRef((e,t)=>{let{forceMount:a,...s}=e,r=aP(aE,e.__scopeScrollArea);return(0,w.jsx)(ao.Presence,{present:a||r.hasThumb,children:(0,w.jsx)(a$,{ref:t,...s})})}),a$=v.forwardRef((e,t)=>{let{__scopeScrollArea:a,style:s,...r}=e,n=ag(aE,a),o=aP(aE,a),{onThumbPositionChange:l}=o,i=(0,tu.useComposedRefs)(t,e=>o.onThumbChange(e)),c=v.useRef(void 0),d=aq(()=>{c.current&&(c.current(),c.current=void 0)},100);return v.useEffect(()=>{let e=n.viewport;if(e){let t=()=>{d(),c.current||(c.current=aW(e,l),l())};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[n.viewport,d,l]),(0,w.jsx)(an.Primitive.div,{"data-state":o.hasThumb?"visible":"hidden",...r,ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:(0,ah.composeEventHandlers)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),a=e.clientX-t.left,s=e.clientY-t.top;o.onThumbPointerDown({x:a,y:s})}),onPointerUp:(0,ah.composeEventHandlers)(e.onPointerUp,o.onThumbPointerUp)})});aA.displayName=aE;var aB="ScrollAreaCorner",aI=v.forwardRef((e,t)=>{let a=ag(aB,e.__scopeScrollArea),s=!!(a.scrollbarX&&a.scrollbarY);return"scroll"!==a.type&&s?(0,w.jsx)(aD,{...e,ref:t}):null});aI.displayName=aB;var aD=v.forwardRef((e,t)=>{let{__scopeScrollArea:a,...s}=e,r=ag(aB,a),[n,o]=v.useState(0),[l,i]=v.useState(0),c=!!(n&&l);return aK(r.scrollbarX,()=>{let e=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(e),i(e)}),aK(r.scrollbarY,()=>{let e=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(e),o(e)}),c?(0,w.jsx)(an.Primitive.div,{...s,ref:t,style:{width:n,height:l,position:"absolute",right:"ltr"===r.dir?0:void 0,left:"rtl"===r.dir?0:void 0,bottom:0,...e.style}}):null});function aO(e){return e?parseInt(e,10):0}function aL(e,t){let a=e/t;return isNaN(a)?0:a}function az(e){let t=aL(e.viewport,e.content),a=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-a)*t,18)}function aF(e,t,a="ltr"){let s=az(t),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=t.scrollbar.size-r,o=t.content-t.viewport,l=function(e,[t,a]){return Math.min(a,Math.max(t,e))}(e,"ltr"===a?[0,o]:[-1*o,0]);return aH([0,o],[0,n-s])(l)}function aH(e,t){return a=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(a-e[0])}}var aW=(e,t=()=>{})=>{let a={left:e.scrollLeft,top:e.scrollTop},s=0;return!function r(){let n={left:e.scrollLeft,top:e.scrollTop},o=a.left!==n.left,l=a.top!==n.top;(o||l)&&t(),a=n,s=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(s)};function aq(e,t){let a=(0,ai.useCallbackRef)(e),s=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(s.current),[]),v.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(a,t)},[a,t])}function aK(e,t){let a=(0,ai.useCallbackRef)(t);(0,au.useLayoutEffect)(()=>{let t=0;if(e){let s=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(a)});return s.observe(e),()=>{window.cancelAnimationFrame(t),s.unobserve(e)}}},[e,a])}function aU({className:e,children:t,...a}){return(0,w.jsxs)(ab,{"data-slot":"scroll-area",className:(0,tA.cn)("relative",e),...a,children:[(0,w.jsx)(aw,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),(0,w.jsx)(aV,{}),(0,w.jsx)(aI,{})]})}function aV({className:e,orientation:t="vertical",...a}){return(0,w.jsx)(aj,{"data-slot":"scroll-area-scrollbar",orientation:t,className:(0,tA.cn)("flex touch-none p-px transition-colors select-none","vertical"===t&&"h-full w-2.5 border-l border-l-transparent","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent",e),...a,children:(0,w.jsx)(aA,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}let aX=["","寂灭前夜","谐振纪","飞升潮","回响纪","接触纪"];function aY(){let e=tn(e=>e.fragments),t=tn(e=>e.totalDecoded),a=function(e){for(let t of $)if(e<t.threshold)return t.threshold;return null}(t),[s,r]=(0,v.useState)(null),n=$.filter(e=>1===e.era),o=n.filter(t=>e[t.id]).length;return(0,w.jsxs)("div",{className:"flex flex-col gap-2 h-full",children:[(0,w.jsxs)("div",{className:"flex items-center justify-between",children:[(0,w.jsxs)("h3",{className:"text-sm font-semibold flex items-center gap-1.5",children:[(0,w.jsx)(ae,{className:"h-4 w-4 text-fuchsia-400"}),"记忆图谱"]}),(0,w.jsxs)("span",{className:"text-xs text-muted-foreground",children:[o,"/",n.length," · 第一纪元"]})]}),a&&(0,w.jsxs)("div",{className:"text-[10px] text-muted-foreground/80 px-1",children:["再解码 ",(0,w.jsx)("span",{className:"text-fuchsia-300 font-mono",children:a-t})," 颗 → 下一个碎片"]}),(0,w.jsx)(aU,{className:"flex-1 min-h-0",children:(0,w.jsx)("div",{className:"grid grid-cols-2 gap-2 pr-2",children:n.map((t,a)=>{let s=!!e[t.id];return(0,w.jsxs)("button",{onClick:()=>s&&r(t),disabled:!s,className:`relative aspect-[4/3] rounded-xl border text-left p-2 transition-all duration-300 overflow-hidden ${s?"border-fuchsia-400/40 bg-gradient-to-br from-fuchsia-950/40 to-black/40 hover:border-fuchsia-400/70 hover:scale-[1.02] cursor-pointer":"border-white/5 bg-black/30 cursor-not-allowed"}`,style:s?{boxShadow:"0 0 16px rgba(232,121,249,0.15)"}:void 0,children:[(0,w.jsx)("span",{className:`absolute top-1.5 right-1.5 text-[9px] font-mono ${s?"text-fuchsia-300/70":"text-white/20"}`,children:String(a+1).padStart(2,"0")}),s?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("div",{className:"absolute -top-3 -right-3 h-12 w-12 rounded-full bg-fuchsia-500/20 blur-xl"}),(0,w.jsx)(tZ,{className:"h-3 w-3 text-fuchsia-300 mb-1"}),(0,w.jsx)("div",{className:"text-[11px] font-semibold text-fuchsia-100 leading-tight",children:t.title}),(0,w.jsxs)("div",{className:"text-[9px] text-muted-foreground mt-1 line-clamp-2",children:[t.echo.slice(0,28),"…"]})]}):(0,w.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-1",children:[(0,w.jsx)(at,{className:"h-4 w-4 text-white/20"}),(0,w.jsxs)("span",{className:"text-[9px] text-white/30",children:["需解码 ",t.threshold," 颗"]})]})]},t.id)})})}),s&&(0,w.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",onClick:()=>r(null),children:(0,w.jsxs)(t9,{className:"max-w-md w-full p-5 bg-gradient-to-br from-fuchsia-950/60 to-black/80 border-fuchsia-400/40",onClick:e=>e.stopPropagation(),style:{boxShadow:"0 0 40px rgba(232,121,249,0.25)"},children:[(0,w.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,w.jsx)(tZ,{className:"h-4 w-4 text-fuchsia-300"}),(0,w.jsxs)("span",{className:"text-[10px] text-fuchsia-300/70 font-mono",children:["第 ",s.era," 纪元 · ",aX[s.era]||""]})]}),(0,w.jsx)("h4",{className:"text-lg font-bold text-fuchsia-100 mb-3",children:s.title}),(0,w.jsxs)("p",{className:"text-sm text-foreground/90 leading-relaxed italic",children:["「",s.echo,"」"]}),(0,w.jsx)("button",{onClick:()=>r(null),className:"mt-4 text-xs text-muted-foreground hover:text-foreground transition",children:"关闭"})]})})]})}var aG=v[" useId ".trim().toString()]||(()=>void 0),aJ=0;function aQ(e){let[t,a]=v.useState(aG());return(0,au.useLayoutEffect)(()=>{e||a(e=>e??String(aJ++))},[e]),e||(t?`radix-${t}`:"")}var aZ=e.i(69340),a0=e.i(26330),a1="focusScope.autoFocusOnMount",a2="focusScope.autoFocusOnUnmount",a5={bubbles:!1,cancelable:!0},a3=v.forwardRef((e,t)=>{let{loop:a=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:n,...o}=e,[l,i]=v.useState(null),c=(0,ai.useCallbackRef)(r),d=(0,ai.useCallbackRef)(n),u=v.useRef(null),h=(0,tu.useComposedRefs)(t,e=>i(e)),f=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(s){let e=function(e){if(f.paused||!l)return;let t=e.target;l.contains(t)?u.current=t:a7(u.current,{select:!0})},t=function(e){if(f.paused||!l)return;let t=e.relatedTarget;null!==t&&(l.contains(t)||a7(u.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let a=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&a7(l)});return l&&a.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),a.disconnect()}}},[s,l,f.paused]),v.useEffect(()=>{if(l){a6.add(f);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(a1,a5);l.addEventListener(a1,c),l.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let a=document.activeElement;for(let s of e)if(a7(s,{select:t}),document.activeElement!==a)return}(a4(l).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&a7(l))}return()=>{l.removeEventListener(a1,c),setTimeout(()=>{let t=new CustomEvent(a2,a5);l.addEventListener(a2,d),l.dispatchEvent(t),t.defaultPrevented||a7(e??document.body,{select:!0}),l.removeEventListener(a2,d),a6.remove(f)},0)}}},[l,c,d,f]);let m=v.useCallback(e=>{if(!a&&!s||f.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){var n;let t,s=e.currentTarget,[o,l]=[a9(t=a4(n=s),n),a9(t.reverse(),n)];o&&l?e.shiftKey||r!==l?e.shiftKey&&r===o&&(e.preventDefault(),a&&a7(l,{select:!0})):(e.preventDefault(),a&&a7(o,{select:!0})):r===s&&e.preventDefault()}},[a,s,f.paused]);return(0,w.jsx)(an.Primitive.div,{tabIndex:-1,...o,ref:h,onKeyDown:m})});function a4(e){let t=[],a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)t.push(a.currentNode);return t}function a9(e,t){for(let a of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(a,{upTo:t}))return a}function a7(e,{select:t=!1}={}){if(e&&e.focus){var a;let s=document.activeElement;e.focus({preventScroll:!0}),e!==s&&(a=e)instanceof HTMLInputElement&&"select"in a&&t&&e.select()}}a3.displayName="FocusScope";var a6=(c=[],{add(e){let t=c[0];e!==t&&t?.pause(),(c=a8(c,e)).unshift(e)},remove(e){c=a8(c,e),c[0]?.resume()}});function a8(e,t){let a=[...e],s=a.indexOf(t);return -1!==s&&a.splice(s,1),a}var se=e.i(74606),st=0;function sa(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ss=function(){return(ss=Object.assign||function(e){for(var t,a=1,s=arguments.length;a<s;a++)for(var r in t=arguments[a])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function sr(e,t){var a={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&0>t.indexOf(s)&&(a[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,s=Object.getOwnPropertySymbols(e);r<s.length;r++)0>t.indexOf(s[r])&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(a[s[r]]=e[s[r]]);return a}var sn=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),so="width-before-scroll-bar";function sl(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var si="u">typeof window?v.useLayoutEffect:v.useEffect,sc=new WeakMap,sd=(void 0===u&&(u={}),(void 0===h&&(h=function(e){return e}),f=[],m=!1,p={read:function(){if(m)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return f.length?f[f.length-1]:null},useMedium:function(e){var t=h(e,m);return f.push(t),function(){f=f.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(m=!0;f.length;){var t=f;f=[],t.forEach(e)}f={push:function(t){return e(t)},filter:function(){return f}}},assignMedium:function(e){m=!0;var t=[];if(f.length){var a=f;f=[],a.forEach(e),t=f}var s=function(){var a=t;t=[],a.forEach(e)},r=function(){return Promise.resolve().then(s)};r(),f={push:function(e){t.push(e),r()},filter:function(e){return t=t.filter(e),f}}}}).options=ss({async:!0,ssr:!1},u),p),su=function(){},sh=v.forwardRef(function(e,t){var a,s,r,n,o=v.useRef(null),l=v.useState({onScrollCapture:su,onWheelCapture:su,onTouchMoveCapture:su}),i=l[0],c=l[1],d=e.forwardProps,u=e.children,h=e.className,f=e.removeScrollBar,m=e.enabled,p=e.shards,x=e.sideCar,g=e.noRelative,b=e.noIsolation,y=e.inert,w=e.allowPinchZoom,j=e.as,N=e.gapMode,k=sr(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=(a=[o,t],s=function(e){return a.forEach(function(t){return sl(t,e)})},(r=(0,v.useState)(function(){return{value:null,callback:s,facade:{get current(){return r.value},set current(value){var e=r.value;e!==value&&(r.value=value,r.callback(value,e))}}}})[0]).callback=s,n=r.facade,si(function(){var e=sc.get(n);if(e){var t=new Set(e),s=new Set(a),r=n.current;t.forEach(function(e){s.has(e)||sl(e,null)}),s.forEach(function(e){t.has(e)||sl(e,r)})}sc.set(n,a)},[a]),n),S=ss(ss({},k),i);return v.createElement(v.Fragment,null,m&&v.createElement(x,{sideCar:sd,removeScrollBar:f,shards:p,noRelative:g,noIsolation:b,inert:y,setCallbacks:c,allowPinchZoom:!!w,lockRef:o,gapMode:N}),d?v.cloneElement(v.Children.only(u),ss(ss({},S),{ref:M})):v.createElement(void 0===j?"div":j,ss({},S,{className:h,ref:M}),u))});sh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},sh.classNames={fullWidth:so,zeroRight:sn};var sf=function(e){var t=e.sideCar,a=sr(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw Error("Sidecar medium not found");return v.createElement(s,ss({},a))};sf.isSideCarExport=!0;var sm=function(){var e=0,t=null;return{add:function(a){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=b||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var s,r;(s=t).styleSheet?s.styleSheet.cssText=a:s.appendChild(document.createTextNode(a)),r=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(r)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},sp=function(){var e=sm();return function(t,a){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&a])}},sx=function(){var e=sp();return function(t){return e(t.styles,t.dynamic),null}},sg={left:0,top:0,right:0,gap:0},sb=function(e){return parseInt(e||"",10)||0},sy=function(e){var t=window.getComputedStyle(document.body),a=t["padding"===e?"paddingLeft":"marginLeft"],s=t["padding"===e?"paddingTop":"marginTop"],r=t["padding"===e?"paddingRight":"marginRight"];return[sb(a),sb(s),sb(r)]},sw=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return sg;var t=sy(e),a=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-a+t[2]-t[0])}},sv=sx(),sj="data-scroll-locked",sN=function(e,t,a,s){var r=e.left,n=e.top,o=e.right,l=e.gap;return void 0===a&&(a="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(s,";\n padding-right: ").concat(l,"px ").concat(s,";\n }\n body[").concat(sj,"] {\n overflow: hidden ").concat(s,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(s,";"),"margin"===a&&"\n padding-left: ".concat(r,"px;\n padding-top: ").concat(n,"px;\n padding-right: ").concat(o,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(l,"px ").concat(s,";\n "),"padding"===a&&"padding-right: ".concat(l,"px ").concat(s,";")].filter(Boolean).join(""),"\n }\n \n .").concat(sn," {\n right: ").concat(l,"px ").concat(s,";\n }\n \n .").concat(so," {\n margin-right: ").concat(l,"px ").concat(s,";\n }\n \n .").concat(sn," .").concat(sn," {\n right: 0 ").concat(s,";\n }\n \n .").concat(so," .").concat(so," {\n margin-right: 0 ").concat(s,";\n }\n \n body[").concat(sj,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(l,"px;\n }\n")},sk=function(){var e=parseInt(document.body.getAttribute(sj)||"0",10);return isFinite(e)?e:0},sM=function(){v.useEffect(function(){return document.body.setAttribute(sj,(sk()+1).toString()),function(){var e=sk()-1;e<=0?document.body.removeAttribute(sj):document.body.setAttribute(sj,e.toString())}},[])},sS=function(e){var t=e.noRelative,a=e.noImportant,s=e.gapMode,r=void 0===s?"margin":s;sM();var n=v.useMemo(function(){return sw(r)},[r]);return v.createElement(sv,{styles:sN(n,!t,r,a?"":"!important")})},sC=!1;if("u">typeof window)try{var s_=Object.defineProperty({},"passive",{get:function(){return sC=!0,!0}});window.addEventListener("test",s_,s_),window.removeEventListener("test",s_,s_)}catch(e){sC=!1}var sT=!!sC&&{passive:!1},sP=function(e,t){if(!(e instanceof Element))return!1;var a=window.getComputedStyle(e);return"hidden"!==a[t]&&(a.overflowY!==a.overflowX||"TEXTAREA"===e.tagName||"visible"!==a[t])},sR=function(e,t){var a=t.ownerDocument,s=t;do{if("u">typeof ShadowRoot&&s instanceof ShadowRoot&&(s=s.host),sE(e,s)){var r=sA(e,s);if(r[1]>r[2])return!0}s=s.parentNode}while(s&&s!==a.body)return!1},sE=function(e,t){return"v"===e?sP(t,"overflowY"):sP(t,"overflowX")},sA=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},s$=function(e,t,a,s,r){var n,o=(n=window.getComputedStyle(t).direction,"h"===e&&"rtl"===n?-1:1),l=o*s,i=a.target,c=t.contains(i),d=!1,u=l>0,h=0,f=0;do{if(!i)break;var m=sA(e,i),p=m[0],x=m[1]-m[2]-o*p;(p||x)&&sE(e,i)&&(h+=x,f+=p);var g=i.parentNode;i=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&i!==document.body||c&&(t.contains(i)||t===i))return u&&(r&&1>Math.abs(h)||!r&&l>h)?d=!0:!u&&(r&&1>Math.abs(f)||!r&&-l>f)&&(d=!0),d},sB=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},sI=function(e){return[e.deltaX,e.deltaY]},sD=function(e){return e&&"current"in e?e.current:e},sO=0,sL=[];let sz=(x=function(e){var t=v.useRef([]),a=v.useRef([0,0]),s=v.useRef(),r=v.useState(sO++)[0],n=v.useState(sx)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(r));var t=(function(e,t,a){if(a||2==arguments.length)for(var s,r=0,n=t.length;r<n;r++)!s&&r in t||(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(sD),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(r))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!o.current.allowPinchZoom;var r,n=sB(e),l=a.current,i="deltaX"in e?e.deltaX:l[0]-n[0],c="deltaY"in e?e.deltaY:l[1]-n[1],d=e.target,u=Math.abs(i)>Math.abs(c)?"h":"v";if("touches"in e&&"h"===u&&"range"===d.type)return!1;var h=window.getSelection(),f=h&&h.anchorNode;if(f&&(f===d||f.contains(d)))return!1;var m=sR(u,d);if(!m)return!0;if(m?r=u:(r="v"===u?"h":"v",m=sR(u,d)),!m)return!1;if(!s.current&&"changedTouches"in e&&(i||c)&&(s.current=r),!r)return!0;var p=s.current||r;return s$(p,t,e,"h"===p?i:c,!0)},[]),i=v.useCallback(function(e){if(sL.length&&sL[sL.length-1]===n){var a="deltaY"in e?sI(e):sB(e),s=t.current.filter(function(t){var s;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(s=t.delta,s[0]===a[0]&&s[1]===a[1])})[0];if(s&&s.should){e.cancelable&&e.preventDefault();return}if(!s){var r=(o.current.shards||[]).map(sD).filter(Boolean).filter(function(t){return t.contains(e.target)});(r.length>0?l(e,r[0]):!o.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=v.useCallback(function(e,a,s,r){var n={name:e,delta:a,target:s,should:r,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(s)};t.current.push(n),setTimeout(function(){t.current=t.current.filter(function(e){return e!==n})},1)},[]),d=v.useCallback(function(e){a.current=sB(e),s.current=void 0},[]),u=v.useCallback(function(t){c(t.type,sI(t),t.target,l(t,e.lockRef.current))},[]),h=v.useCallback(function(t){c(t.type,sB(t),t.target,l(t,e.lockRef.current))},[]);v.useEffect(function(){return sL.push(n),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",i,sT),document.addEventListener("touchmove",i,sT),document.addEventListener("touchstart",d,sT),function(){sL=sL.filter(function(e){return e!==n}),document.removeEventListener("wheel",i,sT),document.removeEventListener("touchmove",i,sT),document.removeEventListener("touchstart",d,sT)}},[]);var f=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(n,{styles:"\n .block-interactivity-".concat(r," {pointer-events: none;}\n .allow-interactivity-").concat(r," {pointer-events: all;}\n")}):null,f?v.createElement(sS,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},sd.useMedium(x),sf);var sF=v.forwardRef(function(e,t){return v.createElement(sh,ss({},e,{ref:t,sideCar:sz}))});sF.classNames=sh.classNames;var sH=new WeakMap,sW=new WeakMap,sq={},sK=0,sU=function(e){return e&&(e.host||sU(e.parentNode))},sV=function(e,t,a,s){var r=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var a=sU(e);return a&&t.contains(a)?a:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});sq[a]||(sq[a]=new WeakMap);var n=sq[a],o=[],l=new Set,i=new Set(r),c=function(e){!e||l.has(e)||(l.add(e),c(e.parentNode))};r.forEach(c);var d=function(e){!e||i.has(e)||Array.prototype.forEach.call(e.children,function(e){if(l.has(e))d(e);else try{var t=e.getAttribute(s),r=null!==t&&"false"!==t,i=(sH.get(e)||0)+1,c=(n.get(e)||0)+1;sH.set(e,i),n.set(e,c),o.push(e),1===i&&r&&sW.set(e,!0),1===c&&e.setAttribute(a,"true"),r||e.setAttribute(s,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),l.clear(),sK++,function(){o.forEach(function(e){var t=sH.get(e)-1,r=n.get(e)-1;sH.set(e,t),n.set(e,r),t||(sW.has(e)||e.removeAttribute(s),sW.delete(e)),r||e.removeAttribute(a)}),--sK||(sH=new WeakMap,sH=new WeakMap,sW=new WeakMap,sq={})}},sX=function(e,t,a){void 0===a&&(a="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),r=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return r?(s.push.apply(s,Array.from(r.querySelectorAll("[aria-live], script"))),sV(s,r,a,"aria-hidden")):function(){return null}},sY=Symbol("radix.slottable");function sG(e){return v.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===sY}var sJ="Dialog",[sQ,sZ]=(0,al.createContextScope)(sJ),[s0,s1]=sQ(sJ),s2=e=>{let{__scopeDialog:t,children:a,open:s,defaultOpen:r,onOpenChange:n,modal:o=!0}=e,l=v.useRef(null),i=v.useRef(null),[c,d]=(0,aZ.useControllableState)({prop:s,defaultProp:r??!1,onChange:n,caller:sJ});return(0,w.jsx)(s0,{scope:t,triggerRef:l,contentRef:i,contentId:aQ(),titleId:aQ(),descriptionId:aQ(),open:c,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(e=>!e),[d]),modal:o,children:a})};s2.displayName=sJ;var s5="DialogTrigger";v.forwardRef((e,t)=>{let{__scopeDialog:a,...s}=e,r=s1(s5,a),n=(0,tu.useComposedRefs)(t,r.triggerRef);return(0,w.jsx)(an.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":rf(r.open),...s,ref:n,onClick:(0,ah.composeEventHandlers)(e.onClick,r.onOpenToggle)})}).displayName=s5;var s3="DialogPortal",[s4,s9]=sQ(s3,{forceMount:void 0}),s7=e=>{let{__scopeDialog:t,forceMount:a,children:s,container:r}=e,n=s1(s3,t);return(0,w.jsx)(s4,{scope:t,forceMount:a,children:v.Children.map(s,e=>(0,w.jsx)(ao.Presence,{present:a||n.open,children:(0,w.jsx)(se.Portal,{asChild:!0,container:r,children:e})}))})};s7.displayName=s3;var s6="DialogOverlay",s8=v.forwardRef((e,t)=>{let a=s9(s6,e.__scopeDialog),{forceMount:s=a.forceMount,...r}=e,n=s1(s6,e.__scopeDialog);return n.modal?(0,w.jsx)(ao.Presence,{present:s||n.open,children:(0,w.jsx)(rt,{...r,ref:t})}):null});s8.displayName=s6;var re=((d=v.forwardRef((e,t)=>{let{children:a,...s}=e;if(v.isValidElement(a)){var r;let e,n,o=(r=a,(n=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.ref:(n=(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.props.ref:r.props.ref||r.ref),l=function(e,t){let a={...t};for(let s in t){let r=e[s],n=t[s];/^on[A-Z]/.test(s)?r&&n?a[s]=(...e)=>{let t=n(...e);return r(...e),t}:r&&(a[s]=r):"style"===s?a[s]={...r,...n}:"className"===s&&(a[s]=[r,n].filter(Boolean).join(" "))}return{...e,...a}}(s,a.props);return a.type!==v.Fragment&&(l.ref=t?(0,tu.composeRefs)(t,o):o),v.cloneElement(a,l)}return v.Children.count(a)>1?v.Children.only(null):null})).displayName="DialogOverlay.RemoveScroll.SlotClone",o=d,(l=v.forwardRef((e,t)=>{let{children:a,...s}=e,r=v.Children.toArray(a),n=r.find(sG);if(n){let e=n.props.children,a=r.map(t=>t!==n?t:v.Children.count(e)>1?v.Children.only(null):v.isValidElement(e)?e.props.children:null);return(0,w.jsx)(o,{...s,ref:t,children:v.isValidElement(e)?v.cloneElement(e,void 0,a):null})}return(0,w.jsx)(o,{...s,ref:t,children:a})})).displayName="DialogOverlay.RemoveScroll.Slot",l),rt=v.forwardRef((e,t)=>{let{__scopeDialog:a,...s}=e,r=s1(s6,a);return(0,w.jsx)(sF,{as:re,allowPinchZoom:!0,shards:[r.contentRef],children:(0,w.jsx)(an.Primitive.div,{"data-state":rf(r.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ra="DialogContent",rs=v.forwardRef((e,t)=>{let a=s9(ra,e.__scopeDialog),{forceMount:s=a.forceMount,...r}=e,n=s1(ra,e.__scopeDialog);return(0,w.jsx)(ao.Presence,{present:s||n.open,children:n.modal?(0,w.jsx)(rr,{...r,ref:t}):(0,w.jsx)(rn,{...r,ref:t})})});rs.displayName=ra;var rr=v.forwardRef((e,t)=>{let a=s1(ra,e.__scopeDialog),s=v.useRef(null),r=(0,tu.useComposedRefs)(t,a.contentRef,s);return v.useEffect(()=>{let e=s.current;if(e)return sX(e)},[]),(0,w.jsx)(ro,{...e,ref:r,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,ah.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:(0,ah.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,a=0===t.button&&!0===t.ctrlKey;(2===t.button||a)&&e.preventDefault()}),onFocusOutside:(0,ah.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault())})}),rn=v.forwardRef((e,t)=>{let a=s1(ra,e.__scopeDialog),s=v.useRef(!1),r=v.useRef(!1);return(0,w.jsx)(ro,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(s.current||a.triggerRef.current?.focus(),t.preventDefault()),s.current=!1,r.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(s.current=!0,"pointerdown"===t.detail.originalEvent.type&&(r.current=!0));let n=t.target;a.triggerRef.current?.contains(n)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&r.current&&t.preventDefault()}})}),ro=v.forwardRef((e,t)=>{let{__scopeDialog:a,trapFocus:s,onOpenAutoFocus:r,onCloseAutoFocus:n,...o}=e,l=s1(ra,a),i=v.useRef(null),c=(0,tu.useComposedRefs)(t,i);return v.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??sa()),document.body.insertAdjacentElement("beforeend",e[1]??sa()),st++,()=>{1===st&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),st--}},[]),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(a3,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:r,onUnmountAutoFocus:n,children:(0,w.jsx)(a0.DismissableLayer,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":rf(l.open),...o,ref:c,onDismiss:()=>l.onOpenChange(!1)})}),(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(rg,{titleId:l.titleId}),(0,w.jsx)(rb,{contentRef:i,descriptionId:l.descriptionId})]})]})}),rl="DialogTitle",ri=v.forwardRef((e,t)=>{let{__scopeDialog:a,...s}=e,r=s1(rl,a);return(0,w.jsx)(an.Primitive.h2,{id:r.titleId,...s,ref:t})});ri.displayName=rl;var rc="DialogDescription",rd=v.forwardRef((e,t)=>{let{__scopeDialog:a,...s}=e,r=s1(rc,a);return(0,w.jsx)(an.Primitive.p,{id:r.descriptionId,...s,ref:t})});rd.displayName=rc;var ru="DialogClose",rh=v.forwardRef((e,t)=>{let{__scopeDialog:a,...s}=e,r=s1(ru,a);return(0,w.jsx)(an.Primitive.button,{type:"button",...s,ref:t,onClick:(0,ah.composeEventHandlers)(e.onClick,()=>r.onOpenChange(!1))})});function rf(e){return e?"open":"closed"}rh.displayName=ru;var rm="DialogTitleWarning",[rp,rx]=(0,al.createContext)(rm,{contentName:ra,titleName:rl,docsSlug:"dialog"}),rg=({titleId:e})=>{let t=rx(rm),a=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(a))},[a,e]),null},rb=({contentRef:e,descriptionId:t})=>{let a=rx("DialogDescriptionWarning"),s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${a.contentName}}.`;return v.useEffect(()=>{let a=e.current?.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},ry=e.i(41947),ry=ry;function rw({...e}){return(0,w.jsx)(s2,{"data-slot":"dialog",...e})}function rv({...e}){return(0,w.jsx)(s7,{"data-slot":"dialog-portal",...e})}function rj({className:e,...t}){return(0,w.jsx)(s8,{"data-slot":"dialog-overlay",className:(0,tA.cn)("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function rN({className:e,children:t,showCloseButton:a=!0,...s}){return(0,w.jsxs)(rv,{"data-slot":"dialog-portal",children:[(0,w.jsx)(rj,{}),(0,w.jsxs)(rs,{"data-slot":"dialog-content",className:(0,tA.cn)("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...s,children:[t,a&&(0,w.jsxs)(rh,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[(0,w.jsx)(ry.default,{}),(0,w.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function rk({className:e,...t}){return(0,w.jsx)("div",{"data-slot":"dialog-header",className:(0,tA.cn)("flex flex-col gap-2 text-center sm:text-left",e),...t})}function rM({className:e,...t}){return(0,w.jsx)("div",{"data-slot":"dialog-footer",className:(0,tA.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function rS({className:e,...t}){return(0,w.jsx)(ri,{"data-slot":"dialog-title",className:(0,tA.cn)("text-lg leading-none font-semibold",e),...t})}function rC({className:e,...t}){return(0,w.jsx)(rd,{"data-slot":"dialog-description",className:(0,tA.cn)("text-muted-foreground text-sm",e),...t})}let r_=(0,to.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);function rT({open:e,onOpenChange:t}){let a=tn(),s=tn(e=>e.doPrestige),{toast:r}=(0,tO.useToast)(),[n,o]=(0,v.useState)(!1),[l,i]=(0,v.useState)(!1),c=eb(a);a.blueprints.length;let d=Math.min(6,a.blueprints.length+c),u=J(a.constellation??[]);return(0,w.jsx)(rw,{open:e,onOpenChange:t,children:(0,w.jsxs)(rN,{className:"bg-gradient-to-br from-fuchsia-950/70 to-black/90 border-fuchsia-400/40",children:[(0,w.jsxs)(rk,{children:[(0,w.jsxs)(rS,{className:"flex items-center gap-2 text-fuchsia-100",children:[(0,w.jsx)(td,{className:"h-5 w-5"}),"飞升 · 跨越维度"]}),(0,w.jsx)(rC,{className:"text-fuchsia-200/70",children:"当接触进度满溢,你将跨越维度与以太族相会。本次飞升将重置资源与技术,但保留记忆图谱与蓝图加成。"})]}),(0,w.jsxs)("div",{className:"space-y-3 py-2",children:[(0,w.jsxs)("div",{className:"rounded-lg border border-fuchsia-400/30 bg-fuchsia-950/30 p-3",children:[(0,w.jsxs)("div",{className:"flex items-center justify-between",children:[(0,w.jsx)("span",{className:"text-sm text-fuchsia-200",children:"本次获得蓝图"}),(0,w.jsxs)("span",{className:"text-2xl font-mono font-bold text-fuchsia-100",children:["+",c]})]}),(0,w.jsxs)("p",{className:"text-[11px] text-muted-foreground mt-1",children:["蓝图总数将达 ",d,"/",6,"(每 ",20," 次解码产出 1 张)"]})]}),(0,w.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,w.jsx)(rP,{label:"产能",value:`+${(d*B*100).toFixed(0)}%`,color:"#34d399"}),(0,w.jsx)(rP,{label:"洞见",value:`+${(d*I*100).toFixed(0)}%`,color:"#fbbf24"}),(0,w.jsx)(rP,{label:"接触",value:`+${(d*D*100).toFixed(0)}%`,color:"#e879f9"})]}),(0,w.jsxs)("div",{className:"text-[11px] text-muted-foreground space-y-1 pt-1",children:[(0,w.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,w.jsx)(tZ,{className:"h-3 w-3 text-fuchsia-400"}),"保留:记忆图谱、累计解码数、飞升次数、蓝图、星图天赋"]}),(0,w.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,w.jsx)(td,{className:"h-3 w-3 text-rose-400"}),"重置:晶体、洞见、技术树、接触进度、待解码晶体"]})]}),(0,w.jsx)("div",{className:"rounded-lg border border-fuchsia-400/30 bg-gradient-to-r from-fuchsia-950/40 to-purple-950/40 p-2.5",children:(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsx)(r_,{className:"h-4 w-4 text-fuchsia-300"}),(0,w.jsxs)("div",{className:"flex-1",children:[(0,w.jsx)("div",{className:"text-[12px] text-fuchsia-200 font-bold",children:"星图觉醒预告"}),(0,w.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:["飞升后将从 3 道随机天赋中选 1,永久获得加成",u.unlocked<u.total&&(0,w.jsxs)("span",{className:"text-fuchsia-300/80",children:[" · 当前 ",u.unlocked,"/",u.total]})]})]}),(0,w.jsx)("div",{className:"text-[10px] text-fuchsia-300/70 font-mono",children:u.unlocked<u.total?"✦ 可觉醒":"✧ 已圆满"})]})}),(0,w.jsxs)("div",{className:"rounded-lg border border-violet-400/25 bg-violet-950/20 p-2.5 flex items-center gap-2",children:[(0,w.jsx)(ae,{className:"h-4 w-4 text-violet-300 flex-shrink-0"}),(0,w.jsxs)("div",{className:"flex-1 text-[10px] text-violet-100/70 leading-relaxed",children:["本次飞升将铭刻入",(0,w.jsx)("span",{className:"text-violet-200 font-bold",children:"回响编年史"}),", 记录本周目的解码、探险、星潮与觉醒天赋,形成永恒叙事时间轴。"]})]})]}),(0,w.jsxs)(rM,{children:[(0,w.jsx)(tJ,{variant:"ghost",onClick:()=>t(!1),children:"取消"}),(0,w.jsx)(tJ,{disabled:n&&!l,onClick:()=>{if(!n){o(!0),i(!1),window.setTimeout(()=>i(!0),900);return}let e=s();t(!1),o(!1),i(!1),e&&(tW("prestige"),window.setTimeout(()=>tW("chronicle"),600),r({title:"✦ 飞升成功",description:`获得 ${e.newBp} 张蓝图,进入第 ${a.ascensions+2} 周目。编年史已铭刻新纪元。`}))},className:"bg-gradient-to-r from-fuchsia-600 to-rose-500 hover:from-fuchsia-500 hover:to-rose-400 text-white border-0",children:n?l?"再次确认飞升":"请确认…":c<=0?"飞升(无新蓝图)":"飞升"})]})]})})}function rP({label:e,value:t,color:a}){return(0,w.jsxs)("div",{className:"rounded-lg border p-2 text-center",style:{borderColor:`${a}44`,background:`${a}11`},children:[(0,w.jsx)("div",{className:"text-[10px] text-muted-foreground",children:e}),(0,w.jsx)("div",{className:"text-sm font-mono font-bold",style:{color:a},children:t})]})}var rR="Switch",[rE,rA]=(0,al.createContextScope)(rR),[r$,rB]=rE(rR),rI=v.forwardRef((e,t)=>{let{__scopeSwitch:a,name:s,checked:r,defaultChecked:n,required:o,disabled:l,value:i="on",onCheckedChange:c,form:d,...u}=e,[h,f]=v.useState(null),m=(0,tu.useComposedRefs)(t,e=>f(e)),p=v.useRef(!1),x=!h||d||!!h.closest("form"),[g,b]=(0,aZ.useControllableState)({prop:r,defaultProp:n??!1,onChange:c,caller:rR});return(0,w.jsxs)(r$,{scope:a,checked:g,disabled:l,children:[(0,w.jsx)(an.Primitive.button,{type:"button",role:"switch","aria-checked":g,"aria-required":o,"data-state":rz(g),"data-disabled":l?"":void 0,disabled:l,value:i,...u,ref:m,onClick:(0,ah.composeEventHandlers)(e.onClick,e=>{b(e=>!e),x&&(p.current=e.isPropagationStopped(),p.current||e.stopPropagation())})}),x&&(0,w.jsx)(rL,{control:h,bubbles:!p.current,name:s,value:i,checked:g,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});rI.displayName=rR;var rD="SwitchThumb",rO=v.forwardRef((e,t)=>{let{__scopeSwitch:a,...s}=e,r=rB(rD,a);return(0,w.jsx)(an.Primitive.span,{"data-state":rz(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:t})});rO.displayName=rD;var rL=v.forwardRef(({__scopeSwitch:e,control:t,checked:a,bubbles:s=!0,...r},n)=>{let o,l=v.useRef(null),i=(0,tu.useComposedRefs)(l,n),c=(o=v.useRef({value:a,previous:a}),v.useMemo(()=>(o.current.value!==a&&(o.current.previous=o.current.value,o.current.value=a),o.current.previous),[a])),d=function(e){let[t,a]=v.useState(void 0);return(0,au.useLayoutEffect)(()=>{if(e){a({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let s,r;if(!Array.isArray(t)||!t.length)return;let n=t[0];if("borderBoxSize"in n){let e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;s=t.inlineSize,r=t.blockSize}else s=e.offsetWidth,r=e.offsetHeight;a({width:s,height:r})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}a(void 0)},[e]),t}(t);return v.useEffect(()=>{let e=l.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(c!==a&&t){let r=new Event("click",{bubbles:s});t.call(e,a),e.dispatchEvent(r)}},[c,a,s]),(0,w.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...r,tabIndex:-1,ref:i,style:{...r.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function rz(e){return e?"checked":"unchecked"}function rF({className:e,...t}){return(0,w.jsx)(rI,{"data-slot":"switch",className:(0,tA.cn)("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:(0,w.jsx)(rO,{"data-slot":"switch-thumb",className:(0,tA.cn)("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}rL.displayName="SwitchBubbleInput";var rH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let a=tp(`Primitive.${t}`),s=v.forwardRef((e,s)=>{let{asChild:r,...n}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,w.jsx)(r?a:t,{...n,ref:s})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),rW=v.forwardRef((e,t)=>(0,w.jsx)(rH.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));function rq({className:e,...t}){return(0,w.jsx)(rW,{"data-slot":"label",className:(0,tA.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}rW.displayName="Label";let rK=(0,to.default)("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),rU=(0,to.default)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),rV=(0,to.default)("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),rX=(0,to.default)("graduation-cap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]),rY=(0,to.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),rG=[{id:"welcome",placement:"bottom",title:"✦ 欢迎来到回响星核",body:"你是一台苏醒在深空遗迹中的自治无人机。在这里,你需要采矿、解码以太文明遗留的记忆晶体,逐步拼凑出一段跨越维度的叙事。\n\n本引导将带你认识 5 个核心玩法,约 1 分钟。可随时跳过。"},{id:"crystal",target:"crystal-orb",placement:"right",title:"① 脉冲扫描 · 采矿",body:"点击中央的「记忆晶体」发起脉冲扫描,获得记忆晶体。\n\n连续点击可触发连击,连击越高单次产出越多。无人机也会每秒自动采集(+0.4/s 起)。",expectAction:"pulse"},{id:"decode",target:"decode-panel",placement:"left",title:"② 谐振序列 · 解码",body:"记忆晶体存满后,点击右侧「待解码晶体」开启谐振谜题:按目标色序依次点击相邻同色节点重建回路。\n\n解码成功 → 获得技术洞见 + 记忆碎片(叙事片段)。这是游戏的核心解谜层。",expectAction:"decode-start"},{id:"tech",target:"tab-tech",placement:"top",title:"③ 技术树 · 成长",body:"用「技术洞见」在「技术」标签升级 4 大分支:产能 / 解码 / 仓库 / 探险。\n\n每个分支 3 级,策略性地分配洞见是关键。",expectAction:"tech-buy"},{id:"expedition",target:"tab-expedition",placement:"top",title:"④ 遗迹探险 · 肉鸽",body:"累积足够实力后,「探险」标签可深入遗迹:6 种节点(战斗/宝藏/抉择/解谜/休整/BOSS)程序化路径,有生命系统,失败保留奖励。\n\n这是放置之外的主动玩法层。",expectAction:"expedition-start"},{id:"prestige",target:"prestige-btn",placement:"bottom",title:"⑤ 飞升 · 多周目",body:"「接触进度」满 100% 后可飞升:重置进度,获得永久蓝图加成 + 星图天赋(3 选 1 draft)+ 编年史记录。\n\n多周目叠加,越飞越强。还有每日信标挑战、6 种星潮事件等你探索。"},{id:"done",placement:"bottom",title:"✦ 回响已唤醒",body:"教程结束!后续可在「设置 → 重新查看教程」再次查看。\n\n深空之中,回响永续。祝你考古愉快。"}],rJ="echo-nexus-tutorial-v1";function rQ({open:e,onOpenChange:t}){let a=tn(e=>e.soundOn),s=tn(e=>e.toggleSound),r=tn(e=>e.hardReset),n=tn(e=>e.ascensions),o=tn(e=>e.totalDecoded),{toast:l}=(0,tO.useToast)(),[i,c]=(0,v.useState)(!1);return(0,w.jsx)(rw,{open:e,onOpenChange:t,children:(0,w.jsxs)(rN,{className:"bg-gradient-to-br from-slate-900/80 to-black/90 border-white/15",children:[(0,w.jsxs)(rk,{children:[(0,w.jsx)(rS,{children:"设置"}),(0,w.jsx)(rC,{children:"游戏偏好与存档管理"})]}),(0,w.jsxs)("div",{className:"space-y-4 py-2",children:[(0,w.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-white/10 bg-black/30 p-3",children:[(0,w.jsxs)("div",{children:[(0,w.jsx)(rq,{className:"text-sm",children:"音效反馈"}),(0,w.jsx)("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"脉冲、解码、探险、飞升等程序化音效"})]}),(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsx)(tJ,{size:"sm",variant:"ghost",className:"h-7 px-2 text-muted-foreground hover:text-foreground",onClick:()=>tW("decodeSuccess"),"aria-label":"试听音效",children:(0,w.jsx)(rV,{className:"h-3.5 w-3.5"})}),(0,w.jsx)(rF,{checked:a,onCheckedChange:s})]})]}),(0,w.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-white/10 bg-black/30 p-3",children:[(0,w.jsxs)("div",{children:[(0,w.jsx)(rq,{className:"text-sm",children:"新手教程"}),(0,w.jsx)("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"重新查看 5 步玩法引导"})]}),(0,w.jsxs)(tJ,{size:"sm",variant:"outline",className:"h-7 px-2 text-[11px] border-fuchsia-400/40 text-fuchsia-200 hover:bg-fuchsia-500/10",onClick:()=>{try{localStorage.removeItem(rJ)}catch{}window.dispatchEvent(new CustomEvent("echo-nexus-tutorial-restart")),t(!1)},children:[(0,w.jsx)(rX,{className:"h-3.5 w-3.5 mr-1"}),"重看教程"]})]}),(0,w.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/30 p-3 text-xs space-y-1.5",children:[(0,w.jsxs)("div",{className:"flex justify-between",children:[(0,w.jsx)("span",{className:"text-muted-foreground",children:"累计解码"}),(0,w.jsxs)("span",{className:"font-mono",children:[o," 颗"]})]}),(0,w.jsxs)("div",{className:"flex justify-between",children:[(0,w.jsx)("span",{className:"text-muted-foreground",children:"飞升周目"}),(0,w.jsx)("span",{className:"font-mono",children:n})]}),(0,w.jsxs)("div",{className:"flex justify-between",children:[(0,w.jsx)("span",{className:"text-muted-foreground",children:"存档位置"}),(0,w.jsx)("span",{className:"font-mono text-[10px]",children:"浏览器本地"})]})]}),(0,w.jsxs)("div",{className:"rounded-lg border border-rose-500/30 bg-rose-950/20 p-3",children:[(0,w.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,w.jsx)(t2,{className:"h-4 w-4 text-rose-400"}),(0,w.jsx)("span",{className:"text-sm font-medium text-rose-200",children:"危险操作"})]}),(0,w.jsx)("p",{className:"text-[11px] text-muted-foreground mb-2",children:"清空所有进度,包括记忆图谱与飞升记录,不可恢复。"}),(0,w.jsxs)(tJ,{variant:"outline",size:"sm",className:"border-rose-500/40 text-rose-300 hover:bg-rose-500/10",onClick:()=>{i?(r(),c(!1),t(!1),l({title:"存档已清空",description:"一切归零,重新开始。"})):c(!0)},children:[(0,w.jsx)(rK,{className:"h-3.5 w-3.5 mr-1"}),i?"再次点击确认清空":"清空存档"]})]}),(0,w.jsxs)("div",{className:"space-y-1.5",children:[(0,w.jsxs)("a",{href:"https://gitea-pages.atdunbg.xyz/Super_Z/echo-nexus/",target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 text-xs text-emerald-300/80 hover:text-emerald-200 transition px-1 py-1 rounded hover:bg-emerald-500/5",children:[(0,w.jsx)(rY,{className:"h-3.5 w-3.5"}),"在线游玩(gitea-pages"]}),(0,w.jsxs)("a",{href:"https://git.atdunbg.xyz/Super_Z/echo-nexus",target:"_blank",rel:"noreferrer",className:"flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground transition px-1 py-1 rounded hover:bg-white/5",children:[(0,w.jsx)(rU,{className:"h-3.5 w-3.5"}),"git.atdunbg.xyz/Super_Z/echo-nexus"]})]})]}),(0,w.jsx)(rM,{children:(0,w.jsx)(tJ,{variant:"ghost",onClick:()=>t(!1),children:"关闭"})})]})})}let rZ=(0,to.default)("swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]),r0=(0,to.default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),r1=(0,to.default)("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]),r2=(0,to.default)("skull",[["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z",key:"1o5pge"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]),r5=(0,to.default)("heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]),r3=(0,to.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),r4=(0,to.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),r9=(0,to.default)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]),r7={combat:{icon:rZ,color:"#fb7185",label:"战斗",bg:"rgba(251,113,133,0.15)"},treasure:{icon:tl,color:"#fbbf24",label:"宝藏",bg:"rgba(251,191,36,0.15)"},choice:{icon:r0,color:"#a5f3fc",label:"抉择",bg:"rgba(165,243,252,0.15)"},puzzle:{icon:r1,color:"#e879f9",label:"解谜",bg:"rgba(232,121,249,0.15)"},rest:{icon:r5,color:"#34d399",label:"休整",bg:"rgba(52,211,153,0.15)"},boss:{icon:r2,color:"#f43f5e",label:"BOSS",bg:"rgba(244,63,94,0.2)"}};function r6(){let e=tn(e=>e.activeExpedition),t=tn(e=>e.energy),a=tn(e=>e.energyMax),s=tn(e=>e.lastEnergyTick),r=tn(e=>e.expeditionLog),n=tn(e=>e.totalExpeditions),o=tn(e=>eC(e)),l=tn(e=>e.startExpedition),i=tn(e=>e.resolveCurrentNode),c=tn(e=>e.advanceNode),d=tn(e=>e.abortExpedition),{toast:u}=(0,tO.useToast)(),[h,f]=(0,v.useState)(null),m=Date.now(),p=1e3*o,x=t>=a?100:Math.min(100,(m-s)/p*100),g=o<45;if(!e||e.finished)return(0,w.jsxs)("div",{className:"flex flex-col gap-3 h-full",children:[(0,w.jsxs)("div",{className:"flex items-center justify-between",children:[(0,w.jsxs)("h3",{className:"text-sm font-semibold flex items-center gap-1.5",children:[(0,w.jsx)(t8,{className:"h-4 w-4 text-amber-400"}),"遗迹探险"]}),(0,w.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["已探索 ",n," 次"]})]}),(0,w.jsxs)("div",{className:"rounded-xl border border-amber-400/20 bg-amber-950/20 p-3",children:[(0,w.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,w.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,w.jsx)(r3,{className:"h-3.5 w-3.5 text-amber-400"}),(0,w.jsx)("span",{className:"text-xs text-amber-200",children:"探险能量"})]}),(0,w.jsxs)("span",{className:"text-xs font-mono text-amber-100",children:[t," / ",a]})]}),t<a?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(t$,{value:x,className:"h-1.5 bg-black/40 [&>div]:bg-gradient-to-r [&>div]:from-amber-500 [&>div]:to-yellow-300"}),(0,w.jsxs)("p",{className:"text-[10px] text-muted-foreground/70 mt-1",children:["下一点能量约 ",Math.ceil((p-(m-s))/1e3),"s 后恢复",g&&(0,w.jsxs)("span",{className:"text-emerald-400/80 ml-1",children:["⚡ ",o.toFixed(0),"s/点 (已加速)"]})]})]}):(0,w.jsx)("p",{className:"text-[10px] text-amber-300/80 mt-0.5",children:"能量已满,可立即出发"})]}),(0,w.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 rounded-2xl border border-dashed border-amber-400/20 bg-black/30 p-6 relative overflow-hidden",children:[(0,w.jsx)("div",{className:"absolute -top-10 -right-10 h-32 w-32 rounded-full bg-amber-500/10 blur-2xl"}),(0,w.jsx)("div",{className:"relative",children:(0,w.jsx)("div",{className:"h-20 w-20 rounded-full bg-gradient-to-br from-amber-500/30 to-rose-500/20 flex items-center justify-center mx-auto",style:{boxShadow:"0 0 30px rgba(251,191,36,0.3)"},children:(0,w.jsx)(t8,{className:"h-9 w-9 text-amber-300"})})}),(0,w.jsxs)("div",{className:"text-center space-y-1",children:[(0,w.jsx)("p",{className:"text-sm font-medium text-amber-100",children:"深入以太遗迹"}),(0,w.jsx)("p",{className:"text-[11px] text-muted-foreground/80 max-w-[220px]",children:"派出探险队进入程序化生成的遗迹路径,沿途遭遇战斗、宝藏、抉择与解谜,击败终点 BOSS 获取丰厚奖励。"})]}),(0,w.jsxs)(tJ,{onClick:()=>{let e=l();e.ok?(tW("expeditionStart"),u({title:"探险队出发",description:"深入遗迹,谨慎前行。"}),f(null)):u({title:"无法出发",description:e.reason,variant:"destructive"})},disabled:t<1,className:"bg-gradient-to-r from-amber-600 to-rose-500 hover:from-amber-500 hover:to-rose-400 text-white border-0",children:[(0,w.jsx)(t8,{className:"h-4 w-4 mr-1.5"}),"出发(消耗 ",1," 能量)"]}),t<1&&(0,w.jsx)("p",{className:"text-[10px] text-rose-300/80",children:"能量不足,请等待恢复"})]}),r.length>0&&(0,w.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-2 max-h-32 overflow-y-auto echo-scroll",children:[(0,w.jsx)("div",{className:"text-[10px] text-muted-foreground/60 mb-1 px-1",children:"最近探险记录"}),r.slice(0,4).map((e,t)=>(0,w.jsxs)("div",{className:"text-[10px] text-muted-foreground/70 px-1 py-0.5 border-b border-white/5 last:border-0",children:[(0,w.jsx)("span",{className:"text-amber-300/60",children:""})," ",e.result,e.rewards&&(0,w.jsx)("span",{className:"text-emerald-300/70 ml-1",children:e.rewards})]},t))]})]});let b=e.nodes[e.currentNode],y=r7[b.type],j=y.icon,N=e.hp/e.maxHp*100,k=(e.currentNode+ +!!b.cleared)/e.nodes.length*100;return(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 flex flex-col gap-2.5 h-full",children:[(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center justify-between gap-2",children:[(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1.5",children:[(0,w.jsx)(t8,{className:"h-3.5 w-3.5 text-amber-400"}),(0,w.jsx)("span",{className:"jsx-df1c681cdb543264 text-xs font-semibold",children:"遗迹探险"}),(0,w.jsxs)("span",{className:"jsx-df1c681cdb543264 text-[10px] text-muted-foreground",children:["第 ",e.currentNode+1,"/",e.nodes.length," 节点"]})]}),(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1.5",children:[(0,w.jsx)("span",{className:"jsx-df1c681cdb543264 text-[10px] text-muted-foreground",children:"探险力"}),(0,w.jsx)("span",{className:"jsx-df1c681cdb543264 text-xs font-mono font-semibold text-amber-300",children:e.power})]})]}),(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264",children:[(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center justify-between mb-0.5",children:[(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1",children:[(0,w.jsx)(r5,{className:"h-3 w-3 text-rose-400"}),(0,w.jsx)("span",{className:"jsx-df1c681cdb543264 text-[10px] text-muted-foreground",children:"探险队生命"})]}),(0,w.jsxs)("span",{className:`jsx-df1c681cdb543264 text-[10px] font-mono ${N<30?"text-rose-400":"text-foreground"}`,children:[e.hp," / ",e.maxHp]})]}),(0,w.jsx)(t$,{value:N,className:"h-1.5 bg-black/40 [&>div]:bg-gradient-to-r [&>div]:from-rose-500 [&>div]:to-emerald-400"})]}),(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 rounded-xl border border-white/10 bg-black/30 p-2.5",children:[(0,w.jsx)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1 overflow-x-auto echo-scroll pb-1",children:e.nodes.map((t,a)=>{let s=r7[t.type],r=s.icon,n=a===e.currentNode,o=t.cleared,l=a<e.currentNode;return(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center shrink-0",children:[(0,w.jsxs)("div",{style:{background:o||l?"rgba(255,255,255,0.04)":s.bg,border:n?`1.5px solid ${s.color}`:"1px solid rgba(255,255,255,0.08)",boxShadow:n?`0 0 12px ${s.color}66`:"none"},title:`${s.label} \xb7 ${t.title}`,className:`jsx-df1c681cdb543264 relative h-9 w-9 rounded-lg flex items-center justify-center transition-all duration-300 ${n?"scale-125":""}`,children:[(0,w.jsx)(r,{style:{color:o||l?"#666":s.color},className:`jsx-df1c681cdb543264 h-4 w-4 ${o||l?"opacity-30":""}`}),o&&(0,w.jsx)("div",{className:"jsx-df1c681cdb543264 absolute -top-1 -right-1 h-3 w-3 rounded-full bg-emerald-500/80 flex items-center justify-center",children:(0,w.jsx)("span",{className:"jsx-df1c681cdb543264 text-[8px] text-white",children:"✓"})})]}),a<e.nodes.length-1&&(0,w.jsx)(r4,{className:`h-3 w-3 mx-0.5 ${l||n&&o?"text-amber-400/60":"text-white/15"}`})]},t.id)})}),(0,w.jsx)("div",{className:"jsx-df1c681cdb543264 mt-1.5",children:(0,w.jsx)(t$,{value:k,className:"h-1 bg-black/40 [&>div]:bg-gradient-to-r [&>div]:from-amber-500 [&>div]:to-rose-400"})})]}),(0,w.jsxs)("div",{style:{borderColor:`${y.color}44`,background:`linear-gradient(135deg, ${y.color}11, rgba(0,0,0,0.4))`,boxShadow:`0 0 20px ${y.color}22`},className:"jsx-df1c681cdb543264 rounded-xl border p-3 relative overflow-hidden",children:[(0,w.jsx)("div",{style:{background:`${y.color}22`},className:"jsx-df1c681cdb543264 absolute -top-8 -right-8 h-24 w-24 rounded-full blur-2xl"}),(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 relative",children:[(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-2 mb-1.5",children:[(0,w.jsx)("div",{style:{background:y.bg,border:`1px solid ${y.color}44`},className:"jsx-df1c681cdb543264 h-8 w-8 rounded-lg flex items-center justify-center",children:(0,w.jsx)(j,{style:{color:y.color},className:"jsx-df1c681cdb543264 h-4 w-4"})}),(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264",children:[(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1.5",children:[(0,w.jsx)("span",{style:{background:y.bg,color:y.color},className:"jsx-df1c681cdb543264 text-[10px] font-mono px-1.5 py-0.5 rounded",children:y.label}),"combat"===b.type&&(0,w.jsxs)("span",{className:"jsx-df1c681cdb543264 text-[10px] text-muted-foreground",children:["胜率 ",Math.round(100*eM(e.power,b.difficulty)),"%"]}),b.difficulty>0&&(0,w.jsxs)("span",{className:"jsx-df1c681cdb543264 text-[10px] text-muted-foreground/60",children:["难度 ",b.difficulty]})]}),(0,w.jsx)("h4",{style:{color:y.color},className:"jsx-df1c681cdb543264 text-sm font-semibold mt-0.5",children:b.title})]})]}),(0,w.jsx)("p",{className:"jsx-df1c681cdb543264 text-[11px] text-muted-foreground/90 leading-relaxed",children:b.desc}),h&&(0,w.jsx)("div",{className:"jsx-df1c681cdb543264 mt-2 px-2 py-1.5 rounded-lg bg-black/40 border border-white/10",children:(0,w.jsx)("p",{className:"jsx-df1c681cdb543264 text-[11px] text-foreground/90",children:h})})]})]}),(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1.5",children:[b.cleared?e.currentNode<e.nodes.length-1?(0,w.jsxs)(tJ,{onClick:()=>{c(),f(null)},className:"flex-1 h-8",variant:"outline",children:[(0,w.jsx)(r4,{className:"h-3.5 w-3.5 mr-1"}),"前进"]}):(0,w.jsx)("div",{className:"jsx-df1c681cdb543264 flex-1 text-center text-xs text-emerald-300 py-1.5",children:"探险已完成 ✓"}):(0,w.jsxs)(tJ,{onClick:()=>{let e=i();e&&(f(e.log),e.ended?"victory"===e.endReason?tW("expeditionVictory"):tW("expeditionDefeat"):tW("expeditionNode"),u({title:e.ended?"victory"===e.endReason?"✦ 探险胜利!":"探险失败":"节点结算",description:e.log,variant:"defeat"===e.endReason?"destructive":"default"}))},className:"flex-1 bg-gradient-to-r from-amber-600 to-rose-500 hover:from-amber-500 hover:to-rose-400 text-white border-0 h-8",children:[(0,w.jsx)(tZ,{className:"h-3.5 w-3.5 mr-1"}),"探索节点"]}),(0,w.jsx)(tJ,{onClick:()=>{d(),u({title:"探险队撤退",description:"保留已获奖励,安全返回。"}),f(null)},variant:"ghost",size:"sm",className:"h-8 px-2 text-muted-foreground hover:text-rose-300",children:(0,w.jsx)(r9,{className:"h-3.5 w-3.5"})})]}),(0,w.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-2 text-[10px] px-1",children:[(0,w.jsx)("span",{className:"jsx-df1c681cdb543264 text-muted-foreground/60",children:"本次已获:"}),e.rewards.crystals>0&&(0,w.jsxs)("span",{className:"jsx-df1c681cdb543264 text-emerald-300",children:[O(e.rewards.crystals),"晶体"]}),e.rewards.insights>0&&(0,w.jsxs)("span",{className:"jsx-df1c681cdb543264 text-amber-300",children:[e.rewards.insights,"洞见"]}),e.rewards.contact>0&&(0,w.jsxs)("span",{className:"jsx-df1c681cdb543264 text-fuchsia-300",children:[e.rewards.contact.toFixed(1),"接触"]}),0===e.rewards.crystals&&0===e.rewards.insights&&(0,w.jsx)("span",{className:"jsx-df1c681cdb543264 text-muted-foreground/40",children:"暂无"})]}),(0,w.jsx)(tD.default,{id:"df1c681cdb543264",children:".echo-scroll::-webkit-scrollbar{width:4px;height:4px}.echo-scroll::-webkit-scrollbar-thumb{background:#ffffff1f;border-radius:2px}.echo-scroll::-webkit-scrollbar-track{background:0 0}"})]})}let r8=(0,to.default)("trophy",[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]]);function ne(){let e=tn(e=>e.achievements),t=Object.values(e).filter(Boolean).length,a=z(e);return(0,w.jsxs)("div",{className:"jsx-7e1dc0c087b6bd3d flex flex-col gap-2.5 h-full",children:[(0,w.jsxs)("div",{className:"jsx-7e1dc0c087b6bd3d flex items-center justify-between",children:[(0,w.jsxs)("h3",{className:"jsx-7e1dc0c087b6bd3d text-sm font-semibold flex items-center gap-1.5",children:[(0,w.jsx)(r8,{className:"h-4 w-4 text-amber-400"}),"成就"]}),(0,w.jsxs)("span",{className:"jsx-7e1dc0c087b6bd3d text-[10px] text-muted-foreground font-mono",children:[t," / ",L.length]})]}),(0,w.jsxs)("div",{className:"jsx-7e1dc0c087b6bd3d rounded-lg border border-amber-400/20 bg-amber-950/20 px-2.5 py-1.5 flex items-center gap-3 text-[10px]",children:[(0,w.jsx)("span",{className:"jsx-7e1dc0c087b6bd3d text-amber-300/80",children:"永久加成"}),a.crystalsPerSecPct>0&&(0,w.jsxs)("span",{className:"jsx-7e1dc0c087b6bd3d text-emerald-300",children:["产能 +",a.crystalsPerSecPct,"%"]}),a.insightPct>0&&(0,w.jsxs)("span",{className:"jsx-7e1dc0c087b6bd3d text-fuchsia-300",children:["洞见 +",a.insightPct,"%"]}),0===a.crystalsPerSecPct&&0===a.insightPct&&(0,w.jsx)("span",{className:"jsx-7e1dc0c087b6bd3d text-muted-foreground/60",children:"暂无(达成成就解锁)"})]}),(0,w.jsx)("div",{className:"jsx-7e1dc0c087b6bd3d flex-1 min-h-0 grid grid-cols-1 sm:grid-cols-2 gap-1.5 content-start overflow-y-auto echo-scroll pr-1",children:L.map(t=>{let a=!!e[t.id];return(0,w.jsxs)("div",{style:a?{boxShadow:`inset 0 0 16px ${t.color}11`}:void 0,className:`jsx-7e1dc0c087b6bd3d relative rounded-lg border px-2.5 py-2 transition-all duration-300 overflow-hidden ${a?"border-white/15 bg-black/30":"border-white/5 bg-black/15 opacity-60"}`,children:[a&&(0,w.jsx)("div",{style:{background:t.color},className:"jsx-7e1dc0c087b6bd3d absolute -top-6 -right-6 h-16 w-16 rounded-full blur-2xl opacity-40"}),(0,w.jsxs)("div",{className:"jsx-7e1dc0c087b6bd3d relative flex items-start gap-2",children:[(0,w.jsx)("div",{style:{background:a?`${t.color}22`:"rgba(255,255,255,0.04)",border:`1px solid ${a?t.color+"55":"rgba(255,255,255,0.08)"}`,color:a?t.color:"#666",boxShadow:a?`0 0 10px ${t.color}33`:"none"},className:"jsx-7e1dc0c087b6bd3d shrink-0 h-8 w-8 rounded-lg flex items-center justify-center text-base",children:a?t.icon:(0,w.jsx)(at,{className:"h-3.5 w-3.5"})}),(0,w.jsxs)("div",{className:"jsx-7e1dc0c087b6bd3d min-w-0 flex-1",children:[(0,w.jsx)("div",{style:{color:a?t.color:"rgba(255,255,255,0.5)"},className:"jsx-7e1dc0c087b6bd3d text-[11px] font-semibold truncate",children:t.name}),(0,w.jsx)("div",{className:"jsx-7e1dc0c087b6bd3d text-[10px] text-muted-foreground/80 leading-tight mt-0.5",children:t.desc}),a&&(0,w.jsxs)("div",{style:{color:t.color+"cc"},className:"jsx-7e1dc0c087b6bd3d text-[9px] mt-1 font-mono",children:["✦ ",t.rewardText]})]})]})]},t.id)})}),(0,w.jsx)(tD.default,{id:"7e1dc0c087b6bd3d",children:".echo-scroll::-webkit-scrollbar{width:5px}.echo-scroll::-webkit-scrollbar-thumb{background:#ffffff24;border-radius:3px}.echo-scroll::-webkit-scrollbar-track{background:0 0}"})]})}function nt(){let e=tn(e=>e._achievementQueue),t=tn(e=>e.consumeAchievementQueue),{toast:a}=(0,tO.useToast)();return(0,v.useEffect)(()=>{if(0!==e.length)for(let e of t())tW("achievement"),a({title:`🏆 成就解锁:${e.name}`,description:`${e.desc} 奖励:${e.rewardText}`})},[e,t,a]),null}function na(){let e=tn(e=>e.constellation??[]),t=(0,v.useRef)(null),a=(0,v.useRef)(null),[s,r]=(0,v.useState)({w:360,h:360}),[n,o]=(0,v.useState)(null),l=(0,v.useMemo)(()=>new Set(e),[e]);(0,v.useEffect)(()=>{let e=a.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.getBoundingClientRect();r({w:Math.max(280,t.width),h:Math.max(280,Math.min(420,t.width))})});return t.observe(e),()=>t.disconnect()},[]);let i=(0,v.useMemo)(()=>{let e=s.w/2;return{cx:e,cy:s.h/2,radius:.32*Math.min(s.w,s.h)}},[s]),c=(0,v.useMemo)(()=>{var e,t,a;return(e=i.cx,t=i.cy,a=i.radius,["mining","decoding","expedition","contact","economy","cosmic"].map((s,r)=>{let n=Math.PI/3*r-Math.PI/2;return{category:s,cx:e+a*Math.cos(n),cy:t+a*Math.sin(n),meta:K[s]}})).map(e=>{let t=function(e,t,a,s=1){return U.filter(t=>t.category===e).sort((e,t)=>e.order-t.order).map((e,r)=>({perk:e,x:t+(0===r?0:1===r?-18*s:18*s),y:a+(0===r?-22*s:14*s)}))}(e.category,e.cx,e.cy,1);return{...e,stars:t}})},[i]);(0,v.useEffect)(()=>{let a=t.current;if(!a)return;let r=a.getContext("2d");if(!r)return;let n=window.devicePixelRatio||1;a.width=s.w*n,a.height=s.h*n,a.style.width=`${s.w}px`,a.style.height=`${s.h}px`,r.setTransform(n,0,0,n,0,0);let o=0,d=performance.now(),u=t=>{let a=(t-d)/1e3;r.clearRect(0,0,s.w,s.h);let n=r.createRadialGradient(i.cx,i.cy,0,i.cx,i.cy,1.6*i.radius);n.addColorStop(0,"rgba(40,30,80,0.18)"),n.addColorStop(1,"rgba(5,4,16,0)"),r.fillStyle=n,r.fillRect(0,0,s.w,s.h),r.save(),r.translate(i.cx,i.cy);let h=6+1.5*Math.sin(1.5*a),f=r.createRadialGradient(0,0,0,0,0,3*h);for(let t of(f.addColorStop(0,"rgba(232,121,249,0.9)"),f.addColorStop(.4,"rgba(232,121,249,0.3)"),f.addColorStop(1,"rgba(232,121,249,0)"),r.fillStyle=f,r.beginPath(),r.arc(0,0,3*h,0,2*Math.PI),r.fill(),r.fillStyle="#fce7ff",r.beginPath(),r.arc(0,0,.6*h,0,2*Math.PI),r.fill(),r.restore(),c))G(e,t.category)>0&&(r.save(),r.strokeStyle=t.meta.glow,r.lineWidth=1,r.setLineDash([2,4]),r.globalAlpha=.4+.1*Math.sin(2*a+t.cx),r.beginPath(),r.moveTo(i.cx,i.cy),r.lineTo(t.cx,t.cy),r.stroke(),r.restore());for(let t of c){let s=G(e,t.category);r.save(),r.font="10px ui-monospace, monospace",r.textAlign="center",r.fillStyle=s>0?t.meta.hex:"rgba(148,163,184,0.5)",r.globalAlpha=.85,r.fillText(t.meta.name,t.cx,t.cy+38),r.restore();let n=t.stars.filter(e=>l.has(e.perk.id));for(let e of(n.length>=2&&(r.save(),r.strokeStyle=t.meta.glow,r.lineWidth=1.5,r.globalAlpha=.6,r.beginPath(),n.forEach((e,t)=>{0===t?r.moveTo(e.x,e.y):r.lineTo(e.x,e.y)}),r.stroke(),r.restore()),t.stars)){let s=l.has(e.perk.id);r.save(),r.translate(e.x,e.y);let n=s?.85+.15*Math.sin(3*a+.1*e.x):.3,o=s?10:5,i=r.createRadialGradient(0,0,0,0,0,o);if(i.addColorStop(0,s?t.meta.glow:"rgba(100,116,139,0.2)"),i.addColorStop(1,"rgba(0,0,0,0)"),r.fillStyle=i,r.globalAlpha=n,r.beginPath(),r.arc(0,0,o,0,2*Math.PI),r.fill(),r.globalAlpha=s?1:.4,r.fillStyle=s?t.meta.hex:"#475569",r.beginPath(),r.arc(0,0,s?3.5:2,0,2*Math.PI),r.fill(),s){r.strokeStyle=t.meta.hex,r.globalAlpha=.7*n,r.lineWidth=.8;let s=7+1.5*Math.sin(4*a+.1*e.y);r.beginPath(),r.moveTo(-s,0),r.lineTo(s,0),r.moveTo(0,-s),r.lineTo(0,s),r.stroke()}r.restore()}}o=requestAnimationFrame(u)};return o=requestAnimationFrame(u),()=>cancelAnimationFrame(o)},[c,i,s,e,l]);let d=J(e);return(0,w.jsxs)("div",{ref:a,className:"flex flex-col gap-2 min-h-0 h-full",children:[(0,w.jsxs)("div",{className:"flex items-center justify-between text-[11px] px-1",children:[(0,w.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,w.jsx)("span",{className:"text-fuchsia-300",children:"✦"}),(0,w.jsx)("span",{className:"text-muted-foreground",children:"星图天赋"}),(0,w.jsxs)("span",{className:"font-mono text-foreground",children:[d.unlocked,"/",d.total]})]}),(0,w.jsx)("span",{className:"text-muted-foreground/60 text-[10px]",children:"每次飞升可解锁 1 个"})]}),(0,w.jsxs)("div",{className:"relative rounded-xl bg-black/30 border border-white/5 overflow-hidden flex-shrink-0",children:[(0,w.jsx)("canvas",{ref:t,onMouseMove:e=>{let a=t.current;if(!a)return;let s=a.getBoundingClientRect(),r=e.clientX-s.left,n=e.clientY-s.top,i=null,d=14;for(let e of c)for(let t of e.stars){let e=Math.hypot(t.x-r,t.y-n);e<d&&(d=e,i={perk:t.perk,x:t.x,y:t.y,unlocked:l.has(t.perk.id)})}o(i)},onMouseLeave:()=>o(null),className:"block cursor-pointer"}),n&&(0,w.jsxs)("div",{className:"pointer-events-none absolute z-10 max-w-[200px] rounded-md bg-black/85 border border-white/10 px-2 py-1.5 text-[10px] leading-tight shadow-lg backdrop-blur-sm",style:{left:Math.min(n.x+12,s.w-200),top:Math.max(0,n.y-40)},children:[(0,w.jsxs)("div",{className:"font-bold mb-0.5",style:{color:K[n.perk.category].hex},children:[n.unlocked?"★ ":"☆ ",n.perk.name]}),(0,w.jsx)("div",{className:"text-muted-foreground",children:n.perk.desc}),(0,w.jsxs)("div",{className:"text-muted-foreground/60 mt-0.5",children:[K[n.perk.category].name," · 序",n.perk.order]})]})]}),(0,w.jsx)("div",{className:"grid grid-cols-3 gap-1 text-[10px]",children:Object.keys(K).map(t=>{let a=K[t],s=G(e,t),r=U.filter(e=>e.category===t).length;return(0,w.jsxs)("div",{className:"rounded-md bg-black/25 border border-white/5 px-1.5 py-1 flex items-center gap-1",style:s>0?{borderColor:`${a.hex}40`}:void 0,children:[(0,w.jsx)("span",{className:"inline-block h-1.5 w-1.5 rounded-full flex-shrink-0",style:{background:a.hex,boxShadow:s>0?`0 0 4px ${a.hex}`:"none"}}),(0,w.jsx)("span",{className:"text-muted-foreground truncate",children:a.name}),(0,w.jsxs)("span",{className:"ml-auto font-mono",style:{color:s>0?a.hex:"rgba(148,163,184,0.5)"},children:[s,"/",r]})]},t)})}),(0,w.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto pr-1 echo-scrollbar",children:0===e.length?(0,w.jsxs)("div",{className:"rounded-md bg-black/25 border border-dashed border-white/10 px-3 py-3 text-center text-[11px] text-muted-foreground/70",children:[(0,w.jsx)("div",{className:"mb-1 text-fuchsia-300/80",children:"✦"}),"尚未解锁任何天赋。",(0,w.jsx)("br",{}),"累积接触进度至 100%,发起「飞升」即可在 3 个随机天赋中选 1。"]}):(0,w.jsx)("div",{className:"flex flex-col gap-1",children:e.map(e=>{let t=V(e);if(!t)return null;let a=K[t.category];return(0,w.jsxs)("div",{className:"rounded-md bg-black/25 border px-2 py-1.5 flex items-center gap-2 text-[11px]",style:{borderColor:`${a.hex}30`},children:[(0,w.jsx)("span",{className:"inline-block h-2 w-2 rounded-full flex-shrink-0",style:{background:a.hex,boxShadow:`0 0 6px ${a.hex}`}}),(0,w.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,w.jsx)("div",{className:"text-foreground truncate",children:t.name}),(0,w.jsx)("div",{className:"text-muted-foreground/70 text-[10px] truncate",children:t.desc})]}),(0,w.jsx)("span",{className:"text-[9px] text-muted-foreground/50 font-mono",children:a.name})]},e)})})})]})}let ns=(0,to.default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);function nr({open:e,onOpenChange:t}){let a=tn(e=>e.pendingPerkChoices),s=tn(e=>e.constellation??[]),r=tn(e=>e.chooseConstellationPerk),n=tn(e=>e.rerollPerkChoices),[o,l]=(0,v.useState)(null);if((0,v.useEffect)(()=>{e||l(null)},[e]),(0,v.useEffect)(()=>{a&&a.length>0&&!e&&t(!0),(!a||0===a.length)&&e&&t(!1)},[a,e,t]),!a||0===a.length)return null;let i=J(s);return(0,w.jsx)(rw,{open:e,onOpenChange:t,children:(0,w.jsxs)(rN,{className:"max-w-md border-fuchsia-400/30 bg-gradient-to-br from-[#0a0820]/95 to-[#1a0f30]/95 backdrop-blur-md",children:[(0,w.jsxs)(rk,{children:[(0,w.jsxs)(rS,{className:"flex items-center gap-2 text-fuchsia-200",children:[(0,w.jsx)(tZ,{className:"h-4 w-4"}),"星图觉醒"]}),(0,w.jsxs)(rC,{className:"text-muted-foreground text-xs",children:["飞升带来的回响在星图上凝聚。从 3 道星辉中选择 1 道,永久获得其加成。",(0,w.jsx)("br",{}),(0,w.jsxs)("span",{className:"text-fuchsia-300/80",children:["当前已觉醒 ",i.unlocked,"/",i.total]})]})]}),(0,w.jsx)("div",{className:"grid grid-cols-1 gap-2 mt-1",children:a.map(e=>{let a=V(e);if(!a)return null;let s=K[a.category],n=o===e;return(0,w.jsxs)("button",{onClick:()=>{l(e),r(e)&&(tW("constellation"),setTimeout(()=>t(!1),500))},disabled:!!o,className:`group relative w-full text-left rounded-lg border px-3 py-2.5 transition-all overflow-hidden ${n?"border-fuchsia-400/80 bg-fuchsia-500/10 scale-[1.02]":o?"border-white/5 opacity-40":"border-white/10 hover:border-white/30 hover:bg-white/5"}`,style:{boxShadow:n?`0 0 20px ${s.glow}`:void 0},children:[(0,w.jsx)("div",{className:"absolute left-0 top-0 bottom-0 w-1",style:{background:s.hex,boxShadow:`0 0 8px ${s.hex}`}}),(0,w.jsxs)("div",{className:"pl-2 flex items-start gap-3",children:[(0,w.jsx)("div",{className:"flex-shrink-0 mt-0.5 h-8 w-8 rounded-full flex items-center justify-center text-sm font-bold",style:{background:`${s.hex}20`,color:s.hex,border:`1px solid ${s.hex}40`},children:s.name.charAt(0)}),(0,w.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,w.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,w.jsx)("span",{className:"text-sm font-bold text-foreground",children:a.name}),(0,w.jsx)("span",{className:"text-[9px] px-1 py-0.5 rounded font-mono",style:{background:`${s.hex}20`,color:s.hex},children:s.name})]}),(0,w.jsx)("div",{className:"text-[11px] text-muted-foreground",children:a.desc})]})]}),n&&(0,w.jsx)("div",{className:"absolute inset-0 pointer-events-none",children:[...Array(8)].map((e,t)=>(0,w.jsx)("span",{className:"absolute h-1 w-1 rounded-full animate-ping",style:{background:s.hex,left:`${20+8*t}%`,top:`${30+t%3*20}%`,animationDelay:`${50*t}ms`,animationDuration:"800ms"}},t))})]},e)})}),(0,w.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-2 border-t border-white/5",children:[(0,w.jsxs)(tJ,{variant:"ghost",size:"sm",onClick:()=>{n(),tW("uiClick")},disabled:!!o,className:"text-muted-foreground hover:text-foreground h-7 text-[11px]",children:[(0,w.jsx)(ns,{className:"h-3 w-3 mr-1"}),"重新抽取"]}),(0,w.jsx)("span",{className:"text-[10px] text-muted-foreground/60",children:"✦ 选择后永久保留,跨周目生效"})]})]})})}let nn=(0,to.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),no=(0,to.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),nl=(0,to.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);function ni({open:e,onOpenChange:t}){let a=tn(e=>e.chronicle??[]),s=tn(e=>e.ascensions??0),r=tn(e=>e.bossKills??0),n=tn(e=>e.starTidesEncountered??[]),o=(0,v.useMemo)(()=>[...a].reverse(),[a]),l=Math.max(1,Math.ceil(o.length/10)),[i,c]=(0,v.useState)(1);(0,v.useEffect)(()=>{i>l&&c(1)},[i,l]),(0,v.useEffect)(()=>{e&&(tW("chronicleOpen"),c(1))},[e]);let d=o.slice((i-1)*10,10*i);return(0,w.jsx)(rw,{open:e,onOpenChange:t,children:(0,w.jsxs)(rN,{className:"bg-gradient-to-br from-violet-950/80 via-black/90 to-fuchsia-950/60 border-fuchsia-400/30 max-w-3xl max-h-[88vh] overflow-hidden flex flex-col p-0 gap-0",children:[(0,w.jsx)("div",{className:"h-1 bg-gradient-to-r from-emerald-500 via-fuchsia-500 to-amber-500 opacity-70"}),(0,w.jsxs)(rk,{className:"px-6 pt-5 pb-3 space-y-1",children:[(0,w.jsxs)(rS,{className:"flex items-center gap-2 text-fuchsia-100 text-xl",children:[(0,w.jsx)(ae,{className:"h-5 w-5 text-fuchsia-300"}),"回响编年史",(0,w.jsx)("span",{className:"text-[11px] font-normal text-fuchsia-300/60 ml-2",children:"Chronicle of Echoes"})]}),(0,w.jsx)(rC,{className:"text-fuchsia-200/60 text-xs",children:"每一次飞升都在深空留下回响。这里铭刻着跨越维度的全部纪元。"}),(0,w.jsxs)("div",{className:"grid grid-cols-3 gap-2 pt-2",children:[(0,w.jsx)(nc,{icon:(0,w.jsx)(tZ,{className:"h-3 w-3"}),label:"飞升次数",value:s,color:"#e879f9"}),(0,w.jsx)(nc,{icon:(0,w.jsx)(r8,{className:"h-3 w-3"}),label:"BOSS 击破",value:r,color:"#fbbf24"}),(0,w.jsx)(nc,{icon:(0,w.jsx)(tc,{className:"h-3 w-3"}),label:"星潮亲历",value:n.length,color:"#34d399"})]})]}),(0,w.jsx)("div",{className:"flex-1 overflow-y-auto px-6 pb-3 echo-scroll",children:0===o.length?(0,w.jsx)(nd,{ascensions:s}):(0,w.jsxs)("div",{className:"relative",children:[(0,w.jsx)("div",{className:"absolute left-[27px] top-2 bottom-2 w-px bg-gradient-to-b from-fuchsia-400/40 via-violet-400/30 to-transparent"}),(0,w.jsx)("div",{className:"space-y-4",children:d.map((e,t)=>(0,w.jsx)(nu,{entry:e,isLatest:(i-1)*10+t===0,index:(i-1)*10+t},`${e.ascensionNumber}-${e.timestamp}`))})]})}),o.length>10&&(0,w.jsxs)("div",{className:"px-6 py-2.5 border-t border-fuchsia-400/15 bg-black/40 flex items-center justify-between gap-2",children:[(0,w.jsxs)("span",{className:"text-[11px] text-muted-foreground font-mono",children:["第 ",i," / ",l," 页 · 共 ",o.length," 条飞升记录"]}),(0,w.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,w.jsxs)(tJ,{variant:"ghost",size:"sm",disabled:i<=1,onClick:()=>{tW("tabSwitch"),c(e=>Math.max(1,e-1))},className:"h-7 px-2 text-fuchsia-300 hover:bg-fuchsia-500/15 disabled:opacity-30",children:[(0,w.jsx)(nl,{className:"h-3.5 w-3.5"}),"上一页"]}),(0,w.jsxs)(tJ,{variant:"ghost",size:"sm",disabled:i>=l,onClick:()=>{tW("tabSwitch"),c(e=>Math.min(l,e+1))},className:"h-7 px-2 text-fuchsia-300 hover:bg-fuchsia-500/15 disabled:opacity-30",children:["下一页",(0,w.jsx)(r4,{className:"h-3.5 w-3.5"})]})]})]})]})})}function nc({icon:e,label:t,value:a,color:s}){return(0,w.jsxs)("div",{className:"rounded-md border px-3 py-2 flex items-center gap-2",style:{borderColor:`${s}33`,background:`${s}0d`},children:[(0,w.jsx)("div",{style:{color:s},children:e}),(0,w.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,w.jsx)("div",{className:"text-[10px] text-muted-foreground truncate",children:t}),(0,w.jsx)("div",{className:"text-sm font-mono font-bold",style:{color:s},children:a})]})]})}function nd({ascensions:e}){let t=e>0;return(0,w.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[(0,w.jsxs)("div",{className:"relative mb-4",children:[(0,w.jsx)("div",{className:"absolute inset-0 blur-xl bg-fuchsia-500/20 rounded-full animate-pulse"}),(0,w.jsx)(ae,{className:"relative h-12 w-12 text-fuchsia-400/50"})]}),t?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{className:"text-fuchsia-200/70 text-sm",children:["已飞升 ",e," 次,但编年史尚无记录"]}),(0,w.jsx)("div",{className:"text-fuchsia-300/40 text-[11px] mt-2 max-w-xs",children:"编年史于 v0.4 启用。下一次飞升将自动铭刻新纪元,开启永恒叙事时间轴。"})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("div",{className:"text-fuchsia-200/70 text-sm",children:"尚未飞升,等待第一次跨越维度"}),(0,w.jsx)("div",{className:"text-fuchsia-300/40 text-[11px] mt-2 max-w-xs",children:"当接触进度满溢时,发起飞升将开启新周目,并在编年史中铭刻一段永恒回响。"})]})]})}function nu({entry:e,isLatest:t,index:a}){let s,r,n,o,l,i=["#34d399","#fb7185","#fbbf24","#e879f9","#fcd34d"][(e.ascensionNumber-1)%5];return(0,w.jsxs)("div",{className:"relative pl-16 animate-in fade-in slide-in-from-bottom-2 duration-500",style:{animationDelay:`${80*a}ms`},children:[(0,w.jsxs)("div",{className:"absolute left-[19px] top-3 z-10",children:[(0,w.jsx)("div",{className:"w-4 h-4 rounded-full border-2 flex items-center justify-center",style:{borderColor:i,background:`${i}22`,boxShadow:`0 0 12px ${i}88, 0 0 24px ${i}44`},children:(0,w.jsx)("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:i}})}),t&&(0,w.jsx)("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:`${i}33`}})]}),(0,w.jsxs)("div",{className:"rounded-lg border bg-black/40 backdrop-blur-sm overflow-hidden transition-all hover:scale-[1.005] hover:border-fuchsia-400/40",style:{borderColor:`${i}33`,boxShadow:t?`0 0 0 1px ${i}22, 0 4px 24px ${i}22`:"0 2px 8px rgba(0,0,0,0.4)"},children:[(0,w.jsx)("div",{className:"px-4 py-3 flex items-center justify-between border-b",style:{background:`linear-gradient(135deg, ${i}11, transparent)`,borderColor:`${i}22`},children:(0,w.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,w.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,w.jsxs)("span",{className:"text-[10px] font-mono font-bold px-1.5 py-0.5 rounded",style:{color:i,background:`${i}22`},children:["#",String(e.ascensionNumber).padStart(2,"0")]}),(0,w.jsx)("h4",{className:"text-sm font-bold tracking-wide truncate",style:{color:i,textShadow:`0 0 12px ${i}55`},children:e.epochName})]}),(0,w.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-[10px] text-muted-foreground/80",children:[(0,w.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,w.jsx)(nn,{className:"h-2.5 w-2.5"}),(r=String((s=new Date(e.timestamp)).getMonth()+1).padStart(2,"0"),n=String(s.getDate()).padStart(2,"0"),o=String(s.getHours()).padStart(2,"0"),l=String(s.getMinutes()).padStart(2,"0"),`${r}-${n} ${o}:${l}`)]}),(0,w.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,w.jsx)("span",{children:function(e){if(e<60)return`${e}秒`;let t=Math.floor(e/60),a=e%60;if(t<60)return a>0?`${t}${a}秒`:`${t}分钟`;let s=Math.floor(t/60);return`${s}小时${t%60}分`}(e.durationSec)}),t&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,w.jsx)("span",{className:"text-fuchsia-300 font-bold",children:"最新"})]})]})]})}),(0,w.jsx)("div",{className:"px-4 py-3 text-[12px] leading-relaxed text-fuchsia-100/75 font-serif",children:en({ascensionNumber:e.ascensionNumber,epochName:e.epochName,durationSec:e.durationSec,techsThisRun:e.summary.techsThisRun??e.summary.techsUnlocked,expThisRun:e.summary.expeditionsThisRun??e.summary.expeditionsCompleted,bossKillsThisRun:e.summary.bossKillsThisRun??e.summary.bossKills,decodedThisRun:e.summary.crystalsDecodedThisRun,newTides:e.tidesThisRun||[],perksThisAscension:e.perksThisAscension||[],blueprintsAfter:e.summary.blueprintsAfter,milestones:e.milestones||[]})}),(0,w.jsxs)("div",{className:"px-4 pb-3 flex flex-wrap gap-1.5",children:[(0,w.jsx)(nh,{icon:(0,w.jsx)(no,{className:"h-2.5 w-2.5"}),label:"解码",value:e.summary.crystalsDecodedThisRun,color:"#fb7185"}),(0,w.jsx)(nh,{icon:(0,w.jsx)(tZ,{className:"h-2.5 w-2.5"}),label:"技术",value:e.summary.techsUnlocked,color:"#34d399"}),(0,w.jsx)(nh,{icon:(0,w.jsx)(rZ,{className:"h-2.5 w-2.5"}),label:"探险",value:e.summary.expeditionsCompleted,color:"#fbbf24"}),e.summary.bossKills>0&&(0,w.jsx)(nh,{icon:(0,w.jsx)(r8,{className:"h-2.5 w-2.5"}),label:"BOSS",value:e.summary.bossKills,color:"#e879f9"}),(0,w.jsx)(nh,{icon:(0,w.jsx)(tc,{className:"h-2.5 w-2.5"}),label:"星潮",value:e.tidesThisRun.length,color:"#94a3b8"}),(0,w.jsx)(nh,{icon:(0,w.jsx)(r_,{className:"h-2.5 w-2.5"}),label:"星图",value:e.summary.constellationsTotal,color:"#fcd34d"})]}),e.tidesThisRun.length>0&&(0,w.jsx)("div",{className:"px-4 pb-2 flex flex-wrap gap-1",children:e.tidesThisRun.map(e=>{let t,a=(t=F[e.startsWith("tide_")?e.slice(5):e])?{name:t.name,color:t.color}:{name:e,color:"#94a3b8"};return(0,w.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded border",style:{color:a.color,borderColor:`${a.color}44`,background:`${a.color}11`},children:["✦ ",a.name]},e)})}),e.perksThisAscension.length>0&&(0,w.jsx)("div",{className:"px-4 pb-2 flex flex-wrap gap-1",children:e.perksThisAscension.map(e=>{let t=V(e),a=t?.category||"cosmic",s=K[a]?.hex||"#94a3b8",r=K[a]?.name||a,n=Q[e]||e;return(0,w.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded border inline-flex items-center gap-1",style:{color:s,borderColor:`${s}55`,background:`${s}11`},title:`${r} \xb7 ${t?.desc||""}`,children:[(0,w.jsx)(r3,{className:"h-2 w-2"}),n]},e)})}),e.milestones.length>0&&(0,w.jsx)("div",{className:"px-4 py-2 border-t flex flex-wrap gap-1.5",style:{borderColor:`${i}22`,background:`${i}08`},children:e.milestones.map((e,t)=>(0,w.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-fuchsia-500/15 text-fuchsia-200 border border-fuchsia-400/30 inline-flex items-center gap-1",children:[(0,w.jsx)(tZ,{className:"h-2 w-2"}),e]},t))})]})]})}function nh({icon:e,label:t,value:a,color:s}){return(0,w.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded inline-flex items-center gap-1 font-mono",style:{color:s,background:`${s}11`,border:`1px solid ${s}22`},children:[e,(0,w.jsx)("span",{className:"opacity-70",children:t}),(0,w.jsx)("span",{className:"font-bold",children:a})]})}let nf=(0,to.default)("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),nm=(0,to.default)("award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]),np=(0,to.default)("crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]),nx=(0,to.default)("medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]),ng=(0,to.default)("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),nb=(0,to.default)("flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]),ny=(0,to.default)("hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]),nw=(0,to.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),nv=(0,to.default)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),nj=(0,to.default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),nN=["routine","anomaly","singular"];function nk(e){return 0===e?{icon:np,color:"#fbbf24",label:"1st"}:1===e?{icon:nx,color:"#cbd5e1",label:"2nd"}:2===e?{icon:nm,color:"#f97316",label:"3rd"}:null}function nM(){let e,t,a,s,r,n,o=tn(e=>e.grantBeaconReward),l=tn(e=>e.claimWeeklyBeacon),i=tn(e=>e.claimTimedBeacon),c=tn(e=>e.claimChainReward),{toast:d}=(0,tO.useToast)(),[u,h]=(0,v.useState)(null),[f,m]=(0,v.useState)(null),[p,x]=(0,v.useState)(null),[g,b]=(0,v.useState)(null),[y,j]=(0,v.useState)(null),[N,k]=(0,v.useState)(null),[M,S]=(0,v.useState)(null),[C,_]=(0,v.useState)([]),[T,P]=(0,v.useState)("00:00:00"),[R,E]=(0,v.useState)("00:00:00"),[A,$]=(0,v.useState)("00:00:00"),[B,I]=(0,v.useState)(Date.now()),[D,L]=(0,v.useState)("local"),[z,F]=(0,v.useState)([]),[H,W]=(0,v.useState)(!1),[q,K]=(0,v.useState)(null),[U,V]=(0,v.useState)(!1),[X,Y]=(0,v.useState)(0),G=(0,v.useRef)(!1);(0,v.useEffect)(()=>{h(eE()),m(eO()),x(e2()),b(e5()),j(eW()),k(eq()),S(eY()),_(eI());let e=setInterval(()=>{I(Date.now()),m(eO()),b(e5()),k(eq()),S(eY()),h(e=>e??eE()),x(e=>e??e2()),j(e=>e??eW())},1e3);return()=>clearInterval(e)},[]),(0,v.useEffect)(()=>{P(ez(function(e=new Date){return Math.max(0,Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+1,0,0,0)-e.getTime())}(new Date(B)))),E(ez(e1(new Date(B)))),$(ez(function(e=new Date){let t=(e.getUTCDay()+6)%7;return Math.max(0,Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()-t,0,0,0)+6048e5-e.getTime())}(new Date(B))))},[B]),(0,v.useEffect)(()=>{Y(e7())},[]);let J=(0,v.useCallback)(async()=>{if(!G.current){G.current=!0,W(!0),K(null);try{let e=await e6();F(e),V(!0),Y(e7()),0===e.length&&K("尚无全球记录,成为首位登顶者!")}catch{K("全球榜连接失败,请稍后重试")}finally{W(!1),G.current=!1}}},[]);(0,v.useEffect)(()=>{"global"!==D||U||H||J()},[D,U,H,J]);let Q=(0,v.useCallback)(()=>{if(!u||!f||null===f.completedAt||f.claimed)return;let e=function(e,t){if(t.claimed||null===t.completedAt)return{rewardInsight:0,rewardContact:0,score:0,leaderboard:eI()};let a=eA(e,t.progress,t.durationSec),s={timestamp:Date.now(),dateKey:e.dateKey,challenge:e.type,difficulty:e.difficulty,progress:t.progress/e.goal,score:a,durationSec:t.durationSec},r=eD(s);return eL({...t,claimed:!0}),{rewardInsight:e.rewardInsight,rewardContact:e.rewardContact,score:a,leaderboard:r,entry:s}}(u,f);_(e.leaderboard),m(eO()),o(e.rewardInsight,e.rewardContact),tW("achievement"),d({title:"✦ 每日信标奖励已领取",description:`+${e.rewardInsight} 洞见 \xb7 +${e.rewardContact.toFixed(1)} 接触 \xb7 得分 ${e.score}`}),e.entry&&e8(e.entry).then(t=>{t>=1&&(Y(e.entry.timestamp),"global"===D&&J())})},[u,f,d,o,D,J]),Z=(0,v.useCallback)(()=>{if(!p||!g||null===g.completedAt||g.claimed)return;let e=i();_(eI()),b(e5()),(e.rewardInsight>0||e.rewardContact>0)&&(tW("achievement"),d({title:"✦ 限时挑战奖励已领取",description:`+${e.rewardInsight} 洞见 \xb7 +${e.rewardContact.toFixed(1)} 接触 \xb7 得分 ${e.score}`}),Y(e7()),"global"===D&&J())},[p,g,d,i,D,J]),ee=(0,v.useCallback)(()=>{if(!y||!N||null===N.completedAt||N.claimed)return;let e=l();_(eI()),k(eq()),(e.rewardInsight>0||e.rewardContact>0)&&(tW("achievement"),d({title:"✦ 周挑战奖励已领取",description:`+${e.rewardInsight} 洞见 \xb7 +${e.rewardContact.toFixed(1)} 接触 \xb7 得分 ${e.score}`}),Y(e7()),"global"===D&&J())},[y,N,d,l,D,J]),et=(0,v.useCallback)(e=>{let t=eX.find(t=>t.milestone===e),a=c(e);S(eY()),a.ok&&(tW("achievement"),d({title:`✦ ${a.label||t?.label||"里程碑"} 已领取`,description:`+${a.rewardInsight} 洞见 \xb7 +${a.rewardContact.toFixed(1)} 接触`}))},[d,c]);if(!u||!f||!p||!g||!y||!N||!M)return(0,w.jsx)("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground/60",children:"正在校准深空信标…"});let ea=e_[u.difficulty],es=eT[u.type],er=Math.min(100,f.progress/u.goal*100),en=null!==f.completedAt,eo=f.claimed,el=en&&!eo,ei=e_[p.difficulty],ec=eT[p.type],ed=Math.min(100,g.progress/p.goal*100),eu=null!==g.completedAt,eh=g.claimed,ef=eu&&!eh,em=e_[y.difficulty],ep=eT[y.type],ex=Math.min(100,N.progress/y.goal*100),eg=null!==N.completedAt,eb=N.claimed,ey=eg&&!eb,ew=function(e){let t=eQ(e),a=0;for(let t of eV)e>=t&&(a=t);if(null===t)return{current:e,next:null,prev:a,progressPct:100};let s=t-a,r=e-a;return{current:e,next:t,prev:a,progressPct:Math.min(100,Math.max(0,s>0?Math.round(r/s*100):100))}}(M.currentStreak),ev=eQ(M.currentStreak),ej=eP(),eN=M.lastCompletedDateKey===ej;return(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex flex-col gap-2.5 h-full overflow-y-auto echo-scroll pr-0.5",children:[(0,w.jsx)(tD.default,{id:"12f5fcaad97b9273",dynamic:[ea.glow,ea.glow,ea.glow,ea.glow],children:`.echo-scroll::-webkit-scrollbar{width:4px}.echo-scroll::-webkit-scrollbar-thumb{background:#ffffff1f;border-radius:2px}.echo-scroll::-webkit-scrollbar-track{background:0 0}@keyframes beacon-pulse-ring{0%{opacity:.8;transform:scale(.8)}to{opacity:0;transform:scale(2.2)}}@keyframes beacon-glow{0%,to{box-shadow:0 0 18px ${ea.glow},inset 0 0 12px ${ea.glow}}50%{box-shadow:0 0 32px ${ea.glow},inset 0 0 20px ${ea.glow}}}@keyframes weekly-glow{0%,to{box-shadow:0 0 18px #e879f959,inset 0 0 12px #e879f940}50%{box-shadow:0 0 32px #e879f980,inset 0 0 20px #e879f959}}@keyframes timed-glow{0%,to{box-shadow:0 0 18px #fbbf2466,inset 0 0 12px #fbbf2440}50%{box-shadow:0 0 30px #fbbf248c,inset 0 0 20px #fbbf2459}}@keyframes timed-urgent{0%,to{box-shadow:0 0 18px #f43f5e80,inset 0 0 12px #f43f5e4d}50%{box-shadow:0 0 34px #f43f5eb3,inset 0 0 22px #f43f5e66}}@keyframes chain-milestone-pulse{0%,to{transform:scale(1);box-shadow:0 0 #fb71858c}50%{transform:scale(1.06);box-shadow:0 0 0 8px #fb718500}}.chain-milestone-reachable{animation:1.8s ease-in-out infinite chain-milestone-pulse}@keyframes chain-streak-flux{0%,to{background-position:0%}50%{background-position:100%}}.chain-streak-text{-webkit-text-fill-color:transparent;background:linear-gradient(90deg,#fbbf24,#fb7185,#fbbf24) 0 0/200% 100%;-webkit-background-clip:text;background-clip:text;animation:4s ease-in-out infinite chain-streak-flux}`}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between",children:[(0,w.jsxs)("h3",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-sm font-semibold flex items-center gap-1.5",children:[(0,w.jsx)(nf,{className:"h-4 w-4 text-fuchsia-400"}),"深空信标"]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1 text-[10px] text-muted-foreground/70",children:[(0,w.jsx)(nn,{className:"h-3 w-3"}),"次日重置",(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono text-fuchsia-300/90",children:T})]})]}),(0,w.jsxs)("div",{style:{borderColor:`${ea.color}55`,background:`linear-gradient(135deg, ${ea.color}1f, rgba(0,0,0,0.45))`,animation:en?"none":"beacon-glow 3s ease-in-out infinite"},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" relative rounded-xl border p-3 overflow-hidden",children:[!en&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("div",{style:{border:`1.5px solid ${ea.color}`,animation:"beacon-pulse-ring 2.5s ease-out infinite"},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" absolute top-4 right-4 h-10 w-10 rounded-full pointer-events-none"}),(0,w.jsx)("div",{style:{border:`1.5px solid ${ea.color}`,animation:"beacon-pulse-ring 2.5s ease-out infinite 1.25s"},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" absolute top-4 right-4 h-10 w-10 rounded-full pointer-events-none"})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" relative",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1.5 mb-2",children:[(0,w.jsxs)("span",{style:{background:`${ea.color}22`,color:ea.color,border:`1px solid ${ea.color}55`},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]]),children:ea.icon}),ea.label]}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded bg-white/5 text-muted-foreground border border-white/10",children:[es.icon," ",es.label]}),en&&(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded bg-emerald-500/20 text-emerald-300 border border-emerald-500/40 flex items-center gap-1",children:[(0,w.jsx)(tZ,{className:"h-2.5 w-2.5"})," 已完成"]})]}),(0,w.jsx)("h4",{style:{color:ea.color,textShadow:`0 0 10px ${ea.glow}`},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-sm font-semibold mb-1",children:u.title}),(0,w.jsx)("p",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[11px] text-muted-foreground/80 leading-relaxed mb-2.5",children:u.desc}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" mb-2",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between mb-1",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] text-muted-foreground/70",children:"进度"}),(0,w.jsxs)("span",{style:{color:ea.color},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[11px] font-mono font-semibold",children:[Math.min(f.progress,u.goal)," / ",u.goal," ",es.unit]})]}),(0,w.jsx)(t$,{value:er,className:"h-2 bg-black/40",style:{"--progress-color":ea.color}})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between gap-2",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-2 text-[10px]",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-muted-foreground/60",children:"奖励:"}),u.rewardInsight>0&&(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-amber-300 font-mono",children:["+",O(u.rewardInsight),"洞见"]}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-fuchsia-300 font-mono",children:["+",u.rewardContact.toFixed(1),"接触"]})]}),(0,w.jsx)(tJ,{onClick:Q,disabled:!el,size:"sm",className:"h-7 px-3 text-[11px] border-0",style:{background:el?`linear-gradient(90deg, ${ea.color}, ${ea.color}cc)`:`${ea.color}1a`,color:el?"#022c22":`${ea.color}99`},children:eo?"已领取":el?"领取奖励":en?"已领取":"进行中…"})]}),en&&f.durationSec>0&&(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" mt-1.5 text-[10px] text-muted-foreground/50 text-center",children:["完成用时 ",Math.floor(f.durationSec/60),"分",f.durationSec%60,"秒"]})]})]}),(e=18e5>e1(new Date(B))&&!eu,t=eu?"none":e?"timed-urgent 1.5s ease-in-out infinite":"timed-glow 3s ease-in-out infinite",(0,w.jsxs)("div",{style:{borderColor:e?"rgba(244,63,94,0.5)":"rgba(251,191,36,0.4)",background:e?"linear-gradient(135deg, rgba(244,63,94,0.12), rgba(251,191,36,0.08), rgba(0,0,0,0.45))":"linear-gradient(135deg, rgba(251,191,36,0.14), rgba(0,0,0,0.45))",animation:t},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" relative rounded-xl border p-3 overflow-hidden",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between mb-2",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1.5",children:[(0,w.jsx)(ny,{className:`h-3.5 w-3.5 ${e?"text-rose-400":"text-amber-400"}`}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" "+`text-xs font-semibold ${e?"text-rose-200":"text-amber-200"}`,children:"限时挑战 · TIMED"})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1 text-[9px] text-muted-foreground/70",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono text-amber-300/70",children:e0().split("_").slice(1).join(" ")}),(0,w.jsx)(nn,{className:"h-2.5 w-2.5"}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" "+`font-mono ${e?"text-rose-300":"text-amber-300/90"}`,children:R})]})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1.5 mb-2",children:[(0,w.jsxs)("span",{style:{background:`${ei.color}22`,color:ei.color,border:`1px solid ${ei.color}55`},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]]),children:ei.icon}),ei.label]}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded bg-white/5 text-muted-foreground border border-white/10",children:[ec.icon," ",ec.label]}),eu&&(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded bg-emerald-500/20 text-emerald-300 border border-emerald-500/40 flex items-center gap-1",children:[(0,w.jsx)(tZ,{className:"h-2.5 w-2.5"})," 已完成"]}),e&&!eu&&(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded bg-rose-500/20 text-rose-300 border border-rose-500/40 flex items-center gap-1 animate-pulse",children:"即将结束"})]}),(0,w.jsx)("h4",{style:{color:ei.color,textShadow:`0 0 10px ${ei.glow}`},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-sm font-semibold mb-1",children:p.title}),(0,w.jsx)("p",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] text-muted-foreground/80 leading-relaxed mb-2",children:p.desc}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" mb-2",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between mb-1",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] text-muted-foreground/70",children:"进度"}),(0,w.jsxs)("span",{style:{color:ei.color},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[11px] font-mono font-semibold",children:[Math.min(g.progress,p.goal)," / ",p.goal," ",ec.unit]})]}),(0,w.jsx)(t$,{value:ed,className:"h-2 bg-black/40",style:{"--progress-color":e?"#f43f5e":ei.color}})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between gap-2",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1.5 text-[10px]",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-muted-foreground/60",children:"奖励:"}),p.rewardInsight>0&&(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-amber-300 font-mono",children:["+",O(p.rewardInsight),"洞见"]}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-fuchsia-300 font-mono",children:["+",p.rewardContact.toFixed(1),"接触"]})]}),(0,w.jsx)(tJ,{onClick:Z,disabled:!ef,size:"sm",className:"h-7 px-3 text-[11px] border-0",style:{background:ef?"linear-gradient(90deg, #34d399, #34d399cc)":"rgba(251,191,36,0.10)",color:ef?"#022c22":"rgba(251,191,36,0.55)"},children:eh?"已领取":ef?"领取奖励":eu?"已领取":"进行中…"})]}),eu&&g.durationSec>0&&(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" mt-1.5 text-[10px] text-muted-foreground/50 text-center",children:["完成用时 ",Math.floor(g.durationSec/60),"分",g.durationSec%60,"秒"]})]})),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" grid grid-cols-1 lg:grid-cols-2 gap-2.5",children:[(0,w.jsxs)("div",{style:{borderColor:"rgba(232,121,249,0.4)",background:"linear-gradient(135deg, rgba(232,121,249,0.12), rgba(0,0,0,0.45))",animation:eg?"none":"weekly-glow 3.5s ease-in-out infinite"},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" relative rounded-xl border p-3 overflow-hidden",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between mb-2",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1.5",children:[(0,w.jsx)(r3,{className:"h-3.5 w-3.5 text-fuchsia-400"}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-xs font-semibold text-fuchsia-200",children:"周挑战 · WEEKLY"})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1 text-[9px] text-muted-foreground/70",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono text-fuchsia-300/80",children:y.weekKey}),(0,w.jsx)(nn,{className:"h-2.5 w-2.5"}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono text-fuchsia-300/90",children:A})]})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1.5 mb-2",children:[(0,w.jsxs)("span",{style:{background:`${em.color}22`,color:em.color,border:`1px solid ${em.color}55`},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]]),children:em.icon}),em.label]}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded bg-white/5 text-muted-foreground border border-white/10",children:[ep.icon," ",ep.label]}),eg&&(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded bg-emerald-500/20 text-emerald-300 border border-emerald-500/40 flex items-center gap-1",children:[(0,w.jsx)(tZ,{className:"h-2.5 w-2.5"})," 已完成"]})]}),(0,w.jsx)("h4",{style:{color:em.color,textShadow:`0 0 10px ${em.glow}`},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-sm font-semibold mb-1",children:y.title}),(0,w.jsx)("p",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] text-muted-foreground/80 leading-relaxed mb-2",children:y.desc}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" mb-2",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between mb-1",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] text-muted-foreground/70",children:"进度"}),(0,w.jsxs)("span",{style:{color:em.color},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[11px] font-mono font-semibold",children:[Math.min(N.progress,y.goal)," / ",y.goal," ",ep.unit]})]}),(0,w.jsx)(t$,{value:ex,className:"h-2 bg-black/40",style:{"--progress-color":em.color}})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between gap-2",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1.5 text-[10px]",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-muted-foreground/60",children:"奖励:"}),y.rewardInsight>0&&(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-amber-300 font-mono",children:["+",O(y.rewardInsight),"洞见"]}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-fuchsia-300 font-mono",children:["+",y.rewardContact.toFixed(1),"接触"]})]}),(0,w.jsx)(tJ,{onClick:ee,disabled:!ey,size:"sm",className:"h-7 px-3 text-[11px] border-0",style:{background:ey?"linear-gradient(90deg, #34d399, #34d399cc)":"rgba(232,121,249,0.10)",color:ey?"#022c22":"rgba(232,121,249,0.55)"},children:eb?"已领取":ey?"领取奖励":eg?"已领取":"进行中…"})]}),eg&&N.durationSec>0&&(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" mt-1.5 text-[10px] text-muted-foreground/50 text-center",children:["完成用时 ",Math.floor(N.durationSec/60),"分",N.durationSec%60,"秒"]})]}),(0,w.jsxs)("div",{style:{borderColor:"rgba(251,191,36,0.35)",background:"linear-gradient(135deg, rgba(251,191,36,0.10), rgba(251,113,133,0.10), rgba(0,0,0,0.4))"},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" relative rounded-xl border p-3 overflow-hidden",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between mb-2",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1.5",children:[(0,w.jsx)(ng,{className:"h-3.5 w-3.5 text-amber-400"}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-xs font-semibold text-amber-200",children:"信标链 · CHAIN"})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-baseline gap-1",children:[(0,w.jsx)(nb,{className:"h-3 w-3 text-rose-400"}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] text-muted-foreground/60",children:"连续"}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" chain-streak-text text-2xl font-bold font-mono leading-none",children:M.currentStreak}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] text-muted-foreground/60",children:"天"})]})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" mb-2 flex items-center justify-between",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] text-muted-foreground/70",children:eN?"今日已贡献":"今日尚未完成日挑战"}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" "+`text-[10px] font-mono px-1.5 py-0.5 rounded border ${eN?"bg-emerald-500/15 text-emerald-300 border-emerald-500/30":"bg-white/5 text-muted-foreground/70 border-white/10"}`,children:eN?"✓ 已记录":"○ 待完成"})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between mb-2 relative",children:[(0,w.jsx)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" absolute top-6 left-[12.5%] right-[12.5%] h-[2px] bg-white/10"}),(s=(a={0:12.5,3:12.5,7:37.5,14:62.5,30:87.5})[ew.prev]??12.5,r=null!==ew.next?a[ew.next]??87.5:87.5,(n=Math.max(0,s+(r-s)*(ew.progressPct/100)-12.5))<=0?null:(0,w.jsx)("div",{style:{left:"12.5%",width:`${n}%`,background:"linear-gradient(90deg, #fbbf24, #fb7185)",boxShadow:"0 0 8px rgba(251,113,133,0.5)"},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" absolute top-6 h-[2px]"})),eV.map(e=>{let t=eX.find(t=>t.milestone===e),a=M.milestonesClaimed.includes(e),s=M.currentStreak>=e&&!a,r=M.currentStreak>0&&ev===e,n="rgba(255,255,255,0.05)",o="rgba(255,255,255,0.15)",l="rgba(255,255,255,0.4)";return a?(n="rgba(52,211,153,0.25)",o="#34d399",l="#34d399"):s?(n="rgba(251,113,133,0.20)",o="#fb7185",l="#fb7185"):r&&(n="rgba(251,191,36,0.20)",o="#fbbf24",l="#fbbf24"),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex flex-col items-center gap-1 z-10 flex-1",children:[(0,w.jsx)("div",{style:{background:n,borderColor:o,color:l},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" "+`w-12 h-12 rounded-full flex items-center justify-center font-mono font-bold text-sm border-2 ${s?"chain-milestone-reachable":""}`,children:a?(0,w.jsx)(tZ,{className:"h-4 w-4"}):e}),(0,w.jsx)("span",{style:{color:l},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[9px] text-center leading-tight",children:t?.label}),a?(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[9px] text-emerald-400/80 font-mono",children:"已领"}):s?(0,w.jsx)(tJ,{onClick:()=>et(e),size:"sm",className:"h-5 px-2 text-[9px] py-0 border-0",style:{background:"linear-gradient(90deg, #fb7185, #f43f5e)",color:"#1c0608"},children:"领取"}):(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[9px] text-muted-foreground/40 font-mono",children:["+",t?.rewardInsight,"洞"]})]},e)})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" mb-2",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between mb-1",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] text-muted-foreground/70",children:null===ew.next?"已通关全部里程碑":`下一目标:${ew.next} 天`}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[10px] font-mono text-amber-300",children:[ew.current,null!==ew.next&&` / ${ew.next}`," 天"]})]}),(0,w.jsx)(t$,{value:ew.progressPct,className:"h-1.5 bg-black/40",style:{"--progress-color":"#fbbf24"}})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between gap-2 text-[10px]",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-2",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-muted-foreground/60",children:"最长"}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono text-amber-300",children:[M.longestStreak,"天"]})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-2",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-muted-foreground/60",children:"累计"}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono text-rose-300",children:[M.totalCompletions,"次"]})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1",children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-muted-foreground/60",children:"续命"}),M.graceUsed>=1?(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono text-rose-400/80",children:"已用"}):(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono text-emerald-400/80",children:"可用"})]})]})]})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" rounded-xl border border-white/10 bg-black/30 p-2.5",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-between gap-2 mb-2",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1.5",children:[(0,w.jsx)(r8,{className:"h-3.5 w-3.5 text-amber-400"}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-xs font-semibold",children:"深空排行榜"})]}),(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1",children:[(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-0.5 p-0.5 rounded-lg bg-black/40 border border-white/10",children:[(0,w.jsxs)("button",{type:"button",onClick:()=>L("local"),"aria-pressed":"local"===D,className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" "+`flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono transition-colors ${"local"===D?"bg-amber-500/25 text-amber-300 border border-amber-500/40":"text-muted-foreground/60 hover:text-muted-foreground border border-transparent"}`,children:[(0,w.jsx)(r8,{className:"h-2.5 w-2.5"}),"本地"]}),(0,w.jsxs)("button",{type:"button",onClick:()=>L("global"),"aria-pressed":"global"===D,className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" "+`flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono transition-colors ${"global"===D?"bg-emerald-500/25 text-emerald-300 border border-emerald-500/40":"text-muted-foreground/60 hover:text-muted-foreground border border-transparent"}`,children:[(0,w.jsx)(nw,{className:"h-2.5 w-2.5"}),"全球"]})]}),"global"===D&&(0,w.jsx)("button",{type:"button",onClick:()=>void J(),disabled:H,"aria-label":"刷新全球榜",title:"刷新全球榜",className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" p-1 rounded-md text-muted-foreground/70 hover:text-emerald-300 hover:bg-emerald-500/10 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:(0,w.jsx)(ns,{className:`h-3 w-3 ${H?"animate-spin":""}`})})]})]}),(0,w.jsx)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" mb-1.5 text-[10px] text-muted-foreground/50 flex items-center gap-2",children:"local"===D?(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]]),children:["本机 Top ",C.length||0," · 离线可用"]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]]),children:["全球 Top ",z.length||0]}),U&&!H&&z.length>0&&(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-emerald-400/60",children:"· 已同步"}),H&&(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-amber-400/70 flex items-center gap-1",children:[(0,w.jsx)(nj,{className:"h-2.5 w-2.5 animate-spin"}),"同步中…"]})]})}),"local"===D&&(0===C.length?(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-center py-4 text-[11px] text-muted-foreground/40",children:[(0,w.jsx)(r8,{className:"h-6 w-6 mx-auto mb-1 opacity-30"}),"尚无记录。完成限时、每日或本周信标即可登榜。"]}):(0,w.jsx)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" space-y-0.5 max-h-[200px] overflow-y-auto echo-scroll",children:C.map((e,t)=>{let a=nk(t),s=e_[e.difficulty],r=eT[e.challenge],n=e.dateKey===eP()||e.dateKey===eH()||e.dateKey===e0();return(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" "+`flex items-center gap-2 px-2 py-1 rounded-lg text-[11px] ${e.isWeekly?"bg-fuchsia-500/10 border border-fuchsia-500/20":e.isTimed?"bg-amber-500/10 border border-amber-500/20":n?"bg-fuchsia-500/10 border border-fuchsia-500/20":"hover:bg-white/5"}`,children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" w-6 flex items-center justify-center",children:a?(0,w.jsx)(a.icon,{className:"h-3.5 w-3.5",style:{color:a.color}}):(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-muted-foreground/50 font-mono",children:t+1})}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1 flex-1 min-w-0",children:[(0,w.jsx)("span",{style:{color:s.color},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono",children:s.icon}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-muted-foreground/80 truncate",children:r.label}),e.isWeekly&&(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[9px] font-mono px-1 rounded bg-fuchsia-500/20 text-fuchsia-300 border border-fuchsia-500/40",children:"WEEK"}),e.isTimed&&(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[9px] font-mono px-1 rounded bg-amber-500/20 text-amber-300 border border-amber-500/40",children:"TIMED"}),e.progress>=1&&(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-emerald-400/70",children:"✓"})]}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-muted-foreground/50 font-mono text-[10px] w-16 text-right",children:[Math.floor(e.durationSec/60),"m",e.durationSec%60,"s"]}),(0,w.jsx)("span",{style:{color:s.color},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono font-semibold w-12 text-right",children:O(e.score)})]},`local-${e.timestamp}-${t}`)})})),"global"===D&&(0,w.jsx)(w.Fragment,{children:H&&0===z.length?(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-center py-4 text-[11px] text-muted-foreground/60 flex items-center justify-center gap-2",children:[(0,w.jsx)(nj,{className:"h-3.5 w-3.5 animate-spin text-emerald-400"}),"正在拉取全球榜…"]}):0===z.length?(0,w.jsx)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-center py-4 text-[11px] text-muted-foreground/40",children:q?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(nv,{className:"h-6 w-6 mx-auto mb-1 opacity-40 text-rose-400"}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-rose-300/70",children:q}),(0,w.jsx)("button",{type:"button",onClick:()=>void J(),className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" block mx-auto mt-2 text-[10px] text-emerald-400/80 hover:text-emerald-300 underline-offset-2 hover:underline",children:"重试"})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(nw,{className:"h-6 w-6 mx-auto mb-1 opacity-30 text-emerald-400"}),"尚无全球记录。完成挑战并领取即可登顶全球榜!"]})}):(0,w.jsx)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" space-y-0.5 max-h-[200px] overflow-y-auto echo-scroll",children:z.map((e,t)=>{let a=nk(t),s=e_[e.difficulty]??e_.routine,r=eT[e.challenge]??{label:e.challenge,icon:"·",unit:""},n=X>0&&e.timestamp===X;return(0,w.jsxs)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" "+`flex items-center gap-2 px-2 py-1 rounded-lg text-[11px] ${n?"bg-emerald-500/15 border border-emerald-500/40 shadow-[0_0_12px_rgba(52,211,153,0.25)]":e.isWeekly?"bg-fuchsia-500/10 border border-fuchsia-500/20":e.isTimed?"bg-amber-500/10 border border-amber-500/20":"hover:bg-white/5"}`,children:[(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" w-6 flex items-center justify-center",children:a?(0,w.jsx)(a.icon,{className:"h-3.5 w-3.5",style:{color:a.color}}):(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" "+`font-mono ${n?"text-emerald-300 font-bold":"text-muted-foreground/50"}`,children:t+1})}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1 flex-1 min-w-0",children:[(0,w.jsx)("span",{style:{color:s.color},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono",children:s.icon}),(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-muted-foreground/80 truncate",children:r.label}),e.isWeekly&&(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[9px] font-mono px-1 rounded bg-fuchsia-500/20 text-fuchsia-300 border border-fuchsia-500/40",children:"WEEK"}),e.isTimed&&(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[9px] font-mono px-1 rounded bg-amber-500/20 text-amber-300 border border-amber-500/40",children:"TIMED"}),n&&(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-[9px] font-mono px-1 rounded bg-emerald-500/25 text-emerald-200 border border-emerald-500/50",children:"YOU"}),e.progress>=1&&(0,w.jsx)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-emerald-400/70",children:"✓"})]}),(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" text-muted-foreground/50 font-mono text-[10px] w-16 text-right",children:[Math.floor(e.durationSec/60),"m",e.durationSec%60,"s"]}),(0,w.jsx)("span",{style:{color:n?"#34d399":s.color},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" font-mono font-semibold w-12 text-right",children:O(e.score)})]},`global-${e.timestamp}-${t}`)})})})]}),(0,w.jsx)("div",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center justify-center gap-3 text-[9px] text-muted-foreground/50",children:nN.map(e=>{let t=e_[e];return(0,w.jsxs)("span",{className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]])+" flex items-center gap-1",children:[(0,w.jsx)("span",{style:{color:t.color},className:tD.default.dynamic([["12f5fcaad97b9273",[ea.glow,ea.glow,ea.glow,ea.glow]]]),children:t.icon}),t.label," ×",t.mult]},e)})})]})}function nS(){let[e,t]=(0,v.useState)(!1),[a,s]=(0,v.useState)(0),[r,n]=(0,v.useState)(null),[o,l]=(0,v.useState)(!1),i=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!function(){try{return"1"===localStorage.getItem(rJ)}catch{return!0}}()){let e=setTimeout(()=>t(!0),600);return()=>clearTimeout(e)}},[]),(0,v.useEffect)(()=>{let e=()=>{s(0),l(!1),t(!0)};return window.addEventListener("echo-nexus-tutorial-restart",e),()=>window.removeEventListener("echo-nexus-tutorial-restart",e)},[]),tn(e=>e.crystals),tn(e=>e.pulsePower),tn(e=>e.tech),tn(e=>e.activePuzzle),tn(e=>!!e.activeExpedition&&!e.activeExpedition.finished);let c=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!e)return;let t=rG[a];if(!t?.expectAction)return;let s=0,r=()=>{let e=tn.getState(),a=!1;"pulse"===t.expectAction?(null===c.current&&(c.current=e.crystals),a=e.crystals>=(c.current??0)+Math.max(.5,.5*e.pulsePower)):"decode-start"===t.expectAction?a=!!e.activePuzzle:"tech-buy"===t.expectAction?a=Object.values(e.tech).some(e=>e>0):"expedition-start"===t.expectAction&&(a=!!e.activeExpedition&&!e.activeExpedition.finished),l(e=>e!==a?a:e),s=requestAnimationFrame(r)};return s=requestAnimationFrame(r),()=>cancelAnimationFrame(s)},[e,a]);let d=(0,v.useCallback)(()=>{let e=rG[a];if(!e?.target)return void n(null);let t=document.querySelector(`[data-tut="${e.target}"]`);if(!t)return void n(null);let s=t.getBoundingClientRect();n({left:s.left,top:s.top,width:s.width,height:s.height})},[a]);(0,v.useEffect)(()=>{if(!e)return;let t=()=>{d(),i.current=requestAnimationFrame(t)};return i.current=requestAnimationFrame(t),()=>{i.current&&cancelAnimationFrame(i.current)}},[e,a,d]);let u=(0,v.useCallback)(()=>{t(!1);try{localStorage.setItem(rJ,"1")}catch{}},[]),h=(0,v.useCallback)(()=>{a>=rG.length-1?u():(s(e=>e+1),l(!1))},[a,u]),f=(0,v.useCallback)(()=>{a<=0||(s(e=>e-1),l(!1))},[a]);if(!e)return null;let m=rG[a],p=a>=rG.length-1,x=m.placement??"auto",g={};return g=r?"right"===x?{left:r.left+r.width+16,top:r.top+r.height/2,transform:"translateY(-50%)"}:"left"===x?{left:Math.max(16,r.left-360-16),top:r.top+r.height/2,transform:"translateY(-50%)",maxWidth:340}:"top"===x?{left:Math.max(16,Math.min(r.left,window.innerWidth-360-16)),top:Math.max(16,r.top-220),maxWidth:340}:{left:Math.max(16,Math.min(window.innerWidth/2-170,window.innerWidth-360-16)),top:Math.min(window.innerHeight-260,(r?.bottom??window.innerHeight/2)+16),maxWidth:340}:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",maxWidth:440},(0,w.jsxs)("div",{className:"fixed inset-0 z-[79]",children:[(()=>{if(!r)return(0,w.jsx)("div",{className:"fixed inset-0 bg-black/70 z-[80] pointer-events-auto"});let{left:e,top:t,width:a,height:s}=r,n=e-6,o=t-6,l=a+12,i=s+12;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("div",{className:"fixed bg-black/70 z-[80] pointer-events-auto",style:{left:0,top:0,right:0,height:Math.max(0,o)}}),(0,w.jsx)("div",{className:"fixed bg-black/70 z-[80] pointer-events-auto",style:{left:0,top:o+i,right:0,bottom:0}}),(0,w.jsx)("div",{className:"fixed bg-black/70 z-[80] pointer-events-auto",style:{left:0,top:o,width:Math.max(0,n),height:i}}),(0,w.jsx)("div",{className:"fixed bg-black/70 z-[80] pointer-events-auto",style:{left:n+l,top:o,right:0,height:i}}),(0,w.jsx)("div",{className:"fixed z-[81] pointer-events-none rounded-lg",style:{left:n,top:o,width:l,height:i,boxShadow:"0 0 0 2px rgba(232,121,249,0.9), 0 0 24px 4px rgba(232,121,249,0.5)",animation:"tut-pulse 1.6s ease-in-out infinite"}})]})})(),(0,w.jsx)("div",{className:"fixed z-[82] w-[340px] sm:w-[360px] max-w-[calc(100vw-32px)]",style:g,children:(0,w.jsxs)("div",{className:"relative rounded-2xl border border-fuchsia-400/40 bg-gradient-to-br from-[#1a0a2e]/95 to-[#0a0a1e]/95 backdrop-blur-xl shadow-2xl shadow-fuchsia-500/20 overflow-hidden",children:[(0,w.jsx)("div",{className:"h-1 w-full bg-gradient-to-r from-emerald-400 via-fuchsia-500 to-rose-400"}),(0,w.jsx)("button",{onClick:u,className:"absolute top-2 right-2 h-7 w-7 rounded-full flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-white/10 transition z-10","aria-label":"关闭教程",children:(0,w.jsx)(tQ.X,{className:"h-3.5 w-3.5"})}),(0,w.jsxs)("div",{className:"p-4 pt-3.5",children:[(0,w.jsx)("div",{className:"flex items-center gap-1.5 mb-2.5",children:rG.map((e,t)=>(0,w.jsx)("div",{className:`h-1 rounded-full transition-all ${t===a?"w-6 bg-fuchsia-400":t<a?"w-3 bg-fuchsia-400/50":"w-3 bg-white/15"}`},e.id))}),(0,w.jsxs)("h3",{className:"text-sm font-bold text-fuchsia-100 mb-1.5 flex items-center gap-1.5 pr-6",children:[(0,w.jsx)(tZ,{className:"h-3.5 w-3.5 text-fuchsia-300 shrink-0"}),m.title]}),(0,w.jsx)("p",{className:"text-[12.5px] text-muted-foreground leading-relaxed whitespace-pre-line",children:m.body}),m.expectAction&&!o&&(0,w.jsxs)("div",{className:"mt-3 px-2.5 py-1.5 rounded-lg bg-amber-500/10 border border-amber-400/30 text-[11px] text-amber-200 flex items-center gap-1.5",children:[(0,w.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse"}),"完成动作后自动进入下一步,或点跳过"]}),m.expectAction&&o&&(0,w.jsx)("div",{className:"mt-3 px-2.5 py-1.5 rounded-lg bg-emerald-500/10 border border-emerald-400/30 text-[11px] text-emerald-200 flex items-center gap-1.5",children:"✓ 已检测到动作"}),(0,w.jsxs)("div",{className:"flex items-center gap-2 mt-4",children:[(0,w.jsxs)(tJ,{size:"sm",variant:"ghost",onClick:f,disabled:0===a,className:"h-7 px-2 text-[11px] text-muted-foreground hover:text-foreground",children:[(0,w.jsx)(nl,{className:"h-3.5 w-3.5"}),"上一步"]}),(0,w.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,w.jsx)(tJ,{size:"sm",variant:"ghost",onClick:u,className:"h-7 px-2 text-[11px] text-muted-foreground hover:text-foreground",children:"跳过"}),(0,w.jsxs)(tJ,{size:"sm",onClick:h,className:"h-7 px-3 text-[11px] bg-fuchsia-500 hover:bg-fuchsia-600 text-white border-fuchsia-400/50",children:[p?"完成":"下一步",(0,w.jsx)(r4,{className:"h-3.5 w-3.5 ml-0.5"})]})]})]}),(0,w.jsxs)("div",{className:"text-[10px] text-muted-foreground/60 text-center mt-2",children:[a+1," / ",rG.length]})]})]})})]})}let nC=(0,to.default)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]),n_=(0,to.default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);function nT(){let[e,t]=(0,v.useState)(null);(0,v.useEffect)(()=>{let e=()=>{let e=te;e&&e.gain>.1?(t(e),setTimeout(()=>tW("decodeSuccess"),300)):e&&tt()},a=setTimeout(e,1500),s=()=>e();return window.addEventListener("echo-nexus-offline-report",s),()=>{clearTimeout(a),window.removeEventListener("echo-nexus-offline-report",s)}},[]);let a=()=>{tt(),t(null)};if(!e)return null;let s=e.gain<e.rate*e.elapsedSec*e.eff-.01;return(0,w.jsx)(rw,{open:!!e,onOpenChange:e=>!e&&a(),children:(0,w.jsxs)(rN,{className:"bg-gradient-to-br from-[#0f0a2e]/95 to-[#050410]/95 border-emerald-400/30 max-w-[400px]",children:[(0,w.jsxs)(rk,{children:[(0,w.jsx)("div",{className:"absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-emerald-400 via-cyan-400 to-blue-400 rounded-t-xl"}),(0,w.jsxs)(rS,{className:"flex items-center gap-2 text-emerald-100",children:[(0,w.jsx)(tZ,{className:"h-4 w-4 text-emerald-300"}),"欢迎回来,无人机"]}),(0,w.jsx)(rC,{className:"text-muted-foreground",children:"在你离开的这段时间里,采矿机群持续运转…"})]}),(0,w.jsxs)("div",{className:"space-y-3 py-1",children:[(0,w.jsxs)("div",{className:"relative rounded-xl border border-emerald-400/30 bg-emerald-500/5 p-4 overflow-hidden",children:[(0,w.jsx)("div",{className:"pointer-events-none absolute -top-8 -right-8 h-24 w-24 rounded-full bg-emerald-500/20 blur-2xl"}),(0,w.jsxs)("div",{className:"relative flex items-center gap-3",children:[(0,w.jsx)("div",{className:"h-12 w-12 rounded-xl bg-emerald-500/15 border border-emerald-400/40 flex items-center justify-center shrink-0",children:(0,w.jsx)(tl,{className:"h-6 w-6 text-emerald-300"})}),(0,w.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,w.jsx)("div",{className:"text-[11px] text-muted-foreground",children:"离线采集获得"}),(0,w.jsxs)("div",{className:"text-2xl font-bold font-mono text-emerald-200 tabular-nums leading-tight",children:["+",O(e.gain)]}),(0,w.jsx)("div",{className:"text-[10px] text-muted-foreground/80",children:"记忆晶体"})]})]})]}),(0,w.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[(0,w.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/30 px-3 py-2",children:[(0,w.jsxs)("div",{className:"flex items-center gap-1.5 text-muted-foreground mb-1",children:[(0,w.jsx)(nn,{className:"h-3 w-3"}),"离线时长"]}),(0,w.jsx)("div",{className:"font-mono font-semibold text-foreground",children:function(e){if(e<60)return`${Math.floor(e)}秒`;let t=Math.floor(e/60);if(t<60)return`${t}分钟`;let a=Math.floor(t/60),s=t%60;if(a<24)return s>0?`${a}小时${s}分`:`${a}小时`;let r=Math.floor(a/24),n=a%24;return n>0?`${r}${n}小时`:`${r}天`}(e.rawElapsedSec)}),e.capped&&(0,w.jsx)("div",{className:"text-[9px] text-amber-400/80 mt-0.5",children:"已达 8h 上限"})]}),(0,w.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/30 px-3 py-2",children:[(0,w.jsxs)("div",{className:"flex items-center gap-1.5 text-muted-foreground mb-1",children:[(0,w.jsx)(nC,{className:"h-3 w-3"}),"采集速率"]}),(0,w.jsxs)("div",{className:"font-mono font-semibold text-foreground",children:[O(e.rate),"/s"]}),(0,w.jsxs)("div",{className:"text-[9px] text-muted-foreground/70 mt-0.5",children:["效率 ",Math.round(100*e.eff),"%"]})]})]}),s&&(0,w.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-amber-400/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-200",children:[(0,w.jsx)(n_,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),(0,w.jsx)("span",{children:"仓库已满,部分离线产出被截断。升级仓库容量或解码晶体可避免浪费。"})]}),(0,w.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/20 px-3 py-2",children:[(0,w.jsxs)("div",{className:"flex items-center justify-between text-[11px]",children:[(0,w.jsx)("span",{className:"text-muted-foreground",children:"当前晶体"}),(0,w.jsxs)("span",{className:"font-mono text-foreground tabular-nums",children:[O(e.crystalsAfter)," / ",O(e.crystalCap)]})]}),(0,w.jsx)("div",{className:"mt-1.5 h-1.5 rounded-full bg-white/10 overflow-hidden",children:(0,w.jsx)("div",{className:"h-full bg-gradient-to-r from-emerald-500 to-cyan-400 transition-all",style:{width:`${Math.min(100,e.crystalsAfter/e.crystalCap*100)}%`}})})]})]}),(0,w.jsx)("div",{className:"flex justify-end gap-2 mt-1",children:(0,w.jsxs)(tJ,{onClick:a,className:"bg-emerald-500 hover:bg-emerald-600 text-white border-emerald-400/50",children:[(0,w.jsx)(tl,{className:"h-3.5 w-3.5 mr-1"}),"领取收益"]})})]})})}let nP=(0,to.default)("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),nR=(0,to.default)("pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]),nE=(0,to.default)("brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]),nA=(0,to.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),n$=(0,to.default)("crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]),nB=(0,to.default)("wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]),nI=(0,to.default)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),nD=(0,to.default)("feather",[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]]),nO=(0,to.default)("heart-pulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]),nL=(0,to.default)("battery",[["path",{d:"M 22 14 L 22 10",key:"nqc4tb"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]]),nz=(0,to.default)("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]),nF=(0,to.default)("split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]),nH=(0,to.default)("magnet",[["path",{d:"m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15",key:"1i3lhw"}],["path",{d:"m5 8 4 4",key:"j6kj7e"}],["path",{d:"m12 15 4 4",key:"lnac28"}]]),nW=(0,to.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),nq=(0,to.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),nK=(0,to.default)("shield-half",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 22V2",key:"zs6s6o"}]]),nU=(0,to.default)("shield-plus",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]),nV=(0,to.default)("battery-charging",[["path",{d:"m11 7-3 5h4l-3 5",key:"b4a64w"}],["path",{d:"M14.856 6H16a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.935",key:"lre1cr"}],["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M5.14 18H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2.936",key:"13q5k0"}]]),nX=[{id:"speed",title:"速度 +12%",desc:"飞船最大速度提升",color:"#34d399",icon:"Wind"},{id:"accel",title:"加速度 +15%",desc:"更灵活的转向响应",color:"#34d399",icon:"Gauge"},{id:"friction",title:"摩擦优化 +5%",desc:"惯性更小,转向更利落",color:"#34d399",icon:"Feather"},{id:"shield_max",title:"护盾上限 +25",desc:"最高护盾值提升",color:"#34d399",icon:"Shield"},{id:"shield_regen",title:"护盾恢复 +50%",desc:"未受击时护盾回血更快",color:"#34d399",icon:"HeartPulse"},{id:"energy_max",title:"能量上限 +25",desc:"更多射击储备",color:"#fbbf24",icon:"Battery"},{id:"energy_regen",title:"能量恢复 +30%",desc:"能量回充加速",color:"#fbbf24",icon:"Zap"},{id:"firepower",title:"火力 +25%",desc:"每发子弹伤害更高",color:"#fb7185",icon:"Flame"},{id:"fire_rate",title:"射速 +20%",desc:"射击间隔更短",color:"#fb7185",icon:"Timer"},{id:"double_shot",title:"双发",desc:"每次射击发射 2 发(仅一次)",color:"#e879f9",icon:"Split"},{id:"attract_radius",title:"吸引半径 +40%",desc:"更远距离吸取收集物",color:"#e879f9",icon:"Magnet"},{id:"collect_radius",title:"收集半径 +50%",desc:"更易拾取道具与晶体",color:"#e879f9",icon:"Circle"},{id:"invuln_time",title:"无敌时间 +200ms",desc:"受击后更多喘息",color:"#34d399",icon:"ShieldCheck"},{id:"damage_reduce",title:"受击伤害 -20%",desc:"减少承受的伤害",color:"#34d399",icon:"ShieldHalf"},{id:"boss_bonus",title:"BOSS 战金币 +50%",desc:"击败 BOSS 奖励翻倍加成",color:"#fbbf24",icon:"Crown"},{id:"normal_score",title:"普通关卡分数 +30%",desc:"通关得分提升",color:"#fbbf24",icon:"Star"},{id:"start_shield",title:"起始护盾 +20",desc:"每局开局更高护盾",color:"#34d399",icon:"ShieldPlus"},{id:"start_energy",title:"起始能量 +20",desc:"每局开局更多能量",color:"#fbbf24",icon:"BatteryCharging"}];function nY(){return{speedMult:1,accelMult:1,frictionBonus:0,shieldMaxBonus:0,shieldRegenMult:1,energyMaxBonus:0,energyRegenMult:1,firepowerMult:1,fireRateMult:1,doubleShot:!1,attractRadiusMult:1,collectRadiusMult:1,invulnBonusMs:0,damageReduceMult:1,bossBonusMult:1,normalScoreMult:1,startShieldBonus:0,startEnergyBonus:0}}function nG(e){return 100+e.upgrades.shieldMaxBonus}function nJ(e){return 100+e.upgrades.energyMaxBonus}function nQ(e){return 900*e.upgrades.accelMult}function nZ(e){return 600+e.upgrades.invulnBonusMs}function n0(e,t){e.shakeAmount=t??14,e.shakeTimer=280}function n1(e,t){for(e.particles.push({id:e.nextEntityId++,type:"particle",...t});e.particles.length>200;)e.particles.shift()}function n2(e,t,a,s,r,n=180,o=.6,l=3){for(let i=0;i<r;i++){let c=i/r*Math.PI*2+.4*Math.random(),d=n*(.4+.8*Math.random());n1(e,{x:t,y:a,vx:Math.cos(c)*d,vy:Math.sin(c)*d,life:o*(.7+.6*Math.random()),maxLife:o,size:l*(.6+.8*Math.random()),color:s,shrink:!0})}}function n5(e,t){let a=t.heading+Math.PI,s=a+(Math.random()-.5)*.6,r=80+60*Math.random(),n=Math.min(1,t.thrust),o=Math.round(52+199*n),l=Math.round(211+-20*n),i=Math.round(153+-117*n),c=`rgba(${o},${l},${i},0.9)`;n1(e,{x:t.x+Math.cos(a)*t.radius,y:t.y+Math.sin(a)*t.radius,vx:Math.cos(s)*r+.3*t.vx,vy:Math.sin(s)*r+.3*t.vy,life:.35+.25*Math.random(),maxLife:.6,size:2.5+2*Math.random(),color:c,shrink:!0})}function n3(e,t){e.bullets.length>=80&&e.bullets.shift(),e.bullets.push({id:e.nextEntityId++,type:"bullet",...t})}function n4(e,t,a,s){let r=["shield","energy","rapid","overdrive","magnet"],n=r[Math.floor(Math.random()*r.length)],o="boss"===s?18:10;e.powerups.length>=12&&e.powerups.shift(),e.powerups.push({id:e.nextEntityId++,type:"powerup",...{x:t,y:a,vx:(Math.random()-.5)*30,vy:20+20*Math.random(),powerupType:n,radius:14,rotation:0,rotationSpeed:(Math.random()-.5)*2,pulsePhase:Math.random()*Math.PI*2,life:o,maxLife:o,collected:!1}})}function n9(e){let t=e.level,a=e.collectedCrystals*(8+2*t),s=e.collectedInsights*(2+.5*t),r=e.collectedBeacons*(1.5+.3*t),n=1;"won"===e.phase?(n=e.isBossLevel?3:1.5,e.isBossLevel&&(n*=e.upgrades.bossBonusMult)):"lost"===e.phase&&(n=.5);let o={crystals:Math.round(a*n),insights:Math.round(s*n*10)/10,contact:Math.round(r*n*10)/10},l=Math.max(0,1e3-5*e.timeSec),i=Math.round(10*e.ship.shield),c="won"===e.phase?e.isBossLevel?5e3:2e3:0,d=e.score+l+i+c+500*t;return{level:t,phase:e.phase,isBossLevel:e.isBossLevel,durationSec:Math.round(10*e.timeSec)/10,collectedCrystals:e.collectedCrystals,collectedInsights:e.collectedInsights,collectedBeacons:e.collectedBeacons,remainingShield:Math.round(e.ship.shield),score:Math.round(d),rewards:o,timestamp:Date.now()}}let n7="echo-nexus-cruise-v1";function n6(){return{highScore:0,totalRuns:0,totalWins:0,bestLevel:0,totalCrystals:0,totalInsights:0,totalContact:0,bossKills:0,lastResult:null,recentResults:[]}}function n8(){try{let e=window.localStorage.getItem(n7);if(!e)return n6();let t=JSON.parse(e);return{...n6(),...t,recentResults:Array.isArray(t.recentResults)?t.recentResults.slice(0,20):[]}}catch{return n6()}}let oe="#34d399",ot="#34d399",oa="#d1fae5",os="#e879f9",or="#fbbf24",on="#fb7185",oo={shield:"#34d399",energy:"#fbbf24",rapid:"#e879f9",overdrive:"#fb7185",magnet:"#a7f3d0"},ol={Wind:nB,Gauge:nI,Feather:nD,Shield:nA,HeartPulse:nO,Battery:nL,Zap:r3,Flame:nb,Timer:nz,Split:nF,Magnet:nH,Circle:nW,ShieldCheck:nq,ShieldHalf:nK,Crown:np,Star:r_,ShieldPlus:nU,BatteryCharging:nV};function oi({onClose:e}){let t=(0,v.useRef)(null),a=(0,v.useRef)(null),s=(0,v.useRef)(nY()),r=(0,v.useRef)([]),n=(0,v.useRef)(0),o=(0,v.useRef)(0),l=(0,v.useRef)([]),i=(0,v.useRef)(new Set),c=(0,v.useRef)({active:!1,baseX:0,baseY:0,knobX:0,knobY:0,touchId:null}),d=(0,v.useRef)(!1),u=(0,v.useRef)(!1),h=(0,v.useRef)(!1),f=(0,v.useRef)("ready"),m=(0,v.useRef)(null),p=(0,v.useRef)({shield:100,shieldMax:100,energy:100,energyMax:100,score:0,time:0,duration:60,crystals:0,totalCrystals:0,insights:0,totalInsights:0,beacons:0,totalBeacons:0,lowShield:!1,isBossLevel:!1,bossHp:0,bossMaxHp:0,bossPhase:1,buffs:[],appliedUpgrades:[],pickupFlashColor:null}),x=(0,v.useRef)(0),g=(0,v.useRef)({w:0,h:0}),[b,y]=(0,v.useState)("ready"),[j,N]=(0,v.useState)(1),[k,M]=(0,v.useState)(null),[S,C]=(0,v.useState)(()=>n8()),[_,T]=(0,v.useState)(!1),[P]=(0,v.useState)(()=>"ontouchstart"in window||navigator.maxTouchPoints>0),[R,E]=(0,v.useState)({baseX:0,baseY:0,knobX:0,knobY:0,active:!1}),[A,$]=(0,v.useState)([]),[B,I]=(0,v.useState)(null),[D,L]=(0,v.useState)([]),[z,F]=(0,v.useState)({shield:100,shieldMax:100,energy:100,energyMax:100,score:0,time:0,duration:60,crystals:0,totalCrystals:0,insights:0,totalInsights:0,beacons:0,totalBeacons:0,lowShield:!1,isBossLevel:!1,bossHp:0,bossMaxHp:0,bossPhase:1,buffs:[],appliedUpgrades:[],pickupFlashColor:null}),H=(0,v.useCallback)(e=>{let{w:t,h:n}=g.current;if(0===t||0===n)return;let o=function(e,t=Date.now()){var a=`cruise-l${e}-s${t}`;let s=0x811c9dc5;for(let e=0;e<a.length;e++)s^=a.charCodeAt(e),s=Math.imul(s,0x1000193);return s>>>0}(e),l=function(e,t,a,s,r=nY(),n=[]){let o,l,i=(l=t>>>0,function(){l|=0;let e=l=l+0x6d2b79f5|0;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/0x100000000}),c=1,d=e>0&&e%5==0,u=Math.min(100+r.shieldMaxBonus,100+r.shieldMaxBonus+r.startShieldBonus),h=Math.min(100+r.energyMaxBonus,100+r.energyMaxBonus+r.startEnergyBonus),f={id:c++,type:"ship",x:a/2,y:s-80,vx:0,vy:0,heading:-Math.PI/2,shield:u,energy:h,radius:14,thrust:0},m=[],p=null,x=0,g=0,b=0;if(d){let t=100+20*e;p={id:c++,type:"boss",x:a/2,y:.3*s,vx:0,vy:0,hp:t,maxHp:t,radius:70,rotation:0,rotationSpeed:.3,pulsePhase:0,attackPhase:1,directTimer:1.5,homingTimer:2,summonTimer:4,driftAngle:0,dropStage:0,breathPhase:0,tentaclePhase:0},o=120;for(let t=0;t<4;t++){let t=14+16*i(),r=60+i()*(a-120),n=60+i()*(s-120),o=20+30*i(),l=i()*Math.PI*2,d=7+Math.floor(4*i()),u=[];for(let e=0;e<d;e++)u.push(.75+.4*i());m.push({id:c++,type:"asteroid",x:r,y:n,vx:Math.cos(l)*o,vy:Math.sin(l)*o,radius:t,rotation:i()*Math.PI*2,rotationSpeed:(i()-.5)*1.2,vertices:u,damage:18+1.5*e})}x=4;for(let e=0;e<x;e++){let e=80+i()*(a-160),t=120+i()*(s-240);m.push({id:c++,type:"crystal",x:e,y:t,vx:0,vy:0,radius:12,rotation:i()*Math.PI*2,rotationSpeed:(i()-.5)*2,pulsePhase:i()*Math.PI*2,collected:!1})}}else{let t={id:c++,type:"stargate",x:a/2,y:70,vx:0,vy:0,radius:42,rotation:0,rotationSpeed:.6,pulsePhase:0,active:!1};m.push(t);let r=Math.min(8+2*e,32);for(let n=0;n<r;n++){let r=16+28*i(),n=0,o=0,l=0;do n=40+i()*(a-80),o=140+i()*(s-260),l++;while(l<20&&(120>Math.hypot(n-f.x,o-f.y)||100>Math.hypot(n-t.x,o-t.y)))let d=30+60*i()+4*e,u=i()*Math.PI*2,h=7+Math.floor(4*i()),p=[];for(let e=0;e<h;e++)p.push(.75+.4*i());m.push({id:c++,type:"asteroid",x:n,y:o,vx:Math.cos(u)*d,vy:Math.sin(u)*d,radius:r,rotation:i()*Math.PI*2,rotationSpeed:(i()-.5)*1.2,vertices:p,damage:18+1.5*e})}let n=Math.min(1+Math.floor(e/2),5);for(let e=0;e<n;e++){let e=60+50*i(),r=0,n=0,o=0;do r=100+i()*(a-200),n=180+i()*(s-320),o++;while(o<20&&(180>Math.hypot(r-f.x,n-f.y)||150>Math.hypot(r-t.x,n-t.y)))let l=12+18*i(),d=i()*Math.PI*2;m.push({id:c++,type:"storm",x:r,y:n,vx:Math.cos(d)*l,vy:Math.sin(d)*l,radius:e,rotation:i()*Math.PI*2,rotationSpeed:(i()-.5)*.4,lightningTimer:.5*i(),cloudSeed:Math.floor(1e4*i())})}x=5+e;for(let e=0;e<x;e++){let e=0,t=0,r=0;do e=50+i()*(a-100),t=120+i()*(s-220),r++;while(r<20&&90>Math.hypot(e-f.x,t-f.y))m.push({id:c++,type:"crystal",x:e,y:t,vx:0,vy:0,radius:12,rotation:i()*Math.PI*2,rotationSpeed:(i()-.5)*2,pulsePhase:i()*Math.PI*2,collected:!1})}g=2+Math.floor(e/3);for(let e=0;e<g;e++){let e=0,t=0,r=0;do e=60+i()*(a-120),t=140+i()*(s-240),r++;while(r<20&&100>Math.hypot(e-f.x,t-f.y))m.push({id:c++,type:"insight",x:e,y:t,vx:0,vy:0,radius:14,pulsePhase:i()*Math.PI*2,swirlAngle:i()*Math.PI*2,collected:!1})}b=1+Math.floor(e/4);for(let e=0;e<b;e++){let e=0,t=0,r=0;do e=80+i()*(a-160),t=160+i()*(s-280),r++;while(r<20&&110>Math.hypot(e-f.x,t-f.y))m.push({id:c++,type:"beacon",x:e,y:t,vx:0,vy:0,radius:16,rotation:i()*Math.PI*2,rotationSpeed:(i()-.5)*1.5,pulsePhase:i()*Math.PI*2,collected:!1})}o=Math.min(60+(e-1)*3,90)}return{phase:"ready",level:e,seed:t,ship:f,entities:m,particles:[],bullets:[],powerups:[],boss:p,isBossLevel:d,score:0,timeSec:0,durationSec:o,collectedCrystals:0,collectedInsights:0,collectedBeacons:0,totalCrystals:x,totalInsights:g,totalBeacons:b,shakeAmount:0,shakeTimer:0,flashLowShield:!1,pickupFlash:null,worldWidth:a,worldHeight:s,nextEntityId:c,invulnTimer:0,shootCooldown:0,endedAt:null,upgrades:r,appliedUpgrades:n,pendingUpgradeChoice:[],activeBuffs:[],bossDefeated:!1}}(e,o,t,n,s.current,r.current);l.phase="playing",a.current=l,u.current=!1,m.current=null,M(null),N(e),y("playing"),f.current="playing",T(!1),h.current=!1,I(null),p.current={shield:l.ship.shield,shieldMax:100+l.upgrades.shieldMaxBonus,energy:l.ship.energy,energyMax:100+l.upgrades.energyMaxBonus,score:0,time:0,duration:l.durationSec,crystals:0,totalCrystals:l.totalCrystals,insights:0,totalInsights:l.totalInsights,beacons:0,totalBeacons:l.totalBeacons,lowShield:!1,isBossLevel:l.isBossLevel,bossHp:l.boss?.hp??0,bossMaxHp:l.boss?.maxHp??0,bossPhase:l.boss?.attackPhase??1,buffs:[],appliedUpgrades:l.appliedUpgrades,pickupFlashColor:null},F({...p.current})},[]);(0,v.useEffect)(()=>{let e=t.current;if(!e)return;let s=e.getContext("2d");if(!s)return;let r=()=>{let t=Math.min(window.devicePixelRatio||1,2),r=window.innerWidth,n=window.innerHeight;e.width=Math.floor(r*t),e.height=Math.floor(n*t),e.style.width=r+"px",e.style.height=n+"px",s.setTransform(t,0,0,t,0,0),g.current={w:r,h:n},l.current=function(e,t){let a=[{stars:[],speed:8,parallax:.1},{stars:[],speed:18,parallax:.25},{stars:[],speed:36,parallax:.5}],s=[100,60,30];for(let r=0;r<a.length;r++){let n=a[r];for(let a=0;a<s[r];a++)n.stars.push({x:Math.random()*e,y:Math.random()*t,size:.5+.6*r+Math.random()*(.5+.5*r),brightness:.2+.25*r+.25*Math.random(),twinkle:Math.random()*Math.PI*2,twinkleSpeed:.5+2*Math.random()})}return a}(r,n),a.current&&(a.current.worldWidth=r,a.current.worldHeight=n)};return r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),(0,v.useEffect)(()=>{let t=t=>{let a=t.key.toLowerCase();if(["w","a","s","d","arrowup","arrowdown","arrowleft","arrowright"].includes(a))i.current.add(a),t.preventDefault();else if(" "===a||"spacebar"===a)d.current=!0,t.preventDefault();else if("p"===a){if("playing"===f.current){let e=!h.current;h.current=e,T(e)}}else"escape"===a&&e()},a=e=>{let t=e.key.toLowerCase();["w","a","s","d","arrowup","arrowdown","arrowleft","arrowright"].includes(t)?i.current.delete(t):(" "===t||"spacebar"===t)&&(d.current=!1)};return window.addEventListener("keydown",t),window.addEventListener("keyup",a),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",a)}},[e]),(0,v.useEffect)(()=>{let e=()=>{d.current=!1,"playing"===f.current&&(h.current=!0,T(!0))};return window.addEventListener("blur",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("blur",e),document.removeEventListener("visibilitychange",e)}},[]),(0,v.useEffect)(()=>{let e=e=>{if("playing"===f.current&&!h.current)for(let t=0;t<e.changedTouches.length;t++){let a=e.changedTouches[t];if(a.clientX>.65*window.innerWidth&&a.clientY>.55*window.innerHeight){d.current=!0,e.preventDefault();continue}if(a.clientX<.5*window.innerWidth&&a.clientY>.35*window.innerHeight){if(c.current.active)continue;c.current={active:!0,baseX:a.clientX,baseY:a.clientY,knobX:0,knobY:0,touchId:a.identifier},E({baseX:a.clientX,baseY:a.clientY,knobX:0,knobY:0,active:!0}),e.preventDefault();return}}},t=e=>{if(c.current.active)for(let t=0;t<e.changedTouches.length;t++){let a=e.changedTouches[t];if(a.identifier!==c.current.touchId)continue;let s=a.clientX-c.current.baseX,r=a.clientY-c.current.baseY,n=Math.hypot(s,r),o=Math.min(n,55),l=n>0?s/n*o:0,i=n>0?r/n*o:0;c.current.knobX=l/55,c.current.knobY=i/55,E({baseX:c.current.baseX,baseY:c.current.baseY,knobX:l,knobY:i,active:!0}),e.preventDefault();return}},a=e=>{for(let t=0;t<e.changedTouches.length;t++){let a=e.changedTouches[t];a.identifier===c.current.touchId&&(c.current={active:!1,baseX:0,baseY:0,knobX:0,knobY:0,touchId:null},E({baseX:0,baseY:0,knobX:0,knobY:0,active:!1})),a.clientX>.65*window.innerWidth&&a.clientY>.55*window.innerHeight&&(d.current=!1)}e.preventDefault()};return window.addEventListener("touchstart",e,{passive:!1}),window.addEventListener("touchmove",t,{passive:!1}),window.addEventListener("touchend",a,{passive:!1}),window.addEventListener("touchcancel",a,{passive:!1}),()=>{window.removeEventListener("touchstart",e),window.removeEventListener("touchmove",t),window.removeEventListener("touchend",a),window.removeEventListener("touchcancel",a)}},[]),(0,v.useEffect)(()=>{let e=t.current;if(!e)return;let s=e.getContext("2d");if(!s)return;let r=e=>{n.current=requestAnimationFrame(r);let t=0===o.current?16:e-o.current;o.current=e;let b=Math.min(t/1e3,.05),{w,h:v}=g.current;if(0===w||0===v)return;let j=a.current;if(j&&"playing"===j.phase&&!h.current&&j){let a=0,s=0,r=i.current;(r.has("w")||r.has("arrowup"))&&(s-=1),(r.has("s")||r.has("arrowdown"))&&(s+=1),(r.has("a")||r.has("arrowleft"))&&(a-=1),(r.has("d")||r.has("arrowright"))&&(a+=1),c.current.active&&(a=c.current.knobX,s=c.current.knobY);let n=function(e,t,a){let s,r;if("playing"!==e.phase)return null;let n=Math.min(t/1e3,.05);e.timeSec+=n,e.shakeTimer>0&&(e.shakeTimer-=t,e.shakeTimer<=0&&(e.shakeTimer=0,e.shakeAmount=0)),e.pickupFlash&&(e.pickupFlash.timer-=t,e.pickupFlash.timer<=0&&(e.pickupFlash=null)),e.invulnTimer>0&&(e.invulnTimer=Math.max(0,e.invulnTimer-t)),e.shootCooldown>0&&(e.shootCooldown=Math.max(0,e.shootCooldown-t));for(let t=e.activeBuffs.length-1;t>=0;t--)e.activeBuffs[t].remaining-=n,e.activeBuffs[t].remaining<=0&&e.activeBuffs.splice(t,1);let o=e.ship;if(a.active&&(0!==a.dx||0!==a.dy)){let t=Math.hypot(a.dx,a.dy),s=a.dx/t,r=a.dy/t;o.vx+=s*nQ(e)*n,o.vy+=r*nQ(e)*n,o.heading=Math.atan2(r,s),o.thrust=Math.min(1,o.thrust+4*n),.9>Math.random()&&n5(e,o),.5>Math.random()&&n5(e,o)}else o.thrust=Math.max(0,o.thrust-3*n);let l=Math.pow(Math.min(.98,.88+e.upgrades.frictionBonus),60*n);o.vx*=l,o.vy*=l;let i=Math.hypot(o.vx,o.vy),c=(s=e.upgrades.speedMult,e.activeBuffs.some(e=>"overdrive"===e.type)&&(s*=1.5),280*s);for(let t of(i>c&&(o.vx=o.vx/i*c,o.vy=o.vy/i*c),o.x+=o.vx*n,o.y+=o.vy*n,o.x<o.radius&&(o.x=o.radius,o.vx=.4*Math.abs(o.vx)),o.x>e.worldWidth-o.radius&&(o.x=e.worldWidth-o.radius,o.vx=-(.4*Math.abs(o.vx))),o.y<o.radius&&(o.y=o.radius,o.vy=.4*Math.abs(o.vy)),o.y>e.worldHeight-o.radius&&(o.y=e.worldHeight-o.radius,o.vy=-(.4*Math.abs(o.vy))),a.shoot&&function(e){let t;if("playing"!==e.phase||e.shootCooldown>0)return;let a=e.ship;if(a.energy<5)return;a.energy-=5,t=e.upgrades.fireRateMult,e.activeBuffs.some(e=>"rapid"===e.type)&&(t*=.5),e.shootCooldown=150*t;let s=8*e.upgrades.firepowerMult,r=a.heading,n=a.x+Math.cos(r)*(a.radius+4),o=a.y+Math.sin(r)*(a.radius+4);if(n3(e,{x:n,y:o,vx:540*Math.cos(r),vy:540*Math.sin(r),owner:"ship",radius:4,damage:s,life:1.4,homing:!1,homingTime:0,color:"#34d399"}),e.upgrades.doubleShot)for(let t of[.14,-.14]){let n=r+t;n3(e,{x:a.x+Math.cos(n)*(a.radius+4),y:a.y+Math.sin(n)*(a.radius+4),vx:540*Math.cos(n),vy:540*Math.sin(n),owner:"ship",radius:4,damage:s,life:1.4,homing:!1,homingTime:0,color:"#34d399"})}n2(e,n,o,"#a7f3d0",4,120,.25,2)}(e),e.invulnTimer<=0&&o.shield<nG(e)&&(o.shield=Math.min(nG(e),o.shield+2*e.upgrades.shieldRegenMult*n)),o.energy<nJ(e)&&(o.energy=Math.min(nJ(e),o.energy+8*e.upgrades.energyRegenMult*n)),e.flashLowShield=o.shield<.3*nG(e),e.entities))switch(t.x+=t.vx*n,t.y+=t.vy*n,t.type){case"asteroid":t.rotation+=t.rotationSpeed*n;if(t.x<-100||t.x>e.worldWidth+100||t.y<-100||t.y>e.worldHeight+100){if(t.summoned){t.damage=-999;break}let a=Math.floor(4*Math.random());0===a?(t.x=-t.radius,t.y=Math.random()*e.worldHeight,t.vx=Math.abs(t.vx)):1===a?(t.x=e.worldWidth+t.radius,t.y=Math.random()*e.worldHeight,t.vx=-Math.abs(t.vx)):2===a?(t.x=Math.random()*e.worldWidth,t.y=-t.radius,t.vy=Math.abs(t.vy)):(t.x=Math.random()*e.worldWidth,t.y=e.worldHeight+t.radius,t.vy=-Math.abs(t.vy))}break;case"storm":t.rotation+=t.rotationSpeed*n,t.lightningTimer-=n,t.lightningTimer<=0&&(t.lightningTimer=.3+.5*Math.random()),(t.x<t.radius||t.x>e.worldWidth-t.radius)&&(t.vx*=-1),(t.y<t.radius||t.y>e.worldHeight-t.radius)&&(t.vy*=-1);break;case"crystal":t.rotation+=t.rotationSpeed*n,t.pulsePhase+=3*n;break;case"insight":t.pulsePhase+=2.5*n,t.swirlAngle+=1.5*n;break;case"beacon":t.rotation+=t.rotationSpeed*n,t.pulsePhase+=2*n;break;case"stargate":{t.rotation+=t.rotationSpeed*n,t.pulsePhase+=2*n;let e=Math.hypot(o.x-t.x,o.y-t.y);t.active=e<200}}e.entities=e.entities.filter(e=>"asteroid"!==e.type||!(e.damage<=-100)),e.boss&&function(e,t){let a=e.boss;if(!a)return;let s=e.ship,r=a.hp/a.maxHp;r>.66?a.attackPhase=1:r>.33?a.attackPhase=2:a.attackPhase=3,a.rotation+=a.rotationSpeed*t,a.pulsePhase+=2*t,a.breathPhase+=1.4*t,a.tentaclePhase+=.8*t,a.driftAngle+=.4*t;let n=e.worldWidth/2+Math.cos(a.driftAngle)*(.25*e.worldWidth),o=.32*e.worldHeight+40*Math.sin(1.3*a.driftAngle),l=n-a.x,i=o-a.y,c=Math.hypot(l,i)||1;if(a.vx=l/c*18,a.vy=i/c*18,a.x+=a.vx*t,a.y+=a.vy*t,a.x=Math.max(a.radius+20,Math.min(e.worldWidth-a.radius-20,a.x)),a.y=Math.max(a.radius+20,Math.min(.55*e.worldHeight,a.y)),a.attackPhase>=1&&(a.directTimer-=t,a.directTimer<=0))if(a.directTimer=1===a.attackPhase?1.5:2.2,1===a.attackPhase){let t=Math.atan2(s.y-a.y,s.x-a.x);n3(e,{x:a.x+Math.cos(t)*a.radius,y:a.y+Math.sin(t)*a.radius,vx:260*Math.cos(t),vy:260*Math.sin(t),owner:"boss",radius:6,damage:14,life:4,homing:!1,homingTime:0,color:"#fb7185"})}else{let t=Math.atan2(s.y-a.y,s.x-a.x);for(let s=-2;s<=2;s++){let r=t+.18*s;n3(e,{x:a.x+Math.cos(r)*a.radius,y:a.y+Math.sin(r)*a.radius,vx:240*Math.cos(r),vy:240*Math.sin(r),owner:"boss",radius:6,damage:14,life:4,homing:!1,homingTime:0,color:"#fb7185"})}}if(a.attackPhase>=2&&(a.summonTimer-=t,a.summonTimer<=0)){a.summonTimer=4.5;for(let t=0;t<2;t++){let t=Math.random()*Math.PI*2,r=a.radius+10,n=a.x+Math.cos(t)*r,o=a.y+Math.sin(t)*r,l=100+60*Math.random(),i=Math.atan2(s.y-o,s.x-n)+(Math.random()-.5)*.8,c=[];for(let e=0;e<7;e++)c.push(.75+.4*Math.random());e.entities.push({id:e.nextEntityId++,type:"asteroid",x:n,y:o,vx:Math.cos(i)*l,vy:Math.sin(i)*l,radius:14+8*Math.random(),rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*2,vertices:c,damage:18,summoned:!0})}n2(e,a.x,a.y,"#e879f9",12,200,.5,3)}if(a.attackPhase>=3&&(a.homingTimer-=t,a.homingTimer<=0)){a.homingTimer=2;let t=Math.atan2(s.y-a.y,s.x-a.x);n3(e,{x:a.x+Math.cos(t)*a.radius,y:a.y+Math.sin(t)*a.radius,vx:200*Math.cos(t),vy:200*Math.sin(t),owner:"boss",radius:7,damage:14,life:5,homing:!0,homingTime:3,color:"#e879f9"})}let d=Math.min(3,Math.floor((1-r)/.25));for(;a.dropStage<d;)a.dropStage++,n4(e,a.x+(Math.random()-.5)*80,a.y+40,"boss"),n2(e,a.x,a.y,"#fbbf24",16,200,.6,3)}(e,n),function(e,t){let a=e.ship;for(let s=e.bullets.length-1;s>=0;s--){let r=e.bullets[s];if(r.life-=t,r.life<=0){e.bullets.splice(s,1);continue}if(r.homing&&r.homingTime>0){r.homingTime-=t;let e=Math.atan2(a.y-r.y,a.x-r.x),s=Math.hypot(r.vx,r.vy),n=Math.atan2(r.vy,r.vx),o=e-n;for(;o>Math.PI;)o-=2*Math.PI;for(;o<-Math.PI;)o+=2*Math.PI;let l=n+Math.max(-2*t,Math.min(2*t,o));r.vx=Math.cos(l)*s,r.vy=Math.sin(l)*s}if(r.x+=r.vx*t,r.y+=r.vy*t,r.x<-50||r.x>e.worldWidth+50||r.y<-50||r.y>e.worldHeight+50){e.bullets.splice(s,1);continue}if(.4>Math.random()&&n1(e,{x:r.x,y:r.y,vx:-(.05*r.vx),vy:-(.05*r.vy),life:.2,maxLife:.3,size:2,color:r.color,shrink:!0}),"ship"===r.owner){let t=!1;for(let a of e.entities)if("asteroid"===a.type&&Math.hypot(r.x-a.x,r.y-a.y)<a.radius+r.radius){a.summoned||a.radius<22?(n2(e,a.x,a.y,"#fb7185",14,220,.5,3),a.damage=-999,e.score+=30):n2(e,r.x,r.y,"#fbbf24",6,160,.3,2),t=!0;break}if(!t&&e.boss&&Math.hypot(r.x-e.boss.x,r.y-e.boss.y)<e.boss.radius+r.radius&&(e.boss.hp=Math.max(0,e.boss.hp-r.damage),n2(e,r.x,r.y,"#fbbf24",8,180,.4,2.5),n2(e,r.x,r.y,"#fb7185",4,100,.2,2),t=!0),t){e.bullets.splice(s,1);continue}}else if(e.invulnTimer<=0&&Math.hypot(r.x-a.x,r.y-a.y)<a.radius+r.radius){if(!e.activeBuffs.some(e=>"overdrive"===e.type)){let t=r.damage*e.upgrades.damageReduceMult;a.shield=Math.max(0,a.shield-t),n2(e,a.x,a.y,"#fb7185",10,200,.4,3),n0(e,10),e.invulnTimer=nZ(e)}e.bullets.splice(s,1);continue}}e.entities=e.entities.filter(e=>"asteroid"!==e.type||!(e.damage<=-100))}(e,n),function(e,t){let a=e.ship;for(let s=e.powerups.length-1;s>=0;s--){let r=e.powerups[s];if(r.collected||(r.life-=t,r.life<=0)){e.powerups.splice(s,1);continue}r.rotation+=r.rotationSpeed*t,r.pulsePhase+=3*t,r.x+=r.vx*t,r.y+=r.vy*t,r.vx*=.96,r.vy*=.96,r.x=Math.max(r.radius,Math.min(e.worldWidth-r.radius,r.x)),r.y=Math.max(r.radius,Math.min(e.worldHeight-r.radius,r.y));let n=Math.hypot(a.x-r.x,a.y-r.y),o=120*(e.activeBuffs.some(e=>"magnet"===e.type)?3:1);if(n<o){let e=Math.atan2(a.y-r.y,a.x-r.x),s=(1-n/o)*380;r.x+=Math.cos(e)*s*t,r.y+=Math.sin(e)*s*t}n<26+a.radius&&(r.collected=!0,function(e,t){let a=e.ship,s="#34d399";switch(t){case"shield":a.shield=Math.min(nG(e),a.shield+30),s="#34d399",n2(e,a.x,a.y,s,18,220,.6,3);break;case"energy":a.energy=Math.min(nJ(e),a.energy+50),s="#fbbf24",n2(e,a.x,a.y,s,18,220,.6,3);break;case"rapid":e.activeBuffs.push({type:"rapid",remaining:8,total:8}),s="#e879f9";break;case"overdrive":e.activeBuffs.push({type:"overdrive",remaining:8,total:8}),s="#fb7185";break;case"magnet":e.activeBuffs.push({type:"magnet",remaining:6,total:6}),s="#a7f3d0"}e.pickupFlash={color:s,timer:400},e.score+=50}(e,r.powerupType),e.powerups.splice(s,1))}}(e,n);for(let t=e.particles.length-1;t>=0;t--){let a=e.particles[t];if(a.life-=n,a.life<=0){e.particles.splice(t,1);continue}a.x+=a.vx*n,a.y+=a.vy*n,a.vx*=.96,a.vy*=.96}if(e.invulnTimer<=0){let t=e.activeBuffs.some(e=>"overdrive"===e.type);for(let a of e.entities)if("asteroid"===a.type&&Math.hypot(o.x-a.x,o.y-a.y)<o.radius+a.radius){if(!t){let t=a.damage*e.upgrades.damageReduceMult;o.shield=Math.max(0,o.shield-t)}let s=Math.atan2(o.y-a.y,o.x-a.x);o.vx+=200*Math.cos(s),o.vy+=200*Math.sin(s),a.vx=-Math.cos(s)*Math.abs(a.vx)*.5,a.vy=-Math.sin(s)*Math.abs(a.vy)*.5,n2(e,o.x,o.y,"#fb7185",18,260,.7,3.5),n2(e,o.x,o.y,"#fbbf24",8,180,.5,2.5),n0(e,14),e.invulnTimer=nZ(e);break}}if(e.invulnTimer<=0){let t=e.activeBuffs.some(e=>"overdrive"===e.type);for(let a of e.entities)if("storm"===a.type&&Math.hypot(o.x-a.x,o.y-a.y)<o.radius+.7*a.radius){if(!t){let t=12*n*e.upgrades.damageReduceMult;o.shield=Math.max(0,o.shield-t)}.3>Math.random()&&n2(e,o.x,o.y,"#e879f9",2,100,.4,2)}}if(e.invulnTimer<=0&&e.boss){let t=e.activeBuffs.some(e=>"overdrive"===e.type);if(Math.hypot(o.x-e.boss.x,o.y-e.boss.y)<o.radius+.85*e.boss.radius){if(!t){let t=22*e.upgrades.damageReduceMult;o.shield=Math.max(0,o.shield-t)}let a=Math.atan2(o.y-e.boss.y,o.x-e.boss.x);o.vx+=280*Math.cos(a),o.vy+=280*Math.sin(a),n2(e,o.x,o.y,"#fb7185",14,240,.5,3),n0(e,16),e.invulnTimer=nZ(e)}}let d=(r=e.upgrades.attractRadiusMult,e.activeBuffs.some(e=>"magnet"===e.type)&&(r*=3),90*r),u=22*e.upgrades.collectRadiusMult;for(let t of e.entities)if("crystal"===t.type||"insight"===t.type||"beacon"===t.type){if(t.collected)continue;let a=Math.hypot(o.x-t.x,o.y-t.y);if(a<d){let e=Math.atan2(o.y-t.y,o.x-t.x),s=(1-a/d)*320;t.x+=Math.cos(e)*s*n,t.y+=Math.sin(e)*s*n}a<u&&(t.collected=!0,"crystal"===t.type?(e.collectedCrystals++,e.score+=Math.round(100*e.upgrades.normalScoreMult),n2(e,t.x,t.y,"#34d399",10,200,.6,3)):"insight"===t.type?(e.collectedInsights++,e.score+=Math.round(250*e.upgrades.normalScoreMult),n2(e,t.x,t.y,"#e879f9",10,200,.6,3)):"beacon"===t.type&&(e.collectedBeacons++,e.score+=Math.round(500*e.upgrades.normalScoreMult),n2(e,t.x,t.y,"#fbbf24",12,220,.7,3.5),!t.powerupDropped&&.05>Math.random()&&(t.powerupDropped=!0,n4(e,t.x,t.y,"beacon"))))}if(e.boss&&e.boss.hp<=0&&!e.bossDefeated){e.bossDefeated=!0,e.phase="won",e.endedAt=Date.now();let t=e.boss.x,a=e.boss.y,s=["#fb7185","#fbbf24","#e879f9","#34d399"];for(let r=0;r<8;r++)n2(e,t+(Math.random()-.5)*80,a+(Math.random()-.5)*80,s[r%s.length],28,360,1,4);return n0(e,28),n9(e)}if(!e.isBossLevel){for(let t of e.entities)if("stargate"===t.type&&Math.hypot(o.x-t.x,o.y-t.y)<o.radius+.6*t.radius){e.phase="won",e.endedAt=Date.now();for(let t=0;t<5;t++){let a=e.worldWidth*(.2+.6*Math.random()),s=e.worldHeight*(.2+.6*Math.random()),r=["#34d399","#fb7185","#fbbf24","#e879f9"];n2(e,a,s,r[t%r.length],24,320,1,4)}return n9(e)}}return o.shield<=0?(e.phase="lost",e.endedAt=Date.now(),n2(e,o.x,o.y,"#fb7185",30,360,1,4.5),n2(e,o.x,o.y,"#fbbf24",16,240,.8,3),n0(e,24),n9(e)):e.timeSec>=e.durationSec?(e.phase="lost",e.endedAt=Date.now(),n9(e)):null}(j,t,{dx:a,dy:s,active:Math.abs(a)>.05||Math.abs(s)>.05,shoot:d.current});n&&(m.current=n,M(n),y(n.phase),f.current=n.phase,u.current||(u.current=!0,tn.getState().grantCruiseReward(n.rewards),C(function(e){let t=n8();t.totalRuns++,"won"===e.phase&&(t.totalWins++,t.bestLevel=Math.max(t.bestLevel,e.level),e.isBossLevel&&t.bossKills++),t.highScore=Math.max(t.highScore,e.score),t.totalCrystals+=e.rewards.crystals,t.totalInsights+=e.rewards.insights,t.totalContact+=e.rewards.contact,t.lastResult=e,t.recentResults=[e,...t.recentResults].slice(0,20);try{window.localStorage.setItem(n7,JSON.stringify(t))}catch{}return t}(n)))),p.current={shield:j.ship.shield,shieldMax:100+j.upgrades.shieldMaxBonus,energy:j.ship.energy,energyMax:100+j.upgrades.energyMaxBonus,score:j.score,time:j.timeSec,duration:j.durationSec,crystals:j.collectedCrystals,totalCrystals:j.totalCrystals,insights:j.collectedInsights,totalInsights:j.totalInsights,beacons:j.collectedBeacons,totalBeacons:j.totalBeacons,lowShield:j.flashLowShield,isBossLevel:j.isBossLevel,bossHp:j.boss?.hp??0,bossMaxHp:j.boss?.maxHp??0,bossPhase:j.boss?.attackPhase??1,buffs:[...j.activeBuffs],appliedUpgrades:j.appliedUpgrades,pickupFlashColor:j.pickupFlash?.color??null},e-x.current>80&&(x.current=e,F({...p.current}))}s.fillStyle="#050410",s.fillRect(0,0,w,v);let N=0,k=0;if(j&&j.shakeTimer>0){let e=j.shakeAmount*(j.shakeTimer/280);N=(Math.random()-.5)*e,k=(Math.random()-.5)*e}s.save(),s.translate(N,k);let S=j?j.ship.vx:0,_=j?j.ship.vy:0;for(let e of l.current)for(let t of e.stars){t.y+=(e.speed+_*e.parallax)*b,t.x-=S*e.parallax*b,t.y>v+5&&(t.y=-5),t.y<-5&&(t.y=v+5),t.x>w+5&&(t.x=-5),t.x<-5&&(t.x=w+5),t.twinkle+=t.twinkleSpeed*b;let a=.6+.4*Math.sin(t.twinkle),r=t.brightness*a;s.fillStyle=`rgba(220,230,255,${r})`,s.beginPath(),s.arc(t.x,t.y,t.size,0,2*Math.PI),s.fill()}if(j){for(let e of j.entities)"stargate"===e.type&&function(e,t,a){e.save(),e.translate(t.x,t.y);let s=Math.max(0,1-Math.hypot(a.x-t.x,a.y-t.y)/300),r=.5+.5*Math.sin(t.pulsePhase);e.shadowBlur=25+30*s,e.shadowColor=on;for(let a=0;a<4;a++){e.save(),e.rotate(t.rotation*(a%2==0?1:-1)*(1+.3*a)),e.beginPath();let s=t.radius*(1+.25*a);e.arc(0,0,s,0,1.5*Math.PI),e.strokeStyle=`rgba(251,113,133,${(.3+.2*r)*(1-.15*a)})`,e.lineWidth=3-.5*a,e.stroke(),e.restore()}let n=e.createRadialGradient(0,0,0,0,0,t.radius);if(n.addColorStop(0,"#ffe4e6"),n.addColorStop(.4,on),n.addColorStop(.8,"#9f1239"),n.addColorStop(1,"rgba(159,18,57,0)"),e.fillStyle=n,e.beginPath(),e.arc(0,0,t.radius*(.9+.1*r),0,2*Math.PI),e.fill(),e.shadowBlur=0,s>.1)for(let a=0;a<8;a++){let r=2*t.rotation+a/8*Math.PI*2,n=t.radius*(.8+.6*Math.sin(t.pulsePhase+a)),o=Math.cos(r)*n,l=Math.sin(r)*n;e.fillStyle=`rgba(254,205,211,${.8*s})`,e.beginPath(),e.arc(o,l,2,0,2*Math.PI),e.fill()}s>.3&&(e.beginPath(),e.arc(0,0,1.6*t.radius,0,2*Math.PI),e.strokeStyle=`rgba(251,113,133,${.4*s})`,e.lineWidth=2,e.setLineDash([8,8]),e.stroke(),e.setLineDash([])),e.restore()}(s,e,j.ship);for(let e of j.entities)"storm"===e.type&&function(e,t){e.save(),e.translate(t.x,t.y),e.shadowBlur=30,e.shadowColor="#e879f9";for(let a=0;a<5;a++){let s=a/5*Math.PI*2+t.rotation,r=.4*t.radius*(.5+.5*Math.sin(t.cloudSeed+a)),n=Math.cos(s)*r,o=Math.sin(s)*r,l=t.radius*(.5+.2*Math.sin(.7*t.cloudSeed+2*a)),i=e.createRadialGradient(n,o,0,n,o,l);i.addColorStop(0,"rgba(232,121,249,0.55)"),i.addColorStop(.6,"rgba(168,85,247,0.3)"),i.addColorStop(1,"rgba(88,28,135,0)"),e.fillStyle=i,e.beginPath(),e.arc(n,o,l,0,2*Math.PI),e.fill()}e.shadowBlur=0;let a=e.createRadialGradient(0,0,0,0,0,.3*t.radius);if(a.addColorStop(0,"rgba(253,244,255,0.8)"),a.addColorStop(1,"rgba(232,121,249,0)"),e.fillStyle=a,e.beginPath(),e.arc(0,0,.3*t.radius,0,2*Math.PI),e.fill(),t.lightningTimer<.12){e.strokeStyle="rgba(253,244,255,0.9)",e.lineWidth=2,e.shadowBlur=12,e.shadowColor="#fdf4ff",e.beginPath();let a=0,s=0;e.moveTo(a,s);for(let r=0;r<4;r++)a+=(Math.random()-.5)*t.radius*.5,s+=(Math.random()-.5)*t.radius*.5,e.lineTo(a,s);e.stroke()}e.restore()}(s,e);for(let e of j.entities)"asteroid"===e.type&&function(e,t){e.save(),e.translate(t.x,t.y),e.rotate(t.rotation),e.shadowBlur=14,e.shadowColor="#fb7185",e.beginPath();let a=t.vertices.length;for(let s=0;s<a;s++){let r=s/a*Math.PI*2,n=t.radius*t.vertices[s],o=Math.cos(r)*n,l=Math.sin(r)*n;0===s?e.moveTo(o,l):e.lineTo(o,l)}e.closePath();let s=e.createRadialGradient(0,0,.2*t.radius,0,0,t.radius);s.addColorStop(0,"#5a3a3a"),s.addColorStop(.7,"#3a2a2a"),s.addColorStop(1,"#1a0808"),e.fillStyle=s,e.fill(),e.shadowBlur=0,e.lineWidth=1.2,e.strokeStyle="#7f1d1d",e.stroke(),e.beginPath(),e.moveTo(-(.3*t.radius),-(.2*t.radius)),e.lineTo(.2*t.radius,.3*t.radius),e.strokeStyle="rgba(127,29,29,0.5)",e.lineWidth=1,e.stroke(),e.restore()}(s,e);for(let e of j.powerups)!function(e,t){if(t.collected)return;e.save(),e.translate(t.x,t.y);let a=.5+.5*Math.sin(t.pulsePhase);t.life<3&&Math.floor(Date.now()/150)%2==0&&(e.globalAlpha=.5);let s=oo[t.powerupType];e.shadowBlur=22,e.shadowColor=s,e.beginPath(),e.arc(0,0,t.radius*(1.5+.3*a),0,2*Math.PI),e.strokeStyle=`${s}40`,e.lineWidth=2,e.stroke(),e.rotate(t.rotation),e.beginPath();for(let a=0;a<6;a++){let s=a/6*Math.PI*2,r=t.radius,n=Math.cos(s)*r,o=Math.sin(s)*r;0===a?e.moveTo(n,o):e.lineTo(n,o)}e.closePath();let r=e.createRadialGradient(0,0,0,0,0,t.radius);r.addColorStop(0,"#ffffff"),r.addColorStop(.5,s),r.addColorStop(1,`${s}80`),e.fillStyle=r,e.fill(),e.lineWidth=1.5,e.strokeStyle="#ffffffaa",e.stroke(),e.shadowBlur=0,e.rotate(-t.rotation),e.fillStyle="#ffffff",e.font="bold 12px sans-serif",e.textAlign="center",e.textBaseline="middle";let n="shield"===t.powerupType?"S":"energy"===t.powerupType?"E":"rapid"===t.powerupType?"R":"overdrive"===t.powerupType?"O":"M";e.fillText(n,0,1),e.globalAlpha=1,e.restore()}(s,e);for(let e of j.entities)"crystal"===e.type?function(e,t){if(t.collected)return;e.save(),e.translate(t.x,t.y);let a=.5+.5*Math.sin(t.pulsePhase);e.shadowBlur=20,e.shadowColor=ot,e.beginPath(),e.arc(0,0,t.radius*(1.4+.4*a),0,2*Math.PI),e.strokeStyle=`rgba(52,211,153,${.15+.2*a})`,e.lineWidth=2,e.stroke(),e.rotate(t.rotation),e.beginPath(),e.moveTo(0,-t.radius),e.lineTo(.7*t.radius,0),e.lineTo(0,t.radius),e.lineTo(-(.7*t.radius),0),e.closePath();let s=e.createLinearGradient(-t.radius,-t.radius,t.radius,t.radius);s.addColorStop(0,"#065f46"),s.addColorStop(.5,ot),s.addColorStop(1,oa),e.fillStyle=s,e.fill(),e.shadowBlur=0,e.lineWidth=1.2,e.strokeStyle=oa,e.stroke(),e.beginPath(),e.moveTo(0,-(.7*t.radius)),e.lineTo(.3*t.radius,-(.2*t.radius)),e.strokeStyle="rgba(255,255,255,0.6)",e.lineWidth=1,e.stroke(),e.restore()}(s,e):"insight"===e.type?function(e,t){if(t.collected)return;e.save(),e.translate(t.x,t.y);let a=.5+.5*Math.sin(t.pulsePhase);e.shadowBlur=22,e.shadowColor=os,e.beginPath(),e.arc(0,0,t.radius*(1.3+.3*a),0,2*Math.PI),e.strokeStyle=`rgba(232,121,249,${.2+.2*a})`,e.lineWidth=2,e.stroke();let s=e.createRadialGradient(-(.3*t.radius),-(.3*t.radius),0,0,0,t.radius);s.addColorStop(0,"#fae8ff"),s.addColorStop(.5,os),s.addColorStop(1,"#86198f"),e.fillStyle=s,e.beginPath(),e.arc(0,0,t.radius,0,2*Math.PI),e.fill(),e.shadowBlur=0,e.rotate(t.swirlAngle),e.strokeStyle="rgba(253,244,255,0.7)",e.lineWidth=1.5,e.beginPath();for(let a=0;a<2*Math.PI;a+=.3){let s=a/(2*Math.PI)*t.radius*.8,r=Math.cos(2*a)*s,n=Math.sin(2*a)*s;0===a?e.moveTo(r,n):e.lineTo(r,n)}e.stroke(),e.restore()}(s,e):"beacon"===e.type&&function(e,t){if(t.collected)return;e.save(),e.translate(t.x,t.y);let a=.5+.5*Math.sin(t.pulsePhase);e.shadowBlur=25,e.shadowColor=or;let s=e.createLinearGradient(0,-(4*t.radius),0,t.radius);s.addColorStop(0,"rgba(251,191,36,0)"),s.addColorStop(.5,`rgba(251,191,36,${.3+.2*a})`),s.addColorStop(1,`rgba(251,191,36,${.5+.3*a})`),e.fillStyle=s,e.beginPath(),e.moveTo(-(.5*t.radius),0),e.lineTo(-(.2*t.radius),-(4*t.radius)),e.lineTo(.2*t.radius,-(4*t.radius)),e.lineTo(.5*t.radius,0),e.closePath(),e.fill(),e.rotate(t.rotation),e.beginPath(),e.ellipse(0,0,t.radius*(1.2+.2*a),.4*t.radius,0,0,2*Math.PI),e.strokeStyle=`rgba(251,191,36,${.5+.3*a})`,e.lineWidth=2,e.stroke(),e.shadowBlur=0;let r=e.createRadialGradient(0,0,0,0,0,.6*t.radius);r.addColorStop(0,"#fef3c7"),r.addColorStop(.7,or),r.addColorStop(1,"#92400e"),e.fillStyle=r,e.beginPath(),e.arc(0,0,.6*t.radius,0,2*Math.PI),e.fill(),e.restore()}(s,e);for(let e of j.particles)!function(e,t){let a=Math.max(0,t.life/t.maxLife),s=t.shrink?t.size*a:t.size;s<.3||(e.globalAlpha=a,e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,s,0,2*Math.PI),e.fill(),e.globalAlpha=1)}(s,e);for(let e of j.bullets)!function(e,t){e.save(),e.translate(t.x,t.y);let a=Math.atan2(t.vy,t.vx);if(e.rotate(a),e.shadowBlur=14,e.shadowColor=t.color,"ship"===t.owner){let a=e.createLinearGradient(-(3*t.radius),0,t.radius,0);a.addColorStop(0,"rgba(52,211,153,0)"),a.addColorStop(.5,"rgba(52,211,153,0.6)"),a.addColorStop(1,"#a7f3d0"),e.fillStyle=a,e.beginPath(),e.ellipse(0,0,1.8*t.radius,.8*t.radius,0,0,2*Math.PI),e.fill(),e.fillStyle="#ffffff",e.beginPath(),e.arc(.6*t.radius,0,.4*t.radius,0,2*Math.PI),e.fill()}else{let a=e.createRadialGradient(0,0,0,0,0,t.radius);t.homing?(a.addColorStop(0,"#fdf4ff"),a.addColorStop(.6,"#e879f9"),a.addColorStop(1,"#86198f")):(a.addColorStop(0,"#ffe4e6"),a.addColorStop(.6,"#fb7185"),a.addColorStop(1,"#9f1239")),e.fillStyle=a,e.beginPath(),e.arc(0,0,t.radius,0,2*Math.PI),e.fill(),e.shadowBlur=0,e.fillStyle=`${t.color}55`,e.beginPath(),e.ellipse(-(2*t.radius),0,2*t.radius,.5*t.radius,0,0,2*Math.PI),e.fill(),t.homing&&(e.rotate(Date.now()/100),e.strokeStyle="#fdf4ff",e.lineWidth=1,e.beginPath(),e.arc(0,0,1.3*t.radius,0,1.5*Math.PI),e.stroke())}e.restore()}(s,e);j.boss&&function(e,t){e.save(),e.translate(t.x,t.y);let a=1+.06*Math.sin(t.breathPhase),s=.5+.5*Math.sin(t.pulsePhase),r=1===t.attackPhase?"#fb7185":2===t.attackPhase?"#f43f5e":"#e879f9";e.shadowBlur=40,e.shadowColor="#e879f9";for(let s=0;s<3;s++){e.save(),e.rotate(t.rotation*(s%2==0?1:-1)*(1+.4*s)),e.beginPath();let n=t.radius*(1.15+.18*s)*a;for(let a=0;a<24;a++){let s=a/24*Math.PI*2,r=n+4*Math.sin(2*t.pulsePhase+.6*a),o=Math.cos(s)*r,l=Math.sin(s)*r;0===a?e.moveTo(o,l):e.lineTo(o,l)}e.closePath(),e.strokeStyle=`${r}${0===s?"cc":"66"}`,e.lineWidth=3-.6*s,e.stroke(),e.restore()}e.save(),e.rotate(t.tentaclePhase);for(let a=0;a<6;a++){e.save(),e.rotate(a/6*Math.PI*2),e.beginPath();let r=1.4*t.radius;e.moveTo(.6*t.radius,0),e.quadraticCurveTo(1.1*t.radius+10*Math.sin(2*t.tentaclePhase+a),8*Math.cos(t.pulsePhase+a),r,0),e.strokeStyle=`rgba(232,121,249,${.5+.3*s})`,e.lineWidth=2.5,e.stroke(),e.fillStyle="#fda4af",e.beginPath(),e.arc(r,0,3,0,2*Math.PI),e.fill(),e.restore()}e.restore(),e.shadowBlur=30,e.shadowColor=r;let n=e.createRadialGradient(0,0,0,0,0,.85*t.radius);n.addColorStop(0,"#ffffff"),n.addColorStop(.2,"#ffe4e6"),n.addColorStop(.6,r),n.addColorStop(1,"#9f1239"),e.fillStyle=n,e.beginPath(),e.arc(0,0,.85*t.radius*a,0,2*Math.PI),e.fill(),e.shadowBlur=0,e.save(),e.rotate(-(2*t.rotation)),e.beginPath();for(let a=0;a<6;a++){let s=a/6*Math.PI*2,r=.55*t.radius,n=Math.cos(s)*r,o=Math.sin(s)*r;0===a?e.moveTo(n,o):e.lineTo(n,o)}e.closePath(),e.strokeStyle=`rgba(254,205,211,${.6+.2*s})`,e.lineWidth=2,e.stroke(),e.restore(),e.save(),e.rotate(-(1.5*t.rotation));for(let a=0;a<3;a++){let s=a/3*Math.PI*2-Math.PI/2,r=.7*t.radius,n=Math.cos(s)*r,o=Math.sin(s)*r;e.fillStyle=a<t.attackPhase?"#fbbf24":"rgba(255,255,255,0.2)",e.beginPath(),e.arc(n,o,3,0,2*Math.PI),e.fill()}e.restore(),e.restore()}(s,j.boss),("playing"===j.phase||"won"===j.phase)&&function(e,t,a,s){if(e.save(),e.translate(t.x,t.y),s.length>0)for(let a of s){let s=oo[a.type],r=a.remaining/a.total,n=t.radius*(1.6+.2*Math.sin(Date.now()/200));e.beginPath(),e.arc(0,0,n,0,2*Math.PI),e.strokeStyle=`${s}${Math.round(200*r).toString(16).padStart(2,"0")}`,e.lineWidth=2,e.stroke(),e.beginPath(),e.arc(0,0,n+3,-Math.PI/2,-Math.PI/2+2*Math.PI*r),e.strokeStyle=s,e.lineWidth=1.5,e.stroke()}e.rotate(t.heading);let r=a&&Math.floor(Date.now()/80)%2==0;if(t.thrust>.1){let a=t.radius*(1.5+1.5*t.thrust),s=e.createLinearGradient(-(.4*t.radius),0,-a,0);s.addColorStop(0,`rgba(251,191,36,${.8*t.thrust})`),s.addColorStop(.5,`rgba(232,121,249,${.4*t.thrust})`),s.addColorStop(1,"rgba(232,121,249,0)"),e.fillStyle=s,e.beginPath(),e.moveTo(-(.4*t.radius),.4*t.radius),e.lineTo(-a,0),e.lineTo(-(.4*t.radius),-(.4*t.radius)),e.closePath(),e.fill()}e.shadowBlur=22,e.shadowColor=oe;let n=t.radius;e.beginPath(),e.moveTo(n,0),e.lineTo(-(.7*n),.75*n),e.lineTo(-(.35*n),0),e.lineTo(-(.7*n),-(.75*n)),e.closePath();let o=e.createLinearGradient(-n,0,n,0);o.addColorStop(0,r?"#fb7185":"#065f46"),o.addColorStop(.5,r?"#fda4af":oe),o.addColorStop(1,r?"#fecdd3":"#a7f3d0"),e.fillStyle=o,e.fill(),e.shadowBlur=0,e.lineWidth=1.5,e.strokeStyle=r?"#ffe4e6":"#d1fae5",e.stroke(),e.beginPath(),e.arc(.15*n,0,.22*n,0,2*Math.PI),e.fillStyle="rgba(255,255,255,0.85)",e.fill(),e.restore()}(s,j.ship,j.invulnTimer>0,j.activeBuffs)}if(s.restore(),j&&j.flashLowShield&&"playing"===j.phase){let t=.3+.3*Math.sin(e/150);s.strokeStyle=`rgba(251,113,133,${t})`,s.lineWidth=6,s.strokeRect(3,3,w-6,v-6)}if(j&&j.pickupFlash&&"playing"===j.phase){let e=j.pickupFlash.timer/400,t=j.pickupFlash.color,a=s.createRadialGradient(w/2,v/2,.3*Math.min(w,v),w/2,v/2,.7*Math.max(w,v));a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,`${t}${Math.round(100*e).toString(16).padStart(2,"0")}`),s.fillStyle=a,s.fillRect(0,0,w,v)}};return n.current=requestAnimationFrame(r),()=>cancelAnimationFrame(n.current)},[]);let W=(0,v.useCallback)(()=>{if("playing"!==f.current)return;let e=!h.current;h.current=e,T(e)},[]),q=(0,v.useCallback)(()=>{e()},[e]),K=(0,v.useCallback)(()=>{m.current&&"won"===m.current.phase&&($(function(e=3,t=[]){let a=[...nX.filter(e=>!t.includes(e.id))].sort(()=>Math.random()-.5);return a.slice(0,Math.min(e,a.length))}(3,r.current.map(e=>e.id))),I(null),y("choosing"),f.current="choosing")},[]),U=(0,v.useCallback)(e=>{let t=A[e];if(t){I(e);var a=s.current;switch(t.id){case"speed":a.speedMult*=1.12;break;case"accel":a.accelMult*=1.15;break;case"friction":a.frictionBonus=Math.min(.2,a.frictionBonus+.05);break;case"shield_max":a.shieldMaxBonus+=25;break;case"shield_regen":a.shieldRegenMult*=1.5;break;case"energy_max":a.energyMaxBonus+=25;break;case"energy_regen":a.energyRegenMult*=1.3;break;case"firepower":a.firepowerMult*=1.25;break;case"fire_rate":a.fireRateMult*=.8;break;case"double_shot":a.doubleShot=!0;break;case"attract_radius":a.attractRadiusMult*=1.4;break;case"collect_radius":a.collectRadiusMult*=1.5;break;case"invuln_time":a.invulnBonusMs+=200;break;case"damage_reduce":a.damageReduceMult*=.8;break;case"boss_bonus":a.bossBonusMult*=1.5;break;case"normal_score":a.normalScoreMult*=1.3;break;case"start_shield":a.startShieldBonus+=20;break;case"start_energy":a.startEnergyBonus+=20}r.current=[...r.current,t],L(r.current),setTimeout(()=>{m.current&&H(m.current.level+1)},700)}},[A,H]),V=z.shieldMax>0?Math.max(0,Math.min(100,z.shield/z.shieldMax*100)):0,X=V>60?"#34d399":V>30?"#fbbf24":"#fb7185",Y=z.energyMax>0?Math.max(0,Math.min(100,z.energy/z.energyMax*100)):0,G=Math.max(0,z.duration-z.time),J=z.bossMaxHp>0?z.bossHp/z.bossMaxHp*100:0;return(0,w.jsxs)("div",{className:"fixed inset-0 z-50 bg-[#050410] overflow-hidden select-none",children:[(0,w.jsx)("canvas",{ref:t,className:"absolute inset-0 w-full h-full touch-none"}),"playing"===b&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)("div",{className:"absolute top-3 left-3 flex flex-col gap-2 min-w-[180px]",children:[(0,w.jsxs)("div",{className:"glass rounded-xl p-2.5 border-white/10",children:[(0,w.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,w.jsx)(nA,{className:"h-3.5 w-3.5",style:{color:X}}),(0,w.jsx)("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"护盾"}),(0,w.jsx)("span",{className:"ml-auto font-mono text-xs font-bold",style:{color:X},children:Math.round(z.shield)})]}),(0,w.jsx)("div",{className:"h-2 rounded-full bg-black/50 overflow-hidden border border-white/5",children:(0,w.jsx)("div",{className:"h-full rounded-full transition-all duration-150",style:{width:`${V}%`,background:`linear-gradient(90deg, ${X}, ${X}dd)`,boxShadow:`0 0 8px ${X}aa`}})}),(0,w.jsxs)("div",{className:"flex items-center gap-2 mt-2 mb-1.5",children:[(0,w.jsx)(r3,{className:"h-3.5 w-3.5 text-fuchsia-300"}),(0,w.jsx)("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"能量"}),(0,w.jsx)("span",{className:"ml-auto font-mono text-xs font-bold text-fuchsia-200",children:Math.round(z.energy)})]}),(0,w.jsx)("div",{className:"h-2 rounded-full bg-black/50 overflow-hidden border border-white/5",children:(0,w.jsx)("div",{className:"h-full rounded-full transition-all duration-150",style:{width:`${Y}%`,background:"linear-gradient(90deg, #e879f9, #c026d3)",boxShadow:"0 0 8px rgba(232,121,249,0.6)"}})})]}),z.buffs.length>0&&(0,w.jsx)("div",{className:"glass rounded-xl p-2 border-white/10 flex flex-col gap-1",children:z.buffs.map((e,t)=>{let a=oo[e.type],s=Math.max(0,e.remaining/e.total*100),r="shield"===e.type?"护盾":"energy"===e.type?"能量":"rapid"===e.type?"急速":"overdrive"===e.type?"过载":"磁吸";return(0,w.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,w.jsx)("div",{className:"h-2 w-2 rounded-full",style:{background:a,boxShadow:`0 0 6px ${a}`}}),(0,w.jsx)("span",{className:"text-[10px] text-white/80",style:{color:a},children:r}),(0,w.jsx)("div",{className:"flex-1 h-1 rounded-full bg-black/40 overflow-hidden",children:(0,w.jsx)("div",{className:"h-full rounded-full",style:{width:`${s}%`,background:a}})}),(0,w.jsxs)("span",{className:"font-mono text-[9px] text-muted-foreground w-6 text-right",children:[Math.ceil(e.remaining),"s"]})]},t)})}),z.appliedUpgrades.length>0&&(0,w.jsx)("div",{className:"glass rounded-xl p-1.5 border-white/10 flex flex-wrap gap-1 max-w-[200px]",children:z.appliedUpgrades.map((e,t)=>{let a;return(0,w.jsx)("div",{className:"h-5 w-5 rounded-md flex items-center justify-center border",style:{borderColor:`${e.color}80`,background:`${e.color}20`},title:e.title,children:(a=ol[e.icon]??tZ,(0,w.jsx)(a,{className:"h-3 w-3",style:{color:e.color}}))},t)})})]}),(0,w.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 flex flex-col items-center gap-1.5",children:[(0,w.jsxs)("div",{className:"glass rounded-xl px-4 py-2 border-white/10 flex items-center gap-4",children:[(0,w.jsxs)("div",{className:"text-center",children:[(0,w.jsx)("div",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"关卡"}),(0,w.jsxs)("div",{className:"font-mono text-sm font-bold text-amber-200",children:["L",j,z.isBossLevel&&(0,w.jsx)(r2,{className:"inline h-3 w-3 ml-0.5 text-rose-300"})]})]}),(0,w.jsx)("div",{className:"w-px h-7 bg-white/10"}),(0,w.jsxs)("div",{className:"text-center",children:[(0,w.jsx)("div",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"分数"}),(0,w.jsx)("div",{className:"font-mono text-sm font-bold text-emerald-200",children:O(z.score)})]}),(0,w.jsx)("div",{className:"w-px h-7 bg-white/10"}),(0,w.jsxs)("div",{className:"text-center min-w-[52px]",children:[(0,w.jsxs)("div",{className:"text-[9px] text-muted-foreground uppercase tracking-wider flex items-center justify-center gap-0.5",children:[(0,w.jsx)(nn,{className:"h-2.5 w-2.5"}),"用时"]}),(0,w.jsxs)("div",{className:"font-mono text-sm font-bold text-rose-200",children:[Math.floor(G/60),":",String(Math.floor(G%60)).padStart(2,"0")]})]})]}),z.isBossLevel&&z.bossMaxHp>0&&(0,w.jsxs)("div",{className:"glass rounded-lg px-3 py-1.5 border-rose-400/30 min-w-[260px] sm:min-w-[320px]",children:[(0,w.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,w.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,w.jsx)(r2,{className:"h-3 w-3 text-rose-300"}),(0,w.jsx)("span",{className:"text-[10px] text-rose-200 font-bold tracking-wider",children:"BOSS"})]}),(0,w.jsx)("div",{className:"flex items-center gap-1",children:[1,2,3].map(e=>(0,w.jsx)("div",{className:`h-1.5 w-1.5 rounded-full ${e<=z.bossPhase?"bg-rose-400":"bg-white/15"}`},e))})]}),(0,w.jsx)("div",{className:"h-2.5 rounded-full bg-black/60 overflow-hidden border border-rose-400/20",children:(0,w.jsx)("div",{className:"h-full rounded-full transition-all duration-200",style:{width:`${J}%`,background:"linear-gradient(90deg, #fb7185, #e879f9)",boxShadow:"0 0 12px rgba(232,121,249,0.7)"}})})]})]}),(0,w.jsxs)("div",{className:"absolute top-3 right-3 flex items-start gap-2",children:[(0,w.jsxs)("div",{className:"glass rounded-xl p-2 border-white/10 flex flex-col gap-1.5",children:[(0,w.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,w.jsx)(tl,{className:"h-3 w-3 text-emerald-300"}),(0,w.jsxs)("span",{className:"font-mono text-xs font-bold text-emerald-200",children:[z.crystals,(0,w.jsxs)("span",{className:"text-muted-foreground/60",children:["/",z.totalCrystals]})]})]}),(0,w.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,w.jsx)(nE,{className:"h-3 w-3 text-fuchsia-300"}),(0,w.jsxs)("span",{className:"font-mono text-xs font-bold text-fuchsia-200",children:[z.insights,(0,w.jsxs)("span",{className:"text-muted-foreground/60",children:["/",z.totalInsights]})]})]}),(0,w.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,w.jsx)(nf,{className:"h-3 w-3 text-amber-300"}),(0,w.jsxs)("span",{className:"font-mono text-xs font-bold text-amber-200",children:[z.beacons,(0,w.jsxs)("span",{className:"text-muted-foreground/60",children:["/",z.totalBeacons]})]})]})]}),(0,w.jsx)(tJ,{size:"icon",variant:"ghost",onClick:W,className:"h-8 w-8 glass border-white/10 hover:bg-white/10 text-white/80","aria-label":"暂停",children:(0,w.jsx)(nR,{className:"h-4 w-4"})}),(0,w.jsx)(tJ,{size:"icon",variant:"ghost",onClick:q,className:"h-8 w-8 glass border-rose-400/30 hover:bg-rose-500/20 text-rose-200","aria-label":"退出",children:(0,w.jsx)(tQ.X,{className:"h-4 w-4"})})]}),!P&&(0,w.jsxs)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 glass rounded-full px-4 py-1.5 border-white/10 text-[11px] text-muted-foreground",children:[(0,w.jsx)("span",{className:"font-mono text-white/80",children:"WASD"})," / ",(0,w.jsx)("span",{className:"font-mono text-white/80",children:"方向键"})," 移动 · ",(0,w.jsx)("span",{className:"font-mono text-emerald-300",children:"空格"})," 射击 · ",(0,w.jsx)("span",{className:"font-mono text-white/80",children:"P"})," 暂停 · ",(0,w.jsx)("span",{className:"font-mono text-white/80",children:"Esc"})," 退出"]}),P&&(0,w.jsx)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 glass rounded-full px-3 py-1 border-white/10 text-[10px] text-muted-foreground pointer-events-none",children:"左下摇杆 · 右下射击"}),P&&R.active&&(0,w.jsx)("div",{className:"absolute pointer-events-none",style:{left:R.baseX,top:R.baseY,transform:"translate(-50%, -50%)"},children:(0,w.jsx)("div",{className:"relative h-28 w-28 rounded-full border-2 border-amber-400/40 bg-amber-500/5 backdrop-blur-sm",children:(0,w.jsx)("div",{className:"absolute h-12 w-12 rounded-full border-2 border-amber-300 bg-amber-400/30 backdrop-blur",style:{left:"50%",top:"50%",transform:`translate(calc(-50% + ${R.knobX}px), calc(-50% + ${R.knobY}px))`,boxShadow:"0 0 16px rgba(251,191,36,0.6)"}})})}),P&&(0,w.jsxs)("button",{"aria-label":"射击",className:"absolute bottom-20 right-6 h-20 w-20 rounded-full border-2 border-emerald-400/50 bg-emerald-500/15 backdrop-blur-md flex items-center justify-center pointer-events-none",children:[(0,w.jsx)(n$,{className:"h-9 w-9 text-emerald-300",style:{filter:"drop-shadow(0 0 8px rgba(52,211,153,0.8))"}}),(0,w.jsx)("div",{className:"absolute inset-0 rounded-full border-2 border-emerald-400/30 animate-ping",style:{animationDuration:"2s"}})]}),_&&(0,w.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-10",children:(0,w.jsxs)("div",{className:"glass rounded-2xl p-8 border-white/15 text-center max-w-xs",children:[(0,w.jsx)(nR,{className:"h-10 w-10 mx-auto mb-3 text-amber-300"}),(0,w.jsx)("h3",{className:"text-lg font-bold text-white mb-1",children:"已暂停"}),(0,w.jsx)("p",{className:"text-xs text-muted-foreground mb-5",children:"深空时间已凝固"}),(0,w.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,w.jsxs)(tJ,{onClick:W,className:"bg-amber-500/20 border border-amber-400/50 text-amber-100 hover:bg-amber-500/30",children:[(0,w.jsx)(nP,{className:"h-4 w-4 mr-1.5"}),"继续"]}),(0,w.jsx)(tJ,{variant:"ghost",onClick:q,className:"text-rose-200 hover:bg-rose-500/10",children:"退出巡航"})]})]})})]}),"ready"===b&&(0,w.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-4 bg-gradient-to-b from-black/40 via-transparent to-black/60",children:(0,w.jsxs)("div",{className:"glass rounded-2xl p-6 sm:p-8 border-amber-400/30 max-w-md w-full text-center relative overflow-hidden",children:[(0,w.jsx)("div",{className:"pointer-events-none absolute -top-20 -left-20 h-40 w-40 rounded-full bg-amber-500/20 blur-3xl"}),(0,w.jsx)("div",{className:"pointer-events-none absolute -bottom-20 -right-20 h-40 w-40 rounded-full bg-rose-500/20 blur-3xl"}),(0,w.jsxs)("div",{className:"relative",children:[(0,w.jsx)("div",{className:"text-[10px] tracking-[0.3em] text-amber-300/70 mb-1",children:"DEEP SPACE CRUISE · v0.8"}),(0,w.jsx)("h2",{className:"text-3xl sm:text-4xl font-bold text-gradient mb-1",children:"深空巡航"}),(0,w.jsx)("p",{className:"text-xs text-muted-foreground mb-5",children:"操控飞船穿越陨石带,抵达星门 / 击败 BOSS"}),(0,w.jsxs)("div",{className:"grid grid-cols-2 gap-2 mb-5 text-left",children:[(0,w.jsxs)("div",{className:"glass rounded-lg p-2.5 border-white/10",children:[(0,w.jsx)("div",{className:"text-[10px] text-muted-foreground",children:"起始关卡"}),(0,w.jsxs)("div",{className:"font-mono text-lg font-bold text-amber-200",children:["L",j]})]}),(0,w.jsxs)("div",{className:"glass rounded-lg p-2.5 border-white/10",children:[(0,w.jsx)("div",{className:"text-[10px] text-muted-foreground",children:"历史最高分"}),(0,w.jsx)("div",{className:"font-mono text-lg font-bold text-emerald-200",children:S?O(S.highScore):"—"})]}),(0,w.jsxs)("div",{className:"glass rounded-lg p-2.5 border-white/10",children:[(0,w.jsx)("div",{className:"text-[10px] text-muted-foreground",children:"通关次数"}),(0,w.jsx)("div",{className:"font-mono text-lg font-bold text-fuchsia-200",children:S?S.totalWins:0})]}),(0,w.jsxs)("div",{className:"glass rounded-lg p-2.5 border-white/10",children:[(0,w.jsx)("div",{className:"text-[10px] text-muted-foreground",children:"BOSS 击杀"}),(0,w.jsx)("div",{className:"font-mono text-lg font-bold text-rose-200",children:S?S.bossKills:0})]})]}),(0,w.jsxs)("div",{className:"glass rounded-lg p-3 border-white/10 mb-5 text-left text-[11px] space-y-1",children:[(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsx)(tl,{className:"h-3 w-3 text-emerald-300 shrink-0"}),(0,w.jsx)("span",{className:"text-muted-foreground",children:"收集晶体碎片 → 晶体奖励"})]}),(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsx)(nE,{className:"h-3 w-3 text-fuchsia-300 shrink-0"}),(0,w.jsx)("span",{className:"text-muted-foreground",children:"收集洞见光球 → 洞见奖励"})]}),(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsx)(nf,{className:"h-3 w-3 text-amber-300 shrink-0"}),(0,w.jsx)("span",{className:"text-muted-foreground",children:"收集信标 → 接触进度"})]}),(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsx)(r8,{className:"h-3 w-3 text-rose-300 shrink-0"}),(0,w.jsx)("span",{className:"text-muted-foreground",children:"抵达星门通关 → +50% 奖励"})]}),(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsx)(r2,{className:"h-3 w-3 text-rose-300 shrink-0"}),(0,w.jsx)("span",{className:"text-muted-foreground",children:"每 5 关 BOSS 战:击败 ×3 奖励"})]}),(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsx)(n$,{className:"h-3 w-3 text-emerald-300 shrink-0"}),(0,w.jsx)("span",{className:"text-muted-foreground",children:"空格 / 右下角射击按钮 → 发射能量弹"})]}),(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsx)(tZ,{className:"h-3 w-3 text-fuchsia-300 shrink-0"}),(0,w.jsx)("span",{className:"text-muted-foreground",children:"通关后 3 选 1 强化卡牌(每局重置)"})]})]}),(0,w.jsxs)("div",{className:"flex gap-2",children:[(0,w.jsxs)(tJ,{onClick:()=>H(j),className:"flex-1 bg-amber-500/20 border border-amber-400/50 text-amber-100 hover:bg-amber-500/30 h-11",children:[(0,w.jsx)(nP,{className:"h-4 w-4 mr-1.5"}),"启动巡航"]}),(0,w.jsx)(tJ,{variant:"ghost",onClick:q,className:"border border-white/10 text-white/70 hover:bg-white/10 h-11",children:"返回"})]}),(0,w.jsx)("div",{className:"text-[10px] text-muted-foreground/60 mt-3",children:P?"左下摇杆移动 · 右下射击":"WASD / 方向键移动 · 空格射击 · P 暂停 · Esc 退出"})]})]})}),("won"===b||"lost"===b)&&k&&(0,w.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:(0,w.jsxs)("div",{className:`glass rounded-2xl p-6 sm:p-8 max-w-md w-full relative overflow-hidden ${"won"===b?k.isBossLevel?"border-fuchsia-400/50":"border-emerald-400/40":"border-rose-400/40"}`,children:[(0,w.jsx)("div",{className:`pointer-events-none absolute -top-20 -left-20 h-40 w-40 rounded-full blur-3xl ${"won"===b?k.isBossLevel?"bg-fuchsia-500/25":"bg-emerald-500/20":"bg-rose-500/20"}`}),(0,w.jsxs)("div",{className:"relative",children:[(0,w.jsx)("div",{className:`text-[10px] tracking-[0.3em] mb-1 ${"won"===b?k.isBossLevel?"text-fuchsia-300/70":"text-emerald-300/70":"text-rose-300/70"}`,children:"won"===b?k.isBossLevel?"BOSS DEFEATED":"MISSION COMPLETE":"MISSION FAILED"}),(0,w.jsx)("h2",{className:`text-3xl font-bold mb-1 ${"won"===b?k.isBossLevel?"text-fuchsia-300":"text-emerald-300":"text-rose-300"}`,style:{textShadow:`0 0 20px ${"won"===b?k.isBossLevel?"rgba(232,121,249,0.5)":"rgba(52,211,153,0.5)":"rgba(251,113,133,0.5)"}`},children:"won"===b?k.isBossLevel?"BOSS 击破":"巡航成功":"巡航失败"}),(0,w.jsxs)("p",{className:"text-xs text-muted-foreground mb-5",children:["关卡 L",k.level," · 用时 ",Math.floor(k.durationSec/60),":",String(Math.floor(k.durationSec%60)).padStart(2,"0")]}),(0,w.jsxs)("div",{className:"grid grid-cols-3 gap-2 mb-4",children:[(0,w.jsxs)("div",{className:"glass rounded-lg p-2 border-emerald-400/20 text-center",children:[(0,w.jsx)(tl,{className:"h-4 w-4 mx-auto text-emerald-300 mb-0.5"}),(0,w.jsx)("div",{className:"font-mono text-lg font-bold text-emerald-200",children:k.collectedCrystals}),(0,w.jsx)("div",{className:"text-[9px] text-muted-foreground",children:"晶体碎片"})]}),(0,w.jsxs)("div",{className:"glass rounded-lg p-2 border-fuchsia-400/20 text-center",children:[(0,w.jsx)(nE,{className:"h-4 w-4 mx-auto text-fuchsia-300 mb-0.5"}),(0,w.jsx)("div",{className:"font-mono text-lg font-bold text-fuchsia-200",children:k.collectedInsights}),(0,w.jsx)("div",{className:"text-[9px] text-muted-foreground",children:"洞见光球"})]}),(0,w.jsxs)("div",{className:"glass rounded-lg p-2 border-amber-400/20 text-center",children:[(0,w.jsx)(nf,{className:"h-4 w-4 mx-auto text-amber-300 mb-0.5"}),(0,w.jsx)("div",{className:"font-mono text-lg font-bold text-amber-200",children:k.collectedBeacons}),(0,w.jsx)("div",{className:"text-[9px] text-muted-foreground",children:"信标"})]})]}),(0,w.jsxs)("div",{className:"grid grid-cols-2 gap-2 mb-4",children:[(0,w.jsxs)("div",{className:"glass rounded-lg p-2 border-white/10 flex items-center gap-2",children:[(0,w.jsx)(nA,{className:"h-4 w-4 text-rose-300"}),(0,w.jsxs)("div",{children:[(0,w.jsx)("div",{className:"text-[9px] text-muted-foreground",children:"剩余护盾"}),(0,w.jsx)("div",{className:"font-mono text-sm font-bold text-rose-200",children:k.remainingShield})]})]}),(0,w.jsxs)("div",{className:"glass rounded-lg p-2 border-white/10 flex items-center gap-2",children:[(0,w.jsx)(r8,{className:"h-4 w-4 text-amber-300"}),(0,w.jsxs)("div",{children:[(0,w.jsx)("div",{className:"text-[9px] text-muted-foreground",children:"得分"}),(0,w.jsx)("div",{className:"font-mono text-sm font-bold text-amber-200",children:O(k.score)})]})]})]}),(0,w.jsxs)("div",{className:"glass rounded-lg p-3 border-emerald-400/20 mb-5",children:[(0,w.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-2",children:"won"===b?k.isBossLevel?"BOSS 击败奖励 (×3)":"通关奖励 (+50%)":"残骸回收 (×50%)"}),(0,w.jsxs)("div",{className:"space-y-1.5",children:[(0,w.jsxs)("div",{className:"flex items-center justify-between",children:[(0,w.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-200",children:[(0,w.jsx)(tl,{className:"h-3 w-3"})," 晶体"]}),(0,w.jsxs)("span",{className:"font-mono text-sm font-bold text-emerald-200",children:["+",O(k.rewards.crystals)]})]}),(0,w.jsxs)("div",{className:"flex items-center justify-between",children:[(0,w.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-fuchsia-200",children:[(0,w.jsx)(nE,{className:"h-3 w-3"})," 洞见"]}),(0,w.jsxs)("span",{className:"font-mono text-sm font-bold text-fuchsia-200",children:["+",k.rewards.insights.toFixed(1)]})]}),(0,w.jsxs)("div",{className:"flex items-center justify-between",children:[(0,w.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-amber-200",children:[(0,w.jsx)(nf,{className:"h-3 w-3"})," 接触"]}),(0,w.jsxs)("span",{className:"font-mono text-sm font-bold text-amber-200",children:["+",k.rewards.contact.toFixed(1),"%"]})]})]}),(0,w.jsx)("div",{className:"text-[9px] text-muted-foreground/70 mt-2 pt-2 border-t border-white/5",children:"奖励已同步至主游戏"})]}),(0,w.jsxs)("div",{className:"flex gap-2",children:["won"===b&&(0,w.jsxs)(tJ,{onClick:K,className:"flex-1 bg-fuchsia-500/20 border border-fuchsia-400/50 text-fuchsia-100 hover:bg-fuchsia-500/30 h-10",children:[(0,w.jsx)(tZ,{className:"h-4 w-4 mr-1"}),"选择强化"]}),(0,w.jsxs)(tJ,{onClick:()=>H(k.level),variant:"won"===b?"ghost":"default",className:`${"lost"===b?"flex-1 bg-rose-500/20 border border-rose-400/50 text-rose-100 hover:bg-rose-500/30":"border border-white/10 text-white/80 hover:bg-white/10"} h-10`,children:[(0,w.jsx)(td,{className:"h-4 w-4 mr-1"}),"重试"]}),(0,w.jsx)(tJ,{variant:"ghost",onClick:q,className:"border border-white/10 text-white/70 hover:bg-white/10 h-10",children:"返回"})]})]})]})}),"choosing"===b&&(0,w.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-4 bg-black/70 backdrop-blur-md",children:(0,w.jsxs)("div",{className:"w-full max-w-3xl",children:[(0,w.jsxs)("div",{className:"text-center mb-6",children:[(0,w.jsx)("div",{className:"text-[10px] tracking-[0.4em] text-fuchsia-300/70 mb-1",children:"REINFORCEMENT PROTOCOL"}),(0,w.jsx)("h2",{className:"text-2xl sm:text-3xl font-bold text-gradient mb-1",children:"选择强化"}),(0,w.jsx)("p",{className:"text-xs text-muted-foreground",children:"星门共鸣释放能量,3 选 1 永久强化(本局有效)"})]}),(0,w.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:A.map((e,t)=>{let a=ol[e.icon]??tZ,s=B===t,r=null!==B&&!s;return(0,w.jsxs)("button",{onClick:()=>null===B&&U(t),disabled:null!==B,className:`group relative glass rounded-2xl p-5 border-2 transition-all duration-500 text-left overflow-hidden ${s?"scale-105 border-fuchsia-400 shadow-[0_0_30px_rgba(232,121,249,0.5)]":r?"opacity-40 border-white/10":"border-white/15 hover:border-white/30 hover:scale-[1.02] cursor-pointer"}`,style:{minHeight:"220px"},children:[(0,w.jsx)("div",{className:"pointer-events-none absolute -top-10 -left-10 h-32 w-32 rounded-full blur-3xl opacity-40 transition-opacity group-hover:opacity-70",style:{background:e.color}}),(0,w.jsxs)("div",{className:"relative flex flex-col h-full",children:[(0,w.jsx)("div",{className:"h-12 w-12 rounded-xl flex items-center justify-center mb-3 border",style:{background:`${e.color}20`,borderColor:`${e.color}80`,boxShadow:`0 0 16px ${e.color}40`},children:(0,w.jsx)(a,{className:"h-6 w-6",style:{color:e.color}})}),(0,w.jsxs)("div",{className:"text-[10px] font-mono uppercase tracking-wider mb-1",style:{color:e.color},children:["强化 ",String(t+1).padStart(2,"0")]}),(0,w.jsx)("h3",{className:"text-lg font-bold text-white mb-1.5",children:e.title}),(0,w.jsx)("p",{className:"text-xs text-muted-foreground mb-3",children:e.desc}),(0,w.jsx)("div",{className:"mt-auto pt-2 border-t border-white/5",children:(0,w.jsxs)("div",{className:"flex items-center justify-between text-[10px]",children:[(0,w.jsx)("span",{className:"text-muted-foreground/70",children:"点击选择"}),(0,w.jsx)(r4,{className:"h-3 w-3",style:{color:e.color}})]})})]}),s&&(0,w.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-fuchsia-500/10 backdrop-blur-[1px]",children:(0,w.jsxs)("div",{className:"text-center",children:[(0,w.jsx)(tZ,{className:"h-10 w-10 mx-auto text-fuchsia-300 animate-pulse",style:{filter:"drop-shadow(0 0 12px rgba(232,121,249,0.8))"}}),(0,w.jsx)("div",{className:"mt-2 text-xs font-bold text-fuchsia-200 tracking-wider",children:"已激活"})]})})]},e.id)})}),D.length>0&&(0,w.jsxs)("div",{className:"mt-5 glass rounded-xl p-3 border-white/10",children:[(0,w.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-2",children:"本局已激活强化"}),(0,w.jsx)("div",{className:"flex flex-wrap gap-2",children:D.map((e,t)=>{let a=ol[e.icon]??tZ;return(0,w.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md px-2 py-1 border",style:{borderColor:`${e.color}50`,background:`${e.color}15`},children:[(0,w.jsx)(a,{className:"h-3 w-3",style:{color:e.color}}),(0,w.jsx)("span",{className:"text-[11px] text-white/85",children:e.title})]},t)})})]}),(0,w.jsx)("div",{className:"text-center mt-4",children:(0,w.jsx)(tJ,{variant:"ghost",onClick:q,className:"border border-white/10 text-white/60 hover:bg-white/10 h-9",children:"退出巡航"})})]})})]})}let oc=(0,to.default)("compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),od=(0,to.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),ou=(0,to.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),oh={Compass:oc,Brain:nE,Swords:rZ,Sparkles:tZ},of={exploration:{text:"text-emerald-300",border:"border-emerald-400/30",borderActive:"border-emerald-400/70",bg:"bg-emerald-500/10",ring:"ring-emerald-400/40",barFrom:"from-emerald-400",barTo:"to-emerald-500",glow:"rgba(52,211,153,0.45)"},wisdom:{text:"text-fuchsia-300",border:"border-fuchsia-400/30",borderActive:"border-fuchsia-400/70",bg:"bg-fuchsia-500/10",ring:"ring-fuchsia-400/40",barFrom:"from-fuchsia-400",barTo:"to-fuchsia-500",glow:"rgba(232,121,249,0.45)"},courage:{text:"text-amber-300",border:"border-amber-400/30",borderActive:"border-amber-400/70",bg:"bg-amber-500/10",ring:"ring-amber-400/40",barFrom:"from-amber-400",barTo:"to-amber-500",glow:"rgba(251,191,36,0.45)"},inspiration:{text:"text-rose-300",border:"border-rose-400/30",borderActive:"border-rose-400/70",bg:"bg-rose-500/10",ring:"ring-rose-400/40",barFrom:"from-rose-400",barTo:"to-rose-500",glow:"rgba(251,113,133,0.45)"}};function om(){let e=tn(e=>e.attributes),t=tn(e=>e.attributeProgress),a=tn(e=>e.pendingAttrPoints??0),s=tn(e=>e.allocateAttribute),r=(0,v.useMemo)(()=>ec(e),[e]),n=(0,v.useMemo)(()=>e.exploration+e.wisdom+e.courage+e.inspiration,[e]),o=(0,v.useMemo)(()=>(ei(e.exploration)+ei(e.wisdom)+ei(e.courage)+ei(e.inspiration))*100,[e]);return(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f flex flex-col gap-2.5 h-full overflow-y-auto echo-scroll pr-0.5",children:[(0,w.jsx)(tD.default,{id:"fb70db4abea5ec9f",children:".echo-scroll::-webkit-scrollbar{width:4px}.echo-scroll::-webkit-scrollbar-thumb{background:#ffffff1f;border-radius:2px}.echo-scroll::-webkit-scrollbar-track{background:0 0}@keyframes echo-pending-pulse{0%,to{box-shadow:0 0 #e879f980}50%{box-shadow:0 0 14px 4px #e879f9a6}}.echo-pending-pulse{animation:1.6s ease-in-out infinite echo-pending-pulse}@keyframes echo-card-glow{0%,to{opacity:.5}50%{opacity:1}}"}),(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f flex items-center justify-between",children:[(0,w.jsx)("h3",{className:"jsx-fb70db4abea5ec9f text-sm font-semibold flex items-center gap-1.5",children:(0,w.jsx)("span",{className:"jsx-fb70db4abea5ec9f bg-gradient-to-br from-emerald-300 via-fuchsia-300 to-rose-300 bg-clip-text text-transparent",children:"驾驶员属性"})}),(0,w.jsxs)("div",{className:`jsx-fb70db4abea5ec9f text-[10px] px-2 py-0.5 rounded-full border ${a>0?"border-fuchsia-400/60 bg-fuchsia-500/15 text-fuchsia-200 echo-pending-pulse font-bold":"border-white/15 bg-black/25 text-muted-foreground"}`,children:["待分配 ",a]})]}),(0,w.jsx)("div",{className:"jsx-fb70db4abea5ec9f grid grid-cols-2 lg:grid-cols-4 gap-2",children:el.map(r=>{let n=eo[r],o=of[r],l=oh[n.icon]??tZ,i=e?.[r]??0,c=t?.[r]??{exp:0,level:i},d=100*ei(i),u=ed(i),h=c.exp,f=u>0?Math.min(100,h/u*100):100,m=i>=100,p=a>0&&!m,x=i>50;return(0,w.jsxs)("div",{style:{boxShadow:`inset 0 0 18px ${o.glow}`},className:`jsx-fb70db4abea5ec9f relative rounded-xl border ${o.border} ${o.bg} p-2.5 flex flex-col gap-1.5 overflow-hidden transition-all duration-300`,children:[(0,w.jsx)("div",{style:{background:n.hex},className:"jsx-fb70db4abea5ec9f pointer-events-none absolute -top-8 -right-8 h-20 w-20 rounded-full blur-2xl opacity-50"}),(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f relative flex items-center gap-1.5",children:[(0,w.jsx)("div",{style:{boxShadow:`0 0 8px ${o.glow}`},className:`jsx-fb70db4abea5ec9f shrink-0 h-7 w-7 rounded-lg flex items-center justify-center ${o.bg} border ${o.border}`,children:(0,w.jsx)(l,{className:`jsx-fb70db4abea5ec9f h-3.5 w-3.5 ${o.text}`})}),(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f min-w-0 flex-1 leading-tight",children:[(0,w.jsx)("div",{className:`jsx-fb70db4abea5ec9f text-[11px] font-semibold ${o.text} truncate`,children:n.name}),(0,w.jsx)("div",{className:"jsx-fb70db4abea5ec9f text-[8px] text-muted-foreground/70 uppercase tracking-wider truncate",children:n.enName})]}),(0,w.jsxs)("div",{className:`jsx-fb70db4abea5ec9f shrink-0 text-[9px] px-1.5 py-0.5 rounded font-mono font-bold ${m?"bg-amber-400/20 text-amber-200 border border-amber-400/40":"bg-black/30 text-white/80 border border-white/10"}`,children:["Lv.",i]})]}),(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f relative flex items-end justify-between",children:[(0,w.jsxs)("span",{className:`jsx-fb70db4abea5ec9f text-lg font-mono font-bold ${o.text} leading-none`,children:[i,(0,w.jsxs)("span",{className:"jsx-fb70db4abea5ec9f text-[9px] text-muted-foreground/60 ml-0.5",children:["/",100]})]}),(0,w.jsxs)("span",{className:`jsx-fb70db4abea5ec9f text-[10px] ${o.text} font-mono`,children:["+",d.toFixed(1),"%"]})]}),(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f relative",children:[(0,w.jsx)("div",{className:"jsx-fb70db4abea5ec9f h-1.5 rounded-full bg-black/40 overflow-hidden border border-white/5",children:(0,w.jsx)("div",{style:{width:`${m?100:f}%`,boxShadow:`0 0 6px ${o.glow}`},className:`jsx-fb70db4abea5ec9f h-full bg-gradient-to-r ${o.barFrom} ${o.barTo} transition-all duration-500`})}),(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f flex items-center justify-between mt-0.5 text-[8px] text-muted-foreground/70 font-mono",children:[(0,w.jsx)("span",{className:"jsx-fb70db4abea5ec9f",children:m?"已满级":`${h} / ${u} EXP`}),x&&!m&&(0,w.jsx)("span",{className:"jsx-fb70db4abea5ec9f text-amber-300/70",children:"递减区"})]})]}),(0,w.jsx)("div",{className:"jsx-fb70db4abea5ec9f relative flex flex-col gap-0.5 mt-0.5",children:n.effects.map((e,t)=>(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f text-[8.5px] text-muted-foreground/70 leading-tight flex items-center gap-1",children:[(0,w.jsx)("span",{className:"jsx-fb70db4abea5ec9f "+(o.text||""),children:"·"}),(0,w.jsx)("span",{className:"jsx-fb70db4abea5ec9f truncate",children:e})]},t))}),(0,w.jsxs)("button",{type:"button",disabled:!p,onClick:()=>s(r,1),"aria-label":`分配 1 点到 ${n.name}`,style:p?{boxShadow:`0 0 8px ${o.glow}`}:void 0,className:`jsx-fb70db4abea5ec9f relative mt-auto rounded-md border px-1.5 py-1 flex items-center justify-center gap-0.5 text-[10px] font-bold transition-all ${p?`${o.borderActive} ${o.bg} ${o.text} hover:scale-105 cursor-pointer`:"border-white/5 bg-black/20 text-muted-foreground/30 cursor-not-allowed"}`,children:[(0,w.jsx)(od,{className:"h-3 w-3"}),(0,w.jsx)("span",{className:"jsx-fb70db4abea5ec9f",children:"分配"})]})]},r)})}),(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f mt-auto rounded-lg border border-white/10 bg-black/30 px-2.5 py-1.5 flex items-center justify-between gap-2",children:[(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f flex items-center gap-1.5 text-[10px]",children:[(0,w.jsx)(ou,{className:"h-3 w-3 text-fuchsia-300"}),(0,w.jsx)("span",{className:"jsx-fb70db4abea5ec9f text-muted-foreground",children:"总等级"}),(0,w.jsxs)("span",{className:"jsx-fb70db4abea5ec9f font-mono font-bold text-fuchsia-200",children:[n,(0,w.jsxs)("span",{className:"jsx-fb70db4abea5ec9f text-muted-foreground/60 text-[9px]",children:["/",400]})]})]}),(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f flex items-center gap-2 text-[10px]",children:[(0,w.jsx)("span",{className:"jsx-fb70db4abea5ec9f text-muted-foreground",children:"总加成"}),(0,w.jsxs)("span",{className:"jsx-fb70db4abea5ec9f font-mono font-bold text-emerald-200",children:["+",o.toFixed(1),"%"]})]})]}),(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f grid grid-cols-2 gap-1 text-[9px]",children:[(0,w.jsx)(op,{label:"探险力",value:`\xd7${r.expeditionPowerMult.toFixed(2)}`,color:"text-emerald-300"}),(0,w.jsx)(op,{label:"解码步数",value:`+${r.decodeStepsBonus}`,color:"text-fuchsia-300"}),(0,w.jsx)(op,{label:"洞见倍率",value:`+${(100*r.insightMultAdd).toFixed(1)}%`,color:"text-fuchsia-300"}),(0,w.jsx)(op,{label:"自动解码周期",value:`\xd7${r.autoDecodeIntervalMult.toFixed(2)}`,color:"text-fuchsia-300"}),(0,w.jsx)(op,{label:"探险生命",value:`+${r.expeditionHpBonus}`,color:"text-amber-300"}),(0,w.jsx)(op,{label:"BOSS 胜率",value:`+${(100*r.bossWinRateBonus).toFixed(1)}%`,color:"text-amber-300"}),(0,w.jsx)(op,{label:"巡航护盾",value:`+${r.cruiseShieldBonus}`,color:"text-amber-300"}),(0,w.jsx)(op,{label:"接触率",value:`\xd7${r.contactRateMult.toFixed(2)}`,color:"text-rose-300"}),(0,w.jsx)(op,{label:"星潮触发",value:`+${(100*r.tideTriggerBonus).toFixed(1)}%`,color:"text-rose-300"}),(0,w.jsx)(op,{label:"脉冲连击",value:`+${(100*r.pulseComboBonus).toFixed(1)}%`,color:"text-rose-300"}),(0,w.jsx)(op,{label:"巡航速度",value:`\xd7${r.cruiseShipSpeedMult.toFixed(2)}`,color:"text-emerald-300"}),(0,w.jsx)(op,{label:"产能加成",value:`\xd7${r.crystalsPerSecMult.toFixed(2)}`,color:"text-emerald-300"})]}),(0,w.jsxs)("div",{className:"jsx-fb70db4abea5ec9f text-[9px] text-muted-foreground/60 text-center leading-tight",children:["每次飞升获得 ",(0,w.jsx)("span",{className:"jsx-fb70db4abea5ec9f text-fuchsia-300 font-mono",children:"飞升次数 × 2 + 1"})," 点属性点;完成对应活动自动累积经验"]})]})}function op({label:e,value:t,color:a}){return(0,w.jsxs)("div",{className:"flex items-center justify-between rounded bg-black/25 border border-white/5 px-1.5 py-0.5",children:[(0,w.jsx)("span",{className:"text-muted-foreground/80 truncate",children:e}),(0,w.jsx)("span",{className:`font-mono ${a}`,children:t})]})}function ox(){let e=tn(e=>e._tideEvents),t=tn(e=>e.consumeTideEvents),{toast:a}=(0,tO.useToast)();return(0,v.useEffect)(()=>{if(0!==e.length)for(let e of t()){let t=e.isGlobal?"🌐 ":"";if(e.started){let s=F[e.started];tW("tideStart"),a({title:`${t}${s.icon} ${e.isGlobal?"全球星潮":"星潮降临"}${s.name}`,description:e.isGlobal?`全球玩家同步经历 \xb7 ${s.desc}`:s.desc})}if(e.ended){let s=F[e.ended];e.silenceCompensation&&e.silenceCompensation>0?(tW("techBuy"),a({title:`${t}${s.icon} 寂静期消散`,description:`虚空回赠 ${e.silenceCompensation} 洞见。`})):(tW("tideEnd"),a({title:`${t}${s.icon} ${s.name}结束`,description:e.isGlobal?"全球星潮退去,物理法则恢复。":"星潮退去,物理法则恢复。"}))}}},[e,t,a]),null}function og(){let e=tn(e=>e.activeTide),t=tn(e=>e.globalTide),[,a]=(0,v.useState)(0);if((0,v.useEffect)(()=>{if(!e)return;let t=setInterval(()=>a(e=>e+1),500);return()=>clearInterval(t)},[e]),!e)return null;let s=F[e.type],r=Math.max(0,e.endsAt-Date.now()),n=Math.ceil(r/1e3),o=Math.min(1,Math.max(0,1-r/(t?t.endsAt-t.startedAt:75e3))),l=!!t;return(0,w.jsxs)("div",{className:`flex items-center gap-1.5 px-2 py-1 rounded-full text-[10px] font-medium relative overflow-hidden ${l?"ring-1 ring-amber-300/60":""}`,style:{background:l?`linear-gradient(135deg, ${s.color}26, ${s.color}11)`:`${s.color}1a`,border:`1px solid ${s.color}${l?"88":"55"}`,color:s.color,boxShadow:`0 0 ${l?"16":"10"}px ${s.glow}`},title:l?`🌐 全球星潮 \xb7 ${s.desc}`:s.desc,children:[(0,w.jsx)("div",{className:"absolute inset-0 opacity-20",style:{background:`linear-gradient(90deg, ${s.color}40 ${100*o}%, transparent ${100*o}%)`}}),l&&(0,w.jsx)("span",{className:"relative text-[11px] leading-none animate-pulse","aria-label":"全球星潮标记",children:"🌐"}),(0,w.jsx)("span",{className:"relative text-xs leading-none",children:s.icon}),(0,w.jsx)("span",{className:"relative leading-none",children:s.name}),(0,w.jsxs)("span",{className:"relative font-mono leading-none opacity-80",children:[n,"s"]})]})}function ob(){let e=tn(e=>e.activeTide),t=tn(e=>e.globalTide);if(!e)return null;let a=F[e.type],s=!!t;return(0,w.jsxs)("div",{className:"jsx-12289952018fdcbd fixed inset-0 pointer-events-none z-0 transition-opacity duration-1000",children:[(0,w.jsx)("div",{style:{background:`linear-gradient(180deg, ${a.color}22, transparent)`},className:"jsx-12289952018fdcbd absolute top-0 left-0 right-0 h-24 opacity-40"}),(0,w.jsx)("div",{style:{background:`linear-gradient(0deg, ${a.color}22, transparent)`},className:"jsx-12289952018fdcbd absolute bottom-0 left-0 right-0 h-24 opacity-40"}),(0,w.jsx)("div",{style:{boxShadow:`inset 0 0 ${s?"160":"120"}px ${a.glow}`,animation:"tide-breathe 3s ease-in-out infinite"},className:"jsx-12289952018fdcbd absolute inset-0"}),s&&(0,w.jsx)("div",{style:{background:"linear-gradient(90deg, transparent, #fbbf24, #fcd34d, #fbbf24, transparent)",boxShadow:"0 0 16px rgba(251,191,36,0.7)",animation:"global-tide-sweep 2.5s linear infinite"},className:"jsx-12289952018fdcbd absolute top-0 left-0 right-0 h-1 opacity-90"}),(0,w.jsx)(tD.default,{id:"12289952018fdcbd",children:"@keyframes tide-breathe{0%,to{opacity:.5}50%{opacity:.9}}@keyframes global-tide-sweep{0%{transform:translate(-30%)}to{transform:translate(30%)}}"})]})}let oy=Object.create(null);oy.open="0",oy.close="1",oy.ping="2",oy.pong="3",oy.message="4",oy.upgrade="5",oy.noop="6";let ow=Object.create(null);Object.keys(oy).forEach(e=>{ow[oy[e]]=e});let ov={type:"error",data:"parser error"},oj="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),oN="function"==typeof ArrayBuffer,ok=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,oM=({type:e,data:t},a,s)=>{if(oj&&t instanceof Blob)if(a)return s(t);else return oS(t,s);if(oN&&(t instanceof ArrayBuffer||ok(t)))if(a)return s(t);else return oS(new Blob([t]),s);return s(oy[e]+(t||""))},oS=(e,t)=>{let a=new FileReader;return a.onload=function(){t("b"+(a.result.split(",")[1]||""))},a.readAsDataURL(e)};function oC(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let o_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",oT="u"<typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<o_.length;e++)oT[o_.charCodeAt(e)]=e;let oP="function"==typeof ArrayBuffer,oR=(e,t)=>{if("string"!=typeof e)return{type:"message",data:oA(e,t)};let a=e.charAt(0);return"b"===a?{type:"message",data:oE(e.substring(1),t)}:ow[a]?e.length>1?{type:ow[a],data:e.substring(1)}:{type:ow[a]}:ov},oE=(e,t)=>oP?oA((e=>{let t=.75*e.length,a=e.length,s,r=0,n,o,l,i;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);let c=new ArrayBuffer(t),d=new Uint8Array(c);for(s=0;s<a;s+=4)n=oT[e.charCodeAt(s)],o=oT[e.charCodeAt(s+1)],l=oT[e.charCodeAt(s+2)],i=oT[e.charCodeAt(s+3)],d[r++]=n<<2|o>>4,d[r++]=(15&o)<<4|l>>2,d[r++]=(3&l)<<6|63&i;return c})(e),t):{base64:!0,data:e},oA=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer;function o$(e){return e.reduce((e,t)=>e+t.length,0)}function oB(e,t){if(e[0].length===t)return e.shift();let a=new Uint8Array(t),s=0;for(let r=0;r<t;r++)a[r]=e[0][s++],s===e[0].length&&(e.shift(),s=0);return e.length&&s<e[0].length&&(e[0]=e[0].slice(s)),a}function oI(e){if(e){var t=e;for(var a in oI.prototype)t[a]=oI.prototype[a];return t}}oI.prototype.on=oI.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},oI.prototype.once=function(e,t){function a(){this.off(e,a),t.apply(this,arguments)}return a.fn=t,this.on(e,a),this},oI.prototype.off=oI.prototype.removeListener=oI.prototype.removeAllListeners=oI.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var a,s=this._callbacks["$"+e];if(!s)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r=0;r<s.length;r++)if((a=s[r])===t||a.fn===t){s.splice(r,1);break}return 0===s.length&&delete this._callbacks["$"+e],this},oI.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),a=this._callbacks["$"+e],s=1;s<arguments.length;s++)t[s-1]=arguments[s];if(a){a=a.slice(0);for(var s=0,r=a.length;s<r;++s)a[s].apply(this,t)}return this},oI.prototype.emitReserved=oI.prototype.emit,oI.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},oI.prototype.hasListeners=function(e){return!!this.listeners(e).length};let oD="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),oO="u">typeof self?self:"u">typeof window?window:Function("return this")();function oL(e,...t){return t.reduce((t,a)=>(e.hasOwnProperty(a)&&(t[a]=e[a]),t),{})}let oz=oO.setTimeout,oF=oO.clearTimeout;function oH(e,t){t.useNativeTimers?(e.setTimeoutFn=oz.bind(oO),e.clearTimeoutFn=oF.bind(oO)):(e.setTimeoutFn=oO.setTimeout.bind(oO),e.clearTimeoutFn=oO.clearTimeout.bind(oO))}function oW(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class oq extends Error{constructor(e,t,a){super(e),this.description=t,this.context=a,this.type="TransportError"}}class oK extends oI{constructor(e){super(),this.writable=!1,oH(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,a){return super.emitReserved("error",new oq(e,t,a)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return("opening"===this.readyState||"open"===this.readyState)&&(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=oR(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return -1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&443!==Number(this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){let t=function(e){let t="";for(let a in e)e.hasOwnProperty(a)&&(t.length&&(t+="&"),t+=encodeURIComponent(a)+"="+encodeURIComponent(e[a]));return t}(e);return t.length?"?"+t:""}}class oU extends oK{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",function(){--e||t()})),this.writable||(e++,this.once("drain",function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){let t=e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)};((e,t)=>{let a=e.split("\x1e"),s=[];for(let e=0;e<a.length;e++){let r=oR(a[e],t);if(s.push(r),"error"===r.type)break}return s})(e,this.socket.binaryType).forEach(t),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){let e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){var t;let a,s,r;this.writable=!1,t=e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})},s=Array(a=e.length),r=0,e.forEach((e,n)=>{oM(e,!1,e=>{s[n]=e,++r===a&&t(s.join("\x1e"))})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=oW()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let oV=!1;try{oV="u">typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}let oX=oV;function oY(){}class oG extends oU{constructor(e){if(super(e),"u">typeof location){const t="https:"===location.protocol;let a=location.port;a||(a=t?"443":"80"),this.xd="u">typeof location&&e.hostname!==location.hostname||a!==e.port}}doWrite(e,t){let a=this.request({method:"POST",data:e});a.on("success",t),a.on("error",(e,t)=>{this.onError("xhr post error",e,t)})}doPoll(){let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(e,t)=>{this.onError("xhr poll error",e,t)}),this.pollXhr=e}}class oJ extends oI{constructor(e,t,a){super(),this.createRequest=e,oH(this,a),this._opts=a,this._method=a.method||"GET",this._uri=t,this._data=void 0!==a.data?a.data:null,this._create()}_create(){var e;let t=oL(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;let a=this._xhr=this.createRequest(t);try{a.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let e in a.setDisableHeaderCheck&&a.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&a.setRequestHeader(e,this._opts.extraHeaders[e])}catch(e){}if("POST"===this._method)try{a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{a.setRequestHeader("Accept","*/*")}catch(e){}null==(e=this._opts.cookieJar)||e.addCookies(a),"withCredentials"in a&&(a.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(a.timeout=this._opts.requestTimeout),a.onreadystatechange=()=>{var e;3===a.readyState&&(null==(e=this._opts.cookieJar)||e.parseCookies(a.getResponseHeader("set-cookie"))),4===a.readyState&&(200===a.status||1223===a.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof a.status?a.status:0)},0))},a.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}"u">typeof document&&(this._index=oJ.requestsCount++,oJ.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=oY,e)try{this._xhr.abort()}catch(e){}"u">typeof document&&delete oJ.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}function oQ(){for(let e in oJ.requests)oJ.requests.hasOwnProperty(e)&&oJ.requests[e].abort()}oJ.requestsCount=0,oJ.requests={},"u">typeof document&&("function"==typeof attachEvent?attachEvent("onunload",oQ):"function"==typeof addEventListener&&addEventListener("onpagehide"in oO?"pagehide":"unload",oQ,!1));let oZ=(i=o0({xdomain:!1}))&&null!==i.responseType;function o0(e){let t=e.xdomain;try{if("u">typeof XMLHttpRequest&&(!t||oX))return new XMLHttpRequest}catch(e){}if(!t)try{return new oO[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(e){}}let o1="u">typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class o2 extends oK{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,a=o1?{}:oL(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(a.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,a)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let a=e[t],s=t===e.length-1;oM(a,this.supportsBinary,e=>{try{this.doWrite(a,e)}catch(e){}s&&oD(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=oW()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}let o5=oO.WebSocket||oO.MozWebSocket,o3={websocket:class extends o2{createSocket(e,t,a){return o1?new o5(e,t,a):t?new o5(e,t):new o5(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends oK{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{var s,r;let n,o,l,i,c=(s=Number.MAX_SAFE_INTEGER,r=this.socket.binaryType,a||(a=new TextDecoder),n=[],o=0,l=-1,i=!1,new TransformStream({transform(e,t){for(n.push(e);;){if(0===o){if(1>o$(n))break;let e=oB(n,1);i=(128&e[0])==128,o=(l=127&e[0])<126?3:126===l?1:2}else if(1===o){if(2>o$(n))break;let e=oB(n,2);l=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),o=3}else if(2===o){if(8>o$(n))break;let e=oB(n,8),a=new DataView(e.buffer,e.byteOffset,e.length),s=a.getUint32(0);if(s>2097151){t.enqueue(ov);break}l=0x100000000*s+a.getUint32(4),o=3}else{if(o$(n)<l)break;let e=oB(n,l);t.enqueue(oR(i?e:a.decode(e),r)),o=0}if(0===l||l>s){t.enqueue(ov);break}}}})),d=e.readable.pipeThrough(c).getReader(),u=new TransformStream({transform(e,a){var s;s=t=>{let s,r=t.length;if(r<126)new DataView((s=new Uint8Array(1)).buffer).setUint8(0,r);else if(r<65536){let e=new DataView((s=new Uint8Array(3)).buffer);e.setUint8(0,126),e.setUint16(1,r)}else{let e=new DataView((s=new Uint8Array(9)).buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(s[0]|=128),a.enqueue(s),a.enqueue(t)},oj&&e.data instanceof Blob?e.data.arrayBuffer().then(oC).then(s):oN&&(e.data instanceof ArrayBuffer||ok(e.data))?s(oC(e.data)):oM(e,!1,e=>{t||(t=new TextEncoder),s(t.encode(e))})}});u.readable.pipeTo(e.writable),this._writer=u.writable.getWriter();let h=()=>{d.read().then(({done:e,value:t})=>{e||(this.onPacket(t),h())}).catch(e=>{})};h();let f={type:"open"};this.query.sid&&(f.data=`{"sid":"${this.query.sid}"}`),this._writer.write(f).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let a=e[t],s=t===e.length-1;this._writer.write(a).then(()=>{s&&oD(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null==(e=this._transport)||e.close()}},polling:class extends oG{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=oZ&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new oJ(o0,this.uri(),e)}}},o4=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,o9=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function o7(e){var t,a;let s,r;if(e.length>8e3)throw"URI too long";let n=e,o=e.indexOf("["),l=e.indexOf("]");-1!=o&&-1!=l&&(e=e.substring(0,o)+e.substring(o,l).replace(/:/g,";")+e.substring(l,e.length));let i=o4.exec(e||""),c={},d=14;for(;d--;)c[o9[d]]=i[d]||"";return -1!=o&&-1!=l&&(c.source=n,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),s=(t=c.path).replace(/\/{2,9}/g,"/").split("/"),("/"==t.slice(0,1)||0===t.length)&&s.splice(0,1),"/"==t.slice(-1)&&s.splice(s.length-1,1),c.pathNames=s,a=c.query,r={},a.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,a){t&&(r[t]=a)}),c.queryKey=r,c}let o6="function"==typeof addEventListener&&"function"==typeof removeEventListener,o8=[];o6&&addEventListener("offline",()=>{o8.forEach(e=>e())},!1);class le extends oI{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const a=o7(e);t.hostname=a.host,t.secure="https"===a.protocol||"wss"===a.protocol,t.port=a.port,a.query&&(t.query=a.query)}else t.host&&(t.hostname=o7(t.host).host);oH(this,t),this.secure=null!=t.secure?t.secure:"u">typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("u">typeof location?location.hostname:"localhost"),this.port=t.port||("u">typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},a=e.split("&");for(let e=0,s=a.length;e<s;e++){let s=a[e].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}(this.opts.query)),o6&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},o8.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let a=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](a)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let e=this.opts.rememberUpgrade&&le.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";let t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",le.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let t=Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let a=this.writeBuffer[t].data;if(a&&(e+="string"==typeof a?function(e){let t=0,a=0;for(let s=0,r=e.length;s<r;s++)(t=e.charCodeAt(s))<128?a+=1:t<2048?a+=2:t<55296||t>=57344?a+=3:(s++,a+=4);return a}(a):Math.ceil(1.33*(a.byteLength||a.size))),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,oD(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,a){return this._sendPacket("message",e,t,a),this}send(e,t,a){return this._sendPacket("message",e,t,a),this}_sendPacket(e,t,a,s){if("function"==typeof t&&(s=t,t=void 0),"function"==typeof a&&(s=a,a=null),"closing"===this.readyState||"closed"===this.readyState)return;(a=a||{}).compress=!1!==a.compress;let r={type:e,data:t,options:a};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),s&&this.once("flush",s),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},a=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return("opening"===this.readyState||"open"===this.readyState)&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?a():e()}):this.upgrading?a():e()),this}_onError(e){if(le.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),o6&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=o8.indexOf(this._offlineEventListener);-1!==e&&o8.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}le.protocol=4;class lt extends le{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),a=!1;le.priorWebsocketSuccess=!1;let s=()=>{a||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!a)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;le.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{a||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}}))};function r(){a||(a=!0,c(),t.close(),t=null)}let n=e=>{let a=Error("probe error: "+e);a.transport=t.name,r(),this.emitReserved("upgradeError",a)};function o(){n("transport closed")}function l(){n("socket closed")}function i(e){t&&e.name!==t.name&&r()}let c=()=>{t.removeListener("open",s),t.removeListener("error",n),t.removeListener("close",o),this.off("close",l),this.off("upgrading",i)};t.once("open",s),t.once("error",n),t.once("close",o),this.once("close",l),this.once("upgrading",i),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{a||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let a=0;a<e.length;a++)~this.transports.indexOf(e[a])&&t.push(e[a]);return t}}class la extends lt{constructor(e,t={}){const a="object"==typeof e,s=a?{...e}:{...t};(!s.transports||s.transports&&"string"==typeof s.transports[0])&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(e=>o3[e]).filter(e=>!!e)),super(a?s:e,s)}}la.protocol;let ls="function"==typeof ArrayBuffer,lr=Object.prototype.toString,ln="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===lr.call(Blob),lo="function"==typeof File||"u">typeof File&&"[object FileConstructor]"===lr.call(File);function ll(e){return ls&&(e instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer))||ln&&e instanceof Blob||lo&&e instanceof File}let li=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];(g=y||(y={}))[g.CONNECT=0]="CONNECT",g[g.DISCONNECT=1]="DISCONNECT",g[g.EVENT=2]="EVENT",g[g.ACK=3]="ACK",g[g.CONNECT_ERROR=4]="CONNECT_ERROR",g[g.BINARY_EVENT=5]="BINARY_EVENT",g[g.BINARY_ACK=6]="BINARY_ACK";class lc{constructor(e){this.replacer=e}encode(e){return(e.type===y.EVENT||e.type===y.ACK)&&function e(t,a){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let a=0,s=t.length;a<s;a++)if(e(t[a]))return!0;return!1}if(ll(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1==arguments.length)return e(t.toJSON(),!0);for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&e(t[a]))return!0;return!1}(e)?this.encodeAsBinary({type:e.type===y.EVENT?y.BINARY_EVENT:y.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===y.BINARY_EVENT||e.type===y.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t,a,s=(t=[],a=e.data,e.data=function e(t,a){if(!t)return t;if(ll(t)){let e={_placeholder:!0,num:a.length};return a.push(t),e}if(Array.isArray(t)){let s=Array(t.length);for(let r=0;r<t.length;r++)s[r]=e(t[r],a);return s}if("object"==typeof t&&!(t instanceof Date)){let s={};for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=e(t[r],a));return s}return t}(a,t),e.attachments=t.length,{packet:e,buffers:t}),r=this.encodeAsString(s.packet),n=s.buffers;return n.unshift(r),n}}class ld extends oI{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},"function"==typeof e?{reviver:e}:e)}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw Error("got plaintext data when reconstructing a packet");let a=(t=this.decodeString(e)).type===y.BINARY_EVENT;a||t.type===y.BINARY_ACK?(t.type=a?y.EVENT:y.ACK,this.reconstructor=new lu(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(ll(e)||e.base64)if(this.reconstructor)(t=this.reconstructor.takeBinaryData(e))&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw Error("got binary data when not reconstructing a packet");else throw Error("Unknown type: "+e)}decodeString(e){let t=0,a={type:Number(e.charAt(0))};if(void 0===y[a.type])throw Error("unknown packet type "+a.type);if(a.type===y.BINARY_EVENT||a.type===y.BINARY_ACK){let s=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);let r=e.substring(s,t);if(r!=Number(r)||"-"!==e.charAt(t))throw Error("Illegal attachments");let n=Number(r);if(!lh(n)||n<0)throw Error("Illegal attachments");if(n>this.opts.maxAttachments)throw Error("too many attachments");a.attachments=n}if("/"===e.charAt(t+1)){let s=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);a.nsp=e.substring(s,t)}else a.nsp="/";let s=e.charAt(t+1);if(""!==s&&Number(s)==s){let s=t+1;for(;++t;){let a=e.charAt(t);if(null==a||Number(a)!=a){--t;break}if(t===e.length)break}a.id=Number(e.substring(s,t+1))}if(e.charAt(++t)){let s=this.tryParse(e.substr(t));if(ld.isPayloadValid(a.type,s))a.data=s;else throw Error("invalid payload")}return a}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case y.CONNECT:return lf(t);case y.DISCONNECT:return void 0===t;case y.CONNECT_ERROR:return"string"==typeof t||lf(t);case y.EVENT:case y.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===li.indexOf(t[0]));case y.ACK:case y.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class lu{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t,a;let e=(t=this.reconPack,a=this.buffers,t.data=function e(t,a){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num<a.length)return a[t.num];throw Error("illegal attachments")}if(Array.isArray(t))for(let s=0;s<t.length;s++)t[s]=e(t[s],a);else if("object"==typeof t)for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(t[s]=e(t[s],a));return t}(t.data,a),delete t.attachments,t);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let lh=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function lf(e){return"[object Object]"===Object.prototype.toString.call(e)}function lm(e){var t;return"string"==typeof e.nsp&&(void 0===(t=e.id)||lh(t))&&function(e,t){switch(e){case y.CONNECT:return void 0===t||lf(t);case y.DISCONNECT:return void 0===t;case y.EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===li.indexOf(t[0]));case y.ACK:return Array.isArray(t);case y.CONNECT_ERROR:return"string"==typeof t||lf(t);default:return!1}}(e.type,e.data)}function lp(e,t,a){return e.on(t,a),function(){e.off(t,a)}}e.s(["Decoder",()=>ld,"Encoder",()=>lc,"PacketType",()=>y,"isPacketValid",()=>lm,"protocol",0,5],51890);let lx=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class lg extends oI{constructor(e,t,a){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,a&&a.auth&&(this.auth=a.auth),this._opts=Object.assign({},a),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[lp(e,"open",this.onopen.bind(this)),lp(e,"packet",this.onpacket.bind(this)),lp(e,"error",this.onerror.bind(this)),lp(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var a,s,r;if(lx.hasOwnProperty(e))throw Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:y.EVENT,data:t};if(n.options={},n.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){let e=this.ids++,a=t.pop();this._registerAckCallback(e,a),n.id=e}let o=null==(s=null==(a=this.io.engine)?void 0:a.transport)?void 0:s.writable,l=this.connected&&!(null==(r=this.io.engine)?void 0:r._hasPingExpired());return this.flags.volatile&&!o||(l?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var a;let s=null!=(a=this.flags.timeout)?a:this._opts.ackTimeout;if(void 0===s){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error("operation has timed out"))},s),n=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};n.withError=!0,this.acks[e]=n}emitWithAck(e,...t){return new Promise((a,s)=>{let r=(e,t)=>e?s(e):a(t);r.withError=!0,t.push(r),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());let a={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...s)=>(this._queue[0],null!==e?a.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...s)),a.pending=!1,this._drainQueue())),this._queue.push(a),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;let t=this._queue[0];(!t.pending||e)&&(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:y.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case y.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case y.EVENT:case y.BINARY_EVENT:this.onevent(e);break;case y.ACK:case y.BINARY_ACK:this.onack(e);break;case y.DISCONNECT:this.ondisconnect();break;case y.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){let t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length)for(let t of this._anyListeners.slice())t.apply(this,e);super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,a=!1;return function(...s){a||(a=!0,t.packet({type:y.ACK,id:e,data:s}))}}onack(e){let t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:y.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let a=0;a<t.length;a++)if(e===t[a]){t.splice(a,1);break}}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let a=0;a<t.length;a++)if(e===t[a]){t.splice(a,1);break}}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length)for(let t of this._anyOutgoingListeners.slice())t.apply(this,e.data)}}var lb=e.i(51890);function ly(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}ly.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),a=Math.floor(t*this.jitter*e);e=(1&Math.floor(10*t))==0?e-a:e+a}return 0|Math.min(e,this.max)},ly.prototype.reset=function(){this.attempts=0},ly.prototype.setMin=function(e){this.ms=e},ly.prototype.setMax=function(e){this.max=e},ly.prototype.setJitter=function(e){this.jitter=e};class lw extends oI{constructor(e,t){var a;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,oH(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!=(a=t.randomizationFactor)?a:.5),this.backoff=new ly({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const s=t.parser||lb;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null==(t=this.backoff)||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null==(t=this.backoff)||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null==(t=this.backoff)||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new la(this.uri,this.opts);let t=this.engine,a=this;this._readyState="opening",this.skipReconnect=!1;let s=lp(t,"open",function(){a.onopen(),e&&e()}),r=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},n=lp(t,"error",r);if(!1!==this._timeout){let e=this._timeout,a=this.setTimeoutFn(()=>{s(),r(Error("timeout")),t.close()},e);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(s),this.subs.push(n),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(lp(e,"ping",this.onping.bind(this)),lp(e,"data",this.ondata.bind(this)),lp(e,"error",this.onerror.bind(this)),lp(e,"close",this.onclose.bind(this)),lp(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){oD(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let a=this.nsps[e];return a?this._autoConnect&&!a.active&&a.connect():(a=new lg(this,e,t),this.nsps[e]=a),a}_destroy(e){for(let e of Object.keys(this.nsps))if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let a=0;a<t.length;a++)this.engine.write(t[a],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var a;this.cleanup(),null==(a=this.engine)||a.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let a=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()}))},t);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}let lv={};function lj(e,t){let a;"object"==typeof e&&(t=e,e=void 0);let s=function(e,t="",a){let s=e;a=a||"u">typeof location&&location,null==e&&(e=a.protocol+"//"+a.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?a.protocol+e:a.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==a?a.protocol+"//"+e:"https://"+e),s=o7(e)),!s.port&&(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";let r=-1!==s.host.indexOf(":")?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+r+":"+s.port+t,s.href=s.protocol+"://"+r+(a&&a.port===s.port?"":":"+s.port),s}(e,(t=t||{}).path||"/socket.io"),r=s.source,n=s.id,o=s.path,l=lv[n]&&o in lv[n].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||l?a=new lw(r,t):(lv[n]||(lv[n]=new lw(r,t)),a=lv[n]),s.query&&!t.query&&(t.query=s.queryKey),a.socket(s.path,t)}Object.assign(lj,{Manager:lw,Socket:lg,io:lj,connect:lj});let lN=null,lk=0;var lM=e.i(75830),lS="rovingFocusGroup.onEntryFocus",lC={bubbles:!1,cancelable:!0},l_="RovingFocusGroup",[lT,lP,lR]=(0,lM.createCollection)(l_),[lE,lA]=(0,al.createContextScope)(l_,[lR]),[l$,lB]=lE(l_),lI=v.forwardRef((e,t)=>(0,w.jsx)(lT.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,w.jsx)(lT.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,w.jsx)(lD,{...e,ref:t})})}));lI.displayName=l_;var lD=v.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:a,orientation:s,loop:r=!1,dir:n,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:i,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...u}=e,h=v.useRef(null),f=(0,tu.useComposedRefs)(t,h),m=ad(n),[p,x]=(0,aZ.useControllableState)({prop:o,defaultProp:l??null,onChange:i,caller:l_}),[g,b]=v.useState(!1),y=(0,ai.useCallbackRef)(c),j=lP(a),N=v.useRef(!1),[k,M]=v.useState(0);return v.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(lS,y),()=>e.removeEventListener(lS,y)},[y]),(0,w.jsx)(l$,{scope:a,orientation:s,dir:m,loop:r,currentTabStopId:p,onItemFocus:v.useCallback(e=>x(e),[x]),onItemShiftTab:v.useCallback(()=>b(!0),[]),onFocusableItemAdd:v.useCallback(()=>M(e=>e+1),[]),onFocusableItemRemove:v.useCallback(()=>M(e=>e-1),[]),children:(0,w.jsx)(an.Primitive.div,{tabIndex:g||0===k?-1:0,"data-orientation":s,...u,ref:f,style:{outline:"none",...e.style},onMouseDown:(0,ah.composeEventHandlers)(e.onMouseDown,()=>{N.current=!0}),onFocus:(0,ah.composeEventHandlers)(e.onFocus,e=>{let t=!N.current;if(e.target===e.currentTarget&&t&&!g){let t=new CustomEvent(lS,lC);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=j().filter(e=>e.focusable);lF([e.find(e=>e.active),e.find(e=>e.id===p),...e].filter(Boolean).map(e=>e.ref.current),d)}}N.current=!1}),onBlur:(0,ah.composeEventHandlers)(e.onBlur,()=>b(!1))})})}),lO="RovingFocusGroupItem",lL=v.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:a,focusable:s=!0,active:r=!1,tabStopId:n,children:o,...l}=e,i=aQ(),c=n||i,d=lB(lO,a),u=d.currentTabStopId===c,h=lP(a),{onFocusableItemAdd:f,onFocusableItemRemove:m,currentTabStopId:p}=d;return v.useEffect(()=>{if(s)return f(),()=>m()},[s,f,m]),(0,w.jsx)(lT.ItemSlot,{scope:a,id:c,focusable:s,active:r,children:(0,w.jsx)(an.Primitive.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:(0,ah.composeEventHandlers)(e.onMouseDown,e=>{s?d.onItemFocus(c):e.preventDefault()}),onFocus:(0,ah.composeEventHandlers)(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:(0,ah.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,a){var s;let r=(s=e.key,"rtl"!==a?s:"ArrowLeft"===s?"ArrowRight":"ArrowRight"===s?"ArrowLeft":s);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(r))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(r)))return lz[r]}(e,d.orientation,d.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){var a,s;"prev"===t&&r.reverse();let n=r.indexOf(e.currentTarget);r=d.loop?(a=r,s=n+1,a.map((e,t)=>a[(s+t)%a.length])):r.slice(n+1)}setTimeout(()=>lF(r))}}),children:"function"==typeof o?o({isCurrentTabStop:u,hasTabStop:null!=p}):o})})});lL.displayName=lO;var lz={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function lF(e,t=!1){let a=document.activeElement;for(let s of e)if(s===a||(s.focus({preventScroll:t}),document.activeElement!==a))return}var lH="Tabs",[lW,lq]=(0,al.createContextScope)(lH,[lA]),lK=lA(),[lU,lV]=lW(lH),lX=v.forwardRef((e,t)=>{let{__scopeTabs:a,value:s,onValueChange:r,defaultValue:n,orientation:o="horizontal",dir:l,activationMode:i="automatic",...c}=e,d=ad(l),[u,h]=(0,aZ.useControllableState)({prop:s,onChange:r,defaultProp:n??"",caller:lH});return(0,w.jsx)(lU,{scope:a,baseId:aQ(),value:u,onValueChange:h,orientation:o,dir:d,activationMode:i,children:(0,w.jsx)(an.Primitive.div,{dir:d,"data-orientation":o,...c,ref:t})})});lX.displayName=lH;var lY="TabsList",lG=v.forwardRef((e,t)=>{let{__scopeTabs:a,loop:s=!0,...r}=e,n=lV(lY,a),o=lK(a);return(0,w.jsx)(lI,{asChild:!0,...o,orientation:n.orientation,dir:n.dir,loop:s,children:(0,w.jsx)(an.Primitive.div,{role:"tablist","aria-orientation":n.orientation,...r,ref:t})})});lG.displayName=lY;var lJ="TabsTrigger",lQ=v.forwardRef((e,t)=>{let{__scopeTabs:a,value:s,disabled:r=!1,...n}=e,o=lV(lJ,a),l=lK(a),i=l1(o.baseId,s),c=l2(o.baseId,s),d=s===o.value;return(0,w.jsx)(lL,{asChild:!0,...l,focusable:!r,active:d,children:(0,w.jsx)(an.Primitive.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:i,...n,ref:t,onMouseDown:(0,ah.composeEventHandlers)(e.onMouseDown,e=>{r||0!==e.button||!1!==e.ctrlKey?e.preventDefault():o.onValueChange(s)}),onKeyDown:(0,ah.composeEventHandlers)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&o.onValueChange(s)}),onFocus:(0,ah.composeEventHandlers)(e.onFocus,()=>{let e="manual"!==o.activationMode;d||r||!e||o.onValueChange(s)})})})});lQ.displayName=lJ;var lZ="TabsContent",l0=v.forwardRef((e,t)=>{let{__scopeTabs:a,value:s,forceMount:r,children:n,...o}=e,l=lV(lZ,a),i=l1(l.baseId,s),c=l2(l.baseId,s),d=s===l.value,u=v.useRef(d);return v.useEffect(()=>{let e=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,w.jsx)(ao.Presence,{present:r||d,children:({present:a})=>(0,w.jsx)(an.Primitive.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":i,hidden:!a,id:c,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:a&&n})})});function l1(e,t){return`${e}-trigger-${t}`}function l2(e,t){return`${e}-content-${t}`}function l5({className:e,...t}){return(0,w.jsx)(lX,{"data-slot":"tabs",className:(0,tA.cn)("flex flex-col gap-2",e),...t})}function l3({className:e,...t}){return(0,w.jsx)(lG,{"data-slot":"tabs-list",className:(0,tA.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function l4({className:e,...t}){return(0,w.jsx)(lQ,{"data-slot":"tabs-trigger",className:(0,tA.cn)("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function l9({className:e,...t}){return(0,w.jsx)(l0,{"data-slot":"tabs-content",className:(0,tA.cn)("flex-1 outline-none",e),...t})}l0.displayName=lZ;let l7=(0,to.default)("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),l6=(0,to.default)("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]),l8=(0,to.default)("navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]),ie=(0,to.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);function it(){let e,t,a,s,r,n,o,l,i,c;e=tn(e=>e.tick),t=tn(e=>e.autoDecodeTick),a=tn(e=>e.tickTide),s=tn(e=>e.checkAchievements),r=tn(e=>e.init),n=(0,v.useRef)(!1),(0,v.useEffect)(()=>{let o=()=>{n.current||(r(),n.current=!0)},l=null,i=null;tn.persist.hasHydrated()?o():(l=tn.persist.onFinishHydration(o),i=setTimeout(o,500));let c=0,d=setInterval(()=>{let r=Date.now();e(r),t(),a(r),++c%4==0&&s()},250);return()=>{clearInterval(d),l&&l(),i&&clearTimeout(i)}},[e,t,a,s,r]),(0,v.useEffect)(()=>{let t=()=>{"visible"===document.visibilityState&&(e(Date.now()),a(Date.now()),s())};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[e,a,s]),o=tn(e=>e.soundOn),(0,v.useEffect)(()=>{tH().setEnabled(o)},[o]),l=tn(e=>e.triggerGlobalTide),i=(0,v.useRef)(l),(0,v.useEffect)(()=>{i.current=l},[l]),c=(0,v.useRef)(new Set),(0,v.useEffect)(()=>{let e=(lN||(lN=lj("/?XTransformPort=3031",{transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:1e3,reconnectionDelayMax:1e4,timeout:1e4})),lN);lk+=1;let t=e=>{let t=`${e.startedAt}_${e.type}`;if(!c.current.has(t)){if(c.current.add(t),c.current.size>32){let e=c.current.values().next().value;e&&c.current.delete(e)}e.endsAt<=Date.now()||i.current(e.type)}},a=e=>{if(e.current&&e.current.endsAt>Date.now()){let t=`${e.current.startedAt}_${e.current.type}`;c.current.has(t)||(c.current.add(t),i.current(e.current.type))}};return e.on("global-tide",t),e.on("tide-state",a),e.emit("get-next-tide"),()=>{e.off("global-tide",t),e.off("tide-state",a),(lk-=1)<=0&&lN&&(lN.disconnect(),lN=null,lk=0)}},[]);let[d,u]=(0,v.useState)(!1),[h,f]=(0,v.useState)(!1),[m,p]=(0,v.useState)(!1),[x,g]=(0,v.useState)(!1),[b,y]=(0,v.useState)(!1),[N,k]=(0,v.useState)(!1),M=tn(e=>e.contact),S=tn(e=>e.totalDecoded),C=tn(e=>e.crystalsPerSec),_=tn(e=>e.ascensions),T=tn(e=>e.tech),P=tn(e=>e.fragments),R=tn(e=>e.achievements),E=tn(e=>e.constellation??[]),A=tn(e=>e.pendingPerkChoices),B=tn(e=>e.crystals),I=tn(e=>e.crystalCap),D=tn(e=>e.activeTide),z=tn(e=>e.globalTide),H=tn(e=>e.energy),W=tn(e=>!!e.activeExpedition&&!e.activeExpedition.finished),q=tn(e=>e.chronicle?.length??0),K=tn(e=>e.pendingAttrPoints??0),[U,V]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{let e=!1,t=()=>{try{let t=eE(),a=eO();e||V(null!==a.completedAt&&!a.claimed&&a.dateKey===t.dateKey)}catch{e||V(!1)}};t();let a=setInterval(t,2e3);return()=>{e=!0,clearInterval(a)}},[]),(0,v.useEffect)(()=>{k(!0)},[]),!N)return(0,w.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-[#050410] text-muted-foreground",children:(0,w.jsx)("div",{className:"animate-pulse",children:"唤醒回响中…"})});let X=Object.values(T).filter(e=>e>0).length,Y=Object.values(P).filter(Boolean).length,G=Object.values(R).filter(Boolean).length,J=M>=100,Q=A&&A.length>0,Z=B>=.98*I,ee="点击中央晶体发起脉冲,累积记忆晶体";if(0===S&&B>=5?ee="右侧「待解码晶体」点击一颗晶体,开始解码":S>0&&0===X?ee="用洞见解锁技术树,提升产能":S>0&&Y<$.length&&(ee=`继续解码,拼凑记忆图谱(${Y}/${$.length}`),H>=1&&S>=3&&(ee="「探险」标签可深入遗迹,获取丰厚奖励"),_>=1&&E.length>0&&(ee=`星图天赋已觉醒 ${E.length}/18,继续飞升获取更多`),Z&&(ee="⚠ 仓库已满,产能浪费中!请解码晶体或升级仓库"),Q&&(ee="✦ 星图觉醒!点击顶部「星图」按钮选择一道天赋"),D){let e=F[D.type];ee=`${z?"🌐 全球星潮 · ":""}${e.icon} 星潮「${e.name}」进行中 \xb7 ${e.desc}`}return J&&(ee="✦ 接触进度已满,可发起飞升进入新周目"),(0,w.jsxs)("div",{className:"relative min-h-screen flex flex-col bg-[#050410] text-foreground overflow-x-hidden",children:[(0,w.jsx)(j,{className:"fixed inset-0 w-full h-full -z-10"}),(0,w.jsx)(ob,{}),(0,w.jsxs)("header",{className:"sticky top-0 z-30 px-3 sm:px-5 pt-3 pb-2",children:[(0,w.jsxs)("div",{className:"flex items-center gap-3 mb-2.5",children:[(0,w.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,w.jsxs)("div",{className:"relative h-9 w-9",children:[(0,w.jsx)("div",{className:"absolute inset-0 rounded-full bg-gradient-to-br from-emerald-400 via-fuchsia-500 to-rose-400 blur-md opacity-60"}),(0,w.jsx)("div",{className:"absolute inset-1 rounded-full bg-[#050410] flex items-center justify-center",children:(0,w.jsx)(tZ,{className:"h-4 w-4 text-fuchsia-300"})})]}),(0,w.jsxs)("div",{className:"leading-tight",children:[(0,w.jsx)("h1",{className:"text-base sm:text-lg font-bold text-gradient",children:"回响星核"}),(0,w.jsx)("p",{className:"text-[9px] sm:text-[10px] text-muted-foreground/70 -mt-0.5 tracking-wider",children:"ECHO NEXUS · v0.8"})]})]}),(0,w.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[(0,w.jsx)(og,{}),(0,w.jsxs)(tJ,{size:"sm",variant:"outline",onClick:()=>y(!0),className:"border-amber-400/50 text-amber-200 hover:bg-amber-500/10 h-8 px-2.5","aria-label":"深空巡航",title:"深空巡航 · 实时玩法",children:[(0,w.jsx)(l8,{className:"h-3.5 w-3.5 mr-1"}),"巡航"]}),(0,w.jsxs)(tJ,{size:"icon",variant:"ghost",onClick:()=>g(!0),className:"h-8 w-8 relative group","aria-label":"编年史",title:"回响编年史",children:[(0,w.jsx)(ae,{className:"h-4 w-4 group-hover:text-fuchsia-300 transition-colors"}),q>0&&(0,w.jsx)("span",{className:"absolute -top-0.5 -right-0.5 min-w-[14px] h-[14px] px-1 rounded-full bg-fuchsia-500 text-[9px] font-mono font-bold text-white flex items-center justify-center border border-fuchsia-300/50",children:q})]}),Q&&(0,w.jsxs)(tJ,{size:"sm",variant:"outline",onClick:()=>p(!0),className:"border-fuchsia-400/60 text-fuchsia-200 hover:bg-fuchsia-500/15 h-8 px-2.5 animate-pulse",children:[(0,w.jsx)(r_,{className:"h-3.5 w-3.5 mr-1"}),"觉醒"]}),J&&(0,w.jsxs)(tJ,{size:"sm",variant:"outline",onClick:()=>u(!0),"data-tut":"prestige-btn",className:"border-fuchsia-400/50 text-fuchsia-200 hover:bg-fuchsia-500/10 h-8 px-2.5",children:[(0,w.jsx)(td,{className:"h-3.5 w-3.5 mr-1"}),"飞升"]}),(0,w.jsx)(tJ,{size:"icon",variant:"ghost",onClick:()=>f(!0),className:"h-8 w-8","aria-label":"设置",children:(0,w.jsx)(l7,{className:"h-4 w-4"})})]})]}),(0,w.jsx)(tB,{onPrestige:()=>u(!0)})]}),(0,w.jsx)("main",{className:"flex-1 px-3 sm:px-5 pb-3 min-h-0",children:(0,w.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_minmax(360px,420px)] gap-3 h-full",children:[(0,w.jsxs)("section",{className:"glass rounded-2xl p-4 sm:p-6 flex flex-col items-center justify-center min-h-[340px] sm:min-h-[420px] relative overflow-hidden",children:[(0,w.jsx)("div",{className:"pointer-events-none absolute -top-20 -left-20 h-60 w-60 rounded-full bg-emerald-500/10 blur-3xl"}),(0,w.jsx)("div",{className:"pointer-events-none absolute -bottom-20 -right-20 h-60 w-60 rounded-full bg-fuchsia-500/10 blur-3xl"}),(0,w.jsx)("div",{className:"pointer-events-none absolute inset-6 rounded-full border border-emerald-400/10 animate-[spin_60s_linear_infinite]"}),(0,w.jsx)("div",{className:"pointer-events-none absolute inset-10 rounded-full border border-dashed border-fuchsia-400/10 animate-[spin_90s_linear_infinite_reverse]"}),(0,w.jsx)("div",{className:"pointer-events-none absolute inset-16 rounded-full border border-rose-400/8"}),(0,w.jsx)("div",{className:"pointer-events-none absolute top-3 left-3 h-4 w-4 border-l border-t border-emerald-400/30 rounded-tl"}),(0,w.jsx)("div",{className:"pointer-events-none absolute top-3 right-3 h-4 w-4 border-r border-t border-fuchsia-400/30 rounded-tr"}),(0,w.jsx)("div",{className:"pointer-events-none absolute bottom-3 left-3 h-4 w-4 border-l border-b border-amber-400/30 rounded-bl"}),(0,w.jsx)("div",{className:"pointer-events-none absolute bottom-3 right-3 h-4 w-4 border-r border-b border-rose-400/30 rounded-br"}),(0,w.jsxs)("div",{className:"pointer-events-none absolute top-3 left-1/2 -translate-x-1/2 flex items-center gap-2 text-[9px] font-mono text-muted-foreground/60",children:[(0,w.jsx)("span",{className:"h-1 w-1 rounded-full bg-emerald-400 animate-pulse"}),(0,w.jsx)("span",{children:"CRYSTAL CORE · ONLINE"}),(0,w.jsx)("span",{className:"h-1 w-1 rounded-full bg-fuchsia-400 animate-pulse"})]}),(0,w.jsx)("div",{className:"pointer-events-none absolute bottom-3 left-1/2 -translate-x-1/2 text-[8px] font-mono text-muted-foreground/40 tracking-[0.3em] uppercase",children:"echo · nexus · archaeology"}),(0,w.jsx)("div",{"data-tut":"crystal-orb",className:"contents",children:(0,w.jsx)(tY,{})})]}),(0,w.jsxs)("section",{className:"flex flex-col gap-3 min-h-0",children:[(0,w.jsx)("div",{"data-tut":"decode-panel",className:"glass rounded-2xl p-4 flex-1 min-h-[300px] sm:min-h-[360px] max-h-[560px]",children:(0,w.jsx)(t3,{})}),(0,w.jsx)("div",{className:"glass rounded-2xl p-3 min-h-[280px] sm:min-h-[320px] max-h-[440px] flex flex-col",children:(0,w.jsxs)(l5,{defaultValue:W?"expedition":Q?"constellation":"tech",className:"h-full flex flex-col",children:[(0,w.jsxs)(l3,{className:"grid grid-cols-8 h-9 bg-black/30 gap-0.5 p-1",children:[(0,w.jsxs)(l4,{value:"expedition","data-tut":"tab-expedition",className:"text-[11px] gap-1 relative px-0.5 flex-col h-7 data-[state=active]:bg-amber-500/15 data-[state=active]:shadow-[0_0_12px_rgba(251,191,36,0.3)] transition-all",children:[(0,w.jsx)(t8,{className:"h-3.5 w-3.5"}),(0,w.jsx)("span",{className:"leading-none",children:"探险"}),H>=1&&!W&&(0,w.jsx)("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-amber-400 animate-pulse ring-1 ring-black/50"}),W&&(0,w.jsx)("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-rose-400 animate-pulse ring-1 ring-black/50"})]}),(0,w.jsxs)(l4,{value:"tech","data-tut":"tab-tech",className:"text-[11px] gap-1 px-0.5 flex-col h-7 data-[state=active]:bg-emerald-500/15 data-[state=active]:shadow-[0_0_12px_rgba(52,211,153,0.3)] transition-all",children:[(0,w.jsx)(no,{className:"h-3.5 w-3.5"}),(0,w.jsx)("span",{className:"leading-none",children:"技术"})]}),(0,w.jsxs)(l4,{value:"constellation",className:"text-[11px] gap-1 relative px-0.5 flex-col h-7 data-[state=active]:bg-fuchsia-500/15 data-[state=active]:shadow-[0_0_12px_rgba(232,121,249,0.3)] transition-all",children:[(0,w.jsx)(r_,{className:"h-3.5 w-3.5"}),(0,w.jsx)("span",{className:"leading-none",children:"星图"}),Q&&(0,w.jsx)("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-fuchsia-400 animate-pulse ring-1 ring-black/50"})]}),(0,w.jsxs)(l4,{value:"codex",className:"text-[11px] gap-1 px-0.5 flex-col h-7 data-[state=active]:bg-cyan-500/15 data-[state=active]:shadow-[0_0_12px_rgba(34,211,238,0.3)] transition-all",children:[(0,w.jsx)(ae,{className:"h-3.5 w-3.5"}),(0,w.jsx)("span",{className:"leading-none",children:"图谱"})]}),(0,w.jsxs)(l4,{value:"ach",className:"text-[11px] gap-1 relative px-0.5 flex-col h-7 data-[state=active]:bg-amber-500/15 data-[state=active]:shadow-[0_0_12px_rgba(251,191,36,0.3)] transition-all",children:[(0,w.jsx)(r8,{className:"h-3.5 w-3.5"}),(0,w.jsx)("span",{className:"leading-none",children:"成就"}),G<L.length&&(0,w.jsx)("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-amber-400 animate-pulse ring-1 ring-black/50"})]}),(0,w.jsxs)(l4,{value:"beacon",className:"text-[11px] gap-1 relative px-0.5 flex-col h-7 data-[state=active]:bg-emerald-500/15 data-[state=active]:shadow-[0_0_12px_rgba(52,211,153,0.3)] transition-all",children:[(0,w.jsx)(nf,{className:"h-3.5 w-3.5"}),(0,w.jsx)("span",{className:"leading-none",children:"信标"}),U&&(0,w.jsx)("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-emerald-400 animate-pulse ring-1 ring-black/50"})]}),(0,w.jsxs)(l4,{value:"stats",className:"text-[11px] gap-1 px-0.5 flex-col h-7 data-[state=active]:bg-slate-500/15 data-[state=active]:shadow-[0_0_12px_rgba(148,163,184,0.3)] transition-all",children:[(0,w.jsx)(l6,{className:"h-3.5 w-3.5"}),(0,w.jsx)("span",{className:"leading-none",children:"统计"})]}),(0,w.jsxs)(l4,{value:"attributes",className:"text-[11px] gap-1 relative px-0.5 flex-col h-7 data-[state=active]:bg-gradient-to-br data-[state=active]:from-emerald-500/15 data-[state=active]:via-fuchsia-500/15 data-[state=active]:to-rose-500/15 data-[state=active]:shadow-[0_0_12px_rgba(232,121,249,0.3)] transition-all",children:[(0,w.jsx)(ie,{className:"h-3.5 w-3.5"}),(0,w.jsx)("span",{className:"leading-none",children:"角色"}),K>0&&(0,w.jsx)("span",{className:"absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-rose-400 animate-pulse ring-1 ring-black/50"})]})]}),(0,w.jsx)(l9,{value:"expedition",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,w.jsx)(r6,{})}),(0,w.jsx)(l9,{value:"tech",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,w.jsx)(ar,{})}),(0,w.jsx)(l9,{value:"constellation",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,w.jsx)(na,{})}),(0,w.jsx)(l9,{value:"codex",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,w.jsx)(aY,{})}),(0,w.jsx)(l9,{value:"ach",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,w.jsx)(ne,{})}),(0,w.jsx)(l9,{value:"beacon",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,w.jsx)(nM,{})}),(0,w.jsx)(l9,{value:"stats",className:"flex-1 mt-2 min-h-0",children:(0,w.jsx)(ia,{})}),(0,w.jsx)(l9,{value:"attributes",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,w.jsx)(om,{})})]})})]})]})}),(0,w.jsx)("footer",{className:"sticky bottom-0 z-20 mt-auto px-3 sm:px-5 pb-2 pt-1",children:(0,w.jsxs)("div",{className:`glass rounded-xl px-3 py-2 flex items-center gap-2 text-xs ${Z?"border-amber-400/40 animate-pulse":""} ${D?"border-white/20":""}`,style:D?{boxShadow:`inset 0 0 16px ${F[D.type].glow}`}:void 0,children:[(0,w.jsx)("span",{className:Z?"text-amber-400":D?"":"text-fuchsia-300",style:D?{color:F[D.type].color}:void 0,children:"▶"}),(0,w.jsx)("span",{className:`flex-1 truncate ${Z?"text-amber-200":"text-muted-foreground"}`,children:ee}),(0,w.jsx)("span",{className:"hidden sm:inline text-muted-foreground/60",children:"|"}),(0,w.jsxs)("span",{className:"hidden sm:inline text-muted-foreground/70",children:["产能 ",O(C),"/s"]}),(0,w.jsx)("a",{href:"https://git.atdunbg.xyz/Super_Z/echo-nexus",target:"_blank",rel:"noreferrer",className:"text-muted-foreground/60 hover:text-foreground transition ml-1","aria-label":"仓库",children:(0,w.jsx)(rU,{className:"h-3.5 w-3.5"})})]})}),(0,w.jsx)(rT,{open:d,onOpenChange:u}),(0,w.jsx)(ni,{open:x,onOpenChange:g}),(0,w.jsx)(nr,{open:m,onOpenChange:p}),(0,w.jsx)(rQ,{open:h,onOpenChange:f}),(0,w.jsx)(nt,{}),(0,w.jsx)(ox,{}),(0,w.jsx)(nS,{}),(0,w.jsx)(nT,{}),b&&(0,w.jsx)(oi,{onClose:()=>y(!1)})]})}function ia(){let e=tn(),t=Object.values(e.achievements).filter(Boolean).length,[a,s]=(0,v.useState)(null);(0,v.useEffect)(()=>{try{let e=eI();s(e.length>0?e[0].score:null)}catch{s(null)}},[]);let r=[{label:"累计解码晶体",value:`${e.totalDecoded} 颗`},{label:"飞升周目",value:`${e.ascensions}`},{label:"持有蓝图",value:`${e.blueprints.length} / 6`},{label:"已学技术",value:`${Object.values(e.tech).filter(e=>e>0).length} / ${E.length}`},{label:"已获碎片",value:`${Object.values(e.fragments).filter(Boolean).length} / ${$.length}`},{label:"已解锁成就",value:`${t} / ${L.length}`},{label:"星图天赋",value:`${e.constellation?.length??0} / ${U.length}`},{label:"接触进度",value:`${e.contact.toFixed(1)}%`},{label:"晶体产能",value:`${e.crystalsPerSec.toFixed(2)} /s`},{label:"仓库上限",value:`${O(e.crystalCap)}`},{label:"洞见倍率",value:`\xd7${e.insightMult.toFixed(2)}`},{label:"累计探险",value:`${e.totalExpeditions} 次`},{label:"BOSS 击破",value:`${e.bossKills??0} 次`},{label:"星潮亲历",value:`${(e.starTidesEncountered??[]).length} / 9`},{label:"编年史条目",value:`${(e.chronicle??[]).length} 纪元`},{label:"探险能量",value:`${Math.floor(e.energy)} / ${e.energyMax}`},{label:"信标最高分",value:null!==a?O(a):"—"},{label:"探索力",value:`${e.attributes?.exploration??0} / 100`},{label:"智慧",value:`${e.attributes?.wisdom??0} / 100`},{label:"勇气",value:`${e.attributes?.courage??0} / 100`},{label:"灵感",value:`${e.attributes?.inspiration??0} / 100`},{label:"待分配属性点",value:`${e.pendingAttrPoints??0}`}];return(0,w.jsx)("div",{className:"grid grid-cols-2 gap-1.5 text-xs",children:r.map(e=>(0,w.jsxs)("div",{className:"flex items-center justify-between rounded-md bg-black/25 border border-white/5 px-2 py-1.5",children:[(0,w.jsx)("span",{className:"text-muted-foreground",children:e.label}),(0,w.jsx)("span",{className:"font-mono text-foreground",children:e.value})]},e.label))})}e.s(["default",()=>it],52683)}]);