pb-sxp-ui 1.20.14 → 1.20.16

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 (46) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +111 -111
  3. package/dist/index.cjs +959 -212
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.css +73 -72
  6. package/dist/index.js +959 -213
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.min.cjs +7 -7
  9. package/dist/index.min.cjs.map +1 -1
  10. package/dist/index.min.js +7 -7
  11. package/dist/index.min.js.map +1 -1
  12. package/dist/pb-ui.js +959 -212
  13. package/dist/pb-ui.js.map +1 -1
  14. package/dist/pb-ui.min.js +7 -7
  15. package/dist/pb-ui.min.js.map +1 -1
  16. package/es/core/components/DiyStoryPreview/index.js +10 -4
  17. package/es/core/components/StructurePage/index.d.ts +89 -0
  18. package/es/core/components/StructurePage/index.js +716 -0
  19. package/es/core/components/SxpPageRender/fakeData.js +1 -1
  20. package/es/core/components/SxpPageRender/index.js +10 -4
  21. package/es/core/context/SxpDataSourceProvider.js +4 -1
  22. package/es/core/hooks/useVisibleHeight.js +7 -7
  23. package/es/core/index.d.ts +2 -0
  24. package/es/core/index.js +1 -0
  25. package/es/core/utils/materials.d.ts +1 -1
  26. package/es/index.d.ts +1 -0
  27. package/es/index.js +1 -0
  28. package/es/materials/sxp/MultiPosts/index.js +4 -4
  29. package/es/materials/sxp/popup/CommodityDetail/index.js +4 -4
  30. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
  31. package/lib/core/components/DiyStoryPreview/index.js +10 -4
  32. package/lib/core/components/StructurePage/index.d.ts +89 -0
  33. package/lib/core/components/StructurePage/index.js +718 -0
  34. package/lib/core/components/SxpPageRender/fakeData.js +1 -1
  35. package/lib/core/components/SxpPageRender/index.js +10 -4
  36. package/lib/core/context/SxpDataSourceProvider.js +4 -1
  37. package/lib/core/hooks/useVisibleHeight.js +7 -7
  38. package/lib/core/index.d.ts +2 -0
  39. package/lib/core/index.js +6 -1
  40. package/lib/core/utils/materials.d.ts +1 -1
  41. package/lib/index.d.ts +1 -0
  42. package/lib/index.js +3 -1
  43. package/lib/materials/sxp/MultiPosts/index.js +4 -4
  44. package/lib/materials/sxp/popup/CommodityDetail/index.js +4 -4
  45. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +1 -1
  46. package/package.json +111 -111
package/dist/index.js CHANGED
@@ -656,6 +656,10 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
656
656
  const [popupDetailData, setPopupDetailData] = useState();
657
657
  const [waterFallData, setWaterFallData] = useState();
658
658
  const [openHashtag, setOpenHashtag] = useState(isOpenHashTag);
659
+ // 将 setPopupDetailData 挂载到 window 对象,供 StructurePage 使用
660
+ if (typeof window !== 'undefined') {
661
+ window.setPopupDetailData = setPopupDetailData;
662
+ }
659
663
  const [cacheRtcList, setCacheRtcList] = useState([]);
660
664
  const [cacheActiveIndex, setCacheActiveIndex] = useState(0);
661
665
  const [isFromHashtag, setIsFromHashtag] = useState(false);
@@ -1115,7 +1119,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1115
1119
  query.pageNum = pageNum;
1116
1120
  result = isDiyH5
1117
1121
  ? yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v3/recommend/direct/page/view', { method: 'POST', body: query }))
1118
- : yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('recommend/direct_page', { method: 'POST', body: query }));
1122
+ : yield (bffFetch === null || bffFetch === void 0 ? void 0 : bffFetch('v1/recommend/direct_page', { method: 'POST', body: query }));
1119
1123
  if (!(result === null || result === void 0 ? void 0 : result.success)) {
1120
1124
  return undefined;
1121
1125
  }
@@ -1343,6 +1347,7 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
1343
1347
  var _a;
1344
1348
  const prop = match.substring(2, match.length - 2);
1345
1349
  try {
1350
+ // eslint-disable-next-line no-new-func
1346
1351
  let replaceValue = new Function('fix_par', 'product', `return ${prop}`)(fix_par, product === null || product === void 0 ? void 0 : product[0]);
1347
1352
  if (replaceValue) {
1348
1353
  if ((prop === null || prop === void 0 ? void 0 : prop.indexOf('currency')) !== -1 &&
@@ -1926,9 +1931,839 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
1926
1931
  React.createElement(DataSourceProvider$1, { isSsr: isSsr, enable: enableDataSource }, children)));
1927
1932
  });
1928
1933
 
