Files
echo-nexus/_next/static/chunks/9049994ef69d11f1.js
T
2026-06-24 00:41:29 +00:00

18 lines
552 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,s)=>{},98547,(e,t,s)=>{var r=e.i(47167);e.r(16015);var a=e.r(71645),n=a&&"object"==typeof a&&"default"in a?a:{default:a},i=void 0!==r.default&&r.default.env&&!0,o=function(e){return"[object String]"===Object.prototype.toString.call(e)},l=function(){function e(e){var t=void 0===e?{}:e,s=t.name,r=void 0===s?"stylesheet":s,a=t.optimizeForSpeed,n=void 0===a?i:a;c(o(r),"`name` must be a string"),this._name=r,this._deletedRulePlaceholder="#"+r+"-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 l="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=l?l.getAttribute("content"):null}var t,s=e.prototype;return s.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()},s.isOptimizeForSpeed=function(){return this._optimizeForSpeed},s.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||(i||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,s){return"number"==typeof s?e._serverSheet.cssRules[s]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),s},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},s.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]},s.getSheet=function(){return this.getSheetForTag(this._tags[this._tags.length-1])},s.insertRule=function(e,t){if(c(o(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 s=this.getSheet();"number"!=typeof t&&(t=s.cssRules.length);try{s.insertRule(e,t)}catch(t){return i||console.warn("StyleSheet: illegal rule: \n\n"+e+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),-1}}else{var r=this._tags[t];this._tags.push(this.makeStyleTag(this._name,e,r))}return this._rulesCount++},s.replaceRule=function(e,t){if(this._optimizeForSpeed||"u"<typeof window){var s="u">typeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!s.cssRules[e])return e;s.deleteRule(e);try{s.insertRule(t,e)}catch(r){i||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),s.insertRule(this._deletedRulePlaceholder,e)}}else{var r=this._tags[e];c(r,"old rule at index `"+e+"` not found"),r.textContent=t}return e},s.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}},s.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=[]},s.cssRules=function(){var e=this;return"u"<typeof window?this._serverSheet.cssRules:this._tags.reduce(function(t,s){return s?t=t.concat(Array.prototype.map.call(e.getSheetForTag(s).cssRules,function(t){return t.cssText===e._deletedRulePlaceholder?null:t})):t.push(null),t},[])},s.makeStyleTag=function(e,t,s){t&&c(o(t),"makeStyleTag accepts only strings as second parameter");var r=document.createElement("style");this._nonce&&r.setAttribute("nonce",this._nonce),r.type="text/css",r.setAttribute("data-"+e,""),t&&r.appendChild(document.createTextNode(t));var a=document.head||document.getElementsByTagName("head")[0];return s?a.insertBefore(r,s):a.appendChild(r),r},t=[{key:"length",get:function(){return this._rulesCount}}],function(e,t){for(var s=0;s<t.length;s++){var r=t[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(e.prototype,t),e}();function c(e,t){if(!e)throw Error("StyleSheet: "+t+".")}var d=function(e){for(var t=5381,s=e.length;s;)t=33*t^e.charCodeAt(--s);return t>>>0},u={};function h(e,t){if(!t)return"jsx-"+e;var s=String(t),r=e+s;return u[r]||(u[r]="jsx-"+d(e+"-"+s)),u[r]}function f(e,t){"u"<typeof window&&(t=t.replace(/\/style/gi,"\\/style"));var s=e+t;return u[s]||(u[s]=t.replace(/__jsx-style-dynamic-selector/g,e)),u[s]}var p=function(){function e(e){var t=void 0===e?{}:e,s=t.styleSheet,r=void 0===s?null:s,a=t.optimizeForSpeed,n=void 0!==a&&a;this._sheet=r||new l({name:"styled-jsx",optimizeForSpeed:n}),this._sheet.inject(),r&&"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 s=this.getIdAndRules(e),r=s.styleId,a=s.rules;if(r in this._instancesCounts){this._instancesCounts[r]+=1;return}var n=a.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[r]=n,this._instancesCounts[r]=1},t.remove=function(e){var t=this,s=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(s in this._instancesCounts,"styleId: `"+s+"` not found"),this._instancesCounts[s]-=1,this._instancesCounts[s]<1){var r=this._fromServer&&this._fromServer[s];r?(r.parentNode.removeChild(r),delete this._fromServer[s]):(this._indices[s].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[s]),delete this._instancesCounts[s]}},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]]}):[],s=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return s[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,s;return t=this.cssRules(),void 0===(s=e)&&(s={}),t.map(function(e){var t=e[0],r=e[1];return n.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:s.nonce?s.nonce:void 0,dangerouslySetInnerHTML:{__html:r}})})},t.getIdAndRules=function(e){var t=e.children,s=e.dynamic,r=e.id;if(s){var a=h(r,s);return{styleId:a,rules:Array.isArray(t)?t.map(function(e){return f(a,e)}):[f(a,t)]}}return{styleId:h(r),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}(),m=a.createContext(null);function x(){return new p}function g(){return a.useContext(m)}m.displayName="StyleSheetContext";var b=n.default.useInsertionEffect||n.default.useLayoutEffect,y="u">typeof window?x():void 0;function v(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}v.dynamic=function(e){return e.map(function(e){return h(e[0],e[1])}).join(" ")},s.StyleRegistry=function(e){var t=e.registry,s=e.children,r=a.useContext(m),i=a.useState(function(){return r||t||x()})[0];return n.default.createElement(m.Provider,{value:i},s)},s.createStyleRegistry=x,s.style=v,s.useStyleRegistry=g},37902,(e,t,s)=>{t.exports=e.r(98547).style},52683,e=>{"use strict";let t,s,r,a,n,i,o,l,c,d,u,h,f;var p,m,x,g,b,y,v,w,j,k,N=e.i(43476),M=e.i(71645);function S({className:e}){let t=(0,M.useRef)(null);return(0,M.useEffect)(()=>{let e=t.current;if(!e)return;let s=e.getContext("2d");if(!s)return;let r=0,a=0,n=1,i=[],o=[],l=0,c=performance.now(),d=["#34d399","#fb7185","#fbbf24","#e879f9","#a5f3fc"];function u(){n=Math.min(2,window.devicePixelRatio||1),r=e.clientWidth,a=e.clientHeight,e.width=Math.floor(r*n),e.height=Math.floor(a*n),s.setTransform(n,0,0,n,0,0),i=Array.from({length:Math.min(220,Math.floor(r*a/7e3))},()=>({x:Math.random()*r,y:Math.random()*a,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),l=requestAnimationFrame(function e(t){let n=t-c;c=t;let u=s.createRadialGradient(.5*r,.4*a,0,.5*r,.5*a,.8*Math.max(r,a));u.addColorStop(0,"#1a0f2e"),u.addColorStop(.45,"#0d0a1f"),u.addColorStop(1,"#050410"),s.fillStyle=u,s.fillRect(0,0,r,a),s.globalCompositeOperation="screen";for(let e=0;e<3;e++){let n=r*(.2+.3*e)+40*Math.sin(t/9e3+e),i=a*(.3+e%2*.4)+30*Math.cos(t/11e3+e),o=Math.max(80,Math.min(r,a)*(.25+.05*e)),l=s.createRadialGradient(n,i,0,n,i,o),c=0===e?"rgba(232,121,249,0.10)":1===e?"rgba(52,211,153,0.08)":"rgba(251,113,133,0.08)";l.addColorStop(0,c),l.addColorStop(1,"rgba(0,0,0,0)"),s.fillStyle=l,s.beginPath(),s.arc(n,i,o,0,2*Math.PI),s.fill()}for(let e of(s.globalCompositeOperation="source-over",i)){e.tw+=.02+.04*e.z;let t=.4+.35*Math.sin(e.tw)+.3*e.z;e.hue>=0?(s.fillStyle=d[e.hue],s.globalAlpha=Math.max(0,Math.min(1,t)),s.beginPath(),s.arc(e.x,e.y,1.6*e.r,0,2*Math.PI),s.fill(),s.globalAlpha=Math.max(0,Math.min(1,.25*t)),s.beginPath(),s.arc(e.x,e.y,4*e.r,0,2*Math.PI)):(s.fillStyle=`rgba(220,230,255,${Math.max(0,Math.min(1,t))})`,s.beginPath(),s.arc(e.x,e.y,e.r,0,2*Math.PI)),s.fill(),e.y+=.02+.05*e.z,e.y>a+2&&(e.y=-2,e.x=Math.random()*r)}s.globalAlpha=1,.04>Math.random()&&function(){if(o.length>60)return;let e=d[Math.floor(Math.random()*d.length)];o.push({x:Math.random()*r,y:a+10,vx:(Math.random()-.5)*.3,vy:-(.5*Math.random()+.2),life:0,maxLife:600+800*Math.random(),color:e})}(),s.globalCompositeOperation="screen";for(let e=o.length-1;e>=0;e--){let t=o[e];if(t.life+=n,t.x+=t.vx*n*.06,t.y+=t.vy*n*.06,t.life>t.maxLife||t.y<-10){o.splice(e,1);continue}let r=.7*Math.sin(t.life/t.maxLife*Math.PI);s.fillStyle=t.color,s.globalAlpha=r,s.beginPath(),s.arc(t.x,t.y,1.6,0,2*Math.PI),s.fill(),s.globalAlpha=.2*r,s.beginPath(),s.arc(t.x,t.y,5,0,2*Math.PI),s.fill()}s.globalAlpha=1,s.globalCompositeOperation="source-over",l=requestAnimationFrame(e)}),()=>{cancelAnimationFrame(l),h.disconnect()}},[]),(0,N.jsx)("canvas",{ref:t,className:e,"aria-hidden":"true"})}var T=e.i(47167);let C=e=>{let t,s=new Set,r=(e,r)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=r?r:"object"!=typeof a||null===a)?a:Object.assign({},t,a),s.forEach(s=>s(t,e))}},a=()=>t,n={setState:r,getState:a,getInitialState:()=>i,subscribe:e=>(s.add(e),()=>s.delete(e))},i=t=e(r,a,n);return n},P=e=>{let t=e?C(e):C,s=e=>(function(e,t=e=>e){let s=M.default.useSyncExternalStore(e.subscribe,M.default.useCallback(()=>t(e.getState()),[e,t]),M.default.useCallback(()=>t(e.getInitialState()),[e,t]));return M.default.useDebugValue(s),s})(t,e);return Object.assign(s,t),s};function E(e,t){let s;try{s=e()}catch(e){return}return{getItem:e=>{var r;let a=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),n=null!=(r=s.getItem(e))?r:null;return n instanceof Promise?n.then(a):a(n)},setItem:(e,r)=>s.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>s.removeItem(e)}}let _=e=>t=>{try{let s=e(t);if(s instanceof Promise)return s;return{then:e=>_(e)(s),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>_(t)(e)}}},R={crystals:0,insights:0,energy:5,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:8,lastEnergyTick:Date.now(),totalExpeditions:0,bossKills:0,lastExpeditionSummary:null,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},A={1:{crystals:6,insights:1},2:{crystals:22,insights:4},3:{crystals:90,insights:16}},$={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}},D=["emerald","rose","amber","fuchsia"],B={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:"紫"}},I=[{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:"min_4",branch:"mining",level:4,name:"量子采掘矩阵",desc:"晶体/秒 +12,仓库上限 +800",cost:400,effect:{kind:"crystalsPerSec",value:12}},{id:"min_5",branch:"mining",level:5,name:"戴森星核",desc:"晶体/秒 +30,仓库上限 +2000",cost:1200,effect:{kind:"crystalsPerSec",value:30}},{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:"dec_4",branch:"decoding",level:4,name:"谐振放大器",desc:"主动脉冲产出 +8",cost:500,effect:{kind:"pulsePower",value:8}},{id:"dec_5",branch:"decoding",level:5,name:"全息解码核心",desc:"自动解码扩展至 T2 晶体,解码步数 +3",cost:1500,effect:{kind:"decodeSteps",value:3}},{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:"exp_4",branch:"expedition",level:4,name:"虚空航标",desc:"探险力 +12,探险生命 +30,能量恢复 +25%",cost:450,effect:{kind:"crystalCap",value:400}},{id:"exp_5",branch:"expedition",level:5,name:"维度跃迁引擎",desc:"探险力 +25,探险生命 +50,能量恢复 +30%",cost:1400,effect:{kind:"crystalCap",value:600}},{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}},{id:"nar_4",branch:"narrative",level:4,name:"以太低语",desc:"洞见获取 +100%",cost:500,effect:{kind:"insightMult",value:1}},{id:"nar_5",branch:"narrative",level:5,name:"文明回响",desc:"接触进度转化率 +80%,洞见获取 +150%",cost:1600,effect:{kind:"insightMult",value:1.5}}],L={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:"洞见与接触进度"}},O=[{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}],F=.05,z=.03,V=.04;function U(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 W=[{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:"解锁全部 20 项技术",icon:"⬡",color:"#e879f9",check:e=>Object.values(e.tech).filter(e=>e>0).length>=20,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 H(e){let t=0,s=0;for(let r of W)e[r.id]&&(t+=r.reward.crystalsPerSecPct??0,s+=r.reward.insightPct??0);return{crystalsPerSecPct:t,insightPct:s}}let q={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}},K={crystal:22,resonance:20,ruins:16,void:18,core:14,silence:10,surge:12,eclipse:12,prism:12};function X(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 Y(e){let t=X(e);if(!t.silenceInsightPerSec)return 0;let s=(e.endsAt-e.startedAt)/1e3;return Math.round(t.silenceInsightPerSec*s)}let G={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:"全局综合增益"}},J=[{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 Z(e){return J.find(t=>t.id===e)}function Q(e){let t=new Set(e),s={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")&&(s.crystalsPerSecMult+=.2),t.has("c_min_2")&&(s.crystalCapMult+=.5),t.has("c_min_3")&&(s.pulsePowerMult+=.5),t.has("c_dec_1")&&(s.insightMultAdd+=.15),t.has("c_dec_2")&&(s.decodeStepsBonus+=1),t.has("c_dec_3")&&(s.autoDecodeIntervalDeltaSec-=3),t.has("c_exp_1")&&(s.expeditionHpMult+=.25),t.has("c_exp_2")&&(s.expeditionPowerMult+=.2),t.has("c_exp_3")&&(s.energyMaxBonus+=1),t.has("c_con_1")&&(s.contactRateMult+=.2),t.has("c_con_2")&&(s.prestigeContactMinDelta-=10),t.has("c_con_3")&&(s.perBlueprintAllStatsPct+=2),t.has("c_eco_1")&&(s.offlineEffBonus+=.15),t.has("c_eco_2")&&(s.t2t3BonusRate+=.08),t.has("c_eco_3")&&(s.tideGapDeltaSec-=10),t.has("c_cos_1")&&(s.prestigeStartCrystals+=30,s.prestigeStartInsights+=5),t.has("c_cos_2")&&(s.decodeRewardMult+=.1),t.has("c_cos_3")&&(s.allProductionMult+=.08),s}function ee(e,t=Math.random){let s=new Set(e),r=J.filter(e=>!s.has(e.id));if(0===r.length)return[];let a=[...r].sort(()=>t()-.5),n=[],i=new Set;for(let e of a){if(n.length>=3)break;i.has(e.category)||(n.push(e),i.add(e.category))}for(let e of a){if(n.length>=3)break;n.includes(e)||n.push(e)}return n.slice(0,3).map(e=>e.id)}function et(e,t){let s=new Set(e);return J.filter(e=>e.category===t&&s.has(e.id)).length}function es(e){return{unlocked:e.length,total:J.length}}let er=Object.fromEntries(J.map(e=>[e.id,e.name])),ea=Object.fromEntries(Object.entries(q).map(([e,t])=>[`tide_${e}`,t.name])),en=[{prefix:"第一纪元",suffixes:["觉醒之晨","初鸣之夕","晶体降诞","回响初啼"]},{prefix:"第二纪元",suffixes:["谐振潮汐","光谱涌动","深空低语","残响交织"]},{prefix:"第三纪元",suffixes:["遗迹苏醒","星辉汇聚","虚空回望","接触前夜"]},{prefix:"第四纪元",suffixes:["维度折叠","以太共振","星核悸动","飞升之歌"]},{prefix:"第五纪元",suffixes:["终末回响","永恒闭环","超越之境","起源重述"]}],ei=[{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 eo(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=>ea[e]||e).join("、"),perksList:e.perksThisAscension.map(e=>er[e]||e).join("、"),minutes:Math.max(1,Math.round(e.durationSec/60))}}function el(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 ec(e,t,s){for(let r of e.variants)if(r.match(t,s))return el(r.text,s);return el(e.fallback,s)}function ed(e){let t=function(e){let t=(e.ascensionNumber-1)%ei.length,s=ei[t];if(!s)return null;let r=eo(e);return{opening:ec(s.opening,e,r),middle:ec(s.middle,e,r),ending:ec(s.ending,e,r)}}(e);if(t){let s=eo(e);return[t.opening,t.middle,t.ending,`这一周目持续了约 ${s.minutes} 分钟,蓝图累计 ${e.blueprintsAfter} 张,新的周目在等深处的回声。`].join(" ")}let s=Math.max(1,Math.round(e.durationSec/60)),r=[];r.push(`「${e.epochName}」——无人机群在第 ${e.ascensionNumber} 次跨越维度的余烬中重新校准。这一周目持续了约 ${s} 分钟。`);let a=[];if(e.decodedThisRun>0&&a.push(`解码了 ${e.decodedThisRun} 颗记忆晶体`),e.techsThisRun>0&&a.push(`激活了 ${e.techsThisRun} 项新技术`),e.expThisRun>0&&a.push(`完成了 ${e.expThisRun} 次遗迹探险`),e.bossKillsThisRun>0&&a.push(`击破 ${e.bossKillsThisRun} 处维度 BOSS`),a.length>0?r.push(`自治机群${a.join("")},回响在虚空中沉淀。`):r.push(`自治机群在静默中等待,仅完成最基本的脉冲扫描。`),e.newTides.length>0){let t=e.newTides.map(e=>ea[e]||e).join("、");r.push(`本周目经历了 ${e.newTides.length} 次星潮事件(${t}),深空的呼吸塑造了每一个决策。`)}if(e.perksThisAscension.length>0){let t=e.perksThisAscension.map(e=>er[e]||e).join("、");r.push(`飞升之际,星图觉醒「${t}」,铭刻于永恒回响。`)}return e.milestones.length>0&&r.push(`✦ 里程碑:${e.milestones.join("")}。`),r.push(`蓝图累计 ${e.blueprintsAfter} 张,新的周目在等深处的回声。`),r.join(" ")}let eu={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%"]}},eh=["exploration","wisdom","courage","inspiration"];function ef(e){let t=Math.max(0,Math.min(100,e));return t<=50?.005*t:.25+(t-50)*.002}function ep(e){let t=e.exploration??0,s=e.wisdom??0,r=e.courage??0,a=e.inspiration??0;return{expeditionPowerMult:1+ef(t),cruiseShipSpeedMult:1+.6*ef(t),decodeStepsBonus:Math.floor(.1*s),insightMultAdd:ef(s),autoDecodeIntervalMult:1-Math.min(.5,.004*s),expeditionHpBonus:Math.round(2*r),bossWinRateBonus:Math.min(.3,.003*r),cruiseShieldBonus:Math.round(+r),contactRateMult:1+ef(a),tideTriggerBonus:Math.min(.3,.003*a),pulseComboBonus:.005*Math.max(0,Math.min(100,a)),crystalsPerSecMult:1+.4*ef(t)+.2*ef(a)}}function em(e){return Math.max(10,10*Math.max(0,e))}function ex(e,t=100){let{exp:s,level:r}=e,a=!1,n=0,i=0;for(;r<t&&s>=em(r)&&i<200;)s-=em(r),r+=1,a=!0,n+=1,i+=1;return r>=t&&(r=t),{leveledUp:a,levelsGained:n,newProgress:{exp:s,level:r}}}function eg(){return{exploration:{exp:0,level:0},wisdom:{exp:0,level:0},courage:{exp:0,level:0},inspiration:{exp:0,level:0}}}function eb(){return{exploration:0,wisdom:0,courage:0,inspiration:0}}function ey(e){let t,s,r=eb();return t=e.attributes&&"object"==typeof e.attributes?{exploration:ev(e.attributes.exploration),wisdom:ev(e.attributes.wisdom),courage:ev(e.attributes.courage),inspiration:ev(e.attributes.inspiration)}:r,e.attributeProgress&&"object"==typeof e.attributeProgress?(eg(),s={exploration:ew(e.attributeProgress.exploration,t.exploration),wisdom:ew(e.attributeProgress.wisdom,t.wisdom),courage:ew(e.attributeProgress.courage,t.courage),inspiration:ew(e.attributeProgress.inspiration,t.inspiration)}):s={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:s,pendingAttrPoints:"number"==typeof e.pendingAttrPoints&&e.pendingAttrPoints>=0?Math.floor(e.pendingAttrPoints):0}}function ev(e){return Math.max(0,Math.min(100,Math.floor("number"==typeof e&&isFinite(e)?e:0)))}function ew(e,t){if(e&&"object"==typeof e){let s="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:s,level:t}}return{exp:0,level:t}}function ej(e){let t=e.tech??{},s=e.blueprints?.length??0,r=H(e.achievements??{}),a=X(e.activeTide??null),n=Q(e.constellation??[]),i=R.crystalsPerSec,o=R.crystalCap,l=R.pulsePower,c=R.offlineEff,d=R.insightMult,u=1,h=!1,f=0;for(let e of I){let s=t[e.id]??0;if(!s)continue;let r=e.effect;switch(r.kind){case"crystalsPerSec":i+=r.value*s;break;case"crystalCap":o+=r.value*s;break;case"pulsePower":l+=r.value*s;break;case"offlineEff":c=Math.min(1,c+r.value*s);break;case"insightMult":d+=r.value*s;break;case"contactRate":u+=r.value*s;break;case"decodeSteps":f+=r.value*s;break;case"autoDecode":h=s>0}}t.min_2&&(o+=100),t.min_3&&(o+=300),t.min_4&&(o+=800),t.min_5&&(o+=2e3),t.nar_5&&(u+=.8);let p=n.perBlueprintAllStatsPct/100;i*=1+s*(F+p),d*=1+s*(z+p),u*=1+s*(V+p),i*=1+r.crystalsPerSecPct/100,d*=1+r.insightPct/100,i*=n.crystalsPerSecMult*n.allProductionMult,o*=n.crystalCapMult,l*=n.pulsePowerMult*n.allProductionMult,c=Math.min(1,c+n.offlineEffBonus),d+=n.insightMultAdd,u*=n.contactRateMult,f+=n.decodeStepsBonus,d+=a.insightMultAdd,u*=a.contactRateMult;let m=ep(e.attributes??{});return i*=m.crystalsPerSecMult,d+=m.insightMultAdd,{crystalsPerSec:i,crystalCap:o,pulsePower:l,offlineEff:c,insightMult:d,contactRateMult:u*=m.contactRateMult,autoDecode:h,decodeStepsBonus:f+=m.decodeStepsBonus}}function ek(e){return Math.max(0,Math.min(6,Math.floor(e.totalDecoded/20))-e.blueprints.length)}function eN(){return{...R,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 eM(e,t,s){let r=A[e];return{crystals:r.crystals,insights:Math.ceil(r.insights*t),contact:+(.6*e*s).toFixed(2)}}function eS(e,t,s=0){let r,a=$[e],n=t??Math.floor(1e9*Math.random()),i=(r=n>>>0,()=>{r|=0;let e=Math.imul((r=r+0x6d2b79f5|0)^r>>>15,1|r);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}),o=a.targetLen+s,l=a.stepLimitBase+s,c=a.rows,d=a.cols,u=c*d,h=[];for(let e=0;e<o;e++)h.push(D[Math.floor(i()*D.length)]);new Set(h).size<2&&(h[h.length-1]=D[(D.indexOf(h[0])+1)%D.length]);let f=e=>{let t=Math.floor(e/d),s=e%d,r=[];return t>0&&r.push((t-1)*d+s),t<c-1&&r.push((t+1)*d+s),s>0&&r.push(t*d+(s-1)),s<d-1&&r.push(t*d+(s+1)),r},p=null;for(let e=0;e<300&&!p;e++){let e=new Set,t=[],s=Math.floor(i()*u);e.add(s),t.push(s);let r=s,a=!0;for(let s=1;s<h.length;s++){let s=f(r).filter(t=>!e.has(t));if(0===s.length){a=!1;break}r=s[Math.floor(i()*s.length)],e.add(r),t.push(r)}a&&(p=t)}p||(p=Array.from({length:h.length},(e,t)=>t));let m=new Map;p.forEach((e,t)=>m.set(e,h[t]));let x=[];for(let e=0;e<c;e++)for(let t=0;t<d;t++){let s,r=e*d+t;s=m.has(r)?m.get(r):.6>i()?h[Math.floor(i()*h.length)]:D[Math.floor(i()*D.length)],x.push({id:r,row:e,col:t,color:s,used:!1})}return{tier:e,grid:x,rows:c,cols:d,target:h,path:[],stepLimit:l,seed:n}}function eT(e){let t=e.target.slice(e.path.length);if(0===t.length)return!0;let s=new Set(e.path),r=0===e.path.length?e.grid.filter(e=>!s.has(e.id)&&e.color===t[0]).map(e=>e.id):[e.path[e.path.length-1]],a=(r,n)=>{if(n>=t.length)return!0;let i=t[n];for(let t of(t=>{let s=e.grid.find(e=>e.id===t);if(!s)return[];let r=[];return s.row>0&&r.push((s.row-1)*e.cols+s.col),s.row<e.rows-1&&r.push((s.row+1)*e.cols+s.col),s.col>0&&r.push(s.row*e.cols+(s.col-1)),s.col<e.cols-1&&r.push(s.row*e.cols+(s.col+1)),r})(r)){if(s.has(t))continue;let o=e.grid.find(e=>e.id===t);if(o&&o.color===i){if(0===n&&0===e.path.length){let t=e.grid.find(e=>e.id===r);if(!t||t.color!==i)continue}if(s.add(t),a(t,n+1))return!0;s.delete(t)}}return!1};for(let n of r)if(0===e.path.length){let r=e.grid.find(e=>e.id===n);if(!r||r.color!==t[0])continue;if(s.add(n),a(n,1))return!0;s.delete(n)}else if(a(n,0))return!0;return!1}let eC={combat:.3,treasure:.25,choice:.2,puzzle:.1,rest:.15,boss:0},eP={combat:{titles:["守卫残影","虚空巡游者","腐化无人机","以太守门人"],descs:["一道扭曲的残影拦住去路,它是被遗忘的守卫。","虚空巡游者在走廊游荡,感知到了你的存在。","腐化的自治无人机识别为入侵者,启动攻击协议。","以太守门人挡在门前,唯有将其击溃方可通过。"]},treasure:{titles:["遗失货舱","晶体宝库","遗物储藏室","谐振宝箱"],descs:["一扇半开的舱门后,散落着未及带走的晶体。","宝库的能量护盾早已失效,宝藏唾手可得。","储藏室里的容器还亮着微光,里面是珍贵的洞见核心。","一只谐振宝箱静静等候,似乎在等故人归来。"]},choice:{titles:["分岔甬道","低语祭坛","未知装置","回响之井"],descs:["甬道在此分岔,两条路都传来不同的低语。","祭坛上浮动着两团光,你必须选择其一。","未知装置闪烁着两个按钮,你不知道后果。","回响之井倒映出两种可能的未来。"]},puzzle:{titles:["封印之门","谐振锁","记忆机关","维度栅栏"],descs:["一道封印之门需要正确的谐振才能开启。","谐振锁闪烁着复杂的图案,解之有大奖。","记忆机关考验着你的解码技艺。","维度栅栏以谜题为钥,智者得通行。"]},rest:{titles:["休憩节点","能量泉眼","静默之厅","回响营地"],descs:["一处宁静的节点,可在此恢复生命。","能量泉眼涌出暖流,抚慰你的探险队。","静默之厅中,时间仿佛静止,伤痛缓缓消散。","前人留下的营地,尚有补给可用。"]},boss:{titles:["以太回响体","维度守护者","飞升残念","终焉之核"],descs:["路径尽头,以太回响体静静伫立——它是这个遗迹意志的化身。","维度守护者挡在最后,唯有超越它方能触及终焉。","飞升残念凝聚成形,它是以太族离去前留下的最后一道试炼。","终焉之核悬浮于大厅中央,接触它即完成本次探险。"]}};function eE(e,t){return Math.max(.35,Math.min(.95,e/(e+4*t)))}function e_(e,t=Math.random){let s=e.nodes[e.currentNode];if(!s)return{log:"无节点",ended:!0,endReason:"abort"};if(s.cleared){var r;return(r=e).currentNode>=r.nodes.length-1?{log:"探险已完成",ended:!0,endReason:"victory"}:(r.currentNode++,{log:`前进至节点 ${r.currentNode+1}`,ended:!1})}let a=e.power,n=s.difficulty;switch(s.type){case"combat":{let r=eE(a,n);if(t()<r){let e=8+6*n+Math.floor(10*t()),r=1+n+Math.floor(2*t());return s.cleared=!0,{log:`击败「${s.title}」,缴获 ${e} 晶体、${r} 洞见。`,crystals:e,insights:r,ended:!1}}let i=20+10*n+Math.floor(15*t());if(e.hp-i<=0)return s.cleared=!0,{log:`「${s.title}」过于强大,探险队全灭…(生命 -${e.hp}`,hpDelta:-e.hp,ended:!0,endReason:"defeat"};return s.cleared=!0,{log:`「${s.title}」击退了探险队,损失 ${i} 生命,狼狈通过。`,hpDelta:-i,ended:!1}}case"treasure":{let e=10+8*n+Math.floor(15*t()),r=2+n+Math.floor(3*t());return s.cleared=!0,{log:`在「${s.title}」中发现 ${e} 晶体、${r} 洞见。`,crystals:e,insights:r,ended:!1}}case"rest":{let e=15+8*n+Math.floor(10*t());return s.cleared=!0,{log:`在「${s.title}」休整,恢复 ${e} 生命。`,hpDelta:e,ended:!1}}case"puzzle":{let e=Math.min(.9,.4+.01*a);if(t()<e){let e=20+12*n,t=5+3*n,r=1+.5*n;return s.cleared=!0,{log:`解开「${s.title}」,获得 ${e} 晶体、${t} 洞见、${r.toFixed(1)} 接触进度。`,crystals:e,insights:t,contact:r,ended:!1}}return s.cleared=!0,{log:`「${s.title}」未能解开,但探险队平安通过。`,ended:!1}}case"choice":{if(.55>t()){let e=6+5*n+Math.floor(8*t());return s.cleared=!0,{log:`在「${s.title}」做出了明智的选择,获得 ${e} 晶体。`,crystals:e,ended:!1}}let e=8+5*n;return s.cleared=!0,{log:`在「${s.title}」的选择带来了代价,损失 ${e} 生命。`,hpDelta:-e,ended:!1}}case"boss":{let r=eE(a,n),i=t()<r;if(s.cleared=!0,i){let e=60+25*n,t=15+6*n,r=5+1.5*n;return{log:`✦ 击败「${s.title}」!获得 ${e} 晶体、${t} 洞见、${r.toFixed(1)} 接触进度。`,crystals:e,insights:t,contact:r,ended:!0,endReason:"victory"}}return{log:`「${s.title}」的力量超出想象,探险队全军覆没…`,hpDelta:-e.hp,ended:!0,endReason:"defeat"}}}}function eR(e){let t=1;e.tech?.exp_2&&(t*=.7),e.tech?.exp_3&&(t*=.8),e.tech?.exp_4&&(t*=.75),e.tech?.exp_5&&(t*=.7);let s=e.attributes?.exploration??0;return Math.max(8,20*(t*=1-(s>=50?.15+(Math.min(100,s)-50)*.003:.003*s)))}let eA={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:"✶"}},e$={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 eD(e=new Date){let t=e.getUTCFullYear(),s=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0");return`${t}-${s}-${r}`}function eB(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 eI(e=new Date){let t=eD(e),s=function(e){let t=0x811c9dc5;for(let s=0;s<e.length;s++)t^=e.charCodeAt(s),t=Math.imul(t,0x1000193)>>>0;return t>>>0}(t),r=eB(s),a=["decode","expedition","pulse","boss","insight"],n=a[Math.floor(r()*a.length)],i=r(),o=i<.55?"routine":i<.88?"anomaly":"singular",l=eA[o].mult,c=0,d=0,u=0,h="",f="";switch(n){case"decode":d=Math.round(4*(c=Math.round((6+Math.floor(10*r()))*l))*l),u=.8*c,h=`解码 ${c} 颗记忆晶体`,f=`深空信标要求解码 ${c} 颗晶体。谐振风暴期间效率更高。`;break;case"expedition":d=Math.round(12*(c=Math.max(1,Math.round((1+Math.floor(3*r()))*l)))*l),u=1.5*c,h=`完成 ${c} 次遗迹探险`,f=`派出探险队完成 ${c} 次远征,无论胜负均计入。`;break;case"pulse":d=Math.round(1.2*(c=Math.round((20+Math.floor(30*r()))*l))*l),u=.3*c,h=`发起 ${c} 次脉冲扫描`,f=`主动点击晶体发起 ${c} 次脉冲。连击可叠加加成。`;break;case"boss":d=Math.round(30*(c=Math.max(1,Math.round(l)))*l),u=3*c,h=`击破 ${c} 处维度 BOSS`,f=`在探险终点击破 ${c} 处 BOSS。提升探险力后再挑战。`;break;case"insight":c=Math.round((40+Math.floor(80*r()))*l),d=0,u=.1*c,h=`累计获取 ${c} 洞见`,f=`通过解码、探险、星潮等途径累计 ${c} 洞见。`}return{dateKey:t,type:n,difficulty:o,goal:c,rewardInsight:d,rewardContact:u,seed:s,title:h,desc:f}}function eL(e,t,s){let r=Math.min(1,t/e.goal),a=eA[e.difficulty].mult,n=r>=1&&s>0?Math.max(0,500-.5*s):0;return Math.round(1e3*r*a+n)}let eO="echo-nexus-beacon-lb-v1",eF="echo-nexus-beacon-prog-v1";function ez(){if("u"<typeof localStorage)return[];try{let e=localStorage.getItem(eO);if(!e)return[];return JSON.parse(e).sort((e,t)=>t.score-e.score).slice(0,20)}catch{return[]}}function eV(e){let t=ez();t.push(e),t.sort((e,t)=>t.score-e.score);let s=t.slice(0,20);return"u">typeof localStorage&&localStorage.setItem(eO,JSON.stringify(s)),s}function eU(e=new Date){let t=eD(e);if("u"<typeof localStorage)return{dateKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};try{let e=localStorage.getItem(eF);if(!e)return{dateKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};let s=JSON.parse(e);if(s.dateKey!==t)return{dateKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};return s}catch{return{dateKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0}}}function eW(e){"u">typeof localStorage&&localStorage.setItem(eF,JSON.stringify(e))}function eH(e){let t=Math.max(0,Math.floor(e/1e3)),s=String(Math.floor(t/3600)).padStart(2,"0"),r=String(Math.floor(t%3600/60)).padStart(2,"0"),a=String(t%60).padStart(2,"0");return`${s}:${r}:${a}`}let eq="echo-nexus-beacon-weekly-v1";function eK(e=new Date){let t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())),s=(t.getUTCDay()+6)%7;t.setUTCDate(t.getUTCDate()-s+3);let r=t.getUTCFullYear(),a=Date.UTC(r,0,1),n=Math.ceil(((t.getTime()-a)/864e5+1)/7);return`${r}-W${String(n).padStart(2,"0")}`}function eX(e=new Date){let t=eK(e),s=function(e){let t=0x811c9dc5;for(let s=0;s<e.length;s++)t^=e.charCodeAt(s),t=Math.imul(t,0x1000193)>>>0;return t>>>0}(t),r=eB(s),a=["decode","expedition","pulse","boss","insight"],n=a[Math.floor(r()*a.length)],i=.6>r()?"anomaly":"singular",o=eA[i].mult,l=3+Math.floor(3*r()),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*r()))*o*l)))*o),u=1.2*c,h=`周界解码 \xb7 ${c} 颗晶体`,f=`本周深空信标要求解码 ${c} 颗记忆晶体,强度为日挑战的 ${l} 倍。`;break;case"expedition":d=Math.round(14*(c=Math.max(3,Math.round((1+Math.floor(3*r()))*o*l)))*o),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*r()))*o*l)))*o),u=.4*c,h=`周界脉冲 \xb7 ${c} 次扫描`,f=`本周发起 ${c} 次脉冲扫描。连击可叠加加成。`;break;case"boss":d=Math.round(35*(c=Math.max(3,Math.round(l*o)))*o),u=4*c,h=`周界猎杀 \xb7 ${c} 处 BOSS`,f=`本周在探险终点击破 ${c} 处维度 BOSS。提升探险力后再挑战。`;break;case"insight":c=Math.max(120,Math.round((40+Math.floor(80*r()))*o*l)),d=0,u=.15*c,h=`周界洞见 \xb7 ${c} 点`,f=`本周通过解码、探险、星潮等途径累计 ${c} 洞见。`}return{weekKey:t,type:n,difficulty:i,goal:c,rewardInsight:d,rewardContact:u,seed:s,title:h,desc:f}}function eY(e=new Date){let t=eK(e),s={weekKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};if("u"<typeof localStorage)return s;try{let e=localStorage.getItem(eq);if(!e)return s;let r=JSON.parse(e);if(r.weekKey!==t)return s;return r}catch{return s}}function eG(e){"u">typeof localStorage&&localStorage.setItem(eq,JSON.stringify(e))}let eJ="echo-nexus-beacon-chain-v1",eZ=[3,7,14,30],eQ=[{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 e0(){let e=()=>({lastCompletedDateKey:"",currentStreak:0,longestStreak:0,totalCompletions:0,graceUsed:0,milestonesClaimed:[]});if("u"<typeof localStorage)return e();try{let t=localStorage.getItem(eJ);if(!t)return e();let s=JSON.parse(t);return{lastCompletedDateKey:s.lastCompletedDateKey??"",currentStreak:s.currentStreak??0,longestStreak:s.longestStreak??0,totalCompletions:s.totalCompletions??0,graceUsed:s.graceUsed??0,milestonesClaimed:Array.isArray(s.milestonesClaimed)?[...s.milestonesClaimed]:[]}}catch{return e()}}function e1(e){"u">typeof localStorage&&localStorage.setItem(eJ,JSON.stringify(e))}function e2(e){let[t,s,r]=e.split("-").map(Number);return Date.UTC(t,s-1,r,0,0,0)}function e5(e){for(let t of eZ)if(e<t)return t;return null}let e3="echo-nexus-beacon-timed-v1";function e4(e=new Date){let t=e.getUTCFullYear(),s=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0"),a=4*Math.floor(e.getUTCHours()/4);return`timed_${t}-${s}-${r}_${String(a).padStart(2,"0")}`}function e9(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 e7(e=new Date){let t=e4(e),s=function(e){let t=0x811c9dc5;for(let s=0;s<e.length;s++)t^=e.charCodeAt(s),t=Math.imul(t,0x1000193)>>>0;return t>>>0}(t),r=eB(s),a=function(e){let t=e.match(/^timed_(\d{4})-(\d{2})-(\d{2})_(\d{2})$/);if(!t)return Date.now();let[,s,r,a,n]=t;return Date.UTC(Number(s),Number(r)-1,Number(a),Number(n),0,0)}(t)+144e5,n=["decode","expedition","pulse","boss","insight"],i=n[Math.floor(r()*n.length)],o="routine",l=eA[o].mult,c=.3+.2*r(),d=0,u=0,h=0,f="",p="";switch(i){case"decode":u=Math.round(3*(d=Math.max(2,Math.round((6+Math.floor(10*r()))*l*c)))*l),h=.6*d,f=`限时解码 ${d} 颗晶体`,p=`4 小时内解码 ${d} 颗记忆晶体。短周期,快速完成。`;break;case"expedition":u=Math.round(9*(d=Math.max(1,Math.round((1+Math.floor(3*r()))*l*c)))*l),h=1.2*d,f=`限时远征 ${d} 次探险`,p=`4 小时内完成 ${d} 次遗迹探险。`;break;case"pulse":u=Math.round((d=Math.max(6,Math.round((20+Math.floor(30*r()))*l*c)))*l),h=.25*d,f=`限时脉冲 ${d} 次扫描`,p=`4 小时内发起 ${d} 次脉冲扫描。`;break;case"boss":u=Math.round(25*(d=Math.max(1,Math.round(l*c)))*l),h=2.5*d,f=`限时猎杀 ${d} 处 BOSS`,p=`4 小时内击破 ${d} 处维度 BOSS。`;break;case"insight":d=Math.max(12,Math.round((40+Math.floor(80*r()))*l*c)),u=0,h=.08*d,f=`限时洞见 ${d} 点`,p=`4 小时内累计获取 ${d} 洞见。`}return{slotKey:t,type:i,difficulty:o,goal:d,rewardInsight:u,rewardContact:h,seed:s,title:f,desc:p,expiresAt:a}}function e6(e=new Date){let t=e4(e),s={slotKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};if("u"<typeof localStorage)return s;try{let e=localStorage.getItem(e3);if(!e)return s;let r=JSON.parse(e);if(r.slotKey!==t)return s;return r}catch{return s}}function e8(e){"u">typeof localStorage&&localStorage.setItem(e3,JSON.stringify(e))}let te="echo-nexus-beacon-cloud-last-submit-v1",tt="/api/leaderboard?XTransformPort=3030";function ts(){if("u"<typeof localStorage)return 0;try{let e=localStorage.getItem(te);return e&&Number(e)||0}catch{return 0}}async function tr(){try{let e=await fetch(tt,{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 ta(e){try{let t=await fetch(tt,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({entry:e})});if(!t.ok)return -1;let s=await t.json();return s&&"number"==typeof s.rank&&s.rank>=1&&function(e){if("u">typeof localStorage)try{localStorage.setItem(te,String(e))}catch{}}(e.timestamp),s?.rank??-1}catch{return -1}}let tn=null;function ti(){let e=tn;return tn=null,e}function to(e){let t=ej(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 tl(e,t){let s={dailyJustCompleted:!1,timedJustCompleted:!1,weeklyJustCompleted:!1,newChainMilestones:[]};try{let r=eI();if(r.type===e){let e=eU();if(null===e.completedAt){let a,n,i,o,l,{justCompleted:c}=(a=Math.min(r.goal,e.progress+t),i=(n=null===e.completedAt&&a>=r.goal)?Date.now():e.completedAt,o=null!==i?Math.floor((i-e.startedAt)/1e3):e.durationSec,l={...e,progress:a,completedAt:i,durationSec:o},eW(l),{progress:l,justCompleted:n});if(s.dailyJustCompleted=c,c){let{newMilestones:e}=function(e){let t,s=e0();if(s.lastCompletedDateKey===e)return{state:s,newMilestones:[]};if(""===s.lastCompletedDateKey)t={...s,lastCompletedDateKey:e,currentStreak:1,longestStreak:Math.max(s.longestStreak,1),totalCompletions:s.totalCompletions+1};else{var r;let a=(r=s.lastCompletedDateKey,r&&e?Math.round((e2(e)-e2(r))/864e5):Number.MAX_SAFE_INTEGER);if(1===a){let r=s.currentStreak+1;t={...s,lastCompletedDateKey:e,currentStreak:r,longestStreak:Math.max(s.longestStreak,r),totalCompletions:s.totalCompletions+1}}else if(2===a&&s.graceUsed<1){let r=s.currentStreak+1;t={...s,lastCompletedDateKey:e,currentStreak:r,longestStreak:Math.max(s.longestStreak,r),totalCompletions:s.totalCompletions+1,graceUsed:s.graceUsed+1}}else t={...s,lastCompletedDateKey:e,currentStreak:1,totalCompletions:s.totalCompletions+1,graceUsed:0,longestStreak:Math.max(s.longestStreak,1)}}let a=[];for(let e of eZ)t.currentStreak>=e&&!t.milestonesClaimed.includes(e)&&a.push(e);return e1(t),{state:t,newMilestones:a}}(eD());s.newChainMilestones=e}}}let a=e7();if(a.type===e){let e=e6();if(null===e.completedAt){let r,n,i,o,l,{justCompleted:c}=(r=Math.min(a.goal,e.progress+t),i=(n=null===e.completedAt&&r>=a.goal)?Date.now():e.completedAt,o=null!==i?Math.floor((i-e.startedAt)/1e3):e.durationSec,l={...e,progress:r,completedAt:i,durationSec:o},e8(l),{progress:l,justCompleted:n});s.timedJustCompleted=c}}let n=eX();if(n.type===e){let e=eY();if(null===e.completedAt){let r,a,i,o,l,{justCompleted:c}=(r=Math.min(n.goal,e.progress+t),i=(a=null===e.completedAt&&r>=n.goal)?Date.now():e.completedAt,o=null!==i?Math.floor((i-e.startedAt)/1e3):e.durationSec,l={...e,progress:r,completedAt:i,durationSec:o},eG(l),{progress:l,justCompleted:a});s.weeklyJustCompleted=c}}return s}catch{return s}}function tc(e){let t=[];for(let s of O)!e.fragments[s.id]&&e.totalDecoded>=s.threshold&&(e.fragments[s.id]=!0,t.push(s.id));return t}let td=(a?P(a):P)((n=(e,t)=>({...eN(),_lastAutoDecode:Date.now(),_lastSpawn:Date.now(),_combo:0,_lastPulse:0,_achievementQueue:[],_tideEvents:[],globalTide:null,init:()=>{let s=t(),r=Date.now(),a=s.activePuzzle;if(a&&!eT(a)){let t={id:`c_${r}_rec`,tier:a.tier,value:A[a.tier].crystals,createdAt:r};a=null,e({pendingCrystals:[...s.pendingCrystals,t].slice(-6)})}let n=s.achievements??{},i=s.activeTide??null,o=s.constellation??[],l=s.pendingPerkChoices??null,c={chronicle:Array.isArray(s.chronicle)?s.chronicle:[],runStart:s.runStart||{timestamp:s.createdAt||Date.now(),techsUnlocked:Object.keys(s.tech||{}).length,expeditionsCompleted:s.totalExpeditions||0,bossKills:s.bossKills||0,starTidesEncountered:[...s.starTidesEncountered||[]],crystalsDecoded:s.totalDecoded||0},bossKills:"number"==typeof s.bossKills?s.bossKills:0,starTidesEncountered:Array.isArray(s.starTidesEncountered)?s.starTidesEncountered:[]},d=ey(s),u=Q(o),h=R.energyMax+u.energyMaxBonus,f=s.lastTideEnd??0,p=i&&i.endsAt>r?i:null,m=Math.max(0,(r-s.lastTick)/1e3);if(m>5){let t=Math.min(m,28800),i=s.crystalsPerSec*t*s.offlineEff,u=s.crystals,x=Math.min(s.crystalCap,s.crystals+i);tn={elapsedSec:t,rawElapsedSec:m,gain:x-u,rate:s.crystalsPerSec,eff:s.offlineEff,capped:m>28800,crystalsBefore:u,crystalsAfter:x,crystalCap:s.crystalCap},window.dispatchEvent(new CustomEvent("echo-nexus-offline-report")),e({crystals:x,lastTick:r,activePuzzle:a,achievements:n,activeTide:p,lastTideEnd:f,constellation:o,pendingPerkChoices:l,energyMax:h,chronicle:c.chronicle,runStart:c.runStart,bossKills:c.bossKills,starTidesEncountered:c.starTidesEncountered,attributes:d.attributes,attributeProgress:d.attributeProgress,pendingAttrPoints:d.pendingAttrPoints,...to({tech:s.tech,blueprints:s.blueprints,achievements:n,activeTide:p,constellation:o,attributes:d.attributes})})}else e({lastTick:r,activePuzzle:a,achievements:n,activeTide:p,lastTideEnd:f,constellation:o,pendingPerkChoices:l,energyMax:h,chronicle:c.chronicle,runStart:c.runStart,bossKills:c.bossKills,starTidesEncountered:c.starTidesEncountered,attributes:d.attributes,attributeProgress:d.attributeProgress,pendingAttrPoints:d.pendingAttrPoints,...to({tech:s.tech,blueprints:s.blueprints,achievements:n,activeTide:p,constellation:o,attributes:d.attributes})})},loadOnline:()=>{let s=t();e({...to({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:s.activeTide,constellation:s.constellation,attributes:s.attributes})})},hardReset:()=>{e({...eN(),_lastAutoDecode:Date.now(),_lastSpawn:Date.now(),_combo:0,_lastPulse:0,_achievementQueue:[],_tideEvents:[],globalTide:null})},tickTide:s=>{let r=t();if(r.globalTide){if(s>=r.globalTide.endsAt){let t=r.globalTide.type,a=0;"silence"===t&&(a=Y({type:t,startedAt:r.globalTide.startedAt,endsAt:r.globalTide.endsAt,id:r.globalTide.id}));let n={ended:t,isGlobal:!0};return a>0&&(n.silenceCompensation=a),e({globalTide:null,activeTide:null,lastTideEnd:s,insights:r.insights+a,...to({tech:r.tech,blueprints:r.blueprints,achievements:r.achievements,activeTide:null,constellation:r.constellation,attributes:r.attributes}),_tideEvents:[...r._tideEvents,n]}),n}return null}let a=r.activeTide,n=Q(r.constellation??[]),i=Math.min(.3,ep(r.attributes??{}).tideTriggerBonus),o=Math.max(15e3,(4e4+1e3*n.tideGapDeltaSec)*(1-i));if(a&&s>=a.endsAt){let t=a.type,n=0;"silence"===a.type&&(n=Y(a));let i=r.insights+n,o={ended:t};return n>0&&(o.silenceCompensation=n),e({activeTide:null,lastTideEnd:s,insights:i,...to({tech:r.tech,blueprints:r.blueprints,achievements:r.achievements,activeTide:null,constellation:r.constellation,attributes:r.attributes}),_tideEvents:[...r._tideEvents,o]}),o}if(!a&&s-r.lastTideEnd>=(0===r.lastTideEnd||r.lastTideEnd<=r.createdAt+1e3?3e4:o)){let t=function(e=Math.random){let t=Object.values(K).reduce((e,t)=>e+t,0),s=e()*t;for(let e of Object.keys(K))if((s-=K[e])<=0)return e;return"crystal"}(),a={id:`tide_${s}_${Math.random().toString(36).slice(2,7)}`,type:t,startedAt:s,endsAt:s+75e3},n={started:t},i=r.starTidesEncountered??[],o=`tide_${t}`;return e({activeTide:a,starTidesEncountered:i.includes(o)?i:[...i,o],...to({tech:r.tech,blueprints:r.blueprints,achievements:r.achievements,activeTide:a,constellation:r.constellation,attributes:r.attributes}),_tideEvents:[...r._tideEvents,n]}),n}return null},consumeTideEvents:()=>{let s=t();if(0===s._tideEvents.length)return[];let r=s._tideEvents;return e({_tideEvents:[]}),r},triggerGlobalTide:s=>{let r=t(),a=Date.now(),n=`global_tide_${a}_${Math.random().toString(36).slice(2,7)}`,i={id:n,type:s,startedAt:a,endsAt:a+6e4},o=r.starTidesEncountered??[],l=`tide_${s}`;e({globalTide:{type:s,startedAt:a,endsAt:a+6e4,id:n},activeTide:i,starTidesEncountered:o.includes(l)?o:[...o,l],...to({tech:r.tech,blueprints:r.blueprints,achievements:r.achievements,activeTide:i,constellation:r.constellation,attributes:r.attributes}),_tideEvents:[...r._tideEvents,{started:s,isGlobal:!0}]})},tick:s=>{let r=t(),a=Math.max(0,(s-r.lastTick)/1e3);if(a<=0)return;let n=X(r.activeTide),i=r.crystalsPerSec*n.crystalsPerSecMult,o=r.crystals>=r.crystalCap?r.crystals:Math.min(r.crystalCap,r.crystals+i*a),l=1+.03*r.blueprints.length,c=r.pendingCrystals,d=r._lastSpawn;if(s-d>8/l*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 s=t(),r=Math.min(.5,e),a=.7-.7*r;return s<a?1:s<a+(.25+.25*r*.7)?2:3}(Q(r.constellation??[]).t2t3BonusRate);c=[...c,{id:`c_${s}_${Math.random().toString(36).slice(2,7)}`,tier:e,value:A[e].crystals,createdAt:s}],d=s}let u=r.energy,h=r.lastEnergyTick;if(u<r.energyMax){let e=eR(r),t=function(e,t,s,r,a=20){let n=1e3*a,i=Math.floor((t-e)/n);return i<=0?{energy:s,lastTick:e}:{energy:Math.min(r,s+i),lastTick:e+i*n}}(h,s,u,r.energyMax,e);u=t.energy,h=t.lastTick}else h=s;e({crystals:o,lastTick:s,pendingCrystals:c,_lastSpawn:d,energy:u,lastEnergyTick:h})},pulse:()=>{let s=t(),r=Date.now(),a=1;r-s._lastPulse<1500&&(a=Math.min(10,s._combo+1));let n=1+(a-1)*.15,i=X(s.activeTide),o=1+ep(s.attributes??{}).pulseComboBonus*Math.max(0,a-1),l=s.pulsePower*n*i.pulsePowerMult*o;if(e({crystals:Math.min(s.crystalCap,s.crystals+l),_combo:a,_lastPulse:r}),tl("pulse",1),a>=3){let t=1+Math.floor(a/2),r=ex({exp:(s.attributeProgress?.inspiration??{exp:0,level:s.attributes?.inspiration??0}).exp+t,level:s.attributes?.inspiration??0},100),n={...s.attributes??eb(),inspiration:r.newProgress.level};e({attributes:n,attributeProgress:{...s.attributeProgress??eg(),inspiration:r.newProgress},...to({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:s.activeTide,constellation:s.constellation,attributes:n})})}return{gain:l,combo:a}},startDecode:s=>{let r=t(),a=r.pendingCrystals.find(e=>e.id===s);if(!a)return;let n=X(r.activeTide).targetLenBonus??0;e({activePuzzle:eS(a.tier,void 0,n),pendingCrystals:r.pendingCrystals.filter(e=>e.id!==s)})},clickNode:s=>{let r=t();if(!r.activePuzzle)return{ok:!1,finished:!1,failReason:"无活跃谜题"};let a=JSON.parse(JSON.stringify(r.activePuzzle)),n=function(e,t){let s=e.grid.find(e=>e.id===t);if(!s)return{ok:!1,finished:!1,failReason:"无效节点"};if(s.used)return{ok:!1,finished:!1,failReason:"节点已使用"};let r=e.path.length;if(s.color!==e.target[r])return{ok:!1,finished:!1,failReason:"谐振不匹配"};if(r>0){var a;if(a=e.grid.find(t=>t.id===e.path[r-1]),Math.abs(a.row-s.row)+Math.abs(a.col-s.col)!==1)return{ok:!1,finished:!1,failReason:"节点不相邻"}}return r>=e.stepLimit?{ok:!1,finished:!1,failReason:"步数耗尽"}:(s.used=!0,e.path.push(t),{ok:!0,finished:e.path.length>=e.target.length})}(a,s);if(n.ok){if(n.finished){let t=X(r.activeTide),s=Q(r.constellation??[]),n=eM(a.tier,r.insightMult,r.contactRateMult),i=t.decodeRewardMult*s.decodeRewardMult,o={crystals:Math.round(n.crystals*i),insights:Math.round(n.insights*i),contact:+(n.contact*i).toFixed(2)},l=r.totalDecoded+1,c=Math.min(100,r.contact+o.contact),d=r.insights+o.insights,u=r.crystals+o.crystals,h={...r,totalDecoded:l,fragments:{...r.fragments}},f=tc(h),p=2*a.tier,m=r.attributes??eb(),x=r.attributeProgress??eg(),g=ex({exp:(x.wisdom??{exp:0,level:m.wisdom}).exp+p,level:m.wisdom},100),b={...m,wisdom:g.newProgress.level},y={...x,wisdom:g.newProgress};return e({activePuzzle:null,crystals:u,insights:d,contact:c,totalDecoded:l,fragments:h.fragments,attributes:b,attributeProgress:y,...to({tech:r.tech,blueprints:r.blueprints,achievements:r.achievements,activeTide:r.activeTide,constellation:r.constellation,attributes:b})}),tl("decode",1),tl("insight",o.insights),{ok:!0,finished:!0,failReason:f.join(",")||void 0}}let t=eT(a);return e({activePuzzle:a}),{ok:!0,finished:!1,solvable:t}}return n},undoStep:()=>{let s=t();if(!s.activePuzzle||0===s.activePuzzle.path.length)return;let r=JSON.parse(JSON.stringify(s.activePuzzle)),a=r.path.pop();if(void 0!==a){let e=r.grid.find(e=>e.id===a);e&&(e.used=!1)}e({activePuzzle:r})},retryPuzzle:()=>{let s=t();if(s.activePuzzle){var r;e({activePuzzle:eS((r=s.activePuzzle).tier,r.seed+1)})}},abandonPuzzle:()=>{let s=t();if(!s.activePuzzle)return;let r={id:`c_${Date.now()}_ret`,tier:s.activePuzzle.tier,value:A[s.activePuzzle.tier].crystals,createdAt:Date.now()};e({activePuzzle:null,pendingCrystals:[...s.pendingCrystals,r].slice(-6)})},autoDecodeTick:()=>{let s=t();if(!s.autoDecode)return;let r=Date.now(),a=Q(s.constellation??[]),n=ep(s.attributes??{}),i=12e3+1e3*a.autoDecodeIntervalDeltaSec,o=X(s.activeTide).autoDecodeIntervalMult??1,l=Math.max(5e3,i*n.autoDecodeIntervalMult*o);if(r-s._lastAutoDecode<l)return;let c=1,d=s.pendingCrystals.findIndex(e=>1===e.tier);if(d<0&&s.tech?.dec_5&&(d=s.pendingCrystals.findIndex(e=>2===e.tier),c=2),d<0)return;let u=s.pendingCrystals[d],h=X(s.activeTide),f=eM(c,s.insightMult,s.contactRateMult),p=h.decodeRewardMult*a.decodeRewardMult,m={crystals:Math.round(f.crystals*p),insights:Math.round(f.insights*p),contact:+(f.contact*p).toFixed(2)},x=s.totalDecoded+1,g={...s,totalDecoded:x,fragments:{...s.fragments}};tc(g);let b=s.attributes??eb(),y=s.attributeProgress??eg(),v=ex({exp:(y.wisdom??{exp:0,level:b.wisdom}).exp+1,level:b.wisdom},100),w={...b,wisdom:v.newProgress.level},j={...y,wisdom:v.newProgress};e({pendingCrystals:s.pendingCrystals.filter(e=>e.id!==u.id),crystals:s.crystals+m.crystals,insights:s.insights+m.insights,contact:Math.min(100,s.contact+m.contact),totalDecoded:x,fragments:g.fragments,_lastAutoDecode:r,attributes:w,attributeProgress:j,...to({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:s.activeTide,constellation:s.constellation,attributes:w})}),tl("decode",1),tl("insight",m.insights)},buyTech:s=>{let r=t(),a=I.find(e=>e.id===s);if(!a||(r.tech[s]??0)>=1||r.insights<a.cost)return!1;let n={...r.tech,[s]:1};return e({insights:r.insights-a.cost,tech:n,...to({tech:n,blueprints:r.blueprints,achievements:r.achievements,activeTide:r.activeTide,constellation:r.constellation,attributes:r.attributes})}),!0},startExpedition:()=>{let s,r,a,n,i=t();if(i.activeExpedition&&!i.activeExpedition.finished)return{ok:!1,reason:"已有进行中的探险"};if(i.energy<1)return{ok:!1,reason:"能量不足"};let o=X(i.activeTide),l=ep(i.attributes??{}),c=(s=10,r=i.tech?.exp_1??0,a=i.tech?.exp_2??0,n=i.tech?.exp_3??0,s+=3*r+5*a+8*n+12*(i.tech?.exp_4??0)+25*(i.tech?.exp_5??0),Math.round(s*=(1+(i.blueprints?.length??0)*.08)*(1+(i.ascensions??0)*.15)*Q(i.constellation??[]).expeditionPowerMult)+o.expeditionPowerBonus),d=Math.round((100+(i.tech?.exp_2??0)*20+(i.tech?.exp_4??0)*30+(i.tech?.exp_5??0)*50+(i.ascensions??0)*10)*Q(i.constellation??[]).expeditionHpMult)+o.expeditionHpBonus;return e({activeExpedition:function(e,t,s){let r,a=(r=e>>>0,()=>{r|=0;let e=Math.imul((r=r+0x6d2b79f5|0)^r>>>15,1|r);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}),n=5+Math.floor(3*a()),i=[];for(let e=0;e<n;e++){let t=e===n-1,s=t?"boss":function(e){let t=Object.keys(eC),s=t.reduce((e,t)=>e+eC[t],0),r=e()*s;for(let e of t)if((r-=eC[e])<=0)return e;return"combat"}(a),r=eP[s],o=Math.floor(a()*r.titles.length);i.push({id:e,type:s,title:r.titles[o],desc:r.descs[o],cleared:!1,difficulty:t?3+Math.floor(3*a()):1+Math.floor(4*a()),position:e})}if("combat"===i[0].type||"boss"===i[0].type){i[0].type=.5>a()?"treasure":"rest";let e=eP[i[0].type];i[0].title=e.titles[0],i[0].desc=e.descs[0],i[0].difficulty=1}return{id:`exp_${e}_${Date.now()}`,nodes:i,currentNode:0,finished:!1,rewards:{crystals:0,insights:0,contact:0,fragments:[]},power:t,hp:s,maxHp:s,seed:e,startedAt:Date.now()}}(Math.floor(1e9*Math.random()),Math.round(c*l.expeditionPowerMult),d+l.expeditionHpBonus),energy:i.energy-1,totalExpeditions:i.totalExpeditions+1}),{ok:!0}},resolveCurrentNode:()=>{let s=t();if(!s.activeExpedition||s.activeExpedition.finished)return null;let r=JSON.parse(JSON.stringify(s.activeExpedition)),a=r.nodes[r.currentNode],n=a?.type==="boss",i=ep(s.attributes??{}),o=X(s.activeTide).bossWinRateBonus??0,l=n?e_(r,()=>{let e=Math.random(),t=Math.min(.95,i.bossWinRateBonus+o);return e<t?0:Math.min(1,e-t)}):e_(r);l.crystals&&(r.rewards.crystals+=l.crystals),l.insights&&(r.rewards.insights+=l.insights),l.contact&&(r.rewards.contact+=l.contact),l.fragments&&r.rewards.fragments.push(...l.fragments),l.hpDelta&&(r.hp=Math.max(0,Math.min(r.maxHp,r.hp+l.hpDelta)));let c=s.crystals+(l.crystals||0),d=s.insights+(l.insights||0),u=Math.min(100,s.contact+(l.contact||0)),h={...s.fragments};if(l.fragments)for(let e of l.fragments)h[e]=!0;let f=[{expeditionId:r.id,nodeType:a?.type||"combat",result:l.log,rewards:[l.crystals?`+${l.crystals}晶体`:"",l.insights?`+${l.insights}洞见`:"",l.contact?`+${l.contact.toFixed(1)}接触`:"",l.hpDelta?`${l.hpDelta>0?"+":""}${l.hpDelta}生命`:""].filter(Boolean).join(" "),timestamp:Date.now()},...s.expeditionLog].slice(0,30);l.ended&&(r.finished=!0);let p=s.lastExpeditionSummary??null;l.ended&&("victory"===l.endReason||"defeat"===l.endReason)&&(p={result:l.endReason,rewards:{...r.rewards},nodeCount:r.nodes.length,finishedAt:Date.now()});let m=s.bossKills??0,x=!1;l.ended&&"victory"===l.endReason&&a?.type==="boss"&&(m+=1,x=!0);let g=s.attributes??eb(),b=s.attributeProgress??eg(),y=!1,v=(a?.type==="combat"||a?.type==="boss")&&!l.ended,w=l.ended&&"victory"===l.endReason;if(v||x||w){let e=x?8:2,t=x?6:w?4:1,s=ex({exp:b.courage.exp+e,level:g.courage},100),r=ex({exp:b.exploration.exp+t,level:g.exploration},100);g={...g,courage:s.newProgress.level,exploration:r.newProgress.level},b={...b,courage:s.newProgress,exploration:r.newProgress},y=!0}return e({activeExpedition:r,crystals:c,insights:d,contact:u,fragments:h,expeditionLog:f,bossKills:m,attributes:g,attributeProgress:b,lastExpeditionSummary:p,...y?to({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:s.activeTide,constellation:s.constellation,attributes:g}):{}}),l.ended&&(tl("expedition",1),x&&tl("boss",1)),l.insights&&tl("insight",l.insights),l},advanceNode:()=>{let s=t();if(!s.activeExpedition||s.activeExpedition.finished)return;let r=JSON.parse(JSON.stringify(s.activeExpedition)),a=r.nodes[r.currentNode];a&&a.cleared&&(r.currentNode>=r.nodes.length-1||(r.currentNode++,e({activeExpedition:r})))},abortExpedition:()=>{let s=t();if(!s.activeExpedition)return;let r=JSON.parse(JSON.stringify(s.activeExpedition));r.finished=!0;let a={expeditionId:r.id,nodeType:"rest",result:"探险队主动撤退,保留已获奖励。",rewards:"",timestamp:Date.now()},n={result:"abort",rewards:{...r.rewards},nodeCount:r.nodes.length,finishedAt:Date.now()};e({activeExpedition:r,expeditionLog:[a,...s.expeditionLog].slice(0,30),lastExpeditionSummary:n})},dismissExpedition:()=>{let s=t();s.activeExpedition&&s.activeExpedition.finished&&e({activeExpedition:null})},doPrestige:()=>{let s,r,a,n,i,o,l,c,d,u,h,f,p,m,x=t();if(x.contact<100)return null;let g=ek(x),b=(s=ek(x),r=[...x.blueprints,...Array.from({length:s},(e,t)=>`bp_${Date.now()}_${t}`)].slice(0,6),a=ee(x.constellation??[]),n=Q(x.constellation??[]),i=function(e,t=[]){let s,r,a,n,i,o,l=e.ascensions+1,c=(s=Date.now(),{durationSec:Math.max(1,Math.floor((s-(r=e.runStart).timestamp)/1e3)),techsThisRun:Math.max(0,Object.keys(e.tech||{}).length-r.techsUnlocked),expThisRun:Math.max(0,e.totalExpeditions-r.expeditionsCompleted),bossKillsThisRun:Math.max(0,e.bossKills-r.bossKills),decodedThisRun:Math.max(0,e.totalDecoded-r.crystalsDecoded),newTides:(e.starTidesEncountered||[]).filter(e=>!(r.starTidesEncountered||[]).includes(e))}),d=e.createdAt+7919*l>>>0,u=(a=(l-1)%en.length,i=d%(n=en[a]).suffixes.length,`${n.prefix} \xb7 ${n.suffixes[i]}`),h=(o=[],1===e.ascensions+1&&o.push("首次飞升"),c.expThisRun>0&&0===e.runStart.expeditionsCompleted&&o.push("首次完成遗迹探险"),c.bossKillsThisRun>0&&o.push("首杀维度 BOSS"),c.decodedThisRun>=10&&o.push(`单周目解码 ${c.decodedThisRun} 颗`),c.decodedThisRun>=30&&o.push(`单周目解码 ${c.decodedThisRun} 颗`),c.techsThisRun>=5&&o.push("技术狂人"),c.newTides.length>=3&&o.push("星潮亲历者"),(e.constellation?.length||0)>=6&&o.push("星图六分"),(e.constellation?.length||0)>=12&&o.push("星图十二宫"),o),f=Math.min(e.blueprints.length+1,6),p=ed({ascensionNumber:l,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:l,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:p,milestones:h}}(x,[]),o=[...x.chronicle||[],i].slice(-200),l={timestamp:Date.now(),techsUnlocked:Object.keys(x.tech||{}).length,expeditionsCompleted:x.totalExpeditions,bossKills:x.bossKills,starTidesEncountered:[...x.starTidesEncountered||[]],crystalsDecoded:x.totalDecoded},d=(c=ey(x)).attributes,u=eg(),h=2*(x.ascensions??0)+1,f=c.pendingAttrPoints+h,p=eN(),m=ej({tech:{},blueprints:r,achievements:x.achievements,constellation:x.constellation,attributes:d}),{...p,fragments:x.fragments,totalDecoded:x.totalDecoded,ascensions:x.ascensions+1,blueprints:r,achievements:x.achievements,constellation:x.constellation,pendingPerkChoices:a.length>0?a: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:o,runStart:l,activeTide:null,lastTideEnd:Date.now(),attributes:d,attributeProgress:u,pendingAttrPoints:f,...m}),y=Q(b.constellation??[]),v=R.energyMax+y.energyMaxBonus;return e({...b,energyMax:v,...to({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:s=>{let r=t();if(!r.pendingPerkChoices||!r.pendingPerkChoices.includes(s)||!Z(s)||r.constellation?.includes(s))return!1;let a=[...r.constellation??[],s],n=Q(a),i=R.energyMax+n.energyMaxBonus,o=r.chronicle??[],l=o;if(o.length>0){let e=function(e,t){if(e.perksThisAscension.length===t.length&&e.perksThisAscension.every((e,s)=>e===t[s]))return e;let s=ed({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:s}}(o[o.length-1],[s]);l=[...o.slice(0,-1),e]}return e({constellation:a,pendingPerkChoices:null,energyMax:i,chronicle:l,...to({tech:r.tech,blueprints:r.blueprints,achievements:r.achievements,activeTide:r.activeTide,constellation:a,attributes:r.attributes})}),!0},rerollPerkChoices:()=>{let s=t();if(!s.pendingPerkChoices)return;let r=ee(s.constellation??[]);r.length>0&&e({pendingPerkChoices:r})},checkAchievements:()=>{let s=t(),r=[],a={...s.achievements},n=s.crystals,i=s.insights,o=s.contact,l=!1;for(let e of W)!a[e.id]&&e.check(s)&&(a[e.id]=!0,r.push(e),e.reward.crystals&&(n+=e.reward.crystals),e.reward.insights&&(i+=e.reward.insights),e.reward.contact&&(o=Math.min(100,o+e.reward.contact)),(e.reward.crystalsPerSecPct||e.reward.insightPct)&&(l=!0));return 0===r.length?[]:(e({achievements:a,crystals:n,insights:i,contact:o,...l?to({tech:s.tech,blueprints:s.blueprints,achievements:a,activeTide:s.activeTide,constellation:s.constellation,attributes:s.attributes}):{},_achievementQueue:[...s._achievementQueue,...r]}),r)},consumeAchievementQueue:()=>{let s=t();if(0===s._achievementQueue.length)return[];let r=s._achievementQueue;return e({_achievementQueue:[]}),r},canPrestige:()=>t().contact>=100,toggleTheme:()=>e({theme:"dark"===t().theme?"light":"dark"}),toggleSound:()=>e({soundOn:!t().soundOn}),grantBeaconReward:(s,r)=>{let a=t();e({insights:a.insights+Math.round(s),contact:Math.min(100,a.contact+r)})},claimWeeklyBeacon:()=>{let s=function(e,t){if(t.claimed||null===t.completedAt)return{rewardInsight:0,rewardContact:0,score:0,leaderboard:ez()};let s=eL({...e,dateKey:e.weekKey},t.progress,t.durationSec),r={timestamp:Date.now(),dateKey:e.weekKey,challenge:e.type,difficulty:e.difficulty,progress:t.progress/e.goal,score:s,durationSec:t.durationSec,isWeekly:!0},a=eV(r);return eG({...t,claimed:!0}),{rewardInsight:e.rewardInsight,rewardContact:e.rewardContact,score:s,leaderboard:a,entry:r}}(eX(),eY());if(s.rewardInsight>0||s.rewardContact>0){let r=t();e({insights:r.insights+Math.round(s.rewardInsight),contact:Math.min(100,r.contact+s.rewardContact)}),s.entry&&ta(s.entry)}return{rewardInsight:s.rewardInsight,rewardContact:s.rewardContact,score:s.score}},claimTimedBeacon:()=>{let s=function(e,t){if(t.claimed||null===t.completedAt)return{rewardInsight:0,rewardContact:0,score:0,leaderboard:ez()};let s=eL({...e,dateKey:e.slotKey},t.progress,t.durationSec),r={timestamp:Date.now(),dateKey:e.slotKey,challenge:e.type,difficulty:e.difficulty,progress:t.progress/e.goal,score:s,durationSec:t.durationSec,isTimed:!0},a=eV(r);return e8({...t,claimed:!0}),{rewardInsight:e.rewardInsight,rewardContact:e.rewardContact,score:s,leaderboard:a,entry:r}}(e7(),e6());if(s.rewardInsight>0||s.rewardContact>0){let r=t();e({insights:r.insights+Math.round(s.rewardInsight),contact:Math.min(100,r.contact+s.rewardContact)}),s.entry&&ta(s.entry)}return{rewardInsight:s.rewardInsight,rewardContact:s.rewardContact,score:s.score}},claimChainReward:s=>{let r=e0();if(r.currentStreak<s||r.milestonesClaimed.includes(s))return{rewardInsight:0,rewardContact:0,label:"",ok:!1};let a=function(e){let t=eQ.find(t=>t.milestone===e),s=e0();if(!t||s.milestonesClaimed.includes(e)||s.currentStreak<e)return{rewardInsight:0,rewardContact:0,label:"",state:s};let r={...s,milestonesClaimed:[...s.milestonesClaimed,e]};return e1(r),{rewardInsight:t.rewardInsight,rewardContact:t.rewardContact,label:t.label,state:r}}(s);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)})}return{rewardInsight:a.rewardInsight,rewardContact:a.rewardContact,label:a.label,ok:a.rewardInsight>0||a.rewardContact>0}},grantCruiseReward:s=>{let r=t(),a=s.crystals??0,n=s.insights??0,i=s.contact??0,o=Math.max(2,Math.floor((a+10*n+10*i)/30)),l=r.attributes??eb(),c=r.attributeProgress??eg(),d=ex({exp:c.exploration.exp+o,level:l.exploration},100),u=ex({exp:c.courage.exp+Math.floor(.6*o),level:l.courage},100),h={...l,exploration:d.newProgress.level,courage:u.newProgress.level},f={...c,exploration:d.newProgress,courage:u.newProgress};e({crystals:Math.min(r.crystalCap,r.crystals+a),insights:r.insights+Math.round(n),contact:Math.min(100,r.contact+i),attributes:h,attributeProgress:f,...to({tech:r.tech,blueprints:r.blueprints,achievements:r.achievements,activeTide:r.activeTide,constellation:r.constellation,attributes:h})})},allocateAttribute:(s,r=1)=>{let a=t(),n=a.attributes??eb(),i=n[s]??0;if(i>=100||(a.pendingAttrPoints??0)<r)return{ok:!1,leveledUp:0};let o=Math.min(r,100-i,a.pendingAttrPoints),l=i+o,c={...n,[s]:l},d=a.attributeProgress??eg(),u=d[s]??{exp:0,level:i};return e({attributes:c,attributeProgress:{...d,[s]:{exp:u.exp,level:l}},pendingAttrPoints:a.pendingAttrPoints-o,...to({tech:a.tech,blueprints:a.blueprints,achievements:a.achievements,activeTide:a.activeTide,constellation:a.constellation,attributes:c})}),{ok:!0,leveledUp:o}},gainAttributeExp:(s,r)=>{let a=t(),n=a.attributes??eb(),i=a.attributeProgress??eg(),o=ex({exp:(i[s]??{exp:0,level:n[s]}).exp+r,level:n[s]},100),l={...n,[s]:o.newProgress.level};return e({attributes:l,attributeProgress:{...i,[s]:o.newProgress},...to({tech:a.tech,blueprints:a.blueprints,achievements:a.achievements,activeTide:a.activeTide,constellation:a.constellation,attributes:l})}),{leveledUp:o.levelsGained,newLevel:o.newProgress.level}}}),i={name:"echo-nexus-save-v1",storage:E(()=>localStorage),partialize:e=>{let{_lastAutoDecode:t,_lastSpawn:s,_combo:r,_lastPulse:a,_achievementQueue:n,_tideEvents:i,globalTide:o,...l}=e;return l}},(e,t,s)=>{let r,a={storage:E(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...i},o=!1,l=0,c=new Set,d=new Set,u=a.storage;if(!u)return n((...t)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),e(...t)},t,s);let h=()=>{let e=a.partialize({...t()});return u.setItem(a.name,{state:e,version:a.version})},f=s.setState;s.setState=(e,t)=>(f(e,t),h());let p=n((...t)=>(e(...t),h()),t,s);s.getInitialState=()=>p;let m=()=>{var s,n;if(!u)return;let i=++l;o=!1,c.forEach(e=>{var s;return e(null!=(s=t())?s:p)});let f=(null==(n=a.onRehydrateStorage)?void 0:n.call(a,null!=(s=t())?s:p))||void 0;return _(u.getItem.bind(u))(a.name).then(e=>{if(e)if("number"!=typeof e.version||e.version===a.version)return[!1,e.state];else{if(a.migrate){let t=a.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(s=>{var n;if(i!==l)return;let[o,c]=s;if(e(r=a.merge(c,null!=(n=t())?n:p),!0),o)return h()}).then(()=>{i===l&&(null==f||f(r,void 0),r=t(),o=!0,d.forEach(e=>e(r)))}).catch(e=>{i===l&&(null==f||f(void 0,e))})};return s.persist={setOptions:e=>{a={...a,...e},e.storage&&(u=e.storage)},clearStorage:()=>{null==u||u.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>m(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(d.add(e),()=>{d.delete(e)})},a.skipHydration||m(),r||p}));var tu=e.i(75254);let th=(0,tu.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"}]]),tf=(0,tu.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"}]]),tp=(0,tu.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"}]]),tm=(0,tu.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 tx=e.i(20783),tg=Symbol.for("react.lazy"),tb=M[" use ".trim().toString()];function ty(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===tg&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}function tv(e){var t;let s,r=(t=e,(s=M.forwardRef((e,t)=>{let{children:s,...r}=e;if(ty(s)&&"function"==typeof tb&&(s=tb(s._payload)),M.isValidElement(s)){var a;let e,n,i=(a=s,(n=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(n=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),o=function(e,t){let s={...t};for(let r in t){let a=e[r],n=t[r];/^on[A-Z]/.test(r)?a&&n?s[r]=(...e)=>{let t=n(...e);return a(...e),t}:a&&(s[r]=a):"style"===r?s[r]={...a,...n}:"className"===r&&(s[r]=[a,n].filter(Boolean).join(" "))}return{...e,...s}}(r,s.props);return s.type!==M.Fragment&&(o.ref=t?(0,tx.composeRefs)(t,i):i),M.cloneElement(s,o)}return M.Children.count(s)>1?M.Children.only(null):null})).displayName=`${t}.SlotClone`,s),a=M.forwardRef((e,t)=>{let{children:s,...a}=e;ty(s)&&"function"==typeof tb&&(s=tb(s._payload));let n=M.Children.toArray(s),i=n.find(tk);if(i){let e=i.props.children,s=n.map(t=>t!==i?t:M.Children.count(e)>1?M.Children.only(null):M.isValidElement(e)?e.props.children:null);return(0,N.jsx)(r,{...a,ref:t,children:M.isValidElement(e)?M.cloneElement(e,void 0,s):null})}return(0,N.jsx)(r,{...a,ref:t,children:s})});return a.displayName=`${e}.Slot`,a}var tw=tv("Slot"),tj=Symbol("radix.slottable");function tk(e){return M.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===tj}var tN=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let s=tv(`Primitive.${t}`),r=M.forwardRef((e,r)=>{let{asChild:a,...n}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,N.jsx)(a?s:t,{...n,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),tM="Progress",[tS,tT]=function(e,t=[]){let s=[],r=()=>{let t=s.map(e=>M.createContext(e));return function(s){let r=s?.[e]||t;return M.useMemo(()=>({[`__scope${e}`]:{...s,[e]:r}}),[s,r])}};return r.scopeName=e,[function(t,r){let a=M.createContext(r);a.displayName=t+"Context";let n=s.length;s=[...s,r];let i=t=>{let{scope:s,children:r,...i}=t,o=s?.[e]?.[n]||a,l=M.useMemo(()=>i,Object.values(i));return(0,N.jsx)(o.Provider,{value:l,children:r})};return i.displayName=t+"Provider",[i,function(s,i){let o=i?.[e]?.[n]||a,l=M.useContext(o);if(l)return l;if(void 0!==r)return r;throw Error(`\`${s}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let s=()=>{let s=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=s.reduce((t,{useScope:s,scopeName:r})=>{let a=s(e)[`__scope${r}`];return{...t,...a}},{});return M.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return s.scopeName=t.scopeName,s}(r,...t)]}(tM),[tC,tP]=tS(tM),tE=M.forwardRef((e,t)=>{var s,r;let{__scopeProgress:a,value:n=null,max:i,getValueLabel:o=tA,...l}=e;(i||0===i)&&!tB(i)&&console.error((s=`${i}`,`Invalid prop \`max\` of value \`${s}\` supplied to \`Progress\`. Only numbers greater than 0 are valid max values. Defaulting to \`100\`.`));let c=tB(i)?i:100;null===n||tI(n,c)||console.error((r=`${n}`,`Invalid prop \`value\` of value \`${r}\` 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=tI(n,c)?n:null,u=tD(d)?o(d,c):void 0;return(0,N.jsx)(tC,{scope:a,value:d,max:c,children:(0,N.jsx)(tN.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":tD(d)?d:void 0,"aria-valuetext":u,role:"progressbar","data-state":t$(d,c),"data-value":d??void 0,"data-max":c,...l,ref:t})})});tE.displayName=tM;var t_="ProgressIndicator",tR=M.forwardRef((e,t)=>{let{__scopeProgress:s,...r}=e,a=tP(t_,s);return(0,N.jsx)(tN.div,{"data-state":t$(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...r,ref:t})});function tA(e,t){return`${Math.round(e/t*100)}%`}function t$(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function tD(e){return"number"==typeof e}function tB(e){return tD(e)&&!isNaN(e)&&e>0}function tI(e,t){return tD(e)&&!isNaN(e)&&e<=t&&e>=0}tR.displayName=t_;var tL=e.i(75157);function tO({className:e,value:t,...s}){return(0,N.jsx)(tE,{"data-slot":"progress",className:(0,tL.cn)("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",e),...s,children:(0,N.jsx)(tR,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})})}function tF({onPrestige:e}){let t=td(e=>e.crystals),s=td(e=>e.crystalsPerSec),r=td(e=>e.insights),a=td(e=>e.contact),n=td(e=>e.ascensions),i=td(e=>e.blueprints);return(0,N.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,N.jsx)(tz,{icon:(0,N.jsx)(th,{className:"h-4 w-4 text-emerald-400"}),label:"记忆晶体",value:U(t),sub:`+${s.toFixed(1)}/s`,glow:"rgba(52,211,153,0.4)"}),(0,N.jsx)("div",{className:"h-9 w-px bg-gradient-to-b from-transparent via-white/15 to-transparent hidden sm:block"}),(0,N.jsx)(tz,{icon:(0,N.jsx)(tf,{className:"h-4 w-4 text-amber-400"}),label:"技术洞见",value:U(r),sub:"解码产出",glow:"rgba(251,191,36,0.4)"}),(0,N.jsx)("div",{className:"h-9 w-px bg-gradient-to-b from-transparent via-white/15 to-transparent hidden sm:block"}),(0,N.jsxs)("div",{className:"flex-1 min-w-[200px] flex flex-col gap-1.5",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(tp,{className:"h-4 w-4 text-fuchsia-400 shrink-0"}),(0,N.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"接触进度"}),(0,N.jsxs)("span",{className:"text-xs font-mono font-semibold text-fuchsia-300 ml-auto tabular-nums",children:[a.toFixed(1),"%"]}),a>=100&&(0,N.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,N.jsx)(tO,{value:a,className:"h-1.5 bg-white/10 [&>div]:bg-gradient-to-r [&>div]:from-fuchsia-500 [&>div]:to-rose-400"})]}),(0,N.jsx)("div",{className:"h-9 w-px bg-gradient-to-b from-transparent via-white/15 to-transparent hidden sm:block"}),(0,N.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,N.jsx)(tm,{className:"h-4 w-4 text-rose-400 shrink-0"}),(0,N.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,N.jsx)("span",{className:"text-[10px] text-muted-foreground leading-none",children:"飞升"}),(0,N.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,N.jsx)("span",{className:"text-sm font-mono font-semibold leading-none",children:n}),(0,N.jsxs)("span",{className:"text-amber-300 text-xs leading-none",children:["×",i.length]})]})]})]})]})}function tz({icon:e,label:t,value:s,sub:r,glow:a}){return(0,N.jsxs)("div",{className:"flex items-center gap-2.5",style:{filter:`drop-shadow(0 0 6px ${a})`},children:[e,(0,N.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,N.jsx)("span",{className:"text-[10px] text-muted-foreground leading-none",children:t}),(0,N.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,N.jsx)("span",{className:"text-sm font-mono font-semibold leading-none tabular-nums",children:s}),(0,N.jsx)("span",{className:"text-[10px] text-muted-foreground/80 whitespace-nowrap",children:r})]})]})]})}var tV=e.i(37902),tU=e.i(74911);let tW={emerald:523.25,rose:587.33,amber:659.25,fuchsia:698.46};class tH{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,s="sine",r=.3,a=0,n=0,i){let o=this.ensure();if(!o||!this.master)return;let l=o.currentTime+a,c=o.createOscillator(),d=o.createGain();if(c.type=s,c.frequency.setValueAtTime(e,l),n&&c.detune.setValueAtTime(n,l),d.gain.setValueAtTime(0,l),d.gain.linearRampToValueAtTime(r,l+.008),d.gain.exponentialRampToValueAtTime(1e-4,l+t),i){let e=o.createBiquadFilter();e.type="lowpass",e.frequency.value=i,c.connect(e),e.connect(d)}else c.connect(d);d.connect(this.master),c.start(l),c.stop(l+t+.05)}sweep(e,t,s,r="sine",a=.3,n=0){let i=this.ensure();if(!i||!this.master)return;let o=i.currentTime+n,l=i.createOscillator(),c=i.createGain();l.type=r,l.frequency.setValueAtTime(e,o),l.frequency.exponentialRampToValueAtTime(Math.max(1,t),o+s),c.gain.setValueAtTime(0,o),c.gain.linearRampToValueAtTime(a,o+.02),c.gain.exponentialRampToValueAtTime(1e-4,o+s),l.connect(c),c.connect(this.master),l.start(o),l.stop(o+s+.05)}noise(e,t=.2,s=0,r=1200){let a=this.ensure();if(!a||!this.master)return;let n=a.currentTime+s,i=Math.floor(a.sampleRate*e),o=a.createBuffer(1,i,a.sampleRate),l=o.getChannelData(0);for(let e=0;e<i;e++)l[e]=(2*Math.random()-1)*(1-e/i);let c=a.createBufferSource();c.buffer=o;let d=a.createBiquadFilter();d.type="lowpass",d.frequency.value=r;let u=a.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?tW[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 tq=null;function tK(){return tq||(tq=new tH),tq}function tX(e,t){tK().play(e,t)}let tY=["晶核深处传来一阵微弱的震颤…","以太族的余响在谐振中回荡。","你听见了一句无法辨认的低语。","星海的寂静被你的脉冲短暂打破。","晶体表面的纹路闪烁,像是某种回应。","回响核心记录着每一次触碰。","虚空深处,有什么在倾听。","谐振频率与你的脉冲产生了共鸣。","这是以太族留下的第一道印记。","晶体内部的光,比星辰更古老。","你的脉冲唤醒了一段沉睡的频率。","维度薄膜因你的触碰而微微颤动。","采矿不是掠夺,是聆听。","每一颗晶体,都是一封跨越时间的信。","以太族信任你,所以留下了这些。"],tG={mining:"以太族从不掠夺星海,他们与矿脉共振,让晶体自愿献出光芒。",decoding:"谐振法则是以太族的核心遗产——思维可被编码为共振序列。",expedition:"他们留下的遗迹不是废墟,是故意设置的试炼场。",narrative:"记忆校音,是以太族赋予后来者的第一项礼物。"};function tJ(e,t){if(Math.random()<t){if(0===e.length)return"";let t=Math.floor(Math.random()*e.length);return e[t]}return null}let tZ="#34d399",tQ="#e879f9",t0="#fb7185",t1="#fbbf24";function t2(e){return e>=5?t1:e>=3?tQ:tZ}function t5(){let e=td(e=>e.pulse),t=td(e=>e.crystals),s=td(e=>e.crystalsPerSec),r=td(e=>e.crystalCap),a=td(e=>e._combo),{toast:n}=(0,tU.useToast)(),[i,o]=(0,M.useState)([]),l=(0,M.useRef)(0),c=(0,M.useRef)(null),d=(0,M.useRef)(null);(0,M.useRef)(0);let[u,h]=(0,M.useState)(0),f=(0,M.useRef)([]),p=(0,M.useRef)([]),m=(0,M.useRef)([]),x=(0,M.useRef)([]),g=(0,M.useRef)(a),b=(0,M.useRef)(0),y=(0,M.useRef)(t),v=(0,M.useRef)(r);(0,M.useEffect)(()=>{g.current=a,y.current=t,v.current=r},[a,t,r]);let w=(0,M.useRef)({x:0,y:0,inside:!1}),j=(0,M.useCallback)((e,t)=>{let s=.28*Math.min(e,t),r=[];[{count:14,rMul:.95,speed:.6,color:tZ},{count:10,rMul:1.15,speed:-.4,color:tQ},{count:8,rMul:1.35,speed:.3,color:t0}].forEach(e=>{for(let t=0;t<e.count;t++)r.push({angle:2*Math.PI*t/e.count+.3*Math.random(),radius:s*e.rMul,baseRadius:s*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=r;let a=[];for(let s=0;s<40;s++)a.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});p.current=a},[]),k=(0,M.useCallback)((e,t,s)=>{let r=t2(s.combo),a=performance.now();m.current.push({born:a,color:tZ,maxRadius:140,duration:700}),s.combo>=3&&m.current.push({born:a+100,color:tQ,maxRadius:170,duration:800}),s.combo>=5&&m.current.push({born:a+200,color:t1,maxRadius:200,duration:900});let n=10+2*Math.min(10,s.combo);for(let s=0;s<n;s++){let i=2*Math.PI*s/n+.4*Math.random(),o=120+180*Math.random();x.current.push({x:e,y:t,vx:Math.cos(i)*o,vy:Math.sin(i)*o,size:2+3*Math.random(),color:r,born:a,life:600+300*Math.random()})}f.current.forEach(e=>{e.radius=e.baseRadius*(1.25+.15*Math.random())})},[]),S=(0,M.useCallback)(t=>{let s=e();if(!s)return;let r=t.currentTarget.getBoundingClientRect(),a=t.clientX-r.left,i=t.clientY-r.top,c=l.current++,d=t2(s.combo);if(o(e=>[...e,{id:c,x:a,y:i,text:`+${s.gain.toFixed(1)}`,born:Date.now(),color:d}]),k(a,i,s),h(e=>e+1),tX(s.combo>=3?"pulseCombo":"pulse",{combo:s.combo}),setTimeout(()=>{o(e=>e.filter(e=>e.id!==c))},900),s.combo>=5&&s.combo%5==0){let e=tJ(tY,.6);n({title:`\xd7${s.combo} 连击!`,description:e?`「${e}」`:"谐振叠加,产能飙升。"})}else if(s.combo>=3&&s.combo%3==0){let e=tJ(tY,.3);e&&n({title:"低语",description:`「${e}」`})}},[e,n,k]);(0,M.useEffect)(()=>{let e=c.current,t=d.current;if(!e||!t)return;let s=e.getContext("2d");if(!s)return;let r=0,a=performance.now(),n=Math.min(window.devicePixelRatio||1,2),i=()=>{let r=t.getBoundingClientRect();n=Math.min(window.devicePixelRatio||1,2),e.width=Math.max(1,Math.floor(r.width*n)),e.height=Math.max(1,Math.floor(r.height*n)),e.style.width=`${r.width}px`,e.style.height=`${r.height}px`,s.setTransform(n,0,0,n,0,0),j(r.width,r.height)};i();let o=new ResizeObserver(i);o.observe(t);let l=t=>{let i=Math.min(.05,(t-a)/1e3);a=t;let o=e.width/n,c=e.height/n,d=o/2,u=c/2,h=.28*Math.min(o,c);s.clearRect(0,0,o,c),p.current.forEach(e=>{e.x+=e.vx*i,e.y+=e.vy*i,e.twinkle+=2*i,e.x<0&&(e.x=o),e.x>o&&(e.x=0),e.y<0&&(e.y=c),e.y>c&&(e.y=0);let t=.5+.5*Math.sin(e.twinkle);s.globalAlpha=e.alpha*t,s.fillStyle="#ffffff",s.beginPath(),s.arc(e.x,e.y,e.size,0,2*Math.PI),s.fill()}),s.globalAlpha=1;let g=.85+.15*Math.sin(.001*t),j=s.createRadialGradient(d,u,.3*h,d,u,2.2*h);j.addColorStop(0,`rgba(52,211,153,${.18*g})`),j.addColorStop(.5,`rgba(232,121,249,${.1*g})`),j.addColorStop(1,"rgba(0,0,0,0)"),s.fillStyle=j,s.fillRect(0,0,o,c),s.lineWidth=2.5,s.strokeStyle="rgba(255,255,255,0.06)",s.beginPath(),s.arc(d,u,1.45*h,0,2*Math.PI),s.stroke();let k=Math.min(100,y.current/Math.max(1,v.current)*100);b.current=k;let N=1.45*h,M=s.createLinearGradient(d-N,u-N,d+N,u+N);M.addColorStop(0,tZ),M.addColorStop(.5,tQ),M.addColorStop(1,t0),s.strokeStyle=M,s.lineWidth=3,s.lineCap="round",s.shadowBlur=8,s.shadowColor=tZ,s.beginPath(),s.arc(d,u,N,-Math.PI/2,-Math.PI/2+2*Math.PI*k/100),s.stroke(),s.shadowBlur=0,f.current.forEach(e=>{e.angle+=e.speed*i,e.radius+=(e.baseRadius-e.radius)*Math.min(1,4*i);let r=d+Math.cos(e.angle)*e.radius,a=u+Math.sin(e.angle)*e.radius,n=.7+.3*Math.sin(.005*t+e.phase);s.globalAlpha=e.alpha*n,s.fillStyle=e.color,s.shadowBlur=10,s.shadowColor=e.color,s.beginPath(),s.arc(r,a,e.size,0,2*Math.PI),s.fill(),s.globalAlpha=e.alpha*n*.4,s.strokeStyle=e.color,s.lineWidth=.6*e.size,s.beginPath(),s.moveTo(r,a),s.lineTo(d+Math.cos(e.angle-.08*e.speed)*(e.radius-2),u+Math.sin(e.angle-.08*e.speed)*(e.radius-2)),s.stroke()}),s.globalAlpha=1,s.shadowBlur=0;let S=.95*h,T=0,C=0;if(w.current.inside){let e=w.current.x-d,t=w.current.y-u,s=Math.hypot(e,t);s>.1&&(T=e/s*Math.min(8,.05*s),C=t/s*Math.min(8,.05*s))}let P=d+T,E=u+C,_=s.createRadialGradient(P-.25*S,E-.3*S,.1*S,P,E,S);_.addColorStop(0,"rgba(255,255,255,0.95)"),_.addColorStop(.3,`rgba(52,211,153,${.85*g})`),_.addColorStop(.65,"rgba(232,121,249,0.55)"),_.addColorStop(1,"rgba(251,113,133,0.2)"),s.fillStyle=_,s.shadowBlur=30,s.shadowColor=tZ,s.beginPath(),s.arc(P,E,S,0,2*Math.PI),s.fill(),s.save(),s.translate(P,E),s.globalAlpha=.25,s.strokeStyle="rgba(255,255,255,0.6)",s.lineWidth=.8;let R=.7*S;for(let e=0;e<3;e++){let r=R*(1-.3*e);s.beginPath();for(let a=0;a<6;a++){let n=Math.PI/3*a+2e-4*t*(e%2?1:-1),i=Math.cos(n)*r,o=Math.sin(n)*r;0===a?s.moveTo(i,o):s.lineTo(i,o)}s.closePath(),s.stroke()}s.restore(),s.globalAlpha=.4,s.fillStyle="#ffffff",s.beginPath(),s.ellipse(P-.25*S,E-.35*S,.35*S,.18*S,-.4,0,2*Math.PI),s.fill(),s.globalAlpha=1,s.shadowBlur=0,m.current=m.current.filter(e=>{let r=t-e.born;if(r<0||r>e.duration)return r<=e.duration+50;let a=r/e.duration,n=e.maxRadius*a;return s.globalAlpha=(1-a)*.8,s.strokeStyle=e.color,s.lineWidth=2.5*(1-.5*a),s.shadowBlur=12,s.shadowColor=e.color,s.beginPath(),s.arc(d,u,n,0,2*Math.PI),s.stroke(),s.shadowBlur=0,!0}),m.current=m.current.filter(e=>t-e.born<e.duration),s.globalAlpha=1,x.current=x.current.filter(e=>{let r=t-e.born;if(r>e.life)return!1;e.x+=e.vx*i,e.y+=e.vy*i,e.vx*=.96,e.vy*=.96;let a=r/e.life;return s.globalAlpha=1-a,s.fillStyle=e.color,s.shadowBlur=8,s.shadowColor=e.color,s.beginPath(),s.arc(e.x,e.y,e.size*(1-.5*a),0,2*Math.PI),s.fill(),!0}),s.globalAlpha=1,s.shadowBlur=0,r=requestAnimationFrame(l)};return r=requestAnimationFrame(l),()=>{cancelAnimationFrame(r),o.disconnect()}},[j]);let T=(0,M.useCallback)(e=>{let t=e.currentTarget.getBoundingClientRect();w.current={x:e.clientX-t.left,y:e.clientY-t.top,inside:!0}},[]),C=(0,M.useCallback)(()=>{w.current.inside=!1},[]),P=Math.min(100,t/Math.max(1,r)*100);return(0,N.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 relative flex flex-col items-center justify-center gap-4 select-none",children:[a>1&&(0,N.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:["×",a," 连击"]}),(0,N.jsxs)("button",{onClick:S,onMouseMove:T,onMouseLeave:C,"aria-label":"脉冲扫描,获取记忆晶体",className:"jsx-dda3ce20a1930cc3 relative h-52 w-52 sm:h-64 sm:w-64 rounded-full focus:outline-none group",children:[(0,N.jsx)("div",{ref:d,className:"jsx-dda3ce20a1930cc3 absolute inset-0 rounded-full overflow-hidden",children:(0,N.jsx)("canvas",{ref:c,className:"jsx-dda3ce20a1930cc3 block w-full h-full"})}),(0,N.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,N.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,N.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,N.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,N.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}`),i.map(e=>(0,N.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,N.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-center",children:[(0,N.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:U(t)}),(0,N.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-xs text-muted-foreground mt-0.5",children:["记忆晶体 · ",s.toFixed(1),"/s · 上限"," ",U(r)]}),(0,N.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-[11px] text-muted-foreground/70 mt-2",children:["点击晶体发起",(0,N.jsx)("span",{className:"jsx-dda3ce20a1930cc3 text-emerald-300",children:"脉冲扫描"}),",连击叠加加成"]}),(0,N.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-[10px] text-muted-foreground/50 mt-1 tabular-nums",children:["仓库 ",P.toFixed(1),"% · 连击 ×",Math.max(1,a)]})]}),(0,N.jsx)(tV.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 t3=(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 t4({className:e,variant:t,size:s,asChild:r=!1,...a}){return(0,N.jsx)(r?tw:"button",{"data-slot":"button",className:(0,tL.cn)(t3({variant:t,size:s,className:e})),...a})}var t9=e.i(37727);let t7=(0,tu.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"}]]),t6=(0,tu.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),t8=(0,tu.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"}]]),se=(0,tu.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 st(){let e=td(e=>e.activePuzzle),t=td(e=>e.clickNode),s=td(e=>e.undoStep),r=td(e=>e.retryPuzzle),a=td(e=>e.abandonPuzzle),{toast:n}=(0,tU.useToast)(),[i,o]=(0,M.useState)(null),[l,c]=(0,M.useState)(null),[d,u]=(0,M.useState)(!1);if(!e)return null;let{grid:h,rows:f,cols:p,target:m,path:x,stepLimit:g,tier:b}=e,y=x.length,v=m[y],w=x.length>0&&x.length<m.length&&!eT(e),j=()=>{s(),u(!1),c(null)},k=100/p,S=100/f,T=x.map(e=>h.find(t=>t.id===e)).filter(Boolean);return(0,N.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex flex-col gap-4 h-full",children:[(0,N.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center justify-center gap-2 flex-wrap",children:[(0,N.jsx)("span",{className:"jsx-35ab0418fdc54847 text-xs text-muted-foreground mr-1",children:"目标谐振"}),m.map((e,t)=>{let s=t<y,r=t===y,a=B[e];return(0,N.jsxs)("div",{style:{background:`radial-gradient(circle at 35% 30%, ${a.hex}, ${a.hex}aa 60%, ${a.hex}44)`,boxShadow:r?`0 0 18px ${a.glow}, 0 0 36px ${a.glow}`:`0 0 8px ${a.glow}`,"--tw-ring-color":a.hex},className:`jsx-35ab0418fdc54847 relative h-9 w-9 rounded-full flex items-center justify-center transition-all duration-300 ${s?"opacity-30 scale-90":""} ${r?"scale-125 ring-2 ring-offset-2 ring-offset-background":""}`,children:[s&&(0,N.jsx)(t6,{className:"h-4 w-4 text-white"}),r&&(0,N.jsx)("span",{style:{color:a.hex},className:"jsx-35ab0418fdc54847 absolute -bottom-5 text-[10px] font-medium",children:"下一个"})]},t)})]}),(0,N.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,N.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:`${k}% ${S}%`},className:"jsx-35ab0418fdc54847 absolute inset-0 opacity-20"}),(0,N.jsx)("svg",{className:"jsx-35ab0418fdc54847 absolute inset-0 w-full h-full pointer-events-none",children:T.map((e,t)=>{if(0===t)return null;let s=T[t-1],r=(s.col+.5)*k,a=(s.row+.5)*S,n=(e.col+.5)*k,i=(e.row+.5)*S,o=B[e.color];return(0,N.jsx)("line",{x1:`${r}%`,y1:`${a}%`,x2:`${n}%`,y2:`${i}%`,stroke:o.hex,strokeWidth:2.5,strokeLinecap:"round",style:{filter:`drop-shadow(0 0 4px ${o.glow})`},className:"jsx-35ab0418fdc54847 echo-path-line"},t)})}),h.map(s=>{let r=B[s.color],a=s.used,h=void 0!==v&&s.color===v&&!a,f=0===x.length&&h&&function(e,t){if(0!==e.path.length)return!1;let s=e.grid.find(e=>e.id===t);if(!s||s.used||s.color!==e.target[0])return!1;let r=JSON.parse(JSON.stringify(e));return r.grid.find(e=>e.id===t).used=!0,r.path.push(t),eT(r)}(e,s.id),m=0===x.length&&h&&!f,g=i===s.id,b=l?.id===s.id,y=(s.col+.5)*k,w=(s.row+.5)*S;return(0,N.jsx)("button",{onClick:()=>(e=>{let s=t(e.id);if(s.ok&&s.finished){u(!1),tX("decodeSuccess"),s.failReason&&s.failReason.split(",").filter(Boolean).length&&(tX("fragmentUnlock"),n({title:"✦ 记忆碎片浮现",description:"新的回响被拼入图谱,前往「记忆图谱」查看。"})),n({title:"谐振闭合!",description:"晶体解码成功,记忆已释放。"});return}s.ok?(tX("decodeClick",{color:e.color}),c({id:e.id,ok:!0}),setTimeout(()=>c(null),280),!1!==s.solvable||d||(u(!0),n({title:"谐振受阻",description:"此路不通,建议撤销上一步或重排。"})),!0===s.solvable&&u(!1)):(tX("decodeFail"),c({id:e.id,ok:!1}),setTimeout(()=>c(null),280))})(s),onMouseEnter:()=>o(s.id),onMouseLeave:()=>o(null),disabled:a,style:{left:`${y}%`,top:`${w}%`,width:`min(${100/p*.62}%, 56px)`,aspectRatio:"1",background:a?"rgba(255,255,255,0.04)":`radial-gradient(circle at 35% 30%, ${r.hex}, ${r.hex}cc 55%, ${r.hex}55)`,boxShadow:a?"inset 0 0 12px rgba(0,0,0,0.5)":f?`0 0 16px ${r.glow}, 0 0 32px ${r.glow}, inset 0 0 10px rgba(255,255,255,0.5)`:h?`0 0 10px ${r.glow}, 0 0 20px ${r.glow}, inset 0 0 6px rgba(255,255,255,0.3)`:`0 0 6px ${r.glow}`,border:f?`2px solid ${r.hex}`:h?`1.5px solid ${r.hex}aa`:"1px solid rgba(255,255,255,0.12)",opacity:a?.35:m?.5:1,transform:`translate(-50%, -50%) scale(${g&&!a?1.12:b?l?.ok?1.25:.8:1})`,animation:f?"echo-pulse 1.2s ease-in-out infinite":h&&!m?"echo-pulse 1.6s ease-in-out infinite":void 0},"aria-label":`${r.label}色节点 ${s.row+1}-${s.col+1}`,className:"jsx-35ab0418fdc54847 absolute rounded-full transition-[box-shadow,background,border,opacity] duration-200 focus:outline-none disabled:cursor-not-allowed",children:!a&&(0,N.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"})},s.id)})]}),w&&(0,N.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,N.jsx)(se,{className:"h-3.5 w-3.5 shrink-0"}),(0,N.jsx)("span",{className:"jsx-35ab0418fdc54847",children:"谐振受阻,此路已无解。"}),(0,N.jsxs)(t4,{size:"sm",variant:"outline",onClick:j,className:"h-6 px-2 ml-auto border-rose-400/50 text-rose-100 hover:bg-rose-500/20 text-[11px]",children:[(0,N.jsx)(t8,{className:"h-3 w-3 mr-1"}),"撤销"]})]}),(0,N.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center justify-between gap-3",children:[(0,N.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center gap-2 text-xs",children:[(0,N.jsx)("span",{className:"jsx-35ab0418fdc54847 text-muted-foreground",children:"步数"}),(0,N.jsxs)("span",{className:`jsx-35ab0418fdc54847 font-mono font-semibold ${x.length>=g?"text-rose-400":"text-foreground"}`,children:[x.length," / ",g]}),(0,N.jsxs)("span",{className:"jsx-35ab0418fdc54847 ml-2 text-muted-foreground",children:["T",b]})]}),(0,N.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center gap-1.5",children:[(0,N.jsxs)(t4,{variant:"ghost",size:"sm",onClick:j,disabled:0===x.length,className:"h-7",children:[(0,N.jsx)(t8,{className:"h-3.5 w-3.5 mr-1"}),"撤销"]}),(0,N.jsxs)(t4,{variant:"ghost",size:"sm",onClick:()=>{r(),u(!1),c(null)},className:"h-7",children:[(0,N.jsx)(tm,{className:"h-3.5 w-3.5 mr-1"}),"重排"]}),(0,N.jsxs)(t4,{variant:"ghost",size:"sm",onClick:()=>{a(),c(null),u(!1)},className:"h-7",children:[(0,N.jsx)(t9.X,{className:"h-3.5 w-3.5 mr-1"}),"放回"]})]})]}),(0,N.jsx)("p",{className:"jsx-35ab0418fdc54847 text-[11px] text-muted-foreground/80 text-center leading-relaxed",children:0===x.length?(0,N.jsxs)(N.Fragment,{children:["点击",(0,N.jsx)("span",{className:"jsx-35ab0418fdc54847 text-emerald-300",children:"高亮"}),"的可行起点开始,按目标顺序走",(0,N.jsx)("span",{className:"jsx-35ab0418fdc54847 text-emerald-300",children:"相邻同色"}),"节点;走错可",(0,N.jsx)("span",{className:"jsx-35ab0418fdc54847 text-rose-300",children:"撤销"}),"。"]}):(0,N.jsxs)(N.Fragment,{children:["按「目标谐振」顺序,点击",(0,N.jsx)("span",{className:"jsx-35ab0418fdc54847 text-emerald-300",children:"上下左右相邻"}),"的同色节点。每个节点仅可使用一次;走错可",(0,N.jsx)("span",{className:"jsx-35ab0418fdc54847 text-rose-300",children:"撤销"}),"。"]})}),(0,N.jsx)(tV.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 ss(){let e=td(e=>e.activePuzzle),t=td(e=>e.pendingCrystals),s=td(e=>e.startDecode),r=td(e=>e.crystalsPerSec),a=td(e=>e.crystalCap),n=td(e=>e.crystals);return e?(0,N.jsxs)("div",{className:"h-full flex flex-col",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,N.jsx)(t7,{className:"h-4 w-4 text-rose-400"}),(0,N.jsx)("h3",{className:"text-sm font-semibold",children:"解码共振阵列"})]}),(0,N.jsx)("div",{className:"flex-1 min-h-0",children:(0,N.jsx)(st,{})})]}):(0,N.jsxs)("div",{className:"jsx-53059b9e32765d5f h-full flex flex-col",children:[(0,N.jsxs)("div",{className:"jsx-53059b9e32765d5f flex items-center gap-2 mb-3",children:[(0,N.jsx)(t7,{className:"h-4 w-4 text-rose-400"}),(0,N.jsx)("h3",{className:"jsx-53059b9e32765d5f text-sm font-semibold",children:"待解码晶体"}),(0,N.jsxs)("span",{className:"jsx-53059b9e32765d5f text-xs text-muted-foreground ml-auto",children:["产能 ",r.toFixed(1),"/s · ",Math.floor(n),"/",Math.floor(a)]})]}),0===t.length?(0,N.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,N.jsxs)("div",{className:"jsx-53059b9e32765d5f relative h-16 w-16",children:[(0,N.jsx)("div",{className:"jsx-53059b9e32765d5f absolute inset-0 rounded-full bg-rose-500/20 blur-xl animate-pulse"}),(0,N.jsx)("div",{className:"jsx-53059b9e32765d5f absolute inset-2 rounded-full border-2 border-rose-400/40 rotate-45"}),(0,N.jsx)("div",{className:"jsx-53059b9e32765d5f absolute inset-4 rounded-full bg-rose-500/30"})]}),(0,N.jsx)("p",{className:"jsx-53059b9e32765d5f text-sm text-muted-foreground",children:"晶体正在生成中…"}),(0,N.jsx)("p",{className:"jsx-53059b9e32765d5f text-xs text-muted-foreground/70 max-w-[220px]",children:"自治无人机每数秒回收一颗记忆晶体,点击下方晶体开启解码。"})]}):(0,N.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,N.jsx)(sr,{crystal:e,onClick:()=>s(e.id)},e.id))}),(0,N.jsx)(tV.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 sr({crystal:e,onClick:t}){let s=1===e.tier?"#34d399":2===e.tier?"#fbbf24":"#e879f9",r=1===e.tier?"常见":2===e.tier?"稀有":"史诗";return(0,N.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 ${s}22`},children:[(0,N.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,N.jsxs)("div",{className:"relative h-12 w-12 transition-transform duration-500 group-hover:rotate-180",style:{filter:`drop-shadow(0 0 12px ${s}88)`},children:[(0,N.jsx)("div",{className:"absolute inset-0 rotate-45 rounded-md",style:{background:`linear-gradient(135deg, ${s}, ${s}66)`,border:`1px solid ${s}`}}),(0,N.jsx)("div",{className:"absolute inset-2 rotate-45 rounded-sm",style:{background:"linear-gradient(135deg, rgba(255,255,255,0.5), transparent)"}})]})}),(0,N.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:s},children:["T",e.tier]}),(0,N.jsx)("div",{className:"absolute bottom-1.5 right-1.5 text-[10px] text-white/70",children:r}),(0,N.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,N.jsx)("span",{className:"text-[11px] font-medium text-white",children:"解码 →"})})]})}function sa({className:e,...t}){return(0,N.jsx)("div",{"data-slot":"card",className:(0,tL.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}let sn=(0,tu.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"}]]),si=(0,tu.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"}]]),so=(0,tu.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"}]]),sl=(0,tu.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"}]]),sc=(0,tu.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"}]]),sd={Pickaxe:sn,ScanLine:si,Rocket:so,BookOpen:sl},su={mining:"#34d399",decoding:"#fb7185",expedition:"#fbbf24",narrative:"#e879f9"};function sh(){let e=td(e=>e.tech),t=td(e=>e.insights),s=td(e=>e.buyTech);return(0,N.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex flex-col gap-3 h-full",children:[(0,N.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center justify-between",children:[(0,N.jsx)("h3",{className:"jsx-fbf3fdae687a84dd text-sm font-semibold",children:"技术树"}),(0,N.jsxs)("span",{className:"jsx-fbf3fdae687a84dd text-xs text-muted-foreground",children:["洞见 ",(0,N.jsx)("span",{className:"jsx-fbf3fdae687a84dd text-amber-300 font-mono",children:U(t)})]})]}),(0,N.jsx)("div",{className:"jsx-fbf3fdae687a84dd flex-1 overflow-y-auto echo-scroll pr-1 space-y-3",children:["mining","decoding","expedition","narrative"].map(r=>{let a=L[r],n=sd[a.icon],i=su[r],o=I.filter(e=>e.branch===r);return(0,N.jsxs)("div",{className:"jsx-fbf3fdae687a84dd",children:[(0,N.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center gap-2 mb-1.5 px-1",children:[(0,N.jsx)(n,{className:"jsx-fbf3fdae687a84dd h-3.5 w-3.5"}),(0,N.jsx)("span",{style:{color:i},className:"jsx-fbf3fdae687a84dd text-xs font-medium",children:a.name}),(0,N.jsx)("span",{className:"jsx-fbf3fdae687a84dd text-[10px] text-muted-foreground/70 truncate flex-1",children:a.desc})]}),(0,N.jsxs)("p",{className:"jsx-fbf3fdae687a84dd text-[9px] italic text-muted-foreground/50 px-1 mb-1.5 truncate",children:["「",tG[r]??"","」"]}),(0,N.jsx)("div",{className:"jsx-fbf3fdae687a84dd grid gap-1.5",children:o.map(r=>{let a=(e[r.id]??0)>=1,n=t>=r.cost;return(0,N.jsx)(sa,{className:`p-2.5 transition-all duration-200 ${a?"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:a?{boxShadow:`inset 0 0 0 1px ${i}44, 0 0 12px ${i}22`}:void 0,children:(0,N.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center gap-2",children:[(0,N.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex-1 min-w-0",children:[(0,N.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center gap-1.5",children:[(0,N.jsx)("span",{style:{color:a?i:void 0},className:"jsx-fbf3fdae687a84dd text-xs font-semibold truncate",children:r.name}),a&&(0,N.jsx)(t6,{className:"h-3 w-3",style:{color:i}})]}),(0,N.jsx)("p",{className:"jsx-fbf3fdae687a84dd text-[10px] text-muted-foreground/80 truncate",children:r.desc})]}),!a&&(0,N.jsxs)(t4,{size:"sm",variant:n?"default":"ghost",disabled:!n,onClick:()=>{s(r.id)&&tX("techBuy")},className:"h-7 px-2 text-[11px] shrink-0",style:n?{background:`${i}22`,border:`1px solid ${i}66`,color:i}:void 0,children:[(0,N.jsx)(sc,{className:"h-2.5 w-2.5 mr-1"}),r.cost]})]})},r.id)})})]},r)})}),(0,N.jsx)(tV.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 sf=e.i(48425),sp=e.i(96626),sm=e.i(30030),sx=e.i(30207),sg=M.createContext(void 0);function sb(e){let t=M.useContext(sg);return e||t||"ltr"}var sy=e.i(34620),sv=e.i(81140),sw="ScrollArea",[sj,sk]=(0,sm.createContextScope)(sw),[sN,sM]=sj(sw),sS=M.forwardRef((e,t)=>{let{__scopeScrollArea:s,type:r="hover",dir:a,scrollHideDelay:n=600,...i}=e,[o,l]=M.useState(null),[c,d]=M.useState(null),[u,h]=M.useState(null),[f,p]=M.useState(null),[m,x]=M.useState(null),[g,b]=M.useState(0),[y,v]=M.useState(0),[w,j]=M.useState(!1),[k,S]=M.useState(!1),T=(0,tx.useComposedRefs)(t,e=>l(e)),C=sb(a);return(0,N.jsx)(sN,{scope:s,type:r,dir:C,scrollHideDelay:n,scrollArea:o,viewport:c,onViewportChange:d,content:u,onContentChange:h,scrollbarX:f,onScrollbarXChange:p,scrollbarXEnabled:w,onScrollbarXEnabledChange:j,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:k,onScrollbarYEnabledChange:S,onCornerWidthChange:b,onCornerHeightChange:v,children:(0,N.jsx)(sf.Primitive.div,{dir:C,...i,ref:T,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":y+"px",...e.style}})})});sS.displayName=sw;var sT="ScrollAreaViewport",sC=M.forwardRef((e,t)=>{let{__scopeScrollArea:s,children:r,nonce:a,...n}=e,i=sM(sT,s),o=M.useRef(null),l=(0,tx.useComposedRefs)(t,o,i.onViewportChange);return(0,N.jsxs)(N.Fragment,{children:[(0,N.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:a}),(0,N.jsx)(sf.Primitive.div,{"data-radix-scroll-area-viewport":"",...n,ref:l,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,N.jsx)("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});sC.displayName=sT;var sP="ScrollAreaScrollbar",sE=M.forwardRef((e,t)=>{let{forceMount:s,...r}=e,a=sM(sP,e.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:i}=a,o="horizontal"===e.orientation;return M.useEffect(()=>(o?n(!0):i(!0),()=>{o?n(!1):i(!1)}),[o,n,i]),"hover"===a.type?(0,N.jsx)(s_,{...r,ref:t,forceMount:s}):"scroll"===a.type?(0,N.jsx)(sR,{...r,ref:t,forceMount:s}):"auto"===a.type?(0,N.jsx)(sA,{...r,ref:t,forceMount:s}):"always"===a.type?(0,N.jsx)(s$,{...r,ref:t}):null});sE.displayName=sP;var s_=M.forwardRef((e,t)=>{let{forceMount:s,...r}=e,a=sM(sP,e.__scopeScrollArea),[n,i]=M.useState(!1);return M.useEffect(()=>{let e=a.scrollArea,t=0;if(e){let s=()=>{window.clearTimeout(t),i(!0)},r=()=>{t=window.setTimeout(()=>i(!1),a.scrollHideDelay)};return e.addEventListener("pointerenter",s),e.addEventListener("pointerleave",r),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",s),e.removeEventListener("pointerleave",r)}}},[a.scrollArea,a.scrollHideDelay]),(0,N.jsx)(sp.Presence,{present:s||n,children:(0,N.jsx)(sA,{"data-state":n?"visible":"hidden",...r,ref:t})})}),sR=M.forwardRef((e,t)=>{var s;let{forceMount:r,...a}=e,n=sM(sP,e.__scopeScrollArea),i="horizontal"===e.orientation,o=sZ(()=>c("SCROLL_END"),100),[l,c]=(s={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},M.useReducer((e,t)=>s[e][t]??e,"hidden"));return M.useEffect(()=>{if("idle"===l){let e=window.setTimeout(()=>c("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,n.scrollHideDelay,c]),M.useEffect(()=>{let e=n.viewport,t=i?"scrollLeft":"scrollTop";if(e){let s=e[t],r=()=>{let r=e[t];s!==r&&(c("SCROLL"),o()),s=r};return e.addEventListener("scroll",r),()=>e.removeEventListener("scroll",r)}},[n.viewport,i,c,o]),(0,N.jsx)(sp.Presence,{present:r||"hidden"!==l,children:(0,N.jsx)(s$,{"data-state":"hidden"===l?"hidden":"visible",...a,ref:t,onPointerEnter:(0,sv.composeEventHandlers)(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:(0,sv.composeEventHandlers)(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),sA=M.forwardRef((e,t)=>{let s=sM(sP,e.__scopeScrollArea),{forceMount:r,...a}=e,[n,i]=M.useState(!1),o="horizontal"===e.orientation,l=sZ(()=>{if(s.viewport){let e=s.viewport.offsetWidth<s.viewport.scrollWidth,t=s.viewport.offsetHeight<s.viewport.scrollHeight;i(o?e:t)}},10);return sQ(s.viewport,l),sQ(s.content,l),(0,N.jsx)(sp.Presence,{present:r||n,children:(0,N.jsx)(s$,{"data-state":n?"visible":"hidden",...a,ref:t})})}),s$=M.forwardRef((e,t)=>{let{orientation:s="vertical",...r}=e,a=sM(sP,e.__scopeScrollArea),n=M.useRef(null),i=M.useRef(0),[o,l]=M.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=sK(o.viewport,o.content),d={...r,sizes:o,onSizesChange:l,hasThumb:!!(c>0&&c<1),onThumbChange:e=>n.current=e,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:e=>i.current=e};function u(e,t){return function(e,t,s,r="ltr"){let a=sX(s),n=t||a/2,i=s.scrollbar.paddingStart+n,o=s.scrollbar.size-s.scrollbar.paddingEnd-(a-n),l=s.content-s.viewport;return sG([i,o],"ltr"===r?[0,l]:[-1*l,0])(e)}(e,i.current,o,t)}return"horizontal"===s?(0,N.jsx)(sD,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&n.current){let e=sY(a.viewport.scrollLeft,o,a.dir);n.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollLeft=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollLeft=u(e,a.dir))}}):"vertical"===s?(0,N.jsx)(sB,{...d,ref:t,onThumbPositionChange:()=>{if(a.viewport&&n.current){let e=sY(a.viewport.scrollTop,o);n.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{a.viewport&&(a.viewport.scrollTop=e)},onDragScroll:e=>{a.viewport&&(a.viewport.scrollTop=u(e))}}):null}),sD=M.forwardRef((e,t)=>{let{sizes:s,onSizesChange:r,...a}=e,n=sM(sP,e.__scopeScrollArea),[i,o]=M.useState(),l=M.useRef(null),c=(0,tx.useComposedRefs)(t,l,n.onScrollbarXChange);return M.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),(0,N.jsx)(sO,{"data-orientation":"horizontal",...a,ref:c,sizes:s,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":sX(s)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,s)=>{if(n.viewport){var r,a;let i=n.viewport.scrollLeft+t.deltaX;e.onWheelScroll(i),r=i,a=s,r>0&&r<a&&t.preventDefault()}},onResize:()=>{l.current&&n.viewport&&i&&r({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:sq(i.paddingLeft),paddingEnd:sq(i.paddingRight)}})}})}),sB=M.forwardRef((e,t)=>{let{sizes:s,onSizesChange:r,...a}=e,n=sM(sP,e.__scopeScrollArea),[i,o]=M.useState(),l=M.useRef(null),c=(0,tx.useComposedRefs)(t,l,n.onScrollbarYChange);return M.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),(0,N.jsx)(sO,{"data-orientation":"vertical",...a,ref:c,sizes:s,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":sX(s)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,s)=>{if(n.viewport){var r,a;let i=n.viewport.scrollTop+t.deltaY;e.onWheelScroll(i),r=i,a=s,r>0&&r<a&&t.preventDefault()}},onResize:()=>{l.current&&n.viewport&&i&&r({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:sq(i.paddingTop),paddingEnd:sq(i.paddingBottom)}})}})}),[sI,sL]=sj(sP),sO=M.forwardRef((e,t)=>{let{__scopeScrollArea:s,sizes:r,hasThumb:a,onThumbChange:n,onThumbPointerUp:i,onThumbPointerDown:o,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:u,...h}=e,f=sM(sP,s),[p,m]=M.useState(null),x=(0,tx.useComposedRefs)(t,e=>m(e)),g=M.useRef(null),b=M.useRef(""),y=f.viewport,v=r.content-r.viewport,w=(0,sx.useCallbackRef)(d),j=(0,sx.useCallbackRef)(l),k=sZ(u,10);function S(e){g.current&&c({x:e.clientX-g.current.left,y:e.clientY-g.current.top})}return M.useEffect(()=>{let e=e=>{let t=e.target;p?.contains(t)&&w(e,v)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[y,p,v,w]),M.useEffect(j,[r,j]),sQ(p,k),sQ(f.content,k),(0,N.jsx)(sI,{scope:s,scrollbar:p,hasThumb:a,onThumbChange:(0,sx.useCallbackRef)(n),onThumbPointerUp:(0,sx.useCallbackRef)(i),onThumbPositionChange:j,onThumbPointerDown:(0,sx.useCallbackRef)(o),children:(0,N.jsx)(sf.Primitive.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:(0,sv.composeEventHandlers)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),g.current=p.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),S(e))}),onPointerMove:(0,sv.composeEventHandlers)(e.onPointerMove,S),onPointerUp:(0,sv.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})})})}),sF="ScrollAreaThumb",sz=M.forwardRef((e,t)=>{let{forceMount:s,...r}=e,a=sL(sF,e.__scopeScrollArea);return(0,N.jsx)(sp.Presence,{present:s||a.hasThumb,children:(0,N.jsx)(sV,{ref:t,...r})})}),sV=M.forwardRef((e,t)=>{let{__scopeScrollArea:s,style:r,...a}=e,n=sM(sF,s),i=sL(sF,s),{onThumbPositionChange:o}=i,l=(0,tx.useComposedRefs)(t,e=>i.onThumbChange(e)),c=M.useRef(void 0),d=sZ(()=>{c.current&&(c.current(),c.current=void 0)},100);return M.useEffect(()=>{let e=n.viewport;if(e){let t=()=>{d(),c.current||(c.current=sJ(e,o),o())};return o(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[n.viewport,d,o]),(0,N.jsx)(sf.Primitive.div,{"data-state":i.hasThumb?"visible":"hidden",...a,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:(0,sv.composeEventHandlers)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),s=e.clientX-t.left,r=e.clientY-t.top;i.onThumbPointerDown({x:s,y:r})}),onPointerUp:(0,sv.composeEventHandlers)(e.onPointerUp,i.onThumbPointerUp)})});sz.displayName=sF;var sU="ScrollAreaCorner",sW=M.forwardRef((e,t)=>{let s=sM(sU,e.__scopeScrollArea),r=!!(s.scrollbarX&&s.scrollbarY);return"scroll"!==s.type&&r?(0,N.jsx)(sH,{...e,ref:t}):null});sW.displayName=sU;var sH=M.forwardRef((e,t)=>{let{__scopeScrollArea:s,...r}=e,a=sM(sU,s),[n,i]=M.useState(0),[o,l]=M.useState(0),c=!!(n&&o);return sQ(a.scrollbarX,()=>{let e=a.scrollbarX?.offsetHeight||0;a.onCornerHeightChange(e),l(e)}),sQ(a.scrollbarY,()=>{let e=a.scrollbarY?.offsetWidth||0;a.onCornerWidthChange(e),i(e)}),c?(0,N.jsx)(sf.Primitive.div,{...r,ref:t,style:{width:n,height:o,position:"absolute",right:"ltr"===a.dir?0:void 0,left:"rtl"===a.dir?0:void 0,bottom:0,...e.style}}):null});function sq(e){return e?parseInt(e,10):0}function sK(e,t){let s=e/t;return isNaN(s)?0:s}function sX(e){let t=sK(e.viewport,e.content),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-s)*t,18)}function sY(e,t,s="ltr"){let r=sX(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=t.scrollbar.size-a,i=t.content-t.viewport,o=function(e,[t,s]){return Math.min(s,Math.max(t,e))}(e,"ltr"===s?[0,i]:[-1*i,0]);return sG([0,i],[0,n-r])(o)}function sG(e,t){return s=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(s-e[0])}}var sJ=(e,t=()=>{})=>{let s={left:e.scrollLeft,top:e.scrollTop},r=0;return!function a(){let n={left:e.scrollLeft,top:e.scrollTop},i=s.left!==n.left,o=s.top!==n.top;(i||o)&&t(),s=n,r=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(r)};function sZ(e,t){let s=(0,sx.useCallbackRef)(e),r=M.useRef(0);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),M.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(s,t)},[s,t])}function sQ(e,t){let s=(0,sx.useCallbackRef)(t);(0,sy.useLayoutEffect)(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,s])}function s0({className:e,children:t,...s}){return(0,N.jsxs)(sS,{"data-slot":"scroll-area",className:(0,tL.cn)("relative",e),...s,children:[(0,N.jsx)(sC,{"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,N.jsx)(s1,{}),(0,N.jsx)(sW,{})]})}function s1({className:e,orientation:t="vertical",...s}){return(0,N.jsx)(sE,{"data-slot":"scroll-area-scrollbar",orientation:t,className:(0,tL.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),...s,children:(0,N.jsx)(sz,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}let s2=["","寂灭前夜","谐振纪","飞升潮","回响纪","接触纪"];function s5(){let e=td(e=>e.fragments),t=td(e=>e.totalDecoded),s=function(e){for(let t of O)if(e<t.threshold)return t.threshold;return null}(t),[r,a]=(0,M.useState)(null),n=O.filter(e=>1===e.era),i=n.filter(t=>e[t.id]).length;return(0,N.jsxs)("div",{className:"flex flex-col gap-2 h-full",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsxs)("h3",{className:"text-sm font-semibold flex items-center gap-1.5",children:[(0,N.jsx)(sl,{className:"h-4 w-4 text-fuchsia-400"}),"记忆图谱"]}),(0,N.jsxs)("span",{className:"text-xs text-muted-foreground",children:[i,"/",n.length," · 第一纪元"]})]}),s&&(0,N.jsxs)("div",{className:"text-[10px] text-muted-foreground/80 px-1",children:["再解码 ",(0,N.jsx)("span",{className:"text-fuchsia-300 font-mono",children:s-t})," 颗 → 下一个碎片"]}),(0,N.jsx)(s0,{className:"flex-1 min-h-0",children:(0,N.jsx)("div",{className:"grid grid-cols-2 gap-2 pr-2",children:n.map((t,s)=>{let r=!!e[t.id];return(0,N.jsxs)("button",{onClick:()=>r&&a(t),disabled:!r,className:`relative aspect-[4/3] rounded-xl border text-left p-2 transition-all duration-300 overflow-hidden ${r?"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:r?{boxShadow:"0 0 16px rgba(232,121,249,0.15)"}:void 0,children:[(0,N.jsx)("span",{className:`absolute top-1.5 right-1.5 text-[9px] font-mono ${r?"text-fuchsia-300/70":"text-white/20"}`,children:String(s+1).padStart(2,"0")}),r?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{className:"absolute -top-3 -right-3 h-12 w-12 rounded-full bg-fuchsia-500/20 blur-xl"}),(0,N.jsx)(t7,{className:"h-3 w-3 text-fuchsia-300 mb-1"}),(0,N.jsx)("div",{className:"text-[11px] font-semibold text-fuchsia-100 leading-tight",children:t.title}),(0,N.jsxs)("div",{className:"text-[9px] text-muted-foreground mt-1 line-clamp-2",children:[t.echo.slice(0,28),"…"]})]}):(0,N.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-1",children:[(0,N.jsx)(sc,{className:"h-4 w-4 text-white/20"}),(0,N.jsxs)("span",{className:"text-[9px] text-white/30",children:["需解码 ",t.threshold," 颗"]})]})]},t.id)})})}),r&&(0,N.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",onClick:()=>a(null),children:(0,N.jsxs)(sa,{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,N.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,N.jsx)(t7,{className:"h-4 w-4 text-fuchsia-300"}),(0,N.jsxs)("span",{className:"text-[10px] text-fuchsia-300/70 font-mono",children:["第 ",r.era," 纪元 · ",s2[r.era]||""]})]}),(0,N.jsx)("h4",{className:"text-lg font-bold text-fuchsia-100 mb-3",children:r.title}),(0,N.jsxs)("p",{className:"text-sm text-foreground/90 leading-relaxed italic",children:["「",r.echo,"」"]}),(0,N.jsx)("button",{onClick:()=>a(null),className:"mt-4 text-xs text-muted-foreground hover:text-foreground transition",children:"关闭"})]})})]})}var s3=M[" useId ".trim().toString()]||(()=>void 0),s4=0;function s9(e){let[t,s]=M.useState(s3());return(0,sy.useLayoutEffect)(()=>{e||s(e=>e??String(s4++))},[e]),e||(t?`radix-${t}`:"")}var s7=e.i(69340),s6=e.i(26330),s8="focusScope.autoFocusOnMount",re="focusScope.autoFocusOnUnmount",rt={bubbles:!1,cancelable:!0},rs=M.forwardRef((e,t)=>{let{loop:s=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:n,...i}=e,[o,l]=M.useState(null),c=(0,sx.useCallbackRef)(a),d=(0,sx.useCallbackRef)(n),u=M.useRef(null),h=(0,tx.useComposedRefs)(t,e=>l(e)),f=M.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;M.useEffect(()=>{if(r){let e=function(e){if(f.paused||!o)return;let t=e.target;o.contains(t)?u.current=t:rn(u.current,{select:!0})},t=function(e){if(f.paused||!o)return;let t=e.relatedTarget;null!==t&&(o.contains(t)||rn(u.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let s=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&rn(o)});return o&&s.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),s.disconnect()}}},[r,o,f.paused]),M.useEffect(()=>{if(o){ri.add(f);let e=document.activeElement;if(!o.contains(e)){let t=new CustomEvent(s8,rt);o.addEventListener(s8,c),o.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let s=document.activeElement;for(let r of e)if(rn(r,{select:t}),document.activeElement!==s)return}(rr(o).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&rn(o))}return()=>{o.removeEventListener(s8,c),setTimeout(()=>{let t=new CustomEvent(re,rt);o.addEventListener(re,d),o.dispatchEvent(t),t.defaultPrevented||rn(e??document.body,{select:!0}),o.removeEventListener(re,d),ri.remove(f)},0)}}},[o,c,d,f]);let p=M.useCallback(e=>{if(!s&&!r||f.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,a=document.activeElement;if(t&&a){var n;let t,r=e.currentTarget,[i,o]=[ra(t=rr(n=r),n),ra(t.reverse(),n)];i&&o?e.shiftKey||a!==o?e.shiftKey&&a===i&&(e.preventDefault(),s&&rn(o,{select:!0})):(e.preventDefault(),s&&rn(i,{select:!0})):a===r&&e.preventDefault()}},[s,r,f.paused]);return(0,N.jsx)(sf.Primitive.div,{tabIndex:-1,...i,ref:h,onKeyDown:p})});function rr(e){let t=[],s=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(;s.nextNode();)t.push(s.currentNode);return t}function ra(e,t){for(let s 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}(s,{upTo:t}))return s}function rn(e,{select:t=!1}={}){if(e&&e.focus){var s;let r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&(s=e)instanceof HTMLInputElement&&"select"in s&&t&&e.select()}}rs.displayName="FocusScope";var ri=(u=[],{add(e){let t=u[0];e!==t&&t?.pause(),(u=ro(u,e)).unshift(e)},remove(e){u=ro(u,e),u[0]?.resume()}});function ro(e,t){let s=[...e],r=s.indexOf(t);return -1!==r&&s.splice(r,1),s}var rl=e.i(74606),rc=0;function rd(){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 ru=function(){return(ru=Object.assign||function(e){for(var t,s=1,r=arguments.length;s<r;s++)for(var a in t=arguments[s])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)};function rh(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(s[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,r=Object.getOwnPropertySymbols(e);a<r.length;a++)0>t.indexOf(r[a])&&Object.prototype.propertyIsEnumerable.call(e,r[a])&&(s[r[a]]=e[r[a]]);return s}var rf=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),rp="width-before-scroll-bar";function rm(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var rx="u">typeof window?M.useLayoutEffect:M.useEffect,rg=new WeakMap,rb=(void 0===p&&(p={}),(void 0===m&&(m=function(e){return e}),x=[],g=!1,b={read:function(){if(g)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return x.length?x[x.length-1]:null},useMedium:function(e){var t=m(e,g);return x.push(t),function(){x=x.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(g=!0;x.length;){var t=x;x=[],t.forEach(e)}x={push:function(t){return e(t)},filter:function(){return x}}},assignMedium:function(e){g=!0;var t=[];if(x.length){var s=x;x=[],s.forEach(e),t=x}var r=function(){var s=t;t=[],s.forEach(e)},a=function(){return Promise.resolve().then(r)};a(),x={push:function(e){t.push(e),a()},filter:function(e){return t=t.filter(e),x}}}}).options=ru({async:!0,ssr:!1},p),b),ry=function(){},rv=M.forwardRef(function(e,t){var s,r,a,n,i=M.useRef(null),o=M.useState({onScrollCapture:ry,onWheelCapture:ry,onTouchMoveCapture:ry}),l=o[0],c=o[1],d=e.forwardProps,u=e.children,h=e.className,f=e.removeScrollBar,p=e.enabled,m=e.shards,x=e.sideCar,g=e.noRelative,b=e.noIsolation,y=e.inert,v=e.allowPinchZoom,w=e.as,j=e.gapMode,k=rh(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=(s=[i,t],r=function(e){return s.forEach(function(t){return rm(t,e)})},(a=(0,M.useState)(function(){return{value:null,callback:r,facade:{get current(){return a.value},set current(value){var e=a.value;e!==value&&(a.value=value,a.callback(value,e))}}}})[0]).callback=r,n=a.facade,rx(function(){var e=rg.get(n);if(e){var t=new Set(e),r=new Set(s),a=n.current;t.forEach(function(e){r.has(e)||rm(e,null)}),r.forEach(function(e){t.has(e)||rm(e,a)})}rg.set(n,s)},[s]),n),S=ru(ru({},k),l);return M.createElement(M.Fragment,null,p&&M.createElement(x,{sideCar:rb,removeScrollBar:f,shards:m,noRelative:g,noIsolation:b,inert:y,setCallbacks:c,allowPinchZoom:!!v,lockRef:i,gapMode:j}),d?M.cloneElement(M.Children.only(u),ru(ru({},S),{ref:N})):M.createElement(void 0===w?"div":w,ru({},S,{className:h,ref:N}),u))});rv.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},rv.classNames={fullWidth:rp,zeroRight:rf};var rw=function(e){var t=e.sideCar,s=rh(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error("Sidecar medium not found");return M.createElement(r,ru({},s))};rw.isSideCarExport=!0;var rj=function(){var e=0,t=null;return{add:function(s){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=j||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var r,a;(r=t).styleSheet?r.styleSheet.cssText=s:r.appendChild(document.createTextNode(s)),a=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(a)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},rk=function(){var e=rj();return function(t,s){M.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&s])}},rN=function(){var e=rk();return function(t){return e(t.styles,t.dynamic),null}},rM={left:0,top:0,right:0,gap:0},rS=function(e){return parseInt(e||"",10)||0},rT=function(e){var t=window.getComputedStyle(document.body),s=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],a=t["padding"===e?"paddingRight":"marginRight"];return[rS(s),rS(r),rS(a)]},rC=function(e){if(void 0===e&&(e="margin"),"u"<typeof window)return rM;var t=rT(e),s=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-s+t[2]-t[0])}},rP=rN(),rE="data-scroll-locked",r_=function(e,t,s,r){var a=e.left,n=e.top,i=e.right,o=e.gap;return void 0===s&&(s="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(o,"px ").concat(r,";\n }\n body[").concat(rE,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===s&&"\n padding-left: ".concat(a,"px;\n padding-top: ").concat(n,"px;\n padding-right: ").concat(i,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(o,"px ").concat(r,";\n "),"padding"===s&&"padding-right: ".concat(o,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(rf," {\n right: ").concat(o,"px ").concat(r,";\n }\n \n .").concat(rp," {\n margin-right: ").concat(o,"px ").concat(r,";\n }\n \n .").concat(rf," .").concat(rf," {\n right: 0 ").concat(r,";\n }\n \n .").concat(rp," .").concat(rp," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(rE,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(o,"px;\n }\n")},rR=function(){var e=parseInt(document.body.getAttribute(rE)||"0",10);return isFinite(e)?e:0},rA=function(){M.useEffect(function(){return document.body.setAttribute(rE,(rR()+1).toString()),function(){var e=rR()-1;e<=0?document.body.removeAttribute(rE):document.body.setAttribute(rE,e.toString())}},[])},r$=function(e){var t=e.noRelative,s=e.noImportant,r=e.gapMode,a=void 0===r?"margin":r;rA();var n=M.useMemo(function(){return rC(a)},[a]);return M.createElement(rP,{styles:r_(n,!t,a,s?"":"!important")})},rD=!1;if("u">typeof window)try{var rB=Object.defineProperty({},"passive",{get:function(){return rD=!0,!0}});window.addEventListener("test",rB,rB),window.removeEventListener("test",rB,rB)}catch(e){rD=!1}var rI=!!rD&&{passive:!1},rL=function(e,t){if(!(e instanceof Element))return!1;var s=window.getComputedStyle(e);return"hidden"!==s[t]&&(s.overflowY!==s.overflowX||"TEXTAREA"===e.tagName||"visible"!==s[t])},rO=function(e,t){var s=t.ownerDocument,r=t;do{if("u">typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),rF(e,r)){var a=rz(e,r);if(a[1]>a[2])return!0}r=r.parentNode}while(r&&r!==s.body)return!1},rF=function(e,t){return"v"===e?rL(t,"overflowY"):rL(t,"overflowX")},rz=function(e,t){return"v"===e?[t.scrollTop,t.scrollHeight,t.clientHeight]:[t.scrollLeft,t.scrollWidth,t.clientWidth]},rV=function(e,t,s,r,a){var n,i=(n=window.getComputedStyle(t).direction,"h"===e&&"rtl"===n?-1:1),o=i*r,l=s.target,c=t.contains(l),d=!1,u=o>0,h=0,f=0;do{if(!l)break;var p=rz(e,l),m=p[0],x=p[1]-p[2]-i*m;(m||x)&&rF(e,l)&&(h+=x,f+=m);var g=l.parentNode;l=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&l!==document.body||c&&(t.contains(l)||t===l))return u&&(a&&1>Math.abs(h)||!a&&o>h)?d=!0:!u&&(a&&1>Math.abs(f)||!a&&-o>f)&&(d=!0),d},rU=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rW=function(e){return[e.deltaX,e.deltaY]},rH=function(e){return e&&"current"in e?e.current:e},rq=0,rK=[];let rX=(y=function(e){var t=M.useRef([]),s=M.useRef([0,0]),r=M.useRef(),a=M.useState(rq++)[0],n=M.useState(rN)[0],i=M.useRef(e);M.useEffect(function(){i.current=e},[e]),M.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var t=(function(e,t,s){if(s||2==arguments.length)for(var r,a=0,n=t.length;a<n;a++)!r&&a in t||(r||(r=Array.prototype.slice.call(t,0,a)),r[a]=t[a]);return e.concat(r||Array.prototype.slice.call(t))})([e.lockRef.current],(e.shards||[]).map(rH),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),t.forEach(function(e){return e.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var o=M.useCallback(function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!i.current.allowPinchZoom;var a,n=rU(e),o=s.current,l="deltaX"in e?e.deltaX:o[0]-n[0],c="deltaY"in e?e.deltaY:o[1]-n[1],d=e.target,u=Math.abs(l)>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 p=rO(u,d);if(!p)return!0;if(p?a=u:(a="v"===u?"h":"v",p=rO(u,d)),!p)return!1;if(!r.current&&"changedTouches"in e&&(l||c)&&(r.current=a),!a)return!0;var m=r.current||a;return rV(m,t,e,"h"===m?l:c,!0)},[]),l=M.useCallback(function(e){if(rK.length&&rK[rK.length-1]===n){var s="deltaY"in e?rW(e):rU(e),r=t.current.filter(function(t){var r;return t.name===e.type&&(t.target===e.target||e.target===t.shadowParent)&&(r=t.delta,r[0]===s[0]&&r[1]===s[1])})[0];if(r&&r.should){e.cancelable&&e.preventDefault();return}if(!r){var a=(i.current.shards||[]).map(rH).filter(Boolean).filter(function(t){return t.contains(e.target)});(a.length>0?o(e,a[0]):!i.current.noIsolation)&&e.cancelable&&e.preventDefault()}}},[]),c=M.useCallback(function(e,s,r,a){var n={name:e,delta:s,target:r,should:a,shadowParent:function(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}(r)};t.current.push(n),setTimeout(function(){t.current=t.current.filter(function(e){return e!==n})},1)},[]),d=M.useCallback(function(e){s.current=rU(e),r.current=void 0},[]),u=M.useCallback(function(t){c(t.type,rW(t),t.target,o(t,e.lockRef.current))},[]),h=M.useCallback(function(t){c(t.type,rU(t),t.target,o(t,e.lockRef.current))},[]);M.useEffect(function(){return rK.push(n),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",l,rI),document.addEventListener("touchmove",l,rI),document.addEventListener("touchstart",d,rI),function(){rK=rK.filter(function(e){return e!==n}),document.removeEventListener("wheel",l,rI),document.removeEventListener("touchmove",l,rI),document.removeEventListener("touchstart",d,rI)}},[]);var f=e.removeScrollBar,p=e.inert;return M.createElement(M.Fragment,null,p?M.createElement(n,{styles:"\n .block-interactivity-".concat(a," {pointer-events: none;}\n .allow-interactivity-").concat(a," {pointer-events: all;}\n")}):null,f?M.createElement(r$,{noRelative:e.noRelative,gapMode:e.gapMode}):null)},rb.useMedium(y),rw);var rY=M.forwardRef(function(e,t){return M.createElement(rv,ru({},e,{ref:t,sideCar:rX}))});rY.classNames=rv.classNames;var rG=new WeakMap,rJ=new WeakMap,rZ={},rQ=0,r0=function(e){return e&&(e.host||r0(e.parentNode))},r1=function(e,t,s,r){var a=(Array.isArray(e)?e:[e]).map(function(e){if(t.contains(e))return e;var s=r0(e);return s&&t.contains(s)?s:(console.error("aria-hidden",e,"in not contained inside",t,". Doing nothing"),null)}).filter(function(e){return!!e});rZ[s]||(rZ[s]=new WeakMap);var n=rZ[s],i=[],o=new Set,l=new Set(a),c=function(e){!e||o.has(e)||(o.add(e),c(e.parentNode))};a.forEach(c);var d=function(e){!e||l.has(e)||Array.prototype.forEach.call(e.children,function(e){if(o.has(e))d(e);else try{var t=e.getAttribute(r),a=null!==t&&"false"!==t,l=(rG.get(e)||0)+1,c=(n.get(e)||0)+1;rG.set(e,l),n.set(e,c),i.push(e),1===l&&a&&rJ.set(e,!0),1===c&&e.setAttribute(s,"true"),a||e.setAttribute(r,"true")}catch(t){console.error("aria-hidden: cannot operate on ",e,t)}})};return d(t),o.clear(),rQ++,function(){i.forEach(function(e){var t=rG.get(e)-1,a=n.get(e)-1;rG.set(e,t),n.set(e,a),t||(rJ.has(e)||e.removeAttribute(r),rJ.delete(e)),a||e.removeAttribute(s)}),--rQ||(rG=new WeakMap,rG=new WeakMap,rJ=new WeakMap,rZ={})}},r2=function(e,t,s){void 0===s&&(s="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),a=t||("u"<typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body);return a?(r.push.apply(r,Array.from(a.querySelectorAll("[aria-live], script"))),r1(r,a,s,"aria-hidden")):function(){return null}},r5=Symbol("radix.slottable");function r3(e){return M.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===r5}var r4="Dialog",[r9,r7]=(0,sm.createContextScope)(r4),[r6,r8]=r9(r4),ae=e=>{let{__scopeDialog:t,children:s,open:r,defaultOpen:a,onOpenChange:n,modal:i=!0}=e,o=M.useRef(null),l=M.useRef(null),[c,d]=(0,s7.useControllableState)({prop:r,defaultProp:a??!1,onChange:n,caller:r4});return(0,N.jsx)(r6,{scope:t,triggerRef:o,contentRef:l,contentId:s9(),titleId:s9(),descriptionId:s9(),open:c,onOpenChange:d,onOpenToggle:M.useCallback(()=>d(e=>!e),[d]),modal:i,children:s})};ae.displayName=r4;var at="DialogTrigger";M.forwardRef((e,t)=>{let{__scopeDialog:s,...r}=e,a=r8(at,s),n=(0,tx.useComposedRefs)(t,a.triggerRef);return(0,N.jsx)(sf.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":aw(a.open),...r,ref:n,onClick:(0,sv.composeEventHandlers)(e.onClick,a.onOpenToggle)})}).displayName=at;var as="DialogPortal",[ar,aa]=r9(as,{forceMount:void 0}),an=e=>{let{__scopeDialog:t,forceMount:s,children:r,container:a}=e,n=r8(as,t);return(0,N.jsx)(ar,{scope:t,forceMount:s,children:M.Children.map(r,e=>(0,N.jsx)(sp.Presence,{present:s||n.open,children:(0,N.jsx)(rl.Portal,{asChild:!0,container:a,children:e})}))})};an.displayName=as;var ai="DialogOverlay",ao=M.forwardRef((e,t)=>{let s=aa(ai,e.__scopeDialog),{forceMount:r=s.forceMount,...a}=e,n=r8(ai,e.__scopeDialog);return n.modal?(0,N.jsx)(sp.Presence,{present:r||n.open,children:(0,N.jsx)(ac,{...a,ref:t})}):null});ao.displayName=ai;var al=((h=M.forwardRef((e,t)=>{let{children:s,...r}=e;if(M.isValidElement(s)){var a;let e,n,i=(a=s,(n=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(n=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),o=function(e,t){let s={...t};for(let r in t){let a=e[r],n=t[r];/^on[A-Z]/.test(r)?a&&n?s[r]=(...e)=>{let t=n(...e);return a(...e),t}:a&&(s[r]=a):"style"===r?s[r]={...a,...n}:"className"===r&&(s[r]=[a,n].filter(Boolean).join(" "))}return{...e,...s}}(r,s.props);return s.type!==M.Fragment&&(o.ref=t?(0,tx.composeRefs)(t,i):i),M.cloneElement(s,o)}return M.Children.count(s)>1?M.Children.only(null):null})).displayName="DialogOverlay.RemoveScroll.SlotClone",o=h,(l=M.forwardRef((e,t)=>{let{children:s,...r}=e,a=M.Children.toArray(s),n=a.find(r3);if(n){let e=n.props.children,s=a.map(t=>t!==n?t:M.Children.count(e)>1?M.Children.only(null):M.isValidElement(e)?e.props.children:null);return(0,N.jsx)(o,{...r,ref:t,children:M.isValidElement(e)?M.cloneElement(e,void 0,s):null})}return(0,N.jsx)(o,{...r,ref:t,children:s})})).displayName="DialogOverlay.RemoveScroll.Slot",l),ac=M.forwardRef((e,t)=>{let{__scopeDialog:s,...r}=e,a=r8(ai,s);return(0,N.jsx)(rY,{as:al,allowPinchZoom:!0,shards:[a.contentRef],children:(0,N.jsx)(sf.Primitive.div,{"data-state":aw(a.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),ad="DialogContent",au=M.forwardRef((e,t)=>{let s=aa(ad,e.__scopeDialog),{forceMount:r=s.forceMount,...a}=e,n=r8(ad,e.__scopeDialog);return(0,N.jsx)(sp.Presence,{present:r||n.open,children:n.modal?(0,N.jsx)(ah,{...a,ref:t}):(0,N.jsx)(af,{...a,ref:t})})});au.displayName=ad;var ah=M.forwardRef((e,t)=>{let s=r8(ad,e.__scopeDialog),r=M.useRef(null),a=(0,tx.useComposedRefs)(t,s.contentRef,r);return M.useEffect(()=>{let e=r.current;if(e)return r2(e)},[]),(0,N.jsx)(ap,{...e,ref:a,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,sv.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),s.triggerRef.current?.focus()}),onPointerDownOutside:(0,sv.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,s=0===t.button&&!0===t.ctrlKey;(2===t.button||s)&&e.preventDefault()}),onFocusOutside:(0,sv.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault())})}),af=M.forwardRef((e,t)=>{let s=r8(ad,e.__scopeDialog),r=M.useRef(!1),a=M.useRef(!1);return(0,N.jsx)(ap,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||s.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,a.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,"pointerdown"===t.detail.originalEvent.type&&(a.current=!0));let n=t.target;s.triggerRef.current?.contains(n)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&a.current&&t.preventDefault()}})}),ap=M.forwardRef((e,t)=>{let{__scopeDialog:s,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:n,...i}=e,o=r8(ad,s),l=M.useRef(null),c=(0,tx.useComposedRefs)(t,l);return M.useEffect(()=>{let e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rd()),document.body.insertAdjacentElement("beforeend",e[1]??rd()),rc++,()=>{1===rc&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),rc--}},[]),(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(rs,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:n,children:(0,N.jsx)(s6.DismissableLayer,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":aw(o.open),...i,ref:c,onDismiss:()=>o.onOpenChange(!1)})}),(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(aM,{titleId:o.titleId}),(0,N.jsx)(aS,{contentRef:l,descriptionId:o.descriptionId})]})]})}),am="DialogTitle",ax=M.forwardRef((e,t)=>{let{__scopeDialog:s,...r}=e,a=r8(am,s);return(0,N.jsx)(sf.Primitive.h2,{id:a.titleId,...r,ref:t})});ax.displayName=am;var ag="DialogDescription",ab=M.forwardRef((e,t)=>{let{__scopeDialog:s,...r}=e,a=r8(ag,s);return(0,N.jsx)(sf.Primitive.p,{id:a.descriptionId,...r,ref:t})});ab.displayName=ag;var ay="DialogClose",av=M.forwardRef((e,t)=>{let{__scopeDialog:s,...r}=e,a=r8(ay,s);return(0,N.jsx)(sf.Primitive.button,{type:"button",...r,ref:t,onClick:(0,sv.composeEventHandlers)(e.onClick,()=>a.onOpenChange(!1))})});function aw(e){return e?"open":"closed"}av.displayName=ay;var aj="DialogTitleWarning",[ak,aN]=(0,sm.createContext)(aj,{contentName:ad,titleName:am,docsSlug:"dialog"}),aM=({titleId:e})=>{let t=aN(aj),s=`\`${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 M.useEffect(()=>{e&&(document.getElementById(e)||console.error(s))},[s,e]),null},aS=({contentRef:e,descriptionId:t})=>{let s=aN("DialogDescriptionWarning"),r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${s.contentName}}.`;return M.useEffect(()=>{let s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},aT=e.i(41947),aT=aT;function aC({...e}){return(0,N.jsx)(ae,{"data-slot":"dialog",...e})}function aP({...e}){return(0,N.jsx)(an,{"data-slot":"dialog-portal",...e})}function aE({className:e,...t}){return(0,N.jsx)(ao,{"data-slot":"dialog-overlay",className:(0,tL.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 a_({className:e,children:t,showCloseButton:s=!0,...r}){return(0,N.jsxs)(aP,{"data-slot":"dialog-portal",children:[(0,N.jsx)(aE,{}),(0,N.jsxs)(au,{"data-slot":"dialog-content",className:(0,tL.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),...r,children:[t,s&&(0,N.jsxs)(av,{"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,N.jsx)(aT.default,{}),(0,N.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function aR({className:e,...t}){return(0,N.jsx)("div",{"data-slot":"dialog-header",className:(0,tL.cn)("flex flex-col gap-2 text-center sm:text-left",e),...t})}function aA({className:e,...t}){return(0,N.jsx)("div",{"data-slot":"dialog-footer",className:(0,tL.cn)("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function a$({className:e,...t}){return(0,N.jsx)(ax,{"data-slot":"dialog-title",className:(0,tL.cn)("text-lg leading-none font-semibold",e),...t})}function aD({className:e,...t}){return(0,N.jsx)(ab,{"data-slot":"dialog-description",className:(0,tL.cn)("text-muted-foreground text-sm",e),...t})}let aB=(0,tu.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 aI({open:e,onOpenChange:t}){let s=td(),r=td(e=>e.doPrestige),{toast:a}=(0,tU.useToast)(),[n,i]=(0,M.useState)(!1),[o,l]=(0,M.useState)(!1),c=ek(s);s.blueprints.length;let d=Math.min(6,s.blueprints.length+c),u=es(s.constellation??[]);return(0,N.jsx)(aC,{open:e,onOpenChange:t,children:(0,N.jsxs)(a_,{className:"bg-gradient-to-br from-fuchsia-950/70 to-black/90 border-fuchsia-400/40",children:[(0,N.jsxs)(aR,{children:[(0,N.jsxs)(a$,{className:"flex items-center gap-2 text-fuchsia-100",children:[(0,N.jsx)(tm,{className:"h-5 w-5"}),"飞升 · 跨越维度"]}),(0,N.jsx)(aD,{className:"text-fuchsia-200/70",children:"当接触进度满溢,你将跨越维度与以太族相会。本次飞升将重置资源与技术,但保留记忆图谱与蓝图加成。"})]}),(0,N.jsxs)("div",{className:"space-y-3 py-2",children:[(0,N.jsxs)("div",{className:"rounded-lg border border-fuchsia-400/30 bg-fuchsia-950/30 p-3",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsx)("span",{className:"text-sm text-fuchsia-200",children:"本次获得蓝图"}),(0,N.jsxs)("span",{className:"text-2xl font-mono font-bold text-fuchsia-100",children:["+",c]})]}),(0,N.jsxs)("p",{className:"text-[11px] text-muted-foreground mt-1",children:["蓝图总数将达 ",d,"/",6,"(每 ",20," 次解码产出 1 张)"]})]}),(0,N.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,N.jsx)(aL,{label:"产能",value:`+${(d*F*100).toFixed(0)}%`,color:"#34d399"}),(0,N.jsx)(aL,{label:"洞见",value:`+${(d*z*100).toFixed(0)}%`,color:"#fbbf24"}),(0,N.jsx)(aL,{label:"接触",value:`+${(d*V*100).toFixed(0)}%`,color:"#e879f9"})]}),(0,N.jsxs)("div",{className:"text-[11px] text-muted-foreground space-y-1 pt-1",children:[(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(t7,{className:"h-3 w-3 text-fuchsia-400"}),"保留:记忆图谱、累计解码数、飞升次数、蓝图、星图天赋"]}),(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(tm,{className:"h-3 w-3 text-rose-400"}),"重置:晶体、洞见、技术树、接触进度、待解码晶体"]})]}),(0,N.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,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(aB,{className:"h-4 w-4 text-fuchsia-300"}),(0,N.jsxs)("div",{className:"flex-1",children:[(0,N.jsx)("div",{className:"text-[12px] text-fuchsia-200 font-bold",children:"星图觉醒预告"}),(0,N.jsxs)("div",{className:"text-[10px] text-muted-foreground",children:["飞升后将从 3 道随机天赋中选 1,永久获得加成",u.unlocked<u.total&&(0,N.jsxs)("span",{className:"text-fuchsia-300/80",children:[" · 当前 ",u.unlocked,"/",u.total]})]})]}),(0,N.jsx)("div",{className:"text-[10px] text-fuchsia-300/70 font-mono",children:u.unlocked<u.total?"✦ 可觉醒":"✧ 已圆满"})]})}),(0,N.jsxs)("div",{className:"rounded-lg border border-violet-400/25 bg-violet-950/20 p-2.5 flex items-center gap-2",children:[(0,N.jsx)(sl,{className:"h-4 w-4 text-violet-300 flex-shrink-0"}),(0,N.jsxs)("div",{className:"flex-1 text-[10px] text-violet-100/70 leading-relaxed",children:["本次飞升将铭刻入",(0,N.jsx)("span",{className:"text-violet-200 font-bold",children:"回响编年史"}),", 记录本周目的解码、探险、星潮与觉醒天赋,形成永恒叙事时间轴。"]})]})]}),(0,N.jsxs)(aA,{children:[(0,N.jsx)(t4,{variant:"ghost",onClick:()=>t(!1),children:"取消"}),(0,N.jsx)(t4,{disabled:n&&!o,onClick:()=>{if(!n){i(!0),l(!1),window.setTimeout(()=>l(!0),900);return}let e=r();t(!1),i(!1),l(!1),e&&(tX("prestige"),window.setTimeout(()=>tX("chronicle"),600),a({title:"✦ 飞升成功",description:`获得 ${e.newBp} 张蓝图,进入第 ${s.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?o?"再次确认飞升":"请确认…":c<=0?"飞升(无新蓝图)":"飞升"})]})]})})}function aL({label:e,value:t,color:s}){return(0,N.jsxs)("div",{className:"rounded-lg border p-2 text-center",style:{borderColor:`${s}44`,background:`${s}11`},children:[(0,N.jsx)("div",{className:"text-[10px] text-muted-foreground",children:e}),(0,N.jsx)("div",{className:"text-sm font-mono font-bold",style:{color:s},children:t})]})}var aO="Switch",[aF,az]=(0,sm.createContextScope)(aO),[aV,aU]=aF(aO),aW=M.forwardRef((e,t)=>{let{__scopeSwitch:s,name:r,checked:a,defaultChecked:n,required:i,disabled:o,value:l="on",onCheckedChange:c,form:d,...u}=e,[h,f]=M.useState(null),p=(0,tx.useComposedRefs)(t,e=>f(e)),m=M.useRef(!1),x=!h||d||!!h.closest("form"),[g,b]=(0,s7.useControllableState)({prop:a,defaultProp:n??!1,onChange:c,caller:aO});return(0,N.jsxs)(aV,{scope:s,checked:g,disabled:o,children:[(0,N.jsx)(sf.Primitive.button,{type:"button",role:"switch","aria-checked":g,"aria-required":i,"data-state":aX(g),"data-disabled":o?"":void 0,disabled:o,value:l,...u,ref:p,onClick:(0,sv.composeEventHandlers)(e.onClick,e=>{b(e=>!e),x&&(m.current=e.isPropagationStopped(),m.current||e.stopPropagation())})}),x&&(0,N.jsx)(aK,{control:h,bubbles:!m.current,name:r,value:l,checked:g,required:i,disabled:o,form:d,style:{transform:"translateX(-100%)"}})]})});aW.displayName=aO;var aH="SwitchThumb",aq=M.forwardRef((e,t)=>{let{__scopeSwitch:s,...r}=e,a=aU(aH,s);return(0,N.jsx)(sf.Primitive.span,{"data-state":aX(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});aq.displayName=aH;var aK=M.forwardRef(({__scopeSwitch:e,control:t,checked:s,bubbles:r=!0,...a},n)=>{let i,o=M.useRef(null),l=(0,tx.useComposedRefs)(o,n),c=(i=M.useRef({value:s,previous:s}),M.useMemo(()=>(i.current.value!==s&&(i.current.previous=i.current.value,i.current.value=s),i.current.previous),[s])),d=function(e){let[t,s]=M.useState(void 0);return(0,sy.useLayoutEffect)(()=>{if(e){s({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let r,a;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;r=t.inlineSize,a=t.blockSize}else r=e.offsetWidth,a=e.offsetHeight;s({width:r,height:a})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}s(void 0)},[e]),t}(t);return M.useEffect(()=>{let e=o.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(c!==s&&t){let a=new Event("click",{bubbles:r});t.call(e,s),e.dispatchEvent(a)}},[c,s,r]),(0,N.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function aX(e){return e?"checked":"unchecked"}function aY({className:e,...t}){return(0,N.jsx)(aW,{"data-slot":"switch",className:(0,tL.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,N.jsx)(aq,{"data-slot":"switch-thumb",className:(0,tL.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")})})}aK.displayName="SwitchBubbleInput";var aG=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let s=tv(`Primitive.${t}`),r=M.forwardRef((e,r)=>{let{asChild:a,...n}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,N.jsx)(a?s:t,{...n,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),aJ=M.forwardRef((e,t)=>(0,N.jsx)(aG.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));function aZ({className:e,...t}){return(0,N.jsx)(aJ,{"data-slot":"label",className:(0,tL.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})}aJ.displayName="Label";let aQ=(0,tu.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"}]]),a0=(0,tu.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"}]]),a1=(0,tu.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"}]]),a2=(0,tu.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"}]]),a5=(0,tu.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"}]]),a3=[{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深空之中,回响永续。祝你考古愉快。"}],a4="echo-nexus-tutorial-v1";function a9({open:e,onOpenChange:t}){let s=td(e=>e.soundOn),r=td(e=>e.toggleSound),a=td(e=>e.hardReset),n=td(e=>e.ascensions),i=td(e=>e.totalDecoded),{toast:o}=(0,tU.useToast)(),[l,c]=(0,M.useState)(!1);return(0,N.jsx)(aC,{open:e,onOpenChange:t,children:(0,N.jsxs)(a_,{className:"bg-gradient-to-br from-slate-900/80 to-black/90 border-white/15",children:[(0,N.jsxs)(aR,{children:[(0,N.jsx)(a$,{children:"设置"}),(0,N.jsx)(aD,{children:"游戏偏好与存档管理"})]}),(0,N.jsxs)("div",{className:"space-y-4 py-2",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-white/10 bg-black/30 p-3",children:[(0,N.jsxs)("div",{children:[(0,N.jsx)(aZ,{className:"text-sm",children:"音效反馈"}),(0,N.jsx)("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"脉冲、解码、探险、飞升等程序化音效"})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(t4,{size:"sm",variant:"ghost",className:"h-7 px-2 text-muted-foreground hover:text-foreground",onClick:()=>tX("decodeSuccess"),"aria-label":"试听音效",children:(0,N.jsx)(a1,{className:"h-3.5 w-3.5"})}),(0,N.jsx)(aY,{checked:s,onCheckedChange:r})]})]}),(0,N.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-white/10 bg-black/30 p-3",children:[(0,N.jsxs)("div",{children:[(0,N.jsx)(aZ,{className:"text-sm",children:"新手教程"}),(0,N.jsx)("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"重新查看 5 步玩法引导"})]}),(0,N.jsxs)(t4,{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(a4)}catch{}window.dispatchEvent(new CustomEvent("echo-nexus-tutorial-restart")),t(!1)},children:[(0,N.jsx)(a2,{className:"h-3.5 w-3.5 mr-1"}),"重看教程"]})]}),(0,N.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/30 p-3 text-xs space-y-1.5",children:[(0,N.jsxs)("div",{className:"flex justify-between",children:[(0,N.jsx)("span",{className:"text-muted-foreground",children:"累计解码"}),(0,N.jsxs)("span",{className:"font-mono",children:[i," 颗"]})]}),(0,N.jsxs)("div",{className:"flex justify-between",children:[(0,N.jsx)("span",{className:"text-muted-foreground",children:"飞升周目"}),(0,N.jsx)("span",{className:"font-mono",children:n})]}),(0,N.jsxs)("div",{className:"flex justify-between",children:[(0,N.jsx)("span",{className:"text-muted-foreground",children:"存档位置"}),(0,N.jsx)("span",{className:"font-mono text-[10px]",children:"浏览器本地"})]})]}),(0,N.jsxs)("div",{className:"rounded-lg border border-rose-500/30 bg-rose-950/20 p-3",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,N.jsx)(se,{className:"h-4 w-4 text-rose-400"}),(0,N.jsx)("span",{className:"text-sm font-medium text-rose-200",children:"危险操作"})]}),(0,N.jsx)("p",{className:"text-[11px] text-muted-foreground mb-2",children:"清空所有进度,包括记忆图谱与飞升记录,不可恢复。"}),(0,N.jsxs)(t4,{variant:"outline",size:"sm",className:"border-rose-500/40 text-rose-300 hover:bg-rose-500/10",onClick:()=>{l?(a(),c(!1),t(!1),o({title:"存档已清空",description:"一切归零,重新开始。"})):c(!0)},children:[(0,N.jsx)(aQ,{className:"h-3.5 w-3.5 mr-1"}),l?"再次点击确认清空":"清空存档"]})]}),(0,N.jsxs)("div",{className:"space-y-1.5",children:[(0,N.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,N.jsx)(a5,{className:"h-3.5 w-3.5"}),"在线游玩(gitea-pages"]}),(0,N.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,N.jsx)(a0,{className:"h-3.5 w-3.5"}),"git.atdunbg.xyz/Super_Z/echo-nexus"]})]})]}),(0,N.jsx)(aA,{children:(0,N.jsx)(t4,{variant:"ghost",onClick:()=>t(!1),children:"关闭"})})]})})}let a7=(0,tu.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"}]]),a6=(0,tu.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"}]]),a8=(0,tu.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"}]]),ne=(0,tu.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"}]]),nt=(0,tu.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"}]]),ns=(0,tu.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"}]]),nr=(0,tu.default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),na=(0,tu.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"}]]),nn={combat:{icon:a7,color:"#fb7185",label:"战斗",bg:"rgba(251,113,133,0.15)"},treasure:{icon:th,color:"#fbbf24",label:"宝藏",bg:"rgba(251,191,36,0.15)"},choice:{icon:a6,color:"#a5f3fc",label:"抉择",bg:"rgba(165,243,252,0.15)"},puzzle:{icon:a8,color:"#e879f9",label:"解谜",bg:"rgba(232,121,249,0.15)"},rest:{icon:nt,color:"#34d399",label:"休整",bg:"rgba(52,211,153,0.15)"},boss:{icon:ne,color:"#f43f5e",label:"BOSS",bg:"rgba(244,63,94,0.2)"}};function ni(){let e=td(e=>e.activeExpedition),t=td(e=>e.energy),s=td(e=>e.energyMax),r=td(e=>e.lastEnergyTick),a=td(e=>e.expeditionLog),n=td(e=>e.totalExpeditions),i=td(e=>e.lastExpeditionSummary),o=td(e=>eR(e)),l=td(e=>e.startExpedition),c=td(e=>e.resolveCurrentNode),d=td(e=>e.advanceNode),u=td(e=>e.abortExpedition),h=td(e=>e.dismissExpedition),{toast:f}=(0,tU.useToast)(),[p,m]=(0,M.useState)(null),[x,g]=(0,M.useState)(()=>Date.now());(0,M.useEffect)(()=>{let e=setInterval(()=>g(Date.now()),1e3);return()=>clearInterval(e)},[]);let b=1e3*o,y=x-r,v=t>=s?100:Math.min(100,y/b*100),w=o<20,j=t>=s?0:Math.max(0,Math.ceil((b-y)/1e3)),k=t>=1;if(!e||e.finished){let r=e?.finished&&i&&Date.now()-i.finishedAt<6e4;return(0,N.jsxs)("div",{className:"flex flex-col gap-3 h-full",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsxs)("h3",{className:"text-sm font-semibold flex items-center gap-1.5",children:[(0,N.jsx)(so,{className:"h-4 w-4 text-amber-400"}),"遗迹探险"]}),(0,N.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:["已探索 ",n," 次"]})]}),i&&(0,N.jsxs)("div",{className:`rounded-xl border p-2.5 relative overflow-hidden ${"victory"===i.result?"border-emerald-400/40 bg-emerald-950/20":"defeat"===i.result?"border-rose-400/40 bg-rose-950/20":"border-amber-400/30 bg-amber-950/10"}`,children:[(0,N.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,N.jsx)("span",{className:"text-[11px] font-semibold flex items-center gap-1",children:"victory"===i.result?"✦ 上次探险:胜利":"defeat"===i.result?"✕ 上次探险:失败":"→ 上次探险:撤退"}),(0,N.jsxs)("span",{className:"text-[9px] text-muted-foreground font-mono",children:[i.nodeCount," 节点"]})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2.5 text-[10px]",children:[i.rewards.crystals>0&&(0,N.jsxs)("span",{className:"text-emerald-300",children:["+",U(i.rewards.crystals)," 晶体"]}),i.rewards.insights>0&&(0,N.jsxs)("span",{className:"text-amber-300",children:["+",i.rewards.insights," 洞见"]}),i.rewards.contact>0&&(0,N.jsxs)("span",{className:"text-fuchsia-300",children:["+",i.rewards.contact.toFixed(1)," 接触"]}),0===i.rewards.crystals&&0===i.rewards.insights&&(0,N.jsx)("span",{className:"text-muted-foreground/60",children:"无奖励"})]})]}),(0,N.jsxs)("div",{className:"rounded-xl border border-amber-400/20 bg-amber-950/20 p-3",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(ns,{className:"h-3.5 w-3.5 text-amber-400"}),(0,N.jsx)("span",{className:"text-xs text-amber-200",children:"探险能量"})]}),(0,N.jsxs)("span",{className:"text-xs font-mono text-amber-100",children:[t," / ",s]})]}),t<s?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(tO,{value:v,className:"h-1.5 bg-black/40 [&>div]:bg-gradient-to-r [&>div]:from-amber-500 [&>div]:to-yellow-300"}),(0,N.jsxs)("p",{className:"text-[10px] text-muted-foreground/70 mt-1 flex items-center gap-1",children:[(0,N.jsx)("span",{children:"下一点能量"}),(0,N.jsxs)("span",{className:"text-amber-300 font-mono font-semibold",children:[j,"s"]}),(0,N.jsx)("span",{children:"后恢复"}),w&&(0,N.jsxs)("span",{className:"text-emerald-400/80 ml-1",children:["⚡ ",o.toFixed(0),"s/点 (已加速)"]})]})]}):(0,N.jsx)("p",{className:"text-[10px] text-amber-300/80 mt-0.5",children:"能量已满,可立即出发"})]}),(0,N.jsxs)("div",{className:"flex-1 flex flex-col items-center justify-center gap-3 rounded-2xl border border-dashed border-amber-400/20 bg-black/30 p-4 relative overflow-hidden",children:[(0,N.jsx)("div",{className:"absolute -top-10 -right-10 h-32 w-32 rounded-full bg-amber-500/10 blur-2xl"}),(0,N.jsx)("div",{className:"relative",children:(0,N.jsx)("div",{className:`h-16 w-16 rounded-full bg-gradient-to-br from-amber-500/30 to-rose-500/20 flex items-center justify-center mx-auto ${k?"animate-pulse":""}`,style:{boxShadow:"0 0 30px rgba(251,191,36,0.3)"},children:(0,N.jsx)(so,{className:"h-7 w-7 text-amber-300"})})}),(0,N.jsxs)("div",{className:"text-center space-y-1",children:[(0,N.jsx)("p",{className:"text-sm font-medium text-amber-100",children:"深入以太遗迹"}),(0,N.jsx)("p",{className:"text-[11px] text-muted-foreground/80 max-w-[220px]",children:"程序化生成的遗迹路径,沿途遭遇战斗、宝藏、抉择与解谜,击败终点 BOSS 获取丰厚奖励。"})]}),(0,N.jsxs)(t4,{onClick:()=>{let e=l();e.ok?(tX("expeditionStart"),f({title:"探险队出发",description:"深入遗迹,谨慎前行。"}),m(null)):f({title:"无法出发",description:e.reason,variant:"destructive"})},disabled:!k,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,N.jsx)(so,{className:"h-4 w-4 mr-1.5"}),k?`出发(消耗 1 能量)`:`能量不足(${j}s 后恢复)`]})]}),a.length>0&&(0,N.jsxs)("div",{className:"rounded-xl border border-white/5 bg-black/20 p-2 max-h-28 overflow-y-auto echo-scroll",children:[(0,N.jsx)("div",{className:"text-[10px] text-muted-foreground/60 mb-1 px-1",children:"最近探险记录"}),a.slice(0,4).map((e,t)=>(0,N.jsxs)("div",{className:"text-[10px] text-muted-foreground/70 px-1 py-0.5 border-b border-white/5 last:border-0",children:[(0,N.jsx)("span",{className:"text-amber-300/60",children:""})," ",e.result,e.rewards&&(0,N.jsx)("span",{className:"text-emerald-300/70 ml-1",children:e.rewards})]},t))]}),r&&(0,N.jsx)(t4,{onClick:()=>h(),variant:"outline",size:"sm",className:"h-7 text-[11px] border-amber-400/30 text-amber-200",children:"收起结算,准备下次出发"})]})}let S=e.nodes[e.currentNode],T=nn[S.type],C=T.icon,P=e.hp/e.maxHp*100,E=(e.currentNode+ +!!S.cleared)/e.nodes.length*100;return(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 flex flex-col gap-2.5 h-full",children:[(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center justify-between gap-2",children:[(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1.5",children:[(0,N.jsx)(so,{className:"h-3.5 w-3.5 text-amber-400"}),(0,N.jsx)("span",{className:"jsx-df1c681cdb543264 text-xs font-semibold",children:"遗迹探险"}),(0,N.jsxs)("span",{className:"jsx-df1c681cdb543264 text-[10px] text-muted-foreground",children:["第 ",e.currentNode+1,"/",e.nodes.length," 节点"]})]}),(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1.5",children:[(0,N.jsx)("span",{className:"jsx-df1c681cdb543264 text-[10px] text-muted-foreground",children:"探险力"}),(0,N.jsx)("span",{className:"jsx-df1c681cdb543264 text-xs font-mono font-semibold text-amber-300",children:e.power})]})]}),(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264",children:[(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center justify-between mb-0.5",children:[(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1",children:[(0,N.jsx)(nt,{className:"h-3 w-3 text-rose-400"}),(0,N.jsx)("span",{className:"jsx-df1c681cdb543264 text-[10px] text-muted-foreground",children:"探险队生命"})]}),(0,N.jsxs)("span",{className:`jsx-df1c681cdb543264 text-[10px] font-mono ${P<30?"text-rose-400":"text-foreground"}`,children:[e.hp," / ",e.maxHp]})]}),(0,N.jsx)(tO,{value:P,className:"h-1.5 bg-black/40 [&>div]:bg-gradient-to-r [&>div]:from-rose-500 [&>div]:to-emerald-400"})]}),(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 rounded-xl border border-white/10 bg-black/30 p-2.5",children:[(0,N.jsx)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1 overflow-x-auto echo-scroll pb-1",children:e.nodes.map((t,s)=>{let r=nn[t.type],a=r.icon,n=s===e.currentNode,i=t.cleared,o=s<e.currentNode;return(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center shrink-0",children:[(0,N.jsxs)("div",{style:{background:i||o?"rgba(255,255,255,0.04)":r.bg,border:n?`1.5px solid ${r.color}`:"1px solid rgba(255,255,255,0.08)",boxShadow:n?`0 0 12px ${r.color}66`:"none"},title:`${r.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,N.jsx)(a,{style:{color:i||o?"#666":r.color},className:`jsx-df1c681cdb543264 h-4 w-4 ${i||o?"opacity-30":""}`}),i&&(0,N.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,N.jsx)("span",{className:"jsx-df1c681cdb543264 text-[8px] text-white",children:"✓"})})]}),s<e.nodes.length-1&&(0,N.jsx)(nr,{className:`h-3 w-3 mx-0.5 ${o||n&&i?"text-amber-400/60":"text-white/15"}`})]},t.id)})}),(0,N.jsx)("div",{className:"jsx-df1c681cdb543264 mt-1.5",children:(0,N.jsx)(tO,{value:E,className:"h-1 bg-black/40 [&>div]:bg-gradient-to-r [&>div]:from-amber-500 [&>div]:to-rose-400"})})]}),(0,N.jsxs)("div",{style:{borderColor:`${T.color}44`,background:`linear-gradient(135deg, ${T.color}11, rgba(0,0,0,0.4))`,boxShadow:`0 0 20px ${T.color}22`},className:"jsx-df1c681cdb543264 rounded-xl border p-3 relative overflow-hidden",children:[(0,N.jsx)("div",{style:{background:`${T.color}22`},className:"jsx-df1c681cdb543264 absolute -top-8 -right-8 h-24 w-24 rounded-full blur-2xl"}),(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 relative",children:[(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-2 mb-1.5",children:[(0,N.jsx)("div",{style:{background:T.bg,border:`1px solid ${T.color}44`},className:"jsx-df1c681cdb543264 h-8 w-8 rounded-lg flex items-center justify-center",children:(0,N.jsx)(C,{style:{color:T.color},className:"jsx-df1c681cdb543264 h-4 w-4"})}),(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264",children:[(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1.5",children:[(0,N.jsx)("span",{style:{background:T.bg,color:T.color},className:"jsx-df1c681cdb543264 text-[10px] font-mono px-1.5 py-0.5 rounded",children:T.label}),"combat"===S.type&&(0,N.jsxs)("span",{className:"jsx-df1c681cdb543264 text-[10px] text-muted-foreground",children:["胜率 ",Math.round(100*eE(e.power,S.difficulty)),"%"]}),S.difficulty>0&&(0,N.jsxs)("span",{className:"jsx-df1c681cdb543264 text-[10px] text-muted-foreground/60",children:["难度 ",S.difficulty]})]}),(0,N.jsx)("h4",{style:{color:T.color},className:"jsx-df1c681cdb543264 text-sm font-semibold mt-0.5",children:S.title})]})]}),(0,N.jsx)("p",{className:"jsx-df1c681cdb543264 text-[11px] text-muted-foreground/90 leading-relaxed",children:S.desc}),p&&(0,N.jsx)("div",{className:"jsx-df1c681cdb543264 mt-2 px-2 py-1.5 rounded-lg bg-black/40 border border-white/10",children:(0,N.jsx)("p",{className:"jsx-df1c681cdb543264 text-[11px] text-foreground/90",children:p})})]})]}),(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-1.5",children:[S.cleared?e.currentNode<e.nodes.length-1?(0,N.jsxs)(t4,{onClick:()=>{d(),m(null)},className:"flex-1 h-8",variant:"outline",children:[(0,N.jsx)(nr,{className:"h-3.5 w-3.5 mr-1"}),"前进"]}):(0,N.jsx)("div",{className:"jsx-df1c681cdb543264 flex-1 text-center text-xs text-emerald-300 py-1.5",children:"探险已完成 ✓"}):(0,N.jsxs)(t4,{onClick:()=>{let e=c();e&&(m(e.log),e.ended?"victory"===e.endReason?tX("expeditionVictory"):tX("expeditionDefeat"):tX("expeditionNode"),f({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,N.jsx)(t7,{className:"h-3.5 w-3.5 mr-1"}),"探索节点"]}),(0,N.jsx)(t4,{onClick:()=>{u(),f({title:"探险队撤退",description:"保留已获奖励,安全返回。"}),m(null)},variant:"ghost",size:"sm",className:"h-8 px-2 text-muted-foreground hover:text-rose-300",children:(0,N.jsx)(na,{className:"h-3.5 w-3.5"})})]}),(0,N.jsxs)("div",{className:"jsx-df1c681cdb543264 flex items-center gap-2 text-[10px] px-1",children:[(0,N.jsx)("span",{className:"jsx-df1c681cdb543264 text-muted-foreground/60",children:"本次已获:"}),e.rewards.crystals>0&&(0,N.jsxs)("span",{className:"jsx-df1c681cdb543264 text-emerald-300",children:[U(e.rewards.crystals),"晶体"]}),e.rewards.insights>0&&(0,N.jsxs)("span",{className:"jsx-df1c681cdb543264 text-amber-300",children:[e.rewards.insights,"洞见"]}),e.rewards.contact>0&&(0,N.jsxs)("span",{className:"jsx-df1c681cdb543264 text-fuchsia-300",children:[e.rewards.contact.toFixed(1),"接触"]}),0===e.rewards.crystals&&0===e.rewards.insights&&(0,N.jsx)("span",{className:"jsx-df1c681cdb543264 text-muted-foreground/40",children:"暂无"})]}),(0,N.jsx)(tV.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 no=(0,tu.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 nl(){let e=td(e=>e.achievements),t=Object.values(e).filter(Boolean).length,s=H(e);return(0,N.jsxs)("div",{className:"jsx-7e1dc0c087b6bd3d flex flex-col gap-2.5 h-full",children:[(0,N.jsxs)("div",{className:"jsx-7e1dc0c087b6bd3d flex items-center justify-between",children:[(0,N.jsxs)("h3",{className:"jsx-7e1dc0c087b6bd3d text-sm font-semibold flex items-center gap-1.5",children:[(0,N.jsx)(no,{className:"h-4 w-4 text-amber-400"}),"成就"]}),(0,N.jsxs)("span",{className:"jsx-7e1dc0c087b6bd3d text-[10px] text-muted-foreground font-mono",children:[t," / ",W.length]})]}),(0,N.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,N.jsx)("span",{className:"jsx-7e1dc0c087b6bd3d text-amber-300/80",children:"永久加成"}),s.crystalsPerSecPct>0&&(0,N.jsxs)("span",{className:"jsx-7e1dc0c087b6bd3d text-emerald-300",children:["产能 +",s.crystalsPerSecPct,"%"]}),s.insightPct>0&&(0,N.jsxs)("span",{className:"jsx-7e1dc0c087b6bd3d text-fuchsia-300",children:["洞见 +",s.insightPct,"%"]}),0===s.crystalsPerSecPct&&0===s.insightPct&&(0,N.jsx)("span",{className:"jsx-7e1dc0c087b6bd3d text-muted-foreground/60",children:"暂无(达成成就解锁)"})]}),(0,N.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:W.map(t=>{let s=!!e[t.id];return(0,N.jsxs)("div",{style:s?{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 ${s?"border-white/15 bg-black/30":"border-white/5 bg-black/15 opacity-60"}`,children:[s&&(0,N.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,N.jsxs)("div",{className:"jsx-7e1dc0c087b6bd3d relative flex items-start gap-2",children:[(0,N.jsx)("div",{style:{background:s?`${t.color}22`:"rgba(255,255,255,0.04)",border:`1px solid ${s?t.color+"55":"rgba(255,255,255,0.08)"}`,color:s?t.color:"#666",boxShadow:s?`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:s?t.icon:(0,N.jsx)(sc,{className:"h-3.5 w-3.5"})}),(0,N.jsxs)("div",{className:"jsx-7e1dc0c087b6bd3d min-w-0 flex-1",children:[(0,N.jsx)("div",{style:{color:s?t.color:"rgba(255,255,255,0.5)"},className:"jsx-7e1dc0c087b6bd3d text-[11px] font-semibold truncate",children:t.name}),(0,N.jsx)("div",{className:"jsx-7e1dc0c087b6bd3d text-[10px] text-muted-foreground/80 leading-tight mt-0.5",children:t.desc}),s&&(0,N.jsxs)("div",{style:{color:t.color+"cc"},className:"jsx-7e1dc0c087b6bd3d text-[9px] mt-1 font-mono",children:["✦ ",t.rewardText]})]})]})]},t.id)})}),(0,N.jsx)(tV.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}"})]})}let nc=(0,M.createContext)({});function nd(e){let t=(0,M.useRef)(null);return null===t.current&&(t.current=e()),t.current}let nu="u">typeof window,nh=nu?M.useLayoutEffect:M.useEffect,nf=(0,M.createContext)(null);function np(e){return"object"==typeof e&&null!==e}function nm(e){return np(e)&&"offsetHeight"in e}var nx=M;let ng=(0,M.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function nb(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class ny extends nx.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,s=nm(e)&&e.offsetWidth||0,r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft,r.right=s-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}}function nv({children:e,isPresent:t,anchorX:s,root:r}){let a=(0,nx.useId)(),n=(0,nx.useRef)(null),i=(0,nx.useRef)({width:0,height:0,top:0,left:0,right:0}),{nonce:o}=(0,nx.useContext)(ng),l=function(...e){return M.useCallback(function(...e){return t=>{let s=!1,r=e.map(e=>{let r=nb(e,t);return s||"function"!=typeof r||(s=!0),r});if(s)return()=>{for(let t=0;t<r.length;t++){let s=r[t];"function"==typeof s?s():nb(e[t],null)}}}}(...e),e)}(n,e.props?.ref??e?.ref);return(0,nx.useInsertionEffect)(()=>{let{width:e,height:l,top:c,left:d,right:u}=i.current;if(t||!n.current||!e||!l)return;let h="left"===s?`left: ${d}`:`right: ${u}`;n.current.dataset.motionPopId=a;let f=document.createElement("style");o&&(f.nonce=o);let p=r??document.head;return p.appendChild(f),f.sheet&&f.sheet.insertRule(`
[data-motion-pop-id="${a}"] {
position: absolute !important;
width: ${e}px !important;
height: ${l}px !important;
${h}px !important;
top: ${c}px !important;
}
`),()=>{p.contains(f)&&p.removeChild(f)}},[t]),(0,N.jsx)(ny,{isPresent:t,childRef:n,sizeRef:i,children:nx.cloneElement(e,{ref:l})})}let nw=({children:e,initial:t,isPresent:s,onExitComplete:r,custom:a,presenceAffectsLayout:n,mode:i,anchorX:o,root:l})=>{let c=nd(nj),d=(0,M.useId)(),u=!0,h=(0,M.useMemo)(()=>(u=!1,{id:d,initial:t,isPresent:s,custom:a,onExitComplete:e=>{for(let t of(c.set(e,!0),c.values()))if(!t)return;r&&r()},register:e=>(c.set(e,!1),()=>c.delete(e))}),[s,c,r]);return n&&u&&(h={...h}),(0,M.useMemo)(()=>{c.forEach((e,t)=>c.set(t,!1))},[s]),M.useEffect(()=>{s||c.size||!r||r()},[s]),"popLayout"===i&&(e=(0,N.jsx)(nv,{isPresent:s,anchorX:o,root:l,children:e})),(0,N.jsx)(nf.Provider,{value:h,children:e})};function nj(){return new Map}function nk(e=!0){let t=(0,M.useContext)(nf);if(null===t)return[!0,null];let{isPresent:s,onExitComplete:r,register:a}=t,n=(0,M.useId)();(0,M.useEffect)(()=>{if(e)return a(n)},[e]);let i=(0,M.useCallback)(()=>e&&r&&r(n),[n,r,e]);return!s&&r?[!1,i]:[!0]}let nN=e=>e.key||"";function nM(e){let t=[];return M.Children.forEach(e,e=>{(0,M.isValidElement)(e)&&t.push(e)}),t}let nS=({children:e,custom:t,initial:s=!0,onExitComplete:r,presenceAffectsLayout:a=!0,mode:n="sync",propagate:i=!1,anchorX:o="left",root:l})=>{let[c,d]=nk(i),u=(0,M.useMemo)(()=>nM(e),[e]),h=i&&!c?[]:u.map(nN),f=(0,M.useRef)(!0),p=(0,M.useRef)(u),m=nd(()=>new Map),x=(0,M.useRef)(new Set),[g,b]=(0,M.useState)(u),[y,v]=(0,M.useState)(u);nh(()=>{f.current=!1,p.current=u;for(let e=0;e<y.length;e++){let t=nN(y[e]);h.includes(t)?(m.delete(t),x.current.delete(t)):!0!==m.get(t)&&m.set(t,!1)}},[y,h.length,h.join("-")]);let w=[];if(u!==g){let e=[...u];for(let t=0;t<y.length;t++){let s=y[t],r=nN(s);h.includes(r)||(e.splice(t,0,s),w.push(s))}return"wait"===n&&w.length&&(e=w),v(nM(e)),b(u),null}let{forceRender:j}=(0,M.useContext)(nc);return(0,N.jsx)(N.Fragment,{children:y.map(e=>{let g=nN(e),b=(!i||!!c)&&(u===y||h.includes(g));return(0,N.jsx)(nw,{isPresent:b,initial:(!f.current||!!s)&&void 0,custom:t,presenceAffectsLayout:a,mode:n,root:l,onExitComplete:b?void 0:()=>{if(x.current.has(g)||(x.current.add(g),!m.has(g)))return;m.set(g,!0);let e=!0;m.forEach(t=>{t||(e=!1)}),e&&(j?.(),v(p.current),i&&d?.(),r&&r())},anchorX:o,children:e},g)})})},nT=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],nC=new Set(nT),nP=(e,t,s)=>s>t?t:s<e?e:s,nE={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},n_={...nE,transform:e=>nP(0,1,e)},nR={...nE,default:1},nA=e=>Math.round(1e5*e)/1e5,n$=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,nD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,nB=(e,t)=>s=>!!("string"==typeof s&&nD.test(s)&&s.startsWith(e)||t&&null!=s&&Object.prototype.hasOwnProperty.call(s,t)),nI=(e,t,s)=>r=>{if("string"!=typeof r)return r;let[a,n,i,o]=r.match(n$);return{[e]:parseFloat(a),[t]:parseFloat(n),[s]:parseFloat(i),alpha:void 0!==o?parseFloat(o):1}},nL={...nE,transform:e=>Math.round(nP(0,255,e))},nO={test:nB("rgb","red"),parse:nI("red","green","blue"),transform:({red:e,green:t,blue:s,alpha:r=1})=>"rgba("+nL.transform(e)+", "+nL.transform(t)+", "+nL.transform(s)+", "+nA(n_.transform(r))+")"},nF={test:nB("#"),parse:function(e){let t="",s="",r="",a="";return e.length>5?(t=e.substring(1,3),s=e.substring(3,5),r=e.substring(5,7),a=e.substring(7,9)):(t=e.substring(1,2),s=e.substring(2,3),r=e.substring(3,4),a=e.substring(4,5),t+=t,s+=s,r+=r,a+=a),{red:parseInt(t,16),green:parseInt(s,16),blue:parseInt(r,16),alpha:a?parseInt(a,16)/255:1}},transform:nO.transform},nz=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),nV=nz("deg"),nU=nz("%"),nW=nz("px"),nH=nz("vh"),nq=nz("vw"),nK={...nU,parse:e=>nU.parse(e)/100,transform:e=>nU.transform(100*e)},nX={test:nB("hsl","hue"),parse:nI("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:s,alpha:r=1})=>"hsla("+Math.round(e)+", "+nU.transform(nA(t))+", "+nU.transform(nA(s))+", "+nA(n_.transform(r))+")"},nY={test:e=>nO.test(e)||nF.test(e)||nX.test(e),parse:e=>nO.test(e)?nO.parse(e):nX.test(e)?nX.parse(e):nF.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?nO.transform(e):nX.transform(e),getAnimatableNone:e=>{let t=nY.parse(e);return t.alpha=0,nY.transform(t)}},nG=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,nJ="number",nZ="color",nQ=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function n0(e){let t=e.toString(),s=[],r={color:[],number:[],var:[]},a=[],n=0,i=t.replace(nQ,e=>(nY.test(e)?(r.color.push(n),a.push(nZ),s.push(nY.parse(e))):e.startsWith("var(")?(r.var.push(n),a.push("var"),s.push(e)):(r.number.push(n),a.push(nJ),s.push(parseFloat(e))),++n,"${}")).split("${}");return{values:s,split:i,indexes:r,types:a}}function n1(e){return n0(e).values}function n2(e){let{split:t,types:s}=n0(e),r=t.length;return e=>{let a="";for(let n=0;n<r;n++)if(a+=t[n],void 0!==e[n]){let t=s[n];t===nJ?a+=nA(e[n]):t===nZ?a+=nY.transform(e[n]):a+=e[n]}return a}}let n5=e=>"number"==typeof e?0:nY.test(e)?nY.getAnimatableNone(e):e,n3={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(n$)?.length||0)+(e.match(nG)?.length||0)>0},parse:n1,createTransformer:n2,getAnimatableNone:function(e){let t=n1(e);return n2(e)(t.map(n5))}},n4=new Set(["brightness","contrast","saturate","opacity"]);function n9(e){let[t,s]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[r]=s.match(n$)||[];if(!r)return e;let a=s.replace(r,""),n=+!!n4.has(t);return r!==s&&(n*=100),t+"("+n+a+")"}let n7=/\b([a-z-]*)\(.*?\)/gu,n6={...n3,getAnimatableNone:e=>{let t=e.match(n7);return t?t.map(n9).join(" "):e}},n8={...nE,transform:Math.round},ie={borderWidth:nW,borderTopWidth:nW,borderRightWidth:nW,borderBottomWidth:nW,borderLeftWidth:nW,borderRadius:nW,radius:nW,borderTopLeftRadius:nW,borderTopRightRadius:nW,borderBottomRightRadius:nW,borderBottomLeftRadius:nW,width:nW,maxWidth:nW,height:nW,maxHeight:nW,top:nW,right:nW,bottom:nW,left:nW,inset:nW,insetBlock:nW,insetBlockStart:nW,insetBlockEnd:nW,insetInline:nW,insetInlineStart:nW,insetInlineEnd:nW,padding:nW,paddingTop:nW,paddingRight:nW,paddingBottom:nW,paddingLeft:nW,paddingBlock:nW,paddingBlockStart:nW,paddingBlockEnd:nW,paddingInline:nW,paddingInlineStart:nW,paddingInlineEnd:nW,margin:nW,marginTop:nW,marginRight:nW,marginBottom:nW,marginLeft:nW,marginBlock:nW,marginBlockStart:nW,marginBlockEnd:nW,marginInline:nW,marginInlineStart:nW,marginInlineEnd:nW,backgroundPositionX:nW,backgroundPositionY:nW,rotate:nV,rotateX:nV,rotateY:nV,rotateZ:nV,scale:nR,scaleX:nR,scaleY:nR,scaleZ:nR,skew:nV,skewX:nV,skewY:nV,distance:nW,translateX:nW,translateY:nW,translateZ:nW,x:nW,y:nW,z:nW,perspective:nW,transformPerspective:nW,opacity:n_,originX:nK,originY:nK,originZ:nW,zIndex:n8,fillOpacity:n_,strokeOpacity:n_,numOctaves:n8},it={...ie,color:nY,backgroundColor:nY,outlineColor:nY,fill:nY,stroke:nY,borderColor:nY,borderTopColor:nY,borderRightColor:nY,borderBottomColor:nY,borderLeftColor:nY,filter:n6,WebkitFilter:n6},is=e=>it[e],ir=()=>({translate:0,scale:1,origin:0,originPoint:0}),ia=()=>({x:ir(),y:ir()}),ii=()=>({min:0,max:0}),io=()=>({x:ii(),y:ii()}),il=e=>!!(e&&e.getVelocity),ic=new Set(["width","height","top","left","right","bottom",...nT]),id=e=>t=>t.test(e),iu=[nE,nW,nU,nV,nq,nH,{test:e=>"auto"===e,parse:e=>e}],ih=e=>iu.find(id(e)),ip=()=>{},im=()=>{};T.default;let ix=e=>t=>"string"==typeof t&&t.startsWith(e),ig=ix("--"),ib=ix("var(--"),iy=e=>!!ib(e)&&iv.test(e.split("/*")[0].trim()),iv=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function iw(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let ij=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,ik=e=>180*e/Math.PI,iN=e=>iS(ik(Math.atan2(e[1],e[0]))),iM={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:iN,rotateZ:iN,skewX:e=>ik(Math.atan(e[1])),skewY:e=>ik(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},iS=e=>((e%=360)<0&&(e+=360),e),iT=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),iC=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),iP={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:iT,scaleY:iC,scale:e=>(iT(e)+iC(e))/2,rotateX:e=>iS(ik(Math.atan2(e[6],e[5]))),rotateY:e=>iS(ik(Math.atan2(-e[2],e[0]))),rotateZ:iN,rotate:iN,skewX:e=>ik(Math.atan(e[4])),skewY:e=>ik(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function iE(e){return+!!e.includes("scale")}function i_(e,t){let s,r;if(!e||"none"===e)return iE(t);let a=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(a)s=iP,r=a;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=iM,r=t}if(!r)return iE(t);let n=s[t],i=r[1].split(",").map(iR);return"function"==typeof n?n(i):i[n]}function iR(e){return parseFloat(e.trim())}let iA=e=>e===nE||e===nW,i$=new Set(["x","y","z"]),iD=nT.filter(e=>!i$.has(e)),iB={width:({x:e},{paddingLeft:t="0",paddingRight:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),height:({y:e},{paddingTop:t="0",paddingBottom:s="0"})=>e.max-e.min-parseFloat(t)-parseFloat(s),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>i_(t,"x"),y:(e,{transform:t})=>i_(t,"y")};iB.translateX=iB.x,iB.translateY=iB.y;let iI=e=>e,iL={},iO=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function iF(e,t){let s=!1,r=!0,a={delta:0,timestamp:0,isProcessing:!1},n=()=>s=!0,i=iO.reduce((e,s)=>(e[s]=function(e,t){let s=new Set,r=new Set,a=!1,n=!1,i=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1},l=0;function c(t){i.has(t)&&(d.schedule(t),e()),l++,t(o)}let d={schedule:(e,t=!1,n=!1)=>{let o=n&&a?s:r;return t&&i.add(e),o.has(e)||o.add(e),e},cancel:e=>{r.delete(e),i.delete(e)},process:e=>{if(o=e,a){n=!0;return}a=!0,[s,r]=[r,s],s.forEach(c),t,l=0,s.clear(),a=!1,n&&(n=!1,d.process(e))}};return d}(n,t?s:void 0),e),{}),{setup:o,read:l,resolveKeyframes:c,preUpdate:d,update:u,preRender:h,render:f,postRender:p}=i,m=()=>{let n=iL.useManualTiming?a.timestamp:performance.now();s=!1,iL.useManualTiming||(a.delta=r?1e3/60:Math.max(Math.min(n-a.timestamp,40),1)),a.timestamp=n,a.isProcessing=!0,o.process(a),l.process(a),c.process(a),d.process(a),u.process(a),h.process(a),f.process(a),p.process(a),a.isProcessing=!1,s&&t&&(r=!1,e(m))};return{schedule:iO.reduce((t,n)=>{let o=i[n];return t[n]=(t,n=!1,i=!1)=>(!s&&(s=!0,r=!0,a.isProcessing||e(m)),o.schedule(t,n,i)),t},{}),cancel:e=>{for(let t=0;t<iO.length;t++)i[iO[t]].cancel(e)},state:a,steps:i}}let{schedule:iz,cancel:iV,state:iU,steps:iW}=iF("u">typeof requestAnimationFrame?requestAnimationFrame:iI,!0),iH=new Set,iq=!1,iK=!1,iX=!1;function iY(){if(iK){let e=Array.from(iH).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),s=new Map;t.forEach(e=>{let t,r=(t=[],iD.forEach(s=>{let r=e.getValue(s);void 0!==r&&(t.push([s,r.get()]),r.set(+!!s.startsWith("scale")))}),t);r.length&&(s.set(e,r),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=s.get(e);t&&t.forEach(([t,s])=>{e.getValue(t)?.set(s)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}iK=!1,iq=!1,iH.forEach(e=>e.complete(iX)),iH.clear()}function iG(){iH.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(iK=!0)})}class iJ{constructor(e,t,s,r,a,n=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=s,this.motionValue=r,this.element=a,this.isAsync=n}scheduleResolve(){this.state="scheduled",this.isAsync?(iH.add(this),iq||(iq=!0,iz.read(iG),iz.resolveKeyframes(iY))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:s,motionValue:r}=this;if(null===e[0]){let a=r?.get(),n=e[e.length-1];if(void 0!==a)e[0]=a;else if(s&&t){let r=s.readValue(t,n);null!=r&&(e[0]=r)}void 0===e[0]&&(e[0]=n),r&&void 0===a&&r.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),iH.delete(this)}cancel(){"scheduled"===this.state&&(iH.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function iZ(e,t){let s=is(e);return s!==n6&&(s=n3),s.getAnimatableNone?s.getAnimatableNone(t):void 0}let iQ=new Set(["auto","none","0"]);class i0 extends iJ{constructor(e,t,s,r,a){super(e,t,s,r,a,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:s}=this;if(!t||!t.current)return;super.readKeyframes();for(let s=0;s<e.length;s++){let r=e[s];if("string"==typeof r&&iy(r=r.trim())){let a=function e(t,s,r=1){im(r<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[a,n]=function(e){let t=ij.exec(e);if(!t)return[,];let[,s,r,a]=t;return[`--${s??r}`,a]}(t);if(!a)return;let i=window.getComputedStyle(s).getPropertyValue(a);if(i){let e=i.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return iy(n)?e(n,s,r+1):n}(r,t.current);void 0!==a&&(e[s]=a),s===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!ic.has(s)||2!==e.length)return;let[r,a]=e,n=ih(r),i=ih(a);if(iw(r)!==iw(a)&&iB[s]){this.needsMeasurement=!0;return}if(n!==i)if(iA(n)&&iA(i))for(let t=0;t<e.length;t++){let s=e[t];"string"==typeof s&&(e[t]=parseFloat(s))}else iB[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,s=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&s.push(t);s.length&&function(e,t,s){let r,a=0;for(;a<e.length&&!r;){let t=e[a];"string"==typeof t&&!iQ.has(t)&&n0(t).values.length&&(r=e[a]),a++}if(r&&s)for(let a of t)e[a]=iZ(s,r)}(e,s,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:s}=this;if(!e||!e.current)return;"height"===s&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=iB[s](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];void 0!==r&&e.getValue(s,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:s}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let a=s.length-1,n=s[a];s[a]=iB[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==n&&void 0===this.finalKeyframe&&(this.finalKeyframe=n),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,s])=>{e.getValue(t).set(s)}),this.resolveNoneKeyframes()}}function i1(e,t){-1===e.indexOf(t)&&e.push(t)}function i2(e,t){let s=e.indexOf(t);s>-1&&e.splice(s,1)}class i5{constructor(){this.subscriptions=[]}add(e){return i1(this.subscriptions,e),()=>i2(this.subscriptions,e)}notify(e,t,s){let r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](e,t,s);else for(let a=0;a<r;a++){let r=this.subscriptions[a];r&&r(e,t,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:i3}=iF(queueMicrotask,!1);function i4(){t=void 0}let i9={now:()=>(void 0===t&&i9.set(iU.isProcessing||iL.useManualTiming?iU.timestamp:performance.now()),t),set:e=>{t=e,queueMicrotask(i4)}};class i7{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=i9.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=i9.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new i5);let s=this.events[e].add(t);return"change"===e?()=>{s(),iz.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,s){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return f&&f.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=i9.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let s=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),s?1e3/s*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function i6(e,t){return new i7(e,t)}let i8=[...iu,nY,n3],oe={current:null},ot={current:!1},os="u">typeof window,or=new WeakMap;function oa(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function on(e){return"string"==typeof e||Array.isArray(e)}let oi=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],oo=["initial",...oi];function ol(e){return oa(e.animate)||oo.some(t=>on(e[t]))}function oc(e){return!!(ol(e)||e.variants)}function od(e){let t=[{},{}];return e?.values.forEach((e,s)=>{t[0][s]=e.get(),t[1][s]=e.getVelocity()}),t}function ou(e,t,s,r){if("function"==typeof t){let[a,n]=od(r);t=t(void 0!==s?s:e.custom,a,n)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[a,n]=od(r);t=t(void 0!==s?s:e.custom,a,n)}return t}let oh=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],of={};class op{scrapeMotionValuesFromProps(e,t,s){return{}}constructor({parent:e,props:t,presenceContext:s,reducedMotionConfig:r,blockInitialAnimation:a,visualState:n},i={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=iJ,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=i9.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,iz.render(this.render,!1,!0))};const{latestValues:o,renderState:l}=n;this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=i,this.blockInitialAnimation=!!a,this.isControllingVariants=ol(t),this.isVariantNode=oc(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in d){const t=d[e];void 0!==o[e]&&il(t)&&t.set(o[e])}}mount(e){this.current=e,or.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(ot.current||function(){if(ot.current=!0,os)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>oe.current=e.matches;e.addEventListener("change",t),t()}else oe.current=!1}(),this.shouldReduceMotion=oe.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),iV(this.notifyUpdate),iV(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let s;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let r=nC.has(e);r&&this.onBindTransform&&this.onBindTransform();let a=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&iz.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{a(),s&&s(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in of){let t=of[e];if(!t)continue;let{isEnabled:s,Feature:r}=t;if(!this.features[e]&&r&&s(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):io()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<oh.length;t++){let s=oh[t];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);let r=e["on"+s];r&&(this.propEventSubscriptions[s]=this.on(s,r))}this.prevMotionValues=function(e,t,s){for(let r in t){let a=t[r],n=s[r];if(il(a))e.addValue(r,a);else if(il(n))e.addValue(r,i6(a,{owner:e}));else if(n!==a)if(e.hasValue(r)){let t=e.getValue(r);!0===t.liveStyle?t.jump(a):t.hasAnimated||t.set(a)}else{let t=e.getStaticValue(r);e.addValue(r,i6(void 0!==t?t:a,{owner:e}))}}for(let r in s)void 0===t[r]&&e.removeValue(r);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let s=this.values.get(e);t!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return void 0===s&&void 0!==t&&(s=i6(null===t?void 0:t,{owner:this}),this.addValue(e,s)),s}readValue(e,t){let s=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=s){let r,a;if("string"==typeof s&&(r=s,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(r)||(a=s,/^0[^.\s]+$/u.test(a))))s=parseFloat(s);else{let r;r=s,!i8.find(id(r))&&n3.test(t)&&(s=iZ(e,t))}this.setBaseTarget(e,il(s)?s.get():s)}return il(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:s}=this.props;if("string"==typeof s||"object"==typeof s){let r=ou(this.props,s,this.presenceContext?.custom);r&&(t=r[e])}if(s&&void 0!==t)return t;let r=this.getBaseTargetFromProps(this.props,e);return void 0===r||il(r)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:r}on(e,t){return this.events[e]||(this.events[e]=new i5),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){i3.render(this.render)}}class om extends op{constructor(){super(...arguments),this.KeyframeResolver=i0}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let s=e.style;return s?s[t]:void 0}removeValueFromRenderState(e,{vars:t,style:s}){delete t[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;il(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function ox(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let og=(e,t)=>t&&"number"==typeof e?t.transform(e):e,ob={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},oy=nT.length;function ov(e,t,s){let{style:r,vars:a,transformOrigin:n}=e,i=!1,o=!1;for(let e in t){let s=t[e];if(nC.has(e)){i=!0;continue}if(ig(e)){a[e]=s;continue}{let t=og(s,ie[e]);e.startsWith("origin")?(o=!0,n[e]=t):r[e]=t}}if(!t.transform&&(i||s?r.transform=function(e,t,s){let r="",a=!0;for(let n=0;n<oy;n++){let i=nT[n],o=e[i];if(void 0===o)continue;let l=!0;if(!(l="number"==typeof o?o===+!!i.startsWith("scale"):0===parseFloat(o))||s){let e=og(o,ie[i]);if(!l){a=!1;let t=ob[i]||i;r+=`${t}(${e}) `}s&&(t[i]=e)}}return r=r.trim(),s?r=s(t,a?"":r):a&&(r="none"),r}(t,e.transform,s):r.transform&&(r.transform="none")),o){let{originX:e="50%",originY:t="50%",originZ:s=0}=n;r.transformOrigin=`${e} ${t} ${s}`}}let ow={offset:"stroke-dashoffset",array:"stroke-dasharray"},oj={offset:"strokeDashoffset",array:"strokeDasharray"},ok=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function oN(e,{attrX:t,attrY:s,attrScale:r,pathLength:a,pathSpacing:n=1,pathOffset:i=0,...o},l,c,d){if(ov(e,o,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:u,style:h}=e;for(let e of(u.transform&&(h.transform=u.transform,delete u.transform),(h.transform||u.transformOrigin)&&(h.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),h.transform&&(h.transformBox=d?.transformBox??"fill-box",delete u.transformBox),ok))void 0!==u[e]&&(h[e]=u[e],delete u[e]);void 0!==t&&(u.x=t),void 0!==s&&(u.y=s),void 0!==r&&(u.scale=r),void 0!==a&&function(e,t,s=1,r=0,a=!0){e.pathLength=1;let n=a?ow:oj;e[n.offset]=nW.transform(-r);let i=nW.transform(t),o=nW.transform(s);e[n.array]=`${i} ${o}`}(u,a,n,i,!1)}let oM=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),oS=e=>"string"==typeof e&&"svg"===e.toLowerCase();function oT(e,{style:t,vars:s},r,a){let n,i=e.style;for(n in t)i[n]=t[n];for(n in a?.applyProjectionStyles(i,r),s)i.setProperty(n,s[n])}function oC(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let oP={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!nW.test(e))return e;else e=parseFloat(e);let s=oC(e,t.target.x),r=oC(e,t.target.y);return`${s}% ${r}%`}},oE=(e,t,s)=>e+(t-e)*s,o_={borderRadius:{...oP,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:oP,borderTopRightRadius:oP,borderBottomLeftRadius:oP,borderBottomRightRadius:oP,boxShadow:{correct:(e,{treeScale:t,projectionDelta:s})=>{let r=n3.parse(e);if(r.length>5)return e;let a=n3.createTransformer(e),n=+("number"!=typeof r[0]),i=s.x.scale*t.x,o=s.y.scale*t.y;r[0+n]/=i,r[1+n]/=o;let l=oE(i,o,.5);return"number"==typeof r[2+n]&&(r[2+n]/=l),"number"==typeof r[3+n]&&(r[3+n]/=l),a(r)}}};function oR(e,{layout:t,layoutId:s}){return nC.has(e)||e.startsWith("origin")||(t||void 0!==s)&&(!!o_[e]||"opacity"===e)}function oA(e,t,s){let r=e.style,a=t?.style,n={};if(!r)return n;for(let t in r)(il(r[t])||a&&il(a[t])||oR(t,e)||s?.getValue(t)?.liveStyle!==void 0)&&(n[t]=r[t]);return n}function o$(e,t,s){let r=oA(e,t,s);for(let s in e)(il(e[s])||il(t[s]))&&(r[-1!==nT.indexOf(s)?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s]=e[s]);return r}class oD extends om{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=io}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(nC.has(t)){let e=is(t);return e&&e.default||0}return t=oM.has(t)?t:ox(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,s){return o$(e,t,s)}build(e,t,s){oN(e,t,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,t,s,r){for(let s in oT(e,t,void 0,r),t.attrs)e.setAttribute(oM.has(s)?s:ox(s),t.attrs[s])}mount(e){this.isSVGTag=oS(e.tagName),super.mount(e)}}function oB({top:e,left:t,right:s,bottom:r}){return{x:{min:t,max:s},y:{min:e,max:r}}}function oI(e){return void 0===e||1===e}function oL({scale:e,scaleX:t,scaleY:s}){return!oI(e)||!oI(t)||!oI(s)}function oO(e){return oL(e)||oF(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function oF(e){var t,s;return(t=e.x)&&"0%"!==t||(s=e.y)&&"0%"!==s}function oz(e,t,s,r,a){return void 0!==a&&(e=r+a*(e-r)),r+s*(e-r)+t}function oV(e,t=0,s=1,r,a){e.min=oz(e.min,t,s,r,a),e.max=oz(e.max,t,s,r,a)}function oU(e,{x:t,y:s}){oV(e.x,t.translate,t.scale,t.originPoint),oV(e.y,s.translate,s.scale,s.originPoint)}function oW(e,t){e.min=e.min+t,e.max=e.max+t}function oH(e,t,s,r,a=.5){let n=oE(e.min,e.max,a);oV(e,t,s,n,r)}function oq(e,t){oH(e.x,t.x,t.scaleX,t.scale,t.originX),oH(e.y,t.y,t.scaleY,t.scale,t.originY)}function oK(e,t){return oB(function(e,t){if(!t)return e;let s=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:s.y,left:s.x,bottom:r.y,right:r.x}}(e.getBoundingClientRect(),t))}class oX extends om{constructor(){super(...arguments),this.type="html",this.renderInstance=oT}readValueFromInstance(e,t){if(nC.has(t))return this.projection?.isProjecting?iE(t):((e,t)=>{let{transform:s="none"}=getComputedStyle(e);return i_(s,t)})(e,t);{let s=window.getComputedStyle(e),r=(ig(t)?s.getPropertyValue(t):s[t])||0;return"string"==typeof r?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return oK(e,t)}build(e,t,s){ov(e,t,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,s){return oA(e,t,s)}}let oY=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function oG(e){if("string"!=typeof e||e.includes("-"));else if(oY.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let oJ=(0,M.createContext)({strict:!1}),oZ=(0,M.createContext)({});function oQ(e){return Array.isArray(e)?e.join(" "):e}let o0=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function o1(e,t,s){for(let r in t)il(t[r])||oR(r,s)||(e[r]=t[r])}let o2=()=>({...o0(),attrs:{}}),o5=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function o3(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||o5.has(e)}let o4=e=>!o3(e);try{v=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof v&&(o4=e=>e.startsWith("on")?!o3(e):v(e))}catch{}function o9(e){return il(e)?e.get():e}let o7=e=>(t,s)=>{let r=(0,M.useContext)(oZ),a=(0,M.useContext)(nf),n=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},s,r,a){return{latestValues:function(e,t,s,r){let a={},n=r(e,{});for(let e in n)a[e]=o9(n[e]);let{initial:i,animate:o}=e,l=ol(e),c=oc(e);t&&c&&!l&&!1!==e.inherit&&(void 0===i&&(i=t.initial),void 0===o&&(o=t.animate));let d=!!s&&!1===s.initial,u=(d=d||!1===i)?o:i;if(u&&"boolean"!=typeof u&&!oa(u)){let t=Array.isArray(u)?u:[u];for(let s=0;s<t.length;s++){let r=ou(e,t[s]);if(r){let{transitionEnd:e,transition:t,...s}=r;for(let e in s){let t=s[e];if(Array.isArray(t)){let e=d?t.length-1:0;t=t[e]}null!==t&&(a[e]=t)}for(let t in e)a[t]=e[t]}}}return a}(s,r,a,e),renderState:t()}})(e,t,r,a);return s?n():nd(n)},o6=o7({scrapeMotionValuesFromProps:oA,createRenderState:o0}),o8=o7({scrapeMotionValuesFromProps:o$,createRenderState:o2}),le={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},lt=!1;function ls(){return!function(){if(lt)return;let e={};for(let t in le)e[t]={isEnabled:e=>le[t].some(t=>!!e[t])};of=e,lt=!0}(),of}let lr=Symbol.for("motionComponentSymbol"),la="data-"+ox("framerAppearId"),ln=(0,M.createContext)({});function li(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function lo(e,{forwardMotionProps:t=!1,type:s}={},r,a){r&&function(e){let t=ls();for(let s in e)t[s]={...t[s],...e[s]};of=t}(r);let n=s?"svg"===s:oG(e),i=n?o8:o6;function o(s,r){var o;let l,c,d,u={...(0,M.useContext)(ng),...s,layoutId:function({layoutId:e}){let t=(0,M.useContext)(nc).id;return t&&void 0!==e?t+"-"+e:e}(s)},{isStatic:h}=u,f=function(e){let{initial:t,animate:s}=function(e,t){if(ol(e)){let{initial:t,animate:s}=e;return{initial:!1===t||on(t)?t:void 0,animate:on(s)?s:void 0}}return!1!==e.inherit?t:{}}(e,(0,M.useContext)(oZ));return(0,M.useMemo)(()=>({initial:t,animate:s}),[oQ(t),oQ(s)])}(s),p=i(s,h);if(!h&&nu){(0,M.useContext)(oJ).strict;let t=function(e){let{drag:t,layout:s}=ls();if(!t&&!s)return{};let r={...t,...s};return{MeasureLayout:t?.isEnabled(e)||s?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(u);l=t.MeasureLayout,f.visualElement=function(e,t,s,r,a,n){let{visualElement:i}=(0,M.useContext)(oZ),o=(0,M.useContext)(oJ),l=(0,M.useContext)(nf),c=(0,M.useContext)(ng).reducedMotion,d=(0,M.useRef)(null);r=r||o.renderer,!d.current&&r&&(d.current=r(e,{visualState:t,parent:i,props:s,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:c,isSVG:n}));let u=d.current,h=(0,M.useContext)(ln);u&&!u.projection&&a&&("html"===u.type||"svg"===u.type)&&function(e,t,s,r){let{layoutId:a,layout:n,drag:i,dragConstraints:o,layoutScroll:l,layoutRoot:c,layoutCrossfade:d}=t;e.projection=new s(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:a,layout:n,alwaysMeasureLayout:!!i||o&&li(o),visualElement:e,animationType:"string"==typeof n?n:"both",initialPromotionConfig:r,crossfade:d,layoutScroll:l,layoutRoot:c})}(d.current,s,a,h);let f=(0,M.useRef)(!1);(0,M.useInsertionEffect)(()=>{u&&f.current&&u.update(s,l)});let p=s[la],m=(0,M.useRef)(!!p&&!window.MotionHandoffIsComplete?.(p)&&window.MotionHasOptimisedAnimation?.(p));return nh(()=>{u&&(f.current=!0,window.MotionIsMounted=!0,u.updateFeatures(),u.scheduleRenderMicrotask(),m.current&&u.animationState&&u.animationState.animateChanges())}),(0,M.useEffect)(()=>{u&&(!m.current&&u.animationState&&u.animationState.animateChanges(),m.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(p)}),m.current=!1),u.enteringChildren=void 0)}),u}(e,p,u,a,t.ProjectionNode,n)}return(0,N.jsxs)(oZ.Provider,{value:f,children:[l&&f.visualElement?(0,N.jsx)(l,{visualElement:f.visualElement,...u}):null,function(e,t,s,{latestValues:r},a,n=!1,i){let o=(i??oG(e)?function(e,t,s,r){let a=(0,M.useMemo)(()=>{let s=o2();return oN(s,t,oS(r),e.transformTemplate,e.style),{...s.attrs,style:{...s.style}}},[t]);if(e.style){let t={};o1(t,e.style,e),a.style={...t,...a.style}}return a}:function(e,t){let s,r,a={},n=(s=e.style||{},o1(r={},s,e),Object.assign(r,function({transformTemplate:e},t){return(0,M.useMemo)(()=>{let s=o0();return ov(s,t,e),Object.assign({},s.vars,s.style)},[t])}(e,t)),r);return e.drag&&!1!==e.dragListener&&(a.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(a.tabIndex=0),a.style=n,a})(t,r,a,e),l=function(e,t,s){let r={};for(let a in e)("values"!==a||"object"!=typeof e.values)&&(o4(a)||!0===s&&o3(a)||!t&&!o3(a)||e.draggable&&a.startsWith("onDrag"))&&(r[a]=e[a]);return r}(t,"string"==typeof e,n),c=e!==M.Fragment?{...l,...o,ref:s}:{},{children:d}=t,u=(0,M.useMemo)(()=>il(d)?d.get():d,[d]);return(0,M.createElement)(e,{...c,children:u})}(e,s,(o=f.visualElement,c=(0,M.useRef)(r),(0,M.useInsertionEffect)(()=>{c.current=r}),d=(0,M.useRef)(null),(0,M.useCallback)(e=>{e&&p.onMount?.(e),o&&(e?o.mount(e):o.unmount());let t=c.current;if("function"==typeof t)if(e){let s=t(e);"function"==typeof s&&(d.current=s)}else d.current?(d.current(),d.current=null):t(e);else t&&(t.current=e)},[o])),p,h,t,n)]})}o.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,M.forwardRef)(o);return l[lr]=e,l}class ll{constructor(e){this.isMounted=!1,this.node=e}update(){}}function lc(e,t,s){let r=e.getProps();return ou(r,t,void 0!==s?s:r.custom,e)}function ld(e,t){return e?.[t]??e?.default??e}let lu=e=>Array.isArray(e);function lh(e,t){let s=e.getValue("willChange");if(il(s)&&s.add)return s.add(t);if(!s&&iL.WillChange){let s=new iL.WillChange("auto");e.addValue("willChange",s),s.add(t)}}let lf=e=>1e3*e,lp=(e,t)=>s=>t(e(s)),lm=(...e)=>e.reduce(lp),lx={layout:0,mainThread:0,waapi:0};function lg(e,t,s){return(s<0&&(s+=1),s>1&&(s-=1),s<1/6)?e+(t-e)*6*s:s<.5?t:s<2/3?e+(t-e)*(2/3-s)*6:e}function lb(e,t){return s=>s>0?t:e}let ly=(e,t,s)=>{let r=e*e,a=s*(t*t-r)+r;return a<0?0:Math.sqrt(a)},lv=[nF,nO,nX];function lw(e){let t=lv.find(t=>t.test(e));if(ip(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let s=t.parse(e);return t===nX&&(s=function({hue:e,saturation:t,lightness:s,alpha:r}){e/=360,s/=100;let a=0,n=0,i=0;if(t/=100){let r=s<.5?s*(1+t):s+t-s*t,o=2*s-r;a=lg(o,r,e+1/3),n=lg(o,r,e),i=lg(o,r,e-1/3)}else a=n=i=s;return{red:Math.round(255*a),green:Math.round(255*n),blue:Math.round(255*i),alpha:r}}(s)),s}let lj=(e,t)=>{let s=lw(e),r=lw(t);if(!s||!r)return lb(e,t);let a={...s};return e=>(a.red=ly(s.red,r.red,e),a.green=ly(s.green,r.green,e),a.blue=ly(s.blue,r.blue,e),a.alpha=oE(s.alpha,r.alpha,e),nO.transform(a))},lk=new Set(["none","hidden"]);function lN(e,t){return s=>oE(e,t,s)}function lM(e){return"number"==typeof e?lN:"string"==typeof e?iy(e)?lb:nY.test(e)?lj:lC:Array.isArray(e)?lS:"object"==typeof e?nY.test(e)?lj:lT:lb}function lS(e,t){let s=[...e],r=s.length,a=e.map((e,s)=>lM(e)(e,t[s]));return e=>{for(let t=0;t<r;t++)s[t]=a[t](e);return s}}function lT(e,t){let s={...e,...t},r={};for(let a in s)void 0!==e[a]&&void 0!==t[a]&&(r[a]=lM(e[a])(e[a],t[a]));return e=>{for(let t in r)s[t]=r[t](e);return s}}let lC=(e,t)=>{let s=n3.createTransformer(t),r=n0(e),a=n0(t);if(!(r.indexes.var.length===a.indexes.var.length&&r.indexes.color.length===a.indexes.color.length&&r.indexes.number.length>=a.indexes.number.length))return ip(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),lb(e,t);if(lk.has(e)&&!a.values.length||lk.has(t)&&!r.values.length)return lk.has(e)?s=>s<=0?e:t:s=>s>=1?t:e;return lm(lS(function(e,t){let s=[],r={color:0,var:0,number:0};for(let a=0;a<t.values.length;a++){let n=t.types[a],i=e.indexes[n][r[n]],o=e.values[i]??0;s[a]=o,r[n]++}return s}(r,a),a.values),s)};function lP(e,t,s){return"number"==typeof e&&"number"==typeof t&&"number"==typeof s?oE(e,t,s):lM(e)(e,t)}let lE=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>iz.update(t,e),stop:()=>iV(t),now:()=>iU.isProcessing?iU.timestamp:i9.now()}},l_=(e,t,s=10)=>{let r="",a=Math.max(Math.round(t/s),2);for(let t=0;t<a;t++)r+=Math.round(1e4*e(t/(a-1)))/1e4+", ";return`linear(${r.substring(0,r.length-2)})`};function lR(e){let t=0,s=e.next(t);for(;!s.done&&t<2e4;)t+=50,s=e.next(t);return t>=2e4?1/0:t}function lA(e,t,s){var r,a;let n=Math.max(t-5,0);return r=s-e(n),(a=t-n)?1e3/a*r:0}let l$=.01,lD=2,lB=.005,lI=.5;function lL(e,t){return e*Math.sqrt(1-t*t)}let lO=["duration","bounce"],lF=["stiffness","damping","mass"];function lz(e,t){return t.some(t=>void 0!==e[t])}function lV(e=.3,t=.3){let s,r="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:a,restDelta:n}=r,i=r.keyframes[0],o=r.keyframes[r.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:d,mass:u,duration:h,velocity:f,isResolvedFromDuration:p}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!lz(e,lF)&&lz(e,lO))if(e.visualDuration){let s=2*Math.PI/(1.2*e.visualDuration),r=s*s,a=2*nP(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:1,stiffness:r,damping:a}}else{let s=function({duration:e=800,bounce:t=.3,velocity:s=0,mass:r=1}){let a,n;ip(e<=lf(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let i=1-t;i=nP(.05,1,i),e=nP(.01,10,e/1e3),i<1?(a=t=>{let r=t*i,a=r*e;return .001-(r-s)/lL(t,i)*Math.exp(-a)},n=t=>{let r=t*i*e,n=Math.pow(i,2)*Math.pow(t,2)*e,o=Math.exp(-r),l=lL(Math.pow(t,2),i);return(r*s+s-n)*o*(-a(t)+.001>0?-1:1)/l}):(a=t=>-.001+Math.exp(-t*e)*((t-s)*e+1),n=t=>e*e*(s-t)*Math.exp(-t*e));let o=function(e,t,s){let r=s;for(let s=1;s<12;s++)r-=e(r)/t(r);return r}(a,n,5/e);if(e=lf(e),isNaN(o))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(o,2)*r;return{stiffness:t,damping:2*i*Math.sqrt(r*t),duration:e}}}(e);(t={...t,...s,mass:1}).isResolvedFromDuration=!0}return t}({...r,velocity:-((r.velocity||0)/1e3)}),m=f||0,x=d/(2*Math.sqrt(c*u)),g=o-i,b=Math.sqrt(c/u)/1e3,y=5>Math.abs(g);if(a||(a=y?l$:lD),n||(n=y?lB:lI),x<1){let e=lL(b,x);s=t=>o-Math.exp(-x*b*t)*((m+x*b*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(1===x)s=e=>o-Math.exp(-b*e)*(g+(m+b*g)*e);else{let e=b*Math.sqrt(x*x-1);s=t=>{let s=Math.exp(-x*b*t),r=Math.min(e*t,300);return o-s*((m+x*b*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let v={calculatedDuration:p&&h||null,next:e=>{let t=s(e);if(p)l.done=e>=h;else{let r=0===e?m:0;x<1&&(r=0===e?lf(m):lA(s,e,t));let i=Math.abs(o-t)<=n;l.done=Math.abs(r)<=a&&i}return l.value=l.done?o:t,l},toString:()=>{let e=Math.min(lR(v),2e4),t=l_(t=>v.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return v}function lU({keyframes:e,velocity:t=0,power:s=.8,timeConstant:r=325,bounceDamping:a=10,bounceStiffness:n=500,modifyTarget:i,min:o,max:l,restDelta:c=.5,restSpeed:d}){let u,h,f=e[0],p={done:!1,value:f},m=s*t,x=f+m,g=void 0===i?x:i(x);g!==x&&(m=g-f);let b=e=>-m*Math.exp(-e/r),y=e=>g+b(e),v=e=>{let t=b(e),s=y(e);p.done=Math.abs(t)<=c,p.value=p.done?g:s},w=e=>{let t;if(t=p.value,void 0!==o&&t<o||void 0!==l&&t>l){var s;u=e,h=lV({keyframes:[p.value,(s=p.value,void 0===o?l:void 0===l||Math.abs(o-s)<Math.abs(l-s)?o:l)],velocity:lA(y,e,p.value),damping:a,stiffness:n,restDelta:c,restSpeed:d})}};return w(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==u||(t=!0,v(e),w(e)),void 0!==u&&e>=u)?h.next(e-u):(t||v(e),p)}}}lV.applyToOptions=e=>{let t=function(e,t=100,s){let r=s({...e,keyframes:[0,t]}),a=Math.min(lR(r),2e4);return{type:"keyframes",ease:e=>r.next(a*e).value/t,duration:a/1e3}}(e,100,lV);return e.ease=t.ease,e.duration=lf(t.duration),e.type="keyframes",e};let lW=(e,t,s)=>(((1-3*s+3*t)*e+(3*s-6*t))*e+3*t)*e;function lH(e,t,s,r){return e===t&&s===r?iI:a=>0===a||1===a?a:lW(function(e,t,s,r,a){let n,i,o=0;do(n=lW(i=t+(s-t)/2,r,a)-e)>0?s=i:t=i;while(Math.abs(n)>1e-7&&++o<12)return i}(a,0,1,e,s),t,r)}let lq=lH(.42,0,1,1),lK=lH(0,0,.58,1),lX=lH(.42,0,.58,1),lY=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,lG=e=>t=>1-e(1-t),lJ=lH(.33,1.53,.69,.99),lZ=lG(lJ),lQ=lY(lZ),l0=e=>(e*=2)<1?.5*lZ(e):.5*(2-Math.pow(2,-10*(e-1))),l1=e=>1-Math.sin(Math.acos(e)),l2=lG(l1),l5=lY(l1),l3=e=>Array.isArray(e)&&"number"==typeof e[0],l4={linear:iI,easeIn:lq,easeInOut:lX,easeOut:lK,circIn:l1,circInOut:l5,circOut:l2,backIn:lZ,backInOut:lQ,backOut:lJ,anticipate:l0},l9=e=>{if(l3(e)){im(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,s,r,a]=e;return lH(t,s,r,a)}return"string"==typeof e?(im(void 0!==l4[e],`Invalid easing type '${e}'`,"invalid-easing-type"),l4[e]):e},l7=(e,t,s)=>{let r=t-e;return 0===r?1:(s-e)/r};function l6({duration:e=300,keyframes:t,times:s,ease:r="easeInOut"}){var a;let n,i=Array.isArray(r)&&"number"!=typeof r[0]?r.map(l9):l9(r),o={done:!1,value:t[0]},l=function(e,t,{clamp:s=!0,ease:r,mixer:a}={}){let n=e.length;if(im(n===t.length,"Both input and output ranges must be the same length","range-length"),1===n)return()=>t[0];if(2===n&&t[0]===t[1])return()=>t[1];let i=e[0]===e[1];e[0]>e[n-1]&&(e=[...e].reverse(),t=[...t].reverse());let o=function(e,t,s){let r=[],a=s||iL.mix||lP,n=e.length-1;for(let s=0;s<n;s++){let n=a(e[s],e[s+1]);t&&(n=lm(Array.isArray(t)?t[s]||iI:t,n)),r.push(n)}return r}(t,r,a),l=o.length,c=s=>{if(i&&s<e[0])return t[0];let r=0;if(l>1)for(;r<e.length-2&&!(s<e[r+1]);r++);let a=l7(e[r],e[r+1],s);return o[r](a)};return s?t=>c(nP(e[0],e[n-1],t)):c}((a=s&&s.length===t.length?s:(!function(e,t){let s=e[e.length-1];for(let r=1;r<=t;r++){let a=l7(0,t,r);e.push(oE(s,1,a))}}(n=[0],t.length-1),n),a.map(t=>t*e)),t,{ease:Array.isArray(i)?i:t.map(()=>i||lX).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(o.value=l(t),o.done=t>=e,o)}}let l8=e=>null!==e;function ce(e,{repeat:t,repeatType:s="loop"},r,a=1){let n=e.filter(l8),i=a<0||t&&"loop"!==s&&t%2==1?0:n.length-1;return i&&void 0!==r?r:n[i]}let ct={decay:lU,inertia:lU,tween:l6,keyframes:l6,spring:lV};function cs(e){"string"==typeof e.type&&(e.type=ct[e.type])}class cr{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let ca=e=>e/100;class cn extends cr{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==i9.now()&&this.tick(i9.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},lx.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;cs(e);let{type:t=l6,repeat:s=0,repeatDelay:r=0,repeatType:a,velocity:n=0}=e,{keyframes:i}=e,o=t||l6;o!==l6&&"number"!=typeof i[0]&&(this.mixKeyframes=lm(ca,lP(i[0],i[1])),i=[0,100]);let l=o({...e,keyframes:i});"mirror"===a&&(this.mirroredGenerator=o({...e,keyframes:[...i].reverse(),velocity:-n})),null===l.calculatedDuration&&(l.calculatedDuration=lR(l));let{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+r,this.totalDuration=this.resolvedDuration*(s+1)-r,this.generator=l}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let{generator:s,totalDuration:r,mixKeyframes:a,mirroredGenerator:n,resolvedDuration:i,calculatedDuration:o}=this;if(null===this.startTime)return s.next(0);let{delay:l=0,keyframes:c,repeat:d,repeatType:u,repeatDelay:h,type:f,onUpdate:p,finalKeyframe:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let x=this.currentTime-l*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?x<0:x>r;this.currentTime=Math.max(x,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=r);let b=this.currentTime,y=s;if(d){let e=Math.min(this.currentTime,r)/i,t=Math.floor(e),s=e%1;!s&&e>=1&&(s=1),1===s&&t--,(t=Math.min(t,d+1))%2&&("reverse"===u?(s=1-s,h&&(s-=h/i)):"mirror"===u&&(y=n)),b=nP(0,1,s)*i}let v=g?{done:!1,value:c[0]}:y.next(b);a&&(v.value=a(v.value));let{done:w}=v;g||null===o||(w=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let j=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return j&&f!==lU&&(v.value=ce(c,this.options,m,this.speed)),p&&p(v.value),j&&this.finish(),v}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=lf(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(i9.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=lE,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let s=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=s):null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime||(this.startTime=t??s),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(i9.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,lx.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function ci(e){let t;return()=>(void 0===t&&(t=e()),t)}let co=ci(()=>void 0!==window.ScrollTimeline),cl={},cc=(c=ci(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),()=>cl.linearEasing??c()),cd=([e,t,s,r])=>`cubic-bezier(${e}, ${t}, ${s}, ${r})`,cu={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cd([0,.65,.55,1]),circOut:cd([.55,0,1,.45]),backIn:cd([.31,.01,.66,-.59]),backOut:cd([.33,1.53,.69,.99])};function ch(e){return"function"==typeof e&&"applyToOptions"in e}class cf extends cr{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:s,keyframes:r,pseudoElement:a,allowFlatten:n=!1,finalKeyframe:i,onComplete:o}=e;this.isPseudoElement=!!a,this.allowFlatten=n,this.options=e,im("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return ch(e)&&cc()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,s,{delay:r=0,duration:a=300,repeat:n=0,repeatType:i="loop",ease:o="easeOut",times:l}={},c){let d={[t]:s};l&&(d.offset=l);let u=function e(t,s){if(t)return"function"==typeof t?cc()?l_(t,s):"ease-out":l3(t)?cd(t):Array.isArray(t)?t.map(t=>e(t,s)||cu.easeOut):cu[t]}(o,a);Array.isArray(u)&&(d.easing=u);let h={delay:r,duration:a,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:n+1,direction:"reverse"===i?"alternate":"normal"};c&&(h.pseudoElement=c);let f=e.animate(d,h);return f}(t,s,r,l,a),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){let e=ce(r,this.options,i,this.speed);this.updateMotionValue?this.updateMotionValue(e):s.startsWith("--")?t.style.setProperty(s,e):t.style[s]=e,this.animation.cancel()}o?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=lf(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&co())?(this.animation.timeline=e,iI):t(this)}}let cp={anticipate:l0,backInOut:lQ,circInOut:l5};class cm extends cf{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in cp&&(e.ease=cp[e.ease])}(e),cs(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:s,onComplete:r,element:a,...n}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let i=new cn({...n,autoplay:!1}),o=Math.max(10,i9.now()-this.startTime),l=nP(0,10,o-10);t.setWithVelocity(i.sample(Math.max(0,o-l)).value,i.sample(o).value,l),i.stop()}}let cx=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(n3.test(e)||"0"===e)&&!e.startsWith("url("));function cg(e){e.duration=0,e.type="keyframes"}let cb=new Set(["opacity","clipPath","filter","transform"]),cy=ci(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class cv extends cr{constructor({autoplay:e=!0,delay:t=0,type:s="keyframes",repeat:r=0,repeatDelay:a=0,repeatType:n="loop",keyframes:i,name:o,motionValue:l,element:c,...d}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=i9.now();const u={autoplay:e,delay:t,type:s,repeat:r,repeatDelay:a,repeatType:n,name:o,motionValue:l,element:c,...d},h=c?.KeyframeResolver||iJ;this.keyframeResolver=new h(i,(e,t,s)=>this.onKeyframesResolved(e,t,u,!s),o,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,s,r){this.keyframeResolver=void 0;let{name:a,type:n,velocity:i,delay:o,isHandoff:l,onUpdate:c}=s;this.resolvedAt=i9.now(),!function(e,t,s,r){let a=e[0];if(null===a)return!1;if("display"===t||"visibility"===t)return!0;let n=e[e.length-1],i=cx(a,t),o=cx(n,t);return ip(i===o,`You are trying to animate ${t} from "${a}" to "${n}". "${i?n:a}" is not an animatable value.`,"value-not-animatable"),!!i&&!!o&&(function(e){let t=e[0];if(1===e.length)return!0;for(let s=0;s<e.length;s++)if(e[s]!==t)return!0}(e)||("spring"===s||ch(s))&&r)}(e,a,n,i)&&((iL.instantAnimations||!o)&&c?.(ce(e,s,t)),e[0]=e[e.length-1],cg(s),s.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...s,keyframes:e},u=!l&&function(e){let{motionValue:t,name:s,repeatDelay:r,repeatType:a,damping:n,type:i}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:o,transformTemplate:l}=t.owner.getProps();return cy()&&s&&cb.has(s)&&("transform"!==s||!l)&&!o&&!r&&"mirror"!==a&&0!==n&&"inertia"!==i}(d)?new cm({...d,element:d.motionValue.owner.current}):new cn(d);u.finished.then(()=>this.notifyFinished()).catch(iI),this.pendingTimeline&&(this.stopTimeline=u.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=u}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),iX=!0,iG(),iY(),iX=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let cw={type:"spring",stiffness:500,damping:25,restSpeed:10},cj={type:"keyframes",duration:.8},ck={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},cN=e=>null!==e,cM=(e,t,s,r={},a,n)=>i=>{let o=ld(r,e)||{},l=o.delay||r.delay||0,{elapsed:c=0}=r;c-=lf(l);let d={keyframes:Array.isArray(s)?s:[null,s],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-c,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{i(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:n?void 0:a};!function({when:e,delay:t,delayChildren:s,staggerChildren:r,staggerDirection:a,repeat:n,repeatType:i,repeatDelay:o,from:l,elapsed:c,...d}){return!!Object.keys(d).length}(o)&&Object.assign(d,((e,{keyframes:t})=>t.length>2?cj:nC.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:cw:ck)(e,d)),d.duration&&(d.duration=lf(d.duration)),d.repeatDelay&&(d.repeatDelay=lf(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let u=!1;if(!1!==d.type&&(0!==d.duration||d.repeatDelay)||(cg(d),0===d.delay&&(u=!0)),(iL.instantAnimations||iL.skipAnimations)&&(u=!0,cg(d),d.delay=0),d.allowFlatten=!o.type&&!o.ease,u&&!n&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:s="loop"},r){let a=e.filter(cN),n=t&&"loop"!==s&&t%2==1?0:a.length-1;return a[n]}(d.keyframes,o);if(void 0!==e)return void iz.update(()=>{d.onUpdate(e),d.onComplete()})}return o.isSync?new cn(d):new cv(d)};function cS(e,t,{delay:s=0,transitionOverride:r,type:a}={}){let{transition:n=e.getDefaultTransition(),transitionEnd:i,...o}=t;r&&(n=r);let l=[],c=a&&e.animationState&&e.animationState.getState()[a];for(let t in o){let r=e.getValue(t,e.latestValues[t]??null),a=o[t];if(void 0===a||c&&function({protectedKeys:e,needsAnimating:t},s){let r=e.hasOwnProperty(s)&&!0!==t[s];return t[s]=!1,r}(c,t))continue;let i={delay:s,...ld(n||{},t)},d=r.get();if(void 0!==d&&!r.isAnimating&&!Array.isArray(a)&&a===d&&!i.velocity)continue;let u=!1;if(window.MotionHandoffAnimation){let s=e.props[la];if(s){let e=window.MotionHandoffAnimation(s,t,iz);null!==e&&(i.startTime=e,u=!0)}}lh(e,t),r.start(cM(t,r,a,e.shouldReduceMotion&&ic.has(t)?{type:!1}:i,e,u));let h=r.animation;h&&l.push(h)}return i&&Promise.all(l).then(()=>{iz.update(()=>{i&&function(e,t){let{transitionEnd:s={},transition:r={},...a}=lc(e,t)||{};for(let t in a={...a,...s}){var n;let s=lu(n=a[t])?n[n.length-1]||0:n;e.hasValue(t)?e.getValue(t).set(s):e.addValue(t,i6(s))}}(e,i)})}),l}function cT(e,t,s,r=0,a=1){let n=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),i=e.size,o=(i-1)*r;return"function"==typeof s?s(n,i):1===a?n*r:o-n*r}function cC(e,t,s={}){let r=lc(e,t,"exit"===s.type?e.presenceContext?.custom:void 0),{transition:a=e.getDefaultTransition()||{}}=r||{};s.transitionOverride&&(a=s.transitionOverride);let n=r?()=>Promise.all(cS(e,r,s)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:n=0,staggerChildren:i,staggerDirection:o}=a;return function(e,t,s=0,r=0,a=0,n=1,i){let o=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),o.push(cC(l,t,{...i,delay:s+("function"==typeof r?0:r)+cT(e.variantChildren,l,r,a,n)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}(e,t,r,n,i,o,s)}:()=>Promise.resolve(),{when:o}=a;if(!o)return Promise.all([n(),i(s.delay)]);{let[e,t]="beforeChildren"===o?[n,i]:[i,n];return e().then(()=>t())}}let cP=oo.length;function cE(e,t){if(!Array.isArray(t))return!1;let s=t.length;if(s!==e.length)return!1;for(let r=0;r<s;r++)if(t[r]!==e[r])return!1;return!0}let c_=[...oi].reverse(),cR=oi.length;function cA(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function c$(){return{animate:cA(!0),whileInView:cA(),whileHover:cA(),whileTap:cA(),whileDrag:cA(),whileFocus:cA(),exit:cA()}}let cD=0;function cB(e){return[e("x"),e("y")]}let cI=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function cL(e){return cI.has(e.tagName)||!0===e.isContentEditable}function cO(e,t,s,r={passive:!0}){return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s)}let cF={x:!1,y:!1};function cz(e){return e.max-e.min}function cV(e,t,s,r=.5){e.origin=r,e.originPoint=oE(t.min,t.max,e.origin),e.scale=cz(s)/cz(t),e.translate=oE(s.min,s.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function cU(e,t,s,r){cV(e.x,t.x,s.x,r?r.originX:void 0),cV(e.y,t.y,s.y,r?r.originY:void 0)}function cW(e,t,s){e.min=s.min+t.min,e.max=e.min+cz(t)}function cH(e,t,s){e.min=t.min-s.min,e.max=e.min+cz(t)}function cq(e,t,s){cH(e.x,t.x,s.x),cH(e.y,t.y,s.y)}let cK=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function cX(e){return{point:{x:e.pageX,y:e.pageY}}}function cY(e,t,s,r){return cO(e,t,e=>cK(e)&&s(e,cX(e)),r)}let cG=({current:e})=>e?e.ownerDocument.defaultView:null,cJ=(e,t)=>Math.abs(e-t),cZ=new Set(["auto","scroll"]);class cQ{constructor(e,t,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:a=!1,distanceThreshold:n=3,element:i}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let s=c2(this.lastMoveEventInfo,this.history),r=null!==this.startEvent,a=(e=s.offset,t={x:0,y:0},Math.sqrt(cJ(e.x,t.x)**2+cJ(e.y,t.y)**2)>=this.distanceThreshold);if(!r&&!a)return;let{point:n}=s,{timestamp:i}=iU;this.history.push({...n,timestamp:i});let{onStart:o,onMove:l}=this.handlers;r||(o&&o(this.lastMoveEvent,s),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,s)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=c0(t,this.transformPagePoint),iz.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:s,onSessionEnd:r,resumeAnimation:a}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&a&&a(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let n=c2("pointercancel"===e.type?this.lastMoveEventInfo:c0(t,this.transformPagePoint),this.history);this.startEvent&&s&&s(e,n),r&&r(e,n)},!cK(e))return;this.dragSnapToOrigin=a,this.handlers=t,this.transformPagePoint=s,this.distanceThreshold=n,this.contextWindow=r||window;const o=c0(cX(e),this.transformPagePoint),{point:l}=o,{timestamp:c}=iU;this.history=[{...l,timestamp:c}];const{onSessionStart:d}=t;d&&d(e,c2(o,this.history)),this.removeListeners=lm(cY(this.contextWindow,"pointermove",this.handlePointerMove),cY(this.contextWindow,"pointerup",this.handlePointerUp),cY(this.contextWindow,"pointercancel",this.handlePointerUp)),i&&this.startScrollTracking(i)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(cZ.has(e.overflowX)||cZ.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let s=e===window,r=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a={x:r.x-t.x,y:r.y-t.y};(0!==a.x||0!==a.y)&&(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(e,r),iz.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),iV(this.updatePoint)}}function c0(e,t){return t?{point:t(e.point)}:e}function c1(e,t){return{x:e.x-t.x,y:e.y-t.y}}function c2({point:e},t){return{point:e,delta:c1(e,c5(t)),offset:c1(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let s=e.length-1,r=null,a=c5(e);for(;s>=0&&(r=e[s],!(a.timestamp-r.timestamp>lf(.1)));)s--;if(!r)return{x:0,y:0};let n=(a.timestamp-r.timestamp)/1e3;if(0===n)return{x:0,y:0};let i={x:(a.x-r.x)/n,y:(a.y-r.y)/n};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}(t,.1)}}function c5(e){return e[e.length-1]}function c3(e,t,s){return{min:void 0!==t?e.min+t:void 0,max:void 0!==s?e.max+s-(e.max-e.min):void 0}}function c4(e,t){let s=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([s,r]=[r,s]),{min:s,max:r}}function c9(e,t,s){return{min:c7(e,t),max:c7(e,s)}}function c7(e,t){return"number"==typeof e?e:e[t]||0}let c6=new WeakMap;class c8{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=io(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:s}={}){let{presenceContext:r}=this.visualElement;if(r&&!1===r.isPresent)return;let a=e=>{t?(this.stopAnimation(),this.snapToCursor(cX(e).point)):this.pauseAnimation()},n=(e,t)=>{this.stopAnimation();let{drag:s,dragPropagation:r,onDragStart:a}=this.getProps();if(s&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(cF[e])return null;else return cF[e]=!0,()=>{cF[e]=!1};return cF.x||cF.y?null:(cF.x=cF.y=!0,()=>{cF.x=cF.y=!1})}(s),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),cB(e=>{let t=this.getAxisMotionValue(e).get()||0;if(nU.test(t)){let{projection:s}=this.visualElement;if(s&&s.layout){let r=s.layout.layoutBox[e];r&&(t=cz(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),a&&iz.postRender(()=>a(e,t)),lh(this.visualElement,"transform");let{animationState:n}=this.visualElement;n&&n.setActive("whileDrag",!0)},i=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:s,dragDirectionLock:r,onDirectionLock:a,onDrag:n}=this.getProps();if(!s&&!this.openDragLock)return;let{offset:i}=t;if(r&&null===this.currentDirection){this.currentDirection=function(e,t=10){let s=null;return Math.abs(e.y)>t?s="y":Math.abs(e.x)>t&&(s="x"),s}(i),null!==this.currentDirection&&a&&a(this.currentDirection);return}this.updateAxis("x",t.point,i),this.updateAxis("y",t.point,i),this.visualElement.render(),n&&n(e,t)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>cB(e=>"paused"===this.getAnimationState(e)&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:c}=this.getProps();this.panSession=new cQ(e,{onSessionStart:a,onStart:n,onMove:i,onSessionEnd:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:s,contextWindow:cG(this.visualElement),element:this.visualElement.current})}stop(e,t){let s=e||this.latestPointerEvent,r=t||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!r||!s)return;let{velocity:n}=r;this.startAnimation(n);let{onDragEnd:i}=this.getProps();i&&iz.postRender(()=>i(s,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,s){let{drag:r}=this.getProps();if(!s||!de(e,r,this.currentDirection))return;let a=this.getAxisMotionValue(e),n=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(n=function(e,{min:t,max:s},r){return void 0!==t&&e<t?e=r?oE(t,e,r.min):Math.max(e,t):void 0!==s&&e>s&&(e=r?oE(s,e,r.max):Math.min(e,s)),e}(n,this.constraints[e],this.elastic[e])),a.set(n)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&li(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=function(e,{top:t,left:s,bottom:r,right:a}){return{x:c3(e.x,s,a),y:c3(e.y,t,r)}}(s.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:c9(e,"left","right"),y:c9(e,"top","bottom")}}(t),r!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&cB(e=>{var t,r;let a;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=s.layoutBox[e],r=this.constraints[e],a={},void 0!==r.min&&(a.min=r.min-t.min),void 0!==r.max&&(a.max=r.max-t.min),a))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:s}=this.getProps();if(!t||!li(t))return!1;let r=t.current;im(null!==r,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:a}=this.visualElement;if(!a||!a.layout)return!1;let n=function(e,t,s){let r=oK(e,s),{scroll:a}=t;return a&&(oW(r.x,a.offset.x),oW(r.y,a.offset.y)),r}(r,a.root,this.visualElement.getTransformPagePoint()),i=(e=a.layout.layoutBox,{x:c4(e.x,n.x),y:c4(e.y,n.y)});if(s){let e=s(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(i));this.hasMutatedConstraints=!!e,e&&(i=oB(e))}return i}startAnimation(e){let{drag:t,dragMomentum:s,dragElastic:r,dragTransition:a,dragSnapToOrigin:n,onDragTransitionEnd:i}=this.getProps(),o=this.constraints||{};return Promise.all(cB(i=>{if(!de(i,t,this.currentDirection))return;let l=o&&o[i]||{};n&&(l={min:0,max:0});let c={type:"inertia",velocity:s?e[i]:0,bounceStiffness:r?200:1e6,bounceDamping:r?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...a,...l};return this.startAxisValueAnimation(i,c)})).then(i)}startAxisValueAnimation(e,t){let s=this.getAxisMotionValue(e);return lh(this.visualElement,e),s.start(cM(e,s,0,t,this.visualElement,!1))}stopAnimation(){cB(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){cB(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps();return s[t]||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){cB(t=>{let{drag:s}=this.getProps();if(!de(t,s,this.currentDirection))return;let{projection:r}=this.visualElement,a=this.getAxisMotionValue(t);if(r&&r.layout){let{min:s,max:n}=r.layout.layoutBox[t],i=a.get()||0;a.set(e[t]-oE(s,n,.5)+i)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:s}=this.visualElement;if(!li(t)||!s||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};cB(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var s,a;let n,i,o,l=t.get();r[e]=(s={min:l,max:l},a=this.constraints[e],n=.5,i=cz(s),(o=cz(a))>i?n=l7(a.min,a.max-i,s.min):i>o&&(n=l7(s.min,s.max-o,a.min)),nP(0,1,n))}});let{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),cB(t=>{if(!de(t,e,null))return;let s=this.getAxisMotionValue(t),{min:a,max:n}=this.constraints[t];s.set(oE(a,n,r[t]))})}addListeners(){if(!this.visualElement.current)return;c6.set(this.visualElement,this);let e=cY(this.visualElement.current,"pointerdown",e=>{let{drag:t,dragListener:s=!0}=this.getProps();t&&s&&!cL(e.target)&&this.start(e)}),t=()=>{let{dragConstraints:e}=this.getProps();li(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,r=s.addEventListener("measure",t);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),iz.read(t);let a=cO(window,"resize",()=>this.scalePositionWithinConstraints()),n=s.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(cB(t=>{let s=this.getAxisMotionValue(t);s&&(this.originPoint[t]+=e[t].translate,s.set(s.get()+e[t].translate))}),this.visualElement.render())});return()=>{a(),e(),r(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:a=!1,dragElastic:n=.35,dragMomentum:i=!0}=e;return{...e,drag:t,dragDirectionLock:s,dragPropagation:r,dragConstraints:a,dragElastic:n,dragMomentum:i}}}function de(e,t,s){return(!0===t||t===e)&&(null===s||s===e)}let dt=e=>(t,s)=>{e&&iz.postRender(()=>e(t,s))},ds={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var dr=M;let da=!1;class dn extends dr.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s,layoutId:r}=this.props,{projection:a}=e;a&&(t.group&&t.group.add(a),s&&s.register&&r&&s.register(a),da&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,onExitComplete:()=>this.safeToRemove()})),ds.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:s,drag:r,isPresent:a}=this.props,{projection:n}=s;return n&&(n.isPresent=a,da=!0,r||e.layoutDependency!==t||void 0===t||e.isPresent!==a?n.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?n.promote():n.relegate()||iz.postRender(()=>{let e=n.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),i3.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:s}=this.props,{projection:r}=e;da=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function di(e){let[t,s]=nk(),r=(0,dr.useContext)(nc);return(0,N.jsx)(dn,{...e,layoutGroup:r,switchLayoutGroup:(0,dr.useContext)(ln),isPresent:t,safeToRemove:s})}function dl(e,t,s,r,a){return e-=t,e=r+1/s*(e-r),void 0!==a&&(e=r+1/a*(e-r)),e}function dc(e,t,[s,r,a],n,i){!function(e,t=0,s=1,r=.5,a,n=e,i=e){if(nU.test(t)&&(t=parseFloat(t),t=oE(i.min,i.max,t/100)-i.min),"number"!=typeof t)return;let o=oE(n.min,n.max,r);e===n&&(o-=t),e.min=dl(e.min,t,s,o,a),e.max=dl(e.max,t,s,o,a)}(e,t[s],t[r],t[a],t.scale,n,i)}let dd=["x","scaleX","originX"],du=["y","scaleY","originY"];function dh(e,t,s,r){dc(e.x,t,dd,s?s.x:void 0,r?r.x:void 0),dc(e.y,t,du,s?s.y:void 0,r?r.y:void 0)}function df(e,t){e.min=t.min,e.max=t.max}function dp(e,t){df(e.x,t.x),df(e.y,t.y)}function dm(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function dx(e){return 0===e.translate&&1===e.scale}function dg(e){return dx(e.x)&&dx(e.y)}function db(e,t){return e.min===t.min&&e.max===t.max}function dy(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function dv(e,t){return dy(e.x,t.x)&&dy(e.y,t.y)}function dw(e){return cz(e.x)/cz(e.y)}function dj(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}let dk=["TopLeft","TopRight","BottomLeft","BottomRight"],dN=dk.length,dM=e=>"string"==typeof e?parseFloat(e):e,dS=e=>"number"==typeof e||nW.test(e);function dT(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let dC=dE(0,.5,l2),dP=dE(.5,.95,iI);function dE(e,t,s){return r=>r<e?0:r>t?1:s(l7(e,t,r))}function d_(e){return np(e)&&"ownerSVGElement"in e}let dR=(e,t)=>e.depth-t.depth;class dA{constructor(){this.children=[],this.isDirty=!1}add(e){i1(this.children,e),this.isDirty=!0}remove(e){i2(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(dR),this.isDirty=!1,this.children.forEach(e)}}class d${constructor(){this.members=[]}add(e){i1(this.members,e),e.scheduleRender()}remove(e){if(i2(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,s=this.members.findIndex(t=>e===t);if(0===s)return!1;for(let e=s;e>=0;e--){let s=this.members[e];if(!1!==s.isPresent){t=s;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,t&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:r}=e.options;!1===r&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:s}=e;t.onExitComplete&&t.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let dD=["","X","Y","Z"],dB=0;function dI(e,t,s,r){let{latestValues:a}=t;a[e]&&(s[e]=a[e],t.setStaticValue(e,0),r&&(r[e]=0))}function dL({attachResizeListener:e,defaultParent:t,measureScroll:s,checkIsScrollRoot:r,resetTransform:a}){return class{constructor(e={},s=t?.()){this.id=dB++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(dz),this.nodes.forEach(dX),this.nodes.forEach(dY),this.nodes.forEach(dV)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new dA)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new i5),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let s=this.eventHandlers.get(e);s&&s.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=d_(t)&&!(d_(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:s,layout:r,visualElement:a}=this.options;if(a&&!a.current&&a.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||s)&&(this.isLayoutDirty=!0),e){let s,r=0,a=()=>this.root.updateBlockedByResize=!1;iz.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==r){let t,n;r=e,this.root.updateBlockedByResize=!0,s&&s(),t=i9.now(),n=({timestamp:e})=>{let s=e-t;s>=250&&(iV(n),a(s-250))},iz.setup(n,!0),s=()=>iV(n),ds.hasAnimatedSinceResize&&(ds.hasAnimatedSinceResize=!1,this.nodes.forEach(dK))}})}s&&this.root.registerSharedNode(s,this),!1!==this.options.animate&&a&&(s||r)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:s,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let n=this.options.transition||a.getDefaultTransition()||d1,{onLayoutAnimationStart:i,onLayoutAnimationComplete:o}=a.getProps(),l=!this.targetLayout||!dv(this.targetLayout,r),c=!t&&s;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...ld(n,"layout"),onPlay:i,onComplete:o};(a.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c)}else t||dK(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),iV(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(dG),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:s}=t.options;if(!s)return;let r=s.props[la];if(window.MotionHasOptimisedAnimation(r,"transform")){let{layout:e,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",iz,!(e||s))}let{parent:a}=t;a&&!a.hasCheckedOptimisedAppear&&e(a)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:s}=this.options;if(void 0===t&&!s)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(dW);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(dH);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(dq),this.nodes.forEach(dO),this.nodes.forEach(dF)):this.nodes.forEach(dH),this.clearAllSnapshots();let e=i9.now();iU.delta=nP(0,1e3/60,e-iU.timestamp),iU.timestamp=e,iU.isProcessing=!0,iW.update.process(iU),iW.preRender.process(iU),iW.render.process(iU),iU.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,i3.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(dU),this.sharedNodes.forEach(dJ)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,iz.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){iz.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||cz(this.snapshot.measuredBox.x)||cz(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=io(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:s(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!a)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!dg(this.projectionDelta),s=this.getTransformTemplate(),r=s?s(this.latestValues,""):void 0,n=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||oO(this.latestValues)||n)&&(a(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let s=this.measurePageBox(),r=this.removeElementScroll(s);return e&&(r=this.removeTransform(r)),d3((t=r).x),d3(t.y),{animationId:this.root.animationId,measuredBox:s,layoutBox:r,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return io();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(d9))){let{scroll:e}=this.root;e&&(oW(t.x,e.offset.x),oW(t.y,e.offset.y))}return t}removeElementScroll(e){let t=io();if(dp(t,e),this.scroll?.wasRoot)return t;for(let s=0;s<this.path.length;s++){let r=this.path[s],{scroll:a,options:n}=r;r!==this.root&&a&&n.layoutScroll&&(a.wasRoot&&dp(t,e),oW(t.x,a.offset.x),oW(t.y,a.offset.y))}return t}applyTransform(e,t=!1){let s=io();dp(s,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&oq(s,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),oO(r.latestValues)&&oq(s,r.latestValues)}return oO(this.latestValues)&&oq(s,this.latestValues),s}removeTransform(e){let t=io();dp(t,e);for(let e=0;e<this.path.length;e++){let s=this.path[e];if(!s.instance||!oO(s.latestValues))continue;oL(s.latestValues)&&s.updateSnapshot();let r=io();dp(r,s.measurePageBox()),dh(t,s.latestValues,s.snapshot?s.snapshot.layoutBox:void 0,r)}return oO(this.latestValues)&&dh(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==iU.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let s=!!this.resumingFrom||this!==t;if(!(e||s&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:a}=this.options;if(!this.layout||!(r||a))return;this.resolvedRelativeTargetAt=iU.timestamp;let n=this.getClosestProjectingParent();if(n&&this.linkedParentVersion!==n.layoutVersion&&!n.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(n&&n.layout?this.createRelativeTarget(n,this.layout.layoutBox,n.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=io(),this.targetWithTransforms=io()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var i,o,l;this.forceRelativeParentToResolveTarget(),i=this.target,o=this.relativeTarget,l=this.relativeParent.target,cW(i.x,o.x,l.x),cW(i.y,o.y,l.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):dp(this.target,this.layout.layoutBox),oU(this.target,this.targetDelta)):dp(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,n&&!!n.resumingFrom==!!this.resumingFrom&&!n.options.layoutScroll&&n.target&&1!==this.animationProgress?this.createRelativeTarget(n,this.target,n.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||oL(this.parent.latestValues)||oF(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,s){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=io(),this.relativeTargetOrigin=io(),cq(this.relativeTargetOrigin,t,s),dp(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,s=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(s=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(s=!1),this.resolvedRelativeTargetAt===iU.timestamp&&(s=!1),s)return;let{layout:r,layoutId:a}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||a))return;dp(this.layoutCorrected,this.layout.layoutBox);let n=this.treeScale.x,i=this.treeScale.y;!function(e,t,s,r=!1){let a,n,i=s.length;if(i){t.x=t.y=1;for(let o=0;o<i;o++){n=(a=s[o]).projectionDelta;let{visualElement:i}=a.options;(!i||!i.props.style||"contents"!==i.props.style.display)&&(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&oq(e,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),n&&(t.x*=n.x.scale,t.y*=n.y.scale,oU(e,n)),r&&oO(a.latestValues)&&oq(e,a.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=io());let{target:o}=e;if(!o){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(dm(this.prevProjectionDelta.x,this.projectionDelta.x),dm(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),cU(this.projectionDelta,this.layoutCorrected,o,this.latestValues),this.treeScale.x===n&&this.treeScale.y===i&&dj(this.projectionDelta.x,this.prevProjectionDelta.x)&&dj(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",o))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ia(),this.projectionDelta=ia(),this.projectionDeltaWithTransform=ia()}setAnimationOrigin(e,t=!1){let s,r=this.snapshot,a=r?r.latestValues:{},n={...this.latestValues},i=ia();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=io(),l=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),d=!c||c.members.length<=1,u=!!(l&&!d&&!0===this.options.crossfade&&!this.path.some(d0));this.animationProgress=0,this.mixTargetDelta=t=>{let r=t/1e3;if(dZ(i.x,e.x,r),dZ(i.y,e.y,r),this.setTargetDelta(i),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var c,h,f,p,m,x;cq(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),f=this.relativeTarget,p=this.relativeTargetOrigin,m=o,x=r,dQ(f.x,p.x,m.x,x),dQ(f.y,p.y,m.y,x),s&&(c=this.relativeTarget,h=s,db(c.x,h.x)&&db(c.y,h.y))&&(this.isProjectionDirty=!1),s||(s=io()),dp(s,this.relativeTarget)}l&&(this.animationValues=n,function(e,t,s,r,a,n){a?(e.opacity=oE(0,s.opacity??1,dC(r)),e.opacityExit=oE(t.opacity??1,0,dP(r))):n&&(e.opacity=oE(t.opacity??1,s.opacity??1,r));for(let a=0;a<dN;a++){let n=`border${dk[a]}Radius`,i=dT(t,n),o=dT(s,n);(void 0!==i||void 0!==o)&&(i||(i=0),o||(o=0),0===i||0===o||dS(i)===dS(o)?(e[n]=Math.max(oE(dM(i),dM(o),r),0),(nU.test(o)||nU.test(i))&&(e[n]+="%")):e[n]=o)}(t.rotate||s.rotate)&&(e.rotate=oE(t.rotate||0,s.rotate||0,r))}(n,a,this.latestValues,r,u,d)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=r},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(iV(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=iz.update(()=>{var t,s,r;let a;ds.hasAnimatedSinceResize=!0,lx.layout++,this.motionValue||(this.motionValue=i6(0)),this.currentAnimation=(t=this.motionValue,s=[0,1e3],r={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{lx.layout--},onComplete:()=>{lx.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(a=il(t)?t:i6(t)).start(cM("",a,s,r)),a.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:s,layout:r,latestValues:a}=e;if(t&&s&&r){if(this!==e&&this.layout&&r&&d4(this.options.animationType,this.layout.layoutBox,r.layoutBox)){s=this.target||io();let t=cz(this.layout.layoutBox.x);s.x.min=e.target.x.min,s.x.max=s.x.min+t;let r=cz(this.layout.layoutBox.y);s.y.min=e.target.y.min,s.y.max=s.y.min+r}dp(t,s),oq(t,a),cU(this.projectionDeltaWithTransform,this.layoutCorrected,t,a)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new d$),this.sharedNodes.get(e).add(t);let s=t.options.initialPromotionConfig;t.promote({transition:s?s.transition:void 0,preserveFollowOpacity:s&&s.shouldPreserveFollowOpacity?s.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:s}={}){let r=this.getStack();r&&r.promote(this,s),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:s}=e;if((s.z||s.rotate||s.rotateX||s.rotateY||s.rotateZ||s.skewX||s.skewY)&&(t=!0),!t)return;let r={};s.z&&dI("z",e,r,this.animationValues);for(let t=0;t<dD.length;t++)dI(`rotate${dD[t]}`,e,r,this.animationValues),dI(`skew${dD[t]}`,e,r,this.animationValues);for(let t in e.render(),r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let s=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=o9(t?.pointerEvents)||"",e.transform=s?s(this.latestValues,""):"none";return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=o9(t?.pointerEvents)||""),this.hasProjected&&!oO(this.latestValues)&&(e.transform=s?s({},""):"none",this.hasProjected=!1);return}e.visibility="";let a=r.animationValues||r.latestValues;this.applyTransformsToTarget();let n=function(e,t,s){let r="",a=e.x.translate/t.x,n=e.y.translate/t.y,i=s?.z||0;if((a||n||i)&&(r=`translate3d(${a}px, ${n}px, ${i}px) `),(1!==t.x||1!==t.y)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),s){let{transformPerspective:e,rotate:t,rotateX:a,rotateY:n,skewX:i,skewY:o}=s;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),a&&(r+=`rotateX(${a}deg) `),n&&(r+=`rotateY(${n}deg) `),i&&(r+=`skewX(${i}deg) `),o&&(r+=`skewY(${o}deg) `)}let o=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==o||1!==l)&&(r+=`scale(${o}, ${l})`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,a);s&&(n=s(a,n)),e.transform=n;let{x:i,y:o}=this.projectionDelta;for(let t in e.transformOrigin=`${100*i.origin}% ${100*o.origin}% 0`,r.animationValues?e.opacity=r===this?a.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:a.opacityExit:e.opacity=r===this?void 0!==a.opacity?a.opacity:"":void 0!==a.opacityExit?a.opacityExit:0,o_){if(void 0===a[t])continue;let{correct:s,applyTo:i,isCSSVariable:o}=o_[t],l="none"===n?a[t]:s(a[t],r);if(i){let t=i.length;for(let s=0;s<t;s++)e[i[s]]=l}else o?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=r===this?o9(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(dW),this.root.sharedNodes.clear()}}}function dO(e){e.updateLayout()}function dF(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:s,measuredBox:r}=e.layout,{animationType:a}=e.options,n=t.source!==e.layout.source;"size"===a?cB(e=>{let r=n?t.measuredBox[e]:t.layoutBox[e],a=cz(r);r.min=s[e].min,r.max=r.min+a}):d4(a,t.layoutBox,s)&&cB(r=>{let a=n?t.measuredBox[r]:t.layoutBox[r],i=cz(s[r]);a.max=a.min+i,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+i)});let i=ia();cU(i,s,t.layoutBox);let o=ia();n?cU(o,e.applyTransform(r,!0),t.measuredBox):cU(o,s,t.layoutBox);let l=!dg(i),c=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:a,layout:n}=r;if(a&&n){let i=io();cq(i,t.layoutBox,a.layoutBox);let o=io();cq(o,s,n.layoutBox),dv(i,o)||(c=!0),r.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=i,e.relativeParent=r)}}}e.notifyListeners("didUpdate",{layout:s,snapshot:t,delta:o,layoutDelta:i,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function dz(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function dV(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function dU(e){e.clearSnapshot()}function dW(e){e.clearMeasurements()}function dH(e){e.isLayoutDirty=!1}function dq(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function dK(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function dX(e){e.resolveTargetDelta()}function dY(e){e.calcProjection()}function dG(e){e.resetSkewAndRotation()}function dJ(e){e.removeLeadSnapshot()}function dZ(e,t,s){e.translate=oE(t.translate,0,s),e.scale=oE(t.scale,1,s),e.origin=t.origin,e.originPoint=t.originPoint}function dQ(e,t,s,r){e.min=oE(t.min,s.min,r),e.max=oE(t.max,s.max,r)}function d0(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let d1={duration:.45,ease:[.4,0,.1,1]},d2=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),d5=d2("applewebkit/")&&!d2("chrome/")?Math.round:iI;function d3(e){e.min=d5(e.min),e.max=d5(e.max)}function d4(e,t,s){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(dw(t)-dw(s)))}function d9(e){return e!==e.root&&e.scroll?.wasRoot}let d7=dL({attachResizeListener:(e,t)=>cO(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),d6={current:void 0},d8=dL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!d6.current){let e=new d7({});e.mount(window),e.setOptions({layoutScroll:!0}),d6.current=e}return d6.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function ue(e,t){let s=function(e,t,s){if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document,s=(void 0)??t.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}(e),r=new AbortController;return[s,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function ut(e){return!("touch"===e.pointerType||cF.x||cF.y)}function us(e,t,s){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover","Start"===s);let a=r["onHover"+s];a&&iz.postRender(()=>a(t,cX(t)))}let ur=(e,t)=>!!t&&(e===t||ur(e,t.parentElement)),ua=new WeakSet;function un(e){return t=>{"Enter"===t.key&&e(t)}}function ui(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function uo(e){return cK(e)&&!(cF.x||cF.y)}function ul(e,t,s){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap","Start"===s);let a=r["onTap"+("End"===s?"":s)];a&&iz.postRender(()=>a(t,cX(t)))}let uc=new WeakMap,ud=new WeakMap,uu=e=>{let t=uc.get(e.target);t&&t(e)},uh=e=>{e.forEach(uu)},uf={some:0,all:1},up=function(e,t){if("u"<typeof Proxy)return lo;let s=new Map,r=(s,r)=>lo(s,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(a,n)=>"create"===n?r:(s.has(n)||s.set(n,lo(n,void 0,e,t)),s.get(n))})}({animation:{Feature:class extends ll{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:s})=>(function(e,t,s={}){let r;if(e.notify("AnimationStart",t),Array.isArray(t))r=Promise.all(t.map(t=>cC(e,t,s)));else if("string"==typeof t)r=cC(e,t,s);else{let a="function"==typeof t?lc(e,t,s.custom):t;r=Promise.all(cS(e,a,s))}return r.then(()=>{e.notify("AnimationComplete",t)})})(e,t,s))),s=c$(),r=!0,a=t=>(s,r)=>{let a=lc(e,r,"exit"===t?e.presenceContext?.custom:void 0);if(a){let{transition:e,transitionEnd:t,...r}=a;s={...s,...r,...t}}return s};function n(n){let{props:i}=e,o=function e(t){if(!t)return;if(!t.isControllingVariants){let s=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(s.initial=t.props.initial),s}let s={};for(let e=0;e<cP;e++){let r=oo[e],a=t.props[r];(on(a)||!1===a)&&(s[r]=a)}return s}(e.parent)||{},l=[],c=new Set,d={},u=1/0;for(let t=0;t<cR;t++){var h,f;let p=c_[t],m=s[p],x=void 0!==i[p]?i[p]:o[p],g=on(x),b=p===n?m.isActive:null;!1===b&&(u=t);let y=x===o[p]&&x!==i[p]&&g;if(y&&r&&e.manuallyAnimateOnMount&&(y=!1),m.protectedKeys={...d},!m.isActive&&null===b||!x&&!m.prevProp||oa(x)||"boolean"==typeof x)continue;let v=(h=m.prevProp,"string"==typeof(f=x)?f!==h:!!Array.isArray(f)&&!cE(f,h)),w=v||p===n&&m.isActive&&!y&&g||t>u&&g,j=!1,k=Array.isArray(x)?x:[x],N=k.reduce(a(p),{});!1===b&&(N={});let{prevResolvedValues:M={}}=m,S={...M,...N},T=t=>{w=!0,c.has(t)&&(j=!0,c.delete(t)),m.needsAnimating[t]=!0;let s=e.getValue(t);s&&(s.liveStyle=!1)};for(let e in S){let t=N[e],s=M[e];if(!d.hasOwnProperty(e))(lu(t)&&lu(s)?cE(t,s):t===s)?void 0!==t&&c.has(e)?T(e):m.protectedKeys[e]=!0:null!=t?T(e):c.add(e)}m.prevProp=x,m.prevResolvedValues=N,m.isActive&&(d={...d,...N}),r&&e.blockInitialAnimation&&(w=!1);let C=y&&v,P=!C||j;w&&P&&l.push(...k.map(t=>{let s={type:p};if("string"==typeof t&&r&&!C&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,a=lc(r,t);if(r.enteringChildren&&a){let{delayChildren:t}=a.transition||{};s.delay=cT(r.enteringChildren,e,t)}}return{animation:t,options:s}}))}if(c.size){let t={};if("boolean"!=typeof i.initial){let s=lc(e,Array.isArray(i.initial)?i.initial[0]:i.initial);s&&s.transition&&(t.transition=s.transition)}c.forEach(s=>{let r=e.getBaseTarget(s),a=e.getValue(s);a&&(a.liveStyle=!0),t[s]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(!1===i.initial||i.initial===i.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,p?t(l):Promise.resolve()}return{animateChanges:n,setActive:function(t,r){if(s[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),s[t].isActive=r;let a=n(t);for(let e in s)s[e].protectedKeys={};return a},setAnimateFunction:function(s){t=s(e)},getState:()=>s,reset:()=>{s=c$()}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();oa(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends ll{constructor(){super(...arguments),this.id=cD++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;let r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends ll{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:s={}}=this.node.getProps(),{root:r,margin:a,amount:n="some",once:i}=s,o={root:r?r.current:void 0,rootMargin:a,threshold:"number"==typeof n?n:uf[n]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:s,onViewportLeave:r}=this.node.getProps(),a=t?s:r;a&&a(e)};return e=this.node.current,t=function({root:e,...t}){let s=e||document;ud.has(s)||ud.set(s,{});let r=ud.get(s),a=JSON.stringify(t);return r[a]||(r[a]=new IntersectionObserver(uh,{root:e,...t})),r[a]}(o),uc.set(e,l),t.observe(e),()=>{uc.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return s=>e[s]!==t[s]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends ll{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,s={}){let[r,a,n]=ue(e,s),i=e=>{let r=e.currentTarget;if(!uo(e))return;ua.add(r);let n=t(r,e),i=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),ua.has(r)&&ua.delete(r),uo(e)&&"function"==typeof n&&n(e,{success:t})},o=e=>{i(e,r===window||r===document||s.useGlobalTarget||ur(r,e.target))},l=e=>{i(e,!1)};window.addEventListener("pointerup",o,a),window.addEventListener("pointercancel",l,a)};return r.forEach(e=>{(s.useGlobalTarget?window:e).addEventListener("pointerdown",i,a),nm(e)&&(e.addEventListener("focus",e=>((e,t)=>{let s=e.currentTarget;if(!s)return;let r=un(()=>{if(ua.has(s))return;ui(s,"down");let e=un(()=>{ui(s,"up")});s.addEventListener("keyup",e,t),s.addEventListener("blur",()=>ui(s,"cancel"),t)});s.addEventListener("keydown",r,t),s.addEventListener("blur",()=>s.removeEventListener("keydown",r),t)})(e,a)),cL(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),n}(e,(e,t)=>(ul(this.node,t,"Start"),(e,{success:t})=>ul(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends ll{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=lm(cO(this.node.current,"focus",()=>this.onFocus()),cO(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends ll{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,s={}){let[r,a,n]=ue(e,s),i=e=>{if(!ut(e))return;let{target:s}=e,r=t(s,e);if("function"!=typeof r||!s)return;let n=e=>{ut(e)&&(r(e),s.removeEventListener("pointerleave",n))};s.addEventListener("pointerleave",n,a)};return r.forEach(e=>{e.addEventListener("pointerenter",i,a)}),n}(e,(e,t)=>(us(this.node,t,"Start"),e=>us(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends ll{constructor(){super(...arguments),this.removePointerDownListener=iI}onPointerDown(e){this.session=new cQ(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:cG(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:dt(e),onStart:dt(t),onMove:s,onEnd:(e,t)=>{delete this.session,r&&iz.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=cY(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends ll{constructor(e){super(e),this.removeGroupControls=iI,this.removeListeners=iI,this.controls=new c8(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||iI}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:d8,MeasureLayout:di},layout:{ProjectionNode:d8,MeasureLayout:di}},(e,t)=>t.isSVG??oG(e)?new oD(t):new oX(t,{allowProjection:e!==M.Fragment}));function um(){let e=td(e=>e._achievementQueue),t=td(e=>e.consumeAchievementQueue),{toast:s}=(0,tU.useToast)(),[r,a]=(0,M.useState)([]);return((0,M.useEffect)(()=>{if(0!==e.length)for(let e of t()){tX("achievement");let t=Date.now()+Math.random();a(s=>[...s,{achievement:e,id:t}]),setTimeout(()=>{a(e=>e.filter(e=>e.id!==t))},4e3),s({title:`成就解锁:${e.name}`,description:`${e.desc} 奖励:${e.rewardText}`})}},[e,t,s]),0===r.length)?null:(0,N.jsx)("div",{className:"fixed inset-0 z-[120] pointer-events-none flex items-center justify-center",children:(0,N.jsx)(nS,{children:r.map((e,t)=>{let s=e.achievement,a=(t-(r.length-1)/2)*140;return(0,N.jsx)(up.div,{initial:{opacity:0,scale:.4,y:40,rotateX:-30},animate:{opacity:1,scale:1,y:a,rotateX:0},exit:{opacity:0,scale:.6,y:-60},transition:{type:"spring",stiffness:280,damping:22},className:"absolute",style:{transformOrigin:"center center"},children:(0,N.jsxs)("div",{className:"relative rounded-2xl border-2 px-8 py-5 backdrop-blur-xl overflow-hidden",style:{borderColor:s.color,background:`linear-gradient(135deg, ${s.color}22, rgba(5,4,16,0.92))`,boxShadow:`0 0 60px ${s.color}66, 0 0 120px ${s.color}33, inset 0 0 30px ${s.color}11`,minWidth:320,maxWidth:420},children:[(0,N.jsx)("div",{className:"absolute -top-20 -right-20 h-40 w-40 rounded-full blur-3xl opacity-50",style:{background:s.color}}),(0,N.jsx)(up.div,{className:"absolute inset-0 rounded-2xl opacity-20",style:{background:`conic-gradient(from 0deg, transparent, ${s.color}, transparent, ${s.color}, transparent)`},animate:{rotate:360},transition:{duration:8,repeat:1/0,ease:"linear"}}),(0,N.jsxs)("div",{className:"relative flex items-center gap-4",children:[(0,N.jsx)(up.div,{className:"shrink-0 h-16 w-16 rounded-2xl flex items-center justify-center text-3xl",style:{background:`${s.color}33`,border:`2px solid ${s.color}`,boxShadow:`0 0 20px ${s.color}88, inset 0 0 12px ${s.color}44`},animate:{boxShadow:[`0 0 20px ${s.color}88, inset 0 0 12px ${s.color}44`,`0 0 40px ${s.color}cc, inset 0 0 20px ${s.color}66`,`0 0 20px ${s.color}88, inset 0 0 12px ${s.color}44`]},transition:{duration:2,repeat:1/0},children:s.icon}),(0,N.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,N.jsx)(up.div,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:.15},className:"text-[10px] font-mono uppercase tracking-[0.2em] mb-0.5",style:{color:s.color},children:"✦ Achievement Unlocked"}),(0,N.jsx)(up.h3,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:.2},className:"text-lg font-bold truncate",style:{color:s.color,textShadow:`0 0 12px ${s.color}66`},children:s.name}),(0,N.jsx)(up.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.3},className:"text-[11px] text-muted-foreground/90 truncate",children:s.desc}),(0,N.jsxs)(up.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.4},className:"mt-1.5 inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono font-semibold",style:{background:`${s.color}22`,border:`1px solid ${s.color}55`,color:s.color},children:["▸ ",s.rewardText]})]})]}),(0,N.jsx)(up.div,{className:"absolute bottom-0 left-0 h-0.5",style:{background:s.color},initial:{width:"100%"},animate:{width:"0%"},transition:{duration:4,ease:"linear"}})]})},e.id)})})})}function ux(){let e=td(e=>e.constellation??[]),t=(0,M.useRef)(null),s=(0,M.useRef)(null),[r,a]=(0,M.useState)({w:360,h:360}),[n,i]=(0,M.useState)(null),o=(0,M.useMemo)(()=>new Set(e),[e]);(0,M.useEffect)(()=>{let e=s.current;if(!e)return;let t=new ResizeObserver(()=>{let t=e.getBoundingClientRect();a({w:Math.max(280,t.width),h:Math.max(280,Math.min(420,t.width))})});return t.observe(e),()=>t.disconnect()},[]);let l=(0,M.useMemo)(()=>{let e=r.w/2;return{cx:e,cy:r.h/2,radius:.32*Math.min(r.w,r.h)}},[r]),c=(0,M.useMemo)(()=>{var e,t,s;return(e=l.cx,t=l.cy,s=l.radius,["mining","decoding","expedition","contact","economy","cosmic"].map((r,a)=>{let n=Math.PI/3*a-Math.PI/2;return{category:r,cx:e+s*Math.cos(n),cy:t+s*Math.sin(n),meta:G[r]}})).map(e=>{let t=function(e,t,s,r=1){return J.filter(t=>t.category===e).sort((e,t)=>e.order-t.order).map((e,a)=>({perk:e,x:t+(0===a?0:1===a?-18*r:18*r),y:s+(0===a?-22*r:14*r)}))}(e.category,e.cx,e.cy,1);return{...e,stars:t}})},[l]);(0,M.useEffect)(()=>{let s=t.current;if(!s)return;let a=s.getContext("2d");if(!a)return;let n=window.devicePixelRatio||1;s.width=r.w*n,s.height=r.h*n,s.style.width=`${r.w}px`,s.style.height=`${r.h}px`,a.setTransform(n,0,0,n,0,0);let i=0,d=performance.now(),u=t=>{let s=(t-d)/1e3;a.clearRect(0,0,r.w,r.h);let n=a.createRadialGradient(l.cx,l.cy,0,l.cx,l.cy,1.6*l.radius);n.addColorStop(0,"rgba(40,30,80,0.18)"),n.addColorStop(1,"rgba(5,4,16,0)"),a.fillStyle=n,a.fillRect(0,0,r.w,r.h),a.save(),a.translate(l.cx,l.cy);let h=6+1.5*Math.sin(1.5*s),f=a.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)"),a.fillStyle=f,a.beginPath(),a.arc(0,0,3*h,0,2*Math.PI),a.fill(),a.fillStyle="#fce7ff",a.beginPath(),a.arc(0,0,.6*h,0,2*Math.PI),a.fill(),a.restore(),c))et(e,t.category)>0&&(a.save(),a.strokeStyle=t.meta.glow,a.lineWidth=1,a.setLineDash([2,4]),a.globalAlpha=.4+.1*Math.sin(2*s+t.cx),a.beginPath(),a.moveTo(l.cx,l.cy),a.lineTo(t.cx,t.cy),a.stroke(),a.restore());for(let t of c){let r=et(e,t.category);a.save(),a.font="10px ui-monospace, monospace",a.textAlign="center",a.fillStyle=r>0?t.meta.hex:"rgba(148,163,184,0.5)",a.globalAlpha=.85,a.fillText(t.meta.name,t.cx,t.cy+38),a.restore();let n=t.stars.filter(e=>o.has(e.perk.id));for(let e of(n.length>=2&&(a.save(),a.strokeStyle=t.meta.glow,a.lineWidth=1.5,a.globalAlpha=.6,a.beginPath(),n.forEach((e,t)=>{0===t?a.moveTo(e.x,e.y):a.lineTo(e.x,e.y)}),a.stroke(),a.restore()),t.stars)){let r=o.has(e.perk.id);a.save(),a.translate(e.x,e.y);let n=r?.85+.15*Math.sin(3*s+.1*e.x):.3,i=r?10:5,l=a.createRadialGradient(0,0,0,0,0,i);if(l.addColorStop(0,r?t.meta.glow:"rgba(100,116,139,0.2)"),l.addColorStop(1,"rgba(0,0,0,0)"),a.fillStyle=l,a.globalAlpha=n,a.beginPath(),a.arc(0,0,i,0,2*Math.PI),a.fill(),a.globalAlpha=r?1:.4,a.fillStyle=r?t.meta.hex:"#475569",a.beginPath(),a.arc(0,0,r?3.5:2,0,2*Math.PI),a.fill(),r){a.strokeStyle=t.meta.hex,a.globalAlpha=.7*n,a.lineWidth=.8;let r=7+1.5*Math.sin(4*s+.1*e.y);a.beginPath(),a.moveTo(-r,0),a.lineTo(r,0),a.moveTo(0,-r),a.lineTo(0,r),a.stroke()}a.restore()}}i=requestAnimationFrame(u)};return i=requestAnimationFrame(u),()=>cancelAnimationFrame(i)},[c,l,r,e,o]);let d=es(e);return(0,N.jsxs)("div",{ref:s,className:"flex flex-col gap-2 min-h-0 h-full",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between text-[11px] px-1",children:[(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)("span",{className:"text-fuchsia-300",children:"✦"}),(0,N.jsx)("span",{className:"text-muted-foreground",children:"星图天赋"}),(0,N.jsxs)("span",{className:"font-mono text-foreground",children:[d.unlocked,"/",d.total]})]}),(0,N.jsx)("span",{className:"text-muted-foreground/60 text-[10px]",children:"每次飞升可解锁 1 个"})]}),(0,N.jsxs)("div",{className:"relative rounded-xl bg-black/30 border border-white/5 overflow-hidden flex-shrink-0",children:[(0,N.jsx)("canvas",{ref:t,onMouseMove:e=>{let s=t.current;if(!s)return;let r=s.getBoundingClientRect(),a=e.clientX-r.left,n=e.clientY-r.top,l=null,d=14;for(let e of c)for(let t of e.stars){let e=Math.hypot(t.x-a,t.y-n);e<d&&(d=e,l={perk:t.perk,x:t.x,y:t.y,unlocked:o.has(t.perk.id)})}i(l)},onMouseLeave:()=>i(null),className:"block cursor-pointer"}),n&&(0,N.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,r.w-200),top:Math.max(0,n.y-40)},children:[(0,N.jsxs)("div",{className:"font-bold mb-0.5",style:{color:G[n.perk.category].hex},children:[n.unlocked?"★ ":"☆ ",n.perk.name]}),(0,N.jsx)("div",{className:"text-muted-foreground",children:n.perk.desc}),(0,N.jsxs)("div",{className:"text-muted-foreground/60 mt-0.5",children:[G[n.perk.category].name," · 序",n.perk.order]})]})]}),(0,N.jsx)("div",{className:"grid grid-cols-3 gap-1 text-[10px]",children:Object.keys(G).map(t=>{let s=G[t],r=et(e,t),a=J.filter(e=>e.category===t).length;return(0,N.jsxs)("div",{className:"rounded-md bg-black/25 border border-white/5 px-1.5 py-1 flex items-center gap-1",style:r>0?{borderColor:`${s.hex}40`}:void 0,children:[(0,N.jsx)("span",{className:"inline-block h-1.5 w-1.5 rounded-full flex-shrink-0",style:{background:s.hex,boxShadow:r>0?`0 0 4px ${s.hex}`:"none"}}),(0,N.jsx)("span",{className:"text-muted-foreground truncate",children:s.name}),(0,N.jsxs)("span",{className:"ml-auto font-mono",style:{color:r>0?s.hex:"rgba(148,163,184,0.5)"},children:[r,"/",a]})]},t)})}),(0,N.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto pr-1 echo-scrollbar",children:0===e.length?(0,N.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,N.jsx)("div",{className:"mb-1 text-fuchsia-300/80",children:"✦"}),"尚未解锁任何天赋。",(0,N.jsx)("br",{}),"累积接触进度至 100%,发起「飞升」即可在 3 个随机天赋中选 1。"]}):(0,N.jsx)("div",{className:"flex flex-col gap-1",children:e.map(e=>{let t=Z(e);if(!t)return null;let s=G[t.category];return(0,N.jsxs)("div",{className:"rounded-md bg-black/25 border px-2 py-1.5 flex items-center gap-2 text-[11px]",style:{borderColor:`${s.hex}30`},children:[(0,N.jsx)("span",{className:"inline-block h-2 w-2 rounded-full flex-shrink-0",style:{background:s.hex,boxShadow:`0 0 6px ${s.hex}`}}),(0,N.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,N.jsx)("div",{className:"text-foreground truncate",children:t.name}),(0,N.jsx)("div",{className:"text-muted-foreground/70 text-[10px] truncate",children:t.desc})]}),(0,N.jsx)("span",{className:"text-[9px] text-muted-foreground/50 font-mono",children:s.name})]},e)})})})]})}let ug=(0,tu.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 ub({open:e,onOpenChange:t}){let s=td(e=>e.pendingPerkChoices),r=td(e=>e.constellation??[]),a=td(e=>e.chooseConstellationPerk),n=td(e=>e.rerollPerkChoices),[i,o]=(0,M.useState)(null);if((0,M.useEffect)(()=>{e||o(null)},[e]),(0,M.useEffect)(()=>{s&&s.length>0&&!e&&t(!0),(!s||0===s.length)&&e&&t(!1)},[s,e,t]),!s||0===s.length)return null;let l=es(r);return(0,N.jsx)(aC,{open:e,onOpenChange:t,children:(0,N.jsxs)(a_,{className:"max-w-md border-fuchsia-400/30 bg-gradient-to-br from-[#0a0820]/95 to-[#1a0f30]/95 backdrop-blur-md",children:[(0,N.jsxs)(aR,{children:[(0,N.jsxs)(a$,{className:"flex items-center gap-2 text-fuchsia-200",children:[(0,N.jsx)(t7,{className:"h-4 w-4"}),"星图觉醒"]}),(0,N.jsxs)(aD,{className:"text-muted-foreground text-xs",children:["飞升带来的回响在星图上凝聚。从 3 道星辉中选择 1 道,永久获得其加成。",(0,N.jsx)("br",{}),(0,N.jsxs)("span",{className:"text-fuchsia-300/80",children:["当前已觉醒 ",l.unlocked,"/",l.total]})]})]}),(0,N.jsx)("div",{className:"grid grid-cols-1 gap-2 mt-1",children:s.map(e=>{let s=Z(e);if(!s)return null;let r=G[s.category],n=i===e;return(0,N.jsxs)("button",{onClick:()=>{o(e),a(e)&&(tX("constellation"),setTimeout(()=>t(!1),500))},disabled:!!i,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]":i?"border-white/5 opacity-40":"border-white/10 hover:border-white/30 hover:bg-white/5"}`,style:{boxShadow:n?`0 0 20px ${r.glow}`:void 0},children:[(0,N.jsx)("div",{className:"absolute left-0 top-0 bottom-0 w-1",style:{background:r.hex,boxShadow:`0 0 8px ${r.hex}`}}),(0,N.jsxs)("div",{className:"pl-2 flex items-start gap-3",children:[(0,N.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:`${r.hex}20`,color:r.hex,border:`1px solid ${r.hex}40`},children:r.name.charAt(0)}),(0,N.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,N.jsx)("span",{className:"text-sm font-bold text-foreground",children:s.name}),(0,N.jsx)("span",{className:"text-[9px] px-1 py-0.5 rounded font-mono",style:{background:`${r.hex}20`,color:r.hex},children:r.name})]}),(0,N.jsx)("div",{className:"text-[11px] text-muted-foreground",children:s.desc})]})]}),n&&(0,N.jsx)("div",{className:"absolute inset-0 pointer-events-none",children:[...Array(8)].map((e,t)=>(0,N.jsx)("span",{className:"absolute h-1 w-1 rounded-full animate-ping",style:{background:r.hex,left:`${20+8*t}%`,top:`${30+t%3*20}%`,animationDelay:`${50*t}ms`,animationDuration:"800ms"}},t))})]},e)})}),(0,N.jsxs)("div",{className:"flex items-center justify-between mt-3 pt-2 border-t border-white/5",children:[(0,N.jsxs)(t4,{variant:"ghost",size:"sm",onClick:()=>{n(),tX("uiClick")},disabled:!!i,className:"text-muted-foreground hover:text-foreground h-7 text-[11px]",children:[(0,N.jsx)(ug,{className:"h-3 w-3 mr-1"}),"重新抽取"]}),(0,N.jsx)("span",{className:"text-[10px] text-muted-foreground/60",children:"✦ 选择后永久保留,跨周目生效"})]})]})})}let uy=(0,tu.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),uv=(0,tu.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"}]]),uw=(0,tu.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);function uj({open:e,onOpenChange:t}){let s=td(e=>e.chronicle??[]),r=td(e=>e.ascensions??0),a=td(e=>e.bossKills??0),n=td(e=>e.starTidesEncountered??[]),i=(0,M.useMemo)(()=>[...s].reverse(),[s]),o=Math.max(1,Math.ceil(i.length/10)),[l,c]=(0,M.useState)(1);(0,M.useEffect)(()=>{l>o&&c(1)},[l,o]),(0,M.useEffect)(()=>{e&&(tX("chronicleOpen"),c(1))},[e]);let d=i.slice((l-1)*10,10*l);return(0,N.jsx)(aC,{open:e,onOpenChange:t,children:(0,N.jsxs)(a_,{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,N.jsx)("div",{className:"h-1 bg-gradient-to-r from-emerald-500 via-fuchsia-500 to-amber-500 opacity-70"}),(0,N.jsxs)(aR,{className:"px-6 pt-5 pb-3 space-y-1",children:[(0,N.jsxs)(a$,{className:"flex items-center gap-2 text-fuchsia-100 text-xl",children:[(0,N.jsx)(sl,{className:"h-5 w-5 text-fuchsia-300"}),"回响编年史",(0,N.jsx)("span",{className:"text-[11px] font-normal text-fuchsia-300/60 ml-2",children:"Chronicle of Echoes"})]}),(0,N.jsx)(aD,{className:"text-fuchsia-200/60 text-xs",children:"每一次飞升都在深空留下回响。这里铭刻着跨越维度的全部纪元。"}),(0,N.jsxs)("div",{className:"grid grid-cols-3 gap-2 pt-2",children:[(0,N.jsx)(uk,{icon:(0,N.jsx)(t7,{className:"h-3 w-3"}),label:"飞升次数",value:r,color:"#e879f9"}),(0,N.jsx)(uk,{icon:(0,N.jsx)(no,{className:"h-3 w-3"}),label:"BOSS 击破",value:a,color:"#fbbf24"}),(0,N.jsx)(uk,{icon:(0,N.jsx)(tp,{className:"h-3 w-3"}),label:"星潮亲历",value:n.length,color:"#34d399"})]})]}),(0,N.jsx)("div",{className:"flex-1 overflow-y-auto px-6 pb-3 echo-scroll",children:0===i.length?(0,N.jsx)(uN,{ascensions:r}):(0,N.jsxs)("div",{className:"relative",children:[(0,N.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,N.jsx)("div",{className:"space-y-4",children:d.map((e,t)=>(0,N.jsx)(uM,{entry:e,isLatest:(l-1)*10+t===0,index:(l-1)*10+t},`${e.ascensionNumber}-${e.timestamp}`))})]})}),i.length>10&&(0,N.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,N.jsxs)("span",{className:"text-[11px] text-muted-foreground font-mono",children:["第 ",l," / ",o," 页 · 共 ",i.length," 条飞升记录"]}),(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsxs)(t4,{variant:"ghost",size:"sm",disabled:l<=1,onClick:()=>{tX("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,N.jsx)(uw,{className:"h-3.5 w-3.5"}),"上一页"]}),(0,N.jsxs)(t4,{variant:"ghost",size:"sm",disabled:l>=o,onClick:()=>{tX("tabSwitch"),c(e=>Math.min(o,e+1))},className:"h-7 px-2 text-fuchsia-300 hover:bg-fuchsia-500/15 disabled:opacity-30",children:["下一页",(0,N.jsx)(nr,{className:"h-3.5 w-3.5"})]})]})]})]})})}function uk({icon:e,label:t,value:s,color:r}){return(0,N.jsxs)("div",{className:"rounded-md border px-3 py-2 flex items-center gap-2",style:{borderColor:`${r}33`,background:`${r}0d`},children:[(0,N.jsx)("div",{style:{color:r},children:e}),(0,N.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,N.jsx)("div",{className:"text-[10px] text-muted-foreground truncate",children:t}),(0,N.jsx)("div",{className:"text-sm font-mono font-bold",style:{color:r},children:s})]})]})}function uN({ascensions:e}){let t=e>0;return(0,N.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[(0,N.jsxs)("div",{className:"relative mb-4",children:[(0,N.jsx)("div",{className:"absolute inset-0 blur-xl bg-fuchsia-500/20 rounded-full animate-pulse"}),(0,N.jsx)(sl,{className:"relative h-12 w-12 text-fuchsia-400/50"})]}),t?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)("div",{className:"text-fuchsia-200/70 text-sm",children:["已飞升 ",e," 次,但编年史尚无记录"]}),(0,N.jsx)("div",{className:"text-fuchsia-300/40 text-[11px] mt-2 max-w-xs",children:"编年史于 v0.4 启用。下一次飞升将自动铭刻新纪元,开启永恒叙事时间轴。"})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{className:"text-fuchsia-200/70 text-sm",children:"尚未飞升,等待第一次跨越维度"}),(0,N.jsx)("div",{className:"text-fuchsia-300/40 text-[11px] mt-2 max-w-xs",children:"当接触进度满溢时,发起飞升将开启新周目,并在编年史中铭刻一段永恒回响。"})]})]})}function uM({entry:e,isLatest:t,index:s}){let r,a,n,i,o,l=["#34d399","#fb7185","#fbbf24","#e879f9","#fcd34d"][(e.ascensionNumber-1)%5];return(0,N.jsxs)("div",{className:"relative pl-16 animate-in fade-in slide-in-from-bottom-2 duration-500",style:{animationDelay:`${80*s}ms`},children:[(0,N.jsxs)("div",{className:"absolute left-[19px] top-3 z-10",children:[(0,N.jsx)("div",{className:"w-4 h-4 rounded-full border-2 flex items-center justify-center",style:{borderColor:l,background:`${l}22`,boxShadow:`0 0 12px ${l}88, 0 0 24px ${l}44`},children:(0,N.jsx)("div",{className:"w-1.5 h-1.5 rounded-full",style:{background:l}})}),t&&(0,N.jsx)("div",{className:"absolute inset-0 rounded-full animate-ping",style:{background:`${l}33`}})]}),(0,N.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:`${l}33`,boxShadow:t?`0 0 0 1px ${l}22, 0 4px 24px ${l}22`:"0 2px 8px rgba(0,0,0,0.4)"},children:[(0,N.jsx)("div",{className:"px-4 py-3 flex items-center justify-between border-b",style:{background:`linear-gradient(135deg, ${l}11, transparent)`,borderColor:`${l}22`},children:(0,N.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,N.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,N.jsxs)("span",{className:"text-[10px] font-mono font-bold px-1.5 py-0.5 rounded",style:{color:l,background:`${l}22`},children:["#",String(e.ascensionNumber).padStart(2,"0")]}),(0,N.jsx)("h4",{className:"text-sm font-bold tracking-wide truncate",style:{color:l,textShadow:`0 0 12px ${l}55`},children:e.epochName})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-[10px] text-muted-foreground/80",children:[(0,N.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,N.jsx)(uy,{className:"h-2.5 w-2.5"}),(a=String((r=new Date(e.timestamp)).getMonth()+1).padStart(2,"0"),n=String(r.getDate()).padStart(2,"0"),i=String(r.getHours()).padStart(2,"0"),o=String(r.getMinutes()).padStart(2,"0"),`${a}-${n} ${i}:${o}`)]}),(0,N.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,N.jsx)("span",{children:function(e){if(e<60)return`${e}秒`;let t=Math.floor(e/60),s=e%60;if(t<60)return s>0?`${t}${s}秒`:`${t}分钟`;let r=Math.floor(t/60);return`${r}小时${t%60}分`}(e.durationSec)}),t&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,N.jsx)("span",{className:"text-fuchsia-300 font-bold",children:"最新"})]})]})]})}),(0,N.jsx)("div",{className:"px-4 py-3 text-[12px] leading-relaxed text-fuchsia-100/75 font-serif",children:ed({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,N.jsxs)("div",{className:"px-4 pb-3 flex flex-wrap gap-1.5",children:[(0,N.jsx)(uS,{icon:(0,N.jsx)(uv,{className:"h-2.5 w-2.5"}),label:"解码",value:e.summary.crystalsDecodedThisRun,color:"#fb7185"}),(0,N.jsx)(uS,{icon:(0,N.jsx)(t7,{className:"h-2.5 w-2.5"}),label:"技术",value:e.summary.techsUnlocked,color:"#34d399"}),(0,N.jsx)(uS,{icon:(0,N.jsx)(a7,{className:"h-2.5 w-2.5"}),label:"探险",value:e.summary.expeditionsCompleted,color:"#fbbf24"}),e.summary.bossKills>0&&(0,N.jsx)(uS,{icon:(0,N.jsx)(no,{className:"h-2.5 w-2.5"}),label:"BOSS",value:e.summary.bossKills,color:"#e879f9"}),(0,N.jsx)(uS,{icon:(0,N.jsx)(tp,{className:"h-2.5 w-2.5"}),label:"星潮",value:e.tidesThisRun.length,color:"#94a3b8"}),(0,N.jsx)(uS,{icon:(0,N.jsx)(aB,{className:"h-2.5 w-2.5"}),label:"星图",value:e.summary.constellationsTotal,color:"#fcd34d"})]}),e.tidesThisRun.length>0&&(0,N.jsx)("div",{className:"px-4 pb-2 flex flex-wrap gap-1",children:e.tidesThisRun.map(e=>{let t,s=(t=q[e.startsWith("tide_")?e.slice(5):e])?{name:t.name,color:t.color}:{name:e,color:"#94a3b8"};return(0,N.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded border",style:{color:s.color,borderColor:`${s.color}44`,background:`${s.color}11`},children:["✦ ",s.name]},e)})}),e.perksThisAscension.length>0&&(0,N.jsx)("div",{className:"px-4 pb-2 flex flex-wrap gap-1",children:e.perksThisAscension.map(e=>{let t=Z(e),s=t?.category||"cosmic",r=G[s]?.hex||"#94a3b8",a=G[s]?.name||s,n=er[e]||e;return(0,N.jsxs)("span",{className:"text-[9px] px-1.5 py-0.5 rounded border inline-flex items-center gap-1",style:{color:r,borderColor:`${r}55`,background:`${r}11`},title:`${a} \xb7 ${t?.desc||""}`,children:[(0,N.jsx)(ns,{className:"h-2 w-2"}),n]},e)})}),e.milestones.length>0&&(0,N.jsx)("div",{className:"px-4 py-2 border-t flex flex-wrap gap-1.5",style:{borderColor:`${l}22`,background:`${l}08`},children:e.milestones.map((e,t)=>(0,N.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,N.jsx)(t7,{className:"h-2 w-2"}),e]},t))})]})]})}function uS({icon:e,label:t,value:s,color:r}){return(0,N.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded inline-flex items-center gap-1 font-mono",style:{color:r,background:`${r}11`,border:`1px solid ${r}22`},children:[e,(0,N.jsx)("span",{className:"opacity-70",children:t}),(0,N.jsx)("span",{className:"font-bold",children:s})]})}let uT=(0,tu.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"}]]),uC=(0,tu.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"}]]),uP=(0,tu.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"}]]),uE=(0,tu.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"}]]),u_=(0,tu.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"}]]),uR=(0,tu.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"}]]),uA=(0,tu.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"}]]),u$=(0,tu.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"}]]),uD=(0,tu.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"}]]),uB=(0,tu.default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),uI=["routine","anomaly","singular"];function uL(e){return 0===e?{icon:uP,color:"#fbbf24",label:"1st"}:1===e?{icon:uE,color:"#cbd5e1",label:"2nd"}:2===e?{icon:uC,color:"#f97316",label:"3rd"}:null}function uO(){let e,t,s,r,a,n,i=td(e=>e.grantBeaconReward),o=td(e=>e.claimWeeklyBeacon),l=td(e=>e.claimTimedBeacon),c=td(e=>e.claimChainReward),{toast:d}=(0,tU.useToast)(),[u,h]=(0,M.useState)(null),[f,p]=(0,M.useState)(null),[m,x]=(0,M.useState)(null),[g,b]=(0,M.useState)(null),[y,v]=(0,M.useState)(null),[w,j]=(0,M.useState)(null),[k,S]=(0,M.useState)(null),[T,C]=(0,M.useState)([]),[P,E]=(0,M.useState)("00:00:00"),[_,R]=(0,M.useState)("00:00:00"),[A,$]=(0,M.useState)("00:00:00"),[D,B]=(0,M.useState)(Date.now()),[I,L]=(0,M.useState)("local"),[O,F]=(0,M.useState)([]),[z,V]=(0,M.useState)(!1),[W,H]=(0,M.useState)(null),[q,K]=(0,M.useState)(!1),[X,Y]=(0,M.useState)(0),G=(0,M.useRef)(!1);(0,M.useEffect)(()=>{h(eI()),p(eU()),x(e7()),b(e6()),v(eX()),j(eY()),S(e0()),C(ez());let e=setInterval(()=>{B(Date.now()),p(eU()),b(e6()),j(eY()),S(e0()),h(e=>e??eI()),x(e=>e??e7()),v(e=>e??eX())},1e3);return()=>clearInterval(e)},[]),(0,M.useEffect)(()=>{E(eH(function(e=new Date){return Math.max(0,Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()+1,0,0,0)-e.getTime())}(new Date(D)))),R(eH(e9(new Date(D)))),$(eH(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(D))))},[D]),(0,M.useEffect)(()=>{Y(ts())},[]);let J=(0,M.useCallback)(async()=>{if(!G.current){G.current=!0,V(!0),H(null);try{let e=await tr();F(e),K(!0),Y(ts()),0===e.length&&H("尚无全球记录,成为首位登顶者!")}catch{H("全球榜连接失败,请稍后重试")}finally{V(!1),G.current=!1}}},[]);(0,M.useEffect)(()=>{"global"!==I||q||z||J()},[I,q,z,J]);let Z=(0,M.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:ez()};let s=eL(e,t.progress,t.durationSec),r={timestamp:Date.now(),dateKey:e.dateKey,challenge:e.type,difficulty:e.difficulty,progress:t.progress/e.goal,score:s,durationSec:t.durationSec},a=eV(r);return eW({...t,claimed:!0}),{rewardInsight:e.rewardInsight,rewardContact:e.rewardContact,score:s,leaderboard:a,entry:r}}(u,f);C(e.leaderboard),p(eU()),i(e.rewardInsight,e.rewardContact),tX("achievement"),d({title:"✦ 每日信标奖励已领取",description:`+${e.rewardInsight} 洞见 \xb7 +${e.rewardContact.toFixed(1)} 接触 \xb7 得分 ${e.score}`}),e.entry&&ta(e.entry).then(t=>{t>=1&&(Y(e.entry.timestamp),"global"===I&&J())})},[u,f,d,i,I,J]),Q=(0,M.useCallback)(()=>{if(!m||!g||null===g.completedAt||g.claimed)return;let e=l();C(ez()),b(e6()),(e.rewardInsight>0||e.rewardContact>0)&&(tX("achievement"),d({title:"✦ 限时挑战奖励已领取",description:`+${e.rewardInsight} 洞见 \xb7 +${e.rewardContact.toFixed(1)} 接触 \xb7 得分 ${e.score}`}),Y(ts()),"global"===I&&J())},[m,g,d,l,I,J]),ee=(0,M.useCallback)(()=>{if(!y||!w||null===w.completedAt||w.claimed)return;let e=o();C(ez()),j(eY()),(e.rewardInsight>0||e.rewardContact>0)&&(tX("achievement"),d({title:"✦ 周挑战奖励已领取",description:`+${e.rewardInsight} 洞见 \xb7 +${e.rewardContact.toFixed(1)} 接触 \xb7 得分 ${e.score}`}),Y(ts()),"global"===I&&J())},[y,w,d,o,I,J]),et=(0,M.useCallback)(e=>{let t=eQ.find(t=>t.milestone===e),s=c(e);S(e0()),s.ok&&(tX("achievement"),d({title:`✦ ${s.label||t?.label||"里程碑"} 已领取`,description:`+${s.rewardInsight} 洞见 \xb7 +${s.rewardContact.toFixed(1)} 接触`}))},[d,c]);if(!u||!f||!m||!g||!y||!w||!k)return(0,N.jsx)("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground/60",children:"正在校准深空信标…"});let es=eA[u.difficulty],er=e$[u.type],ea=Math.min(100,f.progress/u.goal*100),en=null!==f.completedAt,ei=f.claimed,eo=en&&!ei,el=eA[m.difficulty],ec=e$[m.type],ed=Math.min(100,g.progress/m.goal*100),eu=null!==g.completedAt,eh=g.claimed,ef=eu&&!eh,ep=eA[y.difficulty],em=e$[y.type],ex=Math.min(100,w.progress/y.goal*100),eg=null!==w.completedAt,eb=w.claimed,ey=eg&&!eb,ev=function(e){let t=e5(e),s=0;for(let t of eZ)e>=t&&(s=t);if(null===t)return{current:e,next:null,prev:s,progressPct:100};let r=t-s,a=e-s;return{current:e,next:t,prev:s,progressPct:Math.min(100,Math.max(0,r>0?Math.round(a/r*100):100))}}(k.currentStreak),ew=e5(k.currentStreak),ej=eD(),ek=k.lastCompletedDateKey===ej;return(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex flex-col gap-2.5 h-full overflow-y-auto echo-scroll pr-0.5",children:[(0,N.jsx)(tV.default,{id:"12f5fcaad97b9273",dynamic:[es.glow,es.glow,es.glow,es.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 ${es.glow},inset 0 0 12px ${es.glow}}50%{box-shadow:0 0 32px ${es.glow},inset 0 0 20px ${es.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,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between",children:[(0,N.jsxs)("h3",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-sm font-semibold flex items-center gap-1.5",children:[(0,N.jsx)(uT,{className:"h-4 w-4 text-fuchsia-400"}),"深空信标"]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1 text-[10px] text-muted-foreground/70",children:[(0,N.jsx)(uy,{className:"h-3 w-3"}),"次日重置",(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono text-fuchsia-300/90",children:P})]})]}),(0,N.jsxs)("div",{style:{borderColor:`${es.color}55`,background:`linear-gradient(135deg, ${es.color}1f, rgba(0,0,0,0.45))`,animation:en?"none":"beacon-glow 3s ease-in-out infinite"},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" relative rounded-xl border p-3 overflow-hidden",children:[!en&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{style:{border:`1.5px solid ${es.color}`,animation:"beacon-pulse-ring 2.5s ease-out infinite"},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" absolute top-4 right-4 h-10 w-10 rounded-full pointer-events-none"}),(0,N.jsx)("div",{style:{border:`1.5px solid ${es.color}`,animation:"beacon-pulse-ring 2.5s ease-out infinite 1.25s"},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" absolute top-4 right-4 h-10 w-10 rounded-full pointer-events-none"})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" relative",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1.5 mb-2",children:[(0,N.jsxs)("span",{style:{background:`${es.color}22`,color:es.color,border:`1px solid ${es.color}55`},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]]),children:es.icon}),es.label]}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded bg-white/5 text-muted-foreground border border-white/10",children:[er.icon," ",er.label]}),en&&(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)(t7,{className:"h-2.5 w-2.5"})," 已完成"]})]}),(0,N.jsx)("h4",{style:{color:es.color,textShadow:`0 0 10px ${es.glow}`},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-sm font-semibold mb-1",children:u.title}),(0,N.jsx)("p",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[11px] text-muted-foreground/80 leading-relaxed mb-2.5",children:u.desc}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" mb-2",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between mb-1",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] text-muted-foreground/70",children:"进度"}),(0,N.jsxs)("span",{style:{color:es.color},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[11px] font-mono font-semibold",children:[Math.min(f.progress,u.goal)," / ",u.goal," ",er.unit]})]}),(0,N.jsx)(tO,{value:ea,className:"h-2 bg-black/40",style:{"--progress-color":es.color}})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between gap-2",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-2 text-[10px]",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-muted-foreground/60",children:"奖励:"}),u.rewardInsight>0&&(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-amber-300 font-mono",children:["+",U(u.rewardInsight),"洞见"]}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-fuchsia-300 font-mono",children:["+",u.rewardContact.toFixed(1),"接触"]})]}),(0,N.jsx)(t4,{onClick:Z,disabled:!eo,size:"sm",className:"h-7 px-3 text-[11px] border-0",style:{background:eo?`linear-gradient(90deg, ${es.color}, ${es.color}cc)`:`${es.color}1a`,color:eo?"#022c22":`${es.color}99`},children:ei?"已领取":eo?"领取奖励":en?"已领取":"进行中…"})]}),en&&f.durationSec>0&&(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" mt-1.5 text-[10px] text-muted-foreground/50 text-center",children:["完成用时 ",Math.floor(f.durationSec/60),"分",f.durationSec%60,"秒"]})]})]}),(e=18e5>e9(new Date(D))&&!eu,t=eu?"none":e?"timed-urgent 1.5s ease-in-out infinite":"timed-glow 3s ease-in-out infinite",(0,N.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:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" relative rounded-xl border p-3 overflow-hidden",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between mb-2",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1.5",children:[(0,N.jsx)(uA,{className:`h-3.5 w-3.5 ${e?"text-rose-400":"text-amber-400"}`}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" "+`text-xs font-semibold ${e?"text-rose-200":"text-amber-200"}`,children:"限时挑战 · TIMED"})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1 text-[9px] text-muted-foreground/70",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono text-amber-300/70",children:e4().split("_").slice(1).join(" ")}),(0,N.jsx)(uy,{className:"h-2.5 w-2.5"}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" "+`font-mono ${e?"text-rose-300":"text-amber-300/90"}`,children:_})]})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1.5 mb-2",children:[(0,N.jsxs)("span",{style:{background:`${el.color}22`,color:el.color,border:`1px solid ${el.color}55`},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]]),children:el.icon}),el.label]}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)(t7,{className:"h-2.5 w-2.5"})," 已完成"]}),e&&!eu&&(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)("h4",{style:{color:el.color,textShadow:`0 0 10px ${el.glow}`},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-sm font-semibold mb-1",children:m.title}),(0,N.jsx)("p",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] text-muted-foreground/80 leading-relaxed mb-2",children:m.desc}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" mb-2",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between mb-1",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] text-muted-foreground/70",children:"进度"}),(0,N.jsxs)("span",{style:{color:el.color},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[11px] font-mono font-semibold",children:[Math.min(g.progress,m.goal)," / ",m.goal," ",ec.unit]})]}),(0,N.jsx)(tO,{value:ed,className:"h-2 bg-black/40",style:{"--progress-color":e?"#f43f5e":el.color}})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between gap-2",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1.5 text-[10px]",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-muted-foreground/60",children:"奖励:"}),m.rewardInsight>0&&(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-amber-300 font-mono",children:["+",U(m.rewardInsight),"洞见"]}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-fuchsia-300 font-mono",children:["+",m.rewardContact.toFixed(1),"接触"]})]}),(0,N.jsx)(t4,{onClick:Q,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,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" mt-1.5 text-[10px] text-muted-foreground/50 text-center",children:["完成用时 ",Math.floor(g.durationSec/60),"分",g.durationSec%60,"秒"]})]})),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" grid grid-cols-1 lg:grid-cols-2 gap-2.5",children:[(0,N.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:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" relative rounded-xl border p-3 overflow-hidden",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between mb-2",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1.5",children:[(0,N.jsx)(ns,{className:"h-3.5 w-3.5 text-fuchsia-400"}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-xs font-semibold text-fuchsia-200",children:"周挑战 · WEEKLY"})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1 text-[9px] text-muted-foreground/70",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono text-fuchsia-300/80",children:y.weekKey}),(0,N.jsx)(uy,{className:"h-2.5 w-2.5"}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono text-fuchsia-300/90",children:A})]})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1.5 mb-2",children:[(0,N.jsxs)("span",{style:{background:`${ep.color}22`,color:ep.color,border:`1px solid ${ep.color}55`},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]]),children:ep.icon}),ep.label]}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] font-mono px-1.5 py-0.5 rounded bg-white/5 text-muted-foreground border border-white/10",children:[em.icon," ",em.label]}),eg&&(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)(t7,{className:"h-2.5 w-2.5"})," 已完成"]})]}),(0,N.jsx)("h4",{style:{color:ep.color,textShadow:`0 0 10px ${ep.glow}`},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-sm font-semibold mb-1",children:y.title}),(0,N.jsx)("p",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] text-muted-foreground/80 leading-relaxed mb-2",children:y.desc}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" mb-2",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between mb-1",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] text-muted-foreground/70",children:"进度"}),(0,N.jsxs)("span",{style:{color:ep.color},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[11px] font-mono font-semibold",children:[Math.min(w.progress,y.goal)," / ",y.goal," ",em.unit]})]}),(0,N.jsx)(tO,{value:ex,className:"h-2 bg-black/40",style:{"--progress-color":ep.color}})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between gap-2",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1.5 text-[10px]",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-muted-foreground/60",children:"奖励:"}),y.rewardInsight>0&&(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-amber-300 font-mono",children:["+",U(y.rewardInsight),"洞见"]}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-fuchsia-300 font-mono",children:["+",y.rewardContact.toFixed(1),"接触"]})]}),(0,N.jsx)(t4,{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&&w.durationSec>0&&(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" mt-1.5 text-[10px] text-muted-foreground/50 text-center",children:["完成用时 ",Math.floor(w.durationSec/60),"分",w.durationSec%60,"秒"]})]}),(0,N.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:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" relative rounded-xl border p-3 overflow-hidden",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between mb-2",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1.5",children:[(0,N.jsx)(u_,{className:"h-3.5 w-3.5 text-amber-400"}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-xs font-semibold text-amber-200",children:"信标链 · CHAIN"})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-baseline gap-1",children:[(0,N.jsx)(uR,{className:"h-3 w-3 text-rose-400"}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] text-muted-foreground/60",children:"连续"}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" chain-streak-text text-2xl font-bold font-mono leading-none",children:k.currentStreak}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] text-muted-foreground/60",children:"天"})]})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" mb-2 flex items-center justify-between",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] text-muted-foreground/70",children:ek?"今日已贡献":"今日尚未完成日挑战"}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" "+`text-[10px] font-mono px-1.5 py-0.5 rounded border ${ek?"bg-emerald-500/15 text-emerald-300 border-emerald-500/30":"bg-white/5 text-muted-foreground/70 border-white/10"}`,children:ek?"✓ 已记录":"○ 待完成"})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between mb-2 relative",children:[(0,N.jsx)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" absolute top-6 left-[12.5%] right-[12.5%] h-[2px] bg-white/10"}),(r=(s={0:12.5,3:12.5,7:37.5,14:62.5,30:87.5})[ev.prev]??12.5,a=null!==ev.next?s[ev.next]??87.5:87.5,(n=Math.max(0,r+(a-r)*(ev.progressPct/100)-12.5))<=0?null:(0,N.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:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" absolute top-6 h-[2px]"})),eZ.map(e=>{let t=eQ.find(t=>t.milestone===e),s=k.milestonesClaimed.includes(e),r=k.currentStreak>=e&&!s,a=k.currentStreak>0&&ew===e,n="rgba(255,255,255,0.05)",i="rgba(255,255,255,0.15)",o="rgba(255,255,255,0.4)";return s?(n="rgba(52,211,153,0.25)",i="#34d399",o="#34d399"):r?(n="rgba(251,113,133,0.20)",i="#fb7185",o="#fb7185"):a&&(n="rgba(251,191,36,0.20)",i="#fbbf24",o="#fbbf24"),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex flex-col items-center gap-1 z-10 flex-1",children:[(0,N.jsx)("div",{style:{background:n,borderColor:i,color:o},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" "+`w-12 h-12 rounded-full flex items-center justify-center font-mono font-bold text-sm border-2 ${r?"chain-milestone-reachable":""}`,children:s?(0,N.jsx)(t7,{className:"h-4 w-4"}):e}),(0,N.jsx)("span",{style:{color:o},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[9px] text-center leading-tight",children:t?.label}),s?(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[9px] text-emerald-400/80 font-mono",children:"已领"}):r?(0,N.jsx)(t4,{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,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[9px] text-muted-foreground/40 font-mono",children:["+",t?.rewardInsight,"洞"]})]},e)})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" mb-2",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between mb-1",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] text-muted-foreground/70",children:null===ev.next?"已通关全部里程碑":`下一目标:${ev.next} 天`}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[10px] font-mono text-amber-300",children:[ev.current,null!==ev.next&&` / ${ev.next}`," 天"]})]}),(0,N.jsx)(tO,{value:ev.progressPct,className:"h-1.5 bg-black/40",style:{"--progress-color":"#fbbf24"}})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between gap-2 text-[10px]",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-2",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-muted-foreground/60",children:"最长"}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono text-amber-300",children:[k.longestStreak,"天"]})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-2",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-muted-foreground/60",children:"累计"}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono text-rose-300",children:[k.totalCompletions,"次"]})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1",children:[(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-muted-foreground/60",children:"续命"}),k.graceUsed>=1?(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono text-rose-400/80",children:"已用"}):(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono text-emerald-400/80",children:"可用"})]})]})]})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" rounded-xl border border-white/10 bg-black/30 p-2.5",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-between gap-2 mb-2",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1.5",children:[(0,N.jsx)(no,{className:"h-3.5 w-3.5 text-amber-400"}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-xs font-semibold",children:"深空排行榜"})]}),(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1",children:[(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-0.5 p-0.5 rounded-lg bg-black/40 border border-white/10",children:[(0,N.jsxs)("button",{type:"button",onClick:()=>L("local"),"aria-pressed":"local"===I,className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" "+`flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono transition-colors ${"local"===I?"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,N.jsx)(no,{className:"h-2.5 w-2.5"}),"本地"]}),(0,N.jsxs)("button",{type:"button",onClick:()=>L("global"),"aria-pressed":"global"===I,className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" "+`flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono transition-colors ${"global"===I?"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,N.jsx)(u$,{className:"h-2.5 w-2.5"}),"全球"]})]}),"global"===I&&(0,N.jsx)("button",{type:"button",onClick:()=>void J(),disabled:z,"aria-label":"刷新全球榜",title:"刷新全球榜",className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)(ug,{className:`h-3 w-3 ${z?"animate-spin":""}`})})]})]}),(0,N.jsx)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" mb-1.5 text-[10px] text-muted-foreground/50 flex items-center gap-2",children:"local"===I?(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]]),children:["本机 Top ",T.length||0," · 离线可用"]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]]),children:["全球 Top ",O.length||0]}),q&&!z&&O.length>0&&(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-emerald-400/60",children:"· 已同步"}),z&&(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-amber-400/70 flex items-center gap-1",children:[(0,N.jsx)(uB,{className:"h-2.5 w-2.5 animate-spin"}),"同步中…"]})]})}),"local"===I&&(0===T.length?(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-center py-4 text-[11px] text-muted-foreground/40",children:[(0,N.jsx)(no,{className:"h-6 w-6 mx-auto mb-1 opacity-30"}),"尚无记录。完成限时、每日或本周信标即可登榜。"]}):(0,N.jsx)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" space-y-0.5 max-h-[200px] overflow-y-auto echo-scroll",children:T.map((e,t)=>{let s=uL(t),r=eA[e.difficulty],a=e$[e.challenge],n=e.dateKey===eD()||e.dateKey===eK()||e.dateKey===e4();return(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" w-6 flex items-center justify-center",children:s?(0,N.jsx)(s.icon,{className:"h-3.5 w-3.5",style:{color:s.color}}):(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-muted-foreground/50 font-mono",children:t+1})}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1 flex-1 min-w-0",children:[(0,N.jsx)("span",{style:{color:r.color},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono",children:r.icon}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-muted-foreground/80 truncate",children:a.label}),e.isWeekly&&(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-emerald-400/70",children:"✓"})]}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)("span",{style:{color:r.color},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono font-semibold w-12 text-right",children:U(e.score)})]},`local-${e.timestamp}-${t}`)})})),"global"===I&&(0,N.jsx)(N.Fragment,{children:z&&0===O.length?(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-center py-4 text-[11px] text-muted-foreground/60 flex items-center justify-center gap-2",children:[(0,N.jsx)(uB,{className:"h-3.5 w-3.5 animate-spin text-emerald-400"}),"正在拉取全球榜…"]}):0===O.length?(0,N.jsx)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-center py-4 text-[11px] text-muted-foreground/40",children:W?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(uD,{className:"h-6 w-6 mx-auto mb-1 opacity-40 text-rose-400"}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-rose-300/70",children:W}),(0,N.jsx)("button",{type:"button",onClick:()=>void J(),className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" block mx-auto mt-2 text-[10px] text-emerald-400/80 hover:text-emerald-300 underline-offset-2 hover:underline",children:"重试"})]}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(u$,{className:"h-6 w-6 mx-auto mb-1 opacity-30 text-emerald-400"}),"尚无全球记录。完成挑战并领取即可登顶全球榜!"]})}):(0,N.jsx)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" space-y-0.5 max-h-[200px] overflow-y-auto echo-scroll",children:O.map((e,t)=>{let s=uL(t),r=eA[e.difficulty]??eA.routine,a=e$[e.challenge]??{label:e.challenge,icon:"·",unit:""},n=X>0&&e.timestamp===X;return(0,N.jsxs)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" w-6 flex items-center justify-center",children:s?(0,N.jsx)(s.icon,{className:"h-3.5 w-3.5",style:{color:s.color}}):(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" "+`font-mono ${n?"text-emerald-300 font-bold":"text-muted-foreground/50"}`,children:t+1})}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1 flex-1 min-w-0",children:[(0,N.jsx)("span",{style:{color:r.color},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono",children:r.icon}),(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-muted-foreground/80 truncate",children:a.label}),e.isWeekly&&(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-[9px] font-mono px-1 rounded bg-amber-500/20 text-amber-300 border border-amber-500/40",children:"TIMED"}),n&&(0,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" text-emerald-400/70",children:"✓"})]}),(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.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,N.jsx)("span",{style:{color:n?"#34d399":r.color},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" font-mono font-semibold w-12 text-right",children:U(e.score)})]},`global-${e.timestamp}-${t}`)})})})]}),(0,N.jsx)("div",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center justify-center gap-3 text-[9px] text-muted-foreground/50",children:uI.map(e=>{let t=eA[e];return(0,N.jsxs)("span",{className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]])+" flex items-center gap-1",children:[(0,N.jsx)("span",{style:{color:t.color},className:tV.default.dynamic([["12f5fcaad97b9273",[es.glow,es.glow,es.glow,es.glow]]]),children:t.icon}),t.label," ×",t.mult]},e)})})]})}function uF(){let[e,t]=(0,M.useState)(!1),[s,r]=(0,M.useState)(0),[a,n]=(0,M.useState)(null),[i,o]=(0,M.useState)(!1),l=(0,M.useRef)(null);(0,M.useEffect)(()=>{if(!function(){try{return"1"===localStorage.getItem(a4)}catch{return!0}}()){let e=setTimeout(()=>t(!0),600);return()=>clearTimeout(e)}},[]),(0,M.useEffect)(()=>{let e=()=>{r(0),o(!1),t(!0)};return window.addEventListener("echo-nexus-tutorial-restart",e),()=>window.removeEventListener("echo-nexus-tutorial-restart",e)},[]),td(e=>e.crystals),td(e=>e.pulsePower),td(e=>e.tech),td(e=>e.activePuzzle),td(e=>!!e.activeExpedition&&!e.activeExpedition.finished);let c=(0,M.useRef)(null);(0,M.useEffect)(()=>{if(!e)return;let t=a3[s];if(!t?.expectAction)return;let r=0,a=()=>{let e=td.getState(),s=!1;"pulse"===t.expectAction?(null===c.current&&(c.current=e.crystals),s=e.crystals>=(c.current??0)+Math.max(.5,.5*e.pulsePower)):"decode-start"===t.expectAction?s=!!e.activePuzzle:"tech-buy"===t.expectAction?s=Object.values(e.tech).some(e=>e>0):"expedition-start"===t.expectAction&&(s=!!e.activeExpedition&&!e.activeExpedition.finished),o(e=>e!==s?s:e),r=requestAnimationFrame(a)};return r=requestAnimationFrame(a),()=>cancelAnimationFrame(r)},[e,s]);let d=(0,M.useCallback)(()=>{let e=a3[s];if(!e?.target)return void n(null);let t=document.querySelector(`[data-tut="${e.target}"]`);if(!t)return void n(null);let r=t.getBoundingClientRect();n({left:r.left,top:r.top,width:r.width,height:r.height})},[s]);(0,M.useEffect)(()=>{if(!e)return;let t=()=>{d(),l.current=requestAnimationFrame(t)};return l.current=requestAnimationFrame(t),()=>{l.current&&cancelAnimationFrame(l.current)}},[e,s,d]);let u=(0,M.useCallback)(()=>{t(!1);try{localStorage.setItem(a4,"1")}catch{}},[]),h=(0,M.useCallback)(()=>{s>=a3.length-1?u():(r(e=>e+1),o(!1))},[s,u]),f=(0,M.useCallback)(()=>{s<=0||(r(e=>e-1),o(!1))},[s]);if(!e)return null;let p=a3[s],m=s>=a3.length-1,x=p.placement??"auto",g={};return g=a?"right"===x?{left:a.left+a.width+16,top:a.top+a.height/2,transform:"translateY(-50%)"}:"left"===x?{left:Math.max(16,a.left-360-16),top:a.top+a.height/2,transform:"translateY(-50%)",maxWidth:340}:"top"===x?{left:Math.max(16,Math.min(a.left,window.innerWidth-360-16)),top:Math.max(16,a.top-220),maxWidth:340}:{left:Math.max(16,Math.min(window.innerWidth/2-170,window.innerWidth-360-16)),top:Math.min(window.innerHeight-260,(a?.bottom??window.innerHeight/2)+16),maxWidth:340}:{left:"50%",top:"50%",transform:"translate(-50%, -50%)",maxWidth:440},(0,N.jsxs)("div",{className:"fixed inset-0 z-[79]",children:[(()=>{if(!a)return(0,N.jsx)("div",{className:"fixed inset-0 bg-black/70 z-[80] pointer-events-auto"});let{left:e,top:t,width:s,height:r}=a,n=e-6,i=t-6,o=s+12,l=r+12;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("div",{className:"fixed bg-black/70 z-[80] pointer-events-auto",style:{left:0,top:0,right:0,height:Math.max(0,i)}}),(0,N.jsx)("div",{className:"fixed bg-black/70 z-[80] pointer-events-auto",style:{left:0,top:i+l,right:0,bottom:0}}),(0,N.jsx)("div",{className:"fixed bg-black/70 z-[80] pointer-events-auto",style:{left:0,top:i,width:Math.max(0,n),height:l}}),(0,N.jsx)("div",{className:"fixed bg-black/70 z-[80] pointer-events-auto",style:{left:n+o,top:i,right:0,height:l}}),(0,N.jsx)("div",{className:"fixed z-[81] pointer-events-none rounded-lg",style:{left:n,top:i,width:o,height:l,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,N.jsx)("div",{className:"fixed z-[82] w-[340px] sm:w-[360px] max-w-[calc(100vw-32px)]",style:g,children:(0,N.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,N.jsx)("div",{className:"h-1 w-full bg-gradient-to-r from-emerald-400 via-fuchsia-500 to-rose-400"}),(0,N.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,N.jsx)(t9.X,{className:"h-3.5 w-3.5"})}),(0,N.jsxs)("div",{className:"p-4 pt-3.5",children:[(0,N.jsx)("div",{className:"flex items-center gap-1.5 mb-2.5",children:a3.map((e,t)=>(0,N.jsx)("div",{className:`h-1 rounded-full transition-all ${t===s?"w-6 bg-fuchsia-400":t<s?"w-3 bg-fuchsia-400/50":"w-3 bg-white/15"}`},e.id))}),(0,N.jsxs)("h3",{className:"text-sm font-bold text-fuchsia-100 mb-1.5 flex items-center gap-1.5 pr-6",children:[(0,N.jsx)(t7,{className:"h-3.5 w-3.5 text-fuchsia-300 shrink-0"}),p.title]}),(0,N.jsx)("p",{className:"text-[12.5px] text-muted-foreground leading-relaxed whitespace-pre-line",children:p.body}),p.expectAction&&!i&&(0,N.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,N.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-amber-400 animate-pulse"}),"完成动作后自动进入下一步,或点跳过"]}),p.expectAction&&i&&(0,N.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,N.jsxs)("div",{className:"flex items-center gap-2 mt-4",children:[(0,N.jsxs)(t4,{size:"sm",variant:"ghost",onClick:f,disabled:0===s,className:"h-7 px-2 text-[11px] text-muted-foreground hover:text-foreground",children:[(0,N.jsx)(uw,{className:"h-3.5 w-3.5"}),"上一步"]}),(0,N.jsxs)("div",{className:"ml-auto flex items-center gap-2",children:[(0,N.jsx)(t4,{size:"sm",variant:"ghost",onClick:u,className:"h-7 px-2 text-[11px] text-muted-foreground hover:text-foreground",children:"跳过"}),(0,N.jsxs)(t4,{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:[m?"完成":"下一步",(0,N.jsx)(nr,{className:"h-3.5 w-3.5 ml-0.5"})]})]})]}),(0,N.jsxs)("div",{className:"text-[10px] text-muted-foreground/60 text-center mt-2",children:[s+1," / ",a3.length]})]})]})})]})}let uz=(0,tu.default)("trending-up",[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]]),uV=(0,tu.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 uU(){let[e,t]=(0,M.useState)(null);(0,M.useEffect)(()=>{let e=()=>{let e=tn;e&&e.gain>.1?(t(e),setTimeout(()=>tX("decodeSuccess"),300)):e&&ti()},s=setTimeout(e,1500),r=()=>e();return window.addEventListener("echo-nexus-offline-report",r),()=>{clearTimeout(s),window.removeEventListener("echo-nexus-offline-report",r)}},[]);let s=()=>{ti(),t(null)};if(!e)return null;let r=e.gain<e.rate*e.elapsedSec*e.eff-.01;return(0,N.jsx)(aC,{open:!!e,onOpenChange:e=>!e&&s(),children:(0,N.jsxs)(a_,{className:"bg-gradient-to-br from-[#0f0a2e]/95 to-[#050410]/95 border-emerald-400/30 max-w-[400px]",children:[(0,N.jsxs)(aR,{children:[(0,N.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,N.jsxs)(a$,{className:"flex items-center gap-2 text-emerald-100",children:[(0,N.jsx)(t7,{className:"h-4 w-4 text-emerald-300"}),"欢迎回来,无人机"]}),(0,N.jsx)(aD,{className:"text-muted-foreground",children:"在你离开的这段时间里,采矿机群持续运转…"})]}),(0,N.jsxs)("div",{className:"space-y-3 py-1",children:[(0,N.jsxs)("div",{className:"relative rounded-xl border border-emerald-400/30 bg-emerald-500/5 p-4 overflow-hidden",children:[(0,N.jsx)("div",{className:"pointer-events-none absolute -top-8 -right-8 h-24 w-24 rounded-full bg-emerald-500/20 blur-2xl"}),(0,N.jsxs)("div",{className:"relative flex items-center gap-3",children:[(0,N.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,N.jsx)(th,{className:"h-6 w-6 text-emerald-300"})}),(0,N.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,N.jsx)("div",{className:"text-[11px] text-muted-foreground",children:"离线采集获得"}),(0,N.jsxs)("div",{className:"text-2xl font-bold font-mono text-emerald-200 tabular-nums leading-tight",children:["+",U(e.gain)]}),(0,N.jsx)("div",{className:"text-[10px] text-muted-foreground/80",children:"记忆晶体"})]})]})]}),(0,N.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[(0,N.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/30 px-3 py-2",children:[(0,N.jsxs)("div",{className:"flex items-center gap-1.5 text-muted-foreground mb-1",children:[(0,N.jsx)(uy,{className:"h-3 w-3"}),"离线时长"]}),(0,N.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 s=Math.floor(t/60),r=t%60;if(s<24)return r>0?`${s}小时${r}分`:`${s}小时`;let a=Math.floor(s/24),n=s%24;return n>0?`${a}${n}小时`:`${a}天`}(e.rawElapsedSec)}),e.capped&&(0,N.jsx)("div",{className:"text-[9px] text-amber-400/80 mt-0.5",children:"已达 8h 上限"})]}),(0,N.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/30 px-3 py-2",children:[(0,N.jsxs)("div",{className:"flex items-center gap-1.5 text-muted-foreground mb-1",children:[(0,N.jsx)(uz,{className:"h-3 w-3"}),"采集速率"]}),(0,N.jsxs)("div",{className:"font-mono font-semibold text-foreground",children:[U(e.rate),"/s"]}),(0,N.jsxs)("div",{className:"text-[9px] text-muted-foreground/70 mt-0.5",children:["效率 ",Math.round(100*e.eff),"%"]})]})]}),r&&(0,N.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,N.jsx)(uV,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),(0,N.jsx)("span",{children:"仓库已满,部分离线产出被截断。升级仓库容量或解码晶体可避免浪费。"})]}),(0,N.jsxs)("div",{className:"rounded-lg border border-white/10 bg-black/20 px-3 py-2",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between text-[11px]",children:[(0,N.jsx)("span",{className:"text-muted-foreground",children:"当前晶体"}),(0,N.jsxs)("span",{className:"font-mono text-foreground tabular-nums",children:[U(e.crystalsAfter)," / ",U(e.crystalCap)]})]}),(0,N.jsx)("div",{className:"mt-1.5 h-1.5 rounded-full bg-white/10 overflow-hidden",children:(0,N.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,N.jsx)("div",{className:"flex justify-end gap-2 mt-1",children:(0,N.jsxs)(t4,{onClick:s,className:"bg-emerald-500 hover:bg-emerald-600 text-white border-emerald-400/50",children:[(0,N.jsx)(th,{className:"h-3.5 w-3.5 mr-1"}),"领取收益"]})})]})})}let uW=(0,tu.default)("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),uH=(0,tu.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"}]]),uq=(0,tu.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"}]]),uK=(0,tu.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"}]]),uX=(0,tu.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"}]]),uY=(0,tu.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"}]]),uG=(0,tu.default)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),uJ=(0,tu.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"}]]),uZ=(0,tu.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"}]]),uQ=(0,tu.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"}]]),u0=(0,tu.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"}]]),u1=(0,tu.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"}]]),u2=(0,tu.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"}]]),u5=(0,tu.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),u3=(0,tu.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"}]]),u4=(0,tu.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"}]]),u9=(0,tu.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"}]]),u7=(0,tu.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"}]]),u6=[{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 u8(){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 he(e){return 100+e.upgrades.shieldMaxBonus}function ht(e){return 100+e.upgrades.energyMaxBonus}function hs(e){return 900*e.upgrades.accelMult}function hr(e){return 600+e.upgrades.invulnBonusMs}function ha(e,t){e.shakeAmount=t??14,e.shakeTimer=280}function hn(e,t){for(e.particles.push({id:e.nextEntityId++,type:"particle",...t});e.particles.length>200;)e.particles.shift()}function hi(e,t,s,r,a,n=180,i=.6,o=3){for(let l=0;l<a;l++){let c=l/a*Math.PI*2+.4*Math.random(),d=n*(.4+.8*Math.random());hn(e,{x:t,y:s,vx:Math.cos(c)*d,vy:Math.sin(c)*d,life:i*(.7+.6*Math.random()),maxLife:i,size:o*(.6+.8*Math.random()),color:r,shrink:!0})}}function ho(e,t){let s=t.heading+Math.PI,r=s+(Math.random()-.5)*.6,a=80+60*Math.random(),n=Math.min(1,t.thrust),i=Math.round(52+199*n),o=Math.round(211+-20*n),l=Math.round(153+-117*n),c=`rgba(${i},${o},${l},0.9)`;hn(e,{x:t.x+Math.cos(s)*t.radius,y:t.y+Math.sin(s)*t.radius,vx:Math.cos(r)*a+.3*t.vx,vy:Math.sin(r)*a+.3*t.vy,life:.35+.25*Math.random(),maxLife:.6,size:2.5+2*Math.random(),color:c,shrink:!0})}function hl(e,t){e.bullets.length>=80&&e.bullets.shift(),e.bullets.push({id:e.nextEntityId++,type:"bullet",...t})}function hc(e,t,s,r){let a=["shield","energy","rapid","overdrive","magnet"],n=a[Math.floor(Math.random()*a.length)],i="boss"===r?18:10;e.powerups.length>=12&&e.powerups.shift(),e.powerups.push({id:e.nextEntityId++,type:"powerup",...{x:t,y:s,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:i,maxLife:i,collected:!1}})}function hd(e){let t=e.level,s=e.collectedCrystals*(8+2*t),r=e.collectedInsights*(2+.5*t),a=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 i={crystals:Math.round(s*n),insights:Math.round(r*n*10)/10,contact:Math.round(a*n*10)/10},o=Math.max(0,1e3-5*e.timeSec),l=Math.round(10*e.ship.shield),c="won"===e.phase?e.isBossLevel?5e3:2e3:0,d=e.score+o+l+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:i,timestamp:Date.now()}}let hu="echo-nexus-cruise-v1";function hh(){return{highScore:0,totalRuns:0,totalWins:0,bestLevel:0,totalCrystals:0,totalInsights:0,totalContact:0,bossKills:0,lastResult:null,recentResults:[]}}function hf(){try{let e=window.localStorage.getItem(hu);if(!e)return hh();let t=JSON.parse(e);return{...hh(),...t,recentResults:Array.isArray(t.recentResults)?t.recentResults.slice(0,20):[]}}catch{return hh()}}let hp="#34d399",hm="#34d399",hx="#d1fae5",hg="#e879f9",hb="#fbbf24",hy="#fb7185",hv={shield:"#34d399",energy:"#fbbf24",rapid:"#e879f9",overdrive:"#fb7185",magnet:"#a7f3d0"},hw={Wind:uY,Gauge:uG,Feather:uJ,Shield:uK,HeartPulse:uZ,Battery:uQ,Zap:ns,Flame:uR,Timer:u0,Split:u1,Magnet:u2,Circle:u5,ShieldCheck:u3,ShieldHalf:u4,Crown:uP,Star:aB,ShieldPlus:u9,BatteryCharging:u7};function hj({onClose:e}){let t=(0,M.useRef)(null),s=(0,M.useRef)(null),r=(0,M.useRef)(u8()),a=(0,M.useRef)([]),n=(0,M.useRef)(0),i=(0,M.useRef)(0),o=(0,M.useRef)([]),l=(0,M.useRef)(new Set),c=(0,M.useRef)({active:!1,baseX:0,baseY:0,knobX:0,knobY:0,touchId:null}),d=(0,M.useRef)(!1),u=(0,M.useRef)(!1),h=(0,M.useRef)(!1),f=(0,M.useRef)("ready"),p=(0,M.useRef)(null),m=(0,M.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,M.useRef)(0),g=(0,M.useRef)({w:0,h:0}),[b,y]=(0,M.useState)("ready"),[v,w]=(0,M.useState)(1),[j,k]=(0,M.useState)(null),[S,T]=(0,M.useState)(()=>hf()),[C,P]=(0,M.useState)(!1),[E]=(0,M.useState)(()=>"ontouchstart"in window||navigator.maxTouchPoints>0),[_,R]=(0,M.useState)({baseX:0,baseY:0,knobX:0,knobY:0,active:!1}),[A,$]=(0,M.useState)([]),[D,B]=(0,M.useState)(null),[I,L]=(0,M.useState)([]),[O,F]=(0,M.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}),z=(0,M.useCallback)(e=>{let{w:t,h:n}=g.current;if(0===t||0===n)return;let i=function(e,t=Date.now()){var s=`cruise-l${e}-s${t}`;let r=0x811c9dc5;for(let e=0;e<s.length;e++)r^=s.charCodeAt(e),r=Math.imul(r,0x1000193);return r>>>0}(e),o=function(e,t,s,r,a=u8(),n=[]){let i,o,l=(o=t>>>0,function(){o|=0;let e=o=o+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+a.shieldMaxBonus,100+a.shieldMaxBonus+a.startShieldBonus),h=Math.min(100+a.energyMaxBonus,100+a.energyMaxBonus+a.startEnergyBonus),f={id:c++,type:"ship",x:s/2,y:r-80,vx:0,vy:0,heading:-Math.PI/2,shield:u,energy:h,radius:14,thrust:0},p=[],m=null,x=0,g=0,b=0;if(d){let t=100+20*e;m={id:c++,type:"boss",x:s/2,y:.3*r,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},i=120;for(let t=0;t<4;t++){let t=14+16*l(),a=60+l()*(s-120),n=60+l()*(r-120),i=20+30*l(),o=l()*Math.PI*2,d=7+Math.floor(4*l()),u=[];for(let e=0;e<d;e++)u.push(.75+.4*l());p.push({id:c++,type:"asteroid",x:a,y:n,vx:Math.cos(o)*i,vy:Math.sin(o)*i,radius:t,rotation:l()*Math.PI*2,rotationSpeed:(l()-.5)*1.2,vertices:u,damage:18+1.5*e})}x=4;for(let e=0;e<x;e++){let e=80+l()*(s-160),t=120+l()*(r-240);p.push({id:c++,type:"crystal",x:e,y:t,vx:0,vy:0,radius:12,rotation:l()*Math.PI*2,rotationSpeed:(l()-.5)*2,pulsePhase:l()*Math.PI*2,collected:!1})}}else{let t={id:c++,type:"stargate",x:s/2,y:70,vx:0,vy:0,radius:42,rotation:0,rotationSpeed:.6,pulsePhase:0,active:!1};p.push(t);let a=Math.min(8+2*e,32);for(let n=0;n<a;n++){let a=16+28*l(),n=0,i=0,o=0;do n=40+l()*(s-80),i=140+l()*(r-260),o++;while(o<20&&(120>Math.hypot(n-f.x,i-f.y)||100>Math.hypot(n-t.x,i-t.y)))let d=30+60*l()+4*e,u=l()*Math.PI*2,h=7+Math.floor(4*l()),m=[];for(let e=0;e<h;e++)m.push(.75+.4*l());p.push({id:c++,type:"asteroid",x:n,y:i,vx:Math.cos(u)*d,vy:Math.sin(u)*d,radius:a,rotation:l()*Math.PI*2,rotationSpeed:(l()-.5)*1.2,vertices:m,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*l(),a=0,n=0,i=0;do a=100+l()*(s-200),n=180+l()*(r-320),i++;while(i<20&&(180>Math.hypot(a-f.x,n-f.y)||150>Math.hypot(a-t.x,n-t.y)))let o=12+18*l(),d=l()*Math.PI*2;p.push({id:c++,type:"storm",x:a,y:n,vx:Math.cos(d)*o,vy:Math.sin(d)*o,radius:e,rotation:l()*Math.PI*2,rotationSpeed:(l()-.5)*.4,lightningTimer:.5*l(),cloudSeed:Math.floor(1e4*l())})}x=5+e;for(let e=0;e<x;e++){let e=0,t=0,a=0;do e=50+l()*(s-100),t=120+l()*(r-220),a++;while(a<20&&90>Math.hypot(e-f.x,t-f.y))p.push({id:c++,type:"crystal",x:e,y:t,vx:0,vy:0,radius:12,rotation:l()*Math.PI*2,rotationSpeed:(l()-.5)*2,pulsePhase:l()*Math.PI*2,collected:!1})}g=2+Math.floor(e/3);for(let e=0;e<g;e++){let e=0,t=0,a=0;do e=60+l()*(s-120),t=140+l()*(r-240),a++;while(a<20&&100>Math.hypot(e-f.x,t-f.y))p.push({id:c++,type:"insight",x:e,y:t,vx:0,vy:0,radius:14,pulsePhase:l()*Math.PI*2,swirlAngle:l()*Math.PI*2,collected:!1})}b=1+Math.floor(e/4);for(let e=0;e<b;e++){let e=0,t=0,a=0;do e=80+l()*(s-160),t=160+l()*(r-280),a++;while(a<20&&110>Math.hypot(e-f.x,t-f.y))p.push({id:c++,type:"beacon",x:e,y:t,vx:0,vy:0,radius:16,rotation:l()*Math.PI*2,rotationSpeed:(l()-.5)*1.5,pulsePhase:l()*Math.PI*2,collected:!1})}i=Math.min(60+(e-1)*3,90)}return{phase:"ready",level:e,seed:t,ship:f,entities:p,particles:[],bullets:[],powerups:[],boss:m,isBossLevel:d,score:0,timeSec:0,durationSec:i,collectedCrystals:0,collectedInsights:0,collectedBeacons:0,totalCrystals:x,totalInsights:g,totalBeacons:b,shakeAmount:0,shakeTimer:0,flashLowShield:!1,pickupFlash:null,worldWidth:s,worldHeight:r,nextEntityId:c,invulnTimer:0,shootCooldown:0,endedAt:null,upgrades:a,appliedUpgrades:n,pendingUpgradeChoice:[],activeBuffs:[],bossDefeated:!1}}(e,i,t,n,r.current,a.current);o.phase="playing",s.current=o,u.current=!1,p.current=null,k(null),w(e),y("playing"),f.current="playing",P(!1),h.current=!1,B(null),m.current={shield:o.ship.shield,shieldMax:100+o.upgrades.shieldMaxBonus,energy:o.ship.energy,energyMax:100+o.upgrades.energyMaxBonus,score:0,time:0,duration:o.durationSec,crystals:0,totalCrystals:o.totalCrystals,insights:0,totalInsights:o.totalInsights,beacons:0,totalBeacons:o.totalBeacons,lowShield:!1,isBossLevel:o.isBossLevel,bossHp:o.boss?.hp??0,bossMaxHp:o.boss?.maxHp??0,bossPhase:o.boss?.attackPhase??1,buffs:[],appliedUpgrades:o.appliedUpgrades,pickupFlashColor:null},F({...m.current})},[]);(0,M.useEffect)(()=>{let e=t.current;if(!e)return;let r=e.getContext("2d");if(!r)return;let a=()=>{let t=Math.min(window.devicePixelRatio||1,2),a=window.innerWidth,n=window.innerHeight;e.width=Math.floor(a*t),e.height=Math.floor(n*t),e.style.width=a+"px",e.style.height=n+"px",r.setTransform(t,0,0,t,0,0),g.current={w:a,h:n},o.current=function(e,t){let s=[{stars:[],speed:8,parallax:.1},{stars:[],speed:18,parallax:.25},{stars:[],speed:36,parallax:.5}],r=[100,60,30];for(let a=0;a<s.length;a++){let n=s[a];for(let s=0;s<r[a];s++)n.stars.push({x:Math.random()*e,y:Math.random()*t,size:.5+.6*a+Math.random()*(.5+.5*a),brightness:.2+.25*a+.25*Math.random(),twinkle:Math.random()*Math.PI*2,twinkleSpeed:.5+2*Math.random()})}return s}(a,n),s.current&&(s.current.worldWidth=a,s.current.worldHeight=n)};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),(0,M.useEffect)(()=>{let t=t=>{let s=t.key.toLowerCase();if(["w","a","s","d","arrowup","arrowdown","arrowleft","arrowright"].includes(s))l.current.add(s),t.preventDefault();else if(" "===s||"spacebar"===s)d.current=!0,t.preventDefault();else if("p"===s){if("playing"===f.current){let e=!h.current;h.current=e,P(e)}}else"escape"===s&&e()},s=e=>{let t=e.key.toLowerCase();["w","a","s","d","arrowup","arrowdown","arrowleft","arrowright"].includes(t)?l.current.delete(t):(" "===t||"spacebar"===t)&&(d.current=!1)};return window.addEventListener("keydown",t),window.addEventListener("keyup",s),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",s)}},[e]),(0,M.useEffect)(()=>{let e=()=>{d.current=!1,"playing"===f.current&&(h.current=!0,P(!0))};return window.addEventListener("blur",e),document.addEventListener("visibilitychange",e),()=>{window.removeEventListener("blur",e),document.removeEventListener("visibilitychange",e)}},[]),(0,M.useEffect)(()=>{let e=e=>{if("playing"===f.current&&!h.current)for(let t=0;t<e.changedTouches.length;t++){let s=e.changedTouches[t];if(s.clientX>.65*window.innerWidth&&s.clientY>.55*window.innerHeight){d.current=!0,e.preventDefault();continue}if(s.clientX<.5*window.innerWidth&&s.clientY>.35*window.innerHeight){if(c.current.active)continue;c.current={active:!0,baseX:s.clientX,baseY:s.clientY,knobX:0,knobY:0,touchId:s.identifier},R({baseX:s.clientX,baseY:s.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 s=e.changedTouches[t];if(s.identifier!==c.current.touchId)continue;let r=s.clientX-c.current.baseX,a=s.clientY-c.current.baseY,n=Math.hypot(r,a),i=Math.min(n,55),o=n>0?r/n*i:0,l=n>0?a/n*i:0;c.current.knobX=o/55,c.current.knobY=l/55,R({baseX:c.current.baseX,baseY:c.current.baseY,knobX:o,knobY:l,active:!0}),e.preventDefault();return}},s=e=>{for(let t=0;t<e.changedTouches.length;t++){let s=e.changedTouches[t];s.identifier===c.current.touchId&&(c.current={active:!1,baseX:0,baseY:0,knobX:0,knobY:0,touchId:null},R({baseX:0,baseY:0,knobX:0,knobY:0,active:!1})),s.clientX>.65*window.innerWidth&&s.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",s,{passive:!1}),window.addEventListener("touchcancel",s,{passive:!1}),()=>{window.removeEventListener("touchstart",e),window.removeEventListener("touchmove",t),window.removeEventListener("touchend",s),window.removeEventListener("touchcancel",s)}},[]),(0,M.useEffect)(()=>{let e=t.current;if(!e)return;let r=e.getContext("2d");if(!r)return;let a=e=>{n.current=requestAnimationFrame(a);let t=0===i.current?16:e-i.current;i.current=e;let b=Math.min(t/1e3,.05),{w:v,h:w}=g.current;if(0===v||0===w)return;let j=s.current;if(j&&"playing"===j.phase&&!h.current&&j){let s=0,r=0,a=l.current;(a.has("w")||a.has("arrowup"))&&(r-=1),(a.has("s")||a.has("arrowdown"))&&(r+=1),(a.has("a")||a.has("arrowleft"))&&(s-=1),(a.has("d")||a.has("arrowright"))&&(s+=1),c.current.active&&(s=c.current.knobX,r=c.current.knobY);let n=function(e,t,s){let r,a;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 i=e.ship;if(s.active&&(0!==s.dx||0!==s.dy)){let t=Math.hypot(s.dx,s.dy),r=s.dx/t,a=s.dy/t;i.vx+=r*hs(e)*n,i.vy+=a*hs(e)*n,i.heading=Math.atan2(a,r),i.thrust=Math.min(1,i.thrust+4*n),.9>Math.random()&&ho(e,i),.5>Math.random()&&ho(e,i)}else i.thrust=Math.max(0,i.thrust-3*n);let o=Math.pow(Math.min(.98,.88+e.upgrades.frictionBonus),60*n);i.vx*=o,i.vy*=o;let l=Math.hypot(i.vx,i.vy),c=(r=e.upgrades.speedMult,e.activeBuffs.some(e=>"overdrive"===e.type)&&(r*=1.5),280*r);for(let t of(l>c&&(i.vx=i.vx/l*c,i.vy=i.vy/l*c),i.x+=i.vx*n,i.y+=i.vy*n,i.x<i.radius&&(i.x=i.radius,i.vx=.4*Math.abs(i.vx)),i.x>e.worldWidth-i.radius&&(i.x=e.worldWidth-i.radius,i.vx=-(.4*Math.abs(i.vx))),i.y<i.radius&&(i.y=i.radius,i.vy=.4*Math.abs(i.vy)),i.y>e.worldHeight-i.radius&&(i.y=e.worldHeight-i.radius,i.vy=-(.4*Math.abs(i.vy))),s.shoot&&function(e){let t;if("playing"!==e.phase||e.shootCooldown>0)return;let s=e.ship;if(s.energy<5)return;s.energy-=5,t=e.upgrades.fireRateMult,e.activeBuffs.some(e=>"rapid"===e.type)&&(t*=.5),e.shootCooldown=150*t;let r=8*e.upgrades.firepowerMult,a=s.heading,n=s.x+Math.cos(a)*(s.radius+4),i=s.y+Math.sin(a)*(s.radius+4);if(hl(e,{x:n,y:i,vx:540*Math.cos(a),vy:540*Math.sin(a),owner:"ship",radius:4,damage:r,life:1.4,homing:!1,homingTime:0,color:"#34d399"}),e.upgrades.doubleShot)for(let t of[.14,-.14]){let n=a+t;hl(e,{x:s.x+Math.cos(n)*(s.radius+4),y:s.y+Math.sin(n)*(s.radius+4),vx:540*Math.cos(n),vy:540*Math.sin(n),owner:"ship",radius:4,damage:r,life:1.4,homing:!1,homingTime:0,color:"#34d399"})}hi(e,n,i,"#a7f3d0",4,120,.25,2)}(e),e.invulnTimer<=0&&i.shield<he(e)&&(i.shield=Math.min(he(e),i.shield+2*e.upgrades.shieldRegenMult*n)),i.energy<ht(e)&&(i.energy=Math.min(ht(e),i.energy+8*e.upgrades.energyRegenMult*n)),e.flashLowShield=i.shield<.3*he(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 s=Math.floor(4*Math.random());0===s?(t.x=-t.radius,t.y=Math.random()*e.worldHeight,t.vx=Math.abs(t.vx)):1===s?(t.x=e.worldWidth+t.radius,t.y=Math.random()*e.worldHeight,t.vx=-Math.abs(t.vx)):2===s?(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(i.x-t.x,i.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 s=e.boss;if(!s)return;let r=e.ship,a=s.hp/s.maxHp;a>.66?s.attackPhase=1:a>.33?s.attackPhase=2:s.attackPhase=3,s.rotation+=s.rotationSpeed*t,s.pulsePhase+=2*t,s.breathPhase+=1.4*t,s.tentaclePhase+=.8*t,s.driftAngle+=.4*t;let n=e.worldWidth/2+Math.cos(s.driftAngle)*(.25*e.worldWidth),i=.32*e.worldHeight+40*Math.sin(1.3*s.driftAngle),o=n-s.x,l=i-s.y,c=Math.hypot(o,l)||1;if(s.vx=o/c*18,s.vy=l/c*18,s.x+=s.vx*t,s.y+=s.vy*t,s.x=Math.max(s.radius+20,Math.min(e.worldWidth-s.radius-20,s.x)),s.y=Math.max(s.radius+20,Math.min(.55*e.worldHeight,s.y)),s.attackPhase>=1&&(s.directTimer-=t,s.directTimer<=0))if(s.directTimer=1===s.attackPhase?1.5:2.2,1===s.attackPhase){let t=Math.atan2(r.y-s.y,r.x-s.x);hl(e,{x:s.x+Math.cos(t)*s.radius,y:s.y+Math.sin(t)*s.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(r.y-s.y,r.x-s.x);for(let r=-2;r<=2;r++){let a=t+.18*r;hl(e,{x:s.x+Math.cos(a)*s.radius,y:s.y+Math.sin(a)*s.radius,vx:240*Math.cos(a),vy:240*Math.sin(a),owner:"boss",radius:6,damage:14,life:4,homing:!1,homingTime:0,color:"#fb7185"})}}if(s.attackPhase>=2&&(s.summonTimer-=t,s.summonTimer<=0)){s.summonTimer=4.5;for(let t=0;t<2;t++){let t=Math.random()*Math.PI*2,a=s.radius+10,n=s.x+Math.cos(t)*a,i=s.y+Math.sin(t)*a,o=100+60*Math.random(),l=Math.atan2(r.y-i,r.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:i,vx:Math.cos(l)*o,vy:Math.sin(l)*o,radius:14+8*Math.random(),rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*2,vertices:c,damage:18,summoned:!0})}hi(e,s.x,s.y,"#e879f9",12,200,.5,3)}if(s.attackPhase>=3&&(s.homingTimer-=t,s.homingTimer<=0)){s.homingTimer=2;let t=Math.atan2(r.y-s.y,r.x-s.x);hl(e,{x:s.x+Math.cos(t)*s.radius,y:s.y+Math.sin(t)*s.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-a)/.25));for(;s.dropStage<d;)s.dropStage++,hc(e,s.x+(Math.random()-.5)*80,s.y+40,"boss"),hi(e,s.x,s.y,"#fbbf24",16,200,.6,3)}(e,n),function(e,t){let s=e.ship;for(let r=e.bullets.length-1;r>=0;r--){let a=e.bullets[r];if(a.life-=t,a.life<=0){e.bullets.splice(r,1);continue}if(a.homing&&a.homingTime>0){a.homingTime-=t;let e=Math.atan2(s.y-a.y,s.x-a.x),r=Math.hypot(a.vx,a.vy),n=Math.atan2(a.vy,a.vx),i=e-n;for(;i>Math.PI;)i-=2*Math.PI;for(;i<-Math.PI;)i+=2*Math.PI;let o=n+Math.max(-2*t,Math.min(2*t,i));a.vx=Math.cos(o)*r,a.vy=Math.sin(o)*r}if(a.x+=a.vx*t,a.y+=a.vy*t,a.x<-50||a.x>e.worldWidth+50||a.y<-50||a.y>e.worldHeight+50){e.bullets.splice(r,1);continue}if(.4>Math.random()&&hn(e,{x:a.x,y:a.y,vx:-(.05*a.vx),vy:-(.05*a.vy),life:.2,maxLife:.3,size:2,color:a.color,shrink:!0}),"ship"===a.owner){let t=!1;for(let s of e.entities)if("asteroid"===s.type&&Math.hypot(a.x-s.x,a.y-s.y)<s.radius+a.radius){s.summoned||s.radius<22?(hi(e,s.x,s.y,"#fb7185",14,220,.5,3),s.damage=-999,e.score+=30):hi(e,a.x,a.y,"#fbbf24",6,160,.3,2),t=!0;break}if(!t&&e.boss&&Math.hypot(a.x-e.boss.x,a.y-e.boss.y)<e.boss.radius+a.radius&&(e.boss.hp=Math.max(0,e.boss.hp-a.damage),hi(e,a.x,a.y,"#fbbf24",8,180,.4,2.5),hi(e,a.x,a.y,"#fb7185",4,100,.2,2),t=!0),t){e.bullets.splice(r,1);continue}}else if(e.invulnTimer<=0&&Math.hypot(a.x-s.x,a.y-s.y)<s.radius+a.radius){if(!e.activeBuffs.some(e=>"overdrive"===e.type)){let t=a.damage*e.upgrades.damageReduceMult;s.shield=Math.max(0,s.shield-t),hi(e,s.x,s.y,"#fb7185",10,200,.4,3),ha(e,10),e.invulnTimer=hr(e)}e.bullets.splice(r,1);continue}}e.entities=e.entities.filter(e=>"asteroid"!==e.type||!(e.damage<=-100))}(e,n),function(e,t){let s=e.ship;for(let r=e.powerups.length-1;r>=0;r--){let a=e.powerups[r];if(a.collected||(a.life-=t,a.life<=0)){e.powerups.splice(r,1);continue}a.rotation+=a.rotationSpeed*t,a.pulsePhase+=3*t,a.x+=a.vx*t,a.y+=a.vy*t,a.vx*=.96,a.vy*=.96,a.x=Math.max(a.radius,Math.min(e.worldWidth-a.radius,a.x)),a.y=Math.max(a.radius,Math.min(e.worldHeight-a.radius,a.y));let n=Math.hypot(s.x-a.x,s.y-a.y),i=120*(e.activeBuffs.some(e=>"magnet"===e.type)?3:1);if(n<i){let e=Math.atan2(s.y-a.y,s.x-a.x),r=(1-n/i)*380;a.x+=Math.cos(e)*r*t,a.y+=Math.sin(e)*r*t}n<26+s.radius&&(a.collected=!0,function(e,t){let s=e.ship,r="#34d399";switch(t){case"shield":s.shield=Math.min(he(e),s.shield+30),r="#34d399",hi(e,s.x,s.y,r,18,220,.6,3);break;case"energy":s.energy=Math.min(ht(e),s.energy+50),r="#fbbf24",hi(e,s.x,s.y,r,18,220,.6,3);break;case"rapid":e.activeBuffs.push({type:"rapid",remaining:8,total:8}),r="#e879f9";break;case"overdrive":e.activeBuffs.push({type:"overdrive",remaining:8,total:8}),r="#fb7185";break;case"magnet":e.activeBuffs.push({type:"magnet",remaining:6,total:6}),r="#a7f3d0"}e.pickupFlash={color:r,timer:400},e.score+=50}(e,a.powerupType),e.powerups.splice(r,1))}}(e,n);for(let t=e.particles.length-1;t>=0;t--){let s=e.particles[t];if(s.life-=n,s.life<=0){e.particles.splice(t,1);continue}s.x+=s.vx*n,s.y+=s.vy*n,s.vx*=.96,s.vy*=.96}if(e.invulnTimer<=0){let t=e.activeBuffs.some(e=>"overdrive"===e.type);for(let s of e.entities)if("asteroid"===s.type&&Math.hypot(i.x-s.x,i.y-s.y)<i.radius+s.radius){if(!t){let t=s.damage*e.upgrades.damageReduceMult;i.shield=Math.max(0,i.shield-t)}let r=Math.atan2(i.y-s.y,i.x-s.x);i.vx+=200*Math.cos(r),i.vy+=200*Math.sin(r),s.vx=-Math.cos(r)*Math.abs(s.vx)*.5,s.vy=-Math.sin(r)*Math.abs(s.vy)*.5,hi(e,i.x,i.y,"#fb7185",18,260,.7,3.5),hi(e,i.x,i.y,"#fbbf24",8,180,.5,2.5),ha(e,14),e.invulnTimer=hr(e);break}}if(e.invulnTimer<=0){let t=e.activeBuffs.some(e=>"overdrive"===e.type);for(let s of e.entities)if("storm"===s.type&&Math.hypot(i.x-s.x,i.y-s.y)<i.radius+.7*s.radius){if(!t){let t=12*n*e.upgrades.damageReduceMult;i.shield=Math.max(0,i.shield-t)}.3>Math.random()&&hi(e,i.x,i.y,"#e879f9",2,100,.4,2)}}if(e.invulnTimer<=0&&e.boss){let t=e.activeBuffs.some(e=>"overdrive"===e.type);if(Math.hypot(i.x-e.boss.x,i.y-e.boss.y)<i.radius+.85*e.boss.radius){if(!t){let t=22*e.upgrades.damageReduceMult;i.shield=Math.max(0,i.shield-t)}let s=Math.atan2(i.y-e.boss.y,i.x-e.boss.x);i.vx+=280*Math.cos(s),i.vy+=280*Math.sin(s),hi(e,i.x,i.y,"#fb7185",14,240,.5,3),ha(e,16),e.invulnTimer=hr(e)}}let d=(a=e.upgrades.attractRadiusMult,e.activeBuffs.some(e=>"magnet"===e.type)&&(a*=3),90*a),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 s=Math.hypot(i.x-t.x,i.y-t.y);if(s<d){let e=Math.atan2(i.y-t.y,i.x-t.x),r=(1-s/d)*320;t.x+=Math.cos(e)*r*n,t.y+=Math.sin(e)*r*n}s<u&&(t.collected=!0,"crystal"===t.type?(e.collectedCrystals++,e.score+=Math.round(100*e.upgrades.normalScoreMult),hi(e,t.x,t.y,"#34d399",10,200,.6,3)):"insight"===t.type?(e.collectedInsights++,e.score+=Math.round(250*e.upgrades.normalScoreMult),hi(e,t.x,t.y,"#e879f9",10,200,.6,3)):"beacon"===t.type&&(e.collectedBeacons++,e.score+=Math.round(500*e.upgrades.normalScoreMult),hi(e,t.x,t.y,"#fbbf24",12,220,.7,3.5),!t.powerupDropped&&.05>Math.random()&&(t.powerupDropped=!0,hc(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,s=e.boss.y,r=["#fb7185","#fbbf24","#e879f9","#34d399"];for(let a=0;a<8;a++)hi(e,t+(Math.random()-.5)*80,s+(Math.random()-.5)*80,r[a%r.length],28,360,1,4);return ha(e,28),hd(e)}if(!e.isBossLevel){for(let t of e.entities)if("stargate"===t.type&&Math.hypot(i.x-t.x,i.y-t.y)<i.radius+.6*t.radius){e.phase="won",e.endedAt=Date.now();for(let t=0;t<5;t++){let s=e.worldWidth*(.2+.6*Math.random()),r=e.worldHeight*(.2+.6*Math.random()),a=["#34d399","#fb7185","#fbbf24","#e879f9"];hi(e,s,r,a[t%a.length],24,320,1,4)}return hd(e)}}return i.shield<=0?(e.phase="lost",e.endedAt=Date.now(),hi(e,i.x,i.y,"#fb7185",30,360,1,4.5),hi(e,i.x,i.y,"#fbbf24",16,240,.8,3),ha(e,24),hd(e)):e.timeSec>=e.durationSec?(e.phase="lost",e.endedAt=Date.now(),hd(e)):null}(j,t,{dx:s,dy:r,active:Math.abs(s)>.05||Math.abs(r)>.05,shoot:d.current});n&&(p.current=n,k(n),y(n.phase),f.current=n.phase,u.current||(u.current=!0,td.getState().grantCruiseReward(n.rewards),T(function(e){let t=hf();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(hu,JSON.stringify(t))}catch{}return t}(n)))),m.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({...m.current}))}r.fillStyle="#050410",r.fillRect(0,0,v,w);let N=0,M=0;if(j&&j.shakeTimer>0){let e=j.shakeAmount*(j.shakeTimer/280);N=(Math.random()-.5)*e,M=(Math.random()-.5)*e}r.save(),r.translate(N,M);let S=j?j.ship.vx:0,C=j?j.ship.vy:0;for(let e of o.current)for(let t of e.stars){t.y+=(e.speed+C*e.parallax)*b,t.x-=S*e.parallax*b,t.y>w+5&&(t.y=-5),t.y<-5&&(t.y=w+5),t.x>v+5&&(t.x=-5),t.x<-5&&(t.x=v+5),t.twinkle+=t.twinkleSpeed*b;let s=.6+.4*Math.sin(t.twinkle),a=t.brightness*s;r.fillStyle=`rgba(220,230,255,${a})`,r.beginPath(),r.arc(t.x,t.y,t.size,0,2*Math.PI),r.fill()}if(j){for(let e of j.entities)"stargate"===e.type&&function(e,t,s){e.save(),e.translate(t.x,t.y);let r=Math.max(0,1-Math.hypot(s.x-t.x,s.y-t.y)/300),a=.5+.5*Math.sin(t.pulsePhase);e.shadowBlur=25+30*r,e.shadowColor=hy;for(let s=0;s<4;s++){e.save(),e.rotate(t.rotation*(s%2==0?1:-1)*(1+.3*s)),e.beginPath();let r=t.radius*(1+.25*s);e.arc(0,0,r,0,1.5*Math.PI),e.strokeStyle=`rgba(251,113,133,${(.3+.2*a)*(1-.15*s)})`,e.lineWidth=3-.5*s,e.stroke(),e.restore()}let n=e.createRadialGradient(0,0,0,0,0,t.radius);if(n.addColorStop(0,"#ffe4e6"),n.addColorStop(.4,hy),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*a),0,2*Math.PI),e.fill(),e.shadowBlur=0,r>.1)for(let s=0;s<8;s++){let a=2*t.rotation+s/8*Math.PI*2,n=t.radius*(.8+.6*Math.sin(t.pulsePhase+s)),i=Math.cos(a)*n,o=Math.sin(a)*n;e.fillStyle=`rgba(254,205,211,${.8*r})`,e.beginPath(),e.arc(i,o,2,0,2*Math.PI),e.fill()}r>.3&&(e.beginPath(),e.arc(0,0,1.6*t.radius,0,2*Math.PI),e.strokeStyle=`rgba(251,113,133,${.4*r})`,e.lineWidth=2,e.setLineDash([8,8]),e.stroke(),e.setLineDash([])),e.restore()}(r,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 s=0;s<5;s++){let r=s/5*Math.PI*2+t.rotation,a=.4*t.radius*(.5+.5*Math.sin(t.cloudSeed+s)),n=Math.cos(r)*a,i=Math.sin(r)*a,o=t.radius*(.5+.2*Math.sin(.7*t.cloudSeed+2*s)),l=e.createRadialGradient(n,i,0,n,i,o);l.addColorStop(0,"rgba(232,121,249,0.55)"),l.addColorStop(.6,"rgba(168,85,247,0.3)"),l.addColorStop(1,"rgba(88,28,135,0)"),e.fillStyle=l,e.beginPath(),e.arc(n,i,o,0,2*Math.PI),e.fill()}e.shadowBlur=0;let s=e.createRadialGradient(0,0,0,0,0,.3*t.radius);if(s.addColorStop(0,"rgba(253,244,255,0.8)"),s.addColorStop(1,"rgba(232,121,249,0)"),e.fillStyle=s,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 s=0,r=0;e.moveTo(s,r);for(let a=0;a<4;a++)s+=(Math.random()-.5)*t.radius*.5,r+=(Math.random()-.5)*t.radius*.5,e.lineTo(s,r);e.stroke()}e.restore()}(r,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 s=t.vertices.length;for(let r=0;r<s;r++){let a=r/s*Math.PI*2,n=t.radius*t.vertices[r],i=Math.cos(a)*n,o=Math.sin(a)*n;0===r?e.moveTo(i,o):e.lineTo(i,o)}e.closePath();let r=e.createRadialGradient(0,0,.2*t.radius,0,0,t.radius);r.addColorStop(0,"#5a3a3a"),r.addColorStop(.7,"#3a2a2a"),r.addColorStop(1,"#1a0808"),e.fillStyle=r,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()}(r,e);for(let e of j.powerups)!function(e,t){if(t.collected)return;e.save(),e.translate(t.x,t.y);let s=.5+.5*Math.sin(t.pulsePhase);t.life<3&&Math.floor(Date.now()/150)%2==0&&(e.globalAlpha=.5);let r=hv[t.powerupType];e.shadowBlur=22,e.shadowColor=r,e.beginPath(),e.arc(0,0,t.radius*(1.5+.3*s),0,2*Math.PI),e.strokeStyle=`${r}40`,e.lineWidth=2,e.stroke(),e.rotate(t.rotation),e.beginPath();for(let s=0;s<6;s++){let r=s/6*Math.PI*2,a=t.radius,n=Math.cos(r)*a,i=Math.sin(r)*a;0===s?e.moveTo(n,i):e.lineTo(n,i)}e.closePath();let a=e.createRadialGradient(0,0,0,0,0,t.radius);a.addColorStop(0,"#ffffff"),a.addColorStop(.5,r),a.addColorStop(1,`${r}80`),e.fillStyle=a,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()}(r,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 s=.5+.5*Math.sin(t.pulsePhase);e.shadowBlur=20,e.shadowColor=hm,e.beginPath(),e.arc(0,0,t.radius*(1.4+.4*s),0,2*Math.PI),e.strokeStyle=`rgba(52,211,153,${.15+.2*s})`,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 r=e.createLinearGradient(-t.radius,-t.radius,t.radius,t.radius);r.addColorStop(0,"#065f46"),r.addColorStop(.5,hm),r.addColorStop(1,hx),e.fillStyle=r,e.fill(),e.shadowBlur=0,e.lineWidth=1.2,e.strokeStyle=hx,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()}(r,e):"insight"===e.type?function(e,t){if(t.collected)return;e.save(),e.translate(t.x,t.y);let s=.5+.5*Math.sin(t.pulsePhase);e.shadowBlur=22,e.shadowColor=hg,e.beginPath(),e.arc(0,0,t.radius*(1.3+.3*s),0,2*Math.PI),e.strokeStyle=`rgba(232,121,249,${.2+.2*s})`,e.lineWidth=2,e.stroke();let r=e.createRadialGradient(-(.3*t.radius),-(.3*t.radius),0,0,0,t.radius);r.addColorStop(0,"#fae8ff"),r.addColorStop(.5,hg),r.addColorStop(1,"#86198f"),e.fillStyle=r,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 s=0;s<2*Math.PI;s+=.3){let r=s/(2*Math.PI)*t.radius*.8,a=Math.cos(2*s)*r,n=Math.sin(2*s)*r;0===s?e.moveTo(a,n):e.lineTo(a,n)}e.stroke(),e.restore()}(r,e):"beacon"===e.type&&function(e,t){if(t.collected)return;e.save(),e.translate(t.x,t.y);let s=.5+.5*Math.sin(t.pulsePhase);e.shadowBlur=25,e.shadowColor=hb;let r=e.createLinearGradient(0,-(4*t.radius),0,t.radius);r.addColorStop(0,"rgba(251,191,36,0)"),r.addColorStop(.5,`rgba(251,191,36,${.3+.2*s})`),r.addColorStop(1,`rgba(251,191,36,${.5+.3*s})`),e.fillStyle=r,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*s),.4*t.radius,0,0,2*Math.PI),e.strokeStyle=`rgba(251,191,36,${.5+.3*s})`,e.lineWidth=2,e.stroke(),e.shadowBlur=0;let a=e.createRadialGradient(0,0,0,0,0,.6*t.radius);a.addColorStop(0,"#fef3c7"),a.addColorStop(.7,hb),a.addColorStop(1,"#92400e"),e.fillStyle=a,e.beginPath(),e.arc(0,0,.6*t.radius,0,2*Math.PI),e.fill(),e.restore()}(r,e);for(let e of j.particles)!function(e,t){let s=Math.max(0,t.life/t.maxLife),r=t.shrink?t.size*s:t.size;r<.3||(e.globalAlpha=s,e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,r,0,2*Math.PI),e.fill(),e.globalAlpha=1)}(r,e);for(let e of j.bullets)!function(e,t){e.save(),e.translate(t.x,t.y);let s=Math.atan2(t.vy,t.vx);if(e.rotate(s),e.shadowBlur=14,e.shadowColor=t.color,"ship"===t.owner){let s=e.createLinearGradient(-(3*t.radius),0,t.radius,0);s.addColorStop(0,"rgba(52,211,153,0)"),s.addColorStop(.5,"rgba(52,211,153,0.6)"),s.addColorStop(1,"#a7f3d0"),e.fillStyle=s,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 s=e.createRadialGradient(0,0,0,0,0,t.radius);t.homing?(s.addColorStop(0,"#fdf4ff"),s.addColorStop(.6,"#e879f9"),s.addColorStop(1,"#86198f")):(s.addColorStop(0,"#ffe4e6"),s.addColorStop(.6,"#fb7185"),s.addColorStop(1,"#9f1239")),e.fillStyle=s,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()}(r,e);j.boss&&function(e,t){e.save(),e.translate(t.x,t.y);let s=1+.06*Math.sin(t.breathPhase),r=.5+.5*Math.sin(t.pulsePhase),a=1===t.attackPhase?"#fb7185":2===t.attackPhase?"#f43f5e":"#e879f9";e.shadowBlur=40,e.shadowColor="#e879f9";for(let r=0;r<3;r++){e.save(),e.rotate(t.rotation*(r%2==0?1:-1)*(1+.4*r)),e.beginPath();let n=t.radius*(1.15+.18*r)*s;for(let s=0;s<24;s++){let r=s/24*Math.PI*2,a=n+4*Math.sin(2*t.pulsePhase+.6*s),i=Math.cos(r)*a,o=Math.sin(r)*a;0===s?e.moveTo(i,o):e.lineTo(i,o)}e.closePath(),e.strokeStyle=`${a}${0===r?"cc":"66"}`,e.lineWidth=3-.6*r,e.stroke(),e.restore()}e.save(),e.rotate(t.tentaclePhase);for(let s=0;s<6;s++){e.save(),e.rotate(s/6*Math.PI*2),e.beginPath();let a=1.4*t.radius;e.moveTo(.6*t.radius,0),e.quadraticCurveTo(1.1*t.radius+10*Math.sin(2*t.tentaclePhase+s),8*Math.cos(t.pulsePhase+s),a,0),e.strokeStyle=`rgba(232,121,249,${.5+.3*r})`,e.lineWidth=2.5,e.stroke(),e.fillStyle="#fda4af",e.beginPath(),e.arc(a,0,3,0,2*Math.PI),e.fill(),e.restore()}e.restore(),e.shadowBlur=30,e.shadowColor=a;let n=e.createRadialGradient(0,0,0,0,0,.85*t.radius);n.addColorStop(0,"#ffffff"),n.addColorStop(.2,"#ffe4e6"),n.addColorStop(.6,a),n.addColorStop(1,"#9f1239"),e.fillStyle=n,e.beginPath(),e.arc(0,0,.85*t.radius*s,0,2*Math.PI),e.fill(),e.shadowBlur=0,e.save(),e.rotate(-(2*t.rotation)),e.beginPath();for(let s=0;s<6;s++){let r=s/6*Math.PI*2,a=.55*t.radius,n=Math.cos(r)*a,i=Math.sin(r)*a;0===s?e.moveTo(n,i):e.lineTo(n,i)}e.closePath(),e.strokeStyle=`rgba(254,205,211,${.6+.2*r})`,e.lineWidth=2,e.stroke(),e.restore(),e.save(),e.rotate(-(1.5*t.rotation));for(let s=0;s<3;s++){let r=s/3*Math.PI*2-Math.PI/2,a=.7*t.radius,n=Math.cos(r)*a,i=Math.sin(r)*a;e.fillStyle=s<t.attackPhase?"#fbbf24":"rgba(255,255,255,0.2)",e.beginPath(),e.arc(n,i,3,0,2*Math.PI),e.fill()}e.restore(),e.restore()}(r,j.boss),("playing"===j.phase||"won"===j.phase)&&function(e,t,s,r){if(e.save(),e.translate(t.x,t.y),r.length>0)for(let s of r){let r=hv[s.type],a=s.remaining/s.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=`${r}${Math.round(200*a).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*a),e.strokeStyle=r,e.lineWidth=1.5,e.stroke()}e.rotate(t.heading);let a=s&&Math.floor(Date.now()/80)%2==0;if(t.thrust>.1){let s=t.radius*(1.5+1.5*t.thrust),r=e.createLinearGradient(-(.4*t.radius),0,-s,0);r.addColorStop(0,`rgba(251,191,36,${.8*t.thrust})`),r.addColorStop(.5,`rgba(232,121,249,${.4*t.thrust})`),r.addColorStop(1,"rgba(232,121,249,0)"),e.fillStyle=r,e.beginPath(),e.moveTo(-(.4*t.radius),.4*t.radius),e.lineTo(-s,0),e.lineTo(-(.4*t.radius),-(.4*t.radius)),e.closePath(),e.fill()}e.shadowBlur=22,e.shadowColor=hp;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 i=e.createLinearGradient(-n,0,n,0);i.addColorStop(0,a?"#fb7185":"#065f46"),i.addColorStop(.5,a?"#fda4af":hp),i.addColorStop(1,a?"#fecdd3":"#a7f3d0"),e.fillStyle=i,e.fill(),e.shadowBlur=0,e.lineWidth=1.5,e.strokeStyle=a?"#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()}(r,j.ship,j.invulnTimer>0,j.activeBuffs)}if(r.restore(),j&&j.flashLowShield&&"playing"===j.phase){let t=.3+.3*Math.sin(e/150);r.strokeStyle=`rgba(251,113,133,${t})`,r.lineWidth=6,r.strokeRect(3,3,v-6,w-6)}if(j&&j.pickupFlash&&"playing"===j.phase){let e=j.pickupFlash.timer/400,t=j.pickupFlash.color,s=r.createRadialGradient(v/2,w/2,.3*Math.min(v,w),v/2,w/2,.7*Math.max(v,w));s.addColorStop(0,"rgba(0,0,0,0)"),s.addColorStop(1,`${t}${Math.round(100*e).toString(16).padStart(2,"0")}`),r.fillStyle=s,r.fillRect(0,0,v,w)}};return n.current=requestAnimationFrame(a),()=>cancelAnimationFrame(n.current)},[]);let V=(0,M.useCallback)(()=>{if("playing"!==f.current)return;let e=!h.current;h.current=e,P(e)},[]),W=(0,M.useCallback)(()=>{e()},[e]),H=(0,M.useCallback)(()=>{p.current&&"won"===p.current.phase&&($(function(e=3,t=[]){let s=[...u6.filter(e=>!t.includes(e.id))].sort(()=>Math.random()-.5);return s.slice(0,Math.min(e,s.length))}(3,a.current.map(e=>e.id))),B(null),y("choosing"),f.current="choosing")},[]),q=(0,M.useCallback)(e=>{let t=A[e];if(t){B(e);var s=r.current;switch(t.id){case"speed":s.speedMult*=1.12;break;case"accel":s.accelMult*=1.15;break;case"friction":s.frictionBonus=Math.min(.2,s.frictionBonus+.05);break;case"shield_max":s.shieldMaxBonus+=25;break;case"shield_regen":s.shieldRegenMult*=1.5;break;case"energy_max":s.energyMaxBonus+=25;break;case"energy_regen":s.energyRegenMult*=1.3;break;case"firepower":s.firepowerMult*=1.25;break;case"fire_rate":s.fireRateMult*=.8;break;case"double_shot":s.doubleShot=!0;break;case"attract_radius":s.attractRadiusMult*=1.4;break;case"collect_radius":s.collectRadiusMult*=1.5;break;case"invuln_time":s.invulnBonusMs+=200;break;case"damage_reduce":s.damageReduceMult*=.8;break;case"boss_bonus":s.bossBonusMult*=1.5;break;case"normal_score":s.normalScoreMult*=1.3;break;case"start_shield":s.startShieldBonus+=20;break;case"start_energy":s.startEnergyBonus+=20}a.current=[...a.current,t],L(a.current),setTimeout(()=>{p.current&&z(p.current.level+1)},700)}},[A,z]),K=O.shieldMax>0?Math.max(0,Math.min(100,O.shield/O.shieldMax*100)):0,X=K>60?"#34d399":K>30?"#fbbf24":"#fb7185",Y=O.energyMax>0?Math.max(0,Math.min(100,O.energy/O.energyMax*100)):0,G=Math.max(0,O.duration-O.time),J=O.bossMaxHp>0?O.bossHp/O.bossMaxHp*100:0;return(0,N.jsxs)("div",{className:"fixed inset-0 z-50 bg-[#050410] overflow-hidden select-none",children:[(0,N.jsx)("canvas",{ref:t,className:"absolute inset-0 w-full h-full touch-none"}),"playing"===b&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)("div",{className:"absolute top-3 left-3 flex flex-col gap-2 min-w-[180px]",children:[(0,N.jsxs)("div",{className:"glass rounded-xl p-2.5 border-white/10",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,N.jsx)(uK,{className:"h-3.5 w-3.5",style:{color:X}}),(0,N.jsx)("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"护盾"}),(0,N.jsx)("span",{className:"ml-auto font-mono text-xs font-bold",style:{color:X},children:Math.round(O.shield)})]}),(0,N.jsx)("div",{className:"h-2 rounded-full bg-black/50 overflow-hidden border border-white/5",children:(0,N.jsx)("div",{className:"h-full rounded-full transition-all duration-150",style:{width:`${K}%`,background:`linear-gradient(90deg, ${X}, ${X}dd)`,boxShadow:`0 0 8px ${X}aa`}})}),(0,N.jsxs)("div",{className:"flex items-center gap-2 mt-2 mb-1.5",children:[(0,N.jsx)(ns,{className:"h-3.5 w-3.5 text-fuchsia-300"}),(0,N.jsx)("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:"能量"}),(0,N.jsx)("span",{className:"ml-auto font-mono text-xs font-bold text-fuchsia-200",children:Math.round(O.energy)})]}),(0,N.jsx)("div",{className:"h-2 rounded-full bg-black/50 overflow-hidden border border-white/5",children:(0,N.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)"}})})]}),O.buffs.length>0&&(0,N.jsx)("div",{className:"glass rounded-xl p-2 border-white/10 flex flex-col gap-1",children:O.buffs.map((e,t)=>{let s=hv[e.type],r=Math.max(0,e.remaining/e.total*100),a="shield"===e.type?"护盾":"energy"===e.type?"能量":"rapid"===e.type?"急速":"overdrive"===e.type?"过载":"磁吸";return(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)("div",{className:"h-2 w-2 rounded-full",style:{background:s,boxShadow:`0 0 6px ${s}`}}),(0,N.jsx)("span",{className:"text-[10px] text-white/80",style:{color:s},children:a}),(0,N.jsx)("div",{className:"flex-1 h-1 rounded-full bg-black/40 overflow-hidden",children:(0,N.jsx)("div",{className:"h-full rounded-full",style:{width:`${r}%`,background:s}})}),(0,N.jsxs)("span",{className:"font-mono text-[9px] text-muted-foreground w-6 text-right",children:[Math.ceil(e.remaining),"s"]})]},t)})}),O.appliedUpgrades.length>0&&(0,N.jsx)("div",{className:"glass rounded-xl p-1.5 border-white/10 flex flex-wrap gap-1 max-w-[200px]",children:O.appliedUpgrades.map((e,t)=>{let s;return(0,N.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:(s=hw[e.icon]??t7,(0,N.jsx)(s,{className:"h-3 w-3",style:{color:e.color}}))},t)})})]}),(0,N.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 flex flex-col items-center gap-1.5",children:[(0,N.jsxs)("div",{className:"glass rounded-xl px-4 py-2 border-white/10 flex items-center gap-4",children:[(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)("div",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"关卡"}),(0,N.jsxs)("div",{className:"font-mono text-sm font-bold text-amber-200",children:["L",v,O.isBossLevel&&(0,N.jsx)(ne,{className:"inline h-3 w-3 ml-0.5 text-rose-300"})]})]}),(0,N.jsx)("div",{className:"w-px h-7 bg-white/10"}),(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)("div",{className:"text-[9px] text-muted-foreground uppercase tracking-wider",children:"分数"}),(0,N.jsx)("div",{className:"font-mono text-sm font-bold text-emerald-200",children:U(O.score)})]}),(0,N.jsx)("div",{className:"w-px h-7 bg-white/10"}),(0,N.jsxs)("div",{className:"text-center min-w-[52px]",children:[(0,N.jsxs)("div",{className:"text-[9px] text-muted-foreground uppercase tracking-wider flex items-center justify-center gap-0.5",children:[(0,N.jsx)(uy,{className:"h-2.5 w-2.5"}),"用时"]}),(0,N.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")]})]})]}),O.isBossLevel&&O.bossMaxHp>0&&(0,N.jsxs)("div",{className:"glass rounded-lg px-3 py-1.5 border-rose-400/30 min-w-[260px] sm:min-w-[320px]",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between mb-0.5",children:[(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(ne,{className:"h-3 w-3 text-rose-300"}),(0,N.jsx)("span",{className:"text-[10px] text-rose-200 font-bold tracking-wider",children:"BOSS"})]}),(0,N.jsx)("div",{className:"flex items-center gap-1",children:[1,2,3].map(e=>(0,N.jsx)("div",{className:`h-1.5 w-1.5 rounded-full ${e<=O.bossPhase?"bg-rose-400":"bg-white/15"}`},e))})]}),(0,N.jsx)("div",{className:"h-2.5 rounded-full bg-black/60 overflow-hidden border border-rose-400/20",children:(0,N.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,N.jsxs)("div",{className:"absolute top-3 right-3 flex items-start gap-2",children:[(0,N.jsxs)("div",{className:"glass rounded-xl p-2 border-white/10 flex flex-col gap-1.5",children:[(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(th,{className:"h-3 w-3 text-emerald-300"}),(0,N.jsxs)("span",{className:"font-mono text-xs font-bold text-emerald-200",children:[O.crystals,(0,N.jsxs)("span",{className:"text-muted-foreground/60",children:["/",O.totalCrystals]})]})]}),(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(uq,{className:"h-3 w-3 text-fuchsia-300"}),(0,N.jsxs)("span",{className:"font-mono text-xs font-bold text-fuchsia-200",children:[O.insights,(0,N.jsxs)("span",{className:"text-muted-foreground/60",children:["/",O.totalInsights]})]})]}),(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsx)(uT,{className:"h-3 w-3 text-amber-300"}),(0,N.jsxs)("span",{className:"font-mono text-xs font-bold text-amber-200",children:[O.beacons,(0,N.jsxs)("span",{className:"text-muted-foreground/60",children:["/",O.totalBeacons]})]})]})]}),(0,N.jsx)(t4,{size:"icon",variant:"ghost",onClick:V,className:"h-8 w-8 glass border-white/10 hover:bg-white/10 text-white/80","aria-label":"暂停",children:(0,N.jsx)(uH,{className:"h-4 w-4"})}),(0,N.jsx)(t4,{size:"icon",variant:"ghost",onClick:W,className:"h-8 w-8 glass border-rose-400/30 hover:bg-rose-500/20 text-rose-200","aria-label":"退出",children:(0,N.jsx)(t9.X,{className:"h-4 w-4"})})]}),!E&&(0,N.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,N.jsx)("span",{className:"font-mono text-white/80",children:"WASD"})," / ",(0,N.jsx)("span",{className:"font-mono text-white/80",children:"方向键"})," 移动 · ",(0,N.jsx)("span",{className:"font-mono text-emerald-300",children:"空格"})," 射击 · ",(0,N.jsx)("span",{className:"font-mono text-white/80",children:"P"})," 暂停 · ",(0,N.jsx)("span",{className:"font-mono text-white/80",children:"Esc"})," 退出"]}),E&&(0,N.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:"左下摇杆 · 右下射击"}),E&&_.active&&(0,N.jsx)("div",{className:"absolute pointer-events-none",style:{left:_.baseX,top:_.baseY,transform:"translate(-50%, -50%)"},children:(0,N.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,N.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% + ${_.knobX}px), calc(-50% + ${_.knobY}px))`,boxShadow:"0 0 16px rgba(251,191,36,0.6)"}})})}),E&&(0,N.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,N.jsx)(uX,{className:"h-9 w-9 text-emerald-300",style:{filter:"drop-shadow(0 0 8px rgba(52,211,153,0.8))"}}),(0,N.jsx)("div",{className:"absolute inset-0 rounded-full border-2 border-emerald-400/30 animate-ping",style:{animationDuration:"2s"}})]}),C&&(0,N.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-10",children:(0,N.jsxs)("div",{className:"glass rounded-2xl p-8 border-white/15 text-center max-w-xs",children:[(0,N.jsx)(uH,{className:"h-10 w-10 mx-auto mb-3 text-amber-300"}),(0,N.jsx)("h3",{className:"text-lg font-bold text-white mb-1",children:"已暂停"}),(0,N.jsx)("p",{className:"text-xs text-muted-foreground mb-5",children:"深空时间已凝固"}),(0,N.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,N.jsxs)(t4,{onClick:V,className:"bg-amber-500/20 border border-amber-400/50 text-amber-100 hover:bg-amber-500/30",children:[(0,N.jsx)(uW,{className:"h-4 w-4 mr-1.5"}),"继续"]}),(0,N.jsx)(t4,{variant:"ghost",onClick:W,className:"text-rose-200 hover:bg-rose-500/10",children:"退出巡航"})]})]})})]}),"ready"===b&&(0,N.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,N.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,N.jsx)("div",{className:"pointer-events-none absolute -top-20 -left-20 h-40 w-40 rounded-full bg-amber-500/20 blur-3xl"}),(0,N.jsx)("div",{className:"pointer-events-none absolute -bottom-20 -right-20 h-40 w-40 rounded-full bg-rose-500/20 blur-3xl"}),(0,N.jsxs)("div",{className:"relative",children:[(0,N.jsx)("div",{className:"text-[10px] tracking-[0.3em] text-amber-300/70 mb-1",children:"DEEP SPACE CRUISE · v0.8"}),(0,N.jsx)("h2",{className:"text-3xl sm:text-4xl font-bold text-gradient mb-1",children:"深空巡航"}),(0,N.jsx)("p",{className:"text-xs text-muted-foreground mb-5",children:"操控飞船穿越陨石带,抵达星门 / 击败 BOSS"}),(0,N.jsxs)("div",{className:"grid grid-cols-2 gap-2 mb-5 text-left",children:[(0,N.jsxs)("div",{className:"glass rounded-lg p-2.5 border-white/10",children:[(0,N.jsx)("div",{className:"text-[10px] text-muted-foreground",children:"起始关卡"}),(0,N.jsxs)("div",{className:"font-mono text-lg font-bold text-amber-200",children:["L",v]})]}),(0,N.jsxs)("div",{className:"glass rounded-lg p-2.5 border-white/10",children:[(0,N.jsx)("div",{className:"text-[10px] text-muted-foreground",children:"历史最高分"}),(0,N.jsx)("div",{className:"font-mono text-lg font-bold text-emerald-200",children:S?U(S.highScore):"—"})]}),(0,N.jsxs)("div",{className:"glass rounded-lg p-2.5 border-white/10",children:[(0,N.jsx)("div",{className:"text-[10px] text-muted-foreground",children:"通关次数"}),(0,N.jsx)("div",{className:"font-mono text-lg font-bold text-fuchsia-200",children:S?S.totalWins:0})]}),(0,N.jsxs)("div",{className:"glass rounded-lg p-2.5 border-white/10",children:[(0,N.jsx)("div",{className:"text-[10px] text-muted-foreground",children:"BOSS 击杀"}),(0,N.jsx)("div",{className:"font-mono text-lg font-bold text-rose-200",children:S?S.bossKills:0})]})]}),(0,N.jsxs)("div",{className:"glass rounded-lg p-3 border-white/10 mb-5 text-left text-[11px] space-y-1",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(th,{className:"h-3 w-3 text-emerald-300 shrink-0"}),(0,N.jsx)("span",{className:"text-muted-foreground",children:"收集晶体碎片 → 晶体奖励"})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(uq,{className:"h-3 w-3 text-fuchsia-300 shrink-0"}),(0,N.jsx)("span",{className:"text-muted-foreground",children:"收集洞见光球 → 洞见奖励"})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(uT,{className:"h-3 w-3 text-amber-300 shrink-0"}),(0,N.jsx)("span",{className:"text-muted-foreground",children:"收集信标 → 接触进度"})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(no,{className:"h-3 w-3 text-rose-300 shrink-0"}),(0,N.jsx)("span",{className:"text-muted-foreground",children:"抵达星门通关 → +50% 奖励"})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(ne,{className:"h-3 w-3 text-rose-300 shrink-0"}),(0,N.jsx)("span",{className:"text-muted-foreground",children:"每 5 关 BOSS 战:击败 ×3 奖励"})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(uX,{className:"h-3 w-3 text-emerald-300 shrink-0"}),(0,N.jsx)("span",{className:"text-muted-foreground",children:"空格 / 右下角射击按钮 → 发射能量弹"})]}),(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)(t7,{className:"h-3 w-3 text-fuchsia-300 shrink-0"}),(0,N.jsx)("span",{className:"text-muted-foreground",children:"通关后 3 选 1 强化卡牌(每局重置)"})]})]}),(0,N.jsxs)("div",{className:"flex gap-2",children:[(0,N.jsxs)(t4,{onClick:()=>z(v),className:"flex-1 bg-amber-500/20 border border-amber-400/50 text-amber-100 hover:bg-amber-500/30 h-11",children:[(0,N.jsx)(uW,{className:"h-4 w-4 mr-1.5"}),"启动巡航"]}),(0,N.jsx)(t4,{variant:"ghost",onClick:W,className:"border border-white/10 text-white/70 hover:bg-white/10 h-11",children:"返回"})]}),(0,N.jsx)("div",{className:"text-[10px] text-muted-foreground/60 mt-3",children:E?"左下摇杆移动 · 右下射击":"WASD / 方向键移动 · 空格射击 · P 暂停 · Esc 退出"})]})]})}),("won"===b||"lost"===b)&&j&&(0,N.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:(0,N.jsxs)("div",{className:`glass rounded-2xl p-6 sm:p-8 max-w-md w-full relative overflow-hidden ${"won"===b?j.isBossLevel?"border-fuchsia-400/50":"border-emerald-400/40":"border-rose-400/40"}`,children:[(0,N.jsx)("div",{className:`pointer-events-none absolute -top-20 -left-20 h-40 w-40 rounded-full blur-3xl ${"won"===b?j.isBossLevel?"bg-fuchsia-500/25":"bg-emerald-500/20":"bg-rose-500/20"}`}),(0,N.jsxs)("div",{className:"relative",children:[(0,N.jsx)("div",{className:`text-[10px] tracking-[0.3em] mb-1 ${"won"===b?j.isBossLevel?"text-fuchsia-300/70":"text-emerald-300/70":"text-rose-300/70"}`,children:"won"===b?j.isBossLevel?"BOSS DEFEATED":"MISSION COMPLETE":"MISSION FAILED"}),(0,N.jsx)("h2",{className:`text-3xl font-bold mb-1 ${"won"===b?j.isBossLevel?"text-fuchsia-300":"text-emerald-300":"text-rose-300"}`,style:{textShadow:`0 0 20px ${"won"===b?j.isBossLevel?"rgba(232,121,249,0.5)":"rgba(52,211,153,0.5)":"rgba(251,113,133,0.5)"}`},children:"won"===b?j.isBossLevel?"BOSS 击破":"巡航成功":"巡航失败"}),(0,N.jsxs)("p",{className:"text-xs text-muted-foreground mb-5",children:["关卡 L",j.level," · 用时 ",Math.floor(j.durationSec/60),":",String(Math.floor(j.durationSec%60)).padStart(2,"0")]}),(0,N.jsxs)("div",{className:"grid grid-cols-3 gap-2 mb-4",children:[(0,N.jsxs)("div",{className:"glass rounded-lg p-2 border-emerald-400/20 text-center",children:[(0,N.jsx)(th,{className:"h-4 w-4 mx-auto text-emerald-300 mb-0.5"}),(0,N.jsx)("div",{className:"font-mono text-lg font-bold text-emerald-200",children:j.collectedCrystals}),(0,N.jsx)("div",{className:"text-[9px] text-muted-foreground",children:"晶体碎片"})]}),(0,N.jsxs)("div",{className:"glass rounded-lg p-2 border-fuchsia-400/20 text-center",children:[(0,N.jsx)(uq,{className:"h-4 w-4 mx-auto text-fuchsia-300 mb-0.5"}),(0,N.jsx)("div",{className:"font-mono text-lg font-bold text-fuchsia-200",children:j.collectedInsights}),(0,N.jsx)("div",{className:"text-[9px] text-muted-foreground",children:"洞见光球"})]}),(0,N.jsxs)("div",{className:"glass rounded-lg p-2 border-amber-400/20 text-center",children:[(0,N.jsx)(uT,{className:"h-4 w-4 mx-auto text-amber-300 mb-0.5"}),(0,N.jsx)("div",{className:"font-mono text-lg font-bold text-amber-200",children:j.collectedBeacons}),(0,N.jsx)("div",{className:"text-[9px] text-muted-foreground",children:"信标"})]})]}),(0,N.jsxs)("div",{className:"grid grid-cols-2 gap-2 mb-4",children:[(0,N.jsxs)("div",{className:"glass rounded-lg p-2 border-white/10 flex items-center gap-2",children:[(0,N.jsx)(uK,{className:"h-4 w-4 text-rose-300"}),(0,N.jsxs)("div",{children:[(0,N.jsx)("div",{className:"text-[9px] text-muted-foreground",children:"剩余护盾"}),(0,N.jsx)("div",{className:"font-mono text-sm font-bold text-rose-200",children:j.remainingShield})]})]}),(0,N.jsxs)("div",{className:"glass rounded-lg p-2 border-white/10 flex items-center gap-2",children:[(0,N.jsx)(no,{className:"h-4 w-4 text-amber-300"}),(0,N.jsxs)("div",{children:[(0,N.jsx)("div",{className:"text-[9px] text-muted-foreground",children:"得分"}),(0,N.jsx)("div",{className:"font-mono text-sm font-bold text-amber-200",children:U(j.score)})]})]})]}),(0,N.jsxs)("div",{className:"glass rounded-lg p-3 border-emerald-400/20 mb-5",children:[(0,N.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-2",children:"won"===b?j.isBossLevel?"BOSS 击败奖励 (×3)":"通关奖励 (+50%)":"残骸回收 (×50%)"}),(0,N.jsxs)("div",{className:"space-y-1.5",children:[(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-emerald-200",children:[(0,N.jsx)(th,{className:"h-3 w-3"})," 晶体"]}),(0,N.jsxs)("span",{className:"font-mono text-sm font-bold text-emerald-200",children:["+",U(j.rewards.crystals)]})]}),(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-fuchsia-200",children:[(0,N.jsx)(uq,{className:"h-3 w-3"})," 洞见"]}),(0,N.jsxs)("span",{className:"font-mono text-sm font-bold text-fuchsia-200",children:["+",j.rewards.insights.toFixed(1)]})]}),(0,N.jsxs)("div",{className:"flex items-center justify-between",children:[(0,N.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-amber-200",children:[(0,N.jsx)(uT,{className:"h-3 w-3"})," 接触"]}),(0,N.jsxs)("span",{className:"font-mono text-sm font-bold text-amber-200",children:["+",j.rewards.contact.toFixed(1),"%"]})]})]}),(0,N.jsx)("div",{className:"text-[9px] text-muted-foreground/70 mt-2 pt-2 border-t border-white/5",children:"奖励已同步至主游戏"})]}),(0,N.jsxs)("div",{className:"flex gap-2",children:["won"===b&&(0,N.jsxs)(t4,{onClick:H,className:"flex-1 bg-fuchsia-500/20 border border-fuchsia-400/50 text-fuchsia-100 hover:bg-fuchsia-500/30 h-10",children:[(0,N.jsx)(t7,{className:"h-4 w-4 mr-1"}),"选择强化"]}),(0,N.jsxs)(t4,{onClick:()=>z(j.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,N.jsx)(tm,{className:"h-4 w-4 mr-1"}),"重试"]}),(0,N.jsx)(t4,{variant:"ghost",onClick:W,className:"border border-white/10 text-white/70 hover:bg-white/10 h-10",children:"返回"})]})]})]})}),"choosing"===b&&(0,N.jsx)("div",{className:"absolute inset-0 flex items-center justify-center p-4 bg-black/70 backdrop-blur-md",children:(0,N.jsxs)("div",{className:"w-full max-w-3xl",children:[(0,N.jsxs)("div",{className:"text-center mb-6",children:[(0,N.jsx)("div",{className:"text-[10px] tracking-[0.4em] text-fuchsia-300/70 mb-1",children:"REINFORCEMENT PROTOCOL"}),(0,N.jsx)("h2",{className:"text-2xl sm:text-3xl font-bold text-gradient mb-1",children:"选择强化"}),(0,N.jsx)("p",{className:"text-xs text-muted-foreground",children:"星门共鸣释放能量,3 选 1 永久强化(本局有效)"})]}),(0,N.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3",children:A.map((e,t)=>{let s=hw[e.icon]??t7,r=D===t,a=null!==D&&!r;return(0,N.jsxs)("button",{onClick:()=>null===D&&q(t),disabled:null!==D,className:`group relative glass rounded-2xl p-5 border-2 transition-all duration-500 text-left overflow-hidden ${r?"scale-105 border-fuchsia-400 shadow-[0_0_30px_rgba(232,121,249,0.5)]":a?"opacity-40 border-white/10":"border-white/15 hover:border-white/30 hover:scale-[1.02] cursor-pointer"}`,style:{minHeight:"220px"},children:[(0,N.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,N.jsxs)("div",{className:"relative flex flex-col h-full",children:[(0,N.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,N.jsx)(s,{className:"h-6 w-6",style:{color:e.color}})}),(0,N.jsxs)("div",{className:"text-[10px] font-mono uppercase tracking-wider mb-1",style:{color:e.color},children:["强化 ",String(t+1).padStart(2,"0")]}),(0,N.jsx)("h3",{className:"text-lg font-bold text-white mb-1.5",children:e.title}),(0,N.jsx)("p",{className:"text-xs text-muted-foreground mb-3",children:e.desc}),(0,N.jsx)("div",{className:"mt-auto pt-2 border-t border-white/5",children:(0,N.jsxs)("div",{className:"flex items-center justify-between text-[10px]",children:[(0,N.jsx)("span",{className:"text-muted-foreground/70",children:"点击选择"}),(0,N.jsx)(nr,{className:"h-3 w-3",style:{color:e.color}})]})})]}),r&&(0,N.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-fuchsia-500/10 backdrop-blur-[1px]",children:(0,N.jsxs)("div",{className:"text-center",children:[(0,N.jsx)(t7,{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,N.jsx)("div",{className:"mt-2 text-xs font-bold text-fuchsia-200 tracking-wider",children:"已激活"})]})})]},e.id)})}),I.length>0&&(0,N.jsxs)("div",{className:"mt-5 glass rounded-xl p-3 border-white/10",children:[(0,N.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-2",children:"本局已激活强化"}),(0,N.jsx)("div",{className:"flex flex-wrap gap-2",children:I.map((e,t)=>{let s=hw[e.icon]??t7;return(0,N.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,N.jsx)(s,{className:"h-3 w-3",style:{color:e.color}}),(0,N.jsx)("span",{className:"text-[11px] text-white/85",children:e.title})]},t)})})]}),(0,N.jsx)("div",{className:"text-center mt-4",children:(0,N.jsx)(t4,{variant:"ghost",onClick:W,className:"border border-white/10 text-white/60 hover:bg-white/10 h-9",children:"退出巡航"})})]})})]})}let hk=(0,tu.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"}]]),hN=(0,tu.default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),hM=(0,tu.default)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]),hS={Compass:hk,Brain:uq,Swords:a7,Sparkles:t7},hT={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 hC(){let e=td(e=>e.attributes),t=td(e=>e.attributeProgress),s=td(e=>e.pendingAttrPoints??0),r=td(e=>e.allocateAttribute),a=(0,M.useMemo)(()=>ep(e),[e]),n=(0,M.useMemo)(()=>e.exploration+e.wisdom+e.courage+e.inspiration,[e]),i=(0,M.useMemo)(()=>(ef(e.exploration)+ef(e.wisdom)+ef(e.courage)+ef(e.inspiration))*100,[e]);return(0,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f flex flex-col gap-2.5 h-full overflow-y-auto echo-scroll pr-0.5",children:[(0,N.jsx)(tV.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,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f flex items-center justify-between",children:[(0,N.jsx)("h3",{className:"jsx-fb70db4abea5ec9f text-sm font-semibold flex items-center gap-1.5",children:(0,N.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,N.jsxs)("div",{className:`jsx-fb70db4abea5ec9f text-[10px] px-2 py-0.5 rounded-full border ${s>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:["待分配 ",s]})]}),(0,N.jsx)("div",{className:"jsx-fb70db4abea5ec9f grid grid-cols-2 lg:grid-cols-4 gap-2",children:eh.map(a=>{let n=eu[a],i=hT[a],o=hS[n.icon]??t7,l=e?.[a]??0,c=t?.[a]??{exp:0,level:l},d=100*ef(l),u=em(l),h=c.exp,f=u>0?Math.min(100,h/u*100):100,p=l>=100,m=s>0&&!p,x=l>50;return(0,N.jsxs)("div",{style:{boxShadow:`inset 0 0 18px ${i.glow}`},className:`jsx-fb70db4abea5ec9f relative rounded-xl border ${i.border} ${i.bg} p-2.5 flex flex-col gap-1.5 overflow-hidden transition-all duration-300`,children:[(0,N.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,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f relative flex items-center gap-1.5",children:[(0,N.jsx)("div",{style:{boxShadow:`0 0 8px ${i.glow}`},className:`jsx-fb70db4abea5ec9f shrink-0 h-7 w-7 rounded-lg flex items-center justify-center ${i.bg} border ${i.border}`,children:(0,N.jsx)(o,{className:`jsx-fb70db4abea5ec9f h-3.5 w-3.5 ${i.text}`})}),(0,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f min-w-0 flex-1 leading-tight",children:[(0,N.jsx)("div",{className:`jsx-fb70db4abea5ec9f text-[11px] font-semibold ${i.text} truncate`,children:n.name}),(0,N.jsx)("div",{className:"jsx-fb70db4abea5ec9f text-[8px] text-muted-foreground/70 uppercase tracking-wider truncate",children:n.enName})]}),(0,N.jsxs)("div",{className:`jsx-fb70db4abea5ec9f shrink-0 text-[9px] px-1.5 py-0.5 rounded font-mono font-bold ${p?"bg-amber-400/20 text-amber-200 border border-amber-400/40":"bg-black/30 text-white/80 border border-white/10"}`,children:["Lv.",l]})]}),(0,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f relative flex items-end justify-between",children:[(0,N.jsxs)("span",{className:`jsx-fb70db4abea5ec9f text-lg font-mono font-bold ${i.text} leading-none`,children:[l,(0,N.jsxs)("span",{className:"jsx-fb70db4abea5ec9f text-[9px] text-muted-foreground/60 ml-0.5",children:["/",100]})]}),(0,N.jsxs)("span",{className:`jsx-fb70db4abea5ec9f text-[10px] ${i.text} font-mono`,children:["+",d.toFixed(1),"%"]})]}),(0,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f relative",children:[(0,N.jsx)("div",{className:"jsx-fb70db4abea5ec9f h-1.5 rounded-full bg-black/40 overflow-hidden border border-white/5",children:(0,N.jsx)("div",{style:{width:`${p?100:f}%`,boxShadow:`0 0 6px ${i.glow}`},className:`jsx-fb70db4abea5ec9f h-full bg-gradient-to-r ${i.barFrom} ${i.barTo} transition-all duration-500`})}),(0,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f flex items-center justify-between mt-0.5 text-[8px] text-muted-foreground/70 font-mono",children:[(0,N.jsx)("span",{className:"jsx-fb70db4abea5ec9f",children:p?"已满级":`${h} / ${u} EXP`}),x&&!p&&(0,N.jsx)("span",{className:"jsx-fb70db4abea5ec9f text-amber-300/70",children:"递减区"})]})]}),(0,N.jsx)("div",{className:"jsx-fb70db4abea5ec9f relative flex flex-col gap-0.5 mt-0.5",children:n.effects.map((e,t)=>(0,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f text-[8.5px] text-muted-foreground/70 leading-tight flex items-center gap-1",children:[(0,N.jsx)("span",{className:"jsx-fb70db4abea5ec9f "+(i.text||""),children:"·"}),(0,N.jsx)("span",{className:"jsx-fb70db4abea5ec9f truncate",children:e})]},t))}),(0,N.jsxs)("button",{type:"button",disabled:!m,onClick:()=>r(a,1),"aria-label":`分配 1 点到 ${n.name}`,style:m?{boxShadow:`0 0 8px ${i.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 ${m?`${i.borderActive} ${i.bg} ${i.text} hover:scale-105 cursor-pointer`:"border-white/5 bg-black/20 text-muted-foreground/30 cursor-not-allowed"}`,children:[(0,N.jsx)(hN,{className:"h-3 w-3"}),(0,N.jsx)("span",{className:"jsx-fb70db4abea5ec9f",children:"分配"})]})]},a)})}),(0,N.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,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f flex items-center gap-1.5 text-[10px]",children:[(0,N.jsx)(hM,{className:"h-3 w-3 text-fuchsia-300"}),(0,N.jsx)("span",{className:"jsx-fb70db4abea5ec9f text-muted-foreground",children:"总等级"}),(0,N.jsxs)("span",{className:"jsx-fb70db4abea5ec9f font-mono font-bold text-fuchsia-200",children:[n,(0,N.jsxs)("span",{className:"jsx-fb70db4abea5ec9f text-muted-foreground/60 text-[9px]",children:["/",400]})]})]}),(0,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f flex items-center gap-2 text-[10px]",children:[(0,N.jsx)("span",{className:"jsx-fb70db4abea5ec9f text-muted-foreground",children:"总加成"}),(0,N.jsxs)("span",{className:"jsx-fb70db4abea5ec9f font-mono font-bold text-emerald-200",children:["+",i.toFixed(1),"%"]})]})]}),(0,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f grid grid-cols-2 gap-1 text-[9px]",children:[(0,N.jsx)(hP,{label:"探险力",value:`\xd7${a.expeditionPowerMult.toFixed(2)}`,color:"text-emerald-300"}),(0,N.jsx)(hP,{label:"解码步数",value:`+${a.decodeStepsBonus}`,color:"text-fuchsia-300"}),(0,N.jsx)(hP,{label:"洞见倍率",value:`+${(100*a.insightMultAdd).toFixed(1)}%`,color:"text-fuchsia-300"}),(0,N.jsx)(hP,{label:"自动解码周期",value:`\xd7${a.autoDecodeIntervalMult.toFixed(2)}`,color:"text-fuchsia-300"}),(0,N.jsx)(hP,{label:"探险生命",value:`+${a.expeditionHpBonus}`,color:"text-amber-300"}),(0,N.jsx)(hP,{label:"BOSS 胜率",value:`+${(100*a.bossWinRateBonus).toFixed(1)}%`,color:"text-amber-300"}),(0,N.jsx)(hP,{label:"巡航护盾",value:`+${a.cruiseShieldBonus}`,color:"text-amber-300"}),(0,N.jsx)(hP,{label:"接触率",value:`\xd7${a.contactRateMult.toFixed(2)}`,color:"text-rose-300"}),(0,N.jsx)(hP,{label:"星潮触发",value:`+${(100*a.tideTriggerBonus).toFixed(1)}%`,color:"text-rose-300"}),(0,N.jsx)(hP,{label:"脉冲连击",value:`+${(100*a.pulseComboBonus).toFixed(1)}%`,color:"text-rose-300"}),(0,N.jsx)(hP,{label:"巡航速度",value:`\xd7${a.cruiseShipSpeedMult.toFixed(2)}`,color:"text-emerald-300"}),(0,N.jsx)(hP,{label:"产能加成",value:`\xd7${a.crystalsPerSecMult.toFixed(2)}`,color:"text-emerald-300"})]}),(0,N.jsxs)("div",{className:"jsx-fb70db4abea5ec9f text-[9px] text-muted-foreground/60 text-center leading-tight",children:["每次飞升获得 ",(0,N.jsx)("span",{className:"jsx-fb70db4abea5ec9f text-fuchsia-300 font-mono",children:"飞升次数 × 2 + 1"})," 点属性点;完成对应活动自动累积经验"]})]})}function hP({label:e,value:t,color:s}){return(0,N.jsxs)("div",{className:"flex items-center justify-between rounded bg-black/25 border border-white/5 px-1.5 py-0.5",children:[(0,N.jsx)("span",{className:"text-muted-foreground/80 truncate",children:e}),(0,N.jsx)("span",{className:`font-mono ${s}`,children:t})]})}function hE(){let e=td(e=>e._tideEvents),t=td(e=>e.consumeTideEvents),{toast:s}=(0,tU.useToast)();return(0,M.useEffect)(()=>{if(0!==e.length)for(let e of t()){let t=e.isGlobal?"🌐 ":"";if(e.started){let r=q[e.started];tX("tideStart"),s({title:`${t}${r.icon} ${e.isGlobal?"全球星潮":"星潮降临"}${r.name}`,description:e.isGlobal?`全球玩家同步经历 \xb7 ${r.desc}`:r.desc})}if(e.ended){let r=q[e.ended];e.silenceCompensation&&e.silenceCompensation>0?(tX("techBuy"),s({title:`${t}${r.icon} 寂静期消散`,description:`虚空回赠 ${e.silenceCompensation} 洞见。`})):(tX("tideEnd"),s({title:`${t}${r.icon} ${r.name}结束`,description:e.isGlobal?"全球星潮退去,物理法则恢复。":"星潮退去,物理法则恢复。"}))}}},[e,t,s]),null}function h_(){let e=td(e=>e.activeTide),t=td(e=>e.globalTide),[,s]=(0,M.useState)(0);if((0,M.useEffect)(()=>{if(!e)return;let t=setInterval(()=>s(e=>e+1),500);return()=>clearInterval(t)},[e]),!e)return null;let r=q[e.type],a=Math.max(0,e.endsAt-Date.now()),n=Math.ceil(a/1e3),i=Math.min(1,Math.max(0,1-a/(t?t.endsAt-t.startedAt:75e3))),o=!!t;return(0,N.jsxs)("div",{className:`flex items-center gap-1.5 px-2 py-1 rounded-full text-[10px] font-medium relative overflow-hidden ${o?"ring-1 ring-amber-300/60":""}`,style:{background:o?`linear-gradient(135deg, ${r.color}26, ${r.color}11)`:`${r.color}1a`,border:`1px solid ${r.color}${o?"88":"55"}`,color:r.color,boxShadow:`0 0 ${o?"16":"10"}px ${r.glow}`},title:o?`🌐 全球星潮 \xb7 ${r.desc}`:r.desc,children:[(0,N.jsx)("div",{className:"absolute inset-0 opacity-20",style:{background:`linear-gradient(90deg, ${r.color}40 ${100*i}%, transparent ${100*i}%)`}}),o&&(0,N.jsx)("span",{className:"relative text-[11px] leading-none animate-pulse","aria-label":"全球星潮标记",children:"🌐"}),(0,N.jsx)("span",{className:"relative text-xs leading-none",children:r.icon}),(0,N.jsx)("span",{className:"relative leading-none",children:r.name}),(0,N.jsxs)("span",{className:"relative font-mono leading-none opacity-80",children:[n,"s"]})]})}function hR(){let e=td(e=>e.activeTide),t=td(e=>e.globalTide);if(!e)return null;let s=q[e.type],r=!!t;return(0,N.jsxs)("div",{className:"jsx-12289952018fdcbd fixed inset-0 pointer-events-none z-0 transition-opacity duration-1000",children:[(0,N.jsx)("div",{style:{background:`linear-gradient(180deg, ${s.color}22, transparent)`},className:"jsx-12289952018fdcbd absolute top-0 left-0 right-0 h-24 opacity-40"}),(0,N.jsx)("div",{style:{background:`linear-gradient(0deg, ${s.color}22, transparent)`},className:"jsx-12289952018fdcbd absolute bottom-0 left-0 right-0 h-24 opacity-40"}),(0,N.jsx)("div",{style:{boxShadow:`inset 0 0 ${r?"160":"120"}px ${s.glow}`,animation:"tide-breathe 3s ease-in-out infinite"},className:"jsx-12289952018fdcbd absolute inset-0"}),r&&(0,N.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,N.jsx)(tV.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 hA=Object.create(null);hA.open="0",hA.close="1",hA.ping="2",hA.pong="3",hA.message="4",hA.upgrade="5",hA.noop="6";let h$=Object.create(null);Object.keys(hA).forEach(e=>{h$[hA[e]]=e});let hD={type:"error",data:"parser error"},hB="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),hI="function"==typeof ArrayBuffer,hL=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,hO=({type:e,data:t},s,r)=>{if(hB&&t instanceof Blob)if(s)return r(t);else return hF(t,r);if(hI&&(t instanceof ArrayBuffer||hL(t)))if(s)return r(t);else return hF(new Blob([t]),r);return r(hA[e]+(t||""))},hF=(e,t)=>{let s=new FileReader;return s.onload=function(){t("b"+(s.result.split(",")[1]||""))},s.readAsDataURL(e)};function hz(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let hV="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hU="u"<typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<hV.length;e++)hU[hV.charCodeAt(e)]=e;let hW="function"==typeof ArrayBuffer,hH=(e,t)=>{if("string"!=typeof e)return{type:"message",data:hK(e,t)};let s=e.charAt(0);return"b"===s?{type:"message",data:hq(e.substring(1),t)}:h$[s]?e.length>1?{type:h$[s],data:e.substring(1)}:{type:h$[s]}:hD},hq=(e,t)=>hW?hK((e=>{let t=.75*e.length,s=e.length,r,a=0,n,i,o,l;"="===e[e.length-1]&&(t--,"="===e[e.length-2]&&t--);let c=new ArrayBuffer(t),d=new Uint8Array(c);for(r=0;r<s;r+=4)n=hU[e.charCodeAt(r)],i=hU[e.charCodeAt(r+1)],o=hU[e.charCodeAt(r+2)],l=hU[e.charCodeAt(r+3)],d[a++]=n<<2|i>>4,d[a++]=(15&i)<<4|o>>2,d[a++]=(3&o)<<6|63&l;return c})(e),t):{base64:!0,data:e},hK=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer;function hX(e){return e.reduce((e,t)=>e+t.length,0)}function hY(e,t){if(e[0].length===t)return e.shift();let s=new Uint8Array(t),r=0;for(let a=0;a<t;a++)s[a]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),s}function hG(e){if(e){var t=e;for(var s in hG.prototype)t[s]=hG.prototype[s];return t}}hG.prototype.on=hG.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},hG.prototype.once=function(e,t){function s(){this.off(e,s),t.apply(this,arguments)}return s.fn=t,this.on(e,s),this},hG.prototype.off=hG.prototype.removeListener=hG.prototype.removeAllListeners=hG.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var s,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var a=0;a<r.length;a++)if((s=r[a])===t||s.fn===t){r.splice(a,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},hG.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),s=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(s){s=s.slice(0);for(var r=0,a=s.length;r<a;++r)s[r].apply(this,t)}return this},hG.prototype.emitReserved=hG.prototype.emit,hG.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},hG.prototype.hasListeners=function(e){return!!this.listeners(e).length};let hJ="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),hZ="u">typeof self?self:"u">typeof window?window:Function("return this")();function hQ(e,...t){return t.reduce((t,s)=>(e.hasOwnProperty(s)&&(t[s]=e[s]),t),{})}let h0=hZ.setTimeout,h1=hZ.clearTimeout;function h2(e,t){t.useNativeTimers?(e.setTimeoutFn=h0.bind(hZ),e.clearTimeoutFn=h1.bind(hZ)):(e.setTimeoutFn=hZ.setTimeout.bind(hZ),e.clearTimeoutFn=hZ.clearTimeout.bind(hZ))}function h5(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class h3 extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class h4 extends hG{constructor(e){super(),this.writable=!1,h2(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new h3(e,t,s)),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=hH(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 s in e)e.hasOwnProperty(s)&&(t.length&&(t+="&"),t+=encodeURIComponent(s)+"="+encodeURIComponent(e[s]));return t}(e);return t.length?"?"+t:""}}class h9 extends h4{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 s=e.split("\x1e"),r=[];for(let e=0;e<s.length;e++){let a=hH(s[e],t);if(r.push(a),"error"===a.type)break}return r})(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 s,r,a;this.writable=!1,t=e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})},r=Array(s=e.length),a=0,e.forEach((e,n)=>{hO(e,!1,e=>{r[n]=e,++a===s&&t(r.join("\x1e"))})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=h5()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let h7=!1;try{h7="u">typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}let h6=h7;function h8(){}class fe extends h9{constructor(e){if(super(e),"u">typeof location){const t="https:"===location.protocol;let s=location.port;s||(s=t?"443":"80"),this.xd="u">typeof location&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){let s=this.request({method:"POST",data:e});s.on("success",t),s.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 ft extends hG{constructor(e,t,s){super(),this.createRequest=e,h2(this,s),this._opts=s,this._method=s.method||"GET",this._uri=t,this._data=void 0!==s.data?s.data:null,this._create()}_create(){var e;let t=hQ(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(t);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders)for(let e in s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0),this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&s.setRequestHeader(e,this._opts.extraHeaders[e])}catch(e){}if("POST"===this._method)try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{s.setRequestHeader("Accept","*/*")}catch(e){}null==(e=this._opts.cookieJar)||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var e;3===s.readyState&&(null==(e=this._opts.cookieJar)||e.parseCookies(s.getResponseHeader("set-cookie"))),4===s.readyState&&(200===s.status||1223===s.status?this._onLoad():this.setTimeoutFn(()=>{this._onError("number"==typeof s.status?s.status:0)},0))},s.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}"u">typeof document&&(this._index=ft.requestsCount++,ft.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=h8,e)try{this._xhr.abort()}catch(e){}"u">typeof document&&delete ft.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 fs(){for(let e in ft.requests)ft.requests.hasOwnProperty(e)&&ft.requests[e].abort()}ft.requestsCount=0,ft.requests={},"u">typeof document&&("function"==typeof attachEvent?attachEvent("onunload",fs):"function"==typeof addEventListener&&addEventListener("onpagehide"in hZ?"pagehide":"unload",fs,!1));let fr=(d=fa({xdomain:!1}))&&null!==d.responseType;function fa(e){let t=e.xdomain;try{if("u">typeof XMLHttpRequest&&(!t||h6))return new XMLHttpRequest}catch(e){}if(!t)try{return new hZ[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(e){}}let fn="u">typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class fi extends h4{get name(){return"websocket"}doOpen(){let e=this.uri(),t=this.opts.protocols,s=fn?{}:hQ(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}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 s=e[t],r=t===e.length-1;hO(s,this.supportsBinary,e=>{try{this.doWrite(s,e)}catch(e){}r&&hJ(()=>{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]=h5()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}let fo=hZ.WebSocket||hZ.MozWebSocket,fl={websocket:class extends fi{createSocket(e,t,s){return fn?new fo(e,t,s):t?new fo(e,t):new fo(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends h4{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 t,a;let n,i,o,l,c=(t=Number.MAX_SAFE_INTEGER,a=this.socket.binaryType,r||(r=new TextDecoder),n=[],i=0,o=-1,l=!1,new TransformStream({transform(e,s){for(n.push(e);;){if(0===i){if(1>hX(n))break;let e=hY(n,1);l=(128&e[0])==128,i=(o=127&e[0])<126?3:126===o?1:2}else if(1===i){if(2>hX(n))break;let e=hY(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),i=3}else if(2===i){if(8>hX(n))break;let e=hY(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),r=t.getUint32(0);if(r>2097151){s.enqueue(hD);break}o=0x100000000*r+t.getUint32(4),i=3}else{if(hX(n)<o)break;let e=hY(n,o);s.enqueue(hH(l?e:r.decode(e),a)),i=0}if(0===o||o>t){s.enqueue(hD);break}}}})),d=e.readable.pipeThrough(c).getReader(),u=new TransformStream({transform(e,t){var r;r=s=>{let r,a=s.length;if(a<126)new DataView((r=new Uint8Array(1)).buffer).setUint8(0,a);else if(a<65536){let e=new DataView((r=new Uint8Array(3)).buffer);e.setUint8(0,126),e.setUint16(1,a)}else{let e=new DataView((r=new Uint8Array(9)).buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(a))}e.data&&"string"!=typeof e.data&&(r[0]|=128),t.enqueue(r),t.enqueue(s)},hB&&e.data instanceof Blob?e.data.arrayBuffer().then(hz).then(r):hI&&(e.data instanceof ArrayBuffer||hL(e.data))?r(hz(e.data)):hO(e,!1,e=>{s||(s=new TextEncoder),r(s.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 s=e[t],r=t===e.length-1;this._writer.write(s).then(()=>{r&&hJ(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;null==(e=this._transport)||e.close()}},polling:class extends fe{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=fr&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new ft(fa,this.uri(),e)}}},fc=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,fd=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function fu(e){var t,s;let r,a;if(e.length>8e3)throw"URI too long";let n=e,i=e.indexOf("["),o=e.indexOf("]");-1!=i&&-1!=o&&(e=e.substring(0,i)+e.substring(i,o).replace(/:/g,";")+e.substring(o,e.length));let l=fc.exec(e||""),c={},d=14;for(;d--;)c[fd[d]]=l[d]||"";return -1!=i&&-1!=o&&(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),r=(t=c.path).replace(/\/{2,9}/g,"/").split("/"),("/"==t.slice(0,1)||0===t.length)&&r.splice(0,1),"/"==t.slice(-1)&&r.splice(r.length-1,1),c.pathNames=r,s=c.query,a={},s.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,s){t&&(a[t]=s)}),c.queryKey=a,c}let fh="function"==typeof addEventListener&&"function"==typeof removeEventListener,ff=[];fh&&addEventListener("offline",()=>{ff.forEach(e=>e())},!1);class fp extends hG{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 s=fu(e);t.hostname=s.host,t.secure="https"===s.protocol||"wss"===s.protocol,t.port=s.port,s.query&&(t.query=s.query)}else t.host&&(t.hostname=fu(t.host).host);h2(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={},s=e.split("&");for(let e=0,r=s.length;e<r;e++){let r=s[e].split("=");t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}(this.opts.query)),fh&&(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"})},ff.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 s=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](s)}_open(){if(0===this.transports.length)return void this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);let e=this.opts.rememberUpgrade&&fp.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",fp.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 s=this.writeBuffer[t].data;if(s&&(e+="string"==typeof s?function(e){let t=0,s=0;for(let r=0,a=e.length;r<a;r++)(t=e.charCodeAt(r))<128?s+=1:t<2048?s+=2:t<55296||t>=57344?s+=3:(r++,s+=4);return s}(s):Math.ceil(1.33*(s.byteLength||s.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,hJ(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,s){return this._sendPacket("message",e,t,s),this}send(e,t,s){return this._sendPacket("message",e,t,s),this}_sendPacket(e,t,s,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof s&&(r=s,s=null),"closing"===this.readyState||"closed"===this.readyState)return;(s=s||{}).compress=!1!==s.compress;let a={type:e,data:t,options:s};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),r&&this.once("flush",r),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{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?s():e()}):this.upgrading?s():e()),this}_onError(e){if(fp.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(),fh&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=ff.indexOf(this._offlineEventListener);-1!==e&&ff.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}fp.protocol=4;class fm extends fp{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),s=!1;fp.priorWebsocketSuccess=!1;let r=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",e=>{if(!s)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;fp.priorWebsocketSuccess="websocket"===t.name,this.transport.pause(()=>{s||"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 a(){s||(s=!0,c(),t.close(),t=null)}let n=e=>{let s=Error("probe error: "+e);s.transport=t.name,a(),this.emitReserved("upgradeError",s)};function i(){n("transport closed")}function o(){n("socket closed")}function l(e){t&&e.name!==t.name&&a()}let c=()=>{t.removeListener("open",r),t.removeListener("error",n),t.removeListener("close",i),this.off("close",o),this.off("upgrading",l)};t.once("open",r),t.once("error",n),t.once("close",i),this.once("close",o),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}class fx extends fm{constructor(e,t={}){const s="object"==typeof e,r=s?{...e}:{...t};(!r.transports||r.transports&&"string"==typeof r.transports[0])&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(e=>fl[e]).filter(e=>!!e)),super(s?r:e,r)}}fx.protocol;let fg="function"==typeof ArrayBuffer,fb=Object.prototype.toString,fy="function"==typeof Blob||"u">typeof Blob&&"[object BlobConstructor]"===fb.call(Blob),fv="function"==typeof File||"u">typeof File&&"[object FileConstructor]"===fb.call(File);function fw(e){return fg&&(e instanceof ArrayBuffer||("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer))||fy&&e instanceof Blob||fv&&e instanceof File}let fj=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];(w=k||(k={}))[w.CONNECT=0]="CONNECT",w[w.DISCONNECT=1]="DISCONNECT",w[w.EVENT=2]="EVENT",w[w.ACK=3]="ACK",w[w.CONNECT_ERROR=4]="CONNECT_ERROR",w[w.BINARY_EVENT=5]="BINARY_EVENT",w[w.BINARY_ACK=6]="BINARY_ACK";class fk{constructor(e){this.replacer=e}encode(e){return(e.type===k.EVENT||e.type===k.ACK)&&function e(t,s){if(!t||"object"!=typeof t)return!1;if(Array.isArray(t)){for(let s=0,r=t.length;s<r;s++)if(e(t[s]))return!0;return!1}if(fw(t))return!0;if(t.toJSON&&"function"==typeof t.toJSON&&1==arguments.length)return e(t.toJSON(),!0);for(let s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&e(t[s]))return!0;return!1}(e)?this.encodeAsBinary({type:e.type===k.EVENT?k.BINARY_EVENT:k.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===k.BINARY_EVENT||e.type===k.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,s,r=(t=[],s=e.data,e.data=function e(t,s){if(!t)return t;if(fw(t)){let e={_placeholder:!0,num:s.length};return s.push(t),e}if(Array.isArray(t)){let r=Array(t.length);for(let a=0;a<t.length;a++)r[a]=e(t[a],s);return r}if("object"==typeof t&&!(t instanceof Date)){let r={};for(let a in t)Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=e(t[a],s));return r}return t}(s,t),e.attachments=t.length,{packet:e,buffers:t}),a=this.encodeAsString(r.packet),n=r.buffers;return n.unshift(a),n}}class fN extends hG{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 s=(t=this.decodeString(e)).type===k.BINARY_EVENT;s||t.type===k.BINARY_ACK?(t.type=s?k.EVENT:k.ACK,this.reconstructor=new fM(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(fw(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,s={type:Number(e.charAt(0))};if(void 0===k[s.type])throw Error("unknown packet type "+s.type);if(s.type===k.BINARY_EVENT||s.type===k.BINARY_ACK){let r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);let a=e.substring(r,t);if(a!=Number(a)||"-"!==e.charAt(t))throw Error("Illegal attachments");let n=Number(a);if(!fS(n)||n<0)throw Error("Illegal attachments");if(n>this.opts.maxAttachments)throw Error("too many attachments");s.attachments=n}if("/"===e.charAt(t+1)){let r=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);s.nsp=e.substring(r,t)}else s.nsp="/";let r=e.charAt(t+1);if(""!==r&&Number(r)==r){let r=t+1;for(;++t;){let s=e.charAt(t);if(null==s||Number(s)!=s){--t;break}if(t===e.length)break}s.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){let r=this.tryParse(e.substr(t));if(fN.isPayloadValid(s.type,r))s.data=r;else throw Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case k.CONNECT:return fT(t);case k.DISCONNECT:return void 0===t;case k.CONNECT_ERROR:return"string"==typeof t||fT(t);case k.EVENT:case k.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===fj.indexOf(t[0]));case k.ACK:case k.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class fM{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,s;let e=(t=this.reconPack,s=this.buffers,t.data=function e(t,s){if(!t)return t;if(t&&!0===t._placeholder){if("number"==typeof t.num&&t.num>=0&&t.num<s.length)return s[t.num];throw Error("illegal attachments")}if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=e(t[r],s);else if("object"==typeof t)for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=e(t[r],s));return t}(t.data,s),delete t.attachments,t);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}let fS=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function fT(e){return"[object Object]"===Object.prototype.toString.call(e)}function fC(e){var t;return"string"==typeof e.nsp&&(void 0===(t=e.id)||fS(t))&&function(e,t){switch(e){case k.CONNECT:return void 0===t||fT(t);case k.DISCONNECT:return void 0===t;case k.EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===fj.indexOf(t[0]));case k.ACK:return Array.isArray(t);case k.CONNECT_ERROR:return"string"==typeof t||fT(t);default:return!1}}(e.type,e.data)}function fP(e,t,s){return e.on(t,s),function(){e.off(t,s)}}e.s(["Decoder",()=>fN,"Encoder",()=>fk,"PacketType",()=>k,"isPacketValid",()=>fC,"protocol",0,5],51890);let fE=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class f_ extends hG{constructor(e,t,s){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,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[fP(e,"open",this.onopen.bind(this)),fP(e,"packet",this.onpacket.bind(this)),fP(e,"error",this.onerror.bind(this)),fP(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 s,r,a;if(fE.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:k.EVENT,data:t};if(n.options={},n.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){let e=this.ids++,s=t.pop();this._registerAckCallback(e,s),n.id=e}let i=null==(r=null==(s=this.io.engine)?void 0:s.transport)?void 0:r.writable,o=this.connected&&!(null==(a=this.io.engine)?void 0:a._hasPingExpired());return this.flags.volatile&&!i||(o?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var s;let r=null!=(s=this.flags.timeout)?s:this._opts.ackTimeout;if(void 0===r){this.acks[e]=t;return}let a=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"))},r),n=(...e)=>{this.io.clearTimeoutFn(a),t.apply(this,e)};n.withError=!0,this.acks[e]=n}emitWithAck(e,...t){return new Promise((s,r)=>{let a=(e,t)=>e?r(e):s(t);a.withError=!0,t.push(a),this.emit(e,...t)})}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());let s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],null!==e?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),s.pending=!1,this._drainQueue())),this._queue.push(s),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:k.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 k.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 k.EVENT:case k.BINARY_EVENT:this.onevent(e);break;case k.ACK:case k.BINARY_ACK:this.onack(e);break;case k.DISCONNECT:this.ondisconnect();break;case k.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,s=!1;return function(...r){s||(s=!0,t.packet({type:k.ACK,id:e,data:r}))}}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:k.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 s=0;s<t.length;s++)if(e===t[s]){t.splice(s,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 s=0;s<t.length;s++)if(e===t[s]){t.splice(s,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 fR=e.i(51890);function fA(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}fA.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),s=Math.floor(t*this.jitter*e);e=(1&Math.floor(10*t))==0?e-s:e+s}return 0|Math.min(e,this.max)},fA.prototype.reset=function(){this.attempts=0},fA.prototype.setMin=function(e){this.ms=e},fA.prototype.setMax=function(e){this.max=e},fA.prototype.setJitter=function(e){this.jitter=e};class f$ extends hG{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,h2(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!=(s=t.randomizationFactor)?s:.5),this.backoff=new fA({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||fR;this.encoder=new r.Encoder,this.decoder=new r.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 fx(this.uri,this.opts);let t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;let r=fP(t,"open",function(){s.onopen(),e&&e()}),a=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},n=fP(t,"error",a);if(!1!==this._timeout){let e=this._timeout,s=this.setTimeoutFn(()=>{r(),a(Error("timeout")),t.close()},e);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}return this.subs.push(r),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(fP(e,"ping",this.onping.bind(this)),fP(e,"data",this.ondata.bind(this)),fP(e,"error",this.onerror.bind(this)),fP(e,"close",this.onclose.bind(this)),fP(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){hJ(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new f_(this,e,t),this.nsps[e]=s),s}_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 s=0;s<t.length;s++)this.engine.write(t[s],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 s;this.cleanup(),null==(s=this.engine)||s.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 s=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&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}let fD={};function fB(e,t){let s;"object"==typeof e&&(t=e,e=void 0);let r=function(e,t="",s){let r=e;s=s||"u">typeof location&&location,null==e&&(e=s.protocol+"//"+s.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?s.protocol+e:s.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==s?s.protocol+"//"+e:"https://"+e),r=fu(e)),!r.port&&(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let a=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port+t,r.href=r.protocol+"://"+a+(s&&s.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),a=r.source,n=r.id,i=r.path,o=fD[n]&&i in fD[n].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||o?s=new f$(a,t):(fD[n]||(fD[n]=new f$(a,t)),s=fD[n]),r.query&&!t.query&&(t.query=r.queryKey),s.socket(r.path,t)}Object.assign(fB,{Manager:f$,Socket:f_,io:fB,connect:fB});let fI=null,fL=0;var fO=e.i(75830),fF="rovingFocusGroup.onEntryFocus",fz={bubbles:!1,cancelable:!0},fV="RovingFocusGroup",[fU,fW,fH]=(0,fO.createCollection)(fV),[fq,fK]=(0,sm.createContextScope)(fV,[fH]),[fX,fY]=fq(fV),fG=M.forwardRef((e,t)=>(0,N.jsx)(fU.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,N.jsx)(fU.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,N.jsx)(fJ,{...e,ref:t})})}));fG.displayName=fV;var fJ=M.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:s,orientation:r,loop:a=!1,dir:n,currentTabStopId:i,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...u}=e,h=M.useRef(null),f=(0,tx.useComposedRefs)(t,h),p=sb(n),[m,x]=(0,s7.useControllableState)({prop:i,defaultProp:o??null,onChange:l,caller:fV}),[g,b]=M.useState(!1),y=(0,sx.useCallbackRef)(c),v=fW(s),w=M.useRef(!1),[j,k]=M.useState(0);return M.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(fF,y),()=>e.removeEventListener(fF,y)},[y]),(0,N.jsx)(fX,{scope:s,orientation:r,dir:p,loop:a,currentTabStopId:m,onItemFocus:M.useCallback(e=>x(e),[x]),onItemShiftTab:M.useCallback(()=>b(!0),[]),onFocusableItemAdd:M.useCallback(()=>k(e=>e+1),[]),onFocusableItemRemove:M.useCallback(()=>k(e=>e-1),[]),children:(0,N.jsx)(sf.Primitive.div,{tabIndex:g||0===j?-1:0,"data-orientation":r,...u,ref:f,style:{outline:"none",...e.style},onMouseDown:(0,sv.composeEventHandlers)(e.onMouseDown,()=>{w.current=!0}),onFocus:(0,sv.composeEventHandlers)(e.onFocus,e=>{let t=!w.current;if(e.target===e.currentTarget&&t&&!g){let t=new CustomEvent(fF,fz);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=v().filter(e=>e.focusable);f1([e.find(e=>e.active),e.find(e=>e.id===m),...e].filter(Boolean).map(e=>e.ref.current),d)}}w.current=!1}),onBlur:(0,sv.composeEventHandlers)(e.onBlur,()=>b(!1))})})}),fZ="RovingFocusGroupItem",fQ=M.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:s,focusable:r=!0,active:a=!1,tabStopId:n,children:i,...o}=e,l=s9(),c=n||l,d=fY(fZ,s),u=d.currentTabStopId===c,h=fW(s),{onFocusableItemAdd:f,onFocusableItemRemove:p,currentTabStopId:m}=d;return M.useEffect(()=>{if(r)return f(),()=>p()},[r,f,p]),(0,N.jsx)(fU.ItemSlot,{scope:s,id:c,focusable:r,active:a,children:(0,N.jsx)(sf.Primitive.span,{tabIndex:u?0:-1,"data-orientation":d.orientation,...o,ref:t,onMouseDown:(0,sv.composeEventHandlers)(e.onMouseDown,e=>{r?d.onItemFocus(c):e.preventDefault()}),onFocus:(0,sv.composeEventHandlers)(e.onFocus,()=>d.onItemFocus(c)),onKeyDown:(0,sv.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,s){var r;let a=(r=e.key,"rtl"!==s?r:"ArrowLeft"===r?"ArrowRight":"ArrowRight"===r?"ArrowLeft":r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(a))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)))return f0[a]}(e,d.orientation,d.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let a=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)a.reverse();else if("prev"===t||"next"===t){var s,r;"prev"===t&&a.reverse();let n=a.indexOf(e.currentTarget);a=d.loop?(s=a,r=n+1,s.map((e,t)=>s[(r+t)%s.length])):a.slice(n+1)}setTimeout(()=>f1(a))}}),children:"function"==typeof i?i({isCurrentTabStop:u,hasTabStop:null!=m}):i})})});fQ.displayName=fZ;var f0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function f1(e,t=!1){let s=document.activeElement;for(let r of e)if(r===s||(r.focus({preventScroll:t}),document.activeElement!==s))return}var f2="Tabs",[f5,f3]=(0,sm.createContextScope)(f2,[fK]),f4=fK(),[f9,f7]=f5(f2),f6=M.forwardRef((e,t)=>{let{__scopeTabs:s,value:r,onValueChange:a,defaultValue:n,orientation:i="horizontal",dir:o,activationMode:l="automatic",...c}=e,d=sb(o),[u,h]=(0,s7.useControllableState)({prop:r,onChange:a,defaultProp:n??"",caller:f2});return(0,N.jsx)(f9,{scope:s,baseId:s9(),value:u,onValueChange:h,orientation:i,dir:d,activationMode:l,children:(0,N.jsx)(sf.Primitive.div,{dir:d,"data-orientation":i,...c,ref:t})})});f6.displayName=f2;var f8="TabsList",pe=M.forwardRef((e,t)=>{let{__scopeTabs:s,loop:r=!0,...a}=e,n=f7(f8,s),i=f4(s);return(0,N.jsx)(fG,{asChild:!0,...i,orientation:n.orientation,dir:n.dir,loop:r,children:(0,N.jsx)(sf.Primitive.div,{role:"tablist","aria-orientation":n.orientation,...a,ref:t})})});pe.displayName=f8;var pt="TabsTrigger",ps=M.forwardRef((e,t)=>{let{__scopeTabs:s,value:r,disabled:a=!1,...n}=e,i=f7(pt,s),o=f4(s),l=pn(i.baseId,r),c=pi(i.baseId,r),d=r===i.value;return(0,N.jsx)(fQ,{asChild:!0,...o,focusable:!a,active:d,children:(0,N.jsx)(sf.Primitive.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:l,...n,ref:t,onMouseDown:(0,sv.composeEventHandlers)(e.onMouseDown,e=>{a||0!==e.button||!1!==e.ctrlKey?e.preventDefault():i.onValueChange(r)}),onKeyDown:(0,sv.composeEventHandlers)(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&i.onValueChange(r)}),onFocus:(0,sv.composeEventHandlers)(e.onFocus,()=>{let e="manual"!==i.activationMode;d||a||!e||i.onValueChange(r)})})})});ps.displayName=pt;var pr="TabsContent",pa=M.forwardRef((e,t)=>{let{__scopeTabs:s,value:r,forceMount:a,children:n,...i}=e,o=f7(pr,s),l=pn(o.baseId,r),c=pi(o.baseId,r),d=r===o.value,u=M.useRef(d);return M.useEffect(()=>{let e=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,N.jsx)(sp.Presence,{present:a||d,children:({present:s})=>(0,N.jsx)(sf.Primitive.div,{"data-state":d?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":l,hidden:!s,id:c,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:s&&n})})});function pn(e,t){return`${e}-trigger-${t}`}function pi(e,t){return`${e}-content-${t}`}function po({className:e,...t}){return(0,N.jsx)(f6,{"data-slot":"tabs",className:(0,tL.cn)("flex flex-col gap-2",e),...t})}function pl({className:e,...t}){return(0,N.jsx)(pe,{"data-slot":"tabs-list",className:(0,tL.cn)("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function pc({className:e,...t}){return(0,N.jsx)(ps,{"data-slot":"tabs-trigger",className:(0,tL.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 pd({className:e,...t}){return(0,N.jsx)(pa,{"data-slot":"tabs-content",className:(0,tL.cn)("flex-1 outline-none",e),...t})}pa.displayName=pr;let pu=(0,tu.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"}]]),ph=(0,tu.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"}]]),pf=(0,tu.default)("navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]),pp=(0,tu.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"}]]),pm=(0,tu.default)("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);function px(){let e,t,s,r,a,n,i,o,l,c;e=td(e=>e.tick),t=td(e=>e.autoDecodeTick),s=td(e=>e.tickTide),r=td(e=>e.checkAchievements),a=td(e=>e.init),n=(0,M.useRef)(!1),(0,M.useEffect)(()=>{let i=()=>{n.current||(a(),n.current=!0)},o=null,l=null;td.persist.hasHydrated()?i():(o=td.persist.onFinishHydration(i),l=setTimeout(i,500));let c=0,d=setInterval(()=>{let a=Date.now();e(a),t(),s(a),++c%4==0&&r()},250);return()=>{clearInterval(d),o&&o(),l&&clearTimeout(l)}},[e,t,s,r,a]),(0,M.useEffect)(()=>{let t=()=>{"visible"===document.visibilityState&&(e(Date.now()),s(Date.now()),r())};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[e,s,r]),i=td(e=>e.soundOn),(0,M.useEffect)(()=>{tK().setEnabled(i)},[i]),o=td(e=>e.triggerGlobalTide),l=(0,M.useRef)(o),(0,M.useEffect)(()=>{l.current=o},[o]),c=(0,M.useRef)(new Set),(0,M.useEffect)(()=>{let e=(fI||(fI=fB("/?XTransformPort=3031",{transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:1/0,reconnectionDelay:1e3,reconnectionDelayMax:1e4,timeout:1e4})),fI);fL+=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()||l.current(e.type)}},s=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),l.current(e.current.type))}};return e.on("global-tide",t),e.on("tide-state",s),e.emit("get-next-tide"),()=>{e.off("global-tide",t),e.off("tide-state",s),(fL-=1)<=0&&fI&&(fI.disconnect(),fI=null,fL=0)}},[]);let[d,u]=(0,M.useState)(!1),[h,f]=(0,M.useState)(!1),[p,m]=(0,M.useState)(!1),[x,g]=(0,M.useState)(!1),[b,y]=(0,M.useState)(!1),[v,w]=(0,M.useState)(!1),j=td(e=>e.contact),k=td(e=>e.totalDecoded),T=td(e=>e.crystalsPerSec),C=td(e=>e.ascensions),P=td(e=>e.tech),E=td(e=>e.fragments),_=td(e=>e.achievements),R=td(e=>e.constellation??[]),A=td(e=>e.pendingPerkChoices),$=td(e=>e.crystals),D=td(e=>e.crystalCap),B=td(e=>e.activeTide),I=td(e=>e.globalTide),L=td(e=>e.energy),F=td(e=>!!e.activeExpedition&&!e.activeExpedition.finished),z=td(e=>e.chronicle?.length??0),V=td(e=>e.pendingAttrPoints??0),[H,K]=(0,M.useState)(!1);if((0,M.useEffect)(()=>{let e=!1,t=()=>{try{let t=eI(),s=eU();e||K(null!==s.completedAt&&!s.claimed&&s.dateKey===t.dateKey)}catch{e||K(!1)}};t();let s=setInterval(t,2e3);return()=>{e=!0,clearInterval(s)}},[]),(0,M.useEffect)(()=>{w(!0)},[]),!v)return(0,N.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-[#050410] text-muted-foreground",children:(0,N.jsx)("div",{className:"animate-pulse",children:"唤醒回响中…"})});let X=Object.values(P).filter(e=>e>0).length,Y=Object.values(E).filter(Boolean).length,G=Object.values(_).filter(Boolean).length,J=j>=100,Z=A&&A.length>0,Q=$>=.98*D,ee="点击中央晶体发起脉冲,累积记忆晶体";if(0===k&&$>=5?ee="右侧「待解码晶体」点击一颗晶体,开始解码":k>0&&0===X?ee="用洞见解锁技术树,提升产能":k>0&&Y<O.length&&(ee=`继续解码,拼凑记忆图谱(${Y}/${O.length}`),L>=1&&k>=3&&(ee="「探险」标签可深入遗迹,获取丰厚奖励"),C>=1&&R.length>0&&(ee=`星图天赋已觉醒 ${R.length}/18,继续飞升获取更多`),Q&&(ee="⚠ 仓库已满,产能浪费中!请解码晶体或升级仓库"),Z&&(ee="✦ 星图觉醒!点击顶部「星图」按钮选择一道天赋"),B){let e=q[B.type];ee=`${I?"🌐 全球星潮 · ":""}${e.icon} 星潮「${e.name}」进行中 \xb7 ${e.desc}`}return J&&(ee="✦ 接触进度已满,可发起飞升进入新周目"),(0,N.jsxs)("div",{className:"relative min-h-screen flex flex-col bg-[#050410] text-foreground overflow-x-hidden",children:[(0,N.jsx)(S,{className:"fixed inset-0 w-full h-full -z-10"}),(0,N.jsx)(hR,{}),(0,N.jsxs)("header",{className:"sticky top-0 z-30 px-3 sm:px-5 pt-3 pb-2",children:[(0,N.jsxs)("div",{className:"flex items-center gap-3 mb-2.5",children:[(0,N.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,N.jsxs)("div",{className:"relative h-9 w-9",children:[(0,N.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,N.jsx)("div",{className:"absolute inset-1 rounded-full bg-[#050410] flex items-center justify-center",children:(0,N.jsx)(t7,{className:"h-4 w-4 text-fuchsia-300"})})]}),(0,N.jsxs)("div",{className:"leading-tight",children:[(0,N.jsx)("h1",{className:"text-base sm:text-lg font-bold text-gradient",children:"回响星核"}),(0,N.jsx)("p",{className:"text-[9px] sm:text-[10px] text-muted-foreground/70 -mt-0.5 tracking-wider",children:"ECHO NEXUS · v0.8"})]})]}),(0,N.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[(0,N.jsx)(h_,{}),(0,N.jsxs)(t4,{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,N.jsx)(pf,{className:"h-3.5 w-3.5 mr-1"}),"巡航"]}),(0,N.jsxs)(t4,{size:"icon",variant:"ghost",onClick:()=>g(!0),className:"h-8 w-8 relative group","aria-label":"编年史",title:"回响编年史",children:[(0,N.jsx)(sl,{className:"h-4 w-4 group-hover:text-fuchsia-300 transition-colors"}),z>0&&(0,N.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:z})]}),Z&&(0,N.jsxs)(t4,{size:"sm",variant:"outline",onClick:()=>m(!0),className:"border-fuchsia-400/60 text-fuchsia-200 hover:bg-fuchsia-500/15 h-8 px-2.5 animate-pulse",children:[(0,N.jsx)(aB,{className:"h-3.5 w-3.5 mr-1"}),"觉醒"]}),J&&(0,N.jsxs)(t4,{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,N.jsx)(tm,{className:"h-3.5 w-3.5 mr-1"}),"飞升"]}),(0,N.jsx)(t4,{size:"icon",variant:"ghost",onClick:()=>f(!0),className:"h-8 w-8","aria-label":"设置",children:(0,N.jsx)(pu,{className:"h-4 w-4"})})]})]}),(0,N.jsx)(tF,{onPrestige:()=>u(!0)})]}),(0,N.jsx)("main",{className:"flex-1 px-3 sm:px-5 pb-3 min-h-0",children:(0,N.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_minmax(360px,420px)] gap-3 h-full",children:[(0,N.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,N.jsx)("div",{className:"pointer-events-none absolute -top-20 -left-20 h-60 w-60 rounded-full bg-emerald-500/10 blur-3xl"}),(0,N.jsx)("div",{className:"pointer-events-none absolute -bottom-20 -right-20 h-60 w-60 rounded-full bg-fuchsia-500/10 blur-3xl"}),(0,N.jsx)("div",{className:"pointer-events-none absolute inset-6 rounded-full border border-emerald-400/10 animate-[spin_60s_linear_infinite]"}),(0,N.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,N.jsx)("div",{className:"pointer-events-none absolute inset-16 rounded-full border border-rose-400/8"}),(0,N.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,N.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,N.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,N.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,N.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,N.jsx)("span",{className:"h-1 w-1 rounded-full bg-emerald-400 animate-pulse"}),(0,N.jsx)("span",{children:"CRYSTAL CORE · ONLINE"}),(0,N.jsx)("span",{className:"h-1 w-1 rounded-full bg-fuchsia-400 animate-pulse"})]}),(0,N.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,N.jsx)("div",{"data-tut":"crystal-orb",className:"contents",children:(0,N.jsx)(t5,{})}),(0,N.jsx)(pg,{})]}),(0,N.jsxs)("section",{className:"flex flex-col gap-3 min-h-0",children:[(0,N.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,N.jsx)(ss,{})}),(0,N.jsx)("div",{className:"glass rounded-2xl p-3 min-h-[300px] sm:min-h-[360px] max-h-[520px] flex flex-col",children:(0,N.jsxs)(po,{defaultValue:F?"expedition":Z?"constellation":"tech",className:"h-full flex flex-col",children:[(0,N.jsxs)(pl,{className:"grid grid-cols-4 sm:grid-cols-8 h-auto sm:h-9 bg-black/30 gap-0.5 p-1",children:[(0,N.jsxs)(pc,{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,N.jsx)(so,{className:"h-3.5 w-3.5"}),(0,N.jsx)("span",{className:"leading-none",children:"探险"}),L>=1&&!F&&(0,N.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"}),F&&(0,N.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,N.jsxs)(pc,{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,N.jsx)(uv,{className:"h-3.5 w-3.5"}),(0,N.jsx)("span",{className:"leading-none",children:"技术"})]}),(0,N.jsxs)(pc,{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,N.jsx)(aB,{className:"h-3.5 w-3.5"}),(0,N.jsx)("span",{className:"leading-none",children:"星图"}),Z&&(0,N.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,N.jsxs)(pc,{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,N.jsx)(sl,{className:"h-3.5 w-3.5"}),(0,N.jsx)("span",{className:"leading-none",children:"图谱"})]}),(0,N.jsxs)(pc,{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,N.jsx)(no,{className:"h-3.5 w-3.5"}),(0,N.jsx)("span",{className:"leading-none",children:"成就"}),G<W.length&&(0,N.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,N.jsxs)(pc,{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,N.jsx)(uT,{className:"h-3.5 w-3.5"}),(0,N.jsx)("span",{className:"leading-none",children:"信标"}),H&&(0,N.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,N.jsxs)(pc,{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,N.jsx)(ph,{className:"h-3.5 w-3.5"}),(0,N.jsx)("span",{className:"leading-none",children:"统计"})]}),(0,N.jsxs)(pc,{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,N.jsx)(pp,{className:"h-3.5 w-3.5"}),(0,N.jsx)("span",{className:"leading-none",children:"角色"}),V>0&&(0,N.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,N.jsx)(pd,{value:"expedition",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,N.jsx)(ni,{})}),(0,N.jsx)(pd,{value:"tech",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,N.jsx)(sh,{})}),(0,N.jsx)(pd,{value:"constellation",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,N.jsx)(ux,{})}),(0,N.jsx)(pd,{value:"codex",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,N.jsx)(s5,{})}),(0,N.jsx)(pd,{value:"ach",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,N.jsx)(nl,{})}),(0,N.jsx)(pd,{value:"beacon",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,N.jsx)(uO,{})}),(0,N.jsx)(pd,{value:"stats",className:"flex-1 mt-2 min-h-0",children:(0,N.jsx)(pb,{})}),(0,N.jsx)(pd,{value:"attributes",className:"flex-1 mt-2 min-h-0 data-[state=active]:flex data-[state=active]:flex-col",children:(0,N.jsx)(hC,{})})]})})]})]})}),(0,N.jsx)("footer",{className:"sticky bottom-0 z-20 mt-auto px-3 sm:px-5 pb-2 pt-1",children:(0,N.jsxs)("div",{className:`glass rounded-xl px-3 py-2 flex items-center gap-2 text-xs ${Q?"border-amber-400/40 animate-pulse":""} ${B?"border-white/20":""}`,style:B?{boxShadow:`inset 0 0 16px ${q[B.type].glow}`}:void 0,children:[(0,N.jsx)("span",{className:Q?"text-amber-400":B?"":"text-fuchsia-300",style:B?{color:q[B.type].color}:void 0,children:"▶"}),(0,N.jsx)("span",{className:`flex-1 truncate ${Q?"text-amber-200":"text-muted-foreground"}`,children:ee}),(0,N.jsx)("span",{className:"hidden sm:inline text-muted-foreground/60",children:"|"}),(0,N.jsxs)("span",{className:"hidden sm:inline text-muted-foreground/70",children:["产能 ",U(T),"/s"]}),(0,N.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,N.jsx)(a0,{className:"h-3.5 w-3.5"})})]})}),(0,N.jsx)(aI,{open:d,onOpenChange:u}),(0,N.jsx)(uj,{open:x,onOpenChange:g}),(0,N.jsx)(ub,{open:p,onOpenChange:m}),(0,N.jsx)(a9,{open:h,onOpenChange:f}),(0,N.jsx)(um,{}),(0,N.jsx)(hE,{}),(0,N.jsx)(uF,{}),(0,N.jsx)(uU,{}),b&&(0,N.jsx)(hj,{onClose:()=>y(!1)})]})}function pg(){let e=td(e=>e.crystalsPerSec),t=td(e=>e.pulsePower),s=td(e=>e._combo),r=td(e=>e.crystals),a=td(e=>e.crystalCap),n=s>=1?1+(s-1)*.15:1,i=s>=3,o=(a>0?r/a*100:0)>=90;return(0,N.jsxs)("div",{className:"mt-3 grid grid-cols-2 sm:grid-cols-4 gap-2 w-full max-w-md pointer-events-none",children:[(0,N.jsxs)("div",{className:"rounded-lg border border-emerald-400/30 bg-black/30 backdrop-blur p-2 flex items-center gap-1.5",children:[(0,N.jsx)(th,{className:"h-3.5 w-3.5 text-emerald-400 shrink-0"}),(0,N.jsxs)("div",{className:"min-w-0 leading-tight",children:[(0,N.jsx)("div",{className:"text-[9px] uppercase tracking-wider text-emerald-300/70 truncate",children:"晶体产能"}),(0,N.jsxs)("div",{className:"text-sm font-mono tabular-nums text-emerald-200 truncate",children:[U(e),(0,N.jsx)("span",{className:"text-[9px] text-emerald-300/60",children:"/s"})]})]})]}),(0,N.jsxs)("div",{className:"rounded-lg border border-rose-400/30 bg-black/30 backdrop-blur p-2 flex items-center gap-1.5",children:[(0,N.jsx)(ns,{className:"h-3.5 w-3.5 text-rose-400 shrink-0"}),(0,N.jsxs)("div",{className:"min-w-0 leading-tight",children:[(0,N.jsx)("div",{className:"text-[9px] uppercase tracking-wider text-rose-300/70 truncate",children:"主动脉冲"}),(0,N.jsxs)("div",{className:"text-sm font-mono tabular-nums text-rose-200 truncate",children:[U(t),s>=1&&(0,N.jsxs)("span",{className:"text-[9px] text-rose-300/80",children:[" ×",n.toFixed(2)]})]})]})]}),(0,N.jsxs)("div",{className:`rounded-lg border bg-black/30 backdrop-blur p-2 flex items-center gap-1.5 ${i?"border-amber-400/70 animate-pulse":"border-amber-400/30"}`,children:[(0,N.jsx)(uR,{className:`h-3.5 w-3.5 text-amber-400 shrink-0 ${i?"drop-shadow-[0_0_4px_rgba(251,191,36,0.7)]":""}`}),(0,N.jsxs)("div",{className:"min-w-0 leading-tight",children:[(0,N.jsx)("div",{className:"text-[9px] uppercase tracking-wider text-amber-300/70 truncate",children:"当前连击"}),(0,N.jsxs)("div",{className:`text-sm font-mono tabular-nums truncate ${i?"text-amber-200":"text-amber-300/80"}`,children:[s,(0,N.jsx)("span",{className:"text-[9px] text-amber-300/60",children:"/10"})]})]})]}),(0,N.jsxs)("div",{className:`rounded-lg border bg-black/30 backdrop-blur p-2 flex items-center gap-1.5 ${o?"border-rose-400/70 animate-pulse":"border-fuchsia-400/30"}`,children:[(0,N.jsx)(pm,{className:`h-3.5 w-3.5 shrink-0 ${o?"text-rose-400":"text-fuchsia-400"}`}),(0,N.jsxs)("div",{className:"min-w-0 leading-tight",children:[(0,N.jsx)("div",{className:`text-[9px] uppercase tracking-wider truncate ${o?"text-rose-300/80":"text-fuchsia-300/70"}`,children:"仓库容量"}),(0,N.jsxs)("div",{className:`text-sm font-mono tabular-nums truncate ${o?"text-rose-200":"text-fuchsia-200"}`,children:[U(r),(0,N.jsxs)("span",{className:`text-[9px] ${o?"text-rose-300/70":"text-fuchsia-300/60"}`,children:["/",U(a)]})]})]})]})]})}function pb(){let e=td(),t=Object.values(e.achievements).filter(Boolean).length,[s,r]=(0,M.useState)(null);(0,M.useEffect)(()=>{try{let e=ez();r(e.length>0?e[0].score:null)}catch{r(null)}},[]);let a=[{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} / ${I.length}`},{label:"已获碎片",value:`${Object.values(e.fragments).filter(Boolean).length} / ${O.length}`},{label:"已解锁成就",value:`${t} / ${W.length}`},{label:"星图天赋",value:`${e.constellation?.length??0} / ${J.length}`},{label:"接触进度",value:`${e.contact.toFixed(1)}%`},{label:"晶体产能",value:`${e.crystalsPerSec.toFixed(2)} /s`},{label:"仓库上限",value:`${U(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!==s?U(s):"—"},{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,N.jsx)("div",{className:"grid grid-cols-2 gap-1.5 text-xs",children:a.map(e=>(0,N.jsxs)("div",{className:"flex items-center justify-between rounded-md bg-black/25 border border-white/5 px-2 py-1.5",children:[(0,N.jsx)("span",{className:"text-muted-foreground",children:e.label}),(0,N.jsx)("span",{className:"font-mono text-foreground",children:e.value})]},e.label))})}e.s(["default",()=>px],52683)}]);