@funhub/platform 0.1.35 → 0.1.37

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 (136) hide show
  1. package/dist/assets/images/frame.mjs +2 -0
  2. package/dist/biz.d.mts +13 -13
  3. package/dist/biz.mjs +1 -1
  4. package/dist/components/biz/basics/logo/variants/basic-logo/runtime/client.mjs +1 -1
  5. package/dist/components/biz/business/channel-list/client.mjs +1 -1
  6. package/dist/components/biz/business/detail/detail-operate.mjs +1 -1
  7. package/dist/components/biz/business/detail/materials/editor-preview.mjs +2 -0
  8. package/dist/components/biz/business/detail/materials/video-detail-actions/client.mjs +1 -1
  9. package/dist/components/biz/business/detail/materials/video-detail-info/client.d.mts +1 -1
  10. package/dist/components/biz/business/detail/materials/video-detail-info/client.mjs +1 -1
  11. package/dist/components/biz/business/detail/materials/video-detail-info/material.mjs +1 -1
  12. package/dist/components/biz/business/detail/materials/video-detail-info/schema.d.mts +2 -2
  13. package/dist/components/biz/business/detail/materials/video-detail-info/server.d.mts +1 -1
  14. package/dist/components/biz/business/detail/materials/video-detail-info-title/client.d.mts +1 -1
  15. package/dist/components/biz/business/detail/materials/video-detail-info-title/client.mjs +1 -1
  16. package/dist/components/biz/business/detail/materials/video-detail-info-title/material.mjs +1 -1
  17. package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.d.mts +2 -2
  18. package/dist/components/biz/business/detail/materials/video-detail-info-title/server.d.mts +1 -1
  19. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.d.mts +1 -1
  20. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.mjs +1 -1
  21. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.mjs +1 -1
  22. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.d.mts +2 -2
  23. package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/server.d.mts +1 -1
  24. package/dist/components/biz/business/detail/materials/video-detail-player/client.mjs +1 -1
  25. package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +1 -1
  26. package/dist/components/biz/business/detail/materials/video-detail-recommend/material.mjs +1 -1
  27. package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.mjs +1 -1
  28. package/dist/components/biz/business/detail/video-hero.mjs +1 -1
  29. package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
  30. package/dist/components/biz/business/home-recommend/shared/home-recommend-preview.mjs +2 -0
  31. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.d.mts +4 -0
  32. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.mjs +1 -1
  33. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.d.mts +2 -0
  34. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.mjs +1 -1
  35. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/client.mjs +1 -1
  36. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/component.mjs +1 -1
  37. package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/server.mjs +1 -1
  38. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/defaults/default-props.d.mts +1 -3
  39. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/defaults/default-props.mjs +1 -1
  40. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.d.mts +4 -2
  41. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.mjs +1 -1
  42. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.d.mts +2 -1
  43. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.mjs +1 -1
  44. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/client.mjs +1 -1
  45. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/component.mjs +1 -1
  46. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/props.schema.mjs +1 -1
  47. package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/server.mjs +1 -1
  48. package/dist/components/biz/business/index.d.mts +12 -12
  49. package/dist/components/biz/business/index.mjs +1 -1
  50. package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
  51. package/dist/components/biz/business/large-feature-grid/material.d.mts +4 -3
  52. package/dist/components/biz/business/large-feature-grid/material.mjs +1 -1
  53. package/dist/components/biz/business/large-feature-grid/schema.mjs +1 -1
  54. package/dist/components/biz/business/marquee/client.d.mts +7 -9
  55. package/dist/components/biz/business/marquee/client.mjs +1 -1
  56. package/dist/components/biz/business/marquee/index.d.mts +2 -2
  57. package/dist/components/biz/business/marquee/material.d.mts +15 -6
  58. package/dist/components/biz/business/marquee/schema.d.mts +23 -28
  59. package/dist/components/biz/business/marquee/schema.mjs +1 -1
  60. package/dist/components/biz/business/marquee/server.d.mts +1 -1
  61. package/dist/components/biz/business/nav-bar/variants/basic-nav-bar/runtime/client.mjs +1 -1
  62. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.mjs +1 -1
  63. package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/server.mjs +1 -1
  64. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +1 -1
  65. package/dist/components/biz/business/profile/profile-main/tabs/history-tab/server.mjs +1 -1
  66. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
  67. package/dist/components/biz/business/profile/profile-main/tabs/like-tab/server.mjs +1 -1
  68. package/dist/components/biz/business/search-history/client.d.mts +10 -12
  69. package/dist/components/biz/business/search-history/client.mjs +1 -1
  70. package/dist/components/biz/business/search-history/index.d.mts +2 -2
  71. package/dist/components/biz/business/search-history/material.d.mts +1 -1
  72. package/dist/components/biz/business/search-history/schema.d.mts +7 -15
  73. package/dist/components/biz/business/search-history/schema.mjs +1 -1
  74. package/dist/components/biz/business/search-history/server.d.mts +6 -2
  75. package/dist/components/biz/business/search-input/client.d.mts +11 -9
  76. package/dist/components/biz/business/search-input/client.mjs +1 -1
  77. package/dist/components/biz/business/search-input/index.d.mts +2 -2
  78. package/dist/components/biz/business/search-input/schema.d.mts +6 -10
  79. package/dist/components/biz/business/search-input/schema.mjs +1 -1
  80. package/dist/components/biz/business/search-input/server.d.mts +1 -1
  81. package/dist/components/biz/business/shortcut-grid/material.d.mts +1 -1
  82. package/dist/components/biz/business/shortcut-grid/schema.d.mts +1 -1
  83. package/dist/components/biz/business/shortcut-grid/schema.mjs +1 -1
  84. package/dist/components/biz/business/tab-bar/client.d.mts +6 -5
  85. package/dist/components/biz/business/tab-bar/client.mjs +1 -1
  86. package/dist/components/biz/business/tab-bar/index.d.mts +2 -2
  87. package/dist/components/biz/business/tab-bar/schema.d.mts +10 -18
  88. package/dist/components/biz/business/tab-bar/schema.mjs +1 -1
  89. package/dist/components/biz/business/tab-bar/server.d.mts +1 -1
  90. package/dist/components/biz/business/text-recommend/client.d.mts +10 -14
  91. package/dist/components/biz/business/text-recommend/client.mjs +1 -1
  92. package/dist/components/biz/business/text-recommend/index.d.mts +2 -2
  93. package/dist/components/biz/business/text-recommend/material.d.mts +4 -1
  94. package/dist/components/biz/business/text-recommend/schema.d.mts +9 -12
  95. package/dist/components/biz/business/text-recommend/schema.mjs +1 -1
  96. package/dist/components/biz/business/text-recommend/server.d.mts +1 -1
  97. package/dist/components/biz/business/text-recommend/server.mjs +1 -1
  98. package/dist/components/biz/business/video-horizontal-list/client.d.mts +5 -2
  99. package/dist/components/biz/business/video-horizontal-list/client.mjs +1 -1
  100. package/dist/components/biz/business/video-horizontal-list/index.d.mts +2 -2
  101. package/dist/components/biz/business/video-horizontal-list/material.d.mts +19 -8
  102. package/dist/components/biz/business/video-horizontal-list/schema.d.mts +20 -24
  103. package/dist/components/biz/business/video-horizontal-list/schema.mjs +1 -1
  104. package/dist/components/biz/business/video-horizontal-list/server.d.mts +1 -1
  105. package/dist/components/common/delete-confirm-dialog/delete-confirm-dialog.mjs +1 -1
  106. package/dist/components/common/list/collection-list/collection-list-item.d.mts +1 -0
  107. package/dist/components/common/list/collection-list/collection-list-item.mjs +1 -1
  108. package/dist/components/common/popup-video/index.mjs +1 -1
  109. package/dist/components/pages/feed-series/feed-series-client.mjs +1 -1
  110. package/dist/components/pages/home/client.mjs +1 -1
  111. package/dist/components/pages/post-detail/post-detail-client.mjs +1 -1
  112. package/dist/components/pages/publish/page-client.mjs +1 -1
  113. package/dist/components/pages/search/hot-recommend.mjs +1 -1
  114. package/dist/components/pages/search/page-client.mjs +1 -1
  115. package/dist/components/pages/search/search-result/search-all.mjs +1 -1
  116. package/dist/components/pages/user-follow/page.mjs +1 -1
  117. package/dist/components/pages/video-detail/page.mjs +1 -1
  118. package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
  119. package/dist/components/ui/button.d.mts +1 -1
  120. package/dist/components/ui/image.d.mts +4 -4
  121. package/dist/constants/event-key.mjs +1 -1
  122. package/dist/hooks/use-search-history.mjs +1 -1
  123. package/dist/i18n/locales/en.mjs +1 -1
  124. package/dist/i18n/locales/zh-CN.mjs +1 -1
  125. package/dist/utils/schema/index.d.mts +1 -1
  126. package/dist/utils/schema/inspector.d.mts +31 -1
  127. package/dist/utils/schema/material.d.mts +1 -1
  128. package/dist/utils/schema/schema.d.mts +31 -2
  129. package/dist/utils/schema/schema.mjs +1 -1
  130. package/dist/utils.d.mts +2 -2
  131. package/dist/utils.mjs +1 -1
  132. package/package.json +1 -1
  133. package/dist/components/biz/business/large-feature-grid/client.d.mts +0 -15
  134. package/dist/components/biz/business/large-feature-grid/default.mjs +0 -2
  135. package/dist/components/biz/business/large-feature-grid/server.d.mts +0 -13
  136. package/dist/components/biz/business/large-feature-grid/types.d.mts +0 -53
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Box as e}from"../../../ui/box.mjs";import{Text as t}from"../../../ui/text.mjs";import n from"../../../ui/link.mjs";import r from"../../../../assets/icons/tabs/follow.mjs";import i from"../../../../assets/icons/tabs/follow_active.mjs";import a from"../../../../assets/icons/tabs/home.mjs";import o from"../../../../assets/icons/tabs/home_active.mjs";import s from"../../../../assets/icons/tabs/mine.mjs";import c from"../../../../assets/icons/tabs/mine_active.mjs";import{useEffect as l,useState as u,useTransition as d}from"react";import{Fragment as f,jsx as p,jsxs as m}from"react/jsx-runtime";import{usePathname as h}from"next/navigation";const g=`env(safe-area-inset-bottom, 0px)`;function _(e,t){if(t!==`/`)return e.startsWith(t);let n=[`/user`].some(t=>e.startsWith(t)),r=e.startsWith(`/category/`);return!n&&(e===`/`||r)}const v={home:{icon:a,activeIcon:o},follow:{icon:r,activeIcon:i},mine:{icon:s,activeIcon:c}};function y({items:r}){let i=h(),[a,o]=u(null),[,s]=d(),[c,y]=u(!1);return l(()=>{y(!0)},[]),l(()=>{a&&_(i,a)&&s(()=>{o(null)})},[i,a]),!r||r.length===0?null:p(e,{className:`fixed bottom-0 left-0 right-0 bg-bg1 border-t border-line1 flex items-center justify-around z-50`,style:{height:`calc(56px + ${g})`,paddingBottom:g},children:r.map((r,s)=>{let l=c?_(a||i||``,r.path):!1,u=v[r.iconType]||v.home,d=m(f,{children:[p(l?u.activeIcon:u.icon,{width:22,height:22}),p(t,{className:`text-[10px] mt-[4px] ${l?`text-theme5`:`text-text2`}`,children:r.label})]});return l?p(e,{className:`flex flex-col items-center justify-center flex-1 h-full`,children:d},`${r.path}-${s}`):p(n,{href:r.path,prefetch:!0,className:`flex flex-col items-center justify-center flex-1 h-full`,onClick:()=>{r.path!==i&&o(r.path)},children:d},`${r.path}-${s}`)})})}export{y as TabBarClient};
2
+ "use client";import{Box as e}from"../../../ui/box.mjs";import{Text as t}from"../../../ui/text.mjs";import{useMemo as n}from"react";import{HomeIcon as r,UserIcon as i,UsersIcon as a}from"lucide-react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{usePathname as c,useRouter as l}from"next/navigation";const u=[];function d(d){let{items:f=u}=d,p=l(),m=c(),h=n(()=>f.findIndex(e=>e.path===m)||0,[f,m]),g=(e,t)=>{let n=`w-6 h-6 ${t?`text-brand`:`text-text3`}`;switch(e){case`home`:return o(r,{className:n});case`follow`:return o(a,{className:n});case`mine`:return o(i,{className:n});default:return o(r,{className:n})}};return!f||f.length===0?null:o(e,{className:`fixed bottom-0 left-0 right-0 bg-bg1 border-t border-line safe-area-bottom z-50`,children:o(e,{className:`flex h-[50px] items-center justify-around`,children:f.map((n,r)=>{let i=h===r;return s(e,{className:`flex flex-col items-center justify-center flex-1 cursor-pointer`,onClick:()=>p.push(n.path),children:[g(n.iconType,i),o(t,{className:`text-[10px] mt-0.5 ${i?`text-brand font-medium`:`text-text3`}`,children:n.label})]},r)})})})}export{d as TabBarClient};
@@ -1,5 +1,5 @@
1
1
 
