1import{r as u}from"./vendor-react-Js-mchSQ.js";import{a as c}from"./vendor-tanstack-BENzMncf.js";import{c as m,d as y,c5 as p,c6 as f}from"./index-4J2b-3Se.js";import"./vendor-markdown-eS0OqZqo.js";import"./vendor-radix-ta2ZTxkw.js";import"./vendor-firebase-4fDi6LKY.js";import"./vendor-lucide-BEgeOu3A.js";import"./vendor-zod-C4bLmoCR.js";import"./vendor-framer-motion-BDUiYKmj.js";import"./vendor-posthog-C5UOW2az.js";function h(n){if(typeof n=="object"&&n!==null&&"status"in n){const e=n.status;if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const a=Number(e);if(Number.isFinite(a))return a}}if(n instanceof Error){const e=n.message.match(/^(\d{3}):/);if(e){const a=Number(e[1]);if(Number.isFinite(a))return a}}return null}function g(n,e){const a=h(e);if(a!==null){if(a===408||a===429||a>=500)return n<4;if(a>=400&&a<500)return!1}return n<4}function b(n={}){const{currentUser:e,loading:a}=m(),{language:d}=y(),r=typeof n.customBuildRunId=="string"&&n.customBuildRunId.trim().length>0?n.customBuildRunId.trim():null,[o,l]=u.useState([]);u.useEffect(()=>{const s=()=>{l(p())};return s(),window.addEventListener("recentlyViewedUpdated",s),window.addEventListener("storage",s),()=>{window.removeEventListener("recentlyViewedUpdated",s),window.removeEventListener("storage",s)}},[e==null?void 0:e.uid]);const t=c({queryKey:["homeBundle",e==null?void 0:e.uid,d,r??"default"],queryFn:()=>f(d,{customBuildRunId:r??void 0}),enabled:!!e&&!a,staleTime:60*1e3,refetchOnWindowFocus:!0,placeholderData:r?void 0:s=>s,retry:g,retryDelay:s=>Math.min(1e3*2**s,6e3)}),i=u.useMemo(()=>t.data?t.data.state==="building"?{state:"building",personaKey:t.data.personaKey,runId:t.data.runId,static:{personaKey:t.data.personaKey,version:0,generatedAt:new Date().toISOString(),buildMeta:{source:"custom",interestSignature:t.data.shell.interests.join("|")},hero:t.data.shell.hero,curatedCards:t.data.shell.previewCards??[],impactHook:t.data.shell.previewImpactHook??null,quickDiveTrio:[],crossPollinationDuo:[],trlDuo:[],patentSpotlight:[],newsSnapshot:null,discoverAlso:[],interestHeadlinePools:[],methodTransferDailyPicks:[]},dynamic:{...t.data.dynamic,recentlyViewed:o}}:{...t.data,dynamic:{...t.data.dynamic,recentlyViewed:o},refresh:t.data.state==="stale"?t.data.refresh:void 0}:null,[t.data,o]);return{...t,bundle:i,staticBundle:(i==null?void 0:i.static)??null,dynamicBundle:(i==null?void 0:i.dynamic)??null,personaKey:(i==null?void 0:i.personaKey)??null}}export{b as useHomeBundle};
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.