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