@texonom/nreact 1.4.7 → 1.5.1

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.
Files changed (141) hide show
  1. package/build/_commonjsHelpers-bAxELxBV.js +9 -0
  2. package/build/_commonjsHelpers-bAxELxBV.js.map +1 -0
  3. package/build/asset-wrapper-CmbIDPIw.js +921 -0
  4. package/build/asset-wrapper-CmbIDPIw.js.map +1 -0
  5. package/build/block.d.ts +20 -20
  6. package/build/collection-column-title-l4hmVo49.js +99 -0
  7. package/build/collection-column-title-l4hmVo49.js.map +1 -0
  8. package/build/components/asset-wrapper.d.ts +6 -6
  9. package/build/components/asset.d.ts +7 -7
  10. package/build/components/audio.d.ts +6 -6
  11. package/build/components/checkbox.d.ts +5 -5
  12. package/build/components/eoi.d.ts +7 -7
  13. package/build/components/file.d.ts +6 -6
  14. package/build/components/google-drive.d.ts +6 -6
  15. package/build/components/graceful-image.d.ts +3 -3
  16. package/build/components/header.d.ts +15 -15
  17. package/build/components/lazy-image.d.ts +13 -13
  18. package/build/components/lite-youtube-embed.d.ts +13 -13
  19. package/build/components/page-aside.d.ts +11 -11
  20. package/build/components/page-icon.d.ts +16 -16
  21. package/build/components/page-title.d.ts +12 -12
  22. package/build/components/search-dialog.d.ts +26 -26
  23. package/build/components/search-dialog.d.ts.map +1 -1
  24. package/build/components/sync-pointer-block.d.ts +6 -6
  25. package/build/components/text.d.ts +19 -19
  26. package/build/context.d.ts +64 -64
  27. package/build/context.d.ts.map +1 -1
  28. package/build/icons/check.d.ts +3 -3
  29. package/build/icons/chevron-down-icon.d.ts +2 -2
  30. package/build/icons/clear-icon.d.ts +2 -2
  31. package/build/icons/collection-view-board.d.ts +3 -3
  32. package/build/icons/collection-view-calendar.d.ts +3 -3
  33. package/build/icons/collection-view-gallery.d.ts +3 -3
  34. package/build/icons/collection-view-icon.d.ts +8 -8
  35. package/build/icons/collection-view-list.d.ts +3 -3
  36. package/build/icons/collection-view-table.d.ts +3 -3
  37. package/build/icons/copy.d.ts +3 -3
  38. package/build/icons/default-page-icon.d.ts +2 -2
  39. package/build/icons/empty-icon.d.ts +2 -2
  40. package/build/icons/file-icon.d.ts +2 -2
  41. package/build/icons/link-icon.d.ts +2 -2
  42. package/build/icons/loading-icon.d.ts +2 -2
  43. package/build/icons/property-icon.d.ts +44 -44
  44. package/build/icons/search-icon.d.ts +2 -2
  45. package/build/icons/type-checkbox.d.ts +3 -3
  46. package/build/icons/type-date.d.ts +3 -3
  47. package/build/icons/type-email.d.ts +3 -3
  48. package/build/icons/type-file.d.ts +3 -3
  49. package/build/icons/type-formula.d.ts +3 -3
  50. package/build/icons/type-github.d.ts +3 -3
  51. package/build/icons/type-multi-select.d.ts +3 -3
  52. package/build/icons/type-number.d.ts +3 -3
  53. package/build/icons/type-person-2.d.ts +3 -3
  54. package/build/icons/type-person.d.ts +3 -3
  55. package/build/icons/type-phone-number.d.ts +3 -3
  56. package/build/icons/type-relation.d.ts +3 -3
  57. package/build/icons/type-select.d.ts +3 -3
  58. package/build/icons/type-text.d.ts +3 -3
  59. package/build/icons/type-timestamp.d.ts +3 -3
  60. package/build/icons/type-title.d.ts +3 -3
  61. package/build/icons/type-url.d.ts +3 -3
  62. package/build/index.d.ts +24 -24
  63. package/build/index.js +478 -691
  64. package/build/index.js.map +1 -0
  65. package/build/next.d.ts +1 -1
  66. package/build/renderer.d.ts +50 -50
  67. package/build/third-party/code.d.ts +7 -16
  68. package/build/third-party/code.js +174 -114
  69. package/build/third-party/code.js.map +1 -0
  70. package/build/third-party/collection-card.d.ts +3 -3
  71. package/build/third-party/collection-card.d.ts.map +1 -1
  72. package/build/third-party/collection-column-title.d.ts +5 -5
  73. package/build/third-party/collection-group.d.ts +3 -3
  74. package/build/third-party/collection-row.d.ts +7 -7
  75. package/build/third-party/collection-utils.d.ts +2 -2
  76. package/build/third-party/collection-view-board.d.ts +3 -3
  77. package/build/third-party/collection-view-gallery.d.ts +3 -3
  78. package/build/third-party/collection-view-list.d.ts +3 -3
  79. package/build/third-party/collection-view-table.d.ts +3 -3
  80. package/build/third-party/collection-view.d.ts +4 -4
  81. package/build/third-party/collection.d.ts +14 -14
  82. package/build/third-party/collection.js +2295 -3321
  83. package/build/third-party/collection.js.map +1 -0
  84. package/build/third-party/equation.d.ts +8 -8
  85. package/build/third-party/equation.js +35 -25
  86. package/build/third-party/equation.js.map +1 -0
  87. package/build/third-party/eval-formula.d.ts +20 -20
  88. package/build/third-party/modal.d.ts +2 -2
  89. package/build/third-party/modal.js +3 -5
  90. package/build/third-party/modal.js.map +1 -0
  91. package/build/third-party/pdf.d.ts +4 -4
  92. package/build/third-party/property.d.ts +21 -21
  93. package/build/types.d.ts +93 -93
  94. package/build/utils.d.ts +6 -6
  95. package/package.json +13 -13
  96. package/readme.md +59 -0
  97. package/LICENSE +0 -21
  98. package/README.md +0 -19
  99. package/build/.tsbuildinfo +0 -1
  100. package/build/chunk-2U7I3XVC.js +0 -157
  101. package/build/chunk-72RHNPWF.js +0 -1307
  102. package/build/chunk-C6BUIPAM.js +0 -83
  103. package/build/chunk-FCO7MUK6.js +0 -83
  104. package/build/chunk-H4QYS6CQ.js +0 -1185
  105. package/build/chunk-IMWLLIUB.js +0 -1182
  106. package/build/chunk-P7HX4BAT.js +0 -156
  107. package/build/chunk-VP33CFNB.js +0 -1358
  108. package/build/chunk-YMM43AZ3.js +0 -1207
  109. package/build/dev/chunk-64UJZ76E.js +0 -1308
  110. package/build/dev/chunk-64UJZ76E.js.map +0 -1
  111. package/build/dev/chunk-ABDRHJEI.js +0 -157
  112. package/build/dev/chunk-ABDRHJEI.js.map +0 -1
  113. package/build/dev/chunk-N6EDMIQD.js +0 -1359
  114. package/build/dev/chunk-N6EDMIQD.js.map +0 -1
  115. package/build/dev/chunk-OAIRL2FN.js +0 -84
  116. package/build/dev/chunk-OAIRL2FN.js.map +0 -1
  117. package/build/dev/chunk-P3V5A3W4.js +0 -1183
  118. package/build/dev/chunk-P3V5A3W4.js.map +0 -1
  119. package/build/dev/chunk-PM5CWL6O.js +0 -158
  120. package/build/dev/chunk-PM5CWL6O.js.map +0 -1
  121. package/build/dev/chunk-Q4G2SZRD.js +0 -84
  122. package/build/dev/chunk-Q4G2SZRD.js.map +0 -1
  123. package/build/dev/chunk-SEA7YL2O.js +0 -1308
  124. package/build/dev/chunk-SEA7YL2O.js.map +0 -1
  125. package/build/dev/chunk-SVHGWLRK.js +0 -1208
  126. package/build/dev/chunk-SVHGWLRK.js.map +0 -1
  127. package/build/dev/chunk-ZJAJPWJX.js +0 -1186
  128. package/build/dev/chunk-ZJAJPWJX.js.map +0 -1
  129. package/build/dev/index.js +0 -890
  130. package/build/dev/index.js.map +0 -1
  131. package/build/dev/third-party/code.js +0 -140
  132. package/build/dev/third-party/code.js.map +0 -1
  133. package/build/dev/third-party/collection.js +0 -4382
  134. package/build/dev/third-party/collection.js.map +0 -1
  135. package/build/dev/third-party/equation.js +0 -35
  136. package/build/dev/third-party/equation.js.map +0 -1
  137. package/build/dev/third-party/modal.js +0 -8
  138. package/build/dev/third-party/modal.js.map +0 -1
  139. package/build/dev/third-party/pdf.js +0 -21
  140. package/build/dev/third-party/pdf.js.map +0 -1
  141. package/build/third-party/pdf.js +0 -20
