text: (this["webpackJsonpfe-dev-client"]=this["webpackJsonpfe-dev-client"]||[]).push([[0],{190:function(e,t,c){},206:function(e,t,c){},238:function(e,t,c){},311:function(e,t,c){"use strict";c.r(t);var n,r,i,s,a,o,l=c(0),u=c.n(l),d=c(35),j=c.n(d),b=c(16),x=(c(190),c(43)),h=c(14),O=c(37),f=c(127),p=c(129),m=c(145),g=c(95),v=c(130),C=c.p+"static/media/naver_login_eng.69b5671c.png";!function(e){e.INSTRUCTOR="instructor",e.STUDENT="student"}(n||(n={})),function(e){e[e.LOADED=0]="LOADED",e[e.LOADING=1]="LOADING",e[e.NOTLOADED=2]="NOTLOADED"}(r||(r={})),function(e){e.QUESTION="Question",e.DISCUSSION="Discussion"}(i||(i={})),function(e){e.EN="en",e.KO="ko"}(s||(s={})),function(e){e.USER="user",e.VIDEO="video",e.NOTICE="notice"}(a||(a={})),function(e){e[e.Lecture=0]="Lecture",e[e.Class=1]="Class"}(o||(o={}));var w=Object(l.createContext)({userName:"",status:r.LOADED,id:-1}),S=c.p+"static/media/logo1.23d60d6d.svg",k=c(1),I=function(e){var t=Object.assign({},e);return Object(k.jsx)(f.a,Object(O.a)(Object(O.a)({w:460,h:100,colorScheme:"white"},t),{},{children:Object(k.jsx)(p.a,{src:C,fit:"fill"})}))},y=function(){var e=Object(l.useContext)(w).status;return Object(k.jsxs)(m.a,{size:"xl",isOpen:e!==r.LOADED,onClose:function(){console.log()},children:[Object(k.jsx)(m.g,{}),e===r.LOADING?Object(k.jsx)(g.a,{}):Object(k.jsxs)(m.d,{children:[Object(k.jsx)(m.f,{children:Object(k.jsxs)(v.m,{w:"100%",children:[Object(k.jsxs)(v.e,{w:"100%",h:"60px",children:[Object(k.jsx)(v.i,{}),Object(k.jsx)(p.a,{src:S,alt:"liveclass",h:"60px"}),Object(k.jsx)(v.i,{})]}),Object(k.jsx)(v.b,{w:"100%",textAlign:"center",fontSize:"50px",fontWeight:"bold",children:"LOG IN"})]})}),Object(k.jsx)(m.b,{children:Object(k.jsx)(v.e,{children:Object(k.jsxs)(v.b,{w:"100%",display:"flex",children:[Object(k.jsx)(v.i,{}),Object(k.jsx)(I,{onClick:function(){window.location.pathname="/api/auth/naver"}}),Object(k.jsx)(v.i,{})]})})})]})]})},L=Object(l.createContext)({getSocket:function(){return null},getConnected:function(){return!1},getError:function(){},subscribeEvent:function(){},getEventMsg:function(){return""}}),T=function(){var e=Object(l.useContext)(L),t=e.getSocket,c=e.getConnected,n=e.getError;return{socket:t(),connected:c(),error:n()}},N=c(98),E=c(11),z=c(160);function D(e){var t=e.url,c=e.children,n=e.options,r=e.debug,i=void 0===r||r,s=Object(l.useState)(null),a=Object(E.a)(s,2),o=a[0],u=a[1],d=Object(l.useState)(!1),j=Object(E.a)(d,2),b=j[0],x=j[1],h=Object(l.useState)(null),f=Object(E.a)(h,2),p=f[0],m=f[1],g=Object(l.useState)({}),v=Object(E.a)(g,2),C=v[0],w=v[1];Object(l.useEffect)((function(){var e=Object(z.a)(t,n);return u(e),e.on("connect",(function(){x(!0)})),e.on("disconnect",(function(){e.removeAllListeners(),x(!1)})),e.on("error",(function(e){m(e)})),i&&e.onAny((function(e){for(var t=arguments.length,c=new Array(t>1?t-1:0),n=1;n<t;n++)c[n-1]=arguments[n];console.log(e,c)})),function(){u(null),e.disconnect()}}),[t,n]);return Object(k.jsx)(L.Provider,{value:{getSocket:function(){return o},getConnected:function(){return b},getError:function(){return p},subscribeEvent:function(e){null===o||void 0===o||o.on(e,(function(t){!function(e,t){w(Object(O.a)(Object(O.a)({},C),{},Object(N.a)({},e,t)))}(e,t)}))},getEventMsg:function(e){return C[e]}},children:c})}D.defaultProps={options:null};var M=D,U=c(25),A=c(18),R=c(146),P=c(10),V=c(20),G=c(131),F=c(69),B=Object(l.createContext)({isLive:!1,setIsLive:function(){return null},selectedVidIdx:0,setSelectedVidIdx:function(){return null}}),H=function(e){var t=e.entry,c=Object(h.g)(),r=(c.classUuid,c.memberType),i=(c.lectureId,Object(l.useContext)(B)),s=i.isLive,o=i.selectedVidIdx,u=i.setSelectedVidIdx,d=!1;t.type===a.VIDEO&&(d=t.videoIdx===o);return Object(k.jsx)(v.b,{as:"button",height:"30px",lineHeight:"1.1",transition:"all 0.2s cubic-bezier(.08,.52,.52,1)",border:"1px",px:"8px",borderRadius:"2px",fontSize:"20px",textAlign:"start",bg:"white",borderColor:d?"#FF4A3E":"white",color:"black",overflow:"hidden",whiteSpace:"nowrap",_hover:{bg:"#ebedf0"},_active:{bg:"#dddfe2",transform:"scale(0.98)",borderColor:"#bec3c9"},_focus:{boxShadow:"0 0 1px 2px rgba(88, 144, 255, .75), 0 1px 1px rgba(0, 0, 0, .15)"},onClick:function(){switch(t.type){case a.USER:alert(t.userId);break;case a.VIDEO:if(r===n.STUDENT&&s)return;u(t.videoIdx),r===n.INSTRUCTOR&&s&&t.onClickHandler();break;case a.NOTICE:t.onClickHandler?t.onClickHandler():alert(t.message)}},style:{scrollbarWidth:"none"},children:t.tabName})},J=function(e){var t=e.tabTitle,c=e.tabContents;return Object(k.jsx)(v.b,{w:"175px",children:Object(k.jsxs)(v.j,{spacing:0,children:[Object(k.jsx)(v.b,{letterSpacing:"wide",justifyContent:"flex-start",fontWeight:"bold",fontSize:"18px",ml:"2",mt:"2",overflow:"hidden",whiteSpace:"nowrap",children:t}),Object(k.jsx)(v.b,{w:"100%",h:"3px"}),c.map((function(e){return Object(k.jsxs)(k.Fragment,{children:[Object(k.jsx)(H,{entry:e}),Object(k.jsx)(v.b,{w:"100%",h:"3px"})]})}))]})})},q=Object(l.createContext)({language:s.KO,setLanguage:function(){return null}}),W=Object(P.b)({displayName:"GlobeIcon",path:Object(k.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:Object(k.jsx)("path",{d:"M24 24h-2.784l-1.07-3h-4.875l-1.077 3h-2.697l4.941-13h2.604l4.958 13zm-4.573-5.069l-1.705-4.903-1.712 4.903h3.417zm-9.252-12.804c.126-.486.201-.852.271-1.212l-2.199-.428c-.036.185-.102.533-.22 1-.742-.109-1.532-.122-2.332-.041.019-.537.052-1.063.098-1.569h2.456v-2.083h-2.161c.106-.531.198-.849.288-1.149l-2.147-.645c-.158.526-.29 1.042-.422 1.794h-2.451v2.083h2.184c-.058.673-.093 1.371-.103 2.077-2.413.886-3.437 2.575-3.437 4.107 0 1.809 1.427 3.399 3.684 3.194 2.802-.255 4.673-2.371 5.77-4.974 1.134.654 1.608 1.753 1.181 2.771-.396.941-1.561 1.838-3.785 1.792v2.242c2.469.038 4.898-.899 5.85-3.166.93-2.214-.132-4.635-2.525-5.793zm-2.892 1.531c-.349.774-.809 1.544-1.395 2.15-.09-.646-.151-1.353-.184-2.108.533-.07 1.072-.083 1.579-.042zm-3.788.724c.062.947.169 1.818.317 2.596-1.996.365-2.076-1.603-.317-2.596zm11.236-1.745l-2.075-5.533 5.414-1.104-.976 1.868c2.999 2.418 4.116 5.645 4.532 8.132-1.736-2.913-3.826-4.478-5.885-5.321l-1.01 1.958zm-7.895 10.781l1.985 5.566-5.43 1.016 1.006-1.852c-2.96-2.465-4.021-5.654-4.397-8.148 1.689 2.94 3.749 4.483 5.794 5.36l1.042-1.942zm10.795-6.029"})})}),Q=function(e){var t=e.menus,c=e.memuContext,n=Object(l.useContext)(q),r=n.language,i=n.setLanguage,a=T().socket,u=Object(h.g)(),d=u.classUuid,j=u.lectureId,b=Object(h.f)();return Object(k.jsxs)(v.e,{w:"190px",h:"100vh",flexDir:"column",children:[Object(k.jsx)(v.e,{overflowX:"hidden",overflowY:"auto",flexDir:"column",children:Object(k.jsx)(v.b,{ml:"2",children:Object(k.jsx)(v.m,{divider:Object(k.jsx)(v.k,{borderColor:"gray.200"}),spacing:0,w:"190px",align:"stretch",children:t.map((function(e){return Object(k.jsx)(J,{tabTitle:e.tabTitle,tabContents:e.tabContents})}))})})}),Object(k.jsx)(v.i,{}),Object(k.jsx)(v.e,{p:"10px 10px",w:"full",backgroundColor:"white",flexDir:"column",children:Object(k.jsxs)(v.b,{bottom:0,children:[Object(k.jsxs)(G.a,{children:[Object(k.jsx)(G.f,{children:Object(k.jsx)(f.b,{size:"md",colorScheme:"red",icon:Object(k.jsx)(V.g,{}),"aria-label":"Quit",m:.5})}),Object(k.jsxs)(G.e,{w:180,children:[Object(k.jsx)(G.b,{}),Object(k.jsx)(G.c,{children:Object(k.jsx)(f.a,{colorScheme:"red",w:150,onClick:function(){b(-1),c===o.Lecture&&(null===a||void 0===a||a.emit("ExitLecture",{classUuid:d,lectureId:parseInt(j,10)}))},children:"Quit"})})]})]}),Object(k.jsx)(f.b,{size:"md",icon:Object(k.jsx)(V.j,{}),"aria-label":"Settings",m:.5}),Object(k.jsx)(G.a,{placement:"top-start",children:function(e){var t=e.onClose;return Object(k.jsxs)(k.Fragment,{children:[Object(k.jsx)(G.f,{children:Object(k.jsx)(f.b,{size:"sm",icon:Object(k.jsx)(W,{}),"aria-label":"Settings",m:.5})}),Object(k.jsx)(F.a,{children:Object(k.jsx)(G.e,{w:"165px",h:"60px",children:Object(k.jsxs)(G.c,{children:[Object(k.jsx)(f.a,{colorScheme:"green",marginRight:"2px",onClick:function(){i(s.EN),null===a||void 0===a||a.emit("SetLanguage",{classUuid:d,language:r}),t()},children:"EN"}),Object(k.jsx)(f.a,{colorScheme:"blue",onClick:function(){i(s.KO),null===a||void 0===a||a.emit("SetLanguage",{classUuid:d,language:r}),t()},children:"\ud55c\uae00"}),Object(k.jsx)(G.d,{})]})})})]})}})]})})]})},_=[{tabName:"Notice",type:a.NOTICE,message:"Notice message"},{tabName:"Materials",type:a.NOTICE,message:"Materials message"}],Y=function(){var e=T().connected;return Object(k.jsx)(v.e,{position:"fixed",left:5,bottom:10,zIndex:3,w:"300px",h:"200px",backgroundColor:"gray.300",justifyContent:"center",alignContent:"center",borderRadius:"30px",opacity:"0.8",color:e?"blue.500":"red.500",children:Object(k.jsx)(v.l,{height:"fit-content",fontSize:"2xl",children:"Connected: ".concat(e?"True":"False")})})},K=Object(P.b)({displayName:"flagIcon",path:Object(k.jsx)("svg",{className:"flagIcon",version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 206.505 206.505",xmlSpace:"preserve",children:Object(k.jsx)("g",{children:Object(k.jsx)("path",{d:"M167.069,16.354c-0.426,0.186-43.29,18.671-70.274-4.481c-31.021-26.619-60.722-0.2-61.012,0.072 L34.623,13l-0.179,193.494l7.108,0.011l0.115-122.594c5.157-4.091,27.11-19.086,50.498,0.988 c30.356,26.047,75.839,6.438,77.765,5.59l2.133-0.938V14.153L167.069,16.354z M164.943,84.824 c-8.997,3.389-44.603,14.874-68.148-5.322c-10.375-8.904-20.6-11.871-29.629-11.871c-10.815,0-19.923,4.266-25.489,7.702 l0.047-59.101c5.264-4.169,27.142-18.961,50.44,1.034c24.855,21.323,59.863,12.043,72.78,7.516V84.824z"})})})}),X=function(e){var t=e.children,c=e.onClick;return Object(k.jsx)(f.a,{className:"ClipboardButton",leftIcon:Object(k.jsx)(V.h,{}),"aria-label":"Settings",m:.5,onClick:c,children:t})},Z=function(e){var t=e.onClick;return Object(k.jsxs)(v.b,{className:"create-timeline-marker",children:[Object(k.jsx)(f.a,{colorScheme:"red",leftIcon:Object(k.jsx)(K,{}),marginRight:"2px",onClick:function(){return t(i.QUESTION)},children:"Question"}),Object(k.jsx)(f.a,{colorScheme:"blue",leftIcon:Object(k.jsx)(K,{}),onClick:function(){return t(i.DISCUSSION)},children:"Discussion"})]})},$=c(331),ee=c(329),te=c(330),ce=c(323),ne=c(324),re=c(325),ie=c(326),se=c(327),ae=c(328),oe=(c(202),c(203),c(204),c(205),c(206),c(85)),le=c(5),ue=c(124),de=c.n(ue),je=c(151),be=c(152),xe=c.n(be);c(153).config();var he=function(){var e=Object(je.a)(de.a.mark((function e(t){var c;return de.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,xe.a.get("https://www.googleapis.com/youtube/v3/playlistItems",{params:{part:"id,snippet",maxResults:10,playlistId:t,key:"AIzaSyCHVChOn1oiqENXEWez1FijV9bvlPs-XzI"}});case 2:return c=e.sent,e.abrupt("return",c.data);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Oe=Object(le.c)({sm:"320px",md:"768px",lg:"960px",xl:"1200px","2xl":"1536px"}),fe=(Object(b.b)({breakpoints:Oe}),function(e){var t=e.lectureNum,c=e.youtubePlayList,n=e.isLive,r=e.date,i=e.to,s=e.key,a=Object(l.useState)(""),o=Object(E.a)(a,2),u=o[0],d=o[1];return Object(l.useEffect)((function(){he(c).then((function(e){d(e.items[0].snippet.thumbnails.standard.url)}))}),[]),Object(k.jsx)(v.b,{w:"100%",h:"60vh",rounded:"md",boxShadow:"md",bgColor:n?"red.200":"white",borderColor:n?"red":"black",overflow:"hidden",children:Object(k.jsxs)(v.e,{h:"100%",flexDirection:"column",children:[Object(k.jsx)(v.a,{ratio:16/9,children:Object(k.jsx)(p.a,{src:u,fit:"cover",h:"40%"})}),Object(k.jsxs)(v.e,{h:"100%",flexDirection:"column",textAlign:"center",p:6,color:Object(oe.d)("gray.800","white"),align:"center",children:[n?Object(k.jsx)(v.l,{fontSize:"lg",fontWeight:"bold",bg:"red.100",p:2,px:3,color:"red",rounded:"full",children:"Live"}):Object(k.jsx)(v.l,{fontSize:"lg",fontWeight:"bold",bg:"green.100",p:2,px:3,color:"green.500",rounded:"full",children:"".concat(r)}),Object(k.jsx)(v.i,{}),Object(k.jsx)(v.b,{children:Object(k.jsx)(v.g,{color:Object(oe.d)("gray.700","white"),fontSize:{base:"12px",md:"20px",lg:"26px",xl:"30px","2xl":"42px"},fontFamily:"body",children:"Lecture ".concat(t)})}),Object(k.jsx)(v.i,{}),Object(k.jsx)(x.b,{to:i,children:Object(k.jsx)(f.a,{w:"100%",h:"40px",bg:"green.400",color:"white",fontSize:"15px",rounded:"xl",boxShadow:"0 5px 20px 0px rgb(72 187 120 / 43%)",_hover:{bg:"green.500"},_focus:{bg:"green.500"},children:"Go To Lecture"})},s),Object(k.jsx)(v.b,{h:"30px"})]})]})})});te.a.use([ce.a,ne.a,re.a,ie.a,se.a,ae.a]);var pe,me=function(e){var t=e.classUuid,c=e.memberType,n=e.lectureList;return Object(k.jsx)(k.Fragment,{children:Object(k.jsx)($.a,{centeredSlides:!0,className:"swiper-container",spaceBetween:50,slidesPerView:4,navigation:!0,mousewheel:!0,keyboard:!0,pagination:{clickable:!0,renderBullet:function(e,t){return'<span class="'.concat(t,'">').concat(e+1,"</span>")}},children:n.map((function(e){var n=e.id,r=e.lectureDate,i=(e.lectureName,e.LiveStatus),s=e.playlist;return Object(k.jsx)(ee.a,{children:Object(k.jsx)(fe,{lectureNum:n,youtubePlayList:s,date:r.slice(0,10),to:"/class/".concat(t,"/").concat(c,"/").concat(n),isLive:i},n)})}))})})},ge=function(){var e=Object(h.g)(),t=e.classUuid,c=e.memberType,n=T(),r=n.socket,i=n.connected,s=Object(l.useState)([]),u=Object(E.a)(s,2),d=u[0],j=u[1],b=Object(A.c)(t),O=(b.hasCopied,b.onCopy),p=Object(R.a)(),m={tabTitle:"Classroom",tabContents:_},g=Object(l.useState)([]),C=Object(E.a)(g,2),w=C[0],S=C[1],I={tabTitle:"Classmates",tabContents:w};Object(l.useEffect)((function(){var e=JSON.stringify({classUuid:t});null===r||void 0===r||r.on("JoinClass",(function(){null===r||void 0===r||r.emit("GetClassMembers",e),null===r||void 0===r||r.emit("GetLectures",e)})),null===r||void 0===r||r.emit("JoinClass",e),null===r||void 0===r||r.on("CreateLecture",(function(e){var t=e.lecture;200===e.status&&j((function(e){return[].concat(Object(U.a)(e),[t])}))})),null===r||void 0===r||r.on("GetClassMembers",(function(e){var t=e.members;if(200===e.status){var c=t.map((function(e){return{tabName:e.userName,type:a.USER,userId:e.id}}));S(c)}})),null===r||void 0===r||r.on("GetLectures",(function(e){var t=e.lectures;200===e.status&&j(t)}))}),[i]);return Object(k.jsxs)(k.Fragment,{children:[Object(k.jsx)(Y,{}),Object(k.jsxs)(v.e,{children:[Object(k.jsx)(Q,{menus:[m,I],memuContext:o.Class}),Object(k.jsx)(v.b,{w:"8px",h:"100vh"}),Object(k.jsxs)(v.b,{w:"100%",h:"100vh",bgColor:"gray.100",children:[Object(k.jsx)(me,{classUuid:t,memberType:c,lectureList:d}),"instructor"===c&&Object(k.jsx)(x.b,{to:"/class/".concat(t,"/").concat(c,"/createLecture"),children:Object(k.jsx)(f.a,{children:"Create new lecture"})}),Object(k.jsx)(X,{onClick:function(){O(),p({title:"ClassId copied to your clipboard!",status:"success",duration:1500,isClosable:!0})},children:"Copy Class Id"})]})]})]})},ve=c(154),Ce=(c(238),c(140)),we=function(e){var t=e.color;return Object(k.jsxs)("svg",{width:"26",height:"42",viewBox:"0 0 26 42",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Object(k.jsx)("path",{id:"FlagSVGStroke",d:"M0.25 41.75V1.35983C0.478428 0.930839 0.673497 0.640584 0.845353 0.461995C1.02353 0.276835 1.14455 0.243676 1.22836 0.250958C1.32482 0.259338 1.46095 0.327377 1.65137 0.532983C1.82818 0.723902 2.02343 1.00219 2.25 1.36856V41.75H0.25Z",fill:t,stroke:"black",strokeWidth:"0.5"}),Object(k.jsx)("path",{id:"FlagSVGStroke",d:"M0.25 20.8038V3.86704C5.79233 6.03311 9.95189 6.92656 13.8517 6.82338C17.6706 6.72233 21.2189 5.66585 25.5464 3.95051C24.221 7.25607 23.5865 9.87565 23.6068 12.4474C23.6276 15.0852 24.3371 17.6498 25.6573 20.8285C20.9883 21.9986 17.2644 22.6277 13.4138 22.6521C9.53251 22.6767 5.51003 22.087 0.25 20.8038Z",fill:t,stroke:"black",strokeWidth:"0.5"})]})},Se=function(e){var t=e.id,c=e.time,n=e.markerType,r=(e.videoIndex,T().socket);return Object(k.jsx)("button",{className:"timeline-marker",style:{left:"".concat(c,"%")},type:"button","aria-label":"timeline",onClick:function(){return function(){var e=JSON.stringify({markerId:t,markerType:n});null===r||void 0===r||r.emit("TimeMarkerClicked",e)}()},children:Object(k.jsx)(we,{color:function(e){switch(e){case i.DISCUSSION:return"blue";case i.QUESTION:return"red";default:throw new Error("Invalid MarkerType")}}(n)})})};!function(e){e[e.UNSTARTED=-1]="UNSTARTED",e[e.ENDED=0]="ENDED",e[e.PLAYING=1]="PLAYING",e[e.PAUSED=2]="PAUSED",e[e.BUFFERING=3]="BUFFERING",e[e.CUED=5]="CUED"}(pe||(pe={}));var ke,Ie=function(e){var t,c,r,i=e.memberType,s=e.classUuid,a=e.lectureId,o=e.videoId,u=e.videoIndex,d=e.width,j=void 0===d?"100%":d,b=e.height,x=void 0===b?"100%":b,h=e.isControled,O=T(),f=O.socket,p=O.connected,m=Object(l.useState)(null),g=Object(E.a)(m,2),v=g[0],C=g[1],w=Object(l.useState)(0),S=Object(E.a)(w,2),I=S[0],y=S[1],L=Object(l.useRef)(0),N=Object(l.useRef)(null),z=Object(l.useRef)(null),D=Object(l.useRef)(null),M=Object(l.useState)([]),A=Object(E.a)(M,2),R=A[0],P=A[1];"NULL"===o?function(){var e;null===(e=z.current)||void 0===e||e.classList.add("coverVideo")}():function(){var e;null===(e=z.current)||void 0===e||e.classList.remove("coverVideo")}();Object(l.useEffect)((function(){return p&&v&&(h&&(null===f||void 0===f||f.on("InstructorTimeChange",(function(e){null===v||void 0===v||v.seekTo(e)})),null===f||void 0===f||f.on("InstructorPlay",(function(){null===v||void 0===v||v.playVideo()})),null===f||void 0===f||f.on("InstructorPause",(function(){null===v||void 0===v||v.pauseVideo()}))),null===f||void 0===f||f.on("GetMarkers",(function(e){var t=e.markers;200===e.status&&P(t)})),null===f||void 0===f||f.emit("GetMarkers",{classUuid:s,lectureId:a,videoIndex:u})),null===f||void 0===f||f.on("CreateMarker",(function(e){var t=e.marker;200===e.status&&P((function(e){return[].concat(Object(U.a)(e),[t])}))})),function(){clearInterval(N.current),null===f||void 0===f||f.off("InstructorTimeChange"),null===f||void 0===f||f.off("InstructorPlay"),null===f||void 0===f||f.off("InstructorPause"),null===f||void 0===f||f.off("GetMarkers"),null===f||void 0===f||f.off("CreateMarker")}}),[p,v,u]),h?null===(t=z.current)||void 0===t||t.classList.add("live"):null===(c=z.current)||void 0===c||c.classList.remove("live");var V={height:x.toString(),width:j.toString(),playerVars:{autoplay:0,controls:h?0:1,disablekb:h?1:0,rel:0}},G={backgroundImage:"url(".concat("https://previews.123rf.com/images/sevenozz/sevenozz1812/sevenozz181200056/127054720-vintage-tv-test-screen-please-stand-by-television-calibration-pattern.jpg",")"),backgroundSize:"100% 100%"};return null===(r=D.current)||void 0===r||r.classList.add("showTimeline"),Object(k.jsxs)("div",{className:i===n.INSTRUCTOR?"teacher":"student",id:"youtube-wrapper",ref:z,style:{width:j,height:x},children:[Object(k.jsx)(Z,{onClick:function(e){var t=v.getCurrentTime();t=t>L.current?L.current-5:t;var c={classUuid:s,lectureId:a,marker:{markerType:e,time:t/L.current*100,videoIndex:u}};null===f||void 0===f||f.emit("CreateMarker",JSON.stringify(c))}}),Object(k.jsxs)("div",{className:"video-timeline-components",ref:D,children:[R.map((function(e){var t=e.id,c=e.markerType,n=e.time;return 0===L.current?Object(k.jsx)("div",{}):Object(k.jsx)(Se,{id:t,time:n,markerType:c,videoIndex:u})})),h?Object(k.jsx)(Ce.a,{colorScheme:"red",position:"absolute",bottom:"35px",height:"5px",width:"100%",value:L.current?I/L.current*100:0}):Object(k.jsx)("div",{})]}),Object(k.jsx)("div",{className:"video-cover",style:G}),Object(k.jsx)("div",{className:"video-container",children:Object(k.jsx)(ve.a,{className:"video",videoId:o,opts:V,onReady:function(e){C(e.target)},onPlay:function(e){v&&(L.current=v.playerInfo.duration),N.current=setInterval((function(){y(v.getCurrentTime())}),100)},onPause:function(e){clearInterval(N.current)},onStateChange:function(e){if(!h){var t=e.target,c=JSON.stringify({classUuid:s,lectureId:a,newtime:t.getCurrentTime()});e.data===pe.BUFFERING?null===f||void 0===f||f.emit("InstructorTimeChange",c):e.data===pe.PLAYING?(null===f||void 0===f||f.emit("InstructorTimeChange",c),null===f||void 0===f||f.emit("InstructorPlay",c)):e.data===pe.PAUSED&&(null===f||void 0===f||f.emit("InstructorPause",c))}}})})]})},ye=c(59),Le=function(e){var t=e.message,c=e.backgroundColor,n=e.color;return Object(k.jsx)(v.b,{maxWidth:"200px",backgroundColor:c,color:n,marginBottom:"auto",borderRadius:"7px",fontSize:"14px",p:"5px 7px",children:t})},Te=function(e){var t=e.time;return Object(k.jsx)(v.b,{fontSize:5,marginTop:"auto",p:1,color:"black",children:t})},Ne=function(e){var t=e.userName;return Object(k.jsx)(v.b,{width:"fit-content",mt:0,mb:.5,fontSize:"14px",p:"2px 5px",textAlign:"start",children:t})},Ee=function(e){var t=e.userName,c=e.message,n=e.time,r=e.isMy;return Object(k.jsxs)(v.b,{width:"full",p:"4px 8px 0px",m:0,children:[!r&&Object(k.jsx)(Ne,{userName:t}),Object(k.jsx)(v.e,{display:"flex",justifyContent:r?"right":"left",alignContent:"center",m:0,children:r?Object(k.jsxs)(k.Fragment,{children:[Object(k.jsx)(Te,{time:n}),Object(k.jsx)(Le,{message:c,backgroundColor:"blue.500",color:"gray.50"})]}):Object(k.jsxs)(k.Fragment,{children:[Object(k.jsx)(Le,{message:c,backgroundColor:"gray.100",color:"black"}),Object(k.jsx)(Te,{time:n})]})})]})},ze=c(141),De=(Object(P.b)({displayName:"RecordIcon",path:Object(k.jsxs)("svg",{children:[Object(k.jsx)("g",{id:"Livello_7",children:Object(k.jsx)("path",{d:"M91.192,59.623V21.946c0.043-0.534,0.068-1.073,0.068-1.618C91.262,9.102,82.161,0,70.935,0   c-11.229,0-20.33,9.104-20.33,20.328c0,0.545,0.024,1.084,0.066,1.618v37.677c-0.042,0.535-0.066,1.073-0.066,1.621   c0,11.229,9.103,20.326,20.329,20.326c11.227,0,20.327-9.1,20.327-20.326C91.262,60.696,91.235,60.158,91.192,59.623    M120.942,50.219c0-3.084-2.5-5.584-5.584-5.584c-3.082,0-5.582,2.5-5.582,5.584c0,0.047,0.004,0.092,0.008,0.139   c-0.076,21.43-17.471,38.779-38.917,38.779c-21.448,0-38.842-17.353-38.917-38.779c0.002-0.047,0.008-0.092,0.008-0.139   c0-3.084-2.5-5.584-5.584-5.584s-5.585,2.5-5.585,5.584c0,25.714,19.388,46.896,44.339,49.743v28.648H38.78   c-2.96,0-5.358,2.402-5.358,5.361c0,2.961,2.398,5.355,5.358,5.355h26.35h11.61h26.35c2.959,0,5.357-2.396,5.357-5.355   c0-2.959-2.398-5.361-5.357-5.361h-26.35V99.945C101.628,97.039,120.942,75.885,120.942,50.219"})}),Object(k.jsx)("g",{id:"Livello_1_1_"})]})}),Object(P.b)({displayName:"flagIcon",path:Object(k.jsx)("svg",{version:"1.1",id:"Capa_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 206.505 206.505",xmlSpace:"preserve",children:Object(k.jsx)("g",{children:Object(k.jsx)("path",{d:"M167.069,16.354c-0.426,0.186-43.29,18.671-70.274-4.481c-31.021-26.619-60.722-0.2-61.012,0.072 L34.623,13l-0.179,193.494l7.108,0.011l0.115-122.594c5.157-4.091,27.11-19.086,50.498,0.988 c30.356,26.047,75.839,6.438,77.765,5.59l2.133-0.938V14.153L167.069,16.354z M164.943,84.824 c-8.997,3.389-44.603,14.874-68.148-5.322c-10.375-8.904-20.6-11.871-29.629-11.871c-10.815,0-19.923,4.266-25.489,7.702 l0.047-59.101c5.264-4.169,27.142-18.961,50.44,1.034c24.855,21.323,59.863,12.043,72.78,7.516V84.824z"})})})}),function(e){return Object(k.jsx)(P.a,Object(O.a)(Object(O.a)({viewBox:"0 0 200 200"},e),{},{children:Object(k.jsx)("path",{fill:"currentColor",d:"M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0"})}))}),Me=function(){var e=Object(h.g)(),t=e.classUuid,c=e.lectureId;if(!t)throw new Error("No ClassUuid");if(!c)throw new Error("No Lecture Id");return{classUuid:t,lectureId:parseInt(c,10)}},Ue=function(){var e=Object(l.useState)(),t=Object(E.a)(e,2),c=t[0],n=t[1],r=Object(l.useState)(),i=Object(E.a)(r,2),s=i[0],a=i[1],o=Object(l.useState)(!0),u=Object(E.a)(o,2),d=u[0],j=u[1],b=Object(l.useState)(),x=Object(E.a)(b,2),h=x[0],O=x[1],p=Object(l.useState)(),m=Object(E.a)(p,2),g=m[0],v=m[1],C=Object(l.useState)(),w=Object(E.a)(C,2),S=w[0],I=w[1],y=T(),L=y.socket,N=y.connected,z=Me(),D=z.classUuid,M=z.lectureId;Object(l.useEffect)((function(){N&&L&&L.on("LiveChatAudioMessage",(function(e){var t=e.arrayBuffer,c=(e.senderId,new Blob([new Uint8Array(t)])),n=URL.createObjectURL(c);new Audio(n).play()}))}),[N]);var U=Object(l.useCallback)((function(){if(S){var e=new File([S],"soundBlob",{lastModified:(new Date).getTime(),type:"audio"}),t={classUuid:D,lectureId:M,arrayBuffer:e};null===L||void 0===L||L.emit("LiveChatAudioMessage",t)}}),[S]);return Object(l.useEffect)(U,[S]),Object(k.jsx)(k.Fragment,{children:Object(k.jsx)(f.b,{"aria-label":"Record Voice Chat",icon:Object(k.jsx)(De,{style:{color:d?"black":"red"}}),onClick:d?function(){var e=new window.AudioContext,t=e.createScriptProcessor(0,1,1);v(t);navigator.mediaDevices.getUserMedia({audio:!0}).then((function(c){var r=new MediaRecorder(c);r.start(),n(c),a(r),function(c){var n=e.createMediaStreamSource(c);O(n),n.connect(t),t.connect(e.destination)}(c),t.onaudioprocess=function(n){n.playbackTime>180?(c.getAudioTracks().forEach((function(e){e.stop()})),r.stop(),t.disconnect(),e.createMediaStreamSource(c).disconnect(),r.ondataavailable=function(e){I(e.data),j(!0)}):j(!1)}}))}:function(){s&&(s.ondataavailable=function(e){I(e.data),j(!0)}),c&&c.getAudioTracks().forEach((function(e){e.stop()})),s&&s.stop(),g&&g.disconnect(),h&&h.disconnect()}})})},Ae=function(e){var t=e.sendMessage,c=Object(l.useState)(""),n=Object(E.a)(c,2),r=n[0],i=n[1];Object(l.useEffect)((function(){return document.addEventListener("keydown",s),function(){return document.removeEventListener("keydown",s)}}));var s=function(e){e.shiftKey||"Enter"!==e.code&&"NumpadEnter"!==e.code||(e.preventDefault(),t(r),i(""))};return Object(k.jsxs)(v.e,{p:"8px 6px",w:"full",backgroundColor:"white",flexDir:"column",children:[Object(k.jsx)(ze.a,{placeholder:"Enter Chat",fontSize:"14px",rows:2,m:.5,borderColor:"black",p:"5px 5px",resize:"vertical",value:r,onChange:function(e){i(e.target.value)}}),Object(k.jsxs)(v.e,{justifyContent:"right",children:[Object(k.jsx)(Ue,{}),Object(k.jsx)(f.b,{onClick:function(e){t(r),i("")},size:"md",icon:Object(k.jsx)(V.e,{}),"aria-label":"Send Message",m:.5})]})]})},Re=function(e){var t=e.children,c=e.backgroundColor,n=e.color,r=e.headingSize,i=e.p,s=e.headingText;return Object(k.jsxs)(v.e,{width:"full",p:i,backgroundColor:c,color:n,justify:"space-between",children:[Object(k.jsx)(v.g,{mt:"3px",size:r,children:s}),Object(k.jsx)(v.e,{children:t})]})},Pe=function(){var e=Object(l.useContext)(w);return{status:e.status,userName:e.userName,id:e.id}};!function(e){e.Marker="Marker",e.Live="Live",e.Individual="Individual"}(ke||(ke={}));var Ve,Ge=function(e){var t=e.hasHeader,c=e.classUuid,n=e.lectureId,r=(e.customHeader,T()),a=r.socket,o=r.connected,u=Object(l.useState)([]),d=Object(E.a)(u,2),j=d[0],b=d[1],x=Object(l.useRef)({chatMode:ke.Live}),h=Object(l.useRef)(-1),O=Pe().id,f=function(e){switch(e.chatMode){case ke.Live:return"Live Chat";case ke.Marker:return e.markerType===i.QUESTION?"Question":"Discussion";case ke.Individual:return e.peer.name;default:throw new Error("Invalid ChatStatus")}}(x.current),p=Object(l.useContext)(q).language,m=function(e){var t=e.dateStr,c=e.senderId,n=e.senderName,r=e.text,i=e.messageId,s=new Date(t);return{messageId:i,userName:n,message:r,time:"".concat(s.getHours(),":").concat(s.getMinutes()),isMy:c===O}};Object(l.useEffect)((function(){null===a||void 0===a||a.on("TimeMarkerClicked",(function(e,t){h.current=e,x.current={chatMode:ke.Marker,markerType:t},null===a||void 0===a||a.emit("GetMarkerMessages",JSON.stringify({markerId:e}))})),null===a||void 0===a||a.on("GetMarkerMessages",(function(e){var t=e.textMessages;e.status;b((function(e){return[]}));var c=t.map((function(e){return m(e)}));b((function(e){return[].concat(Object(U.a)(e),Object(U.a)(c))}))})),null===a||void 0===a||a.on("LiveChatTextMessage",(function(e){var t=e.message;200===e.status&&x.current.chatMode===ke.Live&&b((function(e){return[].concat(Object(U.a)(e),[m(t)])}))})),null===a||void 0===a||a.on("MarkerTextMessage",(function(e){var t=e.markerId,c=e.savedMessage;200===e.status&&x.current.chatMode===ke.Marker&&h.current===t&&b((function(e){return[].concat(Object(U.a)(e),[m(c)])}))}))}),[o]);return Object(k.jsxs)(v.e,{w:"auto",h:"100vh",backgroundColor:"gray.50",flexDir:"column",align:"center",children:[t&&Object(k.jsx)(Re,{backgroundColor:function(){switch(x.current.chatMode){case ke.Live:return"gray.50";case ke.Marker:return x.current.markerType===i.QUESTION?"#FF4A3E":"#3D9AFC";case ke.Individual:return"#298977";default:throw new Error("Invalid MarkerType")}}(),color:"black",headingSize:"md",headingText:f,p:"5px 15px",children:Object(k.jsx)(ye.a,{marginLeft:"auto",size:"md",onClick:function(){x.current={chatMode:ke.Live},b([])}})}),Object(k.jsx)(v.e,{w:"280px",overflowY:"auto",pb:3,pt:3,flexDir:"column",h:"full",children:j.map((function(e){var t=e.userName,c=e.message,n=e.time,r=e.messageId,i=e.isMy;return Object(k.jsx)(Ee,{userName:t,message:p===s.KO?c.ko.result:c.en.result,time:n,isMy:i},r)}))}),Object(k.jsx)(Ae,{sendMessage:function(e){return function(e){if(0!==e.trim().length)switch(x.current.chatMode){case ke.Live:null===a||void 0===a||a.emit("LiveChatTextMessage",JSON.stringify({classUuid:c,lectureId:n,text:e}));break;case ke.Marker:null===a||void 0===a||a.emit("MarkerTextMessage",JSON.stringify({classUuid:c,lectureId:n,markerTextMessage:{markerId:h.current,message:e}}));break;case ke.Individual:break;default:throw new Error("Invalid ChatStatus")}}(e)}})]})},Fe=function(){var e=Object(h.g)(),t=e.classUuid,c=e.memberType,r=e.lectureId,i=T(),s=i.socket,u=i.connected,d=Object(l.useState)(),j=Object(E.a)(d,2),b=j[0],x=j[1],O=Object(l.useContext)(B),f=O.isLive,p=O.setIsLive,m=O.selectedVidIdx,g=O.setSelectedVidIdx,C=function(){},w=Object(l.useState)([]),S=Object(E.a)(w,2),I=S[0],y=S[1],L={tabTitle:"Playlist",tabContents:I},N=Object(l.useState)([]),z=Object(E.a)(N,2),D=z[0],M=z[1],A={tabTitle:"Participants",tabContents:D},R=Object(l.useState)(_),P=Object(E.a)(R,2),V=P[0],G=P[1],F={tabTitle:"Lecture room",tabContents:V};Object(l.useEffect)((function(){if(c===n.INSTRUCTOR){var e=JSON.stringify({classUuid:t,lectureId:H,status:!f}),r={tabName:"".concat(f?"\u26ab Off":"\ud83d\udd34 Go"," Live"),type:a.NOTICE,message:"toggleLive",onClickHandler:function(){null===s||void 0===s||s.emit("SetLectureLiveStatus",e)}};G([].concat(Object(U.a)(_),[r]))}else{var i={tabName:f?"\ud83d\udd34 On-Live":"\u26ab Off-Live",type:a.NOTICE,message:"notifyLive",onClickHandler:C};G([].concat(Object(U.a)(_),[i]))}}),[f]);var H=parseInt(r,10);return Object(l.useEffect)((function(){if(b){var e=[];he(b.playlist).then((function(c){c.items.forEach((function(c,n){e.push({tabName:c.snippet.title,type:a.VIDEO,videoIdx:n,link:c.snippet.resourceId.videoId,onClickHandler:function(){null===s||void 0===s||s.emit("SelectVideo",{classUuid:t,lectureId:H,selectedVideoIdx:n})}})})),y(e)}))}}),[b]),Object(l.useEffect)((function(){null===s||void 0===s||s.on("JoinLecture",(function(e){var c=e.user,n=e.lecture;if(200===e.status){x(n);var r={tabName:c.userName,type:a.USER,userId:c.id};M((function(e){return[].concat(Object(U.a)(e),[r])}));var i={classUuid:t,lectureId:H};p(n.LiveStatus),n.LiveStatus&&g(n.videoIdx),null===s||void 0===s||s.emit("GetActiveLectureMember",i)}}));var e={classUuid:t,lectureId:H};null===s||void 0===s||s.emit("JoinLecture",e),null===s||void 0===s||s.on("GetActiveLectureMember",(function(e){var t=e.members;if(200===e.status){var c=t.map((function(e){return{tabName:e.userName,type:a.USER,userId:e.id}}));M(c)}})),null===s||void 0===s||s.on("SetLectureLiveStatus",(function(e){var t=e.liveStatus;200===e.status&&p(t)})),null===s||void 0===s||s.on("SelectVideo",(function(e){var t=e.selectedVideoIdx;200===e.status&&g(t)}))}),[u]),console.log(f,c,f&&c===n.STUDENT),Object(k.jsxs)(k.Fragment,{children:[Object(k.jsx)(Y,{}),Object(k.jsxs)(v.e,{children:[Object(k.jsx)(Q,{menus:[F,L,A],memuContext:o.Lecture}),Object(k.jsx)(v.b,{w:"8px",h:"100vh"}),Object(k.jsx)(v.b,{w:"100%",h:"100vh",children:Object(k.jsx)(Ie,{memberType:null!==c&&void 0!==c?c:n.STUDENT,classUuid:null!==t&&void 0!==t?t:"uuid error",lectureId:H,videoIndex:m,videoId:I.length>0?I[m].link:"NULL",width:"100%",height:"100%",isControled:c===n.STUDENT&&f})}),Object(k.jsx)(Ge,{classUuid:t,lectureId:H,hasHeader:!0})]})]})},Be=c(97),He=c(71),Je=c(142),qe=function(e){var t=e.setModalState;return Object(k.jsxs)(k.Fragment,{children:[Object(k.jsxs)(f.a,{w:200,h:200,onClick:function(){t(Ve.JOIN)},children:[Object(k.jsx)(V.d,{w:10,h:10}),Object(k.jsx)("br",{}),"Join"]}),Object(k.jsxs)(f.a,{w:200,h:200,onClick:function(){t(Ve.CREATE)},children:[Object(k.jsx)(V.a,{w:10,h:10}),Object(k.jsx)("br",{}),"Create"]})]})},We=function(e){var t=e.onChangejoinUUID,c=e.handleJoin,n=e.onModalClose;return Object(k.jsxs)(v.j,{children:[Object(k.jsxs)(He.a,{children:[Object(k.jsx)(He.b,{children:"Join ID"}),Object(k.jsx)(Je.b,{size:"lg",children:Object(k.jsx)(Je.a,{type:"text",placeholder:"Class ID",onChange:t})})]}),Object(k.jsx)(f.a,{onClick:c,colorScheme:"blue",mr:3,children:"Join"}),Object(k.jsx)(f.a,{onClick:n,children:"Cancel"})]})},Qe=function(e){var t=e.onChangeTitle,c=e.onChangeSubtitle,n=e.handleCreate,r=e.onModalClose;return console.log(c),Object(k.jsxs)(v.j,{children:[Object(k.jsxs)(He.a,{children:[Object(k.jsx)(He.b,{children:"Class Title"}),Object(k.jsx)(Je.b,{size:"lg",children:Object(k.jsx)(Je.a,{type:"text",placeholder:"Class name",onChange:t})})]}),Object(k.jsxs)(He.a,{children:[Object(k.jsx)(He.b,{children:"Class Subtitle"}),Object(k.jsx)(Je.b,{children:Object(k.jsx)(Je.a,{type:"text",placeholder:"Class Subtitle",onChange:c})})]}),Object(k.jsx)(f.a,{onClick:n,colorScheme:"blue",mr:3,children:"Save"}),Object(k.jsx)(f.a,{onClick:r,children:"Cancel"})]})};!function(e){e[e.INIT=0]="INIT",e[e.JOIN=1]="JOIN",e[e.CREATE=2]="CREATE"}(Ve||(Ve={}));var _e=function(e){var t=e.isOpen,c=e.onClose,n=e.addClass,r=u.a.useState(Ve.INIT),i=Object(E.a)(r,2),s=i[0],a=i[1],o=u.a.useState(""),l=Object(E.a)(o,2),d=l[0],j=l[1],b=u.a.useState(""),x=Object(E.a)(b,2),h=x[0],O=x[1],f=u.a.useState(""),p=Object(E.a)(f,2),g=p[0],C=p[1],w=function(){j(""),O(""),C(""),c(),a(Ve.INIT)};return Object(k.jsxs)(m.a,{isOpen:t,onClose:w,size:"xl",children:[Object(k.jsx)(m.g,{}),Object(k.jsxs)(m.d,{height:"500px",children:[Object(k.jsx)(m.f,{textAlign:"center",fontSize:"30px",fontWeight:"bold",children:"New Class"}),Object(k.jsx)(m.c,{}),Object(k.jsx)(m.b,{pb:6,h:"300px",children:Object(k.jsxs)(v.f,{justifyContent:"center",alignItems:"center",w:"full",h:"full",children:[s===Ve.INIT&&qe({setModalState:a}),s===Ve.JOIN&&We({onChangejoinUUID:function(e){C(e.target.value)},handleJoin:function(){fetch("http://localhost:5000/api/lobby/class",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({uuid:g})}).then((function(e){return e.json()})).then((function(e){if(200===e.status)n(e.class),w();else if(400===e.status)throw new Error(e.err)})).catch((function(e){console.error(e)}))},onModalClose:w}),s===Ve.CREATE&&Qe({onChangeTitle:function(e){j(e.target.value)},onChangeSubtitle:function(e){O(e.target.value)},handleCreate:function(){fetch("http://localhost:5000/api/lobby/class",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:d,subtitle:h})}).then((function(e){return e.json()})).then((function(e){if(200===e.status)n(e.class),w();else if(400===e.status)throw new Error(e.err)})).catch((function(e){console.error(e)}))},onModalClose:w})]})})]})]})},Ye=function(e){e.col;var t=e.children;return Object(k.jsx)(k.Fragment,{children:Object(k.jsx)(v.h,{gridTemplateRows:"repeat(auto-fit, auto)",gridTemplateColumns:"repeat(auto-fit, 270px)",spacing:8,p:5,children:t})})},Ke=c(157),Xe=c.n(Ke),Ze=function(e){e.imgSrc;var t=e.title,c=e.subTitle,n=(e.color,e.backgroundColor,Xe()({title:t})),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n),i=(r?parseInt(r[1],16):0)+(r?parseInt(r[2],16):0)+(r?parseInt(r[3],16):0)<381;return Object(k.jsx)(v.b,{w:"270px",h:150,overflow:"hidden",position:"relative",borderRadius:"30px",color:i?"white":"black",_hover:{cursor:"pointer",boxShadow:"0 0 3px rgba(0,0,0,1)"},children:Object(k.jsxs)(v.e,{p:4,w:"full",h:"100%",position:"absolute",bottom:0,backgroundColor:n,direction:"column",children:[Object(k.jsx)(v.b,{pl:"5px",fontSize:40,fontWeight:"bold",display:"inline",marginTop:"auto",children:"".concat(t,"   ")}),Object(k.jsx)(v.b,{pl:"5px",fontSize:20,fontWeight:"bold",display:"inline",children:"".concat(c)})]})})},$e=function(){var e=Object(l.useState)([]),t=Object(E.a)(e,2),c=t[0],n=t[1],i=Pe().status;Object(l.useEffect)((function(){i===r.LOADED&&fetch("http://localhost:5000/api/lobby/classes",{method:"GET"}).then((function(e){return e.json()})).then((function(e){n(e.classes)})).catch((function(e){return console.error(e)}))}),[i]);return{classes:c,addClass:function(e){n((function(t){return[].concat(Object(U.a)(t),[e])}))}}},et=c.p+"static/media/logo2.7da65d47.svg",tt=c(158),ct=c.n(tt),nt=(c(267),c(268),{dots:!0,arrows:!1,fade:!0,infinite:!0,autoplay:!0,speed:500,autoplaySpeed:5e3,slidesToShow:1,slidesToScroll:1}),rt=function(){var e=u.a.useState(null),t=Object(E.a)(e,2),c=t[0],n=t[1],r=Object(Be.a)({base:"90%",md:"50%"}),i=Object(Be.a)({base:"30%",md:"40px"});return Object(k.jsxs)(v.b,{position:"relative",height:"500px",width:"full",overflow:"hidden",children:[Object(k.jsx)(f.b,{"aria-label":"left-arrow",variant:"ghost",position:"absolute",left:i,top:r,transform:"translate(0%, -50%)",zIndex:2,onClick:function(){return null===c||void 0===c?void 0:c.slickPrev()},children:Object(k.jsx)(V.b,{size:"40px"})}),Object(k.jsx)(f.b,{"aria-label":"right-arrow",variant:"ghost",position:"absolute",right:i,top:r,transform:"translate(0%, -50%)",zIndex:2,onClick:function(){return null===c||void 0===c?void 0:c.slickNext()},children:Object(k.jsx)(V.c,{size:"40px"})}),Object(k.jsx)(ct.a,Object(O.a)(Object(O.a)({},nt),{},{ref:function(e){return n(e)},children:[{title:"LiveClass",text:"Be Live, Whenever, Wherever.",image:"https://images.unsplash.com/photo-1516796181074-bf453fbfa3e6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1yZWxhdGVkfDV8fHxlbnwwfHx8fA%3D%3D&auto=format&fit=crop&w=900&q=60"},{title:"LiveClass",text:"Be Live, Whenever, Wherever.",image:"https://images.unsplash.com/photo-1438183972690-6d4658e3290e?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=2274&q=80"},{title:"LiveClass",text:"Be Live, Whenever, Wherever.",image:"https://images.unsplash.com/photo-1507237998874-b4d52d1dd655?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1yZWxhdGVkfDR8fHxlbnwwfHx8fA%3D%3D&auto=format&fit=crop&w=900&q=60"}].map((function(e,t){return Object(k.jsx)(v.b,{height:"6xl",position:"relative",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundSize:"cover",backgroundImage:"url(".concat(e.image,")"),children:Object(k.jsx)(v.d,{size:"container.lg",height:"500px",position:"relative",children:Object(k.jsxs)(v.j,{spacing:6,w:"full",maxW:"lg",position:"absolute",top:"50%",transform:"translate(0, -50%)",children:[Object(k.jsx)(v.g,{fontSize:{base:"3xl",md:"4xl",lg:"5xl"},children:e.title}),Object(k.jsx)(v.l,{fontSize:{base:"md",lg:"lg"},color:"GrayText",children:e.text})]})})})}))}))]})},it=function(){var e=Object(Be.a)({base:"4",sm:"1",md:"2",lg:"3",xl:"4","2xl":"5"}),t=Object(A.d)(),c=t.isOpen,r=t.onOpen,i=t.onClose,s=$e(),a=s.classes,o=s.addClass;return Object(k.jsxs)(k.Fragment,{children:[Object(k.jsx)(v.b,{h:"80px",w:"100%",bgColor:"black",children:Object(k.jsx)(p.a,{src:et,alt:"liveclass",h:"80px",pl:"8px"})}),Object(k.jsx)(rt,{}),Object(k.jsx)("br",{}),Object(k.jsx)(v.g,{size:"lg",pl:"30px",children:"Teaching Lectures"}),Object(k.jsx)(Ye,{col:e,children:a.filter((function(e){return e.memberType===n.INSTRUCTOR})).map((function(e){var t=e.uuid,c=e.title,n=e.subtitle,r=e.memberType;return Object(k.jsx)(x.b,{to:"/class/".concat(t,"/").concat(r),children:Object(k.jsx)(Ze,{title:c,subTitle:n,color:"white",backgroundColor:"black"})},t)}))}),Object(k.jsx)("br",{}),Object(k.jsx)(v.g,{size:"lg",pl:"30px",children:"Listening Lectures"}),Object(k.jsx)(Ye,{col:e,children:a.filter((function(e){return e.memberType===n.STUDENT})).map((function(e){var t=e.uuid,c=e.title,n=e.subtitle,r=e.memberType;return Object(k.jsx)(x.b,{to:"/class/".concat(t,"/").concat(r),children:Object(k.jsx)(Ze,{imgSrc:"a",title:c,subTitle:n,color:"white",backgroundColor:"black"})},t)}))}),Object(k.jsx)(f.b,{position:"fixed",right:"5%",bottom:"10%",size:"lg","aria-label":"Add Classroom",colorScheme:"green",icon:Object(k.jsx)(V.a,{}),onClick:r}),Object(k.jsx)(_e,{onClose:i,isOpen:c,addClass:o})]})},st=c(144),at=function(e){var t=e.onChangeLecturetitle;return Object(k.jsxs)(v.j,{spacing:"24px",children:[Object(k.jsx)(v.g,{size:"lg",pl:"30px",children:"Lecture Title"}),Object(k.jsx)(He.a,{pl:"30px",children:Object(k.jsx)(Je.a,{type:"text",placeholder:"Lecture Title",onChange:function(e){return t(e)},w:"500px",focusBorderColor:"black"})})]})},ot=function(e){var t=e.onChangeLectureNotice;return Object(k.jsxs)(v.j,{spacing:"24px",children:[Object(k.jsx)(v.g,{size:"md",pl:"30px",children:"Notice"}),Object(k.jsx)(He.a,{pl:"30px",children:Object(k.jsx)(ze.a,{placeholder:"Description",onChange:function(e){return t(e)},focusBorderColor:"black",w:"500px"})})]})},lt=c(159),ut=c.n(lt),dt=(c(269),function(e){var t=e.lectureDate,c=e.setLectureDate;return Object(k.jsxs)(v.j,{spacing:"24px",children:[Object(k.jsx)(v.g,{size:"md",pl:"30px",children:"Lecture Time"}),Object(k.jsx)(v.f,{pl:"30px",children:Object(k.jsx)(ut.a,{selected:t,onChange:function(e){return c(e)},showTimeSelect:!0,timeFormat:"HH:mm",timeIntervals:15,timeCaption:"time",dateFormat:"yyyy.MM.dd h:mm aa"})})]})}),jt=function(e){var t=e.onChangeLecturePlaylist,c=e.Lecturelink,n=e.setLecturequizlist,r=[{id:1,link:"",title:"",quiztime:"",problem:"",answer:""}];return Object(k.jsxs)(v.j,{spacing:"24px",children:[Object(k.jsx)(v.g,{size:"md",pl:"30px",children:"Youtube playlist"}),Object(k.jsxs)(v.l,{size:"sm",pl:"30px",children:["Input Youtube playlist.",Object(k.jsx)("br",{}),"For https://www.youtube.com/playlist?list=PLFt2h1jjxKxwQAQr6Dv5kYP4Uu5cGX1iH",Object(k.jsx)("br",{}),"Just input PLFt2h1jjxKxwQAQr6Dv5kYP4Uu5cGX1iH"]}),Object(k.jsxs)(v.f,{spacing:"5px",pl:"30px",children:[Object(k.jsx)(Je.a,{placeholder:"Youtube Material link",onChange:function(e){return t(e)},focusBorderColor:"black",w:"500px"}),Object(k.jsx)(f.a,{colorScheme:"blue",w:100,onClick:function(){he(c).then((function(e){e.items.forEach((function(e,t){var c={id:t,link:e.snippet.resourceId.videoId,title:e.snippet.title,quiztime:" ",problem:" ",answer:" ",mark:0};r.push(c)})),n(r)}))},children:"Add"}),Object(k.jsx)(f.a,{colorScheme:"red",w:100,onClick:function(){n([{id:1,link:" ",quiztime:" ",problem:" ",answer:" "}])},children:"Remove All"})]})]})},bt=function(e){var t=e.id,c=e.isAddopen,n=e.onAddopen,r=e.onAddclose,i=e.onChangeLectureproblem,s=e.onChangeLectureanswer,a=e.onChangeLecturequiztime,o=e.Lectureproblem,l=e.Lectureanswer,u=e.Lecturequiztime,d=e.setQurrentnumber,j=e.Lecturequizlist,b=e.Qurrentnumber,x=e.setLecturequizlist;return Object(k.jsxs)(v.j,{children:[Object(k.jsx)(f.b,{id:t,"aria-label":"Add to friends",icon:Object(k.jsx)(V.a,{}),onClick:function(e){d(e.target.id),n()}}),Object(k.jsxs)(m.a,{isOpen:c,onClose:r,children:[Object(k.jsx)(m.g,{}),Object(k.jsxs)(m.d,{children:[Object(k.jsx)(m.f,{children:"Create Quiz"}),Object(k.jsx)(m.c,{}),Object(k.jsx)(m.b,{children:Object(k.jsxs)(v.j,{spacing:"20px",children:[Object(k.jsxs)(v.j,{children:[Object(k.jsx)(v.b,{children:"Problem Description"}),Object(k.jsx)(ze.a,{placeholder:"Description",onChange:i,focusBorderColor:"black"})]}),Object(k.jsxs)(v.j,{children:[Object(k.jsx)(v.b,{children:"Answer"}),Object(k.jsx)(Je.a,{type:"text",placeholder:"Problem Answer",onChange:s,focusBorderColor:"black"})]}),Object(k.jsxs)(v.j,{children:[Object(k.jsx)(v.b,{children:"Quiz Open Time"}),Object(k.jsx)(He.b,{children:"If 07:34 please enter 0734"}),Object(k.jsx)(Je.a,{type:"text",placeholder:"Quiz pop up time",onChange:a,focusBorderColor:"black"})]})]})}),Object(k.jsx)(m.e,{children:Object(k.jsx)(f.a,{colorScheme:"blue",mr:3,onClick:function(){var e=Object(U.a)(j);e[b-1].quiztime=u,e[b-1].problem=o,e[b-1].answer=l,e[b-1].mark=1,x(e),r()},children:"Add"})})]})]})]})},xt=function(){var e=Object(A.d)(),t=e.isOpen,c=e.onOpen,n=e.onClose,r=Object(l.useState)(new Date),i=Object(E.a)(r,2),s=i[0],a=i[1],o=Object(l.useState)(""),u=Object(E.a)(o,2),d=u[0],j=u[1],b=Object(l.useState)(""),x=Object(E.a)(b,2),O=(x[0],x[1]),p=Object(l.useState)(""),m=Object(E.a)(p,2),g=m[0],C=m[1],w=Object(l.useState)(""),S=Object(E.a)(w,2),I=S[0],y=S[1],L=Object(l.useState)(""),N=Object(E.a)(L,2),z=N[0],D=N[1],M=Object(l.useState)(""),P=Object(E.a)(M,2),G=P[0],F=P[1],B=Object(l.useState)(""),H=Object(E.a)(B,2),J=H[0],q=H[1],W=Object(l.useState)([{id:0,playlist:g,link:"Lecture Link",title:"Video Title",quiztime:"Lecture Quiz Time",problem:"Lecture Problem",answer:"Lecture Answer",mark:0}]),Q=Object(E.a)(W,2),_=Q[0],Y=(Q[1],Object(l.useState)([{id:1,playlist:g,link:" ",title:" ",quiztime:" ",problem:" ",answer:" ",mark:0}])),K=Object(E.a)(Y,2),X=K[0],Z=K[1],$=T(),ee=$.socket,te=($.connected,Object(h.g)().classUuid),ce=Object(h.f)(),ne=Object(R.a)(),re=function(e){D(e.target.value)},ie=function(e){F(e.target.value)},se=function(e){y(e.target.value)},ae=function(e){oe(e.target.id)},oe=function(e){var t=Object(U.a)(X);t[e-1].quiztime=" ",t[e-1].problem=" ",t[e-1].answer=" ",t[e-1].mark=0,Z(t)},le=X.map((function(e){return Object(k.jsx)(st.a,{variant:"simple",size:"sm",children:Object(k.jsx)(st.b,{children:Object(k.jsxs)(st.e,{align:"left",children:[Object(k.jsx)(st.c,{align:"left",width:"5%",children:e.id}),Object(k.jsx)(st.c,{align:"left",width:"15%",children:e.title}),Object(k.jsx)(st.c,{align:"left",width:"10%",children:e.quiztime}),Object(k.jsx)(st.c,{align:"left",width:"15%",children:e.problem}),Object(k.jsx)(st.c,{align:"left",width:"5%",children:e.answer}),Object(k.jsx)(st.c,{align:"center",width:"5%",children:Object(k.jsx)(bt,{id:e.id,isAddopen:t,onAddopen:c,onAddclose:n,onChangeLectureproblem:re,onChangeLectureanswer:ie,onChangeLecturequiztime:se,Lectureproblem:z,Lectureanswer:G,Lecturequiztime:I,setQurrentnumber:q,Lecturequizlist:X,Qurrentnumber:J,setLecturequizlist:Z})}),Object(k.jsx)(st.c,{align:"center",width:"5%",children:Object(k.jsx)(f.b,{id:e.id,"aria-label":"Add to friends",icon:Object(k.jsx)(V.i,{}),onClick:ae})})]})})})})),ue=_.map((function(e){return Object(k.jsx)(st.a,{variant:"simple",children:Object(k.jsx)(st.d,{children:Object(k.jsxs)(st.e,{align:"left",children:[Object(k.jsx)(st.c,{align:"left",width:"5%",children:e.id}),Object(k.jsx)(st.c,{align:"left",width:"15%",children:e.title}),Object(k.jsx)(st.c,{align:"left",width:"10%",children:e.quiztime}),Object(k.jsx)(st.c,{align:"left",width:"15%",children:e.problem}),Object(k.jsx)(st.c,{align:"left",width:"5%",children:e.answer}),Object(k.jsx)(st.c,{align:"center",width:"5%",children:"Add"}),Object(k.jsx)(st.c,{align:"center",width:"5%",children:"Remove"})]})})})}));return Object(k.jsxs)(k.Fragment,{children:[Object(k.jsxs)(v.j,{spacing:"24px",children:[Object(k.jsx)(v.c,{bg:"black",h:"100px",color:"white",fontSize:"2xl",children:"Create Lecture"}),Object(k.jsx)(at,{onChangeLecturetitle:function(e){j(e.target.value)}}),Object(k.jsx)(ot,{onChangeLectureNotice:function(e){O(e.target.value)}}),Object(k.jsx)(dt,{lectureDate:s,setLectureDate:a}),Object(k.jsx)(jt,{Lecturequizlist:X,onChangeLecturePlaylist:function(e){C(e.target.value)},Lecturelink:g,setLecturequizlist:Z}),Object(k.jsx)(v.g,{size:"md",pl:"30px",children:"Quiz List"}),Object(k.jsx)("ol",{children:ue}),Object(k.jsx)("ol",{children:le})]}),Object(k.jsx)("br",{}),Object(k.jsx)("br",{}),Object(k.jsx)("br",{}),Object(k.jsxs)(v.e,{children:[Object(k.jsx)(v.i,{}),Object(k.jsx)(f.a,{leftIcon:Object(k.jsx)(V.f,{}),colorScheme:"blue",mr:3,w:150,h:50,onClick:function(){var e=JSON.stringify({classUuid:te,lectureDate:s,lectureName:d,playlist:g});null===ee||void 0===ee||ee.emit("CreateLecture",e),ce(-1),ne({title:"New lecture created",status:"success",duration:1500,isClosable:!0})},children:"Create Lecture"}),Object(k.jsx)(f.a,{leftIcon:Object(k.jsx)(V.g,{}),colorScheme:"red",mr:50,w:150,h:50,onClick:function(){return ce(-1)},children:"Cancel"})]}),Object(k.jsx)("br",{})]})},ht=function(){return Object(k.jsx)("div",{className:"App",children:Object(k.jsxs)(M,{url:"http://localhost:5000/",children:[Object(k.jsx)(y,{}),Object(k.jsx)(x.a,{children:Object(k.jsxs)(h.c,{children:[Object(k.jsx)(h.a,{path:"/",element:Object(k.jsx)(it,{})}),Object(k.jsx)(h.a,{path:"class/:classUuid/:memberType",element:Object(k.jsx)(ge,{})}),Object(k.jsx)(h.a,{path:"class/:classUuid/:memberType/createLecture",element:Object(k.jsx)(xt,{})}),Object(k.jsx)(h.a,{path:"class/:classUuid/:memberType/:lectureId",element:Object(k.jsx)(Fe,{})})]})})]})})};Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));var Ot=function(e){e&&e instanceof Function&&c.e(3).then(c.bind(null,332)).then((function(t){var c=t.getCLS,n=t.getFID,r=t.getFCP,i=t.getLCP,s=t.getTTFB;c(e),n(e),r(e),i(e),s(e)}))},ft=function(e){var t=e.children,c=Object(l.useState)(""),n=Object(E.a)(c,2),i=n[0],s=n[1],a=Object(l.useState)(r.LOADING),o=Object(E.a)(a,2),u=o[0],d=o[1],j=Object(l.useState)(-1),b=Object(E.a)(j,2),x=b[0],h=b[1];return Object(l.useEffect)((function(){u===r.LOADING&&fetch("http://localhost:5000/api/me",{method:"GET"}).then((function(e){return e.json()})).then((function(e){401===e.status?d(r.NOTLOADED):200===e.status&&(console.log("Logged IN"),s(e.userName),h(e.id),d(r.LOADED))})).catch((function(e){return console.error(e)}))}),[]),Object(k.jsx)(w.Provider,{value:{userName:i,status:u,id:x},children:t})},pt=function(e){var t=e.children,c=Object(l.useState)(0),n=Object(E.a)(c,2),r=n[0],i=n[1],s=Object(l.useState)(!1),a=Object(E.a)(s,2),o=a[0],u=a[1];return Object(k.jsx)(B.Provider,{value:{isLive:o,setIsLive:u,selectedVidIdx:r,setSelectedVidIdx:i},children:t})},mt=function(e){var t=e.children,c=Object(l.useState)(s.KO),n=Object(E.a)(c,2),r=n[0],i=n[1];return Object(k.jsx)(q.Provider,{value:{language:r,setLanguage:i},children:t})};j.a.render(Object(k.jsx)(u.a.StrictMode,{children:Object(k.jsx)(b.a,{children:Object(k.jsx)(ft,{children:Object(k.jsx)(pt,{children:Object(k.jsx)(mt,{children:Object(k.jsx)(ht,{})})})})})}),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()})).catch((function(e){console.error(e.message)})),Ot()}},[[311,1,2]]]);
  //# sourceMappingURL=main.a16ac1f7.chunk.js.map