@iowas/toolpad 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2225 @@
1
+ 'use strict';
2
+
3
+ var chunkSWAF5R4Y_js = require('./chunk-SWAF5R4Y.js');
4
+ var chunkBN55HN4U_js = require('./chunk-BN55HN4U.js');
5
+ var chunk5B2NQDIH_js = require('./chunk-5B2NQDIH.js');
6
+ var React16 = require('react');
7
+ var PropTypes9 = require('prop-types');
8
+ var Popover = require('@mui/material/Popover');
9
+ var Divider = require('@mui/material/Divider');
10
+ var Stack = require('@mui/material/Stack');
11
+ var Button = require('@mui/material/Button');
12
+ var Dialog = require('@mui/material/Dialog');
13
+ var DialogTitle = require('@mui/material/DialogTitle');
14
+ var DialogContent = require('@mui/material/DialogContent');
15
+ var DialogActions = require('@mui/material/DialogActions');
16
+ var TextField = require('@mui/material/TextField');
17
+ var DialogContentText = require('@mui/material/DialogContentText');
18
+ var invariant = require('invariant');
19
+ var useEventCallback = require('@mui/utils/useEventCallback');
20
+ var jsxRuntime = require('react/jsx-runtime');
21
+ var LogoutIcon = require('@mui/icons-material/Logout');
22
+ var Avatar = require('@mui/material/Avatar');
23
+ var Typography = require('@mui/material/Typography');
24
+ var Tooltip = require('@mui/material/Tooltip');
25
+ var IconButton = require('@mui/material/IconButton');
26
+ var MoreVertIcon = require('@mui/icons-material/MoreVert');
27
+ var Box4 = require('@mui/material/Box');
28
+ var styles = require('@mui/material/styles');
29
+ var useMediaQuery = require('@mui/material/useMediaQuery');
30
+ var Drawer = require('@mui/material/Drawer');
31
+ var Toolbar2 = require('@mui/material/Toolbar');
32
+ var MuiAppBar = require('@mui/material/AppBar');
33
+ var MenuIcon = require('@mui/icons-material/Menu');
34
+ var MenuOpenIcon = require('@mui/icons-material/MenuOpen');
35
+ var material = require('@mui/material');
36
+ var DarkModeIcon = require('@mui/icons-material/DarkMode');
37
+ var LightModeIcon = require('@mui/icons-material/LightMode');
38
+ var List = require('@mui/material/List');
39
+ var ListSubheader = require('@mui/material/ListSubheader');
40
+ var pathToRegexp = require('path-to-regexp');
41
+ var Collapse = require('@mui/material/Collapse');
42
+ var Grow = require('@mui/material/Grow');
43
+ var ListItem = require('@mui/material/ListItem');
44
+ var ListItemButton = require('@mui/material/ListItemButton');
45
+ var ListItemIcon = require('@mui/material/ListItemIcon');
46
+ var ListItemText = require('@mui/material/ListItemText');
47
+ var Paper = require('@mui/material/Paper');
48
+ var ExpandMoreIcon = require('@mui/icons-material/ExpandMore');
49
+ var Container = require('@mui/material/Container');
50
+ var Breadcrumbs = require('@mui/material/Breadcrumbs');
51
+ var Link4 = require('@mui/material/Link');
52
+ var useSlotProps = require('@mui/utils/useSlotProps');
53
+
54
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
55
+
56
+ function _interopNamespace(e) {
57
+ if (e && e.__esModule) return e;
58
+ var n = Object.create(null);
59
+ if (e) {
60
+ Object.keys(e).forEach(function (k) {
61
+ if (k !== 'default') {
62
+ var d = Object.getOwnPropertyDescriptor(e, k);
63
+ Object.defineProperty(n, k, d.get ? d : {
64
+ enumerable: true,
65
+ get: function () { return e[k]; }
66
+ });
67
+ }
68
+ });
69
+ }
70
+ n.default = e;
71
+ return Object.freeze(n);
72
+ }
73
+
74
+ var React16__namespace = /*#__PURE__*/_interopNamespace(React16);
75
+ var PropTypes9__default = /*#__PURE__*/_interopDefault(PropTypes9);
76
+ var Popover__default = /*#__PURE__*/_interopDefault(Popover);
77
+ var Divider__default = /*#__PURE__*/_interopDefault(Divider);
78
+ var Stack__default = /*#__PURE__*/_interopDefault(Stack);
79
+ var Button__default = /*#__PURE__*/_interopDefault(Button);
80
+ var Dialog__default = /*#__PURE__*/_interopDefault(Dialog);
81
+ var DialogTitle__default = /*#__PURE__*/_interopDefault(DialogTitle);
82
+ var DialogContent__default = /*#__PURE__*/_interopDefault(DialogContent);
83
+ var DialogActions__default = /*#__PURE__*/_interopDefault(DialogActions);
84
+ var TextField__default = /*#__PURE__*/_interopDefault(TextField);
85
+ var DialogContentText__default = /*#__PURE__*/_interopDefault(DialogContentText);
86
+ var invariant__default = /*#__PURE__*/_interopDefault(invariant);
87
+ var useEventCallback__default = /*#__PURE__*/_interopDefault(useEventCallback);
88
+ var LogoutIcon__default = /*#__PURE__*/_interopDefault(LogoutIcon);
89
+ var Avatar__default = /*#__PURE__*/_interopDefault(Avatar);
90
+ var Typography__default = /*#__PURE__*/_interopDefault(Typography);
91
+ var Tooltip__default = /*#__PURE__*/_interopDefault(Tooltip);
92
+ var IconButton__default = /*#__PURE__*/_interopDefault(IconButton);
93
+ var MoreVertIcon__default = /*#__PURE__*/_interopDefault(MoreVertIcon);
94
+ var Box4__default = /*#__PURE__*/_interopDefault(Box4);
95
+ var useMediaQuery__default = /*#__PURE__*/_interopDefault(useMediaQuery);
96
+ var Drawer__default = /*#__PURE__*/_interopDefault(Drawer);
97
+ var Toolbar2__default = /*#__PURE__*/_interopDefault(Toolbar2);
98
+ var MuiAppBar__default = /*#__PURE__*/_interopDefault(MuiAppBar);
99
+ var MenuIcon__default = /*#__PURE__*/_interopDefault(MenuIcon);
100
+ var MenuOpenIcon__default = /*#__PURE__*/_interopDefault(MenuOpenIcon);
101
+ var DarkModeIcon__default = /*#__PURE__*/_interopDefault(DarkModeIcon);
102
+ var LightModeIcon__default = /*#__PURE__*/_interopDefault(LightModeIcon);
103
+ var List__default = /*#__PURE__*/_interopDefault(List);
104
+ var ListSubheader__default = /*#__PURE__*/_interopDefault(ListSubheader);
105
+ var Collapse__default = /*#__PURE__*/_interopDefault(Collapse);
106
+ var Grow__default = /*#__PURE__*/_interopDefault(Grow);
107
+ var ListItem__default = /*#__PURE__*/_interopDefault(ListItem);
108
+ var ListItemButton__default = /*#__PURE__*/_interopDefault(ListItemButton);
109
+ var ListItemIcon__default = /*#__PURE__*/_interopDefault(ListItemIcon);
110
+ var ListItemText__default = /*#__PURE__*/_interopDefault(ListItemText);
111
+ var Paper__default = /*#__PURE__*/_interopDefault(Paper);
112
+ var ExpandMoreIcon__default = /*#__PURE__*/_interopDefault(ExpandMoreIcon);
113
+ var Container__default = /*#__PURE__*/_interopDefault(Container);
114
+ var Breadcrumbs__default = /*#__PURE__*/_interopDefault(Breadcrumbs);
115
+ var Link4__default = /*#__PURE__*/_interopDefault(Link4);
116
+ var useSlotProps__default = /*#__PURE__*/_interopDefault(useSlotProps);
117
+
118
+ var serverNotifications = {
119
+ show: () => {
120
+ throw new Error("Not supported on server side");
121
+ },
122
+ close: () => {
123
+ throw new Error("Not supported on server side");
124
+ }
125
+ };
126
+ function useNotifications() {
127
+ const context = React16__namespace.useContext(chunkSWAF5R4Y_js.NotificationsContext);
128
+ if (context) {
129
+ return context;
130
+ }
131
+ return serverNotifications;
132
+ }
133
+ var defaultLocaleText = {
134
+ alert: "Alert",
135
+ confirm: "Confirm",
136
+ cancel: "Cancel",
137
+ ok: "Ok"
138
+ };
139
+ function useDialogLoadingButton(onClose) {
140
+ const [loading, setLoading] = React16__namespace.useState(false);
141
+ const handleClick = async () => {
142
+ try {
143
+ setLoading(true);
144
+ await onClose();
145
+ } finally {
146
+ setLoading(false);
147
+ }
148
+ };
149
+ return {
150
+ onClick: handleClick,
151
+ loading
152
+ };
153
+ }
154
+ function AlertDialog({ open, payload, onClose }) {
155
+ var _a, _b;
156
+ const appWindowContext = React16__namespace.useContext(chunkSWAF5R4Y_js.WindowContext);
157
+ const globalLocaleText = chunkSWAF5R4Y_js.useLocaleText();
158
+ const localeText = chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues({}, defaultLocaleText), globalLocaleText);
159
+ const okButtonProps = useDialogLoadingButton(() => onClose());
160
+ return /* @__PURE__ */ jsxRuntime.jsxs(
161
+ Dialog__default.default,
162
+ {
163
+ maxWidth: "xs",
164
+ fullWidth: true,
165
+ open,
166
+ onClose: () => onClose(),
167
+ container: appWindowContext == null ? void 0 : appWindowContext.document.body,
168
+ children: [
169
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle__default.default, { children: (_a = payload.title) != null ? _a : localeText.alert }),
170
+ /* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: payload.msg }),
171
+ /* @__PURE__ */ jsxRuntime.jsx(DialogActions__default.default, { children: /* @__PURE__ */ jsxRuntime.jsx(Button__default.default, chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({ disabled: !open }, okButtonProps), { children: (_b = payload.okText) != null ? _b : localeText.ok })) })
172
+ ]
173
+ }
174
+ );
175
+ }
176
+ function ConfirmDialog({ open, payload, onClose }) {
177
+ var _a, _b, _c;
178
+ const appWindowContext = React16__namespace.useContext(chunkSWAF5R4Y_js.WindowContext);
179
+ const globalLocaleText = chunkSWAF5R4Y_js.useLocaleText();
180
+ const localeText = chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues({}, defaultLocaleText), globalLocaleText);
181
+ const cancelButtonProps = useDialogLoadingButton(() => onClose(false));
182
+ const okButtonProps = useDialogLoadingButton(() => onClose(true));
183
+ return /* @__PURE__ */ jsxRuntime.jsxs(
184
+ Dialog__default.default,
185
+ {
186
+ maxWidth: "xs",
187
+ fullWidth: true,
188
+ open,
189
+ onClose: () => onClose(false),
190
+ container: appWindowContext == null ? void 0 : appWindowContext.document.body,
191
+ children: [
192
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle__default.default, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
193
+ /* @__PURE__ */ jsxRuntime.jsx(DialogContent__default.default, { children: payload.msg }),
194
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogActions__default.default, { children: [
195
+ /* @__PURE__ */ jsxRuntime.jsx(Button__default.default, chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({ autoFocus: true, disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
196
+ /* @__PURE__ */ jsxRuntime.jsx(Button__default.default, chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({ color: payload.severity, disabled: !open }, okButtonProps), { children: (_c = payload.okText) != null ? _c : localeText.ok }))
197
+ ] })
198
+ ]
199
+ }
200
+ );
201
+ }
202
+ function PromptDialog({ open, payload, onClose }) {
203
+ var _a, _b, _c;
204
+ const appWindowContext = React16__namespace.useContext(chunkSWAF5R4Y_js.WindowContext);
205
+ const globalLocaleText = chunkSWAF5R4Y_js.useLocaleText();
206
+ const localeText = chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues({}, defaultLocaleText), globalLocaleText);
207
+ const [input, setInput] = React16__namespace.useState("");
208
+ const cancelButtonProps = useDialogLoadingButton(() => onClose(null));
209
+ const [loading, setLoading] = React16__namespace.useState(false);
210
+ const name = "input";
211
+ return /* @__PURE__ */ jsxRuntime.jsxs(
212
+ Dialog__default.default,
213
+ {
214
+ maxWidth: "xs",
215
+ fullWidth: true,
216
+ open,
217
+ onClose: () => onClose(null),
218
+ PaperProps: {
219
+ component: "form",
220
+ onSubmit: async (event) => {
221
+ var _a2;
222
+ event.preventDefault();
223
+ try {
224
+ setLoading(true);
225
+ const formData = new FormData(event.currentTarget);
226
+ const value = (_a2 = formData.get(name)) != null ? _a2 : "";
227
+ invariant__default.default(typeof value === "string", "Value must come from a text input");
228
+ await onClose(value);
229
+ } finally {
230
+ setLoading(false);
231
+ }
232
+ }
233
+ },
234
+ container: appWindowContext == null ? void 0 : appWindowContext.document.body,
235
+ children: [
236
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle__default.default, { children: (_a = payload.title) != null ? _a : localeText.confirm }),
237
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogContent__default.default, { children: [
238
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogContentText__default.default, { children: [
239
+ payload.msg,
240
+ " "
241
+ ] }),
242
+ /* @__PURE__ */ jsxRuntime.jsx(
243
+ TextField__default.default,
244
+ {
245
+ autoFocus: true,
246
+ required: true,
247
+ margin: "dense",
248
+ id: "name",
249
+ name,
250
+ type: "text",
251
+ fullWidth: true,
252
+ variant: "standard",
253
+ value: input,
254
+ onChange: (event) => setInput(event.target.value)
255
+ }
256
+ )
257
+ ] }),
258
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogActions__default.default, { children: [
259
+ /* @__PURE__ */ jsxRuntime.jsx(Button__default.default, chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({ disabled: !open }, cancelButtonProps), { children: (_b = payload.cancelText) != null ? _b : localeText.cancel })),
260
+ /* @__PURE__ */ jsxRuntime.jsx(Button__default.default, { disabled: !open, loading, type: "submit", children: (_c = payload.okText) != null ? _c : localeText.ok })
261
+ ] })
262
+ ]
263
+ }
264
+ );
265
+ }
266
+ function useDialogs() {
267
+ const { open, close } = chunk5B2NQDIH_js.useNonNullableContext(chunkSWAF5R4Y_js.DialogsContext);
268
+ const alert = useEventCallback__default.default(
269
+ (msg, _a = {}) => {
270
+ var _b = _a, { onClose } = _b, options = chunk5B2NQDIH_js.__objRest(_b, ["onClose"]);
271
+ return open(AlertDialog, chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({}, options), { msg }), { onClose });
272
+ }
273
+ );
274
+ const confirm = useEventCallback__default.default(
275
+ (msg, _c = {}) => {
276
+ var _d = _c, { onClose } = _d, options = chunk5B2NQDIH_js.__objRest(_d, ["onClose"]);
277
+ return open(ConfirmDialog, chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({}, options), { msg }), { onClose });
278
+ }
279
+ );
280
+ const prompt = useEventCallback__default.default(
281
+ (msg, _e = {}) => {
282
+ var _f = _e, { onClose } = _f, options = chunk5B2NQDIH_js.__objRest(_f, ["onClose"]);
283
+ return open(PromptDialog, chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({}, options), { msg }), { onClose });
284
+ }
285
+ );
286
+ return React16__namespace.useMemo(
287
+ () => ({
288
+ alert,
289
+ confirm,
290
+ prompt,
291
+ open,
292
+ close
293
+ }),
294
+ [alert, close, confirm, open, prompt]
295
+ );
296
+ }
297
+ var AccountLocaleContext = React16__namespace.createContext(null);
298
+ function SignInButton(props) {
299
+ const authentication = React16__namespace.useContext(chunkSWAF5R4Y_js.AuthenticationContext);
300
+ const globalLocaleText = chunkSWAF5R4Y_js.useLocaleText();
301
+ const accountLocaleText = React16__namespace.useContext(AccountLocaleContext);
302
+ const localeText = chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues({}, globalLocaleText), accountLocaleText);
303
+ return /* @__PURE__ */ jsxRuntime.jsx(
304
+ Button__default.default,
305
+ chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({
306
+ disableElevation: true,
307
+ variant: "contained",
308
+ size: "small",
309
+ onClick: authentication == null ? void 0 : authentication.signIn,
310
+ sx: {
311
+ textTransform: "capitalize",
312
+ filter: "opacity(0.9)",
313
+ width: "50%",
314
+ margin: (theme) => `${theme.spacing(1)} auto`,
315
+ transition: "filter 0.2s ease-in",
316
+ "&:hover": {
317
+ filter: "opacity(1)"
318
+ }
319
+ }
320
+ }, props), {
321
+ children: localeText == null ? void 0 : localeText.accountSignInLabel
322
+ })
323
+ );
324
+ }
325
+ SignInButton.propTypes = {
326
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
327
+ // │ These PropTypes are generated from the TypeScript type definitions. │
328
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
329
+ // └─────────────────────────────────────────────────────────────────────┘
330
+ /**
331
+ * The content of the component.
332
+ */
333
+ children: PropTypes9__default.default.node
334
+ };
335
+ function SignOutButton(props) {
336
+ const authentication = React16__namespace.useContext(chunkSWAF5R4Y_js.AuthenticationContext);
337
+ const globalLocaleText = chunkSWAF5R4Y_js.useLocaleText();
338
+ const accountLocaleText = React16__namespace.useContext(AccountLocaleContext);
339
+ const localeText = chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues({}, globalLocaleText), accountLocaleText);
340
+ return /* @__PURE__ */ jsxRuntime.jsx(
341
+ Button__default.default,
342
+ chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({
343
+ disabled: !authentication,
344
+ variant: "outlined",
345
+ size: "small",
346
+ disableElevation: true,
347
+ onClick: authentication == null ? void 0 : authentication.signOut,
348
+ sx: {
349
+ textTransform: "capitalize",
350
+ fontWeight: "normal",
351
+ filter: "opacity(0.9)",
352
+ transition: "filter 0.2s ease-in",
353
+ "&:hover": {
354
+ filter: "opacity(1)"
355
+ }
356
+ },
357
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(LogoutIcon__default.default, {})
358
+ }, props), {
359
+ children: localeText == null ? void 0 : localeText.accountSignOutLabel
360
+ })
361
+ );
362
+ }
363
+ SignOutButton.propTypes = {
364
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
365
+ // │ These PropTypes are generated from the TypeScript type definitions. │
366
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
367
+ // └─────────────────────────────────────────────────────────────────────┘
368
+ /**
369
+ * The content of the component.
370
+ */
371
+ children: PropTypes9__default.default.node
372
+ };
373
+ function AccountPreview(props) {
374
+ var _a, _b, _c, _d, _e, _f, _g, _h;
375
+ const { slots, variant = "condensed", slotProps, open, handleClick, sx } = props;
376
+ const session = React16__namespace.useContext(chunkSWAF5R4Y_js.SessionContext);
377
+ const globalLocaleText = chunkSWAF5R4Y_js.useLocaleText();
378
+ const accountLocaleText = React16__namespace.useContext(AccountLocaleContext);
379
+ const localeText = chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues({}, globalLocaleText), accountLocaleText);
380
+ if (!session || !session.user) {
381
+ return null;
382
+ }
383
+ const avatarContent = (slots == null ? void 0 : slots.avatar) ? /* @__PURE__ */ jsxRuntime.jsx(slots.avatar, {}) : /* @__PURE__ */ jsxRuntime.jsx(
384
+ Avatar__default.default,
385
+ chunk5B2NQDIH_js.__spreadValues({
386
+ src: ((_a = session.user) == null ? void 0 : _a.image) || "",
387
+ alt: ((_b = session.user) == null ? void 0 : _b.name) || ((_c = session.user) == null ? void 0 : _c.email) || "",
388
+ sx: { height: variant === "expanded" ? 48 : 32, width: variant === "expanded" ? 48 : 32 }
389
+ }, slotProps == null ? void 0 : slotProps.avatar)
390
+ );
391
+ if (variant === "expanded") {
392
+ return /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", justifyContent: "space-between", sx: chunk5B2NQDIH_js.__spreadValues({ py: 1, px: 2, gap: 2 }, sx), children: [
393
+ /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", justifyContent: "flex-start", spacing: 2, overflow: "hidden", children: [
394
+ avatarContent,
395
+ /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "column", justifyContent: "space-evenly", overflow: "hidden", children: [
396
+ /* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { variant: "body2", fontWeight: "bolder", noWrap: true, children: (_d = session.user) == null ? void 0 : _d.name }),
397
+ /* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { variant: "caption", noWrap: true, children: (_e = session.user) == null ? void 0 : _e.email })
398
+ ] })
399
+ ] }),
400
+ handleClick && ((slots == null ? void 0 : slots.moreIconButton) ? /* @__PURE__ */ jsxRuntime.jsx(slots.moreIconButton, {}) : /* @__PURE__ */ jsxRuntime.jsx(
401
+ IconButton__default.default,
402
+ chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({
403
+ size: "small",
404
+ onClick: handleClick
405
+ }, slotProps == null ? void 0 : slotProps.moreIconButton), {
406
+ sx: chunk5B2NQDIH_js.__spreadValues({ alignSelf: "center" }, (_f = slotProps == null ? void 0 : slotProps.moreIconButton) == null ? void 0 : _f.sx),
407
+ children: /* @__PURE__ */ jsxRuntime.jsx(MoreVertIcon__default.default, { fontSize: "small" })
408
+ })
409
+ ))
410
+ ] });
411
+ }
412
+ return /* @__PURE__ */ jsxRuntime.jsx(Tooltip__default.default, { title: (_g = session.user.name) != null ? _g : accountLocaleText == null ? void 0 : accountLocaleText.accountPreviewTitle, children: (slots == null ? void 0 : slots.avatarIconButton) ? /* @__PURE__ */ jsxRuntime.jsx(slots.avatarIconButton, chunk5B2NQDIH_js.__spreadValues({}, slotProps == null ? void 0 : slotProps.avatarIconButton)) : /* @__PURE__ */ jsxRuntime.jsx(Stack__default.default, { sx: chunk5B2NQDIH_js.__spreadValues({ py: 0.5 }, sx), children: /* @__PURE__ */ jsxRuntime.jsx(
413
+ IconButton__default.default,
414
+ chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({
415
+ onClick: handleClick,
416
+ "aria-label": localeText == null ? void 0 : localeText.accountPreviewIconButtonLabel,
417
+ size: "small",
418
+ "aria-controls": open ? "account-menu" : void 0,
419
+ "aria-haspopup": "true",
420
+ "aria-expanded": open ? "true" : void 0
421
+ }, slotProps == null ? void 0 : slotProps.avatarIconButton), {
422
+ sx: chunk5B2NQDIH_js.__spreadValues({ width: "fit-content", margin: "0 auto" }, (_h = slotProps == null ? void 0 : slotProps.avatarIconButton) == null ? void 0 : _h.sx),
423
+ children: avatarContent
424
+ })
425
+ ) }) });
426
+ }
427
+ AccountPreview.propTypes = {
428
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
429
+ // │ These PropTypes are generated from the TypeScript type definitions. │
430
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
431
+ // └─────────────────────────────────────────────────────────────────────┘
432
+ /**
433
+ * The handler used when the preview is expanded
434
+ */
435
+ handleClick: PropTypes9__default.default.func,
436
+ /**
437
+ * The state of the Account popover
438
+ * @default false
439
+ */
440
+ open: PropTypes9__default.default.bool,
441
+ /**
442
+ * The props used for each slot inside.
443
+ */
444
+ slotProps: PropTypes9__default.default.shape({
445
+ avatar: PropTypes9__default.default.object,
446
+ avatarIconButton: PropTypes9__default.default.object,
447
+ moreIconButton: PropTypes9__default.default.object
448
+ }),
449
+ /**
450
+ * The components used for each slot inside.
451
+ */
452
+ slots: PropTypes9__default.default.shape({
453
+ avatar: PropTypes9__default.default.elementType,
454
+ avatarIconButton: PropTypes9__default.default.elementType,
455
+ moreIconButton: PropTypes9__default.default.elementType
456
+ }),
457
+ /**
458
+ * The prop used to customize the styling of the preview
459
+ */
460
+ sx: PropTypes9__default.default.oneOfType([
461
+ PropTypes9__default.default.arrayOf(PropTypes9__default.default.oneOfType([PropTypes9__default.default.func, PropTypes9__default.default.object, PropTypes9__default.default.bool])),
462
+ PropTypes9__default.default.func,
463
+ PropTypes9__default.default.object
464
+ ]),
465
+ /**
466
+ * The type of account details to display.
467
+ * @property {'condensed'} condensed - Shows only the user's avatar.
468
+ * @property {'expanded'} expanded - Displays the user's avatar, name, and email if available.
469
+ * @default 'condensed'
470
+ */
471
+ variant: PropTypes9__default.default.oneOf(["condensed", "expanded"])
472
+ };
473
+ function AccountPopoverHeader(props) {
474
+ const _a = props, { children } = _a, rest = chunk5B2NQDIH_js.__objRest(_a, ["children"]);
475
+ return /* @__PURE__ */ jsxRuntime.jsx(Stack__default.default, chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({}, rest), { children }));
476
+ }
477
+ AccountPopoverHeader.propTypes = {
478
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
479
+ // │ These PropTypes are generated from the TypeScript type definitions. │
480
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
481
+ // └─────────────────────────────────────────────────────────────────────┘
482
+ /**
483
+ * The content of the component.
484
+ */
485
+ children: PropTypes9__default.default.node
486
+ };
487
+ function AccountPopoverFooter(props) {
488
+ const _a = props, { children } = _a, rest = chunk5B2NQDIH_js.__objRest(_a, ["children"]);
489
+ return /* @__PURE__ */ jsxRuntime.jsx(
490
+ Box4__default.default,
491
+ chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({}, rest), {
492
+ sx: chunk5B2NQDIH_js.__spreadValues({ display: "flex", flexDirection: "row", p: 1, justifyContent: "flex-end" }, rest.sx),
493
+ children
494
+ })
495
+ );
496
+ }
497
+ AccountPopoverFooter.propTypes = {
498
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
499
+ // │ These PropTypes are generated from the TypeScript type definitions. │
500
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
501
+ // └─────────────────────────────────────────────────────────────────────┘
502
+ /**
503
+ * @ignore
504
+ */
505
+ children: PropTypes9__default.default.node,
506
+ /**
507
+ * The system prop that allows defining system overrides as well as additional CSS styles.
508
+ */
509
+ sx: PropTypes9__default.default.oneOfType([
510
+ PropTypes9__default.default.arrayOf(PropTypes9__default.default.oneOfType([PropTypes9__default.default.func, PropTypes9__default.default.object, PropTypes9__default.default.bool])),
511
+ PropTypes9__default.default.func,
512
+ PropTypes9__default.default.object
513
+ ])
514
+ };
515
+ var defaultAccountLocaleText = {
516
+ accountPreviewIconButtonLabel: "Current User",
517
+ accountPreviewTitle: "Account",
518
+ accountSignInLabel: "Sign in",
519
+ accountSignOutLabel: "Sign out"
520
+ };
521
+ function Account(props) {
522
+ var _a;
523
+ const { localeText: propsLocaleText } = props;
524
+ const globalLocaleText = chunkSWAF5R4Y_js.useLocaleText();
525
+ const localeText = React16__namespace.useMemo(
526
+ () => chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues({}, defaultAccountLocaleText), globalLocaleText), propsLocaleText),
527
+ [globalLocaleText, propsLocaleText]
528
+ );
529
+ const { slots, slotProps } = props;
530
+ const [anchorEl, setAnchorEl] = React16__namespace.useState(null);
531
+ const session = React16__namespace.useContext(chunkSWAF5R4Y_js.SessionContext);
532
+ const authentication = React16__namespace.useContext(chunkSWAF5R4Y_js.AuthenticationContext);
533
+ const open = Boolean(anchorEl);
534
+ const handleClick = (event) => {
535
+ setAnchorEl(event.currentTarget);
536
+ };
537
+ const handleClose = () => {
538
+ setAnchorEl(null);
539
+ };
540
+ if (!authentication) {
541
+ return null;
542
+ }
543
+ let accountContent = null;
544
+ if (!(session == null ? void 0 : session.user)) {
545
+ accountContent = (slots == null ? void 0 : slots.signInButton) ? /* @__PURE__ */ jsxRuntime.jsx(slots.signInButton, { onClick: authentication.signIn }) : /* @__PURE__ */ jsxRuntime.jsx(SignInButton, chunk5B2NQDIH_js.__spreadValues({}, slotProps == null ? void 0 : slotProps.signInButton));
546
+ } else {
547
+ accountContent = /* @__PURE__ */ jsxRuntime.jsxs(React16__namespace.Fragment, { children: [
548
+ (slots == null ? void 0 : slots.preview) ? /* @__PURE__ */ jsxRuntime.jsx(slots.preview, { handleClick, open }) : /* @__PURE__ */ jsxRuntime.jsx(
549
+ AccountPreview,
550
+ chunk5B2NQDIH_js.__spreadValues({
551
+ variant: "condensed",
552
+ handleClick,
553
+ open
554
+ }, slotProps == null ? void 0 : slotProps.preview)
555
+ ),
556
+ (slots == null ? void 0 : slots.popover) ? /* @__PURE__ */ jsxRuntime.jsx(
557
+ slots.popover,
558
+ chunk5B2NQDIH_js.__spreadValues({
559
+ open,
560
+ onClick: handleClick,
561
+ onClose: handleClose
562
+ }, slotProps == null ? void 0 : slotProps.popover)
563
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
564
+ Popover__default.default,
565
+ chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({
566
+ anchorEl,
567
+ id: "account-menu",
568
+ open,
569
+ onClose: handleClose,
570
+ onClick: handleClose,
571
+ transformOrigin: { horizontal: "right", vertical: "top" },
572
+ anchorOrigin: { horizontal: "right", vertical: "bottom" }
573
+ }, slotProps == null ? void 0 : slotProps.popover), {
574
+ slotProps: chunk5B2NQDIH_js.__spreadValues({
575
+ paper: {
576
+ elevation: 0,
577
+ sx: {
578
+ overflow: "visible",
579
+ filter: (theme) => `drop-shadow(0px 2px 8px ${theme.palette.mode === "dark" ? "rgba(255,255,255,0.10)" : "rgba(0,0,0,0.32)"})`,
580
+ mt: 1,
581
+ "&::before": {
582
+ content: '""',
583
+ display: "block",
584
+ position: "absolute",
585
+ top: 0,
586
+ right: 14,
587
+ width: 10,
588
+ height: 10,
589
+ bgcolor: "background.paper",
590
+ transform: "translateY(-50%) rotate(45deg)",
591
+ zIndex: 0
592
+ }
593
+ }
594
+ }
595
+ }, (_a = slotProps == null ? void 0 : slotProps.popover) == null ? void 0 : _a.slotProps),
596
+ children: (slots == null ? void 0 : slots.popoverContent) ? /* @__PURE__ */ jsxRuntime.jsx(slots.popoverContent, chunk5B2NQDIH_js.__spreadValues({}, slotProps == null ? void 0 : slotProps.popoverContent)) : /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({ direction: "column" }, slotProps == null ? void 0 : slotProps.popoverContent), { children: [
597
+ /* @__PURE__ */ jsxRuntime.jsx(AccountPopoverHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(AccountPreview, { variant: "expanded" }) }),
598
+ /* @__PURE__ */ jsxRuntime.jsx(Divider__default.default, {}),
599
+ /* @__PURE__ */ jsxRuntime.jsx(AccountPopoverFooter, { children: /* @__PURE__ */ jsxRuntime.jsx(SignOutButton, chunk5B2NQDIH_js.__spreadValues({}, slotProps == null ? void 0 : slotProps.signOutButton)) })
600
+ ] }))
601
+ })
602
+ )
603
+ ] });
604
+ }
605
+ return /* @__PURE__ */ jsxRuntime.jsx(AccountLocaleContext.Provider, { value: localeText, children: accountContent });
606
+ }
607
+ Account.propTypes = {
608
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
609
+ // │ These PropTypes are generated from the TypeScript type definitions. │
610
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
611
+ // └─────────────────────────────────────────────────────────────────────┘
612
+ /**
613
+ * The labels for the account component.
614
+ */
615
+ localeText: PropTypes9__default.default.object,
616
+ /**
617
+ * The props used for each slot inside.
618
+ */
619
+ slotProps: PropTypes9__default.default.shape({
620
+ popover: PropTypes9__default.default.object,
621
+ popoverContent: PropTypes9__default.default.object,
622
+ preview: PropTypes9__default.default.shape({
623
+ handleClick: PropTypes9__default.default.func,
624
+ open: PropTypes9__default.default.bool,
625
+ slotProps: PropTypes9__default.default.shape({
626
+ avatar: PropTypes9__default.default.object,
627
+ avatarIconButton: PropTypes9__default.default.object,
628
+ moreIconButton: PropTypes9__default.default.object
629
+ }),
630
+ slots: PropTypes9__default.default.shape({
631
+ avatar: PropTypes9__default.default.elementType,
632
+ avatarIconButton: PropTypes9__default.default.elementType,
633
+ moreIconButton: PropTypes9__default.default.elementType
634
+ }),
635
+ sx: PropTypes9__default.default.oneOfType([
636
+ PropTypes9__default.default.arrayOf(PropTypes9__default.default.oneOfType([PropTypes9__default.default.func, PropTypes9__default.default.object, PropTypes9__default.default.bool])),
637
+ PropTypes9__default.default.func,
638
+ PropTypes9__default.default.object
639
+ ]),
640
+ variant: PropTypes9__default.default.oneOf(["condensed", "expanded"])
641
+ }),
642
+ signInButton: PropTypes9__default.default.object,
643
+ signOutButton: PropTypes9__default.default.object
644
+ }),
645
+ /**
646
+ * The components used for each slot inside.
647
+ */
648
+ slots: PropTypes9__default.default.shape({
649
+ popover: PropTypes9__default.default.elementType,
650
+ popoverContent: PropTypes9__default.default.elementType,
651
+ preview: PropTypes9__default.default.elementType,
652
+ signInButton: PropTypes9__default.default.elementType,
653
+ signOutButton: PropTypes9__default.default.elementType
654
+ })
655
+ };
656
+ var DefaultLink = React16__namespace.forwardRef(function Link(props, ref) {
657
+ const _a = props, { children, href, onClick, history } = _a, rest = chunk5B2NQDIH_js.__objRest(_a, ["children", "href", "onClick", "history"]);
658
+ const routerContext = React16__namespace.useContext(chunkSWAF5R4Y_js.RouterContext);
659
+ const handleLinkClick = React16__namespace.useMemo(() => {
660
+ if (!routerContext) {
661
+ return onClick;
662
+ }
663
+ return (event) => {
664
+ event.preventDefault();
665
+ const url = new URL(event.currentTarget.href);
666
+ routerContext.navigate(url.pathname, { history });
667
+ onClick == null ? void 0 : onClick(event);
668
+ };
669
+ }, [routerContext, onClick, history]);
670
+ return /* @__PURE__ */ jsxRuntime.jsx("a", chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({ ref, href }, rest), { onClick: handleLinkClick, children }));
671
+ });
672
+ var Link2 = React16__namespace.forwardRef(function Link3(props, ref) {
673
+ var _a;
674
+ const routerContext = React16__namespace.useContext(chunkSWAF5R4Y_js.RouterContext);
675
+ const LinkComponent = (_a = routerContext == null ? void 0 : routerContext.Link) != null ? _a : DefaultLink;
676
+ return /* @__PURE__ */ jsxRuntime.jsx(LinkComponent, chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({ ref }, props), { children: props.children }));
677
+ });
678
+ function ToolpadLogo({ size = 40 }) {
679
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: size, height: size, fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
680
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { mask: "url(#a)", children: [
681
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M22.74 27.73v-7.6l6.64-3.79v7.6l-6.64 3.79Z", fill: "#007FFF" }),
682
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16.1 23.93v-7.59l6.64 3.8v7.59l-6.65-3.8Z", fill: "#39F" }),
683
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m16.1 16.34 6.64-3.8 6.64 3.8-6.64 3.8-6.65-3.8Z", fill: "#A5D8FF" })
684
+ ] }),
685
+ /* @__PURE__ */ jsxRuntime.jsx(
686
+ "mask",
687
+ {
688
+ id: "b",
689
+ style: {
690
+ maskType: "alpha"
691
+ },
692
+ maskUnits: "userSpaceOnUse",
693
+ x: "8",
694
+ y: "17",
695
+ width: "14",
696
+ height: "15",
697
+ children: /* @__PURE__ */ jsxRuntime.jsx(
698
+ "path",
699
+ {
700
+ d: "M8.5 22.3c0-1.05.56-2 1.46-2.53l3.75-2.14c.89-.5 1.98-.5 2.87 0l3.75 2.14a2.9 2.9 0 0 1 1.46 2.52v4.23c0 1.04-.56 2-1.46 2.52l-3.75 2.14c-.89.5-1.98.5-2.87 0l-3.75-2.14a2.9 2.9 0 0 1-1.46-2.52v-4.23Z",
701
+ fill: "#D7DCE1"
702
+ }
703
+ )
704
+ }
705
+ ),
706
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { mask: "url(#b)", children: [
707
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.14 32v-7.6l6.65-3.8v7.6L15.14 32Z", fill: "#007FFF" }),
708
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 28.2v-7.6l6.64 3.8V32L8.5 28.2Z", fill: "#39F" }),
709
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m8.5 20.6 6.64-3.79 6.65 3.8-6.65 3.8-6.64-3.8Z", fill: "#A5D8FF" })
710
+ ] }),
711
+ /* @__PURE__ */ jsxRuntime.jsx(
712
+ "mask",
713
+ {
714
+ id: "c",
715
+ style: {
716
+ maskType: "alpha"
717
+ },
718
+ maskUnits: "userSpaceOnUse",
719
+ x: "8",
720
+ y: "4",
721
+ width: "22",
722
+ height: "20",
723
+ children: /* @__PURE__ */ jsxRuntime.jsx(
724
+ "path",
725
+ {
726
+ d: "M24.17 4.82a2.9 2.9 0 0 0-2.87 0L9.97 11.22a2.9 2.9 0 0 0-1.47 2.53v4.22c0 1.04.56 2 1.46 2.52l3.75 2.14c.89.5 1.98.5 2.87 0l11.33-6.42a2.9 2.9 0 0 0 1.47-2.52V9.48c0-1.04-.56-2-1.46-2.52l-3.75-2.14Z",
727
+ fill: "#D7DCE1"
728
+ }
729
+ )
730
+ }
731
+ ),
732
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { mask: "url(#c)", children: [
733
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15.14 23.46v-7.6L29.38 7.8v7.59l-14.24 8.07Z", fill: "#007FFF" }),
734
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 19.66v-7.6l6.64 3.8v7.6l-6.64-3.8Z", fill: "#39F" }),
735
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 12.07 22.74 4l6.64 3.8-14.24 8.06-6.64-3.8Z", fill: "#A5D8FF" })
736
+ ] })
737
+ ] });
738
+ }
739
+ function useApplicationTitle() {
740
+ var _a;
741
+ const branding = React16__namespace.useContext(chunkSWAF5R4Y_js.BrandingContext);
742
+ return (_a = branding == null ? void 0 : branding.title) != null ? _a : "Toolpad";
743
+ }
744
+ var LogoContainer = material.styled("div")({
745
+ position: "relative",
746
+ height: 40,
747
+ display: "flex",
748
+ alignItems: "center",
749
+ "& img": {
750
+ maxHeight: 40
751
+ }
752
+ });
753
+ function AppTitle(props) {
754
+ var _a, _b, _c, _d, _e, _f, _g;
755
+ const theme = material.useTheme();
756
+ const defaultTitle = useApplicationTitle();
757
+ const title = (_b = (_a = props == null ? void 0 : props.branding) == null ? void 0 : _a.title) != null ? _b : defaultTitle;
758
+ return /* @__PURE__ */ jsxRuntime.jsx(Link2, { href: (_d = (_c = props == null ? void 0 : props.branding) == null ? void 0 : _c.homeUrl) != null ? _d : "/", style: { textDecoration: "none" }, children: /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", alignItems: "center", children: [
759
+ /* @__PURE__ */ jsxRuntime.jsx(LogoContainer, { children: (_f = (_e = props == null ? void 0 : props.branding) == null ? void 0 : _e.logo) != null ? _f : /* @__PURE__ */ jsxRuntime.jsx(ToolpadLogo, { size: 40 }) }),
760
+ /* @__PURE__ */ jsxRuntime.jsx(
761
+ Typography__default.default,
762
+ {
763
+ variant: "h6",
764
+ sx: {
765
+ color: ((_g = theme.vars) != null ? _g : theme).palette.primary.main,
766
+ fontWeight: "700",
767
+ ml: 1,
768
+ whiteSpace: "nowrap",
769
+ lineHeight: 1
770
+ },
771
+ children: title
772
+ }
773
+ )
774
+ ] }) });
775
+ }
776
+ function subscribe() {
777
+ return () => {
778
+ };
779
+ }
780
+ function getSnapshot() {
781
+ return false;
782
+ }
783
+ function getServerSnapshot() {
784
+ return true;
785
+ }
786
+ function useSsr() {
787
+ return React16__namespace.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
788
+ }
789
+ function ThemeSwitcher() {
790
+ var _a;
791
+ const isSsr = useSsr();
792
+ const theme = material.useTheme();
793
+ const { paletteMode, setPaletteMode, isDualTheme } = React16__namespace.useContext(chunkSWAF5R4Y_js.PaletteModeContext);
794
+ const toggleMode = React16__namespace.useCallback(() => {
795
+ setPaletteMode(paletteMode === "dark" ? "light" : "dark");
796
+ }, [paletteMode, setPaletteMode]);
797
+ return isDualTheme ? /* @__PURE__ */ jsxRuntime.jsx(
798
+ Tooltip__default.default,
799
+ {
800
+ title: isSsr ? "Switch mode" : `${paletteMode === "dark" ? "Light" : "Dark"} mode`,
801
+ enterDelay: 1e3,
802
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
803
+ IconButton__default.default,
804
+ {
805
+ "aria-label": isSsr ? "Switch theme mode" : `Switch to ${paletteMode === "dark" ? "light" : "dark"} mode`,
806
+ onClick: toggleMode,
807
+ sx: {
808
+ color: ((_a = theme.vars) != null ? _a : theme).palette.primary.dark
809
+ },
810
+ children: theme.getColorSchemeSelector ? /* @__PURE__ */ jsxRuntime.jsxs(React16__namespace.Fragment, { children: [
811
+ /* @__PURE__ */ jsxRuntime.jsx(
812
+ DarkModeIcon__default.default,
813
+ {
814
+ sx: {
815
+ display: "inline",
816
+ [theme.getColorSchemeSelector("dark")]: {
817
+ display: "none"
818
+ }
819
+ }
820
+ }
821
+ ),
822
+ /* @__PURE__ */ jsxRuntime.jsx(
823
+ LightModeIcon__default.default,
824
+ {
825
+ sx: {
826
+ display: "none",
827
+ [theme.getColorSchemeSelector("dark")]: {
828
+ display: "inline"
829
+ }
830
+ }
831
+ }
832
+ )
833
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(React16__namespace.Fragment, { children: isSsr || paletteMode !== "dark" ? /* @__PURE__ */ jsxRuntime.jsx(DarkModeIcon__default.default, {}) : /* @__PURE__ */ jsxRuntime.jsx(LightModeIcon__default.default, {}) })
834
+ }
835
+ ) })
836
+ }
837
+ ) : null;
838
+ }
839
+ function ToolbarActions() {
840
+ return /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", alignItems: "center", children: [
841
+ /* @__PURE__ */ jsxRuntime.jsx(ThemeSwitcher, {}),
842
+ /* @__PURE__ */ jsxRuntime.jsx(Account, {})
843
+ ] });
844
+ }
845
+ var AppBar = styles.styled(MuiAppBar__default.default)(({ theme }) => {
846
+ var _a;
847
+ return {
848
+ borderWidth: 0,
849
+ borderBottomWidth: 1,
850
+ borderStyle: "solid",
851
+ borderColor: ((_a = theme.vars) != null ? _a : theme).palette.divider,
852
+ boxShadow: "none",
853
+ zIndex: theme.zIndex.drawer + 1
854
+ };
855
+ });
856
+ function DashboardHeader(props) {
857
+ var _a, _b;
858
+ const {
859
+ branding: brandingProp,
860
+ menuOpen,
861
+ onToggleMenu,
862
+ hideMenuButton,
863
+ slots,
864
+ slotProps
865
+ } = props;
866
+ const brandingContext = React16__namespace.useContext(chunkSWAF5R4Y_js.BrandingContext);
867
+ const branding = chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues({}, brandingContext), brandingProp);
868
+ const handleMenuOpen = React16__namespace.useCallback(() => {
869
+ onToggleMenu(!menuOpen);
870
+ }, [menuOpen, onToggleMenu]);
871
+ const getMenuIcon = React16__namespace.useCallback(
872
+ (isExpanded) => {
873
+ const expandMenuActionText = "Expand";
874
+ const collapseMenuActionText = "Collapse";
875
+ return /* @__PURE__ */ jsxRuntime.jsx(
876
+ Tooltip__default.default,
877
+ {
878
+ title: `${isExpanded ? collapseMenuActionText : expandMenuActionText} menu`,
879
+ enterDelay: 1e3,
880
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
881
+ IconButton__default.default,
882
+ {
883
+ "aria-label": `${isExpanded ? collapseMenuActionText : expandMenuActionText} navigation menu`,
884
+ onClick: handleMenuOpen,
885
+ children: isExpanded ? /* @__PURE__ */ jsxRuntime.jsx(MenuOpenIcon__default.default, {}) : /* @__PURE__ */ jsxRuntime.jsx(MenuIcon__default.default, {})
886
+ }
887
+ ) })
888
+ }
889
+ );
890
+ },
891
+ [handleMenuOpen]
892
+ );
893
+ const ToolbarActionsSlot = (_a = slots == null ? void 0 : slots.toolbarActions) != null ? _a : ToolbarActions;
894
+ const ToolbarAccountSlot = (_b = slots == null ? void 0 : slots.toolbarAccount) != null ? _b : (() => null);
895
+ return /* @__PURE__ */ jsxRuntime.jsx(AppBar, { color: "inherit", position: "absolute", sx: { displayPrint: "none" }, children: /* @__PURE__ */ jsxRuntime.jsx(Toolbar2__default.default, { sx: { backgroundColor: "inherit", mx: { xs: -0.75, sm: -1 } }, children: /* @__PURE__ */ jsxRuntime.jsxs(
896
+ Stack__default.default,
897
+ {
898
+ direction: "row",
899
+ justifyContent: "space-between",
900
+ alignItems: "center",
901
+ sx: {
902
+ flexWrap: "wrap",
903
+ width: "100%"
904
+ },
905
+ children: [
906
+ /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", children: [
907
+ !hideMenuButton ? /* @__PURE__ */ jsxRuntime.jsxs(React16__namespace.Fragment, { children: [
908
+ /* @__PURE__ */ jsxRuntime.jsx(
909
+ Box4__default.default,
910
+ {
911
+ sx: {
912
+ display: { xs: "block", md: "none" },
913
+ mr: { sm: 1 }
914
+ },
915
+ children: getMenuIcon(menuOpen)
916
+ }
917
+ ),
918
+ /* @__PURE__ */ jsxRuntime.jsx(
919
+ Box4__default.default,
920
+ {
921
+ sx: {
922
+ display: { xs: "none", md: "block" },
923
+ mr: 1
924
+ },
925
+ children: getMenuIcon(menuOpen)
926
+ }
927
+ )
928
+ ] }) : null,
929
+ (slots == null ? void 0 : slots.appTitle) ? /* @__PURE__ */ jsxRuntime.jsx(slots.appTitle, chunk5B2NQDIH_js.__spreadValues({}, slotProps == null ? void 0 : slotProps.appTitle)) : (
930
+ /* Hierarchy of application of `branding`
931
+ * 1. Branding prop passed in the `slotProps.appTitle`
932
+ * 2. Branding prop passed to the `DashboardLayout`
933
+ * 3. Branding prop passed to the `AppProvider`
934
+ */
935
+ /* @__PURE__ */ jsxRuntime.jsx(AppTitle, chunk5B2NQDIH_js.__spreadValues({ branding }, slotProps == null ? void 0 : slotProps.appTitle))
936
+ )
937
+ ] }),
938
+ /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { direction: "row", alignItems: "center", spacing: 1, sx: { marginLeft: "auto" }, children: [
939
+ /* @__PURE__ */ jsxRuntime.jsx(ToolbarActionsSlot, chunk5B2NQDIH_js.__spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarActions)),
940
+ /* @__PURE__ */ jsxRuntime.jsx(ToolbarAccountSlot, chunk5B2NQDIH_js.__spreadValues({}, slotProps == null ? void 0 : slotProps.toolbarAccount))
941
+ ] })
942
+ ]
943
+ }
944
+ ) }) });
945
+ }
946
+ DashboardHeader.propTypes = {
947
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
948
+ // │ These PropTypes are generated from the TypeScript type definitions. │
949
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
950
+ // └─────────────────────────────────────────────────────────────────────┘
951
+ /**
952
+ * Branding options for the header.
953
+ * @default null
954
+ */
955
+ branding: PropTypes9__default.default.shape({
956
+ homeUrl: PropTypes9__default.default.string,
957
+ logo: PropTypes9__default.default.node,
958
+ title: PropTypes9__default.default.string
959
+ }),
960
+ /**
961
+ * Whether the menu icon should always be hidden.
962
+ * @default false
963
+ */
964
+ hideMenuButton: PropTypes9__default.default.bool,
965
+ /**
966
+ * If `true`, show menu button as if menu is expanded, otherwise show it as if menu is collapsed.
967
+ */
968
+ menuOpen: PropTypes9__default.default.bool.isRequired,
969
+ /**
970
+ * Callback fired when the menu button is clicked.
971
+ */
972
+ onToggleMenu: PropTypes9__default.default.func.isRequired,
973
+ /**
974
+ * The props used for each slot inside.
975
+ * @default {}
976
+ */
977
+ slotProps: PropTypes9__default.default.shape({
978
+ appTitle: PropTypes9__default.default.shape({
979
+ branding: PropTypes9__default.default.shape({
980
+ homeUrl: PropTypes9__default.default.string,
981
+ logo: PropTypes9__default.default.node,
982
+ title: PropTypes9__default.default.string
983
+ })
984
+ }),
985
+ toolbarAccount: PropTypes9__default.default.shape({
986
+ localeText: PropTypes9__default.default.object,
987
+ slotProps: PropTypes9__default.default.shape({
988
+ popover: PropTypes9__default.default.object,
989
+ popoverContent: PropTypes9__default.default.object,
990
+ preview: PropTypes9__default.default.object,
991
+ signInButton: PropTypes9__default.default.object,
992
+ signOutButton: PropTypes9__default.default.object
993
+ }),
994
+ slots: PropTypes9__default.default.shape({
995
+ popover: PropTypes9__default.default.elementType,
996
+ popoverContent: PropTypes9__default.default.elementType,
997
+ preview: PropTypes9__default.default.elementType,
998
+ signInButton: PropTypes9__default.default.elementType,
999
+ signOutButton: PropTypes9__default.default.elementType
1000
+ })
1001
+ }),
1002
+ toolbarActions: PropTypes9__default.default.object
1003
+ }),
1004
+ /**
1005
+ * The components used for each slot inside.
1006
+ * @default {}
1007
+ */
1008
+ slots: PropTypes9__default.default.shape({
1009
+ appTitle: PropTypes9__default.default.elementType,
1010
+ toolbarAccount: PropTypes9__default.default.elementType,
1011
+ toolbarActions: PropTypes9__default.default.elementType
1012
+ })
1013
+ };
1014
+ var getItemKind = (item) => {
1015
+ var _a;
1016
+ return (_a = item.kind) != null ? _a : "page";
1017
+ };
1018
+ var isPageItem = (item) => getItemKind(item) === "page";
1019
+ var getItemTitle = (item) => {
1020
+ var _a, _b;
1021
+ return isPageItem(item) ? (_b = (_a = item.title) != null ? _a : item.segment) != null ? _b : "" : item.title;
1022
+ };
1023
+ function buildItemToPathMap(navigation) {
1024
+ const map = /* @__PURE__ */ new Map();
1025
+ const visit = (item, base) => {
1026
+ if (isPageItem(item)) {
1027
+ const path = `${base.startsWith("/") ? base : `/${base}`}${base && base !== "/" && item.segment ? "/" : ""}${item.segment || ""}` || "/";
1028
+ map.set(item, path);
1029
+ if (item.children) {
1030
+ for (const child of item.children) {
1031
+ visit(child, path);
1032
+ }
1033
+ }
1034
+ }
1035
+ };
1036
+ for (const item of navigation) {
1037
+ visit(item, "");
1038
+ }
1039
+ return map;
1040
+ }
1041
+ var itemToPathMapCache = /* @__PURE__ */ new WeakMap();
1042
+ function getItemToPathMap(navigation) {
1043
+ let map = itemToPathMapCache.get(navigation);
1044
+ if (!map) {
1045
+ map = buildItemToPathMap(navigation);
1046
+ itemToPathMapCache.set(navigation, map);
1047
+ }
1048
+ return map;
1049
+ }
1050
+ function buildItemLookup(navigation) {
1051
+ const map = /* @__PURE__ */ new Map();
1052
+ const visit = (item) => {
1053
+ if (isPageItem(item)) {
1054
+ const path = getItemPath(navigation, item);
1055
+ if (map.has(path)) {
1056
+ console.warn(`Duplicate path in navigation: ${path}`);
1057
+ }
1058
+ map.set(path, item);
1059
+ if (item.pattern) {
1060
+ const basePath = item.segment ? path.slice(0, -item.segment.length) : path;
1061
+ map.set(pathToRegexp.pathToRegexp(basePath + item.pattern).regexp, item);
1062
+ }
1063
+ if (item.children) {
1064
+ for (const child of item.children) {
1065
+ visit(child);
1066
+ }
1067
+ }
1068
+ }
1069
+ };
1070
+ for (const item of navigation) {
1071
+ visit(item);
1072
+ }
1073
+ return map;
1074
+ }
1075
+ var itemLookupMapCache = /* @__PURE__ */ new WeakMap();
1076
+ function getItemLookup(navigation) {
1077
+ let map = itemLookupMapCache.get(navigation);
1078
+ if (!map) {
1079
+ map = buildItemLookup(navigation);
1080
+ itemLookupMapCache.set(navigation, map);
1081
+ }
1082
+ return map;
1083
+ }
1084
+ function matchPath(navigation, path) {
1085
+ const lookup = getItemLookup(navigation);
1086
+ for (const [key, item] of lookup.entries()) {
1087
+ if (typeof key === "string" && key === path) {
1088
+ return item;
1089
+ }
1090
+ if (key instanceof RegExp && key.test(path)) {
1091
+ return item;
1092
+ }
1093
+ }
1094
+ return null;
1095
+ }
1096
+ function getItemPath(navigation, item) {
1097
+ const map = getItemToPathMap(navigation);
1098
+ const path = map.get(item);
1099
+ invariant__default.default(path, `Item not found in navigation: ${item.title}`);
1100
+ return path;
1101
+ }
1102
+ function hasSelectedNavigationChildren(navigation, item, activePagePath) {
1103
+ if (item.children) {
1104
+ return item.children.some((nestedItem) => {
1105
+ if (!isPageItem(nestedItem)) {
1106
+ return false;
1107
+ }
1108
+ if (nestedItem.children) {
1109
+ return hasSelectedNavigationChildren(navigation, nestedItem, activePagePath);
1110
+ }
1111
+ return activePagePath === getItemPath(navigation, nestedItem);
1112
+ });
1113
+ }
1114
+ return false;
1115
+ }
1116
+
1117
+ // src/toolpad-core/DashboardLayout/utils.ts
1118
+ function getDrawerSxTransitionMixin(isExpanded, property) {
1119
+ return {
1120
+ transition: (theme) => theme.transitions.create(property, {
1121
+ easing: theme.transitions.easing.sharp,
1122
+ duration: isExpanded ? theme.transitions.duration.enteringScreen : theme.transitions.duration.leavingScreen
1123
+ })
1124
+ };
1125
+ }
1126
+ function getDrawerWidthTransitionMixin(isExpanded) {
1127
+ return chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({}, getDrawerSxTransitionMixin(isExpanded, "width")), {
1128
+ overflowX: "hidden"
1129
+ });
1130
+ }
1131
+ function useActivePage() {
1132
+ var _a;
1133
+ const navigationContext = React16__namespace.useContext(chunkSWAF5R4Y_js.NavigationContext);
1134
+ const routerContext = React16__namespace.useContext(chunkSWAF5R4Y_js.RouterContext);
1135
+ const pathname = (_a = routerContext == null ? void 0 : routerContext.pathname) != null ? _a : "/";
1136
+ const activeItem = matchPath(navigationContext, pathname);
1137
+ const rootItem = matchPath(navigationContext, "/");
1138
+ return React16__namespace.useMemo(() => {
1139
+ if (!activeItem) {
1140
+ return null;
1141
+ }
1142
+ const breadcrumbs = [];
1143
+ if (rootItem) {
1144
+ breadcrumbs.push({
1145
+ title: getItemTitle(rootItem),
1146
+ path: "/"
1147
+ });
1148
+ }
1149
+ const segments = pathname.split("/").filter(Boolean);
1150
+ let prefix = "";
1151
+ for (const segment of segments) {
1152
+ const path = `${prefix}/${segment}`;
1153
+ prefix = path;
1154
+ const item = matchPath(navigationContext, path);
1155
+ if (!item) {
1156
+ continue;
1157
+ }
1158
+ const itemPath = getItemPath(navigationContext, item);
1159
+ const lastCrumb = breadcrumbs[breadcrumbs.length - 1];
1160
+ if ((lastCrumb == null ? void 0 : lastCrumb.path) !== itemPath) {
1161
+ breadcrumbs.push({
1162
+ title: getItemTitle(item),
1163
+ path: itemPath
1164
+ });
1165
+ }
1166
+ }
1167
+ return {
1168
+ title: getItemTitle(activeItem),
1169
+ path: getItemPath(navigationContext, activeItem),
1170
+ breadcrumbs
1171
+ };
1172
+ }, [activeItem, rootItem, pathname, navigationContext]);
1173
+ }
1174
+
1175
+ // src/toolpad-core/DashboardLayout/shared.ts
1176
+ var MINI_DRAWER_WIDTH = 84;
1177
+ var NavigationListItemButton = material.styled(ListItemButton__default.default)(({ theme }) => {
1178
+ var _a, _b, _c, _d, _e, _f, _g;
1179
+ return {
1180
+ borderRadius: 8,
1181
+ "&.Mui-selected": {
1182
+ "& .MuiListItemIcon-root": {
1183
+ color: ((_a = theme.vars) != null ? _a : theme).palette.primary.dark
1184
+ },
1185
+ "& .MuiTypography-root": {
1186
+ color: ((_b = theme.vars) != null ? _b : theme).palette.primary.dark
1187
+ },
1188
+ "& .MuiSvgIcon-root": {
1189
+ color: ((_c = theme.vars) != null ? _c : theme).palette.primary.dark
1190
+ },
1191
+ "& .MuiAvatar-root": {
1192
+ backgroundColor: ((_d = theme.vars) != null ? _d : theme).palette.primary.dark
1193
+ },
1194
+ "& .MuiTouchRipple-child": {
1195
+ backgroundColor: ((_e = theme.vars) != null ? _e : theme).palette.primary.dark
1196
+ }
1197
+ },
1198
+ "& .MuiSvgIcon-root": {
1199
+ color: ((_f = theme.vars) != null ? _f : theme).palette.action.active
1200
+ },
1201
+ "& .MuiAvatar-root": {
1202
+ backgroundColor: ((_g = theme.vars) != null ? _g : theme).palette.action.active
1203
+ }
1204
+ };
1205
+ });
1206
+ var LIST_ITEM_ICON_SIZE = 34;
1207
+ function DashboardSidebarPageItem(props) {
1208
+ var _a;
1209
+ const navigationContext = React16__namespace.useContext(chunkSWAF5R4Y_js.NavigationContext);
1210
+ const pageItemContextProps = React16__namespace.useContext(chunkSWAF5R4Y_js.DashboardSidebarPageItemContext);
1211
+ invariant__default.default(pageItemContextProps, "No navigation page item context provided.");
1212
+ const contextAwareProps = chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues({}, pageItemContextProps), props);
1213
+ const {
1214
+ item,
1215
+ href = getItemPath(navigationContext, item),
1216
+ LinkComponent: LinkComponentProp,
1217
+ expanded = false,
1218
+ selected = false,
1219
+ disabled = false,
1220
+ id,
1221
+ onClick,
1222
+ isMini = false,
1223
+ isSidebarFullyExpanded = true,
1224
+ isSidebarFullyCollapsed = false,
1225
+ renderNestedNavigation
1226
+ } = contextAwareProps;
1227
+ const [hoveredMiniSidebarItemId, setHoveredMiniSidebarItemId] = React16__namespace.useState(
1228
+ null
1229
+ );
1230
+ const handleClick = React16__namespace.useCallback(() => {
1231
+ onClick(id, item);
1232
+ }, [id, item, onClick]);
1233
+ let nestedNavigationCollapseSx = { display: "none" };
1234
+ if (isMini && isSidebarFullyCollapsed) {
1235
+ nestedNavigationCollapseSx = {
1236
+ fontSize: 18,
1237
+ position: "absolute",
1238
+ top: "41.5%",
1239
+ right: "2px",
1240
+ transform: "translateY(-50%) rotate(-90deg)"
1241
+ };
1242
+ } else if (!isMini && isSidebarFullyExpanded) {
1243
+ nestedNavigationCollapseSx = {
1244
+ ml: 0.5,
1245
+ transform: `rotate(${expanded ? 0 : -90}deg)`,
1246
+ transition: (theme) => theme.transitions.create("transform", {
1247
+ easing: theme.transitions.easing.sharp,
1248
+ duration: 100
1249
+ })
1250
+ };
1251
+ }
1252
+ const hasExternalHref = href.startsWith("http://") || href.startsWith("https://");
1253
+ const LinkComponent = LinkComponentProp != null ? LinkComponentProp : hasExternalHref ? "a" : Link2;
1254
+ const title = getItemTitle(item);
1255
+ const listItem = /* @__PURE__ */ jsxRuntime.jsxs(
1256
+ ListItem__default.default,
1257
+ chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({}, item.children && isMini ? {
1258
+ onMouseEnter: () => {
1259
+ setHoveredMiniSidebarItemId(id);
1260
+ },
1261
+ onMouseLeave: () => {
1262
+ setHoveredMiniSidebarItemId(null);
1263
+ }
1264
+ } : {}), {
1265
+ sx: {
1266
+ py: 0,
1267
+ px: 1,
1268
+ overflowX: "hidden"
1269
+ },
1270
+ children: [
1271
+ /* @__PURE__ */ jsxRuntime.jsxs(
1272
+ NavigationListItemButton,
1273
+ chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues({
1274
+ selected,
1275
+ disabled,
1276
+ sx: {
1277
+ px: 1.4,
1278
+ height: isMini ? 60 : 48
1279
+ }
1280
+ }, item.children && !isMini ? {
1281
+ onClick: handleClick
1282
+ } : {}), !item.children ? chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({
1283
+ LinkComponent
1284
+ }, hasExternalHref ? {
1285
+ target: "_blank",
1286
+ rel: "noopener noreferrer"
1287
+ } : {}), {
1288
+ href,
1289
+ onClick: handleClick
1290
+ }) : {}), {
1291
+ children: [
1292
+ item.icon || isMini ? /* @__PURE__ */ jsxRuntime.jsxs(
1293
+ Box4__default.default,
1294
+ {
1295
+ sx: isMini ? {
1296
+ position: "absolute",
1297
+ left: "50%",
1298
+ top: "calc(50% - 6px)",
1299
+ transform: "translate(-50%, -50%)"
1300
+ } : {},
1301
+ children: [
1302
+ /* @__PURE__ */ jsxRuntime.jsxs(
1303
+ ListItemIcon__default.default,
1304
+ {
1305
+ sx: {
1306
+ display: "flex",
1307
+ alignItems: "center",
1308
+ justifyContent: "center",
1309
+ minWidth: LIST_ITEM_ICON_SIZE
1310
+ },
1311
+ children: [
1312
+ (_a = item.icon) != null ? _a : null,
1313
+ !item.icon && isMini ? /* @__PURE__ */ jsxRuntime.jsx(
1314
+ Avatar__default.default,
1315
+ {
1316
+ sx: {
1317
+ width: LIST_ITEM_ICON_SIZE - 7,
1318
+ height: LIST_ITEM_ICON_SIZE - 7,
1319
+ fontSize: 12
1320
+ },
1321
+ children: title.split(" ").slice(0, 2).map((titleWord) => titleWord.charAt(0).toUpperCase())
1322
+ }
1323
+ ) : null
1324
+ ]
1325
+ }
1326
+ ),
1327
+ isMini ? /* @__PURE__ */ jsxRuntime.jsx(
1328
+ Typography__default.default,
1329
+ {
1330
+ variant: "caption",
1331
+ sx: {
1332
+ position: "absolute",
1333
+ bottom: -18,
1334
+ left: "50%",
1335
+ transform: "translateX(-50%)",
1336
+ fontSize: 10,
1337
+ fontWeight: 500,
1338
+ textAlign: "center",
1339
+ whiteSpace: "nowrap",
1340
+ overflow: "hidden",
1341
+ textOverflow: "ellipsis",
1342
+ maxWidth: MINI_DRAWER_WIDTH - 28
1343
+ },
1344
+ children: title
1345
+ }
1346
+ ) : null
1347
+ ]
1348
+ }
1349
+ ) : null,
1350
+ !isMini ? /* @__PURE__ */ jsxRuntime.jsx(
1351
+ ListItemText__default.default,
1352
+ {
1353
+ primary: title,
1354
+ sx: {
1355
+ ml: 1.2,
1356
+ whiteSpace: "nowrap",
1357
+ zIndex: 1
1358
+ }
1359
+ }
1360
+ ) : null,
1361
+ item.action && !isMini && isSidebarFullyExpanded ? item.action : null,
1362
+ item.children ? /* @__PURE__ */ jsxRuntime.jsx(ExpandMoreIcon__default.default, { sx: nestedNavigationCollapseSx }) : null
1363
+ ]
1364
+ })
1365
+ ),
1366
+ item.children && isMini ? /* @__PURE__ */ jsxRuntime.jsx(Grow__default.default, { in: id === hoveredMiniSidebarItemId, children: /* @__PURE__ */ jsxRuntime.jsx(
1367
+ Box4__default.default,
1368
+ {
1369
+ sx: {
1370
+ position: "fixed",
1371
+ left: MINI_DRAWER_WIDTH - 2,
1372
+ pl: "6px"
1373
+ },
1374
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1375
+ Paper__default.default,
1376
+ {
1377
+ sx: {
1378
+ pt: 0.5,
1379
+ pb: 0.5,
1380
+ transform: "translateY(calc(50% - 30px))"
1381
+ },
1382
+ children: renderNestedNavigation(item.children)
1383
+ }
1384
+ )
1385
+ }
1386
+ ) }) : null
1387
+ ]
1388
+ })
1389
+ );
1390
+ return /* @__PURE__ */ jsxRuntime.jsxs(React16__namespace.Fragment, { children: [
1391
+ listItem,
1392
+ item.children && !isMini ? /* @__PURE__ */ jsxRuntime.jsx(Collapse__default.default, { in: expanded, timeout: "auto", unmountOnExit: true, children: renderNestedNavigation(item.children) }) : null
1393
+ ] }, id);
1394
+ }
1395
+ DashboardSidebarPageItem.propTypes = {
1396
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
1397
+ // │ These PropTypes are generated from the TypeScript type definitions. │
1398
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
1399
+ // └─────────────────────────────────────────────────────────────────────┘
1400
+ /**
1401
+ * If `true`, the item is disabled.
1402
+ * @default false
1403
+ */
1404
+ disabled: PropTypes9__default.default.bool,
1405
+ /**
1406
+ * If `true`, expands any nested navigation in the item, otherwise collapse it.
1407
+ * @default false
1408
+ */
1409
+ expanded: PropTypes9__default.default.bool,
1410
+ /**
1411
+ * Link `href` for when the item is rendered as a link.
1412
+ * @default getItemPath(navigationContext, item)
1413
+ */
1414
+ href: PropTypes9__default.default.string,
1415
+ /**
1416
+ * Navigation page item definition.
1417
+ */
1418
+ item: PropTypes9__default.default.shape({
1419
+ action: PropTypes9__default.default.node,
1420
+ children: PropTypes9__default.default.arrayOf(
1421
+ PropTypes9__default.default.oneOfType([
1422
+ PropTypes9__default.default.object,
1423
+ PropTypes9__default.default.shape({
1424
+ kind: PropTypes9__default.default.oneOf(["header"]).isRequired,
1425
+ title: PropTypes9__default.default.string.isRequired
1426
+ }),
1427
+ PropTypes9__default.default.shape({
1428
+ kind: PropTypes9__default.default.oneOf(["divider"]).isRequired
1429
+ })
1430
+ ]).isRequired
1431
+ ),
1432
+ icon: PropTypes9__default.default.node,
1433
+ kind: PropTypes9__default.default.oneOf(["page"]),
1434
+ pattern: PropTypes9__default.default.string,
1435
+ segment: PropTypes9__default.default.string,
1436
+ title: PropTypes9__default.default.string
1437
+ }).isRequired,
1438
+ /**
1439
+ * The component used to render the item as a link.
1440
+ * @default Link
1441
+ */
1442
+ LinkComponent: PropTypes9__default.default.elementType,
1443
+ /**
1444
+ * Use to apply selected styling.
1445
+ * @default false
1446
+ */
1447
+ selected: PropTypes9__default.default.bool
1448
+ };
1449
+ function DashboardSidebarSubNavigationPageItem({
1450
+ id,
1451
+ item,
1452
+ isExpanded,
1453
+ onClick,
1454
+ depth,
1455
+ onLinkClick,
1456
+ isMini,
1457
+ isFullyExpanded,
1458
+ isFullyCollapsed,
1459
+ sidebarExpandedWidth,
1460
+ renderPageItem
1461
+ }) {
1462
+ const navigationContext = React16__namespace.useContext(chunkSWAF5R4Y_js.NavigationContext);
1463
+ const activePage = useActivePage();
1464
+ const isActive = !!activePage && activePage.path === getItemPath(navigationContext, item);
1465
+ const isSelected = activePage && item.children && isMini ? hasSelectedNavigationChildren(navigationContext, item, activePage.path) : isActive && !item.children;
1466
+ const pageItemContextProps = React16__namespace.useMemo(
1467
+ () => ({
1468
+ expanded: isExpanded,
1469
+ selected: isSelected,
1470
+ id,
1471
+ onClick,
1472
+ isMini,
1473
+ isSidebarFullyExpanded: isFullyExpanded,
1474
+ isSidebarFullyCollapsed: isFullyCollapsed,
1475
+ renderNestedNavigation: () => {
1476
+ var _a;
1477
+ return /* @__PURE__ */ jsxRuntime.jsx(
1478
+ DashboardSidebarSubNavigation,
1479
+ {
1480
+ subNavigation: (_a = item.children) != null ? _a : [],
1481
+ depth: depth + 1,
1482
+ onLinkClick,
1483
+ isPopover: isMini,
1484
+ sidebarExpandedWidth
1485
+ }
1486
+ );
1487
+ }
1488
+ }),
1489
+ [
1490
+ depth,
1491
+ id,
1492
+ isExpanded,
1493
+ isFullyCollapsed,
1494
+ isFullyExpanded,
1495
+ isMini,
1496
+ isSelected,
1497
+ item.children,
1498
+ onClick,
1499
+ onLinkClick,
1500
+ sidebarExpandedWidth
1501
+ ]
1502
+ );
1503
+ return /* @__PURE__ */ jsxRuntime.jsx(chunkSWAF5R4Y_js.DashboardSidebarPageItemContext.Provider, { value: pageItemContextProps, children: renderPageItem ? renderPageItem(item, { mini: isMini }) : /* @__PURE__ */ jsxRuntime.jsx(DashboardSidebarPageItem, { item }) });
1504
+ }
1505
+ function DashboardSidebarSubNavigation({
1506
+ subNavigation,
1507
+ depth = 0,
1508
+ onLinkClick,
1509
+ isMini = false,
1510
+ isPopover = false,
1511
+ isFullyExpanded = true,
1512
+ isFullyCollapsed = false,
1513
+ hasDrawerTransitions = false,
1514
+ sidebarExpandedWidth,
1515
+ renderPageItem
1516
+ }) {
1517
+ const navigationContext = React16__namespace.useContext(chunkSWAF5R4Y_js.NavigationContext);
1518
+ const activePage = useActivePage();
1519
+ const initialExpandedItemIds = React16__namespace.useMemo(
1520
+ () => subNavigation.map((navigationItem, navigationItemIndex) => ({
1521
+ navigationItem,
1522
+ originalIndex: navigationItemIndex
1523
+ })).filter(
1524
+ ({ navigationItem }) => isPageItem(navigationItem) && !!activePage && hasSelectedNavigationChildren(navigationContext, navigationItem, activePage.path)
1525
+ ).map(({ originalIndex }) => `page-${depth}-${originalIndex}`),
1526
+ [activePage, depth, navigationContext, subNavigation]
1527
+ );
1528
+ const [expandedItemIds, setExpandedItemIds] = React16__namespace.useState(initialExpandedItemIds);
1529
+ const handlePageItemClick = React16__namespace.useCallback(
1530
+ (itemId, item) => {
1531
+ if (item.children && !isMini) {
1532
+ setExpandedItemIds(
1533
+ (previousValue) => previousValue.includes(itemId) ? previousValue.filter((previousValueItemId) => previousValueItemId !== itemId) : [...previousValue, itemId]
1534
+ );
1535
+ } else if (!item.children) {
1536
+ onLinkClick();
1537
+ }
1538
+ },
1539
+ [isMini, onLinkClick]
1540
+ );
1541
+ return /* @__PURE__ */ jsxRuntime.jsx(
1542
+ List__default.default,
1543
+ {
1544
+ sx: {
1545
+ padding: 0,
1546
+ mt: isPopover && depth === 1 ? 0.5 : 0,
1547
+ mb: depth === 0 && !isPopover ? 4 : 0.5,
1548
+ pl: (isPopover ? 1 : 2) * (isPopover ? depth - 1 : depth),
1549
+ minWidth: isPopover && depth === 1 ? 240 : "auto",
1550
+ width: isMini ? MINI_DRAWER_WIDTH : "auto"
1551
+ },
1552
+ children: subNavigation.map((navigationItem, navigationItemIndex) => {
1553
+ if (navigationItem.kind === "header") {
1554
+ return /* @__PURE__ */ jsxRuntime.jsx(
1555
+ ListSubheader__default.default,
1556
+ {
1557
+ sx: chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({
1558
+ fontSize: 12,
1559
+ fontWeight: "700",
1560
+ height: isMini ? 0 : 40
1561
+ }, hasDrawerTransitions ? getDrawerSxTransitionMixin(isFullyExpanded, "height") : {}), {
1562
+ px: 2,
1563
+ minWidth: sidebarExpandedWidth,
1564
+ overflow: "hidden",
1565
+ textOverflow: "ellipsis",
1566
+ whiteSpace: "nowrap",
1567
+ zIndex: 2
1568
+ }),
1569
+ children: getItemTitle(navigationItem)
1570
+ },
1571
+ `subheader-${depth}-${navigationItemIndex}`
1572
+ );
1573
+ }
1574
+ if (navigationItem.kind === "divider") {
1575
+ const nextItem = subNavigation[navigationItemIndex + 1];
1576
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
1577
+ Divider__default.default,
1578
+ {
1579
+ sx: chunk5B2NQDIH_js.__spreadValues({
1580
+ borderBottomWidth: 2,
1581
+ mx: 1,
1582
+ mt: 1,
1583
+ mb: (nextItem == null ? void 0 : nextItem.kind) === "header" && !isMini ? 0 : 1
1584
+ }, hasDrawerTransitions ? getDrawerSxTransitionMixin(isFullyExpanded, "margin") : {})
1585
+ }
1586
+ ) }, `divider-${depth}-${navigationItemIndex}`);
1587
+ }
1588
+ const pageItemId = `page-${depth}-${navigationItemIndex}`;
1589
+ return /* @__PURE__ */ jsxRuntime.jsx(
1590
+ DashboardSidebarSubNavigationPageItem,
1591
+ {
1592
+ id: pageItemId,
1593
+ item: navigationItem,
1594
+ isExpanded: expandedItemIds.includes(pageItemId),
1595
+ onClick: handlePageItemClick,
1596
+ depth,
1597
+ onLinkClick,
1598
+ isMini,
1599
+ isFullyExpanded,
1600
+ isFullyCollapsed,
1601
+ sidebarExpandedWidth,
1602
+ renderPageItem
1603
+ },
1604
+ pageItemId
1605
+ );
1606
+ })
1607
+ }
1608
+ );
1609
+ }
1610
+ function DashboardLayout(props) {
1611
+ var _a, _b;
1612
+ const {
1613
+ children,
1614
+ branding,
1615
+ navigation: navigationProp,
1616
+ defaultSidebarCollapsed = false,
1617
+ disableCollapsibleSidebar = false,
1618
+ hideNavigation = false,
1619
+ sidebarExpandedWidth = 320,
1620
+ renderPageItem,
1621
+ slots,
1622
+ slotProps,
1623
+ sx
1624
+ } = props;
1625
+ if (navigationProp && process.env.NODE_ENV !== "production") {
1626
+ chunkBN55HN4U_js.warnOnce(
1627
+ "The navigation prop in the DashboardLayout component is deprecated and will eventually be removed. Set the navigation prop in the AppProvider instead (https://mui.com/toolpad/core/react-app-provider/#navigation)."
1628
+ );
1629
+ }
1630
+ const theme = styles.useTheme();
1631
+ const navigationContext = React16__namespace.useContext(chunkSWAF5R4Y_js.NavigationContext);
1632
+ const appWindowContext = React16__namespace.useContext(chunkSWAF5R4Y_js.WindowContext);
1633
+ const navigation = navigationProp != null ? navigationProp : navigationContext;
1634
+ const [isDesktopNavigationExpanded, setIsDesktopNavigationExpanded] = React16__namespace.useState(!defaultSidebarCollapsed);
1635
+ const [isMobileNavigationExpanded, setIsMobileNavigationExpanded] = React16__namespace.useState(false);
1636
+ const isOverSmViewport = useMediaQuery__default.default(
1637
+ theme.breakpoints.up("sm"),
1638
+ appWindowContext && {
1639
+ matchMedia: appWindowContext.matchMedia
1640
+ }
1641
+ );
1642
+ const isOverMdViewport = useMediaQuery__default.default(
1643
+ theme.breakpoints.up("md"),
1644
+ appWindowContext && {
1645
+ matchMedia: appWindowContext.matchMedia
1646
+ }
1647
+ );
1648
+ const isNavigationExpanded = isOverMdViewport ? isDesktopNavigationExpanded : isMobileNavigationExpanded;
1649
+ const setIsNavigationExpanded = React16__namespace.useCallback(
1650
+ (newExpanded) => {
1651
+ if (isOverMdViewport) {
1652
+ setIsDesktopNavigationExpanded(newExpanded);
1653
+ } else {
1654
+ setIsMobileNavigationExpanded(newExpanded);
1655
+ }
1656
+ },
1657
+ [isOverMdViewport]
1658
+ );
1659
+ const [isNavigationFullyExpanded, setIsNavigationFullyExpanded] = React16__namespace.useState(isNavigationExpanded);
1660
+ const [isNavigationFullyCollapsed, setIsNavigationFullyCollapsed] = React16__namespace.useState(!isNavigationExpanded);
1661
+ React16__namespace.useEffect(() => {
1662
+ if (isNavigationExpanded) {
1663
+ const drawerWidthTransitionTimeout = setTimeout(() => {
1664
+ setIsNavigationFullyExpanded(true);
1665
+ }, theme.transitions.duration.enteringScreen);
1666
+ return () => clearTimeout(drawerWidthTransitionTimeout);
1667
+ }
1668
+ setIsNavigationFullyExpanded(false);
1669
+ return () => {
1670
+ };
1671
+ }, [isNavigationExpanded, theme]);
1672
+ React16__namespace.useEffect(() => {
1673
+ if (!isNavigationExpanded) {
1674
+ const drawerWidthTransitionTimeout = setTimeout(() => {
1675
+ setIsNavigationFullyCollapsed(true);
1676
+ }, theme.transitions.duration.leavingScreen);
1677
+ return () => clearTimeout(drawerWidthTransitionTimeout);
1678
+ }
1679
+ setIsNavigationFullyCollapsed(false);
1680
+ return () => {
1681
+ };
1682
+ }, [isNavigationExpanded, theme]);
1683
+ const handleSetNavigationExpanded = React16__namespace.useCallback(
1684
+ (newExpanded) => () => {
1685
+ setIsNavigationExpanded(newExpanded);
1686
+ },
1687
+ [setIsNavigationExpanded]
1688
+ );
1689
+ const handleToggleHeaderMenu = React16__namespace.useCallback(
1690
+ (isExpanded) => {
1691
+ setIsNavigationExpanded(isExpanded);
1692
+ },
1693
+ [setIsNavigationExpanded]
1694
+ );
1695
+ const handleNavigationLinkClick = React16__namespace.useCallback(() => {
1696
+ setIsMobileNavigationExpanded(false);
1697
+ }, [setIsMobileNavigationExpanded]);
1698
+ const isDesktopMini = !disableCollapsibleSidebar && !isDesktopNavigationExpanded;
1699
+ const isMobileMini = !disableCollapsibleSidebar && !isMobileNavigationExpanded;
1700
+ const hasDrawerTransitions = isOverSmViewport && (!disableCollapsibleSidebar || isOverMdViewport);
1701
+ const SidebarFooterSlot = (_a = slots == null ? void 0 : slots.sidebarFooter) != null ? _a : null;
1702
+ const HeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : DashboardHeader;
1703
+ const headerSlotProps = React16__namespace.useMemo(
1704
+ () => chunk5B2NQDIH_js.__spreadValues({
1705
+ branding,
1706
+ menuOpen: isNavigationExpanded,
1707
+ onToggleMenu: handleToggleHeaderMenu,
1708
+ hideMenuButton: hideNavigation || isOverMdViewport && disableCollapsibleSidebar,
1709
+ slots: {
1710
+ appTitle: slots == null ? void 0 : slots.appTitle,
1711
+ toolbarActions: slots == null ? void 0 : slots.toolbarActions,
1712
+ toolbarAccount: slots == null ? void 0 : slots.toolbarAccount
1713
+ },
1714
+ slotProps: {
1715
+ appTitle: slotProps == null ? void 0 : slotProps.appTitle,
1716
+ toolbarActions: slotProps == null ? void 0 : slotProps.toolbarActions,
1717
+ toolbarAccount: slotProps == null ? void 0 : slotProps.toolbarAccount
1718
+ }
1719
+ }, slotProps == null ? void 0 : slotProps.header),
1720
+ [
1721
+ branding,
1722
+ isNavigationExpanded,
1723
+ handleToggleHeaderMenu,
1724
+ hideNavigation,
1725
+ isOverMdViewport,
1726
+ disableCollapsibleSidebar,
1727
+ slotProps,
1728
+ slots
1729
+ ]
1730
+ );
1731
+ const getDrawerContent = React16__namespace.useCallback(
1732
+ (isMini, viewport) => {
1733
+ var _a2;
1734
+ return /* @__PURE__ */ jsxRuntime.jsxs(React16__namespace.Fragment, { children: [
1735
+ /* @__PURE__ */ jsxRuntime.jsx(Toolbar2__default.default, {}),
1736
+ /* @__PURE__ */ jsxRuntime.jsxs(
1737
+ Box4__default.default,
1738
+ {
1739
+ component: "nav",
1740
+ "aria-label": `${viewport.charAt(0).toUpperCase()}${viewport.slice(1)}`,
1741
+ sx: chunk5B2NQDIH_js.__spreadValues({
1742
+ height: "100%",
1743
+ display: "flex",
1744
+ flexDirection: "column",
1745
+ justifyContent: "space-between",
1746
+ overflow: "auto",
1747
+ scrollbarGutter: isMini ? "stable" : "auto",
1748
+ overflowX: "hidden",
1749
+ pt: ((_a2 = navigation[0]) == null ? void 0 : _a2.kind) === "header" && !isMini ? 0 : 2
1750
+ }, hasDrawerTransitions ? getDrawerSxTransitionMixin(isNavigationFullyExpanded, "padding") : {}),
1751
+ children: [
1752
+ /* @__PURE__ */ jsxRuntime.jsx(
1753
+ DashboardSidebarSubNavigation,
1754
+ {
1755
+ subNavigation: navigation,
1756
+ onLinkClick: handleNavigationLinkClick,
1757
+ isMini,
1758
+ isFullyExpanded: isNavigationFullyExpanded,
1759
+ isFullyCollapsed: isNavigationFullyCollapsed,
1760
+ hasDrawerTransitions,
1761
+ sidebarExpandedWidth,
1762
+ renderPageItem
1763
+ }
1764
+ ),
1765
+ SidebarFooterSlot ? /* @__PURE__ */ jsxRuntime.jsx(SidebarFooterSlot, chunk5B2NQDIH_js.__spreadValues({ mini: isMini }, slotProps == null ? void 0 : slotProps.sidebarFooter)) : null
1766
+ ]
1767
+ }
1768
+ )
1769
+ ] });
1770
+ },
1771
+ [
1772
+ SidebarFooterSlot,
1773
+ handleNavigationLinkClick,
1774
+ hasDrawerTransitions,
1775
+ isNavigationFullyCollapsed,
1776
+ isNavigationFullyExpanded,
1777
+ navigation,
1778
+ sidebarExpandedWidth,
1779
+ renderPageItem,
1780
+ slotProps == null ? void 0 : slotProps.sidebarFooter
1781
+ ]
1782
+ );
1783
+ const getDrawerSharedSx = React16__namespace.useCallback(
1784
+ (isMini, isTemporary) => {
1785
+ const drawerWidth = isMini ? MINI_DRAWER_WIDTH : sidebarExpandedWidth;
1786
+ return chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues(chunk5B2NQDIH_js.__spreadValues({
1787
+ displayPrint: "none",
1788
+ width: drawerWidth,
1789
+ flexShrink: 0
1790
+ }, getDrawerWidthTransitionMixin(isNavigationExpanded)), isTemporary ? { position: "absolute" } : {}), {
1791
+ [`& .MuiDrawer-paper`]: chunk5B2NQDIH_js.__spreadValues({
1792
+ position: "absolute",
1793
+ width: drawerWidth,
1794
+ boxSizing: "border-box",
1795
+ backgroundImage: "none"
1796
+ }, getDrawerWidthTransitionMixin(isNavigationExpanded))
1797
+ });
1798
+ },
1799
+ [isNavigationExpanded, sidebarExpandedWidth]
1800
+ );
1801
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1802
+ Box4__default.default,
1803
+ {
1804
+ sx: chunk5B2NQDIH_js.__spreadValues({
1805
+ position: "relative",
1806
+ display: "flex",
1807
+ overflow: "hidden",
1808
+ height: "100vh",
1809
+ width: "100vw"
1810
+ }, sx),
1811
+ children: [
1812
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderSlot, chunk5B2NQDIH_js.__spreadValues({}, headerSlotProps)),
1813
+ !hideNavigation ? /* @__PURE__ */ jsxRuntime.jsxs(React16__namespace.Fragment, { children: [
1814
+ /* @__PURE__ */ jsxRuntime.jsx(
1815
+ Drawer__default.default,
1816
+ {
1817
+ container: appWindowContext == null ? void 0 : appWindowContext.document.body,
1818
+ variant: "temporary",
1819
+ open: isMobileNavigationExpanded,
1820
+ onClose: handleSetNavigationExpanded(false),
1821
+ ModalProps: {
1822
+ keepMounted: true
1823
+ // Better open performance on mobile.
1824
+ },
1825
+ sx: chunk5B2NQDIH_js.__spreadValues({
1826
+ display: {
1827
+ xs: "block",
1828
+ sm: disableCollapsibleSidebar ? "block" : "none",
1829
+ md: "none"
1830
+ }
1831
+ }, getDrawerSharedSx(false, true)),
1832
+ children: getDrawerContent(false, "phone")
1833
+ }
1834
+ ),
1835
+ /* @__PURE__ */ jsxRuntime.jsx(
1836
+ Drawer__default.default,
1837
+ {
1838
+ variant: "permanent",
1839
+ sx: chunk5B2NQDIH_js.__spreadValues({
1840
+ display: {
1841
+ xs: "none",
1842
+ sm: disableCollapsibleSidebar ? "none" : "block",
1843
+ md: "none"
1844
+ }
1845
+ }, getDrawerSharedSx(isMobileMini, false)),
1846
+ children: getDrawerContent(isMobileMini, "tablet")
1847
+ }
1848
+ ),
1849
+ /* @__PURE__ */ jsxRuntime.jsx(
1850
+ Drawer__default.default,
1851
+ {
1852
+ variant: "permanent",
1853
+ sx: chunk5B2NQDIH_js.__spreadValues({
1854
+ display: { xs: "none", md: "block" }
1855
+ }, getDrawerSharedSx(isDesktopMini, false)),
1856
+ children: getDrawerContent(isDesktopMini, "desktop")
1857
+ }
1858
+ )
1859
+ ] }) : null,
1860
+ /* @__PURE__ */ jsxRuntime.jsxs(
1861
+ Box4__default.default,
1862
+ {
1863
+ sx: {
1864
+ display: "flex",
1865
+ flexDirection: "column",
1866
+ flex: 1,
1867
+ minWidth: 0
1868
+ },
1869
+ children: [
1870
+ /* @__PURE__ */ jsxRuntime.jsx(Toolbar2__default.default, { sx: { displayPrint: "none" } }),
1871
+ /* @__PURE__ */ jsxRuntime.jsx(
1872
+ Box4__default.default,
1873
+ {
1874
+ component: "main",
1875
+ sx: {
1876
+ display: "flex",
1877
+ flexDirection: "column",
1878
+ flex: 1,
1879
+ overflow: "auto"
1880
+ },
1881
+ children
1882
+ }
1883
+ )
1884
+ ]
1885
+ }
1886
+ )
1887
+ ]
1888
+ }
1889
+ );
1890
+ }
1891
+ DashboardLayout.propTypes = {
1892
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
1893
+ // │ These PropTypes are generated from the TypeScript type definitions. │
1894
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
1895
+ // └─────────────────────────────────────────────────────────────────────┘
1896
+ /**
1897
+ * Branding options for the dashboard.
1898
+ * @default null
1899
+ */
1900
+ branding: PropTypes9__default.default.shape({
1901
+ homeUrl: PropTypes9__default.default.string,
1902
+ logo: PropTypes9__default.default.node,
1903
+ title: PropTypes9__default.default.string
1904
+ }),
1905
+ /**
1906
+ * The content of the dashboard.
1907
+ */
1908
+ children: PropTypes9__default.default.node,
1909
+ /**
1910
+ * Whether the sidebar should start collapsed in desktop size screens.
1911
+ * @default false
1912
+ */
1913
+ defaultSidebarCollapsed: PropTypes9__default.default.bool,
1914
+ /**
1915
+ * Whether the sidebar should not be collapsible to a mini variant in desktop and tablet viewports.
1916
+ * @default false
1917
+ */
1918
+ disableCollapsibleSidebar: PropTypes9__default.default.bool,
1919
+ /**
1920
+ * Whether the navigation bar and menu icon should be hidden.
1921
+ * @default false
1922
+ */
1923
+ hideNavigation: PropTypes9__default.default.bool,
1924
+ /**
1925
+ * Navigation definition for the dashboard. [Find out more](https://mui.com/toolpad/core/react-dashboard-layout/#navigation).
1926
+ * @default []
1927
+ * @deprecated Set the navigation in the [AppProvider](https://mui.com/toolpad/core/react-app-provider/#navigation) instead.
1928
+ */
1929
+ navigation: PropTypes9__default.default.arrayOf(
1930
+ PropTypes9__default.default.oneOfType([
1931
+ PropTypes9__default.default.shape({
1932
+ action: PropTypes9__default.default.node,
1933
+ children: PropTypes9__default.default.arrayOf(
1934
+ PropTypes9__default.default.oneOfType([
1935
+ PropTypes9__default.default.object,
1936
+ PropTypes9__default.default.shape({
1937
+ kind: PropTypes9__default.default.oneOf(["header"]).isRequired,
1938
+ title: PropTypes9__default.default.string.isRequired
1939
+ }),
1940
+ PropTypes9__default.default.shape({
1941
+ kind: PropTypes9__default.default.oneOf(["divider"]).isRequired
1942
+ })
1943
+ ]).isRequired
1944
+ ),
1945
+ icon: PropTypes9__default.default.node,
1946
+ kind: PropTypes9__default.default.oneOf(["page"]),
1947
+ pattern: PropTypes9__default.default.string,
1948
+ segment: PropTypes9__default.default.string,
1949
+ title: PropTypes9__default.default.string
1950
+ }),
1951
+ PropTypes9__default.default.shape({
1952
+ kind: PropTypes9__default.default.oneOf(["header"]).isRequired,
1953
+ title: PropTypes9__default.default.string.isRequired
1954
+ }),
1955
+ PropTypes9__default.default.shape({
1956
+ kind: PropTypes9__default.default.oneOf(["divider"]).isRequired
1957
+ })
1958
+ ]).isRequired
1959
+ ),
1960
+ /**
1961
+ * Render each page item.
1962
+ *
1963
+ * @param {NavigationPageItem} item
1964
+ * @param {{ mini: boolean }} params
1965
+ * @returns {ReactNode}
1966
+ */
1967
+ renderPageItem: PropTypes9__default.default.func,
1968
+ /**
1969
+ * Width of the sidebar when expanded.
1970
+ * @default 320
1971
+ */
1972
+ sidebarExpandedWidth: PropTypes9__default.default.oneOfType([PropTypes9__default.default.number, PropTypes9__default.default.string]),
1973
+ /**
1974
+ * The props used for each slot inside.
1975
+ * @default {}
1976
+ */
1977
+ slotProps: PropTypes9__default.default.shape({
1978
+ appTitle: PropTypes9__default.default.shape({
1979
+ branding: PropTypes9__default.default.shape({
1980
+ homeUrl: PropTypes9__default.default.string,
1981
+ logo: PropTypes9__default.default.node,
1982
+ title: PropTypes9__default.default.string
1983
+ })
1984
+ }),
1985
+ header: PropTypes9__default.default.shape({
1986
+ branding: PropTypes9__default.default.shape({
1987
+ homeUrl: PropTypes9__default.default.string,
1988
+ logo: PropTypes9__default.default.node,
1989
+ title: PropTypes9__default.default.string
1990
+ }),
1991
+ hideMenuButton: PropTypes9__default.default.bool,
1992
+ menuOpen: PropTypes9__default.default.bool.isRequired,
1993
+ onToggleMenu: PropTypes9__default.default.func.isRequired,
1994
+ slotProps: PropTypes9__default.default.shape({
1995
+ appTitle: PropTypes9__default.default.object,
1996
+ toolbarAccount: PropTypes9__default.default.object,
1997
+ toolbarActions: PropTypes9__default.default.object
1998
+ }),
1999
+ slots: PropTypes9__default.default.shape({
2000
+ appTitle: PropTypes9__default.default.elementType,
2001
+ toolbarAccount: PropTypes9__default.default.elementType,
2002
+ toolbarActions: PropTypes9__default.default.elementType
2003
+ })
2004
+ }),
2005
+ sidebarFooter: PropTypes9__default.default.shape({
2006
+ mini: PropTypes9__default.default.bool.isRequired
2007
+ }),
2008
+ toolbarAccount: PropTypes9__default.default.shape({
2009
+ localeText: PropTypes9__default.default.object,
2010
+ slotProps: PropTypes9__default.default.shape({
2011
+ popover: PropTypes9__default.default.object,
2012
+ popoverContent: PropTypes9__default.default.object,
2013
+ preview: PropTypes9__default.default.object,
2014
+ signInButton: PropTypes9__default.default.object,
2015
+ signOutButton: PropTypes9__default.default.object
2016
+ }),
2017
+ slots: PropTypes9__default.default.shape({
2018
+ popover: PropTypes9__default.default.elementType,
2019
+ popoverContent: PropTypes9__default.default.elementType,
2020
+ preview: PropTypes9__default.default.elementType,
2021
+ signInButton: PropTypes9__default.default.elementType,
2022
+ signOutButton: PropTypes9__default.default.elementType
2023
+ })
2024
+ }),
2025
+ toolbarActions: PropTypes9__default.default.object
2026
+ }),
2027
+ /**
2028
+ * The components used for each slot inside.
2029
+ * @default {}
2030
+ */
2031
+ slots: PropTypes9__default.default.shape({
2032
+ appTitle: PropTypes9__default.default.elementType,
2033
+ header: PropTypes9__default.default.elementType,
2034
+ sidebarFooter: PropTypes9__default.default.elementType,
2035
+ toolbarAccount: PropTypes9__default.default.elementType,
2036
+ toolbarActions: PropTypes9__default.default.elementType
2037
+ }),
2038
+ /**
2039
+ * The system prop that allows defining system overrides as well as additional CSS styles.
2040
+ */
2041
+ sx: PropTypes9__default.default.oneOfType([
2042
+ PropTypes9__default.default.arrayOf(PropTypes9__default.default.oneOfType([PropTypes9__default.default.func, PropTypes9__default.default.object, PropTypes9__default.default.bool])),
2043
+ PropTypes9__default.default.func,
2044
+ PropTypes9__default.default.object
2045
+ ])
2046
+ };
2047
+ var PageHeaderToolbarRoot = material.styled("div")(({ theme }) => ({
2048
+ display: "flex",
2049
+ flexDirection: "row",
2050
+ gap: theme.spacing(1),
2051
+ // Ensure the toolbar is always on the right side, even after wrapping
2052
+ marginLeft: "auto"
2053
+ }));
2054
+ function PageHeaderToolbar(props) {
2055
+ return /* @__PURE__ */ jsxRuntime.jsx(PageHeaderToolbarRoot, chunk5B2NQDIH_js.__spreadValues({}, props));
2056
+ }
2057
+ PageHeaderToolbar.propTypes = {
2058
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
2059
+ // │ These PropTypes are generated from the TypeScript type definitions. │
2060
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
2061
+ // └─────────────────────────────────────────────────────────────────────┘
2062
+ /**
2063
+ * @ignore
2064
+ */
2065
+ children: PropTypes9__default.default.node
2066
+ };
2067
+ var PageContentHeader = material.styled("div")(({ theme }) => ({
2068
+ display: "flex",
2069
+ flexDirection: "row",
2070
+ justifyContent: "space-between",
2071
+ gap: theme.spacing(2)
2072
+ }));
2073
+ function PageHeader(props) {
2074
+ var _a, _b, _c, _d, _e;
2075
+ const { breadcrumbs, title } = props;
2076
+ const activePage = useActivePage();
2077
+ const resolvedBreadcrumbs = (_a = breadcrumbs != null ? breadcrumbs : activePage == null ? void 0 : activePage.breadcrumbs) != null ? _a : [];
2078
+ const resolvedTitle = (_b = title != null ? title : activePage == null ? void 0 : activePage.title) != null ? _b : "";
2079
+ const ToolbarComponent = (_d = (_c = props == null ? void 0 : props.slots) == null ? void 0 : _c.toolbar) != null ? _d : PageHeaderToolbar;
2080
+ const toolbarSlotProps = useSlotProps__default.default({
2081
+ elementType: ToolbarComponent,
2082
+ ownerState: props,
2083
+ externalSlotProps: (_e = props == null ? void 0 : props.slotProps) == null ? void 0 : _e.toolbar,
2084
+ additionalProps: {}
2085
+ });
2086
+ return /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { children: [
2087
+ /* @__PURE__ */ jsxRuntime.jsx(Breadcrumbs__default.default, { "aria-label": "breadcrumb", children: resolvedBreadcrumbs ? resolvedBreadcrumbs.map((item, index) => {
2088
+ return item.path ? /* @__PURE__ */ jsxRuntime.jsx(
2089
+ Link4__default.default,
2090
+ {
2091
+ component: Link2,
2092
+ underline: "hover",
2093
+ color: "inherit",
2094
+ href: item.path,
2095
+ children: getItemTitle(item)
2096
+ },
2097
+ index
2098
+ ) : /* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { color: "text.primary", children: getItemTitle(item) }, index);
2099
+ }) : null }),
2100
+ /* @__PURE__ */ jsxRuntime.jsxs(PageContentHeader, { children: [
2101
+ resolvedTitle ? /* @__PURE__ */ jsxRuntime.jsx(Typography__default.default, { variant: "h4", children: resolvedTitle }) : null,
2102
+ /* @__PURE__ */ jsxRuntime.jsx(ToolbarComponent, chunk5B2NQDIH_js.__spreadValues({}, toolbarSlotProps))
2103
+ ] })
2104
+ ] });
2105
+ }
2106
+ PageHeader.propTypes = {
2107
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
2108
+ // │ These PropTypes are generated from the TypeScript type definitions. │
2109
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
2110
+ // └─────────────────────────────────────────────────────────────────────┘
2111
+ /**
2112
+ * The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
2113
+ */
2114
+ breadcrumbs: PropTypes9__default.default.arrayOf(
2115
+ PropTypes9__default.default.shape({
2116
+ path: PropTypes9__default.default.string,
2117
+ title: PropTypes9__default.default.string.isRequired
2118
+ })
2119
+ ),
2120
+ /**
2121
+ * The props used for each slot inside.
2122
+ */
2123
+ slotProps: PropTypes9__default.default.shape({
2124
+ toolbar: PropTypes9__default.default.shape({
2125
+ children: PropTypes9__default.default.node
2126
+ }).isRequired
2127
+ }),
2128
+ /**
2129
+ * The components used for each slot inside.
2130
+ */
2131
+ slots: PropTypes9__default.default.shape({
2132
+ toolbar: PropTypes9__default.default.elementType
2133
+ }),
2134
+ /**
2135
+ * The title of the page. Leave blank to use the active page title.
2136
+ */
2137
+ title: PropTypes9__default.default.string
2138
+ };
2139
+ function PageContainer(props) {
2140
+ var _b;
2141
+ const _a = props, { children, breadcrumbs, slots, slotProps, title } = _a, rest = chunk5B2NQDIH_js.__objRest(_a, ["children", "breadcrumbs", "slots", "slotProps", "title"]);
2142
+ const PageHeaderSlot = (_b = slots == null ? void 0 : slots.header) != null ? _b : PageHeader;
2143
+ return /* @__PURE__ */ jsxRuntime.jsx(Container__default.default, chunk5B2NQDIH_js.__spreadProps(chunk5B2NQDIH_js.__spreadValues({}, rest), { sx: chunk5B2NQDIH_js.__spreadValues({ flex: 1, display: "flex", flexDirection: "column" }, rest.sx), children: /* @__PURE__ */ jsxRuntime.jsxs(Stack__default.default, { sx: { flex: 1, my: 2 }, spacing: 2, children: [
2144
+ /* @__PURE__ */ jsxRuntime.jsx(PageHeaderSlot, chunk5B2NQDIH_js.__spreadValues({ title, breadcrumbs }, slotProps == null ? void 0 : slotProps.header)),
2145
+ /* @__PURE__ */ jsxRuntime.jsx(Box4__default.default, { sx: { flex: 1, display: "flex", flexDirection: "column" }, children })
2146
+ ] }) }));
2147
+ }
2148
+ PageContainer.propTypes = {
2149
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
2150
+ // │ These PropTypes are generated from the TypeScript type definitions. │
2151
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
2152
+ // └─────────────────────────────────────────────────────────────────────┘
2153
+ /**
2154
+ * The breadcrumbs of the page. Leave blank to use the active page breadcrumbs.
2155
+ */
2156
+ breadcrumbs: PropTypes9__default.default.arrayOf(
2157
+ PropTypes9__default.default.shape({
2158
+ path: PropTypes9__default.default.string,
2159
+ title: PropTypes9__default.default.string.isRequired
2160
+ })
2161
+ ),
2162
+ /**
2163
+ * @ignore
2164
+ */
2165
+ children: PropTypes9__default.default.node,
2166
+ /**
2167
+ * The props used for each slot inside.
2168
+ */
2169
+ slotProps: PropTypes9__default.default.shape({
2170
+ header: PropTypes9__default.default.shape({
2171
+ breadcrumbs: PropTypes9__default.default.arrayOf(
2172
+ PropTypes9__default.default.shape({
2173
+ path: PropTypes9__default.default.string,
2174
+ title: PropTypes9__default.default.string.isRequired
2175
+ })
2176
+ ),
2177
+ slotProps: PropTypes9__default.default.shape({
2178
+ toolbar: PropTypes9__default.default.object.isRequired
2179
+ }),
2180
+ slots: PropTypes9__default.default.shape({
2181
+ toolbar: PropTypes9__default.default.elementType
2182
+ }),
2183
+ title: PropTypes9__default.default.string
2184
+ }).isRequired
2185
+ }),
2186
+ /**
2187
+ * The components used for each slot inside.
2188
+ */
2189
+ slots: PropTypes9__default.default.shape({
2190
+ header: PropTypes9__default.default.elementType
2191
+ }),
2192
+ /**
2193
+ * The system prop that allows defining system overrides as well as additional CSS styles.
2194
+ */
2195
+ sx: PropTypes9__default.default.oneOfType([
2196
+ PropTypes9__default.default.arrayOf(PropTypes9__default.default.oneOfType([PropTypes9__default.default.func, PropTypes9__default.default.object, PropTypes9__default.default.bool])),
2197
+ PropTypes9__default.default.func,
2198
+ PropTypes9__default.default.object
2199
+ ]),
2200
+ /**
2201
+ * The title of the page. Leave blank to use the active page title.
2202
+ */
2203
+ title: PropTypes9__default.default.string
2204
+ };
2205
+
2206
+ exports.Account = Account;
2207
+ exports.AccountPopoverFooter = AccountPopoverFooter;
2208
+ exports.AccountPopoverHeader = AccountPopoverHeader;
2209
+ exports.AccountPreview = AccountPreview;
2210
+ exports.AlertDialog = AlertDialog;
2211
+ exports.ConfirmDialog = ConfirmDialog;
2212
+ exports.DashboardHeader = DashboardHeader;
2213
+ exports.DashboardLayout = DashboardLayout;
2214
+ exports.DashboardSidebarPageItem = DashboardSidebarPageItem;
2215
+ exports.PageContainer = PageContainer;
2216
+ exports.PageHeader = PageHeader;
2217
+ exports.PageHeaderToolbar = PageHeaderToolbar;
2218
+ exports.PromptDialog = PromptDialog;
2219
+ exports.SignInButton = SignInButton;
2220
+ exports.SignOutButton = SignOutButton;
2221
+ exports.ThemeSwitcher = ThemeSwitcher;
2222
+ exports.ToolbarActions = ToolbarActions;
2223
+ exports.useActivePage = useActivePage;
2224
+ exports.useDialogs = useDialogs;
2225
+ exports.useNotifications = useNotifications;