@blocklet/pages-kit-inner-components 0.6.23 → 0.6.25

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.
@@ -1,2747 +0,0 @@
1
- import { jsx as r, jsxs as w, Fragment as Q } from "react/jsx-runtime";
2
- import { ErrorOutline as ne } from "@mui/icons-material";
3
- import { Box as f, styled as re, Typography as j, Container as ie, useTheme as ae, useMediaQuery as se, GlobalStyles as le, Card as ce, CircularProgress as de, Grid as wt, CardMedia as ue, CardContent as me, Alert as pe } from "@mui/material";
4
- import he from "lodash/isEmpty";
5
- import pt from "lodash/pick";
6
- import ge, { createContext as It, useMemo as S, useCallback as z, useContext as Lt, useState as Z, useEffect as J, Fragment as fe, isValidElement as Et, useRef as ht } from "react";
7
- import R from "lodash/keyBy";
8
- import { styled as C, useTheme as At } from "@arcblock/ux/lib/Theme";
9
- import { cx as b, css as ct } from "@emotion/css";
10
- import I from "lodash/omit";
11
- import { Link as xe, NavLink as be, useNavigate as ye } from "react-router-dom";
12
- import ve from "@arcblock/ux/lib/Button";
13
- import dt from "is-uri";
14
- import { Icon as Pt } from "@iconify-icon/react";
15
- import { e as F, f as L, i as gt, l as ft } from "./state-DSo43FAB.js";
16
- import we from "@blocklet/pages-kit/builtin/markdown/markdown-renderer";
17
- import { useColorConvert as Wt } from "@blocklet/pages-kit/contexts/color";
18
- import { materialDark as ke } from "react-syntax-highlighter/dist/esm/styles/prism";
19
- import _e from "@arcblock/react-hooks/lib/useBrowser";
20
- import kt from "@arcblock/ux/lib/Colors";
21
- import { ResponsiveImage as jt, CustomComponentRenderer as $e } from "@blocklet/pages-kit/components";
22
- import { isGradient as Ce, isColorString as Se } from "@blocklet/pages-kit/utils/style";
23
- import zt from "@mui/material/useMediaQuery";
24
- import { join as X } from "pathe";
25
- import { withoutTrailingSlash as lt, isRelative as Be, parseURL as Ne } from "ufo";
26
- import { useMessage as Re } from "@blocklet/embed/message";
27
- import { useLatest as Me } from "ahooks";
28
- import Ie from "lodash/isEqual";
29
- import { EmbedIframe as Le } from "@blocklet/embed/react";
30
- import { useLocaleContext as Ee } from "@arcblock/ux/lib/Locale/context";
31
- import ut from "@arcblock/ux/lib/Screenshot";
32
- import { TwitterTimelineEmbed as Ae } from "react-twitter-embed";
33
- import { useUpdate as Pe, useMount as We } from "react-use";
34
- const tt = "{{CUSTOM_VALUE}}", je = [
35
- {
36
- title: "None",
37
- value: "none",
38
- sx: { py: 0 }
39
- },
40
- {
41
- title: "Small",
42
- value: "small",
43
- sx: { py: { xs: 2.5, md: 4, lg: 4, xl: 6 } }
44
- },
45
- {
46
- title: "Normal",
47
- value: "normal",
48
- sx: { py: { xs: 5, md: 7.5, lg: 10, xl: 12.5 } }
49
- },
50
- {
51
- title: "Large",
52
- value: "large",
53
- sx: { py: { xs: 7.5, md: 10, lg: 12.5, xl: 15 } }
54
- }
55
- ], ze = [
56
- {
57
- title: "None",
58
- value: "none",
59
- sx: { py: 0 }
60
- },
61
- {
62
- title: "Small",
63
- value: "small",
64
- sx: { py: { xs: 2.5, md: 4, lg: 4, xl: 6 } }
65
- },
66
- {
67
- title: "Normal",
68
- value: "normal",
69
- sx: { py: { xs: 5, md: 7, lg: 7, xl: 9 } }
70
- },
71
- {
72
- title: "Large",
73
- value: "large",
74
- sx: { py: { xs: 6, md: 9, lg: 9, xl: 11 } }
75
- }
76
- ], Fe = [
77
- {
78
- title: "None",
79
- value: "none",
80
- sx: { px: 0 }
81
- },
82
- {
83
- title: "Small",
84
- value: "small",
85
- sx: { px: { xs: 2, md: 4, lg: 4, xl: 6 } }
86
- },
87
- {
88
- title: "Normal",
89
- value: "normal",
90
- sx: { px: { xs: 2.5, md: 7.5, lg: 10, xl: 12.5 } }
91
- },
92
- {
93
- title: "Large",
94
- value: "large",
95
- sx: { px: { xs: 2.5, md: 10, lg: 12.5, xl: 15 } }
96
- }
97
- ], q = (t, e, o) => {
98
- const n = t.breakpoints.values[o];
99
- return `${e}${n ? ` (${n}px)` : ""}`;
100
- }, Te = [
101
- {
102
- title: "100%",
103
- value: "full",
104
- sx: { maxWidth: "100%" }
105
- },
106
- {
107
- title: (t) => q(t, "Small", "sm"),
108
- value: "sm",
109
- sx: {
110
- maxWidth: (t) => t.breakpoints.values.sm,
111
- width: "100%",
112
- mx: "auto"
113
- }
114
- },
115
- {
116
- title: (t) => q(t, "Normal", "md"),
117
- value: "md",
118
- sx: { maxWidth: (t) => t.breakpoints.values.md, width: "100%", mx: "auto" }
119
- },
120
- {
121
- title: (t) => q(t, "Large", "lg"),
122
- value: "lg",
123
- sx: { maxWidth: (t) => t.breakpoints.values.lg, width: "100%", mx: "auto" }
124
- },
125
- {
126
- title: (t) => q(t, "Extra Large", "xl"),
127
- value: "xl",
128
- sx: { maxWidth: (t) => t.breakpoints.values.xl, width: "100%", mx: "auto" }
129
- },
130
- {
131
- title: "Custom",
132
- value: "custom",
133
- sx: {
134
- maxWidth: tt,
135
- width: "100%",
136
- mx: "auto"
137
- }
138
- }
139
- ], Oe = [
140
- {
141
- title: "None",
142
- value: "none",
143
- sx: { gap: 0 },
144
- containerSx: { gap: 0 }
145
- },
146
- {
147
- title: "Small",
148
- value: "small",
149
- sx: { gap: { xs: 1, md: 2, lg: 2, xl: 3 } }
150
- },
151
- {
152
- title: "Normal",
153
- value: "normal",
154
- sx: { gap: { xs: 2, md: 3.5, lg: 3.5, xl: 5 } }
155
- },
156
- {
157
- title: "Large",
158
- value: "large",
159
- sx: { gap: { xs: 3, md: 5, lg: 5, xl: 6.5 } }
160
- }
161
- ], Ue = [
162
- {
163
- title: "None",
164
- value: "none",
165
- sx: { p: 0 }
166
- },
167
- {
168
- title: "Small",
169
- value: "small",
170
- sx: { p: { xs: 1, md: 2, lg: 2, xl: 3 } }
171
- },
172
- {
173
- title: "Normal",
174
- value: "normal",
175
- sx: { p: { xs: 2.5, md: 5, lg: 5, xl: 7.5 } }
176
- },
177
- {
178
- title: "Large",
179
- value: "large",
180
- sx: { p: { xs: 3, md: 6, lg: 6, xl: 9 } }
181
- }
182
- ], De = [
183
- {
184
- title: "Start",
185
- value: "start",
186
- sx: { alignContent: "start" }
187
- },
188
- {
189
- title: "Center",
190
- value: "center",
191
- sx: { alignContent: "center" }
192
- },
193
- {
194
- title: "End",
195
- value: "end",
196
- sx: { alignContent: "end" }
197
- },
198
- {
199
- title: "Space Between",
200
- value: "space-between",
201
- sx: { alignContent: "space-between" }
202
- },
203
- {
204
- title: "Space Around",
205
- value: "space-around",
206
- sx: { alignContent: "space-around" }
207
- },
208
- {
209
- title: "Space Evenly",
210
- value: "space-evenly",
211
- sx: { alignContent: "space-evenly" }
212
- }
213
- ], Ge = [
214
- {
215
- title: "Start",
216
- value: "start",
217
- sx: { justifyContent: "start" }
218
- },
219
- {
220
- title: "Center",
221
- value: "center",
222
- sx: { justifyContent: "center" }
223
- },
224
- {
225
- title: "End",
226
- value: "end",
227
- sx: { justifyContent: "end" }
228
- },
229
- {
230
- title: "Space Between",
231
- value: "space-between",
232
- sx: { justifyContent: "space-between" }
233
- },
234
- {
235
- title: "Space Around",
236
- value: "space-around",
237
- sx: { justifyContent: "space-around" }
238
- },
239
- {
240
- title: "Space Evenly",
241
- value: "space-evenly",
242
- sx: { justifyContent: "space-evenly" }
243
- }
244
- ], He = [
245
- {
246
- title: "Solid",
247
- value: "solid",
248
- sx: { border: "1px solid", borderColor: "divider" },
249
- group: "borderFrame"
250
- },
251
- {
252
- title: "Dashed",
253
- value: "dashed",
254
- sx: { border: "1px dashed", borderColor: "divider" },
255
- group: "borderFrame"
256
- },
257
- {
258
- title: "Dotted",
259
- value: "dotted",
260
- sx: { border: "1px dotted", borderColor: "divider" },
261
- group: "borderFrame"
262
- },
263
- {
264
- title: "Custom",
265
- value: "custom",
266
- sx: {
267
- border: tt
268
- },
269
- group: "borderFrame"
270
- }
271
- ], Ft = [
272
- // new device frames
273
- { value: "macbook", title: "MacBook", group: "deviceFrame" },
274
- { value: "phone", title: "Phone", group: "deviceFrame" }
275
- // old device frames:
276
- // @FIXME:以下类型不适配 children,先注释掉了,会走以前的逻辑,渲染 p script 有问题
277
- // { value: 'iphone-x', title: 'iPhone X', group: 'deviceFrame' },
278
- // { value: 'iphone-8', title: 'iPhone 8', group: 'deviceFrame' },
279
- // { value: 'ipad-pro', title: 'iPad Pro', group: 'deviceFrame' },
280
- // { value: 'imac-pro', title: 'iMac Pro', group: 'deviceFrame' },
281
- // { value: 'macbook-pro', title: 'MacBook Pro', group: 'deviceFrame' },
282
- // { value: 'surface-pro', title: 'Surface Pro', group: 'deviceFrame' },
283
- // { value: 'surface-book', title: 'Surface Book', group: 'deviceFrame' },
284
- // { value: 'surface-studio', title: 'Surface Studio', group: 'deviceFrame' },
285
- // { value: 'galaxy-s8', title: 'Galaxy S8', group: 'deviceFrame' },
286
- // { value: 'google-pixel', title: 'Google Pixel', group: 'deviceFrame' },
287
- // { value: 'google-pixel-2-xl', title: 'Google Pixel 2 XL', group: 'deviceFrame' },
288
- // { value: 'apple-watch', title: 'Apple Watch', group: 'deviceFrame' },
289
- ], Tt = (t) => Ft.some((e) => e.value === t), _t = ({ hasUrl: t = !1, hasTab: e = !1 } = {}) => ({
290
- position: "relative",
291
- paddingTop: "2em",
292
- // 为顶部栏腾出空间
293
- // 移除这些边框属性
294
- // border: 1,
295
- // borderColor: 'divider',
296
- // borderTop: '2em solid',
297
- // borderTopColor: 'divider',
298
- // borderRadius: 1,
299
- // 使用伪元素替代边框
300
- "&::before": {
301
- content: '""',
302
- position: "absolute",
303
- top: 0,
304
- left: 0,
305
- right: 0,
306
- bottom: 0,
307
- border: "1px solid",
308
- borderColor: "divider",
309
- pointerEvents: "none",
310
- zIndex: 1
311
- },
312
- // 使用伪元素替代顶部边框
313
- "&::after": {
314
- content: '""',
315
- position: "absolute",
316
- top: 0,
317
- left: 0,
318
- right: 0,
319
- height: "2em",
320
- backgroundColor: "divider",
321
- pointerEvents: "none",
322
- zIndex: 1
323
- },
324
- // 浏览器按钮
325
- "& > div:first-of-type:before": {
326
- display: "block",
327
- position: "absolute",
328
- content: '""',
329
- top: "-1.25em",
330
- // 调整按钮位置到顶部栏中间
331
- left: "1em",
332
- width: "0.5em",
333
- height: "0.5em",
334
- borderRadius: "50%",
335
- bgcolor: "#f44",
336
- boxShadow: "0 0 0 2px #f44, 1.5em 0 0 2px #9b3, 3em 0 0 2px #fb5",
337
- zIndex: 2
338
- },
339
- // 浏览器 URL 栏样式
340
- "& > div:first-of-type:after": t ? {
341
- display: "block",
342
- position: "absolute",
343
- content: '""',
344
- top: "-1.6em",
345
- // 调整URL栏位置到顶部栏中间
346
- left: "5.5em",
347
- width: "calc(100% - 7em)",
348
- height: "1.2em",
349
- borderRadius: 0.25,
350
- bgcolor: "white",
351
- zIndex: 2
352
- } : e ? {
353
- display: "block",
354
- position: "absolute",
355
- content: '""',
356
- top: "0em",
357
- // 调整Tab栏位置
358
- left: "5.5em",
359
- width: "20%",
360
- height: "0em",
361
- borderBottom: "2em solid white",
362
- borderLeft: "0.8em solid transparent",
363
- borderRight: "0.8em solid transparent",
364
- zIndex: 2
365
- } : {}
366
- }), Ve = [
367
- {
368
- value: "chrome",
369
- title: "Chrome",
370
- group: "browserFrame",
371
- sx: _t()
372
- },
373
- {
374
- value: "chrome-with-url",
375
- title: "Chrome (With URL)",
376
- group: "browserFrame",
377
- sx: _t({
378
- hasUrl: !0
379
- })
380
- }
381
- ], Je = [
382
- {
383
- value: "shadow-sm",
384
- title: "Shadow Low Elevation",
385
- group: "shadowFrame",
386
- sx: { boxShadow: (t) => t.shadows[2] }
387
- },
388
- {
389
- value: "shadow-md",
390
- title: "Shadow Medium Elevation",
391
- group: "shadowFrame",
392
- sx: { boxShadow: (t) => t.shadows[6] }
393
- },
394
- {
395
- value: "shadow-lg",
396
- title: "Shadow High Elevation",
397
- group: "shadowFrame",
398
- sx: { boxShadow: (t) => t.shadows[12] }
399
- },
400
- {
401
- value: "shadow-xl",
402
- title: "Shadow Extra High Elevation",
403
- group: "shadowFrame",
404
- sx: { boxShadow: (t) => t.shadows[16] }
405
- },
406
- {
407
- value: "shadow-max",
408
- title: "Shadow Max Elevation",
409
- group: "shadowFrame",
410
- sx: { boxShadow: (t) => t.shadows[24] }
411
- }
412
- ], Ye = [
413
- {
414
- title: "None",
415
- value: "none",
416
- sx: { border: "none" },
417
- group: "commonFrame"
418
- },
419
- ...He,
420
- ...Ve,
421
- ...Je,
422
- ...Ft
423
- ], Ke = [
424
- {
425
- title: "None",
426
- value: "none",
427
- sx: { borderRadius: 0 }
428
- },
429
- {
430
- title: "Small",
431
- value: "small",
432
- sx: { borderRadius: 1 }
433
- // theme.shape.borderRadius * 1
434
- },
435
- {
436
- title: "Medium",
437
- value: "medium",
438
- sx: { borderRadius: 2 }
439
- // theme.shape.borderRadius * 2
440
- },
441
- {
442
- title: "Large",
443
- value: "large",
444
- sx: { borderRadius: 3 }
445
- // theme.shape.borderRadius * 3
446
- },
447
- {
448
- title: "Extra Large",
449
- value: "xl",
450
- sx: { borderRadius: 4 }
451
- // theme.shape.borderRadius * 4
452
- },
453
- {
454
- title: "Rounded",
455
- value: "rounded",
456
- sx: { borderRadius: "50%" }
457
- },
458
- {
459
- title: "Custom",
460
- value: "custom",
461
- sx: { borderRadius: tt }
462
- }
463
- ], Xe = R(je, "value"), qe = R(ze, "value"), Qe = R(Fe, "value"), Ze = R(Te, "value"), to = R(Oe, "value"), eo = R(Ue, "value"), oo = R(De, "value"), no = R(Ge, "value"), ro = R(Ye, "value"), io = R(Ke, "value"), ao = /* @__PURE__ */ new Map([
464
- ["baseSectionPaddingY", Xe],
465
- ["maxWidth", Ze],
466
- ["paddingY", qe],
467
- ["paddingX", Qe],
468
- ["layoutBlockGap", to],
469
- ["layoutBlockPadding", eo],
470
- ["layoutBlockAlignContent", oo],
471
- ["layoutBlockJustifyContent", no],
472
- ["layoutBlockBorder", ro],
473
- ["layoutBlockBorderRadius", io]
474
- ]);
475
- function W(t) {
476
- const { type: e, value: o, format: n = "sx", defaultValue: i = null } = t, a = ao.get(e);
477
- if (!a || typeof o != "string" || !o)
478
- return i;
479
- const c = o.startsWith("custom:"), s = c ? "custom" : o;
480
- if (a?.[s] && a?.[s]?.[n]) {
481
- const l = a[s][n];
482
- if (c) {
483
- const d = o.replace("custom:", "");
484
- try {
485
- return JSON.parse(JSON.stringify(l || {}).replaceAll(tt, d));
486
- } catch {
487
- }
488
- }
489
- return l;
490
- }
491
- return i;
492
- }
493
- const Ot = It({
494
- page: null,
495
- getPageMeta: () => ({}),
496
- getPageMetaStyle: () => ({})
497
- });
498
- function so() {
499
- return Lt(Ot);
500
- }
501
- function cr({
502
- page: t,
503
- children: e,
504
- defaultLocale: o = "en",
505
- currentLocale: n
506
- }) {
507
- const i = S(() => t ? JSON.parse(JSON.stringify(t)) : null, [JSON.stringify(t)]), a = z(() => {
508
- if (!i) return {};
509
- const l = n || o;
510
- return i.locales?.[l] ?? {};
511
- }, [i, o, n]), c = z(
512
- (l = "sx") => {
513
- const d = a();
514
- return !d || !d.style ? {} : Object.entries(d.style || {}).reduce((u, [h, p]) => {
515
- if (!p) return u;
516
- const y = `${h}Custom`;
517
- d.style[y];
518
- const x = W({
519
- type: h,
520
- value: p,
521
- format: l
522
- });
523
- return x ? { ...u, ...x } : u;
524
- }, {});
525
- },
526
- [a]
527
- ), s = S(
528
- () => ({
529
- page: i,
530
- getPageMeta: a,
531
- getPageMetaStyle: c
532
- }),
533
- [i, a, c]
534
- );
535
- return /* @__PURE__ */ r(Ot.Provider, { value: s, children: e });
536
- }
537
- const et = ["editing", "height", "locale", "dev", "sx"];
538
- function lo(t) {
539
- const { className: e, ...o } = t;
540
- return /* @__PURE__ */ r(co, { ...o, className: b("BlockBase-root", e) });
541
- }
542
- const co = C(f)`
543
- position: relative;
544
- color: ${({ theme: t }) => t.palette.text.primary};
545
- `, Ut = It({
546
- pages: [],
547
- project: void 0
548
- }), { Provider: dr, Consumer: ur } = Ut;
549
- function Dt() {
550
- return Lt(Ut);
551
- }
552
- function uo({ icon: t, ...e }) {
553
- return /* @__PURE__ */ r(Pt, { icon: t, ...e, ref: null });
554
- }
555
- function mo({ icon: t, className: e = "", size: o = "1rem", ...n }) {
556
- return /* @__PURE__ */ r(po, { component: uo, className: b("css-icon", e), size: o, ...n, icon: t });
557
- }
558
- const po = C(f)`
559
- &.css-icon {
560
- display: inline-block;
561
- width: ${({ size: t }) => t};
562
- height: ${({ size: t }) => t};
563
- }
564
- `;
565
- function ho({ icon: t, className: e = "", size: o = "1rem", imageMeta: n, ...i }) {
566
- const a = F(L(t), 540), [c, s] = Z(!1), l = At();
567
- return c ? /* @__PURE__ */ r(mo, { icon: "i-mdi:image", color: l.palette.grey[500], size: o, className: e, ...i }) : /* @__PURE__ */ r(go, { className: b("image-icon", e), size: o, ...i, children: /* @__PURE__ */ r(
568
- "img",
569
- {
570
- className: "image-icon__image",
571
- src: a,
572
- onError: () => s(!0),
573
- width: n?.naturalWidth,
574
- height: n?.naturalHeight,
575
- alt: n?.filename || "card-icon",
576
- loading: "lazy"
577
- }
578
- ) });
579
- }
580
- const go = C(f)`
581
- display: inline-block;
582
- width: ${({ size: t }) => t};
583
- height: ${({ size: t }) => t};
584
- .image-icon__image {
585
- object-fit: contain;
586
- height: 100%;
587
- width: 100%;
588
- }
589
- `, xt = (t) => typeof t == "string" && /^[\w-_]+:[\w-_]+$/.test(t);
590
- function mt({ icon: t, size: e = "1rem", imageMeta: o, ...n }) {
591
- const i = window.isNaN(e) ? e : `${e}px`;
592
- return xt(t) ? /* @__PURE__ */ r(Pt, { icon: t }) : /* @__PURE__ */ r(fo, { component: ho, imageMeta: o, className: "base-icon", icon: t, size: i, ...n });
593
- }
594
- const fo = C(f)`
595
- flex-shrink: 0;
596
- `;
597
- function V({ text: t, children: e, icon: o = "", endIcon: n, color: i = "primary", link: a = "", href: c = "", ...s }) {
598
- const l = o ? /* @__PURE__ */ r(mt, { icon: o }) : null, d = n ? /* @__PURE__ */ r(mt, { icon: n }) : null, m = a || c, u = { ...s };
599
- return m && (u.href = m, dt(m) && (u.target = u.target || "_blank")), /* @__PURE__ */ r(ve, { startIcon: l, endIcon: d, color: i, ...u, children: t || e });
600
- }
601
- function Gt({ editing: t, text: e, ...o }) {
602
- const { pages: n = [] } = Dt(), i = n.find((a) => a.id === (o.link || o.linkId));
603
- if (t)
604
- return /* @__PURE__ */ r(V, { ...I(o, ["link", "linkId"]), children: e });
605
- if (i) {
606
- const a = i.path || "/";
607
- return /* @__PURE__ */ r(xe, { to: a, children: /* @__PURE__ */ r(V, { ...I(o, ["link", "linkId"]), children: e }) });
608
- }
609
- return /* @__PURE__ */ r(V, { ...I(o, "linkId"), children: e });
610
- }
611
- function O({ actions: t, center: e, className: o, align: n }) {
612
- return t && t?.length ? /* @__PURE__ */ r(
613
- f,
614
- {
615
- className: b(
616
- "flex gap-4 flex-wrap",
617
- "lg:flex-row lg:gap-8",
618
- (e || n === "center") && "justify-center",
619
- !e && n === "right" && "justify-end",
620
- !e && n === "left" && "justify-start",
621
- o
622
- ),
623
- sx: { alignItems: "center" },
624
- children: t
625
- }
626
- ) : null;
627
- }
628
- const xo = "section", bo = re(f)`
629
- overflow: hidden;
630
-
631
- .section__title {
632
- margin-top: 0;
633
- font-weight: 700;
634
- }
635
- .section__title_non_big {
636
- font-size: 32px;
637
- @media (max-width: 600px) {
638
- font-size: 24px;
639
- }
640
- }
641
- &.base-info .section__tag {
642
- margin-top: 0;
643
- margin-bottom: 2vw;
644
- background-color: ${({ theme: t }) => t.palette.primary.main};
645
- white-space: nowrap;
646
- max-width: 100%;
647
- display: inline-block;
648
- padding: 0 10px;
649
- justify-content: flex-start;
650
- overflow: hidden;
651
- text-overflow: ellipsis;
652
- font-size: 12px;
653
- color: #fff;
654
- border-radius: 4px;
655
- line-height: 20px;
656
- }
657
- .section__title {
658
- color: ${({ theme: t }) => t.palette.text.primary};
659
- a {
660
- color: ${({ theme: t }) => t.palette.primary.main};
661
- }
662
- p {
663
- margin-top: 0;
664
- margin-bottom: 0;
665
- }
666
- }
667
- .section__description {
668
- color: ${({ theme: t }) => t.palette.text.primary};
669
- margin-bottom: 4vw;
670
- margin-top: 0;
671
- a {
672
- color: ${({ theme: t }) => t.palette.primary.main};
673
- }
674
- p {
675
- margin-top: 0;
676
- margin-bottom: 0.5rem;
677
- }
678
- }
679
- @media (min-width: ${({ theme: t }) => t.breakpoints.values[xo]}px) {
680
- .section__tag {
681
- margin-bottom: 32px;
682
- }
683
- .section__title {
684
- margin-bottom: 32px;
685
- }
686
- .section__description {
687
- margin-bottom: 40px;
688
- }
689
- }
690
- `;
691
- function ot({
692
- title: t,
693
- description: e,
694
- descriptionMarkdown: o,
695
- actions: n,
696
- className: i = "",
697
- classes: a = {},
698
- prepend: c,
699
- append: s,
700
- level: l = 2,
701
- tag: d,
702
- badge: m,
703
- center: u,
704
- logo: h,
705
- titleAppearance: p,
706
- descriptionAppearance: y,
707
- ...x
708
- }) {
709
- const v = Wt();
710
- if (!t && !e && !n && !m && !d && !c && !s && !h) return null;
711
- const k = Math.max(Math.min(5, l + 1), 1), _ = {
712
- 1: "xl:!text-3xl lg:!text-2xl md:!text-xl",
713
- 2: "xl:!text-2xl lg:!text-xl md:!text-lg",
714
- 3: "xl:!text-2xl lg:!text-xl md:!text-lg",
715
- 4: "xl:!text-xl lg:!text-lg md:!text-md",
716
- 5: "xl:!text-lg md:!text-md sm:!text-sm",
717
- 6: "!text-sm"
718
- }, M = l === 0 ? "big" : `h${k}`, B = l === 0;
719
- return /* @__PURE__ */ w(bo, { className: b("base-info", "lg:text-left", u && "!text-center", i), ...x, children: [
720
- c && /* @__PURE__ */ r("div", { children: c }),
721
- (d || m) && /* @__PURE__ */ r("div", { className: b("section__tag", a?.tag || a?.badge), children: d || m }),
722
- h && /* @__PURE__ */ r("img", { className: "w-[120px] m-auto mb-8", src: h, alt: "info", loading: "lazy" }),
723
- t && /* @__PURE__ */ r(
724
- j,
725
- {
726
- sx: {
727
- whiteSpace: "pre-wrap",
728
- mb: e ? "2vw" : 0,
729
- ...p?.color && { color: `${v(p.color)} !important` }
730
- },
731
- className: b(
732
- "section__title",
733
- "text-gray-800",
734
- "dark:text-gray-50",
735
- a.title,
736
- "page-kit-section__title",
737
- B ? "" : "section__title_non_big"
738
- ),
739
- component: `h${Math.max(l, 1)}`,
740
- variant: M,
741
- children: t
742
- }
743
- ),
744
- e && (o ? /* @__PURE__ */ r(
745
- f,
746
- {
747
- sx: {
748
- ...y?.color && { color: `${v(y.color)} !important` }
749
- },
750
- className: b(
751
- "section__description",
752
- "text-gray-800",
753
- "dark:text-gray-100",
754
- _[k],
755
- a.description,
756
- "page-kit-section__description"
757
- ),
758
- children: /* @__PURE__ */ r(we, { codeOptions: { showActionButton: !1, theme: ke }, children: e })
759
- }
760
- ) : /* @__PURE__ */ r(
761
- j,
762
- {
763
- sx: {
764
- whiteSpace: "pre-wrap",
765
- ...y?.color && { color: `${v(y.color)} !important` }
766
- },
767
- className: b(
768
- "section__description",
769
- "text-gray-800",
770
- "dark:text-gray-100",
771
- _[k],
772
- a.description,
773
- "page-kit-section__description"
774
- ),
775
- component: "div",
776
- variant: "body1",
777
- gutterBottom: !0,
778
- children: e
779
- }
780
- )),
781
- /* @__PURE__ */ r(O, { actions: n, center: u, className: "mt-8" }),
782
- s && /* @__PURE__ */ r("div", { children: s })
783
- ] });
784
- }
785
- const nt = [
786
- "actions",
787
- "append",
788
- "badge",
789
- "tag",
790
- "center",
791
- "description",
792
- "descriptionMarkdown",
793
- "level",
794
- "logo",
795
- "prepend",
796
- "title",
797
- "titleAppearance",
798
- "descriptionAppearance"
799
- ];
800
- function yo() {
801
- const t = navigator.userAgent.toLowerCase();
802
- return t.includes("safari") && !t.includes("chrome");
803
- }
804
- function vo(t = "") {
805
- if (t.startsWith("data:image/svg+xml,")) return !0;
806
- const e = /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/, o = /^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;
807
- return e.test(t) || o.test(t);
808
- }
809
- function H(t) {
810
- return t?.endsWith(".mp4") || t?.endsWith(".m4v") || t?.endsWith(".webm");
811
- }
812
- function wo(t) {
813
- return t?.endsWith(".mp4") || t?.endsWith(".m4v") ? "video/mp4" : t?.endsWith(".webm") ? "video/webm" : void 0;
814
- }
815
- function ko(t) {
816
- let e = {};
817
- return typeof t == "string" ? Ce(t) ? e.image = t : (e.image = L(t), Se(t) && (e.color = t, e.image = "")) : e = t, e;
818
- }
819
- function _o() {
820
- const [t, e] = Z(Date.now());
821
- return J(() => {
822
- const o = () => {
823
- e(Date.now());
824
- };
825
- return document.addEventListener("visibilitychange", o), () => {
826
- document.removeEventListener("visibilitychange", o);
827
- };
828
- }, []), t;
829
- }
830
- function $t(t, e, o, n, i) {
831
- let a = null;
832
- const { color: c = "", image: s } = ko(e);
833
- if (s && vo(s)) {
834
- delete o.backgroundColor;
835
- const l = !(t.mobile.apple.device || yo()) && H(s), d = H(s) && n ? F(L(n), 1200, "quality") : "";
836
- l ? a = /* @__PURE__ */ r(
837
- f,
838
- {
839
- component: "video",
840
- className: "section-bg",
841
- autoPlay: !0,
842
- loop: !0,
843
- muted: !0,
844
- controls: !1,
845
- playsInline: !0,
846
- poster: d,
847
- src: H(s) ? s : F(s, 1200, "quality"),
848
- sx: {
849
- width: "100%",
850
- position: "absolute",
851
- zIndex: -9999,
852
- right: 0,
853
- left: 0,
854
- top: 0,
855
- height: "100%",
856
- objectFit: "cover"
857
- }
858
- },
859
- s
860
- ) : a = /* @__PURE__ */ r(
861
- jt,
862
- {
863
- src: H(s) && n ? d : s,
864
- sizesAttr: {
865
- sm: 600,
866
- md: 900,
867
- lg: 1200
868
- },
869
- className: "section-bg",
870
- alt: "",
871
- width: "100%",
872
- loading: "lazy",
873
- sx: {
874
- position: "absolute",
875
- zIndex: -9999,
876
- right: 0,
877
- left: 0,
878
- top: 0,
879
- width: "100%",
880
- height: "100%",
881
- objectFit: "cover"
882
- }
883
- },
884
- i || s
885
- );
886
- } else s ? o.backgroundImage = `${s} !important` : c && (o.backgroundColor = `${c} !important`);
887
- return a;
888
- }
889
- function $o({ autoWidth: t, children: e, ...o }) {
890
- return t ? /* @__PURE__ */ r(
891
- f,
892
- {
893
- ...o,
894
- sx: [
895
- {
896
- display: "flex"
897
- },
898
- ...Array.isArray(o.sx) ? o.sx : [o.sx]
899
- ],
900
- children: e
901
- }
902
- ) : /* @__PURE__ */ r(ie, { ...o, children: e });
903
- }
904
- function rt({
905
- dark: t = !1,
906
- children: e,
907
- className: o,
908
- sx: n = {},
909
- boxed: i = { show: !1 },
910
- padding: a = "normal",
911
- boxProps: c,
912
- type: s,
913
- ...l
914
- }) {
915
- const d = { ...n }, m = zt((p) => p.breakpoints.down("md"));
916
- t && (d.color = kt.common.white, d.backgroundColor = `${kt.grey[900]} !important`), i.show && (d.display = "flex");
917
- const u = S(() => !Number(l.boxMaxWidth) || m ? {
918
- width: "100%"
919
- } : s === "wall" && l.boxMaxWidth ? {
920
- maxWidth: `${l.boxMaxWidth}px !important`,
921
- width: "100%"
922
- } : {
923
- width: "100%"
924
- }, [l.boxMaxWidth, m, s]), h = W({
925
- type: "baseSectionPaddingY",
926
- value: a || "normal",
927
- // section default is normal
928
- defaultValue: ""
929
- });
930
- return /* @__PURE__ */ r(
931
- Co,
932
- {
933
- component: "section",
934
- styles: { ...d, ...h },
935
- className: b("base-section", "px-2 md:px-5 lg:px-5 xl:px-10", o, {
936
- dark: t
937
- }),
938
- ...I(
939
- l,
940
- "hoverStyle",
941
- "boxMaxWidth",
942
- "embedUrl",
943
- "autoWidth",
944
- "paddingXY",
945
- "iframeHeight",
946
- "titleAppearance",
947
- "descriptionAppearance"
948
- ),
949
- children: /* @__PURE__ */ r($o, { autoWidth: l?.autoWidth, className: b("section-content h-full"), sx: u, children: i.show ? /* @__PURE__ */ r(Ht, { ...c, boxed: i, children: e }) : e })
950
- }
951
- );
952
- }
953
- function Ht({
954
- background: t = "",
955
- backgroundVideoPoster: e,
956
- children: o,
957
- sx: n = {},
958
- boxed: i = { show: !1 },
959
- className: a = "",
960
- styles: c = {},
961
- ...s
962
- }) {
963
- const l = { ...c, ...n }, d = Wt();
964
- let m = null;
965
- const u = zt((y) => y.breakpoints.up("sm")), h = _e(), p = _o();
966
- return t && (m = $t(
967
- h,
968
- typeof t == "string" ? d(t) : t,
969
- l,
970
- e,
971
- p
972
- )), i.show && (l.borderRadius = "10px", l.padding === void 0 && (l.padding = u ? "50px" : "20px"), i?.border && (l.border = "1px solid #c0c0c0"), i?.background && (m = $t(
973
- h,
974
- typeof i?.background == "string" ? d(i?.background) : i?.background,
975
- l,
976
- i?.backgroundVideoPoster,
977
- p
978
- ))), /* @__PURE__ */ w(
979
- f,
980
- {
981
- ...s,
982
- sx: {
983
- ...l,
984
- ...m ? { position: "relative", overflow: "hidden", zIndex: 0 } : {}
985
- },
986
- className: b(a, i?.boxShadow && "shadow-xl"),
987
- children: [
988
- m,
989
- o
990
- ]
991
- }
992
- );
993
- }
994
- const Co = C(Ht)`
995
- &:nth-of-type(even) {
996
- background: #f8f8f8;
997
- }
998
-
999
- @media (max-width: 600px) {
1000
- .section__title {
1001
- font-size: 24px;
1002
- }
1003
-
1004
- .base-info {
1005
- > *:last-child {
1006
- margin-bottom: 0;
1007
- }
1008
- }
1009
- }
1010
- `;
1011
- function Vt(t) {
1012
- if (t.type === fe) {
1013
- const o = (t.props.children || []).filter((n) => Et(n));
1014
- return o.length === 1 ? Vt(o[0]) : o.length > 1;
1015
- }
1016
- return Array.isArray(t);
1017
- }
1018
- const P = "&>*";
1019
- function Jt({ children: t, col: e, gap: o, className: n, align: i, sx: a, type: c, ...s } = {
1020
- children: null,
1021
- className: "",
1022
- col: 3,
1023
- gap: void 0,
1024
- sx: {},
1025
- align: "center",
1026
- type: "default"
1027
- }) {
1028
- const l = At(), d = Number(Math.floor(100 / e * 100) / 100), m = {
1029
- center: "justify-center items-center",
1030
- left: "justify-start items-center",
1031
- right: "justify-end items-center",
1032
- top: "justify-center items-start",
1033
- bottom: "justify-center items-end",
1034
- "top-left": "justify-start items-start",
1035
- "top-right": "justify-end items-start",
1036
- "bottom-left": "justify-start items-end",
1037
- "bottom-right": "justify-end items-end"
1038
- }, u = m[i] || m.center;
1039
- let p = o ?? ({
1040
- 2: 6,
1041
- 3: 4,
1042
- 4: 4,
1043
- 5: 3,
1044
- 6: 3
1045
- }[e] || 0);
1046
- Vt(t) || (p = 0);
1047
- const x = (e - 1) * p / e;
1048
- let v = { ...a, gap: `${p}rem` };
1049
- const k = { [P]: { width: "100%" } }, _ = {}, M = {}, B = {};
1050
- switch (k.gap = "1rem", _.gap = `${p / 2}rem`, e) {
1051
- case 3:
1052
- case 4:
1053
- _[P] = {
1054
- width: `calc(50% - ${p / 2}rem)`
1055
- };
1056
- break;
1057
- case 5:
1058
- case 6:
1059
- k[P] = {
1060
- width: `calc(50% - ${p / 2 / 2}rem)`
1061
- }, _[P] = {
1062
- width: `calc(50% - ${p / 2 / 2}rem)`
1063
- }, M[P] = {
1064
- width: `calc(33.33% - ${p * 2 / 3}rem)`
1065
- };
1066
- break;
1067
- }
1068
- return v[P] = { width: `calc(${d}% - ${x}rem)` }, v[`@media (max-width: ${l.breakpoints.values.xl}px)`] = B, v[`@media (max-width: ${l.breakpoints.values.lg}px)`] = M, v[`@media (max-width: ${l.breakpoints.values.md}px)`] = _, v[`@media (max-width: ${l.breakpoints.values.sm}px)`] = k, c === "wall" && (v = { ...a, gap: `${p}rem` }, v[P] = { width: `calc(${d}% - ${x}rem)` }, k[P] = { width: `calc(45% - ${p / 2 / 2}rem)` }, v[`@media (max-width: ${l.breakpoints.values.sm}px)`] = k), /* @__PURE__ */ r(f, { className: b("flex flex-wrap flex-row h-full", u, n), sx: v, ...s, children: t });
1069
- }
1070
- function U({ type: t = "", icon: e = "", size: o = "3rem", className: n = "", ...i }) {
1071
- return /* @__PURE__ */ r(
1072
- mt,
1073
- {
1074
- icon: e || t,
1075
- size: o,
1076
- className: b("content-icon", n),
1077
- ...i,
1078
- color: typeof i.color > "u" ? "inherit" : i.color
1079
- }
1080
- );
1081
- }
1082
- function So({
1083
- to: t,
1084
- base: e,
1085
- children: o,
1086
- className: n,
1087
- activeClassName: i = "active",
1088
- target: a = "auto",
1089
- autoExternalMark: c = !1,
1090
- useRouterLink: s,
1091
- ...l
1092
- }) {
1093
- const { pages: d = [], locale: m = "" } = {}, u = e ? X("/", e) : e || "";
1094
- let h = a === "auto" ? "_self" : a, p = X(u, t);
1095
- const y = c ? dt(p) : !1;
1096
- if (e)
1097
- return p = X(u, m, t), /* @__PURE__ */ r(
1098
- "a",
1099
- {
1100
- className: `no-underline ${n}`,
1101
- href: lt(p),
1102
- rel: "noreferrer noopener",
1103
- target: h,
1104
- ...l,
1105
- children: o
1106
- }
1107
- );
1108
- if (dt(t))
1109
- a === "auto" && (h = "_blank"), p = t;
1110
- else {
1111
- Be(p) && (p = X(window.location.pathname, p));
1112
- const x = Ne(`${window.location.origin}${p}`), v = d.some((k) => k.pathname === x.pathname);
1113
- if (s || v)
1114
- return /* @__PURE__ */ r(
1115
- be,
1116
- {
1117
- end: !0,
1118
- to: lt(p),
1119
- className: ({ isActive: k }) => b(n, k ? i : ""),
1120
- ...l,
1121
- children: o
1122
- }
1123
- );
1124
- }
1125
- return /* @__PURE__ */ w(
1126
- "a",
1127
- {
1128
- className: `no-underline ${n}`,
1129
- href: lt(p),
1130
- rel: "noreferrer noopener",
1131
- target: h,
1132
- ...l,
1133
- children: [
1134
- o,
1135
- y && /* @__PURE__ */ r(U, { icon: "i-mdi:arrow-top-right", size: "0.9em", className: "smart-link__mark", style: { marginLeft: 5 } })
1136
- ]
1137
- }
1138
- );
1139
- }
1140
- function Y({
1141
- prepend: t,
1142
- append: e,
1143
- children: o,
1144
- className: n = "",
1145
- dark: i = !1,
1146
- border: a = !0,
1147
- ...c
1148
- }) {
1149
- let s = {};
1150
- const { pages: l = [] } = Dt(), d = l.find((h) => h.id === c.link), m = !o || ge.Children.toArray(o).every((h) => h === null);
1151
- c.link && (s = {
1152
- component: So,
1153
- to: d?.path || c.link,
1154
- useRouterLink: !0
1155
- });
1156
- const u = ae();
1157
- return /* @__PURE__ */ w(
1158
- Bo,
1159
- {
1160
- className: b("base-card card", { dark: i, "border-transparent": !a }, n),
1161
- sx: {
1162
- borderColor: u.palette.divider
1163
- },
1164
- ...s,
1165
- ...I(c, ["listType", "dark", "iconColor", "link", "hoverStyle", "imageSize"]),
1166
- children: [
1167
- t,
1168
- !m && /* @__PURE__ */ r("div", { className: "card__body", children: o }),
1169
- e
1170
- ]
1171
- }
1172
- );
1173
- }
1174
- const Bo = C(f)`
1175
- &.base-card {
1176
- text-align: left;
1177
- border-width: 1px;
1178
- border-style: solid;
1179
- border-radius: 12px;
1180
- overflow: hidden;
1181
- &,
1182
- &:hover {
1183
- text-decoration: none;
1184
- }
1185
- }
1186
- .card__body {
1187
- padding: 15px 15px;
1188
- }
1189
- `;
1190
- function K({
1191
- align: t = "left",
1192
- title: e,
1193
- titleProps: o = {},
1194
- description: n,
1195
- descriptionProps: i = {}
1196
- }) {
1197
- return /* @__PURE__ */ w(Q, { children: [
1198
- e && /* @__PURE__ */ r(
1199
- j,
1200
- {
1201
- className: b("card__title text-gray-800", "dark:text-gray-50"),
1202
- component: "h5",
1203
- variant: "h5",
1204
- gutterBottom: !0,
1205
- align: t,
1206
- ...o,
1207
- children: e
1208
- }
1209
- ),
1210
- n && /* @__PURE__ */ r(
1211
- j,
1212
- {
1213
- className: b("card__description", "text-gray-500", "dark:text-gray-400"),
1214
- component: "div",
1215
- variant: "body1",
1216
- gutterBottom: !0,
1217
- align: t,
1218
- ...i,
1219
- children: n
1220
- }
1221
- )
1222
- ] });
1223
- }
1224
- function No({
1225
- image: t,
1226
- title: e,
1227
- description: o,
1228
- imageProps: n = {},
1229
- imageMeta: i,
1230
- imageSize: a,
1231
- titleProps: c = {},
1232
- descriptionProps: s = {},
1233
- actions: l,
1234
- align: d,
1235
- ...m
1236
- }) {
1237
- const u = xt(t), h = F(L(t), 540);
1238
- return /* @__PURE__ */ w(
1239
- Ro,
1240
- {
1241
- className: "card-article",
1242
- ...m,
1243
- prepend: /* @__PURE__ */ r("div", { className: "card__image__wrap", children: u && t ? /* @__PURE__ */ r(
1244
- f,
1245
- {
1246
- sx: {
1247
- position: "absolute",
1248
- left: 0,
1249
- top: 0,
1250
- right: 0,
1251
- bottom: 0,
1252
- display: "flex",
1253
- alignItems: "center",
1254
- justifyContent: "center"
1255
- },
1256
- children: /* @__PURE__ */ r(U, { icon: t, color: "primary.main" })
1257
- }
1258
- ) : h && /* @__PURE__ */ r(
1259
- "img",
1260
- {
1261
- className: "card__image",
1262
- src: h,
1263
- ...n,
1264
- alt: n.alt || i?.filename || "card-image",
1265
- width: i?.naturalWidth,
1266
- height: i?.naturalHeight,
1267
- style: { width: "100%", height: "100%", objectFit: a || "cover", objectPosition: "center" },
1268
- loading: "lazy"
1269
- }
1270
- ) }),
1271
- children: [
1272
- e || o ? /* @__PURE__ */ r(
1273
- K,
1274
- {
1275
- align: d,
1276
- title: e,
1277
- titleProps: c,
1278
- description: o,
1279
- descriptionProps: s
1280
- }
1281
- ) : null,
1282
- l?.length ? /* @__PURE__ */ r(O, { align: d, actions: l, className: "mt-4" }) : null
1283
- ]
1284
- }
1285
- );
1286
- }
1287
- const Ro = C(Y)`
1288
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1289
- &:hover {
1290
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1291
- }` : ""}
1292
-
1293
- .card__title {
1294
- color: ${({ theme: t }) => t.palette.text.primary};
1295
- a {
1296
- color: ${({ theme: t }) => t.palette.primary.main};
1297
- }
1298
- }
1299
- .card__description {
1300
- color: ${({ theme: t }) => t.palette.text.primary};
1301
- a {
1302
- color: ${({ theme: t }) => t.palette.primary.main};
1303
- }
1304
- }
1305
-
1306
- .card__image__wrap {
1307
- padding-top: 61.8%;
1308
- width: 100%;
1309
- position: relative;
1310
- }
1311
- .card__image {
1312
- position: absolute;
1313
- top: 0;
1314
- left: 0;
1315
- bottom: 0;
1316
- right: 0;
1317
- width: 100%;
1318
- height: 100%;
1319
- object-position: top center;
1320
- }
1321
- `, Ct = "section";
1322
- function St({
1323
- title: t,
1324
- image: e,
1325
- imageMeta: o,
1326
- description: n,
1327
- actions: i,
1328
- align: a,
1329
- listType: c = "",
1330
- className: s = "",
1331
- ...l
1332
- }) {
1333
- return /* @__PURE__ */ w(Mo, { className: b("card", `list-type-${c}`, s), align: a, ...l, children: [
1334
- e && /* @__PURE__ */ r(
1335
- U,
1336
- {
1337
- icon: e,
1338
- color: "primary.main",
1339
- size: c === "icon-title" ? "1.2rem" : "3rem",
1340
- imageMeta: o
1341
- }
1342
- ),
1343
- t || n ? /* @__PURE__ */ r(K, { align: a, title: t, description: n }) : null,
1344
- i?.length ? /* @__PURE__ */ r(O, { align: a, actions: i, className: "mt-4" }) : null
1345
- ] });
1346
- }
1347
- const Mo = C(Y)`
1348
- padding: 5vw 4vw;
1349
- box-sizing: border-box;
1350
- /* min-height: 320px; */
1351
- color: inherit !important;
1352
- border-radius: 0.5rem;
1353
- /* ${({ dark: t, theme: e }) => `background-color:${t ? e.palette.grey[900] : e.palette.common.white};`} */
1354
- @media (max-width: ${({ theme: t }) => t.breakpoints.values[Ct]}px) {
1355
- padding: 1.5rem 2rem;
1356
- }
1357
- @media (max-width: ${({ theme: t }) => t.breakpoints.values.sm}px) {
1358
- height: auto;
1359
- min-height: unset;
1360
- }
1361
-
1362
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1363
- &:hover {
1364
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1365
- }` : ""}
1366
-
1367
- .card__title {
1368
- font-weight: 700;
1369
- margin-top: 24px;
1370
- margin-bottom: 12px;
1371
- color: ${({ theme: t }) => t.palette.text.primary};
1372
- a {
1373
- color: ${({ theme: t }) => t.palette.primary.main};
1374
- }
1375
- }
1376
- .card__description {
1377
- color: ${({ theme: t }) => t.palette.text.primary};
1378
- a {
1379
- color: ${({ theme: t }) => t.palette.primary.main};
1380
- }
1381
- }
1382
- .card__body {
1383
- color: ${({ theme: t }) => t.palette.text.primary};
1384
- padding: 0;
1385
- ${({ align: t }) => `text-align:${t || "left"};`}
1386
- }
1387
-
1388
- &.list-type-icon-title {
1389
- padding: 1.2rem;
1390
- .title-line {
1391
- display: flex;
1392
- }
1393
- .card__title {
1394
- margin: 0;
1395
- font-size: 1em;
1396
- }
1397
- .css-icon {
1398
- margin-right: 0.5rem;
1399
- }
1400
- }
1401
-
1402
- @media (min-width: ${({ theme: t }) => t.breakpoints.values[Ct]}px) {
1403
- padding: 2rem 2rem;
1404
- text-align: left;
1405
- box-sizing: border-box;
1406
- }
1407
- `;
1408
- function Io({
1409
- image: t,
1410
- title: e,
1411
- description: o,
1412
- imageProps: n = {},
1413
- imageMeta: i,
1414
- imageSize: a,
1415
- titleProps: c = {},
1416
- descriptionProps: s = {},
1417
- actions: l,
1418
- align: d,
1419
- ...m
1420
- }) {
1421
- const u = xt(t), h = F(L(t), 540);
1422
- return /* @__PURE__ */ w(
1423
- Lo,
1424
- {
1425
- className: "card-article",
1426
- ...m,
1427
- prepend: /* @__PURE__ */ r("div", { className: "card__image__wrap", children: u && t ? /* @__PURE__ */ r(
1428
- f,
1429
- {
1430
- sx: {
1431
- position: "absolute",
1432
- left: 0,
1433
- top: 0,
1434
- right: 0,
1435
- bottom: 0,
1436
- display: "flex",
1437
- alignItems: "center",
1438
- justifyContent: "center"
1439
- },
1440
- children: /* @__PURE__ */ r(U, { icon: t, color: "primary.main" })
1441
- }
1442
- ) : h && /* @__PURE__ */ r(
1443
- f,
1444
- {
1445
- component: "img",
1446
- className: "card__image",
1447
- src: h,
1448
- ...n,
1449
- alt: n.alt || i?.filename || "card-image",
1450
- style: { width: "100%", height: "100%", objectFit: a || "contain", objectPosition: "center" },
1451
- loading: "lazy",
1452
- sx: [
1453
- {
1454
- width: i?.naturalWidth,
1455
- height: i?.naturalHeight
1456
- },
1457
- ...Array.isArray(n.sx) ? n.sx : [n.sx]
1458
- ]
1459
- }
1460
- ) }),
1461
- children: [
1462
- e || o ? /* @__PURE__ */ r(
1463
- K,
1464
- {
1465
- align: d,
1466
- title: e,
1467
- titleProps: c,
1468
- description: o,
1469
- descriptionProps: s
1470
- }
1471
- ) : null,
1472
- l?.length ? /* @__PURE__ */ r(O, { align: d, actions: l, className: "mt-4" }) : null
1473
- ]
1474
- }
1475
- );
1476
- }
1477
- const Lo = C(Y)`
1478
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1479
- &:hover {
1480
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1481
- }` : ""}
1482
-
1483
- border-radius: 0 !important;
1484
-
1485
- .card__body {
1486
- ${({ align: t }) => `text-align:${t || "left"};`}
1487
- }
1488
-
1489
- .card__image__wrap {
1490
- width: 100%;
1491
- height: 100%;
1492
- position: relative;
1493
- display: flex;
1494
- justify-content: center;
1495
- align-items: center;
1496
- }
1497
-
1498
- .card__image {
1499
- max-height: 60px;
1500
- }
1501
- `, Bt = "section";
1502
- function Eo({
1503
- title: t,
1504
- image: e,
1505
- imageMeta: o,
1506
- iconSize: n = 100,
1507
- description: i,
1508
- actions: a,
1509
- align: c,
1510
- className: s = "",
1511
- ...l
1512
- }) {
1513
- return /* @__PURE__ */ r(Ao, { className: b("card", s), ...l, children: /* @__PURE__ */ w(f, { className: "flex items-center", children: [
1514
- e && /* @__PURE__ */ r(U, { icon: e, color: "primary.main", size: n, imageMeta: o }),
1515
- /* @__PURE__ */ w(f, { className: "flex-1 ml-4", children: [
1516
- /* @__PURE__ */ r(K, { align: c, title: t, description: i }),
1517
- /* @__PURE__ */ r(O, { align: c, actions: a, className: "mt-4" })
1518
- ] })
1519
- ] }) });
1520
- }
1521
- const Ao = C(Y)`
1522
- padding: 5vw 4vw;
1523
- text-align: left;
1524
- box-sizing: border-box;
1525
- /* min-height: 320px; */
1526
- color: inherit !important;
1527
- border-radius: 0.5rem;
1528
- /* ${({ dark: t, theme: e }) => `background-color:${t ? e.palette.grey[900] : e.palette.common.white};`} */
1529
- @media (max-width: ${({ theme: t }) => t.breakpoints.values[Bt]}px) {
1530
- padding: 1.5rem 2rem;
1531
- }
1532
- @media (max-width: ${({ theme: t }) => t.breakpoints.values.sm}px) {
1533
- height: auto;
1534
- min-height: unset;
1535
- }
1536
-
1537
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1538
- &:hover {
1539
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1540
- }` : ""}
1541
-
1542
- .card__title {
1543
- font-weight: 700;
1544
- margin-bottom: 12px;
1545
- color: ${({ theme: t }) => t.palette.text.primary};
1546
- a {
1547
- color: ${({ theme: t }) => t.palette.primary.main};
1548
- }
1549
- }
1550
- .card__description {
1551
- color: ${({ theme: t }) => t.palette.text.primary};
1552
- a {
1553
- color: ${({ theme: t }) => t.palette.primary.main};
1554
- }
1555
- }
1556
- .card__body {
1557
- padding: 0;
1558
- }
1559
-
1560
- &.list-type-icon-title {
1561
- padding: 1.2rem;
1562
- .title-line {
1563
- display: flex;
1564
- }
1565
- .card__title {
1566
- margin: 0;
1567
- font-size: 1em;
1568
- }
1569
- .css-icon {
1570
- margin-right: 0.5rem;
1571
- }
1572
- }
1573
-
1574
- @media (min-width: ${({ theme: t }) => t.breakpoints.values[Bt]}px) {
1575
- padding: 2rem 2rem;
1576
- text-align: left;
1577
- box-sizing: border-box;
1578
- }
1579
- `;
1580
- function Po({
1581
- title: t,
1582
- titleProps: e = {},
1583
- description: o,
1584
- descriptionProps: n = {},
1585
- image: i,
1586
- imageMeta: a,
1587
- className: c = "",
1588
- align: s,
1589
- hoverStyle: l,
1590
- ...d
1591
- }) {
1592
- return /* @__PURE__ */ w(Wo, { className: b("card-simple", c, `hover-style__${l}`), align: s, ...d, children: [
1593
- i && /* @__PURE__ */ r(U, { icon: i, color: "primary.main", imageMeta: a }),
1594
- t || o ? /* @__PURE__ */ r(
1595
- K,
1596
- {
1597
- align: s,
1598
- title: t,
1599
- titleProps: e,
1600
- description: o,
1601
- descriptionProps: n
1602
- }
1603
- ) : null
1604
- ] });
1605
- }
1606
- const Wo = C(Y)`
1607
- .card__title {
1608
- color: ${({ theme: t }) => t.palette.text.primary};
1609
- a {
1610
- color: ${({ theme: t }) => t.palette.primary.main};
1611
- }
1612
- }
1613
- .card__description {
1614
- color: ${({ theme: t }) => t.palette.text.primary};
1615
- a {
1616
- color: ${({ theme: t }) => t.palette.primary.main};
1617
- }
1618
- }
1619
-
1620
- &.hover-style__default {
1621
- &.card-simple {
1622
- &:hover {
1623
- border-top-right-radius: 36px;
1624
- }
1625
- }
1626
- .card__body {
1627
- &:hover {
1628
- &::before {
1629
- width: 42px;
1630
- height: 42px;
1631
- transform: translate(50%, -50%) rotate(45deg);
1632
- }
1633
- &::after {
1634
- transform: none;
1635
- }
1636
- }
1637
- }
1638
- }
1639
-
1640
- &.card-simple {
1641
- border-radius: 8px;
1642
- border-top-right-radius: 26px;
1643
-
1644
- .card__body {
1645
- ${({ align: t }) => `text-align:${t || "left"};`}
1646
- }
1647
-
1648
- ${(t) => t.link ? `
1649
- cursor: pointer;
1650
- ` : ""}
1651
- /* cursor: pointer; */
1652
- /* &:hover {
1653
- border-top-right-radius: 36px;
1654
- } */
1655
- transition: all 180ms ease 0s;
1656
- overflow: visible;
1657
- .card__title {
1658
- margin: 12px 0;
1659
- }
1660
- .card__body {
1661
- position: relative;
1662
- padding: 20px 16px 18px;
1663
- overflow: hidden;
1664
- transition: all 180ms ease 0s;
1665
- /* &:hover {
1666
- &::before {
1667
- width: 42px;
1668
- height: 42px;
1669
- transform: translate(50%, -50%) rotate(45deg);
1670
- }
1671
- &::after {
1672
- transform: none;
1673
- }
1674
- } */
1675
- &::before,
1676
- &::after {
1677
- content: ${({ border: t }) => t ? '""' : ""};
1678
- transition: inherit;
1679
- position: absolute;
1680
- top: 0px;
1681
- right: 0px;
1682
- }
1683
- &::before {
1684
- z-index: 3;
1685
- background: #fff;
1686
- width: 30px;
1687
- height: 30px;
1688
- transform: translate(50%, -50%) rotate(45deg);
1689
- box-shadow: 0 1px 0 0 #e9eaec;
1690
- }
1691
- &::after {
1692
- z-index: 2;
1693
- width: 28px;
1694
- height: 28px;
1695
- border-bottom-left-radius: 6px;
1696
- background: #fcfcfd;
1697
- box-shadow: -1px 1px 0 0 #e9eaec;
1698
- transform: translate(8px, -8px);
1699
- }
1700
- }
1701
- }
1702
- `;
1703
- function jo({ type: t = "default", ...e }) {
1704
- const n = {
1705
- article: No,
1706
- simple: Po,
1707
- news: Eo,
1708
- default: St,
1709
- wall: Io
1710
- }[t] || St;
1711
- return /* @__PURE__ */ r(n, { ...t === "news" ? e : I(e, "iconSize") });
1712
- }
1713
- function zo({
1714
- list: t = [],
1715
- align: e = "top",
1716
- cards: o,
1717
- listBorder: n = !0,
1718
- listType: i = "",
1719
- col: a = 3,
1720
- gap: c,
1721
- iconColor: s,
1722
- className: l = "",
1723
- type: d = "default",
1724
- dark: m = !1,
1725
- textAlign: u = "left",
1726
- hoverStyle: h,
1727
- ...p
1728
- }) {
1729
- return /* @__PURE__ */ r(
1730
- Jt,
1731
- {
1732
- type: d,
1733
- className: b("card-list py-1", l, "items-stretch"),
1734
- col: a,
1735
- gap: c,
1736
- align: e,
1737
- ...p,
1738
- children: o || t.map((y) => /* @__PURE__ */ r(
1739
- jo,
1740
- {
1741
- borderColor: n,
1742
- iconColor: s,
1743
- type: d,
1744
- listType: i,
1745
- dark: m,
1746
- ...y,
1747
- align: u,
1748
- style: c === 0 && t.length > 1 ? {
1749
- borderRadius: 0,
1750
- marginRight: "-1px",
1751
- marginBottom: "-1px"
1752
- } : {}
1753
- },
1754
- y.id
1755
- ))
1756
- }
1757
- );
1758
- }
1759
- const Fo = [
1760
- "align",
1761
- "cards",
1762
- "list",
1763
- "listBorder",
1764
- "listType",
1765
- "col",
1766
- "gap",
1767
- "iconColor",
1768
- "type",
1769
- "textAlign"
1770
- ];
1771
- function E(t, e) {
1772
- const o = pt(t, e), n = I(t, e);
1773
- return [o, n];
1774
- }
1775
- const To = C(rt)`
1776
- a .card {
1777
- color: #404040;
1778
- cursor: pointer;
1779
- }
1780
- a:not(.MuiButton-root) {
1781
- color: ${({ theme: t }) => t.palette.primary.main};
1782
- &:hover,
1783
- &:active {
1784
- color: ${({ theme: t }) => t.palette.primary.main};
1785
- }
1786
- }
1787
- a:hover .card {
1788
- color: #404040;
1789
- }
1790
- `;
1791
- function Oo({ className: t, ...e }) {
1792
- const [o, n] = E(e, nt), [i, a] = E(n, Fo);
1793
- return /* @__PURE__ */ w(To, { className: b("section--card-list", t), type: e.type, ...a, children: [
1794
- Object.keys(o).length > 0 && /* @__PURE__ */ r(ot, { center: !0, ...o, className: "mb-[2.5vw]" }),
1795
- /* @__PURE__ */ r(zo, { ...i, dark: !!e.dark })
1796
- ] });
1797
- }
1798
- const Uo = C(Oo)`
1799
- .card__description {
1800
- white-space: pre-wrap;
1801
- }
1802
- .section__description {
1803
- }
1804
- .card {
1805
- /* background: inherit !important; */
1806
- }
1807
- &.dark .card-simple .card__body::before {
1808
- background: #212121 !important;
1809
- }
1810
- .card-simple .card__body::after {
1811
- background: inherit !important;
1812
- }
1813
- `;
1814
- function Do({ section: t, ...e }) {
1815
- const [{ editing: o }, n] = E(e, et), i = S(() => ({
1816
- ...I(n, ["listBorder", "list", "iconSize", "imageSize"]),
1817
- list: n.list?.map((a) => ({
1818
- ...I(a, "icon", "iconColor"),
1819
- image: ["news", "simple", "default"].includes(n.type) && a.icon ? a.icon : a.image,
1820
- actions: a.actions?.map?.((c) => /* @__PURE__ */ r(Gt, { ...c, editing: o }, c.id)),
1821
- border: n.listBorder,
1822
- iconSize: n.iconSize,
1823
- imageSize: n.imageSize,
1824
- hoverStyle: n.hoverStyle
1825
- }))
1826
- }), [n]);
1827
- return /* @__PURE__ */ r(Uo, { style: o ? { pointerEvents: "none" } : {}, ...i });
1828
- }
1829
- function Go({
1830
- properties: t,
1831
- section: e,
1832
- locale: o,
1833
- dev: n
1834
- }) {
1835
- return e?.config?.componentId ? /* @__PURE__ */ r(
1836
- $e,
1837
- {
1838
- instanceId: e.id,
1839
- componentId: e.config.componentId,
1840
- blockletId: e.config.blockletId,
1841
- blockletTitle: e.config.blockletTitle,
1842
- componentName: e.config.componentName,
1843
- locale: o,
1844
- properties: t,
1845
- dev: n
1846
- }
1847
- ) : /* @__PURE__ */ r(
1848
- f,
1849
- {
1850
- sx: {
1851
- textAlign: "center",
1852
- py: 2
1853
- },
1854
- children: /* @__PURE__ */ r(
1855
- j,
1856
- {
1857
- variant: "caption",
1858
- sx: {
1859
- color: "text.secondary"
1860
- },
1861
- children: "Please select component to render"
1862
- }
1863
- )
1864
- }
1865
- );
1866
- }
1867
- function Ho({
1868
- src: t,
1869
- dataId: e,
1870
- isEdit: o = !1,
1871
- height: n = "100%",
1872
- onLoad: i = () => {
1873
- }
1874
- }) {
1875
- return /* @__PURE__ */ r(
1876
- Le,
1877
- {
1878
- isEdit: o,
1879
- embedId: e,
1880
- src: t,
1881
- height: n,
1882
- onLoad: () => {
1883
- i();
1884
- }
1885
- }
1886
- );
1887
- }
1888
- function Vo({ dataId: t, src: e, actions: o, center: n, onLoad: i, ...a }) {
1889
- const [c, s] = E(a, nt);
1890
- return /* @__PURE__ */ w(rt, { ...s, children: [
1891
- Object.keys(c).length > 0 && /* @__PURE__ */ r(ot, { center: n, ...c }),
1892
- /* @__PURE__ */ r(
1893
- Ho,
1894
- {
1895
- dataId: t,
1896
- src: e,
1897
- onLoad: i,
1898
- height: a.iframeHeight ? `${a.iframeHeight}px` : "100%"
1899
- }
1900
- ),
1901
- /* @__PURE__ */ r(O, { actions: o, center: n })
1902
- ] });
1903
- }
1904
- const mr = {
1905
- src: "",
1906
- embedUrl: "",
1907
- title: "",
1908
- description: "",
1909
- dark: !1,
1910
- background: "",
1911
- center: !0,
1912
- config: {},
1913
- id: ""
1914
- };
1915
- function Jo({ section: t, id: e, src: o, ...n }) {
1916
- const i = `${e}-${n.locale}`, [{ editing: a }, c] = E(n, et), s = ht({}), l = JSON.parse(JSON.stringify(c)), { message: d } = Re(i, "server"), m = Me(JSON.parse(JSON.stringify(c.config) || "{}"));
1917
- return J(() => {
1918
- d && d.onInit(() => m.current);
1919
- }, [d]), J(() => {
1920
- const u = JSON.parse(JSON.stringify(c.config) || "{}");
1921
- Ie(s.current, u) || (s.current = u, d?.send("config-set", u));
1922
- }, [d, c.config]), o ? /* @__PURE__ */ r(Vo, { ...l, dataId: i, src: o, style: a ? { pointerEvents: "none" } : {} }) : /* @__PURE__ */ r(Yo, { children: 'Please set the "src" attribute for this block' });
1923
- }
1924
- const Yo = C("div")`
1925
- user-select: none;
1926
- color: #999;
1927
- padding: 8px;
1928
- height: 200px;
1929
- `, Nt = {
1930
- width: "1px",
1931
- style: "solid",
1932
- color: "divider"
1933
- };
1934
- function Yt(t) {
1935
- return typeof t == "string" && t.startsWith("custom:");
1936
- }
1937
- function Ko(t) {
1938
- if (!Yt(t)) return Nt;
1939
- try {
1940
- const e = t?.substring(7) || "", [o = "1px", n = "solid", ...i] = e.split(" ");
1941
- return {
1942
- width: o,
1943
- style: n,
1944
- color: i.join(" ") || "divider"
1945
- };
1946
- } catch {
1947
- return Nt;
1948
- }
1949
- }
1950
- function Xo(t) {
1951
- if (!t || t === "none")
1952
- return { border: "none" };
1953
- if (Yt(t)) {
1954
- const { width: e, style: o, color: n } = Ko(t);
1955
- return {
1956
- border: "none",
1957
- // 避免和下面的详细属性冲突
1958
- borderWidth: e,
1959
- borderStyle: o,
1960
- borderColor: n
1961
- };
1962
- }
1963
- return {};
1964
- }
1965
- function Kt(t) {
1966
- return typeof t == "string" && t.startsWith("custom:");
1967
- }
1968
- function qo(t) {
1969
- if (!Kt(t)) return "0";
1970
- try {
1971
- return t?.substring(7) || "0";
1972
- } catch {
1973
- return "0";
1974
- }
1975
- }
1976
- function Qo(t) {
1977
- return !t || t === "none" ? { borderRadius: 0 } : Kt(t) ? { borderRadius: qo(t) } : {};
1978
- }
1979
- function Zo({ ref: t = void 0, type: e, sx: o, children: n, ...i }) {
1980
- const a = [{}, ...Array.isArray(o) ? o : [o]];
1981
- return z(() => {
1982
- const s = Tt(e);
1983
- return s ? (a.push({
1984
- img: {
1985
- objectFit: "contain !important",
1986
- bgcolor: (l) => l.palette.background.default,
1987
- borderRadius: "0 !important",
1988
- position: "relative"
1989
- }
1990
- }), /* @__PURE__ */ r(ut, { type: e, children: n })) : /* @__PURE__ */ r(
1991
- f,
1992
- {
1993
- component: s ? ut : "div",
1994
- ref: t,
1995
- sx: a,
1996
- ...i,
1997
- ...s ? { type: e } : {},
1998
- children: n
1999
- }
2000
- );
2001
- }, [e, n, a])();
2002
- }
2003
- const tn = "none", en = "none", on = "transparent", nn = "center", rn = "start", an = "none", sn = "none", ln = 12, cn = ({
2004
- gridSettings: t,
2005
- section: e,
2006
- index: o,
2007
- columns: n,
2008
- simulateMode: i = "desktop",
2009
- isBackground: a
2010
- }) => {
2011
- const c = t?.[i] ?? {}, s = c[e.id], l = dn(c);
2012
- return {
2013
- i: e.id,
2014
- static: e?.locked || a,
2015
- ...a ? {
2016
- x: 0,
2017
- y: 0,
2018
- w: n,
2019
- h: 1,
2020
- isResizable: !1
2021
- } : {
2022
- x: s?.x ?? 0,
2023
- y: s?.y ?? o,
2024
- w: s?.w ?? n,
2025
- h: s?.h ?? 1,
2026
- isResizable: !0
2027
- },
2028
- minH: 1,
2029
- maxH: 1,
2030
- maxY: l
2031
- };
2032
- }, dn = (t) => Object.values(t).reduce((e, o) => Math.max(e, o.y || 0), 0) || 0, un = (t) => {
2033
- const { dev: e, id: o, section: n, onBlockRender: i } = t, a = e?.mode, c = se((g) => g.breakpoints.down("sm")), { t: s } = Ee(), { sections: l, sectionIds: d, config: m } = n, {
2034
- columns: u = ln,
2035
- gridSettings: h,
2036
- gap: p,
2037
- padding: y,
2038
- background: x,
2039
- alignContent: v,
2040
- justifyContent: k,
2041
- border: _,
2042
- borderRadius: M,
2043
- ignoreMaxWidth: B
2044
- } = m || {}, it = S(() => {
2045
- const $ = W({
2046
- type: "layoutBlockGap",
2047
- value: p ?? tn,
2048
- format: "sx"
2049
- }), T = {
2050
- ...$,
2051
- gap: Object.keys($.gap).reduce((N, A) => (N[A] = -$.gap[A], N), {})
2052
- };
2053
- return {
2054
- item: $,
2055
- container: T
2056
- };
2057
- }, [p]), Xt = S(() => W({
2058
- type: "layoutBlockPadding",
2059
- value: y ?? en,
2060
- format: "sx"
2061
- }), [y]), at = S(() => W({
2062
- type: "layoutBlockAlignContent",
2063
- value: v ?? nn,
2064
- format: "sx"
2065
- }), [v]), st = S(() => W({
2066
- type: "layoutBlockJustifyContent",
2067
- value: k ?? rn,
2068
- format: "sx"
2069
- }), [k]), qt = S(() => {
2070
- const g = _ ?? an, $ = Xo(g);
2071
- return Object.keys($).length > 0 ? $ : W({
2072
- type: "layoutBlockBorder",
2073
- value: g,
2074
- format: "sx"
2075
- });
2076
- }, [_]), Qt = z(
2077
- (g) => Tt(_) ? /* @__PURE__ */ r(Zo, { type: _, ...g }) : /* @__PURE__ */ r(f, { ...g }),
2078
- [_]
2079
- ), Zt = S(() => {
2080
- const g = M ?? sn, $ = Qo(g);
2081
- return Object.keys($).length > 0 ? $ : W({
2082
- type: "layoutBlockBorderRadius",
2083
- value: g,
2084
- format: "sx"
2085
- });
2086
- }, [M]), bt = z(
2087
- (g, $ = !1, T = 0) => {
2088
- if (!i || !g || !g.component || g.visibility === "hidden")
2089
- return null;
2090
- const N = cn({
2091
- gridSettings: h,
2092
- section: g,
2093
- index: T,
2094
- columns: u,
2095
- simulateMode: c ? "mobile" : "desktop",
2096
- isBackground: $
2097
- }), A = N?.x ?? 0, D = N?.y ?? 0, G = N?.w ?? u, te = N?.h ?? 1, ee = N?.maxY ?? 0, oe = !!n?.config?.backgroundSectionId;
2098
- return /* @__PURE__ */ r(
2099
- f,
2100
- {
2101
- className: $ ? "layout-block-background" : "layout-block-component",
2102
- sx: {
2103
- // 背景元素和普通元素都使用 grid 布局
2104
- ...$ ? {
2105
- // 背景元素覆盖整个网格区域
2106
- gridColumn: "1 / -1",
2107
- gridRow: `1 / ${ee + 1}`,
2108
- zIndex: 0,
2109
- width: "100%",
2110
- height: "100%",
2111
- "& .BlockBase-root": {
2112
- width: "100%",
2113
- height: "100%"
2114
- }
2115
- } : {
2116
- position: "relative",
2117
- // 使用 grid 定位普通元素
2118
- gridColumn: `${A + 1} / span ${G}`,
2119
- // hasBackground 的话,不再 + 1,因为 background 会占用第一行
2120
- gridRow: `${D + (oe ? 0 : 1)} / span ${te}`,
2121
- zIndex: 1,
2122
- // Ensure content is above background
2123
- minWidth: 0,
2124
- // 防止内容撑开网格项
2125
- minHeight: 0,
2126
- // 防止内容撑开网格项
2127
- // overflow: 'hidden', // 防止子内容溢出网格项
2128
- // 只给非第一行添加上边距
2129
- ...D > 0 ? { mt: it?.item?.gap } : {},
2130
- // 只给非第一列添加左边距
2131
- ...A > 0 ? { ml: it?.item?.gap } : {},
2132
- "& > .BlockBase-root": {
2133
- height: "100%",
2134
- width: "100%",
2135
- boxSizing: "border-box",
2136
- position: "relative",
2137
- ...at,
2138
- ...st
2139
- }
2140
- }
2141
- },
2142
- children: i({
2143
- id: g.id,
2144
- type: g.component,
2145
- config: {},
2146
- section: {
2147
- ...g
2148
- },
2149
- mode: a
2150
- })
2151
- },
2152
- g.id
2153
- );
2154
- },
2155
- [
2156
- o,
2157
- a,
2158
- i,
2159
- h,
2160
- u,
2161
- c,
2162
- it,
2163
- at,
2164
- st,
2165
- B
2166
- ]
2167
- ), { backgroundElements: yt, contentElements: vt } = S(() => {
2168
- if (!d || !d.length || !l || !Object.keys(l).length)
2169
- return { backgroundElements: [], contentElements: [] };
2170
- const g = [], $ = [];
2171
- return d?.forEach((T, N) => {
2172
- const A = l[T];
2173
- if (!A) return;
2174
- const D = n?.config?.backgroundSectionId === T, G = bt(A, D, N);
2175
- G && (D ? g.push(G) : $.push(G));
2176
- }), { backgroundElements: g, contentElements: $ };
2177
- }, [bt, l, d]);
2178
- return a === "draft" && !yt?.length && !vt?.length ? /* @__PURE__ */ w(
2179
- f,
2180
- {
2181
- sx: {
2182
- gridColumn: "1 / -1",
2183
- gridRow: "1",
2184
- display: "flex",
2185
- flexDirection: "column",
2186
- alignItems: "center",
2187
- justifyContent: "center",
2188
- gap: 2,
2189
- border: (g) => `2px dashed ${g.palette.divider}`,
2190
- borderRadius: 2,
2191
- padding: 4,
2192
- color: "text.secondary",
2193
- textAlign: "center",
2194
- minHeight: "160px",
2195
- position: "relative"
2196
- },
2197
- children: [
2198
- /* @__PURE__ */ r(
2199
- f,
2200
- {
2201
- sx: {
2202
- fontSize: "48px",
2203
- opacity: 0.5
2204
- },
2205
- children: "📐"
2206
- }
2207
- ),
2208
- /* @__PURE__ */ r(
2209
- f,
2210
- {
2211
- sx: {
2212
- fontSize: "16px",
2213
- fontWeight: 500,
2214
- marginBottom: 1
2215
- },
2216
- children: "Section Layout"
2217
- }
2218
- ),
2219
- /* @__PURE__ */ r(
2220
- f,
2221
- {
2222
- sx: {
2223
- opacity: 0.7,
2224
- whiteSpace: "pre-line"
2225
- },
2226
- children: s("maker.layoutBlock.draftPlaceholder")
2227
- }
2228
- ),
2229
- /* @__PURE__ */ r(
2230
- f,
2231
- {
2232
- sx: {
2233
- position: "absolute",
2234
- top: 0,
2235
- left: 0,
2236
- right: 0,
2237
- bottom: 0,
2238
- pointerEvents: "none",
2239
- opacity: 0.1,
2240
- background: (g) => `
2241
- repeating-linear-gradient(
2242
- 90deg,
2243
- transparent,
2244
- transparent calc(100% / ${u} - 1px),
2245
- ${g.palette.grey[400]} calc(100% / ${u} - 1px),
2246
- ${g.palette.grey[400]} calc(100% / ${u})
2247
- )
2248
- `
2249
- }
2250
- }
2251
- )
2252
- ]
2253
- }
2254
- ) : /* @__PURE__ */ w(
2255
- Qt,
2256
- {
2257
- sx: {
2258
- position: "relative",
2259
- display: "grid",
2260
- gridTemplateColumns: `repeat(${u}, minmax(0, 1fr))`,
2261
- alignItems: "stretch",
2262
- width: "100%",
2263
- height: "100%",
2264
- minWidth: 0,
2265
- bgcolor: x ?? on,
2266
- boxSizing: "border-box",
2267
- // overflow: 'hidden', // Prevent content overflow
2268
- ...Xt,
2269
- ...at,
2270
- ...st
2271
- },
2272
- children: [
2273
- n?.id && /* @__PURE__ */ r(
2274
- le,
2275
- {
2276
- styles: (g) => g.unstable_sx({
2277
- [`#BlockBase-${n.id}`]: {
2278
- ...B && {
2279
- maxWidth: "unset !important",
2280
- px: 0
2281
- },
2282
- ...qt,
2283
- ...Zt,
2284
- overflow: "hidden"
2285
- }
2286
- })
2287
- }
2288
- ),
2289
- yt,
2290
- vt
2291
- ]
2292
- }
2293
- );
2294
- }, mn = ["title", "description", "actions", "badge", "tag", "prepend", "append", "logo"];
2295
- function pn({
2296
- image: t,
2297
- imageBorder: e,
2298
- imageShadow: o,
2299
- className: n,
2300
- reverse: i = !1,
2301
- fullSizeImage: a,
2302
- ...c
2303
- }) {
2304
- const [s, l] = E(c, nt), d = Object.keys(s).length > 0 && Object.values(pt(s, mn)).filter(Boolean).length > 0 && /* @__PURE__ */ r(ot, { ...s }), m = Et(t) ? t : /* @__PURE__ */ r(f, { component: "img", src: t, alt: "", className: "block" }), u = ["phone", "macbook"].includes(e), h = t && /* @__PURE__ */ r(
2305
- f,
2306
- {
2307
- className: b(
2308
- "section__image",
2309
- "m-auto, leading-[1] text-center",
2310
- o && "shadow-xl",
2311
- s?.center ? "flex justify-center items-center" : ""
2312
- ),
2313
- sx: {
2314
- border: e === !0 ? "1px solid #c0c0c0" : void 0,
2315
- borderRadius: 2,
2316
- overflow: "hidden",
2317
- // FIXME: Screenshot 组件无法设置最外层 div 的样式,只能通过父元素设置
2318
- "> div": u ? { width: "100%", video: { borderRadius: "0 !important" } } : void 0
2319
- },
2320
- children: u ? (
2321
- // @ts-ignore
2322
- /* @__PURE__ */ r(ut, { type: e, sx: { width: "100%" }, children: m })
2323
- ) : m
2324
- }
2325
- );
2326
- return /* @__PURE__ */ r(
2327
- rt,
2328
- {
2329
- className: b(
2330
- "section--block",
2331
- n,
2332
- a && !i && ct`
2333
- .section-bg {
2334
- height: 80%;
2335
- }
2336
- `
2337
- ),
2338
- ...l,
2339
- boxProps: a ? { sx: { padding: 0, overflow: "hidden" } } : void 0,
2340
- children: /* @__PURE__ */ r(
2341
- Jt,
2342
- {
2343
- col: t ? 2 : 1,
2344
- className: a ? ct`
2345
- display: flex;
2346
- flex-direction: column;
2347
-
2348
- > .base-info,
2349
- > .section__image {
2350
- width: 100%;
2351
-
2352
- > img,
2353
- > video {
2354
- width: 100%;
2355
- }
2356
- }
2357
- ` : void 0,
2358
- children: i ? /* @__PURE__ */ w(Q, { children: [
2359
- h,
2360
- d
2361
- ] }) : /* @__PURE__ */ w(Q, { children: [
2362
- d,
2363
- h
2364
- ] })
2365
- }
2366
- )
2367
- }
2368
- );
2369
- }
2370
- const hn = [
2371
- /youtu\.be\/([^#&?]{11})/,
2372
- // youtu.be/<id>
2373
- /\?v=([^#&?]{11})/,
2374
- // ?v=<id>
2375
- /&v=([^#&?]{11})/,
2376
- // &v=<id>
2377
- /embed\/([^#&?]{11})/,
2378
- // embed/<id>
2379
- /\/v\/([^#&?]{11})/
2380
- // /v/<id>
2381
- ];
2382
- function gn(t) {
2383
- if (/youtu\.?be/.test(t))
2384
- for (const e of hn) {
2385
- const o = e.exec(t)?.[1];
2386
- if (o)
2387
- return o;
2388
- }
2389
- }
2390
- function fn(t) {
2391
- const e = gn(t);
2392
- if (e)
2393
- return `https://youtube.com/embed/${e}`;
2394
- }
2395
- function xn({ src: t }) {
2396
- return J(() => {
2397
- import("@lottiefiles/lottie-player");
2398
- }, []), /* @__PURE__ */ r("lottie-player", { autoplay: !0, loop: !0, mode: "normal", src: t });
2399
- }
2400
- function bn(t) {
2401
- return /* @__PURE__ */ r(
2402
- f,
2403
- {
2404
- sx: {
2405
- maxHeight: 400,
2406
- overflow: "hidden auto"
2407
- },
2408
- children: /* @__PURE__ */ r(Ae, { ...t })
2409
- }
2410
- );
2411
- }
2412
- function yn({ url: t }) {
2413
- const e = ht(null), o = 495, [n, i] = Z(
2414
- e.current ? e.current.offsetWidth * 0.5625 : o
2415
- ), a = z(() => {
2416
- const c = window.innerWidth > 990 ? 1 : window.innerWidth > 522 ? 1.2 : window.innerWidth > 400 ? 1.45 : 1.85, s = e.current ? e.current.offsetWidth * 0.5625 : o;
2417
- return i(Math.floor(s * c));
2418
- }, []);
2419
- return J(() => {
2420
- window.addEventListener("resize", a);
2421
- const c = window.innerWidth > 990 ? 1 : window.innerWidth > 522 ? 1.2 : window.innerWidth > 400 ? 1.45 : 1.85, s = e.current ? e.current.offsetWidth * 0.5625 : o;
2422
- return i(Math.floor(s * c)), function() {
2423
- window.removeEventListener("resize", a);
2424
- };
2425
- }, [n, a]), /* @__PURE__ */ r(
2426
- f,
2427
- {
2428
- component: "iframe",
2429
- ref: e,
2430
- title: "youtube",
2431
- src: t,
2432
- frameBorder: "0",
2433
- allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
2434
- allowFullScreen: !0,
2435
- sx: {
2436
- width: "100%",
2437
- height: `${n}px`,
2438
- display: "block"
2439
- }
2440
- }
2441
- );
2442
- }
2443
- const pr = {
2444
- image: "https://www.arcblock.io/static/ead0cabde7f2b7ff34db8f3e8ceca271/afc4b/builder.png",
2445
- badge: "Develop · Deploy · Run",
2446
- title: "The Future is Here: Blockchain and Decentralized Application Development",
2447
- description: "ArcBlock, your exclusive new decentralized development platform, makes developing decentralized applications, blockchain, and distributed ledger technology straightforward.",
2448
- reverse: !1,
2449
- dark: !1,
2450
- background: "",
2451
- actions: void 0,
2452
- hasImage: !0,
2453
- center: !1
2454
- }, vn = C(pn)`
2455
- .section__description {
2456
- }
2457
- `;
2458
- function wn({
2459
- hasImage: t,
2460
- fullSizeImage: e,
2461
- boxed: o,
2462
- videoPoster: n,
2463
- imageMeta: i,
2464
- imageOptimization: a,
2465
- imageSize: c,
2466
- section: s,
2467
- ...l
2468
- }) {
2469
- const [{ editing: d }, m] = E({ ...l, boxed: e ? void 0 : o }, et);
2470
- let u = kn(m.image, n, e, i, a, c);
2471
- t || (u = null);
2472
- let h = null;
2473
- return m.actions && (h = m.actions?.map?.((p, y) => /* @__PURE__ */ r(Gt, { ...p, editing: d }, y))), /* @__PURE__ */ r(
2474
- vn,
2475
- {
2476
- ...m,
2477
- style: d ? { pointerEvents: "none" } : {},
2478
- image: u,
2479
- fullSizeImage: t && e,
2480
- actions: h
2481
- }
2482
- );
2483
- }
2484
- function kn(t, e, o, n, i, a) {
2485
- if (t) {
2486
- if (t.endsWith(".json"))
2487
- return /* @__PURE__ */ r(xn, { src: t });
2488
- if (t.indexOf("twitter.com") !== -1)
2489
- return /* @__PURE__ */ r(bn, { sourceType: "url", url: t });
2490
- const c = fn(t);
2491
- if (c)
2492
- return /* @__PURE__ */ r(yn, { url: c });
2493
- const { naturalWidth: s, naturalHeight: l, filename: d } = n || {};
2494
- if (H(t))
2495
- return /* @__PURE__ */ r(
2496
- "video",
2497
- {
2498
- width: s && `${s}px`,
2499
- height: l && `${l}px`,
2500
- controls: !0,
2501
- autoPlay: !0,
2502
- muted: !0,
2503
- style: {
2504
- display: "block",
2505
- objectFit: a || "contain",
2506
- borderRadius: "8px",
2507
- width: "100%",
2508
- height: "100%"
2509
- },
2510
- poster: F(L(e), o ? 1200 : 540, i),
2511
- children: /* @__PURE__ */ r("source", { src: L(t), type: wo(t) })
2512
- },
2513
- t
2514
- );
2515
- const m = i === "quality" ? 1 : 0.6;
2516
- return /* @__PURE__ */ r(
2517
- jt,
2518
- {
2519
- src: L(t),
2520
- sizesAttr: {
2521
- sm: 600 * m,
2522
- md: 450 * m,
2523
- lg: 540 * m,
2524
- ...o && {
2525
- md: 900 * m,
2526
- lg: 1200 * m
2527
- }
2528
- },
2529
- width: s && `${s}px`,
2530
- height: l && `${l}px`,
2531
- alt: d ?? t,
2532
- style: { objectFit: a || "contain", display: "block", width: "100%", height: "100%" },
2533
- loading: "lazy"
2534
- }
2535
- );
2536
- }
2537
- return null;
2538
- }
2539
- const hr = ["production", "draft"];
2540
- function gr({ mode: t, version: e } = {}) {
2541
- const o = e && typeof e == "number" ? { mode: t, version: e } : { mode: t };
2542
- return gt.get(`/api/${ft()}/pages`, { params: o }).then((n) => n.data);
2543
- }
2544
- function fr({ mode: t, routes: e }) {
2545
- return gt.post(`/api/${ft()}/pages/publish`, { mode: t, routes: e }).then((o) => o.data);
2546
- }
2547
- function _n({
2548
- locale: t,
2549
- sort: e,
2550
- page: o,
2551
- limit: n,
2552
- mode: i
2553
- } = {}) {
2554
- return gt.get(`/api/${ft()}/pages/toc`, { params: { locale: t, sort: e, page: o, limit: n, mode: i } }).then((a) => a.data);
2555
- }
2556
- const xr = {
2557
- style: "list",
2558
- sort: "-updatedAt"
2559
- }, Rt = 20;
2560
- function $n({ style: t, sort: e, section: o, ...n }) {
2561
- const [{ editing: i, locale: a }, c] = E(n, et), [s, l] = E(c, nt), [d, m] = Z(), u = ht(!1), h = Pe(), p = ye(), y = z(async () => {
2562
- if (!u.current) {
2563
- u.current = !0, h();
2564
- try {
2565
- const x = d ? Math.floor(d.list.length / Rt) + 1 : 1, { list: v, total: k } = await _n({ locale: a, sort: e, page: x, limit: Rt });
2566
- m((_) => ({
2567
- list: (_?.list ?? []).concat(v),
2568
- total: k
2569
- }));
2570
- } finally {
2571
- u.current = !1, h();
2572
- }
2573
- }
2574
- }, [d, a, e, h]);
2575
- return We(() => {
2576
- y();
2577
- }), /* @__PURE__ */ w(rt, { ...l, sx: i ? { pointerEvents: "none" } : {}, children: [
2578
- Object.keys(s).length > 0 && /* @__PURE__ */ r(ot, { ...s }),
2579
- d ? /* @__PURE__ */ w(Q, { children: [
2580
- /* @__PURE__ */ r(
2581
- wt,
2582
- {
2583
- container: !0,
2584
- spacing: 2,
2585
- sx: {
2586
- justifyContent: "center"
2587
- },
2588
- children: d?.list.map((x) => /* @__PURE__ */ r(
2589
- wt,
2590
- {
2591
- size: {
2592
- xs: 12,
2593
- sm: t === "card" ? 6 : 12,
2594
- md: t === "card" ? 3 : 12
2595
- },
2596
- children: /* @__PURE__ */ w(
2597
- Cn,
2598
- {
2599
- elevation: 0,
2600
- className: b(t === "card" && "style-card"),
2601
- onClick: i ? void 0 : () => p(x.slug),
2602
- children: [
2603
- !!x.image && /* @__PURE__ */ r(
2604
- ue,
2605
- {
2606
- component: "img",
2607
- alt: "",
2608
- image: F(L(x.image), 540),
2609
- loading: "lazy"
2610
- }
2611
- ),
2612
- /* @__PURE__ */ w(me, { children: [
2613
- /* @__PURE__ */ r(j, { variant: "h6", component: "div", className: Mt, children: x.title || x.id }),
2614
- /* @__PURE__ */ r(j, { variant: "body2", className: Mt, children: x.description })
2615
- ] })
2616
- ]
2617
- }
2618
- )
2619
- },
2620
- x.id
2621
- ))
2622
- }
2623
- ),
2624
- /* @__PURE__ */ r(
2625
- f,
2626
- {
2627
- sx: {
2628
- textAlign: "center",
2629
- mt: 2
2630
- },
2631
- children: d.total > d.list.length ? /* @__PURE__ */ r(V, { variant: "outlined", color: "secondary", onClick: y, loading: u.current, children: "More" }) : /* @__PURE__ */ r(V, { variant: "outlined", color: "secondary", disabled: !0, children: "No More" })
2632
- }
2633
- )
2634
- ] }) : /* @__PURE__ */ r(
2635
- f,
2636
- {
2637
- sx: {
2638
- p: 2,
2639
- textAlign: "center"
2640
- },
2641
- children: /* @__PURE__ */ r(de, { size: 24 })
2642
- }
2643
- )
2644
- ] });
2645
- }
2646
- const Mt = ct`
2647
- display: -webkit-box;
2648
- -webkit-box-orient: vertical;
2649
- -webkit-line-clamp: 2;
2650
- overflow: hidden;
2651
- text-overflow: ellipsis;
2652
- `, Cn = C(ce)`
2653
- border: 1px solid #e0e0e0;
2654
- background-color: transparent;
2655
- cursor: pointer;
2656
- display: flex;
2657
- color: inherit;
2658
-
2659
- > .MuiCardMedia-root {
2660
- width: 30vw;
2661
- max-height: 50vw;
2662
- }
2663
-
2664
- &.style-card {
2665
- display: block;
2666
-
2667
- > .MuiCardMedia-root {
2668
- width: 100%;
2669
- max-height: 50vw;
2670
- }
2671
- }
2672
- `, Sn = {
2673
- iframe: Jo,
2674
- section: wn,
2675
- "section-card-list": Do,
2676
- toc: $n,
2677
- "custom-component": Go,
2678
- "layout-block": un
2679
- };
2680
- function Bn({
2681
- id: t,
2682
- type: e,
2683
- mode: o,
2684
- config: n,
2685
- section: i,
2686
- ignorePageMetaStyle: a,
2687
- page: c,
2688
- ...s
2689
- }) {
2690
- const l = Sn[e], { getPageMetaStyle: d } = so(), m = S(() => {
2691
- const { height: p, ...y } = n;
2692
- return e === "layout-block" && (y.onBlockRender = (x) => {
2693
- const v = {
2694
- ...n?.dev,
2695
- ...x?.config?.dev
2696
- }, { defaultLocale: k } = v, _ = {
2697
- ...pt(n, ["locale", "editing"]),
2698
- ...x?.config,
2699
- dev: v
2700
- }, { locale: M } = _;
2701
- let B = c?.dataSource?.[x?.id]?.[M];
2702
- return he(B) && (B = c?.dataSource?.[x?.id]?.[k ?? "en"]), /* @__PURE__ */ r(
2703
- Bn,
2704
- {
2705
- ...x,
2706
- config: {
2707
- ...x?.section?.properties,
2708
- ...B,
2709
- ..._
2710
- },
2711
- page: c,
2712
- ignorePageMetaStyle: !0
2713
- }
2714
- );
2715
- }), y;
2716
- }, [n, e]), u = S(() => {
2717
- const p = {};
2718
- return e !== "custom-component" && (p.height = n.height), p.sx = a ? void 0 : d("sx"), p.id = `BlockBase-${t}`, p;
2719
- }, [n.height, a, e, d]), h = l && /* @__PURE__ */ r(l, { mode: o, ...m, id: t, section: i });
2720
- return h ? /* @__PURE__ */ r(lo, { ...s, ...u, children: h }) : /* @__PURE__ */ r(Nn, { type: e });
2721
- }
2722
- function Nn({ type: t }) {
2723
- return /* @__PURE__ */ r(
2724
- f,
2725
- {
2726
- sx: {
2727
- p: 2
2728
- },
2729
- children: /* @__PURE__ */ w(pe, { icon: /* @__PURE__ */ r(ne, {}), color: "error", children: [
2730
- "Unsupported Block `",
2731
- t,
2732
- "`"
2733
- ] })
2734
- }
2735
- );
2736
- }
2737
- export {
2738
- Bn as B,
2739
- mr as I,
2740
- dr as P,
2741
- hr as S,
2742
- xr as T,
2743
- cr as a,
2744
- pr as b,
2745
- gr as g,
2746
- fr as p
2747
- };