MCPcopy
hub / github.com/vercel/next.js / jr

Function jr

packages/next/src/compiled/@vercel/og/index.edge.js:18569–18629  ·  view source on GitHub ↗
(e, t)

Source from the content-addressed store, hash-verified

18567 return ri.find((t) => t.toLowerCase().startsWith(e.toLowerCase()));
18568}
18569async function* jr(e, t) {
18570 var le;
18571 let n = await Gt(), { id: r, inheritedStyle: i, parent: o, font: s, debug: a, locale: u2, embedFont: f = true, graphemeImages: l2, canLoadAdditionalAssets: p, getTwStyles: h2 } = t;
18572 if (e === null || typeof e > "u")
18573 return yield, yield, "";
18574 if (!mr(e) || la(e.type)) {
18575 let H;
18576 if (!mr(e))
18577 H = Ji(String(e), t), yield (await H.next()).value;
18578 else {
18579 if (ua(e.type))
18580 throw new Error("Class component is not supported.");
18581 let pe;
18582 Pi(e.type) ? pe = e.type.render : pe = e.type, H = jr(await pe(e.props), t), yield (await H.next()).value;
18583 }
18584 await H.next();
18585 let J = yield;
18586 return (await H.next(J)).value;
18587 }
18588 let { type: m2, props: b } = e, y = m2;
18589 if (b && fa(b))
18590 throw new Error("dangerouslySetInnerHTML property is not supported. See documentation for more information https://github.com/vercel/satori#jsx.");
18591 let { style: T, children: k, tw: P2, lang: w2 = u2 } = b || {}, S2 = yu(w2);
18592 if (P2) {
18593 let H = h2(P2, T);
18594 T = Object.assign(H, T);
18595 }
18596 let O = n.Node.create();
18597 o.insertChild(O, o.getChildCount());
18598 let [I, F] = await Vi(O, y, i, T, b), q = I.transform === i.transform;
18599 if (q || (I.transform.__parent = i.transform), (I.overflow === "hidden" || I.clipPath && I.clipPath !== "none") && (F._inheritedClipPathId = `satori_cp-${r}`, F._inheritedMaskId = `satori_om-${r}`), I.maskImage && (F._inheritedMaskId = `satori_mi-${r}`), I.backgroundClip === "text") {
18600 let H = { value: "" };
18601 F._inheritedBackgroundClipTextPath = H, I._inheritedBackgroundClipTextPath = H, I.backgroundImage && (F._inheritedBackgroundClipTextHasBackground = "true", I._inheritedBackgroundClipTextHasBackground = "true");
18602 }
18603 let V = ca(k), de = [], Ae = 0, me = [];
18604 for (let H of V) {
18605 let J = jr(H, { id: r + "-" + Ae++, parentStyle: I, inheritedStyle: F, isInheritingTransform: true, parent: O, font: s, embedFont: f, debug: a, graphemeImages: l2, canLoadAdditionalAssets: p, locale: S2, getTwStyles: h2, onNodeDetected: t.onNodeDetected });
18606 p ? me.push(...(await J.next()).value || []) : await J.next(), de.push(J);
18607 }
18608 yield me;
18609 for (let H of de)
18610 await H.next();
18611 let [ue, Ie] = yield, { left: Z, top: ne, width: ke, height: ve } = O.getComputedLayout();
18612 Z += ue, ne += Ie;
18613 let Re = "", Ee = "", Ye = "", { children: Me, ...Oe } = b;
18614 if ((le = t.onNodeDetected) == null || le.call(t, { left: Z, top: ne, width: ke, height: ve, type: y, props: Oe, key: e.key, textContent: mr(Me) ? void 0 : Me }), y === "img") {
18615 let H = I.__src;
18616 Ee = await zr({ id: r, left: Z, top: ne, width: ke, height: ve, src: H, isInheritingTransform: q, debug: a }, I, F);
18617 } else if (y === "svg") {
18618 let H = I.color, J = await Na(e, H);
18619 Ee = await zr({ id: r, left: Z, top: ne, width: ke, height: ve, src: J, isInheritingTransform: q, debug: a }, I, F);
18620 } else {
18621 let H = T == null ? void 0 : T.display;
18622 if (y === "div" && k && typeof k != "string" && H !== "flex" && H !== "none" && H !== "contents")
18623 throw new Error('Expected <div> to have explicit "display: flex", "display: contents", or "display: none" if it has more than one child node.');
18624 Ee = await zr({ id: r, left: Z, top: ne, width: ke, height: ve, isInheritingTransform: q, debug: a }, I, F);
18625 }
18626 for (let H of de)

Callers 1

ncFunction · 0.70

Calls 15

mrFunction · 0.85
peFunction · 0.85
yuFunction · 0.85
zrFunction · 0.85
NaFunction · 0.85
assignMethod · 0.80
callMethod · 0.80
GtFunction · 0.70
laFunction · 0.70
JiFunction · 0.70
uaFunction · 0.70
PiFunction · 0.70

Tested by

no test coverage detected