@heycys/gallery 0.1.1 → 0.2.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.
- package/THIRD-PARTY-NOTICES.md +2 -2
- package/browser/editor/components/align.mjs +58 -0
- package/browser/editor/components/code/index.mjs +1 -1
- package/browser/editor/components/columns/page.mjs +4 -4
- package/browser/editor/components/embed/index.mjs +2 -2
- package/browser/editor/components/embed/page.mjs +1 -1
- package/browser/editor/components/file/page.mjs +4 -4
- package/browser/editor/components/flowchart/add.mjs +7 -6
- package/browser/editor/components/flowchart/page.mjs +1 -1
- package/browser/editor/components/heading/index.mjs +7 -6
- package/browser/editor/components/icons.mjs +11 -0
- package/browser/editor/components/image/crop.mjs +6 -9
- package/browser/editor/components/image/index.mjs +2 -0
- package/browser/editor/components/image/page.mjs +172 -90
- package/browser/editor/components/installed/index.mjs +15 -4
- package/browser/editor/components/installed/page.mjs +103 -25
- package/browser/editor/components/installed/served.mjs +6 -5
- package/browser/editor/components/instances.mjs +18 -0
- package/browser/editor/components/list/page.mjs +3 -6
- package/browser/editor/components/media/icons.mjs +13 -8
- package/browser/editor/components/media/page.mjs +5 -3
- package/browser/editor/components/media/toolbar.mjs +12 -3
- package/browser/editor/components/paragraph/index.mjs +4 -3
- package/browser/editor/components/registry.mjs +30 -9
- package/browser/editor/components/table/index.mjs +61 -2
- package/browser/editor/components/table/page.mjs +1 -1
- package/browser/editor/page/after/index.mjs +288 -0
- package/browser/editor/page/align.mjs +91 -0
- package/browser/editor/page/annotate/card.mjs +3 -6
- package/browser/editor/page/autosave.mjs +310 -37
- package/browser/editor/page/beside.mjs +5 -6
- package/browser/editor/page/block-menu/index.mjs +6 -3
- package/browser/editor/page/blocks.mjs +3 -1
- package/browser/editor/page/board/client.mjs +57 -0
- package/browser/editor/page/board/hint.mjs +182 -0
- package/browser/editor/page/board/history.mjs +119 -0
- package/browser/editor/page/board/index.mjs +1059 -0
- package/browser/editor/page/board/motion.mjs +177 -0
- package/browser/editor/page/board/settings.mjs +210 -0
- package/browser/editor/page/caret.mjs +1 -1
- package/browser/editor/page/changes/bar.mjs +6 -14
- package/browser/editor/page/changes/index.mjs +2 -2
- package/browser/editor/page/clipboard/import/html.mjs +29 -6
- package/browser/editor/page/clipboard/import/inline.mjs +32 -0
- package/browser/editor/page/clipboard/import/markdown.mjs +58 -13
- package/browser/editor/page/clipboard/import/read.mjs +6 -1
- package/browser/editor/page/clipboard/import/to-blocks.mjs +44 -12
- package/browser/editor/page/clipboard/import/yuque.mjs +622 -0
- package/browser/editor/page/clipboard/index.mjs +133 -15
- package/browser/editor/page/clipboard/own/blocks.mjs +13 -14
- package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
- package/browser/editor/page/clipboard/own/describe.mjs +6 -2
- package/browser/editor/page/clipboard/own/selection.mjs +1 -1
- package/browser/editor/page/columns/index.mjs +48 -46
- package/browser/editor/page/commit.mjs +80 -22
- package/browser/editor/page/conflicts.mjs +7 -7
- package/browser/editor/page/core.mjs +34 -16
- package/browser/editor/page/custom-page.mjs +110 -0
- package/browser/editor/page/editor.mjs +71 -17
- package/browser/editor/page/emoji-picker/styles.mjs +7 -12
- package/browser/editor/page/emoji-picker/upload.mjs +2 -2
- package/browser/editor/page/handle/index.mjs +5 -8
- package/browser/editor/page/history.mjs +41 -6
- package/browser/editor/page/insert/index.mjs +20 -22
- package/browser/editor/page/links/index.mjs +5 -3
- package/browser/editor/page/links/pages.mjs +27 -9
- package/browser/editor/page/look.mjs +54 -3
- package/browser/editor/page/margin.mjs +18 -3
- package/browser/editor/page/media-menu/index.mjs +6 -7
- package/browser/editor/page/menu.mjs +33 -14
- package/browser/editor/page/notices.mjs +2 -2
- package/browser/editor/page/page-objects.mjs +9 -2
- package/browser/editor/page/panel.mjs +4 -9
- package/browser/editor/page/present-links.mjs +15 -5
- package/browser/editor/page/present-shell.mjs +63 -0
- package/browser/editor/page/resize/index.mjs +42 -29
- package/browser/editor/page/selection/index.mjs +10 -2
- package/browser/editor/page/served.mjs +14 -0
- package/browser/editor/page/session.mjs +48 -4
- package/browser/editor/page/slash-menu/index.mjs +3 -3
- package/browser/editor/page/table/binding.mjs +87 -0
- package/browser/editor/page/table/cells.mjs +102 -46
- package/browser/editor/page/table/index.mjs +24 -9
- package/browser/editor/page/table/pictures.mjs +299 -0
- package/browser/editor/page/table/views.mjs +103 -0
- package/browser/editor/page/table/widths.mjs +82 -10
- package/browser/editor/page/text-select/index.mjs +26 -12
- package/browser/editor/page/todo-writes.mjs +75 -0
- package/browser/editor/page/typing/index.mjs +97 -15
- package/browser/editor/page/typing/leave.mjs +19 -5
- package/browser/editor/page/ui.mjs +13 -0
- package/browser/shared/block-packs.mjs +419 -0
- package/browser/shared/board-places.mjs +224 -0
- package/browser/shared/card-size.mjs +59 -0
- package/browser/shared/colors.mjs +3 -2
- package/browser/shared/component-catalog.mjs +330 -46
- package/browser/shared/component-source.mjs +39 -0
- package/browser/shared/components/heading.mjs +2 -1
- package/browser/shared/components/index.mjs +12 -3
- package/browser/shared/components/installed.mjs +35 -3
- package/browser/shared/components/page.mjs +20 -8
- package/browser/shared/components/paragraph.mjs +8 -1
- package/browser/shared/components/state.mjs +5 -1
- package/browser/shared/components/table.mjs +1 -0
- package/browser/shared/document-look.mjs +10 -5
- package/browser/shared/drafts.mjs +432 -0
- package/browser/shared/emoji/line-icons.mjs +37 -0
- package/browser/shared/extension-sidebar.mjs +126 -0
- package/browser/shared/extensions.mjs +79 -0
- package/browser/shared/file-table.mjs +101 -0
- package/browser/shared/http.mjs +9 -0
- package/browser/shared/i18n/en.mjs +330 -27
- package/browser/shared/json-layout.mjs +47 -0
- package/browser/shared/net-cache.mjs +133 -0
- package/browser/shared/net-keys.mjs +32 -0
- package/browser/shared/net-policy.mjs +177 -0
- package/browser/shared/outline-shape.mjs +128 -0
- package/browser/shared/outline.mjs +359 -67
- package/browser/shared/pack-manifest.mjs +88 -0
- package/browser/shared/page-address.mjs +6 -3
- package/browser/shared/page-cards.mjs +308 -0
- package/browser/shared/page-links.mjs +69 -6
- package/browser/shared/pages.mjs +500 -0
- package/browser/shared/paths.mjs +6 -0
- package/browser/shared/pinyin.mjs +92 -0
- package/browser/shared/present-step.mjs +17 -0
- package/browser/shared/preview-server.mjs +3 -7
- package/browser/shared/session.mjs +8 -1
- package/browser/shared/shipped-blocks.mjs +299 -0
- package/browser/shared/sidebar-head.mjs +70 -0
- package/browser/shared/table-chart.mjs +33 -1
- package/browser/shared/todos.mjs +83 -0
- package/browser/shared/user-directory.mjs +24 -0
- package/browser/shared/versions.mjs +14 -0
- package/browser/shared/web-links.mjs +139 -0
- package/browser/shared/workspace-columns.mjs +120 -0
- package/browser/shared/workspace-name.mjs +154 -0
- package/browser/shared/workspace-query.mjs +125 -0
- package/browser/shared/workspace-registry.mjs +272 -0
- package/browser/shared/workspace.mjs +171 -20
- package/dist/chunk-2OHANJ6Q.mjs +2 -0
- package/dist/chunk-3MBRL2PM.mjs +16 -0
- package/dist/chunk-4OKWZY5E.mjs +2 -0
- package/dist/chunk-4OZWXZE5.mjs +5 -0
- package/dist/chunk-5K44HLTZ.mjs +2 -0
- package/dist/{chunk-5ZKJ3H4P.mjs → chunk-5XA2ZBAE.mjs} +3 -3
- package/dist/{chunk-4FS7Z7WR.mjs → chunk-67N2QJYT.mjs} +1 -1
- package/dist/chunk-6KBYRA2C.mjs +2 -0
- package/dist/chunk-6N3PX4XX.mjs +8 -0
- package/dist/{chunk-V5JTW2LH.mjs → chunk-6QBHU4DF.mjs} +1 -1
- package/dist/chunk-7JDX4E65.mjs +13 -0
- package/dist/chunk-7M2BQQGZ.mjs +2 -0
- package/dist/chunk-7OG26PGF.mjs +2 -0
- package/dist/chunk-AHN3NFKJ.mjs +3 -0
- package/dist/chunk-ALZ6ZENZ.mjs +3 -0
- package/dist/chunk-AR5D57ZD.mjs +170 -0
- package/dist/{chunk-W3BGBJQW.mjs → chunk-BFJGHSQN.mjs} +1 -1
- package/dist/{chunk-LS4F7JUM.mjs → chunk-BZ5RAF7L.mjs} +1 -1
- package/dist/chunk-CMA72MAG.mjs +2 -0
- package/dist/{chunk-LCTHTZIL.mjs → chunk-DAZL73VK.mjs} +91 -91
- package/dist/{chunk-Y6RLRPG3.mjs → chunk-DJISHPUL.mjs} +1 -1
- package/dist/chunk-DR73Y2UJ.mjs +3 -0
- package/dist/{chunk-FDLXYYG4.mjs → chunk-EAIFITAV.mjs} +1 -1
- package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
- package/dist/chunk-EP25HDAJ.mjs +2 -0
- package/dist/{chunk-GB5SOYQJ.mjs → chunk-ERLAIBOA.mjs} +2 -2
- package/dist/chunk-EURLTOTZ.mjs +4 -0
- package/dist/chunk-F4ZA6JRZ.mjs +3 -0
- package/dist/chunk-F6HVDZR4.mjs +2 -0
- package/dist/chunk-FDMAXMQA.mjs +2 -0
- package/dist/chunk-FETSREUN.mjs +5 -0
- package/dist/chunk-GHOYKMQ3.mjs +4 -0
- package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
- package/dist/chunk-HDWTZ763.mjs +12 -0
- package/dist/chunk-HPOI4ZX7.mjs +6 -0
- package/dist/{chunk-BGGDRNYQ.mjs → chunk-HXG7EOPJ.mjs} +1 -1
- package/dist/chunk-IA4PSIMD.mjs +2 -0
- package/dist/{chunk-E7LWZRXY.mjs → chunk-ITOH5EGO.mjs} +1 -1
- package/dist/chunk-IV64FFI4.mjs +2 -0
- package/dist/chunk-J43Z6LSS.mjs +2 -0
- package/dist/chunk-J5PUIV3Y.mjs +4 -0
- package/dist/chunk-JA7G53PC.mjs +2 -0
- package/dist/chunk-JEUK3ZO7.mjs +2 -0
- package/dist/chunk-JLTZF4LA.mjs +2 -0
- package/dist/chunk-JZT7I2OJ.mjs +2 -0
- package/dist/chunk-K5XATEOO.mjs +2 -0
- package/dist/chunk-L2SUIS5S.mjs +2 -0
- package/dist/chunk-L7UP52JO.mjs +2 -0
- package/dist/chunk-LM4XFQHZ.mjs +2 -0
- package/dist/chunk-MN7BZL4R.mjs +2 -0
- package/dist/chunk-MTYYHM2G.mjs +15 -0
- package/dist/chunk-MXUBKDRO.mjs +15 -0
- package/dist/chunk-NAMN3RAF.mjs +2 -0
- package/dist/{chunk-SYGN7GLU.mjs → chunk-OEXWRJME.mjs} +1 -1
- package/dist/chunk-OFHXGWOX.mjs +2 -0
- package/dist/chunk-ORID3AE7.mjs +166 -0
- package/dist/chunk-PAREWQGB.mjs +4 -0
- package/dist/chunk-PGDE24N5.mjs +2 -0
- package/dist/chunk-POTA2FV4.mjs +2 -0
- package/dist/chunk-PUOQ65NC.mjs +2 -0
- package/dist/chunk-Q4UEPUWF.mjs +2 -0
- package/dist/chunk-QE5RG76S.mjs +549 -0
- package/dist/chunk-R2ZDLJYT.mjs +10 -0
- package/dist/{chunk-7DTINW6U.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
- package/dist/chunk-SWUTTZCN.mjs +2 -0
- package/dist/chunk-TANZRINB.mjs +2 -0
- package/dist/chunk-TR7TWGHB.mjs +2 -0
- package/dist/chunk-U5XL7D6A.mjs +3 -0
- package/dist/{chunk-XNROSH2T.mjs → chunk-U7NZI6N4.mjs} +2 -2
- package/dist/chunk-UGWMMEJ5.mjs +15 -0
- package/dist/chunk-UJQJKNGK.mjs +2 -0
- package/dist/chunk-UYVCQK3H.mjs +22 -0
- package/dist/chunk-VFX2KNHP.mjs +4 -0
- package/dist/chunk-VS7JIGJW.mjs +24 -0
- package/dist/chunk-W7665ZEC.mjs +6 -0
- package/dist/chunk-WQDQWCX5.mjs +2 -0
- package/dist/chunk-YI43RG4P.mjs +2 -0
- package/dist/chunk-YLPSMDIS.mjs +5 -0
- package/dist/chunk-YNAWBAYN.mjs +3 -0
- package/dist/chunk-YROX2O22.mjs +2 -0
- package/dist/chunk-ZDLPUOAG.mjs +6 -0
- package/dist/{chunk-IVDLMMBD.mjs → chunk-ZHEHPMBK.mjs} +1 -1
- package/dist/chunk-ZQS6H473.mjs +16 -0
- package/dist/chunk-ZTHICSSF.mjs +2 -0
- package/dist/chunk-ZWWC4KLF.mjs +20 -0
- package/dist/cli.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{chunk-U6KNPJPR.mjs → update-fetch.mjs} +1 -1
- package/dist/worker.mjs +1 -1
- package/kit/board.css +95 -0
- package/kit/board.js +250 -0
- package/kit/charts.js +5 -71
- package/kit/code.js +17 -17
- package/kit/report.css +335 -18
- package/kit/runtime.js +1638 -125
- package/kit/state.js +10 -1
- package/kit/tables.js +130 -43
- package/kit/ui.js +79 -35
- package/package.json +2 -1
- package/packs/gallery/card/component.json +14 -0
- package/packs/gallery/card/example.html +10 -0
- package/packs/gallery/card/preview.svg +1 -0
- package/packs/gallery/card/style.css +6 -0
- package/packs/gallery/card/template.html +6 -0
- package/packs/gallery/card/writing.md +14 -0
- package/packs/gallery/chart-card/component.json +15 -0
- package/packs/gallery/chart-card/example.html +14 -0
- package/packs/gallery/chart-card/kit.js +130 -0
- package/packs/gallery/chart-card/preview.svg +1 -0
- package/packs/gallery/chart-card/style.css +42 -0
- package/packs/gallery/chart-card/template.html +13 -0
- package/packs/gallery/chart-card/writing.md +20 -0
- package/packs/gallery/chart-view/component.json +20 -0
- package/packs/gallery/chart-view/example.html +13 -0
- package/packs/gallery/chart-view/kit.js +355 -0
- package/packs/gallery/chart-view/preview.svg +1 -0
- package/packs/gallery/chart-view/style.css +94 -0
- package/packs/gallery/chart-view/template.html +3 -0
- package/packs/gallery/chart-view/writing.md +22 -0
- package/packs/gallery/countdown/component.json +18 -0
- package/packs/gallery/countdown/example.html +3 -0
- package/packs/gallery/countdown/kit.js +216 -0
- package/packs/gallery/countdown/preview.svg +1 -0
- package/packs/gallery/countdown/style.css +118 -0
- package/packs/gallery/countdown/template.html +3 -0
- package/packs/gallery/countdown/writing.md +22 -0
- package/packs/gallery/habit/component.json +14 -0
- package/packs/gallery/habit/example.html +3 -0
- package/packs/gallery/habit/kit.js +334 -0
- package/packs/gallery/habit/preview.svg +1 -0
- package/packs/gallery/habit/style.css +174 -0
- package/packs/gallery/habit/template.html +3 -0
- package/packs/gallery/habit/writing.md +21 -0
- package/packs/gallery/heatmap/component.json +18 -0
- package/packs/gallery/heatmap/example.html +3 -0
- package/packs/gallery/heatmap/kit.js +513 -0
- package/packs/gallery/heatmap/preview.svg +1 -0
- package/packs/gallery/heatmap/style.css +189 -0
- package/packs/gallery/heatmap/template.html +3 -0
- package/packs/gallery/heatmap/writing.md +21 -0
- package/packs/gallery/kanban/component.json +18 -0
- package/packs/gallery/kanban/example.html +12 -0
- package/packs/gallery/kanban/kit.js +540 -0
- package/packs/gallery/kanban/preview.svg +1 -0
- package/packs/gallery/kanban/style.css +212 -0
- package/packs/gallery/kanban/template.html +3 -0
- package/packs/gallery/kanban/writing.md +20 -0
- package/packs/gallery/metric/component.json +22 -0
- package/packs/gallery/metric/example.html +15 -0
- package/packs/gallery/metric/kit.js +248 -0
- package/packs/gallery/metric/preview.svg +1 -0
- package/packs/gallery/metric/style.css +92 -0
- package/packs/gallery/metric/template.html +3 -0
- package/packs/gallery/metric/writing.md +23 -0
- package/packs/gallery/note/component.json +14 -0
- package/packs/gallery/note/example.html +3 -0
- package/packs/gallery/note/kit.js +129 -0
- package/packs/gallery/note/preview.svg +1 -0
- package/packs/gallery/note/style.css +97 -0
- package/packs/gallery/note/template.html +3 -0
- package/packs/gallery/note/writing.md +18 -0
- package/packs/gallery/pack.json +8 -0
- package/packs/gallery/recent/component.json +13 -0
- package/packs/gallery/recent/example.html +1 -0
- package/packs/gallery/recent/kit.js +293 -0
- package/packs/gallery/recent/preview.svg +1 -0
- package/packs/gallery/recent/style.css +85 -0
- package/packs/gallery/recent/template.html +1 -0
- package/packs/gallery/recent/writing.md +15 -0
- package/packs/gallery/static/component.json +13 -0
- package/packs/gallery/static/example.html +11 -0
- package/packs/gallery/static/preview.svg +1 -0
- package/packs/gallery/static/style.css +171 -0
- package/packs/gallery/static/template.html +1 -0
- package/packs/gallery/static/writing.md +18 -0
- package/packs/gallery/stats/component.json +13 -0
- package/packs/gallery/stats/example.html +1 -0
- package/packs/gallery/stats/kit.js +347 -0
- package/packs/gallery/stats/preview.svg +1 -0
- package/packs/gallery/stats/style.css +73 -0
- package/packs/gallery/stats/template.html +1 -0
- package/packs/gallery/stats/writing.md +11 -0
- package/packs/gallery/today/component.json +12 -0
- package/packs/gallery/today/example.html +1 -0
- package/packs/gallery/today/kit.js +220 -0
- package/packs/gallery/today/preview.svg +1 -0
- package/packs/gallery/today/style.css +149 -0
- package/packs/gallery/today/template.html +1 -0
- package/packs/gallery/today/writing.md +14 -0
- package/packs/gallery/todos/component.json +19 -0
- package/packs/gallery/todos/example.html +3 -0
- package/packs/gallery/todos/kit.js +489 -0
- package/packs/gallery/todos/preview.svg +1 -0
- package/packs/gallery/todos/style.css +214 -0
- package/packs/gallery/todos/template.html +3 -0
- package/packs/gallery/todos/writing.md +30 -0
- package/packs/gallery/weather/component.json +19 -0
- package/packs/gallery/weather/example.html +3 -0
- package/packs/gallery/weather/kit.js +387 -0
- package/packs/gallery/weather/preview.svg +1 -0
- package/packs/gallery/weather/style.css +140 -0
- package/packs/gallery/weather/template.html +3 -0
- package/packs/gallery/weather/writing.md +26 -0
- package/packs/gallery-soft/countdown/component.json +18 -0
- package/packs/gallery-soft/countdown/example.html +3 -0
- package/packs/gallery-soft/countdown/kit.js +206 -0
- package/packs/gallery-soft/countdown/preview.svg +1 -0
- package/packs/gallery-soft/countdown/style.css +211 -0
- package/packs/gallery-soft/countdown/template.html +3 -0
- package/packs/gallery-soft/countdown/writing.md +24 -0
- package/packs/gallery-soft/habit/component.json +14 -0
- package/packs/gallery-soft/habit/example.html +3 -0
- package/packs/gallery-soft/habit/kit.js +366 -0
- package/packs/gallery-soft/habit/preview.svg +1 -0
- package/packs/gallery-soft/habit/style.css +251 -0
- package/packs/gallery-soft/habit/template.html +3 -0
- package/packs/gallery-soft/habit/writing.md +23 -0
- package/packs/gallery-soft/heatmap/component.json +18 -0
- package/packs/gallery-soft/heatmap/example.html +3 -0
- package/packs/gallery-soft/heatmap/kit.js +498 -0
- package/packs/gallery-soft/heatmap/preview.svg +1 -0
- package/packs/gallery-soft/heatmap/style.css +181 -0
- package/packs/gallery-soft/heatmap/template.html +3 -0
- package/packs/gallery-soft/heatmap/writing.md +23 -0
- package/packs/gallery-soft/note/component.json +14 -0
- package/packs/gallery-soft/note/example.html +3 -0
- package/packs/gallery-soft/note/kit.js +162 -0
- package/packs/gallery-soft/note/preview.svg +1 -0
- package/packs/gallery-soft/note/style.css +148 -0
- package/packs/gallery-soft/note/template.html +3 -0
- package/packs/gallery-soft/note/writing.md +20 -0
- package/packs/gallery-soft/pack.json +8 -0
- package/packs/gallery-soft/recent/component.json +13 -0
- package/packs/gallery-soft/recent/example.html +1 -0
- package/packs/gallery-soft/recent/kit.js +335 -0
- package/packs/gallery-soft/recent/preview.svg +1 -0
- package/packs/gallery-soft/recent/style.css +160 -0
- package/packs/gallery-soft/recent/template.html +1 -0
- package/packs/gallery-soft/recent/writing.md +17 -0
- package/packs/gallery-soft/static/component.json +13 -0
- package/packs/gallery-soft/static/example.html +12 -0
- package/packs/gallery-soft/static/preview.svg +1 -0
- package/packs/gallery-soft/static/style.css +186 -0
- package/packs/gallery-soft/static/template.html +1 -0
- package/packs/gallery-soft/static/writing.md +20 -0
- package/packs/gallery-soft/stats/component.json +13 -0
- package/packs/gallery-soft/stats/example.html +1 -0
- package/packs/gallery-soft/stats/kit.js +341 -0
- package/packs/gallery-soft/stats/preview.svg +1 -0
- package/packs/gallery-soft/stats/style.css +119 -0
- package/packs/gallery-soft/stats/template.html +1 -0
- package/packs/gallery-soft/stats/writing.md +13 -0
- package/packs/gallery-soft/today/component.json +12 -0
- package/packs/gallery-soft/today/example.html +1 -0
- package/packs/gallery-soft/today/kit.js +222 -0
- package/packs/gallery-soft/today/preview.svg +1 -0
- package/packs/gallery-soft/today/style.css +178 -0
- package/packs/gallery-soft/today/template.html +1 -0
- package/packs/gallery-soft/today/writing.md +16 -0
- package/packs/gallery-soft/todos/component.json +19 -0
- package/packs/gallery-soft/todos/example.html +3 -0
- package/packs/gallery-soft/todos/kit.js +527 -0
- package/packs/gallery-soft/todos/preview.svg +1 -0
- package/packs/gallery-soft/todos/style.css +212 -0
- package/packs/gallery-soft/todos/template.html +3 -0
- package/packs/gallery-soft/todos/writing.md +32 -0
- package/packs/gallery-soft/weather/component.json +19 -0
- package/packs/gallery-soft/weather/example.html +3 -0
- package/packs/gallery-soft/weather/kit.js +411 -0
- package/packs/gallery-soft/weather/preview.svg +1 -0
- package/packs/gallery-soft/weather/style.css +185 -0
- package/packs/gallery-soft/weather/template.html +3 -0
- package/packs/gallery-soft/weather/writing.md +28 -0
- package/release.json +12 -10
- package/sdk/doc-kit.d.ts +396 -5
- package/sdk/doc-state.d.ts +2 -0
- package/skill/SKILL.md +56 -23
- package/skill/references/block-script.md +140 -0
- package/skill/references/building-blocks.md +257 -0
- package/skill/references/extensions.md +59 -0
- package/skill/references/pages-and-data.md +225 -0
- package/skill/references/writing-html.md +8 -4
- package/skill/sdk/doc-kit.d.ts +396 -5
- package/skill/sdk/doc-state.d.ts +2 -0
- package/web/assets/index-BM_K-Auu.css +1 -0
- package/web/assets/index-DRslOBiv.js +15 -0
- package/web/index.html +2 -2
- package/dist/chunk-3HIRPVLU.mjs +0 -2
- package/dist/chunk-5MHMDLZD.mjs +0 -4
- package/dist/chunk-64K7IPLO.mjs +0 -255
- package/dist/chunk-6QXGZM36.mjs +0 -8
- package/dist/chunk-6RGJOMJP.mjs +0 -16
- package/dist/chunk-AJ73XJF3.mjs +0 -2
- package/dist/chunk-AUZGSZJH.mjs +0 -13
- package/dist/chunk-BFE45AKL.mjs +0 -2
- package/dist/chunk-BXO2ZY5P.mjs +0 -2
- package/dist/chunk-CEH4MRCC.mjs +0 -2
- package/dist/chunk-CY2FNNAB.mjs +0 -16
- package/dist/chunk-DFUDV4LX.mjs +0 -2
- package/dist/chunk-DKXG4XDG.mjs +0 -2
- package/dist/chunk-EZQ34M3F.mjs +0 -124
- package/dist/chunk-EZY3WC6Z.mjs +0 -15
- package/dist/chunk-FUKQNOQS.mjs +0 -9
- package/dist/chunk-JPOSLGOC.mjs +0 -6
- package/dist/chunk-JVHHHGEA.mjs +0 -3
- package/dist/chunk-L3QKH4OK.mjs +0 -26
- package/dist/chunk-LAE5NQ4B.mjs +0 -2
- package/dist/chunk-LEF6DRCK.mjs +0 -59
- package/dist/chunk-NO5NJCHO.mjs +0 -2
- package/dist/chunk-NQPVAU63.mjs +0 -2
- package/dist/chunk-NSKUTQ5J.mjs +0 -5
- package/dist/chunk-O35FIXRB.mjs +0 -2
- package/dist/chunk-P2CAZPDP.mjs +0 -3
- package/dist/chunk-PL6GHLGD.mjs +0 -15
- package/dist/chunk-QJIR2BLP.mjs +0 -6
- package/dist/chunk-QUPLVPB2.mjs +0 -7
- package/dist/chunk-R7BNENLY.mjs +0 -4
- package/dist/chunk-S6O4UHLC.mjs +0 -2
- package/dist/chunk-SGJWQKEI.mjs +0 -2
- package/dist/chunk-TX6JH7TR.mjs +0 -2
- package/dist/chunk-TYK6VNAB.mjs +0 -10
- package/dist/chunk-UALRNVSE.mjs +0 -4
- package/dist/chunk-V3HXVQEM.mjs +0 -2
- package/dist/chunk-V5VXUJKG.mjs +0 -2
- package/dist/chunk-VBXMADMP.mjs +0 -2
- package/dist/chunk-VNV55RUA.mjs +0 -2
- package/dist/chunk-VPD2PS35.mjs +0 -2
- package/dist/chunk-W4VKN3GF.mjs +0 -7
- package/dist/chunk-W5BXXPDJ.mjs +0 -3
- package/dist/chunk-XUNHRCOG.mjs +0 -6
- package/skill/references/building-components.md +0 -367
- package/web/assets/index-Bh74DfsV.css +0 -1
- package/web/assets/index-UW0RyFFt.js +0 -13
package/dist/chunk-EZQ34M3F.mjs
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{b as ht}from"./chunk-NQPVAU63.mjs";import{a as ft,g as ut,h as pt}from"./chunk-DFUDV4LX.mjs";import{k as ke}from"./chunk-Y6RLRPG3.mjs";import{e as ct}from"./chunk-6RGJOMJP.mjs";import{a as dt,b as mt}from"./chunk-QUPLVPB2.mjs";import{a as lt}from"./chunk-LAE5NQ4B.mjs";import{b as tt,c as nt,d as ce,e as ot,f as ye,h as rt,l as at,o as st,p as it}from"./chunk-AUZGSZJH.mjs";import{d as qe,e as ge,f as Re,g as Ae,h as et,k as we}from"./chunk-6QXGZM36.mjs";import{b as He,c as Ge}from"./chunk-UALRNVSE.mjs";import{d as Ke}from"./chunk-JVHHHGEA.mjs";import{a as ue}from"./chunk-L3QKH4OK.mjs";import{a as Je,d as te,g as Xe,h as Ve,l as Ye,m as Ze,r as Qe,s as Fe}from"./chunk-W4VKN3GF.mjs";import Te from"node:fs";import Mo from"node:fs/promises";import No from"node:http";import{editStateDirectory as Wo,kitPublicDirectory as zo,release as Uo,releaseFile as _e,reportsDirectory as Be,vendorDirectory as Bo,workbenchDirectory as Ho}from"../browser/shared/paths.mjs";import{serve as rn}from"../browser/shared/http.mjs";import{ensureWorkspace as Go,layoutOf as Ko}from"../browser/shared/workspace.mjs";import le from"node:fs/promises";import M from"node:path";import{Z as sn}from"../browser/shared/layers.mjs";import{escapeMarkup as De}from"../browser/shared/escape.mjs";import{layoutNotesScript as cn}from"../browser/shared/qa-levels.mjs";var ve=30,ln=`
|
|
3
|
-
[data-doc-dev].doc-checks { position: fixed; z-index: ${sn.checks}; left: 12px; bottom: 12px; max-width: min(520px, calc(100vw - 24px));
|
|
4
|
-
font: 13px/1.5 system-ui, sans-serif; color: light-dark(#37352f, #e3e2e0); }
|
|
5
|
-
[data-doc-dev].doc-checks[hidden] { display: none; }
|
|
6
|
-
[data-doc-dev].doc-checks > summary { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 999px; cursor: pointer;
|
|
7
|
-
list-style: none; color: light-dark(#a1352b, #f19c92); background: light-dark(#fce9e7, #3b2321);
|
|
8
|
-
box-shadow: 0 0 0 1px light-dark(rgb(161 53 43 / 18%), rgb(241 156 146 / 22%)); user-select: none; }
|
|
9
|
-
[data-doc-dev].doc-checks > summary::-webkit-details-marker { display: none; }
|
|
10
|
-
[data-doc-dev].doc-checks > div { margin-top: 6px; padding: 8px 12px; max-height: 50vh; overflow: auto; border-radius: 10px;
|
|
11
|
-
background: light-dark(#ffffff, #252525); box-shadow: 0 0 0 1px light-dark(rgb(42 28 0 / 7%), #383836), 0 20px 24px light-dark(rgb(25 25 25 / 5%), rgb(0 0 0 / 20%)); }
|
|
12
|
-
[data-doc-dev].doc-checks ul { margin: 0; padding-left: 18px; }
|
|
13
|
-
[data-doc-dev].doc-checks li { margin: 2px 0; overflow-wrap: anywhere; }
|
|
14
|
-
[data-doc-dev].doc-checks p { margin: 6px 0 0; color: light-dark(#787774, #9b9a97); }
|
|
15
|
-
[data-doc-dev].doc-checks .doc-checks-live:not(:first-child) { margin-top: 8px; }
|
|
16
|
-
@media print { [data-doc-dev].doc-checks { display: none; } }`,dn=`(() => {
|
|
17
|
-
document.currentScript.remove();
|
|
18
|
-
${cn()}
|
|
19
|
-
const panel = document.querySelector("details.doc-checks[data-doc-dev]");
|
|
20
|
-
if (!panel) return;
|
|
21
|
-
const failures = Number(panel.dataset.failures) || 0;
|
|
22
|
-
const live = panel.querySelector(".doc-checks-live ul");
|
|
23
|
-
// The note's words in the UI's language (the root's data-ge-language).
|
|
24
|
-
const english = document.documentElement.getAttribute("data-ge-language") === "en";
|
|
25
|
-
const WORDS = english
|
|
26
|
-
? { card: "Chart card", table: "Table", named: (kind, name) => kind + " \u201C" + name + "\u201D", first: (name) => "Table (first column \u201C" + name + "\u201D)", colon: ": ",
|
|
27
|
-
failing: (count) => "Checks failed \xB7 " + count, more: (count) => count + " more", all: (slug) => "gallery check " + slug + " runs every check (TypeScript too)." }
|
|
28
|
-
: { card: "\u56FE\u8868\u5361\u7247", table: "\u8868\u683C", named: (kind, name) => kind + "\u300C" + name + "\u300D", first: (name) => "\u8868\u683C\uFF08\u9996\u5217\u300C" + name + "\u300D\uFF09", colon: "\uFF1A",
|
|
29
|
-
failing: (count) => "\u68C0\u67E5\u672A\u901A\u8FC7 \xB7 " + count + " \u9879", more: (count) => "\u8FD8\u6709 " + count + " \u9879", all: (slug) => "gallery check " + slug + " \u8DD1\u5168\u90E8\u68C0\u67E5\uFF08\u542B TypeScript\uFF09\u3002" };
|
|
30
|
-
const more = panel.querySelector("[data-more]");
|
|
31
|
-
if (more) more.textContent = WORDS.more(more.dataset.more);
|
|
32
|
-
const all = panel.querySelector("[data-all]");
|
|
33
|
-
if (all) all.textContent = WORDS.all(all.dataset.all);
|
|
34
|
-
const tidy = (node) => (node?.textContent ?? "").replace(/\\s+/g, " ").trim().slice(0, 40);
|
|
35
|
-
const what = (host) => {
|
|
36
|
-
const card = host.closest("figure");
|
|
37
|
-
const title = card?.querySelector(":scope > h3, :scope > figcaption");
|
|
38
|
-
const table = host.closest(".doc-table-wrap, table");
|
|
39
|
-
const caption = table?.querySelector("caption");
|
|
40
|
-
const header = table?.querySelector("th");
|
|
41
|
-
return title ? WORDS.named(WORDS.card, tidy(title)) : card ? WORDS.card : caption && tidy(caption) ? WORDS.named(WORDS.table, tidy(caption)) : header ? WORDS.first(tidy(header)) : host.localName;
|
|
42
|
-
};
|
|
43
|
-
// A chart that drew nothing says why in its card (the kit's line, in the same language): that line, else the note in words.
|
|
44
|
-
const said = (host, name, note) => (name === "data-missing" && tidy(host.querySelector(".doc-chart-message"))) || noteInWords(note, { english });
|
|
45
|
-
let shown = "";
|
|
46
|
-
let frame = 0;
|
|
47
|
-
const draw = () => {
|
|
48
|
-
frame = 0;
|
|
49
|
-
const notes = [...document.querySelectorAll("[data-doc-layout]")].filter((host) => !host.closest("[data-doc-dev]"))
|
|
50
|
-
.flatMap((host) => layoutNotesOf(host.getAttribute("data-doc-layout"), document.documentElement.clientWidth)
|
|
51
|
-
.filter(({ level }) => level === "fail")
|
|
52
|
-
.map(({ note, name }) => ({ line: what(host) + WORDS.colon + said(host, name, note), note })));
|
|
53
|
-
const key = notes.map(({ line }) => line).join("\\n");
|
|
54
|
-
if (key === shown) return;
|
|
55
|
-
shown = key;
|
|
56
|
-
live.replaceChildren(...notes.map(({ line, note }) => Object.assign(document.createElement("li"), { textContent: line, title: note })));
|
|
57
|
-
live.parentElement.hidden = notes.length === 0;
|
|
58
|
-
const failing = failures + notes.length;
|
|
59
|
-
panel.querySelector("summary").textContent = failing ? WORDS.failing(failing) : "";
|
|
60
|
-
panel.hidden = failing === 0;
|
|
61
|
-
};
|
|
62
|
-
const later = (records) => {
|
|
63
|
-
if (!globalThis.document?.defaultView) return; // the page is gone
|
|
64
|
-
if (!frame && records.some((record) => !record.target.closest?.("[data-doc-dev]"))) frame = requestAnimationFrame(draw);
|
|
65
|
-
};
|
|
66
|
-
new MutationObserver(later).observe(document.documentElement, { subtree: true, childList: true, attributes: true, attributeFilter: ["data-doc-layout"] });
|
|
67
|
-
addEventListener("resize", () => { if (!frame) frame = requestAnimationFrame(draw); });
|
|
68
|
-
draw();
|
|
69
|
-
})();`;function gt(t,n,r={},{directory:c}={}){let s=rt({slug:t,html:n,metadata:r,...c?{directory:c}:{}}),l=s.slice(0,ve).map(w=>`<li>${De(w)}</li>`).join(""),a=s.length>ve?`<p data-more="${s.length-ve}">\u8FD8\u6709 ${s.length-ve} \u9879</p>`:"",p=s.length?`<ul>${l}</ul>${a}<p data-all="${De(t)}">gallery check ${De(t)} \u8DD1\u5168\u90E8\u68C0\u67E5\uFF08\u542B TypeScript\uFF09\u3002</p>`:"";return`<details class="doc-checks" data-doc-dev data-failures="${s.length}"${s.length?"":" hidden"}><summary>${s.length?`\u68C0\u67E5\u672A\u901A\u8FC7 \xB7 ${s.length} \u9879`:""}</summary><div>${p}<div class="doc-checks-live" hidden><ul></ul></div></div><style>${ln}</style></details>
|
|
70
|
-
<script data-doc-dev>${dn}</script>`}import{browserDirectory as fo,editStateDirectory as uo,kitSourceDirectory as Jt,release as po,reportsDirectory as I}from"../browser/shared/paths.mjs";import{sendJson as Mt,serve as Xt,serveFound as de}from"../browser/shared/http.mjs";import{languageScript as ho}from"../browser/shared/i18n/index.mjs";import{announcePreviewServer as go,galleryVersion as wo}from"../browser/shared/preview-server.mjs";import{lookWord as Nt}from"../browser/shared/document-look.mjs";import{documentLook as Wt,ownLookAt as yo}from"../browser/shared/workspace-look.mjs";import{slugPattern as Vt}from"../browser/shared/reports.mjs";import{ATTRIBUTE as zt,PACKAGE_ID as ko}from"../browser/shared/components/installed.mjs";import{COMPONENTS_FOLDER as Ut,WORKSPACE_FILE as ze,documentDirectory as Bt,documentFiles as vo,isDocumentFile as xo,isDocumentSource as Ht,isSlugName as $o,layoutOf as bo}from"../browser/shared/workspace.mjs";import{createHash as Sn,randomBytes as Cn}from"node:crypto";import L from"node:fs";import Le from"node:os";import ee from"node:path";import{Transform as jn}from"node:stream";import{pipeline as On}from"node:stream/promises";import{exportSourceOf as En}from"../browser/shared/export-wrap.mjs";import{writeAtomic as Ie}from"../browser/shared/files.mjs";import{sendJson as D}from"../browser/shared/http.mjs";import{said as Me,saying as Tn}from"../browser/shared/i18n/index.mjs";import{IMPORT_LIMIT as xt}from"../browser/shared/import-types.mjs";import{mediaUrl as _n}from"../browser/shared/media.mjs";import{fullAddress as Pn}from"../browser/shared/page-address.mjs";import{documentLinks as $t,slugPattern as bt}from"../browser/shared/reports.mjs";import{documentDirectory as Fn,documentFiles as St,pageSlug as Rn}from"../browser/shared/workspace.mjs";import{readWritingPreferences as An,saysAnything as Dn,unshownLines as Ln}from"../browser/shared/writing-preferences.mjs";import wt from"node:fs/promises";import yn from"node:path";import{Worker as mn}from"node:worker_threads";import{refusal as fn,said as un}from"../browser/shared/i18n/index.mjs";var pn=6e4,X=null,hn=0,xe=0,re=new Map;function gn(){X=new mn(new URL("./worker.mjs",import.meta.url)),X.on("message",({id:n,result:r,error:c})=>{let s=re.get(n);s&&(re.delete(n),c?s.reject(Object.assign(new Error(c.message),c)):s.resolve(r),re.size===0&&(X?.unref(),wn()))});let t=n=>{for(let r of re.values())r.reject(n);re.clear(),X=null};X.on("error",t),X.on("exit",n=>t(fn(un("\u8F6C\u6362\u8FDB\u7A0B\u610F\u5916\u9000\u51FA\uFF08{0}\uFF09",n))))}function wn(){clearTimeout(xe),xe=setTimeout(()=>{if(re.size===0&&X){let t=X;X=null,t.removeAllListeners("exit"),t.terminate()}},pn),xe.unref?.()}function ne(t,n){clearTimeout(xe),X||gn();let r=++hn;return new Promise((c,s)=>{re.set(r,{resolve:c,reject:s}),X.ref(),X.postMessage({id:r,type:t,payload:n})})}import{pageLanguage as kn}from"../browser/shared/components/page.mjs";function $e(t){return String(t??"").replace(/[\\/:*?"<>|\u0000-\u001f\u007f]/g," ").replace(/\s+/g," ").trim().slice(0,100).trim()||"Untitled"}function be(t,n){let r=t.lastIndexOf("."),[c,s]=r>0?[t.slice(0,r),t.slice(r)]:[t,""];for(let l=0;;l+=1){let a=l===0?t:`${c} ${l}${s}`;if(!n.has(a.toLowerCase()))return n.add(a.toLowerCase()),a}}function Se(t,n){let r=t.split("/").slice(0,-1),c=n.split("/"),s=0;for(;s<r.length&&s<c.length-1&&r[s]===c[s];)s+=1;return[...r.slice(s).map(()=>".."),...c.slice(s)].map(a=>a===".."?a:encodeURIComponent(a).replace(/\(/g,"%28").replace(/\)/g,"%29")).join("/")}import{documentDirectory as vn,documentFiles as xn}from"../browser/shared/workspace.mjs";var yt={markdown:"md",html:"html",pdf:"pdf"},$n={markdown:"text/markdown; charset=utf-8",html:"text/html; charset=utf-8",pdf:"application/pdf"},bn=t=>typeof t=="number"&&t>.1&&t<2;function kt(t){let{format:n,content:r="everything",subpages:c=!1,folders:s=!0,paper:l="A4",scale:a=1}=t??{};return Object.hasOwn(yt,n)&&["everything","no_files"].includes(r)&&typeof c=="boolean"&&typeof s=="boolean"&&["A4","A3","Letter","Legal","Tabloid"].includes(l)&&bn(a)}async function vt(t,n,r){let{format:c,content:s="everything",subpages:l=!1,folders:a=!0,paper:p="A4",scale:g=1}=n,w=yt[c],f=s==="everything",S=[],j=new Map,z=x=>j.get(x)??j.set(x,new Set).get(x),A=async(x,P)=>{let V=await r.titleOf(x),H=be(`${$e(V)}.${w}`,z(P)),G=P?`${P}/${H}`:H,Q=a?G.slice(0,-(w.length+1)):"";if(S.push({slug:x,title:V,file:G,folder:Q,files:P?`${P}/assets`:"assets"}),l)for(let K of await r.childrenOf(x))await A(K,Q)};await A(t,"");let{links:O}=await r.links(),_=(x,P)=>nt(P,x.slug,V=>{let H=c==="pdf"?null:S.find(G=>G.slug===V)?.file??null;return H&&Se(x.file,H)},{blocks:c!=="markdown",links:O}),N=[],U=[];for(let x of S)if(c==="markdown"){await r.check(x.slug);let P=vn(x.slug,r.reportsDirectory),V=ce(await wt.readFile(xn(P).html,"utf8"),{slug:x.slug,mode:"words",reportsDirectory:r.reportsDirectory}),H=_(x,V),G=f&&!!ft(),{text:Q,files:K,charts:ie,charted:oe}=await ne("markdown",{source:H,title:x.title,pictures:G}),Y=Q,Z=new Map;if(K.forEach(({src:d,name:u},k)=>{Z.has(d)||(Z.set(d,`${x.files}/${be($e(u),z(x.files))}`),f&&U.push({from:yn.join(P,d),name:Z.get(d)}));let v=Z.get(d);Y=Y.replace(`\0F${k}\0`,()=>Se(x.file,v))}),G&&ie>0&&Y.includes("\0C")){let d=await pt(await r.offline(x.slug,{files:!0})).catch(()=>[]);Y=Y.replace(/^.*\u0000C(\d+)\u0000.*$/gm,(u,k)=>{let v=d[Number(k)];if(!v)return"\0gone\0";let $=`${x.files}/${be(kn(H)==="en"?oe[Number(k)]?"Chart.png":"Figure.png":oe[Number(k)]?"\u56FE\u8868.png":"\u56FE.png",z(x.files))}`;return N.push({name:$,data:v,later:!0}),u.replace(`\0C${k}\0`,()=>Se(x.file,$))}).replace(/\n*\u0000gone\u0000\n*/g,`
|
|
71
|
-
|
|
72
|
-
`).replace(/^\n+|\n+$/g,"")}N.push({name:x.file,data:Y})}else c==="html"?N.push({name:x.file,data:_(x,await r.offline(x.slug,{files:f}))}):N.push({name:x.file,data:await ut(_(x,await r.offline(x.slug,{files:f})),{paper:p,scale:g})});for(let x of U){let P=await wt.readFile(x.from).catch(()=>null);P&&N.push({name:x.name,data:P})}let W=[...N.filter(x=>!x.later&&S.some(P=>P.file===x.name)),...N.filter(x=>x.later||!S.some(P=>P.file===x.name))];return W.length===1?{name:W[0].name,type:$n[c],data:Buffer.isBuffer(W[0].data)?W[0].data:Buffer.from(W[0].data,"utf8")}:{name:`${$e(S[0].title)}.zip`,type:"application/zip",data:lt(W)}}var In=3600*1e3,Ne=new Set,Ct=!1,Mn=t=>{Ne.add(t),!Ct&&(Ct=!0,process.once("exit",()=>{for(let n of Ne)try{L.rmSync(n,{recursive:!0,force:!0})}catch{}}))},Nn=/^u-[a-f0-9]{16}$/;function jt({edits:t,workspace:n,reports:r,reportsDirectory:c,offline:s}){let l=null,a=()=>l??=L.promises.mkdtemp(ee.join(Le.tmpdir(),"gallery-uploads-")).then(d=>(Mn(d),d)),p=new Map,g=(d,u,k)=>[d,{ok:!1,reason:u,...Tn(k)}],w=d=>L.promises.access(d).then(()=>!0,()=>!1),f=d=>Fn(d,c),S=d=>St(f(d)),j=async d=>{try{return JSON.parse(await L.promises.readFile(S(d).json,"utf8")).title||d}catch{return d}};function z(d){if(d.method!=="POST")return[405,{ok:!1,reason:"method"}];let u=d.headers.host??"",k=d.socket.localPort;return u!==`127.0.0.1:${k}`&&u!==`localhost:${k}`?[403,{ok:!1,reason:"host"}]:d.headers.origin!==`http://${u}`?[403,{ok:!1,reason:"origin"}]:d.headers["x-gallery-token"]!==t.token?[403,{ok:!1,reason:"token"}]:/^application\/octet-stream\b/i.test(d.headers["content-type"]??"")?Number(d.headers["content-length"]??0)>xt?g(413,"size","\u6587\u4EF6\u592A\u5927\uFF08\u6700\u591A 5GB\uFF09"):null:[415,{ok:!1,reason:"type"}]}async function A(){for(let[d,u]of p)Date.now()-u.at<In||(p.delete(d),await L.promises.rm(u.file,{force:!0}).catch(()=>{}))}async function O(d,u){let k=z(d);if(k)return d.resume(),D(u,...k);let v=new URL(d.url,"http://localhost").searchParams.get("name")?.replace(/[\u0000-\u001f]/g,"").trim()??"";if(!v||v.length>255)return d.resume(),D(u,...g(400,"name","\u6587\u4EF6\u540D\u4E0D\u5BF9"));await A();let $=`u-${Cn(8).toString("hex")}`,e=ee.join(await a(),$),o=0,i=new jn({transform(m,h,b){o+=m.length,b(o>xt?Object.assign(new Error("too-large"),{reason:"size"}):null,m)}});try{await On(d,i,L.createWriteStream(e))}catch(m){return await L.promises.rm(e,{force:!0}).catch(()=>{}),m.reason==="size"?D(u,...g(413,"size","\u6587\u4EF6\u592A\u5927\uFF08\u6700\u591A 5GB\uFF09")):D(u,...g(400,"body","\u6587\u4EF6\u6CA1\u6709\u4F20\u5B8C"))}return p.set($,{file:e,name:v,at:Date.now()}),D(u,200,{ok:!0,id:$})}async function _(d,u){let k=await t.check(d);if(k.error)return D(u,...k.error);let{slug:v,options:$}=k.body??{};if(typeof v!="string"||!bt.test(v)||!await w(S(v).html))return D(u,...g(404,"missing","\u627E\u4E0D\u5230\u8FD9\u4EFD\u6587\u6863"));if(!kt($))return D(u,...g(400,"options","\u5BFC\u51FA\u9009\u9879\u4E0D\u5BF9"));try{let e=await s(),o=new Map,i=y=>(o.has(y)||o.set(y,t.handIn(y,{reader:!0}).then(C=>{if(!C.ok)throw Object.assign(new Error(C.message??C.reason),{reason:C.reason});if(C.repeated.length)throw Object.assign(new Error("check"),{reason:"check",slug:y,failures:ye(C.repeated)})})),o.get(y)),m=new Map,h={reportsDirectory:c,titleOf:j,childrenOf:async y=>(await n.outline()).children[y]??[],links:()=>$t(c),offline:async(y,C)=>{await i(y);let R=await e(y,C),B=$.format==="markdown"?null:En(R);return B&&m.set(y,B),R},check:async y=>(await i(y),e.check(y))},{name:b,type:F,data:T}=await vt(v,$,h);m.size&&await(await ke([...m.keys()])).keep([...m.keys()],m),u.writeHead(200,{"Content-Type":F,"Content-Length":T.length,"Content-Disposition":`attachment; filename*=UTF-8''${encodeURIComponent(b)}`,"X-File-Name":encodeURIComponent(b),"Cache-Control":"no-store"}),u.end(T)}catch(e){if(e.reason==="check"){let o=await j(e.slug),i=e.component?Me("\u300C{0}\u300D\u91CC\u7684\u7EC4\u4EF6 {1} \u6709\u9519\u8BEF\uFF0C\u6CA1\u6709\u751F\u6210\u6587\u4EF6\uFF1A\u53EF\u4EE5\u8BA9 AI \u68C0\u67E5\u8FD9\u4EFD\u6587\u6863\u5E76\u4FEE\u597D",o,e.component):e.failures.length>1?Me("\u300C{0}\u300D\u6CA1\u6709\u901A\u8FC7\u5BFC\u51FA\u524D\u7684\u68C0\u67E5\uFF0C\u6CA1\u6709\u751F\u6210\u6587\u4EF6\uFF1A{1}\uFF08\u5171 {2} \u5904\uFF1A\u53EF\u4EE5\u8BA9 AI \u68C0\u67E5\u8FD9\u4EFD\u6587\u6863\uFF0C\u5217\u51FA\u5168\u90E8\u5E76\u4FEE\u597D\uFF09",o,e.failures[0],e.failures.length):Me("\u300C{0}\u300D\u6CA1\u6709\u901A\u8FC7\u5BFC\u51FA\u524D\u7684\u68C0\u67E5\uFF0C\u6CA1\u6709\u751F\u6210\u6587\u4EF6\uFF1A{1}",o,e.failures[0]);return D(u,...g(422,"check",i))}D(u,...g(e.reason==="browser"?422:e.reason==="busy"?409:e.reason==="missing"?404:500,e.reason??"export",e))}}async function N(d,u){let k=await t.check(d);if(k.error)return D(u,...k.error);let{slug:v}=k.body??{},$=(await t.readTaken(v,{wait:0}))?.text??null;if($===null)return D(u,...g(404,"missing","\u627E\u4E0D\u5230\u8FD9\u4EFD\u6587\u6863"));let e=`http://${d.headers.host}`,{named:o}=await $t(c),i=tt(ce($,{slug:v,mode:"words",reportsDirectory:c}),v,F=>F.slug&&Pn(e,F,o),o),{text:m,files:h}=await ne("markdown",{source:i,title:await j(v),pictures:!1}),b=m.replace(/\u0000F(\d+)\u0000/g,(F,T)=>{let{src:y,kind:C}=h[Number(T)];return encodeURI(`${e}${_n(C==="image"?"asset":"file",v,y)}`)});return D(u,200,{ok:!0,text:b})}let U=async d=>{let u=await t.readTaken(d,{wait:0});return{source:u?.text??"",version:u?.version??null}},W=async(d,u=null)=>{let{source:k,version:v}=u??await U(d),$="\u5199\u4F5C\u504F\u597D",{text:e,files:o}=await ne("markdown",{source:k,title:$,pictures:!1}),i=e.split(`
|
|
73
|
-
`).slice(1).join(`
|
|
74
|
-
`).replace(/^[\s>]*(?:```.*|\d+\.|- \[x\])/gm,"").replace(/<\/?aside>/g,"");if(!/[\p{L}\p{N}]|\u0000F\d+\u0000/u.test(i))return{markdown:`# ${$}
|
|
75
|
-
`,empty:!0,version:v};let m=ee.relative(c,f(d)).split(ee.sep).join("/");return{markdown:`${e.replace(/\u0000F(\d+)\u0000/g,(h,b)=>encodeURI(`${m}/${o[Number(b)].src}`))}
|
|
76
|
-
`,empty:!1,version:v}},x=d=>S(d).json,P=async d=>{try{let u=JSON.parse(await L.promises.readFile(x(d),"utf8"));return u&&typeof u=="object"?u:null}catch{return null}},V=d=>Sn("sha256").update(d).digest("hex").slice(0,16);async function H(d,u,k,v){let $=await P(d);if(!$||k===null)return;let{synced:e,...o}=$,i={file:V(u),page:k,unshown:v},m=$.madeSame;e===void 0&&m?.file===i.file&&m?.page===i.page&&JSON.stringify(m?.unshown)===JSON.stringify(v)||await Ie(x(d),`${JSON.stringify({...o,madeSame:i},null,2)}
|
|
77
|
-
`)}async function G(d,u){let k=await L.promises.mkdtemp(ee.join(Le.tmpdir(),"gallery-preferences-"));try{let $=(await ne("import",{uploads:[{file:u,name:"preferences.md"}],scratch:k})).pages[0]??{nodes:[],raws:[],files:[],icon:null,lang:null},e=f(d),o=await P(d)??{},i=St(e).html,m=await L.promises.readFile(i,"utf8").catch(()=>""),h=/<html\b[^>]*\slang="([^"]*)"/i.exec(m)?.[1]??null,{html:b}=await Ge(d,o.title||"\u5199\u4F5C\u504F\u597D",o.description||"",{blank:!0,lang:h}),F=typeof o.icon=="string"&&o.icon?o.icon:null,T=await ne("fill",{source:b,nodes:$.nodes,icon:F,raws:$.raws,lang:$.lang});$.files.length&&await L.promises.mkdir(ee.join(e,"assets"),{recursive:!0});for(let{from:C,name:R}of $.files){let B=ee.join(e,"assets",R);await w(B)||await L.promises.copyFile(C,B)}let y=await L.promises.readFile(i,"utf8").catch(()=>null);y!==null&&t.keepVersion?.(d,y),await Ie(i,we(T))}finally{await L.promises.rm(k,{recursive:!0,force:!0}).catch(()=>{})}}async function Q(d,u){let k=await t.check(d);if(k.error)return D(u,...k.error);let v=k.body?.opening===!0,$=await Rn(c);if(!$)return D(u,...g(404,"missing","\u8FD8\u6CA1\u6709\u5199\u4F5C\u504F\u597D"));let e=null,o=(i,m)=>[200,{ok:!0,path:ee.resolve(e),remade:i,unshown:m}];return t.respond(async()=>{let i;({file:e,text:i}=await An(c));let m=await U($),h=(await P($))?.madeSame??null,b=h===null||h.page===m.version,F=h!==null&&b&&h.file===V(i);if(v&&F&&Array.isArray(h.unshown))return o(!1,h.unshown);let[T,y,C,R]=[i,"",m.version,!1];if(v&&!b)await G($,e),{markdown:y,version:C}=await W($),R=!0;else{let J=await W($,m),q=i.trim()===J.markdown.trim()||J.empty&&!Dn(i);y=J.markdown,v?!q&&!F&&(await G($,e),{markdown:y,version:C}=await W($),R=!0):q||(await Ie(e,J.markdown),T=J.markdown)}let B=Ln(T,y);return await H($,T,C,B),o(R,B)})(d,u)}async function K(d,u){let k=await t.check(d);if(k.error)return D(u,...k.error);let{uploads:v,parent:$="",from:e,language:o}=k.body??{},i={said:typeof e=="string"&&e.includes("{0}")&&e.length<=60?e:"\u5BFC\u5165\u81EA {0}",lang:o==="en"?"en":null};if(!Array.isArray(v)||v.length===0||v.length>1e3||!v.every(y=>typeof y=="string"&&Nn.test(y)))return D(u,...g(400,"body"));let m=v.map(y=>p.get(y)).filter(Boolean);if(m.length!==v.length)return D(u,...g(410,"gone","\u4E0A\u4F20\u7684\u6587\u4EF6\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u5BFC\u5165"));for(let y of v)p.delete(y);let h=typeof $=="string"&&bt.test($)&&await w(ee.join(c,$))?$:"",b=await L.promises.mkdtemp(ee.join(Le.tmpdir(),"gallery-import-")),F=()=>Promise.all([L.promises.rm(b,{recursive:!0,force:!0}),...m.map(({file:y})=>L.promises.rm(y,{force:!0}))]).catch(()=>{}),T;try{T=await ne("import",{uploads:m.map(({file:y,name:C})=>({file:y,name:C})),scratch:b})}catch(y){return await F(),D(u,...g(500,"convert",y))}return t.respond(async()=>{try{let{made:y,top:C}=await dt(T.pages,{create:r.create,slugOf:()=>n.freeSlug("doc"),folderOf:f,fill:R=>ne("fill",R),place:n.place,under:h,...i});return[200,{ok:!0,pages:y.length,reports:C,skipped:T.skipped,missing:ie(T.pages)}]}finally{await F()}})(d,u)}let ie=d=>[...new Set(d.flatMap(function u(k){return[...(k.notes??[]).filter(v=>v.kind==="picture-missing").map(v=>v.name),...k.children.flatMap(u)]}))],oe={export:_,markdown:N,upload:O,import:K,preferences:Q};function Y(d,u,k){return Object.hasOwn(oe,k)?oe[k](d,u).catch(v=>{u.headersSent||D(u,...g(500,"transfer",v))}):D(u,404,{ok:!1,reason:"unknown"})}async function Z(){let d=l;l=null,p.clear();let u=await d?.catch(()=>null);u&&(Ne.delete(u),await L.promises.rm(u,{recursive:!0,force:!0}).catch(()=>{}))}return{handle:Y,close:Z}}function Ot({settled:t,tell:n,delay:r=120,recheck:c=1e3}){let s=new Map,l=(a,p=r)=>{clearTimeout(s.get(a));let g=setTimeout(async()=>{let w=await t(a).catch(()=>({source:null,held:!1,wait:0}));if(s.get(a)===g){if(w.held)return l(a,Math.min(Math.max(w.wait,50),c));if(w.wait>0)return l(a,w.wait);await n(a,w)}},p);s.set(a,g)};return l}import Wn from"node:fs/promises";import{packageScript as zn}from"../browser/shared/export-wrap.mjs";import{serveFound as Un}from"../browser/shared/http.mjs";import{extensionOf as Bn,mediaTypeOf as Hn}from"../browser/shared/media.mjs";var Gn="/__gallery/components/",Kn=/^\/__gallery\/components\/([a-z0-9][a-z0-9-]*\/[a-z0-9][a-z0-9-]*)\/(.+)$/,Jn={js:"text/javascript; charset=utf-8",mjs:"text/javascript; charset=utf-8",css:"text/css; charset=utf-8",wasm:"application/wasm"};async function Et(t,n,r,{root:c}){if(!t.startsWith(Gn))return!1;let[,s,l]=Kn.exec(t)??[],a=s?te(c).packages.get(s):null,p=a?.files.includes(l)?Ye(a,l):null,g=p?await Wn.readFile(p).catch(()=>null):null,w=g&&l==="kit.js"?Buffer.from(zn(g.toString("utf8").replace(/^\uFEFF/,""))):g,f=w&&n===a.stamp&&n===Ze(a);return Un(r,w,{type:w?Jn[Bn(l)]??Hn(l):void 0,headers:{"X-Content-Type-Options":"nosniff","Cache-Control":f?"max-age=31536000, immutable":"no-store"}}),!0}import{LISTED_BLOCKS as Tt}from"../browser/editor/components/registry.mjs";import{PACKAGE_ID as Xn}from"../browser/shared/components/installed.mjs";import{inLanguage as _t,refusal as Vn,said as Ce}from"../browser/shared/i18n/index.mjs";function Pt({root:t,taken:n}){let r=()=>{let l=te(t);return{packages:Qe(l),blocks:Tt.map(({id:a,name:p,icon:g,hideable:w})=>({id:a,name:{zh:_t("zh",p),en:_t("en",p)},icon:g,hidden:w&&l.settings.hidden.includes(a),hideable:w})),problem:Ve(l)}},c=({id:l,hidden:a,disabled:p})=>{if(![a,p].every(w=>w===void 0||typeof w=="boolean"))return Ce("\u5F00\u5173\u7684\u503C\u4E0D\u5BF9");let g=Tt.find(w=>w.id===l);return g?p!==void 0?Ce("\u5185\u7F6E\u5757\u53EA\u80FD\u9690\u85CF\uFF0C\u4E0D\u80FD\u505C\u7528"):a&&!g.hideable?Ce("\u8FD9\u4E2A\u5757\u4E0D\u80FD\u9690\u85CF"):null:typeof l=="string"&&Xn.test(l)?null:Ce("\u6CA1\u6709\u8FD9\u4E2A\u7EC4\u4EF6")};return{read:r,write:async l=>{let a=c(l);if(a)throw Vn(a);return await Je(t,l),n(),r()}}}import Yn from"node:path";import{exportsDirectory as Zn}from"../browser/shared/paths.mjs";async function Ft(t,n){let r=Yn.join(Zn,`${n}.html`),c=await ke([n]),s=await t.handInReport(n,{reader:!0});if(!s.ok)return{problems:[],refused:{reason:s.reason,message:s.message},file:r};if(s.repeated.length)return{problems:ye(s.repeated),file:r};let{exported:l,failures:a}=await it([n]);return await c.keep(l.map(p=>p.slug)),{problems:a.get(n)??[],file:r}}import Qn from"node:fs/promises";import qn from"node:path";import{MEDIA_ROUTES as Rt,mediaTypeOf as eo}from"../browser/shared/media.mjs";import{serveFound as to}from"../browser/shared/http.mjs";import{slugPattern as no}from"../browser/shared/reports.mjs";import{documentDirectory as oo}from"../browser/shared/workspace.mjs";var ro={asset:t=>({"Content-Type":eo(t),"Cache-Control":"no-cache"}),file:()=>({"Content-Type":"application/octet-stream","Content-Disposition":"attachment","X-Content-Type-Options":"nosniff","Cache-Control":"no-cache"}),embed:t=>/\.pdf$/i.test(t)?{"Content-Type":"application/pdf","X-Content-Type-Options":"nosniff","Cache-Control":"no-cache"}:{"Content-Type":"text/html; charset=utf-8","Content-Security-Policy":"sandbox allow-scripts allow-popups allow-forms allow-modals","X-Content-Type-Options":"nosniff","Cache-Control":"no-cache"}},ao=new RegExp(`^/__gallery/edit/(${Object.keys(Rt).join("|")})/([^/]+)/(assets/[^/]+)$`);async function At(t,n,{reportsDirectory:r}){let[,c,s,l]=ao.exec(t)??[];if(!c)return!1;let a=no.test(s)&&Rt[c](l)?await Qn.readFile(qn.join(oo(s,r),l)).catch(()=>null):null;return to(n,a,{headers:ro[c](l)}),!0}function Dt({max:t=20}={}){let n=new Map;return{get(r,c,s){let l=`${r} ${c}`,a=n.get(l);return!a||a.text!==s?null:(n.delete(l),n.set(l,a),a.page)},set(r,c,s,l){let a=`${r} ${c}`;for(n.delete(a),n.set(a,{slug:r,text:s,page:l});n.size>t;)n.delete(n.keys().next().value)},clear(){n.clear()},forget(r){for(let[c,s]of n)s.slug===r&&n.delete(c)},get size(){return n.size}}}import{createHash as so}from"node:crypto";import{readFileSync as io}from"node:fs";import Lt from"node:fs/promises";import co from"node:path";import{release as lo,releaseFile as mo}from"../browser/shared/paths.mjs";async function je(t){let n=await Promise.all(t.map(c=>Lt.stat(c).then(({mtimeMs:s,size:l})=>`${s} ${l}`,()=>"none"))),r=so("sha256");return t.forEach((c,s)=>r.update(`${c}\0${n[s]}
|
|
78
|
-
`)),r.digest("hex").slice(0,16)}function It(t,n){let r=null,c=async()=>(await Promise.all(t.map(async s=>(await Lt.readdir(s,{recursive:!0,withFileTypes:!0}).catch(()=>[])).filter(a=>a.isFile()).map(a=>co.join(a.parentPath,a.name))))).flat().filter(n).sort();return{files:()=>r??=c(),changed:()=>{r=null}}}var We=lo?JSON.parse(io(mo,"utf8")).stamps:null;var Yt=Vt.source.slice(1,-1),So=new RegExp(`^/generated/(${Yt})\\.html$`),Co=new RegExp(`^/(${Yt})/(?:doc|report)\\.html$`),Zt="/__gallery/events",ae=fo,Qt=/^\/__gallery\/edit\/(v\/[a-f0-9]{16}\/)?src\/((?:shared(?:\/components|\/emoji|\/i18n)?\/|editor\/(?:page|components)(?:\/[a-z]+(?:-[a-z]+)*){0,2}\/(?!files?\.mjs))[a-z]+(?:-[a-z]+)*\.mjs)$/,jo=/^\/__gallery\/edit\/(?:v\/[a-f0-9]{16}\/)?src\/(shared\/emoji\/data\/[a-z]+(?:-[a-z]+)*\.(json|bin))$/,Oe=[M.join(ae,"editor","page"),M.join(ae,"editor","components"),M.join(ae,"shared")],Oo=t=>Qt.test(`/__gallery/edit/src/${M.relative(ae,t).split(M.sep).join("/")}`);var Eo=[Jt,M.join(ae,"shared","components")],Ja=[Jt,...Oe],Ee={"Cache-Control":"no-store"},Gt={"Cache-Control":"max-age=31536000, immutable"},Kt=(t,n,r)=>Xt(t,{type:n,headers:Ee,body:r});function To(t){let n=t.headers?.host??"",r=t.socket?.localPort;return!!r&&(n===`127.0.0.1:${r}`||n===`localhost:${r}`)}var _o=(t,n,r)=>`<script>
|
|
79
|
-
(() => {
|
|
80
|
-
document.currentScript.remove();
|
|
81
|
-
const solo = new URLSearchParams(location.search).has("solo");
|
|
82
|
-
let catalog = "${r}";
|
|
83
|
-
const holds = (ids) => document.querySelector(ids === undefined ? "[${zt}]" : ids.split(",").map((id) => '[${zt}="' + id + '"]').join());
|
|
84
|
-
const events = new EventSource("${Zt}?slug=${t}");
|
|
85
|
-
events.onmessage = (event) => {
|
|
86
|
-
const [kind, next, ids] = event.data.split(" ");
|
|
87
|
-
if (kind === "notes") return void window.dispatchEvent(new CustomEvent("doc-annotations-changed", { detail: { version: next ?? "" } }));
|
|
88
|
-
if (kind === "changes") return void window.dispatchEvent(new CustomEvent("doc-changes-changed", { detail: { stamp: next ?? "" } }));
|
|
89
|
-
if (kind === "look") return void window.dispatchEvent(new CustomEvent("doc-look-request", { detail: { look: Object.fromEntries(new URLSearchParams(next ?? "")), from: "file" } }));
|
|
90
|
-
if (kind === "settings") return void window.dispatchEvent(new CustomEvent("doc-settings-changed", { detail: { hidden: next ? next.split(",") : [], disabled: ids ? ids.split(",") : [] } }));
|
|
91
|
-
if (kind === "components") {
|
|
92
|
-
if (document.readyState === "loading") return void document.addEventListener("DOMContentLoaded", () => events.onmessage(event), { once: true });
|
|
93
|
-
if (solo || next === catalog) return;
|
|
94
|
-
catalog = next;
|
|
95
|
-
if (!holds(ids)) return void window.dispatchEvent(new CustomEvent("doc-catalog-changed", { detail: { ids: ids === undefined ? null : ids.split(",").filter(Boolean) } }));
|
|
96
|
-
}
|
|
97
|
-
if (window.__galleryEditBusy) {
|
|
98
|
-
window.dispatchEvent(new CustomEvent({ report: "doc-source-changed", assets: "doc-assets-changed", components: "doc-components-changed" }[kind], { detail: { version: next ?? null } }));
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (kind === "report" && next === "${n}") return;
|
|
102
|
-
if (window.__galleryEditReload) return window.__galleryEditReload(); // in a workbench: swapped in, no reload seen
|
|
103
|
-
location.reload();
|
|
104
|
-
};
|
|
105
|
-
})();
|
|
106
|
-
</script>`;function Po(t,n){let r=M.relative(t,n).split(M.sep);if(r[0]===".."||M.isAbsolute(r[0])||r[0]==="")return null;if(r.length===1&&r[0]===ze)return{slug:null,name:ze,packages:!0};let c=r[0]===".gallery"&&r[1]==="pages"&&r.length>=3,[s,...l]=c?r.slice(2):r,a=!c&&(process.platform==="win32"?s.toLowerCase():s)===Ut;return!(a||Vt.test(s))||s==="exports"||l.some(p=>p.startsWith("."))?null:{slug:a?Ut:s,name:l.length===1?l[0]:null,...a?{packages:a}:{}}}function Ue(t){let n=w=>process.platform==="win32"?M.resolve(w).toLowerCase():M.resolve(w),{gallery:r,pages:c,exports:s}=bo(t),[l,a,p]=[n(r),n(c),n(s)],g=(w,f)=>w===f||w.startsWith(f+M.sep);return w=>{let f=n(w);return g(f,l)&&f!==l&&!g(f,a)||g(f,p)}}var me=(t,n,r)=>new RegExp(`</${n}>`,"i").test(t)?t.replace(new RegExp(`</${n}>`,"i"),()=>` ${r}
|
|
107
|
-
</${n}>`):`${t}
|
|
108
|
-
${r}`;function qt({stateDirectory:t=uo,logger:n=console,kind:r="dev",workbenchPage:c=null,closeServer:s=async()=>{},exit:l=()=>process.exit(0)}={}){let a=new Set,p=(e,o="",i="report")=>{for(let m of a)(!e||m.slug===e)&&m.response.write(`data: ${e?`${i} ${o}`:"assets"}
|
|
109
|
-
|
|
110
|
-
`)},g=()=>K("workspace",()=>{for(let e of a)e.workspace&&e.response.write(`data: workspace ${Date.now()}
|
|
111
|
-
|
|
112
|
-
`)}),w=e=>p(e,String(Date.now()),"changes"),f=ct({stateDirectory:t,finish:we,log:e=>n.info?.(`[gallery] ${e}`),onChanges:w}),S=(e,o,i,{lang:m=null,page:h=!1}={})=>He(e,o,i,{blank:!0,lang:m,page:h}),j=null,z=null,A=()=>z??=(async()=>{for(let e of a)e.response.end();a.clear(),await Promise.race([s().catch(()=>{}),new Promise(e=>setTimeout(e,3e3))]),await j?.().catch(()=>{}),await _.close(),l()})(),O=mt({server:{kind:r,version:wo,stop:A},edits:f,reports:{create:S,export:e=>Ft(f,e),words:(e,o)=>ce(e,{slug:o,mode:"words",reportsDirectory:I})},components:Pt({root:I,taken:()=>Z.taken()}),changed:g}),_=jt({edits:f,workspace:O,reports:{create:S},reportsDirectory:I,offline:st}),N=(e,o,{present:i=!1,editorModule:m,kit:h}={})=>{let b=o,F="",T="",y=!0;try{i||({html:b,snippet:F,head:T}=f.preview(e,o,{editor:m,kitTags:R=>et(R,h)}))}catch(R){y=!1,n.warn(`[gallery] text editing unavailable for ${e}: ${R.message}`)}if({html:b}=ot(b,{slug:e,mode:"preview",kit:h}),b=me(b,"head",_o(e,ue(o),te(I).stamp)),b=me(b,"head",`<script data-doc-dev>${ho()}</script>`),T&&(b=me(b,"head",T)),i)return{html:me(b,"head",`<style data-doc-present>.doc-display { display: none !important; }</style>
|
|
113
|
-
<script type="module" src="/__gallery/edit/src/editor/page/present-links.mjs" data-doc-dev></script>`),whole:y};let C="";try{C=gt(e,o)}catch(R){y=!1,n.warn(`[gallery] checks unavailable for ${e}: ${R.message}`)}return C&&(b=me(b,"body",C)),{html:F?me(b,"body",F):b,whole:y}},U=Dt(),W=It(Oe,Oo),x=e=>{let o=Bt(e,I);return[o,M.join(o,"assets")]},P=()=>We?.editor??W.files().then(je),V=e=>We?.kit?.[e.id]??je([Ae(e)]),H=async(e,o,{present:i})=>{let[m,h,b]=await Promise.all([i?"":P(),Promise.all(ge.map(V)),je(x(e))]),F=[i?"present":m,...h,b,te(I).stamp,`look:${Nt(Wt(e,I))}`].join(" "),T=U.get(e,F,o);if(T!==null)return i||f.opened(o),T;let y=new Map(ge.map((J,q)=>[J,h[q]])),C=i?void 0:`/__gallery/edit/v/${m}/src/editor/page/editor.mjs`,{html:R,whole:B}=N(e,o,{present:i,editorModule:C,kit:J=>`${Re(J)}?v=${y.get(J)}`});return B&&U.set(e,F,o,R),R};async function G(e,o,i){try{if(!To(e))return Mt(o,403,{ok:!1,reason:"host"});let m=new URL(e.url||"/","http://localhost"),h=decodeURI(m.pathname);if(h===Zt){o.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-store",Connection:"keep-alive"}),o.write(`retry: 3000
|
|
114
|
-
|
|
115
|
-
`);let E={slug:m.searchParams.get("slug"),workspace:m.searchParams.has("workspace"),response:o};a.add(E);let{stamp:he,settings:an}=te(I);o.write(`data: components ${he}
|
|
116
|
-
|
|
117
|
-
`),o.write(`data: ${Fe(an)}
|
|
118
|
-
|
|
119
|
-
`),e.on("close",()=>a.delete(E));return}if(h==="/__gallery/edit/commit")return f.commit(e,o);if(h==="/__gallery/edit/reverted")return f.reverted(e,o);if(h==="/__gallery/edit/hand-in")return f.handInRequest(e,o);if(h==="/__gallery/edit/settle")return f.settleRequest(e,o);if(h==="/__gallery/edit/round")return f.roundRequest(e,o);if(h==="/__gallery/edit/upload")return f.upload(e,o);if(h==="/__gallery/edit/unfurl")return f.unfurl(e,o);if(h==="/__gallery/edit/emoji-library"){if(e.method==="POST")return f.addEmoji(e,o);let[E,he]=await f.listEmojis();return Mt(o,E,he)}if(h==="/__gallery/edit/icon"){let E=Ke({value:m.searchParams.get("value")??"",slug:m.searchParams.get("slug"),tab:m.searchParams.has("tab")});return de(o,E?.body,{type:E?.type,headers:{"Cache-Control":"max-age=31536000, immutable"}})}if(await At(h,o,{reportsDirectory:I})||await Et(h,m.searchParams.get("v"),o,{root:I}))return;let b=h.match(/^\/__gallery\/edit\/emoji-library\/([^/]+)$/)?.[1];if(b){let E=await f.readEmoji(b);return de(o,E?.body,{type:E?.type,headers:{"Cache-Control":"no-cache"}})}if(h==="/__gallery/edit/frameable")return f.frameable(e,o);if(h==="/__gallery/edit/annotations")return f.annotations(e,o);if(h==="/__gallery/edit/changes")return f.changes(e,o);let F=h.match(/^\/__gallery\/transfer\/([a-z]+)$/)?.[1];if(F)return _.handle(e,o,F);let T=h.match(/^\/__gallery\/workspace\/([a-z]+)$/)?.[1];if(T)return O.handle(e,o,T);let[,y,C]=h.match(Qt)??[];if(C){let E=await le.readFile(M.join(ae,C),"utf8").catch(()=>null);return de(o,E,{type:"text/javascript; charset=utf-8",headers:y?Gt:Ee})}let R=m.searchParams.has("v")&&ge.find(E=>Re(E)===h);if(R){let E=await le.readFile(Ae(R)).catch(()=>null);return de(o,E,{type:h.endsWith(".css")?"text/css; charset=utf-8":"text/javascript; charset=utf-8",headers:Gt})}if(h==="/__gallery/edit/mhchem.js"){let E=await le.readFile(qe).catch(()=>null);return de(o,E,{type:"text/javascript; charset=utf-8",headers:Ee})}let[,B,J]=h.match(jo)??[];if(B){let E=await le.readFile(M.join(ae,B)).catch(()=>null);return de(o,E,{type:J==="json"?"application/json; charset=utf-8":"application/octet-stream",headers:{"Cache-Control":"max-age=86400"}})}if(c&&(h==="/"||h==="/index.html"))return Kt(o,"text/html; charset=utf-8",await c(m.pathname,e));let q=h.match(So)?.[1];if(!q){let E=h.match(Co)?.[1];return $o(E)&&await le.access(vo(Bt(E,I)).html).then(()=>!0,()=>!1)?Xt(o,{status:302,headers:{Location:`/generated/${E}.html${m.search}`,...Ee}}):i()}let Pe=await f.readTaken(q);if(Pe===null)return i();m.searchParams.has("present")||f.noteTaken(q,Pe.source).then(E=>E&&w(q),()=>{}),Kt(o,"text/html; charset=utf-8",await H(q,Pe.text,{present:m.searchParams.has("present")}))}catch(m){i(m)}}let Q=new Map,K=(e,o)=>{clearTimeout(Q.get(e)),Q.set(e,setTimeout(o,120))},ie=e=>{yo(e,I).reads&&p(e,Nt(Wt(e,I)),"look")},oe=Ot({settled:f.settled,async tell(e,o){let i=await f.read(e,o.source).catch(m=>(n.error(`[gallery] ${e}: ${m.message}`),{version:ue(o.source??"")}));p(e,i?.version??ue("")),f.noteTaken(e,o.source).then(m=>m&&w(e),m=>n.error(`[gallery] ${e}: the Agent's changes not kept: ${m.message}`)),f.checkAnnotations(e).catch(m=>n.error(`[gallery] ${e}: annotations not checked: ${m.message}`))}}),Y=({id:e,problem:o,off:i})=>i||n.warn(`[gallery] component package ${e} does not load: ${Xe("en",o)}`),Z=ht({root:I,tell({stamp:e,problems:o,settings:i},m){for(let h of m)o.has(h)&&Y(o.get(h));for(let{response:h}of a)h.write(`data: components ${e} ${m.filter(b=>ko.test(b)).join(",")}
|
|
120
|
-
|
|
121
|
-
`),h.write(`data: ${Fe(i)}
|
|
122
|
-
|
|
123
|
-
`)}});for(let e of te(I).problems.values())Y(e);let d=Ue(I),u=(e,o)=>!po&&o.some(i=>e.startsWith(i+M.sep));function k(e,o){if(e==="reset"){U.clear(),W.changed(),Z.changed(),g();return}if(d(o))return;let i=Po(I,o);if(i?.packages&&Z.changed(),i?.name===ze&&i.slug===null&&K("look:*",()=>new Set([...a].map(({slug:m})=>m).filter(Boolean)).forEach(ie)),i?.slug&&!(i.name&&xo(i.name))&&U.forget(i.slug),i&&(/^(doc|report)\.json$/.test(i.name??"")||/^(add|unlink)Dir$/.test(e)&&i.name===null)&&U.clear(),i?.slug&&!(i.packages&&i.name===null)&&(/^(doc|report)\.json$/.test(i.name??"")||/^(add|unlink)Dir$/.test(e)&&i.name===null||/^(add|unlink)$/.test(e)&&Ht(i.name??""))&&g(),/^(add|unlink)(Dir)?$/.test(e)&&u(o,Oe)&&W.changed(),i?.name&&(Ht(i.name)||/^(doc|report)\.json$/.test(i.name))){if(oe(i.slug),/^(doc|report)\.json$/.test(i.name)){let{slug:m}=i;K(`look:${m}`,()=>ie(m))}}else if(i?.name==="annotations.json"){let{slug:m}=i;K(`notes:${m}`,async()=>{let h=await le.readFile(o,"utf8").catch(()=>null);p(m,h===null?"":ue(h),"notes")})}else u(o,Eo)?K("kit",async()=>{try{await at({fresh:!0}),p()}catch(m){n.error(`[gallery] shared kit rebuild failed: ${m.message}`)}}):u(o,Oe)&&K("editor",()=>p())}async function v(e){j=await go({reportsDirectory:I,port:e,token:f.token,kind:r})}async function $(){for(let e of Q.values())clearTimeout(e);Z.close(),await j?.().catch(()=>{}),j=null,await _.close()}return{handle:G,changed:k,listening:v,close:$,stop:A,edits:f,get listeners(){return a.size}}}import Fo from"node:fs/promises";import fe from"node:path";import{serve as en}from"../browser/shared/http.mjs";var Ro={".html":"text/html; charset=utf-8",".js":"text/javascript; charset=utf-8",".mjs":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".json":"application/json; charset=utf-8",".map":"application/json; charset=utf-8",".svg":"image/svg+xml",".png":"image/png",".ico":"image/x-icon",".woff2":"font/woff2",".woff":"font/woff",".ttf":"font/ttf",".txt":"text/plain; charset=utf-8"},Ao=t=>Ro[fe.extname(t).toLowerCase()]??"application/octet-stream";function Do(t,n){if(/%(?:2f|5c|00)/i.test(n)||/[\\\0]/.test(n))return null;let r;try{r=decodeURIComponent(n)}catch{return null}let c=r.split("/");if(c.some(a=>a===""||a==="."||a===".."||/[\\\0:]/.test(a)))return null;let s=fe.resolve(t,...c),l=fe.relative(t,s);return l&&!l.startsWith("..")&&!fe.isAbsolute(l)?s:null}async function tn(t,n,{web:r,kit:c,vendor:s}){if(t.method!=="GET"&&t.method!=="HEAD")return!1;let l=new URL(t.url||"/","http://localhost").pathname,a=null,p=null;if(l==="/"||l==="/index.html"){if(!r)return!1;[a,p]=[fe.join(r,"index.html"),{"Cache-Control":"no-store"}]}else{let f=[["/assets/",r&&fe.join(r,"assets"),"max-age=31536000, immutable"],["/kit/",c,"no-cache"],["/vendor/",s,"no-cache"]].find(([S,j])=>j&&l.startsWith(S));if(!f)return!1;a=Do(f[1],l.slice(f[0].length)),p={"Cache-Control":f[2]}}let g=a?await Fo.readFile(a).catch(()=>null):null;return g?(en(n,{type:Ao(a),headers:{...p,"X-Content-Type-Options":"nosniff"},body:t.method==="HEAD"?void 0:g}),!0):(en(n,{status:404}),!0)}import se from"node:fs";import pe from"node:path";import{isSlugName as nn,layoutOf as Lo}from"../browser/shared/workspace.mjs";function Io(t){let{components:n,gallery:r,pages:c}=Lo(t),s=(p,g)=>{try{return se.readdirSync(p,{withFileTypes:!0}).filter(w=>w.isDirectory()&&g(w.name)).map(w=>pe.join(p,w.name))}catch{return[]}},l=[...s(t,p=>nn(p)),...s(c,p=>nn(p))],a=p=>[p,...s(p,g=>!g.startsWith(".")).flatMap(a)];return[...new Set([t,...[r,c].filter(p=>se.existsSync(p)),...l,...l.map(p=>pe.join(p,"assets")).filter(p=>se.existsSync(p)),...se.existsSync(n)?a(n):[]])]}function on(t,n,{folders:r=process.platform==="linux"}={}){let c=Ue(t),s=(f,S)=>{c(S)||pe.basename(S).startsWith(".")||se.stat(S,(j,z)=>{if(j)return n(j.code==="ENOENT"?"unlink":"change",S);let A=z.isDirectory();n(f==="rename"?A?"addDir":"add":A?"addDir":"change",S)})},l=()=>{};if(!r)try{let f=se.watch(t,{recursive:!0},(S,j)=>j?s(S,pe.join(t,j.toString())):n("reset",t));return f.on("error",l),{close:()=>f.close()}}catch(f){if(f.code!=="ERR_FEATURE_UNAVAILABLE_ON_PLATFORM")throw f}let a=new Map,p=null,g=()=>{let f=new Set(Io(t));for(let[S,j]of a)f.has(S)||(j.close(),a.delete(S));for(let S of f)if(!a.has(S))try{let j=se.watch(S,(z,A)=>{if(!A)return n("reset",S);z==="rename"&&w(),s(z,pe.join(S,A.toString()))});j.on("error",l),a.set(S,j)}catch{}},w=()=>{p??=setTimeout(()=>{p=null,g()},50)};return g(),{close(){clearTimeout(p);for(let f of a.values())f.close();a.clear()},get folders(){return[...a.keys()]}}}async function us({port:t,web:n=Ho,kind:r=process.env.GALLERY_SERVER_KIND==="dev"?"dev":"cli",stateDirectory:c=Wo,exit:s=(g=0)=>process.exit(g),watch:l=!0,signals:a=!0,log:p=console}={}){await Go(Be);let g=null,w=null,f=null,S=Ko(Be),j=async()=>{w?.close(),f&&Te.unwatchFile(_e,f),await Mo.writeFile(S.lastPortFile,`${t}
|
|
124
|
-
`).catch(()=>{}),await new Promise(O=>{g.close(()=>O()),g.closeAllConnections()})},A=qt({stateDirectory:c,logger:{info:O=>p.log(O),warn:O=>p.warn(O),error:O=>p.error(O)},kind:r,closeServer:j,exit:()=>s(0)});if(g=No.createServer((O,_)=>{A.handle(O,_,async N=>{if(N){p.error(`[gallery] ${O.method} ${O.url}: ${N.stack??N.message}`),_.headersSent?_.end():rn(_,{status:500});return}try{if(await tn(O,_,{web:n,kit:zo,vendor:Bo}))return}catch(U){p.error(`[gallery] ${O.url}: ${U.message}`)}_.headersSent||rn(_,{status:404})})}),g.keepAliveTimeout=5e3,await new Promise((O,_)=>{g.once("error",_),g.listen(t,"127.0.0.1",()=>{g.off("error",_),O()})}),t=g.address().port,await A.listening(t),l&&(w=on(Be,A.changed)),Uo){let O=Te.readFileSync(_e,"utf8");f=()=>{let _=null;try{_=Te.readFileSync(_e,"utf8")}catch{}_!==O&&(p.log("[gallery] The package was replaced (another version installed): this server stops; the next gallery command starts the new one."),A.stop())},Te.watchFile(_e,{interval:3e3,persistent:!1},f)}if(a)for(let O of["SIGINT","SIGTERM","SIGHUP"])process.once(O,()=>A.stop());return{server:g,port:t,routes:A,async close(){await j(),await A.close()}}}export{us as a};
|
package/dist/chunk-EZY3WC6Z.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{a as b}from"./chunk-LAE5NQ4B.mjs";import{c as j,d as x,k as w}from"./chunk-NSKUTQ5J.mjs";import"./chunk-5L7RYZCL.mjs";import l from"node:fs";import a from"node:path";import{pathToFileURL as E}from"node:url";import{projectRoot as f}from"../browser/shared/paths.mjs";import{sha256 as L}from"../browser/shared/files.mjs";var g=["SKILL.md","references/writing-html.md","references/building-components.md","references/example-report.html","sdk","agents/openai.yaml"],u="## Before anything: the gallery command";function F(n){let[s,t]=n.split(/[.+-]/).map(Number);return{range:`^${n}`,takes:`${n} or a later ${s===0?`0.${t}`:s}.x`}}function K(n,s){let t=n.indexOf(`
|
|
3
|
-
${u}
|
|
4
|
-
`);if(t<0)throw new Error(`SKILL.md has no section "${u}" (the version range of the command stands there)`);let e=n.indexOf(`
|
|
5
|
-
## `,t+u.length+1),r=e<0?n.length:e,{range:i,takes:o}=F(s),c=n.slice(t,r).replace(/\^\d+\.\d+\.\d+(?:-[\w.]+)?/g,i).replace(/\b\d+\.\d+\.\d+(?:-[\w.]+)? or a later \d+(?:\.\d+)?\.x\b/g,o);return n.slice(0,t)+c+n.slice(r)}function y(n=f){let s=g.filter(i=>!l.existsSync(a.join(n,i)));if(s.length)return s.map(i=>`the skill takes ${i}, which is not there`);let t=A(g,n),e=i=>l.readFileSync(a.join(n,i),"utf8"),r=P(t,e).map(i=>`${i}, which the skill does not hold: link only what it holds`);for(let i of t.filter(o=>o.startsWith("sdk/")&&o.endsWith(".ts")))for(let[,o]of e(i).matchAll(/\bfrom\s+["']([^"']+)["']|\bimport\(\s*["']([^"']+)["']\s*\)/g))o&&(!o.startsWith("./")||o.includes("/../"))&&r.push(`${i} imports ${o}, outside sdk/: write the types it needs in sdk/`);return r}function O(n,{root:s=f,version:t=JSON.parse(l.readFileSync(a.join(s,"package.json"),"utf8")).version}={}){let e=y(s);if(e.length)throw new Error(`The skill cannot be made:
|
|
6
|
-
${e.map(r=>` ${r}`).join(`
|
|
7
|
-
`)}`);l.rmSync(n,{recursive:!0,force:!0});for(let r of A(g,s)){let i=a.join(n,r);l.mkdirSync(a.dirname(i),{recursive:!0}),r==="SKILL.md"?l.writeFileSync(i,K(l.readFileSync(a.join(s,r),"utf8"),t)):l.copyFileSync(a.join(s,r),i)}return S(n)}function S(n,s=""){let t=[];for(let e of l.readdirSync(n,{withFileTypes:!0}).sort((r,i)=>r.name.localeCompare(i.name))){let r=s?`${s}/${e.name}`:e.name;e.isDirectory()?t.push(...S(a.join(n,e.name),r)):e.isFile()&&t.push(r)}return t}function A(n,s=f){return n.flatMap(t=>{let e=a.join(s,t);return l.existsSync(e)?l.statSync(e).isDirectory()?S(e,t):[t]:[]})}function N(n){let s=null;return n.split(`
|
|
8
|
-
`).map(t=>{let e=/^\s*(`{3,}|~{3,})(.*)$/.exec(t);return s?(e&&e[1][0]===s[0]&&e[1].length>=s.length&&!e[2].trim()&&(s=null),""):e&&!(e[1][0]==="`"&&e[2].includes("`"))?(s=e[1],""):t}).join(`
|
|
9
|
-
`)}function v(n){let s=N(n).replace(/(`+)(?!`)(?:(?!\n[ \t]*\n)[\s\S])*?[^`]\1(?!`)/g,e=>" ".repeat(e.length));return[...[...s.matchAll(/\]\(\s*(?:<([^<>\n]*)>|((?:[^\s()<>]|\([^\s()<>]*\))+))(?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^()\n]*\)))?\s*\)/g)].map(e=>[e.index,e[1]??e[2]]),...[...s.matchAll(/^ {0,3}\[(?!\^)[^\]\n]+\]:[ \t]*(?:<([^<>\n]*)>|(\S+))/gm)].map(e=>[e.index,e[1]??e[2]]),...[...s.matchAll(/<(?:a|img)\s[^>]*?\b(?:href|src)\s*=\s*(?:"([^"]*)"|'([^']*)')/gi)].map(e=>[e.index,e[1]??e[2]])].sort(([e],[r])=>e-r).map(([,e])=>e)}function z(n,s){if(/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(s))return null;let[,t,e=""]=/^([^?#]*)(?:\?[^#]*)?(?:#(.*))?$/s.exec(s),r=o=>{try{return decodeURIComponent(o)}catch{return o}};return{file:t?a.posix.normalize(a.posix.join(a.posix.dirname(n),r(t))).replace(/\/$/,""):n,anchor:r(e)}}function P(n,s){let t=new Set(n),e=new Set(n.flatMap(i=>i.split("/").slice(0,-1).map((o,c,p)=>p.slice(0,c+1).join("/")))),r=[];for(let i of n.filter(o=>/\.md$/i.test(o)))for(let o of v(s(i))){let c=z(i,o);!c||c.file===i||!t.has(c.file)&&!e.has(c.file)&&r.push(`${i} links ${o}`)}return r}function C(n,{root:s=f,version:t=JSON.parse(l.readFileSync(a.join(s,"package.json"),"utf8")).version}={}){let e=y(s);if(e.length)throw new Error(`The skill cannot be made:
|
|
10
|
-
${e.map(m=>` ${m}`).join(`
|
|
11
|
-
`)}`);let r=a.join(n,"skill","gallery"),i=`gallery-skill-${t}.zip`,o=a.join(n,i);l.rmSync(a.join(n,"skill"),{recursive:!0,force:!0}),l.existsSync(a.join(n,"gallery","PACKAGE-MANIFEST.json"))&&l.rmSync(a.join(n,"gallery"),{recursive:!0,force:!0});for(let m of l.existsSync(n)?l.readdirSync(n):[])/^gallery-skill-.+\.zip(?:\.sha256)?$|^PACKAGE-MANIFEST\.json$/.test(m)&&l.rmSync(a.join(n,m),{force:!0});let c=O(r,{root:s,version:t}),p=c.map(m=>({name:`gallery/${m}`,data:l.readFileSync(a.join(r,m))})),d=b(p);l.writeFileSync(o,d);let k=L(d);l.writeFileSync(`${o}.sha256`,`${k} ${i}
|
|
12
|
-
`);let{range:$}=F(t),T={name:"gallery",version:t,archive:i,holds:"The Agent's documents (SKILL.md, references/writing-html.md, references/building-components.md, the example references/example-report.html), the SDK's types (sdk/) and Codex's display metadata (agents/openai.yaml). The tools are the npm package @heycys/gallery, which SKILL.md has the Agent check for and install (with the user's consent); gallery skill install writes this same skill.",skillEntrypoint:"SKILL.md",requires:`@heycys/gallery@${$}`,files:p.map(({name:m,data:h})=>({path:m.slice(8),bytes:h.byteLength,sha256:L(h)}))};l.writeFileSync(a.join(n,"PACKAGE-MANIFEST.json"),`${JSON.stringify(T,null,2)}
|
|
13
|
-
`);let I=p.reduce((m,{data:h})=>m+h.byteLength,0);return{archive:o,skill:r,files:c,bytes:I,zipBytes:d.byteLength,sha256:k,range:$}}if(import.meta.url===E(process.argv[1]).href){let{positional:n}=await w(import.meta.url);n.length>0&&(console.error(x(j(import.meta.url),`Unknown argument: ${n[0]} (skill:package takes none: there is one skill).`)),process.exit(2));let s=y();s.length>0&&(console.error(`Not packaged:
|
|
14
|
-
${s.map(e=>` ${e}`).join(`
|
|
15
|
-
`)}`),process.exit(1));let t=C(a.join(f,"release"));console.log(`Packaged ${t.archive} (${t.files.length} files, ${t.bytes.toLocaleString("en-US")} bytes; the ZIP ${t.zipBytes.toLocaleString("en-US")} bytes), for @heycys/gallery ${t.range}`),console.log(`The skill's folder: ${t.skill}`),console.log(`SHA-256 ${t.sha256}`)}export{u as BOOTSTRAP,g as SKILL_FILES,O as buildSkill,P as deadLinks,A as filesOf,z as linkTarget,v as linksOf,S as listFiles,C as packageSkill,y as skillProblems,F as skillRange,K as withRange,N as withoutSamples};
|
package/dist/chunk-FUKQNOQS.mjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{b as we,c as pe,d as ge,e as J,g as R,h as me,i as X,j as $e,k as ye,l as $,m as ke}from"./chunk-PL6GHLGD.mjs";import{a as H}from"./chunk-TX6JH7TR.mjs";import{d as ce,g as de}from"./chunk-5ZKJ3H4P.mjs";import{a as U}from"./chunk-NQPVAU63.mjs";import{a as he,b as fe,e as ue}from"./chunk-DFUDV4LX.mjs";import{a as Q,c as F}from"./chunk-QJIR2BLP.mjs";import"./chunk-E7LWZRXY.mjs";import{b as v,i as ie}from"./chunk-NSKUTQ5J.mjs";import"./chunk-AUZGSZJH.mjs";import"./chunk-BGGDRNYQ.mjs";import"./chunk-6QXGZM36.mjs";import"./chunk-UALRNVSE.mjs";import"./chunk-W3BGBJQW.mjs";import"./chunk-JVHHHGEA.mjs";import{a as re}from"./chunk-HYMEEXKN.mjs";import"./chunk-TYK6VNAB.mjs";import{b as z}from"./chunk-CY2FNNAB.mjs";import"./chunk-UMHUSOPJ.mjs";import"./chunk-L3QKH4OK.mjs";import{c as Y,g as le}from"./chunk-W4VKN3GF.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import C from"node:fs/promises";import P from"node:path";import{isInstance as K,partOf as Fe}from"../browser/shared/components/index.mjs";import{ATTRIBUTE as ae,FALLBACK as Re,FIELDS as _e,INSTANCE as Se,PACKAGE_ID as je}from"../browser/shared/components/installed.mjs";import{attr as ee,walk as Pe}from"../browser/shared/html-tree.mjs";import{documentDirectory as Be,documentFiles as He,layoutOf as se,packageFolders as Ue}from"../browser/shared/workspace.mjs";var be=10,te=6,qe=3,Ge=100,Le=1024,Ie=900,Ve=4e3,V=3e4,Ke=1500,ne=3e4,oe=500,We=5e3,Ze=200,B=e=>new Promise(t=>setTimeout(t,e));async function Ye(e){let{_keyDefinitions:t}=await import("./chunk-43B75J5T.mjs"),n=Object.hasOwn(t,e)?[e]:e.split("+"),a=new Set(["Control","Shift","Alt","Meta"]);if(n.some(o=>!Object.hasOwn(t,o))||n.slice(0,-1).some(o=>!a.has(o)))throw new v(`Not a key: ${e} (a key as a browser names it, Enter, Space, Escape, Tab, ArrowRight, a letter or a digit, after modifiers joined by "+": Shift+Tab, Control+Enter).`);return n}async function ze(e,t){let n=["--press","--drag","--key"].filter(a=>e.has(a));if(n.length!==1)throw new v(n.length?`One gesture at a time: ${n.join(" or ")}.`:"Say the gesture: --press <selector>, --drag <selector> --to <selector> or --key <selector> <key>.");if(e.has("--to")&&!e.has("--drag"))throw new v("--to goes with --drag: --drag <selector> --to <selector>.");if(e.has("--drag")&&!e.has("--to"))throw new v("--drag takes --to: --drag <selector> --to <selector>, where it is dropped.");return e.has("--press")?{kind:"press",at:e.get("--press")}:e.has("--drag")?{kind:"drag",at:e.get("--drag"),to:e.get("--to")}:{kind:"key",at:e.get("--key"),keys:await Ye(t),key:t}}var Qe=e=>{let t=e.parentNode;for(;t&&!K(t);)t=t.parentNode;return t??null};function Ne(e){let t=[];return Pe(re(e),n=>{K(n)&&t.push({element:n,id:ee(n,ae),blockId:ee(n,"data-block-id")??null,line:n.sourceCodeLocation?.startLine})},{stop:K}),t}var Je=(e,{id:t,blockId:n})=>n??(e.filter(a=>a.id===t).length===1?t:null);function Xe(e,t,{slug:n,name:a}){let o=()=>e.map(i=>` ${Je(e,i)??"(no id yet: gallery export gives it one)"} ${i.id} at ${a}:${i.line}`).join(`
|
|
3
|
-
`);if(t===null){if(e.length===1)return 0;throw new v(`${n} holds ${e.length} instances: name one, gallery component try ${n} <instance id> \u2026
|
|
4
|
-
${o()}`)}let r=e.findIndex(({blockId:i})=>i===t);if(r>=0)return r;let l=t.includes("/")?t:`local/${t}`,s=je.test(l)?e.flatMap((i,c)=>i.id===l?[c]:[]):[];if(s.length===1)return s[0];throw new v(s.length?`${n} holds ${s.length} instances of ${l}: name one by its id
|
|
5
|
-
${o()}`:`${n} holds no instance ${t}:
|
|
6
|
-
${o()}`)}var et=e=>e.replace(/\s+data-block-id="[^"]*"/g,""),ve=e=>et(z(e).text);function xe(e,t,n){let a=Ne(e)[t]?.element;if(!a||ee(a,ae)!==n.id)return null;let o=[],r=Object.entries(n.parts).map(([c,{at:u}])=>{let p=Fe(a,u).filter(h=>h.sourceCodeLocation?.endTag&&!K(h)&&Qe(h)===a).map(({sourceCodeLocation:{startTag:h,endTag:d}})=>({start:h.endOffset,end:d.startOffset}));return o.push(...p),{name:c,text:p.map(({start:h,end:d})=>e.slice(h,d)).join(`
|
|
7
|
-
`)}}),l=o.sort((c,u)=>c.start-u.start||u.end-c.end).filter((c,u)=>!o.slice(0,u).some(p=>p.start<=c.start&&c.end<=p.end)),s="",i=0;for(let{start:c,end:u}of l)s+=e.slice(i,c),i=u;return{parts:r,outside:s+e.slice(i)}}function tt(e,t,n,a){let[o,r]=[xe(e,n,a),xe(t,n,a)];return!o||!r?{parts:[],outside:null,gone:!0}:{parts:o.parts.flatMap(({name:s,text:i},c)=>i===r.parts[c].text?[]:[{name:s,...X(i,r.parts[c].text),how:$e(i,r.parts[c].text)}]),outside:o.outside===r.outside?null:X(o.outside,r.outside),gone:!1}}async function nt(e,t){let{components:n,marker:a}=se(e);return await Oe([t,a,n])+U+F+oe}async function Oe(e){let t=[...e];for(let a of e)for(let o of await C.readdir(a,{recursive:!0,withFileTypes:!0}).catch(()=>[]))t.push(P.join(o.parentPath,o.name));let n=await Promise.all(t.map(a=>C.stat(a).then(({mtimeMs:o})=>o,()=>0)));return Math.max(...n)}var ot=e=>fetch(`${e}/__gallery/workspace/components`,{signal:AbortSignal.timeout(2e3)}).then(t=>t.ok?t.json():null).then(t=>Array.isArray(t?.packages)?t.packages:null,()=>null);async function at(e,t,n){let{components:a,marker:o}=se(e),r=Ue(e).find(k=>k.id.toLowerCase()===t)?.folder??P.join(a,...t.split("/")),[l,s]=await Promise.all([Oe([o,r]),ot(n)]),{packages:i,problems:c,settings:u}=Y(e),p=s?.find(k=>k.id===t)??null,h=s?p?.state??"none":null,d=h==="normal"||h==="hidden",f=u.disabled.includes(t),m=c.get(t),y=m&&!f&&d?le("en",m.problem):null,S=s!==null&&i.has(t)&&!d;return{by:l+(y?Q:U+F),held:y,behind:S,off:f,stamp:(i.get(t)??m)?.stamp??null,state:h,reason:p?.reason?.en??null}}var Ce=({state:e,reason:t})=>e==="none"?"no such package":t?`it as not loading (${t})`:"it turned off";function st(e,{said:t,unparsed:n=null,off:a,behind:o=!1,state:r,reason:l}){let s="the instance shows what it holds, read-only, so a reader can do nothing with it";return n?`${s}: its kit.js did not parse, so no component of it started, and the console says ${n}`:t.length?`${s}: its component failed as the page started it, and the console says ${t.join("; ")}`:a?`${s}: ${e} is turned off in \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868`:o?`${s}: the server has not taken ${e} as components/ holds it, where it loads: its catalog in use has ${Ce({state:r,reason:l})}`:r==="disabled"&&!l?`${s}: ${e} is turned off in \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868`:r==="broken"||r==="disabled"?`${s}: the server has ${e} as not loading (${l}): gallery component check ${e} says why`:r==="none"?`${s}: the server has not taken ${e} as components/ holds it (its catalog in use has no such package)`:r?`${s}: the page was served before the server took ${e} as components/ holds it, and did not load itself again with it`:`${s}: its component failed or never started, and the console said nothing of it`}var it=(e,t,n)=>t.held?`${e} does not load as components/ holds it (${t.held}), and the server keeps it as it was until components/ has not changed for ${Q/1e3}s, as it keeps a package written file by file`:t.behind?`components/ holds ${e} as loading, and the server's catalog in use still has ${Ce(t)}: it takes what components/ holds once that has not changed for ${F/1e3}s`:n?`${e} or gallery.json changed a moment ago, and the server takes the change once components/ has not changed for ${F/1e3}s, the page served before loading itself again for it`:`the server took ${e} as components/ holds it, and the page served before is to load itself again with it`,rt=(e,t,n)=>t.held?`the server still keeps ${e} as it was`:t.behind?`the server has still not taken ${e} as components/ holds it`:`the server took ${e} as components/ holds it, and the page did not load itself again with it in ${n/1e3}s`;async function lt({root:e,id:t,origin:n,loadedAt:a,loaded:o,told:r=We,say:l=s=>console.log(s)}){let s=Date.now(),i,c=0,u=0,p=!1;for(;;await B(Ze)){let h=await at(e,t,n),d=Date.now();i!==void 0&&h.stamp!==i&&(c=d),i=h.stamp,h.behind&&!u&&(u=d);let f=Math.max(h.by,...[c,u].filter(Boolean).map(y=>y+U+F)),m=o()?"the page loaded itself again":h.off?`gallery.json turns ${t} off now`:a>=f?`the page was asked for after the server took ${t} as components/ holds it`:d>f+r?rt(t,h,r):null;if(m)return p&&l(`Waited ${((d-s)/1e3).toFixed(1)}s: ${m}`),h;p||f-d<=oe&&d-s<=oe||(p=!0,l(`Waiting: ${it(t,h,f>d)}, ${Math.ceil((f+r-d)/1e3)}s more at most`))}}function ct({instance:e,at:t}){return[...document.querySelectorAll(e)].filter(n=>!n.parentElement?.closest(e))[t]??null}function dt(e,t){let n=d=>`<${d.localName}${d.classList.length?` class="${d.getAttribute("class")}"`:""}>`,a;try{a=e.querySelector(t)}catch{return{invalid:!0}}if(!a)return{none:!0,held:[...new Set([...e.querySelectorAll("[class]")].filter(d=>d.getClientRects().length>0).flatMap(d=>[...d.classList].map(f=>`.${f}`)))].slice(0,16)};let o=((a instanceof HTMLElement?a.innerText:a.textContent)??"").replace(/\s+/g," ").trim(),r={named:n(a),words:o.length>40?`${o.slice(0,40)}\u2026`:o},l=[...a.getClientRects()].filter(({width:d,height:f})=>d>0&&f>0);if(!l.length)return{...r,hidden:!0};let{left:s,top:i,right:c,bottom:u,width:p,height:h}=l.reduce((d,f)=>d.width*d.height>=f.width*f.height?d:f);return{...r,box:{left:s,top:i,right:c,bottom:u,x:s+p/2,y:i+h/2}}}function ht(e,{selector:t,x:n,y:a}){let o=e.querySelector(t),r=document.elementFromPoint(n,a);return!r||o.contains(r)?null:`<${r.localName}${r.classList.length?` class="${r.getAttribute("class")}"`:""}>`}function ft(e,{at:t,to:n}){let[a,o]=[e.querySelector(t),e.querySelector(n)];return a===o?"same":a.contains(o)?"inside":null}function ut(e){let t=a=>a instanceof Element?`<${a.localName}${a.classList.length?` class="${a.getAttribute("class")}"`:""}>`:"the page",n={edits:[],states:[],started:null,dropped:null,effect:null};addEventListener("doc-component-edit",a=>{a.target===e&&n.edits.push({taken:a.defaultPrevented,parts:(a.detail?.parts??[]).map(({name:o})=>o)})}),new MutationObserver(a=>{for(let{oldValue:o}of a)n.states.push(o);n.states.push(document.documentElement.getAttribute("data-ge-save"))}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-ge-save"],attributeOldValue:!0}),document.addEventListener("dragstart",a=>{n.started=t(a.target)},!0),document.addEventListener("drop",a=>{n.dropped=t(a.target)},!0),document.addEventListener("dragend",a=>{n.effect=a.dataTransfer?.dropEffect??null},!0),globalThis.__galleryTry=n}async function wt(e,{still:t,step:n}){let a=()=>new Promise(r=>{requestAnimationFrame(r),setTimeout(r,100)});await a(),await a();let o=e.outerHTML;for(let r=0,l=Date.now()+t;r<3;){if(Date.now()>l)return null;await new Promise(i=>setTimeout(i,n));let s=e.outerHTML;r=s===o?r+1:0,o=s}return o}function pt(e,t,{left:n,top:a,right:o,bottom:r}){let l=0;for(let[s,i,c,u]of[[e.x,t.x,n,o],[e.y,t.y,a,r]]){if(i===s)continue;let[p,h]=[(c-s)/(i-s),(u-s)/(i-s)];l=Math.max(l,Math.min(p,h))}return l*Math.hypot(t.x-e.x,t.y-e.y)}function gt(e,t){let n=Math.hypot(t.x-e.x,t.y-e.y),a=i=>n===0?{x:e.x,y:e.y}:{x:e.x+(t.x-e.x)*i/n,y:e.y+(t.y-e.y)*i/n},o=Math.min(te,n),r=pt(e,t,t)-qe,l=r>o?r:n,s=[a(o/2),a(o)];for(let i=1;i<=be;i++)s.push(a(o+(l-o)*i/be));return l!==n&&s.push({x:t.x,y:t.y}),s}var W={press:"press",drag:"drag",key:"key"},q=(e,{named:t,words:n})=>`${e} (${t}${n?` "${n}"`:""})`,Ee=e=>Object.assign(new v(e),{unfound:!0});async function mt(e,t,n){let a=async i=>{let c=await $(t.evaluate(dt,i),"the page was asked what the selector finds");if(c.invalid)throw new v(`Not a selector: ${i}.`);if(c.none)throw Ee(`Nothing in the instance is ${i}${c.held.length?`: what it shows has ${c.held.join(", ")}`:": it shows nothing with a class"}.`);if(c.hidden)throw Ee(`${i} finds ${c.named} in the instance, which is not shown (it has no box on the page), so a reader cannot reach it: name what it shows.`);return c},o=await a(n.at);if(n.kind==="press"){let{x:i,y:c}=o.box,u=await $(t.evaluate(ht,{selector:n.at,x:i,y:c}),"the page was asked what stands at the press");return await e.mouse.move(i,c),await e.mouse.down(),await e.mouse.up(),{said:`a press on ${q(n.at,o)}, with the pointer at its middle`,over:u}}if(n.kind==="drag"){let i=await a(n.to),c=await $(t.evaluate(ft,{at:n.at,to:n.to}),"the page was asked where the drag ends");if(c)throw new v(`${c==="same"?`--drag and --to find the same element, ${o.named}`:`--to ${n.to} finds ${i.named}, which stands in what --drag ${n.at} finds, ${o.named}`}: a drag ends where it is dropped, on another element of the instance (another column, another row), which --to names.`);if(Math.hypot(i.box.x-o.box.x,i.box.y-o.box.y)<te)throw new v(`The middles of what --drag ${n.at} and --to ${n.to} find stand less than ${te}px apart, too near for a drag to start: name with --to where it is dropped, further off.`);let u=gt(o.box,i.box);await e.mouse.move(o.box.x,o.box.y),await e.mouse.down();for(let{x:p,y:h}of u)await e.mouse.move(p,h);return await B(Ge),await e.mouse.up(),{said:`a drag of ${q(n.at,o)} to ${q(n.to,i)}, with the pointer in ${u.length} moves, released as it comes onto it`}}let r=await t.$(n.at);await $(r.focus(),"the focus went to the element");let l=await $(e.evaluate(i=>document.activeElement===i||i.contains(document.activeElement)?null:`<${document.activeElement?.localName??"body"}>`,r),"the page was asked where the focus is"),s=n.keys.slice(0,-1);for(let i of s)await e.keyboard.down(i);await e.keyboard.press(n.keys.at(-1));for(let i of s.toReversed())await e.keyboard.up(i);return{said:`${n.key} pressed with the focus given to ${q(n.at,o)}, as Tab gives it`,unfocused:l}}var $t=e=>fetch(`${e}/__gallery/workspace/info`,{signal:AbortSignal.timeout(2e3)}).then(t=>t.ok,()=>!1);async function Te(e,t,n){let a=Date.now();for(let o=0,r=0;;await B(100)){let{seen:l,now:s}=await $(e.evaluate(c=>({seen:globalThis.__galleryTry.states.slice(c),now:document.documentElement.getAttribute("data-ge-save")}),t),"the page was asked where saving stands"),i=s!=="saved"||l.some(c=>c!=="saved");if(i&&s==="saved")return"saved";if(s==="stopped"||s==="reloading")return s;if(o=s==="held"?o+1:0,o>=3)return"held";if(r=s==="offline"?r+1:0,r>0&&r%10===0&&!await $t(n))return"offline";if(!i&&Date.now()-a>Ke)return"unchanged";if(Date.now()-a>ne)return s}}var _=e=>({held:"a card waits for a reader: someone else changed the part meanwhile, and the page held its write for the reader there, which closing the page dropped",offline:"the page could not reach the server (offline)",stopped:"the page stopped saving (stopped): the server refused its write",reloading:"the page loaded itself again (doc.html or a package it holds changed meanwhile)",waiting:`it waited ${ne/1e3}s to be saved and never was`,syncing:`its save took more than ${ne/1e3}s`})[e];function yt(e,{parts:t,outside:n,gone:a},{gesture:o,name:r,held:l=!1,keep:s=!1}){let i=n?`; outside the instance's parts -${n.removed} +${n.added} lines someone else wrote meanwhile, which stay`:"";return a?{unverified:`${e}, and ${r} holds the instance no more where it stood: someone else wrote the file meanwhile`}:t.length===0?{unverified:`${e}: ${r} is as it was${n?" in the instance's parts":""} (data-block-id aside)${i}`}:l?{unverified:`${e}: what ${r} holds of ${R(t)} is someone else's, which stays${i}`}:s?{unverified:`${e}: ${r} holds what the ${o} wrote, ${R(t)}, kept (--keep)${i}`}:{problem:`${e}, and ${r} holds what the ${o} wrote, ${R(t)}${i}: put that back yourself, ${r} read again first${n?", keeping what someone else wrote":""}`}}function kt(e,t,{over:n,unfocused:a,refusals:o,name:r}){let l=[];return n&&l.push(`the press landed on ${n}, which stands over it there`),a&&l.push(`the element takes no focus (a button, a field or a tabindex), so the key went to ${a}`),t.started&&!t.dropped?l.push(`an HTML5 drag started (dragstart on ${t.started}) and nothing took its drop where it was released (dragend's dropEffect ${t.effect??"none"}): a list a card is dropped on cancels dragenter as well as dragover (preventDefault), or a release as the pointer comes onto it drops nothing`):t.dropped&&t.edits.length===0&&l.push(`it was dropped on ${t.dropped}, and no context.edit came of it`),t.edits.some(({taken:s})=>s)?l.push("context.edit was taken, and its change left what the parts hold as it was"):t.edits.length?l.push(`context.edit was called and the page refused it${o.length?`: the console says ${o.join("; ")}`:""}`):t.started||l.push(`no context.edit came of it: the component answers no ${e} there, or asked while context.canEdit() was false`),`the ${W[e]} wrote nothing to ${r}: ${l.join("; ")}`}async function bt(e,t){let n={own:new Map,others:new Map,dialogs:new Map,pending:[],page:0,from:0},a=new RegExp(`/__gallery/components/${t}/kit\\.js[^:\\s)]*:(\\d+)`),o=(l,s,{at:i="",unparsed:c=!1}={})=>{if(s<n.from)return;let u=l.split(`
|
|
8
|
-
`)[0],p=a.exec(l)??a.exec(i);l.includes(t)||p?n.own.set(u,{line:Number(p?.[1])||null,page:s,unparsed:c&&a.test(i)}):n.others.set(u,{page:s})};e.on("request",l=>{l.isNavigationRequest()&&l.frame()===e.mainFrame()&&(n.page+=1)}),e.on("console",l=>{if(!["error","warn","warning"].includes(l.type())||/^Failed to load resource/.test(l.text()))return;let{page:s}=n;n.pending.push(Promise.all(l.args().map(i=>i.evaluate(c=>c instanceof Error?c.stack:String(c)).catch(()=>""))).then(i=>o(i.join(" ")||l.text(),s)))});let r=await ye(e,{add:l=>n.dialogs.set(l,{page:n.page})});return r.on("Runtime.exceptionThrown",({exceptionDetails:{exception:l,text:s,url:i,lineNumber:c,stackTrace:u}})=>{o(l?.description??String(l?.value??s),n.page,{at:i?`${i}:${c+1}`:"",unparsed:!u&&l?.className==="SyntaxError"})}),await r.send("Runtime.enable"),n}function vt(e){e.from=e.page;for(let t of[e.own,e.others,e.dialogs])for(let[n,{page:a}]of t)a<e.from&&t.delete(n)}var G=e=>Promise.race([Promise.all(e.pending),B(2e3)]);async function xt(e){let t=n=>e.waitForSelector(n,{timeout:V}).catch(a=>{if(a.name==="TimeoutError")throw a;return e.waitForSelector(n,{timeout:V})});try{return await t("[data-doc-ready]"),await t("html[data-ge-editing][data-ge-save]"),await e.waitForFunction(()=>globalThis.__galleryTryEditable===!0&&document.documentElement.getAttribute("data-ge-save")==="saved",{timeout:V}),!0}catch(n){if(n.name!=="TimeoutError")throw n;return!1}}async function Et(e,{at:t,id:n}){let a=await $(e.evaluateHandle(ct,{instance:Se,at:t}),"the page was asked for the instance"),o=await $(a.evaluate((r,{fallback:l,id:s})=>!(r instanceof Element)||r.getAttribute("data-doc-component")!==s?null:(DocKit.reveal?.(r),{fallback:r.hasAttribute(l),height:r.getBoundingClientRect().height}),{fallback:Re,id:n}),"the page was asked for the instance");return o?(await e.setViewport({width:Le,height:Math.min(Ve,Math.max(Ie,Math.ceil(o.height)+240))}),await $(a.evaluate(r=>r.scrollIntoView({block:"center",behavior:"instant"})),"the instance was brought into view"),await $(a.evaluate(wt,{still:pe,step:ge}),"the instance held still"),{host:a,fallback:o.fallback}):null}async function Tt(e){await $(e.evaluate(({instance:t,fields:n})=>{let a=document.activeElement;a instanceof HTMLElement&&a.closest(t)&&a.matches(n)&&a.blur()},{instance:Se,fields:_e}),"the focus left the instance's field"),await e.keyboard.down("Control"),await e.keyboard.press("z"),await e.keyboard.up("Control")}var At=3;async function St(e,{root:t,address:n,at:a,gesture:o,keep:r,file:l,name:s,line:i,found:c,out:u}){let p=await e.createBrowserContext(),h=await p.newPage(),d=await bt(h,c.id),f={problems:[],notes:[]},m=(w,b=`${s}:${i}`)=>f.problems.push({where:b,what:w}),y=W[o.kind],S=new URL(n).origin,k=0,M=0;h.on("request",w=>{!w.isNavigationRequest()||w.frame()!==h.mainFrame()||(k+=1,M=Date.now())});let L=null,N=null,T=async()=>tt(ve(N),ve(await C.readFile(l,"utf8").catch(()=>"")),a,c),A=(w,b,I=!1)=>{let D=yt(w,b,{gesture:y,name:s,held:I,keep:r});return D.problem&&m(D.problem),{...f,unverified:D.unverified}};await h.evaluateOnNewDocument(()=>addEventListener("doc-editable",()=>{globalThis.__galleryTryEditable=!0})),await h.setViewport({width:Le,height:Ie}),await h.emulateMediaFeatures([{name:"prefers-color-scheme",value:"light"}]);try{await $(h.goto(n,{waitUntil:"load",timeout:0}),"the page opened",we);let w=null,b=null;for(let x=1;!w;x++){let g=k;try{if(!await xt(h))return{...f,unverified:`the page did not come to edit in ${V/1e3}s, so nothing was tried`};if(w=await Et(h,{at:a,id:c.id}),!w)return{...f,unverified:`the page does not hold the instance where ${s} has it (${s} changed meanwhile?), so nothing was tried`};if(await B(Math.max(0,await nt(t,l)-Date.now())),w.fallback&&(b=await lt({root:t,id:c.id,origin:S,loadedAt:M,loaded:()=>k!==g})),k!==g)throw new Error("the page loaded itself again");if(w.fallback)break;if(N=await C.readFile(l,"utf8"),await $(w.host.evaluate(ut),"the page was asked to listen"),k!==g)throw new Error("the page loaded itself again")}catch(E){if(k===g||x===At)throw E;w=null,vt(d)}}let{host:I}=w;if(w.fallback){await G(d);let x=[...d.own].map(([g,{line:E,unparsed:De}])=>({words:`${g}${E?` (kit.js:${E})`:""}`,unparsed:De}));return d.own.clear(),m(st(c.id,{said:x.map(({words:g})=>g),unparsed:x.find(({unparsed:g})=>g)?.words??null,...b})),await Ae(I,f,u)}L=k;let D=await mt(h,I,o);f.gesture=D.said;let Z=await Te(h,0,S),Me=await $(h.evaluate(()=>globalThis.__galleryTry),"the page was asked what it heard");await Ae(I,f,u);let O=await T();if(_(Z))return A(`after the ${y}, ${_(Z)}`,O,Z==="held");if(O.gone)return A(`after the ${y}`,O);if(f.others=O.outside,O.parts.length===0){await G(d);let x=[...d.own.keys()].filter(g=>g.includes("context.edit"));for(let g of x)d.own.delete(g);return m(kt(o.kind,Me,{...D,refusals:x,name:s})),f}f.wrote={parts:O.parts,plain:z(N).changes.length>0};for(let{name:x,how:g}of O.parts)g&&f.notes.push({where:`${s}:${i}`,what:`the ${y}'s write lays the part ${x} out anew (${g}): ${me}`});if(!r){let x=await $(h.evaluate(()=>globalThis.__galleryTry.states.length),"the page was asked where saving stands");await Tt(h);let g=await Te(h,x,S),E=await T();if(k>L)return A(`after the ${y}, ${_("reloading")}`,E);if(_(g))return A(`after one Ctrl+Z, ${_(g)}`,E,g==="held");if(E.gone)return A("after one Ctrl+Z",E);g==="unchanged"?m(`one Ctrl+Z wrote nothing, so ${s} keeps what the ${y} wrote: put the part back yourself, ${s} read again first`):E.parts.length?m(`after one Ctrl+Z ${s} is not as it was, ${R(E.parts)} still differing: put that back yourself, ${s} read again first`):f.undone=!0,f.others=E.outside??f.others}return f.others&&(f.unverified=`someone else wrote ${s} meanwhile, outside the instance's parts (the user's page, an Agent), which stays${r?"":": try it again once the file holds still"}`),f}catch(w){if(w instanceof v){if(!w.unfound||(await G(d),d.own.size===0&&d.dialogs.size===0))throw w;return m(`${w.message[0].toLowerCase()}${w.message.slice(1).replace(/\.$/,"")}; its component did not draw it, and the console says why`),f}let b=L===null?null:await T();if(b&&k>L)return A(`after the ${y}, ${_("reloading")}`,b);if(await ke(e)){let I=`the browser went while waiting until ${w.doing??"the page answered"}`;return b?A(I,b):{...f,unverified:`${I}, so nothing was tried`}}return w.stuck?m(`the page stopped answering while waiting until ${w.doing}: a script that never ends, or a component that changes what it hears`,"the page"):m(`the trial stopped: ${J(w)}`,"the page"),b?A(`after the ${y} the trial stopped`,b):f}finally{await G(d);for(let[w,{line:b}]of d.own)f.problems.push({where:b?`kit.js:${b}`:"the page",what:`the console says ${w}`});for(let w of d.others.keys())f.notes.push({where:"the page",what:`the console says ${w}`});for(let w of d.dialogs.keys())f.problems.push({where:"the page",what:`it opened a dialog (${w}), which stops a reader's page until it is answered: show what it says in the instance`});await p.close().catch(()=>{})}}async function Ae(e,t,n){let a=P.join(n,"after.png");try{await $(e.screenshot({path:a}),"the instance was pictured"),t.picture=a}catch(o){if(o.stuck)throw o}return t}var j={gesture:"Gesture: ",wrote:"Wrote: ",undone:"Undone: ",kept:"Kept (--keep): ",picture:"Picture of the instance after the "},Lt="nothing outside the instance changed (data-block-id aside)";function It({slug:e,name:t,gesture:{kind:n},keep:a},o){let r=[];o.gesture&&r.push(`${j.gesture}${o.gesture}`);for(let{where:s,what:i}of o.problems)r.push(` FAIL ${s}: ${i}`);for(let{where:s,what:i}of o.notes)r.push(` note ${s}: ${i}`);if(o.wrote){let s=o.wrote.plain?"; and the page wrote the document's plain HTML as the kit's markup, as its first save of an edit does (gallery check and gallery export say what, by line, once), which stays":"",i=o.others?`; outside the instance's parts -${o.others.removed} +${o.others.added} lines someone else wrote meanwhile (the user's page, an Agent), which stay`:`; ${Lt}`;r.push(`${j.wrote}${R(o.wrote.parts)}${i}${s}`),a?r.push(`${j.kept}${t} holds what it wrote`):o.undone&&r.push(`${j.undone}one Ctrl+Z, and ${o.others?`the instance's parts in ${t} are as they were`:`${t} is as it was`} (data-block-id aside${o.wrote.plain?", its plain HTML the kit's markup":""})`)}o.picture&&r.push(`${j.picture}${W[n]}: ${H(o.picture)}`);let l=o.problems.length;return l?{lines:[...r,`FAIL ${e}: ${l} problem${l===1?"":"s"}`],code:1}:o.unverified?{lines:[...r,`UNVERIFIED ${e}: ${o.unverified}`],code:3}:{lines:[...r,`OK ${e}: the ${W[n]} wrote ${o.wrote.parts.map(({name:s})=>s).join(" and ")}${a?", kept (--keep)":", and one Ctrl+Z took it back"}`],code:0}}async function Kt(e,{named:t,values:n,key:a,keep:o}){let r=await ze(n,a);if(t.length===0)throw new v("Name the document: gallery component try <slug> [<instance id>] and the gesture.");if(t.length>2)throw new v("gallery component try takes a document and an instance's id at most.");let{slug:l,block:s}=await ie(t[0]),i=He(Be(l,e)).html,c=await C.readFile(i,"utf8").catch(()=>null);c===null&&(console.error(`No document "${l}": ${H(i)} does not exist (gallery list lists those there are).`),process.exit(1));let u=Ne(c);u.length===0&&(console.error(`${l} holds no instance of a component package (an element with ${ae}): gallery component list says which there are, and gallery component show <id> how to write one.`),process.exit(1));let p=P.basename(i),h=Xe(u,t[1]??s,{slug:l,name:p}),{id:d,line:f}=u[h],m=Y(e),y=m.packages.get(d);if(!y){let T=m.problems.get(d);console.error(T?.off?`${d} is turned off in \u8BBE\u7F6E \u203A \u7EC4\u4EF6\u5217\u8868: its instances show what they hold, read-only, so a reader can do nothing with them.`:T?`${d} does not load, so its instances show what they hold, read-only: gallery component check ${d} says why.`:`No component ${d} in this workspace, so its instance shows what it holds, read-only: gallery component list says which there are.`),process.exit(1)}console.log(`${d} in ${l}, ${p}:${f}: ${H(i)}`);let S=await de({slug:l,command:`gallery component try ${l}`});if(!S.ok){console.log(`UNVERIFIED ${l}: ${S.message}`),process.exitCode=3;return}let k=ce(S.port,l);console.log(`Page: ${k} (the document's page alone, editable: the Agent's own; the server runs on after this command)`);let M=he();if(!M){console.log(`UNVERIFIED ${l}: no Chrome, Edge or Chromium found (GALLERY_BROWSER=<its executable> picks one), so nothing was tried`),process.exitCode=3;return}let L;try{L=await ue({executablePath:M,args:fe()})}catch(T){console.log(`UNVERIFIED ${l}: the browser ${M} did not start, twice, each time with a fresh profile (${J(T)}; GALLERY_BROWSER=<its executable> picks another), so nothing was tried`),process.exitCode=3;return}let N=P.join(se(e).qa,l,"try");try{await C.rm(N,{recursive:!0,force:!0}),await C.mkdir(N,{recursive:!0});let{lines:T,code:A}=It({slug:l,name:p,gesture:r,keep:o},await St(L.browser,{root:e,address:k,at:h,gesture:r,keep:o,file:i,name:p,line:f,found:y,out:N}));console.log(T.join(`
|
|
9
|
-
`)),process.exitCode=A}finally{await L.close()}}export{Lt as INSIDE_ALONE,j as TRY_LINES,ve as asShown,tt as changesOf,Xe as chosenInstance,yt as cutOffSaid,gt as dragPath,st as fallbackSaid,ze as gestureOf,Ne as instancesIn,Ye as keysOf,bt as listen,kt as nothingSaid,vt as takenAgain,at as takenBy,nt as toldBy,It as trialSaid,Kt as tryCommand,lt as untilTaken,et as withoutIds};
|
package/dist/chunk-JPOSLGOC.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{a as he,b as qt}from"./chunk-342HXE3Q.mjs";import{c as ce,d as de}from"./chunk-FDLXYYG4.mjs";import{b as oe}from"./chunk-4FS7Z7WR.mjs";import{a as ne,b as se,c as ae,d as ie,e as re,f as le}from"./chunk-DFUDV4LX.mjs";import{a as We,b as Vt,c as Qt,d as Zt,f as te,g as je,h as ee,k as Le,l as Ie}from"./chunk-Y6RLRPG3.mjs";import"./chunk-6RGJOMJP.mjs";import"./chunk-QJIR2BLP.mjs";import"./chunk-P2CAZPDP.mjs";import"./chunk-E7LWZRXY.mjs";import{b as Wt,j as Kt}from"./chunk-NSKUTQ5J.mjs";import"./chunk-AUZGSZJH.mjs";import{g as Jt}from"./chunk-BGGDRNYQ.mjs";import"./chunk-6QXGZM36.mjs";import"./chunk-UALRNVSE.mjs";import"./chunk-W3BGBJQW.mjs";import"./chunk-JVHHHGEA.mjs";import{a as Xt}from"./chunk-HYMEEXKN.mjs";import"./chunk-TYK6VNAB.mjs";import"./chunk-CY2FNNAB.mjs";import{a as Pt}from"./chunk-UMHUSOPJ.mjs";import"./chunk-L3QKH4OK.mjs";import"./chunk-W4VKN3GF.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";import{spawnSync as Fe}from"node:child_process";import vt from"node:fs/promises";import ht from"node:path";import{pathToFileURL as Pe}from"node:url";import{MATH_IGNORED_TAGS as Ve}from"../browser/shared/components/math.mjs";import{exportPackagesOf as _e,exportSourceOf as De,packagesSaid as He}from"../browser/shared/export-wrap.mjs";import{sha256 as fe}from"../browser/shared/files.mjs";import{attr as ue}from"../browser/shared/html-tree.mjs";import{projectRoot as ze,qaDirectory as Ue,reportsDirectory as Rt}from"../browser/shared/paths.mjs";import{documentDirectory as jt,documentFiles as Lt}from"../browser/shared/workspace.mjs";import{KINDS as Uo,LEVELS as At,LOOKS as pe,WIDE as Go,WIDTHS as ge,layoutNotesOf as Ge,levelOf as Me}from"../browser/shared/qa-levels.mjs";import{tableHidesScript as Ye}from"../browser/shared/table-hides.mjs";var Ke=new Set(["code-scrolls","formula-scrolls"]),Ce=(e,n)=>e.level??Me(e.kind,n),Xe=(e,n)=>["fail","warn"].includes(Ce(e,n))||Ke.has(e.kind)&&Me(e.kind,n)==="info",Je=4,Ee=12,Qe=8,Ze=2,me=200,to=2e3,we=600;function eo({block:e,above:n=null,below:s=null}){let c=[e,n,s].filter(Boolean),r=Math.min(...c.map(h=>h.left)),u=Math.max(...c.map(h=>h.right)),w=n?Math.max(Math.min(n.top,e.top),e.top-me):e.top,d=s?Math.min(Math.max(s.bottom,e.bottom),e.bottom+me):e.bottom,$=(h,q)=>({x:Math.max(0,r),y:Math.max(0,h),width:u-r,height:q-Math.max(0,h)});return e.bottom-e.top<=to?[{part:"",clip:$(w,d)}]:[{part:"top",clip:$(w,e.top+we)},{part:"bottom",clip:$(e.bottom-we,d)}]}function $e(e,n=""){if(e.startsWith("data:"))return`${e.slice(0,30)}\u2026 (${e.length} characters)`;let s=n.slice(0,n.lastIndexOf("/")+1);if(s&&e.startsWith(s)&&e.length>s.length)try{return decodeURIComponent(e.slice(s.length))}catch{return e.slice(s.length)}return e.length>60?`\u2026${e.slice(-59)}`:e}var It=e=>String(e??"").replace(/\s+/g," ").trim(),Mt=(e,n=40)=>{let s=It(e);return`"${s.length>n?`${s.slice(0,n-1)}\u2026`:s}"`},oo=e=>String(e??"").replace(/\s+/g,"").slice(0,120);function no(e,n="doc.html"){let s=new Map,c=new Map,r=new Map,u=($,h)=>(h&&$.sourceCodeLocation.attrs?.[h]||$.sourceCodeLocation).startLine,w=new Map,d=$=>{if($.nodeName==="#text")return $.value;if(!$.tagName&&$.nodeName!=="#document"||$.tagName==="template")return"";let h=($.childNodes??[]).map(d).join("");if(!$.tagName||!$.sourceCodeLocation)return h;let q=ue($,"data-block-id");q!==void 0&&!s.has(q)&&s.set(q,u($,"data-block-id"));let L=ue($,"id");L!==void 0&&!c.has(L)&&c.set(L,u($,"id"));let U=oo(h);if(U.length>=2){let m=`${$.tagName}|${U}`;w.has(m)||w.set(m,[]),w.get(m).push($.sourceCodeLocation)}return h};d(Xt(e));for(let[$,h]of w)r.set($,h.sort((q,L)=>q.startOffset-L.startOffset).map(q=>q.startLine));return{blocks:s,ids:c,texts:r,name:n}}function so(e,n){if(!e)return"the page";let s=n.name??"doc.html",c=h=>{let q=h&&n.texts.get(`${h.tag}|${h.words}`);return q?.[Math.min(h.nth??0,q.length-1)]},r=e.table||e.header?.text,u=e.card?` card ${Mt(e.card.text)}`:r?` table ${Mt(r)}`:"",w=e.blocks?.find(h=>n.blocks.has(h));if(w!==void 0)return`${s}:${n.blocks.get(w)} [data-block-id="${w}"]${u}`;if(c(e.card))return`${s}:${c(e.card)} card ${Mt(e.card.text)}`;if(c(e.header))return`${s}:${c(e.header)} table ${Mt(r)}`;let d=e.texts?.find(c);if(d)return`${s}:${c(d)} ${d===e.texts[0]&&d.tag===e.tag?"":`${e.element} in `}<${d.tag}> ${Mt(d.text,32)}`;let $=e.ids?.find(h=>n.ids.has(h));return $!==void 0?`${s}:${n.ids.get($)} #${$}${u}`:c(e.section)?`${s}:${c(e.section)} ${e.element} in the section ${Mt(e.section.text)}`:`${e.element}${u} (not found in ${s})`}function Ut(e){let n=new Date(e),s=u=>String(u).padStart(2,"0"),c=-n.getTimezoneOffset(),r=`${c<0?"-":"+"}${s(Math.floor(Math.abs(c)/60))}:${s(Math.abs(c)%60)}`;return`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())}T${s(n.getHours())}:${s(n.getMinutes())}:${s(n.getSeconds())}${r}`}function ao(e,n,s={said:"",now:""}){return e===n?s.said===s.now?{stale:!1,why:""}:{stale:!0,packaged:!0,why:`it holds ${s.said||"no component package"}, the workspace has ${s.now||"none of them"}`}:{stale:!0,why:e?`made from a text whose sha256 is ${e.slice(0,12)}\u2026, the file's is ${n.slice(0,12)}\u2026`:"it does not say which text it was made from: made before exports said it, or before the kit's names were doc-* (2026-10-26), whose pages gallery qa no longer reads"}}async function Gt(e,{made:n=!1}={}){let s=Lt(jt(e,Rt)).html,c=qt(e),[r,u]=await Promise.all([vt.readFile(s).catch(()=>null),vt.stat(c).catch(()=>null)]);if(!r)return{problem:`${e}: no document (${s})`};if(!u)return{problem:`${e}: no export (${c}): run gallery export ${e} first`,missing:!0};let w=await vt.readFile(c),d=w.toString("utf8"),$=De(d),h={said:_e(d),now:He(Jt(r.toString("utf8")))},{stale:q,why:L,packaged:U=!1}=ao($,fe(r),h);return q&&!n?{problem:`${e}: ${c} is not of ${s} as it is now (${L}): run gallery export ${e} first`,stale:!0,why:L,edited:!!$&&!U,packaged:U}:{file:c,sha256:fe(w),time:u.mtimeMs}}function io(e,n){let s=e.map((w,d)=>({length:1,weight:n[d],previous:-1})),c=(w,d)=>w.length>d.length||w.length===d.length&&w.weight>d.weight;e.forEach((w,d)=>{for(let $=0;$<d;$++){if(e[$]>=w)continue;let h={length:s[$].length+1,weight:s[$].weight+n[d],previous:$};c(h,s[d])&&(s[d]=h)}});let r=-1;s.forEach((w,d)=>{(r<0||c(w,s[r]))&&(r=d)});let u=[];for(let w=r;w>=0;w=s[w].previous)u.unshift(w);return u}function qe(e,n){let s=n?.places??{},c=new Set((n?.moved??[]).filter(u=>e.has(u))),r=new Map;for(let[u,{parent:w,size:d=0}]of e){let $=s[u];if($){if($[0]!==w){c.add(u);continue}r.has(w)||r.set(w,[]),r.get(w).push({id:u,at:$[1],size:d})}}for(let u of r.values()){let w=new Set(io(u.map(({at:d})=>d),u.map(({size:d})=>d)).map(d=>u[d].id));for(let{id:d}of u)w.has(d)||c.add(d)}return c}function ro(e,n,s,{named:c=null,verified:r=!0,failed:u=!1,seen:w=null,page:d=void 0,packages:$=void 0}={}){if(!r||u||c&&!n)return null;let h=w??new Set([...s.ids,...[...s.held?.values()??[]].flat()]),q=!n,L=q||s.pageChanged?s.cards??[]:[],U=[...n?.unseen??[],...L],m={blocks:{},places:{},moved:q?[]:[...qe(e,n)].filter(x=>!h.has(x)),unseen:[...new Set(U)].filter(x=>e.has(x)&&!h.has(x))};for(let[x,{hash:H,parent:M,at:Z}]of e){let X=q||h.has(x)?H:n.blocks[x];X!==void 0&&(m.blocks[x]=X),m.places[x]=[M,Z]}let C=!q&&(c||s.tiles)?n.page:d;typeof C=="string"&&(m.page=C);let D=!q&&(c||s.tiles)?n.packages:$&&Object.fromEntries(Object.entries($).map(([x,H])=>[x,(s.restyled?.get(x)??[]).every(M=>h.has(M))?H:n.packages[x]]));return D&&Object.keys(D).length&&(m.packages=D),m}function Ae(e){let n=new Map;for(let s of e){let c=new Set(s.held?.covered??[]);for(let r of s.held?.missed??[])c.has(r)||n.set(r,[...n.get(r)??[],s.label??String(s.width)])}return n}function lo(e,n){let s=Ae(n);return new Set([...e.ids,...[...e.held?.values()??[]].flat().filter(c=>!s.has(c))])}function xe(e){let n=e.time?` of ${Ut(e.time)}`:"";return e.from==="export"?`the export${n} (the document before these changes)`:e.from==="preview"?`gallery open${n} (the document before these changes)`:"the last look"}var co=3;function ho(e,n,s=null,{tiles:c=!1,page:r=void 0,packages:u=void 0}={}){let w={rest:[],unknown:[],moved:new Set,around:new Map,held:new Map,groups:[],cards:[],pageChanged:!1,changed:new Set,restyled:new Map,left:null},d=[...e.keys()],$=new Map(d.map((a,O)=>[a,O])),h=n?qe(e,n):new Set,q=a=>typeof n?.packages?.[a]=="string"&&typeof u?.[a]=="string"&&n.packages[a]!==u[a],L=n?d.filter(a=>q(e.get(a).package)&&n.blocks[a]===e.get(a).hash&&!h.has(a)):[],U=new Map;for(let a of L)U.set(e.get(a).package,[...U.get(e.get(a).package)??[],a]);let m=new Set(L),C=n?d.filter(a=>n.blocks[a]!==e.get(a).hash||h.has(a)||m.has(a)):[],D=new Set((n?.unseen??[]).filter(a=>e.has(a)&&!C.includes(a))),x=(a,O)=>{let G=null;for(let et=e.get(a).parent;et!==null&&e.has(et);et=e.get(et).parent)O.has(et)&&(G=et);return G},H=new Set(C),M=new Set(C.filter(a=>e.get(a).card||h.has(a))),Z=a=>H.has(a)&&!h.has(a)&&x(a,M)===null,X=new Map;for(let a of d)for(let O=e.get(a).parent;O!==null&&e.has(O);O=e.get(O).parent){let G=X.get(O)??{all:0,changed:0};G.all+=1,Z(a)&&(G.changed+=1),X.set(O,G)}let gt=d.filter(a=>!e.get(a).card&&X.has(a)&&X.get(a).changed>=co&&X.get(a).changed*2>=X.get(a).all);if(s){let a=[...new Set(s)].filter(o=>e.has(o)),O=new Set(a),G=new Map;for(let o of d){let l=O.has(o)?null:x(o,O);l!==null&&G.set(l,[...G.get(l)??[],o])}let et="the blocks named",$t=new Set([...a,...[...G.values()].flat()]),yt=!!n&&typeof n.page=="string"&&typeof r=="string"&&n.page!==r,xt=new Set([...C.filter(o=>e.get(o).card||h.has(o)),...gt]),bt=!n||yt?d.filter(o=>e.get(o).card&&!C.includes(o)):[],Ft=new Set([...xt,...bt]),Nt=[...C,...gt.filter(o=>!H.has(o))].sort((o,l)=>$.get(o)-$.get(l)).filter(o=>!$t.has(o)&&x(o,xt)===null),Tt=Nt.filter(o=>m.has(o)),t={changed:Nt.filter(o=>!m.has(o)),...Tt.length?{restyled:Tt,packages:[...new Set(Tt.map(o=>e.get(o).package))]}:{},cards:bt.filter(o=>!$t.has(o)&&x(o,Ft)===null).sort((o,l)=>e.get(o).rank-e.get(l).rank||$.get(o)-$.get(l)),since:n?xe(n):"",first:!n};return{...w,ids:a,why:et,groups:[{kind:"named",why:et,ids:a,rest:[]}],held:G,pageChanged:yt,changed:new Set(C),restyled:U,left:t,unknown:[...new Set(s)].filter(o=>!e.has(o))}}if(e.size===0)return{...w,ids:[],why:"the document has no block ids (never handed in): the whole page in tiles instead",tiles:!0};if(c)return{...w,ids:[],why:null,tiles:!0};let p=(...a)=>(O,G)=>a.reduce((et,$t)=>et||$t(O)-$t(G),0),A=a=>e.get(a).rank,J=a=>$.get(a),Q=n?xe(n):"",k=!!n&&typeof n.page=="string"&&typeof r=="string"&&n.page!==r,v=d.filter(a=>e.get(a).card&&!C.includes(a)),F=!n||k||C.length===0?v:v.filter(a=>D.has(a)),tt=new Set([...C.filter(a=>e.get(a).card||h.has(a)),...gt]),ct=new Set([...tt,...F]),nt=new Map,at=(a,O)=>a.filter(G=>{let et=x(G,O);return et!==null&&nt.set(et,[...nt.get(et)??[],G]),et===null}),_=[...at(C,tt),...gt.filter(a=>!H.has(a)&&x(a,tt)===null)].sort(p(a=>+!h.has(a),A,J)),ft=_.filter(a=>m.has(a)),dt=_.filter(a=>!m.has(a)),it=at(F,ct).sort(p(a=>+!D.has(a),A,J)),rt="the cards (chart cards, code blocks, whole blocks, components, flowcharts and Sheet areas, then columns and the other figures, then tables)",b=it.some(a=>D.has(a))?", those no look has pictured yet first":"",z=typeof n?.page=="string"&&typeof r=="string",P=n?k?`${rt.replace("the cards","the cards, not changed themselves")}${b}: the document's own <script> or <style> changed since ${Q}, which may draw any of them`:C.length?"the cards no look has pictured yet (not changed themselves)":`${rt}${b}: no block changed since ${Q}${z?", nor the document's own <script> or <style>":""}`:`${rt}: no earlier look to compare with`,K=[...dt.length?[{kind:"changed",why:`the blocks changed since ${Q}${h.size?" (a moved block pictured with the edges of the blocks before and after it, the moved ones first)":""}`,all:dt}]:[],...ft.length?[{kind:"changed",why:`the instances of a package changed since ${Q} (${[...new Set(ft.map(a=>e.get(a).package))].join(", ")})`,all:ft}]:[],...it.length||!_.length?[{kind:"cards",why:P,all:it}]:[]],R=Ee;for(let a of K)a.ids=a.all.slice(0,R),a.rest=a.all.slice(a.ids.length),R-=a.ids.length,delete a.all;let I=K.flatMap(a=>a.ids),i=a=>{let{parent:O,at:G}=e.get(a),et=$t=>d.find(yt=>e.get(yt).parent===O&&e.get(yt).at===G+$t)??null;return[et(-1),et(1)]},T=new Map(I.filter(a=>h.has(a)).map(a=>[a,i(a)])),N=new Map(I.filter(a=>nt.has(a)).map(a=>[a,nt.get(a)]));return{...w,ids:I,why:K[0].why,groups:K,rest:K.flatMap(a=>a.rest),moved:new Set(I.filter(a=>h.has(a))),around:T,held:N,cards:F,pageChanged:k,changed:new Set(C),restyled:U}}function fo(e){let n=m=>!!m.closest("[data-doc-dev]"),s=[...document.querySelectorAll("details")].filter(m=>!n(m)),c=s.filter(m=>!m.open).length;s.forEach(m=>{m.open||m.setAttribute("data-qa-closed",""),m.open=!0});let r=[...document.images].filter(m=>!n(m));r.forEach(m=>{m.loading==="lazy"&&(m.loading="eager")});let u=[...document.querySelectorAll("dialog")].filter(m=>!n(m)&&!m.open);u.forEach((m,C)=>{m.dataset.qaCard=String(C)});let w=m=>m.parentElement?.closest("dialog[data-qa-card]")??null,d=[...document.querySelectorAll("[data-doc-sheets] > .doc-sheet-tabs > [data-sheet-tab]")].filter(m=>!n(m));d.forEach((m,C)=>{m.dataset.qaTab=String(C)});let $=m=>m.parentElement.parentElement,h=m=>{let C=[];for(let D=m.closest("[data-doc-sheet]");D;D=D.parentElement.closest("[data-doc-sheet]")){let x=d.find(H=>$(H)===D.parentElement&&H.getAttribute("data-sheet-tab")===D.getAttribute("data-doc-sheet"));x&&C.unshift(Number(x.dataset.qaTab))}return C},q=d.map((m,C)=>{let D=[...h($(m)),C],x=[...$(m).children].find(M=>M.getAttribute("data-doc-sheet")===m.getAttribute("data-sheet-tab"));x&&(x.dataset.qaPanel=String(C));let H=w(m);return{index:C,chain:D,card:H?Number(H.dataset.qaCard):null,label:(m.textContent??"").replace(/\s+/g," ").trim(),shown:D.every(M=>d[M].getAttribute("aria-selected")==="true"),panel:!!x}}),L=u.map((m,C)=>{let D=`[href="#${CSS.escape(m.id)}"]`,x=[...m.querySelectorAll("h1, h2, h3, h4")].find(M=>M.textContent.trim())??document.querySelector(D),H=[];for(let M=w(m);M;M=w(M))H.unshift(Number(M.dataset.qaCard));return{index:C,chain:h(m),within:H,label:(x?.textContent||m.id||"").replace(/\s+/g," ").trim()}}),U=Promise.all(r.map(m=>m.decode().catch(()=>{})));return Promise.race([U.then(()=>!0),new Promise(m=>setTimeout(()=>m(!1),e))]).then(m=>({details:s.length,closed:c,images:r.length,loaded:m,sheets:q,cards:L}))}function ye(e){let n=document.querySelector(`[data-qa-card="${e}"]`);return n?(n.open||(globalThis.DocDialogs?globalThis.DocDialogs.open(n,null):typeof n.showModal=="function"?n.showModal():n.setAttribute("open","")),document.activeElement?.blur?.(),Promise.all(n.getAnimations({subtree:!0}).map(s=>s.finished.catch(()=>{}))).then(()=>n.open&&n.getClientRects().length>0)):Promise.resolve(!1)}function _t(e){let n=document.querySelector(`[data-qa-card="${e}"]`);n?.open&&(globalThis.DocDialogs?globalThis.DocDialogs.close(n):typeof n.close=="function"?n.close():n.removeAttribute("open"))}async function uo({selector:e,up:n=0,margin:s=0,frames:c=2}){let r=document.querySelector(e);for(let v=0;v<n&&r;v++)r=r.parentElement;if(!r||r.getClientRects().length===0)return null;let u=r.getBoundingClientRect();r.scrollIntoView({block:"nearest",inline:"nearest"});let w=r.getBoundingClientRect();if(u.top!==w.top||u.left!==w.left){let v=()=>new Promise(Y=>{requestAnimationFrame(()=>Y()),setTimeout(Y,100)});for(let Y=0;Y<c;Y++)await v()}let d=v=>v===document.body||v===document.documentElement,$=(v,Y,F)=>{let{left:tt,top:ct,right:nt,bottom:at}=v;for(let _=Y;_&&!d(_);_=_.parentElement){let ft=getComputedStyle(_),dt=ft.overflowX!=="visible",it=ft.overflowY!=="visible";if(dt||it){let rt=_.getBoundingClientRect();dt&&([tt,nt]=[Math.max(tt,rt.left),Math.min(nt,rt.right)]),it&&([ct,at]=[Math.max(ct,rt.top),Math.min(at,rt.bottom)])}if(_===F)break}return nt>tt&&at>ct?{left:tt,top:ct,right:nt,bottom:at}:null},h=v=>parseFloat(v)||0,q=(v,Y)=>{let F=getComputedStyle(v,Y);if(["none","normal"].includes(F.content)||F.display==="none"||!["absolute","fixed"].includes(F.position))return null;let tt=F.position==="fixed"?null:getComputedStyle(v).position!=="static"?v:v.offsetParent,ct=tt?tt.getBoundingClientRect():{left:0,top:0,right:innerWidth,bottom:innerHeight},nt=tt?getComputedStyle(tt):null,at={left:ct.left+h(nt?.borderLeftWidth),top:ct.top+h(nt?.borderTopWidth),right:ct.right-h(nt?.borderRightWidth),bottom:ct.bottom-h(nt?.borderBottomWidth)},_=(b,z)=>F.boxSizing==="border-box"?0:h(F[`padding${b}`])+h(F[`padding${z}`])+h(F[`border${b}Width`])+h(F[`border${z}Width`]),ft=h(F.width)+_("Left","Right"),dt=h(F.height)+_("Top","Bottom"),it=F.left!=="auto"?at.left+h(F.left)+h(F.marginLeft):F.right!=="auto"?at.right-h(F.right)-h(F.marginRight)-ft:null,rt=F.top!=="auto"?at.top+h(F.top)+h(F.marginTop):F.bottom!=="auto"?at.bottom-h(F.bottom)-h(F.marginBottom)-dt:null;return it===null||rt===null||!(ft>0)||!(dt>0)?null:$({left:it,top:rt,right:it+ft,bottom:rt+dt},v,r)},L=[r.getBoundingClientRect()],U=[r];for(let v of r.querySelectorAll("*"))v instanceof SVGElement&&v.ownerSVGElement||v.matches("script, style, template")||v.getClientRects().length===0||getComputedStyle(v).visibility!=="hidden"&&(U.push(v),L.push($(v.getBoundingClientRect(),v.parentElement,r)));for(let v of U)L.push(q(v,"::before"),q(v,"::after"));let m=document.createRange(),C=document.createTreeWalker(r,NodeFilter.SHOW_TEXT);for(let v=C.nextNode();v;v=C.nextNode())if(!(!v.nodeValue.trim()||!v.parentElement||v.parentElement.closest("svg, script, style, template"))){m.selectNodeContents(v);for(let Y of m.getClientRects())L.push($(Y,v.parentElement,r))}m.detach();let D=L.filter(Boolean),x={left:Math.min(...D.map(v=>v.left)),top:Math.min(...D.map(v=>v.top)),right:Math.max(...D.map(v=>v.right)),bottom:Math.max(...D.map(v=>v.bottom))},H=$(x,r.parentElement,null)??x,M=!1;for(let v=r;v&&!M;v=v.parentElement)M=getComputedStyle(v).position==="fixed";let Z=visualViewport.pageLeft,X=visualViewport.pageTop,[gt,p]=M?[Z+innerWidth,X+innerHeight]:[document.documentElement.scrollWidth,document.documentElement.scrollHeight],A=Math.max(M?Z:0,H.left+Z-s),J=Math.max(M?X:0,H.top+X-s),Q=Math.min(gt,H.right+Z+s),k=Math.min(p,H.bottom+X+s);return Q>A&&k>J?{clip:{x:A,y:J,width:Q-A,height:k-J},fixed:M}:null}function be(e){for(let s of e){let c=document.querySelector(`[data-qa-tab="${s}"]`);c&&c.getAttribute("aria-selected")!=="true"&&c.click()}let n=document.querySelector(`[data-qa-panel="${e.at(-1)}"]`);return!!(n&&!n.hidden&&n.getClientRects().length>0)}function Dt({scope:e,next:n,ignored:s=[],place:c,slack:r=4,whole:u=[],drawn:w=[]}){let d=e?document.querySelector(e):document.body,$=[];if(!d)return{found:$,next:n};let h=document.documentElement.clientWidth,q=Math.round,L=t=>String(t??"").replace(/\s+/g," ").trim(),U=(t,o=32)=>{let l=L(t);return`"${l.length>o?`${l.slice(0,o-1)}\u2026`:l}"`},m=t=>!!t.closest?.("[data-doc-dev]"),C=t=>{if(!t.isConnected||t.getClientRects().length===0)return!1;for(let o=t;o&&o.nodeType===1;o=o.parentElement){let l=getComputedStyle(o);if(l.visibility==="hidden"||l.display==="none"||Number(l.opacity)===0||o.matches(".katex-mathml, .sr-only, [role=tooltip], [data-doc-dev]"))return!1}return!0},D=t=>`${t.localName}${[...t.classList].filter(o=>!o.startsWith("is-")).slice(0,2).map(o=>`.${o}`).join("")}`,x=t=>(t.textContent??"").replace(/\s+/g,"").slice(0,120),H=new Map,M=t=>{let o=x(t);if(!H.has(t.localName)){let y=new Map;for(let B of document.getElementsByTagName(t.localName)){if(m(B))continue;let j=x(B);y.has(j)||y.set(j,[]),y.get(j).push(B)}H.set(t.localName,y)}let l=H.get(t.localName).get(o)?.indexOf(t)??0;return{tag:t.localName,words:o,nth:Math.max(0,l),text:L(t.textContent).slice(0,80)}},Z=t=>{let o=t.cloneNode(!0);for(let l of o.querySelectorAll(".doc-tab"))l.before(" \xB7 ");return L(o.textContent).replace(/^· /,"")},X=t=>{let o=t.matches("table")?t:t.querySelector("table"),l=t.closest(".doc-table-wrap")??t,y=l.getAttribute("data-doc-chart-source")?.trim(),j=(y?[...document.querySelectorAll("[data-doc-chart-data]")].find(S=>S.getAttribute("data-doc-chart-data").trim()===y&&!m(S)):null)?.closest("figure")?.querySelector(":scope > h2, :scope > h3, :scope > h4, :scope > figcaption"),f=l.previousElementSibling;return L(o?.caption?.textContent)||L(j?.textContent)||(f?.matches("p.doc-note")?Z(f):"")||L(o?.querySelector("th")?.textContent??o?.rows[0]?.cells[0]?.textContent)},gt=t=>{let o=t.nodeType===1?t:t.parentElement,l=[],y=[];for(let g=o;g&&g!==document.documentElement;g=g.parentElement)g.hasAttribute("data-block-id")&&l.push(g.getAttribute("data-block-id")),g.id&&!g.hasAttribute("data-qa-tab")&&!g.hasAttribute("data-qa-panel")&&y.push(g.id);let B=[];for(let g=o,W=0;g&&W<4&&!g.matches("body, main, section, [data-doc-sheet], [data-doc-sheets], .doc-columns, .doc-column");g=g.parentElement,W++){let ot=M(g);ot.words.length>=2&&B.push(ot)}let j=o.closest("figure")?.querySelector(":scope > h3, :scope > figcaption, :scope > .doc-figure-caption"),f=o.closest(".doc-table-wrap, table"),S=f?.querySelector("th"),E=o.closest("section")?.querySelector(":scope > h2, :scope > h3, :scope > h4");return{blocks:l,ids:y,texts:B,tag:o.localName,element:D(o),card:j?M(j):null,header:S?M(S):null,table:f?X(f).slice(0,80):null,section:E?M(E):null}};if(c){let t=document.querySelector(c);return{found:$,next:n,anchor:t?gt(t):null}}let p=t=>(t.dataset.qaShot||(t.dataset.qaShot=String(++n)),Number(t.dataset.qaShot)),A=(t,o,l,{picture:y=o,url:B,measured:j,scroll:f,level:S}={})=>$.push({kind:t,what:l,anchor:o?gt(o):null,shot:y?p(y):null,seen:!!(y&&C(y)),url:B,measured:j,scroll:f,...S?{level:S}:{}}),J=t=>t.closest("figure")??t.closest("[data-doc-chart]")??t,Q=t=>{let o=t.getBoundingClientRect();return o.width>0&&o.height>0},k=(t,o,{x:l=!0,y=!0}={})=>Math.max(l?o.left-t.left:-1/0,l?t.right-o.right:-1/0,y?o.top-t.top:-1/0,y?t.bottom-o.bottom:-1/0),v=t=>({left:Math.min(...t.map(o=>o.x)),right:Math.max(...t.map(o=>o.x)),top:Math.min(...t.map(o=>o.y)),bottom:Math.max(...t.map(o=>o.y))}),Y=t=>{let o=t.getBBox(),l=t.getScreenCTM();return v([[o.x,o.y],[o.x+o.width,o.y],[o.x+o.width,o.y+o.height],[o.x,o.y+o.height]].map(([y,B])=>new DOMPoint(y,B).matrixTransform(l)))},F=t=>{let o=[];for(let l=t.parentElement;l&&l!==document.documentElement;l=l.parentElement){let y=getComputedStyle(l);l instanceof SVGSVGElement&&y.overflow!=="visible"&&o.push(["the svg's edge",l.getBoundingClientRect(),{}]);let B=/url\(\s*["']?#([^)"']+)/.exec(`${l.getAttribute?.("clip-path")??""} ${y.clipPath??""}`)?.[1],j=B?document.getElementById(B):null,f=j?.getAttribute("clipPathUnits")!=="objectBoundingBox"?j?.querySelector("rect"):null;if(f&&l.getScreenCTM){let[S,E,g,W]=["x","y","width","height"].map(ot=>f[ot].baseVal.value);o.push(["a clip-path",v([[S,E],[S+g,E+W]].map(([ot,lt])=>new DOMPoint(ot,lt).matrixTransform(l.getScreenCTM()))),{}])}if(!(l instanceof SVGElement)){let S=/hidden|clip/.test(y.overflowX),E=/hidden|clip/.test(y.overflowY);(S||E)&&o.push([D(l),l.getBoundingClientRect(),{x:S,y:E}])}}return o},tt=t=>`${t.slice(0,4).join("; ")}${t.length>4?`; ${t.length-4} more`:""}`,ct=t=>!t.matches("script, [data-doc-dev]")&&(t.matches("svg, canvas")||t.querySelector("svg, canvas")||C(t)&&Q(t));for(let t of d.querySelectorAll("[data-doc-chart]"))m(t)||!C(t)||[...t.children].some(ct)||A("chart-empty",t,`the ${t.getAttribute("data-doc-chart")||"chart"} chart drew nothing`,{picture:J(t)});let nt=[...d.querySelectorAll("svg")].filter(t=>{if(t.parentElement.closest("svg")||m(t)||t.closest(".katex, .doc-icon, button")||!C(t))return!1;let o=t.getBoundingClientRect();return t.closest("[data-doc-chart], figure")||o.width>=120&&o.height>=60}),at={across:.6,down:.25},_=new Map;for(let t of nt){let o=J(t),l=o.getBoundingClientRect(),y=[],B=[],j=[...t.querySelectorAll("text")].filter(E=>!E.closest("defs, clipPath, mask, pattern, marker, symbol")&&L(E.textContent)&&C(E));for(let E of j){let g=Y(E),W=F(E).map(([ot,lt,ut])=>[ot,k(g,lt,ut)]).find(([,ot])=>ot>1.5);W?y.push(`${U(E.textContent,24)} ${q(W[1])}px past ${W[0]}`):k(g,l)>1.5&&B.push(`${U(E.textContent,24)} ${q(k(g,l))}px past the card's edge`)}y.length&&A("chart-text-clipped",t,tt(y),{picture:o}),B.length&&A("chart-text-outside",t,tt(B),{picture:o});let f=E=>{let g=/^(-?)[$¥€£]?(\d[\d,]*(?:\.\d+)?)\s*(?:%|‰|[kKMBG]|万|亿)?$/.exec(E.replace(/[−–]/g,"-"));return g?+`${g[1]}${g[2].replace(/,/g,"")}`:NaN},S=E=>E.every(Number.isFinite)&&E[1]!==E[0]&&E.slice(2).every((g,W)=>Math.abs(g-E[W+1]-(E[1]-E[0]))<=1e-9*Math.max(1,Math.abs(g)));for(let E of t.querySelectorAll("g")){let g=[...E.children].filter(V=>V.matches("g.tick")&&C(V)),W=g.map(V=>V.querySelector("text")).filter(V=>V&&L(V.textContent)&&C(V)),ot=W.map(V=>L(V.textContent));if(ot.length<2||ot.length!==g.length||!S(ot.map(f)))continue;let lt=W.map(V=>{let kt=V.getScreenCTM(),Ne=(parseFloat(getComputedStyle(V).fontSize)||0)*(kt?Math.hypot(kt.c,kt.d):1);return{label:V,box:Y(V),size:Ne,turned:!!kt&&Math.abs(kt.b)>.001*Math.abs(kt.a)}});if(lt.some(V=>V.turned||!(V.size>0)))continue;let ut=lt.map(({box:V})=>[(V.left+V.right)/2,(V.top+V.bottom)/2]),st=Math.max(...ut.map(([V])=>V))-Math.min(...ut.map(([V])=>V))>=Math.max(...ut.map(([,V])=>V))-Math.min(...ut.map(([,V])=>V)),mt=({box:V,size:kt})=>st?[V.left,V.right]:[(V.top+V.bottom-kt)/2,(V.top+V.bottom+kt)/2],St=[...lt].sort((V,kt)=>mt(V)[0]-mt(kt)[0]),wt=null;for(let V=1;V<St.length;V++){let kt=mt(St[V])[0]-mt(St[V-1])[1];(!wt||kt<wt.gap)&&(wt={gap:kt,pair:[St[V-1],St[V]]})}let Ct=Math.max(...lt.map(V=>V.size));if(!wt||wt.gap>=at[st?"across":"down"]*Ct)continue;for(let{label:V}of lt)_.set(V,E);let[Bt,Et]=wt.pair.map(({label:V})=>U(V.textContent,16)),Te=wt.gap<0?`${Bt} and ${Et} overlapping by ${q(-wt.gap)}px`:`${Bt} and ${Et} ${q(wt.gap)}px apart`;A("ticks",t,`${ot.length} tick labels ${st?"across":"down"} a ${q(st?t.getBoundingClientRect().width:t.getBoundingClientRect().height)}px chart crowd: ${Te}, under ${st?"a digit's width and a hair":"a quarter of a line"} at their ${q(Ct)}px (${ot.slice(0,6).join(", ")}${ot.length>6?", \u2026":""})`,{picture:o})}}let ft=t=>{let o=t.getBBox(),l=t instanceof SVGTextElement&&parseFloat(getComputedStyle(t).fontSize)||o.height,y=o.y+Math.max(0,(o.height-l)/2),B=y+Math.min(o.height,l),j=t.getScreenCTM();return[[o.x,y],[o.x+o.width,y],[o.x+o.width,B],[o.x,B]].map(([f,S])=>new DOMPoint(f,S).matrixTransform(j))},dt=(t,o)=>{let l=1/0;for(let y of[t,o])for(let B=0;B<y.length;B++){let j=y[B],f=y[(B+1)%y.length],S=Math.hypot(f.x-j.x,f.y-j.y);if(S===0)continue;let E={x:-(f.y-j.y)/S,y:(f.x-j.x)/S},g=ut=>ut.map(st=>st.x*E.x+st.y*E.y),[W,ot]=[g(t),g(o)],lt=Math.min(Math.max(...W),Math.max(...ot))-Math.max(Math.min(...W),Math.min(...ot));if(lt<=0)return 0;l=Math.min(l,lt)}return l===1/0?0:l},it=t=>[...t.querySelectorAll("text")].filter(o=>!o.closest("defs, clipPath, mask, pattern, marker, symbol")&&L(o.textContent)&&C(o));for(let t of nt){let o=it(t).map(y=>({label:y,outline:ft(y)})),l=[];o.forEach(({label:y,outline:B},j)=>{for(let f of o.slice(j+1))_.has(y)&&_.get(y)===_.get(f.label)||dt(B,f.outline)>1.5&&l.push(`${U(y.textContent,20)} and ${U(f.label.textContent,20)} overlap`)}),l.length&&A("chart-text-overlap",t,tt(l),{picture:J(t)})}let rt=11;for(let t of nt){if(!t.hasAttribute("viewBox"))continue;let o=[];for(let B of it(t)){let j=B.getScreenCTM(),f=parseFloat(getComputedStyle(B).fontSize);if(!j||!(f>0))continue;let S=f*Math.hypot(j.c,j.d);S<rt-.05&&o.push(`${U(B.textContent,24)} at ${S.toFixed(1)}px (font-size ${+f.toFixed(2)})`)}if(!o.length)continue;let l=t.viewBox.baseVal,y=`${o.length} text${o.length>1?"s":""}`;A("svg-text-small",t,`${y} of a drawing scaled by its viewBox (${+l.width.toFixed(2)}\xD7${+l.height.toFixed(2)} drawn ${q(t.getBoundingClientRect().width)}px wide) render below ${rt}px: ${tt(o)}`,{picture:J(t)})}let b=new Set;for(let t of d.querySelectorAll(".doc-table-wrap")){if(m(t)||!C(t))continue;b.add(t);let o=t.querySelector("table");if(!o)continue;let l=Math.max(t.clientWidth,o.offsetWidth),y=Math.max(t.clientHeight,o.offsetHeight),B=l>t.clientWidth+r,j=y>t.clientHeight+r,f=X(t);(B||j)&&A("table-scrolls",t,[B&&`${l}px wide in a ${t.clientWidth}px frame`,j&&`${y}px tall in a ${t.clientHeight}px frame`].filter(Boolean).join(", "),{scroll:{sideways:B,down:j,name:f}});let S=globalThis.__qaTableHides(t,o);S.said&&A("table-columns",t,`${S.said}: the table is ${l}px wide in a ${t.clientWidth}px frame`),S.shown<S.rows&&!t.style.getPropertyValue("--doc-table-height")&&A("table-rows",t,`the frame shows ${S.shown} of ${S.rows} rows: a reader scrolls inside it for the other ${S.rows-S.shown}; style="--doc-table-height: none" on its div.doc-table-wrap shows every row (or split the table where its content divides)`)}let z=t=>!!t.closest("details[data-qa-closed]"),P="in a disclosure closed in the file: a reader who opens it scrolls";for(let t of d.querySelectorAll(".doc-code, .doc-diff")){if(m(t)||!C(t))continue;let o=t.querySelector(":scope > pre, :scope > .doc-diff-body");if(o&&C(o)){let y=z(t);if(o.scrollHeight>o.clientHeight+r){let B=[t,o].map(E=>E.style.getPropertyValue("--doc-code-height").trim()).find(Boolean),j=o.getBoundingClientRect().top+o.clientTop+o.clientHeight,f=[...o.querySelectorAll(".doc-code-line")].filter(E=>E.getClientRects().length>0&&E.getBoundingClientRect().top>=j-1).length,S=y?`, ${P} inside it for the rest`:B?`, the block's own height (--doc-code-height: ${B}, the author's or the reader's): a reader scrolls inside it for the rest`:": a reader scrolls inside it for the rest";A("code-scrolls",t,`the code is ${o.scrollHeight}px tall, its frame ${o.clientHeight}px${f?` (its last ${f} line${f===1?"":"s"} below it)`:""}${S}`,{level:y||B?"info":void 0})}if(o.scrollWidth>o.clientWidth+r){let B=t.classList.contains("doc-code--nowrap"),j=y?`, ${P} sideways for the rest`:B?", its lines left unwrapped (doc-code--nowrap, the author's or the reader's choice): a reader scrolls sideways for the rest of its long lines":": a reader scrolls sideways for the rest";A("code-scrolls",t,`the code is ${o.scrollWidth}px wide, its frame ${o.clientWidth}px${j}`,{level:y||B?"info":void 0})}}let l=t.querySelector(":scope > .doc-code-title");l&&C(l)&&l.scrollWidth>l.clientWidth+1&&A("code-title-cut",t,`its title ${U(l.textContent,48)} is cut to fit its header (${l.scrollWidth}px of words in ${l.clientWidth}px)`)}for(let t of d.querySelectorAll(".doc-math-block")){if(m(t)||!C(t)||t.scrollWidth<=t.clientWidth+r)continue;let o=z(t);A("formula-scrolls",t,`the formula is ${t.scrollWidth}px wide, its frame ${t.clientWidth}px${o?`, ${P} it sideways for the rest`:": a reader scrolls it sideways for the rest"}`,{level:o?"info":void 0})}for(let t of d.querySelectorAll("[data-doc-layout]"))m(t)||!C(t)||A("layout",t,t.getAttribute("data-doc-layout"),{picture:t.closest("figure, .doc-table-wrap")??t,measured:b.has(t)});let K=document.createTreeWalker(d,NodeFilter.SHOW_TEXT),R=new Map;for(let t=K.nextNode();t;t=K.nextNode()){if(!/\\\(|\\\[|\$\$/.test(t.nodeValue))continue;let o=t.parentElement;if(!o||o.closest([...s,".katex","[data-doc-dev]"].join(", "))||!C(o))continue;let l=o.closest("p, li, h1, h2, h3, h4, td, th, figcaption, summary, blockquote, dd, dt")??o;R.has(l)||R.set(l,t.nodeValue)}for(let[t,o]of R){let l=o.search(/\\\(|\\\[|\$\$/);A("raw-formula",t,`${U(o.slice(l,l+40),40)} is shown as written: the kit's math did not render it`)}for(let t of d.querySelectorAll(".katex-error"))m(t)||!C(t)||A("formula-error",t,`${U(t.textContent,32)}: ${L(t.getAttribute("title"))||"KaTeX could not read it"}`);let I=t=>`"${globalThis.__qaUrlName?.(t,document.baseURI)??t}"`,i=t=>{try{return new URL(t,document.baseURI).href}catch{return t}},T=t=>[...["src","href","poster","data"].filter(o=>t.hasAttribute(o)&&!(o==="href"&&t.matches("a, area"))).map(o=>t.getAttribute(o)),...(t.getAttribute("srcset")??"").split(",").map(o=>o.trim().split(/\s+/)[0]),...[t.getAttribute("style"),t.localName==="style"?t.textContent:""].flatMap(o=>[...String(o??"").matchAll(/url\(\s*["']?([^"')]+)/g)].map(l=>l[1]))].filter(o=>o&&!o.trim().startsWith("#")).map(i),N=[...document.querySelectorAll("*")].filter(t=>!m(t)).flatMap(t=>T(t).map(o=>({node:t,address:o}))),a=new Set;for(let{url:t,directive:o}of globalThis.__qaViolations??[]){let l=/^[a-z][a-z\d+.-]*$/i.test(t)?`${t.toLowerCase()}:`:null,y=N.find(j=>l?!a.has(j)&&j.address.startsWith(l):j.address===t);y&&l&&a.add(y);let B=y?.node??null;e&&!(B&&d.contains(B))||A("blocked",B,`${o} blocked ${I(y?.address??t)}${B?` (${D(B)})`:""}: the export holds every file it shows`,{url:y?.address??t})}for(let t of d.querySelectorAll("img")){if(m(t)||t.complete&&t.naturalWidth>0)continue;let o=t.currentSrc||t.src?i(t.currentSrc||t.src):"";A("image",t,`${o?I(o):"a picture with no src"} did not load`,{picture:t.closest("figure")??t,url:o})}let O=new Set(u),G=new Set(w),et=document.createRange(),$t="button, select, input, textarea, [data-doc-dev]",yt=(t,o)=>t!==o&&(t.matches($t)||[...t.classList].some(l=>l.startsWith("doc-"))),xt=(t,o,l)=>{let y=[],B=!1;for(let j=t,f=!0;j&&j!==document.body&&j!==document.documentElement;j=j.parentElement,f=!1){let S=getComputedStyle(j);if((!f||l)&&(B&&(S.position!=="static"||S.transform!=="none")&&(B=!1),!B)){if(/auto|scroll/.test(S.overflowY))break;/hidden|clip/.test(S.overflowY)&&!yt(j,o)&&y.push(j)}if(S.position==="fixed")break;S.position==="absolute"&&(B=!0)}return y},bt=t=>t.getBoundingClientRect().bottom-(parseFloat(getComputedStyle(t).borderBottomWidth)||0),Ft=t=>{let o=getComputedStyle(t),l=y=>!/^(transparent|rgba\(.*,\s*0\))$/.test(y);return l(o.backgroundColor)||o.backgroundImage!=="none"||["Top","Right","Bottom","Left"].some(y=>parseFloat(o[`border${y}Width`])>0&&o[`border${y}Style`]!=="none"&&l(o[`border${y}Color`]))},Nt="rect, circle, ellipse, line, polyline, polygon, path, use",Tt=(t,o)=>{let l=new Map,y=(f,S,E,g)=>{if(!l.has(f)&&l.size>=3)return;let W=l.get(f)??{words:[],marks:[],depth:0,height:f.getBoundingClientRect().height};E&&W.words.push(E),g&&W.marks.push(g),W.depth=Math.max(W.depth,S),l.set(f,W)},B=f=>f.getBoundingClientRect().height>1.5,j=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let f=j.nextNode();f;f=j.nextNode()){let S=f.parentElement;if(!f.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!C(S)||o(S))continue;let E=xt(S,t,!0).filter(B);if(E.length===0)continue;let g=getComputedStyle(S),W=parseFloat(g.lineHeight);for(let ot of f.nodeValue.matchAll(/\S+/g)){let lt=ot.index+ot[0].length;et.setStart(f,ot.index),et.setEnd(f,lt);let ut=[...et.getClientRects()];for(let st of ut){let mt=Number.isFinite(W)?Math.max(0,(st.height-W)/2):0,St=E.find(Ct=>st.bottom-bt(Ct)>1.5+mt);if(!St)continue;let wt=ot.index;if(ut.length>1){let Ct=bt(St)+1.5+mt;for(let Bt=lt-1;wt<Bt;){let Et=wt+Bt>>1;et.setStart(f,Et),et.setEnd(f,Et+1),(et.getClientRects()[0]?.bottom??0)>Ct?Bt=Et:wt=Et+1}}y(St,Math.max(...ut.map(Ct=>Ct.bottom))-bt(St),f.nodeValue.slice(wt,lt),null);break}}}for(let f of t.querySelectorAll("*")){let S=f instanceof SVGElement&&f.matches(Nt)&&!f.closest("defs, clipPath, mask, pattern, marker, symbol"),E=!S&&!(f instanceof SVGElement)&&!f.matches("img, picture, video, canvas, iframe, object, embed, script, style, template")&&f.children.length===0&&!f.textContent.trim()&&Ft(f);if(!S&&!E||!C(f))continue;let g=f.getBoundingClientRect();if(g.width<=0&&g.height<=0)continue;let W=S?f.ownerSVGElement:null,ot=[...W&&getComputedStyle(W).overflowY!=="visible"?[W]:[],...xt(W??f,t,!!W)].filter(B),lt=st=>{let mt=st.getBoundingClientRect();return g.left>=mt.left-1.5&&g.right<=mt.right+1.5&&g.top>=mt.top-1.5},ut=ot.find(st=>g.bottom-bt(st)>1.5&<(st));ut&&y(ut,g.bottom-bt(ut),null,S?f.localName:D(f))}return l};for(let t of d.querySelectorAll("[data-block-id]")){let o=t.getAttribute("data-block-id"),l=G.has(o);if(!l&&!O.has(o)||m(t)||!C(t))continue;let y=f=>f.closest(".doc-chart-message")||f.closest("h2, h3, h4, p, figcaption")?.parentElement===t,B=new Map,j=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let f=j.nextNode();f&&B.size<3;f=j.nextNode()){let S=f.parentElement;if(!f.nodeValue.trim()||!S||S.closest("svg, script, style, template, .katex")||!C(S)||l&&y(S))continue;let E=S;for(;E!==t&&["inline","contents"].includes(getComputedStyle(E).display);)E=E.parentElement;let g=!1;for(let st=S;st&&!g;st=st===t?null:st.parentElement){let mt=getComputedStyle(st);g=mt.overflowX!=="visible"||mt.overflowY!=="visible"}if(g)continue;let W=getComputedStyle(E),ot=E.getBoundingClientRect(),lt=ot.left+parseFloat(W.borderLeftWidth)+parseFloat(W.paddingLeft),ut=ot.right-parseFloat(W.borderRightWidth)-parseFloat(W.paddingRight);for(let st of f.nodeValue.matchAll(/\S+/g)){et.setStart(f,st.index),et.setEnd(f,st.index+st[0].length);let mt=[...et.getClientRects()],St=Math.max(0,...mt.flatMap(Ct=>[Ct.right-ut,lt-Ct.left]));if(St<=1.5||mt.some(Ct=>Ct.right>h+1))continue;let wt=B.get(E)??{words:[],reach:0,width:ut-lt};wt.words.push(st[0]),wt.reach=Math.max(wt.reach,St),B.set(E,wt)}}for(let[f,{words:S,reach:E,width:g}]of B)A("overflow-in-block",f,`the words ${U(S.join(" "),40)} run ${q(E)}px past the side of ${D(f)} (${q(g)}px wide for its words), over what is beside it`,{picture:t});for(let[f,{words:S,marks:E,depth:g,height:W}]of Tt(t,l?y:()=>!1)){let ot=[S.length&&`the words ${U(S.join(" "),40)}`,E.length&&`${E.length===1?"a mark":`${E.length} marks`} (${[...new Set(E)].slice(0,3).join(", ")})`].filter(Boolean).join(" and "),lt=S.length===0&&E.length===1;A("cut-in-block",f,`${ot} ${lt?"reaches":"reach"} ${q(g)}px past the bottom of ${D(f)} (${q(W)}px tall, its overflow ${getComputedStyle(f).overflowY}), cut off there`,{picture:t})}}if(et.detach(),document.documentElement.scrollWidth>h+1){let t=g=>{for(let W=g.parentElement;W&&W!==document.body;W=W.parentElement)if(getComputedStyle(W).overflowX!=="visible")return!1;return g.nodeType!==1||getComputedStyle(g).position!=="fixed"},o=[...d.querySelectorAll("*")].filter(g=>!(g instanceof SVGElement&&g.ownerSVGElement)&&!m(g)&&g.getBoundingClientRect().right>h+1&&C(g)&&t(g)),l=o.filter(g=>!o.includes(g.parentElement)).slice(0,3),y=`the page is ${document.documentElement.scrollWidth}px wide in a ${h}px window`,B=new Set(o),j=g=>{for(let W=g.parentElement;W;W=W.parentElement)if(B.has(W))return!0;return!1},f=new Map,S=document.createRange(),E=document.createTreeWalker(d,NodeFilter.SHOW_TEXT);for(let g=E.nextNode();g&&f.size<3;g=E.nextNode()){let W=g.parentElement;if(!W||!g.nodeValue.trim()||W.closest("svg, script, style, template")||m(W)||j(g)||!C(W)||!t(g)||(S.selectNodeContents(g),![...S.getClientRects()].some(st=>st.right>h+1)))continue;let ot=W.closest("[data-block-id]")??W;if(f.has(ot))continue;let lt=[],ut=0;for(let st of g.nodeValue.matchAll(/\S+/g)){S.setStart(g,st.index),S.setEnd(g,st.index+st[0].length);let mt=Math.max(...[...S.getClientRects()].map(St=>St.right),0);mt<=h+1||(lt.push(st[0]),ut=Math.max(ut,mt))}lt.length&&f.set(ot,{node:W,words:lt.join(" "),right:ut})}S.detach(),l.length===0&&f.size===0&&!e&&A("overflow",null,y);for(let g of l)A("overflow",g,`${y}: ${D(g)} ${U(g.textContent,24)} reaches ${q(g.getBoundingClientRect().right)}px`);for(let[g,{node:W,words:ot,right:lt}]of f)A("overflow",W,`${y}: the words ${U(ot,60)} in ${D(g)} run past its edge to ${q(lt)}px (a text that cannot break)`,{picture:g})}return{found:$,next:n}}function po(){let e=s=>!!s.closest("[data-doc-dev]"),n=s=>[...document.querySelectorAll(s)].filter(c=>!e(c)).length;return{charts:n("[data-doc-chart]"),tables:n(".doc-table-wrap"),height:document.documentElement.scrollHeight}}var Ot=2e4,Se=1800;function ke(e,n,s){let c=0,r=new Promise((u,w)=>{c=setTimeout(()=>w(new Error(`${s}: no answer in ${n/1e3}s`)),n)});return Promise.race([e,r]).finally(()=>clearTimeout(c))}var Yt=e=>`${e.kind}|${JSON.stringify(e.anchor)}|${e.what}`;async function go(e,n,s,{out:c,tiles:r=!1,blocks:u=[],around:w=new Map,held:d=new Map,whole:$=[],drawn:h=[],known:q=null}){let{width:L,height:U=900,label:m=String(L)}=typeof s=="number"?{width:s}:s,C=m.replace("\xD7","x"),D=await e.createBrowserContext(),x=await D.newPage();x.setDefaultTimeout(Ot);let H=[],M=[],Z=new Set,X=new Map,gt=new Set,p=new Set,A=new Set,J="",Q=0,k=(b,z,P={})=>H.push({kind:b,what:z,anchor:null,shot:null,seen:!1,state:J,...P}),v=Pe(n).href,Y=b=>`"${$e(b,v)}"`,F=b=>c.folders?.get(b)??c.blocks,tt=b=>b.replace(/[^\w-]/g,"_");x.on("pageerror",b=>k("error",`uncaught ${It(b.message).slice(0,200)}`)),x.on("console",b=>{b.type()==="error"&&ae(b,v)&&k("error",`console: ${It(b.text()).slice(0,200)}`)}),x.on("requestfailed",b=>{b.frame()===x.mainFrame()&&k("request",`${Y(b.url())}: ${b.failure()?.errorText??"failed"}`,{url:b.url()})}),x.on("response",b=>{b.status()>=400&&b.request().frame()===x.mainFrame()&&k("request",`${Y(b.url())}: HTTP ${b.status()}`,{url:b.url()})}),await ie(x),await x.evaluateOnNewDocument(`globalThis.__qaUrlName = ${$e}; globalThis.__qaTableHides = ${Ye()};`),await x.setViewport({width:L,height:U}),await x.emulateMediaFeatures([{name:"prefers-color-scheme",value:"light"}]);let ct=async b=>{for(let z of await le(x,{timeout:Ot}))k("unverified",`${b}: waited for ${z}`)},nt=async(b,z,P,K)=>ke(x.screenshot({path:P,clip:b,captureBeyondViewport:!z}),Ot,"the picture").then(()=>!0,R=>(k("unverified",`no picture of ${K} (${R.message})`),!1)),at=async(b,z,P,K=0)=>{let R=await x.evaluate(uo,{selector:b,up:K,margin:Qe,frames:Ze}).catch(I=>({error:I}));return R?.clip?await nt(R.clip,R.fixed,z,P)?R.clip:null:(k("unverified",`no picture of ${P} (${R?.error?.message??"the element is gone or shows nothing"})`),null)},_=(b,z)=>b.left<z.x+z.width&&b.right>z.x&&b.top<z.y+z.height&&b.bottom>z.y,ft=async()=>{let b=u.filter(P=>!gt.has(P)),z=await x.evaluate((P,K,R)=>{let I=new Map(P.map((O,G)=>[O,G])),i=O=>!!O&&!O.closest("[data-doc-dev], dialog:not([open])")&&O.getClientRects().length>0,T=O=>O===null?null:[...document.querySelectorAll("[data-block-id]")].find(G=>G.getAttribute("data-block-id")===O&&i(G))??null,N=O=>{if(!O)return null;let G=O.getBoundingClientRect();return{left:G.left+scrollX,right:G.right+scrollX,top:G.top+scrollY,bottom:G.bottom+scrollY}},a=[];for(let O of document.querySelectorAll("[data-block-id]")){let G=I.get(O.getAttribute("data-block-id"));if(G===void 0||!i(O))continue;I.delete(O.getAttribute("data-block-id")),O.setAttribute("data-qa-block",String(G));let[et,$t]=K[G]??[],yt=(R[G]??[]).map(xt=>[xt,[...O.querySelectorAll("[data-block-id]")].find(bt=>bt.getAttribute("data-block-id")===xt&&i(bt))]).filter(([,xt])=>xt);a.push({index:G,boxes:K[G]?{block:N(O),above:N(T(et)),below:N(T($t))}:null,held:yt.map(([xt,bt])=>({id:xt,box:N(bt)}))})}return a},b,b.map(P=>w.get(P)??null),b.map(P=>d.get(P)??[]));for(let{index:P,boxes:K,held:R}of z){let I=b[P];gt.add(I);let i=`${C}-${tt(I)}`,T=[];if(!K){let N=ht.join(F(I),`${i}.png`),a=await at(`[data-qa-block="${P}"]`,N,`the block ${I}`);a&&(M.push({block:I,file:N}),T.push(a))}for(let{part:N,clip:a}of K?eo(K):[]){let O=ht.join(F(I),`${i}${N?`-${N}`:""}.png`);await nt(a,!1,O,`the block ${I}${N?` (its ${N})`:""}`)&&(M.push({block:I,file:O}),T.push(a))}for(let{id:N,box:a}of R)T.some(O=>_(a,O))?p.add(N):p.has(N)||A.add(N);await x.evaluate(N=>document.querySelector(`[data-qa-block="${N}"]`)?.removeAttribute("data-qa-block"),P)}},dt=async(b,z,P)=>{let K=[...d].filter(([I])=>gt.has(I)).map(([I,i])=>[I,i.filter(T=>!p.has(T))]).filter(([,I])=>I.length);if(!K.length)return;let R=await x.evaluate((I,i)=>{let T=document.querySelector(I);if(!T)return[];let N=a=>[...T.querySelectorAll("[data-block-id]")].some(O=>O.getAttribute("data-block-id")===a&&O.getClientRects().length>0);return i.map(([a,O])=>[a,O.filter(N)]).filter(([,a])=>a.length)},b,K);for(let[I,i]of R){let T=ht.join(F(I),`${C}-${tt(I)}-${z}.png`);if(await at(b,T,`the block ${I} (${z})`,P)){M.push({block:I,part:z,file:T});for(let N of i)p.add(N),A.delete(N)}}},it=async b=>{let z=await x.evaluate(Dt,{scope:b,next:Q,ignored:Ve,slack:Je,whole:$,drawn:h});Q=z.next;let P=z.found.flatMap(R=>R.kind!=="layout"?[R]:Ge(R.what,L).filter(({kind:I})=>!(R.measured&&["table-columns","table-rows"].includes(I))).map(({kind:I,note:i})=>({...R,kind:I,what:`the kit notes ${i}`})));for(let R of P){let I=R.shot===null?null:`${R.kind}|${R.shot}|${R.what}`,i=I&&X.get(I);if(i)!i.seen&&R.seen&&Object.assign(i,R,{state:J});else{let T={...R,state:J};H.push(T),I&&X.set(I,T)}}let K=new Set(H.filter(R=>R.kind==="blocked").map(R=>R.url));for(let R of H){if(R.shot===null||!R.seen||Z.has(R.shot)||!Xe(R,L)||q?.has(Yt(R))||["request","image"].includes(R.kind)&&K.has(R.url))continue;Z.add(R.shot);let I=ht.join(c.flagged,`${C}-${String(R.shot).padStart(2,"0")}-${R.kind}.png`);await at(`[data-qa-shot="${R.shot}"]`,I,R.kind)&&M.push({shot:R.shot,file:I})}u.length&&await ft()},rt=b=>{let z=new Set(H.filter(K=>K.kind==="blocked").map(K=>K.url));return{findings:H.filter(K=>!(["request","image"].includes(K.kind)&&z.has(K.url))&&!q?.has(Yt(K))),counts:b,pictures:M,held:{covered:[...p],missed:[...A]}}};try{try{let i=new Promise(N=>x.once("domcontentloaded",N)),T=x.goto(v,{waitUntil:"load",timeout:6e4});if(T.catch(()=>{}),await Promise.race([i,T]),x.url()!==v)throw new Error(`the browser shows ${x.url()}`)}catch(i){return k("unverified",`the page did not load: ${i.message}`),rt(null)}await ct("the page as it opens");let b=await x.evaluate(fo,Ot);b.loaded||k("unverified",`the pictures (${b.images}) not all loaded in ${Ot/1e3}s`),b.closed&&await ct(`the page with its ${b.closed} closed disclosure${b.closed===1?"":"s"} opened`),await it(null);let z=async(i,T,N,a=null)=>{for(let O=i,G=1;O<T;O+=Se,G++){let et=ht.join(c.tiles,`${C}-${N}${String(G).padStart(2,"0")}.png`);await ke(x.screenshot({path:et,clip:{x:0,y:O,width:L,height:Math.min(Se,T-O)},captureBeyondViewport:!0}),Ot,"a tile").then(()=>M.push({tile:!0,sheet:a,file:et}),$t=>k("unverified",`no tile ${N}${G} (${$t.message})`))}};r&&await z(0,await x.evaluate(()=>document.documentElement.scrollHeight),"");let P=async(i,T=null)=>{if(!await x.evaluate(be,i.chain)){let{anchor:N}=await x.evaluate(Dt,{next:Q,place:`[data-qa-tab="${i.index}"]`});return k("unverified","this Sheet could not be shown: its tab was clicked and its panel stayed hidden",{anchor:N}),!1}if(await ct("the Sheet shown"),await it(`[data-qa-panel="${i.index}"]`),await dt(`[data-qa-panel="${i.index}"]`,`sheet${i.index+1}`,1),r&&T)await K(T,`sheet${i.index+1}-`);else if(r){let N=await x.evaluate(a=>{let O=document.querySelector(`[data-qa-panel="${a}"]`)?.getBoundingClientRect();return O&&O.height>0?{top:Math.max(0,O.top+scrollY),bottom:O.bottom+scrollY}:null},i.index);N&&await z(N.top,N.bottom,`sheet${i.index+1}-`,{number:i.index+1,label:i.label})}return!0},K=async(i,T="")=>{for(let N=1;N<=20;N++){let a=await x.evaluate((G,et)=>{let $t=document.querySelector(`[data-qa-card="${G}"]`),yt=$t?.querySelector(".doc-dialog-content")??$t;if(!yt)return null;if(et)yt.scrollTop=0;else{let bt=yt.scrollTop;if(yt.scrollTop+=Math.max(40,yt.clientHeight-24),yt.scrollTop===bt)return null}let xt=$t.getBoundingClientRect();return{x:xt.left+visualViewport.pageLeft,y:xt.top+visualViewport.pageTop,width:xt.width,height:xt.height}},i.index,N===1);if(!a)break;let O=ht.join(c.tiles,`${C}-card${i.index+1}-${T}${String(N).padStart(2,"0")}.png`);await nt(a,!0,O,`the detail card ${Mt(i.label,24)}, tile ${T}${N}`)&&M.push({tile:!0,card:{number:i.index+1,label:i.label,part:T},file:O})}},R=0;for(let i of b.sheets)i.shown||!i.panel||i.card!==null||(J=`Sheet ${Mt(i.label,24)}`,await P(i)&&(R+=1));let I=0;for(let i of b.cards){J=`detail card ${Mt(i.label,24)}`;let T=`[data-qa-card="${i.index}"]`;i.chain.length&&await x.evaluate(be,i.chain);for(let N of i.within)await x.evaluate(ye,N);if(!await x.evaluate(ye,i.index)){let{anchor:N}=await x.evaluate(Dt,{next:Q,place:T});k("unverified","this detail card could not be opened",{anchor:N});for(let a of i.within.toReversed())await x.evaluate(_t,a);continue}I+=1,await ct("the detail card opened"),await it(T),await dt(T,`card${i.index+1}`,0),r&&await K(i);for(let N of b.sheets)N.card!==i.index||N.shown||!N.panel||(J=`detail card ${Mt(i.label,24)}, Sheet ${Mt(N.label,24)}`,await P(N,i)&&(R+=1));await x.evaluate(_t,i.index);for(let N of i.within.toReversed())await x.evaluate(_t,N)}return J="",rt({...await x.evaluate(po),details:b.details,closed:b.closed,sheets:R,cards:b.cards.length,cardsOpened:I})}catch(b){return k("unverified",`the look ended early: ${b.message}`),rt(null)}finally{await D.close().catch(()=>{})}}var Be=e=>e.split(ht.sep).join("/"),pt=(e,n,s=`${n}s`)=>`${e} ${e===1?n:s}`,Ht=e=>`${e.join(", ")}px`,mo=e=>e.includes("\xD7")?e:`${e}px`;function wo({details:e,closed:n}){if(e===0)return"0 disclosures";let s=n===0?"open in the file":`${n===e?"":`${n} `}closed in the file, opened for the pictures`;return`${pt(e,"disclosure")} (${s})`}function $o(e,n=null){let s=new Map;for(let c of e){let r=n?ht.relative(n,c):"",u=Be(n&&r&&!r.startsWith("..")&&!ht.isAbsolute(r)?r:c),w=/^(.*\/)?(\d+(?:x\d+)?)-([^/]+)$/.exec(u),d=w?`${w[1]??""}\0${w[3]}`:u;s.has(d)||s.set(d,w?{head:w[1]??"",tail:w[3],looks:[]}:{whole:u});let $=s.get(d);w&&!$.looks.includes(w[2])&&$.looks.push(w[2])}return[...s.values()].map(c=>c.whole??`${c.head}${c.looks.length>1?`{${c.looks.join(",")}}`:c.looks[0]}-${c.tail}`)}var Oe=(e="<slug>")=>`more pictures: gallery qa ${e} --tiles (the page, each Sheet panel and each detail card in tiles), gallery qa ${e} --blocks <id,\u2026> (the blocks you name)`,en=Oe(),Re=he,ve='look at the export yourself at 1024, 736 and 360px, its disclosures and detail cards opened (SKILL.md, "Export, check and look"), and say so when you hand the document over.',xo=e=>It(e?.message).replace(/\s*Use a different `?userDataDir`? or stop the running browser first\.?/gi,"").slice(0,300),zt={overflow:"a reader scrolls the whole page sideways. Words that cannot break where they stand (a long path, URL or name): wrap each in <code>, which breaks where it must and keeps it whole for the reader to copy; an element wider than the window (a picture, a drawing, a width of your own): let it fit (max-width: 100%) or put it in a frame that scrolls; never cut or rewrite a path to silence this","table-columns":"not a failure. If the reader must see the column on a desktop, write its long values compactly (a cell of numbers stays on one line, so its longest value sets the column's width: a range as a\u2013b, fewer digits), move a unit out of its header into the line above the table, shorten the header, or split the table; never delete a column to silence this","chart-text-overlap":"not a failure. If the reader must read both, shorten the labels (a unit belongs in the axis's title), move one (above its row, or a leader line) or give the drawing more room at this width; never delete a label or a category to silence this","code-scrolls":'not a failure. A reader scrolls inside the frame (40 lines) for the rest; if every line must show at once, write style="--doc-code-height: none" on its <pre>; never delete code to silence this',"formula-scrolls":"not a failure. A reader scrolls the formula sideways for the rest; if it must show whole at this width, break it into lines (\\begin{aligned} \u2026 \\end{aligned}) or into two formulas; never cut a term to silence this","overflow-in-block":"not a failure. If the words run over others in the picture, give their box room at this width (a wider column in an @media rule of your <style>, or a smaller font there), or let them break (a dash or a space where a line may end); never cut the words to silence this","cut-in-block":"not a failure. If the reader must see what is cut, let the box grow with what it holds (min-height instead of height or max-height, or none), give it room at this width in an @media rule of your <style>, or let it scroll (overflow: auto); never delete the words to silence this",ticks:"not a failure. If the numbers crowd in the picture, give that axis fewer ticks at this width with axis.tickValues([...]), at most four on a phone (the domain's ends and middle; ticks(n) is only a hint to d3 and can still draw five or more), or shorter numbers (the unit in the axis's title: 2k, 1.5\u4E07); never take the axis out to silence this","svg-text-small":"not a failure. The viewBox scales the drawing's text with it: give the text a larger font-size in the viewBox's units (a viewBox 800 wide drawn 340px wide scales by 0.43, so 26 units read as 11px), or lay the drawing out for narrow widths (a viewBox of its own under an @media rule, a chart of your own drawn from its width, or HTML that wraps); never drop the labels to silence this"},yo='not a failure. A reader scrolls sideways for the rest of its long lines; if the reader must see them whole at this width, let them wrap (take data-wrap="false" off its <pre>) or break them where the code allows; a tree or a log whose lines must stay whole may scroll; never cut a line to silence this';function bo(e){if(e.kind!=="code-scrolls")return zt[e.kind]?[zt[e.kind]]:[];let n=[...e.said.keys()],s=n.some(c=>/ wide, its frame /.test(c));return[...!s||n.some(c=>/ tall, its frame /.test(c))?[zt["code-scrolls"]]:[],...s?[yo]:[]]}var So="none is a failure: each says what to do if it matters to the reader (never delete a column or a label to silence one)",ko="a reader scrolls it: not a problem";function vo(e,n,s=null,{folder:c=null,slug:r="<slug>"}={}){let u=[],w=Object.fromEntries(At.map(p=>[p,0])),d=new Map,$=new Set,h=new Map,q=[],L=p=>$o(p,c),U=p=>p.label??String(p.width),m=new Map(e.flatMap(p=>p.pictures.filter(A=>A.shot!==void 0).map(A=>[`${U(p)}|${A.shot}`,A.file])));for(let p of e){let{width:A,findings:J,counts:Q}=p,k=U(p),v=new Set,Y=Object.fromEntries(At.map(_=>[_,0])),F={right:0,down:0,all:0};for(let _ of J){let ft=`${_.kind}|${_.shot??""}|${_.what}`;if(v.has(ft))continue;v.add(ft);let dt=Ce(_,A);Y[dt]+=1;let it=so(_.anchor,n);if(_.kind==="table-scrolls"){let{sideways:R=!1,down:I=!1,name:i=""}=_.scroll??{};Object.assign(F,{all:F.all+1,right:F.right+Number(R),down:F.down+Number(I)});let T=`${it}|${i}`;h.has(T)||h.set(T,{place:it,name:i,right:[],down:[]}),R&&!h.get(T).right.includes(k)&&h.get(T).right.push(k),I&&!h.get(T).down.includes(k)&&h.get(T).down.push(k)}if(dt==="info"&&$.add(`${_.kind}|${it}`),dt==="info"&&["table-scrolls","table-columns","table-rows"].includes(_.kind))continue;let rt=`${At.indexOf(dt)}|${_.kind}|${it}`;d.has(rt)||(d.set(rt,{level:dt,kind:_.kind,place:it,said:new Map}),dt!=="info"&&(w[dt]+=1));let b=d.get(rt).said,z=`${_.state?`[${_.state}] `:""}${_.what}`;b.has(z)||b.set(z,{labels:[],pictures:[]});let P=b.get(z);P.labels.includes(k)||P.labels.push(k);let K=m.get(`${k}|${_.shot}`);K&&!P.pictures.includes(K)&&P.pictures.push(K)}let tt=[F.right&&`\u2192 ${F.right}`,F.down&&`\u2193 ${F.down}`].filter(Boolean).join(", "),ct=`${pt(F.all,"table scrolls","tables scroll")}${tt?` (${tt})`:""}`,nt=Q?.cards?`, ${pt(Q.cards,"detail card")} (${Q.cardsOpened===Q.cards?"closed in the file, opened in turn":`${Q.cardsOpened??0} of them opened`})`:"",at=p.laptop?"; only what the 1024px look did not find":Q?`; ${pt(Q.charts,"chart")}, ${pt(Q.tables,"table")}, ${wo(Q)}, ${pt(Q.sheets,"Sheet")} shown besides the first${nt}, page ${Q.height}px tall`:"";q.push({label:k,fail:Y.fail,warn:Y.warn,line:`${p.laptop?k:`${k.padStart(4)}px`} fail ${Y.fail} \xB7 warn ${Y.warn} \xB7 unverified ${Y.unverified} \xB7 ${ct}${at}`})}let C=[...d.values()].sort((p,A)=>At.indexOf(p.level)-At.indexOf(A.level)),D=e.flatMap(p=>p.pictures);if(c&&D.length&&u.push(`Pictures of this run in ${Be(c)}/ (each path below is in it):`),s){let p=new Map;for(let k of D)k.block!==void 0&&p.set(k.block,[...p.get(k.block)??[],k.file]);let A=Ae(e),J=k=>`${s.tags?.get(k)?`${s.tags.get(k)} `:""}${k}`,Q=`at ${ge.slice(0,-1).join(", ")} and ${ge.at(-1)}px`;s.tiles&&s.why&&u.push(`${s.why[0].toUpperCase()}${s.why.slice(1)}.`);for(let k of s.groups??[]){if(!k.ids.length&&!k.rest.length)continue;let v=!k.ids.length&&s.groups.some(Y=>Y!==k&&Y.ids.length)?`: none this run (the ${Ee} blocks a run pictures went to the changed blocks above)`:"";u.push(`${k.why[0].toUpperCase()}${k.why.slice(1)}${k.ids.length?`, ${Q}`:v}:`);for(let Y of k.ids){let F=n.blocks.get(Y),tt=`${F?`${n.name??"doc.html"}:${F}`:`(not in ${n.name??"doc.html"})`} ${Y}${s.tags?.get(Y)?` ${s.tags.get(Y)}`:""}`,ct=p.get(Y)??[],nt=s.moved?.has(Y)?" (moved: with the edges of the blocks before and after it)":"",at=s.held?.get(Y)??[],_=at.filter(P=>s.changed?.has(P)).length,ft=k.kind==="named"?pt(at.length,"block"):[_&&pt(_,"changed block"),at.length-_&&pt(at.length-_,"card")].filter(Boolean).join(" and "),dt=D.some(P=>P.block===Y&&P.part)?", pictured again with each Sheet panel or detail card that holds one":"",it=at.filter(P=>A.has(P)),rt=[...new Set(it.flatMap(P=>A.get(P)))].map(P=>P.includes("\xD7")?P:`${P}px`).join(", "),b=it.length?`; ${it.length} of them not pictured at ${rt}: gallery qa ${r} --blocks ${it.join(",")}`:"",z=at.length?` (with the ${ft} it holds${dt}${b})`:"";u.push(ct.length?` ${tt}${nt}${z}: ${L(ct).join(", ")}`:` ${tt}${nt}${z}: not shown at any width (hidden)`)}if(k.rest.length){let Y=pt(k.rest.length,{changed:"changed block",cards:"card"}[k.kind]??"block"),F=`${k.rest.slice(0,6).map(J).join(", ")}${k.rest.length>6?", \u2026":""}`;u.push(` ${k.ids.length?"and ":""}${Y}${k.ids.length?" more":""}, not pictured (${F}): gallery qa ${r} --blocks ${k.rest.join(",")}`)}}s.unknown.length&&u.push(` no block of ${n.name??"doc.html"} has the id${s.unknown.length===1?"":"s"} ${s.unknown.join(", ")}`)}let x=[];for(let p of C)for(let{pictures:A}of p.said.values())x.push(...A.filter(J=>!x.includes(J)));x.length&&u.push("The elements flagged below, look at these first:",...L(x).map(p=>` ${p}`));let H=D.filter(p=>p.tile),M=H.filter(p=>!p.sheet&&!p.card);M.length&&u.push(`The page as it opens (each Sheet area with the panel it shows first): ${pt(M.length,"tile")} in ${L([ht.dirname(M[0].file)])[0]}/ (<width>-<n>.png)`);let Z=new Map;for(let{sheet:p}of H)p&&Z.set(p.number,{...p,count:(Z.get(p.number)?.count??0)+1});Z.size&&u.push(`Each other Sheet panel, shown in turn: ${pt(H.filter(p=>p.sheet).length,"tile")} in ${L([ht.dirname(H.find(p=>p.sheet).file)])[0]}/ (<width>-sheet<i>-<n>.png): ${[...Z.values()].map(({number:p,label:A,count:J})=>`sheet${p} ${Mt(A,24)} ${pt(J,"tile")}`).join(", ")}`);let X=new Map;for(let{card:p}of H)p&&X.set(p.number,{...p,count:(X.get(p.number)?.count??0)+1});X.size&&u.push(`Each detail card, opened in turn as the window shows it, its content scrolled a tile at a time: ${pt(H.filter(p=>p.card).length,"tile")} in ${L([ht.dirname(H.find(p=>p.card).file)])[0]}/ (<width>-card<i>-<n>.png${H.some(p=>p.card?.part)?"; with another panel of a Sheet in it shown, <width>-card<i>-sheet<j>-<n>.png":""}): ${[...X.values()].map(({number:p,label:A,count:J})=>`card${p} ${Mt(A,24)} ${pt(J,"tile")}`).join(", ")}`);for(let{place:p,name:A,right:J,down:Q}of h.values()){let k=/^(?:doc|report)\.html:\d+/.exec(p)?.[0]??p;u.push(`${"INFO".padEnd(10)} table-scrolls: ${k}${A?` ${Mt(A,32)}`:""}: ${[J.length&&`\u2192 ${Ht(J)}`,Q.length&&`\u2193 ${Ht(Q)}`].filter(Boolean).join("; ")} (${ko})`)}for(let p of C){u.push(`${p.level.toUpperCase().padEnd(10)} ${p.kind}: ${p.place}`);for(let[A,{labels:J,pictures:Q}]of p.said)u.push(` ${Ht(J)}: ${A}${Q.length?` (${L(Q).join(", ")})`:""}`);for(let A of bo(p))u.push(` ${A}`)}u.push(...q.map(({line:p})=>p));let gt=Mo(s,r);return gt&&u.push(gt),w.info=$.size,{lines:u,levels:w,looks:q.map(({label:p,fail:A,warn:J})=>({label:p,fail:A,warn:J}))}}function Mo(e,n="<slug>"){let{changed:s=[],restyled:c=[],packages:r=[],cards:u=[],since:w="the last look",first:d=!1}=e?.left??{};if(!s.length&&!c.length&&!u.length)return null;let $=q=>`${q.slice(0,6).map(L=>`${e.tags?.get(L)?`${e.tags.get(L)} `:""}${L}`).join(", ")}${q.length>6?", \u2026":""}`;return`Not pictured by this run, which pictures the blocks named alone: ${[s.length&&`${pt(s.length,"block")} changed or moved since ${w} (${$(s)})`,c.length&&`${pt(c.length,"instance")} of a package changed since ${w}, ${r.join(", ")} (${$(c)})`,u.length&&(d?`no earlier look: ${pt(u.length,"card")} never pictured (${$(u)})`:`${pt(u.length,"card")} the change of the document's own <script> or <style> since ${w} may draw again (${$(u)})`)].filter(Boolean).join("; ")}. gallery qa ${n} pictures them.`}function Co(e,n,s=[],{unpictured:c=!1}={}){let r=n.map(({label:q,fail:L,warn:U})=>`${mo(q)} fail ${L}, warn ${U}`).join("; "),u=r?` (${r})`:"",w=Oe(s.length===1?s[0].slug:void 0),d={stale:"its file had changed since its export",missing:"it had none yet"},$=s.filter(({first:q})=>q).map(({slug:q,first:L})=>`${s.length>1?`${q} was`:"It was"} exported first by this run (${d[L]}).`),h=`${$.length?`. ${$.join(" ")}`:""}${s.map(({file:q})=>`
|
|
3
|
-
${Re}${q}`).join("")}`;if(e.fail)return`failures at ${pt(e.fail,"place")}${u}: fix them in the document's doc.html (report.html in an older document), then run this again (it exports first); ${w}${h}`;if(e.unverified)return`nothing failed${u}; not verified at ${pt(e.unverified,"place")}: say so when you hand the document over; ${w}${h}`;if(e.warn)return`nothing failed${u}; warnings at ${pt(e.warn,"place")} to look at, ${So}; ${w}${h}`;if(c){let q=s.length===1?s[0].slug:"<slug>";return`nothing found${u}, and no picture taken: a plain run pictures the cards and the blocks changed since the last look, and the document has no card (a chart or a drawing, code, a whole block, a component, a flowchart, a Sheet area, columns, a figure, a table) and no block changed; run gallery qa ${q} --tiles to picture the page, each Sheet panel and each detail card in tiles, open those pictures and look at the document once yourself; gallery qa ${q} --blocks <id,\u2026> pictures the blocks you name${h}`}return`nothing found${u}: open the pictures above and look at the document once yourself; ${w}${h}`}function Eo(e,{missing:n=!1,edited:s=!1,packaged:c=!1}={}){let r=qt(e),u=ht.basename(Lt(jt(e,Rt)).html);return`exporting first: ${n?`no export yet (${r})`:s?`${u} changed since the last export (${r})`:c?`a component package it uses changed since the last export (${r})`:`the last export (${r}) does not say which text it was made from (an older Gallery's)`}, as gallery export ${e} does (--no-export: refuse instead)`}async function qo(e){for(let[r,{missing:u,edited:w,packaged:d}]of e)console.log(`${r}: ${Eo(r,{missing:u,edited:w,packaged:d})}`);let n=new Map(await Promise.all(e.map(async([r])=>[r,await vt.stat(qt(r)).then(u=>u.mtimeMs,()=>null)]))),s=Fe(process.execPath,[ht.join(ze,"bin","gallery.mjs"),"export",...e.map(([r])=>r)],{cwd:Rt,encoding:"utf8",env:{...process.env,GALLERY_WORKSPACE:Rt},maxBuffer:256*1024*1024});s.stdout&&process.stdout.write(s.stdout),s.stderr&&process.stderr.write(s.stderr),s.error&&console.error(`the export did not run: ${s.error.message}`);let c=[];for(let[r]of e){let u=await vt.stat(qt(r)).then(w=>w.mtimeMs,()=>null);u!==null&&u!==n.get(r)&&!(await Gt(r,{made:!0})).problem&&c.push(r)}return c}var Ao=e=>String(e??"").split(/[\s,]+/).filter(Boolean);function Bo(e,n){let s=Vt(e);return[...new Set(n)].filter(c=>!s.has(c))}var Oo=(e,n)=>`--blocks: no block of ${e} has the id${n.length===1?"":"s"} ${n.join(", ")}: nothing was looked at and no picture removed. Name ids as gallery qa prints them (data-block-id in the file).`;async function on(e){let{slugs:n,options:s,values:c}=await Kt({options:["--tiles","--no-export"],values:["--blocks"],argv:e}),r=c.has("--blocks")?Ao(c.get("--blocks")):null;if(r?.length===0)throw new Wt("--blocks takes block ids: --blocks <id,\u2026>");if(r&&n.length!==1)throw new Wt("--blocks names blocks of one document: name one.");let u=new Map,w=[];for(let M of n){let Z=await Gt(M);Z.problem&&!((Z.stale||Z.missing)&&!s.has("--no-export"))&&w.push(Z.problem),u.set(M,Z)}if(w.length&&(console.error(w.join(`
|
|
4
|
-
`)),process.exit(2)),r){let M=Lt(jt(n[0],Rt)).html,Z=Bo(Pt(await vt.readFile(M,"utf8").catch(()=>"")),r);if(Z.length)throw new Wt(Oo(ht.resolve(M),Z))}await oe(n),await ce(n),await de(n);let d=[...u].filter(([,M])=>M.stale||M.missing),$=new Map(d.map(([M,Z])=>[M,Z.missing?"missing":"stale"]));if(d.length){let M=await qo(d),Z=d.map(([X])=>X).filter(X=>!M.includes(X));for(let X of M)u.set(X,await Gt(X,{made:!0}));Z.length&&(console.error(`${Z.join(", ")}: the export failed (above), so nothing was looked at: fix what it says, then run this again`),process.exit(1))}let h=u,q=[...h].map(([M,{file:Z}])=>({slug:M,file:Z,first:$.get(M)??null})),L=(M,Z)=>{for(let[X,{sha256:gt,time:p}]of h)console.log(`${X}: ${qt(X)} sha256 ${gt}, exported ${Ut(p)}`);console.log(`UNVERIFIED ${M}: nothing was looked at. ${Z}`);for(let{file:X}of q)console.log(`${Re}${X}`);process.exit(3)},U=ne();U||L("no Chrome, Edge or Chromium found (GALLERY_BROWSER=<its executable> picks one)",`Install Chrome or Edge, or ${ve}`);let m=await re({executablePath:U,args:se()}).catch(M=>L(`the browser ${U} did not start, twice, each time with a fresh profile (${xo(M)}; GALLERY_BROWSER=<its executable> picks another)`,`Run gallery qa once more; if it says UNVERIFIED again, ${ve}`)),{browser:C}=m,D=Object.fromEntries(At.map(M=>[M,0])),x=new Map,H=!1;try{for(let[M,{file:Z,sha256:X,time:gt}]of h){let p=ht.join(Ue,M),A=ht.join(p,"blocks.json");console.log(`${M}: ${qt(M)} sha256 ${X}, exported ${Ut(gt)} (${ht.basename(U)}, headless)`);let J=Lt(jt(M,Rt)).html,Q=Pt(await vt.readFile(J,"utf8")),k=Vt(Q),v=ee(k,te(await vt.readFile(A,"utf8").catch(()=>null))),Y=Qt(Q),F=Zt(Q),tt=ho(k,v,r,{tiles:s.has("--tiles")&&!r,page:Y,packages:F}),ct=s.has("--tiles")||!!tt.tiles;(ct||tt.ids.length)&&(H=!0);let nt={flagged:ht.join(p,"flagged"),blocks:ht.join(p,r?"blocks":"changed"),tiles:ht.join(p,"tiles")},at=ht.join(p,"cards");nt.folders=new Map(tt.groups.flatMap(i=>i.ids.map(T=>[T,i.kind==="cards"?at:nt.blocks])));let _=[nt.flagged,...r?[nt.blocks]:tt.tiles?[]:[nt.blocks,at],...ct?[nt.tiles]:[]],ft=(await Promise.all(_.map(async i=>[i,(await vt.readdir(i).catch(()=>[])).filter(T=>T.endsWith(".png")).length]))).filter(([,i])=>i>0);ft.length&&console.log(`The pictures of the run before in ${ft.map(([i])=>`${ht.basename(i)}/`).join(", ")} (${pt(ft.reduce((i,[,T])=>i+T,0),"file")}) were removed: this run's replace them.`);for(let i of _)await vt.rm(i,{recursive:!0,force:!0});for(let i of await vt.readdir(p).catch(()=>[]))i.endsWith(".png")&&await vt.rm(ht.join(p,i),{force:!0});for(let i of _)await vt.mkdir(i,{recursive:!0});let dt=[...k].filter(([,{whole:i}])=>i).map(([i])=>i),it=[...k].filter(([,{figure:i}])=>i).map(([i])=>i),rt=[],b=null;for(let i of pe){let T=await go(C,Z,i,{out:nt,tiles:ct&&!i.laptop,blocks:i.laptop?[]:tt.ids,around:tt.around,held:i.laptop?new Map:tt.held,whole:dt,drawn:it,known:i.laptop?b:null});rt.push({...i,...T}),T.pictures.length&&(H=!0),!i.laptop&&i.width===pe.find(N=>N.laptop)?.width&&(b=new Set(T.findings.map(Yt)))}let{lines:z,levels:P,looks:K}=vo(rt,no(Q,ht.basename(J)),{...tt,tags:new Map([...k].map(([i,{tag:T}])=>[i,T]))},{folder:p,slug:M});console.log(z.join(`
|
|
5
|
-
`));for(let i of At)D[i]+=P[i];for(let{label:i,fail:T,warn:N}of K){let a=x.get(i)??{label:i,fail:0,warn:0};x.set(i,{label:i,fail:a.fail+T,warn:a.warn+N})}let R=rt.every(i=>i.counts&&!i.findings.some(T=>T.kind==="unverified")),I=ro(k,v,tt,{named:r,verified:R,failed:P.fail>0,seen:lo(tt,rt),page:Y,packages:F})??v;I&&await vt.writeFile(A,`${JSON.stringify(I)}
|
|
6
|
-
`)}}finally{await m.close()}console.log(Co(D,[...x.values()],q,{unpictured:!H})),process.exitCode=D.fail?1:D.unverified?3:0}export{zt as ADVICE,Ee as BLOCK_PICTURES,yo as CODE_SIDEWAYS,Re as HAND_OVER,Qe as INK_MARGIN,Uo as KINDS,At as LEVELS,pe as LOOKS,ve as LOOK_YOURSELF,en as MORE_PICTURES,co as MOSTLY_CHANGED,we as MOVED_PART,to as MOVED_WHOLE,me as NEIGHBOUR_EDGE,Ke as PICTURED_INFO,ko as SCROLLS,Ze as SCROLL_FRAMES,Je as SCROLL_SLACK,So as WARNED,Go as WIDE,ge as WIDTHS,ee as adoptIdless,bo as adviceOf,je as baselineOf,xe as baselineSaid,Vt as blocksOf,ho as blocksToPicture,vo as describeLooks,wo as disclosuresSaid,Le as exportBaselines,Gt as exportOf,Eo as exportingFirst,Yt as findingKey,Ce as findingLevel,uo as inkOf,Ge as layoutNotesOf,Me as levelOf,go as lookAt,Ae as missedWidths,Oe as morePictures,qe as movedBlocks,eo as movedClips,Ao as namedBlocks,ro as nextBaseline,Mo as notPicturedLine,Qt as pageOf,Xe as picturedAt,$o as picturesSaid,so as placeOf,Ie as previewBaseline,We as rankOf,te as readBaseline,on as run,lo as seenOf,no as sourceIndex,ao as staleExport,xo as startFailure,Ut as timeOf,Bo as unknownBlocks,Oo as unknownBlocksSaid,$e as urlName,Co as verdictOf,oo as wordsOf};
|
package/dist/chunk-JVHHHGEA.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __galleryRequire } from "node:module"; import { fileURLToPath as __galleryPath } from "node:url"; const require = __galleryRequire(import.meta.url); const __filename = __galleryPath(import.meta.url); const __dirname = __galleryPath(new URL(".", import.meta.url));
|
|
2
|
-
import{a as v,b as j}from"./chunk-HYMEEXKN.mjs";import c from"node:fs";import f from"node:path";import V from"node:zlib";import{escapeAttribute as $,escapeMarkup as _}from"../browser/shared/escape.mjs";import{componentOf as b,instancesOf as L,partOf as O}from"../browser/shared/components/index.mjs";import{ICON_COLOR_VALUES as I,TAB_ICON as N,glyphOf as T,iconKind as u,iconUrl as A,iconValueOf as h,tabIconValue as R}from"../browser/shared/emoji/icon-value.mjs";import{mediaTypeOf as B,mediaUrl as z}from"../browser/shared/media.mjs";import{emojiDataDirectory as J,reportsDirectory as E}from"../browser/shared/paths.mjs";import{slugPattern as P}from"../browser/shared/reports.mjs";import{documentDirectory as D}from"../browser/shared/workspace.mjs";var g=J,k=String.fromCodePoint(65039),C=null,x=null;function G(){return C??={positions:JSON.parse(c.readFileSync(f.join(g,"positions.json"),"utf8")),index:JSON.parse(c.readFileSync(f.join(g,"twemoji-index.json"),"utf8")),svg:V.gunzipSync(c.readFileSync(f.join(g,"twemoji-svg.bin")))},C}function F(t){let{positions:e,index:n,svg:o}=G(),r=[t,t.replaceAll(k,""),`${t}${k}`].find(a=>e[a]),i=r&&n[e[r][0]];return i?o.subarray(i[0],i[0]+i[1]):null}function U(t){let e=F(t);return e?`data:image/svg+xml;base64,${e.toString("base64")}`:null}function mt(t){return d(""),[...x.keys()].filter(e=>e.startsWith(`${t}/`)).map(e=>e.slice(t.length+1))}function d(t,e="currentColor"){x??=new Map(JSON.parse(c.readFileSync(f.join(g,"icons.json"),"utf8")).icons.flatMap(([,r,i,a,l])=>[[`mingcute/${r}`,a],[`tabler/${i}`,l]].filter(([,s])=>s)));let n=T(t),o=n&&x.get(`${n.set}/${n.name}`);return o?o.split("#COLOR").join(e).replace("<svg ",'<svg aria-hidden="true" '):null}function H(t){let[e,n]=I[T(t)?.color]??I.gray,o=d(t);return o&&o.replace(/<svg\b[^>]*>/,r=>`${r.replace(/ aria-hidden="true"/,"").replace(/^<svg /,'<svg xmlns="http://www.w3.org/2000/svg" ').replace(/ xmlns="http:\/\/www\.w3\.org\/2000\/svg"(?=.* xmlns=)/,"")}<style>svg{color:${e}}@media (prefers-color-scheme:dark){svg{color:${n}}}</style>`)}var K=t=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 36"><text x="18" y="18" text-anchor="middle" dominant-baseline="central" font-size="30" font-family="'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif">${_(t)}</text></svg>`;function W({value:t,slug:e=null,tab:n=!1,reportsDirectory:o=E}){let r=u(t);if(r==="emoji")return{type:"image/svg+xml",body:F(t)??Buffer.from(K(t))};if(r==="glyph"){let a=n?H(t):d(t,"#000");return a&&{type:"image/svg+xml",body:Buffer.from(a)}}if(r!=="image"||!e||!P.test(e))return null;let i=f.join(D(e,o),t);return c.existsSync(i)?{type:B(t),body:c.readFileSync(i)}:null}var M=/(<div\b[^>]*\bclass="doc-icon"[^>]*>)([\s\S]*?)(<\/div>)/g;function gt(t,{slug:e,mode:n="export",reportsDirectory:o=E}){return tt(Q(t,{mode:n}).replace(M,(r,i,a,l)=>{let s=h(r),y=u(s);if(!y)return r;let p=null;if(y==="emoji"){let m=U(s);p=m&&`<img alt="${$(s)}" src="${m}">`}else if(y==="glyph")p=d(s);else if(n==="preview")p=`<img src="${z("asset",e,s)}" alt="">`;else{let m=f.join(D(e,o),s),S=c.existsSync(m)?c.readFileSync(m):null;p=S&&`<img src="data:${B(s)};base64,${S.toString("base64")}" alt="">`}let w=n==="preview"?i.replace(/>$/,` data-ge-icon="${$(s)}">`):i;return p?`${w}${p}${l}`:`${w}${a}${l}`}),Z(Y(t),{slug:e,mode:n,reportsDirectory:o}))}var ut=t=>[...t.matchAll(M)].flatMap(e=>{let n=u(h(e[0]))==="image"?/<img\b[^>]*\bsrc="/.exec(e[2]):null;return n?[e.index+e[1].length+n.index]:[]}),q=/<button\b[^>]*\bdata-tab-icon="([^"]*)"[^>]*>/g;function Q(t,{mode:e="export"}={}){return t.replace(q,(n,o)=>{if(u(o)!=="emoji"||n.includes(N))return n;let r=e==="preview"?A(o):U(o);if(!r)return n;let i=`${N}: ${R(r)}`;return/\sstyle="/.test(n)?n.replace(/\sstyle="([^"]*)"/,(a,l)=>` style="${l.replace(/;?\s*$/,"; ")}${i}"`):n.replace(/>$/,` style="${i}">`)})}function X(t){let e=O(t,b("page").header)[0];return{all:L(t,b("icon")),own:e?O(e,b("icon").match):[]}}function Y(t){let[e]=X(v(t)).own;return e?h(j(t,e)):null}function Z(t,{slug:e,mode:n,reportsDirectory:o}){if(!t)return null;if(n==="preview")return A(t,e,{tab:!0});let r=W({value:t,slug:e,tab:!0,reportsDirectory:o});return r&&`data:${r.type};base64,${Buffer.from(r.body).toString("base64")}`}var tt=(t,e)=>e&&/<\/head>/i.test(t)&&!t.includes("data-doc-tab-icon")?t.replace(/<\/head>/i,()=>` <link rel="icon" href="${$(e)}" data-doc-tab-icon>
|
|
3
|
-
</head>`):t;export{U as a,mt as b,d as c,W as d,gt as e,ut as f,X as g,Y as h};
|