1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7281],{19538:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/space/game",function(){return n(49534)}])},49534:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return Y},default:function(){return game}});var r=n(11527),i=n(32515),a=n.n(i),o=n(50959),s=n(47813),l=n.n(s),c=n(59581),p=n.n(c),u=n(49),d=n(77112),modal_GameGiveUpModal=e=>{let{isOpen:t,onSubmit:n,onClose:i}=e,[a,s]=(0,o.useState)(!1);return(0,r.jsx)(d.Z,{isOpen:t,onClose:i,submitBtn:{label:"ê³ìí기",onClick:i},cancelBtn:{label:"ì¢ ë£í기",onClick:()=>{s(!0),n()},disabled:a},testId:"game-give-up-modal",title:"ê²ì ì¢ ë£í기",content:"ì´ë¯¸ ì¬ì©í ëì ê¶ì ëìì¤ì§ ììì!"})},h=n(90001);let Canvas=class Canvas{static getInstance(){return Canvas.instance||(Canvas.instance=new Canvas),Canvas.instance}initCanvas(e){let t=document.querySelector(e);if(t){if(null===this.mainCanvas){let e=document.createElement("canvas");e.setAttribute("id","mainCanvas"),this.mainCanvas=e}if(null===this.lineCanvas){let e=document.createElement("canvas");e.setAttribute("id","line"),Object.assign(e.style,{top:0,left:0,position:"absolute",pointerEvents:"none"}),this.lineCanvas=e}if(null===this.bottomGuide){let e=document.createElement("div");e.setAttribute("id","bottomGuide"),this.bottomGuide=e}t.appendChild(this.mainCanvas),t.appendChild(this.lineCanvas),t.appendChild(this.bottomGuide),this.insertGuide()}}insertGuide(){if(!this.bottomGuide||this.bottomGuide.children.length>0)return;let e=document.createElement("img");e.src="/images/space-game/game-play-bottom-guide.png",Object.assign(e.style,{width:"100%",height:"100%",objectFit:"contain",pointerEvents:"none"}),Object.assign(this.bottomGuide.style,{display:"flex",flexGrow:1,padding:"0 24px",justifyContent:"center",alignItems:"center",backgroundColor:"#252453",height:"100%"}),this.bottomGuide.appendChild(e)}clearCanvas(){var e,t,n,r;null===(t=this.mainCanvas)||void 0===t||null===(e=t.getContext("2d"))||void 0===e||e.clearRect(0,0,this.mainCanvas.width,this.mainCanvas.height),null===(r=this.lineCanvas)||void 0===r||null===(n=r.getContext("2d"))||void 0===n||n.clearRect(0,0,this.lineCanvas.width,this.lineCanvas.height)}constructor(){this.mainCanvas=null,this.lineCanvas=null,this.bottomGuide=null}};let Serializer=class Serializer{};/** 2 * # ResurrectJS 3 * @version 1.0.3 4 * @license Public Domain 5 * 6 * ResurrectJS preserves object behavior (prototypes) and reference 7 * circularity with a special JSON encoding. Unlike regular JSON, 8 * Date, RegExp, DOM objects, and `undefined` are also properly 9 * preserved. 10 * 11 * ## Examples 12 * 13 * function Foo() {} 14 * Foo.prototype.greet = function() { return "hello"; }; 15 * 16 * // Behavior is preserved: 17 * var necromancer = new Resurrect(); 18 * var json = necromancer.stringify(new Foo()); 19 * var foo = necromancer.resurrect(json); 20 * foo.greet(); // => "hello" 21 * 22 * // References to the same object are preserved: 23 * json = necromancer.stringify([foo, foo]); 24 * var array = necromancer.resurrect(json); 25 * array[0] === array[1]; // => true 26 * array[1].greet(); // => "hello" 27 * 28 * // Dates are restored properly 29 * json = necromancer.stringify(new Date()); 30 * var date = necromancer.resurrect(json); 31 * Object.prototype.toString.call(date); // => "[object Date]" 32 * 33 * ## Options 34 * 35 * Options are provided to the constructor as an object with these 36 * properties: 37 * 38 * prefix ('#'): A prefix string used for temporary properties added 39 * to objects during serialization and deserialization. It is 40 * important that you don't use any properties beginning with this 41 * string. This option must be consistent between both 42 * serialization and deserialization. 43 * 44 * cleanup (false): Perform full property cleanup after both 45 * serialization and deserialization using the `delete` 46 * operator. This may cause performance penalties (breaking hidden 47 * classes in V8) on objects that ResurrectJS touches, so enable 48 * with care. 49 * 50 * revive (true): Restore behavior (__proto__) to objects that have 51 * been resurrected. If this is set to false during serialization, 52 * resurrection information will not be encoded. You still get 53 * circularity and Date support. 54 * 55 * resolver (Resurrect.NamespaceResolver(window)): Converts between 56 * a name and a prototype. Create a custom resolver if your 57 * constructors are not stored in global variables. The resolver 58 * has two methods: getName(object) and getPrototype(string). 59 * 60 * For example, 61 * 62 * var necromancer = new Resurrect({ 63 * prefix: '__#', 64 * cleanup: true 65 * }); 66 * 67 * ## Caveats 68 * 69 * * With the default resolver, all constructors must be named and 70 * stored in the global variable under that name. This is required 71 * so that the prototypes can be looked up and reconnected at 72 * resurrection time. 73 * 74 * * The wrapper objects Boolean, String, and Number will be 75 * unwrapped. This means extra properties added to these objects 76 * will not be preserved. 77 * 78 * * Functions cannot ever be serialized. Resurrect will throw an 79 * error if a function is found when traversing a data structure. 80 * 81 * @see http://nullprogram.com/blog/2013/03/28/ 82 */function Resurrect(e){for(let t in this.table=null,this.prefix="#",this.cleanup=!1,this.revive=!0,e)Object.prototype.hasOwnProperty.call(e,t)&&(this[t]=e[t]);this.refcode=this.prefix+"id",this.origcode=this.prefix+"original",this.buildcode=this.prefix+".",this.valuecode=this.prefix+"v"}Resurrect.GLOBAL=(0,eval)("this"),Resurrect.escapeRegExp=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},Resurrect.prototype.Error=function(e){this.message=e||"",this.stack=Error().stack},Resurrect.prototype.Error.prototype=Object.create(Error.prototype),Resurrect.prototype.Error.prototype.name="ResurrectError",Resurrect.NamespaceResolver=function(e){this.scope=e},Resurrect.NamespaceResolver.prototype.getPrototype=function(e){let t=this.scope[e];if(t)return t.prototype;throw new Resurrect.prototype.Error("Unknown constructor: "+e)},Resurrect.NamespaceResolver.prototype.getName=function(e){let t=e.constructor.name;if(null==t&&(t=/^\s*function\s*([A-Za-z0-9_$]*)/.exec(e.constructor)[1]),""===t)throw new Resurrect.prototype.Error("Can't serialize objects with anonymous constructors.");return"Object"===t||"Array"===t?null:t},Resurrect.prototype.resolver=new Resurrect.NamespaceResolver(Resurrect.GLOBAL),Resurrect.Node=function(e){let t=document.createElement("div");return t.innerHTML=e,t.firstChild},Resurrect.is=function(e){let t="[object "+e+"]";return function(e){return Object.prototype.toString.call(e)===t}},Resurrect.isArray=Resurrect.is("Array"),Resurrect.isString=Resurrect.is("String"),Resurrect.isBoolean=Resurrect.is("Boolean"),Resurrect.isNumber=
82Resurrect.is("Number"),Resurrect.isFunction=Resurrect.is("Function"),Resurrect.isDate=Resurrect.is("Date"),Resurrect.isRegExp=Resurrect.is("RegExp"),Resurrect.isObject=Resurrect.is("Object"),Resurrect.isAtom=function(e){return!Resurrect.isObject(e)&&!Resurrect.isArray(e)},Resurrect.isPrimitive=function(e){return null==e||Resurrect.isNumber(e)||Resurrect.isString(e)||Resurrect.isBoolean(e)},Resurrect.prototype.ref=function(e){let t={};return void 0===e?t[this.prefix]=-1:t[this.prefix]=e[this.refcode],t},Resurrect.prototype.deref=function(e){return this.table[e[this.prefix]]},Resurrect.prototype.tag=function(e){if(this.revive){let t=this.resolver.getName(e);if(t){let n=Object.getPrototypeOf(e);if(this.resolver.getPrototype(t)!==n)throw new this.Error("Constructor mismatch!");e[this.prefix]=t}}return e[this.refcode]=this.table.length,this.table.push(e),e[this.refcode]},Resurrect.prototype.builder=function(e,t){let n={};return n[this.buildcode]=e,n[this.valuecode]=t,n},Resurrect.prototype.build=function(e){let t=e[this.buildcode].split(/\./).reduce(function(e,t){return e[t]},Resurrect.GLOBAL),n=[null].concat(e[this.valuecode]),r=t.bind.apply(t,n),i=new r;return Resurrect.isPrimitive(i)?i.valueOf():i},Resurrect.prototype.decode=function(e){if(this.prefix in e)return this.deref(e);if(this.buildcode in e)return this.build(e);throw new this.Error("Unknown encoding.")},Resurrect.prototype.isTagged=function(e){return this.refcode in e&&null!=e[this.refcode]},Resurrect.prototype.visit=function(e,t,n){if(Resurrect.isAtom(e))return t(e);if(this.isTagged(e))return this.ref(e);{let r=null;if(Resurrect.isArray(e)){r=[],e[this.refcode]=this.tag(r);for(let i=0;i<e.length;i++)r.push(this.visit(e[i],t,n))}else for(let i in r=Object.create(Object.getPrototypeOf(e)),e[this.refcode]=this.tag(r),e){let a=e[i];if(e.hasOwnProperty(i)){if(n&&void 0!==a&&void 0===(a=n.call(e,i,e[i])))continue;r[i]=this.visit(a,t,n)}}return r[this.origcode]=e,this.ref(r)}},Resurrect.prototype.handleAtom=function(e){let t=Resurrect.GLOBAL.Node||function(){};if(Resurrect.isFunction(e))throw new this.Error("Can't serialize functions.");if(e instanceof t){let t=new XMLSerializer;return this.builder("Resurrect.Node",[t.serializeToString(e)])}if(Resurrect.isDate(e))return this.builder("Date",[e.toISOString()]);if(Resurrect.isRegExp(e)){let t=e.toString().match(/\/(.+)\/([gimy]*)/).slice(1);return this.builder("RegExp",t)}return void 0===e?this.ref(void 0):Resurrect.isNumber(e)&&(isNaN(e)||!isFinite(e))?this.builder("Number",[e.toString()]):e},Resurrect.prototype.replacerWrapper=function(e){let t=RegExp("^"+Resurrect.escapeRegExp(this.prefix));return function(n,r){return t.test(n)?r:e(n,r)}},Resurrect.prototype.stringify=function(e,t,n){if(Resurrect.isFunction(t))t=this.replacerWrapper(t);else if(Resurrect.isArray(t)){let e=t;t=function(t,n){return e.indexOf(t)>=0?n:void 0}}if(Resurrect.isAtom(e))return JSON.stringify(this.handleAtom(e),t,n);{this.table=[],this.visit(e,this.handleAtom.bind(this),t);for(let e=0;e<this.table.length;e++)this.cleanup?delete this.table[e][this.origcode][this.refcode]:this.table[e][this.origcode][this.refcode]=null,delete this.table[e][this.refcode],delete this.table[e][this.origcode];let r=this.table;return this.table=null,JSON.stringify(r,null,n)}},Resurrect.prototype.fixPrototype=function(e){if(!(this.prefix in e))return e;{let t=e[this.prefix],n=this.resolver.getPrototype(t);if("__proto__"in e)return e.__proto__=n,this.cleanup&&delete e[this.prefix],e;{let t=Object.create(n);for(let n in e)e.hasOwnProperty(n)&&n!==this.prefix&&(t[n]=e[n]);return t}}},Resurrect.prototype.resurrect=function(e){let t=null,n=JSON.parse(e);if(Resurrect.isArray(n)){if(this.table=n,this.revive)for(var r=0;r<this.table.length;r++)this.table[r]=this.fixPrototype(this.table[r]);for(r=0;r<this.table.length;r++){let e=this.table[r];for(let t in e)e.hasOwnProperty(t)&&!Resurrect.isAtom(e[t])&&(e[t]=this.decode(e[t]))}t=this.table[0]}else Resurrect.isObject(n)?(this.table=[],t=this.decode(n)):t=n;return this.table=null,t};let m=l().Common,g=l().Engine;Serializer.create=function(){let e=new Resurrect({prefix:"$",cleanup:!0}
82);return e.parse=e.resurrect,e},Serializer.clone=function(e,t){let n=e.parse(Serializer.serialise(e,t));return n.id=m.nextId(),n},Serializer.saveState=function(e,t,n){localStorage.setItem(n,Serializer.serialise(e,t.world))},Serializer.loadState=function(e,t,n){let r=e.parse(localStorage.getItem(n));r&&g.merge(t,{world:r})},Serializer.serialise=function(e,t,n){return n=n||0,e.stringify(t,function(e,t){if(!/^#/.exec(e)&&"number"==typeof t){let e=parseFloat(t.toFixed(3));return 0===e&&0!==t?t:e}return t},n)};var f=n(70238);let MatterWrapper=class MatterWrapper{static getInstance(){return MatterWrapper.instance||(MatterWrapper.instance=new MatterWrapper),MatterWrapper.instance}init(e,t){if(!this.engine&&!this.render&&!this.walls&&!this.runner&&!this.audio){let n=s.Engine.create({}),r=s.Render.create({canvas:e,engine:n,options:{width:MatterWrapper.parentWidth,height:MatterWrapper.parentHeight,wireframes:!1,background:"none",pixelRatio:.5}}),i=s.Runner.run(n);i.isFixed=!0,s.Render.run(r);let a=this.createWalls();s.Composite.add(n.world,a);let o=f.y.gameProgressEngineInfo.get();o&&(Serializer.loadState(MatterWrapper.serializer,n,f.y.gameProgressEngineInfo.key),localStorage.removeItem(f.y.gameProgressEngineInfo.key),this.restoreBall=n.world.bodies.find(e=>e.isStatic&&"Circle Body"===e.label)),this.audio=t,this.engine=n,this.render=r,this.walls=a,this.runner=i;return}this.engine&&this.runner&&(this.runner.enabled=!0)}createWalls(){return[[192.5,-50,385,100],[192.5,657,385,100],[-50,303.5,100,607],[435,303.5,100,607]].map(e=>{let[t,n,r,i]=e;return s.Bodies.rectangle(t,n,r,i,{isStatic:!0,collisionFilter:{mask:MatterWrapper.collisionLevel},render:{fillStyle:void 0},sleepThreshold:0,isSleeping:!0})})}clear(){if(this.engine&&this.render&&this.walls)for(s.Engine.clear(this.engine),s.Composite.clear(this.engine.world,!0);this.engine.world.bodies.length>this.walls.length;)this.engine.world.bodies.pop()}constructor(){this.engine=null,this.render=null,this.runner=null,this.walls=null,this.audio=null}};async function delay(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}MatterWrapper.paddingBottom=60,MatterWrapper.parentHeight=667-MatterWrapper.paddingBottom,MatterWrapper.parentWidth=385,MatterWrapper.ballFriction=.1,MatterWrapper.ballRestitution=.4,MatterWrapper.ballRadius=10,MatterWrapper.smallerRadius=9.5,MatterWrapper.startSize=1,MatterWrapper.ballStartPositionY=0,MatterWrapper.maxCreatedSize=4,MatterWrapper.headerHeight=36,MatterWrapper.gameEndPosition=MatterWrapper.maxCreatedSize*MatterWrapper.ballRadius+MatterWrapper.headerHeight,MatterWrapper.duration=500,MatterWrapper.stopSpeed=.2,MatterWrapper.maxStage=11,MatterWrapper.collisionLevel=1,MatterWrapper.nonCollisionLevel=2,MatterWrapper.serializer=Serializer.create();var b=n(21262),v=n(81828),x=n(94755);function _templateObject(){let e=(0,b._)(["\n display: flex;\n gap: 4px;\n place-self: start;\n"]);return _templateObject=function(){return e},e}function _templateObject1(){let e=(0,b._)(["\n display: flex;\n gap: 4px;\n align-items: center;\n background-image: url('/images/space-game/next-ball-wrap.png');\n background-repeat: no-repeat;\n background-size: contain;\n background-position: center;\n padding: 3px 3px 5px 8px;\n width: 66px;\n height: 30px;\n\n img {\n width: 22px;\n height: 22px;\n }\n"]);return _templateObject1=function(){return e},e}function _templateObject2(){let e=(0,b._)(["\n display: flex;\n justify-content: center;\n align-items: center;\n\n img {\n width: 30px;\n height: 30px;\n }\n"]);return _templateObject2=function(){return e},e}function _templateObject3(){let e=(0,b._)(["\n position: relative;\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: 480px;\n height: 100%;\n flex-grow: 1;\n background-image: url('/images/space-game/game_background_play.webp');\n background-repeat: no-repeat;\n background-size: cover;\n background-position: center;\n"]);return _templateObject3=function(){return e},e}function _templateObject4(){let e=(0,b._)(["\n position: absolute;\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n padding: 0 16px;\n"]);
82return _templateObject4=function(){return e},e}function _templateObject5(){let e=(0,b._)(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 6px;\n"]);return _templateObject5=function(){return e},e}function _templateObject6(){let e=(0,b._)(["\n ",";\n font-size: 24px;\n font-weight: 600;\n line-height: 28px;\n color: #000;\n -webkit-text-stroke: 5px white;\n paint-order: stroke fill;\n"]);return _templateObject6=function(){return e},e}function _templateObject7(){let e=(0,b._)(["\n ",";\n ",";\n color: ",";\n background-image: url('/images/space-game/give-up-button.png');\n background-repeat: no-repeat;\n background-size: contain;\n background-position: center;\n width: 77px;\n height: 38px;\n"]);return _templateObject7=function(){return e},e}function _templateObject8(){let e=(0,b._)(["\n position: absolute;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.8);\n z-index: 999;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n padding-bottom: 150px;\n"]);return _templateObject8=function(){return e},e}function _templateObject9(){let e=(0,b._)(["\n ",";\n ",";\n background: ",";\n color: ",";\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 9px 16px;\n border-radius: 12px;\n margin-bottom: 24px;\n\n > span {\n margin: 1px 0 -1px; // to fix align\n }\n"]);return _templateObject9=function(){return e},e}function _templateObject10(){let e=(0,b._)(["\n background-image: url('/images/space-game/score-board.png');\n background-repeat: no-repeat;\n background-size: contain;\n background-position: center;\n width: 250px;\n height: 109px;\n position: relative;\n\n > p {\n position: absolute;\n top: 60%;\n left: 50%;\n transform: translate(-50%, -50%);\n ",";\n font-size: 24px;\n font-weight: 600;\n line-height: 28px;\n white-space: nowrap;\n\n > span {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n\n &.fill {\n color: ",";\n z-index: 1;\n }\n\n &.stroke {\n color: #64e1d2;\n -webkit-text-fill-color: transparent;\n -webkit-background-clip: text;\n -webkit-text-stroke: 5px #64e1d2;\n paint-order: stroke fill;\n filter: drop-shadow(0 4px 2px ",");\n }\n }\n }\n"]);return _templateObject10=function(){return e},e}function _templateObject11(){let e=(0,b._)(["\n display: flex;\n align-items: center;\n gap: 6px;\n margin: 24px 0 50px;\n\n span.best-score {\n ",";\n ",";\n color: ",";\n }\n"]);return _templateObject11=function(){return e},e}function _templateObject12(){let e=(0,b._)(["\n display: flex;\n justify-content: center;\n align-items: center;\n ",";\n ",";\n background: ",";\n color: ",";\n padding: 14px 40px;\n border-radius: 12px;\n"]);return _templateObject12=function(){return e},e}let w=v.ZP.div.withConfig({componentId:"sc-2f0dda0e-0"})(_templateObject()),y=v.ZP.div.withConfig({componentId:"sc-2f0dda0e-1"})(_templateObject1()),R=v.ZP.button.withConfig({componentId:"sc-2f0dda0e-2"})(_templateObject2()),_=v.ZP.div.withConfig({componentId:"sc-2f0dda0e-3"})(_templateObject3()),C=v.ZP.div.withConfig({componentId:"sc-2f0dda0e-4"})(_templateObject4()),j=v.ZP.div.withConfig({componentId:"sc-2f0dda0e-5"})(_templateObject5()),S=v.ZP.span.withConfig({componentId:"sc-2f0dda0e-6"})(_templateObject6(),e=>{let{theme:t}=e;return t.fontFamilyV2.hGGGothicssi}),M=v.ZP.button.withConfig({componentId:"sc-2f0dda0e-7"})(_templateObject7(),e=>{let{theme:t}=e;return t.fontFamilyV2.hGGGothicssi},(0,x.L)("body3_semiBold"),(0,x.R)("white")),W=v.ZP.div.withConfig({componentId:"sc-2f0dda0e-8"})(_templateObject8()),O=v.ZP.div.withConfig({componentId:"sc-2f0dda0e-9"})(_templateObject9(),e=>{let{theme:t}=e;return t.fontFamilyV2.hGGGothicssi},(0,x.L)("body3_semiBold"),(0,x.R)("white"),(0,x.R)("gray100")),E=v.ZP.div.withConfig({componentId:"sc-2f0dda0e-10"})(_templateObject10(),e=>{let{theme:t}=e;return t.fontFamilyV2.hGGGothicssi},(0,x.R)("gray100"),(0,x.R)("gray100")),k=v.ZP.div.withConfig({componentId:"sc-2f0dda0e-11"}
82)(_templateObject11(),e=>{let{theme:t}=e;return t.fontFamilyV2.hGGGothicssi},(0,x.L)("body3_semiBold"),(0,x.R)("white")),P=v.ZP.button.withConfig({componentId:"sc-2f0dda0e-12"})(_templateObject12(),e=>{let{theme:t}=e;return t.fontFamilyV2.hGGGothicssi},(0,x.L)("body3_semiBold"),(0,x.R)("white"),(0,x.R)("gray100"));var G=n(33857),z=n(98191),B=n(65986),N=n(60659),L=n(17021),A=n(86854);let preloadImage=e=>{if(!e)return()=>{};let t=document.createElement("link");return t.rel="preload",t.href=e,t.as="image",document.head.append(t),()=>{t.remove()}},preloadImages=e=>{let t=e.map(e=>preloadImage(e));return()=>{t.forEach(e=>e())}};let Audio=class Audio{async init(){if(this.audioContext&&"closed"!==this.audioContext.state&&this.audioBuffer)return{audioContext:this.audioContext,audioBuffer:this.audioBuffer};let{audioBuffer:e,audioContext:t}=await this.getSource();return this.audioBuffer=e,this.audioContext=t,{audioBuffer:e,audioContext:t}}async getSource(){let e=await fetch(this.src),t=new AudioContext,n=await e.arrayBuffer(),r=await t.decodeAudioData(n);return{audioContext:t,audioBuffer:r}}async play(){let{audioContext:e,audioBuffer:t}=await this.init(),n=e.createBufferSource();n.buffer=t,n.connect(e.destination),n.start()}constructor(e){this.audioBuffer=null,this.audioContext=null,this.src=e,this.init().then()}};var I=n(23168),Z=n(16651),F=n(76838),T=n(71979),H=n(4200);let D=["/images/space-game/planets/level_1.png","/images/space-game/planets/level_2.png","/images/space-game/planets/level_3.png","/images/space-game/planets/level_4.png","/images/space-game/planets/level_5.png","/images/space-game/planets/level_6.png","/images/space-game/planets/level_7.png","/images/space-game/planets/level_8.png","/images/space-game/planets/level_9.png","/images/space-game/planets/level_10.png","/images/space-game/planets/level_11.png"],U=MatterWrapper.getInstance(),V=Canvas.getInstance(),q=I.n.getInstance(),getRandomSize=()=>Math.ceil(Math.random()*MatterWrapper.maxCreatedSize),scoreToCoin=e=>Math.ceil(1.5*e);var SpaceGamePlay=()=>{let e;let[t]=(0,L.Z)(),[n,i]=(0,u.KO)(A.WE),a=(0,u.Dv)(A.YS),l=(0,u.b9)(A.fG),[c,d]=(0,o.useState)(!1),m=(0,G.Z)(),g=0,b=null,v=(0,o.useRef)(null),x=(0,o.useRef)(0),X=(0,o.useRef)(!1),Y=(0,o.useRef)(0),J=(0,o.useRef)(!1),$=(0,o.useRef)(0),K=(0,o.useRef)(n),Q=(0,o.useRef)(!1),[ee,et]=(0,o.useState)(0),[en,er]=(0,o.useState)(0),[ei,ea]=(0,o.useState)(!1),[eo,es]=(0,o.useState)(getRandomSize()),[el,ec]=(0,o.useState)(!1);(0,o.useEffect)(()=>{K.current=n},[n]);let drawLine=()=>{var e;let t=null===(e=V.lineCanvas)||void 0===e?void 0:e.getContext("2d");t&&(t.strokeStyle="#ffffff66",t.lineWidth=3,t.lineCap="round",t.beginPath(),t.moveTo(0,MatterWrapper.gameEndPosition),t.lineTo(MatterWrapper.parentWidth,MatterWrapper.gameEndPosition),t.setLineDash([10,20]),t.stroke())},ep=(0,o.useCallback)(e=>{Q.current=!0;let t=v.current,n=V.mainCanvas;if(X.current||!n||!t)return;let r=n.getBoundingClientRect(),i=Object.assign({zoom:0},t.style),a=i.zoom||1;g=e.touches[0].clientX/a-r.left,J.current||setNewPosition(g,b)},[]),eu=(0,o.useCallback)(async()=>{X.current||null===b||!Q.current||J.current||(J.current=!0,setNewPosition(g,b),b.isStatic=!1,b.collisionFilter.mask=MatterWrapper.collisionLevel,await delay(500),b=null,createNextBall(),J.current=!1,Q.current=!1)},[]),ed=(0,o.useCallback)(e=>{Q.current=!0;let t=V.mainCanvas,n=v.current;if(X.current||J.current||!t||!n)return;let r=t.getBoundingClientRect(),i=Object.assign({zoom:0},n.style),a=i.zoom||1;setNewPosition(g=e.touches[0].clientX/a-r.left,b)},[]),eh=(0,o.useCallback)(e=>{let{engine:t}=U;t&&e.pairs.forEach(async e=>{let[n,r]=[e.bodyA,e.bodyB];if(void 0!==n.size&&void 0!==r.size&&n.size===r.size){let e=t.world.bodies;if(e.includes(n)&&e.includes(r)){if(n.position.y<MatterWrapper.gameEndPosition&&r.position.y<MatterWrapper.gameEndPosition)return;if(s.Composite.remove(t.world,[n,r]),et(e=>e+n.size),Y.current+=n.size,K.current){var i;null===(i=U.audio)||void 0===i||i.play().then()}let e=(n.position.x+r.position.x)/2,a=(n.position.y+r.position.y)/2;s.Composite.add(t.world,newBall(e,a,n.size===MatterWrapper.maxStage?MatterWrapper.maxStage:n.size+1))}}})},[]),em=(0,o.useCallback)(async e=>{let{isGiveUp:t}=e;d(!0);let{engine:n,runner:r}=U;X.current=!0;let i=Y.current;n&&r&&(r.enabled=!1,null!=b&&s.Composite.remove(n.world,b));let o=await F.Z.fetchQuery({queryKey:[N.Gu],queryFn:Z.J});if(null==o?void 0:o.spaceGameSeasonId){let{data:e}=await z.Z.postGameDone({spaceGameHistoryId:a,spaceGameSeasonId:null==o?void 0:o.spaceGameSeasonId,score:i,coin:scoreToCoin(i),lastStage:x.current,apply:11===x.current,spaceGameHistoryType:t?"NOT_PERFECT_DONE":"DONE"});if(H.L.SpaceGame_End({lastStage:x.current}),11===x.current&&H.L.SpaceGame_Applied(),e){await F.Z.invalidateQueries({queryKey:[N.Dt]});let{isBestScore:t,maxScore:n}=e;t?er(i):er(n),l({coin:scoreToCoin(i),isApply:11===x.current}),ea(!0)}else throw Error("ì°ì£¼ê²ì ìë£ ì¤í¨")}d(!1)},[]),eg=(0,o.useCallback)(async()=>{let{engine:e,walls:t,render:n,runner:r}=U;if(X.current||!b||!e||!t||!r||!n)return;let{bodies:i}=e.world;for(let r=t.length;r<i.length;r+=1){let t=i[r],o=performance.now(),l={size:0,createdAt:0,...t},c=o-l.createdAt<MatterWrapper.duration;if(l.size===MatterWrapper.startSize){var a;let{min:e,max:r}=n.bounds,{x:i,y:o}=l.position,c=null!==(a=l.circleRadius)&&void 0!==a?a:0,p=Math.min(Math.max(i,e.x+c),r.x-c),u=
82Math.min(Math.max(o,e.y+c),r.y-c);s.Body.setPosition(t,s.Vector.create(p,u))}t.position.y<MatterWrapper.gameEndPosition&&t!==b&&!t.isStatic&&!c&&Math.abs(t.velocity.x)<MatterWrapper.stopSpeed*e.timing.timeScale&&Math.abs(t.velocity.y)<MatterWrapper.stopSpeed*e.timing.timeScale&&await em({isGiveUp:!1})}},[]),createNewBall=e=>{var t;let{engine:n,render:r}=U,i=e*(e>=7&&e<=10?MatterWrapper.smallerRadius:MatterWrapper.ballRadius);n&&r&&((b=newBall((null!==(t=r.options.width)&&void 0!==t?t:0)/2,MatterWrapper.gameEndPosition-i,e)).collisionFilter.mask=MatterWrapper.nonCollisionLevel,b.isStatic=!0,s.Composite.add(n.world,b))},createNextBall=()=>{$.current=getRandomSize(),es(e=>(createNewBall(e),$.current))},resize=()=>{let{render:t}=U,n=V.mainCanvas,r=V.lineCanvas,i=v.current;if(!n||!r||!i||!t)return;n.height=MatterWrapper.parentHeight,n.width=MatterWrapper.parentWidth,r.height=MatterWrapper.parentHeight,r.width=MatterWrapper.parentWidth;let a=window.innerWidth>480?480:window.innerWidth,o=a/MatterWrapper.parentWidth,l=window.innerHeight/MatterWrapper.parentHeight*(1-MatterWrapper.paddingBottom/MatterWrapper.parentHeight);e=Math.min(o,l),i.style.zoom=e,i.style.top="0px",s.Render.setPixelRatio(t,2.75*e),drawLine()},newBall=(e,t,n)=>{let r=n*(n>=7&&n<=10?MatterWrapper.smallerRadius:MatterWrapper.ballRadius);x.current<n&&(x.current=n);let i=s.Bodies.circle(e,t,r,{friction:MatterWrapper.ballFriction,restitution:MatterWrapper.ballRestitution,render:{sprite:{texture:D[n-1],xScale:2*r/256,yScale:2*r/256}}}),a={size:n,createdAt:performance.now()};return Object.assign(i,a)},setNewPosition=(e,t)=>{if(null==t)return;let n={x:e,y:t.position.y}
82,r=t.bounds.max.x-t.bounds.min.x;e>MatterWrapper.parentWidth-r/2?n.x=MatterWrapper.parentWidth-r/2:e<r/2&&(n.x=r/2),s.Body.setPosition(t,n)};return(0,o.useEffect)(()=>{var e,n,r,i,a,o,l;q.setCallback(I.d.SPACE_GAME_PLAY,{cb:()=>{Q.current=!1},once:!1}),V.initCanvas("#canvas");let c=Number(null==t?void 0:t.paddingTop)||0;MatterWrapper.ballStartPositionY=c,MatterWrapper.gameEndPosition=MatterWrapper.maxCreatedSize*MatterWrapper.ballRadius+MatterWrapper.headerHeight+c,U.init(V.mainCanvas,new Audio("/sounds/pop.wav"));let p=preloadImages(D),{engine:u}=U;if(u)return window.handlers.sendState=e=>{"onPaused"===e&&u&&!X.current&&(Serializer.saveState(MatterWrapper.serializer,u,f.y.gameProgressEngineInfo.key),f.y.gameProgressNewBallInfo.set($.current.toString(),{once:!0}),f.y.gameProgressScoreInfo.set(Y.current.toString(),{once:!0}))},window.handlers.aosGoBack=()=>{ec(!0)},resize(),drawLine(),window.addEventListener("resize",resize),null===(e=V.mainCanvas)||void 0===e||e.addEventListener("touchstart",ep),null===(n=V.mainCanvas)||void 0===n||n.addEventListener("touchend",eu),null===(r=V.mainCanvas)||void 0===r||r.addEventListener("touchmove",ed),null===(i=V.bottomGuide)||void 0===i||i.addEventListener("touchstart",ep),null===(a=V.bottomGuide)||void 0===a||a.addEventListener("touchend",eu),null===(o=V.bottomGuide)||void 0===o||o.addEventListener("touchmove",ed),s.Events.on(u,"beforeUpdate",eg),s.Events.on(u,"collisionActive",eh),s.Events.on(u,"collisionStart",eh),U.restoreBall?(b=U.restoreBall,s.Composite.remove(u.world,b),s.Composite.add(u.world,b),U.restoreBall=void 0,Y.current=Number(f.y.gameProgressScoreInfo.get()),et(()=>Y.current)):createNewBall(Number(null!==(l=f.y.gameProgressNewBallInfo.get())&&void 0!==l?l:MatterWrapper.startSize)),()=>{var e,t,n,r,i,a;p(),null===(e=V.mainCanvas)||void 0===e||e.removeEventListener("touchstart",ep),null===(t=V.mainCanvas)||void 0===t||t.removeEventListener("touchend",eu),null===(n=V.mainCanvas)||void 0===n||n.removeEventListener("touchmove",ed),null===(r=V.bottomGuide)||void 0===r||r.removeEventListener("touchstart",ep),null===(i=V.bottomGuide)||void 0===i||i.removeEventListener("touchend",eu),null===(a=V.bottomGuide)||void 0===a||a.removeEventListener("touchmove",ed),s.Events.off(u,"beforeUpdate",eg),s.Events.off(u,"collisionActive",eh),s.Events.off(u,"collisionStart",eh),V.clearCanvas(),U.clear(),q.deleteCallback(I.d.SPACE_GAME_PLAY)}},[]),(0,r.jsxs)(_,{ref:v,children:[ei&&(0,r.jsxs)(W,{"data-testid":"game-over-wrap",children:[(11===x.current||0!==ee&&ee>=en)&&(0,r.jsxs)(O,{children:[(0,r.jsx)(p(),{src:"/images/space-game/congrats-icon.png",width:18,height:18,alt:"í죽ìì´ì½"}),11===x.current?(0,r.jsx)("span",{children:"ìíì ì±ê³µ! ë¬´ë£ ì´¬ìê¶ ìë ì모!"}):(0,r.jsx)("span",{children:"ì¶íí´ì! ìµê³ ì ì를 ë¬ì±íì´ì!"})]}),(0,r.jsx)(E,{children:(0,r.jsxs)("p",{children:[(0,r.jsxs)("span",{className:"fill",children:[ee.toLocaleString(),"ì "]}),(0,r.jsxs)("span",{className:"stroke",children:[ee.toLocaleString(),"ì "]})]})}),(0,r.jsxs)(k,{children:[(0,r.jsx)(p(),{src:"/images/space-game/crown-icon.png",width:18,height:18,alt:"ìµê³ ì ì"}),(0,r.jsxs)("span",{className:"best-score",children:["ìµê³ ì ì : ",en.toLocaleString()," ì "]})]}),(0,r.jsx)(P,{onClick:()=>{d(!0),m.back()},children:"ëìê°ê¸°"})]}),(0,r.jsxs)(C,{style:{top:MatterWrapper.gameEndPosition-MatterWrapper.headerHeight-30},children:[(0,r.jsxs)(j,{children:[(0,r.jsxs)(w,{children:[(0,r.jsxs)(y,{children:[(0,r.jsx)(T.Z,{typo:"body3_medium",fontFamily:"hGGGothicssi",color:"white",children:"NEXT"}),(0,r.jsx)("img",{width:22,height:22,alt:"ë¤ì ê³µ",src:D[eo-1]})]}),(0,r.jsx)(R,{"data-testid":"sound-button",onClick:()=>i(e=>!e),children:(0,r.jsx)("img",{width:30,height:30,alt:"sound-".concat(n?"on":"off"),src:"/images/space-game/sound-".concat(n?"on":"off",".png")})})]}),(0,r.jsx)(S,{children:ee.toString()})]}),(0,r.jsx)(M,{onClick:()=>ec(!0),children:"ê·¸ë§í기"})]}),(0,r.jsx)("div",{id:"canvas","data-testid":"canvas",style:{width:MatterWrapper.parentWidth,height:"100%",display:"flex",flexDirection:"column",flexGrow:1}}),(0,r.jsxs)(B.c.Consumer,{children:[(0,r.jsx)(h.Z,{isLoading:c}
82),(0,r.jsx)(modal_GameGiveUpModal,{isOpen:el,onClose:()=>{ec(!1)},onSubmit:()=>{ec(!1),H.L.SpaceGame_GiveUp(),em({isGiveUp:!0})}})]})]})},X=n(47132),Y=!0,game=()=>((0,o.useEffect)(()=>(window.document.body.style.overflow="hidden",()=>{window.document.body.style.overflow="auto"}),[]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a(),{children:(0,r.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"})}),(0,r.jsx)(X.E,{mode:"dark",style:{padding:0},children:(0,r.jsx)(SpaceGamePlay,{})})]}))},33857:function(e,t,n){"use strict";var r=n(50959),i=n(79096);t.Z=()=>{let e=(0,i.useRouter)();return(0,r.useMemo)(()=>({...e,back(){e.back()},push(t){e.push(t)},replace(t,n,r){e.replace(t,n,r)},query:e.query}),[e])}},47132:function(e,t,n){"use strict";n.d(t,{E:function(){return o},P:function(){return s}});var r=n(21262),i=n(81828),a=n(94755);function _templateObject(){let e=(0,r._)(["\n height: 100%;\n background-image: url(",");\n background-position: center;\n background-repeat: no-repeat;\n background-size: cover;\n "]);return _templateObject=function(){return e},e}function _templateObject1(){let e=(0,r._)(["\n ",";\n min-height: 100%;\n margin: 0 auto;\n position: relative;\n display: flex;\n flex-direction: column;\n overflow-y: visible;\n background: ",";\n color: ",";
82\n overscroll-behavior: none;\n ",";\n padding-top: ",";\n padding-bottom: ",";\n\n &:has(#header) {\n padding-top: ",";\n }\n\n &:has(#bottom-nav) {\n padding-bottom: ",";\n }\n\n &:has(#mobile-bottom-nav) {\n padding-bottom: ",";\n }\n"]);return _templateObject1=function(){return e},e}function _templateObject2(){let e=(0,r._)(["\n ",";\n line-height: 22px; // ê°ë ì±ì ìí´ ì¶ê°\n display: flex;\n flex-direction: column;\n padding: 20px;\n\n td {\n border: 1px solid black;\n padding: 4px;\n vertical-align: middle;\n }\n\n thead td {\n background: ",";\n }\n\n p {\n word-break: break-all;\n }\n\n strong {\n font-weight: 600;\n }\n\n a {\n color: blue;\n text-decoration: underline;\n }\n"]);return _templateObject2=function(){return e},e}let o=i.ZP.div.withConfig({componentId:"sc-675771ff-0"})(_templateObject1(),e=>{let{theme:t}=e;return t.layout.width},e=>{let{mode:t}=e;return"light"===t?(0,a.R)("white"):(0,a.R)("black")},e=>{let{mode:t}=e;return"light"===t?(0,a.R)("gray100"):(0,a.R)("white")},e=>{let{$backgroundImage:t}=e;return t&&(0,i.iv)(_templateObject(),t.src)},e=>{let{theme:t}=e;return t.safeArea.top},e=>{let{theme:t}=e;return t.safeArea.bottom},e=>{let{theme:t}=e;return t.headerHeight.computed},e=>{let{theme:t}=e;return t.webBottomNavHeight.px},e=>{let{theme:t}=e;return t.mobileBottomNavHeight.computed}),s=i.ZP.div.withConfig({componentId:"sc-675771ff-1"})(_templateObject2(),(0,a.L)("body3"),(0,a.R)("gray10"))}},function(e){e.O(0,[8940,5778,3471,9774,2888,179],function(){return e(e.s=19538)}),_N_E=e.O()}]); 83//# sourceMappingURL=game-492526b8e263a7a9.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.