@texonom/nreact 1.6.7 → 1.6.8

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,1074 @@
1
+ import e from "react";
2
+ import { defaultMapImageUrl as t, defaultMapPageUrl as n, formatDate as r, formatNotionDateTime as i, getBlockIcon as a, getBlockParentPage as o, getBlockTitle as s, getPageBreadcrumbs as c, getTextContent as l, isUrl as u, normalizeUrl as d, parsePageId as f } from "@texonom/nutils";
3
+ import { useHotkeys as p } from "react-hotkeys-hook";
4
+ //#region \0rolldown/runtime.js
5
+ var m = Object.create, h = Object.defineProperty, g = Object.getOwnPropertyDescriptor, _ = Object.getOwnPropertyNames, v = Object.getPrototypeOf, y = Object.prototype.hasOwnProperty, b = (e, t, n) => () => {
6
+ if (n) throw n[0];
7
+ try {
8
+ return e && (t = e(e = 0)), t;
9
+ } catch (e) {
10
+ throw n = [e], e;
11
+ }
12
+ }, x = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), S = (e, t, n, r) => {
13
+ if (t && typeof t == "object" || typeof t == "function") for (var i = _(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !y.call(e, s) && s !== n && h(e, s, {
14
+ get: ((e) => t[e]).bind(null, s),
15
+ enumerable: !(r = g(t, s)) || r.enumerable
16
+ });
17
+ return e;
18
+ }, C = (e, t, n) => (n = e == null ? {} : m(v(e)), S(t || !e || !e.__esModule || !y.call(e, "default") ? h(n, "default", {
19
+ value: e,
20
+ enumerable: !0
21
+ }) : n, e));
22
+ //#endregion
23
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
24
+ function w(e) {
25
+ "@babel/helpers - typeof";
26
+ return w = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
27
+ return typeof e;
28
+ } : function(e) {
29
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
30
+ }, w(e);
31
+ }
32
+ //#endregion
33
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
34
+ function ee(e, t) {
35
+ if (w(e) != "object" || !e) return e;
36
+ var n = e[Symbol.toPrimitive];
37
+ if (n !== void 0) {
38
+ var r = n.call(e, t || "default");
39
+ if (w(r) != "object") return r;
40
+ throw TypeError("@@toPrimitive must return a primitive value.");
41
+ }
42
+ return (t === "string" ? String : Number)(e);
43
+ }
44
+ //#endregion
45
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
46
+ function te(e) {
47
+ var t = ee(e, "string");
48
+ return w(t) == "symbol" ? t : t + "";
49
+ }
50
+ //#endregion
51
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
52
+ function ne(e, t, n) {
53
+ return (t = te(t)) in e ? Object.defineProperty(e, t, {
54
+ value: n,
55
+ enumerable: !0,
56
+ configurable: !0,
57
+ writable: !0
58
+ }) : e[t] = n, e;
59
+ }
60
+ //#endregion
61
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/objectSpread2.js
62
+ function T(e, t) {
63
+ var n = Object.keys(e);
64
+ if (Object.getOwnPropertySymbols) {
65
+ var r = Object.getOwnPropertySymbols(e);
66
+ t && (r = r.filter(function(t) {
67
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
68
+ })), n.push.apply(n, r);
69
+ }
70
+ return n;
71
+ }
72
+ function E(e) {
73
+ for (var t = 1; t < arguments.length; t++) {
74
+ var n = arguments[t] == null ? {} : arguments[t];
75
+ t % 2 ? T(Object(n), !0).forEach(function(t) {
76
+ ne(e, t, n[t]);
77
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : T(Object(n)).forEach(function(t) {
78
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
79
+ });
80
+ }
81
+ return e;
82
+ }
83
+ //#endregion
84
+ //#region src/icons/check.tsx
85
+ function re(t) {
86
+ 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" }));
87
+ }
88
+ //#endregion
89
+ //#region src/components/checkbox.tsx
90
+ var D = ({ isChecked: t }) => {
91
+ let n = null;
92
+ return n = t ? /* @__PURE__ */ e.createElement("div", { className: "notion-property-checkbox-checked" }, /* @__PURE__ */ e.createElement(re, null)) : /* @__PURE__ */ e.createElement("div", { className: "notion-property-checkbox-unchecked" }), /* @__PURE__ */ e.createElement("span", { className: "notion-property notion-property-checkbox" }, n);
93
+ };
94
+ //#endregion
95
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/objectWithoutPropertiesLoose.js
96
+ function ie(e, t) {
97
+ if (e == null) return {};
98
+ var n = {};
99
+ for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
100
+ if (t.includes(r)) continue;
101
+ n[r] = e[r];
102
+ }
103
+ return n;
104
+ }
105
+ //#endregion
106
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/objectWithoutProperties.js
107
+ function O(e, t) {
108
+ if (e == null) return {};
109
+ var n, r, i = ie(e, t);
110
+ if (Object.getOwnPropertySymbols) {
111
+ var a = Object.getOwnPropertySymbols(e);
112
+ for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
113
+ }
114
+ return i;
115
+ }
116
+ //#endregion
117
+ //#region src/icons/search-icon.tsx
118
+ var ae = ["className"], k = (t) => {
119
+ let { className: n } = t, r = O(t, ae);
120
+ return /* @__PURE__ */ e.createElement("svg", E({
121
+ className: `notion-icon ${n || ""}`,
122
+ viewBox: "0 0 17 17"
123
+ }, r), /* @__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" }));
124
+ }, oe = ["className"], se = (t) => {
125
+ let { className: n } = t, r = O(t, oe);
126
+ return /* @__PURE__ */ e.createElement("svg", E(E({ className: n }, r), {}, {
127
+ viewBox: "0 0 30 30",
128
+ width: "16"
129
+ }), /* @__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" }));
130
+ }, ce = (e) => {
131
+ let t = [], n, r = -1;
132
+ return Object.keys(e).forEach((i) => {
133
+ var a, o;
134
+ let s = (a = e[i]) == null ? void 0 : a.value;
135
+ s && ((o = s.content) == null || o.forEach((i) => {
136
+ var a;
137
+ let o = (a = e[i]) == null || (a = a.value) == null ? void 0 : a.type;
138
+ o && o !== n && (r++, n = o, t[r] = []), r > -1 && t[r].push(i);
139
+ })), n = void 0;
140
+ }), t;
141
+ }, le = (e, t) => {
142
+ let n = ce(t).find((t) => t.includes(e));
143
+ if (n) return n.indexOf(e) + 1;
144
+ }, A = (e) => e.includes("#") ? e.replace(/^.+(#.+)$/, "$1") : "", ue = typeof window < "u", de = /* @__PURE__ */ new Set([
145
+ "youtu.be",
146
+ "youtube.com",
147
+ "www.youtube.com",
148
+ "youtube-nocookie.com",
149
+ "www.youtube-nocookie.com"
150
+ ]), j = (e) => {
151
+ try {
152
+ let { hostname: t } = new URL(e);
153
+ if (!de.has(t)) return null;
154
+ let n = e.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/i);
155
+ if (n && n[2].length == 11) return n[2];
156
+ } catch (e) {}
157
+ return null;
158
+ }, fe = [
159
+ "src",
160
+ "alt",
161
+ "className",
162
+ "style",
163
+ "zoomable",
164
+ "priority",
165
+ "height",
166
+ "onError"
167
+ ], M = (t) => {
168
+ var n, r, i;
169
+ let { src: a, alt: o, className: s, style: c, zoomable: l = !1, priority: u = !1, height: f, onError: p } = t, m = O(t, fe), { recordMap: h, zoom: g, previewImages: _, forceCustomImages: v, components: y } = Q(), b = e.useRef(g ? g.clone() : null), x = _ ? (n = h == null || (r = h.preview_images) == null ? void 0 : r[a]) == null ? h == null || (i = h.preview_images) == null ? void 0 : i[d(a)] : n : null, S = e.useCallback((e) => {
170
+ l && (e.target.src || e.target.srcset) && b.current && b.current.attach(e.target);
171
+ }, [b, l]), C = e.useCallback((e) => {
172
+ b.current && e && b.current.attach(e);
173
+ }, [b]), w = e.useMemo(() => l ? C : void 0, [l, C]);
174
+ return x && y.Image ? /* @__PURE__ */ e.createElement(y.Image, {
175
+ src: a,
176
+ alt: o,
177
+ style: c,
178
+ className: s,
179
+ width: x.originalWidth,
180
+ height: x.originalHeight,
181
+ blurDataURL: x.dataURIBase64,
182
+ placeholder: "blur",
183
+ priority: u,
184
+ onLoad: S
185
+ }) : y.Image && v ? /* @__PURE__ */ e.createElement(y.Image, {
186
+ src: a,
187
+ alt: o,
188
+ className: s,
189
+ style: c,
190
+ width: null,
191
+ height: f || null,
192
+ priority: u,
193
+ onLoad: S
194
+ }) : /* @__PURE__ */ e.createElement("img", E({
195
+ className: s,
196
+ style: c,
197
+ src: a,
198
+ alt: o,
199
+ ref: w,
200
+ loading: "lazy",
201
+ decoding: "async",
202
+ onError: p
203
+ }, m));
204
+ }, pe = (e) => e.type === "page" || e.type === "callout" || e.type === "collection_view" || e.type === "collection_view_page", N = ({ block: t, className: n, inline: r = !0, hideDefaultIcon: i = !1, defaultIcon: o }) => {
205
+ let { mapImageUrl: c, recordMap: l, darkMode: d } = Q(), f = !1, p = null;
206
+ if (pe(t)) {
207
+ var m;
208
+ let r = ((m = a(t, l)) == null ? void 0 : m.trim()) || o, h = s(t, l);
209
+ if (r && u(r)) {
210
+ let i = c(r, t);
211
+ f = !0, p = /* @__PURE__ */ e.createElement(M, {
212
+ src: i,
213
+ alt: h || "page icon",
214
+ className: `${n || ""} notion-page-icon`
215
+ });
216
+ } else if (r && r.startsWith("/icons/")) {
217
+ let t = "https://www.notion.so" + r + "?mode=" + (d ? "dark" : "light");
218
+ p = /* @__PURE__ */ e.createElement(M, {
219
+ src: t,
220
+ alt: h || "page icon",
221
+ className: `${n || ""} notion-page-icon`
222
+ });
223
+ } else r ? (f = !1, p = /* @__PURE__ */ e.createElement("span", {
224
+ className: `${n || ""} notion-page-icon`,
225
+ role: "img",
226
+ "aria-label": r
227
+ }, r)) : i || (f = !0, p = /* @__PURE__ */ e.createElement(se, {
228
+ className: `${n || ""} notion-page-icon`,
229
+ alt: h || "page icon"
230
+ }));
231
+ }
232
+ return p ? /* @__PURE__ */ e.createElement("div", { className: `
233
+ ${r ? "notion-page-icon-inline" : "notion-page-icon-hero"}
234
+ ${f ? "notion-page-icon-image" : "notion-page-icon-span"}
235
+ ` }, p) : null;
236
+ }, P = e.memo(N), me = ["className"], he = (t) => {
237
+ let { className: n } = t, r = O(t, me);
238
+ return /* @__PURE__ */ e.createElement("svg", E(E({ className: `notion-icon ${n || ""}` }, r), {}, { 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" }));
239
+ }, ge = ["className"], _e = (t) => {
240
+ let { className: n } = t, r = O(t, ge);
241
+ return /* @__PURE__ */ e.createElement("svg", E(E({ className: `notion-icon ${n || ""}` }, r), {}, { viewBox: "0 0 24 24" }), /* @__PURE__ */ e.createElement("defs", null, /* @__PURE__ */ e.createElement("linearGradient", {
242
+ x1: "28.1542969%",
243
+ y1: "63.7402344%",
244
+ x2: "74.6289062%",
245
+ y2: "17.7832031%",
246
+ id: "linearGradient-1"
247
+ }, /* @__PURE__ */ e.createElement("stop", {
248
+ stopColor: "rgba(164, 164, 164, 1)",
249
+ offset: "0%"
250
+ }), /* @__PURE__ */ e.createElement("stop", {
251
+ stopColor: "rgba(164, 164, 164, 0)",
252
+ stopOpacity: "0",
253
+ offset: "100%"
254
+ }))), /* @__PURE__ */ e.createElement("g", {
255
+ id: "Page-1",
256
+ stroke: "none",
257
+ strokeWidth: "1",
258
+ fill: "none"
259
+ }, /* @__PURE__ */ e.createElement("g", { transform: "translate(-236.000000, -286.000000)" }, /* @__PURE__ */ e.createElement("g", { transform: "translate(238.000000, 286.000000)" }, /* @__PURE__ */ e.createElement("circle", {
260
+ id: "Oval-2",
261
+ stroke: "url(#linearGradient-1)",
262
+ strokeWidth: "4",
263
+ cx: "10",
264
+ cy: "12",
265
+ r: "10"
266
+ }), /* @__PURE__ */ e.createElement("path", {
267
+ d: "M10,2 C4.4771525,2 0,6.4771525 0,12",
268
+ id: "Oval-2",
269
+ stroke: "rgba(164, 164, 164, 1)",
270
+ strokeWidth: "4"
271
+ }), /* @__PURE__ */ e.createElement("rect", {
272
+ id: "Rectangle-1",
273
+ fill: "rgba(164, 164, 164, 1)",
274
+ x: "8",
275
+ y: "0",
276
+ width: "4",
277
+ height: "4",
278
+ rx: "8"
279
+ })))));
280
+ };
281
+ //#endregion
282
+ //#region src/icons/type-github.tsx
283
+ function ve(t) {
284
+ return /* @__PURE__ */ e.createElement("svg", E({ viewBox: "0 0 260 260" }, t), /* @__PURE__ */ e.createElement("g", null, /* @__PURE__ */ e.createElement("path", {
285
+ 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",
286
+ fill: "#161614"
287
+ })));
288
+ }
289
+ //#endregion
290
+ //#region src/components/eoi.tsx
291
+ var F = ({ block: t, inline: n, className: r }) => {
292
+ var a, o, s;
293
+ let { components: c } = Q(), { original_url: l, attributes: u, domain: d } = (t == null ? void 0 : t.format) || {};
294
+ if (!l || !u) return null;
295
+ let f = (a = u.find((e) => e.id === "title")) == null ? void 0 : a.values[0], p = (o = u.find((e) => e.id === "owner")) == null ? void 0 : o.values[0], m = (s = u.find((e) => e.id === "updated_at")) == null ? void 0 : s.values[0], h = m ? i(m) : null, g;
296
+ switch (d) {
297
+ case "github.com":
298
+ if (g = /* @__PURE__ */ e.createElement(ve, null), p) {
299
+ let e = p.split("/");
300
+ p = e[e.length - 1];
301
+ }
302
+ break;
303
+ default: return process.env.NODE_ENV !== "production" && console.debug(`Unsupported external_object_instance domain "${d}"`, JSON.stringify(t, null, 2)), null;
304
+ }
305
+ return /* @__PURE__ */ e.createElement(c.Link, {
306
+ target: "_blank",
307
+ rel: "noopener noreferrer",
308
+ href: l,
309
+ className: `notion-external ${n ? "notion-external-mention" : "notion-external-block notion-row"} ${r || ""}`
310
+ }, g && /* @__PURE__ */ e.createElement("div", { className: "notion-external-image" }, g), /* @__PURE__ */ e.createElement("div", { className: "notion-external-description" }, /* @__PURE__ */ e.createElement("div", { className: "notion-external-title" }, f), (p || h) && /* @__PURE__ */ e.createElement("div", { className: "notion-external-subtitle" }, p && /* @__PURE__ */ e.createElement("span", null, p), p && h && /* @__PURE__ */ e.createElement("span", null, " • "), h && /* @__PURE__ */ e.createElement("span", null, "Updated ", h))));
311
+ }, I = (t) => /* @__PURE__ */ e.createElement("img", E({ loading: "lazy" }, t)), L = ({ value: t, block: n, linkProps: i, linkProtocol: a }) => {
312
+ let { components: o, recordMap: s, mapPageUrl: c, mapImageUrl: l, rootDomain: u } = Q();
313
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, t == null ? void 0 : t.map((t, d) => {
314
+ let [p, m] = t;
315
+ if (!m) return p === "," ? /* @__PURE__ */ e.createElement("span", {
316
+ key: d,
317
+ style: { padding: "0.5em" }
318
+ }) : /* @__PURE__ */ e.createElement(e.Fragment, { key: d }, p);
319
+ let h = m.reduce((t, d) => {
320
+ switch (d[0]) {
321
+ case "p": {
322
+ var p;
323
+ let t = d[1], n = (p = s.block[t]) == null ? void 0 : p.value;
324
+ return n ? /* @__PURE__ */ e.createElement(o.PageLink, {
325
+ className: "notion-link",
326
+ href: c(t)
327
+ }, /* @__PURE__ */ e.createElement(z, { block: n })) : (console.debug("\"p\" missing block", t), null);
328
+ }
329
+ case "‣": {
330
+ let t = d[1][0], r = d[1][1];
331
+ switch (t) {
332
+ case "u": {
333
+ var m;
334
+ let t = (m = s.notion_user[r]) == null ? void 0 : m.value;
335
+ if (!t) return console.debug("\"‣\" missing user", r), null;
336
+ let a = [t.given_name, t.family_name].filter(Boolean).join(" "), c = t.email;
337
+ return /* @__PURE__ */ e.createElement(o.Link, E({
338
+ className: "notion-link",
339
+ href: `mailto:${c}`
340
+ }, i), /* @__PURE__ */ e.createElement(I, {
341
+ className: "notion-user",
342
+ src: l(t.profile_photo, n),
343
+ alt: a,
344
+ style: {
345
+ display: "inline",
346
+ marginRight: "0.3em",
347
+ marginBottom: "0.3em"
348
+ }
349
+ }), a);
350
+ }
351
+ default: {
352
+ var h;
353
+ let n = (h = s.block[r]) == null ? void 0 : h.value;
354
+ return n ? /* @__PURE__ */ e.createElement(o.PageLink, E(E({
355
+ className: "notion-link",
356
+ href: c(r)
357
+ }, i), {}, {
358
+ target: "_blank",
359
+ rel: "noopener noreferrer"
360
+ }), /* @__PURE__ */ e.createElement(z, { block: n })) : (console.debug("\"‣\" missing block", t, r), null);
361
+ }
362
+ }
363
+ }
364
+ case "h": return /* @__PURE__ */ e.createElement("span", { className: `notion-${d[1]}` }, t);
365
+ case "c": return /* @__PURE__ */ e.createElement("code", { className: "notion-inline-code" }, t);
366
+ case "b": return /* @__PURE__ */ e.createElement("b", null, t);
367
+ case "i": return /* @__PURE__ */ e.createElement("em", null, t);
368
+ case "s": return /* @__PURE__ */ e.createElement("s", null, t);
369
+ case "_": return /* @__PURE__ */ e.createElement("span", { className: "notion-inline-underscore" }, t);
370
+ case "e": return /* @__PURE__ */ e.createElement(o.Equation, {
371
+ math: d[1],
372
+ inline: !0
373
+ });
374
+ case "m": return t;
375
+ case "a": {
376
+ let n = d[1], r = n.substring(1), s = f(r, { uuid: !0 });
377
+ if ((n[0] === "/" || n.includes(u)) && s) {
378
+ let r = n.includes(u) ? n : `${c(s)}${A(n)}`;
379
+ return /* @__PURE__ */ e.createElement(o.PageLink, E({
380
+ className: "notion-link",
381
+ href: r
382
+ }, i), t);
383
+ }
384
+ return /* @__PURE__ */ e.createElement(o.Link, E({
385
+ className: "notion-link",
386
+ href: a ? `${a}:${d[1]}` : d[1]
387
+ }, i), t);
388
+ }
389
+ case "d": {
390
+ let e = d[1], n = e == null ? void 0 : e.type;
391
+ if (n === "date") {
392
+ let t = e.start_date;
393
+ return r(t);
394
+ }
395
+ if (n === "daterange") {
396
+ let t = e.start_date, n = e.end_date;
397
+ return `${r(t)} → ${r(n)}`;
398
+ }
399
+ return t;
400
+ }
401
+ case "u": {
402
+ var g;
403
+ let t = d[1], r = (g = s.notion_user[t]) == null ? void 0 : g.value;
404
+ if (!r) return console.debug("missing user", t), null;
405
+ let a = r.name, c = r.email;
406
+ return /* @__PURE__ */ e.createElement(o.Link, E({
407
+ className: "notion-link",
408
+ href: `mailto:${c}`
409
+ }, i), /* @__PURE__ */ e.createElement(I, {
410
+ className: "notion-user",
411
+ src: l(r.profile_photo, n),
412
+ alt: a,
413
+ style: {
414
+ display: "inline",
415
+ marginRight: "0.3em",
416
+ marginBottom: "0.3em"
417
+ }
418
+ }), a);
419
+ }
420
+ case "eoi": {
421
+ var _;
422
+ let t = d[1], n = (_ = s.block[t]) == null ? void 0 : _.value;
423
+ return /* @__PURE__ */ e.createElement(F, {
424
+ block: n,
425
+ inline: !0
426
+ });
427
+ }
428
+ default: return process.env.NODE_ENV !== "production" && console.debug("unsupported text format", d), t;
429
+ }
430
+ }, /* @__PURE__ */ e.createElement(e.Fragment, null, p));
431
+ return /* @__PURE__ */ e.createElement(e.Fragment, { key: d }, h);
432
+ }));
433
+ }, ye = [
434
+ "block",
435
+ "className",
436
+ "defaultIcon"
437
+ ], R = (t) => {
438
+ var n, r;
439
+ let { block: i, className: a, defaultIcon: o } = t, c = O(t, ye), { recordMap: l } = Q();
440
+ if (!i) return null;
441
+ if (i.type === "collection_view_page" || i.type === "collection_view") {
442
+ let t = s(i, l);
443
+ if (!t) return null;
444
+ let n = [[t]];
445
+ return /* @__PURE__ */ e.createElement("span", E({ className: `notion-page-title ${a || ""}` }, c), /* @__PURE__ */ e.createElement(P, {
446
+ block: i,
447
+ defaultIcon: o,
448
+ className: "notion-page-title-icon"
449
+ }), /* @__PURE__ */ e.createElement("span", { className: "notion-page-title-text" }, /* @__PURE__ */ e.createElement(L, {
450
+ value: n,
451
+ block: i
452
+ })));
453
+ }
454
+ return (n = i.properties) != null && n.title ? /* @__PURE__ */ e.createElement("span", E({ className: `notion-page-title ${a || ""}` }, c), /* @__PURE__ */ e.createElement(P, {
455
+ block: i,
456
+ defaultIcon: o,
457
+ className: "notion-page-title-icon"
458
+ }), /* @__PURE__ */ e.createElement("span", { className: "notion-page-title-text" }, /* @__PURE__ */ e.createElement(L, {
459
+ value: (r = i.properties) == null ? void 0 : r.title,
460
+ block: i
461
+ }))) : null;
462
+ }, z = e.memo(R);
463
+ //#endregion
464
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/asyncToGenerator.js
465
+ function B(e, t, n, r, i, a, o) {
466
+ try {
467
+ var s = e[a](o), c = s.value;
468
+ } catch (e) {
469
+ n(e);
470
+ return;
471
+ }
472
+ s.done ? t(c) : Promise.resolve(c).then(r, i);
473
+ }
474
+ function V(e) {
475
+ return function() {
476
+ var t = this, n = arguments;
477
+ return new Promise(function(r, i) {
478
+ var a = e.apply(t, n);
479
+ function o(e) {
480
+ B(a, r, i, o, s, "next", e);
481
+ }
482
+ function s(e) {
483
+ B(a, r, i, o, s, "throw", e);
484
+ }
485
+ o(void 0);
486
+ });
487
+ };
488
+ }
489
+ var H = b((() => {}));
490
+ //#endregion
491
+ //#region src/components/search-dialog.tsx
492
+ H();
493
+ var be = (e, t) => {
494
+ let n;
495
+ return (...r) => {
496
+ n && clearTimeout(n), n = setTimeout(() => e(...r), t);
497
+ };
498
+ }, U = class extends e.Component {
499
+ constructor(t) {
500
+ var n;
501
+ super(t), n = this, this.state = {
502
+ isLoading: !1,
503
+ query: "",
504
+ searchResult: null,
505
+ searchError: null
506
+ }, this._onAfterOpen = () => {
507
+ this._inputRef.current && this._inputRef.current.focus();
508
+ }, this._onChangeQuery = (e) => {
509
+ let t = e.target.value;
510
+ if (this.setState({ query: t }), t.trim()) this._search();
511
+ else {
512
+ this.setState({
513
+ isLoading: !1,
514
+ searchResult: null,
515
+ searchError: null
516
+ });
517
+ return;
518
+ }
519
+ }, this._onClearQuery = () => {
520
+ this._onChangeQuery({ target: { value: "" } });
521
+ }, this._warmupSearch = V(function* () {
522
+ let { searchNotion: e, rootBlockId: t, rootSpaceId: r } = n.props;
523
+ yield e({
524
+ query: "",
525
+ spaceId: r,
526
+ filters: {
527
+ ancestors: [t],
528
+ isDeletedOnly: !1,
529
+ excludeTemplates: !0,
530
+ navigableBlockContentOnly: !0,
531
+ requireEditPermissions: !1
532
+ }
533
+ });
534
+ }), this._searchImpl = V(function* () {
535
+ let { searchNotion: e, rootBlockId: t, rootSpaceId: r } = n.props, { query: i } = n.state;
536
+ if (!i.trim()) {
537
+ n.setState({
538
+ isLoading: !1,
539
+ searchResult: null,
540
+ searchError: null
541
+ });
542
+ return;
543
+ }
544
+ n.setState({ isLoading: !0 });
545
+ let a = yield e({
546
+ query: i,
547
+ spaceId: r,
548
+ filters: {
549
+ ancestors: [t],
550
+ isDeletedOnly: !1,
551
+ excludeTemplates: !0,
552
+ navigableBlockContentOnly: !0,
553
+ requireEditPermissions: !1
554
+ }
555
+ });
556
+ console.debug("search", i, a);
557
+ let c = null, l = null;
558
+ if (a.error || a.errorId) l = a;
559
+ else {
560
+ c = E({}, a);
561
+ let e = c.results.map((e) => {
562
+ var t, n;
563
+ let r = (t = c.recordMap.block[e.id]) == null ? void 0 : t.value;
564
+ if (!r) return;
565
+ let i = s(r, c.recordMap);
566
+ if (i && (e.title = i, e.block = r, e.recordMap = c.recordMap, e.page = o(r, c.recordMap, { inclusive: !0 }) || r, e.page.id)) return (n = e.highlight) != null && n.text && (e.highlight.html = e.highlight.text.replace(/<gzkNfoUU>/gi, "<b>").replace(/<\/gzkNfoUU>/gi, "</b>")), e;
567
+ }).filter(Boolean).reduce((e, t) => E(E({}, e), {}, { [t.page.id]: t }), {});
568
+ c.results = Object.values(e);
569
+ }
570
+ n.state.query === i && n.setState({
571
+ isLoading: !1,
572
+ searchResult: c,
573
+ searchError: l
574
+ });
575
+ }), this._inputRef = e.createRef();
576
+ }
577
+ componentDidMount() {
578
+ this._search = be(this._searchImpl.bind(this), 500), this._warmupSearch();
579
+ }
580
+ render() {
581
+ let { isOpen: t, onClose: n } = this.props, { isLoading: r, query: i, searchResult: a, searchError: o } = this.state, s = !!i.trim();
582
+ return /* @__PURE__ */ e.createElement(Fe, null, (c) => {
583
+ let { components: l, defaultPageIcon: u, mapPageUrl: d } = c;
584
+ return /* @__PURE__ */ e.createElement(l.Modal, {
585
+ isOpen: t,
586
+ contentLabel: "Search",
587
+ className: "notion-search",
588
+ overlayClassName: "notion-search-overlay",
589
+ onRequestClose: n,
590
+ onAfterOpen: this._onAfterOpen
591
+ }, /* @__PURE__ */ e.createElement("div", { className: "quickFindMenu" }, /* @__PURE__ */ e.createElement("div", { className: "searchBar" }, /* @__PURE__ */ e.createElement("div", { className: "inlineIcon" }, r ? /* @__PURE__ */ e.createElement(_e, { className: "loadingIcon" }) : /* @__PURE__ */ e.createElement(k, null)), /* @__PURE__ */ e.createElement("input", {
592
+ className: "searchInput",
593
+ placeholder: "Search",
594
+ value: i,
595
+ ref: this._inputRef,
596
+ onInput: this._onChangeQuery
597
+ }), i && /* @__PURE__ */ e.createElement("div", {
598
+ role: "button",
599
+ className: "clearButton",
600
+ onClick: this._onClearQuery
601
+ }, /* @__PURE__ */ e.createElement(he, { className: "clearIcon" }))), s && a && /* @__PURE__ */ e.createElement(e.Fragment, null, a.results.length ? /* @__PURE__ */ e.createElement(Z, E(E({}, c), {}, { recordMap: a.recordMap }), /* @__PURE__ */ e.createElement("div", { className: "resultsPane" }, a.results.map((t) => {
602
+ var n;
603
+ return /* @__PURE__ */ e.createElement(l.PageLink, {
604
+ key: t.id,
605
+ className: "result notion-page-link",
606
+ href: d(t.page.id, a.recordMap)
607
+ }, /* @__PURE__ */ e.createElement(z, {
608
+ block: t.page,
609
+ defaultIcon: u
610
+ }), ((n = t.highlight) == null ? void 0 : n.html) && /* @__PURE__ */ e.createElement("div", {
611
+ className: "notion-search-result-highlight",
612
+ dangerouslySetInnerHTML: { __html: t.highlight.html }
613
+ }));
614
+ })), /* @__PURE__ */ e.createElement("footer", { className: "resultsFooter" }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("span", { className: "resultsCount" }, a.total), a.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"))), s && !a && o && /* @__PURE__ */ e.createElement("div", { className: "noResultsPane" }, /* @__PURE__ */ e.createElement("div", { className: "noResults" }, "Search error"))));
615
+ });
616
+ }
617
+ }, W = ({ block: t }) => /* @__PURE__ */ e.createElement("header", { className: "notion-header" }, /* @__PURE__ */ e.createElement("div", { className: "notion-nav-header" }, /* @__PURE__ */ e.createElement(xe, { block: t }), /* @__PURE__ */ e.createElement(G, { block: t }))), xe = ({ block: t, rootOnly: n = !1 }) => {
618
+ let { recordMap: r, mapPageUrl: i, components: a } = Q(), o = e.useMemo(() => {
619
+ let e = c(r, t.id);
620
+ return n ? [e[0]].filter(Boolean) : e;
621
+ }, [
622
+ r,
623
+ t.id,
624
+ n
625
+ ]);
626
+ return /* @__PURE__ */ e.createElement("div", {
627
+ className: "breadcrumbs",
628
+ key: "breadcrumbs"
629
+ }, o.map((t, n) => {
630
+ if (!t) return null;
631
+ let r = {}, s = { pageLink: a.PageLink };
632
+ return t.active ? s.pageLink = (t) => /* @__PURE__ */ e.createElement("div", t) : r.href = i(t.pageId), /* @__PURE__ */ e.createElement(e.Fragment, { key: t.pageId }, /* @__PURE__ */ e.createElement(s.pageLink, E({ className: `breadcrumb ${t.active && "active"}` }, r), t.icon && /* @__PURE__ */ e.createElement(P, {
633
+ className: "icon",
634
+ block: t.block
635
+ }), t.title && /* @__PURE__ */ e.createElement("span", { className: "title" }, t.title)), n < o.length - 1 && /* @__PURE__ */ e.createElement("span", { className: "spacer" }, "/"));
636
+ }));
637
+ }, G = ({ block: t, search: n, title: r = "Search" }) => {
638
+ let { searchNotion: i, rootPageId: a, isShowingSearch: o, onHideSearch: s, rootSpaceId: c } = Q(), l = n || i, [u, d] = e.useState(o);
639
+ e.useEffect(() => {
640
+ d(o);
641
+ }, [o]);
642
+ let f = e.useCallback(() => {
643
+ d(!0);
644
+ }, []), m = e.useCallback(() => {
645
+ d(!1), s && s();
646
+ }, [s]);
647
+ p("cmd+p", (e) => {
648
+ f(), e.preventDefault(), e.stopPropagation();
649
+ }), p("cmd+k", (e) => {
650
+ f(), e.preventDefault(), e.stopPropagation();
651
+ });
652
+ let h = !!l;
653
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, h && /* @__PURE__ */ e.createElement("div", {
654
+ role: "button",
655
+ className: "breadcrumb button notion-search-button",
656
+ onClick: f
657
+ }, /* @__PURE__ */ e.createElement(k, { className: "searchIcon" }), r && /* @__PURE__ */ e.createElement("span", { className: "title" }, r)), u && h && /* @__PURE__ */ e.createElement(U, {
658
+ isOpen: u,
659
+ rootBlockId: a || (t == null ? void 0 : t.id),
660
+ rootSpaceId: c,
661
+ onClose: m,
662
+ searchNotion: l
663
+ }));
664
+ }, Se = /* @__PURE__ */ C((/* @__PURE__ */ x(((e, t) => {
665
+ var n = typeof Element < "u", r = typeof Map == "function", i = typeof Set == "function", a = typeof ArrayBuffer == "function" && !!ArrayBuffer.isView;
666
+ function o(e, t) {
667
+ if (e === t) return !0;
668
+ if (e && t && typeof e == "object" && typeof t == "object") {
669
+ if (e.constructor !== t.constructor) return !1;
670
+ var s, c, l;
671
+ if (Array.isArray(e)) {
672
+ if (s = e.length, s != t.length) return !1;
673
+ for (c = s; c-- !== 0;) if (!o(e[c], t[c])) return !1;
674
+ return !0;
675
+ }
676
+ var u;
677
+ if (r && e instanceof Map && t instanceof Map) {
678
+ if (e.size !== t.size) return !1;
679
+ for (u = e.entries(); !(c = u.next()).done;) if (!t.has(c.value[0])) return !1;
680
+ for (u = e.entries(); !(c = u.next()).done;) if (!o(c.value[1], t.get(c.value[0]))) return !1;
681
+ return !0;
682
+ }
683
+ if (i && e instanceof Set && t instanceof Set) {
684
+ if (e.size !== t.size) return !1;
685
+ for (u = e.entries(); !(c = u.next()).done;) if (!t.has(c.value[0])) return !1;
686
+ return !0;
687
+ }
688
+ if (a && ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
689
+ if (s = e.length, s != t.length) return !1;
690
+ for (c = s; c-- !== 0;) if (e[c] !== t[c]) return !1;
691
+ return !0;
692
+ }
693
+ if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
694
+ if (e.valueOf !== Object.prototype.valueOf && typeof e.valueOf == "function" && typeof t.valueOf == "function") return e.valueOf() === t.valueOf();
695
+ if (e.toString !== Object.prototype.toString && typeof e.toString == "function" && typeof t.toString == "function") return e.toString() === t.toString();
696
+ if (l = Object.keys(e), s = l.length, s !== Object.keys(t).length) return !1;
697
+ for (c = s; c-- !== 0;) if (!Object.prototype.hasOwnProperty.call(t, l[c])) return !1;
698
+ if (n && e instanceof Element) return !1;
699
+ for (c = s; c-- !== 0;) if ((l[c] !== "_owner" && l[c] !== "__v" && l[c] !== "__o" || !e.$$typeof) && !o(e[l[c]], t[l[c]])) return !1;
700
+ return !0;
701
+ }
702
+ return e !== e && t !== t;
703
+ }
704
+ t.exports = function(e, t) {
705
+ try {
706
+ return o(e, t);
707
+ } catch (e) {
708
+ if ((e.message || "").match(/stack|recursion/i)) return console.warn("react-fast-compare cannot handle circular refs"), !1;
709
+ throw e;
710
+ }
711
+ };
712
+ })))(), 1), Ce = [
713
+ "src",
714
+ "alt",
715
+ "width",
716
+ "height",
717
+ "className",
718
+ "style",
719
+ "layout"
720
+ ], we = [
721
+ "href",
722
+ "as",
723
+ "passHref",
724
+ "prefetch",
725
+ "replace",
726
+ "scroll",
727
+ "shallow",
728
+ "locale",
729
+ "className",
730
+ "style"
731
+ ], Te = (t) => e.memo(function(n) {
732
+ let { src: r, alt: i, width: a, height: o, className: s, style: c, layout: l } = n, u = O(n, Ce);
733
+ return l || (l = a && o ? "intrinsic" : "fill"), /* @__PURE__ */ e.createElement(t, E({
734
+ className: s,
735
+ src: r,
736
+ alt: i,
737
+ width: l === "intrinsic" && a,
738
+ height: l === "intrinsic" && o,
739
+ objectFit: c == null ? void 0 : c.objectFit,
740
+ objectPosition: c == null ? void 0 : c.objectPosition,
741
+ layout: l
742
+ }, u));
743
+ }, Se.default), Ee = (t) => function(n) {
744
+ let { href: r, as: i, passHref: a, prefetch: o, replace: s, scroll: c, shallow: l, locale: u, className: d, style: f } = n, p = O(n, we);
745
+ return /* @__PURE__ */ e.createElement(t, E({
746
+ href: r,
747
+ as: i,
748
+ prefetch: o,
749
+ replace: s,
750
+ scroll: c,
751
+ shallow: l,
752
+ locale: u,
753
+ className: d,
754
+ style: f
755
+ }, p));
756
+ }, De = ["href"], Oe = [
757
+ "href",
758
+ "rel",
759
+ "target",
760
+ "title"
761
+ ], ke = [
762
+ "components",
763
+ "children",
764
+ "mapPageUrl",
765
+ "mapImageUrl",
766
+ "rootPageId",
767
+ "rootSpaceId"
768
+ ], Ae = e.memo((t) => /* @__PURE__ */ e.createElement("a", E({
769
+ target: "_blank",
770
+ rel: "noopener noreferrer"
771
+ }, t))), je = e.memo((t) => {
772
+ let { href: n } = t, r = O(t, De), { recordMap: i, rootSpaceId: a } = Q(), o = n;
773
+ if (typeof n == "string" && a) {
774
+ let e = f(n);
775
+ if (e) {
776
+ var s;
777
+ let t = i == null || (s = i.block) == null || (s = s[e]) == null ? void 0 : s.value;
778
+ (!t || t.space_id !== a) && (o = `https://notion.so/${e.replace(/-/g, "")}`);
779
+ }
780
+ }
781
+ return /* @__PURE__ */ e.createElement("a", E({ href: o }, r));
782
+ }), Me = (t) => /* @__PURE__ */ e.createElement($, t), Ne = W, Pe = (t) => {
783
+ let { href: n, rel: r, target: i, title: a } = t, o = O(t, Oe);
784
+ return /* @__PURE__ */ e.createElement("span", o);
785
+ }, K = (e) => () => (console.warn(`Warning: using empty component "${e}" (you should override this in NotionRenderer.components)`), null), q = (e, t) => t(), J = {
786
+ Image: null,
787
+ Link: Ae,
788
+ PageLink: je,
789
+ Checkbox: D,
790
+ Callout: void 0,
791
+ Code: K("Code"),
792
+ Equation: K("Equation"),
793
+ Collection: K("Collection"),
794
+ Property: void 0,
795
+ propertyTextValue: q,
796
+ propertySelectValue: q,
797
+ propertyRelationValue: q,
798
+ propertyFormulaValue: q,
799
+ propertyTitleValue: q,
800
+ propertyPersonValue: q,
801
+ propertyFileValue: q,
802
+ propertyCheckboxValue: q,
803
+ propertyUrlValue: q,
804
+ propertyEmailValue: q,
805
+ propertyPhoneNumberValue: q,
806
+ propertyNumberValue: q,
807
+ propertyLastEditedTimeValue: q,
808
+ propertyCreatedTimeValue: q,
809
+ propertyDateValue: q,
810
+ Pdf: K("Pdf"),
811
+ Tweet: K("Tweet"),
812
+ Modal: K("Modal"),
813
+ Header: Ne,
814
+ Embed: Me
815
+ }, Y = {
816
+ recordMap: {
817
+ block: {},
818
+ collection: {},
819
+ collection_view: {},
820
+ collection_query: {},
821
+ notion_user: {},
822
+ signed_urls: {}
823
+ },
824
+ components: J,
825
+ mapPageUrl: n(),
826
+ mapImageUrl: t,
827
+ searchNotion: null,
828
+ isShowingSearch: !1,
829
+ onHideSearch: null,
830
+ fullPage: !1,
831
+ darkMode: !1,
832
+ previewImages: !1,
833
+ forceCustomImages: !1,
834
+ showCollectionViewDropdown: !0,
835
+ linkTableTitleProperties: !0,
836
+ isLinkCollectionToUrlProperty: !1,
837
+ showTableOfContents: !1,
838
+ minTableOfContentsItems: 3,
839
+ defaultPageIcon: null,
840
+ defaultPageCover: null,
841
+ defaultPageCoverPosition: .5,
842
+ zoom: null,
843
+ editable: !1
844
+ }, X = e.createContext(Y), Z = (r) => {
845
+ let { components: i = {}, children: a, mapPageUrl: o, mapImageUrl: s, rootPageId: c, rootSpaceId: l } = r, u = O(r, ke);
846
+ for (let e of Object.keys(u)) u[e] === void 0 && delete u[e];
847
+ let d = e.useMemo(() => {
848
+ let e = E({}, i);
849
+ if (e.nextImage && (e.Image = Te(e.nextImage)), e.nextLink) {
850
+ let t = Ee(e.nextLink);
851
+ e.nextLink = t, e.PageLink || (e.PageLink = t), e.Link || (e.Link = t);
852
+ }
853
+ for (let t of Object.keys(e)) e[t] || delete e[t];
854
+ return e;
855
+ }, [i]), f = e.useMemo(() => E(E(E({}, Y), u), {}, {
856
+ rootPageId: c,
857
+ rootSpaceId: l,
858
+ mapPageUrl: o == null ? n(c) : o,
859
+ mapImageUrl: s == null ? t : s,
860
+ components: E(E({}, J), d)
861
+ }), [
862
+ s,
863
+ o,
864
+ d,
865
+ c,
866
+ l,
867
+ u
868
+ ]);
869
+ return /* @__PURE__ */ e.createElement(X.Provider, { value: f }, a);
870
+ }, Fe = X.Consumer, Q = () => e.useContext(X), Ie = (e) => Object.keys(e).map((t) => `${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&"), Le = ({ id: t, defaultPlay: n = !1, mute: r = !1, lazyImage: i = !1, iframeTitle: a = "YouTube video", alt: o = "Video preview", params: s = {}, adLinksPreconnect: c = !0, style: l, className: u }) => {
871
+ let d = r || n ? "1" : "0", f = e.useMemo(() => Ie(E({
872
+ autoplay: "1",
873
+ mute: d
874
+ }, s)), [d, s]), p = `https://i.ytimg.com/vi/${t}/hqdefault.jpg`, m = "https://www.youtube-nocookie.com", h = `${m}/embed/${t}?${f}`, [g, _] = e.useState(!1), [v, y] = e.useState(n), [b, x] = e.useState(!1), S = e.useCallback(() => {
875
+ g || _(!0);
876
+ }, [g]), C = e.useCallback(() => {
877
+ v || y(!0);
878
+ }, [v]), w = e.useCallback(() => {
879
+ x(!0);
880
+ }, []);
881
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("link", {
882
+ rel: "preload",
883
+ href: p,
884
+ as: "image"
885
+ }), g && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("link", {
886
+ rel: "preconnect",
887
+ href: m
888
+ }), /* @__PURE__ */ e.createElement("link", {
889
+ rel: "preconnect",
890
+ href: "https://www.google.com"
891
+ })), g && c && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("link", {
892
+ rel: "preconnect",
893
+ href: "https://static.doubleclick.net"
894
+ }), /* @__PURE__ */ e.createElement("link", {
895
+ rel: "preconnect",
896
+ href: "https://googleads.g.doubleclick.net"
897
+ })), /* @__PURE__ */ e.createElement("div", {
898
+ onClick: C,
899
+ onPointerOver: S,
900
+ className: `notion-yt-lite
901
+ ${b && "notion-yt-loaded"}
902
+ ${v && "notion-yt-initialized"}
903
+ ${u || ""}`,
904
+ style: l
905
+ }, /* @__PURE__ */ e.createElement("img", {
906
+ src: p,
907
+ className: "notion-yt-thumbnail",
908
+ loading: i ? "lazy" : void 0,
909
+ alt: o
910
+ }), /* @__PURE__ */ e.createElement("div", { className: "notion-yt-playbtn" }), v && /* @__PURE__ */ e.createElement("iframe", {
911
+ width: "560",
912
+ height: "315",
913
+ frameBorder: "0",
914
+ allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
915
+ allowFullScreen: !0,
916
+ title: a,
917
+ src: h,
918
+ onLoad: w
919
+ })));
920
+ }, Re = typeof window > "u", ze = [
921
+ "video",
922
+ "image",
923
+ "embed",
924
+ "figma",
925
+ "typeform",
926
+ "excalidraw",
927
+ "maps",
928
+ "tweet",
929
+ "pdf",
930
+ "gist",
931
+ "codepen",
932
+ "drive"
933
+ ], Be = ({ block: t, zoomable: n = !0, children: r }) => {
934
+ var i, a;
935
+ let { recordMap: o, mapImageUrl: s, components: c } = Q();
936
+ if (!t || !ze.includes(t.type)) return null;
937
+ let u = {
938
+ position: "relative",
939
+ display: "flex",
940
+ justifyContent: "center",
941
+ alignSelf: "center",
942
+ width: "100%",
943
+ maxWidth: "100%",
944
+ flexDirection: "column"
945
+ }, d = {};
946
+ if (t.format) {
947
+ let { block_aspect_ratio: e, block_height: n, block_width: r, block_full_width: i, block_page_width: a, block_preserve_scale: o } = t.format;
948
+ if (i || a) u.width = i ? "100vw" : "100%", t.type === "video" ? n ? u.height = n : e ? u.paddingBottom = `${e * 100}%` : o && (u.objectFit = "contain") : e && t.type !== "image" ? u.paddingBottom = `${e * 100}%` : n ? u.height = n : o && (t.type === "image" ? u.height = "100%" : (u.paddingBottom = "75%", u.minHeight = 100));
949
+ else {
950
+ var f;
951
+ switch ((f = t.format) == null ? void 0 : f.block_alignment) {
952
+ case "center":
953
+ u.alignSelf = "center";
954
+ break;
955
+ case "left":
956
+ u.alignSelf = "start";
957
+ break;
958
+ case "right": u.alignSelf = "end";
959
+ }
960
+ r && (u.width = r), o && t.type !== "image" ? (u.paddingBottom = "50%", u.minHeight = 100) : n && t.type !== "image" && (u.height = n);
961
+ }
962
+ t.type === "image" ? d.objectFit = "cover" : o && (d.objectFit = "contain");
963
+ }
964
+ let p = ((i = o.signed_urls) == null ? void 0 : i[t.id]) || ((a = t.properties) == null || (a = a.source) == null || (a = a[0]) == null ? void 0 : a[0]), m = null;
965
+ if (!p) return null;
966
+ if (t.type === "tweet") {
967
+ let t = p;
968
+ if (!t) return null;
969
+ let n = t.split("?")[0].split("/").pop();
970
+ if (!n) return null;
971
+ m = /* @__PURE__ */ e.createElement("div", { style: E(E({}, d), {}, {
972
+ maxWidth: 420,
973
+ width: "100%",
974
+ marginLeft: "auto",
975
+ marginRight: "auto"
976
+ }) }, /* @__PURE__ */ e.createElement(c.Tweet, { id: n }));
977
+ } else if (t.type === "pdf") u.overflow = "auto", u.background = "rgb(226, 226, 226)", u.display = "block", u.padding || (u.padding = "8px 16px"), Re || (m = /* @__PURE__ */ e.createElement(c.Pdf, { file: p }));
978
+ 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") {
979
+ if (t.type === "video" && p && p.indexOf("youtube") < 0 && p.indexOf("youtu.be") < 0 && p.indexOf("vimeo") < 0 && p.indexOf("wistia") < 0 && p.indexOf("loom") < 0 && p.indexOf("videoask") < 0 && p.indexOf("getcloudapp") < 0) u.paddingBottom = void 0, m = /* @__PURE__ */ e.createElement("video", {
980
+ playsInline: !0,
981
+ controls: !0,
982
+ preload: "metadata",
983
+ style: d,
984
+ src: p,
985
+ title: t.type
986
+ });
987
+ else {
988
+ var h;
989
+ let n = ((h = t.format) == null ? void 0 : h.display_source) || p;
990
+ if (n) {
991
+ let r = t.type === "video" ? j(n) : null;
992
+ r ? m = /* @__PURE__ */ e.createElement(Le, {
993
+ id: r,
994
+ style: d,
995
+ className: "notion-asset-object-fit"
996
+ }) : t.type === "gist" ? (n.endsWith(".pibb") || (n = `${n}.pibb`), d.width = "100%", u.paddingBottom = "50%", m = /* @__PURE__ */ e.createElement("iframe", {
997
+ style: d,
998
+ className: "notion-asset-object-fit",
999
+ src: n,
1000
+ title: "GitHub Gist",
1001
+ frameBorder: "0",
1002
+ loading: "lazy",
1003
+ scrolling: "auto"
1004
+ })) : m = /* @__PURE__ */ e.createElement("iframe", {
1005
+ className: "notion-asset-object-fit",
1006
+ style: d,
1007
+ src: n,
1008
+ title: `iframe ${t.type}`,
1009
+ frameBorder: "0",
1010
+ allowFullScreen: !0,
1011
+ loading: "lazy",
1012
+ scrolling: "auto"
1013
+ });
1014
+ }
1015
+ }
1016
+ } else if (t.type === "image") {
1017
+ var g, _;
1018
+ p.includes("file.notion.so") && (p = (g = t.properties) == null || (g = g.source) == null || (g = g[0]) == null ? void 0 : g[0]);
1019
+ let r = s(p, t), i = l((_ = t.properties) == null ? void 0 : _.caption) || "notion image";
1020
+ m = /* @__PURE__ */ e.createElement(M, {
1021
+ src: r,
1022
+ alt: i,
1023
+ zoomable: n,
1024
+ height: u.height,
1025
+ style: d
1026
+ });
1027
+ }
1028
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: u }, m, t.type === "image" && r), t.type !== "image" && r);
1029
+ }, Ve = { width: "100%" }, $ = ({ blockId: t, block: n }) => {
1030
+ var r, i;
1031
+ let a = n, { components: o, mapPageUrl: s, rootDomain: c, zoom: l } = Q(), u = !1;
1032
+ if (n.type === "image") {
1033
+ var d;
1034
+ let e = a == null || (d = a.properties) == null || (d = d.caption) == null || (d = d[0]) == null ? void 0 : d[0];
1035
+ if (e) {
1036
+ let t = f(e, { uuid: !0 });
1037
+ (e.charAt(0) === "/" && t || He(e)) && (u = !0);
1038
+ }
1039
+ }
1040
+ let p = /* @__PURE__ */ e.createElement("figure", { className: `notion-asset-wrapper
1041
+ notion-asset-wrapper-${n.type}
1042
+ ${(r = a.format) != null && r.block_full_width ? "notion-asset-wrapper-full" : ""}
1043
+ ${t}` }, /* @__PURE__ */ e.createElement(Be, {
1044
+ block: a,
1045
+ zoomable: l && !u
1046
+ }, (a == null || (i = a.properties) == null ? void 0 : i.caption) && !u && /* @__PURE__ */ e.createElement("figcaption", { className: "notion-asset-caption" }, /* @__PURE__ */ e.createElement(L, {
1047
+ value: a.properties.caption,
1048
+ block: n
1049
+ }))));
1050
+ if (u) {
1051
+ var m;
1052
+ let t = a == null || (m = a.properties) == null ? void 0 : m.caption[0][0], n = f(t, { uuid: !0 }), r = t.charAt(0) === "/" && n, i = Ue(t);
1053
+ return /* @__PURE__ */ e.createElement(o.PageLink, {
1054
+ style: Ve,
1055
+ href: r ? s(n) : t,
1056
+ target: i && i !== c && !t.startsWith("/") ? "blank_" : null
1057
+ }, p);
1058
+ }
1059
+ return p;
1060
+ };
1061
+ function He(e) {
1062
+ return !!(/* @__PURE__ */ RegExp("^(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_]*)?$", "i")).test(e);
1063
+ }
1064
+ function Ue(e) {
1065
+ try {
1066
+ return new URL(e).hostname;
1067
+ } catch (e) {
1068
+ return "";
1069
+ }
1070
+ }
1071
+ //#endregion
1072
+ export { D as A, i as C, ue as D, j as E, x as M, C as N, u as O, r as S, le as T, I as _, Z as a, N as b, xe as c, U as d, V as f, L as g, R as h, Fe as i, E as j, O as k, W as l, z as m, Be as n, Pe as o, H as p, Le as r, Q as s, $ as t, G as u, F as v, A as w, M as x, P as y };
1073
+
1074
+ //# sourceMappingURL=asset-wrapper-DIov9Zkx.js.map