@nexlylab/widget 1.32.15 → 1.32.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/INSTALL.txt +1 -1
  2. package/dist/runtime/{1.32.15/chunks/ClickToLoadEmbed-CDdotCS8-W2yBrg7b.js → 1.32.17/chunks/ClickToLoadEmbed-D9eMaBG8-r9dN9klo.js} +2 -2
  3. package/dist/runtime/{1.32.15/chunks/PanelInfoVideo-BKn3ucAb-BrU-Qlul.js → 1.32.17/chunks/PanelInfoVideo-DMU0-9Az-BrU-Qlul.js} +1 -1
  4. package/dist/runtime/{1.32.15/chunks/assistant-link-components-MZWf5ty7-C44wlQAi.js → 1.32.17/chunks/assistant-link-components-D0uKk8Hv-xEDu0ls0.js} +2 -2
  5. package/dist/runtime/{1.32.15/chunks/assistant-link-policy-DWaWTnGr-Cc-yj-a-.js → 1.32.17/chunks/assistant-link-policy-CogLpq-3-Cc-yj-a-.js} +1 -1
  6. package/dist/runtime/{1.32.15/chunks/block-rating-DH7mp-_R-CoiP5C2K.js → 1.32.17/chunks/block-rating-BgOeTm52-CoiP5C2K.js} +1 -1
  7. package/dist/runtime/{1.32.15/chunks/external-url-LRu_ntew-CJQjg_od.js → 1.32.17/chunks/external-url-ninK7gY9-CJQjg_od.js} +1 -1
  8. package/dist/runtime/{1.32.15/chunks/index-BSoCdILD-D6wzHiS0.js → 1.32.17/chunks/index-1JK_DoDz-D6wzHiS0.js} +1 -1
  9. package/dist/runtime/{1.32.15/chunks/index-DTVlG27U-DP0QKkgf.js → 1.32.17/chunks/index-B0-9mIbB-DP0QKkgf.js} +1 -1
  10. package/dist/runtime/{1.32.15/chunks/index-BD-jPdzs-ZRnEJoQe.js → 1.32.17/chunks/index-B97ASd4H-ZRnEJoQe.js} +1 -1
  11. package/dist/runtime/{1.32.15/chunks/index-Dh0aThiP-Aqz1AnQ5.js → 1.32.17/chunks/index-BDhTixUR-Aqz1AnQ5.js} +1 -1
  12. package/dist/runtime/{1.32.15/chunks/index-D72orqXX-C_0Ll4qr.js → 1.32.17/chunks/index-BJxJr5j5-C_0Ll4qr.js} +1 -1
  13. package/dist/runtime/{1.32.15/chunks/index-uM4Y0lxc-Dsa9X9U7.js → 1.32.17/chunks/index-BWMbr4oS-Dsa9X9U7.js} +1 -1
  14. package/dist/runtime/{1.32.15/chunks/index-CNJUK2bK-C0OfCXUx.js → 1.32.17/chunks/index-Ba5nbqA8-B620AdXN.js} +2 -2
  15. package/dist/runtime/{1.32.15/chunks/index-C6_8JGpJ-BqZmEVev.js → 1.32.17/chunks/index-BlGeDG8W-CoI3p0S7.js} +2 -2
  16. package/dist/runtime/{1.32.15/chunks/index-Bu9Gh6Nc-BfWdQCT7.js → 1.32.17/chunks/index-Bl_8GpS0-CahNhEcx.js} +2 -2
  17. package/dist/runtime/{1.32.15/chunks/index-Gi-3UOyp-DuzPeEIz.js → 1.32.17/chunks/index-BsUIWTU6-BQ7DWJhg.js} +2 -2
  18. package/dist/runtime/{1.32.15/chunks/index-CwbUW6dx-BLBDoJCM.js → 1.32.17/chunks/index-ByEsnceF-CSQQTbsg.js} +2 -2
  19. package/dist/runtime/{1.32.15/chunks/index-Czz6Gyh_-C3bBvEcm.js → 1.32.17/chunks/index-C5olj-Fr-C3bBvEcm.js} +1 -1
  20. package/dist/runtime/{1.32.15/chunks/index-DP_6HfDM-DAdxCQyi.js → 1.32.17/chunks/index-CHUW1nlj-DAdxCQyi.js} +1 -1
  21. package/dist/runtime/{1.32.15/chunks/index-DO0-ht8E-DUgMllqN.js → 1.32.17/chunks/index-CIFQrVkq-DUgMllqN.js} +1 -1
  22. package/dist/runtime/{1.32.15/chunks/index-Dkv5YXXW-pkywvGDF.js → 1.32.17/chunks/index-CM0iRJSw-pkywvGDF.js} +1 -1
  23. package/dist/runtime/{1.32.15/chunks/index-BylVnv7X-DBhSkJ7i.js → 1.32.17/chunks/index-CPjLHywY-DBhSkJ7i.js} +1 -1
  24. package/dist/runtime/{1.32.15/chunks/index-csHaX5dv-BpgnWlB8.js → 1.32.17/chunks/index-CSDD7Z6C-BpgnWlB8.js} +1 -1
  25. package/dist/runtime/{1.32.15/chunks/index-k-jZV_MQ-H31PHMqm.js → 1.32.17/chunks/index-C_zmepmr-H31PHMqm.js} +1 -1
  26. package/dist/runtime/{1.32.15/chunks/index-B1ef1IlE-QeFj7CR9.js → 1.32.17/chunks/index-CaHbIY6I-QeFj7CR9.js} +1 -1
  27. package/dist/runtime/{1.32.15/chunks/index-V1EfdiK7-bdo5pwX-.js → 1.32.17/chunks/index-Ce0ahORn-bdo5pwX-.js} +1 -1
  28. package/dist/runtime/{1.32.15/chunks/index-DphwDFW6-C9wFr7fa.js → 1.32.17/chunks/index-CpCgmp7C-C9wFr7fa.js} +1 -1
  29. package/dist/runtime/{1.32.15/chunks/index-DZKtK9hT-DQBGsPwB.js → 1.32.17/chunks/index-CtNAXlUH-DQBGsPwB.js} +1 -1
  30. package/dist/runtime/{1.32.15/chunks/index-1o6W5wiJ-I68tb-d3.js → 1.32.17/chunks/index-D0qsMexH-I68tb-d3.js} +1 -1
  31. package/dist/runtime/{1.32.15/chunks/index-B8aKMeg5-BLxOZxZv.js → 1.32.17/chunks/index-D30-Ox5Z-BLxOZxZv.js} +1 -1
  32. package/dist/runtime/{1.32.15/chunks/index-qpVhJY7A-Cgivx3vY.js → 1.32.17/chunks/index-D3OBLy0s-k8E4HOBM.js} +2 -2
  33. package/dist/runtime/{1.32.15/chunks/index-CMFQhtEe-BcW8HKb8.js → 1.32.17/chunks/index-D3fwWbIM-BcW8HKb8.js} +1 -1
  34. package/dist/runtime/{1.32.15/chunks/index-DPNGQF5b-_M0CWPEY.js → 1.32.17/chunks/index-D5EHdeyl-_M0CWPEY.js} +1 -1
  35. package/dist/runtime/{1.32.15/chunks/index-CqV8rHvG-DS9JaGVN.js → 1.32.17/chunks/index-D6YQ4lFv-pbKZ0WGs.js} +2 -2
  36. package/dist/runtime/{1.32.15/chunks/index-C75hX_dj-VhJcCfAC.js → 1.32.17/chunks/index-DAJM_cb9-VhJcCfAC.js} +1 -1
  37. package/dist/runtime/{1.32.15/chunks/index-CmYYEi7N-Dr1V6OGz.js → 1.32.17/chunks/index-DAai_PkG-Dr1V6OGz.js} +1 -1
  38. package/dist/runtime/{1.32.15/chunks/index-BnKOhYKk-CkemNrch.js → 1.32.17/chunks/index-DDHI4Kxr-DrVjDDba.js} +2 -2
  39. package/dist/runtime/{1.32.15/chunks/index-DDEE3QfX-3B-eE3K7.js → 1.32.17/chunks/index-DIMi29lU-3B-eE3K7.js} +1 -1
  40. package/dist/runtime/{1.32.15/chunks/index-Dt6OpItC-R_xuAEQV.js → 1.32.17/chunks/index-DMM00SC5-R_xuAEQV.js} +1 -1
  41. package/dist/runtime/{1.32.15/chunks/index-D9grn5WJ-Dp5AxBD4.js → 1.32.17/chunks/index-DnDMirl9-Dp5AxBD4.js} +1 -1
  42. package/dist/runtime/{1.32.15/chunks/index-BvlAsO4n-DbuSZfeK.js → 1.32.17/chunks/index-DsQ3ssZW-DbuSZfeK.js} +1 -1
  43. package/dist/runtime/{1.32.15/chunks/index-Chy2Zmo5-CiRb-0NX.js → 1.32.17/chunks/index-Dwtd4id8-CiRb-0NX.js} +1 -1
  44. package/dist/runtime/1.32.17/chunks/index-DzCfV77F-C1BzRUwZ.js +2 -0
  45. package/dist/runtime/{1.32.15/chunks/index-C1WD1dlq-Dm9kbc85.js → 1.32.17/chunks/index-DzHo_iNR-Dm9kbc85.js} +1 -1
  46. package/dist/runtime/{1.32.15/chunks/index-IW3aNe-y-W1lJrIDD.js → 1.32.17/chunks/index-Wza_7CGb-W1lJrIDD.js} +1 -1
  47. package/dist/runtime/{1.32.15/chunks/index-hHQjRGar-TEMHje2B.js → 1.32.17/chunks/index-_R8QyLD7-TEMHje2B.js} +1 -1
  48. package/dist/runtime/{1.32.15/chunks/index-D-ZhVFzi-A3rpkVmQ.js → 1.32.17/chunks/index-tapacGlG--YMQ21rc.js} +2 -2
  49. package/dist/runtime/{1.32.15/chunks/index-B9ozeox8-oy07dUaV.js → 1.32.17/chunks/index-zmuItIIf-oy07dUaV.js} +1 -1
  50. package/dist/runtime/1.32.17/nexly.js +61 -0
  51. package/dist/v1.js +1 -1
  52. package/package.json +1 -1
  53. package/dist/runtime/1.32.15/chunks/index-BljIlfbh-D9I6jaso.js +0 -2
  54. package/dist/runtime/1.32.15/nexly.js +0 -61
  55. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/PanelVideoOverlay-BY__oBYV-B8OPC1xh.js +0 -0
  56. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/_commonjsHelpers-C6fGbg64-BC8KDfbh.js +0 -0
  57. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/accent-legibility-BJF2VO5n-CDPQ7suO.js +0 -0
  58. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/allowed-elements-BXnLJV1S-C-_lr2zm.js +0 -0
  59. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/block-helpers-Cg_zAqG6-DnN2COvk.js +0 -0
  60. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/index-BPDIV1BN-DINkyYvc.js +0 -0
  61. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/index-BcsmWDTX-Dw9WA5Ac.js +0 -0
  62. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/index-C262wwK4-DpyhuXqd.js +0 -0
  63. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/index-DMQkz1bV-BuMYksln.js +0 -0
  64. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/index-DZADUAKv-DPfvWVuj.js +0 -0
  65. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/index.modern-CioVZ357-BA5NTOmY.js +0 -0
  66. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/inert-assistant-components-B6Cx9pG5-DWb6n3Yq.js +0 -0
  67. /package/dist/runtime/{1.32.15 → 1.32.17}/chunks/use-deferred-rating-XlgCUwcY-DDVOwURi.js +0 -0
