1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6447],{9445:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/games/bug_sorting",function(){return t(7112)}])},1191:function(e,n,t){"use strict";t.d(n,{Z:function(){return a}});var r=t(2784),i=t(2589);function a(e){var n=e.activityKey,t=e.classroomId,a=(0,r.useRef)(Date.now()),o=(0,r.useRef)(!0),s=(0,r.useRef)(0),c=(0,r.useRef)(0),u=(0,r.useRef)(0),l=(0,r.useRef)(null),d=i.S.useMutation(["user.logActivityTime"]).mutate;return(0,r.useEffect)((function(){if(Number.isFinite(t)&&!(t<=0)&&n){a.current=Date.now(),o.current=!0,s.current=0,c.current=0,u.current=0;var e=function(){var e=function(){var e=Date.now(),n=o.current?e-a.current:0;return Math.floor((s.current+n)/1e3)}()-c.current-u.current;e<=0||(u.current+=e,d({classroomId:t,activityKey:n,seconds:e},{onSuccess:function(){c.current+=e,u.current=Math.max(0,u.current-e)},onError:function(n){console.error("Failed to log activity time",n),u.current=Math.max(0,u.current-e)}}))},r=function(){var n=Date.now();"hidden"===document.visibilityState?(o.current&&(s.current+=n-a.current,o.current=!1),e()):o.current||(a.current=n,o.current=!0)},i=function(){var e=Date.now();o.current&&(s.current+=e-a.current,o.current=!1);var r=Math.floor(s.current/1e3)-c.current-u.current;r>0&&function(e){if(!e||e<=0)return!1;var r=new Blob([JSON.stringify({0:{classroomId:t,activityKey:n,seconds:Math.round(e)}})],{type:"application/json"});try{var i;return Boolean(null===(i=navigator.sendBeacon)||void 0===i?void 0:i.call(navigator,"/api/trpc/user.logActivityTime?batch=1",r))}catch(a){return console.error("Beacon failed",a),!1}}(r)&&(c.current+=r)};return document.addEventListener("visibilitychange",r),window.addEventListener("pagehide",i),l.current=window.setInterval(e,5e3),function(){document.removeEventListener("visibilitychange",r),window.removeEventListener("pagehide",i),l.current&&clearInterval(l.current),o.current&&(s.current+=Date.now()-a.current,o.current=!1);var e=Math.floor(s.current/1e3)-c.current-u.current;e>0&&d({classroomId:t,activityKey:n,seconds:e})}}}),[n,t]),null}},2025:function(e,n,t){"use strict";var r=t(2322),i=t(2448),a=t.n(i),o=t(8090),s=t(2870),c=t(7841),u=t(5632);n.Z=function(e){var n=e.finalMessage,t=e.starImg,i=e.openModal,l=e.setOpenModal,d=e.currScore,p=e.onLevelEnd;(0,u.useRouter)();return(0,r.jsx)(o.u,{centered:!0,opened:i,onClose:function(){return l(!1)},withCloseButton:!1,closeOnClickOutside:!1,className:a().test,children:(0,r.jsxs)("div",{className:a().final_modal,children:[(0,r.jsx)(s.E,{height:120,width:400,className:a().stars,src:"/icons/"+t}),(0,r.jsx)("div",{className:a().final_message,children:n}),(0,r.jsx)(c.z,{className:a().modal_button,radius:"xl",size:"md",onClick:function(){return window.location.reload()},children:"Retry"}),(0,r.jsx)(c.z,{className:a().modal_button,radius:"xl",size:"md",onClick:function(){l(!1),p&&p(d)},children:"Move to Next Level"})]})})}},5628:function(e,n,t){"use strict";t.d(n,{E:function(){return i},e:function(){return r}});var r=8,i=4},5238:function(e,n,t){"use strict";var r=t(2228),i=t(3725),a=t(5036),o=t(5628);function s(){var e=(0,r.Z)(["\n padding: ","px;\n transition: background-color ease 0.2s;\n flex-grow: 1;\n user-select: none;\n position: relative;\n\n &:focus {\n outline: 2px solid ",";\n outline-offset: 2px;\n }\n"]);return s=function(){return e},e}n.Z=i.Z.h4(s(),o.e,a.Vi)},7392:function(e,n,t){"use strict";t.d(n,{Zn:function(){return u},fh:function(){return l}});var r=t(7842),i=t(865),a=t(6670),o=t(6383),s=t(930);function c(e,n,t){var r=(0,s.Z)(e),i=(0,o.Z)(r.splice(n,1),1)[0];return r.splice(t,0,i),r}var u=function(e){var n,t=e.fossilMap,o=e.source,u=e.destination,l=(0,s.Z)(t[o.droppableId]),d=(0,s.Z)(t[u.droppableId]),p=l[o.index];if(o.droppableId===u.droppableId){var f=c(l,o.index,u.index);return{fossilMap:(0,a.Z)((0,i.Z)({},t),(0,r.Z)({},o.droppableId,f))}}return l.splice(o.index,1),d.splice(u.index,0,p),{fossilMap:(0,a.Z)((0,i.Z)({},t),(n={},(0,r.Z)(n,o.droppableId,l),(0,r.Z)(n,u.droppableId,d),n))}};var l=function(e){var n,t=e.optionsMap,o=e.source,u=e.destination,l=(0,s.Z)(t[o.droppableId]),d=(0,s.Z)(t[u.droppableId]),p=l[o.index];
1if(o.droppableId===u.droppableId){var f=c(l,o.index,u.index);return{optionsMap:(0,a.Z)((0,i.Z)({},t),(0,r.Z)({},o.droppableId,f))}}return l.splice(o.index,1),d.splice(u.index,0,p),{optionsMap:(0,a.Z)((0,i.Z)({},t),(n={},(0,r.Z)(n,o.droppableId,l),(0,r.Z)(n,u.droppableId,d),n))}}},2835:function(e,n,t){"use strict";var r=t(2322),i=t(449),a=t.n(i),o=t(4761);n.Z=function(e){var n=e.imgPath,t="url(/icons/"+n+".svg)",i=(0,o.rZ)();return(0,r.jsx)("div",{className:a().icon,style:{backgroundImage:t,backgroundColor:"checkLarge"===n?i.colors.cyan[7]:"xLarge"===n?"#bb1717":"transparent"}})}},7112:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return me}});var r=t(2322),i=t(6766),a=t.n(i),o=t(1783),s=t(8788),c=t(2228),u=t(930),l=t(2970),d=t(2784),p=t(5117),f=t(7841),g=t(7973),m=t(6335),h=t(7082),v=t(3575),x=t(9454),_=t(2835),b=t(2589),w=t(3750),y=t(2025),Z=t(3725),j=t(581),C=t(4297),S=t(865),N=t(5460),k=t(4756),E=t(7392),I=t(6670),P=t(5036),M=t(5628);function O(){var e=(0,c.Z)(["\n border-radius: ","px;\n width:auto;\n box-shadow: ",";\n box-sizing: border-box;\n user-select: none;\n height:auto\n aspect-ratio: 5 / 4; \n margin: 3px;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: rgba(26, 85, 70, 0.4);\n color: ",";\n padding: 4px;\n &:hover,\n &:active {\n color: ",";\n text-decoration: none;\n }\n\n &:focus {\n outline: none;\n box-shadow: none;\n }\n"]);return O=function(){return e},e}var D=Z.Z.a(O(),M.E,(function(e){return e.isDragging?"2px 2px 1px ".concat(P.n2):"none"}),P.xA,P.xA);function L(e,n){return n?(0,S.Z)({},e.draggableProps.style,n):e.draggableProps.style}function A(e){var n=e.option,t=e.isDragging,i=e.isGroupedOver,a=e.provided,o=e.style,s=(e.isClone,e.index);return(0,r.jsx)(D,(0,I.Z)((0,S.Z)({isDragging:t,isGroupedOver:Boolean(i),ref:a.innerRef},a.draggableProps,a.dragHandleProps),{style:L(a,o),"data-is-dragging":t,"data-testid":n.id,"data-index":s,children:(0,r.jsx)("div",{style:{color:"white",fontSize:"1.2rem"},children:n.title})}))}var T=d.memo(A),z=t(5238);function R(){var e=(0,c.Z)(["\n height: 45vh; \n max-height: 400px;\n aspect-ratio: 5 / 4; \n border-radius: 5px;\n background-size: contain;\n background-position: center;\n background-repeat: no-repeat;\n"]);return R=function(){return e},e}function F(){var e=(0,c.Z)(["\n background-color: #088585;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n opacity: ",";\n padding: 0.5vh 0.5vw;\n border: ","px solid transparent;\n border-radius: 10px;\n transition:\n background-color 0.2s ease,\n opacity 0.1s ease;\n user-select: none;\n"]);return F=function(){return e},e}function G(){var e=(0,c.Z)(["\n display: flex;\n flex-direction: row;\n flex-wrap: wrap; \n justify-content: center;\n align-items: center; \n gap: 2px; \n width:100%;\n min-width: 10vw;\n min-height: ","px;\n background-color: transparent;\n flex-direction: ",";\n\n"]);return G=function(){return e},e}function B(){var e=(0,c.Z)(["\n background-color: transparent;\n align-items: center;\n width: 100%;\n "]);return B=function(){return e},e}function W(){var e=(0,c.Z)(["\n overflow-y: auto;\n display: flex;\n flex-direction: row;\n\n max-height: ","px"]);return W=function(){return e},e}var K=Z.Z.div(R()),H=Z.Z.div(F(),(function(e){return e.isDropDisabled?.5:"inherit"}),M.e),V=Z.Z.div(G(),40,(function(e){return e.imgPath?"column":"row"})),U=Z.Z.div(B()),Y=Z.Z.div(W(),40);function J(e){var n;return(0,r.jsx)(r.Fragment,{children:null===(n=e.options)||void 0===n?void 0:n.map((function(e,n){return(0,r.jsx)(k._l,{draggableId:e.id.toString(),index:n,children:function(n,t){return(0,r.jsx)(T,{option:e,isDragging:t.isDragging,isGroupedOver:Boolean(t.combineTargetFor),provided:n},e.id)}},e.id)}))})}var X=d.memo(J);function q(e){e.gameName;var n=e.options,t=e.dropProvided,i=e.title?(0,r.jsx)(z.Z,{children:e.title}):null;return(0,r.jsxs)(U,{children:[(0,r.jsx)(p.x,{children:i}),(0,r.jsxs)(V,{ref:t.innerRef,imgPath:e.imgPath,children:[e.imgPath&&(0,r.jsx)(K,{style:{backgroundImage:e.imgPath,backgroundPosition:"center",backgroundSize:"contain"}}),(0,r.jsx)(X,{options:n}),t.placeholder]})]})}function Q(e){var n=e.gameName,t=e.ignoreContainerClipping,i=e.internalScroll,a=e.scrollC
1ontainerStyle,o=e.isDropDisabled,s=e.isCombineEnabled,c=e.listId,u=void 0===c?"LIST":c,l=e.listType,d=e.options,p=e.title,f=e.imgPath,g=e.useClone;return(0,r.jsx)(k.bK,{droppableId:u,type:l,ignoreContainerClipping:t,isDropDisabled:o,isCombineEnabled:s,renderClone:g?function(e,n,t){return(0,r.jsx)(T,{option:d[t.source.index],provided:e,isDragging:n.isDragging,isClone:!0})}:void 0,children:function(e,t){return(0,r.jsx)(H,(0,I.Z)((0,S.Z)({isDraggingOver:t.isDraggingOver,isDropDisabled:Boolean(o),isDraggingFrom:Boolean(t.draggingFromThisWith)},e.droppableProps),{children:i?(0,r.jsx)(Y,{style:a,children:(0,r.jsx)(q,{gameName:n,options:d,title:p,dropProvided:e,imgPath:f})}):(0,r.jsx)(q,{gameName:n,options:d,title:p,dropProvided:e,imgPath:f})}))}})}function $(){var e=(0,c.Z)(["\n min-height: 40vh;\n display: flex;\n flex-direction: column;\n max-width: 100%;\n align-items: center;\n"]);return $=function(){return e},e}function ee(){var e=(0,c.Z)(["\n min-width: 5px;\n @media (max-width: 1024px) {\n min-width: 10px;\n }\n\n @media (max-width: 768px) {\n min-width: 5px; \n }\n padding: 2px 2px;\n\n"]);return ee=function(){return e},e}function ne(){var e=(0,c.Z)(["\n max-width: 100%;\n min-height: 10vh;\n margin: 2% 2%;\n flex: 1;\n @media (max-width: 1024px) {\n min-width: 300px; \n max-width: 520px;\n }\n\n @media (max-width: 768px) {\n min-width: 240px; \n max-width: 400px;\n }\n\n"]);return ne=function(){return e},e}function te(){var e=(0,c.Z)(["\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n flex-wrap: wrap;\n max-width: 1200px; \n"]);return te=function(){return e},e}function re(){var e=(0,c.Z)(["\n width: 100%;\n max-width: 1200px; \n height: 58vh; \n overflow-y: hidden; \n padding-bottom: 5px; \n display: flex;\n flex-direction: column; \n align-items: center; \n margin: 4px 4px; \n overflow-x:hidden;\n\n"]);return re=function(){return e},e}var ie=Z.Z.div($()),ae=Z.Z.div(ee()),oe=Z.Z.div(ne()),se=Z.Z.div(te()),ce=Z.Z.div(re()),ue=function(e){(0,C.Z)(t,e);var n=(0,N.Z)(t);function t(){var e;return(0,j.Z)(this,t),(e=n.apply(this,arguments)).state={optionsMap:e.props.initial,answered:!1,ansCat:0,buttonDisabled:!1},e.handleOnClick=function(){var n;if(!e.state.buttonDisabled){var t=0;e.props.onOptionsMapUpdate(e.state);var r=e.state.optionsMap.answer||[],i=!1;1===r.length&&(null===(n=e.props.fossil.fossilType)||void 0===n?void 0:n.includes(r[0].title))&&(i=!0),i?(1,t=1,e.setState({buttonDisabled:!0})):t=0,e.setState({answered:!0,ansCat:t})}},e.onDragEnd=function(n){if(n.destination){var t=n.source,r=n.destination;e.setState((function(e){var i=(0,S.Z)({},e.optionsMap);if("answer"===r.droppableId){if(i.answer.length>0){var a=i.answer[0];i.choices.push(a)}i[t.droppableId]=i[t.droppableId].filter((function(e){return e.id!==Number(n.draggableId)}));var o=e.optionsMap[t.droppableId].find((function(e){return e.id===Number(n.draggableId)}));o&&(i.answer=[o])}else{var s=(0,E.fh)({optionsMap:i,source:t,destination:r});"optionsMap"in s&&(i=s.optionsMap)}return{optionsMap:i}}))}},e}var i=t.prototype;return i.componentDidUpdate=function(e){e.currSample!==this.props.currSample&&this.setState({buttonDisabled:!1})},i.render=function(){var e=this.state.optionsMap;return(0,r.jsxs)("div",{children:[(0,r.jsx)(k.Z5,{onDragEnd:this.onDragEnd,children:(0,r.jsxs)(ie,{children:[(0,r.jsx)(se,{children:(0,r.jsx)(Q,{gameName:this.props.gameName,listId:"choices",listType:"card",isDropDisabled:!1,options:e.choices})}),(0,r.jsxs)(ce,{children:[(0,r.jsx)(ae,{children:this.state.answered&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:a().emptySmall}),0===this.state.ansCat?(0,r.jsx)("div",{className:a().incorrectAnsSmall},this.props.currSample):(0,r.jsx)("div",{className:a().correctAnsSmall},this.props.currSample)]})}),(0,r.jsx)(oe,{children:(0,r.jsx)(Q,{gameName:this.props.gameName,listId:"answer",listType:"card",isDropDisabled:!1,options:e.answer,imgPath:this.props.fossil.imagePath})})]})]})}),(0,r.jsx)(f.z,{onClick:this.handleOnClick,className:a().finished_button,radius:"xl",size:"md",disabled:this.state.buttonDisabled,children:"Check Answer"})]})},t}(d.Component);function le(){var e=(0,c.Z)(["\n width: 100%;\n max-width: 1200px; \n height: 110vh; \n overflow-y: auto; \n padding-bottom: 20px; \n display: flex;\n flex-direction: column; \n align-items: center; \n margin: 0 auto; \n overflow-x:hidden;\n\n"]);return le=function(){return e},e}var de=Z.Z.div(le());function pe(e){for(var n=e.length-1;n>0;
1n--){var t=Math.floor(Math.random()*(n+1)),r=e[n];e[n]=e[t],e[t]=r}return e}var fe=function(e){var n=e.titles,t=e.numCards,i=e.numCardsPerCat,o=e.categoriesArr,c=e.gameName,Z=e.gameEnd,j=e.multiLevel,C=e.foldersArr,S=e.onGameEnd,N=e.surveyConfig,k=function(e){return(0,x.yk)(e).then((function(e){if(e){var n=e.map((function(e){return e.split("/").pop()||""}));return Array.isArray(n)&&n.every((function(e){return"string"===typeof e}))?n:[]}})).catch((function(e){return console.warn(e),[]}))},E=(0,d.useContext)(g.Z),I=(0,d.useState)([]),P=I[0],M=I[1],O=(0,d.useState)([]),D=O[0],L=O[1],A=(0,d.useState)(-1),T=A[0],z=A[1],R=(0,d.useState)(!1),F=R[0],G=R[1],B=(0,d.useState)(!1),W=B[0],K=B[1],H=(0,d.useState)("star1.svg"),V=H[0],U=H[1],Y=(0,d.useState)(!1),J=Y[0],X=Y[1],q=(0,d.useState)(),Q=q[0],$=q[1],ee=(0,d.useState)(""),ne=ee[0],te=ee[1],re=(0,d.useState)(3),ie=re[0],ae=re[1],oe=(0,d.useState)(3),se=oe[0],ce=oe[1],le=(0,d.useState)(3),fe=le[0],ge=le[1],me=(0,d.useState)(0),he=me[0],ve=me[1],xe=(0,d.useState)(o[0]),_e=(xe[0],xe[1],(0,d.useState)(n[0])),be=_e[0],we=_e[1],ye=(0,d.useState)(j?["round1","round2"]:[]),Ze=ye[0],je=ye[1],Ce=(0,d.useState)(!1),Se=Ce[0],Ne=Ce[1],ke=b.S.useMutation(["games.saveUserScore"]).mutate,Ee=(0,d.useState)({choices:D,answer:[]}),Ie=Ee[0],Pe=Ee[1];function Me(e,n,t,r){return Oe.apply(this,arguments)}function Oe(){return(Oe=(0,s.Z)((function(e,n,t,r){return(0,l.__generator)(this,(function(i){return"Bivalvia"!==n[0]&&"Gastropoda"!==n[0]||n.push("Other"),[2,k(e).then((function(i){return pe(i),null===(i=null===i||void 0===i?void 0:i.filter((function(e){return""!==e})).slice(0,t))||void 0===i?void 0:i.map((function(t){var i={id:r,imagePath:"url("+(0,x.a9)("".concat(e,"/").concat(t.replaceAll(" ","")))+")",fossilType:n};return r++,i}))})).catch((function(e){return console.error("Error creating fossils from folder:",e),[]}))]}))}))).apply(this,arguments)}function De(e){return Le.apply(this,arguments)}function Le(){return(Le=(0,s.Z)((function(e){var n,r,a,s,c,u,d,p;return(0,l.__generator)(this,(function(l){switch(l.label){case 0:n=[],r=[],a=0,s=0,l.label=1;case 1:if(!(s<o[e].length))return[3,6];c=o[e][s],u=C[e][s],d=0,l.label=2;case 2:return d<u.length?[4,Me(u[d],[c[d]],i,a)]:[3,5];case 3:p=l.sent(),r=r.concat(p),a=n.length,d===u.length-1&&(pe(r),n=n.concat(r.slice(0,i)),r=[]),l.label=4;case 4:return d++,[3,2];case 5:return s++,[3,1];case 6:return pe(n),[2,n.slice(0,t)]}}))}))).apply(this,arguments)}(0,d.useEffect)((function(){Ne(!1),Pe({choices:D,answer:[]}),setTimeout((function(){Ne(!0)}),100)}),[T]);var Ae=function(e){var n=0,t=[],r=new Set;o[e].forEach((function(e){"string"===typeof e?r.has(e)||(r.add(e),t.push({id:n++,title:e})):Array.isArray(e)&&e.forEach((function(e){r.has(e)||(r.add(e),t.push({id:n++,title:e}))}))})),L(t)};(0,d.useEffect)((function(){function e(){return(e=(0,s.Z)((function(){var e;return(0,l.__generator)(this,(function(n){switch(n.label){case 0:return[4,De(0)];case 1:return e=n.sent(),M(e),$(Array(e.length).fill(!0)),z((function(e){return e+1})),Ae(0),[2]}}))}))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[]);var Te=function(){var e=(0,s.Z)((function(){var e,n,t,r,i,a,o;return(0,l.__generator)(this,(function(s){switch(s.label){case 0:return F?[3,2]:(e=P.length,n=Q.filter((function(e){return!0===e})).length,ae(n/e*3),M([]),L([]),[4,De(1)]);case 1:return t=s.sent(),M(t),$(Array(t.length).fill(!0)),z((function(e){return 0})),Ae(1),ve((function(e){return e+1})),X(!1),G(!0),[3,3];case 2:r=P.length,i=Q.filter((function(e){return!0===e})).length,ge(a=(ie+i/r*3)/2),3===a?(U("star3.svg"),te("Perfect! Great job!")):a>=2&&a<3?(a=2,U("star2.svg"),te("Not bad! You can do better")):(a=1,U("star1.svg"),te("Not bad! You can do better")),o={},Z&&ke((o.classroomId=parseInt(E.currentClass),o.name=c,o.score=a,o)),K(!0),s.label=3;case 3:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}(),ze=function(){var e=(0,s.Z)((function(e){var t,i,a;return(0,l.__generator)(this,(function(o){return i={},a={},1===e.optionsMap.answer.length&&(null===(t=P[T].fossilType)||void 0===t?void 0:t.includes(e.optionsMap.answer[0].title))?((0,v.c0)((i.id="CorrectGuess",i.message="Correct!",i.disallowClose=!1,i.autoClose=2500,i.icon=(0,r.jsx)(m.Z,{}),i)),j&&!F&&T===P.length-1?(we(n[1]),je((function(e){var n=(0,u.Z)(e);return n[he]="checkLarge",n})),X(!0)):T!==P.length-1?setTimeout((0,s.Z)((function(){return(0,l.__generator)(this,(function(e){return z((function(e){return e+1})),[2]}))})),3e3):X(!0)):(F?se>1&&ce(Math.max(0,se-1)):ie>1&&ae(Math.max(0,ie-1)),$((function(e){return e[T]=!1,e})),(0,v.c0)((a.id="IncorrectGuess",a.message="That is not quite right. Try again!",a.disallowClose=!1,a.autoClose=2500,a.icon=(0,r.jsx)(h.Z,{}),a.color="red",a))),[2]}))}));return function(n){return e.apply(this,arguments)}}();return(0,r.jsx)("div",{className:a().root_div,children:(0,r.jsxs)(de,{children:[(0,r.jsx)("div",{className:a().round_container,children:Ze.map((function(e,n){return(0,r.jsx)(_.Z,{imgPath:e},n)}))}),Z&&(0,r.jsx)(w.Z,{finalMessage:ne,starImg:V,openModal:W,setOpenModal:K,gameName:c,surveyConfig:N}),!Z&&(0,r.jsx)(y.Z,{finalMessage:ne,starImg:V,openModal:W,setOpenModal:K,currScore:fe,onLevelEnd:S}),(0,r.jsx)("div",{className:a().instructions,children:(0,r.jsx)(p.x,{children:be})}),(0,r.jsx)("div",{className:a().game_instructions,children:(0,r.jsx)(p.x,{children:"Drag the correct option to the image and click Check Answer"})}),Se&&P.length>0&&!J&&T>=0&&(0,r.jsxs)(p.x,{className:a().remaining_counter,children:[P.length-T," fossil",P.length-T===1?"":"s"," remaining"]}),Se&&P.length>0&&!J&&(0,r.jsx)(ue,{gameName:c,initial:Ie,fossil:P[T],currSample:T,numCards:t,onOptionsMapUpdate:ze}),(0,r.jsx)("div",{style:{color:"white",fontWeight:200,paddingTop:"5vh",textAlign:"center"}}),J&&(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{style:{height:"60vh",objectFit:"cover",zIndex:10,transitionDuration:"0.5s",border:"2px solid #088585",display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:"20px",padding:"20px"},children:P.map((function(e,n){return(0,r.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[(0,r.jsx)("div",{className:a().fossil_result_image,style:{backgroundImage:e.imagePath,width:"10vw",height:"10vh",backgroundSize:"contain"}}),(0,r.jsx)("div",{className:a().emptySmall}),!1===Q[n]?(0,r.jsx)("div",{className:a().incorrectAnsSmall}):(0,r.jsx)("div",{className:a().correctAnsSmall})]},n)}))}),(0,r.jsx)("div",{style:{gridColumn:"span 3",textAlign:"center"},children:(0,r.jsx)(f.z,{className:a().next_round_button,onClick:Te,children:!j||F?"Finish Game":"Proceed to Next Round"})})]})]})})},ge=t(1191);var me=function(e){var n=e.handleLogout,t=(0,d.useContext)(g.Z);return(0,r.jsxs)("div",{className:a().background,children:[(0,r.jsx)(o.Z,{handleLogout:n}),t.currentClass&&(0,r.jsx)(ge.Z,{activityKey:"bug_sorting",classroomId:parseInt(t.currentClass)}),(0,r.jsx)(fe,{titles:["Distinguish between ostracoda and foraminifera","Distinguish between benthic and planktonic foraminifera"],numCards:10,numCardsPerCat:5,categoriesArr:[[["Ostracod
1a"],["Foraminifera","Foraminifera"],["Bivalvia","Gastropoda","Other"]],[["Benthic foram"],["Planktonic foram"]]],foldersArr:[[["distinguishGame/ostracoda"],["distinguishGame/foraminifera","distinguishGame/planktonics"],["distinguishGame/bivalvia","distinguishGame/gastropoda","distinguishGame/others"]],[["distinguishGame/foraminifera"],["distinguishGame/planktonics"]]],gameName:"bug_sorting",gameEnd:!0,multiLevel:!0,surveyConfig:w.C})]})}},9454:function(e,n,t){"use strict";t.d(n,{DE:function(){return v},Ix:function(){return c},JF:function(){return f},Kk:function(){return x},NO:function(){return d},a9:function(){return h},ao:function(){return g},h0:function(){return o},yk:function(){return _}});var r=t(8788),i=t(2838),a=t(2970);function o(e,n,t){return s.apply(this,arguments)}function s(){return(s=(0,r.Z)((function(e,n,t){return(0,a.__generator)(this,(function(r){return(0,i.Z)(e,File)?[2,new Promise((function(r,i){var a=new FormData;a.append("image",e),a.append("fossilType",n);var o=new XMLHttpRequest;o.upload.addEventListener("progress",(function(e){if(e.lengthComputable){var n=Math.round(e.loaded/e.total*100);t({percentage:n,status:"uploading"})}})),o.addEventListener("load",(function(){if(o.status>=200&&o.status<300)try{var e=JSON.parse(o.responseText);e.imagePath?(t({percentage:100,status:"success"}),r(e.imagePath)):(t({percentage:100,status:"error",error:"No image path in response"}),i(new Error("No image path in response")))}catch(n){t({percentage:100,status:"error",error:"Failed to parse response"}),i(new Error("Failed to parse response"))}else t({percentage:100,status:"error",error:"Upload failed: ".concat(o.status)}),i(new Error("Upload failed with status ".concat(o.status)))})),o.addEventListener("error",(function(){t({percentage:0,status:"error",error:"Network error"}),i(new Error("Network error"))})),o.open("POST","/api/uploadImage"),o.send(a)}))]:[2]}))}))).apply(this,arguments)}function c(e,n){return u.apply(this,arguments)}function u(){return(u=(0,r.Z)((function(e,n){var t,r,o,s;return(0,a.__generator)(this,(function(a){switch(a.label){case 0:return(0,i.Z)(e,File)?((t=new FormData).append("image",e),t.append("fossilType",n),o={},[4,fetch("/api/uploadImage",(o.method="POST",o.body=t,o))]):[2];case 1:return[4,(r=a.sent()).json().catch((function(){return{}}))];case 2:if(s=a.sent(),!r.ok)throw new Error("string"===typeof s.error?s.error:"Upload failed (".concat(r.status,")"));if(s.imagePath)return[2,s.imagePath];throw new Error("Server did not return an image path")}}))}))).apply(this,arguments)}function l(){var e=window.location,n=e.hostname,t=e.protocol;return"localhost"===n||"127.0.0.1"===n?"".concat(t,"//").concat(n,":8000/api/uploadImage"):"/api/uploadImage"}function d(e,n){return p.apply(this,arguments)}function p(){return(p=(0,r.Z)((function(e,n){return(0,a.__generator)(this,(function(t){if(!(0,i.Z)(e,File))throw new Error("Invalid file");return[2,new Promise((function(t,r){var i=new FormData;i.append("image",e),i.append("fossilType","3D_models");var a=new XMLHttpRequest;a.withCredentials=!0,a.upload.addEventListener("progress",(function(e){if(e.lengthComputable){var t=Math.min(99,Math.round(e.loaded/e.total*100));null===n||void 0===n||n({percentage:t,status:"uploading"})}})),a.addEventListener("load",(function(){var e={};try{e=JSON.parse(a.responseText||"{}")}catch(o){}if(a.status>=200&&a.status<300&&e.imagePath)return null===n||void 0===n||n({percentage:100,status:"success"}),void t(e.imagePath);var i="string"===typeof e.error?e.error:"Upload failed (".concat(a.status||"network",")");null===n||void 0===n||n({percentage:0,status:"error",error:i}),r(new Error(i))})),a.addEventListener("error",(function(){null===n||void 0===n||n({percentage:0,status:"error",error:"Network error"}),r(new Error("Network error during model upload"))})),a.addEventListener("timeout",(function(){r(new Error("Upload timed out"))})),a.open("POST",l()),a.timeout=6e5,null===n||void 0===n||n({percentage:0,status:"uploading"}),a.send(i)}))]}))}))).apply(this,arguments)}function f(e,n){if(!(null===e||void 0===e?void 0:e.trim()))return null;
1var t=e.trim(),r=t.startsWith("{")||/sketchfab\.com/i.test(t);if(!r&&/\.(glb|gltf)$/i.test(t))return/^https?:\/\//i.test(t)||t.startsWith("/")?t:h(t.startsWith("/")?t.slice(1):t);if(null===n||void 0===n?void 0:n.trim()){var i=n.toLowerCase().replace(/^fossil\s+/,"").trim(),a="trifarina"===i?"trifarina_angulosa":i.replace(/ /g,"_");return"https://storage.googleapis.com/fossilsketch/3D_models/".concat(a,".glb")}return null}function g(e,n){return m.apply(this,arguments)}function m(){return(m=(0,r.Z)((function(e,n){var t;return(0,a.__generator)(this,(function(r){switch(r.label){case 0:return""===e?[3,2]:(t={},[4,fetch("/api/deleteImage",(t.method="POST",t.headers={"Content-Type":"application/json"},t.body=JSON.stringify({fileName:e,fossilType:n.toLowerCase()}),t)).then((function(e){return e.json()}))]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))).apply(this,arguments)}function h(e){if(e.startsWith("http"))return e;return"https://storage.googleapis.com/".concat("fossilsketch","/").concat(e.startsWith("/")?e.substring(1):e)}function v(e){var n=e.toLowerCase();return"foraminifera"===n||"forams"===n||"morphotype"===n||"morphotypes"===n?"foraminifera":"ostracoda"===n?"ostracoda":n}function x(e,n){if(!(null===e||void 0===e?void 0:e.trim()))return null;var t=e.trim();if(/^https?:\/\//i.test(t))return t;if(t.startsWith("/api/uploads/"))return t;var r=v(n),i=t.replaceAll(" ","");return i.includes("/")||(i="".concat(r,"/").concat(i)),"localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname?"/api/uploads/".concat(i):h(i)}function _(e){return b.apply(this,arguments)}function b(){return(b=(0,r.Z)((function(e){var n,t;return(0,a.__generator)(this,(function(r){switch(r.label){case 0:return""===e?[3,2]:(t={},[4,fetch("/api/fetchImageNames",(t.method="POST",t.headers={"Content-Type":"application/json"},t.body=JSON.stringify({folderName:e}),t)).then((function(e){return e.json()}))]);case 1:return(n=r.sent()).imagePaths?[2,n.imagePaths]:[2,[]];case 2:return[2]}}
1))}))).apply(this,arguments)}},6766:function(e){e.exports={background:"matching_game_background__OLzzd",game_instructions:"matching_game_game_instructions__48z6u",remaining_counter:"matching_game_remaining_counter__dworO",emptyAns:"matching_game_emptyAns__dM1mx",emptyAnsSmall:"matching_game_emptyAnsSmall__ggS7Y",emptyAnsImg:"matching_game_emptyAnsImg__qj_9G",correctAns:"matching_game_correctAns__pqvEP",incorrectAns:"matching_game_incorrectAns__B8nyg",instructions:"matching_game_instructions__1kK30",round_container:"matching_game_round_container__VvN8n",finished_button:"matching_game_finished_button__wrx9M",next_round_button:"matching_game_next_round_button__i9tBl",container:"matching_game_container___PLCY",row:"matching_game_row__K9rVV",column:"matching_game_column__wtuRe",draggable:"matching_game_draggable__gGgYK",fossil_image:"matching_game_fossil_image__tWwuy",shape_text:"matching_game_shape_text__v_TaQ",feedbackImage:"matching_game_feedbackImage__coR9H",game_container:"matching_game_game_container__taVDX",droppable_manager_container:"matching_game_droppable_manager_container__lIkl_",img:"matching_game_img__oyupM",correctAnsSmall:"matching_game_correctAnsSmall__IXl_w",incorrectAnsSmall:"matching_game_incorrectAnsSmall__6vJhf",fossil_result_image:"matching_game_fossil_result_image__pU5Ru",root_div:"matching_game_root_div__CYX9p"}},449:function(e){e.exports={icon:"round_button_icon__wOxvf"}},6335:function(e,n,t){"use strict";t.d(n,{Z:function(){return o}});var r=t(8409),i=t(2784),a=["size","color"];function o(e){var n=e.size,t=void 0===n?24:n,o=e.color,s=void 0===o?"currentColor":o,c=(0,r.Kd)(e,a);return i.createElement("svg",(0,r.gY)({xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-check",width:t,height:t,viewBox:"0 0 24 24",stroke:s,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},c),i.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElement("path",{d:"M5 12l5 5l10 -10"}))}},7082:function(e,n,t){"use strict";t.d(n,{Z:function(){return o}});var r=t(8409),i=t(2784),a=["size","color"];function o(e){var n=e.size,t=void 0===n?24:n,o=e.color,s=void 0===o?"currentColor":o,c=(0,r.Kd)(e,a);return i.createElement("svg",(0,r.gY)({xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-x",width:t,height:t,viewBox:"0 0 24 24",stroke:s,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"},c),i.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))}},2870:function(e,n,t){"use strict";t.d(n,{E:function(){return M}});var r=t(2784),i=t(4761),a=t(7048),o=Object.defineProperty,s=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,l=(e,n,t)=>n in e?o(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;function d(e){return r.createElement("svg",((e,n)=>{for(var t in n||(n={}))c.call(n,t)&&l(e,t,n[t]);if(s)for(var t of s(n))u.call(n,t)&&l(e,t,n[t]);return e})({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),r.createElement("path",{d:"M2.5 1H12.5C13.3284 1 14 1.67157 14 2.5V12.5C14 13.3284 13.3284 14 12.5 14H2.5C1.67157 14 1 13.3284 1 12.5V2.5C1 1.67157 1.67157 1 2.5 1ZM2.5 2C2.22386 2 2 2.22386 2 2.5V8.3636L3.6818 6.6818C3.76809 6.59551 3.88572 6.54797 4.00774 6.55007C4.12975 6.55216 4.24568 6.60372 4.32895 6.69293L7.87355 10.4901L10.6818 7.6818C10.8575 7.50607 11.1425 7.50607 11.3182 7.6818L13 9.3636V2.5C13 2.22386 12.7761 2 12.5 2H2.5ZM2 12.5V9.6364L3.98887 7.64753L7.5311 11.4421L8.94113 13H2.5C2.22386 13 2 12.7761 2 12.5ZM12.5 13H10.155L8.48336 11.153L11 8.6364L13 10.6364V12.5C13 12.7761 12.7761 13 12.5 13ZM6.64922 5.5C6.64922 5.03013 7.03013 4.64922 7.5 4.64922C7.96987 4.64922 8.35078 5.03013 8.35078 5.5C8.35078 5.96987 7.96987 6.35078 7.5 6.35078C7.03013 6.35078 6.64922 5.96987 6.64922 5.5ZM7.5 3.74922C6.53307 3.74922 5.74922 4.53307 5.74922 5.5C5.74922 6.46693 6.53307 7.25078 7.5 7.25078C8.46693 7.25078 9.25078 6.46693 9.25078 5.5C9.25078 4.53307 8.46693 3.74922 7.5 3.74922Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var p=t(6817),f=Object.defineProperty,g=Object.defineProperties,m=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,_=(e,n,t)=>n in e?f(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,b=(e,n)=>{for(var t in n||(n={}))v.call(n,t)&&_(e,t,n[t]);if(h)for(var t of h(n))x.call(n,t)&&_(e,t,n[t]);return e},w=(e,n)=>g(e,m(n)),y=(0,p.k)(((e,{radius:n})=>({root:{},imageWrapper:{position:"relative"},figure:{margin:0},image:w(b({},e.fn.fontStyles()),{display:"block",width:"100%",height:"100%",border:0,borderRadius:e.fn.size({size:n,sizes:e.radius})}),caption:{color:"dark"===e.colorScheme?e.colors.dark[2]:e.colors.gray[7],marginTop:e.spacing.xs},placeholder:w(b({},e.fn.cover()),{display:"flex",alignItems:"center",justifyContent:"center",color:"dark"===e.colorScheme?e.colors.dark[2]:e.colors.gray[6],backgroundColor:"dark"===e.colorScheme?e.colors.dark[8]:e.colors.gray[0],borderRadius:e.fn.size({size:n,sizes:e.radius})})}))),Z=t(4459),j=t(5117),C=Object.defineProperty,S=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable,E=(e,n,t)=>n in e?C(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,I=(e,n)=>{for(var t in n||(n={}))N.call(n,t)&&E(e,t,n[t]);if(S)for(var t of S(n))k.call(n,t)&&E(e,t,n[t]);return e};const P={fit:"cover",width:"100%",height:"auto",radius:0},M=(0,r.forwardRef)(((e,n)=>{const t=(0,i.N4)("Image",P,e),{className:o,alt:s,src:c,fit:u,width:l,height:p,radius:f,imageProps:g,withPlaceholder:m,placeholder:h,imageRef:v,classNames:x,styles:_,caption:b,unstyled:w,style:C}=t,E=((e,n)=>{var t={};for(var r in e)N.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&S)for(var r of S(e))n.indexOf(r)<0&&k.call(e,r)&&(t[r]=e[r]);return t})(t,["className","alt","src","fit","width","height","radius","imageProps","withPlaceholder","placeholder","imageRef","classNames","styles","caption","unstyled","style"]),{classes:M,cx:O}
1=y({radius:f},{classNames:x,styles:_,unstyled:w,name:"Image"}),[D,L]=(0,r.useState)(!1),[A,T]=(0,r.useState)(!c),z=m&&(!D||A);return(0,a.l)((()=>{L(!1),T(!1)}),[c]),r.createElement(Z.x,I({className:O(M.root,o),ref:n,style:I({width:l,height:p},C)},E),r.createElement("figure",{className:M.figure},r.createElement("div",{className:M.imageWrapper},r.createElement("img",I({className:M.image,src:c,alt:s,style:{objectFit:u,width:l,height:p},ref:v,onLoad:e=>{L(!0),"function"===typeof(null==g?void 0:g.onLoad)&&g.onLoad(e)},onError:e=>{T(!0),"function"===typeof(null==g?void 0:g.onError)&&g.onError(e)}},g)),z&&r.createElement("div",{className:M.placeholder,title:s},h||r.createElement(d,{style:{width:40,height:40}}))),!!b&&r.createElement(j.x,{component:"figcaption",size:"sm",align:"center",className:M.caption},b)))}));M.displayName="@mantine/core/Image"},8788:function(e,n,t){"use strict";function r(e,n,t,r,i,a,o){try{var s=e[a](o),c=s.value}catch(u){return void t(u)}s.done?n(c):Promise.resolve(c).then(r,i)}function i(e){return function(){var n=this,t=arguments;return new Promise((function(i,a){var o=e.apply(n,t);function s(e){r(o,i,a,s,c,"next",e)}function c(e){r(o,i,a,s,c,"throw",e)}s(void 0)}))}}t.d(n,{Z:function(){return i}})},2838:function(e,n,t){"use strict";function r(e,n){return null!=n&&"undefined"!==typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n}t.d(n,{Z:function(){return r}})},930:function(e,n,t){"use strict";t.d(n,{Z:function(){return o}});var r=t(630);var i=t(8366);var a=t(5459);function o(e){return function(e){if(Array.isArray(e))return(0,r.Z)(e)}(e)||(0,i.Z)(e)||(0,a.Z)(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(e){e.O(0,[4185,6577,443,9341,256,6943,9774,2888,179],(function(){return n=9445,e(e.s=n);var n}));var n=e.O();_N_E=n}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.