@blocklet/pages-kit-inner-components 0.5.55 → 0.6.0

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 (45) hide show
  1. package/lib/cjs/add-component.js +21 -23
  2. package/lib/cjs/chunks/{draft-data-CuZfaQ4s.js → draft-data-D44_IEV2.js} +1 -1
  3. package/lib/cjs/chunks/home-BYk01EUy.js +39 -0
  4. package/lib/cjs/chunks/index-BRgYwvuv.js +475 -0
  5. package/lib/cjs/chunks/publish-button-C8XPA4g_.js +1 -0
  6. package/lib/cjs/chunks/session-BRtsDvA-.js +1 -0
  7. package/lib/cjs/chunks/site-state-gSkcvhcV.js +57 -0
  8. package/lib/cjs/chunks/state-B6BF5wJ-.js +1 -0
  9. package/lib/cjs/components.js +1 -1
  10. package/lib/cjs/home.js +1 -1
  11. package/lib/cjs/project-html.js +7 -7
  12. package/lib/cjs/resources.js +1 -1
  13. package/lib/cjs/setting.js +3 -3
  14. package/lib/cjs/site-state.js +1 -1
  15. package/lib/cjs/theme.js +1 -1
  16. package/lib/es/add-component.js +385 -2356
  17. package/lib/es/chunks/{draft-data-CWM--ooz.js → draft-data-CafrGKeh.js} +1 -1
  18. package/lib/es/chunks/home-DW8SdyfO.js +594 -0
  19. package/lib/es/chunks/index-D5gXPe_7.js +2326 -0
  20. package/lib/es/chunks/publish-button-XSZrDaTQ.js +498 -0
  21. package/lib/es/chunks/session-C72Dq8zg.js +19 -0
  22. package/lib/es/chunks/site-state-W2H7XCSQ.js +2077 -0
  23. package/lib/es/chunks/state-0gvZF3k2.js +573 -0
  24. package/lib/es/components.js +1 -1
  25. package/lib/es/home.js +5 -5
  26. package/lib/es/project-html.js +131 -141
  27. package/lib/es/resources.js +106 -107
  28. package/lib/es/setting.js +1772 -1489
  29. package/lib/es/site-state.js +1 -1
  30. package/lib/es/theme.js +50 -51
  31. package/package.json +46 -47
  32. package/lib/cjs/chunks/array-BqHuYyfx.js +0 -475
  33. package/lib/cjs/chunks/config-string-4bVR9Vc8.js +0 -1
  34. package/lib/cjs/chunks/home-BMjMYgq3.js +0 -38
  35. package/lib/cjs/chunks/publish-button-CGfGqrov.js +0 -1
  36. package/lib/cjs/chunks/session-BA7Qrcia.js +0 -1
  37. package/lib/cjs/chunks/site-state-BtZ8o3J2.js +0 -57
  38. package/lib/cjs/chunks/state-BVdbNJCA.js +0 -1
  39. package/lib/es/chunks/array-c6HYTLze.js +0 -2224
  40. package/lib/es/chunks/config-string-WMpFf-7V.js +0 -88
  41. package/lib/es/chunks/home-PDsc59QG.js +0 -566
  42. package/lib/es/chunks/publish-button-Ds7OBvxV.js +0 -462
  43. package/lib/es/chunks/session-CVblGhSp.js +0 -21
  44. package/lib/es/chunks/site-state-D-moj9fA.js +0 -2125
  45. package/lib/es/chunks/state-l--dTdHq.js +0 -603
