text: !function(e){function t(t){for(var n,c,u=t[0],i=t[1],l=t[2],f=0,p=[];f<u.length;f++)c=u[f],Object.prototype.hasOwnProperty.call(a,c)&&a[c]&&p.push(a[c][0]),a[c]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(s&&s(t);p.length;)p.shift()();return o.push.apply(o,l||[]),r()}function r(){for(var e,t=0;t<o.length;t++){for(var r=o[t],n=!0,u=1;u<r.length;u++){var i=r[u];0!==a[i]&&(n=!1)}n&&(o.splice(t--,1),e=c(c.s=r[0]))}return e}var n={},a={0:0},o=[];function c(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,c),r.l=!0,r.exports}c.m=e,c.c=n,c.d=function(e,t,r){c.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},c.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.t=function(e,t){if(1&t&&(e=c(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(c.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)c.d(r,n,function(t){return e[t]}.bind(null,n));return r},c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,"a",t),t},c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.p="/";var u=window.webpackJsonp=window.webpackJsonp||[],i=u.push.bind(u);u.push=t,u=u.slice();for(var l=0;l<u.length;l++)t(u[l]);var s=i;o.push([441,2,1,3]),r()}({427:function(e,t,r){var n=r(71),a=r(428);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.i,a,""]]);var o={insert:"head",singleton:!1};n(a,o);e.exports=a.locals||{}},428:function(e,t,r){},433:function(e,t,r){var n=r(71),a=r(434);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.i,a,""]]);var o={insert:"head",singleton:!1};n(a,o);e.exports=a.locals||{}},434:function(e,t,r){},435:function(e,t,r){var n=r(71),a=r(436);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.i,a,""]]);var o={insert:"head",singleton:!1};n(a,o);e.exports=a.locals||{}},436:function(e,t,r){},437:function(e,t,r){var n=r(71),a=r(438);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.i,a,""]]);var o={insert:"head",singleton:!1};n(a,o);e.exports=a.locals||{}},438:function(e,t,r){},439:function(e,t,r){var n=r(71),a=r(440);"string"==typeof(a=a.__esModule?a.default:a)&&(a=[[e.i,a,""]]);var o={insert:"head",singleton:!1};n(a,o);e.exports=a.locals||{}},440:function(e,t,r){},441:function(e,t,r){"use strict";r.r(t);var n=r(1),a=r.n(n),o=r(177),c=r(73),u=r(13),i=r(51),l=r.n(i);function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var f={menu:function(e){return a.a.createElement("svg",s({},e,{viewBox:"0 0 100 80"}),a.a.createElement("rect",{width:"100",height:"20"}),a.a.createElement("rect",{y:"30",width:"100",height:"20"}),a.a.createElement("rect",{y:"60",width:"100",height:"20"}))}},p=r(178),d=r.n(p).a.create({baseURL:"/api"});function m(e){return function(e){if(Array.isArray(e))return g(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||h(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t,r,n,a,o,c){try{var u=e[o](c),i=u.value}catch(e){return void r(e)}u.done?t(i):Promise.resolve(i).then(n,a)}function v(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function c(e){b(o,n,a,c,u,"next",e)}function u(e){b(o,n,a,c,u,"throw",e)}c(void 0)}))}}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var c,u=e[Symbol.iterator]();!(n=(c=u.next()).done)&&(r.push(c.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}(e,t)||h(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){if(e){if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var k=a.a.createContext({todos:[],buckets:[]}),w=function(){return Object(n.useContext)(k)};function O(e){var t=e.children,r=y(Object(n.useState)([]),2),o=r[0],c=r[1],u=y(Object(n.useState)([]),2),i=u[0],l=u[1];Object(n.useEffect)((function(){(function(){var e=v(regeneratorRuntime.mark((function e(){var t,r,n,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Promise.all([d.get("/todo"),d.get("/bucket")]);case 3:t=e.sent,r=y(t,2),n=r[0],a=r[1],c(n.data),l(a.data),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),console.log(e.t0);case 14:case"end":return e.stop()}}),e,null,[[0,11]])})));return function(){return e.apply(this,arguments)}})()()}),[]);var s=Object(n.useCallback)(function(){var e=v(regeneratorRuntime.mark((function e(t,r){var n,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,d.post("/todo",{description:t,bucket:r});case 3:n=e.sent,a=n.data,c((function(e){return[].concat(m(e),[a])})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),console.log(e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t,r){return e.apply(this,arguments)}}(),[c]),f=Object(n.useCallback)(function(){var e=v(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,d.put("/todo",t);case 3:r=e.sent,n=r.data,c((function(e){return e.map((function(e){return e.id===n.id?n:e}))})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),console.log(e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t){return e.apply(this,arguments)}}(),[c]),p=Object(n.useCallback)(function(){var e=v(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,d.delete("/todo",{params:{id:t}});case 3:c((function(e){return e.filter((function(e){return e.id!==t}))})),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.log(e.t0);case 9:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t){return e.apply(this,arguments)}}(),[c]),b=Object(n.useCallback)(function(){var e=v(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,d.post("/bucket",{name:t});case 3:r=e.sent,n=r.data,l((function(e){return[].concat(m(e),[n])})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),console.log(e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t){return e.apply(this,arguments)}}(),[l]),h=Object(n.useCallback)(function(){var e=v(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,d.delete("/bucket",{params:{name:t}});case 3:l((function(e){return e.filter((function(e){return e.name!==t}))})),c((function(e){return e.map((function(e){return e.bucket===t&&(e.bucket=null),e}))})),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.log(e.t0);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}(),[l,c]);return a.a.createElement(k.Provider,{value:{todos:o,buckets:i,addTodo:s,updateTodo:f,deleteTodo:p,addBucket:b,deleteBucket:h}},t)}r(427);function j(e,t,r,n,a,o,c){try{var u=e[o](c),i=u.value}catch(e){return void r(e)}u.done?t(i):Promise.resolve(i).then(n,a)}function x(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function c(e){j(o,n,a,c,u,"next",e)}function u(e){j(o,n,a,c,u,"throw",e)}c(void 0)}))}}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var c,u=e[Symbol.iterator]();!(n=(c=u.next()).done)&&(r.push(c.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return S(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return S(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var P=function(){var e="buckets-wrapper",t="buckets-wrapper-hidden",r="buckets-menu",o="buckets-menu-right",i="buckets-title",s="buckets-input_wrapper",p="buckets-input",d="buckets-button",m="buckets-button-link",b="buckets-button-active",v="buckets-button2",y="buckets-delete",h=E(Object(n.useState)(""),2),g=h[0],k=h[1],O=E(Object(n.useState)(!1),2),j=O[0],S=O[1],P=w(),C=P.buckets,A=P.addBucket,_=P.deleteBucket,N=Object(u.e)().search,R=Object(u.d)(),T=Object(n.useMemo)((function(){return new URLSearchParams(N).get("bucket")}),[N]),M=Object(n.useCallback)(x(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(g.trim()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,A(g);case 4:k("");case 5:case"end":return e.stop()}}),e)}))),[g,k,A]),I=Object(n.useCallback)((function(e){13===(e.keyCode||e.which)&&M()}),[M]),D=Object(n.useCallback)(function(){var e=x(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_(t);case 2:T===t&&R.replace("/");case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[_,T,R]);return a.a.createElement(a.a.Fragment,null,f.menu({className:l()(r,j?o:""),onClick:function(){return S((function(e){return!e}))}}),a.a.createElement("div",{className:l()(e,j?"":t)},a.a.createElement("h1",{className:i},"To-Do App"),a.a.createElement("div",{className:s},a.a.createElement("input",{className:p,type:"text",placeholder:"Bucket name",maxLength:24,value:g,onChange:function(e){var t=e.target;return k(t.value)},onKeyPress:I}),a.a.createElement("button",{className:v,onClick:M},"Create Bucket")),a.a.createElement("div",{className:l()(d,T?"":b)},a.a.createElement(c.b,{className:m,to:"/"},"All")),C.map((function(e){return a.a.createElement("div",{className:l()(d,T!==e.name?"":b),key:e.name},a.a.createElement(c.b,{className:m,to:{pathname:"/",search:"?bucket=".concat(e.name)}},e.name),a.a.createElement("button",{onClick:function(){return D(e.name)},className:y},"X"))}))))};r(433);function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function A(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?C(Object(r),!0).forEach((function(t){_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var N=function(e){var t=e.todo,r="todo-wrapper",o="todo-flex",c="todo-check",u="todo-text",i="todo-text-done",s="todo-delete",f=w(),p=f.updateTodo,d=f.deleteTodo,m=Object(n.useCallback)((function(e){var r=e.target;return p(A(A({},t),{},{done:r.checked}))}),[p]);return a.a.createElement("div",{className:r},a.a.createElement("div",{className:o},a.a.createElement("input",{className:c,type:"checkbox",checked:t.done,onChange:m}),a.a.createElement("p",{className:l()(u,t.done?i:"")},t.description)),a.a.createElement("button",{className:s,onClick:function(){return d(t.id)},title:"Delete To-Do"},"X"))};r(435);function R(e,t,r,n,a,o,c){try{var u=e[o](c),i=u.value}catch(e){return void r(e)}u.done?t(i):Promise.resolve(i).then(n,a)}function T(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function c(e){R(o,n,a,c,u,"next",e)}function u(e){R(o,n,a,c,u,"throw",e)}c(void 0)}))}}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,a=!1,o=void 0;try{for(var c,u=e[Symbol.iterator]();!(n=(c=u.next()).done)&&(r.push(c.value),!t||r.length!==t);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(a)throw o}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return I(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return I(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var D=function(){var e="todo_list-wrapper",t="todo_list-input_wrapper",r="todo_list-input",o="todo_list-button",c="todo_list-items",i=M(Object(n.useState)(""),2),l=i[0],s=i[1],f=w(),p=f.todos,d=f.addTodo,m=Object(u.e)().search,b=Object(n.useMemo)((function(){return new URLSearchParams(m).get("bucket")}),[m]),v=Object(n.useCallback)(T(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l.trim()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,d(l,b);case 4:s("");case 5:case"end":return e.stop()}}),e)}))),[l,s,d,b]),y=Object(n.useCallback)((function(e){13===(e.keyCode||e.which)&&v()}),[v]);return a.a.createElement("div",{className:e},a.a.createElement("div",{className:t},a.a.createElement("input",{className:r,type:"text",placeholder:"To-Do description",value:l,onChange:function(e){var t=e.target;return s(t.value)},onKeyPress:y}),a.a.createElement("button",{className:o,onClick:v},"Create To-Do ",b?"in ".concat(b):"")),a.a.createElement("div",{className:c},a.a.createElement("div",null,p.map((function(e){if(!b||e.bucket===b)return a.a.createElement(N,{key:e.id,todo:e})})))))};r(437);var B=function(){return a.a.createElement("div",{"data-testid":"app",className:"app-wrapper"},a.a.createElement(P,null),a.a.createElement(D,null))};r(439);Object(o.render)(a.a.createElement(c.a,null,a.a.createElement(O,null,a.a.createElement(B,null))),document.getElementById("root"))}});