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

Function Ji

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

Source from the content-addressed store, hash-verified

17896 return n === 255 && r === 255 && i === 255 && (o === void 0 || o === 1);
17897}
17898async function* Ji(e, t) {
17899 let n = await Gt(), { parentStyle: r, inheritedStyle: i, parent: o, font: s, id: a, isInheritingTransform: u2, debug: f, embedFont: l2, graphemeImages: p, locale: h2, canLoadAdditionalAssets: m2 } = t, { textAlign: b, textIndent: y = 0, lineHeight: T, textWrap: k, fontSize: P2, filter: w2, tabSize: S2 = 8, letterSpacing: O, _inheritedBackgroundClipTextPath: I, _inheritedBackgroundClipTextHasBackground: F, flexShrink: q } = r, { words: V, requiredBreaks: de, allowSoftWrap: Ae, allowBreakWord: me, processedContent: ue, shouldCollapseTabsAndSpaces: Ie, lineLimit: Z, blockEllipsis: ne } = Ka(e, r, h2), ke = Sd(n, b);
17900 o.insertChild(ke, o.getChildCount()), ma(q) && o.setFlexShrink(1);
17901 let ve = s.getEngine(P2, T, r, h2), Re = m2 ? Ve(ue, "grapheme").filter((Y) => !wd(Y) && !ve.has(Y)) : [];
17902 yield Re.map((Y) => ({ word: Y, locale: h2 })), Re.length && (ve = s.getEngine(P2, T, r, h2));
17903 function Ee(Y) {
17904 return !!(p && p[Y]);
17905 }
17906 let { measureGrapheme: Ye, measureGraphemeArray: Me, measureText: Oe } = Qa(ve, Ee, { fontSize: P2, letterSpacing: O }), le = Bn(S2) ? X(S2, P2, 1, r) : Ye(nr) * S2, H = (Y, j) => {
17907 if (Y.length === 0)
17908 return { originWidth: 0, endingSpacesWidth: 0, text: Y };
17909 let { index: fe, tabCount: K2 } = _d(Y), ye = 0;
17910 if (K2 > 0) {
17911 let xe = Y.slice(0, fe), ee = Y.slice(fe + K2), te = Oe(xe), ot = te + j;
17912 ye = (le === 0 ? te : (Math.floor(ot / le) + K2) * le) + Oe(ee);
17913 } else
17914 ye = Oe(Y);
17915 let ae = Y.trimEnd() === Y ? ye : Oe(Y.trimEnd());
17916 return { originWidth: ye, endingSpacesWidth: ye - ae, text: Y };
17917 }, J = [], pe = [], G = [], Le = [], De = [];
17918 function Ue(Y) {
17919 let j = 0, fe = 0, K2 = -1, ye = 0, ae = 0, xe = 0, ee = 0;
17920 J = [], G = [0], Le = [], De = [];
17921 let te = 0, ot = 0;
17922 for (; te < V.length && j < Z; ) {
17923 let Q = V[te], We = de[te], ze = 0, { originWidth: Ar, endingSpacesWidth: Pe, text: er } = H(Q, ae);
17924 Q = er, ze = Ar;
17925 let qe = Pe;
17926 We && xe === 0 && (xe = ve.height(Q));
17927 let Rt = b === "justify", we = te && ae + ze > Y + qe && Ae;
17928 if (me && ze > Y && (!ae || we || We)) {
17929 let tt = Ve(Q, "grapheme");
17930 V.splice(te, 1, ...tt), ae > 0 && (J.push(ae - ot), pe.push(ee), j++, ye += xe, ae = 0, xe = 0, ee = 0, G.push(1), K2 = -1), ot = qe;
17931 continue;
17932 }
17933 if (We || we)
17934 Ie && Q === nr && (ze = 0), J.push(ae - ot), pe.push(ee), j++, ye += xe, ae = ze, xe = ze ? Math.round(ve.height(Q)) : 0, ee = ze ? Math.round(ve.baseline(Q)) : 0, G.push(1), K2 = -1, We || (fe = Math.max(fe, Y));
17935 else {
17936 ae += ze;
17937 let tt = Math.round(ve.height(Q));
17938 tt > xe && (xe = tt, ee = Math.round(ve.baseline(Q))), Rt && G[G.length - 1]++;
17939 }
17940 Rt && K2++, fe = Math.max(fe, ae);
17941 let et2 = ae - ze;
17942 if (ze === 0)
17943 De.push({ y: ye, x: et2, width: 0, line: j, lineIndex: K2, isImage: false });
17944 else {
17945 let tt = Ve(Q, "word");
17946 for (let bt = 0; bt < tt.length; bt++) {
17947 let vt = tt[bt], je = 0, st = false;
17948 Ee(vt) ? (je = P2, st = true) : !l2 && vt.length > 1 ? je = Oe(vt) : je = Ye(vt), Le.push(vt), De.push({ y: ye, x: et2, width: je, line: j, lineIndex: K2, isImage: st }), et2 += je;
17949 }
17950 }
17951 te++, ot = qe;
17952 }
17953 return ae && (j < Z && (ye += xe), j++, J.push(ae), pe.push(ee)), { width: fe, height: ye };
17954 }
17955 let $e = { width: 0, height: 0 };

Callers 2

jrFunction · 0.70
index.node.jsFile · 0.70

Calls 15

SdFunction · 0.85
wdFunction · 0.85
BnFunction · 0.85
JaFunction · 0.85
includesMethod · 0.80
GtFunction · 0.70
KaFunction · 0.70
maFunction · 0.70
VeFunction · 0.70
QaFunction · 0.70
XFunction · 0.70
YeFunction · 0.70

Tested by

no test coverage detected