!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c235d2d7-5957-42a8-9016-b0b23e6175bc",e._sentryDebugIdIdentifier="sentry-dbid-c235d2d7-5957-42a8-9016-b0b23e6175bc")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4011],{58563:function(e,t,a){Promise.resolve().then(a.bind(a,81523)),Promise.resolve().then(a.bind(a,70049)),Promise.resolve().then(a.bind(a,96815))},96815:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return N}});var r=a(57437),s=a(615),n=a(72088),o=a(36633),i=a(2265),l=a(18752),c=a(99376),d=a(18229),u=a(93448),m=a(72364),f=a(59791),g=a(22048),h=a(46214);let p="Registration failed";var x=function(){let[e,t]=(0,i.useState)(""),[a,s]=(0,i.useState)(""),[o,d]=(0,i.useState)(""),[x,y]=(0,i.useState)(""),[b,v]=(0,i.useState)(""),[_,w]=(0,i.useState)(!0),{toast:j}=(0,l.pm)(),S=(0,c.useRouter)(),N=async t=>{t.preventDefault();try{let t=await fetch("".concat((0,u.kG)(),"/register"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,school:a,email:o,password:x})}),r=await t.json();if(t.ok)g.av({email:o,role:"teacher",auth:"email"}),h.ZP.identify(o),localStorage.setItem("email",o),localStorage.setItem("role","teacher"),localStorage.setItem("access_token",r.access_token),document.cookie="token=".concat(r.access_token,"; path=/; max-age=2592000; SameSite=None; Secure"),S.push("/home/".concat(r.access_token,"?tutorial=true"));else{if(422===t.status)return j({title:p,description:(0,u.wY)(r.detail[0].loc[1])});return j({title:p,description:r.detail})}}catch(e){return console.error("Error during Teacher Sign Up",e),j({title:p,description:"Please try again."})}};return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("form",{onSubmit:N,className:"grid gap-4",children:[(0,r.jsx)(m.I,{name:"name",placeholder:"Full Name",value:e,onChange:e=>t(e.target.value),"data-sentry-element":"Input","data-sentry-source-file":"teacher_sign_up_form.tsx"}),(0,r.jsx)(m.I,{name:"schoolName",placeholder:"School Name",value:a,onChange:e=>s(e.target.value),"data-sentry-element":"Input","data-sentry-source-file":"teacher_sign_up_form.tsx"}),(0,r.jsx)(m.I,{name:"email",placeholder:"School Email",value:o,onChange:e=>d(e.target.value),"data-sentry-element":"Input","data-sentry-source-file":"teacher_sign_up_form.tsx"}),(0,r.jsx)(m.I,{name:"password",placeholder:"Password",type:"password",value:x,onChange:e=>y(e.target.value),"data-sentry-element":"Input","data-sentry-source-file":"teacher_sign_up_form.tsx"}),(0,r.jsx)(m.I,{name:"confirmPassword",placeholder:"Confirm Password",type:"password",value:b,onChange:e=>v(e.target.value),"data-sentry-element":"Input","data-sentry-source-file":"teacher_sign_up_form.tsx"}),(0,r.jsxs)("div",{className:"flex items-center space-x-2 py-2",children:[(0,r.jsx)(f.X,{id:"terms",checked:_,onCheckedChange:e=>w(e),className:"h-5 w-5 rounded border-gray-300 data-[state=checked]:bg-[#228BE6]","data-sentry-element":"Checkbox","data-sentry-source-file":"teacher_sign_up_form.tsx"}),(0,r.jsx)("label",{htmlFor:"terms",className:"text-md",children:"I am an educator affiliated with the listed school."})]}),(0,r.jsx)(n.z,{type:"submit",className:"bg-[#228BE6] hover:bg-[#4285F4] text-white",disabled:!_,"data-sentry-element":"Button","data-sentry-source-file":"teacher_sign_up_form.tsx",children:"Register"})]})})};let y="Registration failed";var b=function(e){let{emailPassed:t,firstNamePassed:a,lastNamePassed:s,classIDPassed:o}=e,[d,f]=(0,i.useState)(t||""),[h,p]=(0,i.useState)(a||""),[x,b]=(0,i.useState)(s||""),[v,_]=(0,i.useState)(""),[w,j]=(0,i.useState)(""),{toast:S}=(0,l.pm)(),N=(0,c.useRouter)(),k=async e=>{e.preventDefault();try{let e=await fetch("".concat((0,u.kG)(),"/student-register"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({first:h,last:x,email:d,password:v})}),t=await e.json();if(e.ok){if(g.av({email:d,role:"student",auth:"email"}),localStorage.setItem("email",d),localStorage.setItem("role","student"),localStorage.setItem("student_access_token",t.student_access_token),document.cookie="student_token=".concat(t.student_access_token,"; path=/; max-age=2592000; SameSite=None; Secure"),o){let e=await fetch("".concat((0,u.kG)(),"/add-student-to-class"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t.student_access_token)},body:JSON.stringify({class_id:o})});e.ok||console.error("Error adding student to class",e)}N.push("/student/classes")}else{if(422===e.status)return S({title:y,description:(0,u.wY)(t.detail[0].loc[1])});return S({title:y,description:t.detail})}}catch(e){return console.error("Error during Student Sign Up",e),S({title:y,description:"Please try again."})}};return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("form",{onSubmit:k,className:"grid gap-4",children:[(0,r.jsx)(m.I,{name:"firstName",placeholder:"First Name",value:h,onChange:e=>p(e.target.value),"data-sentry-element":"Input","data-sentry-source-file":"student_sign_up_form.tsx"}),(0,r.jsx)(m.I,{name:"lastName",placeholder:"Last Name",value:x,onChange:e=>b(e.target.value),"data-sentry-element":"Input","data-sentry-source-file":"student_sign_up_form.tsx"}),(0,r.jsx)(m.I,{name:"email",placeholder:"School Email",value:d,onChange:e=>f(e.target.value),"data-sentry-element":"Input","data-sentry-source-file":"student_sign_up_form.tsx"}),(0,r.jsx)(m.I,{name:"password",placeholder:"Password",type:"password",value:v,onChange:e=>_(e.target.value),"data-sentry-element":"Input","data-sentry-source-file":"student_sign_up_form.tsx"}),(0,r.jsx)(m.I,{name:"confirmPassword",placeholder:"Confirm Password",type:"password",value:w,onChange:e=>j(e.target.value),"data-sentry-element":"Input","data-sentry-source-file":"student_sign_up_form.tsx"}),(0,r.jsx)(n.z,{type:"submit",className:"bg-[#228BE6] hover:bg-[#4285F4] text-white","data-sentry-element":"Button","data-sentry-source-file":"student_sign_up_form.tsx",children:"Register"})]})})},v=a(27648),_=a(16657),w=a(55900);let j="Registration failed",S=()=>(0,r.jsxs)("svg",{className:"w-5 h-5 mr-2",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg","data-sentry-element":"svg","data-sentry-component":"GoogleLogo","data-sentry-source-file":"signup_page_client.tsx",children:[(0,r.jsx)("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4","data-sentry-element":"path","data-sentry-source-file":"signup_page_client.tsx"}),(0,r.jsx)("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853","data-sentry-element":"path","data-sentry-source-file":"signup_page_client.tsx"}),(0,r.jsx)("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05","data-sentry-element":"path","data-sentry-source-file":"signup_page_client.tsx"}),(0,r.jsx)("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335","data-sentry-element":"path","data-sentry-source-file":"signup_page_client.tsx"}),(0,r.jsx)("path",{d:"M1 1h22v22H1z",fill:"none","data-sentry-element":"path","data-sentry-source-file":"signup_page_client.tsx"})]});var N=function(){let[e,t]=(0,i.useState)(null),[a,m]=(0,i.useState)(void 0),[f,p]=(0,i.useState)(void 0),[y,N]=(0,i.useState)(void 0),[k,I]=(0,i.useState)(void 0),{toast:C}=(0,l.pm)(),T=(0,c.useRouter)(),E=(0,c.useSearchParams)();(0,i.useEffect)(()=>{if(O())return;let e=localStorage.getItem("student_access_token"),t=localStorage.getItem("access_token"),a=localStorage.getItem("role");e&&"student"===a?T.push("/student/classes"):t&&"teacher"===a&&T.push("/home/".concat(t))},[T]);let O=()=>E.get("courseId")||E.get("submissionId");(0,i.useEffect)(()=>{O()&&t("teacher")},[E]);let P=(e,t)=>{if(E.get("submissionId")){let a=new URLSearchParams({authToken:e,refreshToken:t,submissionId:E.get("submissionId"),attachmentId:E.get("attachmentId"),login_hint:E.get("login_hint")}).toString();T.push("/?".concat(a))}else if(E.get("courseId")){let t=new URLSearchParams({courseId:E.get("courseId"),itemId:E.get("itemId"),itemType:E.get("itemType"),addOnToken:E.get("addOnToken"),login_hint:E.get("login_hint"),authToken:e}).toString();T.push("/home/".concat(e,"?").concat(t))}else T.push("/home/".concat(e,"?tutorial=true"))},R=(0,d.Nq)({onSuccess:async t=>{if(e)try{if(!t.code)throw Error("No auth code received from Google");let a="teacher"===e?"/google-register":"/google-student-register",r=await fetch("".concat((0,u.kG)()).concat(a),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t.code})});if(!r.ok){let e=await r.json();throw Error(e.detail||"Google sign-up failed")}let s=await r.json();g.av({email:s.email,role:s.role,auth:"google"}),localStorage.setItem("email",s.email),localStorage.setItem("role",e),"student"===e?(localStorage.setItem("student_access_token",s.student_access_token),document.cookie="student_token=".concat(s.student_access_token,"; path=/; max-age=2592000; SameSite=None; Secure")):(h.ZP.identify(s.email),localStorage.setItem("access_token",s.access_token),document.cookie="token=".concat(s.access_token,"; path=/; max-age=2592000; SameSite=None; Secure")),"teacher"===e?(localStorage.setItem("google_token",s.google_token),P(s.access_token,s.refresh_token)):T.push("/student/classes")}catch(e){C({title:j,description:"Google sign up failed. Please try again."})}},onError:()=>{C({title:j,description:"Google sign up failed. Please try again."})},flow:"auth-code",scope:"email profile ".concat("teacher"===e&&O()?"https://www.googleapis.com/auth/classroom.addons.student https://www.googleapis.com/auth/classroom.addons.teacher":"")});return((0,i.useEffect)(()=>{let e=E.get("email"),a=E.get("role"),r=E.get("first"),s=E.get("last"),n=E.get("class_id");e&&m(e),a&&t(a),r&&p(r),s&&N(s),n&&I(n)},[E]),O())?(0,r.jsx)("div",{className:"block",children:(0,r.jsx)("div",{className:"flex w-full max-w-md items-center justify-center mx-auto mt-10 bg-white",children:(0,r.jsxs)(o.Zb,{className:"shadow-md rounded-3xl border-neutral border-4",children:[(0,r.jsx)(o.Ol,{className:"space-y-2 pb-4",children:(0,r.jsx)(o.ll,{className:"text-2xl font-semibold tracking-tight text-center",children:"Educator Signup"})}),(0,r.jsx)(o.aY,{className:"grid gap-4",children:(0,r.jsx)("div",{className:"flex items-center space-x-2",children:(0,r.jsxs)(n.z,{onClick:()=>R(),className:"flex items-center justify-center w-full px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:[(0,r.jsx)(S,{}),"Sign in with Google"]})})})]})})}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"block",children:[(0,r.jsx)(s.default,{showLoginLinks:!0,showHome:!0,"data-sentry-element":"Menu","data-sentry-source-file":"signup_page_client.tsx"}),(0,r.jsx)("div",{className:"flex w-full max-w-md items-center justify-center mx-auto mt-10 mb-20 bg-white",children:(0,r.jsxs)(o.Zb,{className:"shadow-md rounded-md border-neutral border-4 w-full","data-sentry-element":"Card","data-sentry-source-file":"signup_page_client.tsx",children:[(0,r.jsx)(o.Ol,{className:"space-y-2 pb-4","data-sentry-element":"CardHeader","data-sentry-source-file":"signup_page_client.tsx",children:(0,r.jsx)(o.ll,{className:"text-2xl font-semibold tracking-tight text-center","data-sentry-element":"CardTitle","data-sentry-source-file":"signup_page_client.tsx",children:"Join TrueMark"})}),!E.get("role")&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"flex justify-center  items-center",children:(0,r.jsx)("span",{className:"mr-3 text-lg",children:"I am a"})}),(0,r.jsxs)("div",{className:"flex justify-center mt-4 ".concat(e?"":"mb-8"," items-center"),children:[(0,r.jsxs)("button",{className:"flex ".concat(e?"flex-row":"flex-col"," items-center ").concat(e?"px-4 py-2":"px-6 py-4"," mx-1 rounded border transition-colors duration-200 ").concat("teacher"===e?"border-blue-500 border-2":"border-gray-300 hover:bg-blue-500 hover:text-white"),onClick:()=>t("teacher"),children:[(0,r.jsx)("div",{className:"".concat(e?"mr-2":"mb-2"),children:(0,r.jsx)(_.Z,{size:28})}),"Teacher"]}),(0,r.jsxs)("button",{className:"flex ".concat(e?"flex-row":"flex-col"," items-center ").concat(e?"px-4 py-2":"px-6 py-4"," mx-1 rounded border transition-colors duration-200 ").concat("student"===e?"border-blue-500 border-2":"border-gray-300 hover:bg-blue-500 hover:text-white"),onClick:()=>t("student"),children:[(0,r.jsx)("div",{className:"".concat(e?"mr-2":"mb-2"),children:(0,r.jsx)(w.Z,{size:28})}),"Student"]})]})]}),e&&(0,r.jsxs)(o.aY,{className:"grid gap-4",children:[(0,r.jsx)("div",{className:"flex items-center space-x-2 mt-4",children:(0,r.jsxs)(n.z,{onClick:()=>R(),className:"flex items-center justify-center w-full px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500",children:[(0,r.jsx)(S,{}),"Sign up with Google"]})}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,r.jsx)("span",{className:"w-full border-t"})}),(0,r.jsx)("div",{className:"relative flex justify-center text-sm",children:(0,r.jsx)("span",{className:"bg-white px-2 text-muted-foreground",children:"Or"})})]}),"teacher"===e?(0,r.jsx)(x,{}):(0,r.jsx)(b,{emailPassed:a,firstNamePassed:f,lastNamePassed:y,classIDPassed:k})]}),(0,r.jsx)("div",{className:"flex items-center justify-center space-x-2 mb-4",children:(0,r.jsxs)("p",{className:"text-md",children:["Already have an account? Log in"," ",(0,r.jsx)(v.default,{href:"/login",className:"text-black underline","data-sentry-element":"Link","data-sentry-source-file":"signup_page_client.tsx",children:"here"}),"."]})})]})})]})})}},72088:function(e,t,a){"use strict";a.d(t,{d:function(){return l},z:function(){return c}});var r=a(57437),s=a(2265),n=a(98482),o=a(77712),i=a(93448);let l=(0,o.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",expandIcon:"group relative text-primary-foreground bg-primary hover:bg-primary/90",ringHover:"bg-primary text-primary-foreground transition-all duration-300 hover:bg-primary/90 hover:ring-2 hover:ring-primary/90 hover:ring-offset-2",shine:"text-primary-foreground animate-shine bg-gradient-to-r from-primary via-primary/75 to-primary bg-[length:400%_100%] ",gooeyRight:"text-primary-foreground relative bg-primary z-0 overflow-hidden transition-all duration-500 before:absolute before:inset-0 before:-z-10 before:translate-x-[150%] before:translate-y-[150%] before:scale-[2.5] before:rounded-[100%] before:bg-gradient-to-r from-zinc-400 before:transition-transform before:duration-1000  hover:before:translate-x-[0%] hover:before:translate-y-[0%] ",gooeyLeft:"text-primary-foreground relative bg-primary z-0 overflow-hidden transition-all duration-500 after:absolute after:inset-0 after:-z-10 after:translate-x-[-150%] after:translate-y-[150%] after:scale-[2.5] after:rounded-[100%] after:bg-gradient-to-l from-zinc-400 after:transition-transform after:duration-1000  hover:after:translate-x-[0%] hover:after:translate-y-[0%] ",linkHover1:"relative after:absolute after:bg-primary after:bottom-2 after:h-[1px] after:w-2/3 after:origin-bottom-left after:scale-x-100 hover:after:origin-bottom-right hover:after:scale-x-0 after:transition-transform after:ease-in-out after:duration-300",linkHover2:"relative after:absolute after:bg-primary after:bottom-2 after:h-[1px] after:w-2/3 after:origin-bottom-right after:scale-x-0 hover:after:origin-bottom-left hover:after:scale-x-100 after:transition-transform after:ease-in-out after:duration-300"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=s.forwardRef((e,t)=>{let{className:a,variant:s,size:o,asChild:c=!1,Icon:d,iconPlacement:u,...m}=e,f=c?n.g7:"button";return(0,r.jsxs)(f,{className:(0,i.cn)(l({variant:s,size:o,className:a})),ref:t,...m,children:[d&&"left"===u&&(0,r.jsx)("div",{className:"w-0 translate-x-[0%] pr-0 opacity-0 transition-all duration-200 group-hover:w-5 group-hover:translate-x-100 group-hover:pr-2 group-hover:opacity-100",children:(0,r.jsx)(d,{})}),(0,r.jsx)(n.A4,{children:m.children}),d&&"right"===u&&(0,r.jsx)("div",{className:"w-0 translate-x-[100%] pl-0 opacity-0 transition-all duration-200 group-hover:w-5 group-hover:translate-x-0 group-hover:pl-2 group-hover:opacity-100",children:(0,r.jsx)(d,{})})]})});c.displayName="Button"},36633:function(e,t,a){"use strict";a.d(t,{Ol:function(){return i},Zb:function(){return o},aY:function(){return c},ll:function(){return l}});var r=a(57437),s=a(2265),n=a(93448);let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("rounded-xl border bg-card text-card-foreground shadow",a),...s})});o.displayName="Card";let i=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("flex flex-col space-y-1.5 p-6",a),...s})});i.displayName="CardHeader";let l=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("h3",{ref:t,className:(0,n.cn)("font-semibold leading-none tracking-tight",a),...s})});l.displayName="CardTitle",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("p",{ref:t,className:(0,n.cn)("text-sm text-muted-foreground",a),...s})}).displayName="CardDescription";let c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("p-6 pt-0",a),...s})});c.displayName="CardContent",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)("div",{ref:t,className:(0,n.cn)("flex items-center p-6 pt-0",a),...s})}).displayName="CardFooter"},59791:function(e,t,a){"use strict";a.d(t,{X:function(){return l}});var r=a(57437),s=a(2265),n=a(71027),o=a(20653),i=a(93448);let l=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.fC,{ref:t,className:(0,i.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",a),...s,children:(0,r.jsx)(n.z$,{className:(0,i.cn)("flex items-center justify-center text-current"),children:(0,r.jsx)(o.nQG,{className:"h-4 w-4"})})})});l.displayName=n.fC.displayName},72364:function(e,t,a){"use strict";a.d(t,{I:function(){return o}});var r=a(57437),s=a(2265),n=a(93448);let o=s.forwardRef((e,t)=>{let{className:a,type:s,...o}=e;return(0,r.jsx)("input",{type:s,className:(0,n.cn)("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...o})});o.displayName="Input"},18752:function(e,t,a){"use strict";a.d(t,{Am:function(){return u},pm:function(){return m}});var r=a(2265);let s=0,n=new Map,o=e=>{if(n.has(e))return;let t=setTimeout(()=>{n.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);n.set(e,t)},i=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:a}=t;return a?o(a):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===a||void 0===a?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},l=[],c={toasts:[]};function d(e){c=i(c,e),l.forEach(e=>{e(c)})}function u(e){let{...t}=e,a=(s=(s+1)%Number.MAX_SAFE_INTEGER).toString(),r=()=>d({type:"DISMISS_TOAST",toastId:a});return d({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||r()}}}),{id:a,dismiss:r,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function m(){let[e,t]=r.useState(c);return r.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}}},function(e){e.O(0,[8310,6137,7684,9444,3845,6214,5511,615,991,2971,7839,1744],function(){return e(e.s=58563)}),_N_E=e.O()}]);