PageSourceSearch

https://xterns.ai/assets/XternsDashboard-B61CJlUF.js

js xterns.ai collected 2026-10-05 13:24:01 UTC 108,486 bytes, 68 lines download raw bytes

1import{c as Ye,w as R,$ as _e,b1 as Es,r as b,f as V,s as v,u as Q,j as e,h as k,i as D,k as I,J as q,m as E,P as se,B as _,a4 as ue,e as cs,M as J,E as ds,X as Ls,A as H,T as he,l as Rs,Z as ms,t as $e,N as Ds,O as Is,Q as Ts,V as Os,Y as Ms,bq as qs,a0 as C,x as xs,R as us,S as Fe,g as K,C as hs,U as Z,a7 as $s,aL as Fs,aa as zs,ab as Gs,ac as Ys,F as Bs,d as Us,q as Vs,L as Ae,bs as Ks,aK as Hs,bt as Ws,bu as Qs,H as Ee}from"./index-DLd_kDlx.js";import{T as Be,a as Ue,b as te,c as Se}from"./tabs-DKw2ItQa.js";import{u as Js}from"./useXternPods-vMByMFnp.js";import{u as Xs}from"./useEIScore-C48npH32.js";import{u as Zs}from"./useLearningResources-UHJHnByl.js";import{u as et}from"./useMultiPodSprints-vPyFVg5i.js";import{u as st}from"./usePodRealtimeSync-Bju8NttL.js";import{X as tt}from"./XternTopbar-CTWW4Hoo.js";import{a as at,b as rt,c as nt}from"./AssessmentUI-DW2eB-aa.js";import{R as it}from"./rotate-ccw-Bx1C64Ur.js";import{C as oe}from"./circle-play-CGUr0fM_.js";import{E as lt}from"./eye-CRDofLPH.js";import{T as W}from"./triangle-alert-Chqk_WK7.js";import{C as ot}from"./circle-x-C4PFt3c3.js";import{f as ps,a as ct}from"./numberFormat-zOUS8IHU.js";import{A as gs}from"./index-Da4Am1jz.js";import{m as L}from"./proxy-D0Q57V63.js";import{T as Ve}from"./trophy-DBX-jNOC.js";import{T as fs}from"./trending-up-BU4cR3Ys.js";import{T as dt}from"./trending-down-BvA8vA3u.js";import{u as mt}from"./NotificationItem-Dc2WXW-y.js";import{f as js}from"./formatDistanceToNow-57P64IbE.js";import{u as Ke}from"./useMutation-CotV56Sa.js";import{T as ys}from"./textarea-C6X-I43k.js";import{S as He}from"./star-BH1OFEcs.js";import{L as ze}from"./loader-circle-D2miE2xB.js";import{C as bs}from"./chevron-right-CD1gvy-q.js";import{f as xt}from"./format-BTXglRCX.js";import{S as ut}from"./SignalScoreTiers-CimoV002.js";import{L as ht}from"./layers-xSe-BphI.js";import{u as pt,P as gt}from"./PodApplicationDialog-j01fAaDf.js";import{E as Le}from"./EmptyState-DNi4BV7D.js";import{L as ft}from"./lightbulb-BpXO0eKD.js";import{R as Re}from"./refresh-cw-CoPjtj5-.js";import{Z as Ns}from"./zap-Cs6U3-LC.js";import{C as jt}from"./ConnectGitHubButton-DLktnEM_.js";import{u as yt}from"./useGitHubIdentity-DDmb0Jwt.js";import{u as bt}from"./useXternProfile-C3z298Ah.js";import{A as De}from"./award-MEJfpupD.js";import{l as ee,A as de,h as ye,P as Nt,r as Ie,F as vt,H as be,I as wt,G as _t,E as Qe,a0 as St,D as Je,g as kt,O as Pt,R as Ct}from"./generateCategoricalChart-ByDL-d9M.js";import{w as At}from"./findIndex-Cos7Fxsp.js";import{b as Et,P as vs,a as ws}from"./PolarAngleAxis-Blx3t8Nb.js";import{A as Lt}from"./arrow-left-BXtn7MCa.js";import{S as Rt}from"./shield-alert-CVqPbwtZ.js";import{S as Dt}from"./send-DsBTdW9L.js";import{B as It}from"./badge-check-BG9dn4bq.js";import{r as Tt,g as Ot}from"./acceleratorApplicationForm-Df61pn3H.js";import{U as Mt}from"./users-round-DunEH6L6.js";import{B as Xe}from"./book-open-BSYsXyfC.js";import{E as qt}from"./external-link-D0CFvOTk.js";import{C as $t}from"./crown-hzm_bRIt.js";import"./index-lTaZyIGy.js";import"./index-Deh-4PO1.js";import"./usePodSprintsQuery-DeeP5xKS.js";import"./NotificationIcon-C1wwYnH5.js";import"./popover-BMD5FOmU.js";import"./scroll-area-BXTuUF24.js";import"./index-BdQq_4o_.js";import"./arrow-right-left-C4CM-5rU.js";import"./message-square-CtxeCfRz.js";import"./en-US-9SRVm7yB.js";import"./differenceInCalendarMonths-BA0TPVs2.js";import"./endOfDay-DkR3ZXc8.js";import"./endOfMonth-CYn6pTOm.js";import"./label-D4-ENrYn.js";import"./alert-CyfKy7ls.js";import"./radio-group-BU56MLP7.js";import"./tiny-invariant-CopsF_GD.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ft=Ye("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Ze=Ye("Medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const zt=Ye("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);var Gt=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function me(s){"@babel/helpers - typeof";return me=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},me(s)}function Yt(s,t){if(s==null)return{};var a=Bt(s,t),r,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(s,r)&&(a[r]=s[r])}return a}function Bt(s,t){if(s==null)return{};var a={};
vendor: 9,675 bytes, line 16
16for(var r in s)if(Object.prototype.hasOwnProperty.call(s,r)){if(t.indexOf(r)>=0)continue;a[r]=s[r]}return a}function U(){return U=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(s[r]=a[r])}return s},U.apply(this,arguments)}function es(s,t){var a=Object.keys(s);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(s);t&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(s,n).enumerable})),a.push.apply(a,r)}return a}function xe(s){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?es(Object(a),!0).forEach(function(r){Ut(s,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(a)):es(Object(a)).forEach(function(r){Object.defineProperty(s,r,Object.getOwnPropertyDescriptor(a,r))})}return s}function Ut(s,t,a){return t=Vt(t),t in s?Object.defineProperty(s,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):s[t]=a,s}function Vt(s){var t=Kt(s,"string");return me(t)=="symbol"?t:t+""}function Kt(s,t){if(me(s)!="object"||!s)return s;var a=s[Symbol.toPrimitive];if(a!==void 0){var r=a.call(s,t);if(me(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(s)}var Ht=function(t,a,r,n){var i="";return n.forEach(function(l,o){var d=de(a,r,t,l);o?i+="L ".concat(d.x,",").concat(d.y):i+="M ".concat(d.x,",").concat(d.y)}),i+="Z",i},Wt=function(t){var a=t.cx,r=t.cy,n=t.innerRadius,i=t.outerRadius,l=t.polarAngles,o=t.radialLines;if(!l||!l.length||!o)return null;var d=xe({stroke:"#ccc"},ee(t,!1));return R.createElement("g",{className:"recharts-polar-grid-angle"},l.map(function(m){var x=de(a,r,n,m),c=de(a,r,i,m);return R.createElement("line",U({},d,{key:"line-".concat(m),x1:x.x,y1:x.y,x2:c.x,y2:c.y}))}))},Qt=function(t){var a=t.cx,r=t.cy,n=t.radius,i=t.index,l=xe(xe({stroke:"#ccc"},ee(t,!1)),{},{fill:"none"});return R.createElement("circle",U({},l,{className:_e("recharts-polar-grid-concentric-circle",t.className),key:"circle-".concat(i),cx:a,cy:r,r:n}))},Jt=function(t){var a=t.radius,r=t.index,n=xe(xe({stroke:"#ccc"},ee(t,!1)),{},{fill:"none"});return R.createElement("path",U({},n,{className:_e("recharts-polar-grid-concentric-polygon",t.className),key:"path-".concat(r),d:Ht(a,t.cx,t.cy,t.polarAngles)}))},Xt=function(t){var a=t.polarRadius,r=t.gridType;return!a||!a.length?null:R.createElement("g",{className:"recharts-polar-grid-concentric"},a.map(function(n,i){var l=i;return r==="circle"?R.createElement(Qt,U({key:l},t,{radius:n,index:i})):R.createElement(Jt,U({key:l},t,{radius:n,index:i}))}))},_s=function(t){var a=t.cx,r=a===void 0?0:a,n=t.cy,i=n===void 0?0:n,l=t.innerRadius,o=l===void 0?0:l,d=t.outerRadius,m=d===void 0?0:d,x=t.gridType,c=x===void 0?"polygon":x,u=t.radialLines,p=u===void 0?!0:u,h=Yt(t,Gt);return m<=0?null:R.createElement("g",{className:"recharts-polar-grid"},R.createElement(Wt,U({cx:r,cy:i,innerRadius:o,outerRadius:m,gridType:c,radialLines:p},h)),R.createElement(Xt,U({cx:r,cy:i,innerRadius:o,outerRadius:m,gridType:c,radialLines:p},h)))};_s.displayName="PolarGrid";var Te,ss;function Zt(){if(ss)return Te;ss=1;function s(t){return t&&t.length?t[0]:void 0}return Te=s,Te}var Oe,ts;function ea(){return ts||(ts=1,Oe=Zt()),Oe}var sa=ea();const ta=Es(sa);var aa=["key"];function ae(s){"@babel/helpers - typeof";return ae=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ae(s)}function ra(s,t){if(s==null)return{};var a=na(s,t),r,n;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(s);for(n=0;n<i.length;n++)r=i[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(s,r)&&(a[r]=s[r])}return a}function na(s,t){if(s==null)return{};var a={};for(var r in s)if(Object.prototype.hasOwnProperty.call(s,r)){if(t.indexOf(r)>=0)continue;a[r]=s[r]}return a}function ke(){return ke=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var r in a)Object.prototype.hasOwnProperty.call(a,r)&&(s[r]=a[r])}return s},ke.apply(this,arguments)}function as(s,t){var a=Object.keys(s);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(s);t&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(s,n).enumerable})),a.push.apply(a,r)}return a}function M(s){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?as(Object(a),!0).forEach(function(r){B(s,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(a)):as(Object(a)).forEach(function(r){Object.defineProperty(s,r,Object.getOwnPropertyDescriptor(a,r))})}return s}function ia(s,t){if(!(s instanceof t))throw new TypeError("Cannot call a class as a function")}function rs(s,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(s,ks(r.key),r)}}function la(s,t,a){return t&&rs(s.prototype,t),a&&rs(s,a),Object.defineProperty(s,"prototype",{writable:!1}),s}function oa(s,t,a){return t=Pe(t),ca(s,Ss()?Reflect.construct(t,a||[],Pe(s).constructor):t.apply(s,a))}function ca(s,t){if(t&&(ae(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return da(s)}function da(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function Ss(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ss=function(){return!!s})()}function Pe(s){return Pe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},Pe(s)}function ma(s,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(t&&t.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),t&&Ge(s,t)}function Ge(s,t){return Ge=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ge(s,t)}function B(s,t,a){return t=ks(t),t in s?Object.defineProperty(s,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):s[t]=a,s}function ks(s){var t=xa(s,"string");return ae(t)=="symbol"?t:t+""}function xa(s,t){if(ae(s)!="object"||!s)return s;var a=s[Symbol.toPrimitive];if(a!==void 0){var r=a.call(s,t);if(ae(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}var pe=(function(s){function t(){var a;ia(this,t);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return a=oa(this,t,[].concat(n)),B(a,"state",{isAnimationFinished:!1}),B(a,"handleAnimationEnd",function(){var l=a.props.onAnimationEnd;a.setState({isAnimationFinished:!0}),ye(l)&&l()}),B(a,"handleAnimationStart",function(){var l=a.props.onAnimationStart;a.setState({isAnimationFinished:!1}),ye(l)&&l()}),B(a,"handleMouseEnter",function(l){var o=a.props.onMouseEnter;o&&o(a.props,l)}),B(a,"handleMouseLeave",function(l){var o=a.props.onMouseLeave;o&&o(a.props,l)}),a}return ma(t,s),la(t,[{key:"renderDots",value:function(r){var n=this.props,i=n.dot,l=n.dataKey,o=ee(this.props,!1),d=ee(i,!0),m=r.map(function(x,c){var u=M(M(M({key:"dot-".concat(c),r:3},o),d),{},{dataKey:l,cx:x.x,cy:x.y,index:c,payload:x});return t.renderDotItem(i,u)});return R.createElement(Ie,{className:"recharts-radar-dots"},m)}},{key:"renderPolygonStatically",value:function(r){var n=this.props,i=n.shape,l=n.dot,o=n.isRange,d=n.baseLinePoints,m=n.connectNulls,x;return R.isValidElement(i)?x=R.cloneElement(i,M(M({},this.props),{},{points:r})):ye(i)?x=i(M(M({},this.props),{},{points:r})):x=R.createElement(Et,ke({},ee(this.props,!0),{onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,points:r,baseLinePoints:o?d:null,connectNulls:m})),R.createElement(Ie,{className:"recharts-radar-polygon"},x,l?this.renderDots(r):null)}},{key:"renderPolygonWithAnimation",value:function(){var r=this,n=this.props,i=n.points,l=n.isAnimationActive,o=n.animationBegin,d=n.animationDuration,m=n.animationEasing,x=n.animationId,c=this.state.prevPoints;return R.createElement(vt,{begin:o,duration:d,isActive:l,easing:m,from:{t:0},to:{t:1},key:"radar-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(u){var p=u.t,h=c&&c.length/i.length,y=i.map(function(f,w){var g=c&&c[Math.floor(w*h)];if(g){var P=be(g.x,f.x),$=be(g.y,f.y);return M(M({},f),{},{x:P(p),y:$(p)})}var G=be(f.cx,f.x),T=be(f.cy,f.y);return M(M({},f),{},{x:G(p),y:T(p)})});return r.renderPolygonStatically(y)})}},{key:"renderPolygon",value:function(){var r=this.props,n=r.points,i=r.isAnimationActive,l=r.isRange,o=this.state.prevPoints;return i&&n&&n.length&&!l&&(!o||!At(o,n))?this.renderPolygonWithAnimation():this.renderPolygonStatically(n)}},{key:"render",value:function(){var r=this.props,n=r.hide,i=r.className,l=r.points,o=r.isAnimationActive;if(n||!l||!l.length)return null;var d=this.state.isAnimationFinished,m=_e("recharts-radar",i);return R.createElement(Ie,{className:m},this.renderPolygon(),(!o||d)&&wt.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,n){return r.animationId!==n.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:n.curPoints}:r.points!==n.curPoints?{curPoints:r.points}:null}},{key:"renderDotItem",value:function(r,n){var i;
16if(R.isValidElement(r))i=R.cloneElement(r,n);else if(ye(r))i=r(n);else{var l=n.key,o=ra(n,aa);i=R.createElement(Nt,ke({},o,{key:l,className:_e("recharts-radar-dot",typeof r!="boolean"?r.className:"")}))}return i}}])})(b.PureComponent);B(pe,"displayName","Radar");B(pe,"defaultProps",{angleAxisId:0,radiusAxisId:0,hide:!1,activeDot:!0,dot:!1,legendType:"rect",isAnimationActive:!_t.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});B(pe,"getComposedData",function(s){var t=s.radiusAxis,a=s.angleAxis,r=s.displayedData,n=s.dataKey,i=s.bandSize,l=a.cx,o=a.cy,d=!1,m=[],x=a.type!=="number"?i??0:0;r.forEach(function(u,p){var h=Qe(u,a.dataKey,p),y=Qe(u,n),f=a.scale(h)+x,w=Array.isArray(y)?St(y):y,g=Je(w)?void 0:t.scale(w);Array.isArray(y)&&y.length>=2&&(d=!0),m.push(M(M({},de(l,o,g,f)),{},{name:h,value:y,cx:l,cy:o,radius:g,angle:f,payload:u}))});var c=[];return d&&m.forEach(function(u){if(Array.isArray(u.value)){var p=ta(u.value),h=Je(p)?void 0:t.scale(p);c.push(M(M({},u),{},{radius:h},de(l,o,h,u.angle)))}else c.push(u)}),{points:m,isRange:d,baseLinePoints:c}});var ua=kt({chartName:"RadarChart",GraphicalChild:pe,axisComponents:[{axisType:"angleAxis",AxisComp:vs},{axisType:"radiusAxis",AxisComp:ws}],formatAxisMap:Pt,defaultProps:{layout:"centric",startAngle:90,endAngle:-270,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const Ps=()=>{const{user:s}=V(),[t,a]=b.useState(null),[r,n]=b.useState(!0),[i,l]=b.useState(null);b.useEffect(()=>{s!=null&&s.id&&o()},[s==null?void 0:s.id]);const o=async()=>{if(s!=null&&s.id){n(!0),l(null);try{console.log("🔍 Loading tech assessment status for user:",s.id);const{data:c,error:u}=await v.from("xtern_assessments").select("*").eq("user_id",s.id).eq("assessment_type","onboarding").order("created_at",{ascending:!1}).limit(1);if(u)throw u;console.log("📊 Assessment data:",c);const{data:p,error:h}=await v.from("xtern_tech_assessments").select("*").eq("user_id",s.id).eq("assessment_type","onboarding").order("created_at",{ascending:!1}).limit(1);if(h)throw h;console.log("🔧 Tech assessment data:",p);let y=null;if(p&&p.length>0){const{data:O}=await v.from("xtern_tech_assessment_attempts").select("*").eq("tech_assessment_id",p[0].id).order("created_at",{ascending:!1}).limit(1);y=O==null?void 0:O[0],console.log("🎯 Latest attempt data:",y)}let f="not_started",w=null,g=0,P=3,$=null,G=null,T=1;if(!c||c.length===0)f="not_started";else{const O=c[0],Y=p==null?void 0:p[0];Y&&(G=Y.id),y&&($=y.id),O.stage_1_completed?O.stage_2_completed?O.stage_3_completed?T=4:T=3:T=2:T=1,O.stage_1_completed&&O.stage_2_completed&&O.stage_3_completed?Y?(g=Y.current_attempt||0,P=Y.max_attempts||3,O.tech_assessment_passed?(f="passed",w=(y==null?void 0:y.score_percentage)||100):Y.status==="failed"||g>=P?(f="failed",w=(y==null?void 0:y.score_percentage)||0):(f="in_progress",w=y==null?void 0:y.score_percentage)):f="pending_tech_assessment":f="in_progress"}console.log("✅ Final status determination:",{status:f,lastScore:w,currentAttempt:g,maxAttempts:P,lastAttemptId:$,techAssessmentId:G,currentStage:T});const{status:re,...X}=(p==null?void 0:p[0])||{};a({status:f,lastScore:w,currentAttempt:g,maxAttempts:P,lastAttemptId:$,techAssessmentId:G,currentStage:T,...X})}catch(c){console.error("❌ Error loading tech assessment status:",c),l("Failed to load tech assessment status")}finally{n(!1)}}};return{techAssessmentStatus:t,isLoading:r,error:i,canCreateAssessment:async()=>{var c;if(!(s!=null&&s.id))return!1;try{const{data:u}=await v.rpc("get_user_lockdown_info",{p_user_id:s.id});return!((c=u==null?void 0:u[0])!=null&&c.is_locked)}catch(u){return console.error("Error checking assessment eligibility:",u),!1}},createTechAssessment:async(c="onboarding",u)=>{if(!(s!=null&&s.id))return null;try{let p=null;if(c==="skill_update"){const{data:f,error:w}=await v.from("xtern_assessments").insert({user_id:s.id,stage_1_completed:!0,stage_2_completed:!0,stage_3_completed:!0,assessment_completed:!1,tech_assessment_passed:!1}).select().single();if(w)throw w;p=f.id}else{const{data:f}=await v.from("xtern_assessments").select("id").eq("user_id",s.id).order("created_at",{ascending:!1}).limit(1).single();p=f==null?void 0:f.id}if(!p)throw new Error("No assessment found");const{data:h,error:y}=await v.from("xtern_tech_assessments").insert({user_id:s.id,assessment_id:p,assessment_type:c,selected_tech_stacks:u||[],status:"pending",current_attempt:0,max_attempts:c==="skill_update"?999:3}).select().single();if(y)throw y;return await o(),h}catch(p){throw console.error("Error creating tech assessment:",p),p}},updateTechAssessmentStatus:async(c,u,p)=>{try{const h={status:u};p!==void 0&&(h.passed=p);const{error:y}=await v.from("xtern_tech_assessments").update(h).eq("id",c);if(y)throw y;await o()}catch(h){throw console.error("Error updating tech assessment status:",h),h}},loadTechAssessmentStatus:o}},ha=()=>{const[s,t]=b.useState([]),[a,r]=b.useState(!0),[n,i]=b.useState(null),l=async()=>{try{r(!0),i(null);const{data:o,error:d}=await v.from("ei_leaderboard").select("user_id, best_score").order("best_score",{ascending:!1}).limit(5);if(d)throw d;if(o&&o.length>0){const m=o.map(u=>u.user_id),{data:x}=await v.from("public_profiles_v").select("id, full_name").in("id",m),c=(o==null?void 0:o.map((u,p)=>{const h=x==null?void 0:x.find(g=>g.id===u.user_id),y=(h==null?void 0:h.full_name)||"Unknown User",f=y.split(" "),w=f.length>1?`${f[0]} ${f[f.length-1].charAt(0)}.`:f[0];return{user_id:u.user_id,score:u.best_score,rank:p+1,full_name:y,display_name:w}}))||[];t(c)}else t([])}
16catch(o){console.error("Error fetching EI leaderboard:",o),i(o instanceof Error?o.message:"Failed to fetch leaderboard"),t([{user_id:"1",score:95.5,rank:1,full_name:"Alex Johnson",display_name:"Alex J."},{user_id:"2",score:92.3,rank:2,full_name:"Sarah Chen",display_name:"Sarah C."},{user_id:"3",score:88.7,rank:3,full_name:"Michael Brown",display_name:"Michael B."},{user_id:"4",score:85.2,rank:4,full_name:"Emma Davis",display_name:"Emma D."},{user_id:"5",score:82.9,rank:5,full_name:"James Wilson",display_name:"James W."}])}finally{r(!1)}};return b.useEffect(()=>{l()},[]),{leaderboard:s,isLoading:a,error:n,refetch:l}},pa=()=>{const{user:s}=V(),[t,a]=b.useState(!1);return{updateProgress:async(l,o)=>{if(!(s!=null&&s.id))return!1;try{a(!0);const d={user_id:s.id,resource_id:l,...o,completed_at:o.status==="completed"?new Date().toISOString():void 0},{error:m}=await v.from("learning_progress").upsert(d,{onConflict:"user_id,resource_id"});if(m)throw m;return!0}catch(d){return console.error("Error updating progress:",d),!1}finally{a(!1)}},getProgress:async l=>{if(!(s!=null&&s.id))return null;try{const{data:o,error:d}=await v.from("learning_progress").select("*").eq("user_id",s.id).eq("resource_id",l).maybeSingle();if(d)throw d;return o?{...o,status:o.status}:null}catch(o){return console.error("Error fetching progress:",o),null}},getUserProgress:async()=>{if(!(s!=null&&s.id))return[];try{const{data:l,error:o}=await v.from("learning_progress").select("*").eq("user_id",s.id).order("updated_at",{ascending:!1});if(o)throw o;return(l||[]).map(d=>({...d,status:d.status}))}catch(l){return console.error("Error fetching user progress:",l),[]}},isUpdating:t}},ga=()=>{const{resources:s,isLoading:t}=Zs(),{getUserProgress:a}=pa(),[r,n]=b.useState([]),[i,l]=b.useState(!0),o=async()=>{try{l(!0);const d=await a(),m=new Map(d.map(c=>[c.resource_id,{status:c.status,progress:c.progress_percentage}])),x=s.map(c=>{const u=m.get(c.id);return{id:c.id,title:c.title,resource_type:c.resource_type,url:c.url,provider:c.provider,duration:c.duration,progress_percentage:(u==null?void 0:u.progress)||0,status:(u==null?void 0:u.status)||"not_started"}}).filter(c=>c.status==="in_progress"||c.status==="not_started").slice(0,3);n(x)}catch(d){console.error("Error fetching pending learning resources:",d),n([])}finally{l(!1)}};return b.useEffect(()=>{!t&&s.length>0?o():t||l(!1)},[s,t]),{pendingResources:r,isLoading:i||t,refetch:o}},fa=()=>{const{techAssessmentStatus:s,isLoading:t}=Ps(),a=Q();console.log("🎯 TechAssessmentCard status:",s==null?void 0:s.status),console.log("🎯 TechAssessmentCard full object:",s);const r=()=>{if(!s)return"bg-gray-500";switch(s.status){case"passed":return"bg-green-500";case"failed":return"bg-red-500";case"in_progress":return"bg-blue-500";case"pending_tech_assessment":return"bg-yellow-500";case"cooldown":return"bg-orange-500";case"not_started":return"bg-gray-500";default:return"bg-gray-500"}},n=()=>{if(!s)return"Not Started";switch(s.status){case"passed":return"Passed";case"failed":return"Failed";case"in_progress":return"In Progress";case"pending_tech_assessment":return"Pending Quiz";case"cooldown":return"Cooldown Period";case"not_started":return"Not Started";default:return"Unknown"}},i=()=>
16{if(!s)return e.jsx(oe,{className:"w-5 h-5 text-gray-500"});switch(s.status){case"passed":return e.jsx(cs,{className:"w-5 h-5 text-green-500"});case"failed":return e.jsx(ot,{className:"w-5 h-5 text-red-500"});case"in_progress":return e.jsx(ue,{className:"w-5 h-5 text-blue-500"});case"pending_tech_assessment":return e.jsx(W,{className:"w-5 h-5 text-yellow-500"});case"cooldown":return e.jsx(W,{className:"w-5 h-5 text-orange-500"});case"not_started":return e.jsx(oe,{className:"w-5 h-5 text-gray-500"});default:return e.jsx(oe,{className:"w-5 h-5 text-gray-500"})}},l=()=>{!s||s.status==="not_started"?a("/assessment"):s.status==="in_progress"?s.currentStage<=3?a(`/assessment/stage-${s.currentStage}`):a("/xtern/assessment-confirmation"):s.status==="pending_tech_assessment"?a("/xtern/assessment-confirmation"):s.status==="passed"&&s.lastAttemptId?a(`/xtern/assessment-results/${s.lastAttemptId}`):s.status==="failed"&&s.currentAttempt<s.maxAttempts?a(`/xtern/assessment-confirmation?retake=${s.techAssessmentId}`):s.lastAttemptId&&a(`/xtern/assessment-results/${s.lastAttemptId}`)},o=()=>s?s.status==="not_started"||s.status==="in_progress"||s.status==="pending_tech_assessment"||s.status==="passed"&&s.lastAttemptId||s.status==="failed"&&s.currentAttempt<s.maxAttempts||s.lastAttemptId:!0,d=()=>!s||s.status==="not_started"?"Start Assessment":s.status==="in_progress"?"Continue Assessment":s.status==="pending_tech_assessment"?"Take Tech Quiz":s.status==="passed"?"View Results":s.status==="failed"&&s.currentAttempt<s.maxAttempts?"Retake Assessment":"View Results",m=()=>s!=null&&s.nextRetakeDate?new Date(s.nextRetakeDate).toLocaleDateString():null;return t?null:e.jsxs(k,{className:`${at} overflow-hidden transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg`,children:[e.jsx(D,{className:"p-6 pb-3",children:e.jsxs(I,{className:"flex flex-col gap-3 text-lg sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:rt,children:i()}),"Tech Stack Assessment"]}),e.jsx(q,{variant:(s==null?void 0:s.status)==="passed"?"default":"secondary",className:`${r()} w-fit rounded-full px-3 text-white`,children:n()})]})}),e.jsxs(E,{className:"space-y-4 px-6 pb-6",children:[(!s||s.status==="not_started")&&e.jsx("p",{className:"text-muted-foreground",children:"Complete your tech stack assessment to unlock full platform access."}),(s==null?void 0:s.status)==="in_progress"&&e.jsx("p",{className:"text-muted-foreground",children:s.currentStage<=3?`Continue from Stage ${s.currentStage} to complete your assessment.`:"Complete your technical quiz to finish the assessment process."}),(s==null?void 0:s.status)==="pending_tech_assessment"&&e.jsx("p",{className:"text-muted-foreground",children:"Complete your technical quiz to finish the assessment process."}),(s==null?void 0:s.status)==="passed"&&s.lastScore&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-muted-foreground",children:"Congratulations! You've passed your tech assessment."}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:"text-sm",children:"Your Score"}),e.jsxs("span",{className:"text-sm font-medium",children:[s.lastScore.toFixed(1),"%"]})]}),e.jsx(se,{value:s.lastScore,className:"h-2"})]})]}),(s==null?void 0:s.status)==="failed"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-muted-foreground",children:"Assessment not passed. You can retake it to improve your score."}),s.lastScore&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between mb-1",children:[e.jsx("span",{className:"text-sm",children:"Last Score"}),e.jsxs("span",{className:"text-sm font-medium",children:[s.lastScore.toFixed(1),"%"]})]}),e.jsx(se,{value:s.lastScore,className:"h-2"})]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{children:"Attempts"}),e.jsxs("span",{children:[s.currentAttempt,"/",s.maxAttempts]})]})]}),(s==null?void 0:s.status)==="cooldown"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-muted-foreground",children:["You're in a cooldown period. Next attempt available on ",m(),"."]}),e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{children:"Attempts Used"}),e.jsxs("span",{children:[s.currentAttempt,"/",s.maxAttempts]})]})]}),o()&&e.jsxs(_,{onClick:l,className:`${nt} w-full`,disabled:(s==null?void 0:s.status)==="cooldown",children:[(s==null?void 0:s.status)==="failed"&&s.currentAttempt<s.maxAttempts?e.jsx(it,{className:"w-4 h-4 mr-2"}):(s==null?void 0:s.status)==="in_progress"?e.jsx(oe,{className:"w-4 h-4 mr-2"}):(s==null?void 0:s.status)==="passed"?e.jsx(lt,{className:"w-4 h-4 mr-2"}):e.jsx(oe,{className:"w-4 h-4 mr-2"}),d()]})]})]})},ja=()=>J({queryKey:["upcoming-events"],queryFn:async()=>{const{data:s,error:t}=await v.from("meeting_occurrences").select(`
17          id,
18          start_at,
19          end_at,
20          location,
21          meeting_link,
22          meeting_series!inner(
23            title,
24            description,
25            session_type,
26            pod_id,
27            pods(
28              pod_name
29            )
30          )
31        `).gte("start_at",new Date().toISOString()).order("start_at",{ascending:!0}).limit(5);if(t)throw t;return(s==null?void 0:s.map(a=>{var r;
31return{id:a.id,title:a.meeting_series.title,description:a.meeting_series.description,start_at:a.start_at,end_at:a.end_at,location:a.location,meeting_link:a.meeting_link,session_type:a.meeting_series.session_type,pod_name:(r=a.meeting_series.pods)==null?void 0:r.pod_name}}))||[]}}),ya=({isOpen:s,onClose:t,scoreIncrease:a,newScore:r,previousScore:n,notificationThreshold:i,milestoneReached:l})=>{const[o,d]=b.useState(!1);return b.useEffect(()=>{if(s){d(!0);const m=setTimeout(()=>d(!1),3e3);return()=>clearTimeout(m)}},[s]),e.jsx(gs,{children:s&&e.jsx(L.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:t,children:e.jsx(L.div,{initial:{scale:.5,rotateY:-90},animate:{scale:1,rotateY:0},exit:{scale:.5,rotateY:90},transition:{type:"spring",damping:15},onClick:m=>m.stopPropagation(),className:"relative",children:e.jsxs(k,{className:"p-8 text-center max-w-md mx-auto bg-gradient-to-br from-primary/10 to-secondary/10 border-primary/20",children:[o&&e.jsx("div",{className:"absolute inset-0 pointer-events-none overflow-hidden rounded-lg",children:[...Array(20)].map((m,x)=>e.jsx(L.div,{className:"absolute w-2 h-2 bg-primary rounded-full",initial:{x:Math.random()*400,y:-10,rotate:0,scale:0},animate:{y:400,rotate:360,scale:[0,1,0]},transition:{duration:3,delay:Math.random()*.5,ease:"easeOut"}},x))}),e.jsx(L.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.2,type:"spring",damping:10},className:"inline-flex items-center justify-center w-16 h-16 bg-primary/20 rounded-full text-primary mb-4",children:e.jsx(Ve,{className:"h-8 w-8"})}),e.jsx(L.h2,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},className:"text-2xl font-bold text-foreground mb-2",children:ba(i,l)}),i==="milestone"&&l&&e.jsx(L.p,{initial:{opacity:0}
31,animate:{opacity:1},transition:{delay:.4},className:"text-sm text-muted-foreground mb-4",children:Na(l)}),e.jsxs(L.div,{initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{delay:.4,type:"spring"},className:"mb-4",children:[e.jsxs("div",{className:"text-3xl font-bold text-primary mb-1",children:["+",Math.round(a)]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Signal Score Increase"})]}),e.jsxs(L.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.5},className:"bg-muted rounded-full p-1 mb-6",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm font-medium px-2",children:[e.jsx("span",{children:Math.round(n)}),e.jsx(fs,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-primary font-bold",children:Math.round(r)})]}),e.jsx(L.div,{className:"h-2 bg-gradient-to-r from-muted-foreground to-primary rounded-full mt-2",initial:{width:0},animate:{width:"100%"},transition:{delay:.6,duration:1}})]}),e.jsx(L.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.7},children:e.jsx(_,{onClick:t,className:"w-full",size:"lg",children:"Awesome! 🎉"})})]})})})})};function ba(s,t){return s==="milestone"&&t?t===1e3?"Perfect Score! 🎯":t>=800?"Excellence Achieved! 👑":t>=600?"Expert Level! 💪":t>=400?"Rising Star! 🔥":t>=200?"Building Momentum! 🚀":"Strong Start! 🌟":s==="first_score"?"Welcome Aboard! 🎉":"Signal Score Increased!"}function Na(s){return{100:"You've crossed your first 100 points - Great beginning!",200:"200 points achieved - Your momentum is building!",300:"300 points reached - You're making real progress!",400:"400 points milestone - Your dedication is showing!",500:"Halfway there! 500 points - You're crushing it!",600:"600 points reached - You're at expert level!",700:"700 points milestone - Elite performance!",800:"800 points achieved - Almost at perfection!",900:"900 points reached - Final stretch!",1e3:"Perfect 1000 points - You've mastered the Signal Score!"}[s]||`${s} points milestone reached!`}const va=({isOpen:s,onClose:t,scoreDecrease:a,newScore:r,previousScore:n,userId:i,scoreBreakdown:l,previousBreakdown:o})=>{const[d,m]=b.useState([]),[x,c]=b.useState(!0),{toast:u}=ds(),p=Q();b.useEffect(()=>{s&&i&&h()},[s,i]);const h=async()=>{c(!0);try{const{data:g,error:P}=await v.functions.invoke("generate-score-recommendations",{body:{userId:i,scoreDelta:a,previousScore:n,newScore:r,scoreBreakdown:l,previousBreakdown:o}});if(P)throw P;m(g.recommendations||[])}catch(g){console.error("Error fetching recommendations:",g),u({title:"Could not load recommendations",description:"Please try again later",variant:"destructive"})}finally{c(!1)}},y=g=>{switch(g){case"technical":return"bg-blue-500/10 text-blue-600 border-blue-500/20";case"engagement":return"bg-green-500/10 text-green-600 border-green-500/20";case"collaboration":return"bg-purple-500/10 text-purple-600 border-purple-500/20";default:return"bg-muted text-muted-foreground"}},f=g=>g==="high"?"🎯":g==="medium"?"⭐":"💡",w=g=>{g&&(p(g),t())};return e.jsx(gs,{children:s&&e.jsx(L.div,{initial:{opacity:0}
31,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:t,children:e.jsx(L.div,{initial:{scale:.9,y:20},animate:{scale:1,y:0},exit:{scale:.9,y:20},transition:{type:"spring",damping:20},onClick:g=>g.stopPropagation(),className:"relative w-full max-w-2xl",children:e.jsxs(k,{className:"p-6 bg-gradient-to-br from-orange-500/5 to-red-500/5 border-orange-200/20",children:[e.jsx("button",{onClick:t,className:"absolute top-4 right-4 p-2 hover:bg-muted rounded-full transition-colors",children:e.jsx(Ls,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[e.jsx(L.div,{initial:{scale:0},animate:{scale:1},transition:{delay:.2,type:"spring",damping:10},className:"flex-shrink-0 w-12 h-12 bg-orange-500/20 rounded-full flex items-center justify-center",children:e.jsx(dt,{className:"h-6 w-6 text-orange-600"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground mb-1",children:"Score Decreased"}),e.jsxs("p",{className:"text-muted-foreground",children:["Your Signal Score dropped by ",e.jsx("span",{className:"font-semibold text-orange-600",children:Math.abs(Math.round(a*10)/10)})," points"]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:Math.round(n)}),e.jsx(H,{className:"h-3 w-3"}),e.jsx("span",{className:"font-semibold text-foreground",children:Math.round(r)})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"h-5 w-5 text-primary"}),e.jsx("h3",{className:"font-semibold text-foreground",children:"Personalized Recommendations"})]}),x?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(g=>e.jsx("div",{className:"h-20 bg-muted/50 rounded-lg animate-pulse"},g))}):d.length>0?e.jsx("div",{className:"space-y-3 max-h-[400px] overflow-y-auto pr-2",children:d.map((g,P)=>e.jsx(L.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},transition:{delay:.3+P*.1},children:e.jsx(k,{className:"p-4 bg-background/50 hover:bg-background/80 transition-colors border-border/50",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-2xl flex-shrink-0",children:f(g.impact)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[e.jsx("h4",{className:"font-semibold text-foreground",children:g.title}),e.jsx(q,{className:`${y(g.category)} flex-shrink-0 text-xs`,children:g.category})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:g.description}),g.actionUrl&&e.jsxs(_,{variant:"ghost",size:"sm",className:"h-8 text-xs",onClick:()=>w(g.actionUrl),children:["Take Action",e.jsx(H,{className:"h-3 w-3 ml-1"})]})]})]})})},P))}):e.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[e.jsx(W,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No recommendations available at this time"})]})]}),e.jsx(L.div,{initial:{opacity:0}
31,animate:{opacity:1},transition:{delay:.6},className:"mt-6",children:e.jsx(_,{onClick:t,className:"w-full",variant:"default",children:"Got it, let's improve! 💪"})})]})})})})},wa=()=>{const[s,t]=b.useState(null),[a,r]=b.useState(!1),[n,i]=b.useState(null),{notifications:l,markAsRead:o}=mt();return b.useEffect(()=>{const x=l.find(c=>{var u;return!c.read_at&&((u=c.metadata)==null?void 0:u.notification_threshold)&&(c.title.includes("reached")||c.title.includes("increased")||c.title.includes("decreased")||c.title.includes("earned"))});if(x!=null&&x.metadata){const c=x.metadata,u=c.delta,p=c.new_score,h=c.previous_score,y=c.notification_threshold,f=c.milestone_reached;i(x.id),t({scoreIncrease:u,newScore:p,previousScore:h,notificationThreshold:y,milestoneReached:f,isDecrease:u<0,userId:x.user_id,scoreBreakdown:c.score_breakdown,previousBreakdown:c.previous_breakdown}),r(!0)}},[l]),{isOpen:a,celebrationData:s,closeCelebration:()=>{r(!1),t(null),n&&(o(n),i(null))},triggerCelebration:x=>{t(x),r(!0)}}};function _a(){const{user:s}=V(),t=Q(),{data:a,isLoading:r}=J({queryKey:["pending-sprint-assessments",s==null?void 0:s.id],queryFn:async()=>{if(!(s!=null&&s.id))return[];const{data:l,error:o}=await v.from("sprint_technical_assessments").select(`
32          *,
33          sprints (
34            sprint_number
35          ),
36          pods (
37            pod_name
38          )
39        `).eq("user_id",s.id).eq("status","pending").gt("expires_at",new Date().toISOString()).order("expires_at",{ascending:!0});return o?(console.error("Error fetching pending assessments:",o),[]):(l||[]).map(d=>{var m,x;return{id:d.id,sprint_id:d.sprint_id,pod_id:d.pod_id,expires_at:d.expires_at,sprint_number:((m=d.sprints)==null?void 0:m.sprint_number)||0,pod_name:((x=d.pods)==null?void 0:x.pod_name)||"Unknown Pod"}})},enabled:!!(s!=null&&s.id),refetchInterval:3e5});if(r||!a||a.length===0)return null;const n=l=>{const o=new Date,d=new Date(l);return Math.ceil((d.getTime()-o.getTime())/(1e3*60*60*24))},i=l=>l<=2?"high":l<=4?"medium":"low";return e.jsxs(k,{className:"border-orange-200 bg-gradient-to-br from-orange-50 to-amber-50",children:[e.jsxs(D,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{className:"h-5 w-5 text-orange-600"}),e.jsx(I,{children:"Pending Sprint Assessments"})]}),e.jsx(Rs,{children:"Complete your sprint assessments to earn EI Score points"})]}),e.jsxs(E,{className:"space-y-4",children:[a.map(l=>{const o=n(l.expires_at),d=i(o);return e.jsx("div",{className:"p-4 bg-white rounded-lg border border-orange-200 shadow-sm hover:shadow-md transition-shadow",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("h4",{className:"font-semibold text-gray-900",children:[l.pod_name," - Sprint ",l.sprint_number]}),d==="high"&&e.jsx(q,{variant:"destructive",className:"text-xs",children:"Urgent"})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(he,{className:"h-4 w-4"}),e.jsx("span",{children:"5 Questions • Up to 5 Points"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ue,{className:"h-4 w-4"}),e.jsx("span",{children:"3 Minutes"})]})]}),e.jsxs("p",{className:`text-sm font-medium ${d==="high"?"text-red-600":d==="medium"?"text-orange-600":"text-gray-600"}`,children:["Expires ",js(new Date(l.expires_at),{addSuffix:!0})]})]}),e.jsx(_,{onClick:()=>t(`/xterns/sprint-assessment/${l.id}`),className:"bg-orange-600 hover:bg-orange-700",children:"Start Assessment"})]})},l.id)}),e.jsxs("div",{className:"p-3 bg-blue-50 rounded-lg text-sm text-blue-800 border border-blue-200",children:[e.jsx("p",{className:"font-medium mb-1",children:"💡 Why Sprint Assessments Matter"}),e.jsx("p",{children:"Each correct answer earns you 1 point toward your Technical Skills score (max 5 points per sprint). These points contribute to your overall EI Score!"})]})]})]})}const Sa=()=>{const{user:s}=V(),{toast:t}=ds(),a=ms(),{data:r=[],isLoading:n}=J({queryKey:["pending-tech-lead-ratings",s==null?void 0:s.id],queryFn:async()=>
39{if(!(s!=null&&s.id))return[];const{data:o,error:d}=await v.from("pod_members").select(`
40          pod_id,
41          joined_at,
42          pods!inner (
43            id,
44            pod_name,
45            tech_lead_id,
46            tech_leads!inner (
47              id,
48              full_name
49            )
50          )
51        `).eq("user_id",s.id).eq("status","active");if(d||!(o!=null&&o.length))return[];const m=o.map(f=>f.pod_id),{data:x,error:c}=await v.from("sprints").select("id, name, sprint_number, pod_id, updated_at").in("pod_id",m).eq("status","completed").order("updated_at",{ascending:!1});if(c||!(x!=null&&x.length))return[];const{data:u,error:p}=await v.from("tech_lead_ratings").select("sprint_id").eq("xtern_user_id",s.id),h=new Set((u==null?void 0:u.map(f=>f.sprint_id))||[]);return x.filter(f=>{if(h.has(f.id))return!1;const w=o.find($=>$.pod_id===f.pod_id);if(!(w!=null&&w.joined_at))return!0;const g=new Date(w.joined_at);return new Date(f.updated_at)>=g}).map(f=>{const w=o.find($=>$.pod_id===f.pod_id),g=w==null?void 0:w.pods,P=g==null?void 0:g.tech_leads;return{sprintId:f.id,sprintName:f.name,sprintNumber:f.sprint_number,podId:f.pod_id,podName:(g==null?void 0:g.pod_name)||"Unknown Pod",techLeadId:(P==null?void 0:P.id)||"",techLeadName:(P==null?void 0:P.full_name)||"Tech Lead",completedAt:f.updated_at}})},enabled:!!(s!=null&&s.id)}),i=Ke({mutationFn:async({sprintId:o,techLeadId:d,podId:m,rating:x,feedback:c})=>{if(!(s!=null&&s.id))throw new Error("User not authenticated");const{error:u}=await v.from("tech_lead_ratings").insert({sprint_id:o,xtern_user_id:s.id,tech_lead_id:d,pod_id:m,rating:x,feedback:(c==null?void 0:c.trim())||null});if(u)throw u},onSuccess:()=>{t({title:"Rating submitted",description:"Thank you for your feedback!"}),a.invalidateQueries({queryKey:["pending-tech-lead-ratings"]})},onError:o=>{var d;console.error("Error submitting rating:",o),t({title:"Error",description:(d=o.message)!=null&&d.includes("unique")?"You have already rated this sprint":"Failed to submit rating",variant:"destructive"})}}),l=b.useCallback(o=>i.mutateAsync(o),[i]);return{pendingRatings:r,isLoadingPending:n,submitRating:l,isSubmitting:i.isPending}},ka=({value:s,onChange:t,size:a="md",disabled:r=!1})=>{const[n,i]=b.useState(0),l={sm:"h-5 w-5",md:"h-8 w-8",lg:"h-10 w-10"},o=c=>{r||t(c)},d=c=>{r||i(c)},m=()=>{i(0)},x=n||s;return e.jsx("div",{className:"flex items-center gap-1",onMouseLeave:m,children:[1,2,3,4,5].map(c=>e.jsx("button",{type:"button",onClick:()=>o(c),onMouseEnter:()=>d(c),disabled:r,className:$e("transition-all duration-150 focus:outline-none focus-visible:ring-2 focus-visible:ring-primary rounded",r?"cursor-not-allowed opacity-50":"cursor-pointer hover:scale-110"),"aria-label":`Rate ${c} star${c>1?"s":""}`,children:e.jsx(He,{className:$e(l[a],"transition-colors duration-150",c<=x?"fill-yellow-400 text-yellow-400":"fill-transparent text-muted-foreground/40")})},c))})},Pa=({open:s,onOpenChange:t,sprintName:a,sprintNumber:r,techLeadName:n,onSubmit:i,isSubmitting:l=!1})=>{const[o,d]=b.useState(0),[m,x]=b.useState(""),c=async()=>{o!==0&&(await i(o,m.trim()||void 0),d(0),x(""))},u=h=>{!h&&!l&&(t(!1),d(0),x(""))},p=h=>({1:"Poor",2:"Fair",3:"Good",4:"Very Good",5:"Excellent"})[h]||"";return e.jsx(Ds,{open:s,onOpenChange:u,children:e.jsxs(Is,{className:"sm:max-w-md",children:[e.jsxs(Ts,{children:[e.jsx(Os,{children:"Rate Your Tech Lead"}),e.jsxs(Ms,{children:["How was your experience with ",e.jsx("span",{className:"font-medium text-foreground",children:n})," during"," ",e.jsxs("span",{className:"font-medium text-foreground",children:["Sprint ",r]}),"?"]})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx(ka,{value:o,onChange:d,size:"lg",disabled:l}),o>0&&e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:p(o)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{htmlFor:"feedback",className:"text-sm font-medium text-muted-foreground",children:"Additional feedback (optional)"}),e.jsx(ys,{id:"feedback",value:m,onChange:h=>x(h.target.value.slice(0,500)),placeholder:"Share your thoughts on support, communication, and effectiveness...",className:"resize-none",rows:4,disabled:l}),e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[m.length,"/500"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Your rating is anonymous and cannot be edited once submitted."})]}),e.jsxs(qs,{className:"flex-col sm:flex-row gap-2",children:[e.jsx(_,{variant:"ghost",onClick:()=>u(!1),disabled:l,className:"sm:order-1",children:"Skip for now"}),e.jsx(_,{onClick:c,disabled:o===0||l,className:"sm:order-2",children:l?e.jsxs(e.Fragment,{children:[e.jsx(ze,{className:"mr-2 h-4 w-4 animate-spin"}),"Submitting..."]}):"Submit Rating"})]})]})})},Ca=()=>{const{pendingRatings:s,isLoadingPending:t,submitRating:a,isSubmitting:r}=Sa(),[n,i]=b.useState(null);if(t||s.length===0)return null;const l=async(o,d)=>{n&&(await a({sprintId:n.sprintId,techLeadId:n.techLeadId,podId:n.podId,rating:o,feedback:d}),i(null))};return e.jsxs(e.Fragment,{children:[e.jsxs(k,{className:"border-amber-200 bg-gradient-to-br from-amber-50 to-orange-50 dark:from-amber-950/20 dark:to-orange-950/20 dark:border-amber-800",children:[e.jsx(D,{className:"pb-3",children:e.jsxs(I,{className:"flex items-center gap-2 text-amber-800 dark:text-amber-200",children:[e.jsx(He,{className:"h-5 w-5 fill-amber-500 text-amber-500"}),"Rate Your Tech Lead"]})}),e.jsxs(E,{className:"space-y-3",children:[e.jsxs("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:["You have ",s.length," sprint",s.length>
511?"s":""," to rate. Your feedback helps improve the experience!"]}),e.jsx("div",{className:"space-y-2",children:s.map(o=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-white/60 dark:bg-background/40 rounded-lg",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("p",{className:"font-medium text-sm truncate",children:["Sprint ",o.sprintNumber,": ",o.sprintName]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[o.podName," • Completed ",xt(new Date(o.completedAt),"MMM d")]})]}),e.jsxs(_,{size:"sm",variant:"ghost",className:"shrink-0 text-amber-700 hover:text-amber-800 hover:bg-amber-100 dark:text-amber-300 dark:hover:bg-amber-900/30",onClick:()=>i(o),children:["Rate Now",e.jsx(bs,{className:"ml-1 h-4 w-4"})]})]},o.sprintId))})]})]}),n&&e.jsx(Pa,{open:!!n,onOpenChange:o=>!o&&i(null),sprintName:n.sprintName,sprintNumber:n.sprintNumber,techLeadName:n.techLeadName,onSubmit:l,isSubmitting:r})]})},Aa=(s,t)=>b.useMemo(()=>{const a={};return s.forEach(r=>{var i,l,o,d;const n=t.find(m=>m.pod_id===r.id&&m.status==="active");if(n){const m=(((i=n.stories)==null?void 0:i.length)||0)+(((l=n.tasks)==null?void 0:l.length)||0);if(m>0){const x=((o=n.stories)==null?void 0:o.filter(p=>p.status==="done").length)||0,c=((d=n.tasks)==null?void 0:d.filter(p=>p.status==="done").length)||0,u=x+c;a[r.id]={progress:Math.round(u/m*100),activeSprint:n}}else a[r.id]={progress:0,activeSprint:n}}else{const m=t.filter(c=>c.pod_id===r.id),x=m.reduce((c,u)=>{var p,h;return c+(((p=u.stories)==null?void 0:p.length)||0)+(((h=u.tasks)==null?void 0:h.length)||0)},0);if(x>0){const c=m.reduce((u,p)=>{var f,w;const h=((f=p.stories)==null?void 0:f.filter(g=>g.status==="done").length)||0,y=((w=p.tasks)==null?void 0:w.filter(g=>g.status==="done").length)||0;return u+h+y},0);a[r.id]={progress:Math.round(c/x*100),activeSprint:null}}else a[r.id]={progress:0,activeSprint:null}}}),a},[s,t]),Ea={blue:"before:bg-xterns-blue",teal:"before:bg-xterns-teal",gold:"before:bg-xterns-gold",none:""};function La({icon:s,title:t,trailing:a,children:r,className:n,index:i=0,accent:l="none"}){return e.jsxs(L.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.35,delay:i*.06,ease:"easeOut"},className:$e("relative overflow-hidden rounded-2xl border border-gray-200 bg-white p-5 shadow-[0_1px_2px_rgba(17,24,39,0.04)]","transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_12px_24px_rgba(17,24,39,0.08)]",l!=="none"&&`before:absolute before:left-0 before:top-0 before:h-full before:w-[3px] ${Ea[l]}`,n),children:[(s||t||a)&&e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s&&e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-xterns-blue/10 text-xterns-blue",children:s}),t&&e.jsx("h3",{className:"truncate text-base font-semibold text-gray-900",children:t})]}),a]}),r]})}const Me=600,Ra=25,Da=s=>{const{user:t}=V(),[a,r]=b.useState({completedPods:0,activePods:0,estimatedRemainingPods:0,isLoading:!0});return b.useEffect(()=>{if(!(t!=null&&t.id))return;(async()=>{try{const{data:i,error:l}=await v.from("pod_members").select("id, pods!inner(status)").eq("user_id",t.id).eq("pods.status","completed"),{data:o,error:d}=await v.from("pod_members").select("id, pods!inner(status)").eq("user_id",t.id).eq("pods.status","active");l&&console.error("Error fetching completed pods:",l),d&&console.error("Error fetching active pods:",d);const m=(i==null?void 0:i.length)??0,x=(o==null?void 0:o.length)??0;let c=0;if(s>0&&s<Me){const u=Me-s,p=m>0?s/m:Ra;c=Math.ceil(u/Math.max(p,1))}r({completedPods:m,activePods:x,estimatedRemainingPods:c,isLoading:!1})}catch(i){console.error("Error in useDareyScoreProgress:",i),r(l=>({...l,isLoading:!1}))}})()},[t==null?void 0:t.id,s]),{...a,targetScore:Me}};function Ia(){return e.jsxs("div",{role:"status","aria-busy":"true","aria-label":"Loading goal tracker",className:"relative overflow-hidden rounded-2xl border border-gray-200 bg-white p-6 shadow-[0_1px_2px_rgba(17,24,39,0.04)]",children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(C,{className:"h-9 w-9 rounded-xl"}),e.jsx(C,{className:"h-5 w-64"})]}),e.jsx(C,{className:"h-8 w-24 rounded-lg"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(C,{className:"h-3 w-32"}),e.jsx(C,{className:"h-3 w-12"})]}),e.jsx(C,{className:"h-3 w-full rounded-full"})]}),e.jsxs("div",{className:"mt-5 grid grid-cols-3 gap-3",children:[e.jsx(C,{className:"h-14 roun
51ded-xl"}),e.jsx(C,{className:"h-14 rounded-xl"}),e.jsx(C,{className:"h-14 rounded-xl"})]}),e.jsx(C,{className:"mt-4 h-12 w-full rounded-xl"}),e.jsx("span",{className:"sr-only",children:"Loading"})]})}function Ta({currentScore:s}){const t=Q(),{completedPods:a,estimatedRemainingPods:r,targetScore:n,isLoading:i}=Da(s);if(i)return e.jsx(Ia,{});const l=Math.min(s/n*100,100),o=s>=n,d=Math.max(0,n-s);return e.jsxs(L.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.35,ease:"easeOut"},className:"relative overflow-hidden rounded-2xl border border-gray-200 bg-white p-6 shadow-[0_1px_2px_rgba(17,24,39,0.04)] transition-all duration-200 hover:shadow-[0_12px_24px_rgba(17,24,39,0.06)] before:absolute before:left-0 before:top-0 before:h-full before:w-[3px] before:bg-xterns-blue",children:[e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-xterns-blue/10 text-xterns-blue",children:e.jsx(he,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-base font-semibold text-gray-900",children:["Road to"," ",e.jsx("span",{className:"font-['DM_Serif_Display',serif] text-xl font-normal text-xterns-blue",children:n})," ","Signal Score"]}),e.jsx("p",{className:"text-xs text-gray-500",children:"Your milestone toward employer visibility"})]})]}),e.jsxs(_,{variant:"outline",size:"sm",className:"h-9 rounded-xl border-gray-200",onClick:()=>t("/xterns/pods"),children:["View Pods",e.jsx(H,{className:"ml-1.5 h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-gray-500",children:"Current progress"}),e.jsxs("span",{className:"font-semibold text-gray-900 tabular-nums",children:[l.toFixed(1),"%"]})]}),e.jsx("div",{className:"h-3 w-full overflow-hidden rounded-full bg-gray-100",children:e.jsx(L.div,{initial:{width:0},animate:{width:`${l}%`},transition:{duration:.9,ease:"easeOut"},className:"h-full rounded-full bg-gradient-to-r from-xterns-blue to-xterns-teal"})})]}),e.jsxs("div",{className:"mt-5 grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"rounded-xl bg-gray-50 px-3 py-2.5 text-center",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Current"}),e.jsx("div",{className:"mt-0.5 text-lg font-bold text-gray-900 tabular-nums",children:Math.round(s)})]}),e.jsxs("div",{className:"rounded-xl bg-gray-50 px-3 py-2.5 text-center",children:[e.jsx("div",{className:"text-xs text-gray-500",children:"Target"}),e.jsx("div",{className:"mt-0.5 text-lg font-bold text-gray-900 tabular-nums",children:n})]}),e.jsxs("div",{className:"rounded-xl bg-xterns-teal/10 px-3 py-2.5 text-center",children:[e.jsx("div",{className:"text-xs text-xterns-teal/80",children:"Remaining"}),e.jsx("div",{className:"mt-0.5 text-lg font-bold text-xterns-teal tabular-nums",children:Math.round(d)})]})]}),o?e.jsxs("div",{className:"mt-4 flex items-center gap-3 rounded-xl border border-emerald-200 bg-emerald-50 p-4 text-emerald-900",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-emerald-100 text-emerald-700",children:e.jsx(Ve,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold",children:"You made it! 🎉"}),e.jsxs("p",{className:"text-xs text-emerald-800/80",children:["You've reached the ",n," threshold — employers can now discover your profile more easily."]})]}),e.jsx(xs,{className:"ml-auto h-5 w-5 shrink-0 text-emerald-600"})]}):e.jsxs("div",{className:"mt-4 flex flex-col gap-3 rounded-xl border border-xterns-blue/10 bg-xterns-blue/5 p-4 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-white text-xterns-blue",children:e.jsx(us,{className:"h-4 w-4"})}),e.jsxs("p",{className:"text-sm text-gray-700",children:["About"," ",e.jsx("span",{className:"font-semibold text-gray-900",children:r})," ","more pod",r===1?"":"s"," to hit your target."]})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-2 rounded-lg bg-white px-3 py-1.5 text-xs text-gray-600 ring-1 ring-gray-200",children:[e.jsx(ht,{className:"h-3.5 w-3.5 text-gray-400"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold text-gray-900",children:a})," ","completed"]})]})]})]})}const Ce="personalized_pod_recommendations",Oa=1800*1e3;function Ma(){try{const s=sessionStorage.getItem(Ce);if(!s)return null;const t=JSON.parse(s);return Date.now()-t.timestamp>Oa?(sessionStorage.removeItem(Ce),null):t}catch{return null}}function qa(s){try{sessionStorage.setItem(Ce,JSON.stringify({recommendations:s,timestamp:Date.now()}))}catch{}}const $a=s=>{const{user:t}=V(),[a,r]=b.useState([]),[n,i]=b.useState(!1),[l,o]=b.useState(null),[d,m]=b.useState(null),x=b.useCallback(async(u=!1)=>
51{if(t!=null&&t.id){if(!u){const p=Ma();if(p){r(p.recommendations),m(!0);return}}i(!0),o(null);try{const{data:p}=await v.from("pod_members").select("pod_id, pods!inner(id, pod_name, project_id, status, projects(title, technologies, career_paths, difficulty_level))").eq("user_id",t.id).eq("pods.status","completed"),h=(p||[]).map(N=>{var A,z,j,S,F,le,We;return{title:((z=(A=N.pods)==null?void 0:A.projects)==null?void 0:z.title)||((j=N.pods)==null?void 0:j.pod_name),technologies:((F=(S=N.pods)==null?void 0:S.projects)==null?void 0:F.technologies)||[],career_paths:((We=(le=N.pods)==null?void 0:le.projects)==null?void 0:We.career_paths)||[]}});if(m(h.length>0),h.length===0){r([]),i(!1);return}const{data:y}=await v.from("xtern_tech_assessment_results").select("tech_stack_name, score_percentage, level").eq("user_id",t.id),f=(y||[]).map(N=>({tech_stack:N.tech_stack_name,score:N.score_percentage,level:N.level})),w=f.filter(N=>N.score<60).map(N=>N.tech_stack),{data:g}=await v.from("xterns_profiles").select("skills, preferred_roles").eq("user_id",t.id).maybeSingle(),P=(g==null?void 0:g.skills)||[],$=(g==null?void 0:g.preferred_roles)||[],{data:G}=await v.from("pods").select(`
52          id, pod_name, project_id, status, max_members, current_members,
53          projects(title, technologies, career_paths, difficulty_level, description)
54        `).eq("status","recruiting").eq("accelerator_only",!1),{data:T}=await v.from("project_applications").select("project_id, pod_id").eq("user_id",t.id),re=new Set((T||[]).filter(N=>N.pod_id).map(N=>N.pod_id)),X=new Set((T||[]).filter(N=>!N.pod_id).map(N=>N.project_id)),{data:O}=await v.from("pod_members").select("pod_id").eq("user_id",t.id),Y=new Set((O||[]).map(N=>N.pod_id)),ne=(G||[]).filter(N=>!re.has(N.id)&&!X.has(N.project_id)&&!Y.has(N.id)).map(N=>{var A,z,j,S,F;return{id:N.id,title:((A=N.projects)==null?void 0:A.title)||N.pod_name,technologies:((z=N.projects)==null?void 0:z.technologies)||[],career_paths:((j=N.projects)==null?void 0:j.career_paths)||[],difficulty:((S=N.projects)==null?void 0:S.difficulty_level)||"intermediate",description:((F=N.projects)==null?void 0:F.description)||""}});if(ne.length===0){r([]),i(!1);return}const{data:ie,error:ge}=await v.functions.invoke("generate-pod-recommendations",{body:{completedPods:h,assessmentScores:f,skillGaps:w,userSkills:P,userCareerPaths:$,currentDareyScore:s??0,availablePods:ne}});if(ge)throw console.error("Edge function error:",ge),new Error("Failed to generate recommendations");const fe=new Map((G||[]).map(N=>[N.id,N])),je=((ie==null?void 0:ie.recommendations)||[]).map(N=>{var z,j,S;const A=fe.get(N.podId);return{...N,podName:(A==null?void 0:A.pod_name)||"Unknown Pod",projectTitle:((z=A==null?void 0:A.projects)==null?void 0:z.title)||"",projectId:(A==null?void 0:A.project_id)||"",technologies:((j=A==null?void 0:A.projects)==null?void 0:j.technologies)||[],difficultyLevel:((S=A==null?void 0:A.projects)==null?void 0:S.difficulty_level)||"intermediate"}});r(je),qa(je)}catch(p){console.error("Error fetching pod recommendations:",p),o(p instanceof Error?p.message:"Failed to load recommendations")}finally{i(!1)}}},[t==null?void 0:t.id,s]),c=b.useCallback(()=>{sessionStorage.removeItem(Ce),x(!0)},[x]);return{recommendations:a,isLoading:n,error:l,hasCompletedPods:d,fetchRecommendations:x,refresh:c}};function Fa(){return e.jsxs("div",{role:"status","aria-busy":"true","aria-label":"Loading recommendations",className:"rounded-2xl border border-gray-200 bg-white p-6 shadow-[0_1px_2px_rgba(17,24,39,0.04)]",children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(C,{className:"h-9 w-9 rounded-xl"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{className:"h-5 w-56"}),e.jsx(C,{className:"h-3 w-40"})]})]}),e.jsx(C,{className:"h-8 w-8 rounded-lg"})]}),e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:[0,1,2].map(s=>e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-gray-200 p-5",children:[e.jsx("span",{className:"absolute left-0 top-0 h-full w-[3px] bg-gray-100"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(C,{className:"h-5 w-3/4"}),e.jsx(C,{className:"h-3 w-1/2"})]}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx(C,{className:"h-5 w-20 rounded-full"}),e.jsx(C,{className:"h-5 w-24 rounded-full"})]}),e.jsxs("div",{className:"mt-4 space-y-1.5",children:[e.jsx(C,{className:"h-3 w-full"}),e.jsx(C,{className:"h-3 w-11/12"}),e.jsx(C,{className:"h-3 w-3/4"})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-1.5",children:[e.jsx(C,{className:"h-5 w-14 roun
54ded-full"}),e.jsx(C,{className:"h-5 w-16 rounded-full"}),e.jsx(C,{className:"h-5 w-12 rounded-full"})]}),e.jsx(C,{className:"mt-4 h-10 w-full rounded-xl"})]},s))}),e.jsx("span",{className:"sr-only",children:"Loading"})]})}const Ne="rounded-2xl border border-gray-200 bg-white p-6 shadow-[0_1px_2px_rgba(17,24,39,0.04)]",za=({currentDareyScore:s})=>{const t=Q(),{recommendations:a,isLoading:r,error:n,hasCompletedPods:i,fetchRecommendations:l,refresh:o}=$a(s),{createApplication:d,isLoading:m}=pt(),[x,c]=b.useState(null);b.useEffect(()=>{l()},[l]);const u=async(h,y)=>{if(x!=null&&x.projectId)try{await d({project_id:x.projectId,pod_id:y?x.podId:void 0,pathway_role:y,motivation:h}),K.success("Application submitted successfully!"),c(null),o()}catch{K.error("Failed to submit application. Please try again.")}};if(r)return e.jsx(Fa,{});const p=({withRefresh:h=!0})=>e.jsxs("div",{className:"mb-5 flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-xterns-blue/10 text-xterns-blue",children:e.jsx(Fe,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"text-base font-semibold text-gray-900",children:"Recommended for you"}),e.jsx("p",{className:"text-xs text-gray-500",children:"AI-picked pods based on your recent work"})]})]}),h&&e.jsx(_,{variant:"ghost",size:"icon",onClick:o,"aria-label":"Refresh recommendations",className:"h-9 w-9 rounded-lg text-gray-500 hover:text-gray-900",children:e.jsx(Re,{className:"h-4 w-4"})})]});return i===!1?e.jsxs("section",{className:Ne,children:[e.jsx(p,{withRefresh:!1}),e.jsx(Le,{icon:e.jsx(ft,{className:"h-6 w-6"}),title:"You're just getting started",description:"Complete your first pod and we'll surface AI-picked next steps here.",action:e.jsx(_,{className:"h-10 rounded-xl bg-xterns-blue hover:bg-xterns-blue/90",onClick:()=>t("/xterns/pods"),children:"Browse Pods"})})]}):n?e.jsxs("section",{className:Ne,children:[e.jsx(p,{}),e.jsx(Le,{icon:e.jsx(W,{className:"h-6 w-6"}),title:"Couldn't load recommendations",description:"We'll try again automatically. You can also retry now.",action:e.jsxs(_,{variant:"outline",className:"h-10 rounded-xl border-gray-200",onClick:o,children:[e.jsx(Re,{className:"mr-2 h-4 w-4"}),"Try again"]})})]}):a.length===0?e.jsxs("section",{className:Ne,children:[e.jsx(p,{}),e.jsx(Le,{icon:e.jsx(Fe,{className:"h-6 w-6"}),title:"No matches this week",description:"Keep building — we're constantly scoring new pod fits for your profile.",action:e.jsxs(_,{variant:"outline",className:"h-10 rounded-xl border-gray-200",onClick:o,children:[e.jsx(Re,{className:"mr-2 h-4 w-4"}),"Refresh"]})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:Ne,children:[e.jsx(p,{}),e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:a.map((h,y)=>e.jsxs(L.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.35,delay:y*.06,ease:"easeOut"},className:"relative overflow-hidden rounded-2xl border border-gray-200 bg-white p-5 transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_12px_24px_rgba(17,24,39,0.08)]",children:[e.jsx("span",{"aria-hidden":!0,className:"absolute left-0 top-0 h-full w-[3px] bg-gradient-to-b from-xterns-blue to-xterns-teal"}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold text-gray-900 line-clamp-1",children:h.podName}),e.jsx("p",{className:"mt-0.5 text-xs text-gray-500 line-clamp-1",children:h.projectTitle})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-xterns-blue/10 px-2.5 py-1 text-[11px] font-semibold text-xterns-blue",children:[e.jsx(he,{className:"h-3 w-3"}),h.matchScore,"% match"]}),e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-50 px-2.5 py-1 text-[11px] font-semibold text-emerald-700",children:[e.jsx(fs,{className:"h-3 w-3"}),"+~",h.estimatedScoreImpact," pts"]})]}),h.personalizedMessage&&e.jsxs("p",{className:"mt-3 line-clamp-3 text-sm italic text-gray-600",children:['"',h.personalizedMessage,'"']}),(h.strengthsLeveraged.length>0||h.gapsAddressed.length>0)&&e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[h.strengthsLeveraged.slice(0,3).map(f=>e.jsxs(q,{variant:"secondary",className:"border-0 bg-gray-100 px-2 py-0.5 text-[10px] font-medium text-gray-700",children:[e.jsx(Ns,{className:"mr-0.5 h-2.5 w-2.5"}),f]},`s-${f}`)),h.gapsAddressed.slice(0,2).map(f=>e.jsx(q,{variant:"outline",className:"border-gray-200 px-2 py-0.5 text-[10px] font-medium text-gray-600",children:f},`g-${f}`))]}),e.jsx(_,{className:"mt-4 h-10 w-full rounded-xl bg-xterns-blue hover:bg-xterns-blue/90",onClick:()=>c(h),children:"Apply to Pod"})]},h.podId))})]}),e.jsx(gt,{isOpen:!!x,onClose:()=>c(null),onSubmit:u,podTitle:(x==null?void 0:x.podName)||"",podId:x==null?void 0:x.podId,isLoading:m})]})},Ga={1:"Beginner",2:"Elementary",3:"Intermediate",4:"Advanced",5:"Expert"},Cs=s=>Ga[s]||"Unknown",Ya={React:"React","React.js":"React",ReactJS:"React","Node.js":"Node.js",NodeJS:"Node.js",TypeScript:"TypeScript",JavaScript:"TypeScript",JS:"TypeScript",Python:"Node.js",Git:"Git",GitHub:"Git",Docker:"Docker",CSS:"CSS/Tailwind",CSS3:"CSS/Tailwind",Tailwind:"CSS/Tailwind","Tailwind CSS":"CSS/Tailwind","CSS/Tailwind":"CSS/Tailwind",HTML:"React",HTML5:"React",SQL:"SQL/Database Design",MySQL:"SQL/Database Design",PostgreSQL:"SQL/Database Design",MongoDB:"SQL/Database Design","REST API":"REST API Design","RESTful APIs":"REST API Design",APIs:"REST API Design",Redux:"State Management","State Management":"State Management",AWS:"Cloud Services",Azure:"Cloud Services",GCP:"Cloud Services","Cloud Services":"Cloud Services","CI/CD":"CI/CD",Jenkins:"CI/CD",Authentication:"Authentication",Auth:"Authentication",Java:"Node.js","C#":"Node.js",PHP:"Node.js",Ruby:"Node.js",Go:"Node.js",Rust:"Node.js"},As=s=>{const{user:t}=V(),a=t==null?void 0:t.id;return J({queryKey:["skill-profiles",a],queryFn:async()=>{var d;if(!a)throw new Error("No user ID");const[r,n]=await Promise.all([v.from("skill_profiles").select(`
55            id,
56            skill_id,
57            current_level,
58            confidence,
59            evidence_count,
60            last_assessed_at,
61            skill_taxonomy!inner (
62              id,
63              skill_name,
64              skill_area,
65              category,
66              sort_order
67            )
68          `).eq("user_id",a),v.from("xterns_profiles").select("skill_proficiencies").eq("user_id",a).maybeSingle()]);if(r.error)throw r.error;const i={technical:{},professional:{}},l=new Set;
68(r.data||[]).forEach(m=>{const x=m.skill_taxonomy;l.add(x.skill_name);const c={id:m.id,skillId:m.skill_id,skillName:x.skill_name,skillArea:x.skill_area,category:x.category,currentLevel:m.current_level,confidence:Number(m.confidence),evidenceCount:m.evidence_count,lastAssessedAt:m.last_assessed_at},u=x.category;i[u][x.skill_area]||(i[u][x.skill_area]=[]),i[u][x.skill_area].push(c)});const o=(d=n.data)==null?void 0:d.skill_proficiencies;if(o&&Array.isArray(o)){const{data:m}=await v.from("skill_taxonomy").select("id, skill_name, skill_area, category").eq("is_active",!0).eq("category","technical"),x=new Map((m||[]).map(c=>[c.skill_name,c]));for(const c of o){const u=c.name||c.skill||"",p=Ya[u];if(!p||l.has(p))continue;const h=x.get(p);if(!h)continue;l.add(p);const y=typeof c.proficiency=="number"?Math.min(5,Math.max(1,c.proficiency)):1,f={id:`onboarding-${h.id}`,skillId:h.id,skillName:h.skill_name,skillArea:h.skill_area,category:"technical",currentLevel:y,confidence:.1,evidenceCount:0,lastAssessedAt:new Date().toISOString()};i.technical[h.skill_area]||(i.technical[h.skill_area]=[]),i.technical[h.skill_area].push(f)}}return Object.values(i.technical).forEach(m=>m.sort((x,c)=>x.skillName.localeCompare(c.skillName))),Object.values(i.professional).forEach(m=>m.sort((x,c)=>x.skillName.localeCompare(c.skillName))),i},enabled:!!a})},Ba=({skill:s,category:t})=>e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-xl border border-gray-100 bg-white px-3 py-3 shadow-sm transition-colors hover:bg-gray-50/80",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:s.skillName}),s.confidence<.5&&e.jsx(q,{variant:"outline",className:"rounded-full px-2 py-0 text-xs text-muted-foreground",children:"Preliminary"})]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.evidenceCount," assessment",s.evidenceCount!==1?"s":""," · last ",js(new Date(s.lastAssessedAt),{addSuffix:!0})]})]}),t==="technical"&&e.jsxs("div",{className:"flex items-center gap-3 ml-3",children:[e.jsx("div",{className:"w-20",children:e.jsx(se,{value:s.currentLevel*20,className:"h-1.5"})}),e.jsx(q,{variant:"secondary",className:"min-w-[80px] justify-center whitespace-nowrap rounded-full text-xs",children:Cs(s.currentLevel)})]})]}),ns=({area:s,skills:t,category:a})=>e.jsxs("div",{className:"mb-5 last:mb-0",children:[e.jsx("h4",{className:"mb-3 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:s}),e.jsx("div",{className:"space-y-2",children:t.map(r=>e.jsx(Ba,{skill:r,category:a},r.id))})]}),Ua=()=>{const{data:s,isLoading:t}=As();if(t)return e.jsxs(k,{className:"rounded-2xl border border-gray-200/80 bg-white shadow-[0_12px_36px_rgba(15,23,42,0.06)]",children:[e.jsx(D,{className:"p-6",children:e.jsxs(I,{className:"flex items-center gap-3 text-lg",children:[e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl border border-gray-200 bg-white shadow-sm",children:e.jsx(De,{className:"h-5 w-5 text-primary"})}),e.jsx("span",{children:"Verified Skills"})]})}),e.jsx(E,{className:"px-6 pb-6",children:e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2,3].map(i=>e.jsx("div",{className:"h-12 rounded-xl bg-muted"},i))})})]});const a=Object.entries((s==null?void 0:s.technical)||{}),r=Object.entries((s==null?void 0:s.professional)||{});return a.length>0||r.length>0?e.jsxs(k,{className:"rounded-2xl border border-gray-200/80 bg-white shadow-[0_12px_36px_rgba(15,23,42,0.06)]",children:[e.jsx(D,{className:"p-6",children:e.jsxs(I,{className:"flex items-center gap-3 text-lg",children:[e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl border border-gray-200 bg-white shadow-sm",children:e.jsx(De,{className:"h-5 w-5 text-primary"})}),e.jsx("span",{children:"Verified Skills"})]})}),e.jsx(E,{className:"px-6 pb-6",children:e.jsxs(Be,{defaultValue:"technical",children:[e.jsxs(Ue,{className:"mb-5 grid h-10 w-full grid-cols-2 rounded-xl bg-gray-100 p-1",children:[e.jsxs(te,{value:"technical",className:"gap-1.5 rounded-lg",children:[e.jsx(hs,{className:"h-3.5 w-3.5"}),"Technical (",a.reduce((i,[,l])=>i+l.length,0),")"]}),e.jsxs(te,{value:"professional",className:"gap-1.5 rounded-lg",children:[e.jsx(Z,{className:"h-3.5 w-3.5"}),"Professional (",r.reduce((i,[,l])=>i+l.length,0),")"]})]}),e.jsx(Se,{value:"technical",children:a.length>0?a.map(([i,l])=>e.jsx(ns,{area:i,skills:l,category:"technical"},i)):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No technical skills assessed yet."})}),e.jsx(Se,{value:"professional",children:r.length>0?r.map(([i,l])=>e.jsx(ns,{area:i,skills:l,category:"professional"},i)):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No professional skills assessed yet."})})]})})]}):e.jsxs(k,{className:"rounded-2xl border border-gray-200/80 bg-white shadow-[0_12px_36px_rgba(15,23,42,0.06)]",children:[e.jsx(D,{className:"p-6",children:e.jsxs(I,{className:"flex items-center gap-3 text-lg",children:[e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl border border-gray-200 bg-white shadow-sm",children:e.jsx(De,{className:"h-5 w-5 text-primary"})}),e.jsx("span",{children:"Verified Skills"})]})}),e.jsx(E,{className:"px-6 pb-6",children:e.jsx("p",{className:"rounded-2xl border border-dashed border-gray-200 bg-gray-50/70 px-6 py-8 text-sm text-muted-foreground",children:"Complete assessments to build your verified skill profile. Your skills will appear here as you progress."})})]})},is=s=>{const t=[];
68return Object.values(s).forEach(a=>{a.forEach(r=>{t.push({skill:r.skillName,level:r.currentLevel,fullMark:5})})}),t},Va=()=>{const{data:s,isLoading:t}=As(),[a,r]=b.useState("technical");if(t||!s)return null;const n=is(s.technical),i=is(s.professional);if(n.length===0&&i.length===0)return null;const l=a==="technical"?n:i;return l.length<3?null:e.jsxs(k,{children:[e.jsx(D,{children:e.jsxs(I,{className:"flex items-center gap-2",children:[e.jsx(Ft,{className:"h-5 w-5 text-primary"}),"Skill Radar"]})}),e.jsx(E,{children:e.jsxs(Be,{value:a,onValueChange:o=>r(o),children:[e.jsxs(Ue,{className:"mb-4",children:[n.length>=3&&e.jsxs(te,{value:"technical",className:"gap-1.5",children:[e.jsx(hs,{className:"h-3.5 w-3.5"}),"Technical"]}),i.length>=3&&e.jsxs(te,{value:"professional",className:"gap-1.5",children:[e.jsx(Z,{className:"h-3.5 w-3.5"}),"Professional"]})]}),e.jsx("div",{className:"h-[300px]",children:e.jsx(Ct,{width:"100%",height:"100%",children:e.jsxs(ua,{data:l,cx:"50%",cy:"50%",outerRadius:"75%",children:[e.jsx(_s,{stroke:"hsl(var(--border))"}),e.jsx(vs,{dataKey:"skill",tick:{fontSize:11,fill:"hsl(var(--muted-foreground))"}}),e.jsx(ws,{angle:30,domain:[0,5],tick:{fontSize:10,fill:"hsl(var(--muted-foreground))"}}),e.jsx(pe,{name:"Proficiency",dataKey:"level",stroke:"hsl(var(--primary))",fill:"hsl(var(--primary))",fillOpacity:.2,strokeWidth:2})]})})})]})})]})},Ka=()=>J({queryKey:["professional-templates"],queryFn:async()=>{const{data:s,error:t}=await v.from("assessment_templates").select("id, title, description, duration, difficulty").eq("response_type","free_text").eq("is_active",!0).order("title");if(t)throw t;return s||[]}}),Ha=s=>J({queryKey:["rubric",s],queryFn:async()=>{if(!s)return null;const a={"Professional Email Writing":"email_writing","Task Estimation Skills":"task_estimation","Stakeholder Communication":"stakeholder_update"}[s];if(!a)return null;const{data:r,error:n}=await v.from("professional_assessment_rubrics").select("*").eq("assessment_type",a).eq("is_active",!0).maybeSingle();if(n)throw n;return r?{id:r.id,assessment_type:r.assessment_type,rubric_name:r.rubric_name,criteria:r.criteria,few_shot_examples:r.few_shot_examples}:null},enabled:!!s}),Wa=()=>Ke({mutationFn:async({rubricId:s,templateId:t})=>{const{data:a,error:r}=await v.functions.invoke("generate-professional-scenario",{body:{rubric_id:s,template_id:t}});if(r)throw r;if(!(a!=null&&a.success))throw new Error((a==null?void 0:a.error)||"Failed to generate scenario");return a.scenario},onError:s=>{s.message.includes("Rate limit")?K.error("Rate limited — please try again in a moment."):K.error("Failed to generate scenario. Using default.")}}),Qa=()=>{const{user:s}=V(),t=ms();return Ke({mutationFn:async({responseText:a,rubricId:r,templateId:n,scenario:i})=>{if(!s)throw new Error("Not authenticated");const{data:l,error:o}=await v.functions.invoke("grade-professional-assessment",{body:{user_id:s.id,response_text:a,rubric_id:r,template_id:n,scenario:i}});if(o)throw o;if(!(l!=null&&l.success))throw new Error((l==null?void 0:l.error)||"Grading failed");return{grading:l.grading,attempt_id:l.attempt_id}},onSuccess:()=>{t.invalidateQueries({queryKey:["skill-profiles"]}),K.success("Assessment graded successfully!")},onError:a=>{a.message.includes("Rate limit")?K.error("Rate limited — please try again in a moment."):a.message.includes("credits")?K.error("AI credits exhausted — contact your admin."):K.error(`Grading failed: ${a.message}`)}})},Ja=({template:s,onStart:t})=>e.jsxs(k,{className:"group flex h-full flex-col rounded-2xl border border-gray-200/80 bg-white shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_16px_34px_rgba(15,23,42,0.09)]",children:[e.jsx(D,{className:"p-5 pb-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary",children:e.jsx($s,{className:"h-5 w-5"})}),e.jsx(I,{className:"truncate text-base leading-snug text-gray-950",children:s.title})]}),e.jsx(q,{variant:"outline",className:"rounded-full text-xs capitalize",children:s.difficulty||"intermediate"})]})}),e.jsxs(E,{className:"flex flex-1 flex-col px-5 pb-5",children:[e.jsx("p",{className:"mb-5 text-sm leading-6 text-muted-foreground",children:s.description}),e.jsxs("div",{className:"mt-auto flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(ue,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[s.duration," min"]})]}),e.jsxs(_,{size:"sm",onClick:()=>t(s),className:"rounded-xl shadow-sm gap-1.5",children:["Start Assessment",e.jsx(H,{className:"h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5"})]})]})]})]}),ls=s=>s>=80?"text-green-600":s>=60?"text-amber-600":"text-red-600",Xa=s=>s>=80?"default":s>=60?"secondary":"destructive",Za=({result:s,rubric:t,templateTitle:a,onBack:r})=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-xl font-semibold",children:[a," — Results"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"AI-graded assessment results"})]}),e.jsxs(_,{variant:"ghost",onClick:r,className:"gap-1.5",children:[e.jsx(Lt,{className:"h-4 w-4"}),"Back to Assessments"]})]}),s.ai_detection_applied&&e.jsx(k,{className:"border-destructive bg-destructive/5",children:e.jsx(E,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Rt,{className:"h-5 w-5 text-destructive mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-destructive",children:"AI-Generated Content Detected"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Your response was flagged as AI-generated. Your score has been capped at 20%. Please write your own original response for an accurate assessment of your skills."})]})]})})}),e.jsx(k,{children:e.jsxs(E,{className:"pt-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Overall Score"}),e.jsxs("p",{className:`text-4xl font-bold ${ls(s.overall_score)}`,children:[s.overall_score,"%"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Proficiency Level"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(q,{variant:Xa(s.overall_score),className:"text-sm px-3 py-1",children:Cs(s.proficiency_level)}),e.jsx("div",{className:"flex",children:Array.from({length:5}).map((n,i)=>e.jsx(He,{className:`h-4 w-4 ${i<s.proficiency_level?"text-amber-400 fill-amber-400":"text-muted-foreground
68/30"}`},i))})]})]})]}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:s.feedback})]})}),e.jsxs(k,{children:[e.jsx(D,{children:e.jsx(I,{className:"text-base",children:"Criteria Breakdown"})}),e.jsx(E,{className:"space-y-4",children:s.criteria_scores.map((n,i)=>{const l=t.criteria.find(d=>d.name===n.criterion_name),o=(l==null?void 0:l.weight)||0;return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:n.criterion_name}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(o*100).toFixed(0),"% weight)"]}),e.jsxs("span",{className:`text-sm font-semibold ${ls(n.score)}`,children:[n.score,"%"]})]})]}),e.jsx(se,{value:n.score,className:"h-2"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n.feedback})]},i)})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs(k,{children:[e.jsx(D,{className:"pb-3",children:e.jsxs(I,{className:"text-base flex items-center gap-2",children:[e.jsx(cs,{className:"h-4 w-4 text-green-600"}),"Strengths"]})}),e.jsx(E,{children:e.jsx("ul",{className:"space-y-2",children:s.strengths.map((n,i)=>e.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[e.jsx("span",{className:"text-green-600 mt-1",children:"•"}),n]},i))})})]}),e.jsxs(k,{children:[e.jsx(D,{className:"pb-3",children:e.jsxs(I,{className:"text-base flex items-center gap-2",children:[e.jsx(W,{className:"h-4 w-4 text-amber-600"}),"Areas for Improvement"]})}),e.jsx(E,{children:e.jsx("ul",{className:"space-y-2",children:s.areas_for_improvement.map((n,i)=>e.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[e.jsx("span",{className:"text-amber-600 mt-1",children:"•"}),n]},i))})})]})]})]}),er=({template:s,rubric:t,onBack:a})=>{const[r,n]=b.useState(""),[i,l]=b.useState(null),[o,d]=b.useState(null),m=Qa(),x=Wa();b.useEffect(()=>{x.mutate({rubricId:t.id,templateId:s.id},{onSuccess:h=>d(h),onError:()=>{var y,f;const h=((f=(y=t.few_shot_examples)==null?void 0:y[0])==null?void 0:f.scenario)||`Complete the following ${s.title} assessment. Write your response below.`;d(h)}})},[]);const c=o||null,u=h=>{h.preventDefault()},p=async()=>{if(r.trim().length<50||!c)return;const h=await m.mutateAsync({responseText:r,rubricId:t.id,templateId:s.id,scenario:c});l(h.grading)};return i?e.jsx(Za,{result:i,rubric:t,templateTitle:s.title,onBack:a}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.description})]}),e.jsx(_,{variant:"ghost",onClick:a,children:"← Back"})]}),e.jsxs(k,{children:[e.jsx(D,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(I,{className:"text-base",children:"Scenario"}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(ue,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[s.duration," min suggested"]})]})]})}),e.jsx(E,{children:x.isPending?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-4",children:[e.jsx(ze,{className:"h-4 w-4 animate-spin"}),"Generating your unique scenario..."]}):e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 text-sm whitespace-pre-wrap select-none",onCopy:h=>h.preventDefault(),children:c})})]}),e.jsxs(k,{children:[e.jsx(D,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{className:"text-base",children:"Your Response"}),e.jsx(Fs,{children:e.jsxs(zs,{children:[e.jsx(Gs,{asChild:!0,children:e.jsx(W,{className:"h-4 w-4 text-amber-500 cursor-help"})}),e.jsx(Ys,{className:"max-w-xs",children:e.jsx("p",{children:"Write your own response. AI-generated answers will be detected and your score will be capped at 20%."})})]})})]}),e.jsxs(q,{variant:"outline",className:"text-xs",children:[r.length," characters"]})]})}),e.jsxs(E,{className:"space-y-4",children:[e.jsx(ys,{value:r,onChange:h=>n(h.target.value),onPaste:u,placeholder:"Type your response here. Pasting is disabled — write your own answer.",className:"min-h-[300px] font-mono text-sm",disabled:m.isPending||!c}),r.trim().length>0&&r.trim().length<50&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600",children:[e.jsx(Bs,{className:"h-4 w-4"}),e.jsx("span",{children:"Response should be at least 50 characters for meaningful grading."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsx("strong",{children:"Grading criteria:"})," ",t.criteria.map(h=>h.name).join(" · ")]}),e.jsx(_,{onClick:p,disabled:r.trim().length<50||m.isPending||!c,className:"gap-2",children:m.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ze,{className:"h-4 w-4 animate-spin"}),"Grading with AI..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Dt,{className:"h-4 w-4"}),"Submit for Grading"]})})]})]})]})]})},sr=()=>{const{data:s,isLoading:t}=Ka(),[a,r]=b.useState(null),{data:n}=Ha(a==null?void 0:a.title);return a&&n?e.jsx(er,{template:a,rubric:n,onBack:()=>r(null)}):e.jsxs(k,{className:"rounded-2xl border border-gray-200/80 bg-white shadow-[0_12px_36px_rgba(15,23,42,0.06)]",children:[e.jsxs(D,{className:"p-6",children:[e.jsxs(I,{className:"flex items-center gap-3 text-lg",children:[e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl border border-gray-200 bg-white shadow-sm",children:e.jsx(Z,{className:"h-5 w-5 text-primary"})}),e.jsx("span",{children:"Professional Skills Assessments"})]}),e.jsx("p",{className:"max-w-3xl text-sm text-muted-foreground",children:"Demonstrate your professional skills through scenario-based writing assessments graded by AI."})]}),e.jsx(E,{className:"px-6 pb-6",children:t?e.jsx("div",{className:"animate-pulse space-y-3",children:[1,2,3].map(i=>e.jsx("div",{className:"h-32 rounded-2xl bg-muted"},i))}):s&&s.length>0?e.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3",children:s.map(i=>e.jsx(Ja,{template:i,onStart:r},i.id))}):e.jsx("div",{className:"rounded-2xl border border-dashed border-gray-200 bg-gray-50/70 px-6 py-10 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"No professional assessments available at the moment."})})})]})};function tr({score:s,isApiAvailable:t,isLoading:a,tierLabel:r="Discoverable Talent",tierDescription:n="You are progressing steadily.",maxScore:i=1e3}){const l=Q(),o=typeof s=="number"?s:0,d=Math.max(0,Math.min(100,o/i*100)),m=160,x=10,c=(m-x)/2,u=2*Math.PI*c,p=u-d/100*u;return e.jsxs(L.section,{initial:{opacity:0,y:10}
68,animate:{opacity:1,y:0},transition:{duration:.5,ease:"easeOut"},className:"relative overflow-hidden rounded-[20px] p-8 text-white shadow-[0_24px_60px_-20px_rgba(13,27,42,0.5)]",style:{background:"linear-gradient(120deg, #0D1B2A 0%, #1565C0 55%, #00838F 100%)"},"aria-label":"Signal Score hero",children:[e.jsx("div",{className:"pointer-events-none absolute -right-16 -top-24 h-72 w-72 rounded-full opacity-30",style:{background:"radial-gradient(circle, rgba(255,255,255,0.6) 0%, transparent 60%)"}}),e.jsxs("div",{className:"relative flex flex-col gap-8 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.14em] text-white/70",children:"Current Signal Score"}),e.jsxs("div",{className:"mt-2 flex items-baseline gap-3",children:[e.jsx("span",{className:"font-['DM_Serif_Display',serif] text-6xl leading-none tracking-tight text-white sm:text-7xl",children:a||!t?"—":ps(o)}),e.jsxs("span",{className:"text-lg text-white/60",children:["/ ",i]})]}),e.jsxs("div",{className:"mt-4 inline-flex items-center gap-2 rounded-full bg-white/15 px-3 py-1.5 backdrop-blur-sm ring-1 ring-white/20",children:[e.jsx(It,{className:"h-4 w-4 text-white"}),e.jsx("span",{className:"text-sm font-medium text-white",children:r})]}),e.jsx("p",{className:"mt-4 max-w-md text-sm text-white/80",children:n})]}),e.jsxs("div",{className:"flex flex-col items-center gap-5 lg:items-end",children:[e.jsxs("div",{className:"relative",style:{width:m,height:m},role:"progressbar","aria-valuenow":Math.round(d),"aria-valuemin":0,"aria-valuemax":100,children:[e.jsxs("svg",{width:m,height:m,className:"-rotate-90",children:[e.jsx("circle",{cx:m/2,cy:m/2,r:c,stroke:"rgba(255,255,255,0.15)",strokeWidth:x,fill:"none"}),e.jsx(L.circle,{cx:m/2,cy:m/2,r:c,stroke:"#5EEAD4",strokeWidth:x,strokeLinecap:"round",fill:"none",strokeDasharray:u,initial:{strokeDashoffset:u},animate:{strokeDashoffset:p},transition:{duration:.9,ease:"easeOut"}})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsxs("span",{className:"text-2xl font-bold text-white",children:[Math.round(d),"%"]}),e.jsx("span",{className:"text-[11px] uppercase tracking-wider text-white/70",children:"to max"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsxs(_,{onClick:()=>l("/xterns/ei-tracker"),className:"h-10 rounded-xl bg-white px-5 text-xterns-navy hover:bg-white/90",children:["Improve Score",e.jsx(H,{className:"ml-2 h-4 w-4"})]}),e.jsxs(_,{variant:"outline",onClick:()=>l("/xterns/ei-tracker"),className:"h-10 rounded-xl border-white/40 bg-transparent px-5 text-white hover:bg-white/10 hover:text-white",children:[e.jsx(Us,{className:"mr-2 h-4 w-4"}),"View Analytics"]})]})]})]})]})}const os=s=>new Intl.DateTimeFormat(void 0,{day:"numeric",month:"short",year:"numeric"}).format(new Date(`${s}T00:00:00`));function ar(){const{data:s,isLoading:t}=J({queryKey:["xtern-accelerator-hub"],queryFn:Ot});return b.useEffect(()=>{((s==null?void 0:s.applications.filter(r=>r.review_status==="queued"))||[]).forEach(r=>{Tt(r.application_id).catch(n=>console.error("Unable to start accelerator AI review",n))})},[s]),t?e.jsx(k,{children:e.jsx(E,{className:"p-6 text-sm text-muted-foreground",children:"Loading accelerator opportunities…"})}):!s||!s.open_programmes.length&&!s.applications.length?null:e.jsxs(k,{className:"rounded-2xl border-gray-200/80 shadow-[0_12px_36px_rgba(15,23,42,0.06)]",children:[e.jsxs(D,{className:"flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(I,{className:"flex items-center gap-2",children:[e.jsx(us,{className:"h-5 w-5 text-primary"}),"Open Accelerators"]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Discover programmes and track your applications."})]}),e.jsxs(q,{variant:"secondary",children:[s.passed_tech_stacks,"/3 stacks passed"]})]}),e.jsxs(E,{className:"space-y-4",children:[s.applications.map(a=>e.jsxs("div",{className:"rounded-xl border p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:a.programme_name}),e.jsxs("p",{className:"mt-1 flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(Vs,{className:"h-4 w-4"}),"Deadline ",os(a.application_close_date)]})]}),e.jsx(q,{children:a.status.replace(/_/g," ")})]}),a.missing_requirements.map(r=>e.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3 rounded-lg bg-amber-50 p-3 text-sm text-amber-900",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"h-4 w-4"}),r.label]}),e.jsx(_,{asChild:!0,size:"sm",children:e.jsx(Ae,{to:r.action,children:"Take assessment"})})]},r.key)),a.status==="submitted"&&e.jsxs("p",{className:"mt-4 flex items-center gap-2 text-sm text-emerald-700",children:[e.jsx(xs,{className:"h-4 w-4"}),"Eligibility complete. Your application is submitted for review."]})]},a.application_id)),s.open_programmes.filter(a=>!a.application_status).map(a=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4 roun
68ded-xl border p-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:a.name}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Deadline ",os(a.application_close_date)]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{asChild:!0,variant:"outline",size:"sm",children:e.jsx(Ae,{to:`/accelerators/${a.slug}`,children:"View Details"})}),e.jsx(_,{asChild:!0,size:"sm",children:e.jsx(Ae,{to:`/accelerators/${a.slug}/apply`,children:"Apply"})})]})]},a.programme_id))]})]})}const ce="rounded-2xl border border-gray-200/80 bg-white shadow-[0_12px_36px_rgba(15,23,42,0.06)]",rr="rounded-2xl border border-gray-200/80 bg-white shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_16px_34px_rgba(15,23,42,0.09)]",ve="flex h-10 w-10 items-center justify-center rounded-xl border border-gray-200 bg-white shadow-sm",we="rounded-2xl border border-dashed border-gray-200 bg-gray-50/70 px-6 py-10 text-center";function qe({label:s,icon:t,value:a,max:r}){const n=Math.max(0,Math.min(100,a/r*100));return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-gray-600",children:[t,e.jsx("span",{className:"font-medium",children:s})]}),e.jsxs("span",{className:"font-semibold text-gray-900 tabular-nums",children:[a.toFixed(1),e.jsxs("span",{className:"text-gray-400",children:[" / ",r]})]})]}),e.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-gray-100",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-xterns-blue to-xterns-teal",style:{width:`${n}%`}})})]})}function bn(){var A,z;const{user:s}=V(),t=Q(),{pods:a}=Js(),{dareyScore:r,isApiAvailable:n,localBreakdown:i,isLoading:l}=Xs(),{assessmentStatus:o,isLoading:d}=Ks(),{techAssessmentStatus:m,isLoading:x}=Ps(),{leaderboard:c,isLoading:u}=ha(),{pendingResources:p,isLoading:h}=ga(),{data:y,isLoading:f}=ja(),{isOpen:w,celebrationData:g,closeCelebration:P}=wa(),{isConnected:$,isLoading:G}=yt(),{profile:T}=bt(),{sprints:re}=et(a),X=Aa(a,re);st(a.map(j=>j.id));const O=a.filter(j=>{var S;return(S=X[j.id])==null?void 0:S.activeSprint}),Y=(o==null?void 0:o.assessmentCompleted)&&(o==null?void 0:o.techAssessmentPassed)||(m==null?void 0:m.status)==="passed",ne=!d&&!x&&!Y,ie=((A=T==null?void 0:T.preferred_roles)==null?void 0:A[0])||(T==null?void 0:T.role)||"Current Pathway",ge=j=>j===1?e.jsx($t,{className:"w-4 h-4 text-yellow-500"}):j===2?e.jsx(Ze,{className:"w-4 h-4 text-gray-400"}):j===3?e.jsx(Ze,{className:"w-4 h-4 text-orange-400"}):e.jsx("span",{className:"text-xs font-semibold text-gray-700",children:j}),fe=j=>e.jsx("div",{className:"overflow-x-auto rounded-2xl border border-gray-200/80",children:e.jsxs("div",{className:j?"min-w-[520px]":"min-w-[360px]",children:[e.jsxs("div",{className:`grid ${j?"grid-cols-[64px_minmax(0,1.2fr)_110px_minmax(120px,1fr)]":"grid-cols-[64px_minmax(0,1fr)_110px]"} items-center gap-3 bg-gray-50/90 px-4 py-3 text-xs font-semibold text-gray-500`,children:[e.jsx("span",{children:"Rank"}),e.jsx("span",{children:"Learner"}),e.jsx("span",{className:"text-right",children:"SignalScore"}),j&&e.jsx("span",{children:"Career Track"})]}),e.jsx("div",{className:"divide-y divide-gray-100 bg-white",children:c.map(S=>{const F=S.user_id===(s==null?void 0:s.id);return e.jsxs("div",{className:`grid ${j?"grid-cols-[64px_minmax(0,1.2fr)_110px_minmax(120px,1fr)]":"grid-cols-[64px_minmax(0,1fr)_110px]"} items-center gap-3 px-4 py-3 transition-colors hover:bg-gray-50 ${F?"bg-primary/10 ring-1 ring-inset ring-primary/20":""}`,children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full border border-gray-200 bg-gray-50",children:ge(S.rank)}),e.jsx("span",{className:"truncate text-sm font-medium text-gray-900",children:S.display_name}),e.jsx("span",{className:"text-right text-sm font-semibold text-primary",children:ps(S.score)}),j&&e.jsx("span",{className:"truncate text-sm text-gray-600",children:ie})]},S.user_id)})})]})}),je=()=>{const S=new Date().getHours();return S<12?"Good morning":S<18?"Good afternoon":"Good evening"},N=j=>{const S=re.find(F=>F.pod_id===j&&F.status==="active");return S==null?void 0:S.id};return e.jsxs(Hs,{children:[e.jsxs("div",{className:"min-h-screen flex w-full bg-gray-50",children:[e.jsx(Ws,{}),e.jsxs(Qs,{className:"flex-1",children:[e.jsx(tt,{title:"Dashboard"}),e.jsxs("main",{className:"py-8 px-6 sm:px-8 lg:px-10 space-y-10",id:"dashboard-overview",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("h1",{className:"font-['DM_Serif_Display',
68serif] text-3xl leading-tight tracking-tight text-gray-900 sm:text-4xl",children:[je(),", ",((z=s==null?void 0:s.name)==null?void 0:z.split(" ")[0])||"there"," ",e.jsx("span",{"aria-hidden":!0,children:"👋"})]}),e.jsx("p",{className:"text-sm text-gray-500",children:"Here's your career progress today."})]}),e.jsx(ar,{}),ne&&e.jsx("div",{children:e.jsx(fa,{})}),!G&&!$&&e.jsx("div",{children:e.jsx(jt,{variant:"banner"})}),e.jsx("div",{children:e.jsx(_a,{})}),e.jsx("div",{children:e.jsx(Ca,{})}),e.jsx("div",{id:"ei-score-card",children:e.jsx(tr,{score:r,isApiAvailable:n,isLoading:l,tierLabel:"Discoverable Talent",tierDescription:"You are progressing steadily. Keep shipping to unlock the next tier."})}),e.jsx(k,{className:ce,children:e.jsx(E,{className:"p-6",children:e.jsx(ut,{tier1Score:r,isUnavailable:!n,trailingContent:e.jsx(La,{index:3,icon:e.jsx(Ns,{className:"h-4 w-4"}),title:"Skill Breakdown",className:"h-full",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx(qe,{label:"Technical",icon:e.jsx(zt,{className:"h-3.5 w-3.5"}),value:(i==null?void 0:i.technical)??0,max:400}),e.jsx(qe,{label:"Engagement",icon:e.jsx(Fe,{className:"h-3.5 w-3.5"}),value:(i==null?void 0:i.engagement)??0,max:300}),e.jsx(qe,{label:"Collaboration",icon:e.jsx(Mt,{className:"h-3.5 w-3.5"}),value:(i==null?void 0:i.collaboration)??0,max:300})]})})})})}),e.jsx("div",{className:"mb-10",children:e.jsx(Ta,{currentScore:r??0})}),e.jsx("div",{className:"mb-10",children:e.jsx(za,{currentDareyScore:r})}),e.jsx("div",{className:"mb-10",children:e.jsxs(k,{id:"active-pods",className:ce,children:[e.jsx(D,{className:"p-6",children:e.jsxs(I,{className:"flex items-center justify-between text-lg",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:ve,children:e.jsx(Z,{className:"w-5 h-5 text-purple-600"})}),e.jsx("span",{children:"Active Pods"})]}),e.jsx(_,{variant:"ghost",size:"sm",className:"rounded-xl",onClick:()=>t("/xterns/pods"),children:"View All Pods"})]})}),e.jsx(E,{className:"px-6 pb-6",children:O.length>0?e.jsx("div",{className:"grid grid-cols-1 gap-5 md:grid-cols-2 lg:grid-cols-3",children:O.slice(0,3).map(j=>{var F;const S=X[j.id]||{progress:0,activeSprint:null};return e.jsxs(k,{className:`${rr} cursor-pointer border-l-4 border-l-purple-500`,onClick:()=>{const le=N(j.id);t(le?`/xterns/sprint-board-swimlanes?pod=${j.id}&sprint=${le}`:`/xterns/sprint-board?pod=${j.id}`)},children:[e.jsx(D,{className:"p-5 pb-3",children:e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"truncate text-sm font-semibold text-gray-950",children:j.pod_name}),e.jsx("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:(F=j.projects)==null?void 0:F.title})]}),e.jsxs(q,{variant:"secondary",className:"ml-2 rounded-full text-xs",children:[j.current_members,"/",j.max_members]})]})}),e.jsx(E,{className:"px-5 pb-5 pt-0",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center mb-1",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Sprint Progress"}),e.jsxs("span",{className:"text-xs font-semibold text-gray-900",children:[S.progress,"%"]})]}),e.jsx(se,{value:S.progress,className:"h-2"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[S.activeSprint?e.jsxs(q,{variant:"default",className:"rounded-full text-xs",children:["Sprint ",S.activeSprint.sprint_number]}):e.jsx("span",{className:"text-xs text-muted-foreground",children:"No active sprint"}),e.jsxs(_,{size:"sm",variant:"outline",className:"h-8 rounded-xl text-xs shadow-sm",children:["View Sprint",e.jsx(bs,{className:"w-3 h-3 ml-1"})]})]})]})})]},j.id)})}):a.length>0?e.jsxs("div",{className:we,children:[e.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-white shadow-sm",children:e.jsx(Z,{className:"w-7 h-7 text-muted-foreground"})}),e.jsx("h3",{className:"mb-2 text-sm font-semibold text-gray-900",children:"No active sprints"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"None of your pods have a sprint in progress right now."}),e.jsxs(_,{size:"sm",variant:"outline",className:"rounded-xl shadow-sm",onClick:()=>t("/xterns/pods"),children:["View All Pods",e.jsx(H,{className:"w-4 h-4 ml-2"})]})]}):e.jsxs("div",{className:we,children:[e.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-white shadow-sm",children:e.jsx(Z,{className:"w-7 h-7 text-muted-foreground"})}),e.jsx("h3",{className:"mb-2 text-sm font-semibold text-gray-900",children:"No Active Pods"}),e.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"Join a project to start collaborating with other xterns"}),e.jsxs(_,{size:"sm",className:"rounded-xl shadow-sm",onClick:()=>t("/xterns/pods"),children:["Explore Projects",e.jsx(H,{className:"w-4 h-4 ml-2"})]})]})})]})}),e.jsxs("div",{className:"mb-10 grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsxs(k,{className:ce,children:[e.jsx(D,{className:"p-6",children:e.jsxs(I,{className:"flex items-center justify-between text-lg",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:ve,children:e.jsx(Xe,{className:"w-5 h-5 text-blue-600"})}),e.jsx("span",{children:"Continue Learning"})]}),e.jsx(_,{variant:"ghost",size:"sm",className:"rounded-xl",onClick:()=>t("/xterns/learning"),children:"View All"})]})}),e.jsx(E,{className:"px-6 pb-6",children:h?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"})}):p.length>0?e.jsx("div",{className:"space-y-4",children:p.map(j=>e.jsxs("div",{className:"rounded-2xl border border-gray-200/80 bg-white p-4 shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:shadow-md",children:[e.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[e.jsx("h4",{className:"truncate text-sm font-semibold text-gray-950",children:j.title}),e.jsx(q,{variant:"outline",className:"rounded-full text-xs",children:j.resource_type})]}),e.jsx("p",{className:"mb-3 text-xs text-gray-500",children:j.provider}),j.progress_percentage>0&&e.jsx("div",{className:"mb-3",children:e.jsx(se,{value:j.progress_percentage,className:"h-1.5"})}),e.jsxs("div",{className:"flex justify-between items-center",children:[j.duration&&e.jsxs("span",{className:"text-xs text-gray-500 flex items-center gap-1",children:[e.jsx(ue,{className:"w-3 h-3"}),j.duration]}),e.jsxs(_,{size:"sm",variant:"outline",className:"rounded-xl shadow-sm",onClick:()=>window.open(j.url,"_blank"),children:["Continue",e.jsx(qt,{className:"w-3 h-3 ml-1"})]})]})]},j.id))}):e.jsxs("div",{className:we,children:[e.jsx(Xe,{className:"mx-auto mb-3 h-8 w-8 text-gray-300"}),e.jsx("p",{className:"text-sm text-gray-500",children:"No pending learning resources"})]})})]}),e.jsxs(k,{className:ce,children:[e.jsx(D,{className:"p-6",children:e.jsxs(I,{className:"flex items-center gap-3 text-lg",children:[e.jsx("div",{className:ve,children:e.jsx(Ve,{className:"w-5 h-5 text-yellow-600"})}),e.jsx("span",{children:"SignalScore Leaderboard"})]})}),e.jsx(E,{className:"px-6 pb-6",children:u?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-yellow-600"})}):e.jsxs(Be,{defaultValue:"global",className:"w-full",children:[e.jsxs(Ue,{className:"mb-4 grid h-10 w-full grid-cols-2 rounded-xl bg-gray-100 p-1",children:[e.jsx(te,{value:"global",className:"rounded-lg text-xs sm:text-sm",children:"Global Ranking"}),e.jsx(te,{value:"career",className:"rounded-lg text-xs sm:text-sm",children:"Career Track Ranking"})]}),e.jsx(Se,{value:"global",className:"mt-0",children:fe(!0)}),e.jsx(Se,{value:"career",className:"mt-0",children:fe(!1)})]})})]})]}),e.jsx("div",{className:"mb-10",children:e.jsxs(k,{id:"upcoming-events",className:ce,children:[e.jsx(D,{className:"p-6",children:e.jsxs(I,{className:"flex items-center gap-3 text-lg",children:[e.jsx("div",{className:ve,children:e.jsx(Ee,{className:"w-5 h-5 text-green-600"})}),e.jsx("span",{children:"Upcoming Events"})]})}),e.jsx(E,{className:"px-6 pb-6",children:f?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-green-600"})}):y&&y.length>0?e.jsx("div",{className:"space-y-4",children:y.map(j=>e.jsxs("div",{className:"rounded-2xl border border-gray-200/80 bg-white p-4 shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:shadow-md",children:[e.jsxs("div",{className:"mb-2 flex items-start justify-between gap-4",children:[e.jsxs("h4",{className:"text-sm font-semibold text-gray-950",children:[j.title,j.pod_name&&` - ${j.pod_name}`]}),e.jsx("span",{className:"shrink-0 text-xs font-medium text-gray-500",children:ct(j.start_at)})]}),j.description&&e.jsx("p",{className:"text-xs text-gray-500",children:j.description}),j.location&&e.jsxs("p",{className:"text-xs text-gray-400 mt-1",children:["📍 ",j.location]}),j.meeting_link&&e.jsx("div",{className:"mt-2",children:e.jsxs(_,{size:"sm",variant:"outline",onClick:()=>t(`/xterns/calendar?event=${j.id}`),className:"h-8 rounded-xl text-xs shadow-sm",children:[e.jsx(Ee,{className:"w-3 h-3 mr-1"}),"View in Calendar"]})})]},j.id))}):e.jsxs("div",{className:we,children:[e.jsx(Ee,{className:"w-8 h-8 text-gray-300 mx-auto mb-3"}),e.jsx("p",{className:"text-sm text-gray-500",children:"No upcoming events"}),e.jsx("p",{className:"text-xs text-gray-400",children:"Your scheduled meetings will appear here"})]})})]})}),e.jsx("div",{className:"mb-10",children:e.jsx(sr,{})}),e.jsxs("div",{className:"mb-10 grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsx(Ua,{}),e.jsx(Va,{})]})]})]})]}),g&&!g.isDecrease&&e.jsx(ya,{isOpen:w,onClose:P,scoreIncrease:g.scoreIncrease,newScore:g.newScore,previousScore:g.previousScore,notificationThreshold:g.notificationThreshold,milestoneReached:g.milestoneReached}),g&&g.isDecrease&&g.userId&&e.jsx(va,{isOpen:w,onClose:P,scoreDecrease:g.scoreIncrease,newScore:g.newScore,previousScore:g.previousScore,userId:g.userId,scoreBreakdown:g.scoreBreakdown,previousBreakdown:g.previousBreakdown})]})}export{bn as default};

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.