PageSourceSearch

https://alleviatefoundation.org/_next/static/chunks/79131.4f1d6db5691052d6.js

js alleviatefoundation.org collected 2026-10-05 22:09:34 UTC 89,540 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[79131],{79131:function(e,t,l){l.r(t),l.d(t,{default:function(){return $}});var r=l(57437),s=l(2265),o=l(71632),n=l(29827),a=l(21770),i=l(32004),d=l(48614),c=l(43949),p=l(11643),u=l(67889),x=l(33349),m=l(25338);let h=(0,x.getBackendUrl)(),b={deep:"#471873",purple:"#9334eb",pale:"#ede0f7",gold:"#c9a84c",surf:"#f9f8fc",ink:"#1a1428",sub:"#6d707a",rule:"#d1d9ea"},f={submitted:"Submitted",under_review:"Under Review",approved:"Approved",revision_requested:"Revision Requested",waived:"Waived",escalated:"Escalated"},g={submitted:{bg:"rgba(147,52,235,.12)",fg:b.purple},under_review:{bg:"rgba(147,52,235,.12)",fg:b.purple},approved:{bg:"rgba(34,197,94,.12)",fg:"#16a34a"},revision_requested:{bg:"rgba(217,119,6,.15)",fg:"#d97706"},waived:{bg:"rgba(148,163,184,.18)",fg:"#475569"},escalated:{bg:"rgba(239,68,68,.12)",fg:"#dc2626"}};function y(e){if(!e)return"—";try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch(t){return e}}function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:240;return e?e.length>t?"".concat(e.slice(0,t).trimEnd(),"…"):e:""}function j(e){let{status:t}=e,l=g[t];return(0,r.jsx)("span",{style:{display:"inline-flex",alignItems:"center",fontSize:10,fontWeight:700,letterSpacing:.4,textTransform:"uppercase",padding:"2px 8px",borderRadius:4,background:l.bg,color:l.fg},children:f[t]})}function k(e){let{s:t}=e;return"text_entry"===t.type&&t.textContent?(0,r.jsx)("div",{style:{marginTop:8,padding:10,background:b.surf,borderRadius:6,fontSize:12,color:b.ink,whiteSpace:"pre-wrap",lineHeight:1.5},children:v(t.textContent,600)}):"file_upload"===t.type&&t.fileUrl?(0,r.jsxs)("a",{href:t.fileUrl,target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",gap:6,marginTop:8,fontSize:12,color:b.purple,fontWeight:600},children:[(0,r.jsx)(S,{})," ",t.fileName||"Download submission"]}):"platform_link"===t.type?(0,r.jsxs)("div",{style:{marginTop:8,fontSize:12,color:b.sub},children:["Platform resource: ",t.platformResourceUrl?(0,r.jsx)("a",{href:t.platformResourceUrl,target:"_blank",rel:"noreferrer",style:{color:b.purple,fontWeight:600},children:"view ↗"}):(0,r.jsx)("code",{style:{color:b.ink},children:t.platformResourceId||"—"})]}):"external_link"===t.type&&t.externalUrl?(0,r.jsxs)("a",{href:t.externalUrl,target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",gap:6,marginTop:8,fontSize:12,color:b.purple,fontWeight:600},children:[(0,r.jsx)(L,{})," ",t.externalUrl]}):(0,r.jsx)("div",{style:{marginTop:8,fontSize:11,color:b.sub,fontStyle:"italic"},children:"(no content)"})}function w(e){let{entry:t}=e;if(t.feedbackAvailableAt)return(0,r.jsxs)("div",{style:{marginTop:10,padding:10,background:b.pale,borderRadius:6,fontSize:12,color:b.deep,display:"flex",alignItems:"center",gap:6},children:[(0,r.jsx)(I,{})," Feedback available ",function(e){if(!e)return"soon";let t=new Date(e).getTime()-Date.now();if(!Number.isFinite(t)||t<=0)return"shortly";let l=Math.round(t/36e5);return l>=24?"in ~".concat(Math.round(l/24),"d"):l>=1?"in ~".concat(l,"h"):"in ~".concat(Math.max(1,Math.round(t/6e4)),"m")}(t.feedbackAvailableAt)," (",y(t.feedbackAvailableAt),")"]});if(t.adminReview&&t.adminReview.feedback)return(0,r.jsxs)("div",{style:{marginTop:10,padding:10,background:b.surf,borderRadius:6,fontSize:12,color:b.ink,lineHeight:1.5,borderLeft:"3px solid ".concat(b.gold)},children:[(0,r.jsx)("div",{style:{fontSize:10,fontWeight:700,color:b.gold,letterSpacing:.6,textTransform:"uppercase",marginBottom:4},children:"Coach feedback"}),(0,r.jsx)(m.Z,{text:v(t.adminReview.feedback,1200),size:12,color:b.ink})]});if(t.aiReview&&t.aiReview.feedback){var l;return(0,r.jsxs)("div",{style:{marginTop:10,padding:10,background:b.surf,borderRadius:6,fontSize:12,color:b.ink,lineHeight:1.5,borderLeft:"3px solid ".concat(b.purple)},children:[(0,r.jsxs)("div",{style:{fontSize:10,fontWeight:700,color:b.purple,letterSpacing:.6,textTransform:"uppercase",marginBottom:4},children:["AI feedback ","number"==typeof t.aiReview.score?"\xb7 ".concat(t.aiReview.score,"/100"):""]}),(0,r.jsx)(m.Z,{text:v(t.aiReview.feedback,1200),size:12,color:b.ink}),(null===(l=t.aiReview.flags)||void 0===l?void 0:l.length)>0&&(0,r.jsx)("div",{style:{marginTop:6,display:"flex",flexWrap:"wrap",gap:4},children:t.aiReview.flags.map(e=>(0,r.jsx)("span",{style:{fontSize:9,fontWeight:600,color:b.sub,background:"#fff",border:"1px solid ".concat(b.rule),borderRadius:3,padding:"1px 6px"},children:e},e))})]})}return(0,r.jsx)("div",{style:{marginTop:10,fontSize:11,color:b.sub,fontStyle:"italic"},children:"Feedback not yet generated."})}function N(e){let{entry:t,isCurrent:l}=e;return(0,r.jsxs)("div",{style:{position:"relative",paddingLeft:22,paddingBottom:18,borderLeft:"2px s
1olid ".concat(b.rule),marginLeft:8},children:[(0,r.jsx)("div",{style:{position:"absolute",left:-7,top:0,width:12,height:12,borderRadius:"50%",background:l?b.gold:g[t.status].fg,boxShadow:"0 0 0 3px ".concat(b.surf)}}),(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,r.jsxs)("span",{style:{fontSize:12,fontWeight:700,color:b.ink},children:["Attempt ",t.attemptNumber]}),(0,r.jsx)(j,{status:t.status}),l&&(0,r.jsx)("span",{style:{fontSize:9,fontWeight:700,color:b.gold,background:"rgba(201,168,76,.15)",padding:"2px 6px",borderRadius:3,textTransform:"uppercase",letterSpacing:.5},children:"Current draft"}),(0,r.jsx)("span",{style:{fontSize:11,color:b.sub,marginLeft:"auto"},children:y(t.submittedAt)})]}),(0,r.jsx)(k,{s:t.submission}),(0,r.jsx)(w,{entry:t})]})}function C(e){var t;let{cohortSlug:l,deliverableId:n,currentSubmissionId:a,collapsible:i=!0,defaultCollapsed:d=!0}=e,[c,u]=(0,s.useState)(!i||!d),{data:x,isLoading:m,error:f}=function(e,t){let l=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return(0,o.useQuery)({queryKey:["atp","deliverable-history",e,t],queryFn:async()=>{let l=await fetch("".concat(h,"/atp/deliverables/").concat(encodeURIComponent(t),"/history?cohortSlug=").concat(encodeURIComponent(e)),{headers:(0,p.iL)()});if(!l.ok)throw Error("history ".concat(l.status));return l.json()},enabled:l&&!!e&&!!t,staleTime:3e4,refetchOnWindowFocus:!0})}(l,n,c),g=null!==(t=null==x?void 0:x.totalAttempts)&&void 0!==t?t:0,y=(0,r.jsxs)("button",{onClick:()=>u(e=>!e),style:{width:"100%",display:"flex",alignItems:"center",gap:10,background:"transparent",border:"none",padding:"8px 0",cursor:i?"pointer":"default",fontFamily:"inherit"},children:[(0,r.jsx)("span",{style:{fontSize:10,fontWeight:700,color:b.sub,letterSpacing:.8,textTransform:"uppercase"},children:"Revision history"}),g>0&&(0,r.jsx)("span",{style:{fontSize:10,fontWeight:700,color:b.purple,background:"rgba(147,52,235,.1)",padding:"1px 8px",borderRadius:99},children:g}),(0,r.jsx)("span",{style:{flex:1,height:1,background:b.rule}}),i&&(0,r.jsx)("span",{style:{fontSize:11,color:b.sub},children:c?"Hide":"Show"})]});return(0,r.jsxs)("div",{style:{marginTop:16,padding:"0 4px"},children:[y,c&&(0,r.jsxs)("div",{style:{marginTop:8},children:[m&&(0,r.jsx)("div",{style:{fontSize:12,color:b.sub,padding:"12px 0"},children:"Loading history…"}),f&&!m&&(0,r.jsxs)("div",{style:{fontSize:12,color:"#dc2626",padding:"12px 0"},children:["Couldn’t load history: ",f.message]}),!m&&!f&&x&&0===x.entries.length&&(0,r.jsx)("div",{style:{fontSize:12,color:b.sub,fontStyle:"italic",padding:"12px 0"},children:"No submissions yet. Your first attempt will appear here once submitted."}),!m&&!f&&x&&x.entries.length>0&&(0,r.jsx)("div",{style:{marginTop:4},children:x.entries.map(e=>(0,r.jsx)(N,{entry:e,isCurrent:!!a&&e._id===a},e._id))})]})]})}function S(e){let{size:t=14}=e;return(0,r.jsx)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0},children:(0,r.jsx)("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}function L(e){let{size:t=14}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0},children:[(0,r.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,r.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function I(e){let{size:t=14}=e;return(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flexShrink:0},children:[(0,r.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,r.jsx)("polyline",{points:"12 6 12 12 16 14"})]})}let _=void 0!==l(40257)&&"https://api.alleviate.org/api"||"http://localhost:5055",M=(()=>{let e=_.replace(/\/+$/,"");return e.endsWith("/api")?e:"".concat(e,"/api")})();function A(e,t){return null==e?"":"string"==typeof e?e:e[t]||e.en||e.fr||""}function T(e){if(!e||"string"!=typeof e)return e;let t=e;return(t=t.replace(/style="([^"]*)"/gi,(e,t)=>{let l=(()=>{let e=t.match(/background(?:-color)?\s*:\s*([^;]+)/i);if(!e)return!1;let l=e[1].trim().toLowerCase(),r=l.match(/^#([0-9a-f]{3,8})\b/);if(r){let e=r[1],t=3===e.length?e.split("").map(e=>e+e).join(""):e.length>=6?e.slice(0,6):null;if(t){let e=parseInt(t.slice(0,2),16);if(.299*e+.587*parseInt(t.slice(2,4),16)+.114*parseInt(t.slice(4,6),16)<130)return!0}}let s=l.match(/rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);if(s){let e=+s[1];if(.299*e+.587*+s[2]+.114*+s[3]<130)return!0}return!!/(?:#471873|#3a1160|#2d1054|#1a1428|#0c0a12|#0c0f1a|#0a0d17|linear-gradient[^;]*#471873|linear-gradient[^;]*#3a1160)/i.test(l)})(),r=t;return l||(r=r.replace(/color\s*:\s*(?:#fff(?:fff)?|white|rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\))\s*;?/gi,"color: #1a1428;").replace(/color\s*:\s*rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*[\d.]+\s*\)\s*;?/gi,"color: #4a4a5a;")),r=r.replace(/background(?:-color)?\s*:\s*rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*[\d.]+\s*\)\s*;?/gi,"background: rgba(71, 24, 115, 0.04);").replace(/border(?:-color)?\s*:\s*([\d.]+px\s+\w+\s+)?rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*[\d.]+\s*\)\s*;?/gi,(e,t)=>"".concat(e.startsWith("border-color")?"border-color":"border",": ").concat(t||"","rgba(71, 24, 115, 0.15);")),'style="'.concat(r,'"')})).replace(/class="([^"]*)"/gi,(e,t)=>
1{let l=t.split(/\s+/).filter(Boolean).filter(e=>!/^text-white(\/\d+)?$/.test(e)&&!/^bg-white(\/\d+)?$/.test(e)&&!/^border-white(\/\d+)?$/.test(e)&&!/^placeholder-white(\/\d+)?$/.test(e)&&!/^divide-white(\/\d+)?$/.test(e)&&!/^ring-white(\/\d+)?$/.test(e)).join(" ");return l?'class="'.concat(l,'"'):""})}function U(e){if(!e)return e;let t=e.replace(/<pre\s+class=["']ql-syntax["'][^>]*>[\s\S]*?<\/pre>/gi,"");return RegExp("&lt;\\/?".concat(/(?:div|section|article|header|footer|main|aside|figure|table|tr|td|th|tbody|thead|nav)/i.source,"\\b"),"i").test(t)?e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&"):e}function R(e){return"fr"===((null==e?void 0:e.language)||"en").slice(0,2).toLowerCase()?"fr":"en"}let F={deep:"#471873",purple:"#9334eb",mid:"#c193ed",pale:"#ede0f7",gold:"#c9a84c",surf:"#f9f8fc",ink:"#1a1428",sub:"#6d707a",rule:"#d1d9ea"},W={1:{en:"Beginner",fr:"D\xe9butant"},2:{en:"Emerging",fr:"\xc9mergent"},3:{en:"Builder",fr:"Constructeur"},4:{en:"Practitioner",fr:"Praticien"},5:{en:"Transformer",fr:"Transformateur"}};function D(e){return(0,o.useQuery)({queryKey:["atp-modules",e],queryFn:async()=>{let t=await fetch("".concat(M,"/atp/modules/").concat(e),{headers:(0,p.iL)()});if(!t.ok)throw Error("modules ".concat(t.status));let l=await t.json();return Array.isArray(l)?l:l.modules||[]},staleTime:3e5,enabled:!!e,retry:(e,t)=>!/\b403\b/.test(String((null==t?void 0:t.message)||""))&&e<3})}let P={learn:()=>(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:[(0,r.jsx)("rect",{x:"2",y:"1.5",width:"9",height:"10",rx:"1.5",stroke:"currentColor",strokeWidth:"1.2"}),(0,r.jsx)("line",{x1:"4.5",y1:"4.5",x2:"8.5",y2:"4.5",stroke:"currentColor",strokeWidth:"1.1"}),(0,r.jsx)("line",{x1:"4.5",y1:"6.5",x2:"8.5",y2:"6.5",stroke:"currentColor",strokeWidth:"1.1"}),(0,r.jsx)("line",{x1:"4.5",y1:"8.5",x2:"7",y2:"8.5",stroke:"currentColor",strokeWidth:"1.1"})]}),build:()=>(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:[(0,r.jsx)("rect",{x:"2",y:"6",width:"3",height:"5.5",rx:"0.7",stroke:"currentColor",strokeWidth:"1.1"}),(0,r.jsx)("rect",{x:"5",y:"3.5",width:"3",height:"8",rx:"0.7",stroke:"currentColor",strokeWidth:"1.1"}),(0,r.jsx)("rect",{x:"8",y:"1.5",width:"3",height:"10",rx:"0.7",stroke:"currentColor",strokeWidth:"1.1"})]}),submit:()=>(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:[(0,r.jsx)("path",{d:"M6.5 1.5V8.5M6.5 1.5L4.5 3.5M6.5 1.5L8.5 3.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M2 9V11H11V9",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]}),done:()=>(0,r.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 13 13",fill:"none",children:[(0,r.jsx)("circle",{cx:"6.5",cy:"6.5",r:"5.5",stroke:"currentColor",strokeWidth:"1.2"}),(0,r.jsx)("path",{d:"M4 6.5L5.5 8L9 5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})]}),lock:()=>(0,r.jsxs)("svg",{width:"11",height:"12",viewBox:"0 0 11 12",fill:"none",children:[(0,r.jsx)("rect",{x:"1.5",y:"5.5",width:"8",height:"6",rx:"1",stroke:"currentColor",strokeWidth:"1.1"}),(0,r.jsx)("path",{d:"M3.5 5.5V3.8C3.5 2.5 4.4 1.5 5.5 1.5C6.6 1.5 7.5 2.5 7.5 3.8V5.5",stroke:"currentColor",strokeWidth:"1.1"})]}),chevronRight:()=>(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:(0,r.jsx)("path",{d:"M5 3L9 7L5 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),chevronLeft:()=>(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:(0,r.jsx)("path",{d:"M9 3L5 7L9 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),bolt:()=>(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:(0,r.jsx)("path",{d:"M7 1L2 7H6.5L5 11L10 5H5.5L7 1Z",stroke:"currentColor",strokeWidth:"1.1",strokeLinejoin:"round"})})};function z(e){let{pct:t,size:l=64,stroke:s=5,color:o=F.gold,label:n}=e,a=(l-s)/2,i=2*Math.PI*a;return(0,r.jsxs)("div",{className:"relative inline-flex items-center justify-center",style:{width:l,height:l},children:[(0,r.jsxs)("svg",{width:l,height:l,style:{transform:"rotate(-90deg)"},children:[(0,r.jsx)("circle",{cx:l/2,cy:l/2,r:a,fill:"none",stroke:"rgba(255,255,255,0.08)",strokeWidth:s}),(0,r.jsx)("circle",{cx:l/2,cy:l/2,r:a,fill:"none",stroke:o,strokeWidth:s,strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:i-t/100*i,style:{transition:"stroke-dashoffset 0.6s ease"}})]}),n&&(0,r.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:n})]})}function B(e){var t;let{status:l}=e,s={approved:{bg:"rgba(5,150,105,.15)",text:"#4ade80",label:"Approved"},revision_requested:{bg:"rgba(217,119,6,.15)",text:"#fbbf24",label:"Revision Requested"},submitted:{bg:"rgba(147,52,235,.15)",text:"#c193ed",label:"Under Review"},pending_human_review:{bg:"rgba(201,168,76,.15)",text:"#c9a84c",label:"Coach Reviewing"},in_progress:{bg:"rgba(255,255,255,.08)",text:"rgba(255,255,255,.5)",label:"In Progress"},not_started:{bg:"rgba(255,255,255,.05)",text:"rgba(255,255,255,.25)",label:"Not Started"}},o=null!==(t=s[l])&&void 0!==t?t:s.not_started;return(0,r.jsx)("span",{className:"inline-flex items-center rounded px-2 py-0.5 text-[10px] font-bold tracking-wide uppercase",style:{background:o.bg,color:o.text},children:o.label})}function q(e){var t;let{progress:l,modules:o,cohortSlug:n,onNavigate:a}=e,{t:d,i18n:p}=(0,c.$G)("atp"),u=R(p),x=null!==(t=l.gamification)&&void 0!==t?t:{xp:0,level:1,streakDays:0,longestStreak:0,badges:[],xpHistory:[]},m=Array.isArray(l.deliverables)?l.deliverables:[],h=Array.isArray(l.modulesUnlocked)?l.modulesUnlocked:[],b=Array.isArray(l.modulesCompleted)?l.modulesCompleted:[],f=m.filter(e=>"approved"===e.status).length,g=Math.max((null==l?void 0:l.cohortDeliverablesTotal)||0,m.length,f),y=g>0?Math.min(100,Math.round(f/g*100)):0,v=(0,s.useMemo)(()=>{var e,t;let l=[0,100,300,600,1e3],r=null!==(e=l.find(e=>e>x.xp))&&void 0!==e?e:null;if(!r)return null;let s=null!==(t=l[x.level-1])&&void 0!==t?t:0;return{needed:r-x.xp,progress:(x.xp-s)/(r-s)}},[x]),j=(0,s.useMemo)(()=>{for(let e of o){if(!h.includes(e.slug)||b.includes(e.slug))continue;let t=e.deliverablesInModule.find(e=>{let t=m.find(t=>t.deliverableId===e);return!t||"approved"!==t.status});if(t)return{module:e,deliverableId:t}}return null},[o,h,b,m]);return(0,r.jsxs)("div",{className:"min-h-screen",style:{background:F.surf},children:[(0,r.jsxs)("div",{className:"relative overflow-hidden",style:{background:F.deep},children:[(0,r.jsx)("div",{className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(ellipse 60% 100% at 80% 50%, rgba(147,52,235,.12) 0%, transparent 70%)"}}),(0,r.jsxs)("div",{className:"relative z-10 px-9 pt-7 pb-6",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-xs font-bold tracking-widest uppercase mb-1",style:{color:F.gold},children:"Alleviate Transformation Program"}),(0,r.jsxs)("h1",{className:"font-serif text-white text-3xl font-light leading-tight",style:{fontFamily:"Cormorant Garamond, serif"},children:["Welcome back",(l.orgName||"").trim()?(0,r.jsxs)(r.Fragment,{children:[","," ",(0,r.jsxs)("em",{className:"italic",style:{color:F.mid},children:[l.orgName.trim().split(" ")[0],"."]})]}):"."]}),(0,r.jsx)("p",{className:"text-sm mt-1",style:{color:"rgba(193,147,237,.6)"},children:(null==l?void 0:l.cohortName)||n.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())})]}),(0,r.jsx)(z,{pct:y,size:76,stroke:5,label:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"text-base font-bold text-white leading-none",children:f}),(0,r.jsxs)("div",{className:"text-[9px] mt-0.5",style:{color:"rgba(255,255,255,.35)"},children:["of ",g]})]})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mt-5 flex-wrap",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3.5 py-1.5 rounded-full border",style:{background:"rgba(255,255,255,.06)",borderColor:"rgba(255,255,255,.1)"},children:[(0,r.jsx)(P.bolt,{}),(0,r.jsxs)("span",{className:"text-sm font-bold tabular-nums",style:{color:F.gold,fontFamily:"JetBrains Mono, monospace"}
1,children:[x.xp.toLocaleString("en-US")," XP"]}),(0,r.jsxs)("span",{className:"text-xs",style:{color:"rgba(255,255,255,.35)"},children:["Level ",x.level," — ",A(W[x.level],u)||"Builder"]})]}),x.streakDays>0&&(0,r.jsxs)("div",{className:"px-3.5 py-1.5 rounded-full border text-xs font-semibold",style:{background:"rgba(201,168,76,.1)",borderColor:"rgba(201,168,76,.2)",color:F.gold},children:[x.streakDays,"-day streak"]}),(0,r.jsxs)("div",{className:"px-3.5 py-1.5 rounded-full border text-xs font-semibold",style:{background:"rgba(147,52,235,.1)",borderColor:"rgba(147,52,235,.2)",color:F.mid},children:[b.length," of ",o.length," module",1===o.length?"":"s"]})]}),v&&(0,r.jsxs)("div",{className:"mt-3",children:[(0,r.jsx)("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"rgba(255,255,255,.08)",width:220},children:(0,r.jsx)("div",{className:"h-full rounded-full transition-all duration-700",style:{width:"".concat(100*v.progress,"%"),background:"linear-gradient(90deg, ".concat(F.purple,", ").concat(F.gold,")")}})}),(0,r.jsxs)("p",{className:"text-[10px] mt-1",style:{color:"rgba(255,255,255,.25)"},children:[v.needed," XP to Level ",x.level+1," — ",A(W[x.level+1],u)]})]})]})]}),(0,r.jsxs)("div",{className:"px-9 py-5 space-y-5",children:[j&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-5 rounded-2xl border",style:{background:"#fff",borderColor:F.rule},children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-bold tracking-widest uppercase mb-1",style:{color:F.purple},children:"Up Next"}),(0,r.jsxs)("p",{className:"text-sm font-bold",style:{color:F.ink},children:[A(j.module.title,u)," — ",j.deliverableId]}),(0,r.jsx)("p",{className:"text-xs mt-0.5",style:{color:F.sub},children:A(j.module.subtitle,u)})]}),(0,r.jsx)("button",{onClick:()=>a("/dashboard/atp/".concat(n,"/").concat(j.module.slug)),className:"px-4 py-2.5 rounded-lg text-sm font-semibold text-white transition-opacity hover:opacity-90",style:{background:F.purple},children:"Continue →"})]}),(0,r.jsxs)("a",{href:"/dashboard/participant/certificate",className:"block p-4 rounded-xl border transition-shadow hover:shadow-md",style:{background:"#fff",borderColor:F.rule,textDecoration:"none",cursor:"pointer"},title:"See the status of every deliverable",children:[(0,r.jsxs)("div",{className:"flex justify-between mb-2",children:[(0,r.jsx)("span",{className:"text-xs font-semibold",style:{color:F.ink},children:"Overall Progress"}),(0,r.jsxs)("span",{className:"text-xs font-bold",style:{color:F.purple},children:[f," / ",g," deliverables approved →"]})]}),(0,r.jsx)("div",{className:"h-2 rounded-full overflow-hidden",style:{background:F.rule},children:(0,r.jsx)("div",{className:"h-full rounded-full transition-all duration-700",style:{width:"".concat(y,"%"),background:"linear-gradient(90deg, ".concat(F.purple,", ").concat(F.gold,")")}})})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:o.map(e=>{let t=e=>{let t=null==l?void 0:l.cohortGateType,r=null==l?void 0:l.cohortLaunchDate;if("date"!==t&&"days_from_start"!==t||!r)return null;let s=new Date(new Date(r).getTime()+864e5*(Number(e.unlockAfterDays)||0));return isNaN(s.getTime())?null:s.toLocaleDateString("fr"===u?"fr-FR":"en-US",{weekday:"long",day:"numeric",month:"long",timeZone:"UTC"})},s=h.includes(e.slug),o=b.includes(e.slug),d=m.filter(t=>e.deliverablesInModule.includes(t.deliverableId)).filter(e=>"approved"===e.status).length,c=e.deliverablesInModule.length>0?Math.round(d/e.deliverablesInModule.length*100):0;return(0,r.jsxs)(i.E.div,{whileHover:s?{y:-2,scale:1.01}:void 0,onClick:()=>s&&a("/dashboard/atp/".concat(n,"/").concat(e.slug)),className:"relative p-5 rounded-2xl border transition-all overflow-hidden ".concat(s?"cursor-pointer":"opacity-50 cursor-not-allowed"),style:{background:"#fff",borderColor:s&&!o?F.rule:o?"rgba(147,52,235,.25)":F.rule,boxShadow:s&&!o?"none":o?"0 2px 12px rgba(147,52,235,.08)":"none"},children:[o&&(0,r.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5",style:{background:"linear-gradient(90deg, ".concat(F.purple,", ").concat(F.gold,")")}}),s&&!o&&(0,r.jsx)("div",{className:"absolute top-3 right-3",children:(0,r.jsx)("span",{className:"text-[9px] font-bold tracking-wide uppercase px-2 py-0.5 rounded",style:{background:"rgba(147,52,235,.1)",color:F.purple},children:c>0?"In Progress":"Available"})}),!s&&(0,r.jsx)("div",{className:"absolute top-3 right-3",style:{color:F.sub},children:(0,r.jsx)(P.lock,{})}),(0,r.jsx)("p",{className:"text-[9px] font-bold tracking-widest uppercase mb-1",style:{color:F.purple},children:0===e.order?"Kickoff":"Week ".concat(e.order)}),(0,r.jsx)("h3",{className:"font-serif text-lg font-semibold leading-tight mb-1",style:{fontFamily:"Cormorant Garamond, serif",color:F.ink},children:A(e.title,u)}),(0,r.jsx)("p",{className:"text-xs leading-relaxed mb-3",style:{color:F.sub},children:A(e.subtitle,u)}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("span",{className:"text-[11px]",style:{color:F.sub},children:[e.deliverablesInModule.length," deliverable",1!==e.deliverablesInModule.length?"s":""]}),o?(0,r.jsx)("span",{className:"text-[11px] font-bold",style:{color:"#059669"},children:"Complete"}):s?(0,r.jsx)(z,{pct:c,size:32,stroke:3,label:(0,r.jsxs)("span",{className:"text-[9px] font-bold text-white",children:[c,"%"]})}):t(e)?(0,r.jsxs)("span",{className:"text-[11px] font-semibold",style:{color:F.sub},children:["Opens ",t(e)]}):null]})]},e.slug)})}),x.badges.length>0&&(0,r.jsxs)("div",{className:"p-4 rounded-xl border",style:{background:"#fff",borderColor:F.rule},children:[(0,r.jsxs)("p",{className:"text-xs font-bold mb-3",style:{color:F.ink},children:["Badges Earned ",(0,r.jsxs)("span",{className:"font-normal ml-1",style:{color:F.sub},children:[x.badges.length," of 7"]})]}),(0,r.jsx)("div",{className:"flex gap-2 flex-wrap",children:x.badges.map(e=>(0,r.jsx)("img",{src:"/badges/badge_".concat(e.id,".svg"),alt:e.id,className:"w-12 h-12 rounded-xl",style:{filter:"drop-shadow(0 2px 6px rgba(201,168,76,.3))"}},e.id))})]})]})]})}function E(e){var t,l,s;let{module:o,progress:n,cohortSlug:a,onNavigate:d}=e,{i18n:p}=(0,c.$G)("atp"),u=R(p);n.deliverables.filter(e=>o.deliverablesInModule.includes(e.deliverableId));let x=Array.isArray(null==n?void 0:n.lessons)?n.lessons:[],m=(null!==(t=o.lessons)&&void 0!==t?t:[]).filter(e=>{if("submit"===e.type){var t;return(null===(t=n.deliverables.find(t=>t.deliverableId===e.deliverableId))||void 0===t?void 0:t.status)==="approved"}let l=x.find(t=>String(t.lessonId)===String(e._id)||t.lessonSlug===e.slug);return!!(null==l?void 0:l.completedAt)}).length,h=(null!==(l=o.lessons)&&void 0!==l?l:[]).length,b=h>0?Math.round(m/h*100):0;return(0,r.jsxs)("div",{className:"min-h-screen",style:{background:F.surf},children:[(0,r.jsx)("div",{className:"relative overflow-hidden",style:{background:F.deep},children:(0,r.jsxs)("div",{className:"px-10 pt-8 pb-7 flex items-start justify-between gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("button",{onClick:()=>d("/dashboard/atp/".concat(a)),className:"flex items-center gap-1 text-xs mb-3 transition-opacity hover:opacity-70",style:{color:"rgba(255,255,255,.35)"},children:[(0,r.jsx)(P.chevronLeft,{})," ATP Hub"]}),(0,r.jsx)("p",{className:"text-[10px] font-bold tracking-widest uppercase mb-1",style:{color:F.gold},children:0===o.order?"Kickoff":"Week ".concat(o.order," \xb7 Module ").concat(o.order)}),(0,r.jsx)("h1",{className:"font-serif text-4xl font-bold text-white leading-tight",style:{fontFamily:"Cormorant Garamond, serif"},children:A(o.title,u)}),(0,r.jsx)("p",{className:"text-sm mt-1.5",style:{color:F.mid},children:A(o.subtitle,u)}),(0,r.jsx)("div",{className:"flex gap-5 mt-4 flex-wrap",children:["~".concat(o.estimatedHours," hours total"),"".concat(o.deliverablesInModule.length," deliverable").concat(1!==o.deliverablesInModule.length?"s":"")].map(e=>(0,r.jsx)("span",{className:"text-xs",style:{color:"rgba(255,255,255,.4)"},children:e},e))})]}),(0,r.jsx)(z,{pct:b,size:68,stroke:5,label:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsxs)("div",{className:"text-sm font-bold text-white",children:[b,"%"]}),(0,r.jsxs)("div",{className:"text-[9px]",style:{color:"rgba(255,255,255,.35)"},children:[m,"/",h]})]})})]})}),(0,r.jsxs)("div",{className:"px-10 py-6",children:[(0,r.jsx)("p",{className:"text-[10px] font-bold tracking-widest uppercase mb-3",style:{color:F.sub},children:"Lessons"}),(0,r.jsx)("div",{className:"space-y-2",children:(null!==(s=o.lessons)&&void 0!==s?s:[]).map((e,t)=>{let l=n.deliverables.find(t=>t.deliverableId===e.deliverableId),s=(null==l?void 0:l.status)==="approved",c=l&&["submitted","revision_requested","pending_human_review"].includes(l.status),p={learn:F.purple,build:F.gold,submit:F.deep};return(0,r.jsxs)(i.E.div,{whileHover:{x:2},onClick:()=>d("/dashboard/atp/".concat(a,"/").concat(o.slug,"/").concat(e.slug)),className:"flex items-center gap-4 p-4 rounded-xl border cursor-pointer transition-all",style:{background:s?"rgba(5,150,105,.03)":"#fff",borderColor:s?"rgba(5,150,105,.2)":F.rule},children:[(0,r.jsx)("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:"".concat(p[e.type],"18"),color:p[e.type]},children:s?(0,r.jsx)(P.done,{}):"learn"===e.type?(0,r.jsx)(P.learn,{}):"build"===e.type?(0,r.jsx)(P.build,{}):(0,r.jsx)(P.submit,{})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-[9px] font-bold tracking-wide uppercase mb-0.5",style:{color:F.sub},children:"submit"===e.type&&e.deliverableId?"Submit \xb7 ".concat(e.deliverableId):e.type}),(0,r.jsx)("p",{className:"text-sm font-semibold truncate",style:{color:F.ink},children:A(e.title,u)}),(0,r.jsxs)("p",{className:"text-[11px] mt-0.5",style:{color:F.sub},children:[e.type," \xb7 ",e.estimatedMins," min"]})]}),(0,r.jsx)("div",{className:"flex-shrink-0",children:s?(0,r.jsx)("span",{className:"text-[11px] font-bold",style:{color:"#059669"},children:"Approved"}):c?(0,r.jsx)(B,{status:l.status}):(0,r.jsx)(P.chevronRight,{})})]},e._id)})}),(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsxs)("button",{onClick:()=>{var e;let t=null===(e=o.lessons)||void 0===e?void 0:e[0];t&&d("/dashboard/atp/".concat(a,"/").concat(o.slug,"/").concat(t.slug))},className:"px-5 py-3 rounded-xl text-sm font-semibold text-white transition-opacity hover:opacity-90",style:{background:F.purple},children:[b>0?"Continue":"Start"," ",A(o.title,u)," →"]})})]})]})}function O(e){var t,l,o,x,h,b,f,g,y,v,j,k,w,N,S;let{lesson:L,deliverable:I,delivRecord:_,attemptsUsed:W,maxAttemptsEffective:D,cohortSlug:z,onSubmitted:q,onAdvance:E}=e,{i18n:O}
1=(0,c.$G)("atp"),H=R(O),[G,$]=(0,s.useState)(null!==(h=null==_?void 0:null===(t=_.submission)||void 0===t?void 0:t.content)&&void 0!==h?h:""),[Q,K]=(0,s.useState)(""),[J,V]=(0,s.useState)(""),[Y,Z]=(0,s.useState)(null!==(b=null==_?void 0:null===(l=_.submission)||void 0===l?void 0:l.externalUrl)&&void 0!==b?b:""),[X,ee]=(0,s.useState)(null!==(f=null==_?void 0:null===(o=_.submission)||void 0===o?void 0:o.externalUrl2)&&void 0!==f?f:""),[et,el]=(0,s.useState)(()=>{var e;let t={};return((null==_?void 0:null===(e=_.submission)||void 0===e?void 0:e.extraValues)||[]).forEach(e=>{(null==e?void 0:e.key)&&(t[e.key]={value:e.value||"",fileName:e.fileName})}),t}),er=Array.isArray(I.extraFields)?I.extraFields:[],es=er.filter(e=>e.required).every(e=>{var t;return((null===(t=et[e.key])||void 0===t?void 0:t.value)||"").trim()}),[eo,en]=(0,s.useState)(null!==(g=null==_?void 0:null===(x=_.submission)||void 0===x?void 0:x.linkedInAboutText)&&void 0!==g?g:""),[ea,ei]=(0,s.useState)(!1),[ed,ec]=(0,s.useState)(!1),[ep,eu]=(0,s.useState)(!1),[ex,em]=(0,s.useState)(""),eh=function(){let e=(0,n.useQueryClient)();return(0,a.useMutation)({mutationFn:e=>fetch("".concat(M,"/atp/deliverables/submit"),{method:"POST",headers:(0,p.authHeaders)(),body:JSON.stringify({cohortSlug:e.cohortSlug,deliverableId:e.deliverableId,submission:e.submissionData})}).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok)throw Error((null==t?void 0:t.message)||"Submission failed (".concat(e.status,")"));return t}),onSuccess:(t,l)=>{e.invalidateQueries({queryKey:["atp-progress",l.cohortSlug]})}})}(),eb=null!==(y=null==_?void 0:_.status)&&void 0!==y?y:"not_started",ef=null==_?void 0:_.aiReview,eg=null!==(v=null==_?void 0:_.attempts)&&void 0!==v?v:0,ey=null!==(j=null==_?void 0:_.attemptHistory)&&void 0!==j?j:[],ev="approved"===eb,ej="revision_requested"===eb,ek=["submitted","pending_human_review"].includes(eb),ew=null!==(k=null!=D?D:I.maxAttempts)&&void 0!==k?k:3,eN="number"==typeof W?W:eg,eC=!ev&&!ek&&eN>=ew,eS=G.trim().split(/\s+/).filter(Boolean).length,eL=null!==(w=I.minWords)&&void 0!==w?w:0,eI=!ev&&!ek&&!eC&&!!es&&("text_entry"===I.submissionType?eS>=eL:"file_upload"===I.submissionType?!!Q:"platform_link"===I.submissionType?ed:"external_link_with_text"===I.submissionType&&!!Y&&!!eo.trim()),[e_,eM]=(0,s.useState)(!1),[eA,eT]=(0,s.useState)(null);async function eU(){eu(!0),em("");try{let e={type:I.submissionType,content:G||void 0,fileUrl:Q||void 0,fileName:J||void 0,externalUrl:Y||void 0,externalUrl2:X||void 0,extraValues:Object.entries(et).filter(e=>{let[,t]=e;return(t.value||"").trim()}).map(e=>{let[t,l]=e;return{key:t,value:l.value,fileName:l.fileName}}),linkedInAboutText:eo||void 0};await eh.mutateAsync({cohortSlug:z,deliverableId:I.id,submissionData:e}),q()}catch(e){em((null==e?void 0:e.message)||"Submission failed — please try again.")}finally{eu(!1)}}return(0,s.useEffect)(()=>{if("platform_link"!==I.submissionType||ev||ek)return;let e=!1,t=async()=>{if(!e){eM(!0);try{var t,l;let r=(null===(t=I.platformLink)||void 0===t?void 0:t.autoDetectThreshold)!=null?"&threshold=".concat(encodeURIComponent(String(I.platformLink.autoDetectThreshold))):"",s=await fetch("".concat(M,"/atp/detect-platform-resource?feature=").concat(encodeURIComponent((null===(l=I.platformLink)||void 0===l?void 0:l.feature)||""),"&cohortSlug=").concat(encodeURIComponent(z)).concat(r),{headers:(0,p.iL)()}),{detected:o,snapshot:n}=await s.json();!e&&n&&("number"==typeof n.activeCount||"number"==typeof n.threshold)&&eT(n),!e&&o&&ec(!0)}catch(e){}e||eM(!1)}};t();let l=setInterval(t,3e4);return()=>{e=!0,clearInterval(l)}},[I,z,ev,ek]),(0,r.jsxs)("div",{className:"mt-6 rounded-2xl border overflow-hidden",style:{borderColor:F.rule,background:"#fff"},children:[(0,r.jsxs)("div",{className:"px-6 py-4 flex items-center gap-3 border-b",style:{borderColor:F.rule},children:[(0,r.jsx)("span",{className:"px-2.5 py-1 rounded-lg text-xs font-bold tabular-nums",style:{background:F.deep,color:F.gold,fontFamily:"JetBrains Mono, monospace"},children:I.id}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-bold",style:{color:F.ink},children:A(I.name,H)}),(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,r.jsx)(B,{status:eb}),eN>0&&(0,r.jsxs)("span",{className:"text-[11px]",style:{color:F.sub},children:["Attempt ",Math.min(eN,ew)," of ",ew]})]})]})]}),(0,r.jsxs)("div",{className:"px-6 py-5 space-y-5",children:[(0,r.jsxs)("div",{className:"p-4 rounded-xl atp-prose",style:{background:F.surf,color:F.ink,fontSize:14,lineHeight:1.7},children:[(0,r.jsx)("p",{className:"text-[10px] font-bold tracking-wide uppercase mb-2",style:{color:F.purple},children:"Instructions"}),(()=>{let e=A(I.instructions,H)||"";if(/<\/?[a-z][\s\S]*>/i.test(e)){let t=T(U(e));return(0,r.jsx)("div",{dangerouslySetInnerHTML:{__html:t}})}return(0,r.jsx)("p",{style:{whiteSpace:"pre-wrap",margin:0},children:e})})()]}),I.templateUrl&&(()=>{let e=I.templateFileName||"".concat(I.id,"-template.").concat((I.templateUrl.split(".").pop()||"file").toLowerCase()),t=(e.split(".").pop()||"").toLowerCase(),l="xlsx"===t||"csv"===t?"#059669":"pdf"===t?"#dc2626":"docx"===t||"doc"===t?"#3b82f6":F.purple,s=async t=>{t.preventDefault(),await (0,u.OP)(I.templateUrl,e)||window.open(I.templateUrl,"_blank","noopener")};return(0,r.jsxs)("a",{href:I.templateUrl,onClick:s,download:e,target:"_blank",rel:"noreferrer",className:"flex items-center gap-3 p-4 rounded-xl border transition-colors hover:bg-white cursor-pointer",style:{borderColor:F.rule,background:"#fff"},children:[(0,r.jsx)("span",{className:"font-mono text-[10px] font-bold px-2 py-1 rounded",style:{background:"rgba(0,0,0,.05)",color:l},children:t?t.toUpperCase():"FILE"}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-[10px] font-bold tracking-wide uppercase mb-0.5",style:{color:F.gold},children:"Starter template"}),(0,r.jsx)("p",{className:"text-sm font-semibold truncate",style:{color:F.ink},children:e})]}),(0,r.jsx)("span",{className:"text-xs font-semibold flex items-center gap-1.5",style:{color:F.purple},children:"Download ↓"})]})})(),!ev&&!ek&&(0,r.jsxs)(r.Fragment,{children:["text_entry"===I.submissionType&&(0,r.jsxs)("div",{className:"rounded-xl overflow-hidden border",style:{borderColor:F.rule},children:[(0,r.jsx)("div",{className:"px-3 py-2 border-b flex gap-1",
1style:{borderColor:F.rule,background:F.surf},children:["B","I","U"].map(e=>(0,r.jsx)("button",{className:"px-2 py-1 rounded text-xs font-medium transition-colors hover:bg-white",style:{color:F.sub},children:e},e))}),(0,r.jsx)("textarea",{value:G,onChange:e=>$(e.target.value),placeholder:"Write your response here...",className:"w-full p-4 text-sm outline-none resize-y min-h-40",style:{color:F.ink,fontFamily:"DM Sans, sans-serif",borderBottom:"3px solid transparent",borderLeft:"3px solid ".concat(F.purple)}}),(0,r.jsxs)("div",{className:"px-3 py-2 flex items-center justify-between border-t text-[11px]",style:{borderColor:F.rule,background:F.surf},children:[(0,r.jsxs)("span",{style:{color:eS<eL?"#dc2626":F.sub},children:[eS," / ",eL," words minimum"]}),(0,r.jsx)("span",{style:{color:F.sub},children:"Auto-saved"})]})]}),"file_upload"===I.submissionType&&(0,r.jsx)("div",{className:"rounded-xl border-2 border-dashed p-8 text-center transition-colors",style:{borderColor:Q?F.gold:F.rule,background:Q?"rgba(201,168,76,.04)":F.surf},children:Q?(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-semibold",style:{color:F.ink},children:J}),(0,r.jsx)("p",{className:"text-xs mt-1",style:{color:F.sub},children:"File ready to submit"}),(0,r.jsx)("button",{onClick:()=>{K(""),V("")},className:"text-xs mt-2",style:{color:F.sub},children:"Remove"})]}):(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-semibold mb-1",style:{color:F.ink},children:"Upload your file"}),(0,r.jsxs)("p",{className:"text-xs mb-3",style:{color:F.sub},children:[(null!==(N=I.fileTypes)&&void 0!==N?N:["pdf","docx","xlsx"]).join(", ").toUpperCase()," \xb7 Max 10MB"]}),(0,r.jsxs)("label",{className:"px-4 py-2 rounded-lg text-sm font-semibold text-white cursor-pointer",style:{background:F.purple},children:["Choose File",(0,r.jsx)("input",{type:"file",accept:(null!==(S=I.fileTypes)&&void 0!==S?S:[]).map(e=>".".concat(e)).join(","),className:"hidden",onChange:async e=>{var t;let l=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!l)return;V(l.name);let r=new FormData;r.append("file",l),r.append("deliverableId",I.id);let s=(0,p.iL)(),o=await fetch("".concat(M,"/atp/participant/upload"),{method:"POST",headers:s,body:r}),{url:n}=await o.json();K(n)}})]})]})}),"platform_link"===I.submissionType&&(()=>{var e,t,l;let s=(null===(e=I.platformLink)||void 0===e?void 0:e.path)||"",o=(null===(t=I.platformLink)||void 0===t?void 0:t.feature)||"";return(0,r.jsxs)("div",{className:"rounded-xl border p-6 text-center",style:{background:"rgba(147,52,235,.04)",borderColor:"rgba(147,52,235,.15)"},children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-xl mx-auto mb-3 flex items-center justify-center",style:{background:"rgba(147,52,235,.12)",color:F.purple},children:(0,r.jsx)(P.build,{})}),(0,r.jsxs)("p",{className:"text-sm font-bold mb-1.5",style:{color:F.ink},children:["Link Your ",(()=>{var e;let t=(A(null===(e=I.platformLink)||void 0===e?void 0:e.label,H)||"Resource").replace(/^(open|view|configure|create|set up|go to|visit)\s+(your\s+)?/i,"");return t.charAt(0).toUpperCase()+t.slice(1)})()]}),(0,r.jsx)("p",{className:"text-xs leading-relaxed mb-4",style:{color:F.sub},children:"Build this in Alleviate first, then come back — we will detect it automatically."}),(0,r.jsxs)("a",{href:{org_profile:"/dashboard/settings/organisation"}[o]||s,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-lg text-sm font-semibold text-white",style:{background:F.purple},children:[A(null===(l=I.platformLink)||void 0===l?void 0:l.label,H)||"Open in Alleviate"," →"]}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 mt-3 text-xs ".concat(ed?"text-green-500":""),style:{color:ed?"#4ade80":F.sub},children:[(0,r.jsx)("span",{className:"w-1.5 h-1.5 rounded-full animate-pulse",style:{background:ed?"#4ade80":F.sub}}),ed?"Resource detected — ready to submit":eA&&"number"==typeof eA.activeCount&&"number"==typeof eA.threshold?"".concat(eA.activeCount," of ").concat(eA.threshold).concat(eA.unit?" ".concat(eA.unit):""," detected — add ").concat(Math.max(1,eA.threshold-eA.activeCount)," more, this updates automatically"):e_?"Checking your Alleviate workspace…":"Not detected yet — Alleviate will re-check every 30s"]})]})})(),"external_link_with_text"===I.submissionType&&(()=>{var e;let t={linkedin:{urlLabel:{en:"Your LinkedIn Organisation Page URL",fr:"URL de votre page LinkedIn"},urlPlaceholder:"https://linkedin.com/company/your-org",textLabel:{en:"Paste your LinkedIn About section",fr:"Collez la section \xc0 propos de LinkedIn"},textPlaceholder:"Go to your LinkedIn company page → About → copy the full text and paste here...",textMinWords:50},website:{urlLabel:{en:"Your Live Website URL",fr:"URL de votre site web"},urlPlaceholder:"https://your-organisation.org",textLabel:{en:"Brief description of your live website",fr:"Br\xe8ve description de votre site web"},textPlaceholder:"Describe what visitors see on your homepage, what programmes / services are listed, and 
1your call to action…",textMinWords:50}}[(null===(e=I.platformLink)||void 0===e?void 0:e.feature)||""]||{urlLabel:{en:"URL",fr:"URL"},urlPlaceholder:"https://…",textLabel:{en:"Description",fr:"Description"},textPlaceholder:"Add a short description…",textMinWords:50},l=I.externalLinkConfig||{},s=A(l.urlLabel,H)||A(t.urlLabel,H),o=l.urlPlaceholder||t.urlPlaceholder,n=A(l.urlLabel2,H)||"",a=l.urlPlaceholder2||"https://…",i=A(l.textLabel,H)||A(t.textLabel,H),d=l.textPlaceholder||t.textPlaceholder,c=("number"==typeof l.textMinWords?l.textMinWords:t.textMinWords)||50,p=eo.trim().split(/\s+/).filter(Boolean).length;return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-semibold mb-1.5",style:{color:F.ink},children:s}),(0,r.jsx)("input",{type:"url",value:Y,onChange:e=>Z(e.target.value),placeholder:o,className:"w-full px-3.5 py-2.5 rounded-xl border text-sm outline-none",style:{borderColor:F.rule,color:F.ink,fontFamily:"DM Sans, sans-serif"}})]}),n&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-xs font-semibold mb-1.5",style:{color:F.ink},children:[n," ",(0,r.jsx)("span",{className:"font-normal",style:{color:F.sub},children:"(optional)"})]}),(0,r.jsx)("input",{type:"url",value:X,onChange:e=>ee(e.target.value),placeholder:a,className:"w-full px-3.5 py-2.5 rounded-xl border text-sm outline-none",style:{borderColor:F.rule,color:F.ink,fontFamily:"DM Sans, sans-serif"}})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-semibold mb-1.5",style:{color:F.ink},children:i}),(0,r.jsx)("textarea",{value:eo,onChange:e=>en(e.target.value),placeholder:d,rows:5,className:"w-full px-3.5 py-2.5 rounded-xl border text-sm outline-none resize-y",style:{borderColor:F.rule,color:F.ink,fontFamily:"DM Sans, sans-serif"}}),(0,r.jsxs)("p",{className:"text-[11px] mt-1",style:{color:F.sub},children:["Minimum ",c," words \xb7 ",p," words entered"]})]})]})})(),er.length>0&&(0,r.jsx)("div",{className:"space-y-3",children:er.map(e=>{let t=et[e.key]||{value:""},l=(t,l)=>el(r=>({...r,[e.key]:{value:t,fileName:l}})),s=A(e.label,H)||e.key,o="text"===e.type?(t.value||"").trim().split(/\s+/).filter(Boolean).length:0;return(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:"block text-xs font-semibold mb-1.5",style:{color:F.ink},children:[s," ",!e.required&&(0,r.jsx)("span",{className:"font-normal",style:{color:F.sub},children:"(optional)"})]}),"url"===e.type&&(0,r.jsx)("input",{type:"url",value:t.value,onChange:e=>l(e.target.value),placeholder:e.placeholder||"https://…",className:"w-full px-3.5 py-2.5 rounded-xl border text-sm outline-none",style:{borderColor:F.rule,color:F.ink,fontFamily:"DM Sans, sans-serif"}}),"text"===e.type&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("textarea",{value:t.value,onChange:e=>l(e.target.value),placeholder:e.placeholder||"",rows:4,className:"w-full px-3.5 py-2.5 rounded-xl border text-sm outline-none resize-y",style:{borderColor:F.rule,color:F.ink,fontFamily:"DM Sans, sans-serif"}}),(e.minWords||0)>0&&(0,r.jsxs)("p",{className:"text-[11px] mt-1",style:{color:F.sub},children:["Minimum ",e.minWords," words \xb7 ",o," words entered"]})]}),"file"===e.type&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("label",{className:"px-4 py-2 rounded-lg text-sm font-semibold text-white cursor-pointer",style:{background:F.purple},children:[t.value?"Replace File":"Choose File",(0,r.jsx)("input",{type:"file",className:"hidden",onChange:async e=>{var t;let r=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!r)return;let s=new FormData;s.append("file",r),s.append("deliverableId",I.id);let o=await fetch("".concat(M,"/atp/participant/upload"),{method:"POST",headers:(0,p.iL)(),body:s}),{url:n}=await o.json();n&&l(n,r.name)}})]}),t.value&&(0,r.jsx)("span",{className:"text-xs truncate max-w-[240px]",style:{color:F.sub},children:t.fileName||t.value})]})]},e.key)})}),eC?(0,r.jsxs)("div",{className:"p-4 rounded-xl border",style:{borderColor:"#F0C36D",background:"#FDF8EE"},children:[(0,r.jsxs)("p",{className:"text-sm font-semibold",style:{color:F.ink},children:["All ",ew," attempts used"]}),(0,r.jsx)("p",{className:"text-xs mt-1",style:{color:F.sub},children:"You've reached the maximum number of submissions for this deliverable. Contact your programme coach to request another attempt."})]}):(0,r.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,r.jsx)("span",{className:"text-xs",style:{color:F.sub},children:ev?"Approved":ej?"Revision requested — resubmit when ready":"Attempt ".concat(eN+1," of ").concat(ew)}),(0,r.jsx)("button",{onClick:eU,disabled:!eI||ep,className:"px-5 py-2.5 rounded-xl text-sm font-semibold text-white transition-all disabled:opacity-40 disabled:cursor-not-allowed",style:{background:F.purple},children:ep?"Submitting…":ej?"Submit Revision →":"Submit →"})]}),ex&&(0,r.jsx)("p",{className:"text-xs mt-2 text-right",style:{color:"#B42318"},children:ex})]}
1),ek&&(0,r.jsxs)("div",{className:"p-4 rounded-xl border",style:{borderColor:F.rule},children:[(0,r.jsxs)("p",{className:"text-[10px] font-bold tracking-wide uppercase mb-3",style:{color:F.sub},children:["Review Status — Attempt ",eg]}),(0,r.jsx)("div",{className:"flex items-center gap-0",children:[{label:"Submitted",done:!0},{label:"Reviewing",active:!0},{label:"Feedback",done:!1},{label:"Approved",done:!1}].map((e,t,l)=>(0,r.jsxs)(s.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{background:e.done?"#059669":e.active?F.purple:"rgba(0,0,0,.1)",boxShadow:e.active?"0 0 0 3px rgba(147,52,235,.2)":"none"}}),(0,r.jsx)("span",{className:"text-xs whitespace-nowrap",style:{color:e.done?"#059669":e.active?F.ink:F.sub,fontWeight:e.active?600:400},children:e.label})]}),t<l.length-1&&(0,r.jsx)("div",{className:"flex-1 h-px mx-2 min-w-4",style:{background:F.rule}})]},e.label))})]}),ef&&("revision_requested"===eb||"approved"===eb)&&(0,r.jsxs)("div",{className:"rounded-2xl border overflow-hidden",style:{borderColor:F.rule},children:[(0,r.jsxs)("div",{className:"px-5 py-4 flex items-center gap-3",style:{background:"linear-gradient(135deg, ".concat(F.deep,", #2d1052)")},children:[(()=>{let e=(null==ef?void 0:ef.coach)||{},t=e.name||(null==ef?void 0:ef.coachPersonaName)||"The Alleviate Team",l=e.photoUrl,s=t.split(/\s+/).map(e=>e[0]).slice(0,2).join("").toUpperCase();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 overflow-hidden",style:{background:F.gold},children:l?(0,r.jsx)("img",{src:l,alt:t,className:"w-full h-full object-cover"}):(0,r.jsx)("span",{className:"font-serif text-lg font-bold",style:{color:F.deep,fontFamily:"Cormorant Garamond, serif"},children:s})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-bold text-white",children:t}),(0,r.jsxs)("p",{className:"text-[10px] mt-0.5",style:{color:F.gold},children:["Feedback on ",I.id," \xb7 Attempt ",ey.length||eg]})]})]})})(),null!=ef.score&&(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsx)("div",{className:"font-serif text-2xl font-bold leading-none",style:{color:F.gold,fontFamily:"Cormorant Garamond, serif"},children:ef.score}),(0,r.jsx)("div",{className:"text-[9px]",style:{color:"rgba(255,255,255,.35)"},children:"/ 100"})]})]}),(0,r.jsxs)("div",{className:"p-5 space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(B,{status:eb}),(0,r.jsx)("span",{className:"text-xs",style:{color:F.sub},children:"approved"===eb?"Great work — this meets the standard.":"A few specific changes will get this approved."})]}),Object.keys(ef.scoreBreakdown||{}).length>0&&(0,r.jsx)("div",{className:"grid grid-cols-4 gap-2",children:(()=>{let e={relevance:"Relevance",completeness:"Completeness",quality:"Quality",applicability:"Applicability"};return Object.entries(ef.scoreBreakdown||{}).map(t=>{let[l,s]=t;return(0,r.jsxs)("div",{className:"p-2.5 rounded-xl text-center",style:{background:F.surf},children:[(0,r.jsx)("p",{className:"tabular-nums text-base font-bold leading-none mb-1",style:{color:F.purple,fontFamily:"JetBrains Mono, monospace"},children:s}),(0,r.jsx)("p",{className:"text-[9px]",style:{color:F.sub},children:"/ 25"}),(0,r.jsx)("p",{className:"text-[10px] mt-0.5 font-semibold",style:{color:F.ink},children:e[l]||l})]},l)})})()}),ey.length>1&&(0,r.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,r.jsx)("span",{className:"text-[10px] font-bold tracking-wide uppercase mr-1",style:{color:F.sub},children:"Attempts"}),ey.map((e,t)=>{var l,s;let o=null!==(s=null==e?void 0:null===(l=e.aiReview)||void 0===l?void 0:l.score)&&void 0!==s?s:null==e?void 0:e.score;if(null==o)return null;let n=t===ey.length-1;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-mono tabular-nums",style:{background:n?"rgba(147,52,235,.15)":F.surf,color:n?F.purple:F.sub,border:"1px solid ".concat(n?"rgba(147,52,235,.3)":F.rule)},children:["Att ",t+1,": ",o]},t)})]}),ef.reviewedAt&&(0,r.jsxs)("p",{className:"text-[11px]",style:{color:F.sub},children:["Feedback received ",function(e){let t="string"==typeof e?new Date(e):e;if(!t||Number.isNaN(t.getTime()))return"";let l=Math.floor((Date.now()-t.getTime())/1e3);if(l<60)return"just now";let r=Math.floor(l/60);if(r<60)return"".concat(r," minute").concat(1===r?"":"s"," ago");let s=Math.floor(r/60);if(s<24)return"".concat(s," hour").concat(1===s?"":"s"," ago");let o=Math.floor(s/24);return o<7?"".concat(o," day").concat(1===o?"":"s"," ago"):t.toLocaleDateString("en-US")}(ef.reviewedAt)]}),ef.acknowledgesProgress&&ef.progressNote&&(0,r.jsx)("div",{className:"p-3.5 rounded-xl text-sm leading-relaxed",style:{background:"rgba(5,150,105,.06)",color:"#059669"},children:ef.progressNote}),(0,r.jsx)(m.Z,{text:ef.personalizedMessage,size:14,color:F.ink}),"revision_requested"===eb&&ef.specificImprovements.length>0&&(0,r.jsxs)("div",{className:"p-4 rounded-xl",style:{background:"#fef3c7"},children:[(0,r.jsx)("p",{className:"text-[10px] font-bold tracking-wide uppercase mb-3",style:{color:"#d97706"},children:"Specific Improvements Needed"}),(0,r.jsx)("div",{className:"space-y-3",children:ef.specificImprovements.map((e,t)=>(0,r.jsxs)("div",{className:"flex gap-3 text-sm",style:{color:F.ink,lineHeight:1.65},children:[(0,r.jsx)("span",{className:"w-5 h-5 rounded-full flex-shrink-0 flex items-center justify-center text-[11px] font-bold text-white mt-0.5",style:{background:"#d97706"},children:t+1}),e]},t))})]}),(0,r.jsx)("p",{className:"text-sm italic",style:{color:F.sub},children:ef.nextStep})]}),ey.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{onClick:()=>ei(e=>!e),className:"w-full px-5 py-3.5 flex items-center justify-between text-xs border-t transition-colors hover:bg-gray-50",style:{borderColor:F.rule,color:F.sub},children:[(0,r.jsxs)("span",{children:["View conversation history (",ey.length," exchange",1!==ey.length?"s":"",")"]}),(0,r.jsx)("span",{children:ea?"↑":"↓"})]}),(0,r.jsx)(d.M,{children:ea&&(0,r.jsx)(i.E.div,{initial:{height:0,opacity:0}
1,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"overflow-hidden",children:(0,r.jsx)("div",{className:"px-5 pb-5 pt-3 space-y-4",children:ey.map((e,t)=>(0,r.jsxs)(s.Fragment,{children:[(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)("div",{className:"w-7 h-7 rounded-full flex-shrink-0 flex items-center justify-center text-[11px] font-bold",style:{background:F.pale,color:F.deep},children:"P"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsxs)("p",{className:"text-[11px] mb-1",style:{color:F.sub},children:[(0,r.jsx)("strong",{style:{color:F.ink},children:"You"})," \xb7 Attempt ",e.attemptNumber," \xb7 ",new Date(e.submittedAt).toLocaleDateString("en-US")]}),(0,r.jsxs)("p",{className:"text-sm",style:{color:F.ink,lineHeight:1.65},children:["Submission ",e.attemptNumber," submitted."]})]})]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)("div",{className:"w-7 h-7 rounded-full flex-shrink-0 flex items-center justify-center text-[10px] font-bold",style:{background:F.deep,color:F.gold},children:"AT"}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsxs)("p",{className:"text-[11px] mb-1",style:{color:F.sub},children:[(0,r.jsx)("strong",{style:{color:F.ink},children:"The Alleviate Team"})," \xb7 Review"]}),(0,r.jsx)("p",{className:"text-sm leading-relaxed",style:{color:F.ink},children:e.feedback}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 mt-1.5 text-[11px] font-bold px-2 py-0.5 rounded",style:{background:F.pale,color:F.purple},children:["Score: ",e.score," / 100"]})]})]})]},t))})})})]})]}),eg>0&&(0,r.jsx)(C,{cohortSlug:z,deliverableId:I.id,defaultCollapsed:!ej}),ev&&(0,r.jsxs)("div",{className:"p-4 rounded-xl border flex items-center justify-between",style:{background:"rgba(5,150,105,.04)",borderColor:"rgba(5,150,105,.2)"},children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-bold",style:{color:"#059669"},children:"Deliverable approved"}),(0,r.jsx)("p",{className:"text-xs mt-0.5",style:{color:F.sub},children:"Continue to the next lesson"})]}),(0,r.jsx)("button",{onClick:E,className:"px-4 py-2 rounded-lg text-sm font-semibold text-white",style:{background:"#059669"},children:"Next →"})]})]})]})}function H(e){var t,l,i,d,x,m;let{cohortSlug:h,moduleSlug:b,lessonSlug:f,progress:g,onNavigate:y}=e,{i18n:v}=(0,c.$G)("atp"),j=R(v),{data:k,isLoading:w}=(0,o.useQuery)({queryKey:["atp-lesson",h,b,f],queryFn:async()=>{let e=await fetch("".concat(M,"/atp/lesson/").concat(h,"/").concat(b,"/").concat(f),{headers:(0,p.iL)()});if(!e.ok)throw Error("lesson ".concat(e.status));return e.json()},enabled:!!f,staleTime:3e5}),{data:N}=D(h),C=(0,s.useMemo)(()=>(N||[]).find(e=>e.slug===b),[N,b]),S=(null==C?void 0:C.lessons)||(H?[H]:[]),L=(0,a.useMutation)({mutationFn:e=>fetch("".concat(M,"/atp/progress/lesson-view"),{method:"POST",headers:(0,p.authHeaders)(),body:JSON.stringify(e)}).then(e=>e.json())}),I=function(){let e=(0,n.useQueryClient)();return(0,a.useMutation)({mutationFn:e=>fetch("".concat(M,"/atp/progress/lesson-complete"),{method:"POST",headers:(0,p.authHeaders)(),body:JSON.stringify(e)}).then(e=>e.json()),onSuccess:(t,l)=>{e.invalidateQueries({queryKey:["atp-progress",l.cohortSlug]})}})}
1(),_=(0,n.useQueryClient)(),W=(0,s.useRef)(null),[z,B]=(0,s.useState)(!1),[q,E]=(0,s.useState)(0),H=null==k?void 0:k.lesson,G=null==k?void 0:k.deliverable,$=null==k?void 0:k.prevSlug,Q=null==k?void 0:k.nextSlug,K=(null==H?void 0:H.deliverableId)?g.deliverables.find(e=>e.deliverableId===H.deliverableId):void 0,J=Array.isArray(null==g?void 0:g.lessons)?g.lessons:[],V=(0,s.useCallback)(e=>{if(!e)return"pending";if(e.slug===f)return"active";if("submit"===e.type){let t=g.deliverables.find(t=>t.deliverableId===e.deliverableId);return(null==t?void 0:t.status)==="approved"?"done":(t&&t.status,"pending")}let t=J.find(t=>String(t.lessonId)===String(e._id)||t.lessonSlug===e.slug);return(null==t?void 0:t.completedAt)?"done":"pending"},[f,g.deliverables,J]);function Y(){let e=W.current;e&&(null==H?void 0:H._id)&&(e.duration>0&&E(e.currentTime/e.duration),!z&&e.currentTime/e.duration>=.9&&(B(!0),fetch("".concat(M,"/atp/progress/video-complete"),{method:"POST",headers:(0,p.authHeaders)(),body:JSON.stringify({cohortSlug:h,lessonId:H._id})}).then(e=>e.json()).then(()=>_.invalidateQueries({queryKey:["atp-progress",h]})).catch(()=>{})))}return((0,s.useEffect)(()=>{(null==H?void 0:H._id)&&L.mutate({cohortSlug:h,lessonId:H._id})},[null==H?void 0:H._id]),(0,s.useEffect)(()=>{B(!1),E(0)},[null==H?void 0:H._id]),(0,s.useEffect)(()=>{var e;if(!(null==H?void 0:H._id))return;let t=W.current;if(!t||!((null===(e=H.content)||void 0===e?void 0:e.videoUrl)&&!/youtube\.com|youtu\.be|vimeo\.com/.test(H.content.videoUrl)))return;let l=()=>{t.paused||t.ended||fetch("".concat(M,"/atp/progress/video-watch"),{method:"POST",headers:(0,p.authHeaders)(),body:JSON.stringify({cohortSlug:h,lessonId:H._id,currentPosition:t.currentTime}),keepalive:!0}).catch(()=>{})},r=window.setInterval(l,5e3),s=()=>l();return t.addEventListener("pause",s),t.addEventListener("ended",s),()=>{window.clearInterval(r),t.removeEventListener("pause",s),t.removeEventListener("ended",s),l()}},[null==H?void 0:H._id,null==H?void 0:null===(t=H.content)||void 0===t?void 0:t.videoUrl,h]),w||!H)?(0,r.jsx)("div",{className:"flex items-center justify-center h-screen",style:{background:F.surf},children:(0,r.jsx)("div",{className:"text-sm",style:{color:F.sub},children:"Loading…"})}):(0,r.jsxs)("div",{className:"flex flex-col h-screen overflow-hidden",style:{background:F.surf},children:[(0,r.jsxs)("div",{className:"flex-shrink-0 flex items-center justify-between px-8 h-13 border-b bg-white",style:{borderColor:F.rule},children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("button",{onClick:()=>y("/dashboard/atp/".concat(h,"/").concat(b)),className:"flex items-center gap-1.5 text-xs transition-opacity hover:opacity-70",style:{color:F.sub},children:[(0,r.jsx)(P.chevronLeft,{})," ",b.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())]}),(0,r.jsx)("span",{style:{color:F.rule},children:"\xb7"}),(0,r.jsx)("span",{className:"text-xs font-semibold",style:{color:F.ink},children:A(H.title,j)})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("span",{className:"text-xs",style:{color:F.sub},children:[H.type," \xb7 ",H.estimatedMins," min"]}),(0,r.jsx)("div",{className:"w-20 h-1 rounded-full overflow-hidden",style:{background:F.rule},children:(0,r.jsx)("div",{className:"h-full rounded-full",style:{width:"55%",background:F.purple}})})]})]}),(0,r.jsxs)("div",{className:"flex-1 overflow-hidden flex",children:[(0,r.jsxs)("div",{className:"w-64 flex-shrink-0 border-r bg-white overflow-y-auto hidden lg:block",style:{borderColor:F.rule},children:[(0,r.jsx)("div",{className:"px-5 py-4 border-b",style:{borderColor:F.rule},children:(0,r.jsx)("p",{className:"text-[10px] font-bold tracking-wide uppercase",style:{color:F.purple},children:b.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())})}),(0,r.jsx)("div",{className:"py-2",children:S.map(e=>{let t=e.slug===f,l=V(e),s="submit"===e.type?F.purple:"build"===e.type?F.gold:F.sub;return(0,r.jsxs)("button",{onClick:()=>y("/dashboard/atp/".concat(h,"/").concat(b,"/").concat(e.slug)),className:"w-full flex items-center gap-2.5 px-5 py-2.5 border-l-[3px] text-left transition-colors hover:bg-black/5",style:{borderLeftColor:t?F.purple:"transparent",background:t?F.pale:"transparent"},children:[(0,r.jsx)("div",{className:"w-6 h-6 rounded-lg flex items-center justify-center flex-shrink-0",style:{background:"done"===l?"rgba(5,150,105,.15)":"".concat(s,"18"),color:"done"===l?"#059669":s}
1,children:"done"===l?(0,r.jsx)(P.done,{}):"learn"===e.type?(0,r.jsx)(P.learn,{}):"build"===e.type?(0,r.jsx)(P.build,{}):(0,r.jsx)(P.submit,{})}),(0,r.jsx)("span",{className:"text-xs leading-snug flex-1 truncate",style:{color:t?F.ink:F.sub,fontWeight:t?600:400},children:A(e.title,j)}),e.estimatedMins?(0,r.jsxs)("span",{className:"text-[10px] tabular-nums",style:{color:F.sub},children:[e.estimatedMins,"m"]}):null]},e._id||e.slug)})})]}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,r.jsxs)("div",{className:"max-w-3xl mx-auto px-12 py-9",children:[(0,r.jsxs)("p",{className:"text-[10px] font-bold tracking-widest uppercase mb-2",style:{color:F.purple},children:[H.type," \xb7 ",b.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())]}),(0,r.jsx)("h1",{className:"font-serif text-4xl font-bold leading-tight mb-2",style:{fontFamily:"Cormorant Garamond, serif",color:F.ink},children:A(H.title,j)}),(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-6 text-xs",style:{color:F.sub},children:[(0,r.jsxs)("span",{children:[H.type," \xb7 ",H.estimatedMins," minutes"]}),"submit"===H.type&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{children:"\xb7"}),(0,r.jsxs)("span",{style:{color:F.gold,fontWeight:600},children:["+",null!==(i=null==G?void 0:G.xpOnApproval)&&void 0!==i?i:100," XP on approval"]})]})]}),"submit"===H.type&&(H.deliverableId||G)&&(0,r.jsxs)("a",{href:"#atp-deliverable-panel",onClick:e=>{var t;e.preventDefault(),null===(t=document.getElementById("atp-deliverable-panel"))||void 0===t||t.scrollIntoView({behavior:"smooth",block:"start"})},className:"flex flex-wrap items-center gap-3 px-4 py-3 rounded-xl mb-6 transition-all hover:shadow-md",style:{background:"linear-gradient(90deg, rgba(201,168,76,.12), rgba(147,52,235,.08))",border:"1.5px solid rgba(201,168,76,.45)"},children:[(0,r.jsx)("span",{className:"font-mono px-2 py-1 rounded text-xs font-bold flex-shrink-0",style:{background:F.gold,color:F.deep},children:(null==G?void 0:G.id)||H.deliverableId}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-[10px] font-bold tracking-wide uppercase mb-0.5",style:{color:F.gold},children:"Submit Deliverable"}),(0,r.jsx)("p",{className:"text-sm font-bold truncate",style:{color:F.ink},children:G&&A(G.name,j)||"Deliverable ".concat(H.deliverableId)})]}),(0,r.jsx)("span",{className:"flex-shrink-0 inline-flex items-center gap-1 text-xs font-semibold",style:{color:F.purple},children:"Jump to submission ↓"})]}),H.content.videoUrl&&(0,r.jsxs)("div",{className:"rounded-2xl overflow-hidden mb-8 aspect-video relative",style:{background:F.deep},children:[(()=>{let e=H.content.videoUrl,t=e.match(/(?:youtube\.com\/(?:watch\?v=|embed\/|shorts\/)|youtu\.be\/)([a-zA-Z0-9_-]{6,})/);if(t){let e=t[1];return(0,r.jsx)("iframe",{src:"https://www.youtube.com/embed/".concat(e,"?rel=0"),className:"absolute inset-0 w-full h-full",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0})}let l=e.match(/vimeo\.com\/(?:video\/)?(\d+)/);return l?(0,r.jsx)("iframe",{src:"https://player.vimeo.com/video/".concat(l[1]),className:"absolute inset-0 w-full h-full",frameBorder:"0",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0}):(0,r.jsx)("video",{ref:W,src:e,controls:!0,className:"absolute inset-0 w-full h-full",onTimeUpdate:Y})})(),(0,r.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-white/10",children:(0,r.jsx)("div",{className:"h-full transition-all",style:{width:"".concat(Math.max(z?100:0,Math.min(100,Math.round(100*q))),"%"),background:z?"#4ade80":F.mid}})})]}),(0,r.jsx)("style",{children:'\n              .atp-prose { color: #3a3350; line-height: 1.75; font-size: 15px; }\n              .atp-prose p { margin: 0 0 14px; }\n              .atp-prose p:last-child { margin-bottom: 0; }\n              /* Apr 27 (Robert) — Quill emits <p><br></p> for blank lines,\n                 which compounds with our paragraph margins and creates the\n                 over-spaced "double gap" look between blocks. Collapse them\n                 so admin pastes render with consistent rhythm. */\n              .atp-prose p:empty,\n              .atp-prose p > br:only-child { display: none; }\n              .atp-prose p.lead { font-size: 16.5px; color: '.concat(F.deep,"; font-weight: 500; margin-bottom: 18px; }\n              .atp-prose p.muted { color: ").concat(F.sub,"; font-size: 13px; }\n              .atp-prose strong { color: ").concat(F.ink,"; font-weight: 600; }\n              .atp-prose em { color: ").concat(F.purple,"; font-style: italic; }\n              /* Apr 27 (Robert) — the quote panel should wrap the whole\n                 statement, not just the first line. Reset child margins so\n                 a multi-paragraph blockquote reads as one block, and bump\n                 padding so longer quotes breathe. */\n              .atp-prose blockquote, .atp-prose .callout {\n                background: ").concat(F.pale,";\n                border-left: 4px solid ").concat(F.purple,";\n                border-radius: 0 12px 12px 0;\n                padding: 18px 22px;\n                margin: 22px 0;\n                color: ").concat(F.ink,";\n                font-style: italic;\n              }\n              .atp-prose blockquote > *:first-child,\n              .atp-prose .callout > *:first-child { margin-top: 0; }\n              .atp-prose blockquote > *:last-child,\n              .atp-prose .callout > *:last-child { margin-bottom: 0; }\n              .atp-prose blockquote p,\n              .atp-prose .callout p { margin: 0 0 10px; }\n              .atp-prose blockquote .callout-label,\n              .atp-prose .callout .callout-label {\n                display: block; font-size: 11px; font-weight: 700;\n                letter-spacing: 0.12em; text-transform: uppercase;\n                color: ").concat(F.purple,"; margin-bottom: 6px;\n                font-style: normal;\n              }\n              .atp-prose h2 { font-family: 'Cormorant Garamond', serif; font-size: 26px; margin: 26px 0 10px; color: ").concat(F.ink,"; line-height: 1.25; }\n              .atp-prose h2:first-child { margin-top: 0; }\n              .atp-prose h3 { font-size: 17px; font-weight: 600; margin: 20px 0 8px; color: ").concat(F.ink,"; line-height: 1.3; }\n              .atp-prose h3:first-child { margin-top: 0; }\n              .atp-prose ul, .atp-prose ol { margin: 10px 0 16px 22px; padding: 0; }\n              .atp-prose li { margin: 6px 0; line-height: 1.65; }\n              .atp-prose li > p { margin: 0; }\n              .atp-prose a { color: ").concat(F.purple,"; text-decoration: underline; }\n              .atp-prose code, .atp-prose pre.ql-syntax {\n                font-family: 'JetBrains Mono', monospace; font-size: 13px;\n                background: ").concat(F.pale,"; color: ").concat(F.deep,";\n                padding: 2px 6px; border-radius: 4px;\n              }\n              .atp-prose pre.ql-syntax { display: block; padding: 12px; overflow-x: auto; margin: 14px 0; }\n              .atp-prose img { max-width: 100%; height: auto; border-radius: 8px; margin: 14px 0; }\n              .atp-prose hr { border: none; border-top: 1px solid ").concat(F.rule,'; margin: 24px 0; }\n              /* 2026-05-20 (Robert) — dark-background callouts authored\n                 inline (e.g. "BEFORE YOU SUBMIT \xb7 Ask Kay to review your\n                 mission statement") were rendering their h2/h3/strong in\n                 ').concat(F.ink,' (the default .atp-prose heading colour), going\n                 black-on-purple = invisible. Detect any inline dark\n                 Alleviate brand background and reset descendant heading +\n                 emphasis colours to light. Covers the three brand purples\n                 plus the dark inks the editor most commonly outputs. */\n              .atp-prose [style*="background:#471873"],\n              .atp-prose [style*="background: #471873"],\n              .atp-prose [style*="background-color:#471873"],\n              .atp-prose [style*="background-color: #471873"],\n              .atp-prose [style*="background:#3a1160"],\n              .atp-prose [style*="background: #3a1160"],\n              .atp-prose [style*="background-color:#3a1160"],\n              .atp-prose [style*="background-color: #3a1160"],\n              .atp-prose [style*="background:#2d1054"],\n              .atp-prose [style*="background: #2d1054"],\n              .atp-prose [style*="background-color:#2d1054"],\n              .atp-prose [style*="background-color: #2d1054"],\n              .atp-prose [style*="background:#1a1428"],\n              .atp-prose [style*="background: #1a1428"],\n              .atp-prose [style*="background-color:#1a1428"],\n              .atp-prose [style*="background-color: #1a1428"],\n              .atp-prose [style*="background:#0c0a12"],\n              .atp-prose [style*="background: #0c0a12"],\n              .atp-prose [style*="background-color:#0c0a12"],\n              .atp-prose [style*="background-color: #0c0a12"] { color: #ffffff; }\n              .atp-prose [style*="background:#471873"] h1,\n              .atp-prose [style*="background:#471873"] h2,\n              .atp-prose [style*="background:#471873"] h3,\n              .atp-prose [style*="background:#471873"] h4,\n              .atp-prose [style*="background:#471873"] strong,\n              .atp-prose [style*="background: #471873"] h1,\n              .atp-prose [style*="background: #471873"] h2,\n              .atp-prose [style*="background: #471873"] h3,\n              .atp-prose [style*="background: #471873"] h4,\n              .atp-prose [style*="background: #471873"] strong,\n              .atp-prose [style*="background-color:#471873"] h1,\n              .atp-prose [style*="background-color:#471873"] h2,\n              .atp-prose [style*="background-color:#471873"] h3,\n              .atp-prose [style*="background-color:#471873"] h4,\n              .atp-prose [style*="background-color:#471873"] strong,\n              .atp-prose [style*="background-color: #471873"] h1,\n              .atp-prose [style*="background-color: #471873"] h2,\n              .atp-prose [style*="background-color: #471873"] h3,\n              .atp-prose [style*="background-color: #471873"] h4,\n              .atp-prose [style*="background-color: #471873"] strong,\n              .atp-prose [style*="background:#3a1160"] h1,\n              .atp-prose [style*="background:#3a1160"] h2,\n              .atp-prose [style*="background:#3a1160"] h3,\n              .atp-prose [style*="background:#3a1160"] h4,\n              .atp-prose [style*="background:#3a1160"] strong,\n              .atp-prose [style*="background: #3a1160"] h1,\n              .atp-prose [style*="background: #3a1160"] h2,\n              .atp-prose [style*="background: #3a1160"] h3,\n              .atp-prose [style*="background: #3a1160"] h4,\n              .atp-prose [style*="background: #3a1160"] strong,\n              .atp-prose [style*="background:#2d1054"] h1,\n              .atp-prose [style*="background:#2d1054"] h2,\n              .atp-prose [style*="background:#2d1054"] h3,\n              .atp-prose [style*="background:#2d1054"] h4,\n              .atp-prose [style*="background:#2d1054"] strong,\n              .atp-prose [style*="background: #2d1054"] h1,\n              .atp-prose [style*="background: #2d1054"] h2,\n              .atp-prose [style*="background: #2d1054"] h3,\n              .atp-prose [style*="background: #2d1054"] h4,\n              .atp-prose [style*="background: #2d1054"] strong,\n              .atp-prose [style*="background:#1a1428"] h1,\n              .atp-prose [style*="background:#1a1428"] h2,\n              .atp-prose [style*="background:#1a1428"] h3,\n              .atp-prose [style*="background:#1a1428"] h4,\n              .atp-prose [style*="background:#1a1428"] strong,\n              .atp-prose [style*="background: #1a1428"] h1,\n              .atp-prose [style*="background: #1a1428"] h2,\n              .atp-prose [style*="background: #1a1428"] h3,\n              .atp-prose [style*="background: #1a1428"] h4,\n              .atp-prose [style*="background: #1a1428"] strong { color: #ffffff !important; }\n              /* Em should pop, not disappear: gold accent reads against\n                 every brand purple. */\n              .atp-prose [style*="background:#471873"] em,\n              .atp-prose [style*="background: #471873"] em,\n              .atp-prose [style*="background-color:#471873"] em,\n              .atp-prose [style*="background-color: #471873"] em,\n              .atp-prose [style*="background:#3a1160"] em,\n              .atp-prose [style*="background: #3a1160"] em,\n              .atp-prose [style*="background:#2d1054"] em,\n              .atp-prose [style*="background: #2d1054"] em,\n              .atp-prose [style*="background:#1a1428"] em,\n              .atp-prose [style*="background: #1a1428"] em { color: ').concat(F.gold," !important; }\n            ")}),(0,r.jsx)("div",{className:"atp-prose text-sm leading-relaxed mb-6",dangerouslySetInnerHTML:{__html:(m=H.c
1ontent)?T(U(("fr"===j?m.body_fr:m.body_en)||m.body_en||m.body_fr||"")):""}}),(null!==(d=null===(l=H.content.attachments)||void 0===l?void 0:l.length)&&void 0!==d?d:0)>0&&(0,r.jsxs)("div",{className:"p-4 rounded-xl border mb-6",style:{borderColor:F.rule},children:[(0,r.jsx)("p",{className:"text-[10px] font-bold tracking-wide uppercase mb-3",style:{color:F.sub},children:"Lesson Resources"}),(0,r.jsx)("div",{className:"space-y-2",children:(H.content.attachments||[]).map((e,t)=>{let l=e.fileName||e.label,s=async t=>{t.preventDefault(),await (0,u.OP)(e.url,l||e.label)||window.open(e.url,"_blank","noopener")};return(0,r.jsxs)("a",{href:e.url,onClick:s,target:"_blank",rel:"noreferrer",download:l||!0,className:"flex items-center gap-3 p-2.5 rounded-lg transition-colors hover:bg-gray-50 cursor-pointer",children:[(0,r.jsx)("span",{className:"font-mono text-[10px] font-bold px-1.5 py-0.5 rounded",style:{background:"xlsx"===e.type?"rgba(5,150,105,.1)":"pdf"===e.type?"rgba(220,38,38,.1)":"rgba(147,52,235,.1)",color:"xlsx"===e.type?"#059669":"pdf"===e.type?"#dc2626":F.purple},children:e.type.toUpperCase()}),(0,r.jsx)("span",{className:"text-sm font-medium flex-1",style:{color:F.ink},children:e.label})]},t)})})]}),"submit"===H.type&&G&&(0,r.jsx)("div",{id:"atp-deliverable-panel",style:{scrollMarginTop:24},children:(0,r.jsx)(O,{lesson:H,deliverable:G,delivRecord:K,attemptsUsed:null==k?void 0:k.attemptsUsed,maxAttemptsEffective:null!==(x=null==k?void 0:k.maxAttemptsEffective)&&void 0!==x?x:void 0,cohortSlug:h,onSubmitted:()=>{_.invalidateQueries({queryKey:["atp-progress",h]})},onAdvance:()=>{var e,t;if(_.invalidateQueries({queryKey:["atp-progress",h]}),Q){y("/dashboard/atp/".concat(h,"/").concat(b,"/").concat(Q));return}let l=Array.isArray(N)?N:[],r=l.findIndex(e=>e.slug===b),s=r>=0?l[r+1]:null,o=!!s&&Array.isArray(null==g?void 0:g.modulesUnlocked)&&g.modulesUnlocked.includes(s.slug),n=null==s?void 0:null===(t=s.lessons)||void 0===t?void 0:null===(e=t[0])||void 0===e?void 0:e.slug;s&&o&&n?y("/dashboard/atp/".concat(h,"/").concat(s.slug,"/").concat(n)):y("/dashboard/atp/".concat(h))}})}),"submit"!==H.type&&(()=>{let e=!!H.content.videoUrl&&!/youtube\.com|youtu\.be|vimeo\.com/.test(H.content.videoUrl)&&!z,t=((null==g?void 0:g.lessons)||[]).find(e=>String(e.lessonId)===String(H._id)),l=!!(null==t?void 0:t.completedAt),s=I.isPending,o=async()=>{if(!e){if(!l&&H._id)try{await I.mutateAsync({cohortSlug:h,lessonId:H._id})}catch(e){}Q?y("/dashboard/atp/".concat(h,"/").concat(b,"/").concat(Q)):y("/dashboard/atp/".concat(h,"/").concat(b))}};return(0,r.jsxs)("div",{className:"mt-8 pt-6 border-t flex items-center justify-between",style:{borderColor:F.rule},children:[(0,r.jsx)("div",{className:"text-sm",style:{color:F.sub},children:e?"Watch at least 90% of the video to continue (".concat(Math.round(100*q),"%)"):l?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{style:{color:"#059669",fontWeight:600},children:"✓ Lesson completed"})," \xb7 ",H.estimatedMins," min"]}):"".concat(H.estimatedMins," minute").concat(1===H.estimatedMins?"":"s"," estimated")}),(0,r.jsxs)("div",{className:"flex gap-3",children:[$&&(0,r.jsx)("button",{onClick:()=>y("/dashboard/atp/".concat(h,"/").concat(b,"/").concat($)),className:"px-4 py-2.5 rounded-xl text-sm font-semibold border transition-colors",style:{borderColor:F.rule,color:F.ink},children:"← Previous"}),(0,r.jsxs)("button",{onClick:o,disabled:e||s,className:"px-5 py-2.5 rounded-xl text-sm font-semibold text-white transition-opacity hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed inline-flex items-center gap-2",style:{background:l?"#059669":F.purple},children:[s&&(0,r.jsx)("span",{className:"inline-block w-3 h-3 rounded-full border-2 animate-spin",style:{borderColor:"#fff transparent transparent transparent"}}),Q?l?"Continue →":"Mark Complete & Continue →":l?"Back to Module →":"Mark Complete & Finish →"]})]})]})})()]})})]})]})}function G(e){let{progress:t,cohortSlug:l,onNavigate:o}=e,n=t.deliverables.filter(e=>"approved"===e.status).length,a=Math.max((null==t?void 0:t.cohortDeliverablesTotal)||0,t.deliverables.length,n),i=t.certificateUnlocked,d=(0,s.useMemo)(()=>{var e;if(!t.certificateCode)return"#";let l=null!==(e=t.certificateCode.split("-").pop())&&void 0!==e?e:"";return"https://www.linkedin.com/profile/add?startTask=CERTIFICATION_NAME"
1+"&name=".concat(encodeURIComponent("Alleviate Transformation Certificate"))+"&certUrl=".concat(encodeURIComponent("https://alleviate.org/verify/".concat(l)))+"&certId=".concat(encodeURIComponent(t.certificateCode))},[t.certificateCode]);return(0,r.jsxs)("div",{className:"min-h-screen",style:{background:F.surf},children:[(0,r.jsxs)("div",{className:"px-10 py-2 flex items-center gap-2 border-b",style:{borderColor:F.rule,background:"#fff"},children:[(0,r.jsxs)("button",{onClick:()=>o("/dashboard/atp/".concat(l)),className:"flex items-center gap-1.5 text-xs transition-opacity hover:opacity-70",style:{color:F.sub},children:[(0,r.jsx)(P.chevronLeft,{})," ATP Hub"]}),(0,r.jsx)("span",{style:{color:F.rule},children:"\xb7"}),(0,r.jsx)("span",{className:"text-xs font-semibold",style:{color:F.ink},children:"Certificate of Transformation"})]}),i?(0,r.jsxs)("div",{className:"px-10 py-8 max-w-4xl mx-auto",children:[(0,r.jsxs)("div",{className:"rounded-2xl px-7 py-6 flex items-center gap-5 mb-8",style:{background:"linear-gradient(135deg, ".concat(F.deep,", #2d1052)"),border:"1px solid rgba(201,168,76,.3)"},children:[(0,r.jsx)("div",{className:"w-14 h-14 rounded-full flex items-center justify-center flex-shrink-0",style:{background:"linear-gradient(135deg, ".concat(F.gold,", ").concat(F.deep,")"),border:"2px solid rgba(201,168,76,.4)"},children:(0,r.jsx)("span",{className:"font-serif text-2xl font-bold text-white",style:{fontFamily:"Cormorant Garamond, serif"},children:"A"})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h2",{className:"font-serif text-3xl font-bold text-white",style:{fontFamily:"Cormorant Garamond, serif"},children:"You did it."}),(0,r.jsxs)("p",{className:"text-sm mt-1",style:{color:F.mid},children:["All ",((null==t?void 0:t.deliverables)||[]).filter(e=>"approved"===e.status).length||""," deliverables approved \xb7 ",(null==t?void 0:t.cohortName)||l.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())]})]}),(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsx)("div",{className:"font-serif text-3xl font-bold",style:{color:F.gold,fontFamily:"Cormorant Garamond, serif"},children:"+500 XP"}),(0,r.jsx)("div",{className:"text-xs mt-1",style:{color:"rgba(255,255,255,.4)"},children:"Level 5 — Transformer"})]})]}),t.certificatePreviewUrl?(0,r.jsx)("img",{src:t.certificatePreviewUrl,alt:"Your certificate",className:"w-full rounded-2xl shadow-2xl mb-6",style:{boxShadow:"0 16px 60px rgba(71,24,115,.3)"}}):(0,r.jsx)("div",{className:"w-full rounded-2xl mb-6 flex items-center justify-center",style:{height:280,background:"linear-gradient(135deg, #1a0d2e, ".concat(F.deep,")")},children:(0,r.jsx)("p",{className:"text-sm",style:{color:"rgba(255,255,255,.4)"},children:"Certificate generating… check back in a moment."})}),(0,r.jsxs)("div",{className:"flex gap-3 flex-wrap mb-5",children:[t.certificateUrl&&(0,r.jsx)("a",{href:t.certificateUrl,target:"_blank",rel:"noreferrer",className:"px-5 py-3 rounded-xl text-sm font-semibold",style:{background:F.gold,color:"#2d1052"},children:"Download PDF"}),(0,r.jsx)("a",{href:d,target:"_blank",rel:"noreferrer",className:"px-5 py-3 rounded-xl text-sm font-semibold text-white",style:{background:F.deep},children:"Add to LinkedIn Profile"}),(0,r.jsx)("button",{onClick:()=>{var e;navigator.clipboard.writeText("https://alleviate.org/verify/".concat(null===(e=t.certificateCode)||void 0===e?void 0:e.split("-").pop()))},className:"px-5 py-3 rounded-xl text-sm font-semibold border transition-colors",style:{borderColor:F.rule,color:F.ink},children:"Copy Verification Link"})]}),t.certificateCode&&(0,r.jsxs)("div",{className:"p-4 rounded-xl border",style:{borderColor:F.rule},children:[(0,r.jsx)("p",{className:"text-xs font-bold mb-2",style:{color:F.ink},children:"LinkedIn post — ready to share"}),(0,r.jsxs)("p",{className:"text-sm italic leading-relaxed",style:{color:F.sub},children:['"I completed the Alleviate Transformation Program — ',(null==t?void 0:t.cohortName)||l.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase()),". In 6 weeks, I built ",a>0?a:""," real organizational assets for ",t.orgName,". Verified: ",window.location.host,"/verify/",t.certificateCode,'"']}),(0,r.jsx)("button",{onClick:()=>navigator.clipboard.writeText("I completed the Alleviate Transformation Program. In 6 weeks, I built ".concat(a>0?a+" ":"","real organizational assets for ").concat(t.orgName,". Verified: ").concat(window.location.origin,"/verify/").concat(t.certificateCode)),className:"mt-3 px-3 py-1.5 rounded-lg text-xs font-semibold border transition-colors",style:{borderColor:F.rule,color:F.sub},children:"Copy Post"})]})]}):(0,r.jsxs)("div",{className:"px-10 py-8 max-w-4xl mx-auto",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"font-serif text-3xl font-bold",style:{fontFamily:"Cormorant Garamond, serif",color:F.ink},children:"Certificate Progress"}),(0,r.jsxs)("p",{className:"text-sm mt-1",style:{color:F.sub},children:[n," of ",a," deliverables approved \xb7 ",Math.max(0,a-n)," remaining"]})]}),(0,r.jsx)(z,{pct:a>0?Math.round(n/a*100):0,size:72,stroke:5,label:(0,r.jsx)("div",{className:"text-center",children:(0,r.jsxs)("div",{className:"text-sm font-bold",style:{color:F.ink},children:[a>0?Math.round(n/a*100):0,"%"]})}),color:F.purple})]}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:t.deliverables.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-2.5 p-3.5 rounded-xl border",style:{background:"#fff",borderColor:F.rule},children:[(0,r.jsx)("span",{className:"text-[10px] font-bold tabular-nums flex-shrink-0",style:{color:F.sub,fontFamily:"JetBrains Mono, monospace"},children:e.deliverableId}),(0,r.jsx)("span",{className:"text-xs flex-1 truncate",style:{color:F.ink},children:e.deliverableId}),(0,r.jsx)("span",{className:"text-[11px] font-bold flex-shrink-0",style:{color:"approved"===e.status?"#059669":"revision_requested"===e.status?"#d97706":"rgba(0,0,0,.2)"},children:"approved"===e.status?"✓":"revision_requested"===e.status?"⟳":"○"})]},e.deliverableId))}),(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)("button",{onClick:()=>o("/dashboard/atp/".concat(l)),className:"px-5 py-3 rounded-xl text-sm font-semibold text-white",style:{background:F.purple},children:"Continue Building →"})})]})]})}
1function $(e){let{cohortSlug:t="",moduleSlug:a,lessonSlug:i,view:d,onNavigate:c}=e,{data:u,isLoading:x,error:m}=(0,o.useQuery)({queryKey:["atp-progress",t],queryFn:async()=>{var e,l,r;let s=await fetch("".concat(M,"/atp/progress/").concat(t),{headers:(0,p.iL)()});if(!s.ok)throw Error("progress ".concat(s.status));let o=await s.json();return(null==o?void 0:o.progress)?{...o.progress,cohortName:(null==o?void 0:null===(e=o.cohort)||void 0===e?void 0:e.name)||o.progress.cohortName,cohortLaunchDate:(null==o?void 0:null===(l=o.cohort)||void 0===l?void 0:l.launchDate)||null,cohortGateType:(null==o?void 0:null===(r=o.cohort)||void 0===r?void 0:r.gateType)||null}:o},refetchOnWindowFocus:!0,refetchInterval:6e4,staleTime:3e4,enabled:!!t,retry:(e,t)=>!/\b403\b/.test(String((null==t?void 0:t.message)||""))&&e<3}),{data:h,isLoading:b,error:f}=D(t),g=(0,n.useQueryClient)();if((0,s.useEffect)(()=>{t&&fetch("".concat(M,"/atp/progress/record-activity"),{method:"POST",headers:(0,p.authHeaders)(),body:JSON.stringify({cohortSlug:t})}).catch(()=>{})},[t]),(0,s.useEffect)(()=>{if(!t||!(null==u?void 0:u._id))return;let e="a6ba140d01f2954855d9";if(!e)return;let r=null,s=null,o=!1;return(async()=>{try{let n=(await l.e(38793).then(l.t.bind(l,38793,23))).default;if(o)return;r=(s=new n(e,{cluster:"us2"})).subscribe("user-".concat(u._id)),["activity","atp:deliverable_approved","atp:feedback_ready","atp:module_unlocked","atp:badge_earned","atp:xp_gained","atp:certificate_ready"].forEach(e=>r.bind(e,()=>g.invalidateQueries({queryKey:["atp-progress",t]})))}catch(e){}})(),()=>{o=!0;try{r&&r.unbind_all()}catch(e){}try{s&&s.unsubscribe("user-".concat(u._id))}catch(e){}}},[t,null==u?void 0:u._id,g]),[m,f].some(e=>/\b403\b/.test(String((null==e?void 0:e.message)||""))))return(0,r.jsx)("div",{className:"flex items-center justify-center h-screen",style:{background:F.surf},children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center px-6",children:[(0,r.jsx)("p",{className:"text-sm font-semibold",style:{color:F.ink},children:"This programme is available to enrolled participants only."}),(0,r.jsx)("p",{className:"text-sm",style:{color:F.sub},children:"Your account isn't enrolled in this cohort."}),(0,r.jsx)("button",{onClick:()=>c("/atp"),className:"mt-2 px-4 py-2 rounded-lg text-sm font-semibold text-white transition-opacity hover:opacity-90",style:{background:F.purple},children:"Learn about the programme"})]})});if(x||b||!u||!h)return(0,r.jsx)("div",{className:"flex items-center justify-center h-screen",style:{background:F.surf},children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,r.jsx)("div",{className:"w-6 h-6 border-2 rounded-full animate-spin",style:{borderColor:F.purple,borderTopColor:"transparent"}}),(0,r.jsx)("p",{className:"text-sm",style:{color:F.sub},children:"Loading your programme…"})]})});let y=null!=d?d:i?"lesson":"certificate"===a?"certificate":a?"module":"hub";if("certificate"===y)return(0,r.jsx)(G,{progress:u,cohortSlug:t,onNavigate:c});if("lesson"===y&&a&&i)return(0,r.jsx)(H,{cohortSlug:t,moduleSlug:a,lessonSlug:i,progress:u,onNavigate:c});if("module"===y&&a){let e=h.find(e=>e.slug===a);if(e)return(0,r.jsx)(E,{module:e,progress:u,cohortSlug:t,onNavigate:c})}return(0,r.jsx)(q,{progress:u,modules:h,cohortSlug:t,onNavigate:c})}},25338:function(e,t,l){l.d(t,{Z:function(){return o}});var r=l(57437),s=l(2265);function o(e){let{text:t,size:l=13,color:o,style:n}=e,a=s.useMemo(()=>(function(e){let t=String(null!=e?e:"").replace(/\r\n/g,"\n").trim();if(!t)return[];let l=t.split("\n"),r=[],s=[],o=null,n=()=>{s.length&&(r.push({kind:"para",lines:s}),s=[])},a=()=>{o&&o.items.length&&r.push({kind:"list",ordered:o.ordered,items:o.items}),o=null};for(let e of l){let t=e.trim();if(!t){n(),a();continue}let l=t.match(/^[-•*]\s+(.*)$/),r=t.match(/^\d+[.)]\s+(.*)$/);if(l||r){n();let e=!!r,t=(l?l[1]:r[1])||"";o&&o.ordered===e||(a(),o={ordered:e,items:[]}),o.items.push(t)}else a(),s.push(t)}return n(),a(),r})(t),[t]);if(!a.length)return null;let i={fontSize:l,color:o,lineHeight:1.6};return(0,r.jsx)("div",{style:n,children:a.map((e,t)=>{if("list"===e.kind){let l=e.ordered?"ol":"ul";return(0,r.jsx)(l,{style:{margin:"0 0 10px 0",paddingLeft:20,...i},children:e.items.map((e,t)=>(0,r.jsx)("li",{style:{marginBottom:4},children:e},t))},t)}return(0,r.jsx)("p",{style:{margin:"0 0 10px 0",...i},children:e.lines.map((t,l)=>(0,r.jsxs)(s.Fragment,{children:[t,l<e.lines.length-1?(0,r.jsx)("br",{}):null]},l))},t)})})}},33349:function(e,t,l){l.r(t),l.d(t,{getBackendUrl:function(){return r}});let r=()=>"https://api.alleviate.org/api"},67889:function(e,t,l){l.d(t,{OP:function(){return o},f$:function(){return s}});let r=/^(https?:\/\/[^/]*cloudinary\.com\/[^/]+\/(?:image|video|raw)\/(?:upload|fetch|authenticated))\/(.*)$/i;function s(e,t){if(!e)return"";if(!t)return e;let l=e.match(r);if(!l)return e;let[,s,o]=l;if(/(^|\/)fl_attachment(:|\/)/i.test(o))return e;let n=t?t.split(/[\\/]/).pop().replace(/\.[a-z0-9]{1,6}$/i,"").normalize("NFKD").replace(/[^\w\-]+/g,"_").replace(/_+/g,"_").replace(/^_+|_+$/g,"").slice(0,80)||"download":"";return"".concat(s,"/fl_attachment:").concat(n,"/").concat(o)}async function o(e,t){try{let l=await fetch(e,{credentials:"omit"});if(!l.ok)return!1;let r=await l.blob(),s=URL.createObjectURL(r),o=document.createElement("a");return o.href=s,o.download=t||"download",document.body.appendChild(o),o.click(),o.remove(),setTimeout(()=>URL.revokeObjectURL(s),4e3),!0}catch(e){return!1}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.