PageSourceSearch

https://mycurriculummate.com.au/static/js/5513.cc6341fb.chunk.js

js mycurriculummate.com.au collected 2026-10-02 00:45:02 UTC 14,681 bytes, 3 lines download raw bytes

1/*! For license information please see 5513.cc6341fb.chunk.js.LICENSE.txt */
2"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[5513],{56277(e,t,s){s.d(t,{A:()=>n});var r=s(65043),a=s(70579);const n=e=>{let{gridData:t=[],placements:s=[],readOnly:n=!1,showAnswers:l=!1,onComplete:o,onGuessesChange:c,teacherMode:i=!1}=e;const d=t.length,u=d>0?t[0].length:0,[m,f]=(0,r.useState)(null),[x,p]=(0,r.useState)(null),[h,g]=(0,r.useState)("across"),[y,w]=(0,r.useState)(!1),[b,v]=(0,r.useState)({}),[j,N]=(0,r.useState)({}),k=(0,r.useRef)(null),C=(0,r.useRef)(null),S=(e,t)=>`${e}_${t}`,A=(e,s)=>e>=0&&e<d&&s>=0&&s<u&&""!==t[e][s],$={},D={};for(const r of s){const e=S(r.row,r.col);$[e]||($[e]=r.number),D[`${r.number}_${r.direction}`]=r}const R=new Set,_=new Set;for(const r of s){const e="down"===r.direction?1:0,t="across"===r.direction?1:0,s=(r.word||"").length||(()=>{let s=0;for(;A(r.row+e*s,r.col+t*s);)s++;return s})();for(let a=0;a<s;a++){const s=S(r.row+e*a,r.col+t*a);"across"===r.direction?R.add(s):_.add(s)}}const M=(e,t,s)=>{const r=S(e,t);return"across"===s?R.has(r):_.has(r)},E=(0,r.useCallback)((e,t,s)=>{const r="down"===s?1:0,a="across"===s?1:0;let n=e,l=t;for(;A(n-r,l-a);)n-=r,l-=a;const o=[];for(;A(n,l);)o.push([n,l]),n+=r,l+=a;return o},[d,u]),T=(e,t)=>{if(!A(e,t)||n)return;const s="across"===h?"down":"across";let r=h;M(e,t,h)?y&&e===m&&t===x&&M(e,t,s)&&(r=s):r=s,f(e),p(t),g(r),w(!0),k.current&&k.current.focus()},z=(0,r.useCallback)((e,t,s)=>{const r=e+("down"===s?1:0),a=t+("across"===s?1:0);A(r,a)&&(f(r),p(a))},[]),I=(0,r.useCallback)((e,t,s)=>{const r=e-("down"===s?1:0),a=t-("across"===s?1:0);A(r,a)&&(f(r),p(a))},[]),Z=(0,r.useCallback)(e=>{if(null===m||n)return;const t=m,s=x;if("Backspace"===e.key||"Delete"===e.key){e.preventDefault();const r=S(t,s);return void(b[r]?v(e=>{const t={...e};return delete t[r],t}):I(t,s,h))}if("Tab"===e.key)return void e.preventDefault();const r={ArrowRight:[0,1],ArrowLeft:[0,-1],ArrowDown:[1,0],ArrowUp:[-1,0]};if(r[e.key]){e.preventDefault();const[a,n]=r[e.key],l=0!==a?"down":"across",o=t+a,c=s+n;return void(A(o,c)&&(f(o),p(c),g(l)))}if(/^[a-zA-Z]$/.test(e.key)){e.preventDefault();const r=e.key.toUpperCase();v(e=>({...e,[S(t,s)]:r})),N(e=>{const r={...e};return delete r[S(t,s)],r}),z(t,s,h)}},[m,x,h,b,n,z,I]);(0,r.useEffect)(()=>{c&&c(b)},[b]),(0,r.useEffect)(()=>{if(!o)return;const e=Object.keys(Object.fromEntries([...R,..._].map(e=>[e,!0]))).length,t=Object.keys(b).filter(e=>{const[t,s]=e.split("_").map(Number);return A(t,s)}).length;o(e>0?Math.round(t/e*100):0)},[b]);const F=new Set;null!==m&&E(m,x,h).forEach(e=>{let[t,s]=e;return F.add(S(t,s))});const O=Math.max(28,Math.min(40,Math.floor(320/Math.max(u,d,1)))),W=(e,s)=>{const r=S(e,s);if(l&&i){const r=t[e][s];return r?(0,a.jsx)("span",{className:"text-primary font-bold text-sm select-none",children:r}):null}if(b[r]){const e=j[r];return(0,a.jsx)("span",{className:"font-bold text-sm select-none "+("correct"===e?"text-primary":"incorrect"===e?"text-destructive":"text-foreground"),children:b[r]})}return null};return(0,a.jsxs)("div",{className:"overflow-auto",children:[(0,a.jsx)("input",{ref:k,onKeyDown:Z,onBlur:()=>w(!1),onFocus:()=>w(!0),readOnly:!0,"aria-hidden":"true",tabIndex:-1,style:{position:"absolute",top:-9999,left:-9999,width:1,height:1,opacity:0,fontSize:16,pointerEvents:"none"},autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:"false"}),(0,a.jsx)("div",{ref:C,style:{display:"grid",gridTemplateColumns:`repeat(${u}, ${O}px)`,gridTemplateRows:`repeat(${d}, ${O}px)`,width:u*O},role:"grid","aria-label":"Crossword grid",children:Array.from({length:d},(e,t)=>Array.from({length:u},(e,s)=>{const r=S(t,s),l=A(t,s),o=t===m&&s===x,c=F.has(r),i=$[r];return l?(0,a.jsxs)("div",{role:"gridcell",tabIndex:0,onClick:()=>T(t,s),onKeyDown:e=>"Enter"===e.key&&T(t,s),style:{width:O,height:O,position:"relative",border:"1px solid hsl(var(--border))",cursor:n?"default":"pointer",backgroundColor:o?"hsl(var(--secondary) / 0.5)":c?"hsl(var(--primary) / 0.12)":"white",boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"center",userSelect:"none"},"aria-selected":o,children:[i&&(0,a.jsx)("span",{style:{position:"absolute",top:1,left:2,fontSize:Math.max(8,.22*O),lineHeight:1,color:"#263238",fontFamily:"Helvetica, Arial, sans-serif",pointerEvents:"none"},children:i}),W(t,s)]},r):(0,a.jsx)("div",{style:{width:O,height:O,backgroundColor:"#263238"}},r)}))})]})}},91140(e,t,s){s.d(t,{BT:()=>i,Wu:()=>d,ZB:()=>c,Zp:()=>l,aR:()=>o,wL:()=>u});var r=s(65043),a=s(99766),n=s(70579);const l=r.forwardRef((e,t)=>
2{let{className:s,...r}=e;return(0,n.jsx)("div",{ref:t,className:(0,a.cn)("rounded-xl border bg-card text-card-foreground shadow",s),...r})});l.displayName="Card";const o=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,n.jsx)("div",{ref:t,className:(0,a.cn)("flex flex-col space-y-1.5 p-6",s),...r})});o.displayName="CardHeader";const c=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,n.jsx)("div",{ref:t,className:(0,a.cn)("font-semibold leading-none tracking-tight",s),...r})});c.displayName="CardTitle";const i=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,n.jsx)("div",{ref:t,className:(0,a.cn)("text-sm text-muted-foreground",s),...r})});i.displayName="CardDescription";const d=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,n.jsx)("div",{ref:t,className:(0,a.cn)("p-6 pt-0",s),...r})});d.displayName="CardContent";const u=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,n.jsx)("div",{ref:t,className:(0,a.cn)("flex items-center p-6 pt-0",s),...r})});u.displayName="CardFooter"},92264(e,t,s){s.d(t,{p:()=>l});var r=s(65043),a=s(99766),n=s(70579);const l=r.forwardRef((e,t)=>{let{className:s,type:r,...l}=e;return(0,n.jsx)("input",{type:r,className:(0,a.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",s),ref:t,...l})});l.displayName="Input"},59938(e,t,s){s.d(t,{J:()=>i});var r=s(65043),a=s(65131),n=s(10917),l=s(99766),o=s(70579);const c=(0,n.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),i=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,o.jsx)(a.b,{ref:t,className:(0,l.cn)(c(),s),...r})});i.displayName=a.b.displayName},45513(e,t,s){s.r(t),s.d(t,{default:()=>h});var r=s(65043),a=s(45621),n=s(86213),l=s(13390),o=s(91140),c=s(92264),i=s(59938),d=s(56277),u=s(82054),m=s(84105),f=s(22024),x=s(70579);const p="mcm_cw_play_token",h=()=>{const{shareToken:e}=(0,a.g)(),[t,h]=(0,r.useState)("name"),[g,y]=(0,r.useState)(""),[w,b]=(0,r.useState)(null),[v,j]=(0,r.useState)(!1),[N,k]=(0,r.useState)(null),[C,S]=(0,r.useState)(0),A=(0,r.useRef)({}),$=(0,r.useRef)(null),D=(0,r.useRef)(localStorage.getItem(p)||(()=>{const e=crypto.randomUUID();return localStorage.setItem(p,e),e})());(0,r.useEffect)(()=>{(async()=>{try{const t=await n.A.get(`/api/crosswords/play/${e}`);b(t.data)}catch(s){var t;404===(null===(t=s.response)||void 0===t?void 0:t.status)?k("This crossword link is no longer active."):k("Could not load crossword. Please check the link.")}})()},[e]);const R=()=>{g.trim()&&($.current=Date.now(),h("play"))},_=(0,r.useCallback)(e=>{S(e)},[]),M=(0,r.useCallback)(e=>{A.current=e},[]),E=(0,r.useCallback)(async e=>{const t=$.current?Math.round((Date.now()-$.current)/1e3):null,r=(null===w||void 0===w?void 0:w.content)||{},a=r.placements||[],l=r.grid||[];let o=0,c=0;const i=new Set;for(const s of a){const t="down"===s.direction?1:0,r="across"===s.direction?1:0,a=(()=>{let e=0;for(;s.row+t*e<l.length&&s.col+r*e<((null===(a=l[0])||void 0===a?void 0:a.length)||0)&&""!==(null===(n=l[s.row+t*e])||void 0===n?void 0:n[s.col+r*e]);){var a,n;e++}return e})();for(let n=0;n<a;n++){const a=`${s.row+t*n}_${s.col+r*n}`;var d;if(!i.has(a))i.add(a),c++,e[a]===(null===(d=l[s.row+t*n])||void 0===d?void 0:d[s.col+r*n])&&o++}}const u={};for(const s of a){const t=`${s.number}_${s.direction}`,r="down"===s.direction?1:0,a="across"===s.direction?1:0;let n="",o=0;for(;;){var m,f;const t=s.row+r*o,c=s.col+a*o;if(t>=l.length||c>=((null===(m=l[0])||void 0===m?void 0:m.length)||0)||""===(null===(f=l[t])||void 0===f?void 0:f[c]))break;n+=e[`${t}_${c}`]||"_",o++}u[t]=n}try{await n.A.post(`/api/crosswords/${w.activity_id}/attempt`,{student_name:g,play_token:D.current,answers:u,cells_correct:o,cells_total:c,completed:o===c,time_taken_seconds:t})}catch{}h("complete"),o===c&&(async()=>{try{(0,(await s.e(8838).then(s.bind(s,78838))).default)({particleCount:150,spread:70,origin:{y:.6},useWorker:!0})}catch{}})()},[w,g]);if(N)return(0,x.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:(0,x.jsx)(o.Zp,{className:"max-w-md w-full",children:(0,x.jsxs)(o.Wu,{className:"py-12 text-center",children:[(0,x.jsx)(m.A,{className:"w-10 h-10 text-muted-foreground
2/40 mx-auto mb-4"}),(0,x.jsx)("p",{className:"text-foreground font-medium",children:N})]})})});if(!w)return(0,x.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:(0,x.jsx)(f.A,{className:"w-8 h-8 animate-spin text-primary"})});const T=w.content||{},z=(T.placements||[]).filter(e=>"across"===e.direction).sort((e,t)=>e.number-t.number),I=(T.placements||[]).filter(e=>"down"===e.direction).sort((e,t)=>e.number-t.number);var Z;return"name"===t?(0,x.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:(0,x.jsxs)(o.Zp,{className:"max-w-md w-full",children:[(0,x.jsxs)(o.aR,{className:"text-center",children:[(0,x.jsx)("div",{className:"mx-auto mb-3 p-3 rounded-full bg-primary/10 w-fit",children:(0,x.jsx)(m.A,{className:"w-8 h-8 text-primary"})}),(0,x.jsx)(o.ZB,{className:"text-xl",children:w.title}),(0,x.jsxs)("p",{className:"text-sm text-muted-foreground mt-1",children:[w.subject," \xb7 Year ",null===(Z=w.year_levels)||void 0===Z?void 0:Z.join(", ")]})]}),(0,x.jsxs)(o.Wu,{className:"space-y-4",children:[(0,x.jsxs)("div",{className:"space-y-1",children:[(0,x.jsx)(i.J,{htmlFor:"name",children:"Your name"}),(0,x.jsx)(c.p,{id:"name",placeholder:"Enter your name",value:g,onChange:e=>y(e.target.value),onKeyDown:e=>"Enter"===e.key&&R(),autoFocus:!0})]}),(0,x.jsx)(l.$,{className:"w-full bg-primary hover:bg-primary/90 text-primary-foreground",onClick:R,disabled:!g.trim(),children:"Start Crossword"}),(0,x.jsx)("p",{className:"text-xs text-center text-muted-foreground",children:"Created with My Curriculum Mate \xb7 mycurriculummate.com.au"})]})]})}):"complete"===t?(0,x.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:(0,x.jsx)(o.Zp,{className:"max-w-md w-full",children:(0,x.jsxs)(o.Wu,{className:"py-12 text-center",children:[(0,x.jsx)(u.A,{className:"w-16 h-16 text-primary mx-auto mb-4"}),(0,x.jsxs)("h2",{className:"text-2xl font-bold text-foreground",children:["Well done, ",g,"!"]}),(0,x.jsx)("p",{className:"text-muted-foreground mt-2",children:"You completed the crossword."}),(0,x.jsxs)("div",{className:"mt-6 p-4 rounded-lg bg-primary/10",children:[(0,x.jsx)("p",{className:"text-sm text-muted-foreground",children:"Progress"}),(0,x.jsxs)("p",{className:"text-3xl font-bold text-primary",children:[C,"%"]})]}),(0,x.jsx)(l.$,{className:"mt-6 w-full bg-primary hover:bg-primary/90 text-primary-foreground",onClick:()=>{h("play")},children:"Keep solving"})]})})}):(0,x.jsxs)("div",{className:"min-h-screen bg-background",children:[(0,x.jsxs)("div",{className:"bg-primary text-primary-foreground px-4 py-3 flex items-center gap-3",children:[(0,x.jsx)(m.A,{className:"w-5 h-5"}),(0,x.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,x.jsx)("p",{className:"font-semibold text-sm truncate",children:w.title}),(0,x.jsx)("p",{className:"text-xs opacity-80",children:g})]}),(0,x.jsx)("div",{className:"w-24 h-1.5 rounded-full bg-primary-foreground/30 overflow-hidden",children:(0,x.jsx)("div",{className:"h-full bg-primary-foreground rounded-full transition-all",style:{width:`${C}%`}})}),(0,x.jsxs)("span",{className:"text-xs font-mono opacity-80 w-10 text-right",children:[C,"%"]}),100===C&&(0,x.jsx)(l.$,{size:"sm",variant:"secondary",className:"text-xs",onClick:()=>E(A.current),children:"Submit"})]}),(0,x.jsxs)("div",{className:"flex flex-col lg:flex-row gap-0 lg:gap-4 p-4 max-w-6xl mx-auto",children:[(0,x.jsx)("div",{className:"flex-shrink-0 overflow-auto",children:(0,x.jsx)(d.A,{gridData:T.grid||[],placements:T.placements||[],readOnly:!1,onComplete:_,onGuessesChange:M})}),(0,x.jsxs)("div",{className:"flex-1 grid grid-cols-2 gap-4 mt-4 lg:mt-0 text-sm min-w-0",children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("p",{className:"text-xs font-semibold text-primary uppercase tracking-wide mb-2",children:"Across"}),(0,x.jsx)("ol",{className:"space-y-1.5",children:z.map(e=>(0,x.jsxs)("li",{className:"text-xs text-foreground leading-snug",children:[(0,x.jsxs)("span",{className:"font-semibold mr-1 text-muted-foreground",children:[e.number,"."]}),e.clue]},e.number))})]}),(0,x.jsxs)("div",{children:[(0,x.jsx)("p",{className:"text-xs font-semibold text-primary uppercase tracking-wide mb-2",children:"Down"}),(0,x.jsx)("ol",{className:"space-y-1.5",children:I.map(e=>(0,x.jsxs)("li",{className:"text-xs text-foreground leading-snug",children:[(0,x.jsxs)("span",{className:"font-semibold mr-1 text-muted-foreground",children:[e.number,"."]}),e.clue]},e.number))})]})]})]})]})}}
2,82054(e,t,s){s.d(t,{A:()=>r});const r=(0,s(77784).A)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},22024(e,t,s){s.d(t,{A:()=>r});const r=(0,s(77784).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},65131(e,t,s){s.d(t,{b:()=>c});var r=s(65043),a=(s(97950),s(16851)),n=s(70579),l=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{const s=(0,a.TL)(`Primitive.${t}`),l=r.forwardRef((e,r)=>{const{asChild:a,...l}=e,o=a?s:t;return"undefined"!==typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,n.jsx)(o,{...l,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{});var o=r.forwardRef((e,t)=>(0,n.jsx)(l.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));o.displayName="Label";var c=o}}]);
3//# sourceMappingURL=5513.cc6341fb.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.