PageSourceSearch

https://scripod.com/assets/route-DEV_no0Z.js

js scripod.com collected 2026-10-09 00:24:21 UTC 12,660 bytes, 1 lines download raw bytes

1import{a as e,t}from"./jsx-runtime-D_MnEzuy.js";import{t as n}from"./react-DBEjWt7A.js";import{t as r}from"./client-BwGoSxqZ.js";import{i}from"./link-Di2oYaad.js";import{n as a,t as o}from"./createServerFn-VTmtgM-o.js";import{r as s,t as c}from"./fileRoute-BoNWulra.js";import{t as l}from"./index.esm-yZ3WVT7t.js";import{i as u,n as d,r as f}from"./dist-DT2jQ2P_.js";import{i as p}from"./useScroll-CTuZtLwS.js";import{c as m,t as h}from"./episodeData-CVEs2LfU.js";import{i as g}from"./useBaseQuery-DXVpLECH.js";import{t as _}from"./useQuery-B_tVWEJs.js";import{t as v}from"./useStandalone-CpLKF5pW.js";import{t as y}from"./smart-image-YG08YgzI.js";import{c as b}from"./react-icons.esm-DSF_-psr.js";import{t as x}from"./input-search-DDKQRhvy.js";import{n as S,t as C}from"./omit-BBwpOQYn.js";import{t as ee}from"./suspense-fade-CqpYXQ3i.js";var w=t(),T=({children:e,className:t,style:n})=>(0,w.jsx)(`div`,{className:u(`px-4 sm:px-12 md:px-24 max-w-4xl mx-auto w-full`,t),style:n,children:e}),E=o({method:`GET`}).handler(a(`3b1fcd23074f543346ee492d7755b5877b19db41ed66833968e0a9734ce66028`));c(`/api/search/`)({});var D=e(n(),1),O=`sp_pub`,k=`x-sp-proof`,A=`x-sp-feed-ticket`,j=e=>new TextEncoder().encode(e),M=e=>{if(typeof btoa==`function`){let t=``;return e.forEach(e=>{t+=String.fromCharCode(e)}),btoa(t)}return Buffer.from(e).toString(`base64`)},N=e=>M(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/g,``),P=e=>{let t=3735928559^e.length,n=1103547991^e.length;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=Math.imul(t^i,2654435761),n=Math.imul(n^i,1597334677)}return t=Math.imul(t^t>>>16,2246822507),t^=Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(t^t>>>13,3266489909),`${(n>>>0).toString(16).padStart(8,`0`)}${(t>>>0).toString(16).padStart(8,`0`)}`},F=e=>(e||``).trim().toLowerCase(),I=e=>(e||``).trim().toLowerCase(),L=(e,t)=>P(`${F(e)}|${I(t)}`),R=(e,t)=>{let n=j(`${t}|sp-proof-v1`),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++){let i=n[t%n.length],a=t*31&255;r[t]=e[t]^i^a}return r},z=(e,t)=>N(R(j(JSON.stringify(e)),t)),B=!1,V={x:0,y:0},H=e=>{if(typeof document>`u`)return``;let t=e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),n=document.cookie.match(RegExp(`(?:^|; )${t}=([^;]*)`));return n?decodeURIComponent(n[1]):``},U=()=>{B||typeof window>`u`||(B=!0,window.addEventListener(`mousemove`,e=>{V={x:e.clientX,y:e.clientY}},{passive:!0}),window.addEventListener(`touchmove`,e=>{let t=e.touches[0];t&&(V={x:t.clientX,y:t.clientY})},{passive:!0}))},W=()=>{if(typeof navigator>`u`)return``;U();let e=H(O);return e?z({p:e,f:L(navigator.userAgent||``,navigator.language||``),t:Math.floor(Date.now()/1e3),m:`${V.x},${V.y}`,v:1},e):``},G=e=>{let t=W();return t?{...e||{},[k]:t}:e||{}},K=e=>G(e),q=(e,t=10)=>{let n=g(),r=(0,D.useCallback)(async e=>{let r=n.getQueryData([`search`,`podcast`,e]);if(r===void 0){let i=await E({data:{keyword:e,limit:t,entity:`podcast`},headers:K()}).then(e=>e.json()).catch(e=>{throw d.error(JSON.parse(e.message).message),e});n.setQueryData([`search`,`podcast`,`podcastindex`,e],i),r=i}return r?.results.length?r:null},[n,t]);return(0,D.useCallback)(async()=>{if(!e)return null;e.startsWith(`http`);let[t]=await Promise.allSettled([r(e)]);return t.status===`fulfilled`?t.value:null},[e,r])},J=({keyword:e,limit:t,children:n})=>{let r=q(e,t),{data:i,isLoading:a,promise:o}=_({queryKey:[`search`,`podcast`,e],queryFn:r,enabled:!!e,experimental_prefetchInRender:!0,staleTime:3600*1e3});if(a)throw o;return n?.(i)},Y=({keyword:e,limit:t=10,podcastSearchResult:n,children:r})=>{let i=(()=>{if(!e)return!1;try{return new URL(e),!0}catch{return!1}})(),a=(0,D.useMemo)(()=>{if(!e)return``;if(i){if(n?.source===`rss`)return e;let t=n?.episode?.title;return typeof t==`number`&&(t=String(t)),t}else return e},[i,e,n]),{data:o,isLoading:s,promise:c}=_({queryKey:[`search`,`episode`,a],queryFn:async e=>{if(n?.episodes)return{source:`rss`,entity:`episode`,results:n.episodes?.map(e=>({title:e.title,feedUrl:e.feedUrl,image:e.image,guid:e.guid,channelTitle:e.title,enclosureUrl:e.enclosureUrl,feedTicket:e.feedTicket}))??[],count:n.results.length};if(n?.episode)return{source:`podcastindex`,entity:`episode`,results:[n.episode],count:n.results.length};if(!a)return null;let r=await E({data:{keyword:a,limit:t,entity:`episode`},headers:K()}).then(e=>e.json()).catch(e=>{throw d.error(JSON.parse(e.message).message),e});return{source:`c`,entity:`episode`,results:r.results,count:r.count}},enabled:!!a,experimental_prefetchInRender:!0,refetchOnMount:!1,refetchOnReconnect:!1,refetchOnWindowFocus:!1,staleTime:3600*1e3});if(s)throw c;return n?.source===`xiaoyuzhou`&&n?.episode?r?.({source:n.source,entity:`episode`,results:[{title:String(n.episode.title),feedUrl:n.episode.feedUrl,image:n.episode.image,guid:n.episode.guid?String(n.episode.guid):void 0,channelTitle:n.episode.channelTitle,enclosureUrl:n.episode.enclosureUrl,feedTicket:n.episode.feedTicket}
1],count:1}):r?.(o)},X=()=>(0,w.jsxs)(`div`,{role:`status`,className:`animate-pulse pt-safe-offset-4`,children:[(0,w.jsx)(`div`,{className:`h-2 bg-card/50 rounded-full w-48 mb-4`}),(0,w.jsx)(`div`,{className:`h-2 bg-card/50 rounded-full max-w-[360px] mb-4`}),(0,w.jsx)(`div`,{className:`h-2 bg-card/50 rounded-full mb-4`}),(0,w.jsx)(`div`,{className:`h-2 bg-card/50 rounded-full max-w-[330px] mb-4`}),(0,w.jsx)(`div`,{className:`h-2 bg-card/50 rounded-full max-w-[300px] mb-4`}),(0,w.jsx)(`div`,{className:`h-2 bg-card/50 rounded-full max-w-[360px]`}),(0,w.jsx)(`span`,{className:`sr-only`,children:`Loading...`})]}),Z=e(r(),1),Q=({visible:e,children:t,onExited:n,duration:r=500})=>((0,D.useEffect)(()=>{if(!e){let e=setTimeout(n,r);return()=>clearTimeout(e)}},[e,n]),(0,w.jsx)(`div`,{className:`transition-opacity duration-${r}ms ${e?`opacity-100`:`opacity-0`}`,children:(0,w.jsx)(`div`,{className:`fixed inset-0 bg-black/50`,children:(0,w.jsxs)(`div`,{className:`flex items-center justify-center h-full`,children:[(0,w.jsx)(f,{className:`mb-4`}),t]})})})),$=(()=>{let e=null,t=null,n=()=>{e=document.createElement(`div`),document.body.appendChild(e),t=(0,Z.createRoot)(e)},r=()=>{e&&(document.body.removeChild(e),e=null,t=null)},i=null,a=a=>{i=a,e||n(),t?.render((0,w.jsx)(Q,{visible:!0,onExited:r,children:i}))},o=async(n=500)=>{if(e)return new Promise(e=>{t?.render((0,w.jsx)(Q,{visible:!1,onExited:()=>{r(),i=null,e()},duration:n,children:i}))})};return{show:a,hide:o,waitUntil:async(e,t={})=>{let n=null;try{let r=setTimeout(()=>{throw Error(`Timeout`)},t.timeout||8e3);a(i),n=await e(),clearTimeout(r),await o(t.duration),t.onExited&&t.onExited(n)}finally{await o(t.duration)}}}})();function te(){return(0,w.jsx)(ne,{})}typeof window<`u`&&/Chrome/.test(navigator.userAgent);function ne(){let{keyword:e,entity:t}=s({from:`/search`}),n=(0,D.useMemo)(()=>e?decodeURIComponent(e):``,[e]),r=p(),[a,o]=(0,D.useState)(!0),c=v(),f=i();(0,D.useEffect)(()=>{if(!c||!r)return;let e=()=>{r.scrollTop>30?o(!1):o(!0)};return e(),r.addEventListener(`scroll`,e),()=>{r.removeEventListener(`scroll`,e)}},[r,c]);let E=(0,D.useMemo)(()=>({all:`All`,podcast:`Podcasts`,episode:`Episodes`}),[]),{register:O,handleSubmit:k}=l({defaultValues:{keyword:n}}),j=g(),M=(0,D.useCallback)(()=>(0,w.jsx)(J,{keyword:n,children:e=>{let i=(t===`all`?e?.results.slice(0,3):e?.results)?.map((e,t)=>(0,w.jsx)(`a`,{href:`#`,onClick:t=>{t.preventDefault(),$.waitUntil(async()=>await S({data:{feedUrl:e.feedUrl},headers:K({[A]:e.feedTicket||``})}).then(e=>m(e)).catch(e=>(d.error(e instanceof Error?e.message:`Unable to open this podcast`),null)),{onExited:e=>{e&&f.navigate({to:`/channel/$cid`,params:{cid:e.id},viewTransition:{types:[`slide-left`]}})}})},children:(0,w.jsxs)(`div`,{className:`flex max-sm:-mx-4 max-sm:pl-4 items-stretch space-x-4 hover-hover:hover:bg-foreground
1/5 cursor-pointer active:bg-foreground/5 py-4 transition`,children:[(0,w.jsx)(y,{src:e.image||``,className:`size-24 object-cover rounded`}),(0,w.jsxs)(`div`,{className:`border-b-[0.5px] border-foreground/20 pr-4 self-stretch -my-4 py-4 flex-1`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-medium`,children:e.title}),(0,w.jsx)(`div`,{className:`opacity-50 text-sm mt-1`,children:e.author})]})]})},t));return i?.length?(0,w.jsxs)(`div`,{className:`mb-12`,children:[(0,w.jsx)(`h2`,{className:`text-xl font-bold mb-2`,children:`Podcasts`}),(0,w.jsxs)(`div`,{className:``,children:[i,t===`all`&&(e?.results?.length||0)>3&&(0,w.jsx)(`div`,{className:`w-full mt-4 rounded-lg cursor-pointer transition hover-hover:hover:bg-foreground/10 active:bg-foreground/10 bg-foreground/5 h-12 flex items-center justify-center text-primary hover:text-primary-hover`,onClick:()=>{f.navigate({to:`/search`,search:{keyword:n,entity:`podcast`},replace:!0}),r?.scrollTo({top:0,behavior:`instant`})},children:`View all`})]})]}):null}}),[n,t,j,r]),N=q(n),{data:P}=_({queryKey:[`search`,`podcast`,n],queryFn:N,enabled:!!n}),F=(0,D.useCallback)(()=>(0,w.jsx)(Y,{keyword:n,podcastSearchResult:P,children:e=>{let i=(t===`all`?e?.results.slice(0,10):e?.results)?.map((e,t)=>(0,w.jsx)(`a`,{href:`#`,onClick:t=>{t.preventDefault(),$.waitUntil(async()=>{let t=await S({data:{feedUrl:e.feedUrl,guid:e.guid,title:e.title,pubDate:e.pubDate?new Date(e.pubDate):void 0},headers:K({[A]:e.feedTicket||``})}).then(e=>m(e)).catch(e=>(d.error(e instanceof Error?e.message:`Unable to open this episode`),null));if(!t)return;let n=t.episodes[0]?.id;if(!n){d.error(`Oops, this episode seems to have been deleted by the author`);return}return h(j,n,{...t.episodes[0],channel:C(t,`episodes`)}),t},{onExited:e=>{if(!e)return;let t=e?.episodes[0]?.id;if(t)return f.navigate({to:`/episode/$eid`,params:{eid:t},viewTransition:{types:[`slide-left`]}});f.navigate({to:`/channel/$cid`,params:{cid:e.id},viewTransition:{types:[`slide-left`]}})}})},children:(0,w.jsxs)(`div`,{className:`flex max-sm:-mx-4 max-sm:pl-4 items-stretch space-x-4 hover-active:bg-foreground
1/5 cursor-pointer py-4 transition`,children:[(0,w.jsx)(y,{src:e.image||``,className:`size-24 object-cover rounded`,optimize:!1}),(0,w.jsxs)(`div`,{className:`border-b-[0.5px] border-foreground/20 pr-4 -my-4 py-4 flex-1`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-medium`,children:e.title}),(0,w.jsx)(`div`,{className:`opacity-50 text-sm mt-1`,children:e.channelTitle})]})]})},t));return i?.length?(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h2`,{className:`text-xl font-bold mb-2`,children:`Episodes`}),i,t===`all`&&(e?.results?.length||0)>10&&(0,w.jsx)(`div`,{className:`w-full mt-4 rounded-lg cursor-pointer transition hover-hover:hover:bg-foreground/10 active:bg-foreground/10 bg-foreground/5 h-12 flex items-center justify-center text-foreground`,onClick:async()=>{await f.navigate({to:`/search`,search:{keyword:n,entity:`episode`},replace:!0}),r?.scrollTo({top:0,behavior:`instant`})},children:`View all`})]}):null}}),[n,P,t,j,r]);return(0,w.jsxs)(`main`,{className:u(`pb-64 bg-background flex-1`),children:[(0,w.jsx)(`div`,{className:`text-center sticky z-10 max-sm:-top-14 top-0 !pwa:max-sm:-top-safe-or-3 w-full pt-3 pwa:pt-safe-or-3 bg-background mb-8`,children:(0,w.jsxs)(T,{children:[(0,w.jsx)(`h1`,{className:u(`text-2xl font-bold mb-4 transition`,{"opacity-0":!a}),children:`Search`}),(0,w.jsxs)(`form`,{action:``,onSubmit:k(e=>{f.navigate({to:`/search`,search:{keyword:e.keyword.trim()},replace:!0})}
1),children:[(0,w.jsxs)(`div`,{className:`relative bg-foreground/10 pr-0.5 rounded-full flex focus-within:ring-1 ring-foreground/50 transition`,children:[(0,w.jsx)(x,{className:`pr-5 h-10 flex-1 border-none rounded-none ring-0! bg-foreground/0`,inputClassName:`pl-4 !placeholder-foreground/40`,clearClassName:`right-8`,type:`search`,placeholder:`Search keyword or paste RSS link here`,...O(`keyword`)}),(0,w.jsx)(`button`,{type:`submit`,className:`absolute inset-y-0 right-0 group`,children:(0,w.jsx)(b,{className:`size-5 mx-3 opacity-50 group-hover:opacity-100`})})]}),(0,w.jsx)(`div`,{className:u(`my-3 p-1 inline-flex gap-1 font-medium text-sm transition ease-in-out duration-300 bg-foreground/5 rounded-full`),children:[`all`,`podcast`,`episode`].map((e,i)=>(0,w.jsx)(`div`,{className:u(`rounded-full px-4 py-1.5 cursor-pointer text-foreground/40 hover:text-foreground transition`,t===e&&`bg-foreground/15! text-foreground`),onClick:async()=>{await f.navigate({to:`/search`,search:{keyword:n,entity:e},replace:!0}),r?.scrollTo({top:0,behavior:`instant`})},children:E[e]},i))})]})]})}),(0,w.jsx)(T,{children:(0,w.jsxs)(ee,{fallback:(0,w.jsx)(X,{}),placeholder:n&&(0,w.jsx)(`div`,{className:`text-center text-foreground/40`,children:`No results found`}),children:[(t===`all`||t===`podcast`)&&M(),(t===`all`||t===`episode`)&&F()]},t)})]})}export{te as component};

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.