@blocklet/list 0.14.4 → 0.14.6

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