1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5910],{8073:function(e,n,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/games/custom_assemblage",function(){return i(4726)}])},4726:function(e,n,i){"use strict";i.r(n);var s=i(2322),t=i(2784),r=i(5632),o=i(5117),a=i(7577),l=i(7841),u=i(356),c=i.n(u),d=i(1783),m=i(8621),g=i(7973),f=i(2589),v=i(9454);function p(e){return e.endQuestions?e.endQuestions.flatMap((function(e){return e.correctAnswers})):[]}n.default=function(e){var n=e.handleLogout,i=(0,r.useRouter)(),u=(0,t.useContext)(g.Z),h=i.query.id,y="string"===typeof h?parseInt(h):0,x=(0,t.useState)(!0),w=x[0],_=x[1],j=f.S.useQuery(["custom_assemblage.getGame",{gameId:y}],{enabled:y>0}),I=j.data,N=j.isLoading;(0,t.useEffect)((function(){I&&I.config&&!I.config.intro&&_(!1)}),[I]);var L=(0,t.useState)(!1),E=L[0],b=L[1];if((0,t.useEffect)((function(){if(i.isReady)if("1"===i.query.skipEnd||Array.isArray(i.query.skipEnd)&&i.query.skipEnd.includes("1")){var e=(u.userEmail||localStorage.getItem("userEmail")||"").toLowerCase();b("[email protected]"===e)}else b(!1)}),[i.isReady,i.query.skipEnd,u.userEmail]),N||!i.isReady)return(0,s.jsxs)("div",{className:c().background,children:[(0,s.jsx)(d.Z,{handleLogout:n}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:(0,s.jsx)(o.x,{color:"white",size:"xl",children:"Loading game..."})})]});if(!I||!I.config)return(0,s.jsxs)("div",{className:c().background,children:[(0,s.jsx)(d.Z,{handleLogout:n}),(0,s.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:(0,s.jsx)(o.x,{color:"white",size:"xl",children:"Game not found"})})]});var C=I.config,k=function(e){return e.samples.map((function(n){return n.levels.map((function(i){var s={Name:i.imageName};i.specimens.forEach((function(e){s[e.name]=e.correctCount})),i.zoomRegions&&i.zoomRegions.length>0&&(s.Zooms=i.zoomRegions.map((function(e){return{Name:e.name,xLow:e.xLow,xHigh:e.xHigh,yLow:e.yLow,yHigh:e.yHigh}})));var t=i.specimens.find((function(e){return"radio"===e.inputType&&e.options}));return t&&(s.Options=t.options),e.singleLineInstructions&&(s.Sample=n.name),i.hintImageName&&(s.HintImage=i.hintImageName),s}))}))}(C),Q=function(e){return e.endQuestions?e.endQuestions.map((function(e){return{instructions:e.instructions,header:e.headers,rowValues:e.rowValues,sampleOptions:e.answerOptions,placeholderOption:e.placeholderOptions,singleDropDown:null!==(n=e.singleDropDown)&&void 0!==n&&n}})):[];var n}(C),R=p(C),q=function(e){var n=p(e),i={};return e.endQuestions&&e.endQuestions.forEach((function(e){e.alternativeCorrectAnswers&&Object.assign(i,e.alternativeCorrectAnswers)})),function(e){for(var s,t=new Array(e.length).fill(!1).map((function(){var n;return new Array(null!==(s=null===(n=e[0])||void 0===n?void 0:n.length)&&void 0!==s?s:0).fill(!1)})),r=0;r<e.length;r++)for(var o,a,l=0;l<(null!==(a=null===(o=e[0])||void 0===o?void 0:o.length)&&void 0!==a?a:0);l++){var u,c=e[r][l];if(c!==(null===(u=n[r])||void 0===u?void 0:u[l])){var d="".concat(r,"-").concat(l);(i[d]||[]).includes(c)||(t[r][l]=!0)}}return t}}(C),O=function(e){if(e.surveyConfig)return{sections:e.surveyConfig.sections.map((function(e){return{title:e.title,questions:e.questions.map((function(e){return{id:e.id,type:e.type,prompt:e.prompt,required:e.required,options:e.options,placeholder:e.placeholder}}))}})),overallRatingQuestionId:e.surveyConfig.overallRatingQuestionId,commentQuestionId:e.surveyConfig.commentQuestionId}}(C),z=C.multiLevel?"subset":"sample",A=Q.length>0,S="custom_assemblage_".concat(y);return(0,s.jsxs)("div",{className:c().background,children:[(0,s.jsx)(d.Z,{handleLogout:n}),(0,s.jsx)(m.Z,{assemblagePool:k,initialRoundImgs:z,assemblageFolder:C.assemblageFolder||"",imageFolder:C.imageFolder||"",gameName:S,endQuestions:Q,checkAnswer:q,endQuestion:A,multiLevel:C.multiLevel,answers:R,answerRange:C.answerRange,singleLineInstructions:C.singleLineInstructions,surveyConfig:O,forceOpenEndModal:E,useGcs:!C.assemblageFolder,gcsSlug:C.gcsSlug||"",referenceImages:C.referenceImages||[]}),w&&C.intro&&(0,s.jsx)(a.a,{opacity:1,color:"rgba(0, 0, 0, 1)",zIndex:5,style:{overflow:"auto"},children:(0,s.jsxs)("div",{className:c().overlay_intro_container,children:[(0,s.jsx)("div",{className:c().overlay_intro_title,children:C.intro.title}),C.intro.slides.map((function(e,n){return(0,s.jsxs)("div",{className:c().overlay_intro_middle,children:[e.images.length>0&&(0,s.jsx)("div",{style:{width:"50%"},children:e.images.map((function(e,n){return(0,s.jsx)("img",{className:c().overlay_intro_img,src:(0,v.a9)(e)},n)}))}),(0,s.jsx)("div",{className:c().overlay_intro_text,dangerouslySetInnerHTML:{__html:e.text}})]},n)})),(0,s.jsx)(l.z,{style:{minHeight:"50px"},radius:"xl",size:"lg",onClick:function(){return _(!1)},children:"Begin"})]})})]})}}},function(e){e.O(0,[6577,443,7301,1858,6943,6870,8621,9774,2888,179],(function(){return n=8073,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.