2
- import { TabBarInspectorProps, TabBarProps, tabBarInspectorDefaultProps, tabBarInspectorPropsSchema } from "./schema.mjs";
3
- import { TabBarClient } from "./client.mjs";
2
+ import { tabBarInspectorPropsSchema } from "./schema.mjs";
3
+ import { TabBarClient, TabBarProps } from "./client.mjs";
4
4
  import { TabBarServer } from "./server.mjs";
5
5
  import { tabBarMaterial } from "./material.mjs";
@@ -1,27 +1,19 @@
1
1
 
2
2
  import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
3
  import "../../../../utils.mjs";
4
- import z$1 from "zod";
4
+ import * as zod from "zod";
5
+ import * as zod_v4_core0 from "zod/v4/core";
5
6
 
6
7
  //#region components/biz/business/tab-bar/schema.d.ts
7
8
  /**
8
9
  * TabBar 物料属性定义
9
10
  */
10
- declare const tabBarInspectorPropsSchema: z$1.ZodObject<{
11
- items: z$1.ZodArray<z$1.ZodObject<{
12
- label: z$1.ZodString & SchemaHasDefaultValue;
13
- path: z$1.ZodString & SchemaHasDefaultValue;
14
- iconType: z$1.ZodString & SchemaHasDefaultValue;
15
- }, z$1.core.$strip>> & SchemaHasDefaultValue;
16
- }, z$1.core.$strip>;
17
- declare const tabBarInspectorDefaultProps: {
18
- items: {
19
- label: string;
20
- path: string;
21
- iconType: string;
22
- }[];
23
- };
24
- type TabBarInspectorProps = z$1.infer<typeof tabBarInspectorPropsSchema>;
25
- type TabBarProps = TabBarInspectorProps;
11
+ declare const tabBarInspectorPropsSchema: zod.ZodObject<{
12
+ items: zod.ZodArray<zod.ZodObject<{
13
+ label: zod.ZodString & SchemaHasDefaultValue;
14
+ path: zod.ZodString & SchemaHasDefaultValue;
15
+ iconType: zod.ZodString & SchemaHasDefaultValue;
16
+ }, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
17
+ }, zod_v4_core0.$strip>;
26
18
  //#endregion
27
- export { TabBarInspectorProps, TabBarProps, tabBarInspectorDefaultProps, tabBarInspectorPropsSchema };
19
+ export { tabBarInspectorPropsSchema };
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineTextPropSchema as n,getSchemaDefaultProps as r}from"../../../../utils/schema/schema.mjs";const i=t({items:e(t({label:n({label:`名称`,defaultValue:`首页`}),path:n({label:`跳转路径`,defaultValue:`/`}),iconType:n({label:`图标类型`,defaultValue:`home`})}),{label:`导航项`,defaultValue:[{label:`首页`,path:`/`,iconType:`home`},{label:`关注`,path:`/user/follow`,iconType:`follow`},{label:`我的`,path:`/user/mine`,iconType:`mine`}]})}),a=r(i);export{a as tabBarInspectorDefaultProps,i as tabBarInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineTextPropSchema as n}from"../../../../utils/schema/schema.mjs";const r=t({items:e(t({label:n({label:`名称`,defaultValue:`首页`}),path:n({label:`跳转路径`,defaultValue:`/`}),iconType:n({label:`图标类型`,defaultValue:`home`})}),{label:`导航项`,defaultValue:[{label:`首页`,path:`/`,iconType:`home`},{label:`关注`,path:`/user/follow`,iconType:`follow`},{label:`我的`,path:`/user/mine`,iconType:`mine`}]})});export{r as tabBarInspectorPropsSchema};
@@ -1,5 +1,5 @@
1
1
 
2
- import { TabBarProps } from "./schema.mjs";
2
+ import { TabBarProps } from "./client.mjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region components/biz/business/tab-bar/server.d.ts
@@ -1,22 +1,18 @@
1
1
 
2
- import { ContentRecommendInfo } from "../../../../types.mjs";
2
+ import { InferSchemaProps } from "../../../../utils/schema/schema.mjs";
3
+ import "../../../../utils/schema/index.mjs";
4
+ import { textRecommendInspectorPropsSchema } from "./schema.mjs";
3
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
6
 
5
7
  //#region components/biz/business/text-recommend/client.d.ts
