1import{u as S,a5 as T,i as k,a6 as A,g as K,R as $,s as p,j as e,$ as N,a3 as B,v as U,z as v,B as C,a2 as q,r as w,ac as Q,Z as G,ab as I,D as R,C as b,c as _}from"./index-Cbw7qYFc.js";import{S as M}from"./SettingsLayout-C9bMAWiJ.js";import{r as y}from"./icon-utils-BVYZ5vK2.js";import{C as P}from"./ClickableDiv-tNdsAuJD.js";import{D as F,a as D,b as z,c as L,d as E,e as O}from"./drawer-j62J7S-h.js";import"./activity-Bug-D_XI.js";import"./archive-restore-CqPEngR-.js";import"./archive-BIR1qq1i.js";import"./arrow-up-Bh3vN-sf.js";import"./arrow-left-D4IkaIk4.js";import"./workflow-dMLZSY6b.js";import"./briefcase-DVH-60xF.js";import"./bug-CUJSXS5J.js";import"./building-BeErahFr.js";import"./calendar-Dw_7t2ww.js";import"./chart-column-DS-zIXh6.js";import"./chevron-down-D2NAvpJh.js";import"./chevron-left-DpgrQ3Tl.js";import"./chevron-right-Dc1jT_WE.js";import"./circle-alert-BQYMnPmy.js";import"./circle-check-big-YjCG260i.js";import"./circle-check-DZ1LcYOq.js";import"./circle-minus-D3ROwH09.js";import"./circle-play-CEhZNOR3.js";import"./circle-x-tujf6WKj.js";import"./circle-Da8d9Erk.js";import"./clipboard-check-BzgAtn1r.js";import"./coins-Df6HMEpP.js";import"./shuffle-BunUEE6m.js";import"./crown-CYPfSiCm.js";import"./database-K_oDmwBL.js";import"./dollar-sign-BIvTKBlN.js";import"./download-kTXPcKg4.js";import"./ellipsis-vertical-D9O2VlND.js";import"./external-link-CLys4UPm.js";import"./eye-off-5Min6hI6.js";import"./eye-BI3ev11h.js";import"./file-text-JtnCUgP1.js";import"./filter-B2N_FB9j.js";import"./flame-CNbw7g4b.js";import"./globe-CRjWe7jP.js";import"./grip-vertical-DXnrhUtG.js";import"./headphones-Cdga2v7l.js";import"./history-CFtkvmr7.js";import"./info-ih-ChEsa.js";import"./lightbulb-Dk4xrwMV.js";import"./lock-DnIpJYFf.js";import"./mail-DrnOWGjU.js";import"./mic-D4eQXl6m.js";import"./pencil-BNBygUqe.js";import"./play-DhYwTrXV.js";import"./plug-uLq-hoH8.js";import"./plus-C1b1L0ev.js";import"./radio-BDIGx38d.js";import"./rotate-ccw-CnrxGX98.js";import"./save-BLHTE7lZ.js";import"./search-GW1_IIKG.js";import"./test-tube-DbXW7zg7.js";import"./shield-alert-GqGotNya.js";import"./square-pen-BjB6_bBZ.js";import"./tag-BZTFcDLo.js";import"./thumbs-down-Bm4Qoanl.js";import"./trash-2-CpeAKZ6Z.js";import"./trophy-DnnuRmVM.js";import"./unplug-W4X3fPU7.js";import"./upload-3ZdPubNE.js";import"./user-check-BN78AVNd.js";import"./user-minus-BK1hq9GO.js";import"./user-plus-Bl3qsuqF.js";import"./user-x-ClRA2npd.js";import"./users-BjUb81Ub.js";const W=()=>{const{user:t}=S(),a=T(),{data:i,isLoading:o}=k({queryKey:["sales-flow-settings",t?.id],queryFn:async()=>{if(!t)return null;const{data:l,error:x}=await p.from("profiles").select("organization_id").eq("id",t.id).single();if(x)throw x;if(!l?.organization_id)return null;const{data:r,error:s}=await p.from("organizations").select("id, sales_strategy, client_type, product_offering, acv, revenue_range, sales_framework").eq("id",l.organization_id).single();if(s)throw s;return r},enabled:!!t}),{data:u}=k({queryKey:["assigned-framework",t?.id],queryFn:async()=>{if(!t)return null;const{data:l,error:x}=await p.from("user_framework_assignments").select(` 2 *, 3 frameworks ( 4 id, 5 name, 6 display_name, 7 description, 8 icon_name, 9 target_audience_description 10 ) 11 `).eq("user_id",t.id).order("assigned_at",{ascending:!1}).limit(1).maybeSingle();if(x)throw x;if(!l)return null;const r=l.frameworks.id,{data:s}=await p.from("framework_mindsets").select(` 12 *, 13 principles:framework_principles(*) 14 `).eq("framework_id",r).maybeSingle(),{data:m}=await p.from("framework_evolution_phases").select("*").eq("framework_id",r).order("phase_order"),{data:h}=await p.from("framework_pipeline_stages").select(` 15 id, 16 stage_order, 17 library_stage_id, 18 library_stage:sales_stage_library( 19 id, 20 display_name, 21 description, 22 exit_criteria 23 ) 24 `).eq("framework_id",r).order("stage_order"),d=(h||[]).map(n=>({id:n.id,stage_order:n.stage_order,library_stage_id:n.library_stage_id,name:n.library_stage?.display_name||"Unnamed Stage",description:n.library_stage?.description||null,exit_criteria:n.library_stage?.exit_criteria||null})),f=s?{...s,principles:(s.principles||[]).sort((n,j)=>n.display_order-j.display_order)}:null;return{...l,frameworks:{...l.frameworks,mindset_model:f,evolution_phases:m||[],pipeline_stages:d}}},enabled:!!t}),c=A({mutationFn:async l=>{if(!i?.id)throw new Error("Organization not found");const{data:x,error:r}=await p.from("organizations").update(l).eq("id",i.id).select().single();if(r)throw r;return x},onSuccess:()=>{a.invalidateQueries({queryKey:["sales-flow-settings",t?.id]}),$("Sales flow settings updated successfully")},onError:l=>{K(`Failed to update sales flow settings: ${l.message}`)}});return{salesFlow:i,assignedFramework:u,isLoading:o,updateSalesFlow:c.mutate,isUpdating:c.isPending}},Z=t=>{const{user:a}=S(),i=T(),{data:o,isLoading:u}=k({queryKey:["framework-category-skills",t],queryFn:async()=>
24{if(!t)return[];const{data:d,error:f}=await p.from("framework_category_skills").select(` 25 skill_id, 26 category_id, 27 display_order, 28 category:skill_categories(id, name, display_order), 29 skill:skills_library(id, name, description, difficulty_multiplier) 30 `).eq("framework_id",t).order("display_order");if(f)throw f;return(d||[]).map(n=>({skill_id:n.skill_id,category_id:n.category_id,category_name:n.category?.name||"Uncategorized",display_order:n.display_order,skill:n.skill?{id:n.skill.id,name:n.skill.name,description:n.skill.description,difficulty:n.skill.difficulty_multiplier||null}:void 0}))},enabled:!!t}),{data:c,isLoading:l}=k({queryKey:["user-skills",a?.id,t],queryFn:async()=>{if(!a||!t)return[];const{data:d,error:f}=await p.from("user_skill_assessments").select(` 31 *, 32 skill:skills_library(id, name, description, difficulty_multiplier) 33 `).eq("user_id",a.id).eq("framework_id",t).order("assessed_at",{ascending:!1});if(f)throw f;return(d||[]).map(n=>({id:n.id,skill_id:n.skill_id,proficiency_level:n.proficiency_level,assessed_at:n.assessed_at,notes:n.notes,skill:n.skill?{id:n.skill.id,name:n.skill.name,description:n.skill.description,difficulty:n.skill.difficulty_multiplier||null}:void 0}))},enabled:!!a&&!!t}),x=A({mutationFn:async({skillId:d,proficiencyLevel:f,notes:n})=>{if(!a||!t)throw new Error("Missing required data");const{data:j,error:g}=await p.from("user_skill_assessments").upsert({user_id:a.id,framework_id:t,skill_id:d,proficiency_level:f,notes:n,assessed_at:new Date().toISOString()}).select().single();if(g)throw g;return j},onSuccess:()=>{i.invalidateQueries({queryKey:["user-skills"]}),$("Skill assessment saved")},onError:d=>{K("Failed to save skill assessment"),console.error("Skill assessment error:",d)}}),r=d=>o?.filter(f=>f.category_id===d)||[],s=d=>c?.find(f=>f.skill_id===d)?.proficiency_level||0,m=d=>{const f=r(d);return f.length?f.reduce((j,g)=>j+s(g.skill_id),0)/(f.length*5)*100:0},h=()=>{const d=new Map;return o?.forEach(f=>{d.has(f.category_id)||d.set(f.category_id,{id:f.category_id,name:f.category_name})}),Array.from(d.values())};return{frameworkSkills:o,skillsLoading:u,userSkills:c,userSkillsLoading:l,assessSkill:x.mutate,isAssessingSkill:x.isPending,getSkillsByCategory:r,getUserProficiency:s,getCategoryProgress:m,getCategories:h}},H=({frameworkName:t,assignmentReason:a})=>{const{user:i}=S(),{data:o,isLoading:u}=k({queryKey:["framework-selection-context",i?.id],queryFn:async()=>{if(!i?.id)return null;const{data:l,error:x}=await p.from("profiles").select(` 34 role, 35 organization_id 36 `).eq("id",i.id).single();if(x)throw x;if(!l?.organization_id)return{profile:l,organization:null,roleLookup:null};const{data:r,error:s}=await p.from("organizations").select(` 37 industry, 38 sales_strategy 39 `).eq("id",l.organization_id).single();if(s)throw s;let m=null;if(l.role){const{data:d}=await p.from("roles").select("display_label").eq("id",l.role).single();m=d}let h=null;if(r?.sales_strategy){const{data:d}=await p.from("sales_strategies").select("display_label").eq("name",r.sales_strategy).single();h=d}return{profile:l,organization:r,roleLookup:m,strategyLookup:h}},enabled:!!i?.id});if(u)return e.jsxs("div",{className:"rounded-xl bg-gradient-to-br from-secondary/10 via-primary/5 to-accent/10 p-6 border border-secondary/20",children:[e.jsx(N,{className:"h-6 w-48 mb-4"}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(N,{className:"h-8 w-32"}),e.jsx(N,{className:"h-8 w-40"}),e.jsx(N,{className:"h-8 w-36"})]})]});const c=[{icon:"user",label:"Role",value:o?.roleLookup?.display_label||"Not specified"},{icon:"building-2",label:"Industry",value:o?.organization?.industry||"Not specified"},{icon:"trending-up",label:"Who's selling",value:o?.strategyLookup?.display_label||"Not specified"}];return e.jsxs("div",{className:"rounded-lg bg-card p-5 border border-border shadow-sm border-l-4 border-l-primary",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsx(B,{className:"h-5 w-5 text-primary"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Why This Framework?"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(l=>e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-full bg-muted border border-border text-sm",children:[e.jsx("div",{className:"p-1 rounded bg-background",children:y(l.icon,{className:"h-3 w-3 text-muted-foreground"})}),e.jsxs("span",{className:"text-muted-foreground",children:[l.label,":"]}
39),e.jsx("span",{className:"font-medium text-foreground",children:l.value})]},l.label))}),a&&a!=="test_data"&&e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed mt-3",children:a})]})},X=({open:t,onOpenChange:a,phase:i,isCurrentPhase:o})=>i?e.jsx(F,{open:t,onOpenChange:a,direction:"right",children:e.jsx(D,{className:"h-full",children:e.jsxs("div",{className:"w-full h-full flex flex-col",children:[e.jsx(z,{className:"border-b pb-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-framework-evolution/15",children:e.jsx(U,{className:"h-5 w-5 text-framework-evolution"})}),e.jsxs("div",{children:[e.jsxs(L,{className:"text-lg flex items-center gap-2",children:[i.name,o&&e.jsx(v,{variant:"outline",className:"text-xs border-framework-evolution text-framework-evolution",children:"Current"})]}),e.jsx(E,{children:"Evolution Phase"})]})]}),e.jsx(O,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(q,{className:"h-4 w-4"})})})]})}),e.jsxs("div",{className:"p-6 space-y-6 overflow-y-auto flex-1",children:[i.description&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-foreground",children:"Description"}),e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:i.description})]}),i.phase_order!==void 0&&e.jsx("div",{className:"p-4 rounded-lg bg-muted/50 border",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsxs("span",{className:"font-medium text-foreground",children:["Phase ",i.phase_order]})," in your evolution journey"]})})]})]})})}):null,Y=({phases:t,currentPhase:a})=>{const[i,o]=w.useState(null),[u,c]=w.useState(!1),l=[...t].sort((r,s)=>(r.phase_order||0)-(s.phase_order||0)),x=r=>{o(r),c(!0)};return t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No evolution phases defined"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative py-4",children:[e.jsx("div",{className:"absolute top-1/2 left-0 right-0 h-0.5 bg-border -translate-y-1/2"}),e.jsx("div",{className:"relative flex justify-between items-center overflow-x-auto pb-2",children:l.map((r,s)=>{const m=r.name===a,h=l.findIndex(d=>d.name===a)>s;return e.jsxs(P,{className:"flex flex-col items-center group flex-shrink-0 min-w-[80px]",onClick:()=>x(r),children:[e.jsx("div",{className:`relative z-10 flex items-center justify-center w-10 h-10 rounded-full border-2 transition-all duration-200 ${m?"bg-framework-evolution border-framework-evolution shadow-md":h?"bg-framework-evolution/15 border-framework-evolution":"bg-background border-border group-hover:border-framework-evolution"}`,children:m?e.jsx("div",{className:"w-2.5 h-2.5 bg-white rounded-full"}):h?y("check",{className:"h-4 w-4 text-framework-evolution"}):e.jsx("span",{className:"text-sm font-medium text-muted-foreground group-hover:text-framework-evolution",children:s+1})}),e.jsxs("div",{className:"mt-2 text-center",children:[e.jsx("p",{className:`text-sm font-medium transition-colors ${m?"text-framework-evolution":"text-muted-foreground group-hover:text-foreground"}`,children:r.name}),m&&e.jsx(v,{variant:"outline",className:"mt-1 text-xs border-framework-evolution text-framework-evolution",children:"Current"})]})]},r.name||`phase-${s}`)})})]}),e.jsx(X,{open:u,onOpenChange:c,phase:i,isCurrentPhase:i?.name===a})]})},J=({open:t,onOpenChange:a,principle:i,principleIndex:o})=>i?e.jsx(F,{open:t,onOpenChange:a,direction:"right",children:e.jsx(D,{className:"h-full",children:e.jsxs("div",{className:"w-full h-full flex flex-col",children:[e.jsx(z,{className:"border-b pb-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-shrink-0 h-10 w-10 rounded-full bg-framework-mindset/15 flex items-center justify-center text-lg font-bold text-framework-mindset",children:o+1}),e.jsxs("div",{children:[e.jsx(L,{className:"text-lg",children:i.name}),e.jsx(E,{children:"Mindset Principle"})]})]}),e.jsx(O,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(q,{className:"h-4 w-4"})})})]})}),e.jsxs("div",{className:"p-6 space-y-6 overflow-y-auto flex-1",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-3",children:[e.jsx(Q,{className:"h-4 w-4 text-framework-mindset"}),e.jsx("span",{children:"Core Principle"})]}),e.jsx("p",{className:"text-foreground leading-relaxed",children:i.description})]}),e.jsx("div",{className:"p-4 rounded-lg bg-muted/50 border",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This principle guides your approach to customer interactions and helps you maintain the right perspective throughout your sales process."})})]})]})})}):null,V=({principles:t,modelSummary:a})=>{const[i,o]=w.useState(null),[u,c]=w.useState(0),[l,x]=w.useState(!1),r=(s,m)=>{o(s),c(m),x(!0)};return!t||t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No mindset principles defined"}):e.jsxs(e.Fragment,{children:[a&&e.jsx("p",{className:"text-sm text-muted-foreground mb-3 italic",children:a}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:t.map((s,m)=>e.jsx(P,{className:"p-3 rounded-lg bg-card border border-gray-200 hover:border-framework-mindset hover:shadow-sm transition-all group",onClick:()=>r(s,m),children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 h-7 w-7 rounded-full bg-framework-mindset/15 flex items-center justify-center text-sm font-bold text-framework-mindset",children:m+1}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-medium text-foreground text-sm group-hover:text-framework-mindset transition-colors",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-0.5",children:s.description})]})]})},s.name))}),e.jsx(J,{open:l,onOpenChange:x,principle:i,principleIndex:u})]})},ee=({open:t,onOpenChange:a,categoryName:i,categoryDescription:o,skills:u})=>e.jsx(F,{open:t,onOpenChange:a,direction:"right",children:e.jsx(D,{className:"h-full",children:e.jsxs("div",{className:"w-full h-full flex flex-col",children:[e.jsx(z,{className:"border-b pb-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-lg bg-framework-skills/15",children:e.jsx(G,{className:"h-5 w-5 text-framework-skills"})}),e.jsxs("div",{children:[e.jsxs(L,{className:"text-lg flex items-center gap-2",children:[i,e.jsxs(v,{variant:"outline",className:"text-xs",children:[u.length," ",u.length===1?"skill":"skills"]})]}),e.jsx(E,{children:"Skill Category"})]})]}),e.jsx(O,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(q,{className:"h-4 w-4"})})})]})}),e.jsxs("div",{className:"p-6 space-y-6 overflow-y-auto flex-1",children:[o&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium text-foreground",children:"About this category"}),e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:o})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"font-medium text-foreground",children:"Skills in this category"}),e.jsx("div",{className:"space-y-2",children:u.map(c=>e.jsxs("div",{className:"p-3 rounded-lg bg-card border hover:bg-muted/50 transition-colors",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-1",children:[e.jsx("h5",{className:"font-medium text-foreground text-sm",children:c.name}),c.difficulty_multiplier&&e.jsx(v,{variant:"outline",className:"text-xs flex-shrink-0",children:c.difficulty_multiplier})]}),c.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:c.description})]},c.id))})]})]})]})})}),se=({frameworkSkills:t})=>{const[a,i]=w.useState(null),[o,u]=w.useState(!1),c=t.reduce((r,s)=>{const m=s.category_name;return r[m]||(r[m]={skills:[],categoryId:s.category_id}
39),s.skill&&r[m].skills.push({id:s.skill_id,name:s.skill.name,description:s.skill.description,difficulty_multiplier:s.skill.difficulty||void 0}),r},{}),l=Object.keys(c).sort((r,s)=>r.toLowerCase().includes("foundation")&&!s.toLowerCase().includes("foundation")?-1:!r.toLowerCase().includes("foundation")&&s.toLowerCase().includes("foundation")?1:r.localeCompare(s)),x=r=>{i(r),u(!0)};return l.length===0?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No skills defined"}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:l.map(r=>{const m=c[r].skills.length;return e.jsx(P,{className:"p-3 rounded-lg bg-card border border-gray-200 hover:border-framework-skills hover:shadow-sm transition-all group",onClick:()=>x(r),children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2 w-2 rounded-full bg-framework-skills"}),e.jsx("h3",{className:"font-medium text-sm text-foreground group-hover:text-framework-skills transition-colors truncate flex-1",children:r}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[m," ",m===1?"skill":"skills"]})]})},r)})}),a&&e.jsx(ee,{open:o,onOpenChange:u,categoryName:a,skills:c[a]?.skills||[]})]})},re=({open:t,onOpenChange:a,stage:i,stageIndex:o,totalStages:u})=>i?e.jsx(F,{open:t,onOpenChange:a,direction:"right",children:e.jsx(D,{className:"h-full",children:e.jsxs("div",{className:"w-full h-full flex flex-col",children:[e.jsx(z,{className:"border-b pb-4",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-shrink-0 h-10 w-10 rounded-full bg-framework-sales/15 flex items-center justify-center text-lg font-bold text-framework-sales",children:o+1}),e.jsxs("div",{children:[e.jsx(L,{className:"text-lg",children:i.name}),e.jsxs(E,{children:["Stage ",o+1," of ",u]})]})]}),e.jsx(O,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(q,{className:"h-4 w-4"})})})]})}),e.jsxs("div",{className:"p-6 space-y-6 overflow-y-auto flex-1",children:[i.description&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-3",children:[e.jsx(I,{className:"h-4 w-4 text-framework-sales"}),e.jsx("span",{children:"Sales Cycle Stage"})]}),e.jsx("p",{className:"text-foreground leading-relaxed",children:i.description})]}),e.jsx("div",{className:"p-4 rounded-lg bg-muted/50 border",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This stage is part of your optimized sales cycle, designed to help you track deal progress and identify opportunities to move prospects forward."})})]})]})})}):null,te=({stages:t})=>{const[a,i]=w.useState(null),[o,u]=w.useState(0),[c,l]=w.useState(!1),x=(r,s)=>{i(r),u(s),l(!0)};return e.jsxs(e.Fragment,{children:[t.length===0?e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No pipeline stages defined"}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"relative py-3",children:[e.jsx("div",{className:"absolute top-1/2 left-0 right-0 h-0.5 bg-border -translate-y-1/2"}),e.jsx("div",{className:"relative flex justify-between items-center gap-2 overflow-x-auto pb-2",children:t.map((r,s)=>e.jsxs(P,{className:"flex flex-col items-center group flex-shrink-0",onClick:()=>x(r,s),children:[e.jsx("div",{className:"relative z-10 flex items-center justify-center w-9 h-9 rounded-full bg-background border-2 border-border group-hover:border-framework-sales transition-all duration-200",children:e.jsx("span",{className:"text-sm font-medium text-muted-foreground group-hover:text-framework-sales",children:s+1})}),e.jsx("div",{className:"mt-1.5 text-center max-w-[90px]",children:e.jsx("p",{className:"text-xs font-medium text-muted-foreground group-hover:text-framework-sales transition-colors line-clamp-2",children:r.name})})]},r.name||`stage-${s}`))})]})}),e.jsx(re,{open:c,onOpenChange:l,stage:a,stageIndex:o,totalStages:t.length})]})},Ns=()=>{const{user:t}=S(),{assignedFramework:a,isLoading:i}=W(),o=a?.frameworks?.id,{frameworkSkills:u,skillsLoading:c,getUserProficiency:l,getCategories:x}=Z(o);u?.length,u?.reduce((j,g)=>j+l(g.skill_id),0),x();const{data:r}=k({queryKey:["user-framework",t?.id,a?.framework_id],queryFn:async()=>
39{if(!t?.id||!a?.framework_id)return null;const{data:j,error:g}=await p.from("user_frameworks").select("current_phase").eq("user_id",t.id).eq("framework_id",a.framework_id).single();if(g&&g.code!=="PGRST116")throw g;return j},enabled:!!t?.id&&!!a?.framework_id});if(i||c)return e.jsx(M,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(N,{className:"h-8 w-64"}),e.jsx(N,{className:"h-4 w-96"}),e.jsx(N,{className:"h-64 w-full"})]})});const s=a?.frameworks,m=Array.isArray(s?.pipeline_stages)?s.pipeline_stages:[],h=s?.mindset_model,d=Array.isArray(s?.evolution_phases)?s.evolution_phases:[],f=d.length>0?[...d].sort((j,g)=>(j.phase_order||0)-(g.phase_order||0))[0]?.name:null,n=r?.current_phase||f||"";return s?e.jsx(M,{children:e.jsxs(R,{children:[e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"flex flex-wrap items-start gap-4",children:[s.icon_name&&e.jsx("div",{className:"flex-shrink-0 p-3 rounded-lg bg-primary/10",children:y(s.icon_name,{className:"h-8 w-8 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:s.display_name||s.name}),e.jsx(v,{variant:"outline",className:"text-xs",children:"Your Framework"})]}),s.target_audience_description&&e.jsx("p",{className:"text-muted-foreground",children:s.target_audience_description})]})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(H,{frameworkName:s.display_name||s.name,assignmentReason:a?.assignment_reason}),e.jsx(b,{className:"border-l-4 border-l-framework-evolution shadow-sm",children:e.jsxs(_,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[y("trending-up",{className:"h-5 w-5 text-framework-evolution"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Evolution Phases"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Click any phase to learn more"})]}),e.jsx(Y,{phases:d,currentPhase:n})]})}),e.jsx(b,{className:"border-l-4 border-l-framework-mindset shadow-sm",children:e.jsxs(_,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[y("brain",{className:"h-5 w-5 text-framework-mindset"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:h?.name?`${h.name} Mindset`:"Mindset"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Click any principle to learn more"})]}),e.jsx(V,{principles:h?.principles||[],modelSummary:h?.one_line_summary})]})}),e.jsx(b,{className:"border-l-4 border-l-framework-skills shadow-sm",children:e.jsxs(_,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[y("zap",{className:"h-5 w-5 text-framework-skills"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Core Skills"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Click any category to see skills"})]}),e.jsx(se,{frameworkSkills:u||[]})]})}),e.jsx(b,{className:"border-l-4 border-l-framework-sales shadow-sm",children:e.jsxs(_,{className:"p-5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[y("target",{className:"h-5 w-5 text-framework-sales"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Sales Cycle"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Click any stage to learn more"})]}),e.jsx(te,{stages:m})]})})]})]})}):e.jsx(M,{children:e.jsx("div",{className:"text-center py-12",children:e.jsx("p",{className:"text-muted-foreground",children:"No framework assigned yet."})})})};export{Ns as SettingsSalesFoundation};
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.