@blocklet/list 0.14.4 → 0.14.5

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