1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8147],{7444:function(e,s,a){"use strict";var r=a(2322),t=(a(2784),a(9094)),n=a(6577),l=a.n(n);s.Z=function(e){var s=e.width,a=void 0===s?400:s,n=e.height,o=void 0===n?140:n,i=e.link,c=void 0===i?"/":i;return(0,r.jsx)(t.M,{children:(0,r.jsx)("a",{href:c,children:(0,r.jsx)(l(),{src:"/logos/logo.png",alt:"FossilSketch logo",width:a,height:o})})})}},8732:function(e,s,a){"use strict";a.d(s,{Z:function(){return Z}});var r=a(7842),t=a(865),n=a(6670),l=a(2322),o=a(2784),i=a(5632),c=a(2623),d=a(1232),u=a(9236),m=a(7841),p=a(5117),h=a(7564),_=a(61),g=a(7138),v=a(8654),x=a(8855),f=a(4403),y=a(6176),b=a(4777),j=a(966),T=a(1194),w=a(7789),F=a(3575),S=a(1019),I=a(2589),C=a(7973),P=a(1803),R=a.n(P);function Z(e){var s=e.editGameId,a=e.onSave,P=e.onCancel,Z=(0,i.useRouter)(),k=(0,o.useContext)(C.Z),N=(0,o.useState)(0),V=N[0],E=N[1],G=(0,o.useState)(!1),q=G[0],D=G[1],M=(0,o.useState)(null),z=M[0],K=M[1];(0,o.useEffect)((function(){D(!0)}),[]);var O=(0,S.c)({initialValues:{name:"",title:"",description:"",fossilType:null,propertyType:"",numRounds:3,numCardsPerRound:3,topImageFolder:"",bottomImageFolder:"",topImageFolderHint:"",useFilteredFossils:!1,filteredFossils:[],roundValues:{},initialScore:3,minScore:1,scoreDecrement:1,showImagePopout:!1,imagePopoutName:""},validate:{name:function(e){return e?null:"Game name is required"},title:function(e){return e?null:"Title is required"},fossilType:function(e){return e?null:"Please select a fossil type"},propertyType:function(e){return e?null:"Please select a property"},numRounds:function(e){return e<1||e>10?"Number of rounds must be between 1 and 10":null},numCardsPerRound:function(e){return e<2||e>10?"Cards per round must be between 2 and 10":null}}}),B=I.S.useQuery(["gameTemplates.getMatchingGameTemplate",{gameId:String(s)}],{enabled:!!s}).data;(0,o.useEffect)((function(){var e;if(B){var s=B;K(s.fossil_type),E(0),O.setValues({name:s.name,title:s.title,description:s.description||"",fossilType:s.fossil_type,propertyType:s.property_type,numRounds:s.num_rounds,numCardsPerRound:s.num_cards_per_round,topImageFolder:s.top_image_folder,bottomImageFolder:s.bottom_image_folder,topImageFolderHint:s.top_image_folder_hint||"",useFilteredFossils:!!(null===(e=s.filtered_fossils)||void 0===e?void 0:e.length),filteredFossils:s.filtered_fossils||[],roundValues:s.round_values||{},initialScore:s.initial_score,minScore:s.min_score,scoreDecrement:s.score_decrement,showImagePopout:s.show_image_popout,imagePopoutName:s.image_popout_name||""})}}),[B]);var A=1===k.role||2===k.role,L=I.S.useQuery(["gameTemplates.getAvailableProperties",{fossilType:z}],{enabled:q&&A&&!!z,retry:!1}),Y=L.data,X=L.isLoading,H=L.error,Q=I.S.useQuery(["gameTemplates.getAvailablePropertyValues",{fossilType:z,propertyType:O.values.propertyType}],{enabled:q&&A&&!!z&&!!O.values.propertyType,retry:!1}),W=Q.data,U=Q.isLoading,J=Q.error;(0,o.useEffect)((function(){if(Y&&O.values.propertyType){var e=Y.find((function(e){return e.value===O.values.propertyType}));e&&(O.setFieldValue("bottomImageFolder",e.folder),"foraminifera"===O.values.fossilType?O.setFieldValue("topImageFolder","foraminifera"):"ostracoda"===O.values.fossilType&&O.setFieldValue("topImageFolder","ostracoda"))}}),[O.values.propertyType,Y,O.values.fossilType]);var $=function(e,s){(0,F.c0)({title:"Success",message:s,color:"green"}),a?a():Z.push("/games/matching/".concat(e))},ee=I.S.useMutation(["gameTemplates.createMatchingGameTemplate"],{onSuccess:function(e){return $(e.id,"Game template created successfully!")},onError:function(e){(0,F.c0)({title:"Error",message:e.message||"Failed to create game template",color:"red"})}}),se=ee.mutate,ae=ee.isLoading,re=I.S.useMutation(["gameTemplates.updateMatchingGameTemplate"],{onSuccess:function(e){return $(e.id,"Game template updated successfully!")},onError:function(e){(0,F.c0)({title:"Error",message:e.message||"Failed to update game template",color:"red"})}}),te=re.mutate,ne=re.isLoading,le=ae||ne;return(0,l.jsx)("div",{className:R().background,children:(0,l.jsxs)(c.X,{shadow:"sm",p:"xl",style:{maxWidth:1e3,margin:"2rem auto",width:"95%"},children:[(0,l.jsxs)(d.Z,{position:"apart",mb:"xl",children:[(0,l.jsx)(u.D,{order:2,children:s?"Edit Matching Game":"Create Matching Game"}),P&&(0,l.jsx)(m.z,{variant:"default",onClick:P,children:"Back to Game Builder"})]}),(0,l.jsxs)(c.X,{p:"md",mb:"xl",withBorder:!0,children:[(0,l.jsxs)(p.x,{size:"lg",weight:500,children:["Step ",V+1," / 6"]}),(0,l.jsxs)(p.x,{size:"sm",color:"dimmed",mt:4,children:[0===V&&"Basic Info - Name and title",1===V&&"Data Source - Select database and property",2===V&&"Game Settings - Rounds and scoring",3===V&&"Images - Image folder configuration",4===V&&"Round Values - Select exact values for each round",5===V&&"Review - Review and save"]})]}),(0,l.jsxs)("div",{children:[0===V&&(0,l.jsxs)(h.K,{spacing:"md",mt:"xl",children:[(0,l.jsx)(_.o,(0,n.Z)((0,t.Z)({label:"Game Name",placeholder:"e.g., morphotype_matching_v2",required:!0},O.getInputProps("name")),{description:"Unique identifier (no spaces, use underscores)"})),(0,l.jsx)(_.o,(0,n.Z)((0,t.Z)({label:"Title",placeholder:"e.g., Match the foram genera with morphotypes",required:!0},O.getInputProps("title")),{description:"Display title shown to students"})),(0,l.jsx)(g.g,(0,n.Z)((0,t.Z)({label:"Description (Optional)",placeholder:"Game description..."},O.getInputProps("description")),{minRows:3}))]}),1===V&&(0,l.jsxs)(h.K,{spacing:"md",mt:"xl",children:[(0,l.jsx)(v.Y.Group,(0,n.Z)((0,t.Z)({label:"Database Table",required:!0},O.getInputProps("fossilType")),{onChange:function(e){K(e),O.setFieldValue("fossilType",e),O.setFieldValue("propertyType",""),O.setFieldValue("bottomImageFolder",""),O.setFieldValue("roundValues",{})},children:(0,l.jsxs)(h.K,{mt:"xs",children:[(0,l.jsx)(v.Y,{value:"foraminifera",label:"Forams (Foraminifera)"}),(0,l.jsx)(v.Y,{value:"ostracoda",label:"Ostracods (Ostracoda)"})]})})),z&&Y&&(0,l.jsx)(x.Ph,(0,n.Z)((0,t.Z)({label:"Property Type",placeholder:"Select property to match",required:!0,data:Y.map((function(e){return{value:e.value,label:"text"===e.folder?e.label:"".concat(e.label," (uses ").concat(e.folder,"/ folder)")}}))},O.getInputProps("propertyType")),{onChange:function(e){O.setFieldValue("propertyType",e||""),O.setFieldValue("roundValues",{})}})),z&&X&&(0,l.jsx)(f.b,{color:"yellow",title:"Loading",children:"Loading available properties..."}),z&&H&&(0,l.jsx)(f.b,{color:"red",title:"Could not load properties",children:H.message||"Failed to load available properties."})]}),2===V&&(0,l.jsxs)(h.K,{spacing:"md",mt:"xl",children:[(0,l.jsx)(y.Y,(0,t.Z)({label:"Number of Rounds",required:!0,min:1,max:10},O.getInputProps("numRounds"))),(0,l.jsx)(y.Y,(0,t.Z)({label:"Cards per Round",required:!0,min:2,max:10},O.getInputProps("numCardsPerRound"))),(0,l.jsx)(b.i,{label:"Scoring",labelPosition:"center",my:"md"}),(0,l.jsx)(y.Y,(0,t.Z)({label:"Initial Score",required:!0,min:1,max:10},O.getInputProps("initialScore"))),(0,l.jsx)(y.Y,(0,t.Z)({label:"Minimum Score",required:!0,min:1},O.getInputProps("minScore"))),(0,l.jsx)(y.Y,(0,n.Z)((0,t.Z)({label:"Score Decrement",required:!0,min:1},O.getInputProps("scoreDecrement")),{description:"Points lost per incorrect attempt"}))]}),3===V&&(0,l.jsxs)(h.K,{spacing:"md",mt:"xl",children:[(0,l.jsx)(_.o,(0,n.Z)((0,t.Z)({label:"Fossil Image Folder",placeholder:"foraminifera or ostracoda",required:!0},O.getInputProps("topImageFolder")),{description:"Folder containing fossil photos (auto-filled based on fossil type)",disabled:!0})),(0,l.jsx)(_.o,(0,n.Z)((0,t.Z)({label:"name"===O.values.propertyType?"Category display":"Category Image Folder",placeholder:"name"===O.values.propertyType?"Text labels (fossil names)":"morphotypeSlots, chambers, or shapes",required:!0},O.getInputProps("bottomImageFolder")),{description:"name"===O.values.propertyType?"Column headers show fossil names (genus + species) as text \u2014 no image folder":"Folder containing category images (auto-filled based on property)",disabled:!0}))]}),4===V&&(0,l.jsxs)(h.K,{spacing:"md",mt:"xl",children:[(0,l.jsx)(p.x,{size:"sm",color:"dimmed",children:"Pick the exact property values students should match in each round. The game will automatically pull one fossil from each selected value bucket at runtime."}),z&&O.values.propertyType?U?(0,l.jsx)(j.a,{}):J?(0,l.jsx)(f.b,{color:"red",title:"Could not load values",children:J.message||"Failed to load available values for this property."}):W&&0!==W.length?(0,l.jsxs)(h.K,{spacing:"lg",children:[Array.from({length:O.values.numRounds}).map((function(e,s){var a="round".concat(s+1),o=O.values.roundValues[a]||[];return(0,l.jsxs)(c.X,{p:"md",withBorder:!0,children:[(0,l.jsxs)(p.x,{weight:500,mb:"sm",children:["Round ",s+1]}),(0,l.jsx)(T.NU,{label:"Select ".concat(O.values.numCardsPerRound," values for Round ").concat(s+1),placeholder:"Search and select values...",data:W,value:o,onChange:function(e){O.setFieldValue("roundValues",(0,n.Z)((0,t.Z)({},O.values.roundValues),(0,r.Z)({},a,e)))},searchable:!0,maxSelectedValues:O.values.numCardsPerRound}),(0,l.jsxs)(d.Z,{mt:"xs",spacing:"xs",children:[(0,l.jsxs)(p.x,{size:"sm",color:"dimmed",children:["Selected: ",o.length," /"," ",O.values.numCardsPerRound]}),o.length===O.values.numCardsPerRound&&(0,l.jsx)(w.C,{color:"green",size:"sm",children:"Complete"}),o.length<O.values.numCardsPerRound&&(0,l.jsxs)(w.C,{color:"yellow",size:"sm",children:["Need"," ",O.values.numCardsPerRound-o.length," ","more"]})]})]},s)})),(0,l.jsxs)(f.b,{color:"blue",title:"Tip",children:["Each round must contain exactly"," ",O.values.numCardsPerRound," distinct values."]})]}):(0,l.jsx)(f.b,{color:"red",title:"No values found",children:"No matching values were found for this fossil type and property."}):(0,l.jsx)(f.b,{color:"yellow",title:"Note",children:"Please select a fossil type and property in Step 2 first."})]}),5===V&&(0,l.jsx)(h.K,{spacing:"md",mt:"xl",children:(0,l.jsxs)(c.X,{p:"md",withBorder:!0,children:[(0,l.jsx)(u.D,{order:4,mb:"md",children:"Game Configuration Summary"}),(0,l.jsxs)(h.K,{spacing:"xs",children:[(0,l.jsxs)(p.x,{children:[(0,l.jsx)("strong",{children:"Name:"})," ",O.values.name]}),(0,l.jsxs)(p.x,{children:[(0,l.jsx)("strong",{children:"Title:"})," ",O.values.title]}),O.values.description&&(0,l.jsxs)(p.x,{children:[(0,l.jsx)("strong",{children:"Description:"})," ",O.values.description]}),(0,l.jsxs)(p.x,{children:[(0,l.jsx)("strong",{children:"Fossil Type:"})," ",O.values.fossilType]}),(0,l.jsxs)(p.x,{children:[(0,l.jsx)("strong",{children:"Property:"})," ",O.values.propertyType]}),(0,l.jsxs)(p.x,{children:[(0,l.jsx)("strong",{children:"Rounds:"})," ",O.values.numRounds]}),(0,l.jsxs)(p.x,{children:[(0,l.jsx)("strong",{children:"Cards per Round:"})," ",O.values.numCardsPerRound]}),(0,l.jsxs)(p.x,{children:[(0,l.jsx)("strong",{children:"Top Images:"})," ",O.values.topImageFolder]}),(0,l.jsxs)(p.x,{children:[(0,l.jsx)("strong",{children:"Bottom Images:"})," ",O.values.bottomImageFolder]}),(0,l.jsxs)(p.x,{children:[(0,l.jsx)("strong",{children:"Round values configured:"})," ",Object.keys(O.values.roundValues).length," /"," ",O.values.numRounds]})]})]})})]}),(0,l.jsxs)(d.Z,{position:"right",mt:"xl",children:[V>0&&(0,l.jsx)(m.z,{variant:"default",onClick:function(){return E((function(e){return e>0?e-1:e}))},children:"Back"}),V<5?(0,l.jsx)(m.z,{onClick:function(){if(0===V)O.validateField("name").hasError||O.validateField("title").hasError||E((function(e){return e<5?e+1:e}));else if(1===V)O.validateField("fossilType").hasError||O.validateField("propertyType").hasError||E((function(e){return e<5?e+1:e}));else if(2===V)O.validateField("numRounds").hasError||O.validateField("numCardsPerRound").hasError||E((function(e){return e<5?e+1:e}));else if(4===V){if(!Array.from({length:O.values.numRounds}).every((function(e,s){var a="round".concat(s+1);return(O.values.roundValues[a]||[]).length===O.values.numCardsPerRound})))return void(0,F.c0)({title:"Incomplete Selection",message:"Please select exactly ".concat(O.values.numCardsPerRound," values for each round."),color:"yellow"});E((function(e){return e<5?e+1:e}))}else E((function(e){return e<5?e+1:e}))},children:"Next step"}):(0,l.jsx)(m.z,{onClick:function(){if(!O.validate().hasErrors){var e={name:O.values.name,title:O.values.title,de
1scription:O.values.description||void 0,fossilType:O.values.fossilType,propertyType:O.values.propertyType,numRounds:O.values.numRounds,numCardsPerRound:O.values.numCardsPerRound,topImageFolder:O.values.topImageFolder,bottomImageFolder:O.values.bottomImageFolder,topImageFolderHint:O.values.topImageFolderHint||void 0,filteredFossils:O.values.useFilteredFossils&&O.values.filteredFossils.length>0?O.values.filteredFossils:void 0,roundValues:Object.keys(O.values.roundValues).length>0?O.values.roundValues:void 0,initialScore:O.values.initialScore,minScore:O.values.minScore,scoreDecrement:O.values.scoreDecrement,showImagePopout:O.values.showImagePopout,imagePopoutName:O.values.imagePopoutName||void 0};s?te((0,t.Z)({id:s},e)):se(e)}},loading:le,children:s?"Save Changes":"Create Game"})]})]})})}},1783:function(e,s,a){"use strict";var r=a(2322),t=a(2784),n=a(7001),l=a(4736),o=a(7973),i=a(7648),c=a(5092),d=a(3341),u=a(8454),m=a(2183),p=a(5166),h=a(8890),_=a(7444),g=a(4621),v=a.n(g),x=a(9097),f=a.n(x),y=a(5632),b=[{path:"/home",text:"Home",icon:i.Z,visibleTo:[0,1,2]},{path:"/database",text:"Database",icon:c.Z,visibleTo:[0,1,2]},{path:"/progress",text:"Progress",icon:d.Z,visibleTo:[0]}],j=[{path:"/instructor/student_stats",text:"Student Statistics",icon:u.Z,visibleTo:[1,2]},{path:"/instructor/game_builder",text:"Game Builder",icon:m.Z,visibleTo:[2]},{path:"/instructor/new_fossil",text:"New Microfossil",icon:u.Z,visibleTo:[1,2]},{path:"/instructor/new_class",text:"New Class",icon:u.Z,visibleTo:[1,2]},{path:"/instructor/game_builder?tab=matching",text:"Matching Games",icon:u.Z,visibleTo:[2]},{path:"/instructor/add_instructor",text:"Add Instructor",icon:u.Z,visibleTo:[2]},{path:"/instructor/select_content",text:"Select Content",icon:u.Z,visibleTo:[1,2]}];s.Z=function(e){var s=e.handleLogout,a=(0,y.useRouter)(),i=(0,t.useContext)(o.Z),c=i.role,d=i.currentClass,u=i.setRole,m=(0,t.useState)(null!==c&&void 0!==c?c:-1),g=m[0],x=m[1];(0,t.useEffect)((function(){var e=localStorage.getItem("role");if(null!==e){var s=parseInt(e,10);if(!Number.isNaN(s))return x(s),void u(s)}void 0!==c&&null!==c&&c>=0&&x(c)}),[c,u]);var T=(0,t.useState)(!1),w=T[0],F=T[1],S=function(e){var s=e.split("?")[0];return a.pathname===s?"".concat(v().link_icon," ").concat(v().active):v().link_icon},I=function(e){var s=e.split("?")[0];return a.pathname===s?"".concat(v().link," ").concat(v().active):v().link};return(0,r.jsxs)("div",{children:[(0,r.jsxs)(n.d,{opened:w,onClose:function(){return F(!1)},size:"md",padding:"xl",overlayOpacity:.3,classNames:{drawer:v().drawer},children:[(0,r.jsx)("div",{className:v().logo,children:(0,r.jsx)(_.Z,{width:270,height:100,link:"/home"})}),b.map((function(e){return e.visibleTo.includes(g)&&(0,r.jsxs)("div",{className:v().link_container,children:[(0,r.jsx)(e.icon,{className:S(e.path)}),(0,r.jsx)(f(),{href:e.path,children:(0,r.jsx)("a",{className:I(e.path),children:e.text})})]},e.path)})),g>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:v().link_container,children:[(0,r.jsx)(p.Z,{className:v().link_icon}),(0,r.jsx)("div",{className:v().link,style:{cursor:"default"},children:"Manage"})]}),(0,r.jsx)("div",{className:v().instructor_container,children:j.filter((function(e){return"/instru
1ctor/add_instructor"!==e.path||"47"!==d&&"48"!==d})).map((function(e){return e.visibleTo.includes(g)&&(0,r.jsxs)("div",{className:"".concat(v().link_container," ").concat(v().manage_link),children:[(0,r.jsx)(e.icon,{className:S(e.path)}),(0,r.jsx)(f(),{href:e.path,children:(0,r.jsx)("a",{className:I(e.path),children:e.text})})]},e.path)}))})]}),(0,r.jsxs)("div",{className:v().link_container,children:[(0,r.jsx)(h.Z,{className:v().link_icon}),(0,r.jsx)("a",{className:v().link,onClick:function(){return s()},children:"Logout"})]})]}),(0,r.jsx)(l.k,{onClick:function(){return F(!0)},children:(0,r.jsx)("div",{className:v().toggle_menu})})]})}},1803:function(e){e.exports={background:"new_class_background__6rT9O",form_card:"new_class_form_card__bWaRV",input_container:"new_class_input_container__KS7qM",input_label:"new_class_input_label__g5T9a",input_text:"new_class_input_text___fHsy",select_input:"new_class_select_input__OEqqV",message_container:"new_class_message_container__NRm_v",class_list_card:"new_class_class_list_card__S_zig",class_row:"new_class_class_row__3YsH_",class_data_label:"new_class_class_data_label___vGdQ",header_row:"new_class_header_row__XQA96",header_cell:"new_class_header_cell__GphNW",clipboard:"new_class_clipboard__ANhl_",class_code:"new_class_class_code__ovjeA",class_name:"new_class_class_name__OaIET",label:"new_class_label__GsEJ_",empty_state:"new_class_empty_state__RavaS",pagination:"new_class_pagination__K05E_"}},4621:function(e){e.exports={drawer:"sidebar_drawer__KpNLV",logo:"sidebar_logo__3EwEr",link_container:"sidebar_link_container__pZwwX",link_icon:"sidebar_link_icon___D4fO",active:"sidebar_active__zubOB",link:"sidebar_link__gXfrl",instructor_container:"sidebar_instructor_container__K4glu",manage_link:"sidebar_manage_link__MXySh",toggle_menu:"sidebar_toggle_menu__dg0Az"}}}]);
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.