@heycys/gallery 0.1.0 → 0.1.2
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 +51 -1
- package/browser/editor/components/callout/index.mjs +40 -15
- package/browser/editor/components/columns/page.mjs +45 -32
- package/browser/editor/components/details/index.mjs +2 -1
- package/browser/editor/components/dialog/index.mjs +2 -1
- package/browser/editor/components/dialog/page.mjs +0 -18
- package/browser/editor/components/divider/index.mjs +1 -1
- package/browser/editor/components/embed/index.mjs +2 -2
- package/browser/editor/components/figure/page.mjs +10 -1
- package/browser/editor/components/file/page.mjs +2 -2
- 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 +2 -0
- package/browser/editor/components/heading/page.mjs +6 -0
- package/browser/editor/components/highlight/index.mjs +4 -20
- package/browser/editor/components/icons.mjs +13 -2
- package/browser/editor/components/image/crop.mjs +6 -9
- package/browser/editor/components/image/page.mjs +2 -2
- package/browser/editor/components/installed/index.mjs +82 -29
- package/browser/editor/components/installed/page.mjs +146 -34
- package/browser/editor/components/installed/served.mjs +6 -5
- package/browser/editor/components/instances.mjs +18 -0
- package/browser/editor/components/kit.mjs +3 -0
- package/browser/editor/components/list/page.mjs +3 -6
- package/browser/editor/components/media/page.mjs +44 -14
- package/browser/editor/components/pages.mjs +2 -2
- package/browser/editor/components/registry.mjs +68 -33
- package/browser/editor/components/section/index.mjs +2 -1
- package/browser/editor/components/set-apart.mjs +24 -0
- package/browser/editor/components/table/index.mjs +64 -5
- package/browser/editor/components/table/page.mjs +30 -19
- package/browser/editor/page/annotate/anchors.mjs +4 -3
- package/browser/editor/page/annotate/card.mjs +3 -6
- package/browser/editor/page/annotate/index.mjs +61 -34
- package/browser/editor/page/autosave.mjs +357 -38
- package/browser/editor/page/beside.mjs +5 -5
- package/browser/editor/page/block-menu/colors.mjs +3 -1
- package/browser/editor/page/block-menu/index.mjs +8 -6
- package/browser/editor/page/blocks.mjs +16 -7
- package/browser/editor/page/board/client.mjs +57 -0
- package/browser/editor/page/board/hint.mjs +145 -0
- package/browser/editor/page/board/history.mjs +119 -0
- package/browser/editor/page/board/index.mjs +970 -0
- package/browser/editor/page/board/settings.mjs +209 -0
- package/browser/editor/page/caret.mjs +5 -2
- package/browser/editor/page/changes/bar.mjs +94 -0
- package/browser/editor/page/changes/ghost.mjs +206 -0
- package/browser/editor/page/changes/gone-words.mjs +94 -0
- package/browser/editor/page/changes/index.mjs +447 -0
- package/browser/editor/page/changes/words.mjs +27 -0
- package/browser/editor/page/clipboard/import/colors.mjs +3 -3
- 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 +156 -26
- package/browser/editor/page/clipboard/own/blocks.mjs +25 -16
- package/browser/editor/page/clipboard/own/chart-keys.mjs +41 -28
- package/browser/editor/page/clipboard/own/describe.mjs +16 -7
- package/browser/editor/page/clipboard/own/export.mjs +6 -6
- package/browser/editor/page/clipboard/own/selection.mjs +3 -3
- package/browser/editor/page/clipboard/own/writers.mjs +0 -11
- package/browser/editor/page/columns/index.mjs +48 -46
- package/browser/editor/page/commit.mjs +98 -25
- package/browser/editor/page/conflicts.mjs +13 -33
- package/browser/editor/page/convert.mjs +8 -7
- package/browser/editor/page/core.mjs +81 -27
- package/browser/editor/page/custom-page.mjs +106 -0
- package/browser/editor/page/drag/index.mjs +40 -24
- package/browser/editor/page/drag/preview.mjs +9 -4
- package/browser/editor/page/editor.mjs +120 -28
- package/browser/editor/page/emoji-picker/emoji-tab.mjs +22 -13
- package/browser/editor/page/emoji-picker/grid.mjs +7 -5
- package/browser/editor/page/emoji-picker/icon-tab.mjs +4 -4
- package/browser/editor/page/emoji-picker/icons.mjs +0 -1
- package/browser/editor/page/emoji-picker/index.mjs +11 -9
- package/browser/editor/page/emoji-picker/styles.mjs +156 -2
- package/browser/editor/page/emoji-picker/support.mjs +6 -4
- package/browser/editor/page/emoji-picker/upload.mjs +14 -13
- package/browser/editor/page/fills.mjs +5 -3
- package/browser/editor/page/fold/index.mjs +348 -0
- package/browser/editor/page/fold/rule.mjs +125 -0
- package/browser/editor/page/folded.mjs +23 -0
- package/browser/editor/page/format-bar/bar.mjs +2 -1
- package/browser/editor/page/format-bar/index.mjs +1 -1
- package/browser/editor/page/geometry.mjs +8 -6
- package/browser/editor/page/handle/index.mjs +22 -14
- package/browser/editor/page/hints/index.mjs +1 -1
- package/browser/editor/page/history.mjs +24 -4
- package/browser/editor/page/insert/index.mjs +30 -17
- package/browser/editor/page/links/index.mjs +5 -3
- package/browser/editor/page/links/pages.mjs +27 -9
- package/browser/editor/page/long-runs.mjs +75 -0
- package/browser/editor/page/look.mjs +69 -6
- package/browser/editor/page/margin.mjs +63 -27
- package/browser/editor/page/media-menu/index.mjs +6 -7
- package/browser/editor/page/menu.mjs +86 -31
- package/browser/editor/page/merge.mjs +24 -0
- package/browser/editor/page/notices.mjs +3 -3
- package/browser/editor/page/offered.mjs +1 -1
- package/browser/editor/page/outline/folds.mjs +11 -10
- package/browser/editor/page/outline/index.mjs +131 -45
- package/browser/editor/page/outline/list.mjs +23 -11
- package/browser/editor/page/outline/read.mjs +1 -1
- package/browser/editor/page/outline/strip.mjs +7 -1
- package/browser/editor/page/page-objects.mjs +13 -2
- package/browser/editor/page/panel.mjs +9 -13
- package/browser/editor/page/present-links.mjs +11 -2
- package/browser/editor/page/resize/index.mjs +42 -29
- package/browser/editor/page/selection/delete.mjs +8 -6
- package/browser/editor/page/selection/index.mjs +10 -3
- package/browser/editor/page/served.mjs +14 -0
- package/browser/editor/page/session.mjs +101 -6
- package/browser/editor/page/slash-menu/index.mjs +3 -3
- package/browser/editor/page/table/cell-bar.mjs +4 -1
- package/browser/editor/page/table/cells.mjs +103 -47
- package/browser/editor/page/table/icons.mjs +3 -1
- package/browser/editor/page/table/index.mjs +40 -16
- package/browser/editor/page/table/pictures.mjs +299 -0
- package/browser/editor/page/table/views.mjs +150 -0
- package/browser/editor/page/table/widths.mjs +9 -4
- package/browser/editor/page/text-select/index.mjs +43 -14
- package/browser/editor/page/todo-writes.mjs +75 -0
- package/browser/editor/page/tooltip.mjs +1 -1
- package/browser/editor/page/type-grid.mjs +4 -3
- package/browser/editor/page/typing/code-edges.mjs +63 -17
- package/browser/editor/page/typing/index.mjs +65 -9
- package/browser/editor/page/typing/leave.mjs +1 -1
- package/browser/editor/page/ui.mjs +13 -0
- package/browser/shared/annotations.mjs +8 -10
- package/browser/shared/block-packs.mjs +404 -0
- package/browser/shared/board-places.mjs +224 -0
- package/browser/shared/card-size.mjs +59 -0
- package/browser/shared/code-folds.mjs +5 -1
- package/browser/shared/colors.mjs +17 -14
- package/browser/shared/component-catalog.mjs +345 -54
- package/browser/shared/component-source.mjs +37 -0
- package/browser/shared/components/callout.mjs +4 -2
- package/browser/shared/components/index.mjs +72 -9
- package/browser/shared/components/installed.mjs +110 -8
- package/browser/shared/components/page.mjs +22 -3
- package/browser/shared/components/state.mjs +5 -1
- package/browser/shared/components/table.mjs +1 -1
- package/browser/shared/components/text.mjs +2 -2
- package/browser/shared/document-look.mjs +183 -0
- package/browser/shared/drafts.mjs +432 -0
- package/browser/shared/emoji/data/LICENSE-lucide.txt +43 -0
- package/browser/shared/emoji/data/README.md +4 -2
- package/browser/shared/emoji/data/categories.json +1 -1
- package/browser/shared/emoji/data/keywords-en.json +1 -1
- package/browser/shared/emoji/data/keywords-zh.json +1 -1
- package/browser/shared/emoji/data/names.json +1 -1
- package/browser/shared/emoji/data/positions.json +1 -1
- package/browser/shared/emoji/data/twemoji-index.json +1 -1
- package/browser/shared/emoji/data/twemoji-svg.bin +0 -0
- package/browser/shared/emoji/data.mjs +10 -12
- package/browser/shared/emoji/emoji.mjs +8 -7
- package/browser/shared/emoji/icon-value.mjs +4 -3
- 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/html-tree.mjs +11 -5
- package/browser/shared/i18n/en.mjs +374 -35
- package/browser/shared/json-layout.mjs +47 -0
- package/browser/shared/long-runs.mjs +39 -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/new-names.mjs +5 -2
- package/browser/shared/outline-shape.mjs +128 -0
- package/browser/shared/outline.mjs +458 -0
- package/browser/shared/pack-manifest.mjs +77 -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 +388 -0
- package/browser/shared/paths.mjs +6 -0
- package/browser/shared/preferences.mjs +10 -4
- package/browser/shared/preview-server.mjs +3 -7
- package/browser/shared/session.mjs +13 -5
- package/browser/shared/shipped-blocks.mjs +299 -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 +134 -0
- package/browser/shared/workspace-columns.mjs +120 -0
- package/browser/shared/workspace-look.mjs +91 -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/browser/shared/zoom.mjs +5 -5
- package/dist/chunk-2NRBY6AJ.mjs +2 -0
- package/dist/chunk-32ZUEFZ7.mjs +2 -0
- package/dist/chunk-35NQ4PLQ.mjs +2 -0
- package/dist/chunk-3KJHLHUO.mjs +2 -0
- package/dist/chunk-3NJACR4W.mjs +2 -0
- package/dist/chunk-4AV456RQ.mjs +2 -0
- package/dist/chunk-4OZWXZE5.mjs +5 -0
- package/dist/chunk-5XYHDBJ5.mjs +2 -0
- package/dist/chunk-5ZJA7CXT.mjs +2 -0
- package/dist/chunk-6A53MZYZ.mjs +2 -0
- package/dist/chunk-6EXH3ORZ.mjs +166 -0
- package/dist/chunk-6EZ7FNIK.mjs +3 -0
- package/dist/{chunk-UXUK4PMC.mjs → chunk-6QBHU4DF.mjs} +1 -1
- package/dist/{chunk-6U2SLSDN.mjs → chunk-6VTU6KEO.mjs} +1 -1
- package/dist/chunk-B4P2CM2J.mjs +3 -0
- package/dist/chunk-BPL64HGA.mjs +4 -0
- package/dist/chunk-BVEFGE4B.mjs +2 -0
- package/dist/chunk-BZ5RAF7L.mjs +2 -0
- package/dist/chunk-CRJEG7MT.mjs +2 -0
- package/dist/{chunk-B3VTYBYR.mjs → chunk-D4CKRD3V.mjs} +91 -91
- package/dist/chunk-D4EURAX4.mjs +4 -0
- package/dist/chunk-DQCE7TJY.mjs +5 -0
- package/dist/chunk-DR73Y2UJ.mjs +3 -0
- package/dist/{chunk-TMYZB6AV.mjs → chunk-EKNHM3P4.mjs} +1 -1
- package/dist/{chunk-DB4WKGYF.mjs → chunk-ERLAIBOA.mjs} +2 -2
- package/dist/chunk-EURLTOTZ.mjs +4 -0
- package/dist/chunk-FJYN7RTH.mjs +4 -0
- package/dist/chunk-FWNRPMCJ.mjs +12 -0
- package/dist/chunk-FWW4CSAZ.mjs +2 -0
- package/dist/{chunk-2B5E4CDJ.mjs → chunk-GPIWQ4X4.mjs} +1 -1
- package/dist/chunk-GY3FAUVM.mjs +2 -0
- package/dist/chunk-HLYV7RIH.mjs +2 -0
- package/dist/chunk-HMYTM3GT.mjs +15 -0
- package/dist/chunk-IA4PSIMD.mjs +2 -0
- package/dist/chunk-JEUK3ZO7.mjs +2 -0
- package/dist/chunk-JVHHHGEA.mjs +3 -0
- package/dist/chunk-KTKHRC6H.mjs +2 -0
- package/dist/chunk-L7UP52JO.mjs +2 -0
- package/dist/chunk-MHW7ZKOU.mjs +2 -0
- package/dist/chunk-N76HWBA3.mjs +10 -0
- package/dist/chunk-N7AZZLGT.mjs +548 -0
- package/dist/chunk-NAMN3RAF.mjs +2 -0
- package/dist/{chunk-YXAUQPVK.mjs → chunk-NFMCP2HI.mjs} +3 -3
- package/dist/chunk-NG375ILQ.mjs +2 -0
- package/dist/chunk-NVRNLK25.mjs +6 -0
- package/dist/chunk-NWFBE2YA.mjs +2 -0
- package/dist/chunk-NWR2LT5B.mjs +2 -0
- package/dist/chunk-OJKMINIU.mjs +20 -0
- package/dist/chunk-OUUP3WKT.mjs +2 -0
- package/dist/chunk-OW5NWPOJ.mjs +10 -0
- package/dist/chunk-PAREWQGB.mjs +4 -0
- package/dist/chunk-POQSE4C2.mjs +2 -0
- package/dist/chunk-PUOQ65NC.mjs +2 -0
- package/dist/{chunk-Z52HTUW7.mjs → chunk-PVER7LSC.mjs} +2 -2
- package/dist/chunk-PZDLJJTJ.mjs +3 -0
- package/dist/chunk-Q47PLKIJ.mjs +15 -0
- package/dist/chunk-Q4UEPUWF.mjs +2 -0
- package/dist/chunk-QKXMPUXC.mjs +2 -0
- package/dist/chunk-QOUEFUCH.mjs +16 -0
- package/dist/chunk-RFDZXFJF.mjs +13 -0
- package/dist/chunk-RKPWLGZ3.mjs +4 -0
- package/dist/chunk-RMECZA2K.mjs +2 -0
- package/dist/{chunk-EUX7IC5J.mjs → chunk-SQ6Y2ZMA.mjs} +2 -2
- package/dist/chunk-SX4LJYT6.mjs +8 -0
- package/dist/chunk-SXHBYZST.mjs +16 -0
- package/dist/chunk-TANZRINB.mjs +2 -0
- package/dist/chunk-TEZAWDSQ.mjs +2 -0
- package/dist/chunk-UBBRTJ2R.mjs +24 -0
- package/dist/chunk-UFNYFFKO.mjs +20 -0
- package/dist/chunk-UGWYKHBL.mjs +170 -0
- package/dist/chunk-UKSHDZZ6.mjs +2 -0
- package/dist/chunk-UMHUSOPJ.mjs +2 -0
- package/dist/chunk-UNOYVIYR.mjs +2 -0
- package/dist/chunk-V6RIYQZZ.mjs +4 -0
- package/dist/chunk-VJPFVNNW.mjs +15 -0
- package/dist/chunk-VS3ZMVGX.mjs +5 -0
- package/dist/chunk-VTKNEYT3.mjs +6 -0
- package/dist/chunk-VXACTLO3.mjs +3 -0
- package/dist/chunk-W3BGBJQW.mjs +2 -0
- package/dist/chunk-YI43RG4P.mjs +2 -0
- package/dist/chunk-YQGT4AB2.mjs +6 -0
- package/dist/chunk-ZB4H7ZN4.mjs +2 -0
- package/dist/{chunk-ACOPDCNB.mjs → chunk-ZHEHPMBK.mjs} +1 -1
- package/dist/chunk-ZTHICSSF.mjs +2 -0
- package/dist/chunk-ZUNVAXLH.mjs +2 -0
- package/dist/chunk-ZWPMCK7P.mjs +2 -0
- package/dist/cli.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/{chunk-EVJ3BX3M.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 +14 -14
- package/kit/math.js +18 -2
- package/kit/report.css +500 -151
- package/kit/runtime.js +1720 -170
- package/kit/state.js +10 -1
- package/kit/tables.js +172 -37
- package/kit/ui.js +166 -27
- 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 +156 -0
- package/packs/gallery/countdown/preview.svg +1 -0
- package/packs/gallery/countdown/style.css +130 -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 +295 -0
- package/packs/gallery/habit/preview.svg +1 -0
- package/packs/gallery/habit/style.css +246 -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 +351 -0
- package/packs/gallery/heatmap/preview.svg +1 -0
- package/packs/gallery/heatmap/style.css +201 -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 +102 -0
- package/packs/gallery/note/preview.svg +1 -0
- package/packs/gallery/note/style.css +76 -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 +238 -0
- package/packs/gallery/recent/preview.svg +1 -0
- package/packs/gallery/recent/style.css +158 -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 +138 -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 +166 -0
- package/packs/gallery/stats/preview.svg +1 -0
- package/packs/gallery/stats/style.css +151 -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 +185 -0
- package/packs/gallery/today/preview.svg +1 -0
- package/packs/gallery/today/style.css +120 -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 +342 -0
- package/packs/gallery/todos/preview.svg +1 -0
- package/packs/gallery/todos/style.css +267 -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 +312 -0
- package/packs/gallery/weather/preview.svg +1 -0
- package/packs/gallery/weather/style.css +258 -0
- package/packs/gallery/weather/template.html +3 -0
- package/packs/gallery/weather/writing.md +26 -0
- package/packs/gallery-soft/pack.json +8 -0
- package/release.json +13 -11
- package/sdk/doc-kit.d.ts +404 -7
- package/sdk/doc-state.d.ts +2 -0
- package/skill/SKILL.md +71 -26
- package/skill/references/block-script.md +140 -0
- package/skill/references/building-blocks.md +257 -0
- package/skill/references/example-report.html +1 -1
- package/skill/references/extensions.md +59 -0
- package/skill/references/pages-and-data.md +221 -0
- package/skill/references/writing-html.md +9 -7
- package/skill/sdk/doc-kit.d.ts +404 -7
- package/skill/sdk/doc-state.d.ts +2 -0
- package/web/assets/index-BK2e_07w.js +13 -0
- package/web/assets/index-CWFI83mF.css +1 -0
- package/web/index.html +2 -2
- package/browser/editor/components/callout/page.mjs +0 -13
- package/dist/chunk-2PBALTR3.mjs +0 -57
- package/dist/chunk-3LA3EMDE.mjs +0 -15
- package/dist/chunk-5FRMCDPY.mjs +0 -16
- package/dist/chunk-5LEK2CBS.mjs +0 -2
- package/dist/chunk-5OFN5AHC.mjs +0 -2
- package/dist/chunk-5SIYS5HN.mjs +0 -2
- package/dist/chunk-5TEK3RAD.mjs +0 -2
- package/dist/chunk-6CYG3Z4V.mjs +0 -2
- package/dist/chunk-7GHT2UCA.mjs +0 -15
- package/dist/chunk-7QQBR7PB.mjs +0 -2
- package/dist/chunk-ATCJYAR4.mjs +0 -2
- package/dist/chunk-C7HWOBIF.mjs +0 -2
- package/dist/chunk-E7VYDG2X.mjs +0 -2
- package/dist/chunk-EZY3WC6Z.mjs +0 -15
- package/dist/chunk-FQGQH4KM.mjs +0 -2
- package/dist/chunk-G7TOXONE.mjs +0 -6
- package/dist/chunk-GPF4YWWB.mjs +0 -9
- package/dist/chunk-GYQV7Y4J.mjs +0 -120
- package/dist/chunk-HMHK3EQ6.mjs +0 -2
- package/dist/chunk-HQQMJCQJ.mjs +0 -10
- package/dist/chunk-IERUOGC3.mjs +0 -6
- package/dist/chunk-ITNLYXXV.mjs +0 -3
- package/dist/chunk-L4DVONOG.mjs +0 -2
- package/dist/chunk-LAE5NQ4B.mjs +0 -2
- package/dist/chunk-LC7YNQFG.mjs +0 -2
- package/dist/chunk-LHTFLRB6.mjs +0 -4
- package/dist/chunk-NFIBI4IP.mjs +0 -26
- package/dist/chunk-NSKUTQ5J.mjs +0 -5
- package/dist/chunk-O52JMOCZ.mjs +0 -2
- package/dist/chunk-P2CAZPDP.mjs +0 -3
- package/dist/chunk-QMQUXTU4.mjs +0 -12
- package/dist/chunk-QVWVFC5K.mjs +0 -6
- package/dist/chunk-QYKCJ7FG.mjs +0 -8
- package/dist/chunk-QZY6Q64C.mjs +0 -2
- package/dist/chunk-TDQP3DKQ.mjs +0 -10
- package/dist/chunk-TX6JH7TR.mjs +0 -2
- package/dist/chunk-UNUEWH4S.mjs +0 -2
- package/dist/chunk-V4CPWKMZ.mjs +0 -2
- package/dist/chunk-VACRB2NE.mjs +0 -3
- package/dist/chunk-W63L7367.mjs +0 -7
- package/dist/chunk-W7CXPCRV.mjs +0 -6
- package/dist/chunk-XINNG4F2.mjs +0 -4
- package/dist/chunk-YL2DPWVS.mjs +0 -4
- package/dist/chunk-YZ5Z6H4W.mjs +0 -4
- package/dist/chunk-ZBIM6ARY.mjs +0 -216
- package/skill/references/building-components.md +0 -327
- package/web/assets/index-B6Ai3wsa.js +0 -13
- package/web/assets/index-SYPC3EZy.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--font:ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Helvetica, "PingFang SC", "Microsoft YaHei", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--mono:"SFMono-Regular", Menlo, Consolas, "PT Mono", "Liberation Mono", Courier, monospace;--sb-w:270px;--dur:.2s;--texPri:#2c2c2b;--texSec:#7d7a75;--texTer:#a19e99;--texAcc:#5f5e59;--texDis:#bcbab6;--icoPri:#5c5a55;--icoSec:#8e8b86;--sidIco:#91918e;--borPri:#e6e5e3;--borSec:#f0efed;--borPriTra:#1c13011c;--borStrTra:#1b150030;--crumbSep:#d4d3cf;--bacPri:#fff;--bacSec:#f9f8f7;--bacEle:#fff;--popBac:#fff;--sidBac:#f3f2ef;--pageBac:#fff;--galleryPageBac:#f8f8f7;--bacIntTra:#211b170d;--bacTerTra:#2a1c0012;--inputBac:#f2f1ee99;--codeBg:#f9f8f7;--blue:#2383e2;--blueLine:#2383e291;--blueBg:#2383e224;--bluBacIntTra:#0079e413;--select:#2383e224;--red:#eb5757;--star:#cb912f;--btnPriBg:#2383e224;--btnPriBgHi:#2383e238;--btnPriTex:#1a69bd;--btnDanBg:#eb575724;--btnDanBgHi:#eb575738;--btnDanTex:#c4403c;--overlay:#0f0f0f99;--tipBg:#0f0f0f;--tipTex:#f0efed;--tipSub:#a19e99;--scrollThumb:#2a1c0024;--shaOutLg:0px 20px 24px 0px #1919190d, 0px 5px 8px 0px #19191907, 0px 0px 0px 1px #2a1c0012;--gra-tx:#7d7a75;--gra-sw:#f0efed;--gra-bg:#2a1c0012;--gra-bd:#1c13011c;--bro-tx:#9f765a;--bro-sw:#f5ede9;--bro-bg:#8b2e0016;--bro-bd:#7f330028;--ora-tx:#d27b2d;--ora-sw:#fbebde;--ora-bg:#e0650121;--ora-bd:#c4580034;--yel-tx:#cb9434;--yel-sw:#f9f3dc;--yel-bg:#d3a80023;--yel-bd:#d19c0048;--gre-tx:#50946e;--gre-sw:#e8f1ec;--gre-bg:#00642d17;--gre-bd:#00602628;--blu-tx:#387dc9;--blu-sw:#e5f2fc;--blu-bg:#007cd718;--blu-bd:#0076d934;--pur-tx:#9a6bb4;--pur-sw:#f3ebf9;--pur-bg:#6600b214;--pur-bd:#5c00a324;--pin-tx:#c14c8a;--pin-sw:#fae9f1;--pin-bg:#c5005d16;--pin-bd:#b7004e27;--red-tx:#cf5148;--red-sw:#fce9e7;--red-bg:#df160018;--red-bd:#ce18002a;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--texPri:#f0efed;--texSec:#ada9a3;--texTer:#7d7a75;--texAcc:#bcbab6;--texDis:#5f5e59;--icoPri:#a9a69e;--icoSec:#ada9a3;--sidIco:#9b9b9b;--borPri:#383836;--borSec:#2c2c2b;--borPriTra:#ffffeb1a;--borStrTra:#fffceb4e;--crumbSep:#383836;--bacPri:#191919;--bacSec:#202020;--bacEle:#202020;--popBac:#252525;--sidBac:#141413;--pageBac:#181818;--galleryPageBac:#181818;--bacIntTra:#ffffff0e;--bacTerTra:#fffff315;--bluBacIntTra:#4499ff1e;--inputBac:#ffffff0e;--codeBg:#ffffff08;--star:#d99e35;--overlay:#0f0f0fcc;--btnPriBg:#439bff3d;--btnPriBgHi:#439bff57;--btnPriTex:#7ab8ff;--btnDanBg:#ff685c3d;--btnDanBgHi:#ff685c57;--btnDanTex:#ff9a90;--tipBg:#2f2f2f;--tipTex:#f0efed;--tipSub:#9b9b9b;--scrollThumb:#fffff324;--shaOutLg:0px 0px 0px 1px #383836, 0px 14px 28px -6px #19191933, 0px 2px 4px -1px #1919191e;--gra-sw:#383836;--gra-bg:#ffffeb1a;--gra-bd:#ffffeb1a;--bro-sw:#45362d;--bro-bg:#ffb18131;--bro-bd:#ffb18131;--ora-sw:#53361f;--ora-bg:#ff934b47;--ora-bd:#ff934b47;--yel-sw:#504425;--yel-bg:#ffcd4b3d;--yel-bd:#ffcd4b3d;--gre-sw:#263d30;--gre-bg:#6cffac28;--gre-bd:#6cffac28;--blu-sw:#233850;--blu-bg:#439bff3d;--blu-bd:#439bff3d;--pur-sw:#3c2d47;--pur-bg:#c87dff33;--pur-bd:#c87dff33;--pin-sw:#4e2b3c;--pin-bg:#ff67b13b;--pin-bd:#ff67b13b;--red-sw:#502c29;--red-bg:#ff685c3d;--red-bd:#ff685c3d;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}}:root[data-theme=dark]{--texPri:#f0efed;--texSec:#ada9a3;--texTer:#7d7a75;--texAcc:#bcbab6;--texDis:#5f5e59;--icoPri:#a9a69e;--icoSec:#ada9a3;--sidIco:#9b9b9b;--borPri:#383836;--borSec:#2c2c2b;--borPriTra:#ffffeb1a;--borStrTra:#fffceb4e;--crumbSep:#383836;--bacPri:#191919;--bacSec:#202020;--bacEle:#202020;--popBac:#252525;--sidBac:#141413;--pageBac:#181818;--galleryPageBac:#181818;--bacIntTra:#ffffff0e;--bacTerTra:#fffff315;--bluBacIntTra:#4499ff1e;--inputBac:#ffffff0e;--codeBg:#ffffff08;--star:#d99e35;--overlay:#0f0f0fcc;--btnPriBg:#439bff3d;--btnPriBgHi:#439bff57;--btnPriTex:#7ab8ff;--btnDanBg:#ff685c3d;--btnDanBgHi:#ff685c57;--btnDanTex:#ff9a90;--tipBg:#2f2f2f;--tipTex:#f0efed;--tipSub:#9b9b9b;--scrollThumb:#fffff324;--shaOutLg:0px 0px 0px 1px #383836, 0px 14px 28px -6px #19191933, 0px 2px 4px -1px #1919191e;--gra-sw:#383836;--gra-bg:#ffffeb1a;--gra-bd:#ffffeb1a;--bro-sw:#45362d;--bro-bg:#ffb18131;--bro-bd:#ffb18131;--ora-sw:#53361f;--ora-bg:#ff934b47;--ora-bd:#ff934b47;--yel-sw:#504425;--yel-bg:#ffcd4b3d;--yel-bd:#ffcd4b3d;--gre-sw:#263d30;--gre-bg:#6cffac28;--gre-bd:#6cffac28;--blu-sw:#233850;--blu-bg:#439bff3d;--blu-bd:#439bff3d;--pur-sw:#3c2d47;--pur-bg:#c87dff33;--pur-bd:#c87dff33;--pin-sw:#4e2b3c;--pin-bg:#ff67b13b;--pin-bd:#ff67b13b;--red-sw:#502c29;--red-bg:#ff685c3d;--red-bd:#ff685c3d;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}html{scrollbar-color:var(--scrollThumb) transparent}body{font-family:var(--font);background:var(--bacPri);color:var(--texPri);-webkit-font-smoothing:antialiased;font-size:16px;line-height:1.5;overflow:hidden}button{font:inherit;color:inherit;cursor:pointer;text-align:inherit;background:0 0;border:0;margin:0;padding:0}svg{fill:none;stroke:currentColor;stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round;width:100%;height:100%;display:block}svg.fill{fill:currentColor;stroke:none}svg.solid{fill:currentColor}svg.lu{stroke-width:1.75px}.ic{display:contents}body.preload *{transition:none!important}@keyframes pop-in{0%{opacity:0;transform:translateY(-2px)}}.app{height:100dvh;font-size:14px;display:flex}.main{background:var(--bacPri);flex-direction:column;flex:1;min-width:0;font-size:16px;display:flex;position:relative}.icon-btn{width:28px;height:28px;color:var(--icoSec);border-radius:6px;flex:none;justify-content:center;align-items:center;transition:background 20ms ease-in;display:inline-flex}.icon-btn svg{width:20px;height:20px}.icon-btn svg.lu{width:18px;height:18px}.icon-btn:hover{background:var(--bacIntTra)}.ghost-btn{height:28px;color:var(--texTer);white-space:nowrap;border-radius:6px;align-items:center;gap:6px;padding:0 8px;font-size:14px;display:inline-flex}.ghost-btn svg{width:16px;height:16px}.ghost-btn:hover{background:var(--bacIntTra)}.ghost-btn.sm{height:24px}.row-act{width:20px;height:20px;color:var(--icoSec);border-radius:4px;flex:none;justify-content:center;align-items:center;display:flex}.row-act svg{width:16px;height:16px}.row-act:hover{background:var(--bacTerTra)}.pg-icon{width:20px;height:20px;color:var(--sidIco);flex:none;justify-content:center;align-items:center;font-size:16px;line-height:1;display:inline-flex}.pg-icon svg.lu{width:18px;height:18px}.pg-icon .page-icon{object-fit:cover;border-radius:3px;width:18px;height:18px;display:block}.pg-icon .page-icon.site-icon{object-fit:contain;border-radius:3px;width:16px;height:16px}.pg-icon .glyph-icon{background:currentColor;width:18px;height:18px;display:block;-webkit-mask:none 50%/contain no-repeat;mask:none 50%/contain no-repeat}.glyph-icon[data-icon$=_gray\.svg]{color:var(--lightningcss-light,#55534e)var(--lightningcss-dark,#d3d3d3)}.glyph-icon[data-icon$=_lightgray\.svg]{color:var(--lightningcss-light,#a6a299)var(--lightningcss-dark,#7f7f7f)}.glyph-icon[data-icon$=_brown\.svg]{color:var(--lightningcss-light,#9f6b53)var(--lightningcss-dark,#aa755f)}.glyph-icon[data-icon$=_yellow\.svg]{color:var(--lightningcss-light,#cb912f)var(--lightningcss-dark,#ca8e1b)}.glyph-icon[data-icon$=_orange\.svg]{color:var(--lightningcss-light,#d9730d)var(--lightningcss-dark,#d87620)}.glyph-icon[data-icon$=_green\.svg]{color:var(--lightningcss-light,#448361)var(--lightningcss-dark,#2d9964)}.glyph-icon[data-icon$=_blue\.svg]{color:var(--lightningcss-light,#337ea9)var(--lightningcss-dark,#2e7cd1)}.glyph-icon[data-icon$=_purple\.svg]{color:var(--lightningcss-light,#9065b0)var(--lightningcss-dark,#8d5bc1)}.glyph-icon[data-icon$=_pink\.svg]{color:var(--lightningcss-light,#c14c8a)var(--lightningcss-dark,#c94079)}.glyph-icon[data-icon$=_red\.svg]{color:var(--lightningcss-light,#d44c47)var(--lightningcss-dark,#cd4945)}.menu{z-index:1000;background:var(--popBac);min-width:240px;max-width:320px;box-shadow:var(--shaOutLg);-webkit-user-select:none;user-select:none;border-radius:10px;outline:none;padding:6px 0;font-size:14px;line-height:1.2;animation:.12s ease-out pop-in;position:fixed;top:0;left:0}.menu-head{color:var(--texSec);padding:6px 12px;font-size:12px;font-weight:500;line-height:14px}.menu-item{cursor:pointer;height:28px;color:var(--texPri);border-radius:6px;align-items:center;gap:8px;margin:0 4px 1px;padding:0 8px;display:flex}.menu:not(.controlled) .menu-item:hover,.menu-item.active{background:var(--bacIntTra)}.menu-item.danger:hover,.menu-item.danger.active{color:var(--red)}.menu-item.off,.menu-item.off:hover,.menu-item.off .mi-icon,.menu-item.off:hover .mi-icon{color:var(--texDis);cursor:default}.menu:not(.controlled) .menu-item.off:hover{background:0 0}.menu-item.danger:not(.off):hover .mi-icon,.menu-item.danger:not(.off).active .mi-icon{color:var(--red)}.mi-icon{width:20px;height:20px;color:var(--icoPri);flex:none;justify-content:center;align-items:center;display:flex}.mi-icon svg{width:18px;height:18px}.mi-icon svg.lu{width:16px;height:16px}.mi-label{white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.mi-line{text-overflow:ellipsis;display:block;overflow:hidden}.mi-detail{color:var(--texTer);margin-top:2px;font-size:12px}.mi-kbd{max-width:45%;color:var(--texTer);white-space:nowrap;text-overflow:ellipsis;flex:none;margin-left:8px;font-size:12px;overflow:hidden}.mi-kbd:empty{display:none}.mi-arrow{width:16px;height:16px;color:var(--texTer);flex:none}.mi-arrow svg{stroke-width:1.6px}.mi-check{width:16px;height:16px;color:var(--texPri);flex:none}.mi-check svg{stroke-width:1.8px}.mi-switch{box-sizing:border-box;background:#8783784d;border-radius:44px;flex:none;align-items:center;width:28px;height:16px;margin-left:8px;padding:2px;transition:background .2s;display:flex;position:relative}.mi-switch.on{background:var(--blue)}.mi-switch>span{background:#fff;border-radius:50%;flex:none;width:12px;height:12px;transition:transform .2s ease-out;box-shadow:0 1px 2px #0f0f0f33}.mi-switch.on>span{transform:translate(12px)}@media (prefers-color-scheme:dark){:root:not([data-theme=light]) .mi-switch:not(.on){background:#caccce4d}}:root[data-theme=dark] .mi-switch:not(.on){background:#caccce4d}.menu-sep{background:var(--bacTerTra);height:1px;margin:3px 12px 4px}.menu-foot{color:var(--texTer);padding:4px 12px 2px;font-size:12px;line-height:1.6}.menu-note{color:var(--texSec);padding:4px 12px 8px;font-size:13px;line-height:1.6}.menu-empty{color:var(--texTer);padding:8px 12px;font-size:13px}.menu-sub{min-width:180px}.menu-wide{width:320px}.pop-search{padding:2px 8px 6px}.pop-input{border:1px solid var(--borPriTra);background:var(--inputBac);width:100%;height:28px;color:var(--texPri);font:inherit;border-radius:6px;outline:none;padding:0 8px;font-size:14px}.pop-input:focus{border-color:var(--blue);box-shadow:0 0 0 1px var(--blue)}.pop-list{max-height:320px;overflow-y:auto}.trash-item{border-radius:6px;align-items:center;gap:8px;height:30px;margin:0 4px;padding:0 4px 0 8px;display:flex}.trash-item:hover{background:var(--bacIntTra)}.trash-item .t{white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.tip{z-index:3000;pointer-events:none;background:var(--tipBg);max-width:260px;color:var(--tipTex);box-shadow:var(--shaOutLg);overflow-wrap:anywhere;opacity:0;border-radius:6px;padding:4px 8px;font-size:12px;font-weight:500;line-height:1.45;transition:opacity .1s;position:fixed;top:0;left:0}.tip.show{opacity:1}.tip .sub{color:var(--tipSub);font-weight:400}.toast{z-index:2500;background:var(--tipBg);width:fit-content;max-width:min(640px,100vw - 32px);color:var(--tipTex);box-shadow:var(--shaOutLg);opacity:0;pointer-events:none;border-radius:8px;align-items:center;gap:10px;margin:0 auto;padding:8px 14px;font-size:14px;transition:opacity .18s,transform .18s;display:flex;position:fixed;bottom:24px;left:0;right:0;transform:translateY(10px)}.toast.show{opacity:1;transform:none}.toast.show button{pointer-events:auto}.toast.error:before{content:"";background:#ff6b6b;border-radius:50%;flex:none;width:6px;height:6px}.toast button{white-space:nowrap;color:#5ea8f2;border-radius:4px;flex:none;margin-right:-6px;padding:2px 6px;font-weight:500}.toast button:hover{background:#ffffff14}.dialog-overlay{align-items:flex-start;padding-top:18vh}.dialog{background:var(--popBac);width:min(420px,100%);box-shadow:var(--shaOutLg);border-radius:12px;padding:20px 20px 16px;animation:.12s ease-out pop-in}.dialog-title{color:var(--texPri);font-size:16px;font-weight:600;line-height:1.4}.dialog-message{color:var(--texSec);margin-top:8px;font-size:14px;line-height:1.6}.dialog-actions{justify-content:flex-end;gap:8px;margin-top:18px;display:flex}.dialog-btn{height:32px;color:var(--texPri);white-space:nowrap;border-radius:6px;padding:0 14px;font-size:14px;transition:background 20ms ease-in}.dialog-btn:hover:not(:disabled){background:var(--bacIntTra)}.dialog-btn:focus-visible{background:var(--bacTerTra);outline:none}.dialog-btn.primary{background:var(--btnPriBg);color:var(--btnPriTex);font-weight:500}.dialog-btn.primary:hover:not(:disabled),.dialog-btn.primary:focus-visible{background:var(--btnPriBgHi)}.dialog-btn.danger.primary{background:var(--btnDanBg);color:var(--btnDanTex)}.dialog-btn.danger.primary:hover:not(:disabled),.dialog-btn.danger.primary:focus-visible{background:var(--btnDanBgHi)}.dialog-btn:disabled{opacity:.5;cursor:default}.modal{z-index:1500;background:var(--overlay);justify-content:center;align-items:flex-start;padding:12vh 16px 0;display:flex;position:fixed;inset:0}.search-panel{background:var(--popBac);width:min(620px,100%);box-shadow:var(--shaOutLg);border-radius:12px;animation:.12s ease-out pop-in;overflow:hidden}.search-bar{border-bottom:1px solid var(--borSec);align-items:center;gap:10px;height:52px;padding:0 16px;display:flex}.search-bar svg{width:20px;height:20px;color:var(--icoSec);flex:none}.search-bar input{min-width:0;color:var(--texPri);font:inherit;background:0 0;border:0;outline:0;flex:1;font-size:16px}.search-bar input::placeholder{color:var(--texTer)}.search-list{max-height:60vh;padding:4px 0 8px;overflow-y:auto}.search-item{cursor:pointer;border-radius:6px;align-items:center;gap:10px;height:36px;margin:0 6px;padding:0 10px;display:flex}.search-item.active{background:var(--bacIntTra)}.search-item .t{white-space:nowrap;text-overflow:ellipsis;flex:none;max-width:60%;overflow:hidden}.search-item .path{text-align:right;min-width:0;color:var(--texTer);white-space:nowrap;text-overflow:ellipsis;flex:1;font-size:12px;overflow:hidden}.search-main{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.search-line{align-items:center;gap:10px;min-width:0;display:flex}.search-item.with-hit{align-items:flex-start;height:auto;min-height:36px;padding-top:6px;padding-bottom:6px}.search-item.with-hit .pg-icon{margin-top:1px}.search-snippet{min-width:0;color:var(--texSec);white-space:nowrap;text-overflow:ellipsis;font-size:13px;line-height:18px;overflow:hidden}.search-item.more{align-items:center;height:28px;min-height:0;padding:0 10px 0 40px}.search-item mark{color:var(--texPri);background:0 0;font-weight:600}.search-note{color:var(--texTer);padding:6px 16px 2px;font-size:12px}.link-view{background:var(--pageBac);flex:1;min-height:0;position:relative}.link-view.off,.link-pane.off{display:none}.link-pane{display:flex;position:absolute;inset:0}.link-frame{background:#fff;border:0;flex:1;width:100%;height:100%;display:block}.link-refused{flex:1}.link-refused-icon{width:36px;height:36px;color:var(--texTer);margin-bottom:6px}.link-refused-icon svg{width:36px;height:36px}.link-refused-url{word-break:break-all;max-width:min(560px,90%)!important;color:var(--texTer)!important;font-size:13px!important}.report-view{flex:1;min-height:0;position:relative}.report-frame{background:var(--pageBac);border:0;width:100%;height:100%;display:block}body.dragging iframe,body.resizing iframe{pointer-events:none}.report-state{text-align:center;flex-direction:column;flex:1;justify-content:center;align-items:center;gap:6px;min-height:0;padding:24px;display:flex}.report-state h2{margin:0;font-size:20px;font-weight:600}.report-state p{max-width:460px;color:var(--texSec);margin:0;font-size:14px;line-height:1.6}.report-state .muted{color:var(--texTer)}.report-state-actions{gap:8px;margin-top:10px;display:flex}.report-frame[data-pending]{opacity:0;pointer-events:none;position:absolute;inset:0}.card-underlay{z-index:900;background:var(--overlay);animation:.16s ease-out card-underlay-fade;position:fixed;inset:0}body.card-open .sb-resizer,body.card-open .sb-edge{pointer-events:none}@keyframes card-underlay-fade{0%{opacity:0}}@media (prefers-reduced-motion:reduce){.card-underlay{animation:none}}.report-view.off{display:none}.xf-overlay{z-index:1500;background:var(--overlay);justify-content:center;align-items:center;padding:16px;display:flex;position:fixed;inset:0}.xf-export,.xf-import{background:var(--popBac);box-shadow:var(--shaOutLg);color:var(--texPri);border-radius:12px;animation:.12s ease-out pop-in}.xf-export{width:320px;max-width:100%;padding:24px;font-size:14px}.xf-row{justify-content:space-between;align-items:center;height:28px;display:flex}.xf-label{color:var(--texTer);white-space:nowrap;margin-inline-end:auto;line-height:21px}.xf-select{white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;height:28px;color:var(--texPri);border-radius:6px;align-items:center;gap:6px;margin-inline-end:-6px;padding:0 8px;line-height:1.2;transition:background 20ms ease-in;display:flex}.xf-select:hover,.xf-select.open{background:var(--bacIntTra)}.xf-select svg{width:14px;height:14px;color:var(--icoSec);stroke-width:1.6px}.xf-select:focus-visible,.xf-btn:focus-visible,.xf-choose:focus-visible{background:var(--bacTerTra);outline:none}.xf-switch:focus-visible{box-shadow:0 0 0 3px var(--blueBg);outline:none}.xf-scale-row{height:32px}.xf-scale{background:var(--inputBac);width:60px;height:28px;box-shadow:0 0 0 1px var(--borPriTra);color:var(--texPri);font:inherit;text-align:end;border:none;border-radius:6px;outline:none;padding:4px 10px;font-size:14px}.xf-scale:focus{box-shadow:0 0 0 1px var(--blue) inset, 0 0 0 1px var(--blue)}.xf-error{min-height:32px;color:var(--red);align-items:center;padding:4px 0;font-size:12px;line-height:16px;display:flex}.xf-switch-row{height:32px}.xf-switch-row .xf-label{line-height:20px}.xf-switch{box-sizing:content-box;cursor:pointer;background:#8783784d;border-radius:44px;flex-shrink:0;width:26px;height:14px;padding:2px;transition:background .2s,box-shadow .2s;display:flex;position:relative}.xf-switch.on{background:var(--blue)}.xf-switch>span{background:#fff;border-radius:44px;width:14px;height:14px;transition:transform .2s ease-out,background .2s ease-out}.xf-switch.on>span{transform:translate(12px)}.xf-switch.disabled{opacity:.4;cursor:default}@media (prefers-color-scheme:dark){:root:not([data-theme=light]) .xf-switch:not(.on){background:#caccce4d}}:root[data-theme=dark] .xf-switch:not(.on){background:#caccce4d}.xf-actions{justify-content:flex-end;align-items:center;gap:8px;margin-top:16px;display:flex}.xf-btn{white-space:nowrap;cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:6px;justify-content:center;align-items:center;height:28px;padding:0 8px;font-size:14px;line-height:1.2;transition:background 20ms ease-in;display:inline-flex}.xf-btn.gray{color:var(--texSec)}.xf-btn.gray:hover{background:var(--bacIntTra)}.xf-btn.blue{background:var(--btnPriBg);color:var(--btnPriTex);font-weight:500}.xf-btn.blue:hover,.xf-btn.blue:focus-visible{background:var(--btnPriBgHi)}.xf-btn[aria-disabled=true]{opacity:.4;pointer-events:none}.menu.menu-select{z-index:1600;width:180px;min-width:180px}.menu-select .mi-icon:empty{display:none}.xf-import{flex-direction:column;gap:14px;width:min(460px,100vw - 32px);padding:20px 20px 18px;font-size:14px;display:flex}.xf-import-head{flex-direction:column;gap:2px;min-width:0;display:flex}.xf-import-title{font-size:16px;font-weight:600;line-height:1.4}.xf-import-where{color:var(--texSec);white-space:nowrap;text-overflow:ellipsis;font-size:13px;line-height:1.5;overflow:hidden}.xf-drop{border:1px dashed var(--borStrTra);color:var(--texPri);cursor:pointer;-webkit-user-select:none;user-select:none;border-radius:10px;flex-direction:column;align-items:center;gap:6px;padding:30px 16px 26px;transition:background .12s,border-color .12s;display:flex}.xf-drop:hover{background:var(--bacIntTra)}.xf-drop.dragging{border-color:var(--blue);background:var(--bluBacIntTra)}.xf-drop:focus-visible{background:var(--bacTerTra);outline:none}.xf-drop svg{width:28px;height:28px;color:var(--icoSec);stroke-width:1.4px;margin-bottom:4px;transition:color .12s}.xf-drop.dragging svg{color:var(--blue)}.xf-drop-main{line-height:20px}.xf-choose{color:var(--blue);margin-inline-start:2px}.xf-drop-kinds,.xf-import-note{color:var(--texTer);font-size:12px;line-height:16px}.pref-overlay{z-index:1500;background:var(--overlay);justify-content:center;align-items:center;padding:24px;display:flex;position:fixed;inset:0}.pref-dialog{background:var(--bacPri);width:min(880px,100%);height:min(86vh,900px);box-shadow:var(--shaOutLg);border-radius:12px;flex-direction:column;animation:.12s ease-out pop-in;display:flex;overflow:hidden}.pref-head{border-bottom:1px solid var(--borSec);flex:none;align-items:center;gap:10px;height:48px;padding:0 12px 0 20px;display:flex}.pref-title{color:var(--texPri);flex:none;font-size:14px;font-weight:600}.pref-sub{white-space:nowrap;text-overflow:ellipsis;min-width:0;color:var(--texSec);flex:1;font-size:13px;overflow:hidden}.pref-actions{flex:none;align-items:center;gap:4px;display:flex}.pref-save{height:28px;color:var(--btnPriTex);background:var(--btnPriBg);white-space:nowrap;border-radius:6px;flex:none;padding:0 10px;font-size:14px;font-weight:500}.pref-save:hover:not(:disabled),.pref-save:focus-visible{background:var(--btnPriBgHi);outline:none}.pref-save:disabled{opacity:.5;cursor:default}.pref-note{border-bottom:1px solid var(--borSec);background:var(--bacSec);color:var(--texSec);overflow-wrap:anywhere;flex:none;padding:8px 20px;font-size:13px;line-height:1.5}.pref-body{background:var(--bacPri);flex:1;min-height:0;position:relative}.pref-frame{background:var(--pageBac);border:0;width:100%;height:100%;position:absolute;inset:0}.pref-frame[data-pending]{opacity:0;pointer-events:none}.pref-loading{opacity:0;height:2px;animation:.2s ease-out .3s forwards pref-loading-in;position:absolute;top:0;left:0;right:0;overflow:hidden}.pref-loading:before{content:"";background:var(--borStrTra);border-radius:1px;width:24%;animation:1.6s ease-in-out infinite pref-loading-pass;position:absolute;top:0;bottom:0;left:0}@keyframes pref-loading-in{to{opacity:1}}@keyframes pref-loading-pass{0%{transform:translate(-100%)}to{transform:translate(417%)}}@media (prefers-reduced-motion:reduce){.pref-loading:before{width:100%;animation:none}}.comp-dialog{width:min(640px,100%);height:min(86vh,720px)}.comp-body{flex:1;min-height:0;padding:4px 20px 20px;overflow-y:auto}.comp-group{color:var(--texPri);margin:16px 0 4px;font-size:14px;font-weight:600}.comp-lead,.comp-empty{color:var(--texSec);padding:4px 0 8px;font-size:13px;line-height:1.5}.comp-problem{color:var(--texPri);margin-top:12px;font-size:13px;line-height:1.5}.comp-row{border-top:1px solid var(--borSec);align-items:center;gap:16px;padding:8px 0;display:flex}.comp-row.comp-block{gap:8px;padding:6px 0}.comp-icon{width:20px;height:20px;color:var(--icoPri);flex:none;justify-content:center;align-items:center;display:flex}.comp-icon svg{stroke-width:1.25px;width:20px;height:20px}.comp-name{min-width:0;color:var(--texPri);overflow-wrap:anywhere;flex:1;font-size:14px;line-height:20px}.comp-row.comp-pkg{padding:0;display:block}.comp-line{border-radius:6px;align-items:center;gap:8px;margin:0 -8px;padding:2px 8px;display:flex}.comp-line:hover{background:var(--bacIntTra)}.comp-head{text-align:left;min-width:0;min-height:28px;font:inherit;color:inherit;cursor:pointer;background:0 0;flex:1;align-items:center;gap:8px;padding:0;display:flex}.comp-head .comp-name{flex:0 auto}.comp-chev{width:14px;height:14px;color:var(--texTer);flex:none}.comp-chev svg{stroke-width:1.6px;transition:transform .15s ease-out}.comp-row[data-open] .comp-chev svg{transform:rotate(90deg)}.comp-tag{color:var(--texTer);flex:none;margin-left:auto;padding-left:8px;font-size:12px}.comp-detail{flex-direction:column;gap:2px;padding:0 0 10px 28px;display:flex}.comp-meta{max-width:100%;color:var(--texTer);overflow-wrap:anywhere;font-size:12px;line-height:18px;display:block}.comp-note{color:var(--texSec);overflow-wrap:anywhere;font-size:13px;line-height:18px}.comp-state{color:var(--texTer)}.comp-opts{flex-direction:column;margin-top:6px;display:flex}.comp-opt{text-align:left;font:inherit;color:inherit;cursor:pointer;background:0 0;border-radius:6px;align-items:center;gap:16px;margin:0 -8px;padding:6px 8px;display:flex}.comp-opt:hover{background:var(--bacIntTra)}.comp-opt-text{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.comp-opt .comp-toggle-name{color:var(--texPri);font-size:14px;line-height:20px}.comp-opt-hint{color:var(--texSec);overflow-wrap:anywhere;font-size:13px;line-height:18px}.comp-opt .mi-switch{margin:0}.comp-opt[aria-disabled=true]{cursor:default;opacity:.5}.comp-opt[aria-disabled=true]:hover{background:0 0}.comp-packs{grid-template-columns:repeat(auto-fill,minmax(176px,1fr));gap:8px;margin:4px 0 8px;display:grid}.comp-pack{background:var(--bacIntTra);border-radius:10px;align-items:center;gap:8px;min-height:64px;padding:0 12px 0 0;display:flex;position:relative}.comp-pack:hover{background:var(--bacTerTra)}.comp-pack-open{text-align:left;min-width:0;font:inherit;color:inherit;cursor:pointer;background:0 0;border-radius:10px 0 0 10px;flex:1;align-self:stretch;align-items:center;gap:10px;padding:10px 0 10px 12px;display:flex}.comp-pack-open:focus-visible,.comp-pack-add:focus-visible{outline:2px solid var(--blue);outline-offset:-2px}.comp-pack-icon{background:var(--bacPri);width:32px;height:32px;color:var(--icoPri);border-radius:8px;flex:none;justify-content:center;align-items:center;font-size:18px;line-height:1;display:flex}.comp-pack-icon svg{stroke-width:1.25px;width:18px;height:18px}.comp-pack-words{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.comp-pack-name{color:var(--texPri);white-space:nowrap;text-overflow:ellipsis;font-size:14px;font-weight:500;line-height:20px;overflow:hidden}.comp-pack-meta{min-width:0;color:var(--texTer);white-space:nowrap;text-overflow:ellipsis;gap:8px;font-size:12px;line-height:16px;display:flex;overflow:hidden}.comp-pack-author{text-overflow:ellipsis;min-width:0;overflow:hidden}.comp-pack[data-off] .comp-pack-name{color:var(--texSec)}.comp-pack-add{font:inherit;color:var(--texSec);cursor:pointer;justify-content:center;padding:0 12px}.comp-pack-add .comp-pack-icon{width:20px;height:20px;color:var(--texSec);background:0 0}.comp-pack-add .comp-pack-icon svg{stroke-width:1.6px;width:16px;height:16px}.comp-pack-add .comp-pack-name{color:var(--texSec);flex:none;font-weight:400}.comp-pack-add[aria-expanded=true]{background:var(--bacTerTra)}.comp-import{flex-direction:column;align-items:flex-start;gap:4px;margin:0 0 8px;display:flex}.comp-import-row{align-items:center;gap:8px;width:100%;display:flex}.comp-import-row .pop-input{flex:1;min-width:0}.comp-import-row .dialog-btn{flex:none;height:28px;padding:0 12px;font-size:13px}.comp-import-pick{height:24px;font:inherit;color:var(--texSec);cursor:pointer;background:0 0;border-radius:6px;margin:0 -6px;padding:0 6px;font-size:13px}.comp-import-pick:hover:not(:disabled){background:var(--bacIntTra)}.comp-import-error{color:var(--red);overflow-wrap:anywhere;font-size:13px;line-height:1.5}.comp-back{height:26px;font:inherit;color:var(--texSec);cursor:pointer;background:0 0;border-radius:6px;align-items:center;gap:4px;margin:0 0 6px -6px;padding:0 8px 0 6px;font-size:13px;display:inline-flex}.comp-back:hover{background:var(--bacIntTra)}.comp-pack-head{align-items:center;gap:10px;padding:2px 0 6px;display:flex}.comp-pack-view>.comp-note{margin-bottom:6px}.comp-pack-view .comp-lead{padding-top:6px}.comp-toggle{cursor:pointer;background:0 0;flex:none;align-items:center;height:24px;padding:0;display:flex}.comp-toggle .mi-switch{margin:0}.comp-toggle[aria-disabled=true]{cursor:default;opacity:.5}.present{z-index:2000;background:var(--bacPri);position:fixed;inset:0}.present-frame{background:var(--pageBac);transform-origin:0 0;border:0;width:100%;height:100%;position:absolute;top:0;left:0}.present-ink{pointer-events:none;touch-action:none;width:100%;height:100%;position:absolute;inset:0}.present:is([data-tool=laser],[data-tool=pen],[data-tool=marker],[data-tool=eraser]) .present-ink{pointer-events:auto}.present[data-tool=laser] .present-ink{cursor:none}.present[data-tool=pen] .present-ink{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Ccircle cx='8' cy='8' r='4' fill='%23e03e3e' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E") 8 8,crosshair}.present[data-tool=marker] .present-ink{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22'%3E%3Crect x='3' y='3' width='16' height='16' rx='5' fill='rgba(255,204,0,.55)' stroke='rgba(120,90,0,.55)' stroke-width='1'/%3E%3C/svg%3E") 11 11,crosshair}.present[data-tool=eraser] .present-ink{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Ccircle cx='12' cy='12' r='10' fill='rgba(140,140,140,.28)' stroke='rgba(110,110,110,.9)' stroke-width='1.5'/%3E%3C/svg%3E") 12 12,default}.present-notice{background:var(--tipBg);color:var(--tipTex);box-shadow:var(--shaOutLg);white-space:nowrap;pointer-events:none;border-radius:8px;padding:8px 14px;font-size:14px;position:absolute;bottom:24px;left:50%;transform:translate(-50%)}.present-bar{background:var(--popBac);box-shadow:var(--shaOutLg);border-radius:10px;align-items:center;gap:2px;padding:4px;transition:opacity .3s;display:flex;position:absolute;bottom:16px;left:16px}.present-bar.idle{opacity:.25}.present-btn{width:32px;height:32px;color:var(--icoPri);border-radius:6px;justify-content:center;align-items:center;display:flex}.present-btn:hover{background:var(--bacIntTra)}.present-btn[aria-pressed=true]{background:var(--bacTerTra);color:var(--texPri)}.present-btn:disabled{opacity:.35;pointer-events:none}.present-btn svg{width:18px;height:18px}.present-sep{background:var(--borSec);flex:none;width:1px;height:18px;margin:0 4px}.present-zoom{min-width:48px;height:32px;color:var(--texPri);font-variant-numeric:tabular-nums;text-align:center;border-radius:6px;flex:none;padding:0 4px;font-size:13px}.present-zoom:hover{background:var(--bacIntTra)}.present-ink{mix-blend-mode:multiply}:root[data-theme=dark] .present-ink{mix-blend-mode:screen}@media (prefers-color-scheme:dark){:root:not([data-theme=light]) .present-ink{mix-blend-mode:screen}}body:has(.present) .toast{display:none}.sb-container{z-index:20;width:var(--sb-w);background:var(--sidBac);transition:width var(--dur) ease;flex:none;position:relative}.sb-container.collapsed{width:0}.sb-anchor{z-index:9;width:0;position:absolute;top:0;bottom:0;left:0}.sidebar{width:var(--sb-w);height:100%;transition-property:width,opacity,transform,visibility;transition-duration:var(--dur);flex-direction:column;transition-timing-function:ease;display:flex;position:relative}.sidebar .float-bg{z-index:-1;background:var(--sidBac);box-shadow:var(--shaOutLg);border-radius:0 14px 14px 0;display:none;position:absolute;inset:0}.sb-inner{flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden}.sidebar.floating{height:calc(100vh - 91px);transform:translateX(calc(20px - var(--sb-w))) translateY(59px);opacity:0;visibility:hidden;pointer-events:none}.sidebar.floating .float-bg{display:block}.sidebar.floating .sb-inner{border-radius:0 14px 14px 0}.sidebar.floating:before{content:"";height:15px;position:absolute;top:-15px;left:0;right:0}.sidebar.floating.peek{opacity:1;visibility:visible;pointer-events:auto;transform:translate(0)translateY(59px)}.sidebar.mobile{height:auto;width:min(var(--sb-w), 86vw);visibility:hidden;pointer-events:none;position:fixed;top:0;bottom:0;left:0;transform:translate(-100%)}.sidebar.mobile .float-bg{display:block}.sidebar.mobile .sb-inner{border-radius:0 14px 14px 0}.sidebar.mobile.mobile-open{visibility:visible;pointer-events:auto;transform:none}.sb-backdrop{z-index:1;background:var(--overlay);display:none;position:fixed;inset:0}.sb-backdrop.show{display:block}.sb-edge{z-index:8;width:32px;display:none;position:fixed;top:44px;bottom:0;left:0}.app.peekable .sb-edge{display:block}.sb-resizer{cursor:col-resize;z-index:10;width:12px;position:absolute;top:0;bottom:0;right:-11px}.sb-resizer:after{content:"";background:0 0;width:2px;transition:background .15s;position:absolute;top:0;bottom:0;left:-1px}.sb-resizer:hover:after,body.resizing .sb-resizer:after{background:var(--borStrTra)}body.resizing,body.resizing *{cursor:col-resize!important;-webkit-user-select:none!important;user-select:none!important}body.resizing .sb-container,body.resizing .sidebar{transition:none!important}.sb-head{flex-direction:column;flex:none;gap:1px;padding:8px 8px 4px;transition:box-shadow .15s;display:flex}.sb-head.scrolled{box-shadow:0 1px 0 var(--borSec)}.sb-top{align-items:center;gap:5px;height:28px;margin-bottom:7px;padding-left:5px;display:flex}.sidebar.floating .sb-top{display:none}.sb-brand{white-space:nowrap;min-width:0;color:var(--texPri);cursor:default;-webkit-user-select:none;user-select:none;font-family:Iowan Old Style,Palatino Linotype,Palatino,Book Antiqua,Georgia,serif;font-size:19px;font-weight:400;line-height:28px;overflow:hidden}.sb-act{min-width:0;height:30px;color:var(--texSec);text-align:left;border-radius:6px;align-items:center;gap:8px;padding:0 8px;font-size:14px;font-weight:500;transition:background 20ms ease-in;display:flex}.sb-act:hover{background:var(--bacIntTra)}.sb-act-icon{width:22px;height:20px;color:var(--sidIco);flex:none;justify-content:center;align-items:center;display:flex}.sb-act-icon svg{width:18px;height:18px}.sb-act-label{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}.sb-brand.home{cursor:pointer}.sb-pages{flex-direction:column;gap:1px;margin-top:3px;display:flex}.sb-page{cursor:pointer;-webkit-user-select:none;user-select:none;outline:none}.sb-act.selected{background:var(--bacIntTra);color:var(--texPri)}.sb-act.selected:hover,.sb-act.menu-open,.sb-page:focus-visible{background:var(--bacTerTra)}.sb-page .pg-icon{justify-content:center;align-items:center;width:20px;height:20px;display:flex}.sb-page.renaming{cursor:default}.sb-page .row-rename{margin:0 -2px 0 -6px;font-weight:400}.sb-scroll{scrollbar-width:thin;scrollbar-color:var(--scrollThumb) transparent;flex:1;min-height:0;padding:6px 0 12px;position:relative;overflow:hidden auto}.section{margin:0 8px 4px}.section.expanded{padding-bottom:12px}.sec-head{-webkit-user-select:none;user-select:none;align-items:center;height:30px;padding:0 2px;display:flex}.sec-toggle{border-radius:6px;flex:0 auto;align-items:center;gap:2px;min-width:0;height:22px;padding:0 4px 0 6px;display:inline-flex}.sec-text{white-space:nowrap;text-overflow:ellipsis;min-width:0;line-height:16px;overflow:hidden}.sec-toggle:hover,.sec-head.menu-open .sec-toggle{background:var(--bacIntTra)}.sec-label{color:var(--texTer);font-size:12px;font-weight:500;line-height:16px}.sec-chev{width:12px;height:12px;color:var(--texTer);opacity:0;flex:none;transition:opacity .1s}.sec-chev svg{stroke-width:1.8px;transition:transform .2s ease-out}.section.expanded .sec-chev svg{transform:rotate(90deg)}.sec-toggle:hover .sec-chev,.sec-head.menu-open .sec-chev{opacity:1}.tree{margin-top:1px}.row{height:30px;padding:5px 8px 5px calc(8px + var(--depth,0) * 8px);cursor:pointer;-webkit-user-select:none;user-select:none;color:var(--texAcc);border-radius:6px;align-items:center;margin-bottom:1px;font-size:14px;display:flex;position:relative}.row:hover,.row.menu-open{background:var(--bacIntTra)}.row.selected{background:var(--bacIntTra);color:var(--texPri)}.row.selected:hover,.row.selected.menu-open{background:var(--bacTerTra)}.row-icon{flex:none;justify-content:center;align-items:center;width:22px;height:20px;margin-right:8px;display:flex;position:relative}.row-chevron{width:20px;height:20px;color:var(--texTer);opacity:0;border-radius:4px;justify-content:center;align-items:center;display:flex;position:absolute;top:0;left:1px}.row-chevron svg{stroke-width:1.8px;width:12px;height:12px;transition:transform .2s ease-out}.node.open>.row .row-chevron svg{transform:rotate(90deg)}.row.has-kids:hover .row-chevron{opacity:1}.row.has-kids:hover .pg-icon{opacity:0}.row-chevron:hover{background:var(--bacTerTra)}.row-title{white-space:nowrap;text-overflow:ellipsis;flex:0 auto;min-width:0;line-height:21px;overflow:hidden}.row-actions{flex:none;align-items:center;gap:2px;margin-left:auto;padding-left:4px;display:none}.row:hover .row-actions,.row.menu-open .row-actions{display:flex}.row.renaming{cursor:default}.row.renaming .row-actions{display:none}.row-rename{background:var(--inputBac);min-width:0;height:24px;color:var(--texPri);font:inherit;box-shadow:inset 0 0 0 1px var(--blueLine), 0 0 0 2px var(--blueBg);border:0;border-radius:4px;outline:none;flex:1;margin:0 -2px 0 -6px;padding:0 6px;font-size:14px}@media (hover:none){.row.has-kids .row-chevron{opacity:1}.row.has-kids .pg-icon{opacity:0}}body.dragging,body.dragging *{cursor:grabbing!important;-webkit-user-select:none!important;user-select:none!important}body.dragging .row:not(.selected):hover{background:0 0}body.dragging .row-actions{display:none!important}body.dragging .row:hover .row-chevron{opacity:0}body.dragging .row:hover .pg-icon{opacity:1}.row.drag-src{opacity:.4}.row.drop-inside{background:var(--blueBg)!important}.drop-line{background:var(--blueLine);pointer-events:none;z-index:5;border-radius:2px;height:3px;display:none;position:absolute}.drop-line.show{display:block}.drag-ghost{z-index:3000;pointer-events:none;background:var(--popBac);height:30px;color:var(--texPri);box-shadow:var(--shaOutLg);opacity:.9;white-space:nowrap;border-radius:6px;align-items:center;gap:8px;padding:0 10px 0 8px;font-size:14px;display:flex;position:fixed;top:0;left:0;overflow:hidden}.drag-ghost .t{text-overflow:ellipsis;overflow:hidden}.sb-foot{flex:none;align-items:center;gap:4px;height:44px;padding:0 8px;display:flex}.ws-btn{min-width:0;height:28px;color:var(--texSec);text-align:left;border-radius:6px;flex:1;align-items:center;gap:8px;padding:0 6px 0 8px;font-size:14px;font-weight:500;display:flex}.ws-btn svg{width:18px;height:18px;color:var(--sidIco);flex:none}.ws-btn:hover,.ws-btn.menu-open{background:var(--bacIntTra)}.ws-name{white-space:nowrap;text-overflow:ellipsis;min-width:0;overflow:hidden}@media (width<=768px){.sb-resizer{display:none}}.sb-note{color:var(--texTer);margin:4px 16px;font-size:13px}.sb-note.inset{margin:2px 8px 4px;padding-left:8px}.ws-dot{background:var(--texDis);border-radius:50%;flex:none;width:7px;height:7px}.ws-dot.ready{background:var(--gre-tx)}.ws-dot.loading{background:var(--yel-tx)}.ws-dot.offline,.ws-dot.error{background:var(--red-tx)}.sb-new-line{flex-direction:column;display:flex;position:relative}.sec-head{position:relative}.sec-actions{flex:none;align-items:center;gap:2px;margin-left:auto;padding-left:4px;padding-right:6px;display:none}.sec-head:hover .sec-actions,.sec-head.menu-open .sec-actions{display:flex}.sec-head .row-rename{flex:none;width:calc(100% - 8px);height:24px;margin:0 4px;font-size:12px}body.dragging .sec-actions{display:none!important}.section.drag-src{opacity:.4}.sb-empty{height:26px;margin:2px 0 4px;padding:0 8px 0 38px;line-height:26px}.sb-ext-note{overflow-wrap:anywhere;line-height:1.5}.row-tag{min-width:0;color:var(--texTer);white-space:nowrap;text-align:right;text-overflow:ellipsis;flex:1 1 0;padding-left:6px;font-size:12px;overflow:hidden}.row:hover .row-tag,.row.menu-open .row-tag{display:none}.link-form{padding:0 0 2px}.link-field{padding:2px 12px 6px;display:block}.link-label{color:var(--texSec);margin-bottom:4px;font-size:12px;display:block}.link-error{color:var(--red);margin:0 12px 6px;font-size:13px;line-height:1.5}.link-actions{justify-content:flex-end;gap:8px;padding:6px 12px 4px;display:flex}.link-actions .dialog-btn{height:28px;padding:0 12px;font-size:13px}.row.missing .row-title,.row.missing .pg-icon{color:var(--texTer);opacity:.7}.sec-above{color:var(--texTer);margin-left:4px;font-size:12px;font-weight:400;line-height:16px}.project-form{padding:0 0 2px}.project-path{align-items:center;gap:8px;padding:2px 12px 8px;display:flex}.project-path .pop-input{flex:1;min-width:0}.project-path .dialog-btn{flex:none;height:28px;padding:0 12px;font-size:13px}.project-list{border-top:1px solid var(--borSec);scrollbar-width:thin;scrollbar-color:var(--scrollThumb) transparent;max-height:300px;padding:4px 6px;overflow-y:auto}.project-row{height:30px;padding:5px 8px 5px calc(4px + var(--depth,0) * 8px);cursor:pointer;-webkit-user-select:none;user-select:none;color:var(--texAcc);border-radius:6px;align-items:center;gap:8px;margin-bottom:1px;font-size:14px;display:flex}.project-row:hover{background:var(--bacIntTra)}.project-row.selected{background:var(--bacIntTra);color:var(--texPri)}.project-row.selected:hover{background:var(--bacTerTra)}.project-toggle{width:20px;height:20px;color:var(--texTer);border-radius:4px;flex:none;justify-content:center;align-items:center;display:flex}.project-toggle:hover:not(:disabled){background:var(--bacTerTra)}.project-toggle svg{stroke-width:1.8px;width:12px;height:12px;transition:transform .2s ease-out}.project-toggle[aria-expanded=true] svg{transform:rotate(90deg)}.project-toggle:disabled{visibility:hidden}.project-row .mi-icon{color:var(--sidIco)}.project-document{padding-left:calc(4px + 28px + var(--depth,0) * 8px)}.project-above{color:var(--texTer);margin-left:6px;font-size:12px;font-weight:400}.project-count{color:var(--texTer);flex:none;font-size:12px}.tb-right .icon-btn.annot-open,.tb-right .icon-btn.annot-open:hover{background:var(--bacTerTra)}.menu.annot-list{width:320px;margin-top:4px}.annot-list .menu-scroll{max-height:384px;overflow-y:auto}.annot-list .menu-scroll .menu-item{height:44px}.annot-list .menu-scroll .mi-icon{display:none}.topbar{background:var(--bacPri);z-index:5;flex:none;align-items:center;gap:8px;height:44px;padding:0 12px;display:flex;position:relative}.topbar.tb-page{background:var(--galleryPageBac)}.tb-left{flex:1;align-items:center;min-width:0;display:flex}.tb-menu{color:var(--icoPri);margin:0 4px 0 1px;display:none}.app.sb-collapsed .tb-menu{display:inline-flex}.crumbs{align-items:center;min-width:0;display:flex;overflow:hidden}.crumb-wrap{display:contents}.crumb{white-space:nowrap;min-width:0;max-width:220px;height:24px;color:var(--texPri);border-radius:6px;align-items:center;gap:6px;padding:2px 6px;font-size:14px;display:inline-flex}.crumb:hover{background:var(--bacIntTra)}.crumb .t{text-overflow:ellipsis;overflow:hidden}.crumb .emoji{font-size:14px;line-height:1}.crumb.crumb-rename{width:220px;padding:0}.crumb-rename .row-rename{margin:0}.crumb-sep{color:var(--crumbSep);-webkit-user-select:none;user-select:none;flex:none;margin:0 1px;font-size:13px}.crumb-pop{z-index:1000;background:var(--popBac);width:180px;max-height:calc(100vh - 16px);box-shadow:var(--shaOutLg);-webkit-user-select:none;user-select:none;scrollbar-width:thin;scrollbar-color:var(--scrollThumb) transparent;border-radius:10px;flex-direction:column;gap:1px;padding:4px;font-size:14px;line-height:1.2;display:flex;position:fixed;top:0;left:0;overflow-y:auto}.crumb-pop-head{color:var(--texSec);white-space:nowrap;flex:none;margin:6px 0 8px;padding:0 8px;font-size:12px;font-weight:500}.crumb-pop-item{cursor:pointer;height:28px;color:var(--texPri);border-radius:6px;flex:none;align-items:center;gap:8px;padding:0 8px;display:flex}.crumb-pop-item:hover,.crumb-pop-item.open,.crumb-pop-item.trigger{background:var(--bacIntTra)}.crumb-pop-item.current{background:var(--bluBacIntTra)}.crumb-pop-item .t{white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;overflow:hidden}.crumb-pop-item.more{color:var(--texSec)}.crumb-pop-arrow{width:16px;height:16px;color:var(--texDis);flex:none}.crumb-pop-arrow svg{stroke-width:1.8px}.tb-right{flex:none;align-items:center;gap:2px;display:flex}.tb-right .icon-btn{color:var(--icoPri)}.tb-right .icon-btn.on{color:var(--star)}.tb-right .icon-btn.menu-open{background:var(--bacIntTra)}.edited{color:var(--texTer);white-space:nowrap;margin-right:8px;font-size:14px}@media (width<=1000px){.edited{display:none}}.session-badge{white-space:nowrap;border-radius:10px;flex:none;margin-left:8px;padding:1px 8px;font-size:12px;line-height:20px}.session-badge.muted{color:var(--texTer)}.session-badge.warn{color:var(--ora-tx);background:var(--ora-bg)}.session-badge.danger{color:var(--red-tx);background:var(--red-bg)}.menu.look-menu{width:224px;max-width:none;padding-bottom:8px}.look-fonts,.look-row{gap:4px;padding:0 8px;display:flex}.look-fonts{margin-bottom:4px}.look-font,.look-option{min-width:0;color:var(--texPri);font:inherit;cursor:pointer;background:0 0;border:0;border-radius:6px;flex:1 1 0;transition:background 20ms ease-in}.look-font{flex-direction:column;align-items:center;padding:8px 4px 6px;display:flex}.look-glyph{white-space:nowrap;height:30px;font-size:24px;line-height:30px}.look-caption{color:var(--texSec);white-space:nowrap;text-overflow:ellipsis;max-width:100%;margin-top:2px;font-size:12px;line-height:16px;overflow:hidden}.look-option{white-space:nowrap;justify-content:center;align-items:center;height:28px;padding:0 4px;font-size:14px;display:flex}.look-font:hover,.look-option:hover{background:var(--bacIntTra)}.look-row.look-off .look-option{opacity:.45}.look-font.on .look-glyph,.look-option.on{color:var(--blue)}.look-font:focus-visible,.look-option:focus-visible{background:var(--bacTerTra);outline:none}.look-menu .menu-sep{margin:8px 12px 4px}.link-crumb{cursor:default}.link-crumb:hover{background:0 0}.link-crumb .pg-icon{flex:none;justify-content:center;align-items:center;width:18px;height:18px;display:flex}.link-crumb .pg-icon svg,.link-crumb .pg-icon img{width:16px;height:16px}.tb-open{color:var(--texSec);margin-right:2px}
|
package/web/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>Gallery</title>
|
|
7
7
|
<link rel="icon" href="data:," />
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-BK2e_07w.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CWFI83mF.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body class="preload">
|
|
12
12
|
<div id="root"></div>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { addStyle } from "../../page/ui.mjs";
|
|
2
|
-
|
|
3
|
-
// Its fill keeps the kit's square corners while it is edited (the light blue of it selected lies
|
|
4
|
-
// 6px past them, round: the kit's --doc-box-reach, overlay-layer.mjs reachOf).
|
|
5
|
-
const STYLE = `
|
|
6
|
-
[data-ge-editing] .doc-callout[contenteditable="true"] { --ge-text-radius: 0px; }
|
|
7
|
-
`;
|
|
8
|
-
|
|
9
|
-
/** A callout on the page: its look while edited. */
|
|
10
|
-
export function create() {
|
|
11
|
-
addStyle(STYLE);
|
|
12
|
-
return {};
|
|
13
|
-
}
|
package/dist/chunk-2PBALTR3.mjs
DELETED
|
@@ -1,57 +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 w}from"./chunk-TX6JH7TR.mjs";import{c as N}from"./chunk-ZBIM6ARY.mjs";import{a as k,b as d,f as O}from"./chunk-NSKUTQ5J.mjs";import{i as S}from"./chunk-HQQMJCQJ.mjs";import{c as u,g as x,o as A,p as C,r as b}from"./chunk-W63L7367.mjs";import $ from"node:fs";import v from"node:path";import{blocksHidden as D}from"../browser/editor/components/registry.mjs";import{PACKAGE_ID as K}from"../browser/shared/components/installed.mjs";import{DEVICE_NAMES as R,layoutOf as F,PACKAGE_MANIFEST as U,shallowPackages as T}from"../browser/shared/workspace.mjs";var W=(e,t,o)=>`{
|
|
3
|
-
"id": "${e}",
|
|
4
|
-
"apiVersion": 1,
|
|
5
|
-
"version": "0.1.0",
|
|
6
|
-
"name": { "zh": "${t}", "en": "${t}" },
|
|
7
|
-
"description": { "zh": "\u4E00\u4E2A\u53EF\u4EE5\u53CD\u590D\u4F7F\u7528\u7684\u5757", "en": "A block to use again" },
|
|
8
|
-
"words": "${t}",
|
|
9
|
-
"parts": {
|
|
10
|
-
"title": { "at": ":scope > h3", "edit": "text" },
|
|
11
|
-
"text": { "at": ":scope > p", "edit": "text", "optional": true }
|
|
12
|
-
},${o?`
|
|
13
|
-
"runtime": { "generated": [".component-drawn"] },`:""}
|
|
14
|
-
"markdown": "parts"
|
|
15
|
-
}
|
|
16
|
-
`,P=(e,t,o)=>`<div data-doc-component="${e}">
|
|
17
|
-
<h3>${t}</h3>
|
|
18
|
-
<p>${o}</p>
|
|
19
|
-
</div>
|
|
20
|
-
`,G=e=>`/* Every selector starts at the instance, so that nothing here reaches the rest of the page. */
|
|
21
|
-
[data-doc-component="${e}"] { padding: 12px 16px; border: 1px solid var(--doc-border); border-radius: 8px; }
|
|
22
|
-
[data-doc-component="${e}"] > h3 { margin-top: 0; }
|
|
23
|
-
`,M=(e,t,o)=>`# ${t}
|
|
24
|
-
|
|
25
|
-
What this block is for, and when a document uses it rather than a block of Gallery's own.
|
|
26
|
-
|
|
27
|
-
## How to write it
|
|
28
|
-
|
|
29
|
-
Write the element as example.html does: \`gallery component show ${e}\` prints it. Each part, and what goes in it:
|
|
30
|
-
|
|
31
|
-
- the title, its \`h3\`: required.
|
|
32
|
-
- the text, its \`p\`: optional.
|
|
33
|
-
|
|
34
|
-
## How it looks
|
|
35
|
-
|
|
36
|
-
What a reader sees of it, and what it shows while it is empty.
|
|
37
|
-
${o?`
|
|
38
|
-
## Its script
|
|
39
|
-
|
|
40
|
-
kit.js runs with the rights of a document's own script. What it draws, it draws in what the manifest's \`runtime\` names.
|
|
41
|
-
`:""}`,_=e=>`// Starts each instance from what the file says, and draws in a node the manifest's runtime names:
|
|
42
|
-
// the kit takes that off an instance before it starts one again, as an undo may put one back.
|
|
43
|
-
DocKit.component({
|
|
44
|
-
id: "${e}",
|
|
45
|
-
on: ["source"],
|
|
46
|
-
mount(host, context) {
|
|
47
|
-
const drawn = document.createElement("div");
|
|
48
|
-
drawn.className = "component-drawn";
|
|
49
|
-
host.append(drawn);
|
|
50
|
-
const draw = () => { drawn.textContent = context.part("title")?.textContent ?? ""; };
|
|
51
|
-
draw();
|
|
52
|
-
return { update: draw };
|
|
53
|
-
},
|
|
54
|
-
});
|
|
55
|
-
`;function I(e,{script:t=!1}={}){let o=e.split("/")[1];return{"component.json":W(e,o,t),"template.html":P(e,"\u6807\u9898","\u5199\u5728\u8FD9\u91CC\u3002"),"example.html":P(e,"\u4E00\u4E2A\u4F8B\u5B50","\u8FD9\u91CC\u5199\u8FD9\u4E2A\u5757\u5728\u4E00\u4EFD\u6587\u6863\u91CC\u7684\u6837\u5B50\u3002"),"writing.md":M(e,o,t),"style.css":G(e),...t?{"kit.js":_(e)}:{}}}var j="local";function B(e){let t=e.includes("/")?e:`${j}/${e}`;if(!K.test(t))throw new d(`Not a component's id: ${e} (<scope>/<name>, each in lowercase letters, digits and hyphens; a <name> alone is ${j}/<name>).`);let o=t.split("/").find(n=>R.has(n));if(o)throw new d(`Not a component's id: ${e} (Windows keeps ${o} for a device).`);return t}var V=(e,t)=>v.join(F(e).components,...t.split("/")),H=({name:e,file:t})=>`${w(t)} is one level too shallow, and no catalog reads it: a package is components/<scope>/<name>/, so move it to components/${j}/${e}/`;function Y(e,t){let o=T(e).find(({name:n})=>n===t.split("/")[1]);return o?H(o):`No component ${t} in ${w(F(e).components)}: gallery component list says which there are.`}function q(e,t,{script:o}){let n=V(e,t);if($.existsSync(n)||u(e).problems.has(t)){let s=!$.existsSync(v.join(n,U));console.error(s?`A folder is there with no component.json: ${w(n)}: move it, or give this component another name.`:`Component already exists: ${w(n)}: gallery component show ${t} says what it is; give a new one another name.`),process.exit(1)}let a=I(t,{script:o});try{$.mkdirSync(n,{recursive:!0});for(let[s,r]of Object.entries(a).reverse())$.writeFileSync(v.join(n,s),r)}catch(s){if(!s.code)throw s;console.error(`Cannot write ${w(n)} (${s.code}).`),process.exit(1)}console.log(`Created ${w(n)}: ${Object.keys(a).join(", ")}`),console.log(`Next: say in component.json what it is (its name, description and parts), write template.html, what "/" puts in a document, and example.html, an instance as a writer would fill it, then writing.md and style.css${o?" and kit.js":""} (references/building-components.md has every field and the rules), and run gallery component check ${t}, which passes as it stands now.`)}var g=({zh:e,en:t})=>e===t?e:`${e} / ${t}`;function z(e){if(C(e))return null;let t=A(e);return t?x("en",t):"it has no template.html"}var J={disabled:"disabled: its instances show as they stand, no script and no style",hidden:"hidden: the menus do not offer it, and the instances there go on running"};function L(e){let t=u(e),o=b(t),n=o.filter(({reason:i})=>i),a=o.filter(({reason:i})=>!i),s=a.filter(({state:i})=>i==="normal"),r=T(e),c=D(t.settings.hidden),p=()=>{c.length&&console.log(`Hidden by the user, not to write unless asked for: ${c.join(", ")}`)};if(console.log(`\u5DE5\u4F5C\u533A\uFF1A${w(e)}`),a.length+n.length+r.length===0){console.log("No component packages yet. A document is written with Gallery's blocks and whole blocks; gallery component new <id> starts a package when the user wants a block to use again."),p();return}console.log(s.length?`${s.length} component${s.length===1?"":"s"} to write with (gallery component show <id> says how):`:"No component to write with now.");for(let{id:i,name:l,version:m,description:y}of s){console.log(`${i} ${g(l)}`),console.log(` \u7248\u672C\uFF1A${m}\uFF08available\uFF09`),console.log(` \u8BF4\u660E\uFF1A${g(y)}`);let E=z(t.packages.get(i));E&&console.log(` \u6A21\u677F\uFF1Athe menus cannot insert it, and a document can still write it: ${E}`)}let h=a.filter(({state:i})=>i!=="normal");h.length+n.length+r.length>0&&console.log("Not to write with now:");for(let{id:i,name:l,version:m,state:y}of h)console.log(`${i} ${g(l)} ${m} ${J[y]}`);for(let{id:i,reason:l,version:m}of n)console.log(`${i}${m?` ${m}`:""} does not load: ${l.en}`);for(let i of r)console.log(H(i));p()}var Q=(e,{at:t,edit:o,optional:n,min:a,max:s})=>{let r=[n?"optional":"",a!==void 0?`at least ${a}`:"",s!==void 0?`at most ${s}`:""].filter(Boolean);return` ${e} ${t} ${o}${r.length?` (${r.join(", ")})`:""}`};function X(e,t){let o=u(e),n=o.problems.get(t),a=o.packages.get(t)??(n?.off?n:void 0);if(!a){let h=n?.problem;console.error(h?`${t} does not load: ${x("en",h)}`:Y(e,t)),process.exit(1)}let{state:s}=b(o).find(h=>h.id===t);console.log(`${t} ${g(a.name)}`),console.log(` \u7248\u672C\uFF1A${a.version}\uFF08${s==="normal"?"available":s}\uFF09`),console.log(` \u8BF4\u660E\uFF1A${g(a.description)}`),console.log(` ${w(a.folder)}`);let r=Object.entries(a.parts);console.log(r.length?"Parts (edit text: the user types there; none, or data: the component's):":"No parts.");for(let[h,i]of r)console.log(Q(h,i));let c=S(a,"writing.md")?.trimEnd();console.log(c?`How to write it (writing.md):
|
|
56
|
-
${c}`:"How to write it: the package has no writing.md.");let p=S(a,"example.html")?.trimEnd();console.log(p?`The example (example.html):
|
|
57
|
-
${p}`:"The example: the package has no example.html."),console.log("In a document: write the element as the example does, straight in the page or a section, with no data-block-id, which the export gives it.")}var f={new:(e,t,o)=>q(e,t,{script:o}),list:L,show:X,check:async(e,t)=>(await import("./chunk-YL2DPWVS.mjs")).checkCommand(e,t),try:async(e,t)=>(await import("./chunk-GPF4YWWB.mjs")).tryCommand(e,t)},Z=["--press","--drag","--to","--key"];function ee(e){let t=e.indexOf("--"),o=(t===-1?e:e.slice(0,t)).findIndex(s=>s==="--key"||s.startsWith("--key="));if(o===-1)return{argv:e,key:null};let n=o+(e[o].includes("=")?1:2),a=e[n];if(a===void 0||n===t||k(a))throw new d("--key takes a selector and a key: --key <selector> <key> (Enter, Space, ArrowRight, a letter, Shift+Tab).");return{argv:e.filter((s,r)=>r!==n),key:a}}async function we(e,{workspace:t}){try{return await te(e,t)}catch(o){throw o instanceof d&&e.find(n=>!k(n))==="try"&&(o.synopsis=N),o}}async function te(e,t){let{argv:o,key:n}=ee(e),{positional:a,options:s,values:r}=O({options:["--script","--keep"],values:Z,argv:o}),[c,p,...h]=a,i=Object.keys(f).join(", ");if(!c)throw new d(`Say what to do: ${i}.`);if(!Object.hasOwn(f,c))throw new d(`No such component command: ${c} (${i}).`);let l=f[c];if(s.has("--script")&&l!==f.new)throw new d(`--script goes with new, not ${c}.`);let m=[...r.keys(),...s.has("--keep")?["--keep"]:[]];if(l===f.try)return l(t,{named:a.slice(1),values:r,key:n,keep:s.has("--keep")});if(m.length)throw new d(`${m[0]} goes with try, not ${c}.`);if(l===f.list){if(p!==void 0)throw new d(`gallery component ${c} takes nothing else.`);return l(t)}if(p===void 0||h.length>0)throw new d(`gallery component ${c} takes one id.`);return l(t,B(p),s.has("--script"))}export{B as a,V as b,H as c,Y as d,ee as e,we as f};
|
package/dist/chunk-3LA3EMDE.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 Ee}from"./chunk-TX6JH7TR.mjs";import{a as Se,b as Ne,c as Oe,d as Ae,e as Le,f as Me}from"./chunk-LC7YNQFG.mjs";import{c as Te}from"./chunk-ITNLYXXV.mjs";import{o as ve}from"./chunk-QMQUXTU4.mjs";import{a as de}from"./chunk-HYMEEXKN.mjs";import{b as je}from"./chunk-5FRMCDPY.mjs";import{l as xe}from"./chunk-W63L7367.mjs";import A from"node:fs/promises";import De from"node:os";import E from"node:path";import{pathToFileURL as Ie}from"node:url";import{instancesOf as Fe}from"../browser/shared/components/index.mjs";import{FALLBACK as Ke,INSTANCE as pe}from"../browser/shared/components/installed.mjs";import{layoutOf as Ye,PACKAGE_MANIFEST as ze}from"../browser/shared/workspace.mjs";var Xe="in a browser, under the export's policy",X="component-check",Q=[360,736,1024],he=["light","dark"],Qe=[1024,360],Pe=1e4,Ze=6e4,we=3e4,_e=2e3,et=3e3,tt=60,nt=2,at=8,ot=we/2,st=/^(?:wasm-)?eval$/,it=new Set(["TargetCloseError","ConnectionClosedError"]),ue=e=>String(e?.message??e).split(`
|
|
3
|
-
`)[0],rt=(e,n)=>`<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${e}</title></head><body><main class="doc-page" data-doc-id="${e}">${n}
|
|
4
|
-
</main></body></html>
|
|
5
|
-
`,lt=({example:e,template:n})=>`<p>example.html</p>${e}
|
|
6
|
-
<hr><p>template.html</p>${n}`,He=(e,n)=>Fe(de(e),n).map(({sourceCodeLocation:{startLine:s,startOffset:i,endOffset:t}})=>({line:s,markup:e.slice(i,t)}));async function ct(e,n){let s=E.join(n,"components",...e.id.split("/"));for(let i of[ze,"template.html",...e.files]){let t=xe(e,i);if(!t)continue;let o=await A.readFile(t);await A.mkdir(E.dirname(E.join(s,i)),{recursive:!0}),await A.writeFile(E.join(s,i),i==="kit.js"?`${o}
|
|
7
|
-
//# sourceURL=kit.js
|
|
8
|
-
`:o)}}async function dt(e,{example:n,template:s},i){await ct(e,i);let t=E.join(i,X);await A.mkdir(t);let o=`${n}
|
|
9
|
-
`,p=je(rt(X,lt({example:n,template:s}))).text;await A.writeFile(E.join(t,"doc.html"),p),await A.writeFile(E.join(t,"doc.json"),JSON.stringify({title:X,description:X,type:"component"}));let u=await(await ve({directory:i}))(X),l=E.join(i,"export.html");await A.writeFile(l,u);let f=o.split(`
|
|
10
|
-
`).length-1,g=He(p,e).map(({line:c})=>c>f?{file:"template.html",line:c-f}:{file:"example.html",line:c});return{html:u,file:l,places:g,source:p}}async function ht({match:e,instance:n,fallback:s,parts:i,at:t,source:o,still:p,step:h,times:u,typed:l,typing:f}){let g=()=>[...document.querySelectorAll(e)].filter(a=>!a.parentElement.closest(n)),c=a=>new Promise(r=>setTimeout(r,a)),d=()=>new Promise(a=>{requestAnimationFrame(a),setTimeout(a,100)}),b=async a=>{await d(),await d();let r=a.outerHTML;for(let k=0,T=Date.now()+p;k<3;){if(Date.now()>T)return null;await c(h);let v=a.outerHTML;k=v===r?k+1:0,r=v}return r},w=a=>{let r=document.createElement("template");return r.innerHTML=a,r.content.firstElementChild},y=a=>`<${a.localName}${a.classList.length?` class="${a.getAttribute("class")}"`:""}>`,m=a=>a.nodeType===1?y(a):`the words "${a.data.trim().slice(0,40)}"`,$=a=>[...a.childNodes].filter(r=>r.nodeType===1||r.nodeType===3&&r.data.trim()),L=(a,r)=>["style","class"].includes(r)&&!a.getAttribute(r)?.trim()?null:a.getAttribute(r),P=(a,r)=>{for(let v of new Set([...a.getAttributeNames(),...r.getAttributeNames()]))if(L(a,v)!==L(r,v))return`${v} on ${y(r)}, ${JSON.stringify(L(a,v))} then ${JSON.stringify(L(r,v))}`;let[k,T]=[$(a),$(r)];for(let v=0;v<Math.max(k.length,T.length);v++){let[S,I]=[k[v],T[v]];if(!S||!I)return`${y(r)} ${S?`without ${m(S)}`:`with ${m(I)} more`}`;if(S.nodeType!==I.nodeType||S.localName!==I.localName||S.nodeType===3&&S.data.trim()!==I.data.trim())return`in ${y(r)}, ${m(S)} then ${m(I)}`;let _=S.nodeType===1?P(S,I):null;if(_)return _}return null},R=a=>{let r=new Map;for(let k of a)r.set(y(k),(r.get(y(k))??0)+1);return r},fe=()=>[...document.querySelectorAll("*")].filter(a=>!a.closest(n)),me=a=>[...a.at(-1).keys()].filter(r=>a.length>2&&a.every((k,T)=>T===0||(k.get(r)??0)>(a[T-1].get(r)??0))),ne=(a,r=()=>!0)=>Object.entries(i).filter(([,{edit:k}])=>r(k)).flatMap(([k,T])=>[...a.querySelectorAll(T.at)].map(v=>({name:k,node:v}))),Y=a=>ne(a,r=>r==="text"),U=a=>Object.entries(i).filter(([,{edit:r}])=>r==="data").map(([r,k])=>({name:r,node:a.querySelector(k.at)})).filter(({node:r})=>r),C=[],V=g()[t];if(!V)return[{kind:"gone"}];if(V.hasAttribute(s))return[{kind:"fallback"}];let ae=await b(V);if(ae===null)return[{kind:"moving"}];let Z=w(o),oe=Y(Z);Y(V).forEach(({name:a,node:r},k)=>{oe[k]&&oe[k].node.innerHTML!==r.innerHTML&&C.push({kind:"redrawn",part:a,how:`the file says ${JSON.stringify(oe[k].node.textContent.trim())}, the page ${JSON.stringify(r.textContent.trim())}`})});let ee=DocKit.dehydrate(V.cloneNode(!0)),se=P(Z,ee);if(se){let a=ne(ee),r=ne(Z).find(({node:k},T)=>a[T]&&P(k,a[T].node))?.name;C.push({kind:"left",what:se,...r?{part:r}:{}})}let qe=U(ee);for(let[a,{name:r,node:k}]of U(Z).entries())!se&&qe[a]?.node.innerHTML!==k.innerHTML&&C.push({kind:"data",part:r});let J=[],ie=new MutationObserver(a=>J.push(...a));ie.observe(document.documentElement,{subtree:!0,childList:!0,characterData:!0});let ge=new Set,ke=a=>{J.push(...ie.takeRecords());for(let{name:r,node:k}of a)(!k.isConnected||J.some(({target:T})=>k.contains(T)))&&ge.add(r);J.length=0},re=[ae],le=[R(fe())],ye=a=>{re.push(a),le.push(R(fe()))},x=ee,ce=Y(x);J.length=0,V.replaceWith(x);let H=await b(x);if(ke(ce),H!==null){ye(H);for(let a=0;a<u&&H!==null;a++){let r=x.cloneNode(!0);ce=Y(r),J.length=0,x.replaceWith(r),x=r,H=await b(x),ke(ce),H!==null&&ye(H)}}ie.disconnect(),H===null&&C.push({kind:"moving"});for(let a of ge)C.push({kind:"redrawn",part:a,how:"a mount changes it"});let be=re.map(a=>R(w(a).querySelectorAll("*"))),$e=me(be);for(let a of $e)C.push({kind:"piles",what:a,counts:be.map(r=>r.get(a)??0)});for(let a of me(le))C.push({kind:"piles",what:a,outside:!0,counts:le.map(r=>r.get(a)??0)});if(!$e.length){let a=re.slice(1).map(r=>P(w(ae),w(r))).find(Boolean);a&&C.push({kind:"changed",what:a})}let te=H===null?[]:Y(x).filter(({node:a})=>a.textContent.trim()),Ge=[...new Set([...new Map(te.map(a=>[a.name,a])).values(),...te])].slice(0,l),Ue=Date.now()+f;for(let{node:a}of Ge){if(Date.now()>Ue)break;let r=document.createTreeWalker(a,NodeFilter.SHOW_TEXT).nextNode(),k=r.data;r.data=`${k}\u2026`;let T=te.map(({node:S})=>S.textContent);await b(x);let v=te.find(({node:S},I)=>!S.isConnected||S.textContent!==T[I]);if(v){C.push({kind:"redrawn",part:v.name,how:"a change of its words does not stand"});break}r.data=k,await b(x)}return H!==null&&U(x).length>0&&C.push(...await Ve()),C;async function Ve(){let a=[],r=null,k=!1,T="as it hears that it can write (the editable signal)",v=[],S=_=>{if(_.target!==x)return;let{parts:F,run:z}=_.detail,M=F.map(({part:j})=>j.innerHTML),K=F.map(({part:j})=>j.cloneNode(!0)),q=z(Object.fromEntries(F.map(({name:j},O)=>[j,K[O]]))),W=F.find(({part:j},O)=>j.innerHTML!==M[O]),B=F.find(({part:j},O)=>K[O].cloneNode(!1).outerHTML!==j.cloneNode(!1).outerHTML);if(W&&F.forEach(({part:j},O)=>{j.innerHTML=M[O]}),!k){let j=W??B??F.find((O,D)=>K[D].innerHTML!==M[D]);j&&!v.some(O=>O.when===T)?v.push({kind:"unasked",part:j.name,when:T}):q&&!j&&_.preventDefault();return}W?r??=`it writes the part ${W.name} on the page, not the draft context.edit hands it, so the editor refuses the edit`:q&&B&&(r??=`it changes the part ${B.name}'s own tag or attributes, which are the file's: a change writes what a part holds, so the editor refuses the edit`),!(W||!q||B)&&(F.forEach(({part:j},O)=>{a.push({part:j,before:M[O]}),j.replaceChildren(...K[O].childNodes)}),_.preventDefault())};document.addEventListener("doc-component-edit",S);try{return[...await I(),...v]}finally{document.removeEventListener("doc-component-edit",S)}async function I(){dispatchEvent(new Event("doc-editable")),await b(x),T="as it mounts";let _=x.cloneNode(!0);x.replaceWith(_),x=_;let F=await b(x);T="as it hears its part changed (the source signal)";let z=DocKit.dehydrate(x.cloneNode(!0)),M=[];k=!0;try{if(!DocKit.example(x))return[{kind:"no-example"}]}catch(D){return[{kind:"example",what:`it throws: ${D?.message??D}`}]}finally{k=!1}let K=await b(x),q=DocKit.dehydrate(x.cloneNode(!0)),W=Object.fromEntries(U(q).map(({name:D,node:G},Je)=>[D,G.innerHTML,U(z)[Je]?.node.innerHTML]).filter(([,D,G])=>D!==G));r?M.push({kind:"example",what:r}):a.length===0?M.push({kind:"example",what:"context.edit was not taken: it was not called, or it answered false, and the console says why"}):Object.keys(W).length===0?M.push({kind:"example",what:"it changes nothing a part holds"}):M.push({kind:"wrote",parts:W});for(let D of[z,q])for(let{node:G}of U(D))G.textContent="";let B=P(z,q);B&&M.push({kind:"example",what:`it changes what is no data part: ${B}`});for(let{part:D,before:G}of a.reverse())D.innerHTML=G;let j=await b(x),O=F!==null&&j!==null?P(w(F),w(j)):null;return K===null||j===null?M.push({kind:"moving"}):O&&!B&&M.push({kind:"undo",what:O}),M}}}var pt=e=>e.map(({name:n,removed:s,added:i,lines:t})=>`${n} (-${s} +${i} of its ${t} line${t===1?"":"s"})`).join(" and "),ut="a write changes the lines it means and no others, a row moved with the blank before it, JSON written back by jsonIn and laid out in template.html and example.html as jsonIn writes it (building-components.md, Two examples)";function wt({kind:e,what:n,part:s,how:i,when:t,counts:o,outside:p,parts:h,back:u,line:l},f,{script:g}){let c=b=>({...f,what:b}),d=b=>({...f,what:b,note:!0});switch(e){case"wrote":return{...f,told:!0,what:`its example wrote ${pt(h)}; the server took it${u?"; put back as an undo does, it shows what it showed":""}`};case"laid":return d(`its example's write lays the part ${s} out anew (${i}): ${ut}`);case"drops":return{...d(`${n} listens for dragover and not for dragenter: a drop goes where both are cancelled, and the move that enters it asks dragenter alone, so that a release then (on a card's words, its padding) drops nothing: cancel dragenter as dragover is cancelled (preventDefault)`),file:"kit.js",line:l};case"gone":return c("the page does not hold this instance");case"fallback":return c(g?"its component failed or never started: the instance shows what it holds, read-only":"the instance shows as one of no package");case"moving":return d("what it shows never holds still (an animation?), so its mounts could not be compared");case"redrawn":return c(`the component redraws its text part ${s}: ${i}. A text part is the file's, what the user types in: read it, and draw in what is the component's`);case"left":return c(`dehydrate does not leave it as the file has it, so a copy of the view would hold what the kit made of it: ${n}. ${s?`That stands in its part ${s}, which is the file's: read a part, and draw in what is the component's`:"Name what it draws in the manifest's runtime, or take it off in dehydrate"}`);case"data":return c(`a mount changes its data part ${s}, so that a page would write what the component left there, with nothing edited: read a data part, and change it by context.edit alone`);case"no-example":return d("it has a data part and its component offers no example of an edit, so nothing has tried the way back to the file: give DocKit.component an example(host, context) that makes a small context.edit");case"example":return c(`its example: ${n}`);case"refused":return c("what its example wrote cannot go in the file: a script, a handler, an address of code, data-block-id or data-ge-*, what does not read back as itself, or what is no JSON in a script of data");case"undo":return c(`with what its example wrote put back, as an undo does, it does not show what it showed: ${n}: draw from the part, and on the source signal`);case"unasked":return c(`it writes its data part ${s} with no reader's gesture, ${t}, once the page takes edits: a page would write it each time it opened. Call context.edit on a gesture alone, a press, a drop or a key, and draw what the part holds as it is`);case"piles":return c(p?`${n} piles up outside the instance on each put-back (${o.join(", then ")} of them), so an undo adds another: a component draws in its instance, and what it has to put elsewhere it takes away again in destroy`:`${n} piles up on each put-back (${o.join(", then ")} of them): it is declared in neither the manifest's runtime nor dehydrate, so an undo adds another`);default:return c(`a mount does not give the same DOM again: ${n}`)}}var ft=e=>[...new Map(e.toReversed().map(n=>[`${n.finding.kind}|${n.finding.part??""}|${["piles","example"].includes(n.finding.kind)?n.finding.what:""}|${n.finding.when??""}|${n.finding.line??""}`,n])).values()].toReversed(),mt=4e6;function We(e,n,s=(i,t)=>i===t){let[i,t]=[e.split(`
|
|
11
|
-
`),n.split(`
|
|
12
|
-
`)],o=0;for(;o<i.length&&o<t.length&&s(i[o],t[o]);)o++;let p=0;for(;p<i.length-o&&p<t.length-o&&s(i[i.length-1-p],t[t.length-1-p]);)p++;let[h,u]=[i.slice(o,i.length-p),t.slice(o,t.length-p)];if(h.length===0&&u.length===0)return[];if(h.length*u.length>mt)return[{removed:h,added:u}];let l=Array.from({length:h.length+1},()=>new Uint32Array(u.length+1));for(let c=h.length-1;c>=0;c--)for(let d=u.length-1;d>=0;d--)l[c][d]=s(h[c],u[d])?l[c+1][d+1]+1:Math.max(l[c+1][d],l[c][d+1]);let f=[],g=null;for(let c=0,d=0;c<h.length||d<u.length;)c<h.length&&d<u.length&&s(h[c],u[d])?(g=null,c++,d++):(g||f.push(g={removed:[],added:[]}),d<u.length&&(c===h.length||l[c][d+1]>=l[c+1][d])?g.added.push(u[d++]):g.removed.push(h[c++]));return f}function gt(e,n){let s=t=>t.filter(o=>o.trim()).length,i=We(e,n);return{removed:i.reduce((t,o)=>t+s(o.removed),0),added:i.reduce((t,o)=>t+s(o.added),0),lines:s(e.split(`
|
|
13
|
-
`))}}function Re(e,n){let s=0,i=0;for(let[t,o]of e.entries())if(t>0&&s>0&&s<n&&i++,s+=o.replace(/\s+/g,"").length,s>=n)break;return i}function kt(e,n){let s=i=>i.filter(t=>!t.trim()).length;for(let{removed:i,added:t}of We(e,n,(o,p)=>o.trim()===p.trim())){if(s(t)>s(i))return"a line left blank";let[o,p]=[i.join("").replace(/\s+/g,""),t.join("").replace(/\s+/g,"")],h=0;for(;h<o.length&&h<p.length&&o[h]===p[h];)h++;let u=0;for(;u<o.length-h&&u<p.length-h&&o[o.length-1-u]===p[p.length-1-u];)u++;for(let[l,f,g]of[[h,i,t],[u,i.toReversed(),t.toReversed()]]){let[c,d]=[Re(f,l)+1,Re(g,l)+1];if(c!==d)return`${c} line${c===1?"":"s"} became ${d}`}}return null}function yt(e,{source:n,found:s,at:i,findings:t}){let o=Te(n,Fe(de(n),s)[i],e.parts,new Map([[s.id,s]]));if(!o)return[{kind:"refused"}];let p=Object.keys(e.parts),h=o.map(({start:l,end:f,text:g},c)=>({name:p[c],before:n.slice(l,f),after:g}));return[{kind:"wrote",back:!t.some(({kind:l})=>l==="undo"||l==="moving"),parts:h.map(({name:l,before:f,after:g})=>({name:l,...gt(f,g)}))},...h.flatMap(({name:l,before:f,after:g})=>{let c=kt(f,g);return c?[{kind:"laid",part:l,how:c}]:[]})]}var bt=2e3;function $t({match:e,instance:n,at:s,most:i}){let t=[...document.querySelectorAll(e)].filter(o=>!o.parentElement.closest(n))[s];return t?[window,document,t,...t.querySelectorAll("*")].slice(0,i):[]}function xt(e){return e.map((n,s)=>s<2?{parent:s-1,named:""}:{parent:s===2?1:e.indexOf(n.parentElement),named:`<${n.localName}${n.classList.length?` class="${n.getAttribute("class")}"`:""}>`})}function vt(){let e=new DragEvent("dragenter",{bubbles:!0,cancelable:!0,composed:!0,dataTransfer:new DataTransfer});return this.dispatchEvent(e),e.defaultPrevented}async function jt(e,{match:n,at:s}){let i=new Map,t=({scriptId:o,url:p})=>i.set(o,p);e.on("Debugger.scriptParsed",t);try{await e.send("Debugger.enable"),await e.send("Debugger.setSkipAllPauses",{skip:!0});let{result:o}=await e.send("Runtime.evaluate",{expression:`(${$t})(${JSON.stringify({match:n,instance:pe,at:s,most:bt})})`,objectGroup:"drops"}),{result:p}=await e.send("Runtime.callFunctionOn",{objectId:o.objectId,functionDeclaration:String(xt),arguments:[{objectId:o.objectId}],returnByValue:!0}),{result:h}=await e.send("Runtime.getProperties",{objectId:o.objectId,ownProperties:!0}),u=h.filter(({name:c,value:d})=>/^\d+$/.test(c)&&d?.objectId).sort((c,d)=>Number(c.name)-Number(d.name)),l=[];for(let{value:c}of u)l.push((await e.send("DOMDebugger.getEventListeners",{objectId:c.objectId})).listeners);let f=(c,d)=>l[c]?.some(b=>b.type===d),g=[];for(let c=2;c<l.length;c++){let d=l[c].find(w=>w.type==="dragover"&&i.get(w.scriptId)==="kit.js");if(!d)continue;let b=!1;for(let w=c;w>=2&&!b;w=p.value[w].parent)b=f(w,"dragenter");if(!b&&(f(0,"dragenter")||f(1,"dragenter"))){let{result:w}=await e.send("Runtime.callFunctionOn",{objectId:u[c].value.objectId,functionDeclaration:String(vt),returnByValue:!0});b=w.value===!0}b||g.push({kind:"drops",what:p.value[c].named,line:d.lineNumber+1})}return g}finally{e.off("Debugger.scriptParsed",t),await e.send("Runtime.releaseObjectGroup",{objectGroup:"drops"}).catch(()=>{}),await e.send("Debugger.disable").catch(()=>{})}}function Tt(e,n){let s={errors:new Map,notes:new Set,failed:new Set,dialogs:new Set,windows:0,opened:[],asked:1,pending:[]},i=t=>{let[o]=t.split(`
|
|
14
|
-
`);s.errors.has(o)||s.errors.set(o,Number(/\bkit\.js:(\d+)/.exec(t)?.[1])||null)};return e.on("pageerror",t=>i(t.stack??t.message)),e.on("console",t=>{let o=t.type();!["error","warn","warning"].includes(o)||!Oe(t,n,["kit.js"])||s.pending.push(Promise.all(t.args().map(p=>p.evaluate(h=>h instanceof Error?h.stack:String(h)).catch(()=>""))).then(p=>{let h=p.join(" ")||t.text();o==="error"?i(h):s.notes.add(h.split(`
|
|
15
|
-
`)[0])}))}),e.on("requestfailed",t=>{t.frame()===e.mainFrame()&&!t.isNavigationRequest()&&s.failed.add(t.url())}),e.on("request",t=>{t.isNavigationRequest()&&t.frame()===e.mainFrame()&&s.opened.push(t.url())}),s}async function Et(e,n){let s=await e.createCDPSession();return await s.send("Page.enable"),s.on("Page.javascriptDialogOpening",({type:i})=>{n.add(i),s.send("Page.handleJavaScriptDialog",{accept:!1}).catch(()=>{})}),s}function N(e,n,s=we){let i=0,t=()=>Object.assign(new Error(n),{stuck:!0,doing:n}),o=new Promise((h,u)=>{i=setTimeout(()=>u(t()),s)}),p=e.catch(h=>{throw it.has(h.name)?t():Object.assign(h,{doing:n})});return Promise.race([p,o]).finally(()=>clearTimeout(i))}var Be=e=>new Promise(n=>{if(!e.connected)return n(!0);e.once("disconnected",()=>n(!0)),setTimeout(()=>n(!1),_e)});function St({match:e,instance:n}){let{clientWidth:s,scrollWidth:i}=document.documentElement;if(i<=s+1)return null;let t=[...document.querySelectorAll(e)].filter(o=>!o.parentElement.closest(n));return{wide:i,at:t.findIndex(o=>[o,...o.querySelectorAll("*")].some(p=>p.getBoundingClientRect().right>s+1))}}var Ce=16,Nt="#8f8f8f";async function Ot(e,n,s){let i=await Promise.all(n.map(async t=>`data:image/png;base64,${(await A.readFile(t)).toString("base64")}`));await e.setViewport({width:Q.reduce((t,o)=>t+o,0)+Ce*(Q.length-1),height:900}),await e.setContent(`<!doctype html><body style="margin: 0; display: flex; align-items: flex-start; gap: ${Ce}px; background: ${Nt}">${i.map((t,o)=>`<img src="${t}" width="${Q[o]}" alt="" style="display: block">`).join("")}</body>`,{waitUntil:"load"}),await e.screenshot({path:s,fullPage:!0})}async function At(e,{file:n,html:s,source:i,places:t,found:o,out:p,loading:h}){let u=await e.createBrowserContext(),l=await u.newPage(),f=Ie(n).href,g=Tt(l,f),c=await Et(l,g.dialogs);u.on("targetcreated",w=>{w.type()==="page"&&(g.windows+=1,w.page().then(y=>y?.close()).then(()=>l.bringToFront()).catch(()=>{}))});let d={heard:g,blocked:[],late:[],taken:[],overviews:[],edited:[],asExport:[],answers:[],wide:[],stuck:null,stopped:null,gone:null},b=async w=>d.late.push(...await N(Me(l,{timeout:Pe}),w,3*Pe+we));await Ae(l),await l.setViewport({width:736,height:900}),await l.emulateMediaFeatures([{name:"prefers-color-scheme",value:"light"}]);try{await N(l.goto(f,{waitUntil:"load",timeout:0}),"the page opened",h),await b("the page opened");for(let m of he){await N(l.emulateMediaFeatures([{name:"prefers-color-scheme",value:m}]),`the ${m} theme came`);for(let $ of Q){if(await N(l.setViewport({width:$,height:900}),`the window went to ${$}px`),await b(`it was drawn at ${$}px`),m===he[0]){let P=await N(l.evaluate(St,{match:o.match,instance:pe}),`it was measured at ${$}px`);P&&d.wide.push({width:$,...P})}let L=E.join(p,`${$}-${m}.png`);await N(l.screenshot({path:L,fullPage:!0}),`it was pictured at ${$}px`),d.taken.push(L)}}await N(l.emulateMediaFeatures([{name:"prefers-color-scheme",value:"light"}]),"the light theme came"),await N(l.setViewport({width:736,height:900}),"the window went to 736px");let w=He(s,o),y=o.files.includes("kit.js")&&Object.values(o.parts).some(({edit:m})=>m==="data");for(let m=0;m<w.length;m++){let $=await N(l.evaluate(ht,{match:o.match,instance:pe,fallback:Ke,parts:o.parts,at:m,source:w[m].markup,still:et,step:tt,times:nt,typed:at,typing:ot}),"an instance was put back"),L=$.find(({kind:R})=>R==="wrote"),P=[...$.filter(R=>R!==L),...L?yt(L,{source:i,found:o,at:m,findings:$}):[]];y&&!$.some(({kind:R})=>R==="gone"||R==="fallback")&&P.push(...await N(jt(c,{match:o.match,at:m}),"the page was asked what an instance listens to")),d.answers.push(...P.map(R=>({finding:R,place:t[m]})))}d.blocked=await N(l.evaluate(()=>globalThis.__qaViolations),"the page was asked what it blocked"),g.asked+=1,await N(l.goto(f,{waitUntil:"load",timeout:0}),"the page opened again",h),await b("the page opened again"),await N(l.evaluate(()=>dispatchEvent(new Event("doc-editable"))),"the page was told it takes edits"),await b("it was drawn as the editing page draws it");for(let m of Qe){await N(l.setViewport({width:m,height:900}),`the window went to ${m}px`),await b(`it was drawn at ${m}px as the editing page draws it`);let $=E.join(p,`edit-${m}-light.png`);await N(l.screenshot({path:$,fullPage:!0}),`it was pictured at ${m}px as the editing page draws it`),d.edited.push($),(await A.readFile($)).equals(await A.readFile(E.join(p,`${m}-light.png`)))&&d.asExport.push($)}d.blocked.push(...await N(l.evaluate(()=>globalThis.__qaViolations),"the page was asked what it blocked"));for(let m of he){let $=E.join(p,`overview-${m}.png`);await N(Ot(l,Q.map(L=>E.join(p,`${L}-${m}.png`)),$),`the ${m} pictures were put side by side`),d.overviews.push($)}}catch(w){if(w.syscall)throw w;await Be(e)?d.gone=w.doing??"the page answered":w.stuck?d.stuck=w.doing:d.stopped=ue(w)}return await Promise.race([Promise.all(g.pending),new Promise(w=>setTimeout(w,_e).unref())]),d}var Lt=(e,n)=>e.startsWith(n)?e.slice(n.length):e;function Mt(e,n,s){let i=new Map;for(let{url:t,directive:o,source:p,line:h}of e){if(st.test(t)){let l=!p&&h>0;i.set(`${t}|${p}|${h}`,{file:l?"kit.js":"the page",...l?{line:h}:{},what:"the export's policy blocks code made from words (eval, new Function, a string given to setTimeout): an export runs none"});continue}let u=/^[a-z][a-z0-9+.-]*$/.test(t)?n.filter(l=>l.startsWith(`${t}:`)):[];for(let l of u.length?u:[t])i.set(`${l}|${o}`,{file:"the page",what:`the export's policy blocks ${Lt(l,s)||"something"} (${o}): ${o==="img-src"?"a picture of an instance is a data: address, or a file its style names":"an export holds all it needs"}`})}return[...i.values()]}function Dt({heard:e,blocked:n,late:s,answers:i,wide:t,stuck:o,stopped:p},{places:h,script:u,folder:l}){let f=ft(i).map(({finding:y,place:m})=>wt(y,m,{script:u})),g=[...e.failed],c=g.filter(y=>!n.some(m=>m.url&&y.startsWith(m.url))),d=e.opened.length>e.asked?"it loads itself again (location.reload(), a new location.href), so a reader's page would not stay":o?`it stopped answering while waiting until ${o}${u?": a script that never ends, or a component that changes what it hears (a text part, on its source signal)":""}`:p&&`the look at it stopped: ${p}`,b=t.map(({width:y,wide:m})=>`${m}px wide in a ${y}px window`).join(", "),w=h[t.find(({at:y})=>y>=0)?.at]??{file:"the page"};return{problems:[...[...e.errors].map(([y,m])=>({file:m?"kit.js":"the page",line:m,what:`the console says ${y}`})),...Mt(n,g,l),...c.map(y=>({file:"the page",what:`it could not load ${y.slice(0,120)}`})),...[...e.dialogs].map(y=>({file:"the page",what:`it opens a dialog (${y}), which stops a reader's page until it is answered: show what it says in the instance`})),...e.windows?[{file:"the page",what:"it opens a window, which takes a reader away from the page: show it in the instance, or link to it"}]:[],...d?[{file:"the page",what:d}]:[],...t.length?[{...w,what:`the page is ${b}: a reader scrolls the whole page sideways, and gallery qa fails it: let it fit the window (max-width: 100%), or put what is wider in a frame of its own that scrolls`}]:[],...f.filter(({note:y,told:m})=>!y&&!m)],notes:[...[...e.notes].map(y=>({file:"the page",what:`the console says ${y}`})),...f.filter(({note:y})=>y),...s.map(y=>({file:"the page",what:`waited for ${y}`}))],told:f.filter(({told:y})=>y)}}async function Jt(e,n,{example:s,template:i},{find:t=Se,start:o=Le,loading:p=Ze}={}){let h=Xe,u=null,l=null;try{u=await A.mkdtemp(E.join(De.tmpdir(),"gallery-component-check-"));let f=await dt(n,{example:s,template:i},u),g=t();if(!g)return{title:h,unverified:"no Chrome, Edge or Chromium found (GALLERY_BROWSER=<its executable> picks one)"};try{l=await o({executablePath:g,args:Ne()})}catch(w){return{title:h,unverified:`the browser ${g} did not start, twice, each time with a fresh profile (${ue(w)}; GALLERY_BROWSER=<its executable> picks another)`}}let c=E.join(Ye(e).qa,"components",...n.id.split("/"));await A.rm(c,{recursive:!0,force:!0}),await A.mkdir(c,{recursive:!0});let d=await At(l.browser,{...f,found:n,out:c,loading:p}),b=Dt(d,{places:f.places,script:n.files.includes("kit.js"),folder:Ie(`${u}${E.sep}`).href});return d.gone?{title:h,...b,unverified:`the browser went while waiting until ${d.gone}, so it says nothing of the package`}:{title:h,...b,...d.taken.length?{pictures:{folder:c,overviews:d.overviews.map(w=>E.basename(w)),each:d.taken.map(w=>E.basename(w)),edited:d.edited.map(w=>E.basename(w)),asExport:d.asExport.map(w=>E.basename(w))}}:{}}}catch(f){return f.reason==="check"?{title:h,problems:f.failures.map(g=>({file:"the export",what:g}))}:f.syscall?{title:h,unverified:`cannot write ${Ee(f.syscall==="mkdtemp"?De.tmpdir():f.path)} (${f.code})`}:l&&await Be(l.browser)?{title:h,unverified:"the browser went before the page opened"}:{title:h,problems:[{file:"the page",what:`the look at it stopped: ${ue(f)}`}]}}finally{await l?.close(),u&&await A.rm(u,{recursive:!0,force:!0,maxRetries:5,retryDelay:200}).catch(()=>{})}}export{Xe as a,Ze as b,et as c,tt as d,ue as e,rt as f,pt as g,ut as h,gt as i,kt as j,Et as k,N as l,Be as m,Jt as n};
|
package/dist/chunk-5FRMCDPY.mjs
DELETED
|
@@ -1,16 +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 Ge}from"./chunk-E7VYDG2X.mjs";import{A as Ut,C as Ue,F as zt,H as ze,K as qe,L as Je,M as Ve,N as qt,c as at,d as Ke,l as Pt,m as We,t as He,u as gt,w as Pe}from"./chunk-NFIBI4IP.mjs";import{b as ht,e as Ys}from"./chunk-A55HN5OK.mjs";Ys();import tn from"node:path";import{attr as w,curlyQuoted as en}from"../browser/shared/html-tree.mjs";import{FOLDED_LINES as Xe,LINE_START as Ze,NOWRAP as Jt,lineStart as sn,validFolded as nn}from"../browser/shared/code-lines.mjs";import{COLORS as on}from"../browser/shared/colors.mjs";import{FLOWS as an,isInstance as it,matchesNode as $t}from"../browser/shared/components/index.mjs";import{HEADED as ft}from"../browser/shared/components/dialog.mjs";import{pageLanguage as cn}from"../browser/shared/components/page.mjs";import{SHEETS_LABEL as Qe,shortSheets as rn}from"../browser/shared/components/sheets.mjs";import{iconValueOf as ln}from"../browser/shared/emoji/icon-value.mjs";import{escapeText as pt}from"../browser/shared/escape.mjs";import{COLUMN_GAP as fn,READING_WIDTH as St,SPAN as Ye,SPAN_SIZE as dt}from"../browser/shared/media.mjs";import{kitNamespace as ls}from"../browser/shared/old-names.mjs";import{CHART_DATA as fs,CHART_SOURCE as tt,nextChartKey as dn}from"../browser/shared/table-chart.mjs";import{BLOCK_COLORS as se}from"../browser/editor/components/colors.mjs";import{DETAILS as un,DIALOG as Xt,PAGE as mn,SECTION as hn,SHEETS as gn}from"../browser/editor/components/kit.mjs";import{DIALOG_TRIGGER as pn}from"../browser/editor/components/dialog/index.mjs";import{CHECKED as ne,FLOW as ut,TODO as Zt}from"../browser/editor/components/list/index.mjs";import{texSource as Nn}from"../browser/editor/components/math/index.mjs";import{BOX_CLASSES as On,HOSTS as $n,UNIT_KINDS as wn}from"../browser/editor/components/registry.mjs";import{HEADER_LOOK as ts}from"../browser/editor/components/table/index.mjs";import{backgroundColor as bn,parseColor as kn,textColor as Ln}from"../browser/editor/page/clipboard/import/colors.mjs";var oe=new Set(["script","style","template","textarea","noscript","code","svg","math","select","option","button","iframe","video","audio","canvas","object","picture"]),It=["doc-figure","doc-code","doc-diff","doc-math-inline","doc-math-block","doc-link-mention","doc-sheet-tabs","doc-state-fields","doc-filter-row","doc-image","doc-file","doc-bookmark","doc-embed","doc-icon","doc-title","doc-table-meta"],ae=new Set(["p","h1","h2","h3","h4","h5","h6","li","td","th","dt","dd","blockquote","figcaption","caption","summary"]),xt=new Set(["main","section","div","article","aside","blockquote","li","details","dialog"]),yn=new Set(on.map(({name:s})=>s)),C=s=>(w(s,"class")??"").split(/\s+/).filter(Boolean),es=s=>C(s).every(n=>se.includes(n)),vn=se.filter(s=>s.startsWith("doc-highlight-")),ct=s=>C(s).some(n=>!ls(n)),D=s=>s.nodeName==="#text",At=/^[\s\u200b-\u200d\u2060\ufeff]*$/,J=s=>D(s)&&At.test(s.value),L=s=>(s.childNodes??[]).filter(n=>n.tagName),Z=s=>(s.attrs??[]).map(n=>n.name),K=(s,n)=>Z(s).every(d=>n.includes(d)),Cn=[hn.match,un.match,Xt.match,gn.match,"table.doc-table"].join(", ");function ds(s){let n=C(s);return n.some(d=>It.includes(d))||Ke(s)||$t(s,Cn)||On.some(([d])=>n.includes(d))||wn.some(d=>d.class&&n.includes(d.class)&&(!d.tag||[d.tag].flat().includes(s.tagName)))}var Sn=s=>{for(let n=s.parentNode;n?.tagName&&n.tagName!=="main";n=n.parentNode)if(n.tagName==="figure")return!0;return!1},us=new Set(["thead","tbody","tfoot","tr","colgroup","col"]),ie=s=>ct(s)&&s.tagName!=="figure"&&!ae.has(s.tagName)&&!us.has(s.tagName)&&!ds(s),ms=new Set([...at].filter(s=>!["header","main","dialog","form","fieldset","caption","dd","dt","figcaption","summary","li","td","th",...us].includes(s))),xn=/\\\(([\s\S]*?)\\\)/g,Nt=s=>Nn(s)&&/\S/.test(s);function Tn(s,n=!0){let d=n?s:/^\s*(?:\\\[[\s\S]*?\\\]|\$\$[\s\S]*?\$\$)/.exec(s)?.[0]??"";return/[<>]/.test(d)&&Nt(d.replace(/</g,"\\lt ").replace(/>/g,"\\gt "))}var Qt=new Set(["br","wbr","img","input"]),hs=new Set([...at,"script","style","template","noscript","link","meta"]),gs=new Set(["input","select","textarea","button","label","option"]),En=new Set([...at,"hgroup","search","center","dir","listing","xmp","plaintext"]),Yt=s=>L(s).some(n=>En.has(n.tagName)||Yt(n)),ps=new Set(["main","section","div","article","aside","blockquote"]),In=an.join(", "),An=s=>ps.has(s.tagName)&&!ct(s)&&(C(s).length===0||$t(s,In)),et=s=>D(s)?!At.test(s.value):(s.childNodes??[]).some(et),Ns=s=>s.childNodes.some(n=>D(n)&&!At.test(n.value))&&L(s).some(n=>at.has(n.tagName)),_n=/^[ \t\n\r\f]*/;function Vt(s){let n=[],d=[];for(let u of s)u.tagName&&hs.has(u.tagName)?(n.push(d),d=[]):d.push(u);n.push(d);let p=u=>!u.tagName&&!et(u),N=u=>(D(u)||u.tagName&&!gs.has(u.tagName))&&et(u);return n.map(u=>{let O=u.findIndex(h=>!p(h));return O<0?[]:u.slice(O,u.findLastIndex(h=>!p(h))+1)}).filter(u=>u.some(N))}function jn(s){let n=[],d=p=>{for(let N of p.childNodes??[])N.tagName==="style"?n.push(N.childNodes.map(u=>u.value??"").join("")):N.tagName&&N.tagName!=="template"&&d(N)};return d(s),n.flatMap(p=>[...p.replace(/\/\*[\s\S]*?(?:\*\/|$)/g," ").matchAll(/([^{};]*)\{/g)].map(([,N])=>N))}var Bn=(s,{tags:n=[],classes:d=[]})=>{let p=[...n.map(u=>`(?<![\\w.#-])${u}`),...d.map(u=>`\\.${u}`)],N=p.length?new RegExp(`(?:${p.join("|")})(?![\\w-])`,"i"):null;return!!N&&s.some(u=>N.test(u))};function Mn(s){let n=[],d=p=>{for(let N of p.childNodes??[])N.tagName==="script"?n.push(N.childNodes.map(u=>u.value??"").join("")):N.tagName&&N.tagName!=="template"&&d(N)};return d(s),n.join(`
|
|
3
|
-
`)}var ce=["contains-task-list","task-list-item"],re=["task-list-item"],Os=["task-list-item-checkbox"],le=(s,n)=>C(s).every(d=>n.includes(d));function $s(s){let n=s.childNodes.find(d=>!J(d));return n?.tagName==="input"&&K(n,["type","checked","disabled","class"])&&w(n,"type")?.toLowerCase()==="checkbox"&&le(n,Os)&&n.sourceCodeLocation?.startTag?n:null}var ws=s=>s.tagName==="li"&&le(s,re)&&w(s,ne)===void 0&&s.sourceCodeLocation?.startTag&&$s(s),Rn=s=>s.tagName==="ul"&&le(s,ce)&&L(s).length>0&&s.childNodes.every(n=>n.tagName==="li"||J(n))&&L(s).every(ws),Dn={classes:[...new Set([...ce,...re,...Os])]},Fn=/checkbox|task-list/i,te=s=>s.tagName==="ol"&&(w(s,"data-doc-chart")==="flow"||w(s,"data-flow")!==void 0&&w(s,"data-doc-chart")===void 0),Gn=s=>s?.tagName==="ol"&&!ct(s)&&(C(s).includes(ut)||te(s)),Kn=s=>s.tagName==="li"&&Gn(s.parentNode),Et="doc-icon",Wn=s=>s.some(n=>n.tagName==="strong"||n.tagName==="b")&&s.every(n=>n.tagName==="strong"||n.tagName==="b"||D(n)&&At.test(n.value)||n.nodeName==="#comment"),Hn=/^(?:inherit|unset|currentcolor|none)$/i,Pn=/^(?:inherit|initial|unset|revert|revert-layer|transparent|none)$/i,z=s=>s.replace(/\s+/g," ").trim(),ss=/^\s*--doc-(?:table-height|span)\s*:/i;function ee(s){let n=s.replace(/\/\*[\s\S]*?(?:\*\/|$)/g," "),d=[],p="",N=0,u=0;for(let O=0;O<=n.length;O++){let h=n[O];p?h==="\\"?O++:h===p&&(p=""):h==='"'||h==="'"?p=h:h==="("?N++:h===")"?N=Math.max(0,N-1):(h===";"&&N===0||O===n.length)&&(d.push(n.slice(u,O)),u=O+1)}return d.filter(O=>O.trim())}function bs(s){let n=new Map;for(let l of ee(s)){let $=l.indexOf(":"),i=z($<0?l:l.slice(0,$)).toLowerCase();n.set(i==="background-color"?"background":i,$<0?"":z(l.slice($+1).replace(/!\s*important\s*$/i,"")))}let d=[],p=[],N,u,O=new Set,h=(l,$,i)=>{if((l==="color"?Hn:Pn).test($))return;let f=kn($);if(!f||f.a===0&&l==="color"){d.push(l);return}if(f.a===0)return;let g=i($,{nearest:!0})?.replace(/_background$/,"");if(!g||!yn.has(g)){p.push(`${l} ${$} left out: the ${l==="color"?"text's":"page's"} own is the nearest`);return}return i($)?.replace(/_background$/,"")!==g&&p.push(`${l} ${$} written as the kit's ${g}${l==="color"?"":" highlight"}`),g};for(let[l,$]of n)l==="color"?N=h(l,$,Ln):l==="background"?u=h(l,$,bn):l==="font-weight"&&/^(?:bold|bolder|[6-9]\d\d)$/i.test($)?O.add("strong"):l==="font-style"&&/^(?:italic|oblique)\b/i.test($)?O.add("em"):(l==="text-decoration"||l==="text-decoration-line")&&/^(?:(?:underline|line-through|solid)\s*)+$/i.test($)&&/underline|line-through/i.test($)?(/underline/i.test($)&&O.add("u"),/line-through/i.test($)&&O.add("s")):d.push(l);if(d.length)return{foreign:[...new Set(d)]};let y=[];N&&y.push([`<span class="doc-text-${N}">`,"</span>"]),u&&y.push([`<span class="doc-highlight-${u}">`,"</span>"]);for(let l of["strong","em","u","s"])O.has(l)&&y.push([`<${l}>`,`</${l}>`]);return{open:y.map(([l])=>l).join(""),close:y.map(([,l])=>l).reverse().join(""),notes:p}}var ns=/^(?:language|lang)-([\w#+.-]+)$/,Un=new Set(["data-language","data-lang","data-block-id"]),zn=[{name:Ze,names:[Ze,"data-start"],value:s=>sn(s)?.toString()??null,says:"the number of its first line is a whole number from 1"},{name:"data-line-numbers",names:["data-line-numbers"],value:s=>/^\s*(?:true|false)\s*$/i.test(s)?s.trim().toLowerCase():null,says:"false hides its line numbers, true shows them"},{name:Xe,names:[Xe],value:s=>nn(z(s))?z(s):null,says:"its folded lines are their numbers from 1, spaces between"}],os="data-title",as="data-wrap",qn=s=>L(s).length===1&&L(s)[0].tagName==="code"&&s.childNodes.every(n=>n.tagName||J(n))?L(s)[0]:null,Jn=new Set(["a","abbr","b","bdi","bdo","cite","code","data","del","dfn","em","font","i","ins","kbd","mark","q","s","samp","small","span","strike","strong","sub","sup","time","tt","u","var","br","wbr"]),Vn=new Set(["code","kbd","samp","tt","var"]);function ks(s){for(let n of s.childNodes){if(D(n))continue;if(!n.tagName)return"a comment in its <figcaption>";if(["img","picture","svg"].includes(n.tagName))return"a picture in its <figcaption>";if(!Jn.has(n.tagName))return`a <${n.tagName}> in its <figcaption>`;if(!n.sourceCodeLocation?.startTag||!(n.sourceCodeLocation.endTag||Qt.has(n.tagName)))return`a <${n.tagName}> not closed in its <figcaption>`;let d=ks(n);if(d)return d}return""}function is(s){let n=L(s),d=n.filter(y=>y.tagName==="pre"),p=n.filter(y=>y.tagName==="figcaption");if(!d.length)return null;let[N]=d,[u=null]=p,O=s.childNodes.find(y=>!y.tagName&&!J(y)),h=d.length>1||p.length>1||n.length>d.length+p.length?"more than the pre and one <figcaption> in its <figure>":O?D(O)?"words in its <figure> outside its caption":"a comment in its <figure>":u?Z(u).length?`its <figcaption> has an attribute of its own (${Z(u).join(", ")})`:u.sourceCodeLocation?.endTag?ks(u):"its <figcaption> is not closed in the file":"";return h?{pre:N,caption:u,why:h}:{pre:N,caption:u}}function Tt(s){let n=(s.attrs??[]).filter(({value:p})=>p.trim()),d=s.tagName==="abbr";return n.map(p=>`${p.name} ${JSON.stringify(z(p.value))} dropped: ${d&&p.name==="title"?"write the full name in the text":"write it in the text if the reader needs it"}`)}var q=s=>s.replace(/&/g,"&").replace(/"/g,""");function Xn(s){let n=new Set,d=p=>{for(let N of p.childNodes??[])if(N.tagName){for(let u of[tt,fs])w(N,u)!==void 0&&n.add(w(N,u));d(N.tagName==="template"?N.content:N)}};return d(s),n}function Zn(s){let n=new Map,d=p=>{for(let N of p.childNodes??[]){if(!N.tagName)continue;let u=w(N,"id");u!==void 0&&n.set(u,(n.get(u)??0)+1),d(N.tagName==="template"?N.content:N)}};return d(s),n}var Qn=/^[A-Za-z][\w-]{0,63}$/;function Yn(s){let n=Ge(s),d=ht(n,{sourceCodeLocationInfo:!0}),p=jt(d);if(!p)return{text:n,changes:[]};let N=[],u=[],O=t=>n.slice(0,t).split(`
|
|
4
|
-
`).length,h=(t,e,o=[],a={})=>{let c=O(t.sourceCodeLocation.startOffset);o.length||u.push({line:c,rule:e,...a});for(let r of o)u.push({line:c,rule:e,note:r,...a})},y=0,l=(t,e,o,{opens:a=null,closes:c=null,move:r=null,leaves:m=!1}={})=>N.push({start:t,end:e,text:o,order:y++,opens:a,closes:c,move:r,leaves:m}),$=(t,e,o,a)=>{l(t,t,o,{opens:e}),l(e,e,a,{closes:t})},i=t=>t.sourceCodeLocation?.startTag,f=t=>t.sourceCodeLocation?.endTag,g=(t,e,{drop:o=[]}={})=>{let a=C(t).filter(m=>!o.includes(m)),c=[...a,...e.filter(m=>!a.includes(m))],r=t.sourceCodeLocation.attrs?.class;if(c.join(" ")!==C(t).join(" "))if(r&&c.length)l(r.startOffset,r.endOffset,`class="${q(c.join(" "))}"`);else if(r)S(t,"class");else{let m=i(t).startOffset+1+t.tagName.length;l(m,m,` class="${q(c.join(" "))}"`)}},S=(t,e)=>{let o=t.sourceCodeLocation.attrs[e],a=o.startOffset;for(;/[ \t\n\r\f]/.test(n[a-1]??"");)a--;l(a,o.endOffset,"")},M=(t,e,{classes:o=[],drop:a=[]}={})=>{let c=t.sourceCodeLocation,r=Object.entries(c.attrs??{}).filter(([v])=>v!=="class"&&!a.includes(v)).map(([,v])=>` ${n.slice(v.startOffset,v.endOffset)}`).join(""),m=[...o,...C(t).filter(v=>!o.includes(v))];return`<${e}${m.length?` class="${q(m.join(" "))}"`:""}${r}>`},_,F=t=>Bn(_??=jn(d),t),Q,rt=t=>t.test(Q??=Mn(d)),W=(t,e,o)=>{l(i(t).startOffset,i(t).endOffset,e),f(t)&&l(f(t).startOffset,f(t).endOffset,o)},Bt=t=>W(t,"",""),H=t=>!!(i(t)&&(f(t)||t.tagName==="img")),de,ue=t=>{let e=w(t,"id");if(t.tagName!=="dialog"||!K(t,["id"])||!Qn.test(e??"")||!H(t))return!1;let o=L(t);return!(o.length?ms.has(o[0].tagName)&&H(o[0]):t.childNodes.some(c=>!J(c)&&c.nodeName!=="#comment"))||o.some(c=>c.tagName==="form")?!1:(de??=Zn(d),de.get(e)===1)},xs=t=>{let e=L(t)[0];return!$t(e,Xt.short)||Z(e).length?null:t.childNodes.slice(0,t.childNodes.indexOf(e)).every(J)?e:null},me=t=>t.tagName==="dialog"&&(C(t).includes("doc-dialog")||ue(t)),he=(t,e=[])=>{for(let o of t.childNodes??[])o===p||it(o)||(me(o)&&H(o)?e.push(o):he(o,e));return e},Mt=f(p)?he(d):[],ge,Ts=t=>(ge??=new Set((function e(o,a=[]){for(let c of o.childNodes??[])!c.tagName||it(c)||(me(c)&&a.push(w(c,"id")),e(c,a));return a})({childNodes:[p,...Mt]})),/^#./.test(t??"")&&ge.has(t.slice(1))),Es=t=>{let[e,...o]=L(t);if(!e||o.length||!C(e).includes("doc-dialog-panel"))return null;let[a,c,...r]=L(e);if(r.length||!a||!c||!C(a).includes(ft.header)||!C(c).includes("doc-dialog-content"))return null;let m=x=>x.childNodes.some(A=>!A.tagName&&!J(A)&&A.nodeName!=="#comment");if(m(e)||m(a)||!H(a)||!i(c))return null;let v=L(a),k=v.filter(x=>C(x).includes(ft.title)),E=v.filter(x=>!k.includes(x)),I=x=>(C(x).includes(ft.close)||w(x,ft.closeAttribute)!==void 0)&&H(x);return k.length!==1||!H(k[0])||E.length>1||!E.every(I)?null:{header:a,title:k[0],close:E[0]??null,content:c}},mt,pe=(t,e=[])=>{for(let o of t.childNodes??[])if(o.tagName){for(let{name:a,value:c}of o.attrs)a!=="id"&&a!=="class"&&e.push(c);(o.tagName==="script"||o.tagName==="style")&&e.push(o.childNodes.map(a=>a.value??"").join("")),pe(o,e)}return e},Is=(t,e)=>{mt??=pe(d).join(`
|
|
5
|
-
`);let o=0;for(let a=mt.indexOf(t);a>=0;a=mt.indexOf(t,a+t.length))!/[\w-]/.test(mt[a-1]??"")&&!/[\w-]/.test(mt[a+t.length]??"")&&o++;return o>(e?1:0)};function As(t){let e=Es(t);if(!e)return;let{header:o,title:a,close:c,content:r}=e,m=w(a,"id"),v=!!m&&w(t,"aria-labelledby")?.trim()===m;v&&S(t,"aria-labelledby"),l(i(o).startOffset,i(o).endOffset,n.slice(i(r).startOffset,i(r).endOffset));let k=i(a).startOffset+1;l(k,k+a.tagName.length,"h3"),g(a,[],{drop:[ft.title]}),m!==void 0&&!(m&&Is(m,v))&&S(a,"id"),l(f(a).startOffset,f(a).endOffset,"</h3>"),c&&l(c.sourceCodeLocation.startOffset,c.sourceCodeLocation.endOffset,""),l(f(o).startOffset,f(o).endOffset,""),l(i(r).startOffset,i(r).endOffset,"")}let Ne=t=>{for(let e of t.childNodes??[])it(e)||(e.tagName&&$t(e,Xt.match)&&As(e),Ne(e))},Rt=new Set;function Oe(t){let e=t.tagName;if(!H(t))return!1;let o=[];if(e==="mark"&&K(t,[]))W(t,'<span class="doc-highlight-yellow">',"</span>");else if((e==="del"||e==="strike")&&K(t,["cite","datetime"]))W(t,"<s>","</s>"),o=Tt(t);else if(e==="ins"&&K(t,["cite","datetime"]))W(t,"<u>","</u>"),o=Tt(t);else{if(["kbd","samp","tt","var"].includes(e)&&K(t,[]))return W(t,"<code>","</code>"),Rt.add(t),h(t,e),!0;if(e==="a"&&K(t,["href"])&&Ts(w(t,"href")))return g(t,[pn]),h(t,"dialog link"),!1;if(e==="small"&&K(t,[]))W(t,'<span class="doc-text-gray">',"</span>");else if(e==="q"&&K(t,["cite"]))W(t,"\u201C","\u201D"),o=Tt(t);else if(["abbr","cite","dfn","time","bdi","data"].includes(e)&&K(t,["title","datetime","value"]))Bt(t),o=Tt(t);else if(e==="span"&&K(t,[])||e==="font"&&K(t,["color"])&&!w(t,"color")?.trim())Bt(t);else if(e==="span"&&K(t,["style"])||e==="font"&&K(t,["color"])){let a=bs(e==="span"?w(t,"style")??"":`color: ${w(t,"color")}`);if(a.foreign)return!1;W(t,a.open,a.close),o=a.notes}else return!1}return Rt.add(t),h(t,e,o),!1}function _s(t){let{startOffset:e,endOffset:o}=t.sourceCodeLocation,a=n.slice(e,o);for(let c of a.matchAll(xn))$(e+c.index,e+c.index+c[0].length,'<span class="doc-math-inline">',"</span>"),u.push({line:O(e+c.index),rule:"formula"})}let $e=t=>L(t).every(e=>Rt.has(e)?$e(e):Ue(e));function js(t,e){let o=Ut(e);if(!o||t.tagName!==$n[o].takes||!H(e)||!H(t)||Z(t).length>0||!e.childNodes.every(r=>r===t||J(r))||!$e(t))return;let a=n.slice(i(e).endOffset,i(t).startOffset)+n.slice(f(t).endOffset,f(e).startOffset);l(i(e).endOffset,i(t).endOffset,""),l(f(t).startOffset,f(e).startOffset,"");let c=a.split(`
|
|
6
|
-
`).length-1;c>0&&l(f(e).endOffset,f(e).endOffset,lt.repeat(c)),h(e,o)}let Dt=new Set,we=new Set;function wt(t,e=()=>!1){for(let o of Vt(t)){if(!o.every(k=>k.tagName?i(k)&&(f(k)||Qt.has(k.tagName))&&!Yt(k):k.sourceCodeLocation))continue;let a=o[0].sourceCodeLocation.startOffset,c=o.at(-1).sourceCodeLocation.endOffset,r=n.slice(a,c),m=a+_n.exec(r)[0].length,v=c-/[ \t\n\r\f]*$/.exec(r)[0].length;if(o.every(D)&&Nt(n.slice(m,v)))$(m,v,'<div class="doc-math-block">',"</div>"),u.push({line:O(m),rule:"display formula"}),o.forEach(k=>we.add(k));else if(e(o)){let k=Wn(o);$(m,v,k?"<p>":"<p><strong>",k?"</p>":"</strong></p>"),u.push({line:O(m),rule:"step title",...ke(o[0].parentNode)}),o.forEach(E=>Dt.add(E))}else $(m,v,"<p>","</p>"),u.push({line:O(m),rule:"loose words"}),o.forEach(k=>Dt.add(k))}}let Bs=t=>t[0].parentNode.childNodes.slice(0,t[0].parentNode.childNodes.indexOf(t[0])).every(e=>!e.tagName||C(e).includes(Et)),be=new Set,ke=t=>be.has(t.parentNode)?{}:(be.add(t.parentNode),{note:"a step's own words written as its title, the first block of its node: <li><p><strong>\u2026</strong></p> then its content (a paragraph, a list\u2026)</li>"}),Ms=t=>{if(wt(t.childNodes,Bs),t.childNodes.filter(c=>c.tagName&&!C(c).includes(Et)).length>0||Vt(t.childNodes).length>0||!i(t)||!f(t))return;let a=t.childNodes.filter(c=>c.tagName).at(-1)?.sourceCodeLocation?.endOffset??i(t).endOffset;l(a,a,"<p></p>"),u.push({line:O(a),rule:"step title",...ke(t)})},Ft,Le=()=>{Ft??=Xn(d);let t=dn(Ft);return Ft.add(t),t},Rs=(t,e)=>`<div data-doc-chart="${q(w(t,"data-doc-chart"))}" ${fs}="${q(e)}"></div>`,lt=n.includes(`\r
|
|
7
|
-
`)?`\r
|
|
8
|
-
`:`
|
|
9
|
-
`,ye=t=>/^[ \t]*/.exec(n.slice(n.lastIndexOf(`
|
|
10
|
-
`,t-1)+1))[0];function ve(t,e,o,a=null){let c=Ce(t),r=c?gt(n,c.sourceCodeLocation.startOffset,c.sourceCodeLocation.endOffset):null,m=!!r&&(r.start!==c.sourceCodeLocation.startOffset||r.end!==c.sourceCodeLocation.endOffset),v=c?{from:i(c).endOffset,to:f(c).startOffset}:null,k=A=>`<figure class="doc-figure">${A?`<h3>${A}</h3>`:""}${Rs(t,o)}</figure>`,E=A=>v?A:A(""),I=m?`${lt}${ye(i(e).startOffset)}`:"",x=!!(a??f(e));if(x){let A=a?f(t).endOffset:f(e).endOffset;l(A,A,E(G=>`${a??""}${I}${k(G)}`),{closes:i(e).startOffset,move:v}),u.push({line:O(A),rule:"chart",key:o})}else l(i(e).startOffset,i(e).startOffset,E(A=>`${k(A)}${I}`),{opens:i(e).endOffset,move:v}),u.push({line:O(i(e).startOffset),rule:"chart",key:o});return r&&l(r.start,r.end,""),x&&!!a}let[Ds]=ts,Ce=t=>{let e=t.childNodes.find(o=>!J(o));return e?.tagName!=="caption"||!H(e)||Z(e).length>0||!et(e)||!e.childNodes.every(o=>D(o)||o.tagName&&!hs.has(o.tagName)&&!gs.has(o.tagName)&&!Yt(o))||e.childNodes.every(D)&&Nt(n.slice(i(e).endOffset,f(e).startOffset))||F({tags:["caption"]})?null:e},Fs=t=>{let e=w(t,"rowspan");return e===void 0||/^\s*\d+\s*$/.test(e)&&Number(e)===1};function Gs(t){let e=L(t).filter(m=>["thead","tbody","tfoot"].includes(m.tagName)),o=e.flatMap(m=>L(m)).flatMap(m=>L(m)).filter(m=>m.tagName==="th"&&i(m)),a=!F({tags:["th","thead"]});if(a)for(let m of o)g(m,se.some(v=>C(m).includes(v))?[Ds]:ts);let c=a||!o.length?[]:["its th as written (no header look, no thead): the document's own <style> styles th"],r=m=>m.length>0&&m.every(v=>v.tagName==="tr"&&H(v));for(let m of e){let v=L(m);if(m.tagName!=="tbody"||!r(v))continue;let[k,...E]=v,I=a&&e.length===1&&E.length>0&&L(k).length>0&&L(k).every(G=>G.tagName==="th"&&Fs(G)),x=i(m);if(x){if(!I||!f(m))continue;l(x.startOffset,x.endOffset,"<thead>"),l(k.sourceCodeLocation.endOffset,k.sourceCodeLocation.endOffset,`</thead>${n.slice(x.startOffset,x.endOffset)}`),h(k,"header row");continue}I&&($(k.sourceCodeLocation.startOffset,k.sourceCodeLocation.endOffset,"<thead>","</thead>"),h(k,"header row"));let A=I?E:v;$(A[0].sourceCodeLocation.startOffset,A.at(-1).sourceCodeLocation.endOffset,"<tbody>","</tbody>")}return c}let Gt,Ks=()=>{Gt??=(function e(o,a=new Set){for(let c of o.childNodes??[])c.tagName&&(w(c,"data-doc-sheets")!==void 0&&a.add(w(c,"data-doc-sheets")),e(c.tagName==="template"?c.content:c,a));return a})(d);let t=1;for(;Gt.has(`tabs-${t}`);)t++;return Gt.add(`tabs-${t}`),`tabs-${t}`},Se=new Set,Ws=t=>{let e=[],o=c=>c.childNodes.map(r=>D(r)?r.sourceCodeLocation?n.slice(r.sourceCodeLocation.startOffset,r.sourceCodeLocation.endOffset):r.value:r.tagName?(i(r)&&e.push(z(n.slice(i(r).startOffset,i(r).endOffset))),r.tagName==="br"?" ":o(r)):"").join(""),a=c=>c.childNodes.map(r=>D(r)?r.value:r.tagName==="br"?" ":r.tagName?a(r):"").join("");return{raw:z(o(t)),plain:z(a(t)),left:[...new Set(e)]}},Hs=(t,e,o)=>{let a=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").slice(0,48).replace(/-+$/,"")||`tab-${e+1}`,c=a;for(let r=2;o.has(c);r++)c=`${a}-${r}`;return o.add(c),c};function Ps(t,e){let o=cn(n),a=Qe[o]??Qe.zh,c=w(t,"data-doc-sheets")?.trim()?null:Ks(),r=new Set,m=[],v=e.map(({section:E,heading:I},x)=>{let{raw:A,plain:G,left:Y}=Ws(I),st=Hs(G,x,r);Z(I).length&&m.push(`${Z(I).join(", ")} of the heading "${G}" left out: a tab is its name alone`);for(let nt of Y)m.push(`${nt} in the heading "${G}" left out: a tab's name is plain text`);W(E,`<div data-doc-sheet="${st}">`,"</div>"),Se.add(I);let{startOffset:V,endOffset:X}=I.sourceCodeLocation,U=gt(n,V,X);return l(U.start,U.end,lt.repeat(n.slice(U.start,U.end).split(`
|
|
11
|
-
`).length-1)),Pe({sheet:st,title:A})}),k=M(t,t.tagName,{classes:["doc-sheet-shell"],drop:c?["data-doc-sheets"]:[]});c&&(k=k.replace(/>$/,` data-doc-sheets="${c}">`)),w(t,"aria-label")===void 0&&(k=k.replace(/>$/,` aria-label="${a}">`)),l(i(t).startOffset,i(t).endOffset,`${k}<div class="doc-sheet-tabs" aria-label="${a}">${v.join("")}</div>`),h(t,"sheets",m)}let Us=t=>{let e=L(t)[0];return L(t).length===1&&e.tagName==="a"&&C(e).join(" ")==="doc-bookmark"&&K(e,["class","href","title","target","rel"])&&!!w(e,"href")?.trim()&&H(e)&&e.childNodes.every(D)&&t.childNodes.every(o=>o===e||J(o))};function zs(t){let e=L(t)[0],o=w(e,"href").trim(),a=z(w(e,"title")??""),c=o;try{c=new URL(o).hostname||o}catch{}let r=[],m=w(e,"target");m!==void 0&&m.trim()!=="_blank"&&r.push(`target ${JSON.stringify(z(m))} left out: a bookmark opens its page in a new tab`);let v=w(e,"rel");v!==void 0&&v.split(/\s+/).some(I=>I&&!["noopener","noreferrer"].includes(I.toLowerCase()))&&r.push(`rel ${JSON.stringify(z(v))} left out: a bookmark's link is rel="noopener noreferrer"`),l(i(t).startOffset,i(t).endOffset,M(t,"figure",{classes:["doc-bookmark"]}));let k=et(e)?"":pt(c);l(i(e).startOffset,i(e).endOffset,`<a class="doc-bookmark-card" href="${q(o)}" target="_blank" rel="noopener noreferrer"><span class="doc-bookmark-text"><span class="doc-bookmark-title">${k}`);let E=a?`<span class="doc-bookmark-description">${pt(a)}</span>`:"";l(f(e).startOffset,f(e).endOffset,`</span>${E}<span class="doc-bookmark-url"><span class="doc-bookmark-href">${pt(o)}</span></span></span></a>`),l(f(t).startOffset,f(t).endOffset,"<figcaption></figcaption></figure>"),h(t,"bookmark",r)}let qs=t=>{let e=t?.parentNode;if(!t?.tagName||!C(t).includes("doc-column")||!e?.tagName||!C(e).includes("doc-columns"))return null;let o=r=>Number(/--doc-column-ratio\s*:\s*(\d*\.?\d+)/i.exec(w(r,"style")??"")?.[1]??1)||1,a=L(e).filter(r=>C(r).includes("doc-column")),c=a.reduce((r,m)=>r+o(m),0);return(St-fn*(a.length-1))/St*(o(t)/c)},Kt=(t,e,o)=>{let a=w(t,"width"),c=/^\s*(\d+(?:\.\d+)?)\s*(px|%)?\s*$/i.exec(a??""),r=(e?w(e,"style")??"":"").trim().replace(/;\s*$/,""),m=t.sourceCodeLocation.attrs?.width;if(!c||!m||/--doc-span\s*:/i.test(r))return null;let v=c[2]==="%",k=v?qs(o):null,E=v?Number(c[1])/100*(k??1):Number(c[1])/St,I=Math.round(Math.min(dt.max,Math.max(dt.min,E))*1e3)/1e3,x=m.startOffset;for(;/[ \t\n\r\f]/.test(n[x-1]??"");)x--;l(x,m.endOffset,"");let A=E<dt.min||E>dt.max?`, within ${dt.min} to ${dt.max}`:"",G=v?k===null?"a share of the width it stands in":`a share of the width it stands in, its column ${Math.round(k*1e3)/1e3} of the reading width`:`${Number(c[1])}px of the ${St}px reading width`;return{attribute:` style="${q(`${r?`${r}; `:""}${Ye}: ${I}`)}"`,note:`width="${a}" written as ${Ye}: ${I} on its figure (${G}${A}; at most the width it stands in)`}},Wt=(t,e)=>{let o=t?M(t,"figure",{classes:["doc-image"],drop:e?.attribute?["style"]:[]}):'<figure class="doc-image">';return e?.attribute?`${o.slice(0,-1)}${e.attribute}>`:o},Js=t=>L(t).filter(e=>e.tagName==="img").length===1&&L(t).every(e=>e.tagName==="img"||e.tagName==="figcaption")&&t.childNodes.every(e=>e.tagName||J(e)),Vs=t=>L(t).length===1&&L(t)[0].tagName==="img"&&t.childNodes.every(e=>e.tagName||J(e)),Xs=t=>t.childNodes.length>0&&t.childNodes.every(D)&&Nt(n.slice(i(t).endOffset,f(t).startOffset)),xe=new Set,Te=()=>F(Dn)||rt(Fn),Ee=t=>Rn(t)&&!Te();function Ie(t,e=null,o=null,a=[]){let c=qn(t),r=[t,c].filter(Boolean),m=[e,...r].filter(Boolean),v=r.flatMap(C).map(b=>ns.exec(b)?.[1]).find(Boolean)??m.map(b=>w(b,"data-language")??w(b,"data-lang")).find(Boolean),k=b=>m.find(T=>T.sourceCodeLocation.attrs?.[b]),E=(b,T)=>{let B=b?.sourceCodeLocation.attrs[T];return B?` ${n.slice(B.startOffset,B.endOffset)}`:""},I=k("id"),x=[...a],A=new Map(m.map(b=>[b,new Set])),G=b=>b.flatMap(T=>m.filter(B=>w(B,T)!==void 0).map(B=>(A.get(B).add(T),{element:B,name:T,value:w(B,T)}))),Y=(b,T)=>x.push(`${b.name} ${JSON.stringify(z(b.value))} left out (its <${b.element.tagName}>'s): ${T}`),st=zn.flatMap(({name:b,names:T,value:B,says:P})=>{let ot=G(T),R=ot.find(j=>B(j.value)!==null);for(let j of ot)j!==R&&Y(j,B(j.value)===null?P:`the block takes its <${R.element.tagName}>'s ${R.name}`);return R?[` ${b}="${q(B(R.value))}"`]:[]}),V=G([as]),X=V.find(b=>/^\s*(?:true|false)\s*$/i.test(b.value));for(let b of V)b!==X&&Y(b,X?`the block takes its <${X.element.tagName}>'s ${as}`:"false keeps its long lines on one line (they scroll), true wraps them");let U=X?X.value.trim().toLowerCase()==="false":r.some(b=>C(b).includes(Jt)),nt=r.flatMap(C).find(b=>vn.includes(b)),je=G([os]),Lt=o?null:je[0],Be=Lt?pt(z(Lt.value)):"";for(let b of je)b!==Lt&&Y(b,o?"its caption is its title":`the block takes its <${Lt.element.tagName}>'s ${os}`);let Me=b=>Object.keys(b.sourceCodeLocation.attrs??{}).filter(T=>T!=="class"&&!Un.has(T)&&!(T==="id"&&b===I)&&!A.get(b).has(T)),Re=b=>{let T=C(b).filter(j=>!ns.test(j)&&j!==Jt&&j!==nt),B=Me(b),ot=(b.attrs.find(j=>j.name==="style")?.value??"").split(";").map(j=>j.trim()).filter(Boolean).every(j=>/^--doc-code-height\s*:/i.test(j)),R=[...T.length?[`class ${JSON.stringify(T.join(" "))}`]:[],...B.filter(j=>!(j==="style"&&ot))];return R.length&&x.push(`${R.join(", ")} kept on its <${b.tagName}>`),`<${b.tagName}${T.length?` class="${q(T.join(" "))}"`:""}${B.map(j=>E(b,j)).join("")}>`},Ht=e?Me(e):[],De=`<div class="doc-code${U?` ${Jt}`:""}${nt?` ${nt}`:""}"${E(I,"id")}${E(k("data-block-id"),"data-block-id")}${v?` data-language="${q(v.toLowerCase())}"`:""}${st.join("")}${Ht.map(b=>E(e,b)).join("")}>`;Ht.length&&x.push(`${Ht.join(", ")} kept on the block (its <figure>'s)`);let Fe=Re(t),yt=b=>c?`${b}${Fe}`:`${b}${Fe}<code>`,vt=c&&H(c)?"</pre>":"</code></pre>",Ct=b=>`<div class="doc-code-title">${b}</div>`;if(!e)W(t,yt(`${De}${Ct(Be)}`),`${vt}</div>`);else if(W(e,De,"</div>"),!o)W(t,yt(Ct(Be)),vt);else{let{startOffset:b,endOffset:T}=o.sourceCodeLocation,B={from:i(o).endOffset,to:f(o).startOffset},P=R=>R.replace(/[ \t\n\r\f]+/g," ").trim(),ot=(R,j)=>n.slice(R,j).split(`
|
|
12
|
-
`).length-1;if(b<t.sourceCodeLocation.startOffset)l(b,T,R=>`${Ct(P(R))}${lt.repeat(ot(b,T))}`,{move:B}),W(t,yt(""),vt);else{let R=gt(n,b,T),j=ot(R.start,R.end),Zs=j?`${lt.repeat(j)}${ye(i(t).startOffset)}`:"";l(i(t).startOffset,i(t).endOffset,Qs=>yt(`${Ct(P(Qs))}${Zs}`),{move:B}),l(R.start,R.end,""),f(t)&&l(f(t).startOffset,f(t).endOffset,vt)}}if(c&&Z(c).length&&l(i(c).startOffset,i(c).endOffset,Re(c)),o){let b=new Set,T=B=>{for(let P of L(B))(!Vn.has(P.tagName)||Z(P).length)&&b.add(z(n.slice(i(P).startOffset,i(P).endOffset))),Qt.has(P.tagName)?l(i(P).startOffset,i(P).endOffset,P.tagName==="br"?" ":""):(Bt(P),T(P))};T(o);for(let B of b)x.push(`${B} in its caption left out: a code block's title is plain text`)}h(e??t,"code",x)}function Ae(t,e){let o=t.tagName;if(!H(t))return!1;if((o==="p"||o==="div"&&C(t).length===0)&&Xs(t))return W(t,M(t,"div",{classes:["doc-math-block"]}),"</div>"),h(t,"display formula"),!0;if(o==="figure"&&C(t).length===0&&Js(t)){let r=Kt(L(t).find(m=>m.tagName==="img"),t,e);return l(i(t).startOffset,i(t).endOffset,Wt(t,r)),L(t).some(m=>m.tagName==="figcaption")||l(f(t).startOffset,f(t).startOffset,"<figcaption></figcaption>"),h(t,"figure",r?[r.note]:[]),!0}if(o==="img"&&xt.has(e?.tagName)){let r=Kt(t,null,e);return $(i(t).startOffset,i(t).endOffset,Wt(null,r),"<figcaption></figcaption></figure>"),h(t,"picture",r?[r.note]:[]),!0}if(o==="p"&&xt.has(e?.tagName)&&Us(t))return zs(t),!0;if(w(t,"data-doc-sheets")!==void 0){let r=rn(t)?.tabs;return r&&Ps(t,r),!1}if(o==="p"&&Vs(t)){let r=Kt(L(t)[0],t,e);return W(t,Wt(t,r),"<figcaption></figcaption></figure>"),h(t,"picture",r?[r.note]:[]),!0}let a=o==="figure"&&C(t).length===0?is(t):null;if(a&&!a.why&&H(a.pre))return Ie(a.pre,t,a.caption),!0;if(o==="pre"&&!C(e??{}).includes("doc-code")){let m=e?.tagName==="figure"&&C(e).length===0&&L(e).some(k=>k.tagName==="figcaption")?is(e):null,v=m?.pre===t?m.why:"";return Ie(t,null,null,v?[`its <figure>'s caption stays a caption beside it: ${v}; a <figure> holding the pre and one <figcaption> of words alone makes them its title`]:[]),!0}if(o==="figure")return!xt.has(e?.tagName)||Sn(t)?!0:(g(t,["doc-figure"]),h(t,"figure"),ct(t));let c=o==="table"&&C(e??{}).includes("doc-table-wrap");if(o==="table"&&w(t,"data-doc-chart")!==void 0&&!xt.has((c?e.parentNode:e)?.tagName))return!1;if(o==="table"&&w(t,"data-doc-chart")!==void 0&&c&&i(e)){let r=w(e,tt)??Le();if(ve(t,e,r),w(e,tt)===void 0){let m=i(e).endOffset-1;l(m,m,` ${tt}="${q(r)}"`)}return l(i(t).startOffset,i(t).endOffset,M(t,"table",{drop:["data-doc-chart"]})),!1}if(o==="table"&&(!ct(t)||ds(t))&&!C(e??{}).includes("doc-table-wrap")){let r=t.sourceCodeLocation.attrs?.["data-block-id"],m=w(t,"data-doc-chart")!==void 0,k=(w(t,tt)?.trim()||null)??(m?Le():null),E=w(t,"style"),I=E===void 0?[]:ee(E).filter(U=>ss.test(U)),x=I.length?ee(E).filter(U=>!ss.test(U)):[],A=U=>` style="${q(U.map(nt=>nt.trim()).join("; "))}"`,G=`<div class="doc-table-wrap"${r?` ${n.slice(r.startOffset,r.endOffset)}`:""}${k?` ${tt}="${q(k)}"`:""}${I.length?A(I):""}>`,Y=M(t,"table",{classes:["doc-table"],drop:["data-block-id",...w(t,tt)!==void 0?[tt]:[],...m?["data-doc-chart"]:[],...I.length?["style"]:[]]}),st=x.length?`${Y.slice(0,-1)}${A(x)}>`:Y,V=m?null:Ce(t),X=!1;if(m&&(X=ve(t,t,k,"</div>")),V){let U=n.slice(i(t).endOffset,V.sourceCodeLocation.startOffset);l(i(t).startOffset,i(V).endOffset,'<p class="doc-note">'),l(f(V).startOffset,f(V).endOffset,`</p>${U}${G}${st}`),h(V,"caption")}else l(i(t).startOffset,i(t).startOffset,G,{opens:f(t).endOffset}),l(i(t).startOffset,i(t).endOffset,st);return X||l(f(t).endOffset,f(t).endOffset,"</div>",{closes:i(t).startOffset}),h(t,"table",Gs(t)),!1}if(o==="details"&&es(t)){let r=L(t)[0]?.tagName==="summary"?L(t)[0]:null;return!r||!H(r)||(l(i(t).startOffset,i(t).endOffset,M(t,"details",{classes:["doc-details"]})),L(r).some(m=>C(m).includes("doc-details-summary-label"))||$(i(r).endOffset,f(r).startOffset,'<span class="doc-details-summary-label">',"</span>"),$(f(r).endOffset,f(t).startOffset,'<div class="doc-details-content">',"</div>"),wt(t.childNodes.slice(t.childNodes.indexOf(r)+1)),h(t,"details")),!1}if(o==="dialog"&&ue(t)){let r=xs(t);return l(i(t).startOffset,i(t).endOffset,M(t,"dialog",{classes:["doc-dialog"]})),$(i(t).endOffset,f(t).startOffset,'<div class="doc-dialog-panel"><div class="doc-dialog-content">',"</div></div>"),r&&W(r,"<h3>","</h3>"),wt(t.childNodes.slice(r?t.childNodes.indexOf(r)+1:0)),h(t,"dialog"),!1}if(o==="aside"&&es(t)&&!F({tags:["aside"]}))return g(t,["doc-panel"]),xe.add(t),h(t,"aside"),!1;if(o==="ul"&&Ee(t)){g(t,[Zt],{drop:ce});for(let r of L(t))_e(r);return h(t,"task list"),!1}if(te(t)&&!ct(t))return l(i(t).startOffset,i(t).endOffset,M(t,"ol",{classes:[ut],drop:["data-doc-chart","data-flow"]})),h(t,"flowchart"),!1;if(o==="ul"&&C(t).includes(Zt)&&!ct(t)){let r=L(t).filter(ws);if(r.length&&!Te()){for(let m of r)_e(m);h(t,"task list")}return!1}return!1}function _e(t){let e=$s(t);if(g(t,[],{drop:re}),w(e,"checked")!==void 0){let c=i(t).startOffset+1+t.tagName.length;l(c,c,` ${ne}`)}let{startOffset:o,endOffset:a}=e.sourceCodeLocation;l(o,a+(n[a]===" "?1:0),"")}function bt(t,e=null,o=!1){An(t)&&(Ns(t)||xe.has(t)&&Vt(t.childNodes).length>0)?wt(t.childNodes):Kn(t)&&i(t)&&Ms(t);for(let a of t.childNodes??[]){if(D(a)){a.sourceCodeLocation&&a.value.includes("\\(")&&!we.has(a)&&_s(a);continue}if(!(!a.tagName||oe.has(a.tagName)||Se.has(a)||it(a))&&!(w(a,"data-doc-chart")!==void 0&&a.tagName!=="table"&&!te(a)||w(a,"contenteditable")!==void 0)&&!C(a).some(c=>It.includes(c))){if(a.tagName==="pre"){Ae(a,t);continue}if(!(ie(a)&&!Ee(a))){if(Dt.has(a)){Oe(a)||bt(a,a,!0);continue}Ae(a,t)||o&&Oe(a)||(bt(a,a,o||ae.has(a.tagName)),js(a,t))}}}}bt(p,p),bt({childNodes:Mt}),n.includes(ft.header)&&Ne(d);for(let t of Mt){let{startOffset:e,endOffset:o}=t.sourceCodeLocation,a=gt(n,e,o),c=f(p).startOffset,r=a.end>o?He(n,c):null;l(c,c,m=>r===null?m:`${m}${lt}${r}`,{move:{from:e,to:o}}),l(a.start,a.end,"",{leaves:!0}),h(t,"card outside main")}if(!N.length)return{text:n,changes:[]};let kt=N;for(let t of N.filter(e=>e.move)){let{from:e,to:o}=t.move,a=kt.filter(c=>!c.move&&!c.leaves&&c.start>=e&&c.end<=o);kt=kt.filter(c=>!a.includes(c)),t.text=t.text(cs(n.slice(e,o),a,e)),t.move=null}return{text:cs(n,kt),changes:u.sort((t,e)=>t.line-e.line)}}function cs(s,n,d=0){let p=h=>h.closes!==null?0:h.opens!==null?2:1,N=(h,y)=>p(h)-p(y)||(h.closes!==null?y.closes-h.closes||y.order-h.order:0)||(h.opens!==null?y.opens-h.opens:0)||h.order-y.order,u=[...n].sort((h,y)=>y.start-h.start||y.end-h.end||(h.start===h.end?N(y,h):y.order-h.order)),O=s;for(let{start:h,end:y,text:l}of u)O=O.slice(0,h-d)+l+O.slice(y-d);return O}function Ls(s,{finish:n=d=>d}={}){let{text:d,changes:p}=Yn(s);return{text:p.length?n(d):d,changes:p}}function jo(s,{finish:n,next:d,metadata:p=null}={}){let N=qt(s);if(N.length)return{text:s,changes:[],added:0,given:[],repeated:N,title:null,icon:null};let u=Ls(s,{finish:n}),{text:O,added:h,given:y}=qe(u.text,d),l=to(O,p);return{...l,changes:u.changes,added:h,given:Ve(l.text,y),repeated:N}}function Bo(s){return qt(s).length?[]:Je(Ls(s).text)}function to(s,n=null){let d=ht(s,{sourceCodeLocationInfo:!0}),p=jt(d),N=p&&Ot(p,l=>$t(l,mn.title)),u=N?.sourceCodeLocation?.endTag?Pt(s.slice(N.sourceCodeLocation.startTag.endOffset,N.sourceCodeLocation.endTag.startOffset)):"",O=s,h=null;if(u){let l=Ot(d,S=>S.tagName==="head"),i=(l&&Ot(l,S=>S.tagName==="title"))?.sourceCodeLocation,f=typeof n?.title=="string"?n.title:null,g=!1;if(i?.startTag&&i.endTag){let S=Pt(s.slice(i.startTag.endOffset,i.endTag.startOffset));if(!(f&&f!==u&&f.includes(u)?S.split(f).join("\0").includes(u):S.includes(u))){let _=f&&f!==u&&We(s,{from:f,to:u})||{start:i.startTag.endOffset,end:i.endTag.startOffset,text:pt(u)};O=s.slice(0,_.start)+_.text+s.slice(_.end),g=!0}}(g||f!==null&&f!==u)&&(h={from:f,to:u,page:g})}let y=null;if(p&&n&&typeof n=="object"){let l=ze(s),$=l.units.find(g=>g.kind==="icon"&&l.boxes[g.box]?.kind==="header"),i=$?ln(s.slice($.start,$.end)):null,f=n.icon??null;$?i!==null&&i!==f&&(y={from:f,to:i}):y=f===null?null:{from:f,to:f,missing:!0}}return{text:O,title:h,icon:y}}function Mo(s,n,{dryRun:d=!1,pending:p=!1,reread:N=!d&&!p}={}){let u=new Map;for(let{rule:y,line:l}of n)u.set(y,[...new Set([...u.get(y)??[],l])]);let O=[...u].map(([y,l])=>`${y} (line${l.length>1?"s":""} ${l.join(", ")})`).join(", "),h=tn.resolve(s);return[p?`natural ${h}: ${O} not rewritten yet: the export rewrites them in this file as the kit's markup (nothing to fix)`:`natural ${h}: ${O}${d?" would be":""} rewritten in this file as the kit's markup (nothing to fix)`,...n.filter(y=>y.note).map(({line:y,rule:l,note:$})=>` line ${y}, ${l}: ${$}`),...N?[" re-read the file before editing it"]:[]]}var rs="strong, em, b, i, u, s, code, a, sub, sup and br, the kit's colors (doc-text-*, doc-highlight-*) and formulas",fe=`write a to-do list as ul.${Zt} \u203A li, li[${ne}] for a checked item (a GFM task list, every item starting with its box, is made one unless the document's own style or script uses GFM's classes or the boxes)`,ys=s=>C(s).every(ls),vs=s=>L(s).flatMap(n=>[...n.tagName==="span"&&!(K(n,["class"])&&ys(n))?[n]:[],...vs(n)]),Cs=s=>L(s).some(n=>n.tagName==="img"||Cs(n)),Ss=s=>L(s).some(n=>n.tagName==="svg"||n.tagName==="canvas"||Ss(n)),_t=s=>L(s).some(n=>n.tagName==="input"&&w(n,"type")?.toLowerCase()==="checkbox"||_t(n)),eo=(s,n)=>{if(s==="tag:img")return"a picture amid the words: give it a paragraph of its own";if(s==="tag:span"){let d=vs(n).filter(p=>K(p,["style","class"])&&w(p,"style")!==void 0&&ys(p)).map(p=>bs(w(p,"style")).foreign).find(Boolean);return d?`a span with a style the kit has no format for (${d.join(", ")}): left as written`:`a <span> with a class or attribute of the document's own (the preview edits ${rs})`}return s==="tag:input"&&_t(n)?`a checkbox amid the words: ${fe}`:s.startsWith("tag:")&&at.has(s.slice(4))?`a block (<${s.slice(4)}>) amid the words: give the words a paragraph of their own`:s.startsWith("tag:")?`<${s.slice(4)}> amid the words (the preview edits ${rs})`:s==="comment"?"an HTML comment amid the words":s==="markup"?"an element not closed in the file (the parser closed it)":s==="mention"?'a page block written another way: the preview edits only <a class="doc-link-mention" href="../<slug>/doc.html"><span class="doc-link-mention-icon"></span>title</a>, its title plain words, no other attribute':s==="link"?"a javascript: or data: link":s},so=new Set([...ps,"details"]);function Ro(s){let n=ht(s,{sourceCodeLocationInfo:!0}),d=jt(n);if(!d)return[];let p=$=>s.slice(0,$).split(`
|
|
13
|
-
`).length,N=new Map,u=[],O=$=>{so.has($.tagName)&&$.sourceCodeLocation?.startTag&&Ns($)&&u.push({line:p($.sourceCodeLocation.startOffset),text:`<${$.tagName}>: words straight in it, outside any paragraph: give them a <p> (the preview cannot reach them, nor move its blocks one by one)`})},h=$=>{for(let i of L($)){let f=i.sourceCodeLocation?.startTag;f&&N.set(f.endOffset-1,i),h(i)}},y=$=>{for(let i of $.childNodes??[]){if(!i.tagName||oe.has(i.tagName))continue;if(it(i)){h(i);continue}if(w(i,"data-doc-chart")!==void 0||C(i).some(S=>It.includes(S))||ie(i))continue;let f=i.sourceCodeLocation?.startTag;f&&N.set(f.endOffset-1,i);let g=i.sourceCodeLocation?.endTag;if(ae.has(i.tagName)&&f&&i.childNodes.some(S=>D(S)&&/\\\[|\$\$/.test(S.value))&&!(g&&i.childNodes.every(D)&&Nt(s.slice(f.endOffset,g.startOffset)))){let S=Tn(s.slice(f.endOffset,g?g.startOffset:i.sourceCodeLocation.endOffset),!!g);u.push({line:p(f.startOffset),text:S?`<${i.tagName}>: the formula holds a bare < or >: write \\lt / \\gt (or < / >)`:`<${i.tagName}>: a display formula (\\[\u2026\\] or $$\u2026$$) amid the words: give it a paragraph of its own`})}i.tagName==="caption"&&f&&(et(i)||L(i).length>0)&&u.push({line:p(f.startOffset),text:'<caption>: the preview cannot edit a table caption; write the line above the table as <p class="doc-note">'}),O(i),y(i)}};O(d),y(d);let l=new Set;for(let{at:$,reason:i}of zt(s).locks){let f=N.get($);if(!f)continue;let g=i==="tag:input"&&f.tagName==="li"&&_t(f)&&f.parentNode?.sourceCodeLocation?.startTag?f.parentNode:null;g&&l.has(g)||(g&&l.add(g),g?u.push({line:p(g.sourceCodeLocation.startOffset),text:`<${g.tagName}>: checkboxes in its items: ${fe}`}):u.push({line:p(f.sourceCodeLocation.startOffset),text:`<${f.tagName}>: ${eo(i,f)}`}))}return u.sort(($,i)=>$.line-i.line).map(({line:$,text:i})=>`line ${$}: ${i}`)}function Do(s){let n=ht(s,{sourceCodeLocationInfo:!0}),d=jt(n);if(!d)return[];let p=f=>s.slice(0,f).split(`
|
|
14
|
-
`).length,N=[],u=[],O=f=>{for(let g of f.childNodes??[])g.tagName==="style"?u.push((g.childNodes??[]).map(S=>S.value??"").join("")):O(g)};O(n);let h=u.join(`
|
|
15
|
-
`).replace(/\/\*[\s\S]*?\*\//g,""),y=f=>new RegExp(`\\.${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w-])`).test(h),l=f=>{for(let g of L(f).filter(S=>S.tagName==="colgroup"&&w(S,"data-doc-columns")===void 0)){let S=[g,...L(g)].filter(_=>w(_,"width")!==void 0||/(?:^|;)\s*(?:min-|max-)?width\s*:/i.test(w(_,"style")??"")),M=(g.sourceCodeLocation?g:L(g)[0])?.sourceCodeLocation;S.length&&M&&N.push({line:p(M.startOffset),text:`<${g.sourceCodeLocation?"colgroup":"col"}> widths: the kit sizes columns itself; a merged table uses yours`})}},$=f=>{for(let g of f.childNodes??[]){if(!g.tagName||oe.has(g.tagName)||it(g)||w(g,"data-doc-chart")!==void 0||C(g).some(_=>It.includes(_)))continue;if(ie(g)){let _=g.sourceCodeLocation,F=en(s,g).some(({name:Q})=>Q==="class");if(ms.has(g.tagName)&&_?.startTag&&!F&&(et(g)||Cs(g))&&!Ss(g)&&!C(g).some(y)){let Q=(g.tagName==="ul"||g.tagName==="ol")&&_t(g)?`; for its checkboxes, ${fe}`:"";N.push({line:p(_.startOffset),text:`<${g.tagName} class="${w(g,"class").trim()}"> is a whole block (\u6574\u4F53\u5757): the reader moves it whole and edits its words in place; right for a layout of yours that is no figure (a figure, a diagram or a timeline, goes in <figure class="doc-figure">); drop its class only if its contents were meant as ordinary blocks${Q}`})}continue}g.tagName==="table"&&l(g);let S=Ut(g)?L(g).filter(_=>at.has(_.tagName)):[];S.length>0&&g.sourceCodeLocation&&N.push({line:p(g.sourceCodeLocation.startOffset),text:`<${g.tagName} class="${w(g,"class").trim()}"> holds ${[...new Set(S.map(_=>`<${_.tagName}>`))].join(", ")}: it is one text block, its words straight in it (<br> starts a line) or in one plain <p>, and blocks set apart on a fill go in an <aside>`});let M=g.tagName==="ol"&&C(g).includes(ut)?L(g).find(_=>_.tagName!=="li"&&_.sourceCodeLocation):null;if(M&&N.push({line:p(M.sourceCodeLocation.startOffset),text:`<ol class="${ut}"> holds a <${M.tagName}> outside its items: a flowchart's steps are its <li>s (what one holds after its words, a paragraph or a list, is that step's content)`}),g.tagName==="ol"&&C(g).includes(ut))for(let _ of L(g).filter(F=>F.tagName==="li")){let F=L(_).find(rt=>!C(rt).includes(Et)),Q=F?_.childNodes.slice(0,_.childNodes.indexOf(F)):[];F&&F.tagName!=="p"&&F.sourceCodeLocation&&!Q.some(rt=>!C(rt).includes(Et)&&et(rt))&&N.push({line:p(F.sourceCodeLocation.startOffset),text:`a step of <ol class="${ut}"> begins with a <${F.tagName}>: a step's first block is its title, a paragraph (<p><strong>\u2026</strong></p>), the blocks after it its content`})}$(g)}};return $(d),i(d,(f,g)=>N.push({line:f,text:`a ${no[g]} in the text: the page shows it as a break or an empty line, not as a character (a tool that decodes \\u2028 or \\u2029 escapes writes one); write the break the text means (<br>, a new paragraph, a new line in code) or take it out`})),N.sort((f,g)=>f.line-g.line).map(({line:f,text:g})=>`line ${f}: ${g}`);function i(f,g){for(let S of f.childNodes??[])if(!(S.tagName==="script"||S.tagName==="style"||it(S))){if(D(S)&&S.sourceCodeLocation&&/[\u2028\u2029]/.test(S.value)){let{startOffset:M,endOffset:_}=S.sourceCodeLocation,Q=s.slice(M,_).search(/[\u2028\u2029]/);g(p(M+Math.max(Q,0)),S.value.match(/[\u2028\u2029]/)[0])}i(S,g)}}}function Fo(s){let n=O=>s.slice(0,O).split(`
|
|
16
|
-
`).length,d=O=>D(O)?O.value:(O.childNodes??[]).map(d).join(""),p=O=>d(O).replace(/\s+/g," ").trim(),N=O=>L(O).find(h=>/^h[1-6]$/.test(h.tagName)),u=[];for(let O of zt(s).units){if(O.keep?.reason!=="script"||!O.keep.own)continue;let h=O.node.parentNode;for(;h&&h.tagName!=="section";)h=h.parentNode;let y=O.tag==="section"&&N(O.node)?` ${p(N(O.node))}`:"",l=h?.tagName&&N(h)?` in ${p(N(h))}`:"";u.push({line:n(O.elStart),text:`<${O.tag}>${y}${l} kept by the script: ${O.keep.names.join(", ")} (the reader cannot delete or convert it; rename any of these the script does not select it by)`})}return u.sort((O,h)=>O.line-h.line).map(({line:O,text:h})=>`line ${O}: ${h}`)}var no={"\u2028":"line separator (U+2028)","\u2029":"paragraph separator (U+2029)"};function jt(s){return Ot(s,n=>n.tagName==="main")}function Ot(s,n){if(s.tagName&&n(s))return s;for(let d of s.childNodes??[]){let p=Ot(d,n);if(p)return p}return null}export{Yn as a,Ls as b,jo as c,Bo as d,to as e,Mo as f,Ro as g,Do as h,Fo as i};
|
package/dist/chunk-5LEK2CBS.mjs
DELETED
|
@@ -1,2 +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}from"./chunk-GYQV7Y4J.mjs";import"./chunk-7GHT2UCA.mjs";import"./chunk-UNUEWH4S.mjs";import"./chunk-G7TOXONE.mjs";import"./chunk-LC7YNQFG.mjs";import"./chunk-6U2SLSDN.mjs";import"./chunk-W7CXPCRV.mjs";import"./chunk-LAE5NQ4B.mjs";import"./chunk-P2CAZPDP.mjs";import"./chunk-ITNLYXXV.mjs";import"./chunk-QMQUXTU4.mjs";import"./chunk-HQQMJCQJ.mjs";import"./chunk-QYKCJ7FG.mjs";import"./chunk-YZ5Z6H4W.mjs";import"./chunk-VACRB2NE.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-TDQP3DKQ.mjs";import"./chunk-5FRMCDPY.mjs";import"./chunk-E7VYDG2X.mjs";import"./chunk-NFIBI4IP.mjs";import"./chunk-W63L7367.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{a as startProductionServer};
|
package/dist/chunk-5OFN5AHC.mjs
DELETED
|
@@ -1,2 +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 k}from"./chunk-V4CPWKMZ.mjs";import{b as B,c as I}from"./chunk-342HXE3Q.mjs";import{a as y,b,c as v,d as l,e as x,f as S,g as $}from"./chunk-XINNG4F2.mjs";import"./chunk-7GHT2UCA.mjs";import"./chunk-G7TOXONE.mjs";import{k as h}from"./chunk-6U2SLSDN.mjs";import"./chunk-P2CAZPDP.mjs";import"./chunk-ITNLYXXV.mjs";import{j as u}from"./chunk-NSKUTQ5J.mjs";import{j as c,p as m,s as d,t as w,u as g}from"./chunk-QMQUXTU4.mjs";import"./chunk-HQQMJCQJ.mjs";import"./chunk-QYKCJ7FG.mjs";import"./chunk-YZ5Z6H4W.mjs";import"./chunk-VACRB2NE.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-TDQP3DKQ.mjs";import"./chunk-5FRMCDPY.mjs";import"./chunk-E7VYDG2X.mjs";import"./chunk-NFIBI4IP.mjs";import"./chunk-W63L7367.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";async function C(L){let{slugs:o,options:M}=await u({options:["--allow-failures"],argv:L});o.length===0&&(console.error(k()),process.exit(1));let N=await h(o),s=await c(o,{prepare:l({say:!1})}),t=await y(o.filter(e=>!s.has(e)));await b(o.filter(e=>s.has(e)||t.failures.has(e))),await S(o),await $(o);let p=o.filter(e=>!s.has(e)&&!t.failures.has(e)),{built:a,exported:i,failures:n}=p.length>0?await m(p,{prepare:l({say:!1})}):{built:[],exported:[],failures:new Map};for(let[e,r]of[...s,...t.failures])n.set(e,r);await w(n,{exportNote:!0}),await N.keep(i.map(({slug:e})=>e));let R=new Map(a.map(({report:e,removed:r})=>[e.slug,r]));for(let{slug:e,bytes:r,sha256:D}of i){let f=R.get(e),j=f.length>0?`; shared scripts and styles left out (unused): ${f.join(", ")}`:"";console.log(`Exported ${B(e)} (${r.toLocaleString("en-US")} bytes, sha256 ${D})${j}`)}d(a.map(({report:e})=>e)),x(a.map(({report:e})=>e));for(let e of t.lines)console.log(e);t.written.length>0&&console.log(v(t.written));for(let{slug:e}of i)console.log(I(e));g(n,{above:!0,allow:M.has("--allow-failures")})}export{C as run};
|
package/dist/chunk-5SIYS5HN.mjs
DELETED
|
@@ -1,2 +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 l,g as a,h as c}from"./chunk-YXAUQPVK.mjs";import{b as s,f as t,i}from"./chunk-NSKUTQ5J.mjs";import"./chunk-5L7RYZCL.mjs";import{reportsDirectory as w}from"../browser/shared/paths.mjs";async function h(m){let{positional:o,options:p}=t({options:["--no-browser"],argv:m});if(o.length>1)throw new s("Name one document at most.");let{slug:e=null,block:u=null}=o.length?await i(o[0]):{};console.log(`\u5DE5\u4F5C\u533A\uFF1A${w}`);let n=await a({slug:e,baseline:e!==null});n.ok||(console.error(n.message),process.exit(1));let r=await c(e,n,u);for(let g of r)console.log(g);console.log(await l(r,p))}export{h as run};
|
package/dist/chunk-5TEK3RAD.mjs
DELETED
|
@@ -1,2 +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{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l,r as m,s as n,t as o,u as p,v as q}from"./chunk-QMQUXTU4.mjs";import"./chunk-HQQMJCQJ.mjs";import"./chunk-QYKCJ7FG.mjs";import"./chunk-YZ5Z6H4W.mjs";import"./chunk-VACRB2NE.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-E7VYDG2X.mjs";import"./chunk-W63L7367.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{h as buildReports,d as checkReports,f as checkSelectedReports,b as exportFailures,k as exportReports,p as failureSummary,e as handInBlockers,l as notesByKind,m as notesOf,j as offlineReports,o as printFailures,c as quickFailures,a as repeatedIdFailures,q as reportFailures,n as reportNotes,i as withExportPolicy,g as writeSharedAssets};
|
package/dist/chunk-6CYG3Z4V.mjs
DELETED
|
@@ -1,2 +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,b,c,d,e,f}from"./chunk-2PBALTR3.mjs";import"./chunk-TX6JH7TR.mjs";import"./chunk-ZBIM6ARY.mjs";import"./chunk-NSKUTQ5J.mjs";import"./chunk-HQQMJCQJ.mjs";import"./chunk-QYKCJ7FG.mjs";import"./chunk-HYMEEXKN.mjs";import"./chunk-W63L7367.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{e as keyOf,d as missingSaid,b as packageFolder,a as packageNamed,f as run,c as shallowSaid};
|
package/dist/chunk-7GHT2UCA.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{d as re,e as oe}from"./chunk-G7TOXONE.mjs";import{d as ne}from"./chunk-P2CAZPDP.mjs";import{a as zt}from"./chunk-ITNLYXXV.mjs";import{a as Kt,b as Qt,c as Vt,d as Xt,e as qt}from"./chunk-TDQP3DKQ.mjs";import{b as te,c as ee,f as bt}from"./chunk-5FRMCDPY.mjs";import{a as Zt}from"./chunk-E7VYDG2X.mjs";import{G as Gt,H as Ht,a as Z}from"./chunk-NFIBI4IP.mjs";import{d as Wt,q as Ct}from"./chunk-W63L7367.mjs";import{randomBytes as Je}from"node:crypto";import X from"node:fs/promises";import nt from"node:path";import{FILE as Le,readItems as _e}from"../browser/shared/annotations.mjs";import{writeAtomic as Ue}from"../browser/shared/files.mjs";import{documentDirectory as Be}from"../browser/shared/workspace.mjs";var Ye=20,ie=/^\d{8}T\d{6}Z-[a-f0-9]{8}\.json$/,se=80,ce=({stateDirectory:i,slug:s})=>nt.join(i,"dropped-annotations",s),le=i=>({id:i.id,text:i.text,quote:i.anchor?.quote??"",kind:i.anchor?.kind??"text"});async function fe({stateDirectory:i,reportsDirectory:s,slug:p,time:m,items:h}){let d=ce({stateDirectory:i,reportsDirectory:s,slug:p});await X.mkdir(d,{recursive:!0});let k=m.replace(/[-:]/g,"").replace(/\.\d+Z$/,"Z");await Ue(nt.join(d,`${k}-${Je(4).toString("hex")}.json`),JSON.stringify({time:m,items:h}));let l=(await X.readdir(d)).filter(w=>ie.test(w)).sort();await Promise.all(l.slice(0,Math.max(0,l.length-Ye)).map(w=>X.rm(nt.join(d,w),{force:!0})))}async function _n({stateDirectory:i,reportsDirectory:s,slug:p}){let m=ce({stateDirectory:i,reportsDirectory:s,slug:p}),h=(await X.readdir(m).catch(()=>[])).filter(l=>ie.test(l)).sort();if(h.length===0)return[];let d=new Set(_e(await X.readFile(nt.join(Be(p,s),Le),"utf8").catch(()=>"")).map(l=>l.id)),k=[];for(let l of h){let w=nt.join(m,l);try{let T=JSON.parse(await X.readFile(w,"utf8")),E=Array.isArray(T?.items)?T.items.filter(F=>typeof F?.id=="string"&&!d.has(F.id)):[];typeof T?.time=="string"&&E.length&&k.push({time:T.time,items:E})}catch{}await X.rm(w,{force:!0}).catch(()=>{})}return k}var Ze=(i,s=new Date)=>{let p=new Date(i),m=d=>String(d).padStart(2,"0"),h=`${m(p.getHours())}:${m(p.getMinutes())}`;return p.toDateString()===s.toDateString()?h:`${p.getFullYear()}-${m(p.getMonth()+1)}-${m(p.getDate())} ${h}`},ae=i=>{let s=String(i??"").replace(/\s+/g," ").trim();return JSON.stringify(s.length>se?`${s.slice(0,se-1)}\u2026`:s)};function At(i,{time:s=null,items:p},{today:m=new Date}={}){let h=nt.resolve(i),d=`${p.length} \u6279\u6CE8 (annotation${p.length===1?"":"s"})`;return[`annotations ${h}: ${s?`at ${Ze(s,m)}, `:""}Gallery deleted ${d} whose words are gone from the document (rewritten or deleted):`,...p.map(({id:k,text:l,quote:w,kind:T})=>` ${k} ${ae(l)} on ${T==="blocks"?"the blocks ":""}${ae(w)}`)]}function Un(i,s,{today:p=new Date}={}){return s.length?[...s.flatMap(m=>At(i,m,{today:p}))," they were the reader's: say in your hand-off which your edit carried out and which you left, and never write them back"]:[]}import{randomBytes as We}from"node:crypto";import rt from"node:fs/promises";import dt from"node:path";import{writeAtomic as Ce}from"../browser/shared/files.mjs";var Ge=20,de=/^\d{8}T\d{6}Z-[a-f0-9]{8}\.json$/,ue=({stateDirectory:i,slug:s})=>dt.join(i,"rewrites",s);async function me({stateDirectory:i,reportsDirectory:s,slug:p,time:m,changes:h}){let d=ue({stateDirectory:i,reportsDirectory:s,slug:p});await rt.mkdir(d,{recursive:!0});let k=m.replace(/[-:]/g,"").replace(/\.\d+Z$/,"Z");await Ce(dt.join(d,`${k}-${We(4).toString("hex")}.json`),JSON.stringify({time:m,changes:h}));let l=(await rt.readdir(d)).filter(w=>de.test(w)).sort();await Promise.all(l.slice(0,Math.max(0,l.length-Ge)).map(w=>rt.rm(dt.join(d,w),{force:!0})))}async function pe({stateDirectory:i,reportsDirectory:s,slug:p}){let m=ue({stateDirectory:i,reportsDirectory:s,slug:p}),h=(await rt.readdir(m).catch(()=>[])).filter(k=>de.test(k)).sort(),d=[];for(let k of h){let l=dt.join(m,k);try{let w=JSON.parse(await rt.readFile(l,"utf8"));typeof w?.time=="string"&&Array.isArray(w.changes)&&d.push(w)}catch{}await rt.rm(l,{force:!0}).catch(()=>{})}return d}var He=(i,s=new Date)=>{let p=new Date(i),m=d=>String(d).padStart(2,"0"),h=`${m(p.getHours())}:${m(p.getMinutes())}`;return p.toDateString()===s.toDateString()?h:`${p.getFullYear()}-${m(p.getMonth()+1)}-${m(p.getDate())} ${h}`};function Gn(i,s,{today:p=new Date}={}){if(!s.length)return[];let m=dt.resolve(i),h=[];for(let{time:d,changes:k}of s){let l=[];for(let{line:w,rule:T,key:E}of[...k].sort((F,R)=>F.line-R.line)){let F=`line ${w} ${T}${E?` ${E}`:""}`;l.includes(F)||l.push(F)}h.push(`preview ${m}: at ${He(d,p)}, when the reader edited the page, the preview wrote your natural HTML as the kit's markup: ${l.join(", ")}`),h.push(...k.filter(w=>w.note).map(({line:w,rule:T,note:E})=>` line ${w}, ${T}: ${E}`))}return h.push(" re-read the file before editing it (those lines are the file's as you had left it)"),h}import{createHmac as sn,randomBytes as $e}from"node:crypto";import{existsSync as an,mkdirSync as cn,readFileSync as ln,writeFileSync as fn}from"node:fs";import D from"node:fs/promises";import A from"node:path";import{FILE as dn}from"../browser/shared/annotations.mjs";import{escapeTyped as un}from"../browser/shared/escape.mjs";import{writeAtomic as wt}from"../browser/shared/files.mjs";import{sendJson as U}from"../browser/shared/http.mjs";import{REQUEST_ID as Nt}from"../browser/shared/ids.mjs";import{UPLOAD_REQUEST_LIMIT as mn}from"../browser/shared/media.mjs";import{reportsDirectory as pn}from"../browser/shared/paths.mjs";import{sameDirectory as hn}from"../browser/shared/preview-server.mjs";import{slugPattern as q}from"../browser/shared/reports.mjs";import{documentDirectory as wn,documentFiles as gt,isDocumentSource as gn}from"../browser/shared/workspace.mjs";import Et from"node:fs/promises";import he from"node:path";import{checkAnnotations as ze,cleanAnchor as Ke,cleanItem as we,FILE as Qe,itemsText as Ve,readItems as Xe,treeText as ge}from"../browser/shared/annotations.mjs";import{writeAtomic as qe}from"../browser/shared/files.mjs";import{slugPattern as tn}from"../browser/shared/reports.mjs";import{documentDirectory as ye,documentFiles as en}from"../browser/shared/workspace.mjs";var nn=600*1e3,rn=600*1e3;function on(i){let{units:s,boxes:p}=Ht(i),m=[...s].sort((l,w)=>l.elStart-w.elStart),h=new Map(m.map((l,w)=>[l.id,w])),d=new Map(m.map(l=>[l.id,ge(l.node)])),k={h2:null,h3:null,h4:null};return m.map(l=>{let w=[];for(let R=l;R;R=R.parent===null?null:s[R.parent]){let N=p[R.box];if(N?.kind==="panel"&&N.key!==null){let v=s.find(I=>I.kind==="tab"&&I.parent===N.unit&&I.key===N.key);v&&w.unshift({tab:d.get(v.id)})}let B=N?.unit===null||N?.unit===void 0?null:s[N.unit];if(B?.tag==="details"&&N.kind==="details"){let v=B.node.childNodes.find(I=>I.tagName==="summary");v&&w.push({details:ge(v)})}}let T=w.find(R=>R.tab)?.tab,E=w.find(R=>R.details)?.details,F=[T,k.h2,k.h3,k.h4,E].filter(Boolean);return l.tag==="h2"?Object.assign(k,{h2:d.get(l.id),h3:null,h4:null}):l.tag==="h3"?Object.assign(k,{h3:d.get(l.id),h4:null}):l.tag==="h4"&&(k.h4=d.get(l.id)),{id:l.blockId,text:d.get(l.id),parent:l.parent===null?null:h.get(l.parent)??null,where:F,heading:/^h[2-4]$/.test(l.tag)}})}function ke({reportsDirectory:i,read:s,write:p=qe,dropped:m=()=>{},now:h=Date.now}){let d=new Map,k=new Map,l=new Map,w=(o,c)=>{let S=l.get(o);if(S?.text===c)return S.units;let y=on(c);return l.set(o,{text:c,units:y}),y},T=o=>he.join(ye(o,i),Qe),E=o=>typeof o=="string"&&tn.test(o);async function F(o){let c=await Et.readFile(T(o),"utf8").catch(()=>null);return{text:c,items:c===null?[]:Xe(c)}}async function R(o,c,S){let y=Ve(c);return y===S||(y===null?await Et.rm(T(o),{force:!0}):await p(T(o),y)),N(y)}let N=o=>o===null?"":Z(o),B=o=>{let c=d.get(o)??new Map;for(let[S,y]of c)h()-y>nn&&c.delete(S);return[...c.keys()]},v=(o,c)=>c.forEach(S=>d.get(o)?.delete(S)),I=o=>{let c=k.get(o)??k.set(o,new Map).get(o);for(let[S,y]of c)h()-y>rn&&c.delete(S);return c};async function W(o,{keep:c=null,items:S=null,before:y=void 0}={}){let J=S?{items:S,text:y}:await F(o),Y=await s(o).catch(()=>null);if(!Y)return{items:J.items,units:[],places:new Map,version:N(J.text),missing:!0};let L=w(o,Y.text),M=I(o),j=ze(J.items,L,{keep:new Set([...M.keys(),c])});for(let g of M.keys())j.waiting.has(g)||M.delete(g);if(j.dropped.length>0){let g=d.get(o)??d.set(o,new Map).get(o);for(let K of j.dropped)g.set(K.id,h())}let x=j.changed||S?await R(o,j.items,J.text):N(J.text);return j.dropped.length>0&&m(o,j.dropped),{items:j.items,units:L,places:j.places,version:x,missing:!1}}let ot=(o,{items:c,version:S})=>({ok:!0,version:S,items:c,dropped:B(o)});async function H(o){if(!E(o))return[400,{ok:!1,reason:"body"}];let c=await W(o);return c.missing?[404,{ok:!1,reason:"missing"}]:[200,ot(o,c)]}async function z(o){if(!E(o))return[400,{ok:!1,reason:"body"}];let c=await W(o);if(c.missing)return[404,{ok:!1,reason:"missing"}];let S=null,y=en(ye(o,i));try{S=JSON.parse(await Et.readFile(y.json,"utf8"))}catch{}let J=await s(o).catch(()=>null),Y=/<h1\b[^>]*>([\s\S]*?)<\/h1>/i.exec(J?.text??"")?.[1]?.replace(/<[^>]*>/g,"").trim(),L=typeof S?.title=="string"&&S.title.trim()?S.title.trim():Y||o,M=c.units.some(x=>x.heading),j=c.items.map(x=>{let g=c.units[c.places.get(x.id)?.at],K=g?.where?.length?g.where:g?.heading?[g.text]:[];return{where:K,top:M&&K.length===0,blocks:x.anchor.blocks.filter(kt=>c.units.some($t=>$t.id===kt)),whole:x.anchor.kind==="blocks",quote:x.anchor.quote,text:x.text}});return[200,{ok:!0,title:L,path:he.resolve(y.html),items:j}]}async function ut(o){let{slug:c}=o??{};if(!E(c))return[400,{ok:!1,reason:"body"}];if(!await s(c).catch(()=>null))return[404,{ok:!1,reason:"missing"}];let S=await F(c);if(o.anchors&&typeof o.anchors=="object"&&!Array.isArray(o.anchors)){let M=S.items.map(x=>{let g=Object.hasOwn(o.anchors,x.id)?Ke(o.anchors[x.id]):null;return g&&g.kind===x.anchor.kind?{...x,anchor:g}:x}),j=await R(c,M,S.text);return[200,ot(c,{items:M,version:j})]}let y=S.items,J=null,Y=null;if(o.put!==void 0){let M=y.find(x=>x.id===o.put?.id),j=we({...o.put,created:M?.created??o.put?.created});if(!j)return[400,{ok:!1,reason:"item"}];y=M?y.map(x=>x.id===j.id?j:x):[...y,j],J=j.id,M||I(c).set(j.id,h()),v(c,[j.id])}else if(typeof o.remove=="string")y=y.filter(M=>M.id!==o.remove);else if(o.clear===!0)Y=y,y=[];else if(Array.isArray(o.restore)){let M=new Map(y.map(g=>[g.id,g])),j=o.restore.map(g=>we(g,g?.updated)).filter(g=>g&&!(M.get(g.id)?.updated>g.updated)),x=new Set(j.map(g=>g.id));for(let g of x)M.has(g)||I(c).set(g,h());y=[...y.filter(g=>!x.has(g.id)),...j],v(c,[...x])}else return[400,{ok:!1,reason:"body"}];let L=await W(c,{keep:J,items:y,before:S.text});return[200,{...ot(c,L),...Y?{removed:Y}:{}}]}async function yt(o){if(!E(o))return;let{text:c}=await F(o);c!==null&&await W(o)}return{list:H,copy:z,change:ut,afterWrite:yt}}import{EMPTY_STYLE as yn,emptyWordsScript as kn,showEmpty as $n}from"../browser/editor/components/placeholder.mjs";import{TOKENS as xn}from"../browser/editor/page/look.mjs";import{MARGIN_STYLE as Sn,earlyMarginScript as jn}from"../browser/editor/page/margin.mjs";var Tt=/^[a-f0-9]{16}$/,Ft=2*1024*1024,On=mn,xe=50,Se=/^\d{8}T\d{6}Z-[a-f0-9]{16}\.html$/,vn=30,je=3,Oe=200,Mt="\u6587\u4EF6\u4E00\u518D\u88AB\u4FEE\u6539\uFF08\u4F8B\u5982 AI \u6B63\u5728\u5199\u5165\uFF09\uFF0C\u7A0D\u540E\u518D\u540C\u6B65",bn="\u8FD9\u6B21\u7684\u4FEE\u6539\u592A\u5927\uFF0C\u4E00\u6B21\u5B58\u4E0D\u4E0B",An=250,Rt=Symbol("again"),En="/__gallery/edit/src/editor/page/editor.mjs",Nn=i=>new Promise(s=>setTimeout(s,i));function Tn(i,s=Ft){return new Promise((p,m)=>{let h=[],d=0;i.on("data",k=>{d+=k.length,d>s?h.length=0:h.push(k)}),i.on("end",()=>d>s?m(new Error("too-large")):p(Buffer.concat(h).toString("utf8"))),i.on("error",m)})}function Mn(i){if(!i)return $e(16).toString("hex");let s=A.join(i,"token");try{let m=ln(s,"utf8").trim();if(/^[a-f0-9]{32}$/.test(m))return m}catch{}let p=$e(16).toString("hex");try{cn(i,{recursive:!0,mode:448}),fn(s,p,{mode:384})}catch{}return p}function Ar({reportsDirectory:i=pn,stateDirectory:s=null,write:p=wt,ids:m=!0,finish:h=l=>l,log:d=null,settling:k={}}={}){let l=Mn(s),w=oe(k),T=k.wait??re,E=async(t,n,e)=>{let r=await p(t,n,e);return r!==!1&&gn(A.basename(t))&&w.wrote(A.basename(A.dirname(t)),n),r},F=t=>wn(t,i),R=t=>gt(F(t)).html,N=new Map,B=s&&A.join(s,"snapshots"),v=Promise.resolve(),I=Promise.resolve(),W=async(t,n,e,{by:r="time"}={})=>{let a=(await D.readdir(t)).filter(f=>n.test(f));if(a.length<=e)return;let u=r==="name"?a.sort():(await Promise.all(a.map(async f=>({name:f,time:(await D.stat(A.join(t,f))).mtimeMs})))).sort((f,$)=>f.time-$.time).map(({name:f})=>f);await Promise.all(u.slice(0,u.length-e).map(f=>D.rm(A.join(t,f),{force:!0})))},ot=(t,n)=>{B&&(v=v.then(async()=>{let e=A.join(B,`${t}.html`),r=new Date;try{await D.utimes(e,r,r);return}catch{}await D.mkdir(B,{recursive:!0}),await wt(e,n),await W(B,/^[a-f0-9]{16}\.html$/,xe)}).catch(()=>{}))},H=(t,n)=>{s&&(v=v.then(async()=>{let e=A.join(s,"history",t),r=Z(n);if(await D.mkdir(e,{recursive:!0}),(await D.readdir(e)).filter(f=>Se.test(f)).sort().at(-1)?.endsWith(`-${r}.html`))return;let u=new Date().toISOString().replace(/[-:]/g,"").replace(/\.\d+Z$/,"Z");await wt(A.join(e,`${u}-${r}.html`),n),await W(e,Se,vn,{by:"name"})}).catch(()=>{}))},z=new Map,ut=t=>s&&A.join(s,"receipts",t),yt=(t,n,e,r)=>{for(z.set(`${t} ${n}`,{digest:e,answer:r});z.size>Oe*4;)z.delete(z.keys().next().value);let a=ut(t);a&&(v=v.then(async()=>{await D.mkdir(a,{recursive:!0}),await wt(A.join(a,`${n}.json`),JSON.stringify({digest:e,answer:r})),await W(a,{test:u=>u.endsWith(".json")&&Nt.test(u.slice(0,-5))},Oe)}).catch(()=>{}))},o=async(t,n)=>{let e=z.get(`${t} ${n}`);if(e)return e;let r=ut(t);if(!r)return null;await v;try{let a=JSON.parse(await D.readFile(A.join(r,`${n}.json`),"utf8"));return typeof a?.digest=="string"&&a.answer?.ok?a:null}catch{return null}},c=new Map,S=(t,n)=>{let e=new Date().toISOString();if(!s)return void c.set(t,[...c.get(t)??[],{time:e,changes:n}].slice(-20));v=v.then(()=>me({stateDirectory:s,reportsDirectory:i,slug:t,time:e,changes:n})).catch(()=>{})},y=async t=>{if(!s){let n=c.get(t)??[];return c.delete(t),n}return await v,pe({stateDirectory:s,reportsDirectory:i,slug:t})},J=(t,n)=>{for(N.delete(t),N.set(t,n);N.size>xe;)N.delete(N.keys().next().value);ot(t,n)},Y=async t=>{if(N.has(t))return N.get(t);if(!B||!Tt.test(t))return null;await v;let n=await D.readFile(A.join(B,`${t}.html`),"utf8").catch(()=>null);return n===null||Z(n)!==t?null:(J(t,n),n)},L=new Map,M=t=>{let n=L.get(t);if(n)return n;let e=te(t,{finish:h});for(L.set(t,e);L.size>8;)L.delete(L.keys().next().value);return e};async function j(t,n=void 0){if(typeof t!="string"||!q.test(t))return null;let e=R(t),r=n!==void 0?n:await D.readFile(e,"utf8").catch(()=>null);if(r===null)return null;let{text:a,changes:u}=M(r);return{file:e,source:r,text:a,version:Z(a),changes:u}}async function x(t){if(typeof t!="string"||!q.test(t))return{source:null,held:!1,signs:[],wait:0,own:!1};let n=R(t),e=await D.readFile(n,"utf8").catch(()=>null),r=(await D.stat(n).catch(()=>null))?.mtimeMs??0;return{source:e,...w.judge(t,{source:e,mtime:r})}}async function g(t,n=Date.now()+T){for(;;){let e=await x(t);if(!e.held||Date.now()>=n)return e;await Nn(Math.max(0,Math.min(An,n-Date.now())))}}async function K(t,{wait:n=T}={}){let e=await g(t,Date.now()+n);return j(t,e.held&&e.taken!==void 0?e.taken:e.source)}function kt(t,n,{editor:e=En,kitTags:r=()=>[]}={}){let{html:a,map:u}=zt(n);J(u.version,n);let f=Wt(i),$=Ct(f).map(({assets:_,...C})=>({...C,kit:r(_)})),O=`<script type="application/json" id="doc-edit-map" data-doc-dev>${JSON.stringify({slug:t,token:l,...u,components:$,hidden:f.settings.hidden}).replace(/</g,"\\u003c")}</script>
|
|
3
|
-
<script data-doc-dev>document.currentScript.remove(); import(${JSON.stringify(e)});</script>`,P=`<style data-doc-dev>.doc-display { display: none; }</style>
|
|
4
|
-
<style data-doc-dev data-ge-palette>${xn}</style>
|
|
5
|
-
<style data-doc-dev>${yn}</style>
|
|
6
|
-
<script data-doc-dev>${kn()}</script>
|
|
7
|
-
<script data-doc-dev>document.currentScript.remove(); document.documentElement.setAttribute("data-ge-order", "file");</script>
|
|
8
|
-
<style data-doc-dev data-ge-margin-style>${Sn}</style>
|
|
9
|
-
<script data-doc-dev>document.currentScript.remove(); ${jn(t,{notes:an(A.join(F(t),dn))})}</script>`;return{html:$n(a),snippet:O,head:P}}let $t=t=>J(Z(t),t);async function st(t,n=Ft){if(t.method!=="POST")return{error:[405,{ok:!1,reason:"method"}]};let e=t.headers.host??"",r=t.socket.localPort;if(e!==`127.0.0.1:${r}`&&e!==`localhost:${r}`)return{error:[403,{ok:!1,reason:"host"}]};if(t.headers.origin!==`http://${e}`)return{error:[403,{ok:!1,reason:"origin"}]};if(t.headers["x-gallery-token"]!==l)return{error:[403,{ok:!1,reason:"token"}]};if(!/^application\/json\b/i.test(t.headers["content-type"]??""))return{error:[415,{ok:!1,reason:"type"}]};try{return{body:JSON.parse(await Tn(t,n))}}catch(a){return{error:a.message==="too-large"?[413,{ok:!1,reason:"body",message:bn}]:[400,{ok:!1,reason:"body"}]}}}async function ve(t,n){let{slug:e,opening:r,known:a=null,texts:u=[],units:f=[],touch:$=[],pageIds:b=null,request:O=null}=t;if(typeof e!="string"||!q.test(e)||![u,f,$].every(Array.isArray))return[400,{ok:!1,reason:"body"}];if(O!==null&&(typeof O!="string"||!Nt.test(O)))return[400,{ok:!1,reason:"body"}];let P=O===null?null:Z(JSON.stringify([r??null,u,f,$])),_=await It(t);if(_)return _;let C=V=>(O!==null&&yt(e,O,P,V),[200,V]),G=R(e),Q=typeof r=="string"&&Tt.test(r)?await Y(r):null,et=V=>sn("sha256",l).update(`${e}
|
|
10
|
-
${V}`).digest("hex").slice(0,32);for(let V=1;;V++){let{source:pt,held:De}=await x(e);if(pt===null)return[404,{ok:!1,reason:"missing"}];if(De)return Date.now()<n?Rt:[409,{ok:!1,reason:"busy",message:Mt}];let{text:lt,changes:vt}=M(pt),ht=Qt({current:lt,opening:Q,texts:u,units:f,touch:$,ids:m,seal:et,pageIds:b}),{title:_t,icon:Ut,...Bt}=ht,ft=ht.text===lt?lt:h(ht.text);ft!==ht.text&&(Bt.version=Z(ft));let Yt={...Bt,foreign:typeof a=="string"&&Z(lt)!==a};if(ft===lt)return C({ok:!0,...Yt,wrote:!1,notes:[]});if(H(e,pt),!await E(G,ft,{expect:pt})){if(V===je)return[409,{ok:!1,reason:"busy",message:Mt}];continue}H(e,ft),vt.length&&(d&&d(bt(G,vt).join(`
|
|
11
|
-
`)),S(e,vt));let Pe=[..._t?await xt(A.dirname(G),_t):[],...Ut!==void 0?await Dt(A.dirname(G),Ut):[]];return C({ok:!0,...Yt,wrote:!0,notes:Pe})}}async function It({slug:t,opening:n,texts:e=[],units:r=[],touch:a=[],request:u=null}){if(typeof t!="string"||!q.test(t)||typeof u!="string"||!Nt.test(u)||![e,r,a].every(Array.isArray))return null;let f=await o(t,u);return f?f.digest===Z(JSON.stringify([n??null,e,r,a]))?[200,{...f.answer,again:!0}]:[409,{ok:!1,reason:"request",message:"\u540C\u4E00\u6B21\u4FDD\u5B58\u7684\u5185\u5BB9\u4E0D\u4E00\u81F4"}]:null}async function be(t,n){let{slug:e,opening:r,texts:a=[],units:u=[],instances:f=[],pageIds:$=null}=t;if(typeof e!="string"||!q.test(e)||!Array.isArray(a)||!Array.isArray(u)||!Array.isArray(f))return[400,{ok:!1,reason:"body"}];let{source:b,held:O}=await x(e);if(O)return Date.now()<n?Rt:[409,{ok:!1,reason:"busy",message:Mt}];let P=await j(e,b);if(P===null)return[404,{ok:!1,reason:"missing"}];let{text:_,version:C}=P,G=typeof r=="string"&&Tt.test(r)?await Y(r):null;return[200,{ok:!0,version:C,reverted:qt({current:_,opening:G,texts:a,pageIds:$}),units:Vt({current:_,units:u}),parts:Xt({current:_,instances:f,pageIds:$})}]}async function xt(t,{from:n,to:e,synced:r}){let a=["\u6807\u9898\u5DF2\u66F4\u65B0",...r?[]:["\u5355\u72EC\u6253\u5F00\u6216\u5BFC\u51FA\u65F6\u7684\u9875\u9762\u540D\u79F0\u539F\u672C\u5C31\u548C\u6807\u9898\u4E0D\u540C\uFF0C\u6CA1\u6709\u8DDF\u7740\u6539"]],u=gt(t).json,f=await D.readFile(u,"utf8").catch(()=>""),$=null;try{$=JSON.parse(f)}catch{}if($?.title!==n)return[...a,"\u641C\u7D22\u548C\u4FA7\u680F\u91CC\uFF08\u6CA1\u6253\u5F00\u8FD9\u4EFD\u6587\u6863\u65F6\uFF09\u7684\u6587\u6863\u540D\u539F\u672C\u5C31\u548C\u6807\u9898\u4E0D\u540C\uFF0C\u6CA1\u6709\u8DDF\u7740\u6539"];let b=new RegExp(`("title"\\s*:\\s*)${JSON.stringify(n).replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}`),O=b.test(f)?f.replace(b,(P,_)=>_+JSON.stringify(e)):`${JSON.stringify({...$,title:e},null,2)}
|
|
12
|
-
`;try{await E(u,O)}catch(P){return d?.(`${A.basename(u)}'s title was not written (${P.code??P.message}): ${u}`),[...a,"\u641C\u7D22\u548C\u4FA7\u680F\u91CC\uFF08\u6CA1\u6253\u5F00\u8FD9\u4EFD\u6587\u6863\u65F6\uFF09\u7684\u6587\u6863\u540D\u6CA1\u80FD\u8DDF\u7740\u6539"]}return a}async function Dt(t,n){let e=gt(t).json,r=null;try{r=JSON.parse(await D.readFile(e,"utf8"))}catch{}if(!r||typeof r!="object")return d?.(`${A.basename(e)} could not be read, so its icon was not written: ${e}`),["\u9875\u9762\u56FE\u6807\u5DF2\u66F4\u6362\uFF0C\u4F46\u641C\u7D22\u548C\u4FA7\u680F\u91CC\uFF08\u6CA1\u6253\u5F00\u8FD9\u4EFD\u6587\u6863\u65F6\uFF09\u7684\u56FE\u6807\u6CA1\u80FD\u8DDF\u7740\u6362"];if((r.icon??null)===n)return[];let{icon:a,...u}=r,f=n===null?u:{...u,icon:n};try{await E(e,`${JSON.stringify(f,null,2)}
|
|
13
|
-
`)}catch($){return d?.(`${A.basename(e)}'s icon was not written (${$.code??$.message}): ${e}`),["\u9875\u9762\u56FE\u6807\u5DF2\u66F4\u6362\uFF0C\u4F46\u641C\u7D22\u548C\u4FA7\u680F\u91CC\uFF08\u6CA1\u6253\u5F00\u8FD9\u4EFD\u6587\u6863\u65F6\uFF09\u7684\u56FE\u6807\u6CA1\u80FD\u8DDF\u7740\u6362"]}return[]}async function Ae(t,n){let e=typeof n=="string"?n.replace(/\s+/g," ").trim():"";if(!e)return{ok:!1,reason:"title",message:"\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A"};let r=R(t),a=await D.readFile(r,"utf8").catch(()=>null);if(a===null)return{ok:!1,reason:"missing"};let u=Zt(a),f=Gt(u).find(O=>O.kind==="title");if(!f)return{ok:!1,reason:"no-title",message:"\u8FD9\u4EFD\u6587\u6863\u6CA1\u6709\u6807\u9898"};let $=un(e),b=Kt({current:u,edits:[{id:f.id,parts:[{keep:!0,html:$}]}],ids:m});return b.ok?b.text!==a&&!await E(r,b.text,{expect:a})?{ok:!1,reason:"changed-again"}:{ok:!0,title:e,notes:b.title?await xt(A.dirname(r),b.title):[]}:{ok:!1,reason:"conflict"}}let at=t=>(n,e)=>{let r=I.then(()=>t(n));return I=r.catch(()=>{}),r.then(([a,u])=>U(e,a,u),a=>U(e,500,{ok:!1,reason:"write",message:a.message}))},Pt=(t,{early:n=null}={})=>async(e,r)=>{let a=await st(e);if(a.error)return U(r,...a.error);let u=a.body??{},f=Date.now()+T;try{let $=n&&await n(u);if($)return U(r,...$);for(;;){await g(u.slug,f);let b=I.then(()=>t(u,f));I=b.catch(()=>{});let O=await b;if(O!==Rt)return U(r,...O)}}catch($){return U(r,500,{ok:!1,reason:"write",message:$.message})}};async function St(t,{reader:n=!1}={}){if(typeof t!="string"||!q.test(t))return{ok:!1,reason:"missing",message:"\u627E\u4E0D\u5230\u8FD9\u4EFD\u6587\u6863"};let e=F(t),{html:r,json:a}=gt(e);for(let u=1;;u++){let{source:f,held:$}=n?await x(t):{source:await D.readFile(r,"utf8").catch(()=>null),held:!1};if(f===null)return{ok:!1,reason:"missing",message:"\u627E\u4E0D\u5230\u8FD9\u4EFD\u6587\u6863"};if($)return{ok:!1,reason:"busy",message:"\u6587\u4EF6\u4E00\u518D\u88AB\u4FEE\u6539\uFF08\u4F8B\u5982 AI \u6B63\u5728\u5199\u5165\uFF09\uFF0C\u6CA1\u6709\u5199\u5165"};let b=null;try{b=JSON.parse(await D.readFile(a,"utf8"))}catch{}let{text:O,changes:P,added:_,given:C,repeated:G,title:Q,icon:et}=ee(f,{finish:h,next:typeof m=="function"?m:void 0,metadata:b});if(O!==f){if(H(t,f),!await E(r,O,{expect:f})){if(u===je)return{ok:!1,reason:"busy",message:"\u6587\u4EF6\u4E00\u518D\u88AB\u4FEE\u6539\uFF08\u4F8B\u5982 AI \u6B63\u5728\u5199\u5165\uFF09\uFF0C\u6CA1\u6709\u5199\u5165"};continue}H(t,O),n&&P.length&&(d&&d(bt(r,P).join(`
|
|
14
|
-
`)),S(t,P))}return Q&&typeof b?.title=="string"&&b.title!==Q.to&&await xt(e,{from:b.title,to:Q.to,synced:Q.page}),et&&!et.missing&&await Dt(e,et.to),{ok:!0,changes:O===f?[]:P,added:O===f?0:_,given:O===f?[]:C,repeated:G,written:O!==f,title:Q,icon:et}}}let Ee=async(t,{reader:n=!1}={})=>{n&&await g(t);let e=I.then(()=>St(t,{reader:n}));return I=e.catch(()=>{}),e};async function Jt(t){let n=await st(t);if(n.error)return{refused:n.error};let{slug:e,workspace:r}=n.body??{};return typeof e!="string"||!q.test(e)||typeof r!="string"?{refused:[400,{ok:!1,reason:"body"}]}:hn(r,i)?{slug:e}:{refused:[409,{ok:!1,reason:"elsewhere",message:"\u8FD9\u4E2A\u9884\u89C8\u670D\u52A1\u5668\u7BA1\u7684\u662F\u53E6\u4E00\u4E2A\u76EE\u5F55\u7684\u6587\u6863"}]}}async function Ne(t,n){try{let e=I.then(async()=>{let{slug:u,refused:f}=await Jt(t);if(f)return{answer:f};let $=await St(u);return{slug:$.ok?u:null,answer:[$.ok?200:$.reason==="missing"?404:409,$]}});I=e.catch(()=>{});let{slug:r,answer:a}=await e;return r&&await Ot(r),U(n,...a)}catch(e){return U(n,500,{ok:!1,reason:"write",message:e.message})}}async function Te(t){let{slug:n,refused:e}=await Jt(t);return e||(await Ot(n),[200,{ok:!0}])}let tt=ne({reportsDirectory:i}),it=ke({reportsDirectory:i,read:t=>K(t,{wait:0}),write:E,dropped:(t,n)=>{let e=n.map(le);d&&d(At(A.join(F(t),"annotations.json"),{items:e}).join(`
|
|
15
|
-
`)),s&&(v=v.then(()=>fe({stateDirectory:s,reportsDirectory:i,slug:t,time:new Date().toISOString(),items:e})).catch(()=>{}))}}),Lt=Promise.resolve(),jt=t=>{let n=Lt.then(t);return Lt=n.catch(()=>{}),n},Me=t=>(n,e)=>jt(()=>t(n)).then(([r,a])=>U(e,r,a),r=>U(e,500,{ok:!1,reason:"write",message:r.message})),Re=300,ct=new Map;async function Ot(t){let n=ct.get(t);n&&(clearTimeout(n.timer),ct.delete(t));let e=jt(()=>it.afterWrite(t));n&&e.then(n.resolve,n.reject),await e.catch(r=>d?.(`${t}: annotations not checked: ${r.message}`)),await v}let Fe=t=>{let n=t.headers.host??"",e=t.socket.localPort;return n!==`127.0.0.1:${e}`&&n!==`localhost:${e}`?[403,{ok:!1,reason:"host"}]:t.headers["x-gallery-token"]!==l?[403,{ok:!1,reason:"token"}]:null};async function Ie(t){if(t.method==="GET"){let e=Fe(t);if(e)return e;let r=new URL(t.url??"/","http://localhost").searchParams;return r.get("as")==="copy"?it.copy(r.get("slug")):it.list(r.get("slug"))}let n=await st(t);return n.error??it.change(n.body)}let mt=(t,n=Ft)=>async e=>{let r=await st(e,n);return r.error??t(r.body)};return{token:l,preview:kt,opened:$t,check:st,upload:at(mt(tt.upload,On)),addEmoji:at(mt(tt.addEmoji)),unfurl:at(mt(tt.unfurl)),annotations:Me(Ie),checkAnnotations(t){let n=ct.get(t);return n||(n={timer:0},n.done=new Promise((e,r)=>Object.assign(n,{resolve:e,reject:r})),ct.set(t,n)),clearTimeout(n.timer),n.timer=setTimeout(()=>{ct.delete(t),jt(()=>it.afterWrite(t)).then(n.resolve,n.reject)},Re),n.done},frameable:at(mt(tt.frameable)),listEmojis:tt.listEmojis,readEmoji:tt.readEmoji,respond:at,keepVersion:H,renameReport:Ae,read:j,settled:x,whenTaken:g,readTaken:K,takeRewrites:y,handIn:Ee,handInReport:St,handInRequest:Ne,settleRequest:(t,n)=>Te(t).then(([e,r])=>U(n,e,r),e=>U(n,500,{ok:!1,reason:"write",message:e.message})),settleNotes:Ot,commit:Pt(ve,{early:It}),reverted:Pt(be),stored:()=>v}}export{_n as a,Un as b,pe as c,Gn as d,Ar as e};
|
package/dist/chunk-7QQBR7PB.mjs
DELETED
|
@@ -1,2 +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{c as l,d as i}from"./chunk-LHTFLRB6.mjs";import{f as a}from"./chunk-NSKUTQ5J.mjs";import p from"node:fs/promises";import f from"node:path";import{reportsDirectory as h}from"../browser/shared/paths.mjs";import{sameDirectory as u}from"../browser/shared/preview-server.mjs";import{copyOldDocuments as d,ensureWorkspace as g,layoutOf as k}from"../browser/shared/workspace.mjs";var m=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function $(e,t,r){let{preferences:s}=k(r);return[e.copied.length?`Copied ${m(e.copied.length,"document")} from ${t}: ${e.copied.join(", ")}`:`Copied no documents from ${t}.`,...e.skipped.length?[`Skipped (the slug is taken here, or the folder's name is no slug): ${e.skipped.join(", ")}`]:[],...e.kept.length?[`Left behind (a name a workspace keeps for itself, for its component packages here, which no new document takes): ${e.kept.join(", ")}`]:[],...e.preferences==="copied"?[`\u5199\u4F5C\u504F\u597D\uFF1Acopied (${s})`]:e.preferences==="kept"?[`\u5199\u4F5C\u504F\u597D\uFF1Akept the workspace's (${s}); the old one was not copied`]:[],...e.outline?[`Sidebar order: ${e.outline}`]:[],...e.page?[`\u5199\u4F5C\u504F\u597D's page: ${e.page==="copied"?"copied":"kept the workspace's"}`]:[],...e.emoji?[`Emoji library: ${e.emoji} added`]:[],...e.history?[`Recent versions: ${m(e.history,"document")}`]:[],...e.packages.length?[`Component packages: ${e.packages.join(", ")}`]:[]]}async function C(e){let{values:t}=a({values:["--from"],argv:e}),r=h,s;try{let{made:o,ours:n,reads:c}=await g(r);n||(console.error(i(r,c)),process.exit(1)),s=o}catch(o){if(!o.code)throw o;console.error(l(r,o.code)),process.exit(1)}if(console.log(`\u5DE5\u4F5C\u533A\uFF1A${r}\uFF08${s?"\u65B0\u5EFA":"\u5DF2\u6709"}\uFF09`),t.has("--from")){let o=f.resolve(t.get("--from"));await p.stat(o).then(n=>n.isDirectory(),()=>!1)||(console.error(`No such folder: ${o} (--from names an older Gallery's reports/ folder).`),process.exit(1)),u(o,r)&&(console.error(`${o} is this workspace: --from names another folder (an older Gallery's reports/).`),process.exit(1));for(let n of $(await d({from:o,to:r}),o,r))console.log(n)}console.log('Next: gallery new <slug> "<title>" makes a document; gallery open opens the workbench.')}export{$ as a,C as b};
|
package/dist/chunk-ATCJYAR4.mjs
DELETED
|
@@ -1,2 +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,b,c,d,e,f,g,h,i}from"./chunk-5FRMCDPY.mjs";import"./chunk-E7VYDG2X.mjs";import"./chunk-NFIBI4IP.mjs";import"./chunk-W63L7367.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{f as changeLines,c as handedInSource,e as inStep,a as naturalize,d as pendingBlockIds,g as readOnlyTexts,i as scriptKept,b as shownSource,h as writingNotes};
|
package/dist/chunk-C7HWOBIF.mjs
DELETED
|
@@ -1,2 +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,b,c}from"./chunk-FQGQH4KM.mjs";import"./chunk-TX6JH7TR.mjs";import"./chunk-YXAUQPVK.mjs";import"./chunk-NSKUTQ5J.mjs";import"./chunk-YZ5Z6H4W.mjs";import"./chunk-E7VYDG2X.mjs";import"./chunk-A55HN5OK.mjs";import"./chunk-5L7RYZCL.mjs";export{a as DEFAULT_DESCRIPTION,c as run,b as slugRefused};
|
package/dist/chunk-E7VYDG2X.mjs
DELETED
|
@@ -1,2 +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 d,e as L}from"./chunk-A55HN5OK.mjs";L();import{isInstance as x}from"../browser/shared/components/index.mjs";import{mayHoldOldNames as A,newAttributeName as I,newAttributeValue as b,newScriptNames as N,newStyleNames as j}from"../browser/shared/old-names.mjs";var S=/^data-(?:report|doc)-(?:kit|vendor)$/;function q(o){if(typeof o!="string"||!A(o))return o;let O=d(o,{sourceCodeLocationInfo:!0}),c=[],u=(t,e,s)=>{o.slice(t,e)!==s&&c.push({start:t,end:e,text:s})};function g(t){let e=t.sourceCodeLocation?.attrs??{};for(let{name:n,value:y}of t.attrs){let r=e[n];if(!r)continue;let i=o.slice(r.startOffset,r.endOffset),f=i.indexOf("="),v=f<0?i:i.slice(0,f),m=f<0?"":i.slice(f),C=/^on/i.test(n)||/^\s*javascript:/i.test(y)?N(m):b(n,m,t.tagName);u(r.startOffset,r.endOffset,I(v)+C)}if(t.attrs.some(({name:n})=>S.test(n))||!["style","script"].includes(t.tagName))return;let s=t.childNodes?.[0]?.sourceCodeLocation;if(!s)return;let w=(t.attrs.find(({name:n})=>n==="type")?.value??"").trim().toLowerCase();if(t.tagName==="script"&&/json/.test(w))return;let p=o.slice(s.startOffset,s.endOffset);u(s.startOffset,s.endOffset,t.tagName==="style"?j(p):N(p))}let l=t=>{for(let e of t.childNodes??[])x(e)||(e.tagName&&g(e),l(e.tagName==="template"&&e.content?e.content:e))};if(l(O),!c.length)return o;c.sort((t,e)=>e.start-t.start);let a=o;for(let{start:t,end:e,text:s}of c)a=a.slice(0,t)+s+a.slice(e);return a}export{q as a};
|