@blocklet/pages-kit-inner-components 0.6.2 → 0.6.4

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 (42) hide show
  1. package/lib/cjs/add-component.js +420 -1
  2. package/lib/cjs/chunks/draft-data-D44_IEV2.js +1 -0
  3. package/lib/cjs/chunks/home-BYk01EUy.js +39 -0
  4. package/lib/cjs/chunks/index-BRgYwvuv.js +475 -0
  5. package/lib/cjs/chunks/publish-button-C8XPA4g_.js +1 -0
  6. package/lib/cjs/chunks/session-BRtsDvA-.js +1 -0
  7. package/lib/cjs/chunks/site-state-BlQzwACl.js +57 -0
  8. package/lib/cjs/chunks/state-B6BF5wJ-.js +1 -0
  9. package/lib/cjs/components.js +1 -0
  10. package/lib/cjs/home.js +1 -1
  11. package/lib/cjs/locales.js +3 -0
  12. package/lib/cjs/project-html.js +4 -4
  13. package/lib/cjs/resources.js +1 -1
  14. package/lib/cjs/setting.js +11 -0
  15. package/lib/cjs/site-state.js +1 -0
  16. package/lib/cjs/theme.js +1 -0
  17. package/lib/cjs/uploader.js +1 -0
  18. package/lib/es/add-component.js +1089 -2
  19. package/lib/es/chunks/{draft-data-bRUHvvzp.js → draft-data-CafrGKeh.js} +4 -5
  20. package/lib/es/chunks/home-DW8SdyfO.js +594 -0
  21. package/lib/es/chunks/index-D5gXPe_7.js +2326 -0
  22. package/lib/es/chunks/{publish-button-Ceet-m88.js → publish-button-XSZrDaTQ.js} +140 -158
  23. package/lib/es/chunks/session-C72Dq8zg.js +19 -0
  24. package/lib/es/chunks/{site-state-Bh8guIeX.js → site-state-BdLTu3Od.js} +201 -170
  25. package/lib/es/chunks/state-0gvZF3k2.js +573 -0
  26. package/lib/es/components.js +24 -0
  27. package/lib/es/home.js +28 -3
  28. package/lib/es/locales.js +1032 -0
  29. package/lib/es/project-html.js +155 -79
  30. package/lib/es/resources.js +137 -93
  31. package/lib/es/setting.js +2294 -0
  32. package/lib/es/site-state.js +48 -0
  33. package/lib/es/theme.js +484 -0
  34. package/lib/es/uploader.js +8 -0
  35. package/package.json +3 -3
  36. package/lib/cjs/chunks/draft-data-CfIMszE7.js +0 -1
  37. package/lib/cjs/chunks/home-DUjl5PbP.js +0 -6
  38. package/lib/cjs/chunks/publish-button-C522nNv6.js +0 -1
  39. package/lib/cjs/chunks/site-state-DDXqWF74.js +0 -57
  40. package/lib/cjs/chunks/state-CtNs8GrN.js +0 -1
  41. package/lib/es/chunks/home-VWWdvIPQ.js +0 -69
  42. package/lib/es/chunks/state-BdNIIXJP.js +0 -502
@@ -1,44 +1,26 @@
1
- import { jsx as t, jsxs as u, Fragment as oe } from "react/jsx-runtime";
2
- import { g as ae, p as le, a as ce } from "./home-VWWdvIPQ.js";
1
+ import { jsx as t, jsxs as m, Fragment as oe } from "react/jsx-runtime";
2
+ import { u as ae, b as le } from "./state-0gvZF3k2.js";
3
3
  import { useLocaleContext as G } from "@arcblock/ux/lib/Locale/context";
4
4
  import q from "@arcblock/ux/lib/Toast";
5
- import { generateParamCombinations as de } from "@blocklet/pages-kit/utils/route";
6
- import { Warning as ue, Sync as _, VisibilityOff as ee, KeyboardArrowDown as me, KeyboardArrowRight as pe } from "@mui/icons-material";
5
+ import { generateParamCombinations as ce } from "@blocklet/pages-kit/utils/route";
6
+ import { Warning as de, Sync as _, VisibilityOff as ee, KeyboardArrowDown as me, KeyboardArrowRight as ue } from "@mui/icons-material";
7
7
  import { LoadingButton as te } from "@mui/lab";
