(function(t){function e(e){for(var i,a,r=e[0],c=e[1],u=e[2],d=0,m=[];d.5?{text:"".concat(e," - ").concat(n),answer:e-n}:{text:"-".concat(e," + ").concat(n),answer:-e+n}},multiplication:function(t){var e=g.methods.getRandomInt(t.low,t.high),n=g.methods.getRandomInt(t.low,t.high);return{text:"".concat(e," \\times ").concat(n),answer:e*n}},division:function(t){var e=g.methods.getRandomInt(t.low,t.high),n=g.methods.getRandomInt(t.low,t.high);return{text:"".concat(e*n," \\div ").concat(n),answer:e}},square_root:function(t){var e=g.methods.getRandomInt(t.low,t.high);return{text:"\\sqrt{".concat(e*e,"}"),answer:e}}},data:function(){var t=this;return{problems:[{name:"Addition",id:"addition",description:"Find the sum of two integers",difficulties:[{id:"easy",name:"Easy",options:{low:7,high:50},style:"is-success"},{id:"medium",name:"Medium",options:{low:30,high:100},style:"is-warning"},{id:"hard",name:"Hard",options:{low:50,high:200},style:"is-danger"}],method:t.methods.addition,enabled:!0,current:0},{name:"Subtraction",id:"subtraction",description:"Evaluate the difference between two integers.",difficulties:[{id:"easy",name:"Easy",options:{low:7,high:50},style:"is-success"},{id:"medium",name:"Medium",options:{low:20,high:80},style:"is-warning"},{id:"hard",name:"Hard",options:{low:40,high:110},style:"is-danger"}],method:t.methods.subtraction,enabled:!0,current:0},{name:"Multiplication",id:"multiplication",description:"Evaluate the product of two integers.",difficulties:[{id:"easy",name:"Easy",options:{low:5,high:35},style:"is-success"},{id:"medium",name:"Medium",options:{low:8,high:50},style:"is-warning"},{id:"hard",name:"Hard",options:{low:15,high:95},style:"is-danger"}],method:t.methods.multiplication,enabled:!0,current:0},{name:"Division",id:"division",description:"Divide one integer by another to get a third integer.",difficulties:[{id:"easy",name:"Easy",options:{low:5,high:35},style:"is-success"},{id:"medium",name:"Medium",options:{low:8,high:50},style:"is-warning"},{id:"hard",name:"Hard",options:{low:15,high:95},style:"is-danger"}],method:t.methods.division,enabled:!0,current:0},{name:"Square Root",id:"square_root",description:"Find the square root of a given integer.",difficulties:[{id:"easy",name:"Easy",options:{low:4,high:20},style:"is-success"},{id:"medium",name:"Medium",options:{low:13,high:30},style:"is-warning"},{id:"hard",name:"Hard",options:{low:19,high:60},style:"is-danger"}],method:t.methods.square_root,enabled:!0,current:0}]}}},v={computed:{availableProblems:function(){return this.problems.filter((function(t){return t.enabled}))}},methods:{getProblem:function(){for(var t=this.availableProblems[g.methods.getRandomInt(0,this.availableProblems.length)],e=null,n=0;n<5;n++)if(e=t.method(t.difficulties[t.current].options),null==this.previousProblem||e.text!==this.previousProblem.text)break;return this.previousProblem=e,e}},data:function(){return{previousProblem:null,problems:w.data().problems}}},y=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"modal-card"},[n("header",{staticClass:"modal-card-head"},[n("p",{staticClass:"modal-card-title"},[t._v("Settings")]),n("b-icon",{staticClass:"is-clickable",attrs:{pack:"fas",icon:"times"},nativeOn:{click:function(e){return t.$parent.close()}}})],1),n("section",{staticClass:"modal-card-body"},t._l(t.problems,(function(e,i){return n("b-field",{key:e.id,staticClass:"is-flex mb-1",attrs:{addons:""}},[n("p",{staticClass:"control is-flex-grow-0",staticStyle:{"min-width":"150px"}},[n("b-button",{staticClass:"button-unhoverable is-block darker w-100",staticStyle:{cursor:"default"},attrs:{hovered:!1}},[t._v(" "+t._s(e.name)+" ")])],1),n("p",{staticClass:"control is-flex-grow-2"},[n("b-button",{staticClass:"w-100",attrs:{type:e.enabled?"":"is-info",selected:!e.enabled},on:{click:function(e){return t.disableProblem(i)}}},[t._v(" Off ")])],1),t._l(e.difficulties,(function(s,o){return n("p",{key:s.id,staticClass:"control is-flex-grow-2"},[n("b-tooltip",{staticClass:"w-100",attrs:{type:"is-dark",animated:!1},scopedSlots:t._u([{key:"content",fn:function(){return[n("katex-element",{attrs:{expression:t.getExample(i,o)}})]},proxy:!0}],null,!0)},[n("b-button",{staticClass:"w-100",attrs:{type:e.enabled&&e.current===o?s.style||"is-info":"",selected:e.enabled&&e.current===o},nativeOn:{click:function(e){return t.selectProblemDifficulty(i,o)}}},[t._v(" "+t._s(s.name)+" ")])],1)],1)}))],2)})),1)])},x=[],k={name:"SettingsMenu",props:{problems:v},methods:{selectProblemDifficulty:function(t,e){this.problems[t].enabled=!0,this.problems[t].current=e},disableProblem:function(t){this.problems[t].enabled=!1},getExample:function(t,e){var n=this.problems[t];return n.method(n.difficulties[e].options).text}}},_=k,C=n("2877"),I=Object(C["a"])(_,y,x,!1,null,null,null),S=I.exports,M={name:"App",mixins:[v],components:{SettingsMenu:S},data:function(){return{answer:null,currentQuestion:null,correctTimeout:!1,inputClass:"",allowInputSubmit:!0,currentAnimation:"",chances:3,isSettingsMenuActive:!1}},computed:{expression:function(){return null!=this.currentQuestion?this.currentQuestion.text:"error"}},created:function(){var t=this;window.addEventListener("keyup",(function(e){38===e.keyCode?t.nextQuestion():39===e.keyCode&&t.checkAnswer(!0)}))},mounted:function(){var t=this;this.$nextTick((function(){t.nextQuestion()}))},methods:{nextQuestion:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.getProblem();null==this.currentQuestion?this.currentQuestion=n:(this.currentAnimation=e?"animate__fadeOutRight":"animate__fadeOutUp",setTimeout((function(){t.currentQuestion=n,t.currentAnimation="animate__fadeInDown",setTimeout((function(){t.currentAnimation=""}),500)}),200))},checkAnswer:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(this.allowInputSubmit||e)&&(t="number"===typeof this.currentQuestion.answer?this.currentQuestion.answer===Number.parseInt(this.answer):this.currentQuestion.answer===this.answer,t||e?(this.inputClass="correct",setTimeout(this.clearInputClass,500),this.nextQuestion(),this.answer=""):(0===--this.chances&&(this.nextQuestion(!0),this.chances=3),this.inputClass="incorrect",setTimeout(this.clearInputClass,500),this.allowInputSubmit=!1,setTimeout(this.unlockInput,500)))},clearInputClass:function(){this.inputClass=""},unlockInput:function(){this.allowInputSubmit=!0}}},O=M,P=(n("5c0b"),Object(C["a"])(O,f,b,!1,null,null,null)),A=P.exports;n("be0f"),n("432b"),n("4b3c");i["a"].config.productionTip=!1,m["c"].add(h["a"],h["b"]),i["a"].component("vue-fontawesome",p["a"]),i["a"].use(o["a"]),i["a"].use(a["a"]),i["a"].use(r["a"]),i["a"].use(c["a"]),i["a"].use(u["a"]),i["a"].use(l["a"]),d["a"].setOptions({defaultIconComponent:"vue-fontawesome",defaultIconPack:"fas"}),i["a"].use(s["a"]),new i["a"]({render:function(t){return t(A)}}).$mount("#app")},"5c0b":function(t,e,n){"use strict";var i=n("9c0c"),s=n.n(i);s.a},"9c0c":function(t,e,n){}}); //# sourceMappingURL=app.aa8bf807.js.map