@heycys/gallery 0.0.0-stage → 0.1.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 (806) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +50 -2
  3. package/THIRD-PARTY-NOTICES.md +3303 -0
  4. package/assets/writing-preferences.md +107 -0
  5. package/bin/gallery.mjs +10 -0
  6. package/browser/editor/components/bookmark/icons.mjs +6 -0
  7. package/browser/editor/components/bookmark/index.mjs +80 -0
  8. package/browser/editor/components/bookmark/page.mjs +147 -0
  9. package/browser/editor/components/builders.mjs +19 -0
  10. package/browser/editor/components/callout/index.mjs +64 -0
  11. package/browser/editor/components/code/index.mjs +327 -0
  12. package/browser/editor/components/code/page.mjs +561 -0
  13. package/browser/editor/components/colors.mjs +50 -0
  14. package/browser/editor/components/columns/index.mjs +104 -0
  15. package/browser/editor/components/columns/page.mjs +310 -0
  16. package/browser/editor/components/details/index.mjs +73 -0
  17. package/browser/editor/components/details/page.mjs +86 -0
  18. package/browser/editor/components/dialog/index.mjs +84 -0
  19. package/browser/editor/components/dialog/page.mjs +201 -0
  20. package/browser/editor/components/divider/index.mjs +48 -0
  21. package/browser/editor/components/embed/icons.mjs +11 -0
  22. package/browser/editor/components/embed/index.mjs +123 -0
  23. package/browser/editor/components/embed/page.mjs +309 -0
  24. package/browser/editor/components/figure/index.mjs +87 -0
  25. package/browser/editor/components/figure/page.mjs +42 -0
  26. package/browser/editor/components/file/icons.mjs +14 -0
  27. package/browser/editor/components/file/index.mjs +77 -0
  28. package/browser/editor/components/file/page.mjs +114 -0
  29. package/browser/editor/components/flowchart/add.mjs +123 -0
  30. package/browser/editor/components/flowchart/index.mjs +246 -0
  31. package/browser/editor/components/flowchart/page.mjs +453 -0
  32. package/browser/editor/components/heading/index.mjs +53 -0
  33. package/browser/editor/components/heading/page.mjs +6 -0
  34. package/browser/editor/components/highlight/index.mjs +63 -0
  35. package/browser/editor/components/icon/index.mjs +57 -0
  36. package/browser/editor/components/icon/page.mjs +286 -0
  37. package/browser/editor/components/icons.mjs +48 -0
  38. package/browser/editor/components/image/crop.mjs +189 -0
  39. package/browser/editor/components/image/index.mjs +104 -0
  40. package/browser/editor/components/image/page.mjs +385 -0
  41. package/browser/editor/components/image/viewer.mjs +213 -0
  42. package/browser/editor/components/installed/index.mjs +179 -0
  43. package/browser/editor/components/installed/page.mjs +523 -0
  44. package/browser/editor/components/installed/served.mjs +35 -0
  45. package/browser/editor/components/kit.mjs +67 -0
  46. package/browser/editor/components/list/index.mjs +194 -0
  47. package/browser/editor/components/list/join.mjs +68 -0
  48. package/browser/editor/components/list/numbers.mjs +107 -0
  49. package/browser/editor/components/list/page.mjs +632 -0
  50. package/browser/editor/components/math/index.mjs +88 -0
  51. package/browser/editor/components/math/page.mjs +236 -0
  52. package/browser/editor/components/math/tex-logo.mjs +6 -0
  53. package/browser/editor/components/media/icons.mjs +19 -0
  54. package/browser/editor/components/media/page.mjs +192 -0
  55. package/browser/editor/components/media/parts.mjs +60 -0
  56. package/browser/editor/components/media/size.mjs +20 -0
  57. package/browser/editor/components/media/toolbar.mjs +37 -0
  58. package/browser/editor/components/media/write.mjs +7 -0
  59. package/browser/editor/components/pages.mjs +46 -0
  60. package/browser/editor/components/paragraph/index.mjs +43 -0
  61. package/browser/editor/components/paragraph/page.mjs +52 -0
  62. package/browser/editor/components/placeholder-bar.mjs +17 -0
  63. package/browser/editor/components/placeholder.mjs +128 -0
  64. package/browser/editor/components/quote/index.mjs +33 -0
  65. package/browser/editor/components/registry.mjs +859 -0
  66. package/browser/editor/components/rows.mjs +16 -0
  67. package/browser/editor/components/section/index.mjs +42 -0
  68. package/browser/editor/components/section/page.mjs +141 -0
  69. package/browser/editor/components/set-apart.mjs +24 -0
  70. package/browser/editor/components/sheets/index.mjs +137 -0
  71. package/browser/editor/components/sheets/page.mjs +227 -0
  72. package/browser/editor/components/sheets/pills.mjs +226 -0
  73. package/browser/editor/components/table/grid.mjs +73 -0
  74. package/browser/editor/components/table/index.mjs +308 -0
  75. package/browser/editor/components/table/page.mjs +683 -0
  76. package/browser/editor/components/table/slots.mjs +41 -0
  77. package/browser/editor/components/widget/index.mjs +50 -0
  78. package/browser/editor/page/annotate/anchors.mjs +230 -0
  79. package/browser/editor/page/annotate/card.mjs +102 -0
  80. package/browser/editor/page/annotate/index.mjs +1656 -0
  81. package/browser/editor/page/at-menu/index.mjs +317 -0
  82. package/browser/editor/page/autosave.mjs +1023 -0
  83. package/browser/editor/page/beside.mjs +21 -0
  84. package/browser/editor/page/block-info.mjs +63 -0
  85. package/browser/editor/page/block-menu/colors.mjs +84 -0
  86. package/browser/editor/page/block-menu/index.mjs +217 -0
  87. package/browser/editor/page/blocks.mjs +255 -0
  88. package/browser/editor/page/caret.mjs +682 -0
  89. package/browser/editor/page/changes/bar.mjs +102 -0
  90. package/browser/editor/page/changes/ghost.mjs +206 -0
  91. package/browser/editor/page/changes/gone-words.mjs +94 -0
  92. package/browser/editor/page/changes/index.mjs +447 -0
  93. package/browser/editor/page/changes/words.mjs +27 -0
  94. package/browser/editor/page/chip-fills.mjs +126 -0
  95. package/browser/editor/page/clipboard/import/colors.mjs +192 -0
  96. package/browser/editor/page/clipboard/import/html.mjs +792 -0
  97. package/browser/editor/page/clipboard/import/inline.mjs +232 -0
  98. package/browser/editor/page/clipboard/import/languages.mjs +42 -0
  99. package/browser/editor/page/clipboard/import/markdown.mjs +760 -0
  100. package/browser/editor/page/clipboard/import/math.mjs +100 -0
  101. package/browser/editor/page/clipboard/import/office.mjs +245 -0
  102. package/browser/editor/page/clipboard/import/read.mjs +120 -0
  103. package/browser/editor/page/clipboard/import/rich.mjs +29 -0
  104. package/browser/editor/page/clipboard/import/to-blocks.mjs +290 -0
  105. package/browser/editor/page/clipboard/index.mjs +816 -0
  106. package/browser/editor/page/clipboard/own/blocks.mjs +211 -0
  107. package/browser/editor/page/clipboard/own/chart-keys.mjs +58 -0
  108. package/browser/editor/page/clipboard/own/describe.mjs +124 -0
  109. package/browser/editor/page/clipboard/own/export.mjs +167 -0
  110. package/browser/editor/page/clipboard/own/ids.mjs +39 -0
  111. package/browser/editor/page/clipboard/own/index.mjs +13 -0
  112. package/browser/editor/page/clipboard/own/rules.mjs +44 -0
  113. package/browser/editor/page/clipboard/own/selection.mjs +159 -0
  114. package/browser/editor/page/clipboard/own/writers.mjs +315 -0
  115. package/browser/editor/page/columns/index.mjs +360 -0
  116. package/browser/editor/page/commit.mjs +1813 -0
  117. package/browser/editor/page/conflicts.mjs +249 -0
  118. package/browser/editor/page/convert.mjs +831 -0
  119. package/browser/editor/page/core.mjs +1693 -0
  120. package/browser/editor/page/drag/drop.mjs +307 -0
  121. package/browser/editor/page/drag/index.mjs +351 -0
  122. package/browser/editor/page/drag/preview.mjs +126 -0
  123. package/browser/editor/page/edge-scroll.mjs +50 -0
  124. package/browser/editor/page/editor.mjs +1780 -0
  125. package/browser/editor/page/emoji-picker/emoji-tab.mjs +287 -0
  126. package/browser/editor/page/emoji-picker/glyph-html.mjs +26 -0
  127. package/browser/editor/page/emoji-picker/grid.mjs +81 -0
  128. package/browser/editor/page/emoji-picker/icon-tab.mjs +217 -0
  129. package/browser/editor/page/emoji-picker/icons.mjs +31 -0
  130. package/browser/editor/page/emoji-picker/index.mjs +166 -0
  131. package/browser/editor/page/emoji-picker/styles.mjs +161 -0
  132. package/browser/editor/page/emoji-picker/support.mjs +204 -0
  133. package/browser/editor/page/emoji-picker/upload.mjs +236 -0
  134. package/browser/editor/page/export-report.mjs +23 -0
  135. package/browser/editor/page/fills.mjs +62 -0
  136. package/browser/editor/page/find/index.mjs +107 -0
  137. package/browser/editor/page/flags.mjs +70 -0
  138. package/browser/editor/page/fold/index.mjs +348 -0
  139. package/browser/editor/page/fold/rule.mjs +125 -0
  140. package/browser/editor/page/folded.mjs +23 -0
  141. package/browser/editor/page/format-bar/bar.mjs +449 -0
  142. package/browser/editor/page/format-bar/brush.mjs +77 -0
  143. package/browser/editor/page/format-bar/colors.mjs +46 -0
  144. package/browser/editor/page/format-bar/index.mjs +404 -0
  145. package/browser/editor/page/formula/index.mjs +236 -0
  146. package/browser/editor/page/formula/panel.mjs +336 -0
  147. package/browser/editor/page/formula/symbols.mjs +156 -0
  148. package/browser/editor/page/frame.mjs +74 -0
  149. package/browser/editor/page/frames.mjs +196 -0
  150. package/browser/editor/page/geometry.mjs +402 -0
  151. package/browser/editor/page/gesture.mjs +45 -0
  152. package/browser/editor/page/handle/index.mjs +650 -0
  153. package/browser/editor/page/handle-sizes.mjs +14 -0
  154. package/browser/editor/page/hints/index.mjs +84 -0
  155. package/browser/editor/page/history.mjs +401 -0
  156. package/browser/editor/page/insert/index.mjs +256 -0
  157. package/browser/editor/page/kept.mjs +38 -0
  158. package/browser/editor/page/links/address.mjs +40 -0
  159. package/browser/editor/page/links/index.mjs +866 -0
  160. package/browser/editor/page/links/pages.mjs +131 -0
  161. package/browser/editor/page/links/views.mjs +369 -0
  162. package/browser/editor/page/long-runs.mjs +75 -0
  163. package/browser/editor/page/look.mjs +77 -0
  164. package/browser/editor/page/made.mjs +24 -0
  165. package/browser/editor/page/margin.mjs +373 -0
  166. package/browser/editor/page/markdown/index.mjs +88 -0
  167. package/browser/editor/page/markdown/rules.mjs +33 -0
  168. package/browser/editor/page/marks.mjs +377 -0
  169. package/browser/editor/page/media-menu/index.mjs +158 -0
  170. package/browser/editor/page/menu.mjs +544 -0
  171. package/browser/editor/page/merge.mjs +124 -0
  172. package/browser/editor/page/notices.mjs +142 -0
  173. package/browser/editor/page/offered.mjs +32 -0
  174. package/browser/editor/page/outline/folds.mjs +53 -0
  175. package/browser/editor/page/outline/index.mjs +783 -0
  176. package/browser/editor/page/outline/list.mjs +184 -0
  177. package/browser/editor/page/outline/read.mjs +201 -0
  178. package/browser/editor/page/outline/strip.mjs +287 -0
  179. package/browser/editor/page/outline/tree.mjs +248 -0
  180. package/browser/editor/page/overlay-layer.mjs +227 -0
  181. package/browser/editor/page/overlays.mjs +205 -0
  182. package/browser/editor/page/own.mjs +28 -0
  183. package/browser/editor/page/pads.mjs +71 -0
  184. package/browser/editor/page/page-objects.mjs +105 -0
  185. package/browser/editor/page/panel.mjs +65 -0
  186. package/browser/editor/page/placement.mjs +58 -0
  187. package/browser/editor/page/post.mjs +41 -0
  188. package/browser/editor/page/present-links.mjs +50 -0
  189. package/browser/editor/page/quiet.mjs +48 -0
  190. package/browser/editor/page/resize/index.mjs +327 -0
  191. package/browser/editor/page/select-all/index.mjs +262 -0
  192. package/browser/editor/page/selection/delete.mjs +61 -0
  193. package/browser/editor/page/selection/index.mjs +164 -0
  194. package/browser/editor/page/selection/marquee.mjs +174 -0
  195. package/browser/editor/page/session.mjs +168 -0
  196. package/browser/editor/page/slash-menu/index.mjs +291 -0
  197. package/browser/editor/page/storage.mjs +48 -0
  198. package/browser/editor/page/sync-state.mjs +267 -0
  199. package/browser/editor/page/table/aligns.mjs +29 -0
  200. package/browser/editor/page/table/cell-bar.mjs +141 -0
  201. package/browser/editor/page/table/cells.mjs +527 -0
  202. package/browser/editor/page/table/icons.mjs +40 -0
  203. package/browser/editor/page/table/index.mjs +990 -0
  204. package/browser/editor/page/table/lists.mjs +187 -0
  205. package/browser/editor/page/table/widths.mjs +313 -0
  206. package/browser/editor/page/tex.mjs +32 -0
  207. package/browser/editor/page/text-select/index.mjs +671 -0
  208. package/browser/editor/page/tooltip.mjs +98 -0
  209. package/browser/editor/page/type-grid.mjs +83 -0
  210. package/browser/editor/page/typing/code-edges.mjs +274 -0
  211. package/browser/editor/page/typing/index.mjs +282 -0
  212. package/browser/editor/page/typing/leave.mjs +68 -0
  213. package/browser/editor/page/ui.mjs +160 -0
  214. package/browser/shared/annotations.mjs +569 -0
  215. package/browser/shared/code-folds.mjs +14 -0
  216. package/browser/shared/code-languages.mjs +70 -0
  217. package/browser/shared/code-lines.mjs +30 -0
  218. package/browser/shared/colors.mjs +30 -0
  219. package/browser/shared/component-catalog.mjs +573 -0
  220. package/browser/shared/components/bookmark.mjs +26 -0
  221. package/browser/shared/components/callout.mjs +9 -0
  222. package/browser/shared/components/chart.mjs +20 -0
  223. package/browser/shared/components/code.mjs +37 -0
  224. package/browser/shared/components/columns.mjs +16 -0
  225. package/browser/shared/components/details.mjs +15 -0
  226. package/browser/shared/components/dialog.mjs +28 -0
  227. package/browser/shared/components/diff.mjs +18 -0
  228. package/browser/shared/components/divider.mjs +6 -0
  229. package/browser/shared/components/embed.mjs +25 -0
  230. package/browser/shared/components/figure.mjs +14 -0
  231. package/browser/shared/components/file.mjs +23 -0
  232. package/browser/shared/components/heading.mjs +6 -0
  233. package/browser/shared/components/highlight.mjs +9 -0
  234. package/browser/shared/components/icon.mjs +18 -0
  235. package/browser/shared/components/image.mjs +39 -0
  236. package/browser/shared/components/index.mjs +396 -0
  237. package/browser/shared/components/installed.mjs +232 -0
  238. package/browser/shared/components/list.mjs +146 -0
  239. package/browser/shared/components/math.mjs +49 -0
  240. package/browser/shared/components/mention.mjs +33 -0
  241. package/browser/shared/components/page.mjs +46 -0
  242. package/browser/shared/components/paragraph.mjs +9 -0
  243. package/browser/shared/components/quote.mjs +6 -0
  244. package/browser/shared/components/section.mjs +8 -0
  245. package/browser/shared/components/sheets.mjs +80 -0
  246. package/browser/shared/components/state.mjs +20 -0
  247. package/browser/shared/components/table.mjs +49 -0
  248. package/browser/shared/components/text.mjs +14 -0
  249. package/browser/shared/components/widget.mjs +10 -0
  250. package/browser/shared/copy-ids.mjs +72 -0
  251. package/browser/shared/css-references.mjs +110 -0
  252. package/browser/shared/document-look.mjs +178 -0
  253. package/browser/shared/emoji/custom.mjs +91 -0
  254. package/browser/shared/emoji/data/LICENSE-lucide.txt +43 -0
  255. package/browser/shared/emoji/data/LICENSE-mingcute.txt +202 -0
  256. package/browser/shared/emoji/data/LICENSE-tabler.txt +21 -0
  257. package/browser/shared/emoji/data/README.md +28 -0
  258. package/browser/shared/emoji/data/categories.json +1 -0
  259. package/browser/shared/emoji/data/icons.json +1 -0
  260. package/browser/shared/emoji/data/keywords-en.json +1 -0
  261. package/browser/shared/emoji/data/keywords-zh.json +1 -0
  262. package/browser/shared/emoji/data/names.json +1 -0
  263. package/browser/shared/emoji/data/positions.json +1 -0
  264. package/browser/shared/emoji/data/twemoji-index.json +1 -0
  265. package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
  266. package/browser/shared/emoji/data.mjs +194 -0
  267. package/browser/shared/emoji/emoji.mjs +38 -0
  268. package/browser/shared/emoji/glyphs.mjs +134 -0
  269. package/browser/shared/emoji/icon-value.mjs +91 -0
  270. package/browser/shared/escape.mjs +20 -0
  271. package/browser/shared/export-wrap.mjs +89 -0
  272. package/browser/shared/files.mjs +33 -0
  273. package/browser/shared/html-tree.mjs +59 -0
  274. package/browser/shared/http.mjs +22 -0
  275. package/browser/shared/i18n/en.mjs +1223 -0
  276. package/browser/shared/i18n/index.mjs +132 -0
  277. package/browser/shared/ids.mjs +24 -0
  278. package/browser/shared/import-types.mjs +23 -0
  279. package/browser/shared/inline-spacing.mjs +97 -0
  280. package/browser/shared/layers.mjs +42 -0
  281. package/browser/shared/long-runs.mjs +39 -0
  282. package/browser/shared/media.mjs +162 -0
  283. package/browser/shared/new-names.mjs +67 -0
  284. package/browser/shared/number-reading.mjs +92 -0
  285. package/browser/shared/old-names.mjs +143 -0
  286. package/browser/shared/outline.mjs +194 -0
  287. package/browser/shared/page-address.mjs +140 -0
  288. package/browser/shared/page-links.mjs +86 -0
  289. package/browser/shared/paths.mjs +73 -0
  290. package/browser/shared/preferences.mjs +116 -0
  291. package/browser/shared/preview-server.mjs +247 -0
  292. package/browser/shared/qa-levels.mjs +93 -0
  293. package/browser/shared/reading-place.mjs +91 -0
  294. package/browser/shared/renamed-storage.mjs +220 -0
  295. package/browser/shared/reports.mjs +46 -0
  296. package/browser/shared/search.mjs +85 -0
  297. package/browser/shared/session.mjs +77 -0
  298. package/browser/shared/table-chart.mjs +113 -0
  299. package/browser/shared/table-hides.mjs +120 -0
  300. package/browser/shared/table-slots.mjs +75 -0
  301. package/browser/shared/words.mjs +23 -0
  302. package/browser/shared/workspace-look.mjs +91 -0
  303. package/browser/shared/workspace.mjs +535 -0
  304. package/browser/shared/writing-preferences.mjs +68 -0
  305. package/browser/shared/zoom.mjs +57 -0
  306. package/dist/chunk-2B5E4CDJ.mjs +2 -0
  307. package/dist/chunk-342HXE3Q.mjs +2 -0
  308. package/dist/chunk-3HIRPVLU.mjs +2 -0
  309. package/dist/chunk-43B75J5T.mjs +2 -0
  310. package/dist/chunk-4FS7Z7WR.mjs +2 -0
  311. package/dist/chunk-4K5KC6V2.mjs +2 -0
  312. package/dist/chunk-5L7RYZCL.mjs +2 -0
  313. package/dist/chunk-5MHMDLZD.mjs +4 -0
  314. package/dist/chunk-5ZKJ3H4P.mjs +8 -0
  315. package/dist/chunk-64K7IPLO.mjs +255 -0
  316. package/dist/chunk-6QXGZM36.mjs +8 -0
  317. package/dist/chunk-6RGJOMJP.mjs +16 -0
  318. package/dist/chunk-742D2WWJ.mjs +19 -0
  319. package/dist/chunk-7DTINW6U.mjs +48 -0
  320. package/dist/chunk-A55HN5OK.mjs +2 -0
  321. package/dist/chunk-AGDILNWB.mjs +2 -0
  322. package/dist/chunk-AJ73XJF3.mjs +2 -0
  323. package/dist/chunk-AUZGSZJH.mjs +13 -0
  324. package/dist/chunk-BFE45AKL.mjs +2 -0
  325. package/dist/chunk-BGGDRNYQ.mjs +10 -0
  326. package/dist/chunk-BXO2ZY5P.mjs +2 -0
  327. package/dist/chunk-C564NU2H.mjs +77 -0
  328. package/dist/chunk-CEH4MRCC.mjs +2 -0
  329. package/dist/chunk-CY2FNNAB.mjs +16 -0
  330. package/dist/chunk-DFUDV4LX.mjs +2 -0
  331. package/dist/chunk-DKXG4XDG.mjs +2 -0
  332. package/dist/chunk-E7LWZRXY.mjs +4 -0
  333. package/dist/chunk-EZQ34M3F.mjs +124 -0
  334. package/dist/chunk-EZY3WC6Z.mjs +15 -0
  335. package/dist/chunk-FDLXYYG4.mjs +4 -0
  336. package/dist/chunk-FUKQNOQS.mjs +9 -0
  337. package/dist/chunk-GB5SOYQJ.mjs +7 -0
  338. package/dist/chunk-GRAXKKG4.mjs +2 -0
  339. package/dist/chunk-HYMEEXKN.mjs +4 -0
  340. package/dist/chunk-IVDLMMBD.mjs +2 -0
  341. package/dist/chunk-JPOSLGOC.mjs +6 -0
  342. package/dist/chunk-JVHHHGEA.mjs +3 -0
  343. package/dist/chunk-L3QKH4OK.mjs +26 -0
  344. package/dist/chunk-LAE5NQ4B.mjs +2 -0
  345. package/dist/chunk-LCTHTZIL.mjs +960 -0
  346. package/dist/chunk-LEF6DRCK.mjs +59 -0
  347. package/dist/chunk-LKX55H76.mjs +2 -0
  348. package/dist/chunk-LS4F7JUM.mjs +2 -0
  349. package/dist/chunk-MAFIGVXY.mjs +2 -0
  350. package/dist/chunk-NO5NJCHO.mjs +2 -0
  351. package/dist/chunk-NQPVAU63.mjs +2 -0
  352. package/dist/chunk-NSKUTQ5J.mjs +5 -0
  353. package/dist/chunk-O35FIXRB.mjs +2 -0
  354. package/dist/chunk-P2CAZPDP.mjs +3 -0
  355. package/dist/chunk-PL6GHLGD.mjs +15 -0
  356. package/dist/chunk-QAIHRH3I.mjs +13 -0
  357. package/dist/chunk-QJIR2BLP.mjs +6 -0
  358. package/dist/chunk-QR6A54KJ.mjs +3 -0
  359. package/dist/chunk-QUPLVPB2.mjs +7 -0
  360. package/dist/chunk-R7BNENLY.mjs +4 -0
  361. package/dist/chunk-S6O4UHLC.mjs +2 -0
  362. package/dist/chunk-SGJWQKEI.mjs +2 -0
  363. package/dist/chunk-SYGN7GLU.mjs +2 -0
  364. package/dist/chunk-TMYZB6AV.mjs +2 -0
  365. package/dist/chunk-TX6JH7TR.mjs +2 -0
  366. package/dist/chunk-TYK6VNAB.mjs +10 -0
  367. package/dist/chunk-U3SSPL4K.mjs +8 -0
  368. package/dist/chunk-U6KNPJPR.mjs +2 -0
  369. package/dist/chunk-UALRNVSE.mjs +4 -0
  370. package/dist/chunk-UH4SIXTR.mjs +2 -0
  371. package/dist/chunk-UMHUSOPJ.mjs +2 -0
  372. package/dist/chunk-V3HXVQEM.mjs +2 -0
  373. package/dist/chunk-V5JTW2LH.mjs +27 -0
  374. package/dist/chunk-V5VXUJKG.mjs +2 -0
  375. package/dist/chunk-V6XZ4VIR.mjs +2 -0
  376. package/dist/chunk-VBXMADMP.mjs +2 -0
  377. package/dist/chunk-VNV55RUA.mjs +2 -0
  378. package/dist/chunk-VPD2PS35.mjs +2 -0
  379. package/dist/chunk-W3BGBJQW.mjs +2 -0
  380. package/dist/chunk-W4VKN3GF.mjs +7 -0
  381. package/dist/chunk-W5BXXPDJ.mjs +3 -0
  382. package/dist/chunk-W7XHE4CT.mjs +2 -0
  383. package/dist/chunk-XNROSH2T.mjs +4 -0
  384. package/dist/chunk-XUNHRCOG.mjs +6 -0
  385. package/dist/chunk-Y34NR5JL.mjs +2 -0
  386. package/dist/chunk-Y6RLRPG3.mjs +3 -0
  387. package/dist/chunk-YEY3RSFQ.mjs +2 -0
  388. package/dist/cli.mjs +2 -0
  389. package/dist/server.mjs +2 -0
  390. package/dist/worker.mjs +5 -0
  391. package/kit/charts.js +355 -0
  392. package/kit/code.js +164 -0
  393. package/kit/dialogs.js +157 -0
  394. package/kit/math.js +2004 -0
  395. package/kit/report.css +2932 -0
  396. package/kit/runtime.js +1782 -0
  397. package/kit/sheets.js +123 -0
  398. package/kit/state.js +217 -0
  399. package/kit/tables.js +1499 -0
  400. package/kit/tokens.js +29 -0
  401. package/kit/ui.js +658 -0
  402. package/package.json +41 -4
  403. package/release.json +25 -0
  404. package/sdk/column-widths.d.ts +56 -0
  405. package/sdk/doc-charts.d.ts +82 -0
  406. package/sdk/doc-code.d.ts +28 -0
  407. package/sdk/doc-dialogs.d.ts +4 -0
  408. package/sdk/doc-kit.d.ts +147 -0
  409. package/sdk/doc-math.d.ts +3 -0
  410. package/sdk/doc-sheets.d.ts +15 -0
  411. package/sdk/doc-state.d.ts +41 -0
  412. package/sdk/doc-tables.d.ts +24 -0
  413. package/sdk/doc-tokens.d.ts +22 -0
  414. package/sdk/index.d.ts +30 -0
  415. package/skill/SKILL.md +150 -0
  416. package/skill/agents/openai.yaml +5 -0
  417. package/skill/references/building-components.md +367 -0
  418. package/skill/references/example-report.html +356 -0
  419. package/skill/references/writing-html.md +187 -0
  420. package/skill/sdk/column-widths.d.ts +56 -0
  421. package/skill/sdk/doc-charts.d.ts +82 -0
  422. package/skill/sdk/doc-code.d.ts +28 -0
  423. package/skill/sdk/doc-dialogs.d.ts +4 -0
  424. package/skill/sdk/doc-kit.d.ts +147 -0
  425. package/skill/sdk/doc-math.d.ts +3 -0
  426. package/skill/sdk/doc-sheets.d.ts +15 -0
  427. package/skill/sdk/doc-state.d.ts +41 -0
  428. package/skill/sdk/doc-tables.d.ts +24 -0
  429. package/skill/sdk/doc-tokens.d.ts +22 -0
  430. package/skill/sdk/index.d.ts +30 -0
  431. package/starter/doc.html +21 -0
  432. package/starter/doc.json +5 -0
  433. package/vendor/d3.v7.9.0.min.js +2 -0
  434. package/vendor/katex/auto-render.min.js +1 -0
  435. package/vendor/katex/contrib/mhchem.min.js +1 -0
  436. package/vendor/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  437. package/vendor/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  438. package/vendor/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  439. package/vendor/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  440. package/vendor/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  441. package/vendor/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
  442. package/vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  443. package/vendor/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
  444. package/vendor/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
  445. package/vendor/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  446. package/vendor/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
  447. package/vendor/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  448. package/vendor/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  449. package/vendor/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  450. package/vendor/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
  451. package/vendor/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  452. package/vendor/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  453. package/vendor/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  454. package/vendor/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  455. package/vendor/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  456. package/vendor/katex/katex.min.css +1 -0
  457. package/vendor/katex/katex.min.js +1 -0
  458. package/vendor/pdfjs/LICENSE +177 -0
  459. package/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  460. package/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  461. package/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
  462. package/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  463. package/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  464. package/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
  465. package/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  466. package/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  467. package/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  468. package/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  469. package/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  470. package/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  471. package/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  472. package/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  473. package/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  474. package/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
  475. package/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  476. package/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  477. package/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
  478. package/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  479. package/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  480. package/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  481. package/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  482. package/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  483. package/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  484. package/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  485. package/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  486. package/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  487. package/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  488. package/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  489. package/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  490. package/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  491. package/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  492. package/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  493. package/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  494. package/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  495. package/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  496. package/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  497. package/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  498. package/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  499. package/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  500. package/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  501. package/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  502. package/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  503. package/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  504. package/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  505. package/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
  506. package/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
  507. package/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  508. package/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  509. package/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  510. package/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  511. package/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  512. package/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  513. package/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  514. package/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  515. package/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  516. package/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  517. package/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  518. package/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  519. package/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  520. package/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  521. package/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
  522. package/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
  523. package/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
  524. package/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  525. package/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  526. package/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
  527. package/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  528. package/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  529. package/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
  530. package/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
  531. package/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  532. package/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  533. package/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  534. package/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  535. package/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  536. package/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  537. package/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  538. package/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  539. package/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
  540. package/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
  541. package/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  542. package/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  543. package/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  544. package/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  545. package/vendor/pdfjs/cmaps/H.bcmap +0 -0
  546. package/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  547. package/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  548. package/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  549. package/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  550. package/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  551. package/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  552. package/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  553. package/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  554. package/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  555. package/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  556. package/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  557. package/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  558. package/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
  559. package/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
  560. package/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  561. package/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  562. package/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
  563. package/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  564. package/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  565. package/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
  566. package/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  567. package/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  568. package/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  569. package/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  570. package/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  571. package/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  572. package/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
  573. package/vendor/pdfjs/cmaps/LICENSE +36 -0
  574. package/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
  575. package/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
  576. package/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  577. package/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  578. package/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
  579. package/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  580. package/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  581. package/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  582. package/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  583. package/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  584. package/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  585. package/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  586. package/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  587. package/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  588. package/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  589. package/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  590. package/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  591. package/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  592. package/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  593. package/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  594. package/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  595. package/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  596. package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  597. package/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  598. package/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  599. package/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  600. package/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  601. package/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  602. package/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  603. package/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  604. package/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  605. package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  606. package/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  607. package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  608. package/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  609. package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  610. package/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  611. package/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  612. package/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  613. package/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  614. package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  615. package/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  616. package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  617. package/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  618. package/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  619. package/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  620. package/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  621. package/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  622. package/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  623. package/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  624. package/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  625. package/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  626. package/vendor/pdfjs/cmaps/V.bcmap +0 -0
  627. package/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  628. package/vendor/pdfjs/legacy/build/pdf.min.mjs +27 -0
  629. package/vendor/pdfjs/legacy/build/pdf.worker.min.mjs +27 -0
  630. package/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  631. package/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  632. package/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  633. package/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  634. package/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  635. package/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  636. package/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  637. package/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  638. package/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  639. package/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  640. package/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  641. package/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  642. package/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  643. package/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  644. package/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  645. package/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  646. package/vendor/types/@types/d3/LICENSE +21 -0
  647. package/vendor/types/@types/d3/index.d.ts +39 -0
  648. package/vendor/types/@types/d3/package.json +81 -0
  649. package/vendor/types/@types/d3-array/LICENSE +21 -0
  650. package/vendor/types/@types/d3-array/index.d.ts +1118 -0
  651. package/vendor/types/@types/d3-array/package.json +56 -0
  652. package/vendor/types/@types/d3-axis/LICENSE +21 -0
  653. package/vendor/types/@types/d3-axis/index.d.ts +293 -0
  654. package/vendor/types/@types/d3-axis/package.json +47 -0
  655. package/vendor/types/@types/d3-brush/LICENSE +21 -0
  656. package/vendor/types/@types/d3-brush/index.d.ts +255 -0
  657. package/vendor/types/@types/d3-brush/package.json +42 -0
  658. package/vendor/types/@types/d3-chord/LICENSE +21 -0
  659. package/vendor/types/@types/d3-chord/index.d.ts +471 -0
  660. package/vendor/types/@types/d3-chord/package.json +40 -0
  661. package/vendor/types/@types/d3-color/LICENSE +21 -0
  662. package/vendor/types/@types/d3-color/index.d.ts +669 -0
  663. package/vendor/types/@types/d3-color/package.json +55 -0
  664. package/vendor/types/@types/d3-contour/LICENSE +21 -0
  665. package/vendor/types/@types/d3-contour/index.d.ts +222 -0
  666. package/vendor/types/@types/d3-contour/package.json +38 -0
  667. package/vendor/types/@types/d3-delaunay/LICENSE +21 -0
  668. package/vendor/types/@types/d3-delaunay/index.d.ts +316 -0
  669. package/vendor/types/@types/d3-delaunay/package.json +30 -0
  670. package/vendor/types/@types/d3-dispatch/LICENSE +21 -0
  671. package/vendor/types/@types/d3-dispatch/index.d.ts +96 -0
  672. package/vendor/types/@types/d3-dispatch/package.json +51 -0
  673. package/vendor/types/@types/d3-drag/LICENSE +21 -0
  674. package/vendor/types/@types/d3-drag/index.d.ts +395 -0
  675. package/vendor/types/@types/d3-drag/package.json +42 -0
  676. package/vendor/types/@types/d3-dsv/LICENSE +21 -0
  677. package/vendor/types/@types/d3-dsv/index.d.ts +482 -0
  678. package/vendor/types/@types/d3-dsv/package.json +45 -0
  679. package/vendor/types/@types/d3-ease/LICENSE +21 -0
  680. package/vendor/types/@types/d3-ease/index.d.ts +316 -0
  681. package/vendor/types/@types/d3-ease/package.json +40 -0
  682. package/vendor/types/@types/d3-fetch/LICENSE +21 -0
  683. package/vendor/types/@types/d3-fetch/index.d.ts +282 -0
  684. package/vendor/types/@types/d3-fetch/package.json +37 -0
  685. package/vendor/types/@types/d3-force/LICENSE +21 -0
  686. package/vendor/types/@types/d3-force/index.d.ts +899 -0
  687. package/vendor/types/@types/d3-force/package.json +45 -0
  688. package/vendor/types/@types/d3-format/LICENSE +21 -0
  689. package/vendor/types/@types/d3-format/index.d.ts +337 -0
  690. package/vendor/types/@types/d3-format/package.json +45 -0
  691. package/vendor/types/@types/d3-geo/LICENSE +21 -0
  692. package/vendor/types/@types/d3-geo/index.d.ts +1371 -0
  693. package/vendor/types/@types/d3-geo/package.json +48 -0
  694. package/vendor/types/@types/d3-hierarchy/LICENSE +21 -0
  695. package/vendor/types/@types/d3-hierarchy/index.d.ts +928 -0
  696. package/vendor/types/@types/d3-hierarchy/package.json +50 -0
  697. package/vendor/types/@types/d3-interpolate/LICENSE +21 -0
  698. package/vendor/types/@types/d3-interpolate/index.d.ts +387 -0
  699. package/vendor/types/@types/d3-interpolate/package.json +47 -0
  700. package/vendor/types/@types/d3-path/LICENSE +21 -0
  701. package/vendor/types/@types/d3-path/index.d.ts +108 -0
  702. package/vendor/types/@types/d3-path/package.json +41 -0
  703. package/vendor/types/@types/d3-polygon/LICENSE +21 -0
  704. package/vendor/types/@types/d3-polygon/index.d.ts +41 -0
  705. package/vendor/types/@types/d3-polygon/package.json +40 -0
  706. package/vendor/types/@types/d3-quadtree/LICENSE +21 -0
  707. package/vendor/types/@types/d3-quadtree/index.d.ts +204 -0
  708. package/vendor/types/@types/d3-quadtree/package.json +45 -0
  709. package/vendor/types/@types/d3-random/LICENSE +21 -0
  710. package/vendor/types/@types/d3-random/index.d.ts +313 -0
  711. package/vendor/types/@types/d3-random/package.json +41 -0
  712. package/vendor/types/@types/d3-scale/LICENSE +21 -0
  713. package/vendor/types/@types/d3-scale/index.d.ts +2669 -0
  714. package/vendor/types/@types/d3-scale/package.json +53 -0
  715. package/vendor/types/@types/d3-scale-chromatic/LICENSE +21 -0
  716. package/vendor/types/@types/d3-scale-chromatic/index.d.ts +520 -0
  717. package/vendor/types/@types/d3-scale-chromatic/package.json +46 -0
  718. package/vendor/types/@types/d3-selection/LICENSE +21 -0
  719. package/vendor/types/@types/d3-selection/index.d.ts +1210 -0
  720. package/vendor/types/@types/d3-selection/package.json +56 -0
  721. package/vendor/types/@types/d3-shape/LICENSE +21 -0
  722. package/vendor/types/@types/d3-shape/index.d.ts +2792 -0
  723. package/vendor/types/@types/d3-shape/package.json +53 -0
  724. package/vendor/types/@types/d3-time/LICENSE +21 -0
  725. package/vendor/types/@types/d3-time/index.d.ts +697 -0
  726. package/vendor/types/@types/d3-time/package.json +46 -0
  727. package/vendor/types/@types/d3-time-format/LICENSE +21 -0
  728. package/vendor/types/@types/d3-time-format/index.d.ts +202 -0
  729. package/vendor/types/@types/d3-time-format/package.json +40 -0
  730. package/vendor/types/@types/d3-timer/LICENSE +21 -0
  731. package/vendor/types/@types/d3-timer/index.d.ts +68 -0
  732. package/vendor/types/@types/d3-timer/package.json +45 -0
  733. package/vendor/types/@types/d3-transition/LICENSE +21 -0
  734. package/vendor/types/@types/d3-transition/index.d.ts +664 -0
  735. package/vendor/types/@types/d3-transition/package.json +47 -0
  736. package/vendor/types/@types/d3-zoom/LICENSE +21 -0
  737. package/vendor/types/@types/d3-zoom/index.d.ts +611 -0
  738. package/vendor/types/@types/d3-zoom/package.json +48 -0
  739. package/vendor/types/@types/geojson/LICENSE +21 -0
  740. package/vendor/types/@types/geojson/index.d.ts +202 -0
  741. package/vendor/types/@types/geojson/package.json +46 -0
  742. package/vendor/typescript/LICENSE.txt +55 -0
  743. package/vendor/typescript/lib.decorators.d.ts +384 -0
  744. package/vendor/typescript/lib.decorators.legacy.d.ts +22 -0
  745. package/vendor/typescript/lib.dom.d.ts +39429 -0
  746. package/vendor/typescript/lib.dom.iterable.d.ts +571 -0
  747. package/vendor/typescript/lib.es2015.collection.d.ts +147 -0
  748. package/vendor/typescript/lib.es2015.core.d.ts +597 -0
  749. package/vendor/typescript/lib.es2015.d.ts +28 -0
  750. package/vendor/typescript/lib.es2015.generator.d.ts +77 -0
  751. package/vendor/typescript/lib.es2015.iterable.d.ts +605 -0
  752. package/vendor/typescript/lib.es2015.promise.d.ts +81 -0
  753. package/vendor/typescript/lib.es2015.proxy.d.ts +128 -0
  754. package/vendor/typescript/lib.es2015.reflect.d.ts +144 -0
  755. package/vendor/typescript/lib.es2015.symbol.d.ts +46 -0
  756. package/vendor/typescript/lib.es2015.symbol.wellknown.d.ts +326 -0
  757. package/vendor/typescript/lib.es2016.array.include.d.ts +116 -0
  758. package/vendor/typescript/lib.es2016.d.ts +21 -0
  759. package/vendor/typescript/lib.es2016.intl.d.ts +31 -0
  760. package/vendor/typescript/lib.es2017.arraybuffer.d.ts +21 -0
  761. package/vendor/typescript/lib.es2017.d.ts +26 -0
  762. package/vendor/typescript/lib.es2017.date.d.ts +31 -0
  763. package/vendor/typescript/lib.es2017.intl.d.ts +44 -0
  764. package/vendor/typescript/lib.es2017.object.d.ts +49 -0
  765. package/vendor/typescript/lib.es2017.sharedmemory.d.ts +135 -0
  766. package/vendor/typescript/lib.es2017.string.d.ts +45 -0
  767. package/vendor/typescript/lib.es2017.typedarrays.d.ts +53 -0
  768. package/vendor/typescript/lib.es2018.asyncgenerator.d.ts +77 -0
  769. package/vendor/typescript/lib.es2018.asynciterable.d.ts +53 -0
  770. package/vendor/typescript/lib.es2018.d.ts +24 -0
  771. package/vendor/typescript/lib.es2018.intl.d.ts +83 -0
  772. package/vendor/typescript/lib.es2018.promise.d.ts +30 -0
  773. package/vendor/typescript/lib.es2018.regexp.d.ts +37 -0
  774. package/vendor/typescript/lib.es2019.array.d.ts +79 -0
  775. package/vendor/typescript/lib.es2019.d.ts +24 -0
  776. package/vendor/typescript/lib.es2019.intl.d.ts +23 -0
  777. package/vendor/typescript/lib.es2019.object.d.ts +33 -0
  778. package/vendor/typescript/lib.es2019.string.d.ts +37 -0
  779. package/vendor/typescript/lib.es2019.symbol.d.ts +24 -0
  780. package/vendor/typescript/lib.es2020.bigint.d.ts +765 -0
  781. package/vendor/typescript/lib.es2020.d.ts +27 -0
  782. package/vendor/typescript/lib.es2020.date.d.ts +42 -0
  783. package/vendor/typescript/lib.es2020.intl.d.ts +474 -0
  784. package/vendor/typescript/lib.es2020.number.d.ts +28 -0
  785. package/vendor/typescript/lib.es2020.promise.d.ts +47 -0
  786. package/vendor/typescript/lib.es2020.sharedmemory.d.ts +99 -0
  787. package/vendor/typescript/lib.es2020.string.d.ts +44 -0
  788. package/vendor/typescript/lib.es2020.symbol.wellknown.d.ts +41 -0
  789. package/vendor/typescript/lib.es2021.d.ts +23 -0
  790. package/vendor/typescript/lib.es2021.intl.d.ts +166 -0
  791. package/vendor/typescript/lib.es2021.promise.d.ts +48 -0
  792. package/vendor/typescript/lib.es2021.string.d.ts +33 -0
  793. package/vendor/typescript/lib.es2021.weakref.d.ts +78 -0
  794. package/vendor/typescript/lib.es2022.array.d.ts +121 -0
  795. package/vendor/typescript/lib.es2022.d.ts +25 -0
  796. package/vendor/typescript/lib.es2022.error.d.ts +75 -0
  797. package/vendor/typescript/lib.es2022.intl.d.ts +145 -0
  798. package/vendor/typescript/lib.es2022.object.d.ts +26 -0
  799. package/vendor/typescript/lib.es2022.regexp.d.ts +39 -0
  800. package/vendor/typescript/lib.es2022.string.d.ts +25 -0
  801. package/vendor/typescript/lib.es5.d.ts +4601 -0
  802. package/vendor/typescript/package.json +4 -0
  803. package/vendor/typescript/typescript.js +446 -0
  804. package/web/assets/index-Bh74DfsV.css +1 -0
  805. package/web/assets/index-UW0RyFFt.js +13 -0
  806. package/web/index.html +14 -0
