@texonom/nreact 1.6.5 → 1.6.7

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.
package/build/index.js CHANGED
@@ -1,58 +1,62 @@
1
- import { o as e, t } from "./rolldown-runtime-CEFd7nDs.js";
2
- import { A as n, C as r, D as i, E as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, g as m, h, i as g, j as _, k as v, l as y, m as b, n as x, o as S, r as C, s as w, t as T, u as E, v as D, w as O, x as k, y as A } from "./asset-wrapper-BjCXzGmC.js";
3
- import { n as ee, r as j, t as M } from "./collection-column-title-Bw3sXBSk.js";
4
- import N from "react";
5
- import P from "@fisch0920/medium-zoom";
6
- import { getBlockCollectionId as te, getBlockIcon as ne, getBlockParentPage as F, getPageTableOfContents as I, getTextContent as L, isEditableBlock as re, uuidToId as R } from "@texonom/nutils";
1
+ import { n as e, r as t, s as n, t as r } from "./objectSpread2-DfFXoz5f.js";
2
+ import { A as i, C as a, D as o, E as s, O as c, S as l, T as u, _ as d, a as f, b as p, c as m, d as h, g, h as _, i as v, k as y, l as b, m as x, n as S, o as C, r as w, s as T, t as E, u as D, v as O, w as ee, x as te, y as k } from "./asset-wrapper-saop46mm.js";
3
+ import { n as A, r as j, t as ne } from "./collection-column-title-B2x01rzc.js";
4
+ import M from "react";
5
+ import re from "@fisch0920/medium-zoom";
6
+ import { getBlockCollectionId as ie, getBlockIcon as ae, getBlockParentPage as N, getPageTableOfContents as P, getTextContent as F, isEditableInPlace as oe, parsePageId as I, uuidToId as L } from "@texonom/nutils";
7
7
  //#region src/components/audio.tsx