@@ -1,2 +1,2 @@
1
- import{j as e,r as g,a as As,Q as Ts,d as Ze,t as In,b as Ls,e as Ms}from"../nexly.js";import{C as $s}from"./block-rating-DH7mp-_R-CoiP5C2K.js";import{x as Rs,c as Us,s as Zn,a as Os}from"./allowed-elements-BXnLJV1S-C-_lr2zm.js";import{r as Bs}from"./inert-assistant-components-B6Cx9pG5-DWb6n3Yq.js";import{X as Ds,F as Es}from"./ClickToLoadEmbed-CDdotCS8-W2yBrg7b.js";import{p as Ps}from"./external-url-LRu_ntew-CJQjg_od.js";import"./_commonjsHelpers-C6fGbg64-BC8KDfbh.js";import"./assistant-link-policy-DWaWTnGr-Cc-yj-a-.js";const Fs=/^[a-z0-9][a-z0-9-]*$/,Qs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Le(n){if(!n)return null;const s=n.trim();if(!s)return null;if(s.startsWith("media:")){const l=s.slice(6);return Qs.test(l)?{kind:"media",mediaId:l}:null}const a=s.startsWith("icon:")?s.slice(5):s;return Fs.test(a)?{kind:"icon",slug:a}:null}const fn="media:",bn="youtube:",Ws=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Yn(n){if(!n)return null;const s=n.trim();if(s.startsWith(fn)){const a=s.slice(fn.length);return Ws.test(a)?{kind:"image",ref:`${fn}${a}`,mediaId:a}:null}if(s.startsWith(bn)){const a=s.slice(bn.length);return Es(a)?{kind:"youtube",ref:`${bn}${a}`,id:a}:null}return null}const xl={slug:"learning",name:"Learning",version:"1.0.0",category:"interactive",requiredService:"learning",configSchema:{properties:{readAloudEnabled:{type:"boolean",default:!1},title:{type:"string",default:""},showExplanations:{type:"boolean",default:!0},showBrowse:{type:"boolean",default:!0},showDashboard:{type:"boolean",default:!0},showProgress:{type:"boolean",default:!1},showNews:{type:"boolean",default:!0}}},defaultConfig:{readAloudEnabled:!1,title:"",showExplanations:!0,showBrowse:!0,showDashboard:!0,showProgress:!1,showNews:!0},dataContract:{serviceSlug:"learning",inputSchema:{type:"object",properties:{mode:{type:"string",description:"placement_quiz | section_quiz | checking_question | new_information | nothing"},quizId:{type:"string",description:"Set for placement_quiz / section_quiz"},questionId:{type:"string",description:"Set for checking_question"},lessonId:{type:"string",description:"Set for new_information / checking_question"},topicId:{type:"string",description:"Set for new_information / section_quiz"},reason:{type:"string",description:"Set for mode=nothing: no_curriculum | all_mastered | all_in_cooldown"}},required:["mode"]},previewDataOverride:{mode:"nothing",reason:"all_in_cooldown"}},fields:[{id:"readAloudEnabled",type:"toggle",label:"Read this panel aloud",default:!1,group:"Voice"},{id:"title",type:"localized-text",label:"Heading",default:"",placeholder:'Leave empty to use the translated default ("Learning")',group:"Content"},{id:"showExplanations",type:"toggle",label:"Show explanations after answering",default:!0,group:"Behavior"},{id:"showBrowse",type:"toggle",label:"Offer the browsing sections (Topics, Dashboard, Progress)",default:!0,group:"Sections"},{id:"showDashboard",type:"toggle",label:"Show the Dashboard section (streak, progress, what to pick up)",default:!0,group:"Sections"},{id:"showProgress",type:"toggle",label:"Show the Progress section (mastery by topic, quiz history)",default:!1,group:"Sections"},{id:"showNews",type:"toggle",label:"Show the News section (published feed items, with an unread badge)",default:!0,group:"Sections"}],events:{emits:[{name:"learning:answerSubmitted",description:"Learner answered a question"},{name:"learning:quizCompleted",description:"Learner finished a quiz attempt"},{name:"learning:lessonSkipped",description:"Learner declared a lesson already known"}],listens:[{name:"learning:reload",description:"Re-fetch the current assignment"}]},sizing:{minWidth:260,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main"]},Xn=g.createContext(null),Gs=({children:n})=>e.jsx("span",{className:"es-learning__md-link",children:n}),Js=({node:n,...s})=>e.jsx("div",{className:"es-learning__md-tablewrap",children:e.jsx("table",{...s})}),Vs=({node:n,type:s,checked:a,...l})=>s==="checkbox"?e.jsx("input",{...l,type:"checkbox",checked:!!a,disabled:!0,readOnly:!0}):null,Hs=()=>null,Ks=({src:n,alt:s})=>{const a=g.useContext(Xn);if(!a)return null;const{media:l,t:r}=a,t=Yn(typeof n=="string"?n:void 0),_=t?l[t.ref]:void 0,j=(s??"").trim();return _?_.kind==="image"?e.jsx("img",{className:"es-learning__media-img",src:_.url,alt:j||r("learning.media_image_alt"),loading:"lazy",decoding:"async",referrerPolicy:"no-referrer"}):e.jsx(Ds,{embed:{provider:_.provider,id:_.id},t:r,classPrefix:"es-learning",posterUrl:_.posterUrl},`${_.provider}:${_.id}`):e.jsx("span",{className:"es-learning__media-missing",children:j||r("learning.media_unavailable")})},Zs=({node:n,children:s,...a})=>{const l=n?.children;return l!==void 0&&l.length>0&&l.every(r=>r.type==="element"&&r.tagName==="img"||r.type==="text"&&!(r.value??"").trim())&&l.some(r=>r.type==="element")?e.jsx(e.Fragment,{children:s}):e.jsx("p",{...a,children:s})},es={...Bs,a:Gs,table:Js,input:Vs},Ys={...es,img:Hs},Xs={...es,img:Ks,p:Zs},ea=[...Zn],na=[...Zn,"img"],sa=n=>Os(n)??"",aa=()=>"",la=n=>Yn(n)?n:"";function ns(n,s,a,l){return e.jsx("div",{className:"es-learning__md",children:e.jsx(Rs,{remarkPlugins:[...Us],allowedElements:s,transformLinkUri:sa,transformImageUri:a,components:l,children:n})})}function zn({children:n}){return n?.trim()?ns(n,ea,aa,Ys):null}function ss({children:n,media:s,t:a}){const l=g.useMemo(()=>({media:s??{},t:a}),[s,a]);return n?.trim()?e.jsx(Xn.Provider,{value:l,children:ns(n,na,la,Xs)}):null}function se({graphicRef:n,graphicAlt:s,graphicUrl:a,variant:l,done:r}){const t=Le(n);if(!t)return null;const _=["es-learning__graphic",l?`es-learning__graphic--${l}`:"",r?"es-learning__graphic--done":""].filter(Boolean).join(" ");if(t.kind==="media")return a?e.jsx("div",{className:`${_} es-learning__graphic--image`,children:e.jsx("img",{src:a,alt:s??"",className:"es-learning__graphic-img",loading:"lazy","data-testid":"learning-graphic-image"})}):null;const j=Ze(t.slug);return j?e.jsx("div",{className:_,role:s?"img":"presentation","aria-label":s??void 0,"data-testid":"learning-graphic-icon",children:e.jsx(j,{size:40})}):null}function as(n,s){const a=Le(n);return a?a.kind==="media"?!!s:!!Ze(a.slug):!1}function ls(n,s){return Le(n)?.kind==="media"&&!!s}function is({topicTitle:n,onBackToTopic:s,t:a}){return s?e.jsxs("button",{type:"button",className:"es-learning__eyebrow es-learning__eyebrow--back",onClick:s,"aria-label":a("learning.back_to_topic",{topic:n}),children:[e.jsx("span",{"aria-hidden":"true",children:"← "}),n]}):e.jsx("p",{className:"es-learning__eyebrow",children:n})}const Q=n=>({width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0});function ia({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"m15.5 8.5-2 5.5-5.5 2 2-5.5z"})]})}function Qn({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7.5V12l3 2"})]})}function ta({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M8 4h8v4a4 4 0 0 1-8 0z"}),e.jsx("path",{d:"M8 5H5.5a2.5 2.5 0 0 0 2.5 4M16 5h2.5a2.5 2.5 0 0 1-2.5 4"}),e.jsx("path",{d:"M12 12v4M9 20h6M10 20a2 2 0 0 1 4 0"})]})}function ra({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M4 5h16M4 12h16M4 19h16"}),e.jsx("path",{d:"M7 5v7M12 12v7",opacity:"0.45"})]})}function oa({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"}),e.jsx("path",{d:"M14 3v5h5"}),e.jsx("path",{d:"m9.5 12.5 5 5m0-5-5 5"})]})}function He({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M19 12H5m0 0 6-6m-6 6 6 6"})})}function fe({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M5 12h14m0 0-6-6m6 6-6 6"})})}function oe({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"m5 13 4 4L19 7"})})}function Te({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})}function qn({size:n=16}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6v.3"}),e.jsx("path",{d:"M12 17h.01"})]})}function Wn({size:n=14}){return e.jsxs("svg",{...Q(n),children:[e.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2"}),e.jsx("path",{d:"M8 11V8a4 4 0 0 1 8 0v3"})]})}function Cn({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"m9 6 6 6-6 6"})})}function ca({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M12 6.5C10.5 5 8.5 4.5 4 4.5v13c4.5 0 6.5.5 8 2 1.5-1.5 3.5-2 8-2v-13c-4.5 0-6.5.5-8 2Z"}),e.jsx("path",{d:"M12 6.5v13"})]})}function da({size:n=18}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M4 6h16M4 12h16M4 18h10"})})}function ua({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"m4 11 8-6 8 6"}),e.jsx("path",{d:"M6 10v9h12v-9"})]})}function ga({size:n=18}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M5 19V10M12 19V5M19 19v-6"})})}function _a({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M12 3c1 3-2 4-2 7a3 3 0 0 0 6 0c0-1.5-1-2-1-3.5 1.5 1 2.5 3 2.5 5A5.5 5.5 0 0 1 12 21a5.5 5.5 0 0 1-5-7.5C7.5 10 9 7 12 3Z"})})}function pa({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M4 5h13v14H6a2 2 0 0 1-2-2Z"}),e.jsx("path",{d:"M17 8h3v9a2 2 0 0 1-2 2h-1"}),e.jsx("path",{d:"M7 9h7"}),e.jsx("path",{d:"M7 12.5h7"}),e.jsx("path",{d:"M7 16h4"})]})}function ts({size:n=14}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M15 3h6v6"}),e.jsx("path",{d:"M10 14 21 3"}),e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function rs({lesson:n,busy:s,onDone:a,doneLabel:l,doneGoesBack:r=!1,onBackToTopic:t,rating:_,readAloud:j,readAloudRef:o,t:x}){return e.jsxs("section",{className:"es-learning__lesson","aria-label":x("learning.lesson_aria"),children:[e.jsxs("div",{className:"es-learning__lesson-readable",ref:o,children:[e.jsx(is,{topicTitle:n.topicTitle,onBackToTopic:t,t:x}),e.jsx("h4",{className:"es-learning__lesson-title",children:n.title}),e.jsx(se,{graphicRef:n.graphicRef,graphicAlt:n.graphicAlt,graphicUrl:n.graphicUrl}),e.jsx(ss,{media:n.media,t:x,children:n.body})]}),j&&e.jsx("div",{className:"es-learning__lesson-readaloud",children:j}),_,e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:a,disabled:s,children:s?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),x("learning.loading")]}):e.jsxs(e.Fragment,{children:[r&&e.jsx(He,{}),l??x("learning.lesson_done"),!r&&e.jsx(fe,{})]})})]})}const os={owl:({size:n})=>e.jsx(Ms,{size:n})};function ha(n){return typeof n=="string"&&n in os?n:"none"}function Ne({name:n,size:s=56,className:a}){const l=n==="none"?void 0:os[n];return l?e.jsx("span",{className:["es-learning__mascot",a].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(l,{size:s})}):null}function Gn({lessonTitle:n,topicTitle:s,newTopic:a=!1,graphicRef:l,graphicAlt:r,graphicUrl:t,slideCount:_,mascot:j,busy:o,onStart:x,onBackToTopic:b,t:p}){const f=!!l,m=p(a?"learning.new_topic_title":"learning.new_lesson_title");return e.jsxs("section",{className:`es-learning__intro${f?" es-learning__intro--illustrated":""}${a?" es-learning__intro--topic":""}`,"aria-label":m,children:[f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"es-learning__intro-say",children:[e.jsx(Ne,{name:j,size:30}),e.jsx("h4",{className:"es-learning__intro-title",children:m})]}),e.jsx(se,{graphicRef:l,graphicAlt:r,graphicUrl:t})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{name:j,size:64}),e.jsx("h4",{className:"es-learning__intro-title",children:m})]}),e.jsx("p",{className:"es-learning__intro-lesson",children:a?s:n}),b&&!a?e.jsxs("button",{type:"button",className:"es-learning__intro-note es-learning__intro-note--back",onClick:b,"aria-label":p("learning.back_to_topic",{topic:s}),children:[e.jsx("span",{"aria-hidden":"true",children:"← "}),s]}):e.jsx("p",{className:"es-learning__intro-note",children:a?n:s}),typeof _=="number"&&_>0&&e.jsx("p",{className:"es-learning__intro-meta",children:p("learning.slide_count",{total:_})}),e.jsx("div",{className:"es-learning__intro-foot",children:e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:x,disabled:o,children:[p(a?"learning.start_new_topic":"learning.start_lesson"),e.jsx(fe,{})]})})]})}function ma({topicTitle:n,topicComplete:s,mascot:a,busy:l,onStart:r,onSkip:t,t:_}){const j=g.useRef(null);g.useEffect(()=>{j.current?.focus({preventScroll:!0})},[]);const o=_(s?"learning.section_quiz_title_complete":"learning.section_quiz_title");return e.jsxs("section",{className:"es-learning__intro","aria-label":o,children:[e.jsx(Ne,{name:a,size:64}),e.jsx("h4",{className:"es-learning__intro-title",children:o}),e.jsx("p",{className:"es-learning__intro-lesson",children:n}),e.jsx("p",{className:"es-learning__intro-note",children:_("learning.section_quiz_note")}),e.jsxs("div",{className:"es-learning__intro-foot",children:[e.jsxs("button",{ref:j,type:"button",className:"es-learning__btn es-learning__btn--block",onClick:r,disabled:l,children:[_("learning.section_quiz_start"),e.jsx(fe,{})]}),e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block es-learning__btn--ghost",onClick:t,disabled:l,children:_("learning.section_quiz_skip")})]})]})}function wn({quiz:n,isPlacement:s,eyebrow:a,topics:l,results:r,busy:t,mascot:_,onAnswer:j,onAnswerOpen:o,onFinish:x,onBackToLesson:b,onChooseTopic:p,onContinue:f,continueLabel:m,t:w}){const q=g.useMemo(()=>n.questions??(n.question?[n.question]:[]),[n.questions,n.question]),v=!!n.questions,[I,P]=g.useState(!s||n.answered>0),[T,K]=g.useState(n.answers??{}),[u,E]=g.useState(()=>new Set(n.answeredIds??[])),[G,Z]=g.useState({}),[be,F]=g.useState({}),[L,B]=g.useState(()=>{if(!n.questions)return 0;const k=new Set(n.answeredIds??Object.keys(n.answers??{})),A=n.questions.findIndex(he=>!k.has(he.questionId));return A===-1?Math.max(0,n.questions.length-1):A});if(r)return e.jsx(ja,{results:r,questions:q,mascot:_,onContinue:f,continueLabel:m,t:w});if(!I)return e.jsxs("section",{className:"es-learning__intro","aria-label":w("learning.placement_intro_title"),children:[_!=="none"?e.jsx(Ne,{name:_,size:64}):e.jsx("span",{className:"es-learning__state-icon","aria-hidden":"true",children:e.jsx(ia,{size:32})}),e.jsx("h4",{className:"es-learning__intro-title",children:w("learning.placement_intro_title")}),e.jsx("p",{className:"es-learning__intro-body",children:w("learning.placement_intro_body",{total:n.total})}),e.jsx("p",{className:"es-learning__intro-note",children:w("learning.placement_intro_note")}),l.length>0&&p&&e.jsxs("div",{className:"es-learning__topics",children:[e.jsx("p",{className:"es-learning__hint",children:w("learning.choose_topic")}),e.jsx("div",{className:"es-learning__topic-list",children:l.map(k=>e.jsx("button",{type:"button",className:"es-learning__topic",onClick:()=>p(k.topicId),disabled:t,children:k.title},k.topicId))})]}),e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:()=>P(!0),disabled:t,children:w("learning.placement_start")})]});const J=q[L];if(!J)return e.jsx("p",{className:"es-learning__hint",children:w("learning.quiz_finished")});const _e=k=>T[k]!==void 0||u.has(k)||(G[k]??"").trim().length>0,Xe=q.filter(k=>_e(k.questionId)).length,ve=T[J.questionId],Y=J.options===null,V=L===q.length-1,ae=q.every(k=>_e(k.questionId)),we=Object.fromEntries(q.filter(k=>_e(k.questionId)).map(k=>[k.questionId,0])),U=J.questionId;function X(k){K(A=>({...A,[U]:k})),j(U,k)}async function pe(){const k=(G[U]??"").trim();return!Y||!k||!o||u.has(U)&&be[U]===k?!0:await o(U,k)?(E(A=>new Set(A).add(U)),F(A=>({...A,[U]:k})),!0):!1}async function H(){await pe()&&B(k=>Math.min(q.length-1,k+1))}async function ke(){await pe()&&x()}return e.jsxs("section",{className:"es-learning__quiz","aria-label":w("learning.quiz_aria"),children:[b&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:b,children:["← ",w("learning.back_to_lesson")]}),s&&e.jsx("p",{className:"es-learning__eyebrow",children:w("learning.placement_intro")}),e.jsx("h4",{className:"es-learning__lesson-title",children:a??n.title}),e.jsx(xa,{total:q.length,currentIndex:L,answeredIds:we,questions:q,answeredCount:Xe,onJump:v?B:void 0,t:w}),e.jsx("p",{className:"es-learning__prompt",children:J.prompt}),Y?e.jsxs("div",{className:"es-learning__open",children:[e.jsx("textarea",{className:"es-learning__textarea",value:G[U]??"",onChange:k=>Z(A=>({...A,[U]:k.target.value})),placeholder:w("learning.open_answer_placeholder"),"aria-label":w("learning.open_answer_aria"),rows:5,disabled:t}),e.jsx("p",{className:"es-learning__hint",children:w("learning.open_answer_hint")})]}):null,!Y&&e.jsx("div",{className:"es-learning__options",role:"radiogroup","aria-label":w("learning.options_aria"),children:(J.options??[]).map((k,A)=>e.jsxs("label",{className:`es-learning__option${ve===A?" es-learning__option--selected":""}`,children:[e.jsx("input",{type:"radio",name:`learning-option-${J.questionId}`,checked:ve===A,onChange:()=>X(A),disabled:t}),e.jsx("span",{className:"es-learning__option-letter",children:String.fromCharCode(65+A)}),e.jsx("span",{className:"es-learning__option-text",children:k})]},A))}),e.jsxs("footer",{className:"es-learning__actions",children:[v?e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--ghost",onClick:()=>B(k=>Math.max(0,k-1)),disabled:t||L===0,children:[e.jsx(He,{}),w("learning.previous_question")]}):e.jsx("span",{}),V?e.jsx("button",{type:"button",className:"es-learning__btn",onClick:()=>{ke()},disabled:t||!ae,children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),w("learning.checking")]}):w("learning.finish_quiz")}):e.jsx("button",{type:"button",className:"es-learning__btn",onClick:()=>{H()},disabled:t||!_e(U),children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),w("learning.checking")]}):e.jsxs(e.Fragment,{children:[w("learning.next_question"),e.jsx(fe,{})]})})]})]})}function xa({total:n,currentIndex:s,answeredIds:a,questions:l,answeredCount:r,onJump:t,t:_}){return e.jsxs("div",{className:"es-learning__progress",children:[e.jsx("div",{className:"es-learning__track",children:l.map((j,o)=>{const x=["es-learning__seg",a[j.questionId]!==void 0?"es-learning__seg--done":"",o===s?"es-learning__seg--current":""].filter(Boolean).join(" ");return t?e.jsx("button",{type:"button",className:x,onClick:()=>t(o),"aria-label":_("learning.go_to_question",{n:o+1}),"aria-current":o===s?"step":void 0},j.questionId):e.jsx("span",{className:x},j.questionId)})}),e.jsxs("span",{className:"es-learning__progress-count",children:[r,"/",n]})]})}function ja({results:n,questions:s,mascot:a,onContinue:l,continueLabel:r,t}){const _=n.total>0?Math.round(n.correct/n.total*100):0,j=(o,x)=>s.find(b=>b.questionId===o)?.prompt??x;return e.jsxs("section",{className:"es-learning__results","aria-label":t("learning.results_aria"),children:[e.jsxs("div",{className:"es-learning__score",children:[e.jsx(Ne,{name:a,size:28,className:"es-learning__mascot--score"}),e.jsxs("span",{className:"es-learning__score-value",children:[n.correct,"/",n.total]}),e.jsx("div",{className:"es-learning__score-bar",style:{"--es-learning-score":`${_}`},role:"img","aria-label":t("learning.quiz_result",{correct:n.correct,total:n.total})})]}),typeof n.passed=="boolean"&&typeof n.passPercent=="number"&&e.jsx("p",{className:`es-learning__pass es-learning__pass--${n.passed?"yes":"no"}`,children:t(n.passed?"learning.section_quiz_passed":"learning.section_quiz_failed",{percent:n.passPercent})}),n.rows&&n.rows.length>0&&e.jsx("ol",{className:"es-learning__review",children:n.rows.map(o=>e.jsxs("li",{className:`es-learning__review-row es-learning__review-row--${o.verdict}`,children:[e.jsx("span",{className:"es-learning__review-mark","aria-hidden":"true",children:o.verdict==="correct"?e.jsx(oe,{}):o.verdict==="wrong"?e.jsx(Te,{}):e.jsx(qn,{})}),e.jsxs("div",{className:"es-learning__review-body",children:[e.jsx("p",{className:"es-learning__review-prompt",children:j(o.questionId,o.prompt)}),(()=>{const x=o.answerText??(o.selectedOptionIndex!==null?o.options?.[o.selectedOptionIndex]??null:null);return x?e.jsx("p",{className:"es-learning__review-answer",children:t("learning.your_answer",{answer:x})}):null})(),o.feedback&&e.jsx("p",{className:"es-learning__review-feedback",children:o.feedback}),o.verdict!=="correct"&&o.correctAnswer&&e.jsx("p",{className:"es-learning__review-correct",children:t("learning.correct_answer",{answer:o.correctAnswer})}),o.explanation&&e.jsx(zn,{children:o.explanation})]})]},o.questionId))}),l&&e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:l,children:[r??t("learning.continue"),e.jsx(fe,{})]})]})}function fa({prompt:n,lessonTitle:s,answer:a,feedback:l,busy:r,showExplanations:t,onChange:_,onSubmit:j,t:o}){return e.jsxs("section",{className:"es-learning__question","aria-label":o("learning.question_aria"),children:[e.jsx("p",{className:"es-learning__eyebrow",children:s}),e.jsx("p",{className:"es-learning__prompt",children:n}),l?e.jsx(ba,{feedback:l,showExplanations:t,t:o}):e.jsxs(e.Fragment,{children:[e.jsx("textarea",{className:"es-learning__textarea",rows:5,value:a,onChange:x=>_(x.target.value),placeholder:o("learning.open_answer_placeholder"),"aria-label":o("learning.open_answer_aria"),disabled:r}),e.jsx("footer",{className:"es-learning__actions es-learning__actions--end",children:e.jsx("button",{type:"button",className:"es-learning__btn",onClick:j,disabled:r||!a.trim(),children:o(r?"learning.checking":"learning.submit_answer")})})]})]})}function ba({feedback:n,showExplanations:s,t:a}){const l=n.verdict==="correct"?e.jsx(oe,{size:18}):n.verdict==="wrong"?e.jsx(Te,{size:18}):e.jsx(qn,{size:18}),r=n.verdict==="correct"?a("learning.verdict_correct"):n.verdict==="wrong"?a("learning.verdict_wrong"):a("learning.verdict_ungradeable");return e.jsxs("div",{className:`es-learning__feedback es-learning__feedback--${n.verdict}`,role:"status",children:[e.jsxs("p",{className:"es-learning__verdict",children:[e.jsx("span",{className:"es-learning__verdict-icon","aria-hidden":"true",children:l}),r]}),n.feedback&&e.jsx("p",{className:"es-learning__feedback-text",children:n.feedback}),s&&n.explanation&&e.jsx(zn,{children:n.explanation})]})}const wa={all_in_cooldown:e.jsx(Qn,{}),not_due_yet:e.jsx(Qn,{}),all_mastered:e.jsx(ta,{}),no_curriculum:e.jsx(ra,{}),unavailable:e.jsx(oa,{})},Na={all_in_cooldown:{title:"learning.empty_cooldown_title",body:"learning.empty_cooldown"},not_due_yet:{title:"learning.next_lesson_title",body:"learning.next_lesson_body"},all_mastered:{title:"learning.empty_all_mastered_title",body:"learning.empty_all_mastered"},no_curriculum:{title:"learning.empty_no_curriculum_title",body:"learning.empty_no_curriculum"},unavailable:{title:"learning.unavailable_title",body:"learning.unavailable"}},va=new Set(["all_in_cooldown","all_mastered","not_due_yet"]);function ka(n){const[s,a]=g.useState(()=>Date.now());if(g.useEffect(()=>{if(!n)return;const t=setInterval(()=>a(Date.now()),6e4);return()=>clearInterval(t)},[n]),!n)return null;const l=new Date(n).getTime();if(!Number.isFinite(l))return null;const r=Math.max(0,Math.ceil((l-s)/6e4));return{hours:Math.floor(r/60),minutes:r%60}}function kn({kind:n,mascot:s,nextDueAt:a,t:l}){const{title:r,body:t}=Na[n],_=s!=="none"&&va.has(n),j=ka(n==="not_due_yet"?a:void 0);return e.jsxs("div",{className:`es-learning__state es-learning__state--${n}`,role:"status",children:[_?e.jsx(Ne,{name:s}):e.jsx("span",{className:"es-learning__state-icon","aria-hidden":"true",children:wa[n]}),e.jsx("p",{className:"es-learning__state-title",children:l(r)}),e.jsx("p",{className:"es-learning__state-body",children:l(t)}),j&&e.jsx("p",{className:"es-learning__countdown",children:j.hours>0?l("learning.next_lesson_in_hm",{hours:j.hours,minutes:j.minutes}):l("learning.next_lesson_in_m",{minutes:j.minutes})})]})}function cs({lesson:n,index:s,onIndexChange:a,answers:l,onAnswer:r,busy:t,onDone:_,doneLabel:j,doneGoesBack:o=!1,onBackToTopic:x,rating:b,readAloud:p,readAloudRef:f,t:m}){const w=n.slides??[],q=w.length,v=w[s];if(!v)return null;const I=v.check??null,P=l[v.id],T=!I||P!==void 0,K=s===q-1;return e.jsxs("section",{className:"es-learning__lesson","aria-label":m("learning.lesson_aria"),children:[e.jsx(is,{topicTitle:n.topicTitle,onBackToTopic:x,t:m}),e.jsx("div",{className:"es-learning__slide-dots","aria-hidden":"true",children:w.map((u,E)=>e.jsx("span",{className:`es-learning__slide-dot${E<=s?" es-learning__slide-dot--on":""}`},u.id))}),e.jsx(se,{graphicRef:v.graphicRef??n.graphicRef,graphicAlt:v.graphicAlt??n.graphicAlt,graphicUrl:v.graphicUrl??n.graphicUrl}),e.jsxs("div",{className:"es-learning__lesson-readable",ref:f,children:[e.jsx("h4",{className:"es-learning__lesson-title",style:{fontSize:16},children:v.title}),e.jsx(ss,{media:n.media,t:m,children:v.body})]}),p&&e.jsx("div",{className:"es-learning__lesson-readaloud",children:p}),I&&e.jsxs("div",{className:`es-learning__slide-check${T?P===I.correctIndex?" es-learning__slide-check--good":" es-learning__slide-check--bad":""}`,children:[e.jsx("p",{className:"es-learning__slide-check-prompt",children:I.prompt}),e.jsx("div",{className:"es-learning__slide-check-options",children:I.options.map((u,E)=>{const G=P===E,Z=E===I.correctIndex,be=["es-learning__slide-choice",T&&G&&Z?"es-learning__slide-choice--good":"",T&&G&&!Z?"es-learning__slide-choice--bad":"",T&&Z&&!G?"es-learning__slide-choice--reveal":""].filter(Boolean).join(" ");return e.jsxs("button",{type:"button",className:be,disabled:T||t,onClick:()=>r(v.id,E),children:[T&&G&&e.jsx("span",{className:"es-learning__slide-choice-icon","aria-hidden":"true",children:Z?e.jsx(oe,{size:14}):e.jsx(Te,{size:14})}),e.jsx("span",{children:u})]},E)})}),T&&e.jsx("p",{className:`es-learning__slide-check-fb${P===I.correctIndex?" es-learning__slide-check-fb--good":" es-learning__slide-check-fb--bad"}`,children:P===I.correctIndex?I.feedbackCorrect:I.feedbackIncorrect})]}),e.jsxs("div",{className:"es-learning__deck-foot",children:[K&&T&&b,!T&&e.jsx("p",{className:"es-learning__hint",children:m("learning.slide_check_required")}),e.jsxs("footer",{className:"es-learning__actions es-learning__actions--captioned",children:[e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--ghost",onClick:()=>a(s-1),disabled:t||s===0,children:[e.jsx(He,{}),m("learning.previous_question")]}),e.jsx("p",{className:"es-learning__slide-caption",children:m("learning.slide_caption",{n:s+1,total:q})}),K?e.jsx("button",{type:"button",className:"es-learning__btn",onClick:_,disabled:t||!T,children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),m("learning.loading")]}):e.jsxs(e.Fragment,{children:[o&&e.jsx(He,{}),j??m("learning.lesson_done"),!o&&e.jsx(fe,{})]})}):e.jsxs("button",{type:"button",className:"es-learning__btn",onClick:()=>a(s+1),disabled:t||!T,children:[m("learning.next_question"),e.jsx(fe,{})]})]})]})]})}function ya({rows:n,t:s}){const[a,l]=g.useState(!1);if(n.length===0)return e.jsx("p",{className:"es-learning__hint",children:s("learning.review_unavailable")});const r=n.filter(t=>t.verdict==="correct").length;return e.jsxs("div",{className:"es-learning__review-block",children:[e.jsxs("button",{type:"button",className:`es-learning__review-toggle${a?" es-learning__review-toggle--open":""}`,"aria-expanded":a,onClick:()=>l(t=>!t),children:[e.jsx("span",{className:"es-learning__review-heading",children:s("learning.your_answers")}),e.jsx("span",{className:"es-learning__review-score",children:s("learning.review_score",{correct:r,total:n.length})}),e.jsx("span",{className:"es-learning__review-chevron","aria-hidden":"true",children:e.jsx(Cn,{size:14})})]}),a?e.jsx("ol",{className:"es-learning__review",children:n.map(t=>{const _=t.answerText??(t.selectedOptionIndex!==null?t.options?.[t.selectedOptionIndex]??null:null);return e.jsxs("li",{className:`es-learning__review-row es-learning__review-row--${t.verdict}`,children:[e.jsx("span",{className:"es-learning__review-mark","aria-hidden":"true",children:t.verdict==="correct"?e.jsx(oe,{}):t.verdict==="wrong"?e.jsx(Te,{}):e.jsx(qn,{})}),e.jsxs("div",{className:"es-learning__review-body",children:[e.jsx("p",{className:"es-learning__review-prompt",children:t.prompt}),t.options&&t.options.length>0?e.jsx("ul",{className:"es-learning__review-options",children:t.options.map((j,o)=>{const x=o===t.selectedOptionIndex,b=t.correctAnswer!==null&&j===t.correctAnswer;return e.jsxs("li",{className:`es-learning__review-option es-learning__review-option--${b?"correct":x?"picked":"plain"}`,children:[e.jsx("span",{className:"es-learning__review-option-mark","aria-hidden":"true",children:b?e.jsx(oe,{size:12}):x?e.jsx(Te,{size:12}):null}),e.jsx("span",{className:"es-learning__review-option-text",children:j}),(x||b)&&e.jsx("span",{className:"es-learning__review-option-tag",children:s(x?"learning.answer_tag_yours":"learning.answer_tag_correct")})]},o)})}):e.jsxs("div",{className:"es-learning__review-pair",children:[_&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__review-pair-label",children:s("learning.answer_tag_yours")}),e.jsx("span",{className:"es-learning__review-pair-value es-learning__review-pair-value--yours",children:_})]}),t.verdict!=="correct"&&t.correctAnswer&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__review-pair-label",children:s("learning.answer_tag_correct")}),e.jsx("span",{className:"es-learning__review-pair-value es-learning__review-pair-value--correct",children:t.correctAnswer})]})]}),t.feedback&&e.jsx("p",{className:"es-learning__review-feedback",children:t.feedback}),t.explanation&&e.jsx(zn,{children:t.explanation})]})]},t.questionId)})}):null]})}function Jn({lesson:n,slideIndex:s,onSlideIndexChange:a,slideAnswers:l,onSlideAnswer:r,onBack:t,backLabel:_,showBackLink:j=!0,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,onFinish:f,finishLabel:m,review:w,t:q}){const v=(n.slides?.length??0)>0,I=f??t,P=f?m??_:_,T=!!o&&!f;return e.jsxs("div",{className:`es-learning__reader${w?" es-learning__reader--reviewed":""}`,children:[j&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:t,children:["← ",_]}),v?e.jsx(cs,{lesson:n,index:s,onIndexChange:a,answers:l,onAnswer:r,busy:!1,onDone:I,doneLabel:P,doneGoesBack:T,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,t:q}):e.jsx(rs,{lesson:n,busy:!1,onDone:I,doneLabel:P,doneGoesBack:T,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,t:q}),w&&e.jsx(ya,{rows:w,t:q})]})}function Ia({graphicRef:n,graphicUrl:s,graphicAlt:a,done:l}){const r=Le(n);if(!r)return null;const t=l?" es-learning__lesson-thumb--done":"";if(r.kind==="media")return s?e.jsx("img",{src:s,alt:a??"",loading:"lazy",className:`es-learning__lesson-thumb es-learning__lesson-thumb--image${t}`,"data-testid":"lesson-thumb-image"}):null;const _=Ze(r.slug);return _?e.jsx("span",{className:`es-learning__lesson-thumb${t}`,"aria-hidden":"true","data-testid":"lesson-thumb-icon",children:e.jsx(_,{size:20})}):null}function Sn({iconRef:n,iconUrl:s}){const a=Le(n);if(!a)return null;if(a.kind==="media")return s?e.jsx("img",{src:s,alt:"","aria-hidden":"true",loading:"lazy",className:"es-learning__topic-icon es-learning__topic-icon--image","data-testid":"topic-icon-image"}):null;const l=Ze(a.slug);return l?e.jsx("span",{className:"es-learning__topic-icon","aria-hidden":"true","data-testid":"topic-icon",children:e.jsx(l,{size:16})}):null}function ds({topics:n,onOpen:s,t:a}){return n.length===0?e.jsx("p",{className:"es-learning__hint",children:a("learning.empty_no_curriculum")}):e.jsx("section",{className:"es-learning__topics-view","aria-label":a("learning.nav_topics"),children:e.jsx("ul",{className:"es-learning__topic-cards",children:n.map(l=>{const r=l.lessonCount>0?Math.round(l.doneCount/l.lessonCount*100):0,t=l.doneCount===l.lessonCount&&l.lessonCount>0,_=as(l.heroRef,l.heroUrl);return e.jsx("li",{children:e.jsxs("button",{type:"button",className:"es-learning__topic-card",onClick:()=>s(l.topicId),children:[e.jsx(se,{graphicRef:l.heroRef,graphicAlt:l.heroAlt,graphicUrl:l.heroUrl,done:t}),e.jsxs("span",{className:"es-learning__topic-card-head",children:[!_&&e.jsx(Sn,{iconRef:l.iconRef,iconUrl:l.iconUrl}),e.jsx("span",{className:"es-learning__topic-card-title",children:l.title}),t&&e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})})]}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${r}%`}})}),e.jsx("span",{className:"es-learning__topic-card-meta",children:a("learning.topic_progress",{mastered:l.doneCount,total:l.lessonCount})})]})},l.topicId)})})})}const Ve=["basics","intermediate","advanced","expert"],za={basics:"learning.level_basics",intermediate:"learning.level_intermediate",advanced:"learning.level_advanced",expert:"learning.level_expert"};function qa({level:n,t:s}){const a=Ve.indexOf(n)+1,l=Ve.length;return e.jsx("span",{className:"es-learning__level-stars",role:"img","aria-label":s("learning.level_difficulty",{n:a,total:l}),"data-testid":"learning-level-stars",children:Ve.map((r,t)=>e.jsx("span",{"aria-hidden":"true",className:`es-learning__level-star${t<a?" es-learning__level-star--on":""}`,children:"★"},t))})}const Ke=n=>n.lessonCount>0&&n.doneCount===n.lessonCount;function Ca({tracks:n,untracked:s=[],currentTrackId:a,onOpenTrack:l,onOpenUntracked:r,t}){const _=n.filter(o=>o.topicCount>0);if(_.length===0&&s.length===0)return e.jsx("p",{className:"es-learning__hint",children:t("learning.empty_no_curriculum")});const j=s.filter(Ke).length;return e.jsxs("section",{className:"es-learning__tracks-view","aria-label":t("learning.tracks_heading"),children:[e.jsx("div",{className:"es-learning__infobar es-learning__infobar--intro",children:e.jsxs("p",{className:"es-learning__infobar-text",children:[t("learning.tracks_intro"),_.length>1&&e.jsxs(e.Fragment,{children:[" ",e.jsx("strong",{children:t("learning.track_independent_hint")})]})]})}),e.jsxs("ul",{className:"es-learning__tracks",children:[_.map(o=>{const x=o.topicCount>0?Math.round(o.doneTopicCount/o.topicCount*100):0,b=as(o.heroRef,o.heroUrl),p=o.topicCount>0&&o.doneTopicCount===o.topicCount;return e.jsx("li",{children:e.jsxs("button",{type:"button",className:`es-learning__track-card${o.trackId===a?" es-learning__track-card--current":""}`,onClick:()=>l(o.trackId),children:[e.jsx(se,{graphicRef:o.heroRef,graphicAlt:o.heroAlt,graphicUrl:o.heroUrl,done:p}),e.jsxs("span",{className:"es-learning__track-card-head",children:[!b&&e.jsx("span",{className:"es-learning__track-icon",children:e.jsx(Sn,{iconRef:o.iconRef,iconUrl:o.iconUrl})}),e.jsx("span",{className:"es-learning__track-card-title",children:o.title}),p&&e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})})]}),o.description&&e.jsx("span",{className:"es-learning__track-card-desc",children:o.description}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${x}%`}})}),e.jsx("span",{className:"es-learning__track-card-meta",children:t("learning.track_progress",{done:o.doneTopicCount,total:o.topicCount})})]})},o.trackId)}),s.length>0&&e.jsx("li",{children:e.jsxs("button",{type:"button",className:"es-learning__track-card",onClick:()=>r?.(),children:[e.jsx("span",{className:"es-learning__track-card-head",children:e.jsx("span",{className:"es-learning__track-card-title",children:t("learning.track_unassigned")})}),e.jsx("span",{className:"es-learning__track-card-meta",children:t("learning.track_progress",{done:j,total:s.length})})]})})]})]})}function Sa({track:n,currentTopicId:s,onOpenTopic:a,onBack:l,t:r}){const t=new Set(n.topics.filter(Ke).map(b=>b.topicId)),_=n.topics.find(b=>b.topicId===s),j=_?.unlocks??[],o=Ve.map(b=>({level:b,topics:n.topics.filter(p=>(p.level??"basics")===b)})).filter(b=>b.topics.length>0),x=n.topicCount>0?Math.round(n.doneTopicCount/n.topicCount*100):0;return e.jsxs("section",{className:"es-learning__roadmap-view","aria-label":n.title,children:[e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:l,children:["← ",r("learning.tracks_heading")]}),e.jsxs("div",{className:"es-learning__detail-head",children:[e.jsx("h4",{className:"es-learning__detail-title",children:n.title}),e.jsxs("div",{className:"es-learning__progress-line",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${x}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:r("learning.track_progress",{done:n.doneTopicCount,total:n.topicCount})})]})]}),_&&j.length>0&&e.jsxs("div",{className:"es-learning__unlocks",children:[e.jsx("span",{className:"es-learning__unlocks-lead",children:r("learning.unlocks_lead",{topic:_.title})}),e.jsx("ul",{className:"es-learning__unlocks-list",children:j.map(b=>e.jsx("li",{children:b.title},b.topicId))})]}),e.jsx("div",{className:"es-learning__infobar es-learning__infobar--order",children:e.jsxs("p",{className:"es-learning__infobar-text",children:[e.jsx("strong",{children:r("learning.roadmap_heading")})," — ",r("learning.roadmap_why")]})}),e.jsx("ul",{className:"es-learning__levels",children:o.map(b=>e.jsxs("li",{children:[e.jsxs("span",{className:"es-learning__level-head",children:[e.jsx("span",{className:"es-learning__level-name",children:r(za[b.level])}),e.jsx("span",{className:"es-learning__level-rule","aria-hidden":"true"}),e.jsx(qa,{level:b.level,t:r})]}),e.jsx("ul",{className:"es-learning__level-topics",children:b.topics.map(p=>{const f=p.prerequisites??[],m=f.some(I=>!t.has(I.topicId)),w=ls(p.heroRef,p.heroUrl),q=Ke(p),v=["es-learning__road-row",w?"es-learning__road-row--card":"",m?"es-learning__road-row--ahead":"",p.topicId===s?"es-learning__road-row--current":""].filter(Boolean).join(" ");return e.jsx("li",{children:e.jsxs("button",{type:"button",className:v,onClick:()=>a(p.topicId),children:[w?e.jsx(se,{graphicRef:p.heroRef,graphicAlt:p.heroAlt,graphicUrl:p.heroUrl,variant:"card",done:q}):e.jsx(Sn,{iconRef:p.iconRef,iconUrl:p.iconUrl}),e.jsxs("span",{className:"es-learning__road-body",children:[e.jsx("span",{className:"es-learning__road-title",children:p.title}),f.length>0&&e.jsx("span",{className:"es-learning__road-needs",children:r("learning.topic_after",{names:f.map(I=>I.title).join(", ")})}),e.jsx("span",{className:"es-learning__track-card-meta",children:r("learning.topic_progress",{mastered:p.doneCount,total:p.lessonCount})})]}),q?e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})}):e.jsx("span",{className:"es-learning__lesson-open","aria-hidden":"true",children:e.jsx(Cn,{size:14})})]})},p.topicId)})})]},b.level))})]})}const Aa={mastered:"learning.state_mastered",done:"learning.state_done",gap:"learning.state_in_progress",current:"learning.state_current",unseen:"learning.state_locked"},Ta=n=>n==="mastered"||n==="done",La="learning.state_available";function Ma({topic:n,onOpenLesson:s,onStartSectionQuiz:a,canPickAnyLesson:l=!1,backLabel:r,onBack:t,t:_}){const j=n.lessonCount>0?Math.round(n.doneCount/n.lessonCount*100):0;return e.jsxs("section",{className:"es-learning__topic-detail","aria-label":n.title,children:[r&&t&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:t,"aria-label":_("learning.back_to_track",{track:r}),children:["← ",r]}),e.jsxs("div",{className:"es-learning__detail-head",children:[!(r&&t)&&e.jsx("p",{className:"es-learning__eyebrow",children:_("learning.nav_topics")}),e.jsx("h4",{className:"es-learning__detail-title",children:n.title}),e.jsx(se,{graphicRef:n.heroRef,graphicAlt:n.heroAlt,graphicUrl:n.heroUrl,variant:"hero",done:Ke(n)}),e.jsxs("div",{className:"es-learning__progress-block",children:[e.jsx("span",{className:"es-learning__sec-label",children:_("learning.topic_lessons_done")}),e.jsxs("div",{className:"es-learning__progress-line",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${j}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:_("learning.progress_count",{done:n.doneCount,total:n.lessonCount})})]})]})]}),n.hasSectionQuiz===!0&&a&&e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block es-learning__btn--ghost es-learning__section-cta",onClick:a,children:_("learning.section_quiz_cta")}),e.jsxs("div",{className:"es-learning__list-block",children:[e.jsx("p",{className:"es-learning__list-divider",children:e.jsx("span",{className:"es-learning__sec-label",children:_("learning.topic_lesson_list")})}),e.jsx("ol",{className:"es-learning__lesson-list",children:n.lessons.map(o=>{const x=l||o.servedAt!==null||o.state==="mastered"||o.state==="done"||o.state==="current",b=x?"button":"div",p=ls(o.graphicRef,o.graphicUrl),f=x&&o.state==="unseen"?"available":o.state,m=_(x&&o.state==="unseen"?La:Aa[o.state]),w=o.servedAt===null&&o.state==="mastered",q=Ta(o.state);return p?e.jsx("li",{children:e.jsxs(b,{...x?{type:"button",onClick:()=>s(o)}:{},className:`es-learning__lesson-card es-learning__lesson-card--${o.state}${x?"":" es-learning__lesson-card--locked"}`,"aria-disabled":x?void 0:!0,children:[e.jsx(se,{graphicRef:o.graphicRef,graphicUrl:o.graphicUrl,graphicAlt:o.graphicAlt,variant:"card",done:q}),e.jsx("span",{className:"es-learning__lesson-card-title",children:o.title}),(o.isMilestone||w)&&e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[o.isMilestone&&_("learning.milestone"),w&&`${o.isMilestone?" · ":""}${_("learning.not_delivered")}`]}),e.jsxs("span",{className:"es-learning__lesson-card-foot",children:[e.jsx("span",{className:`es-learning__lesson-chip es-learning__lesson-chip--${f}`,children:m}),!x&&e.jsx("span",{className:"es-learning__lesson-lock","aria-hidden":"true",children:e.jsx(Wn,{})})]})]})},o.lessonId):e.jsx("li",{children:e.jsxs(b,{...x?{type:"button",onClick:()=>s(o)}:{},className:`es-learning__lesson-row es-learning__lesson-row--${o.state}${x?"":" es-learning__lesson-row--locked"}`,"aria-disabled":x?void 0:!0,children:[e.jsx(Ia,{graphicRef:o.graphicRef,graphicUrl:o.graphicUrl,graphicAlt:o.graphicAlt,done:q}),e.jsxs("span",{className:"es-learning__lesson-row-body",children:[e.jsx("span",{className:"es-learning__lesson-row-title",children:o.title}),e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[o.isMilestone?_("learning.milestone"):n.title,w&&` · ${_("learning.not_delivered")}`]}),e.jsx("span",{className:`es-learning__lesson-chip es-learning__lesson-chip--${f}`,children:m})]}),x?e.jsx("span",{className:"es-learning__lesson-open","aria-hidden":"true",children:e.jsx(Cn,{size:14})}):e.jsx("span",{className:"es-learning__lesson-lock","aria-hidden":"true",children:e.jsx(Wn,{})})]})},o.lessonId)})})]})]})}function $a({view:n,browse:s,mascot:a,slidePositions:l,newsTile:r,onGoToday:t,onOpenLesson:_,onOpenTopic:j,t:o}){const x=s?.summary?.doneLessons??0,b=s?.summary?.totalLessons??0,p=b>0?Math.round(x/b*100):0,f=s?.streak??{currentStreak:0,longestStreak:0},m=(s?.topics??[]).flatMap(v=>(v.lessons??[]).map(I=>({topic:v,lesson:I}))).filter(({lesson:v})=>v.servedAt!==null&&!v.done).sort((v,I)=>(I.lesson.servedAt??"").localeCompare(v.lesson.servedAt??"")).slice(0,3),w=s?.summary?.attempts?.[0]??null,q=s?.topics??[];return e.jsxs("section",{className:"es-learning__dashboard","aria-label":o("learning.nav_dashboard"),children:[e.jsx(Oa,{view:n,mascot:a,onGoToday:t,t:o}),s&&e.jsxs("div",{className:"es-learning__stats-deck",children:[e.jsxs("div",{className:"es-learning__stats-cell es-learning__stats-cell--ring",children:[e.jsxs("div",{className:"es-learning__ring",role:"img","aria-label":o("learning.dashboard_mastered_label",{pct:p}),style:{"--es-learning-ring":`${p}`},children:[e.jsx("span",{className:"es-learning__ring-value",children:p}),e.jsx("span",{className:"es-learning__ring-unit",children:"%"})]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_mastered")})]}),e.jsx("span",{className:"es-learning__stats-divider","aria-hidden":"true"}),e.jsxs("div",{className:"es-learning__stats-cell",children:[e.jsxs("span",{className:"es-learning__stats-n",children:[x,"/",b]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_lessons_done")})]}),e.jsx("span",{className:"es-learning__stats-divider","aria-hidden":"true"}),e.jsxs("div",{className:"es-learning__stats-cell es-learning__stats-cell--streak",children:[e.jsxs("span",{className:"es-learning__stats-n",children:[e.jsx(_a,{size:15}),f.currentStreak]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_streak")}),f.longestStreak>f.currentStreak&&e.jsx("span",{className:"es-learning__stats-sub",children:o("learning.dashboard_best_streak",{n:f.longestStreak})})]})]}),m.length>0&&_&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.dashboard_inprogress_title")}),m.map(({topic:v,lesson:I})=>e.jsx(Ua,{topicTitle:v.title,lesson:I,position:l?.[I.lessonId],onOpen:()=>_(v.topicId,I),t:o},I.lessonId))]}),r,w&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.dashboard_last_quiz")}),e.jsx("ul",{className:"es-learning__attempt-list",children:e.jsxs("li",{className:"es-learning__attempt",children:[e.jsx("span",{className:"es-learning__attempt-title",children:w.title}),e.jsx(Ra,{correct:w.correct,total:w.total,t:o})]})})]}),j&&q.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.nav_topics")}),e.jsx(ds,{topics:q,onOpen:j,t:o})]})]})}function Ra({correct:n,total:s,t:a}){return s<=0?e.jsx("span",{className:"es-learning__attempt-score",children:a("learning.review_score",{correct:n,total:s})}):e.jsx("span",{className:"es-learning__attempt-segs",role:"img","aria-label":a("learning.attempt_score_a11y",{correct:n,total:s}),"data-testid":"learning-attempt-segments",children:Array.from({length:s},(l,r)=>e.jsx("span",{"aria-hidden":"true",className:`es-learning__attempt-seg es-learning__attempt-seg--${r<n?"good":"bad"}`},r))})}function Ua({topicTitle:n,lesson:s,position:a,onOpen:l,t:r}){const t=!!a&&a.total>0,_=a&&t?Math.round((a.index+1)/a.total*100):0;return e.jsxs("button",{type:"button",className:"es-learning__continue",onClick:l,children:[e.jsxs("span",{className:"es-learning__continue-row",children:[e.jsx(se,{graphicRef:s.graphicRef,graphicUrl:s.graphicUrl,graphicAlt:s.graphicAlt,variant:"continue"}),e.jsxs("span",{className:"es-learning__continue-body",children:[e.jsx("span",{className:"es-learning__continue-title",children:s.title}),e.jsx("span",{className:"es-learning__lesson-row-meta",children:n})]})]}),a&&t&&e.jsxs("span",{className:"es-learning__continue-bar",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${_}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:r("learning.slide_caption",{n:a.index+1,total:a.total})})]})]})}function Oa({view:n,mascot:s,onGoToday:a,t:l}){if(!n)return null;if(n.mode==="new_information"){const r=n.lesson.slides?.length??0;return e.jsxs("button",{type:"button",className:"es-learning__today-card es-learning__today-card--hero",onClick:a,children:[e.jsx(se,{graphicRef:n.lesson.graphicRef,graphicUrl:n.lesson.graphicUrl,graphicAlt:n.lesson.graphicAlt,variant:"today"}),e.jsxs("span",{className:"es-learning__today-inner",children:[e.jsx("span",{className:"es-learning__eyebrow",children:l("learning.dashboard_today_eyebrow")}),e.jsx("strong",{className:"es-learning__today-card-title",children:n.lesson.title}),e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[n.lesson.topicTitle,r>0&&` · ${l("learning.slide_count",{total:r})}`]})]})]})}if(n.mode==="checking_question"||n.mode==="lesson_quiz"||n.mode==="section_quiz"||n.mode==="placement_quiz"){const r=n.mode==="checking_question"?null:n.quiz;return e.jsxs("button",{type:"button",className:"es-learning__today-card es-learning__today-card--gold",onClick:a,children:[e.jsx("span",{className:"es-learning__eyebrow",children:l("learning.dashboard_today_eyebrow")}),e.jsx("strong",{className:"es-learning__today-card-title",children:l("learning.dashboard_continue")}),r&&e.jsx("span",{className:"es-learning__lesson-row-meta",children:l("learning.quiz_progress",{answered:r.answered,total:r.total})})]})}return n.mode==="nothing"?e.jsx("div",{className:"es-learning__today-card",children:e.jsx(kn,{kind:n.reason,mascot:s,nextDueAt:n.nextDueAt,t:l})}):null}function Ba({browse:n,t:s}){const{topics:a,summary:l}=n;return e.jsxs("section",{className:"es-learning__progress-view","aria-label":s("learning.nav_progress"),children:[e.jsxs("div",{children:[e.jsx("p",{className:"es-learning__sec-label",children:s("learning.progress_topics_title")}),e.jsx("p",{className:"es-learning__hint",children:s("learning.progress_overall",{mastered:l.doneLessons,total:l.totalLessons})})]}),e.jsx("ul",{className:"es-learning__by-topic",children:a.map(r=>{const t=r.lessonCount>0?Math.round(r.doneCount/r.lessonCount*100):0;return e.jsxs("li",{className:"es-learning__by-topic-row",children:[e.jsx("span",{className:"es-learning__by-topic-title",children:r.title}),e.jsxs("span",{className:"es-learning__by-topic-count",children:[r.doneCount,"/",r.lessonCount]}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${t}%`}})})]},r.topicId)})}),l.attempts.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"es-learning__sec-label",children:s("learning.quiz_history")}),e.jsx("ul",{className:"es-learning__attempt-list",children:l.attempts.map(r=>e.jsxs("li",{className:"es-learning__attempt",children:[e.jsx("span",{className:"es-learning__attempt-title",children:r.title}),e.jsxs("span",{className:"es-learning__attempt-score",children:[r.correct,"/",r.total]})]},r.attemptId??r.quizId))})]})]})}const Da="es-learning-place",Ea=10080*60*1e3;function us(n){return`${Da}:${n}`}function Vn(n,s){return!n||typeof n!="object"?{}:Object.fromEntries(Object.entries(n).filter(a=>typeof a[1]=="number"&&Number.isFinite(a[1])&&a[1]>=s))}const Pa=n=>n==="dashboard"||n==="today"||n==="topics"||n==="news"||n==="progress";function Fa(n,s){try{const a=localStorage.getItem(us(n));if(!a)return null;const l=JSON.parse(a);return!Pa(l.tab)||(l.ownerId??null)!==s||typeof l.savedAt!="number"||Date.now()-l.savedAt>Ea?null:{tab:l.tab,openTopicId:typeof l.openTopicId=="string"?l.openTopicId:null,readingLessonId:typeof l.readingLessonId=="string"?l.readingLessonId:null,slideIndex:Vn(l.slideIndex,0),slideTotals:Vn(l.slideTotals,1)}}catch{return null}}function Qa(n,s,a){try{const l={...a,ownerId:s,savedAt:Date.now()};localStorage.setItem(us(n),JSON.stringify(l))}catch{}}const Wa=".es-widget__content, .gaio-theme__content";function Ga(n){const s=n?.ownerDocument;if(!n||!s)return;let a=n;for(;a&&a!==s.body&&a!==s.documentElement;){if(a.scrollTop!==0&&(a.scrollTop=0),a.matches(Wa))return;a=a.parentElement}}const Ja="es-learning-rated";function gs(n){return`${Ja}:${n}`}function _s(n,s){const[a]=In(()=>{const l=localStorage.getItem(gs(n));if(!l)return null;const r=JSON.parse(l);return(r.ownerId??null)!==s||!Array.isArray(r.lessonIds)?null:new Set(r.lessonIds.filter(t=>typeof t=="string"))});return a??new Set}function Va(n,s,a){const l=_s(n,s);l.add(a);const r=[...l].slice(-500),t={ownerId:s,lessonIds:r};return In(()=>localStorage.setItem(gs(n),JSON.stringify(t))),new Set(r)}const Ha=["learning-load","learning-browse","learning-read-lesson","learning-lesson-review","learning-lesson-quiz","learning-news-load"],Ka=["learning-answer-quiz","learning-answer-quiz-open","learning-answer-open","learning-quiz-finish","learning-start-lesson","learning-complete-lesson"],Za=300*1e3,ps=new Set(Ha),Ye=new Map;let Ae;function hs(n){n!==Ae&&(Ye.clear(),Ae=n)}function Ya(n){return n?JSON.stringify(Object.keys(n).sort().map(s=>[s,String(n[s])])):""}function ms(n,s,a,l){return`${n}\0${s}\0${a}\0${Ya(l)}`}function re(n,s,a,l,r=Date.now()){if(hs(s),s===null||!ps.has(a))return null;const t=Ye.get(ms(n,s,a,l));return t?{data:t.data,stale:r-t.storedAt>=Za}:null}function ge(n,s,a,l,r,t=Date.now()){if(Ae===void 0)Ae=s;else if(s!==Ae)return;s===null||!ps.has(a)||Ye.set(ms(n,s,a,l),{data:r,storedAt:t})}function Hn(){Ye.clear()}function Xa(n){hs(n)}function el(n){return Ps(n)}function nl(n,s){if(!n)return null;const[a]=In(()=>{const l=new Date(n);return Number.isNaN(l.getTime())?null:new Intl.DateTimeFormat(s,{day:"numeric",month:"short"}).format(l)});return a??null}function sl(n,s){if(!n)return null;const a=n.split("-")[0]?.toLowerCase();return!a||a===s.split("-")[0]?.toLowerCase()?null:a.toUpperCase()}function yn({item:n,currentLanguage:s,onPick:a,t:l}){const r=nl(n.publishedAt,s),t=sl(n.language,s),_=n.sourceName??n.host;return e.jsx("button",{type:"button",className:`es-learning__news${n.read?" es-learning__news--read":""}`,onClick:()=>a(n),"data-testid":"learning-news-card",children:e.jsxs("span",{className:"es-learning__news-row",children:[e.jsx("span",{className:"es-learning__news-thumb",children:n.thumbnailUrl&&e.jsx("img",{src:n.thumbnailUrl,alt:"",loading:"lazy"})}),e.jsxs("span",{className:"es-learning__news-body",children:[e.jsx("span",{className:"es-learning__news-title",children:n.title}),e.jsxs("span",{className:"es-learning__news-meta",children:[_&&e.jsx("span",{children:_}),_&&r&&e.jsx("span",{"aria-hidden":"true",children:"·"}),r&&e.jsx("span",{children:r}),t&&e.jsx("span",{className:"es-learning__news-lang",children:t})]})]}),n.read?e.jsx("span",{className:"es-learning__news-done",role:"img","aria-label":l("learning.news_read"),children:e.jsx(oe,{size:13})}):e.jsx("span",{className:"es-learning__news-ext","aria-hidden":"true",children:e.jsx(ts,{size:14})})]})})}function al({item:n,currentLanguage:s,onPick:a,t:l}){return e.jsxs("div",{className:"es-learning__news-tile","data-testid":"learning-news-tile",children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_suggested_title")}),e.jsx(yn,{item:n,currentLanguage:s,onPick:a,t:l})]})}function ll({news:n,currentLanguage:s,onPick:a,t:l}){const r=n?.unread??[],t=n?.read??[];return r.length===0&&t.length===0?e.jsx("section",{className:"es-learning__dashboard","aria-label":l("learning.nav_news"),children:e.jsx("p",{className:"es-learning__news-empty",children:l("learning.news_empty")})}):e.jsxs("section",{className:"es-learning__dashboard","aria-label":l("learning.nav_news"),children:[r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_new_title")}),e.jsx("div",{className:"es-learning__news-list",children:r.map(_=>e.jsx(yn,{item:_,currentLanguage:s,onPick:a,t:l},_.id))})]}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_read_title")}),e.jsx("div",{className:"es-learning__news-list",children:t.map(_=>e.jsx(yn,{item:_,currentLanguage:s,onPick:a,t:l},_.id))})]})]})}function il({item:n,onCancel:s,onConfirm:a,t:l}){const r=g.useRef(null);return g.useEffect(()=>{r.current?.focus()},[]),g.useEffect(()=>{const t=_=>{_.key==="Escape"&&s()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[s]),e.jsxs("div",{className:"es-learning__leave",role:"dialog","aria-modal":"true","aria-labelledby":"es-learning-leave-title","data-testid":"learning-news-leave",children:[e.jsx("div",{className:"es-learning__leave-scrim","aria-hidden":"true",onClick:s}),e.jsxs("div",{className:"es-learning__leave-card",children:[e.jsx("span",{className:"es-learning__leave-icon","aria-hidden":"true",children:e.jsx(ts,{size:22})}),e.jsx("p",{className:"es-learning__leave-title",id:"es-learning-leave-title",children:l("learning.news_leave_title")}),e.jsx("p",{className:"es-learning__leave-body",children:l("learning.news_leave_body")}),e.jsx("span",{className:"es-learning__leave-host",children:n.host}),e.jsxs("div",{className:"es-learning__leave-actions",children:[e.jsx("button",{type:"button",className:"es-learning__leave-btn es-learning__leave-btn--cancel",onClick:s,children:l("learning.news_leave_cancel")}),e.jsx("button",{ref:r,type:"button",className:"es-learning__leave-btn es-learning__leave-btn--go",onClick:a,children:l("learning.news_leave_confirm")})]})]})]})}function Kn(){const n=new Date,s=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return`${s}-${a}-${l}`}function tl(n){return!!n&&typeof n=="object"&&typeof n.error=="string"}async function R(n,s,a){const[l]=await Ls(n.call(s,a));return!l||tl(l)?null:l}const Nn="__untracked__";function vn(n){return!!n&&Array.isArray(n.unread)&&Array.isArray(n.read)}function rl(n,s,a){const l=n.unread.find(r=>r.id===s);return{suggested:n.suggested?.id===s?n.suggested.pinned?{...n.suggested,read:!0}:null:n.suggested,unread:n.unread.filter(r=>r.id!==s),read:l?[{...l,read:!0},...n.read]:n.read,unreadCount:a}}function jl(n){const s=n.auth?.user?.id??null;return e.jsx(ol,{...n},`${n.productId}\0${s??"signed-out"}`)}function ol({config:n,data:s,actions:a,i18n:l,builderMode:r,productId:t,auth:_,baseUrl:j,externalContext:o,previewMode:x,readOnly:b}){const p=l?.t??(i=>i),f=l?.currentLanguage??"en",m=_?.user?.id??null,w=As(n.title,f,{t:p,fallbackKey:"learning.title",enDefault:"Learning"}),q=n.showExplanations!==!1,v=ha(n.mascot),I=n.showBrowse!==!1,P=I&&n.showDashboard!==!1,T=I&&n.showProgress===!0,K=I&&n.showNews!==!1,[u,E]=g.useState(()=>r?null:re(t,m,"learning-load",{language:f})?.data??null),[G,Z]=g.useState(()=>!r&&re(t,m,"learning-load",{language:f})===null),[be,F]=g.useState(null),[L,B]=g.useState(!1),[J,_e]=g.useState(""),[Xe,ve]=g.useState(null),[Y,V]=g.useState(null),[ae,we]=g.useState(null),U=g.useRef(r?null:Fa(t,m)).current,[X,pe]=g.useState(U?.tab??"dashboard"),[H,ke]=g.useState(()=>{if(r||!K)return null;const i=re(t,m,"learning-news-load")?.data;return vn(i)?i:null}),k=g.useRef(null);k.current=H;const[A,he]=g.useState(null),[ce,Me]=g.useState(()=>U?.slideIndex??{}),[en,$e]=g.useState({}),[ye,xs]=g.useState(()=>U?.slideTotals??{}),[js]=g.useState(()=>r?new Set:_s(t,m)),[fs,bs]=g.useState(()=>new Set),Ie=g.useRef(null),Re=i=>{if(n?.readAloudEnabled!==!0)return null;const c=o?.renderReadAloud;return typeof c!="function"?null:c(`learning-lesson-${i}`,Ie)},nn=i=>r||js.has(i)||fs.has(i)?null:e.jsx($s,{compact:!0,blockSlug:"learning",subjectType:"learning_lesson",subjectId:i,promptKey:"block_rating.prompt_lesson",ariaKey:"block_rating.rate_lesson_aria",baseUrl:j,apiKey:o?.apiKey,jwt:_?.jwt,previewMode:x||b,settleInPlace:!0,onRated:()=>Va(t,m,i),onFeedbackCycleDone:()=>bs(c=>new Set(c).add(i)),t:p}),[sn,an]=g.useState(!1),[ws,Ns]=g.useState(!1),[Ue,ln]=g.useState(!1),[An,Tn]=g.useState(null),[vs,tn]=g.useState(!1),Ln=g.useRef(null),[le,me]=g.useState(U?.openTopicId??null),[xe,Oe]=g.useState(null),[W,de]=g.useState(null),[N,ze]=g.useState(()=>r?null:re(t,m,"learning-browse",{language:f})?.data??null),[rn,on]=g.useState(!1),[S,ee]=g.useState(null),[ks,Be]=g.useState(null),[M,De]=g.useState(null),[O,Ee]=g.useState(null),[ue,Mn]=g.useState(null),[cn,dn]=g.useState(!1),[$,un]=g.useState(null),ie=g.useRef(p);ie.current=p;const $n=g.useCallback((i,c)=>(Ka.includes(i)&&(Hn(),on(!0)),a.call(i,c)),[a]),C=g.useMemo(()=>({...a,call:$n}),[a,$n]),je=g.useCallback(async i=>{F(null),ve(null),V(null),we(null),_e("");const c={...i?{preferredTopicId:i}:{},language:f},d=re(t,m,"learning-load",c);if(d){if(E(d.data),Z(!1),!d.stale)return d.data;const y=await R(C,"learning-load",c);return y&&(ge(t,m,"learning-load",c,y),E(y)),y??d.data}Z(!0);const h=await R(C,"learning-load",c);return h?(ge(t,m,"learning-load",c,h),E(h)):F(ie.current("learning.error_load")),Z(!1),h},[C,f,m,t]);g.useEffect(()=>{if(r){const i=s?.mode??"nothing";E(i==="nothing"?{mode:"nothing",reason:s?.reason??"all_in_cooldown"}:{mode:"unavailable"});return}je()},[r,je,s?.mode,s?.reason]),g.useEffect(()=>{const i=a.on?.("learning:reload",()=>{Hn(),je()});return()=>i?.()},[a,je]),g.useEffect(()=>{if(r||!K)return;let i=!1;return(async()=>{const c=re(t,m,"learning-news-load");if(c&&(vn(c.data)&&ke(c.data),!c.stale))return;const d=await R(a,"learning-news-load");i||!d||(ge(t,m,"learning-news-load",void 0,d),vn(d)&&ke(d))})(),()=>{i=!0}},[a,r,m,t,K]);const ys=g.useCallback(()=>{const i=A;if(!i)return;he(null);const c=el(i.url);if(!c){F(ie.current("learning.news_error_open"));return}const d=window.open(c,"_blank","noopener,noreferrer");d&&(d.opener=null),(async()=>{const h=await R(a,"learning-news-open",{newsItemId:i.id});if(!h||typeof h.unreadCount!="number")return;const y=k.current;if(!y)return;const D=rl(y,i.id,h.unreadCount);ke(D),ge(t,m,"learning-news-load",void 0,D)})()},[a,A,m,t]);g.useEffect(()=>{Xa(m)},[m]),g.useEffect(()=>{if(X==="today"||r||N&&(M||W||$))return;const i={language:f},c=rn?null:re(t,m,"learning-browse",i);if(N&&!rn&&!(c&&c.stale)||(c&&ze(c.data),c&&!c.stale))return;let d=!1;return(async()=>{const h=await R(C,"learning-browse",i);d||!h||!Array.isArray(h.topics)||!h.summary||(ge(t,m,"learning-browse",i,h),ze(h),on(!1))})(),()=>{d=!0}},[X,N,rn,M,W,$,r,C,f,m,t]);const gn=g.useCallback(async(i,c,d)=>{const h=await R(C,"learning-answer-quiz",{quizId:i,questionId:c,selectedOptionIndex:d,language:f});if(!h){F(ie.current("learning.error_answer"));return}a.emit("learning:answerSubmitted",{questionId:c}),h.completed&&V(h.completed)},[a,C,f]),_n=g.useCallback(async(i,c,d)=>{B(!0);const h=await R(C,"learning-answer-quiz-open",{quizId:i,questionId:c,answer:d,language:f});return h?a.emit("learning:answerSubmitted",{questionId:c}):F(ie.current("learning.error_answer")),B(!1),!!h},[a,C,f]),pn=g.useCallback(async(i,c)=>{if(L)return;B(!0);const d=await R(C,"learning-quiz-finish",{quizId:i,language:f,activeDate:Kn()});if(d){if(V(d),a.emit("learning:quizCompleted",d),Mn(d.sectionQuiz??null),d.streak&&ze(h=>h&&{...h,streak:d.streak}),!c?.isSectionQuiz){const h=await R(C,"learning-load",{language:f});h?.mode&&we(h)}}else Y||F(ie.current("learning.error_answer"));B(!1)},[a,C,L,f,Y]),Rn=g.useCallback(async(i,c,d)=>{if(L)return!1;B(!0);const h=await R(C,"learning-section-quiz",{topicId:i,language:f});B(!1);const y=h?.quiz??null;return y?(V(null),dn(!1),un({quiz:y,topicTitle:h?.topicTitle||c,origin:d}),!0):!1},[L,C,f]),Is=g.useCallback(async i=>{const c=J.trim();if(!c||L)return;B(!0);const d=await R(C,"learning-answer-open",{questionId:i,answer:c,language:f});d?(a.emit("learning:answerSubmitted",{questionId:i,verdict:d.verdict}),ve(d)):F(ie.current("learning.error_answer")),B(!1)},[a,C,L,f,J]),Pe=g.useCallback(async i=>{B(!0);const c=await R(C,"learning-start-lesson",{lessonId:i});return B(!1),c?!0:(F(ie.current("learning.error_load")),!1)},[C]),hn=g.useCallback(async i=>{await Pe(i)&&ln(!0)},[Pe]),Fe=g.useCallback(async(i,c)=>{i?.mode==="new_information"&&i.isNew&&(c!==null&&i.lesson.topicId!==c?Tn(i.lesson.lessonId):await hn(i.lesson.lessonId)),tn(!1)},[hn]),Qe=g.useCallback(()=>{dn(!1),Mn(null),un(null),V(null),ln(!1),ae&&(E(ae),we(null),tn(!0),Fe(ae,Ln.current))},[Fe,ae]),We=g.useCallback(async i=>{const c=await R(C,"learning-complete-lesson",{lessonId:i,activeDate:Kn()});return c?.streak&&ze(d=>d&&{...d,streak:c.streak}),c},[C]),Un=g.useCallback(async(i,c)=>{ln(!1),tn(!0),Ln.current=c??null,i&&(await We(i),Me(d=>{if(!(i in d))return d;const h={...d};return delete h[i],h}),$e(d=>{if(!(i in d))return d;const h={...d};return delete h[i],h})),await Fe(await je(),c??null)},[Fe,je,We]),te=g.useCallback(async(i,c)=>{F(null),Ns(c?.fromQuiz===!0),de({...i}),Be(null);const d={lessonId:i.lessonId,language:f},h=re(t,m,"learning-read-lesson",d);if(h)ee(h.data),h.stale&&(async()=>{const y=await R(C,"learning-read-lesson",d);y&&(y.body||y.slides?.length)&&(ge(t,m,"learning-read-lesson",d,y),ee(y))})();else{ee(null);const y=await R(C,"learning-read-lesson",d);if(!y||!y.body&&!y.slides?.length){de(null),F(ie.current("learning.error_load"));return}ge(t,m,"learning-read-lesson",d,y),ee(y)}if(i.done){const y={lessonId:i.lessonId,language:f},D=re(t,m,"learning-lesson-review",y);if(D&&!D.stale)Be(D.data.rows??null);else{const Se=await R(C,"learning-lesson-review",y);Se?(ge(t,m,"learning-lesson-review",y,Se),Be(Se.rows??null)):Be(D?D.data.rows??null:null)}}},[C,f,m,t]),Ge=g.useCallback(async i=>{if(N?.canPickAnyLesson===!0&&i.servedAt===null&&!i.done){F(null),de(null),ee(null),Ee(i);return}await te(i)},[N?.canPickAnyLesson,te]),mn=g.useCallback(async i=>{await Pe(i.lessonId)&&(Ee(null),await te({...i,servedAt:new Date().toISOString()}))},[te,Pe]),zs=g.useCallback(async i=>{B(!0),await R(C,"learning-start-lesson",{lessonId:i}),await We(i);const c=await R(C,"learning-lesson-quiz",{lessonId:i,language:f});if(B(!1),c?.quiz){De({quiz:c.quiz,lessonId:c.lessonId??i,lessonTitle:c.lessonTitle??""}),de(null),ee(null);return}const d=N?.topics.flatMap(D=>(D.lessons??[]).map(Se=>({topicId:D.topicId,lesson:Se})))??[],h=d.findIndex(D=>D.lesson.lessonId===i),y=N?.canPickAnyLesson===!0&&h!==-1?d.slice(h+1).find(D=>!D.lesson.done)??null:null;if(de(null),ee(null),ze(null),!!y){if(y.topicId===d[h].topicId){await mn(y.lesson);return}Tn(y.lesson.lessonId),Ge(y.lesson)}},[C,f,N,Ge,We,mn]),On=g.useRef(U?.readingLessonId??null);g.useEffect(()=>{const i=On.current;if(!i||!N||r)return;On.current=null;const c=N.topics.flatMap(d=>d.lessons??[]).find(d=>d.lessonId===i);c&&te(c)},[N,r,te]),g.useEffect(()=>{r||Qa(t,m,{tab:X,openTopicId:le,readingLessonId:W?.lessonId??null,slideIndex:ce,slideTotals:ye})},[r,t,m,X,le,W,ce,ye]);const Bn=u?.mode==="new_information"?u.lesson:null;g.useEffect(()=>{const i=[];for(const c of[Bn,S]){const d=c?.slides?.length??0;c&&d>0&&i.push([c.lessonId,d])}i.length!==0&&xs(c=>{const d=i.filter(([h,y])=>c[h]!==y);return d.length>0?{...c,...Object.fromEntries(d)}:c})},[Bn,S]);const qs=g.useMemo(()=>{const i={};for(const[c,d]of Object.entries(ye))d<=0||(i[c]={index:Math.min(ce[c]??0,d-1),total:d});return i},[ye,ce]),qe=(N?.tracks?.length??0)>0,xn=g.useMemo(()=>O?N?.topics.find(i=>(i.lessons??[]).some(c=>c.lessonId===O.lessonId))??null:null,[N,O]),Ce=g.useMemo(()=>{if(!N||!qe)return[];const i=new Set(N.tracks.flatMap(c=>c.topics.map(d=>d.topicId)));return N.topics.filter(c=>!i.has(c.topicId))},[N,qe]),Je=g.useMemo(()=>!N||!xe?null:xe===Nn?{trackId:Nn,title:p("learning.track_unassigned"),topicCount:Ce.length,doneTopicCount:Ce.filter(i=>i.lessonCount>0&&i.doneCount===i.lessonCount).length,topics:Ce}:N.tracks?.find(i=>i.trackId===xe)??null,[N,xe,Ce,p]),Dn=i=>{if(N?.canPickAnyLesson!==!0)return null;const c=N.topics.flatMap(h=>h.lessons??[]),d=c.findIndex(h=>h.lessonId===i);return d===-1?null:c.slice(d+1).find(h=>!h.done)??null},Cs=i=>{if(!N)return!0;const c=N.topics.flatMap(h=>h.lessons??[]),d=c.findIndex(h=>h.lessonId===i);return d===-1?!0:c.slice(d+1).some(h=>!h.done)},jn=i=>Cs(i)?p("learning.finish_next_lesson"):p("learning.finish_lesson"),En=K&&H!==null&&(H.unread.length>0||H.read.length>0||H.suggested!==null),ne=G||vs,z=X==="dashboard"&&!P||X==="progress"&&!T||X==="news"&&!En?"today":X,Pn=g.useRef(null),Fn=S?.lessonId??(u?.mode==="new_information"?u.lesson.lessonId:null),Ss=[z,xe??"",le??"",O?.lessonId??"",W?.lessonId??"",sn?"quiz-lesson":"",M?.quiz.attemptId??M?.quiz.quizId??"",$?.quiz.attemptId??$?.quiz.quizId??"",cn?"section-intro":"",u?.mode??"",u?.mode==="new_information"?u.lesson.lessonId:"",u?.mode==="new_information"&&u.isNew&&!Ue?"arrival":"",u?.mode==="checking_question"?u.question.questionId:"",u?.mode==="placement_quiz"||u?.mode==="section_quiz"||u?.mode==="lesson_quiz"?u.quiz.attemptId??u.quiz.quizId:"",Y?"results":"",Fn?String(ce[Fn]??0):""].join("|");return g.useLayoutEffect(()=>{Ga(Pn.current)},[Ss]),e.jsxs(Ts,{blockType:"learning",children:[e.jsxs("header",{className:"es-learning__header",children:[e.jsx("span",{className:"es-learning__header-title",children:w}),I&&e.jsx("nav",{className:"es-learning__header-actions","aria-label":w,children:[...P?[["dashboard",ua]]:[],["today",ca],["topics",da],...En?[["news",pa]]:[],...T?[["progress",ga]]:[]].map(([i,c])=>{const d=i==="news"&&z!=="news"?H?.unreadCount??0:0,h=p(`learning.nav_${i}`);return e.jsxs("button",{type:"button",className:`es-learning__navbtn es-learning__navbtn--icon${i==="news"?" es-learning__navbtn--news":""}${z===i?" es-learning__navbtn--active":""}`,"aria-current":z===i?"page":void 0,"aria-label":d>0?p("learning.nav_news_unread",{n:d}):h,title:h,onClick:()=>{pe(i),me(null),Oe(null),de(null),ee(null),Ee(null),an(!1),De(null),V(null),we(null),he(null)},children:[e.jsx(c,{}),d>0&&e.jsx("span",{className:"es-learning__navbadge","aria-hidden":"true",children:d>99?"99+":d})]},i)})})]}),e.jsxs("div",{className:"es-block__body es-learning",ref:Pn,children:[be&&e.jsx("div",{className:"es-learning__error",role:"alert",children:be}),ne&&(z==="today"||z==="dashboard")&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="dashboard"&&!G&&e.jsx($a,{view:u,browse:N,mascot:v,slidePositions:qs,newsTile:K&&H?.suggested?e.jsx(al,{item:H.suggested,currentLanguage:f,onPick:he,t:p}):void 0,onGoToday:()=>pe("today"),onOpenLesson:(i,c)=>{pe("topics"),me(i),te(c)},onOpenTopic:i=>{pe("topics"),me(i)},t:p}),z==="news"&&e.jsx(ll,{news:H,currentLanguage:f,onPick:he,t:p}),z==="progress"&&N&&e.jsx(Ba,{browse:N,t:p}),(z==="topics"||z==="progress")&&!N&&!O&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="topics"&&O&&e.jsx(Gn,{lessonTitle:O.title,topicTitle:xn?.title??"",newTopic:An===O.lessonId,graphicRef:O.graphicRef,graphicAlt:O.graphicAlt,graphicUrl:O.graphicUrl,slideCount:ye[O.lessonId]??0,mascot:v,busy:L,onStart:()=>{mn(O)},onBackToTopic:xn?()=>{Ee(null),me(xn.topicId)}:void 0,t:p}),z==="topics"&&N&&W&&!S&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="topics"&&N&&W&&S&&e.jsx(Jn,{lesson:S,readAloud:Re(S.lessonId),readAloudRef:Ie,slideIndex:ce[S.lessonId]??0,onSlideIndexChange:i=>Me(c=>({...c,[S.lessonId]:i})),slideAnswers:en[S.lessonId]??{},onSlideAnswer:(i,c)=>$e(d=>({...d,[S.lessonId]:{...d[S.lessonId]??{},[i]:c}})),review:ks,backLabel:p("learning.back_to_topic",{topic:S.topicTitle}),showBackLink:!1,onBack:()=>{de(null),ee(null)},onBackToTopic:()=>{de(null),ee(null)},onFinish:N.canPickAnyLesson===!0&&!W.done?()=>{zs(S.lessonId)}:void 0,finishLabel:S.hasQuiz===!1?jn(S.lessonId):p("learning.finish_to_quiz"),rating:ws?null:nn(S.lessonId),t:p}),z==="topics"&&M&&e.jsx(wn,{quiz:M.quiz,isPlacement:!1,eyebrow:M.lessonTitle,topics:[],results:Y,busy:L,mascot:v,onAnswer:(i,c)=>{gn(M.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n(M.quiz.quizId,i,c),onFinish:()=>{pn(M.quiz.quizId)},onBackToLesson:()=>{De(null),te({lessonId:M.lessonId,title:M.lessonTitle,isMilestone:!1,state:"gap",done:!1,servedAt:new Date().toISOString()},{fromQuiz:!0})},onContinue:()=>{const i=Dn(M.lessonId);V(null),De(null),i&&Ge(i)},continueLabel:Dn(M.lessonId)?p("learning.go_to_next_lesson"):p("learning.nav_topics"),t:p},M.quiz.attemptId??M.quiz.quizId),z==="topics"&&N&&!W&&!M&&!$&&!O&&le&&e.jsx(Ma,{topic:N.topics.find(i=>i.topicId===le)??N.topics[0],onOpenLesson:i=>{Ge(i)},onStartSectionQuiz:()=>{const i=N.topics.find(c=>c.topicId===le)??N.topics[0];(async()=>await Rn(i.topicId,i.title,"topics")||on(!0))()},canPickAnyLesson:N.canPickAnyLesson===!0,backLabel:Je?.title,onBack:Je?()=>me(null):void 0,t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&qe&&!xe&&e.jsx(Ca,{tracks:N.tracks,untracked:Ce,onOpenTrack:Oe,onOpenUntracked:()=>Oe(Nn),t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&qe&&xe&&Je&&e.jsx(Sa,{track:Je,onOpenTopic:me,onBack:()=>Oe(null),t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&!qe&&e.jsx(ds,{topics:N.topics,onOpen:me,t:p}),z==="today"&&!ne&&u?.mode==="nothing"&&e.jsx(kn,{kind:u.reason,mascot:v,nextDueAt:u.nextDueAt,t:p}),z==="today"&&!ne&&u?.mode==="unavailable"&&e.jsx(kn,{kind:"unavailable",mascot:v,t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&u.isNew&&!Ue&&e.jsx(Gn,{lessonTitle:u.lesson.title,topicTitle:u.lesson.topicTitle,newTopic:An===u.lesson.lessonId,graphicRef:u.lesson.graphicRef,graphicAlt:u.lesson.graphicAlt,graphicUrl:u.lesson.graphicUrl,slideCount:u.lesson.slides?.length??0,mascot:v,busy:L,onStart:()=>{hn(u.lesson.lessonId)},t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&(!u.isNew||Ue)&&(!u.lesson.kind||u.lesson.kind==="info"||!u.lesson.slides?.length)&&e.jsx(rs,{lesson:u.lesson,busy:L,onDone:()=>{Un(u.lesson.lessonId,u.lesson.topicId)},doneLabel:u.lesson.hasQuiz===!1?jn(u.lesson.lessonId):void 0,rating:nn(u.lesson.lessonId),readAloud:Re(u.lesson.lessonId),readAloudRef:Ie,t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&(!u.isNew||Ue)&&u.lesson.kind&&u.lesson.kind!=="info"&&!!u.lesson.slides?.length&&e.jsx(cs,{lesson:u.lesson,index:ce[u.lesson.lessonId]??0,onIndexChange:i=>Me(c=>({...c,[u.lesson.lessonId]:i})),answers:en[u.lesson.lessonId]??{},onAnswer:(i,c)=>$e(d=>({...d,[u.lesson.lessonId]:{...d[u.lesson.lessonId]??{},[i]:c}})),busy:L,onDone:()=>{Un(u.lesson.lessonId,u.lesson.topicId)},doneLabel:u.lesson.hasQuiz===!1?jn(u.lesson.lessonId):void 0,rating:nn(u.lesson.lessonId),readAloud:Re(u.lesson.lessonId),readAloudRef:Ie,t:p}),z==="today"&&!ne&&u?.mode==="checking_question"&&e.jsx(fa,{prompt:u.question.prompt,lessonTitle:u.lessonTitle,answer:J,feedback:Xe,busy:L,showExplanations:q,onChange:_e,onSubmit:()=>{Is(u.question.questionId)},t:p}),z==="today"&&!ne&&u?.mode==="lesson_quiz"&&sn&&(S?e.jsx(Jn,{lesson:S,readAloud:Re(S.lessonId),readAloudRef:Ie,slideIndex:ce[S.lessonId]??0,onSlideIndexChange:i=>Me(c=>({...c,[S.lessonId]:i})),slideAnswers:en[S.lessonId]??{},onSlideAnswer:(i,c)=>$e(d=>({...d,[S.lessonId]:{...d[S.lessonId]??{},[i]:c}})),backLabel:p("learning.back_to_quiz"),onBack:()=>an(!1),t:p}):e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")})),z==="today"&&!ne&&cn&&ue&&e.jsx(ma,{topicTitle:ue.topicTitle,topicComplete:ue.topicComplete,mascot:v,busy:L,onStart:()=>{(async()=>await Rn(ue.topicId,ue.topicTitle,"today")||Qe())()},onSkip:Qe,t:p}),$&&z===$.origin&&e.jsx(wn,{quiz:$.quiz,isPlacement:!1,eyebrow:$.topicTitle,topics:[],results:Y,busy:L,mascot:v,onAnswer:(i,c)=>{gn($.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n($.quiz.quizId,i,c),onFinish:()=>{pn($.quiz.quizId,{isSectionQuiz:!0})},onBackToLesson:void 0,onContinue:$.origin==="today"?Qe:()=>{un(null),V(null)},continueLabel:$.origin==="topics"?p("learning.nav_topics"):ae?.mode==="new_information"?p("learning.go_to_next_lesson"):p("learning.continue"),t:p},$.quiz.attemptId??$.quiz.quizId),z==="today"&&!ne&&!sn&&!cn&&$?.origin!=="today"&&(u?.mode==="placement_quiz"||u?.mode==="section_quiz"||u?.mode==="lesson_quiz")&&e.jsx(wn,{quiz:u.quiz,isPlacement:u.mode==="placement_quiz",eyebrow:u.mode==="lesson_quiz"?u.lessonTitle:void 0,topics:u.mode==="placement_quiz"?u.topics:[],results:Y,busy:L,mascot:v,onAnswer:(i,c)=>{gn(u.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n(u.quiz.quizId,i,c),onFinish:()=>{pn(u.quiz.quizId)},onBackToLesson:u.mode==="lesson_quiz"?()=>{an(!0),te({lessonId:u.lessonId,title:u.lessonTitle,isMilestone:!1,state:"current",done:!1,servedAt:null},{fromQuiz:!0})}:void 0,onChooseTopic:u.mode==="placement_quiz"?i=>{je(i)}:void 0,onContinue:ue||ae?()=>{if(ue){V(null),dn(!0);return}Qe()}:void 0,continueLabel:!ue&&ae?.mode==="new_information"?p("learning.go_to_next_lesson"):p("learning.continue"),t:p},u.quiz.attemptId??u.quiz.quizId)]}),A&&e.jsx(il,{item:A,onCancel:()=>he(null),onConfirm:ys,t:p})]})}export{jl as Component,Gn as NewLessonIntro,ya as QuizReview,ma as SectionQuizIntro,xl as manifest};
2
- //# sourceMappingURL=index-Gi-3UOyp-DuzPeEIz.js.map
1
+ import{j as e,r as g,a as As,Q as Ts,Y as Ye,t as In,b as Ls,d as Ms}from"../nexly.js";import{C as $s}from"./block-rating-BgOeTm52-CoiP5C2K.js";import{x as Rs,c as Us,s as Yn,a as Os}from"./allowed-elements-BXnLJV1S-C-_lr2zm.js";import{r as Bs}from"./inert-assistant-components-B6Cx9pG5-DWb6n3Yq.js";import{X as Ds,F as Es}from"./ClickToLoadEmbed-D9eMaBG8-r9dN9klo.js";import{p as Ps}from"./external-url-ninK7gY9-CJQjg_od.js";import"./_commonjsHelpers-C6fGbg64-BC8KDfbh.js";import"./assistant-link-policy-CogLpq-3-Cc-yj-a-.js";const Fs=/^[a-z0-9][a-z0-9-]*$/,Qs=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Le(n){if(!n)return null;const s=n.trim();if(!s)return null;if(s.startsWith("media:")){const l=s.slice(6);return Qs.test(l)?{kind:"media",mediaId:l}:null}const a=s.startsWith("icon:")?s.slice(5):s;return Fs.test(a)?{kind:"icon",slug:a}:null}const fn="media:",bn="youtube:",Ws=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Zn(n){if(!n)return null;const s=n.trim();if(s.startsWith(fn)){const a=s.slice(fn.length);return Ws.test(a)?{kind:"image",ref:`${fn}${a}`,mediaId:a}:null}if(s.startsWith(bn)){const a=s.slice(bn.length);return Es(a)?{kind:"youtube",ref:`${bn}${a}`,id:a}:null}return null}const xl={slug:"learning",name:"Learning",version:"1.0.0",category:"interactive",requiredService:"learning",configSchema:{properties:{readAloudEnabled:{type:"boolean",default:!1},title:{type:"string",default:""},showExplanations:{type:"boolean",default:!0},showBrowse:{type:"boolean",default:!0},showDashboard:{type:"boolean",default:!0},showProgress:{type:"boolean",default:!1},showNews:{type:"boolean",default:!0}}},defaultConfig:{readAloudEnabled:!1,title:"",showExplanations:!0,showBrowse:!0,showDashboard:!0,showProgress:!1,showNews:!0},dataContract:{serviceSlug:"learning",inputSchema:{type:"object",properties:{mode:{type:"string",description:"placement_quiz | section_quiz | checking_question | new_information | nothing"},quizId:{type:"string",description:"Set for placement_quiz / section_quiz"},questionId:{type:"string",description:"Set for checking_question"},lessonId:{type:"string",description:"Set for new_information / checking_question"},topicId:{type:"string",description:"Set for new_information / section_quiz"},reason:{type:"string",description:"Set for mode=nothing: no_curriculum | all_mastered | all_in_cooldown"}},required:["mode"]},previewDataOverride:{mode:"nothing",reason:"all_in_cooldown"}},fields:[{id:"readAloudEnabled",type:"toggle",label:"Read this panel aloud",default:!1,group:"Voice"},{id:"title",type:"localized-text",label:"Heading",default:"",placeholder:'Leave empty to use the translated default ("Learning")',group:"Content"},{id:"showExplanations",type:"toggle",label:"Show explanations after answering",default:!0,group:"Behavior"},{id:"showBrowse",type:"toggle",label:"Offer the browsing sections (Topics, Dashboard, Progress)",default:!0,group:"Sections"},{id:"showDashboard",type:"toggle",label:"Show the Dashboard section (streak, progress, what to pick up)",default:!0,group:"Sections"},{id:"showProgress",type:"toggle",label:"Show the Progress section (mastery by topic, quiz history)",default:!1,group:"Sections"},{id:"showNews",type:"toggle",label:"Show the News section (published feed items, with an unread badge)",default:!0,group:"Sections"}],events:{emits:[{name:"learning:answerSubmitted",description:"Learner answered a question"},{name:"learning:quizCompleted",description:"Learner finished a quiz attempt"},{name:"learning:lessonSkipped",description:"Learner declared a lesson already known"}],listens:[{name:"learning:reload",description:"Re-fetch the current assignment"}]},sizing:{minWidth:260,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main"]},Xn=g.createContext(null),Gs=({children:n})=>e.jsx("span",{className:"es-learning__md-link",children:n}),Js=({node:n,...s})=>e.jsx("div",{className:"es-learning__md-tablewrap",children:e.jsx("table",{...s})}),Vs=({node:n,type:s,checked:a,...l})=>s==="checkbox"?e.jsx("input",{...l,type:"checkbox",checked:!!a,disabled:!0,readOnly:!0}):null,Hs=()=>null,Ks=({src:n,alt:s})=>{const a=g.useContext(Xn);if(!a)return null;const{media:l,t:r}=a,t=Zn(typeof n=="string"?n:void 0),_=t?l[t.ref]:void 0,j=(s??"").trim();return _?_.kind==="image"?e.jsx("img",{className:"es-learning__media-img",src:_.url,alt:j||r("learning.media_image_alt"),loading:"lazy",decoding:"async",referrerPolicy:"no-referrer"}):e.jsx(Ds,{embed:{provider:_.provider,id:_.id},t:r,classPrefix:"es-learning",posterUrl:_.posterUrl},`${_.provider}:${_.id}`):e.jsx("span",{className:"es-learning__media-missing",children:j||r("learning.media_unavailable")})},Ys=({node:n,children:s,...a})=>{const l=n?.children;return l!==void 0&&l.length>0&&l.every(r=>r.type==="element"&&r.tagName==="img"||r.type==="text"&&!(r.value??"").trim())&&l.some(r=>r.type==="element")?e.jsx(e.Fragment,{children:s}):e.jsx("p",{...a,children:s})},es={...Bs,a:Gs,table:Js,input:Vs},Zs={...es,img:Hs},Xs={...es,img:Ks,p:Ys},ea=[...Yn],na=[...Yn,"img"],sa=n=>Os(n)??"",aa=()=>"",la=n=>Zn(n)?n:"";function ns(n,s,a,l){return e.jsx("div",{className:"es-learning__md",children:e.jsx(Rs,{remarkPlugins:[...Us],allowedElements:s,transformLinkUri:sa,transformImageUri:a,components:l,children:n})})}function zn({children:n}){return n?.trim()?ns(n,ea,aa,Zs):null}function ss({children:n,media:s,t:a}){const l=g.useMemo(()=>({media:s??{},t:a}),[s,a]);return n?.trim()?e.jsx(Xn.Provider,{value:l,children:ns(n,na,la,Xs)}):null}function se({graphicRef:n,graphicAlt:s,graphicUrl:a,variant:l,done:r}){const t=Le(n);if(!t)return null;const _=["es-learning__graphic",l?`es-learning__graphic--${l}`:"",r?"es-learning__graphic--done":""].filter(Boolean).join(" ");if(t.kind==="media")return a?e.jsx("div",{className:`${_} es-learning__graphic--image`,children:e.jsx("img",{src:a,alt:s??"",className:"es-learning__graphic-img",loading:"lazy","data-testid":"learning-graphic-image"})}):null;const j=Ye(t.slug);return j?e.jsx("div",{className:_,role:s?"img":"presentation","aria-label":s??void 0,"data-testid":"learning-graphic-icon",children:e.jsx(j,{size:40})}):null}function as(n,s){const a=Le(n);return a?a.kind==="media"?!!s:!!Ye(a.slug):!1}function ls(n,s){return Le(n)?.kind==="media"&&!!s}function is({topicTitle:n,onBackToTopic:s,t:a}){return s?e.jsxs("button",{type:"button",className:"es-learning__eyebrow es-learning__eyebrow--back",onClick:s,"aria-label":a("learning.back_to_topic",{topic:n}),children:[e.jsx("span",{"aria-hidden":"true",children:"← "}),n]}):e.jsx("p",{className:"es-learning__eyebrow",children:n})}const Q=n=>({width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0});function ia({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"m15.5 8.5-2 5.5-5.5 2 2-5.5z"})]})}function Qn({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7.5V12l3 2"})]})}function ta({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M8 4h8v4a4 4 0 0 1-8 0z"}),e.jsx("path",{d:"M8 5H5.5a2.5 2.5 0 0 0 2.5 4M16 5h2.5a2.5 2.5 0 0 1-2.5 4"}),e.jsx("path",{d:"M12 12v4M9 20h6M10 20a2 2 0 0 1 4 0"})]})}function ra({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M4 5h16M4 12h16M4 19h16"}),e.jsx("path",{d:"M7 5v7M12 12v7",opacity:"0.45"})]})}function oa({size:n=28}){return e.jsxs("svg",{...Q(n),children:[e.jsx("path",{d:"M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"}),e.jsx("path",{d:"M14 3v5h5"}),e.jsx("path",{d:"m9.5 12.5 5 5m0-5-5 5"})]})}function He({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M19 12H5m0 0 6-6m-6 6 6 6"})})}function fe({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M5 12h14m0 0-6-6m6 6-6 6"})})}function oe({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"m5 13 4 4L19 7"})})}function Te({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})}function qn({size:n=16}){return e.jsxs("svg",{...Q(n),children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M9.5 9.5a2.5 2.5 0 1 1 3.5 2.3c-.6.3-1 .9-1 1.6v.3"}),e.jsx("path",{d:"M12 17h.01"})]})}function Wn({size:n=14}){return e.jsxs("svg",{...Q(n),children:[e.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2"}),e.jsx("path",{d:"M8 11V8a4 4 0 0 1 8 0v3"})]})}function Cn({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"m9 6 6 6-6 6"})})}function ca({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M12 6.5C10.5 5 8.5 4.5 4 4.5v13c4.5 0 6.5.5 8 2 1.5-1.5 3.5-2 8-2v-13c-4.5 0-6.5.5-8 2Z"}),e.jsx("path",{d:"M12 6.5v13"})]})}function da({size:n=18}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M4 6h16M4 12h16M4 18h10"})})}function ua({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"m4 11 8-6 8 6"}),e.jsx("path",{d:"M6 10v9h12v-9"})]})}function ga({size:n=18}){return e.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M5 19V10M12 19V5M19 19v-6"})})}function _a({size:n=16}){return e.jsx("svg",{...Q(n),children:e.jsx("path",{d:"M12 3c1 3-2 4-2 7a3 3 0 0 0 6 0c0-1.5-1-2-1-3.5 1.5 1 2.5 3 2.5 5A5.5 5.5 0 0 1 12 21a5.5 5.5 0 0 1-5-7.5C7.5 10 9 7 12 3Z"})})}function pa({size:n=18}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M4 5h13v14H6a2 2 0 0 1-2-2Z"}),e.jsx("path",{d:"M17 8h3v9a2 2 0 0 1-2 2h-1"}),e.jsx("path",{d:"M7 9h7"}),e.jsx("path",{d:"M7 12.5h7"}),e.jsx("path",{d:"M7 16h4"})]})}function ts({size:n=14}){return e.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M15 3h6v6"}),e.jsx("path",{d:"M10 14 21 3"}),e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function rs({lesson:n,busy:s,onDone:a,doneLabel:l,doneGoesBack:r=!1,onBackToTopic:t,rating:_,readAloud:j,readAloudRef:o,t:x}){return e.jsxs("section",{className:"es-learning__lesson","aria-label":x("learning.lesson_aria"),children:[e.jsxs("div",{className:"es-learning__lesson-readable",ref:o,children:[e.jsx(is,{topicTitle:n.topicTitle,onBackToTopic:t,t:x}),e.jsx("h4",{className:"es-learning__lesson-title",children:n.title}),e.jsx(se,{graphicRef:n.graphicRef,graphicAlt:n.graphicAlt,graphicUrl:n.graphicUrl}),e.jsx(ss,{media:n.media,t:x,children:n.body})]}),j&&e.jsx("div",{className:"es-learning__lesson-readaloud",children:j}),_,e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:a,disabled:s,children:s?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),x("learning.loading")]}):e.jsxs(e.Fragment,{children:[r&&e.jsx(He,{}),l??x("learning.lesson_done"),!r&&e.jsx(fe,{})]})})]})}const os={owl:({size:n})=>e.jsx(Ms,{size:n})};function ha(n){return typeof n=="string"&&n in os?n:"none"}function Ne({name:n,size:s=56,className:a}){const l=n==="none"?void 0:os[n];return l?e.jsx("span",{className:["es-learning__mascot",a].filter(Boolean).join(" "),"aria-hidden":"true",children:e.jsx(l,{size:s})}):null}function Gn({lessonTitle:n,topicTitle:s,newTopic:a=!1,graphicRef:l,graphicAlt:r,graphicUrl:t,slideCount:_,mascot:j,busy:o,onStart:x,onBackToTopic:b,t:p}){const f=!!l,m=p(a?"learning.new_topic_title":"learning.new_lesson_title");return e.jsxs("section",{className:`es-learning__intro${f?" es-learning__intro--illustrated":""}${a?" es-learning__intro--topic":""}`,"aria-label":m,children:[f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"es-learning__intro-say",children:[e.jsx(Ne,{name:j,size:30}),e.jsx("h4",{className:"es-learning__intro-title",children:m})]}),e.jsx(se,{graphicRef:l,graphicAlt:r,graphicUrl:t})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{name:j,size:64}),e.jsx("h4",{className:"es-learning__intro-title",children:m})]}),e.jsx("p",{className:"es-learning__intro-lesson",children:a?s:n}),b&&!a?e.jsxs("button",{type:"button",className:"es-learning__intro-note es-learning__intro-note--back",onClick:b,"aria-label":p("learning.back_to_topic",{topic:s}),children:[e.jsx("span",{"aria-hidden":"true",children:"← "}),s]}):e.jsx("p",{className:"es-learning__intro-note",children:a?n:s}),typeof _=="number"&&_>0&&e.jsx("p",{className:"es-learning__intro-meta",children:p("learning.slide_count",{total:_})}),e.jsx("div",{className:"es-learning__intro-foot",children:e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:x,disabled:o,children:[p(a?"learning.start_new_topic":"learning.start_lesson"),e.jsx(fe,{})]})})]})}function ma({topicTitle:n,topicComplete:s,mascot:a,busy:l,onStart:r,onSkip:t,t:_}){const j=g.useRef(null);g.useEffect(()=>{j.current?.focus({preventScroll:!0})},[]);const o=_(s?"learning.section_quiz_title_complete":"learning.section_quiz_title");return e.jsxs("section",{className:"es-learning__intro","aria-label":o,children:[e.jsx(Ne,{name:a,size:64}),e.jsx("h4",{className:"es-learning__intro-title",children:o}),e.jsx("p",{className:"es-learning__intro-lesson",children:n}),e.jsx("p",{className:"es-learning__intro-note",children:_("learning.section_quiz_note")}),e.jsxs("div",{className:"es-learning__intro-foot",children:[e.jsxs("button",{ref:j,type:"button",className:"es-learning__btn es-learning__btn--block",onClick:r,disabled:l,children:[_("learning.section_quiz_start"),e.jsx(fe,{})]}),e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block es-learning__btn--ghost",onClick:t,disabled:l,children:_("learning.section_quiz_skip")})]})]})}function wn({quiz:n,isPlacement:s,eyebrow:a,topics:l,results:r,busy:t,mascot:_,onAnswer:j,onAnswerOpen:o,onFinish:x,onBackToLesson:b,onChooseTopic:p,onContinue:f,continueLabel:m,t:w}){const q=g.useMemo(()=>n.questions??(n.question?[n.question]:[]),[n.questions,n.question]),v=!!n.questions,[I,P]=g.useState(!s||n.answered>0),[T,K]=g.useState(n.answers??{}),[u,E]=g.useState(()=>new Set(n.answeredIds??[])),[G,Y]=g.useState({}),[be,F]=g.useState({}),[L,B]=g.useState(()=>{if(!n.questions)return 0;const k=new Set(n.answeredIds??Object.keys(n.answers??{})),A=n.questions.findIndex(he=>!k.has(he.questionId));return A===-1?Math.max(0,n.questions.length-1):A});if(r)return e.jsx(ja,{results:r,questions:q,mascot:_,onContinue:f,continueLabel:m,t:w});if(!I)return e.jsxs("section",{className:"es-learning__intro","aria-label":w("learning.placement_intro_title"),children:[_!=="none"?e.jsx(Ne,{name:_,size:64}):e.jsx("span",{className:"es-learning__state-icon","aria-hidden":"true",children:e.jsx(ia,{size:32})}),e.jsx("h4",{className:"es-learning__intro-title",children:w("learning.placement_intro_title")}),e.jsx("p",{className:"es-learning__intro-body",children:w("learning.placement_intro_body",{total:n.total})}),e.jsx("p",{className:"es-learning__intro-note",children:w("learning.placement_intro_note")}),l.length>0&&p&&e.jsxs("div",{className:"es-learning__topics",children:[e.jsx("p",{className:"es-learning__hint",children:w("learning.choose_topic")}),e.jsx("div",{className:"es-learning__topic-list",children:l.map(k=>e.jsx("button",{type:"button",className:"es-learning__topic",onClick:()=>p(k.topicId),disabled:t,children:k.title},k.topicId))})]}),e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:()=>P(!0),disabled:t,children:w("learning.placement_start")})]});const J=q[L];if(!J)return e.jsx("p",{className:"es-learning__hint",children:w("learning.quiz_finished")});const _e=k=>T[k]!==void 0||u.has(k)||(G[k]??"").trim().length>0,Xe=q.filter(k=>_e(k.questionId)).length,ve=T[J.questionId],Z=J.options===null,V=L===q.length-1,ae=q.every(k=>_e(k.questionId)),we=Object.fromEntries(q.filter(k=>_e(k.questionId)).map(k=>[k.questionId,0])),U=J.questionId;function X(k){K(A=>({...A,[U]:k})),j(U,k)}async function pe(){const k=(G[U]??"").trim();return!Z||!k||!o||u.has(U)&&be[U]===k?!0:await o(U,k)?(E(A=>new Set(A).add(U)),F(A=>({...A,[U]:k})),!0):!1}async function H(){await pe()&&B(k=>Math.min(q.length-1,k+1))}async function ke(){await pe()&&x()}return e.jsxs("section",{className:"es-learning__quiz","aria-label":w("learning.quiz_aria"),children:[b&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:b,children:["← ",w("learning.back_to_lesson")]}),s&&e.jsx("p",{className:"es-learning__eyebrow",children:w("learning.placement_intro")}),e.jsx("h4",{className:"es-learning__lesson-title",children:a??n.title}),e.jsx(xa,{total:q.length,currentIndex:L,answeredIds:we,questions:q,answeredCount:Xe,onJump:v?B:void 0,t:w}),e.jsx("p",{className:"es-learning__prompt",children:J.prompt}),Z?e.jsxs("div",{className:"es-learning__open",children:[e.jsx("textarea",{className:"es-learning__textarea",value:G[U]??"",onChange:k=>Y(A=>({...A,[U]:k.target.value})),placeholder:w("learning.open_answer_placeholder"),"aria-label":w("learning.open_answer_aria"),rows:5,disabled:t}),e.jsx("p",{className:"es-learning__hint",children:w("learning.open_answer_hint")})]}):null,!Z&&e.jsx("div",{className:"es-learning__options",role:"radiogroup","aria-label":w("learning.options_aria"),children:(J.options??[]).map((k,A)=>e.jsxs("label",{className:`es-learning__option${ve===A?" es-learning__option--selected":""}`,children:[e.jsx("input",{type:"radio",name:`learning-option-${J.questionId}`,checked:ve===A,onChange:()=>X(A),disabled:t}),e.jsx("span",{className:"es-learning__option-letter",children:String.fromCharCode(65+A)}),e.jsx("span",{className:"es-learning__option-text",children:k})]},A))}),e.jsxs("footer",{className:"es-learning__actions",children:[v?e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--ghost",onClick:()=>B(k=>Math.max(0,k-1)),disabled:t||L===0,children:[e.jsx(He,{}),w("learning.previous_question")]}):e.jsx("span",{}),V?e.jsx("button",{type:"button",className:"es-learning__btn",onClick:()=>{ke()},disabled:t||!ae,children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),w("learning.checking")]}):w("learning.finish_quiz")}):e.jsx("button",{type:"button",className:"es-learning__btn",onClick:()=>{H()},disabled:t||!_e(U),children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),w("learning.checking")]}):e.jsxs(e.Fragment,{children:[w("learning.next_question"),e.jsx(fe,{})]})})]})]})}function xa({total:n,currentIndex:s,answeredIds:a,questions:l,answeredCount:r,onJump:t,t:_}){return e.jsxs("div",{className:"es-learning__progress",children:[e.jsx("div",{className:"es-learning__track",children:l.map((j,o)=>{const x=["es-learning__seg",a[j.questionId]!==void 0?"es-learning__seg--done":"",o===s?"es-learning__seg--current":""].filter(Boolean).join(" ");return t?e.jsx("button",{type:"button",className:x,onClick:()=>t(o),"aria-label":_("learning.go_to_question",{n:o+1}),"aria-current":o===s?"step":void 0},j.questionId):e.jsx("span",{className:x},j.questionId)})}),e.jsxs("span",{className:"es-learning__progress-count",children:[r,"/",n]})]})}function ja({results:n,questions:s,mascot:a,onContinue:l,continueLabel:r,t}){const _=n.total>0?Math.round(n.correct/n.total*100):0,j=(o,x)=>s.find(b=>b.questionId===o)?.prompt??x;return e.jsxs("section",{className:"es-learning__results","aria-label":t("learning.results_aria"),children:[e.jsxs("div",{className:"es-learning__score",children:[e.jsx(Ne,{name:a,size:28,className:"es-learning__mascot--score"}),e.jsxs("span",{className:"es-learning__score-value",children:[n.correct,"/",n.total]}),e.jsx("div",{className:"es-learning__score-bar",style:{"--es-learning-score":`${_}`},role:"img","aria-label":t("learning.quiz_result",{correct:n.correct,total:n.total})})]}),typeof n.passed=="boolean"&&typeof n.passPercent=="number"&&e.jsx("p",{className:`es-learning__pass es-learning__pass--${n.passed?"yes":"no"}`,children:t(n.passed?"learning.section_quiz_passed":"learning.section_quiz_failed",{percent:n.passPercent})}),n.rows&&n.rows.length>0&&e.jsx("ol",{className:"es-learning__review",children:n.rows.map(o=>e.jsxs("li",{className:`es-learning__review-row es-learning__review-row--${o.verdict}`,children:[e.jsx("span",{className:"es-learning__review-mark","aria-hidden":"true",children:o.verdict==="correct"?e.jsx(oe,{}):o.verdict==="wrong"?e.jsx(Te,{}):e.jsx(qn,{})}),e.jsxs("div",{className:"es-learning__review-body",children:[e.jsx("p",{className:"es-learning__review-prompt",children:j(o.questionId,o.prompt)}),(()=>{const x=o.answerText??(o.selectedOptionIndex!==null?o.options?.[o.selectedOptionIndex]??null:null);return x?e.jsx("p",{className:"es-learning__review-answer",children:t("learning.your_answer",{answer:x})}):null})(),o.feedback&&e.jsx("p",{className:"es-learning__review-feedback",children:o.feedback}),o.verdict!=="correct"&&o.correctAnswer&&e.jsx("p",{className:"es-learning__review-correct",children:t("learning.correct_answer",{answer:o.correctAnswer})}),o.explanation&&e.jsx(zn,{children:o.explanation})]})]},o.questionId))}),l&&e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--block",onClick:l,children:[r??t("learning.continue"),e.jsx(fe,{})]})]})}function fa({prompt:n,lessonTitle:s,answer:a,feedback:l,busy:r,showExplanations:t,onChange:_,onSubmit:j,t:o}){return e.jsxs("section",{className:"es-learning__question","aria-label":o("learning.question_aria"),children:[e.jsx("p",{className:"es-learning__eyebrow",children:s}),e.jsx("p",{className:"es-learning__prompt",children:n}),l?e.jsx(ba,{feedback:l,showExplanations:t,t:o}):e.jsxs(e.Fragment,{children:[e.jsx("textarea",{className:"es-learning__textarea",rows:5,value:a,onChange:x=>_(x.target.value),placeholder:o("learning.open_answer_placeholder"),"aria-label":o("learning.open_answer_aria"),disabled:r}),e.jsx("footer",{className:"es-learning__actions es-learning__actions--end",children:e.jsx("button",{type:"button",className:"es-learning__btn",onClick:j,disabled:r||!a.trim(),children:o(r?"learning.checking":"learning.submit_answer")})})]})]})}function ba({feedback:n,showExplanations:s,t:a}){const l=n.verdict==="correct"?e.jsx(oe,{size:18}):n.verdict==="wrong"?e.jsx(Te,{size:18}):e.jsx(qn,{size:18}),r=n.verdict==="correct"?a("learning.verdict_correct"):n.verdict==="wrong"?a("learning.verdict_wrong"):a("learning.verdict_ungradeable");return e.jsxs("div",{className:`es-learning__feedback es-learning__feedback--${n.verdict}`,role:"status",children:[e.jsxs("p",{className:"es-learning__verdict",children:[e.jsx("span",{className:"es-learning__verdict-icon","aria-hidden":"true",children:l}),r]}),n.feedback&&e.jsx("p",{className:"es-learning__feedback-text",children:n.feedback}),s&&n.explanation&&e.jsx(zn,{children:n.explanation})]})}const wa={all_in_cooldown:e.jsx(Qn,{}),not_due_yet:e.jsx(Qn,{}),all_mastered:e.jsx(ta,{}),no_curriculum:e.jsx(ra,{}),unavailable:e.jsx(oa,{})},Na={all_in_cooldown:{title:"learning.empty_cooldown_title",body:"learning.empty_cooldown"},not_due_yet:{title:"learning.next_lesson_title",body:"learning.next_lesson_body"},all_mastered:{title:"learning.empty_all_mastered_title",body:"learning.empty_all_mastered"},no_curriculum:{title:"learning.empty_no_curriculum_title",body:"learning.empty_no_curriculum"},unavailable:{title:"learning.unavailable_title",body:"learning.unavailable"}},va=new Set(["all_in_cooldown","all_mastered","not_due_yet"]);function ka(n){const[s,a]=g.useState(()=>Date.now());if(g.useEffect(()=>{if(!n)return;const t=setInterval(()=>a(Date.now()),6e4);return()=>clearInterval(t)},[n]),!n)return null;const l=new Date(n).getTime();if(!Number.isFinite(l))return null;const r=Math.max(0,Math.ceil((l-s)/6e4));return{hours:Math.floor(r/60),minutes:r%60}}function kn({kind:n,mascot:s,nextDueAt:a,t:l}){const{title:r,body:t}=Na[n],_=s!=="none"&&va.has(n),j=ka(n==="not_due_yet"?a:void 0);return e.jsxs("div",{className:`es-learning__state es-learning__state--${n}`,role:"status",children:[_?e.jsx(Ne,{name:s}):e.jsx("span",{className:"es-learning__state-icon","aria-hidden":"true",children:wa[n]}),e.jsx("p",{className:"es-learning__state-title",children:l(r)}),e.jsx("p",{className:"es-learning__state-body",children:l(t)}),j&&e.jsx("p",{className:"es-learning__countdown",children:j.hours>0?l("learning.next_lesson_in_hm",{hours:j.hours,minutes:j.minutes}):l("learning.next_lesson_in_m",{minutes:j.minutes})})]})}function cs({lesson:n,index:s,onIndexChange:a,answers:l,onAnswer:r,busy:t,onDone:_,doneLabel:j,doneGoesBack:o=!1,onBackToTopic:x,rating:b,readAloud:p,readAloudRef:f,t:m}){const w=n.slides??[],q=w.length,v=w[s];if(!v)return null;const I=v.check??null,P=l[v.id],T=!I||P!==void 0,K=s===q-1;return e.jsxs("section",{className:"es-learning__lesson","aria-label":m("learning.lesson_aria"),children:[e.jsx(is,{topicTitle:n.topicTitle,onBackToTopic:x,t:m}),e.jsx("div",{className:"es-learning__slide-dots","aria-hidden":"true",children:w.map((u,E)=>e.jsx("span",{className:`es-learning__slide-dot${E<=s?" es-learning__slide-dot--on":""}`},u.id))}),e.jsx(se,{graphicRef:v.graphicRef??n.graphicRef,graphicAlt:v.graphicAlt??n.graphicAlt,graphicUrl:v.graphicUrl??n.graphicUrl}),e.jsxs("div",{className:"es-learning__lesson-readable",ref:f,children:[e.jsx("h4",{className:"es-learning__lesson-title",style:{fontSize:16},children:v.title}),e.jsx(ss,{media:n.media,t:m,children:v.body})]}),p&&e.jsx("div",{className:"es-learning__lesson-readaloud",children:p}),I&&e.jsxs("div",{className:`es-learning__slide-check${T?P===I.correctIndex?" es-learning__slide-check--good":" es-learning__slide-check--bad":""}`,children:[e.jsx("p",{className:"es-learning__slide-check-prompt",children:I.prompt}),e.jsx("div",{className:"es-learning__slide-check-options",children:I.options.map((u,E)=>{const G=P===E,Y=E===I.correctIndex,be=["es-learning__slide-choice",T&&G&&Y?"es-learning__slide-choice--good":"",T&&G&&!Y?"es-learning__slide-choice--bad":"",T&&Y&&!G?"es-learning__slide-choice--reveal":""].filter(Boolean).join(" ");return e.jsxs("button",{type:"button",className:be,disabled:T||t,onClick:()=>r(v.id,E),children:[T&&G&&e.jsx("span",{className:"es-learning__slide-choice-icon","aria-hidden":"true",children:Y?e.jsx(oe,{size:14}):e.jsx(Te,{size:14})}),e.jsx("span",{children:u})]},E)})}),T&&e.jsx("p",{className:`es-learning__slide-check-fb${P===I.correctIndex?" es-learning__slide-check-fb--good":" es-learning__slide-check-fb--bad"}`,children:P===I.correctIndex?I.feedbackCorrect:I.feedbackIncorrect})]}),e.jsxs("div",{className:"es-learning__deck-foot",children:[K&&T&&b,!T&&e.jsx("p",{className:"es-learning__hint",children:m("learning.slide_check_required")}),e.jsxs("footer",{className:"es-learning__actions es-learning__actions--captioned",children:[e.jsxs("button",{type:"button",className:"es-learning__btn es-learning__btn--ghost",onClick:()=>a(s-1),disabled:t||s===0,children:[e.jsx(He,{}),m("learning.previous_question")]}),e.jsx("p",{className:"es-learning__slide-caption",children:m("learning.slide_caption",{n:s+1,total:q})}),K?e.jsx("button",{type:"button",className:"es-learning__btn",onClick:_,disabled:t||!T,children:t?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__spinner","aria-hidden":"true"}),m("learning.loading")]}):e.jsxs(e.Fragment,{children:[o&&e.jsx(He,{}),j??m("learning.lesson_done"),!o&&e.jsx(fe,{})]})}):e.jsxs("button",{type:"button",className:"es-learning__btn",onClick:()=>a(s+1),disabled:t||!T,children:[m("learning.next_question"),e.jsx(fe,{})]})]})]})]})}function ya({rows:n,t:s}){const[a,l]=g.useState(!1);if(n.length===0)return e.jsx("p",{className:"es-learning__hint",children:s("learning.review_unavailable")});const r=n.filter(t=>t.verdict==="correct").length;return e.jsxs("div",{className:"es-learning__review-block",children:[e.jsxs("button",{type:"button",className:`es-learning__review-toggle${a?" es-learning__review-toggle--open":""}`,"aria-expanded":a,onClick:()=>l(t=>!t),children:[e.jsx("span",{className:"es-learning__review-heading",children:s("learning.your_answers")}),e.jsx("span",{className:"es-learning__review-score",children:s("learning.review_score",{correct:r,total:n.length})}),e.jsx("span",{className:"es-learning__review-chevron","aria-hidden":"true",children:e.jsx(Cn,{size:14})})]}),a?e.jsx("ol",{className:"es-learning__review",children:n.map(t=>{const _=t.answerText??(t.selectedOptionIndex!==null?t.options?.[t.selectedOptionIndex]??null:null);return e.jsxs("li",{className:`es-learning__review-row es-learning__review-row--${t.verdict}`,children:[e.jsx("span",{className:"es-learning__review-mark","aria-hidden":"true",children:t.verdict==="correct"?e.jsx(oe,{}):t.verdict==="wrong"?e.jsx(Te,{}):e.jsx(qn,{})}),e.jsxs("div",{className:"es-learning__review-body",children:[e.jsx("p",{className:"es-learning__review-prompt",children:t.prompt}),t.options&&t.options.length>0?e.jsx("ul",{className:"es-learning__review-options",children:t.options.map((j,o)=>{const x=o===t.selectedOptionIndex,b=t.correctAnswer!==null&&j===t.correctAnswer;return e.jsxs("li",{className:`es-learning__review-option es-learning__review-option--${b?"correct":x?"picked":"plain"}`,children:[e.jsx("span",{className:"es-learning__review-option-mark","aria-hidden":"true",children:b?e.jsx(oe,{size:12}):x?e.jsx(Te,{size:12}):null}),e.jsx("span",{className:"es-learning__review-option-text",children:j}),(x||b)&&e.jsx("span",{className:"es-learning__review-option-tag",children:s(x?"learning.answer_tag_yours":"learning.answer_tag_correct")})]},o)})}):e.jsxs("div",{className:"es-learning__review-pair",children:[_&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__review-pair-label",children:s("learning.answer_tag_yours")}),e.jsx("span",{className:"es-learning__review-pair-value es-learning__review-pair-value--yours",children:_})]}),t.verdict!=="correct"&&t.correctAnswer&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"es-learning__review-pair-label",children:s("learning.answer_tag_correct")}),e.jsx("span",{className:"es-learning__review-pair-value es-learning__review-pair-value--correct",children:t.correctAnswer})]})]}),t.feedback&&e.jsx("p",{className:"es-learning__review-feedback",children:t.feedback}),t.explanation&&e.jsx(zn,{children:t.explanation})]})]},t.questionId)})}):null]})}function Jn({lesson:n,slideIndex:s,onSlideIndexChange:a,slideAnswers:l,onSlideAnswer:r,onBack:t,backLabel:_,showBackLink:j=!0,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,onFinish:f,finishLabel:m,review:w,t:q}){const v=(n.slides?.length??0)>0,I=f??t,P=f?m??_:_,T=!!o&&!f;return e.jsxs("div",{className:`es-learning__reader${w?" es-learning__reader--reviewed":""}`,children:[j&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:t,children:["← ",_]}),v?e.jsx(cs,{lesson:n,index:s,onIndexChange:a,answers:l,onAnswer:r,busy:!1,onDone:I,doneLabel:P,doneGoesBack:T,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,t:q}):e.jsx(rs,{lesson:n,busy:!1,onDone:I,doneLabel:P,doneGoesBack:T,onBackToTopic:o,rating:x,readAloud:b,readAloudRef:p,t:q}),w&&e.jsx(ya,{rows:w,t:q})]})}function Ia({graphicRef:n,graphicUrl:s,graphicAlt:a,done:l}){const r=Le(n);if(!r)return null;const t=l?" es-learning__lesson-thumb--done":"";if(r.kind==="media")return s?e.jsx("img",{src:s,alt:a??"",loading:"lazy",className:`es-learning__lesson-thumb es-learning__lesson-thumb--image${t}`,"data-testid":"lesson-thumb-image"}):null;const _=Ye(r.slug);return _?e.jsx("span",{className:`es-learning__lesson-thumb${t}`,"aria-hidden":"true","data-testid":"lesson-thumb-icon",children:e.jsx(_,{size:20})}):null}function Sn({iconRef:n,iconUrl:s}){const a=Le(n);if(!a)return null;if(a.kind==="media")return s?e.jsx("img",{src:s,alt:"","aria-hidden":"true",loading:"lazy",className:"es-learning__topic-icon es-learning__topic-icon--image","data-testid":"topic-icon-image"}):null;const l=Ye(a.slug);return l?e.jsx("span",{className:"es-learning__topic-icon","aria-hidden":"true","data-testid":"topic-icon",children:e.jsx(l,{size:16})}):null}function ds({topics:n,onOpen:s,t:a}){return n.length===0?e.jsx("p",{className:"es-learning__hint",children:a("learning.empty_no_curriculum")}):e.jsx("section",{className:"es-learning__topics-view","aria-label":a("learning.nav_topics"),children:e.jsx("ul",{className:"es-learning__topic-cards",children:n.map(l=>{const r=l.lessonCount>0?Math.round(l.doneCount/l.lessonCount*100):0,t=l.doneCount===l.lessonCount&&l.lessonCount>0,_=as(l.heroRef,l.heroUrl);return e.jsx("li",{children:e.jsxs("button",{type:"button",className:"es-learning__topic-card",onClick:()=>s(l.topicId),children:[e.jsx(se,{graphicRef:l.heroRef,graphicAlt:l.heroAlt,graphicUrl:l.heroUrl,done:t}),e.jsxs("span",{className:"es-learning__topic-card-head",children:[!_&&e.jsx(Sn,{iconRef:l.iconRef,iconUrl:l.iconUrl}),e.jsx("span",{className:"es-learning__topic-card-title",children:l.title}),t&&e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})})]}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${r}%`}})}),e.jsx("span",{className:"es-learning__topic-card-meta",children:a("learning.topic_progress",{mastered:l.doneCount,total:l.lessonCount})})]})},l.topicId)})})})}const Ve=["basics","intermediate","advanced","expert"],za={basics:"learning.level_basics",intermediate:"learning.level_intermediate",advanced:"learning.level_advanced",expert:"learning.level_expert"};function qa({level:n,t:s}){const a=Ve.indexOf(n)+1,l=Ve.length;return e.jsx("span",{className:"es-learning__level-stars",role:"img","aria-label":s("learning.level_difficulty",{n:a,total:l}),"data-testid":"learning-level-stars",children:Ve.map((r,t)=>e.jsx("span",{"aria-hidden":"true",className:`es-learning__level-star${t<a?" es-learning__level-star--on":""}`,children:"★"},t))})}const Ke=n=>n.lessonCount>0&&n.doneCount===n.lessonCount;function Ca({tracks:n,untracked:s=[],currentTrackId:a,onOpenTrack:l,onOpenUntracked:r,t}){const _=n.filter(o=>o.topicCount>0);if(_.length===0&&s.length===0)return e.jsx("p",{className:"es-learning__hint",children:t("learning.empty_no_curriculum")});const j=s.filter(Ke).length;return e.jsxs("section",{className:"es-learning__tracks-view","aria-label":t("learning.tracks_heading"),children:[e.jsx("div",{className:"es-learning__infobar es-learning__infobar--intro",children:e.jsxs("p",{className:"es-learning__infobar-text",children:[t("learning.tracks_intro"),_.length>1&&e.jsxs(e.Fragment,{children:[" ",e.jsx("strong",{children:t("learning.track_independent_hint")})]})]})}),e.jsxs("ul",{className:"es-learning__tracks",children:[_.map(o=>{const x=o.topicCount>0?Math.round(o.doneTopicCount/o.topicCount*100):0,b=as(o.heroRef,o.heroUrl),p=o.topicCount>0&&o.doneTopicCount===o.topicCount;return e.jsx("li",{children:e.jsxs("button",{type:"button",className:`es-learning__track-card${o.trackId===a?" es-learning__track-card--current":""}`,onClick:()=>l(o.trackId),children:[e.jsx(se,{graphicRef:o.heroRef,graphicAlt:o.heroAlt,graphicUrl:o.heroUrl,done:p}),e.jsxs("span",{className:"es-learning__track-card-head",children:[!b&&e.jsx("span",{className:"es-learning__track-icon",children:e.jsx(Sn,{iconRef:o.iconRef,iconUrl:o.iconUrl})}),e.jsx("span",{className:"es-learning__track-card-title",children:o.title}),p&&e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})})]}),o.description&&e.jsx("span",{className:"es-learning__track-card-desc",children:o.description}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${x}%`}})}),e.jsx("span",{className:"es-learning__track-card-meta",children:t("learning.track_progress",{done:o.doneTopicCount,total:o.topicCount})})]})},o.trackId)}),s.length>0&&e.jsx("li",{children:e.jsxs("button",{type:"button",className:"es-learning__track-card",onClick:()=>r?.(),children:[e.jsx("span",{className:"es-learning__track-card-head",children:e.jsx("span",{className:"es-learning__track-card-title",children:t("learning.track_unassigned")})}),e.jsx("span",{className:"es-learning__track-card-meta",children:t("learning.track_progress",{done:j,total:s.length})})]})})]})]})}function Sa({track:n,currentTopicId:s,onOpenTopic:a,onBack:l,t:r}){const t=new Set(n.topics.filter(Ke).map(b=>b.topicId)),_=n.topics.find(b=>b.topicId===s),j=_?.unlocks??[],o=Ve.map(b=>({level:b,topics:n.topics.filter(p=>(p.level??"basics")===b)})).filter(b=>b.topics.length>0),x=n.topicCount>0?Math.round(n.doneTopicCount/n.topicCount*100):0;return e.jsxs("section",{className:"es-learning__roadmap-view","aria-label":n.title,children:[e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:l,children:["← ",r("learning.tracks_heading")]}),e.jsxs("div",{className:"es-learning__detail-head",children:[e.jsx("h4",{className:"es-learning__detail-title",children:n.title}),e.jsxs("div",{className:"es-learning__progress-line",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${x}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:r("learning.track_progress",{done:n.doneTopicCount,total:n.topicCount})})]})]}),_&&j.length>0&&e.jsxs("div",{className:"es-learning__unlocks",children:[e.jsx("span",{className:"es-learning__unlocks-lead",children:r("learning.unlocks_lead",{topic:_.title})}),e.jsx("ul",{className:"es-learning__unlocks-list",children:j.map(b=>e.jsx("li",{children:b.title},b.topicId))})]}),e.jsx("div",{className:"es-learning__infobar es-learning__infobar--order",children:e.jsxs("p",{className:"es-learning__infobar-text",children:[e.jsx("strong",{children:r("learning.roadmap_heading")})," — ",r("learning.roadmap_why")]})}),e.jsx("ul",{className:"es-learning__levels",children:o.map(b=>e.jsxs("li",{children:[e.jsxs("span",{className:"es-learning__level-head",children:[e.jsx("span",{className:"es-learning__level-name",children:r(za[b.level])}),e.jsx("span",{className:"es-learning__level-rule","aria-hidden":"true"}),e.jsx(qa,{level:b.level,t:r})]}),e.jsx("ul",{className:"es-learning__level-topics",children:b.topics.map(p=>{const f=p.prerequisites??[],m=f.some(I=>!t.has(I.topicId)),w=ls(p.heroRef,p.heroUrl),q=Ke(p),v=["es-learning__road-row",w?"es-learning__road-row--card":"",m?"es-learning__road-row--ahead":"",p.topicId===s?"es-learning__road-row--current":""].filter(Boolean).join(" ");return e.jsx("li",{children:e.jsxs("button",{type:"button",className:v,onClick:()=>a(p.topicId),children:[w?e.jsx(se,{graphicRef:p.heroRef,graphicAlt:p.heroAlt,graphicUrl:p.heroUrl,variant:"card",done:q}):e.jsx(Sn,{iconRef:p.iconRef,iconUrl:p.iconUrl}),e.jsxs("span",{className:"es-learning__road-body",children:[e.jsx("span",{className:"es-learning__road-title",children:p.title}),f.length>0&&e.jsx("span",{className:"es-learning__road-needs",children:r("learning.topic_after",{names:f.map(I=>I.title).join(", ")})}),e.jsx("span",{className:"es-learning__track-card-meta",children:r("learning.topic_progress",{mastered:p.doneCount,total:p.lessonCount})})]}),q?e.jsx("span",{className:"es-learning__topic-card-done","aria-hidden":"true",children:e.jsx(oe,{size:14})}):e.jsx("span",{className:"es-learning__lesson-open","aria-hidden":"true",children:e.jsx(Cn,{size:14})})]})},p.topicId)})})]},b.level))})]})}const Aa={mastered:"learning.state_mastered",done:"learning.state_done",gap:"learning.state_in_progress",current:"learning.state_current",unseen:"learning.state_locked"},Ta=n=>n==="mastered"||n==="done",La="learning.state_available";function Ma({topic:n,onOpenLesson:s,onStartSectionQuiz:a,canPickAnyLesson:l=!1,backLabel:r,onBack:t,t:_}){const j=n.lessonCount>0?Math.round(n.doneCount/n.lessonCount*100):0;return e.jsxs("section",{className:"es-learning__topic-detail","aria-label":n.title,children:[r&&t&&e.jsxs("button",{type:"button",className:"es-learning__backlink",onClick:t,"aria-label":_("learning.back_to_track",{track:r}),children:["← ",r]}),e.jsxs("div",{className:"es-learning__detail-head",children:[!(r&&t)&&e.jsx("p",{className:"es-learning__eyebrow",children:_("learning.nav_topics")}),e.jsx("h4",{className:"es-learning__detail-title",children:n.title}),e.jsx(se,{graphicRef:n.heroRef,graphicAlt:n.heroAlt,graphicUrl:n.heroUrl,variant:"hero",done:Ke(n)}),e.jsxs("div",{className:"es-learning__progress-block",children:[e.jsx("span",{className:"es-learning__sec-label",children:_("learning.topic_lessons_done")}),e.jsxs("div",{className:"es-learning__progress-line",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${j}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:_("learning.progress_count",{done:n.doneCount,total:n.lessonCount})})]})]})]}),n.hasSectionQuiz===!0&&a&&e.jsx("button",{type:"button",className:"es-learning__btn es-learning__btn--block es-learning__btn--ghost es-learning__section-cta",onClick:a,children:_("learning.section_quiz_cta")}),e.jsxs("div",{className:"es-learning__list-block",children:[e.jsx("p",{className:"es-learning__list-divider",children:e.jsx("span",{className:"es-learning__sec-label",children:_("learning.topic_lesson_list")})}),e.jsx("ol",{className:"es-learning__lesson-list",children:n.lessons.map(o=>{const x=l||o.servedAt!==null||o.state==="mastered"||o.state==="done"||o.state==="current",b=x?"button":"div",p=ls(o.graphicRef,o.graphicUrl),f=x&&o.state==="unseen"?"available":o.state,m=_(x&&o.state==="unseen"?La:Aa[o.state]),w=o.servedAt===null&&o.state==="mastered",q=Ta(o.state);return p?e.jsx("li",{children:e.jsxs(b,{...x?{type:"button",onClick:()=>s(o)}:{},className:`es-learning__lesson-card es-learning__lesson-card--${o.state}${x?"":" es-learning__lesson-card--locked"}`,"aria-disabled":x?void 0:!0,children:[e.jsx(se,{graphicRef:o.graphicRef,graphicUrl:o.graphicUrl,graphicAlt:o.graphicAlt,variant:"card",done:q}),e.jsx("span",{className:"es-learning__lesson-card-title",children:o.title}),(o.isMilestone||w)&&e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[o.isMilestone&&_("learning.milestone"),w&&`${o.isMilestone?" · ":""}${_("learning.not_delivered")}`]}),e.jsxs("span",{className:"es-learning__lesson-card-foot",children:[e.jsx("span",{className:`es-learning__lesson-chip es-learning__lesson-chip--${f}`,children:m}),!x&&e.jsx("span",{className:"es-learning__lesson-lock","aria-hidden":"true",children:e.jsx(Wn,{})})]})]})},o.lessonId):e.jsx("li",{children:e.jsxs(b,{...x?{type:"button",onClick:()=>s(o)}:{},className:`es-learning__lesson-row es-learning__lesson-row--${o.state}${x?"":" es-learning__lesson-row--locked"}`,"aria-disabled":x?void 0:!0,children:[e.jsx(Ia,{graphicRef:o.graphicRef,graphicUrl:o.graphicUrl,graphicAlt:o.graphicAlt,done:q}),e.jsxs("span",{className:"es-learning__lesson-row-body",children:[e.jsx("span",{className:"es-learning__lesson-row-title",children:o.title}),e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[o.isMilestone?_("learning.milestone"):n.title,w&&` · ${_("learning.not_delivered")}`]}),e.jsx("span",{className:`es-learning__lesson-chip es-learning__lesson-chip--${f}`,children:m})]}),x?e.jsx("span",{className:"es-learning__lesson-open","aria-hidden":"true",children:e.jsx(Cn,{size:14})}):e.jsx("span",{className:"es-learning__lesson-lock","aria-hidden":"true",children:e.jsx(Wn,{})})]})},o.lessonId)})})]})]})}function $a({view:n,browse:s,mascot:a,slidePositions:l,newsTile:r,onGoToday:t,onOpenLesson:_,onOpenTopic:j,t:o}){const x=s?.summary?.doneLessons??0,b=s?.summary?.totalLessons??0,p=b>0?Math.round(x/b*100):0,f=s?.streak??{currentStreak:0,longestStreak:0},m=(s?.topics??[]).flatMap(v=>(v.lessons??[]).map(I=>({topic:v,lesson:I}))).filter(({lesson:v})=>v.servedAt!==null&&!v.done).sort((v,I)=>(I.lesson.servedAt??"").localeCompare(v.lesson.servedAt??"")).slice(0,3),w=s?.summary?.attempts?.[0]??null,q=s?.topics??[];return e.jsxs("section",{className:"es-learning__dashboard","aria-label":o("learning.nav_dashboard"),children:[e.jsx(Oa,{view:n,mascot:a,onGoToday:t,t:o}),s&&e.jsxs("div",{className:"es-learning__stats-deck",children:[e.jsxs("div",{className:"es-learning__stats-cell es-learning__stats-cell--ring",children:[e.jsxs("div",{className:"es-learning__ring",role:"img","aria-label":o("learning.dashboard_mastered_label",{pct:p}),style:{"--es-learning-ring":`${p}`},children:[e.jsx("span",{className:"es-learning__ring-value",children:p}),e.jsx("span",{className:"es-learning__ring-unit",children:"%"})]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_mastered")})]}),e.jsx("span",{className:"es-learning__stats-divider","aria-hidden":"true"}),e.jsxs("div",{className:"es-learning__stats-cell",children:[e.jsxs("span",{className:"es-learning__stats-n",children:[x,"/",b]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_lessons_done")})]}),e.jsx("span",{className:"es-learning__stats-divider","aria-hidden":"true"}),e.jsxs("div",{className:"es-learning__stats-cell es-learning__stats-cell--streak",children:[e.jsxs("span",{className:"es-learning__stats-n",children:[e.jsx(_a,{size:15}),f.currentStreak]}),e.jsx("span",{className:"es-learning__stats-l",children:o("learning.dashboard_streak")}),f.longestStreak>f.currentStreak&&e.jsx("span",{className:"es-learning__stats-sub",children:o("learning.dashboard_best_streak",{n:f.longestStreak})})]})]}),m.length>0&&_&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.dashboard_inprogress_title")}),m.map(({topic:v,lesson:I})=>e.jsx(Ua,{topicTitle:v.title,lesson:I,position:l?.[I.lessonId],onOpen:()=>_(v.topicId,I),t:o},I.lessonId))]}),r,w&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.dashboard_last_quiz")}),e.jsx("ul",{className:"es-learning__attempt-list",children:e.jsxs("li",{className:"es-learning__attempt",children:[e.jsx("span",{className:"es-learning__attempt-title",children:w.title}),e.jsx(Ra,{correct:w.correct,total:w.total,t:o})]})})]}),j&&q.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:o("learning.nav_topics")}),e.jsx(ds,{topics:q,onOpen:j,t:o})]})]})}function Ra({correct:n,total:s,t:a}){return s<=0?e.jsx("span",{className:"es-learning__attempt-score",children:a("learning.review_score",{correct:n,total:s})}):e.jsx("span",{className:"es-learning__attempt-segs",role:"img","aria-label":a("learning.attempt_score_a11y",{correct:n,total:s}),"data-testid":"learning-attempt-segments",children:Array.from({length:s},(l,r)=>e.jsx("span",{"aria-hidden":"true",className:`es-learning__attempt-seg es-learning__attempt-seg--${r<n?"good":"bad"}`},r))})}function Ua({topicTitle:n,lesson:s,position:a,onOpen:l,t:r}){const t=!!a&&a.total>0,_=a&&t?Math.round((a.index+1)/a.total*100):0;return e.jsxs("button",{type:"button",className:"es-learning__continue",onClick:l,children:[e.jsxs("span",{className:"es-learning__continue-row",children:[e.jsx(se,{graphicRef:s.graphicRef,graphicUrl:s.graphicUrl,graphicAlt:s.graphicAlt,variant:"continue"}),e.jsxs("span",{className:"es-learning__continue-body",children:[e.jsx("span",{className:"es-learning__continue-title",children:s.title}),e.jsx("span",{className:"es-learning__lesson-row-meta",children:n})]})]}),a&&t&&e.jsxs("span",{className:"es-learning__continue-bar",children:[e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${_}%`}})}),e.jsx("span",{className:"es-learning__progress-count",children:r("learning.slide_caption",{n:a.index+1,total:a.total})})]})]})}function Oa({view:n,mascot:s,onGoToday:a,t:l}){if(!n)return null;if(n.mode==="new_information"){const r=n.lesson.slides?.length??0;return e.jsxs("button",{type:"button",className:"es-learning__today-card es-learning__today-card--hero",onClick:a,children:[e.jsx(se,{graphicRef:n.lesson.graphicRef,graphicUrl:n.lesson.graphicUrl,graphicAlt:n.lesson.graphicAlt,variant:"today"}),e.jsxs("span",{className:"es-learning__today-inner",children:[e.jsx("span",{className:"es-learning__eyebrow",children:l("learning.dashboard_today_eyebrow")}),e.jsx("strong",{className:"es-learning__today-card-title",children:n.lesson.title}),e.jsxs("span",{className:"es-learning__lesson-row-meta",children:[n.lesson.topicTitle,r>0&&` · ${l("learning.slide_count",{total:r})}`]})]})]})}if(n.mode==="checking_question"||n.mode==="lesson_quiz"||n.mode==="section_quiz"||n.mode==="placement_quiz"){const r=n.mode==="checking_question"?null:n.quiz;return e.jsxs("button",{type:"button",className:"es-learning__today-card es-learning__today-card--gold",onClick:a,children:[e.jsx("span",{className:"es-learning__eyebrow",children:l("learning.dashboard_today_eyebrow")}),e.jsx("strong",{className:"es-learning__today-card-title",children:l("learning.dashboard_continue")}),r&&e.jsx("span",{className:"es-learning__lesson-row-meta",children:l("learning.quiz_progress",{answered:r.answered,total:r.total})})]})}return n.mode==="nothing"?e.jsx("div",{className:"es-learning__today-card",children:e.jsx(kn,{kind:n.reason,mascot:s,nextDueAt:n.nextDueAt,t:l})}):null}function Ba({browse:n,t:s}){const{topics:a,summary:l}=n;return e.jsxs("section",{className:"es-learning__progress-view","aria-label":s("learning.nav_progress"),children:[e.jsxs("div",{children:[e.jsx("p",{className:"es-learning__sec-label",children:s("learning.progress_topics_title")}),e.jsx("p",{className:"es-learning__hint",children:s("learning.progress_overall",{mastered:l.doneLessons,total:l.totalLessons})})]}),e.jsx("ul",{className:"es-learning__by-topic",children:a.map(r=>{const t=r.lessonCount>0?Math.round(r.doneCount/r.lessonCount*100):0;return e.jsxs("li",{className:"es-learning__by-topic-row",children:[e.jsx("span",{className:"es-learning__by-topic-title",children:r.title}),e.jsxs("span",{className:"es-learning__by-topic-count",children:[r.doneCount,"/",r.lessonCount]}),e.jsx("span",{className:"es-learning__meter","aria-hidden":"true",children:e.jsx("span",{className:"es-learning__meter-fill",style:{width:`${t}%`}})})]},r.topicId)})}),l.attempts.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"es-learning__sec-label",children:s("learning.quiz_history")}),e.jsx("ul",{className:"es-learning__attempt-list",children:l.attempts.map(r=>e.jsxs("li",{className:"es-learning__attempt",children:[e.jsx("span",{className:"es-learning__attempt-title",children:r.title}),e.jsxs("span",{className:"es-learning__attempt-score",children:[r.correct,"/",r.total]})]},r.attemptId??r.quizId))})]})]})}const Da="es-learning-place",Ea=10080*60*1e3;function us(n){return`${Da}:${n}`}function Vn(n,s){return!n||typeof n!="object"?{}:Object.fromEntries(Object.entries(n).filter(a=>typeof a[1]=="number"&&Number.isFinite(a[1])&&a[1]>=s))}const Pa=n=>n==="dashboard"||n==="today"||n==="topics"||n==="news"||n==="progress";function Fa(n,s){try{const a=localStorage.getItem(us(n));if(!a)return null;const l=JSON.parse(a);return!Pa(l.tab)||(l.ownerId??null)!==s||typeof l.savedAt!="number"||Date.now()-l.savedAt>Ea?null:{tab:l.tab,openTopicId:typeof l.openTopicId=="string"?l.openTopicId:null,readingLessonId:typeof l.readingLessonId=="string"?l.readingLessonId:null,slideIndex:Vn(l.slideIndex,0),slideTotals:Vn(l.slideTotals,1)}}catch{return null}}function Qa(n,s,a){try{const l={...a,ownerId:s,savedAt:Date.now()};localStorage.setItem(us(n),JSON.stringify(l))}catch{}}const Wa=".es-widget__content, .gaio-theme__content";function Ga(n){const s=n?.ownerDocument;if(!n||!s)return;let a=n;for(;a&&a!==s.body&&a!==s.documentElement;){if(a.scrollTop!==0&&(a.scrollTop=0),a.matches(Wa))return;a=a.parentElement}}const Ja="es-learning-rated";function gs(n){return`${Ja}:${n}`}function _s(n,s){const[a]=In(()=>{const l=localStorage.getItem(gs(n));if(!l)return null;const r=JSON.parse(l);return(r.ownerId??null)!==s||!Array.isArray(r.lessonIds)?null:new Set(r.lessonIds.filter(t=>typeof t=="string"))});return a??new Set}function Va(n,s,a){const l=_s(n,s);l.add(a);const r=[...l].slice(-500),t={ownerId:s,lessonIds:r};return In(()=>localStorage.setItem(gs(n),JSON.stringify(t))),new Set(r)}const Ha=["learning-load","learning-browse","learning-read-lesson","learning-lesson-review","learning-lesson-quiz","learning-news-load"],Ka=["learning-answer-quiz","learning-answer-quiz-open","learning-answer-open","learning-quiz-finish","learning-start-lesson","learning-complete-lesson"],Ya=300*1e3,ps=new Set(Ha),Ze=new Map;let Ae;function hs(n){n!==Ae&&(Ze.clear(),Ae=n)}function Za(n){return n?JSON.stringify(Object.keys(n).sort().map(s=>[s,String(n[s])])):""}function ms(n,s,a,l){return`${n}\0${s}\0${a}\0${Za(l)}`}function re(n,s,a,l,r=Date.now()){if(hs(s),s===null||!ps.has(a))return null;const t=Ze.get(ms(n,s,a,l));return t?{data:t.data,stale:r-t.storedAt>=Ya}:null}function ge(n,s,a,l,r,t=Date.now()){if(Ae===void 0)Ae=s;else if(s!==Ae)return;s===null||!ps.has(a)||Ze.set(ms(n,s,a,l),{data:r,storedAt:t})}function Hn(){Ze.clear()}function Xa(n){hs(n)}function el(n){return Ps(n)}function nl(n,s){if(!n)return null;const[a]=In(()=>{const l=new Date(n);return Number.isNaN(l.getTime())?null:new Intl.DateTimeFormat(s,{day:"numeric",month:"short"}).format(l)});return a??null}function sl(n,s){if(!n)return null;const a=n.split("-")[0]?.toLowerCase();return!a||a===s.split("-")[0]?.toLowerCase()?null:a.toUpperCase()}function yn({item:n,currentLanguage:s,onPick:a,t:l}){const r=nl(n.publishedAt,s),t=sl(n.language,s),_=n.sourceName??n.host;return e.jsx("button",{type:"button",className:`es-learning__news${n.read?" es-learning__news--read":""}`,onClick:()=>a(n),"data-testid":"learning-news-card",children:e.jsxs("span",{className:"es-learning__news-row",children:[e.jsx("span",{className:"es-learning__news-thumb",children:n.thumbnailUrl&&e.jsx("img",{src:n.thumbnailUrl,alt:"",loading:"lazy"})}),e.jsxs("span",{className:"es-learning__news-body",children:[e.jsx("span",{className:"es-learning__news-title",children:n.title}),e.jsxs("span",{className:"es-learning__news-meta",children:[_&&e.jsx("span",{children:_}),_&&r&&e.jsx("span",{"aria-hidden":"true",children:"·"}),r&&e.jsx("span",{children:r}),t&&e.jsx("span",{className:"es-learning__news-lang",children:t})]})]}),n.read?e.jsx("span",{className:"es-learning__news-done",role:"img","aria-label":l("learning.news_read"),children:e.jsx(oe,{size:13})}):e.jsx("span",{className:"es-learning__news-ext","aria-hidden":"true",children:e.jsx(ts,{size:14})})]})})}function al({item:n,currentLanguage:s,onPick:a,t:l}){return e.jsxs("div",{className:"es-learning__news-tile","data-testid":"learning-news-tile",children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_suggested_title")}),e.jsx(yn,{item:n,currentLanguage:s,onPick:a,t:l})]})}function ll({news:n,currentLanguage:s,onPick:a,t:l}){const r=n?.unread??[],t=n?.read??[];return r.length===0&&t.length===0?e.jsx("section",{className:"es-learning__dashboard","aria-label":l("learning.nav_news"),children:e.jsx("p",{className:"es-learning__news-empty",children:l("learning.news_empty")})}):e.jsxs("section",{className:"es-learning__dashboard","aria-label":l("learning.nav_news"),children:[r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_new_title")}),e.jsx("div",{className:"es-learning__news-list",children:r.map(_=>e.jsx(yn,{item:_,currentLanguage:s,onPick:a,t:l},_.id))})]}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"es-learning__sec-label",children:l("learning.news_read_title")}),e.jsx("div",{className:"es-learning__news-list",children:t.map(_=>e.jsx(yn,{item:_,currentLanguage:s,onPick:a,t:l},_.id))})]})]})}function il({item:n,onCancel:s,onConfirm:a,t:l}){const r=g.useRef(null);return g.useEffect(()=>{r.current?.focus()},[]),g.useEffect(()=>{const t=_=>{_.key==="Escape"&&s()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[s]),e.jsxs("div",{className:"es-learning__leave",role:"dialog","aria-modal":"true","aria-labelledby":"es-learning-leave-title","data-testid":"learning-news-leave",children:[e.jsx("div",{className:"es-learning__leave-scrim","aria-hidden":"true",onClick:s}),e.jsxs("div",{className:"es-learning__leave-card",children:[e.jsx("span",{className:"es-learning__leave-icon","aria-hidden":"true",children:e.jsx(ts,{size:22})}),e.jsx("p",{className:"es-learning__leave-title",id:"es-learning-leave-title",children:l("learning.news_leave_title")}),e.jsx("p",{className:"es-learning__leave-body",children:l("learning.news_leave_body")}),e.jsx("span",{className:"es-learning__leave-host",children:n.host}),e.jsxs("div",{className:"es-learning__leave-actions",children:[e.jsx("button",{type:"button",className:"es-learning__leave-btn es-learning__leave-btn--cancel",onClick:s,children:l("learning.news_leave_cancel")}),e.jsx("button",{ref:r,type:"button",className:"es-learning__leave-btn es-learning__leave-btn--go",onClick:a,children:l("learning.news_leave_confirm")})]})]})]})}function Kn(){const n=new Date,s=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,"0"),l=String(n.getDate()).padStart(2,"0");return`${s}-${a}-${l}`}function tl(n){return!!n&&typeof n=="object"&&typeof n.error=="string"}async function R(n,s,a){const[l]=await Ls(n.call(s,a));return!l||tl(l)?null:l}const Nn="__untracked__";function vn(n){return!!n&&Array.isArray(n.unread)&&Array.isArray(n.read)}function rl(n,s,a){const l=n.unread.find(r=>r.id===s);return{suggested:n.suggested?.id===s?n.suggested.pinned?{...n.suggested,read:!0}:null:n.suggested,unread:n.unread.filter(r=>r.id!==s),read:l?[{...l,read:!0},...n.read]:n.read,unreadCount:a}}function jl(n){const s=n.auth?.user?.id??null;return e.jsx(ol,{...n},`${n.productId}\0${s??"signed-out"}`)}function ol({config:n,data:s,actions:a,i18n:l,builderMode:r,productId:t,auth:_,baseUrl:j,externalContext:o,previewMode:x,readOnly:b}){const p=l?.t??(i=>i),f=l?.currentLanguage??"en",m=_?.user?.id??null,w=As(n.title,f,{t:p,fallbackKey:"learning.title",enDefault:"Learning"}),q=n.showExplanations!==!1,v=ha(n.mascot),I=n.showBrowse!==!1,P=I&&n.showDashboard!==!1,T=I&&n.showProgress===!0,K=I&&n.showNews!==!1,[u,E]=g.useState(()=>r?null:re(t,m,"learning-load",{language:f})?.data??null),[G,Y]=g.useState(()=>!r&&re(t,m,"learning-load",{language:f})===null),[be,F]=g.useState(null),[L,B]=g.useState(!1),[J,_e]=g.useState(""),[Xe,ve]=g.useState(null),[Z,V]=g.useState(null),[ae,we]=g.useState(null),U=g.useRef(r?null:Fa(t,m)).current,[X,pe]=g.useState(U?.tab??"dashboard"),[H,ke]=g.useState(()=>{if(r||!K)return null;const i=re(t,m,"learning-news-load")?.data;return vn(i)?i:null}),k=g.useRef(null);k.current=H;const[A,he]=g.useState(null),[ce,Me]=g.useState(()=>U?.slideIndex??{}),[en,$e]=g.useState({}),[ye,xs]=g.useState(()=>U?.slideTotals??{}),[js]=g.useState(()=>r?new Set:_s(t,m)),[fs,bs]=g.useState(()=>new Set),Ie=g.useRef(null),Re=i=>{if(n?.readAloudEnabled!==!0)return null;const c=o?.renderReadAloud;return typeof c!="function"?null:c(`learning-lesson-${i}`,Ie)},nn=i=>r||js.has(i)||fs.has(i)?null:e.jsx($s,{compact:!0,blockSlug:"learning",subjectType:"learning_lesson",subjectId:i,promptKey:"block_rating.prompt_lesson",ariaKey:"block_rating.rate_lesson_aria",baseUrl:j,apiKey:o?.apiKey,jwt:_?.jwt,previewMode:x||b,settleInPlace:!0,onRated:()=>Va(t,m,i),onFeedbackCycleDone:()=>bs(c=>new Set(c).add(i)),t:p}),[sn,an]=g.useState(!1),[ws,Ns]=g.useState(!1),[Ue,ln]=g.useState(!1),[An,Tn]=g.useState(null),[vs,tn]=g.useState(!1),Ln=g.useRef(null),[le,me]=g.useState(U?.openTopicId??null),[xe,Oe]=g.useState(null),[W,de]=g.useState(null),[N,ze]=g.useState(()=>r?null:re(t,m,"learning-browse",{language:f})?.data??null),[rn,on]=g.useState(!1),[S,ee]=g.useState(null),[ks,Be]=g.useState(null),[M,De]=g.useState(null),[O,Ee]=g.useState(null),[ue,Mn]=g.useState(null),[cn,dn]=g.useState(!1),[$,un]=g.useState(null),ie=g.useRef(p);ie.current=p;const $n=g.useCallback((i,c)=>(Ka.includes(i)&&(Hn(),on(!0)),a.call(i,c)),[a]),C=g.useMemo(()=>({...a,call:$n}),[a,$n]),je=g.useCallback(async i=>{F(null),ve(null),V(null),we(null),_e("");const c={...i?{preferredTopicId:i}:{},language:f},d=re(t,m,"learning-load",c);if(d){if(E(d.data),Y(!1),!d.stale)return d.data;const y=await R(C,"learning-load",c);return y&&(ge(t,m,"learning-load",c,y),E(y)),y??d.data}Y(!0);const h=await R(C,"learning-load",c);return h?(ge(t,m,"learning-load",c,h),E(h)):F(ie.current("learning.error_load")),Y(!1),h},[C,f,m,t]);g.useEffect(()=>{if(r){const i=s?.mode??"nothing";E(i==="nothing"?{mode:"nothing",reason:s?.reason??"all_in_cooldown"}:{mode:"unavailable"});return}je()},[r,je,s?.mode,s?.reason]),g.useEffect(()=>{const i=a.on?.("learning:reload",()=>{Hn(),je()});return()=>i?.()},[a,je]),g.useEffect(()=>{if(r||!K)return;let i=!1;return(async()=>{const c=re(t,m,"learning-news-load");if(c&&(vn(c.data)&&ke(c.data),!c.stale))return;const d=await R(a,"learning-news-load");i||!d||(ge(t,m,"learning-news-load",void 0,d),vn(d)&&ke(d))})(),()=>{i=!0}},[a,r,m,t,K]);const ys=g.useCallback(()=>{const i=A;if(!i)return;he(null);const c=el(i.url);if(!c){F(ie.current("learning.news_error_open"));return}const d=window.open(c,"_blank","noopener,noreferrer");d&&(d.opener=null),(async()=>{const h=await R(a,"learning-news-open",{newsItemId:i.id});if(!h||typeof h.unreadCount!="number")return;const y=k.current;if(!y)return;const D=rl(y,i.id,h.unreadCount);ke(D),ge(t,m,"learning-news-load",void 0,D)})()},[a,A,m,t]);g.useEffect(()=>{Xa(m)},[m]),g.useEffect(()=>{if(X==="today"||r||N&&(M||W||$))return;const i={language:f},c=rn?null:re(t,m,"learning-browse",i);if(N&&!rn&&!(c&&c.stale)||(c&&ze(c.data),c&&!c.stale))return;let d=!1;return(async()=>{const h=await R(C,"learning-browse",i);d||!h||!Array.isArray(h.topics)||!h.summary||(ge(t,m,"learning-browse",i,h),ze(h),on(!1))})(),()=>{d=!0}},[X,N,rn,M,W,$,r,C,f,m,t]);const gn=g.useCallback(async(i,c,d)=>{const h=await R(C,"learning-answer-quiz",{quizId:i,questionId:c,selectedOptionIndex:d,language:f});if(!h){F(ie.current("learning.error_answer"));return}a.emit("learning:answerSubmitted",{questionId:c}),h.completed&&V(h.completed)},[a,C,f]),_n=g.useCallback(async(i,c,d)=>{B(!0);const h=await R(C,"learning-answer-quiz-open",{quizId:i,questionId:c,answer:d,language:f});return h?a.emit("learning:answerSubmitted",{questionId:c}):F(ie.current("learning.error_answer")),B(!1),!!h},[a,C,f]),pn=g.useCallback(async(i,c)=>{if(L)return;B(!0);const d=await R(C,"learning-quiz-finish",{quizId:i,language:f,activeDate:Kn()});if(d){if(V(d),a.emit("learning:quizCompleted",d),Mn(d.sectionQuiz??null),d.streak&&ze(h=>h&&{...h,streak:d.streak}),!c?.isSectionQuiz){const h=await R(C,"learning-load",{language:f});h?.mode&&we(h)}}else Z||F(ie.current("learning.error_answer"));B(!1)},[a,C,L,f,Z]),Rn=g.useCallback(async(i,c,d)=>{if(L)return!1;B(!0);const h=await R(C,"learning-section-quiz",{topicId:i,language:f});B(!1);const y=h?.quiz??null;return y?(V(null),dn(!1),un({quiz:y,topicTitle:h?.topicTitle||c,origin:d}),!0):!1},[L,C,f]),Is=g.useCallback(async i=>{const c=J.trim();if(!c||L)return;B(!0);const d=await R(C,"learning-answer-open",{questionId:i,answer:c,language:f});d?(a.emit("learning:answerSubmitted",{questionId:i,verdict:d.verdict}),ve(d)):F(ie.current("learning.error_answer")),B(!1)},[a,C,L,f,J]),Pe=g.useCallback(async i=>{B(!0);const c=await R(C,"learning-start-lesson",{lessonId:i});return B(!1),c?!0:(F(ie.current("learning.error_load")),!1)},[C]),hn=g.useCallback(async i=>{await Pe(i)&&ln(!0)},[Pe]),Fe=g.useCallback(async(i,c)=>{i?.mode==="new_information"&&i.isNew&&(c!==null&&i.lesson.topicId!==c?Tn(i.lesson.lessonId):await hn(i.lesson.lessonId)),tn(!1)},[hn]),Qe=g.useCallback(()=>{dn(!1),Mn(null),un(null),V(null),ln(!1),ae&&(E(ae),we(null),tn(!0),Fe(ae,Ln.current))},[Fe,ae]),We=g.useCallback(async i=>{const c=await R(C,"learning-complete-lesson",{lessonId:i,activeDate:Kn()});return c?.streak&&ze(d=>d&&{...d,streak:c.streak}),c},[C]),Un=g.useCallback(async(i,c)=>{ln(!1),tn(!0),Ln.current=c??null,i&&(await We(i),Me(d=>{if(!(i in d))return d;const h={...d};return delete h[i],h}),$e(d=>{if(!(i in d))return d;const h={...d};return delete h[i],h})),await Fe(await je(),c??null)},[Fe,je,We]),te=g.useCallback(async(i,c)=>{F(null),Ns(c?.fromQuiz===!0),de({...i}),Be(null);const d={lessonId:i.lessonId,language:f},h=re(t,m,"learning-read-lesson",d);if(h)ee(h.data),h.stale&&(async()=>{const y=await R(C,"learning-read-lesson",d);y&&(y.body||y.slides?.length)&&(ge(t,m,"learning-read-lesson",d,y),ee(y))})();else{ee(null);const y=await R(C,"learning-read-lesson",d);if(!y||!y.body&&!y.slides?.length){de(null),F(ie.current("learning.error_load"));return}ge(t,m,"learning-read-lesson",d,y),ee(y)}if(i.done){const y={lessonId:i.lessonId,language:f},D=re(t,m,"learning-lesson-review",y);if(D&&!D.stale)Be(D.data.rows??null);else{const Se=await R(C,"learning-lesson-review",y);Se?(ge(t,m,"learning-lesson-review",y,Se),Be(Se.rows??null)):Be(D?D.data.rows??null:null)}}},[C,f,m,t]),Ge=g.useCallback(async i=>{if(N?.canPickAnyLesson===!0&&i.servedAt===null&&!i.done){F(null),de(null),ee(null),Ee(i);return}await te(i)},[N?.canPickAnyLesson,te]),mn=g.useCallback(async i=>{await Pe(i.lessonId)&&(Ee(null),await te({...i,servedAt:new Date().toISOString()}))},[te,Pe]),zs=g.useCallback(async i=>{B(!0),await R(C,"learning-start-lesson",{lessonId:i}),await We(i);const c=await R(C,"learning-lesson-quiz",{lessonId:i,language:f});if(B(!1),c?.quiz){De({quiz:c.quiz,lessonId:c.lessonId??i,lessonTitle:c.lessonTitle??""}),de(null),ee(null);return}const d=N?.topics.flatMap(D=>(D.lessons??[]).map(Se=>({topicId:D.topicId,lesson:Se})))??[],h=d.findIndex(D=>D.lesson.lessonId===i),y=N?.canPickAnyLesson===!0&&h!==-1?d.slice(h+1).find(D=>!D.lesson.done)??null:null;if(de(null),ee(null),ze(null),!!y){if(y.topicId===d[h].topicId){await mn(y.lesson);return}Tn(y.lesson.lessonId),Ge(y.lesson)}},[C,f,N,Ge,We,mn]),On=g.useRef(U?.readingLessonId??null);g.useEffect(()=>{const i=On.current;if(!i||!N||r)return;On.current=null;const c=N.topics.flatMap(d=>d.lessons??[]).find(d=>d.lessonId===i);c&&te(c)},[N,r,te]),g.useEffect(()=>{r||Qa(t,m,{tab:X,openTopicId:le,readingLessonId:W?.lessonId??null,slideIndex:ce,slideTotals:ye})},[r,t,m,X,le,W,ce,ye]);const Bn=u?.mode==="new_information"?u.lesson:null;g.useEffect(()=>{const i=[];for(const c of[Bn,S]){const d=c?.slides?.length??0;c&&d>0&&i.push([c.lessonId,d])}i.length!==0&&xs(c=>{const d=i.filter(([h,y])=>c[h]!==y);return d.length>0?{...c,...Object.fromEntries(d)}:c})},[Bn,S]);const qs=g.useMemo(()=>{const i={};for(const[c,d]of Object.entries(ye))d<=0||(i[c]={index:Math.min(ce[c]??0,d-1),total:d});return i},[ye,ce]),qe=(N?.tracks?.length??0)>0,xn=g.useMemo(()=>O?N?.topics.find(i=>(i.lessons??[]).some(c=>c.lessonId===O.lessonId))??null:null,[N,O]),Ce=g.useMemo(()=>{if(!N||!qe)return[];const i=new Set(N.tracks.flatMap(c=>c.topics.map(d=>d.topicId)));return N.topics.filter(c=>!i.has(c.topicId))},[N,qe]),Je=g.useMemo(()=>!N||!xe?null:xe===Nn?{trackId:Nn,title:p("learning.track_unassigned"),topicCount:Ce.length,doneTopicCount:Ce.filter(i=>i.lessonCount>0&&i.doneCount===i.lessonCount).length,topics:Ce}:N.tracks?.find(i=>i.trackId===xe)??null,[N,xe,Ce,p]),Dn=i=>{if(N?.canPickAnyLesson!==!0)return null;const c=N.topics.flatMap(h=>h.lessons??[]),d=c.findIndex(h=>h.lessonId===i);return d===-1?null:c.slice(d+1).find(h=>!h.done)??null},Cs=i=>{if(!N)return!0;const c=N.topics.flatMap(h=>h.lessons??[]),d=c.findIndex(h=>h.lessonId===i);return d===-1?!0:c.slice(d+1).some(h=>!h.done)},jn=i=>Cs(i)?p("learning.finish_next_lesson"):p("learning.finish_lesson"),En=K&&H!==null&&(H.unread.length>0||H.read.length>0||H.suggested!==null),ne=G||vs,z=X==="dashboard"&&!P||X==="progress"&&!T||X==="news"&&!En?"today":X,Pn=g.useRef(null),Fn=S?.lessonId??(u?.mode==="new_information"?u.lesson.lessonId:null),Ss=[z,xe??"",le??"",O?.lessonId??"",W?.lessonId??"",sn?"quiz-lesson":"",M?.quiz.attemptId??M?.quiz.quizId??"",$?.quiz.attemptId??$?.quiz.quizId??"",cn?"section-intro":"",u?.mode??"",u?.mode==="new_information"?u.lesson.lessonId:"",u?.mode==="new_information"&&u.isNew&&!Ue?"arrival":"",u?.mode==="checking_question"?u.question.questionId:"",u?.mode==="placement_quiz"||u?.mode==="section_quiz"||u?.mode==="lesson_quiz"?u.quiz.attemptId??u.quiz.quizId:"",Z?"results":"",Fn?String(ce[Fn]??0):""].join("|");return g.useLayoutEffect(()=>{Ga(Pn.current)},[Ss]),e.jsxs(Ts,{blockType:"learning",children:[e.jsxs("header",{className:"es-learning__header",children:[e.jsx("span",{className:"es-learning__header-title",children:w}),I&&e.jsx("nav",{className:"es-learning__header-actions","aria-label":w,children:[...P?[["dashboard",ua]]:[],["today",ca],["topics",da],...En?[["news",pa]]:[],...T?[["progress",ga]]:[]].map(([i,c])=>{const d=i==="news"&&z!=="news"?H?.unreadCount??0:0,h=p(`learning.nav_${i}`);return e.jsxs("button",{type:"button",className:`es-learning__navbtn es-learning__navbtn--icon${i==="news"?" es-learning__navbtn--news":""}${z===i?" es-learning__navbtn--active":""}`,"aria-current":z===i?"page":void 0,"aria-label":d>0?p("learning.nav_news_unread",{n:d}):h,title:h,onClick:()=>{pe(i),me(null),Oe(null),de(null),ee(null),Ee(null),an(!1),De(null),V(null),we(null),he(null)},children:[e.jsx(c,{}),d>0&&e.jsx("span",{className:"es-learning__navbadge","aria-hidden":"true",children:d>99?"99+":d})]},i)})})]}),e.jsxs("div",{className:"es-block__body es-learning",ref:Pn,children:[be&&e.jsx("div",{className:"es-learning__error",role:"alert",children:be}),ne&&(z==="today"||z==="dashboard")&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="dashboard"&&!G&&e.jsx($a,{view:u,browse:N,mascot:v,slidePositions:qs,newsTile:K&&H?.suggested?e.jsx(al,{item:H.suggested,currentLanguage:f,onPick:he,t:p}):void 0,onGoToday:()=>pe("today"),onOpenLesson:(i,c)=>{pe("topics"),me(i),te(c)},onOpenTopic:i=>{pe("topics"),me(i)},t:p}),z==="news"&&e.jsx(ll,{news:H,currentLanguage:f,onPick:he,t:p}),z==="progress"&&N&&e.jsx(Ba,{browse:N,t:p}),(z==="topics"||z==="progress")&&!N&&!O&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="topics"&&O&&e.jsx(Gn,{lessonTitle:O.title,topicTitle:xn?.title??"",newTopic:An===O.lessonId,graphicRef:O.graphicRef,graphicAlt:O.graphicAlt,graphicUrl:O.graphicUrl,slideCount:ye[O.lessonId]??0,mascot:v,busy:L,onStart:()=>{mn(O)},onBackToTopic:xn?()=>{Ee(null),me(xn.topicId)}:void 0,t:p}),z==="topics"&&N&&W&&!S&&e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")}),z==="topics"&&N&&W&&S&&e.jsx(Jn,{lesson:S,readAloud:Re(S.lessonId),readAloudRef:Ie,slideIndex:ce[S.lessonId]??0,onSlideIndexChange:i=>Me(c=>({...c,[S.lessonId]:i})),slideAnswers:en[S.lessonId]??{},onSlideAnswer:(i,c)=>$e(d=>({...d,[S.lessonId]:{...d[S.lessonId]??{},[i]:c}})),review:ks,backLabel:p("learning.back_to_topic",{topic:S.topicTitle}),showBackLink:!1,onBack:()=>{de(null),ee(null)},onBackToTopic:()=>{de(null),ee(null)},onFinish:N.canPickAnyLesson===!0&&!W.done?()=>{zs(S.lessonId)}:void 0,finishLabel:S.hasQuiz===!1?jn(S.lessonId):p("learning.finish_to_quiz"),rating:ws?null:nn(S.lessonId),t:p}),z==="topics"&&M&&e.jsx(wn,{quiz:M.quiz,isPlacement:!1,eyebrow:M.lessonTitle,topics:[],results:Z,busy:L,mascot:v,onAnswer:(i,c)=>{gn(M.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n(M.quiz.quizId,i,c),onFinish:()=>{pn(M.quiz.quizId)},onBackToLesson:()=>{De(null),te({lessonId:M.lessonId,title:M.lessonTitle,isMilestone:!1,state:"gap",done:!1,servedAt:new Date().toISOString()},{fromQuiz:!0})},onContinue:()=>{const i=Dn(M.lessonId);V(null),De(null),i&&Ge(i)},continueLabel:Dn(M.lessonId)?p("learning.go_to_next_lesson"):p("learning.nav_topics"),t:p},M.quiz.attemptId??M.quiz.quizId),z==="topics"&&N&&!W&&!M&&!$&&!O&&le&&e.jsx(Ma,{topic:N.topics.find(i=>i.topicId===le)??N.topics[0],onOpenLesson:i=>{Ge(i)},onStartSectionQuiz:()=>{const i=N.topics.find(c=>c.topicId===le)??N.topics[0];(async()=>await Rn(i.topicId,i.title,"topics")||on(!0))()},canPickAnyLesson:N.canPickAnyLesson===!0,backLabel:Je?.title,onBack:Je?()=>me(null):void 0,t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&qe&&!xe&&e.jsx(Ca,{tracks:N.tracks,untracked:Ce,onOpenTrack:Oe,onOpenUntracked:()=>Oe(Nn),t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&qe&&xe&&Je&&e.jsx(Sa,{track:Je,onOpenTopic:me,onBack:()=>Oe(null),t:p}),z==="topics"&&N&&!W&&!M&&!$&&!O&&!le&&!qe&&e.jsx(ds,{topics:N.topics,onOpen:me,t:p}),z==="today"&&!ne&&u?.mode==="nothing"&&e.jsx(kn,{kind:u.reason,mascot:v,nextDueAt:u.nextDueAt,t:p}),z==="today"&&!ne&&u?.mode==="unavailable"&&e.jsx(kn,{kind:"unavailable",mascot:v,t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&u.isNew&&!Ue&&e.jsx(Gn,{lessonTitle:u.lesson.title,topicTitle:u.lesson.topicTitle,newTopic:An===u.lesson.lessonId,graphicRef:u.lesson.graphicRef,graphicAlt:u.lesson.graphicAlt,graphicUrl:u.lesson.graphicUrl,slideCount:u.lesson.slides?.length??0,mascot:v,busy:L,onStart:()=>{hn(u.lesson.lessonId)},t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&(!u.isNew||Ue)&&(!u.lesson.kind||u.lesson.kind==="info"||!u.lesson.slides?.length)&&e.jsx(rs,{lesson:u.lesson,busy:L,onDone:()=>{Un(u.lesson.lessonId,u.lesson.topicId)},doneLabel:u.lesson.hasQuiz===!1?jn(u.lesson.lessonId):void 0,rating:nn(u.lesson.lessonId),readAloud:Re(u.lesson.lessonId),readAloudRef:Ie,t:p}),z==="today"&&!ne&&u?.mode==="new_information"&&(!u.isNew||Ue)&&u.lesson.kind&&u.lesson.kind!=="info"&&!!u.lesson.slides?.length&&e.jsx(cs,{lesson:u.lesson,index:ce[u.lesson.lessonId]??0,onIndexChange:i=>Me(c=>({...c,[u.lesson.lessonId]:i})),answers:en[u.lesson.lessonId]??{},onAnswer:(i,c)=>$e(d=>({...d,[u.lesson.lessonId]:{...d[u.lesson.lessonId]??{},[i]:c}})),busy:L,onDone:()=>{Un(u.lesson.lessonId,u.lesson.topicId)},doneLabel:u.lesson.hasQuiz===!1?jn(u.lesson.lessonId):void 0,rating:nn(u.lesson.lessonId),readAloud:Re(u.lesson.lessonId),readAloudRef:Ie,t:p}),z==="today"&&!ne&&u?.mode==="checking_question"&&e.jsx(fa,{prompt:u.question.prompt,lessonTitle:u.lessonTitle,answer:J,feedback:Xe,busy:L,showExplanations:q,onChange:_e,onSubmit:()=>{Is(u.question.questionId)},t:p}),z==="today"&&!ne&&u?.mode==="lesson_quiz"&&sn&&(S?e.jsx(Jn,{lesson:S,readAloud:Re(S.lessonId),readAloudRef:Ie,slideIndex:ce[S.lessonId]??0,onSlideIndexChange:i=>Me(c=>({...c,[S.lessonId]:i})),slideAnswers:en[S.lessonId]??{},onSlideAnswer:(i,c)=>$e(d=>({...d,[S.lessonId]:{...d[S.lessonId]??{},[i]:c}})),backLabel:p("learning.back_to_quiz"),onBack:()=>an(!1),t:p}):e.jsx("div",{className:"es-learning__loading",children:p("learning.loading")})),z==="today"&&!ne&&cn&&ue&&e.jsx(ma,{topicTitle:ue.topicTitle,topicComplete:ue.topicComplete,mascot:v,busy:L,onStart:()=>{(async()=>await Rn(ue.topicId,ue.topicTitle,"today")||Qe())()},onSkip:Qe,t:p}),$&&z===$.origin&&e.jsx(wn,{quiz:$.quiz,isPlacement:!1,eyebrow:$.topicTitle,topics:[],results:Z,busy:L,mascot:v,onAnswer:(i,c)=>{gn($.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n($.quiz.quizId,i,c),onFinish:()=>{pn($.quiz.quizId,{isSectionQuiz:!0})},onBackToLesson:void 0,onContinue:$.origin==="today"?Qe:()=>{un(null),V(null)},continueLabel:$.origin==="topics"?p("learning.nav_topics"):ae?.mode==="new_information"?p("learning.go_to_next_lesson"):p("learning.continue"),t:p},$.quiz.attemptId??$.quiz.quizId),z==="today"&&!ne&&!sn&&!cn&&$?.origin!=="today"&&(u?.mode==="placement_quiz"||u?.mode==="section_quiz"||u?.mode==="lesson_quiz")&&e.jsx(wn,{quiz:u.quiz,isPlacement:u.mode==="placement_quiz",eyebrow:u.mode==="lesson_quiz"?u.lessonTitle:void 0,topics:u.mode==="placement_quiz"?u.topics:[],results:Z,busy:L,mascot:v,onAnswer:(i,c)=>{gn(u.quiz.quizId,i,c)},onAnswerOpen:(i,c)=>_n(u.quiz.quizId,i,c),onFinish:()=>{pn(u.quiz.quizId)},onBackToLesson:u.mode==="lesson_quiz"?()=>{an(!0),te({lessonId:u.lessonId,title:u.lessonTitle,isMilestone:!1,state:"current",done:!1,servedAt:null},{fromQuiz:!0})}:void 0,onChooseTopic:u.mode==="placement_quiz"?i=>{je(i)}:void 0,onContinue:ue||ae?()=>{if(ue){V(null),dn(!0);return}Qe()}:void 0,continueLabel:!ue&&ae?.mode==="new_information"?p("learning.go_to_next_lesson"):p("learning.continue"),t:p},u.quiz.attemptId??u.quiz.quizId)]}),A&&e.jsx(il,{item:A,onCancel:()=>he(null),onConfirm:ys,t:p})]})}export{jl as Component,Gn as NewLessonIntro,ya as QuizReview,ma as SectionQuizIntro,xl as manifest};
2
+ //# sourceMappingURL=index-BsUIWTU6-BQ7DWJhg.js.map
@@ -1,2 +1,2 @@
1
- import{w as B,p as T,f as O,x as E,A as W,S as G,O as X}from"./accent-legibility-BJF2VO5n-CDPQ7suO.js";import{H as J,r as j,j as s,d as K}from"../nexly.js";const Q=4.5,x="#3B6FD4",Z={"--ai-bg":"#FFFFFF","--ai-bg-elevated":"#F9FAFB","--ai-bg-card":"#F3F4F6","--ai-bg-input":"#FFFFFF","--ai-bg-footer":"#F9FAFB","--ai-fg":"#111827","--ai-fg-secondary":"#374151","--ai-muted":"#4B5563","--ai-muted-dim":"#6B7280","--ai-border":"#E5E7EB","--ai-border-subtle":"#F3F4F6","--ai-assistant-bubble":"#F3F4F6","--ai-assistant-bubble-fg":"#111827","--ai-shadow":"0 20px 60px -15px rgba(15, 23, 42, 0.25)","--ai-success":"#00672B","--ai-warning":"#9C5300","--ai-error":"#AD2C26","--ai-info":"#03669D","--es-color-surface":"#FFFFFF","--es-color-surface-elevated":"#F9FAFB","--es-color-surface-hover":"#F3F4F6","--es-color-on-surface":"#111827","--es-color-on-surface-muted":"#4B5563","--es-color-border":"#E5E7EB","--es-color-control-border":"#6B7280","--es-color-error":"#AD2C26","--es-color-success":"#00672B","--es-color-on-success":"#FFFFFF"},ee={"--ai-bg":"#0F1115","--ai-bg-elevated":"#171A20","--ai-bg-card":"#171A20","--ai-bg-input":"#0F1115","--ai-bg-footer":"#0F1115","--ai-fg":"#F3F4F6","--ai-fg-secondary":"#D1D5DB","--ai-muted":"#9CA3AF","--ai-muted-dim":"#6B7280","--ai-border":"#252A33","--ai-border-subtle":"#1B1F26","--ai-assistant-bubble":"#171A20","--ai-assistant-bubble-fg":"#F3F4F6","--ai-shadow":"0 20px 60px -15px rgba(0, 0, 0, 0.7)","--ai-success":"#4ADE80","--ai-warning":"#FACC15","--ai-error":"#F87171","--ai-info":"#38BDF8","--es-color-surface":"#0F1115","--es-color-surface-elevated":"#171A20","--es-color-surface-hover":"#252A33","--es-color-on-surface":"#F3F4F6","--es-color-on-surface-muted":"#9CA3AF","--es-color-border":"#252A33","--es-color-control-border":"#6B7280","--es-color-error":"#F87171","--es-color-success":"#4ADE80","--es-color-on-success":"#0F1115"};function Y(e){const a=X("#FFFFFF",e),r=X("#000000",e);return a>=r?"#FFFFFF":"#000000"}function ae(e){const[a,r,o]=O(e),t=G(e)<.2?28:-28;return T([Math.max(0,Math.min(255,a+t)),Math.max(0,Math.min(255,r+t)),Math.max(0,Math.min(255,o+t))])}function L({brandColor:e,mode:a}){const r=a==="light"?Z:ee,o=e&&B(e)?e:x,t=T(O(o)),l=Y(t),f={ai:["--ai-bg","--ai-bg-elevated","--ai-bg-card","--ai-bg-input","--ai-bg-sidebar","--ai-bg-footer"],es:["--es-color-surface","--es-color-surface-elevated","--es-color-surface-hover"]},w=(C,c)=>{const g=new Set([c]);for(const S of f[C]){const b=r[S];typeof b=="string"&&B(b)&&g.add(b)}return[...g]},p=E({accent:t,surface:w("ai",r["--ai-bg-card"]),backdrop:r["--ai-bg"],tintAlpha:a==="light"?.08:.12,mode:a}),m=E({accent:t,surface:w("es",r["--es-color-surface-elevated"]),backdrop:r["--es-color-surface"],tintAlpha:a==="light"?.08:.12,mode:a}),u=W(t,w("es",r["--es-color-surface"]),Q,a);return{...r,"--ai-accent":t,"--ai-accent-fg":l,"--ai-accent-hover":ae(t),"--ai-accent-subtle":p.tint,"--ai-accent-on-subtle":p.onTint,"--ai-accent-on-subtle-strong":p.onStrongTint,"--ai-accent-border":p.boundary,"--ai-user-bubble":t,"--ai-user-bubble-fg":l,"--ai-scrollbar":t,"--es-color-primary":u,"--es-color-on-primary":Y(u),"--es-color-primary-muted":m.tint,"--es-color-primary-on-muted":m.onTint,"--es-color-interactive":u}}const ge=L({brandColor:x,mode:"light"}),be=L({brandColor:x,mode:"dark"}),n={shape:"--es-demo-launcher-shape",width:"--es-demo-launcher-width",height:"--es-demo-launcher-height",radius:"--es-demo-launcher-radius",background:"--es-demo-launcher-background",shadow:"--es-demo-launcher-shadow",padding:"--es-demo-launcher-padding",offsetX:"--es-demo-launcher-offset-x",offsetY:"--es-demo-launcher-offset-y"},i={width:{min:32,max:240,step:2},height:{min:32,max:240,step:2},radius:{min:0,max:64,step:1},padding:{min:0,max:32,step:1},offsetX:{min:0,max:240,step:2},offsetY:{min:0,max:240,step:2}},H=8,re=8,oe=.6,d={shape:"pill",width:56,height:56,radius:12,background:"accent",shadow:!0,padding:0,offsetX:20,offsetY:20},se=new Set(["pill","circle","square","rectangle"]),te=new Set(["accent","neutral","none"]);function ne(e){if(typeof e!="string")return;const a=/^\s*(-?\d+(?:\.\d+)?)\s*(?:px)?\s*$/i.exec(e);if(!a)return;const r=Number(a[1]);return Number.isFinite(r)?r:void 0}function F(e,a,r){const o=ne(e);return o===void 0?r:Math.min(a.max,Math.max(a.min,o))}function R(e,a,r){if(typeof e!="string")return r;const o=e.trim().toLowerCase();return a.has(o)?o:r}function ie(e,a){if(typeof e!="string")return a;const r=e.trim().toLowerCase();return r==="true"||r==="1"?!0:r==="false"||r==="0"?!1:a}function U(e){const a=e.shape==="circle"||e.shape==="square";return{width:e.width,height:a?e.width:e.height}}function le(e,a,r,o){if(e==="pill")return o;const t=Math.max(0,Math.floor((Math.min(r.width,r.height)-H)/2)),l=a==="accent"?Math.min(re,t):0;return Math.min(t,Math.max(l,o))}function ce(e){const a=e??{},r=d,o=R(a[n.shape],se,r.shape),t=R(a[n.background],te,r.background),l=F(a[n.width],i.width,r.width),f=F(a[n.height],i.height,r.height);return{shape:o,width:l,height:f,radius:F(a[n.radius],i.radius,r.radius),background:t,shadow:ie(a[n.shadow],r.shadow),padding:le(o,t,U({shape:o,width:l,height:f}),F(a[n.padding],i.padding,r.padding)),offsetX:F(a[n.offsetX],i.offsetX,r.offsetX),offsetY:F(a[n.offsetY],i.offsetY,r.offsetY)}}const N={accent:"var(--ai-accent)",neutral:"var(--ai-bg)",none:"transparent"};function de(e){const{width:a,height:r}=U(e),o=e.shape==="circle"?"50%":e.shape==="pill"?"calc(var(--es-demo-launcher-h) / 2)":`${e.radius}px`;return{"--es-demo-launcher-w":`${a}px`,"--es-demo-launcher-h":`${r}px`,"--es-demo-launcher-radius":o,"--es-demo-launcher-bg":N[e.background],"--es-demo-launcher-dot-ring":e.background==="none"?N.neutral:N[e.background],"--es-demo-launcher-shadow":e.shadow?"var(--ai-shadow)":"none","--es-demo-launcher-pad":`${e.padding}px`,"--es-demo-launcher-coin":`${oe}`,"--es-demo-launcher-mark-min":`${H}px`,"--es-demo-launcher-x":`${e.offsetX}px`,"--es-demo-launcher-y":`${e.offsetY}px`}}const Fe={slug:"demo",name:"Demo",version:"0.1.0",slots:["header","main","footer"],cssVariables:{"--ai-accent":x},structure:{header:{id:"header",label:"Header",accepts:!0},main:{id:"main",label:"Main Content",accepts:!0},footer:{id:"footer",label:"Footer",accepts:!0}},defaultViews:[],requiredServices:["support-chat"],description:"Neutral, brand-adaptive shell for demo clones. Carries no mascot and no brand of its own: the logo, name and accent colour all come from the product, and the rest of the palette is derived around them so it stays legible for any input.",author:"E-Commerce Studio",packageName:"@ecommerce-studio/theme-demo",options:[{id:"colorScheme",type:"select",label:"Appearance mode",default:"auto",group:"Appearance",options:[{label:"Auto (match visitor)",value:"auto"},{label:"Light",value:"light"},{label:"Dark",value:"dark"}]},{id:"brandColor",type:"color",label:"Brand colour",default:x,cssVariable:"--ai-accent",group:"Colors"},{id:"launcherShape",type:"select",label:"Button shape",default:d.shape,cssVariable:n.shape,group:"Launcher",options:[{label:"Pill (wordmark on a chip)",value:"pill"},{label:"Circle",value:"circle"},{label:"Square",value:"square"},{label:"Rectangle",value:"rectangle"}]},{id:"launcherWidth",type:"range",label:"Width (side for circle / square)",default:d.width,unit:"px",cssVariable:n.width,group:"Launcher",...i.width},{id:"launcherHeight",type:"range",label:"Height (pill / rectangle)",default:d.height,unit:"px",cssVariable:n.height,group:"Launcher",...i.height},{id:"launcherRadius",type:"range",label:"Corner radius (square / rectangle)",default:d.radius,unit:"px",cssVariable:n.radius,group:"Launcher",...i.radius},{id:"launcherBackground",type:"select",label:"Background",default:d.background,cssVariable:n.background,group:"Launcher",options:[{label:"Brand colour",value:"accent"},{label:"Neutral",value:"neutral"},{label:"None (transparent)",value:"none"}]},{id:"launcherShadow",type:"toggle",label:"Shadow",default:d.shadow,cssVariable:n.shadow,group:"Launcher"},{id:"launcherPadding",type:"range",label:"Logo padding",default:d.padding,unit:"px",cssVariable:n.padding,group:"Launcher",...i.padding},{id:"launcherOffsetX",type:"range",label:"Distance from side",default:d.offsetX,unit:"px",cssVariable:n.offsetX,group:"Launcher",...i.offsetX},{id:"launcherOffsetY",type:"range",label:"Distance from bottom",default:d.offsetY,unit:"px",cssVariable:n.offsetY,group:"Launcher",...i.offsetY}],supports:{customCss:!1,customJs:!1,darkMode:!0,rtl:!1,views:!0}};function ue(e){const a=[e?.["--ai-accent"],e?.["--es-color-primary"]];for(const r of a)if(typeof r=="string"&&B(r))return r;return x}function he(e){const a=(e??"").trim().split(/\s+/).filter(Boolean);return a.length===0?"":a.slice(0,2).map(r=>[...r][0]??"").join("").toLocaleUpperCase()}function xe({brandName:e="",logoUrl:a,position:r="bottom-right",sidebarPosition:o="right",initialOpen:t=!1,views:l=[],activeView:f="",onViewChange:w=()=>{},children:p=null,cssVariables:m,t:u,colorScheme:C,builderMode:c=!1,unreadCount:g=0,onSettingsClick:S,onOpenChange:b,panelReadAloudControl:q}){const A=J(C)==="light"?"light":"dark",[_,M]=j.useState(t||c),y=j.useMemo(()=>ce(m),[m]),P=j.useMemo(()=>({...L({brandColor:ue(m),mode:A}),...de(y),...c?{width:"100%",height:"100%"}:{}}),[m,y,A,c]),I=()=>M(h=>{const v=!h;return b?.(v),v}),z=()=>{M(!1),b?.(!1)},D=r==="bottom-left",V=o!=="hidden"&&l.length>1,k=he(e);return s.jsxs("div",{className:["es-demo",`es-demo--${A}`].join(" "),style:P,children:[!c&&s.jsxs("button",{type:"button",className:["es-demo__launcher",`es-demo__launcher--${y.shape}`,`es-demo__launcher--bg-${y.background}`,D&&"es-demo__launcher--left",_&&"es-demo__launcher--hidden"].filter(Boolean).join(" "),onClick:I,"aria-label":u?.("floating.open_widget")??"Open chat widget",tabIndex:_?-1:0,"aria-hidden":_,children:[a?s.jsx("img",{className:"es-demo__launcher-logo",src:a,alt:""}):s.jsx("span",{className:"es-demo__launcher-monogram","aria-hidden":"true",children:k||"•"}),g>0&&s.jsx("span",{className:"es-demo__launcher-dot","aria-label":u?.("floating.unread",{count:g})??`${g} unread`})]}),s.jsxs("div",{className:["es-demo__panel",D&&!c&&"es-demo__panel--left",(_||c)&&"es-demo__panel--open"].filter(Boolean).join(" "),role:"dialog","aria-label":u?.("chat.widget_aria")??"Chat widget","aria-hidden":c?!1:!_,children:[s.jsxs("header",{className:"es-demo__header",children:[s.jsxs("div",{className:"es-demo__brand",children:[a?s.jsx("img",{className:"es-demo__brand-logo",src:a,alt:""}):k&&s.jsx("span",{className:"es-demo__brand-monogram","aria-hidden":"true",children:k}),e&&s.jsx("h1",{className:"es-demo__brand-name",children:e})]}),s.jsxs("div",{className:"es-demo__header-actions",children:[q,!c&&s.jsx("button",{type:"button",className:"es-demo__header-btn",onClick:z,"aria-label":u?.("header.close_widget")??"Close widget",children:s.jsx(me,{})})]})]}),s.jsxs("div",{className:["es-demo__body",V&&`es-demo__body--rail-${o}`].filter(Boolean).join(" "),children:[V&&s.jsx("nav",{className:`es-demo__rail es-demo__rail--${o}`,"aria-label":u?.("nav.views")??"Views",children:l.map(h=>{const v=K(h.icon||h.slug),$=h.slug===f;return s.jsxs("button",{type:"button",className:["es-demo__rail-item",$&&"es-demo__rail-item--active"].filter(Boolean).join(" "),onClick:()=>w(h.slug),"aria-current":$?"page":void 0,title:h.label,children:[v?s.jsx(v,{size:20}):null,s.jsx("span",{className:"es-demo__rail-label",children:h.label})]},h.slug)})}),s.jsx("main",{className:"es-demo__content",style:{containerName:"es-slot",containerType:"inline-size"},children:p})]})]})]})}function me({size:e=20}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"m6 9 6 6 6-6"})})}export{x as DEFAULT_BRAND,d as LAUNCHER_DEFAULTS,i as LAUNCHER_LIMITS,n as LAUNCHER_VARS,Q as TEXT_FLOOR,xe as ThemeShell,be as darkVariables,L as deriveDemoPalette,ae as hoverStep,Y as inkOn,de as launcherRootStyle,ge as lightVariables,Fe as manifest,he as monogram,ce as resolveLauncherSettings};
2
- //# sourceMappingURL=index-CwbUW6dx-BLBDoJCM.js.map
1
+ import{w as B,p as T,f as O,x as E,A as W,S as G,O as Y}from"./accent-legibility-BJF2VO5n-CDPQ7suO.js";import{H as J,r as j,j as s,Y as K}from"../nexly.js";const Q=4.5,x="#3B6FD4",Z={"--ai-bg":"#FFFFFF","--ai-bg-elevated":"#F9FAFB","--ai-bg-card":"#F3F4F6","--ai-bg-input":"#FFFFFF","--ai-bg-footer":"#F9FAFB","--ai-fg":"#111827","--ai-fg-secondary":"#374151","--ai-muted":"#4B5563","--ai-muted-dim":"#6B7280","--ai-border":"#E5E7EB","--ai-border-subtle":"#F3F4F6","--ai-assistant-bubble":"#F3F4F6","--ai-assistant-bubble-fg":"#111827","--ai-shadow":"0 20px 60px -15px rgba(15, 23, 42, 0.25)","--ai-success":"#00672B","--ai-warning":"#9C5300","--ai-error":"#AD2C26","--ai-info":"#03669D","--es-color-surface":"#FFFFFF","--es-color-surface-elevated":"#F9FAFB","--es-color-surface-hover":"#F3F4F6","--es-color-on-surface":"#111827","--es-color-on-surface-muted":"#4B5563","--es-color-border":"#E5E7EB","--es-color-control-border":"#6B7280","--es-color-error":"#AD2C26","--es-color-success":"#00672B","--es-color-on-success":"#FFFFFF"},ee={"--ai-bg":"#0F1115","--ai-bg-elevated":"#171A20","--ai-bg-card":"#171A20","--ai-bg-input":"#0F1115","--ai-bg-footer":"#0F1115","--ai-fg":"#F3F4F6","--ai-fg-secondary":"#D1D5DB","--ai-muted":"#9CA3AF","--ai-muted-dim":"#6B7280","--ai-border":"#252A33","--ai-border-subtle":"#1B1F26","--ai-assistant-bubble":"#171A20","--ai-assistant-bubble-fg":"#F3F4F6","--ai-shadow":"0 20px 60px -15px rgba(0, 0, 0, 0.7)","--ai-success":"#4ADE80","--ai-warning":"#FACC15","--ai-error":"#F87171","--ai-info":"#38BDF8","--es-color-surface":"#0F1115","--es-color-surface-elevated":"#171A20","--es-color-surface-hover":"#252A33","--es-color-on-surface":"#F3F4F6","--es-color-on-surface-muted":"#9CA3AF","--es-color-border":"#252A33","--es-color-control-border":"#6B7280","--es-color-error":"#F87171","--es-color-success":"#4ADE80","--es-color-on-success":"#0F1115"};function X(e){const a=Y("#FFFFFF",e),r=Y("#000000",e);return a>=r?"#FFFFFF":"#000000"}function ae(e){const[a,r,o]=O(e),t=G(e)<.2?28:-28;return T([Math.max(0,Math.min(255,a+t)),Math.max(0,Math.min(255,r+t)),Math.max(0,Math.min(255,o+t))])}function L({brandColor:e,mode:a}){const r=a==="light"?Z:ee,o=e&&B(e)?e:x,t=T(O(o)),l=X(t),f={ai:["--ai-bg","--ai-bg-elevated","--ai-bg-card","--ai-bg-input","--ai-bg-sidebar","--ai-bg-footer"],es:["--es-color-surface","--es-color-surface-elevated","--es-color-surface-hover"]},w=(C,c)=>{const g=new Set([c]);for(const S of f[C]){const b=r[S];typeof b=="string"&&B(b)&&g.add(b)}return[...g]},p=E({accent:t,surface:w("ai",r["--ai-bg-card"]),backdrop:r["--ai-bg"],tintAlpha:a==="light"?.08:.12,mode:a}),m=E({accent:t,surface:w("es",r["--es-color-surface-elevated"]),backdrop:r["--es-color-surface"],tintAlpha:a==="light"?.08:.12,mode:a}),u=W(t,w("es",r["--es-color-surface"]),Q,a);return{...r,"--ai-accent":t,"--ai-accent-fg":l,"--ai-accent-hover":ae(t),"--ai-accent-subtle":p.tint,"--ai-accent-on-subtle":p.onTint,"--ai-accent-on-subtle-strong":p.onStrongTint,"--ai-accent-border":p.boundary,"--ai-user-bubble":t,"--ai-user-bubble-fg":l,"--ai-scrollbar":t,"--es-color-primary":u,"--es-color-on-primary":X(u),"--es-color-primary-muted":m.tint,"--es-color-primary-on-muted":m.onTint,"--es-color-interactive":u}}const ge=L({brandColor:x,mode:"light"}),be=L({brandColor:x,mode:"dark"}),n={shape:"--es-demo-launcher-shape",width:"--es-demo-launcher-width",height:"--es-demo-launcher-height",radius:"--es-demo-launcher-radius",background:"--es-demo-launcher-background",shadow:"--es-demo-launcher-shadow",padding:"--es-demo-launcher-padding",offsetX:"--es-demo-launcher-offset-x",offsetY:"--es-demo-launcher-offset-y"},i={width:{min:32,max:240,step:2},height:{min:32,max:240,step:2},radius:{min:0,max:64,step:1},padding:{min:0,max:32,step:1},offsetX:{min:0,max:240,step:2},offsetY:{min:0,max:240,step:2}},H=8,re=8,oe=.6,d={shape:"pill",width:56,height:56,radius:12,background:"accent",shadow:!0,padding:0,offsetX:20,offsetY:20},se=new Set(["pill","circle","square","rectangle"]),te=new Set(["accent","neutral","none"]);function ne(e){if(typeof e!="string")return;const a=/^\s*(-?\d+(?:\.\d+)?)\s*(?:px)?\s*$/i.exec(e);if(!a)return;const r=Number(a[1]);return Number.isFinite(r)?r:void 0}function F(e,a,r){const o=ne(e);return o===void 0?r:Math.min(a.max,Math.max(a.min,o))}function R(e,a,r){if(typeof e!="string")return r;const o=e.trim().toLowerCase();return a.has(o)?o:r}function ie(e,a){if(typeof e!="string")return a;const r=e.trim().toLowerCase();return r==="true"||r==="1"?!0:r==="false"||r==="0"?!1:a}function U(e){const a=e.shape==="circle"||e.shape==="square";return{width:e.width,height:a?e.width:e.height}}function le(e,a,r,o){if(e==="pill")return o;const t=Math.max(0,Math.floor((Math.min(r.width,r.height)-H)/2)),l=a==="accent"?Math.min(re,t):0;return Math.min(t,Math.max(l,o))}function ce(e){const a=e??{},r=d,o=R(a[n.shape],se,r.shape),t=R(a[n.background],te,r.background),l=F(a[n.width],i.width,r.width),f=F(a[n.height],i.height,r.height);return{shape:o,width:l,height:f,radius:F(a[n.radius],i.radius,r.radius),background:t,shadow:ie(a[n.shadow],r.shadow),padding:le(o,t,U({shape:o,width:l,height:f}),F(a[n.padding],i.padding,r.padding)),offsetX:F(a[n.offsetX],i.offsetX,r.offsetX),offsetY:F(a[n.offsetY],i.offsetY,r.offsetY)}}const N={accent:"var(--ai-accent)",neutral:"var(--ai-bg)",none:"transparent"};function de(e){const{width:a,height:r}=U(e),o=e.shape==="circle"?"50%":e.shape==="pill"?"calc(var(--es-demo-launcher-h) / 2)":`${e.radius}px`;return{"--es-demo-launcher-w":`${a}px`,"--es-demo-launcher-h":`${r}px`,"--es-demo-launcher-radius":o,"--es-demo-launcher-bg":N[e.background],"--es-demo-launcher-dot-ring":e.background==="none"?N.neutral:N[e.background],"--es-demo-launcher-shadow":e.shadow?"var(--ai-shadow)":"none","--es-demo-launcher-pad":`${e.padding}px`,"--es-demo-launcher-coin":`${oe}`,"--es-demo-launcher-mark-min":`${H}px`,"--es-demo-launcher-x":`${e.offsetX}px`,"--es-demo-launcher-y":`${e.offsetY}px`}}const Fe={slug:"demo",name:"Demo",version:"0.1.0",slots:["header","main","footer"],cssVariables:{"--ai-accent":x},structure:{header:{id:"header",label:"Header",accepts:!0},main:{id:"main",label:"Main Content",accepts:!0},footer:{id:"footer",label:"Footer",accepts:!0}},defaultViews:[],requiredServices:["support-chat"],description:"Neutral, brand-adaptive shell for demo clones. Carries no mascot and no brand of its own: the logo, name and accent colour all come from the product, and the rest of the palette is derived around them so it stays legible for any input.",author:"E-Commerce Studio",packageName:"@ecommerce-studio/theme-demo",options:[{id:"colorScheme",type:"select",label:"Appearance mode",default:"auto",group:"Appearance",options:[{label:"Auto (match visitor)",value:"auto"},{label:"Light",value:"light"},{label:"Dark",value:"dark"}]},{id:"brandColor",type:"color",label:"Brand colour",default:x,cssVariable:"--ai-accent",group:"Colors"},{id:"launcherShape",type:"select",label:"Button shape",default:d.shape,cssVariable:n.shape,group:"Launcher",options:[{label:"Pill (wordmark on a chip)",value:"pill"},{label:"Circle",value:"circle"},{label:"Square",value:"square"},{label:"Rectangle",value:"rectangle"}]},{id:"launcherWidth",type:"range",label:"Width (side for circle / square)",default:d.width,unit:"px",cssVariable:n.width,group:"Launcher",...i.width},{id:"launcherHeight",type:"range",label:"Height (pill / rectangle)",default:d.height,unit:"px",cssVariable:n.height,group:"Launcher",...i.height},{id:"launcherRadius",type:"range",label:"Corner radius (square / rectangle)",default:d.radius,unit:"px",cssVariable:n.radius,group:"Launcher",...i.radius},{id:"launcherBackground",type:"select",label:"Background",default:d.background,cssVariable:n.background,group:"Launcher",options:[{label:"Brand colour",value:"accent"},{label:"Neutral",value:"neutral"},{label:"None (transparent)",value:"none"}]},{id:"launcherShadow",type:"toggle",label:"Shadow",default:d.shadow,cssVariable:n.shadow,group:"Launcher"},{id:"launcherPadding",type:"range",label:"Logo padding",default:d.padding,unit:"px",cssVariable:n.padding,group:"Launcher",...i.padding},{id:"launcherOffsetX",type:"range",label:"Distance from side",default:d.offsetX,unit:"px",cssVariable:n.offsetX,group:"Launcher",...i.offsetX},{id:"launcherOffsetY",type:"range",label:"Distance from bottom",default:d.offsetY,unit:"px",cssVariable:n.offsetY,group:"Launcher",...i.offsetY}],supports:{customCss:!1,customJs:!1,darkMode:!0,rtl:!1,views:!0}};function ue(e){const a=[e?.["--ai-accent"],e?.["--es-color-primary"]];for(const r of a)if(typeof r=="string"&&B(r))return r;return x}function he(e){const a=(e??"").trim().split(/\s+/).filter(Boolean);return a.length===0?"":a.slice(0,2).map(r=>[...r][0]??"").join("").toLocaleUpperCase()}function xe({brandName:e="",logoUrl:a,position:r="bottom-right",sidebarPosition:o="right",initialOpen:t=!1,views:l=[],activeView:f="",onViewChange:w=()=>{},children:p=null,cssVariables:m,t:u,colorScheme:C,builderMode:c=!1,unreadCount:g=0,onSettingsClick:S,onOpenChange:b,panelReadAloudControl:q}){const A=J(C)==="light"?"light":"dark",[_,M]=j.useState(t||c),y=j.useMemo(()=>ce(m),[m]),P=j.useMemo(()=>({...L({brandColor:ue(m),mode:A}),...de(y),...c?{width:"100%",height:"100%"}:{}}),[m,y,A,c]),I=()=>M(h=>{const v=!h;return b?.(v),v}),z=()=>{M(!1),b?.(!1)},D=r==="bottom-left",V=o!=="hidden"&&l.length>1,k=he(e);return s.jsxs("div",{className:["es-demo",`es-demo--${A}`].join(" "),style:P,children:[!c&&s.jsxs("button",{type:"button",className:["es-demo__launcher",`es-demo__launcher--${y.shape}`,`es-demo__launcher--bg-${y.background}`,D&&"es-demo__launcher--left",_&&"es-demo__launcher--hidden"].filter(Boolean).join(" "),onClick:I,"aria-label":u?.("floating.open_widget")??"Open chat widget",tabIndex:_?-1:0,"aria-hidden":_,children:[a?s.jsx("img",{className:"es-demo__launcher-logo",src:a,alt:""}):s.jsx("span",{className:"es-demo__launcher-monogram","aria-hidden":"true",children:k||"•"}),g>0&&s.jsx("span",{className:"es-demo__launcher-dot","aria-label":u?.("floating.unread",{count:g})??`${g} unread`})]}),s.jsxs("div",{className:["es-demo__panel",D&&!c&&"es-demo__panel--left",(_||c)&&"es-demo__panel--open"].filter(Boolean).join(" "),role:"dialog","aria-label":u?.("chat.widget_aria")??"Chat widget","aria-hidden":c?!1:!_,children:[s.jsxs("header",{className:"es-demo__header",children:[s.jsxs("div",{className:"es-demo__brand",children:[a?s.jsx("img",{className:"es-demo__brand-logo",src:a,alt:""}):k&&s.jsx("span",{className:"es-demo__brand-monogram","aria-hidden":"true",children:k}),e&&s.jsx("h1",{className:"es-demo__brand-name",children:e})]}),s.jsxs("div",{className:"es-demo__header-actions",children:[q,!c&&s.jsx("button",{type:"button",className:"es-demo__header-btn",onClick:z,"aria-label":u?.("header.close_widget")??"Close widget",children:s.jsx(me,{})})]})]}),s.jsxs("div",{className:["es-demo__body",V&&`es-demo__body--rail-${o}`].filter(Boolean).join(" "),children:[V&&s.jsx("nav",{className:`es-demo__rail es-demo__rail--${o}`,"aria-label":u?.("nav.views")??"Views",children:l.map(h=>{const v=K(h.icon||h.slug),$=h.slug===f;return s.jsxs("button",{type:"button",className:["es-demo__rail-item",$&&"es-demo__rail-item--active"].filter(Boolean).join(" "),onClick:()=>w(h.slug),"aria-current":$?"page":void 0,title:h.label,children:[v?s.jsx(v,{size:20}):null,s.jsx("span",{className:"es-demo__rail-label",children:h.label})]},h.slug)})}),s.jsx("main",{className:"es-demo__content",style:{containerName:"es-slot",containerType:"inline-size"},children:p})]})]})]})}function me({size:e=20}){return s.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:s.jsx("path",{d:"m6 9 6 6 6-6"})})}export{x as DEFAULT_BRAND,d as LAUNCHER_DEFAULTS,i as LAUNCHER_LIMITS,n as LAUNCHER_VARS,Q as TEXT_FLOOR,xe as ThemeShell,be as darkVariables,L as deriveDemoPalette,ae as hoverStep,X as inkOn,de as launcherRootStyle,ge as lightVariables,Fe as manifest,he as monogram,ce as resolveLauncherSettings};
2
+ //# sourceMappingURL=index-ByEsnceF-CSQQTbsg.js.map
@@ -1,2 +1,2 @@
1
1
  import{r as p,j as e,Q as n}from"../nexly.js";const a=o=>`$${o.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0})}`;function M({data:o,config:h,actions:l,metadata:x,i18n:j}){const s=j?.t??(i=>i),u=h.mode??o.mode??"basic",c=o.forecast,t=o.aiTip,[m,d]=p.useState("idle"),[N,b]=p.useState(!1);if(!c&&!o.error)return e.jsx(n,{blockType:"commission-forecast",children:e.jsx("div",{className:"cf-block",children:e.jsxs("div",{className:"cf-hero",children:[e.jsx("div",{className:"cf-hero-label",children:s("commission_forecast.estimated_commission")}),e.jsx("div",{className:"cf-hero-amount",style:{color:"var(--es-color-on-surface-muted, #4B5563)"},children:"—"}),e.jsx("div",{className:"cf-hero-sub",style:{color:"var(--es-color-on-surface-muted, #4B5563)"},children:x?.dataQuality==="none"?s("commission_forecast.signin_prompt"):s("commission_forecast.calculating")})]})})});if(o.error||!c)return e.jsx(n,{blockType:"commission-forecast",children:e.jsx("p",{style:{color:"var(--es-color-error, #AD2C26)",fontSize:13},children:s("commission_forecast.load_error")})});const r=c.deltaVsLastMonth,v=c.projectedMonthEnd>0?Math.min(100,Math.round(c.totalEstimated/c.projectedMonthEnd*100)):0,_=Math.round((c.scenarioOneMember-c.projectedMonthEnd)/Math.max(1,c.projectedMonthEnd)*100),g=()=>{t&&(navigator.clipboard.writeText(t).catch(()=>{}),d("copied"),l?.emit?.("cf:tipCopied",{tip:t}),setTimeout(()=>d("idle"),2e3))},f=()=>{b(!0),l?.emit?.("cf:scenarioViewed",{scenarioOneMember:c.scenarioOneMember})};return e.jsx(n,{blockType:"commission-forecast",children:e.jsxs("div",{className:"cf-block",children:[e.jsxs("div",{className:"cf-hero",children:[e.jsx("div",{className:"cf-hero-label",children:s("commission_forecast.estimated_commission")}),e.jsx("div",{className:"cf-hero-amount",children:a(c.totalEstimated)}),e.jsxs("div",{className:"cf-hero-sub",children:[e.jsxs("span",{children:[s("commission_forecast.projected_month_end_label")," ",e.jsx("strong",{children:a(c.projectedMonthEnd)})]}),r!==null&&e.jsxs("span",{className:`cf-delta-badge ${r>=0?"cf-delta--positive":"cf-delta--negative"}`,children:[r>=0?"↑":"↓"," ",a(Math.abs(r))," ",s("commission_forecast.vs_last_month")]})]})]}),e.jsxs("div",{className:"cf-forecast-row",children:[e.jsxs("div",{className:"cf-forecast-labels",children:[e.jsxs("span",{children:[s("commission_forecast.current_label")," ",a(c.totalEstimated)]}),e.jsxs("span",{children:[s("commission_forecast.target_label")," ",a(c.projectedMonthEnd)]})]}),e.jsx("div",{className:"cf-forecast-bar-track",children:e.jsx("div",{className:"cf-forecast-bar-fill",style:{width:`${v}%`}})}),e.jsx("div",{className:"cf-days-left",children:s("commission_forecast.days_left_run_rate",{days:c.daysLeft,rate:a(c.dailyRunRate)})})]}),e.jsxs("div",{className:"cf-scenario",onClick:f,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),f())},tabIndex:0,role:"button",children:[e.jsx("div",{className:"cf-scenario-label",children:s("commission_forecast.scenario_title")}),e.jsxs("div",{className:"cf-scenario-row",children:[e.jsx("span",{className:"cf-scenario-desc",children:s("commission_forecast.scenario_desc")}),e.jsx("span",{className:"cf-scenario-value",children:a(c.scenarioOneMember)})]}),e.jsx("div",{className:"cf-scenario-uplift",children:s("commission_forecast.uplift",{pct:_,amount:a(c.scenarioOneMember-c.projectedMonthEnd)})})]}),u==="pro"&&c.tiers.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"cf-section-title",children:s("commission_forecast.by_tier",{count:c.tiers.length})}),e.jsx("div",{className:"cf-tier-list",children:c.tiers.map(i=>e.jsxs("div",{className:`cf-tier${i.status==="unreachable"?" cf-tier--unreachable":""}`,children:[e.jsxs("div",{className:"cf-tier-header",children:[e.jsx("span",{className:"cf-tier-engine",children:s("commission_forecast.engine_number",{id:i.engineId})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{className:`cf-tier-status cf-status--${i.status==="in progress"?"in-progress":"unreachable"}`,children:i.status==="in progress"?s("commission_forecast.status.in_progress"):s("commission_forecast.status.unreachable")}),e.jsx("span",{className:"cf-tier-amount",children:a(i.estimatedCommission)})]})]}),e.jsx("div",{className:"cf-tier-progress-track",children:e.jsx("div",{className:"cf-tier-progress-fill",style:{width:`${i.progressPct}%`}})}),e.jsxs("div",{className:"cf-tier-meta",children:[e.jsx("span",{children:s("commission_forecast.volume_label",{current:i.salesVolume.toLocaleString(),max:i.salesVolumeMax.toLocaleString()})}),e.jsx("span",{children:s("commission_forecast.points_label",{current:i.personalPoints,max:i.personalPointsMax})})]})]},i.engineId))})]}),t&&e.jsxs("div",{className:"cf-tip-box",children:[e.jsxs("div",{className:"cf-tip-header",children:[e.jsx("span",{className:"cf-tip-label",children:s("commission_forecast.ai_coach_label")}),e.jsx("button",{className:`cf-copy-btn${m==="copied"?" cf-copied":""}`,onClick:g,children:m==="copied"?`✓ ${s("common.copied")}`:s("common.copy")})]}),e.jsx("p",{className:"cf-tip-text",children:t})]})]})})}const k={slug:"commission-forecast",name:"Commission Forecast",version:"1.0.0",category:"data",requiredService:"commission-forecast",configSchema:{properties:{mode:{type:"string",default:"basic"}}},defaultConfig:{mode:"basic"},sizing:{minWidth:260,preferredHeight:"auto",scrollable:!0},supportedPlacements:["main","sidebar"],dataContract:{serviceSlug:"commission-forecast",inputSchema:{type:"object",properties:{forecast:{type:"object"},aiTip:{type:"string"},mode:{type:"string"}},required:["forecast","mode"]}},events:{emits:[{name:"cf:tipCopied",description:"User copied the AI commission tip"},{name:"cf:scenarioViewed",description:"User viewed the +1 member scenario projection"}]}};export{M as CommissionForecastBlock,M as Component,k as manifest};
2
- //# sourceMappingURL=index-Czz6Gyh_-C3bBvEcm.js.map
2
+ //# sourceMappingURL=index-C5olj-Fr-C3bBvEcm.js.map
@@ -1,2 +1,2 @@
1
1
  import{j as e,Q as u}from"../nexly.js";const y={slug:"demo-shipping-returns",name:"DEMO — Contact details",version:"0.1.0",category:"content",configSchema:{properties:{rows:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"string"},note:{type:"string"}},required:["label","value"]},default:[]}}},defaultConfig:{rows:[]},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main","sidebar"]};function _(t){return Array.isArray(t)?t.flatMap(s=>{if(typeof s!="object"||s===null)return[];const n=s,d=typeof n.label=="string"?n.label.trim():"",a=typeof n.value=="string"?n.value.trim():"";if(!d||!a)return[];const c=typeof n.note=="string"?n.note.trim():"";return[{label:d,value:a,...c?{note:c}:{}}]}):[]}function i(t){if(typeof t!="string")return null;const s=t.trim();return s.length>0?s:null}function x(t){const s=i(t);if(!s||/\s/.test(s))return null;const n=s.indexOf("@");return n>0&&n<s.length-1?s:null}function j(t){const s=i(t);return!s||!/[0-9]/.test(s)?null:s}function f(t){return t.split(/\s+/).filter(s=>/[\p{L}\p{N}]/u.test(s)).slice(0,2).map(s=>s[0].toUpperCase()).join("")}function v({data:t,config:s,i18n:n}){const d=n?.t??(o=>o),a=t?.rows?t:s??{},c=_(a.rows),m=i(a.company),p=i(a.tagline),r=x(a.email),l=j(a.phone),h=i(a.note);return!m&&!r&&!l&&c.length===0?e.jsx(u,{blockType:"demo-shipping-returns",children:e.jsx("div",{className:"es-block__body",children:e.jsx("div",{className:"es-block__empty",children:d("demoTerms.empty")})})}):e.jsx(u,{blockType:"demo-shipping-returns",children:e.jsxs("div",{className:"es-block__body es-democontact",children:[e.jsxs("div",{className:"es-democontact__card",children:[m&&e.jsxs("div",{className:"es-democontact__identity",children:[e.jsx("div",{className:"es-democontact__coin","aria-hidden":"true",children:f(m)}),e.jsxs("div",{className:"es-democontact__names",children:[e.jsx("p",{className:"es-democontact__company",children:m}),p&&e.jsx("p",{className:"es-democontact__tagline",children:p})]})]}),c.length>0&&e.jsx("dl",{className:"es-democontact__grid",children:c.map(o=>e.jsxs("div",{className:"es-democontact__cell",children:[e.jsx("dt",{className:"es-democontact__label",children:o.label}),e.jsx("dd",{className:"es-democontact__value",children:o.value}),o.note&&e.jsx("dd",{className:"es-democontact__note",children:o.note})]},o.label))}),(r||l)&&e.jsxs("div",{className:"es-democontact__actions",children:[r&&e.jsxs("a",{className:"es-democontact__action",href:`mailto:${r}`,children:[e.jsxs("svg",{className:"es-democontact__glyph",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("rect",{x:"2.5",y:"4.5",width:"19",height:"15",rx:"2.5"}),e.jsx("path",{d:"M3 7l9 6 9-6"})]}),e.jsx("span",{className:"es-democontact__action-text",children:r})]}),l&&e.jsxs("a",{className:"es-democontact__action",href:`tel:${l.replace(/\s+/g,"")}`,children:[e.jsx("svg",{className:"es-democontact__glyph",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M6.5 3.5h3l1.5 4-2 1.5a11 11 0 006 6l1.5-2 4 1.5v3a2 2 0 01-2.2 2A17 17 0 014.5 5.7 2 2 0 016.5 3.5z"})}),e.jsx("span",{className:"es-democontact__action-text",children:l})]})]})]}),h&&e.jsxs("div",{className:"es-democontact__reassurance",children:[e.jsxs("svg",{className:"es-democontact__glyph",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M12 3l7.5 3v5.5c0 4.6-3.1 8.4-7.5 9.5-4.4-1.1-7.5-4.9-7.5-9.5V6z"}),e.jsx("path",{d:"M9 12.2l2.2 2.2 4-4.2"})]}),e.jsx("p",{className:"es-democontact__reassurance-text",children:h})]})]})})}export{v as Component,y as manifest};
2
- //# sourceMappingURL=index-DP_6HfDM-DAdxCQyi.js.map
2
+ //# sourceMappingURL=index-CHUW1nlj-DAdxCQyi.js.map
@@ -1,2 +1,2 @@
1
1
  import{r as i,j as e,Q as m}from"../nexly.js";const f={slug:"faq",name:"FAQ",version:"1.0.0",category:"content",requiredService:"knowledge-search",configSchema:{properties:{readAloudEnabled:{type:"boolean",default:!1},limit:{type:"number",default:10}}},defaultConfig:{readAloudEnabled:!1,limit:10},dataContract:{serviceSlug:"knowledge-search",inputSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{question:{type:"string"},answer:{type:"string"},category:{type:"string"}}}},total:{type:"number"}},required:["items"]},previewDataOverride:{items:[{question:"What is your return policy?",answer:"We accept returns within 30 days of purchase.",category:"Returns"},{question:"How long does shipping take?",answer:"Standard shipping takes 3-5 business days.",category:"Shipping"},{question:"Do you offer international shipping?",answer:"Yes, we ship to over 50 countries worldwide.",category:"Shipping"},{question:"How do I track my order?",answer:"You will receive a tracking link via email once your order ships.",category:"Orders"},{question:"Can I change or cancel my order?",answer:"Orders can be modified or cancelled within 1 hour of placement.",category:"Orders"}],total:5}},fields:[{id:"readAloudEnabled",type:"toggle",label:"Read this panel aloud",default:!1,group:"Voice"},{id:"limit",type:"range",label:"Number of FAQs",default:10,min:1,max:50,step:1,group:"Content"}],events:{emits:[{name:"faq:itemExpanded",description:"User expanded a FAQ item"},{name:"faq:itemCollapsed",description:"User collapsed a FAQ item"}],listens:[{name:"faq:refresh",description:"Reload FAQ content from service"}]},sizing:{minWidth:240,preferredHeight:"auto",scrollable:!1},supportedPlacements:["main","sidebar"]};function g({data:n,config:o,i18n:l}){const d=l?.t??(a=>a),t=n.items??o.items??[],[r,c]=i.useState(null),p=i.useCallback(a=>{c(s=>s===a?null:a)},[]);return e.jsx(m,{blockType:"faq",children:e.jsxs("div",{className:"es-block__body",children:[t.length===0&&e.jsx("div",{className:"es-block__empty",children:d("faq.empty")}),t.map((a,s)=>e.jsxs("div",{className:"es-faq__item",children:[e.jsxs("button",{className:"es-faq__question",onClick:()=>p(s),type:"button",children:[e.jsx("span",{children:a.question}),e.jsx("span",{className:"es-faq__chevron",children:r===s?"▲":"▼"})]}),r===s&&e.jsx("div",{className:"es-faq__answer",children:a.answer})]},s))]})})}export{g as Component,f as manifest};
2
- //# sourceMappingURL=index-DO0-ht8E-DUgMllqN.js.map
2
+ //# sourceMappingURL=index-CIFQrVkq-DUgMllqN.js.map