package/kit/runtime.js ADDED
@@ -0,0 +1,1782 @@
1
+ "use strict";
2
+ (() => {
3
+ // <define:__COMPONENT_FLOWS__>
4
+ var define_COMPONENT_FLOWS_default = [".doc-page", ".doc-section", ".doc-summary", ".doc-panel", ".doc-callout", ".doc-details-content", ".doc-dialog-content", "[data-doc-sheet]", ".doc-column", "[data-doc-slot]"];
5
+
6
+ // <define:__COMPONENT_RUNTIME__>
7
+ var define_COMPONENT_RUNTIME_default = [{ id: "page", match: "main.doc-page", runtime: { generated: [".doc-display", "script[data-doc-state]"], root: { attrs: ["data-doc-ready", "data-doc-drawn", "data-doc-controls"] }, state: { html: ["data-doc-theme", "data-doc-width", "data-doc-font", "data-doc-size", "data-doc-spacing", "data-doc-measure"] }, internal: ["doc-display*", "data-doc-export-copy", "data-theme", "doc-export-id", "doc-reveal", "doc-kit-error"] } }, { id: "text", runtime: { classes: { ".doc-range": ["doc-range"], ".doc-long-run": ["doc-long-run"] } } }, { id: "mention", runtime: { attrs: { "a.doc-link-mention": ["data-doc-gone"] } } }, { id: "paragraph", match: "p" }, { id: "heading", match: "h1, h2, h3, h4" }, { id: "list", match: "ul, ol", runtime: { attrs: { "ol.doc-flow": ["data-doc-flow-key", "data-doc-flow-recount"] }, generated: ["br.doc-item-line"] } }, { id: "quote", match: "blockquote" }, { id: "code", match: ".doc-code", runtime: { generated: [".doc-code-fold", ".doc-code-range", ".doc-code-tools"], internal: ["doc-code-lines", "doc-code-line*", "doc-code-content", "doc-code-toolbar", "doc-code-language", "doc-code-separator", "doc-code-copy*", "doc-code-wrap*", "data-line-number"] } }, { id: "divider", match: "hr" }, { id: "math", match: ".doc-math-inline, .doc-math-block", runtime: { generated: [".doc-math-break", ".doc-math-joiner"], classes: { ".doc-math-tie": ["doc-math-tie"], ".doc-math-skip": ["doc-math-skip"] } } }, { id: "section", match: "section.doc-section" }, { id: "highlight", match: ".doc-panel, .doc-summary" }, { id: "callout", match: ".doc-callout" }, { id: "details", match: "details.doc-details" }, { id: "dialog", match: "dialog.doc-dialog", runtime: { attrs: { "dialog.doc-dialog": ["data-doc-dialog-ready", "open", "aria-label"], ".doc-dialog-content": ["tabindex"] }, root: { classes: ["doc-dialog-open", "doc-dialog-gutter"] }, internal: ["doc-dialog-in", "doc-dialog-fade"] } }, { id: "sheets", match: "[data-doc-sheets]", runtime: { state: { "[data-doc-sheets]": ["data-active-sheet"], "[data-sheet-tab]": ["aria-selected", "tabindex", "is-active"], "[data-doc-sheet]": ["hidden", "aria-hidden"] }, internal: ["doc-sheets"] } }, { id: "table", match: "table.doc-table", runtime: { generated: ["colgroup[data-doc-columns]", ".doc-scrollbars"], attrs: { "table.doc-table": ["data-doc-sortable-ready", "data-doc-filled"], ".doc-table-wrap": ["data-doc-min-width", "data-doc-layout", "data-doc-whole"], "th, td": ["data-column-kind", "data-column-wrap", "data-run-wrap", "data-doc-edge"] }, classes: { "table.doc-table": ["doc-table--auto"] }, internal: ["doc-code-run", "doc-table-sort-button", "doc-scrollbar*", "data-doc-sort-arrow", "data-active", "data-drag", "data-x", "data-y", "data-more"] } }, { id: "columns", match: ".doc-columns" }, { id: "figure", match: "figure" }, { id: "chart", match: "[data-doc-chart]", runtime: { attrs: { "[data-doc-chart]": ["data-doc-layout"] }, classes: { "[data-doc-chart]": ["doc-chart"] }, internal: ["doc-chart-message", "data-missing"] } }, { id: "image", match: "figure.doc-image", runtime: { generated: ["dialog.doc-zoom"], attrs: { "img[data-doc-zoom]": ["data-doc-zoom", "tabindex", "role", "aria-haspopup", "aria-label"] }, root: { classes: ["doc-zoom-open", "doc-zoom-gutter", "doc-zoom-hover"] }, internal: ["doc-zoom-*"] } }, { id: "file", match: "figure.doc-file" }, { id: "bookmark", match: "figure.doc-bookmark" }, { id: "embed", match: "figure.doc-embed", runtime: { attrs: { "iframe.doc-embed-frame": ["data-doc-blob"] } } }, { id: "diff", match: ".doc-diff", runtime: { generated: [".doc-diff-body", ".doc-diff-stats"], internal: ["doc-diff-added", "doc-diff-removed"] } }, { id: "icon", match: ".doc-icon", runtime: { internal: ["data-doc-tab-icon"] } }, { id: "installed", match: "div[data-doc-component], section[data-doc-component]", runtime: { generated: [".doc-component-note", ".doc-component-data"], attrs: { "[data-doc-fallback]": ["data-doc-fallback"], "[data-doc-fallback-control]": ["data-doc-fallback-control", "inert"] }, internal: ["data-doc-package", "doc-component-more", "doc-component-one", "doc-component-line", "doc-component-short"] } }, { id: "state", match: "[data-doc-bind], [data-doc-show]", runtime: { attrs: { "[data-doc-show]": ["hidden"] }, state: { "button[data-doc-bind]": ["aria-pressed"] } } }];
8
+
9
+ // src/render/kit/runtime/bindings.js
10
+ var global = globalThis;
11
+ var CONTROLS = "input[data-doc-bind], select[data-doc-bind], textarea[data-doc-bind], button[data-doc-bind][value], details[data-doc-bind]";
12
+ function initial(element) {
13
+ if (element.localName === "details") return element.hasAttribute("open");
14
+ if (element.localName === "button") return element.getAttribute("aria-pressed") === "true" ? element.value : void 0;
15
+ if (element.localName === "input" && (element.type === "checkbox" || element.type === "radio")) return element.type === "checkbox" ? element.checked : element.checked ? element.value : void 0;
16
+ if (element.localName === "table") return { sort: null };
17
+ if (element.matches("input, select, textarea")) return element.value;
18
+ return "";
19
+ }
20
+ function showOf(element) {
21
+ const text = element.getAttribute("data-doc-show") ?? "";
22
+ const at = text.indexOf(":");
23
+ return at < 0 ? { key: text.trim(), value: "" } : { key: text.slice(0, at).trim(), value: text.slice(at + 1).trim() };
24
+ }
25
+ function createBindings() {
26
+ let state = null;
27
+ const later = /* @__PURE__ */ new Map();
28
+ const listeners = /* @__PURE__ */ new Set();
29
+ function open() {
30
+ if (state) return state;
31
+ if (!global.DocState) throw new Error("State bindings require /kit/state.js to be loaded.");
32
+ const defaults = {};
33
+ const transient = /* @__PURE__ */ new Set();
34
+ for (const element of document.querySelectorAll("[data-doc-bind]")) {
35
+ const key = element.getAttribute("data-doc-bind").trim();
36
+ if (!key) continue;
37
+ const value = initial(element);
38
+ if (!(key in defaults) || defaults[key] === "" && value !== void 0 && value !== "") defaults[key] = value ?? "";
39
+ if (element.hasAttribute("data-doc-transient")) transient.add(key);
40
+ }
41
+ for (const element of document.querySelectorAll("[data-doc-show]")) {
42
+ const { key } = showOf(element);
43
+ if (key && !(key in defaults)) defaults[key] = "";
44
+ }
45
+ state = global.DocState.create({ id: "bound", version: 1, defaults, transientKeys: [...transient] });
46
+ state.subscribe((snapshot, change) => {
47
+ const keys = change.type === "set" ? [change.key] : Object.keys(snapshot);
48
+ for (const listener of listeners) for (const key of keys) listener(key);
49
+ });
50
+ return state;
51
+ }
52
+ const known = (key) => later.has(key) || Object.prototype.hasOwnProperty.call(open().snapshot(), key);
53
+ const store = {
54
+ get(key) {
55
+ if (later.has(key)) return later.get(key);
56
+ return open().get(key, "");
57
+ },
58
+ set(key, value) {
59
+ if (!known(key)) later.set(key, value);
60
+ if (later.has(key)) {
61
+ later.set(key, value);
62
+ for (const listener of listeners) listener(key);
63
+ return;
64
+ }
65
+ if (JSON.stringify(open().get(key)) !== JSON.stringify(value)) open().set(key, value);
66
+ },
67
+ /** Calls listener(key) when a key changes; returns what stops it. */
68
+ subscribe(listener) {
69
+ listeners.add(listener);
70
+ return () => listeners.delete(listener);
71
+ },
72
+ listeners: () => listeners.size
73
+ };
74
+ function bindControl(element, { signal }) {
75
+ const key = element.getAttribute("data-doc-bind").trim();
76
+ if (!key) return null;
77
+ if (!known(key)) later.set(key, initial(element) ?? "");
78
+ const show = () => {
79
+ const value = store.get(key);
80
+ if (element.localName === "details") {
81
+ if (element.open !== Boolean(value)) element.open = Boolean(value);
82
+ } else if (element.localName === "button") {
83
+ element.setAttribute("aria-pressed", String(value === element.value));
84
+ } else if (element.type === "checkbox") {
85
+ element.checked = Boolean(value);
86
+ } else if (element.type === "radio") {
87
+ element.checked = value === element.value;
88
+ } else if (element.value !== String(value ?? "")) {
89
+ element.value = String(value ?? "");
90
+ }
91
+ };
92
+ const write = () => {
93
+ if (element.localName === "details") store.set(key, element.open);
94
+ else if (element.localName === "button") store.set(key, element.value);
95
+ else if (element.type === "checkbox") store.set(key, element.checked);
96
+ else if (element.type === "radio") {
97
+ if (element.checked) store.set(key, element.value);
98
+ } else store.set(key, element.value);
99
+ };
100
+ const event = element.localName === "details" ? "toggle" : element.localName === "button" ? "click" : element.localName === "select" || element.type === "checkbox" || element.type === "radio" ? "change" : "input";
101
+ element.addEventListener(event, write, { signal });
102
+ const stop = store.subscribe((changed) => changed === key && show());
103
+ show();
104
+ return { destroy: stop };
105
+ }
106
+ function bindShow(element) {
107
+ const { key, value } = showOf(element);
108
+ if (!key) return null;
109
+ const show = () => {
110
+ const chosen = store.get(key);
111
+ const hidden = chosen !== "" && chosen !== null && chosen !== void 0 && String(chosen) !== value;
112
+ if (element.hidden !== hidden) element.hidden = hidden;
113
+ };
114
+ const stop = store.subscribe((changed) => changed === key && show());
115
+ show();
116
+ return { destroy: stop };
117
+ }
118
+ return { store, bindControl, bindShow, CONTROLS };
119
+ }
120
+
121
+ // src/render/kit/runtime/embeds.js
122
+ var sources = /* @__PURE__ */ new Map();
123
+ function showEmbed(figure) {
124
+ const frame = figure.querySelector(":scope > iframe.doc-embed-frame");
125
+ const source = frame?.getAttribute("src") ?? "";
126
+ const match = /^data:application\/pdf;base64,([\s\S]*)$/.exec(source);
127
+ if (!match) return null;
128
+ const text = atob(match[1]);
129
+ const bytes = new Uint8Array(text.length);
130
+ for (let index = 0; index < text.length; index++) bytes[index] = text.charCodeAt(index);
131
+ const url = URL.createObjectURL(new Blob([bytes], { type: "application/pdf" }));
132
+ sources.set(url, source);
133
+ frame.setAttribute("data-doc-blob", "");
134
+ frame.src = url;
135
+ return {
136
+ destroy() {
137
+ sources.delete(url);
138
+ URL.revokeObjectURL(url);
139
+ frame.removeAttribute("data-doc-blob");
140
+ frame.setAttribute("src", source);
141
+ }
142
+ };
143
+ }
144
+ function dehydrateEmbed(figure) {
145
+ const frame = figure.querySelector(":scope > iframe.doc-embed-frame[data-doc-blob]");
146
+ const source = frame && sources.get(frame.getAttribute("src"));
147
+ if (!source) return;
148
+ frame.setAttribute("src", source);
149
+ frame.removeAttribute("data-doc-blob");
150
+ }
151
+
152
+ // src/shared/components/list.mjs
153
+ var FLOW = "doc-flow";
154
+ var TODO = "doc-todo";
155
+ var HELD_TAGS = /* @__PURE__ */ new Set(["p", "h1", "h2", "h3", "h4", "h5", "h6", "ul", "ol", "div", "figure", "blockquote", "details", "hr", "table", "pre"]);
156
+ var ITEM_LINE = "doc-item-line";
157
+ var kitList = (node) => Boolean(node?.matches(`ul:not([class]), ol:not([class]), ul.${TODO}`));
158
+ var BLANK = /^[\s\p{Cf}]*$/u;
159
+ var SHOWS = "img, picture, svg, video, audio, canvas, iframe, object, input, br";
160
+ var isHeld = (node) => node.nodeType === 1 && HELD_TAGS.has(node.localName);
161
+ var blank = (node) => node.nodeType === 3 ? BLANK.test(node.data) : node.nodeType !== 1;
162
+ var textless = (node) => blank(node) || node.nodeType === 1 && BLANK.test(node.textContent) && !node.matches(SHOWS) && !node.querySelector(SHOWS);
163
+ function drawnList(list2, flows) {
164
+ for (let at = list2; kitList(at) || at !== list2 && at?.matches(`ol.${FLOW}`); ) {
165
+ const holder = at.parentElement;
166
+ if (holder?.localName !== "li") return Boolean(holder?.matches(flows));
167
+ at = holder.parentElement;
168
+ }
169
+ return false;
170
+ }
171
+ function keepsLine(item2, flows) {
172
+ const nodes = [...item2.childNodes];
173
+ const first = nodes.findIndex(isHeld);
174
+ return first >= 0 && nodes.slice(0, first).every(textless) && nodes.slice(first).every((node) => isHeld(node) || blank(node)) && drawnList(item2.parentElement, flows);
175
+ }
176
+ function giveLine(item2, flows) {
177
+ if (!keepsLine(item2, flows)) return false;
178
+ const line = item2.ownerDocument.createElement("br");
179
+ line.className = ITEM_LINE;
180
+ [...item2.childNodes].find(isHeld).before(line);
181
+ return true;
182
+ }
183
+ var FLOW_DIRECTION = "data-direction";
184
+ var FLOW_RATIO = "--doc-flow-ratio";
185
+ var FLOW_KEY = "data-doc-flow-key";
186
+ var FLOW_RECOUNT = "data-doc-flow-recount";
187
+ var FLOW_LABEL = { zh: "\u6D41\u7A0B\u56FE", en: "Flowchart" };
188
+ var isFlowLabel = (value) => Object.values(FLOW_LABEL).includes(value);
189
+ var FLOW_ROW = /* @__PURE__ */ Object.freeze({ most: 5, least: 116, narrow: 520, gap: 28, title: 2 });
190
+ function flowShares(weights) {
191
+ if (weights.length === 1) return [1];
192
+ const given = weights.filter((weight) => weight > 0);
193
+ const fill = given.length ? given.reduce((sum, weight) => sum + weight, 0) / given.length : 1;
194
+ const each = weights.map((weight) => weight > 0 ? weight : fill);
195
+ const all = each.reduce((sum, weight) => sum + weight, 0);
196
+ return each.map((weight) => weight / all);
197
+ }
198
+
199
+ // src/shared/long-runs.mjs
200
+ var LONG_RUN = 20;
201
+ var RUNS = /[^\s\u2000-\u206f\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\ufe30-\ufe4f\uff00-\uffef]+/gu;
202
+ var PIECES = /(?<=[-?])/u;
203
+ var long = (run) => run.length > LONG_RUN && run.split(PIECES).some((piece) => [...piece].length > LONG_RUN);
204
+ function longRuns(text) {
205
+ const found = [];
206
+ if (text.length <= LONG_RUN) return found;
207
+ for (const match of text.matchAll(RUNS)) if (long(match[0])) found.push({ index: match.index, length: match[0].length });
208
+ return found;
209
+ }
210
+ function holdsLongRun(text) {
211
+ if (text.length <= LONG_RUN) return false;
212
+ for (const match of text.matchAll(RUNS)) if (long(match[0])) return true;
213
+ return false;
214
+ }
215
+
216
+ // src/render/kit/words.js
217
+ var RUNTIME = {
218
+ "component-missing": { zh: "\u7EC4\u4EF6 {0} \u7684\u7EC4\u4EF6\u5305\u4E0D\u5728\u8FD9\u4E2A\u5DE5\u4F5C\u533A\u91CC\uFF0C\u8FD9\u91CC\u53EA\u663E\u793A\u5B83\u7684\u5185\u5BB9\u3002", en: "The package of component {0} is not in this workspace: only what it holds is shown." },
219
+ "component-broken": { zh: "\u7EC4\u4EF6 {0} \u7684\u7EC4\u4EF6\u5305\u6CA1\u6709\u52A0\u8F7D\uFF0C\u8FD9\u91CC\u53EA\u663E\u793A\u5B83\u7684\u5185\u5BB9\u3002\u539F\u56E0\uFF1A{1}", en: "The package of component {0} did not load: only what it holds is shown. Why: {1}" },
220
+ "component-silent": { zh: "\u7EC4\u4EF6 {0} \u7684\u811A\u672C\u6CA1\u6709\u542F\u52A8\u5B83\uFF0C\u8FD9\u91CC\u53EA\u663E\u793A\u5B83\u7684\u5185\u5BB9\uFF1A\u770B\u63A7\u5236\u53F0\u91CC\u7684\u9519\u8BEF\u3002", en: "The script of component {0} did not start it: only what it holds is shown. See the console for the error." },
221
+ "value-true": { zh: "\u662F", en: "Yes" },
222
+ "value-false": { zh: "\u5426", en: "No" },
223
+ "value-empty": { zh: "\uFF08\u7A7A\uFF09", en: "(empty)" },
224
+ "value-deeper": { zh: "\uFF08{0} \u9879\uFF0C\u6CA1\u6709\u5C55\u5F00\uFF09", en: "(not shown: {0} in it)" },
225
+ "value-more": { zh: "\u8FD8\u6709 {0} \u9879\u6CA1\u6709\u663E\u793A", en: "{0} more not shown" },
226
+ "rows-more": { zh: "\u8FD8\u6709 {0} \u884C\u6CA1\u6709\u663E\u793A", en: "{0} more rows not shown" },
227
+ "columns-more": { zh: "\u8FD8\u6709 {0} \u5217\u6CA1\u6709\u663E\u793A", en: "{0} more columns not shown" },
228
+ "not-json": { zh: "\u8FD9\u6BB5\u6570\u636E\u4E0D\u662F JSON\uFF1A{0}", en: "This data is not JSON: {0}" },
229
+ "view-image": { zh: "\u67E5\u770B\u56FE\u7247", en: "Image viewer" },
230
+ "open-image": { zh: "\u653E\u5927\u67E5\u770B\u56FE\u7247", en: "View the image larger" },
231
+ "open-image-named": { zh: "\u653E\u5927\u67E5\u770B\uFF1A{0}", en: "View larger: {0}" },
232
+ "close": { zh: "\u5173\u95ED", en: "Close" },
233
+ "flowchart": FLOW_LABEL
234
+ };
235
+ var UI_LANGUAGE = "data-ge-language";
236
+ function kitLanguage(root = globalThis.document?.documentElement) {
237
+ const ui = root?.getAttribute(UI_LANGUAGE) ?? null;
238
+ const english = ui !== null ? ui === "en" : /^en(?:-|$)/i.test(root?.getAttribute("lang") ?? "");
239
+ return english ? "en" : "zh";
240
+ }
241
+ function wordIn(table2, language, key, ...values) {
242
+ const entry = table2[key];
243
+ if (!entry) throw new Error(`The kit has no word "${key}" here (src/render/kit/words.js).`);
244
+ const text = entry[language] ?? entry.zh;
245
+ return values.length === 0 ? text : text.replace(/\{(\d+)\}/g, (whole, index) => index < values.length ? String(values[index]) : whole);
246
+ }
247
+ var sayer = (table2) => (key, ...values) => wordIn(table2, kitLanguage(), key, ...values);
248
+ var sayRuntime = /* @__PURE__ */ sayer(RUNTIME);
249
+ var ENGLISH_ROOT = `:root[${UI_LANGUAGE}="en"], :root:not([${UI_LANGUAGE}])[lang|="en" i]`;
250
+
251
+ // src/render/kit/runtime/flowchart.js
252
+ var CJK = "\\u2e80-\\u9fff\\uac00-\\ud7af\\uf900-\\ufaff\\uff00-\\uffef";
253
+ var WORDS = new RegExp(`[${CJK}]|[^\\s${CJK}]+`, "g");
254
+ var PIECES2 = new RegExp(`[${CJK}]|[^\\s${CJK}]+|\\s+`, "g");
255
+ var WIDE = new RegExp(`[${CJK}]`);
256
+ function linesOf(pieces, width) {
257
+ let lines = 0;
258
+ let used = 0;
259
+ let pending = 0;
260
+ for (const piece of pieces) {
261
+ if (piece.space) {
262
+ if (used > 0) pending += piece.width;
263
+ continue;
264
+ }
265
+ if (lines === 0) lines = 1;
266
+ if (used > 0 && used + pending + piece.width > width + 0.5) {
267
+ lines++;
268
+ used = 0;
269
+ } else used += pending;
270
+ pending = 0;
271
+ if (used === 0 && piece.width > width) {
272
+ lines += Math.ceil(piece.width / width) - 1;
273
+ used = piece.width - (Math.ceil(piece.width / width) - 1) * width;
274
+ } else used += piece.width;
275
+ }
276
+ return lines;
277
+ }
278
+ function blockHeight(block, width) {
279
+ const inner = width - (block.indent ?? 0);
280
+ if (block.pieces) return Math.max(1, linesOf(block.pieces, inner)) * block.line;
281
+ if (block.items) return block.items.reduce((sum, item2, index) => sum + (index > 0 ? item2.gap : 0) + Math.max(1, linesOf(item2.pieces, inner)) * item2.line + stackHeight(item2.blocks, inner), 0);
282
+ if (block.blocks) return block.down + stackHeight(block.blocks, inner);
283
+ return block.height ?? Infinity;
284
+ }
285
+ function stackHeight(blocks, width) {
286
+ let height = 0;
287
+ let below = 0;
288
+ blocks.forEach((block, index) => {
289
+ height += (index === 0 ? block.gap : Math.max(below, block.gap)) + blockHeight(block, width);
290
+ below = block.after ?? 0;
291
+ });
292
+ return height + below;
293
+ }
294
+ function cardHeight(step, content) {
295
+ return step.down + Math.max(1, linesOf(step.title.pieces, content)) * step.title.line + stackHeight(step.blocks, content);
296
+ }
297
+ var fits = (step, width) => width >= Math.max(FLOW_ROW.least, step.word);
298
+ var reads = (step, width) => linesOf(step.title.pieces, width - step.across) <= FLOW_ROW.title && cardHeight(step, width - step.across) <= width;
299
+ var sharesOf = (row, ratios = []) => flowShares(row.map((index) => ratios[index] ?? null));
300
+ function flowLayout({ width, steps, direction = null, directions = [], ratios = [] }) {
301
+ const rows = [];
302
+ if (steps.length > 0) {
303
+ let row = [0];
304
+ for (let next = 1; next < steps.length; next++) {
305
+ const way = directions[next - 1] ?? direction;
306
+ const candidate = [...row, next];
307
+ const each = (test, weighed) => {
308
+ const shares = weighed ? sharesOf(candidate, ratios) : candidate.map(() => 1 / candidate.length);
309
+ return candidate.every((index, place) => test(steps[index], (width - FLOW_ROW.gap * (candidate.length - 1)) * shares[place]));
310
+ };
311
+ const join = width > 0 && way !== "column" && each(fits, true) && (way === "row" || width >= FLOW_ROW.narrow && candidate.length <= FLOW_ROW.most && each(reads, false));
312
+ if (join) row = candidate;
313
+ else {
314
+ rows.push(row);
315
+ row = [next];
316
+ }
317
+ }
318
+ rows.push(row);
319
+ }
320
+ const nodes = [];
321
+ rows.forEach((row, at) => {
322
+ const shares = sharesOf(row, ratios);
323
+ let before = 0;
324
+ row.forEach((step, index) => {
325
+ const last = step === steps.length - 1;
326
+ const out = last ? null : index < row.length - 1 ? "right" : index === 0 ? "down" : "turn";
327
+ nodes[step] = { row: at, index, count: row.length, share: shares[index], before, out, short: Boolean(steps[step].short) };
328
+ before += shares[index];
329
+ });
330
+ });
331
+ return { rows, nodes };
332
+ }
333
+ function reachOf(node, px = null) {
334
+ const gaps = node.index * FLOW_ROW.gap;
335
+ if (px !== null) return (px - FLOW_ROW.gap * (node.count - 1)) * node.before + gaps;
336
+ return `calc((100% + 2px) * ${number(node.before / node.share)} + ${gaps}px)`;
337
+ }
338
+ var number = (value) => String(Math.round(value * 1e5) / 1e5);
339
+ function flowRules(key, { rows, nodes }, { cut: cut2 = [], keep = false } = {}) {
340
+ const list2 = `ol.${FLOW}[${FLOW_KEY}="${key}"]`;
341
+ const at = (step) => `${list2} > li:nth-of-type(${step + 1})`;
342
+ const rules2 = [];
343
+ if (rows.some((row) => row.length > 1)) {
344
+ rules2.push(`${list2} { flex-flow: row wrap; column-gap: ${FLOW_ROW.gap}px; }`);
345
+ nodes.forEach((node, step) => {
346
+ const basis = node.count === 1 ? "100%" : `calc((100% - ${(node.count - 1) * FLOW_ROW.gap}px) * ${number(node.share)} - 1px)`;
347
+ rules2.push(`${at(step)} { flex: 1 1 ${basis}; }`);
348
+ if (node.out === "right") rules2.push(`${at(step)}::after { top: calc(9px + var(--doc-flow-mid) - 5px); left: calc(100% + 5px); width: 20px; height: 10px; clip-path: var(--doc-flow-right); }`);
349
+ if (node.out === "turn") rules2.push(`${at(step)}::after { --doc-flow-reach: ${reachOf(node)}; left: calc(18px - var(--doc-flow-reach)); width: calc(var(--doc-flow-reach) + 10px); clip-path: var(--doc-flow-turn-shape, none); -webkit-mask: var(--doc-flow-turn-mask, var(--doc-flow-turn)); mask: var(--doc-flow-turn-mask, var(--doc-flow-turn)); }`);
350
+ });
351
+ }
352
+ nodes.forEach((node, step) => {
353
+ if (node.short) rules2.push(`${at(step)} > :is(:first-child, .doc-icon + *):not(.doc-icon, div, figure, details, table, pre) { margin-top: var(--doc-list-gap); }`);
354
+ });
355
+ if (keep) rules2.push(`@media print { ${list2} { break-inside: avoid; } }`);
356
+ for (const step of cut2) rules2.push(`${at(step)}::after { content: none; }`);
357
+ return rules2.join("\n");
358
+ }
359
+ function pagedApart(rows, rects, gap) {
360
+ const shown2 = (row) => row.filter((step) => rects[step]?.width > 0);
361
+ const cut2 = [];
362
+ for (let at = 0; at + 1 < rows.length; at++) {
363
+ const here = shown2(rows[at]);
364
+ const next = shown2(rows[at + 1]);
365
+ if (here.length === 0 || next.length === 0) continue;
366
+ const bottom = Math.max(...here.map((step) => rects[step].bottom));
367
+ const top = Math.min(...next.map((step) => rects[step].top));
368
+ if (Math.abs(top - bottom - gap) > 1) cut2.push(rows[at].at(-1));
369
+ }
370
+ return cut2;
371
+ }
372
+ var BLOCKS = /* @__PURE__ */ new Set(["P", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "DIV", "FIGURE", "BLOCKQUOTE", "DETAILS", "HR", "TABLE", "PRE"]);
373
+ var TEXTS = /* @__PURE__ */ new Set(["P", "H1", "H2", "H3", "H4", "H5", "H6"]);
374
+ var ICON = "doc-icon";
375
+ var ownNodes = (item2) => [...item2.childNodes].filter((node) => node.nodeType === 3 || node.nodeType === 1 && !BLOCKS.has(node.tagName));
376
+ var ownText = (item2) => ownNodes(item2).map((node) => node.textContent).join("");
377
+ var pixels = (value) => parseFloat(value) || 0;
378
+ var across = (style) => pixels(style.paddingLeft) + pixels(style.paddingRight) + pixels(style.borderLeftWidth) + pixels(style.borderRightWidth);
379
+ var down = (style) => pixels(style.paddingTop) + pixels(style.paddingBottom) + pixels(style.borderTopWidth) + pixels(style.borderBottomWidth);
380
+ var lineOf = (style) => pixels(style.lineHeight) || (pixels(style.fontSize) || 16) * 1.2;
381
+ var context;
382
+ function measurer(style) {
383
+ context ??= document.createElement("canvas").getContext?.("2d") ?? null;
384
+ const size = pixels(style.fontSize) || 16;
385
+ if (!context) return (text) => [...text].reduce((sum, character) => sum + size * (WIDE.test(character) ? 1 : 0.6), 0);
386
+ const font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;
387
+ return (text) => {
388
+ context.font = font;
389
+ return context.measureText(text).width;
390
+ };
391
+ }
392
+ function piecesOf(text, style, split = true) {
393
+ const measure = measurer(style);
394
+ const space = measure(" ");
395
+ const anywhere = split && style.wordBreak === "break-all";
396
+ const pieces = [];
397
+ let widest = 0;
398
+ for (const piece of String(text).match(PIECES2) ?? []) {
399
+ if (/^\s/.test(piece)) {
400
+ pieces.push({ width: space, space: true });
401
+ continue;
402
+ }
403
+ const width = measure(piece);
404
+ widest = Math.max(widest, width);
405
+ if (split && !WIDE.test(piece) && (anywhere || holdsLongRun(piece))) for (const character of piece) pieces.push({ width: measure(character) });
406
+ else pieces.push({ width });
407
+ }
408
+ return { pieces, widest };
409
+ }
410
+ function inlinePieces(nodes, style) {
411
+ const holds = (node) => node.nodeType === 1 && (node.tagName === "CODE" || node.querySelector("code"));
412
+ if (!nodes.some(holds)) return piecesOf(nodes.map((node) => node.textContent).join(""), style);
413
+ const segments = [];
414
+ const walk = (node, code) => {
415
+ if (node.nodeType === 3) {
416
+ const last = segments.at(-1);
417
+ if (last && last.code === code) last.text += node.textContent;
418
+ else segments.push({ text: node.textContent, code });
419
+ } else if (node.nodeType === 1) node.childNodes.forEach((child) => walk(child, code ?? (node.tagName === "CODE" ? node : null)));
420
+ };
421
+ nodes.forEach((node) => walk(node, null));
422
+ const collect = (split) => {
423
+ const pieces = [];
424
+ let joins = false;
425
+ for (const { text, code } of segments) {
426
+ if (!text) continue;
427
+ const look = code ? getComputedStyle(code) : style;
428
+ const own = piecesOf(text, look, split).pieces;
429
+ if (code && own.length) {
430
+ own[0].width += pixels(look.paddingLeft) + pixels(look.borderLeftWidth);
431
+ own.at(-1).width += pixels(look.paddingRight) + pixels(look.borderRightWidth);
432
+ }
433
+ own.forEach((piece, at) => {
434
+ if (at === 0 && joins && !piece.space && !WIDE.test(text[0])) pieces.at(-1).width += piece.width;
435
+ else pieces.push(piece);
436
+ });
437
+ joins = !/\s$/.test(text) && !WIDE.test(text.at(-1));
438
+ }
439
+ return { pieces, widest: Math.max(0, ...pieces.filter((piece) => !piece.space).map((piece) => piece.width)) };
440
+ };
441
+ const whole = collect(false);
442
+ return { pieces: collect(true).pieces, widest: whole.widest };
443
+ }
444
+ function contentOf(elements) {
445
+ const blocks = [];
446
+ let word = 0;
447
+ for (const block of elements) {
448
+ if (!BLOCKS.has(block.tagName)) continue;
449
+ const look = getComputedStyle(block);
450
+ if (look.display === "none") continue;
451
+ const measured = blockShape(block, look);
452
+ blocks.push(measured.block);
453
+ word = Math.max(word, measured.word);
454
+ }
455
+ return { blocks, word };
456
+ }
457
+ function blockShape(block, look) {
458
+ const margins = { gap: pixels(look.marginTop), after: pixels(look.marginBottom) };
459
+ if (TEXTS.has(block.tagName)) {
460
+ const words = inlinePieces([...block.childNodes], look);
461
+ return { block: { ...margins, pieces: words.pieces, line: lineOf(look) }, word: words.widest };
462
+ }
463
+ if ((block.tagName === "UL" || block.tagName === "OL") && !block.classList.contains(FLOW)) {
464
+ const indent = pixels(look.paddingLeft) + pixels(look.borderLeftWidth);
465
+ const items = [];
466
+ let word = 0;
467
+ for (const item2 of block.children) {
468
+ if (item2.tagName !== "LI") continue;
469
+ const style = getComputedStyle(item2);
470
+ const words = inlinePieces(ownNodes(item2), style);
471
+ const held = contentOf(item2.children);
472
+ items.push({ gap: pixels(style.marginTop), pieces: words.pieces, line: lineOf(style), blocks: held.blocks });
473
+ word = Math.max(word, words.widest, held.word);
474
+ }
475
+ return { block: { ...margins, indent, items }, word: word + indent };
476
+ }
477
+ if (block.tagName === "BLOCKQUOTE") {
478
+ const indent = pixels(look.paddingLeft) + pixels(look.borderLeftWidth);
479
+ const held = contentOf(block.children);
480
+ return { block: { ...margins, indent, down: down(look), blocks: held.blocks }, word: held.word + indent };
481
+ }
482
+ if (block.tagName === "HR") return { block: { ...margins, height: pixels(look.height) + down(look) }, word: 0 };
483
+ return { block: margins, word: 0 };
484
+ }
485
+ function titleOf(item2, style) {
486
+ const blocks = [...item2.children].filter((child) => BLOCKS.has(child.tagName) && !child.classList.contains(ICON));
487
+ const own = ownText(item2);
488
+ const short = /\S/.test(own);
489
+ const [first] = blocks;
490
+ if (short || first?.tagName !== "P") return { nodes: ownNodes(item2), style, line: lineOf(style), content: blocks, short };
491
+ const look = getComputedStyle(first);
492
+ const whole = first.children.length === 1 && first.textContent === first.firstElementChild.textContent ? getComputedStyle(first.firstElementChild) : look;
493
+ return { nodes: [...first.childNodes], style: whole, line: lineOf(look), content: blocks.slice(1), short };
494
+ }
495
+ function stepShape(item2) {
496
+ const style = getComputedStyle(item2);
497
+ const title = titleOf(item2, style);
498
+ const words = inlinePieces(title.nodes, title.style);
499
+ const content = contentOf(title.content);
500
+ return { word: Math.ceil(Math.max(words.widest, content.word) + across(style)), across: across(style), down: down(style), title: { pieces: words.pieces, line: title.line }, blocks: content.blocks, short: title.short };
501
+ }
502
+ var DIRECTIONS = ["row", "column"];
503
+ var directionOf = (element) => DIRECTIONS.includes(element.getAttribute(FLOW_DIRECTION)) ? element.getAttribute(FLOW_DIRECTION) : null;
504
+ var RATIO = new RegExp(`(?:^|;)\\s*${FLOW_RATIO}\\s*:\\s*([^;]*)`);
505
+ var ratioOf = (step) => {
506
+ const value = Number(RATIO.exec(step.getAttribute("style") ?? "")?.[1].trim());
507
+ return value > 0 && Number.isFinite(value) ? value : null;
508
+ };
509
+ var stepsOf = (list2) => [...list2.children].filter((child) => child.tagName === "LI");
510
+ function layoutOf(list2) {
511
+ const steps = stepsOf(list2);
512
+ return flowLayout({ width: list2.clientWidth, steps: steps.map(stepShape), direction: directionOf(list2), directions: steps.map(directionOf), ratios: steps.map(ratioOf) });
513
+ }
514
+ var PAGE = 840;
515
+ var sheet = null;
516
+ var rules = /* @__PURE__ */ new Map();
517
+ var live = /* @__PURE__ */ new Map();
518
+ function writeRules(document2, key, text) {
519
+ if ((rules.get(key) ?? "") === text) return;
520
+ if (text) rules.set(key, text);
521
+ else rules.delete(key);
522
+ if (!sheet) {
523
+ sheet = new document2.defaultView.CSSStyleSheet();
524
+ document2.adoptedStyleSheets = [...document2.adoptedStyleSheets ?? [], sheet];
525
+ }
526
+ sheet.replaceSync([...rules.values()].join("\n"));
527
+ }
528
+ function keyFor(list2) {
529
+ const own = list2.getAttribute(FLOW_KEY);
530
+ if (own && !live.has(own)) return own;
531
+ let next = live.size + 1;
532
+ while (live.has(String(next))) next++;
533
+ list2.setAttribute(FLOW_KEY, String(next));
534
+ return String(next);
535
+ }
536
+ function recount(list2) {
537
+ const first = list2.querySelector(":scope > li");
538
+ if (!first) return;
539
+ list2.setAttribute(FLOW_RECOUNT, "");
540
+ void getComputedStyle(first, "::before").content;
541
+ list2.removeAttribute(FLOW_RECOUNT);
542
+ }
543
+ function startFlowchart(list2, { signal, frame }) {
544
+ const named = !list2.hasAttribute("aria-label") && !list2.hasAttribute("aria-labelledby");
545
+ if (named) list2.setAttribute("aria-label", sayRuntime("flowchart"));
546
+ const key = keyFor(list2);
547
+ live.set(key, list2);
548
+ let moved = false;
549
+ let keep = true;
550
+ const lay = () => frame(() => {
551
+ if (moved) recount(list2);
552
+ moved = false;
553
+ const layout = layoutOf(list2);
554
+ writeRules(list2.ownerDocument, key, flowRules(key, layout, { keep }));
555
+ const fits2 = list2.getBoundingClientRect().height <= PAGE;
556
+ if (fits2 === keep) return;
557
+ keep = fits2;
558
+ writeRules(list2.ownerDocument, key, flowRules(key, layout, { keep }));
559
+ });
560
+ const forPaper = () => {
561
+ const layout = layoutOf(list2);
562
+ const document2 = list2.ownerDocument;
563
+ const apart = () => pagedApart(layout.rows, stepsOf(list2).map((step) => step.getBoundingClientRect()), pixels(getComputedStyle(list2).rowGap));
564
+ writeRules(document2, key, flowRules(key, layout, { keep: true }));
565
+ if (apart().length === 0) return;
566
+ writeRules(document2, key, flowRules(key, layout));
567
+ const cut2 = apart();
568
+ if (cut2.length > 0) writeRules(document2, key, flowRules(key, layout, { cut: cut2 }));
569
+ };
570
+ const paper = list2.ownerDocument.defaultView?.matchMedia?.("print") ?? null;
571
+ paper?.addEventListener("change", (event) => event.matches ? forPaper() : lay(), { signal });
572
+ const directions = new MutationObserver(lay);
573
+ directions.observe(list2, { attributes: true, attributeFilter: [FLOW_DIRECTION, "style"], subtree: true });
574
+ signal.addEventListener("abort", () => directions.disconnect());
575
+ lay();
576
+ return {
577
+ update(reason, records) {
578
+ if (reason === "content" && records.some((record) => record.type === "childList")) moved = true;
579
+ lay();
580
+ },
581
+ // Gone from the page (turned into another kind of list, deleted): its rules go, and the name it
582
+ // was given with it; its key stays on it, so put back (an undo) it is laid out by the same.
583
+ destroy() {
584
+ if (live.get(key) === list2) live.delete(key);
585
+ writeRules(list2.ownerDocument, key, "");
586
+ if (named && isFlowLabel(list2.getAttribute("aria-label"))) list2.removeAttribute("aria-label");
587
+ }
588
+ };
589
+ }
590
+ function dehydrateFlowchart(list2) {
591
+ if (isFlowLabel(list2.getAttribute("aria-label"))) list2.removeAttribute("aria-label");
592
+ }
593
+ var FLOWCHART = `ol.${FLOW}`;
594
+
595
+ // src/shared/components/installed.mjs
596
+ var ATTRIBUTE = "data-doc-component";
597
+ var PACKAGE_ID = /^[a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*$/;
598
+ var INSTANCE = `div[${ATTRIBUTE}], section[${ATTRIBUTE}]`;
599
+ var SLOT = "data-doc-slot";
600
+ var SLOT_PART = `div[${SLOT}], section[${SLOT}]`;
601
+ var REGION = `${INSTANCE}, ${SLOT_PART}`;
602
+ var edgeAround = (node) => node?.parentElement?.closest(REGION) ?? null;
603
+ function heldBy(node) {
604
+ const edge = edgeAround(node);
605
+ if (!edge) return null;
606
+ const owner = heldBy(edge);
607
+ if (edge.matches(INSTANCE)) return owner ?? edge;
608
+ return owner !== null && edgeAround(edge) === owner ? null : owner;
609
+ }
610
+ var opensDocument = (node) => node.matches(SLOT_PART) && heldBy(node) !== null && edgeAround(node) === heldBy(node);
611
+ var componentAt = (node) => node?.nodeType === 1 && heldBy(node) !== null && !opensDocument(node);
612
+ var FALLBACK = "data-doc-fallback";
613
+ var CONTROLS2 = "input, select, textarea, button";
614
+ var CONTROL_MARK = "data-doc-fallback-control";
615
+ var ARRIVING = "data-ge-arriving";
616
+ var NOTE = "doc-component-note";
617
+ var DATA_SHOWN = "doc-component-data";
618
+ var DATA_ONE = "doc-component-one";
619
+ var DATA_LINE = "doc-component-line";
620
+ var DATA_SHORT = "doc-component-short";
621
+ var NO_CODE = /^application\/(?:\S+\+)?json$/i;
622
+ var isDataScript = (tag, attributes) => tag.toLowerCase() === "script" && NO_CODE.test((attributes.find(({ name }) => name.toLowerCase() === "type")?.value ?? "").trim());
623
+ var DATA_MOST = 1024 * 1024;
624
+ var SCHEMA = "data-doc-schema";
625
+ var schemaAhead = (value, schema = 1) => value !== null && value !== void 0 && !(String(value).trim() !== "" && Number(value) <= schema);
626
+
627
+ // src/render/kit/runtime/shown-data.js
628
+ var DEPTH = 3;
629
+ var ITEMS = 20;
630
+ var COLUMNS = 8;
631
+ var TEXT = 200;
632
+ var MOST = 400;
633
+ var SHORT = 20;
634
+ var isObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
635
+ var isValue = (value) => value === null || typeof value !== "object";
636
+ var cut = (text) => text.length > TEXT ? `${text.slice(0, TEXT)}\u2026` : text;
637
+ var sizeOf = (value) => Array.isArray(value) ? value.length : Object.keys(value).length;
638
+ function made(doc, tag, text = null, className = null) {
639
+ const node = doc.createElement(tag);
640
+ if (text !== null) node.textContent = text;
641
+ if (className) node.className = className;
642
+ return node;
643
+ }
644
+ function scalar(value) {
645
+ if (value === null) return "\u2014";
646
+ if (value === true) return sayRuntime("value-true");
647
+ if (value === false) return sayRuntime("value-false");
648
+ return cut(String(value));
649
+ }
650
+ function drawn(doc, value, depth, left) {
651
+ left.values--;
652
+ if (isValue(value)) return doc.createTextNode(scalar(value));
653
+ if (sizeOf(value) === 0) return doc.createTextNode(sayRuntime("value-empty"));
654
+ if (depth >= DEPTH || left.values <= 0) return doc.createTextNode(sayRuntime("value-deeper", String(sizeOf(value))));
655
+ if (Array.isArray(value) && value.every(isObject)) return table(doc, value, depth, left);
656
+ if (Array.isArray(value)) return list(doc, value, depth, left);
657
+ return pairs(doc, value, depth, left);
658
+ }
659
+ function table(doc, rows, depth, left) {
660
+ const keys = [...new Set(rows.slice(0, ITEMS).flatMap((row) => Object.keys(row)))];
661
+ const columns = keys.slice(0, COLUMNS);
662
+ const node = made(doc, "table");
663
+ const head = node.createTHead().insertRow();
664
+ for (const key of columns) head.append(made(doc, "th", cut(key)));
665
+ const body = node.createTBody();
666
+ let shown2 = 0;
667
+ for (const row of rows.slice(0, ITEMS)) {
668
+ if (left.values <= 0) break;
669
+ const line = body.insertRow();
670
+ for (const key of columns) {
671
+ const cell = line.insertCell();
672
+ if (!Object.hasOwn(row, key)) continue;
673
+ const inner = drawn(doc, row[key], depth + 1, left);
674
+ if (inner.nodeType === 3 && inner.data.length <= SHORT) cell.className = DATA_SHORT;
675
+ cell.append(inner);
676
+ }
677
+ shown2++;
678
+ }
679
+ const said = [shown2 < rows.length && sayRuntime("rows-more", String(rows.length - shown2)), keys.length > COLUMNS && sayRuntime("columns-more", String(keys.length - COLUMNS))].filter(Boolean);
680
+ if (said.length > 0) {
681
+ const cell = made(doc, "td", said.join(" "), "doc-component-more");
682
+ cell.colSpan = columns.length;
683
+ node.createTFoot().insertRow().append(cell);
684
+ }
685
+ return node;
686
+ }
687
+ function item(doc, inner) {
688
+ const node = made(doc, "li");
689
+ node.append(inner);
690
+ return node;
691
+ }
692
+ function list(doc, items, depth, left) {
693
+ const node = made(doc, "ul", null, depth > 0 && items.every(isValue) ? DATA_LINE : null);
694
+ let shown2 = 0;
695
+ for (const value of items.slice(0, ITEMS)) {
696
+ if (left.values <= 0) break;
697
+ node.append(item(doc, drawn(doc, value, depth + 1, left)));
698
+ shown2++;
699
+ }
700
+ if (shown2 < items.length) node.append(made(doc, "li", sayRuntime("value-more", String(items.length - shown2)), "doc-component-more"));
701
+ return node;
702
+ }
703
+ function pairs(doc, object, depth, left) {
704
+ const node = made(doc, "dl");
705
+ const entries = Object.entries(object);
706
+ let shown2 = 0;
707
+ for (const [key, value] of entries.slice(0, ITEMS)) {
708
+ if (left.values <= 0) break;
709
+ const said = made(doc, "dd");
710
+ said.append(drawn(doc, value, depth + 1, left));
711
+ node.append(made(doc, "dt", cut(key)), said);
712
+ shown2++;
713
+ }
714
+ if (shown2 < entries.length) node.append(made(doc, "dd", sayRuntime("value-more", String(entries.length - shown2)), "doc-component-more"));
715
+ return node;
716
+ }
717
+ function drawData(script, { writing = false } = {}) {
718
+ const doc = script.ownerDocument;
719
+ const text = script.textContent.trim();
720
+ let root;
721
+ try {
722
+ root = text === "" ? doc.createTextNode(sayRuntime("value-empty")) : drawn(doc, JSON.parse(text), 0, { values: MOST });
723
+ } catch {
724
+ root = doc.createTextNode(writing ? sayRuntime("not-json", cut(text)) : cut(text));
725
+ }
726
+ if (root.nodeType !== 1) {
727
+ const one = made(doc, "ul", null, DATA_ONE);
728
+ one.append(item(doc, root));
729
+ root = one;
730
+ }
731
+ root.classList.add(DATA_SHOWN);
732
+ return root;
733
+ }
734
+
735
+ // src/render/kit/runtime/kernel.js
736
+ function createKit({ descriptions }) {
737
+ const global2 = globalThis;
738
+ const defs = /* @__PURE__ */ new Map();
739
+ const instances = /* @__PURE__ */ new Map();
740
+ const counters = { mounted: 0, destroyed: 0, failed: 0 };
741
+ const preview = () => !document.querySelector('meta[name="generator"][content="Gallery"], meta[name="generator"][content="HTML Report Studio"], meta[name="doc-export-id"]');
742
+ const writing = () => preview() && !new URLSearchParams(location.search).has("present");
743
+ const selectorOf = (def) => def.selector ?? descriptions.get(def.id)?.match;
744
+ const ofPackage = (def) => PACKAGE_ID.test(def.id);
745
+ const listening = (signal) => [...instances.entries()].filter(([, instance]) => instance.def.on?.includes(signal));
746
+ let owned = "";
747
+ function logged(id, error) {
748
+ counters.failed += 1;
749
+ console.error(`[DocKit] ${id}:`, error);
750
+ }
751
+ function report(def, host, error) {
752
+ logged(def.id, error);
753
+ const instance = instances.get(host);
754
+ if (instance && ofPackage(def)) giveUp(instance, host);
755
+ if (!writing() || !host?.isConnected) return;
756
+ const note = instance?.note ?? document.createElement("div");
757
+ note.className = "doc-kit-error";
758
+ note.setAttribute("data-doc-dev", "");
759
+ note.setAttribute("role", "alert");
760
+ note.textContent = `${def.id}: ${error?.message ?? error}`;
761
+ if (!note.isConnected) host.after(note);
762
+ if (instance) instance.note = note;
763
+ }
764
+ function clearNote(instance) {
765
+ instance.note?.remove();
766
+ instance.note = null;
767
+ }
768
+ const queued = /* @__PURE__ */ new Map();
769
+ let frame = 0;
770
+ let asked = 0;
771
+ function runFrame() {
772
+ frame = 0;
773
+ const work = [...queued];
774
+ queued.clear();
775
+ for (const [host, run] of work) {
776
+ const instance = instances.get(host);
777
+ if (!instance) continue;
778
+ try {
779
+ run();
780
+ clearNote(instance);
781
+ } catch (error) {
782
+ report(instance.def, host, error);
783
+ }
784
+ }
785
+ asked = queued.size > 0 ? asked + 1 : 0;
786
+ settle();
787
+ }
788
+ function schedule(host, run) {
789
+ if (instances.get(host)?.failed) return;
790
+ queued.set(host, run);
791
+ if (!frame) frame = requestAnimationFrame(runFrame);
792
+ }
793
+ const ENDLESS = 30;
794
+ let drawn2 = false;
795
+ let fontsIn = !document.fonts;
796
+ const still = () => !drawn2 && (asked >= ENDLESS || !frame && queued.size === 0);
797
+ function settle() {
798
+ if (drawn2 || !fontsIn || document.readyState === "loading") return;
799
+ requestAnimationFrame(() => {
800
+ if (!still()) return;
801
+ requestAnimationFrame(() => {
802
+ if (!still()) return;
803
+ drawn2 = true;
804
+ document.documentElement.setAttribute("data-doc-drawn", "");
805
+ });
806
+ });
807
+ }
808
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", settle, { once: true });
809
+ else settle();
810
+ document.fonts?.ready.then(() => {
811
+ fontsIn = true;
812
+ settle();
813
+ });
814
+ function tell(host, reason, detail, options) {
815
+ const instance = instances.get(host);
816
+ if (!instance?.handle?.update) return;
817
+ try {
818
+ instance.handle.update(reason, detail, options);
819
+ } catch (error) {
820
+ report(instance.def, host, error);
821
+ }
822
+ }
823
+ const tellAll = (signal, detail) => listening(signal).forEach(([host]) => tell(host, signal, detail));
824
+ const resize = new ResizeObserver((entries) => {
825
+ for (const { target, contentRect } of entries) {
826
+ const instance = instances.get(target);
827
+ if (!instance) continue;
828
+ const width = Math.round(contentRect.width);
829
+ if (width === instance.width) continue;
830
+ instance.width = width;
831
+ tell(target, "resize");
832
+ }
833
+ });
834
+ global2.addEventListener("doc-theme-change", () => tellAll("theme"));
835
+ global2.addEventListener("doc-layout-change", () => tellAll("layout"));
836
+ let editable = false;
837
+ global2.addEventListener("doc-editable", () => {
838
+ editable = true;
839
+ tellAll("editable");
840
+ });
841
+ global2.addEventListener("resize", () => tellAll("viewport"));
842
+ document.fonts?.ready.then(() => tellAll("fonts"));
843
+ document.fonts?.addEventListener?.("loadingdone", (event) => tellAll("fonts", [...event.fontfaces ?? []]));
844
+ const ownedBy = (node, host) => node.parentElement.closest(INSTANCE) === host && heldBy(node) === host;
845
+ const partsIn = (host, at, edit = null) => [...host.querySelectorAll(at)].filter((node) => !node.matches(INSTANCE) && ownedBy(node, host) && edit === "flow" === node.matches(SLOT_PART));
846
+ const instanceName = (def, host) => host.getAttribute("data-block-id") ?? String(hostsIn(document, selectorOf(def)).indexOf(host));
847
+ const canEdit = (def, host) => editable && instances.get(host)?.failed === false && !schemaAhead(host.getAttribute(SCHEMA), descriptions.get(def.id)?.schema);
848
+ const partNamed = (def, name) => {
849
+ const part = descriptions.get(def.id)?.parts?.[name];
850
+ if (!part) throw new Error(`no part "${name}" in ${def.id}'s manifest`);
851
+ return part;
852
+ };
853
+ const packageContext = (def, host) => ({
854
+ part: (name) => partsIn(host, partNamed(def, name).at, partNamed(def, name).edit)[0] ?? null,
855
+ state: ({ version, defaults, transientKeys }) => global2.DocState.getOrCreate({ id: `${def.id}:${instanceName(def, host)}`, version, defaults, transientKeys }),
856
+ canEdit: () => canEdit(def, host),
857
+ edit(names, change) {
858
+ if (!canEdit(def, host)) return false;
859
+ const several = Array.isArray(names);
860
+ const parts = (several ? names : [names]).map((name) => {
861
+ const { at, edit } = partNamed(def, name);
862
+ if (edit !== "data") throw new Error(`the part "${name}" of ${def.id} is not edited as data`);
863
+ return { name, part: partsIn(host, at, edit)[0] };
864
+ });
865
+ const apart = parts.find(({ part }, index) => parts.some((other, at) => at !== index && part && other.part && (part === other.part || other.part.contains(part))));
866
+ if (apart) throw new Error(`the part "${apart.name}" of ${def.id} is in another this edit names, or is it: name the one around it`);
867
+ if (parts.length === 0 || parts.some(({ part }) => !part)) return false;
868
+ const run = (drafts) => {
869
+ try {
870
+ if (typeof change(several ? drafts : drafts[names])?.then === "function") throw new Error(`a change of ${several ? names.map((name) => `"${name}"`).join(", ") : `"${names}"`} runs at once: context.edit does not wait for it`);
871
+ return true;
872
+ } catch (error) {
873
+ logged(def.id, error);
874
+ return false;
875
+ }
876
+ };
877
+ return !host.dispatchEvent(new CustomEvent("doc-component-edit", { bubbles: true, cancelable: true, detail: { parts, run } }));
878
+ }
879
+ });
880
+ function takeRuntime(description, root) {
881
+ const { generated = [], attrs = {} } = description?.runtime ?? {};
882
+ const own = (selector) => hostsIn(root, selector).filter((node) => node === root || heldBy(node) === root);
883
+ for (const selector of generated) own(selector).forEach((node) => node.remove());
884
+ for (const [selector, names] of Object.entries(attrs)) own(selector).forEach((node) => names.forEach((name) => node.removeAttribute(name)));
885
+ }
886
+ function clear(def, host) {
887
+ try {
888
+ def.dehydrate?.(host);
889
+ } catch (error) {
890
+ logged(def.id, error);
891
+ }
892
+ takeRuntime(descriptions.get(def.id), host);
893
+ takeFallback(host);
894
+ }
895
+ function takeFallback(host) {
896
+ host.removeAttribute(FALLBACK);
897
+ for (const control of host.querySelectorAll(`[${CONTROL_MARK}]`)) {
898
+ control.removeAttribute("inert");
899
+ control.removeAttribute(CONTROL_MARK);
900
+ }
901
+ host.querySelector(`:scope > .${NOTE}`)?.remove();
902
+ dataShownIn(host).forEach((node) => node.remove());
903
+ }
904
+ function giveUp(instance, host) {
905
+ if (instance.failed) return;
906
+ instance.failed = true;
907
+ queued.delete(host);
908
+ resize.unobserve(host);
909
+ instance.controller.abort();
910
+ const { handle } = instance;
911
+ instance.handle = null;
912
+ takeBack(instance, host, handle);
913
+ }
914
+ function takeBack({ def }, host, handle) {
915
+ for (const undo of [() => handle?.destroy?.(), () => def.dehydrate?.(host)]) {
916
+ try {
917
+ undo();
918
+ } catch {
919
+ }
920
+ }
921
+ takeRuntime(descriptions.get(def.id), host);
922
+ showAsItStands(host);
923
+ }
924
+ function keep(def, host, make) {
925
+ const controller = new AbortController();
926
+ const instance = { def, handle: null, context: null, controller, width: -1, note: null, failed: false };
927
+ instances.set(host, instance);
928
+ const packaged = ofPackage(def);
929
+ const context2 = {
930
+ host,
931
+ signal: controller.signal,
932
+ frame: (run) => schedule(host, run),
933
+ fail: (error) => report(def, host, error),
934
+ ...packaged ? packageContext(def, host) : {}
935
+ };
936
+ instance.context = context2;
937
+ let failure = null;
938
+ let made2 = null;
939
+ try {
940
+ made2 = make(context2);
941
+ } catch (error) {
942
+ failure = error;
943
+ }
944
+ if (packaged && (failure || instance.failed)) {
945
+ const failedAsItRan = instance.failed;
946
+ if (failure) report(def, host, failure);
947
+ if (failedAsItRan) takeBack(instance, host, made2);
948
+ return null;
949
+ }
950
+ if (packaged && typeof made2?.then === "function") made2 = whenMade(made2, instance, host, context2);
951
+ instance.handle = made2 ?? (packaged ? {} : null);
952
+ if (!instance.handle) {
953
+ controller.abort();
954
+ if (instances.get(host) === instance) instances.delete(host);
955
+ if (failure) report(def, host, failure);
956
+ return null;
957
+ }
958
+ counters.mounted += 1;
959
+ if (def.on?.includes("resize")) resize.observe(host);
960
+ return instance.handle;
961
+ }
962
+ function whenMade(promise, instance, host, context2) {
963
+ const current = () => instances.get(host) === instance && !instance.failed;
964
+ const couldEdit = editable;
965
+ promise.then((handle) => {
966
+ if (!current()) return void handle?.destroy?.();
967
+ instance.handle = handle ?? {};
968
+ if (editable && !couldEdit && instance.def.on?.includes("editable")) tell(host, "editable");
969
+ }, (error) => {
970
+ if (current()) context2.fail(error);
971
+ }).catch((error) => logged(instance.def.id, error));
972
+ return {};
973
+ }
974
+ function mount(def, host) {
975
+ if (instances.has(host)) return instances.get(host).handle;
976
+ return keep(def, host, (context2) => {
977
+ if (ofPackage(def)) clear(def, host);
978
+ return def.mount(host, context2);
979
+ });
980
+ }
981
+ function destroy(host) {
982
+ const instance = instances.get(host);
983
+ if (!instance) return;
984
+ instances.delete(host);
985
+ queued.delete(host);
986
+ counters.destroyed += 1;
987
+ resize.unobserve(host);
988
+ instance.controller.abort();
989
+ clearNote(instance);
990
+ try {
991
+ instance.handle?.destroy?.();
992
+ } catch (error) {
993
+ report(instance.def, host, error);
994
+ }
995
+ }
996
+ const hostsIn = (root, selector) => [...root.matches?.(selector) ? [root] : [], ...root.querySelectorAll?.(selector) ?? []];
997
+ const outsidePage = (node) => Boolean(node.closest?.("[data-doc-dev]"));
998
+ const inOther = (def, host) => host.matches(INSTANCE) && host.getAttribute(ATTRIBUTE) !== def.id || (heldBy(host)?.getAttribute(ATTRIBUTE) ?? def.id) !== def.id;
999
+ function scan(root, only, { later = false } = {}) {
1000
+ for (const def of only ? [only] : defs.values()) {
1001
+ if (!def.started || later && def.added === false) continue;
1002
+ for (const host of hostsIn(root, selectorOf(def))) if (!outsidePage(host) && !inOther(def, host)) mount(def, host);
1003
+ }
1004
+ }
1005
+ function component(def) {
1006
+ if (!def?.id || typeof def.mount !== "function") throw new Error("DocKit.component requires an id and a mount function.");
1007
+ if (def.on !== void 0 && !Array.isArray(def.on)) throw new Error(`DocKit: "${def.id}": \`on\` is a list of signals.`);
1008
+ if (defs.has(def.id)) throw new Error(`DocKit: "${def.id}" is registered already.`);
1009
+ if (!selectorOf(def)) throw new Error(`DocKit: "${def.id}" has no description with a match (src/shared/components/).`);
1010
+ const registered = { ...def, owns: def.owns ?? ofPackage(def), started: false };
1011
+ defs.set(def.id, registered);
1012
+ if (registered.owns) owned = [...defs.values()].filter((entry) => entry.owns).map(selectorOf).join(", ");
1013
+ const start = () => {
1014
+ registered.started = true;
1015
+ scan(document, registered);
1016
+ };
1017
+ if (def.when === "now" || document.readyState !== "loading") start();
1018
+ else document.addEventListener("DOMContentLoaded", start, { once: true });
1019
+ return registered;
1020
+ }
1021
+ function showAsItStands(host) {
1022
+ host.setAttribute(FALLBACK, "");
1023
+ for (const control of host.querySelectorAll(CONTROLS2)) {
1024
+ if (control.hasAttribute("inert") || heldBy(control) !== host) continue;
1025
+ control.setAttribute("inert", "");
1026
+ control.setAttribute(CONTROL_MARK, "");
1027
+ }
1028
+ showData(host);
1029
+ }
1030
+ const drawnFrom = /* @__PURE__ */ new WeakMap();
1031
+ const dataShownIn = (host) => [...host.querySelectorAll(`.${DATA_SHOWN}`)].filter((node) => ownedBy(node, host));
1032
+ function showData(host) {
1033
+ const kept = /* @__PURE__ */ new Set();
1034
+ for (const script of host.querySelectorAll("script")) {
1035
+ if (!ownedBy(script, host) || !isDataScript(script.localName, [...script.attributes])) continue;
1036
+ const next = script.nextElementSibling;
1037
+ if (next && drawnFrom.get(next) === script.textContent) {
1038
+ kept.add(next);
1039
+ continue;
1040
+ }
1041
+ const drawing = drawData(script, { writing: writing() });
1042
+ drawnFrom.set(drawing, script.textContent);
1043
+ script.after(drawing);
1044
+ kept.add(drawing);
1045
+ }
1046
+ for (const node of dataShownIn(host)) if (!kept.has(node)) node.remove();
1047
+ }
1048
+ const silent = /* @__PURE__ */ new Set();
1049
+ function fallback(root) {
1050
+ const loaded2 = document.readyState === "complete";
1051
+ for (const host of hostsIn(root, INSTANCE)) {
1052
+ const id = host.getAttribute(ATTRIBUTE);
1053
+ const told = descriptions.get(id);
1054
+ if (outsidePage(host) || heldBy(host) || defs.has(id) || [...document.querySelectorAll(`script[${ARRIVING}]`)].some((script) => script.getAttribute(ARRIVING) === id)) continue;
1055
+ if (told?.match && !(told.script && loaded2)) {
1056
+ if (host.hasAttribute(FALLBACK)) takeFallback(host);
1057
+ continue;
1058
+ }
1059
+ showAsItStands(host);
1060
+ if (told?.match && !silent.has(id)) {
1061
+ silent.add(id);
1062
+ logged(id, new Error("its script ran and started no component: no DocKit.component call of this id"));
1063
+ }
1064
+ if (!writing() || host.querySelector(`:scope > .${NOTE}`)) continue;
1065
+ const note = document.createElement("div");
1066
+ note.className = NOTE;
1067
+ note.setAttribute("data-doc-dev", "");
1068
+ note.textContent = told?.problem ? sayRuntime("component-broken", id, told.problem[kitLanguage()]) : sayRuntime(told?.match ? "component-silent" : "component-missing", id);
1069
+ host.prepend(note);
1070
+ }
1071
+ }
1072
+ if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", () => fallback(document), { once: true });
1073
+ else fallback(document);
1074
+ if (document.readyState !== "complete") global2.addEventListener("load", () => fallback(document), { once: true });
1075
+ const sourceParts = (host, id) => Object.values(descriptions.get(id)?.parts ?? {}).filter(({ edit }) => edit === "text" || edit === "data" || edit === "flow").flatMap(({ at, edit }) => partsIn(host, at, edit));
1076
+ const ownedHere = (target) => {
1077
+ const host = target.closest(owned);
1078
+ if (!host) return false;
1079
+ if (!host.matches(INSTANCE)) return true;
1080
+ return target === host || componentAt(target) && heldBy(target) === host;
1081
+ };
1082
+ function changes(records, options) {
1083
+ if (!global2.document?.defaultView) return;
1084
+ const changed = [];
1085
+ const revealed = /* @__PURE__ */ new Set();
1086
+ const sourced = options?.quiet ? [] : listening("source");
1087
+ const written = [];
1088
+ let removed = false;
1089
+ const later = [...defs.values()].filter((def) => def.started && def.added !== false).map(selectorOf).concat(INSTANCE).join(", ");
1090
+ for (const record of records) {
1091
+ const target = record.target.nodeType === 1 ? record.target : record.target.parentElement;
1092
+ if (!target || outsidePage(target)) continue;
1093
+ if (sourced.length > 0 && record.type !== "attributes") written.push([target, record]);
1094
+ if (owned && ownedHere(target)) continue;
1095
+ if (record.type === "attributes") {
1096
+ revealed.add(target);
1097
+ continue;
1098
+ }
1099
+ if (record.removedNodes.length > 0) removed = true;
1100
+ for (const node of record.addedNodes) {
1101
+ if (node.nodeType !== 1 || !node.isConnected || outsidePage(node) || !(node.matches(later) || node.querySelector(later))) continue;
1102
+ scan(node, null, { later: true });
1103
+ fallback(node);
1104
+ }
1105
+ changed.push([target, record]);
1106
+ }
1107
+ if (removed) {
1108
+ for (const host of [...instances.keys()]) if (!host.isConnected) destroy(host);
1109
+ }
1110
+ const hosts = listening("content").map(([host]) => host);
1111
+ if (hosts.length > 0 && changed.length > 0) {
1112
+ const heard = new Map(hosts.map((host) => [host, []]));
1113
+ for (const [target, record] of changed) for (let node = target; node; node = node.parentElement) heard.get(node)?.push(record);
1114
+ for (const host of hosts) if (heard.get(host).length > 0) tell(host, "content", heard.get(host), options);
1115
+ }
1116
+ for (const [host, { def }] of sourced) {
1117
+ const parts = sourceParts(host, def.id);
1118
+ const heard = written.filter(([target]) => parts.some((part) => part.contains(target))).map(([, record]) => record);
1119
+ if (heard.length > 0) tell(host, "source", heard);
1120
+ }
1121
+ for (const [host] of listening("reveal")) {
1122
+ for (const target of revealed) if (target.contains(host)) {
1123
+ tell(host, "reveal");
1124
+ break;
1125
+ }
1126
+ }
1127
+ }
1128
+ const observer = new MutationObserver((records) => changes(records));
1129
+ observer.observe(document.documentElement, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ["hidden", "open"] });
1130
+ function quietly(change) {
1131
+ changes(observer.takeRecords());
1132
+ try {
1133
+ return change();
1134
+ } finally {
1135
+ for (let pass = 0, records; pass < 3 && (records = observer.takeRecords()).length > 0; pass++) changes(records, { quiet: true });
1136
+ }
1137
+ }
1138
+ function dehydrate(root) {
1139
+ const all = (selector) => hostsIn(root, selector);
1140
+ for (const def of defs.values()) {
1141
+ if (!def.dehydrate) continue;
1142
+ for (const host of all(selectorOf(def))) {
1143
+ try {
1144
+ def.dehydrate(host);
1145
+ } catch (error) {
1146
+ report(def, host, error);
1147
+ }
1148
+ }
1149
+ }
1150
+ for (const [id, description] of descriptions) {
1151
+ const marks = description.runtime ?? {};
1152
+ const of = (selector) => PACKAGE_ID.test(id) ? all(selector).filter((node) => (node.matches(INSTANCE) ? node : heldBy(node))?.getAttribute(ATTRIBUTE) === id) : all(selector);
1153
+ for (const selector of marks.generated ?? []) of(selector).forEach((node) => node.remove());
1154
+ for (const [selector, names] of Object.entries(marks.attrs ?? {})) of(selector).forEach((node) => names.forEach((name) => node.removeAttribute(name)));
1155
+ for (const [selector, names] of Object.entries(marks.classes ?? {})) {
1156
+ all(selector).forEach((node) => {
1157
+ node.classList.remove(...names);
1158
+ if (node.classList.length === 0) node.removeAttribute("class");
1159
+ });
1160
+ }
1161
+ (marks.root?.attrs ?? []).forEach((name) => root.removeAttribute(name));
1162
+ (marks.root?.classes ?? []).forEach((name) => root.classList.remove(name));
1163
+ if (root.classList.length === 0) root.removeAttribute("class");
1164
+ }
1165
+ return root;
1166
+ }
1167
+ return Object.freeze({
1168
+ component,
1169
+ /** What the server says of a package (src/shared/component-catalog.mjs): where its instances are and its parts, before its component registers, or why it does not load (`problem`, { zh, en }). */
1170
+ describe: (told) => void descriptions.set(told.id, told),
1171
+ /** What was told of a package, or a component's own description: where its instances are and its parts; null when nothing was. */
1172
+ description: (id) => descriptions.get(id) ?? null,
1173
+ destroy,
1174
+ /** Start what a root holds now (a report's script added it), as if it had been added. */
1175
+ mount(root = document) {
1176
+ scan(root, null, { later: root !== document });
1177
+ fallback(root);
1178
+ },
1179
+ quietly,
1180
+ dehydrate,
1181
+ /** The component on `host` makes its `example` of an edit, as gallery component check asks it. Whether it has one. */
1182
+ example(host) {
1183
+ const instance = instances.get(host);
1184
+ if (!instance?.def.example) return false;
1185
+ instance.def.example(host, instance.context);
1186
+ return true;
1187
+ },
1188
+ /** Counts for tests and the console: instances live (by component), mounted, destroyed, failed. */
1189
+ stats() {
1190
+ const live2 = {};
1191
+ for (const { def, failed } of instances.values()) if (!failed) live2[def.id] = (live2[def.id] ?? 0) + 1;
1192
+ return { ...counters, live: live2, components: [...defs.keys()] };
1193
+ }
1194
+ });
1195
+ }
1196
+
1197
+ // src/shared/reading-place.mjs
1198
+ var rootOf = (doc) => doc.querySelector("main") ?? doc.body;
1199
+ var cssString = (win, value) => win?.CSS?.escape ? win.CSS.escape(value) : String(value).replace(/["\\]/g, "\\$&").replace(/\n/g, "\\a ");
1200
+ var blockOf = (element) => element.closest("[data-block-id]")?.getAttribute("data-block-id") ?? null;
1201
+ var tabsIn = (win) => {
1202
+ const tabs = {};
1203
+ for (const area of win.document.querySelectorAll("[data-doc-sheets]")) {
1204
+ const key = win.DocSheets?.get(area)?.get();
1205
+ if (typeof key === "string") tabs[area.getAttribute("data-doc-sheets")] = key;
1206
+ }
1207
+ return tabs;
1208
+ };
1209
+ function placeIn(win) {
1210
+ const doc = win.document;
1211
+ const root = rootOf(doc);
1212
+ let top = null;
1213
+ if (root) {
1214
+ const walker = doc.createTreeWalker(root, 1, (element) => {
1215
+ if (element.localName === "dialog") return 2;
1216
+ const box = element.getBoundingClientRect();
1217
+ if (box.bottom <= 0 && box.height > 0) return 2;
1218
+ const { position } = win.getComputedStyle(element);
1219
+ return position === "fixed" || position === "sticky" ? 2 : 1;
1220
+ });
1221
+ for (let element = walker.nextNode(); element; element = walker.nextNode()) {
1222
+ const box = element.getBoundingClientRect();
1223
+ if (box.height === 0 || box.top < 0) continue;
1224
+ const path = [];
1225
+ for (let node = element; node !== root; node = node.parentElement) path.unshift([...node.parentElement.children].indexOf(node));
1226
+ top = { path, id: blockOf(element), at: Math.round(box.top) };
1227
+ break;
1228
+ }
1229
+ }
1230
+ return { x: Math.round(win.scrollX), y: Math.round(win.scrollY), top, tabs: tabsIn(win) };
1231
+ }
1232
+ function elementOf(doc, top) {
1233
+ const root = rootOf(doc);
1234
+ if (!root || !top) return null;
1235
+ let element = root;
1236
+ for (const index of Array.isArray(top.path) ? top.path : [null]) element = Number.isInteger(index) ? element?.children[index] ?? null : null;
1237
+ const id = typeof top.id === "string" ? top.id : null;
1238
+ if (element && (id === null || blockOf(element) === id)) return element;
1239
+ return id ? doc.querySelector(`[data-block-id="${cssString(doc.defaultView, id)}"]`) : null;
1240
+ }
1241
+ function goBackTo(win, place) {
1242
+ const tabs = place?.tabs && typeof place.tabs === "object" ? place.tabs : {};
1243
+ for (const area of win.document.querySelectorAll("[data-doc-sheets]")) {
1244
+ const key = tabs[area.getAttribute("data-doc-sheets")];
1245
+ if (typeof key === "string" && win.DocSheets?.get(area)?.get() !== key) win.DocSheets?.get(area)?.set(key);
1246
+ }
1247
+ const element = elementOf(win.document, place?.top);
1248
+ const box = element && !element.closest("dialog") ? element.getBoundingClientRect() : null;
1249
+ const x = Number(place?.x) || 0;
1250
+ if (box && box.height > 0 && Number.isFinite(place.top.at)) win.scrollTo(x, win.scrollY + box.top - place.top.at);
1251
+ else win.scrollTo(x, Number(place?.y) || 0);
1252
+ }
1253
+ function unmoved(win, place, put) {
1254
+ const at = (x, y) => Math.abs(win.scrollX - x) < 1 && Math.abs(win.scrollY - y) < 1;
1255
+ return at(put[0], put[1]) || at(Number(place?.x) || 0, Number(place?.y) || 0);
1256
+ }
1257
+
1258
+ // src/render/kit/runtime/reveal.js
1259
+ var CARD = "dialog.doc-dialog";
1260
+ var shown = (panel) => {
1261
+ const area = panel.parentElement;
1262
+ const key = panel.getAttribute("data-doc-sheet");
1263
+ globalThis.DocSheets?.get(area)?.set(key);
1264
+ if (panel.hidden) [...area.querySelectorAll("[data-sheet-tab]")].find((tab) => tab.getAttribute("data-sheet-tab") === key)?.click();
1265
+ };
1266
+ function reveal(target) {
1267
+ for (const card of [...document.querySelectorAll(`${CARD}[open]`)].reverse()) {
1268
+ if (card.contains(target)) continue;
1269
+ if (globalThis.DocDialogs) globalThis.DocDialogs.close(card, "outside");
1270
+ else card.close();
1271
+ }
1272
+ const around = [];
1273
+ for (let node = target; node; node = node.parentElement) around.unshift(node);
1274
+ for (const node of around) {
1275
+ if (node.hasAttribute("data-doc-sheet") && node.hidden && node.parentElement?.matches("[data-doc-sheets]")) shown(node);
1276
+ else if (node.matches(`${CARD}:not([open])`)) {
1277
+ if (globalThis.DocDialogs) globalThis.DocDialogs.open(node);
1278
+ else node.showModal();
1279
+ } else if (node !== target && node.localName === "details" && !node.open) node.open = true;
1280
+ }
1281
+ }
1282
+ function startBlockLinks(doc) {
1283
+ const win = doc.defaultView;
1284
+ const root = doc.documentElement;
1285
+ const editing2 = () => root.hasAttribute("data-ge-editing");
1286
+ const idOf = (hash) => {
1287
+ try {
1288
+ return decodeURIComponent(hash.slice(1));
1289
+ } catch {
1290
+ return hash.slice(1);
1291
+ }
1292
+ };
1293
+ const blockNamed = (hash) => idOf(hash) ? doc.querySelector(`[data-block-id="${cssString(win, idOf(hash))}"]`) : null;
1294
+ const named = (hash) => blockNamed(hash) ?? (idOf(hash) ? doc.getElementById(idOf(hash)) : null);
1295
+ const go = (hash) => {
1296
+ putting += 1;
1297
+ const target = named(hash);
1298
+ if (!target) return;
1299
+ reveal(target);
1300
+ target.scrollIntoView({ block: "center" });
1301
+ };
1302
+ let order = [...doc.querySelectorAll(`${CARD}[open]`)];
1303
+ new win.MutationObserver((records) => {
1304
+ for (const { target } of records) {
1305
+ if (!target.matches?.(CARD)) continue;
1306
+ order = order.filter((card) => card !== target);
1307
+ if (target.open) order.push(target);
1308
+ }
1309
+ }).observe(root, { subtree: true, attributes: true, attributeFilter: ["open"] });
1310
+ const contentOf2 = (card) => card.querySelector(".doc-dialog-content");
1311
+ const cards = () => {
1312
+ const open = [...doc.querySelectorAll(`${CARD}[open]`)];
1313
+ return [...order.filter((card) => card.open), ...open.filter((card) => !order.includes(card))].filter((card) => card.id).map((card) => ({ id: card.id, top: contentOf2(card)?.scrollTop ?? 0 }));
1314
+ };
1315
+ let putting = 0;
1316
+ let seen = win.location.hash;
1317
+ let stepped = null;
1318
+ const jump = (hash) => {
1319
+ if (hash !== win.location.hash) {
1320
+ const state = win.history.state;
1321
+ try {
1322
+ win.history.replaceState({ ...state && typeof state === "object" ? state : {}, docPlace: { ...placeIn(win), cards: cards() } }, "");
1323
+ win.history.pushState({ docBlock: hash.slice(1) }, "", hash);
1324
+ seen = hash;
1325
+ } catch {
1326
+ win.location.hash = hash;
1327
+ return;
1328
+ }
1329
+ }
1330
+ go(hash);
1331
+ };
1332
+ const back = (place) => {
1333
+ const kept = (Array.isArray(place.cards) ? place.cards : []).filter((card) => typeof card?.id === "string");
1334
+ const keep = new Set(kept.map((card) => card.id));
1335
+ for (const card of [...cards()].reverse().map(({ id }) => doc.getElementById(id))) {
1336
+ if (!card || keep.has(card.id)) continue;
1337
+ if (globalThis.DocDialogs) globalThis.DocDialogs.close(card, "outside");
1338
+ else card.close();
1339
+ }
1340
+ const scrolled = () => kept.forEach(({ id, top }) => {
1341
+ const content = contentOf2(doc.getElementById(id) ?? doc.body);
1342
+ if (content && Number.isFinite(top)) content.scrollTop = top;
1343
+ });
1344
+ for (const { id } of kept) {
1345
+ const card = doc.getElementById(id);
1346
+ if (!card?.matches(`${CARD}:not([open])`)) continue;
1347
+ if (globalThis.DocDialogs) globalThis.DocDialogs.open(card);
1348
+ else card.showModal();
1349
+ }
1350
+ const mine = ++putting;
1351
+ goBackTo(win, place);
1352
+ scrolled();
1353
+ const put = [win.scrollX, win.scrollY];
1354
+ win.requestAnimationFrame(() => {
1355
+ if (mine !== putting) return;
1356
+ if (!unmoved(win, place, put)) return;
1357
+ goBackTo(win, place);
1358
+ scrolled();
1359
+ });
1360
+ };
1361
+ doc.addEventListener("click", (event) => {
1362
+ if (event.defaultPrevented || editing2() || event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
1363
+ const hash = event.target.closest?.("a[href^='#']:not([download]):not([target])")?.getAttribute("href");
1364
+ const block = hash ? blockNamed(hash) : null;
1365
+ if (!block || block instanceof win.HTMLDialogElement) return;
1366
+ event.preventDefault();
1367
+ jump(hash);
1368
+ });
1369
+ win.addEventListener("doc-jump-request", (event) => {
1370
+ const hash = event.detail?.hash;
1371
+ if (!editing2() && typeof hash === "string" && hash.startsWith("#") && blockNamed(hash)) jump(hash);
1372
+ });
1373
+ win.addEventListener("popstate", (event) => {
1374
+ const state = event.state;
1375
+ const moved = win.location.hash !== seen;
1376
+ seen = win.location.hash;
1377
+ if (editing2() || !state || typeof state !== "object") return;
1378
+ if (state.docPlace && typeof state.docPlace === "object") back(state.docPlace);
1379
+ else if (typeof state.docBlock === "string") go(win.location.hash);
1380
+ else return;
1381
+ stepped = moved ? win.location.hash : null;
1382
+ });
1383
+ win.addEventListener("hashchange", () => {
1384
+ const took = stepped !== null && stepped === win.location.hash;
1385
+ stepped = null;
1386
+ seen = win.location.hash;
1387
+ if (!took && !editing2()) go(win.location.hash);
1388
+ });
1389
+ const arrive = () => {
1390
+ if (win.location.hash && !editing2()) go(win.location.hash);
1391
+ };
1392
+ if (root.hasAttribute("data-doc-drawn")) return arrive();
1393
+ const observer = new win.MutationObserver(() => {
1394
+ if (!root.hasAttribute("data-doc-drawn")) return;
1395
+ observer.disconnect();
1396
+ arrive();
1397
+ });
1398
+ observer.observe(root, { attributes: true, attributeFilter: ["data-doc-drawn"] });
1399
+ }
1400
+
1401
+ // src/shared/inline-spacing.mjs
1402
+ var UNITS = /* @__PURE__ */ new Set([..."\u4E2A\u4E07\u4EBF\u5343\u767E\u5341\u5143\u89D2\u5206\u5398\u6BDB\u500D\u5E74\u6708\u65E5\u53F7\u65F6\u70B9\u79D2\u5929\u5468\u5C81\u4EBA\u4F4D\u540D\u6B21\u5BB6\u6761\u9879\u79CD\u53F0\u53EA\u4EF6\u7BC7\u9875\u5F20\u5957\u4EFD\u7EC4\u6279\u671F\u5C4A\u4EE3\u7EA7\u5C42\u8F6E\u6B65\u7C73\u514B\u65A4\u5428\u5EA6\u91CC\u516C\u6BEB\u5FAE\u5BF8\u5C3A\u4E24\u5347\u6237\u6240\u5EA7\u680B\u8F86\u67B6\u8258\u672C\u90E8\u7AE0\u8282\u573A\u5C40\u9996\u53E5\u5B57\u884C\u5217\u904D\u56DE\u756A\u6210"]);
1403
+ var ZWSP = String.fromCharCode(8203);
1404
+ var WORD = /[\p{L}\p{N}]/u;
1405
+ var ITEM = "code, .doc-math-inline, .katex";
1406
+ var LINE = /^(P|LI|H[1-6]|TD|TH|DT|DD|DIV|SECTION|ARTICLE|ASIDE|HEADER|FOOTER|MAIN|NAV|FIGURE|FIGCAPTION|CAPTION|SUMMARY|DETAILS|BLOCKQUOTE|UL|OL|TABLE|THEAD|TBODY|TR|PRE|BR|HR|DIALOG|BODY|BUTTON|svg)$/;
1407
+ var emptyFormula = (element) => element.matches(".doc-math-inline") && (element.getAttribute("data-ge-empty") === "formula" || !element.textContent.replace(/\\[()]/g, "").trim());
1408
+ var isInlineItem = (node) => node?.nodeType === 1 && node.matches(ITEM) && !emptyFormula(node);
1409
+ function inlineItems(root) {
1410
+ const items = root.nodeType === 1 && root.matches(ITEM) ? [root, ...root.querySelectorAll(ITEM)] : [...root.querySelectorAll(ITEM)];
1411
+ return items.filter((item2) => isInlineItem(item2) && !item2.parentElement?.closest(".doc-math-inline, .katex, .katex-display, code"));
1412
+ }
1413
+ function endOf(node, after) {
1414
+ if (node.nodeType === 3) {
1415
+ const characters = [...node.data.replaceAll(ZWSP, "")];
1416
+ return characters.length === 0 ? void 0 : after ? characters[0] : characters.at(-1);
1417
+ }
1418
+ if (node.nodeType !== 1) return void 0;
1419
+ if (LINE.test(node.tagName)) return null;
1420
+ if (node.matches(ITEM)) return emptyFormula(node) ? void 0 : true;
1421
+ if (node.hasAttribute("data-ge-empty")) return void 0;
1422
+ const children = [...node.childNodes];
1423
+ for (const child of after ? children : children.reverse()) {
1424
+ const found = endOf(child, after);
1425
+ if (found !== void 0) return found;
1426
+ }
1427
+ return void 0;
1428
+ }
1429
+ function sideOf(node, after) {
1430
+ for (let at = node; at; ) {
1431
+ const next = after ? at.nextSibling : at.previousSibling;
1432
+ if (!next) {
1433
+ at = at.parentElement;
1434
+ if (!at || LINE.test(at.tagName) || at.hasAttribute("contenteditable")) return null;
1435
+ continue;
1436
+ }
1437
+ const found = endOf(next, after);
1438
+ if (found !== void 0) return found;
1439
+ at = next;
1440
+ }
1441
+ return null;
1442
+ }
1443
+ function spaceAround(element) {
1444
+ const put = { before: null, after: null };
1445
+ for (const after of [false, true]) {
1446
+ const side = sideOf(element, after);
1447
+ if (side !== true && !(typeof side === "string" && WORD.test(side))) continue;
1448
+ const space = element.ownerDocument.createTextNode(" ");
1449
+ if (after) element.after(space);
1450
+ else element.before(space);
1451
+ put[after ? "after" : "before"] = space;
1452
+ }
1453
+ return put;
1454
+ }
1455
+
1456
+ // src/render/kit/runtime/spacing.js
1457
+ var inert = (element) => element.closest("pre, svg, [contenteditable], [data-doc-dev], script, style, textarea") || element.matches(INSTANCE) || componentAt(element);
1458
+ var NUMBER = String.raw`\d(?:[\d.,]*\d)?(?:%|[A-Za-z]{1,3})?`;
1459
+ var DASH = "[\u2013\u2014~\uFF5E]";
1460
+ var CLOSING = new RegExp(String.raw`^(?:${DASH}${NUMBER})?[,。、;:!?)」』》】〉〕”’,.;:!?)\]]*`);
1461
+ var RANGE = new RegExp(`${NUMBER} ?${DASH} ?${NUMBER}`);
1462
+ var OWN_TEXT = "code, kbd, samp, .katex, .doc-range, .doc-long-run, option";
1463
+ var TEX = /\\[()[\]]|\$\$/;
1464
+ var WRAPPER = /^(STRONG|B|EM|I|U|S|MARK|SPAN|A|SUB|SUP|SMALL)$/;
1465
+ function tieClosing(formula) {
1466
+ let at = formula;
1467
+ while (!at.nextSibling && at.parentElement && WRAPPER.test(at.parentElement.tagName) && !at.parentElement.classList.contains("doc-math-tie")) at = at.parentElement;
1468
+ if (at.parentElement?.classList.contains("doc-math-tie")) return null;
1469
+ const next = at.nextSibling;
1470
+ const marks = next?.nodeType === 3 ? CLOSING.exec(next.data)?.[0] : null;
1471
+ if (!marks) return null;
1472
+ if (next.data.length > marks.length) next.splitText(marks.length);
1473
+ const tie = formula.ownerDocument.createElement("span");
1474
+ tie.className = "doc-math-tie";
1475
+ at.before(tie);
1476
+ const joiner = formula.ownerDocument.createElement("span");
1477
+ joiner.className = "doc-math-joiner";
1478
+ tie.append(at, joiner, next);
1479
+ tie.querySelectorAll(".katex-html").forEach(breakBetweenBoxes);
1480
+ return tie;
1481
+ }
1482
+ function breakBetweenBoxes(html) {
1483
+ if (html.querySelector(":scope > .doc-math-break")) return;
1484
+ const boxes = [...html.children].filter((child) => child.classList.contains("katex-base"));
1485
+ for (const box of boxes.slice(0, -1)) {
1486
+ const gap = html.ownerDocument.createElement("span");
1487
+ gap.className = "doc-math-break";
1488
+ gap.textContent = ZWSP;
1489
+ box.after(gap);
1490
+ }
1491
+ }
1492
+ function untie(tie) {
1493
+ tie.querySelectorAll(":scope > .doc-math-joiner, .doc-math-break").forEach((added) => added.remove());
1494
+ const parent = tie.parentNode;
1495
+ tie.replaceWith(...tie.childNodes);
1496
+ parent?.normalize();
1497
+ }
1498
+ function holdRanges(text) {
1499
+ const held = [];
1500
+ for (let rest = text; rest; ) {
1501
+ const found = RANGE.exec(rest.data);
1502
+ if (!found) break;
1503
+ const range = found.index > 0 ? rest.splitText(found.index) : rest;
1504
+ rest = range.data.length > found[0].length ? range.splitText(found[0].length) : null;
1505
+ const span = range.ownerDocument.createElement("span");
1506
+ span.className = "doc-range";
1507
+ range.before(span);
1508
+ span.append(range);
1509
+ held.push(span);
1510
+ }
1511
+ return held;
1512
+ }
1513
+ function holdRuns(text) {
1514
+ const held = [];
1515
+ for (const { index, length } of longRuns(text.data).reverse()) {
1516
+ if (index + length < text.data.length) text.splitText(index + length);
1517
+ held.unshift(breaking(index > 0 ? text.splitText(index) : text));
1518
+ }
1519
+ return held;
1520
+ }
1521
+ function breaking(node) {
1522
+ const span = node.ownerDocument.createElement("span");
1523
+ span.className = "doc-long-run";
1524
+ node.before(span);
1525
+ span.append(node);
1526
+ return span;
1527
+ }
1528
+ function textsIn(root) {
1529
+ const texts = [];
1530
+ const walker = root.ownerDocument.createTreeWalker(root, 4);
1531
+ for (let node = walker.nextNode(); node; node = walker.nextNode()) texts.push(node);
1532
+ return texts;
1533
+ }
1534
+ function looked(text) {
1535
+ const parent = text.parentElement;
1536
+ return Boolean(parent?.closest("main")) && !TEX.test(text.data) && !inert(parent) && !parent.closest(OWN_TEXT) && !(text.data.includes("$") && parent.closest("[data-doc-math-dollar]"));
1537
+ }
1538
+ function holdIn(root) {
1539
+ for (const text of textsIn(root)) if (RANGE.test(text.data) && looked(text)) holdRanges(text);
1540
+ for (const text of textsIn(root)) if (holdsLongRun(text.data) && looked(text)) holdRuns(text);
1541
+ for (const code of [...root.matches("code") ? [root] : [], ...root.querySelectorAll("code")]) {
1542
+ if (code.closest("main") && !inert(code) && !code.parentElement?.closest(`${OWN_TEXT}, td, th`) && holdsLongRun(code.textContent)) breaking(code);
1543
+ }
1544
+ }
1545
+ function keepLines(root, flows) {
1546
+ const items = [...root.matches("li") ? [root] : [], ...root.parentElement?.matches("li") ? [root.parentElement] : [], ...root.querySelectorAll("li")];
1547
+ for (const item2 of items) if (item2.closest("main") && !inert(item2)) giveLine(item2, flows);
1548
+ }
1549
+ function spaceIn(root, flows) {
1550
+ for (const element of inlineItems(root)) {
1551
+ if (inert(element)) continue;
1552
+ spaceAround(element);
1553
+ if (element.matches(".doc-math-inline, .katex")) tieClosing(element);
1554
+ }
1555
+ for (const html of [root, ...root.querySelectorAll(".katex-html")]) if (html.matches(".katex-html") && html.closest(".doc-math-tie")) breakBetweenBoxes(html);
1556
+ holdIn(root);
1557
+ keepLines(root, flows);
1558
+ }
1559
+ function startSpacing(document2, flows) {
1560
+ const run = () => spaceIn(document2.body, flows);
1561
+ if (document2.readyState === "loading") document2.addEventListener("DOMContentLoaded", run, { once: true });
1562
+ else run();
1563
+ new MutationObserver((records) => {
1564
+ for (const record of records) for (const node of record.addedNodes) if (node.nodeType === 1 && node.isConnected) spaceIn(node, flows);
1565
+ }).observe(document2.documentElement, { childList: true, subtree: true });
1566
+ }
1567
+
1568
+ // src/shared/zoom.mjs
1569
+ var ZOOM_SKIP = [
1570
+ "a[href]",
1571
+ "button",
1572
+ "summary",
1573
+ "label",
1574
+ "select",
1575
+ "[role=button]",
1576
+ "[role=link]",
1577
+ "[role=tab]",
1578
+ "[data-doc-dialog-open]",
1579
+ ".doc-icon",
1580
+ ".doc-link-mention",
1581
+ ".doc-bookmark",
1582
+ ".doc-file",
1583
+ ".doc-zoom",
1584
+ "[data-doc-dev]"
1585
+ ].join(", ");
1586
+ var ZOOM_PICTURES = ".doc-page img";
1587
+ var ZOOM_MARK = "data-doc-zoom";
1588
+ var ZOOM_LEAST = 48;
1589
+ var loaded = (img) => img.complete && (img.naturalWidth > 0 || /^data:image\/svg|\.svg(?:[?#]|$)/i.test(img.currentSrc || img.src));
1590
+ function zoomable(img) {
1591
+ const holder = img?.hasAttribute?.(ZOOM_MARK) ? img.parentElement : img;
1592
+ if (img?.localName !== "img" || !img.closest(".doc-page") || holder?.closest(ZOOM_SKIP) || holder.matches(INSTANCE) || componentAt(holder) || !loaded(img)) return false;
1593
+ const box = img.getBoundingClientRect();
1594
+ return box.width >= ZOOM_LEAST || box.height >= ZOOM_LEAST;
1595
+ }
1596
+ function zoomCaption(img) {
1597
+ const figure = img.closest("figure");
1598
+ if (!figure || [...figure.querySelectorAll("img")].filter((each) => each.closest("figure") === figure).length !== 1) return null;
1599
+ const caption = figure.querySelector(":scope > figcaption, :scope > .doc-figure-caption");
1600
+ return caption && caption.textContent.trim() ? caption : null;
1601
+ }
1602
+
1603
+ // src/render/kit/runtime/zoom.js
1604
+ var OPEN = "doc-zoom-open";
1605
+ var GUTTER = "doc-zoom-gutter";
1606
+ var HOVER = "doc-zoom-hover";
1607
+ var viewer = null;
1608
+ var editing = (doc) => doc.documentElement.hasAttribute("data-ge-editing");
1609
+ var unmark = (root, ...names) => {
1610
+ root.classList.remove(...names);
1611
+ if (root.classList.length === 0) root.removeAttribute("class");
1612
+ };
1613
+ var printing = (win) => Boolean(win.matchMedia?.("print")?.matches);
1614
+ var KEYED = ["tabindex", "role", "aria-haspopup", "aria-label"];
1615
+ var watched = /* @__PURE__ */ new Set();
1616
+ function judgeZoom(img) {
1617
+ const offered = img.hasAttribute(ZOOM_MARK);
1618
+ if (!offered && KEYED.some((name) => img.hasAttribute(name))) return;
1619
+ if (img.isConnected && !editing(img.ownerDocument) && zoomable(img)) {
1620
+ const alt = img.getAttribute("alt")?.trim();
1621
+ const label = alt ? sayRuntime("open-image-named", alt) : sayRuntime("open-image");
1622
+ if (!offered) {
1623
+ img.setAttribute(ZOOM_MARK, "");
1624
+ img.setAttribute("tabindex", "0");
1625
+ img.setAttribute("role", "button");
1626
+ img.setAttribute("aria-haspopup", "dialog");
1627
+ }
1628
+ if (img.getAttribute("aria-label") !== label) img.setAttribute("aria-label", label);
1629
+ } else if (offered) {
1630
+ for (const name of [ZOOM_MARK, ...KEYED]) img.removeAttribute(name);
1631
+ }
1632
+ }
1633
+ function watchZoom(img, context2) {
1634
+ watched.add(img);
1635
+ const again = () => judgeZoom(img);
1636
+ img.addEventListener("load", again, { signal: context2.signal });
1637
+ again();
1638
+ return { update: again, destroy: () => watched.delete(img) };
1639
+ }
1640
+ function zoomFit({ natural, shown: shown2, window: room, caption = 0 }) {
1641
+ const gap = room.width >= 1020 ? 48 : 16;
1642
+ const width = Math.max(1, room.width - 2 * gap);
1643
+ const height = Math.max(1, room.height - 2 * gap - (caption > 0 ? caption + 12 : 0));
1644
+ if (!(natural.width > 0 && natural.height > 0)) {
1645
+ const ratio = shown2.width > 0 && shown2.height > 0 ? shown2.width / shown2.height : 1;
1646
+ const across2 = Math.min(width, height * ratio);
1647
+ return { width: Math.round(across2), height: Math.round(across2 / ratio) };
1648
+ }
1649
+ const scale = Math.min(1, width / natural.width, height / natural.height);
1650
+ return { width: Math.round(natural.width * scale), height: Math.round(natural.height * scale) };
1651
+ }
1652
+ function openZoom(img) {
1653
+ closeZoom();
1654
+ const doc = img.ownerDocument;
1655
+ const win = doc.defaultView;
1656
+ const root = doc.documentElement;
1657
+ const dialog = doc.createElement("dialog");
1658
+ dialog.className = "doc-zoom";
1659
+ const words = zoomCaption(img);
1660
+ dialog.setAttribute("aria-label", img.getAttribute("alt")?.trim() || words?.textContent.trim() || sayRuntime("view-image"));
1661
+ const picture = doc.createElement("img");
1662
+ picture.className = "doc-zoom-picture";
1663
+ picture.alt = img.getAttribute("alt") ?? "";
1664
+ picture.draggable = false;
1665
+ for (const name of ["crossorigin", "referrerpolicy"]) if (img.hasAttribute(name)) picture.setAttribute(name, img.getAttribute(name));
1666
+ picture.src = img.currentSrc || img.src;
1667
+ let caption = null;
1668
+ if (words) {
1669
+ caption = doc.createElement("div");
1670
+ caption.className = "doc-zoom-caption";
1671
+ for (const node of words.childNodes) caption.append(node.cloneNode(true));
1672
+ caption.querySelectorAll("[id]").forEach((node) => node.removeAttribute("id"));
1673
+ }
1674
+ const close = doc.createElement("button");
1675
+ close.type = "button";
1676
+ close.className = "doc-zoom-close";
1677
+ close.setAttribute("aria-label", sayRuntime("close"));
1678
+ dialog.tabIndex = -1;
1679
+ dialog.append(picture, ...caption ? [caption] : [], close);
1680
+ const v = { dialog, picture, caption, from: img, focus: doc.activeElement, keys: null, fit: null };
1681
+ viewer = v;
1682
+ v.fit = () => {
1683
+ const box = img.getBoundingClientRect();
1684
+ const size = zoomFit({
1685
+ natural: { width: picture.naturalWidth, height: picture.naturalHeight },
1686
+ shown: { width: box.width, height: box.height },
1687
+ window: { width: win.innerWidth, height: win.innerHeight },
1688
+ caption: caption ? caption.offsetHeight : 0
1689
+ });
1690
+ picture.style.width = `${size.width}px`;
1691
+ picture.style.height = `${size.height}px`;
1692
+ };
1693
+ v.keys = (event) => {
1694
+ if (event.key !== "Escape" || event.isComposing) return;
1695
+ event.preventDefault();
1696
+ event.stopPropagation();
1697
+ closeZoom();
1698
+ };
1699
+ dialog.addEventListener("click", (event) => {
1700
+ if (event.target === picture || event.target.closest?.(".doc-zoom-caption a[href]")) return;
1701
+ closeZoom();
1702
+ });
1703
+ dialog.addEventListener("close", () => finish(v));
1704
+ picture.addEventListener("load", v.fit);
1705
+ win.addEventListener("keydown", v.keys, true);
1706
+ win.addEventListener("resize", v.fit);
1707
+ const scrollbar = win.innerWidth - root.clientWidth > 0;
1708
+ unmark(root, HOVER);
1709
+ root.classList.add(OPEN);
1710
+ if (scrollbar) root.classList.add(GUTTER);
1711
+ doc.body.append(dialog);
1712
+ if (typeof dialog.showModal === "function") dialog.showModal();
1713
+ else dialog.setAttribute("open", "");
1714
+ dialog.focus({ preventScroll: true });
1715
+ v.fit();
1716
+ return dialog;
1717
+ }
1718
+ function closeZoom() {
1719
+ const v = viewer;
1720
+ if (!v) return;
1721
+ if (v.dialog.open && typeof v.dialog.close === "function") v.dialog.close();
1722
+ else finish(v);
1723
+ }
1724
+ function finish(v) {
1725
+ if (viewer !== v) return;
1726
+ viewer = null;
1727
+ const doc = v.dialog.ownerDocument;
1728
+ const win = doc.defaultView;
1729
+ win?.removeEventListener("keydown", v.keys, true);
1730
+ win?.removeEventListener("resize", v.fit);
1731
+ v.dialog.remove();
1732
+ unmark(doc.documentElement, OPEN, GUTTER);
1733
+ const back = v.focus;
1734
+ if (back && back !== doc.body && back.isConnected && typeof back.focus === "function") back.focus({ preventScroll: true });
1735
+ }
1736
+ function startZoom(doc) {
1737
+ const win = doc.defaultView;
1738
+ const root = doc.documentElement;
1739
+ doc.addEventListener("click", (event) => {
1740
+ if (event.defaultPrevented || event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
1741
+ const img = event.target;
1742
+ if (img?.localName !== "img" || editing(doc) || printing(win) || !zoomable(img)) return;
1743
+ event.preventDefault();
1744
+ openZoom(img);
1745
+ });
1746
+ doc.addEventListener("keydown", (event) => {
1747
+ if (event.defaultPrevented || event.isComposing || event.repeat || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
1748
+ if (event.key !== "Enter" && event.key !== " ") return;
1749
+ const img = event.target;
1750
+ if (img?.localName !== "img" || !img.hasAttribute(ZOOM_MARK) || viewer || editing(doc) || printing(win) || !zoomable(img)) return;
1751
+ event.preventDefault();
1752
+ openZoom(img);
1753
+ });
1754
+ new win.MutationObserver(() => watched.forEach(judgeZoom)).observe(root, { attributes: true, attributeFilter: ["data-ge-editing"] });
1755
+ doc.addEventListener("pointerover", (event) => {
1756
+ const img = event.target;
1757
+ if (img?.localName === "img" && !viewer && !editing(doc) && zoomable(img)) root.classList.add(HOVER);
1758
+ });
1759
+ doc.addEventListener("pointerout", (event) => {
1760
+ if (event.target?.localName === "img" && root.classList.contains(HOVER)) unmark(root, HOVER);
1761
+ });
1762
+ win.addEventListener("beforeprint", () => closeZoom());
1763
+ }
1764
+
1765
+ // src/render/kit/runtime/index.js
1766
+ if (!globalThis.DocKit) {
1767
+ const kit = createKit({ descriptions: new Map(define_COMPONENT_RUNTIME_default.map((component) => [component.id, component])) });
1768
+ const { store, bindControl, bindShow, CONTROLS: CONTROLS3 } = createBindings();
1769
+ kit.component({ id: "bind", selector: CONTROLS3, mount: (element, context2) => bindControl(element, context2) });
1770
+ kit.component({ id: "show", selector: "[data-doc-show]", mount: (element) => bindShow(element) });
1771
+ kit.component({ id: "embed", mount: (figure) => showEmbed(figure), dehydrate: (figure) => dehydrateEmbed(figure) });
1772
+ kit.component({ id: "flowchart", selector: FLOWCHART, on: ["resize", "fonts", "content", "layout"], mount: (list2, context2) => startFlowchart(list2, context2), dehydrate: (list2) => dehydrateFlowchart(list2) });
1773
+ globalThis.DocKit = Object.freeze({ ...kit, bindings: store, flows: define_COMPONENT_FLOWS_default, reveal });
1774
+ globalThis.ReportKit = globalThis.DocKit;
1775
+ globalThis.DocKit.component({ id: "range", selector: ".doc-range", added: false, mount: () => null, dehydrate: untie });
1776
+ globalThis.DocKit.component({ id: "long-run", selector: ".doc-long-run", added: false, mount: () => null, dehydrate: untie });
1777
+ startSpacing(document, ".doc-page, .doc-section, .doc-summary, .doc-panel, .doc-callout, .doc-details-content, .doc-dialog-content, [data-doc-sheet], .doc-column, [data-doc-slot], :is(.doc-section, .doc-summary, .doc-panel, .doc-callout, .doc-details-content, .doc-dialog-content, .doc-column, [data-doc-slot]) > div:not([class])");
1778
+ startZoom(document);
1779
+ globalThis.DocKit.component({ id: "zoom", selector: ZOOM_PICTURES, on: ["resize", "reveal"], mount: (img, context2) => watchZoom(img, context2) });
1780
+ startBlockLinks(document);
1781
+ }
1782
+ })();