@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
294 lines (293 loc) • 9.21 kB
JavaScript
"use client";
import V from "react";
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @lightSyntaxTransform
* @noflow
* @nolint
* @preventMunge
* @preserve-invariant-messages
*/
var O, D;
function ee() {
if (D) return O;
D = 1;
var A = Object.create, m = Object.defineProperty, P = Object.getOwnPropertyDescriptor, x = Object.getOwnPropertyNames, I = Object.getPrototypeOf, T = Object.prototype.hasOwnProperty, z = (e, r) => {
for (var i in r)
m(e, i, { get: r[i], enumerable: !0 });
}, b = (e, r, i, f) => {
if (r && typeof r == "object" || typeof r == "function")
for (let u of x(r))
!T.call(e, u) && u !== i && m(e, u, { get: () => r[u], enumerable: !(f = P(r, u)) || f.enumerable });
return e;
}, L = (e, r, i) => (i = e != null ? A(I(e)) : {}, b(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
!e || !e.__esModule ? m(i, "default", { value: e, enumerable: !0 }) : i,
e
)), U = (e) => b(m({}, "__esModule", { value: !0 }), e), S = {};
z(S, {
$dispatcherGuard: () => G,
$makeReadOnly: () => H,
$reset: () => q,
$structuralCheck: () => B,
c: () => F,
clearRenderCounterRegistry: () => J,
renderCounterRegistry: () => p,
useRenderCounter: () => Z
}), O = U(S);
var y = L(V), { useRef: w, useEffect: d, isValidElement: _ } = y, M, C = (
//@ts-ignore
(M = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE) != null ? M : y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
), E = Symbol.for("react.memo_cache_sentinel"), k, F = (
// @ts-expect-error
typeof ((k = y.__COMPILER_RUNTIME) == null ? void 0 : k.c) == "function" ? (
// @ts-expect-error
y.__COMPILER_RUNTIME.c
) : function(r) {
return y.useMemo(() => {
const i = new Array(r);
for (let f = 0; f < r; f++)
i[f] = E;
return i[E] = !0, i;
}, []);
}
), g = {};
[
"readContext",
"useCallback",
"useContext",
"useEffect",
"useImperativeHandle",
"useInsertionEffect",
"useLayoutEffect",
"useMemo",
"useReducer",
"useRef",
"useState",
"useDebugValue",
"useDeferredValue",
"useTransition",
"useMutableSource",
"useSyncExternalStore",
"useId",
"unstable_isNewReconciler",
"getCacheSignal",
"getCacheForType",
"useCacheRefresh"
].forEach((e) => {
g[e] = () => {
throw new Error(
`[React] Unexpected React hook call (${e}) from a React compiled function. Check that all hooks are called directly and named according to convention ('use[A-Z]') `
);
};
});
var R = null;
g.useMemoCache = (e) => {
if (R == null)
throw new Error(
"React Compiler internal invariant violation: unexpected null dispatcher"
);
return R.useMemoCache(e);
};
function N(e) {
return C.ReactCurrentDispatcher.current = e, C.ReactCurrentDispatcher.current;
}
var $ = [];
function G(e) {
const r = C.ReactCurrentDispatcher.current;
if (e === 0) {
if ($.push(r), $.length === 1 && (R = r), r === g)
throw new Error(
"[React] Unexpected call to custom hook or component from a React compiled function. Check that (1) all hooks are called directly and named according to convention ('use[A-Z]') and (2) components are returned as JSX instead of being directly invoked."
);
N(g);
} else if (e === 1) {
const i = $.pop();
if (i == null)
throw new Error(
"React Compiler internal error: unexpected null in guard stack"
);
$.length === 0 && (R = null), N(i);
} else if (e === 2)
$.push(r), N(R);
else if (e === 3) {
const i = $.pop();
if (i == null)
throw new Error(
"React Compiler internal error: unexpected null in guard stack"
);
N(i);
} else
throw new Error("React Compiler internal error: unreachable block" + e);
}
function q(e) {
for (let r = 0; r < e.length; r++)
e[r] = E;
}
function H() {
throw new Error("TODO: implement $makeReadOnly in react-compiler-runtime");
}
var p = /* @__PURE__ */ new Map();
function J() {
for (const e of p.values())
e.forEach((r) => {
r.count = 0;
});
}
function W(e, r) {
let i = p.get(e);
i == null && (i = /* @__PURE__ */ new Set(), p.set(e, i)), i.add(r);
}
function Y(e, r) {
const i = p.get(e);
i != null && i.delete(r);
}
function Z(e) {
const r = w(null);
r.current != null && (r.current.count += 1), d(() => {
if (r.current == null) {
const i = { count: 0 };
W(e, i), r.current = i;
}
return () => {
r.current !== null && Y(e, r.current);
};
});
}
var j = /* @__PURE__ */ new Set();
function B(e, r, i, f, u, X) {
function a(n, t, o, c) {
const l = `${f}:${X} [${u}] ${i}${o} changed from ${n} to ${t} at depth ${c}`;
j.has(l) || (j.add(l), console.error(l));
}
const K = 2;
function v(n, t, o, c) {
if (!(c > K)) {
if (n === t)
return;
if (typeof n != typeof t)
a(`type ${typeof n}`, `type ${typeof t}`, o, c);
else if (typeof n == "object") {
const l = Array.isArray(n), h = Array.isArray(t);
if (n === null && t !== null)
a("null", `type ${typeof t}`, o, c);
else if (t === null)
a(`type ${typeof n}`, "null", o, c);
else if (n instanceof Map)
if (!(t instanceof Map))
a("Map instance", "other value", o, c);
else if (n.size !== t.size)
a(
`Map instance with size ${n.size}`,
`Map instance with size ${t.size}`,
o,
c
);
else
for (const [s, Q] of n)
t.has(s) ? v(Q, t.get(s), `${o}.get(${s})`, c + 1) : a(
`Map instance with key ${s}`,
`Map instance without key ${s}`,
o,
c
);
else if (t instanceof Map)
a("other value", "Map instance", o, c);
else if (n instanceof Set)
if (!(t instanceof Set))
a("Set instance", "other value", o, c);
else if (n.size !== t.size)
a(
`Set instance with size ${n.size}`,
`Set instance with size ${t.size}`,
o,
c
);
else
for (const s of t)
n.has(s) || a(
`Set instance without element ${s}`,
`Set instance with element ${s}`,
o,
c
);
else if (t instanceof Set)
a("other value", "Set instance", o, c);
else if (l || h)
if (l !== h)
a(
`type ${l ? "array" : "object"}`,
`type ${h ? "array" : "object"}`,
o,
c
);
else if (n.length !== t.length)
a(
`array with length ${n.length}`,
`array with length ${t.length}`,
o,
c
);
else
for (let s = 0; s < n.length; s++)
v(n[s], t[s], `${o}[${s}]`, c + 1);
else if (_(n) || _(t))
_(n) !== _(t) ? a(
`type ${_(n) ? "React element" : "object"}`,
`type ${_(t) ? "React element" : "object"}`,
o,
c
) : n.type !== t.type ? a(
`React element of type ${n.type}`,
`React element of type ${t.type}`,
o,
c
) : v(
n.props,
t.props,
`[props of ${o}]`,
c + 1
);
else {
for (const s in t)
s in n || a(
`object without key ${s}`,
`object with key ${s}`,
o,
c
);
for (const s in n)
s in t ? v(n[s], t[s], `${o}.${s}`, c + 1) : a(
`object with key ${s}`,
`object without key ${s}`,
o,
c
);
}
} else {
if (typeof n == "function")
return;
isNaN(n) || isNaN(t) ? isNaN(n) !== isNaN(t) && a(
`${isNaN(n) ? "NaN" : "non-NaN value"}`,
`${isNaN(t) ? "NaN" : "non-NaN value"}`,
o,
c
) : n !== t && a(n, t, o, c);
}
}
}
v(e, r, "", 0);
}
return O;
}
var te = ee();
export {
te as d
};