6
- interface TextRecommendClientProps {
7
- title?: string;
8
- count?: string;
9
- initialList?: ContentRecommendInfo[];
10
- defaultTitle?: string;
8
+ type TextRecommendProps = InferSchemaProps<typeof textRecommendInspectorPropsSchema>;
9
+ interface ClientProps extends TextRecommendProps {
10
+ onItemClick?: (keyword: string) => void;
11
11
  }
12
12
  /**
13
- * 文字推荐物料组件 - 客户端交互部分
13
+ * 文字推荐物料组件 (推荐搜索) - 客户端交互部分
14
+ * 适配 Figma 设计稿布局:一行展示2个,包含“换一批”功能
14
15
  */
15
- declare function TextRecommendClient({
16
- title,
17
- count,
18
- initialList,
19
- defaultTitle
20
- }: TextRecommendClientProps): react_jsx_runtime0.JSX.Element;
16
+ declare function TextRecommendClient(props: ClientProps): react_jsx_runtime0.JSX.Element | null;
21
17
  //#endregion
22
- export { TextRecommendClient };
18
+ export { TextRecommendClient, TextRecommendProps };
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{updateUrlParams as e}from"../../../../utils/common.mjs";import{useUserStore as t}from"../../../../store/modules/user-store.mjs";import{gContentGetRecommendSearchList as n}from"../../../../service/generated/client.mjs";import{useRequest as r}from"../../../../hooks/query/use-query.mjs";import i from"../../../../assets/icons/refresh.mjs";import{useMemo as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{useRouter as l}from"next/navigation";function u({title:u,count:d,initialList:f=[],defaultTitle:p=`推荐搜索`}){let{userInfo:m}=t(),h=m?.user_id||`guest`,g=l(),[_,v]=o(null),{data:y,refetch:b,isFetching:x}=r([`hotSearchKey`,h],()=>n({user_id:h}),{enabled:!1}),S=a(()=>_||(y?.data?.recommend_list??f).slice(0,Number(d||6)),[y,_,f,d]),C=async()=>{let e=await b();e.data?.data?.recommend_list&&v(e.data.data.recommend_list)},w=t=>{e({q:t}),g.push(`${window.location.pathname}?q=${encodeURIComponent(t)}`)};return c(`div`,{className:`w-full mb-[24px] pt-[8px]`,children:[c(`div`,{className:`w-full px-[12px] h-[24px] mb-[12px] flex items-center justify-between`,children:[s(`span`,{className:`leading-[24px] text-[16px] text-text1 font-semibold`,children:u||p}),s(`div`,{className:`h-full px-[12px] flex items-center cursor-pointer`,onClick:C,children:s(i,{className:`w-[16px] h-[16px] text-text2 ${x?`animate-spin`:``}`})})]}),s(`div`,{className:`w-full px-[12px] flex gap-y-[16px] flex-wrap`,children:x&&!_?Array.from({length:Number(d||6)}).map((e,t)=>s(`div`,{className:`w-[50%] ${t%2==0?`pr-[4px]`:`pl-[4px]`}`,children:s(`div`,{className:`w-[70%] h-[22px] bg-bg2 animate-pulse rounded`})},`skeleton-${t}`)):S.map((e,t)=>s(`div`,{className:`w-[50%] ${t%2==0?`pr-[4px]`:`pl-[4px]`} cursor-pointer`,onClick:()=>w(e.title||``),children:s(`span`,{className:`text-text1 text-[14px] leading-[22px] max-w-[90%] line-clamp-1`,children:e.title})},String(e.title??t)))})]})}export{u as TextRecommendClient};
2
+ "use client";import{Box as e}from"../../../ui/box.mjs";import{Text as t}from"../../../ui/text.mjs";import n from"../../../../assets/icons/refresh.mjs";import{useMemo as r,useState as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{usePathname as s,useRouter as c,useSearchParams as l}from"next/navigation";const u=[];function d(d){let{title:f,displayCount:p=6,items:m=u,onItemClick:h}=d,g=c(),_=s(),v=l(),[y,b]=i(0),x=Math.ceil(m.length/p),S=r(()=>{if(m.length<=p)return m;let e=y%x*p;return m.slice(e,e+p)},[m,p,y,x]);if(m.length===0)return null;let C=e=>{e.stopPropagation(),b(e=>e+1)},w=e=>{if(h)h(e);else{let t=new URLSearchParams(v.toString());t.set(`q`,e);let n=_.includes(`/search`)?_:`/search`;g.push(`${n}?${t.toString()}`)}};return o(e,{className:`bg-bg1 p-3 flex flex-col gap-3 w-full`,children:[o(e,{className:`flex items-center justify-between w-full`,children:[a(t,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:f||`推荐搜索`}),m.length>p&&o(e,{className:`flex items-center gap-1 cursor-pointer active:opacity-70 transition-opacity`,onClick:C,children:[a(t,{className:`text-[14px] text-text3 leading-[22px]`,children:`换一批`}),a(n,{className:`w-3 h-3 text-text3`})]})]}),a(e,{className:`grid grid-cols-2 gap-x-1 gap-y-1 w-full`,children:S.map((n,r)=>a(e,{className:`flex items-center h-[32px] cursor-pointer active:opacity-70 transition-opacity overflow-hidden`,onClick:()=>w(n.label),children:a(t,{className:`text-[14px] text-text1 leading-[22px] truncate w-full`,children:n.label})},`${y}-${r}`))})]})}export{d as TextRecommendClient};
@@ -1,5 +1,5 @@
1
1
 
2
- import { TextRecommendClient } from "./client.mjs";
3
- import { TextRecommendInspectorProps, TextRecommendProps, textRecommendInspectorDefaultProps, textRecommendInspectorPropsSchema } from "./schema.mjs";
2
+ import { textRecommendInspectorPropsSchema } from "./schema.mjs";
3
+ import { TextRecommendClient, TextRecommendProps } from "./client.mjs";
4
4
  import { TextRecommendServer } from "./server.mjs";
5
5
  import { textRecommendMaterial } from "./material.mjs";
@@ -10,7 +10,10 @@ import * as zod_v4_core0 from "zod/v4/core";
10
10
  //#region components/biz/business/text-recommend/material.d.ts
11
11
  declare const textRecommendMaterial: DefineMaterialOption<typeof TextRecommendServer, typeof TextRecommendClient, zod.ZodObject<{
12
12
  title: zod.ZodString & SchemaHasDefaultValue;
13
- count: zod.ZodType<"4" | "6" | "8" | "10", unknown, zod_v4_core0.$ZodTypeInternals<"4" | "6" | "8" | "10", unknown>> & SchemaHasDefaultValue;
13
+ displayCount: zod.ZodNumber & SchemaHasDefaultValue;
14
+ items: zod.ZodArray<zod.ZodObject<{
15
+ label: zod.ZodString & SchemaHasDefaultValue;
16
+ }, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
14
17
  }, zod_v4_core0.$strip>, "text-recommend">;
15
18
  //#endregion
16
19
  export { textRecommendMaterial };
@@ -1,21 +1,18 @@
1
1
 
2
2
  import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
3
3
  import "../../../../utils.mjs";
4
- import z$1 from "zod";
4
+ import { z } from "zod";
5
5
 
6
6
  //#region components/biz/business/text-recommend/schema.d.ts
7
7
  /**
8
8
  * 文字推荐物料属性定义
9
9
  */
10
- declare const textRecommendInspectorPropsSchema: z$1.ZodObject<{
11
- title: z$1.ZodString & SchemaHasDefaultValue;
12
- count: z$1.ZodType<"4" | "6" | "8" | "10", unknown, z$1.core.$ZodTypeInternals<"4" | "6" | "8" | "10", unknown>> & SchemaHasDefaultValue;
13
- }, z$1.core.$strip>;
14
- declare const textRecommendInspectorDefaultProps: {
15
- title: string;
16
- count: "4" | "6" | "8" | "10";
17
- };
18
- type TextRecommendInspectorProps = z$1.infer<typeof textRecommendInspectorPropsSchema>;
19
- type TextRecommendProps = TextRecommendInspectorProps;
10
+ declare const textRecommendInspectorPropsSchema: z.ZodObject<{
11
+ title: z.ZodString & SchemaHasDefaultValue;
12
+ displayCount: z.ZodNumber & SchemaHasDefaultValue;
13
+ items: z.ZodArray<z.ZodObject<{
14
+ label: z.ZodString & SchemaHasDefaultValue;
15
+ }, z.core.$strip>> & SchemaHasDefaultValue;
16
+ }, z.core.$strip>;
20
17
  //#endregion
21
- export { TextRecommendInspectorProps, TextRecommendProps, textRecommendInspectorDefaultProps, textRecommendInspectorPropsSchema };
18
+ export { textRecommendInspectorPropsSchema };
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineComponentPropsSchema as e,defineSelectEnumPropSchema as t,defineTextPropSchema as n,getSchemaDefaultProps as r}from"../../../../utils/schema/schema.mjs";const i=e({title:n({label:`标题名称`,defaultValue:`推荐搜索`}),count:t([`4`,`6`,`8`,`10`],{label:`展示个数`,defaultValue:`6`})}),a=r(i);export{a as textRecommendInspectorDefaultProps,i as textRecommendInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineTextPropSchema as r}from"../../../../utils/schema/schema.mjs";import{z as i}from"zod";const a=t({title:r({label:`标题名称`,defaultValue:`推荐搜索`,description:`支持输入,中/英/数/符,6个字符`}),displayCount:n({label:`展示数`,defaultValue:2}),items:e(i.object({label:r({label:`热词`,defaultValue:`爱回家中文`})}),{label:`推荐位模块`,defaultValue:[{label:`爱回家中文`},{label:`爱回家中文`}]})});export{a as textRecommendInspectorPropsSchema};
@@ -1,5 +1,5 @@
1
1
 
2
- import { TextRecommendProps } from "./schema.mjs";
2
+ import { TextRecommendProps } from "./client.mjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region components/biz/business/text-recommend/server.d.ts
@@ -1,2 +1,2 @@
1
1
 
2
- import{gContentGetRecommendSearchList as e}from"../../../../service/generated/client.mjs";import{TextRecommendClient as t}from"./client.mjs";import{jsx as n}from"react/jsx-runtime";import{getTranslations as r}from"next-intl/server";async function i(i){let a=[],o=await r(`components.pages.search`);try{a=(await e({user_id:`guest`})).data?.recommend_list||[]}catch(e){console.error(`TextRecommendServer prefetch error:`,e)}return n(t,{...i,initialList:a,defaultTitle:o(`hotSearch.recommendedSearches`)})}export{i as TextRecommendServer};
2
+ import{TextRecommendClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";async function n(n){return t(e,{...n})}export{n as TextRecommendServer};
@@ -1,8 +1,11 @@
1
1
 
2
- import { VideoHorizontalListProps } from "./schema.mjs";
2
+ import { InferSchemaProps } from "../../../../utils/schema/schema.mjs";
3
+ import "../../../../utils/schema/index.mjs";
4
+ import { videoHorizontalListInspectorPropsSchema } from "./schema.mjs";
3
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
6
 
5
7
  //#region components/biz/business/video-horizontal-list/client.d.ts
8
+ type VideoHorizontalListProps = InferSchemaProps<typeof videoHorizontalListInspectorPropsSchema>;
6
9
  interface ClientProps extends VideoHorizontalListProps {
7
10
  allEpisodesText?: string;
8
11
  updatedToText?: string;
@@ -13,4 +16,4 @@ interface ClientProps extends VideoHorizontalListProps {
13
16
  */
14
17
  declare function VideoHorizontalListClient(props: ClientProps): react_jsx_runtime0.JSX.Element | null;
15
18
  //#endregion
16
- export { VideoHorizontalListClient };
19
+ export { VideoHorizontalListClient, VideoHorizontalListProps };
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import n from"next/image";function r(r){let{title:i,items:a=[]}=r;return!a||a.length===0?null:t(`div`,{className:`bg-bg1 px-3 py-3`,children:[i&&e(`div`,{className:`mb-3 flex items-center justify-between`,children:e(`h2`,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:i})}),e(`div`,{className:`flex overflow-x-auto pb-2 scrollbar-hide space-x-2`,children:a.map((r,i)=>t(`div`,{className:`flex-shrink-0 w-[116.67px]`,children:[t(`div`,{className:`relative aspect-[116.67/155.56] rounded-lg overflow-hidden bg-bg2`,children:[r.cover?e(n,{src:r.cover,alt:r.title,fill:!0,sizes:`116.67px`,className:`object-cover`}):e(`div`,{className:`w-full h-full flex items-center justify-center text-text3 text-xs`,children:`无封面`}),r.badge&&e(`div`,{className:`absolute top-0 right-0 text-white text-[12px] px-[6px] py-0 rounded-bl-[8px] rounded-tr-[8px] font-normal leading-[20px]`,style:{backgroundImage:`linear-gradient(120deg, #FD4C5E 1.59%, #F05D19 99.09%)`},children:r.badge}),e(`div`,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1 pt-3 px-1 flex justify-end items-center`,children:r.showEpisodes&&r.episodesText&&e(`span`,{className:`text-white text-[12px] leading-[20px]`,children:r.episodesText})})]}),e(`div`,{className:`mt-2 py-2`,children:e(`h3`,{className:`text-[16px] text-text1 line-clamp-1 font-bold leading-[24px]`,children:r.title})})]},i))})]})}export{r as VideoHorizontalListClient};
2
+ "use client";import e from"../../../../assets/images/frame.mjs";import{jsx as t,jsxs as n}from"react/jsx-runtime";import r from"next/image";const i=[];function a(a){let{title:o,items:s=i,commonPlayCount:c,commonEpisodes:l}=a;return!s||s.length===0?null:n(`div`,{className:`bg-bg1 px-3 py-3`,children:[o&&t(`div`,{className:`mb-3 flex items-center justify-between`,children:t(`h2`,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:o})}),t(`div`,{className:`flex overflow-x-auto pb-2 scrollbar-hide space-x-2`,children:s.map((i,a)=>{let o=i.showPlayCount??c?.enabled,s=i.playCountDelta||c?.delta,u=i.showEpisodes??l;return n(`div`,{className:`flex-shrink-0 w-[116.67px]`,children:[n(`div`,{className:`relative aspect-[116.67/155.56] rounded-lg overflow-hidden bg-bg2`,children:[t(r,{src:i.cover||e,alt:i.title,fill:!0,sizes:`116.67px`,className:`object-cover text-[10px] text-text3`}),i.badge&&t(`div`,{className:`absolute top-0 right-0 text-white text-[12px] px-[6px] py-0 rounded-bl-[8px] rounded-tr-[8px] font-normal leading-[20px]`,style:{backgroundImage:`linear-gradient(120deg, #FD4C5E 1.59%, #F05D19 99.08%)`},children:i.badge}),n(`div`,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1 pt-3 px-1 flex justify-between items-center`,children:[o&&s&&n(`span`,{className:`text-white text-[10px] flex items-center leading-none`,children:[t(`span`,{className:`mr-0.5 opacity-80`,children:`▶`}),s]}),u&&i.contentDescription&&t(`span`,{className:`text-white text-[12px] leading-[20px]`,children:i.contentDescription})]})]}),t(`div`,{className:`mt-2 py-2`,children:t(`h3`,{className:`text-[16px] text-text1 truncate font-bold leading-[24px]`,children:i.title})})]},a)})})]})}export{a as VideoHorizontalListClient};
@@ -1,5 +1,5 @@
1
1
 
2
- import { VideoHorizontalListInspectorProps, VideoHorizontalListProps, videoHorizontalListInspectorDefaultProps, videoHorizontalListInspectorPropsSchema } from "./schema.mjs";
3
- import { VideoHorizontalListClient } from "./client.mjs";
2
+ import { videoHorizontalListInspectorPropsSchema } from "./schema.mjs";
3
+ import { VideoHorizontalListClient, VideoHorizontalListProps } from "./client.mjs";
4
4
  import { VideoHorizontalListServer } from "./server.mjs";
5
5
  import { videoHorizontalListMaterial } from "./material.mjs";
@@ -13,15 +13,26 @@ import * as zod_v4_core0 from "zod/v4/core";
13
13
  */
14
14
  declare const videoHorizontalListMaterial: DefineMaterialOption<typeof VideoHorizontalListServer, typeof VideoHorizontalListClient, zod.ZodObject<{
15
15
  title: zod.ZodString & SchemaHasDefaultValue;
16
+ moduleCount: zod.ZodNumber & SchemaHasDefaultValue;
17
+ layout: zod.ZodObject<{
18
+ readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
19
+ readonly tag: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
20
+ }, zod_v4_core0.$strip> & SchemaHasDefaultValue;
21
+ commonPlayCount: zod.ZodObject<{
22
+ readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
23
+ readonly delta: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
24
+ }, zod_v4_core0.$strip> & SchemaHasDefaultValue;
25
+ commonEpisodes: zod.ZodBoolean & SchemaHasDefaultValue;
16
26
  items: zod.ZodArray<zod.ZodObject<{
17
- title: zod.ZodString;
18
- description: zod.ZodOptional<zod.ZodString>;
19
- cover: zod.ZodOptional<zod.ZodString>;
20
- playCount: zod.ZodOptional<zod.ZodString>;
21
- showPlayCount: zod.ZodOptional<zod.ZodBoolean>;
22
- showEpisodes: zod.ZodOptional<zod.ZodBoolean>;
23
- episodesText: zod.ZodOptional<zod.ZodString>;
24
- badge: zod.ZodOptional<zod.ZodString>;
27
+ content: zod.ZodString & SchemaHasDefaultValue;
28
+ title: zod.ZodString & SchemaHasDefaultValue;
29
+ contentDescription: zod.ZodString & SchemaHasDefaultValue;
30
+ cover: zod.ZodString & SchemaHasDefaultValue;
31
+ useVideoPoster: zod.ZodBoolean & SchemaHasDefaultValue;
32
+ showPlayCount: zod.ZodBoolean & SchemaHasDefaultValue;
33
+ playCountDelta: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
34
+ showEpisodes: zod.ZodBoolean & SchemaHasDefaultValue;
35
+ badge: zod.ZodString & SchemaHasDefaultValue;
25
36
  }, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
26
37
  }, zod_v4_core0.$strip>, "video-horizontal-list">;
27
38
  //#endregion
@@ -9,31 +9,27 @@ import { z } from "zod";
9
9
  */
10
10
  declare const videoHorizontalListInspectorPropsSchema: z.ZodObject<{
11
11
  title: z.ZodString & SchemaHasDefaultValue;
12
+ moduleCount: z.ZodNumber & SchemaHasDefaultValue;
13
+ layout: z.ZodObject<{
14
+ readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
15
+ readonly tag: z.ZodOptional<z.ZodString> & SchemaHasDefaultValue;
16
+ }, z.core.$strip> & SchemaHasDefaultValue;
17
+ commonPlayCount: z.ZodObject<{
18
+ readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
19
+ readonly delta: z.ZodOptional<z.ZodString> & SchemaHasDefaultValue;
20
+ }, z.core.$strip> & SchemaHasDefaultValue;
21
+ commonEpisodes: z.ZodBoolean & SchemaHasDefaultValue;
12
22
  items: z.ZodArray<z.ZodObject<{
13
- title: z.ZodString;
14
- description: z.ZodOptional<z.ZodString>;
15
- cover: z.ZodOptional<z.ZodString>;
16
- playCount: z.ZodOptional<z.ZodString>;
17
- showPlayCount: z.ZodOptional<z.ZodBoolean>;
18
- showEpisodes: z.ZodOptional<z.ZodBoolean>;
19
- episodesText: z.ZodOptional<z.ZodString>;
20
- badge: z.ZodOptional<z.ZodString>;
23
+ content: z.ZodString & SchemaHasDefaultValue;
24
+ title: z.ZodString & SchemaHasDefaultValue;
25
+ contentDescription: z.ZodString & SchemaHasDefaultValue;
26
+ cover: z.ZodString & SchemaHasDefaultValue;
27
+ useVideoPoster: z.ZodBoolean & SchemaHasDefaultValue;
28
+ showPlayCount: z.ZodBoolean & SchemaHasDefaultValue;
29
+ playCountDelta: z.ZodOptional<z.ZodString> & SchemaHasDefaultValue;
30
+ showEpisodes: z.ZodBoolean & SchemaHasDefaultValue;
31
+ badge: z.ZodString & SchemaHasDefaultValue;
21
32
  }, z.core.$strip>> & SchemaHasDefaultValue;
22
33
  }, z.core.$strip>;
23
- declare const videoHorizontalListInspectorDefaultProps: {
24
- title: string;
25
- items: {
26
- title: string;
27
- description?: string | undefined;
28
- cover?: string | undefined;
29
- playCount?: string | undefined;
30
- showPlayCount?: boolean | undefined;
31
- showEpisodes?: boolean | undefined;
32
- episodesText?: string | undefined;
33
- badge?: string | undefined;
34
- }[];
35
- };
36
- type VideoHorizontalListInspectorProps = z.infer<typeof videoHorizontalListInspectorPropsSchema>;
37
- type VideoHorizontalListProps = VideoHorizontalListInspectorProps;
38
34
  //#endregion
39
- export { VideoHorizontalListInspectorProps, VideoHorizontalListProps, videoHorizontalListInspectorDefaultProps, videoHorizontalListInspectorPropsSchema };
35
+ export { videoHorizontalListInspectorPropsSchema };
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineTextPropSchema as n,getSchemaDefaultProps as r}from"../../../../utils/schema/schema.mjs";import{z as i}from"zod";const a=i.object({title:i.string(),description:i.string().optional(),cover:i.string().optional(),playCount:i.string().optional(),showPlayCount:i.boolean().optional(),showEpisodes:i.boolean().optional(),episodesText:i.string().optional(),badge:i.string().optional()}),o=t({title:n({label:`推荐位名称`,defaultValue:`推荐视频`}),items:e(a,{label:`推荐位模块`,defaultValue:[]})}),s=r(o);export{s as videoHorizontalListInspectorDefaultProps,o as videoHorizontalListInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineObjectPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a}from"../../../../utils/schema/schema.mjs";import{z as o}from"zod";const s=o.object({content:a({label:`推荐位内容`,defaultValue:``}),title:a({label:`推荐位内容名称`,defaultValue:`视频标题`}),contentDescription:a({label:`内容说明简介`,defaultValue:``}),cover:a({label:`推荐位封面`,defaultValue:``}),useVideoPoster:i({label:`沿用视频海报`,defaultValue:!0}),showPlayCount:i({label:`播放量显示`,defaultValue:!0}),playCountDelta:a({label:`播放量浮动`,defaultValue:``,required:!1}),showEpisodes:i({label:`集数展示`,defaultValue:!0}),badge:a({label:`推荐位角标`,defaultValue:``})}),c=t({title:a({label:`推荐位名称`,defaultValue:`推荐视频`}),moduleCount:n({label:`推荐模块数`,defaultValue:1}),layout:r({enabled:i({label:`组件铺设`,defaultValue:!1}),tag:a({label:`取数范围标签`,defaultValue:`动作`,required:!1})},{label:`组件铺设`,defaultValue:{enabled:!1,tag:`动作`}}),commonPlayCount:r({enabled:i({label:`通用播放量`,defaultValue:!0}),delta:a({label:`播放量浮动值`,defaultValue:``,required:!1})},{label:`通用播放量`,defaultValue:{enabled:!0,delta:``}}),commonEpisodes:i({label:`通用集数`,defaultValue:!0}),items:e(s,{label:`推荐位模块`,defaultValue:[{content:``,title:`视频标题 1`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{content:``,title:`视频标题 2`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{content:``,title:`视频标题 3`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``}]})});export{c as videoHorizontalListInspectorPropsSchema};
@@ -1,5 +1,5 @@
1
1
 
2
- import { VideoHorizontalListProps } from "./schema.mjs";
2
+ import { VideoHorizontalListProps } from "./client.mjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region components/biz/business/video-horizontal-list/server.d.ts
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{AlertDialog as e,AlertDialogAction as t,AlertDialogCancel as n,AlertDialogContent as r,AlertDialogDescription as i,AlertDialogHeader as a,AlertDialogTitle as o}from"../../ui/alert-dialog.mjs";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{useTranslations as l}from"next-intl";function u({open:u,onOpenChange:d,onConfirm:f,onCancel:p,title:m,description:h,confirmText:g,cancelText:_,isConfirming:v=!1,children:y}){let b=l(`components.common`),x=m??b(`title`),S=h??b(`deleteConfirmDialog.description`),C=g??b(`deleteConfirmDialog.confirm`),w=_??b(`deleteConfirmDialog.cancel`);function T(e){e||p?.(),d(e)}function E(){v||f()}return s(e,{open:u,onOpenChange:T,children:c(r,{size:`sm`,className:`max-w-[330px] gap-0 p-0 overflow-hidden rounded-lg bg-bg1 shadow-2xl`,children:[c(a,{className:`flex flex-col items-center justify-center min-h-[110px] p-4 gap-2 text-center`,children:[s(o,{className:`text-[16px] font-normal leading-[24px] text-text1`,style:{fontFamily:`"Source Code Pro", sans-serif`},children:x}),S&&s(i,{className:`text-[14px] leading-[20px] text-text2`,children:S})]}),y,c(`div`,{className:`grid grid-cols-[1fr_1px_1fr] items-center h-[46px] border-t border-line1/5`,children:[s(n,{disabled:v,className:`h-full rounded-none border-none bg-transparent hover:bg-line1/10 text-[16px] font-normal text-text1 outline-none active:opacity-70 transition-opacity`,style:{fontFamily:`"Source Code Pro", sans-serif`},children:w}),s(`div`,{className:`h-[22px] w-px bg-line1/30`}),s(t,{disabled:v,onClick:E,className:`h-full rounded-none border-none bg-transparent hover:bg-line1/10 text-[16px] font-normal text-[#fd4c5e] outline-none active:opacity-70 transition-opacity`,style:{fontFamily:`"Source Code Pro", sans-serif`},children:C})]})]})})}export{u as DeleteConfirmDialog};
2
+ "use client";import{AlertDialog as e,AlertDialogAction as t,AlertDialogCancel as n,AlertDialogContent as r,AlertDialogDescription as i,AlertDialogHeader as a,AlertDialogTitle as o}from"../../ui/alert-dialog.mjs";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{useTranslations as l}from"next-intl";function u({open:u,onOpenChange:d,onConfirm:f,onCancel:p,title:m,description:h,confirmText:g,cancelText:_,isConfirming:v=!1,children:y}){let b=l(`components.common`),x=m??(m===``?``:b(`title`)),S=h??b(`deleteConfirmDialog.description`),C=g??b(`deleteConfirmDialog.confirm`),w=_??b(`deleteConfirmDialog.cancel`);function T(e){e||p?.(),d(e)}function E(){v||f()}return s(e,{open:u,onOpenChange:T,children:c(r,{size:`sm`,className:`max-w-[330px] gap-0 p-0 overflow-hidden rounded-lg bg-bg1 shadow-2xl`,children:[c(a,{className:`flex flex-col items-center justify-center min-h-[110px] p-4 gap-2 text-center`,children:[x&&s(o,{className:`text-[16px] font-normal leading-[24px] text-text1`,style:{fontFamily:`"Source Code Pro", sans-serif`},children:x}),S&&s(i,{className:`text-[16px] leading-[24px] text-text2`,children:S})]}),y,c(`div`,{className:`grid grid-cols-[1fr_1px_1fr] items-center h-[46px] border-t border-line1`,children:[s(n,{disabled:v,className:`h-full rounded-none border-none bg-transparent hover:bg-line1/10 text-[16px] font-normal text-text1 outline-none active:opacity-70 transition-opacity`,style:{fontFamily:`"Source Code Pro", sans-serif`},children:w}),s(`div`,{className:`h-[22px] w-px bg-line1`}),s(t,{disabled:v,onClick:E,className:`h-full rounded-none border-none bg-transparent hover:bg-line1/10 text-[16px] font-normal text-theme5 outline-none active:opacity-70 transition-opacity`,style:{fontFamily:`"Source Code Pro", sans-serif`},children:C})]})]})})}export{u as DeleteConfirmDialog};
@@ -10,6 +10,7 @@ interface CollectionListMediaItem {
10
10
  isVideo?: boolean;
11
11
  isMovie?: boolean;
12
12
  videoDuration?: number;
13
+ isPlaceholder?: boolean;
13
14
  }
14
15
  interface CollectionListItemProps {
15
16
  /** 合集 ID。 */
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import{RightArrowIcon as r}from"../../icons/right-arrow.mjs";import{Fragment as i,jsx as a,jsxs as o}from"react/jsx-runtime";import{useTranslations as s}from"next-intl";import c from"next/link";const l=[];function u({size:e=12}){return a(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`currentColor`,children:a(`path`,{d:`M8 5v14l11-7z`})})}function d(e){if(!e)return``;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`}function f(f){let p=s(`components.common.list.collectionList`),{id:m,title:h,contentCount:g,contents:_=l}=f,v=_.slice(0,3);return o(t,{className:`bg-bg1 rounded-lg py-3`,children:[o(t,{className:`flex items-center justify-between mb-3 gap-2`,children:[a(n,{className:`text-sm text-text1 font-medium line-clamp-1`,children:h}),o(c,{href:`/collection/${m}`,className:`flex items-center shrink-0 gap-1 text-text3`,children:[o(n,{className:`text-xs`,children:[g,p(`collectionListItem.contentCountSuffix`)]}),a(r,{})]})]}),a(t,{className:`grid grid-cols-3 gap-2`,children:v.map((r,s)=>o(c,{href:`/${r.contentType===1?`video`:`post`}/${r.id}`,className:`flex flex-col gap-1`,children:[o(t,{className:`relative aspect-video rounded-md overflow-hidden bg-gray-100`,children:[a(e,{src:r.coverImage||`/empty/default-cover.png`,alt:r.title||h,fill:!0,className:`object-cover`}),r.isVideo&&o(i,{children:[a(t,{className:`absolute inset-0 flex items-center justify-center bg-black/20`,children:a(t,{className:`w-6 h-6 rounded-full bg-white/80 flex items-center justify-center`,children:a(u,{size:12})})}),r.isMovie&&a(t,{className:`absolute bottom-1 left-1 rounded-xs bg-black/60 px-1 text-[10px] text-white`,children:p(`collectionListItem.movieLabel`)}),r.videoDuration&&a(t,{className:`absolute bottom-1 right-1 rounded-xs bg-black/60 px-1 text-[10px] text-white`,children:d(r.videoDuration)})]})]}),a(t,{className:`flex items-center justify-between gap-1`,children:a(n,{className:`text-xs text-text1 line-clamp-1`,dangerouslySetInnerHTML:{__html:r.title||``}})})]},r.id??`${h}-${s}`))})]})}export{f as CollectionListItem};
2
+ "use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import{RightArrowIcon as r}from"../../icons/right-arrow.mjs";import{Fragment as i,jsx as a,jsxs as o}from"react/jsx-runtime";import{useTranslations as s}from"next-intl";import c from"next/link";const l=[];function u({size:e=12}){return a(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`currentColor`,children:a(`path`,{d:`M8 5v14l11-7z`})})}function d(e){if(!e)return``;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`}function f(f){let p=s(`components.common.list.collectionList`),{id:m,title:h,contentCount:g,contents:_=l}=f,v=_.slice(0,3);return o(t,{className:`bg-bg1 rounded-lg py-3`,children:[o(t,{className:`flex items-center justify-between mb-3 gap-2`,children:[a(n,{className:`text-sm text-text1 font-medium line-clamp-1`,children:h}),o(c,{href:`/collection/${m}`,className:`flex items-center shrink-0 gap-1 text-text3`,children:[o(n,{className:`text-xs`,children:[g,p(`collectionListItem.contentCountSuffix`)]}),a(r,{})]})]}),a(t,{className:`grid grid-cols-3 gap-2`,children:v.map((r,s)=>r.isPlaceholder?a(t,{className:`aspect-video rounded-md bg-bg2`},r.id??`${h}-${s}`):o(c,{href:`/${r.contentType===1?`video`:`post`}/${r.id}`,className:`flex flex-col gap-1`,children:[o(t,{className:`relative aspect-video rounded-md overflow-hidden bg-gray-100`,children:[a(e,{src:r.coverImage||`/empty/default-cover.png`,alt:r.title||h,fill:!0,className:`object-cover`}),r.isVideo&&o(i,{children:[a(t,{className:`absolute inset-0 flex items-center justify-center bg-black/20`,children:a(t,{className:`w-6 h-6 rounded-full bg-white/80 flex items-center justify-center`,children:a(u,{size:12})})}),r.isMovie&&a(t,{className:`absolute bottom-1 left-1 rounded-xs bg-black/60 px-1 text-[10px] text-white`,children:p(`collectionListItem.movieLabel`)}),r.videoDuration&&a(t,{className:`absolute bottom-1 right-1 rounded-xs bg-black/60 px-1 text-[10px] text-white`,children:d(r.videoDuration)})]})]}),a(t,{className:`flex items-center justify-between gap-1`,children:a(n,{className:`text-xs text-text1 line-clamp-1`,dangerouslySetInnerHTML:{__html:r.title||``}})})]},r.id??`${h}-${s}`))})]})}export{f as CollectionListItem};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Button as e}from"../../ui/button.mjs";import{parseResolution as t}from"../../../utils/common.mjs";import n from"../../../utils/event-bus.mjs";import r from"../video-player/index.mjs";import{eventKey as i}from"../../../constants/event-key.mjs";import a from"./popup-video.module.mjs";import{useCallback as o,useEffect as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{usePathname as d}from"next/navigation";function f(){let f=d(),[p,m]=c(!1),[h,g]=c(null),[_,v]=c(0),y=o(e=>{if(typeof window>`u`)return 0;let{width:n,height:r}=t(e.resolution);return n<=0?0:Math.max(0,r*(window.innerWidth/n))},[]),b=o(({info:e,show:t})=>{if(!e||!t){m(!1),g(null);return}g(e),v(y(e)),m(!0)},[y]);return s(()=>(n.on(i.SHOW_POPUP_VIDEO,b),()=>{n.off(i.SHOW_POPUP_VIDEO,b)}),[b]),s(()=>{m(!1),g(null)},[f]),!p||!h?null:u(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center bg-black/95`,children:[l(e,{variant:`ghost`,className:`absolute left-4 top-4 h-10 w-10 rounded-full border border-white/20 text-white`,onClick:()=>{m(!1),g(null)},children:`←`}),l(`div`,{className:a.popupVideo,style:{width:`100%`,maxHeight:`100%`,height:_>0?`${_}px`:`auto`},children:l(r,{plyerId:h.plyerId,resolution:h.resolution,poster:h.poster||``,videoUrl:h.videoUrl||``,hlsList:h.hlsList,mergeConfig:_>0?{}:{fitVideoSize:`fixWidth`}})})]})}export{f as default};
2
+ "use client";import{Button as e}from"../../ui/button.mjs";import{parseResolution as t}from"../../../utils/common.mjs";import n from"../../../utils/event-bus.mjs";import{eventKey as r}from"../../../constants/event-key.mjs";import i from"../video-player/index.mjs";import a from"./popup-video.module.mjs";import{useCallback as o,useEffect as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{usePathname as d}from"next/navigation";function f(){let f=d(),[p,m]=c(!1),[h,g]=c(null),[_,v]=c(0),y=o(e=>{if(typeof window>`u`)return 0;let{width:n,height:r}=t(e.resolution);return n<=0?0:Math.max(0,r*(window.innerWidth/n))},[]),b=o(({info:e,show:t})=>{if(!e||!t){m(!1),g(null);return}g(e),v(y(e)),m(!0)},[y]);return s(()=>(n.on(r.SHOW_POPUP_VIDEO,b),()=>{n.off(r.SHOW_POPUP_VIDEO,b)}),[b]),s(()=>{m(!1),g(null)},[f]),!p||!h?null:u(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center bg-black/95`,children:[l(e,{variant:`ghost`,className:`absolute left-4 top-4 h-10 w-10 rounded-full border border-white/20 text-white`,onClick:()=>{m(!1),g(null)},children:`←`}),l(`div`,{className:a.popupVideo,style:{width:`100%`,maxHeight:`100%`,height:_>0?`${_}px`:`auto`},children:l(i,{plyerId:h.plyerId,resolution:h.resolution,poster:h.poster||``,videoUrl:h.videoUrl||``,hlsList:h.hlsList,mergeConfig:_>0?{}:{fitVideoSize:`fixWidth`}})})]})}export{f as default};
@@ -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{useRequest as a}from"../../../hooks/query/use-query.mjs";import{useLoginModalStore as o}from"../../../store/modules/login-modal-store.mjs";import{useKeepAliveState as s}from"../../common/keep-scroll-position/index.mjs";import{batchQueryContentInteractions as c}from"../../../hooks/use-content-operate.mjs";import l from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import{queryKey as u}from"../../../constants/query-key.mjs";import ee from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{SeriesEpisodes as d}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}=a([u.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]=s(`${M}-active-index`,ce),[P,ue]=s(`${M}-user-interacted`,!1),[de,fe]=s(`${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(ee,{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}=a(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}=a(p(()=>[`feed-series-interactions`,T,O],[O,T]),async()=>await c([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(()=>{o.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(l,{items:K,activeIndex:N,top:R,videoConfig:{loop:!1,autoNext:!0},userInteracted:P,onUserInteracted:()=>ue(!0),onActiveIndexChange:Q,onDataUpdate:me,getNavigationInfo:he,currentUserId:D.userId||void 0,followIds:ie,onFollowIdsChange:ae,commentContentId:T,onRequireLogin:pe,activeEpisodeId:$}),F&&g(d,{mode:`selector`,variant:`sheet`,open:F,title:S(`feedSeriesClient.episodeSelectorTitle`),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{useRequest as a}from"../../../hooks/query/use-query.mjs";import{useLoginModalStore as o}from"../../../store/modules/login-modal-store.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 ee from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{SeriesEpisodes as d}from"../../common/series-episodes/index.mjs";import{useCallback as f,useEffect as te,useLayoutEffect as p,useMemo as m,useRef as ne,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 x(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 S({params:b,initialContents:S}){let C=y(`components.pages.feedSeries`),w=y(`components.common.seriesEpisodes`),{locale:T,seriesId:E,episodeNum:D=`1`}=b,{userInfo:re,isLogin:O}=n(),{followIds:ie,setFollowIds:k}=t(),A=m(()=>S??[],[S]),[j,M]=h({}),{data:ae}=a([s.CHANNEL],()=>r()),oe=e(ae?.data),N=m(()=>`feed-series:${T||`default`}:${E}`,[T,E]),se=m(()=>{let e=Number.parseInt(D??`1`,10);return Number.isNaN(e)?0:Math.max(0,e-1)},[D]),[P,ce]=c(`${N}-active-index`,se),[le,ue]=c(`${N}-user-interacted`,!1),[de,fe]=c(`${N}-series-title-toggle`,!1),[F,I]=h(!1),L=ne(null),[R,z]=h(0),B=_(`div`,{ref:L,className:`fixed top-0 left-0 right-0 z-40`,children:_(ee,{data:{list:oe}})});p(()=>{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}=a(m(()=>[`feed-series-detail`,E],[E]),async()=>E?await i({id:E}):null,{enabled:!!E&&A.length===0}),U=m(()=>V?.data?.video,[V]),W=m(()=>U?x(U,E,e=>w(`episodeLabel`,{episode:e})):null,[U,E,w]),G=m(()=>A.length>0?A:W?.contents??[],[W?.contents,A]),K=m(()=>Object.keys(j).length===0?G:G.map(e=>{let t=j[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,j]),q=W?.seriesTitle??(A[0]?.name||``),J=W?.seriesList??[],{data:Y}=a(m(()=>[`feed-series-interactions`,E,O],[O,E]),async()=>await l([E],1),{enabled:!!O&&!!E}),X=m(()=>Y?.interaction_list,[Y]);te(()=>{if(!X||X.length===0)return;let e=X.find(e=>e.content_id===E)||X[0];e&&M(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,E]);let Z=f(({})=>{},[]),pe=f(()=>{o.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;M(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)=>{ce(e),Z({episodeId:E,episodeNum:e+1,mode:t===`jump`?`replace`:`push`})},[Z,E]),he=f(()=>({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 E?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:[C(`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:C(`feedSeriesClient.noEpisodes`)})]}):v(g,{children:[B,_(u,{items:K,activeIndex:P,top:R,videoConfig:{loop:!1,autoNext:!0},userInteracted:le,onUserInteracted:()=>ue(!0),onActiveIndexChange:Q,onDataUpdate:me,getNavigationInfo:he,currentUserId:re.userId||void 0,followIds:ie,onFollowIdsChange:k,commentContentId:E,onRequireLogin:pe,activeEpisodeId:$}),F&&_(d,{mode:`selector`,variant:`sheet`,open:F,title:C(`feedSeriesClient.episodeSelectorTitle`),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`)}})]}):v(g,{children:[B,v(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:[C(`feedSeriesClient.missingEpisode`),` `,`ID`]})]})}export{S 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{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{useRequest as a}from"../../../hooks/query/use-query.mjs";import{useRequireLogin as o}from"../../../hooks/use-auth.mjs";import{useKeepAliveState as s}from"../../common/keep-scroll-position/index.mjs";import{queryKey as c}from"../../../constants/query-key.mjs";import{extractDataByComponentType as l}from"../../biz/utils/transformers/data.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";import{useRouter as _}from"next/navigation";const v=`app-scroll-container`;function y(e){return typeof document>`u`?null:document.getElementById(e)}function b(){if(typeof document>`u`)return 0;let e=document.querySelector(`[data-top-nav-root="true"]`);return e&&e.getBoundingClientRect().height||0}function x({currentChannelId:x,isPGC:S}){let C=_(),w=o(),{data:T}=a(c.GET_CONTENT_LIST(x),()=>e({channel_id:x})),{data:E}=a([c.FLOATING_BALL],()=>n()),D=f(()=>T?.data?.blocks||[],[T?.data?.blocks]),O=f(()=>{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}=a([c.GUESS_YOU_LIKE_USER_DATA,O.blockId],()=>t({block_id:O.blockId}),{enabled:!!O.blockId}),A=f(()=>{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]=s(`home-scroll-top-${x}`,0),N=p(null),P=p({restored:!1,lastScrollTop:j,key:x,rafId:null}),F=p(M),I=p(j);u(()=>{F.current=M},[M]),u(()=>{I.current=j},[j]),u(()=>{P.current.key!==x&&(P.current.restored=!1,P.current.lastScrollTop=j,I.current=j,P.current.key=x)},[x,j]);let L=A.length>0;d(()=>{if(!L)return;N.current=y(v);let e=N.current;if(!e||P.current.restored||j<=0)return;let t=b(),n=Math.max(0,j+t);window.requestAnimationFrame(()=>{e.scrollTop=n,P.current.restored=!0,P.current.lastScrollTop=n})},[L,x,j]),u(()=>{N.current=y(v);let e=N.current;if(!e)return;function t(){P.current.restored=!0,P.current.rafId!==null&&window.cancelAnimationFrame(P.current.rafId),P.current.rafId=window.requestAnimationFrame(()=>{P.current.rafId=null;let e=N.current;if(!e)return;let t=e.scrollTop||0,n=b(),r=Math.max(0,t-n);Math.abs(t-P.current.lastScrollTop)>1&&(P.current.lastScrollTop=t,F.current(r))})}e.addEventListener(`scroll`,t,{passive:!0});let n=P.current.rafId;return()=>{n!==null&&window.cancelAnimationFrame(n),e.removeEventListener(`scroll`,t)}},[x]);let R=f(()=>l(A,S),[A,S]),z=f(()=>E?.data?.ball_infos?.find(e=>e.channel_id===x),[E?.data?.ball_infos,x]);return g(m,{children:[z&&h(i,{className:`fixed right-[20px] bottom-[80px] w-[52px] h-[52px] z-30 rounded-[16px] cursor-move select-none bg-[#FD4C5E33] overflow-hidden`,onClick:()=>{w(()=>{z?.jump_url&&C.push(z.jump_url)})},children:h(r,{src:z.material_url||``,alt:z.name||``,fill:!0,priority:!0,fetchPriority:`high`,sizes:`52px`,unoptimized:!0})}),R.map(e=>{let t=e.component,n=e.data.block_id||`block-${e.data.title||``}`;return h(t,{data:e.data},n)})]})}export{x as default};
2
+ "use client";import{gContentGetAppChannelBlock as e,gContentGetAppChannelBlockData as t,gContentListVisibleFloatingBall as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{useRequest as a}from"../../../hooks/query/use-query.mjs";import{useRequireLogin as o}from"../../../hooks/use-auth.mjs";import{queryKey as s}from"../../../constants/query-key.mjs";import{useKeepAliveState as c}from"../../common/keep-scroll-position/index.mjs";import{extractDataByComponentType as l}from"../../biz/utils/transformers/data.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";import{useRouter as _}from"next/navigation";const v=`app-scroll-container`;function y(e){return typeof document>`u`?null:document.getElementById(e)}function b(){if(typeof document>`u`)return 0;let e=document.querySelector(`[data-top-nav-root="true"]`);return e&&e.getBoundingClientRect().height||0}function x({currentChannelId:x,isPGC:S}){let C=_(),w=o(),{data:T}=a(s.GET_CONTENT_LIST(x),()=>e({channel_id:x})),{data:E}=a([s.FLOATING_BALL],()=>n()),D=f(()=>T?.data?.blocks||[],[T?.data?.blocks]),O=f(()=>{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}=a([s.GUESS_YOU_LIKE_USER_DATA,O.blockId],()=>t({block_id:O.blockId}),{enabled:!!O.blockId}),A=f(()=>{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]=c(`home-scroll-top-${x}`,0),N=p(null),P=p({restored:!1,lastScrollTop:j,key:x,rafId:null}),F=p(M),I=p(j);u(()=>{F.current=M},[M]),u(()=>{I.current=j},[j]),u(()=>{P.current.key!==x&&(P.current.restored=!1,P.current.lastScrollTop=j,I.current=j,P.current.key=x)},[x,j]);let L=A.length>0;d(()=>{if(!L)return;N.current=y(v);let e=N.current;if(!e||P.current.restored||j<=0)return;let t=b(),n=Math.max(0,j+t);window.requestAnimationFrame(()=>{e.scrollTop=n,P.current.restored=!0,P.current.lastScrollTop=n})},[L,x,j]),u(()=>{N.current=y(v);let e=N.current;if(!e)return;function t(){P.current.restored=!0,P.current.rafId!==null&&window.cancelAnimationFrame(P.current.rafId),P.current.rafId=window.requestAnimationFrame(()=>{P.current.rafId=null;let e=N.current;if(!e)return;let t=e.scrollTop||0,n=b(),r=Math.max(0,t-n);Math.abs(t-P.current.lastScrollTop)>1&&(P.current.lastScrollTop=t,F.current(r))})}e.addEventListener(`scroll`,t,{passive:!0});let n=P.current.rafId;return()=>{n!==null&&window.cancelAnimationFrame(n),e.removeEventListener(`scroll`,t)}},[x]);let R=f(()=>l(A,S),[A,S]),z=f(()=>E?.data?.ball_infos?.find(e=>e.channel_id===x),[E?.data?.ball_infos,x]);return g(m,{children:[z&&h(i,{className:`fixed right-[20px] bottom-[80px] w-[52px] h-[52px] z-30 rounded-[16px] cursor-move select-none bg-[#FD4C5E33] overflow-hidden`,onClick:()=>{w(()=>{z?.jump_url&&C.push(z.jump_url)})},children:h(r,{src:z.material_url||``,alt:z.name||``,fill:!0,priority:!0,fetchPriority:`high`,sizes:`52px`,unoptimized:!0})}),R.map(e=>{let t=e.component,n=e.data.block_id||`block-${e.data.title||``}`;return h(t,{data:e.data},n)})]})}export{x as default};
@@ -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{useKeepAliveEffect as u,useKeepAliveState as d}from"../../common/keep-scroll-position/index.mjs";import{apiCollectClick as f}from"../../../utils/api-collect.mjs";import{batchQueryContentInteractions as ee}from"../../../hooks/use-content-operate.mjs";import{queryKey as p}from"../../../constants/query-key.mjs";import m from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{DetailFollowAction as te}from"../../biz/business/detail/detail-follow-action.mjs";import{DetailOperate as ne}from"../../biz/business/detail/detail-operate.mjs";import{PostRecommendList as re}from"../../biz/business/detail/post-recommend-list.mjs";import{DetailHero as h}from"../../biz/business/detail/video-hero.mjs";import g from"../../biz/business/comment/comment-list.mjs";import ie from"../../common/info-card/card-header.mjs";import _ from"../../common/info-card/card-text.mjs";import{useCallback as ae,useEffect as v,useMemo as y}from"react";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";import{useTranslations as C}from"next-intl";import{useSearchParams as oe}from"next/navigation";function se(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=C(`components.pages.postDetail`),k=oe(),{isLogin:ue,userInfo:de,userId:fe}=t(),A=fe||de?.userId||``;l({contentId:f,contentType:2,enabled:!!f,enableIntervalReport:!1,enableExitReport:!1});let{data:j}=c(y(()=>[`post-detail`,f],[f]),async()=>f?await r({content_id:f}):null,{enabled:!!f}),M=y(()=>{let e=j?.data?.data;return se(e)},[j?.data?.data]),pe=w??M??null,{data:N}=c(y(()=>[`post-detail-recommend`,f],[f]),async()=>f?await i({page:1,page_size:6,sort_by:`recommend`}):null,{enabled:!!f}),P=y(()=>(N?.data?.data?.contents??[]).filter(e=>e.content_id!==f).slice(0,4).map(e=>ce(e)),[f,N?.data?.data?.contents]),F=le??P??[],[I,L]=d(`detail-information-${f}`,pe),[R,z]=d(`detail-recommend-${f}`,F),[B,V]=d(`info-detail-comment-add-count-${f}`,0),H=y(()=>I?.content_type===0,[I?.content_type]),U=y(()=>[`post-detail-comments`,f,1,5],[5,f]),{data:W}=c(U,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=W?.data?.data?.comments??[];if(e.length>0)return e},[W?.data?.data?.comments,T]),G=y(()=>{if(typeof E==`number`)return E;if(W?.data?.data)return typeof W?.data?.data?.total==`number`?W.data.data.total:void 0},[W?.data?.data,E]),K=y(()=>{if(typeof D==`boolean`)return D;if(W?.data?.data)return W?.data?.data?.has_more??!1},[W?.data?.data,D]),[q,J]=d(`post-detail-comment-total-${f}`,typeof E==`number`?E:void 0);v(()=>{typeof G==`number`&&J(e=>typeof e==`number`?Math.max(e,G):G)},[G,J]);let he=y(()=>[`detail-interaction`,I?.id,I?.content_type],[I?.content_type,I?.id]),Y=I?.up_user||``,ge=!!(A&&Y&&A===Y),_e=y(()=>[`detail-follow-status`,A,Y],[A,Y]),{data:X}=c(he,async()=>!I?.id||typeof I.content_type!=`number`?null:await ee([I.id],2),{enabled:!!I?.id}),{data:Z}=c(_e,async()=>!A||!Y?null:await o({app_id:0,follower_id:A,followee_ids:[Y]}),{enabled:!!ue&&!!A&&!!Y&&!ge});v(()=>{!I&&M&&L(M)},[I,M,L]),v(()=>{R.length===0&&P.length>0&&z(P)},[R.length,P,z]),v(()=>{if(!X?.interaction_list?.[0])return;let e=X.interaction_list[0];L(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,L]),v(()=>{if(!Z?.data||!Y)return;let e=!!Z.data?.is_following_map?.[Y];L(t=>!t||t.is_followed===e?t:{...t,is_followed:e})},[Z?.data,Y,L]);let Q=ae(e=>{L(t=>t&&{...t,...e})},[L]);u(()=>{I?.id&&I.id},[I?.id],`detail-page-report-${f}`),v(()=>{!I||typeof window>`u`||window.sensors?.track?.(`detail_page_view`,{object_id:I.id||f,author_id:I.up_user,object_type:I.content_type,object_category:I.content_type,object_tags:I.tags?.map(e=>e.name),block_id:``,page_source:window.location?.pathname||``})},[f,I]),v(()=>{V(0)},[I?.id,V]);let ve=y(()=>(typeof q==`number`?q:typeof G==`number`?G:0)+B,[B,q,G]);v(()=>{k?.get(`tab`)===`comment`&&(typeof window>`u`||window.requestAnimationFrame(()=>{document.getElementById(`detail-comments`)?.scrollIntoView({behavior:`smooth`,block:`start`})}))},[I?.id,k]);let $=I?.status===`2`,{data:ye}=c([p.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(m,{data:{list:e(ye?.data)}})}),x(`div`,{className:`mx-auto w-full max-w-[840px] pb-6`,children:S(b,{children:[I&&!$&&x(s,{type:`no-content`,text:O(`postDetailClient.postOffline`)}),I&&$&&S(b,{children:[H&&x(h,{information:I,isVideo:!0}),S(`article`,{className:`w-full`,children:[x(ie,{infoData:I,rightChild:x(te,{information:I,onUpdate:Q})}),x(_,{infoData:I,isEllipsis:!1}),!H&&x(`div`,{className:`mt-[12px]`,children:x(h,{information:I,isVideo:!1})})]}),x(ne,{information:I,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:[ve,O(`postDetailClient.reactions`)]})]}),x(g,{listQueryKey:U,contentId:I.id,information:I,isShow:!1,isClickLoad:!0,initialComments:me,initialTotal:G,initialHasMore:K,addCommentCount:()=>{V(e=>e+1)},onTotalChange:e=>{J(t=>typeof t==`number`?Math.max(t,e):e)}})]}),R.length>0&&x(re,{information:I,initRecommendList:R})]}),!I&&x(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{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/detail-follow-action.mjs";import{DetailOperate as ne}from"../../biz/business/detail/detail-operate.mjs";import{PostRecommendList as re}from"../../biz/business/detail/post-recommend-list.mjs";import{DetailHero as h}from"../../biz/business/detail/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{useTranslations as se}from"next-intl";import{useSearchParams as S}from"next/navigation";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=se(`components.pages.postDetail`),k=S(),{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};
@@ -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 ie}from"../../ui/alert-dialog.mjs";import{getAtUserElement as i}from"../../../utils/common.mjs";import ae from"../../../utils/event-bus.mjs";import{pCommunityPublishContent as oe}from"../../../service/generated/client.mjs";import{Box as se}from"../../ui/box.mjs";import{useKeyboardOpen as ce}from"../../../hooks/use-keyboard-open.mjs";import{useMediaPreview as a}from"../../common/media-preview/index.mjs";import o from"../../ui/popup.mjs";import{eventKey as s}from"../../../constants/event-key.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 le}from"./utils/publish-utils.mjs";import{PublishEditor as ue}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 f,useEffect as he,useMemo as ge,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 _e}from"next-intl";import{useRouter as v}from"next/navigation";function y({className:y}={}){let b=_e(`components.pages.publish`),ve=v(),x=p(null),[ye,S]=m(!1),[C,w]=m(`0`),{isOpen:T}=ce(),[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);he(()=>()=>{ae.emit(s.WAIT_LOADING_SHOW,{show:!1})},[]);let Y=f(e=>(Te(e),q(!0),new Promise(e=>{J.current=e})),[]),{selectFile:X}=me({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=ge(()=>(H.trim()===``||H.trim()===`<br>`)&&O.length===0&&!A,[H,O.length,A]),$=a(),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=`${i(e)}&nbsp;`;x.current?.insertHtml(t)},[G]),Pe=f(()=>{x.current?.saveSelection(),S(!0)},[]);return g(se,{className:e(`relative min-h-screen max-w-full bg-bg2 overflow-hidden flex flex-col`,y),children:[h(de,{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=le(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(ue,{ref:x,content:H,onContentChange:U,atUsers:W,onAtUsersChange:G}),E&&h(c,{currentFiles:E.currentFiles,totalFiles:E.totalFiles,currentTasks:E.currentTasks,totalTasks:E.totalTasks}),(O.length>0||A)&&h(fe,{materialList:O,videoUrl:A,videoDuration:I,coverUrl:M,originCoverUrl:P,isKeyboardOpen:T,onMaterialDelete:Ae,onVideoDelete:je,onMaterialAdd:Z,onCoverClick:Me,onPreview:ke}),h(pe,{isKeyboardOpen:T,onMaterialClick:()=>void Z(),onVideoClick:()=>void Ee(),onAtUserClick:Pe}),h(u,{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(ie,{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(o,{open:ye,onOpenChange:De,showCloseButton:!1,className:`w-full rounded-[8px] bg-bg2`,children:h(l,{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 ee,AlertDialogDescription as te,AlertDialogFooter as ne,AlertDialogHeader as re,AlertDialogTitle as ie}from"../../ui/alert-dialog.mjs";import{getAtUserElement as i}from"../../../utils/common.mjs";import ae from"../../../utils/event-bus.mjs";import{pCommunityPublishContent as oe}from"../../../service/generated/client.mjs";import{Box as se}from"../../ui/box.mjs";import{useKeyboardOpen as ce}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 le}from"./utils/publish-utils.mjs";import{PublishEditor as ue}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 f,useEffect as he,useMemo as ge,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 _e}from"next-intl";import{useRouter as v}from"next/navigation";function y({className:y}={}){let b=_e(`components.pages.publish`),ve=v(),x=p(null),[ye,S]=m(!1),[C,w]=m(`0`),{isOpen:T}=ce(),[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);he(()=>()=>{ae.emit(a.WAIT_LOADING_SHOW,{show:!1})},[]);let Y=f(e=>(Te(e),q(!0),new Promise(e=>{J.current=e})),[]),{selectFile:X}=me({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=ge(()=>(H.trim()===``||H.trim()===`<br>`)&&O.length===0&&!A,[H,O.length,A]),$=o(),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=`${i(e)}&nbsp;`;x.current?.insertHtml(t)},[G]),Pe=f(()=>{x.current?.saveSelection(),S(!0)},[]);return g(se,{className:e(`relative min-h-screen max-w-full bg-bg2 overflow-hidden flex flex-col`,y),children:[h(de,{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=le(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(ue,{ref:x,content:H,onContentChange:U,atUsers:W,onAtUsersChange:G}),E&&h(c,{currentFiles:E.currentFiles,totalFiles:E.totalFiles,currentTasks:E.currentTasks,totalTasks:E.totalTasks}),(O.length>0||A)&&h(fe,{materialList:O,videoUrl:A,videoDuration:I,coverUrl:M,originCoverUrl:P,isKeyboardOpen:T,onMaterialDelete:Ae,onVideoDelete:je,onMaterialAdd:Z,onCoverClick:Me,onPreview:ke}),h(pe,{isKeyboardOpen:T,onMaterialClick:()=>void Z(),onVideoClick:()=>void Ee(),onAtUserClick:Pe}),h(u,{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(ie,{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(s,{open:ye,onOpenChange:De,showCloseButton:!1,className:`w-full rounded-[8px] bg-bg2`,children:h(l,{onSelect:Ne,onClose:Oe})})]})}export{y as PublishPageClient};