sigurd-startup 2.2.5 → 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -238,7 +238,7 @@ Check the render method of %s.`,bt(Cr)||"Unknown"));var b=ks(p,g);b.payload={ele
238
238
 
239
239
  let root = createRoot(domContainer);
240
240
  root.render(<App />);`),t.unstable_strictMode===!0&&(i=!0),t.identifierPrefix!==void 0&&(u=t.identifierPrefix),t.onRecoverableError!==void 0&&(p=t.onRecoverableError),t.transitionCallbacks!==void 0&&t.transitionCallbacks);var g=Q1(e,jg,null,i,o,u,p);Dg(g.current,e);var w=e.nodeType===Xn?e.parentNode:e;return Ph(w),new Vb(g)}function Gy(e){this._internalRoot=e}function RP(e){e&&tg(e)}Gy.prototype.unstable_scheduleHydration=RP;function MP(e,t,i){if(!Yy(e))throw new Error("hydrateRoot(...): Target container is not a DOM element.");yR(e),t===void 0&&v("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var o=i??null,u=i!=null&&i.hydratedSources||null,p=!1,g=!1,w="",b=gR;i!=null&&(i.unstable_strictMode===!0&&(p=!0),i.identifierPrefix!==void 0&&(w=i.identifierPrefix),i.onRecoverableError!==void 0&&(b=i.onRecoverableError));var M=q1(t,null,e,jg,o,p,g,w,b);if(Dg(M.current,e),Ph(e),u)for(var O=0;O<u.length;O++){var B=u[O];OD(M,B)}return new Gy(M)}function Yy(e){return!!(e&&(e.nodeType===pa||e.nodeType===xo||e.nodeType===Up))}function Av(e){return!!(e&&(e.nodeType===pa||e.nodeType===xo||e.nodeType===Up||e.nodeType===Xn&&e.nodeValue===" react-mount-point-unstable "))}function yR(e){e.nodeType===pa&&e.tagName&&e.tagName.toUpperCase()==="BODY"&&v("createRoot(): Creating roots directly with document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try using a container element created for your app."),Yh(e)&&(e._reactRootContainer?v("You are calling ReactDOMClient.createRoot() on a container that was previously passed to ReactDOM.render(). This is not supported."):v("You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it."))}var kP=l.ReactCurrentOwner,SR;SR=function(e){if(e._reactRootContainer&&e.nodeType!==Xn){var t=J1(e._reactRootContainer.current);t&&t.parentNode!==e&&v("render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.")}var i=!!e._reactRootContainer,o=$b(e),u=!!(o&&Eu(o));u&&!i&&v("render(...): Replacing React-rendered children with a new root component. If you intended to update the children of this node, you should instead have the existing children update their state and render the new components instead of calling ReactDOM.render."),e.nodeType===pa&&e.tagName&&e.tagName.toUpperCase()==="BODY"&&v("render(): Rendering components directly into document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try rendering into a container element created for your app.")};function $b(e){return e?e.nodeType===xo?e.documentElement:e.firstChild:null}function wR(){}function _P(e,t,i,o,u){if(u){if(typeof o=="function"){var p=o;o=function(){var F=$y(g);p.call(F)}}var g=q1(t,o,e,Ru,null,!1,!1,"",wR);e._reactRootContainer=g,Dg(g.current,e);var w=e.nodeType===Xn?e.parentNode:e;return Ph(w),Ns(),g}else{for(var b;b=e.lastChild;)e.removeChild(b);if(typeof o=="function"){var M=o;o=function(){var F=$y(O);M.call(F)}}var O=Q1(e,Ru,null,!1,!1,"",wR);e._reactRootContainer=O,Dg(O.current,e);var B=e.nodeType===Xn?e.parentNode:e;return Ph(B),Ns(function(){_v(t,O,i,o)}),O}}function AP(e,t){e!==null&&typeof e!="function"&&v("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",t,e)}function Wy(e,t,i,o,u){SR(i),AP(u===void 0?null:u,"render");var p=i._reactRootContainer,g;if(!p)g=_P(i,t,e,u,o);else{if(g=p,typeof u=="function"){var w=u;u=function(){var b=$y(g);w.call(b)}}_v(t,g,e,u)}return $y(g)}var bR=!1;function OP(e){{bR||(bR=!0,v("findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node"));var t=kP.current;if(t!==null&&t.stateNode!==null){var i=t.stateNode._warnedAboutRefsInRender;i||v("%s is accessing findDOMNode inside its render(). render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.",Kt(t.type)||"A component"),t.stateNode._warnedAboutRefsInRender=!0}}return e==null?null:e.nodeType===pa?e:vP(e,"findDOMNode")}function NP(e,t,i){if(v("ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!Av(t))throw new Error("Target container is not a DOM element.");{var o=Yh(t)&&t._reactRootContainer===void 0;o&&v("You are calling ReactDOM.hydrate() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call hydrateRoot(container, element)?")}return Wy(null,e,t,!0,i)}function DP(e,t,i){if(v("ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!Av(t))throw new Error("Target container is not a DOM element.");{var o=Yh(t)&&t._reactRootContainer===void 0;o&&v("You are calling ReactDOM.render() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.render(element)?")}return Wy(null,e,t,!1,i)}function LP(e,t,i,o){if(v("ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported in React 18. Consider using a portal instead. Until you switch to the createRoot API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot"),!Av(i))throw new Error("Target container is not a DOM element.");if(e==null||!B0(e))throw new Error("parentComponent must be a valid React Component");return Wy(e,t,i,!1,o)}var xR=!1;function PP(e){if(xR||(xR=!0,v("unmountComponentAtNode is deprecated and will be removed in the next major release. Switch to the createRoot API. Learn more: https://reactjs.org/link/switch-to-createroot")),!Av(e))throw new Error("unmountComponentAtNode(...): Target container is not a DOM element.");{var t=Yh(e)&&e._reactRootContainer===void 0;t&&v("You are calling ReactDOM.unmountComponentAtNode() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?")}if(e._reactRootContainer){{var i=$b(e),o=i&&!Eu(i);o&&v("unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React.")}return Ns(function(){Wy(null,null,e,!1,function(){e._reactRootContainer=null,gE(e)})}),!0}else{{var u=$b(e),p=!!(u&&Eu(u)),g=e.nodeType===pa&&Av(e.parentNode)&&!!e.parentNode._reactRootContainer;p&&v("unmountComponentAtNode(): The node you're attempting to unmount was rendered by React and is not a top-level container. %s",g?"You may have accidentally passed in a React root node instead of its container.":"Instead, have the parent component update its state and rerender in order to remove this component.")}return!1}}Hr(mP),vu(gP),qm(yP),Dc(ii),yh(Xm),(typeof Map!="function"||Map.prototype==null||typeof Map.prototype.forEach!="function"||typeof Set!="function"||Set.prototype==null||typeof Set.prototype.clear!="function"||typeof Set.prototype.forEach!="function")&&v("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),If(UO),j0(bb,ML,Ns);function IP(e,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;if(!Yy(t))throw new Error("Target container is not a DOM element.");return hP(e,t,null,i)}function UP(e,t,i,o){return LP(e,t,i,o)}var Gb={usingClientEntryPoint:!1,Events:[Eu,zd,Lg,au,Uf,bb]};function zP(e,t){return Gb.usingClientEntryPoint||v('You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".'),TP(e,t)}function FP(e,t,i){return Gb.usingClientEntryPoint||v('You are importing hydrateRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".'),MP(e,t,i)}function jP(e){return _1()&&v("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task."),Ns(e)}var BP=EP({findFiberByHostInstance:Wc,bundleType:1,version:zb,rendererPackageName:"react-dom"});if(!BP&&gn&&window.top===window.self&&(navigator.userAgent.indexOf("Chrome")>-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)){var CR=window.location.protocol;/^(https?|file):$/.test(CR)&&console.info("%cDownload the React DevTools for a better development experience: https://reactjs.org/link/react-devtools"+(CR==="file:"?`
241
- You might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq`:""),"font-weight:bold")}Ga.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Gb,Ga.createPortal=IP,Ga.createRoot=zP,Ga.findDOMNode=OP,Ga.flushSync=jP,Ga.hydrate=NP,Ga.hydrateRoot=FP,Ga.render=DP,Ga.unmountComponentAtNode=PP,Ga.unstable_batchedUpdates=bb,Ga.unstable_renderSubtreeIntoContainer=UP,Ga.version=zb,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ga}function rx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(process.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rx)}catch(c){console.error(c)}}}process.env.NODE_ENV==="production"?(rx(),Ky.exports=AR()):Ky.exports=OR();var Zy=Ky.exports,hp=Zy;if(process.env.NODE_ENV==="production")pp.createRoot=hp.createRoot,pp.hydrateRoot=hp.hydrateRoot;else{var Lv=hp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;pp.createRoot=function(c,a){Lv.usingClientEntryPoint=!0;try{return hp.createRoot(c,a)}finally{Lv.usingClientEntryPoint=!1}},pp.hydrateRoot=function(c,a,l){Lv.usingClientEntryPoint=!0;try{return hp.hydrateRoot(c,a,l)}finally{Lv.usingClientEntryPoint=!1}}}var Q=fp();const Pv=cf(Q),ax=di({__proto__:null,default:Pv},[Q]),ix=c=>{let a;const l=new Set,f=(R,A)=>{const k=typeof R=="function"?R(a):R;if(!Object.is(k,a)){const _=a;a=A??(typeof k!="object"||k===null)?k:Object.assign({},a,k),l.forEach(N=>N(a,_))}},h=()=>a,C={setState:f,getState:h,getInitialState:()=>x,subscribe:R=>(l.add(R),()=>l.delete(R))},x=a=c(f,h,C);return C},NR=c=>c?ix(c):ix,DR=c=>c;function LR(c,a=DR){const l=Pv.useSyncExternalStore(c.subscribe,()=>a(c.getState()),()=>a(c.getInitialState()));return Pv.useDebugValue(l),l}const ox=c=>{const a=NR(c),l=f=>LR(a,f);return Object.assign(l,a),l},PR=c=>c?ox(c):ox,H={CANVAS_WIDTH:800,CANVAS_HEIGHT:600,PLAYER_HEIGHT:35,PLAYER_WIDTH:25,BOMB_SIZE:25,MONSTER_SIZE:25,PLATFORM_HEIGHT:25,COIN_SIZE:25,USE_SPRITES:!0,PARALLAX_ENABLED:!0,GRAVITY:.3,FLOAT_GRAVITY:.005,MOVE_SPEED:4,JUMP_POWER:8,SUPER_JUMP_POWER:12,COIN_BOUNCE_SPEED:3,COIN_BOUNCE_DAMPING:.8,COIN_GRAVITY:.1,MIN_JUMP_DURATION:50,MAX_JUMP_DURATION:300,TOTAL_BOMBS:23,STARTING_LIVES:3,POWER_COIN_SPAWN_INTERVAL:9,BONUS_COIN_SPAWN_INTERVAL:5e3,EXTRA_LIFE_COIN_RATIO:10,POWER_COIN_DURATION:7e3,POWER_COIN_POINTS:2e3,MONSTER_KILL_POINTS:100,BONUS_MULTIPLIER_COIN_POINTS:1e3,EXTRA_LIFE_COIN_POINTS:1e3,MULTIPLIER_THRESHOLDS:{1:0,2:1800,3:3600,4:5400,5:7200},MAX_MULTIPLIER:5,BOMB_POINTS:{NORMAL:100,FIREBOMB:200},BONUS_POINTS:{23:5e4,22:3e4,21:2e4,20:1e4}},lx={masterVolume:80,musicVolume:70,sfxVolume:90,masterMuted:!1,musicMuted:!1,sfxMuted:!1},Ya={ENABLED:!1,TARGET_STATE:"PLAYING",TARGET_LEVEL:6,MOCK_DATA:{score:15e3,lives:2,correctOrderCount:18,multiplier:2,multiplierScore:2600}};typeof window<"u"&&(window.__DEV_LOGGING_ENABLED__=Ya.ENABLED);const rr={PLAYER:"#00FF00",BOMB:"#FFD700",BOMB_NEXT:"#FF0000",MONSTER:"#FF4444",MONSTER_FROZEN:"#4444FF",MONSTER_HORIZONTAL_PATROL:"#FF4444",MONSTER_VERTICAL_PATROL:"#44FF44",MONSTER_CHASER:"#FF8844",MONSTER_AMBUSHER:"#8844FF",MONSTER_FLOATER:"#44FFFF",PLATFORM:"#484744",BACKGROUND:"#262521"},sx=()=>({x:H.CANVAS_WIDTH/2,y:H.CANVAS_HEIGHT-100,width:H.PLAYER_WIDTH,height:H.PLAYER_HEIGHT,color:rr.PLAYER,velocityX:0,velocityY:0,isGrounded:!1,isFloating:!1,isJumping:!1,jumpStartTime:0,moveSpeed:H.MOVE_SPEED,jumpPower:H.JUMP_POWER,gravity:H.GRAVITY,floatGravity:H.FLOAT_GRAVITY}),IR=(c,a)=>({player:sx(),updatePlayer:l=>{c({player:{...a().player,...l}})},resetPlayer:()=>{c({player:sx()})},setPlayerPosition:(l,f)=>{c({player:{...a().player,x:l,y:f,velocityX:0,velocityY:0,isGrounded:!1,isFloating:!1,isJumping:!1,jumpStartTime:0}})}});var ot=(c=>(c.MENU="MENU",c.COUNTDOWN="COUNTDOWN",c.PLAYING="PLAYING",c.PAUSED="PAUSED",c.BONUS="BONUS",c.VICTORY="VICTORY",c.GAME_OVER="GAME_OVER",c.MAP_CLEARED="MAP_CLEARED",c))(ot||{}),Pt=(c=>(c.START="START",c.COUNTDOWN="COUNTDOWN",c.IN_GAME="IN_GAME",c.PAUSE="PAUSE",c.SETTINGS="SETTINGS",c.BONUS="BONUS",c.VICTORY="VICTORY",c.GAME_OVER="GAME_OVER",c.AUDIO_SETTINGS="AUDIO_SETTINGS",c))(Pt||{}),kn=(c=>(c.HORIZONTAL_PATROL="HORIZONTAL_PATROL",c.VERTICAL_PATROL="VERTICAL_PATROL",c.CHASER="CHASER",c.AMBUSHER="AMBUSHER",c.FLOATER="FLOATER",c))(kn||{}),It=(c=>(c.POWER="POWER",c.BONUS_MULTIPLIER="BONUS_MULTIPLIER",c.EXTRA_LIFE="EXTRA_LIFE",c.MONSTER_FREEZE="MONSTER_FREEZE",c))(It||{}),ua=(c=>(c.GAME_START="GAME_START",c.LEVEL_COMPLETE="LEVEL_COMPLETE",c.PLAYER_DEATH="PLAYER_DEATH",c.GAME_OVER="GAME_OVER",c.BONUS_SCREEN="BONUS_SCREEN",c.BOMB_COLLECT="BOMB_COLLECT",c.MAP_CLEARED="MAP_CLEARED",c.BACKGROUND_MUSIC="BACKGROUND_MUSIC",c.MONSTER_HIT="MONSTER_HIT",c.COIN_COLLECT="COIN_COLLECT",c.POWER_COIN_ACTIVATE="POWER_COIN_ACTIVATE",c))(ua||{});class UR{constructor(a=2){be(this,"logLevel",2);be(this,"lastLogTime",new Map);be(this,"logThrottle",new Map);switch("dataPassing".toLowerCase()){case"error":this.logLevel=0;break;case"warn":this.logLevel=1;break;case"info":this.logLevel=2;break;case"debug":this.logLevel=3;break;case"trace":this.logLevel=4;break;case"datapassing":this.logLevel=5;break;default:this.logLevel=a}}setLogLevel(a){this.logLevel=a}shouldLog(a,l=1e3){const f=Date.now(),h=this.lastLogTime.get(a)||0;return f-h>=l?(this.lastLogTime.set(a,f),!0):!1}game(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🎮 ${a}`,...l)}flow(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🌊 ${a}`,...l)}player(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`👤 ${a}`,...l)}monster(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`👹 ${a}`,...l)}coin(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🪙 ${a}`,...l)}bomb(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`💣 ${a}`,...l)}power(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`⚡ ${a}`,...l)}dataPassing(a,...l){this.logLevel===5&&console.log(`📡 ${a}`,...l)}pause(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&this.shouldLog("pause",500)&&console.log(`⏸️ ${a}`,...l)}scaling(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&this.shouldLog("scaling",2e3)&&console.log(`📈 ${a}`,...l)}debug(a,...l){(this.logLevel===3||this.logLevel===4)&&console.log(`🔧 ${a}`,...l)}audio(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🎵 ${a}`,...l)}error(a,...l){this.logLevel>=0&&console.error(`❌ ${a}`,...l)}warn(a,...l){this.logLevel>=1&&console.warn(`⚠️ ${a}`,...l)}info(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`ℹ️ ${a}`,...l)}trace(a,...l){this.logLevel===4&&console.log(`🔍 ${a}`,...l)}dev(a,...l){}score(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`📊 ${a}`,...l)}clearThrottle(){this.lastLogTime.clear()}disable(){this.logLevel=0}enable(){this.logLevel=2}setLevel(a){this.logLevel=a}}const Ge=new UR,Pe={error:(c,...a)=>Ge.error(c,...a),warn:(c,...a)=>Ge.warn(c,...a),info:(c,...a)=>Ge.info(c,...a),debug:(c,...a)=>Ge.debug(c,...a),trace:(c,...a)=>Ge.trace(c,...a),game:(c,...a)=>Ge.game(c,...a),dev:(c,...a)=>Ge.dev(c,...a),audio:(c,...a)=>Ge.audio(c,...a),coin:(c,...a)=>Ge.coin(c,...a),bomb:(c,...a)=>Ge.bomb(c,...a),score:(c,...a)=>Ge.score(c,...a),dataPassing:(c,...a)=>Ge.dataPassing(c,...a)},zR=(c,a,l,f,h)=>{const y={score:c,map:a,timestamp:Date.now(),level:l,lives:f,multiplier:h};Pe.dataPassing("Sending score to host:",y);const v=new CustomEvent("scoreUpdate",{detail:{score:c},bubbles:!0,composed:!0});window.dispatchEvent(v);const C=new CustomEvent("game:score-updated",{detail:y,bubbles:!0,composed:!0});window.dispatchEvent(C)},FR=()=>{Pe.dataPassing("Game ready signal sent to host");const c=new CustomEvent("game:ready",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0});window.dispatchEvent(c)},Iv=(c,a)=>{Pe.dataPassing("Game state update sent to host:",{state:c,map:a});const l=new CustomEvent("game:state-updated",{detail:{state:c,map:a,timestamp:Date.now()},bubbles:!0,composed:!0});window.dispatchEvent(l)},ux=c=>{Pe.dataPassing("Sending map completion data to host:",c);const a=new CustomEvent("game:map-completed",{detail:c,bubbles:!0,composed:!0});window.dispatchEvent(a)},jR=c=>{Pe.dataPassing("Sending game completion data to host:",c);const a=new CustomEvent("game:completed",{detail:c,bubbles:!0,composed:!0});window.dispatchEvent(a)},BR=(c,a,l,f,h,y,v)=>{const C=c.reduce((N,z)=>N+z.totalBombs,0),x=c.reduce((N,z)=>N+z.correctOrderCount,0),R=c.reduce((N,z)=>N+z.coinsCollected,0),A=c.reduce((N,z)=>N+z.powerModeActivations,0),k=v-y,_=c.length>0?k/c.length/1e3:0;return{totalBombs:C,totalCorrectOrders:x,totalCoinsCollected:R,totalPowerModeActivations:A,averageCompletionTime:Math.round(_),totalPlayTime:Math.round(k/1e3)}},HR=c=>{switch(c){case kn.HORIZONTAL_PATROL:return rr.MONSTER_HORIZONTAL_PATROL;case kn.VERTICAL_PATROL:return rr.MONSTER_VERTICAL_PATROL;case kn.CHASER:return rr.MONSTER_CHASER;case kn.AMBUSHER:return rr.MONSTER_AMBUSHER;case kn.FLOATER:return rr.MONSTER_FLOATER;default:return rr.MONSTER}},vp=(c,a,l,f=1,h=0)=>({x:c,y:a,width:H.MONSTER_SIZE,height:H.MONSTER_SIZE,color:HR(l),type:l,speed:f,direction:1,isActive:!0,spawnDelay:h}),pi=(c,a,l,f="left",h=1,y=1,v,C=0)=>{const x=f==="left"?c:c+l-H.MONSTER_SIZE,R=a-H.MONSTER_SIZE,A=f==="left"?1:-1;return{...vp(x,R,kn.HORIZONTAL_PATROL,y,C),patrolStartX:c,patrolEndX:c+l,direction:A,walkLengths:h}},Ps=(c,a,l,f="left",h=1,y=1,v=0)=>{const C=f==="left"?c-H.MONSTER_SIZE:c+15;return{...vp(C,a,kn.VERTICAL_PATROL,h,v),patrolStartY:a,patrolEndY:a+l,direction:y,patrolSide:f,targetPlatformX:c}},Is=(c,a,l=45,f=1,h=0)=>({...vp(c,a,kn.FLOATER,f,h),startAngle:l,spawnTime:Date.now()}),ff=(c,a,l=.8,f=.2,h=200,y=0)=>({...vp(c,a,kn.CHASER,l,y),direction:0,directness:f,chaseUpdateInterval:h}),df=(c,a,l=.8,f=8e3,h=0)=>({...vp(c,a,kn.AMBUSHER,l,h),ambushCooldown:0}),ne=(c,a,l,f)=>({x:c,y:a,width:H.BOMB_SIZE,height:H.BOMB_SIZE,order:l,group:f,isCollected:!1,isBlinking:!1}),Vt=(c,a,l,f=rr.PLATFORM,h="#000")=>({x:c,y:a,width:l.width,height:l.height,borderColor:h,color:f}),pf=(c,a,l,f=rr.PLATFORM,h="#000")=>({x:c,y:a,width:15,height:l,borderColor:h,color:f,isVertical:!0}),Us=c=>(H.CANVAS_WIDTH-c)/2,zs=c=>(H.CANVAS_HEIGHT-c)/2,hf=(c,a)=>({x:Us(c),y:zs(a)}),VR={id:"level1",name:"startup lab",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#00ffff",groupSequence:[1,2,3,4,5],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#88a2bc"},platforms:[pf(96,220,150,"#abccee","#4f6a8f"),pf(684,220,150,"#abccee","#4f6a8f"),Vt(95,450,{width:200,height:15},"#abccee","#4f6a8f"),Vt(480,150,{width:200,height:15},"#abccee","#4f6a8f"),Vt(430,430,{width:200,height:15},"#abccee","#4f6a8f"),Vt(170,170,{width:200,height:15},"#abccee","#4f6a8f")],bombs:[ne(440,400,1,1),ne(490,400,2,1),ne(540,400,3,1),ne(590,400,4,1),ne(180,140,5,2),ne(230,140,6,2),ne(280,140,7,2),ne(330,140,8,2),ne(710,230,9,3),ne(710,280,10,3),ne(710,330,11,3),ne(130,470,12,4),ne(180,470,13,4),ne(230,470,14,4),ne(520,70,15,5),ne(570,70,16,5),ne(620,70,17,5),ne(120,230,18,6),ne(120,280,19,6),ne(120,330,20,6),ne(130,420,21,7),ne(180,420,22,7),ne(230,420,23,7)],coinSpawnPoints:[{x:Us(H.COIN_SIZE),y:zs(H.COIN_SIZE),type:It.POWER,spawnAngle:45},{x:570,y:50,type:It.POWER,spawnAngle:135},{x:200,y:75,type:It.BONUS_MULTIPLIER},{x:200,y:75,type:It.BONUS_MULTIPLIER},{x:200,y:75,type:It.EXTRA_LIFE},{x:200,y:75,type:It.EXTRA_LIFE}],monsterSpawnPoints:[{spawnDelay:4e3,createMonster:()=>pi(430,430,200,"left",1,1)},{spawnDelay:5e3,createMonster:()=>df(500,500,1)}],monsters:[Ps(105,220,220,"right"),Ps(695,220,220,"right",2,1),pi(170,170,200,"left"),ff(250,300,1,.3,1e3)]},$R={id:"level2",name:"innovasjon norge",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#ff6b6b",groupSequence:[1,2,3,4,5],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#262335"},platforms:[Vt(165,475,{width:150,height:15},"#d4896a","#262335"),Vt(485,475,{width:150,height:15},"#d4896a","#262335"),Vt(300,380,{width:200,height:15},"#d4896a","#262335"),Vt(300,240,{width:200,height:15},"#d4896a","#262335"),Vt(165,130,{width:150,height:15},"#d4896a","#262335"),Vt(485,130,{width:150,height:15},"#d4896a","#262335")],bombs:[ne(600,95,1,1),ne(550,95,2,1),ne(500,95,3,1),ne(180,440,4,2),ne(230,440,5,2),ne(280,440,6,2),ne(280,95,7,3),ne(230,95,8,3),ne(180,95,9,3),ne(600,440,10,4),ne(550,440,11,4),ne(500,440,12,4),ne(385,70,13,5),ne(385,120,14,5),ne(385,170,15,5),ne(500,500,16,6),ne(550,500,17,6),ne(600,500,18,6),ne(180,500,19,7),ne(230,500,20,7),ne(280,500,21,7),ne(360,345,22,8),ne(410,345,23,8)],coinSpawnPoints:[{x:400,y:H.CANVAS_HEIGHT-150,type:It.POWER,spawnAngle:60},{x:400,y:H.CANVAS_HEIGHT-250,type:It.POWER,spawnAngle:120},{x:520,y:100,type:It.BONUS_MULTIPLIER,spawnAngle:120},{x:180,y:100,type:It.BONUS_MULTIPLIER,spawnAngle:120},{x:520,y:100,type:It.EXTRA_LIFE,spawnAngle:120},{x:180,y:100,type:It.EXTRA_LIFE,spawnAngle:120}],monsterSpawnPoints:[{spawnDelay:7e3,createMonster:()=>ff(750,500,1)},{spawnDelay:15e3,createMonster:()=>df(50,500,1)}],monsters:[pi(165,130,150,"left",0,.7),pi(485,130,150,"right",0,1),pi(300,240,200,"left",0,1),Is(50,300,45,1),Is(750,500,155,1)]},GR={id:"level3",name:"skatteetaten",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#4ecdc4",groupSequence:[1,2,3,4,5,6,7],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#3c4c56"},platforms:[Vt(150,490,{width:500,height:15},"#acc7d0","#556d7b"),Vt(100,400,{width:200,height:15},"#acc7d0","#556d7b"),Vt(500,400,{width:200,height:15},"#acc7d0","#556d7b"),Vt(100,250,{width:200,height:15},"#acc7d0","#556d7b"),Vt(500,250,{width:200,height:15},"#acc7d0","#556d7b"),Vt(150,130,{width:500,height:15},"#acc7d0","#556d7b")],bombs:[ne(540,275,1,1),ne(590,275,2,1),ne(640,275,3,1),ne(240,275,4,2),ne(190,275,5,2),ne(140,275,6,2),ne(325,515,7,3),ne(375,515,8,3),ne(425,515,9,3),ne(760,360,10,4),ne(760,310,11,4),ne(760,260,12,4),ne(15,360,13,5),ne(15,310,14,5),ne(15,260,15,5),ne(325,155,16,6),ne(375,155,17,6),ne(425,155,18,6),ne(375,205,19,6),ne(375,255,20,6),ne(580,455,21,7),ne(195,455,22,7),ne(375,95,23,7)],coinSpawnPoints:[],monsters:[pi(150,490,500,"left",0,1),pi(150,130,500,"left",0,1),pi(150,130,500,"right",0,1),pi(100,400,200,"right",0,1),pi(500,400,200,"left",0,1),ff(200,200,1,.1,500)],monsterSpawnPoints:[{spawnDelay:3e3,createMonster:()=>Is(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE),150,1)},{spawnDelay:6e3,createMonster:()=>Is(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE),50,1)},{spawnDelay:5e3,createMonster:()=>df(50,550,1,8e3)}]},YR={id:"level4",name:"nav",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#ffe66d",groupSequence:[1,2,3,4,5],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#586c5c"},platforms:[Vt(580,500,{width:150,height:15},"#586c5c","#202e32"),Vt(580,445,{width:150,height:15},"#586c5c","#202e32"),pf(500,245,150,"#586c5c","#202e32"),pf(555,245,150,"#586c5c","#202e32"),Vt(90,45,{width:150,height:15},"#586c5c","#202e32"),Vt(90,100,{width:150,height:15},"#586c5c","#202e32"),pf(240,160,150,"#586c5c","#202e32"),pf(295,160,150,"#586c5c","#202e32"),Vt(90,500,{width:200,height:15},"#586c5c","#202e32"),Vt(235,400,{width:150,height:15},"#586c5c","#202e32"),Vt(415,145,{width:150,height:15},"#586c5c","#202e32"),Vt(530,45,{width:200,height:15},"#586c5c","#202e32")],bombs:[ne(595,467,1,1),ne(645,467,2,1),ne(695,467,3,1),ne(522,255,4,2),ne(522,305,5,2),ne(522,355,6,2),ne(130,467,7,3),ne(180,467,8,3),ne(230,467,9,3),ne(250,367,10,4),ne(300,367,11,4),ne(350,367,12,4),ne(263,170,13,5),ne(263,220,14,5),ne(263,270,15,5),ne(100,67,16,6),ne(150,67,17,6),ne(200,67,18,6),ne(430,113,19,7),ne(480,113,20,7),ne(530,113,21,7),ne(630,68,22,8),ne(680,68,23,8)],coinSpawnPoints:[],monsterSpawnPoints:[{spawnDelay:4e3,createMonster:()=>Is(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE),65,1)},{spawnDelay:6e3,createMonster:()=>Is(240,350,40,1)},{spawnDelay:2e3,createMonster:()=>df(50,50,1.2,8e3)},{spawnDelay:4e3,createMonster:()=>df(50,50,1.2,8e3)},{spawnDelay:4e3,createMonster:()=>ff(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE),3,.5)},{spawnDelay:9e3,createMonster:()=>ff(590,400,3,.5)}],monsters:[Ps(500,170,350,"right"),Ps(240,60,340,"right"),pi(90,500,200,"left"),pi(90,45,150,"right")]},WR={id:"level5",name:"kommunehuset",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#a8e6cf",groupSequence:[1,2,3,4,5,6],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#8d4fc9"},platforms:[Vt(375,300,{width:50,height:15},"#ff4700","#631b09"),Vt(88,300,{width:50,height:15},"#ff4700","#631b09"),Vt(667,300,{width:50,height:15},"#ff4700","#631b09")],bombs:[ne(150,60,1,1),ne(100,60,2,1),ne(50,60,3,1),ne(625,60,4,2),ne(675,60,5,2),ne(725,60,6,2),ne(150,525,7,3),ne(100,525,8,3),ne(50,525,9,3),ne(625,525,10,4),ne(675,525,11,4),ne(725,525,12,4),ne(438,100,13,5),ne(388,100,14,5),ne(338,100,15,5),ne(338,525,16,6),ne(388,525,17,6),ne(438,525,18,6),ne(388,330,19,6),ne(388,380,20,6),ne(388,430,21,6),ne(101,270,22,7),ne(680,270,23,7)],monsters:[Ps(520,200,350,"right"),Ps(225,200,350,"right"),Ps(520,20,350,"right"),Ps(225,20,350,"right"),pi(0,550,800,"left")],monsterSpawnPoints:[{spawnDelay:5e3,createMonster:()=>df(700,150)},{spawnDelay:7e3,createMonster:()=>Is(100,150)},{spawnDelay:1e4,createMonster:()=>ff(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE+200))},{spawnDelay:15e3,createMonster:()=>Is(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE-200))}],coinSpawnPoints:[{x:400,y:500,type:It.POWER,spawnAngle:46},{x:500,y:200,type:It.POWER,spawnAngle:45},{x:388,y:50,type:It.BONUS_MULTIPLIER},{x:388,y:50,type:It.EXTRA_LIFE},{x:101,y:50,type:It.BONUS_MULTIPLIER},{x:101,y:50,type:It.EXTRA_LIFE},{x:680,y:50,type:It.BONUS_MULTIPLIER},{x:680,y:50,type:It.EXTRA_LIFE}]};Vt(200,H.CANVAS_HEIGHT-120,{width:200,height:15},"#ebb185"),Vt(600,H.CANVAS_HEIGHT-110,{width:200,height:15},"#ebb185"),Vt(100,H.CANVAS_HEIGHT-180,{width:200,height:15},"#ebb185"),Vt(700,H.CANVAS_HEIGHT-180,{width:200,height:15},"#ebb185"),Vt(300,H.CANVAS_HEIGHT-240,{width:200,height:15},"#ebb185"),Vt(500,H.CANVAS_HEIGHT-240,{width:200,height:15},"#ebb185"),Vt(150,H.CANVAS_HEIGHT-300,{width:200,height:15},"#ebb185"),Vt(650,H.CANVAS_HEIGHT-300,{width:200,height:15},"#ebb185"),Vt(400,H.CANVAS_HEIGHT-370,{width:200,height:15},"#ebb185"),Vt(250,H.CANVAS_HEIGHT-420,{width:200,height:15},"#ebb185"),Vt(550,H.CANVAS_HEIGHT-420,{width:200,height:15},"#ebb185"),H.CANVAS_HEIGHT-70,H.MONSTER_SIZE,H.MONSTER_SIZE,rr.MONSTER,kn.HORIZONTAL_PATROL,H.CANVAS_HEIGHT-130,H.MONSTER_SIZE,H.MONSTER_SIZE,rr.MONSTER,kn.HORIZONTAL_PATROL,H.CANVAS_HEIGHT-170,H.MONSTER_SIZE,H.MONSTER_SIZE,rr.MONSTER,kn.HORIZONTAL_PATROL,H.CANVAS_HEIGHT-290,H.MONSTER_SIZE,H.MONSTER_SIZE,rr.MONSTER,kn.HORIZONTAL_PATROL,H.CANVAS_HEIGHT-350,H.MONSTER_SIZE,H.MONSTER_SIZE,rr.MONSTER,kn.HORIZONTAL_PATROL,H.CANVAS_HEIGHT-100,It.POWER,H.CANVAS_HEIGHT-140,It.POWER;const XR={id:"level7",name:"silicone vally",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#feca57",groupSequence:[1,2,3,4,5],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#46474c"},platforms:[],bombs:[ne(440,530,1,1),ne(490,530,2,1),ne(540,530,3,1),ne(590,530,4,1),ne(760,530,5,2),ne(760,480,6,2),ne(760,430,7,2),ne(760,380,8,2),ne(590,330,9,3),ne(540,330,10,3),ne(490,330,11,3),ne(440,330,12,3),ne(290,530,13,4),ne(240,530,14,4),ne(190,530,15,4),ne(140,530,16,4),ne(15,530,17,5),ne(15,480,18,5),ne(15,430,19,5),ne(15,380,20,5),ne(190,330,21,6),ne(240,330,22,6),ne(290,330,23,6)],coinSpawnPoints:[],monsterSpawnPoints:[],monsters:[]},vf=[VR,$R,GR,YR,WR,XR],KR=(c,a)=>(Pe.info(`Initializing game state slice with ${H.STARTING_LIVES} lives`),{currentState:ot.MENU,score:0,levelScore:0,lives:H.STARTING_LIVES,currentLevel:1,showMenu:Pt.START,previousMenu:null,isPaused:!1,bonusAnimationComplete:!1,setState:l=>{c({currentState:l,isPaused:l===ot.PAUSED}),l===ot.MENU?c({showMenu:Pt.START}):l===ot.PLAYING&&c({showMenu:Pt.IN_GAME});const f=a(),h="currentMap"in f?f.currentMap:void 0;Iv(l,h?.name)},setMenuType:l=>{const f=a();l===Pt.SETTINGS?c({showMenu:l,previousMenu:f.showMenu}):c({showMenu:l})},setBonusAnimationComplete:l=>{c({bonusAnimationComplete:l})},loseLife:()=>{const{lives:l}=a(),f=l-1;Pe.info(`Losing life: ${l} → ${f}`),c({lives:f});const h=a(),y="currentMap"in h?h.currentMap:void 0;if(Iv(ot.PLAYING,y?.name),f<=0){Pe.info(`GAME OVER triggered at ${f} lives`),c({currentState:ot.GAME_OVER,showMenu:Pt.GAME_OVER});const v="currentMap"in h?h.currentMap:void 0;Iv(ot.GAME_OVER,v?.name);const C="getLevelResults"in h?h.getLevelResults():[],x="multiplier"in h?h.multiplier:1,R="getGameStartTime"in h?h.getGameStartTime():Date.now(),A="getSessionId"in h?h.getSessionId():`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,k=BR(C,a().score,f,x,"failed",R,Date.now()),_={finalScore:a().score,totalLevels:vf.length,completedLevels:C.length,timestamp:Date.now(),lives:f,multiplier:x,levelHistory:C,totalCoinsCollected:k.totalCoinsCollected,totalPowerModeActivations:k.totalPowerModeActivations,totalBombs:k.totalBombs,totalCorrectOrders:k.totalCorrectOrders,averageCompletionTime:k.averageCompletionTime,gameEndReason:"failed",sessionId:A,startTime:R,endTime:Date.now()};jR(_)}},addLife:()=>{const{lives:l}=a(),f=l+1;Pe.info(`Adding life: ${l} → ${f}`),c({lives:f})},nextLevel:()=>{const{currentLevel:l}=a();c({currentLevel:l+1}),c({levelScore:0});const f=a();"resetMultiplier"in f&&(Pe.debug("Resetting multiplier on level change..."),f.resetMultiplier());const h="currentMap"in f?f.currentMap:void 0;Iv(ot.PLAYING,h?.name)},addScore:l=>{const{score:f,levelScore:h,currentLevel:y,lives:v}=a(),C=f+l;c({score:C,levelScore:h+l});const x=a(),R="multiplier"in x?x.multiplier:1,A="currentMap"in x?x.currentMap:void 0;zR(C,A?.name||`Level ${y}`,y,v,R)},resetLevelScores:()=>{c({levelScore:0})},resetGameState:()=>{c({currentState:ot.MENU,score:0,levelScore:0,lives:H.STARTING_LIVES,currentLevel:1,showMenu:Pt.START,previousMenu:null,isPaused:!1,bonusAnimationComplete:!1})}}),QR=(c,a)=>{const l=c?H.BOMB_POINTS.FIREBOMB:H.BOMB_POINTS.NORMAL,f=l*a;return{basePoints:l,actualPoints:f,multiplier:a,isFirebomb:c}},qR=c=>{const{actualPoints:a,isFirebomb:l,multiplier:f}=c;return`🎯 Score: +${a} (${l?"Firebomb":"Normal"} x${f})`},ZR=(c,a)=>{const{MULTIPLIER_THRESHOLDS:l,MAX_MULTIPLIER:f}=H;if(a>=f)return 1;const h=l[a],y=l[a+1];if(!y)return 1;const v=(c-h)/(y-h);return Math.max(0,Math.min(1,v))},JR=(c,a)=>({bombs:[],collectedBombs:[],correctOrderCount:0,nextBombOrder:1,bombManager:null,collectBomb:l=>{const{bombs:f,bombManager:h}=a(),y=f.find(_=>_.order===l);if(!y||!h)return Pe.warn("Bomb or bomb manager not found"),{isValid:!1,isCorrect:!1};const v=h.handleBombClick(y.group,y.order);if(!v.isValid)return{isValid:!1,isCorrect:!1};const C=v.isCorrect,x=a(),R="multiplier"in x?x.multiplier:1,A=QR(C,R);if("addScore"in x&&x.addScore(A.actualPoints),"addMultiplierScore"in x&&x.addMultiplierScore(A.actualPoints),"coinManager"in x&&x.coinManager&&x.coinManager.onPointsEarned(A.actualPoints,!1),(C||A.actualPoints>=400)&&Pe.score(qR(A)),C&&"addFloatingText"in x){const _=f.find(N=>N.order===l);if(_){const N=`${A.actualPoints}`;x.addFloatingText(N,_.x+_.width/2,_.y+_.height/2,1e3,"#FFD700",15)}}const k=f.map(_=>{if(_.order===l)return{..._,isCollected:!0,isCorrect:v.isCorrect};const N=h.getActiveGroup(),z=h.getNextBombOrder(),G=N!==null&&z!==null&&_.group===N&&_.order===z&&!_.isCollected;return{..._,isBlinking:G}});return c({bombs:k,correctOrderCount:h.getCorrectOrderCount(),collectedBombs:Array.from(h.getCollectedBombs()).map(_=>{const[N,z]=_.split("-").map(Number);return z})}),{isValid:!0,isCorrect:v.isCorrect}},setBombs:l=>{c({bombs:l})},setBombManager:l=>{c({bombManager:l})},resetBombState:()=>{c({bombs:[],collectedBombs:[],correctOrderCount:0,nextBombOrder:1,bombManager:null})}});class eM{constructor(a){be(this,"bombs",[]);be(this,"collectedBombs",new Set);be(this,"correctBombs",new Set);be(this,"activeGroup",null);be(this,"nextBombOrder",null);be(this,"gameStarted",!1);this.setBombs(a)}reset(){this.collectedBombs.clear(),this.correctBombs.clear(),this.activeGroup=null,this.nextBombOrder=null,this.gameStarted=!1}setBombs(a){this.bombs=a}handleBombClick(a,l){const f=`${a}-${l}`;if(this.collectedBombs.has(f))return{isValid:!1,isCorrect:!1,gameCompleted:!1};if(!this.gameStarted)return this.startGame(a,l),this.collectBomb(f,!0),this.updateNextBomb(),{isValid:!0,isCorrect:!0,gameCompleted:this.isGameCompleted()};const h=this.isValidBomb(a,l);return h?(this.collectBomb(f,!0),this.updateNextBomb()):this.collectBomb(f,!1),{isValid:!0,isCorrect:h,gameCompleted:this.isGameCompleted()}}startGame(a,l){this.gameStarted=!0,this.activeGroup=a,this.nextBombOrder=this.findLowestOrderInGroup(a)}isValidBomb(a,l){return this.activeGroup===null||this.nextBombOrder===null?!1:a===this.activeGroup&&l===this.nextBombOrder&&!this.collectedBombs.has(`${a}-${l}`)}collectBomb(a,l){this.collectedBombs.add(a),l&&this.correctBombs.add(a)}updateNextBomb(){if(this.activeGroup!==null)if(this.isGroupCompleted(this.activeGroup)){Pe.dev(`GROUP ${this.activeGroup} COMPLETED!`);const a=this.findNextAvailableGroup();if(a!==null)this.activeGroup=a,this.nextBombOrder=this.findLowestOrderInGroup(a);else{this.activeGroup=null,this.nextBombOrder=null;return}}else{const a=this.findNextAvailableOrderInGroup(this.activeGroup);a!==null&&(this.nextBombOrder=a)}}isGroupCompleted(a){return this.bombs.filter(f=>f.group===a).every(f=>{const h=`${f.group}-${f.order}`;return this.collectedBombs.has(h)})}findNextAvailableGroup(){const a=[...new Set(this.bombs.map(l=>l.group))].sort((l,f)=>l-f);for(const l of a)if(!this.isGroupCompleted(l))return l;return null}findLowestOrderInGroup(a){const f=this.bombs.filter(h=>h.group===a).filter(h=>{const y=`${h.group}-${h.order}`;return!this.collectedBombs.has(y)});return f.length>0?Math.min(...f.map(h=>h.order)):null}findNextAvailableOrderInGroup(a){return this.findLowestOrderInGroup(a)}isGameCompleted(){return this.collectedBombs.size===this.bombs.length}getCollectedBombs(){return new Set(this.collectedBombs)}getCorrectBombs(){return new Set(this.correctBombs)}getActiveGroup(){return this.activeGroup}getNextBombOrder(){return this.nextBombOrder}isGameStarted(){return this.gameStarted}getCorrectOrderCount(){return this.correctBombs.size}}const tM=(c,a)=>({currentMap:null,levelStartTime:0,levelCompletionTime:null,monsters:[],platforms:[],ground:null,initializeLevel:l=>{const f=new eM(l.bombs),y=[...l.bombs].sort((x,R)=>x.group-R.group||x.order-R.order)[0],v=x=>{switch(x){case kn.HORIZONTAL_PATROL:return rr.MONSTER;case kn.VERTICAL_PATROL:return"#FF6B6B";case kn.CHASER:return"#FFD93D";case kn.AMBUSHER:return"#FF8800";case kn.FLOATER:return"#4ECDC4";default:return rr.MONSTER}},C=l.monsters.map(x=>({...x,color:x.color||v(x.type)}));return c({currentMap:l,platforms:l.platforms,ground:l.ground,monsters:C}),{bombManager:f,firstBomb:y}},updateMonsters:l=>{c({monsters:l})},resetLevelState:()=>{c({currentMap:null,levelStartTime:0,levelCompletionTime:null,monsters:[],platforms:[],ground:null})},sendLevelCompletionData:l=>{const{levelStartTime:f}=a(),h=Date.now()-f,y={...l,timestamp:Date.now(),completionTime:h};Pe.debug("Sending level completion data:",y),ux(y)}}),nM=(c,a)=>({levelHistory:[],gameStartTime:0,sessionId:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,addLevelResult:l=>{c(f=>({levelHistory:[...f.levelHistory,{...l,completionTime:l.completionTime||0,timestamp:l.timestamp||Date.now(),lives:l.lives||0,multiplier:l.multiplier||1,totalBombs:l.totalBombs||0,correctOrderCount:l.correctOrderCount||0}]}))},getLevelResults:()=>a().levelHistory,resetLevelHistory:()=>{c({levelHistory:[],gameStartTime:Date.now(),sessionId:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`})},setGameStartTime:l=>{c({gameStartTime:l})},getGameStartTime:()=>a().gameStartTime,getSessionId:()=>a().sessionId}),rM=(c,a)=>({multiplier:1,multiplierScore:0,calculateMultiplier:l=>{const{MULTIPLIER_THRESHOLDS:f,MAX_MULTIPLIER:h}=H;for(let y=h;y>=1;y--)if(l>=f[y])return y;return 1},addMultiplierScore:l=>{const{multiplier:f,multiplierScore:h,calculateMultiplier:y}=a(),v=h+l,C=y(v),x=C>f;return c({multiplier:Math.max(f,C),multiplierScore:x?0:v}),{newMultiplier:Math.max(f,C),multiplierIncreased:x}},resetMultiplier:()=>{c({multiplier:1,multiplierScore:0})},setMultiplier:(l,f)=>{c({multiplier:l,multiplierScore:f})}}),aM=(c,a)=>({audioSettings:lx,audioManager:null,updateAudioSettings:l=>{c({audioSettings:{...a().audioSettings,...l}});const f=a().audioManager;f&&f.updateVolumes&&f.updateVolumes()},resetAudioSettings:()=>{c({audioSettings:lx});const l=a().audioManager;l&&l.updateVolumes&&l.updateVolumes()},setAudioManager:l=>{c({audioManager:l})}}),iM=(c,a)=>({coins:[],coinManager:null,activeEffects:{powerMode:!1,powerModeEndTime:0},firebombCount:0,totalCoinsCollected:0,totalPowerCoinsCollected:0,totalBonusMultiplierCoinsCollected:0,totalExtraLifeCoinsCollected:0,setCoins:l=>{c({coins:l})},setCoinManager:l=>{c({coinManager:l})},collectCoin:l=>{const{coinManager:f}=a();if(!f)return;f.collectCoin(l);const h=a().coins.map(N=>N===l?{...N,isCollected:!0}:N);let y=0;if(f.isPowerModeActive()&&l.type==="POWER"&&l.spawnTime!==void 0){const N=f.getPcoinColorForTime(l.spawnTime);y=Date.now()+N.duration}const v={powerMode:f.isPowerModeActive(),powerModeEndTime:y},C=a(),x=C.totalCoinsCollected+1,R=C.totalPowerCoinsCollected+(l.type==="POWER"?1:0),A=C.totalBonusMultiplierCoinsCollected+(l.type==="BONUS_MULTIPLIER"?1:0),k=C.totalExtraLifeCoinsCollected+(l.type==="EXTRA_LIFE"?1:0);c({coins:h,activeEffects:v,totalCoinsCollected:x,totalPowerCoinsCollected:R,totalBonusMultiplierCoinsCollected:A,totalExtraLifeCoinsCollected:k});const _=a();if(l.type==="POWER")"addScore"in _&&_.addScore(H.POWER_COIN_POINTS);else if(l.type==="BONUS_MULTIPLIER"){if("addScore"in _&&"multiplier"in _){const N=_.multiplier,z=1e3*N;if(_.addScore(z),N<H.MAX_MULTIPLIER&&"addMultiplierScore"in _&&"multiplierScore"in _){const{MULTIPLIER_THRESHOLDS:G}=H,J=G[N+1];if(J!==void 0){const de=J-_.multiplierScore;_.addMultiplierScore(de)}}}}else if(l.type==="EXTRA_LIFE"&&"addScore"in _&&"multiplier"in _&&"addLife"in _){const N=_.multiplier,z=H.EXTRA_LIFE_COIN_POINTS*N;_.addScore(z),_.addLife(),Pe.debug("Extra life added via coin slice!")}Pe.debug(`Coin collected: ${l.type} (Total: ${x}, Power: ${R}, Bonus: ${A})`)},onFirebombCollected:()=>{const{coinManager:l}=a();l&&(l.onFirebombCollected(),c({firebombCount:l.getFirebombCount(),coins:l.getCoins()}))},resetCoinState:()=>{const{coinManager:l}=a();l&&l.reset(),c({coins:[],activeEffects:{powerMode:!1,powerModeEndTime:0},firebombCount:0,totalCoinsCollected:0,totalPowerCoinsCollected:0,totalBonusMultiplierCoinsCollected:0,totalExtraLifeCoinsCollected:0})},getCoinStats:()=>{const l=a();return{totalCoinsCollected:l.totalCoinsCollected,totalPowerCoinsCollected:l.totalPowerCoinsCollected,totalBonusMultiplierCoinsCollected:l.totalBonusMultiplierCoinsCollected,totalExtraLifeCoinsCollected:l.totalExtraLifeCoinsCollected}},updateMonsterStates:l=>{const{coinManager:f}=a();if(!f)return;const h=a().activeEffects.powerMode,y=f.isPowerModeActive();h&&!y?l.forEach(C=>{C.isFrozen=!1}):f.updateMonsters(l);let v=0;y&&f&&(v=f.getPowerModeEndTime()),c({activeEffects:{powerMode:y,powerModeEndTime:v}})},resetEffects:()=>{const{coinManager:l}=a();l&&l.resetEffects(),c({activeEffects:{powerMode:!1,powerModeEndTime:0}})}}),oM=(c,a)=>({floatingTexts:[],addFloatingText:(l,f,h,y=1e3,v="#FFFFFF",C=16)=>{const R={id:`floating-text-${Date.now()}-${Math.random()}`,text:l,x:f,y:h,startTime:Date.now(),duration:y,color:v,fontSize:C};c(A=>({floatingTexts:[...A.floatingTexts,R]}))},removeFloatingText:l=>{c(f=>({floatingTexts:f.floatingTexts.filter(h=>h.id!==l)}))},updateFloatingTexts:()=>{const l=Date.now();c(f=>({floatingTexts:f.floatingTexts.filter(h=>l-h.startTime<h.duration)}))},clearAllFloatingTexts:()=>{c({floatingTexts:[]})}}),Yu=class Yu{constructor(){be(this,"config");be(this,"globalPauseState");be(this,"monsterCache");be(this,"globalCache");be(this,"cacheTimeout",1e3);be(this,"globalStartTime",0);this.config=this.getDefaultConfig(),this.globalPauseState=this.createPauseState(),this.monsterCache=new Map,this.globalCache=null}static getInstance(){return Yu.instance||(Yu.instance=new Yu),Yu.instance}getDefaultConfig(){return{base:{ambusher:{ambushInterval:5e3,speed:2},chaser:{speed:1,directness:.3,updateInterval:200},floater:{speed:2,bounceAngle:.2},patrol:{speed:1}},scaling:{ambusher:{ambushInterval:-500,speed:.08},chaser:{speed:.2,directness:.08,updateInterval:-8},floater:{speed:.5,bounceAngle:.008},patrol:{speed:.2}},max:{ambusher:{ambushInterval:500,speed:10},chaser:{speed:5,directness:1,updateInterval:100},floater:{speed:5,bounceAngle:.5},patrol:{speed:5}}}}updateConfig(a){this.config={...this.config,...a},this.clearCache(),Ge.debug("ScalingManager: Configuration updated")}createPauseState(){return{isPaused:!1,pauseStartTime:0,totalPausedTime:0,pauseReasons:new Set}}pause(a="default"){this.globalPauseState.isPaused||(this.globalPauseState.isPaused=!0,this.globalPauseState.pauseStartTime=Date.now()),this.globalPauseState.pauseReasons.add(a),Ge.pause(`Scaling paused (${a})`)}resume(a="default"){if(this.globalPauseState.pauseReasons.delete(a),this.globalPauseState.pauseReasons.size===0&&this.globalPauseState.isPaused){const l=Date.now()-this.globalPauseState.pauseStartTime;this.globalPauseState.totalPausedTime+=l,this.globalPauseState.isPaused=!1,this.clearCache(),Ge.pause(`Scaling resumed (paused for ${(l/1e3).toFixed(1)}s)`)}}isPaused(){return this.globalPauseState.isPaused}getPauseReasons(){return Array.from(this.globalPauseState.pauseReasons)}getPauseStatus(){return{isPaused:this.globalPauseState.isPaused,pauseReasons:this.getPauseReasons(),totalPausedTime:this.globalPauseState.totalPausedTime,timeElapsed:this.getGlobalTimeElapsed(),globalStartTime:this.globalStartTime,currentTime:Date.now()}}startMap(){this.globalStartTime=Date.now(),this.globalPauseState=this.createPauseState(),this.clearCache(),Ge.flow("New map started - difficulty reset")}resetOnDeath(){this.globalStartTime=Date.now(),this.globalPauseState=this.createPauseState(),this.clearCache(),Ge.player("Player died - difficulty reset to base values")}getGlobalScaledValues(){const a=Date.now();if(this.globalCache&&a-this.globalCache.lastUpdate<this.cacheTimeout)return this.globalCache.values;const l=this.calculateScaledValues(this.getGlobalTimeElapsed());return this.globalCache={values:l,lastUpdate:a},l}getGlobalTimeElapsed(){return this.globalStartTime===0?0:(Date.now()-this.globalStartTime-this.globalPauseState.totalPausedTime)/1e3}pauseForPowerMode(){this.pause("power_mode"),Ge.power("Power mode activated - scaling paused")}resumeFromPowerMode(){this.resume("power_mode"),Ge.power("Power mode ended - scaling resumed")}isCurrentlyPausedByPowerMode(){return this.globalPauseState.pauseReasons.has("power_mode")}pauseAllMonsterScaling(){this.pause("monster_scaling"),this.globalPauseState.pauseReasons.size===1&&Ge.pause("All monster scaling paused")}resumeAllMonsterScaling(){this.resume("monster_scaling"),this.globalPauseState.pauseReasons.size===0&&Ge.pause("All monster scaling resumed")}getMonsterScaledValues(a){if(this.initializeMonster(a),a.individualScalingPaused||this.globalPauseState.isPaused)return this.config.base;const l=this.getMonsterCacheKey(a),f=Date.now(),h=this.monsterCache.get(l);if(h&&f-h.lastUpdate<this.cacheTimeout)return h.values;const y=h?.values||this.config.base,v=this.calculateScaledValues(this.getMonsterAge(a));return this.logScalingChanges(a,y,v),this.monsterCache.set(l,{values:v,lastUpdate:f}),v}initializeMonster(a){if(!a.individualSpawnTime){a.individualSpawnTime=Date.now(),a.individualScalingPaused=!1,a.spawnPauseTime=this.globalPauseState.totalPausedTime;const l=this.config.base;let f="";switch(a.type){case"AMBUSHER":f=`ambush interval: ${l.ambusher.ambushInterval}ms, speed: ${l.ambusher.speed.toFixed(2)}`;break;case"CHASER":f=`speed: ${l.chaser.speed.toFixed(2)}, directness: ${l.chaser.directness.toFixed(3)}, update interval: ${l.chaser.updateInterval}ms`;break;case"FLOATER":f=`speed: ${l.floater.speed.toFixed(2)}, bounce angle: ${l.floater.bounceAngle.toFixed(3)}`;break;case"HORIZONTAL_PATROL":case"VERTICAL_PATROL":f=`speed: ${l.patrol.speed.toFixed(2)}`;break;default:f="base values"}Ge.scaling(`${a.type} initialized with ${f}`)}}resetMonsterScaling(a){a.individualSpawnTime=Date.now(),a.individualScalingPaused=!1,a.spawnPauseTime=this.globalPauseState.totalPausedTime,this.monsterCache.delete(this.getMonsterCacheKey(a)),Ge.monster(`${a.type} scaling reset`)}pauseMonsterScaling(a){a.individualScalingPaused=!0,this.monsterCache.delete(this.getMonsterCacheKey(a))}resumeMonsterScaling(a){a.individualScalingPaused=!1,this.monsterCache.delete(this.getMonsterCacheKey(a))}getMonsterAge(a){if(!a.individualSpawnTime)return 0;const f=Date.now()-a.individualSpawnTime,h=this.globalPauseState.totalPausedTime-(a.spawnPauseTime||0),y=f-h,v=Math.max(0,y)/1e3;return this.globalPauseState.isPaused&&v>0&&Ge.debug(`Monster age: ${a.type} - Actual: ${(f/1e3).toFixed(1)}s, Paused: ${(h/1e3).toFixed(1)}s, Adjusted: ${v.toFixed(1)}s`),v}getMonsterCacheKey(a){const l=`${Math.round(a.x)}-${Math.round(a.y)}`;return`${a.type}-${l}-${a.individualSpawnTime||0}`}logScalingChanges(a,l,f){const h=this.getMonsterAge(a),y=Math.floor(h/5);if(y>0&&y%1===0){const v=[];switch(a.type){case"AMBUSHER":Math.abs(l.ambusher.speed-f.ambusher.speed)>.01&&v.push(`speed: ${l.ambusher.speed.toFixed(2)} → ${f.ambusher.speed.toFixed(2)}`),Math.abs(l.ambusher.ambushInterval-f.ambusher.ambushInterval)>50&&v.push(`ambush interval: ${l.ambusher.ambushInterval}ms → ${f.ambusher.ambushInterval}ms`);break;case"CHASER":Math.abs(l.chaser.speed-f.chaser.speed)>.01&&v.push(`speed: ${l.chaser.speed.toFixed(2)} → ${f.chaser.speed.toFixed(2)}`),Math.abs(l.chaser.directness-f.chaser.directness)>.01&&v.push(`directness: ${l.chaser.directness.toFixed(3)} → ${f.chaser.directness.toFixed(3)}`),Math.abs(l.chaser.updateInterval-f.chaser.updateInterval)>5&&v.push(`update interval: ${l.chaser.updateInterval}ms → ${f.chaser.updateInterval}ms`);break;case"FLOATER":Math.abs(l.floater.speed-f.floater.speed)>.01&&v.push(`speed: ${l.floater.speed.toFixed(2)} → ${f.floater.speed.toFixed(2)}`),Math.abs(l.floater.bounceAngle-f.floater.bounceAngle)>.001&&v.push(`bounce angle: ${l.floater.bounceAngle.toFixed(3)} → ${f.floater.bounceAngle.toFixed(3)}`);break;case"HORIZONTAL_PATROL":case"VERTICAL_PATROL":Math.abs(l.patrol.speed-f.patrol.speed)>.01&&v.push(`speed: ${l.patrol.speed.toFixed(2)} → ${f.patrol.speed.toFixed(2)}`);break}v.length>0&&Ge.scaling(`${a.type} scaling (${h.toFixed(1)}s, interval ${y}): ${v.join(", ")}`)}}calculateScaledValues(a){const l=Math.floor(a/5);return{ambusher:{ambushInterval:this.calculateScaledValue(this.config.base.ambusher.ambushInterval,this.config.scaling.ambusher.ambushInterval,this.config.max.ambusher.ambushInterval,l),speed:this.calculateScaledValue(this.config.base.ambusher.speed,this.config.scaling.ambusher.speed,this.config.max.ambusher.speed,l)},chaser:{speed:this.calculateScaledValue(this.config.base.chaser.speed,this.config.scaling.chaser.speed,this.config.max.chaser.speed,l),directness:this.calculateScaledValue(this.config.base.chaser.directness,this.config.scaling.chaser.directness,this.config.max.chaser.directness,l),updateInterval:this.calculateScaledValue(this.config.base.chaser.updateInterval,this.config.scaling.chaser.updateInterval,this.config.max.chaser.updateInterval,l)},floater:{speed:this.calculateScaledValue(this.config.base.floater.speed,this.config.scaling.floater.speed,this.config.max.floater.speed,l),bounceAngle:this.calculateScaledValue(this.config.base.floater.bounceAngle,this.config.scaling.floater.bounceAngle,this.config.max.floater.bounceAngle,l)},patrol:{speed:this.calculateScaledValue(this.config.base.patrol.speed,this.config.scaling.patrol.speed,this.config.max.patrol.speed,l)}}}calculateScaledValue(a,l,f,h){const y=a+l*h;return l>0?Math.min(y,f):Math.max(y,f)}clearCache(){this.monsterCache.clear(),this.globalCache=null}getBaseValues(){return{...this.config.base}}cleanup(){this.clearCache(),this.globalPauseState=this.createPauseState()}};be(Yu,"instance");let ca=Yu;const Uv={POWER_MODE:{type:"POWER_MODE",duration:H.POWER_COIN_DURATION,points:H.POWER_COIN_POINTS,apply:(c,a)=>{let l=H.POWER_COIN_DURATION;if(a&&a.spawnTime!==void 0){const f=c.coinManager;if(f&&typeof f.getPcoinColorForTime=="function")try{l=f.getPcoinColorForTime(a.spawnTime).duration||H.POWER_COIN_DURATION}catch(h){console.warn("Failed to get P-coin color data, using default duration:",h)}}c.monsters&&Array.isArray(c.monsters)&&c.monsters.forEach(f=>{f.isFrozen=!0}),c.activeEffects.powerMode=!0,c.activeEffects.powerModeEndTime=Date.now()+l,c.coinManager&&c.coinManager.resetMonsterKillCount();try{ca.getInstance().pauseForPowerMode()}catch{console.log("Could not pause difficulty scaling (ScalingManager not available)")}},remove:c=>{c.monsters&&Array.isArray(c.monsters)&&c.monsters.forEach(a=>{a.isFrozen=!1}),c.activeEffects.powerMode=!1;try{ca.getInstance().resumeFromPowerMode()}catch{console.log("Could not resume difficulty scaling (ScalingManager not available)")}}},BONUS_MULTIPLIER:{type:"BONUS_MULTIPLIER",points:0,apply:c=>{const a=1e3*c.multiplier;c.addScore(a),c.multiplier<H.MAX_MULTIPLIER&&c.setMultiplier(c.multiplier+1,0)}},EXTRA_LIFE:{type:"EXTRA_LIFE",points:1e3,apply:c=>{c.lives+=1}}},mp={STANDARD:{hasGravity:!0,bounces:!0,reflects:!1},POWER:{hasGravity:!1,bounces:!1,reflects:!0},GRAVITY_ONLY:{hasGravity:!1,bounces:!1,reflects:!1,customUpdate:(c,a,l)=>{if((c.velocityY>0||c.velocityY===void 0)&&(c.velocityX=0,c.velocityY=2),l&&c.y+c.height>=l.y){c.y=l.y-c.height,c.velocityY=0,c.groundDirection||(c.groundDirection=Math.random()<.5?-1:1,c.velocityX=c.groundDirection*1),c.x+=c.velocityX,c.x<=0?(c.x=0,c.groundDirection=1,c.velocityX=1):c.x+c.width>=H.CANVAS_WIDTH&&(c.x=H.CANVAS_WIDTH-c.width,c.groundDirection=-1,c.velocityX=-1);return}let C=!1,x=null;for(const R of a){const A=c.y+c.height,k=R.y,_=A>=k&&A<=k+4,N=c.x<R.x+R.width&&c.x+c.width>R.x;if(_&&N){C=!0,x=R,c.y=k-c.height,c.velocityY=0,c.platformDirection||(c.platformDirection=Math.random()<.5?-1:1,c.velocityX=c.platformDirection*1);break}}C&&x?(c.x+=c.velocityX,(c.x+c.width<=x.x+0||c.x>=x.x+x.width-0)&&(c.platformDirection=null,c.velocityX=0,c.velocityY=2)):C||(c.platformDirection=null,c.velocityX=0,c.velocityY=2)}}},gp=[{color:"#3c82f6",points:100,name:"Blue",duration:3e3},{color:"#ef4444",points:200,name:"Red",duration:4e3},{color:"#a855f7",points:300,name:"Purple",duration:5e3},{color:"#22c55d",points:500,name:"Green",duration:6e3},{color:"#07b6d4",points:800,name:"Cyan",duration:7e3},{color:"#ebb305",points:1200,name:"Yellow",duration:8e3},{color:"#6b7280",points:2e3,name:"Gray",duration:1e4}],Fs={[It.POWER]:{type:It.POWER,color:"#FF0000",points:0,physics:mp.POWER,effects:[Uv.POWER_MODE],spawnCondition:c=>c.firebombCount%9===0,maxActive:1},[It.BONUS_MULTIPLIER]:{type:It.BONUS_MULTIPLIER,color:"#e9b300",points:H.BONUS_MULTIPLIER_COIN_POINTS,physics:mp.GRAVITY_ONLY,effects:[Uv.BONUS_MULTIPLIER],spawnCondition:c=>{const a=c.bombAndMonsterPoints||c.score||0;return a>0&&a%H.BONUS_COIN_SPAWN_INTERVAL===0},maxActive:1},[It.EXTRA_LIFE]:{type:It.EXTRA_LIFE,color:"#ef4444",points:H.EXTRA_LIFE_COIN_POINTS,physics:mp.GRAVITY_ONLY,effects:[Uv.EXTRA_LIFE],spawnCondition:c=>{const a=c.totalBonusMultiplierCoinsCollected||0;return a>0&&a%H.EXTRA_LIFE_COIN_RATIO===0},maxActive:1}};class yp{static updateCoin(a,l,f,h){a.isCollected||(h?(h.hasGravity&&(a.velocityY+=H.COIN_GRAVITY),a.x+=a.velocityX,a.y+=a.velocityY,h.reflects?this.handleReflectiveCollisions(a,l,f):h.bounces&&this.handleBouncingCollisions(a,l,f),h.customUpdate&&h.customUpdate(a,l,f)):this.updateStandardCoin(a,l,f))}static updateStandardCoin(a,l,f){this.updateCoin(a,l,f,mp.STANDARD)}static updatePowerCoin(a,l,f){this.updateCoin(a,l,f,mp.POWER)}static handleBouncingCollisions(a,l,f){this.handleBoundaryCollisions(a),this.handlePlatformCollisions(a,l),this.handleGroundCollisions(a,f)}static handleReflectiveCollisions(a,l,f){this.handlePowerCoinBoundaryCollisions(a),this.handlePowerCoinPlatformCollisions(a,l),this.handlePowerCoinGroundCollisions(a,f)}static handleBoundaryCollisions(a){a.x<=0?(a.x=0,a.velocityX=Math.abs(a.velocityX)*H.COIN_BOUNCE_DAMPING):a.x+a.width>=H.CANVAS_WIDTH&&(a.x=H.CANVAS_WIDTH-a.width,a.velocityX=-Math.abs(a.velocityX)*H.COIN_BOUNCE_DAMPING),a.y<=0&&(a.y=0,a.velocityY=Math.abs(a.velocityY)*H.COIN_BOUNCE_DAMPING)}static handlePowerCoinBoundaryCollisions(a){a.x<=0?(a.x=0,a.velocityX=Math.abs(a.velocityX)):a.x+a.width>=H.CANVAS_WIDTH&&(a.x=H.CANVAS_WIDTH-a.width,a.velocityX=-Math.abs(a.velocityX)),a.y<=0?(a.y=0,a.velocityY=Math.abs(a.velocityY)):a.y+a.height>=H.CANVAS_HEIGHT&&(a.y=H.CANVAS_HEIGHT-a.height,a.velocityY=-Math.abs(a.velocityY))}static handlePlatformCollisions(a,l){l.forEach(f=>{if(this.isColliding(a,f)){const h=a.x+a.width/2,y=a.y+a.height/2,v=f.x+f.width/2,C=f.y+f.height/2,x=h-v,R=y-C;Math.abs(x)>Math.abs(R)?x>0?(a.x=f.x+f.width,a.velocityX=Math.abs(a.velocityX)*H.COIN_BOUNCE_DAMPING):(a.x=f.x-a.width,a.velocityX=-Math.abs(a.velocityX)*H.COIN_BOUNCE_DAMPING):R>0?(a.y=f.y+f.height,a.velocityY=Math.abs(a.velocityY)*H.COIN_BOUNCE_DAMPING):(a.y=f.y-a.height,a.velocityY=-Math.abs(a.velocityY)*H.COIN_BOUNCE_DAMPING)}})}static handlePowerCoinPlatformCollisions(a,l){for(const f of l)if(this.isColliding(a,f)){const h=this.calculateCollisionNormal(a,f);Math.random()<.1&&Pe.debug(`P-coin platform collision - Normal: (${h.x.toFixed(2)}, ${h.y.toFixed(2)}), Velocity before: (${a.velocityX.toFixed(2)}, ${a.velocityY.toFixed(2)})`);const y=a.velocityX*h.x+a.velocityY*h.y;a.velocityX,a.velocityY,a.velocityX=a.velocityX-2*y*h.x,a.velocityY=a.velocityY-2*y*h.y,Math.random()<.1&&Pe.debug(`P-coin platform collision - Velocity after: (${a.velocityX.toFixed(2)}, ${a.velocityY.toFixed(2)})`),h.x!==0?h.x>0?a.x=f.x+f.width+1:a.x=f.x-a.width-1:h.y>0?a.y=f.y+f.height+1:a.y=f.y-a.height-1;break}}static handleGroundCollisions(a,l){this.isColliding(a,l)&&(a.y=l.y-a.height,a.velocityY=-Math.abs(a.velocityY)*H.COIN_BOUNCE_DAMPING,Math.abs(a.velocityY)<.5&&(a.velocityY=0))}static handlePowerCoinGroundCollisions(a,l){if(this.isColliding(a,l)){const f=this.calculateCollisionNormal(a,l),h=a.velocityX*f.x+a.velocityY*f.y;a.velocityX=a.velocityX-2*h*f.x,a.velocityY=a.velocityY-2*h*f.y,a.y=l.y-a.height-1}}static isColliding(a,l){return a.x<l.x+l.width&&a.x+a.width>l.x&&a.y<l.y+l.height&&a.y+a.height>l.y}static createInitialVelocity(){return{velocityX:(Math.random()-.5)*H.COIN_BOUNCE_SPEED*2,velocityY:-3}}static createPowerCoinVelocity(a){const l=H.COIN_BOUNCE_SPEED;if(a!==void 0){const y=a*Math.PI/180;return{velocityX:Math.cos(y)*l,velocityY:Math.sin(y)*l}}const h=Math.random()*360*Math.PI/180;return{velocityX:Math.cos(h)*l,velocityY:Math.sin(h)*l}}static calculateSurfaceNormal(a,l){const f=a.x+a.width/2,h=a.y+a.height/2,y=Math.max(l.x,Math.min(f,l.x+l.width)),v=Math.max(l.y,Math.min(h,l.y+l.height)),C=f-y,x=h-v,R=Math.sqrt(C*C+x*x);if(R>.1)return{x:C/R,y:x/R};{const A=a.x,k=a.x+a.width,_=a.y,N=a.y+a.height,z=l.x,G=l.x+l.width,J=l.y,de=l.y+l.height,ue=Math.abs(k-z),ce=Math.abs(A-G),fe=Math.abs(N-J),le=Math.abs(_-de),Re=Math.min(ue,ce,fe,le);return Re===ue?{x:-1,y:0}:Re===ce?{x:1,y:0}:Re===fe?{x:0,y:-1}:{x:0,y:1}}}static reflectVelocity(a,l){const f=a.velocityX*l.x+a.velocityY*l.y,h=a.velocityX,y=a.velocityY;a.velocityX=a.velocityX-2*f*l.x,a.velocityY=a.velocityY-2*f*l.y;const v=Math.sqrt(h*h+y*y),C=Math.sqrt(a.velocityX*a.velocityX+a.velocityY*a.velocityY);if(C>.001){const x=v/C;a.velocityX*=x,a.velocityY*=x}}static moveCoinOutOfCollision(a,l){const f=a.x+a.width/2,h=a.y+a.height/2,y=Math.max(l.x,Math.min(f,l.x+l.width)),v=Math.max(l.y,Math.min(h,l.y+l.height)),C=f-y,x=h-v;Math.abs(C)>Math.abs(x)?a.x+=C>0?Math.abs(C):-Math.abs(C):a.y+=x>0?Math.abs(x):-Math.abs(x)}static moveCoinOutOfCollisionSimple(a,l){const f=a.x+a.width/2,h=a.y+a.height/2,y=l.x+l.width/2,v=l.y+l.height/2,C=Math.abs(f-y),x=Math.abs(h-v);C>x?f<y?a.x=l.x-a.width-1:a.x=l.x+l.width+1:h<v?a.y=l.y-a.height-1:a.y=l.y+l.height+1}static calculateCollisionNormal(a,l){const f=a.x+a.width/2,h=a.y+a.height/2,y=Math.max(l.x,Math.min(f,l.x+l.width)),v=Math.max(l.y,Math.min(h,l.y+l.height)),C=f-y,x=h-v,R=Math.sqrt(C*C+x*x);if(R>.1)return{x:C/R,y:x/R};{const A=Math.abs(a.x+a.width-l.x),k=Math.abs(a.x-(l.x+l.width)),_=Math.abs(a.y+a.height-l.y),N=Math.abs(a.y-(l.y+l.height)),z=Math.min(A,k,_,N);return z===A?{x:-1,y:0}:z===k?{x:1,y:0}:z===_?{x:0,y:-1}:{x:0,y:1}}}}class lM{constructor(a=[]){be(this,"coins",[]);be(this,"spawnPoints",[]);be(this,"firebombCount",0);be(this,"powerModeActive",!1);be(this,"powerModeEndTime",0);be(this,"activeEffects",new Map);be(this,"triggeredSpawnConditions",new Set);be(this,"lastProcessedScore",0);be(this,"lastScoreCheck",0);be(this,"bombAndMonsterPoints",0);be(this,"monsterKillCount",0);be(this,"pCoinColorIndex",0);this.spawnPoints=a,Pe.debug("CoinManager initialized")}reset(){this.coins=[],this.firebombCount=0,this.powerModeActive=!1,this.powerModeEndTime=0,this.activeEffects.clear(),this.triggeredSpawnConditions.clear(),this.lastProcessedScore=0,this.lastScoreCheck=0,this.bombAndMonsterPoints=0,this.monsterKillCount=0}update(a,l,f){this.coins.forEach(h=>{if(h.isCollected)return;const y=Fs[h.type];y?yp.updateCoin(h,a,l,y.physics):h.type===It.POWER?yp.updatePowerCoin(h,a,l):yp.updateCoin(h,a,l)}),this.checkEffectsEnd(f),this.coins=this.coins.filter(h=>!h.isCollected)}spawnCoin(a,l,f,h){const y=Fs[a];if(y?.maxActive){if(this.coins.filter(R=>R.type===a&&!R.isCollected).length>=y.maxActive){Pe.debug(`${a} coin limit reached (${y.maxActive}), skipping spawn`);return}}else if(this.coins.find(R=>R.type===a)){Pe.debug(`${a} coin already exists, skipping spawn`);return}let v;a===It.POWER?v=yp.createPowerCoinVelocity(h):v=yp.createInitialVelocity();const C={type:a,x:l,y:f,width:H.COIN_SIZE,height:H.COIN_SIZE,velocityX:v.velocityX,velocityY:v.velocityY,isCollected:!1,spawnX:l,spawnY:f};a===It.POWER&&(C.colorIndex=0,C.spawnTime=Date.now(),Pe.debug("Spawning P-coin with Blue color (100 points)")),this.coins.push(C),Pe.debug(`Spawned ${a} coin at (${l}, ${f}) with angle ${h||"random"}`)}onFirebombCollected(){this.firebombCount++,Pe.debug(`Firebomb count: ${this.firebombCount}`),this.checkSpawnConditionsOnFirebombChange()}onPointsEarned(a,l=!1){l||(this.bombAndMonsterPoints+=a,Pe.debug(`Points earned: ${a}, total bomb/monster points: ${this.bombAndMonsterPoints}`),this.checkBcoinSpawnConditions())}checkBcoinSpawnConditions(){const a=Fs.BONUS_MULTIPLIER;if(!a)return;const l=Math.floor(this.bombAndMonsterPoints/H.BONUS_COIN_SPAWN_INTERVAL)*H.BONUS_COIN_SPAWN_INTERVAL,f=Math.floor(this.lastScoreCheck/H.BONUS_COIN_SPAWN_INTERVAL)*H.BONUS_COIN_SPAWN_INTERVAL;if(l>f&&l>=H.BONUS_COIN_SPAWN_INTERVAL){const h=`${a.type}_${l}`;if(this.triggeredSpawnConditions.has(h)){Pe.debug(`B-coin spawn condition already triggered for threshold ${l}`);return}Pe.debug(`B-coin threshold crossed: ${f} -> ${l} (bomb/monster points: ${this.bombAndMonsterPoints})`),this.triggeredSpawnConditions.add(h),this.lastScoreCheck=this.bombAndMonsterPoints;const y=this.spawnPoints.filter(v=>v.type===a.type);if(y.length>0){const v=y[Math.floor(Math.random()*y.length)];this.spawnCoin(a.type,v.x,v.y,v.spawnAngle)}}}checkSpawnConditionsOnFirebombChange(){Object.values(Fs).forEach(a=>{if(a.spawnCondition&&a.spawnCondition.toString().includes("firebombCount")){const l={firebombCount:this.firebombCount};if(a.spawnCondition(l)){const f=`${a.type}_${this.firebombCount}`;if(this.triggeredSpawnConditions.has(f))return;Pe.debug(`P-coin spawn condition met (firebombCount: ${this.firebombCount}, key: ${f})`),this.triggeredSpawnConditions.add(f);const h=this.spawnPoints.filter(y=>y.type===a.type);if(h.length>0){const y=h[Math.floor(Math.random()*h.length)];this.spawnCoin(a.type,y.x,y.y,y.spawnAngle)}else{const y=400+(Math.random()-.5)*200,v=100+Math.random()*100;this.spawnCoin(a.type,y,v)}}}})}checkSpawnConditions(a){Object.values(Fs).forEach(l=>{if(l.spawnCondition&&!l.spawnCondition.toString().includes("firebombCount")&&l.type!=="POWER"){const f={...a,firebombCount:this.firebombCount,bombAndMonsterPoints:this.bombAndMonsterPoints};if(l.spawnCondition(f)){let h=`${l.type}`;if(l.spawnCondition.toString().includes("score")&&l.type==="BONUS_MULTIPLIER"){const v=Math.floor(this.bombAndMonsterPoints/H.BONUS_COIN_SPAWN_INTERVAL)*H.BONUS_COIN_SPAWN_INTERVAL,C=Math.floor(this.lastScoreCheck/H.BONUS_COIN_SPAWN_INTERVAL)*H.BONUS_COIN_SPAWN_INTERVAL;if(v>C&&v>=H.BONUS_COIN_SPAWN_INTERVAL)h=`${l.type}_${v}`,Pe.debug(`B-coin threshold crossed: ${C} -> ${v} (bomb/monster points: ${this.bombAndMonsterPoints})`);else return;this.lastScoreCheck=this.bombAndMonsterPoints}if(l.spawnCondition.toString().includes("totalBonusMultiplierCoinsCollected")){const v=a.totalBonusMultiplierCoinsCollected||0,C=Math.floor(v/H.EXTRA_LIFE_COIN_RATIO)*H.EXTRA_LIFE_COIN_RATIO;h=`${l.type}_${C}`}if(this.triggeredSpawnConditions.has(h))return;Pe.debug(`Spawn condition met for ${l.type} coin (key: ${h})`),this.triggeredSpawnConditions.add(h);const y=this.spawnPoints.filter(v=>v.type===l.type);if(y.length>0){const v=y[Math.floor(Math.random()*y.length)];this.spawnCoin(l.type,v.x,v.y,v.spawnAngle)}else{const v=400+(Math.random()-.5)*200;let C=50;l.physics.hasGravity&&!l.physics.bounces&&!l.physics.reflects?C=50:C=100+Math.random()*100,this.spawnCoin(l.type,v,C)}}}})}collectCoin(a,l){a.isCollected=!0,Pe.debug(`Collected ${a.type} coin`);const f=Fs[a.type];if(f&&l){let h=f.points;if(a.type===It.POWER){const y=a.spawnTime||Date.now(),v=this.getPcoinColorForTime(y),C=l.multiplier||1;h=v.points*C,Pe.debug(`P-coin collected: ${v.name} color, ${v.points} × ${C} = ${h} points`)}else if(a.type===It.BONUS_MULTIPLIER)h=1e3*(l.multiplier||1);else if(a.type===It.EXTRA_LIFE){const y=l.multiplier||1;h=f.points*y}if("addFloatingText"in l&&typeof l.addFloatingText=="function"){const y=h.toString();l.addFloatingText(y,a.x+a.width/2,a.y+a.height/2,1e3,"#fff",15)}f.effects.forEach(y=>{const v={...l,activeEffects:{powerMode:!1,powerModeEndTime:0,...l.activeEffects},coinManager:{resetMonsterKillCount:()=>this.resetMonsterKillCount(),getPcoinColorForTime:C=>this.getPcoinColorForTime(C),getPowerModeEndTime:()=>this.getPowerModeEndTime()},difficultyManager:{pause:()=>{ca.getInstance().pause(),Pe.debug("Difficulty scaling paused (power mode active)")},resume:()=>{ca.getInstance().resume(),Pe.debug("Difficulty scaling resumed (power mode ended)")}}};y.apply(v,a),y.duration&&this.activeEffects.set(y.type,{endTime:Date.now()+y.duration,effect:y})})}else a.type!==It.POWER&&a.type!==It.BONUS_MULTIPLIER&&a.type!==It.EXTRA_LIFE&&Pe.warn(`Unknown coin type: ${a.type}, using legacy behavior`),a.type===It.POWER&&this.activatePowerMode()}checkEffectsEnd(a){const l=Date.now(),f=[];this.activeEffects.forEach((h,y)=>{if(Pe.debug(`Checking effect: ${y}, endTime: ${h.endTime}, currentTime: ${l}, shouldEnd: ${l>=h.endTime}`),l>=h.endTime&&(f.push(y),h.effect.remove&&a)){const v={...a,activeEffects:{powerMode:!1,powerModeEndTime:0,...a.activeEffects},coinManager:{resetMonsterKillCount:()=>this.resetMonsterKillCount(),getPcoinColorForTime:C=>this.getPcoinColorForTime(C),getPowerModeEndTime:()=>this.getPowerModeEndTime()},difficultyManager:{pause:()=>{ca.getInstance().pause(),Pe.debug("Difficulty scaling paused (power mode active)")},resume:()=>{ca.getInstance().resumeFromPowerMode(),Pe.debug("Difficulty scaling resumed (power mode ended)")}}};h.effect.remove(v)}}),f.forEach(h=>{this.activeEffects.delete(h),h==="POWER_MODE"&&(this.powerModeActive=!1,Pe.debug("Power mode deactivated"))})}calculateMonsterKillPoints(a){this.monsterKillCount++;let l;switch(this.monsterKillCount){case 1:l=100;break;case 2:l=200;break;case 3:l=300;break;case 4:l=500;break;case 5:l=800;break;case 6:l=1200;break;case 7:l=1700;break;case 8:l=2300;break;case 9:l=3e3;break;case 10:l=4e3;break;default:l=4e3+(this.monsterKillCount-10)*1e3}const f=l*a;return Pe.debug(`Monster kill #${this.monsterKillCount}: ${l} × ${a} = ${f} points`),f}getPcoinColorForTime(a){const f=Date.now()-a,y=Math.floor(f/1e3)%gp.length;return{...gp[y],index:y}}getCurrentPcoinColor(){return gp[this.pCoinColorIndex]}getPcoinCurrentColor(a){return a.type===It.POWER&&a.spawnTime!==void 0?this.getPcoinColorForTime(a.spawnTime).color:gp[0].color}advancePcoinColor(){this.pCoinColorIndex=(this.pCoinColorIndex+1)%gp.length;const a=this.getCurrentPcoinColor();Pe.debug(`P-coin color advanced to: ${a.name} (${a.points} points)`)}resetMonsterKillCount(){this.monsterKillCount=0,Pe.debug("Monster kill count reset for new power mode session")}isPowerModeActive(){const a=this.activeEffects.get("POWER_MODE");if(a){const l=Date.now()<a.endTime;return l||(this.activeEffects.delete("POWER_MODE"),this.powerModeActive=!1),l}return this.powerModeActive}getCoins(){return this.coins.filter(a=>!a.isCollected)}getAllCoins(){return[...this.coins]}getFirebombCount(){return this.firebombCount}getBombAndMonsterPoints(){return this.bombAndMonsterPoints}updateMonsters(a){if(this.isPowerModeActive()||this.powerModeActive){let f=0;const h=this.activeEffects.get("POWER_MODE");h?f=h.endTime-Date.now():f=this.powerModeEndTime-Date.now();const y=f<=2e3&&f>0;a.forEach(v=>{v.isFrozen=!0,v.isBlinking=y})}else a.forEach(f=>{f.isFrozen=!1,f.isBlinking=!1})}unfreezeAllMonsters(a){a.forEach(l=>{l.isFrozen=!1,l.isBlinking=!1})}resetEffects(){this.powerModeActive=!1,this.powerModeEndTime=0,this.firebombCount=0,this.coins=[],this.activeEffects.clear(),this.bombAndMonsterPoints=0,this.monsterKillCount=0,Pe.debug("Coin effects reset")}getCoinConfig(a){return Fs[a]}isEffectActive(a){return this.activeEffects.has(a)}getPowerModeEndTime(){const a=this.activeEffects.get("POWER_MODE");return a?a.endTime:0}activatePowerMode(){this.powerModeActive=!0;let a=H.POWER_COIN_DURATION;const l=this.coins.find(f=>f.type===It.POWER&&f.spawnTime);l&&l.spawnTime&&(a=this.getPcoinColorForTime(l.spawnTime).duration),this.powerModeEndTime=Date.now()+a,this.resetMonsterKillCount(),this.activeEffects.set("POWER_MODE",{endTime:this.powerModeEndTime,effect:Uv.POWER_MODE}),Pe.debug(`Power mode timing - duration: ${a}ms, endTime: ${this.powerModeEndTime}, currentTime: ${Date.now()}`);try{ca.getInstance().pauseForPowerMode(),Pe.debug("Difficulty scaling paused (power mode active)")}catch{Pe.debug("Could not pause difficulty scaling (ScalingManager not available)")}Pe.debug(`Power mode activated for ${a}ms (${a/1e3}s)`)}}const Ft=PR((c,a,l)=>{const f=IR(c,a),h=KR(c,a),y=JR(c,a),v=tM(c,a),C=nM(c,a),x=rM(c,a),R=aM(c,a),A=iM(c,a),k=oM(c);return{...f,...h,...y,...v,...C,...x,...R,...A,...k,resetGame:()=>{a().resetGameState(),a().resetPlayer(),a().resetBombState(),a().resetLevelState(),a().resetLevelHistory(),a().resetMultiplier(),a().resetAudioSettings(),a().resetCoinState(),a().resetEffects(),a().clearAllFloatingTexts()},initializeLevel:_=>{const{bombManager:N,firstBomb:z}=v.initializeLevel(_),G=_.bombs.map(de=>({...de,isBlinking:!1,isCollected:!1,isCorrect:!1}));a().setBombs(G),a().setBombManager(N);const J=new lM(_.coinSpawnPoints||[]);return a().setCoinManager(J),c({collectedBombs:[],correctOrderCount:0,nextBombOrder:1}),a().setPlayerPosition(_.playerStart.x,_.playerStart.y),{bombManager:N,firstBomb:z}},getLevelHistory:()=>C.getLevelResults(),getGameStartTime:()=>C.getGameStartTime(),getSessionId:()=>C.getSessionId()}});class sM{constructor(){be(this,"keys",new Set);be(this,"keyPressTimes",new Map);be(this,"touchControls",{left:!1,right:!1,up:!1,float:!1});be(this,"boundKeyDownHandler");be(this,"boundKeyUpHandler");be(this,"boundPreventDefaultHandler");this.boundKeyDownHandler=this.handleKeyDown.bind(this),this.boundKeyUpHandler=this.handleKeyUp.bind(this),this.boundPreventDefaultHandler=a=>{["ArrowLeft","ArrowRight","ArrowUp","Space"," ","p","P"].includes(a.key)&&a.preventDefault()},this.bindEvents()}bindEvents(){document.addEventListener("keydown",this.boundKeyDownHandler),document.addEventListener("keyup",this.boundKeyUpHandler),document.addEventListener("keydown",this.boundPreventDefaultHandler)}isKeyPressed(a){return this.keys.has(a)||this.getTouchControl(a)}isShiftPressed(){return this.keys.has("Shift")}getKeyPressDuration(a){const l=this.keyPressTimes.get(a);return l&&this.keys.has(a)?Date.now()-l:0}getTouchControl(a){switch(a){case"ArrowLeft":return this.touchControls.left;case"ArrowRight":return this.touchControls.right;case"ArrowUp":return this.touchControls.up;case" ":case"Space":return this.touchControls.float;default:return!1}}handleKeyDown(a){this.keys.has(a.key)||this.keyPressTimes.set(a.key,Date.now()),this.keys.add(a.key)}handleKeyUp(a){this.keys.delete(a.key),this.keyPressTimes.delete(a.key)}setTouchControl(a,l){this.touchControls[a]=l}cleanup(){document.removeEventListener("keydown",this.boundKeyDownHandler),document.removeEventListener("keyup",this.boundKeyUpHandler),document.removeEventListener("keydown",this.boundPreventDefaultHandler)}}class uM{checkPlayerPlatformCollision(a,l){for(const f of l){const h=this.checkFullCollision(a,f);if(h.hasCollision)return h}return{hasCollision:!1}}checkPlayerGroundCollision(a,l){return this.checkFullCollision(a,l)}checkMonsterGroundCollision(a,l){return this.checkFullCollision(a,l)}checkPlayerCoinCollision(a,l){for(const f of l)if(!f.isCollected&&this.isColliding(a,f))return f;return null}checkFullCollision(a,l){const f=a.x+(a.velocityX||0),h=a.y+(a.velocityY||0);if(this.wouldCollide(f,h,a.width,a.height,l)){const y=a.x+a.width/2,v=a.y+a.height/2,C=l.x+l.width/2,x=l.y+l.height/2,R=y-C,A=v-x,k=(a.width+l.width)/2-Math.abs(R),_=(a.height+l.height)/2-Math.abs(A);return k<_?R>0?{hasCollision:!0,normal:{x:1,y:0},penetration:k}:{hasCollision:!0,normal:{x:-1,y:0},penetration:k}:A>0?{hasCollision:!0,normal:{x:0,y:1},penetration:_}:{hasCollision:!0,normal:{x:0,y:-1},penetration:_}}return{hasCollision:!1}}wouldCollide(a,l,f,h,y){return a<y.x+y.width&&a+f>y.x&&l<y.y+y.height&&l+h>y.y}checkPlayerBombCollision(a,l){for(const f of l)if(!f.isCollected&&this.isColliding(a,f))return f;return null}checkPlayerMonsterCollision(a,l){for(const f of l)if(f.isActive&&this.isColliding(a,f))return f;return null}checkBoundaryCollision(a,l){const f=a.x,h=a.y;return f<0?{hasCollision:!0,normal:{x:1,y:0},penetration:Math.abs(f)}:f+a.width>l.width?{hasCollision:!0,normal:{x:-1,y:0},penetration:f+a.width-l.width}:h<0?{hasCollision:!0,normal:{x:0,y:1},penetration:Math.abs(h)}:h+a.height>l.height?{hasCollision:!0,normal:{x:0,y:-1},penetration:h+a.height-l.height}:{hasCollision:!1}}resolveBoundaryCollision(a,l){const f=this.checkBoundaryCollision(a,l);if(!f.hasCollision||!f.normal||!f.penetration)return{player:a,fellOffScreen:!1};const h={...a},{normal:y,penetration:v}=f;if(y.x===1)h.x=0,h.velocityX=0;else if(y.x===-1)h.x=l.width-a.width,h.velocityX=0;else if(y.y===1)h.y=0,h.velocityY=0;else if(y.y===-1)return{player:h,fellOffScreen:!0};return{player:h,fellOffScreen:!1}}isColliding(a,l){return a.x<l.x+l.width&&a.x+a.width>l.x&&a.y<l.y+l.height&&a.y+a.height>l.y}}class cx{constructor(a,l){be(this,"animations");be(this,"currentAnimation");be(this,"currentFrameIndex",0);be(this,"frameTimer",0);this.animations=Object.fromEntries(a.map(f=>[f.name,f])),this.currentAnimation=this.animations[l]}setAnimation(a){this.currentAnimation.name!==a&&(this.currentAnimation=this.animations[a],this.currentFrameIndex=0,this.frameTimer=0)}setAnimationPreserveFrame(a){if(this.currentAnimation.name!==a){const l=this.animations[a];if(l){const f=Math.min(this.currentFrameIndex,l.frames.length-1);this.currentAnimation=l,this.currentFrameIndex=f}}}update(a){this.frameTimer+=a,this.frameTimer>this.currentAnimation.frameDuration&&(this.frameTimer=0,this.currentFrameIndex++,this.currentFrameIndex>=this.currentAnimation.frames.length&&(this.currentFrameIndex=this.currentAnimation.loop?0:this.currentAnimation.frames.length-1))}draw(a,l,f,h=1){const y=this.currentAnimation.frames[this.currentFrameIndex];if(y.complete){const v=H.PLAYER_WIDTH*2.5,C=H.PLAYER_HEIGHT*h,x=l-(v-H.PLAYER_WIDTH)/2.3;if(this.currentAnimation.name.includes("-left")){a.save(),a.scale(-1,1);const A=x+v/2.14;a.translate(-A*2,0),a.drawImage(y,x,f,v,C),a.restore()}else a.drawImage(y,x,f,v,C);a.save(),a.restore()}}}const cM=!1,Jy=(()=>{{try{const c=document.querySelectorAll('script[src*="sigurd-startup"]');if(c.length>0){const h=c[0].src,y=h.substring(0,h.lastIndexOf("/"));return console.log("Found package via script src:",y),y}const a=new Image,l="/node_modules/sigurd-startup/dist/assets/test.png";a.onerror=()=>{console.log("Trying relative path for assets")},a.src=l;const f=window.location.pathname;if(f.includes("node_modules")){const h=f.indexOf("node_modules"),y=f.indexOf("sigurd-startup",h);if(y!==-1){const v=f.substring(0,y+14);return console.log("Found package via path analysis:",v),v+"/dist"}}if(window.location.port==="5173"||window.location.hostname==="localhost")return console.log("Detected Vite dev server, using relative paths"),"/node_modules/sigurd-startup/dist"}catch{console.warn("Could not determine package location, using fallback paths")}return console.log("Using fallback path: /node_modules/sigurd-startup/dist"),"/node_modules/sigurd-startup/dist"}})(),Il={audio:`${Jy}/audio`,images:`${Jy}/assets`},fx=c=>{const a=`${Il.images}/maps-bg-images/${c}.png`;return console.log(`Background image path: ${a}`),a},fM=()=>{console.log("🔧 Asset Path Debug Info:"),console.log(" isDev:",cM),console.log(" packageBaseUrl:",Jy),console.log(" ASSET_PATHS:",Il),console.log(" current location:",window.location.href),console.log(" current pathname:",window.location.pathname)},Ir=c=>{const a=new Image;return a.src=`${Il.images}/${c}`,a},dx=[Ir("sigurd-idle/sigurd-idle1.png"),Ir("sigurd-idle/sigurd-idle2.png"),Ir("sigurd-idle/sigurd-idle3.png"),Ir("sigurd-idle/sigurd-idle4.png")],px=[Ir("running/run1.png"),Ir("running/run2.png"),Ir("running/run3.png")],hx=[Ir("jumping/jump1.png"),Ir("jumping/jump2.png"),Ir("jumping/jump3.png")],dM=[Ir("complete/complete1.png"),Ir("complete/complete2.png"),Ir("complete/complete3.png"),Ir("complete/complete4.png"),Ir("complete/complete5.png")],pM=[Ir("float/float1.png")],vx=[Ir("float-dir/float-dir1.png")],mx=[Ir("landing/landing1.png")],hM=[{name:"walk-right",frames:px,frameDuration:100,loop:!0},{name:"walk-left",frames:px,frameDuration:100,loop:!0},{name:"idle-right",frames:dx,frameDuration:1e3,loop:!0},{name:"idle-left",frames:dx,frameDuration:1e3,loop:!0},{name:"jump-right",frames:hx,frameDuration:100,loop:!1},{name:"jump-left",frames:hx,frameDuration:100,loop:!1},{name:"land-right",frames:mx,frameDuration:500,loop:!1},{name:"land-left",frames:mx,frameDuration:500,loop:!1},{name:"float-stationary",frames:pM,frameDuration:100,loop:!0},{name:"float-right",frames:vx,frameDuration:100,loop:!1},{name:"float-left",frames:vx,frameDuration:100,loop:!0},{name:"ghost-complete",frames:dM,frameDuration:100,loop:!1}],Sp=new cx(hM,"idle-left"),e0=c=>{const a=new Image;return a.src=`${Il.images}/${c}`,a},vM=[e0("bomb/bomb1.png")],mM=[e0("bomb/bomb1.png"),e0("bomb/bomb2.png")],gM=[{name:"unlit",frames:vM,frameDuration:100,loop:!1},{name:"lit",frames:mM,frameDuration:100,loop:!0}];class gx extends cx{draw(a,l,f,h=1){const y=this.currentAnimation.frames[this.currentFrameIndex];if(y.complete){const v=H.BOMB_SIZE*h,C=H.BOMB_SIZE*h;a.drawImage(y,l,f,v,C)}}}const t0=new gx(gM,"unlit"),wp={"startup lab":"startup-lab.png",nav:"nav.png",skatteetaten:"skatteetaten.png","innovasjon norge":"innovasjon-norge.png",kommunehuset:"kommunehuset.png","alltinn norge":"alltinn-norge.png","silicone vally":"silicone-vally.png",default:"startup-lab.png"};class yx{constructor(a,l){be(this,"currentBackground",null);be(this,"isLoading",!1);be(this,"canvasWidth");be(this,"canvasHeight");be(this,"currentMapName","");this.canvasWidth=a,this.canvasHeight=l}loadMapBackground(a){this.isLoading||(this.currentMapName=a,this.isLoading=!0,this.currentBackground&&(this.currentBackground.image.src="",this.currentBackground=null),this.loadBackgroundAsync(a).catch(l=>{console.error("BackgroundManager: Failed to load background:",l),this.isLoading=!1}))}async loadBackgroundAsync(a){try{const l=wp[a]||wp.default,f=await this.loadImage(`${Il.images}/maps-bg-images/${l}`);this.currentBackground={image:f,isLoaded:!0},this.isLoading=!1,Ge.flow(`Background loaded: ${a}`)}catch(l){console.error("BackgroundManager: Failed to load background image:",l),this.isLoading=!1}}loadImage(a){return new Promise((l,f)=>{const h=new Image;h.onload=()=>l(h),h.onerror=()=>f(new Error(`Failed to load image: ${a}`)),h.src=a})}update(a,l){}render(a){if(!this.currentBackground||!this.currentBackground.isLoaded){this.isLoading?this.renderLoading(a):this.renderFallback(a);return}const l=this.currentBackground.image,f=this.canvasWidth/l.width,h=this.canvasHeight/l.height,y=Math.max(f,h),v=l.width*y,C=l.height*y,x=(v-this.canvasWidth)/2,R=(C-this.canvasHeight)/2;a.drawImage(l,-x,-R,v,C)}renderLoading(a){const l=a.createLinearGradient(0,0,0,this.canvasHeight);l.addColorStop(0,"#262521"),l.addColorStop(1,"#484744"),a.fillStyle=l,a.fillRect(0,0,this.canvasWidth,this.canvasHeight),a.fillStyle="#ffffff",a.font="16px Arial",a.textAlign="center",a.fillText("Loading background...",this.canvasWidth/2,this.canvasHeight/2)}renderFallback(a){const l=a.createLinearGradient(0,0,0,this.canvasHeight);l.addColorStop(0,"#87CEEB"),l.addColorStop(1,"#4682B4"),a.fillStyle=l,a.fillRect(0,0,this.canvasWidth,this.canvasHeight)}isReady(){return this.currentBackground?.isLoaded||!1}isCurrentlyLoading(){return this.isLoading}getCurrentTheme(){return this.currentMapName}getCurrentMapName(){return this.currentMapName}static getAvailableBackgrounds(){return Object.values(wp)}static getMapNameMapping(){return{...wp}}static async preloadAllBackgrounds(){Ge.flow("Starting background preloading...");const a=Object.values(wp);let l=0;const f=a.map(async h=>{try{const y=new Image;await new Promise((v,C)=>{y.onload=v,y.onerror=C,y.src=`${Il.images}/maps-bg-images/${h}`}),l++,(l%2===0||l===a.length)&&Ge.flow(`Preloaded ${l}/${a.length} backgrounds`)}catch{Ge.warn(`Failed to preload background: ${h}`)}});await Promise.all(f),Ge.flow(`Background preloading complete! Loaded ${l}/${a.length} backgrounds.`)}}const Wu=class Wu{constructor(){be(this,"deadMonsters",[]);be(this,"respawnConfig");be(this,"scalingManager");be(this,"lastUpdateTime",0);be(this,"updateInterval",500);be(this,"paused",!1);this.respawnConfig=this.getDefaultRespawnConfig(),this.scalingManager=ca.getInstance(),Ge.debug("Respawn manager initialized")}static getInstance(){return Wu.instance||(Wu.instance=new Wu),Wu.instance}getDefaultRespawnConfig(){return{ambusher:1e4,chaser:7e3,floater:15e3,patrol:8e3}}updateRespawnConfig(a){this.respawnConfig={...this.respawnConfig,...a},Ge.debug("OptimizedRespawnManager: Updated respawn configuration",this.respawnConfig)}getRespawnConfig(){return{...this.respawnConfig}}killMonster(a){if(a.isDead){Ge.debug(`Monster already dead, skipping kill: ${a.type}`);return}a.originalSpawnPoint||(a.originalSpawnPoint={x:a.x,y:a.y}),a.isDead=!0,a.isActive=!1,a.deathTime=Date.now(),a.respawnTime=a.deathTime+this.getRespawnDelay(a.type);const l={monster:a,respawnTime:a.respawnTime};this.insertSorted(l),Ge.monster(`${a.type} killed - respawning in ${this.getRespawnDelay(a.type)/1e3}s`)}insertSorted(a){let l=0,f=this.deadMonsters.length;for(;l<f;){const h=Math.floor((l+f)/2);this.deadMonsters[h].respawnTime<=a.respawnTime?l=h+1:f=h}this.deadMonsters.splice(l,0,a)}update(){const a=Date.now();if(a-this.lastUpdateTime<this.updateInterval)return[];if(this.lastUpdateTime=a,this.paused)return[];const l=[];for(;this.deadMonsters.length>0&&this.deadMonsters[0].respawnTime<=a;){const f=this.deadMonsters.shift(),h=this.respawnMonster(f.monster);l.push(h)}return l.length>0&&Ge.monster(`Respawning ${l.length} monsters: ${l.map(f=>f.type).join(", ")}`),l}pause(){this.paused=!0,Ge.pause("Respawn system paused")}resume(){this.paused=!1,Ge.pause("Respawn system resumed")}isPaused(){return this.paused}respawnMonster(a){const l=a.originalSpawnPoint;return this.resetMonsterState(a,l),this.scalingManager.resetMonsterScaling(a),Ge.monster(`${a.type} respawned`),a}resetMonsterState(a,l){a.isDead=!1,a.isActive=!0,a.x=l.x,a.y=l.y,a.isFrozen=!1,a.isBlinking=!1,a.velocityX=0,a.velocityY=0,a.isGrounded=!1,a.isFalling=!1,a.currentPlatform=null,a.behaviorState=void 0,a.lastDirectionChange=void 0,a.deathTime=void 0,a.respawnTime=void 0}getRespawnDelay(a){switch(a){case"AMBUSHER":return this.respawnConfig.ambusher;case"CHASER":return this.respawnConfig.chaser;case"FLOATER":return this.respawnConfig.floater;case"HORIZONTAL_PATROL":case"VERTICAL_PATROL":return this.respawnConfig.patrol;default:return Ge.warn(`Unknown monster type for respawn delay: ${a}, using default`),this.respawnConfig.patrol}}getDeadMonsterCount(){return this.deadMonsters.length}getDeadMonsters(){return this.deadMonsters.map(a=>a.monster)}getRespawnTimeRemaining(a){return!a.isDead||!a.respawnTime?0:Math.max(0,a.respawnTime-Date.now())}getNextRespawnTime(){return this.deadMonsters.length>0?this.deadMonsters[0].respawnTime:null}reset(){this.deadMonsters=[],this.lastUpdateTime=0,Ge.debug("OptimizedRespawnManager: Reset - cleared all dead monsters")}setUpdateInterval(a){this.updateInterval=a,Ge.debug(`OptimizedRespawnManager: Update interval set to ${a}ms`)}cleanup(){this.deadMonsters=[],this.lastUpdateTime=0}};be(Wu,"instance");let zv=Wu;class yM{constructor(a){be(this,"canvas");be(this,"ctx");be(this,"lastTime",0);be(this,"backgroundManager");be(this,"bombSprites",new Map);be(this,"currentSpawnManager",null);be(this,"currentGameState",null);this.canvas=a,this.ctx=a.getContext("2d"),this.backgroundManager=new yx(a.width,a.height),Pe.debug("RenderManager initialized with canvas")}render(a,l,f,h,y,v=[],C=[],x,R,A,k){this.currentSpawnManager=R,this.currentGameState=k;const _=Date.now(),N=_-this.lastTime;this.lastTime=_,this.backgroundManager.update(a.x,a.y),this.renderBackground(),y&&this.renderGround(y),this.renderPlatforms(l),this.renderBombs(f),this.renderCoins(v,x),this.renderMonsters(h),this.renderPlayer(a),this.renderFloatingTexts(C,N)}clearCanvas(){this.ctx.fillStyle=rr.BACKGROUND,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}renderBackground(){this.backgroundManager.render(this.ctx)}renderGround(a){this.ctx.fillStyle=a.color,this.ctx.fillRect(a.x,a.y,a.width,a.height)}renderPlayer(a){if(Sp&&H.USE_SPRITES){const l=a.height/H.PLAYER_HEIGHT;Sp.draw(this.ctx,a.x,a.y,l)}else this.ctx.fillStyle=a.color,this.ctx.fillRect(a.x,a.y,a.width,a.height)}renderPlatforms(a){a.forEach(l=>{this.ctx.fillStyle=l.color,this.ctx.strokeStyle=l.borderColor;const f=4,h=l.x,y=l.y,v=l.width,C=l.height;this.ctx.beginPath(),this.ctx.moveTo(h+f,y),this.ctx.lineTo(h+v-f,y),this.ctx.quadraticCurveTo(h+v,y,h+v,y+f),this.ctx.lineTo(h+v,y+C-f),this.ctx.quadraticCurveTo(h+v,y+C,h+v-f,y+C),this.ctx.lineTo(h+f,y+C),this.ctx.quadraticCurveTo(h,y+C,h,y+C-f),this.ctx.lineTo(h,y+f),this.ctx.quadraticCurveTo(h,y,h+f,y),this.ctx.closePath(),this.ctx.lineWidth=3,this.ctx.stroke(),this.ctx.fill()})}renderBombs(a){a.forEach(l=>{if(!l.isCollected)if(t0&&H.USE_SPRITES){let f=this.bombSprites.get(l.order);if(!f){const v=[{name:"unlit",frames:t0.animations.unlit.frames,frameDuration:50,loop:!1},{name:"lit",frames:t0.animations.lit.frames,frameDuration:100,loop:!0}];f=new gx(v,"unlit"),this.bombSprites.set(l.order,f)}const h=l.isBlinking?"lit":"unlit";f.setAnimation(h),f.update(16);const y=l.width/H.BOMB_SIZE;f.draw(this.ctx,l.x,l.y,y)}else this.ctx.fillStyle=l.isBlinking?rr.BOMB_NEXT:rr.BOMB,this.ctx.fillRect(l.x,l.y,l.width,l.height),this.ctx.fillStyle="#000000",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.fillText(l.order.toString(),l.x+l.width/2,l.y+l.height/2+4)})}renderCoins(a,l){a.forEach(f=>{if(f.isCollected)return;let y=Fs[f.type]?.color||"#FFD700";f.type==="POWER"&&l&&(y=l.getPcoinCurrentColor(f)),this.ctx.fillStyle=y,this.ctx.beginPath(),this.ctx.arc(f.x+f.width/2,f.y+f.height/2,f.width/2,0,2*Math.PI),this.ctx.fill(),this.ctx.fillStyle="#fff",this.ctx.font="14px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle";let v="C";f.type==="POWER"?(v="P",this.ctx.fillStyle="#000"):f.type==="BONUS_MULTIPLIER"?(v="B",this.ctx.fillStyle="#fff"):f.type==="EXTRA_LIFE"&&(v="M",this.ctx.fillStyle="#fff"),this.ctx.fillText(v,f.x+f.width/2,f.y+f.height/2+2)})}renderMonsters(a){a.forEach((l,f)=>{if(!l.isActive){Pe.debug(`Monster ${f} is not active, skipping`);return}let h=l.color;if(l.isBlinking){const y=Date.now();Math.floor(y/300)%2===0?h=rr.MONSTER_FROZEN:h=l.color}else l.isFrozen&&(h=rr.MONSTER_FROZEN);this.ctx.fillStyle=h,this.ctx.fillRect(l.x,l.y,l.width,l.height),this.ctx.fillStyle="#000",this.ctx.fillRect(l.x+2,l.y+2,2,2),this.ctx.fillRect(l.x+l.width-4,l.y+2,2,2)}),this.renderRespawnIndicators(a),this.renderSpawnIndicators(this.currentSpawnManager)}renderRespawnIndicators(a){const l=zv.getInstance();a.forEach(f=>{if(f.isDead&&f.originalSpawnPoint){const h=l.getRespawnTimeRemaining(f),y=Math.ceil(h/1e3);if(h>0&&y<=3){const v=f.originalSpawnPoint,C=Math.sin(Date.now()/200)*.3+.7,x=f.color||"#ffffff";this.ctx.fillStyle=`${x}${Math.floor(C*1*255).toString(16).padStart(2,"0")}`,this.ctx.fillRect(v.x,v.y,f.width,f.height);const R=`${y}`,A=v.x+f.width/2,k=v.y+f.height/2+4;this.ctx.fillStyle="#ffffff",this.ctx.font="16px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText(R,A,k)}}})}renderSpawnIndicators(a){if(a&&!(!this.currentGameState||this.currentGameState.currentState!=="PLAYING"))try{a.getPendingSpawns().forEach(f=>{const h=a.getSpawnTimeRemaining(f),y=Math.ceil(h/1e3);if(h>0&&y<=3){const v=f.spawnPoint.createMonster(),C=Math.sin(Date.now()/200)*.3+.7,x=v.color||"#ffffff";this.ctx.fillStyle=`${x}${Math.floor(C*1*255).toString(16).padStart(2,"0")}`,this.ctx.fillRect(v.x,v.y,v.width,v.height);const R=`${y}`,A=v.x+v.width/2,k=v.y+v.height/2;this.ctx.fillStyle="#ffffff",this.ctx.font="16px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText(R,A,k)}})}catch{}}renderFloatingTexts(a,l){a.forEach(f=>{const h=Date.now()-f.startTime,y=Math.min(h/f.duration,1),C=f.y-50*y,x=1-y;this.ctx.globalAlpha=x,this.ctx.fillStyle=f.color,this.ctx.font=`${f.fontSize}px Arial`,this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText(f.text,f.x,C),this.ctx.globalAlpha=1})}loadCityTheme(a){this.backgroundManager.loadMapBackground(a)}loadMapBackground(a){this.backgroundManager.loadMapBackground(a)}isParallaxReady(){return this.backgroundManager.isReady()}isParallaxLoading(){return this.backgroundManager.isCurrentlyLoading()}getCurrentMapName(){return this.backgroundManager.getCurrentMapName()}clearBombSprites(){this.bombSprites.clear()}}const Sx=c=>c.type==="HORIZONTAL_PATROL"||c.type==="VERTICAL_PATROL",SM=c=>c.type==="CHASER",wM=c=>c.type==="AMBUSHER";class hi{static checkMonsterPlatformCollision(a,l){return a.x<l.x+l.width&&a.x+a.width>l.x&&a.y<l.y+l.height&&a.y+a.height>l.y}static isMonsterOnPlatform(a,l){return a.x<l.x+l.width&&a.x+a.width>l.x&&Math.abs(a.y+a.height-l.y)<=2}static findCurrentPlatform(a,l){for(const f of l)if(this.isMonsterOnPlatform(a,f))return f;return null}static isMonsterOnGround(a,l){return Math.abs(a.y+a.height-l.y)<=2}static applyGravity(a){a.velocityY||(a.velocityY=0),a.gravity||(a.gravity=H.GRAVITY),a.velocityY+=a.gravity,a.y+=a.velocityY}static isAtPlatformEdge(a,l,f){return f>0?a.x+a.width>=l.x+l.width-5:a.x<=l.x+5}static hasFallenOffPlatform(a,l){return a.x+a.width<l.x||a.x>l.x+l.width}static determineSpawnSide(a,l){const f=l.x+l.width/2;return a.x<f?"left":"right"}static shouldFall(a,l,f,h,y){return h>=y&&Math.abs(a.x-f)<=10}static isOutsideBoundaries(a,l,f){return l<=0||l+a.width>=H.CANVAS_WIDTH||f<=0||f+a.height>=H.CANVAS_HEIGHT}static clampToBoundaries(a){a.x=Math.max(0,Math.min(a.x,H.CANVAS_WIDTH-a.width)),a.y=Math.max(0,Math.min(a.y,H.CANVAS_HEIGHT-a.height))}static isMovementSafe(a,l,f,h){if(this.isOutsideBoundaries(a,l,f))return!1;for(const y of h)if(this.checkMonsterPlatformCollision({...a,x:l,y:f},y))return!1;return!0}static isMovementSafeWithGround(a,l,f,h,y){if(this.isOutsideBoundaries(a,l,f))return!1;for(const v of h)if(this.checkMonsterPlatformCollision({...a,x:l,y:f},v))return!1;return!(y&&this.checkMonsterPlatformCollision({...a,x:l,y:f},y))}}class bM{update(a,l,f,h){if(f&&f.currentState!=="PLAYING")return;a.type==="HORIZONTAL_PATROL"?this.updateHorizontalPatrol(a,l,h):this.updateVerticalPatrol(a,l,h)}updateHorizontalPatrol(a,l,f){if(!Sx(a))return;const h=ca.getInstance(),y=h.getMonsterScaledValues(a);h.getBaseValues();const v=h.getMonsterAge(a),C=y.patrol.speed;v<2&&Ge.debug(`Patrol scaling - Age: ${v.toFixed(1)}s, Speed: ${C.toFixed(2)}`);const x=f?C*(f/16.67):C,R=a.x+x*a.direction;R<a.patrolStartX||R+a.width>a.patrolEndX?(a.direction*=-1,a.lastDirectionChange=l):a.x=R;const A=Ft.getState(),k=A.platforms||[],_=hi.findCurrentPlatform(a,k);_?(a.y=_.y-a.height,a.velocityY=0,a.isGrounded=!0):this.handleGroundCollision(a,A.ground)}updateVerticalPatrol(a,l,f){if(!Sx(a))return;const h=ca.getInstance(),y=h.getMonsterScaledValues(a);h.getBaseValues(),h.getMonsterAge(a);const v=y.patrol.speed;if(!a.originalSpawnX){const A=Ft.getState().platforms||[],k=a.patrolSide||"left",_=a.targetPlatformX,N=A.find(z=>z.isVertical&&Math.abs(z.x-_)<1);N&&(a.originalSpawnX=k==="left"?N.x-a.width-8:N.x+8+N.width,a.x=a.originalSpawnX)}const C=f?v*(f/16.67):v,x=a.y+C*a.direction;x<a.patrolStartY||x+a.height>a.patrolEndY?(a.direction*=-1,a.lastDirectionChange=l):a.y=x,a.originalSpawnX!==void 0?(a.x=a.originalSpawnX,a.velocityX=0,a.velocityY=0,a.isGrounded=!1):(a.velocityX=0,a.velocityY=0,a.isGrounded=!1)}handleGroundCollision(a,l){if(!l)return;a.x<l.x+l.width&&a.x+a.width>l.x&&a.y<l.y+l.height&&a.y+a.height>l.y&&(a.y=l.y-a.height,a.velocityY=0,a.isGrounded=!0)}}class xM{update(a,l,f,h){if(!SM(a)||f.currentState!=="PLAYING")return;const y=f.player;if(!y)return;const v=ca.getInstance(),C=v.getMonsterScaledValues(a);v.getBaseValues();const x=v.getMonsterAge(a);if(x<2&&Ge.debug(`Chaser scaling - Age: ${x.toFixed(1)}s, Speed: ${C.chaser.speed.toFixed(2)}`),!a.behaviorState){a.behaviorState="chasing",a.lastDirectionChange=l,a.chaseTargetX=y.x,a.chaseTargetY=y.y,a.updateIntervalMultiplier=.8+Math.random()*.4,a.directnessMultiplier=.85+Math.random()*.3,a.speedMultiplier=.9+Math.random()*.2;const ue=(Math.random()-.5)*50,ce=(Math.random()-.5)*50;a.chaseTargetX=y.x+ue,a.chaseTargetY=y.y+ce,a.lastDirectionChange=l+Math.random()*C.chaser.updateInterval}const R=f.platforms||[],A=C.chaser.directness*(a.directnessMultiplier||1),k=C.chaser.updateInterval*(a.updateIntervalMultiplier||1);if(l-(a.lastDirectionChange||l)>k){const ue=a.chaseTargetX||a.x,ce=a.chaseTargetY||a.y,fe=Math.random()<.3,le=fe?(Math.random()-.5)*15:0,Re=fe?(Math.random()-.5)*15:0;a.chaseTargetX=ue+(y.x+le-ue)*A,a.chaseTargetY=ce+(y.y+Re-ce)*A,a.lastDirectionChange=l}const N=a.chaseTargetX||a.x,z=a.chaseTargetY||a.y,G=N-a.x,J=z-a.y,de=Math.sqrt(G*G+J*J);if(de>20){const ue=C.chaser.speed*(a.speedMultiplier||1),ce=h?ue*(h/16.67):ue,fe=Math.sign(G)*ce,le=Math.sign(J)*ce;this.applyMovement(a,fe,le,N,z,R,f.ground)}else if(de>5){const ue=C.chaser.speed*(a.speedMultiplier||1)*.5,ce=h?ue*(h/16.67):ue,fe=Math.sign(G)*ce,le=Math.sign(J)*ce;this.applyMovement(a,fe,le,N,z,R,f.ground)}}applyMovement(a,l,f,h,y,v,C){const x=a.x+l,R=a.y+f,A=hi.isMovementSafe(a,x,a.y,v),k=hi.isMovementSafe(a,a.x,R,v);A&&(a.x=x),k&&(a.y=R),this.handleGroundCollision(a,C),!A&&!k&&this.findAlternativePath(a,h,y,v)}findAlternativePath(a,l,f,h){const y=l-a.x,v=f-a.y,C=Math.random();if((Math.abs(y)>Math.abs(v)?C>.7?"vertical":"horizontal":C>.7?"horizontal":"vertical")==="horizontal"){const R=Math.random()>.5?[1,-1]:[-1,1];for(const N of R){const z=a.y+N*a.speed;let G=!0;for(const J of h)if(hi.checkMonsterPlatformCollision({...a,y:z},J)){G=!1;break}if(G){a.y=z;return}}const A=Math.sign(y)*-1,k=a.x+A*a.speed;let _=!0;for(const N of h)if(hi.checkMonsterPlatformCollision({...a,x:k},N)){_=!1;break}if(_){a.x=k;return}}else{const R=Math.random()>.5?[1,-1]:[-1,1];for(const N of R){const z=a.x+N*a.speed;let G=!0;for(const J of h)if(hi.checkMonsterPlatformCollision({...a,x:z},J)){G=!1;break}if(G){a.x=z;return}}const A=Math.sign(v)*-1,k=a.y+A*a.speed;let _=!0;for(const N of h)if(hi.checkMonsterPlatformCollision({...a,y:k},N)){_=!1;break}if(_){a.y=k;return}}this.tryRandomMovement(a,h)}handleGroundCollision(a,l){if(!l)return;a.x<l.x+l.width&&a.x+a.width>l.x&&a.y<l.y+l.height&&a.y+a.height>l.y&&(a.y=l.y-a.height,a.velocityY=0,a.isGrounded=!0)}tryRandomMovement(a,l){const f=[{x:1,y:0},{x:-1,y:0},{x:0,y:1},{x:0,y:-1},{x:1,y:1},{x:-1,y:1},{x:1,y:-1},{x:-1,y:-1}];for(let h=f.length-1;h>0;h--){const y=Math.floor(Math.random()*(h+1));[f[h],f[y]]=[f[y],f[h]]}for(const h of f){const y=a.x+h.x*a.speed,v=a.y+h.y*a.speed;let C=!0;for(const x of l)if(hi.checkMonsterPlatformCollision({...a,x:y,y:v},x)){C=!1;break}if(C){a.x=y,a.y=v;return}}}}class CM{update(a,l,f,h){if(!wM(a)||f.currentState!=="PLAYING")return;const y=f.player;if(!y)return;const v=ca.getInstance(),C=v.getMonsterScaledValues(a);v.getBaseValues();const x=v.getMonsterAge(a);x<2&&Ge.debug(`Ambusher scaling - Age: ${x.toFixed(1)}s, Speed: ${C.ambusher.speed.toFixed(2)}`),a.behaviorState||(a.behaviorState="wandering",a.lastDirectionChange=l,a.ambushCooldown=2e3);const R=f.platforms||[];if(a.behaviorState==="wandering"){(!a.targetX||!a.targetY)&&this.chooseNewWanderingDirection(a,l),l-(a.lastDirectionChange||l)>2e3+Math.random()*2e3&&this.chooseNewWanderingDirection(a,l);const k=C.ambusher.speed*.5,_=h?k*(h/16.67):k,N=a.targetX||a.x,z=a.targetY||a.y,G=N-a.x,J=z-a.y,de=Math.sqrt(G*G+J*J);if(de>5){const ue=G/de,ce=J/de,fe=a.x+_*ue,le=a.y+_*ce;hi.isMovementSafeWithGround(a,fe,le,R,f.ground)?(a.x=fe,a.y=le):this.chooseNewWanderingDirection(a,l)}else this.chooseNewWanderingDirection(a,l);a.ambushCooldown+=h||16,a.ambushCooldown>=C.ambusher.ambushInterval&&(a.behaviorState="ambushing",a.lastDirectionChange=l,a.ambushCooldown=0,a.ambushTargetX=y.x,a.ambushTargetY=y.y,Ge.debug(`Ambusher switching to ambush mode, targeting player at (${a.ambushTargetX}, ${a.ambushTargetY})`))}else if(a.behaviorState==="ambushing"){const A=C.ambusher.speed*3,k=h?A*(h/16.67):A,_=a.ambushTargetX||a.x,N=a.ambushTargetY||a.y,z=Math.sqrt((_-a.x)**2+(N-a.y)**2);if(z>5){const G=_-a.x,J=N-a.y,de=G/z,ue=J/z,ce=a.x+k*de,fe=a.y+k*ue;hi.isMovementSafeWithGround(a,ce,fe,R,f.ground)?(a.x=ce,a.y=fe):(a.behaviorState="wandering",a.lastDirectionChange=l,Ge.debug("Ambusher blocked, returning to wandering"))}else a.behaviorState="wandering",a.lastDirectionChange=l,Ge.debug("Ambusher reached target, returning to wandering")}}chooseNewWanderingDirection(a,l){const f=[{x:1,y:0},{x:-1,y:0},{x:0,y:1},{x:0,y:-1},{x:1,y:1},{x:-1,y:1},{x:1,y:-1},{x:-1,y:-1}],h=f[Math.floor(Math.random()*f.length)],y=50+Math.random()*100,v=Math.max(0,Math.min(a.x+h.x*y,H.CANVAS_WIDTH-a.width)),C=Math.max(0,Math.min(a.y+h.y*y,H.CANVAS_HEIGHT-a.height));a.targetX=v,a.targetY=C,a.lastDirectionChange=l}}class EM{update(a,l,f,h){if(f&&f.currentState!=="PLAYING")return;const y=ca.getInstance(),v=y.getMonsterScaledValues(a);y.getBaseValues();const C=y.getMonsterAge(a);C<2&&Ge.debug(`Floater scaling - Age: ${C.toFixed(1)}s, Speed: ${v.floater.speed.toFixed(2)}`),!a.velocityX&&!a.velocityY&&this.initializeVelocity(a,v.floater.speed);const x=Math.sqrt(a.velocityX*a.velocityX+a.velocityY*a.velocityY);if(x>0){const J=v.floater.speed/x;a.velocityX*=J,a.velocityY*=J}const R=h?h/16.67:1,A=a.x+a.velocityX*R,k=a.y+a.velocityY*R,_=Ft.getState(),N=_.platforms||[];let z=!0,G={x:0,y:0};for(const J of N)if(hi.checkMonsterPlatformCollision({...a,x:A,y:k},J)){z=!1,G=this.calculateCollisionNormal(a,J);break}(A<=0||A+a.width>=H.CANVAS_WIDTH||k<=0||k+a.height>=H.CANVAS_HEIGHT)&&(z=!1,G=this.calculateBoundaryCollisionNormal(a,A,k)),_.ground&&hi.checkMonsterPlatformCollision({...a,x:A,y:k},_.ground)&&(z=!1,G=this.calculateCollisionNormal(a,_.ground)),z?(a.x=A,a.y=k):this.bounceOffCollision(a,G,v.floater.bounceAngle)}initializeVelocity(a,l){if(a.type!=="FLOATER")return;const h=(a.startAngle||45)*Math.PI/180;a.velocityX=Math.cos(h)*l,a.velocityY=Math.sin(h)*l}calculateCollisionNormal(a,l){const f=a.x+a.width/2,h=a.y+a.height/2,y=Math.max(l.x,Math.min(f,l.x+l.width)),v=Math.max(l.y,Math.min(h,l.y+l.height)),C=f-y,x=h-v,R=Math.sqrt(C*C+x*x);if(R>.1)return{x:C/R,y:x/R};{const A=Math.abs(a.x+a.width-l.x),k=Math.abs(a.x-(l.x+l.width)),_=Math.abs(a.y+a.height-l.y),N=Math.abs(a.y-(l.y+l.height)),z=Math.min(A,k,_,N);return z===A?{x:-1,y:0}:z===k?{x:1,y:0}:z===_?{x:0,y:-1}:{x:0,y:1}}}calculateBoundaryCollisionNormal(a,l,f){return l<=0?{x:1,y:0}:l+a.width>=H.CANVAS_WIDTH?{x:-1,y:0}:f<=0?{x:0,y:1}:{x:0,y:-1}}bounceOffCollision(a,l,f){const h=a.velocityX*l.x+a.velocityY*l.y;a.velocityX=a.velocityX-2*h*l.x,a.velocityY=a.velocityY-2*h*l.y;const y=(Math.random()-.5)*f,v=Math.sqrt(a.velocityX*a.velocityX+a.velocityY*a.velocityY),x=Math.atan2(a.velocityY,a.velocityX)+y;a.velocityX=Math.cos(x)*v,a.velocityY=Math.sin(x)*v}}class TM{constructor(){be(this,"patrolMovement");be(this,"chaserMovement");be(this,"ambusherMovement");be(this,"floaterMovement");this.patrolMovement=new bM,this.chaserMovement=new xM,this.ambusherMovement=new CM,this.floaterMovement=new EM}updateMonsterBehaviors(a,l,f){l.monsters&&l.monsters.forEach(h=>{if(!(!h.isActive||h.isFrozen)){switch(h.type){case kn.HORIZONTAL_PATROL:case kn.VERTICAL_PATROL:this.patrolMovement.update(h,a,l,f);break;case kn.CHASER:this.chaserMovement.update(h,a,l,f);break;case kn.AMBUSHER:this.ambusherMovement.update(h,a,l,f);break;case kn.FLOATER:this.floaterMovement.update(h,a,l,f);break}hi.clampToBoundaries(h)}})}}class RM{constructor(){be(this,"levelStartTime",0);be(this,"scheduledSpawns",[]);be(this,"behaviorManager");be(this,"pauseState");be(this,"lastUpdateTime",0);be(this,"updateInterval",16);this.behaviorManager=new TM,this.pauseState=this.createPauseState()}initializeLevel(a){this.levelStartTime=Date.now(),this.scheduledSpawns=this.createScheduledSpawns(a),this.resetPauseState(),Ge.flow(`Level initialized with ${a.length} spawn points`),this.scheduledSpawns.forEach((l,f)=>{const h=(l.scheduledTime-this.levelStartTime)/1e3;try{const y=l.spawnPoint.createMonster();Ge.debug(`Scheduled spawn ${f}: ${y.type} at ${h.toFixed(1)}s`)}catch(y){Ge.error(`Failed to create monster for spawn ${f}: ${y}`)}})}createScheduledSpawns(a){return a.map((l,f)=>({id:`spawn-${f}`,spawnPoint:l,scheduledTime:this.levelStartTime+l.spawnDelay,executed:!1}))}resetPauseState(){this.pauseState=this.createPauseState()}createPauseState(){return{isPaused:!1,pauseStartTime:0,totalPausedTime:0,pauseReasons:new Set}}update(a,l){if(this.pauseState.isPaused)return;const f=Ft.getState(),h=this.getAdjustedTime();Math.floor(h/5e3)!==Math.floor((h-16)/5e3)&&Ge.debug(`SpawnManager.update() called at ${(h/1e3).toFixed(1)}s, paused: ${this.pauseState.isPaused}, spawns: ${this.scheduledSpawns.length}`),this.processSpawns(a,f),f.monsters.some(y=>y.isActive)&&this.behaviorManager.updateMonsterBehaviors(a,f,l)}processSpawns(a,l){const f=this.getAdjustedTime(),h=this.getAdjustedAbsoluteTime(),y=[];if(Math.floor(f/5e3)!==Math.floor((f-16)/5e3)){const v=this.scheduledSpawns.filter(C=>!C.executed);Ge.info(`Spawn check at ${(f/1e3).toFixed(1)}s: ${v.length} pending spawns`),v.forEach(C=>{const x=(C.scheduledTime-h)/1e3;try{const R=C.spawnPoint.createMonster();Ge.info(` - ${R.type} in ${x.toFixed(1)}s (scheduled: ${C.scheduledTime}, current: ${h})`)}catch(R){Ge.error(` - Failed to create monster: ${R}`)}})}for(const v of this.scheduledSpawns)!v.executed&&h>=v.scheduledTime&&(y.push(v),Ge.info(`Spawn ready to execute: ${v.spawnPoint.createMonster().type} (scheduled at ${(v.scheduledTime/1e3).toFixed(1)}s, current time ${(f/1e3).toFixed(1)}s)`));y.length>0&&(Ge.info(`Executing ${y.length} spawns at ${(f/1e3).toFixed(1)}s`),this.executeSpawns(y,a,l))}executeSpawns(a,l,f){const h=[];for(const y of a)try{const v=this.createMonster(y.spawnPoint);h.push(v),y.executed=!0,Ge.monster(`Spawned ${v.type} at (${v.x}, ${v.y})`)}catch(v){Ge.error(`Failed to spawn monster: ${v}`)}h.length>0&&(this.addMonstersToGameState(h,f),Ge.debug(`Added ${h.length} monsters to game state`))}createMonster(a){const l=a.createMonster();return a.color&&(l.color=a.color),l.originalSpawnPoint||(l.originalSpawnPoint={x:l.x,y:l.y}),l}addMonstersToGameState(a,l){if(l.updateMonsters){const h=[...l.monsters||[],...a];l.updateMonsters(h)}else Ge.warn("Game state updateMonsters method is not available")}pause(a="default"){this.pauseState.isPaused||(this.pauseState.isPaused=!0,this.pauseState.pauseStartTime=Date.now()),this.pauseState.pauseReasons.add(a),Ge.pause(`Spawning paused (${a})`),Ge.debug(`SpawnManager pause state: ${this.pauseState.isPaused}, reasons: ${Array.from(this.pauseState.pauseReasons).join(", ")}`)}resume(a="default"){if(this.pauseState.pauseReasons.delete(a),this.pauseState.pauseReasons.size===0&&this.pauseState.isPaused){const l=Date.now()-this.pauseState.pauseStartTime;this.pauseState.totalPausedTime+=l,this.pauseState.isPaused=!1,Ge.pause(`Spawning resumed (paused for ${(l/1e3).toFixed(1)}s)`)}Ge.debug(`SpawnManager pause state: ${this.pauseState.isPaused}, reasons: ${Array.from(this.pauseState.pauseReasons).join(", ")}`)}isPaused(){return this.pauseState.isPaused}getPauseStatus(){return{isPaused:this.pauseState.isPaused,pauseReasons:Array.from(this.pauseState.pauseReasons),totalPausedTime:this.pauseState.totalPausedTime}}getAdjustedTime(){return Date.now()-this.levelStartTime-this.pauseState.totalPausedTime}getAdjustedAbsoluteTime(){return this.levelStartTime+this.getAdjustedTime()}removeMonster(a){a.isActive=!1;const l=Ft.getState();if(l.updateMonsters){const h=(l.monsters||[]).filter(y=>y!==a);l.updateMonsters(h)}}reset(){this.levelStartTime=Date.now(),this.scheduledSpawns.forEach(a=>a.executed=!1),this.resetPauseState(),this.lastUpdateTime=0}getSpawnStatus(){const a=this.scheduledSpawns.filter(h=>h.executed).length,l=this.scheduledSpawns.filter(h=>!h.executed).length,f=this.getAdjustedTime();return{totalSpawnPoints:this.scheduledSpawns.length,executedCount:a,pendingCount:l,isPaused:this.pauseState.isPaused,pauseReasons:Array.from(this.pauseState.pauseReasons),adjustedTime:f/1e3,levelStartTime:this.levelStartTime,totalPausedTime:this.pauseState.totalPausedTime}}getSpawnTimeRemaining(a){if(a.executed)return 0;const l=this.getAdjustedAbsoluteTime();return Math.max(0,a.scheduledTime-l)}getPendingSpawns(){return this.scheduledSpawns.filter(a=>!a.executed)}setUpdateInterval(a){this.updateInterval=a,Ge.debug(`OptimizedSpawnManager: Update interval set to ${a}ms`)}cleanup(){this.scheduledSpawns=[],this.resetPauseState(),this.lastUpdateTime=0}}class MM{constructor(){be(this,"audioContext",null);be(this,"backgroundMusicGain",null);be(this,"isBackgroundMusicPlaying",!1);be(this,"backgroundMusicBuffer",null);be(this,"backgroundMusicSource",null);this.initializeAudioContext(),this.loadBackgroundMusic()}initializeAudioContext(){try{this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.backgroundMusicGain=this.audioContext.createGain(),this.backgroundMusicGain.connect(this.audioContext.destination),this.updateAudioVolumes()}catch(a){Pe.warn("Web Audio API not supported:",a)}}async loadBackgroundMusic(){if(this.audioContext)try{const l=await(await fetch(`${Il.audio}/background-music.wav`)).arrayBuffer();this.backgroundMusicBuffer=await this.audioContext.decodeAudioData(l)}catch(a){Pe.warn("Failed to load background music:",a)}}ensureAudioContext(){this.audioContext?.state==="suspended"&&this.audioContext.resume()}playSound(a,l){switch(this.ensureAudioContext(),a){case ua.BOMB_COLLECT:this.playBombCollectSound();break;case ua.MONSTER_HIT:this.playMonsterHitSound();break;case ua.MAP_CLEARED:this.playMapClearedSound();break;case ua.BONUS_SCREEN:Pe.audio("Bonus sound"),this.playBonusSound();break;case ua.COIN_COLLECT:this.playCoinCollectSound();break;case ua.POWER_COIN_ACTIVATE:this.playPowerCoinActivateSound();break;case ua.BACKGROUND_MUSIC:l===ot.PLAYING&&this.startBackgroundMusic();break;default:Pe.debug(`Audio event ${a} not implemented yet`)}}stopBackgroundMusic(){if(this.isBackgroundMusicPlaying=!1,this.backgroundMusicSource){try{this.backgroundMusicSource.stop()}catch{}this.backgroundMusicSource=null}}playBombCollectSound(){if(!this.audioContext)return;const a=this.audioContext.createOscillator(),l=this.audioContext.createGain();a.connect(l),l.connect(this.audioContext.destination),a.type="square",a.frequency.setValueAtTime(800,this.audioContext.currentTime),a.frequency.exponentialRampToValueAtTime(1200,this.audioContext.currentTime+.1);const f=this.getSFXVolume();l.gain.setValueAtTime(.3*f,this.audioContext.currentTime),l.gain.exponentialRampToValueAtTime(.01,this.audioContext.currentTime+.2),a.start(),a.stop(this.audioContext.currentTime+.2)}playMonsterHitSound(){if(!this.audioContext)return;const a=this.audioContext.createOscillator(),l=this.audioContext.createGain();a.connect(l),l.connect(this.audioContext.destination),a.type="sawtooth",a.frequency.setValueAtTime(200,this.audioContext.currentTime),a.frequency.exponentialRampToValueAtTime(50,this.audioContext.currentTime+.3);const f=this.getSFXVolume();l.gain.setValueAtTime(.4*f,this.audioContext.currentTime),l.gain.exponentialRampToValueAtTime(.01,this.audioContext.currentTime+.3),a.start(),a.stop(this.audioContext.currentTime+.3)}playMapClearedSound(){if(!this.audioContext)return;const a=[523.25,587.33,659.25,698.46,783.99];let l=this.audioContext.currentTime;const f=this.getSFXVolume();a.forEach((h,y)=>{const v=this.audioContext.createOscillator(),C=this.audioContext.createGain();v.connect(C),C.connect(this.audioContext.destination),v.type="triangle",v.frequency.setValueAtTime(h,l),C.gain.setValueAtTime(.3*f,l),C.gain.exponentialRampToValueAtTime(.01,l+.3),v.start(l),v.stop(l+.3),l+=.15})}playBonusSound(){if(!this.audioContext)return;const a=[659.25,783.99,1046.5,783.99,1046.5];let l=this.audioContext.currentTime;const f=this.getSFXVolume();a.forEach((h,y)=>{const v=this.audioContext.createOscillator(),C=this.audioContext.createGain();v.connect(C),C.connect(this.audioContext.destination),v.type="sine",v.frequency.setValueAtTime(h,l),C.gain.setValueAtTime(.2*f,l),C.gain.exponentialRampToValueAtTime(.01,l+.4),v.start(l),v.stop(l+.4),l+=.2})}playCoinCollectSound(){if(!this.audioContext)return;const a=this.audioContext.createOscillator(),l=this.audioContext.createGain();a.connect(l),l.connect(this.audioContext.destination),a.type="sine",a.frequency.setValueAtTime(1e3,this.audioContext.currentTime),a.frequency.exponentialRampToValueAtTime(1500,this.audioContext.currentTime+.1);const f=this.getSFXVolume();l.gain.setValueAtTime(.3*f,this.audioContext.currentTime),l.gain.exponentialRampToValueAtTime(.01,this.audioContext.currentTime+.15),a.start(),a.stop(this.audioContext.currentTime+.15)}playPowerCoinActivateSound(){if(!this.audioContext)return;const a=this.audioContext.currentTime,l=this.getSFXVolume(),f=this.audioContext.createOscillator(),h=this.audioContext.createGain();f.connect(h),h.connect(this.audioContext.destination),f.type="square",f.frequency.setValueAtTime(200,a),f.frequency.exponentialRampToValueAtTime(400,a+.3),h.gain.setValueAtTime(.2*l,a),h.gain.exponentialRampToValueAtTime(.01,a+.5),f.start(a),f.stop(a+.5);const y=this.audioContext.createOscillator(),v=this.audioContext.createGain();y.connect(v),v.connect(this.audioContext.destination),y.type="sine",y.frequency.setValueAtTime(800,a),y.frequency.exponentialRampToValueAtTime(1200,a+.2),v.gain.setValueAtTime(.15*l,a),v.gain.exponentialRampToValueAtTime(.01,a+.3),y.start(a),y.stop(a+.3)}startBackgroundMusic(){!this.audioContext||this.isBackgroundMusicPlaying||!this.backgroundMusicBuffer||(this.isBackgroundMusicPlaying=!0,this.playBackgroundMusicFile())}playBackgroundMusicFile(){if(!(!this.audioContext||!this.backgroundMusicGain||!this.backgroundMusicBuffer||!this.isBackgroundMusicPlaying))try{this.backgroundMusicSource=this.audioContext.createBufferSource(),this.backgroundMusicSource.buffer=this.backgroundMusicBuffer,this.backgroundMusicSource.connect(this.backgroundMusicGain),this.backgroundMusicSource.loop=!0,this.backgroundMusicSource.onended=()=>{this.isBackgroundMusicPlaying&&setTimeout(()=>{this.isBackgroundMusicPlaying&&this.playBackgroundMusicFile()},100)},this.backgroundMusicSource.start()}catch(a){Pe.warn("Failed to play background music file:",a)}}cleanup(){this.stopBackgroundMusic(),this.audioContext&&this.audioContext.close()}updateAudioVolumes(){const a=Ft.getState().audioSettings;if(this.backgroundMusicGain){const l=a.masterMuted||a.musicMuted?0:a.masterVolume/100*(a.musicVolume/100);this.backgroundMusicGain.gain.value=l}}getSFXVolume(){const a=Ft.getState().audioSettings;return a.masterMuted||a.sfxMuted?0:a.masterVolume/100*(a.sfxVolume/100)}updateVolumes(){this.updateAudioVolumes()}}class kM{constructor(a){be(this,"sprite");be(this,"currentState");be(this,"wasInAir",!1);be(this,"isLanding",!1);be(this,"isMapCleared",!1);be(this,"mapClearedFallComplete",!1);this.sprite=a,this.currentState={isGrounded:!0,isMoving:!1,isFloating:!1,gameState:"",moveDirection:"none",lastDirection:"right"}}update(a,l,f=!1,h=""){const y={isGrounded:a,isMoving:l!==0,isFloating:f,gameState:h,moveDirection:l>0?"right":l<0?"left":"none",lastDirection:this.getLastDirection()};h==="MAP_CLEARED"&&!this.isMapCleared&&(this.isMapCleared=!0,this.mapClearedFallComplete=!1,a&&(this.mapClearedFallComplete=!0)),this.isLanding&&this.sprite.currentAnimation.name.includes("land")&&this.sprite.currentFrameIndex>=this.sprite.currentAnimation.frames.length-1&&(this.isLanding=!1,this.isMapCleared&&(this.mapClearedFallComplete=!0));const v=this.wasInAir&&a;this.currentState=y,this.wasInAir=!a,v&&!this.isLanding&&this.isMapCleared?this.setLandingAnimation():v&&!this.isLanding?this.setLandingAnimation():this.isLanding||this.updateAnimation()}getLastDirection(){return this.sprite.currentAnimation.name.includes("right")?"right":"left"}updateAnimation(){const{isGrounded:a,isMoving:l,isFloating:f,gameState:h,moveDirection:y,lastDirection:v}=this.currentState;this.isMapCleared?this.mapClearedFallComplete?this.sprite.setAnimation("ghost-complete"):a?(this.mapClearedFallComplete=!0,this.sprite.setAnimation("ghost-complete")):this.handleAirAnimations(y,v):h==="MAP_CLEARED"?(this.isMapCleared=!0,this.mapClearedFallComplete=!1,this.handleAirAnimations(y,v)):f?this.handleFloatAnimations(y,v):a?l?this.handleWalkAnimations(y):this.handleIdleAnimations(v):this.handleAirAnimations(y,v)}handleAirAnimations(a,l){if(a==="right")this.sprite.setAnimationPreserveFrame("jump-right");else if(a==="left")this.sprite.setAnimationPreserveFrame("jump-left");else{const f=l==="right"?"jump-right":"jump-left";this.sprite.setAnimationPreserveFrame(f)}}handleFloatAnimations(a,l){a==="right"?this.sprite.setAnimation("float-right"):a==="left"?this.sprite.setAnimation("float-left"):this.sprite.setAnimation("float-stationary")}handleWalkAnimations(a){a==="right"?this.sprite.setAnimation("walk-right"):a==="left"&&this.sprite.setAnimation("walk-left")}handleIdleAnimations(a){const l=a==="right"?"idle-right":"idle-left";this.sprite.setAnimation(l)}setLandingAnimation(){const{lastDirection:a}=this.currentState,l=a==="right"?"land-right":"land-left";this.sprite.setAnimation(l),this.isLanding=!0}getCurrentState(){return{...this.currentState}}reset(){this.isMapCleared=!1,this.mapClearedFallComplete=!1,this.isLanding=!1,this.wasInAir=!1}}class _M{constructor(a){be(this,"inputManager");be(this,"collisionManager");be(this,"renderManager");be(this,"monsterSpawnManager");be(this,"audioManager");be(this,"animationController");be(this,"scalingManager");be(this,"monsterRespawnManager");be(this,"animationFrameId",null);be(this,"lastTime",0);be(this,"isBackgroundMusicPlaying",!1);be(this,"previousGameState",null);be(this,"devModeInitialized",!1);be(this,"boundGameLoop");be(this,"wasGroundedWhenMapCleared",!1);be(this,"mapStartTime",0);this.inputManager=new sM,this.collisionManager=new uM,this.renderManager=new yM(a),this.audioManager=new MM,this.animationController=new kM(Sp),this.scalingManager=ca.getInstance(),this.monsterRespawnManager=zv.getInstance(),this.monsterSpawnManager=new RM,this.boundGameLoop=this.gameLoop.bind(this);const l=Ft.getState();"setAudioManager"in l&&l.setAudioManager(this.audioManager)}start(){{const a=Ft.getState();a.resetGame(),"setGameStartTime"in a&&a.setGameStartTime(Date.now()),this.loadCurrentLevel()}FR(),this.gameLoop(0)}initializeDevMode(){const a=Ft.getState();a.resetGameState(),a.addScore(Ya.MOCK_DATA.score);const l=a.lives,f=Ya.MOCK_DATA.lives;if(f<l){for(let y=0;y<l-f;y++)a.loseLife();a.setState(ot.MENU)}const h=Ya.TARGET_LEVEL;{a.resetLevelState();for(let y=1;y<h;y++)a.nextLevel()}switch(this.loadCurrentLevel(),Ya.TARGET_STATE){case"START_MENU":a.setState(ot.MENU),a.setMenuType(Pt.START);break;case"COUNTDOWN":a.setState(ot.COUNTDOWN),a.setMenuType(Pt.COUNTDOWN);break;case"PLAYING":a.setState(ot.PLAYING),a.setMenuType(Pt.IN_GAME);break;case"PAUSED":a.setState(ot.PAUSED),a.setMenuType(Pt.PAUSE);break;case"SETTINGS":a.setState(ot.MENU),a.setMenuType(Pt.SETTINGS);break;case"BONUS":a.setState(ot.BONUS),a.setMenuType(Pt.BONUS),a.resetBombState();for(let y=0;y<Ya.MOCK_DATA.correctOrderCount;y++)a.collectBomb(y+1);break;case"VICTORY":a.setState(ot.VICTORY),a.setMenuType(Pt.VICTORY);break;case"GAME_OVER":a.setState(ot.GAME_OVER),a.setMenuType(Pt.GAME_OVER);break;default:Pe.warn(`Unknown DEV_MODE target state: ${Ya.TARGET_STATE}`),a.setState(ot.MENU),a.setMenuType(Pt.START)}Pe.dev(`DEV_MODE: Setting multiplier to ${Ya.MOCK_DATA.multiplier}x with ${Ya.MOCK_DATA.multiplierScore} progress`),a.setMultiplier(Ya.MOCK_DATA.multiplier,Ya.MOCK_DATA.multiplierScore),Pe.dev(`DEV_MODE initialized with state: ${Ya.TARGET_STATE}, level: ${Ya.TARGET_LEVEL}`),this.devModeInitialized=!0}stop(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.audioManager.stopBackgroundMusic(),this.isBackgroundMusicPlaying=!1}loadCurrentLevel(){const a=Ft.getState(),l=a.currentLevel;if(l<=vf.length){const f=vf[l-1];if(a.initializeLevel(f),a.clearAllFloatingTexts(),this.animationController.reset(),this.scalingManager.startMap(),this.renderManager.loadMapBackground(f.name),f.monsterSpawnPoints?(Pe.info(`GameManager: Initializing MonsterSpawnManager with ${f.monsterSpawnPoints.length} spawn points`),this.monsterSpawnManager.initializeLevel(f.monsterSpawnPoints)):(Pe.info("GameManager: Initializing MonsterSpawnManager with no spawn points"),this.monsterSpawnManager.initializeLevel([])),this.monsterRespawnManager.reset(),f.monsters){const h=f.monsters.map(y=>({...y,originalSpawnPoint:{x:y.x,y:y.y}}));a.updateMonsters(h),Pe.debug(`Set up original spawn points for ${h.length} static monsters`)}a.resetCoinState(),Pe.debug("Coins reset when loading new level"),this.mapStartTime=Date.now()}}gameLoop(a){const l=a-this.lastTime;this.lastTime=a;const f=Ft.getState();if(this.handleBackgroundMusic(f.currentState),this.handleDifficultyPause(f.currentState),f.currentState===ot.MENU&&!f.currentMap&&this.loadCurrentLevel(),f.currentState===ot.BONUS&&f.bonusAnimationComplete&&(setTimeout(()=>{this.proceedToNextLevel()},2e3),f.setBonusAnimationComplete(!1)),f.currentState===ot.PLAYING)this.update(l),Sp.update(l),this.handleCollisions(),this.checkWinCondition();else if(f.currentState===ot.MAP_CLEARED){Sp.update(l);const h=f.player;if(!this.wasGroundedWhenMapCleared){const y={...h};y.velocityY+=h.gravity,y.y+=y.velocityY;const v=f.ground;if(v){const C=this.collisionManager.checkPlayerGroundCollision(y,v);C.hasCollision&&C.normal&&C.penetration&&C.normal.y===-1&&(y.y=y.y-C.penetration,y.velocityY=0,y.isGrounded=!0)}f.updatePlayer(y)}this.animationController.update(h.isGrounded,0,!1,f.currentState)}this.render(),this.animationFrameId=requestAnimationFrame(this.boundGameLoop)}handleDifficultyPause(a){a===ot.PLAYING?(this.scalingManager.isCurrentlyPausedByPowerMode()||this.scalingManager.resume(),this.scalingManager.resumeAllMonsterScaling(),this.monsterSpawnManager.resume(),this.monsterRespawnManager.resume()):(this.scalingManager.pause(),this.scalingManager.pauseAllMonsterScaling(),this.monsterSpawnManager.pause(),this.monsterRespawnManager.pause())}handleBackgroundMusic(a){const l=a===ot.PLAYING;this.previousGameState!==a&&Pe.audio(`Game state changed: ${this.previousGameState} -> ${a}`),l&&!this.isBackgroundMusicPlaying&&(Pe.audio("Starting background music"),this.audioManager.playSound(ua.BACKGROUND_MUSIC,a),this.isBackgroundMusicPlaying=!0),!l&&this.isBackgroundMusicPlaying&&(Pe.audio("Stopping background music"),this.audioManager.stopBackgroundMusic(),this.isBackgroundMusicPlaying=!1),this.previousGameState=a}update(a){this.updatePlayer(a),this.updateMonsters(a),this.updateCoins(a)}updatePlayer(a){const l=Ft.getState();let f={...l.player};if(this.inputManager.isKeyPressed("p")||this.inputManager.isKeyPressed("P")){l.currentState===ot.PLAYING&&(l.setState(ot.PAUSED),l.setMenuType(Pt.PAUSE));return}let h=0;this.inputManager.isKeyPressed("ArrowLeft")&&(h=-f.moveSpeed),this.inputManager.isKeyPressed("ArrowRight")&&(h=f.moveSpeed),this.animationController.update(f.isGrounded,h,f.isFloating,l.currentState);const y=this.inputManager.isKeyPressed("ArrowUp"),v=this.inputManager.isShiftPressed(),C=this.inputManager.isKeyPressed(" ")||this.inputManager.isKeyPressed("Space");if(y&&f.isGrounded&&!f.isJumping){f.isJumping=!0,f.jumpStartTime=Date.now(),f.isGrounded=!1;const k=v?H.SUPER_JUMP_POWER:H.JUMP_POWER;f.velocityY=-k*.6}if(y&&f.isJumping&&f.velocityY<0){const k=Date.now()-f.jumpStartTime;if(k<=H.MAX_JUMP_DURATION){const _=Math.min(k/H.MAX_JUMP_DURATION,1),z=-(v?H.SUPER_JUMP_POWER:H.JUMP_POWER)*(.6+.4*_);f.velocityY>z&&(f.velocityY=z)}}(!y||Date.now()-f.jumpStartTime>H.MAX_JUMP_DURATION)&&f.isJumping&&(f.isJumping=!1),C&&!f.isGrounded?(f.isFloating||(f.velocityY=0),f.isFloating=!0):f.isFloating=!1,f.velocityX=h,f.x+=f.velocityX;const x=f.isFloating&&f.velocityY>=0?f.floatGravity:f.gravity;f.velocityY+=x,f.y+=f.velocityY;const R={width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT},A=this.collisionManager.resolveBoundaryCollision(f,R);if(A.fellOffScreen){l.loseLife();return}f=A.player,f.isGrounded=!1,l.updatePlayer(f)}updateMonsters(a){const l=Date.now(),f=(l-this.mapStartTime)/1e3;Math.floor(f/5)!==Math.floor((f-a/1e3)/5)&&Pe.debug(`GameManager.updateMonsters() called at ${f.toFixed(1)}s`),this.monsterSpawnManager.update(l,a);const h=this.monsterRespawnManager.update(),y=Ft.getState();let v=y.monsters;h.length>0&&(v=[...v,...h],Pe.debug(`Added ${h.length} respawned monsters to active list: ${h.map(x=>x.type).join(", ")}`));const C=this.monsterRespawnManager.getDeadMonsterCount();C>0&&Pe.debug(`Respawn system: ${C} monsters waiting to respawn`),y.updateMonsters(v)}updateCoins(a){const l=Ft.getState(),f=l.currentMap?.platforms||[],h=l.currentMap?.ground,y=l.coinManager;h&&y&&(y.checkSpawnConditions(l),y.update(f,h,l),l.setCoins(y.getCoins()),l.updateMonsterStates(l.monsters)),l.updateFloatingTexts()}handleCollisions(){const a=Ft.getState(),{player:l,platforms:f,bombs:h,monsters:y,ground:v,coins:C}=a,x=this.collisionManager.checkPlayerPlatformCollision(l,f);if(x.hasCollision&&x.normal&&x.penetration){const _={...l};x.normal.y===-1?(_.y=_.y-x.penetration,_.velocityY=0,_.isGrounded=!0):x.normal.y===1?(_.y=_.y+x.penetration,_.velocityY=0):x.normal.x===1?(_.x=_.x+x.penetration,_.velocityX=0):x.normal.x===-1&&(_.x=_.x-x.penetration,_.velocityX=0),a.updatePlayer(_)}if(v){const _=this.collisionManager.checkPlayerGroundCollision(l,v);if(_.hasCollision&&_.normal&&_.penetration){const N={...l};_.normal.y===-1?(N.y=N.y-_.penetration,N.velocityY=0,N.isGrounded=!0):_.normal.y===1?(N.y=N.y+_.penetration,N.velocityY=0):_.normal.x===1?(N.x=N.x+_.penetration,N.velocityX=0):_.normal.x===-1&&(N.x=N.x-_.penetration,N.velocityX=0),a.updatePlayer(N)}}const R=this.collisionManager.checkPlayerBombCollision(l,h);if(R){this.audioManager.playSound(ua.BOMB_COLLECT);const _=a.collectBomb(R.order);_&&_.isCorrect&&a.onFirebombCollected()}const A=this.collisionManager.checkPlayerCoinCollision(l,C);A&&(this.audioManager.playSound(ua.COIN_COLLECT),a.collectCoin(A),A.type==="POWER"&&this.audioManager.playSound(ua.POWER_COIN_ACTIVATE));const k=this.collisionManager.checkPlayerMonsterCollision(l,y);if(k)if(a.activeEffects.powerMode){const _=a.coinManager?.calculateMonsterKillPoints(a.multiplier)||H.MONSTER_KILL_POINTS*a.multiplier;if(a.addScore(_),a.addFloatingText){const N=_.toString();a.addFloatingText(N,k.x+k.width/2,k.y+k.height/2,1e3,"#fff",15)}a.coinManager&&a.coinManager.onPointsEarned(_,!1),Pe.debug(`Monster killed during power mode: ${_} points`),this.audioManager.playSound(ua.COIN_COLLECT),this.monsterRespawnManager.killMonster(k)}else this.audioManager.playSound(ua.MONSTER_HIT),this.handlePlayerDeath()}handlePlayerDeath(){const a=Ft.getState();a.lives<=1?a.loseLife():(a.loseLife(),this.respawnPlayer())}respawnPlayer(){const a=Ft.getState(),l=a.currentMap;if(l){a.clearAllFloatingTexts(),this.scalingManager.resetOnDeath(),Pe.debug("ScalingManager: Reset difficulty to base values after player death"),a.resetCoinState(),Pe.debug("Coins reset after player death"),a.setPlayerPosition(l.playerStart.x,l.playerStart.y);const f=l.monsters.map(h=>({...h,x:h.patrolStartX||h.x,direction:1}));a.updateMonsters(f),this.animationController.reset(),this.renderManager.loadMapBackground(l.name),a.setMenuType(Pt.COUNTDOWN),a.setState(ot.COUNTDOWN),setTimeout(()=>{a.setState(ot.PLAYING)},3e3)}}checkWinCondition(){const a=Ft.getState();a.collectedBombs.length===H.TOTAL_BOMBS&&(Pe.game("Level completed - proceeding to next phase"),this.wasGroundedWhenMapCleared=a.player.isGrounded,this.audioManager.playSound(ua.MAP_CLEARED),a.setState(ot.MAP_CLEARED),setTimeout(()=>{this.proceedAfterMapCleared()},3e3))}proceedAfterMapCleared(){const a=Ft.getState(),l=H.BONUS_POINTS[a.correctOrderCount]||0,f=Date.now()-this.mapStartTime,h=a.getCoinStats(),y=h.totalCoinsCollected,v=h.totalPowerCoinsCollected;if(a.clearAllFloatingTexts(),a.resetEffects(),a.resetCoinState(),Pe.debug("Coins reset when map is cleared"),a.currentMap){const C={level:a.currentLevel,mapName:a.currentMap.name,correctOrderCount:a.correctOrderCount,totalBombs:H.TOTAL_BOMBS,score:a.score,bonus:l,hasBonus:l>0,coinsCollected:y,powerModeActivations:v,completionTime:f,timestamp:Date.now(),lives:a.lives,multiplier:a.multiplier};a.addLevelResult(C);const x={mapName:a.currentMap.name,level:a.currentLevel,correctOrderCount:a.correctOrderCount,totalBombs:H.TOTAL_BOMBS,score:a.score,bonus:l,hasBonus:l>0,timestamp:Date.now(),lives:a.lives,multiplier:a.multiplier,completionTime:f,coinsCollected:y,powerModeActivations:v};ux(x)}l>0?(a.setMenuType(Pt.BONUS),a.setState(ot.BONUS),this.audioManager.playSound(ua.BONUS_SCREEN),a.addScore(l),a.coinManager&&a.coinManager.onPointsEarned(l,!0)):this.proceedToNextLevel()}proceedToNextLevel(){const a=Ft.getState();a.currentLevel+1<=vf.length?(a.resetEffects(),a.resetCoinState(),Pe.debug("Coins reset when proceeding to next level"),a.nextLevel(),this.loadCurrentLevel(),a.setMenuType(Pt.COUNTDOWN),a.setState(ot.COUNTDOWN),setTimeout(()=>{a.setState(ot.PLAYING)},3e3)):(a.setState(ot.VICTORY),a.setMenuType(Pt.VICTORY))}continueToNextLevel(){this.proceedToNextLevel()}calculateBonus(a){return H.BONUS_POINTS[a]||0}render(){const a=Ft.getState();this.renderManager.render(a.player,a.platforms,a.bombs,a.monsters,a.ground,a.coins,a.floatingTexts,a.coinManager,this.monsterSpawnManager,a.currentMap,a)}cleanup(){this.stop(),this.inputManager.cleanup(),this.audioManager.cleanup()}getPauseStatus(){return{gameState:Ft.getState().currentState,scalingManager:this.scalingManager.getPauseStatus(),spawnManager:this.monsterSpawnManager.getPauseStatus(),respawnManager:{isPaused:this.monsterRespawnManager.isPaused()}}}getSpawnStatus(){return this.monsterSpawnManager.getSpawnStatus()}getSpawnManager(){return this.monsterSpawnManager}}const bp=()=>{const[c,a]=Q.useState(!1),l=Q.useCallback(x=>{const R=new CustomEvent("sigurd-startup-fullscreen-change",{detail:{isFullscreen:x,timestamp:Date.now(),gameId:"sigurd-startup-game"},bubbles:!0,cancelable:!0});window.dispatchEvent(R),document.dispatchEvent(R),Pe.debug(`Fullscreen event dispatched: ${x?"entered":"exited"}`)},[]),f=()=>!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled),h=()=>document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement,y=Q.useCallback(async x=>{if(!f())return console.warn("Fullscreen is not supported in this browser"),!1;const R=x||document.documentElement;try{return R.requestFullscreen?await R.requestFullscreen():R.webkitRequestFullscreen?await R.webkitRequestFullscreen():R.mozRequestFullScreen?await R.mozRequestFullScreen():R.msRequestFullscreen&&await R.msRequestFullscreen(),!0}catch(A){return console.error("Error entering fullscreen:",A),!1}},[]),v=Q.useCallback(async()=>{try{return document.exitFullscreen?await document.exitFullscreen():document.webkitExitFullscreen?await document.webkitExitFullscreen():document.mozCancelFullScreen?await document.mozCancelFullScreen():document.msExitFullscreen&&await document.msExitFullscreen(),!0}catch(x){return console.error("Error exiting fullscreen:",x),!1}},[]),C=Q.useCallback(async x=>{c?await v()&&(a(!1),l(!1)):await y(x)&&(a(!0),l(!0))},[c,y,v,l]);return Q.useEffect(()=>{const x=()=>{const A=!!h();A!==c&&(a(A),l(A))};return document.addEventListener("fullscreenchange",x),document.addEventListener("webkitfullscreenchange",x),document.addEventListener("mozfullscreenchange",x),document.addEventListener("MSFullscreenChange",x),x(),()=>{document.removeEventListener("fullscreenchange",x),document.removeEventListener("webkitfullscreenchange",x),document.removeEventListener("mozfullscreenchange",x),document.removeEventListener("MSFullscreenChange",x)}},[c,l]),{isFullscreen:c,isFullscreenSupported:f(),enterFullscreen:y,exitFullscreen:v,toggleFullscreen:C}},AM=({className:c=""})=>{const a=Q.useRef(null),l=Q.useRef(null),{isFullscreen:f}=bp(),[h,y]=Q.useState({});return Q.useEffect(()=>{const v=a.current;if(v)return v.width=H.CANVAS_WIDTH,v.height=H.CANVAS_HEIGHT,l.current=new _M(v),l.current.start(),()=>{l.current&&l.current.cleanup()}},[]),Q.useEffect(()=>{const v=()=>{if(!f){y({imageRendering:"crisp-edges"});return}const C=H.CANVAS_WIDTH/H.CANVAS_HEIGHT,x=window.innerWidth,R=window.innerHeight,A=x/R;let k,_;A>C?(_=R*.9,k=_*C):(k=x*.9,_=k/C),y({width:`${k}px`,height:`${_}px`,imageRendering:"crisp-edges"})};return v(),window.addEventListener("resize",v),()=>{window.removeEventListener("resize",v)}},[f]),I.jsx("div",{className:"relative",children:I.jsx("canvas",{ref:a,className:`shadow-black/10 shadow-lg rounded-lg ${c}`,style:h})})};function wx(c,a){if(typeof c=="function")return c(a);c!=null&&(c.current=a)}function bx(...c){return a=>{let l=!1;const f=c.map(h=>{const y=wx(h,a);return!l&&typeof y=="function"&&(l=!0),y});if(l)return()=>{for(let h=0;h<f.length;h++){const y=f[h];typeof y=="function"?y():wx(c[h],null)}}}}function ju(...c){return Q.useCallback(bx(...c),c)}function xx(c){const a=NM(c),l=Q.forwardRef((f,h)=>{const{children:y,...v}=f,C=Q.Children.toArray(y),x=C.find(LM);if(x){const R=x.props.children,A=C.map(k=>k===x?Q.Children.count(R)>1?Q.Children.only(null):Q.isValidElement(R)?R.props.children:null:k);return I.jsx(a,{...v,ref:h,children:Q.isValidElement(R)?Q.cloneElement(R,void 0,A):null})}return I.jsx(a,{...v,ref:h,children:y})});return l.displayName=`${c}.Slot`,l}var OM=xx("Slot");function NM(c){const a=Q.forwardRef((l,f)=>{const{children:h,...y}=l;if(Q.isValidElement(h)){const v=IM(h),C=PM(y,h.props);return h.type!==Q.Fragment&&(C.ref=f?bx(f,v):v),Q.cloneElement(h,C)}return Q.Children.count(h)>1?Q.Children.only(null):null});return a.displayName=`${c}.SlotClone`,a}var Cx=Symbol("radix.slottable");function DM(c){const a=({children:l})=>I.jsx(I.Fragment,{children:l});return a.displayName=`${c}.Slottable`,a.__radixId=Cx,a}function LM(c){return Q.isValidElement(c)&&typeof c.type=="function"&&"__radixId"in c.type&&c.type.__radixId===Cx}function PM(c,a){const l={...a};for(const f in a){const h=c[f],y=a[f];/^on[A-Z]/.test(f)?h&&y?l[f]=(...C)=>{const x=y(...C);return h(...C),x}:h&&(l[f]=h):f==="style"?l[f]={...h,...y}:f==="className"&&(l[f]=[h,y].filter(Boolean).join(" "))}return{...c,...l}}function IM(c){let a=Object.getOwnPropertyDescriptor(c.props,"ref")?.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?c.ref:(a=Object.getOwnPropertyDescriptor(c,"ref")?.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?c.props.ref:c.props.ref||c.ref)}function Ex(c){var a,l,f="";if(typeof c=="string"||typeof c=="number")f+=c;else if(typeof c=="object")if(Array.isArray(c)){var h=c.length;for(a=0;a<h;a++)c[a]&&(l=Ex(c[a]))&&(f&&(f+=" "),f+=l)}else for(l in c)c[l]&&(f&&(f+=" "),f+=l);return f}function Tx(){for(var c,a,l=0,f="",h=arguments.length;l<h;l++)(c=arguments[l])&&(a=Ex(c))&&(f&&(f+=" "),f+=a);return f}const Rx=c=>typeof c=="boolean"?`${c}`:c===0?"0":c,Mx=Tx,UM=(c,a)=>l=>{var f;if(a?.variants==null)return Mx(c,l?.class,l?.className);const{variants:h,defaultVariants:y}=a,v=Object.keys(h).map(R=>{const A=l?.[R],k=y?.[R];if(A===null)return null;const _=Rx(A)||Rx(k);return h[R][_]}),C=l&&Object.entries(l).reduce((R,A)=>{let[k,_]=A;return _===void 0||(R[k]=_),R},{}),x=a==null||(f=a.compoundVariants)===null||f===void 0?void 0:f.reduce((R,A)=>{let{class:k,className:_,...N}=A;return Object.entries(N).every(z=>{let[G,J]=z;return Array.isArray(J)?J.includes({...y,...C}[G]):{...y,...C}[G]===J})?[...R,k,_]:R},[]);return Mx(c,v,x,l?.class,l?.className)},n0="-",zM=c=>{const a=jM(c),{conflictingClassGroups:l,conflictingClassGroupModifiers:f}=c;return{getClassGroupId:v=>{const C=v.split(n0);return C[0]===""&&C.length!==1&&C.shift(),kx(C,a)||FM(v)},getConflictingClassGroupIds:(v,C)=>{const x=l[v]||[];return C&&f[v]?[...x,...f[v]]:x}}},kx=(c,a)=>{if(c.length===0)return a.classGroupId;const l=c[0],f=a.nextPart.get(l),h=f?kx(c.slice(1),f):void 0;if(h)return h;if(a.validators.length===0)return;const y=c.join(n0);return a.validators.find(({validator:v})=>v(y))?.classGroupId},_x=/^\[(.+)\]$/,FM=c=>{if(_x.test(c)){const a=_x.exec(c)[1],l=a?.substring(0,a.indexOf(":"));if(l)return"arbitrary.."+l}},jM=c=>{const{theme:a,classGroups:l}=c,f={nextPart:new Map,validators:[]};for(const h in l)r0(l[h],f,h,a);return f},r0=(c,a,l,f)=>{c.forEach(h=>{if(typeof h=="string"){const y=h===""?a:Ax(a,h);y.classGroupId=l;return}if(typeof h=="function"){if(BM(h)){r0(h(f),a,l,f);return}a.validators.push({validator:h,classGroupId:l});return}Object.entries(h).forEach(([y,v])=>{r0(v,Ax(a,y),l,f)})})},Ax=(c,a)=>{let l=c;return a.split(n0).forEach(f=>{l.nextPart.has(f)||l.nextPart.set(f,{nextPart:new Map,validators:[]}),l=l.nextPart.get(f)}),l},BM=c=>c.isThemeGetter,HM=c=>{if(c<1)return{get:()=>{},set:()=>{}};let a=0,l=new Map,f=new Map;const h=(y,v)=>{l.set(y,v),a++,a>c&&(a=0,f=l,l=new Map)};return{get(y){let v=l.get(y);if(v!==void 0)return v;if((v=f.get(y))!==void 0)return h(y,v),v},set(y,v){l.has(y)?l.set(y,v):h(y,v)}}},a0="!",i0=":",VM=i0.length,$M=c=>{const{prefix:a,experimentalParseClassName:l}=c;let f=h=>{const y=[];let v=0,C=0,x=0,R;for(let z=0;z<h.length;z++){let G=h[z];if(v===0&&C===0){if(G===i0){y.push(h.slice(x,z)),x=z+VM;continue}if(G==="/"){R=z;continue}}G==="["?v++:G==="]"?v--:G==="("?C++:G===")"&&C--}const A=y.length===0?h:h.substring(x),k=GM(A),_=k!==A,N=R&&R>x?R-x:void 0;return{modifiers:y,hasImportantModifier:_,baseClassName:k,maybePostfixModifierPosition:N}};if(a){const h=a+i0,y=f;f=v=>v.startsWith(h)?y(v.substring(h.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:v,maybePostfixModifierPosition:void 0}}if(l){const h=f;f=y=>l({className:y,parseClassName:h})}return f},GM=c=>c.endsWith(a0)?c.substring(0,c.length-1):c.startsWith(a0)?c.substring(1):c,YM=c=>{const a=Object.fromEntries(c.orderSensitiveModifiers.map(f=>[f,!0]));return f=>{if(f.length<=1)return f;const h=[];let y=[];return f.forEach(v=>{v[0]==="["||a[v]?(h.push(...y.sort(),v),y=[]):y.push(v)}),h.push(...y.sort()),h}},WM=c=>({cache:HM(c.cacheSize),parseClassName:$M(c),sortModifiers:YM(c),...zM(c)}),XM=/\s+/,KM=(c,a)=>{const{parseClassName:l,getClassGroupId:f,getConflictingClassGroupIds:h,sortModifiers:y}=a,v=[],C=c.trim().split(XM);let x="";for(let R=C.length-1;R>=0;R-=1){const A=C[R],{isExternal:k,modifiers:_,hasImportantModifier:N,baseClassName:z,maybePostfixModifierPosition:G}=l(A);if(k){x=A+(x.length>0?" "+x:x);continue}let J=!!G,de=f(J?z.substring(0,G):z);if(!de){if(!J){x=A+(x.length>0?" "+x:x);continue}if(de=f(z),!de){x=A+(x.length>0?" "+x:x);continue}J=!1}const ue=y(_).join(":"),ce=N?ue+a0:ue,fe=ce+de;if(v.includes(fe))continue;v.push(fe);const le=h(de,J);for(let Re=0;Re<le.length;++Re){const ve=le[Re];v.push(ce+ve)}x=A+(x.length>0?" "+x:x)}return x};function QM(){let c=0,a,l,f="";for(;c<arguments.length;)(a=arguments[c++])&&(l=Ox(a))&&(f&&(f+=" "),f+=l);return f}const Ox=c=>{if(typeof c=="string")return c;let a,l="";for(let f=0;f<c.length;f++)c[f]&&(a=Ox(c[f]))&&(l&&(l+=" "),l+=a);return l};function qM(c,...a){let l,f,h,y=v;function v(x){const R=a.reduce((A,k)=>k(A),c());return l=WM(R),f=l.cache.get,h=l.cache.set,y=C,C(x)}function C(x){const R=f(x);if(R)return R;const A=KM(x,l);return h(x,A),A}return function(){return y(QM.apply(null,arguments))}}const Sr=c=>{const a=l=>l[c]||[];return a.isThemeGetter=!0,a},Nx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ZM=/^\d+\/\d+$/,JM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ek=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,nk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rk=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mf=c=>ZM.test(c),jt=c=>!!c&&!Number.isNaN(Number(c)),js=c=>!!c&&Number.isInteger(Number(c)),o0=c=>c.endsWith("%")&&jt(c.slice(0,-1)),Ul=c=>JM.test(c),ak=()=>!0,ik=c=>ek.test(c)&&!tk.test(c),Lx=()=>!1,ok=c=>nk.test(c),lk=c=>rk.test(c),sk=c=>!Ke(c)&&!Qe(c),uk=c=>gf(c,Fx,Lx),Ke=c=>Nx.test(c),Bu=c=>gf(c,jx,ik),l0=c=>gf(c,hk,jt),Px=c=>gf(c,Ux,Lx),ck=c=>gf(c,zx,lk),Fv=c=>gf(c,Bx,ok),Qe=c=>Dx.test(c),xp=c=>yf(c,jx),fk=c=>yf(c,vk),Ix=c=>yf(c,Ux),dk=c=>yf(c,Fx),pk=c=>yf(c,zx),jv=c=>yf(c,Bx,!0),gf=(c,a,l)=>{const f=Nx.exec(c);return f?f[1]?a(f[1]):l(f[2]):!1},yf=(c,a,l=!1)=>{const f=Dx.exec(c);return f?f[1]?a(f[1]):l:!1},Ux=c=>c==="position"||c==="percentage",zx=c=>c==="image"||c==="url",Fx=c=>c==="length"||c==="size"||c==="bg-size",jx=c=>c==="length",hk=c=>c==="number",vk=c=>c==="family-name",Bx=c=>c==="shadow",mk=qM(()=>{const c=Sr("color"),a=Sr("font"),l=Sr("text"),f=Sr("font-weight"),h=Sr("tracking"),y=Sr("leading"),v=Sr("breakpoint"),C=Sr("container"),x=Sr("spacing"),R=Sr("radius"),A=Sr("shadow"),k=Sr("inset-shadow"),_=Sr("text-shadow"),N=Sr("drop-shadow"),z=Sr("blur"),G=Sr("perspective"),J=Sr("aspect"),de=Sr("ease"),ue=Sr("animate"),ce=()=>["auto","avoid","all","avoid-page","page","left","right","column"],fe=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],le=()=>[...fe(),Qe,Ke],Re=()=>["auto","hidden","clip","visible","scroll"],ve=()=>["auto","contain","none"],xe=()=>[Qe,Ke,x],tt=()=>[mf,"full","auto",...xe()],dt=()=>[js,"none","subgrid",Qe,Ke],Rt=()=>["auto",{span:["full",js,Qe,Ke]},js,Qe,Ke],lt=()=>[js,"auto",Qe,Ke],Ae=()=>["auto","min","max","fr",Qe,Ke],rt=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],st=()=>["start","end","center","stretch","center-safe","end-safe"],qe=()=>["auto",...xe()],Te=()=>[mf,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...xe()],$=()=>[c,Qe,Ke],ke=()=>[...fe(),Ix,Px,{position:[Qe,Ke]}],Ce=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",dk,uk,{size:[Qe,Ke]}],oe=()=>[o0,xp,Bu],Be=()=>["","none","full",R,Qe,Ke],He=()=>["",jt,xp,Bu],yt=()=>["solid","dashed","dotted","double"],xt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ve=()=>[jt,o0,Ix,Px],St=()=>["","none",z,Qe,Ke],wt=()=>["none",jt,Qe,Ke],$t=()=>["none",jt,Qe,Ke],gn=()=>[jt,Qe,Ke],Un=()=>[mf,"full",...xe()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ul],breakpoint:[Ul],color:[ak],container:[Ul],"drop-shadow":[Ul],ease:["in","out","in-out"],font:[sk],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ul],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ul],shadow:[Ul],spacing:["px",jt],text:[Ul],"text-shadow":[Ul],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",mf,Ke,Qe,J]}],container:["container"],columns:[{columns:[jt,Ke,Qe,C]}],"break-after":[{"break-after":ce()}],"break-before":[{"break-before":ce()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:le()}],overflow:[{overflow:Re()}],"overflow-x":[{"overflow-x":Re()}],"overflow-y":[{"overflow-y":Re()}],overscroll:[{overscroll:ve()}],"overscroll-x":[{"overscroll-x":ve()}],"overscroll-y":[{"overscroll-y":ve()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:tt()}],"inset-x":[{"inset-x":tt()}],"inset-y":[{"inset-y":tt()}],start:[{start:tt()}],end:[{end:tt()}],top:[{top:tt()}],right:[{right:tt()}],bottom:[{bottom:tt()}],left:[{left:tt()}],visibility:["visible","invisible","collapse"],z:[{z:[js,"auto",Qe,Ke]}],basis:[{basis:[mf,"full","auto",C,...xe()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[jt,mf,"auto","initial","none",Ke]}],grow:[{grow:["",jt,Qe,Ke]}],shrink:[{shrink:["",jt,Qe,Ke]}],order:[{order:[js,"first","last","none",Qe,Ke]}],"grid-cols":[{"grid-cols":dt()}],"col-start-end":[{col:Rt()}],"col-start":[{"col-start":lt()}],"col-end":[{"col-end":lt()}],"grid-rows":[{"grid-rows":dt()}],"row-start-end":[{row:Rt()}],"row-start":[{"row-start":lt()}],"row-end":[{"row-end":lt()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ae()}],"auto-rows":[{"auto-rows":Ae()}],gap:[{gap:xe()}],"gap-x":[{"gap-x":xe()}],"gap-y":[{"gap-y":xe()}],"justify-content":[{justify:[...rt(),"normal"]}],"justify-items":[{"justify-items":[...st(),"normal"]}],"justify-self":[{"justify-self":["auto",...st()]}],"align-content":[{content:["normal",...rt()]}],"align-items":[{items:[...st(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...st(),{baseline:["","last"]}]}],"place-content":[{"place-content":rt()}],"place-items":[{"place-items":[...st(),"baseline"]}],"place-self":[{"place-self":["auto",...st()]}],p:[{p:xe()}],px:[{px:xe()}],py:[{py:xe()}],ps:[{ps:xe()}],pe:[{pe:xe()}],pt:[{pt:xe()}],pr:[{pr:xe()}],pb:[{pb:xe()}],pl:[{pl:xe()}],m:[{m:qe()}],mx:[{mx:qe()}],my:[{my:qe()}],ms:[{ms:qe()}],me:[{me:qe()}],mt:[{mt:qe()}],mr:[{mr:qe()}],mb:[{mb:qe()}],ml:[{ml:qe()}],"space-x":[{"space-x":xe()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":xe()}],"space-y-reverse":["space-y-reverse"],size:[{size:Te()}],w:[{w:[C,"screen",...Te()]}],"min-w":[{"min-w":[C,"screen","none",...Te()]}],"max-w":[{"max-w":[C,"screen","none","prose",{screen:[v]},...Te()]}],h:[{h:["screen","lh",...Te()]}],"min-h":[{"min-h":["screen","lh","none",...Te()]}],"max-h":[{"max-h":["screen","lh",...Te()]}],"font-size":[{text:["base",l,xp,Bu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[f,Qe,l0]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",o0,Ke]}],"font-family":[{font:[fk,Ke,a]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[h,Qe,Ke]}],"line-clamp":[{"line-clamp":[jt,"none",Qe,l0]}],leading:[{leading:[y,...xe()]}],"list-image":[{"list-image":["none",Qe,Ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Qe,Ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...yt(),"wavy"]}],"text-decoration-thickness":[{decoration:[jt,"from-font","auto",Qe,Bu]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[jt,"auto",Qe,Ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:xe()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Qe,Ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Qe,Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ke()}],"bg-repeat":[{bg:Ce()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},js,Qe,Ke],radial:["",Qe,Ke],conic:[js,Qe,Ke]},pk,ck]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:oe()}],"gradient-via-pos":[{via:oe()}],"gradient-to-pos":[{to:oe()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:Be()}],"rounded-s":[{"rounded-s":Be()}],"rounded-e":[{"rounded-e":Be()}],"rounded-t":[{"rounded-t":Be()}],"rounded-r":[{"rounded-r":Be()}],"rounded-b":[{"rounded-b":Be()}],"rounded-l":[{"rounded-l":Be()}],"rounded-ss":[{"rounded-ss":Be()}],"rounded-se":[{"rounded-se":Be()}],"rounded-ee":[{"rounded-ee":Be()}],"rounded-es":[{"rounded-es":Be()}],"rounded-tl":[{"rounded-tl":Be()}],"rounded-tr":[{"rounded-tr":Be()}],"rounded-br":[{"rounded-br":Be()}],"rounded-bl":[{"rounded-bl":Be()}],"border-w":[{border:He()}],"border-w-x":[{"border-x":He()}],"border-w-y":[{"border-y":He()}],"border-w-s":[{"border-s":He()}],"border-w-e":[{"border-e":He()}],"border-w-t":[{"border-t":He()}],"border-w-r":[{"border-r":He()}],"border-w-b":[{"border-b":He()}],"border-w-l":[{"border-l":He()}],"divide-x":[{"divide-x":He()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":He()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...yt(),"hidden","none"]}],"divide-style":[{divide:[...yt(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...yt(),"none","hidden"]}],"outline-offset":[{"outline-offset":[jt,Qe,Ke]}],"outline-w":[{outline:["",jt,xp,Bu]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",A,jv,Fv]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",k,jv,Fv]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:He()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[jt,Bu]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":He()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",_,jv,Fv]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[jt,Qe,Ke]}],"mix-blend":[{"mix-blend":[...xt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xt()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[jt]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ve()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":Ve()}],"mask-image-t-to-pos":[{"mask-t-to":Ve()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":Ve()}],"mask-image-r-to-pos":[{"mask-r-to":Ve()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":Ve()}],"mask-image-b-to-pos":[{"mask-b-to":Ve()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":Ve()}],"mask-image-l-to-pos":[{"mask-l-to":Ve()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":Ve()}],"mask-image-x-to-pos":[{"mask-x-to":Ve()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":Ve()}],"mask-image-y-to-pos":[{"mask-y-to":Ve()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[Qe,Ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ve()}],"mask-image-radial-from-color":[{"mask-radial-from":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":fe()}],"mask-image-conic-pos":[{"mask-conic":[jt]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ve()}],"mask-image-conic-from-color":[{"mask-conic-from":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ke()}],"mask-repeat":[{mask:Ce()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Qe,Ke]}],filter:[{filter:["","none",Qe,Ke]}],blur:[{blur:St()}],brightness:[{brightness:[jt,Qe,Ke]}],contrast:[{contrast:[jt,Qe,Ke]}],"drop-shadow":[{"drop-shadow":["","none",N,jv,Fv]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",jt,Qe,Ke]}],"hue-rotate":[{"hue-rotate":[jt,Qe,Ke]}],invert:[{invert:["",jt,Qe,Ke]}],saturate:[{saturate:[jt,Qe,Ke]}],sepia:[{sepia:["",jt,Qe,Ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Qe,Ke]}],"backdrop-blur":[{"backdrop-blur":St()}],"backdrop-brightness":[{"backdrop-brightness":[jt,Qe,Ke]}],"backdrop-contrast":[{"backdrop-contrast":[jt,Qe,Ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",jt,Qe,Ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[jt,Qe,Ke]}],"backdrop-invert":[{"backdrop-invert":["",jt,Qe,Ke]}],"backdrop-opacity":[{"backdrop-opacity":[jt,Qe,Ke]}],"backdrop-saturate":[{"backdrop-saturate":[jt,Qe,Ke]}],"backdrop-sepia":[{"backdrop-sepia":["",jt,Qe,Ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":xe()}],"border-spacing-x":[{"border-spacing-x":xe()}],"border-spacing-y":[{"border-spacing-y":xe()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Qe,Ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[jt,"initial",Qe,Ke]}],ease:[{ease:["linear","initial",de,Qe,Ke]}],delay:[{delay:[jt,Qe,Ke]}],animate:[{animate:["none",ue,Qe,Ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[G,Qe,Ke]}],"perspective-origin":[{"perspective-origin":le()}],rotate:[{rotate:wt()}],"rotate-x":[{"rotate-x":wt()}],"rotate-y":[{"rotate-y":wt()}],"rotate-z":[{"rotate-z":wt()}],scale:[{scale:$t()}],"scale-x":[{"scale-x":$t()}],"scale-y":[{"scale-y":$t()}],"scale-z":[{"scale-z":$t()}],"scale-3d":["scale-3d"],skew:[{skew:gn()}],"skew-x":[{"skew-x":gn()}],"skew-y":[{"skew-y":gn()}],transform:[{transform:[Qe,Ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:le()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Un()}],"translate-x":[{"translate-x":Un()}],"translate-y":[{"translate-y":Un()}],"translate-z":[{"translate-z":Un()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Qe,Ke]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":xe()}],"scroll-mx":[{"scroll-mx":xe()}],"scroll-my":[{"scroll-my":xe()}],"scroll-ms":[{"scroll-ms":xe()}],"scroll-me":[{"scroll-me":xe()}],"scroll-mt":[{"scroll-mt":xe()}],"scroll-mr":[{"scroll-mr":xe()}],"scroll-mb":[{"scroll-mb":xe()}],"scroll-ml":[{"scroll-ml":xe()}],"scroll-p":[{"scroll-p":xe()}],"scroll-px":[{"scroll-px":xe()}],"scroll-py":[{"scroll-py":xe()}],"scroll-ps":[{"scroll-ps":xe()}],"scroll-pe":[{"scroll-pe":xe()}],"scroll-pt":[{"scroll-pt":xe()}],"scroll-pr":[{"scroll-pr":xe()}],"scroll-pb":[{"scroll-pb":xe()}],"scroll-pl":[{"scroll-pl":xe()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Qe,Ke]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[jt,xp,Bu,l0]}],stroke:[{stroke:["none",...$()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Hx(...c){return mk(Tx(c))}const gk=UM("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),vi=Q.forwardRef(({className:c,variant:a,size:l,asChild:f=!1,...h},y)=>{const v=f?OM:"button";return I.jsx(v,{className:Hx(gk({variant:a,size:l,className:c})),ref:y,...h})});vi.displayName="Button";/**
241
+ You might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq`:""),"font-weight:bold")}Ga.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Gb,Ga.createPortal=IP,Ga.createRoot=zP,Ga.findDOMNode=OP,Ga.flushSync=jP,Ga.hydrate=NP,Ga.hydrateRoot=FP,Ga.render=DP,Ga.unmountComponentAtNode=PP,Ga.unstable_batchedUpdates=bb,Ga.unstable_renderSubtreeIntoContainer=UP,Ga.version=zb,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ga}function rx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(process.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(rx)}catch(c){console.error(c)}}}process.env.NODE_ENV==="production"?(rx(),Ky.exports=AR()):Ky.exports=OR();var Zy=Ky.exports,hp=Zy;if(process.env.NODE_ENV==="production")pp.createRoot=hp.createRoot,pp.hydrateRoot=hp.hydrateRoot;else{var Lv=hp.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;pp.createRoot=function(c,a){Lv.usingClientEntryPoint=!0;try{return hp.createRoot(c,a)}finally{Lv.usingClientEntryPoint=!1}},pp.hydrateRoot=function(c,a,l){Lv.usingClientEntryPoint=!0;try{return hp.hydrateRoot(c,a,l)}finally{Lv.usingClientEntryPoint=!1}}}var Q=fp();const Pv=cf(Q),ax=di({__proto__:null,default:Pv},[Q]),ix=c=>{let a;const l=new Set,f=(R,A)=>{const k=typeof R=="function"?R(a):R;if(!Object.is(k,a)){const _=a;a=A??(typeof k!="object"||k===null)?k:Object.assign({},a,k),l.forEach(N=>N(a,_))}},h=()=>a,C={setState:f,getState:h,getInitialState:()=>x,subscribe:R=>(l.add(R),()=>l.delete(R))},x=a=c(f,h,C);return C},NR=c=>c?ix(c):ix,DR=c=>c;function LR(c,a=DR){const l=Pv.useSyncExternalStore(c.subscribe,()=>a(c.getState()),()=>a(c.getInitialState()));return Pv.useDebugValue(l),l}const ox=c=>{const a=NR(c),l=f=>LR(a,f);return Object.assign(l,a),l},PR=c=>c?ox(c):ox,H={CANVAS_WIDTH:800,CANVAS_HEIGHT:600,PLAYER_HEIGHT:35,PLAYER_WIDTH:25,BOMB_SIZE:25,MONSTER_SIZE:25,PLATFORM_HEIGHT:25,COIN_SIZE:25,USE_SPRITES:!0,PARALLAX_ENABLED:!0,GRAVITY:.3,FLOAT_GRAVITY:.005,MOVE_SPEED:4,JUMP_POWER:8,SUPER_JUMP_POWER:12,COIN_BOUNCE_SPEED:3,COIN_BOUNCE_DAMPING:.8,COIN_GRAVITY:.1,MIN_JUMP_DURATION:50,MAX_JUMP_DURATION:300,TOTAL_BOMBS:23,STARTING_LIVES:3,POWER_COIN_SPAWN_INTERVAL:9,BONUS_COIN_SPAWN_INTERVAL:5e3,EXTRA_LIFE_COIN_RATIO:10,POWER_COIN_DURATION:7e3,POWER_COIN_POINTS:2e3,MONSTER_KILL_POINTS:100,BONUS_MULTIPLIER_COIN_POINTS:1e3,EXTRA_LIFE_COIN_POINTS:1e3,MULTIPLIER_THRESHOLDS:{1:0,2:1800,3:3600,4:5400,5:7200},MAX_MULTIPLIER:5,BOMB_POINTS:{NORMAL:100,FIREBOMB:200},BONUS_POINTS:{23:5e4,22:3e4,21:2e4,20:1e4}},lx={masterVolume:80,musicVolume:70,sfxVolume:90,masterMuted:!1,musicMuted:!1,sfxMuted:!1},Ya={ENABLED:!1,TARGET_STATE:"PLAYING",TARGET_LEVEL:6,MOCK_DATA:{score:15e3,lives:2,correctOrderCount:18,multiplier:2,multiplierScore:2600}};typeof window<"u"&&(window.__DEV_LOGGING_ENABLED__=Ya.ENABLED);const rr={PLAYER:"#00FF00",BOMB:"#FFD700",BOMB_NEXT:"#FF0000",MONSTER:"#FF4444",MONSTER_FROZEN:"#4444FF",MONSTER_HORIZONTAL_PATROL:"#FF4444",MONSTER_VERTICAL_PATROL:"#44FF44",MONSTER_CHASER:"#FF8844",MONSTER_AMBUSHER:"#8844FF",MONSTER_FLOATER:"#44FFFF",PLATFORM:"#484744",BACKGROUND:"#262521"},sx=()=>({x:H.CANVAS_WIDTH/2,y:H.CANVAS_HEIGHT-100,width:H.PLAYER_WIDTH,height:H.PLAYER_HEIGHT,color:rr.PLAYER,velocityX:0,velocityY:0,isGrounded:!1,isFloating:!1,isJumping:!1,jumpStartTime:0,moveSpeed:H.MOVE_SPEED,jumpPower:H.JUMP_POWER,gravity:H.GRAVITY,floatGravity:H.FLOAT_GRAVITY}),IR=(c,a)=>({player:sx(),updatePlayer:l=>{c({player:{...a().player,...l}})},resetPlayer:()=>{c({player:sx()})},setPlayerPosition:(l,f)=>{c({player:{...a().player,x:l,y:f,velocityX:0,velocityY:0,isGrounded:!1,isFloating:!1,isJumping:!1,jumpStartTime:0}})}});var ot=(c=>(c.MENU="MENU",c.COUNTDOWN="COUNTDOWN",c.PLAYING="PLAYING",c.PAUSED="PAUSED",c.BONUS="BONUS",c.VICTORY="VICTORY",c.GAME_OVER="GAME_OVER",c.MAP_CLEARED="MAP_CLEARED",c))(ot||{}),Pt=(c=>(c.START="START",c.COUNTDOWN="COUNTDOWN",c.IN_GAME="IN_GAME",c.PAUSE="PAUSE",c.SETTINGS="SETTINGS",c.BONUS="BONUS",c.VICTORY="VICTORY",c.GAME_OVER="GAME_OVER",c.AUDIO_SETTINGS="AUDIO_SETTINGS",c))(Pt||{}),kn=(c=>(c.HORIZONTAL_PATROL="HORIZONTAL_PATROL",c.VERTICAL_PATROL="VERTICAL_PATROL",c.CHASER="CHASER",c.AMBUSHER="AMBUSHER",c.FLOATER="FLOATER",c))(kn||{}),It=(c=>(c.POWER="POWER",c.BONUS_MULTIPLIER="BONUS_MULTIPLIER",c.EXTRA_LIFE="EXTRA_LIFE",c.MONSTER_FREEZE="MONSTER_FREEZE",c))(It||{}),ua=(c=>(c.GAME_START="GAME_START",c.LEVEL_COMPLETE="LEVEL_COMPLETE",c.PLAYER_DEATH="PLAYER_DEATH",c.GAME_OVER="GAME_OVER",c.BONUS_SCREEN="BONUS_SCREEN",c.BOMB_COLLECT="BOMB_COLLECT",c.MAP_CLEARED="MAP_CLEARED",c.BACKGROUND_MUSIC="BACKGROUND_MUSIC",c.MONSTER_HIT="MONSTER_HIT",c.COIN_COLLECT="COIN_COLLECT",c.POWER_COIN_ACTIVATE="POWER_COIN_ACTIVATE",c))(ua||{});class UR{constructor(a=2){be(this,"logLevel",2);be(this,"lastLogTime",new Map);be(this,"logThrottle",new Map);switch("dataPassing".toLowerCase()){case"error":this.logLevel=0;break;case"warn":this.logLevel=1;break;case"info":this.logLevel=2;break;case"debug":this.logLevel=3;break;case"trace":this.logLevel=4;break;case"datapassing":this.logLevel=5;break;default:this.logLevel=a}}setLogLevel(a){this.logLevel=a}shouldLog(a,l=1e3){const f=Date.now(),h=this.lastLogTime.get(a)||0;return f-h>=l?(this.lastLogTime.set(a,f),!0):!1}game(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🎮 ${a}`,...l)}flow(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🌊 ${a}`,...l)}player(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`👤 ${a}`,...l)}monster(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`👹 ${a}`,...l)}coin(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🪙 ${a}`,...l)}bomb(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`💣 ${a}`,...l)}power(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`⚡ ${a}`,...l)}dataPassing(a,...l){this.logLevel===5&&console.log(`📡 ${a}`,...l)}pause(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&this.shouldLog("pause",500)&&console.log(`⏸️ ${a}`,...l)}scaling(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&this.shouldLog("scaling",2e3)&&console.log(`📈 ${a}`,...l)}debug(a,...l){(this.logLevel===3||this.logLevel===4)&&console.log(`🔧 ${a}`,...l)}audio(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`🎵 ${a}`,...l)}error(a,...l){this.logLevel>=0&&console.error(`❌ ${a}`,...l)}warn(a,...l){this.logLevel>=1&&console.warn(`⚠️ ${a}`,...l)}info(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`ℹ️ ${a}`,...l)}trace(a,...l){this.logLevel===4&&console.log(`🔍 ${a}`,...l)}dev(a,...l){}score(a,...l){(this.logLevel===2||this.logLevel===3||this.logLevel===4)&&console.log(`📊 ${a}`,...l)}clearThrottle(){this.lastLogTime.clear()}disable(){this.logLevel=0}enable(){this.logLevel=2}setLevel(a){this.logLevel=a}}const Ge=new UR,Pe={error:(c,...a)=>Ge.error(c,...a),warn:(c,...a)=>Ge.warn(c,...a),info:(c,...a)=>Ge.info(c,...a),debug:(c,...a)=>Ge.debug(c,...a),trace:(c,...a)=>Ge.trace(c,...a),game:(c,...a)=>Ge.game(c,...a),dev:(c,...a)=>Ge.dev(c,...a),audio:(c,...a)=>Ge.audio(c,...a),coin:(c,...a)=>Ge.coin(c,...a),bomb:(c,...a)=>Ge.bomb(c,...a),score:(c,...a)=>Ge.score(c,...a),dataPassing:(c,...a)=>Ge.dataPassing(c,...a)},zR=(c,a,l,f,h)=>{const y={score:c,map:a,timestamp:Date.now(),level:l,lives:f,multiplier:h};Pe.dataPassing("Sending score to host:",y);const v=new CustomEvent("scoreUpdate",{detail:{score:c},bubbles:!0,composed:!0});window.dispatchEvent(v);const C=new CustomEvent("game:score-updated",{detail:y,bubbles:!0,composed:!0});window.dispatchEvent(C)},FR=()=>{Pe.dataPassing("Game ready signal sent to host");const c=new CustomEvent("game:ready",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0});window.dispatchEvent(c)},Iv=(c,a)=>{Pe.dataPassing("Game state update sent to host:",{state:c,map:a});const l=new CustomEvent("game:state-updated",{detail:{state:c,map:a,timestamp:Date.now()},bubbles:!0,composed:!0});window.dispatchEvent(l)},ux=c=>{Pe.dataPassing("Sending map completion data to host:",c);const a=new CustomEvent("game:map-completed",{detail:c,bubbles:!0,composed:!0});window.dispatchEvent(a)},jR=c=>{Pe.dataPassing("Sending game completion data to host:",c);const a=new CustomEvent("game:completed",{detail:c,bubbles:!0,composed:!0});window.dispatchEvent(a)},BR=(c,a,l,f,h,y,v)=>{const C=c.reduce((N,z)=>N+z.totalBombs,0),x=c.reduce((N,z)=>N+z.correctOrderCount,0),R=c.reduce((N,z)=>N+z.coinsCollected,0),A=c.reduce((N,z)=>N+z.powerModeActivations,0),k=v-y,_=c.length>0?k/c.length/1e3:0;return{totalBombs:C,totalCorrectOrders:x,totalCoinsCollected:R,totalPowerModeActivations:A,averageCompletionTime:Math.round(_),totalPlayTime:Math.round(k/1e3)}},HR=c=>{switch(c){case kn.HORIZONTAL_PATROL:return rr.MONSTER_HORIZONTAL_PATROL;case kn.VERTICAL_PATROL:return rr.MONSTER_VERTICAL_PATROL;case kn.CHASER:return rr.MONSTER_CHASER;case kn.AMBUSHER:return rr.MONSTER_AMBUSHER;case kn.FLOATER:return rr.MONSTER_FLOATER;default:return rr.MONSTER}},vp=(c,a,l,f=1,h=0)=>({x:c,y:a,width:H.MONSTER_SIZE,height:H.MONSTER_SIZE,color:HR(l),type:l,speed:f,direction:1,isActive:!0,spawnDelay:h}),pi=(c,a,l,f="left",h=1,y=1,v,C=0)=>{const x=f==="left"?c:c+l-H.MONSTER_SIZE,R=a-H.MONSTER_SIZE,A=f==="left"?1:-1;return{...vp(x,R,kn.HORIZONTAL_PATROL,y,C),patrolStartX:c,patrolEndX:c+l,direction:A,walkLengths:h}},Ps=(c,a,l,f="left",h=1,y=1,v=0)=>{const C=f==="left"?c-H.MONSTER_SIZE:c+15;return{...vp(C,a,kn.VERTICAL_PATROL,h,v),patrolStartY:a,patrolEndY:a+l,direction:y,patrolSide:f,targetPlatformX:c}},Is=(c,a,l=45,f=1,h=0)=>({...vp(c,a,kn.FLOATER,f,h),startAngle:l,spawnTime:Date.now()}),ff=(c,a,l=.8,f=.2,h=200,y=0)=>({...vp(c,a,kn.CHASER,l,y),direction:0,directness:f,chaseUpdateInterval:h}),df=(c,a,l=.8,f=8e3,h=0)=>({...vp(c,a,kn.AMBUSHER,l,h),ambushCooldown:0}),ne=(c,a,l,f)=>({x:c,y:a,width:H.BOMB_SIZE,height:H.BOMB_SIZE,order:l,group:f,isCollected:!1,isBlinking:!1}),Vt=(c,a,l,f=rr.PLATFORM,h="#000")=>({x:c,y:a,width:l.width,height:l.height,borderColor:h,color:f}),pf=(c,a,l,f=rr.PLATFORM,h="#000")=>({x:c,y:a,width:15,height:l,borderColor:h,color:f,isVertical:!0}),Us=c=>(H.CANVAS_WIDTH-c)/2,zs=c=>(H.CANVAS_HEIGHT-c)/2,hf=(c,a)=>({x:Us(c),y:zs(a)}),VR={id:"level1",name:"startup lab",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#00ffff",groupSequence:[1,2,3,4,5],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#88a2bc"},platforms:[pf(96,220,150,"#abccee","#4f6a8f"),pf(684,220,150,"#abccee","#4f6a8f"),Vt(95,450,{width:200,height:15},"#abccee","#4f6a8f"),Vt(480,150,{width:200,height:15},"#abccee","#4f6a8f"),Vt(430,430,{width:200,height:15},"#abccee","#4f6a8f"),Vt(170,170,{width:200,height:15},"#abccee","#4f6a8f")],bombs:[ne(440,400,1,1),ne(490,400,2,1),ne(540,400,3,1),ne(590,400,4,1),ne(180,140,5,2),ne(230,140,6,2),ne(280,140,7,2),ne(330,140,8,2),ne(710,230,9,3),ne(710,280,10,3),ne(710,330,11,3),ne(130,470,12,4),ne(180,470,13,4),ne(230,470,14,4),ne(520,70,15,5),ne(570,70,16,5),ne(620,70,17,5),ne(120,230,18,6),ne(120,280,19,6),ne(120,330,20,6),ne(130,420,21,7),ne(180,420,22,7),ne(230,420,23,7)],coinSpawnPoints:[{x:Us(H.COIN_SIZE),y:zs(H.COIN_SIZE),type:It.POWER,spawnAngle:45},{x:570,y:50,type:It.POWER,spawnAngle:135},{x:200,y:75,type:It.BONUS_MULTIPLIER},{x:200,y:75,type:It.BONUS_MULTIPLIER},{x:200,y:75,type:It.EXTRA_LIFE},{x:200,y:75,type:It.EXTRA_LIFE}],monsterSpawnPoints:[{spawnDelay:4e3,createMonster:()=>pi(430,430,200,"left",1,1)},{spawnDelay:5e3,createMonster:()=>df(500,500,1)}],monsters:[Ps(105,220,220,"right"),Ps(695,220,220,"right",2,1),pi(170,170,200,"left"),ff(250,300,1,.3,1e3)]},$R={id:"level2",name:"innovasjon norge",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#ff6b6b",groupSequence:[1,2,3,4,5],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#262335"},platforms:[Vt(165,475,{width:150,height:15},"#d4896a","#262335"),Vt(485,475,{width:150,height:15},"#d4896a","#262335"),Vt(300,380,{width:200,height:15},"#d4896a","#262335"),Vt(300,240,{width:200,height:15},"#d4896a","#262335"),Vt(165,130,{width:150,height:15},"#d4896a","#262335"),Vt(485,130,{width:150,height:15},"#d4896a","#262335")],bombs:[ne(600,95,1,1),ne(550,95,2,1),ne(500,95,3,1),ne(180,440,4,2),ne(230,440,5,2),ne(280,440,6,2),ne(280,95,7,3),ne(230,95,8,3),ne(180,95,9,3),ne(600,440,10,4),ne(550,440,11,4),ne(500,440,12,4),ne(385,70,13,5),ne(385,120,14,5),ne(385,170,15,5),ne(500,500,16,6),ne(550,500,17,6),ne(600,500,18,6),ne(180,500,19,7),ne(230,500,20,7),ne(280,500,21,7),ne(360,345,22,8),ne(410,345,23,8)],coinSpawnPoints:[{x:400,y:H.CANVAS_HEIGHT-150,type:It.POWER,spawnAngle:60},{x:400,y:H.CANVAS_HEIGHT-250,type:It.POWER,spawnAngle:120},{x:520,y:100,type:It.BONUS_MULTIPLIER,spawnAngle:120},{x:180,y:100,type:It.BONUS_MULTIPLIER,spawnAngle:120},{x:520,y:100,type:It.EXTRA_LIFE,spawnAngle:120},{x:180,y:100,type:It.EXTRA_LIFE,spawnAngle:120}],monsterSpawnPoints:[{spawnDelay:7e3,createMonster:()=>ff(750,500,1)},{spawnDelay:15e3,createMonster:()=>df(50,500,1)}],monsters:[pi(165,130,150,"left",0,.7),pi(485,130,150,"right",0,1),pi(300,240,200,"left",0,1),Is(50,300,45,1),Is(750,500,155,1)]},GR={id:"level3",name:"skatteetaten",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#4ecdc4",groupSequence:[1,2,3,4,5,6,7],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#3c4c56"},platforms:[Vt(150,490,{width:500,height:15},"#acc7d0","#556d7b"),Vt(100,400,{width:200,height:15},"#acc7d0","#556d7b"),Vt(500,400,{width:200,height:15},"#acc7d0","#556d7b"),Vt(100,250,{width:200,height:15},"#acc7d0","#556d7b"),Vt(500,250,{width:200,height:15},"#acc7d0","#556d7b"),Vt(150,130,{width:500,height:15},"#acc7d0","#556d7b")],bombs:[ne(540,275,1,1),ne(590,275,2,1),ne(640,275,3,1),ne(240,275,4,2),ne(190,275,5,2),ne(140,275,6,2),ne(325,515,7,3),ne(375,515,8,3),ne(425,515,9,3),ne(760,360,10,4),ne(760,310,11,4),ne(760,260,12,4),ne(15,360,13,5),ne(15,310,14,5),ne(15,260,15,5),ne(325,155,16,6),ne(375,155,17,6),ne(425,155,18,6),ne(375,205,19,6),ne(375,255,20,6),ne(580,455,21,7),ne(195,455,22,7),ne(375,95,23,7)],coinSpawnPoints:[],monsters:[pi(150,490,500,"left",0,1),pi(150,130,500,"left",0,1),pi(150,130,500,"right",0,1),pi(100,400,200,"right",0,1),pi(500,400,200,"left",0,1),ff(200,200,1,.1,500)],monsterSpawnPoints:[{spawnDelay:3e3,createMonster:()=>Is(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE),150,1)},{spawnDelay:6e3,createMonster:()=>Is(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE),50,1)},{spawnDelay:5e3,createMonster:()=>df(50,550,1,8e3)}]},YR={id:"level4",name:"nav",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#ffe66d",groupSequence:[1,2,3,4,5],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#586c5c"},platforms:[Vt(580,500,{width:150,height:15},"#586c5c","#202e32"),Vt(580,445,{width:150,height:15},"#586c5c","#202e32"),pf(500,245,150,"#586c5c","#202e32"),pf(555,245,150,"#586c5c","#202e32"),Vt(90,45,{width:150,height:15},"#586c5c","#202e32"),Vt(90,100,{width:150,height:15},"#586c5c","#202e32"),pf(240,160,150,"#586c5c","#202e32"),pf(295,160,150,"#586c5c","#202e32"),Vt(90,500,{width:200,height:15},"#586c5c","#202e32"),Vt(235,400,{width:150,height:15},"#586c5c","#202e32"),Vt(415,145,{width:150,height:15},"#586c5c","#202e32"),Vt(530,45,{width:200,height:15},"#586c5c","#202e32")],bombs:[ne(595,467,1,1),ne(645,467,2,1),ne(695,467,3,1),ne(522,255,4,2),ne(522,305,5,2),ne(522,355,6,2),ne(130,467,7,3),ne(180,467,8,3),ne(230,467,9,3),ne(250,367,10,4),ne(300,367,11,4),ne(350,367,12,4),ne(263,170,13,5),ne(263,220,14,5),ne(263,270,15,5),ne(100,67,16,6),ne(150,67,17,6),ne(200,67,18,6),ne(430,113,19,7),ne(480,113,20,7),ne(530,113,21,7),ne(630,68,22,8),ne(680,68,23,8)],coinSpawnPoints:[],monsterSpawnPoints:[{spawnDelay:4e3,createMonster:()=>Is(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE),65,1)},{spawnDelay:6e3,createMonster:()=>Is(240,350,40,1)},{spawnDelay:2e3,createMonster:()=>df(50,50,1.2,8e3)},{spawnDelay:4e3,createMonster:()=>df(50,50,1.2,8e3)},{spawnDelay:4e3,createMonster:()=>ff(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE),3,.5)},{spawnDelay:9e3,createMonster:()=>ff(590,400,3,.5)}],monsters:[Ps(500,170,350,"right"),Ps(240,60,340,"right"),pi(90,500,200,"left"),pi(90,45,150,"right")]},WR={id:"level5",name:"kommunehuset",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#a8e6cf",groupSequence:[1,2,3,4,5,6],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#8d4fc9"},platforms:[Vt(375,300,{width:50,height:15},"#ff4700","#631b09"),Vt(88,300,{width:50,height:15},"#ff4700","#631b09"),Vt(667,300,{width:50,height:15},"#ff4700","#631b09")],bombs:[ne(150,60,1,1),ne(100,60,2,1),ne(50,60,3,1),ne(625,60,4,2),ne(675,60,5,2),ne(725,60,6,2),ne(150,525,7,3),ne(100,525,8,3),ne(50,525,9,3),ne(625,525,10,4),ne(675,525,11,4),ne(725,525,12,4),ne(438,100,13,5),ne(388,100,14,5),ne(338,100,15,5),ne(338,525,16,6),ne(388,525,17,6),ne(438,525,18,6),ne(388,330,19,6),ne(388,380,20,6),ne(388,430,21,6),ne(101,270,22,7),ne(680,270,23,7)],monsters:[Ps(520,200,350,"right"),Ps(225,200,350,"right"),Ps(520,20,350,"right"),Ps(225,20,350,"right"),pi(0,550,800,"left")],monsterSpawnPoints:[{spawnDelay:5e3,createMonster:()=>df(700,150)},{spawnDelay:7e3,createMonster:()=>Is(100,150)},{spawnDelay:1e4,createMonster:()=>ff(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE+200))},{spawnDelay:15e3,createMonster:()=>Is(Us(H.MONSTER_SIZE),zs(H.MONSTER_SIZE-200))}],coinSpawnPoints:[{x:400,y:500,type:It.POWER,spawnAngle:46},{x:500,y:200,type:It.POWER,spawnAngle:45},{x:388,y:50,type:It.BONUS_MULTIPLIER},{x:388,y:50,type:It.EXTRA_LIFE},{x:101,y:50,type:It.BONUS_MULTIPLIER},{x:101,y:50,type:It.EXTRA_LIFE},{x:680,y:50,type:It.BONUS_MULTIPLIER},{x:680,y:50,type:It.EXTRA_LIFE}]};Vt(200,H.CANVAS_HEIGHT-120,{width:200,height:15},"#ebb185"),Vt(600,H.CANVAS_HEIGHT-110,{width:200,height:15},"#ebb185"),Vt(100,H.CANVAS_HEIGHT-180,{width:200,height:15},"#ebb185"),Vt(700,H.CANVAS_HEIGHT-180,{width:200,height:15},"#ebb185"),Vt(300,H.CANVAS_HEIGHT-240,{width:200,height:15},"#ebb185"),Vt(500,H.CANVAS_HEIGHT-240,{width:200,height:15},"#ebb185"),Vt(150,H.CANVAS_HEIGHT-300,{width:200,height:15},"#ebb185"),Vt(650,H.CANVAS_HEIGHT-300,{width:200,height:15},"#ebb185"),Vt(400,H.CANVAS_HEIGHT-370,{width:200,height:15},"#ebb185"),Vt(250,H.CANVAS_HEIGHT-420,{width:200,height:15},"#ebb185"),Vt(550,H.CANVAS_HEIGHT-420,{width:200,height:15},"#ebb185"),H.CANVAS_HEIGHT-70,H.MONSTER_SIZE,H.MONSTER_SIZE,rr.MONSTER,kn.HORIZONTAL_PATROL,H.CANVAS_HEIGHT-130,H.MONSTER_SIZE,H.MONSTER_SIZE,rr.MONSTER,kn.HORIZONTAL_PATROL,H.CANVAS_HEIGHT-170,H.MONSTER_SIZE,H.MONSTER_SIZE,rr.MONSTER,kn.HORIZONTAL_PATROL,H.CANVAS_HEIGHT-290,H.MONSTER_SIZE,H.MONSTER_SIZE,rr.MONSTER,kn.HORIZONTAL_PATROL,H.CANVAS_HEIGHT-350,H.MONSTER_SIZE,H.MONSTER_SIZE,rr.MONSTER,kn.HORIZONTAL_PATROL,H.CANVAS_HEIGHT-100,It.POWER,H.CANVAS_HEIGHT-140,It.POWER;const XR={id:"level7",name:"silicone vally",width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT,playerStart:hf(H.PLAYER_WIDTH,H.PLAYER_HEIGHT),spawnIndicatorColor:"#feca57",groupSequence:[1,2,3,4,5],ground:{x:0,y:H.CANVAS_HEIGHT-40,width:H.CANVAS_WIDTH,height:40,color:"#46474c"},platforms:[],bombs:[ne(440,530,1,1),ne(490,530,2,1),ne(540,530,3,1),ne(590,530,4,1),ne(760,530,5,2),ne(760,480,6,2),ne(760,430,7,2),ne(760,380,8,2),ne(590,330,9,3),ne(540,330,10,3),ne(490,330,11,3),ne(440,330,12,3),ne(290,530,13,4),ne(240,530,14,4),ne(190,530,15,4),ne(140,530,16,4),ne(15,530,17,5),ne(15,480,18,5),ne(15,430,19,5),ne(15,380,20,5),ne(190,330,21,6),ne(240,330,22,6),ne(290,330,23,6)],coinSpawnPoints:[],monsterSpawnPoints:[],monsters:[]},vf=[VR,$R,GR,YR,WR,XR],KR=(c,a)=>(Pe.info(`Initializing game state slice with ${H.STARTING_LIVES} lives`),{currentState:ot.MENU,score:0,levelScore:0,lives:H.STARTING_LIVES,currentLevel:1,showMenu:Pt.START,previousMenu:null,isPaused:!1,bonusAnimationComplete:!1,setState:l=>{c({currentState:l,isPaused:l===ot.PAUSED}),l===ot.MENU?c({showMenu:Pt.START}):l===ot.PLAYING&&c({showMenu:Pt.IN_GAME});const f=a(),h="currentMap"in f?f.currentMap:void 0;Iv(l,h?.name)},setMenuType:l=>{const f=a();l===Pt.SETTINGS?c({showMenu:l,previousMenu:f.showMenu}):c({showMenu:l})},setBonusAnimationComplete:l=>{c({bonusAnimationComplete:l})},loseLife:()=>{const{lives:l}=a(),f=l-1;Pe.info(`Losing life: ${l} → ${f}`),c({lives:f});const h=a(),y="currentMap"in h?h.currentMap:void 0;if(Iv(ot.PLAYING,y?.name),f<=0){Pe.info(`GAME OVER triggered at ${f} lives`),c({currentState:ot.GAME_OVER,showMenu:Pt.GAME_OVER});const v="currentMap"in h?h.currentMap:void 0;Iv(ot.GAME_OVER,v?.name);const C="getLevelResults"in h?h.getLevelResults():[],x="multiplier"in h?h.multiplier:1,R="getGameStartTime"in h?h.getGameStartTime():Date.now(),A="getSessionId"in h?h.getSessionId():`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,k=BR(C,a().score,f,x,"failed",R,Date.now()),_={finalScore:a().score,totalLevels:vf.length,completedLevels:C.length,timestamp:Date.now(),lives:f,multiplier:x,levelHistory:C,totalCoinsCollected:k.totalCoinsCollected,totalPowerModeActivations:k.totalPowerModeActivations,totalBombs:k.totalBombs,totalCorrectOrders:k.totalCorrectOrders,averageCompletionTime:k.averageCompletionTime,gameEndReason:"failed",sessionId:A,startTime:R,endTime:Date.now()};jR(_)}},addLife:()=>{const{lives:l}=a(),f=l+1;Pe.info(`Adding life: ${l} → ${f}`),c({lives:f})},nextLevel:()=>{const{currentLevel:l}=a();c({currentLevel:l+1}),c({levelScore:0});const f=a();"resetMultiplier"in f&&(Pe.debug("Resetting multiplier on level change..."),f.resetMultiplier());const h="currentMap"in f?f.currentMap:void 0;Iv(ot.PLAYING,h?.name)},addScore:l=>{const{score:f,levelScore:h,currentLevel:y,lives:v}=a(),C=f+l;c({score:C,levelScore:h+l});const x=a(),R="multiplier"in x?x.multiplier:1,A="currentMap"in x?x.currentMap:void 0;zR(C,A?.name||`Level ${y}`,y,v,R)},resetLevelScores:()=>{c({levelScore:0})},resetGameState:()=>{c({currentState:ot.MENU,score:0,levelScore:0,lives:H.STARTING_LIVES,currentLevel:1,showMenu:Pt.START,previousMenu:null,isPaused:!1,bonusAnimationComplete:!1})}}),QR=(c,a)=>{const l=c?H.BOMB_POINTS.FIREBOMB:H.BOMB_POINTS.NORMAL,f=l*a;return{basePoints:l,actualPoints:f,multiplier:a,isFirebomb:c}},qR=c=>{const{actualPoints:a,isFirebomb:l,multiplier:f}=c;return`🎯 Score: +${a} (${l?"Firebomb":"Normal"} x${f})`},ZR=(c,a)=>{const{MULTIPLIER_THRESHOLDS:l,MAX_MULTIPLIER:f}=H;if(a>=f)return 1;const h=l[a],y=l[a+1];if(!y)return 1;const v=(c-h)/(y-h);return Math.max(0,Math.min(1,v))},JR=(c,a)=>({bombs:[],collectedBombs:[],correctOrderCount:0,nextBombOrder:1,bombManager:null,collectBomb:l=>{const{bombs:f,bombManager:h}=a(),y=f.find(_=>_.order===l);if(!y||!h)return Pe.warn("Bomb or bomb manager not found"),{isValid:!1,isCorrect:!1};const v=h.handleBombClick(y.group,y.order);if(!v.isValid)return{isValid:!1,isCorrect:!1};const C=v.isCorrect,x=a(),R="multiplier"in x?x.multiplier:1,A=QR(C,R);if("addScore"in x&&x.addScore(A.actualPoints),"addMultiplierScore"in x&&x.addMultiplierScore(A.actualPoints),"coinManager"in x&&x.coinManager&&x.coinManager.onPointsEarned(A.actualPoints,!1),(C||A.actualPoints>=400)&&Pe.score(qR(A)),C&&"addFloatingText"in x){const _=f.find(N=>N.order===l);if(_){const N=`${A.actualPoints}`;x.addFloatingText(N,_.x+_.width/2,_.y+_.height/2,1e3,"#FFD700",15)}}const k=f.map(_=>{if(_.order===l)return{..._,isCollected:!0,isCorrect:v.isCorrect};const N=h.getActiveGroup(),z=h.getNextBombOrder(),G=N!==null&&z!==null&&_.group===N&&_.order===z&&!_.isCollected;return{..._,isBlinking:G}});return c({bombs:k,correctOrderCount:h.getCorrectOrderCount(),collectedBombs:Array.from(h.getCollectedBombs()).map(_=>{const[N,z]=_.split("-").map(Number);return z})}),{isValid:!0,isCorrect:v.isCorrect}},setBombs:l=>{c({bombs:l})},setBombManager:l=>{c({bombManager:l})},resetBombState:()=>{c({bombs:[],collectedBombs:[],correctOrderCount:0,nextBombOrder:1,bombManager:null})}});class eM{constructor(a){be(this,"bombs",[]);be(this,"collectedBombs",new Set);be(this,"correctBombs",new Set);be(this,"activeGroup",null);be(this,"nextBombOrder",null);be(this,"gameStarted",!1);this.setBombs(a)}reset(){this.collectedBombs.clear(),this.correctBombs.clear(),this.activeGroup=null,this.nextBombOrder=null,this.gameStarted=!1}setBombs(a){this.bombs=a}handleBombClick(a,l){const f=`${a}-${l}`;if(this.collectedBombs.has(f))return{isValid:!1,isCorrect:!1,gameCompleted:!1};if(!this.gameStarted)return this.startGame(a,l),this.collectBomb(f,!0),this.updateNextBomb(),{isValid:!0,isCorrect:!0,gameCompleted:this.isGameCompleted()};const h=this.isValidBomb(a,l);return h?(this.collectBomb(f,!0),this.updateNextBomb()):this.collectBomb(f,!1),{isValid:!0,isCorrect:h,gameCompleted:this.isGameCompleted()}}startGame(a,l){this.gameStarted=!0,this.activeGroup=a,this.nextBombOrder=this.findLowestOrderInGroup(a)}isValidBomb(a,l){return this.activeGroup===null||this.nextBombOrder===null?!1:a===this.activeGroup&&l===this.nextBombOrder&&!this.collectedBombs.has(`${a}-${l}`)}collectBomb(a,l){this.collectedBombs.add(a),l&&this.correctBombs.add(a)}updateNextBomb(){if(this.activeGroup!==null)if(this.isGroupCompleted(this.activeGroup)){Pe.dev(`GROUP ${this.activeGroup} COMPLETED!`);const a=this.findNextAvailableGroup();if(a!==null)this.activeGroup=a,this.nextBombOrder=this.findLowestOrderInGroup(a);else{this.activeGroup=null,this.nextBombOrder=null;return}}else{const a=this.findNextAvailableOrderInGroup(this.activeGroup);a!==null&&(this.nextBombOrder=a)}}isGroupCompleted(a){return this.bombs.filter(f=>f.group===a).every(f=>{const h=`${f.group}-${f.order}`;return this.collectedBombs.has(h)})}findNextAvailableGroup(){const a=[...new Set(this.bombs.map(l=>l.group))].sort((l,f)=>l-f);for(const l of a)if(!this.isGroupCompleted(l))return l;return null}findLowestOrderInGroup(a){const f=this.bombs.filter(h=>h.group===a).filter(h=>{const y=`${h.group}-${h.order}`;return!this.collectedBombs.has(y)});return f.length>0?Math.min(...f.map(h=>h.order)):null}findNextAvailableOrderInGroup(a){return this.findLowestOrderInGroup(a)}isGameCompleted(){return this.collectedBombs.size===this.bombs.length}getCollectedBombs(){return new Set(this.collectedBombs)}getCorrectBombs(){return new Set(this.correctBombs)}getActiveGroup(){return this.activeGroup}getNextBombOrder(){return this.nextBombOrder}isGameStarted(){return this.gameStarted}getCorrectOrderCount(){return this.correctBombs.size}}const tM=(c,a)=>({currentMap:null,levelStartTime:0,levelCompletionTime:null,monsters:[],platforms:[],ground:null,initializeLevel:l=>{const f=new eM(l.bombs),y=[...l.bombs].sort((x,R)=>x.group-R.group||x.order-R.order)[0],v=x=>{switch(x){case kn.HORIZONTAL_PATROL:return rr.MONSTER;case kn.VERTICAL_PATROL:return"#FF6B6B";case kn.CHASER:return"#FFD93D";case kn.AMBUSHER:return"#FF8800";case kn.FLOATER:return"#4ECDC4";default:return rr.MONSTER}},C=l.monsters.map(x=>({...x,color:x.color||v(x.type)}));return c({currentMap:l,platforms:l.platforms,ground:l.ground,monsters:C}),{bombManager:f,firstBomb:y}},updateMonsters:l=>{c({monsters:l})},resetLevelState:()=>{c({currentMap:null,levelStartTime:0,levelCompletionTime:null,monsters:[],platforms:[],ground:null})},sendLevelCompletionData:l=>{const{levelStartTime:f}=a(),h=Date.now()-f,y={...l,timestamp:Date.now(),completionTime:h};Pe.debug("Sending level completion data:",y),ux(y)}}),nM=(c,a)=>({levelHistory:[],gameStartTime:0,sessionId:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,addLevelResult:l=>{c(f=>({levelHistory:[...f.levelHistory,{...l,completionTime:l.completionTime||0,timestamp:l.timestamp||Date.now(),lives:l.lives||0,multiplier:l.multiplier||1,totalBombs:l.totalBombs||0,correctOrderCount:l.correctOrderCount||0}]}))},getLevelResults:()=>a().levelHistory,resetLevelHistory:()=>{c({levelHistory:[],gameStartTime:Date.now(),sessionId:`session_${Date.now()}_${Math.random().toString(36).substr(2,9)}`})},setGameStartTime:l=>{c({gameStartTime:l})},getGameStartTime:()=>a().gameStartTime,getSessionId:()=>a().sessionId}),rM=(c,a)=>({multiplier:1,multiplierScore:0,calculateMultiplier:l=>{const{MULTIPLIER_THRESHOLDS:f,MAX_MULTIPLIER:h}=H;for(let y=h;y>=1;y--)if(l>=f[y])return y;return 1},addMultiplierScore:l=>{const{multiplier:f,multiplierScore:h,calculateMultiplier:y}=a(),v=h+l,C=y(v),x=C>f;return c({multiplier:Math.max(f,C),multiplierScore:x?0:v}),{newMultiplier:Math.max(f,C),multiplierIncreased:x}},resetMultiplier:()=>{c({multiplier:1,multiplierScore:0})},setMultiplier:(l,f)=>{c({multiplier:l,multiplierScore:f})}}),aM=(c,a)=>({audioSettings:lx,audioManager:null,updateAudioSettings:l=>{c({audioSettings:{...a().audioSettings,...l}});const f=a().audioManager;f&&f.updateVolumes&&f.updateVolumes()},resetAudioSettings:()=>{c({audioSettings:lx});const l=a().audioManager;l&&l.updateVolumes&&l.updateVolumes()},setAudioManager:l=>{c({audioManager:l})}}),iM=(c,a)=>({coins:[],coinManager:null,activeEffects:{powerMode:!1,powerModeEndTime:0},firebombCount:0,totalCoinsCollected:0,totalPowerCoinsCollected:0,totalBonusMultiplierCoinsCollected:0,totalExtraLifeCoinsCollected:0,setCoins:l=>{c({coins:l})},setCoinManager:l=>{c({coinManager:l})},collectCoin:l=>{const{coinManager:f}=a();if(!f)return;f.collectCoin(l);const h=a().coins.map(N=>N===l?{...N,isCollected:!0}:N);let y=0;if(f.isPowerModeActive()&&l.type==="POWER"&&l.spawnTime!==void 0){const N=f.getPcoinColorForTime(l.spawnTime);y=Date.now()+N.duration}const v={powerMode:f.isPowerModeActive(),powerModeEndTime:y},C=a(),x=C.totalCoinsCollected+1,R=C.totalPowerCoinsCollected+(l.type==="POWER"?1:0),A=C.totalBonusMultiplierCoinsCollected+(l.type==="BONUS_MULTIPLIER"?1:0),k=C.totalExtraLifeCoinsCollected+(l.type==="EXTRA_LIFE"?1:0);c({coins:h,activeEffects:v,totalCoinsCollected:x,totalPowerCoinsCollected:R,totalBonusMultiplierCoinsCollected:A,totalExtraLifeCoinsCollected:k});const _=a();if(l.type==="POWER")"addScore"in _&&_.addScore(H.POWER_COIN_POINTS);else if(l.type==="BONUS_MULTIPLIER"){if("addScore"in _&&"multiplier"in _){const N=_.multiplier,z=1e3*N;if(_.addScore(z),N<H.MAX_MULTIPLIER&&"addMultiplierScore"in _&&"multiplierScore"in _){const{MULTIPLIER_THRESHOLDS:G}=H,J=G[N+1];if(J!==void 0){const de=J-_.multiplierScore;_.addMultiplierScore(de)}}}}else if(l.type==="EXTRA_LIFE"&&"addScore"in _&&"multiplier"in _&&"addLife"in _){const N=_.multiplier,z=H.EXTRA_LIFE_COIN_POINTS*N;_.addScore(z),_.addLife(),Pe.debug("Extra life added via coin slice!")}Pe.debug(`Coin collected: ${l.type} (Total: ${x}, Power: ${R}, Bonus: ${A})`)},onFirebombCollected:()=>{const{coinManager:l}=a();l&&(l.onFirebombCollected(),c({firebombCount:l.getFirebombCount(),coins:l.getCoins()}))},resetCoinState:()=>{const{coinManager:l}=a();l&&l.reset(),c({coins:[],activeEffects:{powerMode:!1,powerModeEndTime:0},firebombCount:0,totalCoinsCollected:0,totalPowerCoinsCollected:0,totalBonusMultiplierCoinsCollected:0,totalExtraLifeCoinsCollected:0})},getCoinStats:()=>{const l=a();return{totalCoinsCollected:l.totalCoinsCollected,totalPowerCoinsCollected:l.totalPowerCoinsCollected,totalBonusMultiplierCoinsCollected:l.totalBonusMultiplierCoinsCollected,totalExtraLifeCoinsCollected:l.totalExtraLifeCoinsCollected}},updateMonsterStates:l=>{const{coinManager:f}=a();if(!f)return;const h=a().activeEffects.powerMode,y=f.isPowerModeActive();h&&!y?l.forEach(C=>{C.isFrozen=!1}):f.updateMonsters(l);let v=0;y&&f&&(v=f.getPowerModeEndTime()),c({activeEffects:{powerMode:y,powerModeEndTime:v}})},resetEffects:()=>{const{coinManager:l}=a();l&&l.resetEffects(),c({activeEffects:{powerMode:!1,powerModeEndTime:0}})}}),oM=(c,a)=>({floatingTexts:[],addFloatingText:(l,f,h,y=1e3,v="#FFFFFF",C=16)=>{const R={id:`floating-text-${Date.now()}-${Math.random()}`,text:l,x:f,y:h,startTime:Date.now(),duration:y,color:v,fontSize:C};c(A=>({floatingTexts:[...A.floatingTexts,R]}))},removeFloatingText:l=>{c(f=>({floatingTexts:f.floatingTexts.filter(h=>h.id!==l)}))},updateFloatingTexts:()=>{const l=Date.now();c(f=>({floatingTexts:f.floatingTexts.filter(h=>l-h.startTime<h.duration)}))},clearAllFloatingTexts:()=>{c({floatingTexts:[]})}}),Yu=class Yu{constructor(){be(this,"config");be(this,"globalPauseState");be(this,"monsterCache");be(this,"globalCache");be(this,"cacheTimeout",1e3);be(this,"globalStartTime",0);this.config=this.getDefaultConfig(),this.globalPauseState=this.createPauseState(),this.monsterCache=new Map,this.globalCache=null}static getInstance(){return Yu.instance||(Yu.instance=new Yu),Yu.instance}getDefaultConfig(){return{base:{ambusher:{ambushInterval:5e3,speed:2},chaser:{speed:1,directness:.3,updateInterval:200},floater:{speed:2,bounceAngle:.2},patrol:{speed:1}},scaling:{ambusher:{ambushInterval:-500,speed:.08},chaser:{speed:.2,directness:.08,updateInterval:-8},floater:{speed:.5,bounceAngle:.008},patrol:{speed:.2}},max:{ambusher:{ambushInterval:500,speed:10},chaser:{speed:5,directness:1,updateInterval:100},floater:{speed:5,bounceAngle:.5},patrol:{speed:5}}}}updateConfig(a){this.config={...this.config,...a},this.clearCache(),Ge.debug("ScalingManager: Configuration updated")}createPauseState(){return{isPaused:!1,pauseStartTime:0,totalPausedTime:0,pauseReasons:new Set}}pause(a="default"){this.globalPauseState.isPaused||(this.globalPauseState.isPaused=!0,this.globalPauseState.pauseStartTime=Date.now()),this.globalPauseState.pauseReasons.add(a),Ge.pause(`Scaling paused (${a})`)}resume(a="default"){if(this.globalPauseState.pauseReasons.delete(a),this.globalPauseState.pauseReasons.size===0&&this.globalPauseState.isPaused){const l=Date.now()-this.globalPauseState.pauseStartTime;this.globalPauseState.totalPausedTime+=l,this.globalPauseState.isPaused=!1,this.clearCache(),Ge.pause(`Scaling resumed (paused for ${(l/1e3).toFixed(1)}s)`)}}isPaused(){return this.globalPauseState.isPaused}getPauseReasons(){return Array.from(this.globalPauseState.pauseReasons)}getPauseStatus(){return{isPaused:this.globalPauseState.isPaused,pauseReasons:this.getPauseReasons(),totalPausedTime:this.globalPauseState.totalPausedTime,timeElapsed:this.getGlobalTimeElapsed(),globalStartTime:this.globalStartTime,currentTime:Date.now()}}startMap(){this.globalStartTime=Date.now(),this.globalPauseState=this.createPauseState(),this.clearCache(),Ge.flow("New map started - difficulty reset")}resetOnDeath(){this.globalStartTime=Date.now(),this.globalPauseState=this.createPauseState(),this.clearCache(),Ge.player("Player died - difficulty reset to base values")}getGlobalScaledValues(){const a=Date.now();if(this.globalCache&&a-this.globalCache.lastUpdate<this.cacheTimeout)return this.globalCache.values;const l=this.calculateScaledValues(this.getGlobalTimeElapsed());return this.globalCache={values:l,lastUpdate:a},l}getGlobalTimeElapsed(){return this.globalStartTime===0?0:(Date.now()-this.globalStartTime-this.globalPauseState.totalPausedTime)/1e3}pauseForPowerMode(){this.pause("power_mode"),Ge.power("Power mode activated - scaling paused")}resumeFromPowerMode(){this.resume("power_mode"),Ge.power("Power mode ended - scaling resumed")}isCurrentlyPausedByPowerMode(){return this.globalPauseState.pauseReasons.has("power_mode")}pauseAllMonsterScaling(){this.pause("monster_scaling"),this.globalPauseState.pauseReasons.size===1&&Ge.pause("All monster scaling paused")}resumeAllMonsterScaling(){this.resume("monster_scaling"),this.globalPauseState.pauseReasons.size===0&&Ge.pause("All monster scaling resumed")}getMonsterScaledValues(a){if(this.initializeMonster(a),a.individualScalingPaused||this.globalPauseState.isPaused)return this.config.base;const l=this.getMonsterCacheKey(a),f=Date.now(),h=this.monsterCache.get(l);if(h&&f-h.lastUpdate<this.cacheTimeout)return h.values;const y=h?.values||this.config.base,v=this.calculateScaledValues(this.getMonsterAge(a));return this.logScalingChanges(a,y,v),this.monsterCache.set(l,{values:v,lastUpdate:f}),v}initializeMonster(a){if(!a.individualSpawnTime){a.individualSpawnTime=Date.now(),a.individualScalingPaused=!1,a.spawnPauseTime=this.globalPauseState.totalPausedTime;const l=this.config.base;let f="";switch(a.type){case"AMBUSHER":f=`ambush interval: ${l.ambusher.ambushInterval}ms, speed: ${l.ambusher.speed.toFixed(2)}`;break;case"CHASER":f=`speed: ${l.chaser.speed.toFixed(2)}, directness: ${l.chaser.directness.toFixed(3)}, update interval: ${l.chaser.updateInterval}ms`;break;case"FLOATER":f=`speed: ${l.floater.speed.toFixed(2)}, bounce angle: ${l.floater.bounceAngle.toFixed(3)}`;break;case"HORIZONTAL_PATROL":case"VERTICAL_PATROL":f=`speed: ${l.patrol.speed.toFixed(2)}`;break;default:f="base values"}Ge.scaling(`${a.type} initialized with ${f}`)}}resetMonsterScaling(a){a.individualSpawnTime=Date.now(),a.individualScalingPaused=!1,a.spawnPauseTime=this.globalPauseState.totalPausedTime,this.monsterCache.delete(this.getMonsterCacheKey(a)),Ge.monster(`${a.type} scaling reset`)}pauseMonsterScaling(a){a.individualScalingPaused=!0,this.monsterCache.delete(this.getMonsterCacheKey(a))}resumeMonsterScaling(a){a.individualScalingPaused=!1,this.monsterCache.delete(this.getMonsterCacheKey(a))}getMonsterAge(a){if(!a.individualSpawnTime)return 0;const f=Date.now()-a.individualSpawnTime,h=this.globalPauseState.totalPausedTime-(a.spawnPauseTime||0),y=f-h,v=Math.max(0,y)/1e3;return this.globalPauseState.isPaused&&v>0&&Ge.debug(`Monster age: ${a.type} - Actual: ${(f/1e3).toFixed(1)}s, Paused: ${(h/1e3).toFixed(1)}s, Adjusted: ${v.toFixed(1)}s`),v}getMonsterCacheKey(a){const l=`${Math.round(a.x)}-${Math.round(a.y)}`;return`${a.type}-${l}-${a.individualSpawnTime||0}`}logScalingChanges(a,l,f){const h=this.getMonsterAge(a),y=Math.floor(h/5);if(y>0&&y%1===0){const v=[];switch(a.type){case"AMBUSHER":Math.abs(l.ambusher.speed-f.ambusher.speed)>.01&&v.push(`speed: ${l.ambusher.speed.toFixed(2)} → ${f.ambusher.speed.toFixed(2)}`),Math.abs(l.ambusher.ambushInterval-f.ambusher.ambushInterval)>50&&v.push(`ambush interval: ${l.ambusher.ambushInterval}ms → ${f.ambusher.ambushInterval}ms`);break;case"CHASER":Math.abs(l.chaser.speed-f.chaser.speed)>.01&&v.push(`speed: ${l.chaser.speed.toFixed(2)} → ${f.chaser.speed.toFixed(2)}`),Math.abs(l.chaser.directness-f.chaser.directness)>.01&&v.push(`directness: ${l.chaser.directness.toFixed(3)} → ${f.chaser.directness.toFixed(3)}`),Math.abs(l.chaser.updateInterval-f.chaser.updateInterval)>5&&v.push(`update interval: ${l.chaser.updateInterval}ms → ${f.chaser.updateInterval}ms`);break;case"FLOATER":Math.abs(l.floater.speed-f.floater.speed)>.01&&v.push(`speed: ${l.floater.speed.toFixed(2)} → ${f.floater.speed.toFixed(2)}`),Math.abs(l.floater.bounceAngle-f.floater.bounceAngle)>.001&&v.push(`bounce angle: ${l.floater.bounceAngle.toFixed(3)} → ${f.floater.bounceAngle.toFixed(3)}`);break;case"HORIZONTAL_PATROL":case"VERTICAL_PATROL":Math.abs(l.patrol.speed-f.patrol.speed)>.01&&v.push(`speed: ${l.patrol.speed.toFixed(2)} → ${f.patrol.speed.toFixed(2)}`);break}v.length>0&&Ge.scaling(`${a.type} scaling (${h.toFixed(1)}s, interval ${y}): ${v.join(", ")}`)}}calculateScaledValues(a){const l=Math.floor(a/5);return{ambusher:{ambushInterval:this.calculateScaledValue(this.config.base.ambusher.ambushInterval,this.config.scaling.ambusher.ambushInterval,this.config.max.ambusher.ambushInterval,l),speed:this.calculateScaledValue(this.config.base.ambusher.speed,this.config.scaling.ambusher.speed,this.config.max.ambusher.speed,l)},chaser:{speed:this.calculateScaledValue(this.config.base.chaser.speed,this.config.scaling.chaser.speed,this.config.max.chaser.speed,l),directness:this.calculateScaledValue(this.config.base.chaser.directness,this.config.scaling.chaser.directness,this.config.max.chaser.directness,l),updateInterval:this.calculateScaledValue(this.config.base.chaser.updateInterval,this.config.scaling.chaser.updateInterval,this.config.max.chaser.updateInterval,l)},floater:{speed:this.calculateScaledValue(this.config.base.floater.speed,this.config.scaling.floater.speed,this.config.max.floater.speed,l),bounceAngle:this.calculateScaledValue(this.config.base.floater.bounceAngle,this.config.scaling.floater.bounceAngle,this.config.max.floater.bounceAngle,l)},patrol:{speed:this.calculateScaledValue(this.config.base.patrol.speed,this.config.scaling.patrol.speed,this.config.max.patrol.speed,l)}}}calculateScaledValue(a,l,f,h){const y=a+l*h;return l>0?Math.min(y,f):Math.max(y,f)}clearCache(){this.monsterCache.clear(),this.globalCache=null}getBaseValues(){return{...this.config.base}}cleanup(){this.clearCache(),this.globalPauseState=this.createPauseState()}};be(Yu,"instance");let ca=Yu;const Uv={POWER_MODE:{type:"POWER_MODE",duration:H.POWER_COIN_DURATION,points:H.POWER_COIN_POINTS,apply:(c,a)=>{let l=H.POWER_COIN_DURATION;if(a&&a.spawnTime!==void 0){const f=c.coinManager;if(f&&typeof f.getPcoinColorForTime=="function")try{l=f.getPcoinColorForTime(a.spawnTime).duration||H.POWER_COIN_DURATION}catch(h){console.warn("Failed to get P-coin color data, using default duration:",h)}}c.monsters&&Array.isArray(c.monsters)&&c.monsters.forEach(f=>{f.isFrozen=!0}),c.activeEffects.powerMode=!0,c.activeEffects.powerModeEndTime=Date.now()+l,c.coinManager&&c.coinManager.resetMonsterKillCount();try{ca.getInstance().pauseForPowerMode()}catch{console.log("Could not pause difficulty scaling (ScalingManager not available)")}},remove:c=>{c.monsters&&Array.isArray(c.monsters)&&c.monsters.forEach(a=>{a.isFrozen=!1}),c.activeEffects.powerMode=!1;try{ca.getInstance().resumeFromPowerMode()}catch{console.log("Could not resume difficulty scaling (ScalingManager not available)")}}},BONUS_MULTIPLIER:{type:"BONUS_MULTIPLIER",points:0,apply:c=>{const a=1e3*c.multiplier;c.addScore(a),c.multiplier<H.MAX_MULTIPLIER&&c.setMultiplier(c.multiplier+1,0)}},EXTRA_LIFE:{type:"EXTRA_LIFE",points:1e3,apply:c=>{c.lives+=1}}},mp={STANDARD:{hasGravity:!0,bounces:!0,reflects:!1},POWER:{hasGravity:!1,bounces:!1,reflects:!0},GRAVITY_ONLY:{hasGravity:!1,bounces:!1,reflects:!1,customUpdate:(c,a,l)=>{if((c.velocityY>0||c.velocityY===void 0)&&(c.velocityX=0,c.velocityY=2),l&&c.y+c.height>=l.y){c.y=l.y-c.height,c.velocityY=0,c.groundDirection||(c.groundDirection=Math.random()<.5?-1:1,c.velocityX=c.groundDirection*1),c.x+=c.velocityX,c.x<=0?(c.x=0,c.groundDirection=1,c.velocityX=1):c.x+c.width>=H.CANVAS_WIDTH&&(c.x=H.CANVAS_WIDTH-c.width,c.groundDirection=-1,c.velocityX=-1);return}let C=!1,x=null;for(const R of a){const A=c.y+c.height,k=R.y,_=A>=k&&A<=k+4,N=c.x<R.x+R.width&&c.x+c.width>R.x;if(_&&N){C=!0,x=R,c.y=k-c.height,c.velocityY=0,c.platformDirection||(c.platformDirection=Math.random()<.5?-1:1,c.velocityX=c.platformDirection*1);break}}C&&x?(c.x+=c.velocityX,(c.x+c.width<=x.x+0||c.x>=x.x+x.width-0)&&(c.platformDirection=null,c.velocityX=0,c.velocityY=2)):C||(c.platformDirection=null,c.velocityX=0,c.velocityY=2)}}},gp=[{color:"#3c82f6",points:100,name:"Blue",duration:3e3},{color:"#ef4444",points:200,name:"Red",duration:4e3},{color:"#a855f7",points:300,name:"Purple",duration:5e3},{color:"#22c55d",points:500,name:"Green",duration:6e3},{color:"#07b6d4",points:800,name:"Cyan",duration:7e3},{color:"#ebb305",points:1200,name:"Yellow",duration:8e3},{color:"#6b7280",points:2e3,name:"Gray",duration:1e4}],Fs={[It.POWER]:{type:It.POWER,color:"#FF0000",points:0,physics:mp.POWER,effects:[Uv.POWER_MODE],spawnCondition:c=>c.firebombCount%9===0,maxActive:1},[It.BONUS_MULTIPLIER]:{type:It.BONUS_MULTIPLIER,color:"#e9b300",points:H.BONUS_MULTIPLIER_COIN_POINTS,physics:mp.GRAVITY_ONLY,effects:[Uv.BONUS_MULTIPLIER],spawnCondition:c=>{const a=c.bombAndMonsterPoints||c.score||0;return a>0&&a%H.BONUS_COIN_SPAWN_INTERVAL===0},maxActive:1},[It.EXTRA_LIFE]:{type:It.EXTRA_LIFE,color:"#ef4444",points:H.EXTRA_LIFE_COIN_POINTS,physics:mp.GRAVITY_ONLY,effects:[Uv.EXTRA_LIFE],spawnCondition:c=>{const a=c.totalBonusMultiplierCoinsCollected||0;return a>0&&a%H.EXTRA_LIFE_COIN_RATIO===0},maxActive:1}};class yp{static updateCoin(a,l,f,h){a.isCollected||(h?(h.hasGravity&&(a.velocityY+=H.COIN_GRAVITY),a.x+=a.velocityX,a.y+=a.velocityY,h.reflects?this.handleReflectiveCollisions(a,l,f):h.bounces&&this.handleBouncingCollisions(a,l,f),h.customUpdate&&h.customUpdate(a,l,f)):this.updateStandardCoin(a,l,f))}static updateStandardCoin(a,l,f){this.updateCoin(a,l,f,mp.STANDARD)}static updatePowerCoin(a,l,f){this.updateCoin(a,l,f,mp.POWER)}static handleBouncingCollisions(a,l,f){this.handleBoundaryCollisions(a),this.handlePlatformCollisions(a,l),this.handleGroundCollisions(a,f)}static handleReflectiveCollisions(a,l,f){this.handlePowerCoinBoundaryCollisions(a),this.handlePowerCoinPlatformCollisions(a,l),this.handlePowerCoinGroundCollisions(a,f)}static handleBoundaryCollisions(a){a.x<=0?(a.x=0,a.velocityX=Math.abs(a.velocityX)*H.COIN_BOUNCE_DAMPING):a.x+a.width>=H.CANVAS_WIDTH&&(a.x=H.CANVAS_WIDTH-a.width,a.velocityX=-Math.abs(a.velocityX)*H.COIN_BOUNCE_DAMPING),a.y<=0&&(a.y=0,a.velocityY=Math.abs(a.velocityY)*H.COIN_BOUNCE_DAMPING)}static handlePowerCoinBoundaryCollisions(a){a.x<=0?(a.x=0,a.velocityX=Math.abs(a.velocityX)):a.x+a.width>=H.CANVAS_WIDTH&&(a.x=H.CANVAS_WIDTH-a.width,a.velocityX=-Math.abs(a.velocityX)),a.y<=0?(a.y=0,a.velocityY=Math.abs(a.velocityY)):a.y+a.height>=H.CANVAS_HEIGHT&&(a.y=H.CANVAS_HEIGHT-a.height,a.velocityY=-Math.abs(a.velocityY))}static handlePlatformCollisions(a,l){l.forEach(f=>{if(this.isColliding(a,f)){const h=a.x+a.width/2,y=a.y+a.height/2,v=f.x+f.width/2,C=f.y+f.height/2,x=h-v,R=y-C;Math.abs(x)>Math.abs(R)?x>0?(a.x=f.x+f.width,a.velocityX=Math.abs(a.velocityX)*H.COIN_BOUNCE_DAMPING):(a.x=f.x-a.width,a.velocityX=-Math.abs(a.velocityX)*H.COIN_BOUNCE_DAMPING):R>0?(a.y=f.y+f.height,a.velocityY=Math.abs(a.velocityY)*H.COIN_BOUNCE_DAMPING):(a.y=f.y-a.height,a.velocityY=-Math.abs(a.velocityY)*H.COIN_BOUNCE_DAMPING)}})}static handlePowerCoinPlatformCollisions(a,l){for(const f of l)if(this.isColliding(a,f)){const h=this.calculateCollisionNormal(a,f);Math.random()<.1&&Pe.debug(`P-coin platform collision - Normal: (${h.x.toFixed(2)}, ${h.y.toFixed(2)}), Velocity before: (${a.velocityX.toFixed(2)}, ${a.velocityY.toFixed(2)})`);const y=a.velocityX*h.x+a.velocityY*h.y;a.velocityX,a.velocityY,a.velocityX=a.velocityX-2*y*h.x,a.velocityY=a.velocityY-2*y*h.y,Math.random()<.1&&Pe.debug(`P-coin platform collision - Velocity after: (${a.velocityX.toFixed(2)}, ${a.velocityY.toFixed(2)})`),h.x!==0?h.x>0?a.x=f.x+f.width+1:a.x=f.x-a.width-1:h.y>0?a.y=f.y+f.height+1:a.y=f.y-a.height-1;break}}static handleGroundCollisions(a,l){this.isColliding(a,l)&&(a.y=l.y-a.height,a.velocityY=-Math.abs(a.velocityY)*H.COIN_BOUNCE_DAMPING,Math.abs(a.velocityY)<.5&&(a.velocityY=0))}static handlePowerCoinGroundCollisions(a,l){if(this.isColliding(a,l)){const f=this.calculateCollisionNormal(a,l),h=a.velocityX*f.x+a.velocityY*f.y;a.velocityX=a.velocityX-2*h*f.x,a.velocityY=a.velocityY-2*h*f.y,a.y=l.y-a.height-1}}static isColliding(a,l){return a.x<l.x+l.width&&a.x+a.width>l.x&&a.y<l.y+l.height&&a.y+a.height>l.y}static createInitialVelocity(){return{velocityX:(Math.random()-.5)*H.COIN_BOUNCE_SPEED*2,velocityY:-3}}static createPowerCoinVelocity(a){const l=H.COIN_BOUNCE_SPEED;if(a!==void 0){const y=a*Math.PI/180;return{velocityX:Math.cos(y)*l,velocityY:Math.sin(y)*l}}const h=Math.random()*360*Math.PI/180;return{velocityX:Math.cos(h)*l,velocityY:Math.sin(h)*l}}static calculateSurfaceNormal(a,l){const f=a.x+a.width/2,h=a.y+a.height/2,y=Math.max(l.x,Math.min(f,l.x+l.width)),v=Math.max(l.y,Math.min(h,l.y+l.height)),C=f-y,x=h-v,R=Math.sqrt(C*C+x*x);if(R>.1)return{x:C/R,y:x/R};{const A=a.x,k=a.x+a.width,_=a.y,N=a.y+a.height,z=l.x,G=l.x+l.width,J=l.y,de=l.y+l.height,ue=Math.abs(k-z),ce=Math.abs(A-G),fe=Math.abs(N-J),le=Math.abs(_-de),Re=Math.min(ue,ce,fe,le);return Re===ue?{x:-1,y:0}:Re===ce?{x:1,y:0}:Re===fe?{x:0,y:-1}:{x:0,y:1}}}static reflectVelocity(a,l){const f=a.velocityX*l.x+a.velocityY*l.y,h=a.velocityX,y=a.velocityY;a.velocityX=a.velocityX-2*f*l.x,a.velocityY=a.velocityY-2*f*l.y;const v=Math.sqrt(h*h+y*y),C=Math.sqrt(a.velocityX*a.velocityX+a.velocityY*a.velocityY);if(C>.001){const x=v/C;a.velocityX*=x,a.velocityY*=x}}static moveCoinOutOfCollision(a,l){const f=a.x+a.width/2,h=a.y+a.height/2,y=Math.max(l.x,Math.min(f,l.x+l.width)),v=Math.max(l.y,Math.min(h,l.y+l.height)),C=f-y,x=h-v;Math.abs(C)>Math.abs(x)?a.x+=C>0?Math.abs(C):-Math.abs(C):a.y+=x>0?Math.abs(x):-Math.abs(x)}static moveCoinOutOfCollisionSimple(a,l){const f=a.x+a.width/2,h=a.y+a.height/2,y=l.x+l.width/2,v=l.y+l.height/2,C=Math.abs(f-y),x=Math.abs(h-v);C>x?f<y?a.x=l.x-a.width-1:a.x=l.x+l.width+1:h<v?a.y=l.y-a.height-1:a.y=l.y+l.height+1}static calculateCollisionNormal(a,l){const f=a.x+a.width/2,h=a.y+a.height/2,y=Math.max(l.x,Math.min(f,l.x+l.width)),v=Math.max(l.y,Math.min(h,l.y+l.height)),C=f-y,x=h-v,R=Math.sqrt(C*C+x*x);if(R>.1)return{x:C/R,y:x/R};{const A=Math.abs(a.x+a.width-l.x),k=Math.abs(a.x-(l.x+l.width)),_=Math.abs(a.y+a.height-l.y),N=Math.abs(a.y-(l.y+l.height)),z=Math.min(A,k,_,N);return z===A?{x:-1,y:0}:z===k?{x:1,y:0}:z===_?{x:0,y:-1}:{x:0,y:1}}}}class lM{constructor(a=[]){be(this,"coins",[]);be(this,"spawnPoints",[]);be(this,"firebombCount",0);be(this,"powerModeActive",!1);be(this,"powerModeEndTime",0);be(this,"activeEffects",new Map);be(this,"triggeredSpawnConditions",new Set);be(this,"lastProcessedScore",0);be(this,"lastScoreCheck",0);be(this,"bombAndMonsterPoints",0);be(this,"monsterKillCount",0);be(this,"pCoinColorIndex",0);this.spawnPoints=a,Pe.debug("CoinManager initialized")}reset(){this.coins=[],this.firebombCount=0,this.powerModeActive=!1,this.powerModeEndTime=0,this.activeEffects.clear(),this.triggeredSpawnConditions.clear(),this.lastProcessedScore=0,this.lastScoreCheck=0,this.bombAndMonsterPoints=0,this.monsterKillCount=0}update(a,l,f){this.coins.forEach(h=>{if(h.isCollected)return;const y=Fs[h.type];y?yp.updateCoin(h,a,l,y.physics):h.type===It.POWER?yp.updatePowerCoin(h,a,l):yp.updateCoin(h,a,l)}),this.checkEffectsEnd(f),this.coins=this.coins.filter(h=>!h.isCollected)}spawnCoin(a,l,f,h){const y=Fs[a];if(y?.maxActive){if(this.coins.filter(R=>R.type===a&&!R.isCollected).length>=y.maxActive){Pe.debug(`${a} coin limit reached (${y.maxActive}), skipping spawn`);return}}else if(this.coins.find(R=>R.type===a)){Pe.debug(`${a} coin already exists, skipping spawn`);return}let v;a===It.POWER?v=yp.createPowerCoinVelocity(h):v=yp.createInitialVelocity();const C={type:a,x:l,y:f,width:H.COIN_SIZE,height:H.COIN_SIZE,velocityX:v.velocityX,velocityY:v.velocityY,isCollected:!1,spawnX:l,spawnY:f};a===It.POWER&&(C.colorIndex=0,C.spawnTime=Date.now(),Pe.debug("Spawning P-coin with Blue color (100 points)")),this.coins.push(C),Pe.debug(`Spawned ${a} coin at (${l}, ${f}) with angle ${h||"random"}`)}onFirebombCollected(){this.firebombCount++,Pe.debug(`Firebomb count: ${this.firebombCount}`),this.checkSpawnConditionsOnFirebombChange()}onPointsEarned(a,l=!1){l||(this.bombAndMonsterPoints+=a,Pe.debug(`Points earned: ${a}, total bomb/monster points: ${this.bombAndMonsterPoints}`),this.checkBcoinSpawnConditions())}checkBcoinSpawnConditions(){const a=Fs.BONUS_MULTIPLIER;if(!a)return;const l=Math.floor(this.bombAndMonsterPoints/H.BONUS_COIN_SPAWN_INTERVAL)*H.BONUS_COIN_SPAWN_INTERVAL,f=Math.floor(this.lastScoreCheck/H.BONUS_COIN_SPAWN_INTERVAL)*H.BONUS_COIN_SPAWN_INTERVAL;if(l>f&&l>=H.BONUS_COIN_SPAWN_INTERVAL){const h=`${a.type}_${l}`;if(this.triggeredSpawnConditions.has(h)){Pe.debug(`B-coin spawn condition already triggered for threshold ${l}`);return}Pe.debug(`B-coin threshold crossed: ${f} -> ${l} (bomb/monster points: ${this.bombAndMonsterPoints})`),this.triggeredSpawnConditions.add(h),this.lastScoreCheck=this.bombAndMonsterPoints;const y=this.spawnPoints.filter(v=>v.type===a.type);if(y.length>0){const v=y[Math.floor(Math.random()*y.length)];this.spawnCoin(a.type,v.x,v.y,v.spawnAngle)}}}checkSpawnConditionsOnFirebombChange(){Object.values(Fs).forEach(a=>{if(a.spawnCondition&&a.spawnCondition.toString().includes("firebombCount")){const l={firebombCount:this.firebombCount};if(a.spawnCondition(l)){const f=`${a.type}_${this.firebombCount}`;if(this.triggeredSpawnConditions.has(f))return;Pe.debug(`P-coin spawn condition met (firebombCount: ${this.firebombCount}, key: ${f})`),this.triggeredSpawnConditions.add(f);const h=this.spawnPoints.filter(y=>y.type===a.type);if(h.length>0){const y=h[Math.floor(Math.random()*h.length)];this.spawnCoin(a.type,y.x,y.y,y.spawnAngle)}else{const y=400+(Math.random()-.5)*200,v=100+Math.random()*100;this.spawnCoin(a.type,y,v)}}}})}checkSpawnConditions(a){Object.values(Fs).forEach(l=>{if(l.spawnCondition&&!l.spawnCondition.toString().includes("firebombCount")&&l.type!=="POWER"){const f={...a,firebombCount:this.firebombCount,bombAndMonsterPoints:this.bombAndMonsterPoints};if(l.spawnCondition(f)){let h=`${l.type}`;if(l.spawnCondition.toString().includes("score")&&l.type==="BONUS_MULTIPLIER"){const v=Math.floor(this.bombAndMonsterPoints/H.BONUS_COIN_SPAWN_INTERVAL)*H.BONUS_COIN_SPAWN_INTERVAL,C=Math.floor(this.lastScoreCheck/H.BONUS_COIN_SPAWN_INTERVAL)*H.BONUS_COIN_SPAWN_INTERVAL;if(v>C&&v>=H.BONUS_COIN_SPAWN_INTERVAL)h=`${l.type}_${v}`,Pe.debug(`B-coin threshold crossed: ${C} -> ${v} (bomb/monster points: ${this.bombAndMonsterPoints})`);else return;this.lastScoreCheck=this.bombAndMonsterPoints}if(l.spawnCondition.toString().includes("totalBonusMultiplierCoinsCollected")){const v=a.totalBonusMultiplierCoinsCollected||0,C=Math.floor(v/H.EXTRA_LIFE_COIN_RATIO)*H.EXTRA_LIFE_COIN_RATIO;h=`${l.type}_${C}`}if(this.triggeredSpawnConditions.has(h))return;Pe.debug(`Spawn condition met for ${l.type} coin (key: ${h})`),this.triggeredSpawnConditions.add(h);const y=this.spawnPoints.filter(v=>v.type===l.type);if(y.length>0){const v=y[Math.floor(Math.random()*y.length)];this.spawnCoin(l.type,v.x,v.y,v.spawnAngle)}else{const v=400+(Math.random()-.5)*200;let C=50;l.physics.hasGravity&&!l.physics.bounces&&!l.physics.reflects?C=50:C=100+Math.random()*100,this.spawnCoin(l.type,v,C)}}}})}collectCoin(a,l){a.isCollected=!0,Pe.debug(`Collected ${a.type} coin`);const f=Fs[a.type];if(f&&l){let h=f.points;if(a.type===It.POWER){const y=a.spawnTime||Date.now(),v=this.getPcoinColorForTime(y),C=l.multiplier||1;h=v.points*C,Pe.debug(`P-coin collected: ${v.name} color, ${v.points} × ${C} = ${h} points`)}else if(a.type===It.BONUS_MULTIPLIER)h=1e3*(l.multiplier||1);else if(a.type===It.EXTRA_LIFE){const y=l.multiplier||1;h=f.points*y}if("addFloatingText"in l&&typeof l.addFloatingText=="function"){const y=h.toString();l.addFloatingText(y,a.x+a.width/2,a.y+a.height/2,1e3,"#fff",15)}f.effects.forEach(y=>{const v={...l,activeEffects:{powerMode:!1,powerModeEndTime:0,...l.activeEffects},coinManager:{resetMonsterKillCount:()=>this.resetMonsterKillCount(),getPcoinColorForTime:C=>this.getPcoinColorForTime(C),getPowerModeEndTime:()=>this.getPowerModeEndTime()},difficultyManager:{pause:()=>{ca.getInstance().pause(),Pe.debug("Difficulty scaling paused (power mode active)")},resume:()=>{ca.getInstance().resume(),Pe.debug("Difficulty scaling resumed (power mode ended)")}}};y.apply(v,a),y.duration&&this.activeEffects.set(y.type,{endTime:Date.now()+y.duration,effect:y})})}else a.type!==It.POWER&&a.type!==It.BONUS_MULTIPLIER&&a.type!==It.EXTRA_LIFE&&Pe.warn(`Unknown coin type: ${a.type}, using legacy behavior`),a.type===It.POWER&&this.activatePowerMode()}checkEffectsEnd(a){const l=Date.now(),f=[];this.activeEffects.forEach((h,y)=>{if(Pe.debug(`Checking effect: ${y}, endTime: ${h.endTime}, currentTime: ${l}, shouldEnd: ${l>=h.endTime}`),l>=h.endTime&&(f.push(y),h.effect.remove&&a)){const v={...a,activeEffects:{powerMode:!1,powerModeEndTime:0,...a.activeEffects},coinManager:{resetMonsterKillCount:()=>this.resetMonsterKillCount(),getPcoinColorForTime:C=>this.getPcoinColorForTime(C),getPowerModeEndTime:()=>this.getPowerModeEndTime()},difficultyManager:{pause:()=>{ca.getInstance().pause(),Pe.debug("Difficulty scaling paused (power mode active)")},resume:()=>{ca.getInstance().resumeFromPowerMode(),Pe.debug("Difficulty scaling resumed (power mode ended)")}}};h.effect.remove(v)}}),f.forEach(h=>{this.activeEffects.delete(h),h==="POWER_MODE"&&(this.powerModeActive=!1,Pe.debug("Power mode deactivated"))})}calculateMonsterKillPoints(a){this.monsterKillCount++;let l;switch(this.monsterKillCount){case 1:l=100;break;case 2:l=200;break;case 3:l=300;break;case 4:l=500;break;case 5:l=800;break;case 6:l=1200;break;case 7:l=1700;break;case 8:l=2300;break;case 9:l=3e3;break;case 10:l=4e3;break;default:l=4e3+(this.monsterKillCount-10)*1e3}const f=l*a;return Pe.debug(`Monster kill #${this.monsterKillCount}: ${l} × ${a} = ${f} points`),f}getPcoinColorForTime(a){const f=Date.now()-a,y=Math.floor(f/1e3)%gp.length;return{...gp[y],index:y}}getCurrentPcoinColor(){return gp[this.pCoinColorIndex]}getPcoinCurrentColor(a){return a.type===It.POWER&&a.spawnTime!==void 0?this.getPcoinColorForTime(a.spawnTime).color:gp[0].color}advancePcoinColor(){this.pCoinColorIndex=(this.pCoinColorIndex+1)%gp.length;const a=this.getCurrentPcoinColor();Pe.debug(`P-coin color advanced to: ${a.name} (${a.points} points)`)}resetMonsterKillCount(){this.monsterKillCount=0,Pe.debug("Monster kill count reset for new power mode session")}isPowerModeActive(){const a=this.activeEffects.get("POWER_MODE");if(a){const l=Date.now()<a.endTime;return l||(this.activeEffects.delete("POWER_MODE"),this.powerModeActive=!1),l}return this.powerModeActive}getCoins(){return this.coins.filter(a=>!a.isCollected)}getAllCoins(){return[...this.coins]}getFirebombCount(){return this.firebombCount}getBombAndMonsterPoints(){return this.bombAndMonsterPoints}updateMonsters(a){if(this.isPowerModeActive()||this.powerModeActive){let f=0;const h=this.activeEffects.get("POWER_MODE");h?f=h.endTime-Date.now():f=this.powerModeEndTime-Date.now();const y=f<=2e3&&f>0;a.forEach(v=>{v.isFrozen=!0,v.isBlinking=y})}else a.forEach(f=>{f.isFrozen=!1,f.isBlinking=!1})}unfreezeAllMonsters(a){a.forEach(l=>{l.isFrozen=!1,l.isBlinking=!1})}resetEffects(){this.powerModeActive=!1,this.powerModeEndTime=0,this.firebombCount=0,this.coins=[],this.activeEffects.clear(),this.bombAndMonsterPoints=0,this.monsterKillCount=0,Pe.debug("Coin effects reset")}getCoinConfig(a){return Fs[a]}isEffectActive(a){return this.activeEffects.has(a)}getPowerModeEndTime(){const a=this.activeEffects.get("POWER_MODE");return a?a.endTime:0}activatePowerMode(){this.powerModeActive=!0;let a=H.POWER_COIN_DURATION;const l=this.coins.find(f=>f.type===It.POWER&&f.spawnTime);l&&l.spawnTime&&(a=this.getPcoinColorForTime(l.spawnTime).duration),this.powerModeEndTime=Date.now()+a,this.resetMonsterKillCount(),this.activeEffects.set("POWER_MODE",{endTime:this.powerModeEndTime,effect:Uv.POWER_MODE}),Pe.debug(`Power mode timing - duration: ${a}ms, endTime: ${this.powerModeEndTime}, currentTime: ${Date.now()}`);try{ca.getInstance().pauseForPowerMode(),Pe.debug("Difficulty scaling paused (power mode active)")}catch{Pe.debug("Could not pause difficulty scaling (ScalingManager not available)")}Pe.debug(`Power mode activated for ${a}ms (${a/1e3}s)`)}}const Ft=PR((c,a,l)=>{const f=IR(c,a),h=KR(c,a),y=JR(c,a),v=tM(c,a),C=nM(c,a),x=rM(c,a),R=aM(c,a),A=iM(c,a),k=oM(c);return{...f,...h,...y,...v,...C,...x,...R,...A,...k,resetGame:()=>{a().resetGameState(),a().resetPlayer(),a().resetBombState(),a().resetLevelState(),a().resetLevelHistory(),a().resetMultiplier(),a().resetAudioSettings(),a().resetCoinState(),a().resetEffects(),a().clearAllFloatingTexts()},initializeLevel:_=>{const{bombManager:N,firstBomb:z}=v.initializeLevel(_),G=_.bombs.map(de=>({...de,isBlinking:!1,isCollected:!1,isCorrect:!1}));a().setBombs(G),a().setBombManager(N);const J=new lM(_.coinSpawnPoints||[]);return a().setCoinManager(J),c({collectedBombs:[],correctOrderCount:0,nextBombOrder:1}),a().setPlayerPosition(_.playerStart.x,_.playerStart.y),{bombManager:N,firstBomb:z}},getLevelHistory:()=>C.getLevelResults(),getGameStartTime:()=>C.getGameStartTime(),getSessionId:()=>C.getSessionId()}});class sM{constructor(){be(this,"keys",new Set);be(this,"keyPressTimes",new Map);be(this,"touchControls",{left:!1,right:!1,up:!1,float:!1});be(this,"boundKeyDownHandler");be(this,"boundKeyUpHandler");be(this,"boundPreventDefaultHandler");this.boundKeyDownHandler=this.handleKeyDown.bind(this),this.boundKeyUpHandler=this.handleKeyUp.bind(this),this.boundPreventDefaultHandler=a=>{["ArrowLeft","ArrowRight","ArrowUp","Space"," ","p","P"].includes(a.key)&&a.preventDefault()},this.bindEvents()}bindEvents(){document.addEventListener("keydown",this.boundKeyDownHandler),document.addEventListener("keyup",this.boundKeyUpHandler),document.addEventListener("keydown",this.boundPreventDefaultHandler)}isKeyPressed(a){return this.keys.has(a)||this.getTouchControl(a)}isShiftPressed(){return this.keys.has("Shift")}getKeyPressDuration(a){const l=this.keyPressTimes.get(a);return l&&this.keys.has(a)?Date.now()-l:0}getTouchControl(a){switch(a){case"ArrowLeft":return this.touchControls.left;case"ArrowRight":return this.touchControls.right;case"ArrowUp":return this.touchControls.up;case" ":case"Space":return this.touchControls.float;default:return!1}}handleKeyDown(a){this.keys.has(a.key)||this.keyPressTimes.set(a.key,Date.now()),this.keys.add(a.key)}handleKeyUp(a){this.keys.delete(a.key),this.keyPressTimes.delete(a.key)}setTouchControl(a,l){this.touchControls[a]=l}cleanup(){document.removeEventListener("keydown",this.boundKeyDownHandler),document.removeEventListener("keyup",this.boundKeyUpHandler),document.removeEventListener("keydown",this.boundPreventDefaultHandler)}}class uM{checkPlayerPlatformCollision(a,l){for(const f of l){const h=this.checkFullCollision(a,f);if(h.hasCollision)return h}return{hasCollision:!1}}checkPlayerGroundCollision(a,l){return this.checkFullCollision(a,l)}checkMonsterGroundCollision(a,l){return this.checkFullCollision(a,l)}checkPlayerCoinCollision(a,l){for(const f of l)if(!f.isCollected&&this.isColliding(a,f))return f;return null}checkFullCollision(a,l){const f=a.x+(a.velocityX||0),h=a.y+(a.velocityY||0);if(this.wouldCollide(f,h,a.width,a.height,l)){const y=a.x+a.width/2,v=a.y+a.height/2,C=l.x+l.width/2,x=l.y+l.height/2,R=y-C,A=v-x,k=(a.width+l.width)/2-Math.abs(R),_=(a.height+l.height)/2-Math.abs(A);return k<_?R>0?{hasCollision:!0,normal:{x:1,y:0},penetration:k}:{hasCollision:!0,normal:{x:-1,y:0},penetration:k}:A>0?{hasCollision:!0,normal:{x:0,y:1},penetration:_}:{hasCollision:!0,normal:{x:0,y:-1},penetration:_}}return{hasCollision:!1}}wouldCollide(a,l,f,h,y){return a<y.x+y.width&&a+f>y.x&&l<y.y+y.height&&l+h>y.y}checkPlayerBombCollision(a,l){for(const f of l)if(!f.isCollected&&this.isColliding(a,f))return f;return null}checkPlayerMonsterCollision(a,l){for(const f of l)if(f.isActive&&this.isColliding(a,f))return f;return null}checkBoundaryCollision(a,l){const f=a.x,h=a.y;return f<0?{hasCollision:!0,normal:{x:1,y:0},penetration:Math.abs(f)}:f+a.width>l.width?{hasCollision:!0,normal:{x:-1,y:0},penetration:f+a.width-l.width}:h<0?{hasCollision:!0,normal:{x:0,y:1},penetration:Math.abs(h)}:h+a.height>l.height?{hasCollision:!0,normal:{x:0,y:-1},penetration:h+a.height-l.height}:{hasCollision:!1}}resolveBoundaryCollision(a,l){const f=this.checkBoundaryCollision(a,l);if(!f.hasCollision||!f.normal||!f.penetration)return{player:a,fellOffScreen:!1};const h={...a},{normal:y,penetration:v}=f;if(y.x===1)h.x=0,h.velocityX=0;else if(y.x===-1)h.x=l.width-a.width,h.velocityX=0;else if(y.y===1)h.y=0,h.velocityY=0;else if(y.y===-1)return{player:h,fellOffScreen:!0};return{player:h,fellOffScreen:!1}}isColliding(a,l){return a.x<l.x+l.width&&a.x+a.width>l.x&&a.y<l.y+l.height&&a.y+a.height>l.y}}class cx{constructor(a,l){be(this,"animations");be(this,"currentAnimation");be(this,"currentFrameIndex",0);be(this,"frameTimer",0);this.animations=Object.fromEntries(a.map(f=>[f.name,f])),this.currentAnimation=this.animations[l]}setAnimation(a){this.currentAnimation.name!==a&&(this.currentAnimation=this.animations[a],this.currentFrameIndex=0,this.frameTimer=0)}setAnimationPreserveFrame(a){if(this.currentAnimation.name!==a){const l=this.animations[a];if(l){const f=Math.min(this.currentFrameIndex,l.frames.length-1);this.currentAnimation=l,this.currentFrameIndex=f}}}update(a){this.frameTimer+=a,this.frameTimer>this.currentAnimation.frameDuration&&(this.frameTimer=0,this.currentFrameIndex++,this.currentFrameIndex>=this.currentAnimation.frames.length&&(this.currentFrameIndex=this.currentAnimation.loop?0:this.currentAnimation.frames.length-1))}draw(a,l,f,h=1){const y=this.currentAnimation.frames[this.currentFrameIndex];if(y.complete){const v=H.PLAYER_WIDTH*2.5,C=H.PLAYER_HEIGHT*h,x=l-(v-H.PLAYER_WIDTH)/2.3;if(this.currentAnimation.name.includes("-left")){a.save(),a.scale(-1,1);const A=x+v/2.14;a.translate(-A*2,0),a.drawImage(y,x,f,v,C),a.restore()}else a.drawImage(y,x,f,v,C);a.save(),a.restore()}}}const cM=!1,Jy=(()=>{{try{const c=document.querySelectorAll('script[src*="sigurd-startup"]');if(c.length>0){const f=c[0].src,h=f.substring(0,f.lastIndexOf("/"));if(console.log("Found package via script src:",h),h.includes("/dist")){const y=h.substring(0,h.lastIndexOf("/dist"));return console.log("Extracted package root from Vite path:",y),y}return h}const a=window.location.href,l=window.location.pathname;if(a.includes("localhost")&&l.includes("/game")){const h=`${window.location.origin}/node_modules/sigurd-startup/dist`;return console.log("Constructed package path for Vite dev server:",h),h}if(l.includes("node_modules")){const f=l.indexOf("node_modules"),h=l.indexOf("sigurd-startup",f);if(h!==-1){const y=l.substring(0,h+14);return console.log("Found package via path analysis:",y),y+"/dist"}}}catch{console.warn("Could not determine package location, using fallback paths")}return console.log("Using fallback path: /node_modules/sigurd-startup/dist"),"/node_modules/sigurd-startup/dist"}})(),Il={audio:`${Jy}/audio`,images:`${Jy}/assets`},fx=c=>{const a=`${Il.images}/maps-bg-images/${c}.png`;return console.log(`Background image path: ${a}`),a},fM=()=>{console.log("🔧 Asset Path Debug Info:"),console.log(" isDev:",cM),console.log(" packageBaseUrl:",Jy),console.log(" ASSET_PATHS:",Il),console.log(" current location:",window.location.href),console.log(" current pathname:",window.location.pathname)},Ir=c=>{const a=new Image;return a.src=`${Il.images}/${c}`,a},dx=[Ir("sigurd-idle/sigurd-idle1.png"),Ir("sigurd-idle/sigurd-idle2.png"),Ir("sigurd-idle/sigurd-idle3.png"),Ir("sigurd-idle/sigurd-idle4.png")],px=[Ir("running/run1.png"),Ir("running/run2.png"),Ir("running/run3.png")],hx=[Ir("jumping/jump1.png"),Ir("jumping/jump2.png"),Ir("jumping/jump3.png")],dM=[Ir("complete/complete1.png"),Ir("complete/complete2.png"),Ir("complete/complete3.png"),Ir("complete/complete4.png"),Ir("complete/complete5.png")],pM=[Ir("float/float1.png")],vx=[Ir("float-dir/float-dir1.png")],mx=[Ir("landing/landing1.png")],hM=[{name:"walk-right",frames:px,frameDuration:100,loop:!0},{name:"walk-left",frames:px,frameDuration:100,loop:!0},{name:"idle-right",frames:dx,frameDuration:1e3,loop:!0},{name:"idle-left",frames:dx,frameDuration:1e3,loop:!0},{name:"jump-right",frames:hx,frameDuration:100,loop:!1},{name:"jump-left",frames:hx,frameDuration:100,loop:!1},{name:"land-right",frames:mx,frameDuration:500,loop:!1},{name:"land-left",frames:mx,frameDuration:500,loop:!1},{name:"float-stationary",frames:pM,frameDuration:100,loop:!0},{name:"float-right",frames:vx,frameDuration:100,loop:!1},{name:"float-left",frames:vx,frameDuration:100,loop:!0},{name:"ghost-complete",frames:dM,frameDuration:100,loop:!1}],Sp=new cx(hM,"idle-left"),e0=c=>{const a=new Image;return a.src=`${Il.images}/${c}`,a},vM=[e0("bomb/bomb1.png")],mM=[e0("bomb/bomb1.png"),e0("bomb/bomb2.png")],gM=[{name:"unlit",frames:vM,frameDuration:100,loop:!1},{name:"lit",frames:mM,frameDuration:100,loop:!0}];class gx extends cx{draw(a,l,f,h=1){const y=this.currentAnimation.frames[this.currentFrameIndex];if(y.complete){const v=H.BOMB_SIZE*h,C=H.BOMB_SIZE*h;a.drawImage(y,l,f,v,C)}}}const t0=new gx(gM,"unlit"),wp={"startup lab":"startup-lab.png",nav:"nav.png",skatteetaten:"skatteetaten.png","innovasjon norge":"innovasjon-norge.png",kommunehuset:"kommunehuset.png","alltinn norge":"alltinn-norge.png","silicone vally":"silicone-vally.png",default:"startup-lab.png"};class yx{constructor(a,l){be(this,"currentBackground",null);be(this,"isLoading",!1);be(this,"canvasWidth");be(this,"canvasHeight");be(this,"currentMapName","");this.canvasWidth=a,this.canvasHeight=l}loadMapBackground(a){this.isLoading||(this.currentMapName=a,this.isLoading=!0,this.currentBackground&&(this.currentBackground.image.src="",this.currentBackground=null),this.loadBackgroundAsync(a).catch(l=>{console.error("BackgroundManager: Failed to load background:",l),this.isLoading=!1}))}async loadBackgroundAsync(a){try{const l=wp[a]||wp.default,f=await this.loadImage(`${Il.images}/maps-bg-images/${l}`);this.currentBackground={image:f,isLoaded:!0},this.isLoading=!1,Ge.flow(`Background loaded: ${a}`)}catch(l){console.error("BackgroundManager: Failed to load background image:",l),this.isLoading=!1}}loadImage(a){return new Promise((l,f)=>{const h=new Image;h.onload=()=>l(h),h.onerror=()=>f(new Error(`Failed to load image: ${a}`)),h.src=a})}update(a,l){}render(a){if(!this.currentBackground||!this.currentBackground.isLoaded){this.isLoading?this.renderLoading(a):this.renderFallback(a);return}const l=this.currentBackground.image,f=this.canvasWidth/l.width,h=this.canvasHeight/l.height,y=Math.max(f,h),v=l.width*y,C=l.height*y,x=(v-this.canvasWidth)/2,R=(C-this.canvasHeight)/2;a.drawImage(l,-x,-R,v,C)}renderLoading(a){const l=a.createLinearGradient(0,0,0,this.canvasHeight);l.addColorStop(0,"#262521"),l.addColorStop(1,"#484744"),a.fillStyle=l,a.fillRect(0,0,this.canvasWidth,this.canvasHeight),a.fillStyle="#ffffff",a.font="16px Arial",a.textAlign="center",a.fillText("Loading background...",this.canvasWidth/2,this.canvasHeight/2)}renderFallback(a){const l=a.createLinearGradient(0,0,0,this.canvasHeight);l.addColorStop(0,"#87CEEB"),l.addColorStop(1,"#4682B4"),a.fillStyle=l,a.fillRect(0,0,this.canvasWidth,this.canvasHeight)}isReady(){return this.currentBackground?.isLoaded||!1}isCurrentlyLoading(){return this.isLoading}getCurrentTheme(){return this.currentMapName}getCurrentMapName(){return this.currentMapName}static getAvailableBackgrounds(){return Object.values(wp)}static getMapNameMapping(){return{...wp}}static async preloadAllBackgrounds(){Ge.flow("Starting background preloading...");const a=Object.values(wp);let l=0;const f=a.map(async h=>{try{const y=new Image;await new Promise((v,C)=>{y.onload=v,y.onerror=C,y.src=`${Il.images}/maps-bg-images/${h}`}),l++,(l%2===0||l===a.length)&&Ge.flow(`Preloaded ${l}/${a.length} backgrounds`)}catch{Ge.warn(`Failed to preload background: ${h}`)}});await Promise.all(f),Ge.flow(`Background preloading complete! Loaded ${l}/${a.length} backgrounds.`)}}const Wu=class Wu{constructor(){be(this,"deadMonsters",[]);be(this,"respawnConfig");be(this,"scalingManager");be(this,"lastUpdateTime",0);be(this,"updateInterval",500);be(this,"paused",!1);this.respawnConfig=this.getDefaultRespawnConfig(),this.scalingManager=ca.getInstance(),Ge.debug("Respawn manager initialized")}static getInstance(){return Wu.instance||(Wu.instance=new Wu),Wu.instance}getDefaultRespawnConfig(){return{ambusher:1e4,chaser:7e3,floater:15e3,patrol:8e3}}updateRespawnConfig(a){this.respawnConfig={...this.respawnConfig,...a},Ge.debug("OptimizedRespawnManager: Updated respawn configuration",this.respawnConfig)}getRespawnConfig(){return{...this.respawnConfig}}killMonster(a){if(a.isDead){Ge.debug(`Monster already dead, skipping kill: ${a.type}`);return}a.originalSpawnPoint||(a.originalSpawnPoint={x:a.x,y:a.y}),a.isDead=!0,a.isActive=!1,a.deathTime=Date.now(),a.respawnTime=a.deathTime+this.getRespawnDelay(a.type);const l={monster:a,respawnTime:a.respawnTime};this.insertSorted(l),Ge.monster(`${a.type} killed - respawning in ${this.getRespawnDelay(a.type)/1e3}s`)}insertSorted(a){let l=0,f=this.deadMonsters.length;for(;l<f;){const h=Math.floor((l+f)/2);this.deadMonsters[h].respawnTime<=a.respawnTime?l=h+1:f=h}this.deadMonsters.splice(l,0,a)}update(){const a=Date.now();if(a-this.lastUpdateTime<this.updateInterval)return[];if(this.lastUpdateTime=a,this.paused)return[];const l=[];for(;this.deadMonsters.length>0&&this.deadMonsters[0].respawnTime<=a;){const f=this.deadMonsters.shift(),h=this.respawnMonster(f.monster);l.push(h)}return l.length>0&&Ge.monster(`Respawning ${l.length} monsters: ${l.map(f=>f.type).join(", ")}`),l}pause(){this.paused=!0,Ge.pause("Respawn system paused")}resume(){this.paused=!1,Ge.pause("Respawn system resumed")}isPaused(){return this.paused}respawnMonster(a){const l=a.originalSpawnPoint;return this.resetMonsterState(a,l),this.scalingManager.resetMonsterScaling(a),Ge.monster(`${a.type} respawned`),a}resetMonsterState(a,l){a.isDead=!1,a.isActive=!0,a.x=l.x,a.y=l.y,a.isFrozen=!1,a.isBlinking=!1,a.velocityX=0,a.velocityY=0,a.isGrounded=!1,a.isFalling=!1,a.currentPlatform=null,a.behaviorState=void 0,a.lastDirectionChange=void 0,a.deathTime=void 0,a.respawnTime=void 0}getRespawnDelay(a){switch(a){case"AMBUSHER":return this.respawnConfig.ambusher;case"CHASER":return this.respawnConfig.chaser;case"FLOATER":return this.respawnConfig.floater;case"HORIZONTAL_PATROL":case"VERTICAL_PATROL":return this.respawnConfig.patrol;default:return Ge.warn(`Unknown monster type for respawn delay: ${a}, using default`),this.respawnConfig.patrol}}getDeadMonsterCount(){return this.deadMonsters.length}getDeadMonsters(){return this.deadMonsters.map(a=>a.monster)}getRespawnTimeRemaining(a){return!a.isDead||!a.respawnTime?0:Math.max(0,a.respawnTime-Date.now())}getNextRespawnTime(){return this.deadMonsters.length>0?this.deadMonsters[0].respawnTime:null}reset(){this.deadMonsters=[],this.lastUpdateTime=0,Ge.debug("OptimizedRespawnManager: Reset - cleared all dead monsters")}setUpdateInterval(a){this.updateInterval=a,Ge.debug(`OptimizedRespawnManager: Update interval set to ${a}ms`)}cleanup(){this.deadMonsters=[],this.lastUpdateTime=0}};be(Wu,"instance");let zv=Wu;class yM{constructor(a){be(this,"canvas");be(this,"ctx");be(this,"lastTime",0);be(this,"backgroundManager");be(this,"bombSprites",new Map);be(this,"currentSpawnManager",null);be(this,"currentGameState",null);this.canvas=a,this.ctx=a.getContext("2d"),this.backgroundManager=new yx(a.width,a.height),Pe.debug("RenderManager initialized with canvas")}render(a,l,f,h,y,v=[],C=[],x,R,A,k){this.currentSpawnManager=R,this.currentGameState=k;const _=Date.now(),N=_-this.lastTime;this.lastTime=_,this.backgroundManager.update(a.x,a.y),this.renderBackground(),y&&this.renderGround(y),this.renderPlatforms(l),this.renderBombs(f),this.renderCoins(v,x),this.renderMonsters(h),this.renderPlayer(a),this.renderFloatingTexts(C,N)}clearCanvas(){this.ctx.fillStyle=rr.BACKGROUND,this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}renderBackground(){this.backgroundManager.render(this.ctx)}renderGround(a){this.ctx.fillStyle=a.color,this.ctx.fillRect(a.x,a.y,a.width,a.height)}renderPlayer(a){if(Sp&&H.USE_SPRITES){const l=a.height/H.PLAYER_HEIGHT;Sp.draw(this.ctx,a.x,a.y,l)}else this.ctx.fillStyle=a.color,this.ctx.fillRect(a.x,a.y,a.width,a.height)}renderPlatforms(a){a.forEach(l=>{this.ctx.fillStyle=l.color,this.ctx.strokeStyle=l.borderColor;const f=4,h=l.x,y=l.y,v=l.width,C=l.height;this.ctx.beginPath(),this.ctx.moveTo(h+f,y),this.ctx.lineTo(h+v-f,y),this.ctx.quadraticCurveTo(h+v,y,h+v,y+f),this.ctx.lineTo(h+v,y+C-f),this.ctx.quadraticCurveTo(h+v,y+C,h+v-f,y+C),this.ctx.lineTo(h+f,y+C),this.ctx.quadraticCurveTo(h,y+C,h,y+C-f),this.ctx.lineTo(h,y+f),this.ctx.quadraticCurveTo(h,y,h+f,y),this.ctx.closePath(),this.ctx.lineWidth=3,this.ctx.stroke(),this.ctx.fill()})}renderBombs(a){a.forEach(l=>{if(!l.isCollected)if(t0&&H.USE_SPRITES){let f=this.bombSprites.get(l.order);if(!f){const v=[{name:"unlit",frames:t0.animations.unlit.frames,frameDuration:50,loop:!1},{name:"lit",frames:t0.animations.lit.frames,frameDuration:100,loop:!0}];f=new gx(v,"unlit"),this.bombSprites.set(l.order,f)}const h=l.isBlinking?"lit":"unlit";f.setAnimation(h),f.update(16);const y=l.width/H.BOMB_SIZE;f.draw(this.ctx,l.x,l.y,y)}else this.ctx.fillStyle=l.isBlinking?rr.BOMB_NEXT:rr.BOMB,this.ctx.fillRect(l.x,l.y,l.width,l.height),this.ctx.fillStyle="#000000",this.ctx.font="12px Arial",this.ctx.textAlign="center",this.ctx.fillText(l.order.toString(),l.x+l.width/2,l.y+l.height/2+4)})}renderCoins(a,l){a.forEach(f=>{if(f.isCollected)return;let y=Fs[f.type]?.color||"#FFD700";f.type==="POWER"&&l&&(y=l.getPcoinCurrentColor(f)),this.ctx.fillStyle=y,this.ctx.beginPath(),this.ctx.arc(f.x+f.width/2,f.y+f.height/2,f.width/2,0,2*Math.PI),this.ctx.fill(),this.ctx.fillStyle="#fff",this.ctx.font="14px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle";let v="C";f.type==="POWER"?(v="P",this.ctx.fillStyle="#000"):f.type==="BONUS_MULTIPLIER"?(v="B",this.ctx.fillStyle="#fff"):f.type==="EXTRA_LIFE"&&(v="M",this.ctx.fillStyle="#fff"),this.ctx.fillText(v,f.x+f.width/2,f.y+f.height/2+2)})}renderMonsters(a){a.forEach((l,f)=>{if(!l.isActive){Pe.debug(`Monster ${f} is not active, skipping`);return}let h=l.color;if(l.isBlinking){const y=Date.now();Math.floor(y/300)%2===0?h=rr.MONSTER_FROZEN:h=l.color}else l.isFrozen&&(h=rr.MONSTER_FROZEN);this.ctx.fillStyle=h,this.ctx.fillRect(l.x,l.y,l.width,l.height),this.ctx.fillStyle="#000",this.ctx.fillRect(l.x+2,l.y+2,2,2),this.ctx.fillRect(l.x+l.width-4,l.y+2,2,2)}),this.renderRespawnIndicators(a),this.renderSpawnIndicators(this.currentSpawnManager)}renderRespawnIndicators(a){const l=zv.getInstance();a.forEach(f=>{if(f.isDead&&f.originalSpawnPoint){const h=l.getRespawnTimeRemaining(f),y=Math.ceil(h/1e3);if(h>0&&y<=3){const v=f.originalSpawnPoint,C=Math.sin(Date.now()/200)*.3+.7,x=f.color||"#ffffff";this.ctx.fillStyle=`${x}${Math.floor(C*1*255).toString(16).padStart(2,"0")}`,this.ctx.fillRect(v.x,v.y,f.width,f.height);const R=`${y}`,A=v.x+f.width/2,k=v.y+f.height/2+4;this.ctx.fillStyle="#ffffff",this.ctx.font="16px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText(R,A,k)}}})}renderSpawnIndicators(a){if(a&&!(!this.currentGameState||this.currentGameState.currentState!=="PLAYING"))try{a.getPendingSpawns().forEach(f=>{const h=a.getSpawnTimeRemaining(f),y=Math.ceil(h/1e3);if(h>0&&y<=3){const v=f.spawnPoint.createMonster(),C=Math.sin(Date.now()/200)*.3+.7,x=v.color||"#ffffff";this.ctx.fillStyle=`${x}${Math.floor(C*1*255).toString(16).padStart(2,"0")}`,this.ctx.fillRect(v.x,v.y,v.width,v.height);const R=`${y}`,A=v.x+v.width/2,k=v.y+v.height/2;this.ctx.fillStyle="#ffffff",this.ctx.font="16px Arial",this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText(R,A,k)}})}catch{}}renderFloatingTexts(a,l){a.forEach(f=>{const h=Date.now()-f.startTime,y=Math.min(h/f.duration,1),C=f.y-50*y,x=1-y;this.ctx.globalAlpha=x,this.ctx.fillStyle=f.color,this.ctx.font=`${f.fontSize}px Arial`,this.ctx.textAlign="center",this.ctx.textBaseline="middle",this.ctx.fillText(f.text,f.x,C),this.ctx.globalAlpha=1})}loadCityTheme(a){this.backgroundManager.loadMapBackground(a)}loadMapBackground(a){this.backgroundManager.loadMapBackground(a)}isParallaxReady(){return this.backgroundManager.isReady()}isParallaxLoading(){return this.backgroundManager.isCurrentlyLoading()}getCurrentMapName(){return this.backgroundManager.getCurrentMapName()}clearBombSprites(){this.bombSprites.clear()}}const Sx=c=>c.type==="HORIZONTAL_PATROL"||c.type==="VERTICAL_PATROL",SM=c=>c.type==="CHASER",wM=c=>c.type==="AMBUSHER";class hi{static checkMonsterPlatformCollision(a,l){return a.x<l.x+l.width&&a.x+a.width>l.x&&a.y<l.y+l.height&&a.y+a.height>l.y}static isMonsterOnPlatform(a,l){return a.x<l.x+l.width&&a.x+a.width>l.x&&Math.abs(a.y+a.height-l.y)<=2}static findCurrentPlatform(a,l){for(const f of l)if(this.isMonsterOnPlatform(a,f))return f;return null}static isMonsterOnGround(a,l){return Math.abs(a.y+a.height-l.y)<=2}static applyGravity(a){a.velocityY||(a.velocityY=0),a.gravity||(a.gravity=H.GRAVITY),a.velocityY+=a.gravity,a.y+=a.velocityY}static isAtPlatformEdge(a,l,f){return f>0?a.x+a.width>=l.x+l.width-5:a.x<=l.x+5}static hasFallenOffPlatform(a,l){return a.x+a.width<l.x||a.x>l.x+l.width}static determineSpawnSide(a,l){const f=l.x+l.width/2;return a.x<f?"left":"right"}static shouldFall(a,l,f,h,y){return h>=y&&Math.abs(a.x-f)<=10}static isOutsideBoundaries(a,l,f){return l<=0||l+a.width>=H.CANVAS_WIDTH||f<=0||f+a.height>=H.CANVAS_HEIGHT}static clampToBoundaries(a){a.x=Math.max(0,Math.min(a.x,H.CANVAS_WIDTH-a.width)),a.y=Math.max(0,Math.min(a.y,H.CANVAS_HEIGHT-a.height))}static isMovementSafe(a,l,f,h){if(this.isOutsideBoundaries(a,l,f))return!1;for(const y of h)if(this.checkMonsterPlatformCollision({...a,x:l,y:f},y))return!1;return!0}static isMovementSafeWithGround(a,l,f,h,y){if(this.isOutsideBoundaries(a,l,f))return!1;for(const v of h)if(this.checkMonsterPlatformCollision({...a,x:l,y:f},v))return!1;return!(y&&this.checkMonsterPlatformCollision({...a,x:l,y:f},y))}}class bM{update(a,l,f,h){if(f&&f.currentState!=="PLAYING")return;a.type==="HORIZONTAL_PATROL"?this.updateHorizontalPatrol(a,l,h):this.updateVerticalPatrol(a,l,h)}updateHorizontalPatrol(a,l,f){if(!Sx(a))return;const h=ca.getInstance(),y=h.getMonsterScaledValues(a);h.getBaseValues();const v=h.getMonsterAge(a),C=y.patrol.speed;v<2&&Ge.debug(`Patrol scaling - Age: ${v.toFixed(1)}s, Speed: ${C.toFixed(2)}`);const x=f?C*(f/16.67):C,R=a.x+x*a.direction;R<a.patrolStartX||R+a.width>a.patrolEndX?(a.direction*=-1,a.lastDirectionChange=l):a.x=R;const A=Ft.getState(),k=A.platforms||[],_=hi.findCurrentPlatform(a,k);_?(a.y=_.y-a.height,a.velocityY=0,a.isGrounded=!0):this.handleGroundCollision(a,A.ground)}updateVerticalPatrol(a,l,f){if(!Sx(a))return;const h=ca.getInstance(),y=h.getMonsterScaledValues(a);h.getBaseValues(),h.getMonsterAge(a);const v=y.patrol.speed;if(!a.originalSpawnX){const A=Ft.getState().platforms||[],k=a.patrolSide||"left",_=a.targetPlatformX,N=A.find(z=>z.isVertical&&Math.abs(z.x-_)<1);N&&(a.originalSpawnX=k==="left"?N.x-a.width-8:N.x+8+N.width,a.x=a.originalSpawnX)}const C=f?v*(f/16.67):v,x=a.y+C*a.direction;x<a.patrolStartY||x+a.height>a.patrolEndY?(a.direction*=-1,a.lastDirectionChange=l):a.y=x,a.originalSpawnX!==void 0?(a.x=a.originalSpawnX,a.velocityX=0,a.velocityY=0,a.isGrounded=!1):(a.velocityX=0,a.velocityY=0,a.isGrounded=!1)}handleGroundCollision(a,l){if(!l)return;a.x<l.x+l.width&&a.x+a.width>l.x&&a.y<l.y+l.height&&a.y+a.height>l.y&&(a.y=l.y-a.height,a.velocityY=0,a.isGrounded=!0)}}class xM{update(a,l,f,h){if(!SM(a)||f.currentState!=="PLAYING")return;const y=f.player;if(!y)return;const v=ca.getInstance(),C=v.getMonsterScaledValues(a);v.getBaseValues();const x=v.getMonsterAge(a);if(x<2&&Ge.debug(`Chaser scaling - Age: ${x.toFixed(1)}s, Speed: ${C.chaser.speed.toFixed(2)}`),!a.behaviorState){a.behaviorState="chasing",a.lastDirectionChange=l,a.chaseTargetX=y.x,a.chaseTargetY=y.y,a.updateIntervalMultiplier=.8+Math.random()*.4,a.directnessMultiplier=.85+Math.random()*.3,a.speedMultiplier=.9+Math.random()*.2;const ue=(Math.random()-.5)*50,ce=(Math.random()-.5)*50;a.chaseTargetX=y.x+ue,a.chaseTargetY=y.y+ce,a.lastDirectionChange=l+Math.random()*C.chaser.updateInterval}const R=f.platforms||[],A=C.chaser.directness*(a.directnessMultiplier||1),k=C.chaser.updateInterval*(a.updateIntervalMultiplier||1);if(l-(a.lastDirectionChange||l)>k){const ue=a.chaseTargetX||a.x,ce=a.chaseTargetY||a.y,fe=Math.random()<.3,le=fe?(Math.random()-.5)*15:0,Re=fe?(Math.random()-.5)*15:0;a.chaseTargetX=ue+(y.x+le-ue)*A,a.chaseTargetY=ce+(y.y+Re-ce)*A,a.lastDirectionChange=l}const N=a.chaseTargetX||a.x,z=a.chaseTargetY||a.y,G=N-a.x,J=z-a.y,de=Math.sqrt(G*G+J*J);if(de>20){const ue=C.chaser.speed*(a.speedMultiplier||1),ce=h?ue*(h/16.67):ue,fe=Math.sign(G)*ce,le=Math.sign(J)*ce;this.applyMovement(a,fe,le,N,z,R,f.ground)}else if(de>5){const ue=C.chaser.speed*(a.speedMultiplier||1)*.5,ce=h?ue*(h/16.67):ue,fe=Math.sign(G)*ce,le=Math.sign(J)*ce;this.applyMovement(a,fe,le,N,z,R,f.ground)}}applyMovement(a,l,f,h,y,v,C){const x=a.x+l,R=a.y+f,A=hi.isMovementSafe(a,x,a.y,v),k=hi.isMovementSafe(a,a.x,R,v);A&&(a.x=x),k&&(a.y=R),this.handleGroundCollision(a,C),!A&&!k&&this.findAlternativePath(a,h,y,v)}findAlternativePath(a,l,f,h){const y=l-a.x,v=f-a.y,C=Math.random();if((Math.abs(y)>Math.abs(v)?C>.7?"vertical":"horizontal":C>.7?"horizontal":"vertical")==="horizontal"){const R=Math.random()>.5?[1,-1]:[-1,1];for(const N of R){const z=a.y+N*a.speed;let G=!0;for(const J of h)if(hi.checkMonsterPlatformCollision({...a,y:z},J)){G=!1;break}if(G){a.y=z;return}}const A=Math.sign(y)*-1,k=a.x+A*a.speed;let _=!0;for(const N of h)if(hi.checkMonsterPlatformCollision({...a,x:k},N)){_=!1;break}if(_){a.x=k;return}}else{const R=Math.random()>.5?[1,-1]:[-1,1];for(const N of R){const z=a.x+N*a.speed;let G=!0;for(const J of h)if(hi.checkMonsterPlatformCollision({...a,x:z},J)){G=!1;break}if(G){a.x=z;return}}const A=Math.sign(v)*-1,k=a.y+A*a.speed;let _=!0;for(const N of h)if(hi.checkMonsterPlatformCollision({...a,y:k},N)){_=!1;break}if(_){a.y=k;return}}this.tryRandomMovement(a,h)}handleGroundCollision(a,l){if(!l)return;a.x<l.x+l.width&&a.x+a.width>l.x&&a.y<l.y+l.height&&a.y+a.height>l.y&&(a.y=l.y-a.height,a.velocityY=0,a.isGrounded=!0)}tryRandomMovement(a,l){const f=[{x:1,y:0},{x:-1,y:0},{x:0,y:1},{x:0,y:-1},{x:1,y:1},{x:-1,y:1},{x:1,y:-1},{x:-1,y:-1}];for(let h=f.length-1;h>0;h--){const y=Math.floor(Math.random()*(h+1));[f[h],f[y]]=[f[y],f[h]]}for(const h of f){const y=a.x+h.x*a.speed,v=a.y+h.y*a.speed;let C=!0;for(const x of l)if(hi.checkMonsterPlatformCollision({...a,x:y,y:v},x)){C=!1;break}if(C){a.x=y,a.y=v;return}}}}class CM{update(a,l,f,h){if(!wM(a)||f.currentState!=="PLAYING")return;const y=f.player;if(!y)return;const v=ca.getInstance(),C=v.getMonsterScaledValues(a);v.getBaseValues();const x=v.getMonsterAge(a);x<2&&Ge.debug(`Ambusher scaling - Age: ${x.toFixed(1)}s, Speed: ${C.ambusher.speed.toFixed(2)}`),a.behaviorState||(a.behaviorState="wandering",a.lastDirectionChange=l,a.ambushCooldown=2e3);const R=f.platforms||[];if(a.behaviorState==="wandering"){(!a.targetX||!a.targetY)&&this.chooseNewWanderingDirection(a,l),l-(a.lastDirectionChange||l)>2e3+Math.random()*2e3&&this.chooseNewWanderingDirection(a,l);const k=C.ambusher.speed*.5,_=h?k*(h/16.67):k,N=a.targetX||a.x,z=a.targetY||a.y,G=N-a.x,J=z-a.y,de=Math.sqrt(G*G+J*J);if(de>5){const ue=G/de,ce=J/de,fe=a.x+_*ue,le=a.y+_*ce;hi.isMovementSafeWithGround(a,fe,le,R,f.ground)?(a.x=fe,a.y=le):this.chooseNewWanderingDirection(a,l)}else this.chooseNewWanderingDirection(a,l);a.ambushCooldown+=h||16,a.ambushCooldown>=C.ambusher.ambushInterval&&(a.behaviorState="ambushing",a.lastDirectionChange=l,a.ambushCooldown=0,a.ambushTargetX=y.x,a.ambushTargetY=y.y,Ge.debug(`Ambusher switching to ambush mode, targeting player at (${a.ambushTargetX}, ${a.ambushTargetY})`))}else if(a.behaviorState==="ambushing"){const A=C.ambusher.speed*3,k=h?A*(h/16.67):A,_=a.ambushTargetX||a.x,N=a.ambushTargetY||a.y,z=Math.sqrt((_-a.x)**2+(N-a.y)**2);if(z>5){const G=_-a.x,J=N-a.y,de=G/z,ue=J/z,ce=a.x+k*de,fe=a.y+k*ue;hi.isMovementSafeWithGround(a,ce,fe,R,f.ground)?(a.x=ce,a.y=fe):(a.behaviorState="wandering",a.lastDirectionChange=l,Ge.debug("Ambusher blocked, returning to wandering"))}else a.behaviorState="wandering",a.lastDirectionChange=l,Ge.debug("Ambusher reached target, returning to wandering")}}chooseNewWanderingDirection(a,l){const f=[{x:1,y:0},{x:-1,y:0},{x:0,y:1},{x:0,y:-1},{x:1,y:1},{x:-1,y:1},{x:1,y:-1},{x:-1,y:-1}],h=f[Math.floor(Math.random()*f.length)],y=50+Math.random()*100,v=Math.max(0,Math.min(a.x+h.x*y,H.CANVAS_WIDTH-a.width)),C=Math.max(0,Math.min(a.y+h.y*y,H.CANVAS_HEIGHT-a.height));a.targetX=v,a.targetY=C,a.lastDirectionChange=l}}class EM{update(a,l,f,h){if(f&&f.currentState!=="PLAYING")return;const y=ca.getInstance(),v=y.getMonsterScaledValues(a);y.getBaseValues();const C=y.getMonsterAge(a);C<2&&Ge.debug(`Floater scaling - Age: ${C.toFixed(1)}s, Speed: ${v.floater.speed.toFixed(2)}`),!a.velocityX&&!a.velocityY&&this.initializeVelocity(a,v.floater.speed);const x=Math.sqrt(a.velocityX*a.velocityX+a.velocityY*a.velocityY);if(x>0){const J=v.floater.speed/x;a.velocityX*=J,a.velocityY*=J}const R=h?h/16.67:1,A=a.x+a.velocityX*R,k=a.y+a.velocityY*R,_=Ft.getState(),N=_.platforms||[];let z=!0,G={x:0,y:0};for(const J of N)if(hi.checkMonsterPlatformCollision({...a,x:A,y:k},J)){z=!1,G=this.calculateCollisionNormal(a,J);break}(A<=0||A+a.width>=H.CANVAS_WIDTH||k<=0||k+a.height>=H.CANVAS_HEIGHT)&&(z=!1,G=this.calculateBoundaryCollisionNormal(a,A,k)),_.ground&&hi.checkMonsterPlatformCollision({...a,x:A,y:k},_.ground)&&(z=!1,G=this.calculateCollisionNormal(a,_.ground)),z?(a.x=A,a.y=k):this.bounceOffCollision(a,G,v.floater.bounceAngle)}initializeVelocity(a,l){if(a.type!=="FLOATER")return;const h=(a.startAngle||45)*Math.PI/180;a.velocityX=Math.cos(h)*l,a.velocityY=Math.sin(h)*l}calculateCollisionNormal(a,l){const f=a.x+a.width/2,h=a.y+a.height/2,y=Math.max(l.x,Math.min(f,l.x+l.width)),v=Math.max(l.y,Math.min(h,l.y+l.height)),C=f-y,x=h-v,R=Math.sqrt(C*C+x*x);if(R>.1)return{x:C/R,y:x/R};{const A=Math.abs(a.x+a.width-l.x),k=Math.abs(a.x-(l.x+l.width)),_=Math.abs(a.y+a.height-l.y),N=Math.abs(a.y-(l.y+l.height)),z=Math.min(A,k,_,N);return z===A?{x:-1,y:0}:z===k?{x:1,y:0}:z===_?{x:0,y:-1}:{x:0,y:1}}}calculateBoundaryCollisionNormal(a,l,f){return l<=0?{x:1,y:0}:l+a.width>=H.CANVAS_WIDTH?{x:-1,y:0}:f<=0?{x:0,y:1}:{x:0,y:-1}}bounceOffCollision(a,l,f){const h=a.velocityX*l.x+a.velocityY*l.y;a.velocityX=a.velocityX-2*h*l.x,a.velocityY=a.velocityY-2*h*l.y;const y=(Math.random()-.5)*f,v=Math.sqrt(a.velocityX*a.velocityX+a.velocityY*a.velocityY),x=Math.atan2(a.velocityY,a.velocityX)+y;a.velocityX=Math.cos(x)*v,a.velocityY=Math.sin(x)*v}}class TM{constructor(){be(this,"patrolMovement");be(this,"chaserMovement");be(this,"ambusherMovement");be(this,"floaterMovement");this.patrolMovement=new bM,this.chaserMovement=new xM,this.ambusherMovement=new CM,this.floaterMovement=new EM}updateMonsterBehaviors(a,l,f){l.monsters&&l.monsters.forEach(h=>{if(!(!h.isActive||h.isFrozen)){switch(h.type){case kn.HORIZONTAL_PATROL:case kn.VERTICAL_PATROL:this.patrolMovement.update(h,a,l,f);break;case kn.CHASER:this.chaserMovement.update(h,a,l,f);break;case kn.AMBUSHER:this.ambusherMovement.update(h,a,l,f);break;case kn.FLOATER:this.floaterMovement.update(h,a,l,f);break}hi.clampToBoundaries(h)}})}}class RM{constructor(){be(this,"levelStartTime",0);be(this,"scheduledSpawns",[]);be(this,"behaviorManager");be(this,"pauseState");be(this,"lastUpdateTime",0);be(this,"updateInterval",16);this.behaviorManager=new TM,this.pauseState=this.createPauseState()}initializeLevel(a){this.levelStartTime=Date.now(),this.scheduledSpawns=this.createScheduledSpawns(a),this.resetPauseState(),Ge.flow(`Level initialized with ${a.length} spawn points`),this.scheduledSpawns.forEach((l,f)=>{const h=(l.scheduledTime-this.levelStartTime)/1e3;try{const y=l.spawnPoint.createMonster();Ge.debug(`Scheduled spawn ${f}: ${y.type} at ${h.toFixed(1)}s`)}catch(y){Ge.error(`Failed to create monster for spawn ${f}: ${y}`)}})}createScheduledSpawns(a){return a.map((l,f)=>({id:`spawn-${f}`,spawnPoint:l,scheduledTime:this.levelStartTime+l.spawnDelay,executed:!1}))}resetPauseState(){this.pauseState=this.createPauseState()}createPauseState(){return{isPaused:!1,pauseStartTime:0,totalPausedTime:0,pauseReasons:new Set}}update(a,l){if(this.pauseState.isPaused)return;const f=Ft.getState(),h=this.getAdjustedTime();Math.floor(h/5e3)!==Math.floor((h-16)/5e3)&&Ge.debug(`SpawnManager.update() called at ${(h/1e3).toFixed(1)}s, paused: ${this.pauseState.isPaused}, spawns: ${this.scheduledSpawns.length}`),this.processSpawns(a,f),f.monsters.some(y=>y.isActive)&&this.behaviorManager.updateMonsterBehaviors(a,f,l)}processSpawns(a,l){const f=this.getAdjustedTime(),h=this.getAdjustedAbsoluteTime(),y=[];if(Math.floor(f/5e3)!==Math.floor((f-16)/5e3)){const v=this.scheduledSpawns.filter(C=>!C.executed);Ge.info(`Spawn check at ${(f/1e3).toFixed(1)}s: ${v.length} pending spawns`),v.forEach(C=>{const x=(C.scheduledTime-h)/1e3;try{const R=C.spawnPoint.createMonster();Ge.info(` - ${R.type} in ${x.toFixed(1)}s (scheduled: ${C.scheduledTime}, current: ${h})`)}catch(R){Ge.error(` - Failed to create monster: ${R}`)}})}for(const v of this.scheduledSpawns)!v.executed&&h>=v.scheduledTime&&(y.push(v),Ge.info(`Spawn ready to execute: ${v.spawnPoint.createMonster().type} (scheduled at ${(v.scheduledTime/1e3).toFixed(1)}s, current time ${(f/1e3).toFixed(1)}s)`));y.length>0&&(Ge.info(`Executing ${y.length} spawns at ${(f/1e3).toFixed(1)}s`),this.executeSpawns(y,a,l))}executeSpawns(a,l,f){const h=[];for(const y of a)try{const v=this.createMonster(y.spawnPoint);h.push(v),y.executed=!0,Ge.monster(`Spawned ${v.type} at (${v.x}, ${v.y})`)}catch(v){Ge.error(`Failed to spawn monster: ${v}`)}h.length>0&&(this.addMonstersToGameState(h,f),Ge.debug(`Added ${h.length} monsters to game state`))}createMonster(a){const l=a.createMonster();return a.color&&(l.color=a.color),l.originalSpawnPoint||(l.originalSpawnPoint={x:l.x,y:l.y}),l}addMonstersToGameState(a,l){if(l.updateMonsters){const h=[...l.monsters||[],...a];l.updateMonsters(h)}else Ge.warn("Game state updateMonsters method is not available")}pause(a="default"){this.pauseState.isPaused||(this.pauseState.isPaused=!0,this.pauseState.pauseStartTime=Date.now()),this.pauseState.pauseReasons.add(a),Ge.pause(`Spawning paused (${a})`),Ge.debug(`SpawnManager pause state: ${this.pauseState.isPaused}, reasons: ${Array.from(this.pauseState.pauseReasons).join(", ")}`)}resume(a="default"){if(this.pauseState.pauseReasons.delete(a),this.pauseState.pauseReasons.size===0&&this.pauseState.isPaused){const l=Date.now()-this.pauseState.pauseStartTime;this.pauseState.totalPausedTime+=l,this.pauseState.isPaused=!1,Ge.pause(`Spawning resumed (paused for ${(l/1e3).toFixed(1)}s)`)}Ge.debug(`SpawnManager pause state: ${this.pauseState.isPaused}, reasons: ${Array.from(this.pauseState.pauseReasons).join(", ")}`)}isPaused(){return this.pauseState.isPaused}getPauseStatus(){return{isPaused:this.pauseState.isPaused,pauseReasons:Array.from(this.pauseState.pauseReasons),totalPausedTime:this.pauseState.totalPausedTime}}getAdjustedTime(){return Date.now()-this.levelStartTime-this.pauseState.totalPausedTime}getAdjustedAbsoluteTime(){return this.levelStartTime+this.getAdjustedTime()}removeMonster(a){a.isActive=!1;const l=Ft.getState();if(l.updateMonsters){const h=(l.monsters||[]).filter(y=>y!==a);l.updateMonsters(h)}}reset(){this.levelStartTime=Date.now(),this.scheduledSpawns.forEach(a=>a.executed=!1),this.resetPauseState(),this.lastUpdateTime=0}getSpawnStatus(){const a=this.scheduledSpawns.filter(h=>h.executed).length,l=this.scheduledSpawns.filter(h=>!h.executed).length,f=this.getAdjustedTime();return{totalSpawnPoints:this.scheduledSpawns.length,executedCount:a,pendingCount:l,isPaused:this.pauseState.isPaused,pauseReasons:Array.from(this.pauseState.pauseReasons),adjustedTime:f/1e3,levelStartTime:this.levelStartTime,totalPausedTime:this.pauseState.totalPausedTime}}getSpawnTimeRemaining(a){if(a.executed)return 0;const l=this.getAdjustedAbsoluteTime();return Math.max(0,a.scheduledTime-l)}getPendingSpawns(){return this.scheduledSpawns.filter(a=>!a.executed)}setUpdateInterval(a){this.updateInterval=a,Ge.debug(`OptimizedSpawnManager: Update interval set to ${a}ms`)}cleanup(){this.scheduledSpawns=[],this.resetPauseState(),this.lastUpdateTime=0}}class MM{constructor(){be(this,"audioContext",null);be(this,"backgroundMusicGain",null);be(this,"isBackgroundMusicPlaying",!1);be(this,"backgroundMusicBuffer",null);be(this,"backgroundMusicSource",null);this.initializeAudioContext(),this.loadBackgroundMusic()}initializeAudioContext(){try{this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.backgroundMusicGain=this.audioContext.createGain(),this.backgroundMusicGain.connect(this.audioContext.destination),this.updateAudioVolumes()}catch(a){Pe.warn("Web Audio API not supported:",a)}}async loadBackgroundMusic(){if(this.audioContext)try{const l=await(await fetch(`${Il.audio}/background-music.wav`)).arrayBuffer();this.backgroundMusicBuffer=await this.audioContext.decodeAudioData(l)}catch(a){Pe.warn("Failed to load background music:",a)}}ensureAudioContext(){this.audioContext?.state==="suspended"&&this.audioContext.resume()}playSound(a,l){switch(this.ensureAudioContext(),a){case ua.BOMB_COLLECT:this.playBombCollectSound();break;case ua.MONSTER_HIT:this.playMonsterHitSound();break;case ua.MAP_CLEARED:this.playMapClearedSound();break;case ua.BONUS_SCREEN:Pe.audio("Bonus sound"),this.playBonusSound();break;case ua.COIN_COLLECT:this.playCoinCollectSound();break;case ua.POWER_COIN_ACTIVATE:this.playPowerCoinActivateSound();break;case ua.BACKGROUND_MUSIC:l===ot.PLAYING&&this.startBackgroundMusic();break;default:Pe.debug(`Audio event ${a} not implemented yet`)}}stopBackgroundMusic(){if(this.isBackgroundMusicPlaying=!1,this.backgroundMusicSource){try{this.backgroundMusicSource.stop()}catch{}this.backgroundMusicSource=null}}playBombCollectSound(){if(!this.audioContext)return;const a=this.audioContext.createOscillator(),l=this.audioContext.createGain();a.connect(l),l.connect(this.audioContext.destination),a.type="square",a.frequency.setValueAtTime(800,this.audioContext.currentTime),a.frequency.exponentialRampToValueAtTime(1200,this.audioContext.currentTime+.1);const f=this.getSFXVolume();l.gain.setValueAtTime(.3*f,this.audioContext.currentTime),l.gain.exponentialRampToValueAtTime(.01,this.audioContext.currentTime+.2),a.start(),a.stop(this.audioContext.currentTime+.2)}playMonsterHitSound(){if(!this.audioContext)return;const a=this.audioContext.createOscillator(),l=this.audioContext.createGain();a.connect(l),l.connect(this.audioContext.destination),a.type="sawtooth",a.frequency.setValueAtTime(200,this.audioContext.currentTime),a.frequency.exponentialRampToValueAtTime(50,this.audioContext.currentTime+.3);const f=this.getSFXVolume();l.gain.setValueAtTime(.4*f,this.audioContext.currentTime),l.gain.exponentialRampToValueAtTime(.01,this.audioContext.currentTime+.3),a.start(),a.stop(this.audioContext.currentTime+.3)}playMapClearedSound(){if(!this.audioContext)return;const a=[523.25,587.33,659.25,698.46,783.99];let l=this.audioContext.currentTime;const f=this.getSFXVolume();a.forEach((h,y)=>{const v=this.audioContext.createOscillator(),C=this.audioContext.createGain();v.connect(C),C.connect(this.audioContext.destination),v.type="triangle",v.frequency.setValueAtTime(h,l),C.gain.setValueAtTime(.3*f,l),C.gain.exponentialRampToValueAtTime(.01,l+.3),v.start(l),v.stop(l+.3),l+=.15})}playBonusSound(){if(!this.audioContext)return;const a=[659.25,783.99,1046.5,783.99,1046.5];let l=this.audioContext.currentTime;const f=this.getSFXVolume();a.forEach((h,y)=>{const v=this.audioContext.createOscillator(),C=this.audioContext.createGain();v.connect(C),C.connect(this.audioContext.destination),v.type="sine",v.frequency.setValueAtTime(h,l),C.gain.setValueAtTime(.2*f,l),C.gain.exponentialRampToValueAtTime(.01,l+.4),v.start(l),v.stop(l+.4),l+=.2})}playCoinCollectSound(){if(!this.audioContext)return;const a=this.audioContext.createOscillator(),l=this.audioContext.createGain();a.connect(l),l.connect(this.audioContext.destination),a.type="sine",a.frequency.setValueAtTime(1e3,this.audioContext.currentTime),a.frequency.exponentialRampToValueAtTime(1500,this.audioContext.currentTime+.1);const f=this.getSFXVolume();l.gain.setValueAtTime(.3*f,this.audioContext.currentTime),l.gain.exponentialRampToValueAtTime(.01,this.audioContext.currentTime+.15),a.start(),a.stop(this.audioContext.currentTime+.15)}playPowerCoinActivateSound(){if(!this.audioContext)return;const a=this.audioContext.currentTime,l=this.getSFXVolume(),f=this.audioContext.createOscillator(),h=this.audioContext.createGain();f.connect(h),h.connect(this.audioContext.destination),f.type="square",f.frequency.setValueAtTime(200,a),f.frequency.exponentialRampToValueAtTime(400,a+.3),h.gain.setValueAtTime(.2*l,a),h.gain.exponentialRampToValueAtTime(.01,a+.5),f.start(a),f.stop(a+.5);const y=this.audioContext.createOscillator(),v=this.audioContext.createGain();y.connect(v),v.connect(this.audioContext.destination),y.type="sine",y.frequency.setValueAtTime(800,a),y.frequency.exponentialRampToValueAtTime(1200,a+.2),v.gain.setValueAtTime(.15*l,a),v.gain.exponentialRampToValueAtTime(.01,a+.3),y.start(a),y.stop(a+.3)}startBackgroundMusic(){!this.audioContext||this.isBackgroundMusicPlaying||!this.backgroundMusicBuffer||(this.isBackgroundMusicPlaying=!0,this.playBackgroundMusicFile())}playBackgroundMusicFile(){if(!(!this.audioContext||!this.backgroundMusicGain||!this.backgroundMusicBuffer||!this.isBackgroundMusicPlaying))try{this.backgroundMusicSource=this.audioContext.createBufferSource(),this.backgroundMusicSource.buffer=this.backgroundMusicBuffer,this.backgroundMusicSource.connect(this.backgroundMusicGain),this.backgroundMusicSource.loop=!0,this.backgroundMusicSource.onended=()=>{this.isBackgroundMusicPlaying&&setTimeout(()=>{this.isBackgroundMusicPlaying&&this.playBackgroundMusicFile()},100)},this.backgroundMusicSource.start()}catch(a){Pe.warn("Failed to play background music file:",a)}}cleanup(){this.stopBackgroundMusic(),this.audioContext&&this.audioContext.close()}updateAudioVolumes(){const a=Ft.getState().audioSettings;if(this.backgroundMusicGain){const l=a.masterMuted||a.musicMuted?0:a.masterVolume/100*(a.musicVolume/100);this.backgroundMusicGain.gain.value=l}}getSFXVolume(){const a=Ft.getState().audioSettings;return a.masterMuted||a.sfxMuted?0:a.masterVolume/100*(a.sfxVolume/100)}updateVolumes(){this.updateAudioVolumes()}}class kM{constructor(a){be(this,"sprite");be(this,"currentState");be(this,"wasInAir",!1);be(this,"isLanding",!1);be(this,"isMapCleared",!1);be(this,"mapClearedFallComplete",!1);this.sprite=a,this.currentState={isGrounded:!0,isMoving:!1,isFloating:!1,gameState:"",moveDirection:"none",lastDirection:"right"}}update(a,l,f=!1,h=""){const y={isGrounded:a,isMoving:l!==0,isFloating:f,gameState:h,moveDirection:l>0?"right":l<0?"left":"none",lastDirection:this.getLastDirection()};h==="MAP_CLEARED"&&!this.isMapCleared&&(this.isMapCleared=!0,this.mapClearedFallComplete=!1,a&&(this.mapClearedFallComplete=!0)),this.isLanding&&this.sprite.currentAnimation.name.includes("land")&&this.sprite.currentFrameIndex>=this.sprite.currentAnimation.frames.length-1&&(this.isLanding=!1,this.isMapCleared&&(this.mapClearedFallComplete=!0));const v=this.wasInAir&&a;this.currentState=y,this.wasInAir=!a,v&&!this.isLanding&&this.isMapCleared?this.setLandingAnimation():v&&!this.isLanding?this.setLandingAnimation():this.isLanding||this.updateAnimation()}getLastDirection(){return this.sprite.currentAnimation.name.includes("right")?"right":"left"}updateAnimation(){const{isGrounded:a,isMoving:l,isFloating:f,gameState:h,moveDirection:y,lastDirection:v}=this.currentState;this.isMapCleared?this.mapClearedFallComplete?this.sprite.setAnimation("ghost-complete"):a?(this.mapClearedFallComplete=!0,this.sprite.setAnimation("ghost-complete")):this.handleAirAnimations(y,v):h==="MAP_CLEARED"?(this.isMapCleared=!0,this.mapClearedFallComplete=!1,this.handleAirAnimations(y,v)):f?this.handleFloatAnimations(y,v):a?l?this.handleWalkAnimations(y):this.handleIdleAnimations(v):this.handleAirAnimations(y,v)}handleAirAnimations(a,l){if(a==="right")this.sprite.setAnimationPreserveFrame("jump-right");else if(a==="left")this.sprite.setAnimationPreserveFrame("jump-left");else{const f=l==="right"?"jump-right":"jump-left";this.sprite.setAnimationPreserveFrame(f)}}handleFloatAnimations(a,l){a==="right"?this.sprite.setAnimation("float-right"):a==="left"?this.sprite.setAnimation("float-left"):this.sprite.setAnimation("float-stationary")}handleWalkAnimations(a){a==="right"?this.sprite.setAnimation("walk-right"):a==="left"&&this.sprite.setAnimation("walk-left")}handleIdleAnimations(a){const l=a==="right"?"idle-right":"idle-left";this.sprite.setAnimation(l)}setLandingAnimation(){const{lastDirection:a}=this.currentState,l=a==="right"?"land-right":"land-left";this.sprite.setAnimation(l),this.isLanding=!0}getCurrentState(){return{...this.currentState}}reset(){this.isMapCleared=!1,this.mapClearedFallComplete=!1,this.isLanding=!1,this.wasInAir=!1}}class _M{constructor(a){be(this,"inputManager");be(this,"collisionManager");be(this,"renderManager");be(this,"monsterSpawnManager");be(this,"audioManager");be(this,"animationController");be(this,"scalingManager");be(this,"monsterRespawnManager");be(this,"animationFrameId",null);be(this,"lastTime",0);be(this,"isBackgroundMusicPlaying",!1);be(this,"previousGameState",null);be(this,"devModeInitialized",!1);be(this,"boundGameLoop");be(this,"wasGroundedWhenMapCleared",!1);be(this,"mapStartTime",0);this.inputManager=new sM,this.collisionManager=new uM,this.renderManager=new yM(a),this.audioManager=new MM,this.animationController=new kM(Sp),this.scalingManager=ca.getInstance(),this.monsterRespawnManager=zv.getInstance(),this.monsterSpawnManager=new RM,this.boundGameLoop=this.gameLoop.bind(this);const l=Ft.getState();"setAudioManager"in l&&l.setAudioManager(this.audioManager)}start(){{const a=Ft.getState();a.resetGame(),"setGameStartTime"in a&&a.setGameStartTime(Date.now()),this.loadCurrentLevel()}FR(),this.gameLoop(0)}initializeDevMode(){const a=Ft.getState();a.resetGameState(),a.addScore(Ya.MOCK_DATA.score);const l=a.lives,f=Ya.MOCK_DATA.lives;if(f<l){for(let y=0;y<l-f;y++)a.loseLife();a.setState(ot.MENU)}const h=Ya.TARGET_LEVEL;{a.resetLevelState();for(let y=1;y<h;y++)a.nextLevel()}switch(this.loadCurrentLevel(),Ya.TARGET_STATE){case"START_MENU":a.setState(ot.MENU),a.setMenuType(Pt.START);break;case"COUNTDOWN":a.setState(ot.COUNTDOWN),a.setMenuType(Pt.COUNTDOWN);break;case"PLAYING":a.setState(ot.PLAYING),a.setMenuType(Pt.IN_GAME);break;case"PAUSED":a.setState(ot.PAUSED),a.setMenuType(Pt.PAUSE);break;case"SETTINGS":a.setState(ot.MENU),a.setMenuType(Pt.SETTINGS);break;case"BONUS":a.setState(ot.BONUS),a.setMenuType(Pt.BONUS),a.resetBombState();for(let y=0;y<Ya.MOCK_DATA.correctOrderCount;y++)a.collectBomb(y+1);break;case"VICTORY":a.setState(ot.VICTORY),a.setMenuType(Pt.VICTORY);break;case"GAME_OVER":a.setState(ot.GAME_OVER),a.setMenuType(Pt.GAME_OVER);break;default:Pe.warn(`Unknown DEV_MODE target state: ${Ya.TARGET_STATE}`),a.setState(ot.MENU),a.setMenuType(Pt.START)}Pe.dev(`DEV_MODE: Setting multiplier to ${Ya.MOCK_DATA.multiplier}x with ${Ya.MOCK_DATA.multiplierScore} progress`),a.setMultiplier(Ya.MOCK_DATA.multiplier,Ya.MOCK_DATA.multiplierScore),Pe.dev(`DEV_MODE initialized with state: ${Ya.TARGET_STATE}, level: ${Ya.TARGET_LEVEL}`),this.devModeInitialized=!0}stop(){this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.audioManager.stopBackgroundMusic(),this.isBackgroundMusicPlaying=!1}loadCurrentLevel(){const a=Ft.getState(),l=a.currentLevel;if(l<=vf.length){const f=vf[l-1];if(a.initializeLevel(f),a.clearAllFloatingTexts(),this.animationController.reset(),this.scalingManager.startMap(),this.renderManager.loadMapBackground(f.name),f.monsterSpawnPoints?(Pe.info(`GameManager: Initializing MonsterSpawnManager with ${f.monsterSpawnPoints.length} spawn points`),this.monsterSpawnManager.initializeLevel(f.monsterSpawnPoints)):(Pe.info("GameManager: Initializing MonsterSpawnManager with no spawn points"),this.monsterSpawnManager.initializeLevel([])),this.monsterRespawnManager.reset(),f.monsters){const h=f.monsters.map(y=>({...y,originalSpawnPoint:{x:y.x,y:y.y}}));a.updateMonsters(h),Pe.debug(`Set up original spawn points for ${h.length} static monsters`)}a.resetCoinState(),Pe.debug("Coins reset when loading new level"),this.mapStartTime=Date.now()}}gameLoop(a){const l=a-this.lastTime;this.lastTime=a;const f=Ft.getState();if(this.handleBackgroundMusic(f.currentState),this.handleDifficultyPause(f.currentState),f.currentState===ot.MENU&&!f.currentMap&&this.loadCurrentLevel(),f.currentState===ot.BONUS&&f.bonusAnimationComplete&&(setTimeout(()=>{this.proceedToNextLevel()},2e3),f.setBonusAnimationComplete(!1)),f.currentState===ot.PLAYING)this.update(l),Sp.update(l),this.handleCollisions(),this.checkWinCondition();else if(f.currentState===ot.MAP_CLEARED){Sp.update(l);const h=f.player;if(!this.wasGroundedWhenMapCleared){const y={...h};y.velocityY+=h.gravity,y.y+=y.velocityY;const v=f.ground;if(v){const C=this.collisionManager.checkPlayerGroundCollision(y,v);C.hasCollision&&C.normal&&C.penetration&&C.normal.y===-1&&(y.y=y.y-C.penetration,y.velocityY=0,y.isGrounded=!0)}f.updatePlayer(y)}this.animationController.update(h.isGrounded,0,!1,f.currentState)}this.render(),this.animationFrameId=requestAnimationFrame(this.boundGameLoop)}handleDifficultyPause(a){a===ot.PLAYING?(this.scalingManager.isCurrentlyPausedByPowerMode()||this.scalingManager.resume(),this.scalingManager.resumeAllMonsterScaling(),this.monsterSpawnManager.resume(),this.monsterRespawnManager.resume()):(this.scalingManager.pause(),this.scalingManager.pauseAllMonsterScaling(),this.monsterSpawnManager.pause(),this.monsterRespawnManager.pause())}handleBackgroundMusic(a){const l=a===ot.PLAYING;this.previousGameState!==a&&Pe.audio(`Game state changed: ${this.previousGameState} -> ${a}`),l&&!this.isBackgroundMusicPlaying&&(Pe.audio("Starting background music"),this.audioManager.playSound(ua.BACKGROUND_MUSIC,a),this.isBackgroundMusicPlaying=!0),!l&&this.isBackgroundMusicPlaying&&(Pe.audio("Stopping background music"),this.audioManager.stopBackgroundMusic(),this.isBackgroundMusicPlaying=!1),this.previousGameState=a}update(a){this.updatePlayer(a),this.updateMonsters(a),this.updateCoins(a)}updatePlayer(a){const l=Ft.getState();let f={...l.player};if(this.inputManager.isKeyPressed("p")||this.inputManager.isKeyPressed("P")){l.currentState===ot.PLAYING&&(l.setState(ot.PAUSED),l.setMenuType(Pt.PAUSE));return}let h=0;this.inputManager.isKeyPressed("ArrowLeft")&&(h=-f.moveSpeed),this.inputManager.isKeyPressed("ArrowRight")&&(h=f.moveSpeed),this.animationController.update(f.isGrounded,h,f.isFloating,l.currentState);const y=this.inputManager.isKeyPressed("ArrowUp"),v=this.inputManager.isShiftPressed(),C=this.inputManager.isKeyPressed(" ")||this.inputManager.isKeyPressed("Space");if(y&&f.isGrounded&&!f.isJumping){f.isJumping=!0,f.jumpStartTime=Date.now(),f.isGrounded=!1;const k=v?H.SUPER_JUMP_POWER:H.JUMP_POWER;f.velocityY=-k*.6}if(y&&f.isJumping&&f.velocityY<0){const k=Date.now()-f.jumpStartTime;if(k<=H.MAX_JUMP_DURATION){const _=Math.min(k/H.MAX_JUMP_DURATION,1),z=-(v?H.SUPER_JUMP_POWER:H.JUMP_POWER)*(.6+.4*_);f.velocityY>z&&(f.velocityY=z)}}(!y||Date.now()-f.jumpStartTime>H.MAX_JUMP_DURATION)&&f.isJumping&&(f.isJumping=!1),C&&!f.isGrounded?(f.isFloating||(f.velocityY=0),f.isFloating=!0):f.isFloating=!1,f.velocityX=h,f.x+=f.velocityX;const x=f.isFloating&&f.velocityY>=0?f.floatGravity:f.gravity;f.velocityY+=x,f.y+=f.velocityY;const R={width:H.CANVAS_WIDTH,height:H.CANVAS_HEIGHT},A=this.collisionManager.resolveBoundaryCollision(f,R);if(A.fellOffScreen){l.loseLife();return}f=A.player,f.isGrounded=!1,l.updatePlayer(f)}updateMonsters(a){const l=Date.now(),f=(l-this.mapStartTime)/1e3;Math.floor(f/5)!==Math.floor((f-a/1e3)/5)&&Pe.debug(`GameManager.updateMonsters() called at ${f.toFixed(1)}s`),this.monsterSpawnManager.update(l,a);const h=this.monsterRespawnManager.update(),y=Ft.getState();let v=y.monsters;h.length>0&&(v=[...v,...h],Pe.debug(`Added ${h.length} respawned monsters to active list: ${h.map(x=>x.type).join(", ")}`));const C=this.monsterRespawnManager.getDeadMonsterCount();C>0&&Pe.debug(`Respawn system: ${C} monsters waiting to respawn`),y.updateMonsters(v)}updateCoins(a){const l=Ft.getState(),f=l.currentMap?.platforms||[],h=l.currentMap?.ground,y=l.coinManager;h&&y&&(y.checkSpawnConditions(l),y.update(f,h,l),l.setCoins(y.getCoins()),l.updateMonsterStates(l.monsters)),l.updateFloatingTexts()}handleCollisions(){const a=Ft.getState(),{player:l,platforms:f,bombs:h,monsters:y,ground:v,coins:C}=a,x=this.collisionManager.checkPlayerPlatformCollision(l,f);if(x.hasCollision&&x.normal&&x.penetration){const _={...l};x.normal.y===-1?(_.y=_.y-x.penetration,_.velocityY=0,_.isGrounded=!0):x.normal.y===1?(_.y=_.y+x.penetration,_.velocityY=0):x.normal.x===1?(_.x=_.x+x.penetration,_.velocityX=0):x.normal.x===-1&&(_.x=_.x-x.penetration,_.velocityX=0),a.updatePlayer(_)}if(v){const _=this.collisionManager.checkPlayerGroundCollision(l,v);if(_.hasCollision&&_.normal&&_.penetration){const N={...l};_.normal.y===-1?(N.y=N.y-_.penetration,N.velocityY=0,N.isGrounded=!0):_.normal.y===1?(N.y=N.y+_.penetration,N.velocityY=0):_.normal.x===1?(N.x=N.x+_.penetration,N.velocityX=0):_.normal.x===-1&&(N.x=N.x-_.penetration,N.velocityX=0),a.updatePlayer(N)}}const R=this.collisionManager.checkPlayerBombCollision(l,h);if(R){this.audioManager.playSound(ua.BOMB_COLLECT);const _=a.collectBomb(R.order);_&&_.isCorrect&&a.onFirebombCollected()}const A=this.collisionManager.checkPlayerCoinCollision(l,C);A&&(this.audioManager.playSound(ua.COIN_COLLECT),a.collectCoin(A),A.type==="POWER"&&this.audioManager.playSound(ua.POWER_COIN_ACTIVATE));const k=this.collisionManager.checkPlayerMonsterCollision(l,y);if(k)if(a.activeEffects.powerMode){const _=a.coinManager?.calculateMonsterKillPoints(a.multiplier)||H.MONSTER_KILL_POINTS*a.multiplier;if(a.addScore(_),a.addFloatingText){const N=_.toString();a.addFloatingText(N,k.x+k.width/2,k.y+k.height/2,1e3,"#fff",15)}a.coinManager&&a.coinManager.onPointsEarned(_,!1),Pe.debug(`Monster killed during power mode: ${_} points`),this.audioManager.playSound(ua.COIN_COLLECT),this.monsterRespawnManager.killMonster(k)}else this.audioManager.playSound(ua.MONSTER_HIT),this.handlePlayerDeath()}handlePlayerDeath(){const a=Ft.getState();a.lives<=1?a.loseLife():(a.loseLife(),this.respawnPlayer())}respawnPlayer(){const a=Ft.getState(),l=a.currentMap;if(l){a.clearAllFloatingTexts(),this.scalingManager.resetOnDeath(),Pe.debug("ScalingManager: Reset difficulty to base values after player death"),a.resetCoinState(),Pe.debug("Coins reset after player death"),a.setPlayerPosition(l.playerStart.x,l.playerStart.y);const f=l.monsters.map(h=>({...h,x:h.patrolStartX||h.x,direction:1}));a.updateMonsters(f),this.animationController.reset(),this.renderManager.loadMapBackground(l.name),a.setMenuType(Pt.COUNTDOWN),a.setState(ot.COUNTDOWN),setTimeout(()=>{a.setState(ot.PLAYING)},3e3)}}checkWinCondition(){const a=Ft.getState();a.collectedBombs.length===H.TOTAL_BOMBS&&(Pe.game("Level completed - proceeding to next phase"),this.wasGroundedWhenMapCleared=a.player.isGrounded,this.audioManager.playSound(ua.MAP_CLEARED),a.setState(ot.MAP_CLEARED),setTimeout(()=>{this.proceedAfterMapCleared()},3e3))}proceedAfterMapCleared(){const a=Ft.getState(),l=H.BONUS_POINTS[a.correctOrderCount]||0,f=Date.now()-this.mapStartTime,h=a.getCoinStats(),y=h.totalCoinsCollected,v=h.totalPowerCoinsCollected;if(a.clearAllFloatingTexts(),a.resetEffects(),a.resetCoinState(),Pe.debug("Coins reset when map is cleared"),a.currentMap){const C={level:a.currentLevel,mapName:a.currentMap.name,correctOrderCount:a.correctOrderCount,totalBombs:H.TOTAL_BOMBS,score:a.score,bonus:l,hasBonus:l>0,coinsCollected:y,powerModeActivations:v,completionTime:f,timestamp:Date.now(),lives:a.lives,multiplier:a.multiplier};a.addLevelResult(C);const x={mapName:a.currentMap.name,level:a.currentLevel,correctOrderCount:a.correctOrderCount,totalBombs:H.TOTAL_BOMBS,score:a.score,bonus:l,hasBonus:l>0,timestamp:Date.now(),lives:a.lives,multiplier:a.multiplier,completionTime:f,coinsCollected:y,powerModeActivations:v};ux(x)}l>0?(a.setMenuType(Pt.BONUS),a.setState(ot.BONUS),this.audioManager.playSound(ua.BONUS_SCREEN),a.addScore(l),a.coinManager&&a.coinManager.onPointsEarned(l,!0)):this.proceedToNextLevel()}proceedToNextLevel(){const a=Ft.getState();a.currentLevel+1<=vf.length?(a.resetEffects(),a.resetCoinState(),Pe.debug("Coins reset when proceeding to next level"),a.nextLevel(),this.loadCurrentLevel(),a.setMenuType(Pt.COUNTDOWN),a.setState(ot.COUNTDOWN),setTimeout(()=>{a.setState(ot.PLAYING)},3e3)):(a.setState(ot.VICTORY),a.setMenuType(Pt.VICTORY))}continueToNextLevel(){this.proceedToNextLevel()}calculateBonus(a){return H.BONUS_POINTS[a]||0}render(){const a=Ft.getState();this.renderManager.render(a.player,a.platforms,a.bombs,a.monsters,a.ground,a.coins,a.floatingTexts,a.coinManager,this.monsterSpawnManager,a.currentMap,a)}cleanup(){this.stop(),this.inputManager.cleanup(),this.audioManager.cleanup()}getPauseStatus(){return{gameState:Ft.getState().currentState,scalingManager:this.scalingManager.getPauseStatus(),spawnManager:this.monsterSpawnManager.getPauseStatus(),respawnManager:{isPaused:this.monsterRespawnManager.isPaused()}}}getSpawnStatus(){return this.monsterSpawnManager.getSpawnStatus()}getSpawnManager(){return this.monsterSpawnManager}}const bp=()=>{const[c,a]=Q.useState(!1),l=Q.useCallback(x=>{const R=new CustomEvent("sigurd-startup-fullscreen-change",{detail:{isFullscreen:x,timestamp:Date.now(),gameId:"sigurd-startup-game"},bubbles:!0,cancelable:!0});window.dispatchEvent(R),document.dispatchEvent(R),Pe.debug(`Fullscreen event dispatched: ${x?"entered":"exited"}`)},[]),f=()=>!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled),h=()=>document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement,y=Q.useCallback(async x=>{if(!f())return console.warn("Fullscreen is not supported in this browser"),!1;const R=x||document.documentElement;try{return R.requestFullscreen?await R.requestFullscreen():R.webkitRequestFullscreen?await R.webkitRequestFullscreen():R.mozRequestFullScreen?await R.mozRequestFullScreen():R.msRequestFullscreen&&await R.msRequestFullscreen(),!0}catch(A){return console.error("Error entering fullscreen:",A),!1}},[]),v=Q.useCallback(async()=>{try{return document.exitFullscreen?await document.exitFullscreen():document.webkitExitFullscreen?await document.webkitExitFullscreen():document.mozCancelFullScreen?await document.mozCancelFullScreen():document.msExitFullscreen&&await document.msExitFullscreen(),!0}catch(x){return console.error("Error exiting fullscreen:",x),!1}},[]),C=Q.useCallback(async x=>{c?await v()&&(a(!1),l(!1)):await y(x)&&(a(!0),l(!0))},[c,y,v,l]);return Q.useEffect(()=>{const x=()=>{const A=!!h();A!==c&&(a(A),l(A))};return document.addEventListener("fullscreenchange",x),document.addEventListener("webkitfullscreenchange",x),document.addEventListener("mozfullscreenchange",x),document.addEventListener("MSFullscreenChange",x),x(),()=>{document.removeEventListener("fullscreenchange",x),document.removeEventListener("webkitfullscreenchange",x),document.removeEventListener("mozfullscreenchange",x),document.removeEventListener("MSFullscreenChange",x)}},[c,l]),{isFullscreen:c,isFullscreenSupported:f(),enterFullscreen:y,exitFullscreen:v,toggleFullscreen:C}},AM=({className:c=""})=>{const a=Q.useRef(null),l=Q.useRef(null),{isFullscreen:f}=bp(),[h,y]=Q.useState({});return Q.useEffect(()=>{const v=a.current;if(v)return v.width=H.CANVAS_WIDTH,v.height=H.CANVAS_HEIGHT,l.current=new _M(v),l.current.start(),()=>{l.current&&l.current.cleanup()}},[]),Q.useEffect(()=>{const v=()=>{if(!f){y({imageRendering:"crisp-edges"});return}const C=H.CANVAS_WIDTH/H.CANVAS_HEIGHT,x=window.innerWidth,R=window.innerHeight,A=x/R;let k,_;A>C?(_=R*.9,k=_*C):(k=x*.9,_=k/C),y({width:`${k}px`,height:`${_}px`,imageRendering:"crisp-edges"})};return v(),window.addEventListener("resize",v),()=>{window.removeEventListener("resize",v)}},[f]),I.jsx("div",{className:"relative",children:I.jsx("canvas",{ref:a,className:`shadow-black/10 shadow-lg rounded-lg ${c}`,style:h})})};function wx(c,a){if(typeof c=="function")return c(a);c!=null&&(c.current=a)}function bx(...c){return a=>{let l=!1;const f=c.map(h=>{const y=wx(h,a);return!l&&typeof y=="function"&&(l=!0),y});if(l)return()=>{for(let h=0;h<f.length;h++){const y=f[h];typeof y=="function"?y():wx(c[h],null)}}}}function ju(...c){return Q.useCallback(bx(...c),c)}function xx(c){const a=NM(c),l=Q.forwardRef((f,h)=>{const{children:y,...v}=f,C=Q.Children.toArray(y),x=C.find(LM);if(x){const R=x.props.children,A=C.map(k=>k===x?Q.Children.count(R)>1?Q.Children.only(null):Q.isValidElement(R)?R.props.children:null:k);return I.jsx(a,{...v,ref:h,children:Q.isValidElement(R)?Q.cloneElement(R,void 0,A):null})}return I.jsx(a,{...v,ref:h,children:y})});return l.displayName=`${c}.Slot`,l}var OM=xx("Slot");function NM(c){const a=Q.forwardRef((l,f)=>{const{children:h,...y}=l;if(Q.isValidElement(h)){const v=IM(h),C=PM(y,h.props);return h.type!==Q.Fragment&&(C.ref=f?bx(f,v):v),Q.cloneElement(h,C)}return Q.Children.count(h)>1?Q.Children.only(null):null});return a.displayName=`${c}.SlotClone`,a}var Cx=Symbol("radix.slottable");function DM(c){const a=({children:l})=>I.jsx(I.Fragment,{children:l});return a.displayName=`${c}.Slottable`,a.__radixId=Cx,a}function LM(c){return Q.isValidElement(c)&&typeof c.type=="function"&&"__radixId"in c.type&&c.type.__radixId===Cx}function PM(c,a){const l={...a};for(const f in a){const h=c[f],y=a[f];/^on[A-Z]/.test(f)?h&&y?l[f]=(...C)=>{const x=y(...C);return h(...C),x}:h&&(l[f]=h):f==="style"?l[f]={...h,...y}:f==="className"&&(l[f]=[h,y].filter(Boolean).join(" "))}return{...c,...l}}function IM(c){let a=Object.getOwnPropertyDescriptor(c.props,"ref")?.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?c.ref:(a=Object.getOwnPropertyDescriptor(c,"ref")?.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?c.props.ref:c.props.ref||c.ref)}function Ex(c){var a,l,f="";if(typeof c=="string"||typeof c=="number")f+=c;else if(typeof c=="object")if(Array.isArray(c)){var h=c.length;for(a=0;a<h;a++)c[a]&&(l=Ex(c[a]))&&(f&&(f+=" "),f+=l)}else for(l in c)c[l]&&(f&&(f+=" "),f+=l);return f}function Tx(){for(var c,a,l=0,f="",h=arguments.length;l<h;l++)(c=arguments[l])&&(a=Ex(c))&&(f&&(f+=" "),f+=a);return f}const Rx=c=>typeof c=="boolean"?`${c}`:c===0?"0":c,Mx=Tx,UM=(c,a)=>l=>{var f;if(a?.variants==null)return Mx(c,l?.class,l?.className);const{variants:h,defaultVariants:y}=a,v=Object.keys(h).map(R=>{const A=l?.[R],k=y?.[R];if(A===null)return null;const _=Rx(A)||Rx(k);return h[R][_]}),C=l&&Object.entries(l).reduce((R,A)=>{let[k,_]=A;return _===void 0||(R[k]=_),R},{}),x=a==null||(f=a.compoundVariants)===null||f===void 0?void 0:f.reduce((R,A)=>{let{class:k,className:_,...N}=A;return Object.entries(N).every(z=>{let[G,J]=z;return Array.isArray(J)?J.includes({...y,...C}[G]):{...y,...C}[G]===J})?[...R,k,_]:R},[]);return Mx(c,v,x,l?.class,l?.className)},n0="-",zM=c=>{const a=jM(c),{conflictingClassGroups:l,conflictingClassGroupModifiers:f}=c;return{getClassGroupId:v=>{const C=v.split(n0);return C[0]===""&&C.length!==1&&C.shift(),kx(C,a)||FM(v)},getConflictingClassGroupIds:(v,C)=>{const x=l[v]||[];return C&&f[v]?[...x,...f[v]]:x}}},kx=(c,a)=>{if(c.length===0)return a.classGroupId;const l=c[0],f=a.nextPart.get(l),h=f?kx(c.slice(1),f):void 0;if(h)return h;if(a.validators.length===0)return;const y=c.join(n0);return a.validators.find(({validator:v})=>v(y))?.classGroupId},_x=/^\[(.+)\]$/,FM=c=>{if(_x.test(c)){const a=_x.exec(c)[1],l=a?.substring(0,a.indexOf(":"));if(l)return"arbitrary.."+l}},jM=c=>{const{theme:a,classGroups:l}=c,f={nextPart:new Map,validators:[]};for(const h in l)r0(l[h],f,h,a);return f},r0=(c,a,l,f)=>{c.forEach(h=>{if(typeof h=="string"){const y=h===""?a:Ax(a,h);y.classGroupId=l;return}if(typeof h=="function"){if(BM(h)){r0(h(f),a,l,f);return}a.validators.push({validator:h,classGroupId:l});return}Object.entries(h).forEach(([y,v])=>{r0(v,Ax(a,y),l,f)})})},Ax=(c,a)=>{let l=c;return a.split(n0).forEach(f=>{l.nextPart.has(f)||l.nextPart.set(f,{nextPart:new Map,validators:[]}),l=l.nextPart.get(f)}),l},BM=c=>c.isThemeGetter,HM=c=>{if(c<1)return{get:()=>{},set:()=>{}};let a=0,l=new Map,f=new Map;const h=(y,v)=>{l.set(y,v),a++,a>c&&(a=0,f=l,l=new Map)};return{get(y){let v=l.get(y);if(v!==void 0)return v;if((v=f.get(y))!==void 0)return h(y,v),v},set(y,v){l.has(y)?l.set(y,v):h(y,v)}}},a0="!",i0=":",VM=i0.length,$M=c=>{const{prefix:a,experimentalParseClassName:l}=c;let f=h=>{const y=[];let v=0,C=0,x=0,R;for(let z=0;z<h.length;z++){let G=h[z];if(v===0&&C===0){if(G===i0){y.push(h.slice(x,z)),x=z+VM;continue}if(G==="/"){R=z;continue}}G==="["?v++:G==="]"?v--:G==="("?C++:G===")"&&C--}const A=y.length===0?h:h.substring(x),k=GM(A),_=k!==A,N=R&&R>x?R-x:void 0;return{modifiers:y,hasImportantModifier:_,baseClassName:k,maybePostfixModifierPosition:N}};if(a){const h=a+i0,y=f;f=v=>v.startsWith(h)?y(v.substring(h.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:v,maybePostfixModifierPosition:void 0}}if(l){const h=f;f=y=>l({className:y,parseClassName:h})}return f},GM=c=>c.endsWith(a0)?c.substring(0,c.length-1):c.startsWith(a0)?c.substring(1):c,YM=c=>{const a=Object.fromEntries(c.orderSensitiveModifiers.map(f=>[f,!0]));return f=>{if(f.length<=1)return f;const h=[];let y=[];return f.forEach(v=>{v[0]==="["||a[v]?(h.push(...y.sort(),v),y=[]):y.push(v)}),h.push(...y.sort()),h}},WM=c=>({cache:HM(c.cacheSize),parseClassName:$M(c),sortModifiers:YM(c),...zM(c)}),XM=/\s+/,KM=(c,a)=>{const{parseClassName:l,getClassGroupId:f,getConflictingClassGroupIds:h,sortModifiers:y}=a,v=[],C=c.trim().split(XM);let x="";for(let R=C.length-1;R>=0;R-=1){const A=C[R],{isExternal:k,modifiers:_,hasImportantModifier:N,baseClassName:z,maybePostfixModifierPosition:G}=l(A);if(k){x=A+(x.length>0?" "+x:x);continue}let J=!!G,de=f(J?z.substring(0,G):z);if(!de){if(!J){x=A+(x.length>0?" "+x:x);continue}if(de=f(z),!de){x=A+(x.length>0?" "+x:x);continue}J=!1}const ue=y(_).join(":"),ce=N?ue+a0:ue,fe=ce+de;if(v.includes(fe))continue;v.push(fe);const le=h(de,J);for(let Re=0;Re<le.length;++Re){const ve=le[Re];v.push(ce+ve)}x=A+(x.length>0?" "+x:x)}return x};function QM(){let c=0,a,l,f="";for(;c<arguments.length;)(a=arguments[c++])&&(l=Ox(a))&&(f&&(f+=" "),f+=l);return f}const Ox=c=>{if(typeof c=="string")return c;let a,l="";for(let f=0;f<c.length;f++)c[f]&&(a=Ox(c[f]))&&(l&&(l+=" "),l+=a);return l};function qM(c,...a){let l,f,h,y=v;function v(x){const R=a.reduce((A,k)=>k(A),c());return l=WM(R),f=l.cache.get,h=l.cache.set,y=C,C(x)}function C(x){const R=f(x);if(R)return R;const A=KM(x,l);return h(x,A),A}return function(){return y(QM.apply(null,arguments))}}const Sr=c=>{const a=l=>l[c]||[];return a.isThemeGetter=!0,a},Nx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ZM=/^\d+\/\d+$/,JM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ek=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,tk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,nk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rk=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mf=c=>ZM.test(c),jt=c=>!!c&&!Number.isNaN(Number(c)),js=c=>!!c&&Number.isInteger(Number(c)),o0=c=>c.endsWith("%")&&jt(c.slice(0,-1)),Ul=c=>JM.test(c),ak=()=>!0,ik=c=>ek.test(c)&&!tk.test(c),Lx=()=>!1,ok=c=>nk.test(c),lk=c=>rk.test(c),sk=c=>!Ke(c)&&!Qe(c),uk=c=>gf(c,Fx,Lx),Ke=c=>Nx.test(c),Bu=c=>gf(c,jx,ik),l0=c=>gf(c,hk,jt),Px=c=>gf(c,Ux,Lx),ck=c=>gf(c,zx,lk),Fv=c=>gf(c,Bx,ok),Qe=c=>Dx.test(c),xp=c=>yf(c,jx),fk=c=>yf(c,vk),Ix=c=>yf(c,Ux),dk=c=>yf(c,Fx),pk=c=>yf(c,zx),jv=c=>yf(c,Bx,!0),gf=(c,a,l)=>{const f=Nx.exec(c);return f?f[1]?a(f[1]):l(f[2]):!1},yf=(c,a,l=!1)=>{const f=Dx.exec(c);return f?f[1]?a(f[1]):l:!1},Ux=c=>c==="position"||c==="percentage",zx=c=>c==="image"||c==="url",Fx=c=>c==="length"||c==="size"||c==="bg-size",jx=c=>c==="length",hk=c=>c==="number",vk=c=>c==="family-name",Bx=c=>c==="shadow",mk=qM(()=>{const c=Sr("color"),a=Sr("font"),l=Sr("text"),f=Sr("font-weight"),h=Sr("tracking"),y=Sr("leading"),v=Sr("breakpoint"),C=Sr("container"),x=Sr("spacing"),R=Sr("radius"),A=Sr("shadow"),k=Sr("inset-shadow"),_=Sr("text-shadow"),N=Sr("drop-shadow"),z=Sr("blur"),G=Sr("perspective"),J=Sr("aspect"),de=Sr("ease"),ue=Sr("animate"),ce=()=>["auto","avoid","all","avoid-page","page","left","right","column"],fe=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],le=()=>[...fe(),Qe,Ke],Re=()=>["auto","hidden","clip","visible","scroll"],ve=()=>["auto","contain","none"],xe=()=>[Qe,Ke,x],tt=()=>[mf,"full","auto",...xe()],dt=()=>[js,"none","subgrid",Qe,Ke],Rt=()=>["auto",{span:["full",js,Qe,Ke]},js,Qe,Ke],lt=()=>[js,"auto",Qe,Ke],Ae=()=>["auto","min","max","fr",Qe,Ke],rt=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],st=()=>["start","end","center","stretch","center-safe","end-safe"],qe=()=>["auto",...xe()],Te=()=>[mf,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...xe()],$=()=>[c,Qe,Ke],ke=()=>[...fe(),Ix,Px,{position:[Qe,Ke]}],Ce=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",dk,uk,{size:[Qe,Ke]}],oe=()=>[o0,xp,Bu],Be=()=>["","none","full",R,Qe,Ke],He=()=>["",jt,xp,Bu],yt=()=>["solid","dashed","dotted","double"],xt=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ve=()=>[jt,o0,Ix,Px],St=()=>["","none",z,Qe,Ke],wt=()=>["none",jt,Qe,Ke],$t=()=>["none",jt,Qe,Ke],gn=()=>[jt,Qe,Ke],Un=()=>[mf,"full",...xe()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ul],breakpoint:[Ul],color:[ak],container:[Ul],"drop-shadow":[Ul],ease:["in","out","in-out"],font:[sk],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ul],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ul],shadow:[Ul],spacing:["px",jt],text:[Ul],"text-shadow":[Ul],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",mf,Ke,Qe,J]}],container:["container"],columns:[{columns:[jt,Ke,Qe,C]}],"break-after":[{"break-after":ce()}],"break-before":[{"break-before":ce()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:le()}],overflow:[{overflow:Re()}],"overflow-x":[{"overflow-x":Re()}],"overflow-y":[{"overflow-y":Re()}],overscroll:[{overscroll:ve()}],"overscroll-x":[{"overscroll-x":ve()}],"overscroll-y":[{"overscroll-y":ve()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:tt()}],"inset-x":[{"inset-x":tt()}],"inset-y":[{"inset-y":tt()}],start:[{start:tt()}],end:[{end:tt()}],top:[{top:tt()}],right:[{right:tt()}],bottom:[{bottom:tt()}],left:[{left:tt()}],visibility:["visible","invisible","collapse"],z:[{z:[js,"auto",Qe,Ke]}],basis:[{basis:[mf,"full","auto",C,...xe()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[jt,mf,"auto","initial","none",Ke]}],grow:[{grow:["",jt,Qe,Ke]}],shrink:[{shrink:["",jt,Qe,Ke]}],order:[{order:[js,"first","last","none",Qe,Ke]}],"grid-cols":[{"grid-cols":dt()}],"col-start-end":[{col:Rt()}],"col-start":[{"col-start":lt()}],"col-end":[{"col-end":lt()}],"grid-rows":[{"grid-rows":dt()}],"row-start-end":[{row:Rt()}],"row-start":[{"row-start":lt()}],"row-end":[{"row-end":lt()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Ae()}],"auto-rows":[{"auto-rows":Ae()}],gap:[{gap:xe()}],"gap-x":[{"gap-x":xe()}],"gap-y":[{"gap-y":xe()}],"justify-content":[{justify:[...rt(),"normal"]}],"justify-items":[{"justify-items":[...st(),"normal"]}],"justify-self":[{"justify-self":["auto",...st()]}],"align-content":[{content:["normal",...rt()]}],"align-items":[{items:[...st(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...st(),{baseline:["","last"]}]}],"place-content":[{"place-content":rt()}],"place-items":[{"place-items":[...st(),"baseline"]}],"place-self":[{"place-self":["auto",...st()]}],p:[{p:xe()}],px:[{px:xe()}],py:[{py:xe()}],ps:[{ps:xe()}],pe:[{pe:xe()}],pt:[{pt:xe()}],pr:[{pr:xe()}],pb:[{pb:xe()}],pl:[{pl:xe()}],m:[{m:qe()}],mx:[{mx:qe()}],my:[{my:qe()}],ms:[{ms:qe()}],me:[{me:qe()}],mt:[{mt:qe()}],mr:[{mr:qe()}],mb:[{mb:qe()}],ml:[{ml:qe()}],"space-x":[{"space-x":xe()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":xe()}],"space-y-reverse":["space-y-reverse"],size:[{size:Te()}],w:[{w:[C,"screen",...Te()]}],"min-w":[{"min-w":[C,"screen","none",...Te()]}],"max-w":[{"max-w":[C,"screen","none","prose",{screen:[v]},...Te()]}],h:[{h:["screen","lh",...Te()]}],"min-h":[{"min-h":["screen","lh","none",...Te()]}],"max-h":[{"max-h":["screen","lh",...Te()]}],"font-size":[{text:["base",l,xp,Bu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[f,Qe,l0]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",o0,Ke]}],"font-family":[{font:[fk,Ke,a]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[h,Qe,Ke]}],"line-clamp":[{"line-clamp":[jt,"none",Qe,l0]}],leading:[{leading:[y,...xe()]}],"list-image":[{"list-image":["none",Qe,Ke]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Qe,Ke]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...yt(),"wavy"]}],"text-decoration-thickness":[{decoration:[jt,"from-font","auto",Qe,Bu]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[jt,"auto",Qe,Ke]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:xe()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Qe,Ke]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Qe,Ke]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ke()}],"bg-repeat":[{bg:Ce()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},js,Qe,Ke],radial:["",Qe,Ke],conic:[js,Qe,Ke]},pk,ck]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:oe()}],"gradient-via-pos":[{via:oe()}],"gradient-to-pos":[{to:oe()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:Be()}],"rounded-s":[{"rounded-s":Be()}],"rounded-e":[{"rounded-e":Be()}],"rounded-t":[{"rounded-t":Be()}],"rounded-r":[{"rounded-r":Be()}],"rounded-b":[{"rounded-b":Be()}],"rounded-l":[{"rounded-l":Be()}],"rounded-ss":[{"rounded-ss":Be()}],"rounded-se":[{"rounded-se":Be()}],"rounded-ee":[{"rounded-ee":Be()}],"rounded-es":[{"rounded-es":Be()}],"rounded-tl":[{"rounded-tl":Be()}],"rounded-tr":[{"rounded-tr":Be()}],"rounded-br":[{"rounded-br":Be()}],"rounded-bl":[{"rounded-bl":Be()}],"border-w":[{border:He()}],"border-w-x":[{"border-x":He()}],"border-w-y":[{"border-y":He()}],"border-w-s":[{"border-s":He()}],"border-w-e":[{"border-e":He()}],"border-w-t":[{"border-t":He()}],"border-w-r":[{"border-r":He()}],"border-w-b":[{"border-b":He()}],"border-w-l":[{"border-l":He()}],"divide-x":[{"divide-x":He()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":He()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...yt(),"hidden","none"]}],"divide-style":[{divide:[...yt(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...yt(),"none","hidden"]}],"outline-offset":[{"outline-offset":[jt,Qe,Ke]}],"outline-w":[{outline:["",jt,xp,Bu]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",A,jv,Fv]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",k,jv,Fv]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:He()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[jt,Bu]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":He()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",_,jv,Fv]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[jt,Qe,Ke]}],"mix-blend":[{"mix-blend":[...xt(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xt()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[jt]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ve()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":Ve()}],"mask-image-t-to-pos":[{"mask-t-to":Ve()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":Ve()}],"mask-image-r-to-pos":[{"mask-r-to":Ve()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":Ve()}],"mask-image-b-to-pos":[{"mask-b-to":Ve()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":Ve()}],"mask-image-l-to-pos":[{"mask-l-to":Ve()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":Ve()}],"mask-image-x-to-pos":[{"mask-x-to":Ve()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":Ve()}],"mask-image-y-to-pos":[{"mask-y-to":Ve()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[Qe,Ke]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ve()}],"mask-image-radial-from-color":[{"mask-radial-from":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":fe()}],"mask-image-conic-pos":[{"mask-conic":[jt]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ve()}],"mask-image-conic-from-color":[{"mask-conic-from":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ke()}],"mask-repeat":[{mask:Ce()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Qe,Ke]}],filter:[{filter:["","none",Qe,Ke]}],blur:[{blur:St()}],brightness:[{brightness:[jt,Qe,Ke]}],contrast:[{contrast:[jt,Qe,Ke]}],"drop-shadow":[{"drop-shadow":["","none",N,jv,Fv]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",jt,Qe,Ke]}],"hue-rotate":[{"hue-rotate":[jt,Qe,Ke]}],invert:[{invert:["",jt,Qe,Ke]}],saturate:[{saturate:[jt,Qe,Ke]}],sepia:[{sepia:["",jt,Qe,Ke]}],"backdrop-filter":[{"backdrop-filter":["","none",Qe,Ke]}],"backdrop-blur":[{"backdrop-blur":St()}],"backdrop-brightness":[{"backdrop-brightness":[jt,Qe,Ke]}],"backdrop-contrast":[{"backdrop-contrast":[jt,Qe,Ke]}],"backdrop-grayscale":[{"backdrop-grayscale":["",jt,Qe,Ke]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[jt,Qe,Ke]}],"backdrop-invert":[{"backdrop-invert":["",jt,Qe,Ke]}],"backdrop-opacity":[{"backdrop-opacity":[jt,Qe,Ke]}],"backdrop-saturate":[{"backdrop-saturate":[jt,Qe,Ke]}],"backdrop-sepia":[{"backdrop-sepia":["",jt,Qe,Ke]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":xe()}],"border-spacing-x":[{"border-spacing-x":xe()}],"border-spacing-y":[{"border-spacing-y":xe()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Qe,Ke]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[jt,"initial",Qe,Ke]}],ease:[{ease:["linear","initial",de,Qe,Ke]}],delay:[{delay:[jt,Qe,Ke]}],animate:[{animate:["none",ue,Qe,Ke]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[G,Qe,Ke]}],"perspective-origin":[{"perspective-origin":le()}],rotate:[{rotate:wt()}],"rotate-x":[{"rotate-x":wt()}],"rotate-y":[{"rotate-y":wt()}],"rotate-z":[{"rotate-z":wt()}],scale:[{scale:$t()}],"scale-x":[{"scale-x":$t()}],"scale-y":[{"scale-y":$t()}],"scale-z":[{"scale-z":$t()}],"scale-3d":["scale-3d"],skew:[{skew:gn()}],"skew-x":[{"skew-x":gn()}],"skew-y":[{"skew-y":gn()}],transform:[{transform:[Qe,Ke,"","none","gpu","cpu"]}],"transform-origin":[{origin:le()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Un()}],"translate-x":[{"translate-x":Un()}],"translate-y":[{"translate-y":Un()}],"translate-z":[{"translate-z":Un()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Qe,Ke]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":xe()}],"scroll-mx":[{"scroll-mx":xe()}],"scroll-my":[{"scroll-my":xe()}],"scroll-ms":[{"scroll-ms":xe()}],"scroll-me":[{"scroll-me":xe()}],"scroll-mt":[{"scroll-mt":xe()}],"scroll-mr":[{"scroll-mr":xe()}],"scroll-mb":[{"scroll-mb":xe()}],"scroll-ml":[{"scroll-ml":xe()}],"scroll-p":[{"scroll-p":xe()}],"scroll-px":[{"scroll-px":xe()}],"scroll-py":[{"scroll-py":xe()}],"scroll-ps":[{"scroll-ps":xe()}],"scroll-pe":[{"scroll-pe":xe()}],"scroll-pt":[{"scroll-pt":xe()}],"scroll-pr":[{"scroll-pr":xe()}],"scroll-pb":[{"scroll-pb":xe()}],"scroll-pl":[{"scroll-pl":xe()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Qe,Ke]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[jt,xp,Bu,l0]}],stroke:[{stroke:["none",...$()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Hx(...c){return mk(Tx(c))}const gk=UM("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),vi=Q.forwardRef(({className:c,variant:a,size:l,asChild:f=!1,...h},y)=>{const v=f?OM:"button";return I.jsx(v,{className:Hx(gk({variant:a,size:l,className:c})),ref:y,...h})});vi.displayName="Button";/**
242
242
  * @license lucide-react v0.539.0 - ISC
243
243
  *
244
244
  * This source code is licensed under the ISC license.
@@ -318,5 +318,5 @@ You might need to use a local HTTP server (instead of file://): https://reactjs.
318
318
  *
319
319
  * This source code is licensed under the ISC license.
320
320
  * See the LICENSE file in the root directory of this source tree.
321
- */const kk=Ui("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"}]]);function zl(c,a,{checkForDefaultPrevented:l=!0}={}){return function(h){if(c?.(h),l===!1||!h.defaultPrevented)return a?.(h)}}function Qx(c,a=[]){let l=[];function f(y,v){const C=Q.createContext(v),x=l.length;l=[...l,v];const R=k=>{const{scope:_,children:N,...z}=k,G=_?.[c]?.[x]||C,J=Q.useMemo(()=>z,Object.values(z));return I.jsx(G.Provider,{value:J,children:N})};R.displayName=y+"Provider";function A(k,_){const N=_?.[c]?.[x]||C,z=Q.useContext(N);if(z)return z;if(v!==void 0)return v;throw new Error(`\`${k}\` must be used within \`${y}\``)}return[R,A]}const h=()=>{const y=l.map(v=>Q.createContext(v));return function(C){const x=C?.[c]||y;return Q.useMemo(()=>({[`__scope${c}`]:{...C,[c]:x}}),[C,x])}};return h.scopeName=c,[f,_k(h,...a)]}function _k(...c){const a=c[0];if(c.length===1)return a;const l=()=>{const f=c.map(h=>({useScope:h(),scopeName:h.scopeName}));return function(y){const v=f.reduce((C,{useScope:x,scopeName:R})=>{const k=x(y)[`__scope${R}`];return{...C,...k}},{});return Q.useMemo(()=>({[`__scope${a.scopeName}`]:v}),[v])}};return l.scopeName=a.scopeName,l}var Ak=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Hu=Ak.reduce((c,a)=>{const l=xx(`Primitive.${a}`),f=Q.forwardRef((h,y)=>{const{asChild:v,...C}=h,x=v?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),I.jsx(x,{...C,ref:y})});return f.displayName=`Primitive.${a}`,{...c,[a]:f}},{});function Ok(c,a){c&&Zy.flushSync(()=>c.dispatchEvent(a))}function Bv(c){const a=Q.useRef(c);return Q.useEffect(()=>{a.current=c}),Q.useMemo(()=>(...l)=>a.current?.(...l),[])}function Nk(c,a=globalThis?.document){const l=Bv(c);Q.useEffect(()=>{const f=h=>{h.key==="Escape"&&l(h)};return a.addEventListener("keydown",f,{capture:!0}),()=>a.removeEventListener("keydown",f,{capture:!0})},[l,a])}var Dk="DismissableLayer",u0="dismissableLayer.update",Lk="dismissableLayer.pointerDownOutside",Pk="dismissableLayer.focusOutside",qx,Zx=Q.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jx=Q.forwardRef((c,a)=>{const{disableOutsidePointerEvents:l=!1,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:y,onInteractOutside:v,onDismiss:C,...x}=c,R=Q.useContext(Zx),[A,k]=Q.useState(null),_=A?.ownerDocument??globalThis?.document,[,N]=Q.useState({}),z=ju(a,ve=>k(ve)),G=Array.from(R.layers),[J]=[...R.layersWithOutsidePointerEventsDisabled].slice(-1),de=G.indexOf(J),ue=A?G.indexOf(A):-1,ce=R.layersWithOutsidePointerEventsDisabled.size>0,fe=ue>=de,le=zk(ve=>{const xe=ve.target,tt=[...R.branches].some(dt=>dt.contains(xe));!fe||tt||(h?.(ve),v?.(ve),ve.defaultPrevented||C?.())},_),Re=Fk(ve=>{const xe=ve.target;[...R.branches].some(dt=>dt.contains(xe))||(y?.(ve),v?.(ve),ve.defaultPrevented||C?.())},_);return Nk(ve=>{ue===R.layers.size-1&&(f?.(ve),!ve.defaultPrevented&&C&&(ve.preventDefault(),C()))},_),Q.useEffect(()=>{if(A)return l&&(R.layersWithOutsidePointerEventsDisabled.size===0&&(qx=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),R.layersWithOutsidePointerEventsDisabled.add(A)),R.layers.add(A),eC(),()=>{l&&R.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=qx)}},[A,_,l,R]),Q.useEffect(()=>()=>{A&&(R.layers.delete(A),R.layersWithOutsidePointerEventsDisabled.delete(A),eC())},[A,R]),Q.useEffect(()=>{const ve=()=>N({});return document.addEventListener(u0,ve),()=>document.removeEventListener(u0,ve)},[]),I.jsx(Hu.div,{...x,ref:z,style:{pointerEvents:ce?fe?"auto":"none":void 0,...c.style},onFocusCapture:zl(c.onFocusCapture,Re.onFocusCapture),onBlurCapture:zl(c.onBlurCapture,Re.onBlurCapture),onPointerDownCapture:zl(c.onPointerDownCapture,le.onPointerDownCapture)})});Jx.displayName=Dk;var Ik="DismissableLayerBranch",Uk=Q.forwardRef((c,a)=>{const l=Q.useContext(Zx),f=Q.useRef(null),h=ju(a,f);return Q.useEffect(()=>{const y=f.current;if(y)return l.branches.add(y),()=>{l.branches.delete(y)}},[l.branches]),I.jsx(Hu.div,{...c,ref:h})});Uk.displayName=Ik;function zk(c,a=globalThis?.document){const l=Bv(c),f=Q.useRef(!1),h=Q.useRef(()=>{});return Q.useEffect(()=>{const y=C=>{if(C.target&&!f.current){let x=function(){tC(Lk,l,R,{discrete:!0})};const R={originalEvent:C};C.pointerType==="touch"?(a.removeEventListener("click",h.current),h.current=x,a.addEventListener("click",h.current,{once:!0})):x()}else a.removeEventListener("click",h.current);f.current=!1},v=window.setTimeout(()=>{a.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(v),a.removeEventListener("pointerdown",y),a.removeEventListener("click",h.current)}},[a,l]),{onPointerDownCapture:()=>f.current=!0}}function Fk(c,a=globalThis?.document){const l=Bv(c),f=Q.useRef(!1);return Q.useEffect(()=>{const h=y=>{y.target&&!f.current&&tC(Pk,l,{originalEvent:y},{discrete:!1})};return a.addEventListener("focusin",h),()=>a.removeEventListener("focusin",h)},[a,l]),{onFocusCapture:()=>f.current=!0,onBlurCapture:()=>f.current=!1}}function eC(){const c=new CustomEvent(u0);document.dispatchEvent(c)}function tC(c,a,l,{discrete:f}){const h=l.originalEvent.target,y=new CustomEvent(c,{bubbles:!1,cancelable:!0,detail:l});a&&h.addEventListener(c,a,{once:!0}),f?Ok(h,y):h.dispatchEvent(y)}var Vu=globalThis?.document?Q.useLayoutEffect:()=>{},jk=ax[" useId ".trim().toString()]||(()=>{}),Bk=0;function Hk(c){const[a,l]=Q.useState(jk());return Vu(()=>{l(f=>f??String(Bk++))},[c]),a?`radix-${a}`:""}const Vk=["top","right","bottom","left"],Bs=Math.min,mi=Math.max,Hv=Math.round,Vv=Math.floor,$o=c=>({x:c,y:c}),$k={left:"right",right:"left",bottom:"top",top:"bottom"},Gk={start:"end",end:"start"};function c0(c,a,l){return mi(c,Bs(a,l))}function Fl(c,a){return typeof c=="function"?c(a):c}function jl(c){return c.split("-")[0]}function Sf(c){return c.split("-")[1]}function f0(c){return c==="x"?"y":"x"}function d0(c){return c==="y"?"height":"width"}const Yk=new Set(["top","bottom"]);function Go(c){return Yk.has(jl(c))?"y":"x"}function p0(c){return f0(Go(c))}function Wk(c,a,l){l===void 0&&(l=!1);const f=Sf(c),h=p0(c),y=d0(h);let v=h==="x"?f===(l?"end":"start")?"right":"left":f==="start"?"bottom":"top";return a.reference[y]>a.floating[y]&&(v=$v(v)),[v,$v(v)]}function Xk(c){const a=$v(c);return[h0(c),a,h0(a)]}function h0(c){return c.replace(/start|end/g,a=>Gk[a])}const nC=["left","right"],rC=["right","left"],Kk=["top","bottom"],Qk=["bottom","top"];function qk(c,a,l){switch(c){case"top":case"bottom":return l?a?rC:nC:a?nC:rC;case"left":case"right":return a?Kk:Qk;default:return[]}}function Zk(c,a,l,f){const h=Sf(c);let y=qk(jl(c),l==="start",f);return h&&(y=y.map(v=>v+"-"+h),a&&(y=y.concat(y.map(h0)))),y}function $v(c){return c.replace(/left|right|bottom|top/g,a=>$k[a])}function Jk(c){return{top:0,right:0,bottom:0,left:0,...c}}function aC(c){return typeof c!="number"?Jk(c):{top:c,right:c,bottom:c,left:c}}function Gv(c){const{x:a,y:l,width:f,height:h}=c;return{width:f,height:h,top:l,left:a,right:a+f,bottom:l+h,x:a,y:l}}function iC(c,a,l){let{reference:f,floating:h}=c;const y=Go(a),v=p0(a),C=d0(v),x=jl(a),R=y==="y",A=f.x+f.width/2-h.width/2,k=f.y+f.height/2-h.height/2,_=f[C]/2-h[C]/2;let N;switch(x){case"top":N={x:A,y:f.y-h.height};break;case"bottom":N={x:A,y:f.y+f.height};break;case"right":N={x:f.x+f.width,y:k};break;case"left":N={x:f.x-h.width,y:k};break;default:N={x:f.x,y:f.y}}switch(Sf(a)){case"start":N[v]-=_*(l&&R?-1:1);break;case"end":N[v]+=_*(l&&R?-1:1);break}return N}const e_=async(c,a,l)=>{const{placement:f="bottom",strategy:h="absolute",middleware:y=[],platform:v}=l,C=y.filter(Boolean),x=await(v.isRTL==null?void 0:v.isRTL(a));let R=await v.getElementRects({reference:c,floating:a,strategy:h}),{x:A,y:k}=iC(R,f,x),_=f,N={},z=0;for(let G=0;G<C.length;G++){const{name:J,fn:de}=C[G],{x:ue,y:ce,data:fe,reset:le}=await de({x:A,y:k,initialPlacement:f,placement:_,strategy:h,middlewareData:N,rects:R,platform:v,elements:{reference:c,floating:a}});A=ue??A,k=ce??k,N={...N,[J]:{...N[J],...fe}},le&&z<=50&&(z++,typeof le=="object"&&(le.placement&&(_=le.placement),le.rects&&(R=le.rects===!0?await v.getElementRects({reference:c,floating:a,strategy:h}):le.rects),{x:A,y:k}=iC(R,_,x)),G=-1)}return{x:A,y:k,placement:_,strategy:h,middlewareData:N}};async function Cp(c,a){var l;a===void 0&&(a={});const{x:f,y:h,platform:y,rects:v,elements:C,strategy:x}=c,{boundary:R="clippingAncestors",rootBoundary:A="viewport",elementContext:k="floating",altBoundary:_=!1,padding:N=0}=Fl(a,c),z=aC(N),J=C[_?k==="floating"?"reference":"floating":k],de=Gv(await y.getClippingRect({element:(l=await(y.isElement==null?void 0:y.isElement(J)))==null||l?J:J.contextElement||await(y.getDocumentElement==null?void 0:y.getDocumentElement(C.floating)),boundary:R,rootBoundary:A,strategy:x})),ue=k==="floating"?{x:f,y:h,width:v.floating.width,height:v.floating.height}:v.reference,ce=await(y.getOffsetParent==null?void 0:y.getOffsetParent(C.floating)),fe=await(y.isElement==null?void 0:y.isElement(ce))?await(y.getScale==null?void 0:y.getScale(ce))||{x:1,y:1}:{x:1,y:1},le=Gv(y.convertOffsetParentRelativeRectToViewportRelativeRect?await y.convertOffsetParentRelativeRectToViewportRelativeRect({elements:C,rect:ue,offsetParent:ce,strategy:x}):ue);return{top:(de.top-le.top+z.top)/fe.y,bottom:(le.bottom-de.bottom+z.bottom)/fe.y,left:(de.left-le.left+z.left)/fe.x,right:(le.right-de.right+z.right)/fe.x}}const t_=c=>({name:"arrow",options:c,async fn(a){const{x:l,y:f,placement:h,rects:y,platform:v,elements:C,middlewareData:x}=a,{element:R,padding:A=0}=Fl(c,a)||{};if(R==null)return{};const k=aC(A),_={x:l,y:f},N=p0(h),z=d0(N),G=await v.getDimensions(R),J=N==="y",de=J?"top":"left",ue=J?"bottom":"right",ce=J?"clientHeight":"clientWidth",fe=y.reference[z]+y.reference[N]-_[N]-y.floating[z],le=_[N]-y.reference[N],Re=await(v.getOffsetParent==null?void 0:v.getOffsetParent(R));let ve=Re?Re[ce]:0;(!ve||!await(v.isElement==null?void 0:v.isElement(Re)))&&(ve=C.floating[ce]||y.floating[z]);const xe=fe/2-le/2,tt=ve/2-G[z]/2-1,dt=Bs(k[de],tt),Rt=Bs(k[ue],tt),lt=dt,Ae=ve-G[z]-Rt,rt=ve/2-G[z]/2+xe,st=c0(lt,rt,Ae),qe=!x.arrow&&Sf(h)!=null&&rt!==st&&y.reference[z]/2-(rt<lt?dt:Rt)-G[z]/2<0,Te=qe?rt<lt?rt-lt:rt-Ae:0;return{[N]:_[N]+Te,data:{[N]:st,centerOffset:rt-st-Te,...qe&&{alignmentOffset:Te}},reset:qe}}}),n_=function(c){return c===void 0&&(c={}),{name:"flip",options:c,async fn(a){var l,f;const{placement:h,middlewareData:y,rects:v,initialPlacement:C,platform:x,elements:R}=a,{mainAxis:A=!0,crossAxis:k=!0,fallbackPlacements:_,fallbackStrategy:N="bestFit",fallbackAxisSideDirection:z="none",flipAlignment:G=!0,...J}=Fl(c,a);if((l=y.arrow)!=null&&l.alignmentOffset)return{};const de=jl(h),ue=Go(C),ce=jl(C)===C,fe=await(x.isRTL==null?void 0:x.isRTL(R.floating)),le=_||(ce||!G?[$v(C)]:Xk(C)),Re=z!=="none";!_&&Re&&le.push(...Zk(C,G,z,fe));const ve=[C,...le],xe=await Cp(a,J),tt=[];let dt=((f=y.flip)==null?void 0:f.overflows)||[];if(A&&tt.push(xe[de]),k){const rt=Wk(h,v,fe);tt.push(xe[rt[0]],xe[rt[1]])}if(dt=[...dt,{placement:h,overflows:tt}],!tt.every(rt=>rt<=0)){var Rt,lt;const rt=(((Rt=y.flip)==null?void 0:Rt.index)||0)+1,st=ve[rt];if(st&&(!(k==="alignment"?ue!==Go(st):!1)||dt.every($=>Go($.placement)===ue?$.overflows[0]>0:!0)))return{data:{index:rt,overflows:dt},reset:{placement:st}};let qe=(lt=dt.filter(Te=>Te.overflows[0]<=0).sort((Te,$)=>Te.overflows[1]-$.overflows[1])[0])==null?void 0:lt.placement;if(!qe)switch(N){case"bestFit":{var Ae;const Te=(Ae=dt.filter($=>{if(Re){const ke=Go($.placement);return ke===ue||ke==="y"}return!0}).map($=>[$.placement,$.overflows.filter(ke=>ke>0).reduce((ke,Ce)=>ke+Ce,0)]).sort(($,ke)=>$[1]-ke[1])[0])==null?void 0:Ae[0];Te&&(qe=Te);break}case"initialPlacement":qe=C;break}if(h!==qe)return{reset:{placement:qe}}}return{}}}};function oC(c,a){return{top:c.top-a.height,right:c.right-a.width,bottom:c.bottom-a.height,left:c.left-a.width}}function lC(c){return Vk.some(a=>c[a]>=0)}const r_=function(c){return c===void 0&&(c={}),{name:"hide",options:c,async fn(a){const{rects:l}=a,{strategy:f="referenceHidden",...h}=Fl(c,a);switch(f){case"referenceHidden":{const y=await Cp(a,{...h,elementContext:"reference"}),v=oC(y,l.reference);return{data:{referenceHiddenOffsets:v,referenceHidden:lC(v)}}}case"escaped":{const y=await Cp(a,{...h,altBoundary:!0}),v=oC(y,l.floating);return{data:{escapedOffsets:v,escaped:lC(v)}}}default:return{}}}}},sC=new Set(["left","top"]);async function a_(c,a){const{placement:l,platform:f,elements:h}=c,y=await(f.isRTL==null?void 0:f.isRTL(h.floating)),v=jl(l),C=Sf(l),x=Go(l)==="y",R=sC.has(v)?-1:1,A=y&&x?-1:1,k=Fl(a,c);let{mainAxis:_,crossAxis:N,alignmentAxis:z}=typeof k=="number"?{mainAxis:k,crossAxis:0,alignmentAxis:null}:{mainAxis:k.mainAxis||0,crossAxis:k.crossAxis||0,alignmentAxis:k.alignmentAxis};return C&&typeof z=="number"&&(N=C==="end"?z*-1:z),x?{x:N*A,y:_*R}:{x:_*R,y:N*A}}const i_=function(c){return c===void 0&&(c=0),{name:"offset",options:c,async fn(a){var l,f;const{x:h,y,placement:v,middlewareData:C}=a,x=await a_(a,c);return v===((l=C.offset)==null?void 0:l.placement)&&(f=C.arrow)!=null&&f.alignmentOffset?{}:{x:h+x.x,y:y+x.y,data:{...x,placement:v}}}}},o_=function(c){return c===void 0&&(c={}),{name:"shift",options:c,async fn(a){const{x:l,y:f,placement:h}=a,{mainAxis:y=!0,crossAxis:v=!1,limiter:C={fn:J=>{let{x:de,y:ue}=J;return{x:de,y:ue}}},...x}=Fl(c,a),R={x:l,y:f},A=await Cp(a,x),k=Go(jl(h)),_=f0(k);let N=R[_],z=R[k];if(y){const J=_==="y"?"top":"left",de=_==="y"?"bottom":"right",ue=N+A[J],ce=N-A[de];N=c0(ue,N,ce)}if(v){const J=k==="y"?"top":"left",de=k==="y"?"bottom":"right",ue=z+A[J],ce=z-A[de];z=c0(ue,z,ce)}const G=C.fn({...a,[_]:N,[k]:z});return{...G,data:{x:G.x-l,y:G.y-f,enabled:{[_]:y,[k]:v}}}}}},l_=function(c){return c===void 0&&(c={}),{options:c,fn(a){const{x:l,y:f,placement:h,rects:y,middlewareData:v}=a,{offset:C=0,mainAxis:x=!0,crossAxis:R=!0}=Fl(c,a),A={x:l,y:f},k=Go(h),_=f0(k);let N=A[_],z=A[k];const G=Fl(C,a),J=typeof G=="number"?{mainAxis:G,crossAxis:0}:{mainAxis:0,crossAxis:0,...G};if(x){const ce=_==="y"?"height":"width",fe=y.reference[_]-y.floating[ce]+J.mainAxis,le=y.reference[_]+y.reference[ce]-J.mainAxis;N<fe?N=fe:N>le&&(N=le)}if(R){var de,ue;const ce=_==="y"?"width":"height",fe=sC.has(jl(h)),le=y.reference[k]-y.floating[ce]+(fe&&((de=v.offset)==null?void 0:de[k])||0)+(fe?0:J.crossAxis),Re=y.reference[k]+y.reference[ce]+(fe?0:((ue=v.offset)==null?void 0:ue[k])||0)-(fe?J.crossAxis:0);z<le?z=le:z>Re&&(z=Re)}return{[_]:N,[k]:z}}}},s_=function(c){return c===void 0&&(c={}),{name:"size",options:c,async fn(a){var l,f;const{placement:h,rects:y,platform:v,elements:C}=a,{apply:x=()=>{},...R}=Fl(c,a),A=await Cp(a,R),k=jl(h),_=Sf(h),N=Go(h)==="y",{width:z,height:G}=y.floating;let J,de;k==="top"||k==="bottom"?(J=k,de=_===(await(v.isRTL==null?void 0:v.isRTL(C.floating))?"start":"end")?"left":"right"):(de=k,J=_==="end"?"top":"bottom");const ue=G-A.top-A.bottom,ce=z-A.left-A.right,fe=Bs(G-A[J],ue),le=Bs(z-A[de],ce),Re=!a.middlewareData.shift;let ve=fe,xe=le;if((l=a.middlewareData.shift)!=null&&l.enabled.x&&(xe=ce),(f=a.middlewareData.shift)!=null&&f.enabled.y&&(ve=ue),Re&&!_){const dt=mi(A.left,0),Rt=mi(A.right,0),lt=mi(A.top,0),Ae=mi(A.bottom,0);N?xe=z-2*(dt!==0||Rt!==0?dt+Rt:mi(A.left,A.right)):ve=G-2*(lt!==0||Ae!==0?lt+Ae:mi(A.top,A.bottom))}await x({...a,availableWidth:xe,availableHeight:ve});const tt=await v.getDimensions(C.floating);return z!==tt.width||G!==tt.height?{reset:{rects:!0}}:{}}}};function Yv(){return typeof window<"u"}function wf(c){return uC(c)?(c.nodeName||"").toLowerCase():"#document"}function gi(c){var a;return(c==null||(a=c.ownerDocument)==null?void 0:a.defaultView)||window}function Yo(c){var a;return(a=(uC(c)?c.ownerDocument:c.document)||window.document)==null?void 0:a.documentElement}function uC(c){return Yv()?c instanceof Node||c instanceof gi(c).Node:!1}function ho(c){return Yv()?c instanceof Element||c instanceof gi(c).Element:!1}function Wo(c){return Yv()?c instanceof HTMLElement||c instanceof gi(c).HTMLElement:!1}function cC(c){return!Yv()||typeof ShadowRoot>"u"?!1:c instanceof ShadowRoot||c instanceof gi(c).ShadowRoot}const u_=new Set(["inline","contents"]);function Ep(c){const{overflow:a,overflowX:l,overflowY:f,display:h}=vo(c);return/auto|scroll|overlay|hidden|clip/.test(a+f+l)&&!u_.has(h)}const c_=new Set(["table","td","th"]);function f_(c){return c_.has(wf(c))}const d_=[":popover-open",":modal"];function Wv(c){return d_.some(a=>{try{return c.matches(a)}catch{return!1}})}const p_=["transform","translate","scale","rotate","perspective"],h_=["transform","translate","scale","rotate","perspective","filter"],v_=["paint","layout","strict","content"];function v0(c){const a=m0(),l=ho(c)?vo(c):c;return p_.some(f=>l[f]?l[f]!=="none":!1)||(l.containerType?l.containerType!=="normal":!1)||!a&&(l.backdropFilter?l.backdropFilter!=="none":!1)||!a&&(l.filter?l.filter!=="none":!1)||h_.some(f=>(l.willChange||"").includes(f))||v_.some(f=>(l.contain||"").includes(f))}function m_(c){let a=Hs(c);for(;Wo(a)&&!bf(a);){if(v0(a))return a;if(Wv(a))return null;a=Hs(a)}return null}function m0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const g_=new Set(["html","body","#document"]);function bf(c){return g_.has(wf(c))}function vo(c){return gi(c).getComputedStyle(c)}function Xv(c){return ho(c)?{scrollLeft:c.scrollLeft,scrollTop:c.scrollTop}:{scrollLeft:c.scrollX,scrollTop:c.scrollY}}function Hs(c){if(wf(c)==="html")return c;const a=c.assignedSlot||c.parentNode||cC(c)&&c.host||Yo(c);return cC(a)?a.host:a}function fC(c){const a=Hs(c);return bf(a)?c.ownerDocument?c.ownerDocument.body:c.body:Wo(a)&&Ep(a)?a:fC(a)}function Tp(c,a,l){var f;a===void 0&&(a=[]),l===void 0&&(l=!0);const h=fC(c),y=h===((f=c.ownerDocument)==null?void 0:f.body),v=gi(h);if(y){const C=g0(v);return a.concat(v,v.visualViewport||[],Ep(h)?h:[],C&&l?Tp(C):[])}return a.concat(h,Tp(h,[],l))}function g0(c){return c.parent&&Object.getPrototypeOf(c.parent)?c.frameElement:null}function dC(c){const a=vo(c);let l=parseFloat(a.width)||0,f=parseFloat(a.height)||0;const h=Wo(c),y=h?c.offsetWidth:l,v=h?c.offsetHeight:f,C=Hv(l)!==y||Hv(f)!==v;return C&&(l=y,f=v),{width:l,height:f,$:C}}function y0(c){return ho(c)?c:c.contextElement}function xf(c){const a=y0(c);if(!Wo(a))return $o(1);const l=a.getBoundingClientRect(),{width:f,height:h,$:y}=dC(a);let v=(y?Hv(l.width):l.width)/f,C=(y?Hv(l.height):l.height)/h;return(!v||!Number.isFinite(v))&&(v=1),(!C||!Number.isFinite(C))&&(C=1),{x:v,y:C}}const y_=$o(0);function pC(c){const a=gi(c);return!m0()||!a.visualViewport?y_:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function S_(c,a,l){return a===void 0&&(a=!1),!l||a&&l!==gi(c)?!1:a}function $u(c,a,l,f){a===void 0&&(a=!1),l===void 0&&(l=!1);const h=c.getBoundingClientRect(),y=y0(c);let v=$o(1);a&&(f?ho(f)&&(v=xf(f)):v=xf(c));const C=S_(y,l,f)?pC(y):$o(0);let x=(h.left+C.x)/v.x,R=(h.top+C.y)/v.y,A=h.width/v.x,k=h.height/v.y;if(y){const _=gi(y),N=f&&ho(f)?gi(f):f;let z=_,G=g0(z);for(;G&&f&&N!==z;){const J=xf(G),de=G.getBoundingClientRect(),ue=vo(G),ce=de.left+(G.clientLeft+parseFloat(ue.paddingLeft))*J.x,fe=de.top+(G.clientTop+parseFloat(ue.paddingTop))*J.y;x*=J.x,R*=J.y,A*=J.x,k*=J.y,x+=ce,R+=fe,z=gi(G),G=g0(z)}}return Gv({width:A,height:k,x,y:R})}function S0(c,a){const l=Xv(c).scrollLeft;return a?a.left+l:$u(Yo(c)).left+l}function hC(c,a,l){l===void 0&&(l=!1);const f=c.getBoundingClientRect(),h=f.left+a.scrollLeft-(l?0:S0(c,f)),y=f.top+a.scrollTop;return{x:h,y}}function w_(c){let{elements:a,rect:l,offsetParent:f,strategy:h}=c;const y=h==="fixed",v=Yo(f),C=a?Wv(a.floating):!1;if(f===v||C&&y)return l;let x={scrollLeft:0,scrollTop:0},R=$o(1);const A=$o(0),k=Wo(f);if((k||!k&&!y)&&((wf(f)!=="body"||Ep(v))&&(x=Xv(f)),Wo(f))){const N=$u(f);R=xf(f),A.x=N.x+f.clientLeft,A.y=N.y+f.clientTop}const _=v&&!k&&!y?hC(v,x,!0):$o(0);return{width:l.width*R.x,height:l.height*R.y,x:l.x*R.x-x.scrollLeft*R.x+A.x+_.x,y:l.y*R.y-x.scrollTop*R.y+A.y+_.y}}function b_(c){return Array.from(c.getClientRects())}function x_(c){const a=Yo(c),l=Xv(c),f=c.ownerDocument.body,h=mi(a.scrollWidth,a.clientWidth,f.scrollWidth,f.clientWidth),y=mi(a.scrollHeight,a.clientHeight,f.scrollHeight,f.clientHeight);let v=-l.scrollLeft+S0(c);const C=-l.scrollTop;return vo(f).direction==="rtl"&&(v+=mi(a.clientWidth,f.clientWidth)-h),{width:h,height:y,x:v,y:C}}function C_(c,a){const l=gi(c),f=Yo(c),h=l.visualViewport;let y=f.clientWidth,v=f.clientHeight,C=0,x=0;if(h){y=h.width,v=h.height;const R=m0();(!R||R&&a==="fixed")&&(C=h.offsetLeft,x=h.offsetTop)}return{width:y,height:v,x:C,y:x}}const E_=new Set(["absolute","fixed"]);function T_(c,a){const l=$u(c,!0,a==="fixed"),f=l.top+c.clientTop,h=l.left+c.clientLeft,y=Wo(c)?xf(c):$o(1),v=c.clientWidth*y.x,C=c.clientHeight*y.y,x=h*y.x,R=f*y.y;return{width:v,height:C,x,y:R}}function vC(c,a,l){let f;if(a==="viewport")f=C_(c,l);else if(a==="document")f=x_(Yo(c));else if(ho(a))f=T_(a,l);else{const h=pC(c);f={x:a.x-h.x,y:a.y-h.y,width:a.width,height:a.height}}return Gv(f)}function mC(c,a){const l=Hs(c);return l===a||!ho(l)||bf(l)?!1:vo(l).position==="fixed"||mC(l,a)}function R_(c,a){const l=a.get(c);if(l)return l;let f=Tp(c,[],!1).filter(C=>ho(C)&&wf(C)!=="body"),h=null;const y=vo(c).position==="fixed";let v=y?Hs(c):c;for(;ho(v)&&!bf(v);){const C=vo(v),x=v0(v);!x&&C.position==="fixed"&&(h=null),(y?!x&&!h:!x&&C.position==="static"&&!!h&&E_.has(h.position)||Ep(v)&&!x&&mC(c,v))?f=f.filter(A=>A!==v):h=C,v=Hs(v)}return a.set(c,f),f}function M_(c){let{element:a,boundary:l,rootBoundary:f,strategy:h}=c;const v=[...l==="clippingAncestors"?Wv(a)?[]:R_(a,this._c):[].concat(l),f],C=v[0],x=v.reduce((R,A)=>{const k=vC(a,A,h);return R.top=mi(k.top,R.top),R.right=Bs(k.right,R.right),R.bottom=Bs(k.bottom,R.bottom),R.left=mi(k.left,R.left),R},vC(a,C,h));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function k_(c){const{width:a,height:l}=dC(c);return{width:a,height:l}}function __(c,a,l){const f=Wo(a),h=Yo(a),y=l==="fixed",v=$u(c,!0,y,a);let C={scrollLeft:0,scrollTop:0};const x=$o(0);function R(){x.x=S0(h)}if(f||!f&&!y)if((wf(a)!=="body"||Ep(h))&&(C=Xv(a)),f){const N=$u(a,!0,y,a);x.x=N.x+a.clientLeft,x.y=N.y+a.clientTop}else h&&R();y&&!f&&h&&R();const A=h&&!f&&!y?hC(h,C):$o(0),k=v.left+C.scrollLeft-x.x-A.x,_=v.top+C.scrollTop-x.y-A.y;return{x:k,y:_,width:v.width,height:v.height}}function w0(c){return vo(c).position==="static"}function gC(c,a){if(!Wo(c)||vo(c).position==="fixed")return null;if(a)return a(c);let l=c.offsetParent;return Yo(c)===l&&(l=l.ownerDocument.body),l}function yC(c,a){const l=gi(c);if(Wv(c))return l;if(!Wo(c)){let h=Hs(c);for(;h&&!bf(h);){if(ho(h)&&!w0(h))return h;h=Hs(h)}return l}let f=gC(c,a);for(;f&&f_(f)&&w0(f);)f=gC(f,a);return f&&bf(f)&&w0(f)&&!v0(f)?l:f||m_(c)||l}const A_=async function(c){const a=this.getOffsetParent||yC,l=this.getDimensions,f=await l(c.floating);return{reference:__(c.reference,await a(c.floating),c.strategy),floating:{x:0,y:0,width:f.width,height:f.height}}};function O_(c){return vo(c).direction==="rtl"}const N_={convertOffsetParentRelativeRectToViewportRelativeRect:w_,getDocumentElement:Yo,getClippingRect:M_,getOffsetParent:yC,getElementRects:A_,getClientRects:b_,getDimensions:k_,getScale:xf,isElement:ho,isRTL:O_};function SC(c,a){return c.x===a.x&&c.y===a.y&&c.width===a.width&&c.height===a.height}function D_(c,a){let l=null,f;const h=Yo(c);function y(){var C;clearTimeout(f),(C=l)==null||C.disconnect(),l=null}function v(C,x){C===void 0&&(C=!1),x===void 0&&(x=1),y();const R=c.getBoundingClientRect(),{left:A,top:k,width:_,height:N}=R;if(C||a(),!_||!N)return;const z=Vv(k),G=Vv(h.clientWidth-(A+_)),J=Vv(h.clientHeight-(k+N)),de=Vv(A),ce={rootMargin:-z+"px "+-G+"px "+-J+"px "+-de+"px",threshold:mi(0,Bs(1,x))||1};let fe=!0;function le(Re){const ve=Re[0].intersectionRatio;if(ve!==x){if(!fe)return v();ve?v(!1,ve):f=setTimeout(()=>{v(!1,1e-7)},1e3)}ve===1&&!SC(R,c.getBoundingClientRect())&&v(),fe=!1}try{l=new IntersectionObserver(le,{...ce,root:h.ownerDocument})}catch{l=new IntersectionObserver(le,ce)}l.observe(c)}return v(!0),y}function L_(c,a,l,f){f===void 0&&(f={});const{ancestorScroll:h=!0,ancestorResize:y=!0,elementResize:v=typeof ResizeObserver=="function",layoutShift:C=typeof IntersectionObserver=="function",animationFrame:x=!1}=f,R=y0(c),A=h||y?[...R?Tp(R):[],...Tp(a)]:[];A.forEach(de=>{h&&de.addEventListener("scroll",l,{passive:!0}),y&&de.addEventListener("resize",l)});const k=R&&C?D_(R,l):null;let _=-1,N=null;v&&(N=new ResizeObserver(de=>{let[ue]=de;ue&&ue.target===R&&N&&(N.unobserve(a),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var ce;(ce=N)==null||ce.observe(a)})),l()}),R&&!x&&N.observe(R),N.observe(a));let z,G=x?$u(c):null;x&&J();function J(){const de=$u(c);G&&!SC(G,de)&&l(),G=de,z=requestAnimationFrame(J)}return l(),()=>{var de;A.forEach(ue=>{h&&ue.removeEventListener("scroll",l),y&&ue.removeEventListener("resize",l)}),k?.(),(de=N)==null||de.disconnect(),N=null,x&&cancelAnimationFrame(z)}}const P_=i_,I_=o_,U_=n_,z_=s_,F_=r_,wC=t_,j_=l_,B_=(c,a,l)=>{const f=new Map,h={platform:N_,...l},y={...h.platform,_c:f};return e_(c,a,{...h,platform:y})};var H_=typeof document<"u",V_=function(){},Kv=H_?Q.useLayoutEffect:V_;function Qv(c,a){if(c===a)return!0;if(typeof c!=typeof a)return!1;if(typeof c=="function"&&c.toString()===a.toString())return!0;let l,f,h;if(c&&a&&typeof c=="object"){if(Array.isArray(c)){if(l=c.length,l!==a.length)return!1;for(f=l;f--!==0;)if(!Qv(c[f],a[f]))return!1;return!0}if(h=Object.keys(c),l=h.length,l!==Object.keys(a).length)return!1;for(f=l;f--!==0;)if(!{}.hasOwnProperty.call(a,h[f]))return!1;for(f=l;f--!==0;){const y=h[f];if(!(y==="_owner"&&c.$$typeof)&&!Qv(c[y],a[y]))return!1}return!0}return c!==c&&a!==a}function bC(c){return typeof window>"u"?1:(c.ownerDocument.defaultView||window).devicePixelRatio||1}function xC(c,a){const l=bC(c);return Math.round(a*l)/l}function b0(c){const a=Q.useRef(c);return Kv(()=>{a.current=c}),a}function $_(c){c===void 0&&(c={});const{placement:a="bottom",strategy:l="absolute",middleware:f=[],platform:h,elements:{reference:y,floating:v}={},transform:C=!0,whileElementsMounted:x,open:R}=c,[A,k]=Q.useState({x:0,y:0,strategy:l,placement:a,middlewareData:{},isPositioned:!1}),[_,N]=Q.useState(f);Qv(_,f)||N(f);const[z,G]=Q.useState(null),[J,de]=Q.useState(null),ue=Q.useCallback($=>{$!==Re.current&&(Re.current=$,G($))},[]),ce=Q.useCallback($=>{$!==ve.current&&(ve.current=$,de($))},[]),fe=y||z,le=v||J,Re=Q.useRef(null),ve=Q.useRef(null),xe=Q.useRef(A),tt=x!=null,dt=b0(x),Rt=b0(h),lt=b0(R),Ae=Q.useCallback(()=>{if(!Re.current||!ve.current)return;const $={placement:a,strategy:l,middleware:_};Rt.current&&($.platform=Rt.current),B_(Re.current,ve.current,$).then(ke=>{const Ce={...ke,isPositioned:lt.current!==!1};rt.current&&!Qv(xe.current,Ce)&&(xe.current=Ce,Zy.flushSync(()=>{k(Ce)}))})},[_,a,l,Rt,lt]);Kv(()=>{R===!1&&xe.current.isPositioned&&(xe.current.isPositioned=!1,k($=>({...$,isPositioned:!1})))},[R]);const rt=Q.useRef(!1);Kv(()=>(rt.current=!0,()=>{rt.current=!1}),[]),Kv(()=>{if(fe&&(Re.current=fe),le&&(ve.current=le),fe&&le){if(dt.current)return dt.current(fe,le,Ae);Ae()}},[fe,le,Ae,dt,tt]);const st=Q.useMemo(()=>({reference:Re,floating:ve,setReference:ue,setFloating:ce}),[ue,ce]),qe=Q.useMemo(()=>({reference:fe,floating:le}),[fe,le]),Te=Q.useMemo(()=>{const $={position:l,left:0,top:0};if(!qe.floating)return $;const ke=xC(qe.floating,A.x),Ce=xC(qe.floating,A.y);return C?{...$,transform:"translate("+ke+"px, "+Ce+"px)",...bC(qe.floating)>=1.5&&{willChange:"transform"}}:{position:l,left:ke,top:Ce}},[l,C,qe.floating,A.x,A.y]);return Q.useMemo(()=>({...A,update:Ae,refs:st,elements:qe,floatingStyles:Te}),[A,Ae,st,qe,Te])}const G_=c=>{function a(l){return{}.hasOwnProperty.call(l,"current")}return{name:"arrow",options:c,fn(l){const{element:f,padding:h}=typeof c=="function"?c(l):c;return f&&a(f)?f.current!=null?wC({element:f.current,padding:h}).fn(l):{}:f?wC({element:f,padding:h}).fn(l):{}}}},Y_=(c,a)=>({...P_(c),options:[c,a]}),W_=(c,a)=>({...I_(c),options:[c,a]}),X_=(c,a)=>({...j_(c),options:[c,a]}),K_=(c,a)=>({...U_(c),options:[c,a]}),Q_=(c,a)=>({...z_(c),options:[c,a]}),q_=(c,a)=>({...F_(c),options:[c,a]}),Z_=(c,a)=>({...G_(c),options:[c,a]});var J_="Arrow",CC=Q.forwardRef((c,a)=>{const{children:l,width:f=10,height:h=5,...y}=c;return I.jsx(Hu.svg,{...y,ref:a,width:f,height:h,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:c.asChild?l:I.jsx("polygon",{points:"0,0 30,0 15,10"})})});CC.displayName=J_;var eA=CC;function tA(c){const[a,l]=Q.useState(void 0);return Vu(()=>{if(c){l({width:c.offsetWidth,height:c.offsetHeight});const f=new ResizeObserver(h=>{if(!Array.isArray(h)||!h.length)return;const y=h[0];let v,C;if("borderBoxSize"in y){const x=y.borderBoxSize,R=Array.isArray(x)?x[0]:x;v=R.inlineSize,C=R.blockSize}else v=c.offsetWidth,C=c.offsetHeight;l({width:v,height:C})});return f.observe(c,{box:"border-box"}),()=>f.unobserve(c)}else l(void 0)},[c]),a}var x0="Popper",[EC,TC]=Qx(x0),[nA,RC]=EC(x0),MC=c=>{const{__scopePopper:a,children:l}=c,[f,h]=Q.useState(null);return I.jsx(nA,{scope:a,anchor:f,onAnchorChange:h,children:l})};MC.displayName=x0;var kC="PopperAnchor",_C=Q.forwardRef((c,a)=>{const{__scopePopper:l,virtualRef:f,...h}=c,y=RC(kC,l),v=Q.useRef(null),C=ju(a,v);return Q.useEffect(()=>{y.onAnchorChange(f?.current||v.current)}),f?null:I.jsx(Hu.div,{...h,ref:C})});_C.displayName=kC;var C0="PopperContent",[rA,aA]=EC(C0),AC=Q.forwardRef((c,a)=>{const{__scopePopper:l,side:f="bottom",sideOffset:h=0,align:y="center",alignOffset:v=0,arrowPadding:C=0,avoidCollisions:x=!0,collisionBoundary:R=[],collisionPadding:A=0,sticky:k="partial",hideWhenDetached:_=!1,updatePositionStrategy:N="optimized",onPlaced:z,...G}=c,J=RC(C0,l),[de,ue]=Q.useState(null),ce=ju(a,Ve=>ue(Ve)),[fe,le]=Q.useState(null),Re=tA(fe),ve=Re?.width??0,xe=Re?.height??0,tt=f+(y!=="center"?"-"+y:""),dt=typeof A=="number"?A:{top:0,right:0,bottom:0,left:0,...A},Rt=Array.isArray(R)?R:[R],lt=Rt.length>0,Ae={padding:dt,boundary:Rt.filter(oA),altBoundary:lt},{refs:rt,floatingStyles:st,placement:qe,isPositioned:Te,middlewareData:$}=$_({strategy:"fixed",placement:tt,whileElementsMounted:(...Ve)=>L_(...Ve,{animationFrame:N==="always"}),elements:{reference:J.anchor},middleware:[Y_({mainAxis:h+xe,alignmentAxis:v}),x&&W_({mainAxis:!0,crossAxis:!1,limiter:k==="partial"?X_():void 0,...Ae}),x&&K_({...Ae}),Q_({...Ae,apply:({elements:Ve,rects:St,availableWidth:wt,availableHeight:$t})=>{const{width:gn,height:Un}=St.reference,yn=Ve.floating.style;yn.setProperty("--radix-popper-available-width",`${wt}px`),yn.setProperty("--radix-popper-available-height",`${$t}px`),yn.setProperty("--radix-popper-anchor-width",`${gn}px`),yn.setProperty("--radix-popper-anchor-height",`${Un}px`)}}),fe&&Z_({element:fe,padding:C}),lA({arrowWidth:ve,arrowHeight:xe}),_&&q_({strategy:"referenceHidden",...Ae})]}),[ke,Ce]=DC(qe),V=Bv(z);Vu(()=>{Te&&V?.()},[Te,V]);const oe=$.arrow?.x,Be=$.arrow?.y,He=$.arrow?.centerOffset!==0,[yt,xt]=Q.useState();return Vu(()=>{de&&xt(window.getComputedStyle(de).zIndex)},[de]),I.jsx("div",{ref:rt.setFloating,"data-radix-popper-content-wrapper":"",style:{...st,transform:Te?st.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:yt,"--radix-popper-transform-origin":[$.transformOrigin?.x,$.transformOrigin?.y].join(" "),...$.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:c.dir,children:I.jsx(rA,{scope:l,placedSide:ke,onArrowChange:le,arrowX:oe,arrowY:Be,shouldHideArrow:He,children:I.jsx(Hu.div,{"data-side":ke,"data-align":Ce,...G,ref:ce,style:{...G.style,animation:Te?void 0:"none"}})})})});AC.displayName=C0;var OC="PopperArrow",iA={top:"bottom",right:"left",bottom:"top",left:"right"},NC=Q.forwardRef(function(a,l){const{__scopePopper:f,...h}=a,y=aA(OC,f),v=iA[y.placedSide];return I.jsx("span",{ref:y.onArrowChange,style:{position:"absolute",left:y.arrowX,top:y.arrowY,[v]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[y.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[y.placedSide],visibility:y.shouldHideArrow?"hidden":void 0},children:I.jsx(eA,{...h,ref:l,style:{...h.style,display:"block"}})})});NC.displayName=OC;function oA(c){return c!==null}var lA=c=>({name:"transformOrigin",options:c,fn(a){const{placement:l,rects:f,middlewareData:h}=a,v=h.arrow?.centerOffset!==0,C=v?0:c.arrowWidth,x=v?0:c.arrowHeight,[R,A]=DC(l),k={start:"0%",center:"50%",end:"100%"}[A],_=(h.arrow?.x??0)+C/2,N=(h.arrow?.y??0)+x/2;let z="",G="";return R==="bottom"?(z=v?k:`${_}px`,G=`${-x}px`):R==="top"?(z=v?k:`${_}px`,G=`${f.floating.height+x}px`):R==="right"?(z=`${-x}px`,G=v?k:`${N}px`):R==="left"&&(z=`${f.floating.width+x}px`,G=v?k:`${N}px`),{data:{x:z,y:G}}}});function DC(c){const[a,l="center"]=c.split("-");return[a,l]}var sA=MC,uA=_C,cA=AC,fA=NC;function dA(c,a){return Q.useReducer((l,f)=>a[l][f]??l,c)}var LC=c=>{const{present:a,children:l}=c,f=pA(a),h=typeof l=="function"?l({present:f.isPresent}):Q.Children.only(l),y=ju(f.ref,hA(h));return typeof l=="function"||f.isPresent?Q.cloneElement(h,{ref:y}):null};LC.displayName="Presence";function pA(c){const[a,l]=Q.useState(),f=Q.useRef(null),h=Q.useRef(c),y=Q.useRef("none"),v=c?"mounted":"unmounted",[C,x]=dA(v,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Q.useEffect(()=>{const R=qv(f.current);y.current=C==="mounted"?R:"none"},[C]),Vu(()=>{const R=f.current,A=h.current;if(A!==c){const _=y.current,N=qv(R);c?x("MOUNT"):N==="none"||R?.display==="none"?x("UNMOUNT"):x(A&&_!==N?"ANIMATION_OUT":"UNMOUNT"),h.current=c}},[c,x]),Vu(()=>{if(a){let R;const A=a.ownerDocument.defaultView??window,k=N=>{const G=qv(f.current).includes(N.animationName);if(N.target===a&&G&&(x("ANIMATION_END"),!h.current)){const J=a.style.animationFillMode;a.style.animationFillMode="forwards",R=A.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=J)})}},_=N=>{N.target===a&&(y.current=qv(f.current))};return a.addEventListener("animationstart",_),a.addEventListener("animationcancel",k),a.addEventListener("animationend",k),()=>{A.clearTimeout(R),a.removeEventListener("animationstart",_),a.removeEventListener("animationcancel",k),a.removeEventListener("animationend",k)}}else x("ANIMATION_END")},[a,x]),{isPresent:["mounted","unmountSuspended"].includes(C),ref:Q.useCallback(R=>{f.current=R?getComputedStyle(R):null,l(R)},[])}}function qv(c){return c?.animationName||"none"}function hA(c){let a=Object.getOwnPropertyDescriptor(c.props,"ref")?.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?c.ref:(a=Object.getOwnPropertyDescriptor(c,"ref")?.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?c.props.ref:c.props.ref||c.ref)}var vA=ax[" useInsertionEffect ".trim().toString()]||Vu;function mA({prop:c,defaultProp:a,onChange:l=()=>{},caller:f}){const[h,y,v]=gA({defaultProp:a,onChange:l}),C=c!==void 0,x=C?c:h;{const A=Q.useRef(c!==void 0);Q.useEffect(()=>{const k=A.current;k!==C&&console.warn(`${f} is changing from ${k?"controlled":"uncontrolled"} to ${C?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),A.current=C},[C,f])}const R=Q.useCallback(A=>{if(C){const k=yA(A)?A(c):A;k!==c&&v.current?.(k)}else y(A)},[C,c,y,v]);return[x,R]}function gA({defaultProp:c,onChange:a}){const[l,f]=Q.useState(c),h=Q.useRef(l),y=Q.useRef(a);return vA(()=>{y.current=a},[a]),Q.useEffect(()=>{h.current!==l&&(y.current?.(l),h.current=l)},[l,h]),[l,f,y]}function yA(c){return typeof c=="function"}var SA=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),wA="VisuallyHidden",PC=Q.forwardRef((c,a)=>I.jsx(Hu.span,{...c,ref:a,style:{...SA,...c.style}}));PC.displayName=wA;var bA=PC,[Zv,o3]=Qx("Tooltip",[TC]),Jv=TC(),IC="TooltipProvider",xA=700,E0="tooltip.open",[CA,T0]=Zv(IC),em=c=>{const{__scopeTooltip:a,delayDuration:l=xA,skipDelayDuration:f=300,disableHoverableContent:h=!1,children:y}=c,v=Q.useRef(!0),C=Q.useRef(!1),x=Q.useRef(0);return Q.useEffect(()=>{const R=x.current;return()=>window.clearTimeout(R)},[]),I.jsx(CA,{scope:a,isOpenDelayedRef:v,delayDuration:l,onOpen:Q.useCallback(()=>{window.clearTimeout(x.current),v.current=!1},[]),onClose:Q.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>v.current=!0,f)},[f]),isPointerInTransitRef:C,onPointerInTransitChange:Q.useCallback(R=>{C.current=R},[]),disableHoverableContent:h,children:y})};em.displayName=IC;var Rp="Tooltip",[EA,tm]=Zv(Rp),UC=c=>{const{__scopeTooltip:a,children:l,open:f,defaultOpen:h,onOpenChange:y,disableHoverableContent:v,delayDuration:C}=c,x=T0(Rp,c.__scopeTooltip),R=Jv(a),[A,k]=Q.useState(null),_=Hk(),N=Q.useRef(0),z=v??x.disableHoverableContent,G=C??x.delayDuration,J=Q.useRef(!1),[de,ue]=mA({prop:f,defaultProp:h??!1,onChange:ve=>{ve?(x.onOpen(),document.dispatchEvent(new CustomEvent(E0))):x.onClose(),y?.(ve)},caller:Rp}),ce=Q.useMemo(()=>de?J.current?"delayed-open":"instant-open":"closed",[de]),fe=Q.useCallback(()=>{window.clearTimeout(N.current),N.current=0,J.current=!1,ue(!0)},[ue]),le=Q.useCallback(()=>{window.clearTimeout(N.current),N.current=0,ue(!1)},[ue]),Re=Q.useCallback(()=>{window.clearTimeout(N.current),N.current=window.setTimeout(()=>{J.current=!0,ue(!0),N.current=0},G)},[G,ue]);return Q.useEffect(()=>()=>{N.current&&(window.clearTimeout(N.current),N.current=0)},[]),I.jsx(sA,{...R,children:I.jsx(EA,{scope:a,contentId:_,open:de,stateAttribute:ce,trigger:A,onTriggerChange:k,onTriggerEnter:Q.useCallback(()=>{x.isOpenDelayedRef.current?Re():fe()},[x.isOpenDelayedRef,Re,fe]),onTriggerLeave:Q.useCallback(()=>{z?le():(window.clearTimeout(N.current),N.current=0)},[le,z]),onOpen:fe,onClose:le,disableHoverableContent:z,children:l})})};UC.displayName=Rp;var R0="TooltipTrigger",zC=Q.forwardRef((c,a)=>{const{__scopeTooltip:l,...f}=c,h=tm(R0,l),y=T0(R0,l),v=Jv(l),C=Q.useRef(null),x=ju(a,C,h.onTriggerChange),R=Q.useRef(!1),A=Q.useRef(!1),k=Q.useCallback(()=>R.current=!1,[]);return Q.useEffect(()=>()=>document.removeEventListener("pointerup",k),[k]),I.jsx(uA,{asChild:!0,...v,children:I.jsx(Hu.button,{"aria-describedby":h.open?h.contentId:void 0,"data-state":h.stateAttribute,...f,ref:x,onPointerMove:zl(c.onPointerMove,_=>{_.pointerType!=="touch"&&!A.current&&!y.isPointerInTransitRef.current&&(h.onTriggerEnter(),A.current=!0)}),onPointerLeave:zl(c.onPointerLeave,()=>{h.onTriggerLeave(),A.current=!1}),onPointerDown:zl(c.onPointerDown,()=>{h.open&&h.onClose(),R.current=!0,document.addEventListener("pointerup",k,{once:!0})}),onFocus:zl(c.onFocus,()=>{R.current||h.onOpen()}),onBlur:zl(c.onBlur,h.onClose),onClick:zl(c.onClick,h.onClose)})})});zC.displayName=R0;var TA="TooltipPortal",[l3,RA]=Zv(TA,{forceMount:void 0}),Cf="TooltipContent",FC=Q.forwardRef((c,a)=>{const l=RA(Cf,c.__scopeTooltip),{forceMount:f=l.forceMount,side:h="top",...y}=c,v=tm(Cf,c.__scopeTooltip);return I.jsx(LC,{present:f||v.open,children:v.disableHoverableContent?I.jsx(jC,{side:h,...y,ref:a}):I.jsx(MA,{side:h,...y,ref:a})})}),MA=Q.forwardRef((c,a)=>{const l=tm(Cf,c.__scopeTooltip),f=T0(Cf,c.__scopeTooltip),h=Q.useRef(null),y=ju(a,h),[v,C]=Q.useState(null),{trigger:x,onClose:R}=l,A=h.current,{onPointerInTransitChange:k}=f,_=Q.useCallback(()=>{C(null),k(!1)},[k]),N=Q.useCallback((z,G)=>{const J=z.currentTarget,de={x:z.clientX,y:z.clientY},ue=NA(de,J.getBoundingClientRect()),ce=DA(de,ue),fe=LA(G.getBoundingClientRect()),le=IA([...ce,...fe]);C(le),k(!0)},[k]);return Q.useEffect(()=>()=>_(),[_]),Q.useEffect(()=>{if(x&&A){const z=J=>N(J,A),G=J=>N(J,x);return x.addEventListener("pointerleave",z),A.addEventListener("pointerleave",G),()=>{x.removeEventListener("pointerleave",z),A.removeEventListener("pointerleave",G)}}},[x,A,N,_]),Q.useEffect(()=>{if(v){const z=G=>{const J=G.target,de={x:G.clientX,y:G.clientY},ue=x?.contains(J)||A?.contains(J),ce=!PA(de,v);ue?_():ce&&(_(),R())};return document.addEventListener("pointermove",z),()=>document.removeEventListener("pointermove",z)}},[x,A,v,R,_]),I.jsx(jC,{...c,ref:y})}),[kA,_A]=Zv(Rp,{isInside:!1}),AA=DM("TooltipContent"),jC=Q.forwardRef((c,a)=>{const{__scopeTooltip:l,children:f,"aria-label":h,onEscapeKeyDown:y,onPointerDownOutside:v,...C}=c,x=tm(Cf,l),R=Jv(l),{onClose:A}=x;return Q.useEffect(()=>(document.addEventListener(E0,A),()=>document.removeEventListener(E0,A)),[A]),Q.useEffect(()=>{if(x.trigger){const k=_=>{_.target?.contains(x.trigger)&&A()};return window.addEventListener("scroll",k,{capture:!0}),()=>window.removeEventListener("scroll",k,{capture:!0})}},[x.trigger,A]),I.jsx(Jx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:y,onPointerDownOutside:v,onFocusOutside:k=>k.preventDefault(),onDismiss:A,children:I.jsxs(cA,{"data-state":x.stateAttribute,...R,...C,ref:a,style:{...C.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[I.jsx(AA,{children:f}),I.jsx(kA,{scope:l,isInside:!0,children:I.jsx(bA,{id:x.contentId,role:"tooltip",children:h||f})})]})})});FC.displayName=Cf;var BC="TooltipArrow",OA=Q.forwardRef((c,a)=>{const{__scopeTooltip:l,...f}=c,h=Jv(l);return _A(BC,l).isInside?null:I.jsx(fA,{...h,...f,ref:a})});OA.displayName=BC;function NA(c,a){const l=Math.abs(a.top-c.y),f=Math.abs(a.bottom-c.y),h=Math.abs(a.right-c.x),y=Math.abs(a.left-c.x);switch(Math.min(l,f,h,y)){case y:return"left";case h:return"right";case l:return"top";case f:return"bottom";default:throw new Error("unreachable")}}function DA(c,a,l=5){const f=[];switch(a){case"top":f.push({x:c.x-l,y:c.y+l},{x:c.x+l,y:c.y+l});break;case"bottom":f.push({x:c.x-l,y:c.y-l},{x:c.x+l,y:c.y-l});break;case"left":f.push({x:c.x+l,y:c.y-l},{x:c.x+l,y:c.y+l});break;case"right":f.push({x:c.x-l,y:c.y-l},{x:c.x-l,y:c.y+l});break}return f}function LA(c){const{top:a,right:l,bottom:f,left:h}=c;return[{x:h,y:a},{x:l,y:a},{x:l,y:f},{x:h,y:f}]}function PA(c,a){const{x:l,y:f}=c;let h=!1;for(let y=0,v=a.length-1;y<a.length;v=y++){const C=a[y],x=a[v],R=C.x,A=C.y,k=x.x,_=x.y;A>f!=_>f&&l<(k-R)*(f-A)/(_-A)+R&&(h=!h)}return h}function IA(c){const a=c.slice();return a.sort((l,f)=>l.x<f.x?-1:l.x>f.x?1:l.y<f.y?-1:l.y>f.y?1:0),UA(a)}function UA(c){if(c.length<=1)return c.slice();const a=[];for(let f=0;f<c.length;f++){const h=c[f];for(;a.length>=2;){const y=a[a.length-1],v=a[a.length-2];if((y.x-v.x)*(h.y-v.y)>=(y.y-v.y)*(h.x-v.x))a.pop();else break}a.push(h)}a.pop();const l=[];for(let f=c.length-1;f>=0;f--){const h=c[f];for(;l.length>=2;){const y=l[l.length-1],v=l[l.length-2];if((y.x-v.x)*(h.y-v.y)>=(y.y-v.y)*(h.x-v.x))l.pop();else break}l.push(h)}return l.pop(),a.length===1&&l.length===1&&a[0].x===l[0].x&&a[0].y===l[0].y?a:a.concat(l)}var zA=em,FA=UC,jA=zC,HC=FC;const BA=zA,M0=FA,k0=jA,nm=Q.forwardRef(({className:c,sideOffset:a=4,...l},f)=>I.jsx(HC,{ref:f,sideOffset:a,className:Hx("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",c),...l}));nm.displayName=HC.displayName;const HA=()=>{const{setState:c,setMenuType:a}=Ft(),{isFullscreen:l,toggleFullscreen:f}=bp(),h=Q.useRef(null),y=()=>{a(Pt.COUNTDOWN),c(ot.COUNTDOWN),setTimeout(()=>{c(ot.PLAYING)},3e3)},v=()=>{a(Pt.SETTINGS)},C=()=>{const x=h.current?.closest("sigurd-startup");x?f(x):f()};return I.jsxs("div",{className:"flex flex-col items-center justify-center h-full rounded-lg",children:[I.jsx(BA,{children:I.jsxs(M0,{children:[I.jsx(k0,{asChild:!0,children:I.jsx(vi,{onClick:C,variant:"outline",className:"absolute top-4 right-4 bg-background-80 text-foreground backdrop-blur-sm border-none hover:bg-primary hover:text-black h-10 w-10",children:l?I.jsx(Xx,{className:"text-foreground hover:text-primary",size:24}):I.jsx(Wx,{className:"text-foreground hover:text-primary",size:24})})}),I.jsx(nm,{children:l?"Avslutt fullskjerm (F11 eller F)":"Fullskjerm (F11 eller F)"})]})}),I.jsxs("div",{className:"text-center mb-8",children:[I.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"Sigurd Startup"}),I.jsx("p",{className:"text-muted-foreground",children:"Samle så mye finansiering som mulig!"})]}),I.jsxs("div",{className:"space-y-4 w-[70%]",children:[I.jsxs(vi,{onClick:y,className:"w-full bg-primary hover:bg-primary-80 text-white font-bold py-3 text-lg transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(s0,{size:20}),"Start"]}),I.jsxs(vi,{onClick:v,variant:"outline",className:"w-full border-secondary text-muted-foreground hover:bg-secondary hover:text-white font-bold py-3 text-lg transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(Kx,{size:20}),"Innstillinger"]})]})]})},VA=()=>{const[c,a]=Q.useState(3),{currentMap:l}=Ft();return Q.useEffect(()=>{{const f=setInterval(()=>{a(h=>h>1?h-1:0)},1e3);return()=>clearInterval(f)}},[]),c===0?null:I.jsx("div",{className:"text-center",children:I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"text-8xl font-bold text-primary",children:c}),I.jsxs("div",{className:"flex items-center justify-center gap-2",children:[I.jsx("div",{className:"w-2 h-2 bg-white rounded-full p-1 animate-pulse"}),I.jsx("p",{className:"text-2xl text-white uppercase italic",children:l?.name}),I.jsx("div",{className:"w-2 h-2 bg-white rounded-full p-1 animate-pulse"})]})]})})},$A=()=>{const{score:c,lives:a,currentLevel:l,setState:f,setMenuType:h,isPaused:y,multiplier:v,multiplierScore:C}=Ft(),x=Q.useRef(null),{isFullscreen:R,toggleFullscreen:A}=bp(),k=()=>{y?f(ot.PLAYING):(f(ot.PAUSED),h(Pt.PAUSE))},_=()=>{const z=x.current?.closest("sigurd-startup");z?A(z):A()},N=ZR(C,v);return I.jsxs("div",{ref:x,className:"flex justify-between items-center w-full h-full",children:[I.jsx("div",{className:"absolute top-4 left-1/2 transform -translate-x-1/2 z-10 bg-background-80 text-foreground px-4 py-2 rounded-lg backdrop-blur-sm pointer-events-auto",children:I.jsxs("div",{className:"flex items-center gap-4 text-sm font-mono",children:[I.jsx("div",{className:"text-center",children:I.jsxs("div",{className:"text-primary font-bold flex items-center gap-1",children:[I.jsx(Ck,{size:16}),c.toLocaleString()]})}),I.jsx("div",{className:"w-px h-8 bg-border"}),I.jsx("div",{className:"text-center",children:I.jsxs("div",{className:"text-primary font-bold flex items-center gap-1",children:[I.jsx(Tk,{size:16}),l.toLocaleString()]})}),I.jsx("div",{className:"w-px h-8 bg-border"}),I.jsxs("div",{className:"min-w-20 flex justify-center border border-primary p-1 rounded-lg relative overflow-hidden",children:[I.jsx("div",{className:"absolute inset-0 bg-primary-20 transition-all duration-300 ease-out",style:{width:`${N*100}%`}}),I.jsxs("div",{className:"text-primary text-center font-bold flex items-center gap-1 relative z-10",children:[I.jsx(kk,{size:16}),"x",v]})]})]})}),I.jsxs("div",{className:"flex items-center space-x-4 absolute right-4 top-4",children:[I.jsx(em,{children:I.jsxs(M0,{children:[I.jsx(k0,{asChild:!0,children:I.jsx(vi,{onClick:k,variant:"outline",className:"bg-background-80 text-foreground backdrop-blur-sm border-none hover:bg-primary hover:text-black h-10 w-10",children:y?I.jsx(s0,{className:"text-white hover:text-primary",size:24}):I.jsx(Rk,{className:"text-foreground hover:text-primary",size:24})})}),I.jsx(nm,{children:"Pause Spill (P)"})]})}),I.jsx(em,{children:I.jsxs(M0,{children:[I.jsx(k0,{asChild:!0,children:I.jsx(vi,{onClick:_,variant:"outline",className:"bg-background-80 text-foreground backdrop-blur-sm border-none hover:bg-primary hover:text-black h-10 w-10",children:R?I.jsx(Xx,{className:"text-foreground hover:text-primary",size:24}):I.jsx(Wx,{className:"text-foreground hover:text-primary",size:24})})}),I.jsx(nm,{children:R?"Avslutt fullskjerm (F11 eller F)":"Fullskjerm (F11 eller F)"})]})})]}),I.jsx("div",{className:`absolute left-3 bottom-2 ${R?"bottom-4":"bottom-2"}`,children:I.jsxs("div",{className:"text-xl font-bold text-red-400 flex items-center gap-1",children:[Array.from({length:3}).map((z,G)=>I.jsx(Ek,{color:"#ff3143",size:R?25:20,fill:G<a?"#ff3143":"none"},G)),a>3?I.jsxs("p",{children:["+ ",a-3]}):""]})})]})},GA=()=>{const{setState:c,setMenuType:a,resetGame:l}=Ft(),f=()=>{a(Pt.COUNTDOWN),c(ot.COUNTDOWN),setTimeout(()=>{c(ot.PLAYING)},3e3)},h=()=>{a(Pt.SETTINGS)},y=()=>{l(),c(ot.MENU),a(Pt.START)},v=()=>{const{resetBombState:C,resetPlayer:x,resetEffects:R,clearAllFloatingTexts:A,currentMap:k}=Ft.getState();if(C(),x(),R(),A(),k){const{initializeLevel:_}=Ft.getState();_(k)}c(ot.MENU),a(Pt.COUNTDOWN),c(ot.COUNTDOWN),setTimeout(()=>{c(ot.PLAYING)},3e3)};return I.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:I.jsxs("div",{className:"space-y-4",children:[I.jsxs(vi,{onClick:f,className:"w-full bg-primary hover:bg-primary-80 text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(s0,{size:20}),"Fortsett"]}),I.jsxs(vi,{onClick:h,variant:"outline",className:"w-full border-secondary text-muted-foreground bg-secondary hover:text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(Kx,{size:20}),"Innstillinger"]}),I.jsxs(vi,{onClick:v,variant:"outline",className:"w-full border-secondary text-muted-foreground bg-secondary hover:text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(Mk,{size:20}),"Start på nytt"]}),I.jsxs(vi,{onClick:y,variant:"default",className:"w-full bg-red-600 hover:bg-red-600/80 text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(Yx,{size:20}),"hovedmeny"]})]})})},YA=()=>{const{setMenuType:c,previousMenu:a}=Ft(),l=Ft(k=>k.audioSettings),f=Ft(k=>k.updateAudioSettings),{masterVolume:h,musicVolume:y,sfxVolume:v,masterMuted:C,musicMuted:x,sfxMuted:R}=l||{masterVolume:80,musicVolume:70,sfxVolume:90,masterMuted:!1,musicMuted:!1,sfxMuted:!1},A=()=>{c(a||Pt.START)};return I.jsxs("div",{className:"flex flex-col items-center justify-center h-full w-full",children:[I.jsxs("div",{className:"flex items-center mb-6 w-[70%] gap-2",children:[I.jsx(vi,{onClick:A,variant:"default",className:"bg-primary hover:bg-primary/80 text-white w-10 h-10",children:I.jsx(Gx,{size:25})}),I.jsx("h2",{className:"text-2xl font-bold text-white uppercase",children:"Innstillinger"})]}),I.jsxs("div",{className:"space-y-2 w-[70%]",children:[I.jsxs("div",{className:"p-3 bg-card rounded-md",children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Master volum"}),I.jsx("button",{onClick:()=>f({masterMuted:!C}),className:`px-3 py-1 rounded text-sm font-mono ${C?"bg-red-600 text-white":"bg-secondary text-white"}`,children:C?"Muted":`${h}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:C?0:h,onChange:k=>f({masterVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:C})]}),I.jsxs("div",{className:"p-3 bg-card rounded-md",children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Musikk volum"}),I.jsx("button",{onClick:()=>f({musicMuted:!x}),className:`px-3 py-1 rounded text-sm font-mono ${x?"bg-red-600 text-white":"bg-secondary text-white"}`,children:x?"Muted":`${y}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:x?0:y,onChange:k=>f({musicVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:x})]}),I.jsxs("div",{className:"p-3 bg-card rounded-md",children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Lyd effekter"}),I.jsx("button",{onClick:()=>f({sfxMuted:!R}),className:`px-3 py-1 rounded text-sm font-mono ${R?"bg-red-600 text-white":"bg-secondary text-white"}`,children:R?"Muted":`${v}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:R?0:v,onChange:k=>f({sfxVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:R})]}),I.jsx("div",{className:"text-center text-sm text-gray-400",children:I.jsx("p",{children:"(Trykk på tallene for å mute lyd)"})})]})]})},WA=(c,a={})=>{const{duration:l=3e3,steps:f=60,easing:h="ease-out",delay:y=0,onComplete:v}=a,[C,x]=Q.useState(0),R=Q.useRef(!1),A=Q.useRef(c);return Q.useEffect(()=>{if(c===0){x(0),R.current=!1;return}if(A.current!==c&&(R.current=!1,x(0),A.current=c),R.current){x(c);return}const k=setTimeout(()=>{const _=l/f;let N=0;const z=setInterval(()=>{N++;const G=N/f;let J;switch(h){case"linear":J=G;break;case"ease-out":J=1-(1-G)*(1-G);break;case"gentle-ease-out":J=1-Math.pow(1-G,1.5);break;case"ease-in":J=G*G;break;case"ease-in-out":J=G<.5?2*G*G:1-Math.pow(-2*G+2,2)/2;break;default:J=1-(1-G)*(1-G)}const de=c*J,ue=Math.round(de);x(ue),N>=f&&(x(c),R.current=!0,clearInterval(z),v&&v())},_);return()=>clearInterval(z)},y);return()=>clearTimeout(k)},[c,l,f,h,y,v]),C},XA=()=>{const{correctOrderCount:c,currentMap:a,currentLevel:l,nextLevel:f,setState:h,setMenuType:y,initializeLevel:v,setBonusAnimationComplete:C}=Ft(),x=H.BONUS_POINTS[c]||5e4,R=WA(x,{duration:6e3,steps:120,easing:"gentle-ease-out",delay:200,onComplete:()=>C(!0)});return I.jsxs("div",{className:"text-center max-w-md",children:[I.jsxs("h1",{className:"text-4xl font-bold text-primary mb-4 uppercase",children:[a?.name," Fullført!"]}),I.jsx("div",{className:"text-white mb-6 space-y-4",children:x>0&&I.jsxs("div",{className:"flex flex-col items-center justify-center gap-5",children:[I.jsxs("div",{className:"text-2xl",children:["Bra jobba! Du samlet"," ",I.jsx("span",{className:"font-bold text-primary animate-pulse",children:c})," ","av 23 finansiering og unngikk byrokratet!"," "]}),I.jsxs("div",{className:"text-4xl font-bold animate-pulse",children:[R.toLocaleString()," kr"]}),I.jsx("div",{className:"text-sm text-gray-400 mt-2",children:vf.length>l?`Fortsetter til ${vf[l]?.name||"Neste nivå"}...`:""})]})})]})},KA=()=>{const{score:c,resetGame:a}=Ft(),l=()=>{a()};return I.jsxs("div",{className:"text-center max-w-md flex flex-col items-center justify-center gap-4",children:[I.jsx("h1",{className:"text-2xl font-bold uppercase",children:"slutt"}),I.jsxs("div",{className:"text-white mb-6 space-y-4",children:[I.jsx("div",{className:"text-2xl text-primary",children:"Du har klart det umulige!"}),I.jsx("div",{className:"text-lg",children:"Du hjalp Sigurd med å unngå byrokratiske hindringer og samle finansiering."}),I.jsxs("div",{className:"text-2xl flex flex-col items-center justify-center gap-2",children:[I.jsx("div",{className:"text-foreground",children:"Total finansiering samlet:"}),I.jsx("div",{className:"font-bold text-3xl text-primary",children:c.toLocaleString()})]})]}),I.jsx("div",{className:"flex items-center justify-center gap-2",children:I.jsx("button",{onClick:l,className:"bg-primary text-white font-bold hover:bg-primary/80 rounded-lg py-1 px-3 text-lg transition-all duration-200 transform hover:scale-105 flex items-center justify-center gap-2",children:I.jsx(Yx,{className:"w-7 h-7",strokeWidth:2})})})]})},QA=()=>{const{score:c,resetGame:a,levelHistory:l}=Ft(),f=()=>{a()};return I.jsxs("div",{className:"bg-gradient-to-b rounded-lg text-center max-w-md",children:[I.jsx("h1",{className:"text-4xl font-bold text-red-400 mb-4 uppercase",children:"konkurs"}),I.jsxs("div",{className:"text-white mb-6 space-y-3",children:[I.jsx("div",{className:"text-2xl",children:I.jsxs("span",{className:"text-yellow-400",children:["Total finansiering:"," ",I.jsxs("span",{className:"font-bold text-white",children:[c.toLocaleString()," kr"]})]})}),l.length>0&&I.jsx("div",{className:"mt-6 border-t border-gray-600 pt-4",children:I.jsx("div",{className:"overflow-x-auto",children:I.jsxs("table",{className:"w-full text-sm",children:[I.jsx("thead",{children:I.jsxs("tr",{className:"border-b border-gray-600",children:[I.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Bane"}),I.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Mynter"}),I.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Finansiering"}),I.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Bonus"})]})}),I.jsx("tbody",{children:l.map((h,y)=>I.jsxs("tr",{className:"border-b border-gray-700/50",children:[I.jsxs("td",{className:"py-2 px-2 text-gray-300",children:[h.level," (",h.mapName,")"]}),I.jsx("td",{className:"py-2 px-2 text-gray-300",children:h.coinsCollected}),I.jsx("td",{className:"py-2 px-2 text-gray-300",children:h.score.toLocaleString()}),I.jsx("td",{className:"py-2 px-2",children:h.bonus>0?I.jsxs("span",{className:"text-yellow-400 font-semibold",children:[h.bonus.toLocaleString()," kr"]}):I.jsx("span",{className:"text-gray-500",children:"-"})})]},y))})]})})})]}),I.jsx(vi,{onClick:f,className:"bg-primary hover:bg-primary/80 text-white font-bold py-3 px-8 text-lg transition-all duration-200 transform hover:scale-105 uppercase",children:"prøv igjen"})]})},qA=()=>{const{setMenuType:c,previousMenu:a}=Ft(),l=Ft(k=>k.audioSettings),f=Ft(k=>k.updateAudioSettings),{masterVolume:h,musicVolume:y,sfxVolume:v,masterMuted:C,musicMuted:x,sfxMuted:R}=l||{masterVolume:80,musicVolume:70,sfxVolume:90,masterMuted:!1,musicMuted:!1,sfxMuted:!1},A=()=>{c(a||Pt.START)};return I.jsx("div",{className:"flex items-center justify-center h-full",children:I.jsxs("div",{className:"bg-card backdrop-blur-sm rounded-xl p-6 border border-secondary max-w-md w-full",children:[I.jsxs("div",{className:"flex items-center mb-6 gap-2",children:[I.jsx(vi,{onClick:A,variant:"ghost",className:"text-muted-foreground hover:text-white p-1",children:I.jsx(Gx,{size:20})}),I.jsx("h2",{className:"text-xl font-bold text-primary",children:"Lydinnstillinger"})]}),I.jsxs("div",{className:"space-y-4",children:[I.jsxs("div",{children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Master Volume"}),I.jsx("button",{onClick:()=>f({masterMuted:!C}),className:`px-3 py-1 rounded text-sm font-mono ${C?"bg-red-600 text-white":"bg-secondary text-white"}`,children:C?"Muted":`${h}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:C?0:h,onChange:k=>f({masterVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:C})]}),I.jsxs("div",{children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Music Volume"}),I.jsx("button",{onClick:()=>f({musicMuted:!x}),className:`px-3 py-1 rounded text-sm font-mono ${x?"bg-red-600 text-white":"bg-secondary text-white"}`,children:x?"Muted":`${y}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:x?0:y,onChange:k=>f({musicVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:x})]}),I.jsxs("div",{children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Sound Effects"}),I.jsx("button",{onClick:()=>f({sfxMuted:!R}),className:`px-3 py-1 rounded text-sm font-mono ${R?"bg-red-600 text-white":"bg-secondary text-white"}`,children:R?"Muted":`${v}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:R?0:v,onChange:k=>f({sfxVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:R})]})]})]})})},Xo=({children:c,transparent:a})=>I.jsx("div",{className:`absolute inset-0 flex items-center justify-center z-50 rounded-lg ${a?"bg-transparent":"bg-menu backdrop-blur-sm"}`,children:c}),ZA=c=>{const{currentState:a,setState:l,setMenuType:f,isPaused:h}=Ft();Q.useEffect(()=>{const y=v=>{if(!(v.target instanceof HTMLInputElement||v.target instanceof HTMLTextAreaElement))switch(v.key){case"F11":case"f":v.preventDefault(),c?.();break;case"Escape":document.fullscreenElement||document.webkitFullscreenElement?(v.preventDefault(),c?.()):a===ot.PLAYING&&(v.preventDefault(),h?l(ot.PLAYING):(l(ot.PAUSED),f(Pt.PAUSE)));break;case"p":case"P":a===ot.PLAYING&&(v.preventDefault(),h?l(ot.PLAYING):(l(ot.PAUSED),f(Pt.PAUSE)));break;case" ":a===ot.PAUSED&&(v.preventDefault(),f(Pt.COUNTDOWN),l(ot.COUNTDOWN),setTimeout(()=>{l(ot.PLAYING)},3e3));break}};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}},[a,h,l,f,c])},JA=()=>{const[c,a]=Q.useState(!0);return Q.useEffect(()=>{yx.preloadAllBackgrounds().then(()=>{Ge.flow("All background images preloaded"),a(!1)}).catch(l=>{Ge.warn("Failed to preload some background images"),a(!1)})},[]),{isPreloading:c}},Ko={major:2,minor:2,patch:5,build:0,timestamp:1755081167206,hash:"9AOWH4",full:"2.2.5"},_0=Ko.full,Gu=()=>({version:_0,major:Ko.major,minor:Ko.minor,patch:Ko.patch,build:Ko.build,timestamp:Ko.timestamp,hash:Ko.hash}),VC=()=>{console.log(`🎮 Sigurd Startup Game v${_0} (Build ${Ko.build})`),console.log(`📦 Hash: ${Ko.hash}`),console.log(`⏰ Built: ${new Date(Ko.timestamp).toISOString()}`)},eO=()=>{const{currentState:c,showMenu:a}=Ft(),l=Pv.useRef(null),{toggleFullscreen:f}=bp(),{isFullscreen:h}=bp(),{isPreloading:y}=JA();return ZA(()=>{const C=l.current?.closest("sigurd-startup");C?f(C):f()}),I.jsxs("div",{ref:l,className:"relative rounded-lg",children:[I.jsx(AM,{}),y&&I.jsx(Xo,{children:I.jsxs("div",{className:"text-white text-center",children:[I.jsx("div",{className:"text-lg font-bold mb-2",children:"Loading Backgrounds..."}),I.jsx("div",{className:"text-sm text-gray-300",children:"Please wait while we prepare your game"})]})}),Ya.ENABLED,I.jsxs("div",{className:`absolute bottom-3 right-3 ${h?"text-md":"text-xs"} text-muted-foreground z-40 ${h?"bottom-4":"bottom-3"}`,children:["v",_0," (Build ",Gu().build,")"]}),!y&&I.jsxs(I.Fragment,{children:[a===Pt.START&&I.jsx(Xo,{children:I.jsx(HA,{})}),a===Pt.COUNTDOWN&&I.jsx(Xo,{children:I.jsx(VA,{})}),a===Pt.PAUSE&&I.jsx(Xo,{children:I.jsx(GA,{})}),a===Pt.SETTINGS&&I.jsx(Xo,{children:I.jsx(YA,{})}),c===ot.PLAYING&&I.jsx(Xo,{transparent:!0,children:I.jsx($A,{})}),a===Pt.BONUS&&I.jsx(Xo,{children:I.jsx(XA,{})}),a===Pt.VICTORY&&I.jsx(Xo,{children:I.jsx(KA,{})}),a===Pt.GAME_OVER&&I.jsx(Xo,{children:I.jsx(QA,{})}),a===Pt.AUDIO_SETTINGS&&I.jsx(Xo,{children:I.jsx(qA,{})})]})]})},tO='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: #302e2b;--foreground: #ffffff;--card: #262521;--card-foreground: #ffffff;--popover: #262521;--popover-foreground: #ffffff;--primary: #81b64c;--primary-light: #94cc5b;--primary-dark: #6ca039;--primary-opacity-hover: #8bc2546f;--primary-foreground: #ffffff;--secondary: #484744;--secondary-light: #5a5956;--secondary-dark: #3a3936;--secondary-foreground: #ffffff;--muted: #343434;--muted-foreground: #cbcbca;--accent: #81b64c;--accent-foreground: #ffffff;--destructive: #ef4444;--destructive-foreground: #ffffff;--border: #484744;--input: #484744;--ring: #81b64c;--radius: .5rem;--menu-background: #262521c6;--sidebar-background: #262521;--sidebar-foreground: #ffffff;--sidebar-primary: #81b64c;--sidebar-primary-foreground: #ffffff;--sidebar-accent: #484744;--sidebar-accent-foreground: #ffffff;--sidebar-border: #484744;--sidebar-ring: #81b64c;--gradient-primary: linear-gradient(135deg, #94cc5b 0%, #436324 100%);--gradient-primary-hover: linear-gradient(135deg, #8bc254 0%, #7aa847 100%);--gradient-primary-subtle: linear-gradient( 135deg, #81b64c 0%, #7aa847 100% );--gradient-primary-radial: radial-gradient( circle at center, #81b64c 0%, #6a9a3d 100% )}.dark{--background: #302e2b;--foreground: #ffffff;--card: #262521;--card-foreground: #ffffff;--popover: #262521;--popover-foreground: #ffffff;--primary: #81b64c;--primary-light: #94cc5b;--primary-dark: #436324;--primary-opacity-hover: #8bc2546f;--primary-foreground: #ffffff;--secondary: #484744;--secondary-foreground: #ffffff;--muted: #262521;--muted-foreground: #cbcbca;--accent: #81b64c;--accent-foreground: #ffffff;--destructive: #dc2626;--destructive-foreground: #ffffff;--border: #484744;--input: #484744;--ring: #81b64c;--sidebar-background: #262521;--sidebar-foreground: #ffffff;--sidebar-primary: #81b64c;--sidebar-primary-foreground: #ffffff;--sidebar-accent: #484744;--sidebar-accent-foreground: #ffffff;--sidebar-border: #484744;--sidebar-ring: #81b64c;--gradient-primary: linear-gradient(135deg, #81b64c 0%, #6a9a3d 100%);--gradient-primary-hover: linear-gradient(135deg, #8bc254 0%, #7aa847 100%);--gradient-primary-subtle: linear-gradient( 135deg, #81b64c 0%, #7aa847 100% );--gradient-primary-radial: radial-gradient( circle at center, #81b64c 0%, #6a9a3d 100% )}*{border-color:var(--border)}body{background-color:var(--background);color:var(--foreground)}:fullscreen{background:var(--background)}:-webkit-full-screen{background:var(--background)}:-moz-full-screen{background:var(--background)}:-ms-fullscreen{background:var(--background)}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.bottom-2{bottom:.5rem}.bottom-3{bottom:.75rem}.bottom-4{bottom:1rem}.left-1{left:.25rem}.left-1\\/2{left:50%}.left-3{left:.75rem}.right-3{right:.75rem}.right-4{right:1rem}.top-1{top:.25rem}.top-4{top:1rem}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.float-right{float:right}.float-left{float:left}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mt-2{margin-top:.5rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-2{height:.5rem}.h-4{height:1rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-full{height:100%}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-2{width:.5rem}.w-4{width:1rem}.w-7{width:1.75rem}.w-\\[70\\%\\]{width:70%}.w-full{width:100%}.w-px{width:1px}.min-w-20{min-width:5rem}.max-w-md{max-width:28rem}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.border-gray-700\\/50{border-color:#37415180}.border-input{border-color:var(--input)}.bg-background{background-color:var(--background)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-destructive{background-color:var(--destructive)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-menu{background-color:var(--menu-background)}.bg-popover{background-color:var(--popover)}.bg-primary{background-color:var(--primary)}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:var(--secondary)}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:JetBrains Mono,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-8xl{font-size:6rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-destructive-foreground{color:var(--destructive-foreground)}.text-foreground{color:var(--foreground)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:var(--popover-foreground)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:var(--secondary-foreground)}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.accent-primary{accent-color:var(--primary)}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\\/10{--tw-shadow-color: rgb(0 0 0 / .1);--tw-shadow: var(--tw-shadow-colored)}.outline{outline-style:solid}.ring-offset-background{--tw-ring-offset-color: var(--background)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in{animation-timing-function:cubic-bezier(.4,0,1,1)}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.paused{animation-play-state:paused}.bg-background-80{background-color:#302e2bcc}.bg-primary-20{background-color:#81b64c33}.text-muted-foreground{color:var(--muted-foreground)}.text-primary{color:var(--primary)}.border-primary{border-color:var(--primary)}.border-secondary{border-color:var(--secondary)}.hover\\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-primary:hover{background-color:var(--primary)}.hover\\:bg-red-600\\/80:hover{background-color:#dc2626cc}.hover\\:bg-secondary:hover{background-color:var(--secondary)}.hover\\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\\:text-black:hover{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.hover\\:text-blue-700:hover{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.hover\\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:bg-primary-80:hover{background-color:#81b64ccc}.hover\\:text-primary:hover{color:var(--primary)}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\\:ring-ring:focus-visible{--tw-ring-color: var(--ring)}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:opacity-50:disabled{opacity:.5}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:size-4 svg{width:1rem;height:1rem}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}';class nO extends HTMLElement{constructor(){super(...arguments);be(this,"root",null)}connectedCallback(){fM();const l=this.attachShadow({mode:"open"}),f=document.createElement("div");l.appendChild(f);const h=document.createElement("style");h.textContent=tO,l.appendChild(h),this.root=pp.createRoot(f),this.root.render(I.jsx(eO,{})),VC(),this.setAttribute("data-version",Gu().version),this.setAttribute("data-build",Gu().build.toString())}disconnectedCallback(){this.root&&(this.root.unmount(),this.root=null)}getVersion(){return Gu()}isCompatible(l){const f=Gu(),[h,y,v]=f.version.split(".").map(Number),[C,x,R]=l.split(".").map(Number);return h>C?!0:h<C?!1:y>x?!0:y<x?!1:v>=R}}customElements.define("sigurd-startup",nO);const rO={getVersion:Gu,ASSET_PATHS:Il,getBackgroundImagePath:fx};sa.ASSET_PATHS=Il,sa.default=rO,sa.getBackgroundImagePath=fx,sa.getVersion=Gu,sa.logVersion=VC,Object.defineProperties(sa,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
321
+ */const kk=Ui("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"}]]);function zl(c,a,{checkForDefaultPrevented:l=!0}={}){return function(h){if(c?.(h),l===!1||!h.defaultPrevented)return a?.(h)}}function Qx(c,a=[]){let l=[];function f(y,v){const C=Q.createContext(v),x=l.length;l=[...l,v];const R=k=>{const{scope:_,children:N,...z}=k,G=_?.[c]?.[x]||C,J=Q.useMemo(()=>z,Object.values(z));return I.jsx(G.Provider,{value:J,children:N})};R.displayName=y+"Provider";function A(k,_){const N=_?.[c]?.[x]||C,z=Q.useContext(N);if(z)return z;if(v!==void 0)return v;throw new Error(`\`${k}\` must be used within \`${y}\``)}return[R,A]}const h=()=>{const y=l.map(v=>Q.createContext(v));return function(C){const x=C?.[c]||y;return Q.useMemo(()=>({[`__scope${c}`]:{...C,[c]:x}}),[C,x])}};return h.scopeName=c,[f,_k(h,...a)]}function _k(...c){const a=c[0];if(c.length===1)return a;const l=()=>{const f=c.map(h=>({useScope:h(),scopeName:h.scopeName}));return function(y){const v=f.reduce((C,{useScope:x,scopeName:R})=>{const k=x(y)[`__scope${R}`];return{...C,...k}},{});return Q.useMemo(()=>({[`__scope${a.scopeName}`]:v}),[v])}};return l.scopeName=a.scopeName,l}var Ak=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Hu=Ak.reduce((c,a)=>{const l=xx(`Primitive.${a}`),f=Q.forwardRef((h,y)=>{const{asChild:v,...C}=h,x=v?l:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),I.jsx(x,{...C,ref:y})});return f.displayName=`Primitive.${a}`,{...c,[a]:f}},{});function Ok(c,a){c&&Zy.flushSync(()=>c.dispatchEvent(a))}function Bv(c){const a=Q.useRef(c);return Q.useEffect(()=>{a.current=c}),Q.useMemo(()=>(...l)=>a.current?.(...l),[])}function Nk(c,a=globalThis?.document){const l=Bv(c);Q.useEffect(()=>{const f=h=>{h.key==="Escape"&&l(h)};return a.addEventListener("keydown",f,{capture:!0}),()=>a.removeEventListener("keydown",f,{capture:!0})},[l,a])}var Dk="DismissableLayer",u0="dismissableLayer.update",Lk="dismissableLayer.pointerDownOutside",Pk="dismissableLayer.focusOutside",qx,Zx=Q.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jx=Q.forwardRef((c,a)=>{const{disableOutsidePointerEvents:l=!1,onEscapeKeyDown:f,onPointerDownOutside:h,onFocusOutside:y,onInteractOutside:v,onDismiss:C,...x}=c,R=Q.useContext(Zx),[A,k]=Q.useState(null),_=A?.ownerDocument??globalThis?.document,[,N]=Q.useState({}),z=ju(a,ve=>k(ve)),G=Array.from(R.layers),[J]=[...R.layersWithOutsidePointerEventsDisabled].slice(-1),de=G.indexOf(J),ue=A?G.indexOf(A):-1,ce=R.layersWithOutsidePointerEventsDisabled.size>0,fe=ue>=de,le=zk(ve=>{const xe=ve.target,tt=[...R.branches].some(dt=>dt.contains(xe));!fe||tt||(h?.(ve),v?.(ve),ve.defaultPrevented||C?.())},_),Re=Fk(ve=>{const xe=ve.target;[...R.branches].some(dt=>dt.contains(xe))||(y?.(ve),v?.(ve),ve.defaultPrevented||C?.())},_);return Nk(ve=>{ue===R.layers.size-1&&(f?.(ve),!ve.defaultPrevented&&C&&(ve.preventDefault(),C()))},_),Q.useEffect(()=>{if(A)return l&&(R.layersWithOutsidePointerEventsDisabled.size===0&&(qx=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),R.layersWithOutsidePointerEventsDisabled.add(A)),R.layers.add(A),eC(),()=>{l&&R.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=qx)}},[A,_,l,R]),Q.useEffect(()=>()=>{A&&(R.layers.delete(A),R.layersWithOutsidePointerEventsDisabled.delete(A),eC())},[A,R]),Q.useEffect(()=>{const ve=()=>N({});return document.addEventListener(u0,ve),()=>document.removeEventListener(u0,ve)},[]),I.jsx(Hu.div,{...x,ref:z,style:{pointerEvents:ce?fe?"auto":"none":void 0,...c.style},onFocusCapture:zl(c.onFocusCapture,Re.onFocusCapture),onBlurCapture:zl(c.onBlurCapture,Re.onBlurCapture),onPointerDownCapture:zl(c.onPointerDownCapture,le.onPointerDownCapture)})});Jx.displayName=Dk;var Ik="DismissableLayerBranch",Uk=Q.forwardRef((c,a)=>{const l=Q.useContext(Zx),f=Q.useRef(null),h=ju(a,f);return Q.useEffect(()=>{const y=f.current;if(y)return l.branches.add(y),()=>{l.branches.delete(y)}},[l.branches]),I.jsx(Hu.div,{...c,ref:h})});Uk.displayName=Ik;function zk(c,a=globalThis?.document){const l=Bv(c),f=Q.useRef(!1),h=Q.useRef(()=>{});return Q.useEffect(()=>{const y=C=>{if(C.target&&!f.current){let x=function(){tC(Lk,l,R,{discrete:!0})};const R={originalEvent:C};C.pointerType==="touch"?(a.removeEventListener("click",h.current),h.current=x,a.addEventListener("click",h.current,{once:!0})):x()}else a.removeEventListener("click",h.current);f.current=!1},v=window.setTimeout(()=>{a.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(v),a.removeEventListener("pointerdown",y),a.removeEventListener("click",h.current)}},[a,l]),{onPointerDownCapture:()=>f.current=!0}}function Fk(c,a=globalThis?.document){const l=Bv(c),f=Q.useRef(!1);return Q.useEffect(()=>{const h=y=>{y.target&&!f.current&&tC(Pk,l,{originalEvent:y},{discrete:!1})};return a.addEventListener("focusin",h),()=>a.removeEventListener("focusin",h)},[a,l]),{onFocusCapture:()=>f.current=!0,onBlurCapture:()=>f.current=!1}}function eC(){const c=new CustomEvent(u0);document.dispatchEvent(c)}function tC(c,a,l,{discrete:f}){const h=l.originalEvent.target,y=new CustomEvent(c,{bubbles:!1,cancelable:!0,detail:l});a&&h.addEventListener(c,a,{once:!0}),f?Ok(h,y):h.dispatchEvent(y)}var Vu=globalThis?.document?Q.useLayoutEffect:()=>{},jk=ax[" useId ".trim().toString()]||(()=>{}),Bk=0;function Hk(c){const[a,l]=Q.useState(jk());return Vu(()=>{l(f=>f??String(Bk++))},[c]),a?`radix-${a}`:""}const Vk=["top","right","bottom","left"],Bs=Math.min,mi=Math.max,Hv=Math.round,Vv=Math.floor,$o=c=>({x:c,y:c}),$k={left:"right",right:"left",bottom:"top",top:"bottom"},Gk={start:"end",end:"start"};function c0(c,a,l){return mi(c,Bs(a,l))}function Fl(c,a){return typeof c=="function"?c(a):c}function jl(c){return c.split("-")[0]}function Sf(c){return c.split("-")[1]}function f0(c){return c==="x"?"y":"x"}function d0(c){return c==="y"?"height":"width"}const Yk=new Set(["top","bottom"]);function Go(c){return Yk.has(jl(c))?"y":"x"}function p0(c){return f0(Go(c))}function Wk(c,a,l){l===void 0&&(l=!1);const f=Sf(c),h=p0(c),y=d0(h);let v=h==="x"?f===(l?"end":"start")?"right":"left":f==="start"?"bottom":"top";return a.reference[y]>a.floating[y]&&(v=$v(v)),[v,$v(v)]}function Xk(c){const a=$v(c);return[h0(c),a,h0(a)]}function h0(c){return c.replace(/start|end/g,a=>Gk[a])}const nC=["left","right"],rC=["right","left"],Kk=["top","bottom"],Qk=["bottom","top"];function qk(c,a,l){switch(c){case"top":case"bottom":return l?a?rC:nC:a?nC:rC;case"left":case"right":return a?Kk:Qk;default:return[]}}function Zk(c,a,l,f){const h=Sf(c);let y=qk(jl(c),l==="start",f);return h&&(y=y.map(v=>v+"-"+h),a&&(y=y.concat(y.map(h0)))),y}function $v(c){return c.replace(/left|right|bottom|top/g,a=>$k[a])}function Jk(c){return{top:0,right:0,bottom:0,left:0,...c}}function aC(c){return typeof c!="number"?Jk(c):{top:c,right:c,bottom:c,left:c}}function Gv(c){const{x:a,y:l,width:f,height:h}=c;return{width:f,height:h,top:l,left:a,right:a+f,bottom:l+h,x:a,y:l}}function iC(c,a,l){let{reference:f,floating:h}=c;const y=Go(a),v=p0(a),C=d0(v),x=jl(a),R=y==="y",A=f.x+f.width/2-h.width/2,k=f.y+f.height/2-h.height/2,_=f[C]/2-h[C]/2;let N;switch(x){case"top":N={x:A,y:f.y-h.height};break;case"bottom":N={x:A,y:f.y+f.height};break;case"right":N={x:f.x+f.width,y:k};break;case"left":N={x:f.x-h.width,y:k};break;default:N={x:f.x,y:f.y}}switch(Sf(a)){case"start":N[v]-=_*(l&&R?-1:1);break;case"end":N[v]+=_*(l&&R?-1:1);break}return N}const e_=async(c,a,l)=>{const{placement:f="bottom",strategy:h="absolute",middleware:y=[],platform:v}=l,C=y.filter(Boolean),x=await(v.isRTL==null?void 0:v.isRTL(a));let R=await v.getElementRects({reference:c,floating:a,strategy:h}),{x:A,y:k}=iC(R,f,x),_=f,N={},z=0;for(let G=0;G<C.length;G++){const{name:J,fn:de}=C[G],{x:ue,y:ce,data:fe,reset:le}=await de({x:A,y:k,initialPlacement:f,placement:_,strategy:h,middlewareData:N,rects:R,platform:v,elements:{reference:c,floating:a}});A=ue??A,k=ce??k,N={...N,[J]:{...N[J],...fe}},le&&z<=50&&(z++,typeof le=="object"&&(le.placement&&(_=le.placement),le.rects&&(R=le.rects===!0?await v.getElementRects({reference:c,floating:a,strategy:h}):le.rects),{x:A,y:k}=iC(R,_,x)),G=-1)}return{x:A,y:k,placement:_,strategy:h,middlewareData:N}};async function Cp(c,a){var l;a===void 0&&(a={});const{x:f,y:h,platform:y,rects:v,elements:C,strategy:x}=c,{boundary:R="clippingAncestors",rootBoundary:A="viewport",elementContext:k="floating",altBoundary:_=!1,padding:N=0}=Fl(a,c),z=aC(N),J=C[_?k==="floating"?"reference":"floating":k],de=Gv(await y.getClippingRect({element:(l=await(y.isElement==null?void 0:y.isElement(J)))==null||l?J:J.contextElement||await(y.getDocumentElement==null?void 0:y.getDocumentElement(C.floating)),boundary:R,rootBoundary:A,strategy:x})),ue=k==="floating"?{x:f,y:h,width:v.floating.width,height:v.floating.height}:v.reference,ce=await(y.getOffsetParent==null?void 0:y.getOffsetParent(C.floating)),fe=await(y.isElement==null?void 0:y.isElement(ce))?await(y.getScale==null?void 0:y.getScale(ce))||{x:1,y:1}:{x:1,y:1},le=Gv(y.convertOffsetParentRelativeRectToViewportRelativeRect?await y.convertOffsetParentRelativeRectToViewportRelativeRect({elements:C,rect:ue,offsetParent:ce,strategy:x}):ue);return{top:(de.top-le.top+z.top)/fe.y,bottom:(le.bottom-de.bottom+z.bottom)/fe.y,left:(de.left-le.left+z.left)/fe.x,right:(le.right-de.right+z.right)/fe.x}}const t_=c=>({name:"arrow",options:c,async fn(a){const{x:l,y:f,placement:h,rects:y,platform:v,elements:C,middlewareData:x}=a,{element:R,padding:A=0}=Fl(c,a)||{};if(R==null)return{};const k=aC(A),_={x:l,y:f},N=p0(h),z=d0(N),G=await v.getDimensions(R),J=N==="y",de=J?"top":"left",ue=J?"bottom":"right",ce=J?"clientHeight":"clientWidth",fe=y.reference[z]+y.reference[N]-_[N]-y.floating[z],le=_[N]-y.reference[N],Re=await(v.getOffsetParent==null?void 0:v.getOffsetParent(R));let ve=Re?Re[ce]:0;(!ve||!await(v.isElement==null?void 0:v.isElement(Re)))&&(ve=C.floating[ce]||y.floating[z]);const xe=fe/2-le/2,tt=ve/2-G[z]/2-1,dt=Bs(k[de],tt),Rt=Bs(k[ue],tt),lt=dt,Ae=ve-G[z]-Rt,rt=ve/2-G[z]/2+xe,st=c0(lt,rt,Ae),qe=!x.arrow&&Sf(h)!=null&&rt!==st&&y.reference[z]/2-(rt<lt?dt:Rt)-G[z]/2<0,Te=qe?rt<lt?rt-lt:rt-Ae:0;return{[N]:_[N]+Te,data:{[N]:st,centerOffset:rt-st-Te,...qe&&{alignmentOffset:Te}},reset:qe}}}),n_=function(c){return c===void 0&&(c={}),{name:"flip",options:c,async fn(a){var l,f;const{placement:h,middlewareData:y,rects:v,initialPlacement:C,platform:x,elements:R}=a,{mainAxis:A=!0,crossAxis:k=!0,fallbackPlacements:_,fallbackStrategy:N="bestFit",fallbackAxisSideDirection:z="none",flipAlignment:G=!0,...J}=Fl(c,a);if((l=y.arrow)!=null&&l.alignmentOffset)return{};const de=jl(h),ue=Go(C),ce=jl(C)===C,fe=await(x.isRTL==null?void 0:x.isRTL(R.floating)),le=_||(ce||!G?[$v(C)]:Xk(C)),Re=z!=="none";!_&&Re&&le.push(...Zk(C,G,z,fe));const ve=[C,...le],xe=await Cp(a,J),tt=[];let dt=((f=y.flip)==null?void 0:f.overflows)||[];if(A&&tt.push(xe[de]),k){const rt=Wk(h,v,fe);tt.push(xe[rt[0]],xe[rt[1]])}if(dt=[...dt,{placement:h,overflows:tt}],!tt.every(rt=>rt<=0)){var Rt,lt;const rt=(((Rt=y.flip)==null?void 0:Rt.index)||0)+1,st=ve[rt];if(st&&(!(k==="alignment"?ue!==Go(st):!1)||dt.every($=>Go($.placement)===ue?$.overflows[0]>0:!0)))return{data:{index:rt,overflows:dt},reset:{placement:st}};let qe=(lt=dt.filter(Te=>Te.overflows[0]<=0).sort((Te,$)=>Te.overflows[1]-$.overflows[1])[0])==null?void 0:lt.placement;if(!qe)switch(N){case"bestFit":{var Ae;const Te=(Ae=dt.filter($=>{if(Re){const ke=Go($.placement);return ke===ue||ke==="y"}return!0}).map($=>[$.placement,$.overflows.filter(ke=>ke>0).reduce((ke,Ce)=>ke+Ce,0)]).sort(($,ke)=>$[1]-ke[1])[0])==null?void 0:Ae[0];Te&&(qe=Te);break}case"initialPlacement":qe=C;break}if(h!==qe)return{reset:{placement:qe}}}return{}}}};function oC(c,a){return{top:c.top-a.height,right:c.right-a.width,bottom:c.bottom-a.height,left:c.left-a.width}}function lC(c){return Vk.some(a=>c[a]>=0)}const r_=function(c){return c===void 0&&(c={}),{name:"hide",options:c,async fn(a){const{rects:l}=a,{strategy:f="referenceHidden",...h}=Fl(c,a);switch(f){case"referenceHidden":{const y=await Cp(a,{...h,elementContext:"reference"}),v=oC(y,l.reference);return{data:{referenceHiddenOffsets:v,referenceHidden:lC(v)}}}case"escaped":{const y=await Cp(a,{...h,altBoundary:!0}),v=oC(y,l.floating);return{data:{escapedOffsets:v,escaped:lC(v)}}}default:return{}}}}},sC=new Set(["left","top"]);async function a_(c,a){const{placement:l,platform:f,elements:h}=c,y=await(f.isRTL==null?void 0:f.isRTL(h.floating)),v=jl(l),C=Sf(l),x=Go(l)==="y",R=sC.has(v)?-1:1,A=y&&x?-1:1,k=Fl(a,c);let{mainAxis:_,crossAxis:N,alignmentAxis:z}=typeof k=="number"?{mainAxis:k,crossAxis:0,alignmentAxis:null}:{mainAxis:k.mainAxis||0,crossAxis:k.crossAxis||0,alignmentAxis:k.alignmentAxis};return C&&typeof z=="number"&&(N=C==="end"?z*-1:z),x?{x:N*A,y:_*R}:{x:_*R,y:N*A}}const i_=function(c){return c===void 0&&(c=0),{name:"offset",options:c,async fn(a){var l,f;const{x:h,y,placement:v,middlewareData:C}=a,x=await a_(a,c);return v===((l=C.offset)==null?void 0:l.placement)&&(f=C.arrow)!=null&&f.alignmentOffset?{}:{x:h+x.x,y:y+x.y,data:{...x,placement:v}}}}},o_=function(c){return c===void 0&&(c={}),{name:"shift",options:c,async fn(a){const{x:l,y:f,placement:h}=a,{mainAxis:y=!0,crossAxis:v=!1,limiter:C={fn:J=>{let{x:de,y:ue}=J;return{x:de,y:ue}}},...x}=Fl(c,a),R={x:l,y:f},A=await Cp(a,x),k=Go(jl(h)),_=f0(k);let N=R[_],z=R[k];if(y){const J=_==="y"?"top":"left",de=_==="y"?"bottom":"right",ue=N+A[J],ce=N-A[de];N=c0(ue,N,ce)}if(v){const J=k==="y"?"top":"left",de=k==="y"?"bottom":"right",ue=z+A[J],ce=z-A[de];z=c0(ue,z,ce)}const G=C.fn({...a,[_]:N,[k]:z});return{...G,data:{x:G.x-l,y:G.y-f,enabled:{[_]:y,[k]:v}}}}}},l_=function(c){return c===void 0&&(c={}),{options:c,fn(a){const{x:l,y:f,placement:h,rects:y,middlewareData:v}=a,{offset:C=0,mainAxis:x=!0,crossAxis:R=!0}=Fl(c,a),A={x:l,y:f},k=Go(h),_=f0(k);let N=A[_],z=A[k];const G=Fl(C,a),J=typeof G=="number"?{mainAxis:G,crossAxis:0}:{mainAxis:0,crossAxis:0,...G};if(x){const ce=_==="y"?"height":"width",fe=y.reference[_]-y.floating[ce]+J.mainAxis,le=y.reference[_]+y.reference[ce]-J.mainAxis;N<fe?N=fe:N>le&&(N=le)}if(R){var de,ue;const ce=_==="y"?"width":"height",fe=sC.has(jl(h)),le=y.reference[k]-y.floating[ce]+(fe&&((de=v.offset)==null?void 0:de[k])||0)+(fe?0:J.crossAxis),Re=y.reference[k]+y.reference[ce]+(fe?0:((ue=v.offset)==null?void 0:ue[k])||0)-(fe?J.crossAxis:0);z<le?z=le:z>Re&&(z=Re)}return{[_]:N,[k]:z}}}},s_=function(c){return c===void 0&&(c={}),{name:"size",options:c,async fn(a){var l,f;const{placement:h,rects:y,platform:v,elements:C}=a,{apply:x=()=>{},...R}=Fl(c,a),A=await Cp(a,R),k=jl(h),_=Sf(h),N=Go(h)==="y",{width:z,height:G}=y.floating;let J,de;k==="top"||k==="bottom"?(J=k,de=_===(await(v.isRTL==null?void 0:v.isRTL(C.floating))?"start":"end")?"left":"right"):(de=k,J=_==="end"?"top":"bottom");const ue=G-A.top-A.bottom,ce=z-A.left-A.right,fe=Bs(G-A[J],ue),le=Bs(z-A[de],ce),Re=!a.middlewareData.shift;let ve=fe,xe=le;if((l=a.middlewareData.shift)!=null&&l.enabled.x&&(xe=ce),(f=a.middlewareData.shift)!=null&&f.enabled.y&&(ve=ue),Re&&!_){const dt=mi(A.left,0),Rt=mi(A.right,0),lt=mi(A.top,0),Ae=mi(A.bottom,0);N?xe=z-2*(dt!==0||Rt!==0?dt+Rt:mi(A.left,A.right)):ve=G-2*(lt!==0||Ae!==0?lt+Ae:mi(A.top,A.bottom))}await x({...a,availableWidth:xe,availableHeight:ve});const tt=await v.getDimensions(C.floating);return z!==tt.width||G!==tt.height?{reset:{rects:!0}}:{}}}};function Yv(){return typeof window<"u"}function wf(c){return uC(c)?(c.nodeName||"").toLowerCase():"#document"}function gi(c){var a;return(c==null||(a=c.ownerDocument)==null?void 0:a.defaultView)||window}function Yo(c){var a;return(a=(uC(c)?c.ownerDocument:c.document)||window.document)==null?void 0:a.documentElement}function uC(c){return Yv()?c instanceof Node||c instanceof gi(c).Node:!1}function ho(c){return Yv()?c instanceof Element||c instanceof gi(c).Element:!1}function Wo(c){return Yv()?c instanceof HTMLElement||c instanceof gi(c).HTMLElement:!1}function cC(c){return!Yv()||typeof ShadowRoot>"u"?!1:c instanceof ShadowRoot||c instanceof gi(c).ShadowRoot}const u_=new Set(["inline","contents"]);function Ep(c){const{overflow:a,overflowX:l,overflowY:f,display:h}=vo(c);return/auto|scroll|overlay|hidden|clip/.test(a+f+l)&&!u_.has(h)}const c_=new Set(["table","td","th"]);function f_(c){return c_.has(wf(c))}const d_=[":popover-open",":modal"];function Wv(c){return d_.some(a=>{try{return c.matches(a)}catch{return!1}})}const p_=["transform","translate","scale","rotate","perspective"],h_=["transform","translate","scale","rotate","perspective","filter"],v_=["paint","layout","strict","content"];function v0(c){const a=m0(),l=ho(c)?vo(c):c;return p_.some(f=>l[f]?l[f]!=="none":!1)||(l.containerType?l.containerType!=="normal":!1)||!a&&(l.backdropFilter?l.backdropFilter!=="none":!1)||!a&&(l.filter?l.filter!=="none":!1)||h_.some(f=>(l.willChange||"").includes(f))||v_.some(f=>(l.contain||"").includes(f))}function m_(c){let a=Hs(c);for(;Wo(a)&&!bf(a);){if(v0(a))return a;if(Wv(a))return null;a=Hs(a)}return null}function m0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const g_=new Set(["html","body","#document"]);function bf(c){return g_.has(wf(c))}function vo(c){return gi(c).getComputedStyle(c)}function Xv(c){return ho(c)?{scrollLeft:c.scrollLeft,scrollTop:c.scrollTop}:{scrollLeft:c.scrollX,scrollTop:c.scrollY}}function Hs(c){if(wf(c)==="html")return c;const a=c.assignedSlot||c.parentNode||cC(c)&&c.host||Yo(c);return cC(a)?a.host:a}function fC(c){const a=Hs(c);return bf(a)?c.ownerDocument?c.ownerDocument.body:c.body:Wo(a)&&Ep(a)?a:fC(a)}function Tp(c,a,l){var f;a===void 0&&(a=[]),l===void 0&&(l=!0);const h=fC(c),y=h===((f=c.ownerDocument)==null?void 0:f.body),v=gi(h);if(y){const C=g0(v);return a.concat(v,v.visualViewport||[],Ep(h)?h:[],C&&l?Tp(C):[])}return a.concat(h,Tp(h,[],l))}function g0(c){return c.parent&&Object.getPrototypeOf(c.parent)?c.frameElement:null}function dC(c){const a=vo(c);let l=parseFloat(a.width)||0,f=parseFloat(a.height)||0;const h=Wo(c),y=h?c.offsetWidth:l,v=h?c.offsetHeight:f,C=Hv(l)!==y||Hv(f)!==v;return C&&(l=y,f=v),{width:l,height:f,$:C}}function y0(c){return ho(c)?c:c.contextElement}function xf(c){const a=y0(c);if(!Wo(a))return $o(1);const l=a.getBoundingClientRect(),{width:f,height:h,$:y}=dC(a);let v=(y?Hv(l.width):l.width)/f,C=(y?Hv(l.height):l.height)/h;return(!v||!Number.isFinite(v))&&(v=1),(!C||!Number.isFinite(C))&&(C=1),{x:v,y:C}}const y_=$o(0);function pC(c){const a=gi(c);return!m0()||!a.visualViewport?y_:{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}}function S_(c,a,l){return a===void 0&&(a=!1),!l||a&&l!==gi(c)?!1:a}function $u(c,a,l,f){a===void 0&&(a=!1),l===void 0&&(l=!1);const h=c.getBoundingClientRect(),y=y0(c);let v=$o(1);a&&(f?ho(f)&&(v=xf(f)):v=xf(c));const C=S_(y,l,f)?pC(y):$o(0);let x=(h.left+C.x)/v.x,R=(h.top+C.y)/v.y,A=h.width/v.x,k=h.height/v.y;if(y){const _=gi(y),N=f&&ho(f)?gi(f):f;let z=_,G=g0(z);for(;G&&f&&N!==z;){const J=xf(G),de=G.getBoundingClientRect(),ue=vo(G),ce=de.left+(G.clientLeft+parseFloat(ue.paddingLeft))*J.x,fe=de.top+(G.clientTop+parseFloat(ue.paddingTop))*J.y;x*=J.x,R*=J.y,A*=J.x,k*=J.y,x+=ce,R+=fe,z=gi(G),G=g0(z)}}return Gv({width:A,height:k,x,y:R})}function S0(c,a){const l=Xv(c).scrollLeft;return a?a.left+l:$u(Yo(c)).left+l}function hC(c,a,l){l===void 0&&(l=!1);const f=c.getBoundingClientRect(),h=f.left+a.scrollLeft-(l?0:S0(c,f)),y=f.top+a.scrollTop;return{x:h,y}}function w_(c){let{elements:a,rect:l,offsetParent:f,strategy:h}=c;const y=h==="fixed",v=Yo(f),C=a?Wv(a.floating):!1;if(f===v||C&&y)return l;let x={scrollLeft:0,scrollTop:0},R=$o(1);const A=$o(0),k=Wo(f);if((k||!k&&!y)&&((wf(f)!=="body"||Ep(v))&&(x=Xv(f)),Wo(f))){const N=$u(f);R=xf(f),A.x=N.x+f.clientLeft,A.y=N.y+f.clientTop}const _=v&&!k&&!y?hC(v,x,!0):$o(0);return{width:l.width*R.x,height:l.height*R.y,x:l.x*R.x-x.scrollLeft*R.x+A.x+_.x,y:l.y*R.y-x.scrollTop*R.y+A.y+_.y}}function b_(c){return Array.from(c.getClientRects())}function x_(c){const a=Yo(c),l=Xv(c),f=c.ownerDocument.body,h=mi(a.scrollWidth,a.clientWidth,f.scrollWidth,f.clientWidth),y=mi(a.scrollHeight,a.clientHeight,f.scrollHeight,f.clientHeight);let v=-l.scrollLeft+S0(c);const C=-l.scrollTop;return vo(f).direction==="rtl"&&(v+=mi(a.clientWidth,f.clientWidth)-h),{width:h,height:y,x:v,y:C}}function C_(c,a){const l=gi(c),f=Yo(c),h=l.visualViewport;let y=f.clientWidth,v=f.clientHeight,C=0,x=0;if(h){y=h.width,v=h.height;const R=m0();(!R||R&&a==="fixed")&&(C=h.offsetLeft,x=h.offsetTop)}return{width:y,height:v,x:C,y:x}}const E_=new Set(["absolute","fixed"]);function T_(c,a){const l=$u(c,!0,a==="fixed"),f=l.top+c.clientTop,h=l.left+c.clientLeft,y=Wo(c)?xf(c):$o(1),v=c.clientWidth*y.x,C=c.clientHeight*y.y,x=h*y.x,R=f*y.y;return{width:v,height:C,x,y:R}}function vC(c,a,l){let f;if(a==="viewport")f=C_(c,l);else if(a==="document")f=x_(Yo(c));else if(ho(a))f=T_(a,l);else{const h=pC(c);f={x:a.x-h.x,y:a.y-h.y,width:a.width,height:a.height}}return Gv(f)}function mC(c,a){const l=Hs(c);return l===a||!ho(l)||bf(l)?!1:vo(l).position==="fixed"||mC(l,a)}function R_(c,a){const l=a.get(c);if(l)return l;let f=Tp(c,[],!1).filter(C=>ho(C)&&wf(C)!=="body"),h=null;const y=vo(c).position==="fixed";let v=y?Hs(c):c;for(;ho(v)&&!bf(v);){const C=vo(v),x=v0(v);!x&&C.position==="fixed"&&(h=null),(y?!x&&!h:!x&&C.position==="static"&&!!h&&E_.has(h.position)||Ep(v)&&!x&&mC(c,v))?f=f.filter(A=>A!==v):h=C,v=Hs(v)}return a.set(c,f),f}function M_(c){let{element:a,boundary:l,rootBoundary:f,strategy:h}=c;const v=[...l==="clippingAncestors"?Wv(a)?[]:R_(a,this._c):[].concat(l),f],C=v[0],x=v.reduce((R,A)=>{const k=vC(a,A,h);return R.top=mi(k.top,R.top),R.right=Bs(k.right,R.right),R.bottom=Bs(k.bottom,R.bottom),R.left=mi(k.left,R.left),R},vC(a,C,h));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}}function k_(c){const{width:a,height:l}=dC(c);return{width:a,height:l}}function __(c,a,l){const f=Wo(a),h=Yo(a),y=l==="fixed",v=$u(c,!0,y,a);let C={scrollLeft:0,scrollTop:0};const x=$o(0);function R(){x.x=S0(h)}if(f||!f&&!y)if((wf(a)!=="body"||Ep(h))&&(C=Xv(a)),f){const N=$u(a,!0,y,a);x.x=N.x+a.clientLeft,x.y=N.y+a.clientTop}else h&&R();y&&!f&&h&&R();const A=h&&!f&&!y?hC(h,C):$o(0),k=v.left+C.scrollLeft-x.x-A.x,_=v.top+C.scrollTop-x.y-A.y;return{x:k,y:_,width:v.width,height:v.height}}function w0(c){return vo(c).position==="static"}function gC(c,a){if(!Wo(c)||vo(c).position==="fixed")return null;if(a)return a(c);let l=c.offsetParent;return Yo(c)===l&&(l=l.ownerDocument.body),l}function yC(c,a){const l=gi(c);if(Wv(c))return l;if(!Wo(c)){let h=Hs(c);for(;h&&!bf(h);){if(ho(h)&&!w0(h))return h;h=Hs(h)}return l}let f=gC(c,a);for(;f&&f_(f)&&w0(f);)f=gC(f,a);return f&&bf(f)&&w0(f)&&!v0(f)?l:f||m_(c)||l}const A_=async function(c){const a=this.getOffsetParent||yC,l=this.getDimensions,f=await l(c.floating);return{reference:__(c.reference,await a(c.floating),c.strategy),floating:{x:0,y:0,width:f.width,height:f.height}}};function O_(c){return vo(c).direction==="rtl"}const N_={convertOffsetParentRelativeRectToViewportRelativeRect:w_,getDocumentElement:Yo,getClippingRect:M_,getOffsetParent:yC,getElementRects:A_,getClientRects:b_,getDimensions:k_,getScale:xf,isElement:ho,isRTL:O_};function SC(c,a){return c.x===a.x&&c.y===a.y&&c.width===a.width&&c.height===a.height}function D_(c,a){let l=null,f;const h=Yo(c);function y(){var C;clearTimeout(f),(C=l)==null||C.disconnect(),l=null}function v(C,x){C===void 0&&(C=!1),x===void 0&&(x=1),y();const R=c.getBoundingClientRect(),{left:A,top:k,width:_,height:N}=R;if(C||a(),!_||!N)return;const z=Vv(k),G=Vv(h.clientWidth-(A+_)),J=Vv(h.clientHeight-(k+N)),de=Vv(A),ce={rootMargin:-z+"px "+-G+"px "+-J+"px "+-de+"px",threshold:mi(0,Bs(1,x))||1};let fe=!0;function le(Re){const ve=Re[0].intersectionRatio;if(ve!==x){if(!fe)return v();ve?v(!1,ve):f=setTimeout(()=>{v(!1,1e-7)},1e3)}ve===1&&!SC(R,c.getBoundingClientRect())&&v(),fe=!1}try{l=new IntersectionObserver(le,{...ce,root:h.ownerDocument})}catch{l=new IntersectionObserver(le,ce)}l.observe(c)}return v(!0),y}function L_(c,a,l,f){f===void 0&&(f={});const{ancestorScroll:h=!0,ancestorResize:y=!0,elementResize:v=typeof ResizeObserver=="function",layoutShift:C=typeof IntersectionObserver=="function",animationFrame:x=!1}=f,R=y0(c),A=h||y?[...R?Tp(R):[],...Tp(a)]:[];A.forEach(de=>{h&&de.addEventListener("scroll",l,{passive:!0}),y&&de.addEventListener("resize",l)});const k=R&&C?D_(R,l):null;let _=-1,N=null;v&&(N=new ResizeObserver(de=>{let[ue]=de;ue&&ue.target===R&&N&&(N.unobserve(a),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var ce;(ce=N)==null||ce.observe(a)})),l()}),R&&!x&&N.observe(R),N.observe(a));let z,G=x?$u(c):null;x&&J();function J(){const de=$u(c);G&&!SC(G,de)&&l(),G=de,z=requestAnimationFrame(J)}return l(),()=>{var de;A.forEach(ue=>{h&&ue.removeEventListener("scroll",l),y&&ue.removeEventListener("resize",l)}),k?.(),(de=N)==null||de.disconnect(),N=null,x&&cancelAnimationFrame(z)}}const P_=i_,I_=o_,U_=n_,z_=s_,F_=r_,wC=t_,j_=l_,B_=(c,a,l)=>{const f=new Map,h={platform:N_,...l},y={...h.platform,_c:f};return e_(c,a,{...h,platform:y})};var H_=typeof document<"u",V_=function(){},Kv=H_?Q.useLayoutEffect:V_;function Qv(c,a){if(c===a)return!0;if(typeof c!=typeof a)return!1;if(typeof c=="function"&&c.toString()===a.toString())return!0;let l,f,h;if(c&&a&&typeof c=="object"){if(Array.isArray(c)){if(l=c.length,l!==a.length)return!1;for(f=l;f--!==0;)if(!Qv(c[f],a[f]))return!1;return!0}if(h=Object.keys(c),l=h.length,l!==Object.keys(a).length)return!1;for(f=l;f--!==0;)if(!{}.hasOwnProperty.call(a,h[f]))return!1;for(f=l;f--!==0;){const y=h[f];if(!(y==="_owner"&&c.$$typeof)&&!Qv(c[y],a[y]))return!1}return!0}return c!==c&&a!==a}function bC(c){return typeof window>"u"?1:(c.ownerDocument.defaultView||window).devicePixelRatio||1}function xC(c,a){const l=bC(c);return Math.round(a*l)/l}function b0(c){const a=Q.useRef(c);return Kv(()=>{a.current=c}),a}function $_(c){c===void 0&&(c={});const{placement:a="bottom",strategy:l="absolute",middleware:f=[],platform:h,elements:{reference:y,floating:v}={},transform:C=!0,whileElementsMounted:x,open:R}=c,[A,k]=Q.useState({x:0,y:0,strategy:l,placement:a,middlewareData:{},isPositioned:!1}),[_,N]=Q.useState(f);Qv(_,f)||N(f);const[z,G]=Q.useState(null),[J,de]=Q.useState(null),ue=Q.useCallback($=>{$!==Re.current&&(Re.current=$,G($))},[]),ce=Q.useCallback($=>{$!==ve.current&&(ve.current=$,de($))},[]),fe=y||z,le=v||J,Re=Q.useRef(null),ve=Q.useRef(null),xe=Q.useRef(A),tt=x!=null,dt=b0(x),Rt=b0(h),lt=b0(R),Ae=Q.useCallback(()=>{if(!Re.current||!ve.current)return;const $={placement:a,strategy:l,middleware:_};Rt.current&&($.platform=Rt.current),B_(Re.current,ve.current,$).then(ke=>{const Ce={...ke,isPositioned:lt.current!==!1};rt.current&&!Qv(xe.current,Ce)&&(xe.current=Ce,Zy.flushSync(()=>{k(Ce)}))})},[_,a,l,Rt,lt]);Kv(()=>{R===!1&&xe.current.isPositioned&&(xe.current.isPositioned=!1,k($=>({...$,isPositioned:!1})))},[R]);const rt=Q.useRef(!1);Kv(()=>(rt.current=!0,()=>{rt.current=!1}),[]),Kv(()=>{if(fe&&(Re.current=fe),le&&(ve.current=le),fe&&le){if(dt.current)return dt.current(fe,le,Ae);Ae()}},[fe,le,Ae,dt,tt]);const st=Q.useMemo(()=>({reference:Re,floating:ve,setReference:ue,setFloating:ce}),[ue,ce]),qe=Q.useMemo(()=>({reference:fe,floating:le}),[fe,le]),Te=Q.useMemo(()=>{const $={position:l,left:0,top:0};if(!qe.floating)return $;const ke=xC(qe.floating,A.x),Ce=xC(qe.floating,A.y);return C?{...$,transform:"translate("+ke+"px, "+Ce+"px)",...bC(qe.floating)>=1.5&&{willChange:"transform"}}:{position:l,left:ke,top:Ce}},[l,C,qe.floating,A.x,A.y]);return Q.useMemo(()=>({...A,update:Ae,refs:st,elements:qe,floatingStyles:Te}),[A,Ae,st,qe,Te])}const G_=c=>{function a(l){return{}.hasOwnProperty.call(l,"current")}return{name:"arrow",options:c,fn(l){const{element:f,padding:h}=typeof c=="function"?c(l):c;return f&&a(f)?f.current!=null?wC({element:f.current,padding:h}).fn(l):{}:f?wC({element:f,padding:h}).fn(l):{}}}},Y_=(c,a)=>({...P_(c),options:[c,a]}),W_=(c,a)=>({...I_(c),options:[c,a]}),X_=(c,a)=>({...j_(c),options:[c,a]}),K_=(c,a)=>({...U_(c),options:[c,a]}),Q_=(c,a)=>({...z_(c),options:[c,a]}),q_=(c,a)=>({...F_(c),options:[c,a]}),Z_=(c,a)=>({...G_(c),options:[c,a]});var J_="Arrow",CC=Q.forwardRef((c,a)=>{const{children:l,width:f=10,height:h=5,...y}=c;return I.jsx(Hu.svg,{...y,ref:a,width:f,height:h,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:c.asChild?l:I.jsx("polygon",{points:"0,0 30,0 15,10"})})});CC.displayName=J_;var eA=CC;function tA(c){const[a,l]=Q.useState(void 0);return Vu(()=>{if(c){l({width:c.offsetWidth,height:c.offsetHeight});const f=new ResizeObserver(h=>{if(!Array.isArray(h)||!h.length)return;const y=h[0];let v,C;if("borderBoxSize"in y){const x=y.borderBoxSize,R=Array.isArray(x)?x[0]:x;v=R.inlineSize,C=R.blockSize}else v=c.offsetWidth,C=c.offsetHeight;l({width:v,height:C})});return f.observe(c,{box:"border-box"}),()=>f.unobserve(c)}else l(void 0)},[c]),a}var x0="Popper",[EC,TC]=Qx(x0),[nA,RC]=EC(x0),MC=c=>{const{__scopePopper:a,children:l}=c,[f,h]=Q.useState(null);return I.jsx(nA,{scope:a,anchor:f,onAnchorChange:h,children:l})};MC.displayName=x0;var kC="PopperAnchor",_C=Q.forwardRef((c,a)=>{const{__scopePopper:l,virtualRef:f,...h}=c,y=RC(kC,l),v=Q.useRef(null),C=ju(a,v);return Q.useEffect(()=>{y.onAnchorChange(f?.current||v.current)}),f?null:I.jsx(Hu.div,{...h,ref:C})});_C.displayName=kC;var C0="PopperContent",[rA,aA]=EC(C0),AC=Q.forwardRef((c,a)=>{const{__scopePopper:l,side:f="bottom",sideOffset:h=0,align:y="center",alignOffset:v=0,arrowPadding:C=0,avoidCollisions:x=!0,collisionBoundary:R=[],collisionPadding:A=0,sticky:k="partial",hideWhenDetached:_=!1,updatePositionStrategy:N="optimized",onPlaced:z,...G}=c,J=RC(C0,l),[de,ue]=Q.useState(null),ce=ju(a,Ve=>ue(Ve)),[fe,le]=Q.useState(null),Re=tA(fe),ve=Re?.width??0,xe=Re?.height??0,tt=f+(y!=="center"?"-"+y:""),dt=typeof A=="number"?A:{top:0,right:0,bottom:0,left:0,...A},Rt=Array.isArray(R)?R:[R],lt=Rt.length>0,Ae={padding:dt,boundary:Rt.filter(oA),altBoundary:lt},{refs:rt,floatingStyles:st,placement:qe,isPositioned:Te,middlewareData:$}=$_({strategy:"fixed",placement:tt,whileElementsMounted:(...Ve)=>L_(...Ve,{animationFrame:N==="always"}),elements:{reference:J.anchor},middleware:[Y_({mainAxis:h+xe,alignmentAxis:v}),x&&W_({mainAxis:!0,crossAxis:!1,limiter:k==="partial"?X_():void 0,...Ae}),x&&K_({...Ae}),Q_({...Ae,apply:({elements:Ve,rects:St,availableWidth:wt,availableHeight:$t})=>{const{width:gn,height:Un}=St.reference,yn=Ve.floating.style;yn.setProperty("--radix-popper-available-width",`${wt}px`),yn.setProperty("--radix-popper-available-height",`${$t}px`),yn.setProperty("--radix-popper-anchor-width",`${gn}px`),yn.setProperty("--radix-popper-anchor-height",`${Un}px`)}}),fe&&Z_({element:fe,padding:C}),lA({arrowWidth:ve,arrowHeight:xe}),_&&q_({strategy:"referenceHidden",...Ae})]}),[ke,Ce]=DC(qe),V=Bv(z);Vu(()=>{Te&&V?.()},[Te,V]);const oe=$.arrow?.x,Be=$.arrow?.y,He=$.arrow?.centerOffset!==0,[yt,xt]=Q.useState();return Vu(()=>{de&&xt(window.getComputedStyle(de).zIndex)},[de]),I.jsx("div",{ref:rt.setFloating,"data-radix-popper-content-wrapper":"",style:{...st,transform:Te?st.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:yt,"--radix-popper-transform-origin":[$.transformOrigin?.x,$.transformOrigin?.y].join(" "),...$.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:c.dir,children:I.jsx(rA,{scope:l,placedSide:ke,onArrowChange:le,arrowX:oe,arrowY:Be,shouldHideArrow:He,children:I.jsx(Hu.div,{"data-side":ke,"data-align":Ce,...G,ref:ce,style:{...G.style,animation:Te?void 0:"none"}})})})});AC.displayName=C0;var OC="PopperArrow",iA={top:"bottom",right:"left",bottom:"top",left:"right"},NC=Q.forwardRef(function(a,l){const{__scopePopper:f,...h}=a,y=aA(OC,f),v=iA[y.placedSide];return I.jsx("span",{ref:y.onArrowChange,style:{position:"absolute",left:y.arrowX,top:y.arrowY,[v]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[y.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[y.placedSide],visibility:y.shouldHideArrow?"hidden":void 0},children:I.jsx(eA,{...h,ref:l,style:{...h.style,display:"block"}})})});NC.displayName=OC;function oA(c){return c!==null}var lA=c=>({name:"transformOrigin",options:c,fn(a){const{placement:l,rects:f,middlewareData:h}=a,v=h.arrow?.centerOffset!==0,C=v?0:c.arrowWidth,x=v?0:c.arrowHeight,[R,A]=DC(l),k={start:"0%",center:"50%",end:"100%"}[A],_=(h.arrow?.x??0)+C/2,N=(h.arrow?.y??0)+x/2;let z="",G="";return R==="bottom"?(z=v?k:`${_}px`,G=`${-x}px`):R==="top"?(z=v?k:`${_}px`,G=`${f.floating.height+x}px`):R==="right"?(z=`${-x}px`,G=v?k:`${N}px`):R==="left"&&(z=`${f.floating.width+x}px`,G=v?k:`${N}px`),{data:{x:z,y:G}}}});function DC(c){const[a,l="center"]=c.split("-");return[a,l]}var sA=MC,uA=_C,cA=AC,fA=NC;function dA(c,a){return Q.useReducer((l,f)=>a[l][f]??l,c)}var LC=c=>{const{present:a,children:l}=c,f=pA(a),h=typeof l=="function"?l({present:f.isPresent}):Q.Children.only(l),y=ju(f.ref,hA(h));return typeof l=="function"||f.isPresent?Q.cloneElement(h,{ref:y}):null};LC.displayName="Presence";function pA(c){const[a,l]=Q.useState(),f=Q.useRef(null),h=Q.useRef(c),y=Q.useRef("none"),v=c?"mounted":"unmounted",[C,x]=dA(v,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Q.useEffect(()=>{const R=qv(f.current);y.current=C==="mounted"?R:"none"},[C]),Vu(()=>{const R=f.current,A=h.current;if(A!==c){const _=y.current,N=qv(R);c?x("MOUNT"):N==="none"||R?.display==="none"?x("UNMOUNT"):x(A&&_!==N?"ANIMATION_OUT":"UNMOUNT"),h.current=c}},[c,x]),Vu(()=>{if(a){let R;const A=a.ownerDocument.defaultView??window,k=N=>{const G=qv(f.current).includes(N.animationName);if(N.target===a&&G&&(x("ANIMATION_END"),!h.current)){const J=a.style.animationFillMode;a.style.animationFillMode="forwards",R=A.setTimeout(()=>{a.style.animationFillMode==="forwards"&&(a.style.animationFillMode=J)})}},_=N=>{N.target===a&&(y.current=qv(f.current))};return a.addEventListener("animationstart",_),a.addEventListener("animationcancel",k),a.addEventListener("animationend",k),()=>{A.clearTimeout(R),a.removeEventListener("animationstart",_),a.removeEventListener("animationcancel",k),a.removeEventListener("animationend",k)}}else x("ANIMATION_END")},[a,x]),{isPresent:["mounted","unmountSuspended"].includes(C),ref:Q.useCallback(R=>{f.current=R?getComputedStyle(R):null,l(R)},[])}}function qv(c){return c?.animationName||"none"}function hA(c){let a=Object.getOwnPropertyDescriptor(c.props,"ref")?.get,l=a&&"isReactWarning"in a&&a.isReactWarning;return l?c.ref:(a=Object.getOwnPropertyDescriptor(c,"ref")?.get,l=a&&"isReactWarning"in a&&a.isReactWarning,l?c.props.ref:c.props.ref||c.ref)}var vA=ax[" useInsertionEffect ".trim().toString()]||Vu;function mA({prop:c,defaultProp:a,onChange:l=()=>{},caller:f}){const[h,y,v]=gA({defaultProp:a,onChange:l}),C=c!==void 0,x=C?c:h;{const A=Q.useRef(c!==void 0);Q.useEffect(()=>{const k=A.current;k!==C&&console.warn(`${f} is changing from ${k?"controlled":"uncontrolled"} to ${C?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),A.current=C},[C,f])}const R=Q.useCallback(A=>{if(C){const k=yA(A)?A(c):A;k!==c&&v.current?.(k)}else y(A)},[C,c,y,v]);return[x,R]}function gA({defaultProp:c,onChange:a}){const[l,f]=Q.useState(c),h=Q.useRef(l),y=Q.useRef(a);return vA(()=>{y.current=a},[a]),Q.useEffect(()=>{h.current!==l&&(y.current?.(l),h.current=l)},[l,h]),[l,f,y]}function yA(c){return typeof c=="function"}var SA=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),wA="VisuallyHidden",PC=Q.forwardRef((c,a)=>I.jsx(Hu.span,{...c,ref:a,style:{...SA,...c.style}}));PC.displayName=wA;var bA=PC,[Zv,o3]=Qx("Tooltip",[TC]),Jv=TC(),IC="TooltipProvider",xA=700,E0="tooltip.open",[CA,T0]=Zv(IC),em=c=>{const{__scopeTooltip:a,delayDuration:l=xA,skipDelayDuration:f=300,disableHoverableContent:h=!1,children:y}=c,v=Q.useRef(!0),C=Q.useRef(!1),x=Q.useRef(0);return Q.useEffect(()=>{const R=x.current;return()=>window.clearTimeout(R)},[]),I.jsx(CA,{scope:a,isOpenDelayedRef:v,delayDuration:l,onOpen:Q.useCallback(()=>{window.clearTimeout(x.current),v.current=!1},[]),onClose:Q.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>v.current=!0,f)},[f]),isPointerInTransitRef:C,onPointerInTransitChange:Q.useCallback(R=>{C.current=R},[]),disableHoverableContent:h,children:y})};em.displayName=IC;var Rp="Tooltip",[EA,tm]=Zv(Rp),UC=c=>{const{__scopeTooltip:a,children:l,open:f,defaultOpen:h,onOpenChange:y,disableHoverableContent:v,delayDuration:C}=c,x=T0(Rp,c.__scopeTooltip),R=Jv(a),[A,k]=Q.useState(null),_=Hk(),N=Q.useRef(0),z=v??x.disableHoverableContent,G=C??x.delayDuration,J=Q.useRef(!1),[de,ue]=mA({prop:f,defaultProp:h??!1,onChange:ve=>{ve?(x.onOpen(),document.dispatchEvent(new CustomEvent(E0))):x.onClose(),y?.(ve)},caller:Rp}),ce=Q.useMemo(()=>de?J.current?"delayed-open":"instant-open":"closed",[de]),fe=Q.useCallback(()=>{window.clearTimeout(N.current),N.current=0,J.current=!1,ue(!0)},[ue]),le=Q.useCallback(()=>{window.clearTimeout(N.current),N.current=0,ue(!1)},[ue]),Re=Q.useCallback(()=>{window.clearTimeout(N.current),N.current=window.setTimeout(()=>{J.current=!0,ue(!0),N.current=0},G)},[G,ue]);return Q.useEffect(()=>()=>{N.current&&(window.clearTimeout(N.current),N.current=0)},[]),I.jsx(sA,{...R,children:I.jsx(EA,{scope:a,contentId:_,open:de,stateAttribute:ce,trigger:A,onTriggerChange:k,onTriggerEnter:Q.useCallback(()=>{x.isOpenDelayedRef.current?Re():fe()},[x.isOpenDelayedRef,Re,fe]),onTriggerLeave:Q.useCallback(()=>{z?le():(window.clearTimeout(N.current),N.current=0)},[le,z]),onOpen:fe,onClose:le,disableHoverableContent:z,children:l})})};UC.displayName=Rp;var R0="TooltipTrigger",zC=Q.forwardRef((c,a)=>{const{__scopeTooltip:l,...f}=c,h=tm(R0,l),y=T0(R0,l),v=Jv(l),C=Q.useRef(null),x=ju(a,C,h.onTriggerChange),R=Q.useRef(!1),A=Q.useRef(!1),k=Q.useCallback(()=>R.current=!1,[]);return Q.useEffect(()=>()=>document.removeEventListener("pointerup",k),[k]),I.jsx(uA,{asChild:!0,...v,children:I.jsx(Hu.button,{"aria-describedby":h.open?h.contentId:void 0,"data-state":h.stateAttribute,...f,ref:x,onPointerMove:zl(c.onPointerMove,_=>{_.pointerType!=="touch"&&!A.current&&!y.isPointerInTransitRef.current&&(h.onTriggerEnter(),A.current=!0)}),onPointerLeave:zl(c.onPointerLeave,()=>{h.onTriggerLeave(),A.current=!1}),onPointerDown:zl(c.onPointerDown,()=>{h.open&&h.onClose(),R.current=!0,document.addEventListener("pointerup",k,{once:!0})}),onFocus:zl(c.onFocus,()=>{R.current||h.onOpen()}),onBlur:zl(c.onBlur,h.onClose),onClick:zl(c.onClick,h.onClose)})})});zC.displayName=R0;var TA="TooltipPortal",[l3,RA]=Zv(TA,{forceMount:void 0}),Cf="TooltipContent",FC=Q.forwardRef((c,a)=>{const l=RA(Cf,c.__scopeTooltip),{forceMount:f=l.forceMount,side:h="top",...y}=c,v=tm(Cf,c.__scopeTooltip);return I.jsx(LC,{present:f||v.open,children:v.disableHoverableContent?I.jsx(jC,{side:h,...y,ref:a}):I.jsx(MA,{side:h,...y,ref:a})})}),MA=Q.forwardRef((c,a)=>{const l=tm(Cf,c.__scopeTooltip),f=T0(Cf,c.__scopeTooltip),h=Q.useRef(null),y=ju(a,h),[v,C]=Q.useState(null),{trigger:x,onClose:R}=l,A=h.current,{onPointerInTransitChange:k}=f,_=Q.useCallback(()=>{C(null),k(!1)},[k]),N=Q.useCallback((z,G)=>{const J=z.currentTarget,de={x:z.clientX,y:z.clientY},ue=NA(de,J.getBoundingClientRect()),ce=DA(de,ue),fe=LA(G.getBoundingClientRect()),le=IA([...ce,...fe]);C(le),k(!0)},[k]);return Q.useEffect(()=>()=>_(),[_]),Q.useEffect(()=>{if(x&&A){const z=J=>N(J,A),G=J=>N(J,x);return x.addEventListener("pointerleave",z),A.addEventListener("pointerleave",G),()=>{x.removeEventListener("pointerleave",z),A.removeEventListener("pointerleave",G)}}},[x,A,N,_]),Q.useEffect(()=>{if(v){const z=G=>{const J=G.target,de={x:G.clientX,y:G.clientY},ue=x?.contains(J)||A?.contains(J),ce=!PA(de,v);ue?_():ce&&(_(),R())};return document.addEventListener("pointermove",z),()=>document.removeEventListener("pointermove",z)}},[x,A,v,R,_]),I.jsx(jC,{...c,ref:y})}),[kA,_A]=Zv(Rp,{isInside:!1}),AA=DM("TooltipContent"),jC=Q.forwardRef((c,a)=>{const{__scopeTooltip:l,children:f,"aria-label":h,onEscapeKeyDown:y,onPointerDownOutside:v,...C}=c,x=tm(Cf,l),R=Jv(l),{onClose:A}=x;return Q.useEffect(()=>(document.addEventListener(E0,A),()=>document.removeEventListener(E0,A)),[A]),Q.useEffect(()=>{if(x.trigger){const k=_=>{_.target?.contains(x.trigger)&&A()};return window.addEventListener("scroll",k,{capture:!0}),()=>window.removeEventListener("scroll",k,{capture:!0})}},[x.trigger,A]),I.jsx(Jx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:y,onPointerDownOutside:v,onFocusOutside:k=>k.preventDefault(),onDismiss:A,children:I.jsxs(cA,{"data-state":x.stateAttribute,...R,...C,ref:a,style:{...C.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[I.jsx(AA,{children:f}),I.jsx(kA,{scope:l,isInside:!0,children:I.jsx(bA,{id:x.contentId,role:"tooltip",children:h||f})})]})})});FC.displayName=Cf;var BC="TooltipArrow",OA=Q.forwardRef((c,a)=>{const{__scopeTooltip:l,...f}=c,h=Jv(l);return _A(BC,l).isInside?null:I.jsx(fA,{...h,...f,ref:a})});OA.displayName=BC;function NA(c,a){const l=Math.abs(a.top-c.y),f=Math.abs(a.bottom-c.y),h=Math.abs(a.right-c.x),y=Math.abs(a.left-c.x);switch(Math.min(l,f,h,y)){case y:return"left";case h:return"right";case l:return"top";case f:return"bottom";default:throw new Error("unreachable")}}function DA(c,a,l=5){const f=[];switch(a){case"top":f.push({x:c.x-l,y:c.y+l},{x:c.x+l,y:c.y+l});break;case"bottom":f.push({x:c.x-l,y:c.y-l},{x:c.x+l,y:c.y-l});break;case"left":f.push({x:c.x+l,y:c.y-l},{x:c.x+l,y:c.y+l});break;case"right":f.push({x:c.x-l,y:c.y-l},{x:c.x-l,y:c.y+l});break}return f}function LA(c){const{top:a,right:l,bottom:f,left:h}=c;return[{x:h,y:a},{x:l,y:a},{x:l,y:f},{x:h,y:f}]}function PA(c,a){const{x:l,y:f}=c;let h=!1;for(let y=0,v=a.length-1;y<a.length;v=y++){const C=a[y],x=a[v],R=C.x,A=C.y,k=x.x,_=x.y;A>f!=_>f&&l<(k-R)*(f-A)/(_-A)+R&&(h=!h)}return h}function IA(c){const a=c.slice();return a.sort((l,f)=>l.x<f.x?-1:l.x>f.x?1:l.y<f.y?-1:l.y>f.y?1:0),UA(a)}function UA(c){if(c.length<=1)return c.slice();const a=[];for(let f=0;f<c.length;f++){const h=c[f];for(;a.length>=2;){const y=a[a.length-1],v=a[a.length-2];if((y.x-v.x)*(h.y-v.y)>=(y.y-v.y)*(h.x-v.x))a.pop();else break}a.push(h)}a.pop();const l=[];for(let f=c.length-1;f>=0;f--){const h=c[f];for(;l.length>=2;){const y=l[l.length-1],v=l[l.length-2];if((y.x-v.x)*(h.y-v.y)>=(y.y-v.y)*(h.x-v.x))l.pop();else break}l.push(h)}return l.pop(),a.length===1&&l.length===1&&a[0].x===l[0].x&&a[0].y===l[0].y?a:a.concat(l)}var zA=em,FA=UC,jA=zC,HC=FC;const BA=zA,M0=FA,k0=jA,nm=Q.forwardRef(({className:c,sideOffset:a=4,...l},f)=>I.jsx(HC,{ref:f,sideOffset:a,className:Hx("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",c),...l}));nm.displayName=HC.displayName;const HA=()=>{const{setState:c,setMenuType:a}=Ft(),{isFullscreen:l,toggleFullscreen:f}=bp(),h=Q.useRef(null),y=()=>{a(Pt.COUNTDOWN),c(ot.COUNTDOWN),setTimeout(()=>{c(ot.PLAYING)},3e3)},v=()=>{a(Pt.SETTINGS)},C=()=>{const x=h.current?.closest("sigurd-startup");x?f(x):f()};return I.jsxs("div",{className:"flex flex-col items-center justify-center h-full rounded-lg",children:[I.jsx(BA,{children:I.jsxs(M0,{children:[I.jsx(k0,{asChild:!0,children:I.jsx(vi,{onClick:C,variant:"outline",className:"absolute top-4 right-4 bg-background-80 text-foreground backdrop-blur-sm border-none hover:bg-primary hover:text-black h-10 w-10",children:l?I.jsx(Xx,{className:"text-foreground hover:text-primary",size:24}):I.jsx(Wx,{className:"text-foreground hover:text-primary",size:24})})}),I.jsx(nm,{children:l?"Avslutt fullskjerm (F11 eller F)":"Fullskjerm (F11 eller F)"})]})}),I.jsxs("div",{className:"text-center mb-8",children:[I.jsx("h1",{className:"text-4xl font-bold text-white mb-2",children:"Sigurd Startup"}),I.jsx("p",{className:"text-muted-foreground",children:"Samle så mye finansiering som mulig!"})]}),I.jsxs("div",{className:"space-y-4 w-[70%]",children:[I.jsxs(vi,{onClick:y,className:"w-full bg-primary hover:bg-primary-80 text-white font-bold py-3 text-lg transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(s0,{size:20}),"Start"]}),I.jsxs(vi,{onClick:v,variant:"outline",className:"w-full border-secondary text-muted-foreground hover:bg-secondary hover:text-white font-bold py-3 text-lg transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(Kx,{size:20}),"Innstillinger"]})]})]})},VA=()=>{const[c,a]=Q.useState(3),{currentMap:l}=Ft();return Q.useEffect(()=>{{const f=setInterval(()=>{a(h=>h>1?h-1:0)},1e3);return()=>clearInterval(f)}},[]),c===0?null:I.jsx("div",{className:"text-center",children:I.jsxs(I.Fragment,{children:[I.jsx("div",{className:"text-8xl font-bold text-primary",children:c}),I.jsxs("div",{className:"flex items-center justify-center gap-2",children:[I.jsx("div",{className:"w-2 h-2 bg-white rounded-full p-1 animate-pulse"}),I.jsx("p",{className:"text-2xl text-white uppercase italic",children:l?.name}),I.jsx("div",{className:"w-2 h-2 bg-white rounded-full p-1 animate-pulse"})]})]})})},$A=()=>{const{score:c,lives:a,currentLevel:l,setState:f,setMenuType:h,isPaused:y,multiplier:v,multiplierScore:C}=Ft(),x=Q.useRef(null),{isFullscreen:R,toggleFullscreen:A}=bp(),k=()=>{y?f(ot.PLAYING):(f(ot.PAUSED),h(Pt.PAUSE))},_=()=>{const z=x.current?.closest("sigurd-startup");z?A(z):A()},N=ZR(C,v);return I.jsxs("div",{ref:x,className:"flex justify-between items-center w-full h-full",children:[I.jsx("div",{className:"absolute top-4 left-1/2 transform -translate-x-1/2 z-10 bg-background-80 text-foreground px-4 py-2 rounded-lg backdrop-blur-sm pointer-events-auto",children:I.jsxs("div",{className:"flex items-center gap-4 text-sm font-mono",children:[I.jsx("div",{className:"text-center",children:I.jsxs("div",{className:"text-primary font-bold flex items-center gap-1",children:[I.jsx(Ck,{size:16}),c.toLocaleString()]})}),I.jsx("div",{className:"w-px h-8 bg-border"}),I.jsx("div",{className:"text-center",children:I.jsxs("div",{className:"text-primary font-bold flex items-center gap-1",children:[I.jsx(Tk,{size:16}),l.toLocaleString()]})}),I.jsx("div",{className:"w-px h-8 bg-border"}),I.jsxs("div",{className:"min-w-20 flex justify-center border border-primary p-1 rounded-lg relative overflow-hidden",children:[I.jsx("div",{className:"absolute inset-0 bg-primary-20 transition-all duration-300 ease-out",style:{width:`${N*100}%`}}),I.jsxs("div",{className:"text-primary text-center font-bold flex items-center gap-1 relative z-10",children:[I.jsx(kk,{size:16}),"x",v]})]})]})}),I.jsxs("div",{className:"flex items-center space-x-4 absolute right-4 top-4",children:[I.jsx(em,{children:I.jsxs(M0,{children:[I.jsx(k0,{asChild:!0,children:I.jsx(vi,{onClick:k,variant:"outline",className:"bg-background-80 text-foreground backdrop-blur-sm border-none hover:bg-primary hover:text-black h-10 w-10",children:y?I.jsx(s0,{className:"text-white hover:text-primary",size:24}):I.jsx(Rk,{className:"text-foreground hover:text-primary",size:24})})}),I.jsx(nm,{children:"Pause Spill (P)"})]})}),I.jsx(em,{children:I.jsxs(M0,{children:[I.jsx(k0,{asChild:!0,children:I.jsx(vi,{onClick:_,variant:"outline",className:"bg-background-80 text-foreground backdrop-blur-sm border-none hover:bg-primary hover:text-black h-10 w-10",children:R?I.jsx(Xx,{className:"text-foreground hover:text-primary",size:24}):I.jsx(Wx,{className:"text-foreground hover:text-primary",size:24})})}),I.jsx(nm,{children:R?"Avslutt fullskjerm (F11 eller F)":"Fullskjerm (F11 eller F)"})]})})]}),I.jsx("div",{className:`absolute left-3 bottom-2 ${R?"bottom-4":"bottom-2"}`,children:I.jsxs("div",{className:"text-xl font-bold text-red-400 flex items-center gap-1",children:[Array.from({length:3}).map((z,G)=>I.jsx(Ek,{color:"#ff3143",size:R?25:20,fill:G<a?"#ff3143":"none"},G)),a>3?I.jsxs("p",{children:["+ ",a-3]}):""]})})]})},GA=()=>{const{setState:c,setMenuType:a,resetGame:l}=Ft(),f=()=>{a(Pt.COUNTDOWN),c(ot.COUNTDOWN),setTimeout(()=>{c(ot.PLAYING)},3e3)},h=()=>{a(Pt.SETTINGS)},y=()=>{l(),c(ot.MENU),a(Pt.START)},v=()=>{const{resetBombState:C,resetPlayer:x,resetEffects:R,clearAllFloatingTexts:A,currentMap:k}=Ft.getState();if(C(),x(),R(),A(),k){const{initializeLevel:_}=Ft.getState();_(k)}c(ot.MENU),a(Pt.COUNTDOWN),c(ot.COUNTDOWN),setTimeout(()=>{c(ot.PLAYING)},3e3)};return I.jsx("div",{className:"flex flex-col items-center justify-center h-full",children:I.jsxs("div",{className:"space-y-4",children:[I.jsxs(vi,{onClick:f,className:"w-full bg-primary hover:bg-primary-80 text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(s0,{size:20}),"Fortsett"]}),I.jsxs(vi,{onClick:h,variant:"outline",className:"w-full border-secondary text-muted-foreground bg-secondary hover:text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(Kx,{size:20}),"Innstillinger"]}),I.jsxs(vi,{onClick:v,variant:"outline",className:"w-full border-secondary text-muted-foreground bg-secondary hover:text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(Mk,{size:20}),"Start på nytt"]}),I.jsxs(vi,{onClick:y,variant:"default",className:"w-full bg-red-600 hover:bg-red-600/80 text-white font-bold py-3 text-md transition-all duration-200 uppercase flex items-center justify-center gap-2",children:[I.jsx(Yx,{size:20}),"hovedmeny"]})]})})},YA=()=>{const{setMenuType:c,previousMenu:a}=Ft(),l=Ft(k=>k.audioSettings),f=Ft(k=>k.updateAudioSettings),{masterVolume:h,musicVolume:y,sfxVolume:v,masterMuted:C,musicMuted:x,sfxMuted:R}=l||{masterVolume:80,musicVolume:70,sfxVolume:90,masterMuted:!1,musicMuted:!1,sfxMuted:!1},A=()=>{c(a||Pt.START)};return I.jsxs("div",{className:"flex flex-col items-center justify-center h-full w-full",children:[I.jsxs("div",{className:"flex items-center mb-6 w-[70%] gap-2",children:[I.jsx(vi,{onClick:A,variant:"default",className:"bg-primary hover:bg-primary/80 text-white w-10 h-10",children:I.jsx(Gx,{size:25})}),I.jsx("h2",{className:"text-2xl font-bold text-white uppercase",children:"Innstillinger"})]}),I.jsxs("div",{className:"space-y-2 w-[70%]",children:[I.jsxs("div",{className:"p-3 bg-card rounded-md",children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Master volum"}),I.jsx("button",{onClick:()=>f({masterMuted:!C}),className:`px-3 py-1 rounded text-sm font-mono ${C?"bg-red-600 text-white":"bg-secondary text-white"}`,children:C?"Muted":`${h}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:C?0:h,onChange:k=>f({masterVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:C})]}),I.jsxs("div",{className:"p-3 bg-card rounded-md",children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Musikk volum"}),I.jsx("button",{onClick:()=>f({musicMuted:!x}),className:`px-3 py-1 rounded text-sm font-mono ${x?"bg-red-600 text-white":"bg-secondary text-white"}`,children:x?"Muted":`${y}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:x?0:y,onChange:k=>f({musicVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:x})]}),I.jsxs("div",{className:"p-3 bg-card rounded-md",children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Lyd effekter"}),I.jsx("button",{onClick:()=>f({sfxMuted:!R}),className:`px-3 py-1 rounded text-sm font-mono ${R?"bg-red-600 text-white":"bg-secondary text-white"}`,children:R?"Muted":`${v}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:R?0:v,onChange:k=>f({sfxVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:R})]}),I.jsx("div",{className:"text-center text-sm text-gray-400",children:I.jsx("p",{children:"(Trykk på tallene for å mute lyd)"})})]})]})},WA=(c,a={})=>{const{duration:l=3e3,steps:f=60,easing:h="ease-out",delay:y=0,onComplete:v}=a,[C,x]=Q.useState(0),R=Q.useRef(!1),A=Q.useRef(c);return Q.useEffect(()=>{if(c===0){x(0),R.current=!1;return}if(A.current!==c&&(R.current=!1,x(0),A.current=c),R.current){x(c);return}const k=setTimeout(()=>{const _=l/f;let N=0;const z=setInterval(()=>{N++;const G=N/f;let J;switch(h){case"linear":J=G;break;case"ease-out":J=1-(1-G)*(1-G);break;case"gentle-ease-out":J=1-Math.pow(1-G,1.5);break;case"ease-in":J=G*G;break;case"ease-in-out":J=G<.5?2*G*G:1-Math.pow(-2*G+2,2)/2;break;default:J=1-(1-G)*(1-G)}const de=c*J,ue=Math.round(de);x(ue),N>=f&&(x(c),R.current=!0,clearInterval(z),v&&v())},_);return()=>clearInterval(z)},y);return()=>clearTimeout(k)},[c,l,f,h,y,v]),C},XA=()=>{const{correctOrderCount:c,currentMap:a,currentLevel:l,nextLevel:f,setState:h,setMenuType:y,initializeLevel:v,setBonusAnimationComplete:C}=Ft(),x=H.BONUS_POINTS[c]||5e4,R=WA(x,{duration:6e3,steps:120,easing:"gentle-ease-out",delay:200,onComplete:()=>C(!0)});return I.jsxs("div",{className:"text-center max-w-md",children:[I.jsxs("h1",{className:"text-4xl font-bold text-primary mb-4 uppercase",children:[a?.name," Fullført!"]}),I.jsx("div",{className:"text-white mb-6 space-y-4",children:x>0&&I.jsxs("div",{className:"flex flex-col items-center justify-center gap-5",children:[I.jsxs("div",{className:"text-2xl",children:["Bra jobba! Du samlet"," ",I.jsx("span",{className:"font-bold text-primary animate-pulse",children:c})," ","av 23 finansiering og unngikk byrokratet!"," "]}),I.jsxs("div",{className:"text-4xl font-bold animate-pulse",children:[R.toLocaleString()," kr"]}),I.jsx("div",{className:"text-sm text-gray-400 mt-2",children:vf.length>l?`Fortsetter til ${vf[l]?.name||"Neste nivå"}...`:""})]})})]})},KA=()=>{const{score:c,resetGame:a}=Ft(),l=()=>{a()};return I.jsxs("div",{className:"text-center max-w-md flex flex-col items-center justify-center gap-4",children:[I.jsx("h1",{className:"text-2xl font-bold uppercase",children:"slutt"}),I.jsxs("div",{className:"text-white mb-6 space-y-4",children:[I.jsx("div",{className:"text-2xl text-primary",children:"Du har klart det umulige!"}),I.jsx("div",{className:"text-lg",children:"Du hjalp Sigurd med å unngå byrokratiske hindringer og samle finansiering."}),I.jsxs("div",{className:"text-2xl flex flex-col items-center justify-center gap-2",children:[I.jsx("div",{className:"text-foreground",children:"Total finansiering samlet:"}),I.jsx("div",{className:"font-bold text-3xl text-primary",children:c.toLocaleString()})]})]}),I.jsx("div",{className:"flex items-center justify-center gap-2",children:I.jsx("button",{onClick:l,className:"bg-primary text-white font-bold hover:bg-primary/80 rounded-lg py-1 px-3 text-lg transition-all duration-200 transform hover:scale-105 flex items-center justify-center gap-2",children:I.jsx(Yx,{className:"w-7 h-7",strokeWidth:2})})})]})},QA=()=>{const{score:c,resetGame:a,levelHistory:l}=Ft(),f=()=>{a()};return I.jsxs("div",{className:"bg-gradient-to-b rounded-lg text-center max-w-md",children:[I.jsx("h1",{className:"text-4xl font-bold text-red-400 mb-4 uppercase",children:"konkurs"}),I.jsxs("div",{className:"text-white mb-6 space-y-3",children:[I.jsx("div",{className:"text-2xl",children:I.jsxs("span",{className:"text-yellow-400",children:["Total finansiering:"," ",I.jsxs("span",{className:"font-bold text-white",children:[c.toLocaleString()," kr"]})]})}),l.length>0&&I.jsx("div",{className:"mt-6 border-t border-gray-600 pt-4",children:I.jsx("div",{className:"overflow-x-auto",children:I.jsxs("table",{className:"w-full text-sm",children:[I.jsx("thead",{children:I.jsxs("tr",{className:"border-b border-gray-600",children:[I.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Bane"}),I.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Mynter"}),I.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Finansiering"}),I.jsx("th",{className:"text-left py-2 px-2 text-primary font-semibold",children:"Bonus"})]})}),I.jsx("tbody",{children:l.map((h,y)=>I.jsxs("tr",{className:"border-b border-gray-700/50",children:[I.jsxs("td",{className:"py-2 px-2 text-gray-300",children:[h.level," (",h.mapName,")"]}),I.jsx("td",{className:"py-2 px-2 text-gray-300",children:h.coinsCollected}),I.jsx("td",{className:"py-2 px-2 text-gray-300",children:h.score.toLocaleString()}),I.jsx("td",{className:"py-2 px-2",children:h.bonus>0?I.jsxs("span",{className:"text-yellow-400 font-semibold",children:[h.bonus.toLocaleString()," kr"]}):I.jsx("span",{className:"text-gray-500",children:"-"})})]},y))})]})})})]}),I.jsx(vi,{onClick:f,className:"bg-primary hover:bg-primary/80 text-white font-bold py-3 px-8 text-lg transition-all duration-200 transform hover:scale-105 uppercase",children:"prøv igjen"})]})},qA=()=>{const{setMenuType:c,previousMenu:a}=Ft(),l=Ft(k=>k.audioSettings),f=Ft(k=>k.updateAudioSettings),{masterVolume:h,musicVolume:y,sfxVolume:v,masterMuted:C,musicMuted:x,sfxMuted:R}=l||{masterVolume:80,musicVolume:70,sfxVolume:90,masterMuted:!1,musicMuted:!1,sfxMuted:!1},A=()=>{c(a||Pt.START)};return I.jsx("div",{className:"flex items-center justify-center h-full",children:I.jsxs("div",{className:"bg-card backdrop-blur-sm rounded-xl p-6 border border-secondary max-w-md w-full",children:[I.jsxs("div",{className:"flex items-center mb-6 gap-2",children:[I.jsx(vi,{onClick:A,variant:"ghost",className:"text-muted-foreground hover:text-white p-1",children:I.jsx(Gx,{size:20})}),I.jsx("h2",{className:"text-xl font-bold text-primary",children:"Lydinnstillinger"})]}),I.jsxs("div",{className:"space-y-4",children:[I.jsxs("div",{children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Master Volume"}),I.jsx("button",{onClick:()=>f({masterMuted:!C}),className:`px-3 py-1 rounded text-sm font-mono ${C?"bg-red-600 text-white":"bg-secondary text-white"}`,children:C?"Muted":`${h}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:C?0:h,onChange:k=>f({masterVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:C})]}),I.jsxs("div",{children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Music Volume"}),I.jsx("button",{onClick:()=>f({musicMuted:!x}),className:`px-3 py-1 rounded text-sm font-mono ${x?"bg-red-600 text-white":"bg-secondary text-white"}`,children:x?"Muted":`${y}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:x?0:y,onChange:k=>f({musicVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:x})]}),I.jsxs("div",{children:[I.jsxs("div",{className:"flex justify-between items-center mb-2",children:[I.jsx("span",{className:"text-muted-foreground",children:"Sound Effects"}),I.jsx("button",{onClick:()=>f({sfxMuted:!R}),className:`px-3 py-1 rounded text-sm font-mono ${R?"bg-red-600 text-white":"bg-secondary text-white"}`,children:R?"Muted":`${v}%`})]}),I.jsx("input",{type:"range",min:"0",max:"100",value:R?0:v,onChange:k=>f({sfxVolume:Number(k.target.value)}),className:"w-full accent-primary",disabled:R})]})]})]})})},Xo=({children:c,transparent:a})=>I.jsx("div",{className:`absolute inset-0 flex items-center justify-center z-50 rounded-lg ${a?"bg-transparent":"bg-menu backdrop-blur-sm"}`,children:c}),ZA=c=>{const{currentState:a,setState:l,setMenuType:f,isPaused:h}=Ft();Q.useEffect(()=>{const y=v=>{if(!(v.target instanceof HTMLInputElement||v.target instanceof HTMLTextAreaElement))switch(v.key){case"F11":case"f":v.preventDefault(),c?.();break;case"Escape":document.fullscreenElement||document.webkitFullscreenElement?(v.preventDefault(),c?.()):a===ot.PLAYING&&(v.preventDefault(),h?l(ot.PLAYING):(l(ot.PAUSED),f(Pt.PAUSE)));break;case"p":case"P":a===ot.PLAYING&&(v.preventDefault(),h?l(ot.PLAYING):(l(ot.PAUSED),f(Pt.PAUSE)));break;case" ":a===ot.PAUSED&&(v.preventDefault(),f(Pt.COUNTDOWN),l(ot.COUNTDOWN),setTimeout(()=>{l(ot.PLAYING)},3e3));break}};return document.addEventListener("keydown",y),()=>{document.removeEventListener("keydown",y)}},[a,h,l,f,c])},JA=()=>{const[c,a]=Q.useState(!0);return Q.useEffect(()=>{yx.preloadAllBackgrounds().then(()=>{Ge.flow("All background images preloaded"),a(!1)}).catch(l=>{Ge.warn("Failed to preload some background images"),a(!1)})},[]),{isPreloading:c}},Ko={major:2,minor:2,patch:6,build:0,timestamp:1755082048800,hash:"37931M",full:"2.2.6"},_0=Ko.full,Gu=()=>({version:_0,major:Ko.major,minor:Ko.minor,patch:Ko.patch,build:Ko.build,timestamp:Ko.timestamp,hash:Ko.hash}),VC=()=>{console.log(`🎮 Sigurd Startup Game v${_0} (Build ${Ko.build})`),console.log(`📦 Hash: ${Ko.hash}`),console.log(`⏰ Built: ${new Date(Ko.timestamp).toISOString()}`)},eO=()=>{const{currentState:c,showMenu:a}=Ft(),l=Pv.useRef(null),{toggleFullscreen:f}=bp(),{isFullscreen:h}=bp(),{isPreloading:y}=JA();return ZA(()=>{const C=l.current?.closest("sigurd-startup");C?f(C):f()}),I.jsxs("div",{ref:l,className:"relative rounded-lg",children:[I.jsx(AM,{}),y&&I.jsx(Xo,{children:I.jsxs("div",{className:"text-white text-center",children:[I.jsx("div",{className:"text-lg font-bold mb-2",children:"Loading Backgrounds..."}),I.jsx("div",{className:"text-sm text-gray-300",children:"Please wait while we prepare your game"})]})}),Ya.ENABLED,I.jsxs("div",{className:`absolute bottom-3 right-3 ${h?"text-md":"text-xs"} text-muted-foreground z-40 ${h?"bottom-4":"bottom-3"}`,children:["v",_0," (Build ",Gu().build,")"]}),!y&&I.jsxs(I.Fragment,{children:[a===Pt.START&&I.jsx(Xo,{children:I.jsx(HA,{})}),a===Pt.COUNTDOWN&&I.jsx(Xo,{children:I.jsx(VA,{})}),a===Pt.PAUSE&&I.jsx(Xo,{children:I.jsx(GA,{})}),a===Pt.SETTINGS&&I.jsx(Xo,{children:I.jsx(YA,{})}),c===ot.PLAYING&&I.jsx(Xo,{transparent:!0,children:I.jsx($A,{})}),a===Pt.BONUS&&I.jsx(Xo,{children:I.jsx(XA,{})}),a===Pt.VICTORY&&I.jsx(Xo,{children:I.jsx(KA,{})}),a===Pt.GAME_OVER&&I.jsx(Xo,{children:I.jsx(QA,{})}),a===Pt.AUDIO_SETTINGS&&I.jsx(Xo,{children:I.jsx(qA,{})})]})]})},tO='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: #302e2b;--foreground: #ffffff;--card: #262521;--card-foreground: #ffffff;--popover: #262521;--popover-foreground: #ffffff;--primary: #81b64c;--primary-light: #94cc5b;--primary-dark: #6ca039;--primary-opacity-hover: #8bc2546f;--primary-foreground: #ffffff;--secondary: #484744;--secondary-light: #5a5956;--secondary-dark: #3a3936;--secondary-foreground: #ffffff;--muted: #343434;--muted-foreground: #cbcbca;--accent: #81b64c;--accent-foreground: #ffffff;--destructive: #ef4444;--destructive-foreground: #ffffff;--border: #484744;--input: #484744;--ring: #81b64c;--radius: .5rem;--menu-background: #262521c6;--sidebar-background: #262521;--sidebar-foreground: #ffffff;--sidebar-primary: #81b64c;--sidebar-primary-foreground: #ffffff;--sidebar-accent: #484744;--sidebar-accent-foreground: #ffffff;--sidebar-border: #484744;--sidebar-ring: #81b64c;--gradient-primary: linear-gradient(135deg, #94cc5b 0%, #436324 100%);--gradient-primary-hover: linear-gradient(135deg, #8bc254 0%, #7aa847 100%);--gradient-primary-subtle: linear-gradient( 135deg, #81b64c 0%, #7aa847 100% );--gradient-primary-radial: radial-gradient( circle at center, #81b64c 0%, #6a9a3d 100% )}.dark{--background: #302e2b;--foreground: #ffffff;--card: #262521;--card-foreground: #ffffff;--popover: #262521;--popover-foreground: #ffffff;--primary: #81b64c;--primary-light: #94cc5b;--primary-dark: #436324;--primary-opacity-hover: #8bc2546f;--primary-foreground: #ffffff;--secondary: #484744;--secondary-foreground: #ffffff;--muted: #262521;--muted-foreground: #cbcbca;--accent: #81b64c;--accent-foreground: #ffffff;--destructive: #dc2626;--destructive-foreground: #ffffff;--border: #484744;--input: #484744;--ring: #81b64c;--sidebar-background: #262521;--sidebar-foreground: #ffffff;--sidebar-primary: #81b64c;--sidebar-primary-foreground: #ffffff;--sidebar-accent: #484744;--sidebar-accent-foreground: #ffffff;--sidebar-border: #484744;--sidebar-ring: #81b64c;--gradient-primary: linear-gradient(135deg, #81b64c 0%, #6a9a3d 100%);--gradient-primary-hover: linear-gradient(135deg, #8bc254 0%, #7aa847 100%);--gradient-primary-subtle: linear-gradient( 135deg, #81b64c 0%, #7aa847 100% );--gradient-primary-radial: radial-gradient( circle at center, #81b64c 0%, #6a9a3d 100% )}*{border-color:var(--border)}body{background-color:var(--background);color:var(--foreground)}:fullscreen{background:var(--background)}:-webkit-full-screen{background:var(--background)}:-moz-full-screen{background:var(--background)}:-ms-fullscreen{background:var(--background)}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.bottom-2{bottom:.5rem}.bottom-3{bottom:.75rem}.bottom-4{bottom:1rem}.left-1{left:.25rem}.left-1\\/2{left:50%}.left-3{left:.75rem}.right-3{right:.75rem}.right-4{right:1rem}.top-1{top:.25rem}.top-4{top:1rem}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.float-right{float:right}.float-left{float:left}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.mt-2{margin-top:.5rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-2{height:.5rem}.h-4{height:1rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-full{height:100%}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-2{width:.5rem}.w-4{width:1rem}.w-7{width:1.75rem}.w-\\[70\\%\\]{width:70%}.w-full{width:100%}.w-px{width:1px}.min-w-20{min-width:5rem}.max-w-md{max-width:28rem}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.border-gray-700\\/50{border-color:#37415180}.border-input{border-color:var(--input)}.bg-background{background-color:var(--background)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-destructive{background-color:var(--destructive)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-menu{background-color:var(--menu-background)}.bg-popover{background-color:var(--popover)}.bg-primary{background-color:var(--primary)}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:var(--secondary)}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-6{padding:1.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:JetBrains Mono,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-8xl{font-size:6rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-destructive-foreground{color:var(--destructive-foreground)}.text-foreground{color:var(--foreground)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:var(--popover-foreground)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:var(--secondary-foreground)}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.accent-primary{accent-color:var(--primary)}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\\/10{--tw-shadow-color: rgb(0 0 0 / .1);--tw-shadow: var(--tw-shadow-colored)}.outline{outline-style:solid}.ring-offset-background{--tw-ring-offset-color: var(--background)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in{animation-timing-function:cubic-bezier(.4,0,1,1)}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-out{animation-timing-function:cubic-bezier(0,0,.2,1)}.paused{animation-play-state:paused}.bg-background-80{background-color:#302e2bcc}.bg-primary-20{background-color:#81b64c33}.text-muted-foreground{color:var(--muted-foreground)}.text-primary{color:var(--primary)}.border-primary{border-color:var(--primary)}.border-secondary{border-color:var(--secondary)}.hover\\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-primary:hover{background-color:var(--primary)}.hover\\:bg-red-600\\/80:hover{background-color:#dc2626cc}.hover\\:bg-secondary:hover{background-color:var(--secondary)}.hover\\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\\:text-black:hover{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.hover\\:text-blue-700:hover{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.hover\\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\\:underline:hover{text-decoration-line:underline}.hover\\:bg-primary-80:hover{background-color:#81b64ccc}.hover\\:text-primary:hover{color:var(--primary)}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\\:ring-ring:focus-visible{--tw-ring-color: var(--ring)}.focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:opacity-50:disabled{opacity:.5}.data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:size-4 svg{width:1rem;height:1rem}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}';class nO extends HTMLElement{constructor(){super(...arguments);be(this,"root",null)}connectedCallback(){fM();const l=this.attachShadow({mode:"open"}),f=document.createElement("div");l.appendChild(f);const h=document.createElement("style");h.textContent=tO,l.appendChild(h),this.root=pp.createRoot(f),this.root.render(I.jsx(eO,{})),VC(),this.setAttribute("data-version",Gu().version),this.setAttribute("data-build",Gu().build.toString())}disconnectedCallback(){this.root&&(this.root.unmount(),this.root=null)}getVersion(){return Gu()}isCompatible(l){const f=Gu(),[h,y,v]=f.version.split(".").map(Number),[C,x,R]=l.split(".").map(Number);return h>C?!0:h<C?!1:y>x?!0:y<x?!1:v>=R}}customElements.define("sigurd-startup",nO);const rO={getVersion:Gu,ASSET_PATHS:Il,getBackgroundImagePath:fx};sa.ASSET_PATHS=Il,sa.default=rO,sa.getBackgroundImagePath=fx,sa.getVersion=Gu,sa.logVersion=VC,Object.defineProperties(sa,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
322
322
  //# sourceMappingURL=sigurd-startup.umd.js.map