PageSourceSearch

https://www.finpera.ai/assets/DYhuU7_H.js

js finpera.ai collected 2026-10-05 12:01:01 UTC 84,166 bytes, 1 lines download raw bytes

1import{j as e}from"./BE6pS2ft.js";import{u as Ne,k as Pe,i as se,C as b,b as M,c as q,d as V,a as w,L as d,S as $,p as H,q as J,r as G,s as h,I as z,B as A,D as _e,z as ke,E as Te,F as Ie,_ as fe,w as Ue,aI as gs,T as Re,a1 as Ye,bW as ps,bX as js,bY as fs,bZ as vs,b_ as ys,b$ as Ns,c0 as bs,c1 as ws,a2 as f,ch as Cs,en as Ss,ci as _s,e as xe,G as Le,h as Ve,H as $e,bS as ks,bd as Ts,al as ls,am as Is,an as me,b2 as ne,bP as K,f as Fs,bU as As,bV as Ps,b1 as Ls}from"./DonsFxV-.js";import{a as u,u as Es}from"./BIAevyrO.js";import{I as Os}from"./CLfWWA-D.js";import{P as Ce}from"./DnJGqcTl.js";import{D as He}from"./Br8mrdCq.js";import{A as Rs}from"./DAPTfVhH.js";import{t as Ms}from"./BqWA9u2k.js";import{a as Ds,c as Je}from"./CK5NaRPd.js";import{O as Se,R as zs,T as Ge,t as We,v as qs}from"./UTDhWc-W.js";import{g as Bs}from"./DIRBs-P9.js";import{I as cs}from"./PSyELt9Q.js";import{eg as ds,c0 as Us,c2 as os,B as he,b as ms,an as ge,J as Ys,a_ as Fe,x as Vs,az as $s,bP as Hs,o as oe,g as Ae,S as ye,v as Me,bS as Ke,cD as Js,bw as Gs,s as Ws,c as Ks,r as Xe,q as Xs,L as Ze,T as De,cl as Zs,a2 as Qe,M as Qs,cI as ea,Z as sa,bq as aa,bt as us,D as es,ah as ss,i as as,a as ts,O as Ee,t as ta,b3 as ia,eh as na,al as ra}from"./C48Yo72U.js";import{a as la,N as ca}from"./v7hmeBUa.js";import{D as da}from"./BGxAd-wS.js";import{A as oa,m as ue}from"./DknV8l8p.js";import{S as is}from"./DLuqFWak.js";import{T as ma}from"./DSmHjRyi.js";import{h as ua}from"./CbStt3CZ.js";import"./CnKLv5cd.js";import"./BUR2T1uU.js";import"./BqMJr-Jg.js";import"./BWLPKZVz.js";import"./BQwZLIhy.js";import"./BYwmh0Ii.js";import"./BGak8LzC.js";import"./DOw_u7zl.js";import"./p_w_jtHj.js";import"./Cr2YIBqK.js";const xs=[{value:"saas",label:"SaaS"},{value:"fintech",label:"Fintech"},{value:"healthtech",label:"Healthtech"},{value:"consumer",label:"Consumer"},{value:"marketplace",label:"Marketplace"},{value:"other",label:"Other"}],ze=[{value:"pre-seed",label:"Pre-Seed"},{value:"seed",label:"Seed"},{value:"series-a",label:"Series A"},{value:"series-b",label:"Series B"},{value:"series-c",label:"Series C"},{value:"series-d-plus",label:"Series D+"},{value:"growth",label:"Growth"},{value:"pre-ipo",label:"Pre-IPO"},{value:"public",label:"Public"}];function xa(r){return xs.some(j=>j.value===r)}function Oe(r){return r?xa(r)?{selectValue:r,otherText:""}:{selectValue:"other",otherText:r}:{selectValue:"",otherText:""}}const ha=({industry:r,fundingStage:j,onSaved:F})=>{const{toast:x}=Ne(),{getToken:_}=Pe(),o=Oe(r),[E,Y]=u.useState(o.selectValue),[D,B]=u.useState(o.otherText),[P,X]=u.useState(j??""),[I,Z]=u.useState(!1),[a,t]=u.useState(!1),[T,O]=u.useState(!1);u.useEffect(()=>{let y=!1;return(async()=>{try{const Q=await _();if(!Q||y)return;const te=await fetch("/api/m02/company-profile",{headers:se(Q)});if(!te.ok||y)return;const ie=await te.json();if(ie.success&&ie.data?.profile){const ce=Oe(ie.data.profile.industry);Y(ce.selectValue),B(ce.otherText),X(ie.data.profile.fundingStage??""),t(!0)}}catch{}})(),()=>{y=!0}},[]),u.useEffect(()=>{if(a)return;const y=Oe(r);Y(y.selectValue),B(y.otherText)},[r,a]),u.useEffect(()=>{a||X(j??"")},[j,a]);const ae=E==="other"?D.trim():E,re=async()=>{if(!(!ae&&!P)){Z(!0);try{const y=await _();if(!y)throw new Error("Not authenticated");const Q=await fetch("/api/m02/company-profile",{method:"PATCH",headers:{"Content-Type":"application/json",...se(y)},body:JSON.stringify({industry:ae||void 0,funding_stage:P||void 0})}),te=await Q.json();if(!Q.ok||!te.success)throw new Error(te.error??"Save failed");x({title:"Profile updated",description:"Industry and funding stage updated."}),F?.(ae,P)}catch(y){console.error("Error saving industry and funding stage:",y),x({title:"Couldn't save industry and stage",description:"Try again in a moment. Nothing was saved.",variant:"destructive"})}finally{Z(!1)}}};return e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2 text-foreground",children:[e.jsx(ds,{className:"h-5 w-5 text-link"}),"Peer Benchmark Context"]}),e.jsx(V,{children:"Industry and funding stage power the peer comparison view in Market Intelligence and Financial Analytics."})]}),e.jsxs(w,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"industry-select",children:"Industry"}),e.jsxs($,{value:E,onValueChange:y=>Y(y),children:[e.jsx(H,{id:"industry-select",className:"w-full",children:e.jsx(J,{placeholder:"Select an industry"})}),e.jsx(G,{children:xs.map(y=>e.jsx(h,{value:y.value,children:y.label},y.value))})]}),E==="other"&&e.jsxs("div",{className:"mt-2",children:[e.jsx(z,{id:"industry-other",value:D,onChange:y=>B(y.target.value),placeholder:"Describe your industry",className:"w-full"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This value will be saved as-is. Peer benchmarks apply to the named industries above."})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"funding-stage-select",children:"Funding Stage"}),e.jsxs($,{value:P,onValueChange:y=>X(y),children:[e.jsx(H,{id:"funding-stage-select",className:"w-full",children:e.jsx(J,{placeholder:"Select a stage"})}),e.jsx(G,{children:ze.map(y=>e.jsx(h,{value:y.value,children:y.label},y.value))})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Peer benchmarks are available for Seed, Series A, Series B, and Growth stages."})]})]}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs(A,{type:"button",variant:"outline",size:"sm",onClick:()=>O(!0),children:[e.jsx(Us,{className:"mr-2 h-4 w-4"}),"Finance recommendation profile"]}),e.jsxs(A,{onClick:re,disabled:I,size:"sm",children:[e.jsx(os,{className:"h-4 w-4 mr-2"}),I?"Saving…":"Save"]})]})]}),e.jsx(_e,{open:T,onOpenChange:O,children:e.jsxs(ke,{className:"max-w-3xl",children:[e.jsx(Te,{children:e.jsx(Ie,{children:"Finance recommendation profile"})}),e.jsx(cs,{compact:!0,onSaved:()=>O(!1)})]})})]})},ns=[{value:"private_limited",label:"Private Limited"},{value:"public_limited",label:"Public Limited"},{value:"llp",label:"LLP (Limited Liability Partnership)"},{value:"llc",label:"LLC (Limited Liability Company)"},{value:"corporation",label:"Corporation"},{value:"partnership",label:"Partnership"},{value:"sole_proprietorship",label:"Sole Proprietorship"},{value:"other",label:"Other"}],rs=({companyData:r,isEditMode:j,onUpdate:F})=>{const{toast:x}=Ne(),_=la(),{refreshUser:o}=Pe(),[E,Y]=u.useState(!1),[D,B]=u.useState(r.reportingCurrency??null),[P,X]=u.useState({}),[I,Z]=u.useState(null),[a,t]=u.useState({name:"",legalName:"",description:"",foundedYear:"",companySize:"",website:"",socialLinkedin:"",socialTwitter:"",socialInstagram:"",socialYoutube:"",industry:"",fundingStage:"",headquarters:"",headquartersCountry:"",primaryCountry:"",addressLine1:"",addressLine2:"",addressCity:"",addressState:"",addressPostalCode:"",addressCountry:"",registrationNumber:"",legalEntityType:""}),[T,O]=u.useState([]);u.useEffect(()=>{if(r){t({name:r.name||"",legalName:r.legalName||"",description:r.description||"",foundedYear:r.foundedYear?.toString()||"",companySize:r.companySize||"",website:r.website||"",socialLinkedin:r.socialLinks?.linkedin||"",socialTwitter:r.socialLinks?.twitter||"",socialInstagram:r.socialLinks?.instagram||"",socialYoutube:r.socialLinks?.youtube||"",industry:r.industry||"",fundingStage:r.fundingStage||"",headquarters:r.headquarters||"",headquartersCountry:fe(r.headquartersCountry)??"",primaryCountry:fe(r.primaryCountry)??"",registrationNumber:r.registrationNumber||"",legalEntityType:r.legalEntityType||"",addressLine1:r.registeredAddress?.line1||"",addressLine2:r.registeredAddress?.line2||"",addressCity:r.registeredAddress?.city||"",addressState:Ms(fe(r.registeredAddress?.country),r.registeredAddress?.state)??"",addressPostalCode:r.registeredAddress?.postalCode||"",addressCountry:fe(r.registeredAddress?.country)??""});const s=Object.entries(r.taxIds||{});O(s.map(([N,R])=>({id:Ue(),type:N,value:R||""})))}},[r]),u.useEffect(()=>{B(r.reportingCurrency??null)},[r.reportingCurrency]);const ae=async(s,N)=>{await F({reportingCurrency:s,...N?.confirmRelabel?{confirmRelabel:!0}:{}}),B(s),await o()},re=(s,N)=>{O(R=>R.map(ee=>ee.id===s?{...ee,...N}:ee))},y=()=>{O(s=>[...s,{id:Ue(),type:"",value:""}])},Q=s=>{O(N=>N.filter(R=>R.id!==s))},te=async()=>{const s=qs({name:a.name,legalName:a.legalName,description:a.description,website:a.website,headquarters:a.headquarters,legalEntityType:a.legalEntityType,registrationNumber:a.registrationNumber});if(X(s),Object.keys(s).length>0){x({title:"Check the highlighted fields",description:Object.values(s)[0],variant:"destructive"});return}try{Y(!0);const R=[["line1",a.addressLine1.trim()],["line2",a.addressLine2.trim()],["city",a.addressCity.trim()],["state",a.addressState.trim()],["postalCode",a.addressPostalCode.trim()],["country",a.addressCountry.trim()]].reduce((le,[de,v])=>(v&&(le[de]=v),le),{}),ee=T.reduce((le,de)=>{const v=de.type.trim().toLowerCase(),n=de.value.trim();return v&&n&&(le[v]=n),le},{}),pe={name:a.name.trim(),legalName:a.legalName.trim(),description:a.description.trim(),companySize:a.companySize,website:a.website.trim(),foundedYear:a.foundedYear?parseInt(a.foundedYear):null,socialLinkedin:a.socialLinkedin.trim(),socialTwitter:a.socialTwitter.trim(),socialInstagram:a.socialInstagram.trim(),socialYoutube:a.socialYoutube.trim(),industry:a.industry||void 0,fundingStage:a.fundingStage||void 0,headquarters:a.headquarters,headquartersCountry:a.headquartersCountry,primaryCountry:a.primaryCountry,registrationNumber:a.registrationNumber.trim()||null,legalEntityType:a.legalEntityType||null,registeredAddress:Object.keys(R).length>0?R:null,taxIds:Object.keys(ee).length>0?ee:null};await F(pe),x({title:"Company information updated"})}catch(N){if(N?.code==="PRICING_REGION_LOCKED"){Z(N instanceof Error&&N.message?N.message:null);return}console.error("Error saving company info:",N),x({title:"Couldn't save changes",description:"Try again in a moment. Nothing was saved.",variant:"destructive"})}finally{Y(!1)}},ie=()=>{Z(null),t(s=>({...s,primaryCountry:fe(r.primaryCountry)??""}))},ce=["1-10 employees","11-50 employees","51-200 employees","201-500 employees","501-1000 employees","1001-5000 employees","5001+ employees"];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(b,{children:[e.jsx(M,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(he,{className:"h-5 w-5"}),"Company Identity"]}),e.jsx(V,{children:"Core company facts, branding, and official social pages"})]}
1),j&&e.jsx(A,{onClick:te,disabled:E,children:E?e.jsxs(e.Fragment,{children:[e.jsx(gs,{size:"sm"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ms,{className:"h-4 w-4 mr-2"}),"Save Changes"]})})]})}),e.jsxs(w,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"name",children:"Company Name *"}),j?e.jsxs(e.Fragment,{children:[e.jsx(z,{id:"name",value:a.name,onChange:s=>t({...a,name:s.target.value}),placeholder:"Company legal name",maxLength:Se.name,"aria-invalid":!!P.name,"aria-describedby":P.name?"name-error":void 0}),P.name&&e.jsx("p",{id:"name-error",className:"text-xs text-destructive",children:P.name})]}):e.jsx("p",{className:"text-sm font-medium",children:a.name||"—"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"legalName",children:"Legal Name"}),j?e.jsx(z,{id:"legalName",value:a.legalName,onChange:s=>t({...a,legalName:s.target.value}),placeholder:"Company legal name",maxLength:Se.legalName}):e.jsx("p",{className:"text-sm text-muted-foreground",children:a.legalName||"—"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"description",children:"Description"}),j?e.jsxs(e.Fragment,{children:[e.jsx(Re,{id:"description",value:a.description,onChange:s=>t({...a,description:s.target.value}),placeholder:"Describe your company, what you do, and your mission...",rows:4,maxLength:Se.description}),e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[a.description.length," / ",Se.description]})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:a.description||"—"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"foundedYear",children:"Founded Year"}),j?e.jsx(z,{id:"foundedYear",type:"number",value:a.foundedYear,onChange:s=>t({...a,foundedYear:s.target.value}),placeholder:"YYYY",min:"1800",max:new Date().getFullYear()}):e.jsx("p",{className:"text-sm text-muted-foreground",children:a.foundedYear||"—"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"companySize",children:"Company Size"}),j?e.jsxs($,{value:a.companySize,onValueChange:s=>t({...a,companySize:s}),children:[e.jsx(H,{children:e.jsx(J,{placeholder:"Select company size"})}),e.jsx(G,{children:ce.map(s=>e.jsx(h,{value:s,children:s},s))})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:a.companySize||"—"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"website",children:"Website"}),j?e.jsx(z,{id:"website",type:"url",value:a.website,onChange:s=>t({...a,website:s.target.value}),placeholder:"https://www.example.com"}):e.jsxs("a",{href:Bs(a.website),target:"_blank",rel:"noopener noreferrer",className:"text-sm text-link hover:underline flex items-center gap-1",children:[a.website||"—",a.website&&e.jsx(ge,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[e.jsxs(d,{className:"text-sm font-medium flex items-center gap-2",children:[e.jsx(Ys,{className:"h-4 w-4"}),"Official social pages"]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"socialLinkedin",className:"text-xs text-muted-foreground",children:"LinkedIn"}),j?e.jsx(z,{id:"socialLinkedin",type:"url",value:a.socialLinkedin,onChange:s=>t({...a,socialLinkedin:s.target.value}),placeholder:"https://www.linkedin.com/company/..."}):e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:a.socialLinkedin||"—"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"socialTwitter",className:"text-xs text-muted-foreground",children:"X / Twitter"}),j?e.jsx(z,{id:"socialTwitter",type:"url",value:a.socialTwitter,onChange:s=>t({...a,socialTwitter:s.target.value}),placeholder:"https://x.com/..."}):e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:a.socialTwitter||"—"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"socialInstagram",className:"text-xs text-muted-foreground",children:"Instagram"}),j?e.jsx(z,{id:"socialInstagram",type:"url",value:a.socialInstagram,onChange:s=>t({...a,socialInstagram:s.target.value}),placeholder:"https://www.instagram.com/..."}):e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:a.socialInstagram||"—"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"socialYoutube",className:"text-xs text-muted-foreground",children:"YouTube"}),j?e.jsx(z,{id:"socialYoutube",type:"url",value:a.socialYoutube,onChange:s=>t({...a,socialYoutube:s.target.value}),placeholder:"https://www.youtube.com/@..."}):e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:a.socialYoutube||"—"})]})]})]})]})]}),e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(ds,{className:"h-5 w-5"}),"Industry & Stage"]}),e.jsx(V,{children:"Used across FinPera for peer comparisons and AI context"})]}),e.jsxs(w,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{children:"Industry"}),j?e.jsx(cs,{compact:!0,apiPath:"/api/m02/industry-activities",onSaved:s=>{s&&(t(N=>({...N,industry:s})),F({industry:s}))}}):e.jsx("p",{className:"text-sm text-muted-foreground",children:a.industry||"—"})]}),e.jsxs("div",{className:"space-y-2 md:max-w-sm",children:[e.jsx(d,{htmlFor:"fundingStage",children:"Funding Stage"}),j?e.jsxs($,{value:a.fundingStage,onValueChange:s=>t({...a,fundingStage:s}),children:[e.jsx(H,{id:"fundingStage",children:e.jsx(J,{placeholder:"Select a stage"})}),e.jsx(G,{children:ze.map(s=>e.jsx(h,{value:s.value,children:s.label},s.value))})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:ze.find(s=>
1s.value===a.fundingStage)?.label||a.fundingStage||"—"})]})]})]}),e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(Fe,{className:"h-5 w-5"}),"Registered Address"]}),e.jsx(V,{children:"The company's registered office - grounds generated documents so FinPera AI can fill them automatically"})]}),e.jsxs(w,{className:"space-y-4",children:[j?e.jsx(Rs,{idPrefix:"address",value:{line1:a.addressLine1,line2:a.addressLine2,city:a.addressCity,state:a.addressState,postalCode:a.addressPostalCode,country:a.addressCountry},onChange:s=>t({...a,addressLine1:s.line1??"",addressLine2:s.line2??"",addressCity:s.city??"",addressState:s.state??"",addressPostalCode:s.postalCode??"",addressCountry:s.country??""})}):(()=>{const s=Ds({line1:a.addressLine1,line2:a.addressLine2,city:a.addressCity,state:a.addressState,postalCode:a.addressPostalCode,country:a.addressCountry});return s.length>0?e.jsx("div",{className:"text-sm text-muted-foreground",children:s.map(N=>e.jsx("p",{children:N},N))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"-"})})(),e.jsxs("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[e.jsx(d,{className:"text-sm font-medium",children:"Operating locations"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"headquarters",className:"text-xs text-muted-foreground",children:"Headquarters (City)"}),j?e.jsx(z,{id:"headquarters",value:a.headquarters,onChange:s=>t({...a,headquarters:s.target.value}),placeholder:"City"}):e.jsx("p",{className:"text-sm text-muted-foreground",children:a.headquarters||"—"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"headquartersCountry",className:"text-xs text-muted-foreground",children:"Headquarters Country"}),j?e.jsxs($,{value:a.headquartersCountry,onValueChange:s=>t({...a,headquartersCountry:s}),children:[e.jsx(H,{id:"headquartersCountry","aria-label":"Headquarters Country",children:e.jsx(J,{placeholder:"Select country"})}),e.jsx(G,{children:Ye.map(s=>e.jsx(h,{value:s.code,children:s.name},s.code))})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:Je(a.headquartersCountry)||"-"})]}),e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx(d,{htmlFor:"primaryCountry",className:"text-xs text-muted-foreground",children:"Primary Operating Country *"}),j?e.jsxs($,{value:a.primaryCountry,onValueChange:s=>t({...a,primaryCountry:s}),children:[e.jsx(H,{id:"primaryCountry","aria-label":"Primary Operating Country",children:e.jsx(J,{placeholder:"Select country"})}),e.jsx(G,{children:Ye.map(s=>e.jsx(h,{value:s.code,children:s.name},s.code))})]}):e.jsx("p",{className:"text-sm font-medium",children:Je(a.primaryCountry)||"-"})]}),e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx(d,{className:"text-xs text-muted-foreground",children:"Reporting Currency"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The currency every money figure in this workspace is labelled in - the cap table, valuations, fundraising totals, dashboard tiles and exports."}),e.jsx(zs,{value:D,onConfirm:ae,disabled:!j,disabledReason:j?void 0:"Only an owner or admin can change the reporting currency."})]})]})]})]})]}),e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(Vs,{className:"h-5 w-5"}),"Tax & Registration"]}),e.jsx(V,{children:"Legal entity type, registration number, and tax identifiers"})]}),e.jsxs(w,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"legalEntityType",children:"Legal Entity Type"}),j?e.jsxs($,{value:a.legalEntityType,onValueChange:s=>t({...a,legalEntityType:s}),children:[e.jsx(H,{children:e.jsx(J,{placeholder:"Select entity type"})}),e.jsx(G,{children:ns.map(s=>e.jsx(h,{value:s.value,children:s.label},s.value))})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:ns.find(s=>s.value===a.legalEntityType)?.label||"—"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"registrationNumber",children:"Registration / CIN Number"}),j?e.jsx(z,{id:"registrationNumber",value:a.registrationNumber,onChange:s=>t({...a,registrationNumber:s.target.value}),placeholder:"Company registration number"}):e.jsx("p",{className:"text-sm text-muted-foreground",children:a.registrationNumber||"—"})]})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[e.jsx(d,{className:"text-sm font-medium",children:"Tax Identifiers"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Add the identifiers that apply to your jurisdiction. All optional."}),j?e.jsxs("div",{className:"space-y-3",children:[T.map(s=>e.jsxs("div",{className:"flex flex-col md:flex-row gap-2 md:items-end",children:[e.jsxs("div",{className:"space-y-1 md:w-52",children:[e.jsx(d,{htmlFor:`tax-type-${s.id}`,className:"text-xs text-muted-foreground",children:"Identifier type"}),e.jsxs($,{value:s.type,onValueChange:N=>re(s.id,{type:N}),children:[e.jsx(H,{id:`tax-type-${s.id}`,"aria-label":"Identifier type",children:e.jsx(J,{placeholder:"Select type"})}),e.jsxs(G,{children:[Ge.map(N=>e.jsx(h,{value:N.value,children:N.label},N.value)),s.type&&!Ge.some(N=>N.value===s.type)&&e.jsx(h,{value:s.type,children:We(s.type)})]})]})]}),e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsx(d,{htmlFor:`tax-value-${s.id}`,className:"text-xs text-muted-foreground",children:"Identifier value"}),e.jsx(z,{id:`tax-value-${s.id}`,value:s.value,onChange:N=>re(s.id,{value:N.target.value}),placeholder:"Identifier value"})]}),e.jsx(A,{type:"button",variant:"ghost",size:"sm",onClick:()=>Q(s.id),"aria-label":"Remove identifier",children:e.jsx($s,{className:"h-4 w-4"})})]},s.id)),e.jsxs(A,{type:"button",variant:"outline",size:"sm",onClick:y,children:[e.jsx(Hs,{className:"h-4 w-4 mr-2"}),"Add identifier"]})]}):T.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:T.map(s=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(d,{className:"text-xs text-muted-foreground",children:We(s.type)}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.value||"—"})]},s.id))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"—"})]})]})]}),e.jsx(ps,{open:I!==null,onOpenChange:s=>{s||ie()},children:e.jsxs(js,{children:[e.jsxs(fs,{children:[e.jsx(vs,{children:"This change affects your plan pricing"}),e.jsx(ys,{children:I??"Your plan is priced for your current primary country. Switch your plan to international pricing first, then change the country."})]}),e.jsxs(Ns,{children:[e.jsx(bs,{onClick:ie,children:"Keep current country"}),e.jsx(ws,{onClick:()=>_("/app/company/billing"),children:"Go to Billing"})]})]})})]})},ve="__none__";
1function ga(r){const j=(r.designation??"").trim();if(j)return j;const F=new Set(["team member",(r.roleCategory??"").toLowerCase()]),x=(r.positionTitle??"").trim();return x&&!F.has(x.toLowerCase())?x:""}const pa=({organizationId:r,isEditMode:j})=>{const{user:F}=Pe(),{getToken:x}=Es(),{toast:_}=Ne(),[o,E]=u.useState([]),[Y,D]=u.useState(null),[B,P]=u.useState(!0),[X,I]=u.useState(!1),[Z,a]=u.useState(!1),[t,T]=u.useState(null),[O,ae]=u.useState(!1),[re,y]=u.useState(null),[Q,te]=u.useState(ve),[ie,ce]=u.useState(ve),[s,N]=u.useState(null),[R,ee]=u.useState(null),[pe,le]=u.useState(!1),de=u.useCallback(async i=>{if(i.userId){N(i),ee(null),le(!0);try{const p=await x(),S=await fetch(`/api/shared/member-experience?memberUserId=${encodeURIComponent(i.userId)}`,{headers:se(p)}),U=await S.json();S.ok&&U.success?ee(U.data):ee({hasAny:!1,totalHours:0,distinctClients:0,topWorkTypes:[],topIndustries:[],topSectors:[],topJurisdictions:[]})}catch(p){console.error("Error loading member experience:",p),ee({hasAny:!1,totalHours:0,distinctClients:0,topWorkTypes:[],topIndustries:[],topSectors:[],topJurisdictions:[]})}finally{le(!1)}}},[x]),[v,n]=u.useState({userId:"",externalName:"",positionTitle:"",roleCategory:"employee",isFounder:!1,department:"",externalLinkedinUrl:"",externalBio:"",externalPhotoUrl:"",joinedDate:"",displayOrder:0}),m=u.useCallback(async()=>{if(r)try{P(!0);const i=await x(),p=await fetch("/api/m02/team",{method:"GET",headers:{...se(i),"Content-Type":"application/json"}});if(!p.ok)throw new Error("Failed to load team");const S=await p.json();if(S.success){const U=S.data.team||[];E(U.filter(be=>(be.status??"active")==="active")),D(S.data.summary)}}catch(i){console.error("Error loading team:",i),_({title:"Couldn't load team members",description:"Try again, or refresh the page.",variant:"destructive"})}finally{P(!1)}},[r,F,_]);u.useEffect(()=>{m()},[m]);const k=async()=>{if(!v.positionTitle||!v.roleCategory){_({title:"Position details needed",description:"Enter a position title and choose a role category",variant:"destructive"});return}if(!v.userId&&!v.externalName){_({title:"Team member needed",description:"Add a FinPera user or enter the person's name",variant:"destructive"});return}try{ae(!0);const i=await x(),p=await fetch("/api/m02/team",{method:"POST",headers:{...se(i),"Content-Type":"application/json"},body:JSON.stringify(v)});if(!p.ok)throw new Error("Failed to add team member");(await p.json()).success&&(_({title:"Team member added"}),I(!1),L(),await m())}catch(i){console.error("Error adding team member:",i),_({title:"Couldn't add team member",description:"Try again in a moment. Nothing was saved.",variant:"destructive"})}finally{ae(!1)}},c=async()=>{if(!t)return;if(!t.isFinPeraUser){_({title:"Not available yet",description:"External profile editing isn't supported yet.",variant:"destructive"});return}const i=v.positionTitle.trim(),p=Q!==ie,S=Q===ve?null:Q;try{ae(!0);const U=await x(),be={memberId:t.id,designation:i};p&&(be.reportsToMemberId=S);const qe=await fetch("/api/m02/team",{method:"PATCH",headers:{...se(U),"Content-Type":"application/json"},body:JSON.stringify(be)}),Be=await qe.json().catch(()=>({}));if(!qe.ok||Be.success===!1)throw new Error(Be.error||"Failed to update team member");_({title:"Success",description:"Team member updated successfully"}),E(hs=>hs.map(we=>we.id===t.id?{...we,positionTitle:i||we.positionTitle,...p?{reportsToMemberId:S}:{}}:we)),a(!1),T(null),L()}catch(U){console.error("Error updating team member:",U),_({title:"Couldn't update team member",description:"Try again in a moment. Nothing was saved.",variant:"destructive"})}finally{ae(!1)}},l=async i=>{if(re!==i){y(i),_({title:"Confirm removal",description:"Click remove again to confirm."}),setTimeout(()=>y(null),3e3);return}y(null);try{const p=await x(),S=await fetch(`/api/m02/team?id=${i}`,{method:"DELETE",headers:{...se(p),"Content-Type":"application/json"}});if(!S.ok)throw new Error("Failed to remove team member");(await S.json()).success&&(_({title:"Team member removed"}),await m())}catch(p){console.error("Error removing team member:",p),_({title:"Couldn't remove team member",description:"Try again in a moment.",variant:"destructive"})}},g=i=>{T(i),n({userId:i.userId||"",externalName:i.isFinPeraUser?"":i.name,positionTitle:ga(i),roleCategory:i.roleCategory,isFounder:i.isFounder,department:i.department||"",externalLinkedinUrl:i.isFinPeraUser?"":i.linkedin||"",externalBio:i.isFinPeraUser?"":i.bio||"",externalPhotoUrl:i.isFinPeraUser?"":i.avatar||"",joinedDate:i.joinedDate||"",displayOrder:i.displayOrder});const p=i.reportsToMemberId??ve;te(p),ce(p),a(!0)},L=()=>{n({userId:"",externalName:"",positionTitle:"",roleCategory:"employee",isFounder:!1,department:"",externalLinkedinUrl:"",externalBio:"",externalPhotoUrl:"",joinedDate:"",displayOrder:0})},C=i=>{switch(i){case"executive":return e.jsx(Ae,{className:"h-4 w-4"});case"board":return e.jsx(ye,{className:"h-4 w-4"});case"advisor":return e.jsx(De,{className:"h-4 w-4"});default:return e.jsx(oe,{className:"h-4 w-4"})}},W=i=>{switch(i){case"executive":return"default";case"board":return"secondary";case"advisor":return"outline";default:return"secondary"}},je=i=>i.split(" ").map(p=>p[0]).join("").toUpperCase().slice(0,2);return B?e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[...Array(4)].map((i,p)=>e.jsx(b,{children:e.jsx(w,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(f,{className:"h-4 w-24 mb-2"}),e.jsx(f,{className:"h-9 w-12"})]}),e.jsx(f,{className:"h-8 w-8 rounded"})]})})},p))}),e.jsxs(b,{children:[e.jsx(M,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(f,{className:"h-6 w-36 mb-2"}),e.jsx(f,{className:"h-4 w-64"})]}),e.jsx(f,{className:"h-10 w-40"})]})}),e.jsx(w,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((i,p)=>e.jsx(b,{children:e.jsx(w,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(f,{className:"h-16 w-16 rounded-full"}),e.jsxs("div",{className:"flex-1",children:[e.jsx(f,{className:"h-5 w-32 mb-2"}),e.jsx(f,{className:"h-4 w-24 mb-3"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx(f,{className:"h-5 w-20 rounded-full"}),e.jsx(f,{className:"h-5 w-16 rounded-full"})]})]})]})})},p))})})]})]}):e.jsxs("div",{className:"space-y-6",children:[Y&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx(b,{children:e.jsx(w,{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",children:"Total Members"}),e.jsx("p",{className:"text-3xl font-bold",children:Y.totalMembers})]}),e.jsx(oe,{className:"h-8 w-8 text-muted-foreground"})]})})}),e.jsx(b,{children:e.jsx(w,{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",children:"Executives"}),e.jsx("p",{className:"text-3xl font-bold",children:Y.byRole.executive})]}),e.jsx(Ae,{className:"h-8 w-8 text-muted-foreground"})]})})}),e.jsx(b,{children:e.jsx(w,{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",children:"Board Members"}),e.jsx("p",{className:"text-3xl font-bold",children:Y.byRole.board})]}),e.jsx(ye,{className:"h-8 w-8 text-muted-foreground"})]})})}),e.jsx(b,{children:e.jsx(w,{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",children:"Founders"}),e.jsx("p",{className:"text-3xl font-bold",children:Y.founders})]}),e.jsx(Me,{className:"h-8 w-8 text-muted-foreground"})]})})})]}),e.jsxs(b,{children:[e.jsx(M,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(oe,{className:"h-5 w-5"}),"Team Members"]}),e.jsx(V,{children:"Manage your company's team members and leadership"})]}),j&&e.jsxs(A,{onClick:()=>I(!0),className:"gap-2",children:[e.jsx(Ke,{className:"h-4 w-4"}),"Add Team Member"]})]})}),e.jsx(w,{children:o.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(oe,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"No team members added yet"}),j&&e.jsxs(A,{onClick:()=>I(!0),variant:"outline",className:"gap-2",children:[e.jsx(Ke,{className:"h-4 w-4"}),"Add Your First Team Member"]})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:e.jsx(oa,{children:o.map(i=>e.jsx(ue.div,{initial:{opacity:0,scale:.95}
1,animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.2},children:e.jsx(b,{className:"hover:shadow-md transition-shadow",children:e.jsx(w,{className:"pt-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsxs(Cs,{className:"h-16 w-16",children:[e.jsx(Ss,{src:i.avatar,alt:i.name}),e.jsx(_s,{className:"text-lg",children:je(i.name)})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"font-semibold truncate",children:i.name}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:i.positionTitle})]}),j&&e.jsxs("div",{className:"flex gap-1",children:[e.jsx(A,{variant:"ghost",size:"sm",onClick:()=>g(i),children:e.jsx(Js,{className:"h-3 w-3"})}),e.jsx(A,{variant:"ghost",size:"sm",onClick:()=>l(i.id),children:e.jsx(Gs,{className:"h-3 w-3 text-destructive"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 mt-2",children:[e.jsxs(xe,{variant:W(i.roleCategory),children:[C(i.roleCategory),e.jsx("span",{className:"ml-1 text-xs capitalize",children:i.roleCategory})]}),i.isFounder&&e.jsxs(xe,{variant:"default",className:"gap-1",children:[e.jsx(Me,{className:"h-3 w-3"}),"Founder"]}),i.isFinPeraUser&&e.jsx(xe,{variant:"outline",className:"text-xs",children:"FinPera User"})]}),i.bio&&e.jsx("p",{className:"text-xs text-muted-foreground mt-2 line-clamp-2",children:i.bio}),e.jsxs("div",{className:"flex items-center gap-3 mt-3",children:[i.linkedin&&e.jsx("a",{href:i.linkedin,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(Ws,{className:"h-4 w-4"})}),i.joinedDate&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(Ks,{className:"h-3 w-3"}),"Joined ",new Date(i.joinedDate).getFullYear()]})]}),i.userId&&e.jsxs(A,{variant:"ghost",size:"sm",onClick:()=>de(i),className:"mt-2 h-7 gap-1 px-2 text-xs text-gray-11",children:[e.jsx(Xe,{className:"h-3 w-3"}),"View experience"]})]})]})})})},i.id))})})})]}),e.jsx(_e,{open:X,onOpenChange:I,children:e.jsxs(ke,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Te,{children:[e.jsx(Ie,{children:"Add Team Member"}),e.jsx(Le,{children:"Add a FinPera user or create an external profile"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{children:"Profile Type"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(b,{className:"cursor-pointer hover:border-primary transition-colors",children:e.jsx(w,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(he,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"font-medium",children:"FinPera User"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Link to existing user"})]})})}),e.jsx(b,{className:"cursor-pointer hover:border-primary transition-colors",children:e.jsx(w,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Xs,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),e.jsx("p",{className:"font-medium",children:"External Profile"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Create new profile"})]})})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"externalName",children:"Full Name *"}),e.jsx(z,{id:"externalName",value:v.externalName,onChange:i=>n({...v,externalName:i.target.value}),placeholder:"Full name"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"positionTitle",children:"Position Title *"}),e.jsx(z,{id:"positionTitle",value:v.positionTitle,onChange:i=>n({...v,positionTitle:i.target.value}),placeholder:"CEO, CTO, Board Member, etc."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"roleCategory",children:"Role Category *"}),e.jsxs($,{value:v.roleCategory,onValueChange:i=>n({...v,roleCategory:i}),children:[e.jsx(H,{children:e.jsx(J,{})}),e.jsxs(G,{children:[e.jsx(h,{value:"executive",children:"Executive"}),e.jsx(h,{value:"board",children:"Board Member"}
1),e.jsx(h,{value:"advisor",children:"Advisor"}),e.jsx(h,{value:"employee",children:"Employee"})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"department",children:"Department"}),e.jsx(z,{id:"department",value:v.department,onChange:i=>n({...v,department:i.target.value}),placeholder:"Engineering, Finance, etc."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"joinedDate",children:"Joined Date"}),e.jsx(da,{value:v.joinedDate??"",onChange:i=>n({...v,joinedDate:i}),clearable:!0,"aria-label":"Joined Date"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"externalLinkedinUrl",children:"LinkedIn URL"}),e.jsx(z,{id:"externalLinkedinUrl",value:v.externalLinkedinUrl,onChange:i=>n({...v,externalLinkedinUrl:i.target.value}),placeholder:"https://linkedin.com/in/username"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"externalBio",children:"Bio"}),e.jsx(Re,{id:"externalBio",value:v.externalBio,onChange:i=>n({...v,externalBio:i.target.value}),placeholder:"Brief professional bio...",rows:3})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ve,{id:"isFounder",checked:v.isFounder,onCheckedChange:i=>n({...v,isFounder:i===!0})}),e.jsx(d,{htmlFor:"isFounder",className:"cursor-pointer",children:"Mark as Founder"})]})]}),e.jsxs($e,{children:[e.jsx(A,{variant:"outline",onClick:()=>I(!1),children:"Cancel"}),e.jsx(A,{onClick:k,disabled:O,children:O?e.jsxs(e.Fragment,{children:[e.jsx(Ze,{className:"h-4 w-4 mr-2 animate-spin"}),"Adding..."]}):"Add Team Member"})]})]})}),e.jsx(_e,{open:Z,onOpenChange:a,children:e.jsxs(ke,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Te,{children:[e.jsx(Ie,{children:"Edit Team Member"}),e.jsx(Le,{children:"Update team member information"})]}),e.jsxs("div",{className:"space-y-4",children:[t?.isFinPeraUser?e.jsx("div",{className:"bg-muted/50 p-4 rounded-lg",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This is a FinPera user. Profile information is managed by the user. You can update their designation and who they report to here."})}):e.jsx("div",{className:"bg-muted/50 p-4 rounded-lg",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"External profile editing isn't available yet - this member can't be saved from this dialog."})}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"editPositionTitle",children:"Designation"}),e.jsx(z,{id:"editPositionTitle",placeholder:"e.g. VP Finance, Company Secretary",value:v.positionTitle,onChange:i=>n({...v,positionTitle:i.target.value}),disabled:!t?.isFinPeraUser})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"editReportsTo",children:"Reports to"}),e.jsxs($,{value:Q,onValueChange:te,disabled:!t?.isFinPeraUser,children:[e.jsx(H,{id:"editReportsTo",children:e.jsx(J,{})}),e.jsxs(G,{children:[e.jsx(h,{value:ve,children:"No one (top of chart)"}),o.filter(i=>i.id!==t?.id).map(i=>e.jsx(h,{value:i.id,children:i.name},i.id))]})]})]})]}),e.jsxs("div",{className:"space-y-3 rounded-lg border border-dashed border-border p-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Extended profile fields are coming soon - role category, department, and founder status aren't saved by this dialog yet."}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"editRoleCategory",children:"Role Category"}),e.jsxs($,{value:v.roleCategory,disabled:!0,children:[e.jsx(H,{children:e.jsx(J,{})}),e.jsxs(G,{children:[e.jsx(h,{value:"executive",children:"Executive"}),e.jsx(h,{value:"board",children:"Board Member"}),e.jsx(h,{value:"advisor",children:"Advisor"}),e.jsx(h,{value:"employee",children:"Employee"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"editDepartment",children:"Department"}),e.jsx(z,{id:"editDepartment",value:v.department,disabled:!0})]})]}),!t?.isFinPeraUser&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"editLinkedinUrl",children:"LinkedIn URL"}),e.jsx(z,{id:"editLinkedinUrl",value:v.externalLinkedinUrl,disabled:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{htmlFor:"editBio",children:"Bio"}),e.jsx(Re,{id:"editBio",value:v.externalBio,rows:3,disabled:!0})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ve,{id:"editIsFounder",checked:v.isFounder,disabled:!0}),e.jsx(d,{htmlFor:"editIsFounder",className:"cursor-pointer text-muted-foreground",children:"Mark as Founder"})]})]})]}),e.jsxs($e,{children:[e.jsx(A,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(A,{onClick:c,disabled:O||!t?.isFinPeraUser,children:O?e.jsxs(e.Fragment,{children:[e.jsx(Ze,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})}),e.jsx(_e,{open:!!s,onOpenChange:i=>{i||N(null)},children:e.jsxs(ke,{className:"max-w-lg",children:[e.jsxs(Te,{children:[e.jsxs(Ie,{className:"flex items-center gap-2",children:[e.jsx(Xe,{className:"h-4 w-4"}),"Experience ",s?`- ${s.name}`:""]}),e.jsx(Le,{children:"Learned from completed work"})]}),pe?e.jsxs("div",{className:"space-y-3 py-2",children:[e.jsx(f,{className:"h-5 w-40"}),e.jsx(f,{className:"h-16 w-full"}),e.jsx(f,{className:"h-16 w-full"})]}):!R||!R.hasAny?e.jsx("div",{className:"py-8 text-center text-sm text-gray-11",children:"No completed-work signal yet"}):e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 text-sm text-gray-11",children:[e.jsxs("span",{children:[R.distinctClients," client",R.distinctClients===1?"":"s"]}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:[R.totalHours," hrs"]})]}),[{label:"Work types",facets:R.topWorkTypes},{label:"Industries",facets:R.topIndustries},{label:"Sectors",facets:R.topSectors},{label:"Jurisdictions",facets:R.topJurisdictions}].filter(i=>i.facets.length>0).map(i=>e.jsxs("div",{children:[e.jsx("p",{className:"mb-1.5 text-xs font-medium text-gray-11",children:i.label}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.facets.map(p=>e.jsxs(xe,{variant:"secondary",className:"font-normal",children:[p.value,p.count>1&&e.jsxs("span",{className:"ml-1 text-gray-11",children:["×",p.count]})]},p.value))})]},i.label))]})]})})]})},ja=({companyData:r,onUpdate:j})=>{const{toast:F}=Ne(),[x,_]=u.useState(!1),[o,E]=u.useState({notifications:{compliance_deadlines:r.settings?.notifications?.compliance_deadlines??!0,financial_updates:r.settings?.notifications?.financial_updates??!0,team_changes:r.settings?.notifications?.team_changes??!0,ai_suggestions:r.settings?.notifications?.ai_suggestions??!0,security_alerts:r.settings?.notifications?.security_alerts??!0,system_maintenance:r.settings?.notifications?.system_maintenance??!0,weekly_digest:r.settings?.notifications?.weekly_digest??!0,monthly_report:r.settings?.notifications?.monthly_report??!0},communication:{email_enabled:r.settings?.communication?.email_enabled??!0,in_app_enabled:r.settings?.communication?.in_app_enabled??!0,sms_enabled:r.settings?.communication?.sms_enabled??!1,slack_integration:r.settings?.communication?.slack_integration??!1,teams_integration:r.settings?.communication?.teams_integration??!1,notification_frequency:r.settings?.communication?.notification_frequency??"real_time"},features:{ai_assistance:r.settings?.features?.ai_assistance??!0,beta_features:r.settings?.features?.beta_features??!1,advanced_analytics:r.settings?.features?.advanced_analytics??!0,api_access:r.settings?.features?.api_access??!1,white_labeling:r.settings?.features?.white_labeling??!1,custom_branding:r.settings?.features?.custom_branding??!0},security:{two_factor_auth:r.settings?.security?.two_factor_auth??!1,session_timeout:r.settings?.security?.session_timeout??120,ip_restrictions:r.settings?.security?.ip_restrictions??!1,audit_logging:r.settings?.security?.audit_logging??!0,data_encryption:r.settings?.security?.data_encryption??!0,automatic_backups:r.settings?.security?.automatic_backups??!0},data:{retention_period:r.settings?.data?.retention_period??7,automatic_cleanup:r.settings?.data?.automatic_cleanup??!0,data_export_format:r.settings?.data?.data_export_format??"json",backup_frequency:r.settings?.data?.backup_frequency??"daily"},regional:{timezone:Ts(r.settings?.regional?.timezone)||ks,number_format:r.settings?.regional?.number_format??"US",fiscal_year_start:r.settings?.regional?.fiscal_year_start??"January"}}),Y=["January","February","March","April","May","June","July","August","September","October","November","December"],D=async()=>{try{j({settings:o}),_(!1),F({title:"Platform settings updated"})}catch(t){console.error("Error updating platform settings:",t),F({title:"Couldn't save settings",description:"Try again in a moment. Nothing was saved.",variant:"destructive"})}},B=(t,T)=>{E({...o,notifications:{...o.notifications,[t]:T}})},P=(t,T)=>{E({...o,communication:{...o.communication,[t]:T}})},X=(t,T)=>{E({...o,features:{...o.features,[t]:T}})},I=(t,T)=>{E({...o,security:{...o.security,[t]:T}})},Z=(t,T)=>{E({...o,data:{...o.data,[t]:T}})},a=(t,T)=>{E({...o,regional:{...o.regional,[t]:T}})};return 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-2xl font-bold text-foreground",children:"Platform Settings"}),e.jsx("p",{className:"text-muted-foreground",children:"Configure notifications, features, and platform preferences"})]}),e.jsx("div",{className:"flex gap-2",children:x?e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"outline",onClick:()=>_(!1),children:"Cancel"}),e.jsxs(A,{onClick:D,children:[e.jsx(os,{className:"h-4 w-4 mr-2"}),"Save Settings"]})]}):e.jsxs(A,{onClick:()=>_(!0),children:[e.jsx(Zs,{className:"h-4 w-4 mr-2"}),"Edit Settings"]})})]}),e.jsxs(ls,{defaultValue:"notifications",className:"w-full",children:[e.jsxs(Is,{className:"grid w-full grid-cols-6",children:[e.jsx(me,{value:"notifications",children:"Notifications"}),e.jsx(me,{value:"features",children:"Features"}),e.jsx(me,{value:"security",children:"Security"}),e.jsx(me,{value:"data",children:"Data"}),e.jsx(me,{value:"regional",children:"Regional"}),e.jsx(me,{value:"integrations",children:"Integrations"})]}),e.jsx(ne,{value:"notifications",className:"space-y-4",children:e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(Qe,{className:"h-5 w-5"}),"Notification Preferences"]}),e.jsx(V,{children:"Configure when and how you receive notifications"})]}),e.jsxs(w,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Notification Categories"}),e.jsx("div",{className:"space-y-3",children:Object.entries({compliance_deadlines:"Compliance Deadlines",financial_updates:"Financial Data Updates",team_changes:"Team Changes",ai_suggestions:"AI Suggestions",security_alerts:"Security Alerts",system_maintenance:"System Maintenance"}).map(([t,T])=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(d,{className:"font-medium",children:T}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[t==="compliance_deadlines"&&"Get notified about upcoming compliance deadlines",t==="financial_updates"&&"Receive updates when financial data is modified",t==="team_changes"&&"Get notified when team members are added or removed",t==="ai_suggestions"&&"Receive AI-powered insights and recommendations",t==="security_alerts"&&"Critical security notifications and alerts",t==="system_maintenance"&&"System maintenance and update notifications"]})]}),e.jsx(K,{checked:o.notifications[t],onCheckedChange:O=>B(t,O),disabled:!x})]},t))})]}),e.jsx(is,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Digest Reports"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(d,{className:"font-medium",children:"Weekly Digest"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Weekly summary of platform activity"})]}),e.jsx(K,{checked:o.notifications.weekly_digest,onCheckedChange:t=>B("weekly_digest",t),disabled:!x})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(d,{className:"font-medium",children:"Monthly Report"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Comprehensive monthly anal
1ytics report"})]}),e.jsx(K,{checked:o.notifications.monthly_report,onCheckedChange:t=>B("monthly_report",t),disabled:!x})]})]})]}),e.jsx(is,{}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Communication Channels"}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(Qs,{className:"h-4 w-4"}),"Email Notifications"]}),e.jsx(K,{checked:o.communication.email_enabled,onCheckedChange:t=>P("email_enabled",t),disabled:!x})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(Qe,{className:"h-4 w-4"}),"In-App Notifications"]}),e.jsx(K,{checked:o.communication.in_app_enabled,onCheckedChange:t=>P("in_app_enabled",t),disabled:!x})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(ea,{className:"h-4 w-4"}),"SMS Notifications"]}),e.jsx(K,{checked:o.communication.sms_enabled,onCheckedChange:t=>P("sms_enabled",t),disabled:!x})]})]}),e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{children:[e.jsx(d,{children:"Notification Frequency"}),e.jsxs($,{value:o.communication.notification_frequency,onValueChange:t=>P("notification_frequency",t),disabled:!x,children:[e.jsx(H,{children:e.jsx(J,{})}),e.jsxs(G,{children:[e.jsx(h,{value:"real_time",children:"Real-time"}),e.jsx(h,{value:"hourly",children:"Hourly digest"}),e.jsx(h,{value:"daily",children:"Daily digest"}),e.jsx(h,{value:"weekly",children:"Weekly summary"})]})]})]})})]})]})]})]})}),e.jsx(ne,{value:"features",className:"space-y-4",children:e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(sa,{className:"h-5 w-5"}),"Feature Management"]}),e.jsx(V,{children:"Enable or disable platform features and modules"})]}),e.jsx(w,{className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Core Features"}),e.jsx("div",{className:"space-y-3",children:Object.entries({ai_assistance:"AI-Powered Assistance",advanced_analytics:"Advanced Analytics",api_access:"API Access",custom_branding:"Custom Branding"}).map(([t,T])=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{className:"font-medium",children:T}),e.jsx(K,{checked:o.features[t],onCheckedChange:O=>X(t,O),disabled:!x})]},t))})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Advanced Features"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(d,{className:"font-medium",children:"Beta Features"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Access to experimental features"})]}),e.jsx(K,{checked:o.features.beta_features,onCheckedChange:t=>X("beta_features",t),disabled:!x})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(d,{className:"font-medium",children:"White Label Mode"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Remove FinPera branding"})]}),e.jsx(K,{checked:o.features.white_labeling,onCheckedChange:t=>X("white_labeling",t),disabled:!x})]})]})]})]})})]})}),e.jsx(ne,{value:"security",className:"space-y-4",children:e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(ye,{className:"h-5 w-5"}),"Security Settings"]}),e.jsx(V,{children:"Configure security and access control settings"})]}),e.jsx(w,{className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Authentication"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(d,{className:"font-medium",children:"Two-Factor Authentication"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Require 2FA for all users"})]}),e.jsx(K,{checked:o.security.two_factor_auth,onCheckedChange:t=>I("two_factor_auth",t),disabled:!x})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(d,{children:"Session Timeout (minutes)"}),e.jsxs($,{value:o.security.session_timeout.toString(),onValueChange:t=>I("session_timeout",parseInt(t)),disabled:!x,children:[e.jsx(H,{children:e.jsx(J,{})}),e.jsxs(G,{children:[e.jsx(h,{value:"30",children:"30 minutes"}),e.jsx(h,{value:"60",children:"1 hour"}),e.jsx(h,{value:"120",children:"2 hours"}),e.jsx(h,{value:"240",children:"4 hours"}),e.jsx(h,{value:"480",children:"8 hours"})]})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Data Protection"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{className:"font-medium",children:"IP Restrictions"}),e.jsx(K,{checked:o.security.ip_restrictions,onCheckedChange:t=>I("ip_restrictions",t),disabled:!x})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{className:"font-medium",children:"Audit Logging"}),e.jsx(K,{checked:o.security.audit_logging,onCheckedChange:t=>I("audit_logging",t),disabled:!x})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{className:"font-medium",children:"Data Encryption"}),e.jsx(K,{checked:o.security.data_encryption,onCheckedChange:t=>I("data_encryption",t),disabled:!x})]})]})]})]})})]})}),e.jsx(ne,{value:"data",className:"space-y-4",children:e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(aa,{className:"h-5 w-5"}),"Data Management"]}),e.jsx(V,{children:"Configure data retention, backups, and export settings"})]}),e.jsx(w,{className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Data Retention"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(d,{children:"Retention Period (years)"}),e.jsxs($,{value:o.data.retention_period.toString(),onValueChange:t=>Z("retention_period",parseInt(t)),disabled:!x,children:[e.jsx(H,{children:e.jsx(J,{})}),e.jsxs(G,{children:[e.jsx(h,{value:"1",children:"1 year"}),e.jsx(h,{value:"3",children:"3 years"}),e.jsx(h,{value:"5",children:"5 years"}),e.jsx(h,{value:"7",children:"7 years"}),e.jsx(h,{value:"10",children:"10 years"})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(d,{className:"font-medium",children:"Automatic Cleanup"}),e.jsx(K,{checked:o.data.automatic_cleanup,onCheckedChange:t=>Z("automatic_cleanup",t),disabled:!x})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Backups & Export"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(d,{children:"Backup Frequency"}),e.jsxs($,{value:o.data.backup_frequency,onValueChange:t=>Z("backup_frequency",t),disabled:!x,children:[e.jsx(H,{children:e.jsx(J,{})}),e.jsxs(G,{children:[e.jsx(h,{value:"hourly",children:"Hourly"}),e.jsx(h,{value:"daily",children:"Daily"}),e.jsx(h,{value:"weekly",children:"Weekly"}),e.jsx(h,{value:"monthly",children:"Monthly"})]})]})]}),e.jsxs("div",{children:[e.jsx(d,{children:"Export Format"}),e.jsxs($,{value:o.data.data_export_format,onValueChange:t=>Z("data_export_format",t),disabled:!x,children:[e.jsx(H,{children:e.jsx(J,{})}),e.jsxs(G,{children:[e.jsx(h,{value:"json",children:"JSON"}),e.jsx(h,{value:"csv",children:"CSV"}),e.jsx(h,{value:"xlsx",children:"Excel"}),e.jsx(h,{value:"pdf",children:"PDF"})]})]})]})]})]})]})})]})}),e.jsx(ne,{value:"regional",className:"space-y-4",children:e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(ge,{className:"h-5 w-5"}),"Regional Settings"]}),e.jsx(V,{children:"Configure timezone, number formatting, and fiscal year"})]}),e.jsx(w,{className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Localization"}),e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{children:[e.jsx(d,{htmlFor:"company-timezone",children:"Timezone"}),e.jsx(ma,{id:"company-timezone",value:o.regional.timezone,onValueChange:t=>a("timezone",t),disabled:!x})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Format Preferences"}),e.jsx("div",{className:"space-y-3",children:e.jsxs("div",{children:[e.jsx(d,{children:"Fiscal Year Start"}),e.jsxs($,{value:o.regional.fiscal_year_start,onValueChange:t=>a("fiscal_year_start",t),disabled:!x,children:[e.jsx(H,{children:e.jsx(J,{})}),e.jsx(G,{children:Y.map(t=>e.jsx(h,{value:t,children:t},t))})]})]})})]})]})})]})}),e.jsx(ne,{value:"integrations",className:"space-y-4",children:e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(us,{className:"h-5 w-5"}),"Third-Party Integrations"]}),e.jsx(V,{children:"Configure integrations with external services"})]}),e.jsx(w,{className:"space-y-6",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h4",{className:"font-medium",children:"Communication"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(d,{className:"font-medium",children:"Slack Integration"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Send notifications to Slack"})]}),e.jsx(K,{checked:o.communication.slack_integration,onCheckedChange:t=>P("slack_integration",t),disabled:!x})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(d,{className:"font-medium",children:"Microsoft Teams"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Send notifications to Teams"})]}),e.jsx(K,{checked:o.communication.teams_integration,onCheckedChange:t=>P("teams_integration",t),disabled:!x})]})]})]})})})]})})]})]})},Ja=({embedded:r=!1,canEdit:j=!1})=>{const{user:F,loading:x,getToken:_}=Pe(),{toast:o}=Ne(),[E,Y]=u.useState("overview"),[D,B]=u.useState(null),[P,X]=u.useState(!0),[I,Z]=u.useState(0),[a,t]=u.useState([]),[T,O]=u.useState([]),[ae,re]=u.useState([]),y=u.useCallback(async()=>
1{if(F?.activeMembership?.organizationId)try{X(!0);const n=await _();if(!n)throw new Error("Authentication required");const k=await(await fetch(`/api/company/dashboard/${F.activeMembership.organizationId}`,{headers:se(n)})).json();if(!k.success||!k.data)throw new Error(k.error||"Company not found");const c=k.data.company??k.data,l={id:c.id,name:c.name,legalName:c.legalName||c.name,legal_name:c.legalName||c.name,industry:c.industry||"",fundingStage:c.fundingStage||"",funding_stage:c.fundingStage||"",companySize:c.companySize||"",company_stage:c.companySize||"",description:c.description||"",website:c.website||"",foundedYear:c.foundedYear||void 0,headquarters:c.headquarters||"",employee_count:c.employeeCount||null,revenue_range:c.revenueRange||"",headquarters_address:c.headquartersAddress||null,incorporation_details:c.incorporationDetails||null,registration_numbers:c.registrationNumbers||null,financial_details:c.financialDetails||null,contact_information:c.contactInformation||null,branding:c.branding||null,documents:c.documents||[],team_members:c.teamMembers||[],locations:c.locations||[],compliance_status:c.complianceStatus||null,created_at:c.createdAt||new Date().toISOString(),updated_at:c.updatedAt||new Date().toISOString()};if(r)try{const g=await fetch("/api/m02/company-profile",{headers:se(n)});if(g.ok){const C=(await g.json())?.data?.profile;C&&(l.legalName=C.legalName||l.legalName,l.legal_name=C.legalName||l.legal_name,l.tagline=C.tagline||"",l.elevatorPitch=C.elevatorPitch||"",l.businessModel=C.businessModel||"",l.revenueModel=C.revenueModel||"",l.headquartersCountry=C.headquartersCountry||"",l.primaryCountry=C.primaryCountry||"",l.reportingCurrency=C.reportingCurrency||null,l.registrationNumber=C.registrationNumber||"",l.registeredAddress=C.registeredAddress||null,l.socialLinks=C.socialLinks||null,l.taxIds=C.taxIds||null,l.legalEntityType=C.legalEntityType||"",l.notableInvestors=C.notableInvestors||[],l.lookingFor=C.lookingFor?[C.lookingFor]:[],l.totalFundingRaised=C.totalFundingRaised?Number(C.totalFundingRaised):void 0)}}catch(g){console.error("Error loading extended company profile:",g)}B(l),Q(l),r||await Promise.all([te(l),ce(),s()])}catch(n){console.error("Error loading company data:",n),o({title:"Couldn't load company profile",description:"Try again, or refresh the page.",variant:"destructive"})}finally{X(!1)}},[F?.activeMembership?.organizationId,o,r]);u.useEffect(()=>{F?.activeMembership?.organizationId&&y()},[F?.activeMembership?.organizationId,y]);const Q=n=>{const m=["name","legal_name","industry","headquarters_address","contact_information"],k=["financial_details","incorporation_details","registration_numbers"],c=["description","website","employee_count"],l=["branding","documents"],g={essential:.4,financial:.25,operational:.2,digital:.15};let L=0;const C=m.filter(p=>{const S=n[p];return S&&(typeof S=="object"?Object.keys(S).length>0:String(S).trim())}).length/m.length,W=k.filter(p=>{const S=n[p];return S&&typeof S=="object"&&Object.keys(S).length>0}).length/k.length,je=c.filter(p=>{const S=n[p];return S&&String(S).trim()}).length/c.length,i=l.filter(p=>{const S=n[p];return S&&(Array.isArray(S)?S.length>0:typeof S=="object"&&Object.keys(S).length>0)}).length/l.length;L=(C*g.essential+W*g.financial+je*g.operational+i*g.digital)*100,Z(Math.round(L))},te=u.useCallback(async n=>{try{if(!F?.activeMembership?.organizationId)return;const m=await _();if(!m)return;const k=await fetch("/api/m02/profile-completion",{headers:{"Content-Type":"application/json",...se(m)}});if(k.ok){const l=(await k.json()).data?.sections||{},g=W=>W>=80?"text-success":W>=50?"text-warning":"text-destructive",L=W=>W>=80?"up":W>=50?"stable":"down",C=[{title:"Basic Information",value:`${l.basicInfo?.percentage||0}%`,percentage:l.basicInfo?.percentage||0,icon:he,color:g(l.basicInfo?.percentage||0),trend:L(l.basicInfo?.percentage||0)},{title:"Financial Profile",value:`${l.financials?.percentage||0}%`,percentage:l.financials?.percentage||0,icon:es,color:g(l.financials?.percentage||0),trend:L(l.financials?.percentage||0)},{title:"Branding & Online",value:`${l.branding?.percentage||0}%`,percentage:l.branding?.percentage||0,icon:ge,color:g(l.branding?.percentage||0),trend:L(l.branding?.percentage||0)},{title:"Vision & Mission",value:`${l.vision?.percentage||0}%`,percentage:l.vision?.percentage||0,icon:Ae,color:g(l.vision?.percentage||0),trend:L(l.vision?.percentage||0)},{title:"Team Structure",value:`${l.team?.count||n.team_members?.length||0}`,percentage:l.team?.percentage||0,icon:oe,color:g(l.team?.percentage||0),trend:L(l.team?.percentage||0)},{title:"Documents",value:`${l.documents?.count||0}`,percentage:l.documents?.percentage||0,icon:ye,color:g(l.documents?.percentage||0),trend:L(l.documents?.percentage||0)}];t(C)}else ie(n)}catch(m){console.error("Error loading KPI metrics:",m),ie(n)}},[_,F?.activeMembership?.organizationId]),ie=n=>{const m=i=>{const p=i.filter(S=>{const U=n[S];return U==null?!1:typeof U=="string"?U.trim()!=="":typeof U=="object"?Object.keys(U).length>0:Array.isArray(U)?U.length>0:!0});return Math.round(p.length/i.length*100)}
1,k=m(["name","legal_name","industry","company_stage","description"]),c=m(["financial_details","incorporation_details","registration_numbers"]),l=m(["branding","website"]),g=Math.min(100,(n.team_members?.length||0)/3*100),L=Math.min(100,(n.documents?.length||0)/5*100),C=i=>i>=80?"text-success":i>=50?"text-warning":"text-destructive",W=i=>i>=80?"up":i>=50?"stable":"down",je=[{title:"Basic Information",value:`${k}%`,percentage:k,icon:he,color:C(k),trend:W(k)},{title:"Financial Profile",value:`${c}%`,percentage:c,icon:es,color:C(c),trend:W(c)},{title:"Branding & Online",value:`${l}%`,percentage:l,icon:ge,color:C(l),trend:W(l)},{title:"Vision & Mission",value:`${n.description?"100":"0"}%`,percentage:n.description?100:0,icon:Ae,color:C(n.description?100:0),trend:W(n.description?100:0)},{title:"Team Structure",value:`${n.team_members?.length||0}`,percentage:g,icon:oe,color:C(g),trend:W(g)},{title:"Documents",value:`${n.documents?.length||0}`,percentage:L,icon:ye,color:C(L),trend:W(L)}];t(je)},ce=u.useCallback(async()=>{try{const n=await _();if(!n)return;const m=await fetch("/api/m02/profile-completion",{headers:{"Content-Type":"application/json",...se(n)}});if(m.ok){const c=(await m.json()).data?.sections||{},l=[];let g=1;c.basicInfo?.missing?.length>0&&l.push({id:String(g++),title:"Complete Basic Information",description:`Missing: ${c.basicInfo.missing.slice(0,3).join(", ")}`,priority:"high",category:"Profile",dueDate:new Date(Date.now()+10080*60*1e3).toISOString().split("T")[0]??"",status:"pending"}),c.branding?.missing?.length>0&&l.push({id:String(g++),title:"Complete Branding Details",description:`Missing: ${c.branding.missing.slice(0,3).join(", ")}`,priority:c.branding.missing.includes("logo_url")?"high":"medium",category:"Branding",dueDate:new Date(Date.now()+336*60*60*1e3).toISOString().split("T")[0]??"",status:"pending"}),c.team&&!c.team.isComplete&&l.push({id:String(g++),title:"Add Team Members",description:`Add at least ${c.team.minimum-(c.team.count||0)} more team member(s)`,priority:"high",category:"Team",dueDate:new Date(Date.now()+10080*60*1e3).toISOString().split("T")[0]??"",status:"in_progress"}),c.financials&&!c.financials.isComplete&&l.push({id:String(g++),title:"Add Financial Information",description:"Add funding rounds or key metrics",priority:"medium",category:"Financial",dueDate:new Date(Date.now()+336*60*60*1e3).toISOString().split("T")[0]??"",status:"pending"}),c.documents&&!c.documents.isComplete&&l.push({id:String(g++),title:"Upload Key Documents",description:`Upload at least ${c.documents.minimum-(c.documents.count||0)} more document(s)`,priority:"medium",category:"Documents",dueDate:new Date(Date.now()+504*60*60*1e3).toISOString().split("T")[0]??"",status:"pending"}),l.length===0&&l.push({id:"1",title:"Profile Complete!",description:"Your company profile is investor-ready",priority:"low",category:"Status",dueDate:new Date().toISOString().split("T")[0]??"",status:"completed"}),O(l.slice(0,5))}}catch(n){console.error("Error loading action items:",n),O([])}},[_]),s=u.useCallback(async()=>{try{const n=await _();if(!n)return;const m=await fetch("/api/m02/activity-log",{headers:{"Content-Type":"application/json",...se(n)}});if(m.ok){const l=((await m.json()).data?.activities||[]).slice(0,5).map(g=>({id:g.id,type:g.action||"update",title:g.title||N(g.action),description:g.description||"",timestamp:R(g.created_at),user:g.user_name||"System"}));re(l)}else re([])}catch(n){console.error("Error loading recent activity:",n),re([])}},[_]),N=n=>({profile_update:"Profile information updated",logo_upload:"Company logo uploaded",team_add:"Team member added",document_upload:"Document uploaded",settings_change:"Settings updated"})[n]||"Profile updated",R=n=>{const m=new Date(n),c=new Date().getTime()-m.getTime(),l=Math.floor(c/6e4),g=Math.floor(c/36e5),L=Math.floor(c/864e5);return l<60?`${l} minute${l!==1?"s":""} ago`:g<24?`${g} hour${g!==1?"s":""} ago`:L<7?`${L} day${L!==1?"s":""} ago`:Fs(m)};if(x)return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"h-20 bg-card border-b border-border rounded-xl p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(f,{className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{className:"h-5 w-48"}),e.jsx(f,{className:"h-3 w-32"})]})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(f,{className:"h-8 w-32"}),e.jsx(f,{className:"h-8 w-24"})]})]})}),e.jsx(b,{children:e.jsx(w,{className:"p-6",children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[...Array(4)].map((n,m)=>e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(f,{className:"h-16 w-16 rounded-xl"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{className:"h-8 w-20"}),e.jsx(f,{className:"h-4 w-28"})]})]},m))})})})]});if(!F||!F.activeMembership?.organizationId)return e.jsx(ca,{to:"/setup",replace:!0});const ee=n=>n>=90?"bg-success/10 text-success border-success/20":n>=70?"bg-warning/10 text-warning border-warning/20":"bg-destructive/10 text-destructive border-destructive/20",pe=n=>n>=90?e.jsx(Me,{className:"h-4 w-4"}):n>=70?e.jsx(ra,{className:"h-4 w-4"}):e.jsx(as,{className:"h-4 w-4"}),le=n=>{switch(n){case"high":return"text-destructive bg-destructive/10";case"medium":return"text-warning bg-warning/10";case"low":return"text-success bg-success/10";default:return"text-muted-foreground bg-muted/10"}};if(P||!D)return r?e.jsxs("div",{className:"space-y-4",children:[e.jsx(f,{className:"h-32 w-full"}),e.jsx(f,{className:"h-64 w-full"})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"h-20 bg-card border-b border-border rounded-xl p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(f,{className:"h-10 w-10 rounded-lg"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{className:"h-5 w-48"}),e.jsx(f,{className:"h-3 w-32"})]})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(f,{className:"h-8 w-32"}),e.jsx(f,{className:"h-8 w-24"}),e.jsx(f,{className:"h-8 w-24"})]})]})}),e.jsx(b,{children:e.jsx(w,{className:"p-6",children:e.jsx("div",{className:"grid grid-cols-4 gap-6",children:[...Array(4)].map((n,m)=>e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(f,{className:"h-16 w-16 rounded-xl"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{className:"h-8 w-20"}),e.jsx(f,{className:"h-4 w-28"})]})]},m))})})}),e.jsx("div",{className:"grid grid-cols-6 gap-4",children:[...Array(6)].map((n,m)=>e.jsx(b,{children:e.jsxs(w,{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(f,{className:"h-6 w-6 rounded"}),e.jsx(f,{className:"h-3 w-3 rounded"})]}),e.jsx(f,{className:"h-8 w-20"}),e.jsx(f,{className:"h-4 w-28"}),e.jsx(f,{className:"h-1 w-full"})]})},m))})]});const de=e.jsx(e.Fragment,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(ue.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.1},className:"h-30",children:e.jsx(b,{className:"h-full",children:e.jsx(w,{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-4 gap-6 h-full",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"bg-primary/10 p-4 rounded-xl",children:e.jsx(ss,{className:"h-8 w-8 text-link"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-3xl font-bold text-foreground",children:[e.jsx("span",{children:I}),"%"]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Profile Completion"}),e.jsxs("div",{className:"flex items-center mt-1",children:[e.jsx(De,{className:"h-3 w-3 text-success mr-1"}),e.jsx("span",{className:"text-xs text-success",children:"+5% this week"})]})]})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"bg-warning/10 dark:bg-warning/30 p-4 rounded-xl",children:e.jsx(as,{className:"h-8 w-8 text-warning"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-3xl font-bold text-foreground",children:e.jsx("span",{children:3})}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Critical Items"}),e.jsx("div",{className:"text-xs text-warning mt-1",children:"Requires attention"})]})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"bg-info/10 dark:bg-info/30 p-4 rounded-xl",children:e.jsx(ts,{className:"h-8 w-8 text-info"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"Financial Year-End"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Due in 5 days"}),e.jsx("div",{className:"text-xs text-info mt-1",children:"High priority"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-bold text-foreground",children:e.jsx("span",{children:(D?.locations?.length||0).toLocaleString()})}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Locations"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-bold text-foreground",children:e.jsx("span",{children:(D?.team_members?.length||0).toLocaleString()})}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Team Members"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-bold text-foreground",children:e.jsx("span",{children:(D?.documents?.length||0).toLocaleString()})}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Documents"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-lg font-bold text-foreground",children:[I,"%"]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Profile Complete"})]})]})]})})})}),e.jsxs(ls,{value:E,onValueChange:Y,className:"w-full",children:[e.jsx(Os,{ariaLabel:"Company profile dashboard views",value:E,onChange:Y,className:"mb-6",items:[{value:"overview",label:"Overview",icon:Ee},{value:"corporate",label:"Corporate",icon:he},{value:"team",label:"Team",icon:oe},{value:"locations",label:"Locations",icon:Fe},{value:"settings",label:"Settings",icon:us},{value:"analytics",label:"Analytics",icon:ta}]}),e.jsxs(ne,{value:"overview",className:"space-y-6",children:[e.jsx(ue.div,{variants:As.container,initial:"hidden",animate:"visible",className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-4",children:a.map((n,m)=>e.jsx(ue.div,{variants:Ps.scaleIn,children:e.jsx(b,{className:"hover-card group hover:shadow-lg transition-all duration-300 cursor-pointer",children:e.jsxs(w,{className:"p-4 flex flex-col justify-between min-h-[120px]",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(n.icon,{className:`h-6 w-6 ${n.color}`}),n.trend&&e.jsx(De,{className:`h-3 w-3 ${n.trend==="up"?"text-success":n.trend==="down"?"text-destructive":"text-muted-foreground"}`})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-foreground",children:n.value}),e.jsx("div",{className:"text-sm text-muted-foreground",children:n.title}),e.jsx(Ce,{value:n.percentage,className:"h-1 mt-2"})]})]})})},m))}),e.jsxs(ue.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.3},className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs(b,{className:"lg:col-span-2",children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(ge,{className:"h-5 w-5 text-link"}),"Global Presence"]}),e.jsx(V,{children:"Company locations and registrations worldwide"})]}),e.jsx(w,{className:"min-h-[280px] flex items-center justify-center bg-muted/20 rounded-lg",children:e.jsxs("div",{className:"text-center text-muted-foreground",children:[e.jsx(ge,{className:"h-16 w-16 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"Interactive world map visualization"}),e.jsx("p",{className:"text-sm",children:"Showing presence in 2 countries"})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-1 gap-4",children:[e.jsxs(b,{children:[e.jsx(M,{className:"pb-2",children:e.jsx(q,{className:"text-sm",children:"Industry Classification"})}),e.jsx(w,{className:"flex items-center justify-center py-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center mx-auto mb-2",children:e.jsx(he,{className:"h-6 w-6 text-link"})}),e.jsx("div",{className:"text-sm font-medium",children:"Technology"}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"SaaS Platform"})]})})]}),e.jsxs(b,{children:[e.jsx(M,{className:"pb-2",children:e.jsx(q,{className:"text-sm",children:"Team Composition"})}),e.jsxs(w,{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Engineering"}),e.jsx("span",{className:"text-xs font-medium",children:"60%"})]}),e.jsx(Ce,{value:60,className:"h-1"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Business"}),e.jsx("span",{className:"text-xs font-medium",children:"25%"})]}),e.jsx(Ce,{value:25,className:"h-1"}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Operations"}),e.jsx("span",{className:"text-xs font-medium",children:"15%"})]}),e.jsx(Ce,{value:15,className:"h-1"})]})]})]})]}),e.jsxs(ue.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.4},className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(ss,{className:"h-5 w-5 text-link"}),"Action Items"]}),e.jsx(V,{children:"Prioritized tasks to improve your profile"})]}),e.jsx(w,{className:"space-y-3 max-h-52 overflow-y-auto",children:T.map(n=>e.jsx("div",{className:"p-3 border border-border rounded-lg hover:bg-muted/50 transition-colors",children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm",children:n.title}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:n.description}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx(xe,{variant:"outline",className:`text-xs ${le(n.priority)}`,children:ua(n.priority)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Due: ",n.dueDate]})]})]}),e.jsx(A,{variant:"ghost",size:"sm",children:e.jsx(ms,{className:"h-4 w-4"})})]})},n.id))})]}),e.jsxs(b,{children:[e.jsxs(M,{children:[e.jsxs(q,{className:"flex items-center gap-2",children:[e.jsx(ts,{className:"h-5 w-5 text-link"}),"Recent Activity"]}),e.jsx(V,{children:"Latest updates and changes"})]}),e.jsx(w,{className:"space-y-3 max-h-52 overflow-y-auto",children:ae.map(n=>e.jsxs("div",{className:"p-3 border border-border rounded-lg",children:[e.jsx("div",{className:"font-medium text-sm",children:n.title}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:n.description}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["by ",n.user]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:n.timestamp})]})]},n.id))})]})]})]}),e.jsxs(ne,{value:"corporate",className:"space-y-6",children:[e.jsx(ha,{industry:D.industry,fundingStage:D.funding_stage,onSaved:(n,m)=>{B(k=>k&&{...k,industry:n,funding_stage:m})}}),e.jsx(rs,{companyData:D,isEditMode:!1,onUpdate:async n=>{B(m=>m&&{...m,...n})}})]}),e.jsx(ne,{value:"team",children:e.jsx(pa,{organizationId:D.id,isEditMode:!1})}),e.jsx(ne,{value:"locations",children:e.jsxs(b,{className:"relative overflow-hidden",children:[e.jsxs(M,{children:[e.jsx(q,{children:"Locations & Offices"}),e.jsx(V,{children:"Manage your company's physical and virtual presence"})]}),e.jsxs(w,{children:[e.jsx(He,{className:"absolute inset-0 text-muted-foreground
1/20 [mask-image:radial-gradient(ellipse_at_center,transparent_20%,black)]"}),e.jsxs("div",{className:"text-center py-12 text-muted-foreground relative z-10",children:[e.jsx(Fe,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"Location Management"}),e.jsx("p",{className:"text-sm",children:"Add and manage your company's offices, warehouses, and remote work locations"}),e.jsxs(A,{variant:"outline",className:"mt-4",children:[e.jsx(Fe,{className:"h-4 w-4 mr-2"}),"Add Location"]})]})]})]})}),e.jsx(ne,{value:"settings",children:e.jsx(ja,{companyData:D,onUpdate:n=>B(m=>m&&{...m,...n})})}),e.jsx(ne,{value:"analytics",children:e.jsxs(b,{className:"relative overflow-hidden",children:[e.jsxs(M,{children:[e.jsx(q,{children:"Analytics & Insights"}),e.jsx(V,{children:"Profile usage and completion analytics"})]}),e.jsxs(w,{children:[e.jsx(He,{className:"absolute inset-0 text-muted-foreground/20 [mask-image:radial-gradient(ellipse_at_center,transparent_20%,black)]"}),e.jsxs("div",{className:"text-center py-12 text-muted-foreground relative z-10",children:[e.jsx(Ee,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"Profile Analytics"}),e.jsx("p",{className:"text-sm",children:"Track profile views, engagement metrics, and completion trends"}),e.jsxs(A,{variant:"outline",className:"mt-4",children:[e.jsx(Ee,{className:"h-4 w-4 mr-2"}),"View Analytics"]})]})]})]})})]})]})}),v=e.jsx("div",{className:"space-y-6",children:e.jsx(rs,{companyData:D,isEditMode:j,onUpdate:async n=>{const m=await _();if(!m)throw new Error("Authentication required");const k=await fetch("/api/m02/company-profile",{method:"PATCH",headers:{"Content-Type":"application/json",...se(m)},body:JSON.stringify(n)}),c=await k.json().catch(()=>null);if(!k.ok||c?.error){const l=new Error(c?.error??"Failed to save company profile");throw l.code=c?.code,l.plan=c?.plan,l}B(l=>l&&{...l,...n})}})});return r?v:e.jsx(Ls,{title:"Company Profile",description:"Your Corporate DNA",actionsSlot:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsxs(xe,{variant:"outline",className:ee(I),children:[pe(I),e.jsxs("span",{className:"ml-1",children:[I,"% Complete"]})]}),e.jsxs(A,{variant:"outline",size:"sm",children:[e.jsx(ia,{className:"h-4 w-4 mr-2"}),"Export"]}),e.jsxs(A,{variant:"outline",size:"sm",children:[e.jsx(na,{className:"h-4 w-4 mr-2"}),"Share"]})]}),children:de})};export{Ja as CompanyProfileDashboard,Ja 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.