@blocklet/list 0.14.9 → 0.14.11
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.
- package/lib/index.es.js +417 -405
- package/package.json +3 -3
package/lib/index.es.js
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { styled as q, useTheme as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { ErrorFallback as
|
|
7
|
-
import
|
|
1
|
+
import { jsx as t, jsxs as m, Fragment as D } from "react/jsx-runtime";
|
|
2
|
+
import { styled as q, useTheme as he } from "@arcblock/ux/lib/Theme";
|
|
3
|
+
import Ke from "@mui/material/styles/createTheme";
|
|
4
|
+
import Xe from "@mui/material/styles/ThemeProvider";
|
|
5
|
+
import Qe from "lodash/merge";
|
|
6
|
+
import { ErrorFallback as pe } from "@arcblock/ux/lib/ErrorBoundary";
|
|
7
|
+
import x from "@mui/material/Box";
|
|
8
8
|
import T from "@mui/material/Stack";
|
|
9
|
-
import { ErrorBoundary as
|
|
10
|
-
import
|
|
11
|
-
import { Icon as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { createContext as
|
|
15
|
-
import { createAxios as
|
|
16
|
-
import
|
|
17
|
-
import { useRequest as
|
|
18
|
-
import
|
|
9
|
+
import { ErrorBoundary as Ye } from "react-error-boundary";
|
|
10
|
+
import Ze from "@iconify-icons/tabler/compass";
|
|
11
|
+
import { Icon as Re } from "@iconify/react";
|
|
12
|
+
import me from "@mui/icons-material/Close";
|
|
13
|
+
import w from "@mui/material/Typography";
|
|
14
|
+
import { createContext as Pe, useState as L, useMemo as j, useContext as Te, useCallback as de, useEffect as H, forwardRef as Je, useRef as ue, memo as et } from "react";
|
|
15
|
+
import { createAxios as Ae } from "@blocklet/js-sdk";
|
|
16
|
+
import tt from "lodash/orderBy";
|
|
17
|
+
import { useRequest as J, useDebounceFn as Fe, useInfiniteScroll as rt, useReactive as ot } from "ahooks";
|
|
18
|
+
import oe from "lodash/omitBy";
|
|
19
19
|
import "color";
|
|
20
20
|
import "lodash/cloneDeep";
|
|
21
|
-
import { parseURL as
|
|
22
|
-
import
|
|
23
|
-
import
|
|
21
|
+
import { parseURL as nt, parseQuery as lt, parseFilename as it, stringifyParsedURL as at, withQuery as fe, joinURL as we } from "ufo";
|
|
22
|
+
import be from "flat";
|
|
23
|
+
import ee from "@mui/material/Button";
|
|
24
24
|
import st from "@mui/material/styles/useTheme";
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import kt from "
|
|
46
|
-
import vt from "@
|
|
25
|
+
import $ from "@mui/material/useMediaQuery";
|
|
26
|
+
import ct from "@mui/material/Drawer";
|
|
27
|
+
import Le from "@mui/material/Checkbox";
|
|
28
|
+
import Oe from "@mui/material/FormControlLabel";
|
|
29
|
+
import dt from "@mui/icons-material/Check";
|
|
30
|
+
import ut from "@mui/icons-material/KeyboardArrowDown";
|
|
31
|
+
import ht from "@mui/material/ClickAwayListener";
|
|
32
|
+
import pt from "@mui/material/Grow";
|
|
33
|
+
import _e from "@mui/material/MenuItem";
|
|
34
|
+
import Ee from "@mui/material/MenuList";
|
|
35
|
+
import mt from "@mui/material/Paper";
|
|
36
|
+
import ft from "@mui/material/Popper";
|
|
37
|
+
import gt from "@mui/material/SvgIcon";
|
|
38
|
+
import yt from "lodash/isEmpty";
|
|
39
|
+
import te from "@mui/material/CircularProgress";
|
|
40
|
+
import ze from "@arcblock/ux/lib/Avatar";
|
|
41
|
+
import xt from "@iconify-icons/tabler/cloud-download";
|
|
42
|
+
import wt from "@mui/icons-material/ChevronLeft";
|
|
43
|
+
import bt from "@mui/icons-material/ChevronRight";
|
|
44
|
+
import E from "@mui/material/Skeleton";
|
|
45
|
+
import kt from "react-image-gallery";
|
|
46
|
+
import vt from "@arcblock/ux/lib/Img";
|
|
47
47
|
import "react-image-gallery/styles/css/image-gallery.css";
|
|
48
|
-
import
|
|
48
|
+
import ke from "@mui/material/Grid";
|
|
49
49
|
import Ct from "react-infinite-scroll-hook";
|
|
50
50
|
import St from "@mui/material/Chip";
|
|
51
|
-
import
|
|
51
|
+
import Z from "@mui/icons-material/Search";
|
|
52
52
|
import It from "@mui/icons-material/Verified";
|
|
53
53
|
import Bt from "@mui/material/Autocomplete";
|
|
54
54
|
import Rt from "@mui/material/Dialog";
|
|
55
|
-
import
|
|
55
|
+
import Me from "@mui/material/OutlinedInput";
|
|
56
56
|
import Pt from "@mui/material/TextField";
|
|
57
57
|
import { useHotkeys as Tt } from "react-hotkeys-hook";
|
|
58
|
-
import
|
|
58
|
+
import ve from "@mui/material/InputAdornment";
|
|
59
59
|
import At from "@arcblock/ux/lib/Empty";
|
|
60
60
|
import Ft from "json-stable-stringify";
|
|
61
61
|
import Lt from "@mui/icons-material/Menu";
|
|
62
|
-
const
|
|
62
|
+
const Ne = Pe({
|
|
63
63
|
open: !1,
|
|
64
64
|
toggleOpen: (e) => {
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
function Ot({ children: e }) {
|
|
68
|
-
const [r, o] = L(!1), n = (
|
|
69
|
-
o(
|
|
70
|
-
}, i =
|
|
71
|
-
return /* @__PURE__ */ t(
|
|
68
|
+
const [r, o] = L(!1), n = (a) => {
|
|
69
|
+
o(a ?? !a);
|
|
70
|
+
}, i = j(() => ({ open: r, toggleOpen: n }), [r]);
|
|
71
|
+
return /* @__PURE__ */ t(Ne.Provider, { value: i, children: e });
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
return
|
|
73
|
+
function ge() {
|
|
74
|
+
return Te(Ne);
|
|
75
75
|
}
|
|
76
76
|
const P = {
|
|
77
77
|
nameAsc: "title",
|
|
@@ -87,34 +87,34 @@ const P = {
|
|
|
87
87
|
explorePath: "/api/blocklets/explore",
|
|
88
88
|
exploreDidsPath: "/api/blocklets/dids",
|
|
89
89
|
cacheSize: 100
|
|
90
|
-
},
|
|
90
|
+
}, _t = (e) => J(
|
|
91
91
|
async () => {
|
|
92
92
|
const { data: r } = await e.get(P.categoriesPath);
|
|
93
93
|
return Array.isArray(r) ? r : [];
|
|
94
94
|
},
|
|
95
95
|
{ manual: !0 }
|
|
96
96
|
);
|
|
97
|
-
function
|
|
97
|
+
function Et(e, r) {
|
|
98
98
|
const o = { sortBy: "popularity", sortDirection: "desc", ...e }, {
|
|
99
99
|
onFilterChange: n,
|
|
100
100
|
onSearchSelect: i = (l) => {
|
|
101
101
|
r.onFilterChange({ ...o, keyword: l.title });
|
|
102
102
|
},
|
|
103
|
-
emptyCategory:
|
|
103
|
+
emptyCategory: a
|
|
104
104
|
} = r;
|
|
105
|
-
!o.category && !
|
|
105
|
+
!o.category && !a && (o.category = "All");
|
|
106
106
|
const c = (l) => {
|
|
107
|
-
const
|
|
108
|
-
n(
|
|
107
|
+
const h = { ...o, ...l };
|
|
108
|
+
n(oe(h, (d) => d === "" || d === void 0));
|
|
109
109
|
};
|
|
110
110
|
return {
|
|
111
111
|
filters: e,
|
|
112
112
|
cleanFilter: (l) => {
|
|
113
|
-
const
|
|
114
|
-
n(
|
|
113
|
+
const h = l ? oe(o, (d, g) => l.includes(g)) : {};
|
|
114
|
+
n(oe(h, (d) => d === "" || d === void 0));
|
|
115
115
|
},
|
|
116
|
-
handleSort: (l,
|
|
117
|
-
c({ sortBy: l, sortDirection:
|
|
116
|
+
handleSort: (l, h) => {
|
|
117
|
+
c({ sortBy: l, sortDirection: h || l === "nameAsc" ? "asc" : "desc" });
|
|
118
118
|
},
|
|
119
119
|
handleKeyword: (l) => {
|
|
120
120
|
c({ category: void 0, keyword: l || void 0 });
|
|
@@ -139,7 +139,7 @@ function _t(e, r) {
|
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
const
|
|
142
|
+
const zt = (e, r, o) => e && r || !o, De = (e) => [
|
|
143
143
|
{
|
|
144
144
|
name: e("sort.popularity"),
|
|
145
145
|
value: "popularity"
|
|
@@ -152,16 +152,16 @@ const Et = (e, r, o) => e && r || !o, Ne = (e) => [
|
|
|
152
152
|
// name: t('sort.rating'),
|
|
153
153
|
// value: 'rating',
|
|
154
154
|
// },
|
|
155
|
-
],
|
|
155
|
+
], We = (e, r, o) => {
|
|
156
156
|
var d, g;
|
|
157
|
-
const n =
|
|
158
|
-
if ((d =
|
|
159
|
-
return i.imageFilter ?
|
|
157
|
+
const n = nt(e), i = lt(n.search);
|
|
158
|
+
if ((d = it(e, { strict: !0 })) == null ? void 0 : d.endsWith(".gif"))
|
|
159
|
+
return i.imageFilter ? at({ ...n, search: "" }) : e;
|
|
160
160
|
if (i.imageFilter)
|
|
161
161
|
return e;
|
|
162
|
-
const c = o || ((g = window.blocklet) == null ? void 0 : g.version), { w: l, h
|
|
163
|
-
return
|
|
164
|
-
...l ||
|
|
162
|
+
const c = o || ((g = window.blocklet) == null ? void 0 : g.version), { w: l, h } = typeof r == "object" ? { w: r.w, h: r.h } : { w: r, h: r };
|
|
163
|
+
return fe(e, {
|
|
164
|
+
...l || h ? { imageFilter: "resize", w: l, h } : {},
|
|
165
165
|
v: c
|
|
166
166
|
});
|
|
167
167
|
}, Mt = (e) => [
|
|
@@ -203,7 +203,7 @@ const Et = (e, r, o) => e && r || !o, Ne = (e) => [
|
|
|
203
203
|
helperText: "Please select a category"
|
|
204
204
|
},
|
|
205
205
|
blocklet: {
|
|
206
|
-
noResults: "
|
|
206
|
+
noResults: "No blocklet found.",
|
|
207
207
|
free: "Free",
|
|
208
208
|
search: 'Results for "{keyword}"',
|
|
209
209
|
resultCount: "{count} Blocklets",
|
|
@@ -268,16 +268,16 @@ const Et = (e, r, o) => e && r || !o, Ne = (e) => [
|
|
|
268
268
|
autocomplete: {
|
|
269
269
|
expandResult: "查看 “{name}” 的所有搜索结果"
|
|
270
270
|
}
|
|
271
|
-
},
|
|
272
|
-
en:
|
|
273
|
-
zh:
|
|
274
|
-
},
|
|
271
|
+
}, ne = {
|
|
272
|
+
en: be($t),
|
|
273
|
+
zh: be(jt)
|
|
274
|
+
}, $e = (e, r) => {
|
|
275
275
|
const o = {};
|
|
276
276
|
return e && (o["x-blocklet-server-version"] = e), r && (o["x-blocklet-store-version"] = r), o;
|
|
277
|
-
},
|
|
278
|
-
const n =
|
|
277
|
+
}, Ht = (e) => (r, o) => {
|
|
278
|
+
const n = ne[e] ? ne[e][r] : ne.en[r];
|
|
279
279
|
return Dt(n, o) || r;
|
|
280
|
-
},
|
|
280
|
+
}, je = {
|
|
281
281
|
errors: {
|
|
282
282
|
fetchCategoriesError: null
|
|
283
283
|
},
|
|
@@ -329,22 +329,22 @@ const Et = (e, r, o) => e && r || !o, Ne = (e) => [
|
|
|
329
329
|
handlePage: () => {
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
},
|
|
333
|
-
function
|
|
332
|
+
}, He = Pe(je), { Provider: Ut, Consumer: Io } = He;
|
|
333
|
+
function Vt(e) {
|
|
334
334
|
const {
|
|
335
335
|
locale: r = "zh",
|
|
336
336
|
filters: o = {},
|
|
337
337
|
serverVersion: n = "",
|
|
338
338
|
onFilterChange: i = () => {
|
|
339
339
|
},
|
|
340
|
-
minItemWidth:
|
|
340
|
+
minItemWidth: a = 350,
|
|
341
341
|
queryFilter: c = !0,
|
|
342
342
|
layout: l = {},
|
|
343
|
-
wrapChildren:
|
|
343
|
+
wrapChildren: h = (R) => R,
|
|
344
344
|
extraFilter: d = (R) => R,
|
|
345
345
|
baseSearch: g = !1,
|
|
346
|
-
fetchCategoryDelay:
|
|
347
|
-
showResourcesSwitch:
|
|
346
|
+
fetchCategoryDelay: p = 0,
|
|
347
|
+
showResourcesSwitch: f = !1,
|
|
348
348
|
showCategory: k = !0,
|
|
349
349
|
tagFilters: C = [],
|
|
350
350
|
children: S,
|
|
@@ -353,19 +353,19 @@ function Ht(e) {
|
|
|
353
353
|
},
|
|
354
354
|
endpoint: v,
|
|
355
355
|
blockletRender: y
|
|
356
|
-
} = e, A =
|
|
356
|
+
} = e, A = $e(n, B), F = j(() => Ae({ baseURL: v, headers: A }), [v]), O = Et(o, { onFilterChange: i, emptyCategory: !l.showExplore, onSearchSelect: u }), [z, U] = L(""), {
|
|
357
357
|
data: V = [],
|
|
358
|
-
error:
|
|
359
|
-
loading:
|
|
360
|
-
run:
|
|
361
|
-
} =
|
|
362
|
-
const R =
|
|
363
|
-
return
|
|
364
|
-
}, [V]),
|
|
358
|
+
error: re,
|
|
359
|
+
loading: K,
|
|
360
|
+
run: X
|
|
361
|
+
} = _t(F), W = j(() => {
|
|
362
|
+
const R = tt(V, [(N) => N.name], ["asc"]), _ = R.findIndex((N) => N.name === "All" || N.locales.en === "All");
|
|
363
|
+
return _ > -1 ? [{ ...R[_], _id: "All" }, ...R.slice(0, _), ...R.slice(_ + 1)] : R;
|
|
364
|
+
}, [V]), G = de(Ht(r), [r]), s = j(() => Nt(W, r), [W, r]), b = Mt(G), M = {
|
|
365
365
|
search: O,
|
|
366
|
-
errors: { fetchCategoriesError:
|
|
366
|
+
errors: { fetchCategoriesError: re },
|
|
367
367
|
loadings: {
|
|
368
|
-
fetchCategoriesLoading:
|
|
368
|
+
fetchCategoriesLoading: K
|
|
369
369
|
},
|
|
370
370
|
extraFilter: d,
|
|
371
371
|
endpoint: v,
|
|
@@ -376,41 +376,41 @@ function Ht(e) {
|
|
|
376
376
|
showTitle: l.showTitle ?? !0,
|
|
377
377
|
showSearch: l.showSearch ?? !0
|
|
378
378
|
},
|
|
379
|
-
minItemWidth:
|
|
380
|
-
wrapChildren:
|
|
381
|
-
t:
|
|
379
|
+
minItemWidth: a,
|
|
380
|
+
wrapChildren: h,
|
|
381
|
+
t: G,
|
|
382
382
|
storeVersion: B,
|
|
383
383
|
serverVersion: n,
|
|
384
384
|
selectedCategory: O.filters.category || (l.showExplore ? "" : "All"),
|
|
385
|
-
categoryList:
|
|
385
|
+
categoryList: W,
|
|
386
386
|
blockletRender: y,
|
|
387
387
|
locale: r,
|
|
388
|
-
categoryOptions:
|
|
388
|
+
categoryOptions: s,
|
|
389
389
|
priceOptions: b,
|
|
390
390
|
storeApi: F,
|
|
391
391
|
baseSearch: g,
|
|
392
|
-
showResourcesSwitch:
|
|
392
|
+
showResourcesSwitch: f,
|
|
393
393
|
showCategory: k,
|
|
394
394
|
tagFilters: C,
|
|
395
395
|
onFilterChange: i,
|
|
396
396
|
getCategoryLocale: (R) => {
|
|
397
397
|
if (!R)
|
|
398
398
|
return null;
|
|
399
|
-
const
|
|
400
|
-
return
|
|
399
|
+
const _ = V.find((N) => N._id === R || N.locales.en === "All");
|
|
400
|
+
return _ ? _.locales[r] || _.locales.en : null;
|
|
401
401
|
},
|
|
402
402
|
get developerName() {
|
|
403
|
-
return
|
|
403
|
+
return z;
|
|
404
404
|
},
|
|
405
405
|
updateDeveloperName: U
|
|
406
406
|
};
|
|
407
|
-
return
|
|
408
|
-
setTimeout(
|
|
409
|
-
}, [v,
|
|
407
|
+
return H(() => {
|
|
408
|
+
setTimeout(X, p || 0);
|
|
409
|
+
}, [v, X, p]), /* @__PURE__ */ t(Ut, { value: M, children: S });
|
|
410
410
|
}
|
|
411
411
|
function I() {
|
|
412
|
-
const e =
|
|
413
|
-
return e ||
|
|
412
|
+
const e = Te(He);
|
|
413
|
+
return e || je;
|
|
414
414
|
}
|
|
415
415
|
function Ue({
|
|
416
416
|
children: e,
|
|
@@ -419,7 +419,7 @@ function Ue({
|
|
|
419
419
|
...n
|
|
420
420
|
}) {
|
|
421
421
|
return /* @__PURE__ */ t(
|
|
422
|
-
|
|
422
|
+
ee,
|
|
423
423
|
{
|
|
424
424
|
...n,
|
|
425
425
|
onClick: r,
|
|
@@ -442,86 +442,86 @@ function Ue({
|
|
|
442
442
|
}
|
|
443
443
|
);
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function Q(e, r) {
|
|
446
446
|
return e === void 0 ? r : e;
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function ye({
|
|
449
449
|
xs: e,
|
|
450
450
|
sm: r,
|
|
451
451
|
md: o,
|
|
452
452
|
lg: n,
|
|
453
453
|
xl: i,
|
|
454
|
-
exact:
|
|
454
|
+
exact: a
|
|
455
455
|
}) {
|
|
456
|
-
const c = st(), l =
|
|
457
|
-
if (
|
|
458
|
-
return l ? e || null :
|
|
459
|
-
let
|
|
460
|
-
return l || (
|
|
456
|
+
const c = st(), l = $(c.breakpoints.down("sm")), h = $(c.breakpoints.between("sm", "md")), d = $(c.breakpoints.between("md", "lg")), g = $(c.breakpoints.between("lg", "xl"));
|
|
457
|
+
if (a)
|
|
458
|
+
return l ? e || null : h ? r || null : d ? o || null : g ? n || null : i || null;
|
|
459
|
+
let p = e;
|
|
460
|
+
return l || (p = Q(r, p), h) || (p = Q(o, p), d) || (p = Q(n, p), g) ? p : Q(i, p);
|
|
461
461
|
}
|
|
462
|
-
function
|
|
463
|
-
const { open: r, toggleOpen: o } =
|
|
462
|
+
function Gt({ children: e }) {
|
|
463
|
+
const { open: r, toggleOpen: o } = ge();
|
|
464
464
|
return /* @__PURE__ */ t(
|
|
465
|
-
|
|
465
|
+
ye,
|
|
466
466
|
{
|
|
467
|
-
xs: /* @__PURE__ */ t(
|
|
468
|
-
md: /* @__PURE__ */ t(
|
|
467
|
+
xs: /* @__PURE__ */ t(ct, { open: r, onClose: () => o(!1), children: e }),
|
|
468
|
+
md: /* @__PURE__ */ t(x, { children: e })
|
|
469
469
|
}
|
|
470
470
|
);
|
|
471
471
|
}
|
|
472
|
-
const
|
|
473
|
-
|
|
472
|
+
const qt = Je(({ loading: e, disabled: r, ...o }, n) => /* @__PURE__ */ t(
|
|
473
|
+
ee,
|
|
474
474
|
{
|
|
475
475
|
ref: n,
|
|
476
476
|
disableElevation: !0,
|
|
477
477
|
disabled: r || e,
|
|
478
478
|
...o,
|
|
479
479
|
sx: [{ borderRadius: "4px" }, ...Array.isArray(o.sx) ? o.sx : [o.sx]],
|
|
480
|
-
startIcon: e && /* @__PURE__ */ t(
|
|
480
|
+
startIcon: e && /* @__PURE__ */ t(te, { size: "1em" })
|
|
481
481
|
}
|
|
482
482
|
));
|
|
483
483
|
function Ve({ value: e, options: r, onChange: o, placeholder: n, ...i }) {
|
|
484
484
|
var B;
|
|
485
|
-
const
|
|
486
|
-
|
|
485
|
+
const a = ue(null), c = he(), [l, h] = L(!1), [d, g] = L(e !== null ? e : ""), p = $(c.breakpoints.down("sm"));
|
|
486
|
+
H(() => {
|
|
487
487
|
g(e !== null ? e : "");
|
|
488
488
|
}, [e]);
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
}, []), k =
|
|
492
|
-
|
|
489
|
+
const f = de(() => {
|
|
490
|
+
h(!1);
|
|
491
|
+
}, []), k = de(() => {
|
|
492
|
+
h(!0);
|
|
493
493
|
}, []);
|
|
494
494
|
function C(u) {
|
|
495
|
-
g(u.value), o(u.value),
|
|
495
|
+
g(u.value), o(u.value), p && f();
|
|
496
496
|
}
|
|
497
497
|
function S(u) {
|
|
498
498
|
return u === d;
|
|
499
499
|
}
|
|
500
|
-
return /* @__PURE__ */
|
|
501
|
-
/* @__PURE__ */
|
|
500
|
+
return /* @__PURE__ */ m(D, { children: [
|
|
501
|
+
/* @__PURE__ */ m(
|
|
502
502
|
Kt,
|
|
503
503
|
{
|
|
504
|
-
ref:
|
|
504
|
+
ref: a,
|
|
505
505
|
onClick: k,
|
|
506
506
|
variant: "outlined",
|
|
507
507
|
size: "small",
|
|
508
|
-
className: ["my-select__selector",
|
|
508
|
+
className: ["my-select__selector", yt(d) ? "" : "my-select__selector--active"].join(" "),
|
|
509
509
|
sx: { minWidth: "auto", color: "text.primary" },
|
|
510
510
|
...i,
|
|
511
511
|
children: [
|
|
512
512
|
((B = r.find((u) => u.value === d)) == null ? void 0 : B.name) || n,
|
|
513
|
-
/* @__PURE__ */ t(
|
|
513
|
+
/* @__PURE__ */ t(gt, { className: "my-select__arrowdown", component: ut, fontSize: "small" })
|
|
514
514
|
]
|
|
515
515
|
}
|
|
516
516
|
),
|
|
517
|
-
/* @__PURE__ */ t(
|
|
518
|
-
|
|
517
|
+
/* @__PURE__ */ t(ft, { open: l, anchorEl: a.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: u, placement: v }) => /* @__PURE__ */ t(
|
|
518
|
+
pt,
|
|
519
519
|
{
|
|
520
520
|
...u,
|
|
521
521
|
style: { transformOrigin: v === "bottom" ? "center top" : "center bottom" },
|
|
522
|
-
children: /* @__PURE__ */ t(
|
|
522
|
+
children: /* @__PURE__ */ t(mt, { children: /* @__PURE__ */ t(ht, { onClickAway: f, children: /* @__PURE__ */ t(Xt, { autoFocusItem: l, onMouseEnter: k, onMouseLeave: f, children: r.map((y) => /* @__PURE__ */ m(_e, { onClick: () => C(y), children: [
|
|
523
523
|
/* @__PURE__ */ t(
|
|
524
|
-
|
|
524
|
+
dt,
|
|
525
525
|
{
|
|
526
526
|
sx: { mr: 1, fontSize: 16, visibility: S(y.value) ? "visible" : "hidden" }
|
|
527
527
|
}
|
|
@@ -532,7 +532,7 @@ function Ve({ value: e, options: r, onChange: o, placeholder: n, ...i }) {
|
|
|
532
532
|
) })
|
|
533
533
|
] });
|
|
534
534
|
}
|
|
535
|
-
const Kt = q(
|
|
535
|
+
const Kt = q(qt)`
|
|
536
536
|
border: 1px solid #f0f0f0;
|
|
537
537
|
padding: 6px 8px 6px 12px;
|
|
538
538
|
font-weight: ${(e) => e.theme.typography.fontWeightRegular};
|
|
@@ -560,7 +560,7 @@ const Kt = q(Gt)`
|
|
|
560
560
|
margin-right: 3px;
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
`, Xt = q(
|
|
563
|
+
`, Xt = q(Ee)`
|
|
564
564
|
.my-select__option__icon {
|
|
565
565
|
color: transparent;
|
|
566
566
|
font-size: 14px;
|
|
@@ -577,9 +577,9 @@ const Kt = q(Gt)`
|
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
`;
|
|
580
|
-
function
|
|
581
|
-
const { search: e, t: r } = I(), { filters: o, handleSort: n, handlePrice: i } = e,
|
|
582
|
-
return /* @__PURE__ */
|
|
580
|
+
function Ge() {
|
|
581
|
+
const { search: e, t: r } = I(), { filters: o, handleSort: n, handlePrice: i } = e, a = De(r);
|
|
582
|
+
return /* @__PURE__ */ m(
|
|
583
583
|
T,
|
|
584
584
|
{
|
|
585
585
|
direction: { xs: "row", md: "column" },
|
|
@@ -589,10 +589,10 @@ function He() {
|
|
|
589
589
|
justifyContent: "space-between",
|
|
590
590
|
children: [
|
|
591
591
|
/* @__PURE__ */ t(
|
|
592
|
-
|
|
592
|
+
Oe,
|
|
593
593
|
{
|
|
594
594
|
control: /* @__PURE__ */ t(
|
|
595
|
-
|
|
595
|
+
Le,
|
|
596
596
|
{
|
|
597
597
|
checked: o.price === "free",
|
|
598
598
|
size: "small",
|
|
@@ -606,8 +606,8 @@ function He() {
|
|
|
606
606
|
/* @__PURE__ */ t(
|
|
607
607
|
Ve,
|
|
608
608
|
{
|
|
609
|
-
value: o.sortBy ||
|
|
610
|
-
options:
|
|
609
|
+
value: o.sortBy || a[0].value,
|
|
610
|
+
options: a,
|
|
611
611
|
onChange: (c) => n(c),
|
|
612
612
|
placeholder: r("sort.sort")
|
|
613
613
|
}
|
|
@@ -617,16 +617,16 @@ function He() {
|
|
|
617
617
|
);
|
|
618
618
|
}
|
|
619
619
|
function Qt() {
|
|
620
|
-
const { selectedCategory: e, search: r, t: o, categoryOptions: n, loadings: i, layout:
|
|
621
|
-
|
|
620
|
+
const { selectedCategory: e, search: r, t: o, categoryOptions: n, loadings: i, layout: a, baseSearch: c } = I(), { filters: l, handleCategory: h, cleanFilter: d } = r, { toggleOpen: g } = ge();
|
|
621
|
+
H(() => {
|
|
622
622
|
g(!1);
|
|
623
623
|
}, [Object.values(l).join("")]);
|
|
624
|
-
const
|
|
625
|
-
return
|
|
624
|
+
const p = zt(c, a.showSearch, l.keyword);
|
|
625
|
+
return a.showCategory ? /* @__PURE__ */ m(Gt, { children: [
|
|
626
626
|
/* @__PURE__ */ t(
|
|
627
|
-
|
|
627
|
+
ye,
|
|
628
628
|
{
|
|
629
|
-
xs: /* @__PURE__ */
|
|
629
|
+
xs: /* @__PURE__ */ m(
|
|
630
630
|
T,
|
|
631
631
|
{
|
|
632
632
|
direction: "row",
|
|
@@ -638,8 +638,8 @@ function Qt() {
|
|
|
638
638
|
borderBottom: 1,
|
|
639
639
|
borderColor: "divider",
|
|
640
640
|
children: [
|
|
641
|
-
/* @__PURE__ */ t(Ue, { onClick: () => g(!1), children: /* @__PURE__ */ t(
|
|
642
|
-
/* @__PURE__ */ t(
|
|
641
|
+
/* @__PURE__ */ t(Ue, { onClick: () => g(!1), children: /* @__PURE__ */ t(me, {}) }),
|
|
642
|
+
/* @__PURE__ */ t(w, { flex: 1, variant: "body1", fontWeight: "fontWeightMedium", children: o("common.category") })
|
|
643
643
|
]
|
|
644
644
|
}
|
|
645
645
|
),
|
|
@@ -654,11 +654,11 @@ function Qt() {
|
|
|
654
654
|
boxSizing: "content-box",
|
|
655
655
|
p: { xs: 2, md: 0 },
|
|
656
656
|
pr: { md: 6 },
|
|
657
|
-
children:
|
|
658
|
-
|
|
659
|
-
/* @__PURE__ */ t(
|
|
657
|
+
children: p ? /* @__PURE__ */ m(D, { children: [
|
|
658
|
+
a.showExplore && /* @__PURE__ */ m(x, { display: "flex", alignItems: "center", gap: 1, mb: 3, pb: 3, borderBottom: 1, borderColor: "divider", children: [
|
|
659
|
+
/* @__PURE__ */ t(Re, { icon: Ze }),
|
|
660
660
|
/* @__PURE__ */ t(
|
|
661
|
-
|
|
661
|
+
w,
|
|
662
662
|
{
|
|
663
663
|
variant: "body1",
|
|
664
664
|
color: e ? "text.lighter" : "text.primary",
|
|
@@ -671,59 +671,59 @@ function Qt() {
|
|
|
671
671
|
}
|
|
672
672
|
)
|
|
673
673
|
] }),
|
|
674
|
-
!!n.length && /* @__PURE__ */ t(T, { gap: 2, children: n.map((
|
|
675
|
-
|
|
674
|
+
!!n.length && /* @__PURE__ */ t(T, { gap: 2, children: n.map((f) => /* @__PURE__ */ t(
|
|
675
|
+
w,
|
|
676
676
|
{
|
|
677
677
|
variant: "body1",
|
|
678
|
-
title:
|
|
678
|
+
title: f.name,
|
|
679
679
|
sx: { cursor: "pointer" },
|
|
680
680
|
"data-cy": "filter",
|
|
681
|
-
color: e ===
|
|
681
|
+
color: e === f.value ? "text.primary" : "text.lighter",
|
|
682
682
|
textTransform: "capitalize",
|
|
683
683
|
onClick: () => {
|
|
684
|
-
e ===
|
|
684
|
+
e === f.value ? d() : h(f.value), g(!1);
|
|
685
685
|
},
|
|
686
|
-
children:
|
|
686
|
+
children: f.name
|
|
687
687
|
},
|
|
688
|
-
|
|
688
|
+
f.value
|
|
689
689
|
)) })
|
|
690
|
-
] }) : /* @__PURE__ */ t(
|
|
690
|
+
] }) : /* @__PURE__ */ t(Ge, {})
|
|
691
691
|
}
|
|
692
692
|
)
|
|
693
693
|
] }) : null;
|
|
694
694
|
}
|
|
695
|
-
function
|
|
696
|
-
const { endpoint: e, serverVersion: r, storeVersion: o } = I(), n =
|
|
695
|
+
function xe() {
|
|
696
|
+
const { endpoint: e, serverVersion: r, storeVersion: o } = I(), n = $e(r, o), i = j(() => Ae({
|
|
697
697
|
baseURL: e,
|
|
698
698
|
headers: n
|
|
699
699
|
}), [e]);
|
|
700
700
|
return {
|
|
701
|
-
get: async (
|
|
702
|
-
const { data: c } = await i.get(
|
|
701
|
+
get: async (a) => {
|
|
702
|
+
const { data: c } = await i.get(a);
|
|
703
703
|
return c;
|
|
704
704
|
},
|
|
705
|
-
post: async (
|
|
706
|
-
const { data: l } = await i.post(
|
|
705
|
+
post: async (a, c) => {
|
|
706
|
+
const { data: l } = await i.post(a, c);
|
|
707
707
|
return l;
|
|
708
708
|
}
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
|
-
const qe =
|
|
712
|
-
return /* @__PURE__ */ t(
|
|
711
|
+
const qe = et(function(r) {
|
|
712
|
+
return /* @__PURE__ */ t(x, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", ...r, children: /* @__PURE__ */ t(te, {}) });
|
|
713
713
|
});
|
|
714
714
|
function Yt({ showSkeleton: e, ...r }) {
|
|
715
|
-
return e ? /* @__PURE__ */ t(
|
|
715
|
+
return e ? /* @__PURE__ */ t(E, { variant: "rectangular", width: r.width, height: r.height }) : /* @__PURE__ */ t(vt, { ...r });
|
|
716
716
|
}
|
|
717
|
-
function
|
|
717
|
+
function Ce({
|
|
718
718
|
icon: e,
|
|
719
719
|
children: r,
|
|
720
720
|
maxWidth: o = 100,
|
|
721
721
|
title: n
|
|
722
722
|
}) {
|
|
723
|
-
return (r === 0 || r) && /* @__PURE__ */
|
|
723
|
+
return (r === 0 || r) && /* @__PURE__ */ m(T, { direction: "row", alignItems: "center", gap: 1, sx: { maxWidth: o, overflow: "hidden" }, children: [
|
|
724
724
|
e,
|
|
725
725
|
/* @__PURE__ */ t(
|
|
726
|
-
|
|
726
|
+
w,
|
|
727
727
|
{
|
|
728
728
|
flex: 1,
|
|
729
729
|
variant: "body2",
|
|
@@ -734,18 +734,18 @@ function ke({
|
|
|
734
734
|
)
|
|
735
735
|
] });
|
|
736
736
|
}
|
|
737
|
-
const
|
|
738
|
-
function
|
|
737
|
+
const le = 292, Zt = 210, Jt = 338;
|
|
738
|
+
function er() {
|
|
739
739
|
var S, B;
|
|
740
|
-
const { t: e, search: r } = I(), { get: o } =
|
|
740
|
+
const { t: e, search: r } = I(), { get: o } = xe(), n = he(), i = $(n.breakpoints.down("md")), a = ((B = (S = window.blocklet) == null ? void 0 : S.preferences) == null ? void 0 : B.homeBanner) || [], {
|
|
741
741
|
data: c = [],
|
|
742
742
|
error: l,
|
|
743
|
-
loading:
|
|
744
|
-
} =
|
|
743
|
+
loading: h
|
|
744
|
+
} = J(async () => {
|
|
745
745
|
const u = await o(
|
|
746
|
-
|
|
746
|
+
fe(P.blockletsPath, { didList: a.map((v) => v.did).join(",") })
|
|
747
747
|
);
|
|
748
|
-
return u != null && u.dataList ?
|
|
748
|
+
return u != null && u.dataList ? a.map((v) => u.dataList.find((y) => y.did === v.did)) : [];
|
|
749
749
|
});
|
|
750
750
|
l && console.error("Get Banner Blocklets error:", l);
|
|
751
751
|
const d = {
|
|
@@ -756,19 +756,31 @@ function Zt() {
|
|
|
756
756
|
cursor: "pointer",
|
|
757
757
|
color: "text.lighter"
|
|
758
758
|
};
|
|
759
|
-
return !l &&
|
|
760
|
-
/* @__PURE__ */ t(
|
|
759
|
+
return !l && a.length > 0 ? /* @__PURE__ */ m(D, { children: [
|
|
760
|
+
/* @__PURE__ */ t(w, { component: "h2", variant: "h2", mt: { xs: 2, md: 0 }, mb: 3, children: e("explore.title") }),
|
|
761
761
|
/* @__PURE__ */ t(
|
|
762
|
-
|
|
762
|
+
x,
|
|
763
763
|
{
|
|
764
|
-
height: { xs: "auto", md:
|
|
764
|
+
height: { xs: "auto", md: le },
|
|
765
765
|
position: "relative",
|
|
766
766
|
border: 1,
|
|
767
767
|
borderColor: "divider",
|
|
768
768
|
borderRadius: 3,
|
|
769
769
|
overflow: "hidden",
|
|
770
|
-
children: /* @__PURE__ */
|
|
771
|
-
|
|
770
|
+
children: h ? /* @__PURE__ */ m(x, { p: 5, display: "flex", gap: 5, height: le, alignItems: "center", justifyContent: "center", children: [
|
|
771
|
+
/* @__PURE__ */ t(E, { variant: "rounded", height: Zt, width: Jt }),
|
|
772
|
+
/* @__PURE__ */ m(x, { flex: 1, height: "100%", children: [
|
|
773
|
+
/* @__PURE__ */ t(E, { variant: "text", height: 50, width: 100 }),
|
|
774
|
+
/* @__PURE__ */ t(E, { variant: "text", height: 40, width: "100%" }),
|
|
775
|
+
/* @__PURE__ */ t(E, { variant: "text", height: 40, width: 300 }),
|
|
776
|
+
/* @__PURE__ */ m(x, { display: "flex", gap: 1, my: 2, children: [
|
|
777
|
+
/* @__PURE__ */ t(E, { variant: "circular", height: 20, width: 20 }),
|
|
778
|
+
/* @__PURE__ */ t(E, { variant: "text", height: 20, width: 50 })
|
|
779
|
+
] }),
|
|
780
|
+
/* @__PURE__ */ t(E, { variant: "rounded", height: 30, width: 100 })
|
|
781
|
+
] })
|
|
782
|
+
] }) : /* @__PURE__ */ t(
|
|
783
|
+
kt,
|
|
772
784
|
{
|
|
773
785
|
showNav: !0,
|
|
774
786
|
autoPlay: !0,
|
|
@@ -779,17 +791,17 @@ function Zt() {
|
|
|
779
791
|
showBullets: !1,
|
|
780
792
|
showThumbnails: !1,
|
|
781
793
|
showFullscreenButton: !1,
|
|
782
|
-
renderLeftNav: (u) => /* @__PURE__ */ t(
|
|
783
|
-
renderRightNav: (u) => /* @__PURE__ */ t(
|
|
784
|
-
items:
|
|
794
|
+
renderLeftNav: (u) => /* @__PURE__ */ t(x, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(wt, { sx: { ...d, left: 5 } }) }),
|
|
795
|
+
renderRightNav: (u) => /* @__PURE__ */ t(x, { onClick: u, sx: { display: { xs: "none", md: "block" } }, children: /* @__PURE__ */ t(bt, { sx: { ...d, right: 5 } }) }),
|
|
796
|
+
items: a.map((u, v) => ({
|
|
785
797
|
original: u.did,
|
|
786
798
|
renderItem: () => {
|
|
787
799
|
var O;
|
|
788
|
-
const y = c[v] || {}, A = u.cover ||
|
|
789
|
-
return /* @__PURE__ */
|
|
800
|
+
const y = c[v] || {}, A = u.cover || rr(u.did, (O = y.screenshots) == null ? void 0 : O[0]), F = We(A, { h: 400, w: 700 });
|
|
801
|
+
return /* @__PURE__ */ m(
|
|
790
802
|
T,
|
|
791
803
|
{
|
|
792
|
-
height: { xs: "auto", md:
|
|
804
|
+
height: { xs: "auto", md: le },
|
|
793
805
|
sx: {
|
|
794
806
|
"&::before": {
|
|
795
807
|
content: '""',
|
|
@@ -815,10 +827,10 @@ function Zt() {
|
|
|
815
827
|
gap: { xs: 2, md: 5 },
|
|
816
828
|
children: [
|
|
817
829
|
g(F),
|
|
818
|
-
/* @__PURE__ */
|
|
819
|
-
/* @__PURE__ */
|
|
820
|
-
|
|
821
|
-
|
|
830
|
+
/* @__PURE__ */ m(T, { flex: 1, height: "100%", gap: 3, children: [
|
|
831
|
+
/* @__PURE__ */ m(x, { flex: 1, children: [
|
|
832
|
+
p(u.name || y.title || u.name),
|
|
833
|
+
f(u.desc || y.description)
|
|
822
834
|
] }),
|
|
823
835
|
y.did && k(y, u.baseNum),
|
|
824
836
|
C(y)
|
|
@@ -834,10 +846,10 @@ function Zt() {
|
|
|
834
846
|
)
|
|
835
847
|
] }) : null;
|
|
836
848
|
function g(u) {
|
|
837
|
-
return /* @__PURE__ */ t(
|
|
849
|
+
return /* @__PURE__ */ t(x, { width: { xs: "100%", md: 338 }, height: 210, borderRadius: 2, overflow: "hidden", position: "relative", children: /* @__PURE__ */ t(
|
|
838
850
|
Yt,
|
|
839
851
|
{
|
|
840
|
-
showSkeleton:
|
|
852
|
+
showSkeleton: h,
|
|
841
853
|
src: u,
|
|
842
854
|
alt: "",
|
|
843
855
|
width: i ? void 0 : 338,
|
|
@@ -846,12 +858,12 @@ function Zt() {
|
|
|
846
858
|
}
|
|
847
859
|
) });
|
|
848
860
|
}
|
|
849
|
-
function
|
|
850
|
-
return /* @__PURE__ */ t(
|
|
861
|
+
function p(u) {
|
|
862
|
+
return /* @__PURE__ */ t(w, { variant: "h2", width: "100%", children: u });
|
|
851
863
|
}
|
|
852
|
-
function
|
|
864
|
+
function f(u) {
|
|
853
865
|
return /* @__PURE__ */ t(
|
|
854
|
-
|
|
866
|
+
w,
|
|
855
867
|
{
|
|
856
868
|
variant: "body2",
|
|
857
869
|
color: "text.secondary",
|
|
@@ -875,14 +887,14 @@ function Zt() {
|
|
|
875
887
|
}
|
|
876
888
|
function k(u, v = 0) {
|
|
877
889
|
const { did: y, owner: A, stats: F } = u;
|
|
878
|
-
return /* @__PURE__ */
|
|
879
|
-
/* @__PURE__ */ t(
|
|
880
|
-
/* @__PURE__ */ t(
|
|
890
|
+
return /* @__PURE__ */ m(x, { display: "flex", alignItems: "center", gap: 2, color: "text.secondary", children: [
|
|
891
|
+
/* @__PURE__ */ t(Ce, { icon: /* @__PURE__ */ t(ze, { src: A.avatar, did: y, size: 20, variant: "circle" }), children: A.fullName }),
|
|
892
|
+
/* @__PURE__ */ t(Ce, { icon: /* @__PURE__ */ t(Re, { icon: xt }), title: `${F.downloads + v}`, children: tr(F.downloads + v) })
|
|
881
893
|
] });
|
|
882
894
|
}
|
|
883
895
|
function C(u) {
|
|
884
896
|
return /* @__PURE__ */ t(
|
|
885
|
-
|
|
897
|
+
ee,
|
|
886
898
|
{
|
|
887
899
|
variant: "outlined",
|
|
888
900
|
size: "small",
|
|
@@ -900,72 +912,72 @@ function Zt() {
|
|
|
900
912
|
);
|
|
901
913
|
}
|
|
902
914
|
}
|
|
903
|
-
const
|
|
904
|
-
function
|
|
915
|
+
const tr = (e) => Number.isNaN(e) ? 0 : e < 1e3 ? e : e < 1e6 ? `${(e / 1e3).toFixed(1)}k` : e < 1e9 ? `${(e / 1e6).toFixed(1)}m` : `${(e / 1e9).toFixed(1)}b`, rr = (e, r) => e && r ? `/assets/${e}/screenshots/${r}` : "";
|
|
916
|
+
function or({ title: e, blocklets: r }) {
|
|
905
917
|
const { blockletRender: o, serverVersion: n } = I();
|
|
906
|
-
return /* @__PURE__ */
|
|
907
|
-
/* @__PURE__ */ t(
|
|
908
|
-
/* @__PURE__ */ t(
|
|
918
|
+
return /* @__PURE__ */ m(x, { mt: 3, children: [
|
|
919
|
+
/* @__PURE__ */ t(w, { component: "h3", variant: "h3", sx: { mb: 2 }, children: e }),
|
|
920
|
+
/* @__PURE__ */ t(ke, { container: !0, spacing: 2, children: r.map((i) => /* @__PURE__ */ t(ke, { item: !0, xs: 12, md: 6, p: "2px", "data-blocklet-did": i.did, children: /* @__PURE__ */ t(x, { padding: "1px", children: o({ blocklet: i, blocklets: r, serverVersion: n }) }) }, i.did)) })
|
|
909
921
|
] });
|
|
910
922
|
}
|
|
911
|
-
function
|
|
912
|
-
const { get: e } =
|
|
923
|
+
function nr() {
|
|
924
|
+
const { get: e } = xe(), { t: r } = I(), {
|
|
913
925
|
data: o = [],
|
|
914
926
|
error: n,
|
|
915
927
|
loading: i
|
|
916
|
-
} =
|
|
917
|
-
const
|
|
918
|
-
return Array.isArray(
|
|
928
|
+
} = J(async () => {
|
|
929
|
+
const a = await e(P.explorePath);
|
|
930
|
+
return Array.isArray(a) ? a : [];
|
|
919
931
|
});
|
|
920
|
-
return n ? /* @__PURE__ */ t(
|
|
921
|
-
/* @__PURE__ */ t(
|
|
932
|
+
return n ? /* @__PURE__ */ t(pe, { error: new Error(`Failed to fetch blocklets from ${P.explorePath}`) }) : i ? /* @__PURE__ */ t(qe, { mt: 15 }) : /* @__PURE__ */ m(D, { children: [
|
|
933
|
+
/* @__PURE__ */ t(er, {}),
|
|
922
934
|
o.map(
|
|
923
|
-
(
|
|
935
|
+
(a) => a.blocklets.length > 0 ? /* @__PURE__ */ t(or, { title: r(`explore.${a.type}`), blocklets: a.blocklets }, a.type) : null
|
|
924
936
|
)
|
|
925
937
|
] });
|
|
926
938
|
}
|
|
927
|
-
const
|
|
928
|
-
function
|
|
939
|
+
const ie = "__FREE_TEXT__", Se = "__NO_RESULT__", ae = 40;
|
|
940
|
+
function lr({
|
|
929
941
|
endpoint: e,
|
|
930
942
|
t: r,
|
|
931
943
|
locale: o,
|
|
932
944
|
filters: n,
|
|
933
945
|
handleKeyword: i,
|
|
934
|
-
handleSearchSelect:
|
|
946
|
+
handleSearchSelect: a,
|
|
935
947
|
...c
|
|
936
948
|
}) {
|
|
937
|
-
const l =
|
|
949
|
+
const l = ue(null), h = ue(!1), [d, g] = L(!1), [p, f] = L(""), [k, C] = L(!1), S = xe(), [B, u] = L(!1), v = async (s) => {
|
|
938
950
|
u(!0);
|
|
939
|
-
const b = await S.get(
|
|
951
|
+
const b = await S.get(we(e, fe(P.blockletsPath, s)));
|
|
940
952
|
return u(!1), b.dataList || [];
|
|
941
|
-
}, { data: y, run: A } =
|
|
942
|
-
(
|
|
953
|
+
}, { data: y, run: A } = J(
|
|
954
|
+
(s) => s ? v({
|
|
943
955
|
sortBy: P.nameDesc,
|
|
944
956
|
page: 1,
|
|
945
957
|
pageSize: 10,
|
|
946
|
-
keyword:
|
|
958
|
+
keyword: s
|
|
947
959
|
}) : Promise.resolve([]),
|
|
948
960
|
{
|
|
949
961
|
manual: !0
|
|
950
962
|
}
|
|
951
963
|
);
|
|
952
|
-
|
|
953
|
-
u(!0), A(n.keyword),
|
|
964
|
+
H(() => {
|
|
965
|
+
u(!0), A(n.keyword), f(n.keyword || "");
|
|
954
966
|
}, [n.keyword, A]), Tt(
|
|
955
967
|
"ctrl + k, command + k",
|
|
956
|
-
(
|
|
957
|
-
var b,
|
|
958
|
-
return
|
|
968
|
+
(s) => {
|
|
969
|
+
var b, M;
|
|
970
|
+
return s.stopPropagation(), s.preventDefault(), (M = (b = l.current) == null ? void 0 : b.querySelector("input")) == null || M.focus(), !1;
|
|
959
971
|
},
|
|
960
972
|
{ enableOnTags: ["INPUT"] }
|
|
961
973
|
);
|
|
962
|
-
const F =
|
|
963
|
-
let
|
|
964
|
-
return
|
|
965
|
-
/* @__PURE__ */
|
|
966
|
-
/* @__PURE__ */
|
|
974
|
+
const F = Fe((s) => A(s), { wait: 300 }), O = { name: ie, title: p, did: "" };
|
|
975
|
+
let z = [];
|
|
976
|
+
return p && (B ? z = [O] : y != null && y.length ? z = [O, ...y] : z = [{ name: Se, title: r("blocklet.noResults"), did: "" }]), /* @__PURE__ */ m(D, { children: [
|
|
977
|
+
/* @__PURE__ */ m(Rt, { fullScreen: !0, open: k, sx: { display: { md: "none" } }, children: [
|
|
978
|
+
/* @__PURE__ */ m(x, { p: 2, pb: 0, display: "flex", alignItems: "center", gap: 2, children: [
|
|
967
979
|
/* @__PURE__ */ t(
|
|
968
|
-
|
|
980
|
+
Me,
|
|
969
981
|
{
|
|
970
982
|
fullWidth: !0,
|
|
971
983
|
sx: {
|
|
@@ -985,27 +997,27 @@ function or({
|
|
|
985
997
|
autoFocus: !0,
|
|
986
998
|
placeholder: r("common.searchStore"),
|
|
987
999
|
className: "bl-autocomplete-input",
|
|
988
|
-
value:
|
|
989
|
-
onChange: (
|
|
990
|
-
startAdornment:
|
|
991
|
-
endAdornment:
|
|
1000
|
+
value: p,
|
|
1001
|
+
onChange: (s) => U(s.target.value),
|
|
1002
|
+
startAdornment: W(k),
|
|
1003
|
+
endAdornment: G()
|
|
992
1004
|
}
|
|
993
1005
|
),
|
|
994
1006
|
/* @__PURE__ */ t(
|
|
995
|
-
|
|
1007
|
+
ee,
|
|
996
1008
|
{
|
|
997
1009
|
variant: "outlined",
|
|
998
1010
|
onClick: () => {
|
|
999
|
-
C(!1),
|
|
1011
|
+
C(!1), f(n.keyword || "");
|
|
1000
1012
|
},
|
|
1001
1013
|
children: r("common.cancel")
|
|
1002
1014
|
}
|
|
1003
1015
|
)
|
|
1004
1016
|
] }),
|
|
1005
|
-
/* @__PURE__ */ t(
|
|
1017
|
+
/* @__PURE__ */ t(Ee, { sx: { p: 0.5 }, children: z.map((s) => K(s)) })
|
|
1006
1018
|
] }),
|
|
1007
1019
|
/* @__PURE__ */ t(
|
|
1008
|
-
|
|
1020
|
+
Z,
|
|
1009
1021
|
{
|
|
1010
1022
|
sx: { display: { sx: "block", md: "none" }, fontSize: 28, color: "text.lighter" },
|
|
1011
1023
|
onClick: () => C(!0)
|
|
@@ -1015,18 +1027,18 @@ function or({
|
|
|
1015
1027
|
Bt,
|
|
1016
1028
|
{
|
|
1017
1029
|
ref: l,
|
|
1018
|
-
open: !!
|
|
1030
|
+
open: !!p && d,
|
|
1019
1031
|
size: "small",
|
|
1020
1032
|
onOpen: () => g(!0),
|
|
1021
|
-
onClose: (
|
|
1022
|
-
g(!1), b === "selectOption" && !
|
|
1033
|
+
onClose: (s, b) => {
|
|
1034
|
+
g(!1), b === "selectOption" && !h.current && i(p);
|
|
1023
1035
|
},
|
|
1024
1036
|
disableClearable: !0,
|
|
1025
|
-
inputValue:
|
|
1026
|
-
onInputChange: (
|
|
1027
|
-
isOptionEqualToValue: (
|
|
1028
|
-
getOptionLabel: (
|
|
1029
|
-
getOptionKey: (
|
|
1037
|
+
inputValue: p,
|
|
1038
|
+
onInputChange: (s, b) => U(b),
|
|
1039
|
+
isOptionEqualToValue: (s, b) => s.name === b.name,
|
|
1040
|
+
getOptionLabel: (s) => s.title,
|
|
1041
|
+
getOptionKey: (s) => s.name,
|
|
1030
1042
|
noOptionsText: r("blocklet.noResults"),
|
|
1031
1043
|
autoHighlight: !0,
|
|
1032
1044
|
forcePopupIcon: !1,
|
|
@@ -1040,25 +1052,25 @@ function or({
|
|
|
1040
1052
|
}
|
|
1041
1053
|
}
|
|
1042
1054
|
},
|
|
1043
|
-
renderInput: (
|
|
1055
|
+
renderInput: (s) => /* @__PURE__ */ t(
|
|
1044
1056
|
Pt,
|
|
1045
1057
|
{
|
|
1046
|
-
...
|
|
1058
|
+
...s,
|
|
1047
1059
|
InputProps: {
|
|
1048
|
-
...
|
|
1060
|
+
...s.InputProps,
|
|
1049
1061
|
autoFocus: !0,
|
|
1050
1062
|
placeholder: r("common.searchStore"),
|
|
1051
1063
|
className: "bl-autocomplete-input",
|
|
1052
|
-
value:
|
|
1053
|
-
startAdornment:
|
|
1054
|
-
endAdornment:
|
|
1064
|
+
value: p,
|
|
1065
|
+
startAdornment: W(d),
|
|
1066
|
+
endAdornment: G()
|
|
1055
1067
|
}
|
|
1056
1068
|
}
|
|
1057
1069
|
),
|
|
1058
|
-
filterOptions: (
|
|
1070
|
+
filterOptions: (s) => s,
|
|
1059
1071
|
...c,
|
|
1060
|
-
options:
|
|
1061
|
-
renderOption: (
|
|
1072
|
+
options: z,
|
|
1073
|
+
renderOption: (s, b) => K(b),
|
|
1062
1074
|
value: O,
|
|
1063
1075
|
sx: [
|
|
1064
1076
|
{
|
|
@@ -1079,43 +1091,43 @@ function or({
|
|
|
1079
1091
|
}
|
|
1080
1092
|
)
|
|
1081
1093
|
] });
|
|
1082
|
-
function U(
|
|
1083
|
-
u(!0),
|
|
1094
|
+
function U(s) {
|
|
1095
|
+
u(!0), f(s), h.current = !1, F.run(s);
|
|
1084
1096
|
}
|
|
1085
1097
|
function V() {
|
|
1086
|
-
C(!1),
|
|
1098
|
+
C(!1), f(""), U(""), i("");
|
|
1087
1099
|
}
|
|
1088
|
-
function
|
|
1089
|
-
|
|
1100
|
+
function re(s) {
|
|
1101
|
+
s != null && s.did ? (C(!1), h.current = !0, f(""), a(s)) : s.name === ie && (C(!1), i(p));
|
|
1090
1102
|
}
|
|
1091
|
-
function
|
|
1092
|
-
var b,
|
|
1093
|
-
return /* @__PURE__ */
|
|
1094
|
-
|
|
1103
|
+
function K(s) {
|
|
1104
|
+
var b, M;
|
|
1105
|
+
return /* @__PURE__ */ m(
|
|
1106
|
+
_e,
|
|
1095
1107
|
{
|
|
1096
1108
|
sx: { display: "flex", alignItems: "center", gap: 1, p: 1.5, borderRadius: "8px" },
|
|
1097
|
-
onClick: () =>
|
|
1109
|
+
onClick: () => re(s),
|
|
1098
1110
|
children: [
|
|
1099
|
-
|
|
1100
|
-
/* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
|
|
1111
|
+
X(s),
|
|
1112
|
+
/* @__PURE__ */ m(w, { variant: "body1", children: [
|
|
1113
|
+
/* @__PURE__ */ m(w, { fontWeight: "fontWeightMedium", display: "flex", alignItems: "center", gap: 1, children: [
|
|
1114
|
+
s.title,
|
|
1103
1115
|
" ",
|
|
1104
1116
|
/* @__PURE__ */ t(It, { sx: { color: "#D97706", fontSize: 16, display: "none" } })
|
|
1105
1117
|
] }),
|
|
1106
|
-
/* @__PURE__ */ t(
|
|
1118
|
+
/* @__PURE__ */ t(w, { sx: { color: "text.lighter" }, fontSize: "13px", children: ((M = (b = s.category) == null ? void 0 : b.locales) == null ? void 0 : M[o || "en"]) || "" })
|
|
1107
1119
|
] })
|
|
1108
1120
|
]
|
|
1109
1121
|
},
|
|
1110
|
-
|
|
1122
|
+
s.did
|
|
1111
1123
|
);
|
|
1112
1124
|
}
|
|
1113
|
-
function
|
|
1114
|
-
if ([
|
|
1125
|
+
function X(s) {
|
|
1126
|
+
if ([ie, Se].includes(s.name))
|
|
1115
1127
|
return /* @__PURE__ */ t(
|
|
1116
|
-
|
|
1128
|
+
x,
|
|
1117
1129
|
{
|
|
1118
|
-
width:
|
|
1130
|
+
width: ae,
|
|
1119
1131
|
p: "6px",
|
|
1120
1132
|
display: "flex",
|
|
1121
1133
|
justifyContent: "center",
|
|
@@ -1123,46 +1135,46 @@ function or({
|
|
|
1123
1135
|
color: "text.lighter",
|
|
1124
1136
|
bgcolor: "#F1F3F5",
|
|
1125
1137
|
borderRadius: "8px",
|
|
1126
|
-
children: /* @__PURE__ */ t(
|
|
1138
|
+
children: /* @__PURE__ */ t(Z, { sx: { fontSize: 28 } })
|
|
1127
1139
|
}
|
|
1128
1140
|
);
|
|
1129
1141
|
let b = "";
|
|
1130
|
-
return
|
|
1142
|
+
return s.logo && (b = we(e, "assets", s.did, We(s.logo, ae, s.version))), /* @__PURE__ */ t(ze, { src: b, size: ae, style: { borderRadius: "8px", overflow: "hidden" } });
|
|
1131
1143
|
}
|
|
1132
|
-
function
|
|
1133
|
-
return /* @__PURE__ */ t(
|
|
1144
|
+
function W(s = !0) {
|
|
1145
|
+
return /* @__PURE__ */ t(x, { sx: { display: "flex", pl: 0.5, alignItems: "center", color: "text.lighter" }, children: s && p && B ? /* @__PURE__ */ t(te, { color: "inherit", size: 16 }) : /* @__PURE__ */ t(Z, { sx: { fontSize: 16, cursor: "default" } }) });
|
|
1134
1146
|
}
|
|
1135
|
-
function
|
|
1136
|
-
return
|
|
1147
|
+
function G() {
|
|
1148
|
+
return p ? /* @__PURE__ */ t(x, { sx: { display: "flex", alignItems: "center", color: "text.lighter" }, children: /* @__PURE__ */ t(me, { sx: { fontSize: 20, cursor: "pointer" }, onClick: () => V() }) }) : null;
|
|
1137
1149
|
}
|
|
1138
1150
|
}
|
|
1139
|
-
function
|
|
1140
|
-
const { search: o } = I(), { filters: n, handleKeyword: i } = o, [
|
|
1141
|
-
const { value:
|
|
1142
|
-
c(
|
|
1151
|
+
function ir({ placeholder: e = "Type to search...", ...r }) {
|
|
1152
|
+
const { search: o } = I(), { filters: n, handleKeyword: i } = o, [a, c] = L(n.keyword || ""), l = Fe(i, { wait: 300 }), h = (g) => {
|
|
1153
|
+
const { value: p } = g.target;
|
|
1154
|
+
c(p), l.run(p);
|
|
1143
1155
|
}, d = () => {
|
|
1144
1156
|
c(""), i("");
|
|
1145
1157
|
};
|
|
1146
|
-
return
|
|
1158
|
+
return H(() => {
|
|
1147
1159
|
c(n.keyword || "");
|
|
1148
1160
|
}, [n.keyword]), /* @__PURE__ */ t(
|
|
1149
|
-
|
|
1161
|
+
ar,
|
|
1150
1162
|
{
|
|
1151
1163
|
inputProps: {
|
|
1152
1164
|
"data-cy": "search-blocklet"
|
|
1153
1165
|
},
|
|
1154
|
-
startAdornment: /* @__PURE__ */ t(
|
|
1155
|
-
onChange:
|
|
1166
|
+
startAdornment: /* @__PURE__ */ t(ve, { position: "start", children: /* @__PURE__ */ t(sr, {}) }),
|
|
1167
|
+
onChange: h,
|
|
1156
1168
|
placeholder: e,
|
|
1157
|
-
value:
|
|
1169
|
+
value: a,
|
|
1158
1170
|
title: e,
|
|
1159
1171
|
"data-cy": "search",
|
|
1160
|
-
endAdornment:
|
|
1172
|
+
endAdornment: a && /* @__PURE__ */ t(ve, { position: "end", children: /* @__PURE__ */ t(cr, { "data-cy": "search-delete", onClick: d }) }),
|
|
1161
1173
|
...r
|
|
1162
1174
|
}
|
|
1163
1175
|
);
|
|
1164
1176
|
}
|
|
1165
|
-
const
|
|
1177
|
+
const ar = q(Me)`
|
|
1166
1178
|
background-color: ${(e) => e.theme.palette.grey[50]};
|
|
1167
1179
|
font-size: 14px;
|
|
1168
1180
|
border-radius: 6px;
|
|
@@ -1179,20 +1191,20 @@ const lr = q(Ee)`
|
|
|
1179
1191
|
color: transparent;
|
|
1180
1192
|
}
|
|
1181
1193
|
}
|
|
1182
|
-
`,
|
|
1194
|
+
`, sr = q(Z)`
|
|
1183
1195
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1184
1196
|
font-size: 28px;
|
|
1185
1197
|
@media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
|
|
1186
1198
|
font-size: 24px;
|
|
1187
1199
|
}
|
|
1188
|
-
`,
|
|
1200
|
+
`, cr = q(me)`
|
|
1189
1201
|
color: ${(e) => e.theme.palette.grey[500]};
|
|
1190
1202
|
font-size: 16px;
|
|
1191
1203
|
cursor: pointer;
|
|
1192
1204
|
`;
|
|
1193
|
-
function
|
|
1194
|
-
const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale: i, developerName:
|
|
1195
|
-
return /* @__PURE__ */
|
|
1205
|
+
function dr() {
|
|
1206
|
+
const { search: e, t: r, endpoint: o, locale: n, getCategoryLocale: i, developerName: a, showResourcesSwitch: c, layout: l, baseSearch: h } = I(), { filters: d, handleSort: g, handlePrice: p, handleDeveloper: f, handleSwitchShowResources: k } = e, C = De(r);
|
|
1207
|
+
return /* @__PURE__ */ m(
|
|
1196
1208
|
T,
|
|
1197
1209
|
{
|
|
1198
1210
|
className: "filter-bar",
|
|
@@ -1205,8 +1217,8 @@ function ar() {
|
|
|
1205
1217
|
px: 0,
|
|
1206
1218
|
pb: 3,
|
|
1207
1219
|
children: [
|
|
1208
|
-
/* @__PURE__ */ t(
|
|
1209
|
-
/* @__PURE__ */
|
|
1220
|
+
/* @__PURE__ */ t(w, { variant: "h2", textTransform: "capitalize", children: i(d.category) }),
|
|
1221
|
+
/* @__PURE__ */ m(
|
|
1210
1222
|
T,
|
|
1211
1223
|
{
|
|
1212
1224
|
flex: 1,
|
|
@@ -1216,8 +1228,8 @@ function ar() {
|
|
|
1216
1228
|
justifyContent: { xs: "space-between", md: "flex-end" },
|
|
1217
1229
|
gap: 2,
|
|
1218
1230
|
children: [
|
|
1219
|
-
l.showSearch ? /* @__PURE__ */ t(
|
|
1220
|
-
|
|
1231
|
+
l.showSearch ? /* @__PURE__ */ t(x, { flex: 1, children: h ? /* @__PURE__ */ t(ir, {}) : /* @__PURE__ */ t(
|
|
1232
|
+
lr,
|
|
1221
1233
|
{
|
|
1222
1234
|
locale: n,
|
|
1223
1235
|
endpoint: o,
|
|
@@ -1233,9 +1245,9 @@ function ar() {
|
|
|
1233
1245
|
handleSearchSelect: e.handleSearchSelect
|
|
1234
1246
|
}
|
|
1235
1247
|
) }) : null,
|
|
1236
|
-
d.owner &&
|
|
1248
|
+
d.owner && a && /* @__PURE__ */ t(St, { label: a, size: "small", onDelete: () => f("") }),
|
|
1237
1249
|
c ? /* @__PURE__ */ t(
|
|
1238
|
-
|
|
1250
|
+
Ie,
|
|
1239
1251
|
{
|
|
1240
1252
|
checked: d.showResources === "true",
|
|
1241
1253
|
onChange: (S) => k(S ? "true" : ""),
|
|
@@ -1243,10 +1255,10 @@ function ar() {
|
|
|
1243
1255
|
}
|
|
1244
1256
|
) : null,
|
|
1245
1257
|
/* @__PURE__ */ t(
|
|
1246
|
-
|
|
1258
|
+
Ie,
|
|
1247
1259
|
{
|
|
1248
1260
|
checked: d.price === "free",
|
|
1249
|
-
onChange: (S) =>
|
|
1261
|
+
onChange: (S) => p(S ? "free" : ""),
|
|
1250
1262
|
label: r("blocklet.free")
|
|
1251
1263
|
}
|
|
1252
1264
|
),
|
|
@@ -1266,17 +1278,17 @@ function ar() {
|
|
|
1266
1278
|
}
|
|
1267
1279
|
);
|
|
1268
1280
|
}
|
|
1269
|
-
function
|
|
1281
|
+
function Ie({
|
|
1270
1282
|
checked: e,
|
|
1271
1283
|
onChange: r,
|
|
1272
1284
|
label: o
|
|
1273
1285
|
}) {
|
|
1274
1286
|
return /* @__PURE__ */ t(
|
|
1275
|
-
|
|
1287
|
+
Oe,
|
|
1276
1288
|
{
|
|
1277
1289
|
sx: { m: 0 },
|
|
1278
1290
|
control: /* @__PURE__ */ t(
|
|
1279
|
-
|
|
1291
|
+
Le,
|
|
1280
1292
|
{
|
|
1281
1293
|
checked: e,
|
|
1282
1294
|
size: "small",
|
|
@@ -1288,94 +1300,94 @@ function Se({
|
|
|
1288
1300
|
}
|
|
1289
1301
|
);
|
|
1290
1302
|
}
|
|
1291
|
-
function
|
|
1292
|
-
return /* @__PURE__ */
|
|
1303
|
+
function Y({ children: e }) {
|
|
1304
|
+
return /* @__PURE__ */ m(x, { display: "flex", mt: 2, flexDirection: "column", alignItems: "center", justifyContent: "center", color: "text.lighter", children: [
|
|
1293
1305
|
/* @__PURE__ */ t(At, {}),
|
|
1294
1306
|
e
|
|
1295
1307
|
] });
|
|
1296
1308
|
}
|
|
1297
|
-
function
|
|
1309
|
+
function Be() {
|
|
1298
1310
|
const { t: e } = I();
|
|
1299
|
-
return /* @__PURE__ */ t(
|
|
1311
|
+
return /* @__PURE__ */ t(w, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
|
|
1300
1312
|
}
|
|
1301
|
-
function
|
|
1313
|
+
function se({ filterTip: e, keywordTip: r }) {
|
|
1302
1314
|
const { t: o, locale: n } = I(), i = () => n === "zh" ? "、" : " , ";
|
|
1303
|
-
return /* @__PURE__ */
|
|
1304
|
-
/* @__PURE__ */ t(
|
|
1305
|
-
e && /* @__PURE__ */ t(
|
|
1315
|
+
return /* @__PURE__ */ m(x, { mt: 1, display: "flex", children: [
|
|
1316
|
+
/* @__PURE__ */ t(w, { style: { marginRight: "16px" }, children: o("blocklet.emptyTip") }),
|
|
1317
|
+
e && /* @__PURE__ */ t(w, { children: o("blocklet.filterTip") }),
|
|
1306
1318
|
e && r && i(),
|
|
1307
|
-
r && /* @__PURE__ */ t(
|
|
1319
|
+
r && /* @__PURE__ */ t(w, { children: o("blocklet.keywordTip") })
|
|
1308
1320
|
] });
|
|
1309
1321
|
}
|
|
1310
|
-
function
|
|
1322
|
+
function ce({
|
|
1311
1323
|
primaryStart: e,
|
|
1312
1324
|
primaryEnd: r,
|
|
1313
1325
|
filter: o
|
|
1314
1326
|
}) {
|
|
1315
|
-
return /* @__PURE__ */
|
|
1316
|
-
/* @__PURE__ */ t(
|
|
1317
|
-
/* @__PURE__ */ t(
|
|
1318
|
-
/* @__PURE__ */
|
|
1327
|
+
return /* @__PURE__ */ m(w, { variant: "subtitle2", display: "flex", gap: 0.5, mx: 0.5, children: [
|
|
1328
|
+
/* @__PURE__ */ t(w, { children: e }),
|
|
1329
|
+
/* @__PURE__ */ t(w, { color: "primary", children: o }),
|
|
1330
|
+
/* @__PURE__ */ m(w, { children: [
|
|
1319
1331
|
r,
|
|
1320
1332
|
" "
|
|
1321
1333
|
] })
|
|
1322
1334
|
] });
|
|
1323
1335
|
}
|
|
1324
|
-
function
|
|
1325
|
-
const { t: e, search: r, getCategoryLocale: o, selectedCategory: n } = I(), { filters: i } = r,
|
|
1326
|
-
if (i.keyword &&
|
|
1327
|
-
return /* @__PURE__ */
|
|
1336
|
+
function ur() {
|
|
1337
|
+
const { t: e, search: r, getCategoryLocale: o, selectedCategory: n } = I(), { filters: i } = r, a = !!n || !!i.price;
|
|
1338
|
+
if (i.keyword && a)
|
|
1339
|
+
return /* @__PURE__ */ m(Y, { children: [
|
|
1328
1340
|
/* @__PURE__ */ t(
|
|
1329
|
-
|
|
1341
|
+
ce,
|
|
1330
1342
|
{
|
|
1331
1343
|
primaryStart: e("blocklet.noBlockletPart1"),
|
|
1332
1344
|
primaryEnd: e("blocklet.noBlockletPart2"),
|
|
1333
1345
|
filter: i.keyword
|
|
1334
1346
|
}
|
|
1335
1347
|
),
|
|
1336
|
-
/* @__PURE__ */ t(
|
|
1348
|
+
/* @__PURE__ */ t(se, { keywordTip: !0, filterTip: !0 })
|
|
1337
1349
|
] });
|
|
1338
1350
|
if (i.keyword)
|
|
1339
|
-
return /* @__PURE__ */
|
|
1351
|
+
return /* @__PURE__ */ m(Y, { children: [
|
|
1340
1352
|
/* @__PURE__ */ t(
|
|
1341
|
-
|
|
1353
|
+
ce,
|
|
1342
1354
|
{
|
|
1343
1355
|
primaryStart: e("blocklet.noBlockletPart1"),
|
|
1344
1356
|
primaryEnd: e("blocklet.noBlockletPart2"),
|
|
1345
1357
|
filter: i.keyword
|
|
1346
1358
|
}
|
|
1347
1359
|
),
|
|
1348
|
-
/* @__PURE__ */ t(
|
|
1360
|
+
/* @__PURE__ */ t(se, { keywordTip: !0 })
|
|
1349
1361
|
] });
|
|
1350
|
-
if (
|
|
1362
|
+
if (a) {
|
|
1351
1363
|
const c = o(n);
|
|
1352
|
-
return /* @__PURE__ */
|
|
1364
|
+
return /* @__PURE__ */ m(Y, { children: [
|
|
1353
1365
|
c ? /* @__PURE__ */ t(
|
|
1354
|
-
|
|
1366
|
+
ce,
|
|
1355
1367
|
{
|
|
1356
1368
|
primaryStart: e("blocklet.noCategoryResults1"),
|
|
1357
1369
|
primaryEnd: e("blocklet.noCategoryResults2"),
|
|
1358
1370
|
filter: c
|
|
1359
1371
|
}
|
|
1360
|
-
) : /* @__PURE__ */ t(
|
|
1361
|
-
/* @__PURE__ */ t(
|
|
1372
|
+
) : /* @__PURE__ */ t(Be, {}),
|
|
1373
|
+
/* @__PURE__ */ t(se, { filterTip: !0 })
|
|
1362
1374
|
] });
|
|
1363
1375
|
}
|
|
1364
|
-
return /* @__PURE__ */ t(
|
|
1376
|
+
return /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t(Be, {}) });
|
|
1365
1377
|
}
|
|
1366
|
-
const
|
|
1378
|
+
const hr = (e, r, o, n) => rt(
|
|
1367
1379
|
async (i) => {
|
|
1368
1380
|
i || (o.currentPage = o.defaultCurrentPage);
|
|
1369
|
-
const { currentPage:
|
|
1381
|
+
const { currentPage: a, pageSize: c } = o, l = {
|
|
1370
1382
|
...r,
|
|
1371
1383
|
category: r.category === "All" ? "" : r.category,
|
|
1372
1384
|
sortBy: P[r.sortBy],
|
|
1373
|
-
page:
|
|
1385
|
+
page: a,
|
|
1374
1386
|
pageSize: c
|
|
1375
1387
|
};
|
|
1376
1388
|
n(null);
|
|
1377
|
-
const { data:
|
|
1378
|
-
return o.currentPage++, { page:
|
|
1389
|
+
const { data: h = {} } = await e.get(P.blockletsPath, { params: l });
|
|
1390
|
+
return o.currentPage++, { page: a, pageSize: c, list: (h == null ? void 0 : h.dataList) || [], total: (h == null ? void 0 : h.total) || 0 };
|
|
1379
1391
|
},
|
|
1380
1392
|
{
|
|
1381
1393
|
isNoMore: (i) => i ? i.page * i.pageSize >= i.total : !1,
|
|
@@ -1383,28 +1395,28 @@ const dr = (e, r, o, n) => tt(
|
|
|
1383
1395
|
onError: n
|
|
1384
1396
|
}
|
|
1385
1397
|
);
|
|
1386
|
-
function
|
|
1387
|
-
var
|
|
1388
|
-
const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: i } = I(), { filters:
|
|
1398
|
+
function pr() {
|
|
1399
|
+
var p;
|
|
1400
|
+
const { storeApi: e, search: r, extraFilter: o, errors: n, updateDeveloperName: i } = I(), { filters: a } = r, c = ot({
|
|
1389
1401
|
currentPage: P.currentPage,
|
|
1390
1402
|
pageSize: Wt() ? P.mobilePageSize : P.pageSize,
|
|
1391
1403
|
defaultCurrentPage: P.defaultCurrentPage
|
|
1392
|
-
}), [l,
|
|
1404
|
+
}), [l, h] = L(null), d = hr(e, a, c, h), g = j(
|
|
1393
1405
|
() => {
|
|
1394
|
-
var
|
|
1395
|
-
return o ? o(((
|
|
1406
|
+
var f, k;
|
|
1407
|
+
return o ? o(((f = d.data) == null ? void 0 : f.list) || []) : ((k = d.data) == null ? void 0 : k.list) || [];
|
|
1396
1408
|
},
|
|
1397
1409
|
[d.data, o]
|
|
1398
1410
|
);
|
|
1399
|
-
return
|
|
1400
|
-
const
|
|
1401
|
-
i((
|
|
1402
|
-
}, [
|
|
1411
|
+
return H(() => {
|
|
1412
|
+
const f = g.find((k) => k.owner.did === a.owner);
|
|
1413
|
+
i((f == null ? void 0 : f.owner.fullName) || (f == null ? void 0 : f.author.name) || "");
|
|
1414
|
+
}, [a.owner, g, i]), {
|
|
1403
1415
|
blocklets: g,
|
|
1404
1416
|
fetchBlockletsError: l,
|
|
1405
1417
|
loadMore: d.loadMore,
|
|
1406
1418
|
hasNextPage: !d.noMore,
|
|
1407
|
-
total: (
|
|
1419
|
+
total: (p = d.data) == null ? void 0 : p.total,
|
|
1408
1420
|
loadings: {
|
|
1409
1421
|
fetchBlockletsLoading: d.loading,
|
|
1410
1422
|
loadingMore: d.loadingMore
|
|
@@ -1415,40 +1427,40 @@ function ur() {
|
|
|
1415
1427
|
}
|
|
1416
1428
|
};
|
|
1417
1429
|
}
|
|
1418
|
-
function
|
|
1419
|
-
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: i, minItemWidth:
|
|
1420
|
-
loading:
|
|
1430
|
+
function mr() {
|
|
1431
|
+
const { t: e, search: r, endpoint: o, blockletRender: n, serverVersion: i, minItemWidth: a, layout: c, baseSearch: l } = I(), { filters: h } = r, { blocklets: d, errors: g, loadMore: p, loadings: f, hasNextPage: k, total: C } = pr(), [S] = Ct({
|
|
1432
|
+
loading: f.fetchBlockletsLoading || f.loadingMore,
|
|
1421
1433
|
hasNextPage: k,
|
|
1422
|
-
onLoadMore:
|
|
1434
|
+
onLoadMore: p
|
|
1423
1435
|
});
|
|
1424
1436
|
if (g.fetchBlockletsError) {
|
|
1425
1437
|
const y = new Error(`Failed to fetch blocklets from ${o}: ${g.fetchBlockletsError.message}`);
|
|
1426
|
-
return /* @__PURE__ */ t(
|
|
1438
|
+
return /* @__PURE__ */ t(pe, { error: y });
|
|
1427
1439
|
}
|
|
1428
|
-
const B = l && c.showSearch || !
|
|
1429
|
-
return /* @__PURE__ */
|
|
1430
|
-
B ? /* @__PURE__ */ t(
|
|
1431
|
-
/* @__PURE__ */ t(
|
|
1440
|
+
const B = l && c.showSearch || !h.keyword;
|
|
1441
|
+
return /* @__PURE__ */ m(D, { children: [
|
|
1442
|
+
B ? /* @__PURE__ */ t(dr, {}) : /* @__PURE__ */ m(D, { children: [
|
|
1443
|
+
/* @__PURE__ */ t(ye, { xs: /* @__PURE__ */ t(Ge, {}), md: null }),
|
|
1432
1444
|
v()
|
|
1433
1445
|
] }),
|
|
1434
1446
|
u(),
|
|
1435
|
-
!
|
|
1447
|
+
!f.fetchBlockletsLoading && k && /* @__PURE__ */ t(x, { height: 60, display: "flex", justifyContent: "center", py: 2, ref: S, children: /* @__PURE__ */ t(te, {}) })
|
|
1436
1448
|
] });
|
|
1437
1449
|
function u() {
|
|
1438
|
-
return
|
|
1439
|
-
|
|
1450
|
+
return f.fetchBlockletsLoading ? /* @__PURE__ */ t(qe, { mt: 15 }) : d.length ? /* @__PURE__ */ t(
|
|
1451
|
+
x,
|
|
1440
1452
|
{
|
|
1441
1453
|
className: "blocklet-list",
|
|
1442
1454
|
display: "grid",
|
|
1443
|
-
gridTemplateColumns: `repeat(auto-fill, minmax(${
|
|
1455
|
+
gridTemplateColumns: `repeat(auto-fill, minmax(${a}px, 1fr))`,
|
|
1444
1456
|
p: "2px",
|
|
1445
1457
|
gap: 2,
|
|
1446
|
-
children: d.map((y) => /* @__PURE__ */ t(
|
|
1458
|
+
children: d.map((y) => /* @__PURE__ */ t(x, { "data-blocklet-did": y.did, sx: { minWidth: a }, children: n({ blocklet: y, blocklets: d, serverVersion: i }) }, y.did))
|
|
1447
1459
|
}
|
|
1448
|
-
) : /* @__PURE__ */ t(
|
|
1460
|
+
) : /* @__PURE__ */ t(ur, {});
|
|
1449
1461
|
}
|
|
1450
1462
|
function v() {
|
|
1451
|
-
return /* @__PURE__ */
|
|
1463
|
+
return /* @__PURE__ */ m(
|
|
1452
1464
|
T,
|
|
1453
1465
|
{
|
|
1454
1466
|
direction: "row",
|
|
@@ -1458,17 +1470,17 @@ function hr() {
|
|
|
1458
1470
|
mb: 2,
|
|
1459
1471
|
mt: { xs: 2, md: 0 },
|
|
1460
1472
|
children: [
|
|
1461
|
-
/* @__PURE__ */ t(
|
|
1462
|
-
/* @__PURE__ */ t(
|
|
1473
|
+
/* @__PURE__ */ t(w, { variant: "h3", children: e("blocklet.search", { keyword: h.keyword }) }),
|
|
1474
|
+
/* @__PURE__ */ t(w, { variant: "body1", color: "text.lighter", fontSize: 13, children: e("blocklet.resultCount", { count: C }) })
|
|
1463
1475
|
]
|
|
1464
1476
|
}
|
|
1465
1477
|
);
|
|
1466
1478
|
}
|
|
1467
1479
|
}
|
|
1468
|
-
function
|
|
1469
|
-
const { t: e, selectedCategory: r, getCategoryLocale: o } = I(), { toggleOpen: n } =
|
|
1470
|
-
return /* @__PURE__ */
|
|
1471
|
-
|
|
1480
|
+
function fr() {
|
|
1481
|
+
const { t: e, selectedCategory: r, getCategoryLocale: o } = I(), { toggleOpen: n } = ge();
|
|
1482
|
+
return /* @__PURE__ */ m(
|
|
1483
|
+
w,
|
|
1472
1484
|
{
|
|
1473
1485
|
variant: "body1",
|
|
1474
1486
|
display: { xs: "flex", md: "none" },
|
|
@@ -1483,19 +1495,19 @@ function pr() {
|
|
|
1483
1495
|
}
|
|
1484
1496
|
);
|
|
1485
1497
|
}
|
|
1486
|
-
function
|
|
1498
|
+
function gr() {
|
|
1487
1499
|
const { search: e, layout: r } = I(), { filters: o } = e, n = o.category || o.keyword || o.price;
|
|
1488
|
-
return /* @__PURE__ */ t(Ot, { children: /* @__PURE__ */
|
|
1489
|
-
/* @__PURE__ */ t(
|
|
1490
|
-
/* @__PURE__ */
|
|
1500
|
+
return /* @__PURE__ */ t(Ot, { children: /* @__PURE__ */ m(Ye, { FallbackComponent: pe, children: [
|
|
1501
|
+
/* @__PURE__ */ t(fr, {}),
|
|
1502
|
+
/* @__PURE__ */ m(x, { display: "flex", height: "100%", className: "list-container", pt: { xs: 0, md: 5 }, children: [
|
|
1491
1503
|
/* @__PURE__ */ t(Qt, {}),
|
|
1492
|
-
/* @__PURE__ */ t(T, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(
|
|
1504
|
+
/* @__PURE__ */ t(T, { height: "100%", position: "relative", flex: 1, overflow: "visible", children: r.showExplore && !n ? /* @__PURE__ */ t(nr, {}) : /* @__PURE__ */ t(mr, {}) })
|
|
1493
1505
|
] })
|
|
1494
1506
|
] }) });
|
|
1495
1507
|
}
|
|
1496
|
-
function
|
|
1497
|
-
const r =
|
|
1498
|
-
|
|
1508
|
+
function Bo(e) {
|
|
1509
|
+
const r = he(), o = Ke(
|
|
1510
|
+
Qe({
|
|
1499
1511
|
...r,
|
|
1500
1512
|
typography: {
|
|
1501
1513
|
h1: {
|
|
@@ -1523,11 +1535,11 @@ function So(e) {
|
|
|
1523
1535
|
}
|
|
1524
1536
|
})
|
|
1525
1537
|
);
|
|
1526
|
-
return /* @__PURE__ */ t(
|
|
1538
|
+
return /* @__PURE__ */ t(Xe, { theme: o, children: /* @__PURE__ */ t(Vt, { ...e, children: /* @__PURE__ */ t(gr, {}) }) });
|
|
1527
1539
|
}
|
|
1528
1540
|
export {
|
|
1529
|
-
|
|
1541
|
+
lr as Autocomplete,
|
|
1530
1542
|
Yt as Image,
|
|
1531
|
-
|
|
1532
|
-
|
|
1543
|
+
Bo as default,
|
|
1544
|
+
Et as useSearch
|
|
1533
1545
|
};
|