iobroker.vis-2
Version:
Next generation graphical user interface for ioBroker.
1,526 lines • 120 kB
JavaScript
import { f as formatMuiErrorMessage, d as deepmerge, a as capitalize, i as isPlainObject, __tla as __tla_0 } from "./clsx-XqGtd7JN.js";
import { R as React, n as __mf_28, m as __mf_10, p as __mf_14, o as __mf_21, l as __mf_11, r as __mf_2, __tla as __tla_1 } from "./iobroker_vis__loadShare__react__loadShare__.js-Bo2lxMHB.js";
import { __tla as __tla_2 } from "./iobroker_vis__loadShare__prop_mf_2_types__loadShare__.js-OoAqYupB.js";
import { j as jsxRuntimeExports, __tla as __tla_3 } from "./jsx-runtime-DgDbgMDY.js";
let blend, serializeStyles$1, withEmotionCache, ClassNameGenerator, useInsertionEffectWithLayoutFallback, insertStyles, hasOwn, Emotion$1, createEmotionProps, CacheProvider, internal_serializeStyles, DefaultPropsProvider, compose, style$1, spacing, sizing, palette, grid, borders, styled, ThemeContext, preprocessStyles, handleBreakpoints, resolveBreakpointValues, mergeBreakpointsInOrder, getValue, backgroundColor, bgcolor, generateUtilityClasses, border, borderBottom, borderBottomColor, borderColor, borderLeft, borderLeftColor, borderRadius, borderRight, borderRightColor, borderTop, margin, marginKeys, maxHeight, maxWidth, minHeight, minWidth, outline, outlineColor, padding, paddingKeys, paletteTransform, recomposeColor, rgbToHex, rowGap, shape, shouldForwardProp, sizeHeight, sizeWidth, sizingTransform, systemDefaultTheme, unstable_createStyleFunctionSx, cssVarsParser, width, borderTopColor, borderTransform, boxSizing, breakpoints, color, colorChannel, columnGap, createSpacing, createUnaryUnit, cssContainerQueries, decomposeColor, gap, getLuminance, getStyleFromPropValue, getStyleValue, gridArea, gridAutoColumns, gridAutoFlow, gridAutoRows, gridColumn, gridRow, gridTemplateAreas, gridTemplateColumns, gridTemplateRows, height, hexToRgb, alpha, composeClasses, darken, emphasize, getPath, generateUtilityClass, clamp, createBreakpoints, getContrastRatio, createTheme, lighten, defaultSxConfig, private_safeLighten, private_safeEmphasize, private_safeDarken, private_safeAlpha, resolveProps, styleFunctionSx, private_safeColorChannel, prepareCssVars, createUnarySpacing, createGetColorSchemeSelector, hslToRgb, createStyled, useDefaultProps;
let __tla = Promise.all([
(() => {
try {
return __tla_0;
} catch {
}
})(),
(() => {
try {
return __tla_1;
} catch {
}
})(),
(() => {
try {
return __tla_2;
} catch {
}
})(),
(() => {
try {
return __tla_3;
} catch {
}
})()
]).then(async () => {
const sortBreakpointsValues = (values2) => {
const breakpointsAsArray = Object.keys(values2).map((key) => ({
key,
val: values2[key]
})) || [];
breakpointsAsArray.sort((breakpoint1, breakpoint2) => breakpoint1.val - breakpoint2.val);
return breakpointsAsArray.reduce((acc, obj) => {
return {
...acc,
[obj.key]: obj.val
};
}, {});
};
createBreakpoints = function(breakpoints2) {
const { values: values2 = {
xs: 0,
sm: 600,
md: 900,
lg: 1200,
xl: 1536
}, unit = "px", step = 5, ...other } = breakpoints2;
const sortedValues = sortBreakpointsValues(values2);
const keys = Object.keys(sortedValues);
function up(key) {
const value = typeof values2[key] === "number" ? values2[key] : key;
return `@media (min-width:${value}${unit})`;
}
function down(key) {
const value = typeof values2[key] === "number" ? values2[key] : key;
return `@media (max-width:${value - step / 100}${unit})`;
}
function between(start, end) {
const endIndex = keys.indexOf(end);
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})`;
}
function only(key) {
if (keys.indexOf(key) + 1 < keys.length) {
return between(key, keys[keys.indexOf(key) + 1]);
}
return up(key);
}
function not(key) {
const keyIndex = keys.indexOf(key);
if (keyIndex === 0) {
return up(keys[1]);
}
if (keyIndex === keys.length - 1) {
return down(keys[keyIndex]);
}
return between(key, keys[keys.indexOf(key) + 1]).replace("@media", "@media not all and");
}
return {
keys,
values: sortedValues,
up,
down,
between,
only,
not,
unit,
...other
};
};
clamp = function(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
return Math.max(min, Math.min(val, max));
};
function clampWrapper(value, min = 0, max = 1) {
return clamp(value, min, max);
}
hexToRgb = function(color2) {
color2 = color2.slice(1);
const re = new RegExp(`.{1,${color2.length >= 6 ? 2 : 1}}`, "g");
let colors = color2.match(re);
if (colors && colors[0].length === 1) {
colors = colors.map((n) => n + n);
}
return colors ? `rgb${colors.length === 4 ? "a" : ""}(${colors.map((n, index) => {
return index < 3 ? parseInt(n, 16) : Math.round(parseInt(n, 16) / 255 * 1e3) / 1e3;
}).join(", ")})` : "";
};
function intToHex(int) {
const hex = int.toString(16);
return hex.length === 1 ? `0${hex}` : hex;
}
decomposeColor = function(color2) {
if (color2.type) {
return color2;
}
if (color2.charAt(0) === "#") {
return decomposeColor(hexToRgb(color2));
}
const marker = color2.indexOf("(");
const type = color2.substring(0, marker);
if (![
"rgb",
"rgba",
"hsl",
"hsla",
"color"
].includes(type)) {
throw new Error(formatMuiErrorMessage(9, color2));
}
let values2 = color2.substring(marker + 1, color2.length - 1);
let colorSpace;
if (type === "color") {
values2 = values2.split(" ");
colorSpace = values2.shift();
if (values2.length === 4 && values2[3].charAt(0) === "/") {
values2[3] = values2[3].slice(1);
}
if (![
"srgb",
"display-p3",
"a98-rgb",
"prophoto-rgb",
"rec-2020"
].includes(colorSpace)) {
throw new Error(formatMuiErrorMessage(10, colorSpace));
}
} else {
values2 = values2.split(",");
}
values2 = values2.map((value) => parseFloat(value));
return {
type,
values: values2,
colorSpace
};
};
colorChannel = (color2) => {
const decomposedColor = decomposeColor(color2);
return decomposedColor.values.slice(0, 3).map((val, idx) => decomposedColor.type.includes("hsl") && idx !== 0 ? `${val}%` : val).join(" ");
};
private_safeColorChannel = (color2, warning) => {
try {
return colorChannel(color2);
} catch (error) {
return color2;
}
};
recomposeColor = function(color2) {
const { type, colorSpace } = color2;
let { values: values2 } = color2;
if (type.includes("rgb")) {
values2 = values2.map((n, i) => i < 3 ? parseInt(n, 10) : n);
} else if (type.includes("hsl")) {
values2[1] = `${values2[1]}%`;
values2[2] = `${values2[2]}%`;
}
if (type.includes("color")) {
values2 = `${colorSpace} ${values2.join(" ")}`;
} else {
values2 = `${values2.join(", ")}`;
}
return `${type}(${values2})`;
};
rgbToHex = function(color2) {
if (color2.startsWith("#")) {
return color2;
}
const { values: values2 } = decomposeColor(color2);
return `#${values2.map((n, i) => intToHex(i === 3 ? Math.round(255 * n) : n)).join("")}`;
};
hslToRgb = function(color2) {
color2 = decomposeColor(color2);
const { values: values2 } = color2;
const h = values2[0];
const s = values2[1] / 100;
const l = values2[2] / 100;
const a = s * Math.min(l, 1 - l);
const f = (n, k = (n + h / 30) % 12) => l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
let type = "rgb";
const rgb = [
Math.round(f(0) * 255),
Math.round(f(8) * 255),
Math.round(f(4) * 255)
];
if (color2.type === "hsla") {
type += "a";
rgb.push(values2[3]);
}
return recomposeColor({
type,
values: rgb
});
};
getLuminance = function(color2) {
color2 = decomposeColor(color2);
let rgb = color2.type === "hsl" || color2.type === "hsla" ? decomposeColor(hslToRgb(color2)).values : color2.values;
rgb = rgb.map((val) => {
if (color2.type !== "color") {
val /= 255;
}
return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;
});
return Number((0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]).toFixed(3));
};
getContrastRatio = function(foreground, background) {
const lumA = getLuminance(foreground);
const lumB = getLuminance(background);
return (Math.max(lumA, lumB) + 0.05) / (Math.min(lumA, lumB) + 0.05);
};
alpha = function(color2, value) {
color2 = decomposeColor(color2);
value = clampWrapper(value);
if (color2.type === "rgb" || color2.type === "hsl") {
color2.type += "a";
}
if (color2.type === "color") {
color2.values[3] = `/${value}`;
} else {
color2.values[3] = value;
}
return recomposeColor(color2);
};
private_safeAlpha = function(color2, value, warning) {
try {
return alpha(color2, value);
} catch (error) {
if (warning && false) {
console.warn(warning);
}
return color2;
}
};
darken = function(color2, coefficient) {
color2 = decomposeColor(color2);
coefficient = clampWrapper(coefficient);
if (color2.type.includes("hsl")) {
color2.values[2] *= 1 - coefficient;
} else if (color2.type.includes("rgb") || color2.type.includes("color")) {
for (let i = 0; i < 3; i += 1) {
color2.values[i] *= 1 - coefficient;
}
}
return recomposeColor(color2);
};
private_safeDarken = function(color2, coefficient, warning) {
try {
return darken(color2, coefficient);
} catch (error) {
if (warning && false) {
console.warn(warning);
}
return color2;
}
};
lighten = function(color2, coefficient) {
color2 = decomposeColor(color2);
coefficient = clampWrapper(coefficient);
if (color2.type.includes("hsl")) {
color2.values[2] += (100 - color2.values[2]) * coefficient;
} else if (color2.type.includes("rgb")) {
for (let i = 0; i < 3; i += 1) {
color2.values[i] += (255 - color2.values[i]) * coefficient;
}
} else if (color2.type.includes("color")) {
for (let i = 0; i < 3; i += 1) {
color2.values[i] += (1 - color2.values[i]) * coefficient;
}
}
return recomposeColor(color2);
};
private_safeLighten = function(color2, coefficient, warning) {
try {
return lighten(color2, coefficient);
} catch (error) {
if (warning && false) {
console.warn(warning);
}
return color2;
}
};
emphasize = function(color2, coefficient = 0.15) {
return getLuminance(color2) > 0.5 ? darken(color2, coefficient) : lighten(color2, coefficient);
};
private_safeEmphasize = function(color2, coefficient, warning) {
try {
return emphasize(color2, coefficient);
} catch (error) {
if (warning && false) {
console.warn(warning);
}
return color2;
}
};
blend = function(background, overlay, opacity, gamma = 1) {
const blendChannel = (b, o) => Math.round((b ** (1 / gamma) * (1 - opacity) + o ** (1 / gamma) * opacity) ** gamma);
const backgroundColor2 = decomposeColor(background);
const overlayColor = decomposeColor(overlay);
const rgb = [
blendChannel(backgroundColor2.values[0], overlayColor.values[0]),
blendChannel(backgroundColor2.values[1], overlayColor.values[1]),
blendChannel(backgroundColor2.values[2], overlayColor.values[2])
];
return recomposeColor({
type: "rgb",
values: rgb
});
};
function merge(acc, item) {
if (!item) {
return acc;
}
return deepmerge(acc, item, {
clone: false
});
}
function sortContainerQueries(theme, css) {
if (!theme.containerQueries) {
return css;
}
const sorted = Object.keys(css).filter((key) => key.startsWith("@container")).sort((a, b) => {
var _a, _b;
const regex = /min-width:\s*([0-9.]+)/;
return +(((_a = a.match(regex)) == null ? void 0 : _a[1]) || 0) - +(((_b = b.match(regex)) == null ? void 0 : _b[1]) || 0);
});
if (!sorted.length) {
return css;
}
return sorted.reduce((acc, key) => {
const value = css[key];
delete acc[key];
acc[key] = value;
return acc;
}, {
...css
});
}
function isCqShorthand(breakpointKeys, value) {
return value === "@" || value.startsWith("@") && (breakpointKeys.some((key) => value.startsWith(`@${key}`)) || !!value.match(/^@\d/));
}
function getContainerQuery(theme, shorthand) {
const matches = shorthand.match(/^@([^/]+)?\/?(.+)?$/);
if (!matches) {
return null;
}
const [, containerQuery, containerName] = matches;
const value = Number.isNaN(+containerQuery) ? containerQuery || 0 : +containerQuery;
return theme.containerQueries(containerName).up(value);
}
cssContainerQueries = function(themeInput) {
const toContainerQuery = (mediaQuery, name) => mediaQuery.replace("@media", name ? `@container ${name}` : "@container");
function attachCq(node22, name) {
node22.up = (...args) => toContainerQuery(themeInput.breakpoints.up(...args), name);
node22.down = (...args) => toContainerQuery(themeInput.breakpoints.down(...args), name);
node22.between = (...args) => toContainerQuery(themeInput.breakpoints.between(...args), name);
node22.only = (...args) => toContainerQuery(themeInput.breakpoints.only(...args), name);
node22.not = (...args) => {
const result = toContainerQuery(themeInput.breakpoints.not(...args), name);
if (result.includes("not all and")) {
return result.replace("not all and ", "").replace("min-width:", "width<").replace("max-width:", "width>").replace("and", "or");
}
return result;
};
}
const node2 = {};
const containerQueries = (name) => {
attachCq(node2, name);
return node2;
};
attachCq(containerQueries);
return {
...themeInput,
containerQueries
};
};
const values = {
xs: 0,
sm: 600,
md: 900,
lg: 1200,
xl: 1536
};
const defaultBreakpoints = {
keys: [
"xs",
"sm",
"md",
"lg",
"xl"
],
up: (key) => `@media (min-width:${values[key]}px)`
};
const defaultContainerQueries = {
containerQueries: (containerName) => ({
up: (key) => {
let result = typeof key === "number" ? key : values[key] || key;
if (typeof result === "number") {
result = `${result}px`;
}
return containerName ? `@container ${containerName} (min-width:${result})` : `@container (min-width:${result})`;
}
})
};
handleBreakpoints = function(props, propValue, styleFromPropValue) {
const theme = props.theme || {};
if (Array.isArray(propValue)) {
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
return propValue.reduce((acc, item, index) => {
acc[themeBreakpoints.up(themeBreakpoints.keys[index])] = styleFromPropValue(propValue[index]);
return acc;
}, {});
}
if (typeof propValue === "object") {
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
return Object.keys(propValue).reduce((acc, breakpoint) => {
if (isCqShorthand(themeBreakpoints.keys, breakpoint)) {
const containerKey = getContainerQuery(theme.containerQueries ? theme : defaultContainerQueries, breakpoint);
if (containerKey) {
acc[containerKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
}
} else if (Object.keys(themeBreakpoints.values || values).includes(breakpoint)) {
const mediaKey = themeBreakpoints.up(breakpoint);
acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
} else {
const cssKey = breakpoint;
acc[cssKey] = propValue[cssKey];
}
return acc;
}, {});
}
const output = styleFromPropValue(propValue);
return output;
};
breakpoints = function(styleFunction) {
const newStyleFunction = (props) => {
const theme = props.theme || {};
const base = styleFunction(props);
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
const extended = themeBreakpoints.keys.reduce((acc, key) => {
if (props[key]) {
acc = acc || {};
acc[themeBreakpoints.up(key)] = styleFunction({
theme,
...props[key]
});
}
return acc;
}, null);
return merge(base, extended);
};
newStyleFunction.propTypes = {};
newStyleFunction.filterProps = [
"xs",
"sm",
"md",
"lg",
"xl",
...styleFunction.filterProps
];
return newStyleFunction;
};
function createEmptyBreakpointObject(breakpointsInput = {}) {
var _a;
const breakpointsInOrder = (_a = breakpointsInput.keys) == null ? void 0 : _a.reduce((acc, key) => {
const breakpointStyleKey = breakpointsInput.up(key);
acc[breakpointStyleKey] = {};
return acc;
}, {});
return breakpointsInOrder || {};
}
function removeUnusedBreakpoints(breakpointKeys, style2) {
return breakpointKeys.reduce((acc, key) => {
const breakpointOutput = acc[key];
const isBreakpointUnused = !breakpointOutput || Object.keys(breakpointOutput).length === 0;
if (isBreakpointUnused) {
delete acc[key];
}
return acc;
}, style2);
}
mergeBreakpointsInOrder = function(breakpointsInput, ...styles) {
const emptyBreakpoints = createEmptyBreakpointObject(breakpointsInput);
const mergedOutput = [
emptyBreakpoints,
...styles
].reduce((prev2, next2) => deepmerge(prev2, next2), {});
return removeUnusedBreakpoints(Object.keys(emptyBreakpoints), mergedOutput);
};
function computeBreakpointsBase(breakpointValues, themeBreakpoints) {
if (typeof breakpointValues !== "object") {
return {};
}
const base = {};
const breakpointsKeys = Object.keys(themeBreakpoints);
if (Array.isArray(breakpointValues)) {
breakpointsKeys.forEach((breakpoint, i) => {
if (i < breakpointValues.length) {
base[breakpoint] = true;
}
});
} else {
breakpointsKeys.forEach((breakpoint) => {
if (breakpointValues[breakpoint] != null) {
base[breakpoint] = true;
}
});
}
return base;
}
resolveBreakpointValues = function({ values: breakpointValues, breakpoints: themeBreakpoints, base: customBase }) {
const base = customBase || computeBreakpointsBase(breakpointValues, themeBreakpoints);
const keys = Object.keys(base);
if (keys.length === 0) {
return breakpointValues;
}
let previous;
return keys.reduce((acc, breakpoint, i) => {
if (Array.isArray(breakpointValues)) {
acc[breakpoint] = breakpointValues[i] != null ? breakpointValues[i] : breakpointValues[previous];
previous = i;
} else if (typeof breakpointValues === "object") {
acc[breakpoint] = breakpointValues[breakpoint] != null ? breakpointValues[breakpoint] : breakpointValues[previous];
previous = breakpoint;
} else {
acc[breakpoint] = breakpointValues;
}
return acc;
}, {});
};
getPath = function(obj, path, checkVars = true) {
if (!path || typeof path !== "string") {
return null;
}
if (obj && obj.vars && checkVars) {
const val = `vars.${path}`.split(".").reduce((acc, item) => acc && acc[item] ? acc[item] : null, obj);
if (val != null) {
return val;
}
}
return path.split(".").reduce((acc, item) => {
if (acc && acc[item] != null) {
return acc[item];
}
return null;
}, obj);
};
getStyleValue = function(themeMapping, transform, propValueFinal, userValue = propValueFinal) {
let value;
if (typeof themeMapping === "function") {
value = themeMapping(propValueFinal);
} else if (Array.isArray(themeMapping)) {
value = themeMapping[propValueFinal] || userValue;
} else {
value = getPath(themeMapping, propValueFinal) || userValue;
}
if (transform) {
value = transform(value, userValue, themeMapping);
}
return value;
};
style$1 = function(options) {
const { prop, cssProperty = options.prop, themeKey, transform } = options;
const fn = (props) => {
if (props[prop] == null) {
return null;
}
const propValue = props[prop];
const theme = props.theme;
const themeMapping = getPath(theme, themeKey) || {};
const styleFromPropValue = (propValueFinal) => {
let value = getStyleValue(themeMapping, transform, propValueFinal);
if (propValueFinal === value && typeof propValueFinal === "string") {
value = getStyleValue(themeMapping, transform, `${prop}${propValueFinal === "default" ? "" : capitalize(propValueFinal)}`, propValueFinal);
}
if (cssProperty === false) {
return value;
}
return {
[cssProperty]: value
};
};
return handleBreakpoints(props, propValue, styleFromPropValue);
};
fn.propTypes = {};
fn.filterProps = [
prop
];
return fn;
};
function memoize$2(fn) {
const cache = {};
return (arg) => {
if (cache[arg] === void 0) {
cache[arg] = fn(arg);
}
return cache[arg];
};
}
const properties = {
m: "margin",
p: "padding"
};
const directions = {
t: "Top",
r: "Right",
b: "Bottom",
l: "Left",
x: [
"Left",
"Right"
],
y: [
"Top",
"Bottom"
]
};
const aliases = {
marginX: "mx",
marginY: "my",
paddingX: "px",
paddingY: "py"
};
const getCssProperties = memoize$2((prop) => {
if (prop.length > 2) {
if (aliases[prop]) {
prop = aliases[prop];
} else {
return [
prop
];
}
}
const [a, b] = prop.split("");
const property = properties[a];
const direction = directions[b] || "";
return Array.isArray(direction) ? direction.map((dir) => property + dir) : [
property + direction
];
});
marginKeys = [
"m",
"mt",
"mr",
"mb",
"ml",
"mx",
"my",
"margin",
"marginTop",
"marginRight",
"marginBottom",
"marginLeft",
"marginX",
"marginY",
"marginInline",
"marginInlineStart",
"marginInlineEnd",
"marginBlock",
"marginBlockStart",
"marginBlockEnd"
];
paddingKeys = [
"p",
"pt",
"pr",
"pb",
"pl",
"px",
"py",
"padding",
"paddingTop",
"paddingRight",
"paddingBottom",
"paddingLeft",
"paddingX",
"paddingY",
"paddingInline",
"paddingInlineStart",
"paddingInlineEnd",
"paddingBlock",
"paddingBlockStart",
"paddingBlockEnd"
];
const spacingKeys = [
...marginKeys,
...paddingKeys
];
createUnaryUnit = function(theme, themeKey, defaultValue, propName) {
const themeSpacing = getPath(theme, themeKey, true) ?? defaultValue;
if (typeof themeSpacing === "number" || typeof themeSpacing === "string") {
return (val) => {
if (typeof val === "string") {
return val;
}
if (typeof themeSpacing === "string") {
return `calc(${val} * ${themeSpacing})`;
}
return themeSpacing * val;
};
}
if (Array.isArray(themeSpacing)) {
return (val) => {
if (typeof val === "string") {
return val;
}
const abs2 = Math.abs(val);
const transformed = themeSpacing[abs2];
if (val >= 0) {
return transformed;
}
if (typeof transformed === "number") {
return -transformed;
}
return `-${transformed}`;
};
}
if (typeof themeSpacing === "function") {
return themeSpacing;
}
return () => void 0;
};
createUnarySpacing = function(theme) {
return createUnaryUnit(theme, "spacing", 8);
};
getValue = function(transformer, propValue) {
if (typeof propValue === "string" || propValue == null) {
return propValue;
}
return transformer(propValue);
};
getStyleFromPropValue = function(cssProperties, transformer) {
return (propValue) => cssProperties.reduce((acc, cssProperty) => {
acc[cssProperty] = getValue(transformer, propValue);
return acc;
}, {});
};
function resolveCssProperty(props, keys, prop, transformer) {
if (!keys.includes(prop)) {
return null;
}
const cssProperties = getCssProperties(prop);
const styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
const propValue = props[prop];
return handleBreakpoints(props, propValue, styleFromPropValue);
}
function style(props, keys) {
const transformer = createUnarySpacing(props.theme);
return Object.keys(props).map((prop) => resolveCssProperty(props, keys, prop, transformer)).reduce(merge, {});
}
margin = function(props) {
return style(props, marginKeys);
};
margin.propTypes = {};
margin.filterProps = marginKeys;
padding = function(props) {
return style(props, paddingKeys);
};
padding.propTypes = {};
padding.filterProps = paddingKeys;
spacing = function(props) {
return style(props, spacingKeys);
};
spacing.propTypes = {};
spacing.filterProps = spacingKeys;
function _extends() {
return _extends = Object.assign ? Object.assign.bind() : function(n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
}
return n;
}, _extends.apply(null, arguments);
}
function sheetForTag(tag) {
if (tag.sheet) {
return tag.sheet;
}
for (var i = 0; i < document.styleSheets.length; i++) {
if (document.styleSheets[i].ownerNode === tag) {
return document.styleSheets[i];
}
}
return void 0;
}
function createStyleElement(options) {
var tag = document.createElement("style");
tag.setAttribute("data-emotion", options.key);
if (options.nonce !== void 0) {
tag.setAttribute("nonce", options.nonce);
}
tag.appendChild(document.createTextNode(""));
tag.setAttribute("data-s", "");
return tag;
}
var StyleSheet = (function() {
function StyleSheet2(options) {
var _this = this;
this._insertTag = function(tag) {
var before;
if (_this.tags.length === 0) {
if (_this.insertionPoint) {
before = _this.insertionPoint.nextSibling;
} else if (_this.prepend) {
before = _this.container.firstChild;
} else {
before = _this.before;
}
} else {
before = _this.tags[_this.tags.length - 1].nextSibling;
}
_this.container.insertBefore(tag, before);
_this.tags.push(tag);
};
this.isSpeedy = options.speedy === void 0 ? true : options.speedy;
this.tags = [];
this.ctr = 0;
this.nonce = options.nonce;
this.key = options.key;
this.container = options.container;
this.prepend = options.prepend;
this.insertionPoint = options.insertionPoint;
this.before = null;
}
var _proto = StyleSheet2.prototype;
_proto.hydrate = function hydrate(nodes) {
nodes.forEach(this._insertTag);
};
_proto.insert = function insert(rule) {
if (this.ctr % (this.isSpeedy ? 65e3 : 1) === 0) {
this._insertTag(createStyleElement(this));
}
var tag = this.tags[this.tags.length - 1];
if (this.isSpeedy) {
var sheet = sheetForTag(tag);
try {
sheet.insertRule(rule, sheet.cssRules.length);
} catch (e) {
}
} else {
tag.appendChild(document.createTextNode(rule));
}
this.ctr++;
};
_proto.flush = function flush() {
this.tags.forEach(function(tag) {
var _tag$parentNode;
return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
});
this.tags = [];
this.ctr = 0;
};
return StyleSheet2;
})();
var MS = "-ms-";
var MOZ = "-moz-";
var WEBKIT = "-webkit-";
var COMMENT = "comm";
var RULESET = "rule";
var DECLARATION = "decl";
var IMPORT = "@import";
var KEYFRAMES = "@keyframes";
var LAYER = "@layer";
var abs = Math.abs;
var from = String.fromCharCode;
var assign = Object.assign;
function hash(value, length2) {
return charat(value, 0) ^ 45 ? (((length2 << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3) : 0;
}
function trim(value) {
return value.trim();
}
function match(value, pattern) {
return (value = pattern.exec(value)) ? value[0] : value;
}
function replace(value, pattern, replacement) {
return value.replace(pattern, replacement);
}
function indexof(value, search) {
return value.indexOf(search);
}
function charat(value, index) {
return value.charCodeAt(index) | 0;
}
function substr(value, begin, end) {
return value.slice(begin, end);
}
function strlen(value) {
return value.length;
}
function sizeof(value) {
return value.length;
}
function append(value, array) {
return array.push(value), value;
}
function combine(array, callback) {
return array.map(callback).join("");
}
var line = 1;
var column = 1;
var length = 0;
var position = 0;
var character = 0;
var characters = "";
function node(value, root, parent, type, props, children, length2) {
return {
value,
root,
parent,
type,
props,
children,
line,
column,
length: length2,
return: ""
};
}
function copy(root, props) {
return assign(node("", null, null, "", null, null, 0), root, {
length: -root.length
}, props);
}
function char() {
return character;
}
function prev() {
character = position > 0 ? charat(characters, --position) : 0;
if (column--, character === 10) column = 1, line--;
return character;
}
function next() {
character = position < length ? charat(characters, position++) : 0;
if (column++, character === 10) column = 1, line++;
return character;
}
function peek() {
return charat(characters, position);
}
function caret() {
return position;
}
function slice(begin, end) {
return substr(characters, begin, end);
}
function token(type) {
switch (type) {
case 0:
case 9:
case 10:
case 13:
case 32:
return 5;
case 33:
case 43:
case 44:
case 47:
case 62:
case 64:
case 126:
case 59:
case 123:
case 125:
return 4;
case 58:
return 3;
case 34:
case 39:
case 40:
case 91:
return 2;
case 41:
case 93:
return 1;
}
return 0;
}
function alloc(value) {
return line = column = 1, length = strlen(characters = value), position = 0, [];
}
function dealloc(value) {
return characters = "", value;
}
function delimit(type) {
return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
}
function whitespace(type) {
while (character = peek()) if (character < 33) next();
else break;
return token(type) > 2 || token(character) > 3 ? "" : " ";
}
function escaping(index, count) {
while (--count && next()) if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97) break;
return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
}
function delimiter(type) {
while (next()) switch (character) {
case type:
return position;
case 34:
case 39:
if (type !== 34 && type !== 39) delimiter(character);
break;
case 40:
if (type === 41) delimiter(type);
break;
case 92:
next();
break;
}
return position;
}
function commenter(type, index) {
while (next()) if (type + character === 47 + 10) break;
else if (type + character === 42 + 42 && peek() === 47) break;
return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next());
}
function identifier(index) {
while (!token(peek())) next();
return slice(index, position);
}
function compile(value) {
return dealloc(parse("", null, null, null, [
""
], value = alloc(value), 0, [
0
], value));
}
function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
var index = 0;
var offset = 0;
var length2 = pseudo;
var atrule = 0;
var property = 0;
var previous = 0;
var variable = 1;
var scanning = 1;
var ampersand = 1;
var character2 = 0;
var type = "";
var props = rules;
var children = rulesets;
var reference = rule;
var characters2 = type;
while (scanning) switch (previous = character2, character2 = next()) {
case 40:
if (previous != 108 && charat(characters2, length2 - 1) == 58) {
if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f") != -1) ampersand = -1;
break;
}
case 34:
case 39:
case 91:
characters2 += delimit(character2);
break;
case 9:
case 10:
case 13:
case 32:
characters2 += whitespace(previous);
break;
case 92:
characters2 += escaping(caret() - 1, 7);
continue;
case 47:
switch (peek()) {
case 42:
case 47:
append(comment(commenter(next(), caret()), root, parent), declarations);
break;
default:
characters2 += "/";
}
break;
case 123 * variable:
points[index++] = strlen(characters2) * ampersand;
case 125 * variable:
case 59:
case 0:
switch (character2) {
case 0:
case 125:
scanning = 0;
case 59 + offset:
if (ampersand == -1) characters2 = replace(characters2, /\f/g, "");
if (property > 0 && strlen(characters2) - length2) append(property > 32 ? declaration(characters2 + ";", rule, parent, length2 - 1) : declaration(replace(characters2, " ", "") + ";", rule, parent, length2 - 2), declarations);
break;
case 59:
characters2 += ";";
default:
append(reference = ruleset(characters2, root, parent, index, offset, rules, points, type, props = [], children = [], length2), rulesets);
if (character2 === 123) if (offset === 0) parse(characters2, root, reference, reference, props, rulesets, length2, points, children);
else switch (atrule === 99 && charat(characters2, 3) === 110 ? 100 : atrule) {
case 100:
case 108:
case 109:
case 115:
parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length2), children), rules, children, length2, points, rule ? props : children);
break;
default:
parse(characters2, reference, reference, reference, [
""
], children, 0, points, children);
}
}
index = offset = property = 0, variable = ampersand = 1, type = characters2 = "", length2 = pseudo;
break;
case 58:
length2 = 1 + strlen(characters2), property = previous;
default:
if (variable < 1) {
if (character2 == 123) --variable;
else if (character2 == 125 && variable++ == 0 && prev() == 125) continue;
}
switch (characters2 += from(character2), character2 * variable) {
case 38:
ampersand = offset > 0 ? 1 : (characters2 += "\f", -1);
break;
case 44:
points[index++] = (strlen(characters2) - 1) * ampersand, ampersand = 1;
break;
case 64:
if (peek() === 45) characters2 += delimit(next());
atrule = peek(), offset = length2 = strlen(type = characters2 += identifier(caret())), character2++;
break;
case 45:
if (previous === 45 && strlen(characters2) == 2) variable = 0;
}
}
return rulesets;
}
function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length2) {
var post = offset - 1;
var rule = offset === 0 ? rules : [
""
];
var size = sizeof(rule);
for (var i = 0, j = 0, k = 0; i < index; ++i) for (var x = 0, y = substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x) if (z = trim(j > 0 ? rule[x] + " " + y : replace(y, /&\f/g, rule[x]))) props[k++] = z;
return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length2);
}
function comment(value, root, parent) {
return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0);
}
function declaration(value, root, parent, length2) {
return node(value, root, parent, DECLARATION, substr(value, 0, length2), substr(value, length2 + 1, -1), length2);
}
function serialize(children, callback) {
var output = "";
var length2 = sizeof(children);
for (var i = 0; i < length2; i++) output += callback(children[i], i, children, callback) || "";
return output;
}
function stringify(element, index, children, callback) {
switch (element.type) {
case LAYER:
if (element.children.length) break;
case IMPORT:
case DECLARATION:
return element.return = element.return || element.value;
case COMMENT:
return "";
case KEYFRAMES:
return element.return = element.value + "{" + serialize(element.children, callback) + "}";
case RULESET:
element.value = element.props.join(",");
}
return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
}
function middleware(collection) {
var length2 = sizeof(collection);
return function(element, index, children, callback) {
var output = "";
for (var i = 0; i < length2; i++) output += collection[i](element, index, children, callback) || "";
return output;
};
}
function rulesheet(callback) {
return function(element) {
if (!element.root) {
if (element = element.return) callback(element);
}
};
}
function memoize$1(fn) {
var cache = /* @__PURE__ */ Object.create(null);
return function(arg) {
if (cache[arg] === void 0) cache[arg] = fn(arg);
return cache[arg];
};
}
var identifierWithPointTracking = function identifierWithPointTracking2(begin, points, index) {
var previous = 0;
var character2 = 0;
while (true) {
previous = character2;
character2 = peek();
if (previous === 38 && character2 === 12) {
points[index] = 1;
}
if (token(character2)) {
break;
}
next();
}
return slice(begin, position);
};
var toRules = function toRules2(parsed, points) {
var index = -1;
var character2 = 44;
do {
switch (token(character2)) {
case 0:
if (character2 === 38 && peek() === 12) {
points[index] = 1;
}
parsed[index] += identifierWithPointTracking(position - 1, points, index);
break;
case 2:
parsed[index] += delimit(character2);
break;
case 4:
if (character2 === 44) {
parsed[++index] = peek() === 58 ? "&\f" : "";
points[index] = parsed[index].length;
break;
}
default:
parsed[index] += from(character2);
}
} while (character2 = next());
return parsed;
};
var getRules = function getRules2(value, points) {
return dealloc(toRules(alloc(value), points));
};
var fixedElements = /* @__PURE__ */ new WeakMap();
var compat = function compat2(element) {
if (element.type !== "rule" || !element.parent || element.length < 1) {
return;
}
var value = element.value;
var parent = element.parent;
var isImplicitRule = element.column === parent.column && element.line === parent.line;
while (parent.type !== "rule") {
parent = parent.parent;
if (!parent) return;
}
if (element.props.length === 1 && value.charCodeAt(0) !== 58 && !fixedElements.get(parent)) {
return;
}
if (isImplicitRule) {
return;
}
fixedElements.set(element, true);
var points = [];
var rules = getRules(value, points);
var parentRules = parent.props;
for (var i = 0, k = 0; i < rules.length; i++) {
for (var j = 0; j < parentRules.length; j++, k++) {
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
}
}
};
var removeLabel = function removeLabel2(element) {
if (element.type === "decl") {
var value = element.value;
if (value.charCodeAt(0) === 108 && value.charCodeAt(2) === 98) {
element["return"] = "";
element.value = "";
}
}
};
function prefix(value, length2) {
switch (hash(value, length2)) {
case 5103:
return WEBKIT + "print-" + value + value;
case 5737:
case 4201:
case 3177:
case 3433:
case 1641:
case 4457:
case 2921:
case 5572:
case 6356:
case 5844:
case 3191:
case 6645:
case 3005:
case 6391:
case 5879:
case 5623:
case 6135:
case 4599:
case 4855:
case 4215:
case 6389:
case 5109:
case 5365:
case 5621:
case 3829:
return WEBKIT + value + value;
case 5349:
case 4246:
case 4810:
case 6968:
case 2756:
return WEBKIT + value + MOZ + value + MS + value + value;
case 6828:
case 4268:
return WEBKIT + value + MS + value + value;
case 6165:
return WEBKIT + value + MS + "flex-" + value + value;
case 5187:
return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + "box-$1$2" + MS + "flex-$1$2") + value;
case 5443:
return WEBKIT + value + MS + "flex-item-" + replace(value, /flex-|-self/, "") + value;
case 4675:
return WEBKIT + value + MS + "flex-line-pack" + replace(value, /align-content|flex-|-self/, "") + value;
case 5548:
return WEBKIT + value + MS + replace(value, "shrink", "negative") + value;
case 5292:
return WEBKIT + value + MS + replace(value, "basis", "preferred-size") + value;
case 6060:
return WEBKIT + "box-" + replace(value, "-grow", "") + WEBKIT + value + MS + replace(value, "grow", "positive") + value;
case 4554:
return WEBKIT + replace(value, /([^-])(transform)/g, "$1" + WEBKIT + "$2") + value;
case 6187:
return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + "$1"), /(image-set)/, WEBKIT + "$1"), value, "") + value;
case 5495:
case 3959:
return replace(value, /(image-set\([^]*)/, WEBKIT + "$1$`$1");
case 4968:
return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + "box-pack:$3" + MS + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + WEBKIT + value + value;
case 4095:
case 3583:
case 4068:
case 2532:
return replace(value, /(.+)-inline(.+)/, WEBKIT + "$1$2") + value;
case 8116:
case 7059:
case 5753:
case 5535:
case 5445:
case 5701:
case 4933:
case 4677:
case 5533:
case 5789:
case 5021:
case 4765:
if (strlen(value) - 1 - length2 > 6) switch (charat(value, length2 + 1)) {
case 109:
if (charat(value, length2 + 4) !== 45) break;
case 102:
return replace(value, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3$1" + MOZ + (charat(value, length2 + 3) == 108 ? "$3" : "$2-$3")) + value;
case 115:
return ~indexof(value, "stretch") ? prefix(replace(value, "stretch", "fill-available"), length2) + value : value;
}
break;
case 4949:
if (charat(value, length2 + 1) !== 115) break;
case 6444:
switch (charat(value, strlen(value) - 3 - (~indexof(value, "!important") && 10))) {
case 107:
return replace(value, ":", ":" + WEBKIT) + value;
case 101:
return replace(value, /(.+:)([^;!]+)(;|!.+)?/, "$1" + WEBKIT + (charat(value, 14) === 45 ? "inline-" : "") + "box$3$1" + WEBKIT + "$2$3$1" + MS + "$2box$3") + value;
}
break;
case 5936:
switch (charat(value, length2 + 11)) {
case 114:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb") + value;
case 108:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb-rl") + value;
case 45:
return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "lr") + value;
}
return WEBKIT + value + MS + value + value;
}
return value;
}
var prefixer = function prefixer2(element, index, children, callback) {
if (element.length > -1) {
if (!element["return"]) switch (element.type) {
case DECLARATION:
element["return"] = prefix(element.value, element.length);
break;
case KEYFRAMES:
return serialize([
copy(element, {
value: replace(element.value, "@", "@" + WEBKIT)
})
], callback);
case RULESET:
if (element.length) return combine(element.props, function(value) {
switch (match(value, /(::plac\w+|:read-\w+)/)) {
case ":read-only":
case ":read-write":
return serialize([
copy(element, {
props: [
replace(value, /:(read-\w+)/, ":" + MOZ + "$1")
]
})
], callback);
case "::placeholder":
return serialize([
copy(element, {
props: [
replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1")
]
}),
copy(element, {
props: [
replace(value, /:(plac\w+)/, ":" + MOZ + "$1")
]
}),
copy(element, {
props: [
replace(value, /:(plac\w+)/, MS + "input-$1")
]
})
], callback);
}
return "";
});
}
}
};
var defaultStylisPlugins = [
prefixer
];
var createCache = function createCache2(options) {
var key = options.key;
if (key === "css") {
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])");
Array.prototype.forEach.call(ssrStyles, function(node2) {
var dataEmotionAttribute = node2.getAttribute("data-emotion");
if (dataEmotionAttribute.indexOf(" ") === -1) {
return;
}
document.head.appendChild(node2);
node2.setAttribute("data-s", "");
});
}
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
var inserted = {};
var container;
var nodesToHydrate = [];
{
container = options.container || document.head;
Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="' + key + ' "]'), function(node2) {
var attrib = node2.getAttribute("data-emotion").split(" ");
for (var i = 1; i < attrib.length; i++) {
inserted[attrib[i]] = true;
}
nodesToHydrate.push(node2);
});
}
var _insert;
var omnipresentPlugins = [
compat,
removeLabel
];
{
var currentSheet;
var finalizingPlugins = [
stringify,
rulesheet(function(rule) {
currentSheet.insert(rule);
})
];
var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
var stylis = function stylis2(styles) {
return serialize(compile(styles), serializer);
};
_insert = function insert(selector, serialized, sheet, shouldCache) {
currentSheet = sheet;
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
if (shouldCache) {
cache.inserted[serialized.name] = true;
}
};
}
var cache = {
key,
sheet: new StyleSheet({
key,
container,
nonce: options.nonce,
speedy: options.speedy,
prepend: options.prepend,
insertionPoint: options.insertionPoint
}),
nonce: options.nonce,
inserted,
registered: {},
insert: _insert
};
cache.sheet.hydrate(nodesToHydrate);
retur