laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
58 lines (57 loc) • 1.63 kB
JavaScript
"use client";
import { color as A } from "./color.js";
import { convert as I } from "../../unist-util-is/lib/index.js";
const g = [], j = !0, a = !1, k = "skip";
function w(t, o, u, s) {
let p;
typeof o == "function" && typeof u != "function" ? (s = u, u = o) : p = o;
const b = I(p), y = s ? -1 : 1;
m(t, void 0, [])();
function m(n, N, l) {
const r = (
/** @type {Record<string, unknown>} */
n && typeof n == "object" ? n : {}
);
if (typeof r.type == "string") {
const e = (
// `hast`
typeof r.tagName == "string" ? r.tagName : (
// `xast`
typeof r.name == "string" ? r.name : void 0
)
);
Object.defineProperty(h, "name", {
value: "node (" + A(n.type + (e ? "<" + e + ">" : "")) + ")"
});
}
return h;
function h() {
let e = g, f, i, d;
if ((!o || b(n, N, l[l.length - 1] || void 0)) && (e = E(u(n, l)), e[0] === a))
return e;
if ("children" in n && n.children) {
const c = (
/** @type {UnistParent} */
n
);
if (c.children && e[0] !== k)
for (i = (s ? c.children.length : -1) + y, d = l.concat(c); i > -1 && i < c.children.length; ) {
const P = c.children[i];
if (f = m(P, i, d)(), f[0] === a)
return f;
i = typeof f[1] == "number" ? f[1] : i + y;
}
}
return e;
}
}
}
function E(t) {
return Array.isArray(t) ? t : typeof t == "number" ? [j, t] : t == null ? g : [t];
}
export {
j as CONTINUE,
a as EXIT,
k as SKIP,
w as visitParents
};