text: (function(t){function e(e){for(var a,r,s=e[0],l=e[1],u=e[2],h=0,d=[];h<s.length;h++)r=s[h],i[r]&&d.push(i[r][0]),i[r]=0;for(a in l)Object.prototype.hasOwnProperty.call(l,a)&&(t[a]=l[a]);c&&c(e);while(d.length)d.shift()();return o.push.apply(o,u||[]),n()}function n(){for(var t,e=0;e<o.length;e++){for(var n=o[e],a=!0,s=1;s<n.length;s++){var l=n[s];0!==i[l]&&(a=!1)}a&&(o.splice(e--,1),t=r(r.s=n[0]))}return t}var a={},i={app:0},o=[];function r(e){if(a[e])return a[e].exports;var n=a[e]={i:e,l:!1,exports:{}};return t[e].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=t,r.c=a,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/infinitebuttons/";var s=window["webpackJsonp"]=window["webpackJsonp"]||[],l=s.push.bind(s);s.push=e,s=s.slice();for(var u=0;u<s.length;u++)e(s[u]);var c=l;o.push([0,"chunk-vendors"]),n()})({0:function(t,e,n){t.exports=n("56d7")},"034f":function(t,e,n){"use strict";var a=n("64a9"),i=n.n(a);i.a},"3f8f":function(t,e,n){},"56d7":function(t,e,n){"use strict";n.r(e);var a=n("2b0e"),i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{attrs:{id:"app"}},[n("ul",{staticClass:"mainMenu"},[n("li",{on:{click:t.save}},[t._v("Guardar")]),n("li",{on:{click:t.load}},[t._v("Cargar")])]),n("p",{staticClass:"available"},[t._v("Disponible: "+t._s(t.available))]),n("button",{attrs:{id:"buyButton",disabled:t.canBuyNewButton()},on:{click:t.buyNewButton}},[t._v("Nuevo botón - Coste: "+t._s(t.newButtonCost))]),t._l(t.buttons,function(e){return n("Button",{key:e,attrs:{number:e,available:t.available},on:{incrementAvailable:t.incrementAvailable}})}),n("input",{attrs:{type:"hidden",id:"shareText"}})],2)},o=[],r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"buttonContainer"},[n("button",{staticClass:"workerButton",class:t.maxed?"maxed":"",attrs:{level:t.level,disabled:t.canUpgrade()},on:{click:t.upgrade}},[t._v(t._s(t.label))]),n("div",{staticClass:"increment"},[t._v("Incremento: +"+t._s(t.increment)+"/s")])])},s=[],l={name:"Button",props:{available:Number,number:Number},data:()=>{return{level:1,cost:.005,startTick:null,timer:null,increment:.001,maxed:!1,maxLevel:100}},computed:{label(){return this.maxed?`Nivel ${this.level} - Máximo`:`Nivel: ${this.level} - Precio mejora: ${this.cost}`}},methods:{canUpgrade(){return this.maxed||parseFloat(this.cost)>=parseFloat(this.available)},upgrade(){this.maxed||(this.level++,this.$emit("incrementAvailable",-1*this.cost),this.level>=this.maxLevel?this.maxed=!0:(this.cost*=1.3,this.increment*=1.2))},start(){this.startTick=Date.now(),this.timer=setTimeout(()=>{this.$emit("incrementAvailable",this.increment),this.start()},1e3)}},mounted(){this.increment*=this.number,this.cost*=this.number,this.start()},beforeDestroy(){clearTimeout(this.timer)}},u=l,c=(n("63d7"),n("2877")),h=Object(c["a"])(u,r,s,!1,null,"7c208c6c",null),d=h.exports,m={name:"app",components:{Button:d},data:()=>{return{available:0,buttons:1,newButtonCost:.05}},methods:{incrementAvailable(t){this.available+=parseFloat(t,10)},buyNewButton(){this.buttons++,this.available-=this.newButtonCost,this.newButtonCost*=1.5*this.buttons},canBuyNewButton(){return this.newButtonCost>=this.available},getButtonsLevel(){return[...document.querySelectorAll(".workerButton")].map(t=>t.getAttribute("level")).join(", ")},copyToShare(){let t=document.querySelector("#shareText");t.setAttribute("type","text"),t.select();try{document.execCommand("copy");alert("¡Copiado al portapapeles!")}catch(e){alert("Jo, no se ha podido copiar al portapapeles :(")}t.setAttribute("type","hidden"),window.getSelection().removeAllRanges()},share(){let t=`\n  Tengo disponible: ${this.available}.\n  Tengo ${this.buttons} botones.\n  Los niveles de mis botones son: ${this.getButtonsLevel()}\n      `;document.querySelector("#shareText").value=t,this.copyToShare()},save(){const t=this.$children.map(t=>{return{level:t.level,cost:t.cost,increment:t.increment,maxed:t.maxed,maxLevel:t.maxLevel}}),e={available:this.available,newButtonCost:this.newButtonCost,buttons:this.buttons,buttonsData:t};localStorage.setItem("infiniteincremental-save",JSON.stringify(e))},load(){let t=localStorage.getItem("infiniteincremental-save");t&&(t=JSON.parse(t),this.available=t.available,this.buttons=t.buttons,this.newButtonCost=t.newButtonCost,t.buttonsData.forEach((t,e)=>{this.$children[e].level=t.level,this.$children[e].cost=t.cost,this.$children[e].increment=t.increment,this.$children[e].maxed=t.maxed,this.$children[e].maxLevel=t.maxLevel}))}},mounted(){this.load()}},v=m,b=(n("034f"),Object(c["a"])(v,i,o,!1,null,null,null)),p=b.exports;a["a"].config.productionTip=!1,new a["a"]({render:function(t){return t(p)}}).$mount("#app")},"63d7":function(t,e,n){"use strict";var a=n("3f8f"),i=n.n(a);i.a},"64a9":function(t,e,n){}});
  //# sourceMappingURL=app.2314432a.js.map