(this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{211:function(e,t,n){},213:function(e,t,n){},386:function(e,t,n){"use strict";n.r(t);var r,a=n(0),c=n(24),s=n.n(c),i=(n(211),n(212),n(213),n(103)),o=n(29),u=n(21),l=n.n(u),p=n(30),j=n(55),d=n(203),h=n(391),b=n(388),f=n(390),x=n(393),O=n(86),m=n(57),v=n(127),g=n.n(v),w=n(112),y=n(64),k=n.n(y),C=function(){var e=Object(p.a)(l.a.mark((function e(t){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.next=2;break;case 2:return e.next=4,k.a.post("/api/clients",t);case 4:return n=e.sent,e.abrupt("return",n.data.client_id);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),S=function(){var e=Object(p.a)(l.a.mark((function e(t){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.next=2;break;case 2:return e.next=4,k.a.get("/api/clients/".concat(t));case 4:return n=e.sent,e.abrupt("return",n.data);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),T=function(){var e=Object(p.a)(l.a.mark((function e(t){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,k.a.post("/api/clients/".concat(t,"/session"));case 3:return n=e.sent,e.abrupt("return",n.data);case 7:return e.prev=7,e.t0=e.catch(0),d.b.error("Something went wrong, check connection with the machine"),e.abrupt("return",e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(t){return e.apply(this,arguments)}}(),N=function(){var e=Object(p.a)(l.a.mark((function e(t){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k.a.get("/api/clients/".concat(t,"/session"));case 2:return n=e.sent,e.abrupt("return",n.data);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),I=function(){var e=Object(p.a)(l.a.mark((function e(t){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k.a.delete("/api/clients/".concat(t,"/session"));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),P=function(){var e=Object(p.a)(l.a.mark((function e(t){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,I(t);case 2:return e.next=4,T(t);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),D=function(){var e=Object(p.a)(l.a.mark((function e(){var t;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,k.a.get("/api/status");case 2:return t=e.sent,e.abrupt("return",t.data.status);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),E=n(7),F=function(){var e=Object(o.f)(),t=Object(a.useState)(null),n=Object(j.a)(t,2),r=n[0],c=n[1],s=function(){var t=Object(p.a)(l.a.mark((function t(n){var r;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(n.phone.length<10)){t.next=4;break}return d.b.error("Check all fields!"),c("Phone number needs to be a length of at least 10"),t.abrupt("return");case 4:return t.next=6,C({name:n.name,email:n.email,phone:parseInt(n.phone.replace(/\D/g,""))});case 6:r=t.sent,e.push("/sessions/".concat(r));case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();return Object(E.jsxs)(w.Content,{children:[Object(E.jsx)(h.a.Title,{className:"page-head",level:3,children:"Dashboard"}),Object(E.jsx)(h.a.Text,{children:"Enter the name, email and phone number of the subject"}),Object(E.jsx)(b.a,{}),Object(E.jsxs)(f.a,{className:"dashboard-form",onFinish:s,labelCol:{span:8},wrapperCol:{span:16},children:[Object(E.jsx)(g.a,{label:"name",name:"name",children:Object(E.jsx)(x.a,{minLength:3})}),Object(E.jsx)(g.a,{label:"email",name:"email",children:Object(E.jsx)(x.a,{type:"email"})}),Object(E.jsx)(g.a,{label:"phone",name:"phone",children:Object(E.jsx)(x.a,{type:"tel",minLength:10})}),Object(E.jsxs)(O.a,{justify:"space-between",children:[Object(E.jsx)(m.a,{danger:!0,onClick:function(){},children:"Reset"}),Object(E.jsx)(m.a,{htmlType:"submit",type:"primary",children:"Start Session"})]}),r&&Object(E.jsx)("p",{className:"error",children:r})]})]})},_=n(394),B=n(392),J=n(389),L=function(){return Object(E.jsx)(m.a,{type:"link",style:{position:"fixed",right:20,bottom:20},onClick:function(){window.scrollTo(0,0),console.log("")},children:"\u2934\ufe0f Scroll To Top"})},W=function(e){var t=e.clientId,n=Object(a.useState)(null),r=Object(j.a)(n,2),c=r[0],s=r[1],i=Object(a.useState)(null),o=Object(j.a)(i,2),u=o[0],d=o[1],b=Object(a.useState)(JSON.parse(window.localStorage.getItem("focusPhotos")||"[]")),f=Object(j.a)(b,2),x=f[0],m=f[1];Object(a.useEffect)((function(){var e=setInterval(function(){var e=Object(p.a)(l.a.mark((function e(){var n,r;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(c&&c.length>=89)){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,N(t);case 4:n=e.sent,(r=n.photos).length&&s(r);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),250);return function(){return clearInterval(e)}}),[t,c]);var v=function(){return d(null)};if(!(null===c||void 0===c?void 0:c.length))return null;var g=c.sort((function(e,t){return e.split("_")[0].localeCompare(t.split("_")[0])})),w=c.length/89,y=g.filter((function(e){var t=e.split("_")[0];return x.includes(t)}));return Object(E.jsxs)(E.Fragment,{children:[Object(E.jsx)(_.a,{visible:!!u,onOk:v,footer:null,onCancel:v,width:"50%",children:Object(E.jsx)("img",{width:"100%",onClick:v,src:"".concat("","/output/").concat(t,"/").concat(u),alt:"large modal"})}),Object(E.jsxs)(O.a,{align:"middle",justify:"space-around",style:{display:"flex",width:"100%"},children:[Object(E.jsx)(h.a.Title,{style:{margin:"0.5rem 1rem 0.7rem"},level:3,children:"Session Pictures"}),Object(E.jsxs)(h.a.Text,{children:[c.length,"/ 89 loaded"]}),Object(E.jsx)(h.a.Text,{children:"Select Featured Photos:"}),Object(E.jsx)(B.a,{mode:"multiple",allowClear:!0,placeholder:"Please select featured",style:{width:"35%"},defaultValue:x,value:x,onChange:function(e){console.log("SEelcted",e),window.localStorage.setItem("focusPhotos",JSON.stringify(e)),m(e)},children:g.map((function(e){var t=e.split("_")[0];return Object(E.jsx)(B.a.Option,{value:t,children:t})}))})]}),Object(E.jsx)("div",{className:"loading-bar-container",children:Object(E.jsx)("div",{className:"loading-bar",style:{width:"".concat(100*w,"%"),background:"hsl(".concat(Math.floor(120*w),", 90%, 70%)")}})}),Object(E.jsx)("div",{className:"featured-photos",style:{marginTop:"2rem"},children:y.map((function(e){return Object(E.jsx)("img",{onClick:function(){return d(e)},src:"".concat("","/output/").concat(t,"/").concat(e),alt:"lol"})}))}),Object(E.jsx)("div",{className:"photo-wall",children:g.map((function(e){return Object(E.jsx)(J.a,{className:"photo",title:e.split("_")[0],children:Object(E.jsx)("img",{onClick:function(){return d(e)},src:"".concat("","/output/").concat(t,"/").concat(e),alt:"lol"})},e)}))}),Object(E.jsx)(L,{})]})},G=n(395);!function(e){e[e["Standing By..."]=0]="Standing By...",e[e["Warming Up..."]=1]="Warming Up...",e[e["Capturing Photo"]=2]="Capturing Photo",e[e["Capturing Grid"]=3]="Capturing Grid",e[e["Writing To Disk"]=4]="Writing To Disk",e[e["Downloading!"]=5]="Downloading!"}(r||(r={}));var R=["lime","gold","volcano","magenta","geekblue"],V=function(e){var t=e.poll,n=Object(a.useState)(r["Standing By..."]),c=Object(j.a)(n,2),s=c[0],i=c[1];return Object(a.useEffect)((function(){var e=setInterval(function(){var e=Object(p.a)(l.a.mark((function e(){var n;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,D();case 4:n=e.sent,i(n);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),250);return function(){return clearInterval(e)}}),[t]),Object(E.jsx)(G.a,{color:R[s],style:{display:"flex"},children:Object(E.jsx)("span",{style:{margin:"auto"},children:r[s]})})},q=n(396),A=function(e){var t=Object(o.f)(),n=e.match.params.clientId,r=Object(a.useState)(null),c=Object(j.a)(r,2),s=c[0],i=c[1],u=Object(a.useState)(!1),f=Object(j.a)(u,2),x=f[0],v=f[1],g=function(){var e=Object(p.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d.b.loading("Photo sequence starting! Stand by..."),e.next=3,T(n);case 3:v(!0);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),y=function(){var e=Object(p.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return v(!1),d.b.loading("Deleting photos & restarting capture sequence! Stand by..."),e.next=4,P(n);case 4:v(!0);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),k=function(){var e=Object(p.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.push("/");case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),C=function(){var e=Object(p.a)(l.a.mark((function e(){return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,I(n);case 2:d.b.success("Photos Deleted! Going back to dashboard"),t.push("/");case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Object(a.useEffect)((function(){(function(){var e=Object(p.a)(l.a.mark((function e(){var t;return l.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S(n);case 2:t=e.sent,i(t),t.has_photos&&v(!0);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}})()()}),[n]),Object(E.jsxs)(w.Content,{children:[Object(E.jsx)(h.a.Title,{className:"page-head",level:3,children:"Session View"}),Object(E.jsxs)(O.a,{justify:"space-around",style:{width:"60%",margin:"auto"},children:[Object(E.jsxs)(h.a.Text,{children:[Object(E.jsx)("strong",{children:"Name:"})," ",null===s||void 0===s?void 0:s.name]}),Object(E.jsxs)(h.a.Text,{children:[Object(E.jsx)("strong",{children:"Email:"})," ",null===s||void 0===s?void 0:s.email]}),Object(E.jsxs)(h.a.Text,{children:[Object(E.jsx)("strong",{children:"Phone:"})," ",null===s||void 0===s?void 0:s.phone]})]}),Object(E.jsx)(b.a,{}),Object(E.jsxs)(O.a,{justify:"center",className:"session-toolbar",children:[Object(E.jsx)(m.a,{onClick:k,children:"Back To Dashboard"},"finish"),Object(E.jsx)(m.a,{disabled:x,type:"primary",onClick:g,children:"Capture"},"startsession"),Object(E.jsx)(q.a,{disabled:!x,title:"Re-capture set?",onConfirm:y,children:Object(E.jsx)(m.a,{type:"default",disabled:!x,children:"Retry Capture"})},"retry"),Object(E.jsx)(q.a,{disabled:!x,title:"Delete all photos and return to dashboard?",onConfirm:C,children:Object(E.jsx)(m.a,{danger:!0,disabled:!x,children:"Abort Session"})},"nuke"),Object(E.jsx)(V,{poll:!0})]}),Object(E.jsx)(b.a,{}),Object(E.jsx)(O.a,{className:"controls",children:x&&Object(E.jsx)(W,{clientId:n})})]})};console.log("ENV","production");var U=function(){return Object(E.jsx)(i.a,{children:Object(E.jsx)("div",{className:"App",children:Object(E.jsxs)(o.c,{children:[Object(E.jsx)(o.a,{path:"/sessions/:clientId",component:A}),Object(E.jsx)(o.a,{exact:!0,path:"/",component:F})]})})})},M=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,397)).then((function(t){var n=t.getCLS,r=t.getFID,a=t.getFCP,c=t.getLCP,s=t.getTTFB;n(e),r(e),a(e),c(e),s(e)}))};s.a.render(Object(E.jsx)(U,{}),document.getElementById("root")),M()}},[[386,1,2]]]); //# sourceMappingURL=main.4fce879a.chunk.js.map