sandbox-agent/factory/.context/vite-mock-cache/deps/chunk-TFDFHE5Q.js
2026-03-09 19:57:56 -07:00

637 lines
19 KiB
JavaScript

import {
require_react
} from "./chunk-776SV3ZX.js";
import {
__esm,
__export,
__toESM
} from "./chunk-V4OQ3NZ2.js";
// ../../../node_modules/.pnpm/styletron-standard@3.1.0/node_modules/styletron-standard/dist-browser-esm/index.js
var dist_browser_esm_exports = {};
__export(dist_browser_esm_exports, {
driver: () => driver,
getInitialStyle: () => getInitialStyle,
renderDeclarativeRules: () => renderDeclarativeRules
});
function driver(style, styletron) {
const tx = renderDeclarativeRules(style, styletron);
return styletron.renderStyle(tx);
}
function getInitialStyle() {
return {};
}
function renderDeclarativeRules(style, styletron) {
for (const key in style) {
const val = style[key];
if (key === "animationName" && typeof val !== "string") {
style.animationName = styletron.renderKeyframes(val);
continue;
}
if (key === "fontFamily" && typeof val !== "string") {
if (Array.isArray(val)) {
let result = "";
for (const font of val) {
if (typeof font === "object") {
result += `${styletron.renderFontFace(font)},`;
} else if (typeof font === "string") {
result += `${font},`;
}
}
style.fontFamily = result.slice(0, -1);
continue;
} else if (val === void 0) {
continue;
} else {
style.fontFamily = styletron.renderFontFace(val);
continue;
}
}
if (typeof val === "object" && val !== null) {
renderDeclarativeRules(val, styletron);
}
}
return style;
}
var init_dist_browser_esm = __esm({
"../../../node_modules/.pnpm/styletron-standard@3.1.0/node_modules/styletron-standard/dist-browser-esm/index.js"() {
}
});
// ../../../node_modules/.pnpm/styletron-react@6.1.1_react@19.2.4/node_modules/styletron-react/dist-browser-esm/dev-tool.js
function addDebugMetadata(instance, stackIndex) {
const {
stack,
stacktrace,
message
} = new Error("stacktrace source");
instance.debug = {
stackInfo: {
stack,
stacktrace,
message
},
stackIndex
};
}
var setupDevtoolsExtension, BrowserDebugEngine, DebugEngine;
var init_dev_tool = __esm({
"../../../node_modules/.pnpm/styletron-react@6.1.1_react@19.2.4/node_modules/styletron-react/dist-browser-esm/dev-tool.js"() {
setupDevtoolsExtension = () => {
const atomicMap = {};
const extensionsMap = /* @__PURE__ */ new Map();
const stylesMap = /* @__PURE__ */ new Map();
const getStyles = (className) => {
const styles = {};
if (typeof className !== "string") {
return styles;
}
if (stylesMap.has(className)) {
styles.styles = stylesMap.get(className);
const classList = className.split(" ");
if (classList.length) {
const classes = {};
classList.forEach((singleClassName) => {
classes[singleClassName] = atomicMap[singleClassName];
});
styles.classes = classes;
}
if (extensionsMap.has(className)) {
const extension = extensionsMap.get(className);
styles.extends = extension;
}
return styles;
}
};
window.__STYLETRON_DEVTOOLS__ = {
atomicMap,
extensionsMap,
stylesMap,
getStyles
};
};
BrowserDebugEngine = class {
constructor(worker) {
if (!worker) {
const workerBlob = new Blob([`importScripts("https://unpkg.com/css-to-js-sourcemap-worker@2.0.5/worker.js")`], {
type: "application/javascript"
});
worker = new Worker(URL.createObjectURL(workerBlob));
worker.postMessage({
id: "init_wasm",
url: "https://unpkg.com/css-to-js-sourcemap-worker@2.0.5/mappings.wasm"
});
worker.postMessage({
id: "set_render_interval",
interval: 120
});
if (module.hot) {
module.hot.addStatusHandler((status) => {
if (status === "dispose") {
worker.postMessage({
id: "invalidate"
});
}
});
}
}
this.worker = worker;
this.counter = 0;
this.worker.onmessage = (msg) => {
const {
id,
css
} = msg.data;
if (id === "render_css" && css) {
const style = document.createElement("style");
style.appendChild(document.createTextNode(css));
document.head.appendChild(style);
}
};
}
debug({
stackIndex,
stackInfo
}) {
const className = `__debug-${this.counter++}`;
this.worker.postMessage({
id: "add_mapped_class",
className,
stackInfo,
stackIndex
});
return className;
}
};
DebugEngine = true ? BrowserDebugEngine : NoopDebugEngine;
}
});
// ../../../node_modules/.pnpm/styletron-react@6.1.1_react@19.2.4/node_modules/styletron-react/dist-browser-esm/index.js
var dist_browser_esm_exports2 = {};
__export(dist_browser_esm_exports2, {
DebugEngine: () => DebugEngine,
Provider: () => Provider,
autoComposeDeep: () => autoComposeDeep,
autoComposeShallow: () => autoComposeShallow,
composeDynamic: () => composeDynamic,
composeStatic: () => composeStatic,
createDeepMergeReducer: () => createDeepMergeReducer,
createShallowMergeReducer: () => createShallowMergeReducer,
createStyled: () => createStyled,
createStyledElementComponent: () => createStyledElementComponent,
dynamicComposeDeep: () => dynamicComposeDeep,
dynamicComposeShallow: () => dynamicComposeShallow,
resolveStyle: () => resolveStyle,
staticComposeDeep: () => staticComposeDeep,
staticComposeShallow: () => staticComposeShallow,
styled: () => styled,
useStyletron: () => useStyletron,
withStyle: () => withStyle,
withStyleDeep: () => withStyleDeep,
withTransform: () => withTransform,
withWrapper: () => withWrapper
});
function _extends() {
_extends = Object.assign ? Object.assign.bind() : function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function checkNoopEngine(engine) {
if (true) {
engine === noopEngine && // eslint-disable-next-line no-console
console.warn(true ? `
Styletron has been switched to a no-op (test) mode.
A Styletron styled component was rendered, but no Styletron engine instance was provided in React context.
Did you forget to provide a Styletron engine instance to React context via using the Styletron provider component?
Note: Providers and Consumers must come from the exact same React.createContext call to work.
If your app has multiple instances of the "styletron-react" package in your node_module tree,
your Provider may be coming from a different React.createContext call, which means the styled components
will not recieve the provided engine instance. This scenario can arise, for example, when using "npm link".
` : `Styletron Provider is not set up. Defaulting to no-op.`);
}
}
function useStyletron() {
const styletronEngine = React.useContext(StyletronContext);
const debugEngine = React.useContext(DebugEngineContext);
const hydrating = React.useContext(HydrationContext);
checkNoopEngine(styletronEngine);
const debugClassName = React.useRef("");
const prevDebugClassNameDeps = React.useRef([]);
return [function css(style) {
const className = driver(style, styletronEngine);
if (false) {
return className;
}
const {
stack,
message
} = new Error("stacktrace source");
const nextDeps = [debugEngine, hydrating];
if (prevDebugClassNameDeps.current[0] !== nextDeps[0] || prevDebugClassNameDeps.current[1] !== nextDeps[1]) {
if (debugEngine && !hydrating) {
debugClassName.current = debugEngine.debug({
stackInfo: {
stack,
message
},
stackIndex: 1
});
}
prevDebugClassNameDeps.current = nextDeps;
}
if (debugClassName.current) {
return `${debugClassName.current} ${className}`;
}
return className;
}];
}
function createStyled({
getInitialStyle: getInitialStyle2,
driver: driver2,
wrapper
}) {
function styled2(base, styleArg) {
if (true) {
if (base.__STYLETRON__) {
console.warn("It appears you are passing a styled component into `styled`.");
console.warn("For composition with existing styled components, use `withStyle` or `withTransform` instead.");
}
}
const baseStyletron = {
reducers: [],
base,
driver: driver2,
getInitialStyle: getInitialStyle2,
wrapper
};
if (true) {
addDebugMetadata(baseStyletron, 2);
}
return createStyledElementComponent(autoComposeShallow(baseStyletron, styleArg));
}
return styled2;
}
function autoComposeShallow(styletron, styleArg) {
if (typeof styleArg === "function") {
return dynamicComposeShallow(styletron, styleArg);
}
return staticComposeShallow(styletron, styleArg);
}
function addExtension(composed, component, styleArg) {
return {
...composed,
ext: {
with: styleArg,
name: component.displayName,
base: component.__STYLETRON__.base,
getInitialStyle: component.__STYLETRON__.reducers.length ? component.__STYLETRON__.reducers[0].reducer : component.__STYLETRON__.getInitialStyle
}
};
}
function autoComposeDeep(styletron, styleArg) {
if (typeof styleArg === "function") {
return dynamicComposeDeep(styletron, styleArg);
}
return staticComposeDeep(styletron, styleArg);
}
function staticComposeShallow(styletron, style) {
return composeStatic(styletron, createShallowMergeReducer(style));
}
function staticComposeDeep(styletron, style) {
return composeStatic(styletron, createDeepMergeReducer(style));
}
function dynamicComposeShallow(styletron, styleFn) {
return composeDynamic(styletron, (style, props) => shallowMerge(style, styleFn(props)));
}
function dynamicComposeDeep(styletron, styleFn) {
return composeDynamic(styletron, (style, props) => deepMerge(style, styleFn(props)));
}
function createShallowMergeReducer(style) {
return {
reducer: (inputStyle) => shallowMerge(inputStyle, style),
assignmentCommutative: true,
factory: createShallowMergeReducer,
style
};
}
function createDeepMergeReducer(style) {
return {
reducer: (inputStyle) => deepMerge(inputStyle, style),
assignmentCommutative: true,
factory: createDeepMergeReducer,
style
};
}
function composeStatic(styletron, reducerContainer) {
if (styletron.reducers.length === 0) {
const style = reducerContainer.reducer(styletron.getInitialStyle());
const result = {
reducers: styletron.reducers,
base: styletron.base,
driver: styletron.driver,
wrapper: styletron.wrapper,
getInitialStyle: () => style
};
if (true) {
result.debug = styletron.debug;
}
return result;
} else {
const last = styletron.reducers[0];
if (last.assignmentCommutative === true && reducerContainer.assignmentCommutative === true) {
const composed = reducerContainer.reducer(last.style);
const result = {
getInitialStyle: styletron.getInitialStyle,
base: styletron.base,
driver: styletron.driver,
wrapper: styletron.wrapper,
reducers: [last.factory(composed)].concat(styletron.reducers.slice(1))
};
if (true) {
result.debug = styletron.debug;
}
return result;
}
return composeDynamic(styletron, reducerContainer.reducer);
}
}
function composeDynamic(styletron, reducer) {
const composed = {
getInitialStyle: styletron.getInitialStyle,
base: styletron.base,
driver: styletron.driver,
wrapper: styletron.wrapper,
// @ts-ignore
reducers: [{
assignmentCommutative: false,
reducer
}].concat(styletron.reducers)
};
if (true) {
composed.debug = styletron.debug;
}
return composed;
}
function createStyledElementComponent(styletron) {
const {
reducers,
base,
driver: driver2,
wrapper,
getInitialStyle: getInitialStyle2,
ext
} = styletron;
if (true) {
var debugStackInfo, debugStackIndex;
if (styletron.debug) {
debugStackInfo = styletron.debug.stackInfo;
debugStackIndex = styletron.debug.stackIndex;
}
}
if (true) {
var debugClassName;
}
const StyledElement = React.forwardRef((props, ref) => {
const styletron2 = React.useContext(StyletronContext);
const debugEngine = React.useContext(DebugEngineContext);
const hydrating = React.useContext(HydrationContext);
checkNoopEngine(styletron2);
const elementProps = omitPrefixedKeys(props);
let style = resolveStyle(getInitialStyle2, reducers, props);
if (props.$style) {
if (typeof props.$style === "function") {
style = deepMerge(style, props.$style(props));
} else {
style = deepMerge(style, props.$style);
}
}
const styleClassString = driver2(style, styletron2);
const Element = props.$as ? props.$as : base;
elementProps.className = props.className ? `${props.className} ${styleClassString}` : styleClassString;
if (debugEngine && !hydrating) {
if (!debugClassName) {
debugClassName = debugEngine.debug({
stackInfo: debugStackInfo,
stackIndex: debugStackIndex
});
}
const joined = `${debugClassName} ${elementProps.className}`;
elementProps.className = joined;
}
if (window.__STYLETRON_DEVTOOLS__) {
window.__STYLETRON_DEVTOOLS__.stylesMap.set(elementProps.className, style);
if (ext) {
window.__STYLETRON_DEVTOOLS__.extensionsMap.set(elementProps.className, {
base: ext.base,
displayName: ext.name,
initialStyles: ext.getInitialStyle({}, props),
styleOverrides: typeof ext.with === "function" ? ext.with(props) : ext.with
});
}
}
if (props.$ref) {
console.warn("The prop `$ref` has been deprecated. Use `ref` instead. Refs are now forwarded with React.forwardRef.");
}
return React.createElement(Element, _extends({}, elementProps, {
ref: ref || props.$ref
}));
});
const Wrapped = wrapper(StyledElement);
Wrapped.__STYLETRON__ = {
base,
reducers,
driver: driver2,
wrapper,
getInitialStyle: getInitialStyle2
};
if (true) {
let displayName;
if (typeof base === "string") {
displayName = base;
} else if (base.displayName) {
displayName = base.displayName;
} else if (base.name) {
displayName = base.name;
} else {
displayName = "Unknown";
}
Wrapped.displayName = `Styled(${displayName})`;
}
return Wrapped;
}
function resolveStyle(getInitialStyle2, reducers, props) {
let result = getInitialStyle2();
let i = reducers.length;
while (i--) {
const reducer = reducers[i].reducer;
result = reducer(result, props);
}
return result;
}
function isObject(x) {
return typeof x === "object" && x !== null;
}
function omitPrefixedKeys(source) {
const result = {};
for (const key in source) {
if (key[0] !== "$") {
result[key] = source[key];
}
}
return result;
}
function deepMerge(a, b) {
const result = assign({}, a);
for (const key in b) {
const val = b[key];
if (isObject(val) && isObject(a[key])) {
result[key] = deepMerge(a[key], val);
} else {
result[key] = val;
}
}
return result;
}
function shallowMerge(a, b) {
return assign(assign({}, a), b);
}
function assign(target, source) {
for (const key in source) {
target[key] = source[key];
}
return target;
}
var React, noopEngine, StyletronContext, HydrationContext, DebugEngineContext, DevProvider, Provider, styled, withTransform, withStyleDeep, withStyle, withWrapper;
var init_dist_browser_esm2 = __esm({
"../../../node_modules/.pnpm/styletron-react@6.1.1_react@19.2.4/node_modules/styletron-react/dist-browser-esm/index.js"() {
React = __toESM(require_react());
init_dist_browser_esm();
init_dev_tool();
noopEngine = {
renderStyle: () => "",
renderKeyframes: () => "",
renderFontFace: () => ""
};
StyletronContext = React.createContext(noopEngine);
HydrationContext = React.createContext(false);
DebugEngineContext = React.createContext(void 0);
DevProvider = class extends React.Component {
constructor(props) {
super(props);
this.state = {
hydrating: Boolean(props.debugAfterHydration)
};
}
componentDidMount() {
if (true) {
if (this.state.hydrating === true) {
this.setState({
hydrating: false
});
}
}
}
render() {
return React.createElement(StyletronContext.Provider, {
value: this.props.value
}, React.createElement(DebugEngineContext.Provider, {
value: this.props.debug
}, React.createElement(HydrationContext.Provider, {
value: this.state.hydrating
}, this.props.children)));
}
};
Provider = true ? DevProvider : StyletronContext.Provider;
if (!window.__STYLETRON_DEVTOOLS__) {
setupDevtoolsExtension();
}
styled = createStyled({
getInitialStyle,
driver,
wrapper: (Component2) => Component2
});
withTransform = (component, transformer) => {
const styletron = component.__STYLETRON__;
if (true) {
addDebugMetadata(styletron, 2);
}
return createStyledElementComponent(composeDynamic(styletron, transformer));
};
withStyleDeep = (component, styleArg) => {
const styletron = component.__STYLETRON__;
if (true) {
if (!styletron) {
console.warn("The first parameter to `withStyle` must be a styled component (without extra wrappers).");
}
}
if (true) {
addDebugMetadata(styletron, 2);
return createStyledElementComponent(addExtension(autoComposeDeep(styletron, styleArg), component, styleArg));
} else {
return createStyledElementComponent(autoComposeDeep(styletron, styleArg));
}
};
withStyle = withStyleDeep;
withWrapper = (component, wrapper) => {
const styletron = component.__STYLETRON__;
if (true) {
if (!styletron) {
console.warn("The first parameter to `withWrapper` must be a styled component (without extra wrappers).");
}
}
const composed = {
getInitialStyle: styletron.getInitialStyle,
base: styletron.base,
driver: styletron.driver,
wrapper,
reducers: styletron.reducers
};
if (true) {
addDebugMetadata(composed, 2);
}
return createStyledElementComponent(composed);
};
}
});
export {
dist_browser_esm_exports,
init_dist_browser_esm,
DebugEngine,
Provider,
useStyletron,
createStyled,
styled,
withTransform,
withStyleDeep,
withStyle,
withWrapper,
autoComposeShallow,
autoComposeDeep,
staticComposeShallow,
staticComposeDeep,
dynamicComposeShallow,
dynamicComposeDeep,
createShallowMergeReducer,
createDeepMergeReducer,
composeStatic,
composeDynamic,
createStyledElementComponent,
resolveStyle,
dist_browser_esm_exports2,
init_dist_browser_esm2
};
//# sourceMappingURL=chunk-TFDFHE5Q.js.map