@funhub/platform 0.2.13 → 0.2.14

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.
Files changed (92) hide show
  1. package/dist/biz.mjs +1 -1
  2. package/dist/common.d.mts +2 -1
  3. package/dist/common.mjs +1 -1
  4. package/dist/components/biz/basics/logo/variants/basic-logo/runtime/client.mjs +1 -1
  5. package/dist/components/biz/business/advertisement/ad-match.mjs +1 -1
  6. package/dist/components/biz/business/advertisement/banner-ad/client.d.mts +3 -1
  7. package/dist/components/biz/business/advertisement/banner-ad/client.mjs +1 -1
  8. package/dist/components/biz/business/advertisement/banner-ad/schema.d.mts +12 -0
  9. package/dist/components/biz/business/advertisement/floating-ad/client.d.mts +2 -0
  10. package/dist/components/biz/business/advertisement/floating-ad/client.mjs +1 -1
  11. package/dist/components/biz/business/advertisement/floating-ad/schema.d.mts +12 -0
  12. package/dist/components/biz/business/advertisement/icon-ad/client.d.mts +3 -1
  13. package/dist/components/biz/business/advertisement/icon-ad/client.mjs +1 -1
  14. package/dist/components/biz/business/advertisement/icon-ad/schema.d.mts +12 -0
  15. package/dist/components/biz/business/advertisement/popup-ad/client.d.mts +3 -1
  16. package/dist/components/biz/business/advertisement/popup-ad/client.mjs +2 -2
  17. package/dist/components/biz/business/advertisement/popup-ad/schema.d.mts +3 -1
  18. package/dist/components/biz/business/advertisement/text-ad/client.d.mts +3 -1
  19. package/dist/components/biz/business/advertisement/text-ad/client.mjs +1 -1
  20. package/dist/components/biz/business/advertisement/text-ad/schema.d.mts +12 -0
  21. package/dist/components/biz/business/detail/shared/detail-info-tags.mjs +1 -1
  22. package/dist/components/biz/business/detail/shared/detail-info-title.mjs +1 -1
  23. package/dist/components/biz/business/detail/shared/detail-operate.mjs +1 -1
  24. package/dist/components/biz/business/detail/shared/video-hero.mjs +1 -1
  25. package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
  26. package/dist/components/biz/business/nav-bar/variants/basic-nav-bar/runtime/client.mjs +1 -1
  27. package/dist/components/biz/business/profile/profile-header/client.mjs +1 -1
  28. package/dist/components/biz/business/profile/profile-header/user-profile-avatar.mjs +1 -1
  29. package/dist/components/biz/business/profile/profile-main/shell.mjs +1 -1
  30. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.mjs +1 -1
  31. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +1 -1
  32. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
  33. package/dist/components/biz/business/profile/tracking.mjs +2 -0
  34. package/dist/components/biz/business/search-bar/variants/basic-search-bar/runtime/client.mjs +1 -1
  35. package/dist/components/biz/business/search-history/client.mjs +1 -1
  36. package/dist/components/biz/business/tab-bar/client.mjs +1 -1
  37. package/dist/components/common/analytics-init/analytics-init.mjs +1 -1
  38. package/dist/components/common/analytics-init/index.d.mts +2 -1
  39. package/dist/components/common/analytics-init/sensor-init.d.mts +20 -0
  40. package/dist/components/common/analytics-init/sensor-init.mjs +2 -0
  41. package/dist/components/common/list/user-activity-list/user-activity-list-item.d.mts +2 -0
  42. package/dist/components/common/list/user-activity-list/user-activity-list-item.mjs +1 -1
  43. package/dist/components/common/list/user-activity-list/user-activity-list.d.mts +2 -0
  44. package/dist/components/common/list/user-activity-list/user-activity-list.mjs +1 -1
  45. package/dist/components/common/list/waterfall-recommend/waterfall-recommend.d.mts +4 -1
  46. package/dist/components/common/list/waterfall-recommend/waterfall-recommend.mjs +1 -1
  47. package/dist/components/common/login-dialog/login-dialog.mjs +1 -1
  48. package/dist/components/common/series-episodes/index.mjs +1 -1
  49. package/dist/components/common/top-nav-bar/client.mjs +1 -1
  50. package/dist/components/common/video-player/preroll-skip-button-content.mjs +2 -0
  51. package/dist/components/common/video-player/video-blind-ad-overlay.mjs +1 -1
  52. package/dist/components/common/video-player/video-preroll-ad-overlay.mjs +2 -0
  53. package/dist/components/common/video-player/video-preroll-ad.mjs +1 -1
  54. package/dist/components/pages/(follow)/_components/header-nav/index.mjs +1 -1
  55. package/dist/components/pages/collection-add/page.mjs +1 -1
  56. package/dist/components/pages/collection-create/form.mjs +1 -1
  57. package/dist/components/pages/collection-detail/detail.mjs +1 -1
  58. package/dist/components/pages/edit/page.mjs +1 -1
  59. package/dist/components/pages/feed-series/feed-series-client.mjs +1 -1
  60. package/dist/components/pages/feedback/_components/feedback-form.mjs +1 -1
  61. package/dist/components/pages/fullscreen-feed/page.mjs +1 -1
  62. package/dist/components/pages/home/client.mjs +1 -1
  63. package/dist/components/pages/home/index.mjs +1 -1
  64. package/dist/components/pages/login/index.mjs +1 -1
  65. package/dist/components/pages/login/login-client.mjs +1 -1
  66. package/dist/components/pages/login/register.mjs +1 -1
  67. package/dist/components/pages/login/tracking.mjs +2 -0
  68. package/dist/components/pages/post-detail/post-detail-client.mjs +1 -1
  69. package/dist/components/pages/publish/page-client.mjs +1 -1
  70. package/dist/components/pages/search/hot-recommend.mjs +1 -1
  71. package/dist/components/pages/search/page-client.mjs +1 -1
  72. package/dist/components/pages/search/search-result/search-user.mjs +1 -1
  73. package/dist/components/pages/search/search-result/search-video-info.mjs +1 -1
  74. package/dist/components/pages/search/search-result/shared.mjs +1 -1
  75. package/dist/components/pages/search/tracking.mjs +2 -0
  76. package/dist/components/pages/search-result/page-client.mjs +1 -1
  77. package/dist/components/pages/search-result/tracking.mjs +2 -0
  78. package/dist/components/pages/settings/_components/settings.mjs +1 -1
  79. package/dist/components/pages/user-follow/_components/post-tab.mjs +1 -1
  80. package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
  81. package/dist/components/pages/video-list/video-list-client.mjs +1 -1
  82. package/dist/components/ui/badge.d.mts +1 -1
  83. package/dist/components/ui/button.d.mts +2 -2
  84. package/dist/components/ui/empty.d.mts +1 -1
  85. package/dist/components/ui/image.d.mts +4 -4
  86. package/dist/components/ui/item.d.mts +1 -1
  87. package/dist/components/ui/link.mjs +1 -1
  88. package/dist/utils/tracking.d.mts +231 -0
  89. package/dist/utils/tracking.mjs +2 -0
  90. package/dist/utils.d.mts +2 -1
  91. package/dist/utils.mjs +1 -1
  92. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{useFollowIdsState as t}from"../../../store/modules/follow-ids-store.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetAppChannels as r,gContentGetVideoDetail as i}from"../../../service/generated/client.mjs";import{useLoginModalStore as a}from"../../../store/modules/login-modal-store.mjs";import{useRequest as o}from"../../../hooks/query/use-query.mjs";import{queryKey as s}from"../../../constants/query-key.mjs";import{useKeepAliveState as c}from"../../common/keep-scroll-position/index.mjs";import{batchQueryContentInteractions as l}from"../../../hooks/use-content-operate.mjs";import u from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import d from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{SeriesEpisodes as ee}from"../../common/series-episodes/index.mjs";import{useCallback as f,useEffect as te,useLayoutEffect as ne,useMemo as p,useRef as re,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import{useTranslations as v}from"next-intl";function y(e,t){return(e||[]).map((e,n)=>({id:e.id||`${t||`episode`}-${n+1}`,name:e.name||String(n+1),preview_m3u8_url:e.preview_m3u8_url||e.preview_m3u8url||``,m3u8_url:e.m3u8_url||e.m3u8url||``}))}function b(e,t,n){let r=e.id||``,i=t||r,a=y(e.links,i),o=e.static,s=e.score===void 0||e.score===null?void 0:Number(e.score),c=e.duration===void 0||e.duration===null?void 0:Number(e.duration),l={id:i,mid:i,name:e.name||``,img_x:e.img_x||``,img_y:e.img_y||``,img_type:e.img_type||``,cat_id:e.cat_id||``,cat_name:e.cat_name||``,status:e.status||``,status_text:e.status_text||``,show_at:e.show_at||``,tags:[],update_status:e.update_status||``,description:e.description||``,language:e.language||``,director:e.director||``,issue_date:e.issue_date||``,actor:e.actor||``,up_user:e.up_user||``,money:e.money||``,source_username:e.source_username||``,task_id:e.task_id||``,file_status:e.file_status||``,score:Number.isFinite(s)?s:void 0,duration:Number.isFinite(c)?c:void 0,episode_cnt:a.length||0,links:[],static:{browse_cnt:Number(o?.browse_cnt||0),collect_cnt:Number(o?.collect_cnt||0),comment_cnt:Number(e.comment_count??o?.comment_cnt??0),like_cnt:Number(o?.like_cnt||0),share_cnt:Number(o?.share_cnt||0),dislike_cnt:Number(o?.dislike_cnt||0)},type:e.type??e.content_type,author:{avatar:``,user_id:``,nick_name:``,user_name:``,is_verified:!1}};if(a.length===0)return{seriesTitle:l.name,seriesList:[],contents:[{...l,links:[]}]};let u=a.map((e,t)=>{let r=e.id||`${i||`episode`}-${t+1}`,o=n(t+1),s=[e,...a.filter(t=>t.id!==e.id)];return{...l,id:r,mid:i,episode_name:o,links:s}});return{seriesTitle:l.name,seriesList:a,contents:u}}function x({params:y,initialContents:x}){let S=v(`components.pages.feedSeries`),C=v(`components.common.seriesEpisodes`),{locale:w,seriesId:T,episodeNum:E=`1`}=y,{userInfo:D,isLogin:O}=n(),{followIds:ie,setFollowIds:ae}=t(),k=p(()=>x??[],[x]),[A,j]=m({}),{data:oe}=o([s.CHANNEL],()=>r()),se=e(oe?.data),M=p(()=>`feed-series:${w||`default`}:${T}`,[w,T]),ce=p(()=>{let e=Number.parseInt(E??`1`,10);return Number.isNaN(e)?0:Math.max(0,e-1)},[E]),[N,le]=c(`${M}-active-index`,ce),[ue,P]=c(`${M}-user-interacted`,!1),[de,fe]=c(`${M}-series-title-toggle`,!1),[F,I]=m(!1),L=re(null),[R,z]=m(0),B=g(`div`,{ref:L,className:`fixed top-0 left-0 right-0 z-40`,children:g(d,{data:{list:se}})});ne(()=>{let e=L.current;if(!e)return;let t=()=>{z(Math.max(0,Math.round(e.getBoundingClientRect().height)))};t();let n=new ResizeObserver(()=>t());return n.observe(e),()=>{n.disconnect()}},[]);let{data:V,isFetching:H}=o(p(()=>[`feed-series-detail`,T],[T]),async()=>T?await i({id:T}):null,{enabled:!!T&&k.length===0}),U=p(()=>V?.data?.video,[V]),W=p(()=>U?b(U,T,e=>C(`episodeLabel`,{episode:e})):null,[U,T,C]),G=p(()=>k.length>0?k:W?.contents??[],[W?.contents,k]),K=p(()=>Object.keys(A).length===0?G:G.map(e=>{let t=A[e.id];return t?{...e,...t,static:t.static?{...e.static,...t.static}:e.static,author:t.author?{...e.author,...t.author}:e.author}:e}),[G,A]),q=W?.seriesTitle??(k[0]?.name||``),J=W?.seriesList??[],{data:Y}=o(p(()=>[`feed-series-interactions`,T,O],[O,T]),async()=>await l([T],1),{enabled:!!O&&!!T}),X=p(()=>Y?.interaction_list,[Y]);te(()=>{if(!X||X.length===0)return;let e=X.find(e=>e.content_id===T)||X[0];e&&j(t=>{let n=!1,r={...t};for(let t of G){let i=r[t.id],a={...i,is_liked:e.is_liked||!1,is_dislike:e.is_disliked??e.is_dislike??!1,is_collected:e.is_collected||!1,is_followed:e.is_followed||!1};(!i||i.is_liked!==a.is_liked||i.is_dislike!==a.is_dislike||i.is_collected!==a.is_collected||i.is_followed!==a.is_followed)&&(n=!0,r[t.id]=a)}return n?r:t})},[X,G,T]);let Z=f(({})=>{},[]),pe=f(()=>{a.getState().open()},[]),me=f((e,t)=>{let n=t.is_liked!==void 0||t.is_dislike!==void 0||t.is_collected!==void 0||t.is_followed!==void 0||t.static?.like_cnt!==void 0||t.static?.dislike_cnt!==void 0||t.static?.collect_cnt!==void 0||t.static?.comment_cnt!==void 0;j(r=>{if(!n)return{...r,[e]:{...r[e],...t,static:t.static?{...r[e]?.static,...t.static}:r[e]?.static,author:t.author?{...r[e]?.author,...t.author}:r[e]?.author}};let i=!1,a={...r};for(let e of G){let n=e.id,r=a[n],o=t.static?{...r?.static||{},...t.static}:r?.static,s=t.author?{...r?.author||{},...t.author}:r?.author,c={...r,...t,static:o,author:s},l=!1;if(t.is_liked!==void 0&&r?.is_liked!==t.is_liked&&(l=!0),t.is_dislike!==void 0&&r?.is_dislike!==t.is_dislike&&(l=!0),t.is_collected!==void 0&&r?.is_collected!==t.is_collected&&(l=!0),t.is_followed!==void 0&&r?.is_followed!==t.is_followed&&(l=!0),t.static){let e=r?.static||{};t.static.like_cnt!==void 0&&e.like_cnt!==t.static.like_cnt&&(l=!0),t.static.dislike_cnt!==void 0&&e.dislike_cnt!==t.static.dislike_cnt&&(l=!0),t.static.collect_cnt!==void 0&&e.collect_cnt!==t.static.collect_cnt&&(l=!0),t.static.comment_cnt!==void 0&&e.comment_cnt!==t.static.comment_cnt&&(l=!0)}if(t.author&&r?.author){let e=r.author,n=t.author;for(let t of Object.keys(n))if(e?.[t]!==n[t]){l=!0;break}}l&&(i=!0,a[n]=c)}return i?a:r})},[G]),Q=f((e,t)=>{le(e),Z({episodeId:T,episodeNum:e+1,mode:t===`jump`?`replace`:`push`})},[Z,T]),he=f(()=>({showSeriesButton:!0,seriesTitle:q,seriesText:`${N+1}/${J.length||K.length}`,onSeriesClick:()=>I(!0)}),[N,K.length,J.length,q]),$=p(()=>K[N]?.links?.[0]?.id||``,[N,K]);return T?H&&G.length===0?_(h,{children:[B,_(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:[S(`feedSeriesClient.episodeLoading`),`...`]})]}):!H&&G.length===0?_(h,{children:[B,g(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:S(`feedSeriesClient.noEpisodes`)})]}):_(h,{children:[B,g(u,{items:K,activeIndex:N,top:R,videoConfig:{loop:!1,autoNext:!0},userInteracted:ue,onUserInteracted:()=>P(!0),onActiveIndexChange:Q,onDataUpdate:me,getNavigationInfo:he,currentUserId:D.userId||void 0,followIds:ie,onFollowIdsChange:ae,commentContentId:T,onRequireLogin:pe,activeEpisodeId:$}),F&&g(ee,{mode:`selector`,variant:`sheet`,open:F,title:S(`feedSeriesClient.episodeSelectorTitle`),videoTitle:U?.name,updateStatus:U?.update_status,seriesList:J,activeEpisodeId:$,showEpisodeTitle:de,onToggleTitle:fe,onClose:()=>I(!1),onSelectEpisode:(e,t)=>{I(!1),Q(Math.max(0,t-1),`jump`)}})]}):_(h,{children:[B,_(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:[S(`feedSeriesClient.missingEpisode`),` `,`ID`]})]})}export{x as default};
