@openk9ui/openk9-chatbot 3.1.1-SNAPSHOT → 2026.1.1-SNAPSHOT
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.
- package/dist/SingleMessage-C_7JbDIL.js +4463 -0
- package/dist/components/Chatbot.js +12 -7
- package/dist/components/SingleMessage.js +2 -1
- package/dist/components/Translate.js +20 -9
- package/dist/components/useGenerateResponse.js +20 -4
- package/dist/lib/components/Chatbot.js +22 -6
- package/dist/lib/components/LanguageContext.js +16 -0
- package/dist/lib/components/Search.js +16 -0
- package/dist/lib/components/SingleMessage.js +16 -1
- package/dist/lib/components/Translate.js +36 -9
- package/dist/lib/components/client.js +16 -0
- package/dist/lib/components/styled.js +16 -0
- package/dist/lib/components/useFocusTrap.js +16 -0
- package/dist/lib/components/useGenerateResponse.js +30 -3
- package/dist/lib/components/useLanguage.js +16 -0
- package/dist/lib/main.js +16 -0
- package/dist/src/theme.js +16 -0
- package/dist/types/lib/components/Chatbot.d.ts +1 -0
- package/dist/types/lib/components/Translate.d.ts +2 -1
- package/dist/types/lib/components/client.d.ts +2 -0
- package/package.json +17 -3
- package/dist/SingleMessage-D59l6K_M.js +0 -13752
|
@@ -0,0 +1,4463 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled$2 from "@emotion/styled";
|
|
3
|
+
import { useTheme, Box, CircularProgress, Typography, Chip, IconButton } from "@mui/material";
|
|
4
|
+
import Markdown from "react-markdown";
|
|
5
|
+
import { Translate } from "./components/Translate.js";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import PropTypes from "prop-types";
|
|
9
|
+
import { unstable_createGetCssVar, createSpacing as createSpacing$1, unstable_memoTheme } from "@mui/system";
|
|
10
|
+
import { isValidElementType, Memo, ForwardRef } from "react-is";
|
|
11
|
+
import "@emotion/react";
|
|
12
|
+
function isPlainObject(item) {
|
|
13
|
+
if (typeof item !== "object" || item === null) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
const prototype = Object.getPrototypeOf(item);
|
|
17
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in item) && !(Symbol.iterator in item);
|
|
18
|
+
}
|
|
19
|
+
function deepClone(source) {
|
|
20
|
+
if (/* @__PURE__ */ React.isValidElement(source) || isValidElementType(source) || !isPlainObject(source)) {
|
|
21
|
+
return source;
|
|
22
|
+
}
|
|
23
|
+
const output = {};
|
|
24
|
+
Object.keys(source).forEach((key) => {
|
|
25
|
+
output[key] = deepClone(source[key]);
|
|
26
|
+
});
|
|
27
|
+
return output;
|
|
28
|
+
}
|
|
29
|
+
function deepmerge(target, source, options = {
|
|
30
|
+
clone: true
|
|
31
|
+
}) {
|
|
32
|
+
const output = options.clone ? {
|
|
33
|
+
...target
|
|
34
|
+
} : target;
|
|
35
|
+
if (isPlainObject(target) && isPlainObject(source)) {
|
|
36
|
+
Object.keys(source).forEach((key) => {
|
|
37
|
+
if (/* @__PURE__ */ React.isValidElement(source[key]) || isValidElementType(source[key])) {
|
|
38
|
+
output[key] = source[key];
|
|
39
|
+
} else if (isPlainObject(source[key]) && // Avoid prototype pollution
|
|
40
|
+
Object.prototype.hasOwnProperty.call(target, key) && isPlainObject(target[key])) {
|
|
41
|
+
output[key] = deepmerge(target[key], source[key], options);
|
|
42
|
+
} else if (options.clone) {
|
|
43
|
+
output[key] = isPlainObject(source[key]) ? deepClone(source[key]) : source[key];
|
|
44
|
+
} else {
|
|
45
|
+
output[key] = source[key];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return output;
|
|
50
|
+
}
|
|
51
|
+
function formatMuiErrorMessage(code, ...args) {
|
|
52
|
+
const url = new URL(`https://mui.com/production-error/?code=${code}`);
|
|
53
|
+
args.forEach((arg) => url.searchParams.append("args[]", arg));
|
|
54
|
+
return `Minified MUI error #${code}; visit ${url} for the full message.`;
|
|
55
|
+
}
|
|
56
|
+
function getFunctionComponentName(Component, fallback = "") {
|
|
57
|
+
return Component.displayName || Component.name || fallback;
|
|
58
|
+
}
|
|
59
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
60
|
+
const functionName = getFunctionComponentName(innerType);
|
|
61
|
+
return outerType.displayName || (functionName !== "" ? `${wrapperName}(${functionName})` : wrapperName);
|
|
62
|
+
}
|
|
63
|
+
function getDisplayName(Component) {
|
|
64
|
+
if (Component == null) {
|
|
65
|
+
return void 0;
|
|
66
|
+
}
|
|
67
|
+
if (typeof Component === "string") {
|
|
68
|
+
return Component;
|
|
69
|
+
}
|
|
70
|
+
if (typeof Component === "function") {
|
|
71
|
+
return getFunctionComponentName(Component, "Component");
|
|
72
|
+
}
|
|
73
|
+
if (typeof Component === "object") {
|
|
74
|
+
switch (Component.$$typeof) {
|
|
75
|
+
case ForwardRef:
|
|
76
|
+
return getWrappedName(Component, Component.render, "ForwardRef");
|
|
77
|
+
case Memo:
|
|
78
|
+
return getWrappedName(Component, Component.type, "memo");
|
|
79
|
+
default:
|
|
80
|
+
return void 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return void 0;
|
|
84
|
+
}
|
|
85
|
+
function capitalize(string) {
|
|
86
|
+
if (typeof string !== "string") {
|
|
87
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "MUI: `capitalize(string)` expects a string argument." : formatMuiErrorMessage(7));
|
|
88
|
+
}
|
|
89
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
90
|
+
}
|
|
91
|
+
function resolveProps(defaultProps, props) {
|
|
92
|
+
const output = {
|
|
93
|
+
...props
|
|
94
|
+
};
|
|
95
|
+
for (const key in defaultProps) {
|
|
96
|
+
if (Object.prototype.hasOwnProperty.call(defaultProps, key)) {
|
|
97
|
+
const propName = key;
|
|
98
|
+
if (propName === "components" || propName === "slots") {
|
|
99
|
+
output[propName] = {
|
|
100
|
+
...defaultProps[propName],
|
|
101
|
+
...output[propName]
|
|
102
|
+
};
|
|
103
|
+
} else if (propName === "componentsProps" || propName === "slotProps") {
|
|
104
|
+
const defaultSlotProps = defaultProps[propName];
|
|
105
|
+
const slotProps = props[propName];
|
|
106
|
+
if (!slotProps) {
|
|
107
|
+
output[propName] = defaultSlotProps || {};
|
|
108
|
+
} else if (!defaultSlotProps) {
|
|
109
|
+
output[propName] = slotProps;
|
|
110
|
+
} else {
|
|
111
|
+
output[propName] = {
|
|
112
|
+
...slotProps
|
|
113
|
+
};
|
|
114
|
+
for (const slotKey in defaultSlotProps) {
|
|
115
|
+
if (Object.prototype.hasOwnProperty.call(defaultSlotProps, slotKey)) {
|
|
116
|
+
const slotPropName = slotKey;
|
|
117
|
+
output[propName][slotPropName] = resolveProps(defaultSlotProps[slotPropName], slotProps[slotPropName]);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} else if (output[propName] === void 0) {
|
|
122
|
+
output[propName] = defaultProps[propName];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return output;
|
|
127
|
+
}
|
|
128
|
+
function composeClasses(slots, getUtilityClass, classes = void 0) {
|
|
129
|
+
const output = {};
|
|
130
|
+
for (const slotName in slots) {
|
|
131
|
+
const slot = slots[slotName];
|
|
132
|
+
let buffer = "";
|
|
133
|
+
let start = true;
|
|
134
|
+
for (let i = 0; i < slot.length; i += 1) {
|
|
135
|
+
const value = slot[i];
|
|
136
|
+
if (value) {
|
|
137
|
+
buffer += (start === true ? "" : " ") + getUtilityClass(value);
|
|
138
|
+
start = false;
|
|
139
|
+
if (classes && classes[value]) {
|
|
140
|
+
buffer += " " + classes[value];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
output[slotName] = buffer;
|
|
145
|
+
}
|
|
146
|
+
return output;
|
|
147
|
+
}
|
|
148
|
+
const defaultGenerator = (componentName) => componentName;
|
|
149
|
+
const createClassNameGenerator = () => {
|
|
150
|
+
let generate = defaultGenerator;
|
|
151
|
+
return {
|
|
152
|
+
configure(generator) {
|
|
153
|
+
generate = generator;
|
|
154
|
+
},
|
|
155
|
+
generate(componentName) {
|
|
156
|
+
return generate(componentName);
|
|
157
|
+
},
|
|
158
|
+
reset() {
|
|
159
|
+
generate = defaultGenerator;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
const ClassNameGenerator = createClassNameGenerator();
|
|
164
|
+
const globalStateClasses = {
|
|
165
|
+
active: "active",
|
|
166
|
+
checked: "checked",
|
|
167
|
+
completed: "completed",
|
|
168
|
+
disabled: "disabled",
|
|
169
|
+
error: "error",
|
|
170
|
+
expanded: "expanded",
|
|
171
|
+
focused: "focused",
|
|
172
|
+
focusVisible: "focusVisible",
|
|
173
|
+
open: "open",
|
|
174
|
+
readOnly: "readOnly",
|
|
175
|
+
required: "required",
|
|
176
|
+
selected: "selected"
|
|
177
|
+
};
|
|
178
|
+
function generateUtilityClass(componentName, slot, globalStatePrefix = "Mui") {
|
|
179
|
+
const globalStateClass = globalStateClasses[slot];
|
|
180
|
+
return globalStateClass ? `${globalStatePrefix}-${globalStateClass}` : `${ClassNameGenerator.generate(componentName)}-${slot}`;
|
|
181
|
+
}
|
|
182
|
+
function generateUtilityClasses(componentName, slots, globalStatePrefix = "Mui") {
|
|
183
|
+
const result = {};
|
|
184
|
+
slots.forEach((slot) => {
|
|
185
|
+
result[slot] = generateUtilityClass(componentName, slot, globalStatePrefix);
|
|
186
|
+
});
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
|
|
190
|
+
return Math.max(min, Math.min(val, max));
|
|
191
|
+
}
|
|
192
|
+
function r(e) {
|
|
193
|
+
var t, f, n = "";
|
|
194
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
195
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
196
|
+
var o = e.length;
|
|
197
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
198
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
199
|
+
return n;
|
|
200
|
+
}
|
|
201
|
+
function clsx() {
|
|
202
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
203
|
+
return n;
|
|
204
|
+
}
|
|
205
|
+
function merge(acc, item) {
|
|
206
|
+
if (!item) {
|
|
207
|
+
return acc;
|
|
208
|
+
}
|
|
209
|
+
return deepmerge(acc, item, {
|
|
210
|
+
clone: false
|
|
211
|
+
// No need to clone deep, it's way faster.
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
const responsivePropType = process.env.NODE_ENV !== "production" ? PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.object, PropTypes.array]) : {};
|
|
215
|
+
function sortContainerQueries(theme, css) {
|
|
216
|
+
if (!theme.containerQueries) {
|
|
217
|
+
return css;
|
|
218
|
+
}
|
|
219
|
+
const sorted = Object.keys(css).filter((key) => key.startsWith("@container")).sort((a, b) => {
|
|
220
|
+
var _a, _b;
|
|
221
|
+
const regex = /min-width:\s*([0-9.]+)/;
|
|
222
|
+
return +(((_a = a.match(regex)) == null ? void 0 : _a[1]) || 0) - +(((_b = b.match(regex)) == null ? void 0 : _b[1]) || 0);
|
|
223
|
+
});
|
|
224
|
+
if (!sorted.length) {
|
|
225
|
+
return css;
|
|
226
|
+
}
|
|
227
|
+
return sorted.reduce((acc, key) => {
|
|
228
|
+
const value = css[key];
|
|
229
|
+
delete acc[key];
|
|
230
|
+
acc[key] = value;
|
|
231
|
+
return acc;
|
|
232
|
+
}, {
|
|
233
|
+
...css
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function isCqShorthand(breakpointKeys, value) {
|
|
237
|
+
return value === "@" || value.startsWith("@") && (breakpointKeys.some((key) => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
|
|
238
|
+
}
|
|
239
|
+
function getContainerQuery(theme, shorthand) {
|
|
240
|
+
const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
|
|
241
|
+
if (!matches) {
|
|
242
|
+
if (process.env.NODE_ENV !== "production") {
|
|
243
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The provided shorthand ${`(${shorthand})`} is invalid. The format should be \`@<breakpoint | number>\` or \`@<breakpoint | number>/<container>\`.
|
|
244
|
+
For example, \`@sm\` or \`@600\` or \`@40rem/sidebar\`.` : formatMuiErrorMessage(18, `(${shorthand})`));
|
|
245
|
+
}
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
const [, containerQuery, containerName] = matches;
|
|
249
|
+
const value = Number.isNaN(+containerQuery) ? containerQuery || 0 : +containerQuery;
|
|
250
|
+
return theme.containerQueries(containerName).up(value);
|
|
251
|
+
}
|
|
252
|
+
function cssContainerQueries(themeInput) {
|
|
253
|
+
const toContainerQuery = (mediaQuery, name) => mediaQuery.replace("@media", name ? `@container ${name}` : "@container");
|
|
254
|
+
function attachCq(node2, name) {
|
|
255
|
+
node2.up = (...args) => toContainerQuery(themeInput.breakpoints.up(...args), name);
|
|
256
|
+
node2.down = (...args) => toContainerQuery(themeInput.breakpoints.down(...args), name);
|
|
257
|
+
node2.between = (...args) => toContainerQuery(themeInput.breakpoints.between(...args), name);
|
|
258
|
+
node2.only = (...args) => toContainerQuery(themeInput.breakpoints.only(...args), name);
|
|
259
|
+
node2.not = (...args) => {
|
|
260
|
+
const result = toContainerQuery(themeInput.breakpoints.not(...args), name);
|
|
261
|
+
if (result.includes("not all and")) {
|
|
262
|
+
return result.replace("not all and ", "").replace("min-width:", "width<").replace("max-width:", "width>").replace("and", "or");
|
|
263
|
+
}
|
|
264
|
+
return result;
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
const node = {};
|
|
268
|
+
const containerQueries = (name) => {
|
|
269
|
+
attachCq(node, name);
|
|
270
|
+
return node;
|
|
271
|
+
};
|
|
272
|
+
attachCq(containerQueries);
|
|
273
|
+
return {
|
|
274
|
+
...themeInput,
|
|
275
|
+
containerQueries
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
const values = {
|
|
279
|
+
xs: 0,
|
|
280
|
+
// phone
|
|
281
|
+
sm: 600,
|
|
282
|
+
// tablet
|
|
283
|
+
md: 900,
|
|
284
|
+
// small laptop
|
|
285
|
+
lg: 1200,
|
|
286
|
+
// desktop
|
|
287
|
+
xl: 1536
|
|
288
|
+
// large screen
|
|
289
|
+
};
|
|
290
|
+
const defaultBreakpoints = {
|
|
291
|
+
// Sorted ASC by size. That's important.
|
|
292
|
+
// It can't be configured as it's used statically for propTypes.
|
|
293
|
+
keys: ["xs", "sm", "md", "lg", "xl"],
|
|
294
|
+
up: (key) => `@media (min-width:${values[key]}px)`
|
|
295
|
+
};
|
|
296
|
+
const defaultContainerQueries = {
|
|
297
|
+
containerQueries: (containerName) => ({
|
|
298
|
+
up: (key) => {
|
|
299
|
+
let result = typeof key === "number" ? key : values[key] || key;
|
|
300
|
+
if (typeof result === "number") {
|
|
301
|
+
result = `${result}px`;
|
|
302
|
+
}
|
|
303
|
+
return containerName ? `@container ${containerName} (min-width:${result})` : `@container (min-width:${result})`;
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
};
|
|
307
|
+
function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
308
|
+
const theme = props.theme || {};
|
|
309
|
+
if (Array.isArray(propValue)) {
|
|
310
|
+
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
|
311
|
+
return propValue.reduce((acc, item, index) => {
|
|
312
|
+
acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);
|
|
313
|
+
return acc;
|
|
314
|
+
}, {});
|
|
315
|
+
}
|
|
316
|
+
if (typeof propValue === "object") {
|
|
317
|
+
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
|
318
|
+
return Object.keys(propValue).reduce((acc, breakpoint) => {
|
|
319
|
+
if (isCqShorthand(themeBreakpoints.keys, breakpoint)) {
|
|
320
|
+
const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, breakpoint);
|
|
321
|
+
if (containerKey) {
|
|
322
|
+
acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
|
323
|
+
}
|
|
324
|
+
} else if (Object.keys(themeBreakpoints.values || values).includes(breakpoint)) {
|
|
325
|
+
const mediaKey = themeBreakpoints.up(breakpoint);
|
|
326
|
+
acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
|
327
|
+
} else {
|
|
328
|
+
const cssKey = breakpoint;
|
|
329
|
+
acc[cssKey] = propValue[cssKey];
|
|
330
|
+
}
|
|
331
|
+
return acc;
|
|
332
|
+
}, {});
|
|
333
|
+
}
|
|
334
|
+
const output = styleFromPropValue(propValue);
|
|
335
|
+
return output;
|
|
336
|
+
}
|
|
337
|
+
function createEmptyBreakpointObject(breakpointsInput = {}) {
|
|
338
|
+
var _a;
|
|
339
|
+
const breakpointsInOrder = (_a = breakpointsInput.keys) == null ? void 0 : _a.reduce((acc, key) => {
|
|
340
|
+
const breakpointStyleKey = breakpointsInput.up(key);
|
|
341
|
+
acc[breakpointStyleKey] = {};
|
|
342
|
+
return acc;
|
|
343
|
+
}, {});
|
|
344
|
+
return breakpointsInOrder || {};
|
|
345
|
+
}
|
|
346
|
+
function removeUnusedBreakpoints(breakpointKeys, style2) {
|
|
347
|
+
return breakpointKeys.reduce((acc, key) => {
|
|
348
|
+
const breakpointOutput = acc[key];
|
|
349
|
+
const isBreakpointUnused = !breakpointOutput || Object.keys(breakpointOutput).length === 0;
|
|
350
|
+
if (isBreakpointUnused) {
|
|
351
|
+
delete acc[key];
|
|
352
|
+
}
|
|
353
|
+
return acc;
|
|
354
|
+
}, style2);
|
|
355
|
+
}
|
|
356
|
+
function getPath(obj, path, checkVars = true) {
|
|
357
|
+
if (!path || typeof path !== "string") {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
if (obj && obj.vars && checkVars) {
|
|
361
|
+
const val = `vars.${path}`.split(".").reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
|
|
362
|
+
if (val != null) {
|
|
363
|
+
return val;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return path.split(".").reduce((acc, item) => {
|
|
367
|
+
if (acc && acc[item] != null) {
|
|
368
|
+
return acc[item];
|
|
369
|
+
}
|
|
370
|
+
return null;
|
|
371
|
+
}, obj);
|
|
372
|
+
}
|
|
373
|
+
function getStyleValue(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
|
|
374
|
+
let value;
|
|
375
|
+
if (typeof themeMapping === "function") {
|
|
376
|
+
value = themeMapping(propValueFinal);
|
|
377
|
+
} else if (Array.isArray(themeMapping)) {
|
|
378
|
+
value = themeMapping[propValueFinal] || userValue;
|
|
379
|
+
} else {
|
|
380
|
+
value = getPath(themeMapping, propValueFinal) || userValue;
|
|
381
|
+
}
|
|
382
|
+
if (transform) {
|
|
383
|
+
value = transform(value, userValue, themeMapping);
|
|
384
|
+
}
|
|
385
|
+
return value;
|
|
386
|
+
}
|
|
387
|
+
function style$1(options) {
|
|
388
|
+
const {
|
|
389
|
+
prop,
|
|
390
|
+
cssProperty = options.prop,
|
|
391
|
+
themeKey,
|
|
392
|
+
transform
|
|
393
|
+
} = options;
|
|
394
|
+
const fn = (props) => {
|
|
395
|
+
if (props[prop] == null) {
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
const propValue = props[prop];
|
|
399
|
+
const theme = props.theme;
|
|
400
|
+
const themeMapping = getPath(theme, themeKey) || {};
|
|
401
|
+
const styleFromPropValue = (propValueFinal) => {
|
|
402
|
+
let value = getStyleValue(themeMapping, transform, propValueFinal);
|
|
403
|
+
if (propValueFinal === value && typeof propValueFinal === "string") {
|
|
404
|
+
value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === "default" ? "" : capitalize(propValueFinal)}`, propValueFinal);
|
|
405
|
+
}
|
|
406
|
+
if (cssProperty === false) {
|
|
407
|
+
return value;
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
[cssProperty]: value
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
return handleBreakpoints(props, propValue, styleFromPropValue);
|
|
414
|
+
};
|
|
415
|
+
fn.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
416
|
+
[prop]: responsivePropType
|
|
417
|
+
} : {};
|
|
418
|
+
fn.filterProps = [prop];
|
|
419
|
+
return fn;
|
|
420
|
+
}
|
|
421
|
+
function memoize$1(fn) {
|
|
422
|
+
const cache = {};
|
|
423
|
+
return (arg) => {
|
|
424
|
+
if (cache[arg] === void 0) {
|
|
425
|
+
cache[arg] = fn(arg);
|
|
426
|
+
}
|
|
427
|
+
return cache[arg];
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
const properties = {
|
|
431
|
+
m: "margin",
|
|
432
|
+
p: "padding"
|
|
433
|
+
};
|
|
434
|
+
const directions = {
|
|
435
|
+
t: "Top",
|
|
436
|
+
r: "Right",
|
|
437
|
+
b: "Bottom",
|
|
438
|
+
l: "Left",
|
|
439
|
+
x: ["Left", "Right"],
|
|
440
|
+
y: ["Top", "Bottom"]
|
|
441
|
+
};
|
|
442
|
+
const aliases = {
|
|
443
|
+
marginX: "mx",
|
|
444
|
+
marginY: "my",
|
|
445
|
+
paddingX: "px",
|
|
446
|
+
paddingY: "py"
|
|
447
|
+
};
|
|
448
|
+
const getCssProperties = memoize$1((prop) => {
|
|
449
|
+
if (prop.length > 2) {
|
|
450
|
+
if (aliases[prop]) {
|
|
451
|
+
prop = aliases[prop];
|
|
452
|
+
} else {
|
|
453
|
+
return [prop];
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
const [a, b] = prop.split("");
|
|
457
|
+
const property = properties[a];
|
|
458
|
+
const direction = directions[b] || "";
|
|
459
|
+
return Array.isArray(direction) ? direction.map((dir) => property + dir) : [property + direction];
|
|
460
|
+
});
|
|
461
|
+
const marginKeys = ["m", "mt", "mr", "mb", "ml", "mx", "my", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "marginX", "marginY", "marginInline", "marginInlineStart", "marginInlineEnd", "marginBlock", "marginBlockStart", "marginBlockEnd"];
|
|
462
|
+
const paddingKeys = ["p", "pt", "pr", "pb", "pl", "px", "py", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "paddingX", "paddingY", "paddingInline", "paddingInlineStart", "paddingInlineEnd", "paddingBlock", "paddingBlockStart", "paddingBlockEnd"];
|
|
463
|
+
const spacingKeys = [...marginKeys, ...paddingKeys];
|
|
464
|
+
function createUnaryUnit(theme, themeKey, defaultValue, propName) {
|
|
465
|
+
const themeSpacing = getPath(theme, themeKey, true) ?? defaultValue;
|
|
466
|
+
if (typeof themeSpacing === "number" || typeof themeSpacing === "string") {
|
|
467
|
+
return (val) => {
|
|
468
|
+
if (typeof val === "string") {
|
|
469
|
+
return val;
|
|
470
|
+
}
|
|
471
|
+
if (process.env.NODE_ENV !== "production") {
|
|
472
|
+
if (typeof val !== "number") {
|
|
473
|
+
console.error(`MUI: Expected ${propName} argument to be a number or a string, got ${val}.`);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
if (typeof themeSpacing === "string") {
|
|
477
|
+
return `calc(${val} * ${themeSpacing})`;
|
|
478
|
+
}
|
|
479
|
+
return themeSpacing * val;
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
if (Array.isArray(themeSpacing)) {
|
|
483
|
+
return (val) => {
|
|
484
|
+
if (typeof val === "string") {
|
|
485
|
+
return val;
|
|
486
|
+
}
|
|
487
|
+
const abs = Math.abs(val);
|
|
488
|
+
if (process.env.NODE_ENV !== "production") {
|
|
489
|
+
if (!Number.isInteger(abs)) {
|
|
490
|
+
console.error([`MUI: The \`theme.${themeKey}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${themeKey}\` as a number.`].join("\n"));
|
|
491
|
+
} else if (abs > themeSpacing.length - 1) {
|
|
492
|
+
console.error([`MUI: The value provided (${abs}) overflows.`, `The supported values are: ${JSON.stringify(themeSpacing)}.`, `${abs} > ${themeSpacing.length - 1}, you need to add the missing values.`].join("\n"));
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
const transformed = themeSpacing[abs];
|
|
496
|
+
if (val >= 0) {
|
|
497
|
+
return transformed;
|
|
498
|
+
}
|
|
499
|
+
if (typeof transformed === "number") {
|
|
500
|
+
return -transformed;
|
|
501
|
+
}
|
|
502
|
+
return `-${transformed}`;
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
if (typeof themeSpacing === "function") {
|
|
506
|
+
return themeSpacing;
|
|
507
|
+
}
|
|
508
|
+
if (process.env.NODE_ENV !== "production") {
|
|
509
|
+
console.error([`MUI: The \`theme.${themeKey}\` value (${themeSpacing}) is invalid.`, "It should be a number, an array or a function."].join("\n"));
|
|
510
|
+
}
|
|
511
|
+
return () => void 0;
|
|
512
|
+
}
|
|
513
|
+
function createUnarySpacing(theme) {
|
|
514
|
+
return createUnaryUnit(theme, "spacing", 8, "spacing");
|
|
515
|
+
}
|
|
516
|
+
function getValue(transformer, propValue) {
|
|
517
|
+
if (typeof propValue === "string" || propValue == null) {
|
|
518
|
+
return propValue;
|
|
519
|
+
}
|
|
520
|
+
return transformer(propValue);
|
|
521
|
+
}
|
|
522
|
+
function getStyleFromPropValue(cssProperties, transformer) {
|
|
523
|
+
return (propValue) => cssProperties.reduce((acc, cssProperty) => {
|
|
524
|
+
acc[cssProperty] = getValue(transformer, propValue);
|
|
525
|
+
return acc;
|
|
526
|
+
}, {});
|
|
527
|
+
}
|
|
528
|
+
function resolveCssProperty(props, keys, prop, transformer) {
|
|
529
|
+
if (!keys.includes(prop)) {
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
const cssProperties = getCssProperties(prop);
|
|
533
|
+
const styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
|
|
534
|
+
const propValue = props[prop];
|
|
535
|
+
return handleBreakpoints(props, propValue, styleFromPropValue);
|
|
536
|
+
}
|
|
537
|
+
function style(props, keys) {
|
|
538
|
+
const transformer = createUnarySpacing(props.theme);
|
|
539
|
+
return Object.keys(props).map((prop) => resolveCssProperty(props, keys, prop, transformer)).reduce(merge, {});
|
|
540
|
+
}
|
|
541
|
+
function margin(props) {
|
|
542
|
+
return style(props, marginKeys);
|
|
543
|
+
}
|
|
544
|
+
margin.propTypes = process.env.NODE_ENV !== "production" ? marginKeys.reduce((obj, key) => {
|
|
545
|
+
obj[key] = responsivePropType;
|
|
546
|
+
return obj;
|
|
547
|
+
}, {}) : {};
|
|
548
|
+
margin.filterProps = marginKeys;
|
|
549
|
+
function padding(props) {
|
|
550
|
+
return style(props, paddingKeys);
|
|
551
|
+
}
|
|
552
|
+
padding.propTypes = process.env.NODE_ENV !== "production" ? paddingKeys.reduce((obj, key) => {
|
|
553
|
+
obj[key] = responsivePropType;
|
|
554
|
+
return obj;
|
|
555
|
+
}, {}) : {};
|
|
556
|
+
padding.filterProps = paddingKeys;
|
|
557
|
+
process.env.NODE_ENV !== "production" ? spacingKeys.reduce((obj, key) => {
|
|
558
|
+
obj[key] = responsivePropType;
|
|
559
|
+
return obj;
|
|
560
|
+
}, {}) : {};
|
|
561
|
+
function compose(...styles) {
|
|
562
|
+
const handlers = styles.reduce((acc, style2) => {
|
|
563
|
+
style2.filterProps.forEach((prop) => {
|
|
564
|
+
acc[prop] = style2;
|
|
565
|
+
});
|
|
566
|
+
return acc;
|
|
567
|
+
}, {});
|
|
568
|
+
const fn = (props) => {
|
|
569
|
+
return Object.keys(props).reduce((acc, prop) => {
|
|
570
|
+
if (handlers[prop]) {
|
|
571
|
+
return merge(acc, handlers[prop](props));
|
|
572
|
+
}
|
|
573
|
+
return acc;
|
|
574
|
+
}, {});
|
|
575
|
+
};
|
|
576
|
+
fn.propTypes = process.env.NODE_ENV !== "production" ? styles.reduce((acc, style2) => Object.assign(acc, style2.propTypes), {}) : {};
|
|
577
|
+
fn.filterProps = styles.reduce((acc, style2) => acc.concat(style2.filterProps), []);
|
|
578
|
+
return fn;
|
|
579
|
+
}
|
|
580
|
+
function borderTransform(value) {
|
|
581
|
+
if (typeof value !== "number") {
|
|
582
|
+
return value;
|
|
583
|
+
}
|
|
584
|
+
return `${value}px solid`;
|
|
585
|
+
}
|
|
586
|
+
function createBorderStyle(prop, transform) {
|
|
587
|
+
return style$1({
|
|
588
|
+
prop,
|
|
589
|
+
themeKey: "borders",
|
|
590
|
+
transform
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
const border = createBorderStyle("border", borderTransform);
|
|
594
|
+
const borderTop = createBorderStyle("borderTop", borderTransform);
|
|
595
|
+
const borderRight = createBorderStyle("borderRight", borderTransform);
|
|
596
|
+
const borderBottom = createBorderStyle("borderBottom", borderTransform);
|
|
597
|
+
const borderLeft = createBorderStyle("borderLeft", borderTransform);
|
|
598
|
+
const borderColor = createBorderStyle("borderColor");
|
|
599
|
+
const borderTopColor = createBorderStyle("borderTopColor");
|
|
600
|
+
const borderRightColor = createBorderStyle("borderRightColor");
|
|
601
|
+
const borderBottomColor = createBorderStyle("borderBottomColor");
|
|
602
|
+
const borderLeftColor = createBorderStyle("borderLeftColor");
|
|
603
|
+
const outline = createBorderStyle("outline", borderTransform);
|
|
604
|
+
const outlineColor = createBorderStyle("outlineColor");
|
|
605
|
+
const borderRadius = (props) => {
|
|
606
|
+
if (props.borderRadius !== void 0 && props.borderRadius !== null) {
|
|
607
|
+
const transformer = createUnaryUnit(props.theme, "shape.borderRadius", 4, "borderRadius");
|
|
608
|
+
const styleFromPropValue = (propValue) => ({
|
|
609
|
+
borderRadius: getValue(transformer, propValue)
|
|
610
|
+
});
|
|
611
|
+
return handleBreakpoints(props, props.borderRadius, styleFromPropValue);
|
|
612
|
+
}
|
|
613
|
+
return null;
|
|
614
|
+
};
|
|
615
|
+
borderRadius.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
616
|
+
borderRadius: responsivePropType
|
|
617
|
+
} : {};
|
|
618
|
+
borderRadius.filterProps = ["borderRadius"];
|
|
619
|
+
compose(border, borderTop, borderRight, borderBottom, borderLeft, borderColor, borderTopColor, borderRightColor, borderBottomColor, borderLeftColor, borderRadius, outline, outlineColor);
|
|
620
|
+
const gap = (props) => {
|
|
621
|
+
if (props.gap !== void 0 && props.gap !== null) {
|
|
622
|
+
const transformer = createUnaryUnit(props.theme, "spacing", 8, "gap");
|
|
623
|
+
const styleFromPropValue = (propValue) => ({
|
|
624
|
+
gap: getValue(transformer, propValue)
|
|
625
|
+
});
|
|
626
|
+
return handleBreakpoints(props, props.gap, styleFromPropValue);
|
|
627
|
+
}
|
|
628
|
+
return null;
|
|
629
|
+
};
|
|
630
|
+
gap.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
631
|
+
gap: responsivePropType
|
|
632
|
+
} : {};
|
|
633
|
+
gap.filterProps = ["gap"];
|
|
634
|
+
const columnGap = (props) => {
|
|
635
|
+
if (props.columnGap !== void 0 && props.columnGap !== null) {
|
|
636
|
+
const transformer = createUnaryUnit(props.theme, "spacing", 8, "columnGap");
|
|
637
|
+
const styleFromPropValue = (propValue) => ({
|
|
638
|
+
columnGap: getValue(transformer, propValue)
|
|
639
|
+
});
|
|
640
|
+
return handleBreakpoints(props, props.columnGap, styleFromPropValue);
|
|
641
|
+
}
|
|
642
|
+
return null;
|
|
643
|
+
};
|
|
644
|
+
columnGap.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
645
|
+
columnGap: responsivePropType
|
|
646
|
+
} : {};
|
|
647
|
+
columnGap.filterProps = ["columnGap"];
|
|
648
|
+
const rowGap = (props) => {
|
|
649
|
+
if (props.rowGap !== void 0 && props.rowGap !== null) {
|
|
650
|
+
const transformer = createUnaryUnit(props.theme, "spacing", 8, "rowGap");
|
|
651
|
+
const styleFromPropValue = (propValue) => ({
|
|
652
|
+
rowGap: getValue(transformer, propValue)
|
|
653
|
+
});
|
|
654
|
+
return handleBreakpoints(props, props.rowGap, styleFromPropValue);
|
|
655
|
+
}
|
|
656
|
+
return null;
|
|
657
|
+
};
|
|
658
|
+
rowGap.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
659
|
+
rowGap: responsivePropType
|
|
660
|
+
} : {};
|
|
661
|
+
rowGap.filterProps = ["rowGap"];
|
|
662
|
+
const gridColumn = style$1({
|
|
663
|
+
prop: "gridColumn"
|
|
664
|
+
});
|
|
665
|
+
const gridRow = style$1({
|
|
666
|
+
prop: "gridRow"
|
|
667
|
+
});
|
|
668
|
+
const gridAutoFlow = style$1({
|
|
669
|
+
prop: "gridAutoFlow"
|
|
670
|
+
});
|
|
671
|
+
const gridAutoColumns = style$1({
|
|
672
|
+
prop: "gridAutoColumns"
|
|
673
|
+
});
|
|
674
|
+
const gridAutoRows = style$1({
|
|
675
|
+
prop: "gridAutoRows"
|
|
676
|
+
});
|
|
677
|
+
const gridTemplateColumns = style$1({
|
|
678
|
+
prop: "gridTemplateColumns"
|
|
679
|
+
});
|
|
680
|
+
const gridTemplateRows = style$1({
|
|
681
|
+
prop: "gridTemplateRows"
|
|
682
|
+
});
|
|
683
|
+
const gridTemplateAreas = style$1({
|
|
684
|
+
prop: "gridTemplateAreas"
|
|
685
|
+
});
|
|
686
|
+
const gridArea = style$1({
|
|
687
|
+
prop: "gridArea"
|
|
688
|
+
});
|
|
689
|
+
compose(gap, columnGap, rowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea);
|
|
690
|
+
function paletteTransform(value, userValue) {
|
|
691
|
+
if (userValue === "grey") {
|
|
692
|
+
return userValue;
|
|
693
|
+
}
|
|
694
|
+
return value;
|
|
695
|
+
}
|
|
696
|
+
const color = style$1({
|
|
697
|
+
prop: "color",
|
|
698
|
+
themeKey: "palette",
|
|
699
|
+
transform: paletteTransform
|
|
700
|
+
});
|
|
701
|
+
const bgcolor = style$1({
|
|
702
|
+
prop: "bgcolor",
|
|
703
|
+
cssProperty: "backgroundColor",
|
|
704
|
+
themeKey: "palette",
|
|
705
|
+
transform: paletteTransform
|
|
706
|
+
});
|
|
707
|
+
const backgroundColor = style$1({
|
|
708
|
+
prop: "backgroundColor",
|
|
709
|
+
themeKey: "palette",
|
|
710
|
+
transform: paletteTransform
|
|
711
|
+
});
|
|
712
|
+
compose(color, bgcolor, backgroundColor);
|
|
713
|
+
function sizingTransform(value) {
|
|
714
|
+
return value <= 1 && value !== 0 ? `${value * 100}%` : value;
|
|
715
|
+
}
|
|
716
|
+
const width = style$1({
|
|
717
|
+
prop: "width",
|
|
718
|
+
transform: sizingTransform
|
|
719
|
+
});
|
|
720
|
+
const maxWidth = (props) => {
|
|
721
|
+
if (props.maxWidth !== void 0 && props.maxWidth !== null) {
|
|
722
|
+
const styleFromPropValue = (propValue) => {
|
|
723
|
+
var _a, _b, _c, _d, _e;
|
|
724
|
+
const breakpoint = ((_c = (_b = (_a = props.theme) == null ? void 0 : _a.breakpoints) == null ? void 0 : _b.values) == null ? void 0 : _c[propValue]) || values[propValue];
|
|
725
|
+
if (!breakpoint) {
|
|
726
|
+
return {
|
|
727
|
+
maxWidth: sizingTransform(propValue)
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
if (((_e = (_d = props.theme) == null ? void 0 : _d.breakpoints) == null ? void 0 : _e.unit) !== "px") {
|
|
731
|
+
return {
|
|
732
|
+
maxWidth: `${breakpoint}${props.theme.breakpoints.unit}`
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
return {
|
|
736
|
+
maxWidth: breakpoint
|
|
737
|
+
};
|
|
738
|
+
};
|
|
739
|
+
return handleBreakpoints(props, props.maxWidth, styleFromPropValue);
|
|
740
|
+
}
|
|
741
|
+
return null;
|
|
742
|
+
};
|
|
743
|
+
maxWidth.filterProps = ["maxWidth"];
|
|
744
|
+
const minWidth = style$1({
|
|
745
|
+
prop: "minWidth",
|
|
746
|
+
transform: sizingTransform
|
|
747
|
+
});
|
|
748
|
+
const height = style$1({
|
|
749
|
+
prop: "height",
|
|
750
|
+
transform: sizingTransform
|
|
751
|
+
});
|
|
752
|
+
const maxHeight = style$1({
|
|
753
|
+
prop: "maxHeight",
|
|
754
|
+
transform: sizingTransform
|
|
755
|
+
});
|
|
756
|
+
const minHeight = style$1({
|
|
757
|
+
prop: "minHeight",
|
|
758
|
+
transform: sizingTransform
|
|
759
|
+
});
|
|
760
|
+
style$1({
|
|
761
|
+
prop: "size",
|
|
762
|
+
cssProperty: "width",
|
|
763
|
+
transform: sizingTransform
|
|
764
|
+
});
|
|
765
|
+
style$1({
|
|
766
|
+
prop: "size",
|
|
767
|
+
cssProperty: "height",
|
|
768
|
+
transform: sizingTransform
|
|
769
|
+
});
|
|
770
|
+
const boxSizing = style$1({
|
|
771
|
+
prop: "boxSizing"
|
|
772
|
+
});
|
|
773
|
+
compose(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing);
|
|
774
|
+
const defaultSxConfig = {
|
|
775
|
+
// borders
|
|
776
|
+
border: {
|
|
777
|
+
themeKey: "borders",
|
|
778
|
+
transform: borderTransform
|
|
779
|
+
},
|
|
780
|
+
borderTop: {
|
|
781
|
+
themeKey: "borders",
|
|
782
|
+
transform: borderTransform
|
|
783
|
+
},
|
|
784
|
+
borderRight: {
|
|
785
|
+
themeKey: "borders",
|
|
786
|
+
transform: borderTransform
|
|
787
|
+
},
|
|
788
|
+
borderBottom: {
|
|
789
|
+
themeKey: "borders",
|
|
790
|
+
transform: borderTransform
|
|
791
|
+
},
|
|
792
|
+
borderLeft: {
|
|
793
|
+
themeKey: "borders",
|
|
794
|
+
transform: borderTransform
|
|
795
|
+
},
|
|
796
|
+
borderColor: {
|
|
797
|
+
themeKey: "palette"
|
|
798
|
+
},
|
|
799
|
+
borderTopColor: {
|
|
800
|
+
themeKey: "palette"
|
|
801
|
+
},
|
|
802
|
+
borderRightColor: {
|
|
803
|
+
themeKey: "palette"
|
|
804
|
+
},
|
|
805
|
+
borderBottomColor: {
|
|
806
|
+
themeKey: "palette"
|
|
807
|
+
},
|
|
808
|
+
borderLeftColor: {
|
|
809
|
+
themeKey: "palette"
|
|
810
|
+
},
|
|
811
|
+
outline: {
|
|
812
|
+
themeKey: "borders",
|
|
813
|
+
transform: borderTransform
|
|
814
|
+
},
|
|
815
|
+
outlineColor: {
|
|
816
|
+
themeKey: "palette"
|
|
817
|
+
},
|
|
818
|
+
borderRadius: {
|
|
819
|
+
themeKey: "shape.borderRadius",
|
|
820
|
+
style: borderRadius
|
|
821
|
+
},
|
|
822
|
+
// palette
|
|
823
|
+
color: {
|
|
824
|
+
themeKey: "palette",
|
|
825
|
+
transform: paletteTransform
|
|
826
|
+
},
|
|
827
|
+
bgcolor: {
|
|
828
|
+
themeKey: "palette",
|
|
829
|
+
cssProperty: "backgroundColor",
|
|
830
|
+
transform: paletteTransform
|
|
831
|
+
},
|
|
832
|
+
backgroundColor: {
|
|
833
|
+
themeKey: "palette",
|
|
834
|
+
transform: paletteTransform
|
|
835
|
+
},
|
|
836
|
+
// spacing
|
|
837
|
+
p: {
|
|
838
|
+
style: padding
|
|
839
|
+
},
|
|
840
|
+
pt: {
|
|
841
|
+
style: padding
|
|
842
|
+
},
|
|
843
|
+
pr: {
|
|
844
|
+
style: padding
|
|
845
|
+
},
|
|
846
|
+
pb: {
|
|
847
|
+
style: padding
|
|
848
|
+
},
|
|
849
|
+
pl: {
|
|
850
|
+
style: padding
|
|
851
|
+
},
|
|
852
|
+
px: {
|
|
853
|
+
style: padding
|
|
854
|
+
},
|
|
855
|
+
py: {
|
|
856
|
+
style: padding
|
|
857
|
+
},
|
|
858
|
+
padding: {
|
|
859
|
+
style: padding
|
|
860
|
+
},
|
|
861
|
+
paddingTop: {
|
|
862
|
+
style: padding
|
|
863
|
+
},
|
|
864
|
+
paddingRight: {
|
|
865
|
+
style: padding
|
|
866
|
+
},
|
|
867
|
+
paddingBottom: {
|
|
868
|
+
style: padding
|
|
869
|
+
},
|
|
870
|
+
paddingLeft: {
|
|
871
|
+
style: padding
|
|
872
|
+
},
|
|
873
|
+
paddingX: {
|
|
874
|
+
style: padding
|
|
875
|
+
},
|
|
876
|
+
paddingY: {
|
|
877
|
+
style: padding
|
|
878
|
+
},
|
|
879
|
+
paddingInline: {
|
|
880
|
+
style: padding
|
|
881
|
+
},
|
|
882
|
+
paddingInlineStart: {
|
|
883
|
+
style: padding
|
|
884
|
+
},
|
|
885
|
+
paddingInlineEnd: {
|
|
886
|
+
style: padding
|
|
887
|
+
},
|
|
888
|
+
paddingBlock: {
|
|
889
|
+
style: padding
|
|
890
|
+
},
|
|
891
|
+
paddingBlockStart: {
|
|
892
|
+
style: padding
|
|
893
|
+
},
|
|
894
|
+
paddingBlockEnd: {
|
|
895
|
+
style: padding
|
|
896
|
+
},
|
|
897
|
+
m: {
|
|
898
|
+
style: margin
|
|
899
|
+
},
|
|
900
|
+
mt: {
|
|
901
|
+
style: margin
|
|
902
|
+
},
|
|
903
|
+
mr: {
|
|
904
|
+
style: margin
|
|
905
|
+
},
|
|
906
|
+
mb: {
|
|
907
|
+
style: margin
|
|
908
|
+
},
|
|
909
|
+
ml: {
|
|
910
|
+
style: margin
|
|
911
|
+
},
|
|
912
|
+
mx: {
|
|
913
|
+
style: margin
|
|
914
|
+
},
|
|
915
|
+
my: {
|
|
916
|
+
style: margin
|
|
917
|
+
},
|
|
918
|
+
margin: {
|
|
919
|
+
style: margin
|
|
920
|
+
},
|
|
921
|
+
marginTop: {
|
|
922
|
+
style: margin
|
|
923
|
+
},
|
|
924
|
+
marginRight: {
|
|
925
|
+
style: margin
|
|
926
|
+
},
|
|
927
|
+
marginBottom: {
|
|
928
|
+
style: margin
|
|
929
|
+
},
|
|
930
|
+
marginLeft: {
|
|
931
|
+
style: margin
|
|
932
|
+
},
|
|
933
|
+
marginX: {
|
|
934
|
+
style: margin
|
|
935
|
+
},
|
|
936
|
+
marginY: {
|
|
937
|
+
style: margin
|
|
938
|
+
},
|
|
939
|
+
marginInline: {
|
|
940
|
+
style: margin
|
|
941
|
+
},
|
|
942
|
+
marginInlineStart: {
|
|
943
|
+
style: margin
|
|
944
|
+
},
|
|
945
|
+
marginInlineEnd: {
|
|
946
|
+
style: margin
|
|
947
|
+
},
|
|
948
|
+
marginBlock: {
|
|
949
|
+
style: margin
|
|
950
|
+
},
|
|
951
|
+
marginBlockStart: {
|
|
952
|
+
style: margin
|
|
953
|
+
},
|
|
954
|
+
marginBlockEnd: {
|
|
955
|
+
style: margin
|
|
956
|
+
},
|
|
957
|
+
// display
|
|
958
|
+
displayPrint: {
|
|
959
|
+
cssProperty: false,
|
|
960
|
+
transform: (value) => ({
|
|
961
|
+
"@media print": {
|
|
962
|
+
display: value
|
|
963
|
+
}
|
|
964
|
+
})
|
|
965
|
+
},
|
|
966
|
+
display: {},
|
|
967
|
+
overflow: {},
|
|
968
|
+
textOverflow: {},
|
|
969
|
+
visibility: {},
|
|
970
|
+
whiteSpace: {},
|
|
971
|
+
// flexbox
|
|
972
|
+
flexBasis: {},
|
|
973
|
+
flexDirection: {},
|
|
974
|
+
flexWrap: {},
|
|
975
|
+
justifyContent: {},
|
|
976
|
+
alignItems: {},
|
|
977
|
+
alignContent: {},
|
|
978
|
+
order: {},
|
|
979
|
+
flex: {},
|
|
980
|
+
flexGrow: {},
|
|
981
|
+
flexShrink: {},
|
|
982
|
+
alignSelf: {},
|
|
983
|
+
justifyItems: {},
|
|
984
|
+
justifySelf: {},
|
|
985
|
+
// grid
|
|
986
|
+
gap: {
|
|
987
|
+
style: gap
|
|
988
|
+
},
|
|
989
|
+
rowGap: {
|
|
990
|
+
style: rowGap
|
|
991
|
+
},
|
|
992
|
+
columnGap: {
|
|
993
|
+
style: columnGap
|
|
994
|
+
},
|
|
995
|
+
gridColumn: {},
|
|
996
|
+
gridRow: {},
|
|
997
|
+
gridAutoFlow: {},
|
|
998
|
+
gridAutoColumns: {},
|
|
999
|
+
gridAutoRows: {},
|
|
1000
|
+
gridTemplateColumns: {},
|
|
1001
|
+
gridTemplateRows: {},
|
|
1002
|
+
gridTemplateAreas: {},
|
|
1003
|
+
gridArea: {},
|
|
1004
|
+
// positions
|
|
1005
|
+
position: {},
|
|
1006
|
+
zIndex: {
|
|
1007
|
+
themeKey: "zIndex"
|
|
1008
|
+
},
|
|
1009
|
+
top: {},
|
|
1010
|
+
right: {},
|
|
1011
|
+
bottom: {},
|
|
1012
|
+
left: {},
|
|
1013
|
+
// shadows
|
|
1014
|
+
boxShadow: {
|
|
1015
|
+
themeKey: "shadows"
|
|
1016
|
+
},
|
|
1017
|
+
// sizing
|
|
1018
|
+
width: {
|
|
1019
|
+
transform: sizingTransform
|
|
1020
|
+
},
|
|
1021
|
+
maxWidth: {
|
|
1022
|
+
style: maxWidth
|
|
1023
|
+
},
|
|
1024
|
+
minWidth: {
|
|
1025
|
+
transform: sizingTransform
|
|
1026
|
+
},
|
|
1027
|
+
height: {
|
|
1028
|
+
transform: sizingTransform
|
|
1029
|
+
},
|
|
1030
|
+
maxHeight: {
|
|
1031
|
+
transform: sizingTransform
|
|
1032
|
+
},
|
|
1033
|
+
minHeight: {
|
|
1034
|
+
transform: sizingTransform
|
|
1035
|
+
},
|
|
1036
|
+
boxSizing: {},
|
|
1037
|
+
// typography
|
|
1038
|
+
font: {
|
|
1039
|
+
themeKey: "font"
|
|
1040
|
+
},
|
|
1041
|
+
fontFamily: {
|
|
1042
|
+
themeKey: "typography"
|
|
1043
|
+
},
|
|
1044
|
+
fontSize: {
|
|
1045
|
+
themeKey: "typography"
|
|
1046
|
+
},
|
|
1047
|
+
fontStyle: {
|
|
1048
|
+
themeKey: "typography"
|
|
1049
|
+
},
|
|
1050
|
+
fontWeight: {
|
|
1051
|
+
themeKey: "typography"
|
|
1052
|
+
},
|
|
1053
|
+
letterSpacing: {},
|
|
1054
|
+
textTransform: {},
|
|
1055
|
+
lineHeight: {},
|
|
1056
|
+
textAlign: {},
|
|
1057
|
+
typography: {
|
|
1058
|
+
cssProperty: false,
|
|
1059
|
+
themeKey: "typography"
|
|
1060
|
+
}
|
|
1061
|
+
};
|
|
1062
|
+
function objectsHaveSameKeys(...objects) {
|
|
1063
|
+
const allKeys = objects.reduce((keys, object) => keys.concat(Object.keys(object)), []);
|
|
1064
|
+
const union = new Set(allKeys);
|
|
1065
|
+
return objects.every((object) => union.size === Object.keys(object).length);
|
|
1066
|
+
}
|
|
1067
|
+
function callIfFn(maybeFn, arg) {
|
|
1068
|
+
return typeof maybeFn === "function" ? maybeFn(arg) : maybeFn;
|
|
1069
|
+
}
|
|
1070
|
+
function unstable_createStyleFunctionSx() {
|
|
1071
|
+
function getThemeValue(prop, val, theme, config) {
|
|
1072
|
+
const props = {
|
|
1073
|
+
[prop]: val,
|
|
1074
|
+
theme
|
|
1075
|
+
};
|
|
1076
|
+
const options = config[prop];
|
|
1077
|
+
if (!options) {
|
|
1078
|
+
return {
|
|
1079
|
+
[prop]: val
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
const {
|
|
1083
|
+
cssProperty = prop,
|
|
1084
|
+
themeKey,
|
|
1085
|
+
transform,
|
|
1086
|
+
style: style2
|
|
1087
|
+
} = options;
|
|
1088
|
+
if (val == null) {
|
|
1089
|
+
return null;
|
|
1090
|
+
}
|
|
1091
|
+
if (themeKey === "typography" && val === "inherit") {
|
|
1092
|
+
return {
|
|
1093
|
+
[prop]: val
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
const themeMapping = getPath(theme, themeKey) || {};
|
|
1097
|
+
if (style2) {
|
|
1098
|
+
return style2(props);
|
|
1099
|
+
}
|
|
1100
|
+
const styleFromPropValue = (propValueFinal) => {
|
|
1101
|
+
let value = getStyleValue(themeMapping, transform, propValueFinal);
|
|
1102
|
+
if (propValueFinal === value && typeof propValueFinal === "string") {
|
|
1103
|
+
value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === "default" ? "" : capitalize(propValueFinal)}`, propValueFinal);
|
|
1104
|
+
}
|
|
1105
|
+
if (cssProperty === false) {
|
|
1106
|
+
return value;
|
|
1107
|
+
}
|
|
1108
|
+
return {
|
|
1109
|
+
[cssProperty]: value
|
|
1110
|
+
};
|
|
1111
|
+
};
|
|
1112
|
+
return handleBreakpoints(props, val, styleFromPropValue);
|
|
1113
|
+
}
|
|
1114
|
+
function styleFunctionSx2(props) {
|
|
1115
|
+
const {
|
|
1116
|
+
sx,
|
|
1117
|
+
theme = {},
|
|
1118
|
+
nested
|
|
1119
|
+
} = props || {};
|
|
1120
|
+
if (!sx) {
|
|
1121
|
+
return null;
|
|
1122
|
+
}
|
|
1123
|
+
const config = theme.unstable_sxConfig ?? defaultSxConfig;
|
|
1124
|
+
function traverse(sxInput) {
|
|
1125
|
+
let sxObject = sxInput;
|
|
1126
|
+
if (typeof sxInput === "function") {
|
|
1127
|
+
sxObject = sxInput(theme);
|
|
1128
|
+
} else if (typeof sxInput !== "object") {
|
|
1129
|
+
return sxInput;
|
|
1130
|
+
}
|
|
1131
|
+
if (!sxObject) {
|
|
1132
|
+
return null;
|
|
1133
|
+
}
|
|
1134
|
+
const emptyBreakpoints = createEmptyBreakpointObject(theme.breakpoints);
|
|
1135
|
+
const breakpointsKeys = Object.keys(emptyBreakpoints);
|
|
1136
|
+
let css = emptyBreakpoints;
|
|
1137
|
+
Object.keys(sxObject).forEach((styleKey) => {
|
|
1138
|
+
const value = callIfFn(sxObject[styleKey], theme);
|
|
1139
|
+
if (value !== null && value !== void 0) {
|
|
1140
|
+
if (typeof value === "object") {
|
|
1141
|
+
if (config[styleKey]) {
|
|
1142
|
+
css = merge(css, getThemeValue(styleKey, value, theme, config));
|
|
1143
|
+
} else {
|
|
1144
|
+
const breakpointsValues = handleBreakpoints({
|
|
1145
|
+
theme
|
|
1146
|
+
}, value, (x) => ({
|
|
1147
|
+
[styleKey]: x
|
|
1148
|
+
}));
|
|
1149
|
+
if (objectsHaveSameKeys(breakpointsValues, value)) {
|
|
1150
|
+
css[styleKey] = styleFunctionSx2({
|
|
1151
|
+
sx: value,
|
|
1152
|
+
theme,
|
|
1153
|
+
nested: true
|
|
1154
|
+
});
|
|
1155
|
+
} else {
|
|
1156
|
+
css = merge(css, breakpointsValues);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
} else {
|
|
1160
|
+
css = merge(css, getThemeValue(styleKey, value, theme, config));
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
});
|
|
1164
|
+
if (!nested && theme.modularCssLayers) {
|
|
1165
|
+
return {
|
|
1166
|
+
"@layer sx": sortContainerQueries(theme, removeUnusedBreakpoints(breakpointsKeys, css))
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
return sortContainerQueries(theme, removeUnusedBreakpoints(breakpointsKeys, css));
|
|
1170
|
+
}
|
|
1171
|
+
return Array.isArray(sx) ? sx.map(traverse) : traverse(sx);
|
|
1172
|
+
}
|
|
1173
|
+
return styleFunctionSx2;
|
|
1174
|
+
}
|
|
1175
|
+
const styleFunctionSx = unstable_createStyleFunctionSx();
|
|
1176
|
+
styleFunctionSx.filterProps = ["sx"];
|
|
1177
|
+
function clampWrapper(value, min = 0, max = 1) {
|
|
1178
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1179
|
+
if (value < min || value > max) {
|
|
1180
|
+
console.error(`MUI: The value provided ${value} is out of range [${min}, ${max}].`);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
return clamp(value, min, max);
|
|
1184
|
+
}
|
|
1185
|
+
function hexToRgb$1(color2) {
|
|
1186
|
+
color2 = color2.slice(1);
|
|
1187
|
+
const re = new RegExp(`.{1,${color2.length >= 6 ? 2 : 1}}`, "g");
|
|
1188
|
+
let colors = color2.match(re);
|
|
1189
|
+
if (colors && colors[0].length === 1) {
|
|
1190
|
+
colors = colors.map((n) => n + n);
|
|
1191
|
+
}
|
|
1192
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1193
|
+
if (color2.length !== color2.trim().length) {
|
|
1194
|
+
console.error(`MUI: The color: "${color2}" is invalid. Make sure the color input doesn't contain leading/trailing space.`);
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
return colors ? `rgb${colors.length === 4 ? "a" : ""}(${colors.map((n, index) => {
|
|
1198
|
+
return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1e3) / 1e3;
|
|
1199
|
+
}).join(", ")})` : "";
|
|
1200
|
+
}
|
|
1201
|
+
function decomposeColor(color2) {
|
|
1202
|
+
if (color2.type) {
|
|
1203
|
+
return color2;
|
|
1204
|
+
}
|
|
1205
|
+
if (color2.charAt(0) === "#") {
|
|
1206
|
+
return decomposeColor(hexToRgb$1(color2));
|
|
1207
|
+
}
|
|
1208
|
+
const marker = color2.indexOf("(");
|
|
1209
|
+
const type = color2.substring(0, marker);
|
|
1210
|
+
if (!["rgb", "rgba", "hsl", "hsla", "color"].includes(type)) {
|
|
1211
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: Unsupported \`${color2}\` color.
|
|
1212
|
+
The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().` : formatMuiErrorMessage(9, color2));
|
|
1213
|
+
}
|
|
1214
|
+
let values2 = color2.substring(marker + 1, color2.length - 1);
|
|
1215
|
+
let colorSpace;
|
|
1216
|
+
if (type === "color") {
|
|
1217
|
+
values2 = values2.split(" ");
|
|
1218
|
+
colorSpace = values2.shift();
|
|
1219
|
+
if (values2.length === 4 && values2[3].charAt(0) === "/") {
|
|
1220
|
+
values2[3] = values2[3].slice(1);
|
|
1221
|
+
}
|
|
1222
|
+
if (!["srgb", "display-p3", "a98-rgb", "prophoto-rgb", "rec-2020"].includes(colorSpace)) {
|
|
1223
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: unsupported \`${colorSpace}\` color space.
|
|
1224
|
+
The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.` : formatMuiErrorMessage(10, colorSpace));
|
|
1225
|
+
}
|
|
1226
|
+
} else {
|
|
1227
|
+
values2 = values2.split(",");
|
|
1228
|
+
}
|
|
1229
|
+
values2 = values2.map((value) => parseFloat(value));
|
|
1230
|
+
return {
|
|
1231
|
+
type,
|
|
1232
|
+
values: values2,
|
|
1233
|
+
colorSpace
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
const colorChannel = (color2) => {
|
|
1237
|
+
const decomposedColor = decomposeColor(color2);
|
|
1238
|
+
return decomposedColor.values.slice(0, 3).map((val, idx) => decomposedColor.type.includes("hsl") && idx !== 0 ? `${val}%` : val).join(" ");
|
|
1239
|
+
};
|
|
1240
|
+
const private_safeColorChannel = (color2, warning) => {
|
|
1241
|
+
try {
|
|
1242
|
+
return colorChannel(color2);
|
|
1243
|
+
} catch (error) {
|
|
1244
|
+
if (warning && process.env.NODE_ENV !== "production") {
|
|
1245
|
+
console.warn(warning);
|
|
1246
|
+
}
|
|
1247
|
+
return color2;
|
|
1248
|
+
}
|
|
1249
|
+
};
|
|
1250
|
+
function recomposeColor(color2) {
|
|
1251
|
+
const {
|
|
1252
|
+
type,
|
|
1253
|
+
colorSpace
|
|
1254
|
+
} = color2;
|
|
1255
|
+
let {
|
|
1256
|
+
values: values2
|
|
1257
|
+
} = color2;
|
|
1258
|
+
if (type.includes("rgb")) {
|
|
1259
|
+
values2 = values2.map((n, i) => i < 3 ? parseInt(n, 10) : n);
|
|
1260
|
+
} else if (type.includes("hsl")) {
|
|
1261
|
+
values2[1] = `${values2[1]}%`;
|
|
1262
|
+
values2[2] = `${values2[2]}%`;
|
|
1263
|
+
}
|
|
1264
|
+
if (type.includes("color")) {
|
|
1265
|
+
values2 = `${colorSpace} ${values2.join(" ")}`;
|
|
1266
|
+
} else {
|
|
1267
|
+
values2 = `${values2.join(", ")}`;
|
|
1268
|
+
}
|
|
1269
|
+
return `${type}(${values2})`;
|
|
1270
|
+
}
|
|
1271
|
+
function hslToRgb(color2) {
|
|
1272
|
+
color2 = decomposeColor(color2);
|
|
1273
|
+
const {
|
|
1274
|
+
values: values2
|
|
1275
|
+
} = color2;
|
|
1276
|
+
const h = values2[0];
|
|
1277
|
+
const s = values2[1] / 100;
|
|
1278
|
+
const l = values2[2] / 100;
|
|
1279
|
+
const a = s * Math.min(l, 1 - l);
|
|
1280
|
+
const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
1281
|
+
let type = "rgb";
|
|
1282
|
+
const rgb = [Math.round(f(0) * 255), Math.round(f(8) * 255), Math.round(f(4) * 255)];
|
|
1283
|
+
if (color2.type === "hsla") {
|
|
1284
|
+
type += "a";
|
|
1285
|
+
rgb.push(values2[3]);
|
|
1286
|
+
}
|
|
1287
|
+
return recomposeColor({
|
|
1288
|
+
type,
|
|
1289
|
+
values: rgb
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
function getLuminance(color2) {
|
|
1293
|
+
color2 = decomposeColor(color2);
|
|
1294
|
+
let rgb = color2.type === "hsl" || color2.type === "hsla" ? decomposeColor(hslToRgb(color2)).values : color2.values;
|
|
1295
|
+
rgb = rgb.map((val) => {
|
|
1296
|
+
if (color2.type !== "color") {
|
|
1297
|
+
val /= 255;
|
|
1298
|
+
}
|
|
1299
|
+
return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;
|
|
1300
|
+
});
|
|
1301
|
+
return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));
|
|
1302
|
+
}
|
|
1303
|
+
function getContrastRatio(foreground, background) {
|
|
1304
|
+
const lumA = getLuminance(foreground);
|
|
1305
|
+
const lumB = getLuminance(background);
|
|
1306
|
+
return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);
|
|
1307
|
+
}
|
|
1308
|
+
function alpha(color2, value) {
|
|
1309
|
+
color2 = decomposeColor(color2);
|
|
1310
|
+
value = clampWrapper(value);
|
|
1311
|
+
if (color2.type === "rgb" || color2.type === "hsl") {
|
|
1312
|
+
color2.type += "a";
|
|
1313
|
+
}
|
|
1314
|
+
if (color2.type === "color") {
|
|
1315
|
+
color2.values[3] = `/${value}`;
|
|
1316
|
+
} else {
|
|
1317
|
+
color2.values[3] = value;
|
|
1318
|
+
}
|
|
1319
|
+
return recomposeColor(color2);
|
|
1320
|
+
}
|
|
1321
|
+
function private_safeAlpha(color2, value, warning) {
|
|
1322
|
+
try {
|
|
1323
|
+
return alpha(color2, value);
|
|
1324
|
+
} catch (error) {
|
|
1325
|
+
return color2;
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
function darken(color2, coefficient) {
|
|
1329
|
+
color2 = decomposeColor(color2);
|
|
1330
|
+
coefficient = clampWrapper(coefficient);
|
|
1331
|
+
if (color2.type.includes("hsl")) {
|
|
1332
|
+
color2.values[2] *= 1 - coefficient;
|
|
1333
|
+
} else if (color2.type.includes("rgb") || color2.type.includes("color")) {
|
|
1334
|
+
for (let i = 0; i < 3; i += 1) {
|
|
1335
|
+
color2.values[i] *= 1 - coefficient;
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
return recomposeColor(color2);
|
|
1339
|
+
}
|
|
1340
|
+
function private_safeDarken(color2, coefficient, warning) {
|
|
1341
|
+
try {
|
|
1342
|
+
return darken(color2, coefficient);
|
|
1343
|
+
} catch (error) {
|
|
1344
|
+
return color2;
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
function lighten(color2, coefficient) {
|
|
1348
|
+
color2 = decomposeColor(color2);
|
|
1349
|
+
coefficient = clampWrapper(coefficient);
|
|
1350
|
+
if (color2.type.includes("hsl")) {
|
|
1351
|
+
color2.values[2] += (100 - color2.values[2]) * coefficient;
|
|
1352
|
+
} else if (color2.type.includes("rgb")) {
|
|
1353
|
+
for (let i = 0; i < 3; i += 1) {
|
|
1354
|
+
color2.values[i] += (255 - color2.values[i]) * coefficient;
|
|
1355
|
+
}
|
|
1356
|
+
} else if (color2.type.includes("color")) {
|
|
1357
|
+
for (let i = 0; i < 3; i += 1) {
|
|
1358
|
+
color2.values[i] += (1 - color2.values[i]) * coefficient;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
return recomposeColor(color2);
|
|
1362
|
+
}
|
|
1363
|
+
function private_safeLighten(color2, coefficient, warning) {
|
|
1364
|
+
try {
|
|
1365
|
+
return lighten(color2, coefficient);
|
|
1366
|
+
} catch (error) {
|
|
1367
|
+
return color2;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
function emphasize(color2, coefficient = 0.15) {
|
|
1371
|
+
return getLuminance(color2) > 0.5 ? darken(color2, coefficient) : lighten(color2, coefficient);
|
|
1372
|
+
}
|
|
1373
|
+
function private_safeEmphasize(color2, coefficient, warning) {
|
|
1374
|
+
try {
|
|
1375
|
+
return emphasize(color2, coefficient);
|
|
1376
|
+
} catch (error) {
|
|
1377
|
+
return color2;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
const common = {
|
|
1381
|
+
black: "#000",
|
|
1382
|
+
white: "#fff"
|
|
1383
|
+
};
|
|
1384
|
+
const grey = {
|
|
1385
|
+
50: "#fafafa",
|
|
1386
|
+
100: "#f5f5f5",
|
|
1387
|
+
200: "#eeeeee",
|
|
1388
|
+
300: "#e0e0e0",
|
|
1389
|
+
400: "#bdbdbd",
|
|
1390
|
+
500: "#9e9e9e",
|
|
1391
|
+
600: "#757575",
|
|
1392
|
+
700: "#616161",
|
|
1393
|
+
800: "#424242",
|
|
1394
|
+
900: "#212121",
|
|
1395
|
+
A100: "#f5f5f5",
|
|
1396
|
+
A200: "#eeeeee",
|
|
1397
|
+
A400: "#bdbdbd",
|
|
1398
|
+
A700: "#616161"
|
|
1399
|
+
};
|
|
1400
|
+
const purple = {
|
|
1401
|
+
50: "#f3e5f5",
|
|
1402
|
+
200: "#ce93d8",
|
|
1403
|
+
300: "#ba68c8",
|
|
1404
|
+
400: "#ab47bc",
|
|
1405
|
+
500: "#9c27b0",
|
|
1406
|
+
700: "#7b1fa2"
|
|
1407
|
+
};
|
|
1408
|
+
const red = {
|
|
1409
|
+
300: "#e57373",
|
|
1410
|
+
400: "#ef5350",
|
|
1411
|
+
500: "#f44336",
|
|
1412
|
+
700: "#d32f2f",
|
|
1413
|
+
800: "#c62828"
|
|
1414
|
+
};
|
|
1415
|
+
const orange = {
|
|
1416
|
+
300: "#ffb74d",
|
|
1417
|
+
400: "#ffa726",
|
|
1418
|
+
500: "#ff9800",
|
|
1419
|
+
700: "#f57c00",
|
|
1420
|
+
900: "#e65100"
|
|
1421
|
+
};
|
|
1422
|
+
const blue = {
|
|
1423
|
+
50: "#e3f2fd",
|
|
1424
|
+
200: "#90caf9",
|
|
1425
|
+
400: "#42a5f5",
|
|
1426
|
+
700: "#1976d2",
|
|
1427
|
+
800: "#1565c0"
|
|
1428
|
+
};
|
|
1429
|
+
const lightBlue = {
|
|
1430
|
+
300: "#4fc3f7",
|
|
1431
|
+
400: "#29b6f6",
|
|
1432
|
+
500: "#03a9f4",
|
|
1433
|
+
700: "#0288d1",
|
|
1434
|
+
900: "#01579b"
|
|
1435
|
+
};
|
|
1436
|
+
const green = {
|
|
1437
|
+
300: "#81c784",
|
|
1438
|
+
400: "#66bb6a",
|
|
1439
|
+
500: "#4caf50",
|
|
1440
|
+
700: "#388e3c",
|
|
1441
|
+
800: "#2e7d32",
|
|
1442
|
+
900: "#1b5e20"
|
|
1443
|
+
};
|
|
1444
|
+
function getLight() {
|
|
1445
|
+
return {
|
|
1446
|
+
// The colors used to style the text.
|
|
1447
|
+
text: {
|
|
1448
|
+
// The most important text.
|
|
1449
|
+
primary: "rgba(0, 0, 0, 0.87)",
|
|
1450
|
+
// Secondary text.
|
|
1451
|
+
secondary: "rgba(0, 0, 0, 0.6)",
|
|
1452
|
+
// Disabled text have even lower visual prominence.
|
|
1453
|
+
disabled: "rgba(0, 0, 0, 0.38)"
|
|
1454
|
+
},
|
|
1455
|
+
// The color used to divide different elements.
|
|
1456
|
+
divider: "rgba(0, 0, 0, 0.12)",
|
|
1457
|
+
// The background colors used to style the surfaces.
|
|
1458
|
+
// Consistency between these values is important.
|
|
1459
|
+
background: {
|
|
1460
|
+
paper: common.white,
|
|
1461
|
+
default: common.white
|
|
1462
|
+
},
|
|
1463
|
+
// The colors used to style the action elements.
|
|
1464
|
+
action: {
|
|
1465
|
+
// The color of an active action like an icon button.
|
|
1466
|
+
active: "rgba(0, 0, 0, 0.54)",
|
|
1467
|
+
// The color of an hovered action.
|
|
1468
|
+
hover: "rgba(0, 0, 0, 0.04)",
|
|
1469
|
+
hoverOpacity: 0.04,
|
|
1470
|
+
// The color of a selected action.
|
|
1471
|
+
selected: "rgba(0, 0, 0, 0.08)",
|
|
1472
|
+
selectedOpacity: 0.08,
|
|
1473
|
+
// The color of a disabled action.
|
|
1474
|
+
disabled: "rgba(0, 0, 0, 0.26)",
|
|
1475
|
+
// The background color of a disabled action.
|
|
1476
|
+
disabledBackground: "rgba(0, 0, 0, 0.12)",
|
|
1477
|
+
disabledOpacity: 0.38,
|
|
1478
|
+
focus: "rgba(0, 0, 0, 0.12)",
|
|
1479
|
+
focusOpacity: 0.12,
|
|
1480
|
+
activatedOpacity: 0.12
|
|
1481
|
+
}
|
|
1482
|
+
};
|
|
1483
|
+
}
|
|
1484
|
+
const light = getLight();
|
|
1485
|
+
function getDark() {
|
|
1486
|
+
return {
|
|
1487
|
+
text: {
|
|
1488
|
+
primary: common.white,
|
|
1489
|
+
secondary: "rgba(255, 255, 255, 0.7)",
|
|
1490
|
+
disabled: "rgba(255, 255, 255, 0.5)",
|
|
1491
|
+
icon: "rgba(255, 255, 255, 0.5)"
|
|
1492
|
+
},
|
|
1493
|
+
divider: "rgba(255, 255, 255, 0.12)",
|
|
1494
|
+
background: {
|
|
1495
|
+
paper: "#121212",
|
|
1496
|
+
default: "#121212"
|
|
1497
|
+
},
|
|
1498
|
+
action: {
|
|
1499
|
+
active: common.white,
|
|
1500
|
+
hover: "rgba(255, 255, 255, 0.08)",
|
|
1501
|
+
hoverOpacity: 0.08,
|
|
1502
|
+
selected: "rgba(255, 255, 255, 0.16)",
|
|
1503
|
+
selectedOpacity: 0.16,
|
|
1504
|
+
disabled: "rgba(255, 255, 255, 0.3)",
|
|
1505
|
+
disabledBackground: "rgba(255, 255, 255, 0.12)",
|
|
1506
|
+
disabledOpacity: 0.38,
|
|
1507
|
+
focus: "rgba(255, 255, 255, 0.12)",
|
|
1508
|
+
focusOpacity: 0.12,
|
|
1509
|
+
activatedOpacity: 0.24
|
|
1510
|
+
}
|
|
1511
|
+
};
|
|
1512
|
+
}
|
|
1513
|
+
const dark = getDark();
|
|
1514
|
+
function addLightOrDark(intent, direction, shade, tonalOffset) {
|
|
1515
|
+
const tonalOffsetLight = tonalOffset.light || tonalOffset;
|
|
1516
|
+
const tonalOffsetDark = tonalOffset.dark || tonalOffset * 1.5;
|
|
1517
|
+
if (!intent[direction]) {
|
|
1518
|
+
if (intent.hasOwnProperty(shade)) {
|
|
1519
|
+
intent[direction] = intent[shade];
|
|
1520
|
+
} else if (direction === "light") {
|
|
1521
|
+
intent.light = lighten(intent.main, tonalOffsetLight);
|
|
1522
|
+
} else if (direction === "dark") {
|
|
1523
|
+
intent.dark = darken(intent.main, tonalOffsetDark);
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
function getDefaultPrimary(mode = "light") {
|
|
1528
|
+
if (mode === "dark") {
|
|
1529
|
+
return {
|
|
1530
|
+
main: blue[200],
|
|
1531
|
+
light: blue[50],
|
|
1532
|
+
dark: blue[400]
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
return {
|
|
1536
|
+
main: blue[700],
|
|
1537
|
+
light: blue[400],
|
|
1538
|
+
dark: blue[800]
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
function getDefaultSecondary(mode = "light") {
|
|
1542
|
+
if (mode === "dark") {
|
|
1543
|
+
return {
|
|
1544
|
+
main: purple[200],
|
|
1545
|
+
light: purple[50],
|
|
1546
|
+
dark: purple[400]
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
return {
|
|
1550
|
+
main: purple[500],
|
|
1551
|
+
light: purple[300],
|
|
1552
|
+
dark: purple[700]
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
function getDefaultError(mode = "light") {
|
|
1556
|
+
if (mode === "dark") {
|
|
1557
|
+
return {
|
|
1558
|
+
main: red[500],
|
|
1559
|
+
light: red[300],
|
|
1560
|
+
dark: red[700]
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
return {
|
|
1564
|
+
main: red[700],
|
|
1565
|
+
light: red[400],
|
|
1566
|
+
dark: red[800]
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1569
|
+
function getDefaultInfo(mode = "light") {
|
|
1570
|
+
if (mode === "dark") {
|
|
1571
|
+
return {
|
|
1572
|
+
main: lightBlue[400],
|
|
1573
|
+
light: lightBlue[300],
|
|
1574
|
+
dark: lightBlue[700]
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
return {
|
|
1578
|
+
main: lightBlue[700],
|
|
1579
|
+
light: lightBlue[500],
|
|
1580
|
+
dark: lightBlue[900]
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
function getDefaultSuccess(mode = "light") {
|
|
1584
|
+
if (mode === "dark") {
|
|
1585
|
+
return {
|
|
1586
|
+
main: green[400],
|
|
1587
|
+
light: green[300],
|
|
1588
|
+
dark: green[700]
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
return {
|
|
1592
|
+
main: green[800],
|
|
1593
|
+
light: green[500],
|
|
1594
|
+
dark: green[900]
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1597
|
+
function getDefaultWarning(mode = "light") {
|
|
1598
|
+
if (mode === "dark") {
|
|
1599
|
+
return {
|
|
1600
|
+
main: orange[400],
|
|
1601
|
+
light: orange[300],
|
|
1602
|
+
dark: orange[700]
|
|
1603
|
+
};
|
|
1604
|
+
}
|
|
1605
|
+
return {
|
|
1606
|
+
main: "#ed6c02",
|
|
1607
|
+
// closest to orange[800] that pass 3:1.
|
|
1608
|
+
light: orange[500],
|
|
1609
|
+
dark: orange[900]
|
|
1610
|
+
};
|
|
1611
|
+
}
|
|
1612
|
+
function createPalette(palette) {
|
|
1613
|
+
const {
|
|
1614
|
+
mode = "light",
|
|
1615
|
+
contrastThreshold = 3,
|
|
1616
|
+
tonalOffset = 0.2,
|
|
1617
|
+
...other
|
|
1618
|
+
} = palette;
|
|
1619
|
+
const primary = palette.primary || getDefaultPrimary(mode);
|
|
1620
|
+
const secondary = palette.secondary || getDefaultSecondary(mode);
|
|
1621
|
+
const error = palette.error || getDefaultError(mode);
|
|
1622
|
+
const info = palette.info || getDefaultInfo(mode);
|
|
1623
|
+
const success = palette.success || getDefaultSuccess(mode);
|
|
1624
|
+
const warning = palette.warning || getDefaultWarning(mode);
|
|
1625
|
+
function getContrastText(background) {
|
|
1626
|
+
const contrastText = getContrastRatio(background, dark.text.primary) >= contrastThreshold ? dark.text.primary : light.text.primary;
|
|
1627
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1628
|
+
const contrast = getContrastRatio(background, contrastText);
|
|
1629
|
+
if (contrast < 3) {
|
|
1630
|
+
console.error([`MUI: The contrast ratio of ${contrast}:1 for ${contrastText} on ${background}`, "falls below the WCAG recommended absolute minimum contrast ratio of 3:1.", "https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join("\n"));
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
return contrastText;
|
|
1634
|
+
}
|
|
1635
|
+
const augmentColor = ({
|
|
1636
|
+
color: color2,
|
|
1637
|
+
name,
|
|
1638
|
+
mainShade = 500,
|
|
1639
|
+
lightShade = 300,
|
|
1640
|
+
darkShade = 700
|
|
1641
|
+
}) => {
|
|
1642
|
+
color2 = {
|
|
1643
|
+
...color2
|
|
1644
|
+
};
|
|
1645
|
+
if (!color2.main && color2[mainShade]) {
|
|
1646
|
+
color2.main = color2[mainShade];
|
|
1647
|
+
}
|
|
1648
|
+
if (!color2.hasOwnProperty("main")) {
|
|
1649
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ""} provided to augmentColor(color) is invalid.
|
|
1650
|
+
The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : formatMuiErrorMessage(11, name ? ` (${name})` : "", mainShade));
|
|
1651
|
+
}
|
|
1652
|
+
if (typeof color2.main !== "string") {
|
|
1653
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ""} provided to augmentColor(color) is invalid.
|
|
1654
|
+
\`color.main\` should be a string, but \`${JSON.stringify(color2.main)}\` was provided instead.
|
|
1655
|
+
|
|
1656
|
+
Did you intend to use one of the following approaches?
|
|
1657
|
+
|
|
1658
|
+
import { green } from "@mui/material/colors";
|
|
1659
|
+
|
|
1660
|
+
const theme1 = createTheme({ palette: {
|
|
1661
|
+
primary: green,
|
|
1662
|
+
} });
|
|
1663
|
+
|
|
1664
|
+
const theme2 = createTheme({ palette: {
|
|
1665
|
+
primary: { main: green[500] },
|
|
1666
|
+
} });` : formatMuiErrorMessage(12, name ? ` (${name})` : "", JSON.stringify(color2.main)));
|
|
1667
|
+
}
|
|
1668
|
+
addLightOrDark(color2, "light", lightShade, tonalOffset);
|
|
1669
|
+
addLightOrDark(color2, "dark", darkShade, tonalOffset);
|
|
1670
|
+
if (!color2.contrastText) {
|
|
1671
|
+
color2.contrastText = getContrastText(color2.main);
|
|
1672
|
+
}
|
|
1673
|
+
return color2;
|
|
1674
|
+
};
|
|
1675
|
+
let modeHydrated;
|
|
1676
|
+
if (mode === "light") {
|
|
1677
|
+
modeHydrated = getLight();
|
|
1678
|
+
} else if (mode === "dark") {
|
|
1679
|
+
modeHydrated = getDark();
|
|
1680
|
+
}
|
|
1681
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1682
|
+
if (!modeHydrated) {
|
|
1683
|
+
console.error(`MUI: The palette mode \`${mode}\` is not supported.`);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
const paletteOutput = deepmerge({
|
|
1687
|
+
// A collection of common colors.
|
|
1688
|
+
common: {
|
|
1689
|
+
...common
|
|
1690
|
+
},
|
|
1691
|
+
// prevent mutable object.
|
|
1692
|
+
// The palette mode, can be light or dark.
|
|
1693
|
+
mode,
|
|
1694
|
+
// The colors used to represent primary interface elements for a user.
|
|
1695
|
+
primary: augmentColor({
|
|
1696
|
+
color: primary,
|
|
1697
|
+
name: "primary"
|
|
1698
|
+
}),
|
|
1699
|
+
// The colors used to represent secondary interface elements for a user.
|
|
1700
|
+
secondary: augmentColor({
|
|
1701
|
+
color: secondary,
|
|
1702
|
+
name: "secondary",
|
|
1703
|
+
mainShade: "A400",
|
|
1704
|
+
lightShade: "A200",
|
|
1705
|
+
darkShade: "A700"
|
|
1706
|
+
}),
|
|
1707
|
+
// The colors used to represent interface elements that the user should be made aware of.
|
|
1708
|
+
error: augmentColor({
|
|
1709
|
+
color: error,
|
|
1710
|
+
name: "error"
|
|
1711
|
+
}),
|
|
1712
|
+
// The colors used to represent potentially dangerous actions or important messages.
|
|
1713
|
+
warning: augmentColor({
|
|
1714
|
+
color: warning,
|
|
1715
|
+
name: "warning"
|
|
1716
|
+
}),
|
|
1717
|
+
// The colors used to present information to the user that is neutral and not necessarily important.
|
|
1718
|
+
info: augmentColor({
|
|
1719
|
+
color: info,
|
|
1720
|
+
name: "info"
|
|
1721
|
+
}),
|
|
1722
|
+
// The colors used to indicate the successful completion of an action that user triggered.
|
|
1723
|
+
success: augmentColor({
|
|
1724
|
+
color: success,
|
|
1725
|
+
name: "success"
|
|
1726
|
+
}),
|
|
1727
|
+
// The grey colors.
|
|
1728
|
+
grey,
|
|
1729
|
+
// Used by `getContrastText()` to maximize the contrast between
|
|
1730
|
+
// the background and the text.
|
|
1731
|
+
contrastThreshold,
|
|
1732
|
+
// Takes a background color and returns the text color that maximizes the contrast.
|
|
1733
|
+
getContrastText,
|
|
1734
|
+
// Generate a rich color object.
|
|
1735
|
+
augmentColor,
|
|
1736
|
+
// Used by the functions below to shift a color's luminance by approximately
|
|
1737
|
+
// two indexes within its tonal palette.
|
|
1738
|
+
// E.g., shift from Red 500 to Red 300 or Red 700.
|
|
1739
|
+
tonalOffset,
|
|
1740
|
+
// The light and dark mode object.
|
|
1741
|
+
...modeHydrated
|
|
1742
|
+
}, other);
|
|
1743
|
+
return paletteOutput;
|
|
1744
|
+
}
|
|
1745
|
+
function murmur2(str) {
|
|
1746
|
+
var h = 0;
|
|
1747
|
+
var k, i = 0, len = str.length;
|
|
1748
|
+
for (; len >= 4; ++i, len -= 4) {
|
|
1749
|
+
k = str.charCodeAt(i) & 255 | (str.charCodeAt(++i) & 255) << 8 | (str.charCodeAt(++i) & 255) << 16 | (str.charCodeAt(++i) & 255) << 24;
|
|
1750
|
+
k = /* Math.imul(k, m): */
|
|
1751
|
+
(k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16);
|
|
1752
|
+
k ^= /* k >>> r: */
|
|
1753
|
+
k >>> 24;
|
|
1754
|
+
h = /* Math.imul(k, m): */
|
|
1755
|
+
(k & 65535) * 1540483477 + ((k >>> 16) * 59797 << 16) ^ /* Math.imul(h, m): */
|
|
1756
|
+
(h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
|
|
1757
|
+
}
|
|
1758
|
+
switch (len) {
|
|
1759
|
+
case 3:
|
|
1760
|
+
h ^= (str.charCodeAt(i + 2) & 255) << 16;
|
|
1761
|
+
case 2:
|
|
1762
|
+
h ^= (str.charCodeAt(i + 1) & 255) << 8;
|
|
1763
|
+
case 1:
|
|
1764
|
+
h ^= str.charCodeAt(i) & 255;
|
|
1765
|
+
h = /* Math.imul(h, m): */
|
|
1766
|
+
(h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
|
|
1767
|
+
}
|
|
1768
|
+
h ^= h >>> 13;
|
|
1769
|
+
h = /* Math.imul(h, m): */
|
|
1770
|
+
(h & 65535) * 1540483477 + ((h >>> 16) * 59797 << 16);
|
|
1771
|
+
return ((h ^ h >>> 15) >>> 0).toString(36);
|
|
1772
|
+
}
|
|
1773
|
+
var unitlessKeys = {
|
|
1774
|
+
animationIterationCount: 1,
|
|
1775
|
+
aspectRatio: 1,
|
|
1776
|
+
borderImageOutset: 1,
|
|
1777
|
+
borderImageSlice: 1,
|
|
1778
|
+
borderImageWidth: 1,
|
|
1779
|
+
boxFlex: 1,
|
|
1780
|
+
boxFlexGroup: 1,
|
|
1781
|
+
boxOrdinalGroup: 1,
|
|
1782
|
+
columnCount: 1,
|
|
1783
|
+
columns: 1,
|
|
1784
|
+
flex: 1,
|
|
1785
|
+
flexGrow: 1,
|
|
1786
|
+
flexPositive: 1,
|
|
1787
|
+
flexShrink: 1,
|
|
1788
|
+
flexNegative: 1,
|
|
1789
|
+
flexOrder: 1,
|
|
1790
|
+
gridRow: 1,
|
|
1791
|
+
gridRowEnd: 1,
|
|
1792
|
+
gridRowSpan: 1,
|
|
1793
|
+
gridRowStart: 1,
|
|
1794
|
+
gridColumn: 1,
|
|
1795
|
+
gridColumnEnd: 1,
|
|
1796
|
+
gridColumnSpan: 1,
|
|
1797
|
+
gridColumnStart: 1,
|
|
1798
|
+
msGridRow: 1,
|
|
1799
|
+
msGridRowSpan: 1,
|
|
1800
|
+
msGridColumn: 1,
|
|
1801
|
+
msGridColumnSpan: 1,
|
|
1802
|
+
fontWeight: 1,
|
|
1803
|
+
lineHeight: 1,
|
|
1804
|
+
opacity: 1,
|
|
1805
|
+
order: 1,
|
|
1806
|
+
orphans: 1,
|
|
1807
|
+
scale: 1,
|
|
1808
|
+
tabSize: 1,
|
|
1809
|
+
widows: 1,
|
|
1810
|
+
zIndex: 1,
|
|
1811
|
+
zoom: 1,
|
|
1812
|
+
WebkitLineClamp: 1,
|
|
1813
|
+
// SVG-related properties
|
|
1814
|
+
fillOpacity: 1,
|
|
1815
|
+
floodOpacity: 1,
|
|
1816
|
+
stopOpacity: 1,
|
|
1817
|
+
strokeDasharray: 1,
|
|
1818
|
+
strokeDashoffset: 1,
|
|
1819
|
+
strokeMiterlimit: 1,
|
|
1820
|
+
strokeOpacity: 1,
|
|
1821
|
+
strokeWidth: 1
|
|
1822
|
+
};
|
|
1823
|
+
function memoize(fn) {
|
|
1824
|
+
var cache = /* @__PURE__ */ Object.create(null);
|
|
1825
|
+
return function(arg) {
|
|
1826
|
+
if (cache[arg] === void 0) cache[arg] = fn(arg);
|
|
1827
|
+
return cache[arg];
|
|
1828
|
+
};
|
|
1829
|
+
}
|
|
1830
|
+
var hyphenateRegex = /[A-Z]|^ms/g;
|
|
1831
|
+
var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
|
|
1832
|
+
var isCustomProperty = function isCustomProperty2(property) {
|
|
1833
|
+
return property.charCodeAt(1) === 45;
|
|
1834
|
+
};
|
|
1835
|
+
var isProcessableValue = function isProcessableValue2(value) {
|
|
1836
|
+
return value != null && typeof value !== "boolean";
|
|
1837
|
+
};
|
|
1838
|
+
var processStyleName = /* @__PURE__ */ memoize(function(styleName) {
|
|
1839
|
+
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, "-$&").toLowerCase();
|
|
1840
|
+
});
|
|
1841
|
+
var processStyleValue = function processStyleValue2(key, value) {
|
|
1842
|
+
switch (key) {
|
|
1843
|
+
case "animation":
|
|
1844
|
+
case "animationName": {
|
|
1845
|
+
if (typeof value === "string") {
|
|
1846
|
+
return value.replace(animationRegex, function(match, p1, p2) {
|
|
1847
|
+
cursor = {
|
|
1848
|
+
name: p1,
|
|
1849
|
+
styles: p2,
|
|
1850
|
+
next: cursor
|
|
1851
|
+
};
|
|
1852
|
+
return p1;
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === "number" && value !== 0) {
|
|
1858
|
+
return value + "px";
|
|
1859
|
+
}
|
|
1860
|
+
return value;
|
|
1861
|
+
};
|
|
1862
|
+
function handleInterpolation(mergedProps, registered, interpolation) {
|
|
1863
|
+
if (interpolation == null) {
|
|
1864
|
+
return "";
|
|
1865
|
+
}
|
|
1866
|
+
var componentSelector = interpolation;
|
|
1867
|
+
if (componentSelector.__emotion_styles !== void 0) {
|
|
1868
|
+
return componentSelector;
|
|
1869
|
+
}
|
|
1870
|
+
switch (typeof interpolation) {
|
|
1871
|
+
case "boolean": {
|
|
1872
|
+
return "";
|
|
1873
|
+
}
|
|
1874
|
+
case "object": {
|
|
1875
|
+
var keyframes = interpolation;
|
|
1876
|
+
if (keyframes.anim === 1) {
|
|
1877
|
+
cursor = {
|
|
1878
|
+
name: keyframes.name,
|
|
1879
|
+
styles: keyframes.styles,
|
|
1880
|
+
next: cursor
|
|
1881
|
+
};
|
|
1882
|
+
return keyframes.name;
|
|
1883
|
+
}
|
|
1884
|
+
var serializedStyles = interpolation;
|
|
1885
|
+
if (serializedStyles.styles !== void 0) {
|
|
1886
|
+
var next = serializedStyles.next;
|
|
1887
|
+
if (next !== void 0) {
|
|
1888
|
+
while (next !== void 0) {
|
|
1889
|
+
cursor = {
|
|
1890
|
+
name: next.name,
|
|
1891
|
+
styles: next.styles,
|
|
1892
|
+
next: cursor
|
|
1893
|
+
};
|
|
1894
|
+
next = next.next;
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
var styles = serializedStyles.styles + ";";
|
|
1898
|
+
return styles;
|
|
1899
|
+
}
|
|
1900
|
+
return createStringFromObject(mergedProps, registered, interpolation);
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
var asString = interpolation;
|
|
1904
|
+
{
|
|
1905
|
+
return asString;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
function createStringFromObject(mergedProps, registered, obj) {
|
|
1909
|
+
var string = "";
|
|
1910
|
+
if (Array.isArray(obj)) {
|
|
1911
|
+
for (var i = 0; i < obj.length; i++) {
|
|
1912
|
+
string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
|
|
1913
|
+
}
|
|
1914
|
+
} else {
|
|
1915
|
+
for (var key in obj) {
|
|
1916
|
+
var value = obj[key];
|
|
1917
|
+
if (typeof value !== "object") {
|
|
1918
|
+
var asString = value;
|
|
1919
|
+
if (isProcessableValue(asString)) {
|
|
1920
|
+
string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
|
|
1921
|
+
}
|
|
1922
|
+
} else {
|
|
1923
|
+
if (Array.isArray(value) && typeof value[0] === "string" && registered == null) {
|
|
1924
|
+
for (var _i = 0; _i < value.length; _i++) {
|
|
1925
|
+
if (isProcessableValue(value[_i])) {
|
|
1926
|
+
string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
} else {
|
|
1930
|
+
var interpolated = handleInterpolation(mergedProps, registered, value);
|
|
1931
|
+
switch (key) {
|
|
1932
|
+
case "animation":
|
|
1933
|
+
case "animationName": {
|
|
1934
|
+
string += processStyleName(key) + ":" + interpolated + ";";
|
|
1935
|
+
break;
|
|
1936
|
+
}
|
|
1937
|
+
default: {
|
|
1938
|
+
string += key + "{" + interpolated + "}";
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
return string;
|
|
1946
|
+
}
|
|
1947
|
+
var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g;
|
|
1948
|
+
var cursor;
|
|
1949
|
+
function serializeStyles(args, registered, mergedProps) {
|
|
1950
|
+
if (args.length === 1 && typeof args[0] === "object" && args[0] !== null && args[0].styles !== void 0) {
|
|
1951
|
+
return args[0];
|
|
1952
|
+
}
|
|
1953
|
+
var stringMode = true;
|
|
1954
|
+
var styles = "";
|
|
1955
|
+
cursor = void 0;
|
|
1956
|
+
var strings = args[0];
|
|
1957
|
+
if (strings == null || strings.raw === void 0) {
|
|
1958
|
+
stringMode = false;
|
|
1959
|
+
styles += handleInterpolation(mergedProps, registered, strings);
|
|
1960
|
+
} else {
|
|
1961
|
+
var asTemplateStringsArr = strings;
|
|
1962
|
+
styles += asTemplateStringsArr[0];
|
|
1963
|
+
}
|
|
1964
|
+
for (var i = 1; i < args.length; i++) {
|
|
1965
|
+
styles += handleInterpolation(mergedProps, registered, args[i]);
|
|
1966
|
+
if (stringMode) {
|
|
1967
|
+
var templateStringsArr = strings;
|
|
1968
|
+
styles += templateStringsArr[i];
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
labelPattern.lastIndex = 0;
|
|
1972
|
+
var identifierName = "";
|
|
1973
|
+
var match;
|
|
1974
|
+
while ((match = labelPattern.exec(styles)) !== null) {
|
|
1975
|
+
identifierName += "-" + match[1];
|
|
1976
|
+
}
|
|
1977
|
+
var name = murmur2(styles) + identifierName;
|
|
1978
|
+
return {
|
|
1979
|
+
name,
|
|
1980
|
+
styles,
|
|
1981
|
+
next: cursor
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* @mui/styled-engine v6.5.0
|
|
1986
|
+
*
|
|
1987
|
+
* @license MIT
|
|
1988
|
+
* This source code is licensed under the MIT license found in the
|
|
1989
|
+
* LICENSE file in the root directory of this source tree.
|
|
1990
|
+
*/
|
|
1991
|
+
function styled$1(tag, options) {
|
|
1992
|
+
const stylesFactory = styled$2(tag, options);
|
|
1993
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1994
|
+
return (...styles) => {
|
|
1995
|
+
const component = typeof tag === "string" ? `"${tag}"` : "component";
|
|
1996
|
+
if (styles.length === 0) {
|
|
1997
|
+
console.error([`MUI: Seems like you called \`styled(${component})()\` without a \`style\` argument.`, 'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join("\n"));
|
|
1998
|
+
} else if (styles.some((style2) => style2 === void 0)) {
|
|
1999
|
+
console.error(`MUI: the styled(${component})(...args) API requires all its args to be defined.`);
|
|
2000
|
+
}
|
|
2001
|
+
return stylesFactory(...styles);
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
return stylesFactory;
|
|
2005
|
+
}
|
|
2006
|
+
function internal_mutateStyles(tag, processor) {
|
|
2007
|
+
if (Array.isArray(tag.__emotion_styles)) {
|
|
2008
|
+
tag.__emotion_styles = processor(tag.__emotion_styles);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
const wrapper = [];
|
|
2012
|
+
function internal_serializeStyles(styles) {
|
|
2013
|
+
wrapper[0] = styles;
|
|
2014
|
+
return serializeStyles(wrapper);
|
|
2015
|
+
}
|
|
2016
|
+
const PropsContext = /* @__PURE__ */ React.createContext(void 0);
|
|
2017
|
+
process.env.NODE_ENV !== "production" ? {
|
|
2018
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
2019
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
2020
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
2021
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
2022
|
+
/**
|
|
2023
|
+
* @ignore
|
|
2024
|
+
*/
|
|
2025
|
+
children: PropTypes.node,
|
|
2026
|
+
/**
|
|
2027
|
+
* @ignore
|
|
2028
|
+
*/
|
|
2029
|
+
value: PropTypes.object
|
|
2030
|
+
} : void 0;
|
|
2031
|
+
function getThemeProps(params) {
|
|
2032
|
+
const {
|
|
2033
|
+
theme,
|
|
2034
|
+
name,
|
|
2035
|
+
props
|
|
2036
|
+
} = params;
|
|
2037
|
+
if (!theme || !theme.components || !theme.components[name]) {
|
|
2038
|
+
return props;
|
|
2039
|
+
}
|
|
2040
|
+
const config = theme.components[name];
|
|
2041
|
+
if (config.defaultProps) {
|
|
2042
|
+
return resolveProps(config.defaultProps, props);
|
|
2043
|
+
}
|
|
2044
|
+
if (!config.styleOverrides && !config.variants) {
|
|
2045
|
+
return resolveProps(config, props);
|
|
2046
|
+
}
|
|
2047
|
+
return props;
|
|
2048
|
+
}
|
|
2049
|
+
function useDefaultProps$1({
|
|
2050
|
+
props,
|
|
2051
|
+
name
|
|
2052
|
+
}) {
|
|
2053
|
+
const ctx = React.useContext(PropsContext);
|
|
2054
|
+
return getThemeProps({
|
|
2055
|
+
props,
|
|
2056
|
+
name,
|
|
2057
|
+
theme: {
|
|
2058
|
+
components: ctx
|
|
2059
|
+
}
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2062
|
+
const sortBreakpointsValues = (values2) => {
|
|
2063
|
+
const breakpointsAsArray = Object.keys(values2).map((key) => ({
|
|
2064
|
+
key,
|
|
2065
|
+
val: values2[key]
|
|
2066
|
+
})) || [];
|
|
2067
|
+
breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
|
|
2068
|
+
return breakpointsAsArray.reduce((acc, obj) => {
|
|
2069
|
+
return {
|
|
2070
|
+
...acc,
|
|
2071
|
+
[obj.key]: obj.val
|
|
2072
|
+
};
|
|
2073
|
+
}, {});
|
|
2074
|
+
};
|
|
2075
|
+
function createBreakpoints(breakpoints) {
|
|
2076
|
+
const {
|
|
2077
|
+
// The breakpoint **start** at this value.
|
|
2078
|
+
// For instance with the first breakpoint xs: [xs, sm).
|
|
2079
|
+
values: values2 = {
|
|
2080
|
+
xs: 0,
|
|
2081
|
+
// phone
|
|
2082
|
+
sm: 600,
|
|
2083
|
+
// tablet
|
|
2084
|
+
md: 900,
|
|
2085
|
+
// small laptop
|
|
2086
|
+
lg: 1200,
|
|
2087
|
+
// desktop
|
|
2088
|
+
xl: 1536
|
|
2089
|
+
// large screen
|
|
2090
|
+
},
|
|
2091
|
+
unit = "px",
|
|
2092
|
+
step = 5,
|
|
2093
|
+
...other
|
|
2094
|
+
} = breakpoints;
|
|
2095
|
+
const sortedValues = sortBreakpointsValues(values2);
|
|
2096
|
+
const keys = Object.keys(sortedValues);
|
|
2097
|
+
function up(key) {
|
|
2098
|
+
const value = typeof values2[key] === "number" ? values2[key] : key;
|
|
2099
|
+
return `@media (min-width:${value}${unit})`;
|
|
2100
|
+
}
|
|
2101
|
+
function down(key) {
|
|
2102
|
+
const value = typeof values2[key] === "number" ? values2[key] : key;
|
|
2103
|
+
return `@media (max-width:${value - step / 100}${unit})`;
|
|
2104
|
+
}
|
|
2105
|
+
function between(start, end) {
|
|
2106
|
+
const endIndex = keys.indexOf(end);
|
|
2107
|
+
return `@media (min-width:${typeof values2[start] === "number" ? values2[start] : start}${unit}) and (max-width:${(endIndex !== -1 && typeof values2[keys[endIndex]] === "number" ? values2[keys[endIndex]] : end) - step / 100}${unit})`;
|
|
2108
|
+
}
|
|
2109
|
+
function only(key) {
|
|
2110
|
+
if (keys.indexOf(key) + 1 < keys.length) {
|
|
2111
|
+
return between(key, keys[keys.indexOf(key) + 1]);
|
|
2112
|
+
}
|
|
2113
|
+
return up(key);
|
|
2114
|
+
}
|
|
2115
|
+
function not(key) {
|
|
2116
|
+
const keyIndex = keys.indexOf(key);
|
|
2117
|
+
if (keyIndex === 0) {
|
|
2118
|
+
return up(keys[1]);
|
|
2119
|
+
}
|
|
2120
|
+
if (keyIndex === keys.length - 1) {
|
|
2121
|
+
return down(keys[keyIndex]);
|
|
2122
|
+
}
|
|
2123
|
+
return between(key, keys[keys.indexOf(key) + 1]).replace("@media", "@media not all and");
|
|
2124
|
+
}
|
|
2125
|
+
return {
|
|
2126
|
+
keys,
|
|
2127
|
+
values: sortedValues,
|
|
2128
|
+
up,
|
|
2129
|
+
down,
|
|
2130
|
+
between,
|
|
2131
|
+
only,
|
|
2132
|
+
not,
|
|
2133
|
+
unit,
|
|
2134
|
+
...other
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
const shape = {
|
|
2138
|
+
borderRadius: 4
|
|
2139
|
+
};
|
|
2140
|
+
function createSpacing(spacingInput = 8, transform = createUnarySpacing({
|
|
2141
|
+
spacing: spacingInput
|
|
2142
|
+
})) {
|
|
2143
|
+
if (spacingInput.mui) {
|
|
2144
|
+
return spacingInput;
|
|
2145
|
+
}
|
|
2146
|
+
const spacing = (...argsInput) => {
|
|
2147
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2148
|
+
if (!(argsInput.length <= 4)) {
|
|
2149
|
+
console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${argsInput.length}`);
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
const args = argsInput.length === 0 ? [1] : argsInput;
|
|
2153
|
+
return args.map((argument) => {
|
|
2154
|
+
const output = transform(argument);
|
|
2155
|
+
return typeof output === "number" ? `${output}px` : output;
|
|
2156
|
+
}).join(" ");
|
|
2157
|
+
};
|
|
2158
|
+
spacing.mui = true;
|
|
2159
|
+
return spacing;
|
|
2160
|
+
}
|
|
2161
|
+
function applyStyles(key, styles) {
|
|
2162
|
+
var _a;
|
|
2163
|
+
const theme = this;
|
|
2164
|
+
if (theme.vars) {
|
|
2165
|
+
if (!((_a = theme.colorSchemes) == null ? void 0 : _a[key]) || typeof theme.getColorSchemeSelector !== "function") {
|
|
2166
|
+
return {};
|
|
2167
|
+
}
|
|
2168
|
+
let selector = theme.getColorSchemeSelector(key);
|
|
2169
|
+
if (selector === "&") {
|
|
2170
|
+
return styles;
|
|
2171
|
+
}
|
|
2172
|
+
if (selector.includes("data-") || selector.includes(".")) {
|
|
2173
|
+
selector = `*:where(${selector.replace(/\s*&$/, "")}) &`;
|
|
2174
|
+
}
|
|
2175
|
+
return {
|
|
2176
|
+
[selector]: styles
|
|
2177
|
+
};
|
|
2178
|
+
}
|
|
2179
|
+
if (theme.palette.mode === key) {
|
|
2180
|
+
return styles;
|
|
2181
|
+
}
|
|
2182
|
+
return {};
|
|
2183
|
+
}
|
|
2184
|
+
function createTheme$1(options = {}, ...args) {
|
|
2185
|
+
const {
|
|
2186
|
+
breakpoints: breakpointsInput = {},
|
|
2187
|
+
palette: paletteInput = {},
|
|
2188
|
+
spacing: spacingInput,
|
|
2189
|
+
shape: shapeInput = {},
|
|
2190
|
+
...other
|
|
2191
|
+
} = options;
|
|
2192
|
+
const breakpoints = createBreakpoints(breakpointsInput);
|
|
2193
|
+
const spacing = createSpacing(spacingInput);
|
|
2194
|
+
let muiTheme = deepmerge({
|
|
2195
|
+
breakpoints,
|
|
2196
|
+
direction: "ltr",
|
|
2197
|
+
components: {},
|
|
2198
|
+
// Inject component definitions.
|
|
2199
|
+
palette: {
|
|
2200
|
+
mode: "light",
|
|
2201
|
+
...paletteInput
|
|
2202
|
+
},
|
|
2203
|
+
spacing,
|
|
2204
|
+
shape: {
|
|
2205
|
+
...shape,
|
|
2206
|
+
...shapeInput
|
|
2207
|
+
}
|
|
2208
|
+
}, other);
|
|
2209
|
+
muiTheme = cssContainerQueries(muiTheme);
|
|
2210
|
+
muiTheme.applyStyles = applyStyles;
|
|
2211
|
+
muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
|
|
2212
|
+
muiTheme.unstable_sxConfig = {
|
|
2213
|
+
...defaultSxConfig,
|
|
2214
|
+
...other == null ? void 0 : other.unstable_sxConfig
|
|
2215
|
+
};
|
|
2216
|
+
muiTheme.unstable_sx = function sx(props) {
|
|
2217
|
+
return styleFunctionSx({
|
|
2218
|
+
sx: props,
|
|
2219
|
+
theme: this
|
|
2220
|
+
});
|
|
2221
|
+
};
|
|
2222
|
+
return muiTheme;
|
|
2223
|
+
}
|
|
2224
|
+
const assignNestedKeys = (obj, keys, value, arrayKeys = []) => {
|
|
2225
|
+
let temp = obj;
|
|
2226
|
+
keys.forEach((k, index) => {
|
|
2227
|
+
if (index === keys.length - 1) {
|
|
2228
|
+
if (Array.isArray(temp)) {
|
|
2229
|
+
temp[Number(k)] = value;
|
|
2230
|
+
} else if (temp && typeof temp === "object") {
|
|
2231
|
+
temp[k] = value;
|
|
2232
|
+
}
|
|
2233
|
+
} else if (temp && typeof temp === "object") {
|
|
2234
|
+
if (!temp[k]) {
|
|
2235
|
+
temp[k] = arrayKeys.includes(k) ? [] : {};
|
|
2236
|
+
}
|
|
2237
|
+
temp = temp[k];
|
|
2238
|
+
}
|
|
2239
|
+
});
|
|
2240
|
+
};
|
|
2241
|
+
const walkObjectDeep = (obj, callback, shouldSkipPaths) => {
|
|
2242
|
+
function recurse(object, parentKeys = [], arrayKeys = []) {
|
|
2243
|
+
Object.entries(object).forEach(([key, value]) => {
|
|
2244
|
+
if (!shouldSkipPaths || shouldSkipPaths && !shouldSkipPaths([...parentKeys, key])) {
|
|
2245
|
+
if (value !== void 0 && value !== null) {
|
|
2246
|
+
if (typeof value === "object" && Object.keys(value).length > 0) {
|
|
2247
|
+
recurse(value, [...parentKeys, key], Array.isArray(value) ? [...arrayKeys, key] : arrayKeys);
|
|
2248
|
+
} else {
|
|
2249
|
+
callback([...parentKeys, key], value, arrayKeys);
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
recurse(obj);
|
|
2256
|
+
};
|
|
2257
|
+
const getCssValue = (keys, value) => {
|
|
2258
|
+
if (typeof value === "number") {
|
|
2259
|
+
if (["lineHeight", "fontWeight", "opacity", "zIndex"].some((prop) => keys.includes(prop))) {
|
|
2260
|
+
return value;
|
|
2261
|
+
}
|
|
2262
|
+
const lastKey = keys[keys.length - 1];
|
|
2263
|
+
if (lastKey.toLowerCase().includes("opacity")) {
|
|
2264
|
+
return value;
|
|
2265
|
+
}
|
|
2266
|
+
return `${value}px`;
|
|
2267
|
+
}
|
|
2268
|
+
return value;
|
|
2269
|
+
};
|
|
2270
|
+
function cssVarsParser(theme, options) {
|
|
2271
|
+
const {
|
|
2272
|
+
prefix,
|
|
2273
|
+
shouldSkipGeneratingVar: shouldSkipGeneratingVar2
|
|
2274
|
+
} = options || {};
|
|
2275
|
+
const css = {};
|
|
2276
|
+
const vars = {};
|
|
2277
|
+
const varsWithDefaults = {};
|
|
2278
|
+
walkObjectDeep(
|
|
2279
|
+
theme,
|
|
2280
|
+
(keys, value, arrayKeys) => {
|
|
2281
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
2282
|
+
if (!shouldSkipGeneratingVar2 || !shouldSkipGeneratingVar2(keys, value)) {
|
|
2283
|
+
const cssVar = `--${prefix ? `${prefix}-` : ""}${keys.join("-")}`;
|
|
2284
|
+
const resolvedValue = getCssValue(keys, value);
|
|
2285
|
+
Object.assign(css, {
|
|
2286
|
+
[cssVar]: resolvedValue
|
|
2287
|
+
});
|
|
2288
|
+
assignNestedKeys(vars, keys, `var(${cssVar})`, arrayKeys);
|
|
2289
|
+
assignNestedKeys(varsWithDefaults, keys, `var(${cssVar}, ${resolvedValue})`, arrayKeys);
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
},
|
|
2293
|
+
(keys) => keys[0] === "vars"
|
|
2294
|
+
// skip 'vars/*' paths
|
|
2295
|
+
);
|
|
2296
|
+
return {
|
|
2297
|
+
css,
|
|
2298
|
+
vars,
|
|
2299
|
+
varsWithDefaults
|
|
2300
|
+
};
|
|
2301
|
+
}
|
|
2302
|
+
function prepareCssVars(theme, parserConfig = {}) {
|
|
2303
|
+
const {
|
|
2304
|
+
getSelector = defaultGetSelector2,
|
|
2305
|
+
disableCssColorScheme,
|
|
2306
|
+
colorSchemeSelector: selector
|
|
2307
|
+
} = parserConfig;
|
|
2308
|
+
const {
|
|
2309
|
+
colorSchemes = {},
|
|
2310
|
+
components,
|
|
2311
|
+
defaultColorScheme = "light",
|
|
2312
|
+
...otherTheme
|
|
2313
|
+
} = theme;
|
|
2314
|
+
const {
|
|
2315
|
+
vars: rootVars,
|
|
2316
|
+
css: rootCss,
|
|
2317
|
+
varsWithDefaults: rootVarsWithDefaults
|
|
2318
|
+
} = cssVarsParser(otherTheme, parserConfig);
|
|
2319
|
+
let themeVars = rootVarsWithDefaults;
|
|
2320
|
+
const colorSchemesMap = {};
|
|
2321
|
+
const {
|
|
2322
|
+
[defaultColorScheme]: defaultScheme,
|
|
2323
|
+
...otherColorSchemes
|
|
2324
|
+
} = colorSchemes;
|
|
2325
|
+
Object.entries(otherColorSchemes || {}).forEach(([key, scheme]) => {
|
|
2326
|
+
const {
|
|
2327
|
+
vars,
|
|
2328
|
+
css,
|
|
2329
|
+
varsWithDefaults
|
|
2330
|
+
} = cssVarsParser(scheme, parserConfig);
|
|
2331
|
+
themeVars = deepmerge(themeVars, varsWithDefaults);
|
|
2332
|
+
colorSchemesMap[key] = {
|
|
2333
|
+
css,
|
|
2334
|
+
vars
|
|
2335
|
+
};
|
|
2336
|
+
});
|
|
2337
|
+
if (defaultScheme) {
|
|
2338
|
+
const {
|
|
2339
|
+
css,
|
|
2340
|
+
vars,
|
|
2341
|
+
varsWithDefaults
|
|
2342
|
+
} = cssVarsParser(defaultScheme, parserConfig);
|
|
2343
|
+
themeVars = deepmerge(themeVars, varsWithDefaults);
|
|
2344
|
+
colorSchemesMap[defaultColorScheme] = {
|
|
2345
|
+
css,
|
|
2346
|
+
vars
|
|
2347
|
+
};
|
|
2348
|
+
}
|
|
2349
|
+
function defaultGetSelector2(colorScheme, cssObject) {
|
|
2350
|
+
var _a, _b;
|
|
2351
|
+
let rule = selector;
|
|
2352
|
+
if (selector === "class") {
|
|
2353
|
+
rule = ".%s";
|
|
2354
|
+
}
|
|
2355
|
+
if (selector === "data") {
|
|
2356
|
+
rule = "[data-%s]";
|
|
2357
|
+
}
|
|
2358
|
+
if ((selector == null ? void 0 : selector.startsWith("data-")) && !selector.includes("%s")) {
|
|
2359
|
+
rule = `[${selector}="%s"]`;
|
|
2360
|
+
}
|
|
2361
|
+
if (colorScheme) {
|
|
2362
|
+
if (rule === "media") {
|
|
2363
|
+
if (theme.defaultColorScheme === colorScheme) {
|
|
2364
|
+
return ":root";
|
|
2365
|
+
}
|
|
2366
|
+
const mode = ((_b = (_a = colorSchemes[colorScheme]) == null ? void 0 : _a.palette) == null ? void 0 : _b.mode) || colorScheme;
|
|
2367
|
+
return {
|
|
2368
|
+
[`@media (prefers-color-scheme: ${mode})`]: {
|
|
2369
|
+
":root": cssObject
|
|
2370
|
+
}
|
|
2371
|
+
};
|
|
2372
|
+
}
|
|
2373
|
+
if (rule) {
|
|
2374
|
+
if (theme.defaultColorScheme === colorScheme) {
|
|
2375
|
+
return `:root, ${rule.replace("%s", String(colorScheme))}`;
|
|
2376
|
+
}
|
|
2377
|
+
return rule.replace("%s", String(colorScheme));
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
return ":root";
|
|
2381
|
+
}
|
|
2382
|
+
const generateThemeVars = () => {
|
|
2383
|
+
let vars = {
|
|
2384
|
+
...rootVars
|
|
2385
|
+
};
|
|
2386
|
+
Object.entries(colorSchemesMap).forEach(([, {
|
|
2387
|
+
vars: schemeVars
|
|
2388
|
+
}]) => {
|
|
2389
|
+
vars = deepmerge(vars, schemeVars);
|
|
2390
|
+
});
|
|
2391
|
+
return vars;
|
|
2392
|
+
};
|
|
2393
|
+
const generateStyleSheets = () => {
|
|
2394
|
+
var _a, _b;
|
|
2395
|
+
const stylesheets = [];
|
|
2396
|
+
const colorScheme = theme.defaultColorScheme || "light";
|
|
2397
|
+
function insertStyleSheet(key, css) {
|
|
2398
|
+
if (Object.keys(css).length) {
|
|
2399
|
+
stylesheets.push(typeof key === "string" ? {
|
|
2400
|
+
[key]: {
|
|
2401
|
+
...css
|
|
2402
|
+
}
|
|
2403
|
+
} : key);
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
insertStyleSheet(getSelector(void 0, {
|
|
2407
|
+
...rootCss
|
|
2408
|
+
}), rootCss);
|
|
2409
|
+
const {
|
|
2410
|
+
[colorScheme]: defaultSchemeVal,
|
|
2411
|
+
...other
|
|
2412
|
+
} = colorSchemesMap;
|
|
2413
|
+
if (defaultSchemeVal) {
|
|
2414
|
+
const {
|
|
2415
|
+
css
|
|
2416
|
+
} = defaultSchemeVal;
|
|
2417
|
+
const cssColorSheme = (_b = (_a = colorSchemes[colorScheme]) == null ? void 0 : _a.palette) == null ? void 0 : _b.mode;
|
|
2418
|
+
const finalCss = !disableCssColorScheme && cssColorSheme ? {
|
|
2419
|
+
colorScheme: cssColorSheme,
|
|
2420
|
+
...css
|
|
2421
|
+
} : {
|
|
2422
|
+
...css
|
|
2423
|
+
};
|
|
2424
|
+
insertStyleSheet(getSelector(colorScheme, {
|
|
2425
|
+
...finalCss
|
|
2426
|
+
}), finalCss);
|
|
2427
|
+
}
|
|
2428
|
+
Object.entries(other).forEach(([key, {
|
|
2429
|
+
css
|
|
2430
|
+
}]) => {
|
|
2431
|
+
var _a2, _b2;
|
|
2432
|
+
const cssColorSheme = (_b2 = (_a2 = colorSchemes[key]) == null ? void 0 : _a2.palette) == null ? void 0 : _b2.mode;
|
|
2433
|
+
const finalCss = !disableCssColorScheme && cssColorSheme ? {
|
|
2434
|
+
colorScheme: cssColorSheme,
|
|
2435
|
+
...css
|
|
2436
|
+
} : {
|
|
2437
|
+
...css
|
|
2438
|
+
};
|
|
2439
|
+
insertStyleSheet(getSelector(key, {
|
|
2440
|
+
...finalCss
|
|
2441
|
+
}), finalCss);
|
|
2442
|
+
});
|
|
2443
|
+
return stylesheets;
|
|
2444
|
+
};
|
|
2445
|
+
return {
|
|
2446
|
+
vars: themeVars,
|
|
2447
|
+
generateThemeVars,
|
|
2448
|
+
generateStyleSheets
|
|
2449
|
+
};
|
|
2450
|
+
}
|
|
2451
|
+
function prepareTypographyVars(typography) {
|
|
2452
|
+
const vars = {};
|
|
2453
|
+
const entries = Object.entries(typography);
|
|
2454
|
+
entries.forEach((entry) => {
|
|
2455
|
+
const [key, value] = entry;
|
|
2456
|
+
if (typeof value === "object") {
|
|
2457
|
+
vars[key] = `${value.fontStyle ? `${value.fontStyle} ` : ""}${value.fontVariant ? `${value.fontVariant} ` : ""}${value.fontWeight ? `${value.fontWeight} ` : ""}${value.fontStretch ? `${value.fontStretch} ` : ""}${value.fontSize || ""}${value.lineHeight ? `/${value.lineHeight} ` : ""}${value.fontFamily || ""}`;
|
|
2458
|
+
}
|
|
2459
|
+
});
|
|
2460
|
+
return vars;
|
|
2461
|
+
}
|
|
2462
|
+
function createGetColorSchemeSelector(selector) {
|
|
2463
|
+
return function getColorSchemeSelector(colorScheme) {
|
|
2464
|
+
if (selector === "media") {
|
|
2465
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2466
|
+
if (colorScheme !== "light" && colorScheme !== "dark") {
|
|
2467
|
+
console.error(`MUI: @media (prefers-color-scheme) supports only 'light' or 'dark', but receive '${colorScheme}'.`);
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
return `@media (prefers-color-scheme: ${colorScheme})`;
|
|
2471
|
+
}
|
|
2472
|
+
if (selector) {
|
|
2473
|
+
if (selector.startsWith("data-") && !selector.includes("%s")) {
|
|
2474
|
+
return `[${selector}="${colorScheme}"] &`;
|
|
2475
|
+
}
|
|
2476
|
+
if (selector === "class") {
|
|
2477
|
+
return `.${colorScheme} &`;
|
|
2478
|
+
}
|
|
2479
|
+
if (selector === "data") {
|
|
2480
|
+
return `[data-${colorScheme}] &`;
|
|
2481
|
+
}
|
|
2482
|
+
return `${selector.replace("%s", colorScheme)} &`;
|
|
2483
|
+
}
|
|
2484
|
+
return "&";
|
|
2485
|
+
};
|
|
2486
|
+
}
|
|
2487
|
+
function createMixins(breakpoints, mixins) {
|
|
2488
|
+
return {
|
|
2489
|
+
toolbar: {
|
|
2490
|
+
minHeight: 56,
|
|
2491
|
+
[breakpoints.up("xs")]: {
|
|
2492
|
+
"@media (orientation: landscape)": {
|
|
2493
|
+
minHeight: 48
|
|
2494
|
+
}
|
|
2495
|
+
},
|
|
2496
|
+
[breakpoints.up("sm")]: {
|
|
2497
|
+
minHeight: 64
|
|
2498
|
+
}
|
|
2499
|
+
},
|
|
2500
|
+
...mixins
|
|
2501
|
+
};
|
|
2502
|
+
}
|
|
2503
|
+
function round(value) {
|
|
2504
|
+
return Math.round(value * 1e5) / 1e5;
|
|
2505
|
+
}
|
|
2506
|
+
const caseAllCaps = {
|
|
2507
|
+
textTransform: "uppercase"
|
|
2508
|
+
};
|
|
2509
|
+
const defaultFontFamily = '"Roboto", "Helvetica", "Arial", sans-serif';
|
|
2510
|
+
function createTypography(palette, typography) {
|
|
2511
|
+
const {
|
|
2512
|
+
fontFamily = defaultFontFamily,
|
|
2513
|
+
// The default font size of the Material Specification.
|
|
2514
|
+
fontSize = 14,
|
|
2515
|
+
// px
|
|
2516
|
+
fontWeightLight = 300,
|
|
2517
|
+
fontWeightRegular = 400,
|
|
2518
|
+
fontWeightMedium = 500,
|
|
2519
|
+
fontWeightBold = 700,
|
|
2520
|
+
// Tell MUI what's the font-size on the html element.
|
|
2521
|
+
// 16px is the default font-size used by browsers.
|
|
2522
|
+
htmlFontSize = 16,
|
|
2523
|
+
// Apply the CSS properties to all the variants.
|
|
2524
|
+
allVariants,
|
|
2525
|
+
pxToRem: pxToRem2,
|
|
2526
|
+
...other
|
|
2527
|
+
} = typeof typography === "function" ? typography(palette) : typography;
|
|
2528
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2529
|
+
if (typeof fontSize !== "number") {
|
|
2530
|
+
console.error("MUI: `fontSize` is required to be a number.");
|
|
2531
|
+
}
|
|
2532
|
+
if (typeof htmlFontSize !== "number") {
|
|
2533
|
+
console.error("MUI: `htmlFontSize` is required to be a number.");
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
const coef = fontSize / 14;
|
|
2537
|
+
const pxToRem = pxToRem2 || ((size) => `${size / htmlFontSize * coef}rem`);
|
|
2538
|
+
const buildVariant = (fontWeight, size, lineHeight, letterSpacing, casing) => ({
|
|
2539
|
+
fontFamily,
|
|
2540
|
+
fontWeight,
|
|
2541
|
+
fontSize: pxToRem(size),
|
|
2542
|
+
// Unitless following https://meyerweb.com/eric/thoughts/2006/02/08/unitless-line-heights/
|
|
2543
|
+
lineHeight,
|
|
2544
|
+
// The letter spacing was designed for the Roboto font-family. Using the same letter-spacing
|
|
2545
|
+
// across font-families can cause issues with the kerning.
|
|
2546
|
+
...fontFamily === defaultFontFamily ? {
|
|
2547
|
+
letterSpacing: `${round(letterSpacing / size)}em`
|
|
2548
|
+
} : {},
|
|
2549
|
+
...casing,
|
|
2550
|
+
...allVariants
|
|
2551
|
+
});
|
|
2552
|
+
const variants = {
|
|
2553
|
+
h1: buildVariant(fontWeightLight, 96, 1.167, -1.5),
|
|
2554
|
+
h2: buildVariant(fontWeightLight, 60, 1.2, -0.5),
|
|
2555
|
+
h3: buildVariant(fontWeightRegular, 48, 1.167, 0),
|
|
2556
|
+
h4: buildVariant(fontWeightRegular, 34, 1.235, 0.25),
|
|
2557
|
+
h5: buildVariant(fontWeightRegular, 24, 1.334, 0),
|
|
2558
|
+
h6: buildVariant(fontWeightMedium, 20, 1.6, 0.15),
|
|
2559
|
+
subtitle1: buildVariant(fontWeightRegular, 16, 1.75, 0.15),
|
|
2560
|
+
subtitle2: buildVariant(fontWeightMedium, 14, 1.57, 0.1),
|
|
2561
|
+
body1: buildVariant(fontWeightRegular, 16, 1.5, 0.15),
|
|
2562
|
+
body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
|
|
2563
|
+
button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
|
|
2564
|
+
caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
|
|
2565
|
+
overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
|
|
2566
|
+
// TODO v6: Remove handling of 'inherit' variant from the theme as it is already handled in Material UI's Typography component. Also, remember to remove the associated types.
|
|
2567
|
+
inherit: {
|
|
2568
|
+
fontFamily: "inherit",
|
|
2569
|
+
fontWeight: "inherit",
|
|
2570
|
+
fontSize: "inherit",
|
|
2571
|
+
lineHeight: "inherit",
|
|
2572
|
+
letterSpacing: "inherit"
|
|
2573
|
+
}
|
|
2574
|
+
};
|
|
2575
|
+
return deepmerge({
|
|
2576
|
+
htmlFontSize,
|
|
2577
|
+
pxToRem,
|
|
2578
|
+
fontFamily,
|
|
2579
|
+
fontSize,
|
|
2580
|
+
fontWeightLight,
|
|
2581
|
+
fontWeightRegular,
|
|
2582
|
+
fontWeightMedium,
|
|
2583
|
+
fontWeightBold,
|
|
2584
|
+
...variants
|
|
2585
|
+
}, other, {
|
|
2586
|
+
clone: false
|
|
2587
|
+
// No need to clone deep
|
|
2588
|
+
});
|
|
2589
|
+
}
|
|
2590
|
+
const shadowKeyUmbraOpacity = 0.2;
|
|
2591
|
+
const shadowKeyPenumbraOpacity = 0.14;
|
|
2592
|
+
const shadowAmbientShadowOpacity = 0.12;
|
|
2593
|
+
function createShadow(...px) {
|
|
2594
|
+
return [`${px[0]}px ${px[1]}px ${px[2]}px ${px[3]}px rgba(0,0,0,${shadowKeyUmbraOpacity})`, `${px[4]}px ${px[5]}px ${px[6]}px ${px[7]}px rgba(0,0,0,${shadowKeyPenumbraOpacity})`, `${px[8]}px ${px[9]}px ${px[10]}px ${px[11]}px rgba(0,0,0,${shadowAmbientShadowOpacity})`].join(",");
|
|
2595
|
+
}
|
|
2596
|
+
const shadows = ["none", createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
|
|
2597
|
+
const easing = {
|
|
2598
|
+
// This is the most common easing curve.
|
|
2599
|
+
easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
2600
|
+
// Objects enter the screen at full velocity from off-screen and
|
|
2601
|
+
// slowly decelerate to a resting point.
|
|
2602
|
+
easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
|
|
2603
|
+
// Objects leave the screen at full velocity. They do not decelerate when off-screen.
|
|
2604
|
+
easeIn: "cubic-bezier(0.4, 0, 1, 1)",
|
|
2605
|
+
// The sharp curve is used by objects that may return to the screen at any time.
|
|
2606
|
+
sharp: "cubic-bezier(0.4, 0, 0.6, 1)"
|
|
2607
|
+
};
|
|
2608
|
+
const duration = {
|
|
2609
|
+
shortest: 150,
|
|
2610
|
+
shorter: 200,
|
|
2611
|
+
short: 250,
|
|
2612
|
+
// most basic recommended timing
|
|
2613
|
+
standard: 300,
|
|
2614
|
+
// this is to be used in complex animations
|
|
2615
|
+
complex: 375,
|
|
2616
|
+
// recommended when something is entering screen
|
|
2617
|
+
enteringScreen: 225,
|
|
2618
|
+
// recommended when something is leaving screen
|
|
2619
|
+
leavingScreen: 195
|
|
2620
|
+
};
|
|
2621
|
+
function formatMs(milliseconds) {
|
|
2622
|
+
return `${Math.round(milliseconds)}ms`;
|
|
2623
|
+
}
|
|
2624
|
+
function getAutoHeightDuration(height2) {
|
|
2625
|
+
if (!height2) {
|
|
2626
|
+
return 0;
|
|
2627
|
+
}
|
|
2628
|
+
const constant = height2 / 36;
|
|
2629
|
+
return Math.min(Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10), 3e3);
|
|
2630
|
+
}
|
|
2631
|
+
function createTransitions(inputTransitions) {
|
|
2632
|
+
const mergedEasing = {
|
|
2633
|
+
...easing,
|
|
2634
|
+
...inputTransitions.easing
|
|
2635
|
+
};
|
|
2636
|
+
const mergedDuration = {
|
|
2637
|
+
...duration,
|
|
2638
|
+
...inputTransitions.duration
|
|
2639
|
+
};
|
|
2640
|
+
const create = (props = ["all"], options = {}) => {
|
|
2641
|
+
const {
|
|
2642
|
+
duration: durationOption = mergedDuration.standard,
|
|
2643
|
+
easing: easingOption = mergedEasing.easeInOut,
|
|
2644
|
+
delay = 0,
|
|
2645
|
+
...other
|
|
2646
|
+
} = options;
|
|
2647
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2648
|
+
const isString = (value) => typeof value === "string";
|
|
2649
|
+
const isNumber = (value) => !Number.isNaN(parseFloat(value));
|
|
2650
|
+
if (!isString(props) && !Array.isArray(props)) {
|
|
2651
|
+
console.error('MUI: Argument "props" must be a string or Array.');
|
|
2652
|
+
}
|
|
2653
|
+
if (!isNumber(durationOption) && !isString(durationOption)) {
|
|
2654
|
+
console.error(`MUI: Argument "duration" must be a number or a string but found ${durationOption}.`);
|
|
2655
|
+
}
|
|
2656
|
+
if (!isString(easingOption)) {
|
|
2657
|
+
console.error('MUI: Argument "easing" must be a string.');
|
|
2658
|
+
}
|
|
2659
|
+
if (!isNumber(delay) && !isString(delay)) {
|
|
2660
|
+
console.error('MUI: Argument "delay" must be a number or a string.');
|
|
2661
|
+
}
|
|
2662
|
+
if (typeof options !== "object") {
|
|
2663
|
+
console.error(["MUI: Secong argument of transition.create must be an object.", "Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join("\n"));
|
|
2664
|
+
}
|
|
2665
|
+
if (Object.keys(other).length !== 0) {
|
|
2666
|
+
console.error(`MUI: Unrecognized argument(s) [${Object.keys(other).join(",")}].`);
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
return (Array.isArray(props) ? props : [props]).map((animatedProp) => `${animatedProp} ${typeof durationOption === "string" ? durationOption : formatMs(durationOption)} ${easingOption} ${typeof delay === "string" ? delay : formatMs(delay)}`).join(",");
|
|
2670
|
+
};
|
|
2671
|
+
return {
|
|
2672
|
+
getAutoHeightDuration,
|
|
2673
|
+
create,
|
|
2674
|
+
...inputTransitions,
|
|
2675
|
+
easing: mergedEasing,
|
|
2676
|
+
duration: mergedDuration
|
|
2677
|
+
};
|
|
2678
|
+
}
|
|
2679
|
+
const zIndex = {
|
|
2680
|
+
mobileStepper: 1e3,
|
|
2681
|
+
fab: 1050,
|
|
2682
|
+
speedDial: 1050,
|
|
2683
|
+
appBar: 1100,
|
|
2684
|
+
drawer: 1200,
|
|
2685
|
+
modal: 1300,
|
|
2686
|
+
snackbar: 1400,
|
|
2687
|
+
tooltip: 1500
|
|
2688
|
+
};
|
|
2689
|
+
function isSerializable(val) {
|
|
2690
|
+
return isPlainObject(val) || typeof val === "undefined" || typeof val === "string" || typeof val === "boolean" || typeof val === "number" || Array.isArray(val);
|
|
2691
|
+
}
|
|
2692
|
+
function stringifyTheme(baseTheme = {}) {
|
|
2693
|
+
const serializableTheme = {
|
|
2694
|
+
...baseTheme
|
|
2695
|
+
};
|
|
2696
|
+
function serializeTheme(object) {
|
|
2697
|
+
const array = Object.entries(object);
|
|
2698
|
+
for (let index = 0; index < array.length; index++) {
|
|
2699
|
+
const [key, value] = array[index];
|
|
2700
|
+
if (!isSerializable(value) || key.startsWith("unstable_")) {
|
|
2701
|
+
delete object[key];
|
|
2702
|
+
} else if (isPlainObject(value)) {
|
|
2703
|
+
object[key] = {
|
|
2704
|
+
...value
|
|
2705
|
+
};
|
|
2706
|
+
serializeTheme(object[key]);
|
|
2707
|
+
}
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
serializeTheme(serializableTheme);
|
|
2711
|
+
return `import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';
|
|
2712
|
+
|
|
2713
|
+
const theme = ${JSON.stringify(serializableTheme, null, 2)};
|
|
2714
|
+
|
|
2715
|
+
theme.breakpoints = createBreakpoints(theme.breakpoints || {});
|
|
2716
|
+
theme.transitions = createTransitions(theme.transitions || {});
|
|
2717
|
+
|
|
2718
|
+
export default theme;`;
|
|
2719
|
+
}
|
|
2720
|
+
function createThemeNoVars(options = {}, ...args) {
|
|
2721
|
+
const {
|
|
2722
|
+
breakpoints: breakpointsInput,
|
|
2723
|
+
mixins: mixinsInput = {},
|
|
2724
|
+
spacing: spacingInput,
|
|
2725
|
+
palette: paletteInput = {},
|
|
2726
|
+
transitions: transitionsInput = {},
|
|
2727
|
+
typography: typographyInput = {},
|
|
2728
|
+
shape: shapeInput,
|
|
2729
|
+
...other
|
|
2730
|
+
} = options;
|
|
2731
|
+
if (options.vars && // The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
|
|
2732
|
+
// `generateThemeVars` is the closest identifier for checking that the `options` is a result of `createTheme` with CSS variables so that user can create new theme for nested ThemeProvider.
|
|
2733
|
+
options.generateThemeVars === void 0) {
|
|
2734
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "MUI: `vars` is a private field used for CSS variables support.\nPlease use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature." : formatMuiErrorMessage(20));
|
|
2735
|
+
}
|
|
2736
|
+
const palette = createPalette(paletteInput);
|
|
2737
|
+
const systemTheme = createTheme$1(options);
|
|
2738
|
+
let muiTheme = deepmerge(systemTheme, {
|
|
2739
|
+
mixins: createMixins(systemTheme.breakpoints, mixinsInput),
|
|
2740
|
+
palette,
|
|
2741
|
+
// Don't use [...shadows] until you've verified its transpiled code is not invoking the iterator protocol.
|
|
2742
|
+
shadows: shadows.slice(),
|
|
2743
|
+
typography: createTypography(palette, typographyInput),
|
|
2744
|
+
transitions: createTransitions(transitionsInput),
|
|
2745
|
+
zIndex: {
|
|
2746
|
+
...zIndex
|
|
2747
|
+
}
|
|
2748
|
+
});
|
|
2749
|
+
muiTheme = deepmerge(muiTheme, other);
|
|
2750
|
+
muiTheme = args.reduce((acc, argument) => deepmerge(acc, argument), muiTheme);
|
|
2751
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2752
|
+
const stateClasses = ["active", "checked", "completed", "disabled", "error", "expanded", "focused", "focusVisible", "required", "selected"];
|
|
2753
|
+
const traverse = (node, component) => {
|
|
2754
|
+
let key;
|
|
2755
|
+
for (key in node) {
|
|
2756
|
+
const child = node[key];
|
|
2757
|
+
if (stateClasses.includes(key) && Object.keys(child).length > 0) {
|
|
2758
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2759
|
+
const stateClass = generateUtilityClass("", key);
|
|
2760
|
+
console.error([`MUI: The \`${component}\` component increases the CSS specificity of the \`${key}\` internal state.`, "You can not override it like this: ", JSON.stringify(node, null, 2), "", `Instead, you need to use the '&.${stateClass}' syntax:`, JSON.stringify({
|
|
2761
|
+
root: {
|
|
2762
|
+
[`&.${stateClass}`]: child
|
|
2763
|
+
}
|
|
2764
|
+
}, null, 2), "", "https://mui.com/r/state-classes-guide"].join("\n"));
|
|
2765
|
+
}
|
|
2766
|
+
node[key] = {};
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
};
|
|
2770
|
+
Object.keys(muiTheme.components).forEach((component) => {
|
|
2771
|
+
const styleOverrides = muiTheme.components[component].styleOverrides;
|
|
2772
|
+
if (styleOverrides && component.startsWith("Mui")) {
|
|
2773
|
+
traverse(styleOverrides, component);
|
|
2774
|
+
}
|
|
2775
|
+
});
|
|
2776
|
+
}
|
|
2777
|
+
muiTheme.unstable_sxConfig = {
|
|
2778
|
+
...defaultSxConfig,
|
|
2779
|
+
...other == null ? void 0 : other.unstable_sxConfig
|
|
2780
|
+
};
|
|
2781
|
+
muiTheme.unstable_sx = function sx(props) {
|
|
2782
|
+
return styleFunctionSx({
|
|
2783
|
+
sx: props,
|
|
2784
|
+
theme: this
|
|
2785
|
+
});
|
|
2786
|
+
};
|
|
2787
|
+
muiTheme.toRuntimeSource = stringifyTheme;
|
|
2788
|
+
return muiTheme;
|
|
2789
|
+
}
|
|
2790
|
+
function getOverlayAlpha(elevation) {
|
|
2791
|
+
let alphaValue;
|
|
2792
|
+
if (elevation < 1) {
|
|
2793
|
+
alphaValue = 5.11916 * elevation ** 2;
|
|
2794
|
+
} else {
|
|
2795
|
+
alphaValue = 4.5 * Math.log(elevation + 1) + 2;
|
|
2796
|
+
}
|
|
2797
|
+
return Math.round(alphaValue * 10) / 1e3;
|
|
2798
|
+
}
|
|
2799
|
+
const defaultDarkOverlays = [...Array(25)].map((_, index) => {
|
|
2800
|
+
if (index === 0) {
|
|
2801
|
+
return "none";
|
|
2802
|
+
}
|
|
2803
|
+
const overlay = getOverlayAlpha(index);
|
|
2804
|
+
return `linear-gradient(rgba(255 255 255 / ${overlay}), rgba(255 255 255 / ${overlay}))`;
|
|
2805
|
+
});
|
|
2806
|
+
function getOpacity(mode) {
|
|
2807
|
+
return {
|
|
2808
|
+
inputPlaceholder: mode === "dark" ? 0.5 : 0.42,
|
|
2809
|
+
inputUnderline: mode === "dark" ? 0.7 : 0.42,
|
|
2810
|
+
switchTrackDisabled: mode === "dark" ? 0.2 : 0.12,
|
|
2811
|
+
switchTrack: mode === "dark" ? 0.3 : 0.38
|
|
2812
|
+
};
|
|
2813
|
+
}
|
|
2814
|
+
function getOverlays(mode) {
|
|
2815
|
+
return mode === "dark" ? defaultDarkOverlays : [];
|
|
2816
|
+
}
|
|
2817
|
+
function createColorScheme(options) {
|
|
2818
|
+
const {
|
|
2819
|
+
palette: paletteInput = {
|
|
2820
|
+
mode: "light"
|
|
2821
|
+
},
|
|
2822
|
+
// need to cast to avoid module augmentation test
|
|
2823
|
+
opacity,
|
|
2824
|
+
overlays,
|
|
2825
|
+
...rest
|
|
2826
|
+
} = options;
|
|
2827
|
+
const palette = createPalette(paletteInput);
|
|
2828
|
+
return {
|
|
2829
|
+
palette,
|
|
2830
|
+
opacity: {
|
|
2831
|
+
...getOpacity(palette.mode),
|
|
2832
|
+
...opacity
|
|
2833
|
+
},
|
|
2834
|
+
overlays: overlays || getOverlays(palette.mode),
|
|
2835
|
+
...rest
|
|
2836
|
+
};
|
|
2837
|
+
}
|
|
2838
|
+
function shouldSkipGeneratingVar(keys) {
|
|
2839
|
+
var _a;
|
|
2840
|
+
return !!keys[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) || // ends with sxConfig
|
|
2841
|
+
keys[0] === "palette" && !!((_a = keys[1]) == null ? void 0 : _a.match(/(mode|contrastThreshold|tonalOffset)/));
|
|
2842
|
+
}
|
|
2843
|
+
const excludeVariablesFromRoot = (cssVarPrefix) => [...[...Array(25)].map((_, index) => `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}overlays-${index}`), `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}palette-AppBar-darkBg`, `--${cssVarPrefix ? `${cssVarPrefix}-` : ""}palette-AppBar-darkColor`];
|
|
2844
|
+
const defaultGetSelector = (theme) => (colorScheme, css) => {
|
|
2845
|
+
const root = theme.rootSelector || ":root";
|
|
2846
|
+
const selector = theme.colorSchemeSelector;
|
|
2847
|
+
let rule = selector;
|
|
2848
|
+
if (selector === "class") {
|
|
2849
|
+
rule = ".%s";
|
|
2850
|
+
}
|
|
2851
|
+
if (selector === "data") {
|
|
2852
|
+
rule = "[data-%s]";
|
|
2853
|
+
}
|
|
2854
|
+
if ((selector == null ? void 0 : selector.startsWith("data-")) && !selector.includes("%s")) {
|
|
2855
|
+
rule = `[${selector}="%s"]`;
|
|
2856
|
+
}
|
|
2857
|
+
if (theme.defaultColorScheme === colorScheme) {
|
|
2858
|
+
if (colorScheme === "dark") {
|
|
2859
|
+
const excludedVariables = {};
|
|
2860
|
+
excludeVariablesFromRoot(theme.cssVarPrefix).forEach((cssVar) => {
|
|
2861
|
+
excludedVariables[cssVar] = css[cssVar];
|
|
2862
|
+
delete css[cssVar];
|
|
2863
|
+
});
|
|
2864
|
+
if (rule === "media") {
|
|
2865
|
+
return {
|
|
2866
|
+
[root]: css,
|
|
2867
|
+
[`@media (prefers-color-scheme: dark)`]: {
|
|
2868
|
+
[root]: excludedVariables
|
|
2869
|
+
}
|
|
2870
|
+
};
|
|
2871
|
+
}
|
|
2872
|
+
if (rule) {
|
|
2873
|
+
return {
|
|
2874
|
+
[rule.replace("%s", colorScheme)]: excludedVariables,
|
|
2875
|
+
[`${root}, ${rule.replace("%s", colorScheme)}`]: css
|
|
2876
|
+
};
|
|
2877
|
+
}
|
|
2878
|
+
return {
|
|
2879
|
+
[root]: {
|
|
2880
|
+
...css,
|
|
2881
|
+
...excludedVariables
|
|
2882
|
+
}
|
|
2883
|
+
};
|
|
2884
|
+
}
|
|
2885
|
+
if (rule && rule !== "media") {
|
|
2886
|
+
return `${root}, ${rule.replace("%s", String(colorScheme))}`;
|
|
2887
|
+
}
|
|
2888
|
+
} else if (colorScheme) {
|
|
2889
|
+
if (rule === "media") {
|
|
2890
|
+
return {
|
|
2891
|
+
[`@media (prefers-color-scheme: ${String(colorScheme)})`]: {
|
|
2892
|
+
[root]: css
|
|
2893
|
+
}
|
|
2894
|
+
};
|
|
2895
|
+
}
|
|
2896
|
+
if (rule) {
|
|
2897
|
+
return rule.replace("%s", String(colorScheme));
|
|
2898
|
+
}
|
|
2899
|
+
}
|
|
2900
|
+
return root;
|
|
2901
|
+
};
|
|
2902
|
+
function assignNode(obj, keys) {
|
|
2903
|
+
keys.forEach((k) => {
|
|
2904
|
+
if (!obj[k]) {
|
|
2905
|
+
obj[k] = {};
|
|
2906
|
+
}
|
|
2907
|
+
});
|
|
2908
|
+
}
|
|
2909
|
+
function setColor(obj, key, defaultValue) {
|
|
2910
|
+
if (!obj[key] && defaultValue) {
|
|
2911
|
+
obj[key] = defaultValue;
|
|
2912
|
+
}
|
|
2913
|
+
}
|
|
2914
|
+
function toRgb(color2) {
|
|
2915
|
+
if (typeof color2 !== "string" || !color2.startsWith("hsl")) {
|
|
2916
|
+
return color2;
|
|
2917
|
+
}
|
|
2918
|
+
return hslToRgb(color2);
|
|
2919
|
+
}
|
|
2920
|
+
function setColorChannel(obj, key) {
|
|
2921
|
+
if (!(`${key}Channel` in obj)) {
|
|
2922
|
+
obj[`${key}Channel`] = private_safeColorChannel(toRgb(obj[key]), `MUI: Can't create \`palette.${key}Channel\` because \`palette.${key}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
|
|
2923
|
+
To suppress this warning, you need to explicitly provide the \`palette.${key}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`);
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
function getSpacingVal(spacingInput) {
|
|
2927
|
+
if (typeof spacingInput === "number") {
|
|
2928
|
+
return `${spacingInput}px`;
|
|
2929
|
+
}
|
|
2930
|
+
if (typeof spacingInput === "string" || typeof spacingInput === "function" || Array.isArray(spacingInput)) {
|
|
2931
|
+
return spacingInput;
|
|
2932
|
+
}
|
|
2933
|
+
return "8px";
|
|
2934
|
+
}
|
|
2935
|
+
const silent = (fn) => {
|
|
2936
|
+
try {
|
|
2937
|
+
return fn();
|
|
2938
|
+
} catch (error) {
|
|
2939
|
+
}
|
|
2940
|
+
return void 0;
|
|
2941
|
+
};
|
|
2942
|
+
const createGetCssVar = (cssVarPrefix = "mui") => unstable_createGetCssVar(cssVarPrefix);
|
|
2943
|
+
function attachColorScheme$1(colorSchemes, scheme, restTheme, colorScheme) {
|
|
2944
|
+
if (!scheme) {
|
|
2945
|
+
return void 0;
|
|
2946
|
+
}
|
|
2947
|
+
scheme = scheme === true ? {} : scheme;
|
|
2948
|
+
const mode = colorScheme === "dark" ? "dark" : "light";
|
|
2949
|
+
if (!restTheme) {
|
|
2950
|
+
colorSchemes[colorScheme] = createColorScheme({
|
|
2951
|
+
...scheme,
|
|
2952
|
+
palette: {
|
|
2953
|
+
mode,
|
|
2954
|
+
...scheme == null ? void 0 : scheme.palette
|
|
2955
|
+
}
|
|
2956
|
+
});
|
|
2957
|
+
return void 0;
|
|
2958
|
+
}
|
|
2959
|
+
const {
|
|
2960
|
+
palette,
|
|
2961
|
+
...muiTheme
|
|
2962
|
+
} = createThemeNoVars({
|
|
2963
|
+
...restTheme,
|
|
2964
|
+
palette: {
|
|
2965
|
+
mode,
|
|
2966
|
+
...scheme == null ? void 0 : scheme.palette
|
|
2967
|
+
}
|
|
2968
|
+
});
|
|
2969
|
+
colorSchemes[colorScheme] = {
|
|
2970
|
+
...scheme,
|
|
2971
|
+
palette,
|
|
2972
|
+
opacity: {
|
|
2973
|
+
...getOpacity(mode),
|
|
2974
|
+
...scheme == null ? void 0 : scheme.opacity
|
|
2975
|
+
},
|
|
2976
|
+
overlays: (scheme == null ? void 0 : scheme.overlays) || getOverlays(mode)
|
|
2977
|
+
};
|
|
2978
|
+
return muiTheme;
|
|
2979
|
+
}
|
|
2980
|
+
function createThemeWithVars(options = {}, ...args) {
|
|
2981
|
+
const {
|
|
2982
|
+
colorSchemes: colorSchemesInput = {
|
|
2983
|
+
light: true
|
|
2984
|
+
},
|
|
2985
|
+
defaultColorScheme: defaultColorSchemeInput,
|
|
2986
|
+
disableCssColorScheme = false,
|
|
2987
|
+
cssVarPrefix = "mui",
|
|
2988
|
+
shouldSkipGeneratingVar: shouldSkipGeneratingVar$1 = shouldSkipGeneratingVar,
|
|
2989
|
+
colorSchemeSelector: selector = colorSchemesInput.light && colorSchemesInput.dark ? "media" : void 0,
|
|
2990
|
+
rootSelector = ":root",
|
|
2991
|
+
...input
|
|
2992
|
+
} = options;
|
|
2993
|
+
const firstColorScheme = Object.keys(colorSchemesInput)[0];
|
|
2994
|
+
const defaultColorScheme = defaultColorSchemeInput || (colorSchemesInput.light && firstColorScheme !== "light" ? "light" : firstColorScheme);
|
|
2995
|
+
const getCssVar = createGetCssVar(cssVarPrefix);
|
|
2996
|
+
const {
|
|
2997
|
+
[defaultColorScheme]: defaultSchemeInput,
|
|
2998
|
+
light: builtInLight,
|
|
2999
|
+
dark: builtInDark,
|
|
3000
|
+
...customColorSchemes
|
|
3001
|
+
} = colorSchemesInput;
|
|
3002
|
+
const colorSchemes = {
|
|
3003
|
+
...customColorSchemes
|
|
3004
|
+
};
|
|
3005
|
+
let defaultScheme = defaultSchemeInput;
|
|
3006
|
+
if (defaultColorScheme === "dark" && !("dark" in colorSchemesInput) || defaultColorScheme === "light" && !("light" in colorSchemesInput)) {
|
|
3007
|
+
defaultScheme = true;
|
|
3008
|
+
}
|
|
3009
|
+
if (!defaultScheme) {
|
|
3010
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.` : formatMuiErrorMessage(21, defaultColorScheme));
|
|
3011
|
+
}
|
|
3012
|
+
const muiTheme = attachColorScheme$1(colorSchemes, defaultScheme, input, defaultColorScheme);
|
|
3013
|
+
if (builtInLight && !colorSchemes.light) {
|
|
3014
|
+
attachColorScheme$1(colorSchemes, builtInLight, void 0, "light");
|
|
3015
|
+
}
|
|
3016
|
+
if (builtInDark && !colorSchemes.dark) {
|
|
3017
|
+
attachColorScheme$1(colorSchemes, builtInDark, void 0, "dark");
|
|
3018
|
+
}
|
|
3019
|
+
let theme = {
|
|
3020
|
+
defaultColorScheme,
|
|
3021
|
+
...muiTheme,
|
|
3022
|
+
cssVarPrefix,
|
|
3023
|
+
colorSchemeSelector: selector,
|
|
3024
|
+
rootSelector,
|
|
3025
|
+
getCssVar,
|
|
3026
|
+
colorSchemes,
|
|
3027
|
+
font: {
|
|
3028
|
+
...prepareTypographyVars(muiTheme.typography),
|
|
3029
|
+
...muiTheme.font
|
|
3030
|
+
},
|
|
3031
|
+
spacing: getSpacingVal(input.spacing)
|
|
3032
|
+
};
|
|
3033
|
+
Object.keys(theme.colorSchemes).forEach((key) => {
|
|
3034
|
+
const palette = theme.colorSchemes[key].palette;
|
|
3035
|
+
const setCssVarColor = (cssVar) => {
|
|
3036
|
+
const tokens = cssVar.split("-");
|
|
3037
|
+
const color2 = tokens[1];
|
|
3038
|
+
const colorToken = tokens[2];
|
|
3039
|
+
return getCssVar(cssVar, palette[color2][colorToken]);
|
|
3040
|
+
};
|
|
3041
|
+
if (palette.mode === "light") {
|
|
3042
|
+
setColor(palette.common, "background", "#fff");
|
|
3043
|
+
setColor(palette.common, "onBackground", "#000");
|
|
3044
|
+
}
|
|
3045
|
+
if (palette.mode === "dark") {
|
|
3046
|
+
setColor(palette.common, "background", "#000");
|
|
3047
|
+
setColor(palette.common, "onBackground", "#fff");
|
|
3048
|
+
}
|
|
3049
|
+
assignNode(palette, ["Alert", "AppBar", "Avatar", "Button", "Chip", "FilledInput", "LinearProgress", "Skeleton", "Slider", "SnackbarContent", "SpeedDialAction", "StepConnector", "StepContent", "Switch", "TableCell", "Tooltip"]);
|
|
3050
|
+
if (palette.mode === "light") {
|
|
3051
|
+
setColor(palette.Alert, "errorColor", private_safeDarken(palette.error.light, 0.6));
|
|
3052
|
+
setColor(palette.Alert, "infoColor", private_safeDarken(palette.info.light, 0.6));
|
|
3053
|
+
setColor(palette.Alert, "successColor", private_safeDarken(palette.success.light, 0.6));
|
|
3054
|
+
setColor(palette.Alert, "warningColor", private_safeDarken(palette.warning.light, 0.6));
|
|
3055
|
+
setColor(palette.Alert, "errorFilledBg", setCssVarColor("palette-error-main"));
|
|
3056
|
+
setColor(palette.Alert, "infoFilledBg", setCssVarColor("palette-info-main"));
|
|
3057
|
+
setColor(palette.Alert, "successFilledBg", setCssVarColor("palette-success-main"));
|
|
3058
|
+
setColor(palette.Alert, "warningFilledBg", setCssVarColor("palette-warning-main"));
|
|
3059
|
+
setColor(palette.Alert, "errorFilledColor", silent(() => palette.getContrastText(palette.error.main)));
|
|
3060
|
+
setColor(palette.Alert, "infoFilledColor", silent(() => palette.getContrastText(palette.info.main)));
|
|
3061
|
+
setColor(palette.Alert, "successFilledColor", silent(() => palette.getContrastText(palette.success.main)));
|
|
3062
|
+
setColor(palette.Alert, "warningFilledColor", silent(() => palette.getContrastText(palette.warning.main)));
|
|
3063
|
+
setColor(palette.Alert, "errorStandardBg", private_safeLighten(palette.error.light, 0.9));
|
|
3064
|
+
setColor(palette.Alert, "infoStandardBg", private_safeLighten(palette.info.light, 0.9));
|
|
3065
|
+
setColor(palette.Alert, "successStandardBg", private_safeLighten(palette.success.light, 0.9));
|
|
3066
|
+
setColor(palette.Alert, "warningStandardBg", private_safeLighten(palette.warning.light, 0.9));
|
|
3067
|
+
setColor(palette.Alert, "errorIconColor", setCssVarColor("palette-error-main"));
|
|
3068
|
+
setColor(palette.Alert, "infoIconColor", setCssVarColor("palette-info-main"));
|
|
3069
|
+
setColor(palette.Alert, "successIconColor", setCssVarColor("palette-success-main"));
|
|
3070
|
+
setColor(palette.Alert, "warningIconColor", setCssVarColor("palette-warning-main"));
|
|
3071
|
+
setColor(palette.AppBar, "defaultBg", setCssVarColor("palette-grey-100"));
|
|
3072
|
+
setColor(palette.Avatar, "defaultBg", setCssVarColor("palette-grey-400"));
|
|
3073
|
+
setColor(palette.Button, "inheritContainedBg", setCssVarColor("palette-grey-300"));
|
|
3074
|
+
setColor(palette.Button, "inheritContainedHoverBg", setCssVarColor("palette-grey-A100"));
|
|
3075
|
+
setColor(palette.Chip, "defaultBorder", setCssVarColor("palette-grey-400"));
|
|
3076
|
+
setColor(palette.Chip, "defaultAvatarColor", setCssVarColor("palette-grey-700"));
|
|
3077
|
+
setColor(palette.Chip, "defaultIconColor", setCssVarColor("palette-grey-700"));
|
|
3078
|
+
setColor(palette.FilledInput, "bg", "rgba(0, 0, 0, 0.06)");
|
|
3079
|
+
setColor(palette.FilledInput, "hoverBg", "rgba(0, 0, 0, 0.09)");
|
|
3080
|
+
setColor(palette.FilledInput, "disabledBg", "rgba(0, 0, 0, 0.12)");
|
|
3081
|
+
setColor(palette.LinearProgress, "primaryBg", private_safeLighten(palette.primary.main, 0.62));
|
|
3082
|
+
setColor(palette.LinearProgress, "secondaryBg", private_safeLighten(palette.secondary.main, 0.62));
|
|
3083
|
+
setColor(palette.LinearProgress, "errorBg", private_safeLighten(palette.error.main, 0.62));
|
|
3084
|
+
setColor(palette.LinearProgress, "infoBg", private_safeLighten(palette.info.main, 0.62));
|
|
3085
|
+
setColor(palette.LinearProgress, "successBg", private_safeLighten(palette.success.main, 0.62));
|
|
3086
|
+
setColor(palette.LinearProgress, "warningBg", private_safeLighten(palette.warning.main, 0.62));
|
|
3087
|
+
setColor(palette.Skeleton, "bg", `rgba(${setCssVarColor("palette-text-primaryChannel")} / 0.11)`);
|
|
3088
|
+
setColor(palette.Slider, "primaryTrack", private_safeLighten(palette.primary.main, 0.62));
|
|
3089
|
+
setColor(palette.Slider, "secondaryTrack", private_safeLighten(palette.secondary.main, 0.62));
|
|
3090
|
+
setColor(palette.Slider, "errorTrack", private_safeLighten(palette.error.main, 0.62));
|
|
3091
|
+
setColor(palette.Slider, "infoTrack", private_safeLighten(palette.info.main, 0.62));
|
|
3092
|
+
setColor(palette.Slider, "successTrack", private_safeLighten(palette.success.main, 0.62));
|
|
3093
|
+
setColor(palette.Slider, "warningTrack", private_safeLighten(palette.warning.main, 0.62));
|
|
3094
|
+
const snackbarContentBackground = private_safeEmphasize(palette.background.default, 0.8);
|
|
3095
|
+
setColor(palette.SnackbarContent, "bg", snackbarContentBackground);
|
|
3096
|
+
setColor(palette.SnackbarContent, "color", silent(() => palette.getContrastText(snackbarContentBackground)));
|
|
3097
|
+
setColor(palette.SpeedDialAction, "fabHoverBg", private_safeEmphasize(palette.background.paper, 0.15));
|
|
3098
|
+
setColor(palette.StepConnector, "border", setCssVarColor("palette-grey-400"));
|
|
3099
|
+
setColor(palette.StepContent, "border", setCssVarColor("palette-grey-400"));
|
|
3100
|
+
setColor(palette.Switch, "defaultColor", setCssVarColor("palette-common-white"));
|
|
3101
|
+
setColor(palette.Switch, "defaultDisabledColor", setCssVarColor("palette-grey-100"));
|
|
3102
|
+
setColor(palette.Switch, "primaryDisabledColor", private_safeLighten(palette.primary.main, 0.62));
|
|
3103
|
+
setColor(palette.Switch, "secondaryDisabledColor", private_safeLighten(palette.secondary.main, 0.62));
|
|
3104
|
+
setColor(palette.Switch, "errorDisabledColor", private_safeLighten(palette.error.main, 0.62));
|
|
3105
|
+
setColor(palette.Switch, "infoDisabledColor", private_safeLighten(palette.info.main, 0.62));
|
|
3106
|
+
setColor(palette.Switch, "successDisabledColor", private_safeLighten(palette.success.main, 0.62));
|
|
3107
|
+
setColor(palette.Switch, "warningDisabledColor", private_safeLighten(palette.warning.main, 0.62));
|
|
3108
|
+
setColor(palette.TableCell, "border", private_safeLighten(private_safeAlpha(palette.divider, 1), 0.88));
|
|
3109
|
+
setColor(palette.Tooltip, "bg", private_safeAlpha(palette.grey[700], 0.92));
|
|
3110
|
+
}
|
|
3111
|
+
if (palette.mode === "dark") {
|
|
3112
|
+
setColor(palette.Alert, "errorColor", private_safeLighten(palette.error.light, 0.6));
|
|
3113
|
+
setColor(palette.Alert, "infoColor", private_safeLighten(palette.info.light, 0.6));
|
|
3114
|
+
setColor(palette.Alert, "successColor", private_safeLighten(palette.success.light, 0.6));
|
|
3115
|
+
setColor(palette.Alert, "warningColor", private_safeLighten(palette.warning.light, 0.6));
|
|
3116
|
+
setColor(palette.Alert, "errorFilledBg", setCssVarColor("palette-error-dark"));
|
|
3117
|
+
setColor(palette.Alert, "infoFilledBg", setCssVarColor("palette-info-dark"));
|
|
3118
|
+
setColor(palette.Alert, "successFilledBg", setCssVarColor("palette-success-dark"));
|
|
3119
|
+
setColor(palette.Alert, "warningFilledBg", setCssVarColor("palette-warning-dark"));
|
|
3120
|
+
setColor(palette.Alert, "errorFilledColor", silent(() => palette.getContrastText(palette.error.dark)));
|
|
3121
|
+
setColor(palette.Alert, "infoFilledColor", silent(() => palette.getContrastText(palette.info.dark)));
|
|
3122
|
+
setColor(palette.Alert, "successFilledColor", silent(() => palette.getContrastText(palette.success.dark)));
|
|
3123
|
+
setColor(palette.Alert, "warningFilledColor", silent(() => palette.getContrastText(palette.warning.dark)));
|
|
3124
|
+
setColor(palette.Alert, "errorStandardBg", private_safeDarken(palette.error.light, 0.9));
|
|
3125
|
+
setColor(palette.Alert, "infoStandardBg", private_safeDarken(palette.info.light, 0.9));
|
|
3126
|
+
setColor(palette.Alert, "successStandardBg", private_safeDarken(palette.success.light, 0.9));
|
|
3127
|
+
setColor(palette.Alert, "warningStandardBg", private_safeDarken(palette.warning.light, 0.9));
|
|
3128
|
+
setColor(palette.Alert, "errorIconColor", setCssVarColor("palette-error-main"));
|
|
3129
|
+
setColor(palette.Alert, "infoIconColor", setCssVarColor("palette-info-main"));
|
|
3130
|
+
setColor(palette.Alert, "successIconColor", setCssVarColor("palette-success-main"));
|
|
3131
|
+
setColor(palette.Alert, "warningIconColor", setCssVarColor("palette-warning-main"));
|
|
3132
|
+
setColor(palette.AppBar, "defaultBg", setCssVarColor("palette-grey-900"));
|
|
3133
|
+
setColor(palette.AppBar, "darkBg", setCssVarColor("palette-background-paper"));
|
|
3134
|
+
setColor(palette.AppBar, "darkColor", setCssVarColor("palette-text-primary"));
|
|
3135
|
+
setColor(palette.Avatar, "defaultBg", setCssVarColor("palette-grey-600"));
|
|
3136
|
+
setColor(palette.Button, "inheritContainedBg", setCssVarColor("palette-grey-800"));
|
|
3137
|
+
setColor(palette.Button, "inheritContainedHoverBg", setCssVarColor("palette-grey-700"));
|
|
3138
|
+
setColor(palette.Chip, "defaultBorder", setCssVarColor("palette-grey-700"));
|
|
3139
|
+
setColor(palette.Chip, "defaultAvatarColor", setCssVarColor("palette-grey-300"));
|
|
3140
|
+
setColor(palette.Chip, "defaultIconColor", setCssVarColor("palette-grey-300"));
|
|
3141
|
+
setColor(palette.FilledInput, "bg", "rgba(255, 255, 255, 0.09)");
|
|
3142
|
+
setColor(palette.FilledInput, "hoverBg", "rgba(255, 255, 255, 0.13)");
|
|
3143
|
+
setColor(palette.FilledInput, "disabledBg", "rgba(255, 255, 255, 0.12)");
|
|
3144
|
+
setColor(palette.LinearProgress, "primaryBg", private_safeDarken(palette.primary.main, 0.5));
|
|
3145
|
+
setColor(palette.LinearProgress, "secondaryBg", private_safeDarken(palette.secondary.main, 0.5));
|
|
3146
|
+
setColor(palette.LinearProgress, "errorBg", private_safeDarken(palette.error.main, 0.5));
|
|
3147
|
+
setColor(palette.LinearProgress, "infoBg", private_safeDarken(palette.info.main, 0.5));
|
|
3148
|
+
setColor(palette.LinearProgress, "successBg", private_safeDarken(palette.success.main, 0.5));
|
|
3149
|
+
setColor(palette.LinearProgress, "warningBg", private_safeDarken(palette.warning.main, 0.5));
|
|
3150
|
+
setColor(palette.Skeleton, "bg", `rgba(${setCssVarColor("palette-text-primaryChannel")} / 0.13)`);
|
|
3151
|
+
setColor(palette.Slider, "primaryTrack", private_safeDarken(palette.primary.main, 0.5));
|
|
3152
|
+
setColor(palette.Slider, "secondaryTrack", private_safeDarken(palette.secondary.main, 0.5));
|
|
3153
|
+
setColor(palette.Slider, "errorTrack", private_safeDarken(palette.error.main, 0.5));
|
|
3154
|
+
setColor(palette.Slider, "infoTrack", private_safeDarken(palette.info.main, 0.5));
|
|
3155
|
+
setColor(palette.Slider, "successTrack", private_safeDarken(palette.success.main, 0.5));
|
|
3156
|
+
setColor(palette.Slider, "warningTrack", private_safeDarken(palette.warning.main, 0.5));
|
|
3157
|
+
const snackbarContentBackground = private_safeEmphasize(palette.background.default, 0.98);
|
|
3158
|
+
setColor(palette.SnackbarContent, "bg", snackbarContentBackground);
|
|
3159
|
+
setColor(palette.SnackbarContent, "color", silent(() => palette.getContrastText(snackbarContentBackground)));
|
|
3160
|
+
setColor(palette.SpeedDialAction, "fabHoverBg", private_safeEmphasize(palette.background.paper, 0.15));
|
|
3161
|
+
setColor(palette.StepConnector, "border", setCssVarColor("palette-grey-600"));
|
|
3162
|
+
setColor(palette.StepContent, "border", setCssVarColor("palette-grey-600"));
|
|
3163
|
+
setColor(palette.Switch, "defaultColor", setCssVarColor("palette-grey-300"));
|
|
3164
|
+
setColor(palette.Switch, "defaultDisabledColor", setCssVarColor("palette-grey-600"));
|
|
3165
|
+
setColor(palette.Switch, "primaryDisabledColor", private_safeDarken(palette.primary.main, 0.55));
|
|
3166
|
+
setColor(palette.Switch, "secondaryDisabledColor", private_safeDarken(palette.secondary.main, 0.55));
|
|
3167
|
+
setColor(palette.Switch, "errorDisabledColor", private_safeDarken(palette.error.main, 0.55));
|
|
3168
|
+
setColor(palette.Switch, "infoDisabledColor", private_safeDarken(palette.info.main, 0.55));
|
|
3169
|
+
setColor(palette.Switch, "successDisabledColor", private_safeDarken(palette.success.main, 0.55));
|
|
3170
|
+
setColor(palette.Switch, "warningDisabledColor", private_safeDarken(palette.warning.main, 0.55));
|
|
3171
|
+
setColor(palette.TableCell, "border", private_safeDarken(private_safeAlpha(palette.divider, 1), 0.68));
|
|
3172
|
+
setColor(palette.Tooltip, "bg", private_safeAlpha(palette.grey[700], 0.92));
|
|
3173
|
+
}
|
|
3174
|
+
setColorChannel(palette.background, "default");
|
|
3175
|
+
setColorChannel(palette.background, "paper");
|
|
3176
|
+
setColorChannel(palette.common, "background");
|
|
3177
|
+
setColorChannel(palette.common, "onBackground");
|
|
3178
|
+
setColorChannel(palette, "divider");
|
|
3179
|
+
Object.keys(palette).forEach((color2) => {
|
|
3180
|
+
const colors = palette[color2];
|
|
3181
|
+
if (color2 !== "tonalOffset" && colors && typeof colors === "object") {
|
|
3182
|
+
if (colors.main) {
|
|
3183
|
+
setColor(palette[color2], "mainChannel", private_safeColorChannel(toRgb(colors.main)));
|
|
3184
|
+
}
|
|
3185
|
+
if (colors.light) {
|
|
3186
|
+
setColor(palette[color2], "lightChannel", private_safeColorChannel(toRgb(colors.light)));
|
|
3187
|
+
}
|
|
3188
|
+
if (colors.dark) {
|
|
3189
|
+
setColor(palette[color2], "darkChannel", private_safeColorChannel(toRgb(colors.dark)));
|
|
3190
|
+
}
|
|
3191
|
+
if (colors.contrastText) {
|
|
3192
|
+
setColor(palette[color2], "contrastTextChannel", private_safeColorChannel(toRgb(colors.contrastText)));
|
|
3193
|
+
}
|
|
3194
|
+
if (color2 === "text") {
|
|
3195
|
+
setColorChannel(palette[color2], "primary");
|
|
3196
|
+
setColorChannel(palette[color2], "secondary");
|
|
3197
|
+
}
|
|
3198
|
+
if (color2 === "action") {
|
|
3199
|
+
if (colors.active) {
|
|
3200
|
+
setColorChannel(palette[color2], "active");
|
|
3201
|
+
}
|
|
3202
|
+
if (colors.selected) {
|
|
3203
|
+
setColorChannel(palette[color2], "selected");
|
|
3204
|
+
}
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
});
|
|
3208
|
+
});
|
|
3209
|
+
theme = args.reduce((acc, argument) => deepmerge(acc, argument), theme);
|
|
3210
|
+
const parserConfig = {
|
|
3211
|
+
prefix: cssVarPrefix,
|
|
3212
|
+
disableCssColorScheme,
|
|
3213
|
+
shouldSkipGeneratingVar: shouldSkipGeneratingVar$1,
|
|
3214
|
+
getSelector: defaultGetSelector(theme)
|
|
3215
|
+
};
|
|
3216
|
+
const {
|
|
3217
|
+
vars,
|
|
3218
|
+
generateThemeVars,
|
|
3219
|
+
generateStyleSheets
|
|
3220
|
+
} = prepareCssVars(theme, parserConfig);
|
|
3221
|
+
theme.vars = vars;
|
|
3222
|
+
Object.entries(theme.colorSchemes[theme.defaultColorScheme]).forEach(([key, value]) => {
|
|
3223
|
+
theme[key] = value;
|
|
3224
|
+
});
|
|
3225
|
+
theme.generateThemeVars = generateThemeVars;
|
|
3226
|
+
theme.generateStyleSheets = generateStyleSheets;
|
|
3227
|
+
theme.generateSpacing = function generateSpacing() {
|
|
3228
|
+
return createSpacing$1(input.spacing, createUnarySpacing(this));
|
|
3229
|
+
};
|
|
3230
|
+
theme.getColorSchemeSelector = createGetColorSchemeSelector(selector);
|
|
3231
|
+
theme.spacing = theme.generateSpacing();
|
|
3232
|
+
theme.shouldSkipGeneratingVar = shouldSkipGeneratingVar$1;
|
|
3233
|
+
theme.unstable_sxConfig = {
|
|
3234
|
+
...defaultSxConfig,
|
|
3235
|
+
...input == null ? void 0 : input.unstable_sxConfig
|
|
3236
|
+
};
|
|
3237
|
+
theme.unstable_sx = function sx(props) {
|
|
3238
|
+
return styleFunctionSx({
|
|
3239
|
+
sx: props,
|
|
3240
|
+
theme: this
|
|
3241
|
+
});
|
|
3242
|
+
};
|
|
3243
|
+
theme.toRuntimeSource = stringifyTheme;
|
|
3244
|
+
return theme;
|
|
3245
|
+
}
|
|
3246
|
+
function attachColorScheme(theme, scheme, colorScheme) {
|
|
3247
|
+
if (!theme.colorSchemes) {
|
|
3248
|
+
return void 0;
|
|
3249
|
+
}
|
|
3250
|
+
if (colorScheme) {
|
|
3251
|
+
theme.colorSchemes[scheme] = {
|
|
3252
|
+
...colorScheme !== true && colorScheme,
|
|
3253
|
+
palette: createPalette({
|
|
3254
|
+
...colorScheme === true ? {} : colorScheme.palette,
|
|
3255
|
+
mode: scheme
|
|
3256
|
+
})
|
|
3257
|
+
// cast type to skip module augmentation test
|
|
3258
|
+
};
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
function createTheme(options = {}, ...args) {
|
|
3262
|
+
const {
|
|
3263
|
+
palette,
|
|
3264
|
+
cssVariables = false,
|
|
3265
|
+
colorSchemes: initialColorSchemes = !palette ? {
|
|
3266
|
+
light: true
|
|
3267
|
+
} : void 0,
|
|
3268
|
+
defaultColorScheme: initialDefaultColorScheme = palette == null ? void 0 : palette.mode,
|
|
3269
|
+
...rest
|
|
3270
|
+
} = options;
|
|
3271
|
+
const defaultColorSchemeInput = initialDefaultColorScheme || "light";
|
|
3272
|
+
const defaultScheme = initialColorSchemes == null ? void 0 : initialColorSchemes[defaultColorSchemeInput];
|
|
3273
|
+
const colorSchemesInput = {
|
|
3274
|
+
...initialColorSchemes,
|
|
3275
|
+
...palette ? {
|
|
3276
|
+
[defaultColorSchemeInput]: {
|
|
3277
|
+
...typeof defaultScheme !== "boolean" && defaultScheme,
|
|
3278
|
+
palette
|
|
3279
|
+
}
|
|
3280
|
+
} : void 0
|
|
3281
|
+
};
|
|
3282
|
+
if (cssVariables === false) {
|
|
3283
|
+
if (!("colorSchemes" in options)) {
|
|
3284
|
+
return createThemeNoVars(options, ...args);
|
|
3285
|
+
}
|
|
3286
|
+
let paletteOptions = palette;
|
|
3287
|
+
if (!("palette" in options)) {
|
|
3288
|
+
if (colorSchemesInput[defaultColorSchemeInput]) {
|
|
3289
|
+
if (colorSchemesInput[defaultColorSchemeInput] !== true) {
|
|
3290
|
+
paletteOptions = colorSchemesInput[defaultColorSchemeInput].palette;
|
|
3291
|
+
} else if (defaultColorSchemeInput === "dark") {
|
|
3292
|
+
paletteOptions = {
|
|
3293
|
+
mode: "dark"
|
|
3294
|
+
};
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
const theme = createThemeNoVars({
|
|
3299
|
+
...options,
|
|
3300
|
+
palette: paletteOptions
|
|
3301
|
+
}, ...args);
|
|
3302
|
+
theme.defaultColorScheme = defaultColorSchemeInput;
|
|
3303
|
+
theme.colorSchemes = colorSchemesInput;
|
|
3304
|
+
if (theme.palette.mode === "light") {
|
|
3305
|
+
theme.colorSchemes.light = {
|
|
3306
|
+
...colorSchemesInput.light !== true && colorSchemesInput.light,
|
|
3307
|
+
palette: theme.palette
|
|
3308
|
+
};
|
|
3309
|
+
attachColorScheme(theme, "dark", colorSchemesInput.dark);
|
|
3310
|
+
}
|
|
3311
|
+
if (theme.palette.mode === "dark") {
|
|
3312
|
+
theme.colorSchemes.dark = {
|
|
3313
|
+
...colorSchemesInput.dark !== true && colorSchemesInput.dark,
|
|
3314
|
+
palette: theme.palette
|
|
3315
|
+
};
|
|
3316
|
+
attachColorScheme(theme, "light", colorSchemesInput.light);
|
|
3317
|
+
}
|
|
3318
|
+
return theme;
|
|
3319
|
+
}
|
|
3320
|
+
if (!palette && !("light" in colorSchemesInput) && defaultColorSchemeInput === "light") {
|
|
3321
|
+
colorSchemesInput.light = true;
|
|
3322
|
+
}
|
|
3323
|
+
return createThemeWithVars({
|
|
3324
|
+
...rest,
|
|
3325
|
+
colorSchemes: colorSchemesInput,
|
|
3326
|
+
defaultColorScheme: defaultColorSchemeInput,
|
|
3327
|
+
...typeof cssVariables !== "boolean" && cssVariables
|
|
3328
|
+
}, ...args);
|
|
3329
|
+
}
|
|
3330
|
+
const defaultTheme = createTheme();
|
|
3331
|
+
const THEME_ID = "$$material";
|
|
3332
|
+
function preprocessStyles(input) {
|
|
3333
|
+
const {
|
|
3334
|
+
variants,
|
|
3335
|
+
...style2
|
|
3336
|
+
} = input;
|
|
3337
|
+
const result = {
|
|
3338
|
+
variants,
|
|
3339
|
+
style: internal_serializeStyles(style2),
|
|
3340
|
+
isProcessed: true
|
|
3341
|
+
};
|
|
3342
|
+
if (result.style === style2) {
|
|
3343
|
+
return result;
|
|
3344
|
+
}
|
|
3345
|
+
if (variants) {
|
|
3346
|
+
variants.forEach((variant) => {
|
|
3347
|
+
if (typeof variant.style !== "function") {
|
|
3348
|
+
variant.style = internal_serializeStyles(variant.style);
|
|
3349
|
+
}
|
|
3350
|
+
});
|
|
3351
|
+
}
|
|
3352
|
+
return result;
|
|
3353
|
+
}
|
|
3354
|
+
const systemDefaultTheme = createTheme$1();
|
|
3355
|
+
function shouldForwardProp(prop) {
|
|
3356
|
+
return prop !== "ownerState" && prop !== "theme" && prop !== "sx" && prop !== "as";
|
|
3357
|
+
}
|
|
3358
|
+
function shallowLayer(serialized, layerName) {
|
|
3359
|
+
if (layerName && serialized && typeof serialized === "object" && serialized.styles && !serialized.styles.startsWith("@layer")) {
|
|
3360
|
+
serialized.styles = `@layer ${layerName}{${String(serialized.styles)}}`;
|
|
3361
|
+
}
|
|
3362
|
+
return serialized;
|
|
3363
|
+
}
|
|
3364
|
+
function defaultOverridesResolver(slot) {
|
|
3365
|
+
if (!slot) {
|
|
3366
|
+
return null;
|
|
3367
|
+
}
|
|
3368
|
+
return (_props, styles) => styles[slot];
|
|
3369
|
+
}
|
|
3370
|
+
function attachTheme(props, themeId, defaultTheme2) {
|
|
3371
|
+
props.theme = isObjectEmpty(props.theme) ? defaultTheme2 : props.theme[themeId] || props.theme;
|
|
3372
|
+
}
|
|
3373
|
+
function processStyle(props, style2, layerName) {
|
|
3374
|
+
const resolvedStyle = typeof style2 === "function" ? style2(props) : style2;
|
|
3375
|
+
if (Array.isArray(resolvedStyle)) {
|
|
3376
|
+
return resolvedStyle.flatMap((subStyle) => processStyle(props, subStyle, layerName));
|
|
3377
|
+
}
|
|
3378
|
+
if (Array.isArray(resolvedStyle == null ? void 0 : resolvedStyle.variants)) {
|
|
3379
|
+
let rootStyle;
|
|
3380
|
+
if (resolvedStyle.isProcessed) {
|
|
3381
|
+
rootStyle = layerName ? shallowLayer(resolvedStyle.style, layerName) : resolvedStyle.style;
|
|
3382
|
+
} else {
|
|
3383
|
+
const {
|
|
3384
|
+
variants,
|
|
3385
|
+
...otherStyles
|
|
3386
|
+
} = resolvedStyle;
|
|
3387
|
+
rootStyle = layerName ? shallowLayer(internal_serializeStyles(otherStyles), layerName) : otherStyles;
|
|
3388
|
+
}
|
|
3389
|
+
return processStyleVariants(props, resolvedStyle.variants, [rootStyle], layerName);
|
|
3390
|
+
}
|
|
3391
|
+
if (resolvedStyle == null ? void 0 : resolvedStyle.isProcessed) {
|
|
3392
|
+
return layerName ? shallowLayer(internal_serializeStyles(resolvedStyle.style), layerName) : resolvedStyle.style;
|
|
3393
|
+
}
|
|
3394
|
+
return layerName ? shallowLayer(internal_serializeStyles(resolvedStyle), layerName) : resolvedStyle;
|
|
3395
|
+
}
|
|
3396
|
+
function processStyleVariants(props, variants, results = [], layerName = void 0) {
|
|
3397
|
+
var _a;
|
|
3398
|
+
let mergedState;
|
|
3399
|
+
variantLoop: for (let i = 0; i < variants.length; i += 1) {
|
|
3400
|
+
const variant = variants[i];
|
|
3401
|
+
if (typeof variant.props === "function") {
|
|
3402
|
+
mergedState ?? (mergedState = {
|
|
3403
|
+
...props,
|
|
3404
|
+
...props.ownerState,
|
|
3405
|
+
ownerState: props.ownerState
|
|
3406
|
+
});
|
|
3407
|
+
if (!variant.props(mergedState)) {
|
|
3408
|
+
continue;
|
|
3409
|
+
}
|
|
3410
|
+
} else {
|
|
3411
|
+
for (const key in variant.props) {
|
|
3412
|
+
if (props[key] !== variant.props[key] && ((_a = props.ownerState) == null ? void 0 : _a[key]) !== variant.props[key]) {
|
|
3413
|
+
continue variantLoop;
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
3416
|
+
}
|
|
3417
|
+
if (typeof variant.style === "function") {
|
|
3418
|
+
mergedState ?? (mergedState = {
|
|
3419
|
+
...props,
|
|
3420
|
+
...props.ownerState,
|
|
3421
|
+
ownerState: props.ownerState
|
|
3422
|
+
});
|
|
3423
|
+
results.push(layerName ? shallowLayer(internal_serializeStyles(variant.style(mergedState)), layerName) : variant.style(mergedState));
|
|
3424
|
+
} else {
|
|
3425
|
+
results.push(layerName ? shallowLayer(internal_serializeStyles(variant.style), layerName) : variant.style);
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
return results;
|
|
3429
|
+
}
|
|
3430
|
+
function createStyled(input = {}) {
|
|
3431
|
+
const {
|
|
3432
|
+
themeId,
|
|
3433
|
+
defaultTheme: defaultTheme2 = systemDefaultTheme,
|
|
3434
|
+
rootShouldForwardProp: rootShouldForwardProp2 = shouldForwardProp,
|
|
3435
|
+
slotShouldForwardProp: slotShouldForwardProp2 = shouldForwardProp
|
|
3436
|
+
} = input;
|
|
3437
|
+
function styleAttachTheme(props) {
|
|
3438
|
+
attachTheme(props, themeId, defaultTheme2);
|
|
3439
|
+
}
|
|
3440
|
+
const styled2 = (tag, inputOptions = {}) => {
|
|
3441
|
+
internal_mutateStyles(tag, (styles) => styles.filter((style2) => style2 !== styleFunctionSx));
|
|
3442
|
+
const {
|
|
3443
|
+
name: componentName,
|
|
3444
|
+
slot: componentSlot,
|
|
3445
|
+
skipVariantsResolver: inputSkipVariantsResolver,
|
|
3446
|
+
skipSx: inputSkipSx,
|
|
3447
|
+
// TODO v6: remove `lowercaseFirstLetter()` in the next major release
|
|
3448
|
+
// For more details: https://github.com/mui/material-ui/pull/37908
|
|
3449
|
+
overridesResolver = defaultOverridesResolver(lowercaseFirstLetter(componentSlot)),
|
|
3450
|
+
...options
|
|
3451
|
+
} = inputOptions;
|
|
3452
|
+
const layerName = componentName && componentName.startsWith("Mui") || !!componentSlot ? "components" : "custom";
|
|
3453
|
+
const skipVariantsResolver = inputSkipVariantsResolver !== void 0 ? inputSkipVariantsResolver : (
|
|
3454
|
+
// TODO v6: remove `Root` in the next major release
|
|
3455
|
+
// For more details: https://github.com/mui/material-ui/pull/37908
|
|
3456
|
+
componentSlot && componentSlot !== "Root" && componentSlot !== "root" || false
|
|
3457
|
+
);
|
|
3458
|
+
const skipSx = inputSkipSx || false;
|
|
3459
|
+
let shouldForwardPropOption = shouldForwardProp;
|
|
3460
|
+
if (componentSlot === "Root" || componentSlot === "root") {
|
|
3461
|
+
shouldForwardPropOption = rootShouldForwardProp2;
|
|
3462
|
+
} else if (componentSlot) {
|
|
3463
|
+
shouldForwardPropOption = slotShouldForwardProp2;
|
|
3464
|
+
} else if (isStringTag(tag)) {
|
|
3465
|
+
shouldForwardPropOption = void 0;
|
|
3466
|
+
}
|
|
3467
|
+
const defaultStyledResolver = styled$1(tag, {
|
|
3468
|
+
shouldForwardProp: shouldForwardPropOption,
|
|
3469
|
+
label: generateStyledLabel(componentName, componentSlot),
|
|
3470
|
+
...options
|
|
3471
|
+
});
|
|
3472
|
+
const transformStyle = (style2) => {
|
|
3473
|
+
if (style2.__emotion_real === style2) {
|
|
3474
|
+
return style2;
|
|
3475
|
+
}
|
|
3476
|
+
if (typeof style2 === "function") {
|
|
3477
|
+
return function styleFunctionProcessor(props) {
|
|
3478
|
+
return processStyle(props, style2, props.theme.modularCssLayers ? layerName : void 0);
|
|
3479
|
+
};
|
|
3480
|
+
}
|
|
3481
|
+
if (isPlainObject(style2)) {
|
|
3482
|
+
const serialized = preprocessStyles(style2);
|
|
3483
|
+
return function styleObjectProcessor(props) {
|
|
3484
|
+
if (!serialized.variants) {
|
|
3485
|
+
return props.theme.modularCssLayers ? shallowLayer(serialized.style, layerName) : serialized.style;
|
|
3486
|
+
}
|
|
3487
|
+
return processStyle(props, serialized, props.theme.modularCssLayers ? layerName : void 0);
|
|
3488
|
+
};
|
|
3489
|
+
}
|
|
3490
|
+
return style2;
|
|
3491
|
+
};
|
|
3492
|
+
const muiStyledResolver = (...expressionsInput) => {
|
|
3493
|
+
const expressionsHead = [];
|
|
3494
|
+
const expressionsBody = expressionsInput.map(transformStyle);
|
|
3495
|
+
const expressionsTail = [];
|
|
3496
|
+
expressionsHead.push(styleAttachTheme);
|
|
3497
|
+
if (componentName && overridesResolver) {
|
|
3498
|
+
expressionsTail.push(function styleThemeOverrides(props) {
|
|
3499
|
+
var _a, _b;
|
|
3500
|
+
const theme = props.theme;
|
|
3501
|
+
const styleOverrides = (_b = (_a = theme.components) == null ? void 0 : _a[componentName]) == null ? void 0 : _b.styleOverrides;
|
|
3502
|
+
if (!styleOverrides) {
|
|
3503
|
+
return null;
|
|
3504
|
+
}
|
|
3505
|
+
const resolvedStyleOverrides = {};
|
|
3506
|
+
for (const slotKey in styleOverrides) {
|
|
3507
|
+
resolvedStyleOverrides[slotKey] = processStyle(props, styleOverrides[slotKey], props.theme.modularCssLayers ? "theme" : void 0);
|
|
3508
|
+
}
|
|
3509
|
+
return overridesResolver(props, resolvedStyleOverrides);
|
|
3510
|
+
});
|
|
3511
|
+
}
|
|
3512
|
+
if (componentName && !skipVariantsResolver) {
|
|
3513
|
+
expressionsTail.push(function styleThemeVariants(props) {
|
|
3514
|
+
var _a, _b;
|
|
3515
|
+
const theme = props.theme;
|
|
3516
|
+
const themeVariants = (_b = (_a = theme == null ? void 0 : theme.components) == null ? void 0 : _a[componentName]) == null ? void 0 : _b.variants;
|
|
3517
|
+
if (!themeVariants) {
|
|
3518
|
+
return null;
|
|
3519
|
+
}
|
|
3520
|
+
return processStyleVariants(props, themeVariants, [], props.theme.modularCssLayers ? "theme" : void 0);
|
|
3521
|
+
});
|
|
3522
|
+
}
|
|
3523
|
+
if (!skipSx) {
|
|
3524
|
+
expressionsTail.push(styleFunctionSx);
|
|
3525
|
+
}
|
|
3526
|
+
if (Array.isArray(expressionsBody[0])) {
|
|
3527
|
+
const inputStrings = expressionsBody.shift();
|
|
3528
|
+
const placeholdersHead = new Array(expressionsHead.length).fill("");
|
|
3529
|
+
const placeholdersTail = new Array(expressionsTail.length).fill("");
|
|
3530
|
+
let outputStrings;
|
|
3531
|
+
{
|
|
3532
|
+
outputStrings = [...placeholdersHead, ...inputStrings, ...placeholdersTail];
|
|
3533
|
+
outputStrings.raw = [...placeholdersHead, ...inputStrings.raw, ...placeholdersTail];
|
|
3534
|
+
}
|
|
3535
|
+
expressionsHead.unshift(outputStrings);
|
|
3536
|
+
}
|
|
3537
|
+
const expressions = [...expressionsHead, ...expressionsBody, ...expressionsTail];
|
|
3538
|
+
const Component = defaultStyledResolver(...expressions);
|
|
3539
|
+
if (tag.muiName) {
|
|
3540
|
+
Component.muiName = tag.muiName;
|
|
3541
|
+
}
|
|
3542
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3543
|
+
Component.displayName = generateDisplayName(componentName, componentSlot, tag);
|
|
3544
|
+
}
|
|
3545
|
+
return Component;
|
|
3546
|
+
};
|
|
3547
|
+
if (defaultStyledResolver.withConfig) {
|
|
3548
|
+
muiStyledResolver.withConfig = defaultStyledResolver.withConfig;
|
|
3549
|
+
}
|
|
3550
|
+
return muiStyledResolver;
|
|
3551
|
+
};
|
|
3552
|
+
return styled2;
|
|
3553
|
+
}
|
|
3554
|
+
function generateDisplayName(componentName, componentSlot, tag) {
|
|
3555
|
+
if (componentName) {
|
|
3556
|
+
return `${componentName}${capitalize(componentSlot || "")}`;
|
|
3557
|
+
}
|
|
3558
|
+
return `Styled(${getDisplayName(tag)})`;
|
|
3559
|
+
}
|
|
3560
|
+
function generateStyledLabel(componentName, componentSlot) {
|
|
3561
|
+
let label;
|
|
3562
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3563
|
+
if (componentName) {
|
|
3564
|
+
label = `${componentName}-${lowercaseFirstLetter(componentSlot || "Root")}`;
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
return label;
|
|
3568
|
+
}
|
|
3569
|
+
function isObjectEmpty(object) {
|
|
3570
|
+
for (const _ in object) {
|
|
3571
|
+
return false;
|
|
3572
|
+
}
|
|
3573
|
+
return true;
|
|
3574
|
+
}
|
|
3575
|
+
function isStringTag(tag) {
|
|
3576
|
+
return typeof tag === "string" && // 96 is one less than the char code
|
|
3577
|
+
// for "a" so this is checking that
|
|
3578
|
+
// it's a lowercase character
|
|
3579
|
+
tag.charCodeAt(0) > 96;
|
|
3580
|
+
}
|
|
3581
|
+
function lowercaseFirstLetter(string) {
|
|
3582
|
+
if (!string) {
|
|
3583
|
+
return string;
|
|
3584
|
+
}
|
|
3585
|
+
return string.charAt(0).toLowerCase() + string.slice(1);
|
|
3586
|
+
}
|
|
3587
|
+
function slotShouldForwardProp(prop) {
|
|
3588
|
+
return prop !== "ownerState" && prop !== "theme" && prop !== "sx" && prop !== "as";
|
|
3589
|
+
}
|
|
3590
|
+
const rootShouldForwardProp = (prop) => slotShouldForwardProp(prop) && prop !== "classes";
|
|
3591
|
+
const styled = createStyled({
|
|
3592
|
+
themeId: THEME_ID,
|
|
3593
|
+
defaultTheme,
|
|
3594
|
+
rootShouldForwardProp
|
|
3595
|
+
});
|
|
3596
|
+
const memoTheme = unstable_memoTheme;
|
|
3597
|
+
process.env.NODE_ENV !== "production" ? {
|
|
3598
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
3599
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
3600
|
+
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
3601
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
3602
|
+
/**
|
|
3603
|
+
* @ignore
|
|
3604
|
+
*/
|
|
3605
|
+
children: PropTypes.node,
|
|
3606
|
+
/**
|
|
3607
|
+
* @ignore
|
|
3608
|
+
*/
|
|
3609
|
+
value: PropTypes.object.isRequired
|
|
3610
|
+
} : void 0;
|
|
3611
|
+
function useDefaultProps(params) {
|
|
3612
|
+
return useDefaultProps$1(params);
|
|
3613
|
+
}
|
|
3614
|
+
function getSvgIconUtilityClass(slot) {
|
|
3615
|
+
return generateUtilityClass("MuiSvgIcon", slot);
|
|
3616
|
+
}
|
|
3617
|
+
generateUtilityClasses("MuiSvgIcon", ["root", "colorPrimary", "colorSecondary", "colorAction", "colorError", "colorDisabled", "fontSizeInherit", "fontSizeSmall", "fontSizeMedium", "fontSizeLarge"]);
|
|
3618
|
+
const useUtilityClasses = (ownerState) => {
|
|
3619
|
+
const {
|
|
3620
|
+
color: color2,
|
|
3621
|
+
fontSize,
|
|
3622
|
+
classes
|
|
3623
|
+
} = ownerState;
|
|
3624
|
+
const slots = {
|
|
3625
|
+
root: ["root", color2 !== "inherit" && `color${capitalize(color2)}`, `fontSize${capitalize(fontSize)}`]
|
|
3626
|
+
};
|
|
3627
|
+
return composeClasses(slots, getSvgIconUtilityClass, classes);
|
|
3628
|
+
};
|
|
3629
|
+
const SvgIconRoot = styled("svg", {
|
|
3630
|
+
name: "MuiSvgIcon",
|
|
3631
|
+
slot: "Root",
|
|
3632
|
+
overridesResolver: (props, styles) => {
|
|
3633
|
+
const {
|
|
3634
|
+
ownerState
|
|
3635
|
+
} = props;
|
|
3636
|
+
return [styles.root, ownerState.color !== "inherit" && styles[`color${capitalize(ownerState.color)}`], styles[`fontSize${capitalize(ownerState.fontSize)}`]];
|
|
3637
|
+
}
|
|
3638
|
+
})(memoTheme(({
|
|
3639
|
+
theme
|
|
3640
|
+
}) => {
|
|
3641
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
3642
|
+
return {
|
|
3643
|
+
userSelect: "none",
|
|
3644
|
+
width: "1em",
|
|
3645
|
+
height: "1em",
|
|
3646
|
+
display: "inline-block",
|
|
3647
|
+
flexShrink: 0,
|
|
3648
|
+
transition: (_d = (_a = theme.transitions) == null ? void 0 : _a.create) == null ? void 0 : _d.call(_a, "fill", {
|
|
3649
|
+
duration: (_c = (_b = (theme.vars ?? theme).transitions) == null ? void 0 : _b.duration) == null ? void 0 : _c.shorter
|
|
3650
|
+
}),
|
|
3651
|
+
variants: [
|
|
3652
|
+
{
|
|
3653
|
+
props: (props) => !props.hasSvgAsChild,
|
|
3654
|
+
style: {
|
|
3655
|
+
// the <svg> will define the property that has `currentColor`
|
|
3656
|
+
// for example heroicons uses fill="none" and stroke="currentColor"
|
|
3657
|
+
fill: "currentColor"
|
|
3658
|
+
}
|
|
3659
|
+
},
|
|
3660
|
+
{
|
|
3661
|
+
props: {
|
|
3662
|
+
fontSize: "inherit"
|
|
3663
|
+
},
|
|
3664
|
+
style: {
|
|
3665
|
+
fontSize: "inherit"
|
|
3666
|
+
}
|
|
3667
|
+
},
|
|
3668
|
+
{
|
|
3669
|
+
props: {
|
|
3670
|
+
fontSize: "small"
|
|
3671
|
+
},
|
|
3672
|
+
style: {
|
|
3673
|
+
fontSize: ((_f = (_e = theme.typography) == null ? void 0 : _e.pxToRem) == null ? void 0 : _f.call(_e, 20)) || "1.25rem"
|
|
3674
|
+
}
|
|
3675
|
+
},
|
|
3676
|
+
{
|
|
3677
|
+
props: {
|
|
3678
|
+
fontSize: "medium"
|
|
3679
|
+
},
|
|
3680
|
+
style: {
|
|
3681
|
+
fontSize: ((_h = (_g = theme.typography) == null ? void 0 : _g.pxToRem) == null ? void 0 : _h.call(_g, 24)) || "1.5rem"
|
|
3682
|
+
}
|
|
3683
|
+
},
|
|
3684
|
+
{
|
|
3685
|
+
props: {
|
|
3686
|
+
fontSize: "large"
|
|
3687
|
+
},
|
|
3688
|
+
style: {
|
|
3689
|
+
fontSize: ((_j = (_i = theme.typography) == null ? void 0 : _i.pxToRem) == null ? void 0 : _j.call(_i, 35)) || "2.1875rem"
|
|
3690
|
+
}
|
|
3691
|
+
},
|
|
3692
|
+
// TODO v5 deprecate color prop, v6 remove for sx
|
|
3693
|
+
...Object.entries((theme.vars ?? theme).palette).filter(([, value]) => value && value.main).map(([color2]) => {
|
|
3694
|
+
var _a2, _b2;
|
|
3695
|
+
return {
|
|
3696
|
+
props: {
|
|
3697
|
+
color: color2
|
|
3698
|
+
},
|
|
3699
|
+
style: {
|
|
3700
|
+
color: (_b2 = (_a2 = (theme.vars ?? theme).palette) == null ? void 0 : _a2[color2]) == null ? void 0 : _b2.main
|
|
3701
|
+
}
|
|
3702
|
+
};
|
|
3703
|
+
}),
|
|
3704
|
+
{
|
|
3705
|
+
props: {
|
|
3706
|
+
color: "action"
|
|
3707
|
+
},
|
|
3708
|
+
style: {
|
|
3709
|
+
color: (_l = (_k = (theme.vars ?? theme).palette) == null ? void 0 : _k.action) == null ? void 0 : _l.active
|
|
3710
|
+
}
|
|
3711
|
+
},
|
|
3712
|
+
{
|
|
3713
|
+
props: {
|
|
3714
|
+
color: "disabled"
|
|
3715
|
+
},
|
|
3716
|
+
style: {
|
|
3717
|
+
color: (_n = (_m = (theme.vars ?? theme).palette) == null ? void 0 : _m.action) == null ? void 0 : _n.disabled
|
|
3718
|
+
}
|
|
3719
|
+
},
|
|
3720
|
+
{
|
|
3721
|
+
props: {
|
|
3722
|
+
color: "inherit"
|
|
3723
|
+
},
|
|
3724
|
+
style: {
|
|
3725
|
+
color: void 0
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
]
|
|
3729
|
+
};
|
|
3730
|
+
}));
|
|
3731
|
+
const SvgIcon = /* @__PURE__ */ React.forwardRef(function SvgIcon2(inProps, ref) {
|
|
3732
|
+
const props = useDefaultProps({
|
|
3733
|
+
props: inProps,
|
|
3734
|
+
name: "MuiSvgIcon"
|
|
3735
|
+
});
|
|
3736
|
+
const {
|
|
3737
|
+
children,
|
|
3738
|
+
className,
|
|
3739
|
+
color: color2 = "inherit",
|
|
3740
|
+
component = "svg",
|
|
3741
|
+
fontSize = "medium",
|
|
3742
|
+
htmlColor,
|
|
3743
|
+
inheritViewBox = false,
|
|
3744
|
+
titleAccess,
|
|
3745
|
+
viewBox = "0 0 24 24",
|
|
3746
|
+
...other
|
|
3747
|
+
} = props;
|
|
3748
|
+
const hasSvgAsChild = /* @__PURE__ */ React.isValidElement(children) && children.type === "svg";
|
|
3749
|
+
const ownerState = {
|
|
3750
|
+
...props,
|
|
3751
|
+
color: color2,
|
|
3752
|
+
component,
|
|
3753
|
+
fontSize,
|
|
3754
|
+
instanceFontSize: inProps.fontSize,
|
|
3755
|
+
inheritViewBox,
|
|
3756
|
+
viewBox,
|
|
3757
|
+
hasSvgAsChild
|
|
3758
|
+
};
|
|
3759
|
+
const more = {};
|
|
3760
|
+
if (!inheritViewBox) {
|
|
3761
|
+
more.viewBox = viewBox;
|
|
3762
|
+
}
|
|
3763
|
+
const classes = useUtilityClasses(ownerState);
|
|
3764
|
+
return /* @__PURE__ */ jsxs(SvgIconRoot, {
|
|
3765
|
+
as: component,
|
|
3766
|
+
className: clsx(classes.root, className),
|
|
3767
|
+
focusable: "false",
|
|
3768
|
+
color: htmlColor,
|
|
3769
|
+
"aria-hidden": titleAccess ? void 0 : true,
|
|
3770
|
+
role: titleAccess ? "img" : void 0,
|
|
3771
|
+
ref,
|
|
3772
|
+
...more,
|
|
3773
|
+
...other,
|
|
3774
|
+
...hasSvgAsChild && children.props,
|
|
3775
|
+
ownerState,
|
|
3776
|
+
children: [hasSvgAsChild ? children.props.children : children, titleAccess ? /* @__PURE__ */ jsx("title", {
|
|
3777
|
+
children: titleAccess
|
|
3778
|
+
}) : null]
|
|
3779
|
+
});
|
|
3780
|
+
});
|
|
3781
|
+
process.env.NODE_ENV !== "production" ? SvgIcon.propTypes = {
|
|
3782
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
3783
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
3784
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
3785
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
3786
|
+
/**
|
|
3787
|
+
* Node passed into the SVG element.
|
|
3788
|
+
*/
|
|
3789
|
+
children: PropTypes.node,
|
|
3790
|
+
/**
|
|
3791
|
+
* Override or extend the styles applied to the component.
|
|
3792
|
+
*/
|
|
3793
|
+
classes: PropTypes.object,
|
|
3794
|
+
/**
|
|
3795
|
+
* @ignore
|
|
3796
|
+
*/
|
|
3797
|
+
className: PropTypes.string,
|
|
3798
|
+
/**
|
|
3799
|
+
* The color of the component.
|
|
3800
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
3801
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
3802
|
+
* You can use the `htmlColor` prop to apply a color attribute to the SVG element.
|
|
3803
|
+
* @default 'inherit'
|
|
3804
|
+
*/
|
|
3805
|
+
color: PropTypes.oneOfType([PropTypes.oneOf(["inherit", "action", "disabled", "primary", "secondary", "error", "info", "success", "warning"]), PropTypes.string]),
|
|
3806
|
+
/**
|
|
3807
|
+
* The component used for the root node.
|
|
3808
|
+
* Either a string to use a HTML element or a component.
|
|
3809
|
+
*/
|
|
3810
|
+
component: PropTypes.elementType,
|
|
3811
|
+
/**
|
|
3812
|
+
* The fontSize applied to the icon. Defaults to 24px, but can be configure to inherit font size.
|
|
3813
|
+
* @default 'medium'
|
|
3814
|
+
*/
|
|
3815
|
+
fontSize: PropTypes.oneOfType([PropTypes.oneOf(["inherit", "large", "medium", "small"]), PropTypes.string]),
|
|
3816
|
+
/**
|
|
3817
|
+
* Applies a color attribute to the SVG element.
|
|
3818
|
+
*/
|
|
3819
|
+
htmlColor: PropTypes.string,
|
|
3820
|
+
/**
|
|
3821
|
+
* If `true`, the root node will inherit the custom `component`'s viewBox and the `viewBox`
|
|
3822
|
+
* prop will be ignored.
|
|
3823
|
+
* Useful when you want to reference a custom `component` and have `SvgIcon` pass that
|
|
3824
|
+
* `component`'s viewBox to the root node.
|
|
3825
|
+
* @default false
|
|
3826
|
+
*/
|
|
3827
|
+
inheritViewBox: PropTypes.bool,
|
|
3828
|
+
/**
|
|
3829
|
+
* The shape-rendering attribute. The behavior of the different options is described on the
|
|
3830
|
+
* [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering).
|
|
3831
|
+
* If you are having issues with blurry icons you should investigate this prop.
|
|
3832
|
+
*/
|
|
3833
|
+
shapeRendering: PropTypes.string,
|
|
3834
|
+
/**
|
|
3835
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
3836
|
+
*/
|
|
3837
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
3838
|
+
/**
|
|
3839
|
+
* Provides a human-readable title for the element that contains it.
|
|
3840
|
+
* https://www.w3.org/TR/SVG-access/#Equivalent
|
|
3841
|
+
*/
|
|
3842
|
+
titleAccess: PropTypes.string,
|
|
3843
|
+
/**
|
|
3844
|
+
* Allows you to redefine what the coordinates without units mean inside an SVG element.
|
|
3845
|
+
* For example, if the SVG element is 500 (width) by 200 (height),
|
|
3846
|
+
* and you pass viewBox="0 0 50 20",
|
|
3847
|
+
* this means that the coordinates inside the SVG will go from the top left corner (0,0)
|
|
3848
|
+
* to bottom right (50,20) and each unit will be worth 10px.
|
|
3849
|
+
* @default '0 0 24 24'
|
|
3850
|
+
*/
|
|
3851
|
+
viewBox: PropTypes.string
|
|
3852
|
+
} : void 0;
|
|
3853
|
+
SvgIcon.muiName = "SvgIcon";
|
|
3854
|
+
function createSvgIcon(path, displayName) {
|
|
3855
|
+
function Component(props, ref) {
|
|
3856
|
+
return /* @__PURE__ */ jsx(SvgIcon, {
|
|
3857
|
+
"data-testid": `${displayName}Icon`,
|
|
3858
|
+
ref,
|
|
3859
|
+
...props,
|
|
3860
|
+
children: path
|
|
3861
|
+
});
|
|
3862
|
+
}
|
|
3863
|
+
if (process.env.NODE_ENV !== "production") {
|
|
3864
|
+
Component.displayName = `${displayName}Icon`;
|
|
3865
|
+
}
|
|
3866
|
+
Component.muiName = SvgIcon.muiName;
|
|
3867
|
+
return /* @__PURE__ */ React.memo(/* @__PURE__ */ React.forwardRef(Component));
|
|
3868
|
+
}
|
|
3869
|
+
const ErrorIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
3870
|
+
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"
|
|
3871
|
+
}), "Error");
|
|
3872
|
+
const VisibilityIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
3873
|
+
d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"
|
|
3874
|
+
}), "Visibility");
|
|
3875
|
+
const ContentCopyIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
3876
|
+
d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"
|
|
3877
|
+
}), "ContentCopy");
|
|
3878
|
+
const CheckIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
3879
|
+
d: "M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"
|
|
3880
|
+
}), "Check");
|
|
3881
|
+
const OpenInFullIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
3882
|
+
d: "M21 11V3h-8l3.29 3.29-10 10L3 13v8h8l-3.29-3.29 10-10z"
|
|
3883
|
+
}), "OpenInFull");
|
|
3884
|
+
function SingleMessage({
|
|
3885
|
+
contentMessage,
|
|
3886
|
+
timeMessage,
|
|
3887
|
+
isChatbot,
|
|
3888
|
+
isLoading = false,
|
|
3889
|
+
icon,
|
|
3890
|
+
nameChatbot,
|
|
3891
|
+
status,
|
|
3892
|
+
sources,
|
|
3893
|
+
themeInfo = "light"
|
|
3894
|
+
}) {
|
|
3895
|
+
sources = sources || [];
|
|
3896
|
+
const theme = useTheme();
|
|
3897
|
+
const [copiedSource, setCopiedSource] = useState(null);
|
|
3898
|
+
const [showAllSources, setShowAllSources] = useState(false);
|
|
3899
|
+
const [expandedChips, setExpandedChips] = useState(/* @__PURE__ */ new Set());
|
|
3900
|
+
const maxVisibleSources = 8;
|
|
3901
|
+
const visibleSources = sources.slice(0, maxVisibleSources);
|
|
3902
|
+
const remainingSources = sources.length - maxVisibleSources;
|
|
3903
|
+
const copySource = async (source) => {
|
|
3904
|
+
try {
|
|
3905
|
+
await navigator.clipboard.writeText(source.url);
|
|
3906
|
+
setCopiedSource(source.url);
|
|
3907
|
+
setTimeout(() => setCopiedSource(null), 2e3);
|
|
3908
|
+
} catch (err) {
|
|
3909
|
+
console.error("Errore durante la copia:", err);
|
|
3910
|
+
}
|
|
3911
|
+
};
|
|
3912
|
+
const toggleChipExpansion = (url) => {
|
|
3913
|
+
const newSet = new Set(expandedChips);
|
|
3914
|
+
if (newSet.has(url)) {
|
|
3915
|
+
newSet.delete(url);
|
|
3916
|
+
if (newSet.size < sources.length) {
|
|
3917
|
+
setShowAllSources(false);
|
|
3918
|
+
}
|
|
3919
|
+
} else {
|
|
3920
|
+
newSet.add(url);
|
|
3921
|
+
if (newSet.size === sources.length) {
|
|
3922
|
+
setShowAllSources(true);
|
|
3923
|
+
}
|
|
3924
|
+
}
|
|
3925
|
+
setExpandedChips(newSet);
|
|
3926
|
+
};
|
|
3927
|
+
const getTypeColor = (source) => {
|
|
3928
|
+
const baseColor = getStableColor(source, themeInfo);
|
|
3929
|
+
const hexToRgb2 = (hex) => {
|
|
3930
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
3931
|
+
return result ? {
|
|
3932
|
+
r: parseInt(result[1], 16),
|
|
3933
|
+
g: parseInt(result[2], 16),
|
|
3934
|
+
b: parseInt(result[3], 16)
|
|
3935
|
+
} : { r: 200, g: 200, b: 200 };
|
|
3936
|
+
};
|
|
3937
|
+
const rgb = hexToRgb2(baseColor);
|
|
3938
|
+
const backgroundOpacity = themeInfo === "light" ? 0.1 : 0.2;
|
|
3939
|
+
const borderOpacity = themeInfo === "light" ? 0.3 : 0.4;
|
|
3940
|
+
const lightBackground = `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${backgroundOpacity})`;
|
|
3941
|
+
const lightBorder = `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${borderOpacity})`;
|
|
3942
|
+
return {
|
|
3943
|
+
backgroundColor: lightBackground,
|
|
3944
|
+
color: baseColor,
|
|
3945
|
+
borderColor: lightBorder
|
|
3946
|
+
};
|
|
3947
|
+
};
|
|
3948
|
+
const ariaLabel = (isChatbot ? nameChatbot + " " + Translate({ label: "sendMessage" }) : Translate({ label: "youSendMessage" })) + timeMessage;
|
|
3949
|
+
return /* @__PURE__ */ jsxs(
|
|
3950
|
+
Box,
|
|
3951
|
+
{
|
|
3952
|
+
className: "openk9-single-message-container",
|
|
3953
|
+
display: "flex",
|
|
3954
|
+
flexDirection: "column",
|
|
3955
|
+
gap: "5px",
|
|
3956
|
+
width: "100%",
|
|
3957
|
+
children: [
|
|
3958
|
+
(status == null ? void 0 : status.toUpperCase()) === "ERROR" ? /* @__PURE__ */ jsxs(
|
|
3959
|
+
Box,
|
|
3960
|
+
{
|
|
3961
|
+
className: "openk9-message-box",
|
|
3962
|
+
display: "flex",
|
|
3963
|
+
alignItems: "flex-end",
|
|
3964
|
+
gap: 4,
|
|
3965
|
+
sx: {
|
|
3966
|
+
gap: "6px",
|
|
3967
|
+
backgroundColor: "white",
|
|
3968
|
+
flexDirection: isChatbot ? "row" : "row-reverse"
|
|
3969
|
+
},
|
|
3970
|
+
children: [
|
|
3971
|
+
icon && /* @__PURE__ */ jsx(Box, { className: "openk9-chatbot-icon", children: icon }),
|
|
3972
|
+
/* @__PURE__ */ jsxs(
|
|
3973
|
+
Box,
|
|
3974
|
+
{
|
|
3975
|
+
className: "openk9-error-message-container",
|
|
3976
|
+
sx: {
|
|
3977
|
+
display: "flex",
|
|
3978
|
+
alignItems: "center",
|
|
3979
|
+
background: "#FCEAEA",
|
|
3980
|
+
border: "1px solid #D32F2F",
|
|
3981
|
+
borderRadius: "10px",
|
|
3982
|
+
padding: "12px 16px",
|
|
3983
|
+
gap: "10px",
|
|
3984
|
+
width: "100%"
|
|
3985
|
+
},
|
|
3986
|
+
"aria-live": "polite",
|
|
3987
|
+
children: [
|
|
3988
|
+
/* @__PURE__ */ jsx(ErrorIcon, { sx: { color: "#D32F2F", fontSize: "20px" } }),
|
|
3989
|
+
/* @__PURE__ */ jsx(
|
|
3990
|
+
ParagraphMessage,
|
|
3991
|
+
{
|
|
3992
|
+
className: "openk9-paragraph-message",
|
|
3993
|
+
$font: theme.typography.fontFamily,
|
|
3994
|
+
$color: "#D32F2F",
|
|
3995
|
+
children: contentMessage
|
|
3996
|
+
}
|
|
3997
|
+
)
|
|
3998
|
+
]
|
|
3999
|
+
}
|
|
4000
|
+
)
|
|
4001
|
+
]
|
|
4002
|
+
}
|
|
4003
|
+
) : /* @__PURE__ */ jsxs(
|
|
4004
|
+
Box,
|
|
4005
|
+
{
|
|
4006
|
+
className: "openk9-message-box",
|
|
4007
|
+
display: "flex",
|
|
4008
|
+
alignItems: "flex-end",
|
|
4009
|
+
gap: 4,
|
|
4010
|
+
sx: {
|
|
4011
|
+
gap: "6px",
|
|
4012
|
+
backgroundColor: "white",
|
|
4013
|
+
flexDirection: isChatbot ? "row" : "row-reverse"
|
|
4014
|
+
},
|
|
4015
|
+
children: [
|
|
4016
|
+
icon && /* @__PURE__ */ jsx(Box, { className: "openk9-chatbot-icon", children: icon }),
|
|
4017
|
+
/* @__PURE__ */ jsx(
|
|
4018
|
+
Box,
|
|
4019
|
+
{
|
|
4020
|
+
className: "openk9-message-content-wrapper",
|
|
4021
|
+
sx: {
|
|
4022
|
+
display: "flex",
|
|
4023
|
+
flexDirection: "column",
|
|
4024
|
+
width: ["-webkit-fill-available", "-moz-available", "100%"],
|
|
4025
|
+
gap: "6px"
|
|
4026
|
+
},
|
|
4027
|
+
children: /* @__PURE__ */ jsxs(
|
|
4028
|
+
Box,
|
|
4029
|
+
{
|
|
4030
|
+
className: "openk9-message-content",
|
|
4031
|
+
sx: {
|
|
4032
|
+
overflow: "auto",
|
|
4033
|
+
display: "flex",
|
|
4034
|
+
flexDirection: "column",
|
|
4035
|
+
backgroundColor: isChatbot ? theme.palette.background.default : theme.palette.primary.main,
|
|
4036
|
+
border: "1px solid",
|
|
4037
|
+
borderColor: theme.palette.primary.main,
|
|
4038
|
+
paddingInline: "16px",
|
|
4039
|
+
color: !isChatbot ? "white" : "black",
|
|
4040
|
+
borderRadius: isChatbot ? "12px 12px 12px 2px" : "12px 12px 2px 12px"
|
|
4041
|
+
},
|
|
4042
|
+
"aria-live": "polite",
|
|
4043
|
+
children: [
|
|
4044
|
+
/* @__PURE__ */ jsx(
|
|
4045
|
+
ParagraphMessage,
|
|
4046
|
+
{
|
|
4047
|
+
className: "openk9-paragraph-message",
|
|
4048
|
+
$isLoading: isLoading,
|
|
4049
|
+
$font: theme.typography.fontFamily,
|
|
4050
|
+
children: isLoading ? /* @__PURE__ */ jsx(
|
|
4051
|
+
Box,
|
|
4052
|
+
{
|
|
4053
|
+
className: "openk9-loading-icon-container",
|
|
4054
|
+
sx: {
|
|
4055
|
+
display: "flex",
|
|
4056
|
+
flexDirection: "column",
|
|
4057
|
+
gap: "5px"
|
|
4058
|
+
},
|
|
4059
|
+
children: /* @__PURE__ */ jsx(
|
|
4060
|
+
CircularProgress,
|
|
4061
|
+
{
|
|
4062
|
+
className: "openk9-loader",
|
|
4063
|
+
disableShrink: true,
|
|
4064
|
+
size: 30,
|
|
4065
|
+
sx: { color: theme.palette.primary.main }
|
|
4066
|
+
}
|
|
4067
|
+
)
|
|
4068
|
+
}
|
|
4069
|
+
) : /* @__PURE__ */ jsxs(
|
|
4070
|
+
FocusableSection,
|
|
4071
|
+
{
|
|
4072
|
+
className: "openk9-focusable-section",
|
|
4073
|
+
$contraxtFocus: isChatbot ? "black" : "white",
|
|
4074
|
+
"aria-label": ariaLabel,
|
|
4075
|
+
tabIndex: 0,
|
|
4076
|
+
children: [
|
|
4077
|
+
nameChatbot && /* @__PURE__ */ jsx(
|
|
4078
|
+
ParagraphName,
|
|
4079
|
+
{
|
|
4080
|
+
className: "openk9-paragraph-name",
|
|
4081
|
+
$font: theme.typography.fontFamily || "",
|
|
4082
|
+
children: nameChatbot
|
|
4083
|
+
}
|
|
4084
|
+
),
|
|
4085
|
+
/* @__PURE__ */ jsx(Markdown, { children: contentMessage })
|
|
4086
|
+
]
|
|
4087
|
+
}
|
|
4088
|
+
)
|
|
4089
|
+
}
|
|
4090
|
+
),
|
|
4091
|
+
sources.length > 0 && /* @__PURE__ */ jsxs(Box, { mb: 6, children: [
|
|
4092
|
+
/* @__PURE__ */ jsxs(
|
|
4093
|
+
Box,
|
|
4094
|
+
{
|
|
4095
|
+
display: "flex",
|
|
4096
|
+
justifyContent: "space-between",
|
|
4097
|
+
alignItems: "center",
|
|
4098
|
+
mb: 2,
|
|
4099
|
+
sx: { overflowX: "hidden" },
|
|
4100
|
+
children: [
|
|
4101
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "body2", color: "text.secondary", children: [
|
|
4102
|
+
sources.length,
|
|
4103
|
+
" sources"
|
|
4104
|
+
] }),
|
|
4105
|
+
/* @__PURE__ */ jsxs(
|
|
4106
|
+
Box,
|
|
4107
|
+
{
|
|
4108
|
+
component: "button",
|
|
4109
|
+
onClick: () => {
|
|
4110
|
+
const newState = !showAllSources;
|
|
4111
|
+
setShowAllSources(newState);
|
|
4112
|
+
if (newState) {
|
|
4113
|
+
const allExpanded = new Set(
|
|
4114
|
+
sources.map((s) => s.url || "")
|
|
4115
|
+
);
|
|
4116
|
+
setExpandedChips(allExpanded);
|
|
4117
|
+
} else {
|
|
4118
|
+
setExpandedChips(/* @__PURE__ */ new Set());
|
|
4119
|
+
}
|
|
4120
|
+
},
|
|
4121
|
+
sx: {
|
|
4122
|
+
display: "flex",
|
|
4123
|
+
alignItems: "center",
|
|
4124
|
+
gap: 0.5,
|
|
4125
|
+
color: "#12518f",
|
|
4126
|
+
fontSize: "0.75rem",
|
|
4127
|
+
background: "none",
|
|
4128
|
+
border: "none",
|
|
4129
|
+
cursor: "pointer",
|
|
4130
|
+
"&:hover": { color: "#2782ea" }
|
|
4131
|
+
},
|
|
4132
|
+
children: [
|
|
4133
|
+
/* @__PURE__ */ jsx(VisibilityIcon, { sx: { fontSize: "0.75rem" } }),
|
|
4134
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: showAllSources ? "Hide all" : "Show all" })
|
|
4135
|
+
]
|
|
4136
|
+
}
|
|
4137
|
+
)
|
|
4138
|
+
]
|
|
4139
|
+
}
|
|
4140
|
+
),
|
|
4141
|
+
/* @__PURE__ */ jsxs(
|
|
4142
|
+
Box,
|
|
4143
|
+
{
|
|
4144
|
+
display: "flex",
|
|
4145
|
+
flexWrap: "wrap",
|
|
4146
|
+
gap: 1,
|
|
4147
|
+
sx: { overflowX: "hidden" },
|
|
4148
|
+
children: [
|
|
4149
|
+
visibleSources.map((source, index) => {
|
|
4150
|
+
const typeColors = getTypeColor(source.url || "");
|
|
4151
|
+
return /* @__PURE__ */ jsx(
|
|
4152
|
+
Chip,
|
|
4153
|
+
{
|
|
4154
|
+
label: /* @__PURE__ */ jsxs(
|
|
4155
|
+
Box,
|
|
4156
|
+
{
|
|
4157
|
+
display: "flex",
|
|
4158
|
+
alignItems: "center",
|
|
4159
|
+
gap: 1,
|
|
4160
|
+
flex: 1,
|
|
4161
|
+
sx: {
|
|
4162
|
+
width: expandedChips.has(source.url || "") ? "230px" : "170px",
|
|
4163
|
+
overflow: "hidden",
|
|
4164
|
+
textOverflow: expandedChips.has(
|
|
4165
|
+
source.url || ""
|
|
4166
|
+
) ? "unset" : "ellipsis",
|
|
4167
|
+
whiteSpace: "nowrap"
|
|
4168
|
+
},
|
|
4169
|
+
children: [
|
|
4170
|
+
/* @__PURE__ */ jsx(
|
|
4171
|
+
Box,
|
|
4172
|
+
{
|
|
4173
|
+
sx: {
|
|
4174
|
+
flex: 1,
|
|
4175
|
+
width: 8,
|
|
4176
|
+
height: 8,
|
|
4177
|
+
flexShrink: 0,
|
|
4178
|
+
flexGrow: 0,
|
|
4179
|
+
borderRadius: "50%",
|
|
4180
|
+
backgroundColor: getStableColor(
|
|
4181
|
+
source.url,
|
|
4182
|
+
themeInfo
|
|
4183
|
+
)
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
4186
|
+
),
|
|
4187
|
+
/* @__PURE__ */ jsx(
|
|
4188
|
+
Typography,
|
|
4189
|
+
{
|
|
4190
|
+
variant: "caption",
|
|
4191
|
+
fontWeight: 500,
|
|
4192
|
+
overflow: "hidden",
|
|
4193
|
+
textOverflow: "ellipsis",
|
|
4194
|
+
children: (source == null ? void 0 : source.title) && source.title
|
|
4195
|
+
}
|
|
4196
|
+
),
|
|
4197
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
4198
|
+
/* @__PURE__ */ jsx(
|
|
4199
|
+
IconButton,
|
|
4200
|
+
{
|
|
4201
|
+
size: "small",
|
|
4202
|
+
onClick: (e) => {
|
|
4203
|
+
e.stopPropagation();
|
|
4204
|
+
copySource(source);
|
|
4205
|
+
},
|
|
4206
|
+
sx: {
|
|
4207
|
+
p: 0.25,
|
|
4208
|
+
ml: 0.5,
|
|
4209
|
+
"&:hover": {
|
|
4210
|
+
backgroundColor: "rgba(0,0,0,0.05)"
|
|
4211
|
+
}
|
|
4212
|
+
},
|
|
4213
|
+
children: copiedSource === source.url ? /* @__PURE__ */ jsx(CheckIcon, { sx: { fontSize: "0.75rem" } }) : /* @__PURE__ */ jsx(
|
|
4214
|
+
ContentCopyIcon,
|
|
4215
|
+
{
|
|
4216
|
+
sx: { fontSize: "0.75rem" }
|
|
4217
|
+
}
|
|
4218
|
+
)
|
|
4219
|
+
}
|
|
4220
|
+
),
|
|
4221
|
+
/* @__PURE__ */ jsx(
|
|
4222
|
+
IconButton,
|
|
4223
|
+
{
|
|
4224
|
+
size: "small",
|
|
4225
|
+
onClick: (e) => {
|
|
4226
|
+
e.stopPropagation();
|
|
4227
|
+
toggleChipExpansion(source.url || "");
|
|
4228
|
+
},
|
|
4229
|
+
sx: {
|
|
4230
|
+
p: 0.25,
|
|
4231
|
+
"&:hover": {
|
|
4232
|
+
backgroundColor: "rgba(0,0,0,0.05)"
|
|
4233
|
+
}
|
|
4234
|
+
},
|
|
4235
|
+
children: /* @__PURE__ */ jsx(
|
|
4236
|
+
OpenInFullIcon,
|
|
4237
|
+
{
|
|
4238
|
+
sx: { fontSize: "0.75rem" }
|
|
4239
|
+
}
|
|
4240
|
+
)
|
|
4241
|
+
}
|
|
4242
|
+
)
|
|
4243
|
+
] })
|
|
4244
|
+
]
|
|
4245
|
+
}
|
|
4246
|
+
),
|
|
4247
|
+
onClick: () => window.open(source.url, "_blank"),
|
|
4248
|
+
sx: {
|
|
4249
|
+
backgroundColor: typeColors.backgroundColor,
|
|
4250
|
+
color: typeColors.color,
|
|
4251
|
+
border: `1px solid ${typeColors.borderColor}`,
|
|
4252
|
+
cursor: "pointer",
|
|
4253
|
+
"&:hover": {
|
|
4254
|
+
backgroundColor: typeColors.backgroundColor,
|
|
4255
|
+
opacity: 0.8
|
|
4256
|
+
}
|
|
4257
|
+
},
|
|
4258
|
+
size: "small"
|
|
4259
|
+
},
|
|
4260
|
+
source.url || index
|
|
4261
|
+
);
|
|
4262
|
+
}),
|
|
4263
|
+
remainingSources > 0 && /* @__PURE__ */ jsx(
|
|
4264
|
+
Chip,
|
|
4265
|
+
{
|
|
4266
|
+
label: /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", gap: 0.5, children: [
|
|
4267
|
+
/* @__PURE__ */ jsx(OpenInFullIcon, { sx: { fontSize: "0.75rem" } }),
|
|
4268
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", children: [
|
|
4269
|
+
"+",
|
|
4270
|
+
remainingSources
|
|
4271
|
+
] })
|
|
4272
|
+
] }),
|
|
4273
|
+
sx: {
|
|
4274
|
+
backgroundColor: themeInfo === "light" ? "#f5f5f5" : "#2d2d2d",
|
|
4275
|
+
color: themeInfo === "light" ? "#616161" : "#b0b0b0",
|
|
4276
|
+
cursor: "pointer",
|
|
4277
|
+
"&:hover": {
|
|
4278
|
+
backgroundColor: themeInfo === "light" ? "#e0e0e0" : "#404040"
|
|
4279
|
+
}
|
|
4280
|
+
},
|
|
4281
|
+
size: "small"
|
|
4282
|
+
}
|
|
4283
|
+
)
|
|
4284
|
+
]
|
|
4285
|
+
}
|
|
4286
|
+
)
|
|
4287
|
+
] })
|
|
4288
|
+
]
|
|
4289
|
+
}
|
|
4290
|
+
)
|
|
4291
|
+
}
|
|
4292
|
+
)
|
|
4293
|
+
]
|
|
4294
|
+
}
|
|
4295
|
+
),
|
|
4296
|
+
/* @__PURE__ */ jsx(
|
|
4297
|
+
ParagraphTime,
|
|
4298
|
+
{
|
|
4299
|
+
className: "openk9-paragraph-time",
|
|
4300
|
+
$color: theme.palette.text.secondary,
|
|
4301
|
+
$font: theme.typography.body2.font || "Roboto",
|
|
4302
|
+
style: { alignSelf: !isChatbot ? "start" : "end" },
|
|
4303
|
+
children: timeMessage
|
|
4304
|
+
}
|
|
4305
|
+
)
|
|
4306
|
+
]
|
|
4307
|
+
}
|
|
4308
|
+
);
|
|
4309
|
+
}
|
|
4310
|
+
const ParagraphTime = styled$2.p`
|
|
4311
|
+
color: ${(props) => props.$color};
|
|
4312
|
+
margin: 0px;
|
|
4313
|
+
align-self: end;
|
|
4314
|
+
font-size: 10px;
|
|
4315
|
+
font-weight: 500;
|
|
4316
|
+
line-height: 1.5;
|
|
4317
|
+
letter-spacing: 1.2px;
|
|
4318
|
+
word-spacing: 1.6px;
|
|
4319
|
+
font-family: ${(props) => props.$font};
|
|
4320
|
+
`;
|
|
4321
|
+
const ParagraphMessage = styled$2.div`
|
|
4322
|
+
color: ${(props) => props.$color};
|
|
4323
|
+
margin: ${(props) => !props.$isLoading ? "0" : "16px"};
|
|
4324
|
+
width: ${(props) => !props.$width};
|
|
4325
|
+
font-size: 12px;
|
|
4326
|
+
font-weight: 400;
|
|
4327
|
+
line-height: 1.5;
|
|
4328
|
+
text-align: left;
|
|
4329
|
+
font-family: ${(props) => props.$font};
|
|
4330
|
+
padding-block: 3px;
|
|
4331
|
+
`;
|
|
4332
|
+
const ParagraphName = styled$2.p`
|
|
4333
|
+
color: ${(props) => props.$color};
|
|
4334
|
+
font-weight: 700;
|
|
4335
|
+
size: 10px;
|
|
4336
|
+
line-height: 15.21px;
|
|
4337
|
+
font-family: ${(props) => props.$font};
|
|
4338
|
+
`;
|
|
4339
|
+
const FocusableSection = styled$2.section`
|
|
4340
|
+
padding-block: 0.2px;
|
|
4341
|
+
|
|
4342
|
+
&:focus {
|
|
4343
|
+
outline: 2px solid ${(props) => props.$contraxtFocus};
|
|
4344
|
+
}
|
|
4345
|
+
`;
|
|
4346
|
+
function generateAccessibleColor(theme) {
|
|
4347
|
+
const MAX_TRIES = 20;
|
|
4348
|
+
const bgColor = theme === "light" ? "#ffffff" : "#000000";
|
|
4349
|
+
for (let i = 0; i < MAX_TRIES; i++) {
|
|
4350
|
+
const hue = Math.floor(Math.random() * 360);
|
|
4351
|
+
const saturation = 80;
|
|
4352
|
+
const lightness = theme === "light" ? 20 + Math.random() * 30 : 60 + Math.random() * 30;
|
|
4353
|
+
const hex = hslToHex(hue, saturation, lightness);
|
|
4354
|
+
if (hasGoodContrast(hex, bgColor, 6)) {
|
|
4355
|
+
return hex;
|
|
4356
|
+
}
|
|
4357
|
+
}
|
|
4358
|
+
return theme === "light" ? "#111111" : "#eeeeee";
|
|
4359
|
+
}
|
|
4360
|
+
function hexToRgb(hex) {
|
|
4361
|
+
hex = hex.replace(/^#/, "");
|
|
4362
|
+
if (hex.length === 3) {
|
|
4363
|
+
hex = hex.split("").map((c) => c + c).join("");
|
|
4364
|
+
}
|
|
4365
|
+
const num = parseInt(hex, 16);
|
|
4366
|
+
return {
|
|
4367
|
+
r: num >> 16 & 255,
|
|
4368
|
+
g: num >> 8 & 255,
|
|
4369
|
+
b: num & 255
|
|
4370
|
+
};
|
|
4371
|
+
}
|
|
4372
|
+
function luminance(hex) {
|
|
4373
|
+
const rgb = hexToRgb(hex);
|
|
4374
|
+
const srgb = [rgb.r, rgb.g, rgb.b].map((c) => {
|
|
4375
|
+
const c_ = c / 255;
|
|
4376
|
+
return c_ <= 0.03928 ? c_ / 12.92 : Math.pow((c_ + 0.055) / 1.055, 2.4);
|
|
4377
|
+
});
|
|
4378
|
+
return 0.2126 * srgb[0] + 0.7152 * srgb[1] + 0.0722 * srgb[2];
|
|
4379
|
+
}
|
|
4380
|
+
function contrastRatio(fg, bg) {
|
|
4381
|
+
const L1 = luminance(fg);
|
|
4382
|
+
const L2 = luminance(bg);
|
|
4383
|
+
return (Math.max(L1, L2) + 0.05) / (Math.min(L1, L2) + 0.05);
|
|
4384
|
+
}
|
|
4385
|
+
function hasGoodContrast(fg, bg, minRatio = 6) {
|
|
4386
|
+
return contrastRatio(fg, bg) >= minRatio;
|
|
4387
|
+
}
|
|
4388
|
+
function hslToHex(h, s, l) {
|
|
4389
|
+
l /= 100;
|
|
4390
|
+
const a = s * Math.min(l, 1 - l) / 100;
|
|
4391
|
+
const f = (n) => {
|
|
4392
|
+
const k = (n + h / 30) % 12;
|
|
4393
|
+
const color2 = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
4394
|
+
return Math.round(255 * color2).toString(16).padStart(2, "0");
|
|
4395
|
+
};
|
|
4396
|
+
return `#${f(0)}${f(8)}${f(4)}`;
|
|
4397
|
+
}
|
|
4398
|
+
const sourceColorMap = /* @__PURE__ */ new Map();
|
|
4399
|
+
function getStableColor(source, theme) {
|
|
4400
|
+
if (!source) return theme === "light" ? "#666" : "#999";
|
|
4401
|
+
if (!sourceColorMap.has(source)) {
|
|
4402
|
+
const mappedColor = mappingColors(source, theme);
|
|
4403
|
+
if (mappedColor) {
|
|
4404
|
+
sourceColorMap.set(source, { light: mappedColor, dark: mappedColor });
|
|
4405
|
+
} else {
|
|
4406
|
+
sourceColorMap.set(source, {
|
|
4407
|
+
light: generateAccessibleColor("light"),
|
|
4408
|
+
dark: generateAccessibleColor("dark")
|
|
4409
|
+
});
|
|
4410
|
+
}
|
|
4411
|
+
}
|
|
4412
|
+
return sourceColorMap.get(source)[theme];
|
|
4413
|
+
}
|
|
4414
|
+
function mappingColors(source, theme) {
|
|
4415
|
+
switch (source == null ? void 0 : source.toLowerCase()) {
|
|
4416
|
+
case "ansa.it":
|
|
4417
|
+
return theme === "light" ? "#1976d2" : "#42a5f5";
|
|
4418
|
+
case "eurosport.it":
|
|
4419
|
+
return theme === "light" ? "#d32f2f" : "#ef5350";
|
|
4420
|
+
case "ilpost.it":
|
|
4421
|
+
return theme === "light" ? "#388e3c" : "#66bb6a";
|
|
4422
|
+
case "corriere.it":
|
|
4423
|
+
return theme === "light" ? "#f57c00" : "#ffa726";
|
|
4424
|
+
case "techreport.com":
|
|
4425
|
+
return theme === "light" ? "#1976d2" : "#42a5f5";
|
|
4426
|
+
case "openai.com":
|
|
4427
|
+
return theme === "light" ? "#7b1fa2" : "#ab47bc";
|
|
4428
|
+
case "meta.ai":
|
|
4429
|
+
return theme === "light" ? "#1976d2" : "#42a5f5";
|
|
4430
|
+
case "kaggle.com":
|
|
4431
|
+
return theme === "light" ? "#f57c00" : "#ffa726";
|
|
4432
|
+
case "ethics.ai":
|
|
4433
|
+
return theme === "light" ? "#1976d2" : "#42a5f5";
|
|
4434
|
+
case "coursera.org":
|
|
4435
|
+
return theme === "light" ? "#d32f2f" : "#ef5350";
|
|
4436
|
+
case "spotify.com":
|
|
4437
|
+
return "#1dd15d";
|
|
4438
|
+
case "arxiv.org":
|
|
4439
|
+
return theme === "light" ? "#7b1fa2" : "#ab47bc";
|
|
4440
|
+
case "github.com":
|
|
4441
|
+
return theme === "light" ? "#24292e" : "#f0f6fc";
|
|
4442
|
+
case "stackoverflow.com":
|
|
4443
|
+
return theme === "light" ? "#f48024" : "#f69c3d";
|
|
4444
|
+
case "medium.com":
|
|
4445
|
+
return theme === "light" ? "#000000" : "#ffffff";
|
|
4446
|
+
case "youtube.com":
|
|
4447
|
+
return theme === "light" ? "#ff0000" : "#ff4444";
|
|
4448
|
+
case "x.com":
|
|
4449
|
+
return theme === "light" ? "#1da1f2" : "#1d9bf0";
|
|
4450
|
+
case "linkedin.com":
|
|
4451
|
+
return theme === "light" ? "#0077b5" : "#0a66c2";
|
|
4452
|
+
case "reddit.com":
|
|
4453
|
+
return theme === "light" ? "#ff4500" : "#ff6314";
|
|
4454
|
+
case "wikipedia.org":
|
|
4455
|
+
return theme === "light" ? "#000000" : "#ffffff";
|
|
4456
|
+
default:
|
|
4457
|
+
return void 0;
|
|
4458
|
+
}
|
|
4459
|
+
}
|
|
4460
|
+
export {
|
|
4461
|
+
SingleMessage as S,
|
|
4462
|
+
createTheme as c
|
|
4463
|
+
};
|