PageSourceSearch

https://mycurriculummate.com.au/static/js/4359.56895a19.chunk.js

js mycurriculummate.com.au collected 2026-10-02 00:43:57 UTC 29,903 bytes, 3 lines download raw bytes

1/*! For license information please see 4359.56895a19.chunk.js.LICENSE.txt */
2"use strict";(globalThis.webpackChunkfrontend=globalThis.webpackChunkfrontend||[]).push([[4359],{1673(e,a,s){s.d(a,{y:()=>A,A:()=>R});var t=s(65043),r=s(73824),l=s(4980),n=s(56328),i=s(13390),o=s(91140),d=s(5949),c=s(65598),m=s(99432),u=s(22024),p=s(20073),x=s(36210),h=s(51419),g=s(11009),f=s(99766),y=s(31699),j=s(10917),v=s(70579);const b=(0,j.F)("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});t.forwardRef((e,a)=>{let{className:s,variant:t,size:r,...l}=e;return(0,v.jsx)(y.b,{ref:a,className:(0,f.cn)(b({variant:t,size:r,className:s})),...l})}).displayName=y.b.displayName;const N=t.createContext({size:"default",variant:"default"}),w=t.forwardRef((e,a)=>{let{className:s,variant:t,size:r,children:l,...n}=e;return(0,v.jsx)(g.bL,{ref:a,className:(0,f.cn)("flex items-center justify-center gap-1",s),...n,children:(0,v.jsx)(N.Provider,{value:{variant:t,size:r},children:l})})});w.displayName=g.bL.displayName;const k=t.forwardRef((e,a)=>{let{className:s,children:r,variant:l,size:n,...i}=e;const o=t.useContext(N);return(0,v.jsx)(g.q7,{ref:a,className:(0,f.cn)(b({variant:o.variant||l,size:o.size||n}),s),...i,children:r})});k.displayName=g.q7.displayName;const C=s(26712).D.find(e=>"pro"===e.id)||{price:"$120",period:"/year",monthlyPrice:"$12.99",monthlyPeriod:"/month",monthlyBilling:"Billed monthly",yearlySavings:"Save with yearly billing"},A=e=>{let{onComplete:a}=e;const[s,i]=(0,t.useState)(!1);(0,t.useEffect)(()=>{const e=new URLSearchParams(window.location.search),a=e.get("credit_purchase"),s=e.get("session_id");"success"===a&&s?d(s):"cancelled"===a&&(n.oR.info("Credit purchase was cancelled"),window.history.replaceState({},document.title,window.location.pathname))},[]);const d=async e=>{i(!0);try{const s=await l.A.get(`${r.nC}/payments/credit-purchase/status/${e}`);"success"===s.data.status?(n.oR.success(s.data.message),a&&a()):"already_applied"===s.data.status?n.oR.info(s.data.message):"pending"===s.data.status?n.oR.info("Payment is still processing. Credits will be added shortly."):n.oR.error(s.data.message||"Failed to apply credits")}catch(s){n.oR.error("Failed to verify purchase. Please contact support if credits weren't added.")}finally{i(!1),window.history.replaceState({},document.title,window.location.pathname)}};return s?(0,v.jsx)("div",{className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm flex items-center justify-center",children:(0,v.jsx)(o.Zp,{className:"w-80",children:(0,v.jsxs)(o.Wu,{className:"pt-6 text-center",children:[(0,v.jsx)(u.A,{className:"w-12 h-12 animate-spin text-primary mx-auto mb-4"}),(0,v.jsx)("h3",{className:"font-semibold",children:"Applying Credits..."}),(0,v.jsx)("p",{className:"text-sm text-muted-foreground",children:"Please wait while we add credits to your account."})]})})}):null},R=e=>{let{isOpen:a,onClose:s,onPurchaseComplete:g}=e;const[f,y]=(0,t.useState)([]),[j,b]=(0,t.useState)(!0),[N,A]=(0,t.useState)(null),[R,_]=(0,t.useState)("yearly");(0,t.useEffect)(()=>{a&&P()},[a]);const P=async()=>{b(!0);try{const e=await l.A.get(`${r.nC}/payments/credit-packs`);y(e.data.packs)}catch(e){n.oR.error("Failed to load credit packs")}finally{b(!1)}},$=async e=>{A(e);try{const a=await l.A.post(`${r.nC}/payments/purchase-credits`,{pack_id:e});a.data.checkout_url&&(window.location.href=a.data.checkout_url)}catch(t){var a,s;n.oR.error((null===(a=t.response)||void 0===a||null===(s=a.data)||void 0===s?void 0:s.detail)||"Failed to start purchase"),A(null)}},I=e=>e>=500?"from-purple-500 to-pink-500":e>=250?"from-blue-500 to-purple-500":e>
2=100?"from-green-500 to-blue-500":"from-amber-500 to-orange-500";return(0,v.jsx)(c.lG,{open:a,onOpenChange:s,children:(0,v.jsxs)(c.Cf,{className:"sm:max-w-[600px]",children:[(0,v.jsxs)(c.c7,{children:[(0,v.jsxs)(c.L3,{className:"flex items-center gap-2",children:[(0,v.jsx)(m.A,{className:"w-5 h-5 text-amber-500"}),"Buy More Credits"]}),(0,v.jsx)(c.rr,{children:"Purchase additional credits to continue generating lesson plans, slideshows, and worksheets."})]}),j?(0,v.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,v.jsx)(u.A,{className:"w-8 h-8 animate-spin text-primary"})}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(o.Zp,{className:"border-2 border-primary bg-primary/5 dark:bg-primary/10 overflow-hidden",children:[(0,v.jsx)("div",{className:"h-2 bg-gradient-to-r from-primary to-primary/70"}),(0,v.jsxs)(o.Wu,{className:"pt-5 pb-4",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,v.jsx)(p.A,{className:"w-5 h-5 text-primary"}),(0,v.jsx)("h3",{className:"font-bold text-lg",children:"Upgrade to Pro"})]}),(0,v.jsxs)(w,{type:"single",size:"sm",value:R,onValueChange:e=>e&&_(e),className:"w-fit bg-muted/60 rounded-full p-1 mb-3",children:[(0,v.jsx)(k,{value:"monthly",className:"rounded-full px-3 text-xs",children:"Monthly"}),(0,v.jsx)(k,{value:"yearly",className:"rounded-full px-3 text-xs",children:"Yearly"})]}),(0,v.jsxs)("div",{className:"flex items-baseline justify-between gap-2 mb-3",children:[(0,v.jsxs)("span",{className:"text-2xl font-bold text-primary",children:["monthly"===R?C.monthlyPrice:C.price,(0,v.jsx)("span",{className:"text-sm font-normal text-muted-foreground",children:"monthly"===R?C.monthlyPeriod:C.period})]}),(0,v.jsx)("span",{className:"text-xs text-muted-foreground text-right min-w-0",children:"monthly"===R?C.monthlyBilling:C.yearlySavings})]}),(0,v.jsxs)("ul",{className:"space-y-1.5 mb-4 text-sm",children:[(0,v.jsxs)("li",{className:"flex items-center gap-2",children:[(0,v.jsx)(x.A,{className:"w-4 h-4 text-primary flex-shrink-0"}),"500 credits monthly \u2014 unused credits roll over (up to 1,000)"]}),(0,v.jsxs)("li",{className:"flex items-center gap-2",children:[(0,v.jsx)(x.A,{className:"w-4 h-4 text-primary flex-shrink-0"}),"All Pro features \u2014 slideshows, unit plans, image generation, AI chat"]}),"yearly"===R&&(0,v.jsxs)("li",{className:"flex items-center gap-2",children:[(0,v.jsx)(x.A,{className:"w-4 h-4 text-primary flex-shrink-0"}
2),"7-day free trial (yearly billing) \u2014 no charge today"]})]}),(0,v.jsx)(i.$,{className:"w-full bg-primary hover:bg-primary/90 text-primary-foreground",disabled:null!==N,onClick:async()=>{A("pro_upgrade");try{const e=await l.A.post(`${r.nC}/payments/create-checkout-session`,{tier:"monthly"===R?"pro_monthly":"pro"});e.data.checkout_url?window.location.href=e.data.checkout_url:(n.oR.error("Failed to start checkout"),A(null))}catch(s){var e,a;n.oR.error((null===(e=s.response)||void 0===e||null===(a=e.data)||void 0===a?void 0:a.detail)||"Failed to start checkout"),A(null)}},children:"pro_upgrade"===N?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Redirecting to checkout..."]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(p.A,{className:"w-4 h-4 mr-2"}),"Upgrade \u2014 ","monthly"===R?"Monthly":"Yearly"]})})]})]}),(0,v.jsxs)("div",{className:"relative py-2",children:[(0,v.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,v.jsx)("span",{className:"w-full border-t"})}),(0,v.jsx)("div",{className:"relative flex justify-center text-xs uppercase",children:(0,v.jsx)("span",{className:"bg-background px-2 text-muted-foreground",children:"Or purchase a one-off credit pack"})})]}),(0,v.jsx)("div",{className:"grid grid-cols-2 gap-4",children:f.map(e=>{const a=(e=>{switch(e){case"credits_100":return"10% off";case"credits_250":return"20% off";case"credits_500":return"30% off";default:return null}})(e.pack_id);return(0,v.jsxs)(o.Zp,{className:"relative overflow-hidden border-2 transition-all hover:border-primary/50 hover:shadow-lg cursor-pointer "+(N===e.pack_id?"border-primary":"border-border"),onClick:()=>!N&&$(e.pack_id),children:[a&&(0,v.jsx)(d.E,{className:"absolute top-2 right-2 bg-green-500 text-white text-xs",children:a}),(0,v.jsx)("div",{className:`h-2 bg-gradient-to-r ${I(e.credits)}`}),(0,v.jsx)(o.Wu,{className:"pt-4",children:(0,v.jsxs)("div",{className:"text-center",children:[(0,v.jsx)("div",{className:`inline-flex items-center justify-center w-12 h-12 rounded-full bg-gradient-to-r ${I(e.credits)} text-white mb-3`,children:(0,v.jsx)(m.A,{className:"w-6 h-6"})}),(0,v.jsx)("h3",{className:"text-2xl font-bold",children:e.credits}),(0,v.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"credits"}),(0,v.jsx)("div",{className:"text-xl font-semibold text-primary",children:e.price_formatted}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground",children:e.currency}),(0,v.jsx)(i.$,{className:"w-full mt-4",disabled:null!==N,onClick:a=>{a.stopPropagation(),$(e.pack_id)},children:N===e.pack_id?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(u.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Processing..."]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(h.A,{className:"w-4 h-4 mr-2"}),"Buy Now"]})})]})})]},e.pack_id)})})]}),(0,v.jsx)("div",{className:"text-center text-xs text-muted-foreground pt-2 border-t",children:(0,v.jsx)("p",{children:"Secure payment powered by Stripe. Credits never expire."})})]})})}},91140(e,a,s){s.d(a,{BT:()=>d,Wu:()=>c,ZB:()=>o,Zp:()=>n,aR:()=>i,wL:()=>m});var t=s(65043),r=s(99766),l=s(70579);const n=t.forwardRef((e,a)=>{let{className:s,...t}=e;return(0,l.jsx)("div",{ref:a,className:(0,r.cn)("rounded-xl border bg-card text-card-foreground shadow",s),...t})});n.displayName="Card";const i=t.forwardRef((e,a)=>{let{className:s,...t}=e;return(0,l.jsx)("div",{ref:a,className:(0,r.cn)("flex flex-col space-y-1.5 p-6",s),...t})});i.displayName="CardHeader";const o=t.forwardRef((e,a)=>{let{className:s,...t}=e;return(0,l.jsx)("div",{ref:a,className:(0,r.cn)("font-semibold leading-none tracking-tight",s),...t})});o.displayName="CardTitle";const d=t.forwardRef((e,a)=>{let{className:s,...t}=e;return(0,l.jsx)("div",{ref:a,className:(0,r.cn)("text-sm text-muted-foreground",s),...t})});d.displayName="CardDescription";const c=t.forwardRef((e,a)=>{let{className:s,...t}=e;return(0,l.jsx)("div",{ref:a,className:(0,r.cn)("p-6 pt-0",s),...t})});c.displayName="CardContent";const m=t.forwardRef((e,a)=>{let{className:s,...t}=e;return(0,l.jsx)("div",{ref:a,className:(0,r.cn)("flex items-center p-6 pt-0",s),...t})});
2m.displayName="CardFooter"},92264(e,a,s){s.d(a,{p:()=>n});var t=s(65043),r=s(99766),l=s(70579);const n=t.forwardRef((e,a)=>{let{className:s,type:t,...n}=e;return(0,l.jsx)("input",{type:t,className:(0,r.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:a,...n})});n.displayName="Input"},84370(e,a,s){s.d(a,{bq:()=>u,eb:()=>g,gC:()=>h,l6:()=>c,yv:()=>m});var t=s(65043),r=s(22095),l=s(36210),n=s(92382),i=s(15711),o=s(99766),d=s(70579);const c=r.bL,m=(r.YJ,r.WT),u=t.forwardRef((e,a)=>{let{className:s,children:t,...l}=e;return(0,d.jsxs)(r.l9,{ref:a,className:(0,o.cn)("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...l,children:[t,(0,d.jsx)(r.In,{asChild:!0,children:(0,d.jsx)(n.A,{className:"h-4 w-4 opacity-50"})})]})});u.displayName=r.l9.displayName;const p=t.forwardRef((e,a)=>{let{className:s,...t}=e;return(0,d.jsx)(r.PP,{ref:a,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",s),...t,children:(0,d.jsx)(i.A,{className:"h-4 w-4"})})});p.displayName=r.PP.displayName;const x=t.forwardRef((e,a)=>{let{className:s,...t}=e;return(0,d.jsx)(r.wn,{ref:a,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",s),...t,children:(0,d.jsx)(n.A,{className:"h-4 w-4"})})});x.displayName=r.wn.displayName;const h=t.forwardRef((e,a)=>{let{className:s,children:t,position:l="popper",...n}=e;return(0,d.jsx)(r.ZL,{children:(0,d.jsxs)(r.UC,{ref:a,className:(0,o.cn)("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:l,...n,children:[(0,d.jsx)(p,{}),(0,d.jsx)(r.LM,{className:(0,o.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,d.jsx)(x,{})]})})});h.displayName=r.UC.displayName;t.forwardRef((e,a)=>{let{className:s,...t}=e;return(0,d.jsx)(r.JU,{ref:a,className:(0,o.cn)("px-2 py-1.5 text-sm font-semibold",s),...t})}).displayName=r.JU.displayName;const g=t.forwardRef((e,a)=>{let{className:s,children:t,...n}=e;return(0,d.jsxs)(r.q7,{ref:a,className:(0,o.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...n,children:[(0,d.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,d.jsx)(r.VF,{children:(0,d.jsx)(l.A,{className:"h-4 w-4"})})}),(0,d.jsx)(r.p4,{children:t})]})});g.displayName=r.q7.displayName;t.forwardRef((e,a)=>{let{className:s,...t}=e;return(0,d.jsx)(r.wv,{ref:a,className:(0,o.cn)("-mx-1 my-1 h-px bg-muted",s),...t})}).displayName=r.wv.displayName},4359(e,a,s){s.r(a),s.d(a,{default:()=>k});var t=s(65043),r=s(45621),l=s(73824),n=s(4980),i=s(56328),o=s(13390),d=s(91140),c=s(92264),m=s(59938),u=s(13416),p=s(84370),x=s(46258),h=s(1673),g=s(22024),f=s(56099),y=s(65469),j=s(7104),v=s(70067),b=s(65727),N=s(9855),w=s(70579);const k=()=>{var e,a,s,k;const C=(0,r.Zp)(),{user:A}=(0,l.As)(),[R,_]=(0,t.useState)(!1),[P,$]=(0,t.useState)(!1),[I,G]=(0,t.useState)(null),[S,z]=(0,t.useState)([]),[F,L]=(0,t.useState)(null),[T,U]=(0,t.useState)([]),[Z,M]=(0,t.useState)({prompt:"",style:"educational",subject:"",year_level:""});(0,t.useEffect)(()=>{B(),E(),q()},[]);const B=async()=>{try{const e=await n.A.get(`${l.nC}/subscription`);G(e.data)}catch(e){console.error("Error fetching subscription:",e)}},E=async()=>{try{const e=await n.A.get(`${l.nC}/images`);z(e.data)}catch(e){console.error("Error fetching images:",e)}},q=async()=>{try{const e=await n.A.get(`${l.nC}/curriculum/years`);U(e.data.years)}catch(e){console.error("Error fetching years:",e)}},D="pro"===(null===A||void 0===A?void 0:A.subscription_tier)||"schools"===(null===A||void 0===A?void 0:A.subscription_tier),V=null===I||void 0===I||null===(e=I.features)||void 0===e?void 0:e.includes("image_generator"),W="admin"===(null===A||void 0===A?void 0:A.role),Y=D||V||W,J=async e=>{try{const a=await n.A.get(`${l.nC}/images/${e}`,{responseType:"blob"}),s=window.URL.createObjectURL(new Blob([a.data])),t=document.createElement("a");t.href=s,t.setAttribute("download",`educational_image_${e}.png`),document.body.appendChild(t),t.click(),t.remove(),window.URL.revokeObjectURL(s)}catch(a){i.oR.error("Failed to download image")}};return(0,w.jsxs)(x.A,{children:[(0,w.jsxs)("div",{className:"max-w-5xl mx-auto","data-testid":"images-tool-page",children:[(0,w.jsxs)(o.$,{variant:"ghost",onClick:()=>
2C("/dashboard"),className:"mb-4","data-testid":"back-btn",children:[(0,w.jsx)(y.A,{className:"w-4 h-4 mr-2"}),"Back to Dashboard"]}),(0,w.jsxs)("div",{className:"flex items-center gap-3 mb-8",children:[(0,w.jsx)("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-rose-500 to-pink-600 flex items-center justify-center text-white",children:(0,w.jsx)(v.A,{className:"w-6 h-6"})}),(0,w.jsxs)("div",{className:"min-w-0",children:[(0,w.jsx)("h1",{className:"text-3xl font-bold text-foreground",children:"Educational Images"}),(0,w.jsx)("p",{className:"text-muted-foreground",children:"Generate custom AI visuals for your lessons"})]}),Y&&(0,w.jsx)("div",{className:"ml-auto"}),!Y&&(0,w.jsxs)(o.$,{variant:"outline",size:"sm",onClick:()=>C("/subscription"),className:"ml-auto","data-testid":"upgrade-btn",children:[(0,w.jsx)(b.A,{className:"w-4 h-4 mr-2"}),"Pro Feature"]})]}),Y?(0,w.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[(0,w.jsxs)(d.Zp,{className:"border-border/50",children:[(0,w.jsx)(d.aR,{children:(0,w.jsxs)(d.ZB,{className:"flex items-center gap-2",children:[(0,w.jsx)(f.A,{className:"w-5 h-5 text-secondary"}),"Generate New Image"]})}),(0,w.jsxs)(d.Wu,{className:"space-y-4",children:[(0,w.jsxs)("div",{className:"form-group",children:[(0,w.jsx)(m.J,{children:"Describe Your Image *"}),(0,w.jsx)(u.T,{placeholder:"e.g., A diagram showing the water cycle with labels for evaporation, condensation, and precipitation",value:Z.prompt,onChange:e=>M({...Z,prompt:e.target.value}),rows:4,"data-testid":"prompt-input"})]}),(0,w.jsxs)("div",{className:"form-group",children:[(0,w.jsx)(m.J,{children:"Image Style"}),(0,w.jsxs)(p.l6,{value:Z.style,onValueChange:e=>M({...Z,style:e}),children:[(0,w.jsx)(p.bq,{"data-testid":"style-select",children:(0,w.jsx)(p.yv,{})}),(0,w.jsx)(p.gC,{children:[{value:"educational",label:"Educational Diagram"},{value:"cartoon",label:"Cartoon / Illustration"},{value:"realistic",label:"Realistic"},{value:"infographic",label:"Infographic"},{value:"sketch",label:"Hand-drawn Sketch"}].map(e=>(0,w.jsx)(p.eb,{value:e.value,children:e.label},e.value))})]})]}),(0,w.jsxs)("div",{className:"form-group",children:[(0,w.jsx)(m.J,{children:"Subject Area (optional)"}),(0,w.jsx)(c.p,{placeholder:"e.g., Science, Mathematics, History",value:Z.subject,onChange:e=>M({...Z,subject:e.target.value}),"data-testid":"subject-input"})]}),(0,w.jsxs)("div",{className:"form-group",children:[(0,w.jsx)(m.J,{children:"Year Level (optional)"}),(0,w.jsxs)(p.l6,{value:Z.year_level,onValueChange:e=>M({...Z,year_level:e}),children:[(0,w.jsx)(p.bq,{"data-testid":"year-select",children:(0,w.jsx)(p.yv,{placeholder:"Select year level"})}),(0,w.jsx)(p.gC,{children:T.map(e=>(0,w.jsx)(p.eb,{value:e,children:"K"===e?"Kindergarten":`Year ${e}`},e))})]})]}),(0,w.jsxs)("div",{className:"form-group",children:[(0,w.jsx)(m.J,{children:"Keywords (optional)"}),(0,w.jsx)(c.p,{placeholder:"e.g., diagram, labelled, colourful, simple",value:Z.keywords||"",onChange:e=>M({...Z,keywords:e.target.value}),"data-testid":"keywords-input"}),(0,w.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Add keywords to guide the AI image generation"})]}),I&&!W&&(0,w.jsxs)("div",{className:"flex items-center justify-between text-sm px-3 py-2 rounded-lg border "+((null!==(a=I.credits_balance)&&void 0!==a?a:0)>=10?"bg-primary/5 border-primary/20 text-primary":"bg-amber-50 border-amber-200 text-amber-700"),children:[(0,w.jsxs)("span",{children:["Credit cost: ",(0,w.jsx)("strong",{children:"10"})]}),(0,w.jsxs)("span",{children:[(null!==(s=I.credits_balance)&&void 0!==s?s:0)>=10?"\u2713":"\u26a0"," ",null!==(k=I.credits_balance)&&void 0!==k?k:0," available"]})]}),(0,w.jsx)(o.$,{onClick:async()=>{if(!Y)return i.oR.error("Image Generator requires a Pro subscription"),void C("/subscription");if(Z.prompt.trim()){_(!0),L(null);try{const e=await n.A.post(`${l.nC}/images/generate`,Z);i.oR.success("Image generated successfully!");const a=`${l.nC}/images/${e.data.image_id}`;L({id:e.data.image_id,url:a,message:e.data.message}),E(),M({...Z,prompt:""})}catch(u){var e,a,s,t,r,o,d,c,m;if(403===(null===(e=u.response)||void 0===e?void 0:e.status)&&(null!==(a=u.response)&&void 0!==a&&null!==(s=a.data)&&void 0!==s&&null!==(t=s.detail)&&void 0!==t&&t.toLowerCase().includes("insufficient credits")||null!==(r=u.response)&&void 0!==r&&null!==(o=r.data)&&void 0!==o&&null!==(d=o.detail)&&void 0!==d&&d.toLowerCase().includes("free trial has ended")))$(!0);else i.oR.error((null===(c=u.response)||void 0===c||null===(m=c.data)||void 0===m?void 0:m.detail)||"Failed to generate image. Please try again.")}finally{_(!1)}}else i.oR.error("Please describe the image you want to create")},disabled:R,className:"w-full bg-secondary text-secondary-foreground hover:bg-secondary/90 rounded-full","data-testid":"generate-btn",children:R?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(g.A,{className:"w-4 h-4 mr-2 animate-spin"}),"Generating... (this may take a moment)"]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(f.A,{className:"w-4 h-4 mr-2"}),"Generate Image"]})}),(0,w.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:"Powered by AI - Images are generated specifically for educational use"})]})]}),(0,w.jsxs)(d.Zp,{className:"border-border/50",children:[(0,w.jsx)(d.aR,{children:(0,w.jsx)(d.ZB,{children:"Generated Image"})}),(0,w.jsx)(d.Wu,{children:R?(0,w.jsxs)("div",{className:"text-center py-12",children:[(0,w.jsx)(g.A,{className:"w-16 h-16 text-secondary animate-spin mx-auto mb-4"}),(0,w.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-2",children:"Creating Your Image..."}),(0,w.jsx)("p",{className:"text-muted-foreground text-sm",children:"Our AI is generating a custom educational image for you."})]}):F?(0,w.jsxs)("div",{className:"space-y-4",children:[(0,w.jsx)("div",{className:"relative rounded-lg overflow-hidden border border-border",children:(0,w.jsx)("img",{src:F.url,alt:"Generated educational image",className:"w-full h-auto","data-testid":"generated-image",loading:"lazy"})}),F.message&&(0,w.jsx)("p",{className:"text-sm text-muted-foreground",children:F.message}),(0,w.jsx)("div",{className:"flex gap-2",children:(0,w.jsxs)(o.$,{variant:"outline",onClick:()=>J(F.id),className:"flex-1 rounded-full","data-testid":"download-btn",children:[(0,w.jsx)(j.A,{className:"w-4 h-4 mr-2"}),"Download"]})})]}):(0,w.jsxs)("div",{className:"text-center py-12",children:[(0,w.jsx)(v.A,{className:"w-16 h-16 text-muted-foreground
2/30 mx-auto mb-4"}),(0,w.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-2",children:"No Image Yet"}),(0,w.jsx)("p",{className:"text-muted-foreground text-sm",children:'Describe what you want and click "Generate Image" to create a custom educational visual.'})]})})]}),(0,w.jsxs)(d.Zp,{className:"border-border/50 lg:col-span-2",children:[(0,w.jsx)(d.aR,{children:(0,w.jsx)(d.ZB,{children:"Your Generated Images"})}),(0,w.jsx)(d.Wu,{children:S.length>0?(0,w.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:S.map(e=>{var a;return(0,w.jsxs)("div",{className:"relative group rounded-lg overflow-hidden border border-border bg-muted/20",children:[(0,w.jsx)("img",{src:`${l.nC}/images/${e.image_id}`,alt:e.prompt,className:"w-full h-32 object-cover",loading:"lazy"}),(0,w.jsxs)("div",{className:"absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:[(0,w.jsx)(o.$,{size:"sm",variant:"secondary",onClick:()=>J(e.image_id),className:"rounded-full",children:(0,w.jsx)(j.A,{className:"w-4 h-4"})}),(0,w.jsx)(o.$,{size:"sm",variant:"destructive",onClick:()=>(async e=>{try{await n.A.delete(`${l.nC}/images/${e}`),i.oR.success("Image deleted"),E(),(null===F||void 0===F?void 0:F.id)===e&&L(null)}catch(a){i.oR.error("Failed to delete image")}})(e.image_id),className:"rounded-full",children:(0,w.jsx)(N.A,{className:"w-4 h-4"})})]}),(0,w.jsxs)("div",{className:"p-2",children:[(0,w.jsxs)("p",{className:"text-xs text-muted-foreground truncate",children:[null===(a=e.prompt)||void 0===a?void 0:a.substring(0,40),"..."]}),(0,w.jsxs)("p",{className:"text-xs text-muted-foreground/70",children:[e.style," \u2022 ",e.subject||"General"]})]})]},e.image_id)})}):(0,w.jsxs)("div",{className:"text-center py-8",children:[(0,w.jsx)(v.A,{className:"w-12 h-12 text-muted-foreground/50 mx-auto mb-4"}),(0,w.jsx)("p",{className:"text-muted-foreground",children:"No images generated yet"}),(0,w.jsx)("p",{className:"text-sm text-muted-foreground",children:"Create your first educational image above"})]})})]})]}):(0,w.jsx)(d.Zp,{className:"border-secondary/30 bg-secondary/5",children:(0,w.jsxs)(d.Wu,{className:"p-8 text-center",children:[(0,w.jsx)(b.A,{className:"w-16 h-16 text-secondary/50 mx-auto mb-4"}),(0,w.jsx)("h2",{className:"text-2xl font-bold text-foreground mb-2",children:"Upgrade to Pro"}),(0,w.jsx)("p",{className:"text-muted-foreground mb-6 max-w-md mx-auto",children:"Educational Image Generator is a Pro feature. Upgrade to create custom diagrams, illustrations, and visuals for your lessons."}),(0,w.jsx)(o.$,{onClick:()=>C("/subscription"),className:"bg-secondary text-secondary-foreground hover:bg-secondary/90 rounded-full px-8","data-testid":"upgrade-now-btn",children:"Upgrade Now"})]})})]}),(0,w.jsx)(h.A,{isOpen:P,onClose:()=>$(!1),onPurchaseComplete:()=>$(!1)})]})}},99432(e,a,s){s.d(a,{A:()=>t});const t=(0,s(77784).A)("coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]])},7104(e,a,s){s.d(a,{A:()=>t});const t=(0,s(77784).A)("download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},22024(e,a,s){s.d(a,{A:()=>t});const t=(0,s(77784).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},65727(e,a,s){s.d(a,{A:()=>t});const t=(0,s(77784).A)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},51419(e,a,s){s.d(a,{A:()=>t});const t=(0,s(77784).A)("shopping-cart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]])},11009(e,a,s){s.d(a,{bL:()=>A,q7:()=>R});var t=s(65043),r=s(21862),l=s(87914),n=s(96711),i=s(31699),o=s(13642),d=s(14204),
2c=s(70579),m="ToggleGroup",[u,p]=(0,r.A)(m,[n.RG]),x=(0,n.RG)(),h=t.forwardRef((e,a)=>{const{type:s,...t}=e;if("single"===s){const e=t;return(0,c.jsx)(y,{...e,ref:a})}if("multiple"===s){const e=t;return(0,c.jsx)(j,{...e,ref:a})}throw new Error(`Missing prop \`type\` expected on \`${m}\``)});h.displayName=m;var[g,f]=u(m),y=t.forwardRef((e,a)=>{const{value:s,defaultValue:r,onValueChange:l=()=>{},...n}=e,[i,d]=(0,o.i)({prop:s,defaultProp:r??"",onChange:l,caller:m});return(0,c.jsx)(g,{scope:e.__scopeToggleGroup,type:"single",value:t.useMemo(()=>i?[i]:[],[i]),onItemActivate:d,onItemDeactivate:t.useCallback(()=>d(""),[d]),children:(0,c.jsx)(N,{...n,ref:a})})}),j=t.forwardRef((e,a)=>{const{value:s,defaultValue:r,onValueChange:l=()=>{},...n}=e,[i,d]=(0,o.i)({prop:s,defaultProp:r??[],onChange:l,caller:m}),u=t.useCallback(e=>d(function(){return[...arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e]}),[d]),p=t.useCallback(e=>d(function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(a=>a!==e)}),[d]);return(0,c.jsx)(g,{scope:e.__scopeToggleGroup,type:"multiple",value:i,onItemActivate:u,onItemDeactivate:p,children:(0,c.jsx)(N,{...n,ref:a})})});h.displayName=m;var[v,b]=u(m),N=t.forwardRef((e,a)=>{const{__scopeToggleGroup:s,disabled:t=!1,rovingFocus:r=!0,orientation:i,dir:o,loop:m=!0,...u}=e,p=x(s),h=(0,d.jH)(o),g={role:"group",dir:h,...u};return(0,c.jsx)(v,{scope:s,rovingFocus:r,disabled:t,children:r?(0,c.jsx)(n.bL,{asChild:!0,...p,orientation:i,dir:h,loop:m,children:(0,c.jsx)(l.sG.div,{...g,ref:a})}):(0,c.jsx)(l.sG.div,{...g,ref:a})})}),w="ToggleGroupItem",k=t.forwardRef((e,a)=>{const s=f(w,e.__scopeToggleGroup),r=b(w,e.__scopeToggleGroup),l=x(e.__scopeToggleGroup),i=s.value.includes(e.value),o=r.disabled||e.disabled,d={...e,pressed:i,disabled:o},m=t.useRef(null);return r.rovingFocus?(0,c.jsx)(n.q7,{asChild:!0,...l,focusable:!o,active:i,ref:m,children:(0,c.jsx)(C,{...d,ref:a})}):(0,c.jsx)(C,{...d,ref:a})});k.displayName=w;var C=t.forwardRef((e,a)=>{const{__scopeToggleGroup:s,value:t,...r}=e,l=f(w,s),n={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},o="single"===l.type?n:void 0;
2return(0,c.jsx)(i.l,{...o,...r,ref:a,onPressedChange:e=>{e?l.onItemActivate(t):l.onItemDeactivate(t)}})}),A=h,R=k},31699(e,a,s){s.d(a,{b:()=>c,l:()=>d});var t=s(65043),r=s(30858),l=s(13642),n=s(87914),i=s(70579),o="Toggle",d=t.forwardRef((e,a)=>{const{pressed:s,defaultPressed:t,onPressedChange:d,...c}=e,[m,u]=(0,l.i)({prop:s,onChange:d,defaultProp:t??!1,caller:o});return(0,i.jsx)(n.sG.button,{type:"button","aria-pressed":m,"data-state":m?"on":"off","data-disabled":e.disabled?"":void 0,...c,ref:a,onClick:(0,r.mK)(e.onClick,()=>{e.disabled||u(!m)})})});d.displayName=o;var c=d}}]);
3//# sourceMappingURL=4359.56895a19.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.