PageSourceSearch

https://www.valueinvestinghub.com/assets/BedrockSectorCardsSection-CHpGUNTL.js

js valueinvestinghub.com collected 2026-10-09 22:57:43 UTC 6,982 bytes, 10 lines download raw bytes

1import{a as h,j as e}from"./react-query-DtH7GInu.js";import{n as x,C as u,o as f,a7 as b,cR as y,w as l}from"./index-Bk2jHtle.js";import{c as k}from"./BedrockDisclaimer-mwbkYb3v.js";import{n as g,a as w}from"./sectorNormalization-1p84Cqx3.js";import{u as _}from"./vendors-C_aCOv2N.js";import{a1 as j,aD as p,c4 as v,bl as N,d5 as C,d6 as S,c2 as E,be as T,c6 as R,d7 as B,c8 as q,d8 as L,aU as M}from"./ui-components-BYDPAGXP.js";import"./charts-DXTQz_Nw.js";const I=15*60*1e3,F=60*60*1e3,H=3;function A(a=!0){return h({queryKey:["bedrock-sector-previews"],enabled:a,staleTime:I,gcTime:F,queryFn:async()=>{const[n,o]=await Promise.all([x.from("v_bedrock_top_per_sector").select("symbol, company_name, sector, composite_score, quality_band, sector_rank"),x.from("v_bedrock_leaderboard_sectors").select("sector, symbol_count, last_calculated_at")]);if(n.error)throw new Error(`v_bedrock_top_per_sector query failed: ${n.error.message}`);if(o.error)throw new Error(`v_bedrock_leaderboard_sectors query failed: ${o.error.message}`);const c=new Map;let s=null;for(const t of o.data??[]){const r=g(t.sector);r&&c.set(r,(c.get(r)??0)+Number(t.symbol_count??0)),t.last_calculated_at&&(!s||t.last_calculated_at>s)&&(s=t.last_calculated_at)}const i=new Map;for(const t of n.data??[]){const r=g(t.sector);if(!r)continue;const m=i.get(r)??[];m.push({symbol:t.symbol,company_name:t.company_name,composite_score:Number(t.composite_score),quality_band:t.quality_band}),i.set(r,m)}for(const t of i.values())t.sort((r,m)=>m.composite_score-r.composite_score);return{previews:Array.from(c.entries()).map(([t,r])=>({displaySector:t,slug:w(t),totalCount:r,topRows:(i.get(t)??[]).slice(0,H)})).sort((t,r)=>r.totalCount-t.totalCount),lastUpdated:s}}})}const D={gradient:"from-slate-50/40 dark:from-slate-950/20",accent:"text-slate-600 dark:text-slate-400",icon:p},z={Technology:{gradient:"from-indigo-50/40 dark:from-indigo-950/20",accent:"text-indigo-600 dark:text-indigo-400",icon:v},Healthcare:{gradient:"from-rose-50/40 dark:from-rose-950/20",accent:"text-rose-600 dar
1k:text-rose-400",icon:N},Financials:{gradient:"from-blue-50/40 dark:from-blue-950/20",accent:"text-blue-600 dark:text-blue-400",icon:C},"Consumer Discretionary":{gradient:"from-amber-50/40 dark:from-amber-950/20",accent:"text-amber-600 dark:text-amber-400",icon:S},"Consumer Staples":{gradient:"from-lime-50/40 dark:from-lime-950/20",accent:"text-lime-600 dark:text-lime-400",icon:E},"Communication Services":{gradient:"from-violet-50/40 dark:from-violet-950/20",accent:"text-violet-600 dark:text-violet-400",icon:T},Industrials:{gradient:"from-zinc-50/40 dark:from-zinc-950/20",accent:"text-zinc-600 dark:text-zinc-400",icon:R},Energy:{gradient:"from-orange-50/40 dark:from-orange-950/20",accent:"text-orange-600 dark:text-orange-400",icon:B},Utilities:{gradient:"from-yellow-50/40 dark:from-yellow-950/20",accent:"text-yellow-700 dark:text-yellow-400",icon:q},"Real Estate":{gradient:"from-teal-50/40 dark:from-teal-950/20",accent:"text-teal-600 dark:text-teal-400",icon:p},Materials:{gradient:"from-stone-50/40 dark:from-stone-950/20",accent:"text-stone-600 dar
1k:text-stone-400",icon:L}};function U(a){return z[a]??D}function P({preview:a}){const n=_(),o=U(a.displaySector),c=o.icon;return e.jsxs(u,{onClick:()=>n(`/bedrock?sector=${encodeURIComponent(a.slug)}&tab=browse`),className:`group relative overflow-hidden p-5 cursor-pointer
2                  border bg-gradient-to-br ${o.gradient} via-card to-card
3                  hover:shadow-lg hover:-translate-y-0.5
4                  transition-all duration-300 ease-out
5                  h-full flex flex-col`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[e.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[e.jsx("div",{className:`shrink-0 w-10 h-10 rounded-lg flex items-center justify-center
6                        bg-background/60 ${o.accent}`,children:e.jsx(c,{className:"w-5 h-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:`font-semibold text-base leading-tight
7                         group-hover:text-primary transition-colors truncate`,children:a.displaySector}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[a.totalCount.toLocaleString()," ",a.totalCount===1?"business":"businesses"]})]})]}),e.jsx(f,{variant:"outline",className:"shrink-0 text-[10px] uppercase tracking-wider",children:"Quality"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed mb-4 line-clamp-3",children:["Top quality businesses in ",a.displaySector," by Bedrock composite score — moat, earnings stability, and financial strength."]}),a.topRows.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-4",children:a.topRows.map(s=>e.jsxs(f,{variant:"secondary",className:"font-mono text-[11px]",children:[s.symbol," · ",Math.round(s.composite_score)]},s.symbol))}),e.jsxs("div",{className:`mt-auto pt-1 flex items-center justify-end
8                   text-sm font-medium text-primary
9                   opacity-80 group-hover:opacity-100 transition-opacity`,children:[e.jsx("span",{children:"View ranking"}),e.jsx(j,{className:`ml-1 w-4 h-4
10                     group-hover:translate-x-0.5 transition-transform`})]})]})}const $=5;function Y({variant:a="discover"}={}){const{enabled:n,loading:o}=b("discover_bedrock_sector_cards",!0),{data:c,isLoading:s,error:i}=A(n);if(o||!n)return null;const d=(c?.previews??[]).filter(r=>r.totalCount>=$);if(!s&&!i&&d.length===0)return null;const t=a==="home";return e.jsxs("div",{className:"space-y-3",children:[e.jsx(y,{headingId:"bedrock-sector-cards-heading",title:"Quality Leaderboard by Sector",subtitle:"Top-rated businesses in each sector by the Bedrock quality framework",icon:t?void 0:M,linkTo:"/bedrock",linkLabel:t?"View full quality ranking":"View full ranking",contentSignal:d.length,children:V(d,s,i,a)}),e.jsx(k,{variant:"compact",className:"text-xs"})]})}function V(a,n,o,c){return n?Array.from({length:4}).map((s,i)=>e.jsx("div",{className:c==="home"?"flex-shrink-0 w-[85vw] sm:w-96 snap-center":"flex-shrink-0 w-80 sm:w-96",children:e.jsxs(u,{className:"p-5 h-full space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(l,{className:"w-10 h-10 rounded-lg"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(l,{className:"h-4 w-32"}),e.jsx(l,{className:"h-3 w-24"})]})]}),e.jsx(l,{className:"h-12 w-full"}),e.jsxs("div",{className:"flex gap-1.5",children:[e.jsx(l,{className:"h-5 w-16"}),e.jsx(l,{className:"h-5 w-16"}),e.jsx(l,{className:"h-5 w-16"})]}),e.jsx(l,{className:"h-4 w-24 ml-auto"})]})},i)):o?e.jsx(u,{className:"p-6 text-sm text-muted-foreground w-full",children:"Couldn't load sector quality data right now. Please refresh in a moment."}):a.map(s=>e.jsx("div",{className:c==="home"?"flex-shrink-0 w-[85vw] sm:w-96 snap-center":"flex-shrink-0 w-80 sm:w-96 h-full",children:e.jsx(P,{preview:s})},s.slug))}export{Y as BedrockSectorCardsSection};

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.