1934
+ const FormatImage = forwardRef((props, ref) => {
1935
+ const { src, onLoad, style, className, loading, alt = 'image' } = props;
1936
+ const [imgSrc, setImgSrc] = useState(src);
1937
+ const imgRef = useRef(null);
1938
+ const [visible, setVisible] = useState(false);
1939
+ useImperativeHandle(ref, () => ({
1940
+ setSrc: (v) => {
1941
+ if (v)
1942
+ setImgSrc(v);
1943
+ }
1944
+ }));
1945
+ useEffect(() => {
1946
+ if (src)
1947
+ setImgSrc(src);
1948
+ }, [src]);
1949
+ useEffect(() => {
1950
+ const onShow = () => {
1951
+ if (src && !visible && imgRef.current) {
1952
+ imgRef.current.src = '';
1953
+ imgRef.current.src = src;
1954
+ }
1955
+ };
1956
+ SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
1957
+ return () => {
1958
+ SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
1959
+ };
1960
+ }, [src, visible]);
1961
+ return (React.createElement(React.Fragment, null,
1962
+ !visible && !imgSrc && React.createElement("div", { style: { width: '100%', height: '100%', zIndex: 1, backgroundColor: '#fff' } }),
1963
+ (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
1964
+ React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
1965
+ React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
1966
+ React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
1967
+ React.createElement("img", { ref: imgRef, className: className, src: imgSrc, style: Object.assign({}, style), loading: loading, onLoad: (e) => {
1968
+ setVisible(true);
1969
+ onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
1970
+ }, alt: alt }))) : (React.createElement("img", { ref: imgRef, className: className, src: imgSrc, style: Object.assign({}, style), loading: loading, onLoad: (e) => {
1971
+ setVisible(true);
1972
+ onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
1973
+ }, alt: alt }))));
1974
+ });
1975
+ var FormatImage$1 = memo(FormatImage);
1976
+
1977
+ // 动态导入材料库(避免循环依赖)
1978
+ const RESOLVER$3 = {};
1979
+ try {
1980
+ // 尝试动态导入材料库
1981
+ const materialsModule = require('../../materials/sxp');
1982
+ if (materialsModule && typeof materialsModule === 'object') {
1983
+ Object.values(materialsModule).forEach((v) => {
1984
+ var _a;
1985
+ if ((_a = v === null || v === void 0 ? void 0 : v.extend) === null || _a === void 0 ? void 0 : _a.type) {
1986
+ RESOLVER$3[v.extend.type] = v;
1987
+ }
1988
+ });
1989
+ // 调试信息:记录成功加载的组件数量
1990
+ if (Object.keys(RESOLVER$3).length > 0) {
1991
+ console.log('[StructurePage] Successfully loaded materials:', Object.keys(RESOLVER$3));
1992
+ }
1993
+ else {
1994
+ console.warn('[StructurePage] Materials module loaded but no valid components found');
1995
+ }
1996
+ }
1997
+ else {
1998
+ console.warn('[StructurePage] Materials module is not a valid object:', materialsModule);
1999
+ }
2000
+ }
2001
+ catch (error) {
2002
+ console.error('[StructurePage] Failed to load materials for StructurePage:', error);
2003
+ }
2004
+ // 基础样式定义
2005
+ const baseStyles = {
2006
+ container: {
2007
+ backgroundColor: '#000',
2008
+ overflowY: 'auto',
2009
+ overflowX: 'hidden',
2010
+ padding: 0,
2011
+ boxSizing: 'border-box'
2012
+ },
2013
+ section: {
2014
+ width: '100%',
2015
+ position: 'relative',
2016
+ boxSizing: 'border-box'
2017
+ },
2018
+ // Hero Section
2019
+ heroSection: {
2020
+ width: '100%',
2021
+ height: 'auto',
2022
+ position: 'relative',
2023
+ overflow: 'hidden',
2024
+ backgroundColor: '#000'
2025
+ },
2026
+ heroTopText: {
2027
+ width: '100%',
2028
+ padding: '20px',
2029
+ backgroundColor: '#fff',
2030
+ color: '#000',
2031
+ fontSize: '16px',
2032
+ fontWeight: 'bold',
2033
+ textAlign: 'center',
2034
+ boxSizing: 'border-box'
2035
+ },
2036
+ heroImageContainer: {
2037
+ width: '100%',
2038
+ position: 'relative',
2039
+ overflow: 'hidden'
2040
+ },
2041
+ heroImage: {
2042
+ width: '100%',
2043
+ height: 'auto',
2044
+ display: 'block',
2045
+ objectFit: 'cover'
2046
+ },
2047
+ heroVideo: {
2048
+ width: '100%',
2049
+ height: 'auto',
2050
+ display: 'block',
2051
+ objectFit: 'cover'
2052
+ },
2053
+ heroOverlay: {
2054
+ position: 'absolute',
2055
+ bottom: 0,
2056
+ left: 0,
2057
+ right: 0,
2058
+ padding: '40px 20px',
2059
+ background: 'linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%)',
2060
+ color: '#fff',
2061
+ display: 'flex',
2062
+ justifyContent: 'center',
2063
+ alignItems: 'center'
2064
+ },
2065
+ heroButton: {
2066
+ padding: '12px 30px',
2067
+ backgroundColor: '#fff',
2068
+ color: '#000',
2069
+ border: 'none',
2070
+ fontSize: '14px',
2071
+ fontWeight: 500,
2072
+ cursor: 'pointer',
2073
+ textTransform: 'uppercase'
2074
+ },
2075
+ // Carousel Section
2076
+ carouselSection: {
2077
+ width: '100%',
2078
+ position: 'relative'
2079
+ },
2080
+ carouselImageContainer: {
2081
+ width: '100%',
2082
+ height: 'auto',
2083
+ position: 'relative',
2084
+ overflow: 'hidden'
2085
+ },
2086
+ carouselContainer: {
2087
+ display: 'flex',
2088
+ transition: 'transform 0.5s ease-in-out',
2089
+ width: '100%'
2090
+ },
2091
+ carouselSlide: {
2092
+ minWidth: '100%',
2093
+ position: 'relative'
2094
+ },
2095
+ carouselImage: {
2096
+ width: '100%',
2097
+ height: 'auto',
2098
+ display: 'block',
2099
+ objectFit: 'cover'
2100
+ },
2101
+ carouselVideo: {
2102
+ width: '100%',
2103
+ height: 'auto',
2104
+ display: 'block',
2105
+ objectFit: 'cover'
2106
+ },
2107
+ carouselInfoSection: {
2108
+ width: '100%',
2109
+ padding: '20px',
2110
+ backgroundColor: '#000',
2111
+ color: '#fff',
2112
+ textAlign: 'center'
2113
+ },
2114
+ carouselText: {
2115
+ fontSize: '16px',
2116
+ fontWeight: 'normal',
2117
+ marginBottom: '15px',
2118
+ color: '#fff'
2119
+ },
2120
+ carouselButton: {
2121
+ padding: '10px 25px',
2122
+ backgroundColor: '#fff',
2123
+ color: '#000',
2124
+ border: '1px solid #fff',
2125
+ fontSize: '13px',
2126
+ fontWeight: 500,
2127
+ cursor: 'pointer',
2128
+ textTransform: 'uppercase'
2129
+ },
2130
+ arrowButton: {
2131
+ position: 'absolute',
2132
+ top: '50%',
2133
+ transform: 'translateY(-50%)',
2134
+ width: '40px',
2135
+ height: '40px',
2136
+ backgroundColor: 'rgba(255,255,255,0.8)',
2137
+ border: 'none',
2138
+ borderRadius: '50%',
2139
+ fontSize: '18px',
2140
+ cursor: 'pointer',
2141
+ zIndex: 10,
2142
+ display: 'flex',
2143
+ alignItems: 'center',
2144
+ justifyContent: 'center'
2145
+ },
2146
+ // Highlight Reveal Section
2147
+ highlightSection: {
2148
+ width: '100%',
2149
+ position: 'relative',
2150
+ backgroundColor: '#000'
2151
+ },
2152
+ highlightImageContainer: {
2153
+ width: '100%',
2154
+ aspectRatio: '1/1',
2155
+ position: 'relative',
2156
+ overflow: 'hidden'
2157
+ },
2158
+ highlightImage: {
2159
+ width: '100%',
2160
+ height: '100%',
2161
+ objectFit: 'cover',
2162
+ display: 'block'
2163
+ },
2164
+ highlightInfoSection: {
2165
+ width: '100%',
2166
+ padding: '20px',
2167
+ backgroundColor: '#000',
2168
+ color: '#fff',
2169
+ textAlign: 'center'
2170
+ },
2171
+ highlightTitle: {
2172
+ fontSize: '18px',
2173
+ fontWeight: 'bold',
2174
+ marginBottom: '10px',
2175
+ textAlign: 'center',
2176
+ color: '#fff'
2177
+ },
2178
+ highlightDesc: {
2179
+ fontSize: '14px',
2180
+ marginBottom: '15px',
2181
+ textAlign: 'center',
2182
+ lineHeight: '1.5',
2183
+ color: '#ccc'
2184
+ },
2185
+ highlightButton: {
2186
+ padding: '10px 25px',
2187
+ backgroundColor: 'transparent',
2188
+ color: '#fff',
2189
+ border: '1px solid #fff',
2190
+ fontSize: '13px',
2191
+ fontWeight: 500,
2192
+ cursor: 'pointer',
2193
+ textTransform: 'uppercase'
2194
+ },
2195
+ // Product Grid Section
2196
+ productGrid: {
2197
+ display: 'grid',
2198
+ gridTemplateColumns: '50% 50%',
2199
+ gridAutoRows: 'auto',
2200
+ gap: '0',
2201
+ width: '100%',
2202
+ backgroundColor: '#000',
2203
+ boxSizing: 'border-box',
2204
+ margin: 0,
2205
+ padding: 0,
2206
+ overflow: 'hidden'
2207
+ },
2208
+ productItem: {
2209
+ position: 'relative',
2210
+ backgroundColor: '#000',
2211
+ display: 'block',
2212
+ boxSizing: 'border-box',
2213
+ width: '100%',
2214
+ minWidth: 0,
2215
+ overflow: 'hidden'
2216
+ },
2217
+ productImageContainer: {
2218
+ width: '100%',
2219
+ paddingBottom: '100%',
2220
+ position: 'relative',
2221
+ overflow: 'hidden'
2222
+ },
2223
+ productImage: {
2224
+ position: 'absolute',
2225
+ top: 0,
2226
+ left: 0,
2227
+ width: '100%',
2228
+ height: '100%',
2229
+ objectFit: 'cover',
2230
+ display: 'block'
2231
+ },
2232
+ productCtaContainer: {
2233
+ width: '100%',
2234
+ padding: '15px',
2235
+ backgroundColor: '#000',
2236
+ textAlign: 'center',
2237
+ boxSizing: 'border-box'
2238
+ },
2239
+ productText: {
2240
+ width: '100%',
2241
+ padding: '15px',
2242
+ backgroundColor: '#000',
2243
+ color: '#fff',
2244
+ textAlign: 'center',
2245
+ fontSize: '14px',
2246
+ fontWeight: 'normal',
2247
+ boxSizing: 'border-box'
2248
+ },
2249
+ productButton: {
2250
+ padding: '8px 20px',
2251
+ backgroundColor: 'transparent',
2252
+ color: '#fff',
2253
+ border: '1px solid #fff',
2254
+ fontSize: '12px',
2255
+ fontWeight: 500,
2256
+ cursor: 'pointer',
2257
+ textTransform: 'uppercase',
2258
+ whiteSpace: 'nowrap'
2259
+ },
2260
+ // Footer Section
2261
+ footerSection: {
2262
+ width: '100%',
2263
+ position: 'relative',
2264
+ backgroundColor: '#000'
2265
+ },
2266
+ footerInfoSection: {
2267
+ width: '100%',
2268
+ padding: '20px',
2269
+ backgroundColor: '#000',
2270
+ color: '#fff',
2271
+ textAlign: 'center'
2272
+ },
2273
+ footerText: {
2274
+ fontSize: '18px',
2275
+ fontWeight: 'normal',
2276
+ marginBottom: '15px',
2277
+ lineHeight: '1.4',
2278
+ color: '#fff'
2279
+ },
2280
+ footerButton: {
2281
+ padding: '10px 25px',
2282
+ backgroundColor: 'transparent',
2283
+ color: '#fff',
2284
+ border: '1px solid #fff',
2285
+ fontSize: '13px',
2286
+ fontWeight: 500,
2287
+ cursor: 'pointer',
2288
+ textTransform: 'uppercase',
2289
+ marginBottom: '20px',
2290
+ display: 'inline-block'
2291
+ },
2292
+ footerImageContainer: {
2293
+ width: '100%',
2294
+ aspectRatio: '1/1',
2295
+ overflow: 'hidden'
2296
+ },
2297
+ footerImage: {
2298
+ width: '100%',
2299
+ height: '100%',
2300
+ objectFit: 'cover',
2301
+ display: 'block'
2302
+ }
2303
+ };
2304
+ const StructurePage = (_a) => {
2305
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
2306
+ var { containerStyle, containerHeight = 664, containerWidth = 375, className = '', apiUrl = 'https://bff-be-dev.chatlabs.net/api/v1/recommend/list', requestBody, editorMode = false, multiCTAConfig: propMultiCTAConfig, videoPlayIcon: propVideoPlayIcon, isCmsMode = false, storyId, customHeaders } = _a, rest = __rest(_a, ["containerStyle", "containerHeight", "containerWidth", "className", "apiUrl", "requestBody", "editorMode", "multiCTAConfig", "videoPlayIcon", "isCmsMode", "storyId", "customHeaders"]);
2307
+ const [data, setData] = useState(null);
2308
+ const [loading, setLoading] = useState(true);
2309
+ const [error, setError] = useState(null);
2310
+ const [carouselIndex, setCarouselIndex] = useState(0);
2311
+ const heroVideoRef = useRef(null);
2312
+ const carouselVideoRefs = useRef([]);
2313
+ // 视频暂停状态管理
2314
+ const [isHeroVideoPaused, setIsHeroVideoPaused] = useState(false);
2315
+ const [carouselVideoPausedStates, setCarouselVideoPausedStates] = useState([]);
2316
+ // 从 schema 中获取 multiCTAConfig(优先使用 props 传入的)
2317
+ const { schema } = useEditor();
2318
+ const multiCTAConfig = useMemo(() => {
2319
+ var _a;
2320
+ return propMultiCTAConfig || ((_a = schema === null || schema === void 0 ? void 0 : schema.sxpPageConf) === null || _a === void 0 ? void 0 : _a.multiCTAConfig) || {};
2321
+ }, [propMultiCTAConfig, (_b = schema === null || schema === void 0 ? void 0 : schema.sxpPageConf) === null || _b === void 0 ? void 0 : _b.multiCTAConfig]);
2322
+ // 默认播放图标 URL(直接使用 CDN 地址作为后备)
2323
+ const DEFAULT_PAUSE_ICON = 'https://sxph5-uat.chatlabs.net/pb_static/06f28a2025c74c1cb49be6767316d827.png';
2324
+ // 获取视频播放图标
2325
+ const videoPlayIcon = useMemo(() => {
2326
+ var _a, _b;
2327
+ // 优先使用 props 传入的
2328
+ if (propVideoPlayIcon)
2329
+ return propVideoPlayIcon;
2330
+ // 然后使用 schema 配置的
2331
+ const configIcon = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema.sxpPageConf) === null || _a === void 0 ? void 0 : _a.globalConfig) === null || _b === void 0 ? void 0 : _b.videoPlayIcon;
2332
+ if (configIcon) {
2333
+ // 如果是完整 URL,直接使用
2334
+ if (configIcon.startsWith('http://') || configIcon.startsWith('https://')) {
2335
+ return configIcon;
2336
+ }
2337
+ // 如果是相对路径,拼接当前域名
2338
+ if (configIcon.startsWith('/')) {
2339
+ return `${window.location.origin}${configIcon}`;
2340
+ }
2341
+ return configIcon;
2342
+ }
2343
+ // 最后使用默认图标
2344
+ return DEFAULT_PAUSE_ICON;
2345
+ }, [propVideoPlayIcon, (_d = (_c = schema === null || schema === void 0 ? void 0 : schema.sxpPageConf) === null || _c === void 0 ? void 0 : _c.globalConfig) === null || _d === void 0 ? void 0 : _d.videoPlayIcon]);
2346
+ // 处理 CTA 点击
2347
+ const handleCtaClick = useCallback((link, interaction, productData, ctaData) => {
2348
+ // 如果配置了交互设置,优先使用交互设置
2349
+ if (interaction) {
2350
+ const { linkType, popupType, popupAni } = interaction;
2351
+ if (linkType === 'popup' && popupType) {
2352
+ // 设置弹窗要显示的产品数据
2353
+ if (productData && typeof window !== 'undefined' && window.setPopupDetailData) {
2354
+ // 构造与原有系统一致的数据结构
2355
+ const popupData = {
2356
+ video: {
2357
+ bindProduct: productData,
2358
+ bindProducts: [productData],
2359
+ bindCta: ctaData
2360
+ }
2361
+ };
2362
+ window.setPopupDetailData(popupData);
2363
+ }
2364
+ // 打开弹窗 - 使用与现有系统一致的方式
2365
+ if (typeof window !== 'undefined' && window.sxpPopup) {
2366
+ // 如果有动画配置,传递动画参数;否则只传弹窗 ID
2367
+ if (popupAni && popupAni.name) {
2368
+ window.sxpPopup(popupType, popupAni);
2369
+ }
2370
+ else {
2371
+ window.sxpPopup(popupType);
2372
+ }
2373
+ }
2374
+ return;
2375
+ }
2376
+ }
2377
+ // 默认行为:打开外部链接
2378
+ if (link) {
2379
+ window.open(link, '_blank');
2380
+ }
2381
+ }, []);
2382
+ // 合并基础样式和编辑器配置的样式
2383
+ const mergeStyles = useCallback((baseStyle, configKey) => {
2384
+ if (!editorMode || !multiCTAConfig[configKey]) {
2385
+ return baseStyle;
2386
+ }
2387
+ const config = multiCTAConfig[configKey];
2388
+ // 定义允许的样式属性列表
2389
+ const styleKeys = [
2390
+ 'fontSize', 'color', 'textAlign', 'fontWeight',
2391
+ 'backgroundColor', 'padding', 'margin', 'borderRadius',
2392
+ 'showBorder', 'borderWidth', 'borderColor',
2393
+ 'buttonBackgroundColor', 'buttonTextColor', 'buttonWidth', 'buttonHeight'
2394
+ ];
2395
+ // 只处理样式相关的属性,忽略 interaction 等非样式属性
2396
+ const styleConfig = Object.keys(config)
2397
+ .filter(key => styleKeys.includes(key))
2398
+ .reduce((obj, key) => {
2399
+ obj[key] = config[key];
2400
+ return obj;
2401
+ }, {});
2402
+ // 如果配置中没有任何样式字段(只有 interaction),直接返回基础样式
2403
+ if (Object.keys(styleConfig).length === 0) {
2404
+ return baseStyle;
2405
+ }
2406
+ const customStyle = {};
2407
+ // 应用配置中的样式
2408
+ if (styleConfig.fontSize && typeof styleConfig.fontSize === 'number') {
2409
+ customStyle.fontSize = `${styleConfig.fontSize}px`;
2410
+ }
2411
+ if (styleConfig.color && typeof styleConfig.color === 'string') {
2412
+ customStyle.color = styleConfig.color;
2413
+ }
2414
+ if (styleConfig.textAlign && typeof styleConfig.textAlign === 'string') {
2415
+ customStyle.textAlign = styleConfig.textAlign;
2416
+ }
2417
+ if (styleConfig.fontWeight && typeof styleConfig.fontWeight === 'number') {
2418
+ customStyle.fontWeight = styleConfig.fontWeight;
2419
+ }
2420
+ if (styleConfig.backgroundColor && typeof styleConfig.backgroundColor === 'string') {
2421
+ customStyle.backgroundColor = styleConfig.backgroundColor;
2422
+ }
2423
+ if (styleConfig.padding && typeof styleConfig.padding === 'string') {
2424
+ customStyle.padding = styleConfig.padding;
2425
+ }
2426
+ if (styleConfig.margin && typeof styleConfig.margin === 'string') {
2427
+ customStyle.margin = styleConfig.margin;
2428
+ }
2429
+ if (styleConfig.borderRadius && typeof styleConfig.borderRadius === 'number') {
2430
+ customStyle.borderRadius = `${styleConfig.borderRadius}px`;
2431
+ }
2432
+ if (styleConfig.showBorder && styleConfig.borderWidth && typeof styleConfig.borderWidth === 'number') {
2433
+ customStyle.border = `${styleConfig.borderWidth}px solid ${styleConfig.borderColor || '#d9d9d9'}`;
2434
+ }
2435
+ // 按钮特殊样式
2436
+ if (styleConfig.buttonBackgroundColor && typeof styleConfig.buttonBackgroundColor === 'string') {
2437
+ customStyle.backgroundColor = styleConfig.buttonBackgroundColor;
2438
+ }
2439
+ if (styleConfig.buttonTextColor && typeof styleConfig.buttonTextColor === 'string') {
2440
+ customStyle.color = styleConfig.buttonTextColor;
2441
+ }
2442
+ if (styleConfig.buttonWidth && typeof styleConfig.buttonWidth === 'number') {
2443
+ customStyle.width = `${styleConfig.buttonWidth}px`;
2444
+ }
2445
+ if (styleConfig.buttonHeight && typeof styleConfig.buttonHeight === 'number') {
2446
+ customStyle.height = `${styleConfig.buttonHeight}px`;
2447
+ }
2448
+ return Object.assign(Object.assign({}, baseStyle), customStyle);
2449
+ }, [editorMode, multiCTAConfig]);
2450
+ // 渲染 CTA 按钮或模版组件
2451
+ const renderCTA = useCallback((buttonKey, ctaData, productData, fallbackStyle) => {
2452
+ var _a, _b, _c;
2453
+ if (!ctaData) {
2454
+ return null;
2455
+ }
2456
+ const config = multiCTAConfig[buttonKey];
2457
+ const templateType = config === null || config === void 0 ? void 0 : config.templateType;
2458
+ const interaction = config === null || config === void 0 ? void 0 : config.interaction;
2459
+ // 如果配置了模版类型,渲染对应的模版组件
2460
+ if (editorMode && templateType && RESOLVER$3[templateType]) {
2461
+ const TemplateComponent = RESOLVER$3[templateType];
2462
+ const templateExtend = TemplateComponent === null || TemplateComponent === void 0 ? void 0 : TemplateComponent.extend;
2463
+ // 严格检查组件是否有效
2464
+ if (templateExtend && typeof TemplateComponent === 'function') {
2465
+ try {
2466
+ // 准备模版组件的 props
2467
+ const templateProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = templateExtend.defaulSetting) === null || _a === void 0 ? void 0 : _a.props), { style: Object.assign(Object.assign(Object.assign({}, (_b = templateExtend.defaulSetting) === null || _b === void 0 ? void 0 : _b.style), mergeStyles(fallbackStyle || {}, buttonKey)), { marginBottom: 0, width: '100%' }), textStyle: (_c = templateExtend.defaulSetting) === null || _c === void 0 ? void 0 : _c.textStyle }), (productData && { bindProduct: productData })), { isTel: true }), rest);
2468
+ // 渲染模版组件
2469
+ return React.createElement(TemplateComponent, templateProps);
2470
+ }
2471
+ catch (error) {
2472
+ console.error(`[StructurePage] Failed to render template component ${templateType}:`, error);
2473
+ // 降级到默认按钮
2474
+ }
2475
+ }
2476
+ }
2477
+ // 默认渲染按钮
2478
+ return (React.createElement("button", { style: mergeStyles(fallbackStyle || baseStyles.heroButton, buttonKey), onClick: () => handleCtaClick(ctaData === null || ctaData === void 0 ? void 0 : ctaData.link, interaction, productData, ctaData) }, ctaData.title));
2479
+ }, [multiCTAConfig, editorMode, handleCtaClick, mergeStyles, rest]);
2480
+ // 获取数据 - 只在组件挂载时执行一次
2481
+ useEffect(() => {
2482
+ // 重要:在 PB 编辑器模式下,propMultiCTAConfig 只是样式配置,不是数据源
2483
+ // 只有在 CMS 模式 (isCmsMode=false) 且 propMultiCTAConfig 包含实际数据时才跳过 API 调用
2484
+ // 判断是否包含实际数据:检查是否有 heroSection, carouselSection 等数据字段
2485
+ const hasActualData = propMultiCTAConfig && (propMultiCTAConfig.heroSection ||
2486
+ propMultiCTAConfig.carouselSection ||
2487
+ propMultiCTAConfig.highlightRevealSection ||
2488
+ propMultiCTAConfig.productGridSection ||
2489
+ propMultiCTAConfig.footerSection);
2490
+ if (editorMode && hasActualData && !isCmsMode) {
2491
+ setLoading(false);
2492
+ setError(null);
2493
+ // 使用传入的 multiCTAConfig 作为数据源
2494
+ setData(propMultiCTAConfig);
2495
+ return;
2496
+ }
2497
+ // 如果已经有数据了,且在编辑器模式下,不要重新请求
2498
+ if (editorMode && data && !isCmsMode) {
2499
+ return;
2500
+ }
2501
+ setLoading(true);
2502
+ setError(null);
2503
+ // 根据模式决定使用哪个接口
2504
+ let finalApiUrl = apiUrl;
2505
+ let bodyToSend = {};
2506
+ if (isCmsMode) {
2507
+ // CMS 模式:使用 /api/console/ad/multiCta/rec/detail 接口
2508
+ if (!storyId) {
2509
+ console.error('[StructurePage CMS Mode] storyId is required but not provided');
2510
+ setError('storyId is required in CMS mode');
2511
+ setLoading(false);
2512
+ return;
2513
+ }
2514
+ // 构建 CMS 接口的 URL 和请求体
2515
+ // apiUrl 应该是域名(如 http://localhost:8001),然后拼接 /api/console/ad/multiCta/rec/detail
2516
+ finalApiUrl = `${apiUrl}/api/console/ad/multiCta/rec/detail`;
2517
+ bodyToSend = { storyId };
2518
+ }
2519
+ else {
2520
+ // 普通模式:使用原有的 /api/v1/recommend/list 接口
2521
+ const defaultBody = {
2522
+ maxSize: 20,
2523
+ defaultSize: 10,
2524
+ type: 'story'
2525
+ };
2526
+ bodyToSend = requestBody ? Object.assign(Object.assign({}, defaultBody), requestBody) : defaultBody;
2527
+ }
2528
+ // 构建请求头
2529
+ const headers = {
2530
+ 'Content-Type': 'application/json'
2531
+ };
2532
+ if (isCmsMode) {
2533
+ // CMS 模式:使用自定义 headers(如果有传入)
2534
+ if (customHeaders) {
2535
+ Object.assign(headers, customHeaders);
2536
+ }
2537
+ }
2538
+ else {
2539
+ // 普通模式:从 requestBody 或 bodyToSend 中提取 BFF headers
2540
+ if (bodyToSend['x-app-id']) {
2541
+ headers['x-app-id'] = bodyToSend['x-app-id'];
2542
+ delete bodyToSend['x-app-id'];
2543
+ }
2544
+ if (bodyToSend['x-user-id']) {
2545
+ headers['x-user-id'] = bodyToSend['x-user-id'];
2546
+ delete bodyToSend['x-user-id'];
2547
+ }
2548
+ if (bodyToSend['tenant-id']) {
2549
+ headers['tenant-id'] = bodyToSend['tenant-id'];
2550
+ delete bodyToSend['tenant-id'];
2551
+ }
2552
+ }
2553
+ fetch(finalApiUrl, {
2554
+ method: 'POST',
2555
+ headers,
2556
+ body: JSON.stringify(bodyToSend),
2557
+ credentials: 'include'
2558
+ })
2559
+ .then((res) => {
2560
+ if (!res.ok) {
2561
+ throw new Error(`HTTP error! status: ${res.status}`);
2562
+ }
2563
+ return res.json();
2564
+ })
2565
+ .then((result) => {
2566
+ var _a, _b, _c, _d;
2567
+ if (result.code === '0' || result.code === '00000') {
2568
+ // 判断数据结构:CMS 模式和普通模式可能不同
2569
+ let multiCtaData = null;
2570
+ if (isCmsMode) {
2571
+ // CMS 模式:data.multiCta
2572
+ multiCtaData = (_a = result.data) === null || _a === void 0 ? void 0 : _a.multiCta;
2573
+ }
2574
+ else {
2575
+ // 普通模式:data.recList[0].multiCta
2576
+ multiCtaData = (_d = (_c = (_b = result.data) === null || _b === void 0 ? void 0 : _b.recList) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.multiCta;
2577
+ }
2578
+ if (multiCtaData) {
2579
+ setData(multiCtaData);
2580
+ }
2581
+ else {
2582
+ console.error('[StructurePage] No multiCta data found in response:', result);
2583
+ setError(result.message || 'No multiCta data found');
2584
+ }
2585
+ }
2586
+ else {
2587
+ setError(result.message || 'Failed to load data');
2588
+ }
2589
+ setLoading(false);
2590
+ })
2591
+ .catch((err) => {
2592
+ console.error('[StructurePage] Failed to fetch data:', {
2593
+ error: err,
2594
+ message: err.message,
2595
+ url: finalApiUrl,
2596
+ body: bodyToSend,
2597
+ isCmsMode,
2598
+ storyId
2599
+ });
2600
+ setError(err.message || 'Network error');
2601
+ setLoading(false);
2602
+ });
2603
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2604
+ }, [apiUrl, isCmsMode, storyId, customHeaders]);
2605
+ // 注意:移除了 editorMode 和 propMultiCTAConfig 依赖,因为:
2606
+ // 1. editorMode 和 propMultiCTAConfig 在编辑器中频繁变化
2607
+ // 2. propMultiCTAConfig 只是样式配置,不是数据源
2608
+ // 3. 数据获取只应该在组件挂载时执行一次(除非 apiUrl/storyId 等关键参数变化)
2609
+ // Hero Section 视频自动播放
2610
+ useEffect(() => {
2611
+ var _a;
2612
+ if (heroVideoRef.current && ((_a = data === null || data === void 0 ? void 0 : data.heroSection) === null || _a === void 0 ? void 0 : _a.url)) {
2613
+ heroVideoRef.current.play().catch((err) => console.log('Video autoplay failed:', err));
2614
+ setIsHeroVideoPaused(false);
2615
+ }
2616
+ }, [data === null || data === void 0 ? void 0 : data.heroSection]);
2617
+ // 初始化 carousel 视频暂停状态
2618
+ useEffect(() => {
2619
+ if (data === null || data === void 0 ? void 0 : data.carouselSection) {
2620
+ // carousel 视频默认不自动播放,所以初始状态应该是暂停(true)
2621
+ setCarouselVideoPausedStates(new Array(data.carouselSection.length).fill(true));
2622
+ }
2623
+ }, [data === null || data === void 0 ? void 0 : data.carouselSection]);
2624
+ // Hero 视频点击处理
2625
+ const handleHeroVideoClick = useCallback(() => {
2626
+ if (heroVideoRef.current) {
2627
+ if (heroVideoRef.current.paused) {
2628
+ heroVideoRef.current.play();
2629
+ setIsHeroVideoPaused(false);
2630
+ }
2631
+ else {
2632
+ heroVideoRef.current.pause();
2633
+ setIsHeroVideoPaused(true);
2634
+ }
2635
+ }
2636
+ }, []);
2637
+ // Carousel 视频点击处理
2638
+ const handleCarouselVideoClick = useCallback((index) => {
2639
+ const videoRef = carouselVideoRefs.current[index];
2640
+ if (videoRef) {
2641
+ if (videoRef.paused) {
2642
+ videoRef.play();
2643
+ setCarouselVideoPausedStates(prev => {
2644
+ const newStates = [...prev];
2645
+ newStates[index] = false;
2646
+ return newStates;
2647
+ });
2648
+ }
2649
+ else {
2650
+ videoRef.pause();
2651
+ setCarouselVideoPausedStates(prev => {
2652
+ const newStates = [...prev];
2653
+ newStates[index] = true;
2654
+ return newStates;
2655
+ });
2656
+ }
2657
+ }
2658
+ }, []);
2659
+ // Carousel 导航
2660
+ const handleCarouselPrev = () => {
2661
+ if (data === null || data === void 0 ? void 0 : data.carouselSection) {
2662
+ setCarouselIndex((prev) => (prev === 0 ? data.carouselSection.length - 1 : prev - 1));
2663
+ }
2664
+ };
2665
+ const handleCarouselNext = () => {
2666
+ if (data === null || data === void 0 ? void 0 : data.carouselSection) {
2667
+ setCarouselIndex((prev) => (prev === data.carouselSection.length - 1 ? 0 : prev + 1));
2668
+ }
2669
+ };
2670
+ if (loading) {
2671
+ return (React.createElement("div", { style: Object.assign(Object.assign({}, baseStyles.container), { height: containerHeight, width: containerWidth, display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff', fontSize: '16px' }) }, "Loading..."));
2672
+ }
2673
+ if (error) {
2674
+ return (React.createElement("div", { style: Object.assign(Object.assign({}, baseStyles.container), { height: containerHeight, width: containerWidth, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', color: '#fff', padding: '20px', textAlign: 'center' }) },
2675
+ React.createElement("div", { style: { fontSize: '18px', marginBottom: '10px' } }, "\u26A0\uFE0F Error"),
2676
+ React.createElement("div", { style: { fontSize: '14px', opacity: 0.8 } }, error)));
2677
+ }
2678
+ if (!data) {
2679
+ return (React.createElement("div", { style: Object.assign(Object.assign({}, baseStyles.container), { height: containerHeight, width: containerWidth, display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff', fontSize: '16px' }) }, "No data available"));
2680
+ }
2681
+ return (React.createElement("div", { className: className, style: Object.assign(Object.assign(Object.assign({}, baseStyles.container), { height: containerHeight, width: containerWidth }), containerStyle) },
2682
+ data.heroSection && (React.createElement("div", { style: baseStyles.heroSection },
2683
+ data.heroSection.text && (React.createElement("div", { style: mergeStyles(baseStyles.heroTopText, 'heroTopText') }, data.heroSection.text)),
2684
+ React.createElement("div", { style: baseStyles.heroImageContainer },
2685
+ data.heroSection.url ? (React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' }, onClick: handleHeroVideoClick },
2686
+ React.createElement("video", { ref: heroVideoRef, src: data.heroSection.url, style: baseStyles.heroVideo, autoPlay: true, muted: true, loop: true, playsInline: true, controls: false }),
2687
+ isHeroVideoPaused && (React.createElement(FormatImage$1, { className: 'clc-pb-video-pause', src: videoPlayIcon, alt: 'play' })))) : ((_e = data.heroSection.imgUrls) === null || _e === void 0 ? void 0 : _e[0]) ? (React.createElement("img", { src: data.heroSection.imgUrls[0], alt: 'Hero', style: baseStyles.heroImage })) : null,
2688
+ React.createElement("div", { style: baseStyles.heroOverlay }, renderCTA('heroButton', (_g = (_f = data.heroSection.bindProducts) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.bindCta, (_h = data.heroSection.bindProducts) === null || _h === void 0 ? void 0 : _h[0], baseStyles.heroButton))))),
2689
+ data.carouselSection && data.carouselSection.length > 0 && (React.createElement("div", { style: mergeStyles(baseStyles.carouselSection, 'carouselSection') },
2690
+ React.createElement("div", { style: baseStyles.carouselImageContainer },
2691
+ React.createElement("div", { style: Object.assign(Object.assign({}, baseStyles.carouselContainer), { transform: `translateX(-${carouselIndex * 100}%)` }) }, data.carouselSection.map((item, index) => {
2692
+ var _a;
2693
+ return (React.createElement("div", { key: item.itemId, style: baseStyles.carouselSlide }, item.url ? (React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' }, onClick: () => handleCarouselVideoClick(index) },
2694
+ React.createElement("video", { ref: (el) => {
2695
+ carouselVideoRefs.current[index] = el;
2696
+ }, src: item.url, style: baseStyles.carouselVideo, muted: true, loop: true, playsInline: true, controls: false }),
2697
+ carouselVideoPausedStates[index] && (React.createElement(FormatImage$1, { className: 'clc-pb-video-pause', src: videoPlayIcon, alt: 'play' })))) : ((_a = item.imgUrls) === null || _a === void 0 ? void 0 : _a[0]) ? (React.createElement("img", { src: item.imgUrls[0], alt: item.text || 'Carousel', style: baseStyles.carouselImage })) : null));
2698
+ })),
2699
+ React.createElement("button", { style: Object.assign(Object.assign({}, baseStyles.arrowButton), { left: '10px' }), onClick: handleCarouselPrev }, "\u2039"),
2700
+ React.createElement("button", { style: Object.assign(Object.assign({}, baseStyles.arrowButton), { right: '10px' }), onClick: handleCarouselNext }, "\u203A")),
2701
+ React.createElement("div", { style: mergeStyles(baseStyles.carouselInfoSection, 'carouselSection') },
2702
+ ((_j = data.carouselSection[carouselIndex]) === null || _j === void 0 ? void 0 : _j.text) && (React.createElement("div", { style: mergeStyles(baseStyles.carouselText, 'carouselSection') }, (_k = data.carouselSection[carouselIndex]) === null || _k === void 0 ? void 0 : _k.text)),
2703
+ renderCTA('carouselButton', (_o = (_m = (_l = data.carouselSection[carouselIndex]) === null || _l === void 0 ? void 0 : _l.bindProducts) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.bindCta, (_q = (_p = data.carouselSection[carouselIndex]) === null || _p === void 0 ? void 0 : _p.bindProducts) === null || _q === void 0 ? void 0 : _q[0], baseStyles.carouselButton)))),
2704
+ data.highlightRevealSection && (React.createElement("div", { style: mergeStyles(baseStyles.highlightSection, 'highlightSection') },
2705
+ React.createElement("div", { style: baseStyles.highlightImageContainer },
2706
+ React.createElement("img", { src: data.highlightRevealSection.landingImageUrl || data.highlightRevealSection.cover, alt: data.highlightRevealSection.title, style: baseStyles.highlightImage })),
2707
+ React.createElement("div", { style: mergeStyles(baseStyles.highlightInfoSection, 'highlightSection') },
2708
+ React.createElement("div", { style: mergeStyles(baseStyles.highlightTitle, 'highlightSection') }, data.highlightRevealSection.title),
2709
+ renderCTA('highlightButton', data.highlightRevealSection.bindCta, data.highlightRevealSection, baseStyles.highlightButton)))),
2710
+ data.productGridSection && data.productGridSection.length > 0 && (React.createElement("div", { style: mergeStyles(baseStyles.productGrid, 'productGrid') }, (() => {
2711
+ // 创建一个6格的网格 (3行 x 2列),根据position放置产品
2712
+ const gridItems = [null, null, null, null, null, null];
2713
+ // 创建产品索引映射表:gridIndex -> 产品在数据数组中的索引(从1开始)
2714
+ const productIndexMap = {};
2715
+ data.productGridSection.forEach((product, idx) => {
2716
+ var _a;
2717
+ const pos = (_a = product.position) === null || _a === void 0 ? void 0 : _a.toLowerCase();
2718
+ let gridIndex = -1;
2719
+ if (pos === 'top_right') {
2720
+ gridIndex = 1; // 第一行右侧
2721
+ }
2722
+ else if (pos === 'top_left') {
2723
+ gridIndex = 0; // 第一行左侧
2724
+ }
2725
+ else if (pos === 'center_left') {
2726
+ gridIndex = 2; // 第二行左侧
2727
+ }
2728
+ else if (pos === 'center_right') {
2729
+ gridIndex = 3; // 第二行右侧
2730
+ }
2731
+ else if (pos === 'bottom_left') {
2732
+ gridIndex = 4; // 第三行左侧
2733
+ }
2734
+ else if (pos === 'bottom_right') {
2735
+ gridIndex = 5; // 第三行右侧
2736
+ }
2737
+ if (gridIndex >= 0) {
2738
+ gridItems[gridIndex] = product;
2739
+ // 映射:网格位置 -> 产品序号(基于数据数组的顺序,从1开始)
2740
+ productIndexMap[gridIndex] = idx + 1;
2741
+ }
2742
+ });
2743
+ return gridItems.map((product, gridIndex) => {
2744
+ // 使用产品在数据数组中的实际索引来确定 buttonKey
2745
+ const productDataIndex = productIndexMap[gridIndex];
2746
+ const buttonKey = `productButton${productDataIndex || gridIndex + 1}`;
2747
+ return (React.createElement("div", { key: (product === null || product === void 0 ? void 0 : product.itemId) || `empty-${gridIndex}`, style: baseStyles.productItem }, product ? (React.createElement(React.Fragment, null,
2748
+ React.createElement("div", { style: baseStyles.productImageContainer },
2749
+ React.createElement("img", { src: product.landingImageUrl || product.cover,
2750
+ // alt={product.title}
2751
+ style: baseStyles.productImage })),
2752
+ product.bindCta && (React.createElement("div", { style: baseStyles.productCtaContainer }, renderCTA(buttonKey, product.bindCta, product, baseStyles.productButton))))) : (
2753
+ // 空格子
2754
+ React.createElement("div", { style: { width: '100%', paddingBottom: '100%' } }))));
2755
+ });
2756
+ })())),
2757
+ data.footerSection && (React.createElement("div", { style: mergeStyles(baseStyles.footerSection, 'footerSection') },
2758
+ React.createElement("div", { style: mergeStyles(baseStyles.footerInfoSection, 'footerSection') }, renderCTA('footerButton', data.footerSection.bindCta, data.footerSection, baseStyles.footerButton)),
2759
+ React.createElement("div", { style: baseStyles.footerImageContainer },
2760
+ React.createElement("img", { src: data.footerSection.landingImageUrl || data.footerSection.cover, alt: data.footerSection.title, style: baseStyles.footerImage }))))));
2761
+ };
2762
+
1929
2763
  var index$3 = /*#__PURE__*/Object.freeze({
1930
2764
  __proto__: null,
1931
- EditorCore: EditorCore
2765
+ EditorCore: EditorCore,
2766
+ StructurePage: StructurePage
1932
2767
  });
1933
2768
 
1934
2769
  var interactionRender$h = [
@@ -3877,9 +4712,8 @@ function updateSlides() {
3877
4712
  allSlidesSize += slideSizeValue + (spaceBetween || 0);
3878
4713
  });
3879
4714
  allSlidesSize -= spaceBetween;
3880
- const offsetSize = (params.slidesOffsetBefore || 0) + (params.slidesOffsetAfter || 0);
3881
- if (allSlidesSize + offsetSize < swiperSize) {
3882
- const allSlidesOffset = (swiperSize - allSlidesSize - offsetSize) / 2;
4715
+ if (allSlidesSize < swiperSize) {
4716
+ const allSlidesOffset = (swiperSize - allSlidesSize) / 2;
3883
4717
  snapGrid.forEach((snap, snapIndex) => {
3884
4718
  snapGrid[snapIndex] = snap - allSlidesOffset;
3885
4719
  });
@@ -3983,13 +4817,6 @@ function updateSlidesOffset() {
3983
4817
  }
3984
4818
  }
3985
4819
 
3986
- const toggleSlideClasses$1 = (slideEl, condition, className) => {
3987
- if (condition && !slideEl.classList.contains(className)) {
3988
- slideEl.classList.add(className);
3989
- } else if (!condition && slideEl.classList.contains(className)) {
3990
- slideEl.classList.remove(className);
3991
- }
3992
- };
3993
4820
  function updateSlidesProgress(translate) {
3994
4821
  if (translate === void 0) {
3995
4822
  translate = this && this.translate || 0;
@@ -4005,6 +4832,11 @@ function updateSlidesProgress(translate) {
4005
4832
  if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset();
4006
4833
  let offsetCenter = -translate;
4007
4834
  if (rtl) offsetCenter = translate;
4835
+
4836
+ // Visible Slides
4837
+ slides.forEach(slideEl => {
4838
+ slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass);
4839
+ });
4008
4840
  swiper.visibleSlidesIndexes = [];
4009
4841
  swiper.visibleSlides = [];
4010
4842
  let spaceBetween = params.spaceBetween;
@@ -4028,9 +4860,11 @@ function updateSlidesProgress(translate) {
4028
4860
  if (isVisible) {
4029
4861
  swiper.visibleSlides.push(slide);
4030
4862
  swiper.visibleSlidesIndexes.push(i);
4863
+ slides[i].classList.add(params.slideVisibleClass);
4864
+ }
4865
+ if (isFullyVisible) {
4866
+ slides[i].classList.add(params.slideFullyVisibleClass);
4031
4867
  }
4032
- toggleSlideClasses$1(slide, isVisible, params.slideVisibleClass);
4033
- toggleSlideClasses$1(slide, isFullyVisible, params.slideFullyVisibleClass);
4034
4868
  slide.progress = rtl ? -slideProgress : slideProgress;
4035
4869
  slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress;
4036
4870
  }
@@ -4099,13 +4933,6 @@ function updateProgress(translate) {
4099
4933
  swiper.emit('progress', progress);
4100
4934
  }
4101
4935
 
4102
- const toggleSlideClasses = (slideEl, condition, className) => {
4103
- if (condition && !slideEl.classList.contains(className)) {
4104
- slideEl.classList.add(className);
4105
- } else if (!condition && slideEl.classList.contains(className)) {
4106
- slideEl.classList.remove(className);
4107
- }
4108
- };
4109
4936
  function updateSlidesClasses() {
4110
4937
  const swiper = this;
4111
4938
  const {
@@ -4119,6 +4946,9 @@ function updateSlidesClasses() {
4119
4946
  const getFilteredSlide = selector => {
4120
4947
  return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
4121
4948
  };
4949
+ slides.forEach(slideEl => {
4950
+ slideEl.classList.remove(params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
4951
+ });
4122
4952
  let activeSlide;
4123
4953
  let prevSlide;
4124
4954
  let nextSlide;
@@ -4141,25 +4971,35 @@ function updateSlidesClasses() {
4141
4971
  }
4142
4972
  }
4143
4973
  if (activeSlide) {
4144
- if (!gridEnabled) {
4974
+ // Active classes
4975
+ activeSlide.classList.add(params.slideActiveClass);
4976
+ if (gridEnabled) {
4977
+ if (nextSlide) {
4978
+ nextSlide.classList.add(params.slideNextClass);
4979
+ }
4980
+ if (prevSlide) {
4981
+ prevSlide.classList.add(params.slidePrevClass);
4982
+ }
4983
+ } else {
4145
4984
  // Next Slide
4146
4985
  nextSlide = elementNextAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
4147
4986
  if (params.loop && !nextSlide) {
4148
4987
  nextSlide = slides[0];
4149
4988
  }
4989
+ if (nextSlide) {
4990
+ nextSlide.classList.add(params.slideNextClass);
4991
+ }
4150
4992
 
4151
4993
  // Prev Slide
4152
4994
  prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
4153
4995
  if (params.loop && !prevSlide === 0) {
4154
4996
  prevSlide = slides[slides.length - 1];
4155
4997
  }
4998
+ if (prevSlide) {
4999
+ prevSlide.classList.add(params.slidePrevClass);
5000
+ }
4156
5001
  }
4157
5002
  }
4158
- slides.forEach(slideEl => {
4159
- toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass);
4160
- toggleSlideClasses(slideEl, slideEl === nextSlide, params.slideNextClass);
4161
- toggleSlideClasses(slideEl, slideEl === prevSlide, params.slidePrevClass);
4162
- });
4163
5003
  swiper.emitSlidesClasses();
4164
5004
  }
4165
5005
 
@@ -4537,7 +5377,6 @@ function translateTo(translate, speed, runCallbacks, translateBounds, internal)
4537
5377
  swiper.wrapperEl.removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd);
4538
5378
  swiper.onTranslateToWrapperTransitionEnd = null;
4539
5379
  delete swiper.onTranslateToWrapperTransitionEnd;
4540
- swiper.animating = false;
4541
5380
  if (runCallbacks) {
4542
5381
  swiper.emit('transitionEnd');
4543
5382
  }
@@ -4645,6 +5484,9 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
4645
5484
  if (index === void 0) {
4646
5485
  index = 0;
4647
5486
  }
5487
+ if (speed === void 0) {
5488
+ speed = this.params.speed;
5489
+ }
4648
5490
  if (runCallbacks === void 0) {
4649
5491
  runCallbacks = true;
4650
5492
  }
@@ -4664,12 +5506,9 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
4664
5506
  wrapperEl,
4665
5507
  enabled
4666
5508
  } = swiper;
4667
- if (!enabled && !internal && !initial || swiper.destroyed || swiper.animating && params.preventInteractionOnTransition) {
5509
+ if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial || swiper.destroyed) {
4668
5510
  return false;
4669
5511
  }
4670
- if (typeof speed === 'undefined') {
4671
- speed = swiper.params.speed;
4672
- }
4673
5512
  const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex);
4674
5513
  let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
4675
5514
  if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
@@ -4796,6 +5635,9 @@ function slideToLoop(index, speed, runCallbacks, internal) {
4796
5635
  if (index === void 0) {
4797
5636
  index = 0;
4798
5637
  }
5638
+ if (speed === void 0) {
5639
+ speed = this.params.speed;
5640
+ }
4799
5641
  if (runCallbacks === void 0) {
4800
5642
  runCallbacks = true;
4801
5643
  }
@@ -4805,9 +5647,6 @@ function slideToLoop(index, speed, runCallbacks, internal) {
4805
5647
  }
4806
5648
  const swiper = this;
4807
5649
  if (swiper.destroyed) return;
4808
- if (typeof speed === 'undefined') {
4809
- speed = swiper.params.speed;
4810
- }
4811
5650
  const gridEnabled = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
4812
5651
  let newIndex = index;
4813
5652
  if (swiper.params.loop) {
@@ -4839,9 +5678,6 @@ function slideToLoop(index, speed, runCallbacks, internal) {
4839
5678
  if (centeredSlides) {
4840
5679
  needLoopFix = needLoopFix || targetSlideIndex < Math.ceil(slidesPerView / 2);
4841
5680
  }
4842
- if (internal && centeredSlides && swiper.params.slidesPerView !== 'auto' && !gridEnabled) {
4843
- needLoopFix = false;
4844
- }
4845
5681
  if (needLoopFix) {
4846
5682
  const direction = centeredSlides ? targetSlideIndex < swiper.activeIndex ? 'prev' : 'next' : targetSlideIndex - swiper.activeIndex - 1 < swiper.params.slidesPerView ? 'next' : 'prev';
4847
5683
  swiper.loopFix({
@@ -4867,6 +5703,9 @@ function slideToLoop(index, speed, runCallbacks, internal) {
4867
5703
 
4868
5704
  /* eslint no-unused-vars: "off" */
4869
5705
  function slideNext(speed, runCallbacks, internal) {
5706
+ if (speed === void 0) {
5707
+ speed = this.params.speed;
5708
+ }
4870
5709
  if (runCallbacks === void 0) {
4871
5710
  runCallbacks = true;
4872
5711
  }
@@ -4877,9 +5716,6 @@ function slideNext(speed, runCallbacks, internal) {
4877
5716
  animating
4878
5717
  } = swiper;
4879
5718
  if (!enabled || swiper.destroyed) return swiper;
4880
- if (typeof speed === 'undefined') {
4881
- speed = swiper.params.speed;
4882
- }
4883
5719
  let perGroup = params.slidesPerGroup;
4884
5720
  if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) {
4885
5721
  perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
@@ -4908,6 +5744,9 @@ function slideNext(speed, runCallbacks, internal) {
4908
5744
 
4909
5745
  /* eslint no-unused-vars: "off" */
4910
5746
  function slidePrev(speed, runCallbacks, internal) {
5747
+ if (speed === void 0) {
5748
+ speed = this.params.speed;
5749
+ }
4911
5750
  if (runCallbacks === void 0) {
4912
5751
  runCallbacks = true;
4913
5752
  }
@@ -4921,9 +5760,6 @@ function slidePrev(speed, runCallbacks, internal) {
4921
5760
  animating
4922
5761
  } = swiper;
4923
5762
  if (!enabled || swiper.destroyed) return swiper;
4924
- if (typeof speed === 'undefined') {
4925
- speed = swiper.params.speed;
4926
- }
4927
5763
  const isVirtual = swiper.virtual && params.virtual.enabled;
4928
5764
  if (params.loop) {
4929
5765
  if (animating && !isVirtual && params.loopPreventsSliding) return false;
@@ -4976,19 +5812,22 @@ function slidePrev(speed, runCallbacks, internal) {
4976
5812
 
4977
5813
  /* eslint no-unused-vars: "off" */
4978
5814
  function slideReset(speed, runCallbacks, internal) {
5815
+ if (speed === void 0) {
5816
+ speed = this.params.speed;
5817
+ }
4979
5818
  if (runCallbacks === void 0) {
4980
5819
  runCallbacks = true;
4981
5820
  }
4982
5821
  const swiper = this;
4983
5822
  if (swiper.destroyed) return;
4984
- if (typeof speed === 'undefined') {
4985
- speed = swiper.params.speed;
4986
- }
4987
5823
  return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal);
4988
5824
  }
4989
5825
 
4990
5826
  /* eslint no-unused-vars: "off" */
4991
5827
  function slideToClosest(speed, runCallbacks, internal, threshold) {
5828
+ if (speed === void 0) {
5829
+ speed = this.params.speed;
5830
+ }
4992
5831
  if (runCallbacks === void 0) {
4993
5832
  runCallbacks = true;
4994
5833
  }
@@ -4997,9 +5836,6 @@ function slideToClosest(speed, runCallbacks, internal, threshold) {
4997
5836
  }
4998
5837
  const swiper = this;
4999
5838
  if (swiper.destroyed) return;
5000
- if (typeof speed === 'undefined') {
5001
- speed = swiper.params.speed;
5002
- }
5003
5839
  let index = swiper.activeIndex;
5004
5840
  const skip = Math.min(swiper.params.slidesPerGroupSkip, index);
5005
5841
  const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup);
@@ -5634,7 +6470,7 @@ function onTouchMove(event) {
5634
6470
  data.startMoving = true;
5635
6471
  }
5636
6472
  }
5637
- if (data.isScrolling || e.type === 'touchmove' && data.preventTouchMoveFromPointerMove) {
6473
+ if (data.isScrolling) {
5638
6474
  data.isTouched = false;
5639
6475
  return;
5640
6476
  }
@@ -5676,10 +6512,7 @@ function onTouchMove(event) {
5676
6512
  if (swiper.animating) {
5677
6513
  const evt = new window.CustomEvent('transitionend', {
5678
6514
  bubbles: true,
5679
- cancelable: true,
5680
- detail: {
5681
- bySwiperTouchMove: true
5682
- }
6515
+ cancelable: true
5683
6516
  });
5684
6517
  swiper.wrapperEl.dispatchEvent(evt);
5685
6518
  }
@@ -6073,7 +6906,6 @@ const events = (swiper, method) => {
6073
6906
  const capture = !!params.nested;
6074
6907
  const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener';
6075
6908
  const swiperMethod = method;
6076
- if (!el || typeof el === 'string') return;
6077
6909
 
6078
6910
  // Touch Events
6079
6911
  document[domMethod]('touchstart', swiper.onDocumentTouchStart, {
@@ -6182,8 +7014,6 @@ function setBreakpoint() {
6182
7014
  const breakpointParams = breakpointOnlyParams || swiper.originalParams;
6183
7015
  const wasMultiRow = isGridEnabled(swiper, params);
6184
7016
  const isMultiRow = isGridEnabled(swiper, breakpointParams);
6185
- const wasGrabCursor = swiper.params.grabCursor;
6186
- const isGrabCursor = breakpointParams.grabCursor;
6187
7017
  const wasEnabled = params.enabled;
6188
7018
  if (wasMultiRow && !isMultiRow) {
6189
7019
  el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);
@@ -6195,11 +7025,6 @@ function setBreakpoint() {
6195
7025
  }
6196
7026
  swiper.emitContainerClasses();
6197
7027
  }
6198
- if (wasGrabCursor && !isGrabCursor) {
6199
- swiper.unsetGrabCursor();
6200
- } else if (!wasGrabCursor && isGrabCursor) {
6201
- swiper.setGrabCursor();
6202
- }
6203
7028
 
6204
7029
  // Toggle navigation, pagination, scrollbar
6205
7030
  ['navigation', 'pagination', 'scrollbar'].forEach(prop => {
@@ -6350,7 +7175,6 @@ function removeClasses() {
6350
7175
  el,
6351
7176
  classNames
6352
7177
  } = swiper;
6353
- if (!el || typeof el === 'string') return;
6354
7178
  el.classList.remove(...classNames);
6355
7179
  swiper.emitContainerClasses();
6356
7180
  }
@@ -7115,12 +7939,8 @@ let Swiper$1 = class Swiper {
7115
7939
  // Cleanup styles
7116
7940
  if (cleanStyles) {
7117
7941
  swiper.removeClasses();
7118
- if (el && typeof el !== 'string') {
7119
- el.removeAttribute('style');
7120
- }
7121
- if (wrapperEl) {
7122
- wrapperEl.removeAttribute('style');
7123
- }
7942
+ el.removeAttribute('style');
7943
+ wrapperEl.removeAttribute('style');
7124
7944
  if (slides && slides.length) {
7125
7945
  slides.forEach(slideEl => {
7126
7946
  slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
@@ -7136,9 +7956,7 @@ let Swiper$1 = class Swiper {
7136
7956
  swiper.off(eventName);
7137
7957
  });
7138
7958
  if (deleteInstance !== false) {
7139
- if (swiper.el && typeof swiper.el !== 'string') {
7140
- swiper.el.swiper = null;
7141
- }
7959
+ swiper.el.swiper = null;
7142
7960
  deleteProps(swiper);
7143
7961
  }
7144
7962
  swiper.destroyed = true;
@@ -7532,7 +8350,7 @@ const updateOnVirtualData = swiper => {
7532
8350
  };
7533
8351
 
7534
8352
  /**
7535
- * Swiper React 11.1.4
8353
+ * Swiper React 11.0.7
7536
8354
  * Most modern mobile touch slider and framework with hardware accelerated transitions
7537
8355
  * https://swiperjs.com
7538
8356
  *
@@ -7540,7 +8358,7 @@ const updateOnVirtualData = swiper => {
7540
8358
  *
7541
8359
  * Released under the MIT License
7542
8360
  *
7543
- * Released on: May 30, 2024
8361
+ * Released on: February 27, 2024
7544
8362
  */
7545
8363
 
7546
8364
 
@@ -8467,10 +9285,8 @@ function Navigation(_ref) {
8467
9285
  }
8468
9286
  if (el) {
8469
9287
  if (typeof el === 'string') res = [...document.querySelectorAll(el)];
8470
- if (swiper.params.uniqueNavElements && typeof el === 'string' && res && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {
9288
+ if (swiper.params.uniqueNavElements && typeof el === 'string' && res.length > 1 && swiper.el.querySelectorAll(el).length === 1) {
8471
9289
  res = swiper.el.querySelector(el);
8472
- } else if (res && res.length === 1) {
8473
- res = res[0];
8474
9290
  }
8475
9291
  }
8476
9292
  if (el && !res) return el;
@@ -8592,14 +9408,7 @@ function Navigation(_ref) {
8592
9408
  nextEl = makeElementsArray(nextEl);
8593
9409
  prevEl = makeElementsArray(prevEl);
8594
9410
  const targetEl = e.target;
8595
- let targetIsButton = prevEl.includes(targetEl) || nextEl.includes(targetEl);
8596
- if (swiper.isElement && !targetIsButton) {
8597
- const path = e.path || e.composedPath && e.composedPath();
8598
- if (path) {
8599
- targetIsButton = path.find(pathEl => nextEl.includes(pathEl) || prevEl.includes(pathEl));
8600
- }
8601
- }
8602
- if (swiper.params.navigation.hideOnClick && !targetIsButton) {
9411
+ if (swiper.params.navigation.hideOnClick && !prevEl.includes(targetEl) && !nextEl.includes(targetEl)) {
8603
9412
  if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return;
8604
9413
  let isHidden;
8605
9414
  if (nextEl.length) {
@@ -9255,7 +10064,7 @@ function Scrollbar(_ref) {
9255
10064
  dragEl
9256
10065
  } = scrollbar;
9257
10066
  if (!isTouched) return;
9258
- if (e.preventDefault && e.cancelable) e.preventDefault();else e.returnValue = false;
10067
+ if (e.preventDefault) e.preventDefault();else e.returnValue = false;
9259
10068
  setDragPosition(e);
9260
10069
  wrapperEl.style.transitionDuration = '0ms';
9261
10070
  el.style.transitionDuration = '0ms';
@@ -9466,9 +10275,6 @@ function A11y(_ref) {
9466
10275
  clicked: false
9467
10276
  };
9468
10277
  let liveRegion = null;
9469
- let preventFocusHandler;
9470
- let focusTargetSlideEl;
9471
- let visibilityChangedTimestamp = new Date().getTime();
9472
10278
  function notify(message) {
9473
10279
  const notification = liveRegion;
9474
10280
  if (notification.length === 0) return;
@@ -9549,28 +10355,24 @@ function A11y(_ref) {
9549
10355
  if (swiper.pagination && swiper.pagination.el && (targetEl === swiper.pagination.el || swiper.pagination.el.contains(e.target))) {
9550
10356
  if (!e.target.matches(classesToSelector(swiper.params.pagination.bulletClass))) return;
9551
10357
  }
9552
- if (swiper.navigation && swiper.navigation.prevEl && swiper.navigation.nextEl) {
9553
- const prevEls = makeElementsArray(swiper.navigation.prevEl);
9554
- const nextEls = makeElementsArray(swiper.navigation.nextEl);
9555
- if (nextEls.includes(targetEl)) {
9556
- if (!(swiper.isEnd && !swiper.params.loop)) {
9557
- swiper.slideNext();
9558
- }
9559
- if (swiper.isEnd) {
9560
- notify(params.lastSlideMessage);
9561
- } else {
9562
- notify(params.nextSlideMessage);
9563
- }
10358
+ if (swiper.navigation && swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl) {
10359
+ if (!(swiper.isEnd && !swiper.params.loop)) {
10360
+ swiper.slideNext();
9564
10361
  }
9565
- if (prevEls.includes(targetEl)) {
9566
- if (!(swiper.isBeginning && !swiper.params.loop)) {
9567
- swiper.slidePrev();
9568
- }
9569
- if (swiper.isBeginning) {
9570
- notify(params.firstSlideMessage);
9571
- } else {
9572
- notify(params.prevSlideMessage);
9573
- }
10362
+ if (swiper.isEnd) {
10363
+ notify(params.lastSlideMessage);
10364
+ } else {
10365
+ notify(params.nextSlideMessage);
10366
+ }
10367
+ }
10368
+ if (swiper.navigation && swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl) {
10369
+ if (!(swiper.isBeginning && !swiper.params.loop)) {
10370
+ swiper.slidePrev();
10371
+ }
10372
+ if (swiper.isBeginning) {
10373
+ notify(params.firstSlideMessage);
10374
+ } else {
10375
+ notify(params.prevSlideMessage);
9574
10376
  }
9575
10377
  }
9576
10378
  if (swiper.pagination && targetEl.matches(classesToSelector(swiper.params.pagination.bulletClass))) {
@@ -9635,14 +10437,10 @@ function A11y(_ref) {
9635
10437
  addElLabel(el, message);
9636
10438
  addElControls(el, wrapperId);
9637
10439
  };
9638
- const handlePointerDown = e => {
9639
- if (focusTargetSlideEl && focusTargetSlideEl !== e.target && !focusTargetSlideEl.contains(e.target)) {
9640
- preventFocusHandler = true;
9641
- }
10440
+ const handlePointerDown = () => {
9642
10441
  swiper.a11y.clicked = true;
9643
10442
  };
9644
10443
  const handlePointerUp = () => {
9645
- preventFocusHandler = false;
9646
10444
  requestAnimationFrame(() => {
9647
10445
  requestAnimationFrame(() => {
9648
10446
  if (!swiper.destroyed) {
@@ -9651,15 +10449,10 @@ function A11y(_ref) {
9651
10449
  });
9652
10450
  });
9653
10451
  };
9654
- const onVisibilityChange = e => {
9655
- visibilityChangedTimestamp = new Date().getTime();
9656
- };
9657
10452
  const handleFocus = e => {
9658
10453
  if (swiper.a11y.clicked) return;
9659
- if (new Date().getTime() - visibilityChangedTimestamp < 100) return;
9660
10454
  const slideEl = e.target.closest(`.${swiper.params.slideClass}, swiper-slide`);
9661
10455
  if (!slideEl || !swiper.slides.includes(slideEl)) return;
9662
- focusTargetSlideEl = slideEl;
9663
10456
  const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex;
9664
10457
  const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl);
9665
10458
  if (isActive || isVisible) return;
@@ -9669,15 +10462,7 @@ function A11y(_ref) {
9669
10462
  } else {
9670
10463
  swiper.el.scrollTop = 0;
9671
10464
  }
9672
- requestAnimationFrame(() => {
9673
- if (preventFocusHandler) return;
9674
- if (swiper.params.loop) {
9675
- swiper.slideToLoop(parseInt(slideEl.getAttribute('data-swiper-slide-index')), 0);
9676
- } else {
9677
- swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
9678
- }
9679
- preventFocusHandler = false;
9680
- });
10465
+ swiper.slideTo(swiper.slides.indexOf(slideEl), 0);
9681
10466
  };
9682
10467
  const initSlides = () => {
9683
10468
  const params = swiper.params.a11y;
@@ -9742,9 +10527,6 @@ function A11y(_ref) {
9742
10527
  }
9743
10528
 
9744
10529
  // Tab focus
9745
- const document = getDocument();
9746
- document.addEventListener('visibilitychange', onVisibilityChange);
9747
- swiper.el.addEventListener('focus', handleFocus, true);
9748
10530
  swiper.el.addEventListener('focus', handleFocus, true);
9749
10531
  swiper.el.addEventListener('pointerdown', handlePointerDown, true);
9750
10532
  swiper.el.addEventListener('pointerup', handlePointerUp, true);
@@ -9771,14 +10553,11 @@ function A11y(_ref) {
9771
10553
  el.removeEventListener('keydown', onEnterOrSpaceKey);
9772
10554
  });
9773
10555
  }
9774
- const document = getDocument();
9775
- document.removeEventListener('visibilitychange', onVisibilityChange);
10556
+
9776
10557
  // Tab focus
9777
- if (swiper.el && typeof swiper.el !== 'string') {
9778
- swiper.el.removeEventListener('focus', handleFocus, true);
9779
- swiper.el.removeEventListener('pointerdown', handlePointerDown, true);
9780
- swiper.el.removeEventListener('pointerup', handlePointerUp, true);
9781
- }
10558
+ swiper.el.removeEventListener('focus', handleFocus, true);
10559
+ swiper.el.removeEventListener('pointerdown', handlePointerDown, true);
10560
+ swiper.el.removeEventListener('pointerup', handlePointerUp, true);
9782
10561
  }
9783
10562
  on('beforeInit', () => {
9784
10563
  liveRegion = createElement('span', swiper.params.a11y.notificationClass);
@@ -9850,7 +10629,7 @@ function Autoplay(_ref) {
9850
10629
  if (!swiper || swiper.destroyed || !swiper.wrapperEl) return;
9851
10630
  if (e.target !== swiper.wrapperEl) return;
9852
10631
  swiper.wrapperEl.removeEventListener('transitionend', onTransitionEnd);
9853
- if (pausedByPointerEnter || e.detail && e.detail.bySwiperTouchMove) {
10632
+ if (pausedByPointerEnter) {
9854
10633
  return;
9855
10634
  }
9856
10635
  resume();
@@ -10021,10 +10800,8 @@ function Autoplay(_ref) {
10021
10800
  }
10022
10801
  };
10023
10802
  const detachMouseEvents = () => {
10024
- if (swiper.el && typeof swiper.el !== 'string') {
10025
- swiper.el.removeEventListener('pointerenter', onPointerEnter);
10026
- swiper.el.removeEventListener('pointerleave', onPointerLeave);
10027
- }
10803
+ swiper.el.removeEventListener('pointerenter', onPointerEnter);
10804
+ swiper.el.removeEventListener('pointerleave', onPointerLeave);
10028
10805
  };
10029
10806
  const attachDocumentEvents = () => {
10030
10807
  const document = getDocument();
@@ -10362,49 +11139,6 @@ const Scroll = ({ children, isPadding = true, style, enableSlideActive = false }
10362
11139
  };
10363
11140
  var Scroll$1 = memo(Scroll);
10364
11141
 
10365
- const FormatImage = forwardRef((props, ref) => {
10366
- const { src, onLoad, style, className, loading, alt = 'image' } = props;
10367
- const [imgSrc, setImgSrc] = useState(src);
10368
- const imgRef = useRef(null);
10369
- const [visible, setVisible] = useState(false);
10370
- useImperativeHandle(ref, () => ({
10371
- setSrc: (v) => {
10372
- if (v)
10373
- setImgSrc(v);
10374
- }
10375
- }));
10376
- useEffect(() => {
10377
- if (src)
10378
- setImgSrc(src);
10379
- }, [src]);
10380
- useEffect(() => {
10381
- const onShow = () => {
10382
- if (src && !visible && imgRef.current) {
10383
- imgRef.current.src = '';
10384
- imgRef.current.src = src;
10385
- }
10386
- };
10387
- SXP_EVENT_BUS.on(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
10388
- return () => {
10389
- SXP_EVENT_BUS.off(SXP_EVENT_TYPE.PAGE_DID_SHOW, onShow);
10390
- };
10391
- }, [src, visible]);
10392
- return (React.createElement(React.Fragment, null,
10393
- !visible && !imgSrc && React.createElement("div", { style: { width: '100%', height: '100%', zIndex: 1, backgroundColor: '#fff' } }),
10394
- (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
10395
- React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
10396
- React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
10397
- React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
10398
- React.createElement("img", { ref: imgRef, className: className, src: imgSrc, style: Object.assign({}, style), loading: loading, onLoad: (e) => {
10399
- setVisible(true);
10400
- onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
10401
- }, alt: alt }))) : (React.createElement("img", { ref: imgRef, className: className, src: imgSrc, style: Object.assign({}, style), loading: loading, onLoad: (e) => {
10402
- setVisible(true);
10403
- onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
10404
- }, alt: alt }))));
10405
- });
10406
- var FormatImage$1 = memo(FormatImage);
10407
-
10408
11142
  const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailData, check }) => {
10409
11143
  var _a;
10410
11144
  const { productView } = useEventReport();
@@ -10494,13 +11228,13 @@ function useVisibleHeight() {
10494
11228
  styleElement.id = 'onetrust-pc-sdk';
10495
11229
  styleElement.setAttribute('type', 'text/css');
10496
11230
  document.head.appendChild(styleElement);
10497
- const css = `
10498
- #onetrust-pc-sdk {
10499
- height: ${finalHeight}px !important;
10500
- }
10501
- #onetrust-pc-sdk #ot-pc-content{
10502
- bottom: ${b}px !important;
10503
- }
11231
+ const css = `
11232
+ #onetrust-pc-sdk {
11233
+ height: ${finalHeight}px !important;
11234
+ }
11235
+ #onetrust-pc-sdk #ot-pc-content{
11236
+ bottom: ${b}px !important;
11237
+ }
10504
11238
  `;
10505
11239
  styleElement.textContent = css;
10506
11240
  }
@@ -11047,10 +11781,10 @@ const CommodityDetail$1 = (_a) => {
11047
11781
  __html: setFontForText((_c = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _c !== void 0 ? _c : '税费', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo)
11048
11782
  } }),
11049
11783
  React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
11050
- React.createElement(ExpandableText$1, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_d = product === null || product === void 0 ? void 0 : product.info) !== null && _d !== void 0 ? _d : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
11051
- bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
11052
- collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
11053
- necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
11784
+ React.createElement(ExpandableText$1, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_d = product === null || product === void 0 ? void 0 : product.info) !== null && _d !== void 0 ? _d : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
11785
+ bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
11786
+ collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
11787
+ necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
11054
11788
  18-karat gold, this necklace is embellished with hand-set diamonds.`, maxStr: 79, className: 'pb-commondity-content-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info }))));
11055
11789
  };
11056
11790
  const renderBtn = () => {
@@ -12049,7 +12783,7 @@ const CommodityDetailDiroNew$1 = (_a) => {
12049
12783
  const productInfoText = ({ isPost }) => {
12050
12784
  return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
12051
12785
  React.createElement(ExpandableText$1, { isPost: isPost, onClick: () => setShowModal(true), className: 'pb-commondityDiroNew-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (product === null || product === void 0 ? void 0 : product.info) ||
12052
- `Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
12786
+ `Unveiled at the Spring-Summer 2023 fashion show, the Dior Toujours bag is distinguished by a casual and practical design. Crafted in black calfskin with Macrocannage topstitching, it showcases a spacious interior compartment with a matching pouch to organize essentials. Its leather strap closure keeps items secure while the D of the CD Lock closure twists to adjust the sides and enhance the bag's silhouette. The leather handles can be adjusted using the small notches in order to be able to carry the large bag by hand or wear it over the shoulder. CD Lock and strap closures D.I.O.R. charms Removable interior pouch Adjustable leather handles Dust bag included
12053
12787
  Made in Italy` })));
12054
12788
  };
12055
12789
  const getStyle = useCallback((style) => {
@@ -18231,10 +18965,10 @@ const MultiPosts$1 = (_a) => {
18231
18965
  const traceInfo = ((_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.traceInfo) || ((_c = recData === null || recData === void 0 ? void 0 : recData.product) === null || _c === void 0 ? void 0 : _c.traceInfo) || '';
18232
18966
  const getPropsVal = useCallback((index, str) => {
18233
18967
  try {
18234
- return new Function('props', 'str', `if (str) {
18235
- return props?.button${index + 1}${str}
18236
- } else {
18237
- return props?.button${index + 1}
18968
+ return new Function('props', 'str', `if (str) {
18969
+ return props?.button${index + 1}${str}
18970
+ } else {
18971
+ return props?.button${index + 1}
18238
18972
  }`)(props, str);
18239
18973
  }
18240
18974
  catch (_a) { }
@@ -20117,10 +20851,16 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
20117
20851
  React.createElement(Swiper, { style: {
20118
20852
  marginTop: tagHeight
20119
20853
  }, ref: swiperRef, onSlideChange: () => {
20120
- swiperRef.current.swiper.allowTouchMove = false;
20121
- setTimeout(() => {
20122
- swiperRef.current.swiper.allowTouchMove = true;
20123
- }, 500);
20854
+ var _a;
20855
+ if ((_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) {
20856
+ swiperRef.current.swiper.allowTouchMove = false;
20857
+ setTimeout(() => {
20858
+ var _a;
20859
+ if ((_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) {
20860
+ swiperRef.current.swiper.allowTouchMove = true;
20861
+ }
20862
+ }, 500);
20863
+ }
20124
20864
  }, onActiveIndexChange: (swiper) => {
20125
20865
  var _a, _b;
20126
20866
  setActiveIndex(swiper.activeIndex);
@@ -21013,10 +21753,16 @@ const DiyStoryPreview = forwardRef(({ data = [], globalConfig, tipText, nudge, t
21013
21753
  // className={style['clc-sxp-container']}
21014
21754
  style: { height: containerHeight, position: 'relative', pointerEvents } },
21015
21755
  React.createElement(Swiper, { ref: swiperRef, allowTouchMove: pointerEvents !== 'none', onSlideChange: () => {
21016
- swiperRef.current.swiper.allowTouchMove = false;
21017
- setTimeout(() => {
21018
- swiperRef.current.swiper.allowTouchMove = true;
21019
- }, 500);
21756
+ var _a;
21757
+ if ((_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) {
21758
+ swiperRef.current.swiper.allowTouchMove = false;
21759
+ setTimeout(() => {
21760
+ var _a;
21761
+ if ((_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) {
21762
+ swiperRef.current.swiper.allowTouchMove = true;
21763
+ }
21764
+ }, 500);
21765
+ }
21020
21766
  }, onActiveIndexChange: (swiper) => {
21021
21767
  setCurIndex(swiper === null || swiper === void 0 ? void 0 : swiper.activeIndex);
21022
21768
  onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(swiper.activeIndex);
@@ -21168,5 +21914,5 @@ var index = memo(SxpPageCore);
21168
21914
  * @FilePath: \pb-sxp-ui\src\index.ts
21169
21915
  */
21170
21916
 
21171
- export { index$2 as DiyPortalPreview, index$1 as DiyStoryPreview, EditorDataProvider, Modal$1 as Modal, SxpDataSourceProvider$1 as SxpDataSourceProvider, index as SxpPageCore, SxpPageRender$1 as SxpPageRender, index$3 as core, Pagebuilder as default, _materials_ as materials, useEditorDataProvider };
21917
+ export { index$2 as DiyPortalPreview, index$1 as DiyStoryPreview, EditorDataProvider, Modal$1 as Modal, StructurePage, SxpDataSourceProvider$1 as SxpDataSourceProvider, index as SxpPageCore, SxpPageRender$1 as SxpPageRender, index$3 as core, Pagebuilder as default, _materials_ as materials, useEditorDataProvider };
21172
21918
  //# sourceMappingURL=index.js.map