PageSourceSearch

https://mathai.ai/_next/static/chunks/2739.9153e3e02e8c10ba.js

js mathai.ai collected 2026-10-05 12:17:06 UTC 53,976 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2739,3769],{57500:function(e,t,n){n.d(t,{I:function(){return o},r:function(){return i}});var o=function(){var e=!1,t="";return function(n){var o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;return o?""!=t&&((!e||"timeout"!=t||"submit"!=n)&&e):(t=n,e=i)}}();var i=function(){var e=!1;return function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1?arguments[1]:void 0;return t?e:e=n}}()},23769:function(e,t,n){n.r(t),n.d(t,{AppWrapper:function(){return a},useAppContext:function(){return u}});var o=n(85893),i=n(25707),r=n(67294),s=(0,r.createContext)();function a(e){var t=e.children,n=(0,r.useState)([]),a=n[0],u=n[1],l=(0,r.useState)(null),d=l[0],c=l[1],v=(0,r.useState)(null),p=v[0],h=v[1],_=(0,r.useState)(!1),m=_[0],f=_[1],y=(0,r.useState)(!0),g=y[0],k=y[1],b=(0,r.useState)(void 0),w=b[0],x=b[1],S=(0,r.useState)(0),q=S[0],E=S[1],C=(0,r.useState)(!1),I=C[0],j=C[1],N=(0,r.useState)(0),Z=N[0],A=N[1];(0,r.useEffect)((function(){I&&i.j.track("show_image_not_loaded_popup")}),[I]);var P={challenges:a,setChallenges:u,expandedCardId:d,setExpandedCardId:c,lastOpenActivity:p,setLastOpenActivity:h,canPlayAudio:m,setCanPlayAudio:f,hasSufficientCredits:g,setHasSufficientCredits:k,pricingDetails:w,setPricingDetails:x,homepageActiveTab:q,setHomepageActiveTab:E,showToast:I,setShowToast:j,imcReportScreenScroll:Z,setImcReportScreenScroll:A};return(0,o.jsxs)(s.Provider,{value:P,children:[t,(0,o.jsx)("div",{className:"mx-2",style:{display:I?"flex":"none",position:"fixed",bottom:"60px",width:"100%",left:"50%",transform:"translateX(-53%)",justifyContent:"center",zIndex:999,pointerEvents:"initial",cursor:"pointer"},onClick:function(){j(!1)},children:(0,o.jsxs)("div",{style:{padding:"15px",background:"rgba(242, 242, 242, 0.80)",display:"flex",justifyContent:"space-between",alignItems:"center"},id:"feedbackContainer",children:[(0,o.jsxs)("div",{style:{display:"flex",width:"60%",alignItems:"center"},children:[(0,o.jsx)("img",{src:"https://sets-gamify-assets.s3.ap-south-1.amazonaws.com/dev/home-explore/document/1735987130849.png",style:{width:"25px",height:"25px",marginRight:"10px"}}),"Unable to load Image."]}),(0,o.jsx)("div",{style:{display:"flex",fontWeight:600,color:"cornflowerblue"},children:"Refresh"})]})})]})}function u(){return(0,r.useContext)(s)}},17210:function(e,t,n){n.d(t,{a:function(){return d}});var o=n(85893),i=n(67294),r=n(5152),s=n.n(r),a=n(22280),u=n(23702),l=s()((function(){return Promise.all([n.e(4842),n.e(2064),n.e(1874),n.e(5421)]).then(n.bind(n,31874)).then((function(e){return e.motion.span}))}),{loadableGenerated:{webpack:function(){return[null]}}}),d=function(e){var t=e.count;return(0,o.jsx)(l,{initial:{opacity:0,fontSize:"25rem"},exit:{opacity:0,fontSize:"8rem"},animate:{opacity:1,fontSize:"8rem"},transition:{duration:.3},children:["0",0].includes(t)?"GO!":t},"k_".concat(t))};t.Z=function(e){var t=e.stopGlobalBackgroundSound,n=e.count,r=e.soundLoaded,s=e.setSoundLoaded,l=(0,i.useState)(0),c=l[0];l[1];return(0,i.useEffect)((function(){return document.getElementById("popup-layout")||(a.O.pauseSound=!1),3!==n||e.isPreloading||(a.O.play("Count-down-sound",{onPlay:function(){r||s(!0)},error:function(e){s(!0)}}),t&&t()),function(){a.O.stop("Count-down-sound")}}),[e.isPreloading]),(0,o.jsx)(o.Fragment,{children:r&&(0,o.jsx)("div",{className:"set-layout-contrainer-view",children:(0,o.jsx)("div",{className:"set-layout-view-2",children:(0,o.jsx)("div",{className:"flex ".concat((0,u.a9)()," w-full flex-col items-center justify-center bg-corn-silk text-center font-extrabold text-dark-purple"),style:{background:"linear-gradient(180deg, #FFDE49 0%, #FCF6D7 100%)",marginTop:c},children:(0,o.jsx)(d,{count:n})})})})})}},36280:function(e,t,n){n.d(t,{N:function(){return s},f:function(){return r}});var o=n(85893),i=n(67294),r=(0,i.createContext)({}),s=function(e){var t=e.children,n=(0,i.useState)(!1),s=n[0],a=n[1],u=i.Children.map(t,(function(e){return i.isValidElement(e)?i.cloneElement(e,{keyboardOpen:s,setKeyboardOpen:a}):e}));return(0,o.jsx)(r.Provider,{value:{keyboardOpen:s,setKeyboardOpen:a},children:u})}},254:function(e,t,n){n.d(t,{Z:function(){return a},n:function(){return u}});var o=n(828),i=n(85893),r=n(67294),s=r.createContext(void 0);function a(e){var t=e.children,n=(0,o.Z)(r.useState({}),2),a=n[0],u=n[1],l=(0,o.Z)(r.useState(!1),2),d=l[0],c=l[1],v=(0,o.Z)(r.useState(!1),2),p=v[0],h=v[1],_=(0,o.Z)(r.useState("PAUSE"),2),m=_[0],f=_[1];return(0,i.jsx)(s.Provider,{value:{representationData:a,setRepresentationData:u,showInNavbar:d,setShowInNavbar:c,isGamePopupOpen:p,setIsGamePopupOpen:h,gameBackpressAction:m,setGameBackpressAction:f},children:t})}var u=function(){var e=r.useContext(s);if(!e)throw Error("Not used inside RepresentationDataContext");return e}},42739:function(e,t,n){n.r(t),n.d(t,{getTries:function(){return se}});var o=n(47568),i=n(26042),r=n(69396),s=n(828),a=n(7297),u=n(29815),l=n(97582),d=n(85893),c=n(67294),v=n(11163),p=n(9669),h=n.n(p),_=n(28493),m=n(36963),f=n(9628),y=n(73340),g=n(97200),k=n(76446),b=n(13135),w=n(68390),x=n(23702),S=n(44793),q=n(70455),E=n(5152),C=n.n(E),I=n(91654),j=n(36280),N=n(63036),Z=n(51119),A=n(52285),P=n(69664),T=n(28661),L=n(6834),O=n(36169),D=n(45090),B=n(25707),F=n(4005),G=n(64487),Q=n(22280),z=n(57500),R=n(44577),M=n(75063),X=n(73359),K=n(29895),W=n(46433),H=n(17210),Y=n(68223),V=n(14643),U=n(47558),J=n(254),$=n(23769),ee=n(93212);function te(){var e=(0,a.Z)(["\n        query user($where: personalized_learning_user_bool_exp!) {\n            personalized_learning_user(where: $where) {\n                id\n            }\n        }\n    "]);return te=function(){return e},e}var ne=C()((function(){return n.e(9064).then(n.bind(n,59064)).then((function(e){return e.PopupLayout}))}),{loadableGenerated:{webpack:function(){return[59064]}}}),oe=C()((function(){return n.e(5030).then(n.bind(n,35030))}),{loadableGenerated:{webpack:function(){return[35030]}}}),ie=C()((function(){return n.e(9969).then(n.bind(n,69969))}),{loadableGenerated:{webpack:function(){return[69969]}}}),re=function(e){var t,n,a,p,_,m,f,E,C,ie,re,se,ae,ue,le,de,ce,ve,pe,he=function(e){if(1===e.touches.length){var t=e.touches[0];(t.clientX<20||t.clientX>window.innerWidth-20)&&(e.preventDefault(),Zn.current=!0,jn.current=e.touches[0].pageX)}},_e=function(e){var t=e.touches[0].pageX;Nn.current=t-jn.current},me=function(){if(ct())return ht.current===y.vp.countdown?void vt():(gn(!0),Fe(!0),void history.pushState({},""));if(ht.current==y.vp.landing){if("true"==dt.query.attempt){if((dt.query||{}).isLanding)return;Me();var e=(0,g.Xg)("/".concat(dt.asPath.split("/").slice(1,dt.asPath.split("/").length>5?6:4).join("/")),dt.query,(0,r.Z)((0,i.Z)({lastAttempt:dt.query.activity_id},dt.query.worksheet_standalone&&{worksheet_standalone:!0},dt.query.lt&&{lt:dt.query.lt},dt.query.skipSplash&&{skipSplash:dt.query.skipSplash},dt.query.autoStart&&{autoStart:dt.query.autoStart},dt.query.session_id&&{session_id:dt.query.session_id}),{referrer_screen:(0,k.r)(dt).user_is_currently_on}));setTimeout((function(){dt.replace(e)}),0)}}else ht.current==y.vp.countdown?(gn(!1),Pn()):(gn(!0),Fe(!0),history.pushState({},""))},fe=function(e){Nn.current<In*Math.sign(Nn.current)&&Zn.current&&(me(),Zn.current=!1),Nn.current=0},ye=e.progressionStage,ge=e.loadingProgressionStage,ke=e.contents,be=e.currentStep,we=e.nextStep,xe=e.correctCount,Se=e.globalStarsCount,qe=e.loading,Ee=e.progressionStep,Ce=e.setContents,Ie=e.setCurrentStep,je=e.setNextStep,Ne=e.setCorrectCount,Ze=e.setGlobalStarsCount,Ae=e.setLoading,Pe=e.setProgressionStep,Te=e.isDisabled,Le=e.goBack,Oe=e.setIsDisabled,De=e.setGoBack,Be=e.pauseGame,Fe=e.setPauseGame,Ge=e.addAssetsToSW,Qe=e.addToCacheWithMessage,ze=e.fixedBlocks,Re=e.setFixedBlocks,Me=e.resetStates,Xe=e.setLoadingGeneratedAudio,Ke=e.loadingGeneratedAudio,We=e.userHasInteracted,He=e.isNextQuestionFetching,Ye=e.setIsNextQuestionFetching,Ve=e.setIsGetNextQuestionCalled,Ue=e.chunk,Je=e.setChunk,$e=e.currentId,et=e.setCurrentId,tt=e.setIsPreviewOver,nt=e.setIsBackpress,ot=e.handleBlessFeedbackTag,it=e.setAttemptCount,rt=e.attemptCount,st=(0,U.ev)(),at=st.setDropdown,ut=st.setMathField,lt=c.useRef(new N.E),dt=(0,v.useRouter)(),ct=c.useCallback((function(){var e;var t=null===(e=dt.query)||void 0===e?void 0:e.session_id;return Boolean(t)&&window.self!==window.top}),[null===(t=dt.query)||void 0===t?void 0:t.session_id]),vt=c.useCallback((function(){var e,t=null===(e=dt.query)||void 0===e?void 0:e.session_id;t&&window.parent.postMessage({type:"WORKSHEET_BACK",session_id:Array.isArray(t)?t[0]:t},"*")}),[null===(n=dt.query)||void 0===n?void 0:n.session_id]),pt=c.useRef([]),ht=c.useRef(Ee),_t=(0,c.useState)(0),mt=_t[0],ft=_t[1],yt=c.useRef(!1),gt=function(e){ht.current=e,Pe(e)},kt=pt.current,bt=(0,M.Ps)(te()),wt=(0,s.Z)((0,X.t)(bt,{fetchPolicy:"network-only"}),2),xt=wt[0],St=wt[1],qt=(St.data,St.error,(0,w.nn)().insertLog),Et=(0,T.z)().getFigmaComponentsQuery,Ct=(0,P.L
1)().getFigmaJsonQuery;(0,c.useEffect)((function(){var e;void 0==(null===(e=dt.query)||void 0===e?void 0:e.showQuestion)&&Me(!1)}),[]),(0,c.useEffect)((function(){var e=function(){ft((function(e){return e+1})),gt(y.vp.countdown)};return D.Z.on("reset_worksheet",e),function(){D.Z.off("reset_worksheet",e)}}),[]),(0,c.useEffect)((function(){var e,t,n,o,i;if("true"!=(null===(e=dt.query)||void 0===e?void 0:e.autoStart)||"true"==(null===(t=dt.query)||void 0===t?void 0:t.showQuestion))if("true"==dt.query.showQuestion||"preview"==(null===(n=dt.query)||void 0===n?void 0:n.context)){if(gt(y.vp.gameplay),"preview"==(null===(i=dt.query)||void 0===i?void 0:i.context))return}else"false"==(null===(o=dt.query)||void 0===o?void 0:o.showQuestion)&&gt(y.vp.countdown);else gt(y.vp.countdown)}),[dt.query]);var It=(0,I.useGlobalGameplayContext)(),jt=It.computeFunctionsMounted,Nt=It.setComputeFunctionsMounted,Zt=It.setIsTabHidden,At=It.isSubmissionPreview,Pt=It.disableResumePopUp;(0,c.useEffect)((function(){Ae(ge)}),[ge]),(0,c.useEffect)((function(){if(Ae(!0),ye&&ye.state&&(!be||null!=(null===be||void 0===be?void 0:be.levelId)&&dt.query.activity_id!=be.levelId)){var e,t,n,o;if(Ce([{id:ye.state.id||ye.state.tmpId}]),ye.state.levelId=dt.query.activity_id,Ie(ye.state),Re(ye.fixed_blocks),!isNaN(null===ye||void 0===ye||null===(e=ye.state)||void 0===e?void 0:e.badge_count_initial))Ne(null===ye||void 0===ye||null===(n=ye.state)||void 0===n?void 0:n.badge_count_initial);if(!isNaN(null===ye||void 0===ye||null===(t=ye.state)||void 0===t?void 0:t.total_global_stars))Ze(null===ye||void 0===ye||null===(o=ye.state)||void 0===o?void 0:o.total_global_stars);isNaN(null===ye||void 0===ye?void 0:ye.attempt)||it(null===ye||void 0===ye?void 0:ye.attempt),Ae(!1),Q.O.add("Count-down-sound","https://cdn.homeworkapp.ai/sets-gamify-assets/math-ai-assets/assets/sounds/Count-down-sound.mp3")}}),[ye]),(0,c.useEffect)((function(){var t;if((null===be||void 0===be?void 0:be.chunk)&&(null===Ue||void 0===Ue?void 0:Ue.chunkIdx)!=(null===be||void 0===be||null===(t=be.chunk)||void 0===t?void 0:t.chunkIdx)){var n,o,i,r,s,a,u,l,d,c,v;if(Ue)B.j.track("chunk_ended",{utm_source:null===(a=dt.query)||void 0===a?void 0:a.utm_source,id_of_the_chunk:null===Ue||void 0===Ue?void 0:Ue.chunkId,name_of_chunk:null===Ue||void 0===Ue?void 0:Ue.chunkName,chunk_number:null===Ue||void 0===Ue?void 0:Ue.chunkIdx,current_stars:e.correctCount,name_of_parent:null===ye||void 0===ye||null===(u=ye.progression_stage)||void 0===u?void 0:u.title,id_of_parent:dt.query.activity_id,id_of_next_chunk:null===be||void 0===be||null===(l=be.chunk)||void 0===l?void 0:l.chunkId,name_of_next_chunk:null===be||void 0===be||null===(d=be.chunk)||void 0===d?void 0:d.chunkName,next_chunk_number:null===be||void 0===be||null===(c=be.chunk)||void 0===c?void 0:c.chunkIdx,total_stars_to_crack_the_level:null===ye||void 0===ye||null===(v=ye.progression_stage)||void 0===v?void 0:v.badge_total});Je(null===be||void 0===be?void 0:be.chunk),B.j.track("chunk_started",{utm_source:null===(n=dt.query)||void 0===n?void 0:n.utm_source,id_of_the_chunk:null===be||void 0===be||null===(o=be.chunk)||void 0===o?void 0:o.chunkId,name_of_chunk:null===be||void 0===be||null===(i=be.chunk)||void 0===i?void 0:i.chunkName,chunk_number:null===be||void 0===be||null===(r=be.chunk)||void 0===r?void 0:r.chunkIdx,current_stars:e.correctCount,total_stars_to_crack_the_level:null===ye||void 0===ye||null===(s=ye.progression_stage)||void 0===s?void 0:s.badge_total})}}),[null===be||void 0===be?void 0:be.chunk]),(0,c.useEffect)((function(){return function(){}}),[dt.isReady]),(0,c.useEffect)((function(){var e;Le&&(null===(e=lt.current)||void 0===e||e.addTimeout((function(){De(!1)}),3e3))}),[Le]);var Tt=(0,c.useState)(null),Lt=Tt[0],Ot=Tt[1],Dt=function(e){var t,n=e.content,o=void 0===n?null:n,r=e.transition,s=void 0===r?null:r;if(yt.current)B.j.track("handle_nxt_question_skipped",{});else{var a,l,d,c,v,p,h,_,m,f,y,g,k,b,w,x,S,q,E;if(Q.O.stopAll(),Q.O.removeAll(),Ae(!0),F.ZP.setNextToCurrent(),s)Ie((0,i.Z)({id:"transition"},s)),Ce((function(e){return(0,u.Z)(e).concat([{id:"transition"},{id:(null===o||void 0===o?void 0:o.id)||(null===o||void 0===o?void 0:o.tmpId)}])})),Ot(o);else B.j.track("block_ended",{utm_source:null===(a=dt.query)||void 0===a?void 0:a.utm_source,name_of_block:null===(c=null===(l=be.block)||void 0===l?void 0:l.data[null===(d=be.block)||void 0===d?void 0:d.type])||void 0===c?void 0:c.name,sub_name_of_block:null===(h=null===(v=be.block)||void 0===v?void 0:v.data[null===(p=be.block)||void 0===p?void 0:p.type])||void 0===h?void 0:h.sub_name,id_of_the_block:(null===(_=be.block)||void 0===_?void 0:_.id)||(null===(m=be.block)||void 0===m?void 0:m.tmpId),type_of_the_block:null===(f=be.block)||void 0===f?void 0:f.type,block_number:null===(y=be.block)||void 0===y||null===(g=y.data)||void 0===g?void 0:g.blockIndex,id_of_the_chunk:null===(k=be.chunk)||void 0===k?void 0:k.chunkId,name_of_chunk:null===(b=be.chunk)||void 0===b?void 0:b.chunkName,chunk_number:null===(w=be.chunk)||void 0===w?void 0:w.chunkIdx,id_of_next_block:(null===o||void 0===o?void 0:o.id)||(null===o||void 0===o?void 0:o.tmpId),name_of_next_block:null===(q=null===o||void 0===o||null===(x=o.block)||void 0===x?void 0:x.data[null===o||void 0===o||null===(S=o.block)||void 0===S?void 0:S.type])||void 0===q?void 0:q.name,current_stars:xe,total_stars_to_crack_the_level:null===ye||void 0===ye||null===(E=ye.progression_stage)||void 0===E?void 0:E.badge_total}),Ie(o),Ce((function(e){return(0,u.Z)(e).concat([{id:o.id||o.tmpId}])}));null===(t=lt.current)||void 0===t||t.addTimeout((function(){Ae(!1)}),0),yt.current=!0}},Bt=(0,w.tq)(),Ft=(0,w.gn)(),Gt=function(){var e=(0,o.Z)((function(){var e,t,n,o;return(0,l.__generator)(this,(function(s){switch(s.label){case 0:if(Ee!=y.vp.landing)return[3,7];if(!Bt||Ft)return gt(y.vp.countdown),[2,!0];s.label=1;case 1:return s.trys.push([1,4,,5]),(null===document||void 0===document?void 0:document.fullscreenElement)||!(null===document||void 0===document||null===(e=document.documentElement)||void 0===e?void 0:e.requestFullscreen)||(0,q.N0)()?[3,3]:[4,document.documentElement.requestFullscreen()];case 2:s.sent(),s.label=3;case 3:return[3,5];case 4:return t=s.sent(),console.log(t,"this is error in full screen"),(0,G.Tb)(t),[3,5];case 5:return wn(!0),Fe(!1),screen.orientation&&screen.orientation.lock("portrait").then((function(){})).catch((function(e){console.log(e,"this is error in orientation mode"),(0,G.Tb)(e)})),[4,(0,S.gw)(500)];case 6:return s.sent(),gt(y.vp.countdown),[2,!0];case 7:return Ee==y.vp.countdown?(gt(y.vp.gameplay),Fe(!1),delete(n=dt.query).showQuestion,o=(0,g.Xg)(location.pathname,dt.query,(0,r.Z)((0,i.Z)({},n.attempt&&{attempt:n.attempt},n.isLanding&&{isLanding:n.isLanding},"true"===n.worksheet_standalone&&{worksheet_standalone:!0},n.lt&&{lt:n.lt},n.skipSplash&&{skipSplash:n.skipSplash},n.autoStart&&{autoStart:n.autoStart},n.session_id&&{session_id:n.session_id}),{referrer_screen:b.vY.question_landing_screen,showQuestion:!0}
1)),(0,k.r)(dt),B.j.updatePageLocation(b.vY.gameplay_screen,dt),B.j.track("screen_change",{user_is_currently_on:b.vY.gameplay_screen,referrer_screen:b.vY.question_landing_screen}),dt.replace(o),window.history.pushState({},"",o),window.history.pushState({},"",o),[2,!0]):"transition"==(null===be||void 0===be?void 0:be.id)?(Ae(!0),Ie(Lt),Ae(!1),Ot(null),[2,!0]):[2,!1]}}))}));return function(){return e.apply(this,arguments)}}(),Qt=(0,I.useGlobalGameplayContext)(),zt=Qt.isLastQuestion,Rt=Qt.history,Mt=Qt.setHistory,Xt=function(){var e,t;if((null===(e=dt.query)||void 0===e?void 0:e.context)&&"preview"===(null===(t=dt.query)||void 0===t?void 0:t.context)){if(dt.query.variant_id)return!0;if((null===be||void 0===be?void 0:be.question_total)==(null===be||void 0===be?void 0:be.question_number))return!0;if(At)return!0}return!1},Kt=function(e){var t,n,o;if(!(null===(t=dt.query)||void 0===t?void 0:t.context))return e;if((null===(n=dt.query)||void 0===n?void 0:n.context)&&"preview"===(null===(o=dt.query)||void 0===o?void 0:o.context)){var i,r,s=dt.query,a=s.progression_id,u=s.progression_activity_id,l=s.path_id,d=s.story_id,c=s.total_attempt,v=s.current_attempt;return{data:{build_number:209,platform:"android",worksheet_id:dt.query.worksheet_id,pl_student_id:1,context:{type:"preview",progression_id:a,activity_id:u,path_id:l,child_block_id:ke[ke.length-1].id||ke[ke.length-1].tmpId,story_id:d,block_id:ke[ke.length-1].id||ke[ke.length-1].tmpId,chunkPreview:"true"===(null===(i=dt.query)||void 0===i?void 0:i.chunkPreview),attempt:Rt,total_attempt:c,current_attempt:v},submission:null===e||void 0===e||null===(r=e.data)||void 0===r?void 0:r.submission}}}},Wt=(0,c.useRef)(!1),Ht=function(){var e=(0,o.Z)((function(e){var t,n,i,r,s,a,u,d,c,v;return(0,l.__generator)(this,(function(p){switch(p.label){case 0:return t=e.submission,n=e.attempt,i=e.fetchQuestion,r=void 0===i||i,s=e.forceSkipFetchQuestion,a=void 0!==s&&s,u=e.load,d=e.submissions,Q.O.removeAll(),yt.current=!1,u&&Ae(!0),Ve(!0),Wt.current=!1,c=function(){var e=(0,o.Z)((function(e,o,i){var s,a,v,p,h,_,m,f,g,k,b,x,S,q,E,C,I,j,N,Z,A,P=arguments;return(0,l.__generator)(this,(function(l){switch(l.label){case 0:return s=P.length>3&&void 0!==P[3]?P[3]:0,(0,z.I)("",!1,!1),(0,z.r)(!1,!1),[4,Gt()];case 1:a=l.sent();try{B.j.track("get_next_ques_next_question",{isHandled:a,isPreviewDone:Xt(),forceSkip:i,fetchQuestion:r,nextStep:!!e,nextState_block:!!(null===e||void 0===e?void 0:e.block),nextState_block_1:!!(null===e||void 0===e||null===(v=e.state)||void 0===v?void 0:v.block),nextState_id:null===e||void 0===e?void 0:e.id,nextState_id_1:null===e||void 0===e||null===(p=e.state)||void 0===p?void 0:p.id,p1:!!o,condition_1:!i&&(r||!e||o),idx:s})}catch(T){console.error("Mixpanel error -> rk",T)}if(a)return[2];if(Xt()&&(zt||!(null===(h=dt.query)||void 0===h?void 0:h.chunkPreview)))return tt(!0),alert("Preview is over."),[2];l.label=2;case 2:return l.trys.push([2,16,,17]),i||!r&&e&&!o?[3,4]:[4,Vt({submission:t,attempt:n,fetchQuestion:r,submissions:d})];case 3:return(b=l.sent())||(b=e),[3,5];case 4:null!=(null===e||void 0===e?void 0:e.state)&&(null===e||void 0===e?void 0:e.id)!=(null===be||void 0===be?void 0:be.id)&&(b=e),l.label=5;case 5:return b?[3,7]:[4,(0,w.Fb)(new Promise((function(e){D.Z.emit("get_next_step",e)})),1)];case 6:x=l.sent();try{B.j.track("get_next_step_event",{res:"Timeout reached"==x?x:null===x||void 0===x||null===(S=x.state)||void 0===S?void 0:S.id})}catch(L){console.error("Mixpanel error -> rk",L)}x&&"Timeout reached"!=x&&(b=x),l.label=7;case 7:if(!(null===b||void 0===b?void 0:b.state)&&s<=0&&(b=null),!b&&s<=0)return[2,c(e,!1,!1,1)];if(!b)return B.j.track("flow_stuck_via_next_step",{fetchQuestion:r,submission:t,attempt:n,load:u,contentId:ke[ke.length-1].id||ke[ke.length-1].tmpId,idsRef:pt.current,nextStep:e}),dt.reload(),[2];if((null===b||void 0===b||null===(_=b.state)||void 0===_?void 0:_.id)!=$e&&O.Z.clearFunctions(),et(null===b||void 0===b||null===(m=b.state)||void 0===m?void 0:m.id),O.Z.setWorksheetId(null===b||void 0===b||null===(f=b.state)||void 0===f?void 0:f.id),V.G.isSubmitted=!1,B.j.track("get_next_ques_next_question_1",{nextState:!!b,nextState_block:!!(null===b||void 0===b?void 0:b.block),nextState_block_1:!!(null===b||void 0===b||null===(g=b.state)||void 0===g?void 0:g.block),nextState_id:null===b||void 0===b?void 0:b.id,nextState_id_1:null===b||void 0===b||null===(k=b.state)||void 0===k?void 0:k.id}),!b)return[3,15];if(q=b.state,E=b.transition,C=b.assets,I=b.fixed_blocks,j=void 0===I?[]:I,!q||!q.block)return[3,15];E&&(E.banner="https://cdn.homeworkapp.ai/sets-gamify-assets/math-ai-assets/assets/animations/color-wheel.json"),Dt({content:q,transition:E}),Oe(!1),je(null),l.label=8;case 8:return l.trys.push([8,13,,14]),N=[],(null===C||void 0===C?void 0:C.length)>0&&(N=C.filter((function(e){var t;return null===(t=e.url)||void 0===t?void 0:t.trim()})).map((function(e){return e.url}))),Ge&&N.length?[4,Ge(N)]:[3,10];case 9:l.sent(),l.label=10;case 10:return Qe&&q.id===y.zv.trophy?[4,Qe({type:"PRECACHE_DELETE"})]:[3,12];case 11:l.sent(),l.label=12;case 12:return[3,14];case 13:return Z=l.sent(),(0,G.Tb)(Z),console.log(Z),[3,14];case 14:Re(j),l.label=15;case 15:return[3,17];case 16:return A=l.sent(),(0,G.Tb)(A),qt({message:"Error in get next question",type:"getNextQuestion",error:A}),console.log(A),Oe(!1),[3,17];case 17:return[2]}}
1))}));return function(t,n,o){return e.apply(this,arguments)}}(),B.j.track("get_next_question",{isNextQuestionFetching:He}),(0,R.s)(),He?(c(we,!0,a),[2,new Promise((function(e,t){v=function(){var t=(0,o.Z)((function(t){return(0,l.__generator)(this,(function(n){switch(n.label){case 0:return B.j.track("done_fetch_next_question",{isFetchingCompleted:null===Wt||void 0===Wt?void 0:Wt.current}),Wt.current?[2]:(Wt.current=!0,[4,c(t,!1,a)]);case 1:return n.sent(),e("success"),D.Z.off("done_fetch_next_question",v),Ve(!1),[2]}}))}));return function(e){return t.apply(this,arguments)}}(),D.Z.on("done_fetch_next_question",v)}))]):[3,1];case 1:return[4,c(we,!1,a)];case 2:p.sent(),Ve(!1),p.label=3;case 3:return[2]}}))}));return function(t){return e.apply(this,arguments)}}(),Yt=function(){var e=(0,o.Z)((function(){var e;return(0,l.__generator)(this,(function(t){switch(t.label){case 0:if((0,q.pE)())return[2,{country:"IN",timezone:"Asia/Kolkata"}];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,h().get("/api/country",{timeout:3e3})];case 2:return[2,t.sent().data];case 3:return e=t.sent(),console.error("Error fetching /api/country:",e),[2,{country:"IN",timezone:"Asia/Kolkata"}];case 4:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}(),Vt=function(){var e=(0,o.Z)((function(e){var t,n,o,s,a,d,c,v,p,_,m,f,y,k,w,x,S,E,C,I,j,N,Z,P,T,O,F,Q,z,R,M,X,H,V,U,J,$,ee,te,ne,oe,ie,re,se,ae,ue,le,de,ce,ve,pe,he;return(0,l.__generator)(this,(function(l){switch(l.label){case 0:return t=e.submission,e.attempt,n=e.fetchQuestion,o=void 0!==n&&n,s=e.submissions,a=e.preview_id,B.j.track("fetch_next_question_api_call",{preview_id:a}),Wt.current=!1,j=JSON.parse((0,Y.wy)()),N=j.id,Z=j.mobile,xt({variables:{where:{id:{_eq:N}}}}).then((function(e){var t;return 0==(null===e||void 0===e||null===(t=e.personalized_learning_user)||void 0===t?void 0:t.length)&&((0,Y.O)(),console.log("user data not found in DB redirecting..."),dt.push("onboarding")),e})).catch((function(e){return(0,G.Tb)(e)})),[4,Yt()];case 1:T=null!==(P=l.sent())&&void 0!==P?P:{},O=T.country,F=T.timezone,Q=(null===j||void 0===j?void 0:j.other)||{};try{Q=JSON.parse(null===j||void 0===j?void 0:j.other)}catch(me){}return M={},X={build_number:209,platform:"android",worksheet_id:dt.query.worksheet_id,pl_student_id:Number(N),attempt_count:Number(rt),current_state:{parent_block_id:dt.query.activity_id,child_block_id:ke[ke.length-1].id||ke[ke.length-1].tmpId},submission:t},H={submissions:"feedback"==(null===(v=null===(d=be.block)||void 0===d?void 0:d.data[null===(c=be.block)||void 0===c?void 0:c.type])||void 0===v||null===(p=v.name)||void 0===p?void 0:p.toLowerCase())?s:[],preview_id:a,is_landing:!Boolean(null!==(z=null===dt||void 0===dt||null===(_=dt.query)||void 0===_?void 0:_.showQuestion)&&void 0!==z&&z),router_query:null===dt||void 0===dt?void 0:dt.query,mobile:Z,block:{name:null===(y=null===(m=be.block)||void 0===m?void 0:m.data[null===(f=be.block)||void 0===f?void 0:f.type])||void 0===y?void 0:y.name,type:null===(k=be.block)||void 0===k?void 0:k.type,blockIndex:null===(w=be.block)||void 0===w||null===(x=w.data)||void 0===x?void 0:x.blockIndex},chunk:{chunkId:null===(S=be.chunk)||void 0===S?void 0:S.chunkId,chunkName:null===(E=be.chunk)||void 0===E?void 0:E.chunkName,chunkIdx:null===(C=be.chunk)||void 0===C?void 0:C.chunkIdx},utm_source:dt.query.utm_source,opened_via:dt.query.lastAttempt?"Came back from level ".concat(dt.query.lastAttempt):"true"===dt.query.worksheet_standalone?"Direct Link":"Via Activity Card on the homepage"},V={mathai_platform:K.dV.getPlatform()},[4,(0,W.y)()];case 2:return V.networkInfo=l.sent(),[4,(0,W.r)()];case 3:M.data=(X.analytics=(H.extra=(V.environmentInfo=l.sent(),V.profile_id_with_region="".concat(j.id,"_").concat(b.Xz),V.region=b.Xz,V.chat_session_id=(null===(I=dt.query)||void 0===I?void 0:I.session_id)||null,V),H.distinct_id=(0,g.kG)(j),H.user_properties={profile_id:null===j||void 0===j?void 0:j.id,name:j.name,email:j.email,phone:j.mobile,grade:j.class_name,type:j.type,gender:j.gender,access_type:j.access_type,maths_feeling:null===Q||void 0===Q?void 0:Q.maths_feeling,pervious_marks:null===Q||void 0===Q?void 0:Q.pervious_marks,competition_prep:null===Q||void 0===Q?void 0:Q.competition_prep,parent_name:null===Q||void 0===Q?void 0:Q.parent_name,goals:null===Q||void 0===Q?void 0:Q.goals,goals_commitment:null===Q||void 0===Q?void 0:Q.goals_commitment,profile_picture:null===Q||void 0===Q?void 0:Q.profile_picture,school_name:null===Q||void 0===Q?void 0:Q.school_name,phoneNumber:null===j||void 0===j?void 0:j.mobile,mobile:null===j||void 0===j?void 0:j.mobile},H.append_global_variables={user_device:(0,q.b1)()?"mobile":"desktop"},H.activity_type=B.j.activity_type,H.country=O,H.timezone=F,H),X),R=M,U=function(e){var t,n,o;return(null===(t=dt.query)||void 0===t?void 0:t.context)?(null===(n=dt.query)||void 0===n?void 0:n.context)&&"preview"===(null===(o=dt.query)||void 0===o?void 0:o.context)?"/v3/personalizedLearning/getPreviewV1":void 0:e}(U="/v3/personalizedLearning/getNextStateV2"),R=Kt(R),l.label=4;case 4:return l.trys.push([4,13,,14]),Ye(!0),oe=setTimeout((function(){B.j.track("page_loading_bottleneck",{api:"/getNextStateV2_fetch_next",payload:R,delay:b.h_})}),b.h_),[4,h().post("".concat("https://api.eu.mathai.ai/test/ts").concat(U),R)];case 5:return ie=l.sent().data,clearInterval(oe),oe=null,(null===(J=dt.query)||void 0===J?void 0:J.context)&&"preview"===(null===($=dt.query)||void 0===$?void 0:$.context)&&(Mt(null===ie||void 0===ie||null===(re=ie.data)||void 0===re||null===(se=re.state)||void 0===se?void 0:se.genericData),null===ie||void 0===ie||null===(ae=ie.data)||void 0===ae?void 0:ae.previewOver)?(tt(!0),alert("Preview is over."),[2]):(o&&Xe(!0),[4,(0,A.px)((0,r.Z)((0,i.Z)({},null===ie||void 0===ie||null===(ee=ie.data)||void 0===ee?void 0:ee.state),{getFigmaJsonQuery:Ct,getFigmaComponentsQuery:Et,computeFunctionsMounted:jt,setComputeFunctionsMounted:Nt}))]);case 6:return ue=l.sent(),ue=(0,r.Z)((0,i.Z)({},ie.data),{state:(0,r.Z)((0,i.Z)({id:null===ue||void 0===ue||null===(te=ue.block)||void 0===te?void 0:te.id},ue),{badge_count_initial:null===ie||void 0===ie||null===(ne=ie.data)||void 0===ne?void 0:ne.state.badge_count_initial})}),[4,(0,L.pk)(ue,Ge,!0)];case 7:if(!(null===(ue=l.sent())||void 0===ue?void 0:ue.state))return[3,12];le=ue.state,de=le.assets,ce=void 0===de?[]:de,l.label=8;case 8:return l.trys.push([8,11,,12]),ve=[],(null===ce||void 0===ce?void 0:ce.length)>0&&(ve=ce),Ge&&ve.length?[4,Ge(ve,!0)]:[3,10];case 9:l.sent(),l.label=10;case 10:return isNaN(null===ue||void 0===ue?void 0:ue.attempt)||it(null===ue||void 0===ue?void 0:ue.attempt),[3,12];case 11:return pe=l.sent(),(0,G.Tb)(pe),console.log(pe),[3,12];case 12:return _e=ke[ke.length-1].id||ke[ke.length-1].tmpId,pt.current=(0,u.Z)(kt).concat([_e]),o&&Xe(!1),je(ue),Ye(!1),D.Z.emit("done_fetch_next_question",ue),[2,ue];case 13:return he=l.sent(),(0,G.Tb)(he),Ye(!1),console.log(he),qt({message:"Error in fetch next question",type:"fetchNextQuestion",payload:R,error:he}),[2,null];case 14:return[2]}var _e}))}));return function(t){return e.apply(this,arguments)}}(),Ut={title:null===ye||void 0===ye||null===(a=ye.progression_stage)||void 0===a?void 0:a.title,activityType:"level"==(null===ye||void 0===ye||null===(p=ye.progression_stage)||void 0===p?void 0:p.type)?"practice":null===ye||void 0===ye||null===(_=ye.progression_stage)||void 0===_?void 0:_.type,activityIcon:"activity"==(null===ye||void 0===ye||null===(m=ye.progression_stage)||void 0===m?void 0:m.type)?"https://cdn.homeworkapp.ai/sets-gamify-assets/math-ai-assets/assets/images/paint.png":"https://cdn.homeworkapp.ai/sets-gamify-assets/math-ai-assets/assets/images/brain.png",banner:null===ye||void 0===ye||null===(f=ye.progression_stage)||void 0===f?void 0:f.banner,badges:"Get ".concat(null===ye||void 0===ye||null===(E=ye.progression_stage)||void 0===E?void 0:E.badge_total," badges"),totalStudent:null===ye||void 0===ye||null===(C=ye.progression_stage)||void 0===C?void 0:C.attempts,progress:null===ye||void 0===ye||null===(ie=ye.progression_stage)||void 0===ie?void 0:ie.badge_received,total:null===ye||void 0===ye||null===(re=ye.progression_stage)||void 0===re?void 0:re.badge_total,badge_count_initial:null===ye||void 0===ye||null===(se=ye.state)||void 0===se?void 0:se.badge_count_initial,level:"level"==(null===ye||void 0===ye||null===(ae=ye.progression_stage)||void 0===ae?void 0:ae.type)?null===ye||void 0===ye||null===(ue=ye.progression_stage)||void 0===ue?void 0:ue.sub_title:"",ctaProps:{children:"Start now!"},students:[{id:"1",avatar:"https://cdn.homeworkapp.ai/sets-gamify-assets/math-ai-assets/assets/images/activity/person-1.png"},{id:"2",avatar:"https://cdn.homeworkapp.ai/sets-gamify-assets/math-ai-assets/assets/images/activity/person-2.png"},{id:"3",avatar:"https://cdn.homeworkapp.ai/sets-gamify-assets/math-ai-assets/assets/images/activity/person-3.png"},{id:"4",avatar:"https://cdn.homeworkapp.ai/sets-gamify-assets/math-ai-assets/assets/images/activity/person-4.png"}]}
1,Jt=(0,c.useContext)(j.f),$t=Jt.keyboardOpen,en=Jt.setKeyboardOpen,tn={activity:Ut,progressionStep:Ee,content:be,correctCount:xe,totalQuestions:null===ye||void 0===ye||null===(le=ye.progression_stage)||void 0===le?void 0:le.badge_total,setCorrectCount:Ne,globalStarsCount:Se,setGlobalStarsCount:Ze,isDisabled:Te,setIsDisabled:Oe,hiddenOptions:[],showHeader:!0,goBack:Le,getNextQuestion:Ht,fetchNextQuestion:Vt,pauseGame:Be,onLiveRemoved:null,isRetryQuiz:!1,handleNextActivity:function(){},handleShare:function(){},fixedBlocks:ze,resetStates:Me,loadingGeneratedAudio:Ke,setLoadingGeneratedAudio:Xe,userHasInteracted:We,addAssetsToSW:Ge,chunk:Ue,progressionStageData:null===ye||void 0===ye?void 0:ye.progression_stage,handleBlessFeedbackTag:ot,isExam:"EXAM"===(null===be||void 0===be?void 0:be.exit_popup)||"EXAM"===(null===be||void 0===be||null===(de=be.block)||void 0===de?void 0:de.exit_popup),attemptCount:rt,countdownResetKey:mt},nn=(0,J.n)(),on=nn.showInNavbar,rn=nn.isGamePopupOpen,sn=nn.setIsGamePopupOpen,an=nn.gameBackpressAction,un=(0,c.useState)(!1),ln=un[0],dn=un[1],cn=(0,c.useState)(!1),vn=cn[0],pn=cn[1],hn=(0,c.useRef)(null),_n=(0,c.useRef)(null),mn="PAUSE"===an?"Do you want to pause the game?":"Do you want to leave the game?",fn="PAUSE"===an?"You will be taken back to question screen":"Timer is running, all lives will be lost",yn="PAUSE"===an?"https://cdn.homeworkapp.ai/assets/student/pause.json":"https://cdn.homeworkapp.ai/assets/student/heart-break.json",gn=function(e){dn(e),e&&(at(null),ut(null))},kn=(0,c.useState)(!1),bn=kn[0],wn=kn[1],xn=(0,$.useAppContext)(),Sn=xn.setPricingDetails,qn=xn.setHasSufficientCredits,En=xn.hasSufficientCredits;c.useEffect((function(){window&&history&&!(0,q.ey)()&&(window.onpopstate=function(){if(ct())return ht.current===y.vp.countdown?void vt():(gn(!0),void Fe(!0));if(En){if($t)return en(!1),void D.Z.emit("update-figma-json",{type:Z.o.KeyboardClose,backpress:!0});if(Ee==y.vp.landing){if((dt.query||{}).isLanding)return;Me();var e=(0,g.Xg)("/".concat(dt.asPath.split("/").slice(1,dt.asPath.split("/").length>5?6:4).join("/")),dt.query,(0,r.Z)((0,i.Z)({lastAttempt:dt.query.activity_id},dt.query.worksheet_standalone&&{worksheet_standalone:!0},dt.query.lt&&{lt:dt.query.lt},dt.query.skipSplash&&{skipSplash:dt.query.skipSplash},dt.query.autoStart&&{autoStart:dt.query.autoStart},dt.query.rev&&{rev:dt.query.rev},dt.query.session_id&&{session_id:dt.query.session_id}),{referrer_screen:(0,k.r)(dt).user_is_currently_on}));setTimeout((function(){dt.replace(e)}),0)}else{if("trophy"===(null===be||void 0===be?void 0:be.id)){var t,n=dt.query;delete n.showQuestion,Q.O.pause();var s=(0,g.Xg)("/".concat(dt.asPath.split("/").slice(1,dt.asPath.split("/").length>5?6:4).join("/")),dt.query,(0,r.Z)((0,i.Z)({lastAttempt:dt.query.activity_id},dt.query.worksheet_standalone&&{worksheet_standalone:!0},n.lt&&{lt:n.lt},n.rev&&{rev:n.rev},n.session_id&&{session_id:n.session_id}),{referrer_screen:(0,k.r)(dt).user_is_currently_on}));null===(t=lt.current)||void 0===t||t.addTimeout((0,o.Z)((function(){return(0,l.__generator)(this,(function(e){switch(e.label){case 0:return Q.O.stopAll(),dt.replace(s),[4,Pn()];case 1:return e.sent(),[2]}}))})),0)}else on?(sn(!0),"PAUSE"===an&&D.Z.emit("update_surfer_game",{pause:!0})):gn(!0);Fe(!0)}}else{console.log("redirecting to home",En);!function(){var e,t,n=null===(e=dt.query)||void 0===e?void 0:e.activity_id,o=null===(t=dt.query)||void 0===t?void 0:t.worksheet_id;if(qn(!0),Sn(void 0),n){var s=dt.asPath.split("/").length>5?dt.asPath.split("/").slice(1,6).join("/"):dt.asPath.split("/").slice(1,4).join("/");if(n&&o){var a=(0,g.Xg)("/".concat(s),dt.query,(0,r.Z)((0,i.Z)({},"true"===dt.query.worksheet_standalone&&{worksheet_standalone:!0},dt.query.lt&&{lt:dt.query.lt},dt.query.skipSplash&&{skipSplash:dt.query.skipSplash},dt.query.autoStart&&{autoStart:dt.query.autoStart},dt.query.rev&&{rev:dt.query.rev},dt.query.session_id&&{session_id:dt.query.session_id}),{referrer_screen:(0,k.r)(dt).user_is_currently_on}));dt.push(a)}}else dt.push("/home")}()}})}),[on,an,Ee,En,be]);var Cn=function(e){on||(Ee===y.vp.landing||document.fullscreenElement?Ee!==y.vp.landing&&document.fullscreenElement&&(wn(!0),gn(!1),Fe(!1)):(wn(!1),gn(!0),Fe(!0)))};window&&history&&!(0,q.ey)()&&(document.onfullscreenchange=(0,c.useCallback)(Cn,[bn,on]),document.onvisibilitychange=(0,c.useCallback)((function(){document.hidden&&Pt&&Ee!==y.vp.landing&&"trophy"!==(null===be||void 0===be?void 0:be.id)&&(wn(!1),gn(!0),Fe(!0))}),[Pt,be]));var In=300,jn=c.useRef(0),Nn=c.useRef(0),Zn=c.useRef(!1),An={passive:!1};(0,c.useEffect)((function(){return(0,q.ey)()&&(window.addEventListener("touchend",fe,An),window.addEventListener("touchmove",_e,An),window.addEventListener("touchstart",he,An),window.addEventListener("popstate",me),window.shouldPreventGesture=function(){return!0},window.addEventListener("on_gesture",me)),function(){(0,q.ey)()&&(window.removeEventListener("touchend",fe,An),window.removeEventListener("touchmove",_e,An),window.removeEventListener("touchstart",he,An),window.removeEventListener("popstate",me),window.removeEventListener("on_gesture",me),window.shouldPreventGesture=function(){return!1})}}),[]),(0,c.useEffect)((function(){var e=function(e){var t;if("BACK_GESTURE"===(null===(t=e.data)||void 0===t?void 0:t.type))if(ht.current===y.vp.gameplay&&"trophy"!==(null===be||void 0===be?void 0:be.id))gn(!0),Fe(!0);else{var n,o=null===(n=dt.query)||void 0===n?void 0:n.session_id;window.parent.postMessage({type:"WORKSHEET_BACK",session_id:Array.isArray(o)?o[0]:o},"*")}};return window.addEventListener("message",e),function(){return window.removeEventListener("message",e)}}),[]),(0,c.useEffect)((function(){return function(){document.onfullscreenchange=null,document.onvisibilitychange=null}}),[Ee]);var Pn=function(){var e=(0,o.Z)((function(){var e,t,n,o,s,a,u,d,c,v,p,_,m,f,w,x,S,E,C,I,j,N,Z,P,T,O,D,F,Q,z,R,M,X,H,V,U,J,$,ee,te,ne,oe;return(0,l.__generator)(this,(function(l){switch(l.label){case 0:return"EXAM"===(null===be||void 0===be?void 0:be.exit_popup)||"EXAM"===(null===be||void 0===be||null===(e=be.block)||void 0===e?void 0:e.exit_popup)?(m=(0,g.Xg)("/".concat(dt.asPath.split("/").slice(1,dt.asPath.split("/").length>5?6:4).join("/")),dt.query,(0,r.Z)((0,i.Z)({lastAttempt:dt.query.activity_id},dt.query.worksheet_standalone&&{worksheet_standalone:!0},dt.query.lt&&{lt:dt.query.lt},dt.query.skipSplash&&{skipSplash:dt.query.skipSplash},dt.query.autoStart&&{autoStart:dt.query.autoStart},dt.query.rev&&{rev:dt.query.rev},dt.query.session_id&&{session_id:dt.query.session_id}),{referrer_screen:(0,k.r)(dt).user_is_currently_on})),window.history.pushState({},"",m),setTimeout((function(){dt.replace(m)}),0)):window.history.pushState({},"",window.location.href.replace("?showQuestion=true","").replace("&showQuestion=true","").replace("&referrer_screen=true",(0,k.r)(dt).user_is_currently_on).replace("&referrer_screen=true",(0,k.r)(dt).user_is_currently_on)),B.j.updatePageLocation(b.vY.question_landing_screen,dt),B.j.track("screen_change",{user_is_currently_on:b.vY.question_landing_screen,referrer_screen:b.vY.gameplay_screen}),gt(y.vp.landing),document.fullscreenElement&&document.exitFullscreen().then((function(){wn(!1),console.log("Document Exited from Full screen mode")})).catch((function(e){return console.error(e)})),Ae(!0),Ie(null),Ce([]),Tn(),f=JSON.parse((0,Y.wy)()),w=f.id,x=f.mobile,[4,Yt()];case 1:E=null!==(S=l.sent())&&void 0!==S?S:{},C=E.country,I=E.timezone,j=(null===f||void 0===f?void 0:f.other)||{};try{j=JSON.parse(null===f||void 0===f?void 0:f.other)}catch(ie){}return P={},T={build_number:209,platform:"android",worksheet_id:dt.query.worksheet_id,pl_student_id:Number(w),attempt_count:Number(rt),current_state:{parent_block_id:dt.query.activity_id}},O={is_landing:!Boolean(null!==(N=null===dt||void 0===dt||null===(t=dt.query)||void 0===t?void 0:t.showQuestion)&&void 0!==N&&N),router_query:null===dt||void 0===dt?void 0:dt.query,mobile:x,block:{name:null===(s=null===(n=be.block)||void 0===n?void 0:n.data[null===(o=be.block)||void 0===o?void 0:o.type])||void 0===s?void 0:s.name,type:null===(a=be.block)||void 0===a?void 0:a.type,blockIndex:null===(u=be.block)||void 0===u||null===(d=u.data)||void 0===d?void 0:d.blockIndex},chunk:{chunkId:null===(c=be.chunk)||void 0===c?void 0:c.chunkId,chunkName:null===(v=be.chunk)||void 0===v?void 0:v.chunkName,chunkIdx:null===(p=be.chunk)||void 0===p?void 0:p.chunkIdx},utm_source:dt.query.utm_source,opened_via:dt.query.lastAttempt?"Came back from level ".concat(dt.query.lastAttempt):"true"===dt.query.worksheet_standalone?"Direct Link":"Via Activity Card on the homepage",mathai_platform:K.dV.getPlatform()},D={mathai_platform:K.dV.getPlatform()},[4,(0,W.y)()];case 2:return D.networkInfo=l.sent(),[4,(0,W.r)()];case 3:P.data=(T.analytics=(O.extra=(D.environmentInfo=l.sent(),D.profile_id_with_region="".concat(f.id,"_").concat(b.Xz),D.region=b.Xz,D.chat_session_id=(null===(_=dt.query)||void 0===_?void 0:_.session_id)||null,D),O.distinct_id=(0,g.kG)(f),O.user_properties={profile_id:null===f||void 0===f?void 0:f.id,name:f.name,email:f.email,phone:f.mobile,grade:f.class_name,type:f.type,gender:f.gender,access_type:f.access_type,maths_feeling:null===j||void 0===j?void 0:j.maths_feeling,pervious_marks:null===j||void 0===j?void 0:j.pervious_marks,competition_prep:null===j||void 0===j?void 0:j.competition_prep,parent_name:null===j||void 0===j?void 0:j.parent_name,goals:null===j||void 0===j?void 0:j.goals,goals_commitment:null===j||void 0===j?void 0:j.goals_commitment,profile_picture:null===j||void 0===j?void 0:j.profile_picture,school_name:null===j||void 0===j?void 0:j.school_name,phoneNumber:null===f||void 0===f?void 0:f.mobile,mobile:null===f||void 0===f?void 0:f.mobile},O.append_global_variables={user_device:(0,q.b1)()?"mobile":"desktop"},O.activity_type=B.j.activity_type,O.country=C,O.timezone=I,O),T),Z=P,l.label=4;case 4:return l.trys.push([4,16,,17]),R=setTimeout((function(){B.j.track("page_loading_bottleneck",{api:"/getNextStateV2_reset",payload:Z,delay:b.h_})}),b.h_),[4,h().post("".concat("https://api.eu.mathai.ai/test/ts","/v3/personalizedLearning/getNextStateV2"),Z)];case 5:return M=l.sent().data,clearInterval(R),R=null,[4,(0,A.px)((0,r.Z)((0,i.Z)({},null===M||void 0===M||null===(F=M.data)||void 0===F?void 0:F.state),{getFigmaJsonQuery:Ct,getFigmaComponentsQuery:Et,computeFunctionsMounted:jt,setComputeFunctionsMounted:Nt}))];case 6:return X=l.sent(),X=(0,r.Z)((0,i.Z)({},M.data),{state:(0,r.Z)((0,i.Z)({id:null===X||void 0===X||null===(Q=X.block)||void 0===Q?void 0:Q.id},X),{badge_count_initial:null===M||void 0===M||null===(z=M.data)||void 0===z?void 0:z.state.badge_count_initial})}),[4,(0,L.pk)(X,Ge)];case 7:if(!(X=l.sent()))return[3,15];if(H=X.state,V=X.transition,U=X.assets,J=void 0===U?[]:U,$=X.fixed_blocks,ee=void 0===$?[]:$,!H||!H.block)return[3,15];l.label=8;case 8:return l.trys.push([8,13,,14]),te=[],(null===J||void 0===J?void 0:J.length)>0&&(te=J),Ge&&te.length?[4,Ge(te)]:[3,10];case 9:l.sent(),l.label=10;case 10:return Qe&&H.id===y.zv.trophy?[4,Qe({type:"PRECACHE_DELETE"})]:[3,12];case 11:l.sent(),l.label=12;case 12:return[3,14];case 13:return ne=l.sent(),(0,G.Tb)(ne),console.log(ne),[3,14];case 14:V&&(V.banner="https://cdn.homeworkapp.ai/sets-gamify-assets/math-ai-assets/assets/animations/color-wheel.json"),Ce([{id:H.id||H.tmpId}]),Ie(H),je(H),(null===H||void 0===H?void 0:H.badge_count_initial)&&Ne(null===H||void 0===H?void 0:H.badge_count_initial),isNaN(null===H||void 0===H?void 0:H.total_global_stars)||Ze(null===H||void 0===H?void 0:H.total_global_stars),isNaN(null===X||void 0===X?void 0:X.attempt)||it(null===X||void 0===X?void 0:X.attempt),Re(ee),Ae(!1),Oe(!1),l.label=15;case 15:return[3,17];case 16:return oe=l.sent(),(0,G.Tb)(oe),qt({message:"Error in handle reset",type:"handleReset",payload:Z,error:oe}),console.log(oe),Oe(!1),[3,17];case 17:return[2]}}
1))}));return function(){return e.apply(this,arguments)}}(),Tn=function(){var e=document.getElementById("story_background_video");e&&(e.style.visibility="hidden",e.src="");var t=document.getElementById("story_background_video_container_inner");t&&(t.style.visibility="hidden")},Ln=function(){var e=(0,o.Z)((function(e){var t,n,i;return(0,l.__generator)(this,(function(r){switch(r.label){case 0:return e?(Ee!==y.vp.landing&&(De(!0),null===(t=lt.current)||void 0===t||t.addTimeout((0,o.Z)((function(){return(0,l.__generator)(this,(function(e){switch(e.label){case 0:return gn(!1),[4,Pn()];case 1:return e.sent(),[2]}}))})),500)),[3,4]):[3,1];case 1:return Fe(!1),gn(!1),pn(!1),i=Boolean(null===(n=dt.query)||void 0===n?void 0:n.session_id),!Bt||Ft||i?[2]:document.fullscreenElement||(0,q.N0)()?[3,3]:[4,document.documentElement.requestFullscreen()];case 2:r.sent(),r.label=3;case 3:screen.orientation&&screen.orientation.lock("portrait").then((function(){})).catch((function(e){(0,G.Tb)(e),console.log(e)})),Fe(!1),gn(!1),pn(!1),wn(!0),r.label=4;case 4:return[2]}}
1))}));return function(t){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){return D.Z.on("handle_full_screen_change",Cn),function(){var e;null===(e=lt.current)||void 0===e||e.clearAll(),lt.current=null,D.Z.off("handle_full_screen_change",Cn)}}),[]),(0,c.useEffect)((function(){var e=function(){ct()&&(ht.current!==y.vp.countdown?(gn(!0),Fe(!0)):vt())};return D.Z.on("iframe_back_pressed",e),function(){D.Z.off("iframe_back_pressed",e)}}),[ct,vt]),(0,c.useEffect)((function(){var e,t,n;switch(_n.current=document.createElement("audio"),_n.current.type="audio/mpeg",_n.current.autoplay=!0,null!==(n=null!==(t=null===be||void 0===be?void 0:be.exit_popup)&&void 0!==t?t:null===be||void 0===be||null===(e=be.block)||void 0===e?void 0:e.exit_popup)&&void 0!==n?n:"DEFAULT"){case"DEFAULT":default:break;case"EXAM":ln&&(Q.O.pause(),_n.current.remove(),_n.current.src="https://cdn.mathai.ai/mathai-assets/dev/worksheet/audio/3299a500-2852-41f1-9955-0822ca5b0075.mp3"),vn?(Q.O.pause(),_n.current.remove(),_n.current.src="https://cdn.mathai.ai/mathai-assets/dev/worksheet/audio/965833d0-7c32-4e21-8186-cc35b05a7958.mp3",hn.current=setTimeout((0,o.Z)((function(){var e;return(0,l.__generator)(this,(function(t){switch(t.label){case 0:return nt(!0),Zt(!1),pn(!1),gn(!1),[4,new Promise(function(){var e=(0,o.Z)((function(e,t){var n,o,i,r;return(0,l.__generator)(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,h().post("".concat("https://api.eu.mathai.ai/test/ts","/v3/personalizedLearning/incrementWorksheetAttemptCount"),{data:{worksheet_id:dt.query.worksheet_id,level_id:dt.query.activity_id,student_id:null!==(o="".concat(null===(n=JSON.parse((0,Y.wy)()))||void 0===n?void 0:n.id))&&void 0!==o?o:null}})];case 1:return i=s.sent().data,e(i),[3,3];case 2:return r=s.sent(),t(r),[3,3];case 3:return[2]}}
1))}));return function(t,n){return e.apply(this,arguments)}}())];case 1:return t.sent(),Ee!==y.vp.landing&&(De(!0),null===(e=lt.current)||void 0===e||e.addTimeout((0,o.Z)((function(){return(0,l.__generator)(this,(function(e){switch(e.label){case 0:return gn(!1),[4,Pn()];case 1:return e.sent(),[2]}}))})),0)),[2]}}))})),6e3)):hn.current&&clearTimeout(hn.current)}_n.current.play().catch((function(e){console.error("Error playing audio:",e)}))}),[null===be||void 0===be?void 0:be.exit_popup,"EXAM"===(null===be||void 0===be||null===(ce=be.block)||void 0===ce?void 0:ce.exit_popup),ln,vn]),(0,d.jsxs)("div",{className:"flex justify-center",children:[qe?(0,d.jsx)("div",{style:{width:"100vw",height:(0,x.a8)()},children:(0,d.jsx)(ee.m,{retry:!1})}):be&&!e.hasError?(0,d.jsx)(oe,(0,i.Z)({},tn)):(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(ne,{showBottomSheet:!0,setShowBottomSheet:function(){},icon:"https://cdn.homeworkapp.ai/sets-gamify-assets/math-ai-assets/assets/animations/orange-alert.json",title:"something went wrong",description:"",secondaryText:"Cancel",primaryText:"Reload",primaryClick:function(){dt.replace(dt.asPath)},mixpanelEvent:{event_name:"progression_error_popup_visible",currentStep:!!be,currentStep_id:null===be||void 0===be?void 0:be.id,hasError:e.hasError}})}),(0,d.jsxs)("div",{style:{position:"absolute"},children:["EXAM"===(null===be||void 0===be?void 0:be.exit_popup)||"EXAM"===(null===be||void 0===be||null===(ve=be.block)||void 0===ve?void 0:ve.exit_popup)?(0,d.jsx)(ne,{showBottomSheet:ln,setShowBottomSheet:function(){},icon:"https://sets-gamify-assets.s3.ap-south-1.amazonaws.com/math-ai-assets/assets/animations/exit_level_1.json",title:"Exiting level marks it complete!!",description:"You are trying to exit the level, it will mark this level complete with current progress. Are you sure?",hasSecondary:!0,secondaryText:"End level",primaryText:"Don't exit",primaryClick:function(){var e,t,n,o,i=document.getElementsByClassName("bottomSheetDialog quiz-header-container");history.pushState({},""),i.length<2&&Q.O.resume(),Ln(!1),Q.O.pause(),null===_n||void 0===_n||null===(e=_n.current)||void 0===e||null===(t=e.pause)||void 0===t||t.call(e),null===_n||void 0===_n||null===(n=_n.current)||void 0===n||null===(o=n.remove)||void 0===o||o.call(n),Zt(!1),gn(!1)},secondaryClick:function(){var e,t,n,o;gn(!1),pn(!0),null===_n||void 0===_n||null===(e=_n.current)||void 0===e||null===(t=e.pause)||void 0===t||t.call(e),null===_n||void 0===_n||null===(n=_n.current)||void 0===n||null===(o=n.remove)||void 0===o||o.call(n)},fullWidth:!1}):(0,d.jsx)(ne,{showBottomSheet:ln,setShowBottomSheet:function(){},icon:"https://cdn.homeworkapp.ai/sets-gamify-assets/math-ai-assets/assets/animations/orange-alert.json",title:"Are you sure to go back?",description:"You will lose all your progress",hasSecondary:!0,secondaryText:"Cancel",primaryText:"Yes",primaryClick:function(){var e;Q.O.stopAll(),nt(!0);var t=null===(e=dt.query)||void 0===e?void 0:e.session_id;if(t)return window.parent.postMessage({type:"WORKSHEET_BACK",session_id:Array.isArray(t)?t[0]:t},"*"),void gn(!1);Ln(!0),Zt(!1)},secondaryClick:function(){document.getElementsByClassName("bottomSheetDialog quiz-header-container").length<2&&Q.O.resume(),Ln(!1),history.pushState({},"")},fullWidth:!1}),("EXAM"===(null===be||void 0===be?void 0:be.exit_popup)||"EXAM"===(null===be||void 0===be||null===(pe=be.block)||void 0===pe?void 0:pe.exit_popup))&&(0,d.jsx)(ne,{showBottomSheet:vn,setShowBottomSheet:function(){},icon:"https://sets-gamify-assets.s3.ap-south-1.amazonaws.com/math-ai-assets/assets/animations/exit_level_final.json",title:"You have 6 sec to cancel",description:"Click on cancel if you don't want to exit level",hasSecondary:!1,primaryText:"Cancel",primaryClick:function(){var e,t,n,o,i=document.getElementsByClassName("bottomSheetDialog quiz-header-container");history.pushState({},""),i.length<2&&Q.O.resume(),Ln(!1),Q.O.pause(),null===_n||void 0===_n||null===(e=_n.current)||void 0===e||null===(t=e.pause)||void 0===t||t.call(e),null===_n||void 0===_n||null===(n=_n.current)||void 0===n||null===(o=n.remove)||void 0===o||o.call(n),Zt(!1)},fullWidth:!1}),(0,d.jsx)(ne,{showBottomSheet:rn,setShowBottomSheet:function(){},icon:yn,title:mn,description:fn,hasSecondary:!0,secondaryText:"Cancel",primaryText:"Yes",primaryClick:function(){sn(!1),"EXIT"===an?D.Z.emit("update_surfer_game",{exit:!0}
1):D.Z.emit("update_surfer_game",{pause:!0}),history.pushState({},"")},secondaryClick:function(){sn(!1),D.Z.emit("update_surfer_game",{exit:!1,pause:!1}),history.pushState({},"")},fullWidth:!1})]}),(0,d.jsx)("div",{style:{display:"none"},children:(0,d.jsx)(H.a,{count:1})})]})};t.default=function(e){var t=(0,w.tq)(),n=(0,I.useGlobalGameplayContext)();return(0,d.jsxs)(_.W,(0,r.Z)((0,i.Z)({backend:t?f.zr:m.PD},t?{options:{delay:200}}:{}),{children:[(0,d.jsx)(ie,{}),(0,d.jsx)(j.N,{children:(0,d.jsx)(U.N5,{children:(0,d.jsx)(J.Z,{children:(0,d.jsx)(re,(0,i.Z)({},e,n))})})})]}))};var se=function(e,t){return{totalLives:t,tries:Math.min(Number(t),Number(t)-Number(e)+1)}}},61747:function(e,t,n){n.d(t,{C:function(){return o}});var o=(0,n(67294).createContext)(null)},48762:function(e,t,n){n.d(t,{E:function(){return o}});var o=(0,n(67294).createContext)({})},47558:function(e,t,n){n.d(t,{N5:function(){return y},xF:function(){return f},ev:function(){return m}});var o=n(85893),i=n(61747),r=function(e){var t=e.children,n=e.mathfield,r=i.C.Provider;return(0,o.jsx)(r,{value:n,children:t})},s=n(67294),a=n(48762),u=function(e){var t=e.children,n=e.mathfield,i=a.E.Provider;return(0,o.jsx)(i,{value:n,children:t})},l=(0,s.createContext)(null),d=(0,s.createContext)(null);function c(e){e.preventDefault()}function v(e){if({37:1,38:1,39:1,40:1}[e.keyCode])return c(e),!1}var p=!1,h=function(){var e="onwheel"in window.document.createElement("div")?"wheel":"mousewheel",t=window.document.getElementById("parent-container");null===t||void 0===t||t.addEventListener("DOMMouseScroll",c,!1),null===t||void 0===t||t.addEventListener(e,c,p),null===t||void 0===t||t.addEventListener("touchmove",c,p),null===t||void 0===t||t.addEventListener("keydown",v,!1)},_=function(){var e="onwheel"in window.document.createElement("div")?"wheel":"mousewheel",t=window.document.getElementById("parent-container");null===t||void 0===t||t.removeEventListener("DOMMouseScroll",c,!1),null===t||void 0===t||t.removeEventListener(e,c,p),null===t||void 0===t||t.removeEventListener("touchmove",c,p),null===t||void 0===t||t.removeEventListener("keydown",v,!1)},m=function(){var e=(0,s.useContext)(l);if(!e)throw new Error("Keyboard context not provided");return e},f=function(){var e=(0,s.useContext)(d);if(!e)throw new Error("dropdown context not provided");return e},y=function(e){var t=e.children,n=(0,s.useState)(!1),i=n[0],a=n[1],c=(0,s.useState)(null),v=c[0],p=c[1],m=(0,s.useState)(!0),f=m[0],y=m[1],g=(0,s.useState)([]),k=g[0],b=g[1],w=(0,s.useState)(null),x=w[0],S=w[1],q=(0,s.useState)(!1),E=q[0],C=q[1],I=(0,s.useState)(!1),j=I[0],N=I[1],Z=function(e){return f&&!k[e]},A={onDragStart:function(){S(null),p(null),h()},onDragEnd:function(){_()}};return(0,s.useEffect)((function(){return function(){}}),[v]),(0,o.jsx)(l.Provider,{value:{showKeyboard:i,setShowKeyboard:a,mathfield:v,setMathField:p,editable:f,setEditable:y,setNoInteractionList:b,getEditable:Z,setDropdown:S,stopPropagation:E,setStopPropagation:C,isNativeKeyboardOpen:j,setNativeKeyboardOpen:N,globalDragEvents:A},children:(0,o.jsx)(u,{mathfield:v,children:(0,o.jsx)(r,{mathfield:v,children:(0,o.jsx)(d.Provider,{value:{dropdown:x,setDropdown:S,editable:f,getEditable:Z},children:t})})})})}},63036:function(e,t,n){n.d(t,{E:function(){return i}});var o=n(51438),i=function(){function e(){(0,o.Z)(this,e),this.timeouts=[],this.intervals=[],this.promises=[]}var t=e.prototype;return t.addTimeout=function(e,t){var n=setTimeout(e,t);return this.timeouts.push(n),n},t.clearTimeout=function(e){clearTimeout(e),this.timeouts=this.timeouts.filter((function(t){return t!==e}))},t.addInterval=function(e,t){var n=setInterval(e,t);return this.intervals.push(n),n},t.clearInterval=function(e){clearInterval(e),this.intervals=this.intervals.filter((function(t){return t!==e}))},t.addPromise=function(e){this.promises.push(e)},t.clearAll=function(){this.timeouts.forEach((function(e){return clearTimeout(e)})),this.intervals.forEach((function(e){return clearInterval(e)})),this.promises.forEach((function(e){return e.cancel&&e.cancel()})),this.timeouts=[],this.intervals=[],this.promises=[]},e}()},51119:function(e,t,n){n.d(t,{o:function(){return o}});var o={KeyboardOpen:"keyboard_open",KeyboardClose:"keyboard_close",
1KeyboardFocus:"keyboard_focus",DropdownSelect:"dropdown_select"}}}]);
2//# sourceMappingURL=2739.9153e3e02e8c10ba.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.