package/build/index.js CHANGED
@@ -1,506 +1,359 @@
1
- import {
2
- CollectionColumnTitle,
3
- PropertyIcon,
4
- iconMap
5
- } from "./chunk-P7HX4BAT.js";
6
- import {
7
- Asset,
8
- AssetWrapper,
9
- Breadcrumbs,
10
- Checkbox,
11
- EOI,
12
- GracefulImage,
13
- Header,
14
- LazyImage,
15
- LiteYouTubeEmbed,
16
- NotionContextConsumer,
17
- NotionContextProvider,
18
- PageIcon,
19
- PageIconImpl,
20
- PageTitle,
21
- PageTitleImpl,
22
- Search,
23
- SearchDialog,
24
- Text,
25
- dummyLink,
26
- formatDate,
27
- formatNotionDateTime,
28
- getHashFragmentValue,
29
- getListNumber,
30
- getYoutubeId,
31
- isBrowser,
32
- isUrl,
33
- useNotionContext
34
- } from "./chunk-YMM43AZ3.js";
35
- import {
36
- __commonJS,
37
- __objRest,
38
- __spreadProps,
39
- __spreadValues,
40
- __toESM
41
- } from "./chunk-C6BUIPAM.js";
42
-
43
- // ../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js
44
- var require_lodash = __commonJS({
45
- "../../node_modules/.pnpm/lodash.throttle@4.1.1/node_modules/lodash.throttle/index.js"(exports, module) {
46
- var FUNC_ERROR_TEXT = "Expected a function";
47
- var NAN = 0 / 0;
48
- var symbolTag = "[object Symbol]";
49
- var reTrim = /^\s+|\s+$/g;
50
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
51
- var reIsBinary = /^0b[01]+$/i;
52
- var reIsOctal = /^0o[0-7]+$/i;
53
- var freeParseInt = parseInt;
54
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
55
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
56
- var root = freeGlobal || freeSelf || Function("return this")();
57
- var objectProto = Object.prototype;
58
- var objectToString = objectProto.toString;
59
- var nativeMax = Math.max;
60
- var nativeMin = Math.min;
61
- var now = function() {
62
- return root.Date.now();
63
- };
64
- function debounce(func, wait, options) {
65
- var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
66
- if (typeof func != "function") {
67
- throw new TypeError(FUNC_ERROR_TEXT);
68
- }
69
- wait = toNumber(wait) || 0;
70
- if (isObject(options)) {
71
- leading = !!options.leading;
72
- maxing = "maxWait" in options;
73
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
74
- trailing = "trailing" in options ? !!options.trailing : trailing;
75
- }
76
- function invokeFunc(time) {
77
- var args = lastArgs, thisArg = lastThis;
78
- lastArgs = lastThis = void 0;
79
- lastInvokeTime = time;
80
- result = func.apply(thisArg, args);
81
- return result;
82
- }
83
- function leadingEdge(time) {
84
- lastInvokeTime = time;
85
- timerId = setTimeout(timerExpired, wait);
86
- return leading ? invokeFunc(time) : result;
87
- }
88
- function remainingWait(time) {
89
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, result2 = wait - timeSinceLastCall;
90
- return maxing ? nativeMin(result2, maxWait - timeSinceLastInvoke) : result2;
91
- }
92
- function shouldInvoke(time) {
93
- var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
94
- return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
95
- }
96
- function timerExpired() {
97
- var time = now();
98
- if (shouldInvoke(time)) {
99
- return trailingEdge(time);
100
- }
101
- timerId = setTimeout(timerExpired, remainingWait(time));
102
- }
103
- function trailingEdge(time) {
104
- timerId = void 0;
105
- if (trailing && lastArgs) {
106
- return invokeFunc(time);
107
- }
108
- lastArgs = lastThis = void 0;
109
- return result;
110
- }
111
- function cancel() {
112
- if (timerId !== void 0) {
113
- clearTimeout(timerId);
114
- }
115
- lastInvokeTime = 0;
116
- lastArgs = lastCallTime = lastThis = timerId = void 0;
117
- }
118
- function flush() {
119
- return timerId === void 0 ? result : trailingEdge(now());
120
- }
121
- function debounced() {
122
- var time = now(), isInvoking = shouldInvoke(time);
123
- lastArgs = arguments;
124
- lastThis = this;
125
- lastCallTime = time;
126
- if (isInvoking) {
127
- if (timerId === void 0) {
128
- return leadingEdge(lastCallTime);
129
- }
130
- if (maxing) {
131
- timerId = setTimeout(timerExpired, wait);
132
- return invokeFunc(lastCallTime);
133
- }
134
- }
135
- if (timerId === void 0) {
136
- timerId = setTimeout(timerExpired, wait);
137
- }
138
- return result;
139
- }
140
- debounced.cancel = cancel;
141
- debounced.flush = flush;
142
- return debounced;
143
- }
144
- function throttle2(func, wait, options) {
145
- var leading = true, trailing = true;
146
- if (typeof func != "function") {
147
- throw new TypeError(FUNC_ERROR_TEXT);
148
- }
149
- if (isObject(options)) {
150
- leading = "leading" in options ? !!options.leading : leading;
151
- trailing = "trailing" in options ? !!options.trailing : trailing;
152
- }
153
- return debounce(func, wait, {
154
- "leading": leading,
155
- "maxWait": wait,
156
- "trailing": trailing
157
- });
158
- }
159
- function isObject(value) {
160
- var type = typeof value;
161
- return !!value && (type == "object" || type == "function");
162
- }
163
- function isObjectLike(value) {
164
- return !!value && typeof value == "object";
165
- }
166
- function isSymbol(value) {
167
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
168
- }
169
- function toNumber(value) {
170
- if (typeof value == "number") {
171
- return value;
172
- }
173
- if (isSymbol(value)) {
174
- return NAN;
175
- }
176
- if (isObject(value)) {
177
- var other = typeof value.valueOf == "function" ? value.valueOf() : value;
178
- value = isObject(other) ? other + "" : other;
179
- }
180
- if (typeof value != "string") {
181
- return value === 0 ? value : +value;
182
- }
183
- value = value.replace(reTrim, "");
184
- var isBinary = reIsBinary.test(value);
185
- return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
186
- }
187
- module.exports = throttle2;
188
- }
189
- });
190
-
191
- // src/renderer.tsx
192
- import React9 from "react";
193
- import mediumZoom from "@fisch0920/medium-zoom";
194
-
195
- // src/block.tsx
196
- import React8 from "react";
197
- import {
198
- getBlockCollectionId,
199
- getBlockIcon,
200
- getBlockParentPage,
201
- getPageTableOfContents,
202
- getTextContent,
203
- uuidToId as uuidToId2
204
- } from "@texonom/nutils";
205
-
206
- // src/components/audio.tsx
207
- import React from "react";
208
- var Audio = ({ block, className }) => {
209
- var _a, _b, _c;
210
- const { recordMap } = useNotionContext();
211
- const source = recordMap.signed_urls[block.id] || ((_c = (_b = (_a = block.properties) == null ? void 0 : _a.source) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]);
212
- return /* @__PURE__ */ React.createElement("div", { className: `notion-audio ${className || ""}` }, /* @__PURE__ */ React.createElement("audio", { controls: true, preload: "none", src: source }));
213
- };
214
-
215
- // src/components/file.tsx
216
- import React3 from "react";
217
-
218
- // src/icons/file-icon.tsx
219
- import React2 from "react";
220
- var FileIcon = (props) => {
221
- const _a = props, { className } = _a, rest = __objRest(_a, ["className"]);
222
- return /* @__PURE__ */ React2.createElement("svg", __spreadProps(__spreadValues({ className }, rest), { viewBox: "0 0 30 30" }), /* @__PURE__ */ React2.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" }));
1
+ var ot = Object.defineProperty, at = Object.defineProperties;
2
+ var rt = Object.getOwnPropertyDescriptors;
3
+ var ge = Object.getOwnPropertySymbols;
4
+ var Ye = Object.prototype.hasOwnProperty, Ze = Object.prototype.propertyIsEnumerable;
5
+ var Ge = (n, a, o) => a in n ? ot(n, a, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[a] = o, W = (n, a) => {
6
+ for (var o in a || (a = {}))
7
+ Ye.call(a, o) && Ge(n, o, a[o]);
8
+ if (ge)
9
+ for (var o of ge(a))
10
+ Ze.call(a, o) && Ge(n, o, a[o]);
11
+ return n;
12
+ }, be = (n, a) => at(n, rt(a));
13
+ var le = (n, a) => {
14
+ var o = {};
15
+ for (var m in n)
16
+ Ye.call(n, m) && a.indexOf(m) < 0 && (o[m] = n[m]);
17
+ if (n != null && ge)
18
+ for (var m of ge(n))
19
+ a.indexOf(m) < 0 && Ze.call(n, m) && (o[m] = n[m]);
20
+ return o;
223
21
  };
224
-
225
- // src/components/file.tsx
226
- var File = ({ block, className }) => {
227
- var _a, _b, _c, _d, _e;
228
- const { components, recordMap } = useNotionContext();
229
- const source = recordMap.signed_urls[block.id] || ((_c = (_b = (_a = block.properties) == null ? void 0 : _a.source) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]);
230
- return /* @__PURE__ */ React3.createElement("div", { className: `notion-file ${className || ""}` }, /* @__PURE__ */ React3.createElement(components.Link, { className: "notion-file-link", href: source, target: "_blank", rel: "noopener noreferrer" }, /* @__PURE__ */ React3.createElement(FileIcon, { className: "notion-file-icon" }), /* @__PURE__ */ React3.createElement("div", { className: "notion-file-info" }, /* @__PURE__ */ React3.createElement("div", { className: "notion-file-title" }, /* @__PURE__ */ React3.createElement(Text, { value: ((_d = block.properties) == null ? void 0 : _d.title) || [["File"]], block })), ((_e = block.properties) == null ? void 0 : _e.size) && /* @__PURE__ */ React3.createElement("div", { className: "notion-file-size" }, /* @__PURE__ */ React3.createElement(Text, { value: block.properties.size, block })))));
231
- };
232
-
233
- // src/components/google-drive.tsx
234
- import React4 from "react";
235
- var GoogleDrive = ({ block, className }) => {
236
- var _a;
237
- const { components, mapImageUrl } = useNotionContext();
238
- const properties = (_a = block.format) == null ? void 0 : _a.drive_properties;
239
- if (!properties) return null;
240
- let domain;
22
+ import e from "react";
23
+ import lt from "@fisch0920/medium-zoom";
24
+ import { uuidToId as Ee, getBlockParentPage as Je, getPageTableOfContents as he, getTextContent as ie, getBlockCollectionId as it, getBlockIcon as ct, isUrl as st } from "@texonom/nutils";
25
+ import { formatDate as Mt, formatNotionDateTime as Ht, isUrl as At } from "@texonom/nutils";
26
+ import { u as ce, T as C, G as mt, E as dt, P as Xe, L as Ne, a as Ke, A as Qe, g as ut, N as ft } from "./asset-wrapper-CmbIDPIw.js";
27
+ import { l as Dt, B as Rt, C as zt, H as Ut, k as Wt, e as Vt, f as qt, j as Gt, S as Yt, h as Zt, d as Jt, b as Xt, c as Kt, i as Qt } from "./asset-wrapper-CmbIDPIw.js";
28
+ import { c as ve, g as pt } from "./_commonjsHelpers-bAxELxBV.js";
29
+ import { C as tn, P as nn, i as on } from "./collection-column-title-l4hmVo49.js";
30
+ const gt = ({ block: n, className: a }) => {
31
+ var r, d, g;
32
+ const { recordMap: o } = ce(), m = o.signed_urls[n.id] || ((g = (d = (r = n.properties) == null ? void 0 : r.source) == null ? void 0 : d[0]) == null ? void 0 : g[0]);
33
+ return /* @__PURE__ */ e.createElement("div", { className: `notion-audio ${a || ""}` }, /* @__PURE__ */ e.createElement("audio", { controls: !0, preload: "none", src: m }));
34
+ }, vt = (n) => {
35
+ const m = n, { className: a } = m, o = le(m, ["className"]);
36
+ return /* @__PURE__ */ e.createElement("svg", be(W({ className: a }, o), { viewBox: "0 0 30 30" }), /* @__PURE__ */ e.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" }));
37
+ }, Et = ({ block: n, className: a }) => {
38
+ var d, g, N, _, v;
39
+ const { components: o, recordMap: m } = ce(), r = m.signed_urls[n.id] || ((N = (g = (d = n.properties) == null ? void 0 : d.source) == null ? void 0 : g[0]) == null ? void 0 : N[0]);
40
+ return /* @__PURE__ */ e.createElement("div", { className: `notion-file ${a || ""}` }, /* @__PURE__ */ e.createElement(o.Link, { className: "notion-file-link", href: r, target: "_blank", rel: "noopener noreferrer" }, /* @__PURE__ */ e.createElement(vt, { className: "notion-file-icon" }), /* @__PURE__ */ e.createElement("div", { className: "notion-file-info" }, /* @__PURE__ */ e.createElement("div", { className: "notion-file-title" }, /* @__PURE__ */ e.createElement(C, { value: ((_ = n.properties) == null ? void 0 : _.title) || [["File"]], block: n })), ((v = n.properties) == null ? void 0 : v.size) && /* @__PURE__ */ e.createElement("div", { className: "notion-file-size" }, /* @__PURE__ */ e.createElement(C, { value: n.properties.size, block: n })))));
41
+ }, bt = ({ block: n, className: a }) => {
42
+ var g;
43
+ const { components: o, mapImageUrl: m } = ce(), r = (g = n.format) == null ? void 0 : g.drive_properties;
44
+ if (!r) return null;
45
+ let d;
241
46
  try {
242
- const url = new URL(properties.url);
243
- domain = url.hostname;
244
- } catch (err) {
47
+ d = new URL(r.url).hostname;
48
+ } catch (N) {
245
49
  }
246
- return /* @__PURE__ */ React4.createElement("div", { className: `notion-google-drive ${className || ""}` }, /* @__PURE__ */ React4.createElement(components.Link, { className: "notion-google-drive-link", href: properties.url, target: "_blank", rel: "noopener noreferrer" }, /* @__PURE__ */ React4.createElement("div", { className: "notion-google-drive-preview" }, /* @__PURE__ */ React4.createElement(
247
- GracefulImage,
50
+ return /* @__PURE__ */ e.createElement("div", { className: `notion-google-drive ${a || ""}` }, /* @__PURE__ */ e.createElement(o.Link, { className: "notion-google-drive-link", href: r.url, target: "_blank", rel: "noopener noreferrer" }, /* @__PURE__ */ e.createElement("div", { className: "notion-google-drive-preview" }, /* @__PURE__ */ e.createElement(
51
+ mt,
248
52
  {
249
- src: mapImageUrl(properties.thumbnail, block),
250
- alt: properties.title || "Google Drive Document",
53
+ src: m(r.thumbnail, n),
54
+ alt: r.title || "Google Drive Document",
251
55
  loading: "lazy"
252
56
  }
253
- )), /* @__PURE__ */ React4.createElement("div", { className: "notion-google-drive-body" }, properties.title && /* @__PURE__ */ React4.createElement("div", { className: "notion-google-drive-body-title" }, properties.title), properties.icon && domain && /* @__PURE__ */ React4.createElement("div", { className: "notion-google-drive-body-source" }, properties.icon && /* @__PURE__ */ React4.createElement(
57
+ )), /* @__PURE__ */ e.createElement("div", { className: "notion-google-drive-body" }, r.title && /* @__PURE__ */ e.createElement("div", { className: "notion-google-drive-body-title" }, r.title), r.icon && d && /* @__PURE__ */ e.createElement("div", { className: "notion-google-drive-body-source" }, r.icon && /* @__PURE__ */ e.createElement(
254
58
  "div",
255
59
  {
256
60
  className: "notion-google-drive-body-source-icon",
257
61
  style: {
258
- backgroundImage: `url(${properties.icon})`
62
+ backgroundImage: `url(${r.icon})`
259
63
  }
260
64
  }
261
- ), domain && /* @__PURE__ */ React4.createElement("div", { className: "notion-google-drive-body-source-domain" }, domain)))));
65
+ ), d && /* @__PURE__ */ e.createElement("div", { className: "notion-google-drive-body-source-domain" }, d)))));
262
66
  };
263
-
264
- // src/components/page-aside.tsx
265
- var import_lodash = __toESM(require_lodash(), 1);
266
- import React5 from "react";
267
- import { uuidToId } from "@texonom/nutils";
268
- var PageAside = ({ toc, activeSection, setActiveSection, pageAside, hasToc, hasAside, className }) => {
269
- const throttleMs = 100;
270
- const actionSectionScrollSpy = React5.useMemo(
271
- () => (0, import_lodash.default)(() => {
272
- const sections = document.getElementsByClassName("notion-h");
273
- let prevBBox = null;
274
- let currentSectionId = activeSection;
275
- for (let i = 0; i < sections.length; ++i) {
276
- const section = sections[i];
277
- if (!section || !(section instanceof Element)) continue;
278
- if (!currentSectionId) currentSectionId = section.getAttribute("data-id");
279
- const bbox = section.getBoundingClientRect();
280
- const prevHeight = prevBBox ? bbox.top - prevBBox.bottom : 0;
281
- const offset = Math.max(150, prevHeight / 4);
282
- if (bbox.top - offset < 0) {
283
- currentSectionId = section.getAttribute("data-id");
284
- prevBBox = bbox;
67
+ var ke, et;
68
+ function ht() {
69
+ if (et) return ke;
70
+ et = 1;
71
+ var n = "Expected a function", a = NaN, o = "[object Symbol]", m = /^\s+|\s+$/g, r = /^[-+]0x[0-9a-f]+$/i, d = /^0b[01]+$/i, g = /^0o[0-7]+$/i, N = parseInt, _ = typeof ve == "object" && ve && ve.Object === Object && ve, v = typeof self == "object" && self && self.Object === Object && self, y = _ || v || Function("return this")(), T = Object.prototype, O = T.toString, L = Math.max, t = Math.min, f = function() {
72
+ return y.Date.now();
73
+ };
74
+ function B(i, u, h) {
75
+ var k, I, q, c, w, S, H = 0, te = !1, A = !1, G = !0;
76
+ if (typeof i != "function")
77
+ throw new TypeError(n);
78
+ u = R(u) || 0, M(h) && (te = !!h.leading, A = "maxWait" in h, q = A ? L(R(h.maxWait) || 0, u) : q, G = "trailing" in h ? !!h.trailing : G);
79
+ function Y(p) {
80
+ var P = k, F = I;
81
+ return k = I = void 0, H = p, c = i.apply(F, P), c;
82
+ }
83
+ function se(p) {
84
+ return H = p, w = setTimeout(z, u), te ? Y(p) : c;
85
+ }
86
+ function me(p) {
87
+ var P = p - S, F = p - H, ae = u - P;
88
+ return A ? t(ae, q - F) : ae;
89
+ }
90
+ function ne(p) {
91
+ var P = p - S, F = p - H;
92
+ return S === void 0 || P >= u || P < 0 || A && F >= q;
93
+ }
94
+ function z() {
95
+ var p = f();
96
+ if (ne(p))
97
+ return oe(p);
98
+ w = setTimeout(z, me(p));
99
+ }
100
+ function oe(p) {
101
+ return w = void 0, G && k ? Y(p) : (k = I = void 0, c);
102
+ }
103
+ function de() {
104
+ w !== void 0 && clearTimeout(w), H = 0, k = S = I = w = void 0;
105
+ }
106
+ function ue() {
107
+ return w === void 0 ? c : oe(f());
108
+ }
109
+ function Z() {
110
+ var p = f(), P = ne(p);
111
+ if (k = arguments, I = this, S = p, P) {
112
+ if (w === void 0)
113
+ return se(S);
114
+ if (A)
115
+ return w = setTimeout(z, u), Y(S);
116
+ }
117
+ return w === void 0 && (w = setTimeout(z, u)), c;
118
+ }
119
+ return Z.cancel = de, Z.flush = ue, Z;
120
+ }
121
+ function V(i, u, h) {
122
+ var k = !0, I = !0;
123
+ if (typeof i != "function")
124
+ throw new TypeError(n);
125
+ return M(h) && (k = "leading" in h ? !!h.leading : k, I = "trailing" in h ? !!h.trailing : I), B(i, u, {
126
+ leading: k,
127
+ maxWait: u,
128
+ trailing: I
129
+ });
130
+ }
131
+ function M(i) {
132
+ var u = typeof i;
133
+ return !!i && (u == "object" || u == "function");
134
+ }
135
+ function Q(i) {
136
+ return !!i && typeof i == "object";
137
+ }
138
+ function ee(i) {
139
+ return typeof i == "symbol" || Q(i) && O.call(i) == o;
140
+ }
141
+ function R(i) {
142
+ if (typeof i == "number")
143
+ return i;
144
+ if (ee(i))
145
+ return a;
146
+ if (M(i)) {
147
+ var u = typeof i.valueOf == "function" ? i.valueOf() : i;
148
+ i = M(u) ? u + "" : u;
149
+ }
150
+ if (typeof i != "string")
151
+ return i === 0 ? i : +i;
152
+ i = i.replace(m, "");
153
+ var h = d.test(i);
154
+ return h || g.test(i) ? N(i.slice(2), h ? 2 : 8) : r.test(i) ? a : +i;
155
+ }
156
+ return ke = V, ke;
157
+ }
158
+ var Nt = ht();
159
+ const kt = /* @__PURE__ */ pt(Nt), _t = ({ toc: n, activeSection: a, setActiveSection: o, pageAside: m, hasToc: r, hasAside: d, className: g }) => {
160
+ const _ = e.useMemo(
161
+ () => kt(() => {
162
+ const v = document.getElementsByClassName("notion-h");
163
+ let y = null, T = a;
164
+ for (let O = 0; O < v.length; ++O) {
165
+ const L = v[O];
166
+ if (!L || !(L instanceof Element)) continue;
167
+ T || (T = L.getAttribute("data-id"));
168
+ const t = L.getBoundingClientRect(), f = y ? t.top - y.bottom : 0, B = Math.max(150, f / 4);
169
+ if (t.top - B < 0) {
170
+ T = L.getAttribute("data-id"), y = t;
285
171
  continue;
286
172
  }
287
173
  break;
288
174
  }
289
- setActiveSection(currentSectionId);
290
- }, throttleMs),
175
+ o(T);
176
+ }, 100),
291
177
  // eslint-disable-next-line react-hooks/exhaustive-deps
292
178
  [
293
179
  // explicitly not taking a dependency on activeSection
294
- setActiveSection
180
+ o
295
181
  ]
296
182
  );
297
- React5.useEffect(() => {
298
- if (!hasToc) return;
299
- window.addEventListener("scroll", actionSectionScrollSpy);
300
- actionSectionScrollSpy();
301
- return () => {
302
- window.removeEventListener("scroll", actionSectionScrollSpy);
303
- };
304
- }, [hasToc, actionSectionScrollSpy]);
305
- if (!hasAside) return null;
306
- return /* @__PURE__ */ React5.createElement("aside", { className: `notion-aside ${className || ""}` }, hasToc && /* @__PURE__ */ React5.createElement("div", { className: "notion-aside-table-of-contents" }, /* @__PURE__ */ React5.createElement("div", { className: "notion-aside-table-of-contents-header" }, "Table of Contents"), /* @__PURE__ */ React5.createElement("nav", { className: "notion-table-of-contents" }, toc.map((tocItem) => {
307
- const id = uuidToId(tocItem.id);
308
- return /* @__PURE__ */ React5.createElement(
183
+ return e.useEffect(() => {
184
+ if (r)
185
+ return window.addEventListener("scroll", _), _(), () => {
186
+ window.removeEventListener("scroll", _);
187
+ };
188
+ }, [r, _]), d ? /* @__PURE__ */ e.createElement("aside", { className: `notion-aside ${g || ""}` }, r && /* @__PURE__ */ e.createElement("div", { className: "notion-aside-table-of-contents" }, /* @__PURE__ */ e.createElement("div", { className: "notion-aside-table-of-contents-header" }, "Table of Contents"), /* @__PURE__ */ e.createElement("nav", { className: "notion-table-of-contents" }, n.map((v) => {
189
+ const y = Ee(v.id);
190
+ return /* @__PURE__ */ e.createElement(
309
191
  "a",
310
192
  {
311
- key: id,
312
- href: `#${id}`,
193
+ key: y,
194
+ href: `#${y}`,
313
195
  className: `notion-table-of-contents-item
314
- notion-table-of-contents-item-indent-level-${tocItem.indentLevel}
315
- ${activeSection === id && "notion-table-of-contents-active-item"}`
196
+ notion-table-of-contents-item-indent-level-${v.indentLevel}
197
+ ${a === y && "notion-table-of-contents-active-item"}`
316
198
  },
317
- /* @__PURE__ */ React5.createElement(
199
+ /* @__PURE__ */ e.createElement(
318
200
  "span",
319
201
  {
320
202
  className: "notion-table-of-contents-item-body",
321
203
  style: {
322
204
  display: "inline-block",
323
- marginLeft: tocItem.indentLevel * 16
205
+ marginLeft: v.indentLevel * 16
324
206
  }
325
207
  },
326
- tocItem.text
208
+ v.text
327
209
  )
328
210
  );
329
- }))), pageAside);
330
- };
331
-
332
- // src/components/sync-pointer-block.tsx
333
- import React6 from "react";
334
- var SyncPointerBlock = ({ block, level }) => {
335
- var _a, _b;
336
- if (!block) {
337
- if (true) console.warn("missing sync pointer block", block.id);
338
- return null;
339
- }
340
- const syncPointerBlock = block;
341
- const referencePointerId = (_b = (_a = syncPointerBlock == null ? void 0 : syncPointerBlock.format) == null ? void 0 : _a.transclusion_reference_pointer) == null ? void 0 : _b.id;
342
- if (!referencePointerId) return null;
343
- return /* @__PURE__ */ React6.createElement(NotionBlockRenderer, { key: referencePointerId, level, blockId: referencePointerId });
344
- };
345
-
346
- // src/icons/link-icon.tsx
347
- import React7 from "react";
348
- var LinkIcon = (props) => {
349
- const _a = props, { className } = _a, rest = __objRest(_a, ["className"]);
350
- return /* @__PURE__ */ React7.createElement("svg", __spreadProps(__spreadValues({ className }, rest), { viewBox: "0 0 16 16", width: "16", height: "16" }), /* @__PURE__ */ React7.createElement(
211
+ }))), m) : null;
212
+ }, yt = ({ block: n, level: a }) => {
213
+ var r, d;
214
+ if (!n)
215
+ return process.env.NODE_ENV !== "production" && console.warn("missing sync pointer block", n.id), null;
216
+ const o = n, m = (d = (r = o == null ? void 0 : o.format) == null ? void 0 : r.transclusion_reference_pointer) == null ? void 0 : d.id;
217
+ return m ? /* @__PURE__ */ e.createElement(_e, { key: m, level: a, blockId: m }) : null;
218
+ }, $t = (n) => {
219
+ const m = n, { className: a } = m, o = le(m, ["className"]);
220
+ return /* @__PURE__ */ e.createElement("svg", be(W({ className: a }, o), { viewBox: "0 0 16 16", width: "16", height: "16" }), /* @__PURE__ */ e.createElement(
351
221
  "path",
352
222
  {
353
223
  fillRule: "evenodd",
354
224
  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"
355
225
  }
356
226
  ));
357
- };
358
-
359
- // src/block.tsx
360
- var tocIndentLevelCache = {};
361
- var pageCoverStyleCache = {};
362
- var Block = (props) => {
363
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q;
364
- const ctx = useNotionContext();
365
- const {
366
- components,
367
- fullPage,
368
- recordMap,
369
- mapPageUrl,
370
- mapImageUrl,
371
- showTableOfContents,
372
- minTableOfContentsItems,
373
- defaultPageIcon,
374
- defaultPageCover,
375
- defaultPageCoverPosition
376
- } = ctx;
377
- const [activeSection, setActiveSection] = React8.useState(null);
378
- const {
379
- block,
380
- children,
381
- level,
382
- className,
383
- bodyClassName,
384
- header,
385
- footer,
386
- pageHeader,
387
- pageFooter,
388
- pageTitle,
389
- pageAside,
390
- pageCover,
391
- hideBlockId,
392
- disableHeader
393
- } = props;
394
- if (!block) return null;
395
- if (level === 0 && block.type === "collection_view") {
396
- const view_block = block;
397
- view_block.type = "collection_view_page";
227
+ }, tt = {}, nt = {}, Ct = (n) => {
228
+ var w, S, H, te, A, G, Y, se, me, ne, z, oe, de, ue, Z, p, P, F, ae, ye, $e, Ce, we, xe, Ie, Le, Pe, Te, Se, je, Oe, Be, Me, He, Ae, Fe, De, Re, ze, Ue, We, Ve, qe;
229
+ const a = ce(), {
230
+ components: o,
231
+ fullPage: m,
232
+ recordMap: r,
233
+ mapPageUrl: d,
234
+ mapImageUrl: g,
235
+ showTableOfContents: N,
236
+ minTableOfContentsItems: _,
237
+ defaultPageIcon: v,
238
+ defaultPageCover: y,
239
+ defaultPageCoverPosition: T
240
+ } = a, [O, L] = e.useState(null), {
241
+ block: t,
242
+ children: f,
243
+ level: B,
244
+ className: V,
245
+ bodyClassName: M,
246
+ header: Q,
247
+ footer: ee,
248
+ pageHeader: R,
249
+ pageFooter: i,
250
+ pageTitle: u,
251
+ pageAside: h,
252
+ pageCover: k,
253
+ hideBlockId: I,
254
+ disableHeader: q
255
+ } = n;
256
+ if (!t) return null;
257
+ if (B === 0 && t.type === "collection_view") {
258
+ const l = t;
259
+ l.type = "collection_view_page";
398
260
  }
399
- const blockId = hideBlockId ? "notion-block" : `notion-block-${uuidToId2(block.id)}`;
400
- switch (block.type) {
261
+ const c = I ? "notion-block" : `notion-block-${Ee(t.id)}`;
262
+ switch (t.type) {
401
263
  case "collection_view_page":
402
264
  // fallthrough
403
265
  case "page":
404
- if (level === 0) {
266
+ if (B === 0) {
405
267
  const {
406
- page_icon = defaultPageIcon,
407
- page_cover = defaultPageCover,
408
- page_cover_position = defaultPageCoverPosition,
409
- page_full_width,
410
- page_small_text
411
- } = block.format || {};
412
- if (fullPage) {
413
- const properties = block.type === "page" ? block.properties : {
414
- title: (_b = (_a = recordMap.collection[getBlockCollectionId(block, recordMap)]) == null ? void 0 : _a.value) == null ? void 0 : _b.name
415
- };
416
- const coverPosition = (1 - (page_cover_position || 0.5)) * 100;
417
- const pageCoverObjectPosition = `center ${coverPosition}%`;
418
- let pageCoverStyle = pageCoverStyleCache[pageCoverObjectPosition];
419
- if (!pageCoverStyle)
420
- pageCoverStyle = pageCoverStyleCache[pageCoverObjectPosition] = {
421
- objectPosition: pageCoverObjectPosition
422
- };
423
- const pageIcon = (_c = getBlockIcon(block, recordMap)) != null ? _c : defaultPageIcon;
424
- const isPageIconUrl = pageIcon && isUrl(pageIcon);
425
- const toc = getPageTableOfContents(block, recordMap);
426
- const hasToc = showTableOfContents && toc.length >= minTableOfContentsItems;
427
- const hasAside = (hasToc || pageAside) && !page_full_width;
428
- const hasPageCover = pageCover || page_cover;
429
- return /* @__PURE__ */ React8.createElement("div", { className: `notion notion-app ${blockId} ${className || ""}` }, /* @__PURE__ */ React8.createElement("div", { className: "notion-viewport" }), /* @__PURE__ */ React8.createElement("div", { className: "notion-frame" }, !disableHeader && /* @__PURE__ */ React8.createElement(components.Header, { block }), header, /* @__PURE__ */ React8.createElement("div", { className: "notion-page-scroller" }, hasPageCover && (pageCover ? pageCover : /* @__PURE__ */ React8.createElement("div", { className: "notion-page-cover-wrapper" }, /* @__PURE__ */ React8.createElement(
430
- LazyImage,
268
+ page_icon: l = v,
269
+ page_cover: s = y,
270
+ page_cover_position: E = T,
271
+ page_full_width: b,
272
+ page_small_text: x
273
+ } = t.format || {};
274
+ if (m) {
275
+ const $ = t.type === "page" ? t.properties : {
276
+ title: (S = (w = r.collection[it(t, r)]) == null ? void 0 : w.value) == null ? void 0 : S.name
277
+ }, D = `center ${(1 - (E || 0.5)) * 100}%`;
278
+ let j = nt[D];
279
+ j || (j = nt[D] = {
280
+ objectPosition: D
281
+ });
282
+ const X = (H = ct(t, r)) != null ? H : v, U = X && st(X), re = he(t, r), fe = N && re.length >= _, K = (fe || h) && !b, pe = k || s;
283
+ return /* @__PURE__ */ e.createElement("div", { className: `notion notion-app ${c} ${V || ""}` }, /* @__PURE__ */ e.createElement("div", { className: "notion-viewport" }), /* @__PURE__ */ e.createElement("div", { className: "notion-frame" }, !q && /* @__PURE__ */ e.createElement(o.Header, { block: t }), Q, /* @__PURE__ */ e.createElement("div", { className: "notion-page-scroller" }, pe && (k || /* @__PURE__ */ e.createElement("div", { className: "notion-page-cover-wrapper" }, /* @__PURE__ */ e.createElement(
284
+ Ne,
431
285
  {
432
- src: mapImageUrl(page_cover, block),
433
- alt: getTextContent(properties == null ? void 0 : properties.title),
434
- priority: true,
286
+ src: g(s, t),
287
+ alt: ie($ == null ? void 0 : $.title),
288
+ priority: !0,
435
289
  className: "notion-page-cover",
436
- style: pageCoverStyle
290
+ style: j
437
291
  }
438
- ))), /* @__PURE__ */ React8.createElement(
292
+ ))), /* @__PURE__ */ e.createElement(
439
293
  "main",
440
294
  {
441
295
  className: `notion-page
442
- ${hasPageCover ? "notion-page-has-cover" : "notion-page-no-cover"}
443
- ${page_icon ? "notion-page-has-icon" : "notion-page-no-icon"}
444
- ${isPageIconUrl ? "notion-page-has-image-icon" : "notion-page-has-text-icon"}
296
+ ${pe ? "notion-page-has-cover" : "notion-page-no-cover"}
297
+ ${l ? "notion-page-has-icon" : "notion-page-no-icon"}
298
+ ${U ? "notion-page-has-image-icon" : "notion-page-has-text-icon"}
445
299
  notion-full-page
446
- ${page_full_width && "notion-full-width"}
447
- ${page_small_text && "notion-small-text"}
448
- ${bodyClassName}`
300
+ ${b && "notion-full-width"}
301
+ ${x && "notion-small-text"}
302
+ ${M}`
449
303
  },
450
- page_icon && /* @__PURE__ */ React8.createElement(PageIcon, { block, defaultIcon: defaultPageIcon, inline: false }),
451
- pageHeader,
452
- /* @__PURE__ */ React8.createElement("h1", { className: "notion-title" }, pageTitle != null ? pageTitle : /* @__PURE__ */ React8.createElement(Text, { value: properties == null ? void 0 : properties.title, block })),
453
- (block.type === "collection_view_page" || block.type === "page" && block.parent_table === "collection") && /* @__PURE__ */ React8.createElement(components.Collection, { block, ctx }),
454
- block.type !== "collection_view_page" && /* @__PURE__ */ React8.createElement(
304
+ l && /* @__PURE__ */ e.createElement(Ke, { block: t, defaultIcon: v, inline: !1 }),
305
+ R,
306
+ /* @__PURE__ */ e.createElement("h1", { className: "notion-title" }, u != null ? u : /* @__PURE__ */ e.createElement(C, { value: $ == null ? void 0 : $.title, block: t })),
307
+ (t.type === "collection_view_page" || t.type === "page" && t.parent_table === "collection") && /* @__PURE__ */ e.createElement(o.Collection, { block: t, ctx: a }),
308
+ t.type !== "collection_view_page" && /* @__PURE__ */ e.createElement(
455
309
  "div",
456
310
  {
457
311
  className: `notion-page-content
458
- ${hasAside && "notion-page-content-has-aside"}
459
- ${hasToc && "notion-page-content-has-toc"}`
312
+ ${K && "notion-page-content-has-aside"}
313
+ ${fe && "notion-page-content-has-toc"}`
460
314
  },
461
- /* @__PURE__ */ React8.createElement("article", { className: "notion-page-content-inner" }, children),
462
- hasAside && /* @__PURE__ */ React8.createElement(
463
- PageAside,
315
+ /* @__PURE__ */ e.createElement("article", { className: "notion-page-content-inner" }, f),
316
+ K && /* @__PURE__ */ e.createElement(
317
+ _t,
464
318
  {
465
- toc,
466
- activeSection,
467
- setActiveSection,
468
- hasToc,
469
- hasAside,
470
- pageAside
319
+ toc: re,
320
+ activeSection: O,
321
+ setActiveSection: L,
322
+ hasToc: fe,
323
+ hasAside: K,
324
+ pageAside: h
471
325
  }
472
326
  )
473
327
  ),
474
- pageFooter
475
- ), footer)));
476
- } else {
477
- return /* @__PURE__ */ React8.createElement(
328
+ i
329
+ ), ee)));
330
+ } else
331
+ return /* @__PURE__ */ e.createElement(
478
332
  "main",
479
333
  {
480
334
  className: `notion
481
335
  notion-page
482
- ${page_full_width && "notion-full-width"}
483
- ${page_small_text && "notion-small-text"}
484
- ${blockId}
485
- ${className || ""}
486
- ${bodyClassName}`
336
+ ${b && "notion-full-width"}
337
+ ${x && "notion-small-text"}
338
+ ${c}
339
+ ${V || ""}
340
+ ${M}`
487
341
  },
488
- /* @__PURE__ */ React8.createElement("div", { className: "notion-viewport" }),
489
- pageHeader,
490
- (block.type === "collection_view_page" || block.type === "page" && block.parent_table === "collection") && /* @__PURE__ */ React8.createElement(components.Collection, { block, ctx }),
491
- block.type !== "collection_view_page" && children,
492
- pageFooter
342
+ /* @__PURE__ */ e.createElement("div", { className: "notion-viewport" }),
343
+ R,
344
+ (t.type === "collection_view_page" || t.type === "page" && t.parent_table === "collection") && /* @__PURE__ */ e.createElement(o.Collection, { block: t, ctx: a }),
345
+ t.type !== "collection_view_page" && f,
346
+ i
493
347
  );
494
- }
495
348
  } else {
496
- const blockColor = (_d = block.format) == null ? void 0 : _d.block_color;
497
- return /* @__PURE__ */ React8.createElement(
498
- components.PageLink,
349
+ const l = (te = t.format) == null ? void 0 : te.block_color;
350
+ return /* @__PURE__ */ e.createElement(
351
+ o.PageLink,
499
352
  {
500
- className: `notion-page-link ${blockColor && `notion-${blockColor}`} ${blockId}`,
501
- href: mapPageUrl(block.id)
353
+ className: `notion-page-link ${l && `notion-${l}`} ${c}`,
354
+ href: d(t.id)
502
355
  },
503
- /* @__PURE__ */ React8.createElement(PageTitle, { block })
356
+ /* @__PURE__ */ e.createElement(Xe, { block: t })
504
357
  );
505
358
  }
506
359
  case "header":
@@ -508,67 +361,44 @@ var Block = (props) => {
508
361
  case "sub_header":
509
362
  // fallthrough
510
363
  case "sub_sub_header": {
511
- if (!block.properties) return null;
512
- const blockColor = (_e = block.format) == null ? void 0 : _e.block_color;
513
- const id = uuidToId2(block.id);
514
- const title = getTextContent(block.properties.title) || `Notion Header ${id}`;
515
- let indentLevel = tocIndentLevelCache[block.id];
516
- let indentLevelClass;
517
- if (indentLevel === void 0) {
518
- const page = getBlockParentPage(block, recordMap);
519
- if (page) {
520
- const toc = getPageTableOfContents(page, recordMap);
521
- const tocItem = toc.find((tocItem2) => tocItem2.id === block.id);
522
- if (tocItem) {
523
- indentLevel = tocItem.indentLevel;
524
- tocIndentLevelCache[block.id] = indentLevel;
525
- }
364
+ if (!t.properties) return null;
365
+ const l = (A = t.format) == null ? void 0 : A.block_color, s = Ee(t.id), E = ie(t.properties.title) || `Notion Header ${s}`;
366
+ let b = tt[t.id], x;
367
+ if (b === void 0) {
368
+ const re = Je(t, r);
369
+ if (re) {
370
+ const K = he(re, r).find((pe) => pe.id === t.id);
371
+ K && (b = K.indentLevel, tt[t.id] = b);
526
372
  }
527
373
  }
528
- if (indentLevel !== void 0) indentLevelClass = `notion-h-indent-${indentLevel}`;
529
- const isH1 = block.type === "header";
530
- const isH2 = block.type === "sub_header";
531
- const isH3 = block.type === "sub_sub_header";
532
- const classNameStr = `${isH1 && "notion-h notion-h1"}
533
- ${isH2 && "notion-h notion-h2"}
534
- ${isH3 && "notion-h notion-h3"}
535
- ${blockColor && `notion-${blockColor}`}
536
- ${indentLevelClass},
537
- ${blockId}`;
538
- const innerHeader = /* @__PURE__ */ React8.createElement("span", null, /* @__PURE__ */ React8.createElement("div", { id, className: "notion-header-anchor" }), !((_f = block.format) == null ? void 0 : _f.toggleable) && /* @__PURE__ */ React8.createElement("a", { className: "notion-hash-link", href: `#${id}`, title }, /* @__PURE__ */ React8.createElement(LinkIcon, null)), /* @__PURE__ */ React8.createElement("span", { className: "notion-h-title" }, /* @__PURE__ */ React8.createElement(Text, { value: block.properties.title, block })));
539
- let headerBlock = null;
540
- if (isH1)
541
- headerBlock = /* @__PURE__ */ React8.createElement("h2", { className: classNameStr, "data-id": id }, innerHeader);
542
- else if (isH2)
543
- headerBlock = /* @__PURE__ */ React8.createElement("h3", { className: classNameStr, "data-id": id }, innerHeader);
544
- else
545
- headerBlock = /* @__PURE__ */ React8.createElement("h4", { className: classNameStr, "data-id": id }, innerHeader);
546
- if ((_g = block.format) == null ? void 0 : _g.toggleable)
547
- return /* @__PURE__ */ React8.createElement("details", { className: `notion-toggle ${blockId}` }, /* @__PURE__ */ React8.createElement("summary", null, headerBlock), /* @__PURE__ */ React8.createElement("div", null, children));
548
- else return headerBlock;
374
+ b !== void 0 && (x = `notion-h-indent-${b}`);
375
+ const $ = t.type === "header", J = t.type === "sub_header", D = t.type === "sub_sub_header", j = `${$ && "notion-h notion-h1"}
376
+ ${J && "notion-h notion-h2"}
377
+ ${D && "notion-h notion-h3"}
378
+ ${l && `notion-${l}`}
379
+ ${x},
380
+ ${c}`, X = /* @__PURE__ */ e.createElement("span", null, /* @__PURE__ */ e.createElement("div", { id: s, className: "notion-header-anchor" }), !((G = t.format) != null && G.toggleable) && /* @__PURE__ */ e.createElement("a", { className: "notion-hash-link", href: `#${s}`, title: E }, /* @__PURE__ */ e.createElement($t, null)), /* @__PURE__ */ e.createElement("span", { className: "notion-h-title" }, /* @__PURE__ */ e.createElement(C, { value: t.properties.title, block: t })));
381
+ let U = null;
382
+ return $ ? U = /* @__PURE__ */ e.createElement("h2", { className: j, "data-id": s }, X) : J ? U = /* @__PURE__ */ e.createElement("h3", { className: j, "data-id": s }, X) : U = /* @__PURE__ */ e.createElement("h4", { className: j, "data-id": s }, X), (Y = t.format) != null && Y.toggleable ? /* @__PURE__ */ e.createElement("details", { className: `notion-toggle ${c}` }, /* @__PURE__ */ e.createElement("summary", null, U), /* @__PURE__ */ e.createElement("div", null, f)) : U;
549
383
  }
550
384
  case "divider":
551
- return /* @__PURE__ */ React8.createElement("hr", { className: `notion-hr ${blockId}` });
385
+ return /* @__PURE__ */ e.createElement("hr", { className: `notion-hr ${c}` });
552
386
  case "text": {
553
- if (!block.properties && !((_h = block.content) == null ? void 0 : _h.length)) return /* @__PURE__ */ React8.createElement("div", { className: `notion-blank ${blockId}` }, "\xA0");
554
- const blockColor = (_i = block.format) == null ? void 0 : _i.block_color;
555
- return /* @__PURE__ */ React8.createElement("div", { className: `notion-text ${blockColor && `notion-${blockColor}`} ${blockId}` }, ((_j = block.properties) == null ? void 0 : _j.title) && /* @__PURE__ */ React8.createElement(Text, { value: block.properties.title, block }), children && /* @__PURE__ */ React8.createElement("div", { className: "notion-text-children" }, children));
387
+ if (!t.properties && !((se = t.content) != null && se.length)) return /* @__PURE__ */ e.createElement("div", { className: `notion-blank ${c}` }, " ");
388
+ const l = (me = t.format) == null ? void 0 : me.block_color;
389
+ return /* @__PURE__ */ e.createElement("div", { className: `notion-text ${l && `notion-${l}`} ${c}` }, ((ne = t.properties) == null ? void 0 : ne.title) && /* @__PURE__ */ e.createElement(C, { value: t.properties.title, block: t }), f && /* @__PURE__ */ e.createElement("div", { className: "notion-text-children" }, f));
556
390
  }
557
391
  case "bulleted_list":
558
392
  // fallthrough
559
393
  case "numbered_list": {
560
- const wrapList = (content, start2) => block.type === "bulleted_list" ? /* @__PURE__ */ React8.createElement("ul", { className: `notion-list notion-list-disc ${blockId}` }, content) : /* @__PURE__ */ React8.createElement("ol", { start: start2, className: `notion-list notion-list-numbered ${blockId}` }, content);
561
- let output = null;
562
- if (block.content)
563
- output = /* @__PURE__ */ React8.createElement(React8.Fragment, null, block.properties && /* @__PURE__ */ React8.createElement("li", null, /* @__PURE__ */ React8.createElement(Text, { value: block.properties.title, block })), wrapList(children));
564
- else
565
- output = block.properties ? /* @__PURE__ */ React8.createElement("li", null, /* @__PURE__ */ React8.createElement(Text, { value: block.properties.title, block })) : null;
566
- const isTopLevel = block.type !== ((_l = (_k = recordMap.block[block.parent_id]) == null ? void 0 : _k.value) == null ? void 0 : _l.type);
567
- const start = getListNumber(block.id, recordMap.block);
568
- return isTopLevel ? wrapList(output, start) : output;
394
+ const l = (x, $) => t.type === "bulleted_list" ? /* @__PURE__ */ e.createElement("ul", { className: `notion-list notion-list-disc ${c}` }, x) : /* @__PURE__ */ e.createElement("ol", { start: $, className: `notion-list notion-list-numbered ${c}` }, x);
395
+ let s = null;
396
+ t.content ? s = /* @__PURE__ */ e.createElement(e.Fragment, null, t.properties && /* @__PURE__ */ e.createElement("li", null, /* @__PURE__ */ e.createElement(C, { value: t.properties.title, block: t })), l(f)) : s = t.properties ? /* @__PURE__ */ e.createElement("li", null, /* @__PURE__ */ e.createElement(C, { value: t.properties.title, block: t })) : null;
397
+ const E = t.type !== ((oe = (z = r.block[t.parent_id]) == null ? void 0 : z.value) == null ? void 0 : oe.type), b = ut(t.id, r.block);
398
+ return E ? l(s, b) : s;
569
399
  }
570
400
  case "embed":
571
- return /* @__PURE__ */ React8.createElement(components.Embed, { blockId, block });
401
+ return /* @__PURE__ */ e.createElement(o.Embed, { blockId: c, block: t });
572
402
  case "tweet":
573
403
  // fallthrough
574
404
  case "maps":
@@ -588,80 +418,63 @@ var Block = (props) => {
588
418
  case "gist":
589
419
  // fallthrough
590
420
  case "video":
591
- return /* @__PURE__ */ React8.createElement(AssetWrapper, { blockId, block });
592
- case "drive": {
593
- const properties = (_m = block.format) == null ? void 0 : _m.drive_properties;
594
- if (!properties) {
595
- if ((_n = block.format) == null ? void 0 : _n.display_source)
596
- return /* @__PURE__ */ React8.createElement(AssetWrapper, { blockId, block });
597
- }
598
- return /* @__PURE__ */ React8.createElement(GoogleDrive, { block, className: blockId });
599
- }
421
+ return /* @__PURE__ */ e.createElement(Qe, { blockId: c, block: t });
422
+ case "drive":
423
+ return !((de = t.format) == null ? void 0 : de.drive_properties) && (ue = t.format) != null && ue.display_source ? /* @__PURE__ */ e.createElement(Qe, { blockId: c, block: t }) : /* @__PURE__ */ e.createElement(bt, { block: t, className: c });
600
424
  case "audio":
601
- return /* @__PURE__ */ React8.createElement(Audio, { block, className: blockId });
425
+ return /* @__PURE__ */ e.createElement(gt, { block: t, className: c });
602
426
  case "file":
603
- return /* @__PURE__ */ React8.createElement(File, { block, className: blockId });
427
+ return /* @__PURE__ */ e.createElement(Et, { block: t, className: c });
604
428
  case "equation":
605
- return /* @__PURE__ */ React8.createElement(components.Equation, { block, inline: false, className: blockId });
429
+ return /* @__PURE__ */ e.createElement(o.Equation, { block: t, inline: !1, className: c });
606
430
  case "code":
607
- return /* @__PURE__ */ React8.createElement(components.Code, { block });
431
+ return /* @__PURE__ */ e.createElement(o.Code, { block: t });
608
432
  case "column_list":
609
- return /* @__PURE__ */ React8.createElement("div", { className: `notion-row ${blockId}` }, children);
433
+ return /* @__PURE__ */ e.createElement("div", { className: `notion-row ${c}` }, f);
610
434
  case "column": {
611
- const spacerWidth = `min(32px, 4vw)`;
612
- const ratio = ((_o = block.format) == null ? void 0 : _o.column_ratio) || 0.5;
613
- const parent = (_p = recordMap.block[block.parent_id]) == null ? void 0 : _p.value;
614
- const columns = ((_q = parent == null ? void 0 : parent.content) == null ? void 0 : _q.length) || Math.max(2, Math.ceil(1 / ratio));
615
- const width = `calc((100% - (${columns - 1} * ${spacerWidth})) * ${ratio})`;
616
- const style = { width };
617
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("div", { className: `notion-column ${blockId}`, style }, children), /* @__PURE__ */ React8.createElement("div", { className: "notion-spacer" }));
435
+ const l = "min(32px, 4vw)", s = ((Z = t.format) == null ? void 0 : Z.column_ratio) || 0.5, E = (p = r.block[t.parent_id]) == null ? void 0 : p.value, $ = { width: `calc((100% - (${(((P = E == null ? void 0 : E.content) == null ? void 0 : P.length) || Math.max(2, Math.ceil(1 / s))) - 1} * ${l})) * ${s})` };
436
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { className: `notion-column ${c}`, style: $ }, f), /* @__PURE__ */ e.createElement("div", { className: "notion-spacer" }));
618
437
  }
619
438
  case "quote": {
620
- if (!block.properties) return null;
621
- const blockColor = (_r = block.format) == null ? void 0 : _r.block_color;
622
- return /* @__PURE__ */ React8.createElement("blockquote", { className: `notion-quote ${blockColor && `notion-${blockColor}`} ${blockId}` }, /* @__PURE__ */ React8.createElement("div", null, /* @__PURE__ */ React8.createElement(Text, { value: block.properties.title, block })), children);
439
+ if (!t.properties) return null;
440
+ const l = (F = t.format) == null ? void 0 : F.block_color;
441
+ return /* @__PURE__ */ e.createElement("blockquote", { className: `notion-quote ${l && `notion-${l}`} ${c}` }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement(C, { value: t.properties.title, block: t })), f);
623
442
  }
624
443
  case "collection_view":
625
- return /* @__PURE__ */ React8.createElement(components.Collection, { block, className: blockId, ctx });
444
+ return /* @__PURE__ */ e.createElement(o.Collection, { block: t, className: c, ctx: a });
626
445
  case "callout":
627
- if (components.Callout) return /* @__PURE__ */ React8.createElement(components.Callout, { block, className: blockId });
628
- else
629
- return /* @__PURE__ */ React8.createElement(
630
- "div",
631
- {
632
- className: `notion-callout ${((_s = block.format) == null ? void 0 : _s.block_color) && `notion-${(_t = block.format) == null ? void 0 : _t.block_color}_co`} ${blockId}`
633
- },
634
- /* @__PURE__ */ React8.createElement(PageIcon, { block }),
635
- /* @__PURE__ */ React8.createElement("div", { className: "notion-callout-text" }, /* @__PURE__ */ React8.createElement(Text, { value: (_u = block.properties) == null ? void 0 : _u.title, block }), children)
636
- );
446
+ return o.Callout ? /* @__PURE__ */ e.createElement(o.Callout, { block: t, className: c }) : /* @__PURE__ */ e.createElement(
447
+ "div",
448
+ {
449
+ className: `notion-callout ${((ae = t.format) == null ? void 0 : ae.block_color) && `notion-${(ye = t.format) == null ? void 0 : ye.block_color}_co`} ${c}`
450
+ },
451
+ /* @__PURE__ */ e.createElement(Ke, { block: t }),
452
+ /* @__PURE__ */ e.createElement("div", { className: "notion-callout-text" }, /* @__PURE__ */ e.createElement(C, { value: ($e = t.properties) == null ? void 0 : $e.title, block: t }), f)
453
+ );
637
454
  case "bookmark": {
638
- if (!block.properties) return null;
639
- const link = block.properties.link;
640
- if (!link || !((_v = link[0]) == null ? void 0 : _v[0])) return null;
641
- let title = getTextContent(block.properties.title);
642
- if (!title) title = getTextContent(link);
643
- if (title) {
644
- if (title.startsWith("http"))
645
- try {
646
- const url = new URL(title);
647
- title = url.hostname;
648
- } catch (err) {
649
- }
650
- }
651
- return /* @__PURE__ */ React8.createElement("div", { className: "notion-row" }, /* @__PURE__ */ React8.createElement(
652
- components.Link,
455
+ if (!t.properties) return null;
456
+ const l = t.properties.link;
457
+ if (!l || !((Ce = l[0]) != null && Ce[0])) return null;
458
+ let s = ie(t.properties.title);
459
+ if (s || (s = ie(l)), s && s.startsWith("http"))
460
+ try {
461
+ s = new URL(s).hostname;
462
+ } catch (E) {
463
+ }
464
+ return /* @__PURE__ */ e.createElement("div", { className: "notion-row" }, /* @__PURE__ */ e.createElement(
465
+ o.Link,
653
466
  {
654
467
  target: "_blank",
655
468
  rel: "noopener noreferrer",
656
- className: `notion-bookmark ${((_w = block.format) == null ? void 0 : _w.block_color) && `notion-${block.format.block_color}`} ${blockId}`,
657
- href: link[0][0]
469
+ className: `notion-bookmark ${((we = t.format) == null ? void 0 : we.block_color) && `notion-${t.format.block_color}`} ${c}`,
470
+ href: l[0][0]
658
471
  },
659
- /* @__PURE__ */ React8.createElement("div", null, title && /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-title" }, /* @__PURE__ */ React8.createElement(Text, { value: [[title]], block })), ((_x = block.properties) == null ? void 0 : _x.description) && /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-description" }, /* @__PURE__ */ React8.createElement(Text, { value: (_y = block.properties) == null ? void 0 : _y.description, block })), /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-link" }, ((_z = block.format) == null ? void 0 : _z.bookmark_icon) && /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-link-icon" }, /* @__PURE__ */ React8.createElement(LazyImage, { src: mapImageUrl((_A = block.format) == null ? void 0 : _A.bookmark_icon, block), alt: title })), /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-link-text" }, /* @__PURE__ */ React8.createElement(Text, { value: link, block })))),
660
- ((_B = block.format) == null ? void 0 : _B.bookmark_cover) && /* @__PURE__ */ React8.createElement("div", { className: "notion-bookmark-image" }, /* @__PURE__ */ React8.createElement(
661
- LazyImage,
472
+ /* @__PURE__ */ e.createElement("div", null, s && /* @__PURE__ */ e.createElement("div", { className: "notion-bookmark-title" }, /* @__PURE__ */ e.createElement(C, { value: [[s]], block: t })), ((xe = t.properties) == null ? void 0 : xe.description) && /* @__PURE__ */ e.createElement("div", { className: "notion-bookmark-description" }, /* @__PURE__ */ e.createElement(C, { value: (Ie = t.properties) == null ? void 0 : Ie.description, block: t })), /* @__PURE__ */ e.createElement("div", { className: "notion-bookmark-link" }, ((Le = t.format) == null ? void 0 : Le.bookmark_icon) && /* @__PURE__ */ e.createElement("div", { className: "notion-bookmark-link-icon" }, /* @__PURE__ */ e.createElement(Ne, { src: g((Pe = t.format) == null ? void 0 : Pe.bookmark_icon, t), alt: s })), /* @__PURE__ */ e.createElement("div", { className: "notion-bookmark-link-text" }, /* @__PURE__ */ e.createElement(C, { value: l, block: t })))),
473
+ ((Te = t.format) == null ? void 0 : Te.bookmark_cover) && /* @__PURE__ */ e.createElement("div", { className: "notion-bookmark-image" }, /* @__PURE__ */ e.createElement(
474
+ Ne,
662
475
  {
663
- src: mapImageUrl((_C = block.format) == null ? void 0 : _C.bookmark_cover, block),
664
- alt: getTextContent((_D = block.properties) == null ? void 0 : _D.title),
476
+ src: g((Se = t.format) == null ? void 0 : Se.bookmark_cover, t),
477
+ alt: ie((je = t.properties) == null ? void 0 : je.title),
665
478
  style: {
666
479
  objectFit: "cover"
667
480
  }
@@ -670,101 +483,86 @@ var Block = (props) => {
670
483
  ));
671
484
  }
672
485
  case "toggle":
673
- return /* @__PURE__ */ React8.createElement("details", { className: `notion-toggle ${blockId}` }, /* @__PURE__ */ React8.createElement("summary", null, /* @__PURE__ */ React8.createElement(Text, { value: (_E = block.properties) == null ? void 0 : _E.title, block })), /* @__PURE__ */ React8.createElement("div", null, children));
486
+ return /* @__PURE__ */ e.createElement("details", { className: `notion-toggle ${c}` }, /* @__PURE__ */ e.createElement("summary", null, /* @__PURE__ */ e.createElement(C, { value: (Oe = t.properties) == null ? void 0 : Oe.title, block: t })), /* @__PURE__ */ e.createElement("div", null, f));
674
487
  case "table_of_contents": {
675
- const page = getBlockParentPage(block, recordMap);
676
- if (!page) return null;
677
- const toc = getPageTableOfContents(page, recordMap);
678
- const blockColor = (_F = block.format) == null ? void 0 : _F.block_color;
679
- return /* @__PURE__ */ React8.createElement("div", { className: `notion-table-of-contents ${blockColor && `notion-${blockColor}`} ${blockId}` }, toc.map((tocItem) => /* @__PURE__ */ React8.createElement("a", { key: tocItem.id, href: `#${uuidToId2(tocItem.id)}`, className: "notion-table-of-contents-item" }, /* @__PURE__ */ React8.createElement(
488
+ const l = Je(t, r);
489
+ if (!l) return null;
490
+ const s = he(l, r), E = (Be = t.format) == null ? void 0 : Be.block_color;
491
+ return /* @__PURE__ */ e.createElement("div", { className: `notion-table-of-contents ${E && `notion-${E}`} ${c}` }, s.map((b) => /* @__PURE__ */ e.createElement("a", { key: b.id, href: `#${Ee(b.id)}`, className: "notion-table-of-contents-item" }, /* @__PURE__ */ e.createElement(
680
492
  "span",
681
493
  {
682
494
  className: "notion-table-of-contents-item-body",
683
495
  style: {
684
496
  display: "inline-block",
685
- marginLeft: tocItem.indentLevel * 24
497
+ marginLeft: b.indentLevel * 24
686
498
  }
687
499
  },
688
- tocItem.text
500
+ b.text
689
501
  ))));
690
502
  }
691
503
  case "to_do": {
692
- const isChecked = ((_I = (_H = (_G = block.properties) == null ? void 0 : _G.checked) == null ? void 0 : _H[0]) == null ? void 0 : _I[0]) === "Yes";
693
- return /* @__PURE__ */ React8.createElement("div", { className: `notion-to-do ${blockId}` }, /* @__PURE__ */ React8.createElement("div", { className: "notion-to-do-item" }, /* @__PURE__ */ React8.createElement(components.Checkbox, { blockId, isChecked }), /* @__PURE__ */ React8.createElement("div", { className: `notion-to-do-body ${isChecked && `notion-to-do-checked`}` }, /* @__PURE__ */ React8.createElement(Text, { value: (_J = block.properties) == null ? void 0 : _J.title, block }))), /* @__PURE__ */ React8.createElement("div", { className: "notion-to-do-children" }, children));
504
+ const l = ((Ae = (He = (Me = t.properties) == null ? void 0 : Me.checked) == null ? void 0 : He[0]) == null ? void 0 : Ae[0]) === "Yes";
505
+ return /* @__PURE__ */ e.createElement("div", { className: `notion-to-do ${c}` }, /* @__PURE__ */ e.createElement("div", { className: "notion-to-do-item" }, /* @__PURE__ */ e.createElement(o.Checkbox, { blockId: c, isChecked: l }), /* @__PURE__ */ e.createElement("div", { className: `notion-to-do-body ${l && "notion-to-do-checked"}` }, /* @__PURE__ */ e.createElement(C, { value: (Fe = t.properties) == null ? void 0 : Fe.title, block: t }))), /* @__PURE__ */ e.createElement("div", { className: "notion-to-do-children" }, f));
694
506
  }
695
507
  case "transclusion_container":
696
- return /* @__PURE__ */ React8.createElement("div", { className: `notion-sync-block ${blockId}` }, children);
508
+ return /* @__PURE__ */ e.createElement("div", { className: `notion-sync-block ${c}` }, f);
697
509
  case "transclusion_reference":
698
- return /* @__PURE__ */ React8.createElement(SyncPointerBlock, __spreadValues({ block, level: level + 1 }, props));
510
+ return /* @__PURE__ */ e.createElement(yt, W({ block: t, level: B + 1 }, n));
699
511
  case "alias": {
700
- const blockPointerId = (_L = (_K = block == null ? void 0 : block.format) == null ? void 0 : _K.alias_pointer) == null ? void 0 : _L.id;
701
- const linkedBlock = (_M = recordMap.block[blockPointerId]) == null ? void 0 : _M.value;
702
- if (!linkedBlock) {
703
- console.debug('"alias" missing block', blockPointerId);
704
- return null;
705
- }
706
- return /* @__PURE__ */ React8.createElement(components.PageLink, { className: `notion-page-link ${blockPointerId}}`, href: mapPageUrl(blockPointerId) }, /* @__PURE__ */ React8.createElement(PageTitle, { block: linkedBlock }));
512
+ const l = (Re = (De = t == null ? void 0 : t.format) == null ? void 0 : De.alias_pointer) == null ? void 0 : Re.id, s = (ze = r.block[l]) == null ? void 0 : ze.value;
513
+ return s ? /* @__PURE__ */ e.createElement(o.PageLink, { className: `notion-page-link ${l}}`, href: d(l) }, /* @__PURE__ */ e.createElement(Xe, { block: s })) : (console.debug('"alias" missing block', l), null);
707
514
  }
708
515
  case "table":
709
- return /* @__PURE__ */ React8.createElement("table", { className: `notion-simple-table ${blockId}` }, /* @__PURE__ */ React8.createElement("tbody", null, children));
516
+ return /* @__PURE__ */ e.createElement("table", { className: `notion-simple-table ${c}` }, /* @__PURE__ */ e.createElement("tbody", null, f));
710
517
  case "table_row": {
711
- const tableBlock = (_N = recordMap.block[block.parent_id]) == null ? void 0 : _N.value;
712
- const order = (_O = tableBlock.format) == null ? void 0 : _O.table_block_column_order;
713
- const formatMap = (_P = tableBlock.format) == null ? void 0 : _P.table_block_column_format;
714
- const backgroundColor = (_Q = block.format) == null ? void 0 : _Q.block_color;
715
- if (!tableBlock || !order) return null;
716
- return /* @__PURE__ */ React8.createElement("tr", { className: `notion-simple-table-row ${backgroundColor && `notion-${backgroundColor}`} ${blockId}` }, order.map((column) => {
717
- var _a2, _b2, _c2;
718
- const color = (_a2 = formatMap == null ? void 0 : formatMap[column]) == null ? void 0 : _a2.color;
719
- return /* @__PURE__ */ React8.createElement(
518
+ const l = (Ue = r.block[t.parent_id]) == null ? void 0 : Ue.value, s = (We = l.format) == null ? void 0 : We.table_block_column_order, E = (Ve = l.format) == null ? void 0 : Ve.table_block_column_format, b = (qe = t.format) == null ? void 0 : qe.block_color;
519
+ return !l || !s ? null : /* @__PURE__ */ e.createElement("tr", { className: `notion-simple-table-row ${b && `notion-${b}`} ${c}` }, s.map((x) => {
520
+ var J, D, j;
521
+ const $ = (J = E == null ? void 0 : E[x]) == null ? void 0 : J.color;
522
+ return /* @__PURE__ */ e.createElement(
720
523
  "td",
721
524
  {
722
- key: column,
723
- className: color ? `notion-${color}` : "",
525
+ key: x,
526
+ className: $ ? `notion-${$}` : "",
724
527
  style: {
725
- width: ((_b2 = formatMap == null ? void 0 : formatMap[column]) == null ? void 0 : _b2.width) || 120
528
+ width: ((D = E == null ? void 0 : E[x]) == null ? void 0 : D.width) || 120
726
529
  }
727
530
  },
728
- /* @__PURE__ */ React8.createElement("div", { className: "notion-simple-table-cell" }, /* @__PURE__ */ React8.createElement(Text, { value: ((_c2 = block.properties) == null ? void 0 : _c2[column]) || [["\u3164"]], block }))
531
+ /* @__PURE__ */ e.createElement("div", { className: "notion-simple-table-cell" }, /* @__PURE__ */ e.createElement(C, { value: ((j = t.properties) == null ? void 0 : j[x]) || [[""]], block: t }))
729
532
  );
730
533
  }));
731
534
  }
732
535
  case "external_object_instance":
733
- return /* @__PURE__ */ React8.createElement(EOI, { block, className: blockId });
536
+ return /* @__PURE__ */ e.createElement(dt, { block: t, className: c });
734
537
  default:
735
- if (true)
736
- console.debug("Unsupported type " + block.type, JSON.stringify(block, null, 2));
737
- return /* @__PURE__ */ React8.createElement("div", null);
538
+ return process.env.NODE_ENV !== "production" && console.debug("Unsupported type " + t.type, JSON.stringify(t, null, 2)), /* @__PURE__ */ e.createElement("div", null);
738
539
  }
739
- };
740
-
741
- // src/renderer.tsx
742
- var NotionRenderer = (_a) => {
743
- var _b = _a, {
744
- components,
745
- recordMap,
746
- mapPageUrl,
747
- mapImageUrl,
748
- searchNotion,
749
- isShowingSearch,
750
- onHideSearch,
751
- fullPage,
752
- rootPageId,
753
- rootDomain,
754
- rootSpaceId,
755
- darkMode,
756
- previewImages,
757
- forceCustomImages,
758
- showCollectionViewDropdown,
759
- linkTableTitleProperties,
760
- isLinkCollectionToUrlProperty,
761
- isImageZoomable = true,
762
- showTableOfContents,
763
- minTableOfContentsItems,
764
- defaultPageIcon,
765
- defaultPageCover,
766
- defaultPageCoverPosition
767
- } = _b, rest = __objRest(_b, [
540
+ }, jt = (h) => {
541
+ var k = h, {
542
+ components: n,
543
+ recordMap: a,
544
+ mapPageUrl: o,
545
+ mapImageUrl: m,
546
+ searchNotion: r,
547
+ isShowingSearch: d,
548
+ onHideSearch: g,
549
+ fullPage: N,
550
+ rootPageId: _,
551
+ rootDomain: v,
552
+ rootSpaceId: y,
553
+ darkMode: T,
554
+ previewImages: O,
555
+ forceCustomImages: L,
556
+ showCollectionViewDropdown: t,
557
+ linkTableTitleProperties: f,
558
+ isLinkCollectionToUrlProperty: B,
559
+ isImageZoomable: V = !0,
560
+ showTableOfContents: M,
561
+ minTableOfContentsItems: Q,
562
+ defaultPageIcon: ee,
563
+ defaultPageCover: R,
564
+ defaultPageCoverPosition: i
565
+ } = k, u = le(k, [
768
566
  "components",
769
567
  "recordMap",
770
568
  "mapPageUrl",
@@ -789,101 +587,90 @@ var NotionRenderer = (_a) => {
789
587
  "defaultPageCover",
790
588
  "defaultPageCoverPosition"
791
589
  ]);
792
- const zoom = React9.useMemo(
793
- () => typeof window !== "undefined" && mediumZoom({
590
+ const I = e.useMemo(
591
+ () => typeof window != "undefined" && lt({
794
592
  background: "rgba(0, 0, 0, 0.8)",
795
593
  minZoomScale: 2,
796
- margin: getMediumZoomMargin()
594
+ margin: wt()
797
595
  }),
798
596
  []
799
597
  );
800
- return /* @__PURE__ */ React9.createElement(
801
- NotionContextProvider,
598
+ return /* @__PURE__ */ e.createElement(
599
+ ft,
802
600
  {
803
- components,
804
- recordMap,
805
- mapPageUrl,
806
- mapImageUrl,
807
- searchNotion,
808
- isShowingSearch,
809
- onHideSearch,
810
- fullPage,
811
- rootPageId,
812
- rootDomain,
813
- rootSpaceId,
814
- darkMode,
815
- previewImages,
816
- forceCustomImages,
817
- showCollectionViewDropdown,
818
- linkTableTitleProperties,
819
- isLinkCollectionToUrlProperty,
820
- showTableOfContents,
821
- minTableOfContentsItems,
822
- defaultPageIcon,
823
- defaultPageCover,
824
- defaultPageCoverPosition,
825
- zoom: isImageZoomable ? zoom : null
601
+ components: n,
602
+ recordMap: a,
603
+ mapPageUrl: o,
604
+ mapImageUrl: m,
605
+ searchNotion: r,
606
+ isShowingSearch: d,
607
+ onHideSearch: g,
608
+ fullPage: N,
609
+ rootPageId: _,
610
+ rootDomain: v,
611
+ rootSpaceId: y,
612
+ darkMode: T,
613
+ previewImages: O,
614
+ forceCustomImages: L,
615
+ showCollectionViewDropdown: t,
616
+ linkTableTitleProperties: f,
617
+ isLinkCollectionToUrlProperty: B,
618
+ showTableOfContents: M,
619
+ minTableOfContentsItems: Q,
620
+ defaultPageIcon: ee,
621
+ defaultPageCover: R,
622
+ defaultPageCoverPosition: i,
623
+ zoom: V ? I : null
826
624
  },
827
- /* @__PURE__ */ React9.createElement(NotionBlockRenderer, __spreadValues({}, rest))
625
+ /* @__PURE__ */ e.createElement(_e, W({}, u))
828
626
  );
627
+ }, _e = (m) => {
628
+ var r = m, { level: n = 0, blockId: a } = r, o = le(r, ["level", "blockId"]);
629
+ var _, v;
630
+ const { recordMap: d } = ce(), g = a || Object.keys(d.block)[0], N = (_ = d.block[g]) == null ? void 0 : _.value;
631
+ return N ? /* @__PURE__ */ e.createElement(Ct, W({ key: g, level: n, block: N }, o), (v = N == null ? void 0 : N.content) == null ? void 0 : v.map((y) => /* @__PURE__ */ e.createElement(_e, W({ key: y, blockId: y, level: n + 1 }, o)))) : (process.env.NODE_ENV !== "production" && console.warn("missing block", a), null);
829
632
  };
830
- var NotionBlockRenderer = (_a) => {
831
- var _b = _a, { level = 0, blockId } = _b, props = __objRest(_b, ["level", "blockId"]);
832
- var _a2, _b2;
833
- const { recordMap } = useNotionContext();
834
- const id = blockId || Object.keys(recordMap.block)[0];
835
- const block = (_a2 = recordMap.block[id]) == null ? void 0 : _a2.value;
836
- if (!block) {
837
- if (true) console.warn("missing block", blockId);
838
- return null;
839
- }
840
- return /* @__PURE__ */ React9.createElement(Block, __spreadValues({ key: id, level, block }, props), (_b2 = block == null ? void 0 : block.content) == null ? void 0 : _b2.map((contentBlockId) => /* @__PURE__ */ React9.createElement(NotionBlockRenderer, __spreadValues({ key: contentBlockId, blockId: contentBlockId, level: level + 1 }, props))));
841
- };
842
- function getMediumZoomMargin() {
843
- const width = window.innerWidth;
844
- if (width < 500) return 8;
845
- else if (width < 800) return 20;
846
- else if (width < 1280) return 30;
847
- else if (width < 1600) return 40;
848
- else if (width < 1920) return 48;
849
- else return 72;
633
+ function wt() {
634
+ const n = window.innerWidth;
635
+ return n < 500 ? 8 : n < 800 ? 20 : n < 1280 ? 30 : n < 1600 ? 40 : n < 1920 ? 48 : 72;
850
636
  }
851
637
  export {
852
- Asset,
853
- AssetWrapper,
854
- Audio,
855
- Block,
856
- Breadcrumbs,
857
- Checkbox,
858
- CollectionColumnTitle,
859
- EOI,
860
- File,
861
- GoogleDrive,
862
- GracefulImage,
863
- Header,
864
- LiteYouTubeEmbed,
865
- NotionBlockRenderer,
866
- NotionContextConsumer,
867
- NotionContextProvider,
868
- NotionRenderer,
869
- PageAside,
870
- PageIcon,
871
- PageIconImpl,
872
- PageTitle,
873
- PageTitleImpl,
874
- PropertyIcon,
875
- Search,
876
- SearchDialog,
877
- SyncPointerBlock,
878
- Text,
879
- dummyLink,
880
- formatDate,
881
- formatNotionDateTime,
882
- getHashFragmentValue,
883
- getListNumber,
884
- getYoutubeId,
885
- iconMap,
886
- isBrowser,
887
- isUrl,
888
- useNotionContext
638
+ Dt as Asset,
639
+ Qe as AssetWrapper,
640
+ gt as Audio,
641
+ Ct as Block,
642
+ Rt as Breadcrumbs,
643
+ zt as Checkbox,
644
+ tn as CollectionColumnTitle,
645
+ dt as EOI,
646
+ Et as File,
647
+ bt as GoogleDrive,
648
+ mt as GracefulImage,
649
+ Ut as Header,
650
+ Wt as LiteYouTubeEmbed,
651
+ _e as NotionBlockRenderer,
652
+ Vt as NotionContextConsumer,
653
+ ft as NotionContextProvider,
654
+ jt as NotionRenderer,
655
+ _t as PageAside,
656
+ Ke as PageIcon,
657
+ qt as PageIconImpl,
658
+ Xe as PageTitle,
659
+ Gt as PageTitleImpl,
660
+ nn as PropertyIcon,
661
+ Yt as Search,
662
+ Zt as SearchDialog,
663
+ yt as SyncPointerBlock,
664
+ C as Text,
665
+ Jt as dummyLink,
666
+ Mt as formatDate,
667
+ Ht as formatNotionDateTime,
668
+ Xt as getHashFragmentValue,
669
+ ut as getListNumber,
670
+ Kt as getYoutubeId,
671
+ on as iconMap,
672
+ Qt as isBrowser,
673
+ At as isUrl,
674
+ ce as useNotionContext
889
675
  };
676
+ //# sourceMappingURL=index.js.map