8
- import { Box as f, CircularProgress as ge, createSvgIcon as he, Dialog as fe, DialogTitle as be, IconButton as xe, DialogContent as ye, DialogActions as we, Button as ke, Alert as Pe, List as Se, ListItem as M, ListItemButton as $, ListItemIcon as W, Checkbox as I, ListItemText as K, Tooltip as N, Collapse as De, Chip as Oe } from "@mui/material";
9
- import { produce as Ae } from "immer";
8
+ import { createSvgIcon as pe, Dialog as ge, DialogTitle as he, Box as b, IconButton as fe, DialogContent as be, DialogActions as xe, Button as ye, Alert as we, List as ke, ListItem as M, ListItemButton as $, ListItemIcon as W, Checkbox as K, ListItemText as N, Tooltip as I, Collapse as Se, Chip as Pe } from "@mui/material";
9
+ import { produce as De } from "immer";
10
10
  import Z from "lodash/difference";
11
- import { useState as D, useMemo as C, useCallback as O, useImperativeHandle as je, useEffect as L, useRef as ve } from "react";
12
- import { useAsync as Ce } from "react-use";
13
- import { u as ze } from "./state-BdNIIXJP.js";
14
- function Re(r) {
15
- return /* @__PURE__ */ t(
16
- f,
17
- {
18
- ...r,
19
- sx: [
20
- {
21
- display: "flex",
22
- flex: 1,
23
- height: "100%",
24
- alignItems: "center",
25
- justifyContent: "center"
26
- },
27
- ...Array.isArray(r.sx) ? r.sx : [r.sx]
28
- ],
29
- children: /* @__PURE__ */ t(ge, { size: 30 })
30
- }
31
- );
32
- }
33
- function Te(r) {
34
- const [m, g] = D(!1);
11
+ import { useState as D, useMemo as C, useCallback as O, useImperativeHandle as Oe, useEffect as E, useRef as Ae } from "react";
12
+ import { useAsync as je } from "react-use";
13
+ import { L as ve } from "./home-DW8SdyfO.js";
14
+ import { p as Ce, g as Re } from "./index-D5gXPe_7.js";
15
+ function ze(s) {
16
+ const [u, g] = D(!1);
35
17
  return /* @__PURE__ */ t(
36
18
  te,
37
19
  {
38
- ...r,
39
- loading: r.loading || m,
20
+ ...s,
21
+ loading: s.loading || u,
40
22
  onClick: (a) => {
41
- const d = r.onClick?.(a);
23
+ const d = s.onClick?.(a);
42
24
  d instanceof Promise && (g(!0), d.finally(() => {
43
25
  g(!1);
44
26
  }));
@@ -46,8 +28,8 @@ function Te(r) {
46
28
  }
47
29
  );
48
30
  }
49
- const Be = he(
50
- /* @__PURE__ */ u("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
31
+ const Te = pe(
32
+ /* @__PURE__ */ m("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
51
33
  /* @__PURE__ */ t(
52
34
  "path",
53
35
  {
@@ -71,57 +53,57 @@ const Be = he(
71
53
  ] }),
72
54
  "Close"
73
55
  );
74
- function Ee() {
75
- const [r, m] = D(), g = C(() => r ? /* @__PURE__ */ t(fe, { ...r }) : null, [r]), a = O(() => {
76
- m(void 0);
56
+ function Le() {
57
+ const [s, u] = D(), g = C(() => s ? /* @__PURE__ */ t(ge, { ...s }) : null, [s]), a = O(() => {
58
+ u(void 0);
77
59
  }, []), d = O(
78
60
  ({
79
61
  title: y,
80
62
  content: c,
81
63
  cancelText: A = "Cancel",
82
- okText: b = "Ok",
64
+ okText: f = "Ok",
83
65
  onOk: w,
84
66
  onClose: l,
85
- okIcon: z,
67
+ okIcon: R,
86
68
  okColor: k = "primary",
87
69
  cancelColor: h = "primary",
88
- DialogContentProps: E,
70
+ DialogContentProps: B,
89
71
  form: F,
90
72
  ...H
91
73
  }) => {
92
- m({
74
+ u({
93
75
  ...H,
94
76
  open: !0,
95
- children: /* @__PURE__ */ u("form", { onSubmit: (R) => R.preventDefault(), children: [
96
- y && /* @__PURE__ */ u(
97
- be,
77
+ children: /* @__PURE__ */ m("form", { onSubmit: (z) => z.preventDefault(), children: [
78
+ y && /* @__PURE__ */ m(
79
+ he,
98
80
  {
99
81
  className: "between",
100
82
  zIndex: "appBar",
101
83
  bgcolor: "background.paper",
102
- sx: { borderBottom: (R) => `1px solid ${R.palette.divider}` },
84
+ sx: { borderBottom: (z) => `1px solid ${z.palette.divider}` },
103
85
  children: [
104
- /* @__PURE__ */ t(f, { children: y }),
86
+ /* @__PURE__ */ t(b, { children: y }),
105
87
  /* @__PURE__ */ t(
106
- xe,
88
+ fe,
107
89
  {
108
90
  size: "small",
109
91
  onClick: async () => {
110
92
  a(), l?.();
111
93
  },
112
- children: /* @__PURE__ */ t(Be, {})
94
+ children: /* @__PURE__ */ t(Te, {})
113
95
  }
114
96
  )
115
97
  ]
116
98
  }
117
99
  ),
118
100
  c && /* @__PURE__ */ t(
119
- ye,
101
+ be,
120
102
  {
121
- ...E,
122
- sx: { mt: -3, ...E?.sx, bgcolor: "background.paper" },
103
+ ...B,
104
+ sx: { mt: -3, ...B?.sx, bgcolor: "background.paper" },
123
105
  children: /* @__PURE__ */ t(
124
- f,
106
+ b,
125
107
  {
126
108
  sx: {
127
109
  pt: 3
@@ -131,20 +113,20 @@ function Ee() {
131
113
  )
132
114
  }
133
115
  ),
134
- /* @__PURE__ */ u(we, { sx: { bgcolor: "background.paper" }, children: [
135
- /* @__PURE__ */ t(ke, { variant: "outlined", color: h || "primary", onClick: l ?? a, children: A }),
116
+ /* @__PURE__ */ m(xe, { sx: { bgcolor: "background.paper" }, children: [
117
+ /* @__PURE__ */ t(ye, { variant: "outlined", color: h || "primary", onClick: l ?? a, children: A }),
136
118
  /* @__PURE__ */ t(
137
- Te,
119
+ ze,
138
120
  {
139
121
  variant: "contained",
140
122
  color: k || "primary",
141
- startIcon: z,
142
- loadingPosition: z ? "start" : "center",
123
+ startIcon: R,
124
+ loadingPosition: R ? "start" : "center",
143
125
  onClick: async () => {
144
126
  await w?.(), a();
145
127
  },
146
128
  type: "submit",
147
- children: b
129
+ children: f
148
130
  }
149
131
  )
150
132
  ] })
@@ -157,19 +139,19 @@ function Ee() {
157
139
  return { dialog: g, showDialog: d, closeDialog: a };
158
140
  }
159
141
  const Xe = ({
160
- ref: r,
161
- mode: m,
142
+ ref: s,
143
+ mode: u,
162
144
  state: g
163
145
  }) => {
164
- const { t: a } = G(), [d, y] = D(!1), { dialog: c, showDialog: A } = Ee(), b = ze(), w = O(
165
- (z) => {
146
+ const { t: a } = G(), [d, y] = D(!1), { dialog: c, showDialog: A } = Le(), f = ae(), w = O(
147
+ (R) => {
166
148
  let k = [];
167
149
  A({
168
150
  title: a("maker.publishToProduction"),
169
- content: /* @__PURE__ */ u(f, { sx: { minWidth: 300 }, children: [
170
- /* @__PURE__ */ t(Pe, { color: "warning", icon: /* @__PURE__ */ t(ue, {}), children: a("maker.publishToProductionTip") }),
151
+ content: /* @__PURE__ */ m(b, { sx: { minWidth: 300 }, children: [
152
+ /* @__PURE__ */ t(we, { color: "warning", icon: /* @__PURE__ */ t(de, {}), children: a("maker.publishToProductionTip") }),
171
153
  /* @__PURE__ */ t(
172
- f,
154
+ b,
173
155
  {
174
156
  sx: {
175
157
  maxHeight: "50vh",
@@ -177,12 +159,12 @@ const Xe = ({
177
159
  mt: 2
178
160
  },
179
161
  children: /* @__PURE__ */ t(
180
- Me,
162
+ Ee,
181
163
  {
182
164
  state: g,
183
- toMode: m,
165
+ toMode: u,
184
166
  onChange: (h) => k = h,
185
- defaultRouteIds: z
167
+ defaultRouteIds: R
186
168
  }
187
169
  )
188
170
  }
@@ -195,9 +177,9 @@ const Xe = ({
195
177
  const h = a("maker.publishSelectPagesMessage");
196
178
  throw q.error(h), new Error(h);
197
179
  }
198
- localStorage.setItem(ae(b ?? ""), String((/* @__PURE__ */ new Date()).getTime())), y(!0);
180
+ localStorage.setItem(le(f ?? ""), String((/* @__PURE__ */ new Date()).getTime())), y(!0);
199
181
  try {
200
- await le({ mode: m, routes: k }), q.success(a("maker.publishSuccessMessage"));
182
+ await Ce({ mode: u, routes: k }), q.success(a("maker.publishSuccessMessage"));
201
183
  } catch (h) {
202
184
  throw q.error(h.message), h;
203
185
  } finally {
@@ -206,15 +188,15 @@ const Xe = ({
206
188
  }
207
189
  });
208
190
  },
209
- [m, g, a, b, A]
191
+ [u, g, a, f, A]
210
192
  );
211
- je(r, () => ({
193
+ Oe(s, () => ({
212
194
  openPublishDialog: w
213
195
  }));
214
196
  const l = O(() => {
215
197
  w();
216
198
  }, [w]);
217
- return /* @__PURE__ */ u(oe, { children: [
199
+ return /* @__PURE__ */ m(oe, { children: [
218
200
  /* @__PURE__ */ t(
219
201
  te,
220
202
  {
@@ -231,20 +213,20 @@ const Xe = ({
231
213
  c
232
214
  ] });
233
215
  };
234
- function Le({
235
- routePathInfo: r,
236
- checked: m,
216
+ function Be({
217
+ routePathInfo: s,
218
+ checked: u,
237
219
  onClick: g,
238
220
  route: a
239
221
  }) {
240
- const { t: d } = G(), y = !r.routeMetaData?.publishedAt || r.routeMetaData?.updatedAt && new Date(r.routeMetaData?.updatedAt) > new Date(r.routeMetaData?.publishedAt);
222
+ const { t: d } = G(), y = !s.routeMetaData?.publishedAt || s.routeMetaData?.updatedAt && new Date(s.routeMetaData?.updatedAt) > new Date(s.routeMetaData?.publishedAt);
241
223
  return /* @__PURE__ */ t(
242
224
  M,
243
225
  {
244
226
  sx: { pl: 4, pr: 3 },
245
227
  disablePadding: !0,
246
- secondaryAction: /* @__PURE__ */ u(
247
- f,
228
+ secondaryAction: /* @__PURE__ */ m(
229
+ b,
248
230
  {
249
231
  sx: {
250
232
  display: "flex",
@@ -253,7 +235,7 @@ function Le({
253
235
  },
254
236
  children: [
255
237
  y && /* @__PURE__ */ t(
256
- f,
238
+ b,
257
239
  {
258
240
  className: "visible",
259
241
  title: d("maker.pages.needPublish"),
@@ -263,28 +245,28 @@ function Le({
263
245
  display: "flex",
264
246
  alignItems: "center"
265
247
  },
266
- children: /* @__PURE__ */ t(N, { title: d("maker.pages.needPublish"), children: /* @__PURE__ */ t(_, { fontSize: "small", sx: { fontSize: "16px" } }) })
248
+ children: /* @__PURE__ */ t(I, { title: d("maker.pages.needPublish"), children: /* @__PURE__ */ t(_, { fontSize: "small", sx: { fontSize: "16px" } }) })
267
249
  }
268
250
  ),
269
- (!r.routeMetaData?.isPublic || !a.isPublic) && /* @__PURE__ */ t(
270
- f,
251
+ (!s.routeMetaData?.isPublic || !a.isPublic) && /* @__PURE__ */ t(
252
+ b,
271
253
  {
272
254
  className: "visible",
273
255
  sx: {
274
256
  color: "warning.main"
275
257
  },
276
- children: /* @__PURE__ */ t(N, { title: d("maker.pages.notPublic"), children: /* @__PURE__ */ t(ee, { fontSize: "small", sx: { fontSize: "16px" } }) })
258
+ children: /* @__PURE__ */ t(I, { title: d("maker.pages.notPublic"), children: /* @__PURE__ */ t(ee, { fontSize: "small", sx: { fontSize: "16px" } }) })
277
259
  }
278
260
  )
279
261
  ]
280
262
  }
281
263
  ),
282
- children: /* @__PURE__ */ u($, { onClick: g, dense: !0, children: [
283
- /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(I, { edge: "start", checked: m, tabIndex: -1 }) }),
264
+ children: /* @__PURE__ */ m($, { onClick: g, dense: !0, children: [
265
+ /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(K, { edge: "start", checked: u, tabIndex: -1 }) }),
284
266
  /* @__PURE__ */ t(
285
- K,
267
+ N,
286
268
  {
287
- primary: r.path,
269
+ primary: s.path,
288
270
  slotProps: {
289
271
  primary: {
290
272
  fontSize: "0.8rem",
@@ -301,23 +283,23 @@ function Le({
301
283
  }
302
284
  );
303
285
  }
304
- function Me({
305
- state: r,
306
- toMode: m,
286
+ function Ee({
287
+ state: s,
288
+ toMode: u,
307
289
  onChange: g,
308
290
  defaultRouteIds: a
309
291
  }) {
310
- const { t: d, locale: y } = G(), [c, A] = D(!1), [b, w] = D(
292
+ const { t: d, locale: y } = G(), [c, A] = D(!1), [f, w] = D(
311
293
  () => a ? Object.fromEntries(a.filter((e) => !e.includes("-")).map((e) => [e, !0])) : {}
312
- ), [l, z] = D({}), [k, h] = D(
294
+ ), [l, R] = D({}), [k, h] = D(
313
295
  () => a ? Object.fromEntries(a.filter((e) => e.includes("-")).map((e) => [e, !0])) : {}
314
- ), [E, F] = D({}), { loading: H, error: R, value: P } = Ce(() => ce({ mode: m }), [m]);
315
- if (R)
316
- throw R;
317
- const x = C(() => r.routeIds || [], [r]), J = C(() => P?.pageIds || [], [P]), j = C(() => !x || !r.routes ? [] : JSON.parse(JSON.stringify(x)).sort((n, i) => {
318
- const s = r.routes?.[n], o = r.routes?.[i];
319
- return s?.publishedAt && new Date(s.publishedAt).getTime() < new Date(s.updatedAt).getTime() ? -1 : o?.publishedAt && new Date(o.publishedAt).getTime() < new Date(o.updatedAt).getTime() ? 1 : new Date(s?.updatedAt ?? "").getTime() - new Date(o?.updatedAt ?? "").getTime();
320
- }), [r, x]), V = C(() => {
296
+ ), [B, F] = D({}), { loading: H, error: z, value: S } = je(() => Re({ mode: u }), [u]);
297
+ if (z)
298
+ throw z;
299
+ const x = C(() => s.routeIds || [], [s]), J = C(() => S?.pageIds || [], [S]), j = C(() => !x || !s.routes ? [] : JSON.parse(JSON.stringify(x)).sort((n, i) => {
300
+ const r = s.routes?.[n], o = s.routes?.[i];
301
+ return r?.publishedAt && new Date(r.publishedAt).getTime() < new Date(r.updatedAt).getTime() ? -1 : o?.publishedAt && new Date(o.publishedAt).getTime() < new Date(o.updatedAt).getTime() ? 1 : new Date(r?.updatedAt ?? "").getTime() - new Date(o?.updatedAt ?? "").getTime();
302
+ }), [s, x]), V = C(() => {
321
303
  if (!j) return [];
322
304
  if (!l) return j;
323
305
  const e = [...j].filter((n) => !l[n]);
@@ -327,17 +309,17 @@ function Me({
327
309
  });
328
310
  }), e;
329
311
  }, [j, l]), v = C(
330
- () => !P || !J || !V ? [] : Z(J, V),
331
- [V, P, J]
332
- ), B = C(
312
+ () => !S || !J || !V ? [] : Z(J, V),
313
+ [V, S, J]
314
+ ), L = C(
333
315
  () => x ? [...x].concat(v) : v,
334
316
  [x, v]
335
317
  ), Q = O(() => {
336
318
  const e = {};
337
319
  j?.forEach((n) => {
338
- const i = r.routes?.[n];
320
+ const i = s.routes?.[n];
339
321
  if (i && i.params && i.params.length > 0 && i.paramsOptions && i.paramsOptions.length > 0) {
340
- const s = de({
322
+ const r = ce({
341
323
  basePath: i.path,
342
324
  params: i.params,
343
325
  routeId: i.id,
@@ -347,13 +329,13 @@ function Me({
347
329
  currentOptionIds: [],
348
330
  result: []
349
331
  });
350
- s.length > 0 && (e[i.id] = s);
332
+ r.length > 0 && (e[i.id] = r);
351
333
  }
352
- }), z(e);
353
- }, [j, r.routes]);
354
- L(() => {
334
+ }), R(e);
335
+ }, [j, s.routes]);
336
+ E(() => {
355
337
  Q();
356
- }, [Q]), L(() => {
338
+ }, [Q]), E(() => {
357
339
  F((e) => {
358
340
  const n = { ...e };
359
341
  return Object.keys(l).forEach((i) => {
@@ -361,51 +343,51 @@ function Me({
361
343
  }), n;
362
344
  });
363
345
  }, [l]);
364
- const U = ve(!0);
365
- L(() => {
346
+ const U = Ae(!0);
347
+ E(() => {
366
348
  h((e) => {
367
349
  const n = { ...e };
368
350
  return Object.keys(l).length === 0 || (Object.keys(l).forEach((i) => {
369
- const s = l[i] || [], o = c || !!b[i];
370
- s.forEach((T) => {
351
+ const r = l[i] || [], o = c || !!f[i];
352
+ r.forEach((T) => {
371
353
  const p = `${i}-${T.paramOptionIds.join("-")}`;
372
354
  U.current ? n[p] = o || e[p] || !1 : n[p] = o;
373
355
  });
374
356
  }), U.current = !1), n;
375
357
  });
376
- }, [b, l, c]);
358
+ }, [f, l, c]);
377
359
  const ne = (e, n) => {
378
360
  n.stopPropagation(), F((i) => {
379
- const s = { ...i };
380
- return s[e] = !s[e], s;
361
+ const r = { ...i };
362
+ return r[e] = !r[e], r;
381
363
  });
382
364
  }, X = O(
383
365
  (e) => {
384
366
  w((n) => {
385
- const i = Ae(n, (s) => {
386
- c ? (Object.assign(s, Object.fromEntries(B.map((o) => [o, !0]))), delete s[e]) : s[e] ? (delete s[e], v.includes(e) && (x || []).filter((o) => r.pages[o]?.slug === P?.pages[e]?.slug).forEach((o) => {
387
- delete s[o];
388
- })) : (s[e] = !0, x && x.includes(e) && v.filter((o) => P?.pages[o]?.slug === r.pages[e]?.slug).forEach((o) => {
389
- s[o] = !0;
367
+ const i = De(n, (r) => {
368
+ c ? (Object.assign(r, Object.fromEntries(L.map((o) => [o, !0]))), delete r[e]) : r[e] ? (delete r[e], v.includes(e) && (x || []).filter((o) => s.pages[o]?.slug === S?.pages[e]?.slug).forEach((o) => {
369
+ delete r[o];
370
+ })) : (r[e] = !0, x && x.includes(e) && v.filter((o) => S?.pages[o]?.slug === s.pages[e]?.slug).forEach((o) => {
371
+ r[o] = !0;
390
372
  }));
391
373
  });
392
- return A(Z(B, Object.keys(i)).length === 0), i;
374
+ return A(Z(L, Object.keys(i)).length === 0), i;
393
375
  });
394
376
  },
395
- [c, B, v, r, P, x]
377
+ [c, L, v, s, S, x]
396
378
  ), ie = O(
397
379
  (e, n) => {
398
380
  const i = `${e}-${n.paramOptionIds.join("-")}`;
399
- h((s) => {
400
- const o = { ...s };
381
+ h((r) => {
382
+ const o = { ...r };
401
383
  o[i] = !o[i];
402
384
  const T = l[e]?.every((p) => o[`${e}-${p.paramOptionIds.join("-")}`]) ?? !1;
403
385
  return w((p) => {
404
386
  if (T && !p[e])
405
387
  return { ...p, [e]: !0 };
406
388
  if (!T && p[e]) {
407
- const S = { ...p };
408
- return delete S[e], S;
389
+ const P = { ...p };
390
+ return delete P[e], P;
409
391
  }
410
392
  return p;
411
393
  }), o;
@@ -415,19 +397,19 @@ function Me({
415
397
  ), re = O(() => {
416
398
  A((e) => (e && w({}), !e));
417
399
  }, []);
418
- return L(() => {
419
- const e = c ? B : Object.keys(b), n = Object.entries(k).filter(([, s]) => s).map(([s]) => s).filter((s) => s !== void 0), i = Array.from(/* @__PURE__ */ new Set([...e, ...n]));
400
+ return E(() => {
401
+ const e = c ? L : Object.keys(f), n = Object.entries(k).filter(([, r]) => r).map(([r]) => r).filter((r) => r !== void 0), i = Array.from(/* @__PURE__ */ new Set([...e, ...n]));
420
402
  g(c ? null : i);
421
- }, [c, b, k, B, g]), H ? /* @__PURE__ */ t(Re, { sx: { my: 4 } }) : /* @__PURE__ */ u(Se, { disablePadding: !0, sx: { maxWidth: 700 }, children: [
422
- /* @__PURE__ */ t(M, { sx: { position: "sticky", top: 0, zIndex: 1 }, disablePadding: !0, children: /* @__PURE__ */ u($, { onClick: re, dense: !0, children: [
423
- /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(I, { edge: "start", checked: c, tabIndex: -1 }) }),
424
- /* @__PURE__ */ t(K, { primary: d("common.all") })
403
+ }, [c, f, k, L, g]), H ? /* @__PURE__ */ t(ve, { sx: { my: 4 } }) : /* @__PURE__ */ m(ke, { disablePadding: !0, sx: { maxWidth: 700 }, children: [
404
+ /* @__PURE__ */ t(M, { sx: { position: "sticky", top: 0, zIndex: 1 }, disablePadding: !0, children: /* @__PURE__ */ m($, { onClick: re, dense: !0, children: [
405
+ /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(K, { edge: "start", checked: c, tabIndex: -1 }) }),
406
+ /* @__PURE__ */ t(N, { primary: d("common.all") })
425
407
  ] }) }),
426
408
  j.map((e) => {
427
- const n = r.routes?.[e];
409
+ const n = s.routes?.[e];
428
410
  if (!n) return null;
429
- const i = !1, s = l && l[e] && l[e]?.length > 0, o = E[e] !== !1, T = l[e] || [], p = !n.publishedAt || n.updatedAt && new Date(n.updatedAt).getTime() > new Date(n.publishedAt).getTime();
430
- return /* @__PURE__ */ u(f, { children: [
411
+ const i = !1, r = l && l[e] && l[e]?.length > 0, o = B[e] !== !1, T = l[e] || [], p = !n.publishedAt || n.updatedAt && new Date(n.updatedAt).getTime() > new Date(n.publishedAt).getTime();
412
+ return /* @__PURE__ */ m(b, { children: [
431
413
  /* @__PURE__ */ t(
432
414
  M,
433
415
  {
@@ -435,14 +417,14 @@ function Me({
435
417
  pr: 4
436
418
  },
437
419
  disablePadding: !0,
438
- secondaryAction: /* @__PURE__ */ u(f, { sx: { display: "flex", alignItems: "center" }, children: [
439
- p && /* @__PURE__ */ t(N, { title: d("maker.pages.needPublish"), children: /* @__PURE__ */ t(_, { fontSize: "small", sx: { color: "warning.main", fontSize: 16, mr: 0.35 } }) }),
440
- !n.isPublic && /* @__PURE__ */ t(N, { title: d("maker.pages.notPublic"), children: /* @__PURE__ */ t(ee, { fontSize: "small", sx: { color: "warning.main", fontSize: 16, mr: 0.35 } }) }),
420
+ secondaryAction: /* @__PURE__ */ m(b, { sx: { display: "flex", alignItems: "center" }, children: [
421
+ p && /* @__PURE__ */ t(I, { title: d("maker.pages.needPublish"), children: /* @__PURE__ */ t(_, { fontSize: "small", sx: { color: "warning.main", fontSize: 16, mr: 0.35 } }) }),
422
+ !n.isPublic && /* @__PURE__ */ t(I, { title: d("maker.pages.notPublic"), children: /* @__PURE__ */ t(ee, { fontSize: "small", sx: { color: "warning.main", fontSize: 16, mr: 0.35 } }) }),
441
423
  i,
442
- s && /* @__PURE__ */ t(
443
- f,
424
+ r && /* @__PURE__ */ t(
425
+ b,
444
426
  {
445
- onClick: (S) => ne(e, S),
427
+ onClick: (P) => ne(e, P),
446
428
  sx: {
447
429
  display: "inline-flex",
448
430
  alignItems: "center",
@@ -450,14 +432,14 @@ function Me({
450
432
  cursor: "pointer",
451
433
  color: "info.main"
452
434
  },
453
- children: o ? /* @__PURE__ */ t(me, { fontSize: "small", sx: { fontSize: "18px" } }) : /* @__PURE__ */ t(pe, { fontSize: "small", sx: { fontSize: "18px" } })
435
+ children: o ? /* @__PURE__ */ t(me, { fontSize: "small", sx: { fontSize: "18px" } }) : /* @__PURE__ */ t(ue, { fontSize: "small", sx: { fontSize: "18px" } })
454
436
  }
455
437
  )
456
438
  ] }),
457
- children: /* @__PURE__ */ u($, { onClick: () => X(e), dense: !0, children: [
458
- /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(I, { edge: "start", checked: c || !!b[e], tabIndex: -1 }) }),
439
+ children: /* @__PURE__ */ m($, { onClick: () => X(e), dense: !0, children: [
440
+ /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(K, { edge: "start", checked: c || !!f[e], tabIndex: -1 }) }),
459
441
  /* @__PURE__ */ t(
460
- K,
442
+ N,
461
443
  {
462
444
  primary: n.path,
463
445
  slotProps: {
@@ -469,14 +451,14 @@ function Me({
469
451
  ] })
470
452
  }
471
453
  ),
472
- s && /* @__PURE__ */ t(De, { in: o, children: /* @__PURE__ */ t(f, { children: T.map((S) => {
473
- const Y = `${e}-${S.paramOptionIds.join("-")}`, se = k[Y] || !1;
454
+ r && /* @__PURE__ */ t(Se, { in: o, children: /* @__PURE__ */ t(b, { children: T.map((P) => {
455
+ const Y = `${e}-${P.paramOptionIds.join("-")}`, se = k[Y] || !1;
474
456
  return /* @__PURE__ */ t(
475
- Le,
457
+ Be,
476
458
  {
477
- routePathInfo: S,
459
+ routePathInfo: P,
478
460
  checked: c || se,
479
- onClick: () => ie(e, S),
461
+ onClick: () => ie(e, P),
480
462
  route: n
481
463
  },
482
464
  Y
@@ -485,16 +467,16 @@ function Me({
485
467
  ] }, e);
486
468
  }),
487
469
  v.map((e) => {
488
- const n = P?.pages[e];
470
+ const n = S?.pages[e];
489
471
  return n ? /* @__PURE__ */ t(
490
472
  M,
491
473
  {
492
474
  disablePadding: !0,
493
- secondaryAction: /* @__PURE__ */ t(Oe, { color: "warning", label: "deleted", size: "small" }),
494
- children: /* @__PURE__ */ u($, { onClick: () => X(e), dense: !0, children: [
495
- /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(I, { edge: "start", checked: c || !!b[e], tabIndex: -1 }) }),
475
+ secondaryAction: /* @__PURE__ */ t(Pe, { color: "warning", label: "deleted", size: "small" }),
476
+ children: /* @__PURE__ */ m($, { onClick: () => X(e), dense: !0, children: [
477
+ /* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(K, { edge: "start", checked: c || !!f[e], tabIndex: -1 }) }),
496
478
  /* @__PURE__ */ t(
497
- K,
479
+ N,
498
480
  {
499
481
  primary: n.slug,
500
482
  secondary: n.locales?.[y]?.title,
@@ -0,0 +1,19 @@
1
+ import { createAuthServiceSessionContext as t } from "@arcblock/did-connect/lib/Session";
2
+ import { useContext as i } from "react";
3
+ const { SessionProvider: l, SessionContext: r, SessionConsumer: S, withSession: f } = t();
4
+ function n() {
5
+ return i(r);
6
+ }
7
+ function u(...e) {
8
+ const { session: s } = n();
9
+ return e.includes(s.user?.role);
10
+ }
11
+ function m(...e) {
12
+ const { session: s } = n(), o = u(...e);
13
+ return window.blocklet?.tenantMode === "multiple" ? !!s.user : o;
14
+ }
15
+ export {
16
+ l as S,
17
+ m as a,
18
+ n as u
19
+ };