PageSourceSearch

https://www.studibuddi.ai/_next/static/chunks/app/layout-78696c398…?dpl=dpl_4LbDzGUU6PFYrrUvrKTZkBAUDBSv

js studibuddi.ai collected 2026-10-05 15:51:57 UTC 25,161 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{2691:(e,t,n)=>{"use strict";n.d(t,{A:()=>l});var r=n(12115),o=n(61005);let s="[useAuth]";function i(e,t){let n=new Date().toISOString();t?console.log("".concat(s," ").concat(n," ").concat(e),t):console.log("".concat(s," ").concat(n," ").concat(e))}function a(e,t){return Promise.race([e,new Promise((e,n)=>setTimeout(()=>n(Error("Auth request timed out after ".concat(t,"ms. Please refresh the page."))),t))])}function l(){let[e,t]=(0,r.useState)(null),[n,s]=(0,r.useState)(!0),[l,u]=(0,r.useState)(null),c=(0,r.useRef)((0,o.createClient)()).current;return(0,r.useEffect)(()=>{i("mount");let e=!0,n={current:null},r=new Set(["SIGNED_OUT"]);(async()=>{var r,o,l;i("fetchUser:start");let d=Date.now();try{let{data:{user:s},error:l}=await a(c.auth.getUser(),1e4),f=Date.now()-d;if(!e)return void i("fetchUser:ignored_unmounted",{elapsed:f});l?(i("fetchUser:error",{elapsed_ms:f,error_name:l.name,error_message:l.message,error_status:l.status}),"Auth session missing!"===l.message?(u(null),n.current=null,t(null)):(u("Auth error: ".concat(l.message)),i("fetchUser:error_preserving_user",{preserved_user_id:null==(r=n.current)?void 0:r.id}))):(i("fetchUser:ok",{elapsed_ms:f,has_user:!!s,user_id:null==s?void 0:s.id,user_email:null==s?void 0:s.email,user_role:null==s||null==(o=s.user_metadata)?void 0:o.role}),u(null),n.current=null!=s?s:null,t(null!=s?s:null))}catch(o){let t=Date.now()-d;if(!e)return void i("fetchUser:threw_unmounted",{elapsed_ms:t});let r=o instanceof Error?o.message:String(o);i("fetchUser:threw_preserving_user",{elapsed_ms:t,error:r,preserved_user_id:null==(l=n.current)?void 0:l.id}),u(r)}finally{e&&s(!1)}})();let{data:{subscription:o}}=c.auth.onAuthStateChange(async(o,l)=>{var d,f,p,h,g,m;if(i("onAuthStateChange:fired",{event:o,has_session:!!l,has_user_in_session:!!(null==l?void 0:l.user),session_user_id:null==l||null==(d=l.user)?void 0:d.id,session_access_token_len:null!=(p=null==l||null==(f=l.access_token)?void 0:f.length)?p:0,session_expires_at:null==l?void 0:l.expires_at,session_expires_in_s:(null==l?void 0:l.expires_at)?Math.floor(l.expires_at-Date.now()/1e3):null,document_visibility:"undefined"!=typeof document?document.visibilityState:"n/a",has_last_known_user:!!n.current}),!e)return void i("onAuthStateChange:ignored_unmounted",{event:o});try{if(null==l?void 0:l.user){i("onAuthStateChange:path_valid_session",{event:o,user_id:l.user.id});let r=Date.now(),{data:{user:s},error:d}=await a(c.auth.getUser(),1e4),f=Date.now()-r;if(!e)return;d&&"Auth session missing!"!==d.message?(i("onAuthStateChange:getUser_error_preserving_user",{event:o,elapsed_ms:f,error_message:d.message,error_status:d.status,preserved_user_id:null==(h=n.current)?void 0:h.id}),u("Auth error: ".concat(d.message))):(i("onAuthStateChange:getUser_ok",{event:o,elapsed_ms:f,has_user:!!s,user_id:null==s?void 0:s.id}),u(null),n.current=null!=s?s:null,t(null!=s?s:null))}else r.has(o)||"INITIAL_SESSION"===o?(i("onAuthStateChange:definite_signout",{event:o}),n.current=null,t(null),u(null)):i("onAuthStateChange:null_session_preserving_user",{event:o,preserved_user_id:null==(g=n.current)?void 0:g.id})}catch(r){if(!e)return;let t=r instanceof Error?r.message:String(r);i("onAuthStateChange:threw_preserving_user",{event:o,error:t,preserved_user_id:null==(m=n.current)?void 0:m.id}),u(t)}finally{e&&s(!1)}}),l=()=>{i("visibility_change",{visibilityState:document.visibilityState,hidden:document.hidden})};return"undefined"!=typeof document&&document.addEventListener("visibilitychange",l),()=>{i("unmount"),e=!1,o.unsubscribe(),"undefined"!=typeof document&&document.removeEventListener("visibilitychange",l)}},[]),{user:e,loading:n,authError:l,signUp:async(e,t,n)=>{i("signUp:start",{email:e});let{data:r,error:o}=await c.auth.signUp({email:e,password:t,options:{data:n}});return i("signUp:result",{email:e,has_data:!!(null==r?void 0:r.user),error_message:null==o?void 0:o.message}),{data:r,error:o}},signIn:async(e,t)=>{i("signIn:start",{email:e});let{data:n,error:r}=await c.auth.signInWithPassword({email:e,password:t});return i("signIn:result",{email:e,has_data:!!(null==n?void 0:n.user),error_message:null==r?void 0:r.message}),{data:n,error:r}},signOut:async()=>{i("signOut:start");let{error:e}=await c.auth.signOut({scope:"local"});return i("signOut:result",{error_message:null==e?void 0:e.message}),{error:e}}}}},4853:(e,t)=>{"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{cancelIdleCallback:function(){return r},requestIdleCallback:function(){return n}});let n="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(window)||function(e){let t=Date.now();return self.setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)},r="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(window)||function(e){return clearTimeout(e)};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},12818:(e,t,n)=>{"use strict";function r(e){let t=["I've been using StudiBuddi for my schoolwork."];return e.botUrl&&t.push("Tap this to chat to StudiBuddi on WhatsApp, where you can ask how I'm doing and get weekly updates if you want: ".concat(e.botUrl)),t.push(e.adult?"What it is and the plans: ".concat(e.url):"It's paid for by a parent or guardian. What it is and the plans: ".concat(e.url)),t.join("\n\n")}async function o(){let e=await fetch("/api/billing/share-link",{method:"POST",credentials:"include"}),t=await e.json().catch(()=>({}));if(!e.ok||!t.url)throw Error(t.error||"Could not create the link");return t}function s(e){return"https://wa.me/?text=".concat(encodeURIComponent(r(e)))}function i(e){let t=["".concat(e.daysActive," day").concat(1===e.daysActive?"":"s"," practised"),"".concat(e.questions," question").concat(1===e.questions?"":"s")];null!==e.percent&&t.push("".concat(e.percent,"% of marks"));let n=e.topics.length?". Topics: ".concat(e.topics.slice(0,3).join("; ")):"";return"".concat(t.join(", ")).concat(n)}n.d(t,{U8:()=>i,YU:()=>o,xb:()=>s,zk:()=>r})},19949:(e,t,n)=>{"use strict";n.d(t,{D4:()=>l,NB:()=>s,U3:()=>a,at:()=>o,lx:()=>r});let r=7,o=5,s={exam_season:{id:"exam_season",name:"Exam season",priceCents:15e3,priceLabel:"R150",period:"until 31 Dec",blurb:"October, November and December. One payment, no renewal.",recurring:!1,recommended:!0},monthly:{id:"monthly",name:"Monthly",priceCents:9900,priceLabel:"R99",period:"per month",blurb:"Renews every month. Cancel any time.",recurring:!0},annual:{id:"annual",name:"Year",priceCents:5e4,priceLabel:"R500",period:"per year",blurb:"Renews every year. Cancel any time.",recurring:!0}},i=["exam_season","monthly","annual"];function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return i.filter(t=>"exam_season"!==t||function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=e.getUTCMonth();return!(t<8||11===t&&e.getUTCDate()>15)}(e)).map(e=>s[e])}function l(e){return"monthly"===e||"exam_season"===e||"annual"===e}},20063:(e,t,n)=>{"use strict";var r=n(47260);n.o(r,"useParams")&&n.d(t,{useParams:function(){return r.useParams}}),n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}}),n.o(r,"useServerInsertedHTML")&&n.d(t,{useServerInsertedHTML:function(){return r.useServerInsertedHTML}})},38353:()=>{},41402:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});let r=n(71983),o=n(45849),s=n(17389);Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return b},handleClientScriptLoad:function(){return _},initScriptLoader:function(){return v}});let i=n(28140),a=n(49417),l=n(95155),u=i._(n(47650)),c=a._(n(12115)),d=n(82073),f=n(94681),p=n(4853),h=new Map,g=new Set,m=e=>{let{src:t,id:n,onLoad:r=()=>{},onReady:o=null,dangerouslySetInnerHTML:s,children:i="",strategy:a="afterInteractive",onError:l,stylesheets:c}=e,d=n||t;if(d&&g.has(d))return;if(h.has(t)){g.add(d),h.get(t).then(r,l);return}let p=()=>{o&&o(),g.add(d)},m=document.createElement("script"),_=new Promise((e,t)=>
1{m.addEventListener("load",function(t){e(),r&&r.call(this,t),p()}),m.addEventListener("error",function(e){t(e)})}).catch(function(e){l&&l(e)});s?(m.innerHTML=s.__html||"",p()):i?(m.textContent="string"==typeof i?i:Array.isArray(i)?i.join(""):"",p()):t&&(m.src=t,h.set(t,_)),(0,f.setAttributesFromProps)(m,e),"worker"===a&&m.setAttribute("type","text/partytown"),m.setAttribute("data-nscript",a),c&&(e=>{if(u.default.preinit)return e.forEach(e=>{u.default.preinit(e,{as:"style"})});{let t=document.head;e.forEach(e=>{let n=document.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=e,t.appendChild(n)})}})(c),document.body.appendChild(m)};function _(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,p.requestIdleCallback)(()=>m(e))}):m(e)}function v(e){e.forEach(_),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");g.add(t)})}function y(e){let{id:t,src:n="",onLoad:i=()=>{},onReady:a=null,strategy:f="afterInteractive",onError:h,stylesheets:_}=e,v=s._(e,["id","src","onLoad","onReady","strategy","onError","stylesheets"]),{updateScripts:y,scripts:b,getIsSsr:x,appDir:w,nonce:S}=(0,c.useContext)(d.HeadManagerContext);S=v.nonce||S;let k=(0,c.useRef)(!1);(0,c.useEffect)(()=>{let e=t||n;k.current||(a&&e&&g.has(e)&&a(),k.current=!0)},[a,t,n]);let I=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{if(!I.current){if("afterInteractive"===f)m(e);else"lazyOnload"===f&&("complete"===document.readyState?(0,p.requestIdleCallback)(()=>m(e)):window.addEventListener("load",()=>{(0,p.requestIdleCallback)(()=>m(e))}));I.current=!0}},[e,f]),("beforeInteractive"===f||"worker"===f)&&(y?(b[f]=(b[f]||[]).concat([o._(r._({id:t,src:n,onLoad:i,onReady:a,onError:h},v),{nonce:S})]),y(b)):x&&x()?g.add(t||n):x&&!x()&&m(o._(r._({},e),{nonce:S}))),w){if(_&&_.forEach(e=>{u.default.preinit(e,{as:"style"})}),"beforeInteractive"===f)if(!n)return v.dangerouslySetInnerHTML&&(v.children=v.dangerouslySetInnerHTML.__html,delete v.dangerouslySetInnerHTML),(0,l.jsx)("script",{nonce:S,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+JSON.stringify([0,o._(r._({},v),{id:t})])+")"}});else return u.default.preload(n,v.integrity?{as:"script",integrity:v.integrity,nonce:S,crossOrigin:v.crossOrigin}:{as:"script",nonce:S,crossOrigin:v.crossOrigin}),(0,l.jsx)("script",{nonce:S,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+JSON.stringify([n,o._(r._({},v),{id:t})])+")"}});"afterInteractive"===f&&n&&u.default.preload(n,v.integrity?{as:"script",integrity:v.integrity,nonce:S,crossOrigin:v.crossOrigin}:{as:"script",nonce:S,crossOrigin:v.crossOrigin})}return null}Object.defineProperty(y,"__nextScript",{value:!0});let b=y;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},44828:(e,t,n)=>{"use strict";n.d(t,{default:()=>v});var r=n(95155),o=n(12115),s=n(50625),i=n(52619),a=n.n(i),l=n(20063),u=n(19949),c=n(12818);let d=["/training","/tutor","/resources","/diagnostic-test"],f="sb_trial_prompt_dismissed_day",p=s.Ay.aside.withConfig({componentId:"sc-8273b90d-0"})(["position:fixed;left:16px;bottom:16px;z-index:900;width:min(360px,calc(100vw - 32px));padding:16px 16px 14px;border-radius:14px;background:",";border:1px solid ","55;box-shadow:0 12px 32px rgba(0,0,0,0.35);color:",";p{margin:0 0 12px;font-size:0.92rem;line-height:1.45;color:",";}strong{display:block;margin-bottom:4px;color:",";}"],e=>{let{theme:t}=e;return t.colors.surface},e=>{let{theme:t}=e;return t.colors.primary},e=>{let{theme:t}=e;return t.colors.text},e=>{let{theme:t}=e;return t.colors.textSecondary},e=>{let{theme:t}=e;return t.colors.text}),h=s.Ay.div.withConfig({componentId:"sc-8273b90d-1"})(["display:flex;gap:8px;align-items:center;flex-wrap:wrap;"]),g=s.Ay.a.withConfig({componentId:"sc-8273b90d-2"})(["padding:8px 12px;border-radius:8px;background:#25d366;color:#0b1f12;font-weight:700;font-size:0.88rem;text-decoration:none;"]),m=(0,s.Ay)(a()).withConfig({componentId:"sc-8273b90d-3"})(["padding:8px 12px;border-radius:8px;border:1px solid ",";color:",";font-weight:600;font-size:0.88rem;text-decoration:none;"],e=>{let{theme:t}=e;return t.colors.primary},e=>{let{theme:t}=e;return t.colors.primary}),_=s.Ay.button.withConfig({componentId:"sc-8273b90d-4"})(["position:absolute;top:6px;right:8px;border:none;background:none;color:",";font-size:1.1rem;cursor:pointer;"],e=>{let{theme:t}=e;return t.colors.textSecondary});function v(){let e=(0,l.usePathname)()||"",t=d.some(t=>e.startsWith(t)),[n,s]=(0,o.useState)(null),[i,a]=(0,o.useState)(null),[v,y]=(0,o.useState)(!1);if((0,o.useEffect)(()=>
1{if(!t||n)return;let e=!1;return fetch("/api/billing/status",{credentials:"include"}).then(e=>e.ok?e.json():null).then(t=>{if(e||!(null==t?void 0:t.billing))return;let n=t.billing;"trial"!==n.state||n.trialDay<u.at||function(){try{let e=localStorage.getItem(f);return e?Number(e):null}catch(e){return null}}()!==n.trialDay&&(s(n),(0,c.YU)().then(t=>!e&&a(t)).catch(()=>void 0))}).catch(()=>void 0),()=>{e=!0}},[t,n]),!t||!n||v)return null;let b=new Date(n.trialEndsAt).toLocaleDateString("en-ZA",{weekday:"long",day:"numeric",month:"long"});return(0,r.jsxs)(p,{"aria-label":"Your free week",children:[(0,r.jsx)(_,{type:"button","aria-label":"Dismiss",onClick:()=>{try{localStorage.setItem(f,String(n.trialDay))}catch(e){}y(!0)},children:"\xd7"}),(0,r.jsxs)("strong",{children:["Your free week ends ",b]}),(0,r.jsx)("p",{children:i&&!i.adult?"Send a parent or guardian a link. When they tap it on WhatsApp, they give consent for your account and can ask how you're doing.":"Want a parent or guardian to see what StudiBuddi is? Send them a link."}),(0,r.jsxs)(h,{children:[i&&(0,r.jsx)(g,{href:(0,c.xb)(i),target:"_blank",rel:"noopener noreferrer",children:"Send on WhatsApp"}),(0,r.jsx)(m,{href:"/billing",children:"See plans"})]})]})}},61005:(e,t,n)=>{"use strict";n.d(t,{createClient:()=>i});var r=n(8490);let o=null;function s(e,t){let n=new Date().toISOString();t?console.log("[supabase-browser] ".concat(n," ").concat(e),t):console.log("[supabase-browser] ".concat(n," ").concat(e))}let i=()=>(o||(s("create_browser_client"),o=(0,r.createBrowserClient)("https://yomgcnunzrirbsmqgneg.supabase.co","eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InlvbWdjbnVuenJpcmJzbXFnbmVnIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDkyMjA5NDUsImV4cCI6MjA2NDc5Njk0NX0.dJj1ia7Q5Jka8dlYtxUoADrC5tFUrs2WZSi__EJNBSc",{cookies:{getAll(){let e="undefined"==typeof document?[]:document.cookie.split("; ").filter(Boolean).map(e=>{let[t,...n]=e.split("=");return{name:t,value:decodeURIComponent(n.join("="))}}),t=e.filter(e=>e.name.startsWith("sb-"));return s("cookies:getAll",{total_cookies:e.length,supabase_cookie_names:t.map(e=>e.name),supabase_cookie_total_bytes:t.reduce((e,t)=>e+t.value.length,0)}),e},setAll(e){s("cookies:setAll",{names:e.map(e=>e.name),total_bytes:e.reduce((e,t)=>e+t.value.length,0)}),e.forEach(e=>{let{name:t,value:n,options:r}=e;!function(e,t,n){if("undefined"==typeof document)return;let r="".concat(e,"=").concat(encodeURIComponent(t));(null==n?void 0:n.path)&&(r+="; path=".concat(n.path)),(null==n?void 0:n.maxAge)&&(r+="; max-age=".concat(n.maxAge)),(null==n?void 0:n.domain)&&(r+="; domain=".concat(n.domain)),(null==n?void 0:n.secure)&&(r+="; secure"),(null==n?void 0:n.sameSite)&&"string"==typeof n.sameSite&&(r+="; samesite=".concat(n.sameSite)),document.cookie=r}(t,n,r)})}},auth:{debug:!0}})),o)},61080:(e,t,n)=>{"use strict";n.d(t,{LessonVideoProvider:()=>l,_:()=>u});var r=n(95155),o=n(12115),s=n(2691),i=n(61005);let a=(0,o.createContext)(null);function l(e){let{children:t}=e,{user:n}=(0,s.A)(),[l,u]=(0,o.useState)([]),[c,d]=(0,o.useState)(null),[f,p]=(0,o.useState)(!1),h=(0,o.useRef)(null),g=(0,o.useRef)(new Set),m=(0,i.createClient)(),_=(0,o.useCallback)(async()=>{"Notification"in window&&"default"===Notification.permission&&await Notification.requestPermission()},[]),v=(0,o.useCallback)(async()=>{if(null==n?void 0:n.id)try{let{data:e,error:t}=await m.from("lesson_videos").select("*").eq("user_id",n.id).order("created_at",{ascending:!1}).limit(20);if(t)return void console.error("Error fetching lesson videos:",t);if(e){u(e);let t=e.find(e=>"generating"===e.status);d(t||null),localStorage.setItem("lesson_videos_cache",JSON.stringify(e))}}catch(e){console.error("Error in refreshVideos:",e)}},[null==n?void 0:n.id,m]);(0,o.useEffect)(()=>{(null==n?void 0:n.id)&&(v(),_())},[null==n?void 0:n.id,v,_]),(0,o.useEffect)(()=>{if(h.current&&(clearInterval(h.current),h.current=null),!c)return void p(!1);p(!0),console.log("[LessonVideo] Starting polling for:",c.id);let e=async()=>{try{let{data:e,error:t}=await m.from("lesson_videos").select("*").eq("id",c.id).single();if(t)return void console.error("Polling error:",t);if(e&&"generating"!==e.status&&(console.log("[LessonVideo] Generation completed:",e.status),d(null),v(),!g.current.has(e.id)))if(g.current.add(e.id),"completed"===e.status){"Notification"in window&&"granted"===Notification.permission&&(new Notification("\uD83C\uDF89 Your lesson video is ready!",{body:e.lesson_description.substring(0,80)+"...",icon:"/logo.png",tag:"lesson-video-".concat(e.id)}).onclick=()=>{window.focus(),window.location.href="/training"});try{let e=new Audio("/success.mp3");e.volume=.3,e.play().catch(e=>console.log("Could not play sound:",e))}catch(e){}}else"failed"===e.status&&"Notification"in window&&"granted"===Notification.permission&&new Notification("❌ Video generation failed",{body:e.error_message||"An error occurred during generation",icon:"/logo.png",tag:"lesson-video-error-".concat(e.id)})}catch(e){console.error("Error polling for video completion:",e)}};return e(),h.current=setInterval(e,15e3),()=>{h.current&&(clearInterval(h.current),h.current=null)}},[null==c?void 0:c.id,m,v]);let y=async e=>{if(!(null==n?void 0:n.id))throw Error("Not authenticated");let t="lesson_".concat(Date.now());try{let{data:r,error:o}=await m.from("lesson_videos").insert({user_id:n.id,lesson_description:e.lessonDescription,user_confusions:e.lessonConfusions||null,user_grade:e.userGrade,include_voiceover:e.includeVoiceover,backend_job_id:t,status:"generating"}).select().single();if(o||!r)throw console.error("Database error:",o),Error("Failed to create video record");console.log("[LessonVideo] Created DB record:",r.id),d(r);let s=(await fetch("/api/config/services").then(e=>e.ok?e.json():{}).catch(()=>({}))).diagram_service_url||"https://diagram-service.blackdesert-f7cf0245.southafricanorth.azurecontainerapps.io";return fetch("".concat(s,"/generate-video"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lesson_description:e.lessonDescription,user_confusions:e.lessonConfusions||void 0,include_voiceover:e.includeVoiceover,user_id:n.id,user_grade:e.userGrade,model:"claude",mode:"production",test_id:t,video_record_id:r.id})}).then(e=>{console.log("[LessonVideo] Backend request completed:",e.ok?"success":"error ".concat(e.status))}).catch(e=>{console.log("[LessonVideo] HTTP connection closed (expected for long jobs):",e.message)}),r.id}catch(e){throw console.error("[LessonVideo] Error starting generation:",e),e}},b=async e=>{try{await m.from("lesson_videos").update({viewed:!0,viewed_at:new Date().toISOString()}).eq("id",e),v()}catch(e){console.error("Error marking video as viewed:",e)}};return(0,r.jsx)(a.Provider,{value:{videos:l,activeGeneration:c,startGeneration:y,markAsViewed:b,refreshVideos:v,isPolling:f,requestNotificationPermission:_},children:t})}let u=()=>{let e=(0,o.useContext)(a);if(!e)throw Error("useLessonVideos must be used within LessonVideoProvider");return e}}
1,71083:(e,t,n)=>{Promise.resolve().then(n.bind(n,44828)),Promise.resolve().then(n.bind(n,90909)),Promise.resolve().then(n.bind(n,81664)),Promise.resolve().then(n.bind(n,78850)),Promise.resolve().then(n.bind(n,18027)),Promise.resolve().then(n.t.bind(n,93258,23)),Promise.resolve().then(n.t.bind(n,38353,23)),Promise.resolve().then(n.bind(n,61080)),Promise.resolve().then(n.t.bind(n,41402,23))},78850:(e,t,n)=>{"use strict";n.d(t,{default:()=>a});var r=n(95155),o=n(12115),s=n(20063),i=n(50625);function a(e){let{children:t}=e,[n]=(0,o.useState)(()=>new i.E);return(0,s.useServerInsertedHTML)(()=>{let e=n.getStyleElement();return n.instance.clearTag(),(0,r.jsx)(r.Fragment,{children:e})}),(0,r.jsx)(r.Fragment,{children:t})}},81664:(e,t,n)=>{"use strict";n.d(t,{DemoProvider:()=>u});var r=n(95155),o=n(12115),s=n(2691);let i="[email protected]",a="[email protected]",l=(0,o.createContext)({isDemo:!1,demoRole:null});function u(e){var t;let{children:n}=e,{user:o}=(0,s.A)(),u=null==o||null==(t=o.email)?void 0:t.toLowerCase();return(0,r.jsx)(l.Provider,{value:{isDemo:u===i||u===a,demoRole:u===a?"educator":u===i?"student":null},children:n})}},90909:(e,t,n)=>{"use strict";n.d(t,{default:()=>p});var r=n(95155),o=n(12115),s=n(50625),i=n(18027);let a=s.Ay.div.withConfig({componentId:"sc-db8c8127-0"})(["position:fixed;bottom:50px;right:50px;z-index:1000;width:56px;height:56px;@media (max-width:768px){bottom:20px;right:20px;}"]),l=s.Ay.button.withConfig({componentId:"sc-db8c8127-1"})(["width:56px;height:56px;border-radius:50%;background:",";border:2px solid ",";cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all 0.3s ease;box-shadow:",";pointer-events:auto;&:hover{transform:scale(1.05);border-color:",";box-shadow:",";}&:active{transform:scale(0.95);}svg{width:28px;height:28px;color:",";fill:",";stroke:",";transition:all 0.3s ease;}"],e=>{let{theme:t}=e;return t.colors.surfaceAlt},e=>{let{theme:t}=e;return t.colors.border},e=>{let{theme:t}=e;return t.shadows.medium},e=>{let{theme:t}=e;return t.colors.primary},e=>{let{theme:t}=e;return t.shadows.large},e=>{let{theme:t}=e;return t.colors.primary},e=>{let{theme:t}=e;return t.colors.primary},e=>{let{theme:t}=e;return t.colors.primary}),u=s.Ay.div.withConfig({componentId:"sc-db8c8127-2"})(["position:absolute;top:70px;left:50%;transform:translateX(-50%) translateY(",");background:",";color:",";padding:8px 16px;border-radius:20px;font-size:0.85rem;font-weight:600;white-space:nowrap;opacity:",";transition:all 0.3s ease;pointer-events:none;box-shadow:",";border:1px solid ",";@media (max-width:768px){display:none;}"],e=>{let{$visible:t}=e;return t?0:"-10px"},e=>{let{theme:t}=e;return t.colors.surface},e=>{let{theme:t}=e;return t.colors.text},e=>{let{$visible:t}=e;return+!!t},e=>{let{theme:t}=e;return t.shadows.medium},e=>{let{theme:t}=e;return t.colors.border}),c=()=>(0,r.jsxs)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"5",fill:"none"}),(0,r.jsx)("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),(0,r.jsx)("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),(0,r.jsx)("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),(0,r.jsx)("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),(0,r.jsx)("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),(0,r.jsx)("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),(0,r.jsx)("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),(0,r.jsx)("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}),d=()=>(0,r.jsx)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",stroke:"none",children:(0,r.jsx)("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),f=()=>(0,r.jsxs)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor"}),(0,r.jsx)("path",{d:"M 12 2 A 10 10 0 0 1 22 12 A 10 10 0 0 1 12 22 Z",fill:"currentColor",stroke:"none"})]});function p(){let{mode:e,cycleMode:t}=(0,i.e)(),[n,s]=(0,o.useState)(!1);return(0,o.useEffect)(()=>
1{if(n){let e=setTimeout(()=>s(!1),2e3);return()=>clearTimeout(e)}},[n]),(0,r.jsxs)(a,{"data-theme-toggle":"true",children:[(0,r.jsx)(u,{$visible:n,children:"light"===e?"Light Mode":"auto"===e?"Auto (7 AM - 5 PM)":"Dark Mode"}),(0,r.jsx)(l,{onClick:e=>{e.preventDefault(),e.stopPropagation(),t(),s(!0)},"aria-label":"Toggle theme","data-theme-toggle":"true",children:"light"===e?(0,r.jsx)(c,{}):"auto"===e?(0,r.jsx)(f,{}):(0,r.jsx)(d,{})})]})}},93258:()=>{}},e=>{e.O(0,[3746,625,2619,5376,8490,8027,8441,1255,7358],()=>e(e.s=71083)),_N_E=e.O()}]);

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.