183 lines
5.2 KiB
JavaScript
183 lines
5.2 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: fd0220e4d10052af.701bdafa2d.js
|
|
* Module id: 500536
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(462214),
|
|
n = e.i(358379),
|
|
i = e.i(768924),
|
|
r = e.i(292002),
|
|
a = e.i(713118),
|
|
o = e.i(216257),
|
|
s = e.i(929286),
|
|
c = e.i(72789),
|
|
l = e.i(295085),
|
|
u = e.i(217884),
|
|
h = e.i(459220),
|
|
f = e.i(36108),
|
|
d = e.i(455228),
|
|
p = e.i(896359);
|
|
function g() {
|
|
return window.devicePixelRatio || 2;
|
|
}
|
|
function b(e, t, n) {
|
|
let i = n ?? g(),
|
|
r = (0, p.computeSizes)(e, t);
|
|
return (0, p.predictSrcsetWidth)(r, i);
|
|
}
|
|
function m(e) {
|
|
return [...l.RESPONSIVE_WIDTHS].filter((t) => t < e).reverse();
|
|
}
|
|
function w(e) {
|
|
let t = (0, n.useRef)(g());
|
|
return (0, i.useStore)((n) => {
|
|
let i = (0, p.computeSizes)(e, n.transform[2]);
|
|
return (0, p.predictSrcsetWidth)(i, t.current);
|
|
});
|
|
}
|
|
e.s(
|
|
[
|
|
"getFallbackShortSides",
|
|
() => m,
|
|
"getVideoTargetWidth",
|
|
() => b,
|
|
"useVideoTargetWidth",
|
|
() => w,
|
|
],
|
|
500536,
|
|
);
|
|
let v = new Set(),
|
|
x = !1,
|
|
y = new Map(),
|
|
_ = [],
|
|
S = null;
|
|
function E() {
|
|
S = null;
|
|
let e = _.splice(0, 4);
|
|
0 !== e.length &&
|
|
((0, n.startTransition)(() => {
|
|
for (let t of e) {
|
|
let e = y.get(t);
|
|
e && (e(), y.delete(t));
|
|
}
|
|
}),
|
|
_.length > 0 && (S = requestAnimationFrame(E)));
|
|
}
|
|
function M() {
|
|
(x = !1),
|
|
v.clear(),
|
|
y.clear(),
|
|
(_.length = 0),
|
|
null !== S && (cancelAnimationFrame(S), (S = null)),
|
|
(0, c.clearAllTierPrefetchState)();
|
|
}
|
|
let T = { visibility: "hidden", pointerEvents: "none" },
|
|
k = (0, n.memo)(function ({ Component: e, ...c }) {
|
|
let { width: p, height: g } = (0, h.useCachedNodeDimensions)(c.id),
|
|
b = Number(w(a.NODE_WIDTH)),
|
|
m = (0, n.useRef)(!x),
|
|
M = (0, n.useRef)(!v.has(c.id)),
|
|
[k, C] = (0, n.useState)(m.current),
|
|
A = (0, o.useCanvasStore)((0, s.selectNodeData)(c.id)),
|
|
N = "object" == typeof c.data && null !== c.data ? c.data : {};
|
|
if (
|
|
((0, n.useEffect)(() => {
|
|
if (((x = !0), v.add(c.id), !k)) {
|
|
var e, t;
|
|
return (
|
|
(e = c.id),
|
|
(t = () => C(!0)),
|
|
y.set(e, t),
|
|
_.push(e),
|
|
null === S && (S = requestAnimationFrame(E)),
|
|
() => {
|
|
y.delete(e);
|
|
let t = _.indexOf(e);
|
|
-1 !== t && _.splice(t, 1);
|
|
}
|
|
);
|
|
}
|
|
}, [c.id]),
|
|
(0, n.useEffect)(
|
|
() => (
|
|
(0, d.markNodeVisible)(c.id),
|
|
() => {
|
|
(0, d.markNodeHidden)(c.id), (0, u.cancelByOwner)(c.id);
|
|
}
|
|
),
|
|
[c.id],
|
|
),
|
|
!k)
|
|
) {
|
|
let e = (function (e, t, n) {
|
|
let i = t?.url,
|
|
r = i?.[0];
|
|
if (r)
|
|
switch (e) {
|
|
case "image": {
|
|
let e = (0, l.getUrlForWidth)(r, n, t?.fileSize);
|
|
if (e) return e;
|
|
if (r.startsWith("http://") || r.startsWith("https://"))
|
|
return r;
|
|
return;
|
|
}
|
|
case "video":
|
|
case "video-story":
|
|
return (0, l.getVideoSnapshotForWidth)(r, n) ?? void 0;
|
|
default:
|
|
return;
|
|
}
|
|
})(c.type, A ?? N ?? {}, b);
|
|
return (0, t.jsxs)("div", {
|
|
style: { width: p, height: g },
|
|
className: "node-skeleton",
|
|
children: [
|
|
e &&
|
|
(0, t.jsx)("img", {
|
|
src: e,
|
|
alt: "",
|
|
draggable: !1,
|
|
decoding: "async",
|
|
className: "node-skeleton-img",
|
|
}),
|
|
(0, t.jsx)(i.Handle, {
|
|
type: "target",
|
|
position: r.Position.Left,
|
|
id: "target",
|
|
style: T,
|
|
}),
|
|
(0, t.jsx)(i.Handle, {
|
|
type: "source",
|
|
position: r.Position.Right,
|
|
id: "source",
|
|
style: T,
|
|
}),
|
|
],
|
|
});
|
|
}
|
|
let I = M.current && !m.current;
|
|
return (0, t.jsx)(f.NodeFreezeContext.Provider, {
|
|
value: !1,
|
|
children: (0, t.jsx)("div", {
|
|
className: I ? "node-first-appear" : void 0,
|
|
children: (0, t.jsx)(e, { ...c }),
|
|
}),
|
|
});
|
|
});
|
|
function C(e) {
|
|
let i = (0, n.memo)(function (n) {
|
|
return (0, t.jsx)(k, { Component: e, ...n });
|
|
});
|
|
return (i.displayName = `SVN(${e.displayName || e.name || "Node"})`), i;
|
|
}
|
|
e.s(
|
|
["resetProgressiveMount", () => M, "wrapSelfVirtualizing", () => C],
|
|
549997,
|
|
);
|
|
};
|
|
|
|
export default moduleFactory;
|