@@ -1,2224 +0,0 @@
1
- import { jsx as n, jsxs as _, Fragment as Z } from "react/jsx-runtime";
2
- import { ErrorOutline as Ht } from "@mui/icons-material";
3
- import { Box as y, styled as Mt, Typography as R, Container as Vt, Stack as Yt, useTheme as _t, createTheme as Dt, ThemeProvider as Jt, useMediaQuery as Gt, Card as Kt, CircularProgress as Xt, Grid as pt, CardMedia as qt, CardContent as Qt, Alert as Zt } from "@mui/material";
4
- import te from "lodash/isEmpty";
5
- import tt from "lodash/pick";
6
- import ee, { createContext as $t, useMemo as L, useCallback as F, useContext as Ct, Fragment as oe, isValidElement as Nt, useState as et, useEffect as H, useRef as lt } from "react";
7
- import ot from "lodash/keyBy";
8
- import { f as T, g as I, E as re, i as st, m as ct } from "./state-l--dTdHq.js";
9
- import { AIForm as ht, AIFormResult as ft } from "@blocklet/ai-runtime/components";
10
- import { deepmerge as ne } from "@mui/utils";
11
- import { ErrorBoundary as ie } from "react-error-boundary";
12
- import ae from "@blocklet/pages-kit/builtin/markdown/markdown-renderer";
13
- import { useColorConvert as St } from "@blocklet/pages-kit/contexts/color";
14
- import { cx as k, css as nt } from "@emotion/css";
15
- import { materialDark as le } from "react-syntax-highlighter/dist/esm/styles/prism";
16
- import { useTheme as Bt, styled as $ } from "@arcblock/ux/lib/Theme";
17
- import se from "@arcblock/react-hooks/lib/useBrowser";
18
- import gt from "@arcblock/ux/lib/Colors";
19
- import { ResponsiveImage as It, CustomComponentRenderer as ce } from "@blocklet/pages-kit/components";
20
- import { isGradient as de, isColorString as me } from "@blocklet/pages-kit/utils/style";
21
- import Wt from "@mui/material/useMediaQuery";
22
- import W from "lodash/omit";
23
- import { Icon as Rt } from "@iconify-icon/react";
24
- import ue from "@arcblock/ux/lib/Screenshot";
25
- import { Link as pe, NavLink as he, useNavigate as fe } from "react-router-dom";
26
- import ge from "@arcblock/ux/lib/Button";
27
- import it from "is-uri";
28
- import { join as q } from "pathe";
29
- import { withoutTrailingSlash as rt, isRelative as xe, parseURL as ye } from "ufo";
30
- import { useMessage as be } from "@blocklet/embed/message";
31
- import { useLatest as we } from "ahooks";
32
- import ve from "lodash/isEqual";
33
- import { EmbedIframe as ke } from "@blocklet/embed/react";
34
- import { useLocaleContext as _e } from "@arcblock/ux/lib/Locale/context";
35
- import { TwitterTimelineEmbed as $e } from "react-twitter-embed";
36
- import { useUpdate as Ce, useMount as Ne } from "react-use";
37
- const jt = "{{CUSTOM_VALUE}}", Se = [
38
- {
39
- title: "None",
40
- value: "none",
41
- sx: { py: 0 }
42
- },
43
- {
44
- title: "Small",
45
- value: "small",
46
- sx: { py: { xs: 2.5, md: 4, lg: 4, xl: 6 } }
47
- },
48
- {
49
- title: "Normal",
50
- value: "normal",
51
- sx: { py: { xs: 5, md: 7.5, lg: 10, xl: 12.5 } }
52
- },
53
- {
54
- title: "Large",
55
- value: "large",
56
- sx: { py: { xs: 7.5, md: 10, lg: 12.5, xl: 15 } }
57
- }
58
- ], Be = [
59
- {
60
- title: "None",
61
- value: "none",
62
- sx: { py: 0 }
63
- },
64
- {
65
- title: "Small",
66
- value: "small",
67
- sx: { py: { xs: 2.5, md: 4, lg: 4, xl: 6 } }
68
- },
69
- {
70
- title: "Normal",
71
- value: "normal",
72
- sx: { py: { xs: 5, md: 7, lg: 7, xl: 9 } }
73
- },
74
- {
75
- title: "Large",
76
- value: "large",
77
- sx: { py: { xs: 6, md: 9, lg: 9, xl: 11 } }
78
- }
79
- ], Ie = [
80
- {
81
- title: "None",
82
- value: "none",
83
- sx: { px: 0 }
84
- },
85
- {
86
- title: "Small",
87
- value: "small",
88
- sx: { px: { xs: 2, md: 4, lg: 4, xl: 6 } }
89
- },
90
- {
91
- title: "Normal",
92
- value: "normal",
93
- sx: { px: { xs: 2.5, md: 7.5, lg: 10, xl: 12.5 } }
94
- },
95
- {
96
- title: "Large",
97
- value: "large",
98
- sx: { px: { xs: 2.5, md: 10, lg: 12.5, xl: 15 } }
99
- }
100
- ], Q = (t, e, i) => {
101
- const o = t.breakpoints.values[i];
102
- return `${e}${o ? ` (${o}px)` : ""}`;
103
- }, We = [
104
- {
105
- title: "100%",
106
- value: "full",
107
- sx: { maxWidth: "100%" }
108
- },
109
- {
110
- title: (t) => Q(t, "Small", "sm"),
111
- value: "sm",
112
- sx: {
113
- maxWidth: (t) => t.breakpoints.values.sm,
114
- width: "100%",
115
- mx: "auto"
116
- }
117
- },
118
- {
119
- title: (t) => Q(t, "Normal", "md"),
120
- value: "md",
121
- sx: { maxWidth: (t) => t.breakpoints.values.md, width: "100%", mx: "auto" }
122
- },
123
- {
124
- title: (t) => Q(t, "Large", "lg"),
125
- value: "lg",
126
- sx: { maxWidth: (t) => t.breakpoints.values.lg, width: "100%", mx: "auto" }
127
- },
128
- {
129
- title: (t) => Q(t, "Extra Large", "xl"),
130
- value: "xl",
131
- sx: { maxWidth: (t) => t.breakpoints.values.xl, width: "100%", mx: "auto" }
132
- },
133
- {
134
- title: "Custom",
135
- value: "custom",
136
- sx: {
137
- maxWidth: jt,
138
- width: "100%",
139
- mx: "auto"
140
- }
141
- }
142
- ], Re = ot(Se, "value"), je = ot(Be, "value"), ze = ot(Ie, "value"), Le = ot(We, "value"), Ee = /* @__PURE__ */ new Map([
143
- ["baseSectionPaddingY", Re],
144
- ["maxWidth", Le],
145
- ["paddingY", je],
146
- ["paddingX", ze]
147
- ]);
148
- function zt(t) {
149
- var s;
150
- const { type: e, value: i, format: o = "sx", defaultValue: r = null } = t, l = Ee.get(e);
151
- if (!l)
152
- return r;
153
- const d = i.startsWith("custom:"), a = d ? "custom" : i;
154
- if (l != null && l[a] && ((s = l == null ? void 0 : l[a]) != null && s[o])) {
155
- const c = l[a][o];
156
- if (d) {
157
- const u = i.replace("custom:", "");
158
- try {
159
- return JSON.parse(JSON.stringify(c || {}).replaceAll(jt, u));
160
- } catch {
161
- }
162
- }
163
- return c;
164
- }
165
- return r;
166
- }
167
- const Lt = $t({
168
- page: null,
169
- getPageMeta: () => ({}),
170
- getPageMetaStyle: () => ({})
171
- });
172
- function Pe() {
173
- return Ct(Lt);
174
- }
175
- function Nr({
176
- page: t,
177
- children: e,
178
- defaultLocale: i = "en",
179
- currentLocale: o
180
- }) {
181
- const r = L(() => t ? JSON.parse(JSON.stringify(t)) : null, [JSON.stringify(t)]), l = F(() => {
182
- var c;
183
- if (!r) return {};
184
- const s = o || i;
185
- return ((c = r.locales) == null ? void 0 : c[s]) ?? {};
186
- }, [r, i, o]), d = F(
187
- (s = "sx") => {
188
- const c = l();
189
- return !c || !c.style ? {} : Object.entries(c.style || {}).reduce((m, [h, p]) => {
190
- if (!p) return m;
191
- const x = `${h}Custom`;
192
- c.style[x];
193
- const f = zt({
194
- type: h,
195
- value: p,
196
- format: s
197
- });
198
- return f ? { ...m, ...f } : m;
199
- }, {});
200
- },
201
- [l]
202
- ), a = L(
203
- () => ({
204
- page: r,
205
- getPageMeta: l,
206
- getPageMetaStyle: d
207
- }),
208
- [r, l, d]
209
- );
210
- return /* @__PURE__ */ n(Lt.Provider, { value: a, children: e });
211
- }
212
- function O({ actions: t, center: e, className: i, align: o }) {
213
- return t && (t != null && t.length) ? /* @__PURE__ */ n(
214
- y,
215
- {
216
- className: k(
217
- "flex gap-4 flex-wrap",
218
- "lg:flex-row lg:gap-8",
219
- (e || o === "center") && "justify-center",
220
- !e && o === "right" && "justify-end",
221
- !e && o === "left" && "justify-start",
222
- i
223
- ),
224
- sx: { alignItems: "center" },
225
- children: t
226
- }
227
- ) : null;
228
- }
229
- const Te = "section", Oe = Mt(y)`
230
- overflow: hidden;
231
-
232
- .section__title {
233
- margin-top: 0;
234
- font-weight: 700;
235
- }
236
- .section__title_non_big {
237
- font-size: 32px;
238
- @media (max-width: 600px) {
239
- font-size: 24px;
240
- }
241
- }
242
- &.base-info .section__tag {
243
- margin-top: 0;
244
- margin-bottom: 2vw;
245
- background-color: ${({ theme: t }) => t.palette.primary.main};
246
- white-space: nowrap;
247
- max-width: 100%;
248
- display: inline-block;
249
- padding: 0 10px;
250
- justify-content: flex-start;
251
- overflow: hidden;
252
- text-overflow: ellipsis;
253
- font-size: 12px;
254
- color: #fff;
255
- border-radius: 4px;
256
- line-height: 20px;
257
- }
258
- .section__title {
259
- color: ${({ theme: t }) => t.palette.text.primary};
260
- a {
261
- color: ${({ theme: t }) => t.palette.primary.main};
262
- }
263
- p {
264
- margin-top: 0;
265
- margin-bottom: 0;
266
- }
267
- }
268
- .section__description {
269
- color: ${({ theme: t }) => t.palette.text.primary};
270
- margin-bottom: 4vw;
271
- margin-top: 0;
272
- a {
273
- color: ${({ theme: t }) => t.palette.primary.main};
274
- }
275
- p {
276
- margin-top: 0;
277
- margin-bottom: 0.5rem;
278
- }
279
- }
280
- @media (min-width: ${({ theme: t }) => t.breakpoints.values[Te]}px) {
281
- .section__tag {
282
- margin-bottom: 32px;
283
- }
284
- .section__title {
285
- margin-bottom: 32px;
286
- }
287
- .section__description {
288
- margin-bottom: 40px;
289
- }
290
- }
291
- `;
292
- function M({
293
- title: t,
294
- description: e,
295
- descriptionMarkdown: i,
296
- actions: o,
297
- className: r = "",
298
- classes: l = {},
299
- prepend: d,
300
- append: a,
301
- level: s = 2,
302
- tag: c,
303
- badge: u,
304
- center: m,
305
- logo: h,
306
- titleAppearance: p,
307
- descriptionAppearance: x,
308
- ...f
309
- }) {
310
- const b = St();
311
- if (!t && !e && !o && !u && !c && !d && !a && !h) return null;
312
- const g = Math.max(Math.min(5, s + 1), 1), w = {
313
- 1: "xl:!text-3xl lg:!text-2xl md:!text-xl",
314
- 2: "xl:!text-2xl lg:!text-xl md:!text-lg",
315
- 3: "xl:!text-2xl lg:!text-xl md:!text-lg",
316
- 4: "xl:!text-xl lg:!text-lg md:!text-md",
317
- 5: "xl:!text-lg md:!text-md sm:!text-sm",
318
- 6: "!text-sm"
319
- }, C = s === 0 ? "big" : `h${g}`, v = s === 0;
320
- return /* @__PURE__ */ _(Oe, { className: k("base-info", "lg:text-left", m && "!text-center", r), ...f, children: [
321
- d && /* @__PURE__ */ n("div", { children: d }),
322
- (c || u) && /* @__PURE__ */ n("div", { className: k("section__tag", (l == null ? void 0 : l.tag) || (l == null ? void 0 : l.badge)), children: c || u }),
323
- h && /* @__PURE__ */ n("img", { className: "w-[120px] m-auto mb-8", src: h, alt: "info", loading: "lazy" }),
324
- t && /* @__PURE__ */ n(
325
- R,
326
- {
327
- sx: {
328
- whiteSpace: "pre-wrap",
329
- mb: e ? "2vw" : 0,
330
- ...(p == null ? void 0 : p.color) && { color: `${b(p.color)} !important` }
331
- },
332
- className: k(
333
- "section__title",
334
- "text-gray-800",
335
- "dark:text-gray-50",
336
- l.title,
337
- "page-kit-section__title",
338
- v ? "" : "section__title_non_big"
339
- ),
340
- component: `h${Math.max(s, 1)}`,
341
- variant: C,
342
- children: t
343
- }
344
- ),
345
- e && (i ? /* @__PURE__ */ n(
346
- y,
347
- {
348
- sx: {
349
- ...(x == null ? void 0 : x.color) && { color: `${b(x.color)} !important` }
350
- },
351
- className: k(
352
- "section__description",
353
- "text-gray-800",
354
- "dark:text-gray-100",
355
- w[g],
356
- l.description,
357
- "page-kit-section__description"
358
- ),
359
- children: /* @__PURE__ */ n(ae, { codeOptions: { showActionButton: !1, theme: le }, children: e })
360
- }
361
- ) : /* @__PURE__ */ n(
362
- R,
363
- {
364
- sx: {
365
- whiteSpace: "pre-wrap",
366
- ...(x == null ? void 0 : x.color) && { color: `${b(x.color)} !important` }
367
- },
368
- className: k(
369
- "section__description",
370
- "text-gray-800",
371
- "dark:text-gray-100",
372
- w[g],
373
- l.description,
374
- "page-kit-section__description"
375
- ),
376
- component: "div",
377
- variant: "body1",
378
- gutterBottom: !0,
379
- children: e
380
- }
381
- )),
382
- /* @__PURE__ */ n(O, { actions: o, center: m, className: "mt-8" }),
383
- a && /* @__PURE__ */ n("div", { children: a })
384
- ] });
385
- }
386
- const V = [
387
- "actions",
388
- "append",
389
- "badge",
390
- "tag",
391
- "center",
392
- "description",
393
- "descriptionMarkdown",
394
- "level",
395
- "logo",
396
- "prepend",
397
- "title",
398
- "titleAppearance",
399
- "descriptionAppearance"
400
- ];
401
- function Et(t) {
402
- if (t.type === oe) {
403
- const i = (t.props.children || []).filter((o) => Nt(o));
404
- return i.length === 1 ? Et(i[0]) : i.length > 1;
405
- }
406
- return Array.isArray(t);
407
- }
408
- const z = "&>*";
409
- function dt({ children: t, col: e, gap: i, className: o, align: r, sx: l, type: d, ...a } = {
410
- children: null,
411
- className: "",
412
- col: 3,
413
- gap: void 0,
414
- sx: {},
415
- align: "center",
416
- type: "default"
417
- }) {
418
- const s = Bt(), c = Number(Math.floor(100 / e * 100) / 100), u = {
419
- center: "justify-center items-center",
420
- left: "justify-start items-center",
421
- right: "justify-end items-center",
422
- top: "justify-center items-start",
423
- bottom: "justify-center items-end",
424
- "top-left": "justify-start items-start",
425
- "top-right": "justify-end items-start",
426
- "bottom-left": "justify-start items-end",
427
- "bottom-right": "justify-end items-end"
428
- }, m = u[r] || u.center;
429
- let p = i ?? ({
430
- 2: 6,
431
- 3: 4,
432
- 4: 4,
433
- 5: 3,
434
- 6: 3
435
- }[e] || 0);
436
- Et(t) || (p = 0);
437
- const f = (e - 1) * p / e;
438
- let b = { ...l, gap: `${p}rem` };
439
- const g = { [z]: { width: "100%" } }, w = {}, C = {}, v = {};
440
- switch (g.gap = "1rem", w.gap = `${p / 2}rem`, e) {
441
- case 3:
442
- case 4:
443
- w[z] = {
444
- width: `calc(50% - ${p / 2}rem)`
445
- };
446
- break;
447
- case 5:
448
- case 6:
449
- g[z] = {
450
- width: `calc(50% - ${p / 2 / 2}rem)`
451
- }, w[z] = {
452
- width: `calc(50% - ${p / 2 / 2}rem)`
453
- }, C[z] = {
454
- width: `calc(33.33% - ${p * 2 / 3}rem)`
455
- };
456
- break;
457
- }
458
- return b[z] = { width: `calc(${c}% - ${f}rem)` }, b[`@media (max-width: ${s.breakpoints.values.xl}px)`] = v, b[`@media (max-width: ${s.breakpoints.values.lg}px)`] = C, b[`@media (max-width: ${s.breakpoints.values.md}px)`] = w, b[`@media (max-width: ${s.breakpoints.values.sm}px)`] = g, d === "wall" && (b = { ...l, gap: `${p}rem` }, b[z] = { width: `calc(${c}% - ${f}rem)` }, g[z] = { width: `calc(45% - ${p / 2 / 2}rem)` }, b[`@media (max-width: ${s.breakpoints.values.sm}px)`] = g), /* @__PURE__ */ n(y, { className: k("flex flex-wrap flex-row h-full", m, o), sx: b, ...a, children: t });
459
- }
460
- function Ae() {
461
- const t = navigator.userAgent.toLowerCase();
462
- return t.includes("safari") && !t.includes("chrome");
463
- }
464
- function Ue(t = "") {
465
- if (t.startsWith("data:image/svg+xml,")) return !0;
466
- const e = /^(((ht|f)tps?):\/\/)?([^!@#$%^&*?.\s-]([^!@#$%^&*?.\s]{0,63}[^!@#$%^&*?.\s])?\.)+[a-z]{2,6}\/?/, i = /^(\/|\.\/|\.\.\/)(?:[^/]+\/)*[^/]+$/;
467
- return e.test(t) || i.test(t);
468
- }
469
- function A(t) {
470
- return (t == null ? void 0 : t.endsWith(".mp4")) || (t == null ? void 0 : t.endsWith(".m4v")) || (t == null ? void 0 : t.endsWith(".webm"));
471
- }
472
- function Fe(t) {
473
- return t != null && t.endsWith(".mp4") || t != null && t.endsWith(".m4v") ? "video/mp4" : t != null && t.endsWith(".webm") ? "video/webm" : void 0;
474
- }
475
- function He(t) {
476
- let e = {};
477
- return typeof t == "string" ? de(t) ? e.image = t : (e.image = I(t), me(t) && (e.color = t, e.image = "")) : e = t, e;
478
- }
479
- function Me() {
480
- const [t, e] = et(Date.now());
481
- return H(() => {
482
- const i = () => {
483
- e(Date.now());
484
- };
485
- return document.addEventListener("visibilitychange", i), () => {
486
- document.removeEventListener("visibilitychange", i);
487
- };
488
- }, []), t;
489
- }
490
- function xt(t, e, i, o, r) {
491
- let l = null;
492
- const { color: d = "", image: a } = He(e);
493
- if (a && Ue(a)) {
494
- delete i.backgroundColor;
495
- const s = !(t.mobile.apple.device || Ae()) && A(a), c = A(a) && o ? T(I(o), 1200, "quality") : "";
496
- s ? l = /* @__PURE__ */ n(
497
- y,
498
- {
499
- component: "video",
500
- className: "section-bg",
501
- width: "100%",
502
- autoPlay: !0,
503
- loop: !0,
504
- muted: !0,
505
- controls: !1,
506
- playsInline: !0,
507
- poster: c,
508
- src: A(a) ? a : T(a, 1200, "quality"),
509
- sx: {
510
- position: "absolute",
511
- zIndex: -9999,
512
- right: 0,
513
- left: 0,
514
- top: 0,
515
- width: "100%",
516
- height: "100%",
517
- objectFit: "cover"
518
- }
519
- },
520
- a
521
- ) : l = /* @__PURE__ */ n(
522
- It,
523
- {
524
- src: A(a) && o ? c : a,
525
- sizesAttr: {
526
- sm: 600,
527
- md: 900,
528
- lg: 1200
529
- },
530
- className: "section-bg",
531
- alt: "",
532
- width: "100%",
533
- loading: "lazy",
534
- sx: {
535
- position: "absolute",
536
- zIndex: -9999,
537
- right: 0,
538
- left: 0,
539
- top: 0,
540
- width: "100%",
541
- height: "100%",
542
- objectFit: "cover"
543
- }
544
- },
545
- r || a
546
- );
547
- } else a ? i.backgroundImage = `${a} !important` : d && (i.backgroundColor = `${d} !important`);
548
- return l;
549
- }
550
- function Ve({ autoWidth: t, children: e, ...i }) {
551
- return t ? /* @__PURE__ */ n(y, { display: "flex", ...i, children: e }) : /* @__PURE__ */ n(Vt, { ...i, children: e });
552
- }
553
- function Y({
554
- dark: t = !1,
555
- children: e,
556
- className: i,
557
- sx: o = {},
558
- boxed: r = { show: !1 },
559
- padding: l = "normal",
560
- boxProps: d,
561
- type: a,
562
- ...s
563
- }) {
564
- const c = { ...o }, u = Wt((p) => p.breakpoints.down("md"));
565
- t && (c.color = gt.common.white, c.backgroundColor = `${gt.grey[900]} !important`), r.show && (c.display = "flex");
566
- const m = L(() => !Number(s.boxMaxWidth) || u ? {
567
- width: "100%"
568
- } : a === "wall" && s.boxMaxWidth ? {
569
- maxWidth: `${s.boxMaxWidth}px !important`,
570
- width: "100%"
571
- } : {
572
- width: "100%"
573
- }, [s.boxMaxWidth, u, a]), h = zt({
574
- type: "baseSectionPaddingY",
575
- value: l || "normal",
576
- // section default is normal
577
- defaultValue: ""
578
- });
579
- return /* @__PURE__ */ n(
580
- Ye,
581
- {
582
- component: "section",
583
- styles: { ...c, ...h },
584
- className: k("base-section", "px-2 md:px-5 lg:px-5 xl:px-10", i, {
585
- dark: t
586
- }),
587
- ...W(
588
- s,
589
- "hoverStyle",
590
- "boxMaxWidth",
591
- "embedUrl",
592
- "autoWidth",
593
- "paddingXY",
594
- "iframeHeight",
595
- "titleAppearance",
596
- "descriptionAppearance"
597
- ),
598
- children: /* @__PURE__ */ n(Ve, { autoWidth: s == null ? void 0 : s.autoWidth, className: k("section-content h-full"), sx: m, children: r.show ? /* @__PURE__ */ n(Pt, { ...d, boxed: r, children: e }) : e })
599
- }
600
- );
601
- }
602
- function Pt({
603
- background: t = "",
604
- backgroundVideoPoster: e,
605
- children: i,
606
- sx: o = {},
607
- boxed: r = { show: !1 },
608
- className: l = "",
609
- styles: d = {},
610
- ...a
611
- }) {
612
- const s = { ...d, ...o }, c = St();
613
- let u = null;
614
- const m = Wt((x) => x.breakpoints.up("sm")), h = se(), p = Me();
615
- return t && (u = xt(
616
- h,
617
- typeof t == "string" ? c(t) : t,
618
- s,
619
- e,
620
- p
621
- )), r.show && (s.borderRadius = "10px", s.padding === void 0 && (s.padding = m ? "50px" : "20px"), r != null && r.border && (s.border = "1px solid #c0c0c0"), r != null && r.background && (u = xt(
622
- h,
623
- typeof (r == null ? void 0 : r.background) == "string" ? c(r == null ? void 0 : r.background) : r == null ? void 0 : r.background,
624
- s,
625
- r == null ? void 0 : r.backgroundVideoPoster,
626
- p
627
- ))), /* @__PURE__ */ _(
628
- y,
629
- {
630
- ...a,
631
- sx: {
632
- ...s,
633
- ...u ? { position: "relative", overflow: "hidden", zIndex: 0 } : {}
634
- },
635
- className: k(l, (r == null ? void 0 : r.boxShadow) && "shadow-xl"),
636
- children: [
637
- u,
638
- i
639
- ]
640
- }
641
- );
642
- }
643
- const Ye = $(Pt)`
644
- &:nth-of-type(even) {
645
- background: #f8f8f8;
646
- }
647
-
648
- @media (max-width: 600px) {
649
- .section__title {
650
- font-size: 24px;
651
- }
652
-
653
- .base-info {
654
- > *:last-child {
655
- margin-bottom: 0;
656
- }
657
- }
658
- }
659
- `;
660
- function Tt({ icon: t, ...e }) {
661
- return /* @__PURE__ */ n(Rt, { icon: t, ...e, ref: null });
662
- }
663
- function N(t, e) {
664
- const i = tt(t, e), o = W(t, e);
665
- return [i, o];
666
- }
667
- const Ot = ["title", "description", "actions", "badge", "tag", "prepend", "append", "logo"];
668
- function De({
669
- image: t,
670
- imageBorder: e,
671
- imageShadow: i,
672
- className: o,
673
- reverse: r = !1,
674
- fullSizeImage: l,
675
- ...d
676
- }) {
677
- const [a, s] = N(d, V), c = Object.keys(a).length > 0 && Object.values(tt(a, Ot)).filter(Boolean).length > 0 && /* @__PURE__ */ n(M, { ...a }), u = Nt(t) ? t : /* @__PURE__ */ n(y, { component: "img", src: t, alt: "", className: "block" }), m = ["phone", "macbook"].includes(e), h = t && /* @__PURE__ */ n(
678
- y,
679
- {
680
- className: k(
681
- "section__image",
682
- "m-auto, leading-[1] text-center",
683
- i && "shadow-xl",
684
- a != null && a.center ? "flex justify-center items-center" : ""
685
- ),
686
- sx: {
687
- border: e === !0 ? "1px solid #c0c0c0" : void 0,
688
- borderRadius: 2,
689
- overflow: "hidden",
690
- // FIXME: Screenshot 组件无法设置最外层 div 的样式,只能通过父元素设置
691
- "> div": m ? { width: "100%", video: { borderRadius: "0 !important" } } : void 0
692
- },
693
- children: m ? (
694
- // @ts-ignore
695
- /* @__PURE__ */ n(ue, { type: e, sx: { width: "100%" }, children: u })
696
- ) : u
697
- }
698
- );
699
- return /* @__PURE__ */ n(
700
- Y,
701
- {
702
- className: k(
703
- "section--block",
704
- o,
705
- l && !r && nt`
706
- .section-bg {
707
- height: 80%;
708
- }
709
- `
710
- ),
711
- ...s,
712
- boxProps: l ? { sx: { padding: 0, overflow: "hidden" } } : void 0,
713
- children: /* @__PURE__ */ n(
714
- dt,
715
- {
716
- col: t ? 2 : 1,
717
- className: l ? nt`
718
- display: flex;
719
- flex-direction: column;
720
-
721
- > .base-info,
722
- > .section__image {
723
- width: 100%;
724
-
725
- > img,
726
- > video {
727
- width: 100%;
728
- }
729
- }
730
- ` : void 0,
731
- children: r ? /* @__PURE__ */ _(Z, { children: [
732
- h,
733
- c
734
- ] }) : /* @__PURE__ */ _(Z, { children: [
735
- c,
736
- h
737
- ] })
738
- }
739
- )
740
- }
741
- );
742
- }
743
- const D = ["editing", "height", "locale", "dev", "sx"];
744
- function Je(t) {
745
- const { className: e, ...i } = t;
746
- return /* @__PURE__ */ n(Ge, { ...i, className: k("BlockBase-root", e) });
747
- }
748
- const Ge = $(y)`
749
- position: relative;
750
- color: ${({ theme: t }) => t.palette.text.primary};
751
- `;
752
- function Ke({
753
- widget: t,
754
- reverse: e,
755
- projectId: i,
756
- assistantId: o,
757
- working: r,
758
- submitTitle: l,
759
- submitIcon: d,
760
- submitColor: a,
761
- placeholder: s,
762
- loadingIndicator: c,
763
- section: u,
764
- ...m
765
- }) {
766
- const [{ editing: h }, p] = N(m, D), [x, f] = N(p, V), b = i && o ? { projectId: i, gitRef: "main", assistantId: o, working: !0 } : void 0, g = {
767
- children: l,
768
- endIcon: d ? /* @__PURE__ */ n(Tt, { icon: d }) : void 0,
769
- sx: {
770
- background: a || void 0,
771
- ":hover": {
772
- background: a || void 0,
773
- opacity: 0.8
774
- }
775
- }
776
- }, w = [], C = s && /* @__PURE__ */ n(R, { variant: "caption", color: "text.disabled", children: s }), v = c && /* @__PURE__ */ n(R, { variant: "caption", color: "text.disabled", children: c });
777
- Object.keys(x).length > 0 && Object.values(tt(x, Ot)).filter(Boolean).length > 0 && w.push(/* @__PURE__ */ n(M, { ...x }, "base-info")), b && (t === "form" ? w.push(/* @__PURE__ */ n(ht, { identifier: b, SubmitProps: g }, "form")) : t === "result" ? w.push(
778
- /* @__PURE__ */ n(
779
- ft,
780
- {
781
- identifier: b,
782
- placeholder: C,
783
- loadingIndicator: v
784
- },
785
- "result"
786
- )
787
- ) : w.push(
788
- /* @__PURE__ */ _(Yt, { width: "100%", gap: 2, direction: "row", children: [
789
- /* @__PURE__ */ n(ht, { identifier: b, BoxProps: { flex: 1 }, SubmitProps: g }),
790
- /* @__PURE__ */ n(
791
- ft,
792
- {
793
- identifier: b,
794
- BoxProps: { flex: 1 },
795
- placeholder: C,
796
- loadingIndicator: v
797
- }
798
- )
799
- ] }, "form-result")
800
- )), e && w.reverse();
801
- const S = _t(), B = L(
802
- () => Dt(ne(S, { palette: { primary: a ? { main: a } : void 0 } })),
803
- [a, S]
804
- );
805
- return /* @__PURE__ */ n(ie, { fallbackRender: re, children: /* @__PURE__ */ n(Jt, { theme: B, children: /* @__PURE__ */ n(Y, { ...f, sx: h ? { pointerEvents: "none" } : {}, children: /* @__PURE__ */ n(dt, { col: w.length, children: w }) }) }) });
806
- }
807
- const At = $t({
808
- pages: [],
809
- project: void 0
810
- }), { Provider: Sr, Consumer: Br } = At;
811
- function Ut() {
812
- return Ct(At);
813
- }
814
- function Xe({ icon: t, className: e = "", size: i = "1rem", ...o }) {
815
- return /* @__PURE__ */ n(qe, { component: Tt, className: k("css-icon", e), size: i, ...o, icon: t });
816
- }
817
- const qe = $(y)`
818
- &.css-icon {
819
- display: inline-block;
820
- width: ${({ size: t }) => t};
821
- height: ${({ size: t }) => t};
822
- }
823
- `;
824
- function Qe({ icon: t, className: e = "", size: i = "1rem", imageMeta: o, ...r }) {
825
- const l = T(I(t), 540), [d, a] = et(!1), s = Bt();
826
- return d ? /* @__PURE__ */ n(Xe, { icon: "i-mdi:image", color: s.palette.grey[500], size: i, className: e, ...r }) : /* @__PURE__ */ n(Ze, { className: k("image-icon", e), size: i, ...r, children: /* @__PURE__ */ n(
827
- "img",
828
- {
829
- className: "image-icon__image",
830
- src: l,
831
- onError: () => a(!0),
832
- width: o == null ? void 0 : o.naturalWidth,
833
- height: o == null ? void 0 : o.naturalHeight,
834
- alt: (o == null ? void 0 : o.filename) || "card-icon",
835
- loading: "lazy"
836
- }
837
- ) });
838
- }
839
- const Ze = $(y)`
840
- display: inline-block;
841
- width: ${({ size: t }) => t};
842
- height: ${({ size: t }) => t};
843
- .image-icon__image {
844
- object-fit: contain;
845
- height: 100%;
846
- width: 100%;
847
- }
848
- `, mt = (t) => typeof t == "string" && /^[\w-_]+:[\w-_]+$/.test(t);
849
- function at({ icon: t, size: e = "1rem", imageMeta: i, ...o }) {
850
- const r = window.isNaN(e) ? e : `${e}px`;
851
- return mt(t) ? /* @__PURE__ */ n(Rt, { icon: t }) : /* @__PURE__ */ n(to, { component: Qe, imageMeta: i, className: "base-icon", icon: t, size: r, ...o });
852
- }
853
- const to = $(y)`
854
- flex-shrink: 0;
855
- `;
856
- function U({ text: t, children: e, icon: i = "", endIcon: o, color: r = "primary", link: l = "", href: d = "", ...a }) {
857
- const s = i ? /* @__PURE__ */ n(at, { icon: i }) : null, c = o ? /* @__PURE__ */ n(at, { icon: o }) : null, u = l || d, m = { ...a };
858
- return u && (m.href = u, it(u) && (m.target = m.target || "_blank")), /* @__PURE__ */ n(ge, { startIcon: s, endIcon: c, color: r, ...m, children: t || e });
859
- }
860
- function Ft({ editing: t, text: e, ...i }) {
861
- const { pages: o = [] } = Ut(), r = o.find((l) => l.id === (i.link || i.linkId));
862
- if (t)
863
- return /* @__PURE__ */ n(U, { ...W(i, ["link", "linkId"]), children: e });
864
- if (r) {
865
- const l = r.path || "/";
866
- return /* @__PURE__ */ n(pe, { to: l, children: /* @__PURE__ */ n(U, { ...W(i, ["link", "linkId"]), children: e }) });
867
- }
868
- return /* @__PURE__ */ n(U, { ...W(i, "linkId"), children: e });
869
- }
870
- function E({ type: t = "", icon: e = "", size: i = "3rem", className: o = "", ...r }) {
871
- return /* @__PURE__ */ n(at, { icon: e || t, size: i, className: k("content-icon", o), ...r });
872
- }
873
- E.propTypes = {};
874
- E.defaultProps = {
875
- type: "",
876
- icon: "",
877
- size: "3rem",
878
- color: "inherit",
879
- className: ""
880
- };
881
- function eo({
882
- to: t,
883
- base: e,
884
- children: i,
885
- className: o,
886
- activeClassName: r = "active",
887
- target: l = "auto",
888
- autoExternalMark: d = !1,
889
- useRouterLink: a,
890
- ...s
891
- }) {
892
- const { pages: c = [], locale: u = "" } = {}, m = e ? q("/", e) : e || "";
893
- let h = l === "auto" ? "_self" : l, p = q(m, t);
894
- const x = d ? it(p) : !1;
895
- if (e)
896
- return p = q(m, u, t), /* @__PURE__ */ n(
897
- "a",
898
- {
899
- className: `no-underline ${o}`,
900
- href: rt(p),
901
- rel: "noreferrer noopener",
902
- target: h,
903
- ...s,
904
- children: i
905
- }
906
- );
907
- if (it(t))
908
- l === "auto" && (h = "_blank"), p = t;
909
- else {
910
- xe(p) && (p = q(window.location.pathname, p));
911
- const f = ye(`${window.location.origin}${p}`), b = c.some((g) => g.pathname === f.pathname);
912
- if (a || b)
913
- return /* @__PURE__ */ n(
914
- he,
915
- {
916
- end: !0,
917
- to: rt(p),
918
- className: ({ isActive: g }) => k(o, g ? r : ""),
919
- ...s,
920
- children: i
921
- }
922
- );
923
- }
924
- return /* @__PURE__ */ _(
925
- "a",
926
- {
927
- className: `no-underline ${o}`,
928
- href: rt(p),
929
- rel: "noreferrer noopener",
930
- target: h,
931
- ...s,
932
- children: [
933
- i,
934
- x && /* @__PURE__ */ n(E, { icon: "i-mdi:arrow-top-right", size: "0.9em", className: "smart-link__mark", style: { marginLeft: 5 } })
935
- ]
936
- }
937
- );
938
- }
939
- function J({
940
- prepend: t,
941
- append: e,
942
- children: i,
943
- className: o = "",
944
- dark: r = !1,
945
- border: l = !0,
946
- ...d
947
- }) {
948
- let a = {};
949
- const { pages: s = [] } = Ut(), c = s.find((h) => h.id === d.link), u = !i || ee.Children.toArray(i).every((h) => h === null);
950
- d.link && (a = {
951
- component: eo,
952
- to: (c == null ? void 0 : c.path) || d.link,
953
- useRouterLink: !0
954
- });
955
- const m = _t();
956
- return /* @__PURE__ */ _(
957
- oo,
958
- {
959
- className: k("base-card card", { dark: r, "border-transparent": !l }, o),
960
- sx: {
961
- borderColor: m.palette.divider
962
- },
963
- ...a,
964
- ...W(d, ["listType", "dark", "iconColor", "link", "hoverStyle", "imageSize"]),
965
- children: [
966
- t,
967
- !u && /* @__PURE__ */ n("div", { className: "card__body", children: i }),
968
- e
969
- ]
970
- }
971
- );
972
- }
973
- const oo = $(y)`
974
- &.base-card {
975
- text-align: left;
976
- border-width: 1px;
977
- border-style: solid;
978
- border-radius: 12px;
979
- overflow: hidden;
980
- &,
981
- &:hover {
982
- text-decoration: none;
983
- }
984
- }
985
- .card__body {
986
- padding: 15px 15px;
987
- }
988
- `;
989
- function G({
990
- align: t = "left",
991
- title: e,
992
- titleProps: i = {},
993
- description: o,
994
- descriptionProps: r = {}
995
- }) {
996
- return /* @__PURE__ */ _(Z, { children: [
997
- e && /* @__PURE__ */ n(
998
- R,
999
- {
1000
- className: k("card__title text-gray-800", "dark:text-gray-50"),
1001
- component: "h5",
1002
- variant: "h5",
1003
- gutterBottom: !0,
1004
- align: t,
1005
- ...i,
1006
- children: e
1007
- }
1008
- ),
1009
- o && /* @__PURE__ */ n(
1010
- R,
1011
- {
1012
- className: k("card__description", "text-gray-500", "dark:text-gray-400"),
1013
- component: "div",
1014
- variant: "body1",
1015
- gutterBottom: !0,
1016
- align: t,
1017
- ...r,
1018
- children: o
1019
- }
1020
- )
1021
- ] });
1022
- }
1023
- function ro({
1024
- image: t,
1025
- title: e,
1026
- description: i,
1027
- imageProps: o = {},
1028
- imageMeta: r,
1029
- imageSize: l,
1030
- titleProps: d = {},
1031
- descriptionProps: a = {},
1032
- actions: s,
1033
- align: c,
1034
- ...u
1035
- }) {
1036
- const m = mt(t), h = T(I(t), 540);
1037
- return /* @__PURE__ */ _(
1038
- no,
1039
- {
1040
- className: "card-article",
1041
- ...u,
1042
- prepend: /* @__PURE__ */ n("div", { className: "card__image__wrap", children: m && t ? /* @__PURE__ */ n(
1043
- y,
1044
- {
1045
- sx: {
1046
- position: "absolute",
1047
- left: 0,
1048
- top: 0,
1049
- right: 0,
1050
- bottom: 0,
1051
- display: "flex",
1052
- alignItems: "center",
1053
- justifyContent: "center"
1054
- },
1055
- children: /* @__PURE__ */ n(E, { icon: t, color: "primary.main" })
1056
- }
1057
- ) : h && /* @__PURE__ */ n(
1058
- "img",
1059
- {
1060
- className: "card__image",
1061
- src: h,
1062
- ...o,
1063
- alt: o.alt || (r == null ? void 0 : r.filename) || "card-image",
1064
- width: r == null ? void 0 : r.naturalWidth,
1065
- height: r == null ? void 0 : r.naturalHeight,
1066
- style: { width: "100%", height: "100%", objectFit: l || "cover", objectPosition: "center" },
1067
- loading: "lazy"
1068
- }
1069
- ) }),
1070
- children: [
1071
- e || i ? /* @__PURE__ */ n(
1072
- G,
1073
- {
1074
- align: c,
1075
- title: e,
1076
- titleProps: d,
1077
- description: i,
1078
- descriptionProps: a
1079
- }
1080
- ) : null,
1081
- s != null && s.length ? /* @__PURE__ */ n(O, { align: c, actions: s, className: "mt-4" }) : null
1082
- ]
1083
- }
1084
- );
1085
- }
1086
- const no = $(J)`
1087
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1088
- &:hover {
1089
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1090
- }` : ""}
1091
-
1092
- .card__title {
1093
- color: ${({ theme: t }) => t.palette.text.primary};
1094
- a {
1095
- color: ${({ theme: t }) => t.palette.primary.main};
1096
- }
1097
- }
1098
- .card__description {
1099
- color: ${({ theme: t }) => t.palette.text.primary};
1100
- a {
1101
- color: ${({ theme: t }) => t.palette.primary.main};
1102
- }
1103
- }
1104
-
1105
- .card__image__wrap {
1106
- padding-top: 61.8%;
1107
- width: 100%;
1108
- position: relative;
1109
- }
1110
- .card__image {
1111
- position: absolute;
1112
- top: 0;
1113
- left: 0;
1114
- bottom: 0;
1115
- right: 0;
1116
- width: 100%;
1117
- height: 100%;
1118
- object-position: top center;
1119
- }
1120
- `, yt = "section";
1121
- function bt({
1122
- title: t,
1123
- image: e,
1124
- imageMeta: i,
1125
- description: o,
1126
- actions: r,
1127
- align: l,
1128
- listType: d = "",
1129
- className: a = "",
1130
- ...s
1131
- }) {
1132
- return /* @__PURE__ */ _(io, { className: k("card", `list-type-${d}`, a), align: l, ...s, children: [
1133
- e && /* @__PURE__ */ n(
1134
- E,
1135
- {
1136
- icon: e,
1137
- color: "primary.main",
1138
- size: d === "icon-title" ? "1.2rem" : "3rem",
1139
- imageMeta: i
1140
- }
1141
- ),
1142
- t || o ? /* @__PURE__ */ n(G, { align: l, title: t, description: o }) : null,
1143
- r != null && r.length ? /* @__PURE__ */ n(O, { align: l, actions: r, className: "mt-4" }) : null
1144
- ] });
1145
- }
1146
- const io = $(J)`
1147
- padding: 5vw 4vw;
1148
- box-sizing: border-box;
1149
- /* min-height: 320px; */
1150
- color: inherit !important;
1151
- border-radius: 0.5rem;
1152
- /* ${({ dark: t, theme: e }) => `background-color:${t ? e.palette.grey[900] : e.palette.common.white};`} */
1153
- @media (max-width: ${({ theme: t }) => t.breakpoints.values[yt]}px) {
1154
- padding: 1.5rem 2rem;
1155
- }
1156
- @media (max-width: ${({ theme: t }) => t.breakpoints.values.sm}px) {
1157
- height: auto;
1158
- min-height: unset;
1159
- }
1160
-
1161
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1162
- &:hover {
1163
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1164
- }` : ""}
1165
-
1166
- .card__title {
1167
- font-weight: 700;
1168
- margin-top: 24px;
1169
- margin-bottom: 12px;
1170
- color: ${({ theme: t }) => t.palette.text.primary};
1171
- a {
1172
- color: ${({ theme: t }) => t.palette.primary.main};
1173
- }
1174
- }
1175
- .card__description {
1176
- color: ${({ theme: t }) => t.palette.text.primary};
1177
- a {
1178
- color: ${({ theme: t }) => t.palette.primary.main};
1179
- }
1180
- }
1181
- .card__body {
1182
- color: ${({ theme: t }) => t.palette.text.primary};
1183
- padding: 0;
1184
- ${({ align: t }) => `text-align:${t || "left"};`}
1185
- }
1186
-
1187
- &.list-type-icon-title {
1188
- padding: 1.2rem;
1189
- .title-line {
1190
- display: flex;
1191
- }
1192
- .card__title {
1193
- margin: 0;
1194
- font-size: 1em;
1195
- }
1196
- .css-icon {
1197
- margin-right: 0.5rem;
1198
- }
1199
- }
1200
-
1201
- @media (min-width: ${({ theme: t }) => t.breakpoints.values[yt]}px) {
1202
- padding: 2rem 2rem;
1203
- text-align: left;
1204
- box-sizing: border-box;
1205
- }
1206
- `;
1207
- function ao({
1208
- image: t,
1209
- title: e,
1210
- description: i,
1211
- imageProps: o = {},
1212
- imageMeta: r,
1213
- imageSize: l,
1214
- titleProps: d = {},
1215
- descriptionProps: a = {},
1216
- actions: s,
1217
- align: c,
1218
- ...u
1219
- }) {
1220
- const m = mt(t), h = T(I(t), 540);
1221
- return /* @__PURE__ */ _(
1222
- lo,
1223
- {
1224
- className: "card-article",
1225
- ...u,
1226
- prepend: /* @__PURE__ */ n("div", { className: "card__image__wrap", children: m && t ? /* @__PURE__ */ n(
1227
- y,
1228
- {
1229
- sx: {
1230
- position: "absolute",
1231
- left: 0,
1232
- top: 0,
1233
- right: 0,
1234
- bottom: 0,
1235
- display: "flex",
1236
- alignItems: "center",
1237
- justifyContent: "center"
1238
- },
1239
- children: /* @__PURE__ */ n(E, { icon: t, color: "primary.main" })
1240
- }
1241
- ) : h && /* @__PURE__ */ n(
1242
- y,
1243
- {
1244
- component: "img",
1245
- className: "card__image",
1246
- src: h,
1247
- ...o,
1248
- alt: o.alt || (r == null ? void 0 : r.filename) || "card-image",
1249
- width: r == null ? void 0 : r.naturalWidth,
1250
- height: r == null ? void 0 : r.naturalHeight,
1251
- style: { width: "100%", height: "100%", objectFit: l || "contain", objectPosition: "center" },
1252
- loading: "lazy"
1253
- }
1254
- ) }),
1255
- children: [
1256
- e || i ? /* @__PURE__ */ n(
1257
- G,
1258
- {
1259
- align: c,
1260
- title: e,
1261
- titleProps: d,
1262
- description: i,
1263
- descriptionProps: a
1264
- }
1265
- ) : null,
1266
- s != null && s.length ? /* @__PURE__ */ n(O, { align: c, actions: s, className: "mt-4" }) : null
1267
- ]
1268
- }
1269
- );
1270
- }
1271
- const lo = $(J)`
1272
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1273
- &:hover {
1274
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1275
- }` : ""}
1276
-
1277
- border-radius: 0 !important;
1278
-
1279
- .card__body {
1280
- ${({ align: t }) => `text-align:${t || "left"};`}
1281
- }
1282
-
1283
- .card__image__wrap {
1284
- width: 100%;
1285
- height: 100%;
1286
- position: relative;
1287
- display: flex;
1288
- justify-content: center;
1289
- align-items: center;
1290
- }
1291
-
1292
- .card__image {
1293
- max-height: 60px;
1294
- }
1295
- `, wt = "section";
1296
- function so({
1297
- title: t,
1298
- image: e,
1299
- imageMeta: i,
1300
- iconSize: o = 100,
1301
- description: r,
1302
- actions: l,
1303
- align: d,
1304
- className: a = "",
1305
- ...s
1306
- }) {
1307
- return /* @__PURE__ */ n(co, { className: k("card", a), ...s, children: /* @__PURE__ */ _(y, { className: "flex items-center", children: [
1308
- e && /* @__PURE__ */ n(E, { icon: e, color: "primary.main", size: o, imageMeta: i }),
1309
- /* @__PURE__ */ _(y, { className: "flex-1 ml-4", children: [
1310
- /* @__PURE__ */ n(G, { align: d, title: t, description: r }),
1311
- /* @__PURE__ */ n(O, { align: d, actions: l, className: "mt-4" })
1312
- ] })
1313
- ] }) });
1314
- }
1315
- const co = $(J)`
1316
- padding: 5vw 4vw;
1317
- text-align: left;
1318
- box-sizing: border-box;
1319
- /* min-height: 320px; */
1320
- color: inherit !important;
1321
- border-radius: 0.5rem;
1322
- /* ${({ dark: t, theme: e }) => `background-color:${t ? e.palette.grey[900] : e.palette.common.white};`} */
1323
- @media (max-width: ${({ theme: t }) => t.breakpoints.values[wt]}px) {
1324
- padding: 1.5rem 2rem;
1325
- }
1326
- @media (max-width: ${({ theme: t }) => t.breakpoints.values.sm}px) {
1327
- height: auto;
1328
- min-height: unset;
1329
- }
1330
-
1331
- ${(t) => t.hoverStyle === "none" ? "" : t.link ? `transition: box-shadow ease .3s;
1332
- &:hover {
1333
- box-shadow: 0 0 10px rgba(95, 142, 244, 0.42);
1334
- }` : ""}
1335
-
1336
- .card__title {
1337
- font-weight: 700;
1338
- margin-bottom: 12px;
1339
- color: ${({ theme: t }) => t.palette.text.primary};
1340
- a {
1341
- color: ${({ theme: t }) => t.palette.primary.main};
1342
- }
1343
- }
1344
- .card__description {
1345
- color: ${({ theme: t }) => t.palette.text.primary};
1346
- a {
1347
- color: ${({ theme: t }) => t.palette.primary.main};
1348
- }
1349
- }
1350
- .card__body {
1351
- padding: 0;
1352
- }
1353
-
1354
- &.list-type-icon-title {
1355
- padding: 1.2rem;
1356
- .title-line {
1357
- display: flex;
1358
- }
1359
- .card__title {
1360
- margin: 0;
1361
- font-size: 1em;
1362
- }
1363
- .css-icon {
1364
- margin-right: 0.5rem;
1365
- }
1366
- }
1367
-
1368
- @media (min-width: ${({ theme: t }) => t.breakpoints.values[wt]}px) {
1369
- padding: 2rem 2rem;
1370
- text-align: left;
1371
- box-sizing: border-box;
1372
- }
1373
- `;
1374
- function mo({
1375
- title: t,
1376
- titleProps: e = {},
1377
- description: i,
1378
- descriptionProps: o = {},
1379
- image: r,
1380
- imageMeta: l,
1381
- className: d = "",
1382
- align: a,
1383
- hoverStyle: s,
1384
- ...c
1385
- }) {
1386
- return /* @__PURE__ */ _(uo, { className: k("card-simple", d, `hover-style__${s}`), align: a, ...c, children: [
1387
- r && /* @__PURE__ */ n(E, { icon: r, color: "primary.main", imageMeta: l }),
1388
- t || i ? /* @__PURE__ */ n(
1389
- G,
1390
- {
1391
- align: a,
1392
- title: t,
1393
- titleProps: e,
1394
- description: i,
1395
- descriptionProps: o
1396
- }
1397
- ) : null
1398
- ] });
1399
- }
1400
- const uo = $(J)`
1401
- .card__title {
1402
- color: ${({ theme: t }) => t.palette.text.primary};
1403
- a {
1404
- color: ${({ theme: t }) => t.palette.primary.main};
1405
- }
1406
- }
1407
- .card__description {
1408
- color: ${({ theme: t }) => t.palette.text.primary};
1409
- a {
1410
- color: ${({ theme: t }) => t.palette.primary.main};
1411
- }
1412
- }
1413
-
1414
- &.hover-style__default {
1415
- &.card-simple {
1416
- &:hover {
1417
- border-top-right-radius: 36px;
1418
- }
1419
- }
1420
- .card__body {
1421
- &:hover {
1422
- &::before {
1423
- width: 42px;
1424
- height: 42px;
1425
- transform: translate(50%, -50%) rotate(45deg);
1426
- }
1427
- &::after {
1428
- transform: none;
1429
- }
1430
- }
1431
- }
1432
- }
1433
-
1434
- &.card-simple {
1435
- border-radius: 8px;
1436
- border-top-right-radius: 26px;
1437
-
1438
- .card__body {
1439
- ${({ align: t }) => `text-align:${t || "left"};`}
1440
- }
1441
-
1442
- ${(t) => t.link ? `
1443
- cursor: pointer;
1444
- ` : ""}
1445
- /* cursor: pointer; */
1446
- /* &:hover {
1447
- border-top-right-radius: 36px;
1448
- } */
1449
- transition: all 180ms ease 0s;
1450
- overflow: visible;
1451
- .card__title {
1452
- margin: 12px 0;
1453
- }
1454
- .card__body {
1455
- position: relative;
1456
- padding: 20px 16px 18px;
1457
- overflow: hidden;
1458
- transition: all 180ms ease 0s;
1459
- /* &:hover {
1460
- &::before {
1461
- width: 42px;
1462
- height: 42px;
1463
- transform: translate(50%, -50%) rotate(45deg);
1464
- }
1465
- &::after {
1466
- transform: none;
1467
- }
1468
- } */
1469
- &::before,
1470
- &::after {
1471
- content: ${({ border: t }) => t ? '""' : ""};
1472
- transition: inherit;
1473
- position: absolute;
1474
- top: 0px;
1475
- right: 0px;
1476
- }
1477
- &::before {
1478
- z-index: 3;
1479
- background: #fff;
1480
- width: 30px;
1481
- height: 30px;
1482
- transform: translate(50%, -50%) rotate(45deg);
1483
- box-shadow: 0 1px 0 0 #e9eaec;
1484
- }
1485
- &::after {
1486
- z-index: 2;
1487
- width: 28px;
1488
- height: 28px;
1489
- border-bottom-left-radius: 6px;
1490
- background: #fcfcfd;
1491
- box-shadow: -1px 1px 0 0 #e9eaec;
1492
- transform: translate(8px, -8px);
1493
- }
1494
- }
1495
- }
1496
- `;
1497
- function po({ type: t = "default", ...e }) {
1498
- const o = {
1499
- article: ro,
1500
- simple: mo,
1501
- news: so,
1502
- default: bt,
1503
- wall: ao
1504
- }[t] || bt;
1505
- return /* @__PURE__ */ n(o, { ...t === "news" ? e : W(e, "iconSize") });
1506
- }
1507
- function ho({
1508
- list: t = [],
1509
- align: e = "top",
1510
- cards: i,
1511
- listBorder: o = !0,
1512
- listType: r = "",
1513
- col: l = 3,
1514
- gap: d,
1515
- iconColor: a,
1516
- className: s = "",
1517
- type: c = "default",
1518
- dark: u = !1,
1519
- textAlign: m = "left",
1520
- hoverStyle: h,
1521
- ...p
1522
- }) {
1523
- return /* @__PURE__ */ n(
1524
- dt,
1525
- {
1526
- type: c,
1527
- className: k("card-list py-1", s, "items-stretch"),
1528
- col: l,
1529
- gap: d,
1530
- align: e,
1531
- ...p,
1532
- children: i || t.map((x) => /* @__PURE__ */ n(
1533
- po,
1534
- {
1535
- borderColor: o,
1536
- iconColor: a,
1537
- type: c,
1538
- listType: r,
1539
- dark: u,
1540
- ...x,
1541
- align: m,
1542
- style: d === 0 && t.length > 1 ? {
1543
- borderRadius: 0,
1544
- marginRight: "-1px",
1545
- marginBottom: "-1px"
1546
- } : {}
1547
- },
1548
- x.id
1549
- ))
1550
- }
1551
- );
1552
- }
1553
- const fo = [
1554
- "align",
1555
- "cards",
1556
- "list",
1557
- "listBorder",
1558
- "listType",
1559
- "col",
1560
- "gap",
1561
- "iconColor",
1562
- "type",
1563
- "textAlign"
1564
- ], go = $(Y)`
1565
- a .card {
1566
- color: #404040;
1567
- cursor: pointer;
1568
- }
1569
- a:not(.MuiButton-root) {
1570
- color: ${({ theme: t }) => t.palette.primary.main};
1571
- &:hover,
1572
- &:active {
1573
- color: ${({ theme: t }) => t.palette.primary.main};
1574
- }
1575
- }
1576
- a:hover .card {
1577
- color: #404040;
1578
- }
1579
- `;
1580
- function xo({ className: t, ...e }) {
1581
- const [i, o] = N(e, V), [r, l] = N(o, fo);
1582
- return /* @__PURE__ */ _(go, { className: k("section--card-list", t), type: e.type, ...l, children: [
1583
- Object.keys(i).length > 0 && /* @__PURE__ */ n(M, { center: !0, ...i, className: "mb-[2.5vw]" }),
1584
- /* @__PURE__ */ n(ho, { ...r, dark: !!e.dark })
1585
- ] });
1586
- }
1587
- const yo = $(xo)`
1588
- .card__description {
1589
- white-space: pre-wrap;
1590
- }
1591
- .section__description {
1592
- }
1593
- .card {
1594
- /* background: inherit !important; */
1595
- }
1596
- &.dark .card-simple .card__body::before {
1597
- background: #212121 !important;
1598
- }
1599
- .card-simple .card__body::after {
1600
- background: inherit !important;
1601
- }
1602
- `;
1603
- function bo({ section: t, ...e }) {
1604
- const [{ editing: i }, o] = N(e, D), r = L(() => {
1605
- var l;
1606
- return {
1607
- ...W(o, ["listBorder", "list", "iconSize", "imageSize"]),
1608
- list: (l = o.list) == null ? void 0 : l.map((d) => {
1609
- var a, s;
1610
- return {
1611
- ...W(d, "icon", "iconColor"),
1612
- image: ["news", "simple", "default"].includes(o.type) && d.icon ? d.icon : d.image,
1613
- actions: (s = (a = d.actions) == null ? void 0 : a.map) == null ? void 0 : s.call(a, (c) => /* @__PURE__ */ n(Ft, { ...c, editing: i }, c.id)),
1614
- border: o.listBorder,
1615
- iconSize: o.iconSize,
1616
- imageSize: o.imageSize,
1617
- hoverStyle: o.hoverStyle
1618
- };
1619
- })
1620
- };
1621
- }, [o]);
1622
- return /* @__PURE__ */ n(yo, { style: i ? { pointerEvents: "none" } : {}, ...r });
1623
- }
1624
- function wo({
1625
- properties: t,
1626
- section: e,
1627
- locale: i,
1628
- dev: o
1629
- }) {
1630
- var r;
1631
- return (r = e == null ? void 0 : e.config) != null && r.componentId ? /* @__PURE__ */ n(
1632
- ce,
1633
- {
1634
- instanceId: e.id,
1635
- componentId: e.config.componentId,
1636
- blockletId: e.config.blockletId,
1637
- blockletTitle: e.config.blockletTitle,
1638
- componentName: e.config.componentName,
1639
- locale: i,
1640
- properties: t,
1641
- dev: o
1642
- }
1643
- ) : /* @__PURE__ */ n(y, { textAlign: "center", py: 2, children: /* @__PURE__ */ n(R, { variant: "caption", color: "text.secondary", children: "Please select component to render" }) });
1644
- }
1645
- function vo({
1646
- src: t,
1647
- dataId: e,
1648
- isEdit: i = !1,
1649
- height: o = "100%",
1650
- onLoad: r = () => {
1651
- }
1652
- }) {
1653
- return /* @__PURE__ */ n(
1654
- ke,
1655
- {
1656
- isEdit: i,
1657
- embedId: e,
1658
- src: t,
1659
- height: o,
1660
- onLoad: () => {
1661
- r();
1662
- }
1663
- }
1664
- );
1665
- }
1666
- function ko({ dataId: t, src: e, actions: i, center: o, onLoad: r, ...l }) {
1667
- const [d, a] = N(l, V);
1668
- return /* @__PURE__ */ _(Y, { ...a, children: [
1669
- Object.keys(d).length > 0 && /* @__PURE__ */ n(M, { center: o, ...d }),
1670
- /* @__PURE__ */ n(
1671
- vo,
1672
- {
1673
- dataId: t,
1674
- src: e,
1675
- onLoad: r,
1676
- height: l.iframeHeight ? `${l.iframeHeight}px` : "100%"
1677
- }
1678
- ),
1679
- /* @__PURE__ */ n(O, { actions: i, center: o })
1680
- ] });
1681
- }
1682
- const Ir = {
1683
- src: "",
1684
- embedUrl: "",
1685
- title: "",
1686
- description: "",
1687
- dark: !1,
1688
- background: "",
1689
- center: !0,
1690
- config: {},
1691
- id: ""
1692
- };
1693
- function _o({ section: t, id: e, src: i, ...o }) {
1694
- const r = `${e}-${o.locale}`, [{ editing: l }, d] = N(o, D), a = lt({}), s = JSON.parse(JSON.stringify(d)), { message: c } = be(r, "server"), u = we(JSON.parse(JSON.stringify(d.config) || "{}"));
1695
- return H(() => {
1696
- c && c.onInit(() => u.current);
1697
- }, [c]), H(() => {
1698
- const m = JSON.parse(JSON.stringify(d.config) || "{}");
1699
- ve(a.current, m) || (a.current = m, c == null || c.send("config-set", m));
1700
- }, [c, d.config]), i ? /* @__PURE__ */ n(ko, { ...s, dataId: r, src: i, style: l ? { pointerEvents: "none" } : {} }) : /* @__PURE__ */ n($o, { children: 'Please set the "src" attribute for this block' });
1701
- }
1702
- const $o = $("div")`
1703
- user-select: none;
1704
- color: #999;
1705
- padding: 8px;
1706
- height: 200px;
1707
- `, Co = 12, No = ({
1708
- gridSettings: t,
1709
- section: e,
1710
- index: i,
1711
- columns: o,
1712
- simulateMode: r = "desktop",
1713
- isBackground: l
1714
- }) => {
1715
- const d = (t == null ? void 0 : t[r]) ?? {}, a = d[e.id], s = So(d);
1716
- return {
1717
- i: e.id,
1718
- static: (e == null ? void 0 : e.locked) || l,
1719
- ...l ? {
1720
- x: 0,
1721
- y: 0,
1722
- w: o,
1723
- h: 1,
1724
- isResizable: !1
1725
- } : {
1726
- x: (a == null ? void 0 : a.x) ?? 0,
1727
- y: (a == null ? void 0 : a.y) ?? i,
1728
- w: (a == null ? void 0 : a.w) ?? o,
1729
- h: (a == null ? void 0 : a.h) ?? 1,
1730
- isResizable: !0
1731
- },
1732
- minH: 1,
1733
- maxH: 1,
1734
- maxY: s
1735
- };
1736
- }, So = (t) => Object.values(t).reduce((e, i) => Math.max(e, i.y || 0), 0) || 0, Bo = (t) => {
1737
- const { dev: e, id: i, section: o, onBlockRender: r } = t, l = e == null ? void 0 : e.mode, d = Gt((g) => g.breakpoints.down("sm")), { t: a } = _e(), { sections: s, sectionIds: c, config: u } = o, { columns: m = Co, gridSettings: h } = u || {}, p = F(
1738
- (g, w = !1, C = 0) => {
1739
- var ut;
1740
- if (!r || !g || !g.component || g.visibility === "hidden")
1741
- return null;
1742
- const v = No({
1743
- gridSettings: h,
1744
- section: g,
1745
- index: C,
1746
- columns: m,
1747
- simulateMode: d ? "mobile" : "desktop",
1748
- isBackground: w
1749
- }), S = (v == null ? void 0 : v.x) ?? 0, B = (v == null ? void 0 : v.y) ?? 0, j = (v == null ? void 0 : v.w) ?? m, P = (v == null ? void 0 : v.h) ?? 1, K = (v == null ? void 0 : v.maxY) ?? 0, X = !!((ut = o == null ? void 0 : o.config) != null && ut.backgroundSectionId);
1750
- return /* @__PURE__ */ n(
1751
- y,
1752
- {
1753
- className: w ? "layout-block-background" : "layout-block-section",
1754
- sx: {
1755
- // 背景元素和普通元素都使用 grid 布局
1756
- ...w ? {
1757
- // 背景元素覆盖整个网格区域
1758
- gridColumn: "1 / -1",
1759
- gridRow: `1 / ${K + 1}`,
1760
- zIndex: 0,
1761
- width: "100%",
1762
- height: "100%",
1763
- "& .BlockBase-root": {
1764
- width: "100%",
1765
- height: "100%"
1766
- }
1767
- } : {
1768
- position: "relative",
1769
- // 使用 grid 定位普通元素
1770
- gridColumn: `${S + 1} / span ${j}`,
1771
- // hasBackground 的话,不再 + 1,因为 background 会占用第一行
1772
- gridRow: `${B + (X ? 0 : 1)} / span ${P}`,
1773
- zIndex: 1
1774
- // Ensure content is above background
1775
- }
1776
- },
1777
- children: r({
1778
- id: g.id,
1779
- type: g.component,
1780
- config: {},
1781
- section: {
1782
- ...g
1783
- },
1784
- mode: l
1785
- })
1786
- },
1787
- g.id
1788
- );
1789
- },
1790
- [i, l, r, h, m, d]
1791
- ), { backgroundElements: x, contentElements: f } = L(() => {
1792
- if (!c || !c.length || !s || !Object.keys(s).length)
1793
- return { backgroundElements: [], contentElements: [] };
1794
- const g = [], w = [];
1795
- return c == null || c.forEach((C, v) => {
1796
- var P;
1797
- const S = s[C];
1798
- if (!S) return;
1799
- const B = ((P = o == null ? void 0 : o.config) == null ? void 0 : P.backgroundSectionId) === C, j = p(S, B, v);
1800
- j && (B ? g.push(j) : w.push(j));
1801
- }), { backgroundElements: g, contentElements: w };
1802
- }, [p, s, c]);
1803
- return l === "draft" && !(x != null && x.length) && !(f != null && f.length) ? /* @__PURE__ */ _(
1804
- y,
1805
- {
1806
- sx: {
1807
- gridColumn: "1 / -1",
1808
- gridRow: "1",
1809
- display: "flex",
1810
- flexDirection: "column",
1811
- alignItems: "center",
1812
- justifyContent: "center",
1813
- gap: 2,
1814
- border: (g) => `2px dashed ${g.palette.divider}`,
1815
- borderRadius: 2,
1816
- padding: 4,
1817
- color: "text.secondary",
1818
- textAlign: "center",
1819
- minHeight: "160px"
1820
- },
1821
- children: [
1822
- /* @__PURE__ */ n(
1823
- y,
1824
- {
1825
- sx: {
1826
- fontSize: "48px",
1827
- opacity: 0.5
1828
- },
1829
- children: "📐"
1830
- }
1831
- ),
1832
- /* @__PURE__ */ n(
1833
- y,
1834
- {
1835
- sx: {
1836
- fontSize: "16px",
1837
- fontWeight: 500,
1838
- marginBottom: 1
1839
- },
1840
- children: "Section Layout"
1841
- }
1842
- ),
1843
- /* @__PURE__ */ n(
1844
- y,
1845
- {
1846
- sx: {
1847
- opacity: 0.7,
1848
- whiteSpace: "pre-line"
1849
- },
1850
- children: a("maker.layoutBlock.draftPlaceholder")
1851
- }
1852
- ),
1853
- /* @__PURE__ */ n(
1854
- y,
1855
- {
1856
- sx: {
1857
- position: "absolute",
1858
- top: 0,
1859
- left: 0,
1860
- right: 0,
1861
- bottom: 0,
1862
- pointerEvents: "none",
1863
- opacity: 0.1,
1864
- background: (g) => `
1865
- repeating-linear-gradient(
1866
- 90deg,
1867
- transparent,
1868
- transparent calc(100% / ${m} - 1px),
1869
- ${g.palette.grey[400]} calc(100% / ${m} - 1px),
1870
- ${g.palette.grey[400]} calc(100% / ${m})
1871
- )
1872
- `
1873
- }
1874
- }
1875
- )
1876
- ]
1877
- }
1878
- ) : /* @__PURE__ */ _(
1879
- y,
1880
- {
1881
- sx: {
1882
- position: "relative",
1883
- display: "grid",
1884
- gridTemplateColumns: `repeat(${m}, 1fr)`,
1885
- alignItems: "center",
1886
- width: "100%",
1887
- height: "100%"
1888
- },
1889
- children: [
1890
- x,
1891
- f
1892
- ]
1893
- }
1894
- );
1895
- }, Io = [
1896
- /youtu\.be\/([^#&?]{11})/,
1897
- // youtu.be/<id>
1898
- /\?v=([^#&?]{11})/,
1899
- // ?v=<id>
1900
- /&v=([^#&?]{11})/,
1901
- // &v=<id>
1902
- /embed\/([^#&?]{11})/,
1903
- // embed/<id>
1904
- /\/v\/([^#&?]{11})/
1905
- // /v/<id>
1906
- ];
1907
- function Wo(t) {
1908
- var e;
1909
- if (/youtu\.?be/.test(t))
1910
- for (const i of Io) {
1911
- const o = (e = i.exec(t)) == null ? void 0 : e[1];
1912
- if (o)
1913
- return o;
1914
- }
1915
- }
1916
- function Ro(t) {
1917
- const e = Wo(t);
1918
- if (e)
1919
- return `https://youtube.com/embed/${e}`;
1920
- }
1921
- function jo({ src: t }) {
1922
- return H(() => {
1923
- import("@lottiefiles/lottie-player");
1924
- }, []), /* @__PURE__ */ n("lottie-player", { autoplay: !0, loop: !0, mode: "normal", src: t });
1925
- }
1926
- function zo(t) {
1927
- return /* @__PURE__ */ n(y, { maxHeight: 400, overflow: "hidden auto", children: /* @__PURE__ */ n($e, { ...t }) });
1928
- }
1929
- function Lo({ url: t }) {
1930
- const e = lt(null), i = 495, [o, r] = et(
1931
- e.current ? e.current.offsetWidth * 0.5625 : i
1932
- ), l = F(() => {
1933
- const d = window.innerWidth > 990 ? 1 : window.innerWidth > 522 ? 1.2 : window.innerWidth > 400 ? 1.45 : 1.85, a = e.current ? e.current.offsetWidth * 0.5625 : i;
1934
- return r(Math.floor(a * d));
1935
- }, []);
1936
- return H(() => {
1937
- window.addEventListener("resize", l);
1938
- const d = window.innerWidth > 990 ? 1 : window.innerWidth > 522 ? 1.2 : window.innerWidth > 400 ? 1.45 : 1.85, a = e.current ? e.current.offsetWidth * 0.5625 : i;
1939
- return r(Math.floor(a * d)), function() {
1940
- window.removeEventListener("resize", l);
1941
- };
1942
- }, [o, l]), /* @__PURE__ */ n(
1943
- y,
1944
- {
1945
- component: "iframe",
1946
- ref: e,
1947
- title: "youtube",
1948
- width: "100%",
1949
- height: `${o}px`,
1950
- src: t,
1951
- frameBorder: "0",
1952
- allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
1953
- allowFullScreen: !0,
1954
- sx: { display: "block" }
1955
- }
1956
- );
1957
- }
1958
- const Wr = {
1959
- image: "https://www.arcblock.io/static/ead0cabde7f2b7ff34db8f3e8ceca271/afc4b/builder.png",
1960
- badge: "Develop · Deploy · Run",
1961
- title: "The Future is Here: Blockchain and Decentralized Application Development",
1962
- description: "ArcBlock, your exclusive new decentralized development platform, makes developing decentralized applications, blockchain, and distributed ledger technology straightforward.",
1963
- reverse: !1,
1964
- dark: !1,
1965
- background: "",
1966
- actions: void 0,
1967
- hasImage: !0,
1968
- center: !1
1969
- }, Eo = $(De)`
1970
- .section__description {
1971
- }
1972
- `;
1973
- function Po({
1974
- hasImage: t,
1975
- fullSizeImage: e,
1976
- boxed: i,
1977
- videoPoster: o,
1978
- imageMeta: r,
1979
- imageOptimization: l,
1980
- imageSize: d,
1981
- section: a,
1982
- ...s
1983
- }) {
1984
- var p, x;
1985
- const [{ editing: c }, u] = N({ ...s, boxed: e ? void 0 : i }, D);
1986
- let m = To(u.image, o, e, r, l, d);
1987
- t || (m = null);
1988
- let h = null;
1989
- return u.actions && (h = (x = (p = u.actions) == null ? void 0 : p.map) == null ? void 0 : x.call(p, (f, b) => /* @__PURE__ */ n(Ft, { ...f, editing: c }, b))), /* @__PURE__ */ n(
1990
- Eo,
1991
- {
1992
- ...u,
1993
- style: c ? { pointerEvents: "none" } : {},
1994
- image: m,
1995
- fullSizeImage: t && e,
1996
- actions: h
1997
- }
1998
- );
1999
- }
2000
- function To(t, e, i, o, r, l) {
2001
- if (t) {
2002
- if (t.endsWith(".json"))
2003
- return /* @__PURE__ */ n(jo, { src: t });
2004
- if (t.indexOf("twitter.com") !== -1)
2005
- return /* @__PURE__ */ n(zo, { sourceType: "url", url: t });
2006
- const d = Ro(t);
2007
- if (d)
2008
- return /* @__PURE__ */ n(Lo, { url: d });
2009
- const { naturalWidth: a, naturalHeight: s, filename: c } = o || {};
2010
- if (A(t))
2011
- return /* @__PURE__ */ n(
2012
- "video",
2013
- {
2014
- width: a && `${a}px`,
2015
- height: s && `${s}px`,
2016
- controls: !0,
2017
- autoPlay: !0,
2018
- muted: !0,
2019
- style: {
2020
- display: "block",
2021
- objectFit: l || "contain",
2022
- borderRadius: "8px",
2023
- width: "100%",
2024
- height: "100%"
2025
- },
2026
- poster: T(I(e), i ? 1200 : 540, r),
2027
- children: /* @__PURE__ */ n("source", { src: I(t), type: Fe(t) })
2028
- },
2029
- t
2030
- );
2031
- const u = r === "quality" ? 1 : 0.6;
2032
- return /* @__PURE__ */ n(
2033
- It,
2034
- {
2035
- src: I(t),
2036
- sizesAttr: {
2037
- sm: 600 * u,
2038
- md: 450 * u,
2039
- lg: 540 * u,
2040
- ...i && {
2041
- md: 900 * u,
2042
- lg: 1200 * u
2043
- }
2044
- },
2045
- width: a && `${a}px`,
2046
- height: s && `${s}px`,
2047
- alt: c ?? t,
2048
- style: { objectFit: l || "contain", display: "block", width: "100%", height: "100%" },
2049
- loading: "lazy"
2050
- }
2051
- );
2052
- }
2053
- return null;
2054
- }
2055
- const Rr = ["production", "draft"];
2056
- function jr({ mode: t, version: e } = {}) {
2057
- const i = e && typeof e == "number" ? { mode: t, version: e } : { mode: t };
2058
- return st.get(`/api/${ct()}/pages`, { params: i }).then((o) => o.data);
2059
- }
2060
- function zr({ mode: t, routes: e }) {
2061
- return st.post(`/api/${ct()}/pages/publish`, { mode: t, routes: e }).then((i) => i.data);
2062
- }
2063
- function Oo({
2064
- locale: t,
2065
- sort: e,
2066
- page: i,
2067
- limit: o,
2068
- mode: r
2069
- } = {}) {
2070
- return st.get(`/api/${ct()}/pages/toc`, { params: { locale: t, sort: e, page: i, limit: o, mode: r } }).then((l) => l.data);
2071
- }
2072
- const Lr = {
2073
- style: "list",
2074
- sort: "-updatedAt"
2075
- }, vt = 20;
2076
- function Ao({ style: t, sort: e, section: i, ...o }) {
2077
- const [{ editing: r, locale: l }, d] = N(o, D), [a, s] = N(d, V), [c, u] = et(), m = lt(!1), h = Ce(), p = fe(), x = F(async () => {
2078
- if (!m.current) {
2079
- m.current = !0, h();
2080
- try {
2081
- const f = c ? Math.floor(c.list.length / vt) + 1 : 1, { list: b, total: g } = await Oo({ locale: l, sort: e, page: f, limit: vt });
2082
- u((w) => ({
2083
- list: ((w == null ? void 0 : w.list) ?? []).concat(b),
2084
- total: g
2085
- }));
2086
- } finally {
2087
- m.current = !1, h();
2088
- }
2089
- }
2090
- }, [c, l, e, h]);
2091
- return Ne(() => {
2092
- x();
2093
- }), /* @__PURE__ */ _(Y, { ...s, sx: r ? { pointerEvents: "none" } : {}, children: [
2094
- Object.keys(a).length > 0 && /* @__PURE__ */ n(M, { ...a }),
2095
- c ? /* @__PURE__ */ _(Z, { children: [
2096
- /* @__PURE__ */ n(pt, { container: !0, spacing: 2, justifyContent: "center", children: c == null ? void 0 : c.list.map((f) => /* @__PURE__ */ n(pt, { item: !0, xs: 12, sm: t === "card" ? 6 : 12, md: t === "card" ? 3 : 12, children: /* @__PURE__ */ _(
2097
- Uo,
2098
- {
2099
- elevation: 0,
2100
- className: k(t === "card" && "style-card"),
2101
- onClick: r ? void 0 : () => p(f.slug),
2102
- children: [
2103
- !!f.image && /* @__PURE__ */ n(
2104
- qt,
2105
- {
2106
- component: "img",
2107
- alt: "",
2108
- image: T(I(f.image), 540),
2109
- loading: "lazy"
2110
- }
2111
- ),
2112
- /* @__PURE__ */ _(Qt, { children: [
2113
- /* @__PURE__ */ n(R, { variant: "h6", component: "div", className: kt, children: f.title || f.id }),
2114
- /* @__PURE__ */ n(R, { variant: "body2", className: kt, children: f.description })
2115
- ] })
2116
- ]
2117
- }
2118
- ) }, f.id)) }),
2119
- /* @__PURE__ */ n(y, { textAlign: "center", mt: 2, children: c.total > c.list.length ? /* @__PURE__ */ n(U, { variant: "outlined", color: "secondary", onClick: x, loading: m.current, children: "More" }) : /* @__PURE__ */ n(U, { variant: "outlined", color: "secondary", disabled: !0, children: "No More" }) })
2120
- ] }) : /* @__PURE__ */ n(y, { p: 2, textAlign: "center", children: /* @__PURE__ */ n(Xt, { size: 24 }) })
2121
- ] });
2122
- }
2123
- const kt = nt`
2124
- display: -webkit-box;
2125
- -webkit-box-orient: vertical;
2126
- -webkit-line-clamp: 2;
2127
- overflow: hidden;
2128
- text-overflow: ellipsis;
2129
- `, Uo = $(Kt)`
2130
- border: 1px solid #e0e0e0;
2131
- background-color: transparent;
2132
- cursor: pointer;
2133
- display: flex;
2134
- color: inherit;
2135
-
2136
- > .MuiCardMedia-root {
2137
- width: 30vw;
2138
- max-height: 50vw;
2139
- }
2140
-
2141
- &.style-card {
2142
- display: block;
2143
-
2144
- > .MuiCardMedia-root {
2145
- width: 100%;
2146
- max-height: 50vw;
2147
- }
2148
- }
2149
- `, Fo = {
2150
- iframe: _o,
2151
- section: Po,
2152
- "section-card-list": bo,
2153
- toc: Ao,
2154
- "ai-runtime": Ke,
2155
- "custom-component": wo,
2156
- "layout-block": Bo
2157
- };
2158
- function Ho({
2159
- id: t,
2160
- type: e,
2161
- mode: i,
2162
- config: o,
2163
- section: r,
2164
- ignorePageMetaStyle: l,
2165
- page: d,
2166
- ...a
2167
- }) {
2168
- const s = Fo[e], { getPageMetaStyle: c } = Pe(), u = L(() => {
2169
- const { height: p, ...x } = o;
2170
- return e === "layout-block" && (x.onBlockRender = (f) => {
2171
- var S, B, j, P, K, X;
2172
- const b = {
2173
- ...o == null ? void 0 : o.dev,
2174
- ...(S = f == null ? void 0 : f.config) == null ? void 0 : S.dev
2175
- }, { defaultLocale: g } = b, w = {
2176
- ...tt(o, ["locale", "editing"]),
2177
- ...f == null ? void 0 : f.config,
2178
- dev: b
2179
- }, { locale: C } = w;
2180
- let v = (j = (B = d == null ? void 0 : d.dataSource) == null ? void 0 : B[f == null ? void 0 : f.id]) == null ? void 0 : j[C];
2181
- return te(v) && (v = (K = (P = d == null ? void 0 : d.dataSource) == null ? void 0 : P[f == null ? void 0 : f.id]) == null ? void 0 : K[g ?? "en"]), /* @__PURE__ */ n(
2182
- Ho,
2183
- {
2184
- ...f,
2185
- config: {
2186
- ...(X = f == null ? void 0 : f.section) == null ? void 0 : X.properties,
2187
- ...v,
2188
- ...w
2189
- },
2190
- page: d,
2191
- ignorePageMetaStyle: !0
2192
- }
2193
- );
2194
- }), x;
2195
- }, [o, e]), m = L(() => {
2196
- const p = {};
2197
- return e !== "custom-component" && (p.height = o.height), p.sx = l ? void 0 : c("sx"), p.id = `BlockBase-${t}`, p;
2198
- }, [o.height, l, e, c]), h = s && /* @__PURE__ */ n(s, { mode: i, ...u, id: t, section: r });
2199
- return h ? /* @__PURE__ */ n(Je, { ...a, ...m, children: h }) : /* @__PURE__ */ n(Mo, { type: e });
2200
- }
2201
- function Mo({ type: t }) {
2202
- return /* @__PURE__ */ n(y, { p: 2, children: /* @__PURE__ */ _(Zt, { icon: /* @__PURE__ */ n(Ht, {}), color: "error", children: [
2203
- "Unsupported Block `",
2204
- t,
2205
- "`"
2206
- ] }) });
2207
- }
2208
- function Er(t) {
2209
- return t != null;
2210
- }
2211
- export {
2212
- Ft as A,
2213
- Ho as B,
2214
- Tt as I,
2215
- Sr as P,
2216
- Rr as S,
2217
- Lr as T,
2218
- Nr as a,
2219
- Wr as b,
2220
- Ir as c,
2221
- jr as g,
2222
- Er as n,
2223
- zr as p
2224
- };