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