1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3459],{45496:function(e,t,s){Promise.resolve().then(s.bind(s,56704))},56704:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return R}});var n=s(57437),a=s(2265),r=s(7824);function l(){return(0,n.jsxs)("div",{className:"bg-gradient-to-br from-blue-100 to-purple-100 min-h-screen flex flex-col gap-10 pb-10 animate-pulse",children:[(0,n.jsx)("div",{className:"relative",children:(0,n.jsxs)("div",{className:"w-full h-[350px] md:h-[450px] flex items-center justify-center overflow-hidden",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-black/60 via-blue-900/40 to-purple-900/60 z-10"}),(0,n.jsx)("div",{className:"absolute top-4 right-4 z-30 w-24 h-10 rounded-lg bg-white/40"}),(0,n.jsx)("div",{className:"relative z-20 text-center w-full flex flex-col items-center justify-center h-full",children:(0,n.jsx)("div",{className:"h-10 md:h-20 w-2/3 md:w-1/2 bg-white/40 rounded-lg mb-4 md:mb-6"})})]})}),(0,n.jsxs)("section",{className:"max-w-5xl mx-auto w-full grid grid-cols-1 md:grid-cols-3 gap-8 px-4",children:[(0,n.jsx)("div",{className:"col-span-2 bg-white/80 backdrop-blur-lg shadow-xl border-0 rounded-xl",children:(0,n.jsx)("div",{className:"p-8 space-y-8",children:(0,n.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[(0,n.jsx)("div",{className:"space-y-6",children:[1,2,3,4].map(e=>(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsx)("div",{className:"h-8 w-8 rounded-full bg-blue-200"}),(0,n.jsx)("div",{className:"h-6 w-32 bg-blue-100 rounded"})]},e))}),(0,n.jsxs)("div",{className:"flex flex-col gap-8 justify-center items-center",children:[(0,n.jsx)("div",{className:"w-40 h-12 bg-gradient-to-r from-purple-200 to-blue-200 rounded-lg"}),(0,n.jsx)("div",{className:"h-4 w-24 bg-gray-200 rounded mt-2"})]})]})})}),(0,n.jsxs)("div",{className:"bg-white/80 backdrop-blur-lg shadow-xl border-0 flex flex-col items-center justify-center p-8 rounded-xl",children:[(0,n.jsx)("div",{className:"w-28 h-28 rounded-full bg-blue-200 mb-6"}),(0,n.jsx)("div",{className:"h-6 w-32 bg-blue-100 rounded mb-2"}),(0,n.jsx)("div",{className:"h-4 w-24 bg-gray-200 rounded"})]})]}),(0,n.jsx)("section",{className:"max-w-5xl mx-auto w-full px-4",children:(0,n.jsx)("div",{className:"bg-white/90 backdrop-blur-lg shadow-xl border-0 rounded-xl",children:(0,n.jsxs)("div",{className:"p-10",children:[(0,n.jsx)("div",{className:"h-8 w-1/3 bg-gradient-to-r from-purple-200 to-blue-200 rounded mb-6"}),(0,n.jsx)("div",{className:"h-6 w-full bg-blue-100 rounded mb-3"}),(0,n.jsx)("div",{className:"h-4 w-2/3 bg-gray-200 rounded mt-2"})]})})}),(0,n.jsx)("section",{className:"max-w-5xl mx-auto w-full px-4",children:(0,n.jsx)("div",{className:"bg-white/90 backdrop-blur-lg shadow-xl border-0 rounded-xl",children:(0,n.jsxs)("div",{className:"p-10",children:[(0,n.jsx)("div",{className:"h-8 w-1/4 bg-gradient-to-r from-purple-200 to-blue-200 rounded mb-8"}),(0,n.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-8",children:[1,2,3,4].map(e=>(0,n.jsx)("div",{className:"h-6 w-full bg-blue-100 rounded mb-3"},e))})]})})})]})}var o=s(96450),i=s(95956),d=s(58357),c=s(35571),u=s(54662);let m=e=>{let t=e.toLowerCase();return t.includes("youtube.com")||t.includes("youtu.be")},h=e=>{try{let t=new URL(e),s=t.hostname.toLowerCase();if(s.includes("youtu.be")){let s=t.pathname.replace("/","").trim();return s?"https://www.youtube.com/embed/".concat(s):e}if(s.includes("youtube.com")){let e=t.searchParams.get("v");if(e)return"https://www.youtube.com/embed/".concat(e);let s=t.pathname.split("/").filter(Boolean),n=s.findIndex(e=>"embed"===e);if(n>=0&&s[n+1])return"https://www.youtube.com/embed/".concat(s[n+1]);let a=s.findIndex(e=>"shorts"===e);if(a>=0&&s[a+1])return"https://www.youtube.com/embed/".concat(s[a+1])}}catch(e){}return e},x=e=>{try{let t=new URL(e),s=t.hostname.toLowerCase();if(s.includes("youtu.be"))return t.pathname.replace("/","").trim()||null;if(s.includes("youtube.com")){let e=t.searchParams.get("v");if(e)return e;
1let s=t.pathname.split("/").filter(Boolean),n=s.findIndex(e=>"embed"===e);if(n>=0&&s[n+1])return s[n+1];let a=s.findIndex(e=>"shorts"===e);if(a>=0&&s[a+1])return s[a+1]}}catch(e){}return null},p=[{value:"pending",label:"Pending"},{value:"inprogress",label:"In Progress"},{value:"completed",label:"Completed"}];function g(e){var t;let{workshop:s,assignment:r,canEdit:l,userId:o,workshopId:i,onTaskUpdate:g}=e,f=()=>(Array.isArray(null==s?void 0:s.tasks)?s.tasks:[]).filter(e=>e&&e.id&&e.name).map(e=>{var t;return{id:e.id,name:e.name,videoLink:e.videoLink||"",videoLinks:Array.isArray(e.videoLinks)&&e.videoLinks.length>0?e.videoLinks.filter(Boolean):e.videoLink?[e.videoLink]:[],status:(null==r?void 0:null===(t=r.tasksStatus)||void 0===t?void 0:t[e.id])||"pending"}}),[b,w]=(0,a.useState)(f()),[v,y]=(0,a.useState)(null),[j,N]=(0,a.useState)(!1),[k,S]=(0,a.useState)(null);(0,a.useEffect)(()=>{w(f())},[s,r]),(0,a.useEffect)(()=>{let e=window.matchMedia("(max-width: 768px)").matches;N((0,c.s)()||e);let t=window.matchMedia("(max-width: 768px)"),s=()=>N((0,c.s)()||t.matches);return t.addEventListener("change",s),()=>t.removeEventListener("change",s)},[]);let A=async(e,t)=>{let s=b[e];w(s=>s.map((s,n)=>n===e?{...s,status:t}:s)),y(s.id);try{if(!(await fetch("".concat(d.CT,"/workshopAssignments"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:o,workshopId:i,taskId:s.id,taskStatus:t})})).ok)throw Error("Failed to update task");g&&g()}catch(t){w(t=>t.map((t,n)=>n===e?{...t,status:s.status}:t)),alert("Failed to update lesson status.")}finally{y(null)}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(u.Vq,{open:null!==k,onOpenChange:e=>{e||S(null)},children:(0,n.jsxs)(u.cZ,{className:"max-w-4xl w-[calc(100vw-1.5rem)] p-4 sm:p-6 gap-3",children:[(0,n.jsx)(u.fK,{children:(0,n.jsx)(u.$N,{className:"text-left text-base sm:text-lg pr-8",children:null!==(t=null==k?void 0:k.title)&&void 0!==t?t:"Lesson video"})}),(null==k?void 0:k.kind)==="youtube"&&(0,n.jsx)("div",{className:"relative w-full aspect-video bg-black rounded-lg overflow-hidden",children:(0,n.jsx)("iframe",{className:"absolute inset-0 w-full h-full border-0",src:k.embedUrl,title:k.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",referrerPolicy:"strict-origin-when-cross-origin",allowFullScreen:!0},k.embedUrl)}),(null==k?void 0:k.kind)==="stream"&&(0,n.jsx)("video",{controls:!0,autoPlay:!0,playsInline:!0,className:"w-full rounded-lg bg-black max-h-[70vh]",controlsList:"nodownload",src:k.src},k.src)]})}),(0,n.jsxs)("div",{className:"space-y-2.5 sm:space-y-8",children:[0===b.length&&(0,n.jsxs)("div",{className:"rounded-2xl border border-blue-200 bg-blue-50 p-6 text-center",children:[(0,n.jsx)("h4",{className:"text-lg font-semibold text-blue-800",children:"No lesson has been assigned yet."}),(0,n.jsx)("p",{className:"mt-2 text-sm text-blue-700",children:"Please wait for the lesson assignment from your mentor/admin."}),(0,n.jsxs)("div",{className:"mt-4 text-left max-w-md mx-auto",children:[(0,n.jsx)("p",{className:"text-sm font-semibold text-blue-800 mb-2",children:"Next steps:"}),(0,n.jsxs)("ol",{className:"list-decimal list-inside text-sm text-blue-700 space-y-1",children:[(0,n.jsx)("li",{children:"Check this page again after some time."}),(0,n.jsx)("li",{children:"Contact your mentor/admin if it is urgent."}),(0,n.jsx)("li",{children:"Complete prerequisite videos in the meantime."})]})]})]}),b.map((e,t)=>(()=>{var s;let a=Array.isArray(e.videoLinks)&&e.videoLinks.length>0?e.videoLinks.filter(Boolean):e.videoLink?[e.videoLink]:[],r=a.filter(m),o=a.filter(e=>!m(e));return(0,n.jsxs)("div",{className:"p-2.5 sm:p-5 md:p-6 rounded-lg sm:rounded-2xl border bg-white shadow-md flex flex-col gap-2 sm:gap-3 transition hover:shadow-lg w-full min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-2",children:[(0,n.jsx)("div",{className:"flex-1 min-w-0",children:(0,n.jsx)("span",{className:"font-bold text-lg text-gray-800 break-words",children:null==e?void 0:e.name})}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-2 md:mt-0 w-full sm:w-auto",children:[(0,n.jsx)("span",{className:"text-gray-500 text-sm font-medium shrink-0",children:"Status:"}),l?(0,n.jsx)("select",{className:"border rounded px-3 py-1.5 min-h-[44px] sm:min-h-0 flex-1 sm:flex-none max-w-full focus:ring-2 focus:ring-blue-400 transition touch-manipulation bg-white",value:null==e?void 0:e.status,disabled:v===e.id,onChange:e=>A(t,e.target.value),children:p.map(e=>(0,n.jsx)("option",{value:e.value,children:e.label},e.value))}):(0,n.jsx)("span",{className:"px-3 py-1 rounded-full text-sm font-semibold ".concat((null==e?void 0:e.status)==="completed"?"bg-green-100 text-green-700":(null==e?void 0:e.status)==="inprogress"?"bg-yellow-100 text-yellow-700":"bg-gray-100 text-gray-700"),children:(null===(s=p.find(t=>t.value===e.status))||void 0===s?void 0:s.label)||(null==e?void 0:e.status)})]})]}),a.length>0&&(0,n.jsxs)("div",{className:"mt-1 sm:mt-3 rounded-md sm:rounded-lg border border-gray-200 bg-gray-50 p-1.5 sm:p-3 w-full min-w-0",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-gray-700 mb-1 sm:mb-2",children:"Video Preview"}),r.length>0&&(0,n.jsx)("div",{className:"mb-3 space-y-3",children:r.map((t,s)=>{let a=x(t),l=h(t),o=r.length>1?"".concat(e.name," (").concat(s+1,")"):e.name;return j?(0,n.jsxs)("button",{type:"button",onClick:()=>S({kind:"youtube",embedUrl:"".concat(l).concat(l.includes("?")?"&":"?","autoplay=1"),title:o}),className:"relative w-full aspect-video rounded-lg overflow-hidden bg-gray-900 touch-manipulation text-left",children:[a?(0,n.jsx)("img",{src:"https://img.youtube.com/vi/".concat(a,"/hqdefault.jpg"),alt:"",className:"absolute inset-0 w-full h-full object-cover"}):null,(0,n.jsxs)("span",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 bg-black/45 text-white font-semibold",children:[(0,n.jsx)("span",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-red-600 shadow-lg","aria-hidden":!0,
1children:"â¶"}),"Play video"]})]},"".concat(e.id,"-yt-").concat(s)):(0,n.jsx)("div",{className:"relative w-full bg-black rounded-md overflow-hidden aspect-video isolate",children:(0,n.jsx)("iframe",{className:"absolute top-0 left-0 w-full h-full border-0",src:h(t),title:"".concat(e.name," YouTube ").concat(s+1),allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",referrerPolicy:"strict-origin-when-cross-origin",allowFullScreen:!0})},"".concat(e.id,"-yt-").concat(s))})}),o.length>0&&(0,n.jsx)("div",{className:"space-y-3",children:o.map((t,s)=>{let a="/api/video-proxy?workshopId=".concat(encodeURIComponent(i),"&taskId=").concat(encodeURIComponent(e.id),"&streamIndex=").concat(s);return j?(0,n.jsxs)("button",{type:"button",onClick:()=>S({kind:"stream",src:a,title:e.name}),className:"flex items-center justify-center gap-2 w-full min-h-[3rem] py-4 px-4 bg-teal-700 hover:bg-teal-800 active:bg-teal-900 text-white font-semibold rounded-lg touch-manipulation",children:[(0,n.jsx)("span",{"aria-hidden":!0,children:"â¶"}),"Play video"]},"".concat(e.id,"-stream-").concat(s)):(0,n.jsx)("div",{className:"relative w-full bg-black rounded-md overflow-hidden aspect-video",children:(0,n.jsx)("video",{className:"absolute top-0 left-0 w-full h-full",controls:!0,controlsList:"nodownload",src:a})},"".concat(e.id,"-stream-").concat(s))})})]})]},e.id||t)})())]})]})}var f=s(16463),b=s(11337),w=s(76165),v=s(87138),y=s(3274),j=s(92513),N=s(75733),k=s(6649),S=s(6884),A=s(23787),I=s(44880),C=s(73284),L=s(4740);function E(e){let{workshopId:t,trainingId:s,userId:r,workshop:l,training:o}=e,d=(0,C.zd)(l,o),[c,u]=(0,a.useState)(""),[m,h]=(0,a.useState)([]),[x,p]=(0,a.useState)(null),[g,f]=(0,a.useState)(null),[b,w]=(0,a.useState)(!1),[E,P]=(0,a.useState)(!0),T=(0,C.kd)(t,s,d,void 0,!0),O=(0,a.useCallback)(async()=>{P(!0);try{var e;let n=await (0,I.Oz)(t,s,d),a=(null===(e=n.profileUrl)||void 0===e?void 0:e.includes("/p/"))&&s?(0,I.uA)(s,r,n.editorType):n.profileUrl;u(a),h(n.uploads||[])}catch(e){(0,L.Fo)(e)||i.Am.error(e.message||"Failed to load your saved work")}finally{P(!1)}},[t,s,d,r]);(0,a.useEffect)(()=>{r&&O()},[r,O]);let R=async()=>{if(c)try{await navigator.clipboard.writeText(c),i.Am.success("Public link copied")}catch(e){i.Am.error("Could not copy link")}},_=async e=>{if(x===e){p(null),f(null);return}p(e),w(!0);try{let n=await (0,I.Oz)(t,s,d,e);f(n.content||n.html||null)}catch(e){(0,L.Fo)(e)||i.Am.error(e.message||"Failed to load preview"),p(null),f(null)}finally{w(!1)}};return E?(0,n.jsxs)("div",{className:"flex items-center justify-center py-10 text-teal-700",children:[(0,n.jsx)(y.Z,{className:"animate-spin mr-2 h-5 w-5"}),"Loading your work..."]}):(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,n.jsx)("p",{className:"text-sm text-gray-600",children:"Add a new submission or edit a previous one."}),(0,n.jsxs)(v.default,{href:T,className:"inline-flex items-center justify-center gap-2 bg-[#1976d2] hover:bg-[#1251a3] text-white px-5 py-2.5 rounded-lg font-semibold transition-colors shrink-0",children:[(0,n.jsx)(j.Z,{className:"h-4 w-4"}),"Add"]})]}),m.length>0?(0,n.jsxs)("div",{className:"rounded-xl border border-green-200 bg-green-50 p-5 space-y-4",children:[(0,n.jsx)("p",{className:"text-sm text-green-700",children:"The latest saved submission appears on the public showcase."}),(0,n.jsx)("div",{className:"space-y-3",children:m.map(e=>(0,n.jsxs)("div",{className:"rounded-lg border border-green-200 bg-white p-4 space-y-3",children:[(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"font-medium text-gray-800",children:e.title}),(0,n.jsxs)("p",{className:"text-sm text-gray-600",children:[e.savedAt?"Saved ".concat(new Date(e.savedAt).toLocaleString()):"Not saved yet",e.isActive&&(0,n.jsx)("span",{className:"ml-2 text-xs font-semibold text-green-700 bg-green-100 px-2 py-0.5 rounded-full",children:"on showcase"})]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>_(e.id),className:"inline-flex items-center gap-1 rounded-lg border border-green-300 px-3 py-2 text-sm font-medium text-green-800 hover:bg-green-50",children:[(0,n.jsx)(N.Z,{className:"h-4 w-4"}),x===e.id?"Hide":"View"]}),(0,n.jsxs)(v.default,{href:(0,C.kd)(t,s,d,e.id),className:"inline-flex items-center gap-1 rounded-lg bg-[#1976d2] px-3 py-2 text-sm font-medium text-white hover:bg-[#1251a3]",children:[(0,n.jsx)(k.Z,{className:"h-4 w-4"}),"Edit"]})]})]}),x===e.id&&(0,n.jsx)("div",{className:"rounded-lg border border-green-100 overflow-hidden",children:b?(0,n.jsxs)("div",{className:"flex items-center justify-center py-8 text-teal-700",children:[(0,n.jsx)(y.Z,{className:"animate-spin mr-2 h-5 w-5"}),"Loading preview..."]}):"html"===d&&g?(0,n.jsx)("iframe",{title:"Preview ".concat(e.title),srcDoc:g,className:"w-full h-72 border-0",sandbox:"allow-scripts allow-same-origin allow-modals"}):"python"===d&&g?(0,n.jsx)("pre",{className:"bg-[#18191c] text-[#7CFC00] p-4 text-sm overflow-auto max-h-72 font-mono whitespace-pre-wrap",children:g}):null})]},e.id))}),c&&(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 pt-2 border-t border-green-200",children:[(0,n.jsx)("input",{readOnly:!0,value:c,className:"flex-1 rounded-lg border border-green-200 px-3 py-2 text-sm bg-white text-gray-700"}),(0,n.jsxs)("button",{type:"button",onClick:R,className:"inline-flex items-center justify-center gap-2 bg-white border border-green-300 text-green-800 px-4 py-2 rounded-lg font-medium hover:bg-green-100",children:[(0,n.jsx)(S.Z,{className:"h-4 w-4"}),"Copy public link"]}),(0,n.jsxs)("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-2 bg-green-700 text-white px-4 py-2 rounded-lg font-medium hover:bg-green-800",children:[(0,n.jsx)(A.Z,{className:"h-4 w-4"}),"Open public page"]})]})]}):(0,n.jsxs)("div",{className:"rounded-xl border border-blue-200 bg-blue-50 p-5 text-blue-800 text-sm",children:["No submissions yet. Click ",(0,n.jsx)("strong",{children:"Add"})," to create your first one."]})]})}var P=s(73868);function T(e){let{workshopId:t,userId:s}=e,[r,l]=(0,a.useState)(null),[o,d]=(0,a.useState)(!1),[u,m]=(0,a.useState)(0),[h,x]=(0,a.useState)(!0),[p,g]=(0,a.useState)(!1),[f,b]=(0,a.useState)(!1);(0,a.useEffect)(()=>{b((0,c.s)())},[]);let w=(0,a.useCallback)(async()=>
1{if(t)try{var e;let n=await (0,P.Oj)(t,s);l(n.session),d(!!n.checkedIn),m(null!==(e=n.minutesRemaining)&&void 0!==e?e:0)}catch(e){l(null),d(!1)}finally{x(!1)}},[t,s]);(0,a.useEffect)(()=>{w();let e=setInterval(w,r?1e4:8e3);return()=>clearInterval(e)},[w,r]);let v=async()=>{if(null==r?void 0:r._id){if(r.mobileOnly&&!f){i.Am.error("Use your mobile phone to mark attendance for this session.");return}g(!0);try{let e;r.requireGeofence&&(e=await (0,c.A)());let t=await (0,P.u)(r._id,s,e);d(!0),i.Am.success(t.alreadyCheckedIn?"You are already marked present.":"Attendance recorded. You're marked present!")}catch(e){i.Am.error(e.message||"Could not mark attendance")}finally{g(!1)}}};if(h||!r)return null;let y=r.mobileOnly&&!f&&!o;return(0,n.jsx)("section",{className:"max-w-5xl mx-auto w-full px-4 mt-8",children:(0,n.jsx)("div",{className:"rounded-xl border p-6 shadow-sm ".concat(y?"border-amber-200 bg-gradient-to-r from-amber-50 to-orange-50":"border-emerald-200 bg-gradient-to-r from-emerald-50 to-teal-50"),children:(0,n.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide ".concat(y?"text-amber-700":"text-emerald-700"),children:"Live session open"}),(0,n.jsx)("h3",{className:"text-xl font-bold text-gray-900 mt-1",children:r.title}),(r.mobileOnly||r.requireGeofence)&&(0,n.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2",children:[r.mobileOnly&&(0,n.jsx)("span",{className:"rounded-full bg-white/80 px-2 py-0.5 text-xs font-medium text-gray-700 border",children:"Mobile only"}),r.requireGeofence&&(0,n.jsxs)("span",{className:"rounded-full bg-white/80 px-2 py-0.5 text-xs font-medium text-gray-700 border",children:["Near classroom",r.geofenceRadiusMeters?" \xb7 ".concat(r.geofenceRadiusMeters,"m"):""]})]}),(0,n.jsx)("p",{className:"text-sm text-gray-600 mt-2",children:o?"You are marked present for this session.":y?"This session requires a phone. Open this workshop on your mobile browser, then tap Mark present.":r.requireGeofence?"Mark present within ".concat(u," minute").concat(1===u?"":"s",". You must be in the classroom area â location access required."):"Mark yourself present within the next ".concat(u," minute").concat(1===u?"":"s",".")})]}),o?(0,n.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-lg bg-emerald-600 px-5 py-3 text-sm font-semibold text-white",children:[(0,n.jsx)("span",{"aria-hidden":!0,children:"â"}),"Present"]}):y?(0,n.jsx)("div",{className:"rounded-lg border border-amber-300 bg-white px-5 py-3 text-sm font-semibold text-amber-800",children:"Phone required"}):(0,n.jsx)("button",{type:"button",onClick:v,disabled:p,className:"rounded-lg bg-emerald-600 px-6 py-3 text-sm font-semibold text-white shadow hover:bg-emerald-700 disabled:opacity-60",children:p?"Saving...":"Mark present"})]})})})}let O=d.CT;var R=e=>{let{params:t}=e,{workshopId:s}=t,[d,c]=(0,a.useState)(null),[u,m]=(0,a.useState)(null),[h,x]=(0,a.useState)(null),[p,v]=(0,a.useState)(!0),[y,j]=(0,a.useState)(null),[N,k]=(0,a.useState)(!1),[S,A]=(0,a.useState)(""),[I,L]=(0,a.useState)(""),[P,R]=(0,a.useState)(!1),[_,D]=(0,a.useState)(!1),[U,q]=(0,a.useState)(!1),[z,M]=(0,a.useState)(!1),[W,F]=(0,a.useState)(!1),[B,Z]=(0,a.useState)(!1),[V,Y]=(0,a.useState)(!1),{user:G}=(0,o.useAuthStore)(),$=(0,f.useRouter)(),J=async()=>{try{let e=localStorage.getItem("user"),t=e?JSON.parse(e):null,n=(null==t?void 0:t.userId)||(null==t?void 0:t._id);if(!n)return;let a=await fetch("".concat(O,"/workshopAssignments/user/").concat(n));if(!a.ok)return;let r=(await a.json()).find(e=>e.workshopId===s);if(r&&(m(r),d)){let e=(d.tasks||[]).map(e=>{var t;return{...e,status:(null===(t=r.tasksStatus)||void 0===t?void 0:t[e.id])||"pending"}});c({...d,tasks:e})}}catch(e){console.error("Failed to refetch assignment:",e)}};(0,a.useEffect)(()=>{(async()=>{v(!0),j(null);try{let e=localStorage.getItem("user"),t=e?JSON.parse(e):null,n=(null==t?void 0:t.userId)||(null==t?void 0:t._id);if(!n)throw Error("User not found");let a=await fetch("".concat(O,"/workshops/").concat(s));if(console.log("Fetching workshop from:",a),!a.ok)throw Error("Failed to fetch workshop");let r=await a.json();c(r);let l=await fetch("".concat(O,"/workshopAssignments/user/").concat(n));if(!l.ok)throw Error("Failed to fetch assignments");let o=(await l.json()).find(e=>
1e.workshopId===s);if(o){let e=(r.tasks||[]).map(e=>{var t;return{...e,status:(null===(t=o.tasksStatus)||void 0===t?void 0:t[e.id])||"pending"}});if(c({...r,tasks:e}),m(o),o.submission&&(A(o.submission.githubLink||""),L(o.submission.description||"")),o.trainingId)try{let e=await fetch("".concat(O,"/trainings/").concat(o.trainingId));if(e.ok){let t=await e.json();x(t)}try{let e=await fetch("".concat(O,"/questions/training/").concat(o.trainingId));if(e.ok){let t=await e.json();t.mcq&&t.mcq.length>0&&F(!0)}}catch(e){console.warn("No questions found for this training")}try{(await fetch("".concat(O,"/assesmentResult/training/").concat(o.trainingId,"/").concat(n))).ok&&(q(!0),console.log("Assessment already submitted for this user"))}catch(e){console.log("No previous assessment found")}}catch(e){console.warn("Failed to fetch training details:",e)}M(!0)}else console.warn("Workshop assignment not found for user"),m(null),M(!0)}catch(e){j(e.message||"Error fetching data")}finally{v(!1)}})()},[s]),(0,a.useEffect)(()=>{(async()=>{if(!G||!s){Y(!0),M(!0);return}try{let e=await fetch("".concat(O,"/workshopAssignments/user/").concat(G._id));if(!e.ok){Y(!0),M(!0);return}let t=await e.json();if(Array.isArray(t)){let e=t.find(e=>e.workshopId===s);if(e&&(Z(!0),m(e),e.submission&&(A(e.submission.githubLink||""),L(e.submission.description||"")),e.trainingId)){x({_id:e.trainingId});try{console.log("Checking questions for trainingId:",e.trainingId);let t=await fetch("".concat(O,"/questions/training/").concat(e.trainingId));if(console.log("Questions API response status:",t.status),t.ok){let e=await t.json();console.log("Questions data:",e),e.mcq&&e.mcq.length>0&&(console.log("â
Questions found - setting hasQuestions to true"),F(!0))}}catch(e){console.log("Questions check error:",e)}try{console.log("Checking assessment for trainingId:",e.trainingId,"userId:",G._id);let t=await fetch("".concat(O,"/assesmentResult/training/").concat(e.trainingId,"/").concat(G._id));if(console.log("Assessment API response status:",t.status),t.ok){let e=await t.json();console.log("Assessment data found:",e),q(!0)}else console.log("No assessment found"),q(!1)}catch(e){console.log("Assessment check error:",e),q(!1)}}}}catch(e){console.error("Error checking workshop assignment and assessment:",e)}Y(!0),M(!0)})()},[G,s]);let H=async e=>{e.preventDefault(),R(!0),j(null),D(!1);try{let e=localStorage.getItem("user"),t=e?JSON.parse(e):null,n=(null==t?void 0:t.userId)||(null==t?void 0:t._id);if(!n)throw Error("User not found");let a={userId:n,workshopId:s,status:"submitted",submission:{githubLink:S,description:I},submittedAt:new Date().toISOString()};(null==u?void 0:u.trainingId)&&(a.trainingId=u.trainingId);let r=await fetch("".concat(O,"/workshopAssignments"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.message||"Failed to submit assignment")}D(!0),k(!1),i.Am.success("Assignment submitted successfully!");let l=await fetch("".concat(O,"/workshopAssignments/user/").concat(n));if(l.ok){let e=(await l.json()).find(e=>e.workshopId===s);e&&m({_id:e._id,userId:e.userId,workshopId:e.workshopId,trainingId:e.trainingId,status:e.status,assignedAt:e.assignedAt,submittedAt:e.submittedAt,submission:e.submission,tasksStatus:e.tasksStatus})}}catch(e){j(e.message||"Error submitting assignment"),i.Am.error(e.message||"Error submitting assignment")}finally{R(!1)}},Q=(null==d?void 0:d.whatsapp)||null,K=(null==d?void 0:d.meeting)||null;return(0,n.jsx)(r.default,{currentPath:"/my-workshops",children:(0,n.jsx)("main",{className:"bg-gradient-to-br from-blue-100 to-purple-100 min-h-screen pb-4 sm:pb-10 w-full max-w-full",children:p?(0,n.jsx)(l,{}):y?(0,n.jsx)("div",{className:"text-center py-12 text-red-600",children:y}):d?u?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"relative w-full h-28 sm:h-52 md:h-[400px] flex items-center justify-center overflow-hidden rounded-none sm:rounded-xl",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-black/60 via-blue-900/40 to-purple-900/60 z-10"}),(0,n.jsx)("div",{className:"relative z-20 text-center w-full px-2 sm:px-3 flex flex-col items-center justify-center h-full",children:(0,n.jsx)("h1",{className:"text-xl sm:text-3xl md:text-5xl font-bold text-white drop-shadow leading-snug",children:d.title})})]}),(0,n.jsx)(T,{workshopId:s,userId:null==G?void 0:G._id}),(0,n.jsx)("section",{className:"max-w-5xl mx-auto w-full px-0 sm:px-4 mt-2 sm:mt-8",children:(0,n.jsx)("div",{className:"bg-white/90 backdrop-blur-lg shadow-xl border-0 rounded-lg sm:rounded-xl",children:(0,n.jsxs)("div",{className:"p-3 sm:p-6 md:p-10",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between mb-3 sm:mb-6",children:[(0,n.jsx)("h3",{className:"text-xl sm:text-2xl font-bold text-teal-700",children:"About this Workshop"}),Q&&(0,n.jsx)("div",{className:"flex flex-col items-end",children:Q&&(0,n.jsxs)("a",{href:Q,target:"_blank",rel:"noopener noreferrer",className:"px-6 py-3 rounded-lg font-semibold transition-all duration-300 flex items-center gap-3 bg-emerald-600 hover:bg-emerald-700 text-white shadow-lg transform hover:scale-105 hover:shadow-xl",children:[(0,n.jsx)("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"
1currentColor",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)("path",{d:"M20.52 3.48A11.93 11.93 0 0012 .5 11.85 11.85 0 001.5 12c0 2.11.55 4.08 1.6 5.83L.5 23.5l5.94-2.02A11.85 11.85 0 0012 23.5c6.34 0 11.5-5.16 11.5-11.5 0-3.08-1.2-5.93-3.0-8.52zM12 21.5c-1.8 0-3.51-.48-5.03-1.38l-.36-.21-3.53 1.2 1.2-3.44-.23-.37A9.35 9.35 0 012.5 12 9.5 9.5 0 1112 21.5zM17.1 14.2c-.25-.12-1.48-.73-1.71-.81-.23-.09-.4-.12-.57.12-.17.24-.66.81-.81.98-.15.17-.3.19-.55.06-.25-.12-1.05-.39-2.0-1.23-.74-.66-1.24-1.46-1.38-1.71-.14-.25-.02-.38.1-.5.1-.1.23-.28.35-.42.12-.14.16-.24.25-.4.09-.16.04-.3-.02-.42-.07-.12-.57-1.37-.78-1.86-.2-.49-.41-.42-.57-.43-.15-.01-.33-.01-.51-.01-.18 0-.47.06-.72.33-.25.27-.95.93-.95 2.27 0 1.34.97 2.64 1.1 2.82.12.17 1.9 2.96 4.61 4.23 3.05 1.45 3.05 0.97 3.6 0.91.55-.06 1.78-.72 2.03-1.41.25-.69.25-1.28.18-1.41-.06-.13-.21-.19-.46-.31z"})}),(0,n.jsx)("span",{children:"Join WhatsApp Group"}),(0,n.jsx)("div",{className:"w-2 h-2 bg-red-400 rounded-full animate-pulse"})]})})]}),(0,n.jsx)("p",{className:"text-gray-700 text-lg",children:d.description})]})})}),(0,n.jsx)("section",{className:"max-w-5xl mx-auto w-full grid grid-cols-1 md:grid-cols-2 gap-2 sm:gap-8 px-0 sm:px-4 mt-2 sm:mt-8",children:(0,n.jsx)("div",{className:"col-span-2 bg-white/90 backdrop-blur-lg shadow-xl border-0 rounded-lg sm:rounded-xl flex items-center",children:(0,n.jsxs)("div",{className:"p-3 sm:p-6 md:p-8 w-full min-w-0",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4",children:[(0,n.jsx)("h3",{className:"text-xl sm:text-2xl font-bold text-teal-700 sm:mb-0",children:"Workshop Details"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 sm:gap-3 items-center",children:[K&&(0,n.jsxs)("a",{href:K,target:"_blank",rel:"noopener noreferrer",className:"px-4 py-2 rounded-lg font-semibold transition-all duration-300 flex items-center gap-2 bg-gradient-to-r from-green-600 to-blue-600 hover:from-green-700 hover:to-blue-700 text-white shadow-lg",children:[(0,n.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 002 2z"})}),"Meeting Link"]}),(0,n.jsx)("span",{className:"text-sm px-3 py-1 rounded-full font-semibold \n ".concat((null==u?void 0:u.status)==="submitted"?"bg-blue-100 text-blue-700":(null==u?void 0:u.status)==="assigned"?"bg-yellow-100 text-yellow-700":"bg-gray-200 text-gray-600"),children:(null==u?void 0:u.status)||d.status})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-4 w-full",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-semibold text-gray-700",children:"Workshop Created: "}),(0,n.jsx)("span",{className:"text-gray-600",children:d.createdAt?"string"==typeof d.createdAt?new Date(d.createdAt).toLocaleDateString():d.createdAt.$date?new Date(d.createdAt.$date).toLocaleDateString():"-":"-"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-semibold text-gray-700",children:"Deadline: "}),(0,n.jsxs)("span",{className:"text-gray-600",children:[d.timeLimit?new Date(d.timeLimit).toLocaleDateString():"-"," ",d.timeLimit&&(0,n.jsx)("span",{className:"ml-2 text-xs text-teal-700 font-semibold",children:function(e){if(!e)return"-";let t=new Date(e),s=new Date,n=Math.ceil((t.getTime()-s.getTime())/864e5);return n>0?"".concat(n," day").concat(1===n?"":"s"," left"):0===n?"Deadline today":"Deadline passed"}(d.timeLimit)})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-semibold text-gray-700",children:"Assigned At: "}),(0,n.jsx)("span",{className:"text-gray-600",children:(null==u?void 0:u.assignedAt)?"string"==typeof u.assignedAt?new Date(u.assignedAt).toLocaleString():u.assignedAt.$date?new Date(u.assignedAt.$date).toLocaleString():"-":"-"})]}),(null==u?void 0:u.submittedAt)&&(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-semibold text-gray-700",children:"Submitted At: "}),(0,n.jsx)("span",{className:"text-gray-600",children:"string"==typeof u.submittedAt?new Date(u.submittedAt).toLocaleStr
1ing():u.submittedAt.$date?new Date(u.submittedAt.$date).toLocaleString():"-"})]})]})]})})}),d.skillsRequired&&(0,n.jsx)("section",{className:"max-w-5xl mx-auto w-full px-0 sm:px-4 mt-2 sm:mt-8",children:(0,n.jsxs)("div",{className:"bg-white/90 backdrop-blur-lg shadow-xl border-0 rounded-lg sm:rounded-xl p-3 sm:p-6",children:[(0,n.jsx)("h3",{className:"text-xl sm:text-2xl font-bold mb-3 sm:mb-8 text-teal-700",children:"Skills Required"}),(0,n.jsx)("div",{className:"text-gray-700 text-lg",children:Array.isArray(d.skillsRequired)?d.skillsRequired.join(", "):d.skillsRequired})]})}),d.videos&&Array.isArray(d.videos)&&d.videos.length>0&&(0,n.jsx)("section",{className:"max-w-5xl mx-auto w-full px-0 sm:px-4 mt-2 sm:mt-8",children:(0,n.jsxs)("div",{className:"bg-white/90 backdrop-blur-lg shadow-xl border-0 rounded-lg sm:rounded-xl p-3 sm:p-6 md:p-8",children:[(0,n.jsxs)("h3",{className:"text-xl sm:text-2xl font-bold mb-3 sm:mb-8 text-teal-700 flex items-center",children:[(0,n.jsx)(b.Z,{className:"w-6 h-6 mr-3 text-teal-600"}),"Prerequisite Videos (",d.videos.length,")"]}),(0,n.jsx)("p",{className:"text-gray-600 mb-6 text-sm",children:"\uD83D\uDCDA Watch these videos before starting the lessons to understand the workshop requirements better."}),(0,n.jsx)(w.Z,{items:d.videos})]})}),(0,n.jsx)("section",{className:"max-w-5xl mx-auto w-full px-0 sm:px-4 mt-2 sm:mt-8",children:(0,n.jsx)("div",{className:"bg-white/90 backdrop-blur-lg shadow-xl border-0 rounded-lg sm:rounded-xl",children:(0,n.jsxs)("div",{className:"p-2 sm:p-6 md:p-10",children:[(0,n.jsx)("h3",{className:"text-xl sm:text-2xl font-bold mb-2 sm:mb-8 text-teal-700 px-1 sm:px-0",children:"Workshop Lessons"}),(0,n.jsx)(g,{workshop:d,assignment:u,canEdit:!!u&&"submitted"!==u.status,userId:(null==G?void 0:G._id)||"",workshopId:d._id,onTaskUpdate:J})]})})}),(0,C.U4)(d)&&(null==G?void 0:G._id)&&(0,n.jsx)("section",{className:"max-w-5xl mx-auto w-full px-0 sm:px-4 mt-2 sm:mt-8",children:(0,n.jsxs)("div",{className:"bg-white/90 backdrop-blur-lg shadow-xl border-0 rounded-lg sm:rounded-xl p-3 sm:p-6 md:p-8",children:[(0,n.jsx)("h3",{className:"text-xl sm:text-2xl font-bold mb-2 text-teal-700",children:"Your Work"}),(0,n.jsx)("p",{className:"text-gray-600 mb-6 text-sm",children:"Open the fullscreen editor to practice and save. Your public link appears here after saving."}),(0,n.jsx)(E,{workshopId:d._id||s,trainingId:null==u?void 0:u.trainingId,userId:G._id,workshop:d,training:h})]})}),(0,n.jsx)("section",{className:"max-w-5xl mx-auto w-full px-0 sm:px-4 mt-2 sm:mt-8",children:(0,n.jsxs)("div",{className:"bg-white/90 backdrop-blur-lg shadow-xl border-0 rounded-lg sm:rounded-xl p-3 sm:p-6 md:p-8",children:[(0,n.jsx)("h3",{className:"text-xl sm:text-2xl font-bold mb-3 sm:mb-8 text-teal-700",children:"Submission"}),(()=>{let e=(null==d?void 0:d["cert-flag"])==="true"||(null==d?void 0:d["cert-flag"])===!0,t=(0,C.U4)(d),a=(0,C.zd)(d,h);if(e){var r;return(null==d?void 0:null===(r=d.tasks)||void 0===r?void 0:r.every(e=>{var t;return(null==u?void 0:null===(t=u.tasksStatus)||void 0===t?void 0:t[e.id])==="completed"}))?(0,n.jsx)("div",{className:"w-full",children:(0,n.jsxs)("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4 text-center",children:[(0,n.jsx)("h4",{className:"font-semibold text-green-800 mb-2",children:"â
Workshop Completed"}),(0,n.jsx)("p",{className:"text-gray-700",children:"You have completed all workshop lessons."})]})}):(0,n.jsx)("div",{className:"w-full",children:(0,n.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4 text-center",children:[(0,n.jsx)("h4",{className:"font-semibold text-blue-800 mb-2",children:"\uD83D\uDCCB Complete Workshop Lessons"}),(0,n.jsx)("p",{className:"text-gray-700",children:"Please complete all the workshop lessons above."})]})})}if(t){let e="python"===a,t=(0,C.kd)(d._id||s,null==u?void 0:u.trainingId,a);return(0,n.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[(0,n.jsx)("h4",{className:"font-semibold text-blue-800 mb-2",children:e?"Python practice & saves":"HTML profile submission"}),(0,n.jsx)("p",{className:"text-gray-700 mb-3",children:e?"Use the Python editor in Your Work above to practice and save snippets. Add submissions from that panel when you are ready.":"Save your work in the HTML editor above. Your public link will appear there after saving."}),e&&(0,n.jsx)("a",{href:t,className:"inline-block text-sm font-semibold text-teal-700 hover:text-teal-900 underline",children:"Open Python editor (fullscreen)"})]})}return(0,n.jsxs)(n.Fragment,{children:[u&&"submitted"!==u.status&&(0,n.jsx)("div",{className:"w-full",children:N?(0,n.jsxs)("form",{onSubmit:H,className:"space-y-4 mt
1-4 w-full",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block font-semibold mb-2 text-gray-700",children:"GitHub Link"}),(0,n.jsx)("input",{type:"url",required:!0,value:S,onChange:e=>A(e.target.value),className:"w-full border border-gray-300 rounded-lg px-4 py-3 focus:ring-2 focus:ring-teal-500 focus:border-transparent",placeholder:"https://github.com/your-repo"})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block font-semibold mb-2 text-gray-700",children:"Description"}),(0,n.jsx)("textarea",{required:!0,value:I,onChange:e=>L(e.target.value),className:"w-full border border-gray-300 rounded-lg px-4 py-3 focus:ring-2 focus:ring-teal-500 focus:border-transparent",rows:4,placeholder:"Describe your approach, technologies used, how to run the project, etc."})]}),(0,n.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,n.jsx)("button",{type:"submit",className:"bg-blue-600 text-white px-6 py-3 rounded-lg hover:bg-blue-700 font-semibold transition-colors disabled:opacity-50 disabled:cursor-not-allowed",disabled:P,children:P?"Submitting...":"Submit Assignment"}),(0,n.jsx)("button",{type:"button",className:"bg-gray-300 text-gray-700 px-6 py-3 rounded-lg hover:bg-gray-400 font-semibold transition-colors",onClick:()=>k(!1),disabled:P,children:"Cancel"})]}),y&&(0,n.jsx)("div",{className:"text-red-600 mt-3 p-3 bg-red-50 rounded-lg",children:y}),_&&(0,n.jsx)("div",{className:"text-green-600 mt-3 p-3 bg-green-50 rounded-lg",children:"Assignment submitted successfully!"})]}):(0,n.jsx)("div",{className:"flex justify-center",children:(0,n.jsx)("button",{className:"bg-teal-600 text-white px-6 py-3 rounded-lg hover:bg-teal-700 font-semibold transition-colors",onClick:()=>k(!0),children:"Submit Assignment"})})}),u&&"submitted"===u.status&&u.submission&&(0,n.jsxs)("div",{className:"w-full space-y-4",children:[(0,n.jsxs)("div",{className:"bg-green-50 border border-green-200 rounded-lg p-4",children:[(0,n.jsx)("h4",{className:"font-semibold text-green-800 mb-2",children:"Assignment Submitted"}),(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-semibold text-gray-700",children:"GitHub Link: "}),(0,n.jsx)("a",{href:u.submission.githubLink,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 underline hover:text-blue-800",children:u.submission.githubLink})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"font-semibold text-gray-700",children:"Description: "}),(0,n.jsx)("p",{className:"text-gray-700 mt-1",children:u.submission.description})]})]})]}),W&&(0,n.jsx)("div",{className:"flex justify-center mt-6",children:(0,n.jsxs)("button",{onClick:()=>{console.log("Button clicked - assessmentSubmitted:",U),U?console.log("Button disabled - evaluation already submitted"):window.location.href="/my-workshops/".concat(s,"/evaluation")},disabled:U,className:"px-6 py-3 rounded-lg font-semibold transition-colors flex items-center gap-2 ".concat(U?"bg-gray-400 text-gray-600 cursor-not-allowed opacity-50":"bg-purple-600 text-white hover:bg-purple-700"),children:[(0,n.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),U?"Evaluation Completed":"Start Evaluation"]})})]})]})})()]})})]}):(0,n.jsx)("div",{className:"text-center py-12",children:(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,n.jsx)("div",{className:"w-24 h-24 bg-red-200 rounded-full flex items-center justify-center",children:(0,n.jsx)("svg",{className:"w-12 h-12 text-red-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})})}),(0,n.jsx)("h3",{className:"text-xl font-semibold text-gray-600",children:"Access Denied"}),(0,n.jsx)("p",{className:"text-gray-500 max-w-md",children:"You don't have access to this workshop. This workshop hasn't been assigned to you yet."}),(0,n.jsx)("button",{onClick:()=>$.push("/my-workshops"),className:"mt-4 px-6 py-2 bg-teal-600 text-white rounded-lg hover:bg-teal-700 transition",children:"Back to My Workshops"})]})}):(0,n.jsx)("div",{className:"text-center py-12 text-gray-500",children:"Workshop not found."})})})}},76165:function(e,t,s){"use strict";s.d(t,{Z:function(){return i}});
1var n=s(57437),a=s(2265),r=s(40121),l=s(99827),o=s(54662);function i(e){let{items:t,buttonText:s="Attachments",title:i="Attachments"}=e,[d,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(null),h=e=>{let t=e.split("?")[0].toLowerCase();return t.endsWith(".mp4")?"video/mp4":t.endsWith(".webm")?"video/webm":t.endsWith(".mov")?"video/quicktime":t.endsWith(".m4v")?"video/x-m4v":t.endsWith(".avi")?"video/x-msvideo":t.endsWith(".pdf")?"application/pdf":t.endsWith(".png")?"image/png":t.endsWith(".jpg")||t.endsWith(".jpeg")?"image/jpeg":t.endsWith(".gif")?"image/gif":"video/mp4"},x=(0,a.useMemo)(()=>Array.isArray(t)?t.filter(e=>!!((null==e?void 0:e.videoLink)||(null==e?void 0:e.url))).map((e,t)=>({id:e.id||t,name:e.name||"Video ".concat(t+1),url:e.videoLink||e.url,type:e.type||e.contentType||h(e.videoLink||e.url),size:e.size})):[],[t]);return 0===x.length?null:(0,n.jsxs)(o.Vq,{open:d,onOpenChange:e=>{c(e),e?m(x[0]||null):m(null)},children:[(0,n.jsx)(o.hg,{asChild:!0,children:(0,n.jsxs)("button",{type:"button",className:"inline-flex items-center gap-2 px-4 py-2 rounded-md border border-gray-200 bg-white hover:bg-gray-50 text-sm font-medium",children:[(0,n.jsx)(r.Z,{className:"h-4 w-4 text-gray-600"}),s]})}),(0,n.jsxs)(o.cZ,{className:"max-w-4xl w-full",children:[(0,n.jsx)(o.fK,{children:(0,n.jsx)(o.$N,{children:i})}),(0,n.jsx)("div",{className:"mt-2 grid grid-cols-1 sm:grid-cols-3 md:grid-cols-5 gap-3",children:x.map((e,t)=>(0,n.jsxs)("button",{type:"button",onClick:()=>m(e),className:"text-left flex items-center gap-2 p-3 rounded-lg border border-gray-200 bg-gray-50 hover:bg-gray-100",children:[(0,n.jsx)(l.Z,{className:"h-5 w-5 text-gray-500"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("div",{className:"font-medium text-sm truncate",children:e.name||"Video ".concat(t+1)}),(0,n.jsx)("div",{className:"text-xs text-gray-500",children:"Video"})]})]},e.id||t))}),u&&(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-gray-700 mb-2",children:u.name}),u?u.type.startsWith("image/")?(0,n.jsx)("img",{src:u.url,alt:u.name,className:"w-full h-auto rounded-lg"}):"application/pdf"===u.type?(0,n.jsx)("iframe",{src:u.url,className:"w-full h-[70vh] rounded-lg",title:u.name}):u.type.startsWith("video/")?(0,n.jsxs)("video",{controls:!0,className:"w-full h-auto rounded-lg",controlsList:"nodownload",src:u.url,children:[(0,n.jsx)("source",{src:u.url,type:u.type}),"Your browser does not support the video tag."]}):(0,n.jsxs)("div",{className:"text-center py-8",children:[(0,n.jsx)("p",{className:"text-sm text-gray-600",children:"Cannot preview this file type."}),(0,n.jsxs)("a",{href:u.url,target:"_self",className:"text-blue-500 hover:underline",children:["Download ",u.name]})]}):null]})]})]})}},54662:function(e,t,s){"use strict";s.d(t,{$N:function(){return p},Be:function(){return g},GG:function(){return u},Vq:function(){return i},cZ:function(){return h},fK:function(){return x},hg:function(){return d}});var n=s(57437),a=s(2265),r=s(30721),l=s(74697),o=s(49354);let i=r.fC,d=r.xz,c=r.h_,u=r.x8,m=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(r.aV,{ref:t,className:(0,o.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...a})});m.displayName=r.aV.displayName;let h=a.forwardRef((e,t)=>{let{className:s,children:a,...i}=e;return(0,n.jsxs)(c,{children:[(0,n.jsx)(m,{}),(0,n.jsxs)(r.VY,{ref:t,className:(0,o.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-neutral-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dark:border-neutral-800 dark:bg-neutral-950",s),...i,children:[a,(0,n.jsxs)(r.x8,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-500 dark:ring-offset-neutral-950 dark:focus:ring-neutral-300 dark:data-[state=open]:bg-neutral-800 dark:data-[state=open]:text-neutral-400",children:[(0,n.jsx)(l.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});h.displayName=r.VY.displayName;let x=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...s})};x.displayName="DialogHeader";let p=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(r.Dx,{ref:t,className:(0,o.cn)("text-lg font-semibold leading-none tracking-tight",s),...a})});p.displayName=r.Dx.displayName;let g=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(r.dk,{ref:t,className:(0,o.cn)("text-sm text-neutral-500 dark:text-neutral-400",s),...a})});g.displayName=r.dk.displayName},58357:function(e,t,s){"use strict";s.d(t,{CT:function(){return n},bz:function(){return r},nL:function(){return a}});let n=(s(20357).env.NEXT_PUBLIC_CLOUD_API_URL||"https://excelrs-cloud-new-1069037816864.asia-south1.run.app").replace(/\/+$/,""),a="https://powr-api.lawazia.tech";function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=String(e||"").replace(/^\/+/,"");return t?"".concat(a,"/").concat(t):a}},44880:function(e,t,s){"use strict";s.d(t,{C6:function(){return h},CZ:function(){return x},Oz:function(){return u},SW:function(){return m},bW:function(){return i},sP:function(){return p},uA:function(){return c}});var n=s(58357),a=s(96450),r=s(4740),l=s(20357);let o=n.CT.replace(/\/$/,"");function i(){return a.useAuthStore.getState().token||localStorage.getItem("token")||localStorage.getItem("auth-token")||localStorage.getItem("authToken")||localStorage.getItem("accessToken")||null}async function d(e,t){let s=await e.text();try{let e=JSON.parse(s);return e.message||e.error||t}catch(e){if(s.includes("Cannot POST")||s.includes("Cannot GET"))return"Workshop profile API is not available.";return(null==s?void 0:s.slice(0,200))||t}}function c(e,t,s){let n=(l.env.NEXT_PUBLIC_APP_URL||"https://www.excelrs.dev").replace(/\/$/,"");return"".concat(n,"/trainings/").concat(e,"/showcase/").concat(encodeURIComponent(t)).concat("python"===s?"?type=python":"")}async function u(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"html",n=arguments.length>3?arguments[3]:void 0,a=i();if(!a)throw Error("Authentication required");let l=new URLSearchParams;t&&l.set("trainingId",t),s&&l.set("editorType",s),n&&l.set("uploadId",n);let c=l.toString()?"?".concat(l.toString()):"",u=await fetch("".concat(o,"/workshops/").concat(e,"/profile/my").concat(c),{headers:{Authorization:"Bearer ".concat(a)}});if((0,r.Ro)(u),!u.ok)throw Error(await d(u,"Failed to load your workshop profile"));return u.json()}async function m(e,t){let s=i();if(!s)throw Error("Authentication required");let n=new URLSearchParams;t&&n.set("trainingId",t);let a=n.toString()?"?".concat(n.toString()):"",l=await fetch("".concat(o,"/workshops/").concat(e,"/profile/uploads").concat(a),{headers:{Authorization:"Bearer ".concat(s)}});if((0,r.Ro)(l),!l.ok)throw Error(await d(l,"Failed to load submissions"));return l.json()}async function h(e,t){let s=i();if(!s)throw Error("Authentication required");if(t.content||t.html,t.editorType,!function(){var e;let t=null===(e=a.useAuthStore.getState().user)||void 0===e?void 0:e._id;if(t)return String(t);try{let e=localStorage.getItem("user");if(e){let t=JSON.parse(e);return String(t.userId||t._id||"")||null}}catch(e){}return null}())throw Error("User not found");let n=await fetch("".concat(o,"/workshops/").concat(e,"/profile/save"),{method:"POST",headers:{Authorization:"Bearer ".concat(s),"Content-Type":"application/json"},body:JSON.stringify(t)});if((0,r.Ro)(n),!n.ok)throw Error(await d(n,"Failed to save profile"));return n.json()}function x(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"html";return"/trainings/".concat(encodeURIComponent(e),"/showcase/").concat(encodeURIComponent(t)).concat("python"===s?"?type=python":"")}async function p(e){let t=await fetch("".concat(o,"/public/users/").concat(encodeURIComponent(e),"/workshop-work"),{next:{revalidate:300}});if(!t.ok)return[];let s=await t.json();return Array.isArray(s.items)?s.items:[]}},73868:function(e,t,s){"use strict";s.d(t,{OH:function(){return i},Oj:function(){return l},Uz:function(){return u},nV:function(){return c},u:function(){return o},u8:function(){return d}});var n=s(58357),a=s(44880);let r=n.CT;async function l(e,t){let s=new URLSearchParams;t&&s.set("userId",t);let n=await fetch("".concat(r,"/workshopSessions/active/").concat(encodeURIComponent(e),"?").concat(s.toString()));if(!n.ok)throw Error("Failed to load attendance session");return n.json()}async function o(e,t,s){let n=(0,a.bW)(),l=await fetch("".concat(r,"/workshopSessions/check-in"),{method:"POST",headers:{"Content-Type":"application/json",...n?{Authorization:"Bearer ".concat(n)}:{}}
1,body:JSON.stringify({sessionId:e,userId:t,latitude:null==s?void 0:s.latitude,longitude:null==s?void 0:s.longitude})}),o=await l.json().catch(()=>({}));if(!l.ok)throw Error(o.message||"Failed to mark attendance");return o}async function i(e,t){let s=await fetch("".concat(r,"/workshopSessions/start"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workshopId:e,title:null==t?void 0:t.title,durationMinutes:null==t?void 0:t.durationMinutes,mobileOnly:null==t?void 0:t.mobileOnly,requireGeofence:null==t?void 0:t.requireGeofence,geofenceLat:null==t?void 0:t.geofenceLat,geofenceLng:null==t?void 0:t.geofenceLng,geofenceRadiusMeters:null==t?void 0:t.geofenceRadiusMeters})}),n=await s.json().catch(()=>({}));if(!s.ok)throw Error(n.message||"Failed to start session");return n}async function d(e){let t=await fetch("".concat(r,"/workshopSessions/").concat(encodeURIComponent(e),"/end"),{method:"POST"}),s=await t.json().catch(()=>({}));if(!t.ok)throw Error(s.message||"Failed to end session");return s}async function c(e){let t=await fetch("".concat(r,"/workshopSessions/workshop/").concat(encodeURIComponent(e),"/history"));if(!t.ok)throw Error("Failed to load session history");return t.json()}async function u(e){let t=await fetch("".concat(r,"/workshopSessions/").concat(encodeURIComponent(e),"/attendance"));if(!t.ok)throw Error("Failed to load attendance list");return t.json()}},35571:function(e,t,s){"use strict";function n(){let e=navigator.userAgent||"",t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile/i.test(e),s=window.matchMedia("(max-width: 768px)").matches,n=navigator.maxTouchPoints>1;return t||s&&n}function a(){return new Promise((e,t)=>{if(!navigator.geolocation){t(Error("Location is not supported on this device."));return}navigator.geolocation.getCurrentPosition(t=>{e({latitude:t.coords.latitude,longitude:t.coords.longitude})},e=>{e.code===e.PERMISSION_DENIED?t(Error("Please allow location access to mark attendance on campus.")):e.code===e.TIMEOUT?t(Error("Could not get your location in time. Try again near a window.")):t(Error("Could not get your location. Check GPS and try again."))},{enableHighAccuracy:!0,timeout:15e3,maximumAge:0})})}s.d(t,{A:function(){return a},s:function(){return n}})},4740:function(e,t,s){"use strict";s.d(t,{Fo:function(){return o},Ro:function(){return l}});var n=s(44785),a=s(96450);class r extends Error{constructor(e="Your session has expired. Please log in again."){super(e),this.name="SessionExpiredError"}}function l(e){if(401===e.status)throw!function(){let e=window.location.pathname+window.location.search;localStorage.setItem("redirectAfterLogin",e),localStorage.removeItem("token"),localStorage.removeItem("auth-token"),localStorage.removeItem("authToken"),localStorage.removeItem("accessToken"),n.Z.remove("auth-token");try{a.useAuthStore.getState().clearAuthData()}catch(e){}window.location.href="/login"}(),new r}function o(e){return e instanceof r}},73284:function(e,t,s){"use strict";function n(e){let t=String(e||"").trim().toLowerCase();return"python"===t?"python":"html"===t?"html":null}function a(e,t){let s=n(null==e?void 0:e.editor);if(s)return s;let a=n((null==t?void 0:t.editor)||(null==t?void 0:t.editorType)||(null==t?void 0:t.workshopEditorType));return a?a:n(null==e?void 0:e.editorType)||((null==e?void 0:e.workshopType)==="python"?"python":"html")}function r(e){return!!n(null==e?void 0:e.editor)}function l(e,t,s,n,a){let r=new URLSearchParams;t&&r.set("trainingId",t),s&&r.set("editorType",s),n&&r.set("uploadId",n),a&&r.set("new","1");let l=r.toString();return"/my-workshops/".concat(e,"/editor").concat(l?"?".concat(l):"")}s.d(t,{U4:function(){return r},kd:function(){return l},zd:function(){return a}})}},function(e){e.O(0,[231,4868,6575,5956,721,7126,7824,2971,7023,1744],function(){return e(e.s=45496)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.