@blocklet/list 0.12.110 → 0.12.112

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 +388 -388
  2. package/package.json +3 -3
package/lib/index.es.js CHANGED
@@ -1,38 +1,38 @@
1
- import { jsx as t, jsxs as g, Fragment as ie } from "react/jsx-runtime";
2
- import { styled as T, useTheme as se } from "@arcblock/ux/lib/Theme";
3
- import { Global as Se, css as Ce } from "@emotion/react";
4
- import Oe from "@mui/icons-material/Sort";
5
- import { Button as Fe, CircularProgress as le, MenuList as Ae, useMediaQuery as ve, SvgIcon as Me, Popper as Ee, Grow as qe, Paper as je, ClickAwayListener as Ue, MenuItem as We, Chip as Pe, Box as D, Unstable_Grid2 as oe, OutlinedInput as Ge, InputAdornment as be, Typography as Te, Hidden as we, Stack as Ke } from "@mui/material";
6
- import He from "@mui/icons-material/Face";
7
- import { ErrorBoundary as Qe } from "react-error-boundary";
8
- import { ErrorFallback as Re } from "@arcblock/ux/lib/ErrorBoundary";
9
- import { createContext as Ve, useMemo as H, useState as M, useCallback as ae, useEffect as U, useContext as Je, forwardRef as Xe, useRef as Q, createElement as Ye, Fragment as Ze } from "react";
10
- import { useReactive as Be, useInfiniteScroll as et, useRequest as tt, useSize as rt, useDebounceFn as ot, useMemoizedFn as nt, useCreation as lt, useMount as at } from "ahooks";
11
- import { joinURL as it, parseQuery as st } from "ufo";
1
+ import { jsx as t, jsxs as f, Fragment as le } from "react/jsx-runtime";
2
+ import { styled as T, useTheme as ae } from "@arcblock/ux/lib/Theme";
3
+ import { Global as xe, css as ke } from "@emotion/react";
4
+ import _e from "@mui/icons-material/Sort";
5
+ import { Button as Ne, CircularProgress as oe, MenuList as Le, useMediaQuery as Se, SvgIcon as Me, Popper as Oe, Grow as Fe, Paper as Ae, ClickAwayListener as Ee, MenuItem as qe, Chip as Ce, Box as D, Unstable_Grid2 as te, OutlinedInput as je, InputAdornment as ge, Typography as ve, Hidden as ye, Stack as Ue } from "@mui/material";
6
+ import We from "@mui/icons-material/Face";
7
+ import { ErrorBoundary as Ge } from "react-error-boundary";
8
+ import { ErrorFallback as Te } from "@arcblock/ux/lib/ErrorBoundary";
9
+ import { createContext as Ke, useMemo as V, useState as E, useCallback as ne, useEffect as j, useContext as He, forwardRef as Qe, useRef as J, createElement as Ve, Fragment as Je } from "react";
10
+ import { useReactive as Pe, useInfiniteScroll as Xe, useRequest as Ye, useSize as Ze, useDebounceFn as et, useMemoizedFn as tt, useCreation as rt, useMount as ot } from "ahooks";
11
+ import { joinURL as nt, parseQuery as lt } from "ufo";
12
12
  import o from "prop-types";
13
- import ct from "lodash/orderBy";
14
- import ut from "axios";
15
- import pt from "json-stable-stringify";
13
+ import at from "lodash/orderBy";
14
+ import it from "axios";
15
+ import st from "json-stable-stringify";
16
16
  import "lodash/cloneDeep";
17
- import dt from "color";
18
- import xe from "flat";
19
- import mt from "@mui/icons-material/KeyboardArrowDown";
20
- import ht from "lodash/isEmpty";
21
- import ft from "@mui/icons-material/FilterAltOutlined";
22
- import gt from "@arcblock/ux/lib/Dialog";
23
- import yt from "@mui/material/Button";
24
- import bt from "@arcblock/ux/lib/Empty";
25
- import wt from "react-infinite-scroll-hook";
26
- import xt from "@mui/material/Box";
27
- import $e from "@mui/material/Typography";
28
- import kt from "@mui/icons-material/Search";
29
- import St from "@mui/icons-material/Close";
30
- import { createRoot as Ct } from "react-dom/client";
31
- import { autocomplete as vt } from "@algolia/autocomplete-js";
32
- import { useHotkeys as Pt } from "react-hotkeys-hook";
33
- import Tt from "@arcblock/ux/lib/Switch";
17
+ import ct from "color";
18
+ import be from "flat";
19
+ import ut from "@mui/icons-material/KeyboardArrowDown";
20
+ import pt from "lodash/isEmpty";
21
+ import dt from "@mui/icons-material/FilterAltOutlined";
22
+ import mt from "@arcblock/ux/lib/Dialog";
23
+ import ht from "@mui/material/Button";
24
+ import ft from "@arcblock/ux/lib/Empty";
25
+ import gt from "react-infinite-scroll-hook";
26
+ import yt from "@mui/material/Box";
27
+ import Re from "@mui/material/Typography";
28
+ import bt from "@mui/icons-material/Search";
29
+ import wt from "@mui/icons-material/Close";
30
+ import { createRoot as xt } from "react-dom/client";
31
+ import { autocomplete as kt } from "@algolia/autocomplete-js";
32
+ import { useHotkeys as St } from "react-hotkeys-hook";
33
+ import Ct from "@arcblock/ux/lib/Switch";
34
34
  import "@algolia/autocomplete-theme-classic/dist/theme.css";
35
- const Rt = (e) => [
35
+ const vt = (e) => [
36
36
  {
37
37
  name: e("sort.popularity"),
38
38
  value: "popularity"
@@ -49,14 +49,14 @@ const Rt = (e) => [
49
49
  name: e("sort.nameDescend"),
50
50
  value: "nameDesc"
51
51
  }
52
- ], Bt = (e) => [
52
+ ], Tt = (e) => [
53
53
  { name: e("blocklet.free"), value: "free" },
54
54
  { name: e("blocklet.payment"), value: "payment" }
55
- ], $t = (e = [], n = "en") => e.map((r) => ({ name: r.locales[n] || `Category.${n}`, value: r._id })), It = (e, n) => (
55
+ ], Pt = (e = [], n = "en") => e.map((r) => ({ name: r.locales[n] || `Category.${n}`, value: r._id })), Rt = (e, n) => (
56
56
  // eslint-disable-next-line no-prototype-builtins
57
- e.replace(/{(\w*)}/g, (r, l) => n.hasOwnProperty(l) ? n[l] : "")
58
- ), zt = () => window.innerWidth <= 600, Dt = (e) => dt(e).rgb().object();
59
- function _t(e, n) {
57
+ e.replace(/{(\w*)}/g, (r, a) => n.hasOwnProperty(a) ? n[a] : "")
58
+ ), Bt = () => window.innerWidth <= 600, $t = (e) => ct(e).rgb().object();
59
+ function It(e, n) {
60
60
  let r;
61
61
  return function(...s) {
62
62
  return r && clearTimeout(r), new Promise((c) => {
@@ -64,7 +64,7 @@ function _t(e, n) {
64
64
  });
65
65
  };
66
66
  }
67
- const Nt = _t((e) => Promise.resolve(e), 300), Lt = {
67
+ const zt = It((e) => Promise.resolve(e), 300), Dt = {
68
68
  common: {
69
69
  searchStore: "Search the store",
70
70
  showResources: "Show resources",
@@ -103,7 +103,7 @@ const Nt = _t((e) => Promise.resolve(e), 300), Lt = {
103
103
  autocomplete: {
104
104
  expandResult: 'Show {number} search results for "{name}" '
105
105
  }
106
- }, Ot = {
106
+ }, _t = {
107
107
  common: {
108
108
  searchStore: "搜索商店内应用",
109
109
  showResources: "显示资源型应用",
@@ -142,10 +142,10 @@ const Nt = _t((e) => Promise.resolve(e), 300), Lt = {
142
142
  autocomplete: {
143
143
  expandResult: "显示 {number} 条 “{name}” 的搜索结果 "
144
144
  }
145
- }, ne = {
146
- en: xe(Lt),
147
- zh: xe(Ot)
148
- }, Ie = {
145
+ }, re = {
146
+ en: be(Dt),
147
+ zh: be(_t)
148
+ }, Be = {
149
149
  filters: o.shape({
150
150
  keyword: o.string,
151
151
  sortBy: o.string,
@@ -168,7 +168,7 @@ const Nt = _t((e) => Promise.resolve(e), 300), Lt = {
168
168
  showResourcesSwitch: o.bool,
169
169
  showCategory: o.bool,
170
170
  tagFilters: o.array
171
- }, ze = {
171
+ }, $e = {
172
172
  locale: "zh",
173
173
  filters: {},
174
174
  onFilterChange: () => {
@@ -195,248 +195,248 @@ const Nt = _t((e) => Promise.resolve(e), 300), Lt = {
195
195
  blockletsPath: "/api/v2/blocklets.json",
196
196
  categoriesPath: "/api/blocklets/categories",
197
197
  cacheSize: 100
198
- }, De = Ve({}), { Provider: Ft, Consumer: Dr } = De;
199
- function ce({
198
+ }, Ie = Ke({}), { Provider: Nt, Consumer: $r } = Ie;
199
+ function ie({
200
200
  filters: e,
201
201
  children: n,
202
202
  endpoint: r,
203
- locale: l,
203
+ locale: a,
204
204
  blockletRender: s,
205
205
  onFilterChange: c,
206
206
  onSearchSelect: x,
207
207
  extraFilter: y,
208
- wrapChildren: u,
208
+ wrapChildren: p,
209
209
  baseSearch: b,
210
- serverVersion: p,
210
+ serverVersion: d,
211
211
  storeVersion: S,
212
212
  fetchCategoryDelay: v,
213
213
  showResourcesSwitch: C,
214
- showCategory: R,
215
- tagFilters: B
214
+ showCategory: P,
215
+ tagFilters: R
216
216
  }) {
217
217
  const i = {};
218
- p && (i["x-blocklet-server-version"] = p), S && (i["x-blocklet-store-version"] = S);
219
- const h = H(() => ut.create({
218
+ d && (i["x-blocklet-server-version"] = d), S && (i["x-blocklet-store-version"] = S);
219
+ const h = V(() => it.create({
220
220
  baseURL: r,
221
221
  headers: i
222
- }), [r]), d = H(() => ({
222
+ }), [r]), m = V(() => ({
223
223
  sortBy: "popularity",
224
224
  sortDirection: "desc",
225
225
  ...e
226
- }), [e]), k = d.category, P = Be({
226
+ }), [e]), k = m.category, $ = Pe({
227
227
  currentPage: _.currentPage,
228
- pageSize: zt() ? _.mobilePageSize : _.pageSize,
228
+ pageSize: Bt() ? _.mobilePageSize : _.pageSize,
229
229
  defaultCurrentPage: _.defaultCurrentPage
230
- }), [w, L] = M(null), {
231
- data: E = { list: [], total: 0 },
232
- loading: te,
233
- loadMore: re,
234
- loadingMore: O
235
- } = et(
236
- async (a) => {
237
- a || (P.currentPage = P.defaultCurrentPage);
238
- const { currentPage: f, pageSize: $ } = P, A = {
239
- ...d,
240
- sortBy: _[d.sortBy],
241
- page: f,
242
- pageSize: $
230
+ }), [w, L] = E(null), I = Xe(
231
+ async (l) => {
232
+ l || ($.currentPage = $.defaultCurrentPage);
233
+ const { currentPage: u, pageSize: B } = $, A = {
234
+ ...m,
235
+ sortBy: _[m.sortBy],
236
+ page: u,
237
+ pageSize: B
243
238
  };
244
239
  L(null);
245
240
  const { data: z = {} } = await h.get(_.blockletsPath, {
246
241
  params: A
247
242
  });
248
- return P.currentPage++, {
249
- page: f,
250
- pageSize: $,
243
+ return $.currentPage++, {
244
+ page: u,
245
+ pageSize: B,
251
246
  list: (z == null ? void 0 : z.dataList) || [],
252
247
  total: (z == null ? void 0 : z.total) || 0
253
248
  };
254
249
  },
255
250
  {
256
- isNoMore: (a) => a ? a.page * a.pageSize >= a.total : !1,
257
- reloadDeps: [r, pt(e)],
258
- onError: (a) => {
259
- L(a);
251
+ isNoMore: (l) => l ? l.page * l.pageSize >= l.total : !1,
252
+ reloadDeps: [r, st(e)],
253
+ onError: (l) => {
254
+ L(l);
260
255
  }
261
256
  }
262
257
  ), {
263
- data: F = [],
264
- error: G,
265
- loading: J,
266
- run: X
267
- } = tt(
258
+ data: W = [],
259
+ error: ee,
260
+ loading: O,
261
+ run: G
262
+ } = Ye(
268
263
  async () => {
269
- const { data: a } = await h.get(_.categoriesPath);
270
- return Array.isArray(a) ? a : [];
264
+ const { data: l } = await h.get(_.categoriesPath);
265
+ return Array.isArray(l) ? l : [];
271
266
  },
272
267
  { manual: !0 }
273
- ), m = H(() => ct(F || [], [(f) => f.name], ["asc"]), [F]), q = ae(
274
- (a, f) => {
275
- const $ = ne[l] ? ne[l][a] : ne.en[a];
276
- return It($, f);
268
+ ), F = V(() => at(W || [], [(u) => u.name], ["asc"]), [W]), K = ne(
269
+ (l, u) => {
270
+ const B = re[a] ? re[a][l] : re.en[l];
271
+ return Rt(B, u);
272
+ },
273
+ [a]
274
+ ), H = V(() => {
275
+ var u;
276
+ let l = ((u = I.data) == null ? void 0 : u.list) || [];
277
+ return l = y(l), l;
278
+ }, [I.data, y]), g = V(() => Pt(F, a), [F, a]), Q = Tt(K), M = {
279
+ errors: { fetchBlockletsError: w, fetchCategoriesError: ee },
280
+ loadings: {
281
+ fetchBlockletsLoading: I.loading,
282
+ fetchCategoriesLoading: O,
283
+ loadingMore: I.loadingMore
277
284
  },
278
- [l]
279
- ), I = H(() => {
280
- let a = E.list || [];
281
- return a = y(a), a;
282
- }, [E, y]), K = H(() => $t(m, l), [m, l]), Y = Bt(q), Le = {
283
- errors: { fetchBlockletsError: w, fetchCategoriesError: G },
284
- loadings: { fetchBlockletsLoading: te, fetchCategoriesLoading: J, loadingMore: O },
285
285
  endpoint: r,
286
- blockletList: I,
287
- wrapChildren: u,
288
- t: q,
289
- filters: d,
286
+ blockletList: H,
287
+ wrapChildren: p,
288
+ t: K,
289
+ filters: m,
290
290
  selectedCategory: k,
291
- categoryList: m,
291
+ categoryList: F,
292
292
  blockletRender: s,
293
- locale: l,
294
- categoryOptions: K,
295
- priceOptions: Y,
293
+ locale: a,
294
+ categoryOptions: g,
295
+ priceOptions: Q,
296
296
  storeApi: h,
297
297
  baseSearch: b,
298
298
  showResourcesSwitch: C,
299
- showCategory: R,
300
- tagFilters: B,
301
- hasNextPage: P.pageSize * P.currentPage < E.total,
299
+ showCategory: P,
300
+ tagFilters: R,
301
+ hasNextPage: !I.noMore,
302
302
  onFilterChange: c,
303
- handleSort: (a) => {
304
- const f = {
305
- ...d,
306
- sortBy: a,
307
- sortDirection: a === "nameAsc" ? "asc" : "desc"
303
+ handleSort: (l) => {
304
+ const u = {
305
+ ...m,
306
+ sortBy: l,
307
+ sortDirection: l === "nameAsc" ? "asc" : "desc"
308
308
  };
309
- c(f);
309
+ c(u);
310
310
  },
311
- handleKeyword: (a) => {
312
- const f = { ...d, keyword: a || void 0 };
313
- c(f);
311
+ handleKeyword: (l) => {
312
+ const u = { ...m, keyword: l || void 0 };
313
+ c(u);
314
314
  },
315
- handlePrice: (a) => {
316
- const f = {
317
- ...d,
318
- price: a === d.price ? void 0 : a
315
+ handlePrice: (l) => {
316
+ const u = {
317
+ ...m,
318
+ price: l === m.price ? void 0 : l
319
319
  };
320
- c(f);
320
+ c(u);
321
321
  },
322
- handleCategory: (a) => {
323
- let f = a;
324
- (a === "all" || a === d.category) && (f = void 0);
325
- const $ = { ...d, category: f };
326
- c($);
322
+ handleCategory: (l) => {
323
+ let u = l;
324
+ (l === "all" || l === m.category) && (u = void 0);
325
+ const B = { ...m, category: u };
326
+ c(B);
327
327
  },
328
- handleDeveloper: (a) => {
329
- const f = { ...d, owner: a || void 0 };
330
- c(f);
328
+ handleDeveloper: (l) => {
329
+ const u = { ...m, owner: l || void 0 };
330
+ c(u);
331
331
  },
332
- handlePage: (a) => {
333
- const f = { ...d, currentPage: a };
334
- c(f);
332
+ handlePage: (l) => {
333
+ const u = { ...m, currentPage: l };
334
+ c(u);
335
335
  },
336
336
  handleSwitchShowResources: () => {
337
- const a = { ...d };
338
- c(a);
337
+ const l = { ...m };
338
+ c(l);
339
339
  },
340
- loadMore: re,
341
- getCategoryLocale: (a) => {
342
- if (!a)
340
+ loadMore: I.loadMore,
341
+ getCategoryLocale: (l) => {
342
+ if (!l)
343
343
  return null;
344
- let f = null;
345
- const $ = F.find((A) => A._id === a);
346
- return $ && (f = $.locales[l]), f;
344
+ let u = null;
345
+ const B = W.find((A) => A._id === l);
346
+ return B && (u = B.locales[a]), u;
347
347
  },
348
348
  get developerName() {
349
- var f, $;
350
- return (($ = (f = I.find((A) => {
349
+ var u, B;
350
+ return ((B = (u = H.find((A) => {
351
351
  var z;
352
- return ((z = A == null ? void 0 : A.owner) == null ? void 0 : z.did) === d.owner;
353
- })) == null ? void 0 : f.owner) == null ? void 0 : $.name) || "";
352
+ return ((z = A == null ? void 0 : A.owner) == null ? void 0 : z.did) === m.owner;
353
+ })) == null ? void 0 : u.owner) == null ? void 0 : B.name) || "";
354
354
  },
355
355
  handleSearchSelect: x
356
356
  };
357
- return U(() => {
357
+ return j(() => {
358
358
  setTimeout(() => {
359
- X();
359
+ G();
360
360
  }, v || 0);
361
- }, [r]), /* @__PURE__ */ t(Ft, { value: Le, children: n });
361
+ }, [r]), /* @__PURE__ */ t(Nt, { value: M, children: n });
362
362
  }
363
- ce.propTypes = {
364
- ...Ie,
363
+ ie.propTypes = {
364
+ ...Be,
365
365
  children: o.any.isRequired
366
366
  };
367
- ce.defaultProps = ze;
367
+ ie.defaultProps = $e;
368
368
  function N() {
369
- const e = Je(De);
369
+ const e = He(Ie);
370
370
  return e || {};
371
371
  }
372
- const At = T(Fe)`
372
+ const Lt = T(Ne)`
373
373
  border-radius: 4px;
374
- `, ue = Xe(({ children: e, rounded: n, loading: r, disabled: l, ...s }, c) => /* @__PURE__ */ t(
375
- At,
374
+ `, se = Qe(({ children: e, rounded: n, loading: r, disabled: a, ...s }, c) => /* @__PURE__ */ t(
375
+ Lt,
376
376
  {
377
377
  ref: c,
378
378
  disableElevation: !0,
379
- disabled: l || r,
379
+ disabled: a || r,
380
380
  ...s,
381
- startIcon: r && /* @__PURE__ */ t(le, { size: "1em" }),
381
+ startIcon: r && /* @__PURE__ */ t(oe, { size: "1em" }),
382
382
  children: e
383
383
  }
384
384
  ));
385
- ue.propTypes = {
385
+ se.propTypes = {
386
386
  children: o.any,
387
387
  rounded: o.bool,
388
388
  loading: o.bool,
389
389
  disabled: o.bool
390
390
  };
391
- ue.defaultProps = {
391
+ se.defaultProps = {
392
392
  children: null,
393
393
  rounded: !1,
394
394
  loading: !1,
395
395
  disabled: !1
396
396
  };
397
- function pe({ title: e, value: n, icon: r, prepend: l, options: s, onChange: c, itemRender: x, ...y }) {
398
- const u = Q(null), b = se(), [p, S] = M(!1), [v, C] = M(n !== null ? n : ""), R = ve(b.breakpoints.down("sm"));
399
- U(() => {
397
+ function ce({ title: e, value: n, icon: r, prepend: a, options: s, onChange: c, itemRender: x, ...y }) {
398
+ const p = J(null), b = ae(), [d, S] = E(!1), [v, C] = E(n !== null ? n : ""), P = Se(b.breakpoints.down("sm"));
399
+ j(() => {
400
400
  C(n !== null ? n : "");
401
401
  }, [n]);
402
- const B = ae(() => {
402
+ const R = ne(() => {
403
403
  S(!1);
404
- }, []), i = ae(() => {
404
+ }, []), i = ne(() => {
405
405
  S(!0);
406
406
  }, []);
407
407
  function h(k) {
408
- C(k.value), c(k.value), R && B();
408
+ C(k.value), c(k.value), P && R();
409
409
  }
410
- function d(k) {
410
+ function m(k) {
411
411
  return k === v;
412
412
  }
413
- return /* @__PURE__ */ g(ie, { children: [
414
- /* @__PURE__ */ g(
413
+ return /* @__PURE__ */ f(le, { children: [
414
+ /* @__PURE__ */ f(
415
415
  Mt,
416
416
  {
417
- ref: u,
417
+ ref: p,
418
418
  onClick: i,
419
419
  variant: "outlined",
420
420
  size: "small",
421
- className: ["my-select__selector", ht(v) ? "" : "my-select__selector--active"].join(" "),
421
+ className: ["my-select__selector", pt(v) ? "" : "my-select__selector--active"].join(" "),
422
422
  sx: { minWidth: "auto" },
423
423
  ...y,
424
424
  children: [
425
425
  /* @__PURE__ */ t("div", { className: "my-select__icon", children: r }),
426
426
  e,
427
- /* @__PURE__ */ t(Me, { className: "my-select__arrowdown", component: mt, fontSize: "small" })
427
+ /* @__PURE__ */ t(Me, { className: "my-select__arrowdown", component: ut, fontSize: "small" })
428
428
  ]
429
429
  }
430
430
  ),
431
- /* @__PURE__ */ t(Ee, { open: p, anchorEl: u.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: k, placement: P }) => /* @__PURE__ */ t(qe, { ...k, sx: { transformOrigin: P === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(je, { children: /* @__PURE__ */ t(Ue, { onClickAway: B, children: /* @__PURE__ */ g(Et, { autoFocusItem: p, onMouseEnter: i, onMouseLeave: B, children: [
432
- l,
431
+ /* @__PURE__ */ t(Oe, { open: d, anchorEl: p.current, transition: !0, sx: { zIndex: "9999" }, children: ({ TransitionProps: k, placement: $ }) => /* @__PURE__ */ t(Fe, { ...k, sx: { transformOrigin: $ === "bottom" ? "center top" : "center bottom" }, children: /* @__PURE__ */ t(Ae, { children: /* @__PURE__ */ t(Ee, { onClickAway: R, children: /* @__PURE__ */ f(Ot, { autoFocusItem: d, onMouseEnter: i, onMouseLeave: R, children: [
432
+ a,
433
433
  s.map((w) => x ? x(w) : /* @__PURE__ */ t(
434
- We,
434
+ qe,
435
435
  {
436
436
  onClick: () => h(w),
437
437
  className: [
438
438
  "my-select__option",
439
- d(w.value) ? "my-select__option--active" : ""
439
+ m(w.value) ? "my-select__option--active" : ""
440
440
  ].join(" "),
441
441
  children: w.name
442
442
  },
@@ -445,7 +445,7 @@ function pe({ title: e, value: n, icon: r, prepend: l, options: s, onChange: c,
445
445
  ] }) }) }) }) })
446
446
  ] });
447
447
  }
448
- pe.propTypes = {
448
+ ce.propTypes = {
449
449
  options: o.array.isRequired,
450
450
  value: o.oneOfType([o.string, o.number, o.array]),
451
451
  onChange: o.func,
@@ -454,7 +454,7 @@ pe.propTypes = {
454
454
  icon: o.any,
455
455
  prepend: o.any
456
456
  };
457
- pe.defaultProps = {
457
+ ce.defaultProps = {
458
458
  value: null,
459
459
  icon: null,
460
460
  prepend: null,
@@ -462,7 +462,7 @@ pe.defaultProps = {
462
462
  onChange: () => {
463
463
  }
464
464
  };
465
- const Mt = T(ue)`
465
+ const Mt = T(se)`
466
466
  border: 1px solid #f0f0f0;
467
467
  padding: 6px 8px 6px 12px;
468
468
  font-weight: ${(e) => e.theme.typography.fontWeightBold};
@@ -493,7 +493,7 @@ const Mt = T(ue)`
493
493
  margin-right: 3px;
494
494
  }
495
495
  }
496
- `, Et = T(Ae)`
496
+ `, Ot = T(Le)`
497
497
  .my-select__option__icon {
498
498
  color: transparent;
499
499
  font-size: 16px;
@@ -510,15 +510,15 @@ const Mt = T(ue)`
510
510
  }
511
511
  }
512
512
  `;
513
- function W({ options: e, onChange: n, title: r, value: l }) {
514
- return /* @__PURE__ */ g(qt, { children: [
513
+ function U({ options: e, onChange: n, title: r, value: a }) {
514
+ return /* @__PURE__ */ f(Ft, { children: [
515
515
  /* @__PURE__ */ t("div", { className: "title", children: r }),
516
516
  /* @__PURE__ */ t("div", { className: "list", children: e.map((s) => /* @__PURE__ */ t(
517
517
  "div",
518
518
  {
519
519
  title: s.name,
520
520
  "data-cy": "filter",
521
- className: l === s.value ? "select item" : "item",
521
+ className: a === s.value ? "select item" : "item",
522
522
  onClick: () => n(s.value),
523
523
  children: s.name
524
524
  },
@@ -526,7 +526,7 @@ function W({ options: e, onChange: n, title: r, value: l }) {
526
526
  )) })
527
527
  ] });
528
528
  }
529
- const qt = T("div")`
529
+ const Ft = T("div")`
530
530
  .title {
531
531
  font-size: 18px;
532
532
  font-weight: bold;
@@ -554,48 +554,48 @@ const qt = T("div")`
554
554
  font-weight: bold;
555
555
  }
556
556
  `;
557
- W.propTypes = {
557
+ U.propTypes = {
558
558
  title: o.string.isRequired,
559
559
  options: o.array.isRequired,
560
560
  onChange: o.func.isRequired,
561
561
  value: o.oneOfType([o.string, o.number])
562
562
  };
563
- W.defaultProps = {
563
+ U.defaultProps = {
564
564
  value: null
565
565
  };
566
- function de() {
567
- const { selectedCategory: e, handleCategory: n, t: r, handlePrice: l, filters: s, categoryOptions: c, priceOptions: x } = N(), [y, u] = M(!1), b = (p, S) => {
568
- p === "category" && n(S), p === "price" && l(S), u(!1);
566
+ function ue() {
567
+ const { selectedCategory: e, handleCategory: n, t: r, handlePrice: a, filters: s, categoryOptions: c, priceOptions: x } = N(), [y, p] = E(!1), b = (d, S) => {
568
+ d === "category" && n(S), d === "price" && a(S), p(!1);
569
569
  };
570
- return /* @__PURE__ */ g(jt, { children: [
571
- /* @__PURE__ */ t(yt, { variant: "outlined", className: "filter-button", onClick: () => u(!0), children: /* @__PURE__ */ t(ft, { className: "filter-icon", fontSize: "small" }) }),
572
- /* @__PURE__ */ g(gt, { fullWidth: !0, title: "", open: y, onClose: () => u(!1), children: [
570
+ return /* @__PURE__ */ f(At, { children: [
571
+ /* @__PURE__ */ t(ht, { variant: "outlined", className: "filter-button", onClick: () => p(!0), children: /* @__PURE__ */ t(dt, { className: "filter-icon", fontSize: "small" }) }),
572
+ /* @__PURE__ */ f(mt, { fullWidth: !0, title: "", open: y, onClose: () => p(!1), children: [
573
573
  /* @__PURE__ */ t(
574
- W,
574
+ U,
575
575
  {
576
576
  title: r("common.price"),
577
577
  options: x,
578
578
  value: s.price,
579
- onChange: (p) => {
580
- b("price", p);
579
+ onChange: (d) => {
580
+ b("price", d);
581
581
  }
582
582
  }
583
583
  ),
584
584
  c.length > 0 && /* @__PURE__ */ t("div", { style: { marginTop: "16px" }, children: /* @__PURE__ */ t(
585
- W,
585
+ U,
586
586
  {
587
587
  title: r("common.category"),
588
588
  options: c,
589
589
  value: e,
590
- onChange: (p) => {
591
- b("category", p);
590
+ onChange: (d) => {
591
+ b("category", d);
592
592
  }
593
593
  }
594
594
  ) })
595
595
  ] })
596
596
  ] });
597
597
  }
598
- const jt = T("div")`
598
+ const At = T("div")`
599
599
  .filter-button {
600
600
  border-color: rgb(240, 240, 240);
601
601
  padding: 5px 8px;
@@ -606,9 +606,9 @@ const jt = T("div")`
606
606
  color: ${(e) => e.theme.palette.grey[500]};
607
607
  }
608
608
  `;
609
- de.propTypes = {};
610
- de.defaultProps = {};
611
- const Ut = T("div")`
609
+ ue.propTypes = {};
610
+ ue.defaultProps = {};
611
+ const Et = T("div")`
612
612
  .MuiChip-root {
613
613
  border-radius: 4px;
614
614
  height: initial;
@@ -617,159 +617,159 @@ const Ut = T("div")`
617
617
  padding: 4px 0;
618
618
  }
619
619
  `;
620
- function j({ label: e, icon: n, onDelete: r, ...l }) {
621
- return e ? /* @__PURE__ */ t(Ut, { ...l, children: /* @__PURE__ */ t(Pe, { color: "primary", "data-cy": "filter-tag", icon: n, label: e, onDelete: r }) }) : null;
620
+ function q({ label: e, icon: n, onDelete: r, ...a }) {
621
+ return e ? /* @__PURE__ */ t(Et, { ...a, children: /* @__PURE__ */ t(Ce, { color: "primary", "data-cy": "filter-tag", icon: n, label: e, onDelete: r }) }) : null;
622
622
  }
623
- j.propTypes = {
623
+ q.propTypes = {
624
624
  label: o.string,
625
625
  onDelete: o.func,
626
626
  icon: o.element
627
627
  };
628
- j.defaultProps = {
628
+ q.defaultProps = {
629
629
  onDelete: null,
630
630
  icon: null,
631
631
  label: null
632
632
  };
633
- function ke() {
633
+ function we() {
634
634
  const { t: e } = N();
635
- return /* @__PURE__ */ t($e, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
635
+ return /* @__PURE__ */ t(Re, { style: { textAlign: "center" }, variant: "subtitle2", children: e("blocklet.noResults") });
636
636
  }
637
- function V({ filterTip: e, keywordTip: n }) {
638
- const { t: r, locale: l } = N(), s = () => l === "zh" ? "、" : " , ";
639
- return /* @__PURE__ */ g(xt, { className: "tips", children: [
637
+ function X({ filterTip: e, keywordTip: n }) {
638
+ const { t: r, locale: a } = N(), s = () => a === "zh" ? "、" : " , ";
639
+ return /* @__PURE__ */ f(yt, { className: "tips", children: [
640
640
  /* @__PURE__ */ t("span", { style: { marginRight: "16px" }, children: r("blocklet.emptyTip") }),
641
641
  e && /* @__PURE__ */ t("span", { children: r("blocklet.filterTip") }),
642
642
  e && n && s(),
643
643
  n && /* @__PURE__ */ t("span", { children: r("blocklet.keywordTip") })
644
644
  ] });
645
645
  }
646
- V.propTypes = {
646
+ X.propTypes = {
647
647
  filterTip: o.bool,
648
648
  keywordTip: o.bool
649
649
  };
650
- V.defaultProps = {
650
+ X.defaultProps = {
651
651
  filterTip: !1,
652
652
  keywordTip: !1
653
653
  };
654
- function ee({ primaryStart: e, primaryEnd: n, filter: r }) {
655
- return /* @__PURE__ */ g($e, { variant: "subtitle2", children: [
654
+ function Z({ primaryStart: e, primaryEnd: n, filter: r }) {
655
+ return /* @__PURE__ */ f(Re, { variant: "subtitle2", children: [
656
656
  /* @__PURE__ */ t("span", { children: e }),
657
- /* @__PURE__ */ g("span", { className: "primary", children: [
657
+ /* @__PURE__ */ f("span", { className: "primary", children: [
658
658
  " ",
659
659
  r,
660
660
  " "
661
661
  ] }),
662
- /* @__PURE__ */ g("span", { children: [
662
+ /* @__PURE__ */ f("span", { children: [
663
663
  n,
664
664
  " "
665
665
  ] })
666
666
  ] });
667
667
  }
668
- ee.propTypes = {
668
+ Z.propTypes = {
669
669
  primaryStart: o.string.isRequired,
670
670
  primaryEnd: o.string.isRequired,
671
671
  filter: o.string.isRequired
672
672
  };
673
- function Wt(e) {
673
+ function qt(e) {
674
674
  return e ? e.width > 900 ? 12 : e.width > 600 ? 8 : 4 : 0;
675
675
  }
676
- function _e({ children: e }) {
677
- const n = Q(null), [r, l] = M(null), s = rt(r);
678
- return U(() => {
679
- r || l(n.current);
680
- }, [r]), e(n, Wt(s));
676
+ function ze({ children: e }) {
677
+ const n = J(null), [r, a] = E(null), s = Ze(r);
678
+ return j(() => {
679
+ r || a(n.current);
680
+ }, [r]), e(n, qt(s));
681
681
  }
682
- _e.propTypes = {
682
+ ze.propTypes = {
683
683
  children: o.func.isRequired
684
684
  };
685
- function me({ blocklets: e, ...n }) {
685
+ function pe({ blocklets: e, ...n }) {
686
686
  const {
687
687
  blockletRender: r,
688
- errors: l,
688
+ errors: a,
689
689
  loadings: s,
690
690
  selectedCategory: c,
691
691
  getCategoryLocale: x,
692
692
  filters: y,
693
- t: u,
693
+ t: p,
694
694
  hasNextPage: b,
695
- loadMore: p,
695
+ loadMore: d,
696
696
  endpoint: S
697
- } = N(), v = !!c || !!y.price, [C] = wt({
697
+ } = N(), v = !!c || !!y.price, [C] = gt({
698
698
  loading: s.fetchBlockletsLoading || s.loadingMore,
699
699
  hasNextPage: b,
700
- onLoadMore: p
700
+ onLoadMore: d
701
701
  });
702
- if (l.fetchBlockletsError)
702
+ if (a.fetchBlockletsError)
703
703
  return /* @__PURE__ */ t(
704
- Re,
704
+ Te,
705
705
  {
706
- error: new Error(`Failed to fetch blocklets from ${S}: ${l.fetchBlockletsError.message}`)
706
+ error: new Error(`Failed to fetch blocklets from ${S}: ${a.fetchBlockletsError.message}`)
707
707
  }
708
708
  );
709
709
  if (s.fetchBlockletsLoading)
710
- return /* @__PURE__ */ t(D, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ t(le, {}) });
710
+ return /* @__PURE__ */ t(D, { height: 60, display: "flex", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ t(oe, {}) });
711
711
  if (y.keyword && v && e.length === 0)
712
- return /* @__PURE__ */ g(Z, { children: [
712
+ return /* @__PURE__ */ f(Y, { children: [
713
713
  /* @__PURE__ */ t(
714
- ee,
714
+ Z,
715
715
  {
716
- primaryStart: u("blocklet.noBlockletPart1"),
717
- primaryEnd: u("blocklet.noBlockletPart2"),
716
+ primaryStart: p("blocklet.noBlockletPart1"),
717
+ primaryEnd: p("blocklet.noBlockletPart2"),
718
718
  filter: y.keyword
719
719
  }
720
720
  ),
721
- /* @__PURE__ */ t(V, { keywordTip: !0, filterTip: !0 })
721
+ /* @__PURE__ */ t(X, { keywordTip: !0, filterTip: !0 })
722
722
  ] });
723
723
  if (y.keyword && e.length === 0)
724
- return /* @__PURE__ */ g(Z, { children: [
724
+ return /* @__PURE__ */ f(Y, { children: [
725
725
  /* @__PURE__ */ t(
726
- ee,
726
+ Z,
727
727
  {
728
- primaryStart: u("blocklet.noBlockletPart1"),
729
- primaryEnd: u("blocklet.noBlockletPart2"),
728
+ primaryStart: p("blocklet.noBlockletPart1"),
729
+ primaryEnd: p("blocklet.noBlockletPart2"),
730
730
  filter: y.keyword
731
731
  }
732
732
  ),
733
- /* @__PURE__ */ t(V, { keywordTip: !0 })
733
+ /* @__PURE__ */ t(X, { keywordTip: !0 })
734
734
  ] });
735
735
  if (v && e.length === 0) {
736
- const R = x(c);
737
- return /* @__PURE__ */ g(Z, { children: [
738
- R ? /* @__PURE__ */ t(
739
- ee,
736
+ const P = x(c);
737
+ return /* @__PURE__ */ f(Y, { children: [
738
+ P ? /* @__PURE__ */ t(
739
+ Z,
740
740
  {
741
- primaryStart: u("blocklet.noCategoryResults1"),
742
- primaryEnd: u("blocklet.noCategoryResults2"),
743
- filter: R
741
+ primaryStart: p("blocklet.noCategoryResults1"),
742
+ primaryEnd: p("blocklet.noCategoryResults2"),
743
+ filter: P
744
744
  }
745
- ) : /* @__PURE__ */ t(ke, {}),
746
- /* @__PURE__ */ t(V, { filterTip: !0 })
745
+ ) : /* @__PURE__ */ t(we, {}),
746
+ /* @__PURE__ */ t(X, { filterTip: !0 })
747
747
  ] });
748
748
  }
749
- return e.length === 0 ? /* @__PURE__ */ t(Z, { children: /* @__PURE__ */ t(ke, {}) }) : /* @__PURE__ */ t(_e, { children: (R, B) => /* @__PURE__ */ g(
750
- oe,
749
+ return e.length === 0 ? /* @__PURE__ */ t(Y, { children: /* @__PURE__ */ t(we, {}) }) : /* @__PURE__ */ t(ze, { children: (P, R) => /* @__PURE__ */ f(
750
+ te,
751
751
  {
752
752
  ...n,
753
753
  container: !0,
754
754
  spacing: 2,
755
- columns: B,
755
+ columns: R,
756
756
  disableEqualOverflow: !0,
757
- ref: R,
757
+ ref: P,
758
758
  sx: {
759
- opacity: () => B > 0 ? 1 : 0
759
+ opacity: () => R > 0 ? 1 : 0
760
760
  },
761
761
  children: [
762
- e.map((i) => /* @__PURE__ */ t(oe, { xs: 4, "data-blocklet-did": i.did, children: r({ blocklet: i, blocklets: e }) }, i.did)),
763
- b && /* @__PURE__ */ t(oe, { xs: 12, ref: C, children: /* @__PURE__ */ t(D, { height: 60, display: "flex", justifyContent: "center", children: /* @__PURE__ */ t(le, {}) }) })
762
+ e.map((i) => /* @__PURE__ */ t(te, { xs: 4, "data-blocklet-did": i.did, children: r({ blocklet: i, blocklets: e }) }, i.did)),
763
+ b && /* @__PURE__ */ t(te, { xs: 12, ref: C, children: /* @__PURE__ */ t(D, { height: 60, display: "flex", justifyContent: "center", children: /* @__PURE__ */ t(oe, {}) }) })
764
764
  ]
765
765
  }
766
766
  ) });
767
767
  }
768
- me.propTypes = {
768
+ pe.propTypes = {
769
769
  blocklets: o.array.isRequired
770
770
  };
771
- me.defaultProps = {};
772
- const Z = T(bt)`
771
+ pe.defaultProps = {};
772
+ const Y = T(ft)`
773
773
  text-align: center;
774
774
  .primary {
775
775
  color: ${(e) => e.theme.palette.primary.main};
@@ -778,12 +778,12 @@ const Z = T(bt)`
778
778
  margin-top: ${(e) => e.theme.spacing(1)};
779
779
  }
780
780
  `;
781
- function he() {
782
- const { selectedCategory: e, handleCategory: n, t: r, handlePrice: l, filters: s, categoryOptions: c, priceOptions: x } = N();
783
- return /* @__PURE__ */ g(Gt, { children: [
784
- /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(W, { title: r("common.price"), options: x, value: s.price, onChange: l }) }),
781
+ function de() {
782
+ const { selectedCategory: e, handleCategory: n, t: r, handlePrice: a, filters: s, categoryOptions: c, priceOptions: x } = N();
783
+ return /* @__PURE__ */ f(jt, { children: [
784
+ /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(U, { title: r("common.price"), options: x, value: s.price, onChange: a }) }),
785
785
  c.length > 0 && /* @__PURE__ */ t("div", { style: { marginTop: "16px" }, children: /* @__PURE__ */ t(
786
- W,
786
+ U,
787
787
  {
788
788
  title: r("common.category"),
789
789
  options: c,
@@ -793,7 +793,7 @@ function he() {
793
793
  ) })
794
794
  ] });
795
795
  }
796
- const Gt = T("aside")`
796
+ const jt = T("aside")`
797
797
  width: 220px;
798
798
  margin-right: ${(e) => e.theme.spacing(2)};
799
799
  height: 100%;
@@ -802,41 +802,41 @@ const Gt = T("aside")`
802
802
  overflow-y: auto;
803
803
  z-index: auto;
804
804
  `;
805
- he.propTypes = {};
806
- he.defaultProps = {};
807
- function fe({ placeholder: e, ...n }) {
808
- const { filters: r, handleKeyword: l } = N(), [s, c] = M(r.keyword || ""), x = ot(l, { wait: 300 }), y = (b) => {
809
- const { value: p } = b.target;
810
- c(p), x.run(p);
811
- }, u = () => {
812
- c(""), l();
805
+ de.propTypes = {};
806
+ de.defaultProps = {};
807
+ function me({ placeholder: e, ...n }) {
808
+ const { filters: r, handleKeyword: a } = N(), [s, c] = E(r.keyword || ""), x = et(a, { wait: 300 }), y = (b) => {
809
+ const { value: d } = b.target;
810
+ c(d), x.run(d);
811
+ }, p = () => {
812
+ c(""), a();
813
813
  };
814
- return U(() => {
814
+ return j(() => {
815
815
  c(r.keyword || "");
816
816
  }, [r.keyword]), /* @__PURE__ */ t(
817
- Kt,
817
+ Ut,
818
818
  {
819
819
  inputProps: {
820
820
  "data-cy": "search-blocklet"
821
821
  },
822
- startAdornment: /* @__PURE__ */ t(be, { position: "start", children: /* @__PURE__ */ t(Ht, {}) }),
822
+ startAdornment: /* @__PURE__ */ t(ge, { position: "start", children: /* @__PURE__ */ t(Wt, {}) }),
823
823
  onChange: y,
824
824
  placeholder: e,
825
825
  value: s,
826
826
  title: e,
827
827
  "data-cy": "search",
828
- endAdornment: s && /* @__PURE__ */ t(be, { position: "end", children: /* @__PURE__ */ t(Qt, { "data-cy": "search-delete", onClick: u }) }),
828
+ endAdornment: s && /* @__PURE__ */ t(ge, { position: "end", children: /* @__PURE__ */ t(Gt, { "data-cy": "search-delete", onClick: p }) }),
829
829
  ...n
830
830
  }
831
831
  );
832
832
  }
833
- fe.propTypes = {
833
+ me.propTypes = {
834
834
  placeholder: o.string
835
835
  };
836
- fe.defaultProps = {
836
+ me.defaultProps = {
837
837
  placeholder: "Type to search..."
838
838
  };
839
- const Kt = T(Ge)`
839
+ const Ut = T(je)`
840
840
  background-color: ${(e) => e.theme.palette.grey[50]};
841
841
  font-size: 14px;
842
842
  border-radius: 6px;
@@ -853,21 +853,21 @@ const Kt = T(Ge)`
853
853
  color: transparent;
854
854
  }
855
855
  }
856
- `, Ht = T(kt)`
856
+ `, Wt = T(bt)`
857
857
  color: ${(e) => e.theme.palette.grey[500]};
858
858
  font-size: 28px;
859
859
  @media (max-width: ${(e) => e.theme.breakpoints.values.md}px) {
860
860
  font-size: 24px;
861
861
  }
862
- `, Qt = T(St)`
862
+ `, Gt = T(wt)`
863
863
  color: ${(e) => e.theme.palette.grey[500]};
864
864
  font-size: 16px;
865
865
  cursor: pointer;
866
866
  `;
867
- function ge({ onSelect: e, wrapChildren: n }) {
868
- const r = Q(null), l = Q(null), s = Q(null), { storeApi: c, blockletRender: x, filters: y, endpoint: u, handleKeyword: b, t: p } = N(), S = async (i) => {
869
- const { data: h } = await c.get(_.blockletsPath, { params: i }), d = h.dataList || [];
870
- return d.length > 0 && d.unshift({ type: "more-result", total: h.total || 0 }), d;
867
+ function he({ onSelect: e, wrapChildren: n }) {
868
+ const r = J(null), a = J(null), s = J(null), { storeApi: c, blockletRender: x, filters: y, endpoint: p, handleKeyword: b, t: d } = N(), S = async (i) => {
869
+ const { data: h } = await c.get(_.blockletsPath, { params: i }), m = h.dataList || [];
870
+ return m.length > 0 && m.unshift({ type: "more-result", total: h.total || 0 }), m;
871
871
  }, v = (i) => {
872
872
  b(i.state.query), i.setIsOpen(!1);
873
873
  }, C = () => {
@@ -875,27 +875,27 @@ function ge({ onSelect: e, wrapChildren: n }) {
875
875
  const i = r.current.querySelector("input.bl-autocomplete-input");
876
876
  i && i.focus();
877
877
  });
878
- }, R = (i) => {
878
+ }, P = (i) => {
879
879
  i.setIsOpen(!1), C();
880
- }, B = ({ prevState: i, state: h }) => {
880
+ }, R = ({ prevState: i, state: h }) => {
881
881
  i.query !== h.query && (h.query || b());
882
882
  };
883
- return Pt(
883
+ return St(
884
884
  "ctrl + k, command + k",
885
885
  (i) => (i.stopPropagation(), i.preventDefault(), C(), !1),
886
886
  { enableOnTags: ["INPUT"] }
887
- ), U(() => {
887
+ ), j(() => {
888
888
  C();
889
- }, [u]), U(() => {
889
+ }, [p]), j(() => {
890
890
  if (!r.current)
891
891
  return;
892
- const i = vt({
892
+ const i = kt({
893
893
  container: r.current,
894
- renderer: { createElement: Ye, Fragment: Ze, render: () => {
894
+ renderer: { createElement: Ve, Fragment: Je, render: () => {
895
895
  } },
896
- render({ children: h }, d) {
896
+ render({ children: h }, m) {
897
897
  var k;
898
- (!l.current || s.current !== d) && (s.current = d, (k = l.current) == null || k.unmount(), l.current = Ct(d)), l.current.render(n(h));
898
+ (!a.current || s.current !== m) && (s.current = m, (k = a.current) == null || k.unmount(), a.current = xt(m)), a.current.render(n(h));
899
899
  },
900
900
  autoFocus: !0,
901
901
  openOnFocus: !1,
@@ -909,35 +909,35 @@ function ge({ onSelect: e, wrapChildren: n }) {
909
909
  detachedContainer: "bl-autocomplete-detached-container"
910
910
  },
911
911
  translations: {
912
- clearButtonTitle: p("common.clear"),
913
- detachedCancelButtonText: p("common.cancel"),
914
- submitButtonTitle: p("common.search"),
915
- detachedSearchButtonTitle: p("common.search")
912
+ clearButtonTitle: d("common.clear"),
913
+ detachedCancelButtonText: d("common.cancel"),
914
+ submitButtonTitle: d("common.search"),
915
+ detachedSearchButtonTitle: d("common.search")
916
916
  },
917
- placeholder: p("common.searchStore"),
917
+ placeholder: d("common.searchStore"),
918
918
  initialState: {
919
919
  query: y.keyword
920
920
  },
921
921
  onStateChange(h) {
922
- B(h);
922
+ R(h);
923
923
  },
924
924
  onSubmit: v,
925
925
  onReset(h) {
926
- R(h);
926
+ P(h);
927
927
  },
928
- getSources({ query: h, state: d, ...k }) {
929
- const P = {
928
+ getSources({ query: h, state: m, ...k }) {
929
+ const $ = {
930
930
  ...y,
931
931
  sortBy: _[y.sortBy],
932
932
  page: 1,
933
933
  pageSize: 10,
934
934
  keyword: h
935
935
  };
936
- return Nt([
936
+ return zt([
937
937
  {
938
938
  sourceId: "blocklets",
939
939
  getItems() {
940
- return S(P);
940
+ return S($);
941
941
  },
942
942
  // 选中后填充 搜索框中值
943
943
  getItemInputValue({ item: w }) {
@@ -947,16 +947,16 @@ function ge({ onSelect: e, wrapChildren: n }) {
947
947
  onSelect({ event: w, item: L }) {
948
948
  return L.type === "more-result" ? (k.setIsOpen(!1), b(h)) : w.type === "keydown" ? b(L.title) : e({
949
949
  blocklet: L,
950
- detailUrl: it(u, `/blocklets/${L.did}`),
951
- storeUrl: u
950
+ detailUrl: nt(p, `/blocklets/${L.did}`),
951
+ storeUrl: p
952
952
  });
953
953
  },
954
954
  templates: {
955
955
  item({ item: w }) {
956
- return w.type === "more-result" ? /* @__PURE__ */ t("div", { children: p("autocomplete.expandResult", { name: h, number: w.total.toLocaleString() }) }) : x({ blocklet: w, autocompleteSetters: k });
956
+ return w.type === "more-result" ? /* @__PURE__ */ t("div", { children: d("autocomplete.expandResult", { name: h, number: w.total.toLocaleString() }) }) : x({ blocklet: w, autocompleteSetters: k });
957
957
  },
958
958
  noResults() {
959
- return p("blocklet.noResults");
959
+ return d("blocklet.noResults");
960
960
  }
961
961
  }
962
962
  }
@@ -966,11 +966,11 @@ function ge({ onSelect: e, wrapChildren: n }) {
966
966
  return () => {
967
967
  i.destroy();
968
968
  };
969
- }, [y, x]), /* @__PURE__ */ g(ie, { children: [
969
+ }, [y, x]), /* @__PURE__ */ f(le, { children: [
970
970
  /* @__PURE__ */ t(
971
- Se,
971
+ xe,
972
972
  {
973
- styles: Ce`
973
+ styles: ke`
974
974
  .bl-autocomplete-detached-container {
975
975
  .bl-autocomplete-detached-cancel {
976
976
  white-space: nowrap;
@@ -982,70 +982,70 @@ function ge({ onSelect: e, wrapChildren: n }) {
982
982
  /* @__PURE__ */ t("div", { className: "bl-search-container", ref: r })
983
983
  ] });
984
984
  }
985
- ge.propTypes = {
985
+ he.propTypes = {
986
986
  onSelect: o.func.isRequired,
987
987
  wrapChildren: o.func
988
988
  };
989
- ge.defaultProps = {
989
+ he.defaultProps = {
990
990
  wrapChildren: (e) => e
991
991
  };
992
- function ye({ t: e }) {
993
- const { filters: n, handleSwitchShowResources: r } = N(), l = () => {
992
+ function fe({ t: e }) {
993
+ const { filters: n, handleSwitchShowResources: r } = N(), a = () => {
994
994
  n.showResources = !n.showResources, r();
995
995
  };
996
996
  return /* @__PURE__ */ t(
997
- Tt,
997
+ Ct,
998
998
  {
999
999
  checked: n.showResources,
1000
- onChange: l,
1000
+ onChange: a,
1001
1001
  labelProps: {
1002
- label: /* @__PURE__ */ t(Te, { marginLeft: "8px", fontSize: "small", children: /* @__PURE__ */ t("span", { children: e("common.showResources") }) })
1002
+ label: /* @__PURE__ */ t(ve, { marginLeft: "8px", fontSize: "small", children: /* @__PURE__ */ t("span", { children: e("common.showResources") }) })
1003
1003
  }
1004
1004
  }
1005
1005
  );
1006
1006
  }
1007
- ye.propTypes = {
1007
+ fe.propTypes = {
1008
1008
  t: o.func.isRequired
1009
1009
  };
1010
- ye.defaultProps = {};
1011
- function Vt() {
1012
- var J, X;
1010
+ fe.defaultProps = {};
1011
+ function Kt() {
1012
+ var K, H;
1013
1013
  const {
1014
1014
  handleDeveloper: e,
1015
1015
  blockletList: n,
1016
1016
  filters: r,
1017
- developerName: l,
1017
+ developerName: a,
1018
1018
  handleSort: s,
1019
1019
  handleCategory: c,
1020
1020
  handlePrice: x,
1021
1021
  handleSearchSelect: y,
1022
- t: u,
1022
+ t: p,
1023
1023
  getCategoryLocale: b,
1024
- priceOptions: p,
1024
+ priceOptions: d,
1025
1025
  wrapChildren: S,
1026
1026
  showResourcesSwitch: v,
1027
1027
  showCategory: C,
1028
- baseSearch: R,
1029
- onFilterChange: B,
1028
+ baseSearch: P,
1029
+ onFilterChange: R,
1030
1030
  tagFilters: i
1031
- } = N(), h = Rt(u), d = ((J = h.find((m) => m.value === r.sortBy)) == null ? void 0 : J.name) || u("sort.sort"), k = b(r.category), { resourceType: P } = r || {}, w = (X = p.find((m) => m.value === r.price)) == null ? void 0 : X.name, [L, E] = M(!1), te = se(), re = ve(() => te.breakpoints.down("md")), O = Be({
1031
+ } = N(), h = vt(p), m = ((K = h.find((g) => g.value === r.sortBy)) == null ? void 0 : K.name) || p("sort.sort"), k = b(r.category), { resourceType: $ } = r || {}, w = (H = d.find((g) => g.value === r.price)) == null ? void 0 : H.name, [L, I] = E(!1), W = ae(), ee = Se(() => W.breakpoints.down("md")), O = Pe({
1032
1032
  chooseTagId: ""
1033
- }), F = nt((m) => {
1034
- O.chooseTagId = m.id, ["category", "resourceType", "resourceDid"].forEach((I) => {
1035
- typeof m.params[I] > "u" ? delete r[I] : r[I] = m.params[I];
1036
- }), B(r);
1037
- }), G = lt(() => i.find((m) => m.id === O.chooseTagId), [O.chooseTagId]);
1038
- return at(() => {
1039
- const m = st(window.location.search), q = i.find((I) => {
1040
- const K = I.params;
1041
- return K ? Object.keys(K).every((Y) => m[Y] === K[Y]) : !1;
1033
+ }), G = tt((g) => {
1034
+ O.chooseTagId = g.id, ["category", "resourceType", "resourceDid"].forEach((M) => {
1035
+ typeof g.params[M] > "u" ? delete r[M] : r[M] = g.params[M];
1036
+ }), R(r);
1037
+ }), F = rt(() => i.find((g) => g.id === O.chooseTagId), [O.chooseTagId]);
1038
+ return ot(() => {
1039
+ const g = lt(window.location.search), Q = i.find((M) => {
1040
+ const l = M.params;
1041
+ return l ? Object.keys(l).every((u) => g[u] === l[u]) : !1;
1042
1042
  });
1043
- q ? F(q) : i.length > 0 && F(i[0]);
1044
- }), /* @__PURE__ */ g(D, { display: "flex", alignItems: "flex-start", height: "100%", children: [
1045
- C ? /* @__PURE__ */ t(we, { mdDown: !0, children: /* @__PURE__ */ t(he, {}) }) : null,
1046
- /* @__PURE__ */ g(Jt, { children: [
1047
- /* @__PURE__ */ g(Xt, { children: [
1048
- /* @__PURE__ */ g(
1043
+ Q ? G(Q) : i.length > 0 && G(i[0]);
1044
+ }), /* @__PURE__ */ f(D, { display: "flex", alignItems: "flex-start", height: "100%", children: [
1045
+ C ? /* @__PURE__ */ t(ye, { mdDown: !0, children: /* @__PURE__ */ t(de, {}) }) : null,
1046
+ /* @__PURE__ */ f(Ht, { children: [
1047
+ /* @__PURE__ */ f(Qt, { children: [
1048
+ /* @__PURE__ */ f(
1049
1049
  D,
1050
1050
  {
1051
1051
  className: "filter-bar",
@@ -1062,7 +1062,7 @@ function Vt() {
1062
1062
  gap: 1
1063
1063
  },
1064
1064
  children: [
1065
- C ? /* @__PURE__ */ t(we, { mdUp: !0, children: /* @__PURE__ */ t(de, {}) }) : null,
1065
+ C ? /* @__PURE__ */ t(ye, { mdUp: !0, children: /* @__PURE__ */ t(ue, {}) }) : null,
1066
1066
  /* @__PURE__ */ t(
1067
1067
  "form",
1068
1068
  {
@@ -1071,29 +1071,29 @@ function Vt() {
1071
1071
  flex: 1,
1072
1072
  width: "100%"
1073
1073
  },
1074
- onSubmit: (m) => {
1075
- m.preventDefault(), m.stopPropagation();
1074
+ onSubmit: (g) => {
1075
+ g.preventDefault(), g.stopPropagation();
1076
1076
  },
1077
1077
  onFocus: () => {
1078
- E(!0);
1078
+ I(!0);
1079
1079
  },
1080
1080
  onBlur: () => {
1081
- E(!1);
1081
+ I(!1);
1082
1082
  },
1083
- children: R ? /* @__PURE__ */ t(fe, { className: "bl-search-container", placeholder: u("common.searchStore") }) : /* @__PURE__ */ t(ge, { onSelect: y, wrapChildren: S })
1083
+ children: P ? /* @__PURE__ */ t(me, { className: "bl-search-container", placeholder: p("common.searchStore") }) : /* @__PURE__ */ t(he, { onSelect: y, wrapChildren: S })
1084
1084
  }
1085
1085
  ),
1086
- /* @__PURE__ */ g(D, { className: "filter-container", display: "flex", alignItems: "center", children: [
1087
- !re && v && /* @__PURE__ */ t(D, { ml: 1, mr: 1, children: /* @__PURE__ */ t(ye, { t: u }) }),
1086
+ /* @__PURE__ */ f(D, { className: "filter-container", display: "flex", alignItems: "center", children: [
1087
+ !ee && v && /* @__PURE__ */ t(D, { ml: 1, mr: 1, children: /* @__PURE__ */ t(fe, { t: p }) }),
1088
1088
  /* @__PURE__ */ t(
1089
- pe,
1089
+ ce,
1090
1090
  {
1091
1091
  value: r.sortBy,
1092
1092
  options: h,
1093
- title: d,
1094
- icon: /* @__PURE__ */ t(Oe, {}),
1095
- onChange: (m) => {
1096
- s(m);
1093
+ title: m,
1094
+ icon: /* @__PURE__ */ t(_e, {}),
1095
+ onChange: (g) => {
1096
+ s(g);
1097
1097
  }
1098
1098
  }
1099
1099
  )
@@ -1101,19 +1101,19 @@ function Vt() {
1101
1101
  ]
1102
1102
  }
1103
1103
  ),
1104
- C ? /* @__PURE__ */ g(D, { display: "flex", flexWrap: "wrap", alignItems: "center", mb: "16px", children: [
1104
+ C ? /* @__PURE__ */ f(D, { display: "flex", flexWrap: "wrap", alignItems: "center", mb: "16px", children: [
1105
1105
  /* @__PURE__ */ t(
1106
- j,
1106
+ q,
1107
1107
  {
1108
- label: l,
1109
- icon: /* @__PURE__ */ t(He, {}),
1108
+ label: a,
1109
+ icon: /* @__PURE__ */ t(We, {}),
1110
1110
  onDelete: () => {
1111
1111
  e(null);
1112
1112
  }
1113
1113
  }
1114
1114
  ),
1115
1115
  /* @__PURE__ */ t(
1116
- j,
1116
+ q,
1117
1117
  {
1118
1118
  label: k,
1119
1119
  onDelete: () => {
@@ -1122,7 +1122,7 @@ function Vt() {
1122
1122
  }
1123
1123
  ),
1124
1124
  /* @__PURE__ */ t(
1125
- j,
1125
+ q,
1126
1126
  {
1127
1127
  label: w,
1128
1128
  onDelete: () => {
@@ -1130,30 +1130,30 @@ function Vt() {
1130
1130
  }
1131
1131
  }
1132
1132
  ),
1133
- P && /* @__PURE__ */ t(j, { label: `${u("common.resourceType")}: ${P}` })
1133
+ $ && /* @__PURE__ */ t(q, { label: `${p("common.resourceType")}: ${$}` })
1134
1134
  ] }) : null
1135
1135
  ] }),
1136
- /* @__PURE__ */ t(Qe, { FallbackComponent: Re, children: /* @__PURE__ */ g(D, { sx: { position: "relative", flex: 1, overflow: "auto" }, children: [
1137
- (i == null ? void 0 : i.length) > 0 ? /* @__PURE__ */ g(ie, { children: [
1138
- /* @__PURE__ */ t(Ke, { my: 1, direction: "row", spacing: 1.5, useFlexGap: !0, flexWrap: "wrap", justifyContent: "flex-start", children: i.map((m) => /* @__PURE__ */ t(
1139
- Pe,
1136
+ /* @__PURE__ */ t(Ge, { FallbackComponent: Te, children: /* @__PURE__ */ f(D, { sx: { position: "relative", flex: 1, overflow: "auto" }, children: [
1137
+ (i == null ? void 0 : i.length) > 0 ? /* @__PURE__ */ f(le, { children: [
1138
+ /* @__PURE__ */ t(Ue, { my: 1, direction: "row", spacing: 1.5, useFlexGap: !0, flexWrap: "wrap", justifyContent: "flex-start", children: i.map((g) => /* @__PURE__ */ t(
1139
+ Ce,
1140
1140
  {
1141
- label: m.title,
1141
+ label: g.title,
1142
1142
  size: "small",
1143
- variant: O.chooseTagId === m.id ? "contained" : "outlined",
1144
- onClick: () => F(m),
1145
- color: O.chooseTagId === m.id ? "primary" : "default"
1143
+ variant: O.chooseTagId === g.id ? "contained" : "outlined",
1144
+ onClick: () => G(g),
1145
+ color: O.chooseTagId === g.id ? "primary" : "default"
1146
1146
  },
1147
- m.id
1147
+ g.id
1148
1148
  )) }),
1149
- G ? /* @__PURE__ */ t(D, { mb: 2, children: G.description ? /* @__PURE__ */ t(Te, { variant: "body1", children: G.description }) : null }) : null
1149
+ F ? /* @__PURE__ */ t(D, { mb: 2, children: F.description ? /* @__PURE__ */ t(ve, { variant: "body1", children: F.description }) : null }) : null
1150
1150
  ] }) : null,
1151
- /* @__PURE__ */ t(me, { blocklets: n })
1151
+ /* @__PURE__ */ t(pe, { blocklets: n })
1152
1152
  ] }) })
1153
1153
  ] })
1154
1154
  ] });
1155
1155
  }
1156
- const Jt = T("main")`
1156
+ const Ht = T("main")`
1157
1157
  display: flex;
1158
1158
  flex-direction: column;
1159
1159
  flex: 1;
@@ -1191,15 +1191,15 @@ const Jt = T("main")`
1191
1191
  font-size: 12px;
1192
1192
  }
1193
1193
  }
1194
- `, Xt = T("div")`
1194
+ `, Qt = T("div")`
1195
1195
  position: sticky;
1196
1196
  top: 0;
1197
1197
  z-index: 9;
1198
1198
  background-color: white;
1199
1199
  `;
1200
- function Ne(e) {
1201
- const n = se(), r = Dt(n.palette.primary.main), l = {
1202
- autocomplete: Ce`
1200
+ function De(e) {
1201
+ const n = ae(), r = $t(n.palette.primary.main), a = {
1202
+ autocomplete: ke`
1203
1203
  :root {
1204
1204
  --aa-detached-media-query: (max-width: ${n.breakpoints.values.md}px) !important;
1205
1205
  --aa-detached-modal-media-query: (min-width: ${n.breakpoints.values.md}px) !important;
@@ -1237,13 +1237,13 @@ function Ne(e) {
1237
1237
  }
1238
1238
  `
1239
1239
  };
1240
- return /* @__PURE__ */ g(ce, { ...e, children: [
1241
- /* @__PURE__ */ t(Se, { styles: l.autocomplete }),
1242
- /* @__PURE__ */ t(Vt, {})
1240
+ return /* @__PURE__ */ f(ie, { ...e, children: [
1241
+ /* @__PURE__ */ t(xe, { styles: a.autocomplete }),
1242
+ /* @__PURE__ */ t(Kt, {})
1243
1243
  ] });
1244
1244
  }
1245
- Ne.propTypes = Ie;
1246
- Ne.defaultProps = ze;
1245
+ De.propTypes = Be;
1246
+ De.defaultProps = $e;
1247
1247
  export {
1248
- Ne as default
1248
+ De as default
1249
1249
  };