(function(e){function t(t){for(var a,o,s=t[0],c=t[1],u=t[2],d=0,m=[];d0){var v=m.map((function(e){return e[0].toLowerCase()}));for(var f in v.forEach((function(e){s[e]=s[e]+1||1})),s)s[f]>c&&(c=s[f],u=t.indexOf(f));r.meat=u}p.length>0?r.mealtype=2:r.mealtype=1,this.updateRecipe(r)}}),created:function(){this.debouncedGetPastedtTitle=$()(this.getPastedTitle,500)},watch:{editMode:function(e){!0===e&&window.scrollTo(0,0)}}},F=N,T=Object(m["a"])(F,k,M,!1,null,"c30c324e",null),S=T.exports,B=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"container"},[r("div",{staticClass:"filterBar grid-4"},[r("select",{on:{change:function(t){return e.updateFilter(t)}}},[r("option",{attrs:{value:"0"}},[e._v("All")]),r("option",{attrs:{value:"1"}},[e._v("Chicken")]),r("option",{attrs:{value:"2"}},[e._v("Beef")]),r("option",{attrs:{value:"3"}},[e._v("Pork")]),r("option",{attrs:{value:"4"}},[e._v("Fish")]),r("option",{attrs:{value:"5"}},[e._v("Egg")]),r("option",{attrs:{value:"6"}},[e._v("Vegetable")])])])])},A=[],q={name:"FilterBar",methods:Object(c["a"])({},Object(u["b"])(["updateFilter"]))},V=q,D=Object(m["a"])(V,B,A,!1,null,"396df403",null),H=D.exports,G={name:"App",data:function(){return{}},components:{Header:v,Editor:S,FilterBar:H,Recipes:C},methods:{}},J=G,L=(r("034f"),Object(m["a"])(J,n,i,!1,null,null,null)),U=L.exports,z=(r("99af"),r("4de4"),r("96cf"),r("1da1")),K=r("bc3a"),Q=r.n(K),W="https://menu.silvrtree.co.uk/recipes",X={recipes:[],currentItem:{name:"",url:"",md:"",meat:"",mealtype:"",_id:"",short:"",hash:"",lastused:""},editMode:!1,filterMode:0},Y={allRecipes:function(e){var t=e.recipes.filter((function(t){return 0===parseInt(e.filterMode,10)||t.meat===parseInt(e.filterMode,10)}));return t.sort((function(e,t){var r=e.short,a=t.short;return ra?1:0}))},editorItem:function(e){return e.currentItem},editMode:function(e){return e.editMode},filterMode:function(e){return e.filterMode}},Z={fetchRecipes:function(e){var t=e.commit;return Object(z["a"])(regeneratorRuntime.mark((function e(){var r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Q.a.get(W);case 2:r=e.sent,t("setRecipes",r.data);case 4:case"end":return e.stop()}}),e)})))()},editRecipe:function(e,t){var r=e.commit;return Object(z["a"])(regeneratorRuntime.mark((function e(){var a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Q.a.get("".concat(W,"/").concat(t));case 2:a=e.sent,r("setCurrentItem",a.data),r("setEditMode",!0);case 5:case"end":return e.stop()}}),e)})))()},newRecipe:function(e){var t=e.commit;return Object(z["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:t("setCurrentItem",{name:"",url:"",md:"",meat:"",mealtype:"",_id:"",short:"",hash:"",lastused:""}),t("setEditMode",!0);case 2:case"end":return e.stop()}}),e)})))()},closeEditor:function(e){var t=e.commit;return Object(z["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:t("setCurrentItem",{name:"",url:"",md:"",meat:"",mealtype:"",_id:"",short:"",hash:"",lastused:""}),t("setEditMode",!1);case 2:case"end":return e.stop()}}),e)})))()},saveRecipe:function(e,t){var r=e.commit;return Object(z["a"])(regeneratorRuntime.mark((function e(){var a,n,i;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(a=Object(c["a"])({},t),""!==a.hash){e.next=8;break}return console.log("Create new"),e.next=5,Q.a.post("".concat(W),a);case 5:n=e.sent,e.next=12;break;case 8:return console.log("Update existing"),e.next=11,Q.a.put("".concat(W,"/").concat(a.hash),a);case 11:n=e.sent;case 12:if(!(n.data.changes>0||"Row inserted"===n.data.msg)){e.next=19;break}return r("setEditMode",!1),r("setCurrentItem",{name:"",url:"",md:"",meat:"",mealtype:"",_id:"",short:"",hash:"",lastused:""}),e.next=17,Q.a.get(W);case 17:i=e.sent,r("setRecipes",i.data);case 19:case"end":return e.stop()}}),e)})))()},updateFilter:function(e,t){var r=e.commit;return Object(z["a"])(regeneratorRuntime.mark((function e(){var a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:a=t.target.value,r("setFilter",a);case 2:case"end":return e.stop()}}),e)})))()},updateRecipe:function(e,t){var r=e.commit;return Object(z["a"])(regeneratorRuntime.mark((function e(){var a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:a=Object.assign({},X.currentItem,t),r("setCurrentItem",a);case 2:case"end":return e.stop()}}),e)})))()}},ee={setRecipes:function(e,t){return e.recipes=t},setCurrentItem:function(e,t){return e.currentItem=t},setEditMode:function(e,t){return e.editMode=t},setFilter:function(e,t){return e.filterMode=t}},te={state:X,getters:Y,actions:Z,mutations:ee};a["a"].use(u["a"]);var re=new u["a"].Store({state:{},mutations:{},actions:{},modules:{recipes:te}});a["a"].config.productionTip=!1,new a["a"]({store:re,render:function(e){return e(U)}}).$mount("#app")},"7c6d":function(e,t,r){},"85ec":function(e,t,r){},ae56:function(e,t,r){"use strict";var a=r("7c6d"),n=r.n(a);n.a}}); //# sourceMappingURL=app.2b970c62.js.map