@funhub/platform 0.1.155 → 0.1.156
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/images/marquee.mjs +1 -1
- package/dist/components/biz/business/detail/shared/runtime-context-provider.mjs +1 -1
- package/dist/components/biz/business/detail/shared/use-video-detail-webview-bridge.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-actions/client.mjs +1 -1
- package/dist/components/biz/business/search-history/client.mjs +1 -1
- package/dist/components/common/series-episodes/index.mjs +1 -1
- package/dist/components/pages/search-result/search-user.mjs +1 -1
- package/dist/components/pages/search-result/search-video.mjs +1 -1
- package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
- package/dist/components/pages/video-list/index.mjs +1 -1
- package/dist/components/pages/video-list/video-list-client.mjs +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/button.d.mts +1 -1
- package/dist/components/ui/image.d.mts +4 -4
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{useRouter as t}from"../../../../../utils/use-compatible-router.mjs";import{
|
|
2
|
+
"use client";import{gContentGetVideoDetail as e}from"../../../../../service/generated/client.mjs";import{useRouter as t}from"../../../../../utils/use-compatible-router.mjs";import{buildVideoPlayerSrc as n}from"../../../../common/video-player/process-m3u8-cache.mjs";import{notifyBridgeEpisodeChanged as r}from"../../../../../utils/login-modal-bridge.mjs";import{useRequest as i}from"../../../../../hooks/query/use-query.mjs";import{useKeepAliveState as a}from"../../../../common/keep-scroll-position/index.mjs";import{createContext as o,use as s,useCallback as c,useEffect as l,useMemo as u}from"react";import{jsx as d}from"react/jsx-runtime";import{useParams as f}from"next/navigation";const p=o(void 0),m=`funhub:video-detail-episode-sync`;function h(e,t){let n=String(e||``).split(`/`).filter(Boolean),r=n.findIndex(e=>e===`video`||e===`webview`);return r<0?!1:n[r+1]===t}function g(e){let t=Math.floor(Number(e)||1);return t>0?t:1}function _(e){typeof window>`u`||window.dispatchEvent(new CustomEvent(m,{detail:e}))}function v(e){return e.type===m&&e instanceof CustomEvent}function y(e,t){if(!(!e&&!t))return{information:e?.information??t?.information,currentSeriesNum:e?.currentSeriesNum??t?.currentSeriesNum,onEpisodeChange:e?.onEpisodeChange??t?.onEpisodeChange,onUpdateInformation:e?.onUpdateInformation??t?.onUpdateInformation,detailId:e?.detailId??t?.detailId,episodeIndex:e?.episodeIndex??t?.episodeIndex,resumeProgressSeconds:e?.resumeProgressSeconds??t?.resumeProgressSeconds,isShow:e?.isShow??t?.isShow,isWebView:e?.isWebView??t?.isWebView,isInformationLoading:e?.isInformationLoading??t?.isInformationLoading,isInformationResolved:e?.isInformationResolved??t?.isInformationResolved}}function b({value:e,children:t}){let n=s(p);return d(p,{value:u(()=>y(n,e)??e,[n,e]),children:t})}function x(){let e=s(p),t=S({enabled:e===void 0||e.onEpisodeChange===void 0||e.detailId===void 0||e.currentSeriesNum===void 0||e.episodeIndex===void 0||e.isInformationLoading===void 0||e.isInformationResolved===void 0,shouldRequestInformation:!e?.information});return u(()=>{let n=y(e,t);return n&&(e&&t&&e.onEpisodeChange===void 0?{...n,currentSeriesNum:t.currentSeriesNum??n.currentSeriesNum,episodeIndex:t.episodeIndex??n.episodeIndex,onEpisodeChange:t.onEpisodeChange??n.onEpisodeChange}:n)},[e,t])}function S(o){let{enabled:s,shouldRequestInformation:d}=o,p=f(),y=t(),b=p.level,x=Array.isArray(b)?b:typeof b==`string`?[b]:[],S=x[0]||``,C=x.findIndex(e=>e===`episode`),w=C>=0?x[C+1]:x[2],T=Math.max(1,Number(w)||1),[E,D]=a(`video-detail-material-series-num-${S}`,T);l(()=>{D(T)},[T,D]),l(()=>{if(!S||typeof window>`u`)return;let e=e=>{if(!v(e))return;let t=e.detail;if(!t||t.detailId!==S)return;let n=g(t.seriesNum);D(e=>e===n?e:n)};return window.addEventListener(m,e),()=>{window.removeEventListener(m,e)}},[S,D]);let O=c(e=>{if(!S)return;let t=g(e);D(t),_({detailId:S,seriesNum:t})},[S,D]),k=Math.max(1,Number(E)||1),A=Math.max(0,k-1),j=x[1]||``,M=typeof window<`u`&&window.isWebView===!0,{data:N,isPending:P,isFetching:F,isError:I,isSuccess:L}=i([`video-detail`,S],async()=>S?await e({id:S}):null,{enabled:s&&d&&!!S}),R=u(()=>{let e=N?.data?.video;if(!(!e||typeof e!=`object`))return{...e,content_type:1,episode_cnt:e.links?.length||0}},[N?.data?.video]),z=c(e=>{let t=Math.max(1,Math.floor(Number(e)||1));if(!S||typeof window>`u`)return;let i=`/${M?`webview`:`video`}/${S}/${encodeURIComponent(j)}/episode/${t}`,{search:a,hash:o,pathname:s}=window.location,c=`${s}${a}${o}`,l=`${i}${a}${o}`,u=h(s,S);if(c!==l){if(M){let e=R?.links?.[Math.max(0,t-1)],i=n(String(e?.m3u8_url||e?.preview_m3u8_url||``).trim());r({poster:String(R?.img_y||R?.img_x||R?.preview_images?.[0]||``).trim(),src:i,title:String(R?.title||R?.name||``).trim(),contentId:S,episode:t}),k!==t&&O(t);return}u&&typeof window.history?.replaceState==`function`?(window.history.replaceState(window.history.state,``,l),O(t)):y.replace(l,{scroll:!1});return}k!==t&&O(t)},[k,S,R?.img_x,R?.img_y,R?.links,R?.name,R?.preview_images,R?.title,M,j,y,O]);if(s)return{information:R,currentSeriesNum:k,onEpisodeChange:z,detailId:S,episodeIndex:A,resumeProgressSeconds:0,isShow:!0,isWebView:M,isInformationLoading:d?!!S&&!R&&(P||F):!1,isInformationResolved:!S||!!R||!d||I||L}}export{b as VideoDetailMaterialRuntimeProvider,x as useVideoDetailMaterialRuntimeContext};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{decryptImageToUint8Array as e}from"../../../../../utils/decrypt-image-client.mjs";import{gContentGetVideoDetail as t,pInteractionBrowse as n}from"../../../../../service/generated/client.mjs";import{uint8ArrayToBase64 as r}from"../../../../../utils/uint8.mjs";import{resolveM3u8Urls as i,resolveVideoPlayerSrc as a}from"../../../../common/video-player/process-m3u8-cache.mjs";import{batchQueryContentInteractions as o}from"../../../../../hooks/use-content-operate.mjs";import{useCallback as s,useEffect as c,useRef as l}from"react";import{usePathname as u}from"next/navigation";function
|
|
2
|
+
"use client";import{decryptImageToUint8Array as e}from"../../../../../utils/decrypt-image-client.mjs";import{gContentGetVideoDetail as t,pInteractionBrowse as n}from"../../../../../service/generated/client.mjs";import{uint8ArrayToBase64 as r}from"../../../../../utils/uint8.mjs";import{resolveM3u8Urls as i,resolveVideoPlayerSrc as a}from"../../../../common/video-player/process-m3u8-cache.mjs";import{batchQueryContentInteractions as o}from"../../../../../hooks/use-content-operate.mjs";import{useCallback as s,useEffect as c,useRef as l}from"react";import{usePathname as u}from"next/navigation";import{useQueryClient as d}from"@tanstack/react-query";const f=new Map,p=new Map;function m(e){let t=Math.floor(Number(e)||1);return t>0?t:1}function h(e){let t=typeof e==`string`?e:typeof window>`u`?``:window.location.pathname,n=String(t||``).split(`/`).filter(Boolean),r=n.findIndex(e=>e===`video`||e===`webview`);if(r<0)return{detailId:``,currentSeriesNum:1,episodeIndex:0};let i=n[r+1]||``;try{let e=decodeURIComponent(i),t=n.slice(r+1),a=t.findIndex(e=>e===`episode`),o=m(a>=0?t[a+1]:t[2]);return{detailId:e,currentSeriesNum:o,episodeIndex:Math.max(0,o-1)}}catch{let e=n.slice(r+1),t=e.findIndex(e=>e===`episode`),a=m(t>=0?e[t+1]:e[2]);return{detailId:i,currentSeriesNum:a,episodeIndex:Math.max(0,a-1)}}}function g(e){for(;e.size>5;){let t=e.keys().next().value;if(!t)break;e.delete(t)}}function _(e){let t=e,n=t?.data?.video||t?.video||t;if(!(!n||typeof n!=`object`))return{...n,content_type:1,episode_cnt:n.links?.length||0}}function v(e){let t=String(e||``).trim();return t?[[`video-detail`,t]]:[]}function y(m){let{enabled:y=!0}=m,b=d(),x=h(u()).detailId,S=l({detailId:``}),C=l(null),w=l(new Map),T=l(new Map);c(()=>{S.current={detailId:x},C.current=null},[x]);let E=s(async e=>{let n=Date.now(),r=()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),i=r(),a=String(e||``).trim(),o=`empty-id`,s=!1,c=0,l=!1,u=0;if(!a){o=`empty-id`;return}if(S.current.detailId===a&&S.current.information){o=`cache`;let e=S.current.information;return l=!0,u=Array.isArray(e?.links)?e.links.length:0,e}let d=f.get(a);if(d)return o=`shared-cache`,S.current={detailId:a,information:d},l=!0,u=Array.isArray(d?.links)?d.links.length:0,d;let m=v(a).map(e=>b.getQueryData(e)).map(_).find(Boolean);if(m)return o=`query-cache`,S.current={detailId:a,information:m},f.set(a,m),l=!0,u=Array.isArray(m?.links)?m.links.length:0,m;if(C.current?.detailId===a){o=`inflight`;let e=r(),t=await C.current.promise;return c=Number((r()-e).toFixed(1)),l=!!t,u=Array.isArray(t?.links)?t.links.length:0,t}if(p.has(a)){o=`shared-inflight`;let e=r(),t=await p.get(a);return c=Number((r()-e).toFixed(1)),l=!!t,u=Array.isArray(t?.links)?t.links.length:0,t&&(S.current={detailId:a,information:t}),t}o=`network`;let h=r(),g=t({id:a}).then(e=>{let t=_(e);if(t)return S.current={detailId:a,information:t},f.set(a,t),t});C.current={detailId:a,promise:g},p.set(a,g);try{let e=await g;return c=Number((r()-h).toFixed(1)),l=!!e,u=Array.isArray(e?.links)?e.links.length:0,e||(o=`network-empty`),e}catch(e){throw s=!0,e}finally{let e=Number((r()-i).toFixed(1));console.warn(`[webview bridge] fetchVideoDetailInformation timing:`,JSON.stringify({status:s?`error`:`success`,detailId:a,source:o,hasInformation:l,episodeCnt:u,requestMs:c,totalMs:e,invocationWallStartMs:n,invocationWallStartTime:new Date(n).toISOString()})),C.current?.detailId===a&&(C.current=null),p.get(a)===g&&p.delete(a)}},[b]),D=s(async t=>{let n=String(t||``).trim();if(!n)return``;let i=w.current.get(n);if(i)return i;let a=T.current.get(n);if(a)return await a;let o=(async()=>{try{let t=await e(n);if(!t)return``;let i=r(t.bytes);return w.current.delete(n),w.current.set(n,i),g(w.current),i}catch(e){return console.warn(`[webview bridge] getVideoInfoAsync poster failed:`,e),``}finally{T.current.delete(n)}})();return T.current.set(n,o),await o},[]),O=s(async e=>{let t=String(e||``).trim();if(!t)return``;let n=D(t),r,i=new Promise(e=>{r=setTimeout(()=>{e(``)},150)}),a=await Promise.race([n,i]);return r!==void 0&&clearTimeout(r),a},[D]),k=s(async()=>{let e=Date.now(),t=()=>typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),n=[],r=e=>{n.push({stage:e,at:t(),wallAtMs:Date.now()})},o=e=>e<=0||e>=n.length?0:Number((n[e].at-n[e-1].at).toFixed(1));r(`start`);let s=``,c=1,l=``,u=0,d=`empty-url`,f=0,p=0,m=0,g=0,_=!1;try{let e;for(let t=0;t<2;t++){u+=1;let t=h();if(e=await E(t.detailId),h().detailId===t.detailId)break}r(`detail-ready`);let t=h(),n=i(Array.isArray(e?.links)?e.links:[],t.currentSeriesNum);r(`m3u8-ready`);let o=n[0]?await a(n[0]):``;r(`src-ready`);let _=e?.name||``,v=String(t.detailId||``).trim(),y=t.currentSeriesNum,b=String(e?.img_y||e?.img_x||e?.preview_images?.[0]||``).trim(),x=await O(b);return r(`poster-ready`),b&&(d=x?`resolved`:`timeout-or-empty`),f=b.length,p=x.length,g=o.length,s=v,c=y,l=_,m=0,{poster:``,src:o,title:_,contentId:v,episode:y}}catch(e){throw _=!0,e}finally{let r=t(),i=n[0]?.at??r,a=n.map((e,t)=>t===0?null:{stage:n[t].stage,costMs:o(t)}).filter(Boolean),h=n.map(e=>({stage:e.stage,offsetMs:Number((e.at-i).toFixed(1)),wallTime:new Date(e.wallAtMs).toISOString()})),v=Number((r-i).toFixed(1));console.warn(`[webview bridge] getVideoInfoAsync timing:`,JSON.stringify({status:_?`error`:`success`,invocationWallStartMs:e,invocationWallStartTime:new Date(e).toISOString(),detailId:s,seriesNum:c,title:l,detailFetchAttempts:u,posterStatus:d,posterUrlLength:f,resolvedPosterLength:p,returnedPosterLength:m,srcLength:g,phases:a,timeline:h,totalMs:v}))}},[E,O]),A=s(async()=>{let e=h();if(!e.detailId)return null;let t=await o([e.detailId],1);return t?.interaction_list?.[0]?t.interaction_list[0].browse_record:null},[]),j=s(async e=>{let t=h();if(!t.detailId)return;let r=e.browse_episode||t.currentSeriesNum,i=Date.now(),a=String(e.browse_key||i);try{await n({app_id:0,content_type:1,content_id:t.detailId,browse_duration:Number(e.browse_duration||0),browse_episode:String(r),browse_key:a,browse_page_ts:i})}catch(e){console.error(`上报播放进度失败:`,e)}},[]);c(()=>{if(!y||typeof window>`u`)return;let e=window;return e.getVideoInfoAsync=k,e.getVideoBrowseRecordAsync=A,e.reportVideoBrowse=j,()=>{e.getVideoInfoAsync===k&&delete e.getVideoInfoAsync,e.getVideoBrowseRecordAsync===A&&delete e.getVideoBrowseRecordAsync,e.reportVideoBrowse===j&&delete e.reportVideoBrowse}},[A,k,y,j])}export{y as useVideoDetailWebViewBridge};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useRequest as e}from"../../../../../hooks/query/use-query.mjs";import{batchQueryContentInteractions as t}from"../../../../../hooks/use-content-operate.mjs";import{DetailOperate as n}from"../shared/detail-operate.mjs";import{editorPreviewInformation as r}from"../shared/editor-preview.mjs";import{useVideoDetailMaterialRuntimeContext as i}from"../shared/runtime-context-provider.mjs";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";function u({mode:u=`renderer`}){let d=i(),f=d?.information,p=d?.onUpdateInformation,m
|
|
2
|
+
"use client";import{useRequest as e}from"../../../../../hooks/query/use-query.mjs";import{batchQueryContentInteractions as t}from"../../../../../hooks/use-content-operate.mjs";import{DetailOperate as n}from"../shared/detail-operate.mjs";import{editorPreviewInformation as r}from"../shared/editor-preview.mjs";import{useVideoDetailMaterialRuntimeContext as i}from"../shared/runtime-context-provider.mjs";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import{jsx as l}from"react/jsx-runtime";function u({mode:u=`renderer`}){let d=i(),f=d?.information,p=d?.onUpdateInformation,m=u===`editor`,h=u===`renderer`,g=m,_=g?r:f,[v,y]=c(_),b=s(_),x=s(``);o(()=>{y(_)},[_]);let S=p?_:v;o(()=>{b.current=S},[S]);let C=h&&!!_?.id,{data:w}=e([`video-detail-actions-interaction`,_?.id],async()=>_?.id?await t([_.id],1):null,{enabled:C,staleTime:0,refetchOnMount:`always`,refetchOnWindowFocus:!1}),T=a(e=>{if(!g){if(p){p(e);return}y(t=>{if(!t)return t;let n=e.static?{...t.static||{},...e.static||{}}:t.static;return{...t,...e,static:n}})}},[p,g]);return o(()=>{let e=w?.interaction_list?.[0],t=b.current;if(!e||!t)return;let n=`${e.is_liked?1:0}-${e.is_disliked?1:0}-${e.is_collected?1:0}`;if(x.current===n)return;x.current=n;let r=e.is_liked||!1,i=e.is_disliked||!1,a=e.is_collected||!1,o=!!t.like,s=!!t.dislike,c=!!t.collect,l=t.static?.like_cnt,u=typeof l==`number`?l:Number(l||0),d=u;!r&&u>0?d=Math.max(0,u-1):o===r?r&&u===0&&(d=1):d=Math.max(0,u+(r?1:-1));let f=d!==u;o===r&&s===i&&c===a&&!f||T({like:r,dislike:i,collect:a,...f?{static:{...t.static||{},like_cnt:d}}:{}})},[T,w]),S?l(`div`,{className:g?`pointer-events-none`:void 0,children:l(n,{mode:u,information:S,onUpdate:T})}):null}export{u as VideoDetailActionsClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{useRouter as r}from"../../../../utils/use-compatible-router.mjs";import{Box as i}from"../../../ui/box.mjs";import{Text as a}from"../../../ui/text.mjs";import{eventKey as o}from"../../../../constants/event-key.mjs";import{useSearchHistory as s}from"../../../../hooks/use-search-history.mjs";import{DeleteConfirmDialog as c}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{
|
|
2
|
+
"use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{useRouter as r}from"../../../../utils/use-compatible-router.mjs";import{Box as i}from"../../../ui/box.mjs";import{Text as a}from"../../../ui/text.mjs";import{eventKey as o}from"../../../../constants/event-key.mjs";import{useSearchHistory as s}from"../../../../hooks/use-search-history.mjs";import{DeleteConfirmDialog as c}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useLayoutEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{usePathname as h,useSearchParams as g}from"next/navigation";function _(e,t){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function v(v){let{title:y,rows:b=1,clearText:x,confirmDescription:S,onHistoryClick:C,mode:w=`renderer`}=v,T=y??`搜索历史`,E=x??`清空`,D=S??`确定要清除所有搜索历史吗?`,O=u(()=>[`搜索历史1`,`搜索历史2`,`搜索历史3`],[]),[k,A]=f(!1),[j,M]=f(null),N=d(null),P=d([]),F=d(null),I=r(),L=h(),R=g(),{userInfo:z}=n(),{history:B,addHistory:V,clearHistory:H}=s({storageKey:z?.user_id||`guest`}),U=()=>{H(),A(!1),t.emit(o.SEARCH_HISTORY_UPDATE)},W=u(()=>(B.length?B:w===`editor`?O:[]).slice(0,b*10),[B,w,O,b]);if(l(()=>{if(W.length===0){M(null);return}let e=N.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=[];P.current.slice(0,W.length).forEach(e=>{if(!e)return;let r=e.getBoundingClientRect(),i=Math.round(r.top-t.top),a=Math.round(r.bottom-t.top),o=n.find(e=>Math.abs(e.top-i)<=1);if(o){o.bottom=Math.max(o.bottom,a);return}n.push({top:i,bottom:a})}),n.sort((e,t)=>e.top-t.top);let r=n.slice(0,b).reduce((e,t)=>Math.max(e,t.bottom),0);M(e=>e===r?e:r)},n=()=>{F.current!=null&&cancelAnimationFrame(F.current),F.current=requestAnimationFrame(()=>{F.current=null,t()})};if(n(),typeof ResizeObserver>`u`)return()=>{F.current!=null&&(cancelAnimationFrame(F.current),F.current=null)};let r=new ResizeObserver(()=>{n()});return r.observe(e),P.current.slice(0,W.length).forEach(e=>{e&&r.observe(e)}),()=>{r.disconnect(),F.current!=null&&(cancelAnimationFrame(F.current),F.current=null)}},[W,b]),W.length===0)return null;let G=e=>{if(V(e),C){C(e);return}let t=new URLSearchParams(R.toString());t.set(`q`,e);let n=L.includes(`/search-result`)?L:`/search-result`;I.push(`${n}?${t.toString()}`)};return m(i,{className:`px-4 py-2`,children:[m(i,{className:`flex justify-between items-center mb-2`,children:[p(a,{className:`text-[16px] font-bold text-text1`,children:T}),p(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>A(!0),children:E})]}),p(i,{ref:N,className:`flex flex-wrap gap-2 overflow-hidden`,style:j?{maxHeight:`${j}px`}:void 0,children:W.map((e,t)=>p(i,{ref:e=>{P.current[t]=e},className:`px-3 py-1 bg-bg2 rounded-full cursor-pointer`,onClick:()=>G(e),children:p(a,{className:`text-[14px] text-text2`,children:_(e,8)})},t))}),p(c,{open:k,onOpenChange:A,onConfirm:U,title:``,description:D})]})}export{v as SearchHistoryClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Box as e}from"../../ui/box.mjs";import{Text as t}from"../../ui/text.mjs";import{Sheet as n,SheetContent as r,SheetHeader as i,SheetTitle as a}from"../../ui/sheet.mjs";import{Switch as o}from"../../ui/switch.mjs";import{useKeepAliveState as s}from"../keep-scroll-position/index.mjs";import c from"../../../assets/icons/close.mjs";import l from"../../../assets/icons/common/right_arrow.mjs";import u from"../../ui/popup.mjs";import{useCallback as d,useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as b}from"next-intl";function x(e,t,n){return(e||[]).map((e,r)=>{let i=Number.parseInt(e?.id||``,10),a=Number.isNaN(i)?r+1:i,o=e?.id||``,s=Number.isNaN(i)&&o||n(a);return{id:e?.id||`${t}-${a}`,series_num:a,title:s}})}function S(e,t,n){return(e||[]).map((e,r)=>{let i=Number(e?.id),a=Number.isNaN(i)?r+1:i,o=n(a);return{id:e?.id||`${t}-${a}`,series_num:a,title:o}})}function C(e,t,n){return e<=0?n(`singleContent`):n(t===`1`?`completedSeriesTotal`:`ongoingSeriesTotal`,{total:e})}function w(e){return e.mode===`detail`?_(E,{information:e.information,series_num:e.series_num,onEpisodeChange:e.onEpisodeChange}):_(T,{open:e.open,variant:e.variant,title:e.title,updateStatus:e.updateStatus,summaryText:e.summaryText,seriesList:e.seriesList,activeEpisodeId:e.activeEpisodeId,showEpisodeTitle:e.showEpisodeTitle,onToggleTitle:e.onToggleTitle,onClose:e.onClose,onSelectEpisode:e.onSelectEpisode,popupBodyStyle:e.popupBodyStyle})}function T({open:s,variant:l,title:d,updateStatus:g,summaryText:y,seriesList:S,activeEpisodeId:w,showEpisodeTitle:T=!1,onToggleTitle:E,onClose:D,onSelectEpisode:O,popupBodyStyle:k}){let A=b(`components.common.seriesEpisodes`),j=!!E,M=j&&T,N=m(null),P=m(null),F=p(()=>x(S,`episode`,e=>A(`episodeLabel`,{episode:e})),[S,A]),I=p(()=>{if(F.length===0)return[];let e=[];return F.forEach((t,n)=>{let r=Math.floor(n/50);e[r]||(e[r]=[]),e[r].push(t)}),e},[F]),L=p(()=>{if(!w)return 0;let e=F.findIndex(e=>e.id===w);return e<0?0:Math.floor(e/50)},[w,F]),[R,z]=h(L);f(()=>{z(L)},[L]);let B=p(()=>typeof y==`string`&&y.trim()?y:C(F.length,g,A),[F.length,y,A,g]),V=d||A(`selectorTitle`);function H(){let e=N.current;if(e){P.current&&=(window.cancelAnimationFrame(P.current),null),e.scrollTop=0;try{e.scrollTo({top:0,left:0,behavior:`auto`})}catch{}P.current=window.requestAnimationFrame(()=>{P.current=null;let e=N.current;e&&(e.scrollTop=0)})}}f(()=>{s&&H()},[s,T,R]);function U(e){E&&(E(e),H())}function W(e){O?.(e.id,e.series_num),D()}let G=M?2:5,K=I.length>1?_(`div`,{className:`shrink-0 w-full flex gap-[8px] overflow-x-auto`,children:I.map((e,t)=>{if(e.length===0)return null;let n=t===R,r=t*50+1,i=Math.min((t+1)*50,F.length);return v(`div`,{className:`shrink-0 px-[16px] py-[6px] rounded-[16px] text-[14px] transition-colors cursor-pointer relative overflow-hidden ${n?`text-theme5 bg-bg2`:`text-text2 bg-bg2`}`,onClick:()=>{z(t),H()},children:[r,`-`,i,n&&_(`div`,{className:`absolute w-full h-full top-0 left-0 opacity-20 bg-theme5`})]},`series-group-${t}`)})}):null,q=v(`div`,{className:`pb-[8px] flex justify-between`,children:[_(`span`,{className:`text-[16px] text-text1`,children:B}),j&&v(`div`,{className:`flex items-center gap-[4px]`,children:[_(o,{size:`sm`,className:`data-checked:bg-theme5 h-[20px] w-[33px]`,checked:T,onCheckedChange:e=>{U(!!e)}}),_(`button`,{type:`button`,className:`text-[16px] text-text1`,onClick:()=>{U(!T)},children:A(`episodeTitle`)})]})]}),J=_(`div`,{className:`grid w-full gap-2 ${G===2?`grid-cols-2`:`grid-cols-5`}`,children:(I[R]||[]).map((e,t)=>{let n=!!(w&&e.id===w);return _(`button`,{type:`button`,"data-episode-id":e.id,onClick:()=>{W(e)},className:`flex items-center justify-center w-full h-[60px] rounded-[8px] border border-line1 border-solid text-[16px] cursor-pointer select-none transition-colors relative overflow-hidden ${n?`font-bold text-theme5 bg-line1`:`text-text1`} ${M?`h-[72px] px-[10px] text-[14px]`:``} ${t%G===0?``:`border-l-0`}`,children:M?_(`span`,{className:`leading-[22px] line-clamp-2`,children:e.title}):e.series_num},e.id)})});return l===`sheet`?_(n,{open:s,onOpenChange:e=>!e&&D(),children:v(r,{side:`bottom`,showCloseButton:!0,className:`min-h-[50vh] bg-bg1 text-text1 rounded-t-2xl border-t border-white/10`,children:[_(i,{className:`pt-3 pb-0`,children:_(a,{className:`flex items-center justify-between text-lg text-text1`,children:V})}),v(`div`,{className:`px-4 pb-2 flex flex-col gap-3`,children:[K,q]}),_(`div`,{ref:N,className:`flex-1 h-0 pt-[4px] pb-[12px] overflow-y-auto px-4`,children:J})]})}):_(u,{open:s,onOpenChange:e=>{e||D()},showCloseButton:!1,className:`border-0 bg-transparent p-0`,children:v(e,{className:`w-full flex flex-col bg-bg1 px-[12px] text-text1`,style:{height:`70vh`,...k},children:[v(e,{className:`shrink-0 flex justify-between items-center h-[48px]`,children:[_(t,{className:`text-[16px] font-bold text-text1`,children:V}),_(e,{className:`pl-[12px] h-full flex items-center`,onClick:D,children:_(c,{className:`w-[14px] h-[14px] text-text1 cursor-pointer`})})]}),v(e,{className:`flex-1 h-0 w-full pb-[12px] flex flex-col gap-3`,children:[K,q,_(e,{ref:N,className:`flex-1 h-0 pt-[4px] pb-[12px] overflow-y-auto`,children:J})]})]})})}function E({information:n,series_num:r,onEpisodeChange:i}){let a=b(`components.common`),[o,c]=s(`detail-series-popup-${n.id}`,!1),[u,x]=s(`detail-series-title-toggle-${n.id}`,!1),[C,w]=s(`detail-series-scroll-left-${n.id}`,null),[E,D]=h(r);f(()=>{D(r)},[n.id,r]);let O=p(()=>S((n.links||[]).map(e=>({id:e.id,name:e.name})),n.id||`episode`,e=>a(`seriesEpisodes.episodeLabel`,{episode:e})),[n.id,n.links,a]),k=n.update_status===`1`?a(`seriesEpisodes.completedSeriesTotal`,{total:n.links.length}):a(`seriesEpisodes.ongoingSeriesUpdatedTo`,{total:n.links.length}),A=p(()=>n.links[E-1]?.id||n.links[0]?.id||``,[n.links,E]),j=m(null),M=m(null),N=m(null),P=m(!1),F=m(null),I=m(null),L=m(null),[R,z]=h(!1),B=d((e,t=`smooth`)=>{let n=j.current?.querySelector(`[data-content-id="${e}"]`);if(n&&j.current){let e=j.current,r=Math.max(0,n.offsetLeft-10);e.scrollTo({left:r,behavior:t})}},[]),V=d(()=>{I.current!==null&&(window.clearTimeout(I.current),I.current=null)},[]),H=d(()=>{L.current!==null&&(window.clearTimeout(L.current),L.current=null)},[]),U=d(()=>{F.current!==null&&(y.dismiss(F.current),F.current=null),V(),H()},[H,V]),W=d(()=>{M.current=null,N.current=null,U(),z(!1)},[U]),G=d((e,t)=>{H(),L.current=window.setTimeout(()=>{L.current=null,M.current===e&&W()},Math.max(0,t))},[H,W]);f(()=>{P.current=!1},[n.id]),f(()=>{if(P.current||!A)return;let e=window.requestAnimationFrame(()=>{let e=j.current;e&&(typeof C==`number`?e.scrollTo({left:Math.max(0,C),behavior:`auto`}):(B(A,`auto`),w(Math.max(0,Math.round(e.scrollLeft)))),P.current=!0)});return()=>{window.cancelAnimationFrame(e)}},[A,C,B,w]),f(()=>{let e=M.current;!e||e!==r||G(e,1e3)},[G,r]),f(()=>()=>{W()},[W]);let K=d((e,t,n)=>{let r=j.current;if(!r||!e)return t;let i=r.querySelector(`[data-content-id="${e}"]`);if(!i)return t;let a=r.getBoundingClientRect();if(a.width<=0||typeof n!=`number`||(n-a.left)/a.width<.5)return t;let o=i.offsetLeft+i.offsetWidth/2,s=r.clientWidth/2,c=Math.max(0,r.scrollWidth-r.clientWidth),l=Math.min(c,Math.max(0,o-s));return r.scrollTo({left:l,behavior:`smooth`}),Math.round(l)},[]),q=d((e,t=`inline`,o,s)=>{if(e!==E){if(!n.links[e-1]){y.error(a(`seriesEpisodes.episodeNotFound`));return}if(typeof window<`u`&&window.isWebView===!0){let t=String(n.id||``).trim(),r=`/webview/${encodeURIComponent(t)}/${encodeURIComponent(String(n.name||``))}/episode/${e}`,{search:i,hash:a}=window.location;window.location.href=`${r}${i}${a}`;return}try{D(e);let c=o||n.links[e-1]?.id||``,l=Math.max(0,Math.round(j.current?.scrollLeft||0));t===`popup`?(c&&B(c,`auto`),w(Math.max(0,Math.round(j.current?.scrollLeft||0)))):w(K(c,l,s)),z(!0),U(),F.current=y.loading(a(`seriesEpisodes.episodeSwitching`)),M.current=e,N.current=t,I.current=window.setTimeout(()=>{M.current===e&&(D(r),W(),y.error(a(`seriesEpisodes.episodeSwitchFailed`)))},8e3),i(e)}catch(e){D(r),W(),console.error(`切换剧集失败`,e),y.error(a(`seriesEpisodes.episodeSwitchFailed`))}}},[W,U,n.id,n.links,n.name,i,E,r,K,B,w,a]),[J,Y]=h(`70vh`),X=d(()=>{if(typeof window>`u`)return;if(window.isWebView===!0){Y(`100vh`);return}let e=document.getElementById(`selectPopupPosition`),t=window.visualViewport?.height||window.innerHeight;if(!e){Y(`70vh`);return}let n=Math.max(0,t-e.offsetTop);if(n<=0){Y(`70vh`);return}Y(`${n}px`)},[]);return f(()=>{if(!o)return;X();let e=()=>{X()};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[X,o]),O.length<=1?null:v(g,{children:[v(e,{className:`w-full mt-[16px] flex flex-col items-end mb-[4px]`,children:[v(e,{className:`w-fit flex items-center px-[12px] h-[28px]`,onClick:()=>c(!0),children:[_(t,{className:`text-[14px] text-text2 leading-[20px]`,children:k}),_(l,{className:`w-[11px] h-[18px] ml-[4px] text-text2`})]}),_(`div`,{ref:j,className:`w-full mt-[12px] overflow-x-auto px-[12px] flex gap-x-[8px] ${u?`h-[76px]`:`h-[60px]`} ${R?`touch-none`:``}`,children:O.map((e,n)=>_(`div`,{"data-content-id":e.id,className:`shrink-0 h-[full] px-[18px] rounded-[6px] border border-line1 flex items-center ${u?`w-[162px]`:`w-[60px] !px-[0] justify-center`} ${e.id===A?`!border-theme5 bg-line1`:``}`,onClick:t=>{q(n+1,`inline`,e.id,t.clientX)},children:_(t,{className:`text-[16px] text-text1 leading-[22px] line-clamp-2 ${e.id===A?`font-bold !text-theme5`:``}`,children:u?e.title:e.series_num})},e.id))})]}),_(T,{title:a(`seriesEpisodes.selectorTitle`),variant:`popup`,open:o,updateStatus:n.update_status,summaryText:k,seriesList:(n.links||[]).map(e=>({id:e.id,name:e.name})),activeEpisodeId:A,showEpisodeTitle:u,onToggleTitle:e=>{x(e)},onClose:()=>c(!1),onSelectEpisode:(e,t)=>{c(!1),q(t,`popup`,e)},popupBodyStyle:{height:J}})]})}export{w as SeriesEpisodes};
|
|
2
|
+
"use client";import{Box as e}from"../../ui/box.mjs";import{Text as t}from"../../ui/text.mjs";import{Sheet as n,SheetContent as r,SheetHeader as i,SheetTitle as a}from"../../ui/sheet.mjs";import{Switch as o}from"../../ui/switch.mjs";import{useKeepAliveState as s}from"../keep-scroll-position/index.mjs";import c from"../../../assets/icons/close.mjs";import l from"../../../assets/icons/common/right_arrow.mjs";import u from"../../ui/popup.mjs";import{useCallback as d,useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as b}from"next-intl";function x(e,t,n){return(e||[]).map((e,r)=>{let i=Number.parseInt(e?.id||``,10),a=Number.isNaN(i)?r+1:i,o=e?.id||``,s=Number.isNaN(i)&&o||n(a);return{id:e?.id||`${t}-${a}`,series_num:a,title:s}})}function S(e,t,n){return(e||[]).map((e,r)=>{let i=Number(e?.id),a=Number.isNaN(i)?r+1:i,o=n(a);return{id:e?.id||`${t}-${a}`,series_num:a,title:o}})}function C(e,t,n){return e<=0?n(`singleContent`):n(t===`1`?`completedSeriesTotal`:`ongoingSeriesTotal`,{total:e})}function w(e){return e.mode===`detail`?_(E,{information:e.information,series_num:e.series_num,onEpisodeChange:e.onEpisodeChange}):_(T,{open:e.open,variant:e.variant,title:e.title,updateStatus:e.updateStatus,summaryText:e.summaryText,seriesList:e.seriesList,activeEpisodeId:e.activeEpisodeId,showEpisodeTitle:e.showEpisodeTitle,onToggleTitle:e.onToggleTitle,onClose:e.onClose,onSelectEpisode:e.onSelectEpisode,popupBodyStyle:e.popupBodyStyle})}function T({open:s,variant:l,title:d,updateStatus:g,summaryText:y,seriesList:S,activeEpisodeId:w,showEpisodeTitle:T=!1,onToggleTitle:E,onClose:D,onSelectEpisode:O,popupBodyStyle:k}){let A=b(`components.common.seriesEpisodes`),j=!!E,M=j&&T,N=m(null),P=m(null),F=p(()=>x(S,`episode`,e=>A(`episodeLabel`,{episode:e})),[S,A]),I=p(()=>{if(F.length===0)return[];let e=[];return F.forEach((t,n)=>{let r=Math.floor(n/50);e[r]||(e[r]=[]),e[r].push(t)}),e},[F]),L=p(()=>{if(!w)return 0;let e=F.findIndex(e=>e.id===w);return e<0?0:Math.floor(e/50)},[w,F]),[R,z]=h(L);f(()=>{z(L)},[L]);let B=p(()=>typeof y==`string`&&y.trim()?y:C(F.length,g,A),[F.length,y,A,g]),V=d||A(`selectorTitle`);function H(){let e=N.current;if(e){P.current&&=(window.cancelAnimationFrame(P.current),null),e.scrollTop=0;try{e.scrollTo({top:0,left:0,behavior:`auto`})}catch{}P.current=window.requestAnimationFrame(()=>{P.current=null;let e=N.current;e&&(e.scrollTop=0)})}}f(()=>{s&&H()},[s,T,R]);function U(e){E&&(E(e),H())}function W(e){O?.(e.id,e.series_num),D()}let G=M?2:5,K=I.length>1?_(`div`,{className:`shrink-0 w-full flex gap-[8px] overflow-x-auto`,children:I.map((e,t)=>{if(e.length===0)return null;let n=t===R,r=t*50+1,i=Math.min((t+1)*50,F.length);return v(`div`,{className:`shrink-0 px-[16px] py-[6px] rounded-[16px] text-[14px] transition-colors cursor-pointer relative overflow-hidden ${n?`text-theme5 bg-bg2`:`text-text2 bg-bg2`}`,onClick:()=>{z(t),H()},children:[r,`-`,i,n&&_(`div`,{className:`absolute w-full h-full top-0 left-0 opacity-20 bg-theme5`})]},`series-group-${t}`)})}):null,q=v(`div`,{className:`pb-[8px] flex justify-between`,children:[_(`span`,{className:`text-[16px] text-text1`,children:B}),j&&v(`div`,{className:`flex items-center gap-[4px]`,children:[_(o,{size:`sm`,className:`data-checked:bg-theme5 h-[20px] w-[33px]`,checked:T,onCheckedChange:e=>{U(!!e)}}),_(`button`,{type:`button`,className:`text-[16px] text-text1`,onClick:()=>{U(!T)},children:A(`episodeTitle`)})]})]}),J=_(`div`,{className:`grid w-full gap-2 ${G===2?`grid-cols-2`:`grid-cols-5`}`,children:(I[R]||[]).map((e,t)=>{let n=!!(w&&e.id===w);return _(`button`,{type:`button`,"data-episode-id":e.id,onClick:()=>{W(e)},className:`flex items-center justify-center w-full h-[60px] rounded-[8px] border border-line1 border-solid text-[16px] cursor-pointer select-none transition-colors relative overflow-hidden ${n?`font-bold text-theme5 bg-line1`:`text-text1`} ${M?`h-[72px] px-[10px] text-[14px]`:``} ${t%G===0?``:`border-l-0`}`,children:M?_(`span`,{className:`leading-[22px] line-clamp-2`,children:e.title}):e.series_num},e.id)})});return l===`sheet`?_(n,{open:s,onOpenChange:e=>!e&&D(),children:v(r,{side:`bottom`,showCloseButton:!0,className:`min-h-[50vh] bg-bg1 text-text1 rounded-t-2xl border-t border-white/10`,children:[_(i,{className:`pt-3 pb-0`,children:_(a,{className:`flex items-center justify-between text-lg text-text1`,children:V})}),v(`div`,{className:`px-4 pb-2 flex flex-col gap-3`,children:[K,q]}),_(`div`,{ref:N,className:`flex-1 h-0 pt-[4px] pb-[12px] overflow-y-auto px-4`,children:J})]})}):_(u,{open:s,onOpenChange:e=>{e||D()},showCloseButton:!1,className:`border-0 bg-transparent p-0`,children:v(e,{className:`w-full flex flex-col bg-bg1 px-[12px] text-text1`,style:{height:`70vh`,...k},children:[v(e,{className:`shrink-0 flex justify-between items-center h-[48px]`,children:[_(t,{className:`text-[16px] font-bold text-text1`,children:V}),_(e,{className:`pl-[12px] h-full flex items-center`,onClick:D,children:_(c,{className:`w-[14px] h-[14px] text-text1 cursor-pointer`})})]}),v(e,{className:`flex-1 h-0 w-full pb-[12px] flex flex-col gap-3`,children:[K,q,_(e,{ref:N,className:`flex-1 h-0 pt-[4px] pb-[12px] overflow-y-auto`,children:J})]})]})})}function E({information:n,series_num:r,onEpisodeChange:i}){let a=b(`components.common`),[o,c]=s(`detail-series-popup-${n.id}`,!1),[u,x]=s(`detail-series-title-toggle-${n.id}`,!1),[C,w]=s(`detail-series-scroll-left-${n.id}`,null),[E,D]=h(r);f(()=>{D(r)},[n.id,r]);let O=p(()=>S((n.links||[]).map(e=>({id:e.id,name:e.name})),n.id||`episode`,e=>a(`seriesEpisodes.episodeLabel`,{episode:e})),[n.id,n.links,a]),k=n.update_status===`1`?a(`seriesEpisodes.completedSeriesTotal`,{total:n.links.length}):a(`seriesEpisodes.ongoingSeriesUpdatedTo`,{total:n.links.length}),A=p(()=>n.links[E-1]?.id||n.links[0]?.id||``,[n.links,E]),j=m(null),M=m(null),N=m(null),P=m(!1),F=m(null),I=m(null),L=m(null),[R,z]=h(!1),B=d((e,t=`smooth`)=>{let n=j.current?.querySelector(`[data-content-id="${e}"]`);if(n&&j.current){let e=j.current,r=Math.max(0,n.offsetLeft-10);e.scrollTo({left:r,behavior:t})}},[]),V=d(()=>{I.current!==null&&(window.clearTimeout(I.current),I.current=null)},[]),H=d(()=>{L.current!==null&&(window.clearTimeout(L.current),L.current=null)},[]),U=d(()=>{F.current!==null&&(y.dismiss(F.current),F.current=null),V(),H()},[H,V]),W=d(()=>{M.current=null,N.current=null,U(),z(!1)},[U]),G=d((e,t)=>{H(),L.current=window.setTimeout(()=>{L.current=null,M.current===e&&W()},Math.max(0,t))},[H,W]);f(()=>{P.current=!1},[n.id]),f(()=>{if(P.current||!A)return;let e=window.requestAnimationFrame(()=>{let e=j.current;e&&(typeof C==`number`?e.scrollTo({left:Math.max(0,C),behavior:`auto`}):(B(A,`auto`),w(Math.max(0,Math.round(e.scrollLeft)))),P.current=!0)});return()=>{window.cancelAnimationFrame(e)}},[A,C,B,w]),f(()=>{let e=M.current;!e||e!==r||G(e,1e3)},[G,r]),f(()=>()=>{W()},[W]);let K=d((e,t,n)=>{let r=j.current;if(!r||!e)return t;let i=r.querySelector(`[data-content-id="${e}"]`);if(!i)return t;let a=r.getBoundingClientRect();if(a.width<=0||typeof n!=`number`||(n-a.left)/a.width<.5)return t;let o=i.offsetLeft+i.offsetWidth/2,s=r.clientWidth/2,c=Math.max(0,r.scrollWidth-r.clientWidth),l=Math.min(c,Math.max(0,o-s));return r.scrollTo({left:l,behavior:`smooth`}),Math.round(l)},[]),q=d((e,t=`inline`,o,s)=>{if(e!==E){if(!n.links[e-1]){y.error(a(`seriesEpisodes.episodeNotFound`));return}if(typeof window<`u`&&window.isWebView===!0){try{D(e);let c=o||n.links[e-1]?.id||``,l=Math.max(0,Math.round(j.current?.scrollLeft||0));t===`popup`?(c&&B(c,`auto`),w(Math.max(0,Math.round(j.current?.scrollLeft||0)))):w(K(c,l,s)),z(!0),U(),F.current=y.loading(a(`seriesEpisodes.episodeSwitching`)),M.current=e,N.current=t,I.current=window.setTimeout(()=>{M.current===e&&(D(r),W(),y.error(a(`seriesEpisodes.episodeSwitchFailed`)))},3e3),i(e)}catch(e){D(r),W(),console.error(`切换剧集失败`,e),y.error(a(`seriesEpisodes.episodeSwitchFailed`))}return}try{D(e);let c=o||n.links[e-1]?.id||``,l=Math.max(0,Math.round(j.current?.scrollLeft||0));t===`popup`?(c&&B(c,`auto`),w(Math.max(0,Math.round(j.current?.scrollLeft||0)))):w(K(c,l,s)),z(!0),U(),F.current=y.loading(a(`seriesEpisodes.episodeSwitching`)),M.current=e,N.current=t,I.current=window.setTimeout(()=>{M.current===e&&(D(r),W(),y.error(a(`seriesEpisodes.episodeSwitchFailed`)))},8e3),i(e)}catch(e){D(r),W(),console.error(`切换剧集失败`,e),y.error(a(`seriesEpisodes.episodeSwitchFailed`))}}},[W,U,n.links,i,E,r,K,B,w,a]),[J,Y]=h(`70vh`),X=d(()=>{if(typeof window>`u`)return;if(window.isWebView===!0){Y(`100vh`);return}let e=document.getElementById(`selectPopupPosition`),t=window.visualViewport?.height||window.innerHeight;if(!e){Y(`70vh`);return}let n=Math.max(0,t-e.offsetTop);if(n<=0){Y(`70vh`);return}Y(`${n}px`)},[]);return f(()=>{if(!o)return;X();let e=()=>{X()};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[X,o]),O.length<=1?null:v(g,{children:[v(e,{className:`w-full mt-[16px] flex flex-col items-end mb-[4px]`,children:[v(e,{className:`w-fit flex items-center px-[12px] h-[28px]`,onClick:()=>c(!0),children:[_(t,{className:`text-[14px] text-text2 leading-[20px]`,children:k}),_(l,{className:`w-[11px] h-[18px] ml-[4px] text-text2`})]}),_(`div`,{ref:j,className:`w-full mt-[12px] overflow-x-auto px-[12px] flex gap-x-[8px] ${u?`h-[76px]`:`h-[60px]`} ${R?`touch-none`:``}`,children:O.map((e,n)=>_(`div`,{"data-content-id":e.id,className:`shrink-0 h-[full] px-[18px] rounded-[6px] border border-line1 flex items-center ${u?`w-[162px]`:`w-[60px] !px-[0] justify-center`} ${e.id===A?`!border-theme5 bg-line1`:``}`,onClick:t=>{q(n+1,`inline`,e.id,t.clientX)},children:_(t,{className:`text-[16px] text-text1 leading-[22px] line-clamp-2 ${e.id===A?`font-bold !text-theme5`:``}`,children:u?e.title:e.series_num})},e.id))})]}),_(T,{title:a(`seriesEpisodes.selectorTitle`),variant:`popup`,open:o,updateStatus:n.update_status,summaryText:k,seriesList:(n.links||[]).map(e=>({id:e.id,name:e.name})),activeEpisodeId:A,showEpisodeTitle:u,onToggleTitle:e=>{x(e)},onClose:()=>c(!1),onSelectEpisode:(e,t)=>{c(!1),q(t,`popup`,e)},popupBodyStyle:{height:J}})]})}export{w as SeriesEpisodes};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../ui/button.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetRecommendVideoList as r}from"../../../service/generated/client.mjs";import{Image as i}from"../../ui/image.mjs";import{Box as a}from"../../ui/box.mjs";import{Item as o}from"../../ui/item.mjs";import{List as s}from"../../ui/list.mjs";import{Text as c}from"../../ui/text.mjs";import{Skeleton as l}from"../../ui/skeleton.mjs";import{usePaginated as u,useUpdateRequest as d}from"../../../hooks/query/use-query.mjs";import{useRequireLogin as f}from"../../../hooks/use-auth.mjs";import{eventKey as p}from"../../../constants/event-key.mjs";import m from"../../../assets/icons/right_arrow.mjs";import h from"../../../assets/images/user/default_avatar.mjs";import{memo as g,useCallback as _,useEffect as v,useMemo as y,useState as b}from"react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{useTranslations as C}from"next-intl";import w from"next/link";const T=typeof h==`string`?h:h.src;function E(){return x(a,{className:`w-full`,children:Array.from({length:6}).map((e,t)=>S(a,{className:`w-full h-[56px] flex items-center justify-between mb-[12px]`,children:[S(a,{className:`flex items-center`,children:[x(l,{className:`w-[56px] h-[56px] rounded-[28px]`}),S(a,{className:`ml-[8px]`,children:[x(l,{className:`w-[120px] h-[18px] mb-[8px]`}),x(l,{className:`w-[72px] h-[14px]`})]})]}),x(l,{className:`w-[76px] h-[34px] rounded-[18px]`})]},`search-user-skeleton-${t}`))})}const D=g(({item:e,onUpdate:t})=>{let r=C(`components.pages.search.searchResult`),{userInfo:o}=n();return _(n=>{t({...e,is_following:n?1:0})},[e,t]),x(a,{className:`w-full h-[56px] bg-bg1 flex flex-row items-center justify-between mb-[12px]`,children:S(w,{className:`cursor-pointer flex flex-row items-center justify-center`,href:`/profile/${e.user_id}`,children:[x(a,{className:`w-[56px] h-[56px] rounded-[28px] overflow-hidden bg-bg2 relative`,children:x(i,{src:e.avatar||T,fill:!0,objectFit:`cover`,alt:e.nick_name})}),S(a,{className:`flex flex-col ml-[8px]`,children:[x(c,{as:`span`,className:`text-text1 text-[16px] leading-[24px] h-[24px] font-bold w-[200px] inline-block truncate`,children:e.nick_name}),S(c,{as:`span`,className:`text-text2 leading-[22px] text-[14px]`,children:[e.follower_count??0,r(`searchUser.followersSuffix`)]})]})]})})});D.displayName=`UserItem`;const O=g(({list:n})=>{let r=f(),[i,o]=b({});v(()=>{o({})},[n]);let s=_(e=>{e.user_id&&o(t=>({...t,[e.user_id]:e.is_following?1:0}))},[]),l=y(()=>n.slice(0,3).map(e=>{let t=e.user_id||``;return!t||i[t]===void 0?e:{...e,is_following:i[t]}}),[i,n,3]),u=n.length>3,d=_(()=>{t.emit(p.EXCHANGE_SEARCH_TYPE,`user`)},[]);return l.length===0?null:S(a,{className:`w-full pt-[12px]`,children:[
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetRecommendVideoList as r}from"../../../service/generated/client.mjs";import{Image as i}from"../../ui/image.mjs";import{Box as a}from"../../ui/box.mjs";import{Item as o}from"../../ui/item.mjs";import{List as s}from"../../ui/list.mjs";import{Text as c}from"../../ui/text.mjs";import{Skeleton as l}from"../../ui/skeleton.mjs";import{usePaginated as u,useUpdateRequest as d}from"../../../hooks/query/use-query.mjs";import{useRequireLogin as f}from"../../../hooks/use-auth.mjs";import{eventKey as p}from"../../../constants/event-key.mjs";import m from"../../../assets/icons/right_arrow.mjs";import h from"../../../assets/images/user/default_avatar.mjs";import{memo as g,useCallback as _,useEffect as v,useMemo as y,useState as b}from"react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{useTranslations as C}from"next-intl";import w from"next/link";const T=typeof h==`string`?h:h.src;function E(){return x(a,{className:`w-full`,children:Array.from({length:6}).map((e,t)=>S(a,{className:`w-full h-[56px] flex items-center justify-between mb-[12px]`,children:[S(a,{className:`flex items-center`,children:[x(l,{className:`w-[56px] h-[56px] rounded-[28px]`}),S(a,{className:`ml-[8px]`,children:[x(l,{className:`w-[120px] h-[18px] mb-[8px]`}),x(l,{className:`w-[72px] h-[14px]`})]})]}),x(l,{className:`w-[76px] h-[34px] rounded-[18px]`})]},`search-user-skeleton-${t}`))})}const D=g(({item:e,onUpdate:t})=>{let r=C(`components.pages.search.searchResult`),{userInfo:o}=n();return _(n=>{t({...e,is_following:n?1:0})},[e,t]),x(a,{className:`w-full h-[56px] bg-bg1 flex flex-row items-center justify-between mb-[12px] px-[12px]`,children:S(w,{className:`cursor-pointer flex flex-row items-center justify-center`,href:`/profile/${e.user_id}`,children:[x(a,{className:`w-[56px] h-[56px] rounded-[28px] overflow-hidden bg-bg2 relative`,children:x(i,{src:e.avatar||T,fill:!0,objectFit:`cover`,alt:e.nick_name})}),S(a,{className:`flex flex-col ml-[8px]`,children:[x(c,{as:`span`,className:`text-text1 text-[16px] leading-[24px] h-[24px] font-bold w-[200px] inline-block truncate`,children:e.nick_name}),S(c,{as:`span`,className:`text-text2 leading-[22px] text-[14px]`,children:[e.follower_count??0,r(`searchUser.followersSuffix`)]})]})]})})});D.displayName=`UserItem`;const O=g(({list:n})=>{let r=f(),[i,o]=b({});v(()=>{o({})},[n]);let s=_(e=>{e.user_id&&o(t=>({...t,[e.user_id]:e.is_following?1:0}))},[]),l=y(()=>n.slice(0,3).map(e=>{let t=e.user_id||``;return!t||i[t]===void 0?e:{...e,is_following:i[t]}}),[i,n,3]),u=n.length>3,d=_(()=>{t.emit(p.EXCHANGE_SEARCH_TYPE,`user`)},[]);return l.length===0?null:S(a,{className:`w-full pt-[12px]`,children:[l.map((e,t)=>x(D,{item:e,onUpdate:e=>{r(()=>s(e))}},String(e.user_id??t))),u&&x(a,{className:`w-full flex items-center justify-center`,children:S(e,{variant:`ghost`,className:`w-fit h-[46px] leading-[46px] mx-auto mt-[-12px] text-[14px] text-text2`,onClick:d,children:[x(c,{as:`span`,children:`查看更多`}),x(m,{className:`w-[12px] h-[12px]`})]})})]})});O.displayName=`SearchUserWithLimit`;const k=g(({inputVal:e,sort:t,refreshVersion:n})=>{let i=C(`components.pages.search.searchResult`),c=f(),l=_(async n=>await r({data_type:2,extra_params:JSON.stringify({type:4,keywords:e,sort:t}),page:n||1,page_size:20}),[e,t]),p=y(()=>[`searchByKeyForUser`,e,4,t,n],[e,t,n]),m=u({key:p,initialPageParam:1,async queryFn(e){return(await l(e))?.data?.users??{has_more:!1,total:0,list:[]}},getNextPageParam(e,t){if(e.has_more)return t.length+1}}),h=d(),g=_((e,t)=>{e&&h(p,n=>n&&{...n,pages:n.pages.map(n=>({...n,list:(n.list??[]).map(n=>n.user_id===e?{...n,is_following:t?1:0}:n)}))})},[h,p]),v=async e=>{try{await m.fetchNextPage()}catch(e){console.error(`获取用户列表失败`,e)}},b=(m?.data?.pages??[]).flatMap(e=>e.list??[]),S=!!(m?.isPending||m?.isFetching);return S&&b.length===0?x(E,{}):x(a,{className:`w-full`,children:x(s,{loading:S,hasMore:m?.hasNextPage??!1,loadMore:v,empty:`nodata`,emptyText:i(`searchUser.emptyResult`),children:b.map((e,t)=>x(o,{children:x(D,{item:e,onUpdate:e=>{c(()=>{g(e.user_id||``,!!e.is_following)})}})},String(e.user_id??t)))})})});k.displayName=`SearchUserWithPagination`;const A=g(e=>e.mode===`all`?x(O,{list:e.list??[]}):x(k,{inputVal:e.inputVal??``,sort:e.sort??1,refreshVersion:e.refreshVersion??0}));A.displayName=`SearchUser`;export{A as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../ui/button.mjs";import t from"../../../utils/event-bus.mjs";import{gContentGetRecommendVideoList as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{Item as a}from"../../ui/item.mjs";import{List as o}from"../../ui/list.mjs";import{Text as s}from"../../ui/text.mjs";import{usePaginated as c}from"../../../hooks/query/use-query.mjs";import{eventKey as l}from"../../../constants/event-key.mjs";import{formatVideoDuration as u,getPostDetailPagePath as d}from"../../../utils/tools.mjs";import{apiCollectCustom as f}from"../../../utils/api-collect.mjs";import p from"../../../assets/icons/view.mjs";import{SearchVideoCardSkeleton as m}from"../../common/skeleton/search-video-card-skeleton.mjs";import h from"../../../assets/icons/right_arrow.mjs";import{memo as g,useCallback as _,useMemo as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{useTranslations as x}from"next-intl";import S from"next/link";const C=g(()=>y(m,{count:3}));C.displayName=`SearchVideoListSkeleton`;function w(e){let t=Number(e||0);return Number.isNaN(t)||t<=0?`0`:t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function T(e){let t=Number(e.episode_count||0),n=Number.isFinite(t)&&t>0,r=String(e.update_status??``).trim();return!n||t<=1?u(Number(e.duration||0)):r===`1`?`${t}集全`:`更新至${t}集`}const E=g(({item:e})=>{let t=e.name||``,n=e.img_x||e.img_y||``,a=T(e);return b(S,{className:`mb-[12px] block w-full border-b border-line1 px-[12px] pb-[12px]`,href:d({id:e.video_id,contentType:0}),onClick:()=>{e.video_id},children:[b(i,{className:`relative w-full overflow-hidden rounded-[12px] bg-neutral-800`,style:{aspectRatio:`16/9`},children:[n&&y(r,{src:n,alt:t||`封面`,fill:!0,objectFit:`cover`}),y(i,{className:`absolute inset-x-0 bottom-0 h-[40px] bg-gradient-to-t from-black/80 to-transparent z-0 pointer-events-none`}),b(i,{className:`absolute bottom-0 left-[8px] mb-[6px] z-10 flex items-center gap-[4px]`,children:[y(p,{className:`h-[14px] w-[14px] text-white`}),y(s,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:w(e.play_count)})]}),a&&y(i,{className:`absolute bottom-0 right-[8px] mb-[6px] z-10 flex items-center`,children:y(s,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:a})})]}),b(i,{className:`flex items-center justify-between gap-[12px] pt-[10px]
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import t from"../../../utils/event-bus.mjs";import{gContentGetRecommendVideoList as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{Item as a}from"../../ui/item.mjs";import{List as o}from"../../ui/list.mjs";import{Text as s}from"../../ui/text.mjs";import{usePaginated as c}from"../../../hooks/query/use-query.mjs";import{eventKey as l}from"../../../constants/event-key.mjs";import{formatVideoDuration as u,getPostDetailPagePath as d}from"../../../utils/tools.mjs";import{apiCollectCustom as f}from"../../../utils/api-collect.mjs";import p from"../../../assets/icons/view.mjs";import{SearchVideoCardSkeleton as m}from"../../common/skeleton/search-video-card-skeleton.mjs";import h from"../../../assets/icons/right_arrow.mjs";import{memo as g,useCallback as _,useMemo as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{useTranslations as x}from"next-intl";import S from"next/link";const C=g(()=>y(m,{count:3}));C.displayName=`SearchVideoListSkeleton`;function w(e){let t=Number(e||0);return Number.isNaN(t)||t<=0?`0`:t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function T(e){let t=Number(e.episode_count||0),n=Number.isFinite(t)&&t>0,r=String(e.update_status??``).trim();return!n||t<=1?u(Number(e.duration||0)):r===`1`?`${t}集全`:`更新至${t}集`}const E=g(({item:e})=>{let t=e.name||``,n=e.img_x||e.img_y||``,a=T(e);return b(S,{className:`mb-[12px] block w-full border-b border-line1 px-[12px] pb-[12px]`,href:d({id:e.video_id,contentType:0}),onClick:()=>{e.video_id},children:[b(i,{className:`relative w-full overflow-hidden rounded-[12px] bg-neutral-800`,style:{aspectRatio:`16/9`},children:[n&&y(r,{src:n,alt:t||`封面`,fill:!0,objectFit:`cover`}),y(i,{className:`absolute inset-x-0 bottom-0 h-[40px] bg-gradient-to-t from-black/80 to-transparent z-0 pointer-events-none`}),b(i,{className:`absolute bottom-0 left-[8px] mb-[6px] z-10 flex items-center gap-[4px]`,children:[y(p,{className:`h-[14px] w-[14px] text-white`}),y(s,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:w(e.play_count)})]}),a&&y(i,{className:`absolute bottom-0 right-[8px] mb-[6px] z-10 flex items-center`,children:y(s,{as:`span`,className:`text-[12px] font-medium text-white drop-shadow-md`,children:a})})]}),b(i,{className:`flex items-center justify-between gap-[12px] pt-[10px]`,children:[b(i,{className:`flex-1 min-w-0`,children:[y(s,{as:`h3`,className:`text-[16px] font-semibold leading-[24px] text-text1 line-clamp-1`,children:t}),e.description&&y(s,{as:`p`,className:`mt-[4px] text-[13px] leading-[20px] text-text2 line-clamp-1`,children:e.description})]}),y(s,{className:`shrink-0 rounded-[20px] border border-[#FD4C5E] px-[24px] py-[8px] text-[14px] font-normal text-[#FD4C5E]`,children:`观看`})]})]})});E.displayName=`VideoItem`;const D=g(({list:e})=>y(i,{className:`w-full pt-[12px]`,children:e.map((e,t)=>y(E,{item:e},String(e.video_id??t)))}));D.displayName=`VideoListContent`;const O=g(({list:n,hasMore:r})=>{let a=_(()=>{t.emit(l.EXCHANGE_SEARCH_TYPE,`video`)},[]);return b(i,{className:`w-full`,children:[y(D,{list:n}),r&&y(i,{className:`w-full flex items-center justify-center`,children:b(e,{variant:`ghost`,className:`w-fit h-[46px] leading-[46px] mx-auto mt-[-12px] text-[14px] text-text2`,onClick:a,children:[y(s,{as:`span`,children:`查看更多`}),y(h,{className:`w-[12px] h-[12px]`})]})})]})});O.displayName=`SearchVideoWithAll`;const k=g(({inputVal:e,sort:t,refreshVersion:r})=>{let s=x(`components.pages.search.searchResult`),l=_(async r=>await n({data_type:2,extra_params:JSON.stringify({type:3,keywords:e,sort:t}),page:r||1,page_size:20}),[e,t]),u=c({key:v(()=>[`searchByKeyForVideoInfo`,e,3,t,r],[e,t,r]),initialPageParam:1,async queryFn(e){return(await l(e))?.data?.videos??{has_more:!1,total:0,list:[]}},getNextPageParam(e,t){if(e.has_more)return t.length+1}}),d=v(()=>{let e=u.data?.pages??[],t=[];for(let n of e){let e=n.list??[];t.push(...e)}return t},[u.data?.pages]),f=u.isPending||u.isFetching;return f&&d.length===0?y(C,{}):y(i,{className:`w-full`,children:y(o,{loading:f,hasMore:u.hasNextPage??!1,loadMore:async e=>{try{await u.fetchNextPage()}catch(e){console.error(`获取内容列表失败`,e)}},empty:`nodata`,emptyText:s(`searchVideoInfo.noRelevantContent`),children:d.map((e,t)=>y(a,{className:`p-0`,children:y(E,{item:e})},String(e.video_id??t)))})})});k.displayName=`SearchVideoWithPagination`;const A=g(e=>e.mode===`all`?y(O,{list:e.list,hasMore:e.hasMore}):y(k,{inputVal:e.inputVal,sort:e.sort,refreshVersion:e.refreshVersion}));A.displayName=`SearchVideo`;export{A as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{cn as t}from"../../../utils/cn.mjs";import{gContentGetAppChannels as n,gContentGetVideoDetail as r}from"../../../service/generated/client.mjs";import{useRouter as i}from"../../../utils/use-compatible-router.mjs";import{EmptyState as a}from"../../ui/empty.mjs";import{notifyBridgeEpisodeChanged as
|
|
2
|
+
"use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{cn as t}from"../../../utils/cn.mjs";import{gContentGetAppChannels as n,gContentGetVideoDetail as r}from"../../../service/generated/client.mjs";import{useRouter as i}from"../../../utils/use-compatible-router.mjs";import{EmptyState as a}from"../../ui/empty.mjs";import{buildVideoPlayerSrc as o}from"../../common/video-player/process-m3u8-cache.mjs";import{notifyBridgeEpisodeChanged as s}from"../../../utils/login-modal-bridge.mjs";import{useRequest as c}from"../../../hooks/query/use-query.mjs";import{queryKey as l}from"../../../constants/query-key.mjs";import{useKeepAliveEffect as u,useKeepAliveState as d}from"../../common/keep-scroll-position/index.mjs";import{apiCollectClick as f}from"../../../utils/api-collect.mjs";import p from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{VideoDetailMaterialRuntimeProvider as m}from"../../biz/business/detail/shared/runtime-context-provider.mjs";import{resolveMaterialProps as h,videoDetailMaterials as ee}from"../../biz/business/detail/shared/registry.mjs";import{DetailHero as te}from"../../biz/business/detail/shared/video-hero.mjs";import{Fragment as ne,useCallback as g,useEffect as _,useMemo as v}from"react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import{useParams as re,useSearchParams as ie}from"next/navigation";import{useTranslations as ae}from"next-intl";const S=[{id:`detail-info`,componentName:`video-detail-info`,props:{}},{id:`detail-info-title-tags-episodes`,componentName:`video-detail-info-title-tags-episodes`,props:{}},{id:`detail-actions`,componentName:`video-detail-actions`,props:{}},{id:`detail-recommend`,componentName:`video-detail-recommend`,props:{title:`猜你喜欢`,rows:2,columns:3,smartTagEnabled:!1,smartTagIds:[`腐剧`],showPlayCount:!0,playCountDelta:0,showEpisode:!0,enableInfinite:!1,items:[{contentId:`d6a35ba3279e6f0d`,contentName:`贺总的私宠罪妻`,titleMode:`custom`,title:`贺总的私宠罪妻`,description:`简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百简介多少字是不是两百`,coverMode:`upload`,coverUrl:`/truss/20260227/69a136457d10f.jpgxxx`,showPlayCount:!0,playCountDelta:0,showEpisode:!0},{contentId:`b0f42fed731239a7`,contentName:`少年江湖物语`,titleMode:`custom`,title:`少年江湖物语`,description:`网剧《少年江湖物语》讲述了一个江湖中邪不压正,青春正好,有情有爱的温暖故事。剧中有魔教教主,有天下第一剑客,有身世成谜的江湖大夫,有忠心耿耿的小丫鬟,更有艳压秦淮的当红花魁,众多看似完全没有交集的人物纷纷亮相登场,搅乱江湖一池春水。`,coverMode:`content`,coverUrl:`/md-204/uploads/default/other/2024-08-26/14664d2c31e61c201a29cd4abba267c5.jpg`,showPlayCount:!0,playCountDelta:0,showEpisode:!0},{contentId:`c2304e94ec0ba208`,contentName:`王的男人`,titleMode:`custom`,title:`王的男人`,description:`朝鲜第十代王燕山王君时期,艺人长生(甘宇成饰)和孔吉(李俊基饰)因为不肯加入当地的艺人团,来到京城汉阳谋生。此时暴君燕山君(郑镇荣饰)沉迷于宠妾张绿水(姜成妍饰),朝纲混乱,民不聊生。长生与孔吉二人在街头开始表演讽刺君主的喜剧,大受欢迎,却遭逮捕。后要求到王面前表演,求得一笑。结果,多亏孔吉的急中生智,燕山君才笑了出来。两人随即被留在宫中取乐,孔吉更是因为美色令王倍加宠爱。他们不停表演,大臣们却各自心怀鬼胎,导致了杀戮局面。最终,君王和艺人的命运又将如何呢?`,coverMode:`content`,coverUrl:`/md-204/resource/8c/8cb28f46831558fbeb2f34b2076c3b4e.jpg`,showPlayCount:!0,playCountDelta:0,showEpisode:!0},{contentId:`c7ffc6a558ae8683`,contentName:`怒`,titleMode:`custom`,title:`怒`,description:`炎炎夏日,东京八王子郊外社区,一对夫妇惨遭杀害。事后凶手用血在墙上写下大大的“怒”字,随后逃亡,销声匿迹长达一年之久。而在此期间,三个身份不明的男子和身边的人相遇了。曾自甘堕落的爱子(宫崎葵饰)被父亲(渡边谦饰)领回海滨小镇,邂逅了不善言辞的哲也(松山研一饰)。在东京工作的同性恋优马(妻夫木聪饰)将柔情似水的直人(绫野刚饰)带回了家,他不相信对方,却又尝试去相信。随母亲搬到冲绳的小泉(广濑铃饰)跟着同学辰哉(佐久本宝饰)登上一座荒岛,在废墟中遇到了背包客田中(森山未来饰),他们短暂成为朋友,而可怕的命运突然降临泉的头上。不久之后,通缉令遍布全国,三个男子的真实身份引人生疑……本片根据吉田修一的同名原作改编。`,coverMode:`content`,coverUrl:`/md-204/resource/24/24ef267eef2c35b5e4cf12dac8b55c14.jpg`,showPlayCount:!0,playCountDelta:0,showEpisode:!0},{contentId:`98217427ed96ec51`,contentName:`熔炉`,titleMode:`custom`,title:`熔炉`,description:`来自首尔的哑语美术老师仁浩(孔宥饰)来到雾津,应聘慈爱聋哑人学校。天降大雾,他意外撞车,维修时邂逅了人权组织成员柔珍(郑有美饰)。仁浩妻子早亡,8岁女儿天生哮喘由祖母照看,所以他不辞辛苦谋职养家。然而,双胞胎的校长与教导主任竟逼仁浩索贿5千万韩元。同时,仁浩逐渐发现学校笼罩着一种紧张压抑的气氛,令人窒息。有三个孩子引人关注:聪颖的金妍斗(金贤秀饰)、贪吃的陈宥利(郑仁絮饰)和弟弟自杀身亡的全民秀(白承焕饰),民秀总是满脸淤青。下课后,仁浩还听到女厕所中有呼喊与哭泣,在门卫的阻拦下他未深究。之后。他意外目睹了校长行贿警察,教导员毒打民秀,宿导溺罚妍斗的行径。一个惊天的隐秘被慢慢揭开,真相令韩国震惊……本片取材于2005年光州一所聋哑障碍人学校的真实事件,改编自韩国作家孔枝泳的同名小说。`,coverMode:`content`,coverUrl:`/md-204/resource/b4/b410ccdcd86936455b9460a9152aaa47.jpg`,showPlayCount:!0,playCountDelta:0,showEpisode:!0},{contentId:`caa2b4eb4eb40de0`,contentName:`再次来寻我`,titleMode:`custom`,title:`再次来寻我`,description:`在宇回到曾经与初恋志勋相遇的303号房,这里即将被拆迁,他在房间里回忆和志勋的点点滴滴,突然被书桌上的电话所吸引,一拿起话筒听到的竟是志勋的声音!在房子主人的同意下,在宇带着电话离开了303室,在回家的途中他发现自己像走在一个陌生的地方,而对面走来的竟是已消失已久的志勋…`,coverMode:`content`,coverUrl:`/md-204/resource/2b/2b43375f2248c1a012847d4507fd21a3.jpg`,showPlayCount:!0,playCountDelta:0,showEpisode:!0}]}}];function C(e,t){let n=String(e||``).split(`/`).filter(Boolean),r=n.findIndex(e=>e===`video`||e===`webview`);return r<0?!1:n[r+1]===t}function w({detailId:f,initialInformation:w,isWebView:T=!1,materialConfig:E}){let D=ae(`components.pages.videoDetail`),O=i(),oe=re(),se=ie(),k=oe.level,A=Array.isArray(k)?k:typeof k==`string`?[k]:[],j=A.findIndex(e=>e===`episode`),ce=j>=0?A[j+1]:A[2],M=Math.max(1,Number(ce)||1),[le,N]=d(`detail-current-series-num-${f}`,M);_(()=>{N(M)},[M,N]);let P=Math.max(1,Number(le)||1),F=Math.max(0,P-1),{data:I,isPending:L,isFetching:R,isError:z,isSuccess:B}=c(v(()=>[`video-detail`,f],[f]),async()=>f?await r({id:f}):null,{enabled:!!f}),V=v(()=>{let e=I?.data?.video;return!e||typeof e!=`object`?null:{...e,content_type:1,episode_cnt:e.links?.length||0}},[I?.data?.video]),H=w??V??null,[U,W]=d(`detail-information-${f}`,H),ue=U?.links?.[F]?.id||``,G=!!f&&!U&&(L||R),K=!f||!!U||z||B,[de,fe]=d(`info-detail-active-tab-${f}`,`video`),[q,J]=d(`info-detail-comment-add-count-${f}`,0),[Y,pe]=d(`info-detail-comment-total-${f}`,void 0);_(()=>{!U&&V&&W(V)},[U,V,W]);let X=g(e=>{W(t=>t&&{...t,...e})},[W]);u(()=>{U?.id&&U.id},[U?.id],`detail-page-report-${f}`),_(()=>{!U||typeof window>`u`||window.sensors?.track?.(`detail_page_view`,{object_id:U.id||f,author_id:U.up_user,object_type:U.content_type,object_category:U.content_type,object_tags:U.tags?.map(e=>e.name),block_id:``,page_source:window.location?.pathname||``})},[f,U]),_(()=>{J(0)},[ue,J]),v(()=>(typeof Y==`number`?Y:0)+q,[q,Y]);let me=g(()=>{},[!1,fe]);g(()=>{J(e=>e+1)},[J]),_(()=>{},[!1,me,U?.id,se]);let Z=g(e=>{let t=Math.max(1,Math.floor(Number(e)||1));if(typeof window>`u`)return;let n=String(U?.id||f||``).trim();if(!n)return;let r=T||window.isWebView===!0,i=`/${r?`webview`:`video`}/${n}/${encodeURIComponent(U?.name||``)}/episode/${t}`,{search:a,hash:c,pathname:l}=window.location,u=`${i}${a}${c}`,d=`${l}${a}${c}`,p=C(l,n);if(d!==u){if(r){let e=U?.links?.[Math.max(0,t-1)],r=o(String(e?.m3u8_url||e?.preview_m3u8_url||``).trim());s({poster:String(U?.img_y||U?.img_x||U?.preview_images?.[0]||``).trim(),src:r,title:String(U?.title||U?.name||``).trim(),contentId:n,episode:t}),P!==t&&N(t);return}p&&typeof window.history?.replaceState==`function`?(window.history.replaceState(window.history.state,``,u),N(t)):O.replace(u,{scroll:!1});return}P!==t&&N(t)},[P,f,U?.id,U?.img_x,U?.img_y,U?.links,U?.name,U?.preview_images,U?.title,T,O,N]),Q=U?.status===`1`,{data:he}=c([l.CHANNEL],()=>n()),ge=e(he?.data),$=v(()=>{if(E!==void 0){let e=new Map(S.map(e=>[e.componentName,e]));return E.map(t=>{let n=e.get(t.componentName);return{...n,...t,props:{...n?.props??{},...t.props??{}}}})}return S},[E]),_e=v(()=>({information:U??void 0,currentSeriesNum:P,onEpisodeChange:Z,onUpdateInformation:X,detailId:f,episodeIndex:F,isShow:!0,isWebView:T,isInformationLoading:G,isInformationResolved:K}),[P,f,F,Z,X,U,G,K,T,!0]),ve=g(e=>{if(!U)return null;let t=ee[e.componentName];if(!t)return null;let n=t.clientComponent,r=h(t,e.props);return r.isValid?b(n,{...r.props}):b(`div`,{children:`组件配置错误`})},[U]);return x(`div`,{className:`w-full min-h-screen bg-bg2 text-text1 ${T?``:`pt-11`}`,children:[!T&&b(`div`,{className:`fixed bg-black top-0 left-0 right-0 z-[1000]`,children:b(p,{data:{list:ge}})}),b(`div`,{className:`mx-auto w-full max-w-[840px] pb-6`,children:x(y,{children:[U&&!Q&&b(a,{type:`no-content`,text:D(`videoDetailClient.videoUnavailable`)}),U&&Q&&x(y,{children:[!T&&b(te,{isVideo:!0,information:U,episodeIndex:F}),b(`div`,{id:`selectPopupPosition`,className:`w-full`}),!1,x(`div`,{className:t(`w-full`,!1),children:[b(m,{value:_e,children:$.map(e=>b(ne,{children:ve(e)},e.id))}),!1]}),!1]}),!U&&b(a,{type:`no-content`,text:D(`videoDetailClient.videoDeleted`)})]})})]})}export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{pContentGetNewstVideoList as e,pContentGetTopRatedVideoList as t}from"../../../service/generated/client.mjs";import{pContentGetNewstVideoListKey as n,pContentGetTopRatedVideoListKey as r}from"../../../service/generated/tanstack.mjs";import{HydrationBoundary as i}from"../../../hooks/query/hydration-boundary.mjs";import{revalidate as a}from"../../../constants/revalidate.mjs";import{getNextVideoListPageParam as o,resolveNextCursor as s}from"./types.mjs";import c from"./video-list-client.mjs";import{jsx as l}from"react/jsx-runtime";async function u({title:u=`列表页`,tags:d=[]}={}){let f={page_size:10,tags:d.length?d:void 0};return l(i,{prefetch:[{type:`infinite`,queryKey:r(f),queryFn:async e=>{let n=(await t({page_size:10,cursor:e||void 0,tags:d.length?d:void 0},{revalidate:a.TIME})).data,r=Array.isArray(n?.videos)?n.videos:[];return{list:r,nextCursor:r.length<10?``:s(n)}},initialPageParam:``,getNextPageParam:e=>o(e)},{type:`infinite`,queryKey:n(f),queryFn:async t=>{let n=(await e({page_size:10,cursor:t||void 0,tags:d.length?d:void 0},{revalidate:a.TIME})).data;return{list:
|
|
2
|
+
import{pContentGetNewstVideoList as e,pContentGetTopRatedVideoList as t}from"../../../service/generated/client.mjs";import{pContentGetNewstVideoListKey as n,pContentGetTopRatedVideoListKey as r}from"../../../service/generated/tanstack.mjs";import{HydrationBoundary as i}from"../../../hooks/query/hydration-boundary.mjs";import{revalidate as a}from"../../../constants/revalidate.mjs";import{getNextVideoListPageParam as o,resolveNextCursor as s}from"./types.mjs";import c from"./video-list-client.mjs";import{jsx as l}from"react/jsx-runtime";async function u({title:u=`列表页`,tags:d=[]}={}){let f={page_size:10,tags:d.length?d:void 0};return l(i,{prefetch:[{type:`infinite`,queryKey:r(f),queryFn:async e=>{let n=(await t({page_size:10,cursor:e||void 0,tags:d.length?d:void 0},{revalidate:a.TIME})).data,r=Array.isArray(n?.videos)?n.videos:[];return{list:r,nextCursor:r.length<10?``:s(n)}},initialPageParam:``,getNextPageParam:e=>o(e)},{type:`infinite`,queryKey:n(f),queryFn:async t=>{let n=(await e({page_size:10,cursor:t||void 0,tags:d.length?d:void 0},{revalidate:a.TIME})).data,r=Array.isArray(n?.videos)?n.videos:[];return{list:r,nextCursor:r.length<10?``:s(n)}},initialPageParam:``,getNextPageParam:e=>o(e)}],children:l(c,{title:u,tags:d})})}export{u as VideoListPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../ui/button.mjs";import{pContentGetNewstVideoList as t,pContentGetTopRatedVideoList as n}from"../../../service/generated/client.mjs";import{pContentGetNewstVideoListKey as r,pContentGetTopRatedVideoListKey as i}from"../../../service/generated/tanstack.mjs";import{useRouter as a}from"../../../utils/use-compatible-router.mjs";import{Box as o}from"../../ui/box.mjs";import{InfiniteScroll as s}from"../../ui/infinite-scroll.mjs";import{Text as c}from"../../ui/text.mjs";import{usePaginated as l}from"../../../hooks/query/use-query.mjs";import u from"../../../assets/icons/left_arrow.mjs";import{getNextVideoListPageParam as d,resolveNextCursor as f}from"./types.mjs";import{VideoListItemComponent as p}from"./video-list-item.mjs";import{VideoListSkeleton as m}from"./video-list-skeleton.mjs";import{useEffect as h,useMemo as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import b from"next/link";const x=[];function S({title:S=`列表页`,tags:C=x}){let w=a(),[T,E]=_(`hot`),D=g(()=>({page_size:10,tags:C.length?C:void 0}),[C]),{data:O,fetchNextPage:k,hasNextPage:A,isPending:j,isFetching:M}=l({key:g(()=>T===`hot`?i(D):r(D),[D,T]),queryFn:async e=>{let r={page_size:10,cursor:e||void 0,tags:C.length?C:void 0},i=(T===`hot`?await n(r):await t(r)).data,a=Array.isArray(i?.videos)?i.videos:[];return{list:a,nextCursor:
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{pContentGetNewstVideoList as t,pContentGetTopRatedVideoList as n}from"../../../service/generated/client.mjs";import{pContentGetNewstVideoListKey as r,pContentGetTopRatedVideoListKey as i}from"../../../service/generated/tanstack.mjs";import{useRouter as a}from"../../../utils/use-compatible-router.mjs";import{Box as o}from"../../ui/box.mjs";import{InfiniteScroll as s}from"../../ui/infinite-scroll.mjs";import{Text as c}from"../../ui/text.mjs";import{usePaginated as l}from"../../../hooks/query/use-query.mjs";import u from"../../../assets/icons/left_arrow.mjs";import{getNextVideoListPageParam as d,resolveNextCursor as f}from"./types.mjs";import{VideoListItemComponent as p}from"./video-list-item.mjs";import{VideoListSkeleton as m}from"./video-list-skeleton.mjs";import{useEffect as h,useMemo as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import b from"next/link";const x=[];function S({title:S=`列表页`,tags:C=x}){let w=a(),[T,E]=_(`hot`),D=g(()=>({page_size:10,tags:C.length?C:void 0}),[C]),{data:O,fetchNextPage:k,hasNextPage:A,isPending:j,isFetching:M}=l({key:g(()=>T===`hot`?i(D):r(D),[D,T]),queryFn:async e=>{let r={page_size:10,cursor:e||void 0,tags:C.length?C:void 0},i=(T===`hot`?await n(r):await t(r)).data,a=Array.isArray(i?.videos)?i.videos:[];return{list:a,nextCursor:a.length<10?``:f(i)}},getNextPageParam:d,initialPageParam:``,options:{staleTime:0,refetchOnMount:`always`,refetchOnWindowFocus:!1,refetchOnReconnect:!1}}),N=g(()=>O?.pages?.flatMap(e=>e.list)??[],[O?.pages]),P=(O?.pages?.length??0)>0,F=g(()=>P?A??!1:!0,[P,A]),I=N.length===0&&(!P||j||M);h(()=>{typeof window>`u`||window.scrollTo({top:0,behavior:`auto`})},[T]);function L(){w.back()}let R=g(()=>N.map(e=>{let t=e.id??e.mid??``;return v(b,{href:`/video/${t}/${e.name??``}`,children:v(p,{item:e})},t)}),[N]);return I?v(m,{}):y(o,{as:`main`,className:`min-h-[100dvh] bg-bg1`,children:[y(o,{className:`fixed top-0 left-0 right-0 z-20 bg-bg1`,children:[y(o,{as:`header`,className:`flex items-center gap-2 px-4 py-3`,children:[v(u,{className:`w-[16px] h-[16px]`,onClick:L}),v(c,{as:`h1`,className:`flex-1 min-w-0 flex justify-center overflow-hidden text-[18px] pr-[16px]`,children:v(c,{className:`block max-w-full truncate`,children:S})})]}),y(o,{as:`nav`,className:`px-4 pb-2 flex gap-2`,children:[v(e,{type:`button`,onClick:()=>E(`hot`),className:`h-[30px] px-[12px] text-[14px] rounded-[50px] ${T===`hot`?`bg-theme5 text-text1`:`bg-transparent text-text2`}`,children:`最热`}),v(e,{type:`button`,onClick:()=>E(`latest`),className:`h-[30px] px-[12px] text-[14px] rounded-[50px] ${T===`latest`?`bg-theme5 text-text1`:`bg-transparent text-text2`}`,children:`最新`})]})]}),v(s,{loadMore:()=>k().then(()=>void 0),hasMore:F,noMoreText:`没有更多了`,threshold:300,className:`pt-[88px]`,children:v(o,{className:`grid grid-cols-2 gap-3 p-4`,children:R})},T)]})}export{S as default};
|
|
@@ -6,7 +6,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
6
6
|
//#region components/ui/badge.d.ts
|
|
7
7
|
/** badgeVariants 工具定义。 */
|
|
8
8
|
declare const badgeVariants: (props?: ({
|
|
9
|
-
variant?: "
|
|
9
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
10
10
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
11
11
|
/** Badge 组件。 */
|
|
12
12
|
declare function Badge({
|
|
@@ -7,7 +7,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
|
|
|
7
7
|
//#region components/ui/button.d.ts
|
|
8
8
|
/** buttonVariants 工具定义。 */
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
|
-
variant?: "
|
|
10
|
+
variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
|
|
11
11
|
size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
12
12
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
13
13
|
/** Button 组件属性。 */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
-
import
|
|
4
|
+
import NextImage from "next/image";
|
|
5
5
|
|
|
6
6
|
//#region components/ui/image.d.ts
|
|
7
7
|
/** BaseImageProps 属性定义。 */
|
|
8
|
-
type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof
|
|
8
|
+
type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof NextImage>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
|
|
9
9
|
type CommonImageProps = BaseImageProps & {
|
|
10
10
|
/** 图片地址,支持普通 URL、默认资源路径和加密地址。 */src: string; /** 图片替代文本。 */
|
|
11
11
|
alt?: string; /** 图片类名。 */
|
|
@@ -27,6 +27,6 @@ type ImagePropsWithSize = CommonImageProps & {
|
|
|
27
27
|
/** ImageProps 属性定义。 */
|
|
28
28
|
type ImageProps = ImagePropsWithFill | ImagePropsWithSize;
|
|
29
29
|
/** 图片组件:支持 bnc 解密、默认资源域名拼接与错误占位。 */
|
|
30
|
-
declare function Image
|
|
30
|
+
declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { BaseImageProps, CommonImageProps, Image
|
|
32
|
+
export { BaseImageProps, CommonImageProps, Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
|