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