1"use strict";(self.webpackChunkalivecode_frontend=self.webpackChunkalivecode_frontend||[]).push([[3158,4562],{3437(e,t,n){n.d(t,{EF:()=>r,Ev:()=>a,ku:()=>s,xg:()=>o});var i=n(72249);function o(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function a(e,t){return Math.abs(e-t)<=Number.EPSILON}function s(e){if(""===e)return!1;if("inherit"===e)return!1;if("transparent"===e)return!1;var t=document.createElement("img");return t.style.color="rgb(0, 0, 0)",t.style.color=e,"rgb(0, 0, 0)"!==t.style.color||(t.style.color="rgb(255, 255, 255)",t.style.color=e,"rgb(255, 255, 255)"!==t.style.color)}function r(e,t){for(var n=e,o=t,a=0;a<2;a++){1===a&&(n=t,o=e);for(var s=0;s<(null===(r=n)||void 0===r?void 0:r.length);s++){for(var r,l=n[s],c=n[(s+1)%n.length],u=new i.M(-(c.y-l.y),c.x-l.x),h=1/0,d=-1/0,p=0;p<(null===(f=n)||void 0===f?void 0:f.length);p++){var f,v=n[p].x*u.x+n[p].y*u.y;h=Math.min(h,v),d=Math.max(d,v)}for(var m=1/0,g=-1/0,b=0;b<(null===(y=o)||void 0===y?void 0:y.length);b++){var y,S=o[b].x*u.x+o[b].y*u.y;m=Math.min(m,S),g=Math.max(g,S)}if(!(g>=h&&d>=m))return!1}}return!0}},10740(e,t,n){n.d(t,{gT:()=>o,Ui:()=>a,z6:()=>l,dm:()=>h,R2:()=>u,Qm:()=>c});var i=n(80296),o={alien:n.p+"38300bdf6fab7f3c3e23.gif",crack:n.p+"7bf6ab96faf941bd415c.png",holeCrack:n.p+"3cd81e15eba7773fad3c.png",satelitte:n.p+"1c47c103d60cf8d5645b.png",copy:n.p+"89f4b6542a0cd0abd80e.png",information:n.p+"b3780008f8650bdc9841.png",linkOff:n.p+"09a1e30fa64947e0e6d8.png",linkOn:n.p+"6281662c77885ba5c37e.png",pasteOff:n.p+"6b2bc204ddf779f883f5.png",pasteOn:n.p+"63680e06823daf885355.png",pinOff:n.p+"297e7a638df76de5c69b.png",pinOn:n.p+"052f66232183f702c525.png",redo:n.p+"e427af5b51375c34dee5.png",rotate_clockwise:n.p+"96e278ae1927fb6bbc98.png",rotate_counterclockwise:n.p+"bca524b985a978994f47.png",selectionOff:n.p+"e6b153252c75db222361.png",selectionOn:n.p+"48d8cd76e8262b606e2d.png",tools:n.p+"43586204870d3cbb60d0.png",trash:n.p+"2c881cf181a059d0898d.png",trashOpen:n.p+"5c3ed8c04f3018ba3453.png",undo:n.p+"9f1c99c7a0d431e1c146.png",zoom_in:n.p+"ed3d01ab61bdce14c22a.png",zoom_out:n.p+"f73642ee22aa8dade228.png",hole:n.p+"f51adf25b4df7bdb9e33.gif",lavaAnimation:n.p+"6203eb6a4fc82f535446.gif",water_splash:n.p+"65cb84a30dd726519f96.gif",coin:n.p+"d1cbabe3c3309d844b01.png",finishLine:n.p+"f932a91e02966d2e37df.png",flag:n.p+"c5df73d87cce293b72b2.png",green_button_pressed:n.p+"a4c3741200c4bf3589b2.png",red_button_unpressed:n.p+"a9649b9c0ca6ad3f62ee.png",repair_tools:n.p+"f58aa1b63be15e2c2efe.png",spring:n.p+"ca451f46683a500791da.png",treadmill:n.p+"2ff4b180aa382f1009e0.png",animatedCar:n.p+"836cc4388fb6b087af94.gif",carTop:n.p+"63dea1e30496223c5f68.png",carTopD:n.p+"042b09e1a162abd84f25.png",carTopG:n.p+"f07b12610f16df4b56e9.png",black_hole:n.p+"352e65fb9e40de43e642.png",brokenRocket:n.p+"526086da33ced52bab56.png",hole2:n.p+"9ebeff8d0e1b97368bbe.png",house:n.p+"3beb51a08f7d735ba7c2.png",lava:n.p+"12c09b436c8cf8c3461a.png",mars_dome:n.p+"ce546f03d11c52f98c7e.png",mountains:n.p+"e83fa141a32823b97ae8.png",rocheMars1:n.p+"d6031b0ee389e0a352cd.png",rocheMars2:n.p+"226761678284a4961498.png",stone:n.p+"16e1db820b154c8f90ee.png",tree:n.p+"5801333e71924c1b1762.png",water:n.p+"a964ac1c4ea1849879dc.jpg",bridge:n.p+"6b662d43bda0cbdbc176.png",road1:n.p+"e7cd7986640854a919b1.jpg",tire_tracks:n.p+"7a8e46bdbf060825e9fa.png",darkLava:n.p+"dac1a7ecd1b25b1a8fee.jpg",gazon:n.p+"7d8b0333fb362464191e.gif",grass:n.p+"25bd3fa60516bca11bab.jpg",mars_surface:n.p+"68c82669a5d9aedb2bfd.png",mud:n.p+"942e65ddaecf1468a7e0.jpg",rock:n.p+"2bc60a0d313aa5d24dc2.jpg",sand:n.p+"73e4392cd63f3ca31f6b.jpg",greenhouse1:n.p+"171d97d32a46856f2932.png",greenhouse2:n.p+"4194b8d6f3a1a6c04b65.png",greenhouse3:n.p+"8e51365598d078e41abb.png",worker1:n.p+"3b5d21666b7e0828e0e5.png",worker2:n.p+"2bc5c48fd99d141f1eca.png",worker3:n.p+"f36ec1869f8c88ce1182.png",worker4:n.p+"9fd936b96de5d62a31eb.png",worker5:n.p+"27057f5783a585aace48.png",worker6:n.p+"d2114852662127596d1e.png",worker7:n.p+"2b79bf0c2a5a265cfb85.png",worker8:n.p+"32598d5ce84e8090300a.png",plant1:n.p+"3d81b8675a9e183ab46d.png",plant2:n.p+"b442be2ef3f0273a3955.png",plant3:n.p+"64ab8dd2bb3f38e05577.png",plant4:n.p+"83b9e53642d8856190ae.png"},a=function(e){for(var t=0,n=Object.entries(o);t<n.length;t++){var a=(0,i.A)(n[t],2),s=a[0],r=a[1];"string"==typeof r&&(o[s]=[s,e.loadImage(r)])}},s={},r=[],l=function(e,t){for(var n=arguments.length,a=new Array(n>2?n-2:0),l=2;l<n;l++)a[l-2]=arguments[l];for(var c=function(){var n=h[u];if("string"!=typeof o[n])return r.includes(n)?t():(s[n]||(s[n]=[]),s[n].push(t)),1;o[n]=[n,e.loadImage(o[n],function(e){r.push(n),t(),Object.entries(s).forEac
1h(function(e){var t=(0,i.A)(e,2),o=t[0],a=t[1];n===o&&a.forEach(function(e){return e()})})})]},u=0,h=a;u<h.length;u++)c()},c=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];for(var s=0,r=Object.entries(o);s<r.length;s++){var l=(0,i.A)(r[s],2),c=l[0],u=l[1];n.includes([c,u])&&(o[c]=c)}},u={},h=function(e){}},21812(e,t,n){n.d(t,{A:()=>v});var i=n(73620),o=n(80296),a=n(38267),s=n(96540),r=n(63710),l=n(14837),c=n(18355),u=n(29016),h=n(92985),d=n(50856),p=n(74848),f=a.Ay.div.withConfig({displayName:"Cmd__StyledDiv",componentId:"sc-zik5wl-0"})(["white-space:normal;background-color:var(--gray-100-color);border-left:1px solid var(--gray-300-color);color:var(--fg-color);width:100%;height:100%;font-family:Arial,Helvetica,sans-serif;pre{font-family:'Fira Code',monospace;font-size:large;color:var(--fg-color);line-height:2rem;word-wrap:break-word;max-width:50px;}a{cursor:pointer;}.btn-clearCmdLines{width:fit-content;}"]);const v=s.forwardRef(function(e,t){var n=e.styledDivId,a=e.hideClearButton,v=e.fontSize,m=e.className,g=(0,h.A)("hide-logs","false"),b=(0,s.useState)("true"===g.get()),y=(0,o.A)(b,2),S=y[0],w=y[1],x=(0,r.Bd)().t,C=(0,s.useContext)(l.Dx).theme,M=(0,u.MW)();return(0,i.A)(f,{className:(0,c.xW)(!v&&"min-h-[4rem] text-left text-base font-normal tablet:text-lg","relative flex","flex-col","px-2 py-3 pt-5",m),style:{fontSize:null!=v?v:""},theme:C,id:n},void 0,!a&&(0,i.A)("div",{className:"absolute right-0 top-0 flex"},void 0,(0,i.A)("button",{className:(0,d.QP)("h-fit w-fit px-1 py-0.5 text-xs hover:underline",S?"text-primary-500":"text-red-500"),onClick:function(){if(t&&"current"in t&&t.current){var e=S;w(!e),g.set((!e).toString()),t.current.querySelectorAll(".logmsg").forEach(function(t){e?t.classList.remove("hidden"):t.classList.add("hidden")})}}},void 0,x(S?"cmd.show_logs":"cmd.hide_logs")),(0,i.A)("button",{onClick:function(){var e;t&&"current"in t&&t.current&&(navigator.clipboard.writeText(null!==(e=t.current.innerText)&&void 0!==e?e:""),M.success(x("msg.copied")))},className:"h-fit w-fit px-1 py-0.5 text-xs text-primary-500 hover:underline"},void 0,x("cmd.copy")),(0,i.A)("button",{onClick:function(){t&&"current"in t&&t.current&&(t.current.innerHTML="")},className:"h-fit w-fit py-0.5 pl-1 pr-2 text-xs text-red-500 hover:underline"},void 0,x("cmd.clear"))),(0,p.jsx)("div",{ref:t,className:"challenge-scroll h-full overflow-scroll","data-hide-logs":""+S}))})},26341(e,t,n){n.r(t),n.d(t,{Obstacle:()=>v});var i=n(23029),o=n(92901),a=n(56822),s=n(53954),r=n(85501),l=n(64467),c=n(48744),u=n(80821),h=n(33866),d=n(10740);function p(e,t,n){return t=(0,s.A)(t),(0,a.A)(e,f()?Reflect.construct(t,n||[],(0,s.A)(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}var v=function(e){function t(e,n){var o;(0,i.A)(this,t);for(var a=arguments.length,s=new Array(a>2?a-2:0),r=2;r<a;r++)s[r-2]=arguments[r];return o=p(this,t,[e].concat(s)),(0,l.A)(o,"shapeType","Obstacle"),(0,l.A)(o,"templateName",void 0),(0,l.A)(o,"isGameOver",void 0),(0,l.A)(o,"gameOverEvent",void 0),(0,l.A)(o,"defaultTemplate","stop"),(0,l.A)(o,"templates",{stop:{isGameOver:!0,gameOverEvent:{gameOverImg:d.gT.rocheMars1,message:"simulation.modal.wall"}},fall:{isGameOver:!0,gameOverEvent:{gameOverImg:d.gT.hole,message:"simulation.modal.hole"}},lava:{isGameOver:!0,gameOverEvent:{gameOverImg:d.gT.lava,message:"simulation.modal.lava"}},water:{isGameOver:!0,gameOverEvent:{gameOverImg:d.gT.water_splash,message:"simulation.modal.water"}}}),o.class="Obstacle",o.templateName=n,o.carInteraction=!0,o.loadFromTemplate(),o}
1return(0,r.A)(t,e),(0,o.A)(t,[{key:"collisionFct",value:function(){var e;this.s.editMode||!this.s.execution||this.isGameOver||null===(e=this.colliding.find(function(e){return e instanceof c.T}))||void 0===e||e.stop(this)}},{key:"playGameOverEvent",value:function(){var e,t;if(null!==(e=this.gameOverEvent)&&void 0!==e&&e.gameOverImg&&null!==(t=this.gameOverEvent)&&void 0!==t&&t.message){var n=Array.isArray(this.gameOverEvent.gameOverImg)?this.gameOverEvent.gameOverImg[0]:this.gameOverEvent.gameOverImg,i=this.gameOverEvent.message;console.log(n),this.s.onLose("src/assets/images/simulation/obstacles/"+n,i)}}},{key:"uniqueProperties",get:function(){return{}}},{key:"loadFromTemplate",value:function(){(0,h.P)(this,this.templates,this.templateName)}}])}(u.y)},33866(e,t,n){n.d(t,{P:()=>d});var i=n(80296),o=n(92901),a=n(23029),s=n(56822),r=n(53954),l=n(85501);function c(e,t,n){return t=(0,r.A)(t),(0,s.A)(e,u()?Reflect.construct(t,n||[],(0,r.A)(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var h=function(e){function t(){return(0,a.A)(this,t),c(this,t,arguments)}return(0,l.A)(t,e),(0,o.A)(t)}((0,n(50531).A)(Error));function d(e,t,n,o){var a=t[n];if(void 0===a){if(void 0===o)throw new h("Template ".concat(n," does not exist on type ").concat(e.shapeType));a=t[o]}Object.entries(t[n]).forEach(function(t){var n=(0,i.A)(t,2),o=n[0],a=n[1];o in e&&(e[o]=a)})}},47074(e,t,n){n.r(t),n.d(t,{Interactive:()=>p});var i=n(23029),o=n(92901),a=n(56822),s=n(53954),r=n(85501),l=n(64467),c=n(80821),u=n(33866);function h(e,t,n){return t=(0,s.A)(t),(0,a.A)(e,d()?Reflect.construct(t,n||[],(0,s.A)(e).constructor):t.apply(e,n))}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}var p=function(e){function t(e,n){var o;(0,i.A)(this,t);for(var a=arguments.length,s=new Array(a>2?a-2:0),r=2;r<a;r++)s[r-2]=arguments[r];return o=h(this,t,[e].concat(s)),(0,l.A)(o,"shapeType","Interactive"),(0,l.A)(o,"templateName",void 0),(0,l.A)(o,"isCollectable",!1),(0,l.A)(o,"isObjectif",!1),(0,l.A)(o,"isButton",!1),(0,l.A)(o,"linkedId",void 0),(0,l.A)(o,"defaultTemplate","collectable"),(0,l.A)(o,"templates",{objective:{isObjectif:!0},button:{isButton:!0,linkedId:[]},collectable:{isCollectable:!0},spring:{}}),o.class="Interactive",o.templateName=n,o.linkedId=[],o.carInteraction=!0,o.loadFromTemplate(),o.s.interactiveObjects.push(o),o.isCollectable&&o.s.coinsTotal++,o}return(0,r.A)(t,e),(0,o.A)(t,[{key:"uniqueProperties",get:function(){return{linkedId:this.linkedId}}},{key:"loadFromTemplate",value:function(){var e;(0,u.P)(this,this.templates,null!==(e=this.templateName)&&void 0!==e?e:this.defaultTemplate)}}])}(c.y);(0,l.A)(p,"totalCollectable",0)},48744(e,t,n){n.d(t,{T:()=>h});var i=n(23029),o=n(92901),a=n(56822),s=n(53954),r=n(85501),l=n(64467);function c(e,t,n){return t=(0,s.A)(t),(0,a.A)(e,u()?Reflect.construct(t,n||[],(0,s.A)(e).constructor):t.apply(e,n))}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var h=function(e){function t(e,n){var o;(0,i.A)(this,t);for(var a=arguments.length,s=new Array(a>2?a-2:0),r=2;r<a;r++)s[r-2]=arguments[r];return o=c(this,t,[e].concat(s)),(0,l.A)(o,"shapeType","Car"),(0,l.A)(o,"templateName",void 0),(0,l.A)(o,"defaultTemplate","base"),(0,l.A)(o,"templates",{base:{},physics:{}}),o.class="Car",o.templateName=n,o}return(0,r.A)(t,e),(0,o.A)(t,[{key:"uniqueProperties",get:function(){return{color:this.color}}},{key:"loadFromTemplate",value:function(){Object.assign(this,this.templates[this.templateName])}}])}(n(80821).y)},58072(e,t,n){n.d(t,{A:()=>u});var i=n(64467),o=n(38267),a=n(96540),s=n(74848);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
1t%2?r(Object(n),!0).forEach(function(t){(0,i.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var c=o.Ay.div.withConfig({displayName:"FillContainer__StyledContainer",componentId:"sc-1tvz4ms-0"})(["width:100%;height:100%;position:absolute;"]);const u=function(e){var t=e.centered,n=e.startAtTop,i=e.children,o=e.style,r=e.className,u=e.relative,h=e.id,d=(0,a.useRef)(null),p=l(l(l(l({},o),t?{display:"flex",alignItems:"center",justifyContent:"center"}:{}),n?{top:"0"}:{}),u?{position:"relative"}:{});return(0,a.useLayoutEffect)(function(){var e=function(){if(null!==d&&null!==d.current)if(u)d.current.style.height=d.current.parentNode.closest("div").clientHeight+"px";else if(n)d.current.style.height=window.innerHeight+"px";else{var e=document.getElementById("navbar");e&&(d.current.style.height=window.innerHeight-e.clientHeight-2+"px")}};return window.addEventListener("resize",e),e(),setTimeout(e,50),function(){window.removeEventListener("resize",e)}}),(0,s.jsx)(c,{id:h,className:r,style:p,ref:d,children:i})}},72249(e,t,n){n.d(t,{M:()=>s});var i=n(23029),o=n(92901),a=n(3437),s=function(){function e(t,n){(0,i.A)(this,e),this.x=t,this.y=n,this.calculateLength()}return(0,o.A)(e,[{key:"translateTo",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(n*=t/(1e3/60),(0,a.xg)(this,e)<=n/2)return this;var i=this.clone();return i.add(e.clone().substract(this).normalize().multiplyScalar(n)),(0,a.xg)(i,e)<=n/2?e.clone():i}},{key:"translate",value:function(t,n){var i=new e(t,0);i.rotate(n,new e(0,0)),this.add(i)}},{key:"calculateLength",value:function(){this.length=Math.sqrt(this.x*this.x+this.y*this.y)}},{key:"dist",value:function(e){return Math.sqrt(Math.pow(e.x-this.x,2)+Math.pow(e.y-this.y,2))}},{key:"add",value:function(e){return this.x+=e.x,this.y+=e.y,this.calculateLength(),this}},{key:"substract",value:function(e){return this.x-=e.x,this.y-=e.y,this.calculateLength(),this}},{key:"multiplyScalar",value:function(e){return this.x*=e,this.y*=e,this.calculateLength(),this}},{key:"normalize",value:function(){var e=1/this.length;return this.length=1,this.x*=e,this.y*=e,this}},{key:"isNormalized",value:function(){return 1===this.length}},{key:"isSimilar",value:function(e){return this.x===e.x&&this.y===e.y}},{key:"clone",value:function(){return new e(this.x,this.y)}},{key:"rotate",value:function(e,t){var n=this.x-t.x,i=this.y-t.y;this.x=n*Math.cos(e)-i*Math.sin(e),this.y=i*Math.cos(e)+n*Math.sin(e),this.x+=t.x,this.y+=t.y,this.roundVector(.001)}},{key:"direction",value:function(e){var t=e.y-this.y,n=e.x-this.x,i=Math.atan2(t,n);return(i*=180/Math.PI)<0&&(i=360+i),i}},{key:"roundVector",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.x=Math.round(this.x/e)*e,this.y=Math.round(this.y/e)*e,this}}],[{key:"translateTo",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;if(i*=n/(1e3/60),(0,a.xg)(e,t)<=i/2)return e;var o=e.clone();return o.add(t.clone().substract(e).normalize().multiplyScalar(i)),(0,a.xg)(o,t)<=i/2?t.clone():o}}])}()},74562(e,t,n){n.r(t),n.d(t,{default:()=>O});var i=n(64467),o=n(73620),a=n(45458),s=n(80296),r=n(96540),l=n(21812),c=n(10467),u=n(54756),h=n.n(u),d=n(38267),p=n(14837),f=n(18355),v=n(63710),m=n(54781);function g(e,t){return b.apply(this,arguments)}function b(){return b=(0,c.A)(h().mark(function e(t,n){var i,o,a,s,r,l=arguments;return h().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i=l.length>2&&void 0!==l[2]?l[2]:50,o=t.scrollHeight-t.clientHeight-t.scrollTop,s=o/(a=n*i),o>0&&(s=Math.ceil(2*s)/2,i=(a=o/s)/n),r=0;case 1:if(!(r<a)){e.next=3;break}return t.scrollTop=t.scrollTop+s,e.next=2,new Promise(function(e){return setTimeout(e,1e3/i)});case 2:r++,e.next=1;break;case 3:t.scrollTop=t.scrollHeight;case 4:case"end":return e.stop()}},e)})),b.apply(this,arguments)}var y=n(74848),S=d.Ay.div.withConfig({displayName:"PltView__StyledDiv",componentId:"sc-16set9e-0"})(["background-color:var(--gray-100-color);border-left:1px solid var(--gray-300-color);color:var(--fg-color);width:100%;height:100%;overflow-y:auto;font-family:Arial,Helvetica,sans-serif;.btn-clearCmdLines{padding-top:0.4rem;padding-bottom:0.4rem;width:fit-content;}"]),w=r.forwardRef(function(e){var t=e.open,n=e.fontSize,i=(0,r.useContext)(p.Dx).theme,a=(0,v.Bd)().t,l=(0,r.useContext)(m.P),u=l.items,d=(l.dispatch,(0,r.useRef)(null)),b=(0,r.useState)(!0),w=(0,s.A)(b,2),x=w[0],C=w[1];function M(){return(M=(0,c.A)(h().mark(function e(){return h().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,new Promise(function(e){return setTimeout(e,100)});case 1:d.current&&g(d.current,.3,50);case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}return(0,r.useEffect)(function(){x?C(!1):u.length>0&&t(),function(){M.apply(this,arguments)}()},[u]),(0,o.A)(S,{className:(0,f.xW)("relative flex min-h-[4rem]","flex-col","py-3"),style:{fontSize:null!=n?n:""},theme:i},void 0,(0,o.A)(p.$n,{variant:"danger",onClick:function(){d&&"current"in d&&d.current&&(d.current.innerHTML="")}
1,className:"absolute right-1 top-1",size:"sm"},void 0,a("plt.clear")),(0,y.jsx)("div",{ref:d,className:"challenge-scroll mt-7 h-full overflow-scroll px-3",children:u.map(function(e){return e})}))});const x=w;function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach(function(t){(0,i.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var k=d.Ay.div.withConfig({displayName:"ConsoleTabs__StyledDiv",componentId:"sc-bzho02-0"})([".tabs{background:var(--gray-200-color);}.tab-name{width:120px;text-align:center;margin:2px 3px 0 0;padding:5px;border-radius:10px 10px 0 0;border-width:1px 1px 0 1px;border-color:var(--gray-300-color);background-color:var(--gray-100-color);transition:all 100ms ease-in-out;}.tab-name:not(.selected){opacity:50%;cursor:pointer;}.tab-name:hover:not(.selected){border-width:3px 3px 0 3px;padding:3px;opacity:90%;border-color:var(--secondary-color);}"]);const O=r.forwardRef(function(e,t){var n,i=e.cmdRef,c=e.showPltView,u=e.className,h=e.extraTabs,d=e.noCmd,p=(0,v.Bd)().t,m=(0,r.useState)([].concat((0,a.A)(d?[]:[{id:"cmd",name:p("cmd.name"),open:!(null!=h&&h.some(function(e){return e.open})),component:(0,y.jsx)(l.A,{ref:i})}]),(0,a.A)(c?[{id:"plt",name:p("plt.name"),open:!1,component:(0,o.A)(x,{open:function(){return w(1)}})}]:[]),(0,a.A)(null!==(n=null==h?void 0:h.map(function(e){var t;return M(M({},e),{},{open:null!==(t=e.open)&&void 0!==t&&t})}))&&void 0!==n?n:[]))),g=(0,s.A)(m,2),b=g[0],S=g[1],w=function(e){var t=b.map(function(t,n){return t.open=n===e,t});S(t)};return(0,r.useImperativeHandle)(t,function(){return{setOpenedTab:w}}),(0,o.A)(k,{className:(0,f.xW)("flex h-full flex-col",u)},void 0,b.length>1&&(0,o.A)("div",{className:"tabs flex w-full flex-row"},void 0,b.map(function(e,t){return(0,o.A)("div",{className:"tab-name ".concat(e.open&&"selected"),onClick:function(){return w(t)}},e.id,e.name)})),b.map(function(e){return(0,o.A)("div",{className:"flex min-h-0 grow ".concat(!e.open&&"hidden")},e.id,"function"==typeof e.component?e.component():e.component)}))})},77143(e,t,n){n.r(t),n.d(t,{Terrain:()=>d});var i=n(80296),o=n(23029),a=n(92901),s=n(56822),r=n(53954),l=n(85501),c=n(64467);function u(e,t,n){return t=(0,r.A)(t),(0,s.A)(e,h()?Reflect.construct(t,n||[],(0,r.A)(e).constructor):t.apply(e,n))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}var d=function(e){function t(e,n){var i;(0,o.A)(this,t);for(var a=arguments.length,s=new Array(a>2?a-2:0),r=2;r<a;r++)s[r-2]=arguments[r];return i=u(this,t,[e].concat(s)),(0,c.A)(i,"shapeType","Terrain"),(0,c.A)(i,"templateName",void 0),(0,c.A)(i,"frictionCoef",void 0),(0,c.A)(i,"defaultTemplate","base"),(0,c.A)(i,"templates",{slower:{frictionCoef:1.08},slow:{frictionCoef:1.05},base:{frictionCoef:1},fast:{frictionCoef:.95},faster:{frictionCoef:.9}}),i.class="Terrain",i.templateName=n,i.carInteraction=!0,i.minimumSize=75,i.loadFromTemplate(),i}return(0,l.A)(t,e),(0,a.A)(t,[{key:"uniqueProperties",get:function(){return{}}},{key:"loadFromTemplate",value:function(){var e=this;Object.entries(this.templates[this.templateName]).forEach(function(t){var n=(0,i.A)(t,2),o=n[0],a=n[1];o in e&&(e[o]=a)})}}])}(n(80821).y)},80821(e,t,n){n.d(t,{X:()=>b,y:()=>g});var i=n(56822),o=n(53954),a=n(85501),s=n(50531),r=n(14243),l=n(80296),c=n(23029),u=n(92901),h=n(72249),d=n(3437);function p(e,t,n){return t=(0,o.A)(t),(0,i.A)(e,f()?Reflect.construct(t,n||[],(0,o.A)(e).constructor):t.apply(e,n))}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function v(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];
1if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return m(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){r=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}var g=function(){function e(t){(0,c.A)(this,e),this.s=t,this.id=t.id,t.id++,this.imgName="",this.class="Shape",this.rotation=new h.M(0,0),this.zIndex=0,this.camera=t.canvasCamera,this.vertices=[],this.strokeColor="white",this.alwaysStroke=!1,this.color="#2E75FF",this.soundOnCollision=null,this.hovering=!1,this.minimumSize=20,this.s.isMobile&&(this.minimumSize=40),this.movable=!1,this.pinned=!1,this.isHelp=!1,this.isEditBox=!1,this.isRotateBox=!1,this.scaleWithCamera=!1,this.hasTexture=!1,this.carInteraction=!1,this.colliding=[],this.children=[],this.bounds=[],this.res=null;for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];for(var a=0,s=i;a<s.length;a++){var r=s[a];this.vertices.push(new h.M(r[0],r[1]))}this.calculateCenterPos(),this.calculateForward(),this.setBounds(),this.rememberBounds()}return(0,u.A)(e,[{key:"setBounds",value:function(){this.middle=new h.M((this.calcLeftX()+this.calcRightX())/2,(this.calcTopY()+this.calcBottomY())/2),this.left=new h.M(this.calcLeftX(),this.middle.y),this.top=new h.M(this.middle.x,this.calcTopY()),this.right=new h.M(this.calcRightX(),this.middle.y),this.bottom=new h.M(this.middle.x,this.calcBottomY()),this.bounds.push(this.left),this.bounds.push(this.top),this.bounds.push(this.right),this.bounds.push(this.bottom),this.bounds.push(this.middle)}},{key:"calculateForward",value:function(){null==this.forward&&(this.forward=new h.M(0,0)),this.vertices.length<=1||(this.forward.x=this.vertices[0].x+(this.vertices[1].x-this.vertices[0].x)/2,this.forward.y=this.vertices[0].y+(this.vertices[1].y-this.vertices[0].y)/2,this.forward.substract(this.pos))}},{key:"setImg",value:function(e){var t=(0,l.A)(e,2),n=t[0],i=t[1];this.img=i,this.imgName=n}},{key:"setTexture",value:function(e){var t=(0,l.A)(e,2),n=t[0],i=t[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.img=i,this.imgName=n,this.res=o,this.hasTexture=!0}},{key:"setSoundOnCollision",value:function(e){this.soundOnCollision=e}},{key:"calculateCenterPos",value:function(){if(0!==this.vertices.length){for(var e=0,t=0,n=0;n<this.vertices.length;n++){var i=this.vertices[n],o=this.vertices[(n+1)%this.vertices.length],a=Math.max(i.x,o.x),s=Math.min(i.x,o.x),r=Math.max(i.y,o.y),l=Math.min(i.y,o.y);e+=s+(a-s)/2,t+=l+(r-l)/2}this.pos=new h.M(e/this.vertices.length,t/this.vertices.length)}}},{key:"cloneShape",value:function(){var t,n,i=[],o=v(this.vertices);try{for(o.s();!(t=o.n()).done;){var a=t.value.clone(),s=this.rotation.x*this.s.PI/180;a.rotate(s,this.pos),i.push([a.x,a.y])}}catch(e){o.e(e)}finally{o.f()}return(n=this instanceof y?(0,r.A)(y,[this.s,this.templateName].concat(i)):this instanceof S?(0,r.A)(S,[this.s,this.templateName].concat(i)):this instanceof w?(0,r.A)(w,[this.s,this.templateName].concat(i)):this instanceof x?(0,r.A)(x,[this.s,this.isCollectable?"collectable":this.isObjectif?"objective":this.isButton?"button":"spring"].concat(i)):(0,r.A)(e,[this.s].concat(i))).zIndex=this.zIndex,n.rotate(this.rotation.x),n}},{key:"draw",value:function(){if(this.hovering||this.alwaysStroke?this.s.stroke(this.strokeColor):this.s.noStroke(),this.s.fill(this.color),this.hasTexture){this.s.imageMode(this.s.CORNERS);for(var e=Math.ceil(this.getWidth()/(this.img.width*this.res)),t=Math.ceil(this.getHeight()/(this.img.height*this.res)),n=0;n<e;n++)for(var i=(this.pos.x+n*this.img.width*this.res-this.camera.pos.x)*(1e3/this.camera.scale)-this.getWidth()*(1e3/this.camera.scale)/2,o=(n===e-1?this.getWidth()-this.img.width*this.res*n:this.img.width*this.res)*(1e3/this.camera.scale),a=n===e-1?this.getWidth()-this.img.width*this.res*n:this.img.width*this.res,s=0;s<t;s++){var r=(this.camera.pos.y-this.pos.y+s*this.img.height*this.res)*(1e3/this.camera.scale)-this.getHeight()*(1e3/this.camera.scale)/2,l=new h.M(i,-r),c=-this.rotation.x*this.s.PI/180;l.rotate(c,new h.M((this.pos.x-this.camera.pos.x)*(1e3/this.camera.scale),(this.pos.y-this.camera.pos.y)*(1e3/this.camera.scale))),this.s.translate(l.x,-l.y),this.s.rotate(this.rotation.x);var u=(s===t-1?this.getHeight()-this.img.height*this.res*s:this.img.height*this.res)*(1e3/this.camera.scale),p=s===t-1?this.getHeight()-this.img.height*this.res*s:this.img.height*this.res;this.img&&this.s.image(this.img,0,0,o+.5,u+.5,0,0,a/this.res,p/this.res),this.s.rotate(-this.rotation.x),this.s.translate(-l.x,l.y)}this.s.imageMode(this.s.CENTER)}else if(null!=this.img){var f=(this.pos.x-this.camera.pos.x)*(1e3/this.camera.scale),m=(this.camera.pos.y-this.pos.y)*(1e3/this.camera.scale);this.s.translate(f,m),this.s.rotate(this.rotation.x),this.img&&this.s.image(this.img,0,0,(0,d.xg)(this.vertices[0],this.vertices[1])*(1e3/this.camera.scale),(0,d.xg)(this.vertices[1],this.vertices[2])*(1e3/this.camera.scale)),this.s.rotate(-this.rotation.x),this.s.translate(-f,-m)}else{this.s.beginShape(),this.scaleWithCamera&&(this.oldWidth/(1e3/this.camera.scale)).toFixed(3)!==this.getWidth().toFixed(3)&&(this.scale(this.oldWidth/this.getWidth()/(1e3/this.camera.scale)),this.isRotateBox&&this.setRotateBoxPos(this.parent));var g,b=v(this.vertices);try{for(b.s();!(g=b.n()).done;){var y=g.value;this.s.vertex((y.x-this.camera.pos.x)*(1e3/this.camera.scale),(this.camera.pos.y-y.y)*(1e3/this.camera.scale))}}catch(e){b.e(e)}finally{b.f()}this.s.endShape(this.s.CLOSE)}}},{key:"addChild",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e in this.children||(this.children.push(e),e.parent=this,t&&e.move(this.middle,!1))}},{key:"removeChild",value:function(e){e in this.children&&(this.children=this.children.filter(function(t){return t!==e}),e.parent=null)}},{key:"hasParent",value:function(){return null!=this.parent}},{key:"removeAllChildren",value:function(){var e,t=v(this.children);try{for(t.s();!(e=t.n()).done;){var n=e.value;this.s.deleteShape(n,!0)}}catch(e){t.e(e)}finally{t.f()}this.children=[]}},{key:"rotate",value:function(e,t){void 0===t&&(t=this.pos),this.rotation.x=(this.rotation.x+e)%360,this.rotation.x<0&&(this.rotation.x+=360);var n=360-e;n*=this.s.PI/180;var i,o=v(this.vertices);try{for(o.s();!(i=o.n()).done;)i.value.rotate(n,t)}catch(e){o.e(e)}finally{o.f()}var a,s=v(this.bounds);try{for(s.s();!(a=s.n()).done;)a.value.rotate(n,t)}catch(e){s.e(e)}finally{s.f()}t!==this.pos&&this.pos.rotate(n,t),null!=this.forward&&this.calculateForward();var r,l=v(this.children);try{for(l.s();!(r=l.n()).done;)r.value.rotate(e,t)}catch(e){l.e(e)}finally{l.f()}}},{key:"setRotation",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;null==t&&(t=this.pos);var n=e-this.rotation.x;0!==n&&this.rotate(n,t)}},{key:"getOrientationVector",value:function(){var e=this.rotation.x>270?this.rotation.x-90:(360-(this.rotation.x-90))%360,t=Math.PI*e/180,n=Math.cos(t),i=Math.sin(t);return new h.M(n,i)}},{key:"move",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.clone();if(t&&0!==this.s.pdt){var i=this.s.maxFPS/this.s.frameRate();n.multiplyScalar(i)}this.pos.add(n);var o,a=v(this.vertices);try{for(a.s();!(o=a.n()).done;)o.value.add(n)}catch(e){a.e(e)}finally{a.f()}var s,r=v(this.bounds);try{for(r.s();!(s=r.n()).done;)s.value.add(n)}catch(e){r.e(e)}finally{r.f()}var l,c=v(this.children);try{for(c.s();!(l=c.n()).done;)l.value.move(e,t)}catch(e){c.e(e)}finally{c.f()}}},{key:"moveInDirection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null!=e&&((e=e.clone()).isNormalized()||e.normalize(),this.move(e.multiplyScalar(t),n))}},{key:"moveTowards",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;e.substract(this.pos),e.isNormalized()||e.normalize(),this.move(new h.M(e.x*t,e.y*t))}},{key:"setPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.clone();n.substract(this.pos),t&&0!==this.s.pdt&&n.multiplyScalar(1/((Date.now()-this.s.pdt)/(1e3/this.s.maxFPS)||1)),this.move(n,t)}},{key:"scale",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;null==t&&(t=this.pos);var n,i=v(this.vertices);try{for(i.s();!(n=i.n()).done;){var o=n.value;o.x=(o.x-t.x)*e,o.y=(o.y-t.y)*e,o.x+=t.x,o.y+=t.y}}catch(e){i.e(e)}finally{i.f()}var a,s=v(this.bounds);try{for(s.s();!(a=s.n()).done;){var r=a.value;r.x=(r.x-t.x)*e,r.y=(r.y-t.y)*e,r.x+=t.x,r.y+=t.y}}catch(e){s.e(e)}finally{s.f()}t!==this.pos&&(this.pos.x=(this.pos.x-t.x)*e,this.pos.y=(this.pos.y-t.y)*e,this.pos.x+=t.x,this.pos.y+=t.y);var l,c=v(this.children);try{for(c.s();!(l=c.n()).done;)l.value.scale(e,t)}catch(e){c.e(e)}finally{c.f()}}},{key:"setZIndex",value:function(e){var t=this,n=this.s.shapes[this.zIndex];n=n.filter(function(e){return e!==t}),this.s.shapes[this.zIndex]=n,e in this.s.shapes?this.s.shapes[e].push(this):this.s.shapes[e]=[this],this.zIndex=e}},{key:"hasEventListener",value:function(e){return"function"==typeof e}},{key:"hoverExit",value:function(){this.hovering=!1,this.hoverExitFct()}},{key:"hoverExitFct",value:function(){}},{key:"onHoverExit",value:function(e){this.hoverExitFct=e}},{key:"hover",value:function(e){this.hovering=!0,this.hoverFct()}},{key:"hoverFct",value:function(){}},{key:"onHover",value:function(e){this.hoverFct=e}},{key:"scroll",value:function(e){this.hasEventListener(this.scrollFct)&&this.scrollFct(e)}},{key:"onScroll",value:function(e){this.scrollFct=e}},{key:"clickDownFct",value:function(){}},{key:"clickDown",value:function(){this.clickDownFct()}},{key:"onClickDown",value:function(e){this.clickDownFct=e}},{key:"pressedFct",value:function(){}},{key:"pressed",value:function(){this.pressedFct()}},{key:"onPressed",value:function(e){this.pressedFct=e}},{key:"clickFct",value:function(){}},{key:"click",value:function(){this.clickFct()}},{key:"onClick",value:function(e){this.clickFct=e}},{key:"rightClick",value:function(){}},{key:"collisionEnter",value:function(e){this.colliding.push(e.collidingWith),this.collisionEnterFct(e)}},{key:"collisionEnterFct",value:function(e){}},{key:"onCollisionEnter",value:function(e){this.collisionEnterFct=e}},{key:"collisionExit",value:function(e){this.colliding=this.colliding.filter(function(t){return t!==e.collidingWith}),this.collisionExitFct(e)}},{key:"collisionExitFct",value:function(e){}},{key:"onCollisionExit",value:function(e){this.collisionExitFct=e}},{key:"collision",value:function(e){this.colliding.includes(e.collidingWith)||this.collisionEnter(e),this.collisionFct(e)}},{key:"collisionFct",value:function(e){}},{key:"onCollision",value:function(e){this.collisionFct=e}},{key:"isRect",value:function(){if(4!==this.vertices.length)return!1;var e=this.vertices[0],t=this.vertices[1],n=this.vertices[2],i=this.vertices[3],o=(0,d.xg)(e,this.pos),a=(0,d.xg)(t,this.pos),s=(0,d.xg)(n,this.pos),r=(0,d.xg)(i,this.pos);return o.toFixed(1)===a.toFixed(1)&&a.toFixed(1)===s.toFixed(1)&&s.toFixed(1)===r.toFixed(1)}},{key:"isParallelogram",value:function(){if(4!==this.vertices.length)return!1;var e=this.vertices[0],t=this.vertices[1],n=this.vertices[2],i=this.vertices[3],o=(t.y-e.y)/(t.x-e.x===0?1e-7:t.x-e.x),a=(n.y-t.y)/(n.x-t.x===0?1e-7:n.x-t.x),s=-(i.y-n.y)/(i.x-n.x===0?1e-7:i.x-n.x),r=-(e.y-i.y)/(e.x-i.x===0?1e-7:e.x-i.x);return o===s&&a===r}},{key:"calcTopY",value:function(){var e,t=this.vertices[0].y,n=v(this.vertices);try{for(n.s();!(e=n.n()).done;){var i=e.value;i.y>t&&(t=i.y)}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"calcBottomY",value:function(){var e,t=this.vertices[0].y,n=v(this.vertices);try{for(n.s();!(e=n.n()).done;){var i=e.value;i.y<t&&(t=i.y)}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"calcLeftX",value:function(){var e,t=this.vertices[0].x,n=v(this.vertices);try{for(n.s();!(e=n.n()).done;){var i=e.value;i.x<t&&(t=i.x)}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"calcRightX",value:function(){var e,t=this.vertices[0].x,n=v(this.vertices);try{for(n.s();!(e=n.n()).done;){var i=e.value;i.x>t&&(t=i.x)}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"getWidth",value:function(){return this.right.dist(this.left)}},{key:"getHeight",value:function(){return this.top.dist(this.bottom)}},{key:"getWidthInMeters",value:function(){return this.s.convertPixelsToMeters(this.getWidth())}},{key:"getHeightInMeters",value:function(){return this.s.convertPixelsToMeters(this.getHeight())}},{key:"editShape",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.spawnImageBox();this.spawnRotateBox(t),e||(this.spawnMiddleEditBoxes(t),this.spawnCornerEditBoxes(t));var n,i=v(t.children);try{for(i.s();!(n=i.n()).done;)n.value.setupEditBox(e)}catch(e){i.e(e)}finally{i.f()}t.rotate(this.rotation.x,t.parent.middle)}},{key:"spawnImageBox",value:function(){var e=this,t=this.s.spawnRect(0,0,this.getWidth(),this.getHeight(),this.zIndex);return this.addChild(t,!0),t.alwaysStroke=!0,t.isHelp=!0,t.strokeColor=this.s.color(0,150,255),t.color=this.s.color(0,0),t.onClickDown(function(){e.hovering&&(e.s.pressedObject=e)}),t}}
1,{key:"spawnRotateBox",value:function(e){var t=this.s.spawnRect(-e.getWidth()/2-this.s.editBoxSize/(1e3/this.camera.scale),e.getHeight()/2+this.s.editBoxSize/(1e3/this.camera.scale),this.s.editBoxSize,this.s.editBoxSize,350);t.cursor="ne-resize",t.isRotateBox=!0,e.addChild(t,!0)}},{key:"spawnMiddleEditBoxes",value:function(e){var t=this.s.spawnRect(-e.getWidth()/2,0,this.s.editBoxSize,this.s.editBoxSize,350);t.cursor="w-resize",e.addChild(t,!0);var n=this.s.spawnRect(0,e.getHeight()/2,this.s.editBoxSize,this.s.editBoxSize,350);n.cursor="n-resize",e.addChild(n,!0);var i=this.s.spawnRect(e.getWidth()/2,0,this.s.editBoxSize,this.s.editBoxSize,350);i.cursor="e-resize",e.addChild(i,!0);var o=this.s.spawnRect(0,-e.getHeight()/2,this.s.editBoxSize,this.s.editBoxSize,350);o.cursor="s-resize",e.addChild(o,!0)}},{key:"spawnCornerEditBoxes",value:function(e){var t=this.s.spawnRect(-e.getWidth()/2,e.getHeight()/2,this.s.editBoxSize,this.s.editBoxSize,350);t.cursor="nw-resize",e.addChild(t,!0);var n=this.s.spawnRect(e.getWidth()/2,e.getHeight()/2,this.s.editBoxSize,this.s.editBoxSize,350);n.cursor="ne-resize",e.addChild(n,!0);var i=this.s.spawnRect(e.getWidth()/2,-e.getHeight()/2,this.s.editBoxSize,this.s.editBoxSize,350);i.cursor="se-resize",e.addChild(i,!0);var o=this.s.spawnRect(-e.getWidth()/2,-e.getHeight()/2,this.s.editBoxSize,this.s.editBoxSize,350);o.cursor="sw-resize",e.addChild(o,!0)}},{key:"setupEditBox",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.alwaysStroke=!0,this.isHelp=!0,this.isEditBox=!0,this.scaleWithCamera=!0,this.strokeColor=this.s.color(0,150,255),this.color="white",this.leftEdgeClickDown=!1,this.upEdgeClickDown=!1,this.rightEdgeClickDown=!1,this.bottomEdgeClickDown=!1;var n=this.parent.parent,i=this.parent;this.isRotateBox||(this.left.x<i.left.x&&(this.leftEdgeClickDown=!0),this.right.x>i.right.x&&(this.rightEdgeClickDown=!0),this.top.y>i.top.y&&(this.upEdgeClickDown=!0),this.bottom.y<i.bottom.y&&(this.bottomEdgeClickDown=!0)),this.onHover(function(){e.s.fullscreenDiv.css("cursor",e.cursor)}),this.onClick(function(){n.removeAllChildren(),n.editShape(t)}),this.onHoverExit(function(){e.s.fullscreenDiv.css("cursor","default")})}},{key:"rotateFromRotateBox",value:function(){var e=this.parent.parent,t=e.pos.direction(this.pos),n=e.pos.direction(this.s.mouse),i=Math.round(t-n);return e.rotate(i),i}},{key:"rememberBounds",value:function(){this.oldLeft=this.left.clone(),this.oldTop=this.top.clone(),this.oldRight=this.right.clone(),this.oldBottom=this.bottom.clone(),this.oldMiddle=this.middle.clone(),this.oldWidth=this.getWidth(),this.oldHeight=this.getHeight()}},{key:"adjacentDist",value:function(e,t){return e*=this.s.PI/180,t*Math.sin(e)}},{key:"adjacentDistImage",value:function(e,t){e<0&&(e=360+e);var n=Math.floor(e/90);n%2==0?e%=90:e=90-e%90;var i=this.adjacentDist(e,t);return n>1&&(i=0-i),i}},{key:"modifySize",value:function(){var e=this.parent.parent,t=this.parent;if(t.rememberBounds(),this.s.mouse.roundVector(10),this.leftEdgeClickDown){var n=t.left.dist(this.s.mouse.clone()),i=t.left.direction(this.s.mouse)-t.right.direction(t.vertices[1]),o=this.adjacentDistImage(i,n);t.getWidth()+o<e.minimumSize&&(o=0-(t.getWidth()-e.minimumSize));var a=t.right.direction(t.left);a*=this.s.PI/180,t.vertices[0].translate(o,a),t.vertices[3].translate(o,a),t.left.translate(o,a),t.middle.translate(o/2,a),t.top.translate(o/2,a),t.bottom.translate(o/2,a)}if(this.upEdgeClickDown){var s=t.top.dist(this.s.mouse.clone()),r=t.top.direction(this.s.mouse)-t.bottom.direction(t.vertices[2]),l=this.adjacentDistImage(r,s);t.getHeight()+l<e.minimumSize&&(l=0-(t.getHeight()-e.minimumSize));var c=t.bottom.direction(t.top);c*=this.s.PI/180,t.vertices[0].translate(l,c),t.vertices[1].translate(l,c),t.top.translate(l,c),t.middle.translate(l/2,c),t.left.translate(l/2,c),t.right.translate(l/2,c)}if(this.rightEdgeClickDown){var u=t.right.dist(this.s.mouse.clone()),h=t.right.direction(this.s.mouse)-t.left.direction(t.vertices[3]),d=this.adjacentDistImage(h,u);t.getWidth()+d<e.minimumSize&&(d=0-(t.getWidth()-e.minimumSize));var p=t.left.direction(t.right);p*=this.s.PI/180,t.vertices[1].translate(d,p),t.vertices[2].translate(d,p),t.right.translate(d,p),t.middle.translate(d/2,p),t.top.translate(d/2,p),t.bottom.translate(d/2,p)}if(this.bottomEdgeClickDown){var f=t.bottom.dist(this.s.mouse.clone()),m=t.bottom.direction(this.s.mouse)-t.to
1p.direction(t.vertices[0]),g=this.adjacentDistImage(m,f);t.getHeight()+g<e.minimumSize&&(g=0-(t.getHeight()-e.minimumSize));var b=t.top.direction(t.bottom);b*=this.s.PI/180,t.vertices[2].translate(g,b),t.vertices[3].translate(g,b),t.bottom.translate(g,b),t.middle.translate(g/2,b),t.right.translate(g/2,b),t.left.translate(g/2,b)}var y,S=v(t.children);try{for(S.s();!(y=S.n()).done;){var w=y.value;if(w.isRotateBox)w.setRotateBoxPos(t);else{var x=w.pos.clone();t.resizeVectorToImage(x,t),w.setPos(x,!1)}}}catch(e){S.e(e)}finally{S.f()}e.resizeShape(t)}},{key:"setRotateBoxPos",value:function(e){var t=new h.M(e.vertices[0].x-this.s.editBoxSize/(1e3/this.camera.scale),e.vertices[0].y+this.s.editBoxSize/(800/this.camera.scale)),n=e.vertices[0].dist(t),i=135-this.rotation.x;i*=this.s.PI/180;var o=e.vertices[0].clone();o.translate(n,i),this.setPos(o,!1)}},{key:"resizeShape",value:function(e){this.rememberBounds();var t,n=v(this.vertices);try{for(n.s();!(t=n.n()).done;){var i=t.value;this.resizeVectorToImage(i,e)}}catch(e){n.e(e)}finally{n.f()}var o,a=v(this.bounds);try{for(a.s();!(o=a.n()).done;){var s=o.value;this.resizeVectorToImage(s,e)}}catch(e){a.e(e)}finally{a.f()}this.calculateCenterPos()}},{key:"resizeVectorToImage",value:function(e,t){var n,i,o=t.getWidth()/this.oldWidth,a=t.getHeight()/this.oldHeight,s=Math.round(t.middle.dist(this.oldLeft)),r=Math.round(t.middle.dist(this.oldRight)),l=Math.round(t.middle.dist(this.oldTop)),c=Math.round(t.middle.dist(this.oldBottom));if(o>1&&s<r||o<1&&s>r?n="left":(o>1&&s>r||o<1&&s<r)&&(n="right"),a>1&&l<c||a<1&&l>c?i="top":(a>1&&l>c||a<1&&l<c)&&(i="bottom"),"right"===n){var u=this.oldLeft.dist(e),h=e.direction(this.oldLeft)+this.rotation.x;Math.floor(h/90)%2==0?h=90-h%90:h%=90;var d=this.adjacentDist(h,u);d=d*o-d;var p=360-this.rotation.x;p*=this.s.PI/180,e.translate(d,p)}if("left"===n){var f=this.oldRight.dist(e),v=e.direction(this.oldRight)+this.rotation.x;Math.floor(v/90)%2==0?v=90-v%90:v%=90;var m=this.adjacentDist(v,f);m=m*o-m;var g=360-this.rotation.x;g*=this.s.PI/180,e.translate(-m,g)}if("bottom"===i){var b=this.oldTop.dist(e),y=e.direction(this.oldTop)+this.rotation.x;Math.floor(y/90)%2==0?y%=90:y=90-y%90;var S=this.adjacentDist(y,b);S=S*a-S;var w=(90-this.rotation.x)%360;w*=this.s.PI/180,e.translate(-S,w)}if("top"===i){var x=this.oldBottom.dist(e),C=e.direction(this.oldBottom)+this.rotation.x;Math.floor(C/90)%2==0?C%=90:C=90-C%90;var M=this.adjacentDist(C,x);M=M*a-M;var k=(90-this.rotation.x)%360;k*=this.s.PI/180,e.translate(M,k)}}}])}(),b=function(e){function t(){return(0,c.A)(this,t),p(this,t,arguments)}return(0,a.A)(t,e),(0,u.A)(t)}((0,s.A)(Error)),y=n(26341).Obstacle,S=n(99282).Road,w=n(77143).Terrain,x=n(47074).Interactive},98905(e,t,n){n.r(t),n.d(t,{default:()=>Ye});var i=n(73620),o=n(80296),a=n(96540),s=n(29016),r=n(63710),l=n(41481),c=n(12164),u=n(58072),h=n(14243),d=n(80821),p=n(23029),f=n(92901),v=n(56822),m=n(53954),g=n(85501),b=n(72249),y=n(3437);function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function w(e,t,n){return t=(0,m.A)(t),(0,v.A)(e,x()?Reflect.construct(t,n||[],(0,m.A)(e).constructor):t.apply(e,n))}function x(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(x=function(){return!!e})()}var C=function(e){function t(e){var n;(0,p.A)(this,t);for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return(n=w(this,t,[e].concat(o))).class="FixedObject",n.isRestricted=!1,n.isUndo=!1,n.isRedo=!1,n}return(0,g.A)(t,e),(0,f.A)(t,[{key:"resize",value:function(e,t){this.setPos(new b.M(this.pos.x*(this.s.width/e),this.pos.y*(this.s.height/t)),!1),this.s.height<this.s.width?this.scale(this.s.height/t):this.s.height>this.s.width?this.scale(this.s.width/e):t<e?this.scale(this.s.height/t):this.scale(this.s.width/e)}},{key:"draw",value:function(){this.hovering||this.alwaysStroke?this.s.stroke(this.strokeColor):this.s.noStroke(),this.s.fill(this.color),this.s.beginShape();var e,t=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];
1if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return S(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){r=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}(this.vertices);try{for(t.s();!(e=t.n()).done;){var n=e.value;this.s.vertex(n.x,-n.y)}}catch(e){t.e(e)}finally{t.f()}if(this.s.endShape(this.s.CLOSE),null!=this.img){var i=this.pos.x,o=-this.pos.y;this.s.translate(i,o),this.s.rotate(this.rotation.x),this.s.image(this.img,0,0,(0,y.xg)(this.vertices[0],this.vertices[1]),(0,y.xg)(this.vertices[1],this.vertices[2])),this.s.rotate(-this.rotation.x),this.s.translate(-i,-o)}}}])}(d.y);function M(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return k(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){r=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function O(e,t,n){return t=(0,m.A)(t),(0,v.A)(e,A()?Reflect.construct(t,n||[],(0,m.A)(e).constructor):t.apply(e,n))}function A(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(A=function(){return!!e})()}var T=function(e){function t(e,n,i,o,a){var s,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"black";(0,p.A)(this,t);var l=e.textSize();e.textSize(i);var c=e.textWidth(n),u=.8*e.textAscent(),h=.8*e.textDescent(),f=u+h;if(!(s=O(this,t,[e,[o-c/2,a+f/2],[o+c/2,a+f/2],[o+c/2,a-f/2],[o-c/2,a-f/2]])).isRect())throw new d.X("Can only create a text component of a rectangular shape");return s.class="FixedTextObject",s.text=n,s.size=i,s.scalar=.8,s.w=c,s.h=f,s.ascent=u,s.descent=h,s.color=r,s.strokeColor=s.s.color(0,0),e.textSize(l),s}return(0,g.A)(t,e),(0,f.A)(t,[{key:"draw",value:function(){this.hovering||this.alwaysStroke?this.s.stroke(this.strokeColor):this.s.noStroke();var e=this.pos.x,t=-this.pos.y;if(null!=this.img)this.s.translate(e,t),this.s.rotate(this.rotation.x),this.s.image(this.img,0,0,(0,y.xg)(this.vertices[0],this.vertices[1]),(0,y.xg)(this.vertices[1],this.vertices[2])),this.s.rotate(-this.rotation.x),this.s.translate(-e,-t);else if(null!=this.backgroundColor){this.s.fill(this.backgroundColor),this.s.beginShape();var n,i=M(this.vertices);try{for(i.s();!(n=i.n()).done;){var o=n.value;this.s.vertex(o.x,-o.y)}}catch(e){i.e(e)}finally{i.f()}this.s.endShape(this.s.CLOSE)}this.s.fill(this.color),this.s.translate(e,t),this.s.rotate(this.rotation.x);var a=this.s.textSize();this.s.textSize(this.size),this.s.text(this.text,0,0),this.s.textSize(a),this.s.rotate(-this.rotation.x),this.s.translate(-e,-t)}},{key:"scale",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.size*=e,null==t&&(t=this.pos);var n,i=M(this.vertices);try{for(i.s();!(n=i.n()).done;){var o=n.value;o.x=(o.x-t.x)*e,o.y=(o.y-t.y)*e,o.x+=t.x,o.y+=t.y}}catch(e){i.e(e)}finally{i.f()}t!==this.pos&&(this.pos.x=(this.pos.x-t.x)*e,this.pos.y=(this.pos.y-t.y)*e,this.pos.x+=t.x,this.pos.y+=t.y);var a,s=M(this.children);try{for(s.s();!(a=s.n()).done;)a.value.scale(e,t)}catch(e){s.e(e)}finally{s.f()}}}
1,{key:"setBackgroundColor",value:function(e){this.backgroundColor=e}}])}(d.y),j=n(26341),I=n(99282),D=n(77143),B=n(47074),R=n(64467);function P(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return F(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?F(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){r=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function z(e,t,n){return t=(0,m.A)(t),(0,v.A)(e,E()?Reflect.construct(t,n||[],(0,m.A)(e).constructor):t.apply(e,n))}function E(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(E=function(){return!!e})()}var _=function(e){function t(e,n){var i;(0,p.A)(this,t);for(var o=arguments.length,a=new Array(o>2?o-2:0),s=2;s<o;s++)a[s-2]=arguments[s];i=z(this,t,[e].concat(a)),(0,R.A)(i,"shapeType","TextObject"),(0,R.A)(i,"templateName",void 0),(0,R.A)(i,"text",void 0),(0,R.A)(i,"size",void 0),(0,R.A)(i,"defaultTemplate","base"),(0,R.A)(i,"templates",{base:{}}),i.templateName=n;var r=e.textSize();if(!i.isRect())throw new d.X("Can only create a text component of a rectangular shape");return i.class="TextObject",e.textSize(r),i}return(0,g.A)(t,e),(0,f.A)(t,[{key:"w",get:function(){return this.s.textWidth(this.text)}},{key:"h",get:function(){return this.ascent+this.descent}},{key:"ascent",get:function(){return this.s.textAscent()*t.scalar}},{key:"descent",get:function(){return this.s.textDescent()*t.scalar}},{key:"draw",value:function(){if(void 0!==this.pos){this.hovering||this.alwaysStroke?this.s.stroke(this.strokeColor):this.s.noStroke();var e=(this.pos.x-this.camera.pos.x)*(1e3/this.camera.scale),t=(this.camera.pos.y-this.pos.y)*(1e3/this.camera.scale);null!=this.img&&(this.s.translate(e,t),this.s.rotate(this.rotation.x),this.s.image(this.img,0,0,(0,y.xg)(this.vertices[0],this.vertices[1])*(1e3/this.camera.scale),(0,y.xg)(this.vertices[1],this.vertices[2])*(1e3/this.camera.scale)),this.s.rotate(-this.rotation.x),this.s.translate(-e,-t)),this.s.fill(this.color),this.s.translate(e,t),this.s.rotate(this.rotation.x);var n=this.s.textSize();this.s.textSize(this.size*(1e3/this.s.canvasCamera.scale)-1),this.s.text(this.text,0,0),this.s.textSize(n),this.s.rotate(-this.rotation.x),this.s.translate(-e,-t)}}},{key:"scale",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.size*=e,void 0!==this.pos){null==t&&(t=this.pos);var n,i,o,a=P(this.vertices);try{for(a.s();!(n=a.n()).done;){var s=n.value;s.x=(s.x-t.x)*e,s.y=(s.y-t.y)*e,s.x+=t.x,s.y+=t.y}}catch(e){a.e(e)}finally{a.f()}t!==this.pos&&(this.pos.x=((null===(i=this.pos)||void 0===i?void 0:i.x)-t.x)*e,this.pos.y=((null===(o=this.pos)||void 0===o?void 0:o.y)-t.y)*e,this.pos.x+=t.x,this.pos.y+=t.y);var r,l=P(this.children);try{for(l.s();!(r=l.n()).done;)r.value.scale(e,t)}catch(e){l.e(e)}finally{l.f()}}}},{key:"uniqueProperties",get:function(){return{text:this.text,color:this.color,size:this.size}}},{key:"loadFromTemplate",value:function(){Object.assign(this,this.templates[this.templateName])}}])}(d.y);(0,R.A)(_,"scalar",.8);var W={s:null,enabled:!1,acceleration:function(e,t){return t<1e-10?(function(){throw new Error("La masse entrée est égale ou presque égale à zéro")}(),null):e.clone().multiplyScalar(1/t)},speed:function(e,t){var n,i=(null===(n=W.s)||void 0===n?void 0:n.maxFPS)/W.s.frameRate(),o=t.multiplyScalar(i);return e.clone().add(o)},rollingFrictionForce:function(e,t,n){var i=e*t*9.8;return n.clone().multiplyScalar(-1).clone().multiplyScalar(i)}},L=n(10740);function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function H(e,t,n){return e.set(U(e,t),n),n}function U(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}var V=new WeakMap,G=function(){return(0,f.A)(function e(t,n){var i,o,a;(0,p.A)(this,e),a=void 0,function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(i=this,o=V),o.set(i,a),(0,R.A)(this,"nbFrameToEquilibrium",void 0),this.s=t,this.shape=n,this.initShape(),this.shape.shapeType="Car",this.dir=new b.M(0,0),this.initialSpeed=0,H(V,this,0),this.rotateSpeed=2,this.turning=!1,this.rotationGoal=null,this.initialRotateSpeed=this.rotateSpeed,this.initialPos=n.pos.clone(),this.initialRotation=n.rotation.clone(),this.i=0,this.MASS=250,this.INITIAL_FORCE_MODULUS=2700,this.currentForceModulus=this.INITIAL_FORCE_MODULUS,this.friction=0},[{key:"initShape",value:function(){var e=this;this.shape.movable=!0,this.nbFrameToEquilibrium=45,this.shape.onHover(function(){e.s.editMode&&e.s.fullscreenDiv.css("cursor","move")}),this.shape.onClick(function(){e.s.editMode&&!e.s.keyIsDown(32)&&0===e.shape.children.length&&e.shape.editShape(!0)}),this.shape.onHoverExit(function(){e.s.editMode&&e.s.fullscreenDiv.css("cursor","default")}),this.shape.onCollisionEnter(function(){e.interactions(!1)}),this.shape.onCollisionExit(function(){e.shape.colliding.length>0&&e.interactions(!0)})}},{key:"topShapeCollision",value:function(){var e,t=-1,n=null,i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];
1if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return N(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?N(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){r=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}(this.shape.colliding);try{for(i.s();!(e=i.n()).done;){var o=e.value;o.carInteraction&&o.zIndex>=t&&(t=o.zIndex,n=o)}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"interactions",value:function(e){var t=this,n=this.topShapeCollision();if(n instanceof D.Terrain||n instanceof I.Road);
1else if(!this.s.editMode)if(n instanceof j.Obstacle){if(this.stop(n),n.isGameOver)return void n.playGameOverEvent();var i=this.shape.forward.clone();i.y=-i.y,this.shape.moveInDirection(i,this.dir.y*this.speed+1.5*this.speed,!0)}else if(n instanceof B.Interactive){if(n.isCollectable){this.s.coinsToRespawn.push(n),this.s.movableShapes.forEach(function(e,i){t.s.movableShapes[i].originalShape.id===n.id&&t.s.movableShapes.splice(i,1)}),this.shape.colliding.forEach(function(e,i){t.shape.colliding[i].id===n.id&&t.shape.colliding.splice(i,1)}),this.s.deleteShape(n,!0);var o=!1;return this.s.interactiveObjects.forEach(function(e,n){t.s.interactiveObjects[n].isObjectif&&(o=!0)}),void(this.s.coinsTotal!==this.s.coinsToRespawn.length||o||this.win())}n.isObjectif&&this.s.coinsTotal===this.s.coinsToRespawn.length?this.win():n.isButton&&(n.setImg(L.gT.green_button_pressed),n.linkedId.forEach(function(e,i){var o=t.s.getShapeById(n.linkedId[i]);null!=o&&(t.s.objectsToRespawn.push(o),t.s.deleteShape(o),t.s.movableShapes.forEach(function(e,n){t.s.movableShapes[n].originalShape.id===o.id&&t.s.movableShapes.splice(n,1)}))}))}}},{key:"win",value:function(){this.s.onWin()}},{key:"update",value:function(){if(0!==this.dir.y)if(W.enabled){var e=this.topShapeCollision(),t=1;(e instanceof D.Terrain||e instanceof I.Road)&&(t=e.frictionCoef,t=1);var n=this.shape.forward.normalize();this.friction=W.rollingFrictionForce(t,this.MASS,n.clone()),this.currentForceModulus+=(this.friction.length-this.currentForceModulus)/this.nbFrameToEquilibrium;var i=(360-this.shape.rotation.x+90)%360*Math.PI/180,o=new b.M(Math.cos(i)*this.currentForceModulus,Math.sin(i)*this.currentForceModulus).clone().add(this.friction),a=W.acceleration(o,this.MASS),s=W.speed(n.clone().multiplyScalar(this.speed),a);this.speed=s.length;var r=W.s.maxFPS/W.s.frameRate();this.shape.move(s.clone().multiplyScalar(this.dir.y).multiplyScalar(r))}else this.speed=10,this.shape.moveInDirection(this.shape.forward,this.dir.y*this.speed,!0);if(0!==this.dir.x&&(this.shape.rotate(this.dir.x*this.rotateSpeed),this.dir.x<0?this.shape.setImg(L.gT.carTopG):this.shape.setImg(L.gT.carTopD)),this.rotationGoal){var l=this.rotationGoal,c=this.rotateSpeed*this.rotationDir*(this.s.maxFPS/this.s.frameRate()),u=0;if(Math.abs(l-this.rotationAmount)<=Math.abs(c/2)?u=l:(this.rotationAmount+=c,u=Math.abs(l-this.rotationAmount)<=Math.abs(c/2)?l:this.rotationAmount),this.shape.setRotation(u+this.rotationBeforeTurn),u===l&&(this.rotationGoal=null,this.shape.setImg(L.gT.carTop),null!=this.callback)){var h=this.callback;this.callback=null,h()}}this.i%this.updateInterval===0&&(this.updateFct(),this.i=1),this.i++}},{key:"updateFct",value:function(){}},{key:"onUpdate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;t<=0&&(t=1),this.updateInterval=t,this.updateFct=e}},{key:"speed",get:function(){return(e=V).get(U(e,this));var e},set:function(e){H(V,this,e)}},{key:"speedIRL",get:function(){return 3*this.speed/110}},{key:"speed_pixel_frame",get:function(){return this.s.convertMetersToPixels(this.speed)/this.s.maxFPS}},{key:"setDirection",value:function(e){this.dir=e.clone(),console.log(this.dir)}},{key:"forward",value:function(){this.dir.y=1}},{key:"backward",value:function(){this.dir.y=-1}},{key:"getTimeToRotate",value:function(e){return Math.abs(e/this.rotateSpeed)}},{key:"turn",value:function(e,t){this.shape.setImg(e>0?L.gT.carTopD:L.gT.carTopG),this.rotationBeforeTurn=this.shape.rotation.x,this.rotationAmount=0,this.rotationDir=e<0?-1:1,this.turning=!0,this.rotationGoal=e,this.callback=t}},{key:"stopRotate",value:function(){this.turning=!1,this.rotationGoal=null,this.shape.setImg(L.gT.carTop)}},{key:"stop",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.dir.multiplyScalar(0),null!=e){var t=e.pos.direction(this.shape.pos);t*=this.s.PI/180;var n=this.shape.pos.clone();n.translate(1,t),this.shape.setPos(n)}this.currentForceModulus=this.INITIAL_FORCE_MODULUS}},{key:"setInitialPlacement",value:function(){this.initialPos=this.shape.pos.clone(),this.initialRotation=this.shape.rotation.clone()}},{key:"reset",value:function(){this.stop(),this.speed=this.initialSpeed,this.rotateSpeed=this.initialRotateSpeed,this.shape.setPos(this.initialPos),this.shape.setRotation(this.initialRotation.x),this.shape.setImg(L.gT.carTop),this.rotationGoal=null,this.turning=!1,this.rotationDir=0,this.rotationAmount=0,null!=this.s.canvasCamera&&this.s.canvasCamera.setPos(this.shape.pos.clone())}}])}(),X=function(){return(0,f.A)(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(0,p.A)(this,e),this.pos=new b.M(t,n),this.scale=1e3,this.w=this.scale,this.h=this.scale,this.following=!1,this.wheelScaling=!0},[{key:"update",value:function(){this.following&&null!=this.target&&this.setPos(this.target.pos.clone())}},{key:"move",value:function(e){e.add(this.pos),this.setPos(e)}},{key:"setPos",value:function(e){null!=this.pos_max&&null!=this.pos_min&&(e.x>this.pos_max.x&&(e.x=this.pos_max.x),e.y>this.pos_max.y&&(e.y=this.pos_max.y),e.x<this.pos_min.x&&(e.x=this.pos_min.x),e.y<this.pos_min.y&&(e.y=this.pos_min.y)),this.pos=e}},{key:"addScale",value:function(e){this.setScale(this.scale+e)}},{key:"setScale",value:function(e){null!=this.scale_min&&null!=this.scale_max&&(e>this.scale_max&&(e=this.scale_max),e<this.scale_min&&(e=this.scale_min)),e>6e3&&(e=6e3),e<150&&(e=150),this.scale=e,this.w=this.scale,this.h=this.scale}},{key:"setTarget",value:function(e){if(null==e)return this.target=null,void(this.following=!1);if(e instanceof d.y)this.target=e;else{if(null==e.shape)return;this.target=e.shape}this.following=!0}},{key:"stopFollowing",value:function(){this.following=!1,null!=this.target&&this.pos.clone()}},{key:"removeBound",value:function(){this.pos_min=null,this.pos_max=null}},{key:"setBound",value:function(e,t){this.pos_min=e,this.pos_max=t}},{key:"enableWheelScaling",value:function(e){this.wheelScaling=e}},{key:"removeScaleBound",value:function(){this.scale_min=null,this.scale_max=null}},{key:"setScaleBound",value:function(e,t){this.scale_min=e,this.scale_max=t}}])}(),q=n(45458),Y=n(90991),$=n(33866);function Z(e,t,n){return t=(0,m.A)(t),(0,v.A)(e,Q()?Reflect.construct(t,n||[],(0,m.A)(e).constructor):t.apply(e,n))}function Q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(Q=function(){return!!e})()}var J=function(e){function t(e,n){var i;(0,p.A)(this,t);for(var o=arguments.length,a=new Array(o>2?o-2:0),s=2;s<o;s++)a[s-2]=arguments[s];return i=Z(this,t,[e].concat(a)),(0,R.A)(i,"shapeType","Figure"),(0,R.A)(i,"templateName",void 0),(0,R.A)(i,"defaultTemplate","base"),(0,R.A)(i,"templates",{base:{}}),i.class="Figure",i.templateName=n,i.loadFromTemplate(),i}return(0,g.A)(t,e),(0,f.A)(t,[{key:"click",value:function(){var e,n,i;if((e=t,n=this,"function"==typeof(i=(0,Y.A)((0,m.A)(e.prototype),"click",n))?function(e){return i.apply(n,e)}:i)([]),this.s.editMode&&this.s.keyIsDown(16)){var o=prompt("Changer couleur pour:");(0,y.ku)(null!=o?o:"")&&(this.color=null!=o?o:this.color)}}},{key:"uniqueProperties",get:function(){return{color:this.color}}},{key:"loadFromTemplate",value:function(){(0,$.P)(this,this.templates,this.templateName)}}])}(d.y);function K(e,t,n){return t=(0,m.A)(t),(0,v.A)(e,ee()?Reflect.construct(t,n||[],(0,m.A)(e).constructor):t.apply(e,n))}function ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ee=function(){return!!e})()}var te=function(e){function t(e,n){var i;(0,p.A)(this,t);for(var o=arguments.length,a=new Array(o>2?o-2:0),s=2;s<o;s++)a[s-2]=arguments[s];return i=K(this,t,[e].concat(a)),(0,R.A)(i,"templateName",void 0),(0,R.A)(i,"shapeType","Decoration"),(0,R.A)(i,"defaultTemplate","base"),(0,R.A)(i,"templates",{base:{}}),i.class="Decoration",i.templateName=n,i}return(0,g.A)(t,e),(0,f.A)(t,[{key:"uniqueProperties",get:function(){return{}}},{key:"loadFromTemplate",value:function(){(0,$.P)(this,this.templates,this.templateName)}}])}(d.y),ne={Car:n(48744).T,Decoration:te,Figure:J,Obstacle:j.Obstacle,Interactive:B.Interactive,Terrain:D.Terrain,Road:I.Road,TextOb
1ject:_};function ie(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return oe(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oe(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){r=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}function oe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}var ae=function(e){var t=e.s;e.movable=!0,e.onClickDown(function(){t.editMode&&(e.pinned?t.pinButton.setImg(L.gT.pinOn):t.pinButton.setImg(L.gT.pinOff))}),e.onHover(function(){t.editMode&&(t.sideMenu.hovering?t.fullscreenDiv.css("cursor","grabbing"):t.trashCan.hovering?(t.trashCan.setImg(L.gT.trashOpen),t.fullscreenDiv.css("cursor","grabbing")):e.pinned?e.pinned&&t.fullscreenDiv.css("cursor","pointer"):t.fullscreenDiv.css("cursor","move"))}),e.onClick(function(){!t.editMode||t.keyIsDown(32)||t.keyIsDown(17)||e.pinned||(0===e.children.length&&e.editShape(),(t.trashCan.hovering||t.sideMenu.hovering)&&(e.hovering=!1,t.deleteShapeWithExtraSteps(e),t.fullscreenDiv.css("cursor","default"),t.trashCan.setImg(L.gT.trash)))}),e.onHoverExit(function(){t.editMode&&t.fullscreenDiv.css("cursor","default")})},se=n(74692),re=n.n(se);function le(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return ce(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ce(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){r=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}function ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}var ue=function(){return(0,f.A)(function e(){(0,p.A)(this,e)},null,[{key:"serialize",value:function(e){var t,n=[],i=le(e);try{for(i.s();!(t=i.n()).done;){var o,a=t.value;"shapeType"in a&&n.push({id:a.id,shapeType:a.shapeType,templateName:a.templateName,shapeInfo:{position:{x:a.pos.x,y:a.pos.y},vertices:a.vertices.map(function(e){return{x:e.x,y:e.y}}),rotation:{x:a.rotation.x,y:a.rotation.y}},imageName:a.imgName,imageRes:null!==(o=a.res)&&void 0!==o?o:null,properties:a.uniqueProperties})}}catch(e){i.e(e)}finally{i.f()}return n}},{key:"vectorToCoord",value:function(e){var t=e.position,n=e.vertices,i=e.rotation;return n.map(function(e){var n=new b.M(e.x,e.y);return n.rotate(i.x*Math.PI/180,new b.M(t.x,t.y)),[n.x,n.y]})}},{key:"deserialize",value:function(e,t){var n=this;if(t){var i,a=[],s=le(t);try{var r=function(){var t=i.value,s=n.vectorToCoord(t.shapeInfo),r=(0,h.A)(ne[t.shapeType],[e,t.templateName].concat((0,q.A)(s)));if(r.loadFromTemplate(),t.properties&&Object.entries(t.properties).forEach(function(e){var t=(0,o.A)(e,2),n=t[0],i=t[1];n in r&&(r[n]=i)}),"Car"===t.shapeType)return e.car=e.spawnCar(0,0,75,110),1;t.imageName&&(0,L.z6)(e,function(){null!==t.imageRes?r.setTexture(L.gT[t.imageName],t.imageRes):r.setImg(L.gT[t.imageName])},t.imageName),r.rotate(t.shapeInfo.rotation.x,r.pos),a.push(r)};for(s.s();!(i=s.n()).done;)r()}catch(e){s.e(e)}finally{s.f()}return a}return[]}}])}();function he(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];
1if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return de(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?de(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){r=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}function de(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}(0,R.A)(ue,"version","1.0");var pe,fe,ve,me,ge,be=function(e){var t,n,i,a,s;e.updateWithProps=function(t){t.init&&(e.init=t.init),t.fullscreenDiv&&(e.fullscreenDiv=re()(".".concat(t.fullscreenDiv)).first()),t.canvasDiv&&(a=t.canvasDiv,e.canvasLoaded||e.setup(),e.canvasLoaded=!0),t.onChange&&(e.onChange=t.onChange),t.onWin&&(e.onWin=t.onWin),t.onLose&&(e.onLose=t.onLose),t.onConnectCar&&(e.onConnectCar=t.onConnectCar)},e.cleanup=function(){e.noLoop(),e.canvasLoaded=!1,e.remove()},e.preload=function(){(0,L.z6)(e,function(){},"animatedCar","tools","carTop","carTopD","carTopG"),(0,L.dm)(e)},e.setup=function(){null!=a&&(e.canvasLoaded=!0,e.loading=!0,function(e){function t(t,n){var i=e.sideMenu.getWidth()/4,o=e.spawnFixedTextObject(t,i/2,0,0,500);e.sideMenu.addChild(o,!0),n(),e.sideMenu.children[e.sideMenu.children.length-1].lastInSection=!0}function n(e,t){return[[-e/2,t/2],[e/2,t/2],[e/2,-t/2],[-e/2,-t/2]]}function i(t,i,o,a,s){var r,l,c,u=e.spawnFixedRect.apply(e,[0,0].concat((0,q.A)(null!==(r=null==s?void 0:s.boxDimensions)&&void 0!==r?r:[150,150])));u.color=e.color.apply(e,(0,q.A)(null!==(l=null==s?void 0:s.color)&&void 0!==l?l:[0,0])),u.setTexture(L.gT[o],null!==(c=null==s?void 0:s.imageSize)&&void 0!==c?c:1),u.onClickDown(function(){if(!e.topMenu.hovering){var o,r=(0,h.A)(t,[e,i].concat((0,q.A)(n.apply(void 0,(0,q.A)(a)))));e.spawnShapeFromMenu(u,r),e.addObjectToScene(r,null!==(o=null==s?void 0:s.z_index)&&void 0!==o?o:0)}}),e.sideMenu.addChild(u,!0)}e.enterEditMode=function(){e.editMode=!0,(0,L.Ui)(e),e.topMenu=e.spawnFixedRect(0,e.height/2-(e.isMobile?18.75:25),e.width,e.isMobile?37.5:50,600),e.topMenu.color="#70caff",e.topMenu.strokeColor=e.color(0,0),e.topMenu.onHover(function(){e.fullscreenDiv.css("cursor","default")}),e.sideMenu=e.spawnFixedRect(-e.width/2+(e.isMobile?75:100),-e.topMenu.getHeight()/2,e.isMobile?150:200,e.height-e.topMenu.getHeight()),e.sideMenu.color="#03a2ff",e.sideMenu.strokeColor=e.color(0,0),e.sideMenu.onClickDown(function(){e.startingPointScroll=e.mouse.roundVector(1).clone()}),e.sideMenu.onScroll(function(t){if(e.sideMenu.children[0].top.y+25>e.sideMenu.top.y&&t.delta<0||e.sideMenu.children[e.sideMenu.children.length-1].bottom.y-25<-e.height/2&&t.delta>0)for(var n=0;n<e.sideMenu.children.length;n++){var i=new b.M(e.sideMenu.children[n].pos.x,e.sideMenu.children[n].pos.y+t.delta/2);e.sideMenu.children[n].setPos(i,!1)}}),e.spawnSideMenuItems(),e.spawnTopMenuItems(),e.spawnInteractiveButtons(),e.changeCursorOnMovement(),e.showDebug()},e.exitEditMode=function(){e.editMode=!1,e.deleteShape(e.sideMenu,!0),e.deleteShape(e.topMenu,!0),e.deleteShape(e.trashCan,!0),e.deleteShape(e.zoom_In_Button),e.deleteShape(e.zoom_Out_Button),(0,L.Qm)(e,Object.values(e.shapes).map(function(e){return e.img}))},e.toggleEditMode=function(){e.editMode?e.exitEditMode():e.enterEditMode(),e.zoomButton.click()},e.spawnSideMenuItems=function(){var n=e.sideMenu.getWidth()/4,i=e.sideMenu.getWidth()/20;t("Roads",e.menuRoadItems),t("Terrains",e.menuTerrainItems),t("Obstacles",e.menuObstacleItems),t("Interactives",e.menuInteractiveObjectItems),t("Decorations",e.menuDecorationItems),t("Other",e.menuOtherShapeItems);var o=e.sideMenu.top.y-1.5*n,a=0,s=150/n;
1e.sideMenu.children.forEach(function(t){if(t instanceof T)t.setPos(new b.M(e.sideMenu.pos.x-e.sideMenu.getWidth()/2+1.5*i+t.getWidth()/2,o+n/2-i),!1);else{var r=e.spawnFixedRect(t.left.x+t.getWidth()/s/2,t.top.y-t.getHeight()/s/2,t.getWidth()/s,t.getHeight()/s);t.resizeShape(r),e.deleteShape(r),t.setPos(new b.M(e.sideMenu.pos.x+a%3*(n+i)-(n+i),o-n/2),!1),(a+=1)%3!=0||t.lastInSection||(o-=n+i,a=0),t.lastInSection&&(o-=2*n+i,a=0),t.onHover(function(){null!=e.pressedObject||e.topMenu.hovering||e.fullscreenDiv.css("cursor","grab")}),t.onHoverExit(function(){e.fullscreenDiv.css("cursor","default")})}})},e.menuRoadItems=function(){i(ne.Road,"base","road1",[150,150],{imageSize:.5}),i(ne.Terrain,"base","bridge",[375,150]),e.menuTerrainItems=function(){var t=e.spawnFixedRect(0,0,150,150);t.color=e.color(0,0),t.setTexture(L.gT.grass,2/3*.5),t.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(t,e.spawnTerrain(150,150,"base"))}),e.sideMenu.addChild(t,!0);var n=e.spawnFixedRect(0,0,150,150);n.color=e.color(0,0),n.setTexture(L.gT.mud,2/3*.5),n.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(n,e.spawnTerrain(150,150,"slower"))}),e.sideMenu.addChild(n,!0);var i=e.spawnFixedRect(0,0,150,150);i.color=e.color(0,0),i.setTexture(L.gT.sand,.5),i.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(i,e.spawnTerrain(150,150,"slow"))}),e.sideMenu.addChild(i,!0);var o=e.spawnFixedRect(0,0,150,150);o.color=e.color(0,0),o.setTexture(L.gT.mars_surface,.3),o.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(o,e.spawnTerrain(150,150,"base"))}),e.sideMenu.addChild(o,!0);var a=e.spawnFixedRect(0,0,150,150);a.color=e.color(0,0),a.setTexture(L.gT.darkLava,.3),a.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(a,e.spawnTerrain(150,150,"slow"))}),e.sideMenu.addChild(a,!0);var s=e.spawnFixedRect(0,0,150,150);s.color=e.color(0,0),s.setTexture(L.gT.rock,.3),s.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(s,e.spawnTerrain(150,150,"base"))}),e.sideMenu.addChild(s,!0)},e.menuObstacleItems=function(){var t=e.spawnFixedRect(0,0,150,150);t.color=e.color(0,0),t.setImg(L.gT.house),t.setSoundOnCollision(L.R2.house_impact_audio),t.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(t,e.spawnObstacle(300,300,"stop"))}),e.sideMenu.addChild(t,!0);for(var n=function(){var t=(0,o.A)(a[i],2),n=t[0],s=t[1],r=e.spawnFixedRect(0,0,150,150);r.color=e.color(0,0),r.setImg(L.gT[n]),r.setSoundOnCollision(L.R2.house_impact_audio),r.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(r,e.spawnObstacle(s[0],s[1],"stop"))}),e.sideMenu.addChild(r,!0)},i=0,a=Object.entries({greenhouse1:[500,400],greenhouse2:[300,300],greenhouse3:[400,400]});i<a.length;i++)n();var s=e.spawnFixedRect(0,0,150,100);s.color=e.color(0,0),s.setImg(L.gT.stone),s.setSoundOnCollision(L.R2.stone_impact_audio),s.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(s,e.spawnObstacle(150,100,"stop"))}),e.sideMenu.addChild(s,!0);var r=e.spawnFixedRect(0,0,150,100);r.color=e.color(0,0),r.setImg(L.gT.rocheMars1),r.setSoundOnCollision(L.R2.stone_impact_audio),r.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(r,e.spawnObstacle(150,100,"stop"))}),e.sideMenu.addChild(r,!0);var l=e.spawnFixedRect(0,0,150,150);l.color=e.color(0,0),l.setImg(L.gT.rocheMars2),l.setSoundOnCollision(L.R2.stone_impact_audio),l.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(l,e.spawnObstacle(150,150,"stop"))}),e.sideMenu.addChild(l,!0);var c=e.spawnFixedRect(0,0,150,100);c.color=e.color(0,0),c.setImg(L.gT.mountains),c.setSoundOnCollision(L.R2.stone_impact_audio),c.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(c,e.spawnObstacle(150,100,"stop"))}),e.sideMenu.addChild(c,!0);var u=e.spawnFixedRect(0,0,150,150);u.color=e.color(0,0),u.setImg(L.gT.tree),u.setSoundOnCollision(L.R2.tree_impact_audio),u.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(u,e.spawnObstacle(150,150,"stop"))}),e.sideMenu.addChild(u,!0);var h=e.spawnFixedRect(0,0,150,150);h.color=e.color(0,0),h.setTexture(L.gT.water,.3),h.setSoundOnCollision(L.R2.water_impact_audio),h.gameOverEvent={gameOverImg:"/static/images/gifs/water_splash.gif",message:"La voiture est tombé dans l'eau!"},h.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(h,e.spawnObstacle(150,150,"water"))}),e.sideMenu.addChild(h,!0);var d=e.spawnFixedRect(0,0,150,150);d.color=e.color(0,0),d.setTexture(L.gT.lava,.3),d.setSoundOnCollision(L.R2.lava_bubbles_audio),d.gameOverEvent={gameOverImg:"/static/images/gifs/lava.gif",message:"La voiture est tombée dans la lave!"},d.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(d,e.spawnObstacle(150,150,"lava"))}),e.sideMenu.addChild(d,!0);var p=e.spawnFixedRect(0,0,125,75);p.color=e.color(0,0),p.setImg(L.gT.hole),p.setSoundOnCollision(L.R2.falling_down_audio),p.gameOverEvent={gameOverImg:"/static/images/gifs/hole.gif",message:"La voiture est tombée dans un trou!"},p.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(p,e.spawnObstacle(125,75,"fall"))}),e.sideMenu.addChild(p,!0);var f=e.spawnFixedRect(0,0,150,150);f.color=e.color(0,0),f.setImg(L.gT.mars_dome),f.setSoundOnCollision(L.R2.metal_impact_audio),f.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(f,e.spawnObstacle(400,300,"stop",4))}),e.sideMenu.addChild(f,!0);var v=e.spawnFixedRect(0,0,150,150);v.color=e.color(0,0),v.setImg(L.gT.brokenRocket),v.setSoundOnCollision(L.R2.metal_impact_audio),v.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(v,e.spawnObstacle(150,150,"stop"))}),e.sideMenu.addChild(v,!0);var m=e.spawnFixedRect(0,0,150,150);m.color=e.color(0,0),m.setImg(L.gT.black_hole),m.setSoundOnCollision(L.R2.falling_down_audio),m.gameOverEvent={gameOverImg:"/static/images/gifs/hole.gif",message:"La voiture est tombée dans un trou!"},m.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(m,e.spawnObstacle(150,150,"fall"))}),e.sideMenu.addChild(m,!0)},e.menuInteractiveObjectItems=function(){var t=e.spawnFixedRect(0,0,75,100);t.color=e.color(0,0),t.setImg(L.gT.coin),t.setSoundOnCollision(L.R2.coin_collect_audio),t.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(t,e.
1spawnInteractiveObject(75,100,!0,!1,!1,5))}),e.sideMenu.addChild(t,!0);var n=e.spawnFixedRect(0,0,100,100);n.color=e.color(0,0),n.setImg(L.gT.repair_tools),n.setSoundOnCollision(L.R2.coin_collect_audio),n.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(n,e.spawnInteractiveObject(100,100,!0,!1,!1,5))}),e.sideMenu.addChild(n,!0);var i=e.spawnFixedRect(0,0,150,150);i.color=e.color(0,0),i.setTexture(L.gT.finishLine,2/3*.5),i.setSoundOnCollision(L.R2.level_complete_audio),i.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(i,e.spawnInteractiveObject(195,75,!1,!0,!1,5))}),e.sideMenu.addChild(i,!0);var o=e.spawnFixedRect(0,0,150,150);o.color=e.color(0,0),o.setImg(L.gT.flag),o.setSoundOnCollision(L.R2.level_complete_audio),o.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(o,e.spawnInteractiveObject(150,150,!1,!0,!1,5))}),e.sideMenu.addChild(o,!0);var a=e.spawnFixedRect(0,0,150,150);a.color=e.color(0,0),a.setImg(L.gT.red_button_unpressed),a.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(a,e.spawnInteractiveObject(100,100,!1,!1,!0,5))}),e.sideMenu.addChild(a,!0);var s=e.spawnFixedRect(0,0,150,150);s.color=e.color(0,0),s.setTexture(L.gT.treadmill,.2),s.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(s,e.spawnTerrain(150,150,"faster",3))}),e.sideMenu.addChild(s,!0);var r=e.spawnFixedRect(0,0,75,100);r.color=e.color(0,0),r.setImg(L.gT.spring),r.setSoundOnCollision(L.R2.coin_collect_audio),r.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(r,e.spawnInteractiveObject(75,100,!1,!1,!1,5))}),e.sideMenu.addChild(r,!0)},e.menuDecorationItems=function(){for(var t=function(){var t=(0,o.A)(i[n],2),a=t[0],s=t[1],r=e.spawnFixedRect(0,0,150,150);r.color=e.color(0,0),r.setImg(L.gT[a]),r.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(r,e.spawnDecoration(0,0,s[0],s[1]))}),e.sideMenu.addChild(r,!0)},n=0,i=Object.entries({satelitte:[150,150],alien:[150,150],holeCrack:[150,150],crack:[150,150],worker1:[220,220],worker2:[100,190],worker3:[100,200],worker4:[125,150],worker5:[100,190],worker6:[250,290],worker7:[125,175],worker8:[100,200],plant1:[150,350],plant2:[150,120],plant3:[75,125],plant4:[120,150]});n<i.length;n++)t()},e.menuOtherShapeItems=function(){var t=e.spawnFixedObject(500,[-75,25],[30,25],[30,50],[75,0],[30,-50],[30,-25],[-75,-25]);t.color="blue",t.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(t,e.spawnFigure(void 0,"base",[-75,25],[30,25],[30,50],[75,0],[30,-50],[30,-25],[-75,-25]))}),e.sideMenu.addChild(t,!0);var n=e.spawnFixedObject(500,[-75,-50],[0,50],[75,-50]);n.color="purple",n.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(n,e.spawnFigure(void 0,"base",[-75,-150],[0,-50],[75,-150]))}),e.sideMenu.addChild(n,!0);var i=e.spawnFixedRect(0,0,150,150);i.color="cyan",i.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(i,e.spawnFigure(void 0,"base",[0,0],[0,150],[150,150],[150,0]))}),e.sideMenu.addChild(i,!0);var o=e.spawnFixedRect(0,0,100,150);o.color="red",o.onClickDown(function(){e.topMenu.hovering||e.spawnShapeFromMenu(o,e.spawnFigure(void 0,"base",[0,0],[0,100],[150,100],[150,0]))}),e.sideMenu.addChild(o,!0)},e.spawnShapeFromMenu=function(t,n){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n.setPos(new b.M(e.mouse.x,e.mouse.y),!1),n.color=t.color,t.hasTexture?n.setTexture([t.imgName,t.img],t.res):n.setImg([t.imgName,t.img]),null!=t.soundOnCollision&&n.setSoundOnCollision(t.soundOnCollision),ae(n),i||(e.pressedObject=n,e.pressedObject.mouseOffset=e.mouse.clone().substract(e.pressedObject.pos))},e.spawnTopMenuItems=function(){e.topMenuItemSize=.7*e.topMenu.getHeight(),e.spawnEditorTitle(),e.spawnUndoButton(),e.spawnRedoButton(),e.spawnCopyButton(),e.spawnPasteButton(),e.spawnRotateLeftButton(),e.spawnRotateRightButton(),e.spawnLinkButton(),e.spawnPinButton(),e.spawnInformationButton(),e.isMobile&&e.spawnSelectionButton(),e.topMenu.addChild(e.undoButton,!0),e.topMenu.addChild(e.redoButton,!0),e.topMenu.addChild(e.copyButton,!0),e.topMenu.addChild(e.pasteButton,!0),e.topMenu.addChild(e.rotate_Counter_Clockwise,!0),e.topMenu.addChild(e.rotate_Clockwise,!0),e.topMenu.addChild(e.linkButton,!0),e.topMenu.addChild(e.pinButton,!0),e.isMobile&&e.topMenu.addChild(e.selectionButton,!0),e.topMenu.addChild(e.informationButton,!0);var t=-e.width/2+e.sideMenu.getWidth()+e.topMenuItemSize/2;
1e.topMenu.children.forEach(function(n){n.setPos(new b.M(t,e.topMenu.pos.y),!1),t+=e.topMenu.getHeight(),n.color=e.color(0,0),n.strokeColor=e.color(0,0),n.onHoverExit(function(){e.fullscreenDiv.css("cursor","default")})})},e.spawnEditorTitle=function(){},e.spawnUndoButton=function(){e.undoButton=e.spawnFixedRect(0,0,e.topMenuItemSize,e.topMenuItemSize,650),e.undoButton.setImg(L.gT.undo),e.undoButton.isUndo=!0,e.undoButton.onClick(function(){if(e.undoShapes.length>0){var t=!1,n=e.undoShapes[e.undoShapes.length-1];if(n.isMultipleObjects)if(n.wereDeletedViaTrash){n=e.undoShapes[e.undoShapes.length-1];for(var i=[],o=0;o<n.shapeData.length;o++)i.push(e.storeShapeData(n.shapeData[o].originalShape,!1,!1,!0)),e.revertToLastShape(n.shapeData[o]),e.addShapeWithExtraSteps(n.shapeData[o].originalShape);e.redoShapes.push({shapeData:i,isMultipleObjects:!0,wereDeletedViaTrash:!0,wasDeletedViaRedo:!1}),e.undoShapes.pop()}else{for(var a=[],s=0;s<n.shapeData.length;s++)a.push(e.storeShapeData(n.shapeData[s].originalShape)),e.revertToLastShape(n.shapeData[s]);for(var r=e.undoShapes.length-2;r>=0;r--)if(e.undoShapes[r].isMultipleObjects)for(var l=0;l<e.undoShapes[r].shapeData.length;l++)for(var c=0;c<n.shapeData.length;c++)e.undoShapes[r].shapeData[l].originalShape.id===n.shapeData[c].originalShape.id&&(t=!0);else if(!e.undoShapes[r].isMultipleObjects)for(var u=0;u<n.shapeData.length;u++)e.undoShapes[r].originalShape.id===n.shapeData[u].originalShape.id&&(t=!0);if(!1===t){for(var h=0;h<n.shapeData.length;h++)e.deleteShapeWithExtraSteps(n.shapeData[h].originalShape);e.redoShapes.push({shapeData:a,isMultipleObjects:!0,wereDeletedViaTrash:!1,wereDeletedViaUndo:!0,wasDeletedViaRedo:!1})}else e.redoShapes.push({shapeData:a,isMultipleObjects:!0,wereDeletedViaTrash:!1,wereDeletedViaUndo:!1,wasDeletedViaRedo:!1});e.undoShapes.pop()}else{n.originalShape.removeAllChildren(),n.wasRedo||e.undoShapes.pop(),e.changeCursorOnUndo();for(var d=e.undoShapes.length-1;d>=0;d--)if(!0!==e.undoShapes[d].isMultipleObjects&&e.undoShapes[d].originalShape.id===n.originalShape.id){t=!0,!1===n.wasDeletedViaUndo&&!1===n.wasDeletedViaTrash?e.redoShapes.push(e.storeShapeData(n.originalShape)):(n.wasDeletedViaUndo?e.redoShapes.push(e.storeShapeData(n.originalShape,!0)):n.wasDeletedViaTrash&&e.redoShapes.push(e.storeShapeData(n.originalShape,!1,!1,!0)),e.addShapeWithExtraSteps(n.originalShape)),e.revertToLastShape(e.undoShapes[d]),n.wasRedo&&e.undoShapes.pop();break}if(!1===t){var p,f=!1,v=ie(e.cars);try{for(v.s();!(p=v.n()).done;)p.value.shape===n.originalShape&&(f=!0)}catch(e){v.e(e)}finally{v.f()}f||(e.redoShapes.push(e.storeShapeData(n.originalShape,!0)),e.deleteShapeWithExtraSteps(n.originalShape))}}}e.changeCursorOnUndo()})},e.spawnRedoButton=function(){e.redoButton=e.spawnFixedRect(0,0,e.topMenuItemSize,e.topMenuItemSize,650),e.redoButton.setImg(L.gT.redo),e.redoButton.isRedo=!0,e.redoButton.onClick(function(){if(e.redoShapes.length>0){var t=e.redoShapes[e.redoShapes.length-1];if(t.isMultipleObjects)if(t.wereDeletedViaTrash){for(var n=[],i=0;i<t.shapeData.length;i++)n.push(e.storeShapeData(t.shapeData[i].originalShape,!1,!1,!0)),e.revertToLastShape(t.shapeData[i]),t.shapeData[i].wasDeletedViaTrash&&e.deleteShapeWithExtraSteps(t.shapeData[i].originalShape);e.undoShapes.push({shapeData:n,isMultipleObjects:!0,wereDeletedViaTrash:!0,wasDeletedViaRedo:!0}),e.redoShapes.pop()}else if(t.wereDeletedViaUndo){for(var o=[],a=0;a<t.shapeData.length;a++)o.push(e.storeShapeData(t.shapeData[a].originalShape,!1,!1,!0)),e.revertToLastShape(t.shapeData[a]),e.addShapeWithExtraSteps(t.shapeData[a].originalShape);e.undoShapes.push({shapeData:o,isMultipleObjects:!0,wereDeletedViaTrash:!1,wereDeletedViaUndo:!1,wasDeletedViaRedo:!1}),e.redoShapes.pop()}else{for(var s=[],r=0;r<t.shapeData.length;r++)s.push(e.storeShapeData(t.shapeData[r].originalShape)),e.revertToLastShape(t.shapeData[r]);e.undoShapes.push({shapeData:s,isMultipleObjects:!0,wereDeletedViaTrash:!1,wasDeletedViaRedo:!1}),e.redoShapes.pop()}else{if(t.originalShape.removeAllChildren(),t.wasDeletedViaTrash)return e.addSingleUndoWithData(t.originalShape,!1,!1,!0),e.deleteShapeWithExtraSteps(t.originalShape),void e.redoShapes.pop();for(var l=e.redoShapes.length-1;l>=0;l--)if(e.redoShapes[l].originalShape.id===t.originalShape.id){!1===t.wasDeletedViaUndo&&!1===t.wasDeletedViaTrash?e.addSingleUndo(t):t.wasDeletedViaUndo&&(e.addSingleUndoWithData(t.originalShape,!0),e.addShapeW
1ithExtraSteps(t.originalShape)),e.revertToLastShape(e.redoShapes[l]),e.redoShapes.pop(),e.changeCursorOnRedo();break}}}})},e.spawnCopyButton=function(){e.copyButton=e.spawnFixedRect(0,0,e.topMenuItemSize,e.topMenuItemSize,650),e.copyButton.setImg(L.gT.copy),e.copyButton.onClick(function(){if(null!=e.lastMovableObject){e.lastMovableObject.removeAllChildren();var t=e.copyShape(e.lastMovableObject);e.lastCopiedObjects=[],e.lastCopiedObjects.push(t),e.listPreviousSelect=[],e.deleteSelection(),e.showPopUpMessage("Copied!")}else if(e.listPreviousSelect.length>1)e.lastCopiedObjects=[],e.listPreviousSelect.forEach(function(t){e.lastCopiedObjects.push(e.copyShape(t)),t.removeAllChildren()}),e.listPreviousSelect=[],e.deleteSelection(),e.showPopUpMessage("Copied!");else if(1===e.listPreviousSelect.length){e.listPreviousSelect[0].removeAllChildren();var n=e.copyShape(e.listPreviousSelect[0]);e.lastCopiedObjects=[],e.lastCopiedObjects.push(n),e.listPreviousSelect=[],e.deleteSelection(),e.showPopUpMessage("Copied!")}})},e.spawnPasteButton=function(){e.pasteButton=e.spawnFixedRect(0,0,e.topMenuItemSize,e.topMenuItemSize,650),e.pasteButton.setImg(L.gT.pasteOff),e.pasteButton.onClick(function(){e.togglePasteButton()})},e.spawnRotateLeftButton=function(){e.rotate_Counter_Clockwise=e.spawnFixedRect(0,0,e.topMenuItemSize,e.topMenuItemSize,650),e.rotate_Counter_Clockwise.setImg(L.gT.rotate_counterclockwise),e.rotate_Counter_Clockwise.onClick(function(){e.rotateShapeFromMenu(-45)})},e.spawnRotateRightButton=function(){e.rotate_Clockwise=e.spawnFixedRect(0,0,e.topMenuItemSize,e.topMenuItemSize,650),e.rotate_Clockwise.setImg(L.gT.rotate_clockwise),e.rotate_Clockwise.onClick(function(){e.rotateShapeFromMenu(45)})},e.spawnLinkButton=function(){e.linkButton=e.spawnFixedRect(0,0,e.topMenuItemSize,e.topMenuItemSize,650),e.linkButton.setImg(L.gT.linkOff),e.linkButton.onClick(function(){e.lastMovableObject instanceof B.Interactive&&e.lastMovableObject.isButton&&(e.lastSelectedButton=e.lastMovableObject,e.toggleLinkButton(),e.showPopUpMessage("Select an object!"))})},e.spawnPinButton=function(){e.pinButton=e.spawnFixedRect(0,0,e.topMenuItemSize,e.topMenuItemSize,650),e.pinButton.setImg(L.gT.pinOff),e.pinButton.onClick(function(){e.togglePinButton()})},e.spawnSelectionButton=function(){e.selectionButton=e.spawnFixedRect(0,0,e.topMenuItemSize,e.topMenuItemSize,650),e.selectionButton.setImg(L.gT.selectionOff),e.selectionButton.onClick(function(){e.toggleSelectionButton()})},e.spawnInformationButton=function(){e.informationButton=e.spawnFixedRect(0,0,e.topMenuItemSize,e.topMenuItemSize,650),e.informationButton.setImg(L.gT.information),e.informationButton.onClick(function(){})},e.spawnInteractiveButtons=function(){e.spawnTrashCanButton(),e.spawnZoomInButton(),e.spawnZoomOutButton()},e.spawnTrashCanButton=function(){e.trashCan=e.spawnFixedRect(e.width/2-35,e.height/2-e.topMenu.getHeight()-50,50,50),e.trashCan.setImg(L.gT.trash),e.trashCan.color=e.color(0,0),e.trashCan.strokeColor=e.color(0,0),e.trashCan.onHoverExit(function(){e.trashCan.setImg(L.gT.trash)})},e.spawnZoomInButton=function(){e.zoom_In_Button=e.spawnFixedRect(-e.width/2+e.sideMenu.getWidth()+e.topMenuItemSize,-e.height/2+e.topMenuItemSize,e.topMenuItemSize,e.topMenuItemSize,650),e.zoom_In_Button.color=e.color(0,0),e.zoom_In_Button.setImg(L.gT.zoom_in),e.zoom_In_Button.onClick(function(){e.canvasCamera.addScale(e.canvasCamera.scale/1e3*-500)})},e.spawnZoomOutButton=function(){e.zoom_Out_Button=e.spawnFixedRect(-e.width/2+e.sideMenu.getWidth()+2*e.topMenuItemSize+10,-e.height/2+e.topMenuItemSize,e.topMenuItemSize,e.topMenuItemSize,650),e.zoom_Out_Button.color=e.color(0,0),e.zoom_Out_Button.setImg(L.gT.zoom_out),e.zoom_Out_Button.onClick(function(){e.canvasCamera.addScale(e.canvasCamera.scale/1e3*500)})},e.playSound=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;null!=e&&(e.volume=t,e.play())},e.confetti=function(){},e.newCoinCollectedAudio=function(){return L.R2.coin_collected_audio()},e.addInteractiveObject=function(t){t instanceof B.Interactive&&(e.interactiveObjects.push(t),t.isCollectable&&(e.coinsTotal+=1))},e.removeInteractiveObject=function(t){t instanceof B.Interactive&&(e.interactiveObjects.forEac
1h(function(n,i){e.interactiveObjects[i].id===t.id&&e.interactiveObjects.splice(i,1)}),t.isCollectable&&(e.coinsTotal-=1))},e.addSingleUndo=function(t){e.undoShapes.push(t)},e.addSingleUndoWithData=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];e.undoShapes.push(e.storeShapeData(t,n,i,o))},e.revertToLastShape=function(t){t.originalShape.setPos(new b.M(t.clonedShape.pos.x,t.clonedShape.pos.y),!1);for(var n=0;n<t.originalShape.vertices.length;n++){var i=t.clonedShape.vertices[n].clone(),o=t.clonedShape.rotation.x*e.PI/180;i.rotate(o,t.clonedShape.pos),t.originalShape.vertices[n]=i}t.originalShape.setBounds(),t.originalShape.rotation.x=0,t.originalShape.rotate(t.clonedShape.rotation.x)},e.storeShapeData=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return{originalShape:e,clonedShape:e.cloneShape(),wasDeletedViaUndo:t,wasRedo:n,wasDeletedViaTrash:i}},e.changeCursorOnMovement=function(){e.topMenu.children.forEach(function(t){t.isRedo&&0===e.redoShapes.length?t.onHover(function(){null!=e.pressedObject||e.sideMenu.hovering||e.fullscreenDiv.css("cursor","not-allowed")}):t.onHover(function(){null!=e.pressedObject||e.sideMenu.hovering||e.fullscreenDiv.css("cursor","pointer")})})},e.changeCursorOnUndo=function(){0===e.undoShapes.length?e.topMenu.children.forEach(function(t){t.isUndo?t.onHover(function(){null!=e.pressedObject||e.sideMenu.hovering||e.fullscreenDiv.css("cursor","not-allowed")}):t.isRedo&&t.onHover(function(){null!=e.pressedObject||e.sideMenu.hovering||e.fullscreenDiv.css("cursor","pointer")})}):e.topMenu.children.forEach(function(t){(t.isUndo||t.isRedo)&&t.onHover(function(){null!=e.pressedObject||e.sideMenu.hovering||e.fullscreenDiv.css("cursor","pointer")})})},e.changeCursorOnRedo=function(){0===e.redoShapes.length&&e.topMenu.children.forEach(function(t){t.isRedo&&t.onHover(function(){null!=e.pressedObject||e.sideMenu.hovering||e.fullscreenDiv.css("cursor","not-allowed")})})},e.copyShape=function(t){var n=t.cloneShape();return null!=t.shapeOffset&&(n.shapeOffset=t.shapeOffset),e.spawnShapeFromMenu(t,n,!0),n},e.togglePasteButton=function(){e.pasteButtonState?(e.pasteButtonState=!1,e.pasteButton.setImg(L.gT.pasteOff)):0===e.lastCopiedObjects.length?e.showPopUpMessage("Copy an object first!"):(e.pasteButtonState=!0,e.pasteButton.setImg(L.gT.pasteOn),e.showPopUpMessage("Tap to paste!"))},e.pasteShape=function(){if(0!==e.lastCopiedObjects.length)if(e.deleteSelection(),e.initSelection(),null!=e.lastMovableObject&&e.lastMovableObject.removeAllChildren(),e.lastCopiedObjects.length>1){var t=[];e.lastCopiedObjects.forEach(function(n){var i=e.pasteSingleShape(n);i.setPos(e.mouse.clone().substract(n.shapeOffset).roundVector(1),!1),t.push(e.storeShapeData(i)),e.selectionShape.colliding.push(i)}),e.undoShapes.push({shapeData:t,isMultipleObjects:!0,wereDeletedViaTrash:!1,wereDeletedViaUndo:!1,wasDeletedViaRedo:!1}),e.adjustSelection()}else{var n=e.pasteSingleShape(e.lastCopiedObjects[0]);e.addSingleUndoWithData(n),e.selectionShape.colliding.push(n),e.adjustSelection()}},e.pasteSingleShape=function(t){var n=e.copyShape(t);return n.setPos(new b.M(e.mouse.x,e.mouse.y),!1),e.addShapeWithExtraSteps(n),n},e.rotateShapeFromMenu=function(t){var n=!1;if(e.listPreviousSelect.length>0){if(e.movableShapes.forEach(function(t){e.listPreviousSelect.forEach(function(e){t.originalShape.id===e.id&&(n=!0)})}),n){e.redoShapes.splice(0,e.redoShapes.length);var i=[];e.firstTimeRotation?(e.listPreviousSelect.forEach(function(t){for(var n=e.undoShapes.length-1;n>=0;n--)if(e.undoShapes[n].isMultipleObjects){if(e.undoShapes[n].isMultipleObjects)for(var o=0;o<e.undoShapes[n].shapeData.length;o++)if(e.undoShapes[n].shapeData[o].originalShape.id===t.id){var a=e.storeShapeData(e.undoShapes[n].shapeData[o].originalShape);i.push(a)}}else if(e.undoShapes[n].originalShape.id===t.id){var s=e.storeShapeData(e.undoShapes[n].originalShape);i.push(s);break}}),e.undoShapes.push({shapeData:i,isMultipleObjects:!0,wereDeletedViaTrash:!1,wasDeletedViaRedo:!1}),i=[],e.listPreviousSelect.forEach(function(n){n.rotate(t,e.previousSelectionShape.pos),i.push(e.storeShapeData(n))}),e.undoShapes.push({shapeData:i,isMultipleObjects:!0,wereDeletedViaTrash:!1,wasDeletedViaRedo:!1}),e.firstTimeRotation=!1):e.firstTimeRotation||(e.listPreviousSelect.forEach(function(n){n.rotate(t,e.previousSelectionShape.pos),i.push(e.storeShapeData(n))}),e.undoShapes.push({shapeData:i,isMultipleObjects:!0,wereDeletedViaTrash:!1,wasDeletedViaRedo:!1}))}}
1else null!=e.lastMovableObject&&(e.movableShapes.forEach(function(t){t.originalShape.id===e.lastMovableObject.id&&(n=!0)}),n&&(e.redoShapes.splice(0,e.redoShapes.length),e.lastMovableObject.rotate(t),e.addSingleUndoWithData(e.lastMovableObject)))},e.contextMenuClick=function(){var t=!1,n=null;if(e.movableShapes.forEach(function(e){e.originalShape.hovering&&(t=!0,n=e.originalShape)}),t&&!e.contextMenuState){var i,o=!1,a=ie(e.cars);try{for(a.s();!(i=a.n()).done;)i.value.shape===n&&(o=!0)}catch(e){a.e(e)}finally{a.f()}o||e.toggleContextMenuShapeOn(n),e.undoShapes.pop()}else t||e.contextMenuState||0===e.lastCopiedObjects.length?e.contextMenuState&&e.toggleContextMenuOff():e.toggleContextMenuCanvasOn()},e.toggleContextMenuShapeOn=function(t){e.contextMenuState=!0;var n,i,o,a,s=e.listPreviousSelect.length;e.linkButtonState&&(e.toggleLinkButton(),e.showPopUpMessage("Linking cancelled")),e.contextMenu=e.spawnRect(t.calcRightX()+100,t.calcTopY()-50,200,t.isButton?190:140,400),e.contextMenu.color="#303030",e.contextMenu.isHelp=!0,e.contextMenu.scaleWithCamera=!0,n=e.spawnTextObject(t.pinned?"Unpin":"Pin",26,0,50,400),i=e.spawnTextObject("Copy",26,0,0,400),o=e.spawnTextObject("Delete",26,0,-50,400),e.contextMenu.addChild(n,!0),e.contextMenu.addChild(i,!0),e.contextMenu.addChild(o,!0),t.isButton&&(a=e.spawnTextObject(e.linkButtonState?"Cancel Linking":"Add/Remove link",26,0,-100,400),e.contextMenu.addChild(a,!0),a.onClick(function(){e.lastSelectedButton=t,e.toggleLinkButton(),e.showPopUpMessage("Select an object!"),e.toggleContextMenuOff()})),e.contextMenu.children.forEach(function(e){e.color="white",e.setBackgroundColor&&e.setBackgroundColor("#303030"),e.isHelp=!0}),n.onClick(function(){t.pinned=!t.pinned,t.pinned&&t.removeAllChildren(),e.showPopUpMessage(t.pinned?"Pinned!":"Unpinned!"),e.toggleContextMenuOff()}),i.onClick(function(){e.listPreviousSelect.length!==s&&e.listPreviousSelect.splice(e.listPreviousSelect.length-s,s),e.copyButton.click(),e.toggleContextMenuOff()}),o.onClick(function(){if(e.listPreviousSelect.length!==s&&e.listPreviousSelect.splice(e.listPreviousSelect.length-s,s),null!=e.lastMovableObject)e.addSingleUndoWithData(e.lastMovableObject,!1,!1,!0),e.deleteShapeWithExtraSteps(e.lastMovableObject),e.toggleContextMenuOff(),e.lastMovableObject=null;else if(1===e.listPreviousSelect.length)e.addSingleUndoWithData(e.listPreviousSelect[0],!1,!1,!0),e.deleteShapeWithExtraSteps(e.listPreviousSelect[0]),e.listPreviousSelect=[],e.deleteSelection(),e.toggleContextMenuOff(),e.lastMovableObject=null;else if(e.listPreviousSelect.length>1){e.contextMenuState=!1;var t,n=[],i=ie(e.listPreviousSelect);try{for(i.s();!(t=i.n()).done;){var o=t.value;
1o.hovering=!1,n.push(e.storeShapeData(o,!1,!1,!0)),e.deleteShapeWithExtraSteps(o)}}catch(e){i.e(e)}finally{i.f()}e.listPreviousSelect=[],e.deleteSelection(),e.undoShapes.push({shapeData:n,isMultipleObjects:!0,wereDeletedViaTrash:!0,wasDeletedViaRedo:!1}),e.undoShapes.push({shapeData:n,isMultipleObjects:!0,wereDeletedViaTrash:!0,wasDeletedViaRedo:!1}),e.deleteShape(e.contextMenu,!0),e.lastMovableObject=null}})},e.toggleContextMenuCanvasOn=function(){e.contextMenuState=!0,e.contextMenu=e.spawnRect(e.mouse.x+50,e.mouse.y,100,50,400),e.contextMenu.color="#303030",e.contextMenu.isHelp=!0,e.contextMenu.scaleWithCamera=!0;var t=e.spawnFixedTextObject("Paste",26,0,0,400);e.contextMenu.addChild(t,!0),e.contextMenu.children.forEach(function(e){e.color="#white",e.setBackgroundColor("#303030"),e.isHelp=!0}),t.onClick(function(){e.pasteShape(),e.toggleContextMenuOff()})},e.toggleContextMenuOff=function(){e.contextMenuState=!1,e.deleteShape(e.contextMenu,!0)},e.toggleSelectionButton=function(){e.selectionButtonState?(e.selectionButtonState=!1,e.selectionButton.setImg(L.gT.selectionOff)):(e.selectionButtonState=!0,e.selectionButton.setImg(L.gT.selectionOn),e.showPopUpMessage("Tap and drag to create selection!"))},e.selectionClickDown=function(){if(e.startingPointSelection=e.mouse.roundVector(1).clone(),null!=e.selectionShape&&!e.keyIsDown(32)&&!e.keyIsDown(17)&&null!=e.selectionShape.listSelect){var t,n=!1,i=ie(e.selectionShape.listSelect);try{for(i.s();!(t=i.n()).done;)t.value.hovering&&(n=!0)}catch(e){i.e(e)}finally{i.f()}if(e.selectionShape.children.length>0){var o,a=ie(e.selectionShape.children[0].children);try{for(a.s();!(o=a.n()).done;)o.value.hovering&&(n=!0)}catch(e){a.e(e)}finally{a.f()}}if(n){if(e.selectionShape.listSelect.length>0){var s=[];e.selectionShape.listSelect.forEach(function(t){s.push(e.storeShapeData(t))}),e.undoShapes.push({shapeData:s,isMultipleObjects:!0,wereDeletedViaTrash:!1,wasDeletedViaRedo:!1})}}else e.rotate_Counter_Clockwise.hovering&&!e.rotate_Clockwise.hovering||(e.firstTimeRotation=!0,e.deleteSelection())}},e.initSelection=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;e.selectionShape=e.spawnRect(t,n,i,o,300),e.selectionShape.alwaysStroke=!0,e.selectionShape.strokeColor=e.color(0,150,255),e.selectionShape.color=e.color(0,150,255,25),e.selectionShape.isHelp=!0},e.createSelection=function(){var t;if(null!=e.pressedObject&&!0!==(null===(t=e.pressedObject)||void 0===t?void 0:t.pinned)||null==e.startingPointSelection||null!=e.selectionShape||!e.editMode)null!=e.selectionShape&&(e.selectionShape.vertices[1].x=e.mouse.x,e.selectionShape.vertices[2]=e.mouse.clone(),e.selectionShape.vertices[3].y=e.mouse.y);else{var n=(e.startingPointSelection.x+e.mouse.x)/2,i=(e.startingPointSelection.y+e.mouse.y)/2,o=Math.abs(e.startingPointSelection.x-e.mouse.x),a=Math.abs(e.startingPointSelection.y-e.mouse.y);e.initSelection(n,i,o,a)}},e.adjustSelection=function(){if(null!=e.selectionShape){if(0!==e.selectionShape.colliding.length||e.contextMenu.hovering)if(e.selectionShape.movable){if(e.trashCan.hovering||e.sideMenu.hovering&&e.selectionShape.movable){var t,n=[],i=ie(e.selectionShape.listSelect);try{for(i.s();!(t=i.n()).done;){var o=t.value;
1o.hovering=!1,n.push(e.storeShapeData(o,!1,!1,!0)),e.deleteShapeWithExtraSteps(o)}}catch(e){i.e(e)}finally{i.f()}e.listPreviousSelect=[],e.lastMovableObject=null,e.deleteSelection(),e.undoShapes.push({shapeData:n,isMultipleObjects:!0,wereDeletedViaTrash:!0,wasDeletedViaRedo:!1}),e.fullscreenDiv.css("cursor","default"),e.trashCan.setImg(L.gT.trash)}}else{var a,s=[],r=[],l=[],c=[],u=[],h=ie(e.selectionShape.colliding.filter(function(e){return!e.pinned}));try{for(h.s();!(a=h.n()).done;){var d=a.value;s.push(d.calcLeftX()),r.push(d.calcRightX()),l.push(d.calcTopY()),c.push(d.calcBottomY()),u.push(d)}}catch(e){h.e(e)}finally{h.f()}var p=(Math.min.apply(Math,s)+Math.max.apply(Math,r))/2,f=(Math.min.apply(Math,c)+Math.max.apply(Math,l))/2,v=Math.abs(Math.min.apply(Math,s)-Math.max.apply(Math,r)),m=Math.abs(Math.min.apply(Math,c)-Math.max.apply(Math,l));e.deleteShape(e.selectionShape,!0),e.initSelection(p,f,v,m),e.selectionShape.movable=!0,e.selectionShape.listSelect=u,e.listPreviousSelect=[],e.lastMovableObject=null}else e.deleteSelection();if(null!=e.selectionShape){0===e.selectionShape.children.length&&e.selectionShape.editShape(!0);var g,b=ie(e.selectionShape.listSelect);try{for(b.s();!(g=b.n()).done;){var y=g.value;y.shapeOffset=e.selectionShape.pos.clone().substract(y.pos),e.listPreviousSelect.push(y)}}catch(e){b.e(e)}finally{b.f()}e.previousSelectionShape=e.selectionShape}e.mobileSelection=!1}},e.deleteSelection=function(){null!=e.selectionShape&&(e.deleteShape(e.selectionShape,!0),e.selectionShape=null)},e.addOrRemoveLink=function(){for(var t=!1,n=0;n<e.movableShapes.length;n++)if(e.movableShapes[n].originalShape.hovering&&e.movableShapes[n].originalShape instanceof j.Ob
1stacle){for(var i=0;i<e.lastSelectedButton.linkedId.length;i++)if(e.lastSelectedButton.linkedId[i]===e.movableShapes[n].originalShape.id){t=!0,e.lastSelectedButton.linkedId.splice(i,1);break}if(!t){e.lastSelectedButton.linkedId.push(e.movableShapes[n].originalShape.id),e.showPopUpMessage("Link has been added!");break}e.showPopUpMessage("Link has been removed!")}else!e.movableShapes[n].originalShape.hovering||e.movableShapes[n].originalShape instanceof j.Obstacle||e.showPopUpMessage("Cannot link to this object");e.toggleLinkButton()},e.toggleLinkButton=function(){e.linkButtonState?(e.linkButtonState=!1,e.linkButton.setImg(L.gT.linkOff)):(e.linkButtonState=!0,e.linkButton.setImg(L.gT.linkOn))},e.togglePinButton=function(){null!=e.lastPinnabledObject&&(e.lastPinnabledObject.pinned=!e.lastPinnabledObject.pinned,e.lastPinnabledObject.pinned?(e.lastPinnabledObject.removeAllChildren(),e.pinButton.setImg(L.gT.pinOn)):e.pinButton.setImg(L.gT.pinOff),e.showPopUpMessage(e.lastPinnabledObject.pinned?"Pinned!":"Unpinned!"))},e.addShapeWithExtraSteps=function(t){e.addObjectToScene(t,t.zIndex),e.addInteractiveObject(t),e.addMovableShape(t)},e.deleteShapeWithExtraSteps=function(t){e.removeInteractiveObject(t),e.deleteShape(t,!0),e.removeMovableShape(t)},e.addMovableShape=function(t){e.movableShapes.push(e.storeShapeData(t))},e.removeMovableShape=function(t){e.movableShapes.forEach(function(n,i){e.movableShapes[i].originalShape.id===t.id&&e.movableShapes.splice(i,1)})},e.showPopUpMessage=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(null==e.popUpMessage){e.popUpMessage=e.spawnFixedTextObject(t,25,0,e.height/2-2*e.topMenu.getHeight());var i=0,o=setInterval(function(){(i+=1)>=25&&(i<50?e.popUpMessage.color=e.color(0,255-10*(i-25)):(e.deleteShape(e.popUpMessage),e.popUpMessage=null,clearInterval(o)))},20*n)}},e.spawnCustomSelection=function(t,n,i){var o=e.spawnRect(t.pos.x,t.pos.y,t.getWidth()+i,t.getHeight()+i,150);return o.rotate(t.rotation.x),o.color=e.color(0,0),o.alwaysStroke=!0,o.strokeColor=n,o.isHelp=!0,o}}}(e),e.zoomButton=re()(".zoom-button").first(),t=a.width(),n=a.height(),e.createCanvas(t,n).parent(a[0]),i=re()("canvas").last(),e.resize(),setTimeout(e.resize,100),re()(window).resize(e.resize),e.fullscreen=!1,e.mousePressed=!1,window.onmousedown=function(){e.mousePressed=!0},window.onmouseup=function(){e.mousePressed=!1},e.isMobile=!1,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(navigator.userAgent.
1substring(0,4)))&&(e.isMobile=!0),e.mobileClickDown=!0,e.mobilePressed=!1,e.mobileDoublePressed=!1,e.mobileSelection=!1,e.startingPointScroll=null,e.touche1=null,e.touche2=null,e.id=0,e.canvasCamera=new X,e.shapes={},e.cars=[],e.pdt=0,e.mouse=new b.M(e.mouseX,e.mouseY),e.carController=!1,e.debug=!1,e.editMode=!1,e.pause=!1,e.undoShapes=[],e.redoShapes=[],e.movableShapes=[],e.listPreviousSelect=[],e.coinsToRespawn=[],e.objectsToRespawn=[],e.interactiveObjects=[],e.linkedObjectsList=[],e.lastCopiedObjects=[],e.contextMenu={},e.selectionShape=null,e.startingPointSelection=null,e.previousSelectionShape=null,e.lastSelectedButton=null,e.lastPinnabledObject=null,e.pressedObject=null,e.hoveredObject=null,e.lastMovableObject=null,e.popUpMessage=null,e.save=null,e.saving=!1,e.contextMenuState=!1,e.pasteButtonState=!1,e.selectionButtonState=!1,e.linkButtonState=!1,e.pinButtonState=!1,e.levelHasChanged=!1,e.mouseWasPressed=!1,e.firstTimeRotation=!0,e.coinsTotal=0,e.editBoxSize=e.isMobile?15:10,e.zoomButton&&(e.zoomButton.unbind("click"),e.zoomButton.click(function(){var t;if("block"!==e.fullscreenDiv.css("display")){if(s=a.parent(),e.fullscreenDiv.css("display","block"),a.appendTo(e.fullscreenDiv),e.isMobile){var n=document.documentElement;n.requestFullscreen&&n.requestFullscreen(),e.fullscreen=!0}}else null!==(t=e.editorButton)&&void 0!==t&&t.hovering||(e.fullscreenDiv.css("display","none"),a.appendTo(s),e.isMobile&&document.exitFullscreen&&(document.exitFullscreen(),e.fullscreen=!1),e.editMode&&e.exitEditMode())})),e.maxFPS=30,e.frameRate(60),e.rectMode(e.CENTER),e.imageMode(e.CENTER),e.angleMode(e.DEGREES),e.pdt=Date.now(),W.s=e)},e.draw=function(){if(e.loading&&(e.loading=!1,e.init&&e.init(e)),!e.pause&&e.canvasLoaded){e.canvasAutoResize(),e.background(240),e.translate(e.width/2,e.height/2),e.fill(255,0,0),e.textAlign(e.CENTER,e.CENTER),e.lookForMouseCollisions(),e.isInsideCanvas()&&((e.keyIsDown(32)||e.keyIsDown(17))&&e.fullscreenDiv.css("cursor","grab"),e.editMode&&(e.mobilePressed&&e.mobileClickDown&&!e.mobileDoublePressed?e.clickDownGeneralMobile():e.isMobile||!e.mousePressed||e.mouseWasPressed||e.clickDownGeneralPC()),!e.isMobile&&e.mousePressed||e.mobilePressed?e.mousePressedActions():null==e.pressedObject||!e.editMode||e.keyIsDown(32)||e.keyIsDown(17)||e.clickPressedObjectActions(),!e.mousePressed&&e.mouseWasPressed&&e.clickGeneral()),e.mouse.x=e.mouseX-e.width/2,e.mouse.y=-e.mouseY+e.height/2,e.mouse.multiplyScalar(e.canvasCamera.scale/1e3).add(e.canvasCamera.pos),e.lookForShapesCollisions();var t,n=he(e.cars);try{for(n.s();!(t=n.n()).done;)t.value.update()}catch(e){n.e(e)}finally{n.f()}e.drawGrid();for(var i=0,o=Object.values(e.shapes);i<o.length;i++){var a,s=he(o[i]);try{for(s.s();!(a=s.n()).done;)a.value.draw()}catch(e){s.e(e)}finally{s.f()}}e.canvasCamera.update(),e.debugInfos(),e.mouseWasPressed=e.mousePressed,e.levelHasChanged&&(console.log("level changed, it will be saved automatically soon..."),e.onChange(e),e.levelHasChanged=!1),e.pdt=Date.now()}},e.canvasAutoResize=function(){(0,y.Ev)(a.width(),e.width)&&(0,y.Ev)(a.height(),e.height)||(e.resize(a.width(),a.height()),e.editMode&&(e.exitEditMode(),e.enterEditMode()),e.isMobile&&e.fullscreen&&null==document.fullscreenElement&&e.zoomButton.click())},e.lookForMouseCollisions=function(){for(var t=0,n=Object.values(e.shapes);t<n.length;t++){var i,o=he(n[t]);try{for(o.s();!(i=o.n()).done;){var a,s=i.value;e.isMobile&&e.mousePressed&&e.mouseWasPressed?(e.mobilePressed=!0,2===e.touches.length?e.mobileDoublePressed=!0:e.mobileDoublePressed=!1):e.mobilePressed=!1,a=s instanceof C||s instanceof T?(0,y.EF)(s.vertices,[new b.M(e.mouseX-e.width/2,-e.mouseY+e.height/2)]):(0,y.EF)(s.vertices,[e.mouse]);var r={x:e.mouse.x,y:e.mouse.y};a&&!e.mobileDoublePressed?(e.isMobile&&!e.mobilePressed||(s.hover(r),e.hoveredObject=s),!e.isMobile&&e.mousePressed&&!e.mouseWasPressed||e.mobilePressed&&e.mobileClickDown?(e.pressedObject=s,e.pressedObject.mouseOffset=e.mouse.clone().substract(e.pressedObject.pos),e.pressedObject.clickDown()):!e.isMobile&&e.mousePressed||e.mobilePressed?s.pressed():!e.mousePressed&&e.mouseWasPressed&&(null==e.pressedObject||e.pressedObject!==s||e.editMode||(e.pressedObject.click(),e.pressedObject=null),e.mobileClickDown=!0)):s.hovering&&(s.hoverExit(r),e.hoveredObject=null)}}catch(e){o.e(e)}finally{o.f()}}},e.clickDownGeneralMobile=function(){null!=e.pressedObject&&(e.mobileClickDown=!1),null!=e.selectionShape&&(e.selectionClickDown(),e.mobileClickDown=!1),e.topMenu.hovering||e.sideMenu.hovering||(e.selectionButtonState&&(e.selectionClickDown(),e.mobileSelection=!0,e.toggleSelectionButton(),e.mobileClickDown=!1),e.pasteButtonState?(e.pasteShape(),e.togglePasteButton(),e.pressedObject=e.selectionShape,e.pressedObject.mouseOffset=e.mouse.clone().substract(e.pressedObject.pos),e.mobileClickDown=!1):e.linkButtonState&&(e.addOrRemoveLink(),e.mobileClickDown=!1)),e.deleteSelectionOnLinkedObjects(),e.deleteLastMovableObjectChildren()},e.clickDownGeneralPC=function(){e.deleteSelectionOnLinkedObjects(),e.deleteLastMovableObjectChildren(),e.selectionClickDown(),e.mouseButton===e.LEFT&&(!0===e.contextMenuState&&null!=e.contextMenu?e.contextMenu.hovering||e.toggleContextMenuOff():e.topMenu.hovering||e.sideMenu.hovering||(e.pasteButtonState?(e.pasteShape(),e.togglePasteButton()):e.linkButtonState&&e.addOrRemoveLink()))},e.mousePressedActions=function(){var t;if(e.mobileDoublePressed)e.doubleTouchZoom();else if(e.mouseButton===e.CENTER||e.keyIsDown(32)||e.keyIsDown(17)||!e.editMode)e.canvasCamera.move(new b.M((e.pmouseX-e.mouseX)*(e.canvasCamera.scale/1e3),(e.mouseY-e.pmouseY)*(e.canvasCamera.scale/1e3)));else if(null!=e.pressedObject&&!1===(null===(t=e.pressedObject)||void 0===t?void 0:t.pinned)){if(e.pressedObject.isEditBox)if(e.pressedObject.isRotateBox){var n=e.pressedObject.rotateFromRotateBox();if(e.selectionShape===e.pressedObject.parent.parent){var i,o=he(e.selectionShape.listSelect);try{for(o.s();!(i=o.n()).done;)i.value.rotate(n,e.selectionShape.pos)}catch(e){o.e(e)}finally{o.f()}}}else e.pressedObject.modifySize();
1else if(e.pressedObject.movable){if(e.pressedObject.setPos(e.mouse.clone().substract(e.pressedObject.mouseOffset).roundVector(5),!1),e.selectionShape===e.pressedObject){var a,s=he(e.selectionShape.listSelect);try{for(s.s();!(a=s.n()).done;){var r=a.value;r.setPos(e.selectionShape.pos.clone().substract(r.shapeOffset).roundVector(1),!1)}}catch(e){s.e(e)}finally{s.f()}}}else if(e.pressedObject===e.sideMenu){var l=e.mouse.roundVector(1).clone(),c=l.y-e.startingPointScroll.y;e.sideMenu.scroll({delta:c}),e.startingPointScroll=l}}else e.isMobile&&!e.mobileSelection?e.canvasCamera.move(new b.M((e.pmouseX-e.mouseX)*(e.canvasCamera.scale/1e3),(e.mouseY-e.pmouseY)*(e.canvasCamera.scale/1e3))):e.createSelection()},e.clickPressedObjectActions=function(){if(e.addSelectionOnLinkedObjects(),e.pressedObject.movable&&!e.pressedObject.isHelp){if(e.lastPinnabledObject=e.pressedObject,e.lastMovableObject=e.pressedObject,e.listPreviousSelect=[],!e.pressedObject.pinned){var t,n=he(e.cars);try{for(n.s();!(t=n.n()).done;){var i=t.value;i.shape!==e.pressedObject||e.execution||i.setInitialPlacement()}}catch(e){n.e(e)}finally{n.f()}var o=e.movableShapes.find(function(t){return t.originalShape.id===e.pressedObject.id});e.trashCan.hovering||e.sideMenu.hovering?(e.addSingleUndoWithData(e.pressedObject,!1,!1,!0),void 0===o?e.movableShapes.push(e.storeShapeData(e.pressedObject,!1,!1,!0)):e.movableShapes.splice(e.movableShapes.indexOf(o),1,e.storeShapeData(e.pressedObject,!1,!1,!0)),e.lastMovableObject=null):(e.addSingleUndoWithData(e.pressedObject),void 0===o?e.movableShapes.push(e.storeShapeData(e.pressedObject)):e.movableShapes.splice(e.movableShapes.indexOf(o),1,e.storeShapeData(e.pressedObject)))}}else if(e.pressedObject.isEditBox&&!e.pressedObject.isRotateBox)e.addSingleUndoWithData(e.pressedObject.parent.parent);else if(e.pressedObject.isRotateBox){var a,s=he(e.cars);try{for(s.s();!(a=s.n()).done;){var r=a.value;r.shape!==e.pressedObject.parent.parent||e.execution||r.setInitialPlacement()}}catch(e){s.e(e)}finally{s.f()}}e.pressedObject instanceof C||e.pressedObject instanceof T||e.redoShapes.splice(0,e.redoShapes.length),e.changeCursorOnMovement(),e.mouseButton===e.RIGHT?e.pressedObject.rightClick():e.pressedObject.click(),e.pressedObject=null,e.mobileClickDown=!0,e.levelHasChanged=!0},e.clickGeneral=function(){e.editMode&&e.adjustSelection(),e.touche1=null,e.touche2=null},e.addSelectionOnLinkedObjects=function(){e.pressedObject.isButton&&e.pressedObject.linkedId.forEach(function(t){var n=e.getShapeById(t);null!=n&&e.linkedObjectsList.push(e.spawnCustomSelection(n,"blue",25))})},e.deleteSelectionOnLinkedObjects=function(){e.linkedObjectsList.forEach(function(t){e.deleteShape(t)}),e.linkedObjectsList=[]},e.deleteLastMovableObjectChildren=function(){null!=e.lastMovableObject&&(null==e.hoveredObject?e.lastMovableObject.removeAllChildren():e.hoveredObject.isHelp||e.lastMovableObject.removeAllChildren())},e.doubleTouchZoom=function(){var t=new b.M(e.touches[0].x,e.touches[0].y),n=new b.M(e.touches[1].x,e.touches[1].y);null==e.touche1&&null==e.touche2&&(e.touche1=t.clone(),e.touche2=n.clone());var i=t.clone().dist(n),o=e.touche1.clone().dist(e.touche2);e.canvasCamera.addScale(10*Math.round(o-i)*(e.canvasCamera.scale/1e3)),e.touche1=t.clone(),e.touche2=n.clone()},e.lookForShapesCollisions=function(){for(var t=0,n=Object.values(e.shapes);t<n.length;t++){var i,o=he(n[t]);try{for(o.s();!(i=o.n()).done;){var a=i.value;if(!(a instanceof C||a instanceof T)){var s,r=he(e.cars);try{for(r.s();!(s=r.n()).done;){var l=s.value;a.isHelp||l.shape!==a&&((0,y.EF)(a.vertices,l.shape.vertices)?(a.collision({collider:a,collidingWith:l}),l.shape.collision({collider:l,collidingWith:a})):(a.colliding.includes(l)&&a.collisionExit({collider:a,collidingWith:l}),l.shape.colliding.includes(a)&&l.shape.collisionExit({collider:l,collidingWith:a})))}}catch(e){r.e(e)}finally{r.f()}for(var c=0,u=Object.values(e.shapes);c<u.length;c++){var h,d=he(u[c]);try{for(d.s();!(h=d.n()).done;){var p=h.value;if(!(p instanceof C||p instanceof T||p===a||p.isHelp)){var f,v=!1,m=he(e.cars);try{for(m.s();!(f=m.n()).done;)f.value.shape===p&&(v=!0)}catch(e){m.e(e)}finally{m.f()}v||((0,y.EF)(a.vertices,p.vertices)?a.collision({collider:a,collidingWith:p}
1):a.colliding.includes(p)&&a.collisionExit({collider:a,collidingWith:p}))}}}catch(e){d.e(e)}finally{d.f()}}}}}catch(e){o.e(e)}finally{o.f()}}},e.drawGrid=function(){e.stroke(200),e.strokeWeight(.5);for(var t=50,n=Math.round(e.width*(e.canvasCamera.scale/1e3)/t*2)*t*2,i=Math.round(e.height*(e.canvasCamera.scale/1e3)/t*2)*t*2,o=n/t,a=i/t,s=0;s<o;s++)(s*t-n/2+Math.ceil(e.canvasCamera.pos.x<=0?e.canvasCamera.pos.x/t:e.canvasCamera.pos.x/t-1)*t)%250==0&&e.stroke(100),e.line((s*t-n/2-e.canvasCamera.pos.x%t)*(1e3/e.canvasCamera.scale),(e.canvasCamera.pos.y%t-i/2)*(1e3/e.canvasCamera.scale),(s*t-n/2-e.canvasCamera.pos.x%t)*(1e3/e.canvasCamera.scale),(e.canvasCamera.pos.y%t+i/2)*(1e3/e.canvasCamera.scale)),e.stroke(200);for(var r=0;r<a;r++)(r*t-i/2+Math.ceil(e.canvasCamera.pos.y<=0?e.canvasCamera.pos.y/t:e.canvasCamera.pos.y/t-1)*t)%250==0&&e.stroke(100),e.line((-n/2-e.canvasCamera.pos.x%t)*(1e3/e.canvasCamera.scale),(e.canvasCamera.pos.y%t-r*t+i/2)*(1e3/e.canvasCamera.scale),(n/2-e.canvasCamera.pos.x%t)*(1e3/e.canvasCamera.scale),(e.canvasCamera.pos.y%t-r*t+i/2)*(1e3/e.canvasCamera.scale)),e.stroke(200)},e.debugInfos=function(){e.fill("black"),e.noStroke(),e.textSize(35),e.textAlign(e.LEFT),e.debug&&(e.text("x : "+e.canvasCamera.pos.x.toFixed(2),-490,-475),e.text("y : "+e.canvasCamera.pos.y.toFixed(2),-490,-440),e.text("scaling : "+e.canvasCamera.scale.toFixed(0),-490,-405),e.text("car : "+e.selectedCar,-490,-370));var t=1e3/e.maxFPS/(Date.now()-e.pdt)*e.maxFPS,n=e.isMobile?18:25;e.textSize(n),e.text("FPS: "+Math.round(t),e.width/10,e.height/2-n)},e.saveConditions=function(){e.levelHasChanged&&e.onChange()},e.isInsideCanvas=function(){return e.mouseX>=0&&e.mouseX<=e.width&&e.mouseY>=0&&e.mouseY<=e.height},e.convertToRealPos=function(t){return new b.M(e.convertToRealPosX(t.x),e.convertToRealPosY(t.y))},e.convertToFictPos=function(t){return new b.M(e.convertToFictPosX(t.x),e.convertToFictPosY(t.y))},e.convertToRealPosX=function(t){return(t-e.canvasCamera.pos.x)*(1e3/e.canvasCamera.scale)},e.convertToRealPosY=function(t){return(e.canvasCamera.pos.y-t)*(1e3/e.canvasCamera.scale)},e.convertToFictPosX=function(t){return t*(e.canvasCamera.scale/1e3)+e.canvasCamera.pos.x},e.convertToFictPosY=function(t){return t*(e.canvasCamera.scale/1e3)-e.canvasCamera.pos.y},e.convertPixelsToMeters=function(e){return.02*e},e.convertMetersToPixels=function(e){return 50*e},e.showDebug=function(t){e.debug=t},e.mouseWheel=function(t){var n,i;if(null!=e.sideMenu){if(e.sideMenu.hovering)e.sideMenu.scroll({delta:t.delta});else if(e.isInsideCanvas()&&null!==(i=e.canvasCamera)&&void 0!==i&&i.wheelScaling)return e.canvasCamera.addScale(t.delta*(e.canvasCamera.scale/1e3)),!1}else if(e.isInsideCanvas()&&null!==(n=e.canvasCamera)&&void 0!==n&&n.wheelScaling)return e.canvasCamera.addScale(t.delta*(e.canvasCamera.scale/1e3)),!1},e.keyPressed=function(){var t,n;if(e.carController&&null!=e.selectedCar&&e.selectedCar<e.cars.length&&(82===e.keyCode&&e.cars.length>1?(e.cars[e.selectedCar].stop(),e.selectedCar=(e.selectedCar+1)%e.cars.length):83===e.keyCode?e.cars[e.selectedCar].dir.y=1:88===e.keyCode?e.cars[e.selectedCar].dir.y=-1:90===e.keyCode?e.cars[e.selectedCar].dir.x=-1:67===e.keyCode&&(e.cars[e.selectedCar].dir.x=1)),e.editMode)return e.keyIsDown(17)&&90===e.keyCode&&e.undoShapes.length>0&&(e.undoButton.click(),e.deleteSelection()),e.keyIsDown(17)&&89===e.keyCode&&e.redoShapes.length>0&&e.redoButton.click(),e.keyIsDown(17)&&67===e.keyCode&&(e.copyButton.click(),null!=e.lastMovableObject&&e.lastMovableObject.removeAllChildren()),e.keyIsDown(17)&&86===e.keyCode&&e.pasteShape(),189===e.keyCode&&(null===(t=e.pressedObject)||void 0===t?void 0:t.zIndex)>0?e.pressedObject.setZIndex(Number(e.pressedObject.zIndex)-1):187===e.keyCode&&(null===(n=e.pressedObject)||void 0===n?void 0:n.zIndex)<400&&e.pressedObject.setZIndex(Number(e.pressedObject.zIndex)+1),!1},e.keyReleased=function(){e.carController&&(83===e.keyCode&&e.cars[e.selectedCar].dir.y>0||88===e.keyCode&&e.cars[e.selectedCar].dir.y<0?e.cars[e.selectedCar].dir.y=0:(90===e.keyCode&&e.cars[e.selectedCar].dir.x<0||67===e.keyCode&&e.cars[e.selectedCar].dir.x>
10)&&(e.cars[e.selectedCar].dir.x=0)),32!==e.keyCode&&17!==e.keyCode||e.fullscreenDiv.css("cursor","default")},e.storeShapeData=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return{originalShape:e,clonedShape:e.cloneShape(),wasDeletedViaUndo:t,wasRedo:n,wasDeletedViaTrash:i}},e.addObjectToScene=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;void 0===n&&(n=Object.keys(e.shapes).length),n in e.shapes||(e.shapes[n]=[]),e.shapes[n].push(t),t.zIndex=n;var i=[];for(var o in e.shapes)i.push(o);i.sort();for(var a={},s=0,r=i;s<r.length;s++){var l=r[s];a[l]=e.shapes[l]}e.shapes=a},e.deleteShape=function(t){for(var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=0,s=Object.entries(e.shapes);a<s.length;a++){var r=(0,o.A)(s[a],2),l=r[0],c=r[1];e.shapes[l]=c.filter(function(e){return e!==t})}if(n&&null!=t.children){var u,h=he(t.children);try{for(h.s();!(u=h.n()).done;){var d=u.value;e.deleteShape(d)}}catch(e){h.e(e)}finally{h.f()}}i&&(e.addSingleUndoWithData(e.lastMovableObject,!1,!1,!0),e.movableShapes.push(e.storeShapeData(e.lastMovableObject,!1,!1,!0)))},e.spawnRect=function(t,n,i,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=e.spawnShape(a,[-i/2,o/2],[i/2,o/2],[i/2,-o/2],[-i/2,-o/2]);return s.setPos(new b.M(t,n),!1),s},e.spawnShape=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];var a=(0,h.A)(d.y,[e].concat(i));return e.addObjectToScene(a,t),a},e.spawnDecoration=function(t,n,i,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,s=new te(e,"base",[-i/2,o/2],[i/2,o/2],[i/2,-o/2],[-i/2,-o/2]);return e.addObjectToScene(s,a),s},e.spawnTerrain=function(t,n,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,a=new D.Terrain(e,i,[-t/2,n/2],[t/2,n/2],[t/2,-n/2],[-t/2,-n/2]);return e.addObjectToScene(a,o),a},e.spawnRoad=function(t,n,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,a=new I.Road(e,i,[-t/2,n/2],[t/2,n/2],[t/2,-n/2],[-t/2,-n/2]);return e.addObjectToScene(a,o),a},e.spawnObstacle=function(t,n,i){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,a=new j.Obstacle(e,i,[-t/2,n/2],[t/2,n/2],[t/2,-n/2],[-t/2,-n/2]);return e.addObjectToScene(a,o),a},e.spawnInteractiveObject=function(t,n,i,o,a){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0,r=new B.Interactive(e,i?"collectable":o?"objective":a?"button":"spring",[-t/2,n/2],[t/2,n/2],[t/2,-n/2],[-t/2,-n/2]);return e.addObjectToScene(r,s),e.addInteractiveObject(r),r},e.spawnFixedObject=function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];var a=(0,h.A)(C,[e].concat(i));return e.addObjectToScene(a,t),a},e.spawnFigure=function(t,n){for(var i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];var s=(0,h.A)(J,[e,n].concat(o));return e.addObjectToScene(s),s},e.spawnFixedRect=function(t,n,i,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:500;return e.spawnFixedObject(a,[t-i/2,n+o/2],[t+i/2,n+o/2],[t+i/2,n-o/2],[t-i/2,n-o/2])},e.spawnTextObject=function(t,n,i,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,s=new _(e,"base",[i-n/2,o+n/2],[i+n/2,o+n/2],[i+n/2,o-n/2],[i-n/2,o-n/2]);return s.text=t,e.addObjectToScene(s,a),s},e.spawnFixedTextObject=function(t,n,i,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,s=new T(e,t,n,i,o,"white");return e.addObjectToScene(s,a),s},e.spawnCar=function(t,n,i,o){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:100,s=e.spawnRect(t,n,i,o,a),r=new G(e,s);return r.shape.setImg(L.gT.carTop),e.cars.push(r),e.selectedCar=e.cars.length-1,e.car=r,r},e.deleteCar=function(t){e.cars=e.cars.filter(function(e){return e!==t}),e.deleteShape(t.shape)},e.enableCarController=function(){e.carController=!0},e.disableCarController=function(){e.carController=!1},e.stringify=function(){var t={initial_code:arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],cars:e.cars,shapes:e.shapes,cam:e.canvasCamera},n=["s","img","length","colliding","hovering","camera","forward","dir","shape","children","parent","strokeColor","alwaysStroke","scaleWithCamera","carInteraction","isEditBox","boun
1ds","middle","left","top","right","bottom","oldLeft","oldTop","oldRight","oldBottom","oldMiddle","oldWidth","oldHeight","mouseOffset","isRotateBox","cursor","leftEdgeClickDown","upEdgeClickDown","rightEdgeClickDown","bottomEdgeClickDown"];return JSON.stringify(t,function(e,t){return n.includes(e)?void 0:"number"==typeof t?parseFloat(t.toFixed(2)):t instanceof C||t instanceof T?void 0:t})},e.automaticSave=function(){e.saving=!0,setTimeout(function(){e.saveLevel(),e.saving=!1},5e3)},e.saveLevel=function(){return ue.serialize(Object.values(e.shapes).flat(1))},e.clear=function(){e.shapes={},e.cars=[],e.canvasCamera=null,e.editMode=!1,e.coinsTotal=0,e.coinsToRespawn=[],e.interactiveObjects=[],e.movableShapes=[],e.undoShapes=[],e.redoShapes=[]},e.getShapeById=function(t){for(var n=0,i=Object.values(e.shapes);n<i.length;n++){var o,a=he(i[n]);try{for(a.s();!(o=a.n()).done;){var s=o.value;if(s.id===t)return s}}catch(e){a.e(e)}finally{a.f()}}return null},e.resize=function(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;null==n||null==o||n===e.width&&o===e.height||(e.resizeCanvas(n,o),e.editMode&&(null===(t=e.editorButton)||void 0===t||t.setPos(new b.M(e.width/2-35,-e.height/2+95),!1)),null!=e.robotConnectButton&&e.robotConnectButton.setPos(new b.M(e.width/2-35,-e.height/2+35),!1)),a.height()*(e.width/e.height)<a.width()?(i.css("height","100%"),i.css("width",i.height()*(e.width/e.height)+"px")):(i.css("width","100%"),i.css("height",i.width()*(e.height/e.width)+"px"))},e.winTrigger=function(){}},ye=n(38267).Ay.div.withConfig({displayName:"simulationTypes__StyledSimulation",componentId:"sc-m4mfww-0"})(["width:100%;height:100%;.fullscreen-div{position:fixed;z-index:100;left:0;display:none;}"]),Se=n(14837),we=n(82010),xe=n(80238),Ce=n(45066),Me=n(74848);const ke=function(e){var t=e.init,n=e.onChange,s=e.id,l=e.stopExecution,c=e.setShowConfetti,h=(0,a.useState)(!0),d=(0,o.A)(h,2),p=d[0],f=d[1],v=(0,a.useState)(!1),m=(0,o.A)(v,2),g=m[0],b=m[1],y=(0,a.useState)(""),S=(0,o.A)(y,2),w=S[0],x=S[1],C=(0,a.useState)(!1),M=(0,o.A)(C,2),k=M[0],O=M[1],A=(0,a.useState)(),T=(0,o.A)(A,2),j=T[0],I=T[1],D=(0,a.useRef)(null),B=(0,r.Bd)().t,R=(0,a.useContext)(Se.Dx).theme,P=(0,xe.C)();(0,a.useEffect)(function(){return P(),function(){D.current&&D.current.cleanup()}},[]),(0,a.useEffect)(function(){D.current&&D.current.cleanup(),f(!0)},[s]);var F=(0,a.useCallback)(function(e,t){I(e),x(t),b(!0),l()},[l]),z=(0,a.useCallback)(function(){O(!0),c(!0),l()},[l,c]),E=(0,a.useCallback)(function(){},[]);return(0,i.A)(ye,{},void 0,(0,i.A)("div",{className:"h-full w-full",id:s},void 0,pe||(pe=(0,i.A)(Ce.VAA,{className:"zoom-button absolute top-2 right-2 text-2xl text-black"})),re()("#".concat(s)).length?(0,Me.jsxs)(Me.Fragment,{children:[(0,i.A)(we.W,{className:"h-full w-full bg-white",fullscreenDiv:"fullscreen-div",canvasDiv:re()("#".concat(s)),zoomButton:"",sketch:be,onChange:n,onWin:z,onLose:F,onConnectCar:E,init:function(e){D.current=e,f(!1),t(e)}}),p&&(0,i.A)(Se.xx,{bg:R.color.bg,relative:!0}),fe||(fe=(0,i.A)("div",{id:"p5_loading"}))]}):ve||(ve=(0,i.A)(Se.xx,{relative:!0}))),me||(me=(0,i.A)(u.A,{className:"fullscreen-div",startAtTop:!0})),(0,i.A)(Se.aF,{title:B("simulation.modal.lose"),open:g,setOpen:b,hideCloseButton:!0,centered:!0,centeredText:!0,submitText:B("simulation.modal.retry"),onSubmit:function(){return b(!1),!0}},void 0,(0,i.A)("img",{alt:"lose gif",src:j,height:"200px"}),ge||(ge=(0,i.A)("br",{})),B(w)),(0,i.A)(Se.aF,{title:B("simulation.modal.win"),open:k,setOpen:function(e){e||(O(!1),c(!1))},hideCloseButton:!0,centered:!0,centeredText:!0,submitText:B("simulation.modal.continue"),onSubmit:function(){return O(!1),c(!1),!0}},void 0,"ððð"))};var Oe=n(6246),Ae=n(46431),Te=n(75132),je=n(73275),Ie=n(18355),De=n(10467),Be=n(80045),Re=n(54756),Pe=n.n(Re),Fe=n(52152),ze=n(22072),Ee=["editMode","additionalActions","additionalLegacyActions"];function _e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function We(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
1t%2?We(Object(n),!0).forEach(function(t){(0,R.A)(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):We(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ne=function(){return(0,f.A)(function e(t){var n=this;(0,p.A)(this,e),this.editMode=t,(0,R.A)(this,"s",void 0),(0,R.A)(this,"editorButton",void 0),(0,R.A)(this,"robotConnectButton",void 0),(0,R.A)(this,"playSocket",void 0),(0,R.A)(this,"d1",void 0),(0,R.A)(this,"d2",void 0),(0,R.A)(this,"d3",void 0),(0,R.A)(this,"beforeRun",function(){n.s.canvasCamera&&n.s.car&&n.s.canvasCamera.setTarget(n.s.car)}),(0,R.A)(this,"beforeInterrupt",function(){if(n.s){var e=n.s;if(n.playSocket&&n.playSocket.stopCompile(),e.car.reset(),e.coinsToRespawn.length>0){for(var t=e.coinsToRespawn.length-1;t>=0;t--)e.addObjectToScene(e.coinsToRespawn[t],e.coinsToRespawn[t].zIndex),e.movableShapes.push(e.storeShapeData(e.coinsToRespawn[t]));e.coinsToRespawn.splice(0,e.coinsToRespawn.length)}if(e.objectsToRespawn.length>0){for(var i=e.objectsToRespawn.length-1;i>=0;i--)e.addObjectToScene(e.objectsToRespawn[i],e.objectsToRespawn[i].zIndex),e.movableShapes.push(e.storeShapeData(e.objectsToRespawn[i]));e.objectsToRespawn.splice(0,e.objectsToRespawn.length)}var o,a=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return _e(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_e(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){r=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}(e.interactiveObjects);try{for(a.s();!(o=a.n()).done;){var s=o.value;s.isButton&&s.setImg(L.gT.red_button_unpressed)}}catch(e){a.e(e)}finally{a.f()}null!=e.canvasCamera&&e.canvasCamera.setTarget(null)}})},[{key:"loadChallengeLayout",value:function(e){if("{}"===JSON.stringify(e))this.s.car=this.s.spawnCar(0,0,75,110);else for(var t=ue.deserialize(this.s,e),n=0,i=Object.entries(t);n<i.length;n++){var a=(0,o.A)(i[n],2),s=a[0],r=a[1];this.s.addObjectToScene(r,s),ae(r)}this.editMode&&this.spawnEditorButton(),this.spawnRobotConnectButton()}},{key:"init",value:function(e){this.s=e}},{key:"reset",value:function(e){this.s&&(e.collidingWith,this.s.car)}},{key:"spawnEditorButton",value:function(){var e=this;if(this.s){var t=this.s;this.editorButton=t.spawnFixedRect(t.width/2-35,-t.height/2+95,50,50,5e3),this.editorButton.setImg(L.gT.tools),this.editorButton.color=t.color(0,0),this.editorButton.onHover(function(n){t.strokeWeight(1),e.editorButton.strokeColor="red"}),this.editorButton.onClick(function(e){t.toggleEditMode()})}}},{key:"spawnRobotConnectButton",value:function(){var e=this;this.s&&(this.robotConnectButton=this.s.spawnFixedRect(this.s.width/2-35,-this.s.height/2+35,50,50,1e3),this.robotConnectButton.setImg(L.gT.animatedCar),this.robotConnectButton.color=this.s.color(0,0),this.robotConnectButton.onHover(function(t){e.s.strokeWeight(1),e.robotConnectButton.strokeColor="#0177bc"}),this.robotConnectButton.onClick(function(t){e.s.onConnectCar&&e.s.onConnectCar()}))}},{key:"saveLayout",value:function(e){var t,n=null===(t=Object.entries(e.shapes))||void 0===t?void 0:t.sort(function(e,t){var n=(0,o.A)(e,1)[0],i=(0,o.A)(t,1)[0];return Number(n)-Number(i)}).flatMap(function(e){var t=(0,o.A)(e,2);return t[0],t[1]});return void 0===n?null:ue.serialize(n)}}])}();function He(e){return new Promise(function(t){return setTimeout(t,e)})}var Ue,Ve=n(74562),Ge=n(54781),Xe=n(76629),qe=(0,a.forwardRef)(function(e,t){var n=e.initialCode,u=e.renderForPdf,h=e.readOnly,d=(0,r.Bd)().t,p=(0,a.useContext)(Ae.B),f=p.challenge,v=p.editMode,m=p.progression,g=p.setProgression,y=p.saveChallengeTimed,S=p.saveProgressionTimed,w=p.setShowConfetti,x=p.askForUserInput,C=(p.view,p.tab),M=p.setTab,k=f,O=(0,a.useState)(!1),A=(0,o.A)(O,2),T=A[0],j=A[1],I=(0,Te.A)(),D=(0,o.A)(I,2),B=D[0],R=D[1],P=(0,a.useContext)(Ge.P).dispatch,F=(0,s.MW)(),z=(0,je.A)(),E=function(e){var t=e.editMode,n=e.additionalActions,i=e.additionalLegacyActions,s=(0,Be.A)(e,Ee),r=(0,a.useRef)(null);
1(0,a.useEffect)(function(){r.current=new Ne(t)},[t]);var l,c,u,h=function(){return r.current.s.car},d={"car/arrêter":function(){return h().stop()},"car/avant":(u=(0,De.A)(Pe().mark(function e(t){var n,i;return Pe().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=(0,o.A)(t,1),"number"!=typeof(i=n[0])){e.next=3;break}if(!(i>0)){e.next=2;break}return h().forward(),e.next=1,He(1e3*i);case 1:h().stop(),e.next=2;break;case 2:e.next=4;break;case 3:h().forward();case 4:case"end":return e.stop()}},e)})),function(e){return u.apply(this,arguments)}),"car/arrière":(c=(0,De.A)(Pe().mark(function e(t){var n,i;return Pe().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=(0,o.A)(t,1),"number"!=typeof(i=n[0])){e.next=3;break}if(!(i>0)){e.next=2;break}return h().backward(),e.next=1,He(1e3*i);case 1:h().stop(),e.next=2;break;case 2:e.next=4;break;case 3:h().backward();case 4:case"end":return e.stop()}},e)})),function(e){return c.apply(this,arguments)}),"car/tourner":function(e){var t=(0,o.A)(e,1)[0];if("number"==typeof t)return new Promise(function(e){return h().turn(-t,e)})},"car/tourner droite":function(){return new Promise(function(e){return h().turn(90,e)})},"car/tourner gauche":function(){return new Promise(function(e){return h().turn(-90,e)})},"car/tourner roues":function(e){h().setDirection(new b.M(e[0]/255-e[1]/255,e[0]/500+e[1]/500).normalize().multiplyScalar((e[0]/2+e[1]/2)/255))},"car/tourner vers angle":function(e){var t=(0,o.A)(e,1)[0];if("number"==typeof t){var n,i=h().shape.rotation.x,a=t%360;return n=360-i-(a=360-(a=a<0?360-a:a))<180&&360-i-a>=0?-(360-i-a):-(360-a-i),new Promise(function(e){return h().turn(n,e)})}},"car/set vitesse":function(e){var t=(0,o.A)(e,1)[0];"number"==typeof t&&(h().speed=t)}},p=[{actionId:100,action:{label:"Stop",type:"NORMAL",apply:function(){h().stop()}}},{actionId:101,action:{label:"Forward",type:"NORMAL",apply:function(e){e.length>0&&null!==e[0]&&"number"==typeof e[0]?e[0]>0?(h().forward(),l.wait(function(){h().stop(),l.perform_next()},1e3*e[0])):l.perform_next():(h().forward(),l.perform_next())},handleNext:!0}},{actionId:102,action:{label:"Backward",type:"NORMAL",apply:function(e){e.length>0&&null!==e[0]&&"number"==typeof e[0]?e[0]>0?(h().backward(),setTimeout(function(){h().stop(),l.perform_next()},1e3*e[0])):l.perform_next():(h().backward(),l.perform_next())},handleNext:!0}},{actionId:103,action:{label:"Turn",type:"NORMAL",apply:function(e){e.length>0&&"number"==typeof e[0]?h().turn(-e[0],function(){l.perform_next()}):l.perform_next()},handleNext:!0}},{actionId:104,action:{label:"Turn Right",type:"NORMAL",apply:function(){h().turn(90,function(){l.perform_next()})},handleNext:!0}},{actionId:105,action:{label:"Turn Left",type:"NORMAL",apply:function(){h().turn(-90,function(){l.perform_next()})},handleNext:!0}},{actionId:106,action:{label:"Rotate Wheels",type:"NORMAL",apply:function(e){e.length>=2&&h().setDirection(new b.M(e[0]/255-e[1]/255,e[0]/500+e[1]/500).normalize().multiplyScalar((e[0]/2+e[1]/2)/255))}}},{actionId:107,action:{label:"Go To Angle",type:"NORMAL",apply:function(e){if(e.length>0&&"number"==typeof e[0]){var t,n=h().shape.rotation.x,i=e[0]%360;t=360-n-(i=360-(i=i<0?360-i:i))<180&&360-n-i>=0?-(360-n-i):-(360-i-n),h().turn(t,function(){l.perform_next()})}},handleNext:!0}},{actionId:601,action:{label:"Set Speed",type:"SET",apply:function(e){e.length>=1&&"number"==typeof e[0]&&(h().speed=e[0])}}}],f=(0,a.useCallback)(function(){return r.current.beforeInterrupt()},[]),v=(0,a.useCallback)(function(){return r.current.beforeRun()},[]);return l=(0,Fe.X)(Le({additionalActions:(0,ze.eV)(d,n),additionalLegacyActions:p.concat(null!=i?i:[]),beforeInterrupt:f,beforeRun:v},s)),Le({playgroundRef:r},l)}({editMode:v,askForUserInput:x,alert:F,progLang:k.progLang,additionalActions:{},cmd:null!=R?R:void 0,pltViewDispatch:null!=P?P:void 0});return(0,a.useImperativeHandle)(t,function(){return{nextStep:function(){return E.isExecuting?[!1,!1]:(E.toggleExecution(),[!0,!1])}}}),k?(0,i.A)("div",{className:"h-full w-full"},void 0,(0,i.A)("div",{className:"flex h-full flex-col tablet:flex-row"},void 0,(0,i.A)(Oe.A,{xAxis:"phone"!==z.screenType,yAxis:"phone"===z.screenType,maxWidth:"100%",maxHeight:"100%",minWidth:"0%",initialWidth:"phone"===z.screenType?"100%":u?"70%":"60%",className:(0,Ie.xW)("flex h-3/5 w-full flex-shrink-0 tablet:h-full tablet:w-3/5")},void 0,(0,i.A)("div",{className:"flex h-full w-full flex-col"},void 0,(0,i.A)(l.A,{renderForPdf:u,readOnly:h,onClickPlay:function(){return E.toggleExecution()},isExecuting:E.isExecuting,canExecute:T}),(0,i.A)("div",{className:"flex h-full w-full flex-col overflow-auto"},void 0,v&&(0,i.A)("div",{className:"editors-tab-bg w-full border-b border-gray-300"},void 0,(0,i.A)("div",{className:"editors-tab w-full"},void 0,(0,i.A)(Xe.A,{tab:{id:d("msg.initial_content.code"),open:"initial"===C},setOpen:function(){return M("initial")}}),(0,i.A)(Xe.A,{tab:{id:d("msg.solution"),open:"solution"===C},setOpen:function(){return M("solution")}}))),(0,i.A)(c.default,{mode:k.progLang,renderForPdf:u,className:"h-full w-full",initialContent:"initial"===C?n:k.solution,handleChange:function(e,t){E&&(E.contentRef.current=e),t||(v?(k["solution"===C?"solution":"initialCode"]=e,y()):m&&(m.data.code=e,g(m),S()))},readOnly:h},C)))),(0,i.A)("div",{className:"flex h-3/5 flex-grow flex-col tablet:h-full"},void 0,(0,i.A)(Oe.A,{maxHeight:"100%",minHeight:"0%",initialHeight:"70%",yAxis:!0,className:"relative h-3/5 w-full",id:"simulation-row"},void 0,(0,i.A)("div",{className:"flex h-full flex-col"},void 0,E&&k.layout&&(0,i.A)(ke,{id:k.id,init:function(e){var t;E.playgroundRef.current.init(e),E.playgroundRef.current.loadChallengeLayout(null!==(t=null==k?void 0:k.layout)&&void 0!==t?t:"[]"),E.stop(),j(!0)},onChange:function(e){var t=E.playgroundRef.current.saveLayout(e);t?(k.layout=t,y()):F.error(d("msg.error.saving"))},stopExecution:function(){return E.toggleExecution()},setShowConfetti:function(e){return w(e)}}))),(0,i.A)("div",{className:"z-10 mt-3 h-2/5 flex-1 overflow-hidden"},void 0,(0,i.A)(Ve.default,{showPltView:!1,cmdRef:B}))))):Ue||(Ue=(0,i.A)(Se.xx,{}))});const Ye=qe},99282(e,t,n){n.r(t),n.d(t,{Road:()=>d});var i=n(23029),o=n(92901),a=n(56822),s=n(53954),r=n(85501),l=n(64467);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function u(e,t,n){return t=(0,s.A)(t),(0,a.A)(e,h()?Reflect.construct(t,n||[],(0,s.A)(e).constructor):t.apply(e,n))}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(h=function(){return!!e})()}var d=function(e){function t(e,n){var o;(0,i.A)(this,t);for(var a=arguments.length,s=new Array(a>2?a-2:0),r=2;r<a;r++)s[r-2]=arguments[r];return o=u(this,t,[e].concat(s)),(0,l.A)(o,"shapeType","Road"),(0,l.A)(o,"templateName",void 0),(0,l.A)(o,"minimumSize",void 0),(0,l.A)(o,"frictionCoef",void 0),(0,l.A)(o,"defaultTemplate","base"),(0,l.A)(o,"templates",{base:{frictionCoef:.935,minimumSize:150},path:{frictionCoef:.935,minimumSize:75}}),o.class="Road",o.templateName=n,o.carInteraction=!0,o.minimumSize=150,o}return(0,r.A)(t,e),(0,o.A)(t,[{key:"editShape",value:function(){var e=this.spawnImageBox();this.spawnRotateBox(e),this.spawnMiddleEditBoxes(e);var t,n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];
1if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,o=function(){};return{s:o,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,r=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){r=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(r)throw a}}}}(e.children);try{for(n.s();!(t=n.n()).done;)t.value.setupEditBox()}catch(e){n.e(e)}finally{n.f()}e.rotate(this.rotation.x,e.parent.middle)}},{key:"spawnMiddleEditBoxes",value:function(e){if(!(Math.round(this.getHeight())>this.minimumSize)){var t=this.s.spawnRect(-e.getWidth()/2,0,this.s.editBoxSize,this.s.editBoxSize,350);t.cursor="w-resize",e.addChild(t,!0);var n=this.s.spawnRect(e.getWidth()/2,0,this.s.editBoxSize,this.s.editBoxSize,350);n.cursor="e-resize",e.addChild(n,!0)}if(!(Math.round(this.getWidth())>this.minimumSize)){var i=this.s.spawnRect(0,e.getHeight()/2,this.s.editBoxSize,this.s.editBoxSize,350);i.cursor="n-resize",e.addChild(i,!0);var o=this.s.spawnRect(0,-e.getHeight()/2,this.s.editBoxSize,this.s.editBoxSize,350);o.cursor="s-resize",e.addChild(o,!0)}}},{key:"uniqueProperties",get:function(){return{}}},{key:"loadFromTemplate",value:function(){Object.assign(this,this.templates[this.templateName])}}])}(n(80821).y)}}]);
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.