2
+ "use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{useFollowIdsState as t}from"../../../store/modules/follow-ids-store.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetAppChannels as r,gContentGetVideoDetail as i}from"../../../service/generated/client.mjs";import{usePageLifecycle as a}from"../../../utils/tracking.mjs";import{useLoginModalStore as o}from"../../../store/modules/login-modal-store.mjs";import{useRequest as s}from"../../../hooks/query/use-query.mjs";import{queryKey as c}from"../../../constants/query-key.mjs";import{useKeepAliveState as l}from"../../common/keep-scroll-position/index.mjs";import{batchQueryContentInteractions as u}from"../../../hooks/use-content-operate.mjs";import ee from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import d from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{SeriesEpisodes as f}from"../../common/series-episodes/index.mjs";import{useCallback as p,useEffect as te,useLayoutEffect as ne,useMemo as m,useRef as re,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{useTranslations as y}from"next-intl";function b(e,t){return(e||[]).map((e,n)=>({id:e.id||`${t||`episode`}-${n+1}`,name:e.name||String(n+1),preview_m3u8_url:e.preview_m3u8_url||e.preview_m3u8url||``,m3u8_url:e.m3u8_url||e.m3u8url||``}))}function ie(e,t,n){let r=e.id||``,i=t||r,a=b(e.links,i),o=e.static,s=e.score===void 0||e.score===null?void 0:Number(e.score),c=e.duration===void 0||e.duration===null?void 0:Number(e.duration),l={id:i,mid:i,name:e.name||``,img_x:e.img_x||``,img_y:e.img_y||``,img_type:e.img_type||``,cat_id:e.cat_id||``,cat_name:e.cat_name||``,status:e.status||``,status_text:e.status_text||``,show_at:e.show_at||``,tags:[],update_status:e.update_status||``,description:e.description||``,language:e.language||``,director:e.director||``,issue_date:e.issue_date||``,actor:e.actor||``,up_user:e.up_user||``,money:e.money||``,source_username:e.source_username||``,task_id:e.task_id||``,file_status:e.file_status||``,score:Number.isFinite(s)?s:void 0,duration:Number.isFinite(c)?c:void 0,episode_cnt:a.length||0,links:[],static:{browse_cnt:Number(o?.browse_cnt||0),collect_cnt:Number(o?.collect_cnt||0),comment_cnt:Number(e.comment_count??o?.comment_cnt??0),like_cnt:Number(o?.like_cnt||0),share_cnt:Number(o?.share_cnt||0),dislike_cnt:Number(o?.dislike_cnt||0)},type:e.type??e.content_type,author:{avatar:``,user_id:``,nick_name:``,user_name:``,is_verified:!1}};if(a.length===0)return{seriesTitle:l.name,seriesList:[],contents:[{...l,links:[]}]};let u=a.map((e,t)=>{let r=e.id||`${i||`episode`}-${t+1}`,o=n(t+1),s=[e,...a.filter(t=>t.id!==e.id)];return{...l,id:r,mid:i,episode_name:o,links:s}});return{seriesTitle:l.name,seriesList:a,contents:u}}function x({params:b,initialContents:x}){let S=y(`components.pages.feedSeries`);a(`page_feed_series`,`短剧`);let C=y(`components.common.seriesEpisodes`),{locale:w,seriesId:T,episodeNum:E=`1`}=b,{userInfo:ae,isLogin:D}=n(),{followIds:O,setFollowIds:oe}=t(),k=m(()=>x??[],[x]),[A,j]=h({}),{data:M}=s([c.CHANNEL],()=>r()),se=e(M?.data),N=m(()=>`feed-series:${w||`default`}:${T}`,[w,T]),ce=m(()=>{let e=Number.parseInt(E??`1`,10);return Number.isNaN(e)?0:Math.max(0,e-1)},[E]),[P,le]=l(`${N}-active-index`,ce),[ue,de]=l(`${N}-user-interacted`,!1),[fe,pe]=l(`${N}-series-title-toggle`,!1),[F,I]=h(!1),L=re(null),[R,z]=h(0),B=_(`div`,{ref:L,className:`fixed top-0 left-0 right-0 z-40`,children:_(d,{data:{list:se}})});ne(()=>{let e=L.current;if(!e)return;let t=()=>{z(Math.max(0,Math.round(e.getBoundingClientRect().height)))};t();let n=new ResizeObserver(()=>t());return n.observe(e),()=>{n.disconnect()}},[]);let{data:V,isFetching:H}=s(m(()=>[`feed-series-detail`,T],[T]),async()=>T?await i({id:T}):null,{enabled:!!T&&k.length===0}),U=m(()=>V?.data?.video,[V]),W=m(()=>U?ie(U,T,e=>C(`episodeLabel`,{episode:e})):null,[U,T,C]),G=m(()=>k.length>0?k:W?.contents??[],[W?.contents,k]),K=m(()=>Object.keys(A).length===0?G:G.map(e=>{let t=A[e.id];return t?{...e,...t,static:t.static?{...e.static,...t.static}:e.static,author:t.author?{...e.author,...t.author}:e.author}:e}),[G,A]),q=W?.seriesTitle??(k[0]?.name||``),J=W?.seriesList??[],{data:Y}=s(m(()=>[`feed-series-interactions`,T,D],[D,T]),async()=>await u([T],1),{enabled:!!D&&!!T}),X=m(()=>Y?.interaction_list,[Y]);te(()=>{if(!X||X.length===0)return;let e=X.find(e=>e.content_id===T)||X[0];e&&j(t=>{let n=!1,r={...t};for(let t of G){let i=r[t.id],a={...i,is_liked:e.is_liked||!1,is_dislike:e.is_disliked??e.is_dislike??!1,is_collected:e.is_collected||!1,is_followed:e.is_followed||!1};(!i||i.is_liked!==a.is_liked||i.is_dislike!==a.is_dislike||i.is_collected!==a.is_collected||i.is_followed!==a.is_followed)&&(n=!0,r[t.id]=a)}return n?r:t})},[X,G,T]);let Z=p(({})=>{},[]),me=p(()=>{o.getState().open()},[]),he=p((e,t)=>{let n=t.is_liked!==void 0||t.is_dislike!==void 0||t.is_collected!==void 0||t.is_followed!==void 0||t.static?.like_cnt!==void 0||t.static?.dislike_cnt!==void 0||t.static?.collect_cnt!==void 0||t.static?.comment_cnt!==void 0;j(r=>{if(!n)return{...r,[e]:{...r[e],...t,static:t.static?{...r[e]?.static,...t.static}:r[e]?.static,author:t.author?{...r[e]?.author,...t.author}:r[e]?.author}};let i=!1,a={...r};for(let e of G){let n=e.id,r=a[n],o=t.static?{...r?.static||{},...t.static}:r?.static,s=t.author?{...r?.author||{},...t.author}:r?.author,c={...r,...t,static:o,author:s},l=!1;if(t.is_liked!==void 0&&r?.is_liked!==t.is_liked&&(l=!0),t.is_dislike!==void 0&&r?.is_dislike!==t.is_dislike&&(l=!0),t.is_collected!==void 0&&r?.is_collected!==t.is_collected&&(l=!0),t.is_followed!==void 0&&r?.is_followed!==t.is_followed&&(l=!0),t.static){let e=r?.static||{};t.static.like_cnt!==void 0&&e.like_cnt!==t.static.like_cnt&&(l=!0),t.static.dislike_cnt!==void 0&&e.dislike_cnt!==t.static.dislike_cnt&&(l=!0),t.static.collect_cnt!==void 0&&e.collect_cnt!==t.static.collect_cnt&&(l=!0),t.static.comment_cnt!==void 0&&e.comment_cnt!==t.static.comment_cnt&&(l=!0)}if(t.author&&r?.author){let e=r.author,n=t.author;for(let t of Object.keys(n))if(e?.[t]!==n[t]){l=!0;break}}l&&(i=!0,a[n]=c)}return i?a:r})},[G]),Q=p((e,t)=>{le(e),Z({episodeId:T,episodeNum:e+1,mode:t===`jump`?`replace`:`push`})},[Z,T]),ge=p(()=>({showSeriesButton:!0,seriesTitle:q,seriesText:`${P+1}/${J.length||K.length}`,onSeriesClick:()=>I(!0)}),[P,K.length,J.length,q]),$=m(()=>K[P]?.links?.[0]?.id||``,[P,K]);return T?H&&G.length===0?v(g,{children:[B,v(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:[S(`feedSeriesClient.episodeLoading`),`...`]})]}):!H&&G.length===0?v(g,{children:[B,_(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:S(`feedSeriesClient.noEpisodes`)})]}):v(g,{children:[B,_(ee,{items:K,activeIndex:P,top:R,videoConfig:{loop:!1,autoNext:!0},userInteracted:ue,onUserInteracted:()=>de(!0),onActiveIndexChange:Q,onDataUpdate:he,getNavigationInfo:ge,currentUserId:ae.userId||void 0,followIds:O,onFollowIdsChange:oe,commentContentId:T,onRequireLogin:me,activeEpisodeId:$}),F&&_(f,{mode:`selector`,variant:`sheet`,open:F,title:S(`feedSeriesClient.episodeSelectorTitle`),videoTitle:U?.name,updateStatus:U?.update_status,seriesList:J,activeEpisodeId:$,showEpisodeTitle:fe,onToggleTitle:pe,onClose:()=>I(!1),onSelectEpisode:(e,t)=>{I(!1),Q(Math.max(0,t-1),`jump`)}})]}):v(g,{children:[B,v(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:[S(`feedSeriesClient.missingEpisode`),` `,`ID`]})]})}export{x as default};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{cn as e}from"../../../../utils/cn.mjs";import{Button as t}from"../../../ui/button.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{uploadFile as a}from"../../../../utils/upload-file.mjs";import{useRouter as o}from"../../../../utils/use-compatible-router.mjs";import{Image as s}from"../../../ui/image.mjs";import{Box as c}from"../../../ui/box.mjs";import{InputGroup as l,InputGroupAddon as u,InputGroupInput as d,InputGroupTextarea as f}from"../../../ui/input-group.mjs";import{Field as p,FieldLabel as m}from"../../../ui/field.mjs";import{Text as h}from"../../../ui/text.mjs";import{HeaderNav as g}from"../../../common/header-nav/client.mjs";import{AddIcon as _}from"../../../common/icons/add.mjs";import{useRef as v,useState as y}from"react";import{XIcon as b}from"lucide-react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{toast as C}from"sonner";import{useTranslations as w}from"next-intl";const T=new Set([`image/jpeg`,`image/jpg`,`image/png`]),E=new Set([`jpg`,`jpeg`,`png`]);function D(e){let t=e.type.toLowerCase(),n=e.name.split(`.`).pop()?.toLowerCase()||``;return t?T.has(t):E.has(n)}function O({className:T}={}){let E=w(`components.pages.feedback.components`),O=o(),{userId:k}=n(),A=v(null),[j,M]=y({content:``,contact:``}),[N,P]=y([]),[F,I]=y(!1),[L,R]=y(!1),z=!j.content.trim();function B(e,t){M(n=>({...n,[e]:t}))}function V(){L||F||N.length>=3||A.current?.click()}async function H(e){let t=Array.from(e.target.files??[]);if(!t.length)return;let n=3-N.length;if(n<=0){e.target&&(e.target.value=``);return}let r=t.slice(0,n),o=r.filter(D);if(!o.length){C.error(E(`feedbackForm.imageTypeInvalid`)),e.target&&(e.target.value=``);return}o.length!==r.length&&C.error(E(`feedbackForm.imageTypeInvalid`));try{R(!0);let e=[],t=!1;for(let n of o)try{let t=await a(await i(n),1);e.push(t.objectKey)}catch(e){console.error(`上传截图失败`,e),t=!0}e.length&&P(t=>[...t,...e].slice(0,3)),t&&C.error(E(`feedbackForm.screenshotUploadFailed`))}catch(e){console.error(`上传截图失败`,e),C.error(E(`feedbackForm.screenshotUploadFailed`))}finally{R(!1),e.target&&(e.target.value=``)}}function U(e){L||F||P(t=>t.filter((t,n)=>n!==e))}async function W(){let e=j.content.trim(),t=j.contact.trim();if(!e){C.error(E(`feedbackForm.missingFeedback`));return}if(e.length<4){C.error(E(`feedbackForm.contentMinLength`));return}if(F)return;let n=C.loading(E(`feedbackForm.loading`));try{I(!0);let i=await r({user_id:k,feedback_content:e,feedback_screenshots:N.length?N:void 0,contact_info:t||void 0});if(i.code===0){M({content:``,contact:``}),P([]),O.push(`/settings`),C.success(E(`feedbackForm.submitsuccess`),{id:n});return}C.error(i.message||E(`feedbackForm.message`),{id:n})}catch(e){console.error(`提交反馈失败`,e),C.error(e.message||E(`feedbackForm.message`),{id:n})}finally{I(!1)}}return S(c,{className:e(`min-h-screen bg-[var(--color-surface-panel-dark)]`,T),children:[x(g,{title:E(`feedbackForm.title`),className:`!border-none !bg-[var(--color-surface-panel-dark)]`,rightChild:x(t,{onClick:W,disabled:F||L||z,className:`rounded-[8px] border-0 px-3 py-1.5 text-[16px] font-normal leading-6 text-white active:opacity-90 disabled:text-white/60 disabled:opacity-100`,style:{background:F||L||z?`linear-gradient(90deg, rgba(166, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`:`var(--gradient-action-button)`},children:E(F?`feedbackForm.loading`:`feedbackForm.submit`)})}),S(c,{className:`pb-3`,children:[S(p,{className:`border-none bg-[var(--color-surface-panel-dark)] px-3`,children:[x(m,{required:!0,className:`text-sm leading-6 text-text3`,children:E(`feedbackForm.label`)}),S(l,{className:`overflow-hidden rounded-md !bg-[var(--color-surface-field-bg)] shadow-none dark:!bg-[var(--color-surface-field-bg)]`,children:[x(f,{className:`p-2.5 text-text1 placeholder:text-text3`,maxLength:500,placeholder:E(`feedbackForm.placeholder`),value:j.content,onChange:e=>B(`content`,e.target.value)}),x(u,{className:`!bg-transparent font-normal !text-text3`,align:`block-end`,children:x(`div`,{className:`w-full text-right`,children:S(`span`,{className:`text-xs tabular-nums text-text3`,children:[j.content.length,`/500`]})})})]})]}),S(p,{className:`border-none bg-[var(--color-surface-panel-dark)] px-3`,children:[x(m,{className:`text-sm leading-6 text-text3`,children:E(`feedbackForm.screenshotLabel`)}),x(`input`,{ref:A,type:`file`,multiple:!0,accept:`image/jpeg,image/jpg,image/png,.jpg,.jpeg,.png`,className:`hidden`,onChange:H}),S(c,{className:`mt-2 grid grid-cols-3 gap-2`,children:[N.map((e,n)=>S(c,{className:`relative aspect-square overflow-hidden rounded-md bg-[var(--color-surface-field-bg)] shadow-none`,children:[x(s,{src:e,alt:E(`feedbackForm.alt`),fill:!0,className:`object-cover`}),x(t,{size:`icon-xs`,variant:`secondary`,className:`absolute right-1 top-1 rounded-full bg-[var(--color-surface-chip-gray20)] text-text1 shadow-none`,onClick:()=>U(n),"aria-label":E(`feedbackForm.delete`),children:x(b,{})})]},`${e}-${n}`)),N.length<3&&S(c,{className:`flex aspect-square flex-col items-center justify-center gap-2 rounded-md border border-dashed border-[var(--color-line1)] bg-[var(--color-surface-field-bg)] py-3 text-center shadow-none`,onClick:V,children:[x(_,{}),x(h,{className:`text-xs text-text3`,children:E(L?`feedbackForm.uploading`:`feedbackForm.addScreenshot`)})]})]})]}),S(p,{className:`border-none bg-[var(--color-surface-panel-dark)] px-3`,children:[x(m,{className:`text-sm leading-6 text-text3`,children:E(`feedbackForm.contactLabel`)}),x(l,{className:`h-auto min-h-11 overflow-hidden rounded-md !bg-[var(--color-surface-field-bg)] shadow-none dark:!bg-[var(--color-surface-field-bg)]`,children:x(d,{className:`h-auto min-h-11 px-2.5 py-2.5 text-text1 placeholder:text-text3`,placeholder:E(`feedbackForm.placeholder1_6d0242`),value:j.contact,onChange:e=>B(`contact`,e.target.value)})})]})]})]})}export{O as FeedbackForm};
2
+ "use client";import{cn as e}from"../../../../utils/cn.mjs";import{Button as t}from"../../../ui/button.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{usePageLifecycle as a}from"../../../../utils/tracking.mjs";import{uploadFile as o}from"../../../../utils/upload-file.mjs";import{useRouter as s}from"../../../../utils/use-compatible-router.mjs";import{Image as c}from"../../../ui/image.mjs";import{Box as l}from"../../../ui/box.mjs";import{InputGroup as u,InputGroupAddon as d,InputGroupInput as f,InputGroupTextarea as p}from"../../../ui/input-group.mjs";import{Field as m,FieldLabel as h}from"../../../ui/field.mjs";import{Text as g}from"../../../ui/text.mjs";import{HeaderNav as _}from"../../../common/header-nav/client.mjs";import{AddIcon as v}from"../../../common/icons/add.mjs";import{useRef as y,useState as b}from"react";import{XIcon as x}from"lucide-react";import{jsx as S,jsxs as C}from"react/jsx-runtime";import{toast as w}from"sonner";import{useTranslations as T}from"next-intl";const E=new Set([`image/jpeg`,`image/jpg`,`image/png`]),D=new Set([`jpg`,`jpeg`,`png`]);function O(e){let t=e.type.toLowerCase(),n=e.name.split(`.`).pop()?.toLowerCase()||``;return t?E.has(t):D.has(n)}function k({className:E}={}){let D=T(`components.pages.feedback.components`);a(`page_feedback`,`意见反馈`);let k=s(),{userId:A}=n(),j=y(null),[M,N]=b({content:``,contact:``}),[P,F]=b([]),[I,L]=b(!1),[R,z]=b(!1),B=!M.content.trim();function V(e,t){N(n=>({...n,[e]:t}))}function H(){R||I||P.length>=3||j.current?.click()}async function U(e){let t=Array.from(e.target.files??[]);if(!t.length)return;let n=3-P.length;if(n<=0){e.target&&(e.target.value=``);return}let r=t.slice(0,n),a=r.filter(O);if(!a.length){w.error(D(`feedbackForm.imageTypeInvalid`)),e.target&&(e.target.value=``);return}a.length!==r.length&&w.error(D(`feedbackForm.imageTypeInvalid`));try{z(!0);let e=[],t=!1;for(let n of a)try{let t=await o(await i(n),1);e.push(t.objectKey)}catch(e){console.error(`上传截图失败`,e),t=!0}e.length&&F(t=>[...t,...e].slice(0,3)),t&&w.error(D(`feedbackForm.screenshotUploadFailed`))}catch(e){console.error(`上传截图失败`,e),w.error(D(`feedbackForm.screenshotUploadFailed`))}finally{z(!1),e.target&&(e.target.value=``)}}function W(e){R||I||F(t=>t.filter((t,n)=>n!==e))}async function G(){let e=M.content.trim(),t=M.contact.trim();if(!e){w.error(D(`feedbackForm.missingFeedback`));return}if(e.length<4){w.error(D(`feedbackForm.contentMinLength`));return}if(I)return;let n=w.loading(D(`feedbackForm.loading`));try{L(!0);let i=await r({user_id:A,feedback_content:e,feedback_screenshots:P.length?P:void 0,contact_info:t||void 0});if(i.code===0){N({content:``,contact:``}),F([]),k.push(`/settings`),w.success(D(`feedbackForm.submitsuccess`),{id:n});return}w.error(i.message||D(`feedbackForm.message`),{id:n})}catch(e){console.error(`提交反馈失败`,e),w.error(e.message||D(`feedbackForm.message`),{id:n})}finally{L(!1)}}return C(l,{className:e(`min-h-screen bg-[var(--color-surface-panel-dark)]`,E),children:[S(_,{title:D(`feedbackForm.title`),className:`!border-none !bg-[var(--color-surface-panel-dark)]`,rightChild:S(t,{onClick:G,disabled:I||R||B,className:`rounded-[8px] border-0 px-3 py-1.5 text-[16px] font-normal leading-6 text-white active:opacity-90 disabled:text-white/60 disabled:opacity-100`,style:{background:I||R||B?`linear-gradient(90deg, rgba(166, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`:`var(--gradient-action-button)`},children:D(I?`feedbackForm.loading`:`feedbackForm.submit`)})}),C(l,{className:`pb-3`,children:[C(m,{className:`border-none bg-[var(--color-surface-panel-dark)] px-3`,children:[S(h,{required:!0,className:`text-sm leading-6 text-text3`,children:D(`feedbackForm.label`)}),C(u,{className:`overflow-hidden rounded-md !bg-[var(--color-surface-field-bg)] shadow-none dark:!bg-[var(--color-surface-field-bg)]`,children:[S(p,{className:`p-2.5 text-text1 placeholder:text-text3`,maxLength:500,placeholder:D(`feedbackForm.placeholder`),value:M.content,onChange:e=>V(`content`,e.target.value)}),S(d,{className:`!bg-transparent font-normal !text-text3`,align:`block-end`,children:S(`div`,{className:`w-full text-right`,children:C(`span`,{className:`text-xs tabular-nums text-text3`,children:[M.content.length,`/500`]})})})]})]}),C(m,{className:`border-none bg-[var(--color-surface-panel-dark)] px-3`,children:[S(h,{className:`text-sm leading-6 text-text3`,children:D(`feedbackForm.screenshotLabel`)}),S(`input`,{ref:j,type:`file`,multiple:!0,accept:`image/jpeg,image/jpg,image/png,.jpg,.jpeg,.png`,className:`hidden`,onChange:U}),C(l,{className:`mt-2 grid grid-cols-3 gap-2`,children:[P.map((e,n)=>C(l,{className:`relative aspect-square overflow-hidden rounded-md bg-[var(--color-surface-field-bg)] shadow-none`,children:[S(c,{src:e,alt:D(`feedbackForm.alt`),fill:!0,className:`object-cover`}),S(t,{size:`icon-xs`,variant:`secondary`,className:`absolute right-1 top-1 rounded-full bg-[var(--color-surface-chip-gray20)] text-text1 shadow-none`,onClick:()=>W(n),"aria-label":D(`feedbackForm.delete`),children:S(x,{})})]},`${e}-${n}`)),P.length<3&&C(l,{className:`flex aspect-square flex-col items-center justify-center gap-2 rounded-md border border-dashed border-[var(--color-line1)] bg-[var(--color-surface-field-bg)] py-3 text-center shadow-none`,onClick:H,children:[S(v,{}),S(g,{className:`text-xs text-text3`,children:D(R?`feedbackForm.uploading`:`feedbackForm.addScreenshot`)})]})]})]}),C(m,{className:`border-none bg-[var(--color-surface-panel-dark)] px-3`,children:[S(h,{className:`text-sm leading-6 text-text3`,children:D(`feedbackForm.contactLabel`)}),S(u,{className:`h-auto min-h-11 overflow-hidden rounded-md !bg-[var(--color-surface-field-bg)] shadow-none dark:!bg-[var(--color-surface-field-bg)]`,children:S(f,{className:`h-auto min-h-11 px-2.5 py-2.5 text-text1 placeholder:text-text3`,placeholder:D(`feedbackForm.placeholder1_6d0242`),value:M.contact,onChange:e=>V(`contact`,e.target.value)})})]})]})]})}export{k as FeedbackForm};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import e from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import{useMixedFeedController as t}from"../../biz/basics/fullscreen-feed/runtime/use-mixed-feed-controller.mjs";import{useSeriesFeedController as n}from"../../biz/basics/fullscreen-feed/runtime/use-series-feed-controller.mjs";import{SeriesEpisodes as r}from"../../common/series-episodes/index.mjs";import{useCallback as i,useEffect as a,useMemo as o}from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{usePathname as u}from"next/navigation";import{useTranslations as d}from"next-intl";function f({blockId:f,seriesId:p,initialContents:m,videoConfig:h,hasBottom:g,pageSize:_=6,initialActiveIndex:v=0,items:y,onSwipeTo:b,onEpisodeNavigate:x,onGoToEpisode:S,currentUserId:C,followIds:w,onFollowIdsChange:T,onRequireLogin:E}){let D=d(`components.pages.fullscreenFeed`),O=u(),k=o(()=>{let e=p?`series:${p}`:`block:${f||``}`;return`${O||`unknown`}:fullscreen-feed:${e}:pageSize:${_}`},[f,_,O,p]),A=`${k}:series-controller`,j=`${k}:mixed-controller`,M=n({seriesId:p||``,initialContents:m,initialActiveIndex:v,onEpisodeNavigate:x,keepAliveKey:A}),N=t({blockId:f||``,initialContents:m,initialActiveIndex:v,pageSize:_,keepAliveKey:j}),P=p?M:N,F=y||P.items,I=P.activeIndex,L=P.userInteracted,R=i((e,t)=>{P.setActiveIndex(e,t),p||N.maybeLoadMore(e),b?.({activeIndex:e,items:F,direction:t})},[P,F,b,p,N]),z=i((e,t)=>{P.updateItemData(e,t)},[P]),B=i(e=>P.getNavigationInfo(e),[P]);return a(()=>{S&&S(e=>{R(e,`jump`)})},[S,R]),!f&&!p?c(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/70`,children:D(`page.missingParams`)}):l(s,{children:[c(e,{items:F,activeIndex:I,bottom:g?56:void 0,videoConfig:h,userInteracted:L,onUserInteracted:P.setUserInteracted,onActiveIndexChange:R,onDataUpdate:z,getNavigationInfo:B,currentUserId:C,followIds:w,onFollowIdsChange:T,onRequireLogin:E}),p&&M.isSeriesSelectorOpen&&c(r,{title:D(`page.episodeSelectorTitle`),videoTitle:M.seriesMeta.seriesTitle,mode:`selector`,variant:`sheet`,open:M.isSeriesSelectorOpen,seriesList:M.seriesMeta.seriesList,activeEpisodeId:M.activeEpisodeId,onClose:M.closeSeriesSelector,onSelectEpisode:M.onSelectEpisode})]})}export{f as default};
2
+ "use client";import{usePageLifecycle as e}from"../../../utils/tracking.mjs";import t from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import{useMixedFeedController as n}from"../../biz/basics/fullscreen-feed/runtime/use-mixed-feed-controller.mjs";import{useSeriesFeedController as r}from"../../biz/basics/fullscreen-feed/runtime/use-series-feed-controller.mjs";import{SeriesEpisodes as i}from"../../common/series-episodes/index.mjs";import{useCallback as a,useEffect as o,useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{usePathname as d}from"next/navigation";import{useTranslations as f}from"next-intl";function p({blockId:p,seriesId:m,initialContents:h,videoConfig:g,hasBottom:_,pageSize:v=6,initialActiveIndex:y=0,items:b,onSwipeTo:x,onEpisodeNavigate:S,onGoToEpisode:C,currentUserId:w,followIds:T,onFollowIdsChange:E,onRequireLogin:D}){let O=f(`components.pages.fullscreenFeed`),k=d();e(`page_fullscreen_feed`,`全屏视频`);let A=s(()=>{let e=m?`series:${m}`:`block:${p||``}`;return`${k||`unknown`}:fullscreen-feed:${e}:pageSize:${v}`},[p,v,k,m]),j=`${A}:series-controller`,M=`${A}:mixed-controller`,N=r({seriesId:m||``,initialContents:h,initialActiveIndex:y,onEpisodeNavigate:S,keepAliveKey:j}),P=n({blockId:p||``,initialContents:h,initialActiveIndex:y,pageSize:v,keepAliveKey:M}),F=m?N:P,I=b||F.items,L=F.activeIndex,R=F.userInteracted,z=a((e,t)=>{F.setActiveIndex(e,t),m||P.maybeLoadMore(e),x?.({activeIndex:e,items:I,direction:t})},[F,I,x,m,P]),B=a((e,t)=>{F.updateItemData(e,t)},[F]),V=a(e=>F.getNavigationInfo(e),[F]);return o(()=>{C&&C(e=>{z(e,`jump`)})},[C,z]),!p&&!m?l(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/70`,children:O(`page.missingParams`)}):u(c,{children:[l(t,{items:I,activeIndex:L,bottom:_?56:void 0,videoConfig:g,userInteracted:R,onUserInteracted:F.setUserInteracted,onActiveIndexChange:z,onDataUpdate:B,getNavigationInfo:V,currentUserId:w,followIds:T,onFollowIdsChange:E,onRequireLogin:D}),m&&N.isSeriesSelectorOpen&&l(i,{title:O(`page.episodeSelectorTitle`),videoTitle:N.seriesMeta.seriesTitle,mode:`selector`,variant:`sheet`,open:N.isSeriesSelectorOpen,seriesList:N.seriesMeta.seriesList,activeEpisodeId:N.activeEpisodeId,onClose:N.closeSeriesSelector,onSelectEpisode:N.onSelectEpisode})]})}export{p as default};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{gContentGetAppChannelBlock as e,gContentGetAppChannelBlockData as t,gContentListVisibleFloatingBall as n}from"../../../service/generated/client.mjs";import{useRouter as r}from"../../../utils/use-compatible-router.mjs";import{useRequest as i}from"../../../hooks/query/use-query.mjs";import{useRequireLogin as a}from"../../../hooks/use-auth.mjs";import{queryKey as o}from"../../../constants/query-key.mjs";import{useKeepAliveState as s}from"../../common/keep-scroll-position/index.mjs";import{extractDataByComponentType as c}from"../../biz/utils/transformers/data.mjs";import{FloatingAd as l}from"../../biz/business/advertisement/floating-ad/client.mjs";import{useEffect as u,useLayoutEffect as d,useMemo as f,useRef as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";function _(){if(typeof document>`u`)return 0;let e=document.querySelector(`[data-top-nav-root="true"]`);return e&&e.getBoundingClientRect().height||0}function v({currentChannelId:v,isPGC:y}){let b=r(),x=a(),{data:S}=i(o.GET_CONTENT_LIST(v),()=>e({channel_id:v})),{data:C}=i([o.FLOATING_BALL],()=>n()),w=f(()=>S?.data?.blocks||[],[S?.data?.blocks]),T=f(()=>{let e=w.findIndex(e=>e.type===4),t=e>=0?w[e]:null;return{index:e,block:t,blockId:t?.id||``}},[w]),{data:E}=i([o.GUESS_YOU_LIKE_USER_DATA,T.blockId],()=>t({block_id:T.blockId}),{enabled:!!T.blockId}),D=f(()=>{if(T.index<0)return w;let e=E?.data.block?.data?.users||[];return w.map((t,n)=>n===T.index?{...t,data:{...t.data||{},users:e}}:t)},[w,E,T.index]),[O,k]=s(`home-scroll-top-${v}`,0),A=p({restored:!1,lastScrollTop:O,key:v,rafId:null}),j=p(k),M=p(O);u(()=>{j.current=k},[k]),u(()=>{M.current=O},[O]),u(()=>{A.current.key!==v&&(A.current.restored=!1,A.current.lastScrollTop=O,M.current=O,A.current.key=v)},[v,O]);let N=D.length>0;d(()=>{if(!N||A.current.restored||O<=0)return;let e=_(),t=Math.max(0,O+e);window.requestAnimationFrame(()=>{window.scrollTo({top:t}),A.current.restored=!0,A.current.lastScrollTop=t})},[N,v,O]),u(()=>{let e=A.current;function t(){e.restored=!0,e.rafId!==null&&window.cancelAnimationFrame(e.rafId),e.rafId=window.requestAnimationFrame(()=>{e.rafId=null;let t=window.scrollY??document.documentElement.scrollTop??0,n=_(),r=Math.max(0,t-n);Math.abs(t-e.lastScrollTop)>1&&(e.lastScrollTop=t,j.current(r))})}return window.addEventListener(`scroll`,t,{passive:!0}),()=>{e.rafId!==null&&(window.cancelAnimationFrame(e.rafId),e.rafId=null),window.removeEventListener(`scroll`,t)}},[v]);let P=f(()=>c(D,y),[D,y]),F=f(()=>C?.data?.ball_infos?.find(e=>e.channel_id===v),[C?.data?.ball_infos,v]);return g(m,{children:[F&&h(l,{ad:{materialUrl:F.material_url||``,jumpUrl:F.jump_url||``,name:F.name||``},onClick:()=>{x(()=>{F?.jump_url&&b.push(F.jump_url)})}}),P.map(e=>{let t=e.component,n=e.data.block_id||`block-${e.data.title||``}`;return h(t,{data:e.data},n)})]})}export{v as default};
2
+ "use client";import{gContentGetAppChannelBlock as e,gContentGetAppChannelBlockData as t,gContentListVisibleFloatingBall as n}from"../../../service/generated/client.mjs";import{trackAppPageView as r,usePageLifecycle as i}from"../../../utils/tracking.mjs";import{useRouter as a}from"../../../utils/use-compatible-router.mjs";import{useRequest as o}from"../../../hooks/query/use-query.mjs";import{useRequireLogin as s}from"../../../hooks/use-auth.mjs";import{queryKey as c}from"../../../constants/query-key.mjs";import{useKeepAliveState as l}from"../../common/keep-scroll-position/index.mjs";import{FloatingAd as u}from"../../biz/business/advertisement/floating-ad/client.mjs";import{extractDataByComponentType as d}from"../../biz/utils/transformers/data.mjs";import{useEffect as f,useLayoutEffect as p,useMemo as m,useRef as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";function y(){if(typeof document>`u`)return 0;let e=document.querySelector(`[data-top-nav-root="true"]`);return e&&e.getBoundingClientRect().height||0}function b({currentChannelId:b,currentChannelName:x,isPGC:S}){let C=a(),w=s();i(`page_home_${b}`,`首页-${x}`),f(()=>{b&&r({page_key:`page_home_channel_${b}`,page_name:`首页频道-${x}`})},[b,x]);let{data:T}=o(c.GET_CONTENT_LIST(b),()=>e({channel_id:b})),{data:E}=o([c.FLOATING_BALL],()=>n()),D=m(()=>T?.data?.blocks||[],[T?.data?.blocks]),O=m(()=>{let e=D.findIndex(e=>e.type===4),t=e>=0?D[e]:null;return{index:e,block:t,blockId:t?.id||``}},[D]),{data:k}=o([c.GUESS_YOU_LIKE_USER_DATA,O.blockId],()=>t({block_id:O.blockId}),{enabled:!!O.blockId}),A=m(()=>{if(O.index<0)return D;let e=k?.data.block?.data?.users||[];return D.map((t,n)=>n===O.index?{...t,data:{...t.data||{},users:e}}:t)},[D,k,O.index]),[j,M]=l(`home-scroll-top-${b}`,0),N=h({restored:!1,lastScrollTop:j,key:b,rafId:null}),P=h(M),F=h(j);f(()=>{P.current=M},[M]),f(()=>{F.current=j},[j]),f(()=>{N.current.key!==b&&(N.current.restored=!1,N.current.lastScrollTop=j,F.current=j,N.current.key=b)},[b,j]);let I=A.length>0;p(()=>{if(!I||N.current.restored||j<=0)return;let e=y(),t=Math.max(0,j+e);window.requestAnimationFrame(()=>{window.scrollTo({top:t}),N.current.restored=!0,N.current.lastScrollTop=t})},[I,b,j]),f(()=>{let e=N.current;function t(){e.restored=!0,e.rafId!==null&&window.cancelAnimationFrame(e.rafId),e.rafId=window.requestAnimationFrame(()=>{e.rafId=null;let t=window.scrollY??document.documentElement.scrollTop??0,n=y(),r=Math.max(0,t-n);Math.abs(t-e.lastScrollTop)>1&&(e.lastScrollTop=t,P.current(r))})}return window.addEventListener(`scroll`,t,{passive:!0}),()=>{e.rafId!==null&&(window.cancelAnimationFrame(e.rafId),e.rafId=null),window.removeEventListener(`scroll`,t)}},[b]);let L=m(()=>d(A,S),[A,S]),R=m(()=>E?.data?.ball_infos?.find(e=>e.channel_id===b),[E?.data?.ball_infos,b]);return v(g,{children:[R&&_(u,{ad:{materialUrl:R.material_url||``,jumpUrl:R.jump_url||``,name:R.name||``},onClick:()=>{w(()=>{R?.jump_url&&C.push(R.jump_url)})}}),L.map(e=>{let t=e.component,n=e.data.block_id||`block-${e.data.title||``}`;return _(t,{data:e.data},n)})]})}export{b as default};
@@ -1,2 +1,2 @@
1
1
 
2
- import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{gContentGetAppChannelBlock as t,gContentGetAppChannels as n,gContentListVisibleFloatingBall as r}from"../../../service/generated/client.mjs";import{HydrationBoundary as i}from"../../../hooks/query/hydration-boundary.mjs";import{queryKey as a}from"../../../constants/query-key.mjs";import{revalidate as o}from"../../../constants/revalidate.mjs";import{matchChannelByPath as s}from"./channel-matcher.mjs";import c from"./client.mjs";import{jsx as l}from"react/jsx-runtime";const u=[];async function d({categoryPath:d=u}){let f=await n({},{revalidate:o.TIME}),p=e(f?.data),m=s(d,p);!m&&p.length>0&&(m=p[0]);let h=m.id,g=await t({channel_id:h},{revalidate:o.TIME});return l(i,{prefetch:[{queryKey:[a.CHANNEL],queryFn:()=>Promise.resolve(f)},{queryKey:a.GET_CONTENT_LIST(h),queryFn:async()=>Promise.resolve(g)},{queryKey:[`floating-ball`],queryFn:()=>r({},{revalidate:o.TIME})}],children:l(c,{currentChannelId:h,isPGC:m.source_type===1})})}export{d as HomePage};
2
+ import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{gContentGetAppChannelBlock as t,gContentGetAppChannels as n,gContentListVisibleFloatingBall as r}from"../../../service/generated/client.mjs";import{HydrationBoundary as i}from"../../../hooks/query/hydration-boundary.mjs";import{queryKey as a}from"../../../constants/query-key.mjs";import{revalidate as o}from"../../../constants/revalidate.mjs";import{matchChannelByPath as s}from"./channel-matcher.mjs";import c from"./client.mjs";import{jsx as l}from"react/jsx-runtime";const u=[];async function d({categoryPath:d=u}){let f=await n({},{revalidate:o.TIME}),p=e(f?.data),m=s(d,p);!m&&p.length>0&&(m=p[0]);let h=m.id,g=await t({channel_id:h},{revalidate:o.TIME}),_=[{queryKey:[a.CHANNEL],queryFn:()=>Promise.resolve(f)},{queryKey:a.GET_CONTENT_LIST(h),queryFn:async()=>Promise.resolve(g)},{queryKey:[`floating-ball`],queryFn:()=>r({},{revalidate:o.TIME})}],v=m.source_type===1;return l(i,{prefetch:_,children:l(c,{currentChannelId:h,currentChannelName:m.cn_name||``,isPGC:v})})}export{d as HomePage};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{hashPassword as e}from"../../../utils/common.mjs";import{pUserLogin as t}from"../../../service/generated/client.mjs";import{Box as n}from"../../ui/box.mjs";import{useLoginModalStore as r}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as i}from"../../../hooks/query/use-query.mjs";import{useSetAuthFields as a}from"../../../hooks/use-auth.mjs";import{Forgot as o}from"./forgot.mjs";import{LoginClient as s}from"./login-client.mjs";import{Password as c}from"./password.mjs";import{Register as l}from"./register.mjs";import{ResetPassword as u}from"./reset-password.mjs";import{Verify as d}from"./verify.mjs";import{useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{toast as h}from"sonner";import{useTranslations as g}from"next-intl";function _(_){let{initialStep:v=`login`}=_,{close:y,resolveLogin:b}=r(),[x,S]=f(v),[C,w]=f(``),T=a(),[E,D]=f(``),O=i(),k=g(`components.pages.login`);return m(n,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col fixed top-0 left-0 right-0 bottom-0 z-50`,children:[x===`login`&&p(s,{onRegister:()=>S(`register`),onForgotPassword:()=>S(`forgot`),errorText:E,onSubmit:async n=>{D(``);try{let r=e(n.password),{data:i}=await t({email:n.email,password:r});T({token:i.token,expireTime:i.expire_time,userId:i.user_id}),h.success(k(`index.loginSuccess`)),O([`user-profile`,`mine`]),b(!0)}catch(e){D(e.message??k(`index.loginFailed`))}},onClose:()=>{y()}}),x===`register`&&p(l,{onLogin:()=>S(`login`),onClose:()=>S(`login`),onVerify:e=>{w(e),S(`verify`)}}),x===`forgot`&&p(o,{onLogin:()=>S(`login`),onClose:()=>S(`login`),onVerify:e=>{w(e),S(`verify`)}}),x===`reset-password`&&p(u,{onClose:()=>{y()},onPassword:e=>{w(e??``),S(`password`)}}),x===`verify`&&p(d,{email:C,onClose:()=>S(`register`),onPassword:e=>{w(e),S(`password`)}}),x===`password`&&p(c,{email:C,onClose:()=>S(`verify`)})]})}export{_ as Login};
2
+ "use client";import{hashPassword as e}from"../../../utils/common.mjs";import{pUserLogin as t}from"../../../service/generated/client.mjs";import{usePageLifecycle as n}from"../../../utils/tracking.mjs";import{Box as r}from"../../ui/box.mjs";import{useLoginModalStore as i}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as a}from"../../../hooks/query/use-query.mjs";import{useSetAuthFields as o}from"../../../hooks/use-auth.mjs";import{Forgot as s}from"./forgot.mjs";import{LoginClient as c}from"./login-client.mjs";import{Password as l}from"./password.mjs";import{Register as u}from"./register.mjs";import{ResetPassword as d}from"./reset-password.mjs";import{Verify as f}from"./verify.mjs";import{useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{toast as g}from"sonner";import{useTranslations as _}from"next-intl";function v(v){let{initialStep:y=`login`}=v,{close:b,resolveLogin:x}=i(),[S,C]=p(y),[w,T]=p(``),E=o(),[D,O]=p(``),k=a(),A=_(`components.pages.login`);return n(`login`,`登录注册`),h(r,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col fixed top-0 left-0 right-0 bottom-0 z-50`,children:[S===`login`&&m(c,{onRegister:()=>C(`register`),onForgotPassword:()=>C(`forgot`),errorText:D,onSubmit:async n=>{O(``);try{let r=e(n.password),{data:i}=await t({email:n.email,password:r});E({token:i.token,expireTime:i.expire_time,userId:i.user_id}),g.success(A(`index.loginSuccess`)),k([`user-profile`,`mine`]),x(!0)}catch(e){O(e.message??A(`index.loginFailed`))}},onClose:()=>{b()}}),S===`register`&&m(u,{onLogin:()=>C(`login`),onClose:()=>C(`login`),onVerify:e=>{T(e),C(`verify`)}}),S===`forgot`&&m(s,{onLogin:()=>C(`login`),onClose:()=>C(`login`),onVerify:e=>{T(e),C(`verify`)}}),S===`reset-password`&&m(d,{onClose:()=>{b()},onPassword:e=>{T(e??``),C(`password`)}}),S===`verify`&&m(f,{email:w,onClose:()=>C(`register`),onPassword:e=>{T(e),C(`password`)}}),S===`password`&&m(l,{email:w,onClose:()=>C(`verify`)})]})}export{v as Login};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Button as e}from"../../ui/button.mjs";import{ensureGuestIdentity as t}from"../../../store/modules/user-store.mjs";import{Box as n}from"../../ui/box.mjs";import{Checkbox as r}from"../../ui/checkbox.mjs";import{Input as i}from"../../ui/input.mjs";import{Text as a}from"../../ui/text.mjs";import{CloseIcon as o}from"../../../assets/icons/close-icon.mjs";import{EyeIcon as s}from"../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as c}from"../../../assets/icons/eye-off-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{useCallback as f,useMemo as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useTranslations as _}from"next-intl";function v(v){let y=_(`components.pages.login`),{onClose:b,onForgotPassword:x,onRegister:S,onSubmit:C,errorText:w}=v,[T,E]=m(``),[D,O]=m(``),[k,A]=m(!1),[j,M]=m(!1),[N,P]=m(!1),[F,I]=m(null),L=p(()=>T.trim().length>0&&D.length>0&&N&&!j,[T,D,N,j]),R=f(()=>{t(!0),S?.()},[S]);async function z(){if(L)try{M(!0),await C?.({email:T.trim(),password:D})}finally{M(!1)}}return g(n,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:d,children:[g(n,{className:`relative z-[1] mx-auto flex min-h-screen w-full max-w-[390px] flex-col justify-between px-[32px] pt-[calc(env(safe-area-inset-top)+152px)] pb-[calc(env(safe-area-inset-bottom)+40px)]`,children:[h(e,{type:`button`,variant:`ghost`,onClick:b,"aria-label":y(`loginClient.close`),className:`absolute top-[calc(env(safe-area-inset-top)+12px)] right-[24px] h-[32px] w-[32px] rounded-full border border-white/10 bg-white/5 !p-0 text-text2 backdrop-blur-[12px] hover:!bg-white/10 hover:text-text1`,children:h(o,{className:`h-[16px] w-[16px]`,"aria-hidden":`true`,focusable:`false`})}),g(n,{className:`flex w-full flex-col`,children:[h(a,{className:`text-[28px] leading-[32px] font-medium text-[#E6E6E6]`,children:y(`loginClient.title`)}),h(a,{className:`mt-[16px] text-[14px] leading-[24px] text-[#E6E6E6]`,children:y(`loginClient.subtitle`)}),g(`form`,{className:`mt-[48px]`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),z()},children:[h(n,{className:`flex h-[48px] items-center rounded-[8px] bg-white/10 px-[22px]`,children:h(i,{placeholder:y(`loginClient.emailPlaceholder`),type:`email`,name:`funhub-login-email`,value:T,onChange:e=>E(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`!h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`})}),g(n,{className:`mt-[24px] flex h-[48px] items-center justify-between rounded-[8px] bg-white/10 px-[16px]`,children:[h(i,{placeholder:y(`loginClient.passwordPlaceholder`),type:k?`text`:`password`,name:`funhub-login-password`,value:D,onChange:e=>O(e.target.value),autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`flex-1 !h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`}),h(e,{type:`button`,variant:`ghost`,className:`ml-[12px] h-[24px] w-[24px] cursor-pointer select-none !p-0 text-white/50 hover:text-white/80`,"aria-label":y(k?`loginClient.hidePassword`:`loginClient.showPassword`),onClick:()=>A(e=>!e),children:h(k?s:c,{className:`h-[20px] w-[20px]`,"aria-hidden":`true`,focusable:`false`})})]}),!!w&&h(n,{className:`mt-[8px] text-[12px] leading-[16px] text-theme5`,children:w})]}),g(n,{className:`mt-[16px] flex items-center justify-between text-[14px] leading-[24px] text-[#9DA3AC]`,children:[g(a,{as:`span`,className:`whitespace-nowrap`,children:[y(`loginClient.noAccount`),h(e,{type:`button`,variant:`link`,onClick:R,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,children:y(`loginClient.registerLink`)})]}),h(e,{type:`button`,variant:`link`,onClick:x,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] text-[#9DA3AC] !no-underline hover:text-text1 hover:!no-underline`,children:y(`loginClient.forgotPassword`)})]})]}),g(n,{className:`flex w-full flex-col`,children:[g(n,{className:`flex items-center`,children:[h(r,{checked:N,onCheckedChange:e=>P(e===!0),"aria-label":y(`loginClient.agreeToTerms`),className:`mt-px size-[16px] border-white/60 bg-transparent data-[checked]:border-theme5 data-[checked]:bg-theme5 data-[checked]:text-white`}),g(a,{as:`span`,className:`ml-[8px] text-[12px] leading-[16px] text-[#9DA3AC]`,children:[y(`loginClient.agreeToTermsPrefix`),g(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>I(`terms`),children:[`《`,y(`loginClient.userAgreement`),`》`]}),y(`loginClient.and`),g(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>I(`privacy`),children:[`《`,y(`loginClient.privacyPolicy`),`》`]})]})]}),h(e,{type:`button`,onClick:z,disabled:!L,className:`mt-[16px] h-[48px] w-full !rounded-[8px] !border-0 !px-0 !py-0 text-[16px] font-normal leading-[24px] text-white disabled:opacity-100 active:opacity-90 ${L?``:`!text-white/60`}`,style:{background:L?`var(--gradient-action-button)`:`linear-gradient(90deg, rgba(151, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`},children:y(j?`loginClient.loggingIn`:`loginClient.login`)})]})]}),h(l,{type:F,onClose:()=>I(null)})]})}export{v as LoginClient};
2
+ "use client";import{Button as e}from"../../ui/button.mjs";import{ensureGuestIdentity as t}from"../../../store/modules/user-store.mjs";import{Box as n}from"../../ui/box.mjs";import{Checkbox as r}from"../../ui/checkbox.mjs";import{Input as i}from"../../ui/input.mjs";import{Text as a}from"../../ui/text.mjs";import{CloseIcon as o}from"../../../assets/icons/close-icon.mjs";import{EyeIcon as s}from"../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as c}from"../../../assets/icons/eye-off-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{trackLoginPageClick as f}from"./tracking.mjs";import{useCallback as p,useMemo as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{useTranslations as v}from"next-intl";function y(y){let b=v(`components.pages.login`),{onClose:x,onForgotPassword:S,onRegister:C,onSubmit:w,errorText:T}=y,[E,D]=h(``),[O,k]=h(``),[A,j]=h(!1),[M,N]=h(!1),[P,F]=h(!1),[I,L]=h(null),R=m(()=>E.trim().length>0&&O.length>0&&P&&!M,[E,O,P,M]),z=p(()=>{t(!0),C?.()},[C]);async function B(){if(R)try{N(!0),await w?.({email:E.trim(),password:O})}finally{N(!1)}}return _(n,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:d,children:[_(n,{className:`relative z-[1] mx-auto flex min-h-screen w-full max-w-[390px] flex-col justify-between px-[32px] pt-[calc(env(safe-area-inset-top)+152px)] pb-[calc(env(safe-area-inset-bottom)+40px)]`,children:[g(e,{type:`button`,variant:`ghost`,onClick:x,"aria-label":b(`loginClient.close`),className:`absolute top-[calc(env(safe-area-inset-top)+12px)] right-[24px] h-[32px] w-[32px] rounded-full border border-white/10 bg-white/5 !p-0 text-text2 backdrop-blur-[12px] hover:!bg-white/10 hover:text-text1`,children:g(o,{className:`h-[16px] w-[16px]`,"aria-hidden":`true`,focusable:`false`})}),_(n,{className:`flex w-full flex-col`,children:[g(a,{className:`text-[28px] leading-[32px] font-medium text-[#E6E6E6]`,children:b(`loginClient.title`)}),g(a,{className:`mt-[16px] text-[14px] leading-[24px] text-[#E6E6E6]`,children:b(`loginClient.subtitle`)}),_(`form`,{className:`mt-[48px]`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),B()},children:[g(n,{className:`flex h-[48px] items-center rounded-[8px] bg-white/10 px-[22px]`,children:g(i,{placeholder:b(`loginClient.emailPlaceholder`),type:`email`,name:`funhub-login-email`,value:E,onChange:e=>D(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`!h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`})}),_(n,{className:`mt-[24px] flex h-[48px] items-center justify-between rounded-[8px] bg-white/10 px-[16px]`,children:[g(i,{placeholder:b(`loginClient.passwordPlaceholder`),type:A?`text`:`password`,name:`funhub-login-password`,value:O,onChange:e=>k(e.target.value),autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`flex-1 !h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`}),g(e,{type:`button`,variant:`ghost`,className:`ml-[12px] h-[24px] w-[24px] cursor-pointer select-none !p-0 text-white/50 hover:text-white/80`,"aria-label":b(A?`loginClient.hidePassword`:`loginClient.showPassword`),onClick:()=>j(e=>!e),children:g(A?s:c,{className:`h-[20px] w-[20px]`,"aria-hidden":`true`,focusable:`false`})})]}),!!T&&g(n,{className:`mt-[8px] text-[12px] leading-[16px] text-theme5`,children:T})]}),_(n,{className:`mt-[16px] flex items-center justify-between text-[14px] leading-[24px] text-[#9DA3AC]`,children:[_(a,{as:`span`,className:`whitespace-nowrap`,children:[b(`loginClient.noAccount`),g(e,{type:`button`,variant:`link`,onClick:z,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,children:b(`loginClient.registerLink`)})]}),g(e,{type:`button`,variant:`link`,onClick:S,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] text-[#9DA3AC] !no-underline hover:text-text1 hover:!no-underline`,children:b(`loginClient.forgotPassword`)})]})]}),_(n,{className:`flex w-full flex-col`,children:[_(n,{className:`flex items-center`,children:[g(r,{checked:P,onCheckedChange:e=>F(e===!0),"aria-label":b(`loginClient.agreeToTerms`),className:`mt-px size-[16px] border-white/60 bg-transparent data-[checked]:border-theme5 data-[checked]:bg-theme5 data-[checked]:text-white`}),_(a,{as:`span`,className:`ml-[8px] text-[12px] leading-[16px] text-[#9DA3AC]`,children:[b(`loginClient.agreeToTermsPrefix`),_(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>L(`terms`),children:[`《`,b(`loginClient.userAgreement`),`》`]}),b(`loginClient.and`),_(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>L(`privacy`),children:[`《`,b(`loginClient.privacyPolicy`),`》`]})]})]}),g(e,{type:`button`,"data-skip-dialog-track":`true`,onClick:e=>{f(e,`login_submit`),B()},disabled:!R,className:`mt-[16px] h-[48px] w-full !rounded-[8px] !border-0 !px-0 !py-0 text-[16px] font-normal leading-[24px] text-white disabled:opacity-100 active:opacity-90 ${R?``:`!text-white/60`}`,style:{background:R?`var(--gradient-action-button)`:`linear-gradient(90deg, rgba(151, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`},children:b(M?`loginClient.loggingIn`:`loginClient.login`)})]})]}),g(l,{type:I,onClose:()=>L(null)})]})}export{y as LoginClient};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Button as e}from"../../ui/button.mjs";import{isValidEmail as t}from"../../../utils/email-validator.mjs";import{pUserSendEmailCode as n}from"../../../service/generated/client.mjs";import{Box as r}from"../../ui/box.mjs";import{Checkbox as i}from"../../ui/checkbox.mjs";import{Input as a}from"../../ui/input.mjs";import{Text as o}from"../../ui/text.mjs";import{useLoginModalStore as s}from"../../../store/modules/login-modal-store.mjs";import{LeftArrowIcon as c}from"../../../assets/icons/left-arrow-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{useMemo as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{useTranslations as g}from"next-intl";function _(_){let v=g(`components.pages.login`),{onClose:y,onLogin:b,onVerify:x}=_,{setVerifyStep:S}=s(),[C,w]=p(``),[T,E]=p(!1),[D,O]=p(``),[k,A]=p(!1),[j,M]=p(null),N=f(()=>C.trim().length>0&&k&&!T,[C,k,T]);function P(e){w(e),D&&O(``)}async function F(){if(N)try{E(!0),O(``);let e=C.trim();if(!t(e)){O(v(`register.invalidEmail`));return}await n({email:e}),S(`register-verify`),x?.(e)}catch(e){O(e.message??v(`register.sendFailed`))}finally{E(!1)}}return h(r,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:d,children:[h(r,{className:`relative z-[1] mx-auto flex min-h-screen w-full max-w-[390px] flex-col justify-between px-[32px] pt-[calc(env(safe-area-inset-top)+152px)] pb-[calc(env(safe-area-inset-bottom)+40px)]`,children:[m(e,{type:`button`,variant:`ghost`,onClick:y,"aria-label":v(`register.back`),className:`absolute top-[calc(env(safe-area-inset-top)+12px)] left-[24px] h-[32px] w-[32px] rounded-full border border-white/10 bg-white/5 !p-0 text-text2 backdrop-blur-[12px] hover:!bg-white/10 hover:text-text1`,children:m(c,{className:`h-[16px] w-[16px]`,"aria-hidden":`true`,focusable:`false`})}),h(r,{className:`flex w-full flex-col`,children:[m(o,{className:`text-[28px] leading-[32px] font-medium text-[#E6E6E6]`,children:v(`loginClient.title`)}),m(o,{className:`mt-[16px] text-[14px] leading-[24px] text-[#E6E6E6]`,children:v(`loginClient.subtitle`)}),m(`form`,{className:`mt-[48px]`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),F()},children:m(r,{className:`flex h-[48px] items-center rounded-[8px] bg-white/10 px-[22px]`,children:m(a,{placeholder:v(`register.emailPlaceholder`),type:`email`,name:`funhub-register-email`,value:C,onChange:e=>P(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`!h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`})})}),!!D&&m(r,{className:`mt-[8px] min-h-[16px] text-[12px] leading-[16px] text-theme5`,children:D}),m(r,{className:`mt-[16px] flex items-center justify-between text-[14px] leading-[24px] text-[#9DA3AC]`,children:h(o,{as:`span`,className:`whitespace-nowrap`,children:[v(`register.hasAccount`),m(e,{type:`button`,variant:`link`,onClick:b,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,children:v(`register.loginLink`)})]})})]}),h(r,{className:`flex w-full flex-col`,children:[h(r,{className:`flex items-center`,children:[m(i,{checked:k,onCheckedChange:e=>A(e===!0),"aria-label":v(`loginClient.agreeToTerms`),className:`mt-px size-[16px] border-white/60 bg-transparent data-[checked]:border-theme5 data-[checked]:bg-theme5 data-[checked]:text-white`}),h(o,{as:`span`,className:`ml-[8px] text-[12px] leading-[16px] text-[#9DA3AC]`,children:[v(`loginClient.agreeToTermsPrefix`),h(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>M(`terms`),children:[`《`,v(`loginClient.userAgreement`),`》`]}),v(`loginClient.and`),h(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>M(`privacy`),children:[`《`,v(`loginClient.privacyPolicy`),`》`]})]})]}),m(e,{type:`button`,onClick:F,disabled:!N,className:`mt-[16px] h-[48px] w-full !rounded-[8px] !border-0 !px-0 !py-0 text-[16px] font-normal leading-[24px] text-white disabled:opacity-100 active:opacity-90 ${N?``:`!text-white/60`}`,style:{background:N?`var(--gradient-action-button)`:`linear-gradient(90deg, rgba(151, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`},children:v(T?`register.sending`:`register.getCode`)})]})]}),m(l,{type:j,onClose:()=>M(null)})]})}export{_ as Register};
2
+ "use client";import{Button as e}from"../../ui/button.mjs";import{isValidEmail as t}from"../../../utils/email-validator.mjs";import{pUserSendEmailCode as n}from"../../../service/generated/client.mjs";import{Box as r}from"../../ui/box.mjs";import{Checkbox as i}from"../../ui/checkbox.mjs";import{Input as a}from"../../ui/input.mjs";import{Text as o}from"../../ui/text.mjs";import{useLoginModalStore as s}from"../../../store/modules/login-modal-store.mjs";import{LeftArrowIcon as c}from"../../../assets/icons/left-arrow-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{trackLoginPageClick as f}from"./tracking.mjs";import{useMemo as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useTranslations as _}from"next-intl";function v(v){let y=_(`components.pages.login`),{onClose:b,onLogin:x,onVerify:S}=v,{setVerifyStep:C}=s(),[w,T]=m(``),[E,D]=m(!1),[O,k]=m(``),[A,j]=m(!1),[M,N]=m(null),P=p(()=>w.trim().length>0&&A&&!E,[w,A,E]);function F(e){T(e),O&&k(``)}async function I(){if(P)try{D(!0),k(``);let e=w.trim();if(!t(e)){k(y(`register.invalidEmail`));return}await n({email:e}),C(`register-verify`),S?.(e)}catch(e){k(e.message??y(`register.sendFailed`))}finally{D(!1)}}return g(r,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:d,children:[g(r,{className:`relative z-[1] mx-auto flex min-h-screen w-full max-w-[390px] flex-col justify-between px-[32px] pt-[calc(env(safe-area-inset-top)+152px)] pb-[calc(env(safe-area-inset-bottom)+40px)]`,children:[h(e,{type:`button`,variant:`ghost`,onClick:b,"aria-label":y(`register.back`),className:`absolute top-[calc(env(safe-area-inset-top)+12px)] left-[24px] h-[32px] w-[32px] rounded-full border border-white/10 bg-white/5 !p-0 text-text2 backdrop-blur-[12px] hover:!bg-white/10 hover:text-text1`,children:h(c,{className:`h-[16px] w-[16px]`,"aria-hidden":`true`,focusable:`false`})}),g(r,{className:`flex w-full flex-col`,children:[h(o,{className:`text-[28px] leading-[32px] font-medium text-[#E6E6E6]`,children:y(`loginClient.title`)}),h(o,{className:`mt-[16px] text-[14px] leading-[24px] text-[#E6E6E6]`,children:y(`loginClient.subtitle`)}),h(`form`,{className:`mt-[48px]`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),I()},children:h(r,{className:`flex h-[48px] items-center rounded-[8px] bg-white/10 px-[22px]`,children:h(a,{placeholder:y(`register.emailPlaceholder`),type:`email`,name:`funhub-register-email`,value:w,onChange:e=>F(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`!h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`})})}),!!O&&h(r,{className:`mt-[8px] min-h-[16px] text-[12px] leading-[16px] text-theme5`,children:O}),h(r,{className:`mt-[16px] flex items-center justify-between text-[14px] leading-[24px] text-[#9DA3AC]`,children:g(o,{as:`span`,className:`whitespace-nowrap`,children:[y(`register.hasAccount`),h(e,{type:`button`,variant:`link`,onClick:x,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,children:y(`register.loginLink`)})]})})]}),g(r,{className:`flex w-full flex-col`,children:[g(r,{className:`flex items-center`,children:[h(i,{checked:A,onCheckedChange:e=>j(e===!0),"aria-label":y(`loginClient.agreeToTerms`),className:`mt-px size-[16px] border-white/60 bg-transparent data-[checked]:border-theme5 data-[checked]:bg-theme5 data-[checked]:text-white`}),g(o,{as:`span`,className:`ml-[8px] text-[12px] leading-[16px] text-[#9DA3AC]`,children:[y(`loginClient.agreeToTermsPrefix`),g(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>N(`terms`),children:[`《`,y(`loginClient.userAgreement`),`》`]}),y(`loginClient.and`),g(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>N(`privacy`),children:[`《`,y(`loginClient.privacyPolicy`),`》`]})]})]}),h(e,{type:`button`,"data-skip-dialog-track":`true`,onClick:e=>{f(e,`register_submit`),I()},disabled:!P,className:`mt-[16px] h-[48px] w-full !rounded-[8px] !border-0 !px-0 !py-0 text-[16px] font-normal leading-[24px] text-white disabled:opacity-100 active:opacity-90 ${P?``:`!text-white/60`}`,style:{background:P?`var(--gradient-action-button)`:`linear-gradient(90deg, rgba(151, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`},children:y(E?`register.sending`:`register.getCode`)})]})]}),h(l,{type:M,onClose:()=>N(null)})]})}export{v as Register};
@@ -0,0 +1,2 @@
1
+
2
+ "use client";import{trackAppPageView as e,trackPageClick as t}from"../../../utils/tracking.mjs";const n=`login`,r=`登录注册`;function i(e,i,a){t(n,r,e,i,a)}function a(t=0){e({page_key:n,page_name:r,current_page_key:n,current_page_name:r,page_load_time:t})}export{i as trackLoginPageClick,a as trackLoginPageView};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetComments as n,gCommunityGetContentInfo as r,gCommunityGetContentList as i,gContentGetAppChannels as a}from"../../../service/generated/client.mjs";import{checkFollowStatus as o}from"../../../utils/follow-service.mjs";import{EmptyState as s}from"../../ui/empty.mjs";import{useRequest as c}from"../../../hooks/query/use-query.mjs";import{useBrowseReport as l}from"../../../hooks/use-browse-report.mjs";import{queryKey as u}from"../../../constants/query-key.mjs";import{useKeepAliveEffect as ee,useKeepAliveState as d}from"../../common/keep-scroll-position/index.mjs";import{apiCollectClick as f}from"../../../utils/api-collect.mjs";import{batchQueryContentInteractions as p}from"../../../hooks/use-content-operate.mjs";import m from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{DetailFollowAction as te}from"../../biz/business/detail/shared/detail-follow-action.mjs";import{DetailOperate as ne}from"../../biz/business/detail/shared/detail-operate.mjs";import{PostRecommendList as re}from"../../biz/business/detail/shared/post-recommend-list.mjs";import{DetailHero as h}from"../../biz/business/detail/shared/video-hero.mjs";import g from"../../biz/business/comment/comment-list.mjs";import ie from"../../common/info-card/card-header.mjs";import ae from"../../common/info-card/card-text.mjs";import{useCallback as oe,useEffect as _,useMemo as v}from"react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import{useSearchParams as se}from"next/navigation";import{useTranslations as S}from"next-intl";function C(e){if(!e||typeof e!=`object`||!e.content_id)return null;let t=Array.isArray(e.medias)?e.medias:[],n=t.filter(e=>e&&e.is_video===!1),r=t.filter(e=>e&&e.is_video===!0),i=n.map(e=>e.media_url).filter(e=>typeof e==`string`&&e.length>0),a=(Array.isArray(e.images)?e.images:[]).map(e=>typeof e==`string`?e:e&&typeof e==`object`&&(e.url||e.image_url||e.media_url)||``).filter(e=>typeof e==`string`&&e.length>0),o=i.length?i:a,s=r.map(e=>e.cover_image).find(e=>typeof e==`string`&&e.length>0),c=o[0]||``,l=e.cover_image||s||c||``,u=(Array.isArray(e.tags)?e.tags:[]).map(e=>{if(e&&typeof e==`object`){let t=e.id??e.name??``,n=e.name??e.id??``,r=e.group??``;return{id:String(t),name:String(n),group:String(r)}}return{id:String(e),name:String(e),group:``}}).filter(e=>!!(e.id||e.name));return{...t.length?{medias:t}:{},id:e.content_id,mid:e.content_id,name:e.title||``,cat_id:``,cat_name:``,status:String(e.status||`2`),status_text:``,create_time:e.create_time,show_at:e.create_time,position:``,img_type:``,img_x:l,img_y:l,img_width:``,img_height:``,preview_images:o,score:``,duration:``,is_more_link:`n`,update_status:`1`,description:e.content||``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:u,source_tags:u.map(e=>e.name).filter(Boolean).join(`,`),source_actor:[],links:[],money:``,up_user:e.user_id||e.author?.user_id||``,source_username:e.author?.nickname||e.author?.username||``,task_id:``,file_status:``,content_type:2,author:{...e.author,avatar:e.author.avatar_url},like:e.interaction?.is_liked||!1,dislike:e.interaction?.is_dislike||!1,collect:e.interaction?.is_collected||!1,is_followed:e.interaction?.is_followed||!1,static:{like_cnt:e.like_count||0,comment_cnt:e.comment_count||0,share_cnt:e.share_count||0,browse_cnt:e.view_count||0},info:{text:e.content||``,images:o}}}function ce(e){let t=Array.isArray(e.medias)?e.medias:[],n=t.filter(e=>e&&e.is_video===!1).map(e=>e.media_url).filter(e=>typeof e==`string`&&e.length>0),r=(Array.isArray(e.images)?e.images:[]).map(e=>typeof e==`string`?e:e&&typeof e==`object`&&(e.url||e.image_url||e.media_url)||``).filter(e=>typeof e==`string`&&e.length>0),i=n.length?n:r,a=t.filter(e=>e&&e.is_video===!0).map(e=>e.cover_image).find(e=>typeof e==`string`&&e.length>0),o=e.cover_image||a||i[0]||``,s=(Array.isArray(e.tags)?e.tags:[]).map(e=>{if(e&&typeof e==`object`){let t=e.id??e.name??``,n=e.name??e.id??``,r=e.group??``;return{id:String(t),name:String(n),group:String(r)}}return{id:String(e),name:String(e),group:``}}).filter(e=>!!(e.id||e.name)),c=t.length?t:i.filter(Boolean).map(e=>({media_url:e,is_video:!1,cover_image:``}));return{...c.length?{medias:c}:{},id:e.content_id||``,mid:e.content_id||``,name:e.title||``,cat_id:``,cat_name:``,status:String(e.status||`2`),status_text:``,create_time:e.create_time,show_at:e.create_time,position:``,img_type:``,img_x:o,img_y:o,img_width:``,img_height:``,preview_images:i,score:``,duration:``,is_more_link:`n`,update_status:`1`,description:e.content||``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:s,source_tags:s.map(e=>e.name).filter(Boolean).join(`,`),source_actor:[],links:[],money:``,up_user:e.user_id||e.author?.user_id||``,source_username:e.author?.nickname||e.author?.username||``,task_id:``,file_status:``,content_type:2,author:{...e.author,avatar:e.author.avatar_url},like:e.interaction?.is_liked||!1,dislike:e.interaction?.is_dislike||!1,collect:e.interaction?.is_collected||!1,is_followed:e.interaction?.is_followed||!1,statics_cnt:{like_cnt:String(e.like_count||0),dislike_cnt:String(e.dislike_count||0),comment_cnt:String(e.comment_count||0),share_cnt:String(e.share_count||0),browse_cnt:String(e.view_count||0),collect_cnt:String(e.collect_count||0)}}}function w({detailId:f,initialInformation:w,initialRecommendList:le,initialCommentList:T,initialCommentTotal:E,initialCommentHasMore:D}){let O=S(`components.pages.postDetail`),k=se(),{isLogin:ue,userInfo:A,userId:de}=t(),j=de||A?.userId||``;l({contentId:f,contentType:2,enabled:!!f,enableIntervalReport:!1,enableExitReport:!1});let{data:M}=c(v(()=>[`post-detail`,f],[f]),async()=>f?await r({content_id:f}):null,{enabled:!!f}),N=v(()=>{let e=M?.data?.data;return C(e)},[M?.data?.data]),fe=w??N??null,{data:P}=c(v(()=>[`post-detail-recommend`,f],[f]),async()=>f?await i({page:1,page_size:6,sort_by:`recommend`}):null,{enabled:!!f}),F=v(()=>(P?.data?.data?.contents??[]).filter(e=>e.content_id!==f).slice(0,4).map(e=>ce(e)),[f,P?.data?.data?.contents]),I=le??F??[],[L,R]=d(`detail-information-${f}`,fe),[z,B]=d(`detail-recommend-${f}`,I),[V,H]=d(`info-detail-comment-add-count-${f}`,0),U=v(()=>L?.content_type===0,[L?.content_type]),W=v(()=>[`post-detail-comments`,f,1,5],[5,f]),{data:G}=c(W,async()=>f?await n({content_id:f,page:1,page_size:5,sort_by:`latest`}):null,{enabled:!!f}),pe=v(()=>{if(T?.length)return T;let e=G?.data?.data?.comments??[];if(e.length>0)return e},[G?.data?.data?.comments,T]),K=v(()=>{if(typeof E==`number`)return E;if(G?.data?.data)return typeof G?.data?.data?.total==`number`?G.data.data.total:void 0},[G?.data?.data,E]),me=v(()=>{if(typeof D==`boolean`)return D;if(G?.data?.data)return G?.data?.data?.has_more??!1},[G?.data?.data,D]),[q,J]=d(`post-detail-comment-total-${f}`,typeof E==`number`?E:void 0);_(()=>{typeof K==`number`&&J(e=>typeof e==`number`?Math.max(e,K):K)},[K,J]);let he=v(()=>[`detail-interaction`,L?.id,L?.content_type],[L?.content_type,L?.id]),Y=L?.up_user||``,ge=!!(j&&Y&&j===Y),_e=v(()=>[`detail-follow-status`,j,Y],[j,Y]),{data:X}=c(he,async()=>!L?.id||typeof L.content_type!=`number`?null:await p([L.id],2),{enabled:!!L?.id}),{data:Z}=c(_e,async()=>!j||!Y?null:await o({app_id:0,follower_id:j,followee_ids:[Y]}),{enabled:!!ue&&!!j&&!!Y&&!ge});_(()=>{!L&&N&&R(N)},[L,N,R]),_(()=>{z.length===0&&F.length>0&&B(F)},[z.length,F,B]),_(()=>{if(!X?.interaction_list?.[0])return;let e=X.interaction_list[0];R(t=>{if(!t)return t;let n=t.static?.like_cnt,r=typeof n==`number`?n:Number(n||0),i=!!e.is_liked&&r===0;return{...t,like:e.is_liked||!1,dislike:e.is_disliked||!1,collect:e.is_collected||!1,static:i?{...t.static||{},like_cnt:1}:t.static}})},[X,R]),_(()=>{if(!Z?.data||!Y)return;let e=!!Z.data?.is_following_map?.[Y];R(t=>!t||t.is_followed===e?t:{...t,is_followed:e})},[Z?.data,Y,R]);let Q=oe(e=>{R(t=>t&&{...t,...e})},[R]);ee(()=>{L?.id&&L.id},[L?.id],`detail-page-report-${f}`),_(()=>{!L||typeof window>`u`||window.sensors?.track?.(`detail_page_view`,{object_id:L.id||f,author_id:L.up_user,object_type:L.content_type,object_category:L.content_type,object_tags:L.tags?.map(e=>e.name),block_id:``,page_source:window.location?.pathname||``})},[f,L]),_(()=>{H(0)},[L?.id,H]);let ve=v(()=>(typeof q==`number`?q:typeof K==`number`?K:0)+V,[V,q,K]);_(()=>{k?.get(`tab`)===`comment`&&(typeof window>`u`||window.requestAnimationFrame(()=>{document.getElementById(`detail-comments`)?.scrollIntoView({behavior:`smooth`,block:`start`})}))},[L?.id,k]);let $=L?.status===`2`,{data:ye}=c([u.CHANNEL],()=>a());return x(`div`,{className:`w-full min-h-screen bg-bg2 text-text1 pt-11`,children:[b(`div`,{className:`fixed top-0 left-0 right-0 z-40`,children:b(m,{data:{list:e(ye?.data)}})}),b(`div`,{className:`mx-auto w-full max-w-[840px] pb-6`,children:x(y,{children:[L&&!$&&b(s,{type:`no-content`,text:O(`postDetailClient.postOffline`)}),L&&$&&x(y,{children:[U&&b(h,{information:L,isVideo:!0}),x(`article`,{className:`w-full`,children:[b(ie,{infoData:L,rightChild:b(te,{information:L,onUpdate:Q})}),b(ae,{infoData:L,isEllipsis:!1}),!U&&b(`div`,{className:`mt-[12px]`,children:b(h,{information:L,isVideo:!1})})]}),b(ne,{information:L,onUpdate:Q}),x(`div`,{id:`detail-comments`,className:`w-full border-t-[8px] border-bg2 mt-[12px]`,children:[x(`div`,{className:`w-full px-[16px] h-[40px] flex items-center justify-between border-b-[1px] border-line1`,children:[b(`p`,{className:`text-[16px] text-text1 font-bold`,children:O(`postDetailClient.comment`)}),x(`p`,{className:`text-[12px] text-text3`,children:[ve,O(`postDetailClient.reactions`)]})]}),b(g,{listQueryKey:W,contentId:L.id,information:L,isShow:!1,isClickLoad:!0,initialComments:pe,initialTotal:K,initialHasMore:me,addCommentCount:()=>{H(e=>e+1)},onTotalChange:e=>{J(t=>typeof t==`number`?Math.max(t,e):e)}})]}),z.length>0&&b(re,{information:L,initRecommendList:z})]}),!L&&b(s,{type:`no-content`,text:O(`postDetailClient.postDeleted`)})]})})]})}export{w as default};
2
+ "use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetComments as n,gCommunityGetContentInfo as r,gCommunityGetContentList as i,gContentGetAppChannels as a}from"../../../service/generated/client.mjs";import{checkFollowStatus as o}from"../../../utils/follow-service.mjs";import{usePageLifecycle as s}from"../../../utils/tracking.mjs";import{EmptyState as c}from"../../ui/empty.mjs";import{useRequest as l}from"../../../hooks/query/use-query.mjs";import{useBrowseReport as u}from"../../../hooks/use-browse-report.mjs";import{queryKey as ee}from"../../../constants/query-key.mjs";import{useKeepAliveEffect as te,useKeepAliveState as d}from"../../common/keep-scroll-position/index.mjs";import{apiCollectClick as f}from"../../../utils/api-collect.mjs";import{batchQueryContentInteractions as p}from"../../../hooks/use-content-operate.mjs";import ne from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{DetailFollowAction as re}from"../../biz/business/detail/shared/detail-follow-action.mjs";import{DetailOperate as ie}from"../../biz/business/detail/shared/detail-operate.mjs";import{PostRecommendList as m}from"../../biz/business/detail/shared/post-recommend-list.mjs";import{DetailHero as h}from"../../biz/business/detail/shared/video-hero.mjs";import g from"../../biz/business/comment/comment-list.mjs";import _ from"../../common/info-card/card-header.mjs";import ae from"../../common/info-card/card-text.mjs";import{useCallback as oe,useEffect as v,useMemo as y}from"react";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";import{useSearchParams as C}from"next/navigation";import{useTranslations as se}from"next-intl";function ce(e){if(!e||typeof e!=`object`||!e.content_id)return null;let t=Array.isArray(e.medias)?e.medias:[],n=t.filter(e=>e&&e.is_video===!1),r=t.filter(e=>e&&e.is_video===!0),i=n.map(e=>e.media_url).filter(e=>typeof e==`string`&&e.length>0),a=(Array.isArray(e.images)?e.images:[]).map(e=>typeof e==`string`?e:e&&typeof e==`object`&&(e.url||e.image_url||e.media_url)||``).filter(e=>typeof e==`string`&&e.length>0),o=i.length?i:a,s=r.map(e=>e.cover_image).find(e=>typeof e==`string`&&e.length>0),c=o[0]||``,l=e.cover_image||s||c||``,u=(Array.isArray(e.tags)?e.tags:[]).map(e=>{if(e&&typeof e==`object`){let t=e.id??e.name??``,n=e.name??e.id??``,r=e.group??``;return{id:String(t),name:String(n),group:String(r)}}return{id:String(e),name:String(e),group:``}}).filter(e=>!!(e.id||e.name));return{...t.length?{medias:t}:{},id:e.content_id,mid:e.content_id,name:e.title||``,cat_id:``,cat_name:``,status:String(e.status||`2`),status_text:``,create_time:e.create_time,show_at:e.create_time,position:``,img_type:``,img_x:l,img_y:l,img_width:``,img_height:``,preview_images:o,score:``,duration:``,is_more_link:`n`,update_status:`1`,description:e.content||``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:u,source_tags:u.map(e=>e.name).filter(Boolean).join(`,`),source_actor:[],links:[],money:``,up_user:e.user_id||e.author?.user_id||``,source_username:e.author?.nickname||e.author?.username||``,task_id:``,file_status:``,content_type:2,author:{...e.author,avatar:e.author.avatar_url},like:e.interaction?.is_liked||!1,dislike:e.interaction?.is_dislike||!1,collect:e.interaction?.is_collected||!1,is_followed:e.interaction?.is_followed||!1,static:{like_cnt:e.like_count||0,comment_cnt:e.comment_count||0,share_cnt:e.share_count||0,browse_cnt:e.view_count||0},info:{text:e.content||``,images:o}}}function le(e){let t=Array.isArray(e.medias)?e.medias:[],n=t.filter(e=>e&&e.is_video===!1).map(e=>e.media_url).filter(e=>typeof e==`string`&&e.length>0),r=(Array.isArray(e.images)?e.images:[]).map(e=>typeof e==`string`?e:e&&typeof e==`object`&&(e.url||e.image_url||e.media_url)||``).filter(e=>typeof e==`string`&&e.length>0),i=n.length?n:r,a=t.filter(e=>e&&e.is_video===!0).map(e=>e.cover_image).find(e=>typeof e==`string`&&e.length>0),o=e.cover_image||a||i[0]||``,s=(Array.isArray(e.tags)?e.tags:[]).map(e=>{if(e&&typeof e==`object`){let t=e.id??e.name??``,n=e.name??e.id??``,r=e.group??``;return{id:String(t),name:String(n),group:String(r)}}return{id:String(e),name:String(e),group:``}}).filter(e=>!!(e.id||e.name)),c=t.length?t:i.filter(Boolean).map(e=>({media_url:e,is_video:!1,cover_image:``}));return{...c.length?{medias:c}:{},id:e.content_id||``,mid:e.content_id||``,name:e.title||``,cat_id:``,cat_name:``,status:String(e.status||`2`),status_text:``,create_time:e.create_time,show_at:e.create_time,position:``,img_type:``,img_x:o,img_y:o,img_width:``,img_height:``,preview_images:i,score:``,duration:``,is_more_link:`n`,update_status:`1`,description:e.content||``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:s,source_tags:s.map(e=>e.name).filter(Boolean).join(`,`),source_actor:[],links:[],money:``,up_user:e.user_id||e.author?.user_id||``,source_username:e.author?.nickname||e.author?.username||``,task_id:``,file_status:``,content_type:2,author:{...e.author,avatar:e.author.avatar_url},like:e.interaction?.is_liked||!1,dislike:e.interaction?.is_dislike||!1,collect:e.interaction?.is_collected||!1,is_followed:e.interaction?.is_followed||!1,statics_cnt:{like_cnt:String(e.like_count||0),dislike_cnt:String(e.dislike_count||0),comment_cnt:String(e.comment_count||0),share_cnt:String(e.share_count||0),browse_cnt:String(e.view_count||0),collect_cnt:String(e.collect_count||0)}}}function w({detailId:f,initialInformation:w,initialRecommendList:ue,initialCommentList:T,initialCommentTotal:E,initialCommentHasMore:D}){let O=se(`components.pages.postDetail`),k=C(),{isLogin:A,userInfo:de,userId:fe}=t(),j=fe||de?.userId||``;s(`page_post_detail`,`详情页`),u({contentId:f,contentType:2,enabled:!!f,enableIntervalReport:!1,enableExitReport:!1});let{data:M}=l(y(()=>[`post-detail`,f],[f]),async()=>f?await r({content_id:f}):null,{enabled:!!f}),N=y(()=>{let e=M?.data?.data;return ce(e)},[M?.data?.data]),pe=w??N??null,{data:P}=l(y(()=>[`post-detail-recommend`,f],[f]),async()=>f?await i({page:1,page_size:6,sort_by:`recommend`}):null,{enabled:!!f}),F=y(()=>(P?.data?.data?.contents??[]).filter(e=>e.content_id!==f).slice(0,4).map(e=>le(e)),[f,P?.data?.data?.contents]),I=ue??F??[],[L,R]=d(`detail-information-${f}`,pe),[z,B]=d(`detail-recommend-${f}`,I),[V,H]=d(`info-detail-comment-add-count-${f}`,0),U=y(()=>L?.content_type===0,[L?.content_type]),W=y(()=>[`post-detail-comments`,f,1,5],[5,f]),{data:G}=l(W,async()=>f?await n({content_id:f,page:1,page_size:5,sort_by:`latest`}):null,{enabled:!!f}),me=y(()=>{if(T?.length)return T;let e=G?.data?.data?.comments??[];if(e.length>0)return e},[G?.data?.data?.comments,T]),K=y(()=>{if(typeof E==`number`)return E;if(G?.data?.data)return typeof G?.data?.data?.total==`number`?G.data.data.total:void 0},[G?.data?.data,E]),he=y(()=>{if(typeof D==`boolean`)return D;if(G?.data?.data)return G?.data?.data?.has_more??!1},[G?.data?.data,D]),[q,J]=d(`post-detail-comment-total-${f}`,typeof E==`number`?E:void 0);v(()=>{typeof K==`number`&&J(e=>typeof e==`number`?Math.max(e,K):K)},[K,J]);let ge=y(()=>[`detail-interaction`,L?.id,L?.content_type],[L?.content_type,L?.id]),Y=L?.up_user||``,_e=!!(j&&Y&&j===Y),ve=y(()=>[`detail-follow-status`,j,Y],[j,Y]),{data:X}=l(ge,async()=>!L?.id||typeof L.content_type!=`number`?null:await p([L.id],2),{enabled:!!L?.id}),{data:Z}=l(ve,async()=>!j||!Y?null:await o({app_id:0,follower_id:j,followee_ids:[Y]}),{enabled:!!A&&!!j&&!!Y&&!_e});v(()=>{!L&&N&&R(N)},[L,N,R]),v(()=>{z.length===0&&F.length>0&&B(F)},[z.length,F,B]),v(()=>{if(!X?.interaction_list?.[0])return;let e=X.interaction_list[0];R(t=>{if(!t)return t;let n=t.static?.like_cnt,r=typeof n==`number`?n:Number(n||0),i=!!e.is_liked&&r===0;return{...t,like:e.is_liked||!1,dislike:e.is_disliked||!1,collect:e.is_collected||!1,static:i?{...t.static||{},like_cnt:1}:t.static}})},[X,R]),v(()=>{if(!Z?.data||!Y)return;let e=!!Z.data?.is_following_map?.[Y];R(t=>!t||t.is_followed===e?t:{...t,is_followed:e})},[Z?.data,Y,R]);let Q=oe(e=>{R(t=>t&&{...t,...e})},[R]);te(()=>{L?.id&&L.id},[L?.id],`detail-page-report-${f}`),v(()=>{!L||typeof window>`u`||window.sensors?.track?.(`detail_page_view`,{object_id:L.id||f,author_id:L.up_user,object_type:L.content_type,object_category:L.content_type,object_tags:L.tags?.map(e=>e.name),block_id:``,page_source:window.location?.pathname||``})},[f,L]),v(()=>{H(0)},[L?.id,H]);let ye=y(()=>(typeof q==`number`?q:typeof K==`number`?K:0)+V,[V,q,K]);v(()=>{k?.get(`tab`)===`comment`&&(typeof window>`u`||window.requestAnimationFrame(()=>{document.getElementById(`detail-comments`)?.scrollIntoView({behavior:`smooth`,block:`start`})}))},[L?.id,k]);let $=L?.status===`2`,{data:be}=l([ee.CHANNEL],()=>a());return S(`div`,{className:`w-full min-h-screen bg-bg2 text-text1 pt-11`,children:[x(`div`,{className:`fixed top-0 left-0 right-0 z-40`,children:x(ne,{data:{list:e(be?.data)}})}),x(`div`,{className:`mx-auto w-full max-w-[840px] pb-6`,children:S(b,{children:[L&&!$&&x(c,{type:`no-content`,text:O(`postDetailClient.postOffline`)}),L&&$&&S(b,{children:[U&&x(h,{information:L,isVideo:!0}),S(`article`,{className:`w-full`,children:[x(_,{infoData:L,rightChild:x(re,{information:L,onUpdate:Q})}),x(ae,{infoData:L,isEllipsis:!1}),!U&&x(`div`,{className:`mt-[12px]`,children:x(h,{information:L,isVideo:!1})})]}),x(ie,{information:L,onUpdate:Q}),S(`div`,{id:`detail-comments`,className:`w-full border-t-[8px] border-bg2 mt-[12px]`,children:[S(`div`,{className:`w-full px-[16px] h-[40px] flex items-center justify-between border-b-[1px] border-line1`,children:[x(`p`,{className:`text-[16px] text-text1 font-bold`,children:O(`postDetailClient.comment`)}),S(`p`,{className:`text-[12px] text-text3`,children:[ye,O(`postDetailClient.reactions`)]})]}),x(g,{listQueryKey:W,contentId:L.id,information:L,isShow:!1,isClickLoad:!0,initialComments:me,initialTotal:K,initialHasMore:he,addCommentCount:()=>{H(e=>e+1)},onTotalChange:e=>{J(t=>typeof t==`number`?Math.max(t,e):e)}})]}),z.length>0&&x(m,{information:L,initRecommendList:z})]}),!L&&x(c,{type:`no-content`,text:O(`postDetailClient.postDeleted`)})]})})]})}export{w as default};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{cn as e}from"../../../utils/cn.mjs";import{AlertDialog as t,AlertDialogAction as n,AlertDialogCancel as r,AlertDialogContent as ee,AlertDialogDescription as te,AlertDialogFooter as ne,AlertDialogHeader as re,AlertDialogTitle as i}from"../../ui/alert-dialog.mjs";import{getAtUserElement as ie}from"../../../utils/common.mjs";import ae from"../../../utils/event-bus.mjs";import{pCommunityPublishContent as oe}from"../../../service/generated/client.mjs";import{useRouter as se}from"../../../utils/use-compatible-router.mjs";import{Box as ce}from"../../ui/box.mjs";import{useKeyboardOpen as a}from"../../../hooks/use-keyboard-open.mjs";import{eventKey as o}from"../../../constants/event-key.mjs";import{useMediaPreview as s}from"../../common/media-preview/index.mjs";import c from"../../ui/popup.mjs";import{UploadProgress as l}from"./components/upload-progress.mjs";import{ContactList as u}from"../../biz/business/contact/contact-list.mjs";import{Collection as le}from"./components/collection.mjs";import{MAX_MATERIAL_COUNT as d}from"./constants.mjs";import{filterAtUserNames as ue}from"./utils/publish-utils.mjs";import{PublishEditor as de}from"./components/editor.mjs";import{PublishHeader as fe}from"./components/header.mjs";import{MaterialGrid as pe}from"./components/material-grid.mjs";import{Toolbar as me}from"./components/toolbar.mjs";import{useFileUpload as he}from"./hooks/use-file-upload.mjs";import{useCallback as f,useEffect as ge,useMemo as _e,useRef as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{toast as _}from"sonner";import{useTranslations as v}from"next-intl";function y({className:y}={}){let b=v(`components.pages.publish`),ve=se(),x=p(null),[ye,S]=m(!1),[C,w]=m(`0`),{isOpen:T}=a(),[E,D]=m(null),[O,k]=m([]),[A,j]=m(``),[M,N]=m(``),[P,F]=m(``),[I,L]=m(0),[be,R]=m(``),[z,B]=m(``),[xe,V]=m(0),[H,U]=m(``),[W,G]=m([]),[Se,K]=m(!1),[Ce,q]=m(!1),[we,Te]=m(``),J=p(null);ge(()=>()=>{ae.emit(o.WAIT_LOADING_SHOW,{show:!1})},[]);let Y=f(e=>(Te(e),q(!0),new Promise(e=>{J.current=e})),[]),{selectFile:X}=he({onProgressUpdate:(e,t,n,r)=>{D(r>0?{currentFiles:e,totalFiles:t,currentTasks:n,totalTasks:r}:null)}}),Z=f(async()=>{if(A){if(!await Y(b(`pageClient.switchToPostConfirm`)))return;j(``),N(``),F(``),L(0),V(0),R(``),B(``)}if(O.length>=d){_.error(b(`pageClient.maxMaterialCount`));return}let e=await X(`material`,{maxMaterialCount:d-O.length});!e||e.type!==`material`||(e.errors.length>0&&_.error(e.errors.length===1?e.errors[0]:b(`pageClient.uploadFailedCount`,{count:e.errors.length})),e.items.length>0&&k(t=>[...t,...e.items].slice(0,d)))},[Y,O.length,X,B,N,F,k,R,L,V,j,b,A]),Ee=f(async()=>{if(O.length>0){if(!await Y(b(`pageClient.switchToVideoConfirm`)))return;k([])}let e=await X(`video`);!e||e.type!==`video`||(j(e.videoUrl),N(e.coverUrl),F(e.coverUrl),R(e.resolution),B(e.coverImageResolution),L(e.videoDuration),V(e.videoSize))},[Y,O.length,X,B,N,F,k,R,L,V,j,b]);function De(e){S(e)}function Oe(){S(!1)}let Q=_e(()=>(H.trim()===``||H.trim()===`<br>`)&&O.length===0&&!A,[H,O.length,A]),$=s(),ke=f(()=>{$.open(O.map(e=>({src:e.media_url,type:e.is_video?`video`:`image`,cover:e.cover_image})))},[O,$]),Ae=f(e=>{k(t=>t.filter((t,n)=>n!==e))},[k]),je=f(()=>{j(``),N(``),F(``),L(0),V(0),R(``),B(``)},[N,F,B,R,L,V,j]),Me=f(async()=>{let e=await X(`cover`);!e||e.type!==`cover`||(N(e.coverUrl),B(e.coverImageResolution))},[X,B,N]),Ne=f(e=>{S(!1),G(t=>[...t,e]),x.current?.restoreSelection();let t=`${ie(e)}&nbsp;`;x.current?.insertHtml(t)},[G]),Pe=f(()=>{x.current?.saveSelection(),S(!0)},[]);return g(ce,{className:e(`relative min-h-screen max-w-full bg-bg2 overflow-hidden flex flex-col`,y),children:[h(fe,{onPublish:async()=>{if(!Se){K(!0);try{if(Q){_.error(b(`pageClient.editContentFirst`));return}let e=H;if(e=e.replace(/<br>/g,``),!e&&O.length===0&&!A){_.error(b(`pageClient.editContentFirst`));return}let t=ue(e,W),n={content:e,mentioned_users:t,collection_ids:C===`0`?[]:[C]};O.length>0?(n.medias=O.map(e=>(delete e.index,e)),n.type=1):A?(n.medias=[{media_url:A,is_video:!0,cover_image:M,video_resolution:be,cover_image_resolution:z,video_duration:I,video_size:xe}],n.type=2):n.type=3,await oe(n),_.success(b(`pageClient.publishSuccess`)),k([]),j(``),N(``),F(``),L(0),V(0),R(``),B(``),U(``),G([]),w(`0`),ve.back()}catch(e){console.error(e),_.error(b(`pageClient.publishFailed`))}finally{K(!1)}}},isEmpty:Q}),h(de,{ref:x,content:H,onContentChange:U,atUsers:W,onAtUsersChange:G}),E&&h(l,{currentFiles:E.currentFiles,totalFiles:E.totalFiles,currentTasks:E.currentTasks,totalTasks:E.totalTasks}),(O.length>0||A)&&h(pe,{materialList:O,videoUrl:A,videoDuration:I,coverUrl:M,originCoverUrl:P,isKeyboardOpen:T,onMaterialDelete:Ae,onVideoDelete:je,onMaterialAdd:Z,onCoverClick:Me,onPreview:ke}),h(me,{isKeyboardOpen:T,onMaterialClick:()=>void Z(),onVideoClick:()=>void Ee(),onAtUserClick:Pe}),h(le,{active:C,setActive:w}),h(t,{open:Ce,onOpenChange:e=>{q(e),e||(J.current?.(!1),J.current=null)},children:g(ee,{children:[g(re,{children:[h(i,{children:b(`pageClient.title`)}),h(te,{children:we})]}),g(ne,{children:[h(r,{onClick:()=>{q(!1),J.current?.(!1),J.current=null},children:b(`pageClient.cancel`)}),h(n,{onClick:()=>{q(!1),J.current?.(!0),J.current=null},children:b(`pageClient.resume`)})]})]})}),h(c,{open:ye,onOpenChange:De,showCloseButton:!1,className:`w-full rounded-[8px] bg-bg2`,children:h(u,{onSelect:Ne,onClose:Oe})})]})}export{y as PublishPageClient};
2
+ "use client";import{cn as e}from"../../../utils/cn.mjs";import{AlertDialog as t,AlertDialogAction as n,AlertDialogCancel as r,AlertDialogContent as i,AlertDialogDescription as ee,AlertDialogFooter as te,AlertDialogHeader as ne,AlertDialogTitle as re}from"../../ui/alert-dialog.mjs";import{getAtUserElement as ie}from"../../../utils/common.mjs";import ae from"../../../utils/event-bus.mjs";import{pCommunityPublishContent as oe}from"../../../service/generated/client.mjs";import{usePageLifecycle as se}from"../../../utils/tracking.mjs";import{useRouter as ce}from"../../../utils/use-compatible-router.mjs";import{Box as le}from"../../ui/box.mjs";import{useKeyboardOpen as ue}from"../../../hooks/use-keyboard-open.mjs";import{eventKey as a}from"../../../constants/event-key.mjs";import{useMediaPreview as o}from"../../common/media-preview/index.mjs";import s from"../../ui/popup.mjs";import{UploadProgress as c}from"./components/upload-progress.mjs";import{ContactList as l}from"../../biz/business/contact/contact-list.mjs";import{Collection as u}from"./components/collection.mjs";import{MAX_MATERIAL_COUNT as d}from"./constants.mjs";import{filterAtUserNames as f}from"./utils/publish-utils.mjs";import{PublishEditor as p}from"./components/editor.mjs";import{PublishHeader as de}from"./components/header.mjs";import{MaterialGrid as fe}from"./components/material-grid.mjs";import{Toolbar as pe}from"./components/toolbar.mjs";import{useFileUpload as me}from"./hooks/use-file-upload.mjs";import{useCallback as m,useEffect as he,useMemo as ge,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as _e}from"next-intl";function b({className:b}={}){let x=_e(`components.pages.publish`);se(`page_publish`,`发布`);let ve=ce(),S=h(null),[ye,C]=g(!1),[w,T]=g(`0`),{isOpen:E}=ue(),[D,O]=g(null),[k,A]=g([]),[j,M]=g(``),[N,P]=g(``),[be,F]=g(``),[I,L]=g(0),[xe,R]=g(``),[Se,z]=g(``),[Ce,B]=g(0),[V,H]=g(``),[U,W]=g([]),[we,G]=g(!1),[Te,K]=g(!1),[Ee,De]=g(``),q=h(null);he(()=>()=>{ae.emit(a.WAIT_LOADING_SHOW,{show:!1})},[]);let J=m(e=>(De(e),K(!0),new Promise(e=>{q.current=e})),[]),{selectFile:Y}=me({onProgressUpdate:(e,t,n,r)=>{O(r>0?{currentFiles:e,totalFiles:t,currentTasks:n,totalTasks:r}:null)}}),X=m(async()=>{if(j){if(!await J(x(`pageClient.switchToPostConfirm`)))return;M(``),P(``),F(``),L(0),B(0),R(``),z(``)}if(k.length>=d){y.error(x(`pageClient.maxMaterialCount`));return}let e=await Y(`material`,{maxMaterialCount:d-k.length});!e||e.type!==`material`||(e.errors.length>0&&y.error(e.errors.length===1?e.errors[0]:x(`pageClient.uploadFailedCount`,{count:e.errors.length})),e.items.length>0&&A(t=>[...t,...e.items].slice(0,d)))},[J,k.length,Y,z,P,F,A,R,L,B,M,x,j]),Oe=m(async()=>{if(k.length>0){if(!await J(x(`pageClient.switchToVideoConfirm`)))return;A([])}let e=await Y(`video`);!e||e.type!==`video`||(M(e.videoUrl),P(e.coverUrl),F(e.coverUrl),R(e.resolution),z(e.coverImageResolution),L(e.videoDuration),B(e.videoSize))},[J,k.length,Y,z,P,F,A,R,L,B,M,x]);function ke(e){C(e)}function Ae(){C(!1)}let Z=ge(()=>(V.trim()===``||V.trim()===`<br>`)&&k.length===0&&!j,[V,k.length,j]),Q=o(),$=m(()=>{Q.open(k.map(e=>({src:e.media_url,type:e.is_video?`video`:`image`,cover:e.cover_image})))},[k,Q]),je=m(e=>{A(t=>t.filter((t,n)=>n!==e))},[A]),Me=m(()=>{M(``),P(``),F(``),L(0),B(0),R(``),z(``)},[P,F,z,R,L,B,M]),Ne=m(async()=>{let e=await Y(`cover`);!e||e.type!==`cover`||(P(e.coverUrl),z(e.coverImageResolution))},[Y,z,P]),Pe=m(e=>{C(!1),W(t=>[...t,e]),S.current?.restoreSelection();let t=`${ie(e)}&nbsp;`;S.current?.insertHtml(t)},[W]),Fe=m(()=>{S.current?.saveSelection(),C(!0)},[]);return v(le,{className:e(`relative min-h-screen max-w-full bg-bg2 overflow-hidden flex flex-col`,b),children:[_(de,{onPublish:async()=>{if(!we){G(!0);try{if(Z){y.error(x(`pageClient.editContentFirst`));return}let e=V;if(e=e.replace(/<br>/g,``),!e&&k.length===0&&!j){y.error(x(`pageClient.editContentFirst`));return}let t=f(e,U),n={content:e,mentioned_users:t,collection_ids:w===`0`?[]:[w]};k.length>0?(n.medias=k.map(e=>(delete e.index,e)),n.type=1):j?(n.medias=[{media_url:j,is_video:!0,cover_image:N,video_resolution:xe,cover_image_resolution:Se,video_duration:I,video_size:Ce}],n.type=2):n.type=3,await oe(n),y.success(x(`pageClient.publishSuccess`)),A([]),M(``),P(``),F(``),L(0),B(0),R(``),z(``),H(``),W([]),T(`0`),ve.back()}catch(e){console.error(e),y.error(x(`pageClient.publishFailed`))}finally{G(!1)}}},isEmpty:Z}),_(p,{ref:S,content:V,onContentChange:H,atUsers:U,onAtUsersChange:W}),D&&_(c,{currentFiles:D.currentFiles,totalFiles:D.totalFiles,currentTasks:D.currentTasks,totalTasks:D.totalTasks}),(k.length>0||j)&&_(fe,{materialList:k,videoUrl:j,videoDuration:I,coverUrl:N,originCoverUrl:be,isKeyboardOpen:E,onMaterialDelete:je,onVideoDelete:Me,onMaterialAdd:X,onCoverClick:Ne,onPreview:$}),_(pe,{isKeyboardOpen:E,onMaterialClick:()=>void X(),onVideoClick:()=>void Oe(),onAtUserClick:Fe}),_(u,{active:w,setActive:T}),_(t,{open:Te,onOpenChange:e=>{K(e),e||(q.current?.(!1),q.current=null)},children:v(i,{children:[v(ne,{children:[_(re,{children:x(`pageClient.title`)}),_(ee,{children:Ee})]}),v(te,{children:[_(r,{onClick:()=>{K(!1),q.current?.(!1),q.current=null},children:x(`pageClient.cancel`)}),_(n,{onClick:()=>{K(!1),q.current?.(!0),q.current=null},children:x(`pageClient.resume`)})]})]})}),_(s,{open:ye,onOpenChange:ke,showCloseButton:!1,className:`w-full rounded-[8px] bg-bg2`,children:_(l,{onSelect:Pe,onClose:Ae})})]})}export{b as PublishPageClient};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{gCommunityGetHotContentList as t,gContentGetHotVideoList as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{Text as a}from"../../ui/text.mjs";import{Skeleton as o}from"../../ui/skeleton.mjs";import{useRequest as s}from"../../../hooks/query/use-query.mjs";import{getPostDetailPagePath as c}from"../../../utils/tools.mjs";import l from"../../common/at-element/index.mjs";import{useCardDecoration as u}from"../../../hooks/use-card-decoration.mjs";import d from"../../ui/rate.mjs";import f from"./style.module.mjs";import{memo as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{useTranslations as g}from"next-intl";import _ from"next/link";const v=p(({list:e})=>{let t=g(`components.pages.search`),{getCalculationScore:n}=u();return e.length===0?m(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(254,201,207,0.5) 0%, rgba(254,201,207,0.1) 100%)`,borderColor:`rgba(255,119,131,0.2)`},children:h(i,{children:[m(a,{className:`leading-[26px] block text-theme5 text-[18px] font-bold`,children:t(`hotRecommend.hotVideosTitle`)}),h(`div`,{className:`flex flex-col gap-[8px]`,children:[m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`})]})]})}):h(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(254,201,207,0.5) 0%, rgba(254,201,207,0.1) 100%)`,borderColor:`rgba(255,119,131,0.2)`},children:[m(a,{className:`leading-[26px] block text-theme5 text-[18px] font-bold`,children:t(`hotRecommend.hotVideosTitle`)}),e.map((e,t)=>h(_,{className:`w-full flex items-center justify-between mt-[12px] shrink-0`,href:c({id:e.video_id,contentType:0}),children:[h(i,{className:`w-[76px] h-[102px] rounded-[8px] overflow-hidden relative bg-bg2`,children:[m(r,{src:e.cover||``,fill:!0,alt:e.name||``,objectFit:`cover`}),m(i,{className:`w-[18px] h-[18px] rounded-tl-[8px] rounded-br-[8px] flex items-center justify-center overflow-hidden absolute left-0 top-0 z-[1]`,style:{background:t>2?`linear-gradient( 218deg, #909BB7 0%, #5D7198 100%)`:`linear-gradient( 175deg, #FD4C5E 0%, #F05D19 100%)`},children:m(a,{className:`text-[12px] leading-[12px] text-white`,children:t+1})})]}),h(i,{className:`flex-1 flex flex-col ml-[12px]`,children:[m(a,{className:`leading-[26px] text-text1 text-[18px] font-bold max-w-[200px] line-clamp-1 mb-[4px]`,children:e.name}),h(i,{className:`flex items-center`,style:{transform:`scale(0.6)`,transformOrigin:`left center`},children:[m(d,{allowHalf:!0,value:n({score:String(e.score??0)})}),m(a,{className:`ml-[8px] text-[24px] text-[#F59E0B] font-bold leading-[24px]`,children:e.score?(Number(e.score)/10).toFixed(1):0})]}),m(i,{className:`w-fit mt-[4px] h-[20px] leading-[20px] px-[6px] text-text2 text-[12px] bg-line1 rounded-[4px]`,children:e.cat_name})]})]},String(e.video_id??t)))]})}),y=p(({list:e})=>{let t=g(`components.pages.search`);return e.length===0?h(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(153,215,255,0.5) 0%, rgba(153,215,255,0.1) 100%)`,borderColor:`rgba(31,167,255,0.2)`},children:[m(a,{className:`leading-[26px] block text-theme1 text-[18px] font-bold mb-[4px]`,children:t(`hotRecommend.hotPostsTitle`)}),h(`div`,{className:`flex flex-col gap-[8px]`,children:[m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`}),m(o,{className:`w-full h-[28px] mt-[8px]`})]})]}):h(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(153,215,255,0.5) 0%, rgba(153,215,255,0.1) 100%)`,borderColor:`rgba(31,167,255,0.2)`},children:[m(a,{className:`leading-[26px] block text-theme1 text-[18px] font-bold mb-[4px]`,children:t(`hotRecommend.hotPostsTitle`)}),e.map((e,t)=>h(_,{className:`w-full h-[48px] mt-[8px] flex items-center`,href:c({id:e.content_id,contentType:1}),children:[h(a,{className:`text-[16px] leading-[24px] font-bold ${t<3?`text-theme1`:`text-text3`}`,children:[t+1,`.`]}),m(a,{className:`ml-[8px] text-[16px] text-text1 leading-[24px] line-clamp-1 max-w-[260px] ${f.hotInfoTitle}`,children:m(l,{text:e.title??``,atUsers:[]})})]},String(e.content_id??t)))]})});function b({isShow:r}){let{userInfo:a}=e(),{data:o}=s([`hotVideo`],()=>n({user_id:a.user_id})),c=o?.data?.hot_video_list??[],{data:l}=s([`hotContent`],()=>t({user_id:a.user_id})),u=l?.data?.hot_content_list??[];return r?h(i,{className:`w-full px-[12px] flex gap-x-[12px] flex-nowrap pb-[24px] ${f.gScrollBoxX}`,children:[m(v,{list:c}),m(y,{list:u})]}):null}export{b as default};
2
+ "use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{gCommunityGetHotContentList as t,gContentGetHotVideoList as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{Text as a}from"../../ui/text.mjs";import{Skeleton as o}from"../../ui/skeleton.mjs";import{useRequest as s}from"../../../hooks/query/use-query.mjs";import{getPostDetailPagePath as c}from"../../../utils/tools.mjs";import l from"../../common/at-element/index.mjs";import{useCardDecoration as u}from"../../../hooks/use-card-decoration.mjs";import d from"../../ui/rate.mjs";import f from"./style.module.mjs";import{trackSearchMediaRecommendClick as p}from"./tracking.mjs";import{memo as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useTranslations as _}from"next-intl";import v from"next/link";const y=m(({list:e})=>{let t=_(`components.pages.search`),{getCalculationScore:n}=u();return e.length===0?h(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(254,201,207,0.5) 0%, rgba(254,201,207,0.1) 100%)`,borderColor:`rgba(255,119,131,0.2)`},children:g(i,{children:[h(a,{className:`leading-[26px] block text-theme5 text-[18px] font-bold`,children:t(`hotRecommend.hotVideosTitle`)}),g(`div`,{className:`flex flex-col gap-[8px]`,children:[h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`})]})]})}):g(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(254,201,207,0.5) 0%, rgba(254,201,207,0.1) 100%)`,borderColor:`rgba(255,119,131,0.2)`},children:[h(a,{className:`leading-[26px] block text-theme5 text-[18px] font-bold`,children:t(`hotRecommend.hotVideosTitle`)}),e.map((e,t)=>g(v,{className:`w-full flex items-center justify-between mt-[12px] shrink-0`,href:c({id:e.video_id,contentType:0}),onClick:()=>{p(String(e.video_id??``))},children:[g(i,{className:`w-[76px] h-[102px] rounded-[8px] overflow-hidden relative bg-bg2`,children:[h(r,{src:e.cover||``,fill:!0,alt:e.name||``,objectFit:`cover`}),h(i,{className:`w-[18px] h-[18px] rounded-tl-[8px] rounded-br-[8px] flex items-center justify-center overflow-hidden absolute left-0 top-0 z-[1]`,style:{background:t>2?`linear-gradient( 218deg, #909BB7 0%, #5D7198 100%)`:`linear-gradient( 175deg, #FD4C5E 0%, #F05D19 100%)`},children:h(a,{className:`text-[12px] leading-[12px] text-white`,children:t+1})})]}),g(i,{className:`flex-1 flex flex-col ml-[12px]`,children:[h(a,{className:`leading-[26px] text-text1 text-[18px] font-bold max-w-[200px] line-clamp-1 mb-[4px]`,children:e.name}),g(i,{className:`flex items-center`,style:{transform:`scale(0.6)`,transformOrigin:`left center`},children:[h(d,{allowHalf:!0,value:n({score:String(e.score??0)})}),h(a,{className:`ml-[8px] text-[24px] text-[#F59E0B] font-bold leading-[24px]`,children:e.score?(Number(e.score)/10).toFixed(1):0})]}),h(i,{className:`w-fit mt-[4px] h-[20px] leading-[20px] px-[6px] text-text2 text-[12px] bg-line1 rounded-[4px]`,children:e.cat_name})]})]},String(e.video_id??t)))]})}),b=m(({list:e})=>{let t=_(`components.pages.search`);return e.length===0?g(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(153,215,255,0.5) 0%, rgba(153,215,255,0.1) 100%)`,borderColor:`rgba(31,167,255,0.2)`},children:[h(a,{className:`leading-[26px] block text-theme1 text-[18px] font-bold mb-[4px]`,children:t(`hotRecommend.hotPostsTitle`)}),g(`div`,{className:`flex flex-col gap-[8px]`,children:[h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`})]})]}):g(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(153,215,255,0.5) 0%, rgba(153,215,255,0.1) 100%)`,borderColor:`rgba(31,167,255,0.2)`},children:[h(a,{className:`leading-[26px] block text-theme1 text-[18px] font-bold mb-[4px]`,children:t(`hotRecommend.hotPostsTitle`)}),e.map((e,t)=>g(v,{className:`w-full h-[48px] mt-[8px] flex items-center`,href:c({id:e.content_id,contentType:1}),onClick:()=>{p(String(e.content_id??``))},children:[g(a,{className:`text-[16px] leading-[24px] font-bold ${t<3?`text-theme1`:`text-text3`}`,children:[t+1,`.`]}),h(a,{className:`ml-[8px] text-[16px] text-text1 leading-[24px] line-clamp-1 max-w-[260px] ${f.hotInfoTitle}`,children:h(l,{text:e.title??``,atUsers:[]})})]},String(e.content_id??t)))]})});function x({isShow:r}){let{userInfo:a}=e(),{data:o}=s([`hotVideo`],()=>n({user_id:a.user_id})),c=o?.data?.hot_video_list??[],{data:l}=s([`hotContent`],()=>t({user_id:a.user_id})),u=l?.data?.hot_content_list??[];return r?g(i,{className:`w-full px-[12px] flex gap-x-[12px] flex-nowrap pb-[24px] ${f.gScrollBoxX}`,children:[h(y,{list:c}),h(b,{list:u})]}):null}export{x as default};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetRecommendSearchList as r}from"../../../service/generated/client.mjs";import{useRouter as i}from"../../../utils/use-compatible-router.mjs";import{Box as a}from"../../ui/box.mjs";import{Popover as o,PopoverContent as s,PopoverTrigger as c}from"../../ui/popover.mjs";import{useRequest as l}from"../../../hooks/query/use-query.mjs";import{eventKey as u}from"../../../constants/event-key.mjs";import{useSearchHistory as d}from"../../../hooks/use-search-history.mjs";import{SearchHistoryClient as f}from"../../biz/business/search-history/client.mjs";import p from"../../../assets/icons/search/filter.mjs";import m from"./hot-recommend.mjs";import h from"./hot-search.mjs";import{SEARCH_RESULT_SORT_OPTIONS as g}from"./search-result/shared.mjs";import _ from"./search-result/index.mjs";import v from"./top-header.mjs";import{memo as y,useEffect as b,useMemo as x,useState as S}from"react";import{jsx as C,jsxs as w}from"react/jsx-runtime";import{usePathname as T,useSearchParams as E}from"next/navigation";import{useTranslations as D}from"next-intl";const O=[{labelKey:`tabs.all`,value:`all`},{labelKey:`tabs.video`,value:`video`},{labelKey:`tabs.user`,value:`user`}],k=y(({searchType:e,sort:t,tabList:n,onChange:r,onSortChange:i})=>{let[l,u]=S(!1);return w(a,{as:`nav`,className:`sticky top-[66px] z-40 flex items-center justify-between bg-[linear-gradient(180deg,rgba(6,3,21,0.98)_0%,rgba(6,3,21,0.88)_100%)] px-[16px] pb-[24px] pt-[23px] backdrop-blur-[16px]`,children:[C(a,{className:`flex items-center gap-[10px]`,children:n.map(t=>C(`button`,{type:`button`,className:`text-[16px] leading-[22px] transition-colors ${e===t.value?`font-medium text-white`:`font-normal text-white/80`}`,onClick:()=>{e!==t.value&&r(t.value)},children:t.label},t.value))}),w(o,{open:l,onOpenChange:u,children:[C(c,{"aria-label":`排序筛选`,className:`flex size-[24px] items-center justify-center text-white/70`,children:C(p,{className:`size-[20px]`})}),C(s,{side:`bottom`,align:`end`,sideOffset:8,className:`w-[132px] border border-white/10 bg-[#10071E]/95 p-[8px] backdrop-blur-[18px]`,children:C(a,{className:`flex flex-col gap-[4px]`,children:g.map(e=>C(`button`,{type:`button`,className:`rounded-[8px] px-[12px] py-[8px] text-left text-[14px] leading-[20px] ${e.value===t?`bg-white/10 text-white`:`text-white/70`}`,onClick:()=>{i(e.value),u(!1)},children:e.label},e.value))})})]})]})});k.displayName=`SearchResultTabs`;function A(){let o=D(`components.pages.search.pageClient`),{userInfo:s}=n(),c=s?.user_id||`guest`,p=E(),y=T(),A=i(),j=p.get(`q`)?.toString()||``,{data:M,refetch:N}=l([`hotSearchKey`],()=>r({user_id:c})),P=x(()=>M?.data?.recommend_list??[],[M]),[F,I]=S(j),[L,R]=S(j),[z,B]=S(0),[V,H]=S(O[0].value),[U,W]=S(g[0].value),[G,K]=S(0),{history:q,addHistory:J}=d({storageKey:c}),Y=x(()=>O.map(e=>({value:e.value,label:o(e.labelKey)})),[o]),X=x(()=>F.trim()===``?P.length>0||q.length>0||F.trim()===``:!1,[q.length,P.length,F]),Z=x(()=>F.trim()!==``&&!X,[F,X]);return b(()=>(t.on(u.EXCHANGE_SEARCH_TYPE,H),()=>{t.off(u.EXCHANGE_SEARCH_TYPE,H)}),[]),w(a,{className:`min-h-screen w-full bg-[radial-gradient(79.9%_42.18%_at_50%_0%,rgba(71,20,126,0.95)_0%,rgba(14,6,32,0.98)_42%,#05010F_100%)] pb-[24px]`,children:[C(v,{setSearchInputVal:t=>{t!==F&&(I(t),e({q:t}))},initInputVal:L,initInputVersion:z,addSearchHistory:J}),X&&w(a,{className:`w-full pt-[8px]`,children:[q.length>0&&C(f,{title:o(`searchHistory`),rows:2,storageKey:c,onHistoryClick:e=>{R(e),B(e=>e+1);let t=new URLSearchParams(p.toString());t.set(`q`,e),A.push(`${y}?${t.toString()}`)}}),C(h,{initHotSearchKeywordList:P,onRefreshHotKey:async()=>(await N()).data??{code:0,message:``,data:{recommend_list:[]}},onClick:e=>{R(e.title||``),B(e=>e+1),J(e.title)}})]}),C(m,{isShow:F.trim()===``}),Z&&w(a,{className:`relative mt-[8px] min-h-[calc(100vh-74px)] overflow-hidden rounded-t-[16px] bg-[linear-gradient(180deg,rgba(6,3,21,0.9)_19.905%,rgba(6,3,21,0)_100%)] backdrop-blur-[2px]`,children:[C(k,{searchType:V,sort:U,tabList:Y,onChange:e=>{H(e)},onSortChange:e=>{W(e),K(e=>e+1)}}),C(_,{inputVal:F,searchType:V,sort:U,refreshVersion:G},`${V}-${F}-${U}-${G}`)]})]})}export{A as default};
2
+ "use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetRecommendSearchList as r}from"../../../service/generated/client.mjs";import{usePageLifecycle as i}from"../../../utils/tracking.mjs";import{useRouter as a}from"../../../utils/use-compatible-router.mjs";import{Box as o}from"../../ui/box.mjs";import{Popover as s,PopoverContent as c,PopoverTrigger as l}from"../../ui/popover.mjs";import{useRequest as u}from"../../../hooks/query/use-query.mjs";import{eventKey as d}from"../../../constants/event-key.mjs";import{useSearchHistory as ee}from"../../../hooks/use-search-history.mjs";import{SearchHistoryClient as f}from"../../biz/business/search-history/client.mjs";import p from"../../../assets/icons/search/filter.mjs";import{trackSearchResultPageView as te}from"../search-result/tracking.mjs";import{trackSearchPageView as m,trackSearchTextRecommendClick as h}from"./tracking.mjs";import g from"./hot-recommend.mjs";import _ from"./hot-search.mjs";import{SEARCH_RESULT_SORT_OPTIONS as v}from"./search-result/shared.mjs";import y from"./search-result/index.mjs";import b from"./top-header.mjs";import{memo as x,useEffect as S,useMemo as C,useRef as w,useState as T}from"react";import{jsx as E,jsxs as D}from"react/jsx-runtime";import{usePathname as O,useSearchParams as k}from"next/navigation";import{useTranslations as A}from"next-intl";const j=[{labelKey:`tabs.all`,value:`all`},{labelKey:`tabs.video`,value:`video`},{labelKey:`tabs.user`,value:`user`}],M=x(({searchType:e,sort:t,tabList:n,onChange:r,onSortChange:i})=>{let[a,u]=T(!1);return D(o,{as:`nav`,className:`sticky top-[66px] z-40 flex items-center justify-between bg-[linear-gradient(180deg,rgba(6,3,21,0.98)_0%,rgba(6,3,21,0.88)_100%)] px-[16px] pb-[24px] pt-[23px] backdrop-blur-[16px]`,children:[E(o,{className:`flex items-center gap-[10px]`,children:n.map(t=>E(`button`,{type:`button`,className:`text-[16px] leading-[22px] transition-colors ${e===t.value?`font-medium text-white`:`font-normal text-white/80`}`,onClick:()=>{e!==t.value&&r(t.value)},children:t.label},t.value))}),D(s,{open:a,onOpenChange:u,children:[E(l,{"aria-label":`排序筛选`,className:`flex size-[24px] items-center justify-center text-white/70`,children:E(p,{className:`size-[20px]`})}),E(c,{side:`bottom`,align:`end`,sideOffset:8,className:`w-[132px] border border-white/10 bg-[#10071E]/95 p-[8px] backdrop-blur-[18px]`,children:E(o,{className:`flex flex-col gap-[4px]`,children:v.map(e=>E(`button`,{type:`button`,className:`rounded-[8px] px-[12px] py-[8px] text-left text-[14px] leading-[20px] ${e.value===t?`bg-white/10 text-white`:`text-white/70`}`,onClick:()=>{i(e.value),u(!1)},children:e.label},e.value))})})]})]})});M.displayName=`SearchResultTabs`;function N(){let s=A(`components.pages.search.pageClient`);i(`page_search`,`搜索`);let{userInfo:c}=n(),l=c?.user_id||`guest`,p=k(),x=O(),N=a(),P=p.get(`q`)?.toString()||``,{data:F,refetch:ne}=u([`hotSearchKey`],()=>r({user_id:l})),I=C(()=>F?.data?.recommend_list??[],[F]),[L,R]=T(P),[z,B]=T(P),[V,H]=T(0),[U,W]=T(j[0].value),[G,K]=T(v[0].value),[q,J]=T(0),{history:Y,addHistory:X}=ee({storageKey:l}),re=C(()=>j.map(e=>({value:e.value,label:s(e.labelKey)})),[s]),Z=C(()=>L.trim()===``?I.length>0||Y.length>0||L.trim()===``:!1,[Y.length,I.length,L]),Q=C(()=>L.trim()!==``&&!Z,[L,Z]);S(()=>(t.on(d.EXCHANGE_SEARCH_TYPE,W),()=>{t.off(d.EXCHANGE_SEARCH_TYPE,W)}),[]),S(()=>{m()},[]);let $=w(L);return $.current=L,S(()=>{Q&&te(U,$.current)},[Q,U]),D(o,{className:`min-h-screen w-full bg-[radial-gradient(79.9%_42.18%_at_50%_0%,rgba(71,20,126,0.95)_0%,rgba(14,6,32,0.98)_42%,#05010F_100%)] pb-[24px]`,children:[E(b,{setSearchInputVal:t=>{t!==L&&(R(t),e({q:t}))},initInputVal:z,initInputVersion:V,addSearchHistory:X}),Z&&D(o,{className:`w-full pt-[8px]`,children:[Y.length>0&&E(f,{title:s(`searchHistory`),rows:2,storageKey:l,onHistoryClick:e=>{B(e),H(e=>e+1);let t=new URLSearchParams(p.toString());t.set(`q`,e),N.push(`${x}?${t.toString()}`)}}),E(_,{initHotSearchKeywordList:I,onRefreshHotKey:async()=>(await ne()).data??{code:0,message:``,data:{recommend_list:[]}},onClick:e=>{h(e.title||``,e.trace_id||``,e.trace_info||``),B(e.title||``),H(e=>e+1),X(e.title)}})]}),E(g,{isShow:L.trim()===``}),Q&&D(o,{className:`relative mt-[8px] min-h-[calc(100vh-74px)] overflow-hidden rounded-t-[16px] bg-[linear-gradient(180deg,rgba(6,3,21,0.9)_19.905%,rgba(6,3,21,0)_100%)] backdrop-blur-[2px]`,children:[E(M,{searchType:U,sort:G,tabList:re,onChange:e=>{W(e)},onSortChange:e=>{K(e),J(e=>e+1)}}),E(y,{inputVal:L,searchType:U,sort:G,refreshVersion:q},`${U}-${L}-${G}-${q}`)]})]})}export{N as default};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{useUserStore as e}from"../../../../store/modules/user-store.mjs";import{gContentGetRecommendVideoList as t,pInteractionFollow as n,pInteractionUnfollow as r}from"../../../../service/generated/client.mjs";import{Image as i}from"../../../ui/image.mjs";import{Box as a}from"../../../ui/box.mjs";import{EmptyState as o}from"../../../ui/empty.mjs";import{InfiniteScroll as s}from"../../../ui/infinite-scroll.mjs";import{Text as c}from"../../../ui/text.mjs";import{Skeleton as l}from"../../../ui/skeleton.mjs";import{usePaginated as u}from"../../../../hooks/query/use-query.mjs";import{useRequireLogin as d}from"../../../../hooks/use-auth.mjs";import f from"../../../../assets/images/user/default_avatar.mjs";import{formatSearchFollowerCount as p,resolveSearchUserDescription as m,resolveSearchUserName as h}from"./shared.mjs";import{memo as g,useCallback as _,useEffect as v,useMemo as y,useState as b}from"react";import{Check as x,Plus as S}from"lucide-react";import{jsx as C,jsxs as w}from"react/jsx-runtime";import{toast as T}from"sonner";import{useTranslations as E}from"next-intl";import D from"next/link";const O=typeof f==`string`?f:f.src;function k(e,t){return String(t||e?.user_id||e?.userId||``).trim()}function A({src:e,alt:t,variant:n}){let r=n===`row`?`size-[56px] p-[4px]`:`size-[40px] p-[3px]`,o=n===`row`?`border-[3px]`:`border-[2px]`;return C(a,{className:`rounded-full bg-white/20 ${r}`,children:C(a,{className:`relative size-full overflow-hidden rounded-full border-solid border-white/40 ${o}`,children:C(i,{src:e||O,fill:!0,objectFit:`cover`,alt:t})})})}function j({item:t,variant:i,onFollowChange:a}){let o=d(),{userInfo:s,userId:l}=e(),[u,f]=b(!1),p=k(s,l),m=p!==``&&p===String(t.user_id||``).trim(),h=!!t.is_following,g=_(()=>{!t.user_id||u||o(()=>{let i=k(e.getState().userInfo,e.getState().userId);if(!i){T.error(`请先登录`);return}(async()=>{f(!0);try{let e=h?await r({follower_id:i,followee_id:t.user_id}):await n({follower_id:i,followee_id:t.user_id});if(e.code!==0){T.error(e.message||(h?`取消关注失败`:`关注失败`));return}a?.(!h)}catch(e){console.error(`切换关注状态失败`,e),T.error(h?`取消关注失败`:`关注失败`)}finally{f(!1)}})()})},[h,t.user_id,a,u,o]);return m?null:i===`grid`?C(`button`,{type:`button`,"aria-label":h?`取消关注`:`关注`,className:`flex size-[24px] shrink-0 items-center justify-center rounded-full transition-opacity ${h?`bg-white/15 text-white`:`bg-black/30 text-white/75`} ${u?`opacity-50`:``}`,onClick:g,children:C(h?x:S,{className:`size-[14px]`})}):w(`button`,{type:`button`,className:`flex h-[24px] shrink-0 items-center justify-center rounded-full transition-opacity ${h?`border border-white/25 bg-white/10 px-[8px] text-white/85`:`border border-white/60 bg-black/20 pl-[4px] pr-[8px] text-white/70`} ${u?`opacity-50`:``}`,onClick:g,children:[!h&&C(S,{className:`mr-[2px] size-[16px]`}),C(c,{className:h?`text-[12px] leading-[18px]`:`text-[14px] leading-[20px]`,children:h?`已关注`:`关注`})]})}const M=g(({item:e,onFollowChange:t})=>{let n=h(e),r=m(e),i=p(e.follower_count);return w(a,{className:`flex h-[88px] w-full items-center gap-[8px] rounded-[8px] bg-white/10 px-[12px] py-[8px]`,children:[w(D,{href:`/profile/${e.user_id||``}`,className:`flex min-w-0 flex-1 items-center gap-[8px]`,children:[C(A,{src:e.avatar,alt:n||`用户头像`,variant:`row`}),w(a,{className:`min-w-0 flex-1`,children:[C(c,{className:`block truncate text-[14px] leading-[20px] font-medium text-white`,children:n}),C(c,{className:`mt-[2px] block truncate text-[14px] leading-[20px] text-white/60`,children:r}),w(c,{className:`mt-[2px] block truncate text-[14px] leading-[20px] text-white/60`,children:[`粉丝:`,i]})]})]}),C(j,{item:e,variant:`row`,onFollowChange:t})]})});M.displayName=`SearchUserRowCard`;const N=g(({item:e,onFollowChange:t})=>{let n=h(e),r=m(e);return w(a,{className:`h-[170px] rounded-[8px] bg-white/10 px-[16px] py-[16px]`,children:[w(a,{className:`flex items-start justify-between`,children:[C(D,{href:`/profile/${e.user_id||``}`,className:`flex items-center`,children:C(A,{src:e.avatar,alt:n||`用户头像`,variant:`grid`})}),C(j,{item:e,variant:`grid`,onFollowChange:t})]}),w(D,{href:`/profile/${e.user_id||``}`,className:`mt-[16px] block`,children:[C(c,{className:`block truncate text-[14px] leading-[20px] font-medium text-white`,children:n}),C(c,{className:`mt-[8px] block text-[14px] leading-[20px] text-white/60 line-clamp-4`,children:r})]})]})});N.displayName=`SearchUserGridCard`;function P(){return C(a,{className:`grid grid-cols-2 gap-[16px] px-[16px]`,children:Array.from({length:6}).map((e,t)=>w(a,{className:`h-[170px] rounded-[8px] bg-white/8 px-[16px] py-[16px]`,children:[w(a,{className:`flex items-start justify-between`,children:[C(l,{className:`size-[40px] rounded-full bg-white/10`}),C(l,{className:`size-[24px] rounded-full bg-white/10`})]}),C(l,{className:`mt-[16px] h-[20px] w-[86px] rounded-[4px] bg-white/10`}),C(l,{className:`mt-[8px] h-[20px] w-full rounded-[4px] bg-white/10`}),C(l,{className:`mt-[6px] h-[20px] w-[90%] rounded-[4px] bg-white/10`}),C(l,{className:`mt-[6px] h-[20px] w-[72%] rounded-[4px] bg-white/10`})]},`search-user-grid-skeleton-${t}`))})}const F=g(({inputVal:e,sort:n,refreshVersion:r})=>{let i=E(`components.pages.search.searchResult`),[c,l]=b({});v(()=>{l({})},[e,r,n]);let d=_(async r=>await t({data_type:2,extra_params:JSON.stringify({type:4,keywords:e,sort:n}),page:r||1,page_size:20}),[e,n]),f=u({key:y(()=>[`search-result`,`user`,e,n,r],[e,r,n]),initialPageParam:1,async queryFn(e){return(await d(e))?.data?.users??{has_more:!1,total:0,list:[]}},getNextPageParam(e,t){if(e.has_more)return t.length+1}}),p=y(()=>(f.data?.pages??[]).flatMap(e=>e.list??[]).map(e=>{let t=String(e.user_id||``).trim();return!t||c[t]===void 0?e:{...e,is_following:c[t]}}),[c,f.data?.pages]),m=!!((f.isPending||f.isFetching)&&p.length===0),h=_((e,t)=>{e&&l(n=>({...n,[e]:t?1:0}))},[]),g=_(async()=>{try{await f.fetchNextPage()}catch(e){console.error(`获取用户搜索结果失败`,e)}},[f]);return m?C(P,{}):p.length===0?C(o,{type:`nodata`,text:i(`searchUser.emptyResult`),className:`!pt-[72px]`}):w(a,{className:`w-full pb-[24px]`,children:[C(a,{className:`grid grid-cols-2 gap-[16px] px-[16px]`,children:p.map((e,t)=>C(N,{item:e,onFollowChange:t=>{h(String(e.user_id||``),t)}},String(e.user_id??t)))}),f.hasNextPage&&C(s,{loadMore:async e=>g(),hasMore:f.hasNextPage,className:`w-full`})]})});F.displayName=`SearchUser`;export{M as SearchUserRowCard,F as default};
2
+ "use client";import{useUserStore as e}from"../../../../store/modules/user-store.mjs";import{gContentGetRecommendVideoList as t,pInteractionFollow as n,pInteractionUnfollow as r}from"../../../../service/generated/client.mjs";import{Image as i}from"../../../ui/image.mjs";import{Box as a}from"../../../ui/box.mjs";import{EmptyState as o}from"../../../ui/empty.mjs";import{InfiniteScroll as s}from"../../../ui/infinite-scroll.mjs";import{Text as c}from"../../../ui/text.mjs";import{Skeleton as l}from"../../../ui/skeleton.mjs";import{usePaginated as u}from"../../../../hooks/query/use-query.mjs";import{useRequireLogin as d}from"../../../../hooks/use-auth.mjs";import{trackSearchResultClick as f}from"../../search-result/tracking.mjs";import p from"../../../../assets/images/user/default_avatar.mjs";import{formatSearchFollowerCount as m,resolveSearchUserDescription as h,resolveSearchUserName as g}from"./shared.mjs";import{memo as _,useCallback as v,useEffect as y,useMemo as b,useState as x}from"react";import{Check as S,Plus as C}from"lucide-react";import{jsx as w,jsxs as T}from"react/jsx-runtime";import{toast as E}from"sonner";import{useTranslations as D}from"next-intl";import O from"next/link";const k=typeof p==`string`?p:p.src;function A(e,t){return String(t||e?.user_id||e?.userId||``).trim()}function j({src:e,alt:t,variant:n}){let r=n===`row`?`size-[56px] p-[4px]`:`size-[40px] p-[3px]`,o=n===`row`?`border-[3px]`:`border-[2px]`;return w(a,{className:`rounded-full bg-white/20 ${r}`,children:w(a,{className:`relative size-full overflow-hidden rounded-full border-solid border-white/40 ${o}`,children:w(i,{src:e||k,fill:!0,objectFit:`cover`,alt:t})})})}function M({item:t,variant:i,onFollowChange:a}){let o=d(),{userInfo:s,userId:l}=e(),[u,f]=x(!1),p=A(s,l),m=p!==``&&p===String(t.user_id||``).trim(),h=!!t.is_following,g=v(()=>{!t.user_id||u||o(()=>{let i=A(e.getState().userInfo,e.getState().userId);if(!i){E.error(`请先登录`);return}(async()=>{f(!0);try{let e=h?await r({follower_id:i,followee_id:t.user_id}):await n({follower_id:i,followee_id:t.user_id});if(e.code!==0){E.error(e.message||(h?`取消关注失败`:`关注失败`));return}a?.(!h)}catch(e){console.error(`切换关注状态失败`,e),E.error(h?`取消关注失败`:`关注失败`)}finally{f(!1)}})()})},[h,t.user_id,a,u,o]);return m?null:i===`grid`?w(`button`,{type:`button`,"aria-label":h?`取消关注`:`关注`,className:`flex size-[24px] shrink-0 items-center justify-center rounded-full transition-opacity ${h?`bg-white/15 text-white`:`bg-black/30 text-white/75`} ${u?`opacity-50`:``}`,onClick:g,children:w(h?S:C,{className:`size-[14px]`})}):T(`button`,{type:`button`,className:`flex h-[24px] shrink-0 items-center justify-center rounded-full transition-opacity ${h?`border border-white/25 bg-white/10 px-[8px] text-white/85`:`border border-white/60 bg-black/20 pl-[4px] pr-[8px] text-white/70`} ${u?`opacity-50`:``}`,onClick:g,children:[!h&&w(C,{className:`mr-[2px] size-[16px]`}),w(c,{className:h?`text-[12px] leading-[18px]`:`text-[14px] leading-[20px]`,children:h?`已关注`:`关注`})]})}const N=_(({item:e,onFollowChange:t})=>{let n=g(e),r=h(e),i=m(e.follower_count);return T(a,{className:`flex h-[88px] w-full items-center gap-[8px] rounded-[8px] bg-white/10 px-[12px] py-[8px]`,children:[T(O,{href:`/profile/${e.user_id||``}`,className:`flex min-w-0 flex-1 items-center gap-[8px]`,onClick:t=>{f(t,String(e.user_id??``),`user`)},children:[w(j,{src:e.avatar,alt:n||`用户头像`,variant:`row`}),T(a,{className:`min-w-0 flex-1`,children:[w(c,{className:`block truncate text-[14px] leading-[20px] font-medium text-white`,children:n}),w(c,{className:`mt-[2px] block truncate text-[14px] leading-[20px] text-white/60`,children:r}),T(c,{className:`mt-[2px] block truncate text-[14px] leading-[20px] text-white/60`,children:[`粉丝:`,i]})]})]}),w(M,{item:e,variant:`row`,onFollowChange:t})]})});N.displayName=`SearchUserRowCard`;const P=_(({item:e,onFollowChange:t})=>{let n=g(e),r=h(e);return T(a,{className:`h-[170px] rounded-[8px] bg-white/10 px-[16px] py-[16px]`,children:[T(a,{className:`flex items-start justify-between`,children:[w(O,{href:`/profile/${e.user_id||``}`,className:`flex items-center`,onClick:t=>{f(t,String(e.user_id??``),`user`)},children:w(j,{src:e.avatar,alt:n||`用户头像`,variant:`grid`})}),w(M,{item:e,variant:`grid`,onFollowChange:t})]}),T(O,{href:`/profile/${e.user_id||``}`,className:`mt-[16px] block`,children:[w(c,{className:`block truncate text-[14px] leading-[20px] font-medium text-white`,children:n}),w(c,{className:`mt-[8px] block text-[14px] leading-[20px] text-white/60 line-clamp-4`,children:r})]})]})});P.displayName=`SearchUserGridCard`;function F(){return w(a,{className:`grid grid-cols-2 gap-[16px] px-[16px]`,children:Array.from({length:6}).map((e,t)=>T(a,{className:`h-[170px] rounded-[8px] bg-white/8 px-[16px] py-[16px]`,children:[T(a,{className:`flex items-start justify-between`,children:[w(l,{className:`size-[40px] rounded-full bg-white/10`}),w(l,{className:`size-[24px] rounded-full bg-white/10`})]}),w(l,{className:`mt-[16px] h-[20px] w-[86px] rounded-[4px] bg-white/10`}),w(l,{className:`mt-[8px] h-[20px] w-full rounded-[4px] bg-white/10`}),w(l,{className:`mt-[6px] h-[20px] w-[90%] rounded-[4px] bg-white/10`}),w(l,{className:`mt-[6px] h-[20px] w-[72%] rounded-[4px] bg-white/10`})]},`search-user-grid-skeleton-${t}`))})}const I=_(({inputVal:e,sort:n,refreshVersion:r})=>{let i=D(`components.pages.search.searchResult`),[c,l]=x({});y(()=>{l({})},[e,r,n]);let d=v(async r=>await t({data_type:2,extra_params:JSON.stringify({type:4,keywords:e,sort:n}),page:r||1,page_size:20}),[e,n]),f=u({key:b(()=>[`search-result`,`user`,e,n,r],[e,r,n]),initialPageParam:1,async queryFn(e){return(await d(e))?.data?.users??{has_more:!1,total:0,list:[]}},getNextPageParam(e,t){if(e.has_more)return t.length+1}}),p=b(()=>(f.data?.pages??[]).flatMap(e=>e.list??[]).map(e=>{let t=String(e.user_id||``).trim();return!t||c[t]===void 0?e:{...e,is_following:c[t]}}),[c,f.data?.pages]),m=!!((f.isPending||f.isFetching)&&p.length===0),h=v((e,t)=>{e&&l(n=>({...n,[e]:t?1:0}))},[]),g=v(async()=>{try{await f.fetchNextPage()}catch(e){console.error(`获取用户搜索结果失败`,e)}},[f]);return m?w(F,{}):p.length===0?w(o,{type:`nodata`,text:i(`searchUser.emptyResult`),className:`!pt-[72px]`}):T(a,{className:`w-full pb-[24px]`,children:[w(a,{className:`grid grid-cols-2 gap-[16px] px-[16px]`,children:p.map((e,t)=>w(P,{item:e,onFollowChange:t=>{h(String(e.user_id||``),t)}},String(e.user_id??t)))}),f.hasNextPage&&w(s,{loadMore:async e=>g(),hasMore:f.hasNextPage,className:`w-full`})]})});I.displayName=`SearchUser`;export{N as SearchUserRowCard,I as default};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{gContentGetRecommendVideoList as e}from"../../../../service/generated/client.mjs";import{Box as t}from"../../../ui/box.mjs";import{EmptyState as n}from"../../../ui/empty.mjs";import{InfiniteScroll as r}from"../../../ui/infinite-scroll.mjs";import{Skeleton as i}from"../../../ui/skeleton.mjs";import{usePaginated as a}from"../../../../hooks/query/use-query.mjs";import o from"../../../../assets/icons/common/right_arrow_thin.mjs";import{WaterfallRecommend as s}from"../../../common/list/waterfall-recommend/waterfall-recommend.mjs";import{buildSearchVideoWaterfallColumns as c}from"./shared.mjs";import{memo as l,useCallback as u,useMemo as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{useTranslations as m}from"next-intl";function h(){return p(t,{className:`flex w-full gap-[15px] px-[16px]`,children:[p(t,{className:`flex min-w-0 flex-1 flex-col gap-[16px]`,children:[f(i,{className:`h-[218px] w-full rounded-[8px] bg-white/8`}),f(i,{className:`h-[120px] w-full rounded-[8px] bg-white/8`}),f(i,{className:`h-[218px] w-full rounded-[8px] bg-white/8`})]}),p(t,{className:`flex min-w-0 flex-1 flex-col gap-[16px]`,children:[f(i,{className:`h-[120px] w-full rounded-[8px] bg-white/8`}),f(i,{className:`h-[218px] w-full rounded-[8px] bg-white/8`}),f(i,{className:`h-[120px] w-full rounded-[8px] bg-white/8`})]})]})}const g=l(({list:e,title:t,onMoreClick:n,sectionClassName:r=`w-full`})=>{let i=d(()=>c(e),[e]),a=!!t;return e.length===0?null:f(s,{title:t||``,columns:i,sectionClassName:r,headerClassName:a?`mb-[16px] flex items-center justify-between px-[16px]`:`hidden`,titleClassName:`min-w-0 flex-1 text-[18px] leading-[24px] font-medium text-white`,moreLinkClassName:`ml-[8px] flex size-[24px] shrink-0 items-center justify-center text-white/50`,moreIcon:a&&n?f(o,{className:`size-[16px]`}):void 0,onMoreClick:n,containerClassName:`relative flex w-full gap-[15px] px-[16px]`})});g.displayName=`SearchVideoWaterfall`;const _=l(({inputVal:i,sort:o,refreshVersion:s})=>{let c=m(`components.pages.search.searchResult`),l=u(async t=>await e({data_type:2,extra_params:JSON.stringify({type:3,keywords:i,sort:o}),page:t||1,page_size:20}),[i,o]),_=a({key:d(()=>[`search-result`,`video`,i,o,s],[i,s,o]),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}}),v=d(()=>(_.data?.pages??[]).flatMap(e=>e.list??[]),[_.data?.pages]),y=!!((_.isPending||_.isFetching)&&v.length===0),b=u(async()=>{try{await _.fetchNextPage()}catch(e){console.error(`获取视频搜索结果失败`,e)}},[_]);return y?f(h,{}):v.length===0?f(n,{type:`nodata`,text:c(`searchVideoInfo.noRelevantContent`),className:`!pt-[72px]`}):p(t,{className:`w-full pb-[24px]`,children:[f(g,{list:v}),_.hasNextPage&&f(r,{loadMore:async e=>b(),hasMore:_.hasNextPage,className:`w-full`})]})});_.displayName=`SearchVideoInfo`;export{g as SearchVideoWaterfall,_ as default};
2
+ "use client";import{gContentGetRecommendVideoList as e}from"../../../../service/generated/client.mjs";import{Box as t}from"../../../ui/box.mjs";import{EmptyState as n}from"../../../ui/empty.mjs";import{InfiniteScroll as r}from"../../../ui/infinite-scroll.mjs";import{Skeleton as i}from"../../../ui/skeleton.mjs";import{usePaginated as a}from"../../../../hooks/query/use-query.mjs";import o from"../../../../assets/icons/common/right_arrow_thin.mjs";import{WaterfallRecommend as s}from"../../../common/list/waterfall-recommend/waterfall-recommend.mjs";import{trackSearchResultClick as c}from"../../search-result/tracking.mjs";import{buildSearchVideoWaterfallColumns as l}from"./shared.mjs";import{memo as u,useCallback as d,useMemo as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{useTranslations as h}from"next-intl";function g(){return m(t,{className:`flex w-full gap-[15px] px-[16px]`,children:[m(t,{className:`flex min-w-0 flex-1 flex-col gap-[16px]`,children:[p(i,{className:`h-[218px] w-full rounded-[8px] bg-white/8`}),p(i,{className:`h-[120px] w-full rounded-[8px] bg-white/8`}),p(i,{className:`h-[218px] w-full rounded-[8px] bg-white/8`})]}),m(t,{className:`flex min-w-0 flex-1 flex-col gap-[16px]`,children:[p(i,{className:`h-[120px] w-full rounded-[8px] bg-white/8`}),p(i,{className:`h-[218px] w-full rounded-[8px] bg-white/8`}),p(i,{className:`h-[120px] w-full rounded-[8px] bg-white/8`})]})]})}const _=u(({list:e,title:t,onMoreClick:n,sectionClassName:r=`w-full`})=>{let i=f(()=>l(e),[e]),a=!!t;return e.length===0?null:p(s,{title:t||``,columns:i,sectionClassName:r,headerClassName:a?`mb-[16px] flex items-center justify-between px-[16px]`:`hidden`,titleClassName:`min-w-0 flex-1 text-[18px] leading-[24px] font-medium text-white`,moreLinkClassName:`ml-[8px] flex size-[24px] shrink-0 items-center justify-center text-white/50`,moreIcon:a&&n?p(o,{className:`size-[16px]`}):void 0,onMoreClick:n,containerClassName:`relative flex w-full gap-[15px] px-[16px]`,onItemClick:e=>{e.selectionId&&c(null,e.selectionId,`video`)}})});_.displayName=`SearchVideoWaterfall`;const v=u(({inputVal:i,sort:o,refreshVersion:s})=>{let c=h(`components.pages.search.searchResult`),l=d(async t=>await e({data_type:2,extra_params:JSON.stringify({type:3,keywords:i,sort:o}),page:t||1,page_size:20}),[i,o]),u=a({key:f(()=>[`search-result`,`video`,i,o,s],[i,s,o]),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}}),v=f(()=>(u.data?.pages??[]).flatMap(e=>e.list??[]),[u.data?.pages]),y=!!((u.isPending||u.isFetching)&&v.length===0),b=d(async()=>{try{await u.fetchNextPage()}catch(e){console.error(`获取视频搜索结果失败`,e)}},[u]);return y?p(g,{}):v.length===0?p(n,{type:`nodata`,text:c(`searchVideoInfo.noRelevantContent`),className:`!pt-[72px]`}):m(t,{className:`w-full pb-[24px]`,children:[p(_,{list:v}),u.hasNextPage&&p(r,{loadMore:async e=>b(),hasMore:u.hasNextPage,className:`w-full`})]})});v.displayName=`SearchVideoInfo`;export{_ as SearchVideoWaterfall,v as default};
@@ -1,2 +1,2 @@
1
1
 
2
- import{getPostDetailPagePath as e}from"../../../../utils/tools.mjs";const t=[{label:`综合`,value:1},{label:`最新`,value:2},{label:`最热`,value:3}];function n(e){return!Number.isFinite(e)||e<=0?``:e>=1e8?`${(e/1e8).toFixed(1).replace(/\.0$/,``)}亿热度`:e>=1e4?`${(e/1e4).toFixed(1).replace(/\.0$/,``)}万热度`:`${Math.floor(e)}热度`}function r(e){let t=Number(e);if(!(!Number.isFinite(t)||t<=0))return t>10&&t<=100?t/10:Math.min(t,10)}function i(e){return String(e.img_type??``).trim().toLowerCase()===`long`?`short`:`tall`}function a(e){let t=[],n=[],r=0,i=0;return e.forEach(e=>{let a=(e.cardKind===`short`?142:216)+16;if(r<=i){t.push(e),r+=a;return}n.push(e),i+=a}),{left:t,right:n}}function o(e){return String(e.name||``).trim()}function s(e){return e.img_y||e.img_x||``}function c(e){return String(e.group_name||e.description||``).trim()}function l(t){let n=String(t.video_id||``).trim();return n?e({id:n,contentType:0}):`#`}function u(e){return a(e.filter(e=>String(e.video_id||``).trim()).map((e,t)=>({key:`${e.video_id??`video`}-${t}`,sourceIndex:t,href:l(e),cardKind:i(e),coverUrl:s(e),title:o(e),metaPrimaryText:c(e),heatText:n(Number(e.play_count||0)),score:r(e.score)})))}function d(e){for(let t of e)if(typeof t==`string`&&t.trim())return t.trim();return``}function f(e){return d([e.nick_name,e.nickname,e.display_id,e.user_id])}function p(e){return d([e.signature,e.description,e.text,e.introduce,e.bio])}function m(e){let t=Number(e||0);return!Number.isFinite(t)||t<=0?`0`:t>=1e8?`${(t/1e8).toFixed(1).replace(/\.0$/,``)}亿`:t>=1e4?`${(t/1e4).toFixed(1).replace(/\.0$/,``)}万`:`${Math.floor(t)}`}export{t as SEARCH_RESULT_SORT_OPTIONS,u as buildSearchVideoWaterfallColumns,m as formatSearchFollowerCount,p as resolveSearchUserDescription,f as resolveSearchUserName};
2
+ import{getPostDetailPagePath as e}from"../../../../utils/tools.mjs";const t=[{label:`综合`,value:1},{label:`最新`,value:2},{label:`最热`,value:3}];function n(e){return!Number.isFinite(e)||e<=0?``:e>=1e8?`${(e/1e8).toFixed(1).replace(/\.0$/,``)}亿热度`:e>=1e4?`${(e/1e4).toFixed(1).replace(/\.0$/,``)}万热度`:`${Math.floor(e)}热度`}function r(e){let t=Number(e);if(!(!Number.isFinite(t)||t<=0))return t>10&&t<=100?t/10:Math.min(t,10)}function i(e){return String(e.img_type??``).trim().toLowerCase()===`long`?`short`:`tall`}function a(e){let t=[],n=[],r=0,i=0;return e.forEach(e=>{let a=(e.cardKind===`short`?142:216)+16;if(r<=i){t.push(e),r+=a;return}n.push(e),i+=a}),{left:t,right:n}}function o(e){return String(e.name||``).trim()}function s(e){return e.img_y||e.img_x||``}function c(e){return String(e.group_name||e.description||``).trim()}function l(t){let n=String(t.video_id||``).trim();return n?e({id:n,contentType:0}):`#`}function u(e){return a(e.filter(e=>String(e.video_id||``).trim()).map((e,t)=>({key:`${e.video_id??`video`}-${t}`,sourceIndex:t,href:l(e),cardKind:i(e),coverUrl:s(e),title:o(e),metaPrimaryText:c(e),heatText:n(Number(e.play_count||0)),score:r(e.score),selectionId:String(e.video_id??``).trim()||void 0})))}function d(e){for(let t of e)if(typeof t==`string`&&t.trim())return t.trim();return``}function f(e){return d([e.nick_name,e.nickname,e.display_id,e.user_id])}function p(e){return d([e.signature,e.description,e.text,e.introduce,e.bio])}function m(e){let t=Number(e||0);return!Number.isFinite(t)||t<=0?`0`:t>=1e8?`${(t/1e8).toFixed(1).replace(/\.0$/,``)}亿`:t>=1e4?`${(t/1e4).toFixed(1).replace(/\.0$/,``)}万`:`${Math.floor(t)}`}export{t as SEARCH_RESULT_SORT_OPTIONS,u as buildSearchVideoWaterfallColumns,m as formatSearchFollowerCount,p as resolveSearchUserDescription,f as resolveSearchUserName};
@@ -0,0 +1,2 @@
1
+
2
+ "use client";import{trackAppPageView as e,trackRecommendListClick as t}from"../../../utils/tracking.mjs";const n=`search`,r=`搜索`;function i(){e({page_key:n,page_name:r,current_page_key:n,current_page_name:r})}function a(e,i=``,a=``){t({page_key:n,page_name:r,recommend_id:e,recommend_trace_id:i,recommend_trace_info:a})}function o(e,i=``,a=``){t({page_key:n,page_name:r,recommend_id:e,recommend_trace_id:i,recommend_trace_info:a})}export{o as trackSearchMediaRecommendClick,i as trackSearchPageView,a as trackSearchTextRecommendClick};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{Box as r}from"../../ui/box.mjs";import{eventKey as i}from"../../../constants/event-key.mjs";import{useSearchHistory as a}from"../../../hooks/use-search-history.mjs";import{SEARCH_RESULT_SORT_OPTIONS as o}from"./shared.mjs";import s from"./search-user.mjs";import c from"./search-video-info.mjs";import l from"./search-all.mjs";import{SearchTab as u}from"./search-tab.mjs";import d from"./top-header.mjs";import{useEffect as f,useMemo as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useSearchParams as _}from"next/navigation";import{useTranslations as v}from"next-intl";const y=[{labelKey:`tabs.all`,value:`all`},{labelKey:`tabs.video`,value:`video`},{labelKey:`tabs.user`,value:`user`}];function b(){let b=v(`components.pages.search.pageClient`),{userInfo:x}=n(),S=x?.user_id||`guest`,C=_().get(`q`)?.toString()||``,[w,T]=m(C),[E,D]=m(0);f(()=>{T(C),D(e=>e+1)},[C]);let[O,k]=m(y[0].value),[A,j]=m(o[0].value),[M,N]=m(0),{addHistory:P}=a({storageKey:S}),F=p(()=>y.map(e=>({value:e.value,label:b(e.labelKey)})),[b]),I=p(()=>w.trim()!==``,[w]);return f(()=>(t.on(i.EXCHANGE_SEARCH_TYPE,k),()=>{t.off(i.EXCHANGE_SEARCH_TYPE,k)}),[]),g(r,{className:`flex h-dvh w-full flex-col`,children:[h(r,{className:`shrink-0`,children:h(d,{setSearchInputVal:t=>{t!==w&&(T(t),e({q:t}))},initInputVal:C,initInputVersion:E,addSearchHistory:P})}),h(r,{className:`mt-[16px] min-h-0 flex-1 overflow-hidden rounded-t-[16px]`,children:I&&g(r,{className:`flex h-full flex-col bg-[linear-gradient(180deg,rgba(6,3,21,0.9)_0%,rgba(6,3,21,0)_100%)] backdrop-blur-[2px]`,children:[h(u,{searchType:O,tabList:F,onChange:e=>{k(e)},sort:A,onSortChange:e=>{j(e),N(e=>e+1)}}),g(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-[24px]`,children:[O===`user`&&h(s,{inputVal:w,sort:A,refreshVersion:M}),O===`all`&&h(l,{searchInputVal:w,sort:A,refreshVersion:M}),O===`video`&&h(c,{inputVal:w,sort:A,refreshVersion:M})]})]})})]})}export{b as default};
2
+ "use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{usePageLifecycle as r}from"../../../utils/tracking.mjs";import{useRouter as i}from"../../../utils/use-compatible-router.mjs";import{Box as a}from"../../ui/box.mjs";import{eventKey as o}from"../../../constants/event-key.mjs";import{useSearchHistory as s}from"../../../hooks/use-search-history.mjs";import{trackSearchResultPageView as c}from"./tracking.mjs";import{SEARCH_RESULT_SORT_OPTIONS as l}from"./shared.mjs";import u from"./search-user.mjs";import d from"./search-video-info.mjs";import f from"./search-all.mjs";import{SearchTab as p}from"./search-tab.mjs";import m from"./top-header.mjs";import{useEffect as h,useMemo as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useSearchParams as b}from"next/navigation";import{useTranslations as x}from"next-intl";const S=[{labelKey:`tabs.all`,value:`all`},{labelKey:`tabs.video`,value:`video`},{labelKey:`tabs.user`,value:`user`}];function C(){i(),r(`page_search_result`,`搜索结果`);let C=x(`components.pages.search.pageClient`),{userInfo:w}=n(),T=w?.user_id||`guest`,E=b().get(`q`)?.toString()||``,[D,O]=_(E),[k,A]=_(0);h(()=>{O(E),A(e=>e+1)},[E]);let[j,M]=_(S[0].value),[N,P]=_(l[0].value),[F,I]=_(0),{addHistory:L}=s({storageKey:T}),R=g(()=>S.map(e=>({value:e.value,label:C(e.labelKey)})),[C]),z=g(()=>D.trim()!==``,[D]);return h(()=>(t.on(o.EXCHANGE_SEARCH_TYPE,M),()=>{t.off(o.EXCHANGE_SEARCH_TYPE,M)}),[M]),h(()=>{D.trim()&&c(j,D)},[j,D]),y(a,{className:`flex h-dvh w-full flex-col`,children:[v(a,{className:`shrink-0`,children:v(m,{setSearchInputVal:t=>{t!==D&&(O(t),e({q:t}))},initInputVal:E,initInputVersion:k,addSearchHistory:L})}),v(a,{className:`mt-[16px] min-h-0 flex-1 overflow-hidden rounded-t-[16px]`,children:z&&y(a,{className:`flex h-full flex-col bg-[linear-gradient(180deg,rgba(6,3,21,0.9)_0%,rgba(6,3,21,0)_100%)] backdrop-blur-[2px]`,children:[v(p,{searchType:j,tabList:R,onChange:e=>{M(e)},sort:N,onSortChange:e=>{P(e),I(e=>e+1)}}),y(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-[24px]`,children:[j===`user`&&v(u,{inputVal:D,sort:N,refreshVersion:F}),j===`all`&&v(f,{searchInputVal:D,sort:N,refreshVersion:F}),j===`video`&&v(d,{inputVal:D,sort:N,refreshVersion:F})]})]})})]})}export{C as default};
@@ -0,0 +1,2 @@
1
+
2
+ "use client";import{trackAppPageView as e,trackPageClick as t}from"../../../utils/tracking.mjs";const n=`search_result`,r=`搜索结果`;function i(t,i){e({page_key:n,page_name:r,current_page_key:n,current_page_name:r,search_type:t,keyword:i})}function a(e,i,a){t(n,r,e,`search_result_item`,{content_id:i,content_type:a})}export{a as trackSearchResultClick,i as trackSearchResultPageView};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{cn as e}from"../../../../utils/cn.mjs";import{useUserStore as t}from"../../../../store/modules/user-store.mjs";import{gUserGetUserPrivacySettings as n}from"../../../../service/generated/client.mjs";import{Box as r}from"../../../ui/box.mjs";import{useLoginModalStore as i}from"../../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as a,useRequest as o}from"../../../../hooks/query/use-query.mjs";import{locales as s}from"../../../../i18n.mjs";import{DeleteConfirmDialog as c}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{HeaderNav as l}from"../../../common/header-nav/client.mjs";import{ResetPasswordDrawer as u}from"./reset-password-drawer.mjs";import{useEffect as d,useRef as f,useState as p}from"react";import{ChevronRight as m}from"lucide-react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useRouter as _}from"next/navigation";import{useLocale as v,useTranslations as y}from"next-intl";import b from"next/link";function x(e){return{collection:Number(e?.collections_open??0)>0,follower:Number(e?.follower_open??0)>0,following:Number(e?.following_open??0)>0,like:Number(e?.like_open??0)>0}}function S({className:m}={}){let S=y(`components.pages.settings.components`),w=v(),{open:T}=i(),E=t(e=>e.isLogin),D=t(e=>e.token),O=t(e=>e.logout),k=t(e=>e.userId),A=(E||!!D)&&!!k,j=x(),[M,N]=p(j),P=f(j),[F,I]=p(!1),[L,R]=p(!1);a();let z=[`user-privacy-settings`,k],B=w===`zh-CN`?`en`:`zh-CN`;s.find(e=>e.code===B)?.name;let{data:V}=o(z,()=>n({user_id:k}),{enabled:!!k}),H=V?.data;d(()=>{if(!H)return;let e=x(H);N(e),P.current=e},[H]),d(()=>{P.current=M},[M]);let U=a(),W=_();function G(){U([`user-profile`,`mine`]),O(),W.push(`/user/mine`)}function K(e){R(e)}function q(){R(!0)}function J(){R(!1)}function Y(){G()}function X(e){I(e)}function Z(){if(!A){T();return}I(!0)}function Q(e){A||(e.preventDefault(),e.stopPropagation(),T())}return g(r,{className:e(`min-h-dvh bg-[var(--color-surface-panel-dark)]`,m),children:[h(l,{className:`!bg-[var(--color-surface-panel-dark)] !border-transparent`,title:S(`settings.title`)}),h(u,{open:F,onOpenChange:X}),g(r,{className:`mx-4 mt-4 flex flex-col`,children:[h(`button`,{type:`button`,className:`block w-full text-left`,onClick:Z,children:h(C,{title:S(`settings.resetPasswordTitle`)})}),h(b,{href:`/feedback`,onClick:Q,className:`block`,children:h(C,{title:S(`settings.feedbackTitle`)})})]}),F||!A?null:h(r,{className:`fixed inset-x-0 bottom-0 z-40 flex flex-col pb-[env(safe-area-inset-bottom)]`,children:h(`div`,{className:`flex flex-col items-center px-4 py-2`,style:{background:`var(--color-overlay-panel-fade-start90)`,backdropFilter:`blur(var(--effect-backdrop-blur-detail-hero))`},children:h(`button`,{type:`button`,className:`flex h-12 w-full items-center justify-center rounded-[8px] text-base text-[var(--color-text-primary)] transition-opacity active:opacity-80`,style:{background:`var(--color-surface-white10)`},onClick:q,children:S(`settings.button`)})})}),h(c,{open:L,onOpenChange:K,onCancel:J,onConfirm:Y,title:``,description:S(`settings.logoutConfirmMessage`),confirmText:S(`settings.confirm`),cancelText:S(`settings.cancel`)})]})}function C({title:e}){return g(`div`,{className:`flex h-14 items-center justify-between px-4`,children:[h(`span`,{className:`text-base text-[var(--color-text-primary)]`,children:e}),h(m,{className:`size-6 shrink-0 opacity-50 text-[var(--color-text-primary)]`})]})}export{S as Settings};
2
+ "use client";import{cn as e}from"../../../../utils/cn.mjs";import{useUserStore as t}from"../../../../store/modules/user-store.mjs";import{gUserGetUserPrivacySettings as n}from"../../../../service/generated/client.mjs";import{usePageLifecycle as r}from"../../../../utils/tracking.mjs";import{Box as i}from"../../../ui/box.mjs";import{useLoginModalStore as a}from"../../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as o,useRequest as s}from"../../../../hooks/query/use-query.mjs";import{locales as c}from"../../../../i18n.mjs";import{DeleteConfirmDialog as l}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{HeaderNav as u}from"../../../common/header-nav/client.mjs";import{ResetPasswordDrawer as d}from"./reset-password-drawer.mjs";import{useEffect as f,useRef as p,useState as m}from"react";import{ChevronRight as h}from"lucide-react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{useRouter as v}from"next/navigation";import{useLocale as y,useTranslations as b}from"next-intl";import x from"next/link";function S(e){return{collection:Number(e?.collections_open??0)>0,follower:Number(e?.follower_open??0)>0,following:Number(e?.following_open??0)>0,like:Number(e?.like_open??0)>0}}function C({className:h}={}){let C=b(`components.pages.settings.components`);r(`page_settings`,`设置`);let T=y(),{open:E}=a(),D=t(e=>e.isLogin),O=t(e=>e.token),k=t(e=>e.logout),A=t(e=>e.userId),j=(D||!!O)&&!!A,M=S(),[N,P]=m(M),F=p(M),[I,L]=m(!1),[R,z]=m(!1);o();let B=[`user-privacy-settings`,A],V=T===`zh-CN`?`en`:`zh-CN`;c.find(e=>e.code===V)?.name;let{data:H}=s(B,()=>n({user_id:A}),{enabled:!!A}),U=H?.data;f(()=>{if(!U)return;let e=S(U);P(e),F.current=e},[U]),f(()=>{F.current=N},[N]);let W=o(),G=v();function K(){W([`user-profile`,`mine`]),k(),G.push(`/user/mine`)}function q(e){z(e)}function J(){z(!0)}function Y(){z(!1)}function X(){K()}function Z(e){L(e)}function Q(){if(!j){E();return}L(!0)}function $(e){j||(e.preventDefault(),e.stopPropagation(),E())}return _(i,{className:e(`min-h-dvh bg-[var(--color-surface-panel-dark)]`,h),children:[g(u,{className:`!bg-[var(--color-surface-panel-dark)] !border-transparent`,title:C(`settings.title`)}),g(d,{open:I,onOpenChange:Z}),_(i,{className:`mx-4 mt-4 flex flex-col`,children:[g(`button`,{type:`button`,className:`block w-full text-left`,onClick:Q,children:g(w,{title:C(`settings.resetPasswordTitle`)})}),g(x,{href:`/feedback`,onClick:$,className:`block`,children:g(w,{title:C(`settings.feedbackTitle`)})})]}),I||!j?null:g(i,{className:`fixed inset-x-0 bottom-0 z-40 flex flex-col pb-[env(safe-area-inset-bottom)]`,children:g(`div`,{className:`flex flex-col items-center px-4 py-2`,style:{background:`var(--color-overlay-panel-fade-start90)`,backdropFilter:`blur(var(--effect-backdrop-blur-detail-hero))`},children:g(`button`,{type:`button`,className:`flex h-12 w-full items-center justify-center rounded-[8px] text-base text-[var(--color-text-primary)] transition-opacity active:opacity-80`,style:{background:`var(--color-surface-white10)`},onClick:J,children:C(`settings.button`)})})}),g(l,{open:R,onOpenChange:q,onCancel:Y,onConfirm:X,title:``,description:C(`settings.logoutConfirmMessage`),confirmText:C(`settings.confirm`),cancelText:C(`settings.cancel`)})]})}function w({title:e}){return _(`div`,{className:`flex h-14 items-center justify-between px-4`,children:[g(`span`,{className:`text-base text-[var(--color-text-primary)]`,children:e}),g(h,{className:`size-6 shrink-0 opacity-50 text-[var(--color-text-primary)]`})]})}export{C as Settings};