8
- var ie = ({ block: e, className: t }) => {
8
+ var se = ({ block: e, className: t }) => {
9
9
  var n;
10
- let { recordMap: r } = w(), i = r.signed_urls[e.id] || ((n = e.properties) == null || (n = n.source) == null || (n = n[0]) == null ? void 0 : n[0]);
11
- return /* @__PURE__ */ N.createElement("div", { className: `notion-audio ${t || ""}` }, /* @__PURE__ */ N.createElement("audio", {
10
+ let { recordMap: r } = T(), i = r.signed_urls[e.id] || ((n = e.properties) == null || (n = n.source) == null || (n = n[0]) == null ? void 0 : n[0]);
11
+ return /* @__PURE__ */ M.createElement("div", { className: `notion-audio ${t || ""}` }, /* @__PURE__ */ M.createElement("audio", {
12
12
  controls: !0,
13
13
  preload: "none",
14
14
  src: i
15
15
  }));
16
- }, z = ["className"], B = (e) => {
17
- let { className: t } = e, n = v(e, z);
18
- return /* @__PURE__ */ N.createElement("svg", _(_({ className: t }, n), {}, { viewBox: "0 0 30 30" }), /* @__PURE__ */ N.createElement("path", { d: "M22,8v12c0,3.866-3.134,7-7,7s-7-3.134-7-7V8c0-2.762,2.238-5,5-5s5,2.238,5,5v12c0,1.657-1.343,3-3,3s-3-1.343-3-3V8h-2v12c0,2.762,2.238,5,5,5s5-2.238,5-5V8c0-3.866-3.134-7-7-7S6,4.134,6,8v12c0,4.971,4.029,9,9,9s9-4.029,9-9V8H22z" }));
19
- }, ae = ({ block: e, className: t }) => {
16
+ };
17
+ //#endregion
18
+ //#region src/icons/file-icon.tsx
19
+ e();
20
+ var ce = ["className"], le = (e) => {
21
+ let { className: t } = e, n = y(e, ce);
22
+ return /* @__PURE__ */ M.createElement("svg", r(r({ className: t }, n), {}, { viewBox: "0 0 30 30" }), /* @__PURE__ */ M.createElement("path", { d: "M22,8v12c0,3.866-3.134,7-7,7s-7-3.134-7-7V8c0-2.762,2.238-5,5-5s5,2.238,5,5v12c0,1.657-1.343,3-3,3s-3-1.343-3-3V8h-2v12c0,2.762,2.238,5,5,5s5-2.238,5-5V8c0-3.866-3.134-7-7-7S6,4.134,6,8v12c0,4.971,4.029,9,9,9s9-4.029,9-9V8H22z" }));
23
+ }, ue = ({ block: e, className: t }) => {
20
24
  var n, r, i;
21
- let { components: a, recordMap: o } = w(), s = o.signed_urls[e.id] || ((n = e.properties) == null || (n = n.source) == null || (n = n[0]) == null ? void 0 : n[0]);
22
- return /* @__PURE__ */ N.createElement("div", { className: `notion-file ${t || ""}` }, /* @__PURE__ */ N.createElement(a.Link, {
25
+ let { components: a, recordMap: o } = T(), s = o.signed_urls[e.id] || ((n = e.properties) == null || (n = n.source) == null || (n = n[0]) == null ? void 0 : n[0]);
26
+ return /* @__PURE__ */ M.createElement("div", { className: `notion-file ${t || ""}` }, /* @__PURE__ */ M.createElement(a.Link, {
23
27
  className: "notion-file-link",
24
28
  href: s,
25
29
  target: "_blank",
26
30
  rel: "noopener noreferrer"
27
- }, /* @__PURE__ */ N.createElement(B, { className: "notion-file-icon" }), /* @__PURE__ */ N.createElement("div", { className: "notion-file-info" }, /* @__PURE__ */ N.createElement("div", { className: "notion-file-title" }, /* @__PURE__ */ N.createElement(m, {
31
+ }, /* @__PURE__ */ M.createElement(le, { className: "notion-file-icon" }), /* @__PURE__ */ M.createElement("div", { className: "notion-file-info" }, /* @__PURE__ */ M.createElement("div", { className: "notion-file-title" }, /* @__PURE__ */ M.createElement(g, {
28
32
  value: ((r = e.properties) == null ? void 0 : r.title) || [["File"]],
29
33
  block: e
30
- })), ((i = e.properties) == null ? void 0 : i.size) && /* @__PURE__ */ N.createElement("div", { className: "notion-file-size" }, /* @__PURE__ */ N.createElement(m, {
34
+ })), ((i = e.properties) == null ? void 0 : i.size) && /* @__PURE__ */ M.createElement("div", { className: "notion-file-size" }, /* @__PURE__ */ M.createElement(g, {
31
35
  value: e.properties.size,
32
36
  block: e
33
37
  })))));
34
- }, oe = ({ block: e, className: t }) => {
38
+ }, de = ({ block: e, className: t }) => {
35
39
  var n;
36
- let { components: r, mapImageUrl: i } = w(), a = (n = e.format) == null ? void 0 : n.drive_properties;
40
+ let { components: r, mapImageUrl: i } = T(), a = (n = e.format) == null ? void 0 : n.drive_properties;
37
41
  if (!a) return null;
38
42
  let o;
39
43
  try {
40
44
  o = new URL(a.url).hostname;
41
45
  } catch (e) {}
42
- return /* @__PURE__ */ N.createElement("div", { className: `notion-google-drive ${t || ""}` }, /* @__PURE__ */ N.createElement(r.Link, {
46
+ return /* @__PURE__ */ M.createElement("div", { className: `notion-google-drive ${t || ""}` }, /* @__PURE__ */ M.createElement(r.Link, {
43
47
  className: "notion-google-drive-link",
44
48
  href: a.url,
45
49
  target: "_blank",
46
50
  rel: "noopener noreferrer"
47
- }, /* @__PURE__ */ N.createElement("div", { className: "notion-google-drive-preview" }, /* @__PURE__ */ N.createElement(l, {
51
+ }, /* @__PURE__ */ M.createElement("div", { className: "notion-google-drive-preview" }, /* @__PURE__ */ M.createElement(d, {
48
52
  src: i(a.thumbnail, e),
49
53
  alt: a.title || "Google Drive Document",
50
54
  loading: "lazy"
51
- })), /* @__PURE__ */ N.createElement("div", { className: "notion-google-drive-body" }, a.title && /* @__PURE__ */ N.createElement("div", { className: "notion-google-drive-body-title" }, a.title), a.icon && o && /* @__PURE__ */ N.createElement("div", { className: "notion-google-drive-body-source" }, a.icon && /* @__PURE__ */ N.createElement("div", {
55
+ })), /* @__PURE__ */ M.createElement("div", { className: "notion-google-drive-body" }, a.title && /* @__PURE__ */ M.createElement("div", { className: "notion-google-drive-body-title" }, a.title), a.icon && o && /* @__PURE__ */ M.createElement("div", { className: "notion-google-drive-body-source" }, a.icon && /* @__PURE__ */ M.createElement("div", {
52
56
  className: "notion-google-drive-body-source-icon",
53
57
  style: { backgroundImage: `url(${a.icon})` }
54
- }), o && /* @__PURE__ */ N.createElement("div", { className: "notion-google-drive-body-source-domain" }, o)))));
55
- }, V = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => {
58
+ }), o && /* @__PURE__ */ M.createElement("div", { className: "notion-google-drive-body-source-domain" }, o)))));
59
+ }, R = /* @__PURE__ */ n((/* @__PURE__ */ t(((e, t) => {
56
60
  var n = "Expected a function", r = NaN, i = /^\s+|\s+$/g, a = /^[-+]0x[0-9a-f]+$/i, o = /^0b[01]+$/i, s = /^0o[0-7]+$/i, c = parseInt, l = typeof global == "object" && global && global.Object === Object && global, u = typeof self == "object" && self && self.Object === Object && self, d = l || u || Function("return this")(), f = Object.prototype.toString, p = Math.max, m = Math.min, h = function() {
57
61
  return d.Date.now();
58
62
  };
@@ -131,8 +135,8 @@ var ie = ({ block: e, className: t }) => {
131
135
  return n || s.test(e) ? c(e.slice(2), n ? 2 : 8) : a.test(e) ? r : +e;
132
136
  }
133
137
  t.exports = _;
134
- })))(), 1), se = ({ toc: e, activeSection: t, setActiveSection: n, pageAside: r, hasToc: i, hasAside: a, className: o }) => {
135
- let s = N.useMemo(() => (0, V.default)(() => {
138
+ })))(), 1), fe = ({ toc: e, activeSection: t, setActiveSection: n, pageAside: r, hasToc: i, hasAside: a, className: o }) => {
139
+ let s = M.useMemo(() => (0, R.default)(() => {
136
140
  let e = document.getElementsByClassName("notion-h"), r = null, i = t;
137
141
  for (let t = 0; t < e.length; ++t) {
138
142
  let n = e[t];
@@ -144,19 +148,19 @@ var ie = ({ block: e, className: t }) => {
144
148
  }
145
149
  n(i);
146
150
  }, 100), [n]);
147
- return N.useEffect(() => {
151
+ return M.useEffect(() => {
148
152
  if (i) return window.addEventListener("scroll", s), s(), () => {
149
153
  window.removeEventListener("scroll", s);
150
154
  };
151
- }, [i, s]), a ? /* @__PURE__ */ N.createElement("aside", { className: `notion-aside ${o || ""}` }, i && /* @__PURE__ */ N.createElement("div", { className: "notion-aside-table-of-contents" }, /* @__PURE__ */ N.createElement("div", { className: "notion-aside-table-of-contents-header" }, "Table of Contents"), /* @__PURE__ */ N.createElement("nav", { className: "notion-table-of-contents" }, e.map((e) => {
152
- let n = R(e.id);
153
- return /* @__PURE__ */ N.createElement("a", {
155
+ }, [i, s]), a ? /* @__PURE__ */ M.createElement("aside", { className: `notion-aside ${o || ""}` }, i && /* @__PURE__ */ M.createElement("div", { className: "notion-aside-table-of-contents" }, /* @__PURE__ */ M.createElement("div", { className: "notion-aside-table-of-contents-header" }, "Table of Contents"), /* @__PURE__ */ M.createElement("nav", { className: "notion-table-of-contents" }, e.map((e) => {
156
+ let n = L(e.id);
157
+ return /* @__PURE__ */ M.createElement("a", {
154
158
  key: n,
155
159
  href: `#${n}`,
156
160
  className: `notion-table-of-contents-item
157
161
  notion-table-of-contents-item-indent-level-${e.indentLevel}
158
162
  ${t === n && "notion-table-of-contents-active-item"}`
159
- }, /* @__PURE__ */ N.createElement("span", {
163
+ }, /* @__PURE__ */ M.createElement("span", {
160
164
  className: "notion-table-of-contents-item-body",
161
165
  style: {
162
166
  display: "inline-block",
@@ -164,176 +168,355 @@ var ie = ({ block: e, className: t }) => {
164
168
  }
165
169
  }, e.text));
166
170
  }))), r) : null;
167
- }, ce = ({ block: e, level: t }) => {
171
+ }, pe = ({ block: e, level: t }) => {
168
172
  var n;
169
173
  if (!e) return process.env.NODE_ENV !== "production" && console.warn("missing sync pointer block", e.id), null;
170
174
  let r = e, i = r == null || (n = r.format) == null || (n = n.transclusion_reference_pointer) == null ? void 0 : n.id;
171
- return i ? /* @__PURE__ */ N.createElement(q, {
175
+ return i ? /* @__PURE__ */ M.createElement(Z, {
172
176
  key: i,
173
177
  level: t,
174
178
  blockId: i
175
179
  }) : null;
176
- }, le = ({ block: e }) => {
177
- var t, n;
178
- let { onChangeBlock: r } = w(), i = N.useRef(null), a = L((t = (n = e.properties) == null ? void 0 : n.title) == null ? [] : t), o = N.useRef(null);
179
- return N.useEffect(() => {
180
- let e = i.current;
181
- e && a !== o.current && e !== document.activeElement && (e.innerText = a, o.current = a);
182
- }, [a]), /* @__PURE__ */ N.createElement("span", {
183
- ref: i,
180
+ }, me = /* @__PURE__ */ new Set([
181
+ "b",
182
+ "i",
183
+ "s",
184
+ "c",
185
+ "_",
186
+ "h"
187
+ ]), z = (e, t) => (e[0] === "/" || !!t && e.includes(t)) && !!I(e.substring(1), { uuid: !0 });
188
+ function B(e, t) {
189
+ let [n, r] = e;
190
+ return !r || r.length === 0 ? n === "," : !r.every((e) => me.has(e[0]) || e[0] === "a" && typeof e[1] == "string" && !z(e[1], t));
191
+ }
192
+ var he = ({ title: e, block: t, holdsLine: n }) => {
193
+ let { rootDomain: r } = T();
194
+ return n ? /* @__PURE__ */ M.createElement("br", null) : /* @__PURE__ */ M.createElement(M.Fragment, null, e.map((e, n) => B(e, r) ? /* @__PURE__ */ M.createElement("span", {
195
+ key: n,
196
+ contentEditable: !1,
197
+ "data-segment": JSON.stringify(e)
198
+ }, /* @__PURE__ */ M.createElement(g, {
199
+ value: [e],
200
+ block: t
201
+ })) : /* @__PURE__ */ M.createElement(g, {
202
+ key: n,
203
+ value: [e],
204
+ block: t
205
+ })));
206
+ }, ge = ({ block: e }) => {
207
+ var t, n, r, i;
208
+ let a = (t = (n = e.properties) == null ? void 0 : n.title) == null ? [] : t, o = a.length === 0 && (e.type === "text" && !e.properties && !((r = e.content) != null && r.length) || Array.isArray((i = e.properties) == null ? void 0 : i.title)), s = JSON.stringify(a), c = M.useRef(null), l = M.useRef({
209
+ json: s,
210
+ version: 0
211
+ });
212
+ if (l.current.json !== s) {
213
+ var u;
214
+ l.current = {
215
+ json: s,
216
+ version: ((u = c.current) == null ? void 0 : u.getAttribute("data-title")) === s ? l.current.version : l.current.version + 1
217
+ };
218
+ }
219
+ let { version: d } = l.current, f = M.useMemo(() => /* @__PURE__ */ M.createElement(he, {
220
+ title: a,
221
+ block: e,
222
+ holdsLine: o
223
+ }), [d]);
224
+ return /* @__PURE__ */ M.createElement("span", {
225
+ key: d,
226
+ ref: c,
184
227
  className: "notion-text-editable",
185
- role: "textbox",
186
- "aria-multiline": "true",
228
+ "data-block-id": e.id,
229
+ "data-title": s,
187
230
  contentEditable: !0,
188
231
  suppressContentEditableWarning: !0,
189
- spellCheck: !0,
190
- onBlur: (t) => {
191
- let n = t.currentTarget.innerText.replace(/\n+$/, "");
192
- n !== o.current && (o.current = n, r == null || r(e.id, n));
232
+ spellCheck: !0
233
+ }, f);
234
+ }, _e = /* @__PURE__ */ new Set([
235
+ "default",
236
+ "gray",
237
+ "brown",
238
+ "orange",
239
+ "yellow",
240
+ "teal",
241
+ "green",
242
+ "blue",
243
+ "purple",
244
+ "pink",
245
+ "red"
246
+ ]), ve = (e) => {
247
+ if (!e.startsWith("notion-")) return;
248
+ let t = e.slice(7);
249
+ return _e.has(t.replace(/_background$/, "")) ? t : void 0;
250
+ };
251
+ function V(e) {
252
+ switch (e.tagName) {
253
+ case "B":
254
+ case "STRONG": return ["b"];
255
+ case "EM":
256
+ case "I": return ["i"];
257
+ case "S":
258
+ case "STRIKE":
259
+ case "DEL": return ["s"];
260
+ case "CODE": return ["c"];
261
+ case "U": return ["_"];
262
+ case "A": {
263
+ let t = e.getAttribute("href");
264
+ return t ? ["a", t] : void 0;
193
265
  }
194
- });
195
- }, ue = ["className"], de = (e) => {
196
- let { className: t } = e, n = v(e, ue);
197
- return /* @__PURE__ */ N.createElement("svg", _(_({ className: t }, n), {}, {
266
+ case "SPAN":
267
+ if (e.classList.contains("notion-inline-underscore")) return ["_"];
268
+ for (let t of Array.from(e.classList)) {
269
+ let e = ve(t);
270
+ if (e) return ["h", e];
271
+ }
272
+ return;
273
+ default: return;
274
+ }
275
+ }
276
+ var H = (e) => e.nodeType === Node.ELEMENT_NODE && e.dataset.segment !== void 0 ? e : void 0;
277
+ function U(e) {
278
+ let t = e;
279
+ for (; t.lastChild && !H(t);) t = t.lastChild;
280
+ return t !== e && t.nodeName === "BR" ? t : void 0;
281
+ }
282
+ function W(e) {
283
+ let t = [], n = U(e), r = (e, n) => {
284
+ if (!e) return;
285
+ let r = t[t.length - 1];
286
+ r && "text" in r && JSON.stringify(r.formats) === JSON.stringify(n) ? r.text += e : t.push({
287
+ text: e,
288
+ formats: n
289
+ });
290
+ }, i = (e, a) => {
291
+ if (e.nodeType === Node.TEXT_NODE) {
292
+ r(e.data.replace(/ /g, " "), a);
293
+ return;
294
+ }
295
+ let o = H(e);
296
+ if (o) {
297
+ t.push({ island: JSON.parse(o.dataset.segment) });
298
+ return;
299
+ }
300
+ if (e.nodeType !== Node.ELEMENT_NODE) return;
301
+ let s = e;
302
+ if (s.tagName === "BR") {
303
+ s !== n && r("\n", a);
304
+ return;
305
+ }
306
+ (s.tagName === "DIV" || s.tagName === "P") && s.previousSibling && r("\n", a);
307
+ let c = V(s), l = c ? [...a, c] : a;
308
+ for (let e of Array.from(s.childNodes)) i(e, l);
309
+ };
310
+ for (let t of Array.from(e.childNodes)) i(t, []);
311
+ return t.map((e) => "island" in e ? e.island : e.formats.length > 0 ? [e.text, [...e.formats].reverse()] : [e.text]);
312
+ }
313
+ function G(e) {
314
+ let t = [], n = (e) => {
315
+ if (e.nodeType === Node.TEXT_NODE || H(e) || e.nodeName === "BR") t.push(e);
316
+ else if (e.nodeType === Node.ELEMENT_NODE) for (let t of Array.from(e.childNodes)) n(t);
317
+ };
318
+ for (let t of Array.from(e.childNodes)) n(t);
319
+ return t;
320
+ }
321
+ function K(e, t) {
322
+ if (e.nodeType === Node.TEXT_NODE) return e.data.length;
323
+ let n = H(e);
324
+ return n ? JSON.parse(n.dataset.segment)[0].length : e === t ? 0 : 1;
325
+ }
326
+ var q = (e) => Array.prototype.indexOf.call(e.parentNode.childNodes, e);
327
+ function ye(e, t, n) {
328
+ var r;
329
+ let i = (r = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement) == null ? void 0 : r.closest("[data-segment]");
330
+ i && i !== e && e.contains(i) && (t = i.parentNode, n = q(i) + 1);
331
+ let a = U(e), o = 0;
332
+ for (let r of G(e)) {
333
+ if (r === t) return o + Math.min(n, K(r, a));
334
+ let i = e.ownerDocument.createRange();
335
+ if (i.selectNode(r), !(i.comparePoint(t, n) > 0 || t === i.endContainer && n === i.endOffset)) return o;
336
+ o += K(r, a);
337
+ }
338
+ return o;
339
+ }
340
+ function J(e, t) {
341
+ let n = U(e), r = Math.max(0, t), i;
342
+ for (let t of G(e)) {
343
+ let e = K(t, n);
344
+ if (t.nodeType === Node.TEXT_NODE) {
345
+ if (r <= e) return {
346
+ node: t,
347
+ offset: r
348
+ };
349
+ } else if (r === 0) return {
350
+ node: t.parentNode,
351
+ offset: q(t)
352
+ };
353
+ r -= e, t !== n && (i = t);
354
+ }
355
+ return i ? {
356
+ node: i.parentNode,
357
+ offset: q(i) + 1
358
+ } : {
359
+ node: e,
360
+ offset: 0
361
+ };
362
+ }
363
+ function be(e, t, n = t) {
364
+ let r = e.ownerDocument.getSelection();
365
+ if (!r) return;
366
+ let i = J(e, t), a = n === t ? i : J(e, n), o = e.ownerDocument.createRange();
367
+ o.setStart(i.node, i.offset), o.setEnd(a.node, a.offset), r.removeAllRanges(), r.addRange(o);
368
+ }
369
+ //#endregion
370
+ //#region src/icons/link-icon.tsx
371
+ e();
372
+ var xe = ["className"], Se = (e) => {
373
+ let { className: t } = e, n = y(e, xe);
374
+ return /* @__PURE__ */ M.createElement("svg", r(r({ className: t }, n), {}, {
198
375
  viewBox: "0 0 16 16",
199
376
  width: "16",
200
377
  height: "16"
201
- }), /* @__PURE__ */ N.createElement("path", {
378
+ }), /* @__PURE__ */ M.createElement("path", {
202
379
  fillRule: "evenodd",
203
380
  d: "M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"
204
381
  }));
205
- }, H = {}, fe = {}, U = (e) => {
206
- let t = w(), { components: n, fullPage: r, recordMap: i, mapPageUrl: a, mapImageUrl: s, showTableOfContents: l, minTableOfContentsItems: u, defaultPageIcon: d, defaultPageCover: f, defaultPageCoverPosition: p, editable: h } = t, [g, v] = N.useState(null), { block: y, children: x, level: S, className: C, bodyClassName: E, header: O, footer: ee, pageHeader: j, pageFooter: M, pageTitle: P, pageAside: z, pageCover: B, pageBody: V, hideBlockId: ue, disableHeader: U } = e;
382
+ };
383
+ //#endregion
384
+ //#region src/block.tsx
385
+ e();
386
+ var Ce = {}, we = {}, Y = (e) => {
387
+ let t = T(), { components: n, fullPage: i, recordMap: a, mapPageUrl: o, mapImageUrl: s, showTableOfContents: l, minTableOfContentsItems: d, defaultPageIcon: f, defaultPageCover: p, defaultPageCoverPosition: m, editable: h } = t, [_, v] = M.useState(null), { block: y, children: b, level: S, className: C, bodyClassName: w, header: D, footer: ee, pageHeader: A, pageFooter: j, pageTitle: ne, pageAside: re, pageCover: I, hideBlockId: ce, disableHeader: le } = e;
207
388
  if (!y) return null;
208
389
  if (S === 0 && y.type === "collection_view") {
209
390
  let e = y;
210
391
  e.type = "collection_view_page";
211
392
  }
212
- let W = ue ? "notion-block" : `notion-block-${R(y.id)}`, G = () => h && re(y) ? /* @__PURE__ */ N.createElement(le, { block: y }) : /* @__PURE__ */ N.createElement(m, {
213
- value: y.properties.title,
214
- block: y
215
- });
393
+ let R = ce ? "notion-block" : `notion-block-${L(y.id)}`, me = h && oe(y), z = () => {
394
+ var e;
395
+ return me ? /* @__PURE__ */ M.createElement(ge, { block: y }) : /* @__PURE__ */ M.createElement(g, {
396
+ value: (e = y.properties) == null ? void 0 : e.title,
397
+ block: y
398
+ });
399
+ };
216
400
  switch (y.type) {
217
401
  case "collection_view_page":
218
402
  case "page":
219
403
  if (S === 0) {
220
- let { page_icon: e = d, page_cover: a = f, page_cover_position: c = p, page_full_width: h, page_small_text: _ } = y.format || {};
221
- if (r) {
222
- var K, q;
223
- let r = y.type === "page" ? y.properties : { title: (K = i.collection[te(y, i)]) == null || (K = K.value) == null ? void 0 : K.name }, f = `center ${(1 - (c || .5)) * 100}%`, p = fe[f];
224
- p || (p = fe[f] = { objectPosition: f });
225
- let b = (q = ne(y, i)) == null ? d : q, S = b && o(b), w = I(y, i), T = l && w.length >= u, D = (T || z) && !h, F = B || a;
226
- return /* @__PURE__ */ N.createElement("div", { className: `notion notion-app ${W} ${C || ""}` }, /* @__PURE__ */ N.createElement("div", { className: "notion-viewport" }), /* @__PURE__ */ N.createElement("div", { className: "notion-frame" }, !U && /* @__PURE__ */ N.createElement(n.Header, { block: y }), O, /* @__PURE__ */ N.createElement("div", { className: "notion-page-scroller" }, F && (B || /* @__PURE__ */ N.createElement("div", { className: "notion-page-cover-wrapper" }, /* @__PURE__ */ N.createElement(k, {
227
- src: s(a, y),
228
- alt: L(r == null ? void 0 : r.title),
404
+ let { page_icon: e = f, page_cover: r = p, page_cover_position: o = m, page_full_width: u, page_small_text: h } = y.format || {};
405
+ if (i) {
406
+ var B, he;
407
+ let i = y.type === "page" ? y.properties : { title: (B = a.collection[ie(y, a)]) == null || (B = B.value) == null ? void 0 : B.name }, p = `center ${(1 - (o || .5)) * 100}%`, m = we[p];
408
+ m || (m = we[p] = { objectPosition: p });
409
+ let x = (he = ae(y, a)) == null ? f : he, S = x && c(x), T = P(y, a), E = l && T.length >= d, O = (E || re) && !u, N = I || r;
410
+ return /* @__PURE__ */ M.createElement("div", { className: `notion notion-app ${R} ${C || ""}` }, /* @__PURE__ */ M.createElement("div", { className: "notion-viewport" }), /* @__PURE__ */ M.createElement("div", { className: "notion-frame" }, !le && /* @__PURE__ */ M.createElement(n.Header, { block: y }), D, /* @__PURE__ */ M.createElement("div", { className: "notion-page-scroller" }, N && (I || /* @__PURE__ */ M.createElement("div", { className: "notion-page-cover-wrapper" }, /* @__PURE__ */ M.createElement(te, {
411
+ src: s(r, y),
412
+ alt: F(i == null ? void 0 : i.title),
229
413
  priority: !0,
230
414
  className: "notion-page-cover",
231
- style: p
232
- }))), /* @__PURE__ */ N.createElement("main", { className: `notion-page
233
- ${F ? "notion-page-has-cover" : "notion-page-no-cover"}
415
+ style: m
416
+ }))), /* @__PURE__ */ M.createElement("main", { className: `notion-page
417
+ ${N ? "notion-page-has-cover" : "notion-page-no-cover"}
234
418
  ${e ? "notion-page-has-icon" : "notion-page-no-icon"}
235
419
  ${S ? "notion-page-has-image-icon" : "notion-page-has-text-icon"}
236
420
  notion-full-page
237
- ${h && "notion-full-width"}
238
- ${_ && "notion-small-text"}
239
- ${E}` }, e && /* @__PURE__ */ N.createElement(A, {
421
+ ${u && "notion-full-width"}
422
+ ${h && "notion-small-text"}
423
+ ${w}` }, e && /* @__PURE__ */ M.createElement(k, {
240
424
  block: y,
241
- defaultIcon: d,
425
+ defaultIcon: f,
242
426
  inline: !1
243
- }), j, /* @__PURE__ */ N.createElement("h1", { className: "notion-title" }, P == null ? /* @__PURE__ */ N.createElement(m, {
244
- value: r == null ? void 0 : r.title,
427
+ }), A, /* @__PURE__ */ M.createElement("h1", { className: "notion-title" }, ne == null ? /* @__PURE__ */ M.createElement(g, {
428
+ value: i == null ? void 0 : i.title,
245
429
  block: y
246
- }) : P), (y.type === "collection_view_page" || y.type === "page" && y.parent_table === "collection") && /* @__PURE__ */ N.createElement(n.Collection, {
430
+ }) : ne), (y.type === "collection_view_page" || y.type === "page" && y.parent_table === "collection") && /* @__PURE__ */ M.createElement(n.Collection, {
247
431
  block: y,
248
432
  ctx: t
249
- }), y.type !== "collection_view_page" && /* @__PURE__ */ N.createElement("div", { className: `notion-page-content
250
- ${D && "notion-page-content-has-aside"}
251
- ${T && "notion-page-content-has-toc"}` }, /* @__PURE__ */ N.createElement("article", { className: "notion-page-content-inner" }, V == null ? x : V), D && /* @__PURE__ */ N.createElement(se, {
252
- toc: w,
253
- activeSection: g,
433
+ }), y.type !== "collection_view_page" && /* @__PURE__ */ M.createElement("div", { className: `notion-page-content
434
+ ${O && "notion-page-content-has-aside"}
435
+ ${E && "notion-page-content-has-toc"}` }, /* @__PURE__ */ M.createElement("article", { className: "notion-page-content-inner" }, b), O && /* @__PURE__ */ M.createElement(fe, {
436
+ toc: T,
437
+ activeSection: _,
254
438
  setActiveSection: v,
255
- hasToc: T,
256
- hasAside: D,
257
- pageAside: z
258
- })), M), ee)));
439
+ hasToc: E,
440
+ hasAside: O,
441
+ pageAside: re
442
+ })), j), ee)));
259
443
  }
260
- return /* @__PURE__ */ N.createElement("main", { className: `notion
444
+ return /* @__PURE__ */ M.createElement("main", { className: `notion
261
445
  notion-page
262
- ${h && "notion-full-width"}
263
- ${_ && "notion-small-text"}
264
- ${W}
446
+ ${u && "notion-full-width"}
447
+ ${h && "notion-small-text"}
448
+ ${R}
265
449
  ${C || ""}
266
- ${E}` }, /* @__PURE__ */ N.createElement("div", { className: "notion-viewport" }), j, (y.type === "collection_view_page" || y.type === "page" && y.parent_table === "collection") && /* @__PURE__ */ N.createElement(n.Collection, {
450
+ ${w}` }, /* @__PURE__ */ M.createElement("div", { className: "notion-viewport" }), A, (y.type === "collection_view_page" || y.type === "page" && y.parent_table === "collection") && /* @__PURE__ */ M.createElement(n.Collection, {
267
451
  block: y,
268
452
  ctx: t
269
- }), y.type !== "collection_view_page" && (V == null ? x : V), M);
453
+ }), y.type !== "collection_view_page" && b, j);
270
454
  }
271
455
  {
272
- var J;
273
- let e = (J = y.format) == null ? void 0 : J.block_color;
274
- return /* @__PURE__ */ N.createElement(n.PageLink, {
275
- className: `notion-page-link ${e && `notion-${e}`} ${W}`,
276
- href: a(y.id)
277
- }, /* @__PURE__ */ N.createElement(b, { block: y }));
456
+ var _e;
457
+ let e = (_e = y.format) == null ? void 0 : _e.block_color;
458
+ return /* @__PURE__ */ M.createElement(n.PageLink, {
459
+ className: `notion-page-link ${e && `notion-${e}`} ${R}`,
460
+ href: o(y.id)
461
+ }, /* @__PURE__ */ M.createElement(x, { block: y }));
278
462
  }
279
463
  case "header":
280
464
  case "sub_header":
281
465
  case "sub_sub_header": {
282
- var pe, me, he;
466
+ var ve, V, H;
283
467
  if (!y.properties) return null;
284
- let e = (pe = y.format) == null ? void 0 : pe.block_color, t = R(y.id), n = L(y.properties.title) || `Notion Header ${t}`, r = H[y.id], a;
468
+ let e = (ve = y.format) == null ? void 0 : ve.block_color, t = L(y.id), n = F(y.properties.title) || `Notion Header ${t}`, r = Ce[y.id], i;
285
469
  if (r === void 0) {
286
- let e = F(y, i);
470
+ let e = N(y, a);
287
471
  if (e) {
288
- let t = I(e, i).find((e) => e.id === y.id);
289
- t && (r = t.indentLevel, H[y.id] = r);
472
+ let t = P(e, a).find((e) => e.id === y.id);
473
+ t && (r = t.indentLevel, Ce[y.id] = r);
290
474
  }
291
475
  }
292
- r !== void 0 && (a = `notion-h-indent-${r}`);
476
+ r !== void 0 && (i = `notion-h-indent-${r}`);
293
477
  let o = y.type === "header", s = y.type === "sub_header", c = y.type === "sub_sub_header", l = `${o && "notion-h notion-h1"}
294
478
  ${s && "notion-h notion-h2"}
295
479
  ${c && "notion-h notion-h3"}
296
480
  ${e && `notion-${e}`}
297
- ${a},
298
- ${W}`, u = /* @__PURE__ */ N.createElement("span", null, /* @__PURE__ */ N.createElement("div", {
481
+ ${i},
482
+ ${R}`, u = /* @__PURE__ */ M.createElement("span", null, /* @__PURE__ */ M.createElement("div", {
299
483
  id: t,
300
484
  className: "notion-header-anchor"
301
- }), !((me = y.format) != null && me.toggleable) && /* @__PURE__ */ N.createElement("a", {
485
+ }), !((V = y.format) != null && V.toggleable) && /* @__PURE__ */ M.createElement("a", {
302
486
  className: "notion-hash-link",
303
487
  href: `#${t}`,
304
488
  title: n
305
- }, /* @__PURE__ */ N.createElement(de, null)), /* @__PURE__ */ N.createElement("span", { className: "notion-h-title" }, G())), d = null;
306
- return d = o ? /* @__PURE__ */ N.createElement("h2", {
489
+ }, /* @__PURE__ */ M.createElement(Se, null)), /* @__PURE__ */ M.createElement("span", { className: "notion-h-title" }, z())), d = null;
490
+ return d = o ? /* @__PURE__ */ M.createElement("h2", {
307
491
  className: l,
308
492
  "data-id": t
309
- }, u) : s ? /* @__PURE__ */ N.createElement("h3", {
493
+ }, u) : s ? /* @__PURE__ */ M.createElement("h3", {
310
494
  className: l,
311
495
  "data-id": t
312
- }, u) : /* @__PURE__ */ N.createElement("h4", {
496
+ }, u) : /* @__PURE__ */ M.createElement("h4", {
313
497
  className: l,
314
498
  "data-id": t
315
- }, u), (he = y.format) != null && he.toggleable ? /* @__PURE__ */ N.createElement("details", { className: `notion-toggle ${W}` }, /* @__PURE__ */ N.createElement("summary", null, d), /* @__PURE__ */ N.createElement("div", null, x)) : d;
499
+ }, u), (H = y.format) != null && H.toggleable ? /* @__PURE__ */ M.createElement("details", { className: `notion-toggle ${R}` }, /* @__PURE__ */ M.createElement("summary", null, d), /* @__PURE__ */ M.createElement("div", null, b)) : d;
316
500
  }
317
- case "divider": return /* @__PURE__ */ N.createElement("hr", { className: `notion-hr ${W}` });
501
+ case "divider": return /* @__PURE__ */ M.createElement("hr", { className: `notion-hr ${R}` });
318
502
  case "text": {
319
- var ge, _e, ve;
320
- if (!y.properties && !((ge = y.content) != null && ge.length)) return /* @__PURE__ */ N.createElement("div", { className: `notion-blank ${W}` }, "\xA0");
321
- let e = (_e = y.format) == null ? void 0 : _e.block_color;
322
- return /* @__PURE__ */ N.createElement("div", { className: `notion-text ${e && `notion-${e}`} ${W}` }, ((ve = y.properties) == null ? void 0 : ve.title) && G(), x && /* @__PURE__ */ N.createElement("div", { className: "notion-text-children" }, x));
503
+ var U, W, G;
504
+ let e = !y.properties && !((U = y.content) != null && U.length), t = (W = y.format) == null ? void 0 : W.block_color, n = e ? `notion-blank ${R}` : `notion-text ${t && `notion-${t}`} ${R}`;
505
+ return me ? /* @__PURE__ */ M.createElement("div", { className: n }, z(), b && /* @__PURE__ */ M.createElement("div", { className: "notion-text-children" }, b)) : e ? /* @__PURE__ */ M.createElement("div", { className: n }, "\xA0") : /* @__PURE__ */ M.createElement("div", { className: n }, ((G = y.properties) == null ? void 0 : G.title) && z(), b && /* @__PURE__ */ M.createElement("div", { className: "notion-text-children" }, b));
323
506
  }
324
507
  case "bulleted_list":
325
508
  case "numbered_list": {
326
- var Y;
327
- let e = (e, t) => y.type === "bulleted_list" ? /* @__PURE__ */ N.createElement("ul", { className: `notion-list notion-list-disc ${W}` }, e) : /* @__PURE__ */ N.createElement("ol", {
509
+ var K;
510
+ let e = (e, t) => y.type === "bulleted_list" ? /* @__PURE__ */ M.createElement("ul", { className: `notion-list notion-list-disc ${R}` }, e) : /* @__PURE__ */ M.createElement("ol", {
328
511
  start: t,
329
- className: `notion-list notion-list-numbered ${W}`
512
+ className: `notion-list notion-list-numbered ${R}`
330
513
  }, e), t = null;
331
- t = y.content ? /* @__PURE__ */ N.createElement(N.Fragment, null, y.properties && /* @__PURE__ */ N.createElement("li", null, G()), e(x)) : y.properties ? /* @__PURE__ */ N.createElement("li", null, G()) : null;
332
- let n = y.type !== ((Y = i.block[y.parent_id]) == null || (Y = Y.value) == null ? void 0 : Y.type), r = c(y.id, i.block);
514
+ t = y.content ? /* @__PURE__ */ M.createElement(M.Fragment, null, y.properties && /* @__PURE__ */ M.createElement("li", { "data-block-id": h ? y.id : void 0 }, z()), e(b)) : y.properties ? /* @__PURE__ */ M.createElement("li", { "data-block-id": h ? y.id : void 0 }, z()) : null;
515
+ let n = y.type !== ((K = a.block[y.parent_id]) == null || (K = K.value) == null ? void 0 : K.type), r = u(y.id, a.block);
333
516
  return n ? e(t, r) : t;
334
517
  }
335
- case "embed": return /* @__PURE__ */ N.createElement(n.Embed, {
336
- blockId: W,
518
+ case "embed": return /* @__PURE__ */ M.createElement(n.Embed, {
519
+ blockId: R,
337
520
  block: y
338
521
  });
339
522
  case "tweet":
@@ -345,102 +528,99 @@ var ie = ({ block: e, className: t }) => {
345
528
  case "excalidraw":
346
529
  case "image":
347
530
  case "gist":
348
- case "video": return /* @__PURE__ */ N.createElement(T, {
349
- blockId: W,
531
+ case "video": return /* @__PURE__ */ M.createElement(E, {
532
+ blockId: R,
350
533
  block: y
351
534
  });
352
535
  case "drive":
353
- var ye;
354
- if (!((ye = y.format) != null && ye.drive_properties)) {
355
- var be;
356
- if ((be = y.format) != null && be.display_source) return /* @__PURE__ */ N.createElement(T, {
357
- blockId: W,
536
+ var q;
537
+ if (!((q = y.format) != null && q.drive_properties)) {
538
+ var ye;
539
+ if ((ye = y.format) != null && ye.display_source) return /* @__PURE__ */ M.createElement(E, {
540
+ blockId: R,
358
541
  block: y
359
542
  });
360
543
  }
361
- return /* @__PURE__ */ N.createElement(oe, {
544
+ return /* @__PURE__ */ M.createElement(de, {
362
545
  block: y,
363
- className: W
546
+ className: R
364
547
  });
365
- case "audio": return /* @__PURE__ */ N.createElement(ie, {
548
+ case "audio": return /* @__PURE__ */ M.createElement(se, {
366
549
  block: y,
367
- className: W
550
+ className: R
368
551
  });
369
- case "file": return /* @__PURE__ */ N.createElement(ae, {
552
+ case "file": return /* @__PURE__ */ M.createElement(ue, {
370
553
  block: y,
371
- className: W
554
+ className: R
372
555
  });
373
- case "equation": return /* @__PURE__ */ N.createElement(n.Equation, {
556
+ case "equation": return /* @__PURE__ */ M.createElement(n.Equation, {
374
557
  block: y,
375
558
  inline: !1,
376
- className: W
559
+ className: R
377
560
  });
378
- case "code": return /* @__PURE__ */ N.createElement(n.Code, { block: y });
379
- case "column_list": return /* @__PURE__ */ N.createElement("div", { className: `notion-row ${W}` }, x);
561
+ case "code": return /* @__PURE__ */ M.createElement(n.Code, { block: y });
562
+ case "column_list": return /* @__PURE__ */ M.createElement("div", { className: `notion-row ${R}` }, b);
380
563
  case "column": {
381
- var xe, Se, Ce;
382
- let e = ((xe = y.format) == null ? void 0 : xe.column_ratio) || .5, t = (Se = i.block[y.parent_id]) == null ? void 0 : Se.value, n = { width: `calc((100% - (${((t == null || (Ce = t.content) == null ? void 0 : Ce.length) || Math.max(2, Math.ceil(1 / e))) - 1} * min(32px, 4vw))) * ${e})` };
383
- return /* @__PURE__ */ N.createElement(N.Fragment, null, /* @__PURE__ */ N.createElement("div", {
384
- className: `notion-column ${W}`,
564
+ var J, be, xe;
565
+ let e = ((J = y.format) == null ? void 0 : J.column_ratio) || .5, t = (be = a.block[y.parent_id]) == null ? void 0 : be.value, n = { width: `calc((100% - (${((t == null || (xe = t.content) == null ? void 0 : xe.length) || Math.max(2, Math.ceil(1 / e))) - 1} * min(32px, 4vw))) * ${e})` };
566
+ return /* @__PURE__ */ M.createElement(M.Fragment, null, /* @__PURE__ */ M.createElement("div", {
567
+ className: `notion-column ${R}`,
385
568
  style: n
386
- }, x), /* @__PURE__ */ N.createElement("div", { className: "notion-spacer" }));
569
+ }, b), /* @__PURE__ */ M.createElement("div", { className: "notion-spacer" }));
387
570
  }
388
571
  case "quote": {
389
- var we;
572
+ var Y;
390
573
  if (!y.properties) return null;
391
- let e = (we = y.format) == null ? void 0 : we.block_color;
392
- return /* @__PURE__ */ N.createElement("blockquote", { className: `notion-quote ${e && `notion-${e}`} ${W}` }, /* @__PURE__ */ N.createElement("div", null, /* @__PURE__ */ N.createElement(m, {
393
- value: y.properties.title,
394
- block: y
395
- })), x);
574
+ let e = (Y = y.format) == null ? void 0 : Y.block_color;
575
+ return /* @__PURE__ */ M.createElement("blockquote", { className: `notion-quote ${e && `notion-${e}`} ${R}` }, /* @__PURE__ */ M.createElement("div", null, z()), b);
396
576
  }
397
- case "collection_view": return /* @__PURE__ */ N.createElement(n.Collection, {
577
+ case "collection_view": return /* @__PURE__ */ M.createElement(n.Collection, {
398
578
  block: y,
399
- className: W,
579
+ className: R,
400
580
  ctx: t
401
581
  });
402
582
  case "callout":
403
- var Te, Ee, De;
404
- return n.Callout ? /* @__PURE__ */ N.createElement(n.Callout, {
583
+ var Te, X, Ee;
584
+ return n.Callout ? /* @__PURE__ */ M.createElement(n.Callout, {
405
585
  block: y,
406
- className: W
407
- }) : /* @__PURE__ */ N.createElement("div", { className: `notion-callout ${((Te = y.format) == null ? void 0 : Te.block_color) && `notion-${(Ee = y.format) == null ? void 0 : Ee.block_color}_co`} ${W}` }, /* @__PURE__ */ N.createElement(A, { block: y }), /* @__PURE__ */ N.createElement("div", { className: "notion-callout-text" }, /* @__PURE__ */ N.createElement(m, {
408
- value: (De = y.properties) == null ? void 0 : De.title,
586
+ className: R
587
+ }) : /* @__PURE__ */ M.createElement("div", { className: `notion-callout ${((Te = y.format) == null ? void 0 : Te.block_color) && `notion-${(X = y.format) == null ? void 0 : X.block_color}_co`} ${R}` }, /* @__PURE__ */ M.createElement(k, { block: y }), /* @__PURE__ */ M.createElement("div", { className: "notion-callout-text" }, /* @__PURE__ */ M.createElement(g, {
588
+ value: (Ee = y.properties) == null ? void 0 : Ee.title,
409
589
  block: y
410
- }), x));
590
+ }), b));
411
591
  case "bookmark": {
412
- var Oe, ke, Ae, je, Me, Ne, Pe, Fe, Ie;
592
+ var Z, De, Oe, ke, Ae, je, Me, Ne, Pe;
413
593
  if (!y.properties) return null;
414
594
  let e = y.properties.link;
415
- if (!e || !((Oe = e[0]) != null && Oe[0])) return null;
416
- let t = L(y.properties.title);
417
- if (t || (t = L(e)), t && t.startsWith("http")) try {
595
+ if (!e || !((Z = e[0]) != null && Z[0])) return null;
596
+ let t = F(y.properties.title);
597
+ if (t || (t = F(e)), t && t.startsWith("http")) try {
418
598
  t = new URL(t).hostname;
419
599
  } catch (e) {}
420
- return /* @__PURE__ */ N.createElement("div", { className: "notion-row" }, /* @__PURE__ */ N.createElement(n.Link, {
600
+ return /* @__PURE__ */ M.createElement("div", { className: "notion-row" }, /* @__PURE__ */ M.createElement(n.Link, {
421
601
  target: "_blank",
422
602
  rel: "noopener noreferrer",
423
- className: `notion-bookmark ${(ke = y.format) != null && ke.block_color ? `notion-${y.format.block_color}` : ""} ${W}`,
603
+ className: `notion-bookmark ${(De = y.format) != null && De.block_color ? `notion-${y.format.block_color}` : ""} ${R}`,
424
604
  href: e[0][0]
425
- }, /* @__PURE__ */ N.createElement("div", null, t && /* @__PURE__ */ N.createElement("div", { className: "notion-bookmark-title" }, /* @__PURE__ */ N.createElement(m, {
605
+ }, /* @__PURE__ */ M.createElement("div", null, t && /* @__PURE__ */ M.createElement("div", { className: "notion-bookmark-title" }, /* @__PURE__ */ M.createElement(g, {
426
606
  value: [[t]],
427
607
  block: y
428
- })), ((Ae = y.properties) == null ? void 0 : Ae.description) && /* @__PURE__ */ N.createElement("div", { className: "notion-bookmark-description" }, /* @__PURE__ */ N.createElement(m, {
429
- value: (je = y.properties) == null ? void 0 : je.description,
608
+ })), ((Oe = y.properties) == null ? void 0 : Oe.description) && /* @__PURE__ */ M.createElement("div", { className: "notion-bookmark-description" }, /* @__PURE__ */ M.createElement(g, {
609
+ value: (ke = y.properties) == null ? void 0 : ke.description,
430
610
  block: y
431
- })), /* @__PURE__ */ N.createElement("div", { className: "notion-bookmark-link" }, ((Me = y.format) == null ? void 0 : Me.bookmark_icon) && /* @__PURE__ */ N.createElement("div", { className: "notion-bookmark-link-icon" }, /* @__PURE__ */ N.createElement(k, {
432
- src: s((Ne = y.format) == null ? void 0 : Ne.bookmark_icon, y),
611
+ })), /* @__PURE__ */ M.createElement("div", { className: "notion-bookmark-link" }, ((Ae = y.format) == null ? void 0 : Ae.bookmark_icon) && /* @__PURE__ */ M.createElement("div", { className: "notion-bookmark-link-icon" }, /* @__PURE__ */ M.createElement(te, {
612
+ src: s((je = y.format) == null ? void 0 : je.bookmark_icon, y),
433
613
  alt: t,
434
614
  onError: (e) => {
435
615
  let t = e.currentTarget.closest(".notion-bookmark-link-icon");
436
616
  t && (t.style.display = "none");
437
617
  }
438
- })), /* @__PURE__ */ N.createElement("div", { className: "notion-bookmark-link-text" }, /* @__PURE__ */ N.createElement(m, {
618
+ })), /* @__PURE__ */ M.createElement("div", { className: "notion-bookmark-link-text" }, /* @__PURE__ */ M.createElement(g, {
439
619
  value: e,
440
620
  block: y
441
- })))), ((Pe = y.format) == null ? void 0 : Pe.bookmark_cover) && /* @__PURE__ */ N.createElement("div", { className: "notion-bookmark-image" }, /* @__PURE__ */ N.createElement(k, {
442
- src: s((Fe = y.format) == null ? void 0 : Fe.bookmark_cover, y).replace(/(\/\/i\.ytimg\.com\/.*?)maxresdefault/, "$1hqdefault"),
443
- alt: L((Ie = y.properties) == null ? void 0 : Ie.title),
621
+ })))), ((Me = y.format) == null ? void 0 : Me.bookmark_cover) && /* @__PURE__ */ M.createElement("div", { className: "notion-bookmark-image" }, /* @__PURE__ */ M.createElement(te, {
622
+ src: s((Ne = y.format) == null ? void 0 : Ne.bookmark_cover, y).replace(/(\/\/i\.ytimg\.com\/.*?)maxresdefault/, "$1hqdefault"),
623
+ alt: F((Pe = y.properties) == null ? void 0 : Pe.title),
444
624
  style: { objectFit: "cover" },
445
625
  onError: (e) => {
446
626
  let t = e.currentTarget.closest(".notion-bookmark-image");
@@ -448,22 +628,17 @@ var ie = ({ block: e, className: t }) => {
448
628
  }
449
629
  }))));
450
630
  }
451
- case "toggle":
452
- var Le;
453
- return /* @__PURE__ */ N.createElement("details", { className: `notion-toggle ${W}` }, /* @__PURE__ */ N.createElement("summary", null, /* @__PURE__ */ N.createElement(m, {
454
- value: (Le = y.properties) == null ? void 0 : Le.title,
455
- block: y
456
- })), /* @__PURE__ */ N.createElement("div", null, x));
631
+ case "toggle": return /* @__PURE__ */ M.createElement("details", { className: `notion-toggle ${R}` }, /* @__PURE__ */ M.createElement("summary", null, z()), /* @__PURE__ */ M.createElement("div", null, b));
457
632
  case "table_of_contents": {
458
- var X;
459
- let e = F(y, i);
633
+ var Fe;
634
+ let e = N(y, a);
460
635
  if (!e) return null;
461
- let t = I(e, i), n = (X = y.format) == null ? void 0 : X.block_color;
462
- return /* @__PURE__ */ N.createElement("div", { className: `notion-table-of-contents ${n && `notion-${n}`} ${W}` }, t.map((e) => /* @__PURE__ */ N.createElement("a", {
636
+ let t = P(e, a), n = (Fe = y.format) == null ? void 0 : Fe.block_color;
637
+ return /* @__PURE__ */ M.createElement("div", { className: `notion-table-of-contents ${n && `notion-${n}`} ${R}` }, t.map((e) => /* @__PURE__ */ M.createElement("a", {
463
638
  key: e.id,
464
- href: `#${R(e.id)}`,
639
+ href: `#${L(e.id)}`,
465
640
  className: "notion-table-of-contents-item"
466
- }, /* @__PURE__ */ N.createElement("span", {
641
+ }, /* @__PURE__ */ M.createElement("span", {
467
642
  className: "notion-table-of-contents-item-body",
468
643
  style: {
469
644
  display: "inline-block",
@@ -472,53 +647,54 @@ var ie = ({ block: e, className: t }) => {
472
647
  }, e.text))));
473
648
  }
474
649
  case "to_do": {
475
- var Z, Re;
476
- let e = ((Z = y.properties) == null || (Z = Z.checked) == null || (Z = Z[0]) == null ? void 0 : Z[0]) === "Yes";
477
- return /* @__PURE__ */ N.createElement("div", { className: `notion-to-do ${W}` }, /* @__PURE__ */ N.createElement("div", { className: "notion-to-do-item" }, /* @__PURE__ */ N.createElement(n.Checkbox, {
478
- blockId: W,
650
+ var Q;
651
+ let e = ((Q = y.properties) == null || (Q = Q.checked) == null || (Q = Q[0]) == null ? void 0 : Q[0]) === "Yes";
652
+ return /* @__PURE__ */ M.createElement("div", { className: `notion-to-do ${R}` }, /* @__PURE__ */ M.createElement("div", { className: "notion-to-do-item" }, /* @__PURE__ */ M.createElement(n.Checkbox, {
653
+ blockId: R,
479
654
  isChecked: e
480
- }), /* @__PURE__ */ N.createElement("div", { className: `notion-to-do-body ${e && "notion-to-do-checked"}` }, /* @__PURE__ */ N.createElement(m, {
481
- value: (Re = y.properties) == null ? void 0 : Re.title,
482
- block: y
483
- }))), /* @__PURE__ */ N.createElement("div", { className: "notion-to-do-children" }, x));
655
+ }), /* @__PURE__ */ M.createElement("div", { className: `notion-to-do-body ${e && "notion-to-do-checked"}` }, z())), /* @__PURE__ */ M.createElement("div", { className: "notion-to-do-children" }, b));
484
656
  }
485
- case "transclusion_container": return /* @__PURE__ */ N.createElement("div", { className: `notion-sync-block ${W}` }, x);
486
- case "transclusion_reference": return /* @__PURE__ */ N.createElement(ce, _({
657
+ case "transclusion_container": return /* @__PURE__ */ M.createElement("div", { className: `notion-sync-block ${R}` }, b);
658
+ case "transclusion_reference": return /* @__PURE__ */ M.createElement(pe, r({
487
659
  block: y,
488
660
  level: S + 1
489
661
  }, e));
490
662
  case "alias": {
491
- var Q, ze;
492
- let e = y == null || (Q = y.format) == null || (Q = Q.alias_pointer) == null ? void 0 : Q.id, t = (ze = i.block[e]) == null ? void 0 : ze.value;
493
- return t ? /* @__PURE__ */ N.createElement(n.PageLink, {
663
+ var $, Ie;
664
+ let e = y == null || ($ = y.format) == null || ($ = $.alias_pointer) == null ? void 0 : $.id, t = (Ie = a.block[e]) == null ? void 0 : Ie.value;
665
+ return t ? /* @__PURE__ */ M.createElement(n.PageLink, {
494
666
  className: `notion-page-link ${e}}`,
495
- href: a(e)
496
- }, /* @__PURE__ */ N.createElement(b, { block: t })) : (console.debug("\"alias\" missing block", e), null);
667
+ href: o(e)
668
+ }, /* @__PURE__ */ M.createElement(x, { block: t })) : (console.debug("\"alias\" missing block", e), null);
497
669
  }
498
- case "table": return /* @__PURE__ */ N.createElement("table", { className: `notion-simple-table ${W}` }, /* @__PURE__ */ N.createElement("tbody", null, x));
670
+ case "table": return /* @__PURE__ */ M.createElement("table", { className: `notion-simple-table ${R}` }, /* @__PURE__ */ M.createElement("tbody", null, b));
499
671
  case "table_row": {
500
- var Be, Ve, He, $;
501
- let e = (Be = i.block[y.parent_id]) == null ? void 0 : Be.value, t = (Ve = e.format) == null ? void 0 : Ve.table_block_column_order, n = (He = e.format) == null ? void 0 : He.table_block_column_format, r = ($ = y.format) == null ? void 0 : $.block_color;
502
- return !e || !t ? null : /* @__PURE__ */ N.createElement("tr", { className: `notion-simple-table-row ${r && `notion-${r}`} ${W}` }, t.map((e) => {
672
+ var Le, Re, ze, Be;
673
+ let e = (Le = a.block[y.parent_id]) == null ? void 0 : Le.value, t = (Re = e.format) == null ? void 0 : Re.table_block_column_order, n = (ze = e.format) == null ? void 0 : ze.table_block_column_format, r = (Be = y.format) == null ? void 0 : Be.block_color;
674
+ return !e || !t ? null : /* @__PURE__ */ M.createElement("tr", { className: `notion-simple-table-row ${r && `notion-${r}`} ${R}` }, t.map((e) => {
503
675
  var t, r, i;
504
676
  let a = n == null || (t = n[e]) == null ? void 0 : t.color;
505
- return /* @__PURE__ */ N.createElement("td", {
677
+ return /* @__PURE__ */ M.createElement("td", {
506
678
  key: e,
507
679
  className: a ? `notion-${a}` : "",
508
680
  style: { width: (n == null || (r = n[e]) == null ? void 0 : r.width) || 120 }
509
- }, /* @__PURE__ */ N.createElement("div", { className: "notion-simple-table-cell" }, /* @__PURE__ */ N.createElement(m, {
681
+ }, /* @__PURE__ */ M.createElement("div", { className: "notion-simple-table-cell" }, /* @__PURE__ */ M.createElement(g, {
510
682
  value: ((i = y.properties) == null ? void 0 : i[e]) || [["ㅤ"]],
511
683
  block: y
512
684
  })));
513
685
  }));
514
686
  }
515
- case "external_object_instance": return /* @__PURE__ */ N.createElement(D, {
687
+ case "external_object_instance": return /* @__PURE__ */ M.createElement(O, {
516
688
  block: y,
517
- className: W
689
+ className: R
518
690
  });
519
- default: return process.env.NODE_ENV !== "production" && console.debug("Unsupported type " + y.type, JSON.stringify(y, null, 2)), /* @__PURE__ */ N.createElement("div", null);
691
+ default: return process.env.NODE_ENV !== "production" && console.debug("Unsupported type " + y.type, JSON.stringify(y, null, 2)), /* @__PURE__ */ M.createElement("div", null);
520
692
  }
521
- }, W = [
693
+ };
694
+ //#endregion
695
+ //#region src/renderer.tsx
696
+ e();
697
+ var Te = [
522
698
  "components",
523
699
  "recordMap",
524
700
  "mapPageUrl",
@@ -542,15 +718,14 @@ var ie = ({ block: e, className: t }) => {
542
718
  "defaultPageIcon",
543
719
  "defaultPageCover",
544
720
  "defaultPageCoverPosition",
545
- "editable",
546
- "onChangeBlock"
547
- ], G = ["level", "blockId"], K = (e) => {
548
- let { components: t, recordMap: n, mapPageUrl: r, mapImageUrl: i, searchNotion: a, isShowingSearch: o, onHideSearch: s, fullPage: c, rootPageId: l, rootDomain: d, rootSpaceId: f, darkMode: p, previewImages: m, forceCustomImages: h, showCollectionViewDropdown: g, linkTableTitleProperties: _, isLinkCollectionToUrlProperty: y, isImageZoomable: b = !0, showTableOfContents: x, minTableOfContentsItems: S, defaultPageIcon: C, defaultPageCover: w, defaultPageCoverPosition: T, editable: E, onChangeBlock: D } = e, O = v(e, W), k = N.useMemo(() => typeof window < "u" && P({
721
+ "editable"
722
+ ], X = ["level", "blockId"], Ee = (e) => {
723
+ let { components: t, recordMap: n, mapPageUrl: r, mapImageUrl: i, searchNotion: a, isShowingSearch: o, onHideSearch: s, fullPage: c, rootPageId: l, rootDomain: u, rootSpaceId: d, darkMode: p, previewImages: m, forceCustomImages: h, showCollectionViewDropdown: g, linkTableTitleProperties: _, isLinkCollectionToUrlProperty: v, isImageZoomable: b = !0, showTableOfContents: x, minTableOfContentsItems: S, defaultPageIcon: C, defaultPageCover: w, defaultPageCoverPosition: T, editable: E } = e, D = y(e, Te), O = M.useMemo(() => typeof window < "u" && re({
549
724
  background: "rgba(0, 0, 0, 0.8)",
550
725
  minZoomScale: 2,
551
- margin: J()
726
+ margin: De()
552
727
  }), []);
553
- return /* @__PURE__ */ N.createElement(u, {
728
+ return /* @__PURE__ */ M.createElement(f, {
554
729
  components: t,
555
730
  recordMap: n,
556
731
  mapPageUrl: r,
@@ -560,41 +735,40 @@ var ie = ({ block: e, className: t }) => {
560
735
  onHideSearch: s,
561
736
  fullPage: c,
562
737
  rootPageId: l,
563
- rootDomain: d,
564
- rootSpaceId: f,
738
+ rootDomain: u,
739
+ rootSpaceId: d,
565
740
  darkMode: p,
566
741
  previewImages: m,
567
742
  forceCustomImages: h,
568
743
  showCollectionViewDropdown: g,
569
744
  linkTableTitleProperties: _,
570
- isLinkCollectionToUrlProperty: y,
745
+ isLinkCollectionToUrlProperty: v,
571
746
  showTableOfContents: x,
572
747
  minTableOfContentsItems: S,
573
748
  defaultPageIcon: C,
574
749
  defaultPageCover: w,
575
750
  defaultPageCoverPosition: T,
576
751
  editable: E,
577
- onChangeBlock: D,
578
- zoom: b ? k : null
579
- }, /* @__PURE__ */ N.createElement(q, O));
580
- }, q = (e) => {
752
+ zoom: b ? O : null
753
+ }, /* @__PURE__ */ M.createElement(Z, D));
754
+ }, Z = (e) => {
581
755
  var t, n;
582
- let { level: r = 0, blockId: i } = e, a = v(e, G), { recordMap: o } = w(), s = i || Object.keys(o.block)[0], c = (t = o.block[s]) == null ? void 0 : t.value;
583
- return c ? /* @__PURE__ */ N.createElement(U, _({
584
- key: s,
585
- level: r,
586
- block: c
587
- }, a), c == null || (n = c.content) == null ? void 0 : n.map((e) => /* @__PURE__ */ N.createElement(q, _({
756
+ let { level: i = 0, blockId: a } = e, o = y(e, X), { recordMap: s } = T(), c = a || Object.keys(s.block)[0], l = (t = s.block[c]) == null ? void 0 : t.value;
757
+ return l ? /* @__PURE__ */ M.createElement(Y, r({
758
+ key: c,
759
+ level: i,
760
+ block: l
761
+ }, o), l == null || (n = l.content) == null ? void 0 : n.map((e) => /* @__PURE__ */ M.createElement(Z, r({
588
762
  key: e,
589
763
  blockId: e,
590
- level: r + 1
591
- }, a)))) : (process.env.NODE_ENV !== "production" && console.warn("missing block", i), null);
764
+ level: i + 1
765
+ }, o)))) : (process.env.NODE_ENV !== "production" && console.warn("missing block", a), null);
592
766
  };
593
- function J() {
767
+ function De() {
594
768
  let e = window.innerWidth;
595
769
  return e < 500 ? 8 : e < 800 ? 20 : e < 1280 ? 30 : e < 1600 ? 40 : e < 1920 ? 48 : 72;
596
770
  }
597
771
  //#endregion
598
- export { x as Asset, T as AssetWrapper, ie as Audio, U as Block, f as Breadcrumbs, n as Checkbox, M as CollectionColumnTitle, D as EOI, ae as File, oe as GoogleDrive, l as GracefulImage, y as Header, C as LiteYouTubeEmbed, q as NotionBlockRenderer, g as NotionContextConsumer, u as NotionContextProvider, K as NotionRenderer, se as PageAside, A as PageIcon, d as PageIconImpl, b as PageTitle, h as PageTitleImpl, ee as PropertyIcon, E as Search, p as SearchDialog, ce as SyncPointerBlock, m as Text, S as dummyLink, s as formatDate, r as formatNotionDateTime, O as getHashFragmentValue, c as getListNumber, a as getYoutubeId, j as iconMap, i as isBrowser, o as isUrl, w as useNotionContext };
772
+ export { S as Asset, E as AssetWrapper, se as Audio, Y as Block, m as Breadcrumbs, i as Checkbox, ne as CollectionColumnTitle, O as EOI, ge as EditableText, ue as File, de as GoogleDrive, d as GracefulImage, b as Header, w as LiteYouTubeEmbed, Z as NotionBlockRenderer, v as NotionContextConsumer, f as NotionContextProvider, Ee as NotionRenderer, fe as PageAside, k as PageIcon, p as PageIconImpl, x as PageTitle, _ as PageTitleImpl, A as PropertyIcon, D as Search, h as SearchDialog, pe as SyncPointerBlock, g as Text, C as dummyLink, l as formatDate, a as formatNotionDateTime, ee as getHashFragmentValue, u as getListNumber, s as getYoutubeId, j as iconMap, o as isBrowser, B as isTitleIsland, c as isUrl, W as readTitle, be as selectTitle, ye as titleOffset, J as titlePosition, T as useNotionContext };
599
773
 
600
774
  //# sourceMappingURL=index.js.map