@heycys/gallery 0.0.0-stage → 0.1.0

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