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