@texonom/nreact 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,984 @@
1
+ var te = Object.defineProperty, ne = Object.defineProperties;
2
+ var re = Object.getOwnPropertyDescriptors;
3
+ var $ = Object.getOwnPropertySymbols;
4
+ var A = Object.prototype.hasOwnProperty, Z = Object.prototype.propertyIsEnumerable;
5
+ var q = (t, s, a) => s in t ? te(t, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[s] = a, E = (t, s) => {
6
+ for (var a in s || (s = {}))
7
+ A.call(s, a) && q(t, a, s[a]);
8
+ if ($)
9
+ for (var a of $(s))
10
+ Z.call(s, a) && q(t, a, s[a]);
11
+ return t;
12
+ }, M = (t, s) => ne(t, re(s));
13
+ var I = (t, s) => {
14
+ var a = {};
15
+ for (var i in t)
16
+ A.call(t, i) && s.indexOf(i) < 0 && (a[i] = t[i]);
17
+ if (t != null && $)
18
+ for (var i of $(t))
19
+ s.indexOf(i) < 0 && Z.call(t, i) && (a[i] = t[i]);
20
+ return a;
21
+ };
22
+ var R = (t, s, a) => new Promise((i, m) => {
23
+ var o = (r) => {
24
+ try {
25
+ l(a.next(r));
26
+ } catch (u) {
27
+ m(u);
28
+ }
29
+ }, n = (r) => {
30
+ try {
31
+ l(a.throw(r));
32
+ } catch (u) {
33
+ m(u);
34
+ }
35
+ }, l = (r) => r.done ? i(r.value) : Promise.resolve(r.value).then(o, n);
36
+ l((a = a.apply(t, s)).next());
37
+ });
38
+ import e from "react";
39
+ import { normalizeUrl as ae, getBlockIcon as oe, getBlockTitle as U, isUrl as se, formatNotionDateTime as ie, formatDate as z, parsePageId as B, getBlockParentPage as le, getPageBreadcrumbs as ce, defaultMapImageUrl as Y, defaultMapPageUrl as X, getTextContent as ue } from "@texonom/nutils";
40
+ import { useHotkeys as W } from "react-hotkeys-hook";
41
+ import { g as me } from "./_commonjsHelpers-ByYUsBRP.js";
42
+ function pe(t) {
43
+ return /* @__PURE__ */ e.createElement("svg", E({ viewBox: "0 0 14 14" }, t), /* @__PURE__ */ e.createElement("path", { d: "M5.5 12L14 3.5 12.5 2l-7 7-4-4.003L0 6.499z" }));
44
+ }
45
+ const fe = ({ isChecked: t }) => {
46
+ let s = null;
47
+ return t ? s = /* @__PURE__ */ e.createElement("div", { className: "notion-property-checkbox-checked" }, /* @__PURE__ */ e.createElement(pe, null)) : s = /* @__PURE__ */ e.createElement("div", { className: "notion-property-checkbox-unchecked" }), /* @__PURE__ */ e.createElement("span", { className: "notion-property notion-property-checkbox" }, s);
48
+ }, J = (t) => {
49
+ const i = t, { className: s } = i, a = I(i, ["className"]);
50
+ return /* @__PURE__ */ e.createElement("svg", E({ className: `notion-icon ${s || ""}`, viewBox: "0 0 17 17" }, a), /* @__PURE__ */ e.createElement("path", { d: "M6.78027 13.6729C8.24805 13.6729 9.60156 13.1982 10.709 12.4072L14.875 16.5732C15.0684 16.7666 15.3232 16.8633 15.5957 16.8633C16.167 16.8633 16.5713 16.4238 16.5713 15.8613C16.5713 15.5977 16.4834 15.3516 16.29 15.1582L12.1504 11.0098C13.0205 9.86719 13.5391 8.45215 13.5391 6.91406C13.5391 3.19629 10.498 0.155273 6.78027 0.155273C3.0625 0.155273 0.0214844 3.19629 0.0214844 6.91406C0.0214844 10.6318 3.0625 13.6729 6.78027 13.6729ZM6.78027 12.2139C3.87988 12.2139 1.48047 9.81445 1.48047 6.91406C1.48047 4.01367 3.87988 1.61426 6.78027 1.61426C9.68066 1.61426 12.0801 4.01367 12.0801 6.91406C12.0801 9.81445 9.68066 12.2139 6.78027 12.2139Z" }));
51
+ }, de = (t) => {
52
+ const i = t, { className: s } = i, a = I(i, ["className"]);
53
+ return /* @__PURE__ */ e.createElement("svg", M(E({ className: s }, a), { viewBox: "0 0 30 30", width: "16" }), /* @__PURE__ */ e.createElement("path", { d: "M16,1H4v28h22V11L16,1z M16,3.828L23.172,11H16V3.828z M24,27H6V3h8v10h10V27z M8,17h14v-2H8V17z M8,21h14v-2H8V21z M8,25h14v-2H8V25z" }));
54
+ }, ge = (t) => {
55
+ const s = [];
56
+ let a, i = -1;
57
+ return Object.keys(t).forEach((m) => {
58
+ var n, l;
59
+ const o = (n = t[m]) == null ? void 0 : n.value;
60
+ o && ((l = o.content) == null || l.forEach((r) => {
61
+ var p, c;
62
+ const u = (c = (p = t[r]) == null ? void 0 : p.value) == null ? void 0 : c.type;
63
+ u && u !== a && (i++, a = u, s[i] = []), i > -1 && s[i].push(r);
64
+ })), a = void 0;
65
+ }), s;
66
+ }, at = (t, s) => {
67
+ const i = ge(s).find((m) => m.includes(t));
68
+ if (i)
69
+ return i.indexOf(t) + 1;
70
+ }, he = (t) => t.includes("#") ? t.replace(/^.+(#.+)$/, "$1") : "", ot = typeof window != "undefined", Ee = /* @__PURE__ */ new Set([
71
+ "youtu.be",
72
+ "youtube.com",
73
+ "www.youtube.com",
74
+ "youtube-nocookie.com",
75
+ "www.youtube-nocookie.com"
76
+ ]), ye = (t) => {
77
+ try {
78
+ const { hostname: s } = new URL(t);
79
+ if (!Ee.has(s)) return null;
80
+ const a = /^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/i, i = t.match(a);
81
+ if (i && i[2].length == 11) return i[2];
82
+ } catch (s) {
83
+ }
84
+ return null;
85
+ }, V = (u) => {
86
+ var p = u, { src: t, alt: s, className: a, style: i, zoomable: m = !1, priority: o = !1, height: n, onError: l } = p, r = I(p, ["src", "alt", "className", "style", "zoomable", "priority", "height", "onError"]);
87
+ var g, y, C;
88
+ const { recordMap: c, zoom: f, previewImages: v, forceCustomImages: h, components: d } = b(), N = e.useRef(f ? f.clone() : null), _ = v ? (C = (g = c == null ? void 0 : c.preview_images) == null ? void 0 : g[t]) != null ? C : (y = c == null ? void 0 : c.preview_images) == null ? void 0 : y[ae(t)] : null, k = e.useCallback(
89
+ (x) => {
90
+ m && (x.target.src || x.target.srcset) && N.current && N.current.attach(x.target);
91
+ },
92
+ [N, m]
93
+ ), S = e.useCallback(
94
+ (x) => {
95
+ N.current && x && N.current.attach(x);
96
+ },
97
+ [N]
98
+ ), w = e.useMemo(() => m ? S : void 0, [m, S]);
99
+ return _ && d.Image ? /* @__PURE__ */ e.createElement(
100
+ d.Image,
101
+ {
102
+ src: t,
103
+ alt: s,
104
+ style: i,
105
+ className: a,
106
+ width: _.originalWidth,
107
+ height: _.originalHeight,
108
+ blurDataURL: _.dataURIBase64,
109
+ placeholder: "blur",
110
+ priority: o,
111
+ onLoad: k
112
+ }
113
+ ) : d.Image && h ? /* @__PURE__ */ e.createElement(
114
+ d.Image,
115
+ {
116
+ src: t,
117
+ alt: s,
118
+ className: a,
119
+ style: i,
120
+ width: null,
121
+ height: n || null,
122
+ priority: o,
123
+ onLoad: k
124
+ }
125
+ ) : /* @__PURE__ */ e.createElement(
126
+ "img",
127
+ E({
128
+ className: a,
129
+ style: i,
130
+ src: t,
131
+ alt: s,
132
+ ref: w,
133
+ loading: "lazy",
134
+ decoding: "async",
135
+ onError: l
136
+ }, r)
137
+ );
138
+ }, ve = (t) => t.type === "page" || t.type === "callout" || t.type === "collection_view" || t.type === "collection_view_page", Ce = ({ block: t, className: s, inline: a = !0, hideDefaultIcon: i = !1, defaultIcon: m }) => {
139
+ var p;
140
+ const { mapImageUrl: o, recordMap: n, darkMode: l } = b();
141
+ let r = !1, u = null;
142
+ if (ve(t)) {
143
+ const c = ((p = oe(t, n)) == null ? void 0 : p.trim()) || m, f = U(t, n);
144
+ if (c && se(c)) {
145
+ const v = o(c, t);
146
+ r = !0, u = /* @__PURE__ */ e.createElement(V, { src: v, alt: f || "page icon", className: `${s || ""} notion-page-icon` });
147
+ } else if (c && c.startsWith("/icons/")) {
148
+ const v = "https://www.notion.so" + c + "?mode=" + (l ? "dark" : "light");
149
+ u = /* @__PURE__ */ e.createElement(V, { src: v, alt: f || "page icon", className: `${s || ""} notion-page-icon` });
150
+ } else c ? (r = !1, u = /* @__PURE__ */ e.createElement("span", { className: `${s || ""} notion-page-icon`, role: "img", "aria-label": c }, c)) : i || (r = !0, u = /* @__PURE__ */ e.createElement(de, { className: `${s || ""} notion-page-icon`, alt: f || "page icon" }));
151
+ }
152
+ return u ? /* @__PURE__ */ e.createElement(
153
+ "div",
154
+ {
155
+ className: `
156
+ ${a ? "notion-page-icon-inline" : "notion-page-icon-hero"}
157
+ ${r ? "notion-page-icon-image" : "notion-page-icon-span"}
158
+ `
159
+ },
160
+ u
161
+ ) : null;
162
+ }, j = e.memo(Ce), we = (t) => {
163
+ const i = t, { className: s } = i, a = I(i, ["className"]);
164
+ return /* @__PURE__ */ e.createElement("svg", M(E({ className: `notion-icon ${s || ""}` }, a), { viewBox: "0 0 30 30" }), /* @__PURE__ */ e.createElement("path", { d: "M15,0C6.716,0,0,6.716,0,15s6.716,15,15,15s15-6.716,15-15S23.284,0,15,0z M22,20.6L20.6,22L15,16.4L9.4,22L8,20.6l5.6-5.6 L8,9.4L9.4,8l5.6,5.6L20.6,8L22,9.4L16.4,15L22,20.6z" }));
165
+ }, Ne = (t) => {
166
+ const i = t, { className: s } = i, a = I(i, ["className"]);
167
+ return /* @__PURE__ */ e.createElement("svg", M(E({ className: `notion-icon ${s || ""}` }, a), { viewBox: "0 0 24 24" }), /* @__PURE__ */ e.createElement("defs", null, /* @__PURE__ */ e.createElement("linearGradient", { x1: "28.1542969%", y1: "63.7402344%", x2: "74.6289062%", y2: "17.7832031%", id: "linearGradient-1" }, /* @__PURE__ */ e.createElement("stop", { stopColor: "rgba(164, 164, 164, 1)", offset: "0%" }), /* @__PURE__ */ e.createElement("stop", { stopColor: "rgba(164, 164, 164, 0)", stopOpacity: "0", offset: "100%" }))), /* @__PURE__ */ e.createElement("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none" }, /* @__PURE__ */ e.createElement("g", { transform: "translate(-236.000000, -286.000000)" }, /* @__PURE__ */ e.createElement("g", { transform: "translate(238.000000, 286.000000)" }, /* @__PURE__ */ e.createElement("circle", { id: "Oval-2", stroke: "url(#linearGradient-1)", strokeWidth: "4", cx: "10", cy: "12", r: "10" }), /* @__PURE__ */ e.createElement("path", { d: "M10,2 C4.4771525,2 0,6.4771525 0,12", id: "Oval-2", stroke: "rgba(164, 164, 164, 1)", strokeWidth: "4" }), /* @__PURE__ */ e.createElement("rect", { id: "Rectangle-1", fill: "rgba(164, 164, 164, 1)", x: "8", y: "0", width: "4", height: "4", rx: "8" })))));
168
+ };
169
+ function xe(t) {
170
+ return /* @__PURE__ */ e.createElement("svg", E({ viewBox: "0 0 260 260" }, t), /* @__PURE__ */ e.createElement("g", null, /* @__PURE__ */ e.createElement(
171
+ "path",
172
+ {
173
+ d: "M128.00106,0 C57.3172926,0 0,57.3066942 0,128.00106 C0,184.555281 36.6761997,232.535542 87.534937,249.460899 C93.9320223,250.645779 96.280588,246.684165 96.280588,243.303333 C96.280588,240.251045 96.1618878,230.167899 96.106777,219.472176 C60.4967585,227.215235 52.9826207,204.369712 52.9826207,204.369712 C47.1599584,189.574598 38.770408,185.640538 38.770408,185.640538 C27.1568785,177.696113 39.6458206,177.859325 39.6458206,177.859325 C52.4993419,178.762293 59.267365,191.04987 59.267365,191.04987 C70.6837675,210.618423 89.2115753,204.961093 96.5158685,201.690482 C97.6647155,193.417512 100.981959,187.77078 104.642583,184.574357 C76.211799,181.33766 46.324819,170.362144 46.324819,121.315702 C46.324819,107.340889 51.3250588,95.9223682 59.5132437,86.9583937 C58.1842268,83.7344152 53.8029229,70.715562 60.7532354,53.0843636 C60.7532354,53.0843636 71.5019501,49.6441813 95.9626412,66.2049595 C106.172967,63.368876 117.123047,61.9465949 128.00106,61.8978432 C138.879073,61.9465949 149.837632,63.368876 160.067033,66.2049595 C184.49805,49.6441813 195.231926,53.0843636 195.231926,53.0843636 C202.199197,70.715562 197.815773,83.7344152 196.486756,86.9583937 C204.694018,95.9223682 209.660343,107.340889 209.660343,121.315702 C209.660343,170.478725 179.716133,181.303747 151.213281,184.472614 C155.80443,188.444828 159.895342,196.234518 159.895342,208.176593 C159.895342,225.303317 159.746968,239.087361 159.746968,243.303333 C159.746968,246.709601 162.05102,250.70089 168.53925,249.443941 C219.370432,232.499507 256,184.536204 256,128.00106 C256,57.3066942 198.691187,0 128.00106,0 Z M47.9405593,182.340212 C47.6586465,182.976105 46.6581745,183.166873 45.7467277,182.730227 C44.8183235,182.312656 44.2968914,181.445722 44.5978808,180.80771 C44.8734344,180.152739 45.876026,179.97045 46.8023103,180.409216 C47.7328342,180.826786 48.2627451,181.702199 47.9405593,182.340212 Z M54.2367892,187.958254 C53.6263318,188.524199 52.4329723,188.261363 51.6232682,187.366874 C50.7860088,186.474504 50.6291553,185.281144 51.2480912,184.70672 C51.8776254,184.140775 53.0349512,184.405731 53.8743302,185.298101 C54.7115892,186.201069 54.8748019,187.38595 54.2367892,187.958254 Z M58.5562413,195.146347 C57.7719732,195.691096 56.4895886,195.180261 55.6968417,194.042013 C54.9125733,192.903764 54.9125733,191.538713 55.713799,190.991845 C56.5086651,190.444977 57.7719732,190.936735 58.5753181,192.066505 C59.3574669,193.22383 59.3574669,194.58888 58.5562413,195.146347 Z M65.8613592,203.471174 C65.1597571,204.244846 63.6654083,204.03712 62.5716717,202.981538 C61.4524999,201.94927 61.1409122,200.484596 61.8446341,199.710926 C62.5547146,198.935137 64.0575422,199.15346 65.1597571,200.200564 C66.2704506,201.230712 66.6095936,202.705984 65.8613592,203.471174 Z M75.3025151,206.281542 C74.9930474,207.284134 73.553809,207.739857 72.1039724,207.313809 C70.6562556,206.875043 69.7087748,205.700761 70.0012857,204.687571 C70.302275,203.678621 71.7478721,203.20382 73.2083069,203.659543 C74.6539041,204.09619 75.6035048,205.261994 75.3025151,206.281542 Z M86.046947,207.473627 C86.0829806,208.529209 84.8535871,209.404622 83.3316829,209.4237 C81.8013,209.457614 80.563428,208.603398 80.5464708,207.564772 C80.5464708,206.498591 81.7483088,205.631657 83.2786917,205.606221 C84.8005962,205.576546 86.046947,206.424403 86.046947,207.473627 Z M96.6021471,207.069023 C96.7844366,208.099171 95.7267341,209.156872 94.215428,209.438785 C92.7295577,209.710099 91.3539086,209.074206 91.1652603,208.052538 C90.9808515,206.996955 92.0576306,205.939253 93.5413813,205.66582 C95.054807,205.402984 96.4092596,206.021919 96.6021471,207.069023 Z",
174
+ fill: "#161614"
175
+ }
176
+ )));
177
+ }
178
+ const ke = ({ block: t, inline: s, className: a }) => {
179
+ var f, v, h;
180
+ const { components: i } = b(), { original_url: m, attributes: o, domain: n } = (t == null ? void 0 : t.format) || {};
181
+ if (!m || !o) return null;
182
+ const l = (f = o.find((d) => d.id === "title")) == null ? void 0 : f.values[0];
183
+ let r = (v = o.find((d) => d.id === "owner")) == null ? void 0 : v.values[0];
184
+ const u = (h = o.find((d) => d.id === "updated_at")) == null ? void 0 : h.values[0], p = u ? ie(u) : null;
185
+ let c;
186
+ switch (n) {
187
+ case "github.com":
188
+ if (c = /* @__PURE__ */ e.createElement(xe, null), r) {
189
+ const d = r.split("/");
190
+ r = d[d.length - 1];
191
+ }
192
+ break;
193
+ default:
194
+ return process.env.NODE_ENV !== "production" && console.debug(`Unsupported external_object_instance domain "${n}"`, JSON.stringify(t, null, 2)), null;
195
+ }
196
+ return /* @__PURE__ */ e.createElement(
197
+ i.Link,
198
+ {
199
+ target: "_blank",
200
+ rel: "noopener noreferrer",
201
+ href: m,
202
+ className: `notion-external ${s ? "notion-external-mention" : "notion-external-block notion-row"} ${a || ""}`
203
+ },
204
+ c && /* @__PURE__ */ e.createElement("div", { className: "notion-external-image" }, c),
205
+ /* @__PURE__ */ e.createElement("div", { className: "notion-external-description" }, /* @__PURE__ */ e.createElement("div", { className: "notion-external-title" }, l), (r || p) && /* @__PURE__ */ e.createElement("div", { className: "notion-external-subtitle" }, r && /* @__PURE__ */ e.createElement("span", null, r), r && p && /* @__PURE__ */ e.createElement("span", null, " • "), p && /* @__PURE__ */ e.createElement("span", null, "Updated ", p)))
206
+ );
207
+ }, G = (t) => /* @__PURE__ */ e.createElement("img", E({ loading: "lazy" }, t)), D = ({ value: t, block: s, linkProps: a, linkProtocol: i }) => {
208
+ const { components: m, recordMap: o, mapPageUrl: n, mapImageUrl: l, rootDomain: r } = b();
209
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, t == null ? void 0 : t.map((u, p) => {
210
+ const [c, f] = u;
211
+ if (!f)
212
+ return c === "," ? /* @__PURE__ */ e.createElement("span", { key: p, style: { padding: "0.5em" } }) : /* @__PURE__ */ e.createElement(e.Fragment, { key: p }, c);
213
+ const v = f.reduce(
214
+ (h, d) => {
215
+ var N, _, k, S, w;
216
+ switch (d[0]) {
217
+ case "p": {
218
+ const g = d[1], y = (N = o.block[g]) == null ? void 0 : N.value;
219
+ return y ? /* @__PURE__ */ e.createElement(m.PageLink, { className: "notion-link", href: n(g) }, /* @__PURE__ */ e.createElement(F, { block: y })) : (console.debug('"p" missing block', g), null);
220
+ }
221
+ case "‣": {
222
+ const g = d[1][0], y = d[1][1];
223
+ switch (g) {
224
+ case "u": {
225
+ const C = (_ = o.notion_user[y]) == null ? void 0 : _.value;
226
+ if (!C)
227
+ return console.debug('"‣" missing user', y), null;
228
+ const x = [C.given_name, C.family_name].filter(Boolean).join(" "), P = C.email;
229
+ return /* @__PURE__ */ e.createElement(m.Link, E({ className: "notion-link", href: `mailto:${P}` }, a), /* @__PURE__ */ e.createElement(
230
+ G,
231
+ {
232
+ className: "notion-user",
233
+ src: l(C.profile_photo, s),
234
+ alt: x,
235
+ style: { display: "inline", marginRight: "0.3em", marginBottom: "0.3em" }
236
+ }
237
+ ), x);
238
+ }
239
+ default: {
240
+ const C = (k = o.block[y]) == null ? void 0 : k.value;
241
+ return C ? /* @__PURE__ */ e.createElement(
242
+ m.PageLink,
243
+ M(E({
244
+ className: "notion-link",
245
+ href: n(y)
246
+ }, a), {
247
+ target: "_blank",
248
+ rel: "noopener noreferrer"
249
+ }),
250
+ /* @__PURE__ */ e.createElement(F, { block: C })
251
+ ) : (console.debug('"‣" missing block', g, y), null);
252
+ }
253
+ }
254
+ }
255
+ case "h":
256
+ return /* @__PURE__ */ e.createElement("span", { className: `notion-${d[1]}` }, h);
257
+ case "c":
258
+ return /* @__PURE__ */ e.createElement("code", { className: "notion-inline-code" }, h);
259
+ case "b":
260
+ return /* @__PURE__ */ e.createElement("b", null, h);
261
+ case "i":
262
+ return /* @__PURE__ */ e.createElement("em", null, h);
263
+ case "s":
264
+ return /* @__PURE__ */ e.createElement("s", null, h);
265
+ case "_":
266
+ return /* @__PURE__ */ e.createElement("span", { className: "notion-inline-underscore" }, h);
267
+ case "e":
268
+ return /* @__PURE__ */ e.createElement(m.Equation, { math: d[1], inline: !0 });
269
+ case "m":
270
+ return h;
271
+ //still need to return the base element
272
+ case "a": {
273
+ const g = d[1], y = g.substring(1), C = B(y, { uuid: !0 });
274
+ if ((g[0] === "/" || g.includes(r)) && C) {
275
+ const x = g.includes(r) ? g : `${n(C)}${he(g)}`;
276
+ return /* @__PURE__ */ e.createElement(m.PageLink, E({ className: "notion-link", href: x }, a), h);
277
+ } else
278
+ return /* @__PURE__ */ e.createElement(
279
+ m.Link,
280
+ E({
281
+ className: "notion-link",
282
+ href: i ? `${i}:${d[1]}` : d[1]
283
+ }, a),
284
+ h
285
+ );
286
+ }
287
+ // Date
288
+ case "d": {
289
+ const g = d[1], y = g == null ? void 0 : g.type;
290
+ if (y === "date") {
291
+ const C = g.start_date;
292
+ return z(C);
293
+ } else if (y === "daterange") {
294
+ const C = g.start_date, x = g.end_date;
295
+ return `${z(C)} → ${z(x)}`;
296
+ } else
297
+ return h;
298
+ }
299
+ // User
300
+ case "u": {
301
+ const g = d[1], y = (S = o.notion_user[g]) == null ? void 0 : S.value;
302
+ if (!y)
303
+ return console.debug("missing user", g), null;
304
+ const C = y.name, x = y.email;
305
+ return /* @__PURE__ */ e.createElement(m.Link, E({ className: "notion-link", href: `mailto:${x}` }, a), /* @__PURE__ */ e.createElement(
306
+ G,
307
+ {
308
+ className: "notion-user",
309
+ src: l(y.profile_photo, s),
310
+ alt: C,
311
+ style: { display: "inline", marginRight: "0.3em", marginBottom: "0.3em" }
312
+ }
313
+ ), C);
314
+ }
315
+ case "eoi": {
316
+ const g = d[1], y = (w = o.block[g]) == null ? void 0 : w.value;
317
+ return /* @__PURE__ */ e.createElement(ke, { block: y, inline: !0 });
318
+ }
319
+ default:
320
+ return process.env.NODE_ENV !== "production" && console.debug("unsupported text format", d), h;
321
+ }
322
+ },
323
+ /* @__PURE__ */ e.createElement(e.Fragment, null, c)
324
+ );
325
+ return /* @__PURE__ */ e.createElement(e.Fragment, { key: p }, v);
326
+ }));
327
+ }, _e = (m) => {
328
+ var o = m, { block: t, className: s, defaultIcon: a } = o, i = I(o, ["block", "className", "defaultIcon"]);
329
+ var l, r;
330
+ const { recordMap: n } = b();
331
+ if (!t) return null;
332
+ if (t.type === "collection_view_page" || t.type === "collection_view") {
333
+ const u = U(t, n);
334
+ if (!u) return null;
335
+ const p = [[u]];
336
+ return /* @__PURE__ */ e.createElement("span", E({ className: `notion-page-title ${s || ""}` }, i), /* @__PURE__ */ e.createElement(j, { block: t, defaultIcon: a, className: "notion-page-title-icon" }), /* @__PURE__ */ e.createElement("span", { className: "notion-page-title-text" }, /* @__PURE__ */ e.createElement(D, { value: p, block: t })));
337
+ }
338
+ return (l = t.properties) != null && l.title ? /* @__PURE__ */ e.createElement("span", E({ className: `notion-page-title ${s || ""}` }, i), /* @__PURE__ */ e.createElement(j, { block: t, defaultIcon: a, className: "notion-page-title-icon" }), /* @__PURE__ */ e.createElement("span", { className: "notion-page-title-text" }, /* @__PURE__ */ e.createElement(D, { value: (r = t.properties) == null ? void 0 : r.title, block: t }))) : null;
339
+ }, F = e.memo(_e), Le = (t, s) => {
340
+ let a;
341
+ return (...i) => {
342
+ a && clearTimeout(a), a = setTimeout(() => t(...i), s);
343
+ };
344
+ };
345
+ class Ie extends e.Component {
346
+ constructor(s) {
347
+ super(s), this.state = {
348
+ isLoading: !1,
349
+ query: "",
350
+ searchResult: null,
351
+ searchError: null
352
+ }, this._onAfterOpen = () => {
353
+ this._inputRef.current && this._inputRef.current.focus();
354
+ }, this._onChangeQuery = (a) => {
355
+ const i = a.target.value;
356
+ if (this.setState({ query: i }), i.trim())
357
+ this._search();
358
+ else {
359
+ this.setState({ isLoading: !1, searchResult: null, searchError: null });
360
+ return;
361
+ }
362
+ }, this._onClearQuery = () => {
363
+ this._onChangeQuery({ target: { value: "" } });
364
+ }, this._warmupSearch = () => R(this, null, function* () {
365
+ const { searchNotion: a, rootBlockId: i, rootSpaceId: m } = this.props;
366
+ yield a({
367
+ query: "",
368
+ spaceId: m,
369
+ filters: {
370
+ ancestors: [i],
371
+ isDeletedOnly: !1,
372
+ excludeTemplates: !0,
373
+ navigableBlockContentOnly: !0,
374
+ requireEditPermissions: !1
375
+ }
376
+ });
377
+ }), this._searchImpl = () => R(this, null, function* () {
378
+ const { searchNotion: a, rootBlockId: i, rootSpaceId: m } = this.props, { query: o } = this.state;
379
+ if (!o.trim()) {
380
+ this.setState({ isLoading: !1, searchResult: null, searchError: null });
381
+ return;
382
+ }
383
+ this.setState({ isLoading: !0 });
384
+ const n = yield a({
385
+ query: o,
386
+ spaceId: m,
387
+ filters: {
388
+ ancestors: [i],
389
+ isDeletedOnly: !1,
390
+ excludeTemplates: !0,
391
+ navigableBlockContentOnly: !0,
392
+ requireEditPermissions: !1
393
+ }
394
+ });
395
+ console.debug("search", o, n);
396
+ let l = null, r = null;
397
+ if (n.error || n.errorId)
398
+ r = n;
399
+ else {
400
+ l = E({}, n);
401
+ const p = l.results.map((c) => {
402
+ var h, d;
403
+ const f = (h = l.recordMap.block[c.id]) == null ? void 0 : h.value;
404
+ if (!f) return;
405
+ const v = U(f, l.recordMap);
406
+ if (v && (c.title = v, c.block = f, c.recordMap = l.recordMap, c.page = le(f, l.recordMap, {
407
+ inclusive: !0
408
+ }) || f, !!c.page.id))
409
+ return (d = c.highlight) != null && d.text && (c.highlight.html = c.highlight.text.replace(/<gzkNfoUU>/gi, "<b>").replace(/<\/gzkNfoUU>/gi, "</b>")), c;
410
+ }).filter(Boolean).reduce(
411
+ (c, f) => M(E({}, c), {
412
+ [f.page.id]: f
413
+ }),
414
+ {}
415
+ );
416
+ l.results = Object.values(p);
417
+ }
418
+ this.state.query === o && this.setState({ isLoading: !1, searchResult: l, searchError: r });
419
+ }), this._inputRef = e.createRef();
420
+ }
421
+ componentDidMount() {
422
+ this._search = Le(this._searchImpl.bind(this), 500), this._warmupSearch();
423
+ }
424
+ render() {
425
+ const { isOpen: s, onClose: a } = this.props, { isLoading: i, query: m, searchResult: o, searchError: n } = this.state, l = !!m.trim();
426
+ return /* @__PURE__ */ e.createElement(He, null, (r) => {
427
+ const { components: u, defaultPageIcon: p, mapPageUrl: c } = r;
428
+ return /* @__PURE__ */ e.createElement(
429
+ u.Modal,
430
+ {
431
+ isOpen: s,
432
+ contentLabel: "Search",
433
+ className: "notion-search",
434
+ overlayClassName: "notion-search-overlay",
435
+ onRequestClose: a,
436
+ onAfterOpen: this._onAfterOpen
437
+ },
438
+ /* @__PURE__ */ e.createElement("div", { className: "quickFindMenu" }, /* @__PURE__ */ e.createElement("div", { className: "searchBar" }, /* @__PURE__ */ e.createElement("div", { className: "inlineIcon" }, i ? /* @__PURE__ */ e.createElement(Ne, { className: "loadingIcon" }) : /* @__PURE__ */ e.createElement(J, null)), /* @__PURE__ */ e.createElement(
439
+ "input",
440
+ {
441
+ className: "searchInput",
442
+ placeholder: "Search",
443
+ value: m,
444
+ ref: this._inputRef,
445
+ onInput: this._onChangeQuery
446
+ }
447
+ ), m && /* @__PURE__ */ e.createElement("div", { role: "button", className: "clearButton", onClick: this._onClearQuery }, /* @__PURE__ */ e.createElement(we, { className: "clearIcon" }))), l && o && /* @__PURE__ */ e.createElement(e.Fragment, null, o.results.length ? /* @__PURE__ */ e.createElement(Ue, M(E({}, r), { recordMap: o.recordMap }), /* @__PURE__ */ e.createElement("div", { className: "resultsPane" }, o.results.map((f) => {
448
+ var v;
449
+ return /* @__PURE__ */ e.createElement(
450
+ u.PageLink,
451
+ {
452
+ key: f.id,
453
+ className: "result notion-page-link",
454
+ href: c(f.page.id, o.recordMap)
455
+ },
456
+ /* @__PURE__ */ e.createElement(F, { block: f.page, defaultIcon: p }),
457
+ ((v = f.highlight) == null ? void 0 : v.html) && /* @__PURE__ */ e.createElement(
458
+ "div",
459
+ {
460
+ className: "notion-search-result-highlight",
461
+ dangerouslySetInnerHTML: {
462
+ __html: f.highlight.html
463
+ }
464
+ }
465
+ )
466
+ );
467
+ })), /* @__PURE__ */ e.createElement("footer", { className: "resultsFooter" }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("span", { className: "resultsCount" }, o.total), o.total === 1 ? " result" : " results"))) : /* @__PURE__ */ e.createElement("div", { className: "noResultsPane" }, /* @__PURE__ */ e.createElement("div", { className: "noResults" }, "No results"), /* @__PURE__ */ e.createElement("div", { className: "noResultsDetail" }, "Try different search terms"))), l && !o && n && /* @__PURE__ */ e.createElement("div", { className: "noResultsPane" }, /* @__PURE__ */ e.createElement("div", { className: "noResults" }, "Search error")))
468
+ );
469
+ });
470
+ }
471
+ }
472
+ const Se = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { className: "notion-header" }, /* @__PURE__ */ e.createElement("div", { className: "notion-nav-header" }, /* @__PURE__ */ e.createElement(be, { block: t }), /* @__PURE__ */ e.createElement(Me, { block: t }))), be = ({ block: t, rootOnly: s = !1 }) => {
473
+ const { recordMap: a, mapPageUrl: i, components: m } = b(), o = e.useMemo(() => {
474
+ const n = ce(a, t.id);
475
+ return s ? [n[0]].filter(Boolean) : n;
476
+ }, [a, t.id, s]);
477
+ return /* @__PURE__ */ e.createElement("div", { className: "breadcrumbs", key: "breadcrumbs" }, o.map((n, l) => {
478
+ if (!n) return null;
479
+ const r = {}, u = {
480
+ pageLink: m.PageLink
481
+ };
482
+ return n.active ? u.pageLink = (p) => /* @__PURE__ */ e.createElement("div", E({}, p)) : r.href = i(n.pageId), /* @__PURE__ */ e.createElement(e.Fragment, { key: n.pageId }, /* @__PURE__ */ e.createElement(u.pageLink, E({ className: `breadcrumb ${n.active && "active"}` }, r), n.icon && /* @__PURE__ */ e.createElement(j, { className: "icon", block: n.block }), n.title && /* @__PURE__ */ e.createElement("span", { className: "title" }, n.title)), l < o.length - 1 && /* @__PURE__ */ e.createElement("span", { className: "spacer" }, "/"));
483
+ }));
484
+ }, Me = ({ block: t, search: s, title: a = "Search" }) => {
485
+ const { searchNotion: i, rootPageId: m, isShowingSearch: o, onHideSearch: n, rootSpaceId: l } = b(), r = s || i, [u, p] = e.useState(o);
486
+ e.useEffect(() => {
487
+ p(o);
488
+ }, [o]);
489
+ const c = e.useCallback(() => {
490
+ p(!0);
491
+ }, []), f = e.useCallback(() => {
492
+ p(!1), n && n();
493
+ }, [n]);
494
+ W("cmd+p", (h) => {
495
+ c(), h.preventDefault(), h.stopPropagation();
496
+ }), W("cmd+k", (h) => {
497
+ c(), h.preventDefault(), h.stopPropagation();
498
+ });
499
+ const v = !!r;
500
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, v && /* @__PURE__ */ e.createElement("div", { role: "button", className: "breadcrumb button notion-search-button", onClick: c }, /* @__PURE__ */ e.createElement(J, { className: "searchIcon" }), a && /* @__PURE__ */ e.createElement("span", { className: "title" }, a)), u && v && /* @__PURE__ */ e.createElement(
501
+ Ie,
502
+ {
503
+ isOpen: u,
504
+ rootBlockId: m || (t == null ? void 0 : t.id),
505
+ rootSpaceId: l,
506
+ onClose: f,
507
+ searchNotion: r
508
+ }
509
+ ));
510
+ };
511
+ var T, Q;
512
+ function Pe() {
513
+ if (Q) return T;
514
+ Q = 1;
515
+ var t = typeof Element != "undefined", s = typeof Map == "function", a = typeof Set == "function", i = typeof ArrayBuffer == "function" && !!ArrayBuffer.isView;
516
+ function m(o, n) {
517
+ if (o === n) return !0;
518
+ if (o && n && typeof o == "object" && typeof n == "object") {
519
+ if (o.constructor !== n.constructor) return !1;
520
+ var l, r, u;
521
+ if (Array.isArray(o)) {
522
+ if (l = o.length, l != n.length) return !1;
523
+ for (r = l; r-- !== 0; )
524
+ if (!m(o[r], n[r])) return !1;
525
+ return !0;
526
+ }
527
+ var p;
528
+ if (s && o instanceof Map && n instanceof Map) {
529
+ if (o.size !== n.size) return !1;
530
+ for (p = o.entries(); !(r = p.next()).done; )
531
+ if (!n.has(r.value[0])) return !1;
532
+ for (p = o.entries(); !(r = p.next()).done; )
533
+ if (!m(r.value[1], n.get(r.value[0]))) return !1;
534
+ return !0;
535
+ }
536
+ if (a && o instanceof Set && n instanceof Set) {
537
+ if (o.size !== n.size) return !1;
538
+ for (p = o.entries(); !(r = p.next()).done; )
539
+ if (!n.has(r.value[0])) return !1;
540
+ return !0;
541
+ }
542
+ if (i && ArrayBuffer.isView(o) && ArrayBuffer.isView(n)) {
543
+ if (l = o.length, l != n.length) return !1;
544
+ for (r = l; r-- !== 0; )
545
+ if (o[r] !== n[r]) return !1;
546
+ return !0;
547
+ }
548
+ if (o.constructor === RegExp) return o.source === n.source && o.flags === n.flags;
549
+ if (o.valueOf !== Object.prototype.valueOf && typeof o.valueOf == "function" && typeof n.valueOf == "function") return o.valueOf() === n.valueOf();
550
+ if (o.toString !== Object.prototype.toString && typeof o.toString == "function" && typeof n.toString == "function") return o.toString() === n.toString();
551
+ if (u = Object.keys(o), l = u.length, l !== Object.keys(n).length) return !1;
552
+ for (r = l; r-- !== 0; )
553
+ if (!Object.prototype.hasOwnProperty.call(n, u[r])) return !1;
554
+ if (t && o instanceof Element) return !1;
555
+ for (r = l; r-- !== 0; )
556
+ if (!((u[r] === "_owner" || u[r] === "__v" || u[r] === "__o") && o.$$typeof) && !m(o[u[r]], n[u[r]]))
557
+ return !1;
558
+ return !0;
559
+ }
560
+ return o !== o && n !== n;
561
+ }
562
+ return T = function(n, l) {
563
+ try {
564
+ return m(n, l);
565
+ } catch (r) {
566
+ if ((r.message || "").match(/stack|recursion/i))
567
+ return console.warn("react-fast-compare cannot handle circular refs"), !1;
568
+ throw r;
569
+ }
570
+ }, T;
571
+ }
572
+ var Oe = Pe();
573
+ const $e = /* @__PURE__ */ me(Oe), Be = (t) => e.memo(function(p) {
574
+ var c = p, {
575
+ src: a,
576
+ alt: i,
577
+ width: m,
578
+ height: o,
579
+ className: n,
580
+ style: l,
581
+ layout: r
582
+ } = c, u = I(c, [
583
+ "src",
584
+ "alt",
585
+ "width",
586
+ "height",
587
+ "className",
588
+ "style",
589
+ "layout"
590
+ ]);
591
+ return r || (r = m && o ? "intrinsic" : "fill"), /* @__PURE__ */ e.createElement(
592
+ t,
593
+ E({
594
+ className: n,
595
+ src: a,
596
+ alt: i,
597
+ width: r === "intrinsic" && m,
598
+ height: r === "intrinsic" && o,
599
+ objectFit: l == null ? void 0 : l.objectFit,
600
+ objectPosition: l == null ? void 0 : l.objectPosition,
601
+ layout: r
602
+ }, u)
603
+ );
604
+ }, $e), Re = (t) => function(v) {
605
+ var h = v, {
606
+ href: a,
607
+ as: i,
608
+ passHref: m,
609
+ prefetch: o,
610
+ replace: n,
611
+ scroll: l,
612
+ shallow: r,
613
+ locale: u,
614
+ className: p,
615
+ style: c
616
+ } = h, f = I(h, [
617
+ "href",
618
+ "as",
619
+ "passHref",
620
+ "prefetch",
621
+ "replace",
622
+ "scroll",
623
+ "shallow",
624
+ "locale",
625
+ "className",
626
+ "style"
627
+ ]);
628
+ return /* @__PURE__ */ e.createElement(
629
+ t,
630
+ E({
631
+ href: a,
632
+ as: i,
633
+ prefetch: o,
634
+ replace: n,
635
+ scroll: l,
636
+ shallow: r,
637
+ locale: u,
638
+ className: p,
639
+ style: c
640
+ }, f)
641
+ );
642
+ }, ze = (t) => /* @__PURE__ */ e.createElement("a", E({ target: "_blank", rel: "noopener noreferrer" }, t)), Te = e.memo(ze), Ve = (a) => {
643
+ var i = a, { href: t } = i, s = I(i, ["href"]);
644
+ var l, r;
645
+ const { recordMap: m, rootSpaceId: o } = b();
646
+ let n = t;
647
+ if (typeof t == "string" && o) {
648
+ const u = B(t);
649
+ if (u) {
650
+ const p = (r = (l = m == null ? void 0 : m.block) == null ? void 0 : l[u]) == null ? void 0 : r.value;
651
+ (!p || p.space_id !== o) && (n = `https://notion.so/${u.replace(/-/g, "")}`);
652
+ }
653
+ }
654
+ return /* @__PURE__ */ e.createElement("a", E({ href: n }, s));
655
+ }, je = e.memo(Ve), De = (t) => /* @__PURE__ */ e.createElement(Ye, E({}, t)), Fe = Se, st = (o) => {
656
+ var n = o, { href: t, rel: s, target: a, title: i } = n, m = I(n, ["href", "rel", "target", "title"]);
657
+ return /* @__PURE__ */ e.createElement("span", E({}, m));
658
+ }, O = (t) => () => (console.warn(`Warning: using empty component "${t}" (you should override this in NotionRenderer.components)`), null), L = (t, s) => s(), K = {
659
+ Image: null,
660
+ // disable custom images by default
661
+ Link: Te,
662
+ PageLink: je,
663
+ Checkbox: fe,
664
+ Callout: void 0,
665
+ // use the built-in callout rendering by default
666
+ Code: O("Code"),
667
+ Equation: O("Equation"),
668
+ Collection: O("Collection"),
669
+ Property: void 0,
670
+ // use the built-in property rendering by default
671
+ propertyTextValue: L,
672
+ propertySelectValue: L,
673
+ propertyRelationValue: L,
674
+ propertyFormulaValue: L,
675
+ propertyTitleValue: L,
676
+ propertyPersonValue: L,
677
+ propertyFileValue: L,
678
+ propertyCheckboxValue: L,
679
+ propertyUrlValue: L,
680
+ propertyEmailValue: L,
681
+ propertyPhoneNumberValue: L,
682
+ propertyNumberValue: L,
683
+ propertyLastEditedTimeValue: L,
684
+ propertyCreatedTimeValue: L,
685
+ propertyDateValue: L,
686
+ Pdf: O("Pdf"),
687
+ Tweet: O("Tweet"),
688
+ Modal: O("Modal"),
689
+ Header: Fe,
690
+ Embed: De
691
+ }, ee = {
692
+ recordMap: {
693
+ block: {},
694
+ collection: {},
695
+ collection_view: {},
696
+ collection_query: {},
697
+ notion_user: {},
698
+ signed_urls: {}
699
+ },
700
+ components: K,
701
+ mapPageUrl: X(),
702
+ mapImageUrl: Y,
703
+ searchNotion: null,
704
+ isShowingSearch: !1,
705
+ onHideSearch: null,
706
+ fullPage: !1,
707
+ darkMode: !1,
708
+ previewImages: !1,
709
+ forceCustomImages: !1,
710
+ showCollectionViewDropdown: !0,
711
+ linkTableTitleProperties: !0,
712
+ isLinkCollectionToUrlProperty: !1,
713
+ showTableOfContents: !1,
714
+ minTableOfContentsItems: 3,
715
+ defaultPageIcon: null,
716
+ defaultPageCover: null,
717
+ defaultPageCoverPosition: 0.5,
718
+ zoom: null
719
+ }, H = e.createContext(ee), Ue = (l) => {
720
+ var r = l, {
721
+ components: t = {},
722
+ children: s,
723
+ mapPageUrl: a,
724
+ mapImageUrl: i,
725
+ rootPageId: m,
726
+ rootSpaceId: o
727
+ } = r, n = I(r, [
728
+ "components",
729
+ "children",
730
+ "mapPageUrl",
731
+ "mapImageUrl",
732
+ "rootPageId",
733
+ "rootSpaceId"
734
+ ]);
735
+ for (const c of Object.keys(n)) n[c] === void 0 && delete n[c];
736
+ const u = e.useMemo(() => {
737
+ const c = E({}, t);
738
+ if (c.nextImage && (c.Image = Be(c.nextImage)), c.nextLink) {
739
+ const f = Re(c.nextLink);
740
+ c.nextLink = f, c.PageLink || (c.PageLink = f), c.Link || (c.Link = f);
741
+ }
742
+ for (const f of Object.keys(c)) c[f] || delete c[f];
743
+ return c;
744
+ }, [t]), p = e.useMemo(
745
+ () => M(E(E({}, ee), n), {
746
+ rootPageId: m,
747
+ rootSpaceId: o,
748
+ mapPageUrl: a != null ? a : X(m),
749
+ mapImageUrl: i != null ? i : Y,
750
+ components: E(E({}, K), u)
751
+ }),
752
+ [i, a, u, m, o, n]
753
+ );
754
+ return /* @__PURE__ */ e.createElement(H.Provider, { value: p }, s);
755
+ }, He = H.Consumer, b = () => e.useContext(H), qe = (t) => Object.keys(t).map((s) => `${encodeURIComponent(s)}=${encodeURIComponent(t[s])}`).join("&"), Ae = ({
756
+ id: t,
757
+ defaultPlay: s = !1,
758
+ mute: a = !1,
759
+ lazyImage: i = !1,
760
+ iframeTitle: m = "YouTube video",
761
+ alt: o = "Video preview",
762
+ params: n = {},
763
+ adLinksPreconnect: l = !0,
764
+ style: r,
765
+ className: u
766
+ }) => {
767
+ const p = a || s ? "1" : "0", c = e.useMemo(() => qe(E({ autoplay: "1", mute: p }, n)), [p, n]), v = `https://i.ytimg.com/vi/${t}/hqdefault.jpg`, h = "https://www.youtube-nocookie.com", d = `${h}/embed/${t}?${c}`, [N, _] = e.useState(!1), [k, S] = e.useState(s), [w, g] = e.useState(!1), y = e.useCallback(() => {
768
+ N || _(!0);
769
+ }, [N]), C = e.useCallback(() => {
770
+ k || S(!0);
771
+ }, [k]), x = e.useCallback(() => {
772
+ g(!0);
773
+ }, []);
774
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("link", { rel: "preload", href: v, as: "image" }), N && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("link", { rel: "preconnect", href: h }), /* @__PURE__ */ e.createElement("link", { rel: "preconnect", href: "https://www.google.com" })), N && l && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("link", { rel: "preconnect", href: "https://static.doubleclick.net" }), /* @__PURE__ */ e.createElement("link", { rel: "preconnect", href: "https://googleads.g.doubleclick.net" })), /* @__PURE__ */ e.createElement(
775
+ "div",
776
+ {
777
+ onClick: C,
778
+ onPointerOver: y,
779
+ className: `notion-yt-lite
780
+ ${w && "notion-yt-loaded"}
781
+ ${k && "notion-yt-initialized"}
782
+ ${u || ""}`,
783
+ style: r
784
+ },
785
+ /* @__PURE__ */ e.createElement("img", { src: v, className: "notion-yt-thumbnail", loading: i ? "lazy" : void 0, alt: o }),
786
+ /* @__PURE__ */ e.createElement("div", { className: "notion-yt-playbtn" }),
787
+ k && /* @__PURE__ */ e.createElement(
788
+ "iframe",
789
+ {
790
+ width: "560",
791
+ height: "315",
792
+ frameBorder: "0",
793
+ allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
794
+ allowFullScreen: !0,
795
+ title: m,
796
+ src: d,
797
+ onLoad: x
798
+ }
799
+ )
800
+ ));
801
+ }, Ze = typeof window == "undefined", We = [
802
+ "video",
803
+ "image",
804
+ "embed",
805
+ "figma",
806
+ "typeform",
807
+ "excalidraw",
808
+ "maps",
809
+ "tweet",
810
+ "pdf",
811
+ "gist",
812
+ "codepen",
813
+ "drive"
814
+ ], Ge = ({ block: t, zoomable: s = !0, children: a }) => {
815
+ var p, c, f, v, h, d, N, _, k, S;
816
+ const { recordMap: i, mapImageUrl: m, components: o } = b();
817
+ if (!t || !We.includes(t.type)) return null;
818
+ const n = {
819
+ position: "relative",
820
+ display: "flex",
821
+ justifyContent: "center",
822
+ alignSelf: "center",
823
+ width: "100%",
824
+ maxWidth: "100%",
825
+ flexDirection: "column"
826
+ }, l = {};
827
+ if (t.format) {
828
+ const { block_aspect_ratio: w, block_height: g, block_width: y, block_full_width: C, block_page_width: x, block_preserve_scale: P } = t.format;
829
+ if (C || x)
830
+ C ? n.width = "100vw" : n.width = "100%", t.type === "video" ? g ? n.height = g : w ? n.paddingBottom = `${w * 100}%` : P && (n.objectFit = "contain") : w && t.type !== "image" ? n.paddingBottom = `${w * 100}%` : g ? n.height = g : P && (t.type === "image" ? n.height = "100%" : (n.paddingBottom = "75%", n.minHeight = 100));
831
+ else {
832
+ switch ((p = t.format) == null ? void 0 : p.block_alignment) {
833
+ case "center": {
834
+ n.alignSelf = "center";
835
+ break;
836
+ }
837
+ case "left": {
838
+ n.alignSelf = "start";
839
+ break;
840
+ }
841
+ case "right": {
842
+ n.alignSelf = "end";
843
+ break;
844
+ }
845
+ }
846
+ y && (n.width = y), P && t.type !== "image" ? (n.paddingBottom = "50%", n.minHeight = 100) : g && t.type !== "image" && (n.height = g);
847
+ }
848
+ t.type === "image" ? l.objectFit = "cover" : P && (l.objectFit = "contain");
849
+ }
850
+ let r = ((c = i.signed_urls) == null ? void 0 : c[t.id]) || ((h = (v = (f = t.properties) == null ? void 0 : f.source) == null ? void 0 : v[0]) == null ? void 0 : h[0]), u = null;
851
+ if (!r) return null;
852
+ if (t.type === "tweet") {
853
+ const w = r;
854
+ if (!w) return null;
855
+ const g = w.split("?")[0].split("/").pop();
856
+ if (!g) return null;
857
+ u = /* @__PURE__ */ e.createElement(
858
+ "div",
859
+ {
860
+ style: M(E({}, l), {
861
+ maxWidth: 420,
862
+ width: "100%",
863
+ marginLeft: "auto",
864
+ marginRight: "auto"
865
+ })
866
+ },
867
+ /* @__PURE__ */ e.createElement(o.Tweet, { id: g })
868
+ );
869
+ } else if (t.type === "pdf")
870
+ n.overflow = "auto", n.background = "rgb(226, 226, 226)", n.display = "block", n.padding || (n.padding = "8px 16px"), Ze || (u = /* @__PURE__ */ e.createElement(o.Pdf, { file: r }));
871
+ else if (t.type === "embed" || t.type === "video" || t.type === "figma" || t.type === "typeform" || t.type === "gist" || t.type === "maps" || t.type === "excalidraw" || t.type === "codepen" || t.type === "drive")
872
+ if (t.type === "video" && r && r.indexOf("youtube") < 0 && r.indexOf("youtu.be") < 0 && r.indexOf("vimeo") < 0 && r.indexOf("wistia") < 0 && r.indexOf("loom") < 0 && r.indexOf("videoask") < 0 && r.indexOf("getcloudapp") < 0)
873
+ n.paddingBottom = void 0, u = /* @__PURE__ */ e.createElement("video", { playsInline: !0, controls: !0, preload: "metadata", style: l, src: r, title: t.type });
874
+ else {
875
+ let w = ((d = t.format) == null ? void 0 : d.display_source) || r;
876
+ if (w) {
877
+ const g = t.type === "video" ? ye(w) : null;
878
+ g ? u = /* @__PURE__ */ e.createElement(Ae, { id: g, style: l, className: "notion-asset-object-fit" }) : t.type === "gist" ? (w.endsWith(".pibb") || (w = `${w}.pibb`), l.width = "100%", n.paddingBottom = "50%", u = /* @__PURE__ */ e.createElement(
879
+ "iframe",
880
+ {
881
+ style: l,
882
+ className: "notion-asset-object-fit",
883
+ src: w,
884
+ title: "GitHub Gist",
885
+ frameBorder: "0",
886
+ loading: "lazy",
887
+ scrolling: "auto"
888
+ }
889
+ )) : u = /* @__PURE__ */ e.createElement(
890
+ "iframe",
891
+ {
892
+ className: "notion-asset-object-fit",
893
+ style: l,
894
+ src: w,
895
+ title: `iframe ${t.type}`,
896
+ frameBorder: "0",
897
+ allowFullScreen: !0,
898
+ loading: "lazy",
899
+ scrolling: "auto"
900
+ }
901
+ );
902
+ }
903
+ }
904
+ else if (t.type === "image") {
905
+ r.includes("file.notion.so") && (r = (k = (_ = (N = t.properties) == null ? void 0 : N.source) == null ? void 0 : _[0]) == null ? void 0 : k[0]);
906
+ const w = m(r, t), y = ue((S = t.properties) == null ? void 0 : S.caption) || "notion image";
907
+ u = /* @__PURE__ */ e.createElement(V, { src: w, alt: y, zoomable: s, height: n.height, style: l });
908
+ }
909
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: n }, u, t.type === "image" && a), t.type !== "image" && a);
910
+ }, Qe = { width: "100%" }, Ye = ({ blockId: t, block: s }) => {
911
+ var u, p, c, f, v, h;
912
+ const a = s, { components: i, mapPageUrl: m, rootDomain: o, zoom: n } = b();
913
+ let l = !1;
914
+ if (s.type === "image") {
915
+ const d = (c = (p = (u = a == null ? void 0 : a.properties) == null ? void 0 : u.caption) == null ? void 0 : p[0]) == null ? void 0 : c[0];
916
+ if (d) {
917
+ const N = B(d, { uuid: !0 });
918
+ (d.charAt(0) === "/" && N || Xe(d)) && (l = !0);
919
+ }
920
+ }
921
+ const r = /* @__PURE__ */ e.createElement(
922
+ "figure",
923
+ {
924
+ className: `notion-asset-wrapper
925
+ notion-asset-wrapper-${s.type}
926
+ ${(f = a.format) != null && f.block_full_width ? "notion-asset-wrapper-full" : ""}
927
+ ${t}`
928
+ },
929
+ /* @__PURE__ */ e.createElement(Ge, { block: a, zoomable: n && !l }, ((v = a == null ? void 0 : a.properties) == null ? void 0 : v.caption) && !l && /* @__PURE__ */ e.createElement("figcaption", { className: "notion-asset-caption" }, /* @__PURE__ */ e.createElement(D, { value: a.properties.caption, block: s })))
930
+ );
931
+ if (l) {
932
+ const d = (h = a == null ? void 0 : a.properties) == null ? void 0 : h.caption[0][0], N = B(d, { uuid: !0 }), _ = d.charAt(0) === "/" && N, k = Je(d);
933
+ return /* @__PURE__ */ e.createElement(
934
+ i.PageLink,
935
+ {
936
+ style: Qe,
937
+ href: _ ? m(N) : d,
938
+ target: k && k !== o && !d.startsWith("/") ? "blank_" : null
939
+ },
940
+ r
941
+ );
942
+ }
943
+ return r;
944
+ };
945
+ function Xe(t) {
946
+ return !!new RegExp(
947
+ "^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$",
948
+ "i"
949
+ ).test(t);
950
+ }
951
+ function Je(t) {
952
+ try {
953
+ return new URL(t).hostname;
954
+ } catch (s) {
955
+ return "";
956
+ }
957
+ }
958
+ export {
959
+ Ye as A,
960
+ be as B,
961
+ fe as C,
962
+ ke as E,
963
+ G,
964
+ Se as H,
965
+ V as L,
966
+ Ue as N,
967
+ F as P,
968
+ Me as S,
969
+ D as T,
970
+ j as a,
971
+ he as b,
972
+ ye as c,
973
+ st as d,
974
+ He as e,
975
+ Ce as f,
976
+ at as g,
977
+ Ie as h,
978
+ ot as i,
979
+ _e as j,
980
+ Ae as k,
981
+ Ge as l,
982
+ b as u
983
+ };
984
+ //# sourceMappingURL=asset-wrapper-CVJvW06J.js.map