1"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[7975],{7975(e,s,a){a.r(s),a.d(s,{default:()=>$});var l=a(5043),r=a(5621),t=a(3974),i=a(4980),c=a(6328),n=a(3390),d=a(1140),o=a(2264),u=a(556),h=a(5949),x=a(5732),m=a(3084),j=a(4204),p=a(7040),v=a(1351),g=a(5440),y=a(6099),N=a(2626),f=a(8326),b=a(5088),w=a(5919),C=a(1360),A=a(9292),S=a(9855),k=a(579);const _=["Foundation","1","2","3","4","5","6","7","8","9","10","11","12"],z=[{value:"easy",label:"Easy \u2014 Common vocabulary, simple words"},{value:"medium",label:"Medium \u2014 Curriculum vocabulary, subject terms"},{value:"hard",label:"Hard \u2014 Technical terminology, specialist language"}],P=[5,8,10,12,15,18,20],W=["English","Mathematics","Science","History","Geography","Health & PE","Technology","Visual Arts","Music","Drama","Languages","HASS","Design & Technology","Digital Technologies"],$=()=>{const e=(0,r.Zp)(),{user:s}=(0,t.As)(),[a,$]=(0,l.useState)(!1),[T,F]=(0,l.useState)([]),[J,L]=(0,l.useState)("create"),[R,E]=(0,l.useState)(!1),[V,Z]=(0,l.useState)(""),[q,D]=(0,l.useState)(""),[H,Y]=(0,l.useState)([]),[M,G]=(0,l.useState)(""),[I,U]=(0,l.useState)([]),[B,K]=(0,l.useState)({title:"",subject:"",year_levels:[],topic:"",num_words:15,difficulty:"medium",curriculum_state:"National",keywords:""}),O=(0,l.useCallback)(async()=>{try{const e=await i.A.get(`${i.n}/findaword/`,{params:{search:V||void 0}});F(e.data.findawords||[])}catch{}},[V]);(0,l.useEffect)(()=>{O()},[O]);const X=()=>{const e=q.trim().toUpperCase();e&&!H.includes(e)&&Y(s=>[...s,e]),D("")},Q=()=>{const e=M.trim().toUpperCase().replace(/[\s-]/g,"");e&&e.length>=3&&e.length<=15&&/^[A-Z]+$/.test(e)&&!I.includes(e)?U(s=>[...s,e]):e&&(e.length<3||e.length>15||!/^[A-Z]+$/.test(e))&&c.oR.error("Words must be 3\u201315 letters (A\u2013Z only, no spaces or hyphens)."),G("")},ee=T.filter(e=>{var s,a;return!V||(null===(s=e.title)||void 0===s?void 0:s.toLowerCase().includes(V.toLowerCase()))||(null===(a=e.topic)||void 0===a?void 0:a.toLowerCase().includes(V.toLowerCase()))});return(0,k.jsxs)(j.A,{children:[(0,k.jsx)(g.A,{}),(0,k.jsxs)("div",{className:"p-6 max-w-5xl mx-auto",children:[(0,k.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,k.jsx)("div",{className:"p-2 rounded-lg bg-primary/10",children:(0,k.jsx)(w.A,{className:"w-6 h-6 text-primary"})}),(0,k.jsxs)("div",{className:"min-w-0",children:[(0,k.jsx)("h1",{className:"text-2xl font-bold text-foreground",children:"Find-a-Word Maker"}),(0,k.jsx)("p",{className:"text-sm text-muted-foreground",children:"AI-generated curriculum word searches \u2014 printable PDF + interactive student link"})]}),(0,k.jsx)(h.E,{variant:"secondary",className:"ml-auto",children:"5 credits"})]}),(0,k.jsxs)(x.tU,{value:J,onValueChange:L,children:[(0,k.jsxs)(x.j7,{className:"mb-6",children:[(0,k.jsxs)(x.Xi,{value:"create",children:[(0,k.jsx)(C.A,{className:"w-4 h-4 mr-1"})," Create"]}),(0,k.jsxs)(x.Xi,{value:"library",children:[(0,k.jsx)(N.A,{className:"w-4 h-4 mr-1"})," My Puzzles (",T.length,")"]})]}),(0,k.jsx)(x.av,{value:"create",children:a?(0,k.jsx)(p.A,{title:"Building your word search\u2026",steps:["Generating curriculum vocabulary","Placing words in the grid","Filling remaining cells","Running quality checks"]}):(0,k.jsxs)(d.Zp,{children:[(0,k.jsx)(d.aR,{children:(0,k.jsx)(d.ZB,{className:"text-base",children:"Puzzle details"})}),(0,k.jsxs)(d.Wu,{className:"space-y-5",children:[(0,k.jsxs)("div",{className:"space-y-1",children:[(0,k.jsxs)(u.J,{children:["Title ",(0,k.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,k.jsx)(o.p,{placeholder:"e.g. Plant Biology Word Search",value:B.title,onChange:e=>K(s=>({...s,title:e.target.value}))})]}),(0,k.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,k.jsxs)("div",{className:"space-y-1",children:[(0,k.jsxs)(u.J,{children:["Subject ",(0,k.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,k.jsxs)(m.l6,{value:B.subject,onValueChange:e=>K(s=>({...s,subject:e})),children:[(0,k.jsx)(m.bq,{children:(0,k.jsx)(m.yv,{placeholder:"Select subject"})}),(0,k.jsx)(m.gC,{children:W.map(e=>(0,k.jsx)(m.eb,{value:e,children:e},e))})]})]}),(0,k.jsxs)("div",{className:"space-y-1",children:[(0,k.jsxs)(u.J,{children:["Year Level ",(0,k.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,k.jsxs)(m.l6,{value:B.year_levels[0]||"",onValueChange:e=>K(s=>({...s,year_levels:e?[e]:[]})),children:[(0,k.jsx)(m.bq,{children:(0,k.jsx)(m.yv,{placeholder:"Select year level"})}),(0,k.jsx)(m.gC,{children:_.map(e=>(0,k.jsx)(m.eb,{value:e,children:"Foundation"===e?"Foundation (Prep / Kindy)":`Year ${e}`},e))})]})]})]}),(0,k.jsxs)("div",{className:"space-y-1",children:[(0,k.jsxs)(u.J,{children:["Topic ",(0,k.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,k.jsx)(o.p,{placeholder:"e.g. Photosynthesis and plant cells",value:
1B.topic,onChange:e=>K(s=>({...s,topic:e.target.value}))})]}),(0,k.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[(0,k.jsxs)("div",{className:"space-y-1",children:[(0,k.jsx)(u.J,{children:"Number of words"}),(0,k.jsxs)(m.l6,{value:String(B.num_words),onValueChange:e=>K(s=>({...s,num_words:Number(e)})),children:[(0,k.jsx)(m.bq,{children:(0,k.jsx)(m.yv,{})}),(0,k.jsx)(m.gC,{children:P.map(e=>(0,k.jsxs)(m.eb,{value:String(e),children:[e," words"]},e))})]})]}),(0,k.jsxs)("div",{className:"space-y-1",children:[(0,k.jsx)(u.J,{children:"Difficulty"}),(0,k.jsxs)(m.l6,{value:B.difficulty,onValueChange:e=>K(s=>({...s,difficulty:e})),children:[(0,k.jsx)(m.bq,{children:(0,k.jsx)(m.yv,{})}),(0,k.jsx)(m.gC,{children:z.map(e=>(0,k.jsx)(m.eb,{value:e.value,children:e.label},e.value))})]})]}),(0,k.jsxs)("div",{className:"space-y-1",children:[(0,k.jsx)(u.J,{children:"Curriculum"}),(0,k.jsxs)(m.l6,{value:B.curriculum_state,onValueChange:e=>K(s=>({...s,curriculum_state:e})),children:[(0,k.jsx)(m.bq,{children:(0,k.jsx)(m.yv,{})}),(0,k.jsxs)(m.gC,{children:[(0,k.jsx)(m.eb,{value:"National",children:"National (ACARA)"}),(0,k.jsx)(m.eb,{value:"NSW",children:"NSW Syllabus"}),(0,k.jsx)(m.eb,{value:"VIC",children:"Victorian Curriculum"}),(0,k.jsx)(m.eb,{value:"WA",children:"WA Curriculum (SCSA)"})]})]})]})]}),(0,k.jsxs)("div",{className:"space-y-1",children:[(0,k.jsxs)(u.J,{children:["Your specific words ",(0,k.jsx)("span",{className:"text-muted-foreground font-normal",children:"(added first \u2014 AI fills the rest)"})]}),(0,k.jsxs)("div",{className:"flex gap-2",children:[(0,k.jsx)(o.p,{placeholder:"e.g. CHLOROPHYLL",value:M,onChange:e=>G(e.target.value),onKeyDown:e=>"Enter"===e.key&&Q(),className:"flex-1"}),(0,k.jsx)(n.$,{type:"button",variant:"outline",onClick:Q,children:(0,k.jsx)(C.A,{className:"w-4 h-4"})})]}),I.length>0&&(0,k.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:I.map(e=>(0,k.jsxs)(h.E,{variant:"secondary",className:"gap-1 bg-primary/10 text-primary border-primary/20",children:[e,(0,k.jsx)("button",{type:"button",onClick:()=>U(s=>s.filter(s=>s!==e)),children:(0,k.jsx)(S.A,{className:"w-3 h-3"})})]},e))})]}),(0,k.jsxs)("div",{className:"space-y-1",children:[(0,k.jsxs)(u.J,{children:["Focus keywords ",(0,k.jsx)("span",{className:"text-muted-foreground font-normal",children:"(optional \u2014 guides AI vocabulary)"})]}),(0,k.jsx)(o.p,{placeholder:"e.g. chlorophyll, glucose, stomata",value:B.keywords,onChange:e=>K(s=>({...s,keywords:e.target.value}))})]}),(0,k.jsxs)("div",{className:"space-y-1",children:[(0,k.jsxs)(u.J,{children:["Curriculum outcome codes ",(0,k.jsx)("span",{className:"text-muted-foreground font-normal",children:"(optional)"})]}),(0,k.jsxs)("div",{className:"flex gap-2",children:[(0,k.jsx)(o.p,{placeholder:"e.g. AC9SFU01",value:q,onChange:e=>D(e.target.value),onKeyDown:e=>"Enter"===e.key&&X(),className:"flex-1"}),(0,k.jsx)(n.$,{type:"button",variant:"outline",onClick:X,children:(0,k.jsx)(C.A,{className:"w-4 h-4"})})]}),H.length>0&&(0,k.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:H.map(e=>(0,k.jsxs)(h.E,{variant:"secondary",className:"gap-1",children:[e,(0,k.jsx)("button",{type:"button",onClick:()=>Y(s=>s.filter(s=>s!==e)),children:(0,k.jsx)(S.A,{className:"w-3 h-3"})})]},e))})]}),(0,k.jsxs)(n.$,{onClick:async()=>{const s=[];if(B.title||s.push("Title"),B.subject||s.push("Subject"),0===B.year_levels.length&&s.push("Year Level"),B.topic||s.push("Topic"),s.length>0)c.oR.error(`Please fill in: ${s.join(", ")}.`);else{$(!0);try{const s=await i.A.post(`${i.n}/findaword/generate`,{...B,outcome_codes:H,required_words:I});c.oR.success("Find-a-Word created!"),e(`/activity-studio/findaword/${s.data.activity_id}`)}catch(d){var a,l;if(403===(null===(a=d.response)||void 0===a?void 0:a.status)){var r;const e=(null===(r=d.response.data)||void 0===r?void 0:r.detail)||"";var t;if(e.includes("credit")||e.includes("upgrade"))E(!0);else c.oR.error((null===(t=d.response.data)||void 0===t?void 0:t.detail)||"Access denied.")}else if(422===(null===(l=d.response)||void 0===l?void 0:l.status)){var n;c.oR.error((null===(n=d.response.data)||void 0===n?void 0:n.detail)||"Could not generate puzzle. Try a different topic.")}else c.oR.error("Generation failed. Please try again.")}finally{$(!1)}}},disabled:a,className:"w-full bg-primary hover:bg-primary/90 text-primary-foreground",size:"lg",children:[(0,k.jsx)(y.A,{className:"w-4 h-4 mr-2"}),"Generate Find-a-Word (5 credits)"]})]})]})}),(0,k.jsxs)(x.av,{value:"library",children:[(0,k.jsx)("div",{className:"mb-4",children:(0,k.jsxs)("div",{className:"relative",children:[(0,k.jsx)(A.A,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),(0,k.jsx)(o.p,{className:"pl-9",placeholder:"Search puzzles\u2026",value:V,onChange:e=>Z(e.target.value)})]})}),0===ee.length?(0,k.jsx)(d.Zp,{children:(0,k.jsxs)(d.Wu,{className:"py-12 text-center",children:[(0,k.jsx)(w.A,{className:"w-10 h-10 text-muted-foreground
1/40 mx-auto mb-3"}),(0,k.jsx)("p",{className:"text-muted-foreground",children:"No puzzles yet. Create your first one!"}),(0,k.jsxs)(n.$,{className:"mt-4",onClick:()=>L("create"),children:[(0,k.jsx)(C.A,{className:"w-4 h-4 mr-2"})," Create Puzzle"]})]})}):(0,k.jsx)("div",{className:"grid gap-3",children:ee.map(s=>{var a;return(0,k.jsx)(d.Zp,{className:"cursor-pointer hover:border-primary/40 transition-colors",onClick:()=>e(`/activity-studio/findaword/${s.activity_id}`),children:(0,k.jsxs)(d.Wu,{className:"flex items-center gap-4 py-4",children:[(0,k.jsx)("div",{className:"p-2 rounded-lg bg-primary/10",children:(0,k.jsx)(w.A,{className:"w-5 h-5 text-primary"})}),(0,k.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,k.jsx)("p",{className:"font-medium text-foreground truncate",children:s.title}),(0,k.jsxs)("p",{className:"text-sm text-muted-foreground",children:[s.subject," \xb7 Year ",null===(a=s.year_levels)||void 0===a?void 0:a.join(", ")," \xb7 ",s.num_items," words"]})]}),(0,k.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[s.attempt_count>0&&(0,k.jsxs)("span",{className:"flex items-center gap-1",children:[(0,k.jsx)(b.A,{className:"w-3.5 h-3.5"}),s.attempt_count," attempt",1!==s.attempt_count?"s":""]}),(0,k.jsx)(f.A,{className:"w-4 h-4"})]})]})},s.activity_id)})})]})]})]}),R&&(0,k.jsx)(v.A,{isOpen:!0,onClose:()=>E(!1)})]})}}}]); 2//# sourceMappingURL=7975.27dbe097.chunk.js.map
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.