@blocklet/list 0.12.100 → 0.12.102

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