(this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{161:function(t,e,n){},163:function(t,e,n){},261:function(t,e,n){"use strict";n.r(e);var r=n(0),a=n(24),c=n.n(a),s=(n(161),n(162),n(163),n(81)),u=n(25),i=n(15),o=n.n(i),l=n(27),p=n(41),j=n(152),b=n(266),f=n(263),h=n(40),d=n(90),O=n(61),x=n.n(O),m=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.post("/api/clients",e);case 2:return n=t.sent,t.abrupt("return",n.data.client_id);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),v=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.get("/api/clients/".concat(e));case 2:return n=t.sent,t.abrupt("return",n.data);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),g=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.post("/api/clients/".concat(e,"/session"));case 2:return n=t.sent,t.abrupt("return",n.data);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),w=function(){var t=Object(l.a)(o.a.mark((function t(e){var n;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.get("/api/clients/".concat(e,"/session"));case 2:return n=t.sent,t.abrupt("return",n.data);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),k=function(){var t=Object(l.a)(o.a.mark((function t(e){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x.a.delete("/api/clients/".concat(e,"/session"));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),y=function(){var t=Object(l.a)(o.a.mark((function t(e){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,k(e);case 2:return t.next=4,g(e);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),C=n(8),S=function(){var t=Object(u.f)(),e=Object(r.useState)(null),n=Object(p.a)(e,2),a=n[0],c=n[1],s=Object(r.useState)(""),i=Object(p.a)(s,2),O=i[0],x=i[1],v=Object(r.useState)(""),g=Object(p.a)(v,2),w=g[0],k=g[1],y=Object(r.useState)(""),S=Object(p.a)(y,2),I=S[0],F=S[1],N=function(){var e=Object(l.a)(o.a.mark((function e(n){var r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.preventDefault(),!(I.length<10)){e.next=5;break}return j.b.error("Check all fields!"),c("Phone number needs to be a length of at least 10"),e.abrupt("return");case 5:return e.next=7,m({name:O,email:w,phone:parseInt(I)});case 7:r=e.sent,t.push("/sessions/".concat(r));case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return Object(C.jsxs)(d.Content,{children:[Object(C.jsx)(b.a,{title:"Dashboard",subTitle:"Enter the name, email and phone number of the subject"}),Object(C.jsx)(f.a,{}),Object(C.jsxs)("form",{onSubmit:N,children:[Object(C.jsxs)("label",{htmlFor:"name",children:["Name:",Object(C.jsx)("input",{minLength:3,value:O,onChange:function(t){return x(t.target.value)},name:"name"})]}),Object(C.jsxs)("label",{htmlFor:"email",children:["Email:",Object(C.jsx)("input",{value:w,onChange:function(t){return k(t.target.value)},type:"email",name:"email"})]}),Object(C.jsxs)("label",{htmlFor:"phone",children:["Phone:",Object(C.jsx)("input",{value:I,onChange:function(t){return F(t.target.value)},type:"tel",name:"phone"})]}),Object(C.jsx)(h.a,{danger:!0,onClick:function(){x(""),k(""),F("")},children:"Reset"}),Object(C.jsx)(h.a,{htmlType:"submit",type:"primary",children:"Start Session"}),a&&Object(C.jsx)("p",{className:"error",children:a})]})]})},I=n(268),F=n(267),N=n(264),P=function(t){var e=t.clientId,n=Object(r.useState)(null),a=Object(p.a)(n,2),c=a[0],s=a[1],u=Object(r.useState)(null),i=Object(p.a)(u,2),j=i[0],f=i[1],h=Object(r.useState)(!0),d=Object(p.a)(h,2),O=(d[0],d[1]);Object(r.useEffect)((function(){var t=setInterval(function(){var t=Object(l.a)(o.a.mark((function t(){var n,r;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(c&&c.length>=178)){t.next=3;break}return O(!1),t.abrupt("return");case 3:return t.next=5,w(e);case 5:n=t.sent,(r=n.photos).length&&s(r);case 8:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),250);return function(){return clearInterval(t)}}),[e,c]);var x=function(){return f(null)};return(null===c||void 0===c?void 0:c.length)?Object(C.jsxs)(C.Fragment,{children:[Object(C.jsx)(I.a,{visible:!!j,onOk:x,cancelText:null,onCancel:x,width:"50%",children:Object(C.jsx)("img",{width:"100%",onClick:x,src:"".concat("","/output/").concat(e,"/").concat(j),alt:"large image"})}),Object(C.jsx)(b.a,{title:"Session Pictures",subTitle:"".concat(c.length,"/").concat(178," loaded")}),Object(C.jsx)("div",{className:"photo-wall",children:c?c.sort((function(t,e){return t.split("_")[0].localeCompare(e.split("_")[0])})).map((function(t){return Object(C.jsx)(F.a,{className:"photo",title:t.split("_")[0],children:Object(C.jsx)("img",{onClick:function(){return f(t)},id:t,src:"".concat("","/output/").concat(e,"/").concat(t),alt:"lol"},t)})})):Object(C.jsx)(N.a,{})})]}):null},T=n(269),D=n(265),E=n(71),_=function(t){var e=Object(u.f)(),n=t.match.params.clientId,a=Object(r.useState)(null),c=Object(p.a)(a,2),s=(c[0],c[1]),i=Object(r.useState)(!1),O=Object(p.a)(i,2),x=O[0],m=O[1],w=function(){var t=Object(l.a)(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return j.b.loading("Photo sequence starting! Stand by..."),t.next=3,g(n);case 3:m(!0);case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),S=function(){var t=Object(l.a)(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return m(!1),j.b.loading("Deleting photos & restarting capture sequence! Stand by..."),t.next=4,y(n);case 4:m(!0);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),I=function(){var t=Object(l.a)(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.push("/");case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),F=function(){var t=Object(l.a)(o.a.mark((function t(){return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,k(n);case 2:j.b.success("Photos Deleted! Going back to dashboard"),e.push("/");case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return Object(r.useEffect)((function(){(function(){var t=Object(l.a)(o.a.mark((function t(){var e;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v(n);case 2:e=t.sent,s(e),e.has_photos&&m(!0);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}})()()}),[n]),Object(C.jsxs)(d.Content,{children:[Object(C.jsx)(b.a,{ghost:!1,onBack:function(){return e.goBack()},title:"Session for ".concat(n),tags:x?Object(C.jsx)(T.a,{color:"lime",children:"Active"}):Object(C.jsx)(T.a,{children:"Inactive"}),subTitle:"session has ".concat(x?"started":"not started"),extra:[Object(C.jsx)(h.a,{disabled:x,type:"primary",onClick:w,children:"Capture"},"startsession"),Object(C.jsx)(D.a,{title:"Re-capture set?",onConfirm:S,children:Object(C.jsx)(h.a,{type:"default",disabled:!x,children:"Retry Capture"})},"retry"),Object(C.jsx)(D.a,{title:"Delete all photos and return to dashboard?",onConfirm:F,children:Object(C.jsx)(h.a,{danger:!0,disabled:!x,children:"Abort Session"})},"nuke"),Object(C.jsx)(h.a,{ghost:!0,type:"primary",disabled:!x,onClick:I,children:"Finish Session"},"finish")]}),Object(C.jsx)(f.a,{}),Object(C.jsx)(E.a,{className:"controls",children:x&&Object(C.jsx)(P,{clientId:n})})]})};console.log("ENV","production");var B=function(){return Object(C.jsx)(s.a,{children:Object(C.jsx)("div",{className:"App",children:Object(C.jsxs)(u.c,{children:[Object(C.jsx)(u.a,{path:"/sessions/:clientId",component:_}),Object(C.jsx)(u.a,{exact:!0,path:"/",component:S})]})})})},A=function(t){t&&t instanceof Function&&n.e(3).then(n.bind(null,270)).then((function(e){var n=e.getCLS,r=e.getFID,a=e.getFCP,c=e.getLCP,s=e.getTTFB;n(t),r(t),a(t),c(t),s(t)}))};c.a.render(Object(C.jsx)(B,{}),document.getElementById("root")),A()}},[[261,1,2]]]); //# sourceMappingURL=main.eb0b3235.chunk.js.map