diff --git a/.github/workflows/actions/quarto-dev/action.yml b/.github/workflows/actions/quarto-dev/action.yml index 4ebe2de411f..f8c11de9c5b 100644 --- a/.github/workflows/actions/quarto-dev/action.yml +++ b/.github/workflows/actions/quarto-dev/action.yml @@ -4,6 +4,15 @@ description: "Configures the image for Quarto Development" runs: using: "composite" steps: + - name: Cache deno std deps + uses: actions/cache@v3 + with: + path: ./src/resources/deno_std/cache + key: ${{ runner.os }}-deno_std-1-${{ hashFiles('./src/resources/deno_std/deno_std.lock', './package/scripts/deno_std/deno_std.ts') }} + restore-keys: | + ${{ runner.os }}-deno_std-1- + ${{ runner.os }}-deno_std- + - name: Configure Quarto (.sh) if: runner.os != 'Windows' shell: bash diff --git a/.github/workflows/performance-check.yml b/.github/workflows/performance-check.yml index d17abc05fce..9bee61446e9 100644 --- a/.github/workflows/performance-check.yml +++ b/.github/workflows/performance-check.yml @@ -27,9 +27,7 @@ jobs: echo "$HOME/bin" >> $GITHUB_PATH - name: Configure Quarto - shell: bash - run: | - ./configure.sh + uses: ./.github/workflows/actions/quarto-dev - name: Test Bundle id: create_bundle diff --git a/.github/workflows/test-bundle.yml b/.github/workflows/test-bundle.yml index 123149a7161..f6fa5f9c0e7 100644 --- a/.github/workflows/test-bundle.yml +++ b/.github/workflows/test-bundle.yml @@ -27,9 +27,7 @@ jobs: echo "$HOME/bin" >> $GITHUB_PATH - name: Configure Quarto - shell: bash - run: | - ./configure.sh + uses: ./.github/workflows/actions/quarto-dev - name: Test Bundle shell: bash diff --git a/.github/workflows/test-quarto-latexmk.yml b/.github/workflows/test-quarto-latexmk.yml index eeb3e89f0e2..3a95c5da15b 100644 --- a/.github/workflows/test-quarto-latexmk.yml +++ b/.github/workflows/test-quarto-latexmk.yml @@ -26,35 +26,29 @@ jobs: with: fetch-depth: 0 - - name: Test ${{ runner.os }} + - name: Configure Quarto + uses: ./.github/workflows/actions/quarto-dev + + - name: Test Windows if: runner.os == 'Windows' run: | - .\configure.cmd - package/dist/bin/quarto.cmd check - pwd cd package/src .\quarto-bld.cmd compile-quarto-latexmk --target x86_64-pc-windows-msvc --name tinitex tree ..\dist\bin /f /a cd ..\dist\bin\tinitex\x86_64-pc-windows-msvc .\tinitex.exe --help - - name: Test ${{ runner.os }} + - name: Test macOS if: runner.os == 'macOS' run: | - ./configure.sh - quarto check - pwd cd package/src ./quarto-bld compile-quarto-latexmk --target x86_64-apple-darwin --name tinitex ls -R ../dist/bin ../dist/bin/tinitex/x86_64-apple-darwin/tinitex --help - - name: Test ${{ runner.os }} + - name: Test Linux if: runner.os == 'Linux' run: | - ./configure.sh - quarto check - pwd cd package/src ./quarto-bld compile-quarto-latexmk --target x86_64-unknown-linux-gnu --name tinitex ls -R ../dist/bin diff --git a/.github/workflows/test-smokes.yml b/.github/workflows/test-smokes.yml index a7751275206..571a4faf818 100644 --- a/.github/workflows/test-smokes.yml +++ b/.github/workflows/test-smokes.yml @@ -42,8 +42,6 @@ jobs: - os: windows-latest time-test: true runs-on: ${{ matrix.os }} - env: - QUARTO_TESTS_FORCE_NO_PIPENV: true steps: - name: Checkout Repo uses: actions/checkout@v3 @@ -97,14 +95,17 @@ jobs: uses: actions/cache@v3 with: path: ${{ env.RENV_PATHS_ROOT }} - key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-1-${{ hashFiles('tests/renv.lock') }} + key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-2-${{ hashFiles('tests/renv.lock') }} restore-keys: | - ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-1- + ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-2- - name: Install missing system deps if: runner.os == 'Linux' run: | - sudo apt-get update -y && sudo apt-get install -y libcurl4-openssl-dev && sudo apt-get install -y libxml2-utils + sudo apt-get update -y + sudo apt-get install -y libcurl4-openssl-dev + sudo apt-get install -y libxml2-utils + sudo apt-get install -y libharfbuzz-dev libfribidi-dev - name: Restore R packages working-directory: tests @@ -113,11 +114,10 @@ jobs: renv::restore() # Install dev versions for our testing # Use r-universe to avoid github api calls - try(renv::install('knitr', repos = c('https://yihui.r-universe.dev'))) - try(renv::install('rmarkdown', repos = c('https://rstudio.r-universe.dev'))) + try(install.packages('knitr', repos = 'https://yihui.r-universe.dev')) + try(install.packages('rmarkdown', repos = 'https://rstudio.r-universe.dev')) shell: Rscript {0} env: - RENV_CONFIG_REPOS_OVERRIDE: https://packagemanager.rstudio.com/cran/latest GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - name: Set up Python @@ -131,7 +131,7 @@ jobs: working-directory: tests run: | python -m pip install pipenv - pipenv install --system + pipenv install - uses: ./.github/workflows/actions/quarto-dev diff --git a/.gitignore b/.gitignore index e57e4114246..426c62110bf 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,7 @@ win_configuration.bat src/resources/preview/quarto-preview.js .prettierrc.json _manuscript + +# generated by coverage tools +tests/docs/luacov/luacov.report.html +tests/docs/luacov/report.html diff --git a/.vscode/launch.json b/.vscode/launch.json index 5f1eb908ced..e6f8cbb2a48 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,8 +9,8 @@ "request": "launch", "type": "node", "program": "${workspaceFolder}/src/quarto.ts", - "args": ["render", "about.qmd"], - "cwd": "/Users/ct/Desktop/daily-log/2023/09/07/web", + "args": ["serve"], + "cwd": "${workspaceFolder}/../quarto-demo", "runtimeExecutable": "${workspaceFolder}/package/dist/bin/tools/deno", "runtimeArgs": [ "run", @@ -25,7 +25,7 @@ }, "attachSimplePort": 9229, "windows": { - "runtimeExecutable": "${workspaceFolder}\\package\\dist\\bin\\tools\\deno.exe" + "runtimeExecutable": "${workspaceFolder}\\package\\dist\\bin\\tools\\x86_64\\deno.exe" } }, { @@ -53,7 +53,7 @@ }, "attachSimplePort": 9229, "windows": { - "runtimeExecutable": "${workspaceFolder}\\package\\dist\\bin\\tools\\deno.exe" + "runtimeExecutable": "${workspaceFolder}\\package\\dist\\bin\\tools\\x86_64\\deno.exe" } } ] diff --git a/.vscode/settings.json b/.vscode/settings.json index cff03a9b38a..6c5d51ddb39 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,7 +3,8 @@ "editor.defaultFormatter": "denoland.vscode-deno" }, "[r]": { - "editor.formatOnSave": false + "editor.formatOnSave": false, + "editor.defaultFormatter": "REditorSupport.r" }, "[html]": { "editor.formatOnSave": false diff --git a/configuration b/configuration index c979e9a1be9..98fa3af55e7 100644 --- a/configuration +++ b/configuration @@ -10,15 +10,15 @@ # Binary dependencies export DENO=v1.33.4 export DENO_DOM=v0.1.35-alpha-artifacts -export PANDOC=3.1.7 +export PANDOC=3.1.8 export DARTSASS=1.55.0 export ESBUILD=0.18.15 -export TYPST=0.7.0 +export TYPST=0.8.0 # Bootstrap dependencies from bslib # (use commit hash from bslib repo) -export BOOTSTRAP=ff3e498179a066043ceb8f2cb3188f10d0d6ebc4 -export BOOTSTRAP_FONT=1.10.5 +export BOOTSTRAP=dba137ff7fa0b4ee9dfcd77d8982ce5dd7e7214d # 0.5.1 +export BOOTSTRAP_FONT=1.11.1 export BOOTSWATCH=5.3.1 # javascript HTML dependencies @@ -36,6 +36,7 @@ export LIST_JS=2.3.1 export DAY_JS=1.11.7 export ZENSCROLL_JS=4.0.2 export GITHUB_MARKDOWN_CSS=5.2.0 +export GLIGHTBOX_JS=3.2.0 # javascript search dependencies export AUTOCOMPLETE_JS=1.9.2 diff --git a/configure.cmd b/configure.cmd index 0666e0c2dd5..ccbbae63b81 100644 --- a/configure.cmd +++ b/configure.cmd @@ -25,7 +25,10 @@ if "%QUARTO_VENDOR_BINARIES%" == "true" ( ECHO Bootstrapping Deno... REM Download Deno - SET "DENO_FILE=deno-x86_64-pc-windows-msvc.zip" + SET DENO_ARCH_DIR=x86_64 + MKDIR !DENO_ARCH_DIR! + PUSHD !DENO_ARCH_DIR! + SET DENO_FILE=deno-!DENO_ARCH_DIR!-pc-windows-msvc.zip CURL --fail -L "https://github.com/denoland/deno/releases/download/!DENO!/!DENO_FILE!" -o "!DENO_FILE!" REM Windows doesn't have unzip installed by default, but starting in Windows 10 build 17063 they did REM include a build in 'tar' command. Windows 10 build 17063 was released in 2017. @@ -33,15 +36,15 @@ if "%QUARTO_VENDOR_BINARIES%" == "true" ( %WINDIR%/System32/tar -xf !DENO_FILE! REM If tar failed, try unzipping it. - IF %ERRORLEVEL% NEQ 0 ( + IF ERRORLEVEL 1 ( ECHO tar failed; trying to unzip... - unzip !DENO_FILE! + unzip -o !DENO_FILE! ) REM If both failed, exit with error. REM These blocks aren't nested because of the way Windows evaluates variables in control blocks; REM %ERRORLEVEL% won't update without jumping through more hoops in a nested if. - IF %ERRORLEVEL% NEQ 0 ( + IF ERRORLEVEL 1 ( ECHO Unable to decompress !DENO_FILE! exit 1 ) @@ -54,7 +57,8 @@ if "%QUARTO_VENDOR_BINARIES%" == "true" ( deno upgrade --canary --version %DENO_CANARY_COMMIT% ) - SET QUARTO_DENO=!QUARTO_BIN_PATH!\tools\deno.exe + SET QUARTO_DENO=!QUARTO_BIN_PATH!\tools\!DENO_ARCH_DIR!\deno.exe + POPD POPD ) diff --git a/dev-docs/lua-coverage-report.md b/dev-docs/lua-coverage-report.md index dc3e9cc8181..b436ea81d56 100644 --- a/dev-docs/lua-coverage-report.md +++ b/dev-docs/lua-coverage-report.md @@ -5,10 +5,7 @@ run the following commands: ```bash cd quarto-cli/tests -export QUARTO_LUACOV=`pwd`/luacov.stats.out -rm -f luacov.stats.out # to get a fresh report; otherwise it appends -./run-tests.sh -quarto render docs/luacov/report.qmd +./run-tests-with-luacov.sh ``` The report is an HTML file, and will be under `docs/luacov/luacov.report.html`. diff --git a/news/changelog-1.4.md b/news/changelog-1.4.md index 2c9e0ffdddb..fcdffad728e 100644 --- a/news/changelog-1.4.md +++ b/news/changelog-1.4.md @@ -32,17 +32,25 @@ - Add support for `body-right` and `body-left` layouts for Website Table of Contents ([#3473](https://github.com/quarto-dev/quarto-cli/issues/3473)) - ([#6430](https://github.com/quarto-dev/quarto-cli/issues/6430)): Fix layout issue with banner style title block authors when `page-layout: - ([#5955](https://github.com/quarto-dev/quarto-cli/issues/5955)): Correct HTML callout appearance when title isn't present. +- ([#6833](https://github.com/quarto-dev/quarto-cli/issues/6833)): Handle partially-specified aspect ratio, width, and height attributes in `video` shortcode. +- ([#6714](https://github.com/quarto-dev/quarto-cli/issues/6714)): Display title block for HTML when other (non-title/author/subtitle) metadata is present. +- ([#5210](https://github.com/quarto-dev/quarto-cli/issues/5210)): Update to Bootstrap 5.2.2 + +## Appendix + +- ([#6783](https://github.com/quarto-dev/quarto-cli/issues/6783)): Add additional CC licenses, improve link text ## RevealJS Format - ([#5546](https://github.com/quarto-dev/quarto-cli/issues/5546)): Images inside links can't be stretched, and so auto-stretch feature now ignores them. - ([#5783](https://github.com/quarto-dev/quarto-cli/issues/5783)): Ensure fenced code blocks work with line numbers. - ([#6120](https://github.com/quarto-dev/quarto-cli/issues/6120)): `pdf-max-pages-per-slide` is now correctly setting [`pdfMaxPagesPerSlide` config](https://revealjs.com/pdf-export/#page-size) for RevealJS. -- ([#5210](https://github.com/quarto-dev/quarto-cli/issues/5210)): Update to Bootstrap 5.2.2 +- ([#6827](https://github.com/quarto-dev/quarto-cli/issues/6120)): Correctly layout callout in revealjs slides when changing appearance. ## PDF Format - ([#5969](https://github.com/quarto-dev/quarto-cli/issues/5969)): Correctly detect a required rerun for biblatex when using backref link options. +- ([#6907](https://github.com/quarto-dev/quarto-cli/issues/6907)): Fix issue with footnote mark line processor not triggering. ## Docusaurus Format @@ -72,6 +80,10 @@ - ([#5742](https://github.com/quarto-dev/quarto-cli/issues/5742)): Use any element to compute a description for the listing, even when there are no paragraphs. - ([#4800](https://github.com/quarto-dev/quarto-cli/issues/4800)): Add support for including an `xml-stylesheet` in listings. Use the `xml-stylesheet: example.xsl` under `feed:` to provide a path to an XSL style sheet to style your RSS feed. - ([#6777](https://github.com/quarto-dev/quarto-cli/issues/6777)): Add support for complex fields like `citaiton.container-title` when includes custom fields in listings. +- ([#6706](https://github.com/quarto-dev/quarto-cli/issues/6706)): If there is no text displayed for external links in navigation items (navbar, sidebar), display the href value as the text. +- ([#6903](https://github.com/quarto-dev/quarto-cli/issues/6903)): Don't display the `path` field for external paths provided in metadata files. +- ([#5463](https://github.com/quarto-dev/quarto-cli/issues/5463)): Error if the `contents` of a listing match no items. +- ([#6904](https://github.com/quarto-dev/quarto-cli/issues/6904)): Within feeds, remove `index.html` from urls which shouldn't include it. ## Websites @@ -121,6 +133,8 @@ ## Knitr - ([#4735](https://github.com/quarto-dev/quarto-cli/pull/4735)): Special `verbatim` and `embed` language engine for knitr's chunk are now better supported, including with special quarto cell option like `echo: fenced`. +- ([#6775](https://github.com/quarto-dev/quarto-cli/pull/6775)): Avoid duplicating special internal `tools:quarto` R environment used for making `ojs_define()` accessible during knitting. +- ([#6792](https://github.com/quarto-dev/quarto-cli/issues/6792)): `fig-asp` provided at YAML config level now correctly work to set `fig.asp` chunk option in **knitr**. ## OJS engine @@ -149,6 +163,8 @@ - ([#6211](https://github.com/quarto-dev/quarto-cli/pull/6211)): Improve error message when a JSON filter (or a potentially misspelled Lua filter from an extension) is not found. - ([#6215](https://github.com/quarto-dev/quarto-cli/issues/6215)): Add `quarto.utils.string_to_inlines` and `quarto.utils.string_to_blocks` to Lua API to convert a string to a list of inlines or blocks taking into account quarto's AST structure. - ([#6289](https://github.com/quarto-dev/quarto-cli/issues/6289)): allow `markdownToInlines` to take empty string. +- ([#6935](https://github.com/quarto-dev/quarto-cli/issues/6935)): render callouts to `gfm` using GitHub's syntax. +- ([#6935](https://github.com/quarto-dev/quarto-cli/issues/6935)): Add isGithubMarkdownOutput() to quarto.format API. ## Debian Installer @@ -159,6 +175,10 @@ - ([#6766](https://github.com/quarto-dev/quarto-cli/issues/6766)): Add `id` as valid CSL property when specifying a documents citation metadata. +## Crossrefs + +- ([#6620](https://github.com/quarto-dev/quarto-cli/issues/6620)): Introduce `FloatRefTarget` AST nodes that generalize crossref targets to include figures, tables, and custom floating elements. + ## Other Fixes and Improvements - ([#2214](https://github.com/quarto-dev/quarto-cli/issues/2214), reopened): don't report a non-existing version of Google Chrome in macOS. @@ -179,6 +199,10 @@ - ([#6487](https://github.com/quarto-dev/quarto-cli/discussions/6487)): Fix `serviceworkers` check in `htmlDependency` to look at the correct key. - ([#6178](https://github.com/quarto-dev/quarto-cli/pull/6178)): When `QUARTO_LOG_LEVEL=DEBUG`, information about search for a R binary will be shown. - ([#5755](https://github.com/quarto-dev/quarto-cli/pull/5755)): Allow document metadata to control conditional content. +- ([#6620](https://github.com/quarto-dev/quarto-cli/pull/6620)): Rewrite Crossreferenceable figure support. See the [prerelease documentation](https://quarto.org/docs/prerelease/1.4/) for more information. - ([#6697](https://github.com/quarto-dev/quarto-cli/pull/6697)): Fix issue with outputing to stdout (`quarto render -o -`) on Windows. - ([#6705](https://github.com/quarto-dev/quarto-cli/pull/6705)): Fix issue with gfm output being removed when rendered with other formats. - ([#6746](https://github.com/quarto-dev/quarto-cli/issues/6746)): Let stdout and stderr finish independently to avoid deadlock. +- ([#6807](https://github.com/quarto-dev/quarto-cli/pull/6807)): Improve sourcemapping reference cleanup in generated CSS files. +- ([#6825](https://github.com/quarto-dev/quarto-cli/issues/6825)): Show filename when YAML parsing error occurs. +- ([#6836](https://github.com/quarto-dev/quarto-cli/issues/6836)): Fix missing `docx` format for `abstract` key in reference schema. diff --git a/package/scripts/linux/deb/postrm b/package/scripts/linux/deb/postrm index 6c93866e61d..dd4d2c2c025 100755 --- a/package/scripts/linux/deb/postrm +++ b/package/scripts/linux/deb/postrm @@ -7,6 +7,13 @@ rm -f /usr/local/bin/quarto else rm -f ~/bin/quarto fi -rm -f /opt/quarto/bin/tools/pandoc -exit 0 \ No newline at end of file +# Remove pandoc symlink created by postinst +# (before 1.4 this was a regular file that shouldn't be removed here) +pandoc=/opt/quarto/bin/tools/pandoc +if [ -h "$pandoc" ] +then + rm -f "$pandoc" +fi + +exit 0 diff --git a/package/scripts/windows/quarto.cmd b/package/scripts/windows/quarto.cmd index 236f8d7022f..a5dcb0e9c65 100644 --- a/package/scripts/windows/quarto.cmd +++ b/package/scripts/windows/quarto.cmd @@ -91,7 +91,7 @@ IF DEFINED QUARTO_DENO_DOM ( ) IF NOT DEFINED QUARTO_DENO ( - set "QUARTO_DENO=!SCRIPT_PATH!\tools\deno.exe" + set "QUARTO_DENO=!SCRIPT_PATH!\tools\x86_64\deno.exe" ) SET "DENO_TLS_CA_STORE=system,mozilla" diff --git a/package/src/common/configure.ts b/package/src/common/configure.ts index 9bd7a7a5ed6..3bddb890225 100644 --- a/package/src/common/configure.ts +++ b/package/src/common/configure.ts @@ -46,10 +46,12 @@ export async function configure( } } + info("Building quarto-preview.js..."); const result = buildQuartoPreviewJs(config.directoryInfo.src); if (!result.success) { throw new Error(); } + info("Build completed."); // Move the quarto script into place info("Placing Quarto script"); diff --git a/package/src/common/update-html-dependencies.ts b/package/src/common/update-html-dependencies.ts index c4aa57b7413..23955c66fb6 100644 --- a/package/src/common/update-html-dependencies.ts +++ b/package/src/common/update-html-dependencies.ts @@ -1,9 +1,8 @@ /* -* bootstrap.ts -* -* Copyright (C) 2020-2022 Posit Software, PBC -* -*/ + * bootstrap.ts + * + * Copyright (C) 2020-2022 Posit Software, PBC + */ import { ensureDir, ensureDirSync, existsSync } from "fs/mod.ts"; import { copySync } from "fs/copy.ts"; import { info } from "log/mod.ts"; @@ -16,6 +15,7 @@ import { download, unzip } from "../util/utils.ts"; import { Configuration } from "./config.ts"; import { visitLines } from "../../../src/core/file.ts"; import { copyMinimal } from "../../../src/core/copy.ts"; +import { kSourceMappingRegexes } from "../../../src/config/constants.ts"; export async function updateHtmlDependencies(config: Configuration) { info("Updating Bootstrap with version info:"); @@ -39,34 +39,22 @@ export async function updateHtmlDependencies(config: Configuration) { config.directoryInfo.src, "resources", "formats", - "html", + "html" ); - const bsDir = join( - formatDir, - "bootstrap", - ); + const bsDir = join(formatDir, "bootstrap"); - const bsThemesDir = join( - bsDir, - "themes", - ); + const bsThemesDir = join(bsDir, "themes"); - const bsDistDir = join( - bsDir, - "dist", - ); + const bsDistDir = join(bsDir, "dist"); // For applying git patch to what we retreive - const patchesDir = join( - config.directoryInfo.pkg, - "src", "common", "patches" - ) - - function resolvePatches (patches: string[]) { - return patches.map(patch => { - return join(patchesDir, patch) - }) + const patchesDir = join(config.directoryInfo.pkg, "src", "common", "patches"); + + function resolvePatches(patches: string[]) { + return patches.map((patch) => { + return join(patchesDir, patch); + }); } // Anchor @@ -75,7 +63,7 @@ export async function updateHtmlDependencies(config: Configuration) { "ANCHOR_JS", "anchor-js", "anchor.min.js", - anchorJs, + anchorJs ); cleanSourceMap(anchorJs); @@ -85,7 +73,7 @@ export async function updateHtmlDependencies(config: Configuration) { "POPPER_JS", "@popperjs/core", "dist/umd/popper.min.js", - popperJs, + popperJs ); cleanSourceMap(popperJs); @@ -100,10 +88,10 @@ export async function updateHtmlDependencies(config: Configuration) { // Copy the js file Deno.copyFileSync( join(dir, `clipboard.js-${version}`, "dist", "clipboard.min.js"), - clipboardJs, + clipboardJs ); return Promise.resolve(); - }, + } ); cleanSourceMap(clipboardJs); @@ -113,7 +101,7 @@ export async function updateHtmlDependencies(config: Configuration) { config.directoryInfo.src, "resources", "library", - "dayjs", + "dayjs" ); await updateGithubSourceCodeDependency( "dayjs", @@ -121,12 +109,7 @@ export async function updateHtmlDependencies(config: Configuration) { "DAY_JS", workingDir, async (dir: string, version: string) => { - const sourceDir = join( - dir, - `dayjs-${version}`, - "src", - "locale", - ); + const sourceDir = join(dir, `dayjs-${version}`, "src", "locale"); const targetDir = join(dayJsDir, "locale"); ensureDirSync(targetDir); @@ -134,10 +117,7 @@ export async function updateHtmlDependencies(config: Configuration) { for (const file of files) { const targetFile = join(targetDir, file.name); // Move the file - Deno.copyFileSync( - join(sourceDir, file.name), - targetFile, - ); + Deno.copyFileSync(join(sourceDir, file.name), targetFile); // Fixup the file to remove these lines const ignore = [ @@ -157,7 +137,7 @@ export async function updateHtmlDependencies(config: Configuration) { Deno.writeTextFileSync(targetFile, output.join("\n")); } - }, + } ); // Tippy @@ -166,7 +146,7 @@ export async function updateHtmlDependencies(config: Configuration) { "TIPPY_JS", "tippy.js", "dist/tippy.umd.min.js", - tippyUmdJs, + tippyUmdJs ); cleanSourceMap(tippyUmdJs); @@ -177,7 +157,7 @@ export async function updateHtmlDependencies(config: Configuration) { "projects", "website", "listing", - "list.min.js", + "list.min.js" ); await updateGithubSourceCodeDependency( "listjs", @@ -189,10 +169,10 @@ export async function updateHtmlDependencies(config: Configuration) { // Copy the js file Deno.copyFileSync( join(dir, `list.js-${version}`, "dist", "list.min.js"), - listJs, + listJs ); return Promise.resolve(); - }, + } ); // Zenscroll @@ -207,10 +187,10 @@ export async function updateHtmlDependencies(config: Configuration) { // Copy the js file Deno.copyFileSync( join(dir, `zenscroll-${version}`, "zenscroll-min.js"), - zenscrollJs, + zenscrollJs ); return Promise.resolve(); - }, + } ); // Tippy @@ -219,10 +199,46 @@ export async function updateHtmlDependencies(config: Configuration) { "TIPPY_JS", "tippy.js", "dist/tippy.css", - tippyCss, + tippyCss ); cleanSourceMap(tippyCss); + // Glightbox + const glightboxDir = join(formatDir, "glightbox"); + const glightBoxVersion = Deno.env.get("GLIGHTBOX_JS");; + + info("Updating gloghtbox"); + const basename = `glightbox-master`; + const fileName = `${basename}.zip`; + const distUrl = `https://github.com/biati-digital/glightbox/releases/download/${glightBoxVersion}/${fileName}`; + const zipFile = join(workingDir, fileName); + + // Download and unzip the release + const glightboxWorking = join(workingDir, "glightbox-master"); + ensureDirSync(glightboxWorking); + + info(`Downloading ${distUrl}`); + await download(distUrl, zipFile); + await unzip(zipFile, glightboxWorking); + + // Remove extraneous files + [ + { + from: join("dist", "js", "glightbox.min.js"), + to: "glightbox.min.js", + }, + { + from: join("dist", "css", "glightbox.min.css"), + to: "glightbox.min.css", + }, + ].forEach((depends) => { + // Copy the js file + Deno.copyFileSync( + join(glightboxWorking, depends.from), + join(glightboxDir, depends.to) + ); + }); + // Fuse const fuseJs = join( config.directoryInfo.src, @@ -230,7 +246,7 @@ export async function updateHtmlDependencies(config: Configuration) { "projects", "website", "search", - "fuse.min.js", + "fuse.min.js" ); await updateGithubSourceCodeDependency( "fusejs", @@ -242,10 +258,10 @@ export async function updateHtmlDependencies(config: Configuration) { ensureDirSync(dirname(fuseJs)); Deno.copyFileSync( join(dir, `Fuse-${version}`, "dist", "fuse.min.js"), - fuseJs, + fuseJs ); return Promise.resolve(); - }, + } ); cleanSourceMap(fuseJs); @@ -255,7 +271,7 @@ export async function updateHtmlDependencies(config: Configuration) { "resources", "formats", "revealjs", - "reveal", + "reveal" ); await updateGithubSourceCodeDependency( @@ -287,12 +303,12 @@ export async function updateHtmlDependencies(config: Configuration) { info("Copying plugin/"); copySync( join(dir, `reveal.js-${version}`, "plugin"), - join(revealJs, "plugin"), + join(revealJs, "plugin") ); return Promise.resolve(); }, true, - false, + false ); // revealjs-chalkboard @@ -302,7 +318,7 @@ export async function updateHtmlDependencies(config: Configuration) { "formats", "revealjs", "plugins", - "chalkboard", + "chalkboard" ); await updateGithubSourceCodeDependency( "reveal.js-chalkboard", @@ -313,11 +329,11 @@ export async function updateHtmlDependencies(config: Configuration) { ensureDirSync(dirname(revealJsChalkboard)); copyMinimal( join(dir, `reveal.js-plugins-${version}`, "chalkboard"), - revealJsChalkboard, + revealJsChalkboard ); return Promise.resolve(); }, - true, // not a commit + true // not a commit ); // revealjs-menu @@ -327,7 +343,7 @@ export async function updateHtmlDependencies(config: Configuration) { "formats", "revealjs", "plugins", - "menu", + "menu" ); await updateGithubSourceCodeDependency( "reveal.js-menu", @@ -338,29 +354,28 @@ export async function updateHtmlDependencies(config: Configuration) { // Copy the js file (modify to disable loadResource) ensureDirSync(revealJsMenu); const menuJs = Deno.readTextFileSync( - join(dir, `reveal.js-menu-${version}`, "menu.js"), - ) - .replace( - /function P\(e,t,n\).*?function M/, - "function P(e,t,n){n.call()}function M", - ); + join(dir, `reveal.js-menu-${version}`, "menu.js") + ).replace( + /function P\(e,t,n\).*?function M/, + "function P(e,t,n){n.call()}function M" + ); Deno.writeTextFileSync(join(revealJsMenu, "menu.js"), menuJs); // copy the css file Deno.copyFileSync( join(dir, `reveal.js-menu-${version}`, "menu.css"), - join(revealJsMenu, "menu.css"), + join(revealJsMenu, "menu.css") ); // copy font-awesome to chalkboard copyMinimal( join(dir, `reveal.js-menu-${version}`, "font-awesome"), - join(revealJsChalkboard, "font-awesome"), + join(revealJsChalkboard, "font-awesome") ); return Promise.resolve(); }, false, // not a commit - false, // no v prefix + false // no v prefix ); // reveal-pdfexport @@ -370,7 +385,7 @@ export async function updateHtmlDependencies(config: Configuration) { "formats", "revealjs", "plugins", - "pdfexport", + "pdfexport" ); await updateGithubSourceCodeDependency( @@ -382,14 +397,14 @@ export async function updateHtmlDependencies(config: Configuration) { ensureDirSync(revealJsPdfExport); Deno.copyFileSync( join(dir, `reveal-pdfexport-${version}`, "pdfexport.js"), - join(revealJsPdfExport, "pdfexport.js"), + join(revealJsPdfExport, "pdfexport.js") ); return Promise.resolve(); }, false, // not a commit false, // no v prefix, resolvePatches([ - "0001-Patch-PdfExport-RevealJS-plugin-to-export-toggle-fun.patch" + "0001-Patch-PdfExport-RevealJS-plugin-to-export-toggle-fun.patch", ]) ); @@ -399,7 +414,7 @@ export async function updateHtmlDependencies(config: Configuration) { "resources", "formats", "gfm", - "github-markdown-css", + "github-markdown-css" ); await updateGithubSourceCodeDependency( "github-markdown-css", @@ -417,11 +432,11 @@ export async function updateHtmlDependencies(config: Configuration) { // Copy the js file Deno.copyFileSync( join(dir, `github-markdown-css-${version}`, file), - join(ghCSS, file), + join(ghCSS, file) ); }); return Promise.resolve(); - }, + } ); // Autocomplete @@ -431,13 +446,13 @@ export async function updateHtmlDependencies(config: Configuration) { "projects", "website", "search", - "autocomplete.umd.js", + "autocomplete.umd.js" ); await updateUnpkgDependency( "AUTOCOMPLETE_JS", "@algolia/autocomplete-js", "dist/umd/index.production.js", - autocompleteJs, + autocompleteJs ); cleanSourceMap(autocompleteJs); @@ -448,21 +463,18 @@ export async function updateHtmlDependencies(config: Configuration) { "projects", "website", "search", - "autocomplete-preset-algolia.umd.js", + "autocomplete-preset-algolia.umd.js" ); await updateUnpkgDependency( "AUTOCOMPLETE_JS", "@algolia/autocomplete-preset-algolia", "dist/umd/index.production.js", - autocompletePresetJs, + autocompletePresetJs ); cleanSourceMap(autocompletePresetJs); // Update PDF JS - await updatePdfJs( - config, - workingDir, - ); + await updatePdfJs(config, workingDir); // Cookie-Consent await updateCookieConsent(config, "4.0.0", workingDir); @@ -486,13 +498,9 @@ export async function updateHtmlDependencies(config: Configuration) { bsCommit, workingSubDir("bsdist"), bsDistDir, - bsThemesDir, - ); - await updateBoostrapIcons( - bsIconVersion, - workingSubDir("bsicons"), - bsDistDir, + bsThemesDir ); + await updateBoostrapIcons(bsIconVersion, workingSubDir("bsicons"), bsDistDir); // Update Pandoc themes await updatePandocHighlighting(config); @@ -505,23 +513,16 @@ export async function updateHtmlDependencies(config: Configuration) { } catch (_err) { info(`Folder not deleted - Remove manually: ${workingDir}`); } - info( - "\n** Done- please commit any files that have been updated. **\n", - ); - + info("\n** Done- please commit any files that have been updated. **\n"); } -async function updatePdfJs( - config: Configuration, - working: string, -) { +async function updatePdfJs(config: Configuration, working: string) { const version = Deno.env.get("PDF_JS"); info("Updating pdf.js..."); const basename = `pdfjs-${version}-legacy-dist`; const fileName = `${basename}.zip`; - const distUrl = - `https://github.com/mozilla/pdf.js/releases/download/v${version}/${fileName}`; + const distUrl = `https://github.com/mozilla/pdf.js/releases/download/v${version}/${fileName}`; const zipFile = join(working, fileName); // Download and unzip the release @@ -542,7 +543,7 @@ async function updatePdfJs( "resources", "formats", "pdf", - "pdfjs", + "pdfjs" ); copySync(from, to, { overwrite: true }); info("Done\n"); @@ -551,7 +552,7 @@ async function updatePdfJs( async function updateCookieConsent( config: Configuration, version: string, - working: string, + working: string ) { const fileName = "cookie-consent.js"; const url = `https://www.cookieconsent.com/releases/${version}/${fileName}`; @@ -565,7 +566,7 @@ async function updateCookieConsent( "resources", "projects", "website", - "cookie-consent", + "cookie-consent" ); await ensureDir(targetDir); @@ -576,7 +577,7 @@ async function updateBootstrapFromBslib( commit: string, working: string, distDir: string, - themesDir: string, + themesDir: string ) { info("Updating Bootstrap Scss Files..."); await withRepo( @@ -595,7 +596,7 @@ async function updateBootstrapFromBslib( // Fix up the Boostrap rules files info( - "Rewriting bootstrap.scss to exclude functions, mixins, and variables.", + "Rewriting bootstrap.scss to exclude functions, mixins, and variables." ); const bootstrapFilter = [ '@import "functions";', @@ -604,27 +605,30 @@ async function updateBootstrapFromBslib( ]; const bootstrapScssFile = join(to, "bootstrap.scss"); const bootstrapScssContents = lines( - Deno.readTextFileSync(bootstrapScssFile), - ).filter((line: string) => { - return !bootstrapFilter.includes(line); - }).join("\n"); + Deno.readTextFileSync(bootstrapScssFile) + ) + .filter((line: string) => { + return !bootstrapFilter.includes(line); + }) + .join("\n"); Deno.writeTextFileSync(bootstrapScssFile, bootstrapScssContents); info("done."); info(""); - // Rewrite the use of css `var()` style values to base SCSS values - info( - "Rewriting _variables.scss file.", - ); + info("Rewriting _variables.scss file."); const bootstrapVariablesFile = join(to, "_variables.scss"); - const varContents = lines( - Deno.readTextFileSync(bootstrapVariablesFile), - ); + const varContents = lines(Deno.readTextFileSync(bootstrapVariablesFile)); const outLines: string[] = []; for (let line of varContents) { - line = line.replace("var(--#{$prefix}font-sans-serif)", "$font-family-sans-serif"); - line = line.replace("var(--#{$prefix}font-monospace)", "$font-family-monospace"); + line = line.replace( + "var(--#{$prefix}font-sans-serif)", + "$font-family-sans-serif" + ); + line = line.replace( + "var(--#{$prefix}font-monospace)", + "$font-family-monospace" + ); line = line.replace(/var\(--#\{\$prefix\}(.*)\)/, "$$$1"); outLines.push(line); } @@ -632,7 +636,6 @@ async function updateBootstrapFromBslib( info("done."); info(""); - // Copy utils info("Copying scss files"); const utilsFrom = join(repo.dir, "inst", "sass-utils"); @@ -651,24 +654,20 @@ async function updateBootstrapFromBslib( from: "bootstrap.bundle.min.js.map", to: "bootstrap.min.js.map", }, - ] - .forEach((file) => { - const from = join( - repo.dir, - "inst", - "lib", - "bs5", - "dist", - "js", - file.from, - ); - const to = join(distDir, file.to); - info(`Copying ${from} to ${to}`); - Deno.copyFileSync( - from, - to, - ); - }); + ].forEach((file) => { + const from = join( + repo.dir, + "inst", + "lib", + "bs5", + "dist", + "js", + file.from + ); + const to = join(distDir, file.to); + info(`Copying ${from} to ${to}`); + Deno.copyFileSync(from, to); + }); // Merge the bootswatch themes info("Merging themes:"); @@ -685,7 +684,7 @@ async function updateBootstrapFromBslib( join(themeDir, "_functions.scss"), join(themeDir, "_variables.scss"), join(themeDir, "_mixins.scss"), - join(themeDir, "_bootswatch.scss"), + join(themeDir, "_bootswatch.scss") ); const patchedScss = patchTheme(theme, layer); @@ -695,20 +694,19 @@ async function updateBootstrapFromBslib( } } info("Done\n"); - }, + } ); } async function updateBoostrapIcons( version: string, working: string, - distDir: string, + distDir: string ) { info("Updating Bootstrap Icons..."); const dirName = `bootstrap-icons-${version}`; const fileName = `${dirName}.zip`; - const distUrl = - `https://github.com/twbs/icons/releases/download/v${version}/${fileName}`; + const distUrl = `https://github.com/twbs/icons/releases/download/v${version}/${fileName}`; const zipFile = join(working, fileName); // Download and unzip the release @@ -718,15 +716,15 @@ async function updateBoostrapIcons( // Copy the woff file Deno.copyFileSync( - join(working, dirName, "font", "fonts", "bootstrap-icons.woff"), - join(distDir, "bootstrap-icons.woff"), + join(working, dirName, "fonts", "bootstrap-icons.woff"), + join(distDir, "bootstrap-icons.woff") ); // Copy the css file, then fix it up const cssPath = join(distDir, "bootstrap-icons.css"); Deno.copyFileSync( - join(working, dirName, "font", "bootstrap-icons.css"), - cssPath, + join(working, dirName, "bootstrap-icons.css"), + cssPath ); fixupFontCss(cssPath); @@ -740,9 +738,10 @@ async function updatePandocHighlighting(config: Configuration) { config.directoryInfo.src, "resources", "pandoc", - "highlight-styles", + "highlight-styles" ); - const pandoc = Deno.env.get("QUARTO_PANDOC") || + const pandoc = + Deno.env.get("QUARTO_PANDOC") || join(config.directoryInfo.bin, "tools", "pandoc"); // List the styles @@ -765,7 +764,7 @@ async function updatePandocHighlighting(config: Configuration) { const themeData = themeResult.stdout; await Deno.writeTextFile( join(highlightDir, `${style}.theme`), - themeData, + themeData ); } } @@ -778,7 +777,7 @@ async function updateUnpkgDependency( versionEnvVar: string, pkg: string, filename: string, - target: string, + target: string ) { const version = Deno.env.get(versionEnvVar); if (version) { @@ -834,7 +833,7 @@ async function updateGithubSourceCodeDependency( `https://github.com/${repo}/archive`, commit ? `${version}.zip` - : `refs/tags/${vPrefix ? "v" : ""}${version}.zip`, + : `refs/tags/${vPrefix ? "v" : ""}${version}.zip` ); const zipFile = join(working, fileName); @@ -844,7 +843,7 @@ async function updateGithubSourceCodeDependency( await unzip(zipFile, working); await onDownload(working, version); - if (patches) await applyGitPatches(patches) + if (patches) await applyGitPatches(patches); } else { throw new Error(`${versionEnvVar} is not defined`); } @@ -875,7 +874,9 @@ function cleanSourceMap(path: string) { const source = Deno.readTextFileSync(path); Deno.writeTextFileSync( path, - source.replaceAll(/^\/\/#\s*sourceMappingURL\=.*\.map$/gm, ""), + source + .replaceAll(kSourceMappingRegexes[0], "") + .replaceAll(kSourceMappingRegexes[1], "") ); } } @@ -884,22 +885,27 @@ function mergedSassLayer( funcPath: string, defaultsPath: string, mixinsPath: string, - rulesPath: string, + rulesPath: string ) { const merged: string[] = []; - [{ - name: "functions", - path: funcPath, - }, { - name: "defaults", - path: defaultsPath, - }, { - name: "mixins", - path: mixinsPath, - }, { - name: "rules", - path: rulesPath, - }].forEach((part) => { + [ + { + name: "functions", + path: funcPath, + }, + { + name: "defaults", + path: defaultsPath, + }, + { + name: "mixins", + path: mixinsPath, + }, + { + name: "rules", + path: rulesPath, + }, + ].forEach((part) => { const contents = existsSync(part.path) ? Deno.readTextFileSync(part.path) : undefined; @@ -939,7 +945,7 @@ function patchTheme(themeName: string, themeContents: string) { patchedTheme = patchedTheme.replace(patch.from, patch.to); } else { throw Error( - `Unable to patch template ${themeName} because the target ${patch.from} cannot be found`, + `Unable to patch template ${themeName} because the target ${patch.from} cannot be found` ); } }); @@ -955,25 +961,28 @@ interface ThemePatch { } const themePatches: Record = { - "litera": [ + litera: [ { from: ".navbar {\n font-size: $font-size-sm;", - to: - ".navbar {\n font-size: $font-size-sm;\n border: 1px solid rgba(0, 0, 0, .1);", + to: ".navbar {\n font-size: $font-size-sm;\n border: 1px solid rgba(0, 0, 0, .1);", + }, + ], + lumen: [ + { + from: ".navbar {\n @include shadow();", + to: ".navbar {\n @include shadow();\n border-color: shade-color($navbar-bg, 10%);", + }, + ], + simplex: [ + { + from: ".navbar {\n border-style: solid;\n border-width: 1px;", + to: ".navbar {\n border-width: 1px;\n border-style: solid;\n border-color: shade-color($navbar-bg, 13%);", + }, + ], + solar: [ + { + from: "$body-color: $gray-600 !default;", + to: "$body-color: $gray-500 !default;", }, ], - "lumen": [{ - from: ".navbar {\n @include shadow();", - to: - ".navbar {\n @include shadow();\n border-color: shade-color($navbar-bg, 10%);", - }], - "simplex": [{ - from: ".navbar {\n border-style: solid;\n border-width: 1px;", - to: - ".navbar {\n border-width: 1px;\n border-style: solid;\n border-color: shade-color($navbar-bg, 13%);", - }], - "solar": [{ - from: "$body-color: $gray-600 !default;", - to: "$body-color: $gray-500 !default;", - }], }; diff --git a/package/src/quarto-bld.cmd b/package/src/quarto-bld.cmd index 9a24ef35b68..593344a5b2f 100644 --- a/package/src/quarto-bld.cmd +++ b/package/src/quarto-bld.cmd @@ -4,7 +4,7 @@ if NOT DEFINED WIN_CONFIG_TRANSLATED call %~dp0\store_win_configuration.bat call %~dp0\..\..\win_configuration.bat if NOT DEFINED QUARTO_DENO ( - SET QUARTO_DENO=%~dp0\..\dist\bin\tools\deno.exe + SET QUARTO_DENO=%~dp0\..\dist\bin\tools\x86_64\deno.exe ) SET "RUST_BACKTRACE=full" SET "DENO_NO_UPDATE_CHECK=1" diff --git a/package/src/util/tar.ts b/package/src/util/tar.ts index f933a7669cd..cd1a19d41da 100644 --- a/package/src/util/tar.ts +++ b/package/src/util/tar.ts @@ -6,8 +6,7 @@ */ import { info } from "log/mod.ts"; -import { dirname } from "path/mod.ts"; -import { extname } from "../../../src/vendor/deno.land/std@0.185.0/path/win32.ts"; +import { dirname, extname } from "path/mod.ts"; export async function makeTarball( input: string, diff --git a/src/command/render/filters.ts b/src/command/render/filters.ts index 3ed9766a343..dc2b44c776f 100644 --- a/src/command/render/filters.ts +++ b/src/command/render/filters.ts @@ -20,6 +20,7 @@ import { kFigEnv, kFigPos, kFigResponsive, + kFormatIdentifier, kHeaderIncludes, kHtmlMathMethod, kIncludeAfter, @@ -97,6 +98,8 @@ const kQuartoVersion = "quarto-version"; const kQuartoSource = "quarto-source"; +const kQuartoCustomFormat = "quarto-custom-format"; + export async function filterParamsJson( args: string[], options: PandocOptions, @@ -127,6 +130,10 @@ export async function filterParamsJson( defaults, ); + const customFormatParams = extractCustomFormatParams( + options.format.metadata, + ); + const params: Metadata = { ...includes, ...initFilterParams(dependenciesFile), @@ -141,6 +148,7 @@ export async function filterParamsJson( ...jatsFilterParams(options), ...notebookContextFilterParams(options), ...filterParams, + ...customFormatParams, [kResultsFile]: pandocMetadataPath(resultsFile), [kTimingFile]: pandocMetadataPath(timingFile), [kQuartoFilters]: filterSpec, @@ -149,6 +157,7 @@ export async function filterParamsJson( crossref: crossrefFilterActive(options), jats_subarticle: options.format.metadata[kJatsSubarticle], }, + [kFormatIdentifier]: options.format.identifier, }; return JSON.stringify(params); } @@ -161,6 +170,21 @@ export function quartoMainFilter() { return resourcePath("filters/main.lua"); } +function extractCustomFormatParams( + metadata: Metadata, +) { + // pull out custom format spec if provided + const customFormatParams = metadata[kQuartoCustomFormat]; + if (customFormatParams) { + delete metadata[kQuartoCustomFormat]; + return { + [kQuartoCustomFormat]: customFormatParams, + }; + } else { + return {}; + } +} + function extractFilterSpecParams( metadata: Metadata, ) { @@ -752,7 +776,7 @@ async function resolveFilterExtension( typeof (filter) === "string" && !existsSync(filter) ) { - let extensions = await options.services.extension?.find( + const extensions = await options.services.extension?.find( filter, options.source, "filters", @@ -761,16 +785,27 @@ async function resolveFilterExtension( ) || []; // Filter this list of extensions - extensions = filterExtensions(extensions || [], filter, "filter"); + const filteredExtensions = filterExtensions( + extensions || [], + filter, + "filter", + ); // Return any contributed plugins - if (extensions.length > 0) { + if (filteredExtensions.length > 0) { + // This matches an extension, use the contributed filters const filters = extensions[0].contributes.filters; if (filters) { return filters; } else { return filter; } + } else if (extensions.length > 0) { + // There was a matching extension with this name, but + // it was filtered out, just hide the filter altogether + return []; } else { + // There were no extensions matching this name, just allow it + // through return filter; } } else { diff --git a/src/command/render/pandoc-html.ts b/src/command/render/pandoc-html.ts index 517dd1ca73f..b7e786fa502 100644 --- a/src/command/render/pandoc-html.ts +++ b/src/command/render/pandoc-html.ts @@ -21,6 +21,8 @@ import { TempContext } from "../../core/temp.ts"; import { cssImports, cssResources } from "../../core/css.ts"; import { compileSass } from "../../core/sass.ts"; +import { kSourceMappingRegexes } from "../../config/constants.ts"; + import { kQuartoHtmlDependency } from "../../format/html/format-html-constants.ts"; import { kAbbrevs, @@ -411,7 +413,10 @@ function processCssIntoExtras( ): CSSResult { extras.html = extras.html || {}; const css = Deno.readTextFileSync(cssPath).replaceAll( - kSourceMappingRegex, + kSourceMappingRegexes[0], + "", + ).replaceAll( + kSourceMappingRegexes[1], "", ); @@ -473,7 +478,6 @@ function processCssIntoExtras( } const kVariablesRegex = /\/\*\! quarto-variables-start \*\/([\S\s]*)\/\*\! quarto-variables-end \*\//g; -const kSourceMappingRegex = /\/\*\# sourceMappingURL=.* \*\//g; // Attributes for the style tag // Note that we default disable the dark mode and rely on JS to enable it diff --git a/src/command/use/commands/binder/binder-utils.ts b/src/command/use/commands/binder/binder-utils.ts index b72590491d5..640c8116e3d 100644 --- a/src/command/use/commands/binder/binder-utils.ts +++ b/src/command/use/commands/binder/binder-utils.ts @@ -7,14 +7,14 @@ import { md5Hash } from "../../../../core/hash.ts"; import { projectScratchPath } from "../../../../project/project-scratch.ts"; -import { info } from "log/mod.ts"; +import { info, warning } from "log/mod.ts"; import { ensureDirSync, existsSync } from "fs/mod.ts"; import { join } from "path/mod.ts"; import { Confirm } from "cliffy/prompt/mod.ts"; import { dirname } from "path/mod.ts"; -export const safeFileWriter = (projectDir: string) => { +export const safeFileWriter = (projectDir: string, prompt = true) => { // The index file in the project scratch directory const idxPath = join(projectScratchPath(projectDir), "use", "binder.json"); @@ -46,12 +46,23 @@ export const safeFileWriter = (projectDir: string) => { let writeFile = true; if (!lastHash || lastHash !== currentHash) { // The file exists and wasn't generated, prompt to overwrite - const question = lastHash - ? `File ${projRelativePath} was modified since last generated. Overwrite?` - : `File ${projRelativePath} wasn't created by the this command. Overwrite?`; - writeFile = await Confirm.prompt({ - message: question, - }); + if (prompt) { + const question = lastHash + ? `File ${projRelativePath} was modified since last generated. Overwrite?` + : `File ${projRelativePath} wasn't created by the this command. Overwrite?`; + writeFile = await Confirm.prompt({ + message: question, + }); + } else { + writeFile = false; + lastHash + ? warning( + `Skipped ${projRelativePath} - modified since last generated.`, + ) + : warning( + `Skipped ${projRelativePath} - wasn't created by the this command.`, + ); + } } if (writeFile) { diff --git a/src/command/use/commands/binder/binder.ts b/src/command/use/commands/binder/binder.ts index c372e416195..a45ffdf91f5 100644 --- a/src/command/use/commands/binder/binder.ts +++ b/src/command/use/commands/binder/binder.ts @@ -4,7 +4,6 @@ * Copyright (C) 2021-2022 Posit Software, PBC */ -import { Command } from "cliffy/command/mod.ts"; import { initYamlIntelligenceResourcesFromFilesystem } from "../../../../core/schema/utils.ts"; import { createTempContext } from "../../../../core/temp.ts"; @@ -30,13 +29,16 @@ import { } from "../../../../project/project-environment.ts"; import { withSpinner } from "../../../../core/console.ts"; import { logProgress } from "../../../../core/log.ts"; -import { kEnvironmentFiles } from "../../../../project/types/manuscript/manuscript-types.ts"; import { ProjectContext } from "../../../../project/types.ts"; +import { Command } from "cliffy/command/mod.ts"; +import { Table } from "cliffy/table/mod.ts"; +import { Confirm } from "cliffy/prompt/mod.ts"; + export const useBinderCommand = new Command() .name("binder") .description( - "Configure the current project to be deployable using Binder.", + "Configure the current project with Binder support.", ) .option( "--no-prompt", @@ -61,61 +63,16 @@ export const useBinderCommand = new Command() // Read the project environment const projEnv = await withSpinner( - { message: "Inspecting project" }, + { + message: "Inspecting project configuration:", + doneMessage: "Detected Project configuration:\n", + }, () => { - return computeProjectEnvironment(context); + return context.environment(context); }, ); - // Note whether there are depedencies restored - if (projEnv.environments.length === 0) { - // TODO: Provide a hyperlink to more information - info( - "\nNOTE: No files which declare dependencies were discovered. No dependencies will be restored when running this project on Binder.\n", - ); - } - - logProgress("Writing files"); - - // Write the post build to install Quarto - const quartoConfig: QuartoConfiguration = { - version: projEnv.quarto, - tinytex: projEnv.tools.includes("tinytex"), - chromium: projEnv.tools.includes("chromium"), - }; - - const vsCodeConfig: VSCodeConfiguration = { - version: projEnv.codeEnvironment === "vscode" - ? new SemVer("4.16.1") - : undefined, // Whether to install vscode - extensions: [ - "ms-python.python", - "sumneko.lua", - "quarto.quarto", - ], - }; - - // See if we should configure for JL3 or 4 const jupyterLab4 = jupyterLabVersion(context, projEnv); - const pythonConfig: PythonConfiguration = { - pip: [], - }; - if (jupyterLab4) { - pythonConfig.pip?.push( - "git+https://github.com/trungleduc/jupyter-server-proxy@lab4", - ); - pythonConfig.pip?.push("jupyterlab-quarto"); - } else { - pythonConfig.pip?.push("jupyter-server-proxy"); - pythonConfig.pip?.push("jupyterlab-quarto==0.1.45"); - } - - const environmentConfig: EnvironmentConfiguration = { - apt: ["zip"], - }; - - // Get a file write - const writeFile = safeFileWriter(context.dir); const rConfig: RConfiguration = {}; if (projEnv.engines.includes("knitr")) { @@ -144,69 +101,95 @@ export const useBinderCommand = new Command() } } - // Look for an renv.lock file - const renvPath = join(context.dir, "renv.lock"); - if (existsSync(renvPath)) { - // Create an install.R file - const installRText = "install.packages('renv')\nrenv::activate()"; - await writeFile( - "install.R", - installRText, - ); + const quartoVersion = typeof (projEnv.quarto) === "string" + ? projEnv.quarto === "prerelease" + ? "most recent prerelease" + : "most recent release" + : projEnv.quarto.toString(); + + const table = new Table(); + table.push(["Quarto", quartoVersion]); + table.push([ + "JupyterLab", + jupyterLab4 ? "4.x" : "default", + ]); + if (projEnv.engines.length > 0) { + table.push([ + projEnv.engines.length === 1 ? "Engine" : "Engines", + projEnv.engines.join("\n"), + ]); } - - // Generate the postBuild text - const postBuildScriptText = createPostBuild( - quartoConfig, - vsCodeConfig, - pythonConfig, - ); - - // Write the postBuild text - await writeFile( - "postBuild", - postBuildScriptText, - ); - - // Configure JupyterLab to support VSCode - if (vsCodeConfig.version) { - const traitletsDir = ".jupyter"; - ensureDirSync(join(context.dir, traitletsDir)); - - // Move traitlets configuration into place - // Traitlets are used to configure the vscode tile in jupyterlab - // as well as to start the port proxying that permits vscode to work - const resDir = resourcePath("use/binder/"); - for (const file of ["vscode.svg", "jupyter_notebook_config.py"]) { - const textContents = Deno.readTextFileSync(join(resDir, file)); - await writeFile(join(traitletsDir, file), textContents); + if (rConfig.version || rConfig.date) { + const verStr = []; + if (rConfig.version) { + verStr.push(`${rConfig.version?.toString()}`); + } + if (rConfig.date) { + verStr.push(`(${rConfig.date})`); } - } - - // Generate an apt.txt file - if (environmentConfig.apt && environmentConfig.apt.length) { - const aptText = environmentConfig.apt.join("\n"); - await writeFile( - "apt.txt", - aptText, - ); + table.push([ + "R", + verStr.join(" "), + ]); } + if (projEnv.tools.length > 0) { + table.push(["Tools", projEnv.tools.join("\n")]); + } + table.push(["Editor", projEnv.codeEnvironment]); + if (projEnv.environments.length > 0) { + table.push(["Environments", projEnv.environments.join("\n")]); + } + table.indent(4).minColWidth(12).render(); - // Generate a file to configure R - if (rConfig.version || rConfig.date) { - const runtime = ["r"]; - if (rConfig.version) { - runtime.push(`-${rConfig.version}`); + // Note whether there are depedencies restored + const isMarkdownEngineOnly = (engines: string[]) => { + return engines.length === 1 && engines.includes("markdown"); + }; + if ( + projEnv.environments.length === 0 && + !isMarkdownEngineOnly(projEnv.engines) + ) { + info( + "\nNo files which provide dependencies were discovered. If you continue, no dependencies will be restored when running this project with Binder.\n\nLearn more at:\nhttps://www.quarto.org/docs/prerelease/1.4/binder.html#dependencies\n", + ); + const proceed = await Confirm.prompt({ + message: "Do you want to continue?", + default: true, + }); + if (!proceed) { + return; } + } - if (rConfig.date) { - runtime.push(`-${rConfig.date}`); + // Get the list of operations that need to be performed + const fileOperations = await binderFileOperations( + projEnv, + jupyterLab4, + context, + options, + rConfig, + ); + info( + "\nThe following files will be written:", + ); + const changeTable = new Table(); + fileOperations.forEach((op) => { + changeTable.push([op.file, op.desc]); + }); + changeTable.border(true).render(); + info(""); + + const writeFiles = !options.prompt || await Confirm.prompt({ + message: "Continue?", + default: true, + }); + + if (writeFiles) { + logProgress("\nWriting configuration files"); + for (const fileOperation of fileOperations) { + await fileOperation.performOp(); } - await writeFile( - "runtime.txt", - runtime.join(""), - ); } } finally { temp.cleanup(); @@ -367,3 +350,155 @@ rm -rf $PYTHON_SCRIPT fi `; + +async function binderFileOperations( + projEnv: ProjectEnvironment, + jupyterLab4: boolean, + context: ProjectContext, + options: { prompt?: boolean | undefined }, + rConfig: RConfiguration, +) { + const operations: Array< + { file: string; desc: string; performOp: () => Promise } + > = []; + + // Write the post build to install Quarto + const quartoConfig: QuartoConfiguration = { + version: projEnv.quarto, + tinytex: projEnv.tools.includes("tinytex"), + chromium: projEnv.tools.includes("chromium"), + }; + + const vsCodeConfig: VSCodeConfiguration = { + version: projEnv.codeEnvironment === "vscode" + ? new SemVer("4.16.1") + : undefined, + extensions: [ + "ms-python.python", + "sumneko.lua", + "quarto.quarto", + ], + }; + + // See if we should configure for JL3 or 4 + const pythonConfig: PythonConfiguration = { + pip: [], + }; + if (jupyterLab4) { + if (projEnv.codeEnvironment === "vscode") { + pythonConfig.pip?.push( + "git+https://github.com/trungleduc/jupyter-server-proxy@lab4", + ); + } + pythonConfig.pip?.push("jupyterlab-quarto"); + } else { + if (projEnv.codeEnvironment === "vscode") { + pythonConfig.pip?.push("jupyter-server-proxy"); + } + + pythonConfig.pip?.push("jupyterlab-quarto==0.1.45"); + } + + const environmentConfig: EnvironmentConfiguration = { + apt: ["zip"], + }; + + // Get a file writer + const writeFile = safeFileWriter(context.dir, options.prompt); + + // Look for an renv.lock file + const renvPath = join(context.dir, "renv.lock"); + if (existsSync(renvPath)) { + // Create an install.R file + const installRText = "install.packages('renv')\nrenv::activate()"; + operations.push({ + file: "install.R", + desc: "Activates the R environment described in renv.lock", + performOp: async () => { + await writeFile( + "install.R", + installRText, + ); + }, + }); + } + + // Generate the postBuild text + const postBuildScriptText = createPostBuild( + quartoConfig, + vsCodeConfig, + pythonConfig, + ); + + // Write the postBuild text + operations.push({ + file: "postBuild", + desc: "Configures Quarto and supporting tools", + performOp: async () => { + await writeFile( + "postBuild", + postBuildScriptText, + ); + }, + }); + + // Configure JupyterLab to support VSCode + if (vsCodeConfig.version) { + operations.push({ + file: ".jupyter", + desc: "Configures JupyterLab with necessary extensions", + performOp: async () => { + const traitletsDir = ".jupyter"; + ensureDirSync(join(context.dir, traitletsDir)); + + // Move traitlets configuration into place + // Traitlets are used to configure the vscode tile in jupyterlab + // as well as to start the port proxying that permits vscode to work + const resDir = resourcePath("use/binder/"); + for (const file of ["vscode.svg", "jupyter_notebook_config.py"]) { + const textContents = Deno.readTextFileSync(join(resDir, file)); + await writeFile(join(traitletsDir, file), textContents); + } + }, + }); + } + + // Generate an apt.txt file + if (environmentConfig.apt && environmentConfig.apt.length) { + const aptText = environmentConfig.apt.join("\n"); + operations.push({ + file: "apt.txt", + desc: "Installs Quarto required packages", + performOp: async () => { + await writeFile( + "apt.txt", + aptText, + ); + }, + }); + } + + // Generate a file to configure R + if (rConfig.version || rConfig.date) { + const runtime = ["r"]; + if (rConfig.version) { + runtime.push(`-${rConfig.version}`); + } + + if (rConfig.date) { + runtime.push(`-${rConfig.date}`); + } + operations.push({ + file: "runtime.txt", + desc: "Installs R and configures RStudio", + performOp: async () => { + await writeFile( + "runtime.txt", + runtime.join(""), + ); + }, + }); + } + + return operations; +} diff --git a/src/config/constants.ts b/src/config/constants.ts index 5676ce03a5d..1ee18b0f904 100644 --- a/src/config/constants.ts +++ b/src/config/constants.ts @@ -21,6 +21,7 @@ export const kFigWidth = "fig-width"; export const kFigHeight = "fig-height"; export const kFigFormat = "fig-format"; export const kFigDpi = "fig-dpi"; +export const kFigAsp = "fig-asp"; export const kMermaidFormat = "mermaid-format"; export const kDfPrint = "df-print"; @@ -52,6 +53,7 @@ export const kNotebookViewStyle = "notebook-view-style"; export const kNotebookPreserveCells = "notebook-preserve-cells"; export const kClearCellOptions = "clear-cell-options"; export const kDownloadUrl = "download-url"; +export const kLightbox = "lightbox"; export const kNotebookPreviewOptions = "notebook-preview-options"; export const kNotebookPreviewOptionBack = "back"; @@ -136,6 +138,7 @@ export const kExecuteDefaultsKeys = [ kFigHeight, kFigFormat, kFigDpi, + kFigAsp, kMermaidFormat, kDfPrint, kError, @@ -729,3 +732,10 @@ export const kLayout = "layout"; // https://github.com/quarto-dev/quarto-cli/issues/3581 export const kCliffyImplicitCwd = "5a6d2e4f-f9a2-43bc-8019-8149fbb76c85"; + +export const kSourceMappingRegexes = [ + /^\/\/#\s*sourceMappingURL\=.*\.map$/gm, + /\/\*\# sourceMappingURL=.* \*\//g, +]; + +export const kFormatIdentifier = "format-identifier"; diff --git a/src/config/metadata.ts b/src/config/metadata.ts index bb7cb7b809e..89b613c2c48 100644 --- a/src/config/metadata.ts +++ b/src/config/metadata.ts @@ -335,18 +335,19 @@ export function mergeConfigsCustomized( export function mergeDisablableArray(objValue: unknown, srcValue: unknown) { if (Array.isArray(objValue) && Array.isArray(srcValue)) { - return [ - ...objValue, - ...srcValue, - ]; - } else if (Array.isArray(objValue)) { + return mergeArrayCustomizer(objValue, srcValue); + } else { if (srcValue === false) { return []; } else { - return objValue; + const srcArr = srcValue !== undefined + ? Array.isArray(srcValue) ? srcValue : [srcValue] + : []; + const objArr = objValue !== undefined + ? Array.isArray(objValue) ? objValue : [objValue] + : []; + return mergeArrayCustomizer(objArr, srcArr); } - } else { - return srcValue; } } diff --git a/src/config/types.ts b/src/config/types.ts index ef0c4dfa0a2..7dbe8fc6c04 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -72,6 +72,7 @@ import { kExecuteIpynb, kExtensionName, kFigAlign, + kFigAsp, kFigDpi, kFigEnv, kFigFormat, @@ -466,6 +467,7 @@ export interface FormatExecute { [kFigHeight]?: number; [kFigFormat]?: "retina" | "png" | "jpeg" | "svg" | "pdf"; [kFigDpi]?: number; + [kFigAsp]?: number; [kMermaidFormat]?: "png" | "svg" | "js"; [kDfPrint]?: "default" | "kable" | "tibble" | "paged"; [kCache]?: true | false | "refresh" | null; diff --git a/src/core/container.ts b/src/core/container.ts index 1d5ce4009fa..bb8e6fc003a 100644 --- a/src/core/container.ts +++ b/src/core/container.ts @@ -4,7 +4,7 @@ * Copyright (C) 2020-2022 Posit Software, PBC */ -import { walkSync } from "../vendor/deno.land/std@0.185.0/fs/walk.ts"; +import { walkSync } from "fs/walk.ts"; import { basename, join } from "path/mod.ts"; import { existsSync } from "fs/mod.ts"; diff --git a/src/core/devconfig.ts b/src/core/devconfig.ts index e689b5341e8..39f6fb1a9ef 100644 --- a/src/core/devconfig.ts +++ b/src/core/devconfig.ts @@ -125,14 +125,29 @@ export async function reconfigureQuarto( installed: DevConfig | null, source: DevConfig, ) { - const configureScript = isWindows() ? ".\\configure.cmd" : "./configure.sh"; + // Running configuration from within quarto does not work on windows + // because deno.exe is running and this lock and prevent reinstallation + // So we fail and print comment to run + if (isWindows()) { + error( + `Quarto requires reconfiguration to ${ + reconfigureReason(installed, source) + }. Please run \`./configure.cmd\` command.\n`, + ); + return; + } + // Leaving Windows here if we find a way to reconfigure + // to not forget how to call the script + const configureScript = isWindows() + ? ["cmd", "/c", ".\\configure.cmd"] + : ["./configure.sh"]; const quartoDir = normalizePath( join(quartoConfig.sharePath(), "..", ".."), ); const process = Deno.run({ - cmd: [configureScript], + cmd: configureScript, cwd: quartoDir, }); diff --git a/src/core/handlers/base.ts b/src/core/handlers/base.ts index fc71135d233..cab703dcd4e 100644 --- a/src/core/handlers/base.ts +++ b/src/core/handlers/base.ts @@ -1,9 +1,8 @@ /* -* base.ts -* -* Copyright (C) 2022 Posit Software, PBC -* -*/ + * base.ts + * + * Copyright (C) 2022 Posit Software, PBC + */ import { HandlerContextResults, @@ -717,7 +716,7 @@ export function getDivAttributes( } } if (options?.[kCellLstCap]) { - attrs.push(`caption="${options?.[kCellLstCap]}"`); + attrs.push(`lst-cap="${options?.[kCellLstCap]}"`); } const classStr = (options?.classes as (string | undefined)) || ""; diff --git a/src/core/hash.ts b/src/core/hash.ts index 4bb1414c103..709dc3a5c88 100644 --- a/src/core/hash.ts +++ b/src/core/hash.ts @@ -4,7 +4,7 @@ * Copyright (C) 2020-2022 Posit Software, PBC */ -import { crypto } from "https://deno.land/std@0.185.0/crypto/mod.ts"; +import { crypto } from "crypto/mod.ts"; import blueimpMd5 from "blueimpMd5"; export function md5Hash(content: string) { diff --git a/src/core/jupyter/jupyter.ts b/src/core/jupyter/jupyter.ts index b95abd1fe8c..d55639dbb7f 100644 --- a/src/core/jupyter/jupyter.ts +++ b/src/core/jupyter/jupyter.ts @@ -1379,7 +1379,7 @@ async function mdFromCodeCell( } if (typeof cell.options[kCellLstCap] === "string") { - md.push(` caption=\"${cell.options[kCellLstCap]}\"`); + md.push(` lst-cap=\"${cell.options[kCellLstCap]}\"`); } if (typeof cell.options[kCodeFold] !== "undefined") { md.push(` code-fold=\"${cell.options[kCodeFold]}\"`); diff --git a/src/dev_import_map.json b/src/dev_import_map.json index d69cfc61fac..27cef6379ac 100644 --- a/src/dev_import_map.json +++ b/src/dev_import_map.json @@ -45,6 +45,8 @@ "diff": "./vendor/cdn.skypack.dev/diff@5.0.0.js", "observablehq/parser": "./vendor/cdn.skypack.dev/@observablehq/parser@4.5.0.js", "js-yaml": "./vendor/cdn.skypack.dev/js-yaml@4.1.0.js", + "slimdom": "./vendor/cdn.skypack.dev/slimdom@4.2.0.js", + "fontoxpath": "./vendor/cdn.skypack.dev/fontoxpath@3.29.1.js", "https://deno.land/std@0.161.0/": "./vendor/deno.land/std@0.185.0/", "https://deno.land/std@0.101.0/": "./vendor/deno.land/std@0.185.0/", "https://deno.land/std@0.105.0/": "./vendor/deno.land/std@0.185.0/", @@ -280,6 +282,9 @@ "/-/acorn-walk@v7.2.0-HE7wS37ePcNncqJvsD8k/dist=es2019,mode=imports/optimized/acorn-walk.js": "./vendor/cdn.skypack.dev/-/acorn-walk@v7.2.0-HE7wS37ePcNncqJvsD8k/dist=es2019,mode=imports/optimized/acorn-walk.js", "/-/acorn-private-class-elements@v1.0.0-74UyKouPfmJKyVmXndKD/dist=es2019,mode=imports/optimized/acorn-private-class-elements.js": "./vendor/cdn.skypack.dev/-/acorn-private-class-elements@v1.0.0-74UyKouPfmJKyVmXndKD/dist=es2019,mode=imports/optimized/acorn-private-class-elements.js", "/-/acorn@v8.4.0-TUBEehokUmfefnUMjao9/dist=es2019,mode=imports/optimized/acorn.js": "./vendor/cdn.skypack.dev/-/acorn@v8.4.0-TUBEehokUmfefnUMjao9/dist=es2019,mode=imports/optimized/acorn.js", + "/-/xspattern@v3.1.0-ChOssaTvtX8cZQgPaNnM/dist=es2019,mode=imports/optimized/xspattern.js": "./vendor/cdn.skypack.dev/-/xspattern@v3.1.0-ChOssaTvtX8cZQgPaNnM/dist=es2019,mode=imports/optimized/xspattern.js", + "/-/prsc@v4.0.0-yiYip3qo0YwPataeg654/dist=es2019,mode=imports/optimized/prsc.js": "./vendor/cdn.skypack.dev/-/prsc@v4.0.0-yiYip3qo0YwPataeg654/dist=es2019,mode=imports/optimized/prsc.js", + "/-/whynot@v5.0.0-TIWeI93neceQKiPCfmA6/dist=es2019,mode=imports/optimized/whynot.js": "./vendor/cdn.skypack.dev/-/whynot@v5.0.0-TIWeI93neceQKiPCfmA6/dist=es2019,mode=imports/optimized/whynot.js", "/-/@observablehq/parser@v4.5.0-rWZiNfab8flhVomtfVvr/dist=es2019,mode=imports/optimized/@observablehq/parser.js": "./vendor/cdn.skypack.dev/-/@observablehq/parser@v4.5.0-rWZiNfab8flhVomtfVvr/dist=es2019,mode=imports/optimized/@observablehq/parser.js", "/-/acorn-class-fields@v1.0.0-VEggkLxq9gMrdwRuKkzZ/dist=es2019,mode=imports/optimized/acorn-class-fields.js": "./vendor/cdn.skypack.dev/-/acorn-class-fields@v1.0.0-VEggkLxq9gMrdwRuKkzZ/dist=es2019,mode=imports/optimized/acorn-class-fields.js", "/-/acorn-walk@v8.2.0-X811aiix0R2fkBGq305v/dist=es2019,mode=imports/optimized/acorn-walk.js": "./vendor/cdn.skypack.dev/-/acorn-walk@v8.2.0-X811aiix0R2fkBGq305v/dist=es2019,mode=imports/optimized/acorn-walk.js", @@ -287,6 +292,7 @@ "/-/binary-search-bounds@v2.0.5-c8IgO4OqUhed8ANHQXKv/dist=es2019,mode=imports/optimized/binary-search-bounds.js": "./vendor/cdn.skypack.dev/-/binary-search-bounds@v2.0.5-c8IgO4OqUhed8ANHQXKv/dist=es2019,mode=imports/optimized/binary-search-bounds.js", "/-/blueimp-md5@v2.19.0-FsBtHB6ITwdC3L5Giq4Q/dist=es2019,mode=imports/optimized/blueimp-md5.js": "./vendor/cdn.skypack.dev/-/blueimp-md5@v2.19.0-FsBtHB6ITwdC3L5Giq4Q/dist=es2019,mode=imports/optimized/blueimp-md5.js", "/-/dayjs@v1.8.21-6syVEc6qGP8frQXKlmJD/dist=es2019,mode=imports/optimized/dayjs.js": "./vendor/cdn.skypack.dev/-/dayjs@v1.8.21-6syVEc6qGP8frQXKlmJD/dist=es2019,mode=imports/optimized/dayjs.js", + "/-/fontoxpath@v3.29.1-a0ohYsVP957eLX7RfgAa/dist=es2019,mode=imports/optimized/fontoxpath.js": "./vendor/cdn.skypack.dev/-/fontoxpath@v3.29.1-a0ohYsVP957eLX7RfgAa/dist=es2019,mode=imports/optimized/fontoxpath.js", "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/cloneDeep.js": "./vendor/cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/cloneDeep.js", "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/debounce.js": "./vendor/cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/debounce.js", "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/difference.js": "./vendor/cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/difference.js", @@ -303,7 +309,8 @@ "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/toString.js": "./vendor/cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/toString.js", "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/uniq.js": "./vendor/cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/uniq.js", "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/uniqBy.js": "./vendor/cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/uniqBy.js", - "/-/moment-guess@v1.2.4-bDXl7KQy0hLGNuGhyGb4/dist=es2019,mode=imports/optimized/moment-guess.js": "./vendor/cdn.skypack.dev/-/moment-guess@v1.2.4-bDXl7KQy0hLGNuGhyGb4/dist=es2019,mode=imports/optimized/moment-guess.js" + "/-/moment-guess@v1.2.4-bDXl7KQy0hLGNuGhyGb4/dist=es2019,mode=imports/optimized/moment-guess.js": "./vendor/cdn.skypack.dev/-/moment-guess@v1.2.4-bDXl7KQy0hLGNuGhyGb4/dist=es2019,mode=imports/optimized/moment-guess.js", + "/-/slimdom@v4.2.0-QzuHPU3P67qdOzczKt6u/dist=es2019,mode=imports/optimized/slimdom.js": "./vendor/cdn.skypack.dev/-/slimdom@v4.2.0-QzuHPU3P67qdOzczKt6u/dist=es2019,mode=imports/optimized/slimdom.js" } } } \ No newline at end of file diff --git a/src/execute/engine.ts b/src/execute/engine.ts index 1d3028c4645..deabace737f 100644 --- a/src/execute/engine.ts +++ b/src/execute/engine.ts @@ -180,10 +180,20 @@ export function fileExecutionEngine( // if we were passed a transformed markdown, use that for the text instead // of the contents of the file. if (kMdExtensions.includes(ext) || kQmdExtensions.includes(ext)) { - return markdownExecutionEngine( - markdown ? markdown.value : Deno.readTextFileSync(file), - flags, - ); + // https://github.com/quarto-dev/quarto-cli/issues/6825 + // In case the YAML _parsing_ fails, we need to annotate the error + // with the filename so that the user knows which file is the problem. + try { + return markdownExecutionEngine( + markdown ? markdown.value : Deno.readTextFileSync(file), + flags, + ); + } catch (error) { + if (error.name === "YAMLError") { + error.message = `${file}:\n${error.message}`; + } + throw error; + } } else { return undefined; } diff --git a/src/execute/ojs/compile.ts b/src/execute/ojs/compile.ts index b98015e81b8..9c80ba579f6 100644 --- a/src/execute/ojs/compile.ts +++ b/src/execute/ojs/compile.ts @@ -424,9 +424,6 @@ export async function ojsCompile( if (outputVal === "all") { attrs.push(`output="all"`); } - if (cell.options?.[kCellLstCap]) { - attrs.push(`caption="${cell.options?.[kCellLstCap]}"`); - } const { classes, attrs: otherAttrs, diff --git a/src/extension/constants.ts b/src/extension/constants.ts index 66c90b7d99a..deb12987c40 100644 --- a/src/extension/constants.ts +++ b/src/extension/constants.ts @@ -12,3 +12,7 @@ export const kAuthor = "author"; export const kVersion = "version"; export const kQuartoRequired = "quarto-required"; export const kRevealJSPlugins = "revealjs-plugins"; + +// Special case for our lightbox extension, which we've built in +// manually (to better control filter placement) +export const kBuiltInExtNames = ["lightbox"]; diff --git a/src/extension/extension.ts b/src/extension/extension.ts index 9b87557c9c5..75dae644046 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -26,6 +26,7 @@ import { quartoConfig } from "../core/quarto.ts"; import { kAuthor, + kBuiltInExtNames, kBuiltInExtOrg, kCommon, kExtensionDir, @@ -187,7 +188,7 @@ function filterExtensionAndWarn( warnToRemoveExtensions(filterOutExtensions); // filter out the extensions that have become built in return extensions.filter((ext) => { - return filterOutExtensions.map((ext) => ext.id.name).includes( + return !filterOutExtensions.map((ext) => ext.id.name).includes( ext.id.name, ); }); @@ -239,13 +240,14 @@ export function filterExtensions( // referenced in the yaml so we don't break code in the wild) const oldBuiltInExt = extensions?.filter((ext) => { return (ext.id.organization === kQuartoExtOrganization && - kQuartoExtBuiltIn.includes(ext.id.name)); + (kQuartoExtBuiltIn.includes(ext.id.name) || + kBuiltInExtNames.includes(ext.id.name))); }); if (oldBuiltInExt.length > 0) { - filterExtensionAndWarn(extensions, oldBuiltInExt); + return filterExtensionAndWarn(extensions, oldBuiltInExt); + } else { + return extensions; } - - return extensions; } else { return extensions; } diff --git a/src/format/formats-shared.ts b/src/format/formats-shared.ts index e3421791686..60a65b88b54 100644 --- a/src/format/formats-shared.ts +++ b/src/format/formats-shared.ts @@ -25,6 +25,7 @@ import { kExecuteEnabled, kExecuteIpynb, kFigAlign, + kFigAsp, kFigDpi, kFigEnv, kFigFormat, @@ -200,6 +201,7 @@ function defaultFormat(displayName: string): Format { [kFigHeight]: 5, [kFigFormat]: "png", [kFigDpi]: 96, + [kFigAsp]: undefined, [kMermaidFormat]: undefined, [kDfPrint]: "default", [kError]: false, diff --git a/src/format/html/format-html-appendix.ts b/src/format/html/format-html-appendix.ts index 211bfe5adc3..33c45a18c63 100644 --- a/src/format/html/format-html-appendix.ts +++ b/src/format/html/format-html-appendix.ts @@ -41,6 +41,8 @@ const kAppendixCreativeCommonsLic = [ "CC BY-SA", "CC BY-ND", "CC BY-NC", + "CC BY-NC-SA", + "CC BY-NC-ND", ]; const kStylePlain = "plain"; @@ -182,18 +184,15 @@ export async function processDocumentAppendix( // // this will allow us to not include the following code. const normalizedLicense = (license: unknown) => { - if (typeof (license) === "string") { + if (typeof license === "string") { const creativeCommons = creativeCommonsLicense(license); if (creativeCommons) { - const licenseUrl = creativeCommonsUrl( + const licenseUrlInfo = creativeCommonsUrl( creativeCommons.base, format.metadata[kLang] as string | undefined, creativeCommons.version, ); - return { - url: licenseUrl, - text: licenseUrl, - }; + return licenseUrlInfo; } else { return { text: license }; } @@ -242,7 +241,7 @@ export async function processDocumentAppendix( // // this will allow us to not include the following code. const normalizedCopyright = (copyright: unknown) => { - if (typeof (copyright) === "string") { + if (typeof copyright === "string") { return copyright; } else if (copyright) { return (copyright as { statement?: string }).statement; @@ -432,7 +431,13 @@ function creativeCommonsLicense( const version = match[2]; if (kAppendixCreativeCommonsLic.includes(base)) { return { - base: base as "CC BY" | "CC BY-SA" | "CC BY-ND" | "CC BY-NC", + base: base as + | "CC BY" + | "CC BY-SA" + | "CC BY-ND" + | "CC BY-NC" + | "CC BY-NC-ND" + | "CC BY-NC-SA", version: version || "4.0", }; } else { @@ -449,11 +454,19 @@ function creativeCommonsLicense( function creativeCommonsUrl(license: string, lang?: string, version?: string) { const licenseType = license.substring(3); if (lang && lang !== "en") { - return `https://creativecommons.org/licenses/${licenseType.toLowerCase()}/${version}/deed.${ - lang.toLowerCase().replace("-", "_") - }`; + return { + url: + `https://creativecommons.org/licenses/${licenseType.toLowerCase()}/${version}/deed.${ + lang.toLowerCase().replace("-", "_") + }`, + text: `CC ${licenseType} ${version}`, + }; } else { - return `https://creativecommons.org/licenses/${licenseType.toLowerCase()}/${version}/`; + return { + url: + `https://creativecommons.org/licenses/${licenseType.toLowerCase()}/${version}/`, + text: `CC ${licenseType} ${version}`, + }; } } diff --git a/src/format/html/format-html-bootstrap.ts b/src/format/html/format-html-bootstrap.ts index 38a85ded598..ea11b4c8a0a 100644 --- a/src/format/html/format-html-bootstrap.ts +++ b/src/format/html/format-html-bootstrap.ts @@ -20,6 +20,8 @@ import { kGrid, kHtmlMathMethod, kIncludeInHeader, + kLaunchBinderTitle, + kLaunchDevContainerTitle, kLinkCitations, kNotebookLinks, kOtherLinks, @@ -80,6 +82,13 @@ import { isHtmlOutput } from "../../config/format.ts"; import { emplaceNotebookPreviews } from "./format-html-notebook.ts"; import { ProjectContext } from "../../project/types.ts"; import { AlternateLink, otherFormatLinks } from "./format-html-links.ts"; +import { warning } from "log/mod.ts"; +import { + binderUrl, + hasBinderCompatibleEnvironment, + hasDevContainer, +} from "../../core/container.ts"; +import { codeSpacesUrl } from "../../core/container.ts"; export function bootstrapFormatDependency() { const boostrapResource = (resource: string) => @@ -268,10 +277,10 @@ function bootstrapHtmlPostprocessor( for (let j = 0; j < images.length; j++) { (images[j] as Element).classList.add("figure-img"); } - const captions = figure.querySelectorAll("figcaption"); - for (let j = 0; j < captions.length; j++) { - (captions[j] as Element).classList.add("figure-caption"); - } + // const captions = figure.querySelectorAll("figcaption"); + // for (let j = 0; j < captions.length; j++) { + // (captions[j] as Element).classList.add("figure-caption"); + // } } // move the toc if there is a sidebar @@ -374,7 +383,7 @@ function bootstrapHtmlPostprocessor( } // Process additional links for this document - processOtherLinks(doc, format); + await processOtherLinks(doc, format, project); // default treatment for computational tables const addTableClasses = (table: Element, computational = false) => { @@ -488,9 +497,10 @@ function createLinkChild(formatLink: AlternateLink, doc: Document) { return link; } -function processOtherLinks( +async function processOtherLinks( doc: Document, format: Format, + context?: ProjectContext, ) { const processLinks = ( otherLinks: OtherLink[], @@ -552,12 +562,126 @@ function processOtherLinks( } }; + const resolveCodeLinks = async ( + metadata: Metadata, + context?: ProjectContext, + ): Promise => { + const codeLinks = metadata[kCodeLinks] as + | boolean + | string + | string[] + | OtherLink[]; + if (codeLinks !== undefined) { + if (typeof (codeLinks) === "boolean") { + return []; + } else if (typeof (codeLinks) === "string") { + if (!context) { + throw new Error( + `The code-link value '${codeLinks}' is only supported from within a project.`, + ); + } + const resolvedCodeLink = await resolveCodeLink(codeLinks, context); + if (resolvedCodeLink) { + return [resolvedCodeLink]; + } else { + throw new Error(`Unknown code-link value '${codeLinks}'`); + } + } else { + const outputLinks: OtherLink[] = []; + for (const codeLink of codeLinks) { + if (typeof (codeLink) === "string") { + if (!context) { + throw new Error( + `The code-link value '${codeLink}' is only supported from within a project.`, + ); + } + const resolvedCodeLink = await resolveCodeLink(codeLink, context); + if (resolvedCodeLink) { + outputLinks.push(resolvedCodeLink); + } else { + throw new Error(`Unknown code-link value '${codeLink}'`); + } + } else { + outputLinks.push(codeLink); + } + } + return outputLinks; + } + } + return []; + }; + + const resolveCodeLink = async ( + link: string, + context: ProjectContext, + ): Promise => { + if (link === "repo") { + const env = await context.environment(context); + if (env.github.repoUrl) { + return { + icon: "github", + text: "GitHub Repo", + href: env.github.repoUrl, + target: "_blank", + }; + } else { + warning( + "The 'repo' code link is not able to be created as the project isn't a GitHub project.", + ); + } + } else if (link === "devcontainer") { + const env = await context.environment(context); + if ( + env.github.organization && env.github.repository && env.github.repoUrl + ) { + const containerUrl = codeSpacesUrl(env.github.repoUrl); + return { + icon: "github", + text: format.language[kLaunchDevContainerTitle] || + "Launch Dev Container", + href: containerUrl, + target: "_blank", + }; + } else { + warning( + "The 'devcontainer' code link is not able to be created as the project isn't a GitHub project.", + ); + } + } else if (link === "binder") { + const env = await context.environment(context); + if (env.github.organization && env.github.repository) { + const containerUrl = binderUrl( + env.github.organization, + env.github.repository, + { + // TODO: figure out open file path (if support in vscode/rstudio) + // openFile: extname(source) === ".ipynb" ? source : undefined + editor: env.codeEnvironment, + }, + ); + return { + icon: "journals", + text: format.language[kLaunchBinderTitle] || + "Launch Binder", + href: containerUrl, + target: "_blank", + }; + } else { + warning( + "The 'binder' code link is not able to be created as the project isn't a GitHub project.", + ); + } + } + }; + + const codeLinks = await resolveCodeLinks(format.metadata, context); + const otherLinkOptions = [{ links: (format.metadata[kOtherLinks] || []) as OtherLink[], clz: "quarto-other-links", title: format.language[kOtherLinksTitle] || "Other Links", }, { - links: (format.metadata[kCodeLinks] || []) as OtherLink[], + links: codeLinks, clz: "quarto-code-links", title: format.language[kCodeLinksTitle] || "Code Links", }]; diff --git a/src/format/html/format-html-scss.ts b/src/format/html/format-html-scss.ts index d2abcdfc93b..b48bf7d35de 100644 --- a/src/format/html/format-html-scss.ts +++ b/src/format/html/format-html-scss.ts @@ -441,6 +441,7 @@ function pandocVariablesToThemeDefaults( add(explicitVars, "font-family-base", metadata["mainfont"], asCssFont); add(explicitVars, "font-family-code", metadata["monofont"], asCssFont); add(explicitVars, "mono-background-color", metadata["monobackgroundcolor"]); + add(explicitVars, "mono-foreground-color", metadata["monoforegroundcolor"]); // Deal with sizes const explicitSizes = [ diff --git a/src/format/html/format-html-title.ts b/src/format/html/format-html-title.ts index 17ef8855025..163be689040 100644 --- a/src/format/html/format-html-title.ts +++ b/src/format/html/format-html-title.ts @@ -16,7 +16,7 @@ import { MarkdownPipeline, } from "../../project/types/website/website-pipeline-md.ts"; -const kTitleBlockStyle = "title-block-style"; +export const kTitleBlockStyle = "title-block-style"; const kTitleBlockBanner = "title-block-banner"; const ktitleBlockColor = "title-block-banner-color"; const kTitleBlockCategories = "title-block-categories"; diff --git a/src/format/jats/format-jats.ts b/src/format/jats/format-jats.ts index 2a5ca560c09..e54bdc49a27 100644 --- a/src/format/jats/format-jats.ts +++ b/src/format/jats/format-jats.ts @@ -66,6 +66,7 @@ export function jatsFormat(displayName: string, ext: string): Format { "front.xml", "authors.xml", "institution.xml", + "affiliation.xml", "name.xml", ]; const templateContext = { diff --git a/src/format/pdf/format-pdf.ts b/src/format/pdf/format-pdf.ts index b56fe854df6..d83d2a914d9 100644 --- a/src/format/pdf/format-pdf.ts +++ b/src/format/pdf/format-pdf.ts @@ -374,14 +374,19 @@ function pdfLatexPostProcessor( lineProcessors.push(codeListAnnotationPostProcessor()); } - lineProcessors.push(longTableSidenoteProcessor()); + lineProcessors.push(tableSidenoteProcessor()); + // This is pass 1 await processLines(output, lineProcessors, temp); + + // This is pass 2; we need these to happen after the first pass + const pass2Processors: LineProcessor[] = [ + longTableSidenoteProcessor(), + ]; if (Object.keys(renderedCites).length > 0) { - await processLines(output, [ - placePandocBibliographyEntries(renderedCites), - ], temp); + pass2Processors.push(placePandocBibliographyEntries(renderedCites)); } + await processLines(output, pass2Processors, temp); }; } @@ -601,7 +606,7 @@ const captionFootnoteLineProcessor = () => { return (line: string): string | undefined => { switch (state) { case "scanning": - if (line.match(/^\\begin{figure}$/)) { + if (line.match(/^\\begin{figure}.*$/)) { state = "capturing"; capturedLines = [line]; return undefined; @@ -610,7 +615,7 @@ const captionFootnoteLineProcessor = () => { } case "capturing": capturedLines.push(line); - if (line.match(/^\\end{figure}$/)) { + if (line.match(/^\\end{figure}%*$/)) { state = "scanning"; // read the whole figure and clear any capture state @@ -626,96 +631,118 @@ const captionFootnoteLineProcessor = () => { }; }; -const processLongTableSidenotes = (latexLongTable: string) => { - const sideNoteMarker = "\\sidenote{\\footnotesize "; - let strProcessing = latexLongTable; - const strOutput: string[] = []; - const sidenotes: string[] = []; +const processSideNotes = (endMarker: string) => { + return (latexLongTable: string) => { + const sideNoteMarker = "\\sidenote{\\footnotesize "; + let strProcessing = latexLongTable; + const strOutput: string[] = []; + const sidenotes: string[] = []; - let sidenotePos = strProcessing.indexOf(sideNoteMarker); - while (sidenotePos > -1) { - strOutput.push(strProcessing.substring(0, sidenotePos)); + let sidenotePos = strProcessing.indexOf(sideNoteMarker); + while (sidenotePos > -1) { + strOutput.push(strProcessing.substring(0, sidenotePos)); - const remainingStr = strProcessing.substring( - sidenotePos + sideNoteMarker.length, - ); - let escaped = false; - let sideNoteEnd = -1; - for (let i = 0; i < remainingStr.length; i++) { - const ch = remainingStr[i]; - if (ch === "\\") { - escaped = true; - } else { - if (!escaped && ch === "}") { - sideNoteEnd = i; - break; + const remainingStr = strProcessing.substring( + sidenotePos + sideNoteMarker.length, + ); + let escaped = false; + let sideNoteEnd = -1; + for (let i = 0; i < remainingStr.length; i++) { + const ch = remainingStr[i]; + if (ch === "\\") { + escaped = true; } else { - escaped = false; + if (!escaped && ch === "}") { + sideNoteEnd = i; + break; + } else { + escaped = false; + } } } - } - if (sideNoteEnd > -1) { - strOutput.push("\\sidenotemark{}"); - const contents = remainingStr.substring(0, sideNoteEnd); - sidenotes.push(contents); - strProcessing = remainingStr.substring(sideNoteEnd + 1); - sidenotePos = strProcessing.indexOf(sideNoteMarker); - } else { - strOutput.push(remainingStr); + if (sideNoteEnd > -1) { + strOutput.push("\\sidenotemark{}"); + const contents = remainingStr.substring(0, sideNoteEnd); + sidenotes.push(contents); + strProcessing = remainingStr.substring(sideNoteEnd + 1); + sidenotePos = strProcessing.indexOf(sideNoteMarker); + } else { + strOutput.push(remainingStr); + } } - } - // Ensure that we inject sidenotes after the longtable - const endTable = "\\end{longtable}"; - const endPos = strProcessing.indexOf(endTable); - const prefix = strProcessing.substring(0, endPos + endTable.length); - const suffix = strProcessing.substring( - endPos + endTable.length, - strProcessing.length, - ); + // Ensure that we inject sidenotes after the longtable + const endTable = endMarker; + const endPos = strProcessing.indexOf(endTable); + const prefix = strProcessing.substring(0, endPos + endTable.length); + const suffix = strProcessing.substring( + endPos + endTable.length, + strProcessing.length, + ); - strOutput.push(prefix); - for (const note of sidenotes) { - strOutput.push(`\\sidenotetext{${note}}\n`); - } - if (suffix) { - strOutput.push(suffix); - } + strOutput.push(prefix); + for (const note of sidenotes) { + strOutput.push(`\\sidenotetext{${note}}\n`); + } + if (suffix) { + strOutput.push(suffix); + } - return strOutput.join(""); + return strOutput.join(""); + }; }; -const longTableSidenoteProcessor = () => { - let state: "scanning" | "capturing" = "scanning"; - let capturedLines: string[] = []; - return (line: string): string | undefined => { - switch (state) { - case "scanning": - if (line.match(/^\\begin{longtable}.*$/)) { - state = "capturing"; - capturedLines = [line]; - return undefined; - } else { - return line; - } - case "capturing": - capturedLines.push(line); - if (line.match(/\\end{longtable}/)) { - state = "scanning"; - - // read the whole figure and clear any capture state - const lines = capturedLines.join("\n"); - capturedLines = []; +const processLongTableSidenotes = processSideNotes("\\end{longtable}"); +const processTableSidenotes = processSideNotes("\\end{table}"); - // Process the captions and relocate footnotes - return processLongTableSidenotes(lines); - } else { - return undefined; - } - } +const sideNoteProcessor = ( + beginRegex: RegExp, + endRegex: RegExp, + callback: (str: string) => string, +) => { + return () => { + let state: "scanning" | "capturing" = "scanning"; + let capturedLines: string[] = []; + return (line: string): string | undefined => { + switch (state) { + case "scanning": + if (line.match(beginRegex)) { + state = "capturing"; + capturedLines = [line]; + return undefined; + } else { + return line; + } + case "capturing": + capturedLines.push(line); + if (line.match(endRegex)) { + state = "scanning"; + + // read the whole figure and clear any capture state + const lines = capturedLines.join("\n"); + capturedLines = []; + + // Process the captions and relocate footnotes + return callback(lines); + } else { + return undefined; + } + } + }; }; }; +const longTableSidenoteProcessor = sideNoteProcessor( + /^\\begin{longtable}.*$/, + /^\\end{longtable}%*$/, + processLongTableSidenotes, +); + +const tableSidenoteProcessor = sideNoteProcessor( + /^\\begin{table}.*$/, + /^\\end{table}%*$/, + processTableSidenotes, +); const calloutFloatHoldLineProcessor = () => { let state: "scanning" | "replacing" = "scanning"; @@ -846,7 +873,10 @@ const longtableBottomCaptionProcessor = () => { capturing = !line.match(/\\tabularnewline$/); return undefined; } else { - if (line.match(/^\\caption.*?\\tabularnewline$/)) { + if ( + line.match(/^\\caption.*?\\tabularnewline$/) || + line.match(/^\\caption{.*}\\\\$/) + ) { caption = line; return undefined; } else if (line.match(/^\\caption.*?/)) { diff --git a/src/format/reveal/format-reveal-theme.ts b/src/format/reveal/format-reveal-theme.ts index d01ba39bf26..7936b9f617c 100644 --- a/src/format/reveal/format-reveal-theme.ts +++ b/src/format/reveal/format-reveal-theme.ts @@ -247,6 +247,7 @@ function pandocVariablesToRevealDefaults( asCssNumber, ); add(explicitVars, "code-block-bg", metadata["monobackgroundcolor"]); + add(explicitVars, "code-block-color", metadata["monoforegroundcolor"]); return explicitVars; } diff --git a/src/format/reveal/format-reveal.ts b/src/format/reveal/format-reveal.ts index 54e33502fae..2e8441e1ca1 100644 --- a/src/format/reveal/format-reveal.ts +++ b/src/format/reveal/format-reveal.ts @@ -799,7 +799,7 @@ function applyStretch(doc: Document, autoStretch: boolean) { imageEl.classList.add("r-stretch"); } - // If is not a direct child of
, move it + // If is not a direct child of
, move it if ( hasStretchClass(imageEl) && imageEl.parentNode?.nodeName !== "SECTION" diff --git a/src/import_map.json b/src/import_map.json index 31213499076..edad2c6f071 100644 --- a/src/import_map.json +++ b/src/import_map.json @@ -46,6 +46,9 @@ "observablehq/parser": "https://cdn.skypack.dev/@observablehq/parser@4.5.0", "js-yaml": "https://cdn.skypack.dev/js-yaml@4.1.0", + "slimdom": "https://cdn.skypack.dev/slimdom@4.2.0", + "fontoxpath": "https://cdn.skypack.dev/fontoxpath@3.29.1", + "https://deno.land/std@0.161.0/": "https://deno.land/std@0.185.0/", "https://deno.land/std@0.101.0/": "https://deno.land/std@0.185.0/", "https://deno.land/std@0.105.0/": "https://deno.land/std@0.185.0/", diff --git a/src/project/project-context.ts b/src/project/project-context.ts index c2419ea5d2d..3ceb66a1281 100644 --- a/src/project/project-context.ts +++ b/src/project/project-context.ts @@ -91,6 +91,10 @@ import { ExtensionContext } from "../extension/types.ts"; import { asArray } from "../core/array.ts"; import { renderFormats } from "../command/render/render-contexts.ts"; import { debug } from "log/mod.ts"; +import { + computeProjectEnvironment, + ProjectEnvironment, +} from "./project-environment.ts"; export async function projectContext( path: string, @@ -112,6 +116,20 @@ export async function projectContext( await projectExtensionsConfigResolver(extensionContext, dir), ]; + // Compute this on demand and only a single time per + // project context + let cachedEnv: ProjectEnvironment | undefined = undefined; + const environment = async ( + project: ProjectContext, + ) => { + if (cachedEnv) { + return Promise.resolve(cachedEnv); + } else { + cachedEnv = await computeProjectEnvironment(project); + return cachedEnv; + } + }; + while (true) { // use the current resolver const resolver = configResolvers[0]; @@ -259,6 +277,7 @@ export async function projectContext( // this is a relatively ugly hack to avoid a circular import chain // that causes a deno bundler bug; renderFormats, + environment, }; } else { const { files, engines } = projectInputFiles(dir); @@ -274,6 +293,7 @@ export async function projectContext( configResources: projectConfigResources(dir, projectConfig), }, renderFormats, + environment, }; } } else { @@ -292,6 +312,7 @@ export async function projectContext( input: [], }, renderFormats, + environment, }; if (Deno.statSync(path).isDirectory) { const { files, engines } = projectInputFiles(originalDir); diff --git a/src/project/project-environment.ts b/src/project/project-environment.ts index 5329ae65bc3..73a0864a749 100644 --- a/src/project/project-environment.ts +++ b/src/project/project-environment.ts @@ -15,6 +15,7 @@ import { isPdfOutput } from "../config/format.ts"; import { ProjectContext } from "../project/types.ts"; import { kLocalDevelopment, quartoConfig } from "../core/quarto.ts"; import { SemVer } from "semver/mod.ts"; +import { GitHubContext, gitHubContext } from "../core/github.ts"; export interface ProjectEnvironment { title: string; @@ -25,6 +26,7 @@ export interface ProjectEnvironment { environments: string[]; openFiles: string[]; envVars: Record; + github: GitHubContext; } export type QuartoEditor = "vscode" | "rstudio" | "jupyterlab"; @@ -42,6 +44,9 @@ export const computeProjectEnvironment = async ( ? "prerelease" : new SemVer(version); + // Compute the GitHub Context + const github = await gitHubContext(context.dir); + const containerCtx: ProjectEnvironment = { title: kDefaultContainerTitle, engines: context.engines, @@ -51,6 +56,7 @@ export const computeProjectEnvironment = async ( environments: [], openFiles: [], envVars: {}, + github, }; // Figure out the editor diff --git a/src/project/types.ts b/src/project/types.ts index 1638654a1c8..dcb488e84c6 100644 --- a/src/project/types.ts +++ b/src/project/types.ts @@ -13,6 +13,7 @@ import { NavigationItemObject as SidebarTool, ProjectConfig as ProjectConfig_Project, } from "../resources/types/schema-types.ts"; +import { ProjectEnvironment } from "./project-environment.ts"; export { type NavigationItem as NavItem, type NavigationItemObject, @@ -53,6 +54,7 @@ export interface ProjectContext { ) => Promise>; outputNameIndex?: Map; + environment: (project: ProjectContext) => Promise; } export interface ProjectFiles { diff --git a/src/project/types/manuscript/manuscript.ts b/src/project/types/manuscript/manuscript.ts index 258f1dd99a3..5b7ce7c08de 100644 --- a/src/project/types/manuscript/manuscript.ts +++ b/src/project/types/manuscript/manuscript.ts @@ -7,7 +7,7 @@ import { resourcePath } from "../../../core/resources.ts"; import { ProjectCreate, ProjectOutputFile, ProjectType } from "../types.ts"; -import { basename, extname, join, relative } from "path/mod.ts"; +import { basename, join, relative } from "path/mod.ts"; import { Format, FormatExtras, @@ -17,7 +17,6 @@ import { kHtmlPostprocessors, Metadata, NotebookPreviewDescriptor, - OtherLink, PandocFlags, } from "../../../config/types.ts"; import { ProjectConfig, ProjectContext } from "../../types.ts"; @@ -35,8 +34,7 @@ import { kKeepHidden, kKeepTex, kLanguageDefaults, - kLaunchBinderTitle, - kLaunchDevContainerTitle, + kLightbox, kManuscriptMecaBundle, kNotebookLinks, kNotebookPreserveCells, @@ -48,6 +46,7 @@ import { kResources, kTheme, kToc, + kTocLocation, kUnrollMarkdownCells, kWarning, } from "../../../config/constants.ts"; @@ -62,7 +61,7 @@ import { RenderResultFile, RenderServices, } from "../../../command/render/types.ts"; -import { GitHubContext, gitHubContext } from "../../../core/github.ts"; +import { gitHubContext } from "../../../core/github.ts"; import { projectInputFiles } from "../../project-context.ts"; import { kGoogleScholar } from "../../../format/html/format-html-meta.ts"; import { resolveInputTarget } from "../../project-index.ts"; @@ -113,6 +112,7 @@ import { safeExistsSync } from "../../../core/path.ts"; import { dirname, isAbsolute } from "path/mod.ts"; import { copySync, ensureDirSync, existsSync } from "fs/mod.ts"; +import { kTitleBlockStyle } from "../../../format/html/format-html-title.ts"; const kMecaIcon = "archive"; const kOutputDir = "_manuscript"; @@ -297,6 +297,12 @@ export const manuscriptProjectType: ProjectType = { // Default to cosmo theme config[kTheme] = "cosmo"; + // Default to manuscript title block style + config[kTitleBlockStyle] = "manuscript"; + + // Default to lightbox auto + config[kLightbox] = "auto"; + return config; }, create: (title: string): ProjectCreate => { @@ -426,6 +432,10 @@ export const manuscriptProjectType: ProjectType = { // Target index.html as its output format.pandoc[kOutputFile] = "index.html"; } + + if (format.metadata[kTocLocation] === undefined) { + format.metadata[kTocLocation] = "left"; + } } } @@ -506,16 +516,8 @@ export const manuscriptProjectType: ProjectType = { manuscriptConfig, ); if (isArticle && isHtmlOutput(format.pandoc)) { - // Inject code links - const outputCodeLinks = await computeCodeLinks( - source, - format, - manuscriptConfig, - context, - ); - if (outputCodeLinks.length > 0) { - extras.metadata[kCodeLinks] = outputCodeLinks; - } + // Forward code links + extras.metadata[kCodeLinks] = manuscriptConfig[kCodeLinks]; // If the user isn't explicitly providing a notebook list // then automatically create notebooks for the other items in @@ -719,116 +721,6 @@ const resolveNotebookDescriptors = ( return resolvedNbs; }; -const kCodeLinkTypes = ["repo", "binder", "devcontainer"]; -const kNoCodelinks: string[] = []; - -const computeCodeLinks = async ( - source: string, - format: Format, - manuscriptConfig: ResolvedManuscriptConfig, - context: ProjectContext, -) => { - if (format.metadata[kCodeLinks] === false) { - return []; - } - - // Resolve the other links - const codeLinks = resolveCodeLinks(manuscriptConfig); - - let cachedContext: GitHubContext | undefined = undefined; - const getGhContext = async () => { - if (cachedContext === undefined) { - cachedContext = await gitHubContext(context.dir); - } - return cachedContext; - }; - - const outputCodeLinks: OtherLink[] = []; - for (const codeLink of codeLinks) { - if (typeof (codeLink) === "string") { - if (kCodeLinkTypes.includes(codeLink)) { - const ghContext = await getGhContext(); - if (ghContext) { - const repoUrl = ghContext.repoUrl; - if (codeLink === "repo" && repoUrl) { - const repoLink: OtherLink = { - icon: "github", - text: "GitHub Repo", - href: repoUrl, - target: "_blank", - }; - outputCodeLinks.push(repoLink); - } else if (codeLink === "devcontainer" && repoUrl) { - if ( - ghContext.organization && ghContext.repository && - hasDevContainer(context.dir) - ) { - const containerUrl = codeSpacesUrl(repoUrl); - const containerLink: OtherLink = { - icon: "github", - text: format.language[kLaunchDevContainerTitle] || - "Launch Dev Container", - href: containerUrl, - target: "_blank", - }; - outputCodeLinks.push(containerLink); - } - } else if ( - codeLink === "binder" && - ghContext.organization && ghContext.repository && - hasBinderCompatibleEnvironment(context.dir) - ) { - // Compute the project environment and use that to customize the binder options - const projEnv = await computeProjectEnvironment(context); - - const containerUrl = binderUrl( - ghContext.organization, - ghContext.repository, - { - openFile: extname(source) === ".ipynb" ? source : undefined, - editor: projEnv.codeEnvironment, - }, - ); - const containerLink: OtherLink = { - icon: "journals", - text: format.language[kLaunchBinderTitle] || - "Launch Binder", - href: containerUrl, - target: "_blank", - }; - outputCodeLinks.push(containerLink); - } - } - } else { - throw new Error( - `Unknown value '${codeLink}' for code-links. Allowed values include ${ - kCodeLinkTypes.join(", ") - }`, - ); - } - } else { - outputCodeLinks.push(codeLink); - } - } - return outputCodeLinks; -}; - -const resolveCodeLinks = ( - config: ResolvedManuscriptConfig, -): Array => { - const codeLinks = config[kCodeLinks]; - if (codeLinks !== undefined) { - if (typeof (codeLinks) === "boolean") { - return codeLinks ? kCodeLinkTypes : kNoCodelinks; - } else if (typeof (codeLinks) === "string") { - return [codeLinks]; - } else { - return codeLinks; - } - } - return kCodeLinkTypes; -}; - const kTexOutDir = "_tex"; const createTexOutputBundle = ( outputFile: RenderResultFile, diff --git a/src/project/types/website/listing/website-listing-read.ts b/src/project/types/website/listing/website-listing-read.ts index 5a845fdcd2e..80f31ce04e3 100644 --- a/src/project/types/website/listing/website-listing-read.ts +++ b/src/project/types/website/listing/website-listing-read.ts @@ -520,7 +520,10 @@ function hydrateListing( // If the items have come from metadata, we should just show // all the columns in the table. Otherwise, we should use the // document default columns - return itemFields; + const undisplayable = ["path"]; + return itemFields.filter((field) => { + return !undisplayable.includes(field); + }); } else { return defaultFields(type, itemFields); } @@ -740,66 +743,76 @@ async function readContents( const files = filterListingFiles(contentGlobs); debug(`[listing] matches ${files.include.length} files:`); - for (const file of files.include) { - if (!files.exclude.includes(file)) { - if (isYamlPath(file)) { - debug(`[listing] Reading YAML file ${file}`); - const yaml = readYaml(file); - if (Array.isArray(yaml)) { - const items = yaml as Array; - for (const yamlItem of items) { - if (typeof (yamlItem) === "object") { - const { item, source } = await listItemFromMeta( - yamlItem as Metadata, - project, - listing, - dirname(file), - ); - validateItem(listing, item, (field: string) => { - return `An item from the file '${file}' is missing the required field '${field}'.`; - }); - listingItemSources.add(source); - listingItems.push(item); - } else { - throw new Error( - `Unexpected listing contents in file ${file}. The array may only contain listing items, not paths or other types of data.`, - ); - } + const readFiles = files.include.filter((file) => { + return !files.exclude.includes(file); + }); + if (readFiles.length === 0) { + const projRelativePath = relative(project.dir, source); + throw new Error( + `The listing in '${projRelativePath}' using the following contents:\n- ${ + contentGlobs.join("\n- ") + }\ndoesn't match any files or folders.`, + ); + } + + for (const file of readFiles) { + if (isYamlPath(file)) { + debug(`[listing] Reading YAML file ${file}`); + const yaml = readYaml(file); + if (Array.isArray(yaml)) { + const items = yaml as Array; + for (const yamlItem of items) { + if (typeof (yamlItem) === "object") { + const { item, source } = await listItemFromMeta( + yamlItem as Metadata, + project, + listing, + dirname(file), + ); + validateItem(listing, item, (field: string) => { + return `An item from the file '${file}' is missing the required field '${field}'.`; + }); + listingItemSources.add(source); + listingItems.push(item); + } else { + throw new Error( + `Unexpected listing contents in file ${file}. The array may only contain listing items, not paths or other types of data.`, + ); } - } else if (typeof (yaml) === "object") { - const { item, source } = await listItemFromMeta( - yaml as Metadata, - project, - listing, - dirname(file), - ); - validateItem(listing, item, (field: string) => { - return `The item defined in file '${file}' is missing the required field '${field}'.`; - }); - listingItemSources.add(source); - listingItems.push(item); - } else { - throw new Error( - `Unexpected listing contents in file ${file}. The file should contain only one more listing items.`, - ); } + } else if (typeof (yaml) === "object") { + const { item, source } = await listItemFromMeta( + yaml as Metadata, + project, + listing, + dirname(file), + ); + validateItem(listing, item, (field: string) => { + return `The item defined in file '${file}' is missing the required field '${field}'.`; + }); + listingItemSources.add(source); + listingItems.push(item); } else { - const isFile = Deno.statSync(file).isFile; - if (isFile) { - debug(`[listing] Reading file ${file}`); - const item = await listItemFromFile(file, project, listing); - if (item) { - validateItem(listing, item, (field: string) => { - return `The file ${file} is missing the required field '${field}'.`; - }); - - if (item.item.title === undefined) { - debug(`[listing] Missing Title in File ${file}`); - } + throw new Error( + `Unexpected listing contents in file ${file}. The file should contain only one more listing items.`, + ); + } + } else { + const isFile = Deno.statSync(file).isFile; + if (isFile) { + debug(`[listing] Reading file ${file}`); + const item = await listItemFromFile(file, project, listing); + if (item) { + validateItem(listing, item, (field: string) => { + return `The file ${file} is missing the required field '${field}'.`; + }); - listingItemSources.add(item.source); - listingItems.push(item.item); + if (item.item.title === undefined) { + debug(`[listing] Missing Title in File ${file}`); } + + listingItemSources.add(item.source); + listingItems.push(item.item); } } } diff --git a/src/project/types/website/listing/website-listing-shared.ts b/src/project/types/website/listing/website-listing-shared.ts index c15ab7a72ed..53f54a0c684 100644 --- a/src/project/types/website/listing/website-listing-shared.ts +++ b/src/project/types/website/listing/website-listing-shared.ts @@ -278,14 +278,23 @@ export const renderedContentReader = ( }; }; +const isWebUrl = (url: string) => { + return url.startsWith("http:") || url.startsWith("https:"); +}; + export const absoluteUrl = (siteUrl: string, url: string) => { - if (url.startsWith("http:") || url.startsWith("https:")) { + if (isWebUrl(url)) { return url; } else { const baseUrl = siteUrl.endsWith("/") ? siteUrl.substring(0, siteUrl.length - 1) : siteUrl; - const path = url.startsWith("/") ? url.substring(1, url.length) : url; + let path = url.startsWith("/") ? url.substring(1, url.length) : url; + if (path.endsWith("/index.html")) { + path = join(dirname(path), "/"); + } else if (path === "index.html") { + path = ""; + } return `${baseUrl}/${path.replaceAll("\\", "/")}`; } }; @@ -330,7 +339,7 @@ export function readRenderedContents( const imgEl = imgNode as Element; let src = imgEl.getAttribute("src"); if (src) { - if (!src.startsWith("/")) { + if (!src.startsWith("/") && !isWebUrl(src)) { src = join(fileRelFolder, src); } imgEl.setAttribute("src", absoluteUrl(siteUrl, src)); diff --git a/src/project/types/website/website-config.ts b/src/project/types/website/website-config.ts index 928b849e410..d69217db603 100644 --- a/src/project/types/website/website-config.ts +++ b/src/project/types/website/website-config.ts @@ -143,6 +143,21 @@ export function websiteConfig( } } +export function websiteConfigUnknown( + name: WebsiteConfigKey, + project?: ProjectConfig, +) { + const site = project?.[kWebsite] as + | Record + | undefined; + + if (site) { + return site[name] as unknown; + } else { + return undefined; + } +} + export function websiteTitle(project?: ProjectConfig): string | undefined { return websiteConfigString(kSiteTitle, project); } @@ -398,15 +413,18 @@ export function websiteProjectConfig( // move any `other links` into the main config so it is merged if ( - websiteConfigArray(kOtherLinks, config) && + websiteConfigUnknown(kOtherLinks, config) && (config[kOtherLinks] === undefined) ) { - config[kOtherLinks] = websiteConfigArray(kOtherLinks, config); + config[kOtherLinks] = websiteConfigUnknown(kOtherLinks, config); } // move `code links` too - if (websiteConfigArray(kCodeLinks, config) && (config[kCodeLinks])) { - config[kCodeLinks] = websiteConfigArray(kCodeLinks, config); + if ( + websiteConfigUnknown(kCodeLinks, config) && + (config[kCodeLinks] === undefined) + ) { + config[kCodeLinks] = websiteConfigUnknown(kCodeLinks, config); } return Promise.resolve(config); diff --git a/src/project/types/website/website-navigation.ts b/src/project/types/website/website-navigation.ts index b76970f71ca..20902e394e6 100644 --- a/src/project/types/website/website-navigation.ts +++ b/src/project/types/website/website-navigation.ts @@ -1438,6 +1438,7 @@ async function resolveItem( }; } } else { + item.text = item.text || item.href; return item; } } diff --git a/src/publish/posit-cloud/api/index.ts b/src/publish/posit-cloud/api/index.ts index 5ac873aff10..87872adb473 100644 --- a/src/publish/posit-cloud/api/index.ts +++ b/src/publish/posit-cloud/api/index.ts @@ -18,7 +18,7 @@ import { import { md5Hash } from "../../../core/hash.ts"; import { quartoConfig } from "../../../core/quarto.ts"; -import { crypto } from "https://deno.land/std@0.185.0/crypto/mod.ts"; +import { crypto } from "crypto/mod.ts"; import { decode as base64Decode, diff --git a/src/resources/create/extensions/revealjs-plugin/_extensions/qstart-filesafename-qend/qstart-filesafename-qend.js b/src/resources/create/extensions/revealjs-plugin/_extensions/qstart-filesafename-qend/qstart-filesafename-qend.ejs.js similarity index 100% rename from src/resources/create/extensions/revealjs-plugin/_extensions/qstart-filesafename-qend/qstart-filesafename-qend.js rename to src/resources/create/extensions/revealjs-plugin/_extensions/qstart-filesafename-qend/qstart-filesafename-qend.ejs.js diff --git a/src/resources/editor/tools/vs-code.mjs b/src/resources/editor/tools/vs-code.mjs index 000cc37ed08..7e05e3afc23 100644 --- a/src/resources/editor/tools/vs-code.mjs +++ b/src/resources/editor/tools/vs-code.mjs @@ -7212,7 +7212,7 @@ var require_yaml_intelligence_resources = __commonJS({ }, description: { short: "Include cell source code in rendered output.", - long: "Include cell source code in rendered output.\n\n- `true` (default): include source code in output\n- `false`: do not include source code in output\n- `fenced`: in addition to echoing, include the cell delimiter as part of the output.\n- `[...]`: A list of positive or negative line numbers to selectively include or exclude lines\n (explicit inclusion/excusion of lines is available only when using the knitr engine)\n" + long: "Include cell source code in rendered output.\n\n- `true` (default in most formats): include source code in output\n- `false` (default in presentation formats like `beamer`, `revealjs`, and `pptx`): do not include source code in output\n- `fenced`: in addition to echoing, include the cell delimiter as part of the output.\n- `[...]`: A list of positive or negative line numbers to selectively include or exclude lines\n (explicit inclusion/excusion of lines is available only when using the knitr engine)\n" } }, { @@ -7320,7 +7320,17 @@ var require_yaml_intelligence_resources = __commonJS({ tags: { engine: "knitr" }, - schema: "boolean", + schema: { + anyOf: [ + "boolean", + { + enum: [ + "styler", + "formatR" + ] + } + ] + }, default: false, description: "Whether to reformat R code." }, @@ -9676,7 +9686,7 @@ var require_yaml_intelligence_resources = __commonJS({ anyOf: [ "boolean", { - ref: "other-links" + ref: "code-links-schema" } ] }, @@ -11293,6 +11303,58 @@ var require_yaml_intelligence_resources = __commonJS({ } } }, + { + id: "code-links-schema", + schema: { + anyOf: [ + "boolean", + { + maybeArrayOf: { + anyOf: [ + { + object: { + properties: { + icon: { + string: { + description: "The bootstrap icon for this code link." + } + }, + text: { + string: { + description: "The text for this code link." + } + }, + href: { + string: { + description: "The href for this code link." + } + }, + rel: { + string: { + description: "The rel used in the `a` tag for this code link." + } + }, + target: { + string: { + description: "The target used in the `a` tag for this code link." + } + } + } + } + }, + { + enum: [ + "repo", + "binder", + "devcontainer" + ] + } + ] + } + } + ] + } + }, { id: "manuscript-schema", schema: { @@ -11305,17 +11367,10 @@ var require_yaml_intelligence_resources = __commonJS({ } }, "code-links": { - anyOf: [ - "boolean", - { - maybeArrayOf: { - anyOf: [ - "object", - "string" - ] - } - } - ] + schema: { + ref: "code-links-schema" + }, + description: "Code links to display for this manuscript." }, "manuscript-url": { string: { @@ -11401,7 +11456,8 @@ var require_yaml_intelligence_resources = __commonJS({ "$html-all", "context", "muse", - "odt" + "odt", + "docx" ] }, description: "Identifies the subtitle of the document." @@ -11526,7 +11582,8 @@ var require_yaml_intelligence_resources = __commonJS({ "$jats-all", "context", "ms", - "odt" + "odt", + "docx" ] }, description: "Summary of document" @@ -11537,7 +11594,8 @@ var require_yaml_intelligence_resources = __commonJS({ tags: { formats: [ "$html-doc", - "$epub-all" + "$epub-all", + "docx" ] }, description: "Title used to label document abstract" @@ -11895,6 +11953,22 @@ var require_yaml_intelligence_resources = __commonJS({ }, description: "Sets the CSS `background-color` property on code elements and adds extra padding." }, + { + name: "monoforegroundcolor", + schema: "string", + tags: { + formats: [ + "html", + "html4", + "html5", + "slidy", + "slideous", + "s5", + "dzslides" + ] + }, + description: "Sets the CSS `color` property on code elements and adds extra padding." + }, { name: "backgroundcolor", schema: "string", @@ -12011,6 +12085,47 @@ var require_yaml_intelligence_resources = __commonJS({ object: { closed: true, properties: { + custom: { + arrayOf: { + object: { + description: "A custom cross reference type.", + closed: true, + properties: { + kind: { + enum: [ + "float" + ], + description: 'The kind of cross reference (currently only "float" is supported).' + }, + prefix: { + string: { + description: "The prefix used in rendered citations when referencing this type." + } + }, + name: { + string: { + description: "The prefix used in captions when referencing this type." + } + }, + "ref-type": { + string: { + description: 'The prefix string used in references ("dia-", etc.) when referencing this type.' + } + }, + "latex-env": { + string: { + description: "The name of the custom LaTeX environment that quarto will use to create this type of crossreferenceable object in LaTeX output." + } + }, + "latex-list-of-name": { + string: { + description: 'The name of the custom LaTeX "list of" command that quarto will use to create this type of crossreferenceable object in LaTeX output.' + } + } + } + } + } + }, chapters: { boolean: { description: "Use top level sections (H1) in this document as chapters.", @@ -13384,11 +13499,6 @@ var require_yaml_intelligence_resources = __commonJS({ object: { closed: true, properties: { - id: { - string: { - description: "Unique identifier assigned to an award, contract, or grant." - } - }, statement: { string: { description: "Displayable prose statement that describes the funding for the research on which a work was based." @@ -13399,125 +13509,148 @@ var require_yaml_intelligence_resources = __commonJS({ description: "Open access provisions that apply to a work or the funding information that provided the open access provisions." } }, - source: { - maybeArrayOf: { - anyOf: [ - "string", - { - object: { - closed: true, - properties: { - text: { - string: { - description: "The text describing the source of the funding." - } - }, - country: { - string: { - description: { - short: "Abbreviation for country where source of grant is located.", - long: "Abbreviation for country where source of grant is located.\nWhenever possible, ISO 3166-1 2-letter alphabetic codes should be used.\n" - } - } - } - } - } - } - ] - }, - description: "Agency or organization that funded the research on which a work was based." - }, - recipient: { + awards: { maybeArrayOf: { - anyOf: [ - "string", - { - object: { - closed: true, - properties: { - ref: { - string: { - description: "The id of an author or affiliation in the document metadata." - } - } + object: { + properties: { + id: { + string: { + description: "Unique identifier assigned to an award, contract, or grant." } - } - }, - { - object: { - closed: true, - properties: { - name: { - string: { - description: "The name of an individual that was the recipient of the funding." - } - } + }, + name: { + string: { + description: "The name of this award" } - } - }, - { - object: { - closed: true, - properties: { - institution: { - anyOf: [ - "string", - "object" - ], - description: "The institution that was the recipient of the funding." - } + }, + description: { + string: { + description: "The description for this award." } - } - } - ] - }, - description: "Individual(s) or institution(s) to whom the award was given (for example, the principal grant holder or the sponsored individual)." - }, - investigator: { - maybeArrayOf: { - anyOf: [ - "string", - { - object: { - closed: true, - properties: { - ref: { - string: { - description: "The id of an author or affiliation in the document metadata." + }, + source: { + maybeArrayOf: { + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + text: { + string: { + description: "The text describing the source of the funding." + } + }, + country: { + string: { + description: { + short: "Abbreviation for country where source of grant is located.", + long: "Abbreviation for country where source of grant is located.\nWhenever possible, ISO 3166-1 2-letter alphabetic codes should be used.\n" + } + } + } + } + } } - } - } - } - }, - { - object: { - closed: true, - properties: { - name: { - string: { - description: "The name of an individual that was responsible for the intellectual content of the work reported in the document." + ] + }, + description: "Agency or organization that funded the research on which a work was based." + }, + recipient: { + maybeArrayOf: { + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + ref: { + string: { + description: "The id of an author or affiliation in the document metadata." + } + } + } + } + }, + { + object: { + closed: true, + properties: { + name: { + string: { + description: "The name of an individual that was the recipient of the funding." + } + } + } + } + }, + { + object: { + closed: true, + properties: { + institution: { + anyOf: [ + "string", + "object" + ], + description: "The institution that was the recipient of the funding." + } + } + } } - } - } - } - }, - { - object: { - closed: true, - properties: { - institution: { - anyOf: [ - "string", - "object" - ], - description: "The institution that was responsible for the intellectual content of the work reported in the document." - } - } + ] + }, + description: "Individual(s) or institution(s) to whom the award was given (for example, the principal grant holder or the sponsored individual)." + }, + investigator: { + maybeArrayOf: { + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + ref: { + string: { + description: "The id of an author or affiliation in the document metadata." + } + } + } + } + }, + { + object: { + closed: true, + properties: { + name: { + string: { + description: "The name of an individual that was responsible for the intellectual content of the work reported in the document." + } + } + } + } + }, + { + object: { + closed: true, + properties: { + institution: { + anyOf: [ + "string", + "object" + ], + description: "The institution that was responsible for the intellectual content of the work reported in the document." + } + } + } + } + ] + }, + description: "Individual(s) responsible for the intellectual content of the work reported in the document." } } - ] - }, - description: "Individual(s) responsible for the intellectual content of the work reported in the document." + } + } } } } @@ -14672,7 +14805,7 @@ var require_yaml_intelligence_resources = __commonJS({ ] }, { - ref: "other-links" + ref: "code-links-schema" } ] }, @@ -14815,7 +14948,9 @@ var require_yaml_intelligence_resources = __commonJS({ "$asciidoc-all", "$html-files", "$pdf-all", - "context" + "context", + "odt", + "$office-all" ] }, description: "List of keywords to be included in the document metadata." @@ -14826,7 +14961,8 @@ var require_yaml_intelligence_resources = __commonJS({ tags: { formats: [ "$pdf-all", - "$office-all" + "$office-all", + "odt" ] }, description: "The document subject" @@ -14836,6 +14972,7 @@ var require_yaml_intelligence_resources = __commonJS({ schema: "string", tags: { formats: [ + "odt", "$office-all" ] }, @@ -14933,7 +15070,7 @@ var require_yaml_intelligence_resources = __commonJS({ }, description: { short: "The License for this document, if any. (e.g. `CC BY`)", - long: "The license for this document, if any. \n\nCreative Commons licenses `CC BY`, `CC BY-SA`, `CC BY-ND`, `CC BY-NC` will automatically generate a license link\nin the document appendix. Other license text will be placed in the appendix verbatim.\n" + long: "The license for this document, if any. \n\nCreative Commons licenses `CC BY`, `CC BY-SA`, `CC BY-ND`, `CC BY-NC`, `CC BY-NC-SA`, and `CC BY-NC-ND` will automatically generate a license link\nin the document appendix. Other license text will be placed in the appendix verbatim.\n" } }, { @@ -19809,7 +19946,18 @@ var require_yaml_intelligence_resources = __commonJS({ "The title of the notebook when viewed.", "The url to use when viewing this notebook.", "The url to use when downloading the notebook from the preview", + "The bootstrap icon for this code link.", + "The text for this code link.", + "The href for this code link.", + "The rel used in the a tag for this code link.", + "The target used in the a tag for this code link.", + "The bootstrap icon for this code link.", + "The text for this code link.", + "The href for this code link.", + "The rel used in the a tag for this code link.", + "The target used in the a tag for this code link.", "The input document that will serve as the root document for this\nmanuscript", + "Code links to display for this manuscript.", "The deployed url for this manuscript", "Whether to generate a MECA bundle for this manuscript", "Additional file resources to be copied to output directory", @@ -20092,6 +20240,13 @@ var require_yaml_intelligence_resources = __commonJS({ }, "Configuration for document commenting.", "Configuration for crossref labels and prefixes.", + "A custom cross reference type.", + "The kind of cross reference (currently only \u201Cfloat\u201D is\nsupported).", + "The prefix used in rendered citations when referencing this type.", + "The prefix used in captions when referencing this type.", + "The prefix string used in references (\u201Cdia-\u201D, etc.) when referencing\nthis type.", + "The name of the custom LaTeX environment that quarto will use to\ncreate this type of crossreferenceable object in LaTeX output.", + "The name of the custom LaTeX \u201Clist of\u201D command that quarto will use\nto create this type of crossreferenceable object in LaTeX output.", "Use top level sections (H1) in this document as chapters.", "The delimiter used between the prefix and the caption.", "The title prefix used for figure captions.", @@ -20330,9 +20485,11 @@ var require_yaml_intelligence_resources = __commonJS({ long: "Specify the heading level at which to split the EPUB into separate\nchapter files. The default is to split into chapters at level-1\nheadings. This option only affects the internal composition of the EPUB,\nnot the way chapters and sections are displayed to users. Some readers\nmay be slow if the chapter files are too large, so for large documents\nwith few level-1 headings, one might want to use a chapter level of 2 or\n3." }, "Information about the funding of the research reported in the article\n(for example, grants, contracts, sponsors) and any open access fees for\nthe article itself", - "Unique identifier assigned to an award, contract, or grant.", "Displayable prose statement that describes the funding for the\nresearch on which a work was based.", "Open access provisions that apply to a work or the funding\ninformation that provided the open access provisions.", + "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", "Agency or organization that funded the research on which a work was\nbased.", "The text describing the source of the funding.", { @@ -20359,8 +20516,66 @@ var require_yaml_intelligence_resources = __commonJS({ "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", "The institution that was responsible for the intellectual content of\nthe work reported in the document.", "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", + "Agency or organization that funded the research on which a work was\nbased.", + "The text describing the source of the funding.", + { + short: "Abbreviation for country where source of grant is located.", + long: "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "The text describing the source of the funding.", + { + short: "Abbreviation for country where source of grant is located.", + long: "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "Individual(s) or institution(s) to whom the award was given (for\nexample, the principal grant holder or the sponsored individual).", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "Individual(s) responsible for the intellectual content of the work\nreported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", "Displayable prose statement that describes the funding for the\nresearch on which a work was based.", "Open access provisions that apply to a work or the funding\ninformation that provided the open access provisions.", + "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", + "Agency or organization that funded the research on which a work was\nbased.", + "The text describing the source of the funding.", + { + short: "Abbreviation for country where source of grant is located.", + long: "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "The text describing the source of the funding.", + { + short: "Abbreviation for country where source of grant is located.", + long: "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "Individual(s) or institution(s) to whom the award was given (for\nexample, the principal grant holder or the sponsored individual).", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "Individual(s) responsible for the intellectual content of the work\nreported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", + "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", "Agency or organization that funded the research on which a work was\nbased.", "The text describing the source of the funding.", { @@ -20601,7 +20816,7 @@ var require_yaml_intelligence_resources = __commonJS({ "The text to display for the license.", { short: "The License for this document, if any. (e.g. CC BY)", - long: "The license for this document, if any.\nCreative Commons licenses CC BY, CC BY-SA,\nCC BY-ND, CC BY-NC will automatically generate\na license link in the document appendix. Other license text will be\nplaced in the appendix verbatim." + long: "The license for this document, if any.\nCreative Commons licenses CC BY, CC BY-SA,\nCC BY-ND, CC BY-NC, CC BY-NC-SA,\nand CC BY-NC-ND will automatically generate a license link\nin the document appendix. Other license text will be placed in the\nappendix verbatim." }, "The type of the license.", "A URL to the license.", @@ -21338,6 +21553,15 @@ var require_yaml_intelligence_resources = __commonJS({ "Disambiguating year suffix in author-date styles (e.g. \u201Ca\u201D in \u201CDoe,\n1999a\u201D).", "Manuscript configuration", "internal-schema-hack", + "Enable or disable lightbox treatment for images in this document.", + { + short: "Set this to auto if you\u2019d like any image to be given\nlightbox treatment.", + long: "Set this to auto if you\u2019d like any image to be given\nlightbox treatment. If you omit this, only images with the class\nlightbox will be given the lightbox treatment." + }, + "The effect that should be used when opening and closing the lightbox.\nOne of fade, zoom, none. Defaults\nto zoom.", + "The position of the title and description when displaying a lightbox.\nOne of top, bottom, left,\nright. Defaults to bottom.", + "Whether galleries should \u2018loop\u2019 to first image in the gallery if the\nuser continues past the last image of the gallery. Boolean that defaults\nto true.", + "A class name to apply to the lightbox to allow css targeting. This\nwill replace the lightbox class with your custom class name.", "Project configuration.", "Project type (default, website,\nbook, or manuscript)", "Files to render (defaults to all files)", @@ -21652,7 +21876,8 @@ var require_yaml_intelligence_resources = __commonJS({ }, "Disambiguating year suffix in author-date styles (e.g. \u201Ca\u201D in \u201CDoe,\n1999a\u201D).", "Manuscript configuration", - "internal-schema-hack" + "internal-schema-hack", + "Sets the CSS color property on code elements and adds\nextra padding." ], "schema/external-schemas.yml": [ { @@ -21876,12 +22101,12 @@ var require_yaml_intelligence_resources = __commonJS({ mermaid: "%%" }, "handlers/mermaid/schema.yml": { - _internalId: 163250, + _internalId: 167856, type: "object", description: "be an object", properties: { "mermaid-format": { - _internalId: 163242, + _internalId: 167848, type: "enum", enum: [ "png", @@ -21897,7 +22122,7 @@ var require_yaml_intelligence_resources = __commonJS({ exhaustiveCompletions: true }, theme: { - _internalId: 163249, + _internalId: 167855, type: "anyOf", anyOf: [ { @@ -21937,7 +22162,77 @@ var require_yaml_intelligence_resources = __commonJS({ "case-detection": true }, $id: "handlers/mermaid" - } + }, + "schema/document-lightbox.yml": [ + { + name: "lightbox", + schema: { + anyOf: [ + "boolean", + { + enum: [ + "auto" + ] + }, + { + object: { + closed: true, + properties: { + match: { + schema: { + enum: [ + "auto" + ] + }, + description: { + short: "Set this to `auto` if you'd like any image to be given lightbox treatment.", + long: "Set this to `auto` if you'd like any image to be given lightbox treatment. If you omit this, only images with the class `lightbox` will be given the lightbox treatment.\n" + } + }, + effect: { + schema: { + enum: [ + "fade", + "zoom", + "none" + ] + }, + description: "The effect that should be used when opening and closing the lightbox. One of `fade`, `zoom`, `none`. Defaults to `zoom`." + }, + "desc-position": { + schema: { + enum: [ + "top", + "bottom", + "left", + "right" + ] + }, + description: "The position of the title and description when displaying a lightbox. One of `top`, `bottom`, `left`, `right`. Defaults to `bottom`." + }, + loop: { + boolean: { + description: "Whether galleries should 'loop' to first image in the gallery if the user continues past the last image of the gallery. Boolean that defaults to `true`." + } + }, + "css-class": { + string: { + description: "A class name to apply to the lightbox to allow css targeting. This will replace the lightbox class with your custom class name." + } + } + } + } + } + ] + }, + tags: { + formats: [ + "$html-doc" + ] + }, + description: "Enable or disable lightbox treatment for images in this document." + } + ] }; } }); diff --git a/src/resources/editor/tools/yaml/web-worker.js b/src/resources/editor/tools/yaml/web-worker.js index f7c6f151877..d93599eb0d9 100644 --- a/src/resources/editor/tools/yaml/web-worker.js +++ b/src/resources/editor/tools/yaml/web-worker.js @@ -7213,7 +7213,7 @@ try { }, description: { short: "Include cell source code in rendered output.", - long: "Include cell source code in rendered output.\n\n- `true` (default): include source code in output\n- `false`: do not include source code in output\n- `fenced`: in addition to echoing, include the cell delimiter as part of the output.\n- `[...]`: A list of positive or negative line numbers to selectively include or exclude lines\n (explicit inclusion/excusion of lines is available only when using the knitr engine)\n" + long: "Include cell source code in rendered output.\n\n- `true` (default in most formats): include source code in output\n- `false` (default in presentation formats like `beamer`, `revealjs`, and `pptx`): do not include source code in output\n- `fenced`: in addition to echoing, include the cell delimiter as part of the output.\n- `[...]`: A list of positive or negative line numbers to selectively include or exclude lines\n (explicit inclusion/excusion of lines is available only when using the knitr engine)\n" } }, { @@ -7321,7 +7321,17 @@ try { tags: { engine: "knitr" }, - schema: "boolean", + schema: { + anyOf: [ + "boolean", + { + enum: [ + "styler", + "formatR" + ] + } + ] + }, default: false, description: "Whether to reformat R code." }, @@ -9677,7 +9687,7 @@ try { anyOf: [ "boolean", { - ref: "other-links" + ref: "code-links-schema" } ] }, @@ -11294,6 +11304,58 @@ try { } } }, + { + id: "code-links-schema", + schema: { + anyOf: [ + "boolean", + { + maybeArrayOf: { + anyOf: [ + { + object: { + properties: { + icon: { + string: { + description: "The bootstrap icon for this code link." + } + }, + text: { + string: { + description: "The text for this code link." + } + }, + href: { + string: { + description: "The href for this code link." + } + }, + rel: { + string: { + description: "The rel used in the `a` tag for this code link." + } + }, + target: { + string: { + description: "The target used in the `a` tag for this code link." + } + } + } + } + }, + { + enum: [ + "repo", + "binder", + "devcontainer" + ] + } + ] + } + } + ] + } + }, { id: "manuscript-schema", schema: { @@ -11306,17 +11368,10 @@ try { } }, "code-links": { - anyOf: [ - "boolean", - { - maybeArrayOf: { - anyOf: [ - "object", - "string" - ] - } - } - ] + schema: { + ref: "code-links-schema" + }, + description: "Code links to display for this manuscript." }, "manuscript-url": { string: { @@ -11402,7 +11457,8 @@ try { "$html-all", "context", "muse", - "odt" + "odt", + "docx" ] }, description: "Identifies the subtitle of the document." @@ -11527,7 +11583,8 @@ try { "$jats-all", "context", "ms", - "odt" + "odt", + "docx" ] }, description: "Summary of document" @@ -11538,7 +11595,8 @@ try { tags: { formats: [ "$html-doc", - "$epub-all" + "$epub-all", + "docx" ] }, description: "Title used to label document abstract" @@ -11896,6 +11954,22 @@ try { }, description: "Sets the CSS `background-color` property on code elements and adds extra padding." }, + { + name: "monoforegroundcolor", + schema: "string", + tags: { + formats: [ + "html", + "html4", + "html5", + "slidy", + "slideous", + "s5", + "dzslides" + ] + }, + description: "Sets the CSS `color` property on code elements and adds extra padding." + }, { name: "backgroundcolor", schema: "string", @@ -12012,6 +12086,47 @@ try { object: { closed: true, properties: { + custom: { + arrayOf: { + object: { + description: "A custom cross reference type.", + closed: true, + properties: { + kind: { + enum: [ + "float" + ], + description: 'The kind of cross reference (currently only "float" is supported).' + }, + prefix: { + string: { + description: "The prefix used in rendered citations when referencing this type." + } + }, + name: { + string: { + description: "The prefix used in captions when referencing this type." + } + }, + "ref-type": { + string: { + description: 'The prefix string used in references ("dia-", etc.) when referencing this type.' + } + }, + "latex-env": { + string: { + description: "The name of the custom LaTeX environment that quarto will use to create this type of crossreferenceable object in LaTeX output." + } + }, + "latex-list-of-name": { + string: { + description: 'The name of the custom LaTeX "list of" command that quarto will use to create this type of crossreferenceable object in LaTeX output.' + } + } + } + } + } + }, chapters: { boolean: { description: "Use top level sections (H1) in this document as chapters.", @@ -13385,11 +13500,6 @@ try { object: { closed: true, properties: { - id: { - string: { - description: "Unique identifier assigned to an award, contract, or grant." - } - }, statement: { string: { description: "Displayable prose statement that describes the funding for the research on which a work was based." @@ -13400,125 +13510,148 @@ try { description: "Open access provisions that apply to a work or the funding information that provided the open access provisions." } }, - source: { - maybeArrayOf: { - anyOf: [ - "string", - { - object: { - closed: true, - properties: { - text: { - string: { - description: "The text describing the source of the funding." - } - }, - country: { - string: { - description: { - short: "Abbreviation for country where source of grant is located.", - long: "Abbreviation for country where source of grant is located.\nWhenever possible, ISO 3166-1 2-letter alphabetic codes should be used.\n" - } - } - } - } - } - } - ] - }, - description: "Agency or organization that funded the research on which a work was based." - }, - recipient: { + awards: { maybeArrayOf: { - anyOf: [ - "string", - { - object: { - closed: true, - properties: { - ref: { - string: { - description: "The id of an author or affiliation in the document metadata." - } - } + object: { + properties: { + id: { + string: { + description: "Unique identifier assigned to an award, contract, or grant." } - } - }, - { - object: { - closed: true, - properties: { - name: { - string: { - description: "The name of an individual that was the recipient of the funding." - } - } + }, + name: { + string: { + description: "The name of this award" } - } - }, - { - object: { - closed: true, - properties: { - institution: { - anyOf: [ - "string", - "object" - ], - description: "The institution that was the recipient of the funding." - } + }, + description: { + string: { + description: "The description for this award." } - } - } - ] - }, - description: "Individual(s) or institution(s) to whom the award was given (for example, the principal grant holder or the sponsored individual)." - }, - investigator: { - maybeArrayOf: { - anyOf: [ - "string", - { - object: { - closed: true, - properties: { - ref: { - string: { - description: "The id of an author or affiliation in the document metadata." + }, + source: { + maybeArrayOf: { + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + text: { + string: { + description: "The text describing the source of the funding." + } + }, + country: { + string: { + description: { + short: "Abbreviation for country where source of grant is located.", + long: "Abbreviation for country where source of grant is located.\nWhenever possible, ISO 3166-1 2-letter alphabetic codes should be used.\n" + } + } + } + } + } } - } - } - } - }, - { - object: { - closed: true, - properties: { - name: { - string: { - description: "The name of an individual that was responsible for the intellectual content of the work reported in the document." + ] + }, + description: "Agency or organization that funded the research on which a work was based." + }, + recipient: { + maybeArrayOf: { + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + ref: { + string: { + description: "The id of an author or affiliation in the document metadata." + } + } + } + } + }, + { + object: { + closed: true, + properties: { + name: { + string: { + description: "The name of an individual that was the recipient of the funding." + } + } + } + } + }, + { + object: { + closed: true, + properties: { + institution: { + anyOf: [ + "string", + "object" + ], + description: "The institution that was the recipient of the funding." + } + } + } } - } - } - } - }, - { - object: { - closed: true, - properties: { - institution: { - anyOf: [ - "string", - "object" - ], - description: "The institution that was responsible for the intellectual content of the work reported in the document." - } - } + ] + }, + description: "Individual(s) or institution(s) to whom the award was given (for example, the principal grant holder or the sponsored individual)." + }, + investigator: { + maybeArrayOf: { + anyOf: [ + "string", + { + object: { + closed: true, + properties: { + ref: { + string: { + description: "The id of an author or affiliation in the document metadata." + } + } + } + } + }, + { + object: { + closed: true, + properties: { + name: { + string: { + description: "The name of an individual that was responsible for the intellectual content of the work reported in the document." + } + } + } + } + }, + { + object: { + closed: true, + properties: { + institution: { + anyOf: [ + "string", + "object" + ], + description: "The institution that was responsible for the intellectual content of the work reported in the document." + } + } + } + } + ] + }, + description: "Individual(s) responsible for the intellectual content of the work reported in the document." } } - ] - }, - description: "Individual(s) responsible for the intellectual content of the work reported in the document." + } + } } } } @@ -14673,7 +14806,7 @@ try { ] }, { - ref: "other-links" + ref: "code-links-schema" } ] }, @@ -14816,7 +14949,9 @@ try { "$asciidoc-all", "$html-files", "$pdf-all", - "context" + "context", + "odt", + "$office-all" ] }, description: "List of keywords to be included in the document metadata." @@ -14827,7 +14962,8 @@ try { tags: { formats: [ "$pdf-all", - "$office-all" + "$office-all", + "odt" ] }, description: "The document subject" @@ -14837,6 +14973,7 @@ try { schema: "string", tags: { formats: [ + "odt", "$office-all" ] }, @@ -14934,7 +15071,7 @@ try { }, description: { short: "The License for this document, if any. (e.g. `CC BY`)", - long: "The license for this document, if any. \n\nCreative Commons licenses `CC BY`, `CC BY-SA`, `CC BY-ND`, `CC BY-NC` will automatically generate a license link\nin the document appendix. Other license text will be placed in the appendix verbatim.\n" + long: "The license for this document, if any. \n\nCreative Commons licenses `CC BY`, `CC BY-SA`, `CC BY-ND`, `CC BY-NC`, `CC BY-NC-SA`, and `CC BY-NC-ND` will automatically generate a license link\nin the document appendix. Other license text will be placed in the appendix verbatim.\n" } }, { @@ -19810,7 +19947,18 @@ try { "The title of the notebook when viewed.", "The url to use when viewing this notebook.", "The url to use when downloading the notebook from the preview", + "The bootstrap icon for this code link.", + "The text for this code link.", + "The href for this code link.", + "The rel used in the a tag for this code link.", + "The target used in the a tag for this code link.", + "The bootstrap icon for this code link.", + "The text for this code link.", + "The href for this code link.", + "The rel used in the a tag for this code link.", + "The target used in the a tag for this code link.", "The input document that will serve as the root document for this\nmanuscript", + "Code links to display for this manuscript.", "The deployed url for this manuscript", "Whether to generate a MECA bundle for this manuscript", "Additional file resources to be copied to output directory", @@ -20093,6 +20241,13 @@ try { }, "Configuration for document commenting.", "Configuration for crossref labels and prefixes.", + "A custom cross reference type.", + "The kind of cross reference (currently only \u201Cfloat\u201D is\nsupported).", + "The prefix used in rendered citations when referencing this type.", + "The prefix used in captions when referencing this type.", + "The prefix string used in references (\u201Cdia-\u201D, etc.) when referencing\nthis type.", + "The name of the custom LaTeX environment that quarto will use to\ncreate this type of crossreferenceable object in LaTeX output.", + "The name of the custom LaTeX \u201Clist of\u201D command that quarto will use\nto create this type of crossreferenceable object in LaTeX output.", "Use top level sections (H1) in this document as chapters.", "The delimiter used between the prefix and the caption.", "The title prefix used for figure captions.", @@ -20331,9 +20486,11 @@ try { long: "Specify the heading level at which to split the EPUB into separate\nchapter files. The default is to split into chapters at level-1\nheadings. This option only affects the internal composition of the EPUB,\nnot the way chapters and sections are displayed to users. Some readers\nmay be slow if the chapter files are too large, so for large documents\nwith few level-1 headings, one might want to use a chapter level of 2 or\n3." }, "Information about the funding of the research reported in the article\n(for example, grants, contracts, sponsors) and any open access fees for\nthe article itself", - "Unique identifier assigned to an award, contract, or grant.", "Displayable prose statement that describes the funding for the\nresearch on which a work was based.", "Open access provisions that apply to a work or the funding\ninformation that provided the open access provisions.", + "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", "Agency or organization that funded the research on which a work was\nbased.", "The text describing the source of the funding.", { @@ -20360,8 +20517,66 @@ try { "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", "The institution that was responsible for the intellectual content of\nthe work reported in the document.", "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", + "Agency or organization that funded the research on which a work was\nbased.", + "The text describing the source of the funding.", + { + short: "Abbreviation for country where source of grant is located.", + long: "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "The text describing the source of the funding.", + { + short: "Abbreviation for country where source of grant is located.", + long: "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "Individual(s) or institution(s) to whom the award was given (for\nexample, the principal grant holder or the sponsored individual).", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "Individual(s) responsible for the intellectual content of the work\nreported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", "Displayable prose statement that describes the funding for the\nresearch on which a work was based.", "Open access provisions that apply to a work or the funding\ninformation that provided the open access provisions.", + "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", + "Agency or organization that funded the research on which a work was\nbased.", + "The text describing the source of the funding.", + { + short: "Abbreviation for country where source of grant is located.", + long: "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "The text describing the source of the funding.", + { + short: "Abbreviation for country where source of grant is located.", + long: "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "Individual(s) or institution(s) to whom the award was given (for\nexample, the principal grant holder or the sponsored individual).", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "Individual(s) responsible for the intellectual content of the work\nreported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", + "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", "Agency or organization that funded the research on which a work was\nbased.", "The text describing the source of the funding.", { @@ -20602,7 +20817,7 @@ try { "The text to display for the license.", { short: "The License for this document, if any. (e.g. CC BY)", - long: "The license for this document, if any.\nCreative Commons licenses CC BY, CC BY-SA,\nCC BY-ND, CC BY-NC will automatically generate\na license link in the document appendix. Other license text will be\nplaced in the appendix verbatim." + long: "The license for this document, if any.\nCreative Commons licenses CC BY, CC BY-SA,\nCC BY-ND, CC BY-NC, CC BY-NC-SA,\nand CC BY-NC-ND will automatically generate a license link\nin the document appendix. Other license text will be placed in the\nappendix verbatim." }, "The type of the license.", "A URL to the license.", @@ -21339,6 +21554,15 @@ try { "Disambiguating year suffix in author-date styles (e.g. \u201Ca\u201D in \u201CDoe,\n1999a\u201D).", "Manuscript configuration", "internal-schema-hack", + "Enable or disable lightbox treatment for images in this document.", + { + short: "Set this to auto if you\u2019d like any image to be given\nlightbox treatment.", + long: "Set this to auto if you\u2019d like any image to be given\nlightbox treatment. If you omit this, only images with the class\nlightbox will be given the lightbox treatment." + }, + "The effect that should be used when opening and closing the lightbox.\nOne of fade, zoom, none. Defaults\nto zoom.", + "The position of the title and description when displaying a lightbox.\nOne of top, bottom, left,\nright. Defaults to bottom.", + "Whether galleries should \u2018loop\u2019 to first image in the gallery if the\nuser continues past the last image of the gallery. Boolean that defaults\nto true.", + "A class name to apply to the lightbox to allow css targeting. This\nwill replace the lightbox class with your custom class name.", "Project configuration.", "Project type (default, website,\nbook, or manuscript)", "Files to render (defaults to all files)", @@ -21653,7 +21877,8 @@ try { }, "Disambiguating year suffix in author-date styles (e.g. \u201Ca\u201D in \u201CDoe,\n1999a\u201D).", "Manuscript configuration", - "internal-schema-hack" + "internal-schema-hack", + "Sets the CSS color property on code elements and adds\nextra padding." ], "schema/external-schemas.yml": [ { @@ -21877,12 +22102,12 @@ try { mermaid: "%%" }, "handlers/mermaid/schema.yml": { - _internalId: 163250, + _internalId: 167856, type: "object", description: "be an object", properties: { "mermaid-format": { - _internalId: 163242, + _internalId: 167848, type: "enum", enum: [ "png", @@ -21898,7 +22123,7 @@ try { exhaustiveCompletions: true }, theme: { - _internalId: 163249, + _internalId: 167855, type: "anyOf", anyOf: [ { @@ -21938,7 +22163,77 @@ try { "case-detection": true }, $id: "handlers/mermaid" - } + }, + "schema/document-lightbox.yml": [ + { + name: "lightbox", + schema: { + anyOf: [ + "boolean", + { + enum: [ + "auto" + ] + }, + { + object: { + closed: true, + properties: { + match: { + schema: { + enum: [ + "auto" + ] + }, + description: { + short: "Set this to `auto` if you'd like any image to be given lightbox treatment.", + long: "Set this to `auto` if you'd like any image to be given lightbox treatment. If you omit this, only images with the class `lightbox` will be given the lightbox treatment.\n" + } + }, + effect: { + schema: { + enum: [ + "fade", + "zoom", + "none" + ] + }, + description: "The effect that should be used when opening and closing the lightbox. One of `fade`, `zoom`, `none`. Defaults to `zoom`." + }, + "desc-position": { + schema: { + enum: [ + "top", + "bottom", + "left", + "right" + ] + }, + description: "The position of the title and description when displaying a lightbox. One of `top`, `bottom`, `left`, `right`. Defaults to `bottom`." + }, + loop: { + boolean: { + description: "Whether galleries should 'loop' to first image in the gallery if the user continues past the last image of the gallery. Boolean that defaults to `true`." + } + }, + "css-class": { + string: { + description: "A class name to apply to the lightbox to allow css targeting. This will replace the lightbox class with your custom class name." + } + } + } + } + } + ] + }, + tags: { + formats: [ + "$html-doc" + ] + }, + description: "Enable or disable lightbox treatment for images in this document." + } + ] }; } }); diff --git a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json index 10826992ee3..35c647ee899 100644 --- a/src/resources/editor/tools/yaml/yaml-intelligence-resources.json +++ b/src/resources/editor/tools/yaml/yaml-intelligence-resources.json @@ -184,7 +184,7 @@ }, "description": { "short": "Include cell source code in rendered output.", - "long": "Include cell source code in rendered output.\n\n- `true` (default): include source code in output\n- `false`: do not include source code in output\n- `fenced`: in addition to echoing, include the cell delimiter as part of the output.\n- `[...]`: A list of positive or negative line numbers to selectively include or exclude lines\n (explicit inclusion/excusion of lines is available only when using the knitr engine)\n" + "long": "Include cell source code in rendered output.\n\n- `true` (default in most formats): include source code in output\n- `false` (default in presentation formats like `beamer`, `revealjs`, and `pptx`): do not include source code in output\n- `fenced`: in addition to echoing, include the cell delimiter as part of the output.\n- `[...]`: A list of positive or negative line numbers to selectively include or exclude lines\n (explicit inclusion/excusion of lines is available only when using the knitr engine)\n" } }, { @@ -292,7 +292,17 @@ "tags": { "engine": "knitr" }, - "schema": "boolean", + "schema": { + "anyOf": [ + "boolean", + { + "enum": [ + "styler", + "formatR" + ] + } + ] + }, "default": false, "description": "Whether to reformat R code." }, @@ -2648,7 +2658,7 @@ "anyOf": [ "boolean", { - "ref": "other-links" + "ref": "code-links-schema" } ] }, @@ -4265,6 +4275,58 @@ } } }, + { + "id": "code-links-schema", + "schema": { + "anyOf": [ + "boolean", + { + "maybeArrayOf": { + "anyOf": [ + { + "object": { + "properties": { + "icon": { + "string": { + "description": "The bootstrap icon for this code link." + } + }, + "text": { + "string": { + "description": "The text for this code link." + } + }, + "href": { + "string": { + "description": "The href for this code link." + } + }, + "rel": { + "string": { + "description": "The rel used in the `a` tag for this code link." + } + }, + "target": { + "string": { + "description": "The target used in the `a` tag for this code link." + } + } + } + } + }, + { + "enum": [ + "repo", + "binder", + "devcontainer" + ] + } + ] + } + } + ] + } + }, { "id": "manuscript-schema", "schema": { @@ -4277,17 +4339,10 @@ } }, "code-links": { - "anyOf": [ - "boolean", - { - "maybeArrayOf": { - "anyOf": [ - "object", - "string" - ] - } - } - ] + "schema": { + "ref": "code-links-schema" + }, + "description": "Code links to display for this manuscript." }, "manuscript-url": { "string": { @@ -4373,7 +4428,8 @@ "$html-all", "context", "muse", - "odt" + "odt", + "docx" ] }, "description": "Identifies the subtitle of the document." @@ -4498,7 +4554,8 @@ "$jats-all", "context", "ms", - "odt" + "odt", + "docx" ] }, "description": "Summary of document" @@ -4509,7 +4566,8 @@ "tags": { "formats": [ "$html-doc", - "$epub-all" + "$epub-all", + "docx" ] }, "description": "Title used to label document abstract" @@ -4867,6 +4925,22 @@ }, "description": "Sets the CSS `background-color` property on code elements and adds extra padding." }, + { + "name": "monoforegroundcolor", + "schema": "string", + "tags": { + "formats": [ + "html", + "html4", + "html5", + "slidy", + "slideous", + "s5", + "dzslides" + ] + }, + "description": "Sets the CSS `color` property on code elements and adds extra padding." + }, { "name": "backgroundcolor", "schema": "string", @@ -4983,6 +5057,47 @@ "object": { "closed": true, "properties": { + "custom": { + "arrayOf": { + "object": { + "description": "A custom cross reference type.", + "closed": true, + "properties": { + "kind": { + "enum": [ + "float" + ], + "description": "The kind of cross reference (currently only \"float\" is supported)." + }, + "prefix": { + "string": { + "description": "The prefix used in rendered citations when referencing this type." + } + }, + "name": { + "string": { + "description": "The prefix used in captions when referencing this type." + } + }, + "ref-type": { + "string": { + "description": "The prefix string used in references (\"dia-\", etc.) when referencing this type." + } + }, + "latex-env": { + "string": { + "description": "The name of the custom LaTeX environment that quarto will use to create this type of crossreferenceable object in LaTeX output." + } + }, + "latex-list-of-name": { + "string": { + "description": "The name of the custom LaTeX \"list of\" command that quarto will use to create this type of crossreferenceable object in LaTeX output." + } + } + } + } + } + }, "chapters": { "boolean": { "description": "Use top level sections (H1) in this document as chapters.", @@ -6356,11 +6471,6 @@ "object": { "closed": true, "properties": { - "id": { - "string": { - "description": "Unique identifier assigned to an award, contract, or grant." - } - }, "statement": { "string": { "description": "Displayable prose statement that describes the funding for the research on which a work was based." @@ -6371,125 +6481,148 @@ "description": "Open access provisions that apply to a work or the funding information that provided the open access provisions." } }, - "source": { - "maybeArrayOf": { - "anyOf": [ - "string", - { - "object": { - "closed": true, - "properties": { - "text": { - "string": { - "description": "The text describing the source of the funding." - } - }, - "country": { - "string": { - "description": { - "short": "Abbreviation for country where source of grant is located.", - "long": "Abbreviation for country where source of grant is located.\nWhenever possible, ISO 3166-1 2-letter alphabetic codes should be used.\n" - } - } - } - } - } - } - ] - }, - "description": "Agency or organization that funded the research on which a work was based." - }, - "recipient": { + "awards": { "maybeArrayOf": { - "anyOf": [ - "string", - { - "object": { - "closed": true, - "properties": { - "ref": { - "string": { - "description": "The id of an author or affiliation in the document metadata." - } - } + "object": { + "properties": { + "id": { + "string": { + "description": "Unique identifier assigned to an award, contract, or grant." } - } - }, - { - "object": { - "closed": true, - "properties": { - "name": { - "string": { - "description": "The name of an individual that was the recipient of the funding." - } - } + }, + "name": { + "string": { + "description": "The name of this award" } - } - }, - { - "object": { - "closed": true, - "properties": { - "institution": { - "anyOf": [ - "string", - "object" - ], - "description": "The institution that was the recipient of the funding." - } + }, + "description": { + "string": { + "description": "The description for this award." } - } - } - ] - }, - "description": "Individual(s) or institution(s) to whom the award was given (for example, the principal grant holder or the sponsored individual)." - }, - "investigator": { - "maybeArrayOf": { - "anyOf": [ - "string", - { - "object": { - "closed": true, - "properties": { - "ref": { - "string": { - "description": "The id of an author or affiliation in the document metadata." + }, + "source": { + "maybeArrayOf": { + "anyOf": [ + "string", + { + "object": { + "closed": true, + "properties": { + "text": { + "string": { + "description": "The text describing the source of the funding." + } + }, + "country": { + "string": { + "description": { + "short": "Abbreviation for country where source of grant is located.", + "long": "Abbreviation for country where source of grant is located.\nWhenever possible, ISO 3166-1 2-letter alphabetic codes should be used.\n" + } + } + } + } + } } - } - } - } - }, - { - "object": { - "closed": true, - "properties": { - "name": { - "string": { - "description": "The name of an individual that was responsible for the intellectual content of the work reported in the document." + ] + }, + "description": "Agency or organization that funded the research on which a work was based." + }, + "recipient": { + "maybeArrayOf": { + "anyOf": [ + "string", + { + "object": { + "closed": true, + "properties": { + "ref": { + "string": { + "description": "The id of an author or affiliation in the document metadata." + } + } + } + } + }, + { + "object": { + "closed": true, + "properties": { + "name": { + "string": { + "description": "The name of an individual that was the recipient of the funding." + } + } + } + } + }, + { + "object": { + "closed": true, + "properties": { + "institution": { + "anyOf": [ + "string", + "object" + ], + "description": "The institution that was the recipient of the funding." + } + } + } } - } - } - } - }, - { - "object": { - "closed": true, - "properties": { - "institution": { - "anyOf": [ - "string", - "object" - ], - "description": "The institution that was responsible for the intellectual content of the work reported in the document." - } - } + ] + }, + "description": "Individual(s) or institution(s) to whom the award was given (for example, the principal grant holder or the sponsored individual)." + }, + "investigator": { + "maybeArrayOf": { + "anyOf": [ + "string", + { + "object": { + "closed": true, + "properties": { + "ref": { + "string": { + "description": "The id of an author or affiliation in the document metadata." + } + } + } + } + }, + { + "object": { + "closed": true, + "properties": { + "name": { + "string": { + "description": "The name of an individual that was responsible for the intellectual content of the work reported in the document." + } + } + } + } + }, + { + "object": { + "closed": true, + "properties": { + "institution": { + "anyOf": [ + "string", + "object" + ], + "description": "The institution that was responsible for the intellectual content of the work reported in the document." + } + } + } + } + ] + }, + "description": "Individual(s) responsible for the intellectual content of the work reported in the document." } } - ] - }, - "description": "Individual(s) responsible for the intellectual content of the work reported in the document." + } + } } } } @@ -7644,7 +7777,7 @@ ] }, { - "ref": "other-links" + "ref": "code-links-schema" } ] }, @@ -7787,7 +7920,9 @@ "$asciidoc-all", "$html-files", "$pdf-all", - "context" + "context", + "odt", + "$office-all" ] }, "description": "List of keywords to be included in the document metadata." @@ -7798,7 +7933,8 @@ "tags": { "formats": [ "$pdf-all", - "$office-all" + "$office-all", + "odt" ] }, "description": "The document subject" @@ -7808,6 +7944,7 @@ "schema": "string", "tags": { "formats": [ + "odt", "$office-all" ] }, @@ -7905,7 +8042,7 @@ }, "description": { "short": "The License for this document, if any. (e.g. `CC BY`)", - "long": "The license for this document, if any. \n\nCreative Commons licenses `CC BY`, `CC BY-SA`, `CC BY-ND`, `CC BY-NC` will automatically generate a license link\nin the document appendix. Other license text will be placed in the appendix verbatim.\n" + "long": "The license for this document, if any. \n\nCreative Commons licenses `CC BY`, `CC BY-SA`, `CC BY-ND`, `CC BY-NC`, `CC BY-NC-SA`, and `CC BY-NC-ND` will automatically generate a license link\nin the document appendix. Other license text will be placed in the appendix verbatim.\n" } }, { @@ -12781,7 +12918,18 @@ "The title of the notebook when viewed.", "The url to use when viewing this notebook.", "The url to use when downloading the notebook from the preview", + "The bootstrap icon for this code link.", + "The text for this code link.", + "The href for this code link.", + "The rel used in the a tag for this code link.", + "The target used in the a tag for this code link.", + "The bootstrap icon for this code link.", + "The text for this code link.", + "The href for this code link.", + "The rel used in the a tag for this code link.", + "The target used in the a tag for this code link.", "The input document that will serve as the root document for this\nmanuscript", + "Code links to display for this manuscript.", "The deployed url for this manuscript", "Whether to generate a MECA bundle for this manuscript", "Additional file resources to be copied to output directory", @@ -13064,6 +13212,13 @@ }, "Configuration for document commenting.", "Configuration for crossref labels and prefixes.", + "A custom cross reference type.", + "The kind of cross reference (currently only “float” is\nsupported).", + "The prefix used in rendered citations when referencing this type.", + "The prefix used in captions when referencing this type.", + "The prefix string used in references (“dia-”, etc.) when referencing\nthis type.", + "The name of the custom LaTeX environment that quarto will use to\ncreate this type of crossreferenceable object in LaTeX output.", + "The name of the custom LaTeX “list of” command that quarto will use\nto create this type of crossreferenceable object in LaTeX output.", "Use top level sections (H1) in this document as chapters.", "The delimiter used between the prefix and the caption.", "The title prefix used for figure captions.", @@ -13302,9 +13457,11 @@ "long": "Specify the heading level at which to split the EPUB into separate\nchapter files. The default is to split into chapters at level-1\nheadings. This option only affects the internal composition of the EPUB,\nnot the way chapters and sections are displayed to users. Some readers\nmay be slow if the chapter files are too large, so for large documents\nwith few level-1 headings, one might want to use a chapter level of 2 or\n3." }, "Information about the funding of the research reported in the article\n(for example, grants, contracts, sponsors) and any open access fees for\nthe article itself", - "Unique identifier assigned to an award, contract, or grant.", "Displayable prose statement that describes the funding for the\nresearch on which a work was based.", "Open access provisions that apply to a work or the funding\ninformation that provided the open access provisions.", + "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", "Agency or organization that funded the research on which a work was\nbased.", "The text describing the source of the funding.", { @@ -13331,8 +13488,66 @@ "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", "The institution that was responsible for the intellectual content of\nthe work reported in the document.", "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", + "Agency or organization that funded the research on which a work was\nbased.", + "The text describing the source of the funding.", + { + "short": "Abbreviation for country where source of grant is located.", + "long": "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "The text describing the source of the funding.", + { + "short": "Abbreviation for country where source of grant is located.", + "long": "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "Individual(s) or institution(s) to whom the award was given (for\nexample, the principal grant holder or the sponsored individual).", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "Individual(s) responsible for the intellectual content of the work\nreported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", "Displayable prose statement that describes the funding for the\nresearch on which a work was based.", "Open access provisions that apply to a work or the funding\ninformation that provided the open access provisions.", + "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", + "Agency or organization that funded the research on which a work was\nbased.", + "The text describing the source of the funding.", + { + "short": "Abbreviation for country where source of grant is located.", + "long": "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "The text describing the source of the funding.", + { + "short": "Abbreviation for country where source of grant is located.", + "long": "Abbreviation for country where source of grant is located. Whenever\npossible, ISO 3166-1 2-letter alphabetic codes should be used." + }, + "Individual(s) or institution(s) to whom the award was given (for\nexample, the principal grant holder or the sponsored individual).", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was the recipient of the funding.", + "The institution that was the recipient of the funding.", + "Individual(s) responsible for the intellectual content of the work\nreported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", + "The id of an author or affiliation in the document metadata.", + "The name of an individual that was responsible for the intellectual\ncontent of the work reported in the document.", + "The institution that was responsible for the intellectual content of\nthe work reported in the document.", + "Unique identifier assigned to an award, contract, or grant.", + "The name of this award", + "The description for this award.", "Agency or organization that funded the research on which a work was\nbased.", "The text describing the source of the funding.", { @@ -13573,7 +13788,7 @@ "The text to display for the license.", { "short": "The License for this document, if any. (e.g. CC BY)", - "long": "The license for this document, if any.\nCreative Commons licenses CC BY, CC BY-SA,\nCC BY-ND, CC BY-NC will automatically generate\na license link in the document appendix. Other license text will be\nplaced in the appendix verbatim." + "long": "The license for this document, if any.\nCreative Commons licenses CC BY, CC BY-SA,\nCC BY-ND, CC BY-NC, CC BY-NC-SA,\nand CC BY-NC-ND will automatically generate a license link\nin the document appendix. Other license text will be placed in the\nappendix verbatim." }, "The type of the license.", "A URL to the license.", @@ -14310,6 +14525,15 @@ "Disambiguating year suffix in author-date styles (e.g. “a” in “Doe,\n1999a”).", "Manuscript configuration", "internal-schema-hack", + "Enable or disable lightbox treatment for images in this document.", + { + "short": "Set this to auto if you’d like any image to be given\nlightbox treatment.", + "long": "Set this to auto if you’d like any image to be given\nlightbox treatment. If you omit this, only images with the class\nlightbox will be given the lightbox treatment." + }, + "The effect that should be used when opening and closing the lightbox.\nOne of fade, zoom, none. Defaults\nto zoom.", + "The position of the title and description when displaying a lightbox.\nOne of top, bottom, left,\nright. Defaults to bottom.", + "Whether galleries should ‘loop’ to first image in the gallery if the\nuser continues past the last image of the gallery. Boolean that defaults\nto true.", + "A class name to apply to the lightbox to allow css targeting. This\nwill replace the lightbox class with your custom class name.", "Project configuration.", "Project type (default, website,\nbook, or manuscript)", "Files to render (defaults to all files)", @@ -14624,7 +14848,8 @@ }, "Disambiguating year suffix in author-date styles (e.g. “a” in “Doe,\n1999a”).", "Manuscript configuration", - "internal-schema-hack" + "internal-schema-hack", + "Sets the CSS color property on code elements and adds\nextra padding." ], "schema/external-schemas.yml": [ { @@ -14848,12 +15073,12 @@ "mermaid": "%%" }, "handlers/mermaid/schema.yml": { - "_internalId": 163250, + "_internalId": 167856, "type": "object", "description": "be an object", "properties": { "mermaid-format": { - "_internalId": 163242, + "_internalId": 167848, "type": "enum", "enum": [ "png", @@ -14869,7 +15094,7 @@ "exhaustiveCompletions": true }, "theme": { - "_internalId": 163249, + "_internalId": 167855, "type": "anyOf", "anyOf": [ { @@ -14909,5 +15134,75 @@ "case-detection": true }, "$id": "handlers/mermaid" - } + }, + "schema/document-lightbox.yml": [ + { + "name": "lightbox", + "schema": { + "anyOf": [ + "boolean", + { + "enum": [ + "auto" + ] + }, + { + "object": { + "closed": true, + "properties": { + "match": { + "schema": { + "enum": [ + "auto" + ] + }, + "description": { + "short": "Set this to `auto` if you'd like any image to be given lightbox treatment.", + "long": "Set this to `auto` if you'd like any image to be given lightbox treatment. If you omit this, only images with the class `lightbox` will be given the lightbox treatment.\n" + } + }, + "effect": { + "schema": { + "enum": [ + "fade", + "zoom", + "none" + ] + }, + "description": "The effect that should be used when opening and closing the lightbox. One of `fade`, `zoom`, `none`. Defaults to `zoom`." + }, + "desc-position": { + "schema": { + "enum": [ + "top", + "bottom", + "left", + "right" + ] + }, + "description": "The position of the title and description when displaying a lightbox. One of `top`, `bottom`, `left`, `right`. Defaults to `bottom`." + }, + "loop": { + "boolean": { + "description": "Whether galleries should 'loop' to first image in the gallery if the user continues past the last image of the gallery. Boolean that defaults to `true`." + } + }, + "css-class": { + "string": { + "description": "A class name to apply to the lightbox to allow css targeting. This will replace the lightbox class with your custom class name." + } + } + } + } + } + ] + }, + "tags": { + "formats": [ + "$html-doc" + ] + }, + "description": "Enable or disable lightbox treatment for images in this document." + } + ] } \ No newline at end of file diff --git a/src/resources/extensions/quarto/confluence/_extension.yml b/src/resources/extensions/quarto/confluence/_extension.yml index 10c0c0cfaed..a91c53195c9 100644 --- a/src/resources/extensions/quarto/confluence/_extension.yml +++ b/src/resources/extensions/quarto/confluence/_extension.yml @@ -16,6 +16,7 @@ contributes: publish: writer: publish.lua output-ext: xml + quarto-custom-format: confluence html: theme: [default, theme.scss] code-line-numbers: true diff --git a/src/resources/extensions/quarto/docusaurus/docusaurus_renderers.lua b/src/resources/extensions/quarto/docusaurus/docusaurus_renderers.lua index c5f8adf2636..aa5260331e7 100644 --- a/src/resources/extensions/quarto/docusaurus/docusaurus_renderers.lua +++ b/src/resources/extensions/quarto/docusaurus/docusaurus_renderers.lua @@ -19,4 +19,6 @@ local codeBlock = require('docusaurus_utils').codeBlock -- return admonition -- end) -return {} -- return an empty table as a hack to pretend we're a shortcode handler for now \ No newline at end of file +-- luacov: disable +return {} -- return an empty table as a hack to pretend we're a shortcode handler for now +-- luacov: enable \ No newline at end of file diff --git a/src/resources/extensions/quarto/kbd/kbd.lua b/src/resources/extensions/quarto/kbd/kbd.lua index 74d0d0a4072..76fea0e88f3 100644 --- a/src/resources/extensions/quarto/kbd/kbd.lua +++ b/src/resources/extensions/quarto/kbd/kbd.lua @@ -64,7 +64,9 @@ return { else -- all kwargs if n_kwargs == 0 then + -- luacov: disable error("kbd requires at least one argument") + -- luacov: enable else for k, v in pairs(kwargs) do table.insert(result, pandoc.Code(pandoc.utils.stringify(v))) diff --git a/src/resources/extensions/quarto/video/video.lua b/src/resources/extensions/quarto/video/video.lua index 694da5aa07f..04915205e61 100644 --- a/src/resources/extensions/quarto/video/video.lua +++ b/src/resources/extensions/quarto/video/video.lua @@ -234,6 +234,20 @@ end function htmlVideo(src, height, width, title, start, aspectRatio) + -- https://github.com/quarto-dev/quarto-cli/issues/6833 + -- handle partially-specified width, height, and aspectRatio + if aspectRatio then + local strs = splitString(aspectRatio, 'x') + wr = tonumber(strs[1]) + hr = tonumber(strs[2]) + local aspectRatioNum = wr / hr + if height and not width then + width = math.floor(height * aspectRatioNum + 0.5) + elseif width and not height then + height = math.floor(width / aspectRatioNum + 0.5) + end + end + local videoSnippetAndType = getSnippetFromBuilders(src, height, width, title, start) local videoSnippet @@ -314,7 +328,9 @@ return { if #raw_args > 0 then srcValue = pandoc.utils.stringify(raw_args[1]) else + -- luacov: disable fail("No video source specified for video shortcode") + -- luacov: enable end end diff --git a/src/resources/filters/ast/customnodes.lua b/src/resources/filters/ast/customnodes.lua index afda06e3f90..729a10b1445 100644 --- a/src/resources/filters/ast/customnodes.lua +++ b/src/resources/filters/ast/customnodes.lua @@ -1,7 +1,7 @@ -- customnodes.lua -- support for custom nodes in quarto's emulated ast -- --- Copyright (C) 2022 by RStudio, PBC +-- Copyright (C) 2023 Posit Software, PBC local handlers = {} @@ -9,6 +9,17 @@ local custom_node_data = pandoc.List({}) local n_custom_nodes = 0 local profiler = require('profiler') +function scaffold(node) + local pt = pandoc.utils.type(node) + if pt == "Blocks" then + return pandoc.Div(node, {"", {"quarto-scaffold"}}) + elseif pt == "Inlines" then + return pandoc.Span(node, {"", {"quarto-scaffold"}}) + else + return node + end +end + function is_custom_node(node) if node.attributes and node.attributes.__quarto_custom == "true" then return node @@ -37,6 +48,19 @@ function run_emulated_filter(doc, filter) end end + local function checked_walk(node, filter_param) + if node.walk == nil then + if #node == 0 then -- empty node + return node + else + -- luacov: disable + internal_error() + -- luacov: enable + end + end + return node:walk(filter_param) + end + -- performance: if filter is empty, do nothing if sz == 0 then return doc @@ -65,11 +89,28 @@ function run_emulated_filter(doc, filter) return result end + ::regular:: + -- if user passed a table corresponding to the custom node instead + -- of the custom node, then first we will get the actual node + if doc.__quarto_custom_node ~= nil then + doc = doc.__quarto_custom_node + needs_custom = true + end + local is_custom = is_custom_node(doc) if not needs_custom or (not is_custom and filter._is_wrapped) then - local result, recurse = doc:walk(filter) + if doc.walk == nil then + if #doc == 0 then -- empty doc + return doc + else + -- luacov: disable + internal_error() + -- luacov: enable + end + end + local result, recurse = checked_walk(doc, filter) if in_filter then profiler.category = "" end @@ -94,30 +135,17 @@ function run_emulated_filter(doc, filter) Inline = "CustomInline" } local filter_fn = filter[t] or filter[node_type[kind]] or filter.Custom - if filter_fn ~= nil then - local result = filter_fn(custom_data, custom_node) + local result, recurse = filter_fn(custom_data, custom_node) if result == nil then - return nil + return nil, recurse end -- do the user a kindness and unwrap the result if it's a custom node if type(result) == "table" and result.__quarto_custom_node ~= nil then - return result.__quarto_custom_node + return result.__quarto_custom_node, recurse end - return result - end - end - - if is_custom then - local custom_data, t, kind = _quarto.ast.resolve_custom_data(doc) - local result, recurse = process_custom_preamble(custom_data, t, kind, doc) - if in_filter then - profiler.category = "" + return result, recurse end - if result == nil then - result = doc - end - return result, recurse end function wrapped_filter.Div(node) @@ -125,7 +153,10 @@ function run_emulated_filter(doc, filter) local custom_data, t, kind = _quarto.ast.resolve_custom_data(node) -- here, if the node is actually an inline, -- it's ok, because Pandoc will wrap it in a Plain - return process_custom_preamble(custom_data, t, kind, custom) + return process_custom_preamble(custom_data, t, kind, node) + end + if node.attributes.__quarto_custom_scaffold == "true" then + return nil end if filter.Div ~= nil then return filter.Div(node) @@ -138,10 +169,15 @@ function run_emulated_filter(doc, filter) local custom_data, t, kind = _quarto.ast.resolve_custom_data(node) -- only follow through if node matches the expected kind if kind == "Inline" then - return process_custom_preamble(custom_data, t, kind, custom) + return process_custom_preamble(custom_data, t, kind, node) end + -- luacov: disable fatal("Custom node of type " .. t .. " is not an inline, but found in an inline context") return nil + -- luacov: enable + end + if node.attributes.__quarto_custom_scaffold == "true" then + return nil end if filter.Span ~= nil then return filter.Span(node) @@ -149,7 +185,20 @@ function run_emulated_filter(doc, filter) return nil end - return doc:walk(wrapped_filter) + if is_custom then + local custom_data, t, kind = _quarto.ast.resolve_custom_data(doc) + local result, recurse = process_custom_preamble(custom_data, t, kind, doc) + if in_filter then + profiler.category = "" + end + if result ~= nil then + doc = result + end + if recurse == false then + return doc, recurse + end + end + return checked_walk(doc, wrapped_filter) end function create_custom_node_scaffold(t, context) @@ -159,7 +208,9 @@ function create_custom_node_scaffold(t, context) elseif context == "Inline" then result = pandoc.Span({}) else + -- luacov: disable fatal("Invalid context for custom node: " .. context) + -- luacov: enable end n_custom_nodes = n_custom_nodes + 1 local id = tostring(n_custom_nodes) @@ -184,19 +235,13 @@ _quarto.ast = { custom_node_data = custom_node_data, create_custom_node_scaffold = create_custom_node_scaffold, - -- FIXME WE NEED TO REDO THIS WITH PROXY OBJECTS - -- - -- -- this is used in non-lua filters to handle custom nodes - -- reset_custom_tbl = function(tbl) - -- custom_node_data = tbl - -- n_custom_nodes = #tbl - -- end, - grow_scaffold = function(node, size) local n = #node.content local ctor = pandoc[node.t or pandoc.utils.type(node)] for _ = n + 1, size do - node.content:insert(ctor({})) + local scaffold = ctor({}) + scaffold.attributes.__quarto_custom_scaffold = "true" + node.content:insert(scaffold) end end, @@ -245,6 +290,7 @@ _quarto.ast = { end local node = node_accessor(table) local t = pandoc.utils.type(value) + -- FIXME this is broken; that can only be "Block", "Inline", etc if t == "Div" or t == "Span" then local custom_data, t, kind = _quarto.ast.resolve_custom_data(value) if custom_data ~= nil then @@ -254,7 +300,12 @@ _quarto.ast = { if index > #node.content then _quarto.ast.grow_scaffold(node, index) end - node.content[index].content = value + local pt = pandoc.utils.type(value) + if pt == "Block" or pt == "Inline" then + node.content[index].content = {value} + else + node.content[index].content = value + end end } end, @@ -288,9 +339,11 @@ _quarto.ast = { local n = div_or_span.attributes.__quarto_custom_id local kind = div_or_span.attributes.__quarto_custom_context local handler = _quarto.ast.resolve_handler(t) + -- luacov: disable if handler == nil then fatal("Internal Error: handler not found for custom node " .. t) end + -- luacov: enable local custom_data = _quarto.ast.custom_node_data[n] custom_data["__quarto_custom_node"] = div_or_span @@ -300,11 +353,15 @@ _quarto.ast = { add_handler = function(handler) local state = quarto_global_state.extended_ast_handlers if type(handler.constructor) == "nil" then + -- luacov: disable quarto.utils.dump(handler) fatal("Internal Error: extended ast handler must have a constructor") + -- luacov: enable elseif type(handler.class_name) == "nil" then + -- luacov: disable quarto.utils.dump(handler) fatal("handler must define class_name") + -- luacov: enable elseif type(handler.class_name) == "string" then state.namedHandlers[handler.class_name] = handler elseif type(handler.class_name) == "table" then @@ -312,8 +369,10 @@ _quarto.ast = { state.namedHandlers[name] = handler end else + -- luacov: disable quarto.utils.dump(handler) fatal("ERROR: class_name must be a string or an array of strings") + -- luacov: enable end local forwarder = { } @@ -329,7 +388,7 @@ _quarto.ast = { local tbl, need_emulation = handler.constructor(params) if need_emulation ~= false then - return create_emulated_node(handler.ast_name, tbl, handler.kind, forwarder), tbl + return create_emulated_node(handler.ast_name, tbl, handler.kind, forwarder) else tbl.t = handler.ast_name -- set t always to custom ast type custom_node_data[tbl.__quarto_custom_node.attributes.__quarto_custom_id] = tbl @@ -344,7 +403,9 @@ _quarto.ast = { add_renderer = function(name, condition, renderer) local handler = _quarto.ast.resolve_handler(name) if handler == nil then + -- luacov: disable fatal("Internal Error in add_renderer: handler not found for custom node " .. name) + -- luacov: enable end if handler.renderers == nil then handler.renderers = { } @@ -359,7 +420,11 @@ _quarto.ast = { if state.namedHandlers ~= nil then return state.namedHandlers[name] end + -- TODO: should we just fail here? We seem to be failing downstream of every nil + -- result anyway. + -- luacov: disable return nil + -- luacov: enable end, walk = run_emulated_filter, @@ -369,7 +434,14 @@ _quarto.ast = { local function custom_walk(node) local handler = quarto._quarto.ast.resolve_handler(node.t) if handler == nil then + -- luacov: disable fatal("Internal Error: handler not found for custom node " .. node.t) + -- luacov: enable + end + if handler.render == nil then + -- luacov: disable + fatal("Internal Error: handler for custom node " .. node.t .. " does not have a render function") + -- luacov: enable end return handler.render(node) end @@ -395,9 +467,13 @@ function construct_extended_ast_handler_state() quarto_global_state.extended_ast_handlers = state end + -- we currently don't have any handlers at startup, + -- so we disable coverage for this block + -- luacov: disable for _, handler in ipairs(handlers) do _quarto.ast.add_handler(handler) end + -- luacov: enable end construct_extended_ast_handler_state() \ No newline at end of file diff --git a/src/resources/filters/ast/render.lua b/src/resources/filters/ast/render.lua index a8170f9e625..6d68bc761d7 100644 --- a/src/resources/filters/ast/render.lua +++ b/src/resources/filters/ast/render.lua @@ -3,42 +3,62 @@ -- -- Copyright (C) 2022 by RStudio, PBC -function render_raw(raw) - local parts = split(raw.text) - local t = parts[1] - local n = tonumber(parts[2]) - local handler = _quarto.ast.resolve_handler(t) - if handler == nil then - fatal("Internal Error: handler not found for custom node " .. t) - end - local customNode = _quarto.ast.custom_node_data[n] - return handler.render(customNode) -end - function render_extended_nodes() - if string.find(FORMAT, ".lua$") then - return {} -- don't render in custom writers, so we can handle them in the custom writer code. + local function has_custom_nodes(node) + local has_custom_nodes = false + _quarto.ast.walk(node, { + Custom = function() + has_custom_nodes = true + end + }) + return has_custom_nodes end - return { - Custom = function(node) - local handler = _quarto.ast.resolve_handler(node.t) - if handler == nil then - fatal("Internal Error: handler not found for custom node " .. node.t) + local filter + + local function render_custom(node) + local function postprocess_render(render_result) + -- we need to recurse in case custom nodes render to other custom nodes + if is_custom_node(render_result) then + -- recurse directly + return render_custom(render_result) + elseif has_custom_nodes(render_result) then + -- recurse via the filter + return _quarto.ast.walk(render_result, filter) + else + return render_result end - if handler.renderers then - for _, renderer in ipairs(handler.renderers) do - if renderer.condition(node) then - return renderer.render(node) - end + end + if type(node) == "userdata" then + node = _quarto.ast.resolve_custom_data(node) + end + + local handler = _quarto.ast.resolve_handler(node.t) + if handler == nil then + -- luacov: disable + fatal("Internal Error: handler not found for custom node " .. node.t) + -- luacov: enable + end + if handler.renderers then + for _, renderer in ipairs(handler.renderers) do + if renderer.condition(node) then + return scaffold(postprocess_render(scaffold(renderer.render(node)))) end - quarto.utils.dump(node) - fatal("Internal Error: renderers table was exhausted without a match for custom node " .. node.t) - elseif handler.render ~= nil then - return handler.render(node) - else - fatal("Internal Error: handler for custom node " .. node.t .. " does not have a render function or renderers table") end + -- luacov: disable + fatal("Internal Error: renderers table was exhausted without a match for custom node " .. node.t) + -- luacov: enable + elseif handler.render ~= nil then + return scaffold(postprocess_render(scaffold(handler.render(node)))) + else + -- luacov: disable + fatal("Internal Error: handler for custom node " .. node.t .. " does not have a render function or renderers table") + -- luacov: enable end + end + + filter = { + Custom = render_custom } + return filter end \ No newline at end of file diff --git a/src/resources/filters/ast/runemulation.lua b/src/resources/filters/ast/runemulation.lua index a20b6d17599..5f2fa5bacd6 100644 --- a/src/resources/filters/ast/runemulation.lua +++ b/src/resources/filters/ast/runemulation.lua @@ -7,12 +7,13 @@ local profiler = require('profiler') local function run_emulated_filter_chain(doc, filters, afterFilterPass, profiling) init_trace(doc) - -- print(os.clock(), " - starting") for i, v in ipairs(filters) do local function callback() if v.flags then if type(v.flags) ~= "table" then + -- luacov: disable fatal("filter " .. v.name .. " has invalid flags") + -- luacov: enable end local can_skip = true for _, index in ipairs(v.flags) do @@ -21,23 +22,26 @@ local function run_emulated_filter_chain(doc, filters, afterFilterPass, profilin end end if can_skip then - -- print(" - Skipping", v.name) return end end - -- print(os.clock(), " - running", v.name) + -- We don't seem to need coverage for profiling + -- luacov: disable if profiling then profiler.category = v.name end + -- luacov: enable doc = run_emulated_filter(doc, v.filter) add_trace(doc, v.name) + -- luacov: disable if profiling then profiler.category = "" end + -- luacov: enable end if v.filter.scriptFile then _quarto.withScriptFile(v.filter.scriptFile, callback) @@ -56,6 +60,7 @@ local function emulate_pandoc_filter(filters, afterFilterPass) local cached_paths local profiler + -- luacov: disable local function get_paths(tmpdir) if cached_paths then return cached_paths @@ -69,6 +74,7 @@ local function emulate_pandoc_filter(filters, afterFilterPass) paths_file:close() return cached_paths end + -- luacov: enable return { traverse = 'topdown', @@ -77,6 +83,7 @@ local function emulate_pandoc_filter(filters, afterFilterPass) if not profiling then return run_emulated_filter_chain(doc, filters, afterFilterPass), false end + -- luacov: disable if profiler == nil then profiler = require('profiler') end @@ -90,6 +97,7 @@ local function emulate_pandoc_filter(filters, afterFilterPass) return nil end) return doc, false + -- luacov: enable end } end @@ -108,11 +116,14 @@ function run_as_extended_ast(specTable) innerV._filter_name = string.format("%s-%s", v.name, j) table.insert(finalResult, { filter = innerV, - name = innerV._filter_name + name = innerV._filter_name, + flags = v.flags }) end else - print("Warning: filter " .. v.name .. " didn't declare filter or filters.") + -- luacov: disable + warn("filter " .. v.name .. " didn't declare filter or filters.") + -- luacov: enable end end diff --git a/src/resources/filters/ast/traceexecution.lua b/src/resources/filters/ast/traceexecution.lua index 49dec6e65fd..8f68c3e282e 100644 --- a/src/resources/filters/ast/traceexecution.lua +++ b/src/resources/filters/ast/traceexecution.lua @@ -5,6 +5,10 @@ local data = {} +-- don't test coverage for filter tracing +-- TODO but maybe we should? +-- +-- luacov: disable if os.getenv("QUARTO_TRACE_FILTERS") then function init_trace(doc) table.insert(data, { @@ -66,4 +70,6 @@ else end function end_trace() end -end \ No newline at end of file +end + +-- luacov: enable diff --git a/src/resources/filters/ast/wrappedwriter.lua b/src/resources/filters/ast/wrappedwriter.lua index e41cd4d4dd8..69cbb2afba7 100644 --- a/src/resources/filters/ast/wrappedwriter.lua +++ b/src/resources/filters/ast/wrappedwriter.lua @@ -128,7 +128,9 @@ function wrapped_writer() if tbl ~= nil then local astHandler = _quarto.ast.resolve_handler(t) if astHandler == nil then + -- luacov: disable fatal("Internal error: no handler for " .. t) + -- luacov: enable end local nodeHandler = astHandler and handler[astHandler.ast_name] and handler[astHandler.ast_name].handle if nodeHandler == nil then diff --git a/src/resources/filters/common/collate.lua b/src/resources/filters/common/collate.lua new file mode 100644 index 00000000000..e040063df1a --- /dev/null +++ b/src/resources/filters/common/collate.lua @@ -0,0 +1,26 @@ +-- collate.lua +-- Copyright (C) 2023 Posit Software, PBC + +-- improved formatting for dumping tables +function collate(lst, predicate) + local result = pandoc.List({}) + local current_block = pandoc.List({}) + for _, block in ipairs(lst) do + if #current_block == 0 then + current_block = pandoc.List({ block }) + else + if predicate(block, current_block[#current_block]) then + current_block:insert(block) + else + if #current_block > 0 then + result:insert(current_block) + end + current_block = pandoc.List({ block }) + end + end + end + if #current_block > 0 then + result:insert(current_block) + end + return result +end diff --git a/src/resources/filters/common/crossref.lua b/src/resources/filters/common/crossref.lua new file mode 100644 index 00000000000..b1285328914 --- /dev/null +++ b/src/resources/filters/common/crossref.lua @@ -0,0 +1,5 @@ +-- crossref.lua +-- Copyright (C) 2023 Posit Software, PBC +-- +-- common crossref functions/data + diff --git a/src/resources/filters/common/error.lua b/src/resources/filters/common/error.lua index d2b504c48a4..930af18b78d 100644 --- a/src/resources/filters/common/error.lua +++ b/src/resources/filters/common/error.lua @@ -1,15 +1,24 @@ -- debug.lua -- Copyright (C) 2020-2022 Posit Software, PBC -function fail(message) +-- luacov: disable +function fail_and_ask_for_bug_report(message) + fail(message .. "\nThis is a quarto bug. Please consider filing a bug report at https://github.com/quarto-dev/quarto-cli/issues", 5) +end + +function fail(message, level) local file = currentFile() if file then - fatal("An error occurred while processing '" .. file .. "':\n" .. message, 4) + fatal("An error occurred while processing '" .. file .. "':\n" .. message, level or 4) else - fatal("An error occurred:\n" .. message, 4) + fatal("An error occurred:\n" .. message, level or 4) end end +function internal_error() + fail("This is an internal error. Please file a bug report at https://github.com/quarto-dev/quarto-cli/", 5) +end + function currentFile() -- if we're in a multifile contatenated render, return which file we're rendering local fileState = currentFileMetadataState() @@ -23,3 +32,4 @@ function currentFile() return nil end end +-- luacov: enable diff --git a/src/resources/filters/common/figures.lua b/src/resources/filters/common/figures.lua index 98b1f41e10a..662164db091 100644 --- a/src/resources/filters/common/figures.lua +++ b/src/resources/filters/common/figures.lua @@ -27,15 +27,10 @@ function figAlignAttribute(el) return validatedAlign(align) end --- is this an image containing a figure -function isFigureImage(el) - return hasFigureRef(el) and #el.caption > 0 -end - -- is this a Div containing a figure function isFigureDiv(el) if el.t == "Div" and hasFigureRef(el) then - return refCaptionFromDiv(el) ~= nil + return el.attributes[kFigCap] ~= nil or refCaptionFromDiv(el) ~= nil else return discoverLinkedFigureDiv(el) ~= nil end @@ -78,58 +73,6 @@ function discoverLinkedFigure(el, captionRequired) return nil end -function createFigureDiv(paraEl, fig) - flags.has_figure_divs = true - - -- create figure div - local figureDiv = pandoc.Div({}) - - -- transfer identifier - figureDiv.attr.identifier = fig.attr.identifier - fig.attr.identifier = "" - - -- provide anonymous identifier if necessary - if figureDiv.attr.identifier == "" then - figureDiv.attr.identifier = anonymousFigId() - end - - -- transfer classes - figureDiv.attr.classes = fig.attr.classes:clone() - tclear(fig.attr.classes) - - -- transfer fig. attributes - for k,v in pairs(fig.attr.attributes) do - if isFigAttribute(k) then - figureDiv.attr.attributes[k] = v - end - end - local attribs = tkeys(fig.attr.attributes) - for _,k in ipairs(attribs) do - if isFigAttribute(k) then - fig.attr.attributes[k] = v - end - end - - -- collect caption - local caption = fig.caption:clone() - fig.caption = {} - - -- if the image is a .tex file we need to tex \input - if latexIsTikzImage(fig) then - paraEl = pandoc.walk_block(paraEl, { - Image = latexFigureInline - }) - end - - -- insert the paragraph and a caption paragraph - figureDiv.content:insert(paraEl) - figureDiv.content:insert(pandoc.Para(caption)) - - -- return the div - return figureDiv - -end - function discoverLinkedFigureDiv(el, captionRequired) if el.t == "Div" and hasFigureRef(el) and @@ -156,8 +99,6 @@ function isReferenceableFig(figEl) not isAnonymousFigId(figEl.attr.identifier) end - - function latexIsTikzImage(image) return _quarto.format.isLatexOutput() and string.find(image.src, "%.tex$") end diff --git a/src/resources/filters/common/floats.lua b/src/resources/filters/common/floats.lua new file mode 100644 index 00000000000..0a9396272ce --- /dev/null +++ b/src/resources/filters/common/floats.lua @@ -0,0 +1,25 @@ +-- floats.lua +-- Copyright (C) 2023 Posit Software, PBC + +-- constants for float attributes +local kFloatAlignSuffix = "-align" +-- local kEnvSuffix = "-env" +-- local kAltSuffix = "-alt" +-- local kPosSuffix = "-pos" +-- local kCapSuffix = "-cap" +-- local kScapSuffix = "-scap" +-- local kResizeWidth = "resize.width" +-- local kResizeHeight = "resize.height" + +function align_attribute(float) + local prefix = refType(float.identifier) + local attr_key = prefix .. kFloatAlignSuffix + local default = pandoc.utils.stringify( + param(attr_key, pandoc.Str("default")) + ) + local align = attribute(float, attr_key, default) + if align == "default" then + align = default + end + return validatedAlign(align) +end \ No newline at end of file diff --git a/src/resources/filters/common/layout.lua b/src/resources/filters/common/layout.lua index 75f2713081d..c7b6d0ac718 100644 --- a/src/resources/filters/common/layout.lua +++ b/src/resources/filters/common/layout.lua @@ -7,22 +7,28 @@ kLayoutNcol = "layout-ncol" kLayoutNrow = "layout-nrow" kLayout = "layout" - -function layoutAlignAttribute(el, default) - return validatedAlign(attribute(el, kLayoutAlign, default)) +function layout_align_attribute(el_with_attr, default) + return validatedAlign(el_with_attr.attributes[kLayoutAlign] or default) end -function layoutVAlignAttribute(el, default) - return validatedVAlign(attribute(el, kLayoutVAlign, default)) +-- now unused. Remove? +-- luacov: disable +function layout_valign_attribute(el_with_attr, default) + return validatedVAlign(el_with_attr.attributes[kLayoutVAlign] or default) end +-- luacov: enable -function hasLayoutAttributes(el) - local attribs = tkeys(el.attr.attributes) +function attr_has_layout_attributes(attr) + local attribs = tkeys(attr.attributes) return attribs:includes(kLayoutNrow) or attribs:includes(kLayoutNcol) or attribs:includes(kLayout) end +function hasLayoutAttributes(el) + return attr_has_layout_attributes(el.attr) +end + function isLayoutAttribute(key) return key == kLayoutNrow or key == kLayoutNcol or @@ -49,11 +55,13 @@ end -- we often wrap a table in a div, unwrap it function tableFromLayoutCell(cell) - if #cell.content == 1 and cell.content[1].t == "Table" then - return cell.content[1] - else - return nil - end + local tbl + cell:walk({ + Table = function(t) + tbl = t + end + }) + return tbl end -- resolve alignment for layout cell (default to center or left depending @@ -72,19 +80,6 @@ function layoutCellAlignment(cell, align) end end --- does the layout cell have a ref parent -function layoutCellHasRefParent(cell) - if hasRefParent(cell) then - return true - else - local image = figureImageFromLayoutCell(cell) - if image then - return hasRefParent(image) - end - end - return false -end - function sizeToPercent(size) if size then local percent = string.match(size, "^([%d%.]+)%%$") diff --git a/src/resources/filters/common/log.lua b/src/resources/filters/common/log.lua index d8212fb9213..584358be1fe 100644 --- a/src/resources/filters/common/log.lua +++ b/src/resources/filters/common/log.lua @@ -5,6 +5,7 @@ -- could write to named filed (e.g. .filter.log) and client could read warnings and delete (also delete before run) -- always append b/c multiple filters +-- luacov: disable local function caller_info(offset) offset = offset or 3 local caller = debug.getinfo(offset, "lS") @@ -28,4 +29,4 @@ function fatal(message, offset) -- TODO write stack trace into log, and then exit. crash_with_stack_trace() end - +-- luacov: enable \ No newline at end of file diff --git a/src/resources/filters/common/pandoc.lua b/src/resources/filters/common/pandoc.lua index 378bcc4c3a3..85f281ad262 100644 --- a/src/resources/filters/common/pandoc.lua +++ b/src/resources/filters/common/pandoc.lua @@ -1,21 +1,16 @@ -- pandoc.lua -- Copyright (C) 2020-2022 Posit Software, PBC +local readqmd = require("readqmd") + function hasBootstrap() local hasBootstrap = param("has-bootstrap", false) return hasBootstrap end - -- read attribute w/ default function attribute(el, name, default) - -- FIXME: Doesn't attributes respond to __index? - for k,v in pairs(el.attributes) do - if k == name then - return v - end - end - return default + return el.attributes[name] or default end function removeClass(classes, remove) @@ -71,18 +66,26 @@ function combineFilters(filters) end function inlinesToString(inlines) + local pt = pandoc.utils.type(inlines) + if pt ~= "Inlines" then + -- luacov: disable + fail("inlinesToString: expected Inlines, got " .. pt) + return "" + -- luacov: enable + end return pandoc.utils.stringify(pandoc.Span(inlines)) end -- lua string to pandoc inlines function stringToInlines(str) if str then - return pandoc.List({pandoc.Str(str)}) + return pandoc.Inlines({pandoc.Str(str)}) else - return pandoc.List({}) + return pandoc.Inlines({}) end end +-- FIXME we should no longer be using this. -- lua string with markdown to pandoc inlines function markdownToInlines(str) if str then @@ -170,20 +173,48 @@ function compileTemplate(template, meta) return renderedDoc.blocks else + -- luacov: disable fail('Error compiling template: ' .. template) + -- luacov: enable end end -local md_shortcode = require("lpegshortcode") --- FIXME pick a better name for this. -function string_to_quarto_ast_blocks(text) - local after_shortcodes = md_shortcode.md_shortcode:match(text) or "" - local after_reading = pandoc.read(after_shortcodes, "markdown") +function merge_attrs(attr, ...) + local result = pandoc.Attr(attr.identifier, attr.classes, attr.attributes) + for _, a in ipairs({...}) do + if a ~= nil then + result.identifier = result.identifier or a.identifier + result.classes:extend(a.classes) + for k, v in pairs(a.attributes) do + result.attributes[k] = v + end + end + end + return result +end + +-- used to convert metatable, attributetable, etc +-- to plain tables that can be serialized to JSON +function as_plain_table(value) + local result = {} + for k, v in pairs(value) do + result[k] = v + end + return result +end + +function string_to_quarto_ast_blocks(text, opts) + local doc = readqmd.readqmd(text, opts or quarto_global_state.reader_options) - -- FIXME we should run the whole normalization pipeline here - local after_parsing = after_reading:walk(parse_extended_nodes()):walk(compute_flags()) - return after_parsing.blocks + -- run the whole normalization pipeline here to get extended AST nodes, etc. + for _, filter in ipairs(quarto_ast_pipeline()) do + doc = doc:walk(filter.filter) + end + + -- compute flags so we don't skip filters that depend on them + doc:walk(compute_flags()) + return doc.blocks end function string_to_quarto_ast_inlines(text, sep) diff --git a/src/resources/filters/common/refs.lua b/src/resources/filters/common/refs.lua index 9c08e042a32..10e62fb1645 100644 --- a/src/resources/filters/common/refs.lua +++ b/src/resources/filters/common/refs.lua @@ -6,16 +6,21 @@ kRefParent = "ref-parent" -- does this element have a figure label? function hasFigureRef(el) - return isFigureRef(el.attr.identifier) + return isFigureRef(el.identifier) end function isFigureRef(identifier) - return (identifier ~= nil) and string.find(identifier, "^fig%-") + if identifier == nil then + return nil + end + + local ref = refType(identifier) + return crossref.categories.by_ref_type[ref] ~= nil end -- does this element have a table label? function hasTableRef(el) - return isTableRef(el.attr.identifier) + return isTableRef(el.identifier) end function isTableRef(identifier) @@ -24,18 +29,11 @@ end -- does this element support sub-references function hasFigureOrTableRef(el) - return el.attr and (hasFigureRef(el) or hasTableRef(el)) -end - - -function isRefParent(el) - return el.t == "Div" and - (hasFigureRef(el) or hasTableRef(el)) and - refCaptionFromDiv(el) ~= nil + return hasFigureRef(el) or hasTableRef(el) end function hasRefParent(el) - return el.attr.attributes[kRefParent] ~= nil + return el.attributes[kRefParent] ~= nil end function refType(id) @@ -62,31 +60,4 @@ end function emptyCaption() return pandoc.Str("") -end - -function hasSubRefs(divEl, type) - if hasFigureOrTableRef(divEl) and not hasRefParent(divEl) then - -- children w/ parent id - local found = false - local function checkForParent(el) - if not found then - if hasRefParent(el) then - if not type or (refType(el.attr.identifier) == type) then - found = true - end - end - - end - end - _quarto.ast.walk(divEl, { - Div = checkForParent, - Image = checkForParent - }) - return found - else - return false - end -end - - - +end \ No newline at end of file diff --git a/src/resources/filters/common/string.lua b/src/resources/filters/common/string.lua index b657f5490a3..b380c3f22ee 100644 --- a/src/resources/filters/common/string.lua +++ b/src/resources/filters/common/string.lua @@ -43,8 +43,28 @@ function patternEscape(str) return str:gsub("([^%w])", "%%%1") end +function html_escape(s, in_attribute) + return s:gsub("[<>&\"']", + function(x) + if x == '<' then + return '<' + elseif x == '>' then + return '>' + elseif x == '&' then + return '&' + elseif in_attribute and x == '"' then + return '"' + elseif in_attribute and x == "'" then + return ''' + else + return x + end + end) +end + -- Escape '%' in string by replacing by '%%' -- This is especially useful in Lua patterns to escape a '%' function percentEscape(str) return str:gsub("%%", "%%%%") -end \ No newline at end of file +end + diff --git a/src/resources/filters/common/tables.lua b/src/resources/filters/common/tables.lua index dd14a80a43a..8e23c76f20b 100644 --- a/src/resources/filters/common/tables.lua +++ b/src/resources/filters/common/tables.lua @@ -32,7 +32,7 @@ function parseTableCaption(caption) end end if beginIndex ~= nil then - local attrText = trim(inlinesToString(tslice(caption, beginIndex, #caption))) + local attrText = trim(inlinesToString(pandoc.Inlines(tslice(caption, beginIndex, #caption)))) attrText = attrText:gsub("“", "'"):gsub("”", "'") local elWithAttr = pandoc.read("## " .. attrText).blocks[1] if elWithAttr.attr ~= nil then diff --git a/src/resources/filters/common/validate.lua b/src/resources/filters/common/validate.lua index b6a1cac0ec5..52097c1ce53 100644 --- a/src/resources/filters/common/validate.lua +++ b/src/resources/filters/common/validate.lua @@ -16,8 +16,10 @@ function validateInList(value, list, attribute, default) if value == "default" then return default elseif value and not list:includes(value) then + -- luacov: disable warn("Invalid " .. attribute .. " attribute value: " .. value) return default + -- luacov: enable elseif value then return value else diff --git a/src/resources/filters/common/wrapped-filter.lua b/src/resources/filters/common/wrapped-filter.lua index 4226d767e41..7bb7e1f189d 100644 --- a/src/resources/filters/common/wrapped-filter.lua +++ b/src/resources/filters/common/wrapped-filter.lua @@ -98,6 +98,7 @@ function makeWrappedJsonFilter(scriptFile, filterHandler) local custom_node_map = {} local has_custom_nodes = false doc = doc:walk({ + -- FIXME: This is broken with new AST. Needs to go through Custom node instead. RawInline = function(raw) local custom_node, t, kind = _quarto.ast.resolve_custom_data(raw) if custom_node ~= nil then diff --git a/src/resources/filters/crossref/#crossref.lua# b/src/resources/filters/crossref/#crossref.lua# new file mode 100644 index 00000000000..cdc681af1ca --- /dev/null +++ b/src/resources/filters/crossref/#crossref.lua# @@ -0,0 +1,82 @@ + -- crossref.lua +-- Copyright (C) 2020-2023 Posit Software, PBC + +-- this is the standalone version of our crossref filters, used in the IDEs for auto-completion + +-- required version +PANDOC_VERSION:must_be_at_least '2.13' + +-- [import] +function import(script) + local path = PANDOC_SCRIPT_FILE:match("(.*[/\\])") + dofile(path .. script) +end + +import("../mainstateinit.lua") + +import("../ast/customnodes.lua") +import("../ast/emulatedfilter.lua") +import("../ast/parse.lua") +import("../ast/render.lua") +import("../ast/runemulation.lua") +import("../ast/traceexecution.lua") +import("../ast/wrappedwriter.lua") + + +import("index.lua") +import("preprocess.lua") +import("sections.lua") +import("figures.lua") +import("tables.lua") +import("equations.lua") +import("listings.lua") +import("theorems.lua") +import("qmd.lua") +import("refs.lua") +import("meta.lua") +import("format.lua") +import("options.lua") +import("../normalize/flags.lua") +import("../normalize/pandoc3.lua") +import("../common/lunacolors.lua") +import("../common/log.lua") +import("../common/pandoc.lua") +import("../common/format.lua") +import("../common/base64.lua") +import("../common/options.lua") +import("../common/refs.lua") +import("../common/filemetadata.lua") +import("../common/figures.lua") +import("../common/tables.lua") +import("../common/theorems.lua") +import("../common/meta.lua") +import("../common/table.lua") +import("../common/string.lua") +import("../common/debug.lua") +import("../common/layout.lua") + +-- [/import] + +initCrossrefIndex() + +-- chain of filters +return { + init_crossref_options(), + compute_flags(), + parse_pandoc3_figures(), + crossref_preprocess(), + crossref_preprocess_theorems(), + combineFilters({ + file_metadata(), + qmd(), + sections(), + crossref_figures(), + crossref_tables(), + equations(), + listings(), + crossref_theorems(), + }), + resolveRefs(), + crossrefMetaInject(), + writeIndex() +} \ No newline at end of file diff --git a/src/resources/filters/crossref/crossref-standalone.lua b/src/resources/filters/crossref/crossref-standalone.lua index d510670a7de..47762e0438d 100644 --- a/src/resources/filters/crossref/crossref-standalone.lua +++ b/src/resources/filters/crossref/crossref-standalone.lua @@ -10,6 +10,9 @@ function import(script) local path = PANDOC_SCRIPT_FILE:match("(.*[/\\])") dofile(path .. script) end + +-- FIXME: needs updating for float-reftargets branch. + import("../mainstateinit.lua") import("index.lua") import("preprocess.lua") @@ -17,7 +20,6 @@ import("sections.lua") import("figures.lua") import("tables.lua") import("equations.lua") -import("listings.lua") import("theorems.lua") import("qmd.lua") import("refs.lua") @@ -46,7 +48,7 @@ initCrossrefIndex() -- chain of filters return { init_crossref_options(), - crossref_preprocess(), + crossref_mark_subfloats(), crossref_preprocess_theorems(), combineFilters({ file_metadata(), @@ -55,7 +57,6 @@ return { crossref_figures(), crossref_tables(), equations(), - listings(), crossref_theorems(), }), resolveRefs(), diff --git a/src/resources/filters/crossref/crossref.lua b/src/resources/filters/crossref/crossref.lua index bb93d8c9b04..2037fdb4220 100644 --- a/src/resources/filters/crossref/crossref.lua +++ b/src/resources/filters/crossref/crossref.lua @@ -22,61 +22,208 @@ import("../ast/runemulation.lua") import("../ast/traceexecution.lua") import("../ast/wrappedwriter.lua") - -import("index.lua") -import("preprocess.lua") -import("sections.lua") -import("figures.lua") -import("tables.lua") -import("equations.lua") -import("listings.lua") -import("theorems.lua") -import("qmd.lua") -import("refs.lua") -import("meta.lua") -import("format.lua") -import("options.lua") -import("../normalize/flags.lua") -import("../normalize/pandoc3.lua") -import("../common/lunacolors.lua") -import("../common/log.lua") -import("../common/pandoc.lua") -import("../common/format.lua") import("../common/base64.lua") +import("../common/citations.lua") +import("../common/colors.lua") +import("../common/collate.lua") +import("../common/debug.lua") +import("../common/error.lua") +import("../common/figures.lua") +import("../common/filemetadata.lua") +import("../common/floats.lua") +import("../common/format.lua") +import("../common/latex.lua") +import("../common/layout.lua") +import("../common/list.lua") +import("../common/log.lua") +import("../common/lunacolors.lua") +import("../common/maporcall.lua") +import("../common/meta.lua") import("../common/options.lua") +import("../common/pandoc.lua") +import("../common/paths.lua") import("../common/refs.lua") -import("../common/filemetadata.lua") -import("../common/figures.lua") +import("../common/string.lua") +import("../common/table.lua") import("../common/tables.lua") import("../common/theorems.lua") -import("../common/meta.lua") -import("../common/table.lua") -import("../common/string.lua") -import("../common/debug.lua") -import("../common/layout.lua") +import("../common/url.lua") +import("../common/validate.lua") +import("../common/wrapped-filter.lua") + +import("../quarto-init/configurefilters.lua") +import("../quarto-init/includes.lua") +import("../quarto-init/resourcerefs.lua") + +import("../normalize/flags.lua") +import("../normalize/normalize.lua") +import("../normalize/parsehtml.lua") +import("../normalize/extractquartodom.lua") + +import("../crossref/custom.lua") +import("../crossref/index.lua") +import("../crossref/preprocess.lua") +import("../crossref/sections.lua") +import("../crossref/figures.lua") +import("../crossref/tables.lua") +import("../crossref/equations.lua") +import("../crossref/theorems.lua") +import("../crossref/qmd.lua") +import("../crossref/refs.lua") +import("../crossref/meta.lua") +import("../crossref/format.lua") +import("../crossref/options.lua") + +import("../quarto-pre/bibliography-formats.lua") +import("../quarto-pre/book-links.lua") +import("../quarto-pre/book-numbering.lua") +import("../quarto-pre/code-annotation.lua") +import("../quarto-pre/code-filename.lua") +import("../quarto-pre/engine-escape.lua") +import("../quarto-pre/figures.lua") +import("../quarto-pre/hidden.lua") +import("../quarto-pre/include-paths.lua") +import("../quarto-pre/input-traits.lua") +import("../quarto-pre/line-numbers.lua") +import("../quarto-pre/meta.lua") +import("../quarto-pre/options.lua") +import("../quarto-pre/output-location.lua") +import("../quarto-pre/outputs.lua") +import("../quarto-pre/panel-input.lua") +import("../quarto-pre/panel-layout.lua") +import("../quarto-pre/panel-sidebar.lua") +import("../quarto-pre/parsefiguredivs.lua") +import("../quarto-pre/project-paths.lua") +import("../quarto-pre/resourcefiles.lua") +import("../quarto-pre/results.lua") +import("../quarto-pre/shortcodes-handlers.lua") +import("../quarto-pre/table-classes.lua") +import("../quarto-pre/table-captions.lua") +import("../quarto-pre/table-colwidth.lua") +import("../quarto-pre/table-rawhtml.lua") +import("../quarto-pre/theorems.lua") + +import("../customnodes/latexenv.lua") +import("../customnodes/latexcmd.lua") +import("../customnodes/htmltag.lua") +import("../customnodes/shortcodes.lua") +import("../customnodes/content-hidden.lua") +import("../customnodes/decoratedcodeblock.lua") +import("../customnodes/callout.lua") +import("../customnodes/panel-tabset.lua") +import("../customnodes/floatreftarget.lua") + +import("../quarto-init/metainit.lua") -- [/import] initCrossrefIndex() --- chain of filters -return { - init_crossref_options(), - compute_flags(), - parse_pandoc3_figures(), - crossref_preprocess(), - crossref_preprocess_theorems(), - combineFilters({ +initShortcodeHandlers() + +local quarto_init_filters = { + { name = "init-quarto-meta-init", filter = quarto_meta_init() }, + { name = "init-quarto-custom-meta-init", filter = { + Meta = function(meta) + content_hidden_meta(meta) + end + }}, +} + +-- v1.4 change: quartoNormalize is responsible for producing a +-- "normalized" document that is ready for quarto-pre, etc. +-- notably, user filters will run on the normalized document and +-- see a "Quarto AST". For example, Figure nodes are no longer +-- going to be present, and will instead be represented by +-- our custom AST infrastructure (FloatRefTarget specifically). + +local quarto_normalize_filters = { + { name = "normalize", filter = filterIf(function() + if quarto_global_state.active_filters == nil then + return false + end + return quarto_global_state.active_filters.normalization + end, normalize_filter()) }, + + { name = "pre-table-merge-raw-html", + filter = table_merge_raw_html() + }, + + -- { name = "pre-content-hidden-meta", + -- filter = content_hidden_meta() }, + + -- 2023-04-11: We want to combine combine-1 and combine-2, but parse_md_in_html_rawblocks + -- can't be combined with parse_html_tables. combineFilters + -- doesn't inspect the contents of the results in the inner loop in case + -- the result is "spread" into a Blocks or Inlines. + + { name = "normalize-combined-1", filter = combineFilters({ + parse_html_tables(), + parse_extended_nodes(), + code_filename(), + }) + }, + { + name = "normalize-combine-2", + filter = combineFilters({ + parse_md_in_html_rawblocks(), + parse_floats(), + }), + }, +} + +local quarto_pre_filters = { + -- quarto-pre + + { name = "flags", filter = compute_flags() }, + + { name = "pre-shortcodes-filter", + filter = shortcodes_filter(), + flags = { "has_shortcodes" } }, +} + +local quarto_crossref_filters = { + + { name = "crossref-preprocess-floats", filter = crossref_mark_subfloats(), + }, + + { name = "crossref-preprocessTheorems", + filter = crossref_preprocess_theorems(), + flags = { "has_theorem_refs" } }, + + { name = "crossref-combineFilters", filter = combineFilters({ file_metadata(), qmd(), sections(), crossref_figures(), - crossref_tables(), equations(), - listings(), crossref_theorems(), - }), - resolveRefs(), - crossrefMetaInject(), - writeIndex() -} \ No newline at end of file + })}, + + { name = "crossref-resolveRefs", filter = resolveRefs(), + flags = { "has_cites" } }, + + { name = "crossref-crossrefMetaInject", filter = crossrefMetaInject() }, + { name = "crossref-writeIndex", filter = writeIndex() }, +} + +local filterList = {} + +tappend(filterList, quarto_init_filters) +tappend(filterList, quarto_normalize_filters) +tappend(filterList, quarto_pre_filters) +tappend(filterList, quarto_crossref_filters) + +local result = run_as_extended_ast({ + pre = { + init_options() + }, + afterFilterPass = function() + -- After filter pass is called after each pass through a filter group + -- allowing state or other items to be handled + resetFileMetadata() + end, + filters = filterList, +}) + +return result \ No newline at end of file diff --git a/src/resources/filters/crossref/custom.lua b/src/resources/filters/crossref/custom.lua new file mode 100644 index 00000000000..2a207cd309c --- /dev/null +++ b/src/resources/filters/crossref/custom.lua @@ -0,0 +1,82 @@ +-- custom.lua +-- Copyright (C) 2023 Posit Software, PBC +-- +-- custom crossref categories + +function initialize_custom_crossref_categories(meta) + local cr = meta["crossref"] + if pandoc.utils.type(cr) ~= "table" then + return nil + end + local custom = cr["custom"] + if custom == nil then + return nil + end + if type(custom) ~= "table" then + -- luacov: disable + fail_and_ask_for_bug_report("crossref.custom entry must be a table") + return nil + -- luacov: enable + end + local keys = { + "default-caption-location", + "kind", + "name", + "prefix", + "ref-type", + "latex-env", + "latex-list-of-name" + } + local obj_mapping = { + ["default-caption-location"] = "default_caption_location", + ["latex-env"] = "latex_env", + ["latex-list-of-name"] = "latex_list_of_name", + ["ref-type"] = "ref_type" + } + for _, v in ipairs(custom) do + local entry = {} + for _, key in ipairs(keys) do + if v[key] ~= nil then + entry[key] = pandoc.utils.stringify(v[key]) + end + end + if entry["default-caption-location"] == nil then + entry["default-caption-location"] = "bottom" + end + -- slightly inefficient because we recompute the indices at + -- every call, but should be totally ok for the number of categories + -- we expect to see in documents + local obj_entry = {} + for k, v in pairs(entry) do + if obj_mapping[k] ~= nil then + obj_entry[obj_mapping[k]] = v + else + obj_entry[k] = v + end + end + add_crossref_category(obj_entry) + + if quarto.doc.isFormat("pdf") then + metaInjectLatex(meta, function(inject) + local env_name = entry["latex-env"] + local name = entry["name"] + local env_prefix = entry["prefix"] + local ref_type = entry["ref-type"] + local list_of_name = entry["latex-list-of-name"] + + -- FIXME do we need different "lop" extensions for each category? + -- we should be able to test this by creating a document with listings and diagrams + + inject( + usePackage("float") .. "\n" .. + "\\floatstyle{plain}\n" .. + "\\@ifundefined{c@chapter}{\\newfloat{" .. env_name .. "}{h}{lop}}{\\newfloat{" .. env_name .. "}{h}{lop}[chapter]}\n" .. + "\\floatname{".. env_name .. "}{" .. titleString(ref_type, env_prefix) .. "}\n" + ) + inject( + "\\newcommand*\\listof" .. env_name .. "s{\\listof{" .. env_name .. "}{" .. listOfTitle(list_of_name, "List of " .. name .. "s") .. "}}\n" + ) + end) + end + end +end \ No newline at end of file diff --git a/src/resources/filters/crossref/figures.lua b/src/resources/filters/crossref/figures.lua index 5c488aece2d..72973569a83 100644 --- a/src/resources/filters/crossref/figures.lua +++ b/src/resources/filters/crossref/figures.lua @@ -4,58 +4,42 @@ -- process all figures function crossref_figures() return { - Div = function(el) - if isFigureDiv(el) and isReferenceableFig(el) then - local caption = refCaptionFromDiv(el) - if caption then - process_figure(el, caption.content) - end + -- process a float + -- adding it to the global index of floats (figures, tables, etc) + -- + -- in 1.4, we won't re-write its caption here, but instead we'll + -- do it at the render filter. + + FloatRefTarget = function(float) + -- if figure is unlabeled, do not process + if is_unlabeled_float(float) then + return nil end - return el - end, - Para = function(el) - local image = discoverFigure(el) - if image and isFigureImage(image) then - process_figure(image, image.caption) + -- get label and base caption + -- local label = el.attr.identifier + local kind = refType(float.identifier) + if kind == nil then + -- luacov: disable + warn("Could not determine float type for " .. float.identifier) + return nil + -- luacov: enable end - return el + + -- determine order, parent, and displayed caption + local order + local parent = float.parent_id + if (parent) then + order = nextSubrefOrder() + else + order = indexNextOrder(kind) + end + + float.order = order + -- update the index + indexAddEntry(float.identifier, parent, order, {float.caption_long}) + return float end } end - --- process a figure, re-writing its caption as necessary and --- adding it to the global index of figures -function process_figure(el, captionContent) - -- get label and base caption - local label = el.attr.identifier - local caption = captionContent:clone() - - -- determine order, parent, and displayed caption - local order - local parent = el.attr.attributes[kRefParent] - if (parent) then - order = nextSubrefOrder() - prependSubrefNumber(captionContent, order) - else - order = indexNextOrder("fig") - if _quarto.format.isLatexOutput() then - tprepend(captionContent, { - pandoc.RawInline('latex', '\\label{' .. label .. '}') - }) - elseif _quarto.format.isAsciiDocOutput() or _quarto.format.isTypstOutput() then - el.attr.identifier = label - else - tprepend(captionContent, figureTitlePrefix(order)) - end - end - - -- update the index - indexAddEntry(label, parent, order, caption) -end - - -function figureTitlePrefix(order) - return titlePrefix("fig", param("crossref-fig-title", "Figure"), order) -end diff --git a/src/resources/filters/crossref/format.lua b/src/resources/filters/crossref/format.lua index 75019b69084..54c97eb74a1 100644 --- a/src/resources/filters/crossref/format.lua +++ b/src/resources/filters/crossref/format.lua @@ -14,12 +14,18 @@ function titleString(type, default) return pandoc.utils.stringify(title(type, default)) end -function titlePrefix(type, default, order) +function titlePrefix(type, default, order, with_delimiter) + if with_delimiter == nil then + with_delimiter = true + end + local prefix = title(type, default) table.insert(prefix, nbspString()) tappend(prefix, numberOption(type, order)) - tappend(prefix, titleDelim()) - table.insert(prefix, pandoc.Space()) + if with_delimiter then + tappend(prefix, titleDelim()) + table.insert(prefix, pandoc.Space()) + end return prefix end @@ -56,7 +62,17 @@ end function refPrefix(type, upper) local opt = type .. "-prefix" - local default = stringToInlines(param("crossref-" .. type .. "-prefix", type .. ".")) + local default = param("crossref-" .. type .. "-prefix") + if default == nil then + default = crossref.categories.by_ref_type[type] + if default ~= nil then + default = default.prefix + end + end + if default == nil then + default = type .. "." + end + default = stringToInlines(default) local prefix = crossrefOption(opt, default) if upper then local el = pandoc.Plain(prefix) @@ -141,7 +157,7 @@ function formatNumberOption(type, order, default) end num = sectionIndex .. "." .. num end - return { pandoc.Str(num) } + return pandoc.Inlines({ pandoc.Str(num) }) end -- Compute option name and default value @@ -191,7 +207,7 @@ function formatNumberOption(type, order, default) if section then tprepend(option, { pandoc.Str(tostring(section[1]) .. ".") }) end - return { option } + return pandoc.Inlines({ option }) end end diff --git a/src/resources/filters/crossref/index.lua b/src/resources/filters/crossref/index.lua index 98a862136a8..0eda3037465 100644 --- a/src/resources/filters/crossref/index.lua +++ b/src/resources/filters/crossref/index.lua @@ -115,7 +115,11 @@ function writeKeysIndex(indexFile) } -- add caption if we have one if v.caption ~= nil then - entry.caption = inlinesToString(v.caption) + if v.caption[1].t == "Str" then + entry.caption = v.caption[1].text + else + entry.caption = inlinesToString(pandoc.Inlines(v.caption[1].content)) + end else entry.caption = "" end @@ -192,7 +196,11 @@ function writeFullIndex(indexFile) } -- add caption if we have one if v.caption ~= nil then - entry.caption = inlinesToString(v.caption) + if pandoc.utils.type(v.caption[1]) == "Inline" then + entry.caption = inlinesToString(pandoc.Inlines({v.caption[1]})) + else + entry.caption = inlinesToString(pandoc.Inlines(v.caption[1].content)) + end else entry.caption = "" end diff --git a/src/resources/filters/crossref/listings.lua b/src/resources/filters/crossref/listings.lua deleted file mode 100644 index e649de2fb38..00000000000 --- a/src/resources/filters/crossref/listings.lua +++ /dev/null @@ -1,103 +0,0 @@ --- listings.lua --- Copyright (C) 2020-2022 Posit Software, PBC - -local constants = require("modules/constants") - -function isListingRef(identifier) - return string.match(identifier, "^lst%-[^ ]+$") -end - --- process all listings -function listings() - - return { - DecoratedCodeBlock = function(node) - local el = node.code_block - local label = string.match(el.attr.identifier, "^lst%-[^ ]+$") - local caption = el.attr.attributes[constants.kLstCap] - if label and caption then - -- the listing number - local order = indexNextOrder("lst") - - -- generate content from markdown caption - local captionContent = markdownToInlines(caption) - - -- add the listing to the index - indexAddEntry(label, nil, order, captionContent) - - node.caption = captionContent - node.order = order - return node - end - return nil - end, - - CodeBlock = function(el) - local label = string.match(el.attr.identifier, "^lst%-[^ ]+$") - local caption = el.attr.attributes[constants.kLstCap] - if label and caption then - - -- the listing number - local order = indexNextOrder("lst") - - -- generate content from markdown caption - local captionContent = markdownToInlines(caption) - - -- add the listing to the index - indexAddEntry(label, nil, order, captionContent) - - if _quarto.format.isLatexOutput() then - - -- add listing class to the code block - el.attr.classes:insert("listing") - - -- if we are use the listings package we don't need to do anything - -- further, otherwise generate the listing div and return it - if not latexListings() then - local listingDiv = pandoc.Div({}) - local env = "\\begin{codelisting}" - if el.classes:includes('code-annotation-code') then - env = env .. "[H]" - end - listingDiv.content:insert(pandoc.RawBlock("latex", env)) - local listingCaption = pandoc.Plain({pandoc.RawInline("latex", "\\caption{")}) - listingCaption.content:extend(captionContent) - listingCaption.content:insert(pandoc.RawInline("latex", "}")) - listingDiv.content:insert(listingCaption) - listingDiv.content:insert(el) - listingDiv.content:insert(pandoc.RawBlock("latex", "\\end{codelisting}")) - return listingDiv - end - - else - - -- Prepend the title - tprepend(captionContent, listingTitlePrefix(order)) - - -- return a div with the listing - return pandoc.Div( - { - pandoc.Para(captionContent), - el - }, - pandoc.Attr(label, {"listing"}) - ) - end - - end - - -- if we get this far then just reflect back the el - return el - end - } - -end - -function listingTitlePrefix(order) - return titlePrefix("lst", "Listing", order) -end - - -function latexListings() - return param("listings", false) -end \ No newline at end of file diff --git a/src/resources/filters/crossref/meta.lua b/src/resources/filters/crossref/meta.lua index d2997fd63e0..37fc665a245 100644 --- a/src/resources/filters/crossref/meta.lua +++ b/src/resources/filters/crossref/meta.lua @@ -19,7 +19,7 @@ function crossrefMetaInject() "}\n" ) - if latexListings() then + if param("listings", false) then inject( "\\newcommand*\\listoflistings\\lstlistoflistings\n" .. "\\AtBeginDocument{%\n" .. diff --git a/src/resources/filters/crossref/options.lua b/src/resources/filters/crossref/options.lua index d021fefc07b..f7a184e4876 100644 --- a/src/resources/filters/crossref/options.lua +++ b/src/resources/filters/crossref/options.lua @@ -2,20 +2,15 @@ -- Copyright (C) 2020-2022 Posit Software, PBC -- initialize options from 'crossref' metadata value -function init_crossref_options() - return { - Meta = function(meta) - crossref.options = readFilterOptions(meta, "crossref") +function init_crossref_options(meta) + crossref.options = readFilterOptions(meta, "crossref") - -- automatically set maxHeading to 1 if we are in chapters mode, otherwise set to max (7) - if crossrefOption("chapters", false) then - crossref.maxHeading = 1 - else - crossref.maxHeading = 7 - end - - end - } + -- automatically set maxHeading to 1 if we are in chapters mode, otherwise set to max (7) + if crossrefOption("chapters", false) then + crossref.maxHeading = 1 + else + crossref.maxHeading = 7 + end end -- get option value diff --git a/src/resources/filters/crossref/preprocess.lua b/src/resources/filters/crossref/preprocess.lua index ec0e51a25de..0dd7c2b7aff 100644 --- a/src/resources/filters/crossref/preprocess.lua +++ b/src/resources/filters/crossref/preprocess.lua @@ -3,101 +3,26 @@ -- figures and tables support sub-references. mark them up before -- we proceed with crawling for cross-refs -function crossref_preprocess() - +function crossref_mark_subfloats() return { - Pandoc = function(doc) - local walkRefs - walkRefs = function(parentId) - return { - Div = function(el) - if hasFigureOrTableRef(el) then - - -- provide error caption if there is none - if not refCaptionFromDiv(el) then - local err = pandoc.Para(noCaption()) - el.content:insert(err) - end - - if parentId ~= nil then - if refType(el.attr.identifier) == refType(parentId) then - el.attr.attributes[kRefParent] = parentId - end - else - -- mark as table parent if required - if isTableRef(el.attr.identifier) then - el.attr.classes:insert("tbl-parent") - flags.has_tbl_parent = true -- to be able to early-out later on - end - el = _quarto.ast.walk(el, walkRefs(el.attr.identifier)) - end + traverse = "topdown", + FloatRefTarget = function(float) + float.content = _quarto.ast.walk(float.content, { + FloatRefTarget = function(subfloat) + crossref.subfloats[subfloat.identifier] = { + parent_id = float.identifier + } + subfloat.parent_id = float.identifier + subfloat.content = _quarto.ast.walk(subfloat.content, { + Image = function(image) + image.attributes[kRefParent] = float.identifier + return image end - return el - end, - - Table = function(el) - return preprocessTable(el, parentId) - end, - - RawBlock = function(el) - return preprocessRawTableBlock(el, parentId) - end, - - Para = function(el) - - -- provide error caption if there is none - local fig = discoverFigure(el, false) - if fig and hasFigureRef(fig) and #fig.caption == 0 then - if isFigureRef(parentId) then - fig.caption:insert(emptyCaption()) - fig.title = "fig:" .. fig.title - else - fig.caption:insert(noCaption()) - end - end - - -- if we have a parent fig: then mark it's sub-refs - if parentId and isFigureRef(parentId) then - local image = discoverFigure(el) - if image and isFigureImage(image) then - image.attr.attributes[kRefParent] = parentId - end - end - - return el - end - } - end - - -- walk all blocks in the document - for i,el in pairs(doc.blocks) do - -- always wrap referenced tables in a div - if el.t == "Table" then - doc.blocks[i] = preprocessTable(el, nil) - elseif el.t == "RawBlock" then - doc.blocks[i] = preprocessRawTableBlock(el, nil) - elseif el.t ~= "Header" then - local parentId = nil - if hasFigureOrTableRef(el) and el.content ~= nil then - parentId = el.attr.identifier - - -- mark as parent - if isTableRef(el.attr.identifier) then - el.attr.classes:insert("tbl-parent") - end - - -- provide error caption if there is none - if not refCaptionFromDiv(el) then - local err = pandoc.Para(noCaption()) - el.content:insert(err) - end - end - doc.blocks[i] = _quarto.ast.walk(el, walkRefs(parentId)) + }) + return subfloat end - end - - return doc - + }) + return float, false end } end diff --git a/src/resources/filters/crossref/refs.lua b/src/resources/filters/crossref/refs.lua index 041d08e3e2f..02b08bc5b68 100644 --- a/src/resources/filters/crossref/refs.lua +++ b/src/resources/filters/crossref/refs.lua @@ -1,6 +1,8 @@ -- refs.lua -- Copyright (C) 2020-2022 Posit Software, PBC +-- FIXME this resolveRefs filter should be in post-processing +-- since it emits format-specific AST elements -- resolve references function resolveRefs() @@ -70,7 +72,16 @@ function resolveRefs() elseif _quarto.format.isAsciiDocOutput() then ref = pandoc.List({pandoc.RawInline('asciidoc', '<<' .. label .. '>>')}) elseif _quarto.format.isTypstOutput() then - ref = pandoc.List({pandoc.RawInline('typst', '@' .. label)}) + -- if we're referencing a subfloat, + -- we need to package the parent_id information in the + -- supplement as well, so that we can provide + -- better numbering in the typst renderer + local subfloat_info = crossref.subfloats[label] + if subfloat_info == nil then + ref = pandoc.List({pandoc.RawInline('typst', '@' .. label)}) + else + ref = pandoc.List({pandoc.RawInline('typst', '@' .. label .. '[45127368-afa1-446a-820f-fc64c546b2c5%' .. subfloat_info.parent_id .. ']')}) + end else if not resolve then local refClasses = pandoc.List({"quarto-unresolved-ref"}) @@ -126,7 +137,25 @@ function resolveRefs() } end -function autoRefLabel(parentId) + +-- we're removing the dashes from this uuid because +-- it makes it easier to handling it in lua patterns + +local quarto_auto_label_safe_latex_uuid = "539a35d47e664c97a50115a146a7f1bd" +function autoRefLabel(refType) + local index = 1 + while true do + local label = refType .. "-" .. quarto_auto_label_safe_latex_uuid .. "-" ..tostring(index) + if not crossref.autolabels:includes(label) then + crossref.autolabels:insert(label) + return label + else + index = index + 1 + end + end +end + +function autoSubrefLabel(parentId) local index = 1 while true do local label = parentId .. "-" .. tostring(index) @@ -161,10 +190,16 @@ end function validRefTypes() local types = tkeys(theoremTypes) - table.insert(types, "fig") - table.insert(types, "tbl") + for k, _ in pairs(crossref.categories.by_ref_type) do + table.insert(types, k) + -- if v.type ~= nil and not tcontains(types, v.type) then + -- table.insert(types, v.type) + -- end + end + -- table.insert(types, "fig") + -- table.insert(types, "tbl") + -- table.insert(types, "lst") table.insert(types, "eq") - table.insert(types, "lst") table.insert(types, "sec") return types end diff --git a/src/resources/filters/crossref/tables.lua b/src/resources/filters/crossref/tables.lua index ec54cede13c..036cc0fca1e 100644 --- a/src/resources/filters/crossref/tables.lua +++ b/src/resources/filters/crossref/tables.lua @@ -7,43 +7,6 @@ local patterns = require("modules/patterns") -function crossref_tables() - return { - Div = function(el) - if isTableDiv(el) and isReferenceableTbl(el) then - - -- are we a parent of subrefs? If so then process the caption - -- at the bottom of the div - if hasSubRefs(el, "tbl") then - - local caption = refCaptionFromDiv(el) - if not caption then - caption = pandoc.Para(noCaption()) - el.content:insert(caption) - end - local captionClone = caption:clone().content - local label = el.attr.identifier - local order = indexNextOrder("tbl") - prependTitlePrefix(caption, label, order) - indexAddEntry(label, nil, order, captionClone) - - else - -- look for various ways of expressing tables in a div - local processors = { processMarkdownTable, processRawTable } - for _, process in ipairs(processors) do - local tblDiv = process(el) - if tblDiv then - return tblDiv - end - end - end - end - -- default to just reflecting the div back - return el - end - } -end - function preprocessRawTableBlock(rawEl, parentId) local function divWrap(el, label, caption) @@ -67,7 +30,7 @@ function preprocessRawTableBlock(rawEl, parentId) -- remove label from caption rawEl.text = rawEl.text:gsub(captionPattern, "%1" .. caption:gsub("%%", "%%%%") .. "%3", 1) elseif parentId then - label = autoRefLabel(parentId) + label = autoSubrefLabel(parentId) end if label then @@ -87,7 +50,7 @@ function preprocessRawTableBlock(rawEl, parentId) -- remove label from caption rawEl.text = rawEl.text:gsub(captionPattern, "%1%2%4", 1) elseif parentId then - label = autoRefLabel(parentId) + label = autoSubrefLabel(parentId) end if label then @@ -126,7 +89,7 @@ function preprocessTable(el, parentId) -- if there is a parent then auto-assign a label if there is none elseif parentId then - label = autoRefLabel(parentId) + label = autoSubrefLabel(parentId) end if label then @@ -148,28 +111,37 @@ function preprocessTable(el, parentId) end -function processMarkdownTable(divEl) - for i,el in pairs(divEl.content) do +function process(float) + local changed = false + local content = float.content + if pandoc.utils.type(content) ~= "Blocks" then + content = pandoc.List({content}) + end + for _,el in ipairs(content) do if el.t == "Table" then if el.caption.long ~= nil and #el.caption.long > 0 then local label = divEl.attr.identifier local caption = el.caption.long[#el.caption.long] - processMarkdownTableEntry(divEl, el, label, caption) - return divEl + processMarkdownTableEntry(float) + changed = true + return float end end end + if changed then + return float + end return nil end -function processMarkdownTableEntry(divEl, el, label, caption) +function processMarkdownTableEntry(float) -- clone the caption so we can add a clean copy to our index local captionClone = caption.content:clone() -- determine order / insert prefix local order - local parent = divEl.attr.attributes[kRefParent] + local parent = float.parent_id if (parent) then order = nextSubrefOrder() prependSubrefNumber(caption.content, order) @@ -250,6 +222,16 @@ function isTableDiv(el) end +function float_title_prefix(float, withDelimiter) + local category = crossref.categories.by_name[float.type] + if category == nil then + fail("unknown float type '" .. float.type .. "'") + return + end + + return titlePrefix(category.ref_type, category.name, float.order, withDelimiter) +end + function tableTitlePrefix(order) return titlePrefix("tbl", "Table", order) end diff --git a/src/resources/filters/customnodes/callout.lua b/src/resources/filters/customnodes/callout.lua index 26087078657..17617af47b8 100644 --- a/src/resources/filters/customnodes/callout.lua +++ b/src/resources/filters/customnodes/callout.lua @@ -339,7 +339,7 @@ function epubCallout(node) local calloutAppearance = node.appearance local hasIcon = node.icon - if calloutAppearance == constants.kCalloutAppearanceDefault and pandoc.utils.stringify(title) == nil then + if calloutAppearance == constants.kCalloutAppearanceDefault and pandoc.utils.stringify(title) == "" then title = displayName(type) end @@ -350,7 +350,7 @@ function epubCallout(node) local imgDiv = pandoc.Div({imgPlaceholder}, pandoc.Attr("", {"callout-icon-container"})); -- title - if title ~= nil then + if title ~= nil and (pandoc.utils.type(title) == "string" or next(title) ~= nil) then local callout_title = pandoc.Div({}, pandoc.Attr("", {"callout-title"})) if hasIcon then callout_title.content:insert(imgDiv) @@ -376,7 +376,7 @@ function epubCallout(node) if hasIcon == false then attributes:insert("no-icon") end - if title ~= nil then + if title ~= nil and (pandoc.utils.type(title) == "string" or next(title) ~= nil) then attributes:insert("callout-titled") end attributes:insert("callout-style-" .. calloutAppearance) @@ -574,3 +574,24 @@ end, calloutDiv) _quarto.ast.add_renderer("Callout", function(_) return _quarto.format.isEpubOutput() or _quarto.format.isRevealJsOutput() end, epubCallout) + +_quarto.ast.add_renderer("Callout", function(_) + return _quarto.format.isGithubMarkdownOutput() +end, function(callout) + local result = pandoc.Blocks({}) + local header = "[!" .. callout.type:upper() .. "]" + result:insert(pandoc.RawBlock("markdown", header)) + local tt = pandoc.utils.type(callout.title) + if tt ~= "nil" then + result:insert(pandoc.Header(3, quarto.utils.as_inlines(callout.title))) + end + local ct = pandoc.utils.type(callout.content) + if ct == "Block" then + result:insert(callout.content) + elseif ct == "Blocks" then + result:extend(callout.content) + else + internal_error() + end + return pandoc.BlockQuote(result) +end) \ No newline at end of file diff --git a/src/resources/filters/customnodes/content-hidden.lua b/src/resources/filters/customnodes/content-hidden.lua index c0e7bf721ea..a94ba91153e 100644 --- a/src/resources/filters/customnodes/content-hidden.lua +++ b/src/resources/filters/customnodes/content-hidden.lua @@ -18,8 +18,10 @@ function is_visible(node) elseif node.behavior == constants.kContentHidden then return not match else + -- luacov: disable fatal("Internal Error: invalid behavior for conditional block: " .. node.behavior) return false + -- luacov: enable end end @@ -73,7 +75,9 @@ _quarto.ast.add_handler({ }; for i, v in ipairs(tbl.condition or {}) do if kConditions:find(v[1]) == nil then + -- luacov: disable error("Ignoring invalid condition in conditional block: " .. v[1]) + -- luacov: enable else result.condition[v[1]] = v[2] end @@ -93,12 +97,14 @@ _quarto.ast.add_handler({ local _content_hidden_meta = nil -function content_hidden_meta() - return { - Meta = function(meta) - _content_hidden_meta = meta - end - } +-- we capture a copy of meta here for convenience; +-- +function content_hidden_meta(meta) + -- return { + -- Meta = function(meta) + _content_hidden_meta = meta + -- end + -- } end local function get_meta(key) diff --git a/src/resources/filters/customnodes/decoratedcodeblock.lua b/src/resources/filters/customnodes/decoratedcodeblock.lua index 0b4cfb9f2e3..cc0262197fe 100644 --- a/src/resources/filters/customnodes/decoratedcodeblock.lua +++ b/src/resources/filters/customnodes/decoratedcodeblock.lua @@ -19,21 +19,12 @@ _quarto.ast.add_handler({ -- and returns the custom node parse = function(div) -- luacov: disable - fatal("internal error, DecoratedCodeBlock has no native parser") + internal_error() -- luacov: enable end, constructor = function(tbl) - local caption = tbl.caption - if tbl.code_block.attributes["lst-cap"] ~= nil then - caption = pandoc.read(tbl.code_block.attributes["lst-cap"], "markdown").blocks[1].content - end - return { - filename = tbl.filename, - order = tbl.order, - caption = caption, - code_block = tbl.code_block - } + return tbl end }) @@ -72,7 +63,7 @@ _quarto.ast.add_renderer("DecoratedCodeBlock", end end) --- latex renderer + -- latex renderer _quarto.ast.add_renderer("DecoratedCodeBlock", function(_) return _quarto.format.isLatexOutput() @@ -84,7 +75,7 @@ _quarto.ast.add_renderer("DecoratedCodeBlock", -- if we are use the listings package we don't need to do anything -- further, otherwise generate the listing div and return it - if not latexListings() then + if not param("listings", false) then local listingDiv = pandoc.Div({}) local position = "" if _quarto.format.isBeamerOutput() then @@ -146,20 +137,6 @@ _quarto.ast.add_renderer("DecoratedCodeBlock", classes:insert("code-with-filename") fancy_output = true end - if node.caption ~= nil then - local order = node.order - if order == nil then - warn("Node with caption " .. pandoc.utils.stringify(node.caption) .. " is missing a listing id (lst-*).") - warn("This usage is unsupported in HTML formats.") - return el - end - local captionContent = node.caption - tprepend(captionContent, listingTitlePrefix(order)) - caption = pandoc.Para(captionContent) - classes:insert("listing") - fancy_output = true - end - if not fancy_output then return el end diff --git a/src/resources/filters/customnodes/floatreftarget.lua b/src/resources/filters/customnodes/floatreftarget.lua new file mode 100644 index 00000000000..c46d2b2e9dd --- /dev/null +++ b/src/resources/filters/customnodes/floatreftarget.lua @@ -0,0 +1,659 @@ +-- floatreftarget.lua +-- Copyright (C) 2023 Posit Software, PBC + +_quarto.ast.add_handler({ + + -- empty table so this handler is only called programmatically + class_name = {}, + + -- the name of the ast node, used as a key in extended ast filter tables + ast_name = "FloatRefTarget", + + -- generic names this custom AST node responds to + -- this is still unimplemented + interfaces = {"Crossref"}, + + -- float reftargets are always blocks + kind = "Block", + + parse = function(div) + -- luacov: disable + internal_error() + -- luacov: enable + end, + + slots = { "content", "caption_long", "caption_short" }, + + constructor = function(tbl) + if tbl.attr then + tbl.identifier = tbl.attr.identifier + tbl.classes = tbl.attr.classes + tbl.attributes = as_plain_table(tbl.attr.attributes) + tbl.attr = nil + end + + tbl.attributes = pandoc.List(tbl.attributes) + tbl.classes = pandoc.List(tbl.classes) + + table_colwidth_cell(tbl) -- table colwidth forwarding + return tbl + end +}) + +function cap_location(float) + local ref = refType(float.identifier) + local qualified_key = ref .. '-cap-location' + local result = ( + float.attributes[qualified_key] or + float.attributes['cap-location'] or + option_as_string(qualified_key) or + option_as_string('cap-location') or + capLocation(ref) or + crossref.categories.by_ref_type[ref].default_caption_location) + + if result ~= "margin" and result ~= "top" and result ~= "bottom" then + -- luacov: disable + error("Invalid caption location for float: " .. float.identifier .. + " requested " .. result .. + ".\nOnly 'top', 'bottom', and 'margin' are supported. Assuming 'bottom'.") + result = "bottom" + -- luacov: enable + end + + return result +end + +local function get_node_from_float_and_type(float, type) + -- this explicit check appears necessary for the case where + -- float.content is directly the node we want, and not a container that + -- contains the node. + if float.content.t == type then + return float.content + else + local found_node = nil + float.content:walk({ + traverse = "topdown", + [type] = function(node) + found_node = node + return nil, false -- don't recurse + end + }) + return found_node + end +end + +-- default renderer first +_quarto.ast.add_renderer("FloatRefTarget", function(_) + return true +end, function(float) + warn("\nEmitting a placeholder FloatRefTarget\nOutput format " .. FORMAT .. " does not currently support FloatRefTarget nodes.") + return scaffold(float.content) +end) + +local function ensure_custom(node) + if pandoc.utils.type(node) == "Block" or pandoc.utils.type(node) == "Inline" then + return _quarto.ast.resolve_custom_data(node) + end + return node +end + +function is_unlabeled_float(float) + -- from src/resources/filters/common/refs.lua + return float.identifier:match("^%a+%-539a35d47e664c97a50115a146a7f1bd%-") +end + +function decorate_caption_with_crossref(float) + if not param("enable-crossref", true) then + -- don't decorate captions with crossrefs information if crossrefs are disabled + return float + end + float = ensure_custom(float) + -- nil should never happen here, but the Lua analyzer doesn't know it + if float == nil then + -- luacov: disable + internal_error() + -- luacov: enable + end + local caption_content = float.caption_long.content or float.caption_long + + if float.parent_id then + if float.order == nil then + warn("Subfloat without crossref information") + else + prependSubrefNumber(caption_content, float.order) + end + else + -- in HTML, unlabeled floats do not get a title prefix + if (not is_unlabeled_float(float)) and (caption_content ~= nil) and (#caption_content > 0) then + local title_prefix = float_title_prefix(float) + tprepend(caption_content, title_prefix) + end + end + return float +end + +function full_caption_prefix(float, subfloat) + if not param("enable-crossref", true) then + -- don't decorate captions with crossrefs information if crossrefs are disabled + return {} + end + + float = ensure_custom(float) + -- nil should never happen here, but the Lua analyzer doesn't know it + if float == nil then + -- luacov: disable + internal_error() + -- luacov: enable + end + + if subfloat ~= nil then + subfloat = ensure_custom(subfloat) + -- nil should never happen here, but the Lua analyzer doesn't know it + if subfloat == nil then + -- luacov: disable + internal_error() + -- luacov: enable + end + end + + local float_title = {} + if not is_unlabeled_float(float) then + float_title = float_title_prefix(float, false) + end + + local subfloat_title = pandoc.Inlines({}) + if subfloat ~= nil then + if subfloat.order == nil then + warn("Subfloat without crossref information") + else + prependSubrefNumber(subfloat_title, subfloat.order) + end + end + if #subfloat_title > 0 then + tappend(float_title,{nbspString()}) + end + tappend(float_title, subfloat_title) + tappend(float_title, titleDelim()) + tappend(float_title, {pandoc.Space()}) + return pandoc.Inlines(float_title) +end + +-- capture relevant figure attributes then strip them +local function get_figure_attributes(el) + local align = figAlignAttribute(el) + local keys = tkeys(el.attr.attributes) + for _,k in pairs(keys) do + if isFigAttribute(k) then + el.attr.attributes[k] = nil + end + end + local figureAttr = {} + local style = el.attr.attributes["style"] + if style then + figureAttr["style"] = style + el.attributes["style"] = nil + end + return { + align = align, + figureAttr = figureAttr + } +end + +_quarto.ast.add_renderer("FloatRefTarget", function(_) + return _quarto.format.isLatexOutput() +end, function(float) + local figEnv = latexFigureEnv(float) + local figPos = latexFigurePosition(float, figEnv) + local float_type = refType(float.identifier) + local crossref_category = crossref.categories.by_ref_type[float_type] or crossref.categories.by_name.Figure + + local capLoc = capLocation(float_type, crossref_category.default_caption_location) + local caption_cmd_name = latexCaptionEnv(float) + + if float.parent_id then + if caption_cmd_name == kSideCaptionEnv then + fail_and_ask_for_bugreport("Subcaptions for side captions are unimplemented.") + return {} + end + caption_cmd_name = "subcaption" + elseif float.content.t == "Table" and float_type == "tbl" then -- float.parent_id is nil here + -- special-case the situation where the figure is Table and the content is Table + -- + -- just return the table itself with the caption inside the table + + -- FIXME how about tables in margin figures? + + caption_cmd_name = "caption" + float.content.caption.long = float.caption_long + float.content.attr = pandoc.Attr(float.identifier, float.classes or {}, float.attributes or {}) + return float.content + end + + local fig_scap = attribute(float, kFigScap, nil) + if fig_scap then + fig_scap = pandoc.Span(markdownToInlines(fig_scap)) + end + + local latex_caption + + if float.caption_long and #float.caption_long.content > 0 then + local label_cmd = quarto.LatexInlineCommand({ + name = "label", + arg = pandoc.Str(float.identifier) + }) + float.caption_long.content:insert(1, label_cmd) + latex_caption = quarto.LatexInlineCommand({ + name = caption_cmd_name, + opt_arg = fig_scap, + arg = pandoc.Span(quarto.utils.as_inlines(float.caption_long) or {}) -- unnecessary to do the "or {}" bit but the Lua analyzer doesn't know that + }) + end + + if float.parent_id then + -- need to fixup subtables because nested longtables appear to give latex fits + local vAlign = validatedVAlign(float.attributes[kLayoutVAlign]) + local function handle_table(tbl) + return latexTabular(tbl, vAlign) + end + if float.content.t == "Table" then + float.content = handle_table(float.content) + else + float.content = _quarto.ast.walk(float.content, { + Table = handle_table + }) or pandoc.Div({}) -- unnecessary to do the "or {}" bit but the Lua analyzer doesn't know that + end + end + + local figure_content + local pt = pandoc.utils.type(float.content) + if pt == "Block" then + figure_content = pandoc.Blocks({ float.content }) + elseif pt == "Blocks" then + figure_content = float.content + else + -- luacov: disable + fail_and_ask_for_bug_report("Unexpected type for float content: " .. pt) + return {} + -- luacov: enable + end + + -- align the figure + local align = figAlignAttribute(float) + if align == "center" then + figure_content = pandoc.Blocks({ + quarto.LatexBlockCommand({ + name = "centering", + inside = true, + arg = scaffold(figure_content) + }) + }) + elseif align == "right" then + figure_content:insert(1, quarto.LatexInlineCommand({ + name = "hfill", + })) + end -- otherwise, do nothing + -- figure_content:insert(1, pandoc.RawInline("latex", latexBeginAlign(align))) + -- figure_content:insert(pandoc.RawInline("latex", latexEndAlign(align))) + + if latex_caption then + if caption_cmd_name == kSideCaptionEnv then + if #figure_content > 1 then + figure_content:insert(2, latex_caption) -- FIXME why is this 2 and not 1? + else + figure_content:insert(latex_caption) + end + elseif capLoc == "top" then + figure_content:insert(1, latex_caption) + else + figure_content:insert(latex_caption) + end + end + + if float.parent_id then + -- the environment here is handled by the parent float and + -- the panel layout code + return figure_content + else + return quarto.LatexEnvironment({ + name = figEnv, + pos = figPos, + content = figure_content + }) + end +end) + +_quarto.ast.add_renderer("FloatRefTarget", function(_) + return _quarto.format.isHtmlOutput() +end, function(float) + decorate_caption_with_crossref(float) + + ------------------------------------------------------------------------------------ + -- Special handling for listings + local found_listing = get_node_from_float_and_type(float, "CodeBlock") + if found_listing then + found_listing.attr = merge_attrs(found_listing.attr, pandoc.Attr("", float.classes or {}, float.attributes or {})) + -- FIXME this seems to be necessary for our postprocessor to kick in + -- check this out later + found_listing.identifier = float.identifier + end + + ------------------------------------------------------------------------------------ + + return float_reftarget_render_html_figure(float) +end) + +_quarto.ast.add_renderer("FloatRefTarget", function(_) + return _quarto.format.isDocxOutput() or _quarto.format.isOdtOutput() +end, function(float) + -- docx format requires us to annotate the caption prefix explicitly + decorate_caption_with_crossref(float) + + -- options + local options = { + pageWidth = wpPageWidth(), + } + + -- determine divCaption handler (always left-align) + local divCaption = nil + if _quarto.format.isDocxOutput() then + divCaption = docxDivCaption + elseif _quarto.format.isOdtOutput() then + divCaption = odtDivCaption + else + -- luacov: disable + internal_error() + return + -- luacov: enable + end + + options.divCaption = function(el, align) return divCaption(el, "left") end + + -- get alignment + local align = align_attribute(float) + + -- create the row/cell for the figure + local row = pandoc.List() + local cell = pandoc.Div({}) + cell.attr = pandoc.Attr(float.identifier, float.classes or {}, float.attributes or {}) + local c = float.content.content or float.content + if pandoc.utils.type(c) == "Block" then + cell.content:insert(c) + elseif pandoc.utils.type(c) == "Blocks" then + cell.content = c + elseif pandoc.utils.type(c) == "Inlines" then + cell.content:insert(pandoc.Plain(c)) + end + transfer_float_image_width_to_cell(float, cell) + row:insert(cell) + + -- handle caption + local new_caption = options.divCaption(float.caption_long, align) + local caption_location = cap_location(float) + if caption_location == 'top' then + cell.content:insert(1, new_caption) + else + cell.content:insert(new_caption) + end + + -- content fixups for docx, based on old docx.lua code + cell = docx_content_fixups(cell, align) + + -- make the table + local figureTable = pandoc.SimpleTable( + pandoc.List(), -- caption + { layoutTableAlign(align) }, + { 1 }, -- full width + pandoc.List(), -- no headers + { row } -- figure + ) + + -- return it + return pandoc.utils.from_simple_table(figureTable) +end) + +local figcaption_uuid = "0ceaefa1-69ba-4598-a22c-09a6ac19f8ca" + +local function create_figcaption(float) + if float.caption_long == nil or pandoc.utils.stringify(float.caption_long) == "" then + return nil + end + local ref_type = refType(float.identifier) + -- use a uuid to ensure that the figcaption ids won't conflict with real + -- ids in the document + local caption_id = float.identifier .. "-caption-" .. figcaption_uuid + local classes = { float.type:lower() } + if float.parent_id then + table.insert(classes, "quarto-subfloat-caption") + table.insert(classes, "quarto-subfloat-" .. ref_type) + else + table.insert(classes, "quarto-float-caption") + table.insert(classes, "quarto-float-" .. ref_type) + end + return quarto.HtmlTag({ + name = "figcaption", + attr = pandoc.Attr(caption_id, classes, {}), + content = float.caption_long, + }), caption_id +end + +function float_reftarget_render_html_figure(float) + float = ensure_custom(float) + if float == nil then + -- luacov: disable + internal_error() + return pandoc.Div({}) + -- luacov: enable + end + + local caption_content, caption_id = create_figcaption(float) + local caption_location = cap_location(float) + + local float_content = pandoc.Div(_quarto.ast.walk(float.content, { + -- strip image captions + Image = function(image) + image.caption = {} + return image + end + }) or pandoc.Div({})) -- this should never happen but the lua analyzer doesn't know it + if caption_id ~= nil then + float_content.attributes["aria-describedby"] = caption_id + end + + -- otherwise, we render the float as a div with the caption + local div = pandoc.Div({}) + + local found_image = get_node_from_float_and_type(float, "Image") or pandoc.Div({}) + local figure_attrs = get_figure_attributes(found_image) + + div.attr = merge_attrs( + pandoc.Attr(float.identifier, float.classes or {}, float.attributes or {}), + pandoc.Attr("", {}, figure_attrs.figureAttr)) + if float.type == "Listing" then + div.attr.classes:insert("listing") + elseif float.type == "Figure" then + -- apply standalone figure css + div.attr.classes:insert("quarto-figure") + div.attr.classes:insert("quarto-figure-" .. figure_attrs.align) + end + + -- also forward any column or caption classes + local currentClasses = found_image.attr.classes + for _,k in pairs(currentClasses) do + if isCaptionClass(k) or isColumnClass(k) then + div.attr.classes:insert(k) + end + end + + local ref = refType(float.identifier) + local figure_class + if float.parent_id then + figure_class = "quarto-subfloat-" .. ref + else + figure_class = "quarto-float-" .. ref + end + + -- Notice that we need to insert the figure_div value + -- into the div, but we need to use figure_tbl + -- to manipulate the contents of the custom node. + -- + -- This is because the figure_div is a pandoc.Div (required to + -- be inserted into pandoc divs), but figure_tbl is + -- the lua table with the metatable required to marshal + -- the inner contents of the custom node. + -- + -- This is relatively ugly, and another instance + -- of the impedance mismatch we have in the custom AST + -- API. + -- + -- it's possible that the better API is for custom constructors + -- to always return a Lua object and then have a separate + -- function to convert that to a pandoc AST node. + local figure_div, figure_tbl = quarto.HtmlTag({ + name = "figure", + attr = pandoc.Attr("", {"quarto-float", figure_class}, {}), + }) + + figure_tbl.content.content:insert(float_content) + if caption_content ~= nil then + if caption_location == 'top' then + figure_tbl.content.content:insert(1, caption_content) + else + figure_tbl.content.content:insert(caption_content) + end + end + div.content:insert(figure_div) + return div +end + +_quarto.ast.add_renderer("FloatRefTarget", function(_) + return _quarto.format.isAsciiDocOutput() +end, function(float) + if float.content.t == "Plain" and #float.content.content == 1 and float.content.content[1].t == "Image" then + return pandoc.Figure( + {float.content}, + {float.caption_long}, + float.identifier) + end + + float.caption_long.content:insert(1, pandoc.RawInline("asciidoc", ". ")) + float.caption_long.content:insert(pandoc.RawInline("asciidoc", "\n[[" .. float.identifier .. "]]\n====")) + return pandoc.Div({ + float.caption_long, + -- pandoc.RawBlock("asciidoc", "[[" .. float.identifier .. "]]\n====\n"), + float.content, + pandoc.RawBlock("asciidoc", "====\n\n") + }) + +end) + +_quarto.ast.add_renderer("FloatRefTarget", function(_) + return _quarto.format.isJatsOutput() +end, function(float) + -- don't emit unlabeled floats in JATS + if is_unlabeled_float(float) then + float.identifier = "" + end + decorate_caption_with_crossref(float) + return pandoc.Figure( + {float.content}, + {float.caption_long}, + float.identifier + ) +end) + +_quarto.ast.add_renderer("FloatRefTarget", function(_) + return _quarto.format.isIpynbOutput() and param("enable-crossref", true) +end, function(float) + decorate_caption_with_crossref(float) + if float.content.t == "Plain" and #float.content.content == 1 and float.content.content[1].t == "Image" then + return pandoc.Figure( + {float.content}, + {float.caption_long}, + float.identifier) + end + + return pandoc.Div({ + float.content, + pandoc.Para(quarto.utils.as_inlines(float.caption_long) or {}), + }); +end) + +-- this should really be "_quarto.format.isEmbedIpynb()" or something like that.. +_quarto.ast.add_renderer("FloatRefTarget", function(_) + return _quarto.format.isIpynbOutput() and not param("enable-crossref", true) +end, function(float) + if float.content.t == "Plain" and #float.content.content == 1 and float.content.content[1].t == "Image" then + -- replicate pre-reftarget behavior because it'll be used in embedding + -- and needs precisely the same AST output + float.content.content[1].caption = quarto.utils.as_inlines(float.caption_long) + return pandoc.Div({ + pandoc.Para({ + float.content.content[1] + }) + }) + elseif (float.content.t == "Plain" and #float.content.content == 2 + and float.content.content[1].t == "Image" + and float.content.content[2].t == "RawInline" + and float.content.content[2].format == "markdown") then + -- we assume this is the ipynb-specific which we need to manage here. + + -- replicate pre-reftarget behavior because it'll be used in embedding + -- and needs precisely the same AST output + float.content.content[1].caption = quarto.utils.as_inlines(float.caption_long) + return pandoc.Div({ + pandoc.Para({ + float.content.content[1], + float.content.content[2] + }) + }) + else + -- we're not sure how to handle this directly, so we'll just embed the caption + -- as a paragraph after the content + local result = pandoc.Div({}) + result.content:insert(float.content) + if float.caption_long then + result.content:insert(pandoc.Para(quarto.utils.as_inlines(float.caption_long) or {})) + end + return result + end +end) + +_quarto.ast.add_renderer("FloatRefTarget", function(_) + return _quarto.format.isTypstOutput() +end, function(float) + local ref = refType(float.identifier) + local info = crossref.categories.by_ref_type[ref] + if info == nil then + -- luacov: disable + warning("Unknown float type: " .. ref .. "\n Will emit without crossref information.") + return float.content + -- luacov: enable + end + local kind + local supplement = "" + local numbering = "" + + if float.parent_id then + kind = "quarto-subfloat-" .. ref + numbering = "(a)" + else + kind = "quarto-float-" .. ref + numbering = "1" + supplement = info.name + end + + local caption_location = cap_location(float) + + -- FIXME: Listings shouldn't emit centered blocks. I don't know how to disable that right now. + -- FIXME: custom numbering doesn't work yet + + return make_typst_figure { + content = float.content, + caption_location = caption_location, + caption = float.caption_long, + kind = kind, + supplement = supplement, + numbering = numbering, + identifier = float.identifier + } +end) \ No newline at end of file diff --git a/src/resources/filters/customnodes/htmltag.lua b/src/resources/filters/customnodes/htmltag.lua new file mode 100644 index 00000000000..f9cd8098959 --- /dev/null +++ b/src/resources/filters/customnodes/htmltag.lua @@ -0,0 +1,60 @@ +-- htmltag.lua +-- Copyright (C) 2023 Posit Software, PBC + +_quarto.ast.add_handler({ + + -- empty table so this handler is only called programmatically + class_name = {}, + + -- the name of the ast node, used as a key in extended ast filter tables + ast_name = "HtmlTag", + + -- float crossrefs are always blocks + kind = "Block", + + parse = function(div) + -- luacov: disable + internal_error() + -- luacov: enable + end, + + slots = { "content" }, + + constructor = function(tbl) + if tbl.attr then + tbl.identifier = tbl.attr.identifier + tbl.classes = tbl.attr.classes + tbl.attributes = as_plain_table(tbl.attr.attributes) + tbl.attr = nil + end + tbl.classes = tbl.classes or {} + tbl.attributes = tbl.attributes or {} + tbl.identifier = tbl.identifier or "" + tbl.content = pandoc.Div(tbl.content or {}) + return tbl + end +}) + +_quarto.ast.add_renderer("HtmlTag", function(_) return true end, +function(tag) + local div = pandoc.Blocks({}) + local result = div + local result_attrs = { + class = table.concat(tag.classes, " "), + } + if tag.identifier ~= nil and tag.identifier ~= "" then + result_attrs.id = tag.identifier + end + for k, v in pairs(tag.attributes) do + result_attrs[k] = v + end + local attr_string = {} + for k, v in spairs(result_attrs) do + table.insert(attr_string, k .. "=\"" .. html_escape(v, true) .. "\"") + end + result:insert(pandoc.RawBlock("html", "<" .. tag.name .. " " .. table.concat(attr_string, " ") .. ">")) + result:extend(tag.content.content) + result:insert(pandoc.RawBlock("html", "")) + + return div +end) \ No newline at end of file diff --git a/src/resources/filters/customnodes/latexcmd.lua b/src/resources/filters/customnodes/latexcmd.lua new file mode 100644 index 00000000000..c33db8c3985 --- /dev/null +++ b/src/resources/filters/customnodes/latexcmd.lua @@ -0,0 +1,92 @@ +-- latexcmd.lua +-- Copyright (C) 2023 Posit Software, PBC + +_quarto.ast.add_handler({ + class_name = {}, + ast_name = "LatexInlineCommand", + kind = "Inline", + -- luacov: disable + parse = function() internal_error() end, + -- luacov: enable + slots = { "arg", "opt_arg" }, + constructor = function(tbl) return tbl end +}) + +_quarto.ast.add_handler({ + class_name = {}, + ast_name = "LatexBlockCommand", + kind = "Block", + -- luacov: disable + parse = function() internal_error() end, + -- luacov: enable + slots = { "arg", "opt_arg" }, + constructor = function(tbl) return tbl end +}) + +_quarto.ast.add_renderer("LatexInlineCommand", function(_) return true end, +function(cmd) + local result = pandoc.Inlines({}) + result:insert(pandoc.RawInline("latex", "\\" .. cmd.name)) + local opt_arg = cmd.opt_arg + if opt_arg then + result:insert(pandoc.RawInline("latex", "[")) + if opt_arg.content then + result:extend(opt_arg.content) + else + result:insert(opt_arg) + end + result:insert(pandoc.RawInline("latex", "]")) + end + local arg = cmd.arg + if arg then + result:insert(pandoc.RawInline("latex", "{")) + if arg.content then + result:extend(arg.content) + else + result:insert(arg) + end + result:insert(pandoc.RawInline("latex", "}")) + end + return result +end) + +_quarto.ast.add_renderer("LatexBlockCommand", function(_) return true end, +function(cmd) + local result = pandoc.Blocks({}) + local preamble = pandoc.Inlines({}) + local postamble = pandoc.Inlines({}) + preamble:insert(pandoc.RawInline("latex", "\\" .. cmd.name)) + local opt_arg = cmd.opt_arg + if opt_arg then + preamble:insert(pandoc.RawInline("latex", "[")) + if opt_arg.content then + preamble:extend(opt_arg.content) + else + preamble:insert(opt_arg) + end + preamble:insert(pandoc.RawInline("latex", "]")) + end + preamble:insert(pandoc.RawInline("latex", "{")) + result:insert(pandoc.Plain(preamble)) + local arg = cmd.arg + if arg then + local pt = pandoc.utils.type(arg) + if pt == "Blocks" then + result:extend(arg) + elseif pt == "Block" then + if arg.content then + result:extend(arg.content) + else + result:insert(arg) + end + else + -- luacov: disable + fail_and_ask_for_bug_report("Unexpected type for LatexBlockCommand arg: " .. pt) + return nil + -- luacov: enable + end + end + postamble:insert(pandoc.RawInline("latex", "}")) + result:insert(pandoc.Plain(postamble)) + return result +end) \ No newline at end of file diff --git a/src/resources/filters/customnodes/latexenv.lua b/src/resources/filters/customnodes/latexenv.lua new file mode 100644 index 00000000000..d7f80e635af --- /dev/null +++ b/src/resources/filters/customnodes/latexenv.lua @@ -0,0 +1,35 @@ +-- latexenv.lua +-- Copyright (C) 2023 Posit Software, PBC + +_quarto.ast.add_handler({ + + -- empty table so this handler is only called programmatically + class_name = {}, + + -- the name of the ast node, used as a key in extended ast filter tables + ast_name = "LatexEnvironment", + + kind = "Block", + + parse = function(div) + -- luacov: disable + internal_error() + -- luacov: enable + end, + + slots = { "content" }, + + constructor = function(tbl) + tbl.content = pandoc.Div(tbl.content or {}) + return tbl + end +}) + +_quarto.ast.add_renderer("LatexEnvironment", function(_) return true end, +function(env) + local result = pandoc.Blocks({}) + result:insert(latexBeginEnv(env.name, env.pos)) + result:extend(env.content.content or env.content) + result:insert(pandoc.RawBlock("latex-merge", "\\end{" .. env.name .. "}%")) + return result +end) \ No newline at end of file diff --git a/src/resources/filters/customnodes/shortcodes.lua b/src/resources/filters/customnodes/shortcodes.lua index 026216282ca..235e741fc16 100644 --- a/src/resources/filters/customnodes/shortcodes.lua +++ b/src/resources/filters/customnodes/shortcodes.lua @@ -18,8 +18,10 @@ _quarto.ast.add_handler({ end) local shortcode_content = span.content:map(function(el) if not el.classes:includes("quarto-shortcode__-param") then + -- luacov: disable quarto.log.output(el) fatal("Unexpected span in a shortcode parse") + -- luacov: enable end -- is it a recursive shortcode? @@ -64,8 +66,10 @@ _quarto.ast.add_handler({ } end else + -- luacov: disable quarto.log.output(el) fatal("Unexpected span in a shortcode parse") + -- luacov: enable end end) local name = shortcode_content:remove(1) @@ -87,7 +91,9 @@ _quarto.ast.add_handler({ end, render = function(node) - fatal("Should not need to render a shortcode.") + -- luacov: disable + internal_error() + -- luacov: enable end, constructor = function(tbl) @@ -109,8 +115,10 @@ local function handle_shortcode(shortcode_tbl, node) -- we need to handle this explicitly if type(shortcode_tbl.name) ~= "number" then + -- luacov: disable quarto.log.output(shortcode_tbl.name) fatal("Unexpected shortcode name type " .. type(shortcode_tbl.name)) + -- luacov: enable end local shortcode_node = node.content[shortcode_tbl.name] @@ -119,8 +127,10 @@ local function handle_shortcode(shortcode_tbl, node) local custom_data, t, kind = _quarto.ast.resolve_custom_data(v) if custom_data ~= nil then if t ~= "Shortcode" then + -- luacov: disable quarto.log.output(t) fatal("Unexpected shortcode content type " .. tostring(t)) + -- luacov: enable end -- we are not resolved, so resolve shortcode_node.content[i] = handle_shortcode(custom_data, v) @@ -151,9 +161,11 @@ local function handle_shortcode(shortcode_tbl, node) if custom_data == nil then result = pandoc.utils.stringify(shortcode_node) elseif t ~= "Shortcode" then + -- luacov: disable quarto.log.output(custom_data) quarto.log.output(t) fatal("Unexpected shortcode content type " .. tostring(t)) + -- luacov: enable else local result = handle_shortcode(custom_data, shortcode_node) result = pandoc.utils.stringify(result) @@ -164,8 +176,10 @@ local function handle_shortcode(shortcode_tbl, node) table.insert(args, { value = v.value }) table.insert(raw_args, v.value) else + -- luacov: disable quarto.log.output(v) fatal("Unexpected shortcode param type " .. tostring(v.type)) + -- luacov: enable end end @@ -342,9 +356,11 @@ function shortcodeResultAsInlines(result, name) elseif isBlockEl(result) then return pandoc.utils.blocks_to_inlines( { result }, { pandoc.Space() }) else + -- luacov: disable error("Unexpected result from shortcode " .. name .. "") quarto.log.output(result) fatal("This is a bug in the shortcode. If this is a quarto shortcode, please report it at https://github.com/quarto-dev/quarto-cli") + -- luacov: enable end end @@ -374,8 +390,10 @@ function shortcodeResultAsBlocks(result, name) elseif isInlineEl(result) then return pandoc.Blocks( {pandoc.Para( {result} ) }) -- why not a plain? else + -- luacov: disable error("Unexpected result from shortcode " .. name .. "") quarto.log.output(result) fatal("This is a bug in the shortcode. If this is a quarto shortcode, please report it at https://github.com/quarto-dev/quarto-cli") + -- luacov: enable end end diff --git a/src/resources/filters/layout/asciidoc.lua b/src/resources/filters/layout/asciidoc.lua index 6e6c0df2f22..16acd30fdee 100644 --- a/src/resources/filters/layout/asciidoc.lua +++ b/src/resources/filters/layout/asciidoc.lua @@ -31,7 +31,7 @@ function asciidocFigure(image) -- the figure itself figure:extend({"image::" .. image.src .. "[\"" .. altText .. "\"]"}) - return pandoc.RawBlock("asciidoc", table.concat(figure, "")) + return pandoc.RawBlock("asciidoc", table.concat(figure, "") .. "\n\n") end function asciidocDivFigure(el) @@ -56,3 +56,75 @@ function asciidocDivFigure(el) tappend(figure, contents) return figure end + +_quarto.ast.add_renderer("PanelLayout", function(layout) + return _quarto.format.isAsciiDocOutput() +end, function(layout) + + if layout.float == nil then + fail_and_ask_for_bug_report("asciidoc format doesn't currently support layouts without floats.") + return pandoc.Div({}) + end + + -- empty options by default + if not options then + options = {} + end + -- outer panel to contain css and figure panel + local attr = pandoc.Attr(layout.identifier or "", layout.classes or {}, layout.attributes or {}) + local panel_content = pandoc.Blocks({}) + -- layout + for i, row in ipairs(layout.layout) do + + local aligns = row:map(function(cell) + -- get the align + local align = cell.attributes[kLayoutAlign] + return layoutTableAlign(align) + end) + local widths = row:map(function(cell) + -- propagage percents if they are provided + local layoutPercent = horizontalLayoutPercent(cell) + if layoutPercent then + return layoutPercent / 100 + else + return 0 + end + end) + + local cells = pandoc.List() + for _, cell in ipairs(row) do + cells:insert(cell) + end + + -- make the table + local panelTable = pandoc.SimpleTable( + pandoc.List(), -- caption + aligns, + widths, + pandoc.List(), -- headers + { cells } + ) + + -- add it to the panel + panel_content:insert(pandoc.utils.from_simple_table(panelTable)) + end + + -- this is exceedingly hacky, but it works. + local caption_str = pandoc.write(pandoc.Pandoc({layout.float.caption_long}), "asciidoc") + + -- we need to recurse into render_extended_nodes here, sigh + local content_str = pandoc.write(_quarto.ast.walk(pandoc.Pandoc(panel_content), render_extended_nodes()) or {}, "asciidoc") + local figure_str = ". " .. caption_str .. "[#" .. layout.identifier .. "]\n" .. content_str + + local pt = pandoc.utils.type(layout.preamble) + if pt == "Blocks" then + layout.preamble:insert(pandoc.RawBlock("asciidoc", figure_str)) + return layout.preamble + elseif pt == "Block" then + return pandoc.Blocks({ layout.preamble, pandoc.RawBlock("asciidoc", figure_str) }) + elseif pt == "nil" then + return pandoc.RawBlock("asciidoc", figure_str) + else + internal_error() + end +end) \ No newline at end of file diff --git a/src/resources/filters/layout/cites.lua b/src/resources/filters/layout/cites.lua index ed51d749533..8f919053266 100644 --- a/src/resources/filters/layout/cites.lua +++ b/src/resources/filters/layout/cites.lua @@ -3,8 +3,7 @@ function cites_preprocess() - -- FIXME do we need parentheses here? - if not _quarto.format.isLatexOutput() and marginCitations() then + if (not _quarto.format.isLatexOutput()) and marginCitations() then return { } end @@ -20,56 +19,62 @@ function cites_preprocess() end end, - Para = function(para) - local figure = discoverFigure(para, true) - if figure and _quarto.format.isLatexOutput() and hasFigureRef(figure) then - if hasMarginColumn(figure) or hasMarginCaption(figure) then - -- This is a figure in the margin itself, we need to append citations at the end of the caption - -- without any floating - para.content[1] = _quarto.ast.walk(figure, { - Inlines = walkUnresolvedCitations(function(citation, appendInline, appendAtEnd) - appendAtEnd(citePlaceholderInlineWithProtection(citation)) - end) - }) - return para - elseif marginCitations() then - -- This is a figure is in the body, but the citation should be in the margin. Use - -- protection to shift any citations over - para.content[1] = _quarto.ast.walk(figure, { - Inlines = walkUnresolvedCitations(function(citation, appendInline, appendAtEnd) - appendInline(marginCitePlaceholderWithProtection(citation)) - end) + FloatRefTarget = function(float) + local inlines_filter + local has_margin_column = hasMarginColumn(float) + + -- general figure caption cites fixups + if (_quarto.format.isLatexOutput() and has_margin_column) or hasMarginCaption(float) then + -- This is a figure in the margin itself, we need to append citations at the end of the caption + -- without any floating + inlines_filter = walkUnresolvedCitations(function(citation, appendInline, appendAtEnd) + appendAtEnd(citePlaceholderInlineWithProtection(citation)) + end) + elseif marginCitations() then + -- This is a figure is in the body, but the citation should be in the margin. Use + -- protection to shift any citations over + inlines_filter = walkUnresolvedCitations(function(citation, appendInline, appendAtEnd) + appendInline(marginCitePlaceholderInlineWithProtection(citation)) + end) + end + if inlines_filter then + float.caption_long = _quarto.ast.walk(float.caption_long, { + Inlines = inlines_filter + }) + end + + -- table caption cites fixups + if (refType(float.identifier) == 'tbl' and _quarto.format.isLatexOutput() and hasMarginColumn(float)) or marginCitations() then + local ref_table + _quarto.ast.walk(float.content, { + Table = function(t) + ref_table = t + end + }) + if ref_table ~= nil then + -- we don't want to update this inside the float.content walk above + -- because the caption_long is part of the content and that + -- will cause weirdness + float.caption_long = _quarto.ast.walk(float.caption_long, { + Inlines = function(inlines) + return resolveCaptionCitations(inlines, has_margin_column) + end }) - return para - end + end end + + return float end, Div = function(div) - if _quarto.format.isLatexOutput() and hasMarginColumn(div) or marginCitations() then - if hasTableRef(div) then - -- inspect the table caption for refs and just mark them as resolved - local table = discoverTable(div) - if table ~= nil and table.caption ~= nil and table.caption.long ~= nil then - local cites = false - -- go through any captions and resolve citations into latex - for i, caption in ipairs(table.caption.long) do - cites = resolveCaptionCitations(caption.content, hasMarginColumn(div)) or cites - end - if cites then - return div + if (_quarto.format.isLatexOutput() and hasMarginColumn(div)) or marginCitations() then + return _quarto.ast.walk(div, { + Inlines = walkUnresolvedCitations(function(citation, appendInline, appendAtEnd) + if hasMarginColumn(div) then + appendAtEnd(citePlaceholderInline(citation)) end - end - else - return _quarto.ast.walk(div, { - Inlines = walkUnresolvedCitations(function(citation, appendInline, appendAtEnd) - if hasMarginColumn(div) then - appendAtEnd(citePlaceholderInline(citation)) - end - end) - }) - end - + end) + }) end end @@ -83,9 +88,11 @@ function cites() return { -- go through inlines and resolve any unresolved citations - Inlines = walkUnresolvedCitations(function(citation, appendInline) - appendInline(marginCitePlaceholderInline(citation)) - end) + Inlines = function(inlines) + return (walkUnresolvedCitations(function(citation, appendInline) + appendInline(marginCitePlaceholderInline(citation)) + end)(inlines)) + end } end diff --git a/src/resources/filters/layout/columns-preprocess.lua b/src/resources/filters/layout/columns-preprocess.lua index dee24b01b8c..98feacfcc23 100644 --- a/src/resources/filters/layout/columns-preprocess.lua +++ b/src/resources/filters/layout/columns-preprocess.lua @@ -3,15 +3,23 @@ function columns_preprocess() return { - Div = function(el) - - if el.attr.classes:includes('cell') then + FloatRefTarget = function(float) + local location = cap_location(float) + if location == 'margin' then + float.classes:insert('margin-caption') + noteHasColumns() + return float + end + end, + + Div = function(el) + if el.classes:includes('cell') then -- for code chunks that aren't layout panels, forward the column classes to the output -- figures or tables (otherwise, the column class should be used to layout the whole panel) resolveColumnClassesForCodeCell(el) else resolveColumnClassesForEl(el) - end + end return el end, @@ -26,9 +34,8 @@ function columns_preprocess() end -- resolves column classes for an element -function resolveColumnClassesForEl(el) - -- ignore sub figures and sub tables - if not hasRefParent(el) then +function resolveColumnClassesForEl(el) + if not hasRefParent(el) then if hasFigureRef(el) then resolveElementForScopedColumns(el, 'fig') elseif hasTableRef(el) then @@ -38,15 +45,26 @@ function resolveColumnClassesForEl(el) end -- forward column classes from code chunks onto their display / outputs -function resolveColumnClassesForCodeCell(el) +function resolveColumnClassesForCodeCell(el) + + local float_classes = {} + local float_caption_classes = {} + local found = false + + for k, v in ipairs(crossref.categories.all) do + local ref_type = v.ref_type + float_classes[ref_type] = computeClassesForScopedColumns(el, ref_type) + float_caption_classes[ref_type] = computeClassesForScopedCaption(el, ref_type) + found = #float_classes[ref_type] > 0 or #float_caption_classes[ref_type] > 0 + end -- read the classes that should be forwarded - local figClasses = computeClassesForScopedColumns(el, 'fig') - local tblClasses = computeClassesForScopedColumns(el, 'tbl') - local figCaptionClasses = computeClassesForScopedCaption(el, 'fig') - local tblCaptionClasses = computeClassesForScopedCaption(el, 'tbl') + local figClasses = float_classes.fig + local tblClasses = float_classes.tbl + local figCaptionClasses = float_caption_classes.fig + local tblCaptionClasses = float_caption_classes.tbl - if #tblClasses > 0 or #figClasses > 0 or #figCaptionClasses > 0 or #tblCaptionClasses > 0 then + if found then noteHasColumns() if hasLayoutAttributes(el) then @@ -56,28 +74,36 @@ function resolveColumnClassesForCodeCell(el) else -- Forward the column classes inside code blocks for i, childEl in ipairs(el.content) do - if childEl.attr ~= nil and childEl.attr.classes:includes('cell-output-display') then - + if childEl.classes ~= nil and childEl.classes:includes('cell-output-display') then -- look through the children for any figures or tables local forwarded = false for j, figOrTableEl in ipairs(childEl.content) do - local figure = discoverFigure(figOrTableEl, false) - if figure ~= nil then - -- forward to figures - applyClasses(figClasses, figCaptionClasses, el, childEl, figure, 'fig') - forwarded = true - elseif figOrTableEl.attr ~= nil and hasFigureRef(figOrTableEl) then - -- forward to figure divs - applyClasses(figClasses, figCaptionClasses, el, childEl, figOrTableEl, 'fig') - forwarded = true - elseif (figOrTableEl.t == 'Div' and hasTableRef(figOrTableEl)) then - -- for a table div, apply the classes to the figOrTableEl itself - applyClasses(tblClasses, tblCaptionClasses, el, childEl, figOrTableEl, 'tbl') - forwarded = true - elseif figOrTableEl.t == 'Table' then - -- the figOrTableEl is a table, just apply the classes to the div around it - applyClasses(tblClasses, tblCaptionClasses, el, childEl, childEl, 'tbl') - forwarded = true + local custom = _quarto.ast.resolve_custom_data(figOrTableEl) + if custom ~= nil then + local ref_type = crossref.categories.by_name[custom.type].ref_type + local custom_classes = float_classes[ref_type] + local custom_caption_classes = float_caption_classes[ref_type] + -- applyClasses(colClasses, captionClasses, containerEl, colEl, captionEl, scope) + applyClasses(custom_classes, custom_caption_classes, el, custom, custom, ref_type) + else + local figure = discoverFigure(figOrTableEl, false) + if figure ~= nil then + -- forward to figures + applyClasses(figClasses, figCaptionClasses, el, childEl, figure, 'fig') + forwarded = true + elseif hasFigureRef(figOrTableEl) then + -- forward to figure divs + applyClasses(figClasses, figCaptionClasses, el, childEl, figOrTableEl, 'fig') + forwarded = true + elseif (figOrTableEl.t == 'Div' and hasTableRef(figOrTableEl)) then + -- for a table div, apply the classes to the figOrTableEl itself + applyClasses(tblClasses, tblCaptionClasses, el, childEl, figOrTableEl, 'tbl') + forwarded = true + elseif figOrTableEl.t == 'Table' then + -- the figOrTableEl is a table, just apply the classes to the div around it + applyClasses(tblClasses, tblCaptionClasses, el, childEl, childEl, 'tbl') + forwarded = true + end end end @@ -152,7 +178,7 @@ function applyCaptionClasses(el, classes, scope) end -- write the resolve scopes - tappend(el.attr.classes, classes) + tappend(el.classes, classes) end function applyColumnClasses(el, classes, scope) @@ -166,7 +192,7 @@ function applyColumnClasses(el, classes, scope) end -- write the resolve scopes - tappend(el.attr.classes, classes) + tappend(el.classes, classes) end function computeClassesForScopedCaption(el, scope) @@ -241,7 +267,7 @@ function mergedScopedColumnClasses(el, scope) end function resolveScopedColumnClasses(el, scope) - local filtered = el.attr.classes:filter(function(clz) + local filtered = el.classes:filter(function(clz) return clz:match('^' .. scope .. '%-column%-') end) @@ -251,7 +277,7 @@ function resolveScopedColumnClasses(el, scope) end function resolveScopedCaptionClasses(el, scope) - local filtered = el.attr.classes:filter(function(clz) + local filtered = el.classes:filter(function(clz) return clz:match('^' .. scope .. '%-cap%-location%-') end) @@ -266,18 +292,30 @@ function resolveScopedCaptionClasses(el, scope) end end +function is_scoped_column_class(scope) + return function(clz) + return clz:match('^' .. scope .. '%-column%-') + end +end + +function is_scoped_caption_class(scope) + return function(clz) + return clz:match('^' .. scope .. '%-cap%-location%-') + end +end + function removeScopedColumnClasses(el, scope) - for i, clz in ipairs(el.attr.classes) do + for i, clz in ipairs(el.classes) do if clz:match('^' .. scope .. '%-column%-') then - el.attr.classes:remove(i) + el.classes:remove(i) end end end function removeScopedCaptionClasses(el, scope) - for i, clz in ipairs(el.attr.classes) do + for i, clz in ipairs(el.classes) do if clz:match('^' .. scope .. '%-cap%-location%-') then - el.attr.classes:remove(i) + el.classes:remove(i) end end end diff --git a/src/resources/filters/layout/columns.lua b/src/resources/filters/layout/columns.lua index d6ab0cce016..bdd700c4f51 100644 --- a/src/resources/filters/layout/columns.lua +++ b/src/resources/filters/layout/columns.lua @@ -23,12 +23,12 @@ function columns() return el else -- convert the aside class to a column-margin class - if el.attr.classes and tcontains(el.attr.classes, 'aside') then + if el.classes and tcontains(el.classes, 'aside') then noteHasColumns() - el.attr.classes = el.attr.classes:filter(function(attr) + el.classes = el.classes:filter(function(attr) return attr ~= "aside" end) - tappend(el.attr.classes, {'column-margin'}) + tappend(el.classes, {'column-margin'}) return el end end @@ -61,12 +61,12 @@ function renderDivColumn(el) -- be marked a column-margin element (so that it is processed -- by post processors). -- For example: https://github.com/quarto-dev/quarto-cli/issues/2701 - if el.attr.classes and tcontains(el.attr.classes, 'aside') then + if el.classes and tcontains(el.classes, 'aside') then noteHasColumns() - el.attr.classes = el.attr.classes:filter(function(attr) + el.classes = el.classes:filter(function(attr) return attr ~= "aside" end) - tappend(el.attr.classes, {'column-margin'}) + tappend(el.classes, {'column-margin'}) return el end @@ -92,7 +92,7 @@ function renderDivColumn(el) el.content[2] = captionContainer else -- move to container - el.attr.classes:insert(clz) + el.classes:insert(clz) end end end @@ -105,7 +105,7 @@ function renderDivColumn(el) if #columnClasses > 0 then noteHasColumns() - if el.attr.classes:includes('cell-output-display') and #el.content > 0 then + if el.classes:includes('cell-output-display') and #el.content > 0 then -- this could be a code-display-cell local figOrTable = false for j=1,#el.content do @@ -197,20 +197,20 @@ end function hasColumnClasses(el) - return tcontains(el.attr.classes, isColumnClass) or hasMarginColumn(el) + return tcontains(el.classes, isColumnClass) or hasMarginColumn(el) end function hasMarginColumn(el) - if el.attr ~= nil and el.attr.classes ~= nil then - return tcontains(el.attr.classes, 'column-margin') or tcontains(el.attr.classes, 'aside') + if el.classes ~= nil then + return tcontains(el.classes, 'column-margin') or tcontains(el.classes, 'aside') else return false end end function hasMarginCaption(el) - if el.attr ~= nil and el.attr.classes ~= nil then - return tcontains(el.attr.classes, 'margin-caption') + if el.classes ~= nil then + return tcontains(el.classes, 'margin-caption') else return false end @@ -225,7 +225,7 @@ function notColumnClass(clz) end function resolveColumnClasses(el) - return el.attr.classes:filter(isColumnClass) + return el.classes:filter(isColumnClass) end function columnToClass(column) @@ -237,10 +237,10 @@ function columnToClass(column) end function removeColumnClasses(el) - if el.attr and el.attr.classes then - for i, clz in ipairs(el.attr.classes) do + if el.classes then + for i, clz in ipairs(el.classes) do if isColumnClass(clz) then - el.attr.classes:remove(i) + el.classes:remove(i) end end end @@ -250,26 +250,26 @@ function addColumnClasses(classes, toEl) removeColumnClasses(toEl) for i, clz in ipairs(classes) do if isColumnClass(clz) then - toEl.attr.classes:insert(clz) + toEl.classes:insert(clz) end end end function removeCaptionClasses(el) - for i, clz in ipairs(el.attr.classes) do + for i, clz in ipairs(el.classes) do if isCaptionClass(clz) then - el.attr.classes:remove(i) + el.classes:remove(i) end end end function resolveCaptionClasses(el) - local filtered = el.attr.classes:filter(isCaptionClass) + local filtered = el.classes:filter(isCaptionClass) if #filtered > 0 then return {'margin-caption'} else -- try looking for attributes - if el.attr.attributes['cap-location'] == "margin" then + if el.attributes ~= nil and el.attributes['cap-location'] == "margin" then return {'margin-caption'} else return {} diff --git a/src/resources/filters/layout/confluence.lua b/src/resources/filters/layout/confluence.lua new file mode 100644 index 00000000000..c698829725c --- /dev/null +++ b/src/resources/filters/layout/confluence.lua @@ -0,0 +1,129 @@ +-- confluence.lua +-- Copyright (C) 2023 Posit Software, PBC + +-- FIXME this is repeated from overrides.lua but we need to +-- sort out our require() situation first. +local function interpolate(str, vars) + -- Allow replace_vars{str, vars} syntax as well as replace_vars(str, {vars}) + if not vars then + vars = str + str = vars[1] + end + return (string.gsub(str, "({([^}]+)})", + function(whole, i) + return vars[i] or whole + end)) +end + +local function HTMLAnchorConfluence(id) + if (not id or #id == 0) then + return pandoc.RawInline("confluence", "") + end + + local SNIPPET = [[{id}]] + + return pandoc.RawInline("confluence", interpolate { + SNIPPET, + id = id or '' + }) +end + +_quarto.ast.add_renderer("FloatRefTarget", function(_) + return _quarto.format.isConfluenceOutput() +end, function(float) + decorate_caption_with_crossref(float) + + local attr = pandoc.Attr(float.identifier or "", float.classes or {}, float.attributes or {}) + if float.content.t == "Plain" and #float.content.content == 1 and float.content.content[1].t == "Image" then + local result = float.content.content[1] + result.caption = quarto.utils.as_inlines(float.caption_long) + result.attr = merge_attrs(result.attr, attr) + return pandoc.Blocks({ HTMLAnchorConfluence(float.identifier), result }) + end + + local div_content = pandoc.Div({}, attr) + div_content.content:insert(float.content) + + if float.caption_long then + div_content.content:insert(float.caption_long) + end + + return div_content + + -- local content = pandoc.Blocks({}) + -- return pandoc.Div(content, pandoc.Attr(float.identifier or "", float.classes or {}, float.attributes or {})) +end) + +_quarto.ast.add_renderer("PanelLayout", function(_) + return _quarto.format.isConfluenceOutput() +end, function(layout) + decorate_caption_with_crossref(layout.float) + + if layout.float == nil then + fail_and_ask_for_bug_report("Confluence format can't render layouts without floats") + return nil + end + + -- empty options by default + if not options then + options = {} + end + -- outer panel to contain css and figure panel + local attr = pandoc.Attr(layout.identifier or "", layout.classes or {}, layout.attributes or {}) + local panel_content = pandoc.Blocks({}) + + -- layout + for i, row in ipairs(layout.layout) do + + local aligns = row:map(function(cell) + -- get the align + local align = cell.attributes[kLayoutAlign] + return layoutTableAlign(align) + end) + local widths = row:map(function(cell) + -- propagage percents if they are provided + local layoutPercent = horizontalLayoutPercent(cell) + if layoutPercent then + return layoutPercent / 100 + else + return 0 + end + end) + + local cells = pandoc.List() + for _, cell in ipairs(row) do + local align = cell.attributes[kLayoutAlign] + cells:insert(cell) + end + + -- make the table + local panelTable = pandoc.SimpleTable( + pandoc.List(), -- caption + aligns, + widths, + pandoc.List(), -- headers + { cells } + ) + + -- add it to the panel + panel_content:insert(pandoc.utils.from_simple_table(panelTable)) + end + if layout.float.caption_long then + panel_content:insert(pandoc.Para(quarto.utils.as_inlines(layout.float.caption_long) or {})) + end + + local result = pandoc.Div(panel_content, attr) + + if layout.preamble then + local pt = pandoc.utils.type(layout.preamble) + if pt == "Blocks" then + layout.preamble:insert(result) + return result + elseif pt == "Block" then + return pandoc.Blocks({ layout.preamble, result }) + end + else + return result + end +end) + diff --git a/src/resources/filters/layout/docx.lua b/src/resources/filters/layout/docx.lua index eb04b82144d..abf82af20cf 100644 --- a/src/resources/filters/layout/docx.lua +++ b/src/resources/filters/layout/docx.lua @@ -1,6 +1,64 @@ -- docx.lua -- Copyright (C) 2020-2022 Posit Software, PBC +function docx_content_fixups(el, align, layoutPercent) + local width = wpPageWidth() + return _quarto.ast.walk(el, { + traverse = "topdown", + Div = function(div) + if div.classes:includes("quarto-layout-cell-subref") then + layoutPercent = horizontalLayoutPercent(div) + return docx_content_fixups(div, align, layoutPercent), false + end + end, + Image = function(image) + if width then + if layoutPercent then + local inches = (layoutPercent/100) * width + image.attr.attributes["width"] = string.format("%2.2f", inches) .. "in" + return image + end + end + end, + Table = function(tbl) + if align == "center" then + -- force widths to occupy 100% + layoutEnsureFullTableWidth(tbl) + return tbl + end + end + }) or pandoc.Div({}) -- not necessary but the lua analyzer doesn't know that +end + +_quarto.ast.add_renderer("PanelLayout", function(_) + return _quarto.format.isDocxOutput() or _quarto.format.isOdtOutput() +end, function(layout) + decorate_caption_with_crossref(layout.float) + + local div = pandoc.Div({}) + + local layout_attr = pandoc.Attr(layout.identifier or "", layout.classes or {}, layout.attributes or {}) + local float_attr = pandoc.Attr(layout.float.identifier or "", layout.float.classes or {}, layout.float.attributes or {}) + div.attr = merge_attrs(float_attr, layout_attr) + + local rows = layout.rows.content:map(function(div) return div.content end) + local rendered_panel = tableDocxPanel(div, rows, layout.float.caption_long) + local align = align_attribute(layout.float) + rendered_panel = docx_content_fixups(rendered_panel, align) + + local preamble = layout.preamble + if preamble == nil then + return rendered_panel + end + + local result = pandoc.Blocks({}) + panel_insert_preamble(result, preamble) + result:insert(rendered_panel) + + return result +end) + + function tableDocxPanel(divEl, layout, caption) return tablePanel(divEl, layout, caption, { diff --git a/src/resources/filters/layout/figures.lua b/src/resources/filters/layout/figures.lua index 8fc161dedf3..434122ed2ba 100644 --- a/src/resources/filters/layout/figures.lua +++ b/src/resources/filters/layout/figures.lua @@ -3,43 +3,6 @@ local constants = require("modules/constants") --- extended figure features including fig-align, fig-env, etc. -function extended_figures() - return { - - Para = function(el) - local image = discoverFigure(el, false) - if image and shouldHandleExtendedImage(image) then - if _quarto.format.isHtmlOutput() then - return htmlImageFigure(image) - elseif _quarto.format.isLatexOutput() then - return latexImageFigure(image) - elseif _quarto.format.isDocxOutput() then - return wpDivFigure(createFigureDiv(el, image)) - elseif _quarto.format.isAsciiDocOutput() then - return asciidocFigure(image) - end - end - end, - - Div = function(el) - if isFigureDiv(el) and shouldHandleExtended(el) then - if _quarto.format.isLatexOutput() then - return latexDivFigure(el) - elseif _quarto.format.isHtmlOutput() then - return htmlDivFigure(el) - elseif _quarto.format.isDocxOutput() then - return wpDivFigure(el) - elseif _quarto.format.isJatsOutput() then - return jatsDivFigure(el) - elseif _quarto.format.isAsciiDocOutput() then - return asciidocDivFigure(el) - end - end - end - } -end - function preventExtendedFigure(el) el.attr.attributes[constants.kFigExtended] = "false" end diff --git a/src/resources/filters/layout/html.lua b/src/resources/filters/layout/html.lua index 8aeaa866e8d..3ddd4ab5d2e 100644 --- a/src/resources/filters/layout/html.lua +++ b/src/resources/filters/layout/html.lua @@ -1,119 +1,216 @@ -- html.lua -- Copyright (C) 2020-2022 Posit Software, PBC -function htmlPanel(divEl, layout, caption) - - -- outer panel to contain css and figure panel - local divId = divEl.attr.identifier - if divId == nil then - divId = '' - end - - local panel = pandoc.Div({}, pandoc.Attr(divId, divEl.attr.classes)) - panel.attr.classes:insert("quarto-layout-panel") - - -- enclose in figure if it's a figureRef - if hasFigureRef(divEl) then - panel.content:insert(pandoc.RawBlock("html", "
")) - end +_quarto.ast.add_renderer("PanelLayout", function(_) + return _quarto.format.isHtmlOutput() +end, function(panel_layout) + local panel = pandoc.Div({}) - -- compute vertical alignment and remove attribute - local vAlign = validatedVAlign(divEl.attr.attributes[kLayoutVAlign]) - local vAlignClass = vAlignClass(vAlign); - divEl.attr.attributes[kLayoutVAlign] = nil - -- layout - for i, row in ipairs(layout) do - - local rowDiv = pandoc.Div({}, pandoc.Attr("", {"quarto-layout-row"})) - - -- add the vertical align element to this row - if vAlignClass then - rowDiv.attr.classes:insert(vAlignClass); + for i, row in ipairs(panel_layout.rows.content) do + local row_div = row + row_div.attr.classes:insert("quarto-layout-row") + if panel_layout.valign_class then + row_div.attr.classes:insert(panel_layout.valign_class) end - - for i, cellDiv in ipairs(row) do + for j, cell_div in ipairs(row.content) do -- add cell class - cellDiv.attr.classes:insert("quarto-layout-cell") - - -- if it has a ref parent then give it another class - -- (used to provide subcaption styling) - if layoutCellHasRefParent(cellDiv) then - cellDiv.attr.classes:insert("quarto-layout-cell-subref") - end - + cell_div.attr.classes:insert("quarto-layout-cell") + -- create css style for width - local cellDivStyle = "" - local width = cellDiv.attr.attributes["width"] - local align = cellDiv.attr.attributes[kLayoutAlign] - cellDiv.attr.attributes[kLayoutAlign] = nil - cellDivStyle = cellDivStyle .. "flex-basis: " .. width .. ";" - cellDiv.attr.attributes["width"] = nil + local cell_div_style = "" + local width = cell_div.attr.attributes["width"] + local align = cell_div.attr.attributes[kLayoutAlign] + cell_div.attr.attributes[kLayoutAlign] = nil + cell_div_style = cell_div_style .. "flex-basis: " .. width .. ";" + cell_div.attr.attributes["width"] = nil local justify = flexAlign(align) - cellDivStyle = cellDivStyle .. "justify-content: " .. justify .. ";" - cellDiv.attr.attributes["style"] = cellDivStyle + cell_div_style = cell_div_style .. "justify-content: " .. justify .. ";" + cell_div.attr.attributes["style"] = cell_div_style + local has_table = false + local parent_id -- if it's a table then our table-inline style will cause table headers -- (th) to be centered. set them to left is they are default - local tbl = tableFromLayoutCell(cellDiv) - if tbl then - tbl.colspecs = tbl.colspecs:map(function(spec) - if spec[1] == pandoc.AlignDefault then - spec[1] = pandoc.AlignLeft + -- print(cell_div) + cell_div = _quarto.ast.walk(cell_div, { + FloatRefTarget = function(float) + parent_id = float.parent_id + return nil + end, + Table = function(table) + has_table = true + local changed = false + table.colspecs = table.colspecs:map(function(spec) + if spec[1] == pandoc.AlignDefault then + spec[1] = pandoc.AlignLeft + changed = true + end + return spec + end) + if changed then + return table end - return spec - end) + end + }) or {} -- this isn't needed by the Lua analyzer doesn't know it + + if has_table and parent_id ~= nil then + cell_div.attr.attributes[kRefParent] = parent_id end - - -- add div to row - rowDiv.content:insert(cellDiv) + row_div.content[j] = cell_div end -- add row to the panel - panel.content:insert(rowDiv) + panel.content:insert(row_div) + end + + local rendered_panel + + if panel_layout.is_float_reftarget then + rendered_panel = float_reftarget_render_html_figure( + decorate_caption_with_crossref(quarto.FloatRefTarget({ + identifier = panel_layout.identifier, + classes = panel_layout.classes, + attributes = panel_layout.attributes, + order = panel_layout.order, + type = panel_layout.type, + content = panel.content, + caption_long = pandoc.List({panel_layout.caption_long}), + }))) + rendered_panel.attr = pandoc.Attr(panel_layout.identifier, {"quarto-layout-panel"}) + else + rendered_panel = panel + rendered_panel.attr = pandoc.Attr( + panel_layout.identifier or "", + panel_layout.classes, + panel_layout.attributes) + rendered_panel.attr.classes:insert("quarto-layout-panel") + end + local preamble = panel_layout.preamble + if preamble == nil then + return rendered_panel end - -- determine alignment - local align = layoutAlignAttribute(divEl) - divEl.attr.attributes[kLayoutAlign] = nil + local result = pandoc.Blocks({}) + panel_insert_preamble(result, preamble) + result:insert(rendered_panel) + return result +end) + +-- function htmlPanel(divEl, layout, caption) - -- insert caption and
- if caption then - if hasFigureRef(divEl) then - local captionPara = pandoc.Para({}) - -- apply alignment if we have it - local figcaption = "
" - captionPara.content:insert(pandoc.RawInline("html", figcaption)) - tappend(captionPara.content, caption.content) - captionPara.content:insert(pandoc.RawInline("html", "
")) - if capLocation('fig', 'bottom') == 'bottom' then - panel.content:insert(captionPara) - else - tprepend(panel.content, { captionPara }) - end - else - local panelCaption = pandoc.Div(caption, pandoc.Attr("", { "panel-caption" })) - if hasTableRef(divEl) then - panelCaption.attr.classes:insert("table-caption") - if capLocation('tbl', 'top') == 'bottom' then - panel.content:insert(panelCaption) - else - tprepend(panel.content, { panelCaption }) - end - else - panel.content:insert(panelCaption) - end - end - end +-- -- outer panel to contain css and figure panel +-- local divId = divEl.attr.identifier +-- if divId == nil then +-- divId = '' +-- end + +-- local panel = pandoc.Div({}, pandoc.Attr(divId, divEl.attr.classes)) +-- panel.attr.classes:insert("quarto-layout-panel") - if hasFigureRef(divEl) then - panel.content:insert(pandoc.RawBlock("html", "")) - end +-- -- enclose in figure if it's a figureRef +-- if hasFigureRef(divEl) then +-- panel.content:insert(pandoc.RawBlock("html", "
")) +-- end + +-- -- compute vertical alignment and remove attribute +-- local vAlign = validatedVAlign(divEl.attr.attributes[kLayoutVAlign]) +-- local vAlignClass = vAlignClass(vAlign); +-- divEl.attr.attributes[kLayoutVAlign] = nil - -- return panel - return panel -end +-- -- layout +-- for i, row in ipairs(layout) do + +-- local rowDiv = pandoc.Div({}, pandoc.Attr("", {"quarto-layout-row"})) + +-- -- add the vertical align element to this row +-- if vAlignClass then +-- rowDiv.attr.classes:insert(vAlignClass); +-- end + +-- for i, cellDiv in ipairs(row) do + +-- -- add cell class +-- cellDiv.attr.classes:insert("quarto-layout-cell") + +-- -- if it has a ref parent then give it another class +-- -- (used to provide subcaption styling) +-- if layoutCellHasRefParent(cellDiv) then +-- cellDiv.attr.classes:insert("quarto-layout-cell-subref") +-- end + +-- -- create css style for width +-- local cellDivStyle = "" +-- local width = cellDiv.attr.attributes["width"] +-- local align = cellDiv.attr.attributes[kLayoutAlign] +-- cellDiv.attr.attributes[kLayoutAlign] = nil +-- cellDivStyle = cellDivStyle .. "flex-basis: " .. width .. ";" +-- cellDiv.attr.attributes["width"] = nil +-- local justify = flexAlign(align) +-- cellDivStyle = cellDivStyle .. "justify-content: " .. justify .. ";" +-- cellDiv.attr.attributes["style"] = cellDivStyle + +-- -- if it's a table then our table-inline style will cause table headers +-- -- (th) to be centered. set them to left is they are default +-- local tbl = tableFromLayoutCell(cellDiv) +-- if tbl then +-- tbl.colspecs = tbl.colspecs:map(function(spec) +-- if spec[1] == pandoc.AlignDefault then +-- spec[1] = pandoc.AlignLeft +-- end +-- return spec +-- end) +-- end + +-- -- add div to row +-- rowDiv.content:insert(cellDiv) +-- end + +-- -- add row to the panel +-- panel.content:insert(rowDiv) +-- end + +-- -- determine alignment +-- local align = layoutAlignAttribute(divEl) +-- divEl.attr.attributes[kLayoutAlign] = nil + +-- -- insert caption and
+-- if caption then +-- if hasFigureRef(divEl) then +-- local captionPara = pandoc.Para({}) +-- -- apply alignment if we have it +-- local figcaption = "
" +-- captionPara.content:insert(pandoc.RawInline("html", figcaption)) +-- tappend(captionPara.content, caption.content) +-- captionPara.content:insert(pandoc.RawInline("html", "
")) +-- if capLocation('fig', 'bottom') == 'bottom' then +-- panel.content:insert(captionPara) +-- else +-- tprepend(panel.content, { captionPara }) +-- end +-- else +-- local panelCaption = pandoc.Div(caption, pandoc.Attr("", { "panel-caption" })) +-- if hasTableRef(divEl) then +-- panelCaption.attr.classes:insert("table-caption") +-- if capLocation('tbl', 'top') == 'bottom' then +-- panel.content:insert(panelCaption) +-- else +-- tprepend(panel.content, { panelCaption }) +-- end +-- else +-- panel.content:insert(panelCaption) +-- end +-- end +-- end + +-- if hasFigureRef(divEl) then +-- panel.content:insert(pandoc.RawBlock("html", "")) +-- end + +-- -- return panel +-- return panel +-- end function htmlDivFigure(el) diff --git a/src/resources/filters/layout/ipynb.lua b/src/resources/filters/layout/ipynb.lua new file mode 100644 index 00000000000..60b27a99ebb --- /dev/null +++ b/src/resources/filters/layout/ipynb.lua @@ -0,0 +1,75 @@ +-- ipynb.lua +-- Copyright (C) 2020-2023 Posit Software, PBC + +_quarto.ast.add_renderer("PanelLayout", function(_) + return _quarto.format.isIpynbOutput() and param("enable-crossref", true) +end, function(layout) + if layout.float == nil then + fail_and_ask_for_bug_report("Ipynb format can't render layouts without floats") + return pandoc.Div({}) + end + decorate_caption_with_crossref(layout.float) + + -- empty options by default + if not options then + options = {} + end + -- outer panel to contain css and figure panel + local attr = pandoc.Attr(layout.identifier or "", layout.classes or {}, layout.attributes or {}) + local panel_content = pandoc.Blocks({}) + -- layout + for i, row in ipairs(layout.layout) do + + local aligns = row:map(function(cell) + -- get the align + local align = cell.attributes[kLayoutAlign] + return layoutTableAlign(align) + end) + local widths = row:map(function(cell) + -- propagage percents if they are provided + local layoutPercent = horizontalLayoutPercent(cell) + if layoutPercent then + return layoutPercent / 100 + else + return 0 + end + end) + + local cells = pandoc.List() + for _, cell in ipairs(row) do + cells:insert(cell) + end + + -- make the table + local panelTable = pandoc.SimpleTable( + pandoc.List(), -- caption + aligns, + widths, + pandoc.List(), -- headers + { cells } + ) + + -- add it to the panel + panel_content:insert(pandoc.utils.from_simple_table(panelTable)) + end + + local result = pandoc.Div({}) + + if layout.float.caption_long then + result.content:insert(pandoc.Para(quarto.utils.as_inlines(layout.float.caption_long) or {})) + end + + if layout.preamble then + return pandoc.Blocks({ layout.preamble, result }) + else + return result + end +end) + +-- this should really be "_quarto.format.isEmbedIpynb()" or something like that.. +_quarto.ast.add_renderer("PanelLayout", function(_) + return _quarto.format.isIpynbOutput() and not param("enable-crossref", true) +end, function(float) + internal_error() + return pandoc.Div({}) +end) \ No newline at end of file diff --git a/src/resources/filters/layout/jats.lua b/src/resources/filters/layout/jats.lua index 16b78fd2bb9..aa753f2f0ec 100644 --- a/src/resources/filters/layout/jats.lua +++ b/src/resources/filters/layout/jats.lua @@ -47,3 +47,71 @@ function jatsPosition(el) return "float" end end + +_quarto.ast.add_renderer("PanelLayout", function(layout) + return _quarto.format.isJatsOutput() +end, function(layout) + + if layout.float == nil then + fail_and_ask_for_bug_report("JATS format can't render layouts without floats") + return nil + end + + -- empty options by default + if not options then + options = {} + end + -- outer panel to contain css and figure panel + local attr = pandoc.Attr(layout.identifier or "", layout.classes or {}, layout.attributes or {}) + local panel_content = pandoc.Blocks({}) + -- layout + for i, row in ipairs(layout.layout) do + + local aligns = row:map(function(cell) + -- get the align + local align = cell.attributes[kLayoutAlign] + return layoutTableAlign(align) + end) + local widths = row:map(function(cell) + -- propagage percents if they are provided + local layoutPercent = horizontalLayoutPercent(cell) + if layoutPercent then + return layoutPercent / 100 + else + return 0 + end + end) + + local cells = pandoc.List() + for _, cell in ipairs(row) do + local align = cell.attributes[kLayoutAlign] + cells:insert(cell) + end + + -- make the table + local panelTable = pandoc.SimpleTable( + pandoc.List(), -- caption + aligns, + widths, + pandoc.List(), -- headers + { cells } + ) + + -- add it to the panel + panel_content:insert(pandoc.utils.from_simple_table(panelTable)) + end + decorate_caption_with_crossref(layout.float) + local result = pandoc.Figure(panel_content, {layout.float.caption_long}, attr) + + local pt = pandoc.utils.type(layout.preamble) + if pt == "Blocks" then + layout.preamble:insert(result) + return layout.preamble + elseif pt == "Block" then + return pandoc.Blocks({ layout.preamble, result }) + elseif pt == "nil" then + return result + else + internal_error() + end +end) \ No newline at end of file diff --git a/src/resources/filters/layout/latex.lua b/src/resources/filters/layout/latex.lua index 28c42f8140f..f1638a891a6 100644 --- a/src/resources/filters/layout/latex.lua +++ b/src/resources/filters/layout/latex.lua @@ -2,33 +2,46 @@ -- Copyright (C) 2020-2022 Posit Software, PBC kSideCaptionEnv = 'sidecaption' -function latexPanel(divEl, layout, caption) +_quarto.ast.add_renderer("PanelLayout", function(_) + return _quarto.format.isLatexOutput() +end, function(layout) + local rendered_panel = latexPanel(layout) + local preamble = layout.preamble + if preamble == nil then + return rendered_panel + end + + local result = pandoc.Blocks({}) + panel_insert_preamble(result, preamble) + result:insert(rendered_panel) + + return result +end) + +-- function latexPanel(divEl, layout, caption) +function latexPanel(layout) - -- create container - local panel = pandoc.Div({}) - -- begin container - local env, pos = latexPanelEnv(divEl, layout) - panel.content:insert(latexBeginEnv(env, pos)); + local env, pos = latexPanelEnv(layout) + local panel_node, panel = quarto.LatexEnvironment({ + name = env, + pos = pos + }) - local capType = "fig" - local locDefault = "bottom" - if hasTableRef(divEl) then - capType = "tbl" - locDefault = "top" - end - local capLoc = capLocation(capType, locDefault) - if (caption and capLoc == "top") then - insertLatexCaption(divEl, panel.content, caption.content) + local capLoc = "bottom" + + if layout.float ~= nil then + capLoc = cap_location(layout.float) end + local caption = create_latex_caption(layout) -- read vertical alignment and strip attribute - local vAlign = validatedVAlign(divEl.attr.attributes[kLayoutVAlign]) - divEl.attr.attributes[kLayoutVAlign] = nil + local vAlign = validatedVAlign(layout.attributes[kLayoutVAlign]) + layout.attributes[kLayoutVAlign] = nil - for i, row in ipairs(layout) do + for i, row in ipairs(layout.rows.content) do - for j, cell in ipairs(row) do + for j, cell in ipairs(row.content) do -- there should never be \begin{table} inside a panel (as that would -- create a nested float). this can happen if knitr injected it as a @@ -36,64 +49,41 @@ function latexPanel(divEl, layout, caption) cell = latexRemoveTableDelims(cell) -- process cell (enclose content w/ alignment) - local endOfTable = i == #layout - local endOfRow = j == #row + local endOfTable = i == #layout.rows.content + local endOfRow = j == #row.content local prefix, content, suffix = latexCell(cell, vAlign, endOfRow, endOfTable) - panel.content:insert(prefix) - local align = cell.attr.attributes[kLayoutAlign] - if align == "center" then - panel.content:insert(pandoc.RawBlock("latex", latexBeginAlign(align))) - end - tappend(panel.content, content) - if align == "center" then - panel.content:insert(pandoc.RawBlock("latex", latexEndAlign(align))) - end - panel.content:insert(suffix) + panel.content.content:insert(prefix) + tappend(panel.content.content, content) + panel.content.content:insert(suffix) end end -- surround caption w/ appropriate latex (and end the panel) - if caption and capLoc == "bottom" then - insertLatexCaption(divEl, panel.content, caption.content) + if caption then + if capLoc == "top" then + panel.content.content:insert(1, caption) + elseif capLoc == "bottom" then + panel.content.content:insert(caption) + else + warn("unknown caption location '" .. capLoc .. "'. Skipping caption.") + end end - - -- end latex env - panel.content:insert(latexEndEnv(env)); - - -- conjoin paragarphs - panel.content = latexJoinParas(panel.content) - + -- conjoin paragraphs + panel.content.content = latexJoinParas(panel.content.content) + -- return panel - return panel - + return panel_node end -- determine the environment (and pos) to use for a latex panel -function latexPanelEnv(divEl, layout) +function latexPanelEnv(layout) -- defaults - local env = latexFigureEnv(divEl) - local pos = nil + local env = latexFigureEnv(layout) + local pos = attribute(layout.float or { attributes = {} }, kFigPos) - -- explicit figure panel - if hasFigureRef(divEl) then - pos = attribute(divEl, kFigPos, pos) - -- explicit table panel - elseif hasTableRef(divEl) then - env = latexTableEnv(divEl) - -- if there are embedded tables then we need to use table - else - local haveTables = layout:find_if(function(row) - return row:find_if(hasTableRef) - end) - if haveTables then - env = latexTableEnv(divEl) - end - end - return env, pos - end -- conjoin paragraphs (allows % to work correctly between minipages or subfloats) @@ -109,117 +99,38 @@ function latexJoinParas(content) return blocks end -function latexImageFigure(image) - - return renderLatexFigure(image, function(figure) - - -- make a copy of the caption and clear it - local caption = image.caption:clone() - tclear(image.caption) - - -- get align - local align = figAlignAttribute(image) - - -- insert the figure without the caption - local figureContent = { pandoc.Para({ - pandoc.RawInline("latex", latexBeginAlign(align)), - image, - pandoc.RawInline("latex", latexEndAlign(align)), - pandoc.RawInline("latex", "\n") - }) } - - -- return the figure and caption - return figureContent, caption - - end) -end - -function latexDivFigure(divEl) - - return renderLatexFigure(divEl, function(figure) - - -- get align - local align = figAlignAttribute(divEl) - - -- append everything before the caption - local blocks = tslice(divEl.content, 1, #divEl.content - 1) - local figureContent = pandoc.List() - if align == "center" then - figureContent:insert(pandoc.RawBlock("latex", latexBeginAlign(align))) - end - tappend(figureContent, blocks) - if align == "center" then - figureContent:insert(pandoc.RawBlock("latex", latexEndAlign(align))) - end - - -- return the figure and caption - local caption = refCaptionFromDiv(divEl) - if not caption then - caption = pandoc.Inlines() - end - return figureContent, caption.content - - end) - -end - -function renderLatexFigure(el, render) - - -- create container - local figure = pandoc.Div({}) - - -- begin the figure - local figEnv = latexFigureEnv(el) - local figPos = latexFigurePosition(el, figEnv) - - figure.content:insert(latexBeginEnv(figEnv, figPos)) - - -- get the figure content and caption inlines - local figureContent, captionInlines = render(figure) - - local capLoc = capLocation("fig", "bottom") - - -- surround caption w/ appropriate latex (and end the figure) - if captionInlines and inlinesToString(captionInlines) ~= "" then - if capLoc == "top" then - insertLatexCaption(el, figure.content, captionInlines) - tappend(figure.content, figureContent) - else - tappend(figure.content, figureContent) - insertLatexCaption(el, figure.content, captionInlines) - end - else - tappend(figure.content, figureContent) - end - - -- end figure - figure.content:insert(latexEndEnv(figEnv)) - - -- return the figure - return figure - -end - function latexCaptionEnv(el) - if el.attr.classes:includes(kSideCaptionClass) then + if el.classes:includes(kSideCaptionClass) then return kSideCaptionEnv else return 'caption' end end -function insertLatexCaption(divEl, content, captionInlines) - local captionEnv = latexCaptionEnv(divEl) - markupLatexCaption(divEl, captionInlines, captionEnv) - if captionEnv == kSideCaptionEnv then - if #content > 1 then - content:insert(2, pandoc.Para(captionInlines)) - else - content:insert(#content, pandoc.Para(captionInlines)) - end - else - content:insert(pandoc.Para(captionInlines)) +function create_latex_caption(layout) + if layout.float == nil then + return nil + end + local caption_env = latexCaptionEnv(layout.float) + if ((layout.caption_long == nil or #layout.caption_long.content == 0) and + (layout.caption_short == nil or #layout.caption_short.content == 0)) then + return nil end + local cap_inlines = quarto.utils.as_inlines(layout.caption_long) or pandoc.Inlines({}) -- unneeded but the Lua analyzer doesn't know that + if layout.identifier then + -- local label_node = quarto.LatexInlineCommand({ name = "label", arg = layout.identifier }) + local label_node = pandoc.RawInline("latex", "\\label{" .. layout.identifier .. "}") + + cap_inlines:insert(1, label_node) + end + local caption_node, caption = quarto.LatexInlineCommand({ + name = caption_env, + arg = scaffold(cap_inlines), + }) + if layout.caption_short ~= nil then + caption.opt_arg = quarto.utils.as_inlines(layout.caption_short) + end + return caption_node end function latexWrapSignalPostProcessor(el, token) @@ -275,7 +186,7 @@ local kEndSideNote = '\\end{footnotesize}}' function latexEndSidenote(el, block) local offset = '' if el.attr ~= nil then - local offsetValue = el.attr.attributes['offset'] + local offsetValue = el.attributes['offset'] if offsetValue ~= nil then offset = '[' .. offsetValue .. ']' end @@ -323,7 +234,7 @@ function latexBeginEnv(env, pos, inline) if inline then return pandoc.RawInline("latex", beginEnv) else - return pandoc.RawBlock("latex", beginEnv) + return pandoc.RawBlock("latex-merge", beginEnv) end end @@ -331,25 +242,42 @@ function latexEndEnv(env, inline) if inline then return pandoc.RawInline("latex", "\\end{" .. env .. "}") else - return pandoc.RawBlock("latex", "\\end{" .. env .. "}") + return pandoc.RawBlock("latex-merge", "\\end{" .. env .. "}%") end end function latexCell(cell, vAlign, endOfRow, endOfTable) -- figure out what we are dealing with - local label = cell.attr.identifier + local label = cell.identifier local image = figureImageFromLayoutCell(cell) + local has_pandoc_3_figure = false + if image == nil then + -- attempt to unwrap a Pandoc Figure + cell = _quarto.ast.walk(cell, { + Figure = function(figure) + has_pandoc_3_figure = true + _quarto.ast.walk(figure, { + Image = function(img) + image = img + end + }) + if image ~= nil then + return image + end + end + }) + end if (label == "") and image then - label = image.attr.identifier + label = image.identifier end local isFigure = isFigureRef(label) local isTable = isTableRef(label) - local isSubRef = hasRefParent(cell) or (image and hasRefParent(image)) + local isSubRef = hasRefParent(cell) or (image and hasRefParent(image)) or has_pandoc_3_figure local tbl = tableFromLayoutCell(cell) -- determine width - local width = cell.attr.attributes["width"] + local width = cell.attributes["width"] -- derive prefix, content, and suffix local prefix = pandoc.List() @@ -357,7 +285,6 @@ function latexCell(cell, vAlign, endOfRow, endOfTable) local content = pandoc.List() local suffix = pandoc.List() - -- sub-captioned always uses \subfloat if isSubRef then -- lift the caption out it it's current location and onto the \subfloat @@ -383,12 +310,16 @@ function latexCell(cell, vAlign, endOfRow, endOfTable) caption = pandoc.List() end end - - -- subcap - latexAppend(subcap, "\\subcaption{\\label{" .. label .. "}") - tappend(subcap, caption) - latexAppend(subcap, "}\n") + + -- only subcap in the passthrough Figure special case + if has_pandoc_3_figure then + -- subcap + latexAppend(subcap, "\\subcaption{\\label{" .. label .. "}") + tappend(subcap, caption) + latexAppend(subcap, "}\n") + end end + -- convert to latex percent as necessary width = asLatexSize(width) @@ -596,10 +527,35 @@ function latexFigureEnv(el) -- the user specified figure environment return figEnv else + local crossref_cat + if pandoc.utils.type(el) == "Block" then + local ref_type = refType(el.identifier) + if ref_type ~= nil then + crossref_cat = crossref.categories.by_ref_type[ref_type] + else + crossref_cat = crossref.categories.by_name.Figure + end + elseif pandoc.utils.type(el) == "table" then + crossref_cat = crossref.categories.by_name[el.type] + if crossref_cat == nil then + crossref_cat = crossref.categories.by_name.Figure + end + elseif pandoc.utils.type(el) == "Inline" then + local ref_type = refType(el.identifier) + if ref_type ~= nil then + crossref_cat = crossref.categories.by_ref_type[ref_type] + else + crossref_cat = crossref.categories.by_name.Figure + end + else + fail("Don't know how to handle " .. pandoc.utils.type(el) .. " in latexFigureEnv") + end + local env_name = crossref_cat.latex_env -- if not user specified, look for other classes which might determine environment local classes = el.classes for i,class in ipairs(classes) do + -- FIXME how to deal with margin custom floats? -- a margin figure or aside if isMarginEnv(class) then noteHasColumns() @@ -609,12 +565,12 @@ function latexFigureEnv(el) -- any column that resolves to full width if isStarEnv(class) then noteHasColumns() - return "figure*" + return env_name .. "*" end end -- the default figure environment - return "figure" + return env_name end end @@ -656,6 +612,90 @@ function latexTableEnv(el) return "table" end +-- this is still used by stray Figure nodes from Pandoc 3's AST +function latexImageFigure(image) + + return renderLatexFigure(image, function(figure) + + -- make a copy of the caption and clear it + local caption = image.caption:clone() + tclear(image.caption) + + -- get align + local align = figAlignAttribute(image) + + -- insert the figure without the caption + local figureContent = { pandoc.Para({ + pandoc.RawInline("latex", latexBeginAlign(align)), + image, + pandoc.RawInline("latex", latexEndAlign(align)), + pandoc.RawInline("latex", "\n") + }) } + + -- return the figure and caption + return figureContent, caption + + end) +end + +function renderLatexFigure(el, render) + + -- create container + local figure = pandoc.Div({}) + + -- begin the figure + local figEnv = latexFigureEnv(el) + local figPos = latexFigurePosition(el, figEnv) + + figure.content:insert(latexBeginEnv(figEnv, figPos)) + + -- get the figure content and caption inlines + local figureContent, captionInlines = render(figure) + + local capLoc = capLocation("fig", "bottom") + + -- surround caption w/ appropriate latex (and end the figure) + if captionInlines and inlinesToString(captionInlines) ~= "" then + if capLoc == "top" then + insertLatexCaption(el, figure.content, captionInlines) + tappend(figure.content, figureContent) + else + tappend(figure.content, figureContent) + insertLatexCaption(el, figure.content, captionInlines) + end + else + tappend(figure.content, figureContent) + end + + -- end figure + figure.content:insert(latexEndEnv(figEnv)) + + -- return the figure + return figure + +end + +function latexCaptionEnv(el) + if el.classes:includes(kSideCaptionClass) then + return kSideCaptionEnv + else + return 'caption' + end +end + +function insertLatexCaption(divEl, content, captionInlines) + local captionEnv = latexCaptionEnv(divEl) + markupLatexCaption(divEl, captionInlines, captionEnv) + if captionEnv == kSideCaptionEnv then + if #content > 1 then + content:insert(2, pandoc.Para(captionInlines)) + else + content:insert(#content, pandoc.Para(captionInlines)) + end + else + content:insert(pandoc.Para(captionInlines)) + end +end function isStarEnv(clz) return (clz:match('^column%-screen') or clz:match('^column%-page')) and not clz:match('%-left$') diff --git a/src/resources/filters/layout/layout.lua b/src/resources/filters/layout/layout.lua index 519cd47e9ef..8d12f6a163f 100644 --- a/src/resources/filters/layout/layout.lua +++ b/src/resources/filters/layout/layout.lua @@ -12,90 +12,50 @@ layoutState = { function layout_panels() return { - Div = function(el) - if requiresPanelLayout(el) then - - -- partition - local preamble, cells, caption = partitionCells(el) - - -- derive layout - local layout = layoutCells(el, cells) - - -- call the panel layout functions - local panel - if _quarto.format.isLatexOutput() then - panel = latexPanel(el, layout, caption) - elseif _quarto.format.isHtmlOutput() then - panel = htmlPanel(el, layout, caption) - elseif _quarto.format.isDocxOutput() then - panel = tableDocxPanel(el, layout, caption) - elseif _quarto.format.isOdtOutput() then - panel = tableOdtPanel(el, layout, caption) - elseif _quarto.format.isWordProcessorOutput() then - panel = tableWpPanel(el, layout, caption) - elseif _quarto.format.isPowerPointOutput() then - panel = pptxPanel(el, layout) - else - panel = tablePanel(el, layout, caption) - end - - -- transfer attributes from el to panel - local keys = tkeys(el.attr.attributes) - for _,k in pairs(keys) do - if not isLayoutAttribute(k) then - panel.attr.attributes[k] = el.attr.attributes[k] - end - end - - if #preamble > 0 then - local div = pandoc.Div({}) - if #preamble > 0 then - tappend(div.content, preamble) - end - div.content:insert(panel) - return div - - -- otherwise just return the panel - else - return panel - end - + Div = function(div) + if not attr_requires_panel_layout(div.attr) then + return nil end - end + local preamble, cells = partition_cells(div) + local layout = layout_cells(div, cells) + return quarto.PanelLayout({ + attr = div.attr, + preamble = preamble, + layout = layout, + }) + end, + FloatRefTarget = function(float) + local attr = pandoc.Attr(float.identifier, float.classes, float.attributes) + if not attr_requires_panel_layout(attr) then + return nil + end + + local preamble, cells = partition_cells(float) + local layout = layout_cells(float, cells) + + return quarto.PanelLayout({ + float = float, + preamble = preamble, + layout = layout, + }) + end, } end - -function requiresPanelLayout(divEl) - - if hasLayoutAttributes(divEl) then +function attr_requires_panel_layout(attr) + if attr_has_layout_attributes(attr) then return true - -- latex and html require special layout markup for subcaptions - elseif (_quarto.format.isLatexOutput() or _quarto.format.isHtmlOutput()) and - divEl.attr.classes:includes("tbl-parent") then - return true - else - return false end - + return (_quarto.format.isLatexOutput() or _quarto.format.isHtmlOutput()) and + attr.classes:includes("tbl-parent") end - -function partitionCells(divEl) - +function partition_cells(float) local preamble = pandoc.List() local cells = pandoc.List() - local caption = nil - - -- extract caption if it's a table or figure div - if hasFigureOrTableRef(divEl) then - caption = refCaptionFromDiv(divEl) - divEl.content = tslice(divEl.content, 1, #divEl.content-1) - end - + local heading = nil - for _,block in ipairs(divEl.content) do - + for _, block in ipairs(float.content) do if isPreambleBlock(block) then if block.t == "CodeBlock" and #preamble > 0 and preamble[#preamble].t == "CodeBlock" then preamble[#preamble].text = preamble[#preamble].text .. "\n" .. block.text @@ -108,28 +68,41 @@ function partitionCells(divEl) else heading = block end - else - -- ensure we are dealing with a div + else local cellDiv = nil - if block.t == "Div" then - -- if this has a single figure div then unwrap it - if #block.content == 1 and - block.content[#block.content].t == "Div" and - hasFigureOrTableRef(block.content[#block.content]) then - cellDiv = block.content[#block.content] - else - cellDiv = block - end - + local subfloat = _quarto.ast.resolve_custom_data(block) + + -- if we were given a scaffolding div like cell-output-display, etc, + -- we use it. + if subfloat == nil and block.t == "Div" then + cellDiv = block else cellDiv = pandoc.Div(block) end + + -- -- ensure we are dealing with a div + -- local cellDiv = nil + -- if block.t == "Div" then + -- -- if this has a single figure div then unwrap it + -- if #block.content == 1 and + -- block.content[#block.content].t == "Div" and + -- hasFigureOrTableRef(block.content[#block.content]) then + -- cellDiv = block.content[#block.content] + -- else + -- cellDiv = block + -- end + -- else + -- cellDiv = pandoc.Div(block) + -- end - -- special behavior for cells with figures (including ones w/o captions) - local fig = figureImageFromLayoutCell(cellDiv) - if fig then - -- transfer width to cell - transferImageWidthToCell(fig, cellDiv) + -- -- special behavior for cells with figures (including ones w/o captions) + -- local fig = figureImageFromLayoutCell(cellDiv) + -- if fig then + -- -- transfer width to cell + -- transferImageWidthToCell(fig, cellDiv) + -- end + if subfloat ~= nil and subfloat.t == "FloatRefTarget" then + transfer_float_image_width_to_cell(subfloat, cellDiv) end -- if we have a heading then insert it @@ -138,11 +111,17 @@ function partitionCells(divEl) heading = nil end + -- if this is .cell-output-display that isn't a figure or table -- then unroll multiple blocks - if cellDiv.attr.classes:find("cell-output-display") and - #cellDiv.content > 1 and - not hasFigureOrTableRef(cellDiv) then + local is_subfloat + _quarto.ast.walk(cellDiv, { + FloatRefTarget = function(float) + is_subfloat = true + return nil + end + }) + if cellDiv.attr.classes:find("cell-output-display") and is_subfloat == nil then for _,outputBlock in ipairs(cellDiv.content) do if outputBlock.t == "Div" then cells:insert(outputBlock) @@ -154,25 +133,39 @@ function partitionCells(divEl) -- add the div cells:insert(cellDiv) end + + -- -- if this is .cell-output-display that isn't a figure or table + -- -- then unroll multiple blocks + -- if cellDiv.attr.classes:find("cell-output-display") and + -- #cellDiv.content > 1 and + -- not hasFigureOrTableRef(cellDiv) then + -- for _,outputBlock in ipairs(cellDiv.content) do + -- if outputBlock.t == "Div" then + -- cells:insert(outputBlock) + -- else + -- cells:insert(pandoc.Div(outputBlock)) + -- end + -- end + -- else + -- -- add the div + -- cells:insert(cellDiv) + -- end end - end - return preamble, cells, caption - + return preamble, cells end - -function layoutCells(divEl, cells) +function layout_cells(float_or_div, cells) -- layout to return (list of rows) local rows = pandoc.List() -- note any figure layout attributes - local layoutRows = tonumber(attribute(divEl, kLayoutNrow, nil)) - local layoutCols = tonumber(attribute(divEl, kLayoutNcol, nil)) - local layout = attribute(divEl, kLayout, nil) + local layoutRows = tonumber(float_or_div.attributes[kLayoutNrow]) + local layoutCols = tonumber(float_or_div.attributes[kLayoutNcol]) + local layout = float_or_div.attributes[kLayout] -- default to 1 column if nothing is specified if not layoutCols and not layoutRows and not layout then @@ -240,7 +233,7 @@ function layoutCells(divEl, cells) end -- determine alignment - local align = layoutAlignAttribute(divEl) + local align = layout_align_attribute(float_or_div) -- some width and alignment handling rows = rows:map(function(row) @@ -267,6 +260,21 @@ function layoutCells(divEl, cells) end + +function requiresPanelLayout(divEl) + + if hasLayoutAttributes(divEl) then + return true + -- latex and html require special layout markup for subcaptions + elseif (_quarto.format.isLatexOutput() or _quarto.format.isHtmlOutput()) and + divEl.attr.classes:includes("tbl-parent") then + return true + else + return false + end + +end + function isPreambleBlock(el) return (el.t == "CodeBlock" and el.attr.classes:includes("cell-code")) or (el.t == "Div" and el.attr.classes:includes("cell-output-stderr")) diff --git a/src/resources/filters/layout/lightbox.lua b/src/resources/filters/layout/lightbox.lua new file mode 100644 index 00000000000..1ec2356c0ea --- /dev/null +++ b/src/resources/filters/layout/lightbox.lua @@ -0,0 +1,339 @@ +-- lightbox.lua +-- Copyright (C) 2020-2022 Posit Software, PBC + +local lightbox_module = require("modules/lightbox") + + +-- attributes to forward from the image to the newly created link +local kDescription = "description" +local kForwardedAttr = { + "title", kDescription, "desc-position", + "type", "effect", "zoomable", "draggable" +} + +local kLightboxClass = "lightbox" +local kNoLightboxClass = "nolightbox" +local kGalleryPrefix = "quarto-lightbox-gallery-" + +local function readAttrValue(el, attrName) + if attrName == kDescription then + local doc = pandoc.read(el.attr.attributes[attrName]) + local attrInlines = doc.blocks[1].content + return pandoc.write(pandoc.Pandoc(attrInlines), "html") + else + return el[attrName] + end +end + + +function lightbox() + -- whether we're automatically lightboxing + local auto = false + + -- whether we need lightbox dependencies added + local needsLightbox = false + + -- a counter used to ensure each image is in its own gallery + local imgCount = 0 + local function lightboxImage(imgEl, description, gallery) + -- note that we need to include the dependency for lightbox + needsLightbox = true + imgCount = imgCount + 1 + + -- remove the class from the image + imgEl.attr.classes = imgEl.attr.classes:filter(function(clz) + return clz ~= kLightboxClass + end) + + -- attributes for the link + local linkAttributes = {} + + -- mark this image as a lightbox target + linkAttributes.class = kLightboxClass + + -- get the alt text from image and use that as title + local title = nil + if imgEl.caption ~= nil and #imgEl.caption > 0 then + title = pandoc.utils.stringify(imgEl.caption) + elseif imgEl.attributes['fig-alt'] ~= nil and #imgEl.attributes['fig-alt'] > 0 then + title = pandoc.utils.stringify(imgEl.attributes['fig-alt']) + end + + -- move a group attribute to the link, if present + if imgEl.attr.attributes.group ~= nil then + linkAttributes.gallery = imgEl.attr.attributes.group + imgEl.attr.attributes.group = nil + elseif gallery ~= nil then + linkAttributes.gallery = gallery + else + linkAttributes.gallery = kGalleryPrefix .. imgCount + end + + -- write a description, if provided + if description ~= nil then + linkAttributes[kDescription] = inlinesToString(quarto.utils.as_inlines(description)) + end + + -- forward any other known attributes + for i, v in ipairs(kForwardedAttr) do + if imgEl.attr.attributes[v] ~= nil then + -- forward the attribute + linkAttributes[v] = readAttrValue(imgEl, v) + + -- clear the attribute + imgEl.attr.attributes[v] = nil + end + + -- clear the title + if (imgEl.title == 'fig:') then + imgEl.title = "" + end + + end + + -- wrap decorated images in a link with appropriate attrs + local link = pandoc.Link({imgEl}, imgEl.src, title, linkAttributes) + return link + end + + local function processImg(imgEl, options) + local automatic = options.automatic + local caption = options.caption + local gallery = options.gallery + + local autolightbox = automatic and auto and not imgEl.classes:includes(kNoLightboxClass) + if autolightbox or imgEl.classes:includes('lightbox') then + return lightboxImage(imgEl, caption, gallery) + end + end + + local function processFigure(figEl) + return _quarto.ast.walk(figEl, { + Image = function(imgEl) + return processImg(imgEl, { automatic = true, caption = figEl.caption }) + end + }) + end + + local function processSubFloat(subFloatEl, gallery, parentFloat) + local subFloatModified = false + subFloatEl = _quarto.ast.walk(subFloatEl, { + traverse = 'topdown', + Image = function(imgEl) + local caption_content = subFloatEl.caption_long.content or subFloatEl.caption_long + local caption = full_caption_prefix(parentFloat, subFloatEl) + tappend(caption, caption_content) + local subImgModified = processImg(imgEl, { automatic = true, caption = caption, gallery = gallery }) + if subImgModified ~= nil then + subFloatModified = true + return subImgModified, false + else + return nil, false + end + end + }) + if subFloatModified then + return subFloatEl + else + return nil + end + end + + if quarto.doc.is_format("html:js") then + return {{ + traverse = "topdown", + + Meta = function(meta) + -- Set auto lightbox mode, if need be + auto = lightbox_module.automatic(meta) == true + end, + -- Find images that are already within links + -- we'll use this to filter out these images if + -- the most is auto + Link = function() + -- don't walk images, figures, etc... that are already within a link + -- since we rely on being able to Link the image in order to + -- lightbox it + return nil, false + end, + Div = function(div) + -- Walk code cells and forward any lightbox parameters through to + -- the image class that holds them + if div.classes:includes("cell") and div.attributes["lightbox"] ~= nil then + meta = quarto.json.decode(div.attributes["lightbox"]) + local codeImgCount = 0 + div = _quarto.ast.walk(div, { + Image = function(imgEl) + codeImgCount = codeImgCount + 1 + if (type(meta) == "table" and meta[kNoLightboxClass] == true) or meta == false then + imgEl.classes:insert(kNoLightboxClass) + else + if not auto and ((type(meta) == "table" and not meta[kNoLightboxClass]) or meta == true) then + imgEl.classes:insert(kLightboxClass) + end + if (type(meta) == "table") then + if meta.group then + imgEl.attr.attributes.group = meta.group or imgEl.attr.attributes.group + end + for _, v in next, kForwardedAttr do + if type(meta[v]) == "table" and #meta[v] > 1 then + -- if list attributes it should be one per plot + if codeImgCount > #meta[v] then + quarto.log.warning("More plots than '" .. v .. "' passed in YAML chunk options.") + else + attrLb = meta[v][codeImgCount] + end + else + -- Otherwise reuse the single attributes + attrLb = meta[v] + end + imgEl.attr.attributes[v] = attrLb or imgEl.attr.attributes[v] + end + end + end + return imgEl + end + }) + if div then + div.attributes["lightbox"] = nil + end + end + return div + end, + Image = function(imgEl) + -- look only for explicitly targeted images + return processImg(imgEl, { automatic = false } ), false + end, + Figure = function(figEl) + return processFigure(figEl), false + end, + FloatRefTarget = function(floatEl) + + if floatEl.parent_id == nil then + local floatmodified = false + floatEl = _quarto.ast.walk(floatEl, { + traverse = 'topdown', + Image = function(imgEl) + local caption_content = floatEl.caption_long.content or floatEl.caption_long + local caption = full_caption_prefix(floatEl) + tappend(caption, caption_content) + local modifiedImg = processImg(imgEl, { automatic = true, caption = caption }) + if modifiedImg ~= nil then + floatmodified = true + end + return modifiedImg, false + end, + FloatRefTarget = function(subFloatEl) + if subFloatEl.parent_id ~= nil then + local subFloat = processSubFloat(subFloatEl, subFloatEl.parent_id, floatEl) + if subFloat ~= nil then + floatmodified = true + end + return subFloat, false + end + end, + Figure = function(figEl) + local modifiedFig = processFigure(figEl) + if modifiedFig ~= nil then + floatmodified = true + end + return modifiedFig, false + end + }) + + if floatmodified then + return floatEl, false + else + return nil, false + end + end + + + end, + }, + { + Meta = function(meta) + -- If we discovered lightbox-able images + -- we need to include the dependencies + if needsLightbox then + -- add the dependency + quarto.doc.add_html_dependency({ + name = 'glightbox', + scripts = {'../formats/html/glightbox/glightbox.min.js'}, + stylesheets = {'../formats/html/glightbox/glightbox.min.css', '../formats/html/glightbox/lightbox.css'} + }) + + -- read lightbox options + local lbMeta = meta.lightbox + local readEffect = function(el) + local val = pandoc.utils.stringify(el) + if val == "fade" or val == "zoom" or val == "none" then + return val + else + error("Invalid effect " + val) + end + end + + -- permitted options include: + -- lightbox: + -- effect: zoom | fade | none + -- desc-position: top | bottom | left |right + -- loop: true | false + -- class: + local effect = "zoom" + local descPosition = "bottom" + local loop = true + local skin = nil + + -- The selector controls which elements are targeted. + -- currently, it always targets .lightbox elements + -- and there is no way for the user to change this + local selector = "." .. kLightboxClass + + if lbMeta ~= nil and type(lbMeta) == 'table' then + if lbMeta.effect ~= nil then + effect = readEffect(lbMeta.effect) + end + + if lbMeta['desc-position'] ~= nil then + descPosition = pandoc.utils.stringify(lbMeta['desc-position']) + end + + if lbMeta['css-class'] ~= nil then + skin = pandoc.utils.stringify(lbMeta['css-class']) + end + + if lbMeta.loop ~= nil then + loop = lbMeta.loop + end + end + + -- Generate the options to configure lightbox + local options = { + selector = selector, + closeEffect = effect, + openEffect = effect, + descPosition = descPosition, + loop = loop, + } + if skin ~= nil then + options.skin = skin + end + local optionsJson = quarto.json.encode(options) + + -- generate the initialization script with the correct options + local scriptTag = "" + + -- inject the rendering code + quarto.doc.include_text("after-body", scriptTag) + + end + end + }} + else + return {} + end + +end + + diff --git a/src/resources/filters/layout/manuscript.lua b/src/resources/filters/layout/manuscript.lua index 0dcb7dbbc4a..86a8a222a52 100644 --- a/src/resources/filters/layout/manuscript.lua +++ b/src/resources/filters/layout/manuscript.lua @@ -14,19 +14,7 @@ function manuscriptUnroll() Div = function(divEl) -- If this is a markdown cell, we may need to unroll it if divEl.classes:includes("cell") and divEl.classes:includes("markdown") then - local blocks = pandoc.List() - for _, childBlock in ipairs(divEl.content) do - if childBlock.t == "Div" then - if fnSkip and not fnSkip(divEl) then - blocks:insert(childBlock) - else - tappend(blocks, childBlock.content) - end - else - blocks:insert(childBlock) - end - end - return blocks + return divEl.content end end } @@ -143,49 +131,23 @@ function manuscript() end local labelInlines = pandoc.List({ pandoc.Str(notebookPrefix), pandoc.Str(':'), pandoc.Space(), pandoc.Link(nbTitle, notebookUrl)}) + local did_resolve = false -- Attempt to forward the link into element captions, when possible local resolvedEl = _quarto.ast.walk(divEl, { - Div = function(el) - - -- Forward to figure div - if isFigureDiv(el) then - local last = el.content[#el.content] - if last and last.t == "Para" and #el.content > 1 then - labelInlines:insert(1, pandoc.Space()) - tappend(last.content, labelInlines) - else - return nil - end - return el - end - end, - - -- Forward to figure image - Para = function(el) - local image = discoverFigure(el) - if image and isFigureImage(image) then + FloatRefTarget = function(float) + if float.caption then + did_resolve = true labelInlines:insert(1, pandoc.Space()) - tappend(image.caption, labelInlines) - return el + tappend(float.caption, labelInlines) + return float end end, - - -- Forward to tables - Table = function(el) - if el.caption then - labelInlines:insert(1, pandoc.Space()) - tappend(el.caption, labelInlines) - return el - end - end }) - if resolvedEl then + if did_resolve then return resolvedEl - else - -- FIXME This is unreachable code, walk always returns a new element - + else -- We couldn't forward to caption, just place inline divEl.content:insert(pandoc.Subscript(labelInlines)) return divEl diff --git a/src/resources/filters/layout/pandoc3_figure.lua b/src/resources/filters/layout/pandoc3_figure.lua new file mode 100644 index 00000000000..24762b33ead --- /dev/null +++ b/src/resources/filters/layout/pandoc3_figure.lua @@ -0,0 +1,114 @@ +-- pandoc3_figure.lua +-- Copyright (C) 2023 Posit Software, PBC + +-- Figure nodes (from Pandoc3) can exist in our AST. They're +-- never cross-referenceable but they need to be rendered as +-- if they were. + +function render_pandoc3_figure() + local function html_handle_linked_image(figure) + local div = pandoc.Div({}) + div.identifier = "fig-yesiamafigure" -- this is a bad hack to make discoverLinkedFigureDiv work + local link = nil + if figure.content[1].t == "Plain" then + local plain = figure.content[1] + if plain.content[1].t == "Link" then + link = plain.content[1] + end + end + if link == nil then + return nil + end + div.content:insert(pandoc.Para({link})) + local pt = pandoc.utils.type(figure.caption.long) + if pt == "Blocks" or pt == "Inlines" then + div.content:insert(pandoc.Para(quarto.utils.as_inlines(figure.caption.long))) + elseif pt == "Inline" or pt == "Block" then + div.content:insert(pandoc.Para({figure.caption.long})) + else + internal_error() + end + local image = discoverLinkedFigureDiv(div) + if image == nil then + return nil + end + div.identifier = "" + return htmlDivFigure(div) + end + local function html_handle_image(figure) + local image + _quarto.ast.walk(figure, { + Image = function(img) + image = img + end + }) + if image == nil then + return figure + end + if figure.caption.long ~= nil then + image.caption = quarto.utils.as_inlines(figure.caption.long) + end + return htmlImageFigure(image) + end + + if _quarto.format.isHtmlOutput() then + return { + traverse = "topdown", + Figure = function(figure) + local result = html_handle_linked_image(figure) + if result ~= nil then + return result + end + return html_handle_image(figure) + end + } + elseif _quarto.format.isLatexOutput() then + return { + traverse = "topdown", + FloatRefTarget = function(float) + local count = 0 + _quarto.ast.walk(float.content, { + Figure = function() + count = count + 1 + end + }) + if count > 0 then + return nil, false + end + end, + Figure = function(figure) + local image + _quarto.ast.walk(figure, { + Image = function(img) + image = img + end + }) + if image == nil then + return figure + end + if figure.caption.long ~= nil then + image.caption = quarto.utils.as_inlines(figure.caption.long) + end + for k, v in pairs(figure.attributes) do + image.attributes[k] = v + end + image.classes:extend(figure.classes) + return latexImageFigure(image) + end + } + elseif _quarto.format.isTypstOutput() then + return { + traverse = "topdown", + Figure = function(figure) + return make_typst_figure({ + content = figure.content[1], + caption = figure.caption.long[1], + kind = "quarto-float-fig", + caption_location = crossref.categories.by_ref_type["fig"].default_caption_location, + supplement = "Figure", + }) + end + } + end + return {} +end diff --git a/src/resources/filters/layout/table.lua b/src/resources/filters/layout/table.lua index fd2339a82be..271f3307d43 100644 --- a/src/resources/filters/layout/table.lua +++ b/src/resources/filters/layout/table.lua @@ -8,7 +8,7 @@ function tablePanel(divEl, layout, caption, options) options = {} end -- outer panel to contain css and figure panel - local divId = divEl.attr.identifier + local divId = divEl.identifier if divId == nil then divId = '' end diff --git a/src/resources/filters/layout/typst.lua b/src/resources/filters/layout/typst.lua new file mode 100644 index 00000000000..6d7db2b26c9 --- /dev/null +++ b/src/resources/filters/layout/typst.lua @@ -0,0 +1,96 @@ +-- typst.lua +-- Copyright (C) 2023 Posit Software, PBC + +function make_typst_figure(tbl) + local content = tbl.content + local caption_location = tbl.caption_location + local caption = tbl.caption + local kind = tbl.kind + local supplement = tbl.supplement + local numbering = tbl.numbering + local identifier = tbl.identifier + + return pandoc.Blocks({ + pandoc.RawInline("typst", "#figure(["), + content, + pandoc.RawInline("typst", "], caption: figure.caption("), + pandoc.RawInline("typst", "position: " .. caption_location .. ", "), + pandoc.RawInline("typst", "["), + caption, + -- apparently typst doesn't allow separate prefix and name + pandoc.RawInline("typst", "]), "), + pandoc.RawInline("typst", "kind: \"" .. kind .. "\", "), + pandoc.RawInline("typst", supplement and ("supplement: \"" .. supplement .. "\", ") or ""), + pandoc.RawInline("typst", numbering and ("numbering: \"" .. numbering .. "\", ") or ""), + pandoc.RawInline("typst", ")"), + pandoc.RawInline("typst", identifier and ("<" .. identifier .. ">") or ""), + pandoc.RawInline("typst", "\n\n") + }) +end + +_quarto.ast.add_renderer("PanelLayout", function(_) + return _quarto.format.isTypstOutput() +end, function(layout) + if layout.float == nil then + fail_and_ask_for_bug_report("PanelLayout renderer requires a float in typst output") + return pandoc.Div({}) + end + + local ref = refType(layout.float.identifier) + local kind = "quarto-float-" .. ref + local info = crossref.categories.by_ref_type[ref] + if info == nil then + -- luacov: disable + warning("Unknown float type: " .. ref .. "\n Will emit without crossref information.") + return float.content + -- luacov: enable + end + + -- typst output currently only supports a single grid + -- as output, so no rows of varying columns, etc. + local n_cols = layout.attributes[kLayoutNcol] or "1" + + local typst_figure_content = pandoc.Div({}) + typst_figure_content.content:insert(pandoc.RawInline("typst", "#grid(columns: " .. n_cols .. ", gutter: 2em,\n")) + local is_first = true + _quarto.ast.walk(layout.float.content, { + FloatRefTarget = function(_, float_obj) + if is_first then + is_first = false + else + typst_figure_content.content:insert(pandoc.RawInline("typst", ",\n")) + end + typst_figure_content.content:insert(pandoc.RawInline("typst", " [")) + typst_figure_content.content:insert(float_obj) + typst_figure_content.content:insert(pandoc.RawInline("typst", "]")) + return nil + end + }) + typst_figure_content.content:insert(pandoc.RawInline("typst", ")\n")) + local result = pandoc.Blocks({}) + if layout.preamble then + result:insert(layout.preamble) + end + local caption_location = cap_location(layout.float) + + return make_typst_figure { + content = typst_figure_content, + caption_location = caption_location, + caption = layout.float.caption_long, + kind = kind, + supplement = info.prefix, + numbering = info.numbering, + identifier = layout.float.identifier + } + -- result:extend({ + -- pandoc.RawInline("typst", "\n\n#figure(["), + -- typst_figure_content, + -- pandoc.RawInline("typst", "], caption: ["), + -- layout.float.caption_long, + -- -- apparently typst doesn't allow separate prefix and name + -- pandoc.RawInline("typst", "], kind: \"" .. kind .. "\", supplement: \"" .. info.prefix .. "\""), + -- pandoc.RawInline("typst", ", caption-pos: " .. caption_location), + -- pandoc.RawInline("typst", ")<" .. layout.float.identifier .. ">\n\n") + -- }) + -- return result +end) diff --git a/src/resources/filters/layout/width.lua b/src/resources/filters/layout/width.lua index dce108e7b97..f83bc9d9d53 100644 --- a/src/resources/filters/layout/width.lua +++ b/src/resources/filters/layout/width.lua @@ -134,4 +134,13 @@ function transferImageWidthToCell(img, divEl) img.attributes["height"] = nil end +function transfer_float_image_width_to_cell(float, div_el) + local width_attr = float.attributes["width"] + div_el.attr.attributes["width"] = width_attr + if sizeToPercent(width_attr) then + float.attributes["width"] = nil + end + float.attributes["height"] = nil +end + diff --git a/src/resources/filters/main.lua b/src/resources/filters/main.lua index 7e4e17b6022..9c6030ed8c0 100644 --- a/src/resources/filters/main.lua +++ b/src/resources/filters/main.lua @@ -23,10 +23,12 @@ import("./ast/wrappedwriter.lua") import("./common/base64.lua") import("./common/citations.lua") import("./common/colors.lua") +import("./common/collate.lua") import("./common/debug.lua") import("./common/error.lua") import("./common/figures.lua") import("./common/filemetadata.lua") +import("./common/floats.lua") import("./common/format.lua") import("./common/latex.lua") import("./common/layout.lua") @@ -60,6 +62,7 @@ import("./quarto-post/fig-cleanup.lua") import("./quarto-post/foldcode.lua") import("./quarto-post/ipynb.lua") import("./quarto-post/latex.lua") +import("./quarto-post/typst.lua") import("./quarto-post/latexdiv.lua") import("./quarto-post/meta.lua") import("./quarto-post/ojs.lua") @@ -71,26 +74,26 @@ import("./quarto-post/pdf-images.lua") import("./quarto-post/cellcleanup.lua") import("./quarto-post/bibliography.lua") import("./quarto-post/code.lua") +import("./quarto-post/html.lua") import("./quarto-finalize/dependencies.lua") import("./quarto-finalize/book-cleanup.lua") import("./quarto-finalize/mediabag.lua") import("./quarto-finalize/meta-cleanup.lua") +import("./quarto-finalize/coalesceraw.lua") +import("./quarto-finalize/descaffold.lua") +import("./quarto-finalize/typst.lua") import("./normalize/flags.lua") import("./normalize/normalize.lua") import("./normalize/parsehtml.lua") -import("./normalize/pandoc3.lua") import("./normalize/extractquartodom.lua") +import("./normalize/astpipeline.lua") +import("./normalize/capturereaderstate.lua") -import("./layout/asciidoc.lua") import("./layout/meta.lua") import("./layout/width.lua") -import("./layout/latex.lua") -import("./layout/html.lua") import("./layout/wp.lua") -import("./layout/docx.lua") -import("./layout/jats.lua") import("./layout/odt.lua") import("./layout/pptx.lua") import("./layout/table.lua") @@ -98,16 +101,18 @@ import("./layout/figures.lua") import("./layout/cites.lua") import("./layout/columns.lua") import("./layout/manuscript.lua") +import("./layout/pandoc3_figure.lua") +import("./layout/lightbox.lua") import("./layout/columns-preprocess.lua") import("./layout/layout.lua") +import("./crossref/custom.lua") import("./crossref/index.lua") import("./crossref/preprocess.lua") import("./crossref/sections.lua") import("./crossref/figures.lua") import("./crossref/tables.lua") import("./crossref/equations.lua") -import("./crossref/listings.lua") import("./crossref/theorems.lua") import("./crossref/qmd.lua") import("./crossref/refs.lua") @@ -133,6 +138,7 @@ import("./quarto-pre/outputs.lua") import("./quarto-pre/panel-input.lua") import("./quarto-pre/panel-layout.lua") import("./quarto-pre/panel-sidebar.lua") +import("./quarto-pre/parsefiguredivs.lua") import("./quarto-pre/project-paths.lua") import("./quarto-pre/resourcefiles.lua") import("./quarto-pre/results.lua") @@ -143,11 +149,27 @@ import("./quarto-pre/table-colwidth.lua") import("./quarto-pre/table-rawhtml.lua") import("./quarto-pre/theorems.lua") +import("./layout/html.lua") +import("./layout/latex.lua") +import("./layout/docx.lua") +import("./layout/jats.lua") +import("./layout/asciidoc.lua") + +import("./customnodes/latexenv.lua") +import("./customnodes/latexcmd.lua") +import("./customnodes/htmltag.lua") import("./customnodes/shortcodes.lua") import("./customnodes/content-hidden.lua") import("./customnodes/decoratedcodeblock.lua") import("./customnodes/callout.lua") import("./customnodes/panel-tabset.lua") +import("./customnodes/floatreftarget.lua") + +import("./layout/confluence.lua") +import("./layout/ipynb.lua") +import("./layout/typst.lua") + +import("./quarto-init/metainit.lua") -- [/import] @@ -158,50 +180,47 @@ initShortcodeHandlers() -- see whether the cross ref filter is enabled local enableCrossRef = param("enable-crossref", true) -local quartoInit = { - { name = "init-configure-filters", filter = configure_filters() }, - { name = "init-read-includes", filter = read_includes() }, +local quarto_init_filters = { + { name = "init-quarto-meta-init", filter = quarto_meta_init() }, + { name = "init-quarto-custom-meta-init", filter = { + Meta = function(meta) + content_hidden_meta(meta) + end + }}, + -- FIXME this could probably be moved into the next combineFilters below, + -- in quartoNormalize { name = "init-metadata-resource-refs", filter = combineFilters({ file_metadata(), resourceRefs() })}, } -local quartoNormalize = { +-- v1.4 change: quartoNormalize is responsible for producing a +-- "normalized" document that is ready for quarto-pre, etc. +-- notably, user filters will run on the normalized document and +-- see a "Quarto AST". For example, Figure nodes are no longer +-- going to be present, and will instead be represented by +-- our custom AST infrastructure (FloatRefTarget specifically). + +local quarto_normalize_filters = { { name = "normalize", filter = filterIf(function() + if quarto_global_state.active_filters == nil then + return false + end return quarto_global_state.active_filters.normalization end, normalize_filter()) }, - { name = "pre-table-merge-raw-html", - filter = table_merge_raw_html() - }, - - { name = "pre-content-hidden-meta", - filter = content_hidden_meta() }, - - -- 2023-04-11: We want to combine these filters but parse_md_in_html_rawblocks - -- can't be combined with parse_html_tables because combineFilters - -- doesn't inspect the contents of the results in the inner loop. - { name = "normalize-combined", filter = combineFilters({ - parse_html_tables(), - parse_extended_nodes(), - }) - }, - { - name = "normalize-extractQuartoDom", - filter = parse_md_in_html_rawblocks(), - }, + { name = "normalize-capture-reader-state", filter = normalize_capture_reader_state() } } -local quartoPre = { +tappend(quarto_normalize_filters, quarto_ast_pipeline()) + +local quarto_pre_filters = { -- quarto-pre -- TODO we need to compute flags on the results of the user filters { name = "pre-run-user-filters", filters = make_wrapped_user_filters("beforeQuartoFilters") }, - -- do this early so we can compute maxHeading while in the big traversal - { name = "crossref-init-crossref-options", filter = init_crossref_options() }, - { name = "flags", filter = compute_flags() }, -- https://github.com/quarto-dev/quarto-cli/issues/5031 @@ -210,21 +229,12 @@ local quartoPre = { -- when they mutate options { name = "pre-read-options-again", filter = init_options() }, - { name = "pre-parse-pandoc3-figures", - filter = parse_pandoc3_figures(), - flags = { "has_pandoc3_figure" } - }, - { name = "pre-bibliography-formats", filter = bibliography_formats() }, { name = "pre-shortcodes-filter", filter = shortcodes_filter(), flags = { "has_shortcodes" } }, - { name = "pre-table-colwidth-cell", - filter = table_colwidth_cell(), - flags = { "has_tbl_colwidths" } }, - { name = "pre-hidden", filter = hidden(), flags = { "has_hidden" } }, @@ -264,7 +274,6 @@ local quartoPre = { quarto_pre_figures(), quarto_pre_theorems(), docx_callout_and_table_fixup(), - code_filename(), engine_escape(), line_numbers(), bootstrap_panel_input(), @@ -282,7 +291,7 @@ local quartoPre = { { name = "pre-write-results", filter = write_results() }, } -local quartoPost = { +local quarto_post_filters = { -- quarto-post { name = "post-cell-cleanup", filter = cell_cleanup(), @@ -290,7 +299,6 @@ local quartoPost = { { name = "post-cites", filter = indexCites() }, { name = "post-foldCode", filter = foldCode() }, { name = "post-bibliography", filter = bibliography() }, - { name = "post-ipynb", filter = ipynbCode()}, { name = "post-ipynb", filter = ipynb()}, { name = "post-figureCleanupCombined", filter = combineFilters({ latexDiv(), @@ -321,15 +329,18 @@ local quartoPost = { { name = "post-render-asciidoc", filter = render_asciidoc() }, { name = "post-render-latex", filter = render_latex() }, { name = "post-render-docx", filter = render_docx() }, + { name = "post-render-typst", filter = render_typst() }, -- extensible rendering { name = "post-render_extended_nodes", filter = render_extended_nodes() }, - { name = "post-render-pandoc-3-figures", filter = render_pandoc3_figures() }, + -- format fixups post rendering + { name = "post-render-html-fixups", filter = render_html_fixups() }, + { name = "post-userAfterQuartoFilters", filters = make_wrapped_user_filters("afterQuartoFilters") }, } -local quartoFinalize = { +local quarto_finalize_filters = { -- quarto-finalize { name = "finalize-fileMetadataAndMediabag", filter = combineFilters({ @@ -341,32 +352,30 @@ local quartoFinalize = { { name = "finalize-cites", filter = writeCites() }, { name = "finalize-metaCleanup", filter = metaCleanup() }, { name = "finalize-dependencies", filter = dependencies() }, - { name = "finalize-wrapped-writer", filter = wrapped_writer() } + { name = "finalize-coalesce-raw", filters = coalesce_raw() }, + { name = "finalize-descaffold", filter = descaffold() }, + { name = "finalize-wrapped-writer", filter = wrapped_writer() }, + { name = "finalize-typst-state", filter = setup_typst_state() } } -local quartoLayout = { +local quarto_layout_filters = { { name = "manuscript filtering", filter = manuscript() }, { name = "manuscript filtering", filter = manuscriptUnroll() }, + { name = "layout-lightbox", filters = lightbox(), flags = { "has_lightbox" }}, + { name = "layout-render-pandoc3-figure", filter = render_pandoc3_figure(), + flags = { "has_pandoc3_figure" } }, { name = "layout-columns-preprocess", filter = columns_preprocess() }, { name = "layout-columns", filter = columns() }, { name = "layout-cites-preprocess", filter = cites_preprocess() }, { name = "layout-cites", filter = cites() }, - { name = "layout-panels", filter = layout_panels(), flags = - { "has_layout_attributes", "has_tbl_parent" } }, - { name = "layout-extended-figures", filter = extended_figures(), flags = - { "has_discoverable_figures", "has_figure_divs"} }, + { name = "layout-panels", filter = layout_panels() }, { name = "layout-meta-inject-latex-packages", filter = layout_meta_inject_latex_packages() } } -local quartoCrossref = { +local quarto_crossref_filters = { - { name = "crossref-preprocess", filter = crossref_preprocess(), - flags = { - "has_figure_or_table_ref", - "has_discoverable_figures", - "has_table_with_long_captions", - "has_latex_table_captions" - } }, + { name = "crossref-preprocess-floats", filter = crossref_mark_subfloats(), + }, { name = "crossref-preprocessTheorems", filter = crossref_preprocess_theorems(), @@ -377,9 +386,7 @@ local quartoCrossref = { qmd(), sections(), crossref_figures(), - crossref_tables(), equations(), - listings(), crossref_theorems(), })}, @@ -392,15 +399,15 @@ local quartoCrossref = { local filterList = {} -tappend(filterList, quartoInit) -tappend(filterList, quartoNormalize) -tappend(filterList, quartoPre) +tappend(filterList, quarto_init_filters) +tappend(filterList, quarto_normalize_filters) +tappend(filterList, quarto_pre_filters) if enableCrossRef then - tappend(filterList, quartoCrossref) + tappend(filterList, quarto_crossref_filters) end -tappend(filterList, quartoLayout) -tappend(filterList, quartoPost) -tappend(filterList, quartoFinalize) +tappend(filterList, quarto_layout_filters) +tappend(filterList, quarto_post_filters) +tappend(filterList, quarto_finalize_filters) local result = run_as_extended_ast({ pre = { diff --git a/src/resources/filters/mainstateinit.lua b/src/resources/filters/mainstateinit.lua index 244796ea24c..8c0bf1aec57 100644 --- a/src/resources/filters/mainstateinit.lua +++ b/src/resources/filters/mainstateinit.lua @@ -14,7 +14,8 @@ quarto_global_state = { file = nil, appendix = false, fileSectionIds = {}, - emulatedNodeHandlers = {} + emulatedNodeHandlers = {}, + reader_options = {} } crossref = { @@ -22,5 +23,65 @@ crossref = { startAppendix = nil, -- initialize autolabels table - autolabels = pandoc.List() + autolabels = pandoc.List(), + + -- store a subfloat index to be able to lookup by id later. + subfloats = {}, + + -- kinds are "float", "block", "inline", "anchor" + categories = { + all = { + { + default_caption_location = "bottom", + kind = "float", + name = "Figure", + prefix = "Figure", + latex_env = "figure", + ref_type = "fig", + }, + { + default_caption_location = "top", + kind = "float", + name = "Table", + prefix = "Table", + latex_env = "table", + ref_type = "tbl", + }, + { + default_caption_location = "top", + kind = "float", + name = "Listing", + prefix = "Listing", + latex_env = "codelisting", + ref_type = "lst", + } + } + + -- eventually we'll have block kinds here + -- with callouts + theorem envs + + -- eventually we'll have inline kinds here + -- with equation refs + + -- eventually we'll have anchor kinds here + -- with section/chapter/slide refs, etc + } } + + +-- set up crossref category indices +function setup_crossref_category_indices() + crossref.categories.by_ref_type = {} + crossref.categories.by_name = {} + for _, category in ipairs(crossref.categories.all) do + crossref.categories.by_ref_type[category.ref_type] = category + crossref.categories.by_name[category.name] = category + end +end + +function add_crossref_category(category) + table.insert(crossref.categories.all, category) + setup_crossref_category_indices() +end + +setup_crossref_category_indices() \ No newline at end of file diff --git a/src/resources/filters/modules/authors.lua b/src/resources/filters/modules/authors.lua index ad4f15c223f..4392d3cec69 100644 --- a/src/resources/filters/modules/authors.lua +++ b/src/resources/filters/modules/authors.lua @@ -33,23 +33,33 @@ local kAuthors = "authors" -- Funding placeholders -- Normalized into: -- funding: --- - id: string (optional) --- statement: string (optional) +-- - statement: -- open-access: string (optional) --- source: --- - { text } & { country? } --- investigator: --- - { text } | { name } | { insitution } --- recipient: --- - { text } | { name } | { insitution } +-- awards: + -- - id: string (optional) + -- name: string (optional) + -- description: string (optional) + -- source: + -- - string | { country, type } & text | { institution } + -- investigator: + -- - { text } | { name } + -- recipient: + -- - { text } | { name } | { institution } + +-- add support for instition DOI in addition to ringgold/isni, etc... local kFunding = "funding" -local kAwardId = 'id' +local kAwards = "awards" +local kAwardId = "id" +local kAwardName = "name" +local kAwardDesc = "description" local kSource = "source" +local kSourceType = "type" local kStatement = "statement" local kOpenAccess = "open-access" local kRecipient = "recipient" local kInvestigator = "investigator" + -- Properties that may appear on an individual author local kId = 'id' local kName = 'name' @@ -477,21 +487,21 @@ end -- Normalizes a value that could be either a plain old markdown string, -- a name, or an affiliation -local function processNameOrInstitutionObj(keyName, valueRaw, authors, affiliations) +local function processNameOrInstitutionObj(keyName, valueRaw, authors, affiliations, optional) if (pandoc.utils.type(valueRaw) == 'Inlines') then return { text = valueRaw } else if valueRaw.name ~= nil then return { name = toName(valueRaw.name) } elseif valueRaw.institution ~= nil then - return { institition = processAffilationObj(valueRaw.institution) } + return { institution = processAffilationObj(valueRaw.institution) } elseif valueRaw.ref ~= nil then local refStr = pandoc.utils.stringify(valueRaw.ref) -- discover the reference (could be author or affiliation) local affiliation = findAffiliation({{ text = refStr }}, affiliations) if affiliation then - return { institition = affiliation } + return { institution = affiliation } else local author = findAuthor(refStr, authors) if author then @@ -501,39 +511,46 @@ local function processNameOrInstitutionObj(keyName, valueRaw, authors, affiliati end end else - fail("Invalid value for " .. keyName) + if not optional then + fail("Invalid value for " .. keyName) + end end end end -local function processNameOrInstitution(keyName, values, authors, affiliations) +local function processNameOrInstitution(keyName, values, authors, affiliations, optional) if values ~= nil then local pandocType = pandoc.utils.type(values) if pandocType == "List" then local results = pandoc.List() for i, value in ipairs(values) do - results:insert(processNameOrInstitutionObj(keyName, value, authors, affiliations)) + local resolved = processNameOrInstitutionObj(keyName, value, authors, affiliations, optional) + if resolved ~= nil then + results:insert(resolved) + end end return results else - return { processNameOrInstitutionObj(values, values, authors, affiliations) } + local resolved = processNameOrInstitutionObj(keyName, values, authors, affiliations, optional) + if resolved ~= nil then + return { resolved } + end end else return {} end end -local function processSources(sourceRaw) +local function processSources(sourceRaw, authors, affiliations) local pandocType = pandoc.utils.type(sourceRaw) if pandocType == 'Inlines' then return {{ text = sourceRaw }} else - local result = pandoc.List() - for i, value in ipairs(sourceRaw) do - if pandoc.utils.type(value) == 'Inlines' then - result:insert({ text = value}) - else - result:insert(value) + local result = processNameOrInstitution(kSource, sourceRaw, authors, affiliations, true) + for i, key in ipairs({ kCountry, kSourceType }) do + local valueRaw = sourceRaw[key] + if valueRaw ~= nil then + result[key] = valueRaw end end return result @@ -541,35 +558,76 @@ local function processSources(sourceRaw) end -- Normalizes an indivudal funding entry -local function processFundingAward(fundingAward, authors, affiliations) - if pandoc.utils.type(fundingAward) == 'table' then +local function processFundingGroup(fundingGroup, authors, affiliations) + if pandoc.utils.type(fundingGroup) == 'table' then + + -- awards -- this is a table of properties, process them local result = {} - -- process the simple values - for i, key in ipairs({ kAwardId, kStatement, kOpenAccess }) do - local valueRaw = fundingAward[key] - if valueRaw ~= nil then - result[key] = valueRaw + -- statement + local statement = fundingGroup[kStatement]; + if statement ~= nil then + if pandoc.utils.type(statement) == "Block" then + result[kStatement] = pandoc.utils.blocks_to_inlines({statement}) + elseif pandoc.utils.type(statement) == "Blocks" then + result[kStatement] = pandoc.utils.blocks_to_inlines(statement) + else + result[kStatement] = statement end end - -- Process the funding source - local sourceRaw = fundingAward[kSource] - if sourceRaw ~= nil then - result[kSource] = processSources(sourceRaw) + -- open-access (must be a block so it emits a p) + local openAccess = fundingGroup[kOpenAccess]; + if openAccess ~= nil then + if pandoc.utils.type(openAccess) == "Inlines" then + result[kOpenAccess] = pandoc.Para(openAccess) + else + result[kOpenAccess] = openAccess + end end - -- Process recipients - local recipientRaw = fundingAward[kRecipient] - if recipientRaw ~= nil then - result[kRecipient] = processNameOrInstitution(kRecipient, recipientRaw, authors, affiliations) + -- process any awards + local awardsRaw = fundingGroup[kAwards]; + if pandoc.utils.type(awardsRaw) ~= "List" then + awardsRaw = pandoc.List({awardsRaw}) + end + + local awards = pandoc.List({}) + for i, awardRaw in ipairs(awardsRaw) do + local award = {}; + + -- award-id, name, description + for i, key in ipairs({ kAwardId, kAwardName, kAwardDesc }) do + local valueRaw = awardRaw[key] + if valueRaw ~= nil then + award[key] = valueRaw + end + end + + -- Process the funding source + local sourceRaw = awardRaw[kSource] + if sourceRaw ~= nil then + award[kSource] = processSources(sourceRaw, authors, affiliations) + end + + -- Process recipients + local recipientRaw = awardRaw[kRecipient] + if recipientRaw ~= nil then + award[kRecipient] = processNameOrInstitution(kRecipient, recipientRaw, authors, affiliations) + end + + local investigatorRaw = awardRaw[kInvestigator] + if investigatorRaw ~= nil then + award[kInvestigator] = processNameOrInstitution(kInvestigator, investigatorRaw, authors, affiliations) + end + + awards:insert(award) end - local investigatorRaw = fundingAward[kInvestigator] - if investigatorRaw ~= nil then - result[kInvestigator] = processNameOrInstitution(kInvestigator, investigatorRaw, authors, affiliations) + if next(awards) ~= nil then + result[kAwards] = awards end return result @@ -1093,10 +1151,10 @@ local function processAuthorMeta(meta) end - for i,fundingAward in ipairs(fundingRaw) do - local normalizedAward = processFundingAward(fundingAward, authors, affiliations) - if normalizedAward then - funding[i] = normalizedAward + for i,fundingGroup in ipairs(fundingRaw) do + local normalizedFundingGroup = processFundingGroup(fundingGroup, authors, affiliations) + if normalizedFundingGroup then + funding[i] = normalizedFundingGroup end end end diff --git a/src/resources/filters/modules/license.lua b/src/resources/filters/modules/license.lua index aac6e751035..4741e9003ec 100644 --- a/src/resources/filters/modules/license.lua +++ b/src/resources/filters/modules/license.lua @@ -45,6 +45,18 @@ local licenses = { return ccLicenseUrl("by-nc", lang, version) end }, + ["cc by-nc-sa"] = { + type = "creative-commons", + licenseUrl = function (lang, version) + return ccLicenseUrl("by-nc-sa", lang, version) + end + }, + ["cc by-nc-nd"] = { + type = "creative-commons", + licenseUrl = function (lang, version) + return ccLicenseUrl("by-nc-nd", lang, version) + end + }, } local function parseCCLicense(license) @@ -168,4 +180,3 @@ return { copyright = constants.kCopyright } } - diff --git a/src/resources/filters/modules/lightbox.lua b/src/resources/filters/modules/lightbox.lua new file mode 100644 index 00000000000..563047444f7 --- /dev/null +++ b/src/resources/filters/modules/lightbox.lua @@ -0,0 +1,46 @@ +-- lightbox.lua +-- Copyright (C) 2020-2022 Posit Software, PBC + + +local function lightbox_auto(meta) + -- If the mode is auto, we need go ahead and + -- run if there are any images (ideally we would) + -- filter to images in the body, but that can be + -- left for future me to deal with + -- supports: + -- lightbox: true + -- lightbox: auto + -- or + -- lightbox: + -- match: auto + local lbMeta = meta.lightbox + if lbMeta ~= nil and type(lbMeta) == 'table' then + if lbMeta[1] ~= nil then + if lbMeta[1]['text'] == "auto" then + return true + end + elseif lbMeta.match ~= nil and pandoc.utils.stringify(lbMeta.match) == 'auto' then + return true + end + elseif lbMeta == true then + return true + elseif lbMeta == false then + return false + end + -- return nil so caller can know the difference between + -- explicitly off and omitted + return nil +end + +local function el_has_lightbox(el) + + local has_lightbox = el.attributes["lightbox"] ~= nil or el.classes:includes('lightbox') + return has_lightbox +end + +return { + automatic = lightbox_auto, + el_has_lightbox = el_has_lightbox +} + + diff --git a/src/resources/filters/modules/patterns.lua b/src/resources/filters/modules/patterns.lua index 0b922716dab..a8818ad73a7 100644 --- a/src/resources/filters/modules/patterns.lua +++ b/src/resources/filters/modules/patterns.lua @@ -15,6 +15,13 @@ local html_paged_table = ""); - - # don't emit HTML output in PDF formats. (#2334) - if (knitr:::is_html_output(quarto_format$pandoc$to)) { - invisible(knitr:::knit_meta_add(list(structure(class="ojs-define", script_string)))) - } - } -), name = "tools:quarto") - - - + list(name = nm, value = val) + }, quos, nm, vars, + SIMPLIFY = FALSE, USE.NAMES = FALSE + ))), + dataframe = "columns", null = "null", na = "null", auto_unbox = TRUE + ) + script_string <- c( + "" + ) + invisible( + knitr::knit_meta_add( + list(structure(class = "ojs-define", script_string)) + ) + ) +} diff --git a/src/resources/schema/cell-codeoutput.yml b/src/resources/schema/cell-codeoutput.yml index 3518fb7b797..8cf012c1c99 100644 --- a/src/resources/schema/cell-codeoutput.yml +++ b/src/resources/schema/cell-codeoutput.yml @@ -28,8 +28,8 @@ long: | Include cell source code in rendered output. - - `true` (default): include source code in output - - `false`: do not include source code in output + - `true` (default in most formats): include source code in output + - `false` (default in presentation formats like `beamer`, `revealjs`, and `pptx`): do not include source code in output - `fenced`: in addition to echoing, include the cell delimiter as part of the output. - `[...]`: A list of positive or negative line numbers to selectively include or exclude lines (explicit inclusion/excusion of lines is available only when using the knitr engine) @@ -117,7 +117,10 @@ - name: tidy tags: engine: knitr - schema: boolean + schema: + anyOf: + - boolean + - enum: [styler, formatR] default: false description: "Whether to reformat R code." diff --git a/src/resources/schema/definitions.yml b/src/resources/schema/definitions.yml index dce9ec057a5..4d7381a9c61 100644 --- a/src/resources/schema/definitions.yml +++ b/src/resources/schema/definitions.yml @@ -1022,7 +1022,7 @@ schema: anyOf: - boolean - - ref: other-links + - ref: code-links-schema tags: formats: [$html-doc] description: "A list of codes links to appear with this document." @@ -2235,6 +2235,31 @@ description: "The url to use when downloading the notebook from the preview" required: [notebook] +- id: code-links-schema + schema: + anyOf: + - boolean + - maybeArrayOf: + anyOf: + - object: + properties: + icon: + string: + description: The bootstrap icon for this code link. + text: + string: + description: The text for this code link. + href: + string: + description: The href for this code link. + rel: + string: + description: The rel used in the `a` tag for this code link. + target: + string: + description: The target used in the `a` tag for this code link. + - enum: ["repo", "binder", "devcontainer"] + - id: manuscript-schema schema: object: @@ -2244,12 +2269,9 @@ path: description: "The input document that will serve as the root document for this manuscript" "code-links": - anyOf: - - boolean - - maybeArrayOf: - anyOf: - - object - - string + schema: + ref: code-links-schema + description: "Code links to display for this manuscript." "manuscript-url": string: description: "The deployed url for this manuscript" diff --git a/src/resources/schema/document-attributes.yml b/src/resources/schema/document-attributes.yml index aa5720a8125..0d09f77b4e6 100644 --- a/src/resources/schema/document-attributes.yml +++ b/src/resources/schema/document-attributes.yml @@ -5,7 +5,7 @@ - name: subtitle schema: string tags: - formats: [$pdf-all, $html-all, context, muse, odt] + formats: [$pdf-all, $html-all, context, muse, odt, docx] description: "Identifies the subtitle of the document." - name: date @@ -102,13 +102,14 @@ context, ms, odt, + docx, ] description: "Summary of document" - name: abstract-title schema: string tags: - formats: [$html-doc, $epub-all] + formats: [$html-doc, $epub-all, docx] description: "Title used to label document abstract" - name: notes diff --git a/src/resources/schema/document-colors.yml b/src/resources/schema/document-colors.yml index a459fe6dfc0..0092edfb5b1 100644 --- a/src/resources/schema/document-colors.yml +++ b/src/resources/schema/document-colors.yml @@ -26,6 +26,12 @@ formats: [html, html4, html5, slidy, slideous, s5, dzslides] description: Sets the CSS `background-color` property on code elements and adds extra padding. +- name: monoforegroundcolor + schema: string + tags: + formats: [html, html4, html5, slidy, slideous, s5, dzslides] + description: Sets the CSS `color` property on code elements and adds extra padding. + - name: backgroundcolor schema: string tags: diff --git a/src/resources/schema/document-crossref.yml b/src/resources/schema/document-crossref.yml index cd5a2bf4406..e12d3c31de4 100644 --- a/src/resources/schema/document-crossref.yml +++ b/src/resources/schema/document-crossref.yml @@ -6,6 +6,30 @@ - object: closed: true properties: + custom: + arrayOf: + object: + description: A custom cross reference type. + closed: true + properties: + kind: + enum: [float] + description: The kind of cross reference (currently only "float" is supported). + prefix: + string: + description: The prefix used in rendered citations when referencing this type. + name: + string: + description: The prefix used in captions when referencing this type. + ref-type: + string: + description: The prefix string used in references ("dia-", etc.) when referencing this type. + latex-env: + string: + description: The name of the custom LaTeX environment that quarto will use to create this type of crossreferenceable object in LaTeX output. + latex-list-of-name: + string: + description: The name of the custom LaTeX "list of" command that quarto will use to create this type of crossreferenceable object in LaTeX output. chapters: boolean: description: Use top level sections (H1) in this document as chapters. diff --git a/src/resources/schema/document-funding.yml b/src/resources/schema/document-funding.yml index 521b6276acf..64bc510800d 100644 --- a/src/resources/schema/document-funding.yml +++ b/src/resources/schema/document-funding.yml @@ -6,83 +6,93 @@ - object: closed: true properties: - id: - string: - description: Unique identifier assigned to an award, contract, or grant. statement: string: description: Displayable prose statement that describes the funding for the research on which a work was based. open-access: string: description: Open access provisions that apply to a work or the funding information that provided the open access provisions. - source: - maybeArrayOf: - anyOf: - - string - - object: - closed: true - properties: - text: - string: - description: The text describing the source of the funding. - country: - string: - description: - short: Abbreviation for country where source of grant is located. - long: | - Abbreviation for country where source of grant is located. - Whenever possible, ISO 3166-1 2-letter alphabetic codes should be used. - description: Agency or organization that funded the research on which a work was based. - recipient: - maybeArrayOf: - anyOf: - - string - - object: - closed: true - properties: - ref: - string: - description: The id of an author or affiliation in the document metadata. - - object: - closed: true - properties: - name: - string: - description: The name of an individual that was the recipient of the funding. - - object: - closed: true - properties: - institution: - anyOf: - - string - - object - description: The institution that was the recipient of the funding. - description: Individual(s) or institution(s) to whom the award was given (for example, the principal grant holder or the sponsored individual). - investigator: + awards: maybeArrayOf: - anyOf: - - string - - object: - closed: true - properties: - ref: - string: - description: The id of an author or affiliation in the document metadata. - - object: - closed: true - properties: - name: - string: - description: The name of an individual that was responsible for the intellectual content of the work reported in the document. - - object: - closed: true - properties: - institution: - anyOf: - - string - - object - description: The institution that was responsible for the intellectual content of the work reported in the document. - description: Individual(s) responsible for the intellectual content of the work reported in the document. + object: + properties: + id: + string: + description: Unique identifier assigned to an award, contract, or grant. + name: + string: + description: The name of this award + description: + string: + description: The description for this award. + source: + maybeArrayOf: + anyOf: + - string + - object: + closed: true + properties: + text: + string: + description: The text describing the source of the funding. + country: + string: + description: + short: Abbreviation for country where source of grant is located. + long: | + Abbreviation for country where source of grant is located. + Whenever possible, ISO 3166-1 2-letter alphabetic codes should be used. + description: Agency or organization that funded the research on which a work was based. + recipient: + maybeArrayOf: + anyOf: + - string + - object: + closed: true + properties: + ref: + string: + description: The id of an author or affiliation in the document metadata. + - object: + closed: true + properties: + name: + string: + description: The name of an individual that was the recipient of the funding. + - object: + closed: true + properties: + institution: + anyOf: + - string + - object + description: The institution that was the recipient of the funding. + description: Individual(s) or institution(s) to whom the award was given (for example, the principal grant holder or the sponsored individual). + investigator: + maybeArrayOf: + anyOf: + - string + - object: + closed: true + properties: + ref: + string: + description: The id of an author or affiliation in the document metadata. + - object: + closed: true + properties: + name: + string: + description: The name of an individual that was responsible for the intellectual content of the work reported in the document. + - object: + closed: true + properties: + institution: + anyOf: + - string + - object + description: The institution that was responsible for the intellectual content of the work reported in the document. + description: Individual(s) responsible for the intellectual content of the work reported in the document. description: | Information about the funding of the research reported in the article (for example, grants, contracts, sponsors) and any open access fees for the article itself diff --git a/src/resources/schema/document-lightbox.yml b/src/resources/schema/document-lightbox.yml new file mode 100644 index 00000000000..9bc3d7f8268 --- /dev/null +++ b/src/resources/schema/document-lightbox.yml @@ -0,0 +1,32 @@ +- name: lightbox + schema: + anyOf: + - boolean + - enum: ["auto"] + - object: + closed: true + properties: + match: + schema: + enum: ["auto"] + description: + short: Set this to `auto` if you'd like any image to be given lightbox treatment. + long: | + Set this to `auto` if you'd like any image to be given lightbox treatment. If you omit this, only images with the class `lightbox` will be given the lightbox treatment. + effect: + schema: + enum: ["fade", "zoom", "none"] + description: The effect that should be used when opening and closing the lightbox. One of `fade`, `zoom`, `none`. Defaults to `zoom`. + desc-position: + schema: + enum: ["top", "bottom", "left", "right"] + description: The position of the title and description when displaying a lightbox. One of `top`, `bottom`, `left`, `right`. Defaults to `bottom`. + loop: + boolean: + description: Whether galleries should 'loop' to first image in the gallery if the user continues past the last image of the gallery. Boolean that defaults to `true`. + css-class: + string: + description: A class name to apply to the lightbox to allow css targeting. This will replace the lightbox class with your custom class name. + tags: + formats: [$html-doc] + description: Enable or disable lightbox treatment for images in this document. diff --git a/src/resources/schema/document-links.yml b/src/resources/schema/document-links.yml index 759c7f97b97..6a41a218b5d 100644 --- a/src/resources/schema/document-links.yml +++ b/src/resources/schema/document-links.yml @@ -81,7 +81,7 @@ schema: anyOf: - enum: [false] - - ref: other-links + - ref: code-links-schema description: "A list of links that should be displayed below the table of contents in an `Code Links` section." - name: notebook-subarticles diff --git a/src/resources/schema/document-metadata.yml b/src/resources/schema/document-metadata.yml index dfdafec565e..b8491b1278f 100644 --- a/src/resources/schema/document-metadata.yml +++ b/src/resources/schema/document-metadata.yml @@ -2,19 +2,19 @@ schema: maybeArrayOf: string tags: - formats: [$asciidoc-all, $html-files, $pdf-all, context] + formats: [$asciidoc-all, $html-files, $pdf-all, context, odt, $office-all] description: "List of keywords to be included in the document metadata." - name: subject schema: string tags: - formats: [$pdf-all, $office-all] + formats: [$pdf-all, $office-all, odt] description: "The document subject" - name: description schema: string tags: - formats: [$office-all] + formats: [odt, $office-all] description: "The document description. Some applications show this as `Comments` metadata." - name: category @@ -69,7 +69,7 @@ long: | The license for this document, if any. - Creative Commons licenses `CC BY`, `CC BY-SA`, `CC BY-ND`, `CC BY-NC` will automatically generate a license link + Creative Commons licenses `CC BY`, `CC BY-SA`, `CC BY-ND`, `CC BY-NC`, `CC BY-NC-SA`, and `CC BY-NC-ND` will automatically generate a license link in the document appendix. Other license text will be placed in the appendix verbatim. - name: title-meta diff --git a/src/resources/types/schema-types.ts b/src/resources/types/schema-types.ts index 9e5f618e4d0..41fefe6c490 100644 --- a/src/resources/types/schema-types.ts +++ b/src/resources/types/schema-types.ts @@ -406,7 +406,7 @@ The user’s cookie preferences will automatically control Google Analytics (if | boolean | TwitterCardConfig /* Publish twitter card metadata */; "other-links"?: OtherLinks; - "code-links"?: boolean | OtherLinks; + "code-links"?: boolean | CodeLinksSchema; comments?: Comments; description?: string /* Website description */; favicon?: string /* The path to the favicon for this website */; @@ -1168,8 +1168,20 @@ export type NotebookViewSchema = { url?: string; /* The url to use when viewing this notebook. */ }; +export type CodeLinksSchema = + | boolean + | MaybeArrayOf< + ({ + href?: string /* The href for this code link. */; + icon?: string /* The bootstrap icon for this code link. */; + rel?: string /* The rel used in the `a` tag for this code link. */; + text?: string /* The text for this code link. */; + target?: string; /* The target used in the `a` tag for this code link. */ + } | ("repo" | "binder" | "devcontainer")) + >; + export type ManuscriptSchema = { - "code-links"?: boolean | MaybeArrayOf<(SchemaObject | string)>; + "code-links"?: CodeLinksSchema; "manuscript-url"?: string /* The deployed url for this manuscript */; "meca-bundle"?: | boolean diff --git a/src/vendor/cdn.skypack.dev/-/fontoxpath@v3.29.1-a0ohYsVP957eLX7RfgAa/dist=es2019,mode=imports/optimized/fontoxpath.js b/src/vendor/cdn.skypack.dev/-/fontoxpath@v3.29.1-a0ohYsVP957eLX7RfgAa/dist=es2019,mode=imports/optimized/fontoxpath.js new file mode 100644 index 00000000000..b3cd1aa7a6c --- /dev/null +++ b/src/vendor/cdn.skypack.dev/-/fontoxpath@v3.29.1-a0ohYsVP957eLX7RfgAa/dist=es2019,mode=imports/optimized/fontoxpath.js @@ -0,0 +1,9976 @@ +import * as xspattern from "/-/xspattern@v3.1.0-ChOssaTvtX8cZQgPaNnM/dist=es2019,mode=imports/optimized/xspattern.js"; +import * as prsc from "/-/prsc@v4.0.0-yiYip3qo0YwPataeg654/dist=es2019,mode=imports/optimized/prsc.js"; +const fontoxpath = function(xspattern2, prsc2) { + const VERSION = "3.29.1"; + const fontoxpathGlobal = {}; + function aa(a, b) { + if (!(a !== "0" && a !== "-0" || b !== "0" && b !== "-0")) + return 0; + var c = /(?:\+|(-))?(\d+)?(?:\.(\d+))?/; + a = c.exec(a + ""); + var d = c.exec(b + ""), e = !a[1]; + const f = !d[1]; + b = (a[2] || "").replace(/^0*/, ""); + c = (d[2] || "").replace(/^0*/, ""); + a = a[3] || ""; + d = d[3] || ""; + if (e && !f) + return 1; + if (!e && f) + return -1; + e = e && f; + if (b.length > c.length) + return e ? 1 : -1; + if (b.length < c.length) + return e ? -1 : 1; + if (b > c) + return e ? 1 : -1; + if (b < c) + return e ? -1 : 1; + b = Math.max(a.length, d.length); + c = a.padEnd(b, "0"); + b = d.padEnd(b, "0"); + return c > b ? e ? 1 : -1 : c < b ? e ? -1 : 1 : 0; + } + function ca(a, b) { + a = a.toString(); + if (-1 < a.indexOf(".") && b === 0) + return false; + a = /^[-+]?0*([1-9]\d*)?(?:\.((?:\d*[1-9])*)0*)?$/.exec(a); + return a[2] ? a[2].length <= b : true; + } + function ea() { + return function(a, b) { + return 1 > aa(a, b); + }; + } + function fa() { + return function(a, b) { + return 0 > aa(a, b); + }; + } + function ha() { + return function(a, b) { + return -1 < aa(a, b); + }; + } + function ia() { + return function(a, b) { + return 0 < aa(a, b); + }; + } + function ja(a, b) { + switch (b) { + case "required": + return /(Z)|([+-])([01]\d):([0-5]\d)$/.test(a.toString()); + case "prohibited": + return !/(Z)|([+-])([01]\d):([0-5]\d)$/.test(a.toString()); + case "optional": + return true; + } + } + function ka(a) { + switch (a) { + case 1: + case 0: + case 6: + case 3: + return {}; + case 4: + return {ka: ca, ua: ea(), lc: fa(), va: ha(), mc: ia()}; + case 18: + return {}; + case 9: + case 8: + case 7: + case 11: + case 12: + case 13: + case 15: + case 14: + return {Aa: ja}; + case 22: + case 21: + case 20: + case 23: + case 44: + return {}; + default: + return null; + } + } + var la = {}, ma = {}; + function na(a) { + return /^([+-]?(\d*(\.\d*)?([eE][+-]?\d*)?|INF)|NaN)$/.test(a); + } + function oa(a) { + return /^[_:A-Za-z][-._:A-Za-z0-9]*$/.test(a); + } + function pa(a) { + return oa(a) && /^[_A-Za-z]([-._A-Za-z0-9])*$/.test(a); + } + function qa(a) { + a = a.split(":"); + return a.length === 1 ? pa(a[0]) : a.length !== 2 ? false : pa(a[0]) && pa(a[1]); + } + function ra(a) { + return !/[\u0009\u000A\u000D]/.test(a); + } + function sa(a) { + return pa(a); + } + const ta = new Map([ + [45, function() { + return true; + }], + [46, function() { + return true; + }], + [1, function() { + return true; + }], + [0, function(a) { + return /^(0|1|true|false)$/.test(a); + }], + [6, function(a) { + return na(a); + }], + [3, na], + [4, function(a) { + return /^[+-]?\d*(\.\d*)?$/.test(a); + }], + [18, function(a) { + return /^(-)?P(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+(\.\d*)?S)?)?$/.test(a); + }], + [9, function(a) { + return /^-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(a); + }], + [8, function(a) { + return /^(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(a); + }], + [7, function(a) { + return /^-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(a); + }], + [11, function(a) { + return /^-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(a); + }], + [12, function(a) { + return /^-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(a); + }], + [13, function(a) { + return /^--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(a); + }], + [15, function(a) { + return /^---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(a); + }], + [14, function(a) { + return /^--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?$/.test(a); + }], + [22, function(a) { + return /^([0-9A-Fa-f]{2})*$/.test(a); + }], + [21, function(a) { + return new RegExp(/^((([A-Za-z0-9+/] ?){4})*((([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/])|(([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=)|(([A-Za-z0-9+/] ?)[AQgw] ?= ?=)))?$/).test(a); + }], + [20, function() { + return true; + }], + [44, qa], + [48, ra], + [52, function(a) { + return ra(a) && !/^ | {2,}| $/.test(a); + }], + [51, function(a) { + return /^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/.test(a); + }], + [50, function(a) { + return /^[-._:A-Za-z0-9]+$/.test(a); + }], + [25, oa], + [23, qa], + [24, pa], + [42, sa], + [41, sa], + [26, function(a) { + return pa(a); + }], + [5, function(a) { + return /^[+-]?\d+$/.test(a); + }], + [16, function(a) { + return /^-?P[0-9]+(Y([0-9]+M)?|M)$/.test(a); + }], + [17, function(a) { + return /^-?P([0-9]+D)?(T([0-9]+H)?([0-9]+M)?([0-9]+(\.[0-9]+)?S)?)?$/.test(a); + }] + ]); + var ua = Object.create(null); + [ + {C: 0, name: 59}, + {C: 0, name: 46, parent: 59, K: {whiteSpace: "preserve"}}, + {C: 0, name: 19, parent: 46}, + {C: 0, name: 1, parent: 46}, + {C: 0, name: 0, parent: 46, K: {whiteSpace: "collapse"}}, + {C: 0, name: 4, parent: 46, K: {whiteSpace: "collapse"}}, + {C: 0, name: 6, parent: 46, K: {whiteSpace: "collapse"}}, + {C: 0, name: 3, parent: 46, K: {whiteSpace: "collapse"}}, + {C: 0, name: 18, parent: 46, K: {whiteSpace: "collapse"}}, + {C: 0, name: 9, parent: 46, K: {Aa: "optional", whiteSpace: "collapse"}}, + {C: 0, name: 8, parent: 46, K: {Aa: "optional", whiteSpace: "collapse"}}, + { + C: 0, + name: 7, + parent: 46, + K: {Aa: "optional", whiteSpace: "collapse"} + }, + {C: 0, name: 11, parent: 46, K: {Aa: "optional", whiteSpace: "collapse"}}, + {C: 0, name: 12, parent: 46, K: {Aa: "optional", whiteSpace: "collapse"}}, + {C: 0, name: 13, parent: 46, K: {Aa: "optional", whiteSpace: "collapse"}}, + {C: 0, name: 15, parent: 46, K: {Aa: "optional", whiteSpace: "collapse"}}, + {C: 0, name: 14, parent: 46, K: {Aa: "optional", whiteSpace: "collapse"}}, + {C: 0, name: 22, parent: 46, K: {whiteSpace: "collapse"}}, + {C: 0, name: 21, parent: 46, K: {whiteSpace: "collapse"}}, + {C: 0, name: 20, parent: 46, K: {whiteSpace: "collapse"}}, + {C: 0, name: 23, parent: 46, K: {whiteSpace: "collapse"}}, + {C: 0, name: 44, parent: 46, K: {whiteSpace: "collapse"}}, + {C: 1, name: 10, R: 9, K: {whiteSpace: "collapse", Aa: "required"}}, + {C: 1, name: 48, R: 1, K: {whiteSpace: "replace"}}, + {C: 1, name: 52, R: 48, K: {whiteSpace: "collapse"}}, + {C: 1, name: 51, R: 52, K: {whiteSpace: "collapse"}}, + {C: 1, name: 50, R: 52, K: {whiteSpace: "collapse"}}, + {C: 2, name: 49, type: 50, K: {minLength: 1, whiteSpace: "collapse"}}, + {C: 1, name: 25, R: 52, K: {whiteSpace: "collapse"}}, + {C: 1, name: 24, R: 25, K: {whiteSpace: "collapse"}}, + { + C: 1, + name: 42, + R: 24, + K: {whiteSpace: "collapse"} + }, + {C: 1, name: 41, R: 24, K: {whiteSpace: "collapse"}}, + {C: 2, name: 43, type: 41, K: {minLength: 1, whiteSpace: "collapse"}}, + {C: 1, name: 26, R: 24, K: {whiteSpace: "collapse"}}, + {C: 2, name: 40, type: 26, K: {minLength: 1, whiteSpace: "collapse"}}, + {C: 0, name: 5, parent: 4, K: {ka: 0, whiteSpace: "collapse"}}, + {C: 1, name: 27, R: 5, K: {ka: 0, ua: "0", whiteSpace: "collapse"}}, + {C: 1, name: 28, R: 27, K: {ka: 0, ua: "-1", whiteSpace: "collapse"}}, + {C: 1, name: 31, R: 5, K: {ka: 0, ua: "9223372036854775807", va: "-9223372036854775808", whiteSpace: "collapse"}}, + {C: 1, name: 32, R: 31, K: {ka: 0, ua: "2147483647", va: "-2147483648", whiteSpace: "collapse"}}, + {C: 1, name: 33, R: 32, K: {ka: 0, ua: "32767", va: "-32768", whiteSpace: "collapse"}}, + {C: 1, name: 34, R: 33, K: {ka: 0, ua: "127", va: "-128", whiteSpace: "collapse"}}, + {C: 1, name: 30, R: 5, K: {ka: 0, va: "0", whiteSpace: "collapse"}}, + {C: 1, name: 36, R: 30, K: {ka: 0, ua: "18446744073709551615", va: "0", whiteSpace: "collapse"}}, + {C: 1, name: 35, R: 36, K: {ka: 0, ua: "4294967295", va: "0", whiteSpace: "collapse"}}, + {C: 1, name: 38, R: 35, K: {ka: 0, ua: "65535", va: "0", whiteSpace: "collapse"}}, + {C: 1, name: 37, R: 38, K: {ka: 0, ua: "255", va: "0", whiteSpace: "collapse"}}, + {C: 1, name: 29, R: 30, K: {ka: 0, va: "1", whiteSpace: "collapse"}}, + {C: 1, name: 16, R: 18, K: {whiteSpace: "collapse"}}, + {C: 1, name: 17, R: 18, K: {whiteSpace: "collapse"}}, + {C: 1, name: 60, R: 59}, + {C: 3, name: 39, Ba: []}, + {C: 1, name: 61, R: 60}, + {C: 1, name: 62, R: 60}, + {C: 0, name: 53, parent: 59}, + {C: 1, name: 54, R: 53}, + {C: 1, name: 58, R: 53}, + {C: 1, name: 47, R: 53}, + {C: 1, name: 56, R: 53}, + {C: 1, name: 57, R: 53}, + {C: 1, name: 55, R: 53}, + {C: 3, name: 2, Ba: [4, 5, 6, 3]}, + {C: 3, name: 63, Ba: []} + ].forEach((a) => { + const b = a.name, c = a.K || {}; + switch (a.C) { + case 0: + a = a.parent ? ua[a.parent] : null; + var d = ta.get(b) || null; + ua[b] = {C: 0, type: b, Ja: c, parent: a, fb: d, Oa: ka(b), Ba: []}; + break; + case 1: + a = ua[a.R]; + d = ta.get(b) || null; + ua[b] = {C: 1, type: b, Ja: c, parent: a, fb: d, Oa: a.Oa, Ba: []}; + break; + case 2: + ua[b] = {C: 2, type: b, Ja: c, parent: ua[a.type], fb: null, Oa: la, Ba: []}; + break; + case 3: + a = a.Ba.map((e) => ua[e]), ua[b] = {C: 3, type: b, Ja: c, parent: null, fb: null, Oa: ma, Ba: a}; + } + }); + function g(a, b) { + if (!ua[b]) + throw Error("Unknown type"); + return {type: b, value: a}; + } + var va = g(true, 0), wa = g(false, 0); + var ya = (a = "A wrong argument type was specified in a function call.") => Error(`FORG0006: ${a}`); + var za = class { + constructor(a, b) { + this.done = a; + this.value = b; + } + }, p = new za(true); + function q(a) { + return new za(false, a); + } + function Aa(a, b) { + if (b.C === 3) + return !!b.Ba.find((c) => Aa(a, c)); + for (; a; ) { + if (a.type === b.type) + return true; + if (a.C === 3) + return !!a.Ba.find((c) => v(c.type, b.type)); + a = a.parent; + } + return false; + } + function v(a, b) { + return a === b ? true : Aa(ua[a], ua[b]); + } + var Ba = class { + constructor(a) { + this.o = w; + this.h = a; + let b = -1; + this.value = {next: () => { + b++; + return b >= a.length ? p : q(a[b]); + }}; + } + gb() { + return this; + } + filter(a) { + let b = -1; + return this.o.create({next: () => { + for (b++; b < this.h.length && !a(this.h[b], b, this); ) + b++; + return b >= this.h.length ? p : q(this.h[b]); + }}); + } + first() { + return this.h[0]; + } + O() { + return this.h; + } + fa() { + if (v(this.h[0].type, 53)) + return true; + throw ya("Cannot determine the effective boolean value of a sequence with a length higher than one."); + } + Pa() { + return this.h.length; + } + G() { + return false; + } + sa() { + return false; + } + map(a) { + let b = -1; + return this.o.create({next: () => ++b >= this.h.length ? p : q(a(this.h[b], b, this))}, this.h.length); + } + M(a) { + return a(this.h); + } + Y(a) { + return a.multiple ? a.multiple(this) : a.default(this); + } + }; + var Ca = class { + constructor() { + this.value = {next: () => p}; + } + gb() { + return this; + } + filter() { + return this; + } + first() { + return null; + } + O() { + return []; + } + fa() { + return false; + } + Pa() { + return 0; + } + G() { + return true; + } + sa() { + return false; + } + map() { + return this; + } + M(a) { + return a([]); + } + Y(a) { + return a.empty ? a.empty(this) : a.default(this); + } + }; + var Da = class { + constructor(a, b) { + this.type = a; + this.value = b; + } + }; + const Ea = { + [0]: "xs:boolean", + [1]: "xs:string", + [2]: "xs:numeric", + [3]: "xs:double", + [4]: "xs:decimal", + [5]: "xs:integer", + [6]: "xs:float", + [7]: "xs:date", + [8]: "xs:time", + [9]: "xs:dateTime", + [10]: "xs:dateTimeStamp", + [11]: "xs:gYearMonth", + [12]: "xs:gYear", + [13]: "xs:gMonthDay", + [14]: "xs:gMonth", + [15]: "xs:gDay", + [16]: "xs:yearMonthDuration", + [17]: "xs:dayTimeDuration", + [18]: "xs:duration", + [19]: "xs:untypedAtomic", + [20]: "xs:anyURI", + [21]: "xs:base64Binary", + [22]: "xs:hexBinary", + [23]: "xs:QName", + [24]: "xs:NCName", + [25]: "xs:Name", + [26]: "xs:ENTITY", + [27]: "xs:nonPositiveInteger", + [28]: "xs:negativeInteger", + [29]: "xs:positiveInteger", + [30]: "xs:nonNegativeInteger", + [31]: "xs:long", + [32]: "xs:int", + [33]: "xs:short", + [34]: "xs:byte", + [35]: "xs:unsignedInt", + [36]: "xs:unsignedLong", + [37]: "xs:unsignedByte", + [38]: "xs:unsignedShort", + [39]: "xs:error", + [40]: "xs:ENTITIES", + [41]: "xs:IDREF", + [42]: "xs:ID", + [43]: "xs:IDREFS", + [44]: "xs:NOTATION", + [45]: "xs:anySimpleType", + [46]: "xs:anyAtomicType", + [47]: "attribute()", + [48]: "xs:normalizedString", + [49]: "xs:NMTOKENS", + [50]: "xs:NMTOKEN", + [51]: "xs:language", + [52]: "xs:token", + [53]: "node()", + [54]: "element()", + [55]: "document-node()", + [56]: "text()", + [57]: "processing-instruction()", + [58]: "comment()", + [59]: "item()", + [60]: "function(*)", + [61]: "map(*)", + [62]: "array(*)", + [63]: "none" + }, Fa = { + "xs:boolean": 0, + "xs:string": 1, + "xs:numeric": 2, + "xs:double": 3, + "xs:decimal": 4, + "xs:integer": 5, + "xs:float": 6, + "xs:date": 7, + "xs:time": 8, + "xs:dateTime": 9, + "xs:dateTimeStamp": 10, + "xs:gYearMonth": 11, + "xs:gYear": 12, + "xs:gMonthDay": 13, + "xs:gMonth": 14, + "xs:gDay": 15, + "xs:yearMonthDuration": 16, + "xs:dayTimeDuration": 17, + "xs:duration": 18, + "xs:untypedAtomic": 19, + "xs:anyURI": 20, + "xs:base64Binary": 21, + "xs:hexBinary": 22, + "xs:QName": 23, + "xs:NCName": 24, + "xs:Name": 25, + "xs:ENTITY": 26, + "xs:nonPositiveInteger": 27, + "xs:negativeInteger": 28, + "xs:positiveInteger": 29, + "xs:nonNegativeInteger": 30, + "xs:long": 31, + "xs:int": 32, + "xs:short": 33, + "xs:byte": 34, + "xs:unsignedInt": 35, + "xs:unsignedLong": 36, + "xs:unsignedByte": 37, + "xs:unsignedShort": 38, + "xs:error": 39, + "xs:ENTITIES": 40, + "xs:IDREF": 41, + "xs:ID": 42, + "xs:IDREFS": 43, + "xs:NOTATION": 44, + "xs:anySimpleType": 45, + "xs:anyAtomicType": 46, + "attribute()": 47, + "xs:normalizedString": 48, + "xs:NMTOKENS": 49, + "xs:NMTOKEN": 50, + "xs:language": 51, + "xs:token": 52, + "node()": 53, + "element()": 54, + "document-node()": 55, + "text()": 56, + "processing-instruction()": 57, + "comment()": 58, + "item()": 59, + "function(*)": 60, + "map(*)": 61, + "array(*)": 62 + }; + function Ha(a) { + return a.g === 2 ? Ea[a.type] + "*" : a.g === 1 ? Ea[a.type] + "+" : a.g === 0 ? Ea[a.type] + "?" : Ea[a.type]; + } + function Ia(a) { + if (a === "none") + throw Error('XPST0051: The type "none" could not be found'); + if (!a.startsWith("xs:") && 0 <= a.indexOf(":")) + throw Error(`XPST0081: Invalid prefix for input ${a}`); + const b = Fa[a]; + if (b === void 0) + throw Error(`XPST0051: The type "${a}" could not be found`); + return b; + } + function Ja(a) { + switch (a[a.length - 1]) { + case "*": + return {type: Ia(a.substr(0, a.length - 1)), g: 2}; + case "?": + return {type: Ia(a.substr(0, a.length - 1)), g: 0}; + case "+": + return {type: Ia(a.substr(0, a.length - 1)), g: 1}; + default: + return {type: Ia(a), g: 3}; + } + } + function Ka(a) { + switch (a) { + case "*": + return 2; + case "?": + return 0; + case "+": + return 1; + default: + return 3; + } + } + function La(a) { + const b = a.value; + if (v(a.type, 53)) + return true; + if (v(a.type, 0)) + return b; + if (v(a.type, 1) || v(a.type, 20) || v(a.type, 19)) + return b.length !== 0; + if (v(a.type, 2)) + return !isNaN(b) && b !== 0; + throw ya(`Cannot determine the effective boolean value of a value with the type ${Ea[a.type]}`); + } + function Ma(a, b = 0) { + a.h = b; + } + var Na = class { + constructor(a, b = null) { + this.D = w; + this.value = {next: (c) => { + if (this.o !== null && this.h >= this.o) + return p; + if (this.v[this.h] !== void 0) + return q(this.v[this.h++]); + c = a.next(c); + if (c.done) + return this.o = this.h, c; + if (this.l || 2 > this.h) + this.v[this.h] = c.value; + this.h++; + return c; + }}; + this.l = false; + this.v = []; + this.h = 0; + this.o = b; + } + gb() { + return this.D.create(this.O()); + } + filter(a) { + let b = -1; + const c = this.value; + return this.D.create({next: (d) => { + b++; + for (d = c.next(d); !d.done && !a(d.value, b, this); ) + b++, d = c.next(0); + return d; + }}); + } + first() { + if (this.v[0] !== void 0) + return this.v[0]; + const a = this.value.next(0); + Ma(this); + return a.done ? null : a.value; + } + O() { + if (this.h > this.v.length && this.o !== this.v.length) + throw Error("Implementation error: Sequence Iterator has progressed."); + const a = this.value; + this.l = true; + let b = a.next(0); + for (; !b.done; ) + b = a.next(0); + return this.v; + } + fa() { + const a = this.value, b = this.h; + Ma(this); + var c = a.next(0); + if (c.done) + return Ma(this, b), false; + c = c.value; + if (v(c.type, 53)) + return Ma(this, b), true; + if (!a.next(0).done) + throw ya("Cannot determine the effective boolean value of a sequence with a length higher than one."); + Ma(this, b); + return La(c); + } + Pa(a = false) { + if (this.o !== null) + return this.o; + if (a) + return -1; + a = this.h; + const b = this.O().length; + Ma(this, a); + return b; + } + G() { + return this.o === 0 ? true : this.first() === null; + } + sa() { + if (this.o !== null) + return this.o === 1; + var a = this.value; + const b = this.h; + Ma(this); + if (a.next(0).done) + return Ma(this, b), false; + a = a.next(0); + Ma(this, b); + return a.done; + } + map(a) { + let b = 0; + const c = this.value; + return this.D.create({next: (d) => { + d = c.next(d); + return d.done ? p : q(a(d.value, b++, this)); + }}, this.o); + } + M(a, b) { + const c = this.value; + let d; + const e = []; + let f = true; + (function() { + for (let h = c.next(f ? 0 : b); !h.done; h = c.next(b)) + f = false, e.push(h.value); + d = a(e).value; + })(); + return this.D.create({next: () => d.next(0)}); + } + Y(a) { + let b = null; + const c = (d) => { + b = d.value; + d = d.Pa(true); + d !== -1 && (this.o = d); + }; + return this.D.create({next: (d) => { + if (b) + return b.next(d); + if (this.G()) + return c(a.empty ? a.empty(this) : a.default(this)), b.next(d); + if (this.sa()) + return c(a.m ? a.m(this) : a.default(this)), b.next(d); + c(a.multiple ? a.multiple(this) : a.default(this)); + return b.next(d); + }}); + } + }; + var Oa = class { + constructor(a) { + this.v = w; + this.h = a; + let b = false; + this.value = {next: () => { + if (b) + return p; + b = true; + return q(a); + }}; + this.o = null; + } + gb() { + return this; + } + filter(a) { + return a(this.h, 0, this) ? this : this.v.create(); + } + first() { + return this.h; + } + O() { + return [this.h]; + } + fa() { + this.o === null && (this.o = La(this.h)); + return this.o; + } + Pa() { + return 1; + } + G() { + return false; + } + sa() { + return true; + } + map(a) { + return this.v.create(a(this.h, 0, this)); + } + M(a) { + return a([this.h]); + } + Y(a) { + return a.m ? a.m(this) : a.default(this); + } + }; + const Pa = new Ca(); + function Qa(a = null, b = null) { + if (a === null) + return Pa; + if (Array.isArray(a)) + switch (a.length) { + case 0: + return Pa; + case 1: + return new Oa(a[0]); + default: + return new Ba(a); + } + return a.next ? new Na(a, b) : new Oa(a); + } + var w = {create: Qa, m: (a) => new Oa(a), empty: () => Qa(), aa: () => Qa(va), V: () => Qa(wa)}; + function Ra(a) { + const b = [], c = a.value; + return () => { + let d = 0; + return w.create({next: () => { + if (b[d] !== void 0) + return b[d++]; + const e = c.next(0); + return e.done ? e : b[d++] = e; + }}); + }; + } + var Ta = class { + constructor(a, b, c) { + this.namespaceURI = b || null; + this.prefix = a || ""; + this.localName = c; + } + ya() { + return this.prefix ? this.prefix + ":" + this.localName : this.localName; + } + }; + function Ua(a, b) { + const c = a.value, d = b.map((e) => e === null ? null : Ra(e)); + b = b.reduce((e, f, h) => { + f === null && e.push(a.o[h]); + return e; + }, []); + b = new Va({j: b, arity: b.length, Xa: true, J: a.J, localName: "boundFunction", namespaceURI: a.l, i: a.s, value: function(e, f, h) { + const k = Array.from(arguments).slice(3), l = d.map((n) => n === null ? k.shift() : n()); + return c.apply(void 0, [e, f, h].concat(l)); + }}); + return w.m(b); + } + var Va = class extends Da { + constructor({j: a, arity: b, Xa: c = false, J: d = false, localName: e, namespaceURI: f, i: h, value: k}) { + super(60, null); + this.value = k; + this.J = d; + d = -1; + for (k = 0; k < a.length; k++) + a[k] === 4 && (d = k); + -1 < d && (k = Array(b - (a.length - 1)).fill(a[d - 1]), a = a.slice(0, d).concat(k)); + this.o = a; + this.v = b; + this.ia = c; + this.D = e; + this.l = f; + this.s = h; + } + Xa() { + return this.ia; + } + }; + function Wa(a, b) { + const c = []; + a !== 2 && a !== 1 || c.push("type-1-or-type-2"); + c.push(`type-${a}`); + b && c.push(`name-${b}`); + return c; + } + function Xa(a) { + const b = a.node.nodeType; + let c; + if (b === 2 || b === 1) + c = a.node.localName; + return Wa(b, c); + } + function Ya(a) { + const b = a.nodeType; + let c; + if (b === 2 || b === 1) + c = a.localName; + return Wa(b, c); + } + var Za = class { + getAllAttributes(a, b = null) { + if (a.nodeType !== 1) + return []; + a = Array.from(a.attributes); + return b === null ? a : a.filter((c) => Ya(c).includes(b)); + } + getAttribute(a, b) { + return a.nodeType !== 1 ? null : a.getAttribute(b); + } + getChildNodes(a, b = null) { + a = Array.from(a.childNodes); + return b === null ? a : a.filter((c) => Ya(c).includes(b)); + } + getData(a) { + return a.nodeType === 2 ? a.value : a.data; + } + getFirstChild(a, b = null) { + for (a = a.firstChild; a; a = a.nextSibling) + if (b === null || Ya(a).includes(b)) + return a; + return null; + } + getLastChild(a, b = null) { + for (a = a.lastChild; a; a = a.previousSibling) + if (b === null || Ya(a).includes(b)) + return a; + return null; + } + getNextSibling(a, b = null) { + for (a = a.nextSibling; a; a = a.nextSibling) + if (b === null || Ya(a).includes(b)) + return a; + return null; + } + getParentNode(a, b = null) { + return (a = a.nodeType === 2 ? a.ownerElement : a.parentNode) ? b === null || Ya(a).includes(b) ? a : null : null; + } + getPreviousSibling(a, b = null) { + for (a = a.previousSibling; a; a = a.previousSibling) + if (b === null || Ya(a).includes(b)) + return a; + return null; + } + }; + class $a { + insertBefore(a, b, c) { + return a.insertBefore(b, c); + } + removeAttributeNS(a, b, c) { + return a.removeAttributeNS(b, c); + } + removeChild(a, b) { + return a.removeChild(b); + } + setAttributeNS(a, b, c, d) { + a.setAttributeNS(b, c, d); + } + setData(a, b) { + a.data = b; + } + } + var ab = new $a(); + class bb { + constructor(a) { + this.h = a; + } + insertBefore(a, b, c) { + return this.h.insertBefore(a, b, c); + } + removeAttributeNS(a, b, c) { + return this.h.removeAttributeNS(a, b, c); + } + removeChild(a, b) { + return this.h.removeChild(a, b); + } + setAttributeNS(a, b, c, d) { + this.h.setAttributeNS(a, b, c, d); + } + setData(a, b) { + this.h.setData(a, b); + } + } + function cb(a) { + return a.Ra !== void 0; + } + function eb(a, b, c) { + let d = null; + b && (cb(b.node) ? d = {F: b.F, offset: c, parent: b.node} : b.F && (d = b.F)); + return {node: a, F: d}; + } + function fb(a, b, c = null) { + return a.getAllAttributes(b.node, c).map((d) => eb(d, b, d.nodeName)); + } + function gb(a, b, c) { + b = b.node; + return cb(b) ? (a = b.attributes.find((d) => c === d.name)) ? a.value : null : (a = a.h.getAttribute(b, c)) ? a : null; + } + function hb(a, b, c = null) { + return a.getChildNodes(b.node, c).map((d, e) => eb(d, b, e)); + } + function ib(a, b) { + return a.getData(b.node); + } + function jb(a, b, c = null) { + const d = b.node; + cb(d) ? a = d.childNodes[0] : ((c = a.h.getFirstChild(d, c)) && c.nodeType === 10 && (c = a.h.getNextSibling(c)), a = c); + return a ? eb(a, b, 0) : null; + } + function kb(a, b, c = null) { + var d = b.node; + cb(d) ? (a = d.childNodes.length - 1, d = d.childNodes[a]) : ((d = a.h.getLastChild(d, c)) && d.nodeType === 10 && (d = a.h.getPreviousSibling(d)), a = a.getChildNodes(b.node, c).length - 1); + return d ? eb(d, b, a) : null; + } + function x(a, b, c = null) { + const d = b.node, e = b.F; + if (e) + typeof e.offset === "number" && d === e.parent.childNodes[e.offset] || typeof e.offset === "string" && d === e.parent.attributes.find((f) => e.offset === f.nodeName) ? (a = e.parent, b = e.F) : (a = a.getParentNode(d, c), b = e); + else { + if (cb(d)) + return null; + a = a.getParentNode(d, c); + b = null; + } + return a ? {node: a, F: b} : null; + } + function lb(a, b, c = null) { + const d = b.node; + let e, f, h; + const k = b.F; + if (cb(d)) + k && (h = k.offset + 1, e = k.parent.childNodes[h]); + else if (k) + h = k.offset + 1, f = x(a, b, null), e = a.getChildNodes(f.node, c)[h]; + else { + for (e = d; e && (!(e = a.h.getNextSibling(e, c)) || e.nodeType === 10); ) + ; + return e ? {node: e, F: null} : null; + } + return e ? eb(e, f || x(a, b, c), h) : null; + } + function mb(a, b, c = null) { + const d = b.node; + let e, f; + const h = b.F; + let k; + if (cb(d)) + h && (k = h.offset - 1, e = h.parent.childNodes[k]); + else if (h) + k = h.offset - 1, f = x(a, b, null), e = a.getChildNodes(f.node, c)[k]; + else { + for (e = d; e && (!(e = a.h.getPreviousSibling(e, c)) || e.nodeType === 10); ) + ; + return e ? {node: e, F: null} : null; + } + return e ? eb(e, f || x(a, b, c), k) : null; + } + var nb = class { + constructor(a) { + this.h = a; + this.o = []; + } + getAllAttributes(a, b = null) { + return cb(a) ? a.attributes : this.h.getAllAttributes(a, b); + } + getChildNodes(a, b = null) { + b = cb(a) ? a.childNodes : this.h.getChildNodes(a, b); + return a.nodeType === 9 ? b.filter((c) => c.nodeType !== 10) : b; + } + getData(a) { + return cb(a) ? a.nodeType === 2 ? a.value : a.data : this.h.getData(a) || ""; + } + getParentNode(a, b = null) { + return this.h.getParentNode(a, b); + } + }; + var ob = (a, b, c, d, e) => e.M(([f]) => d.M(([h]) => { + const k = f.value; + if (0 >= k || k > h.h.length) + throw Error("FOAY0001: array position out of bounds."); + return h.h[k - 1](); + })); + var pb = class extends Va { + constructor(a) { + super({value: (b, c, d, e) => ob(b, c, d, w.m(this), e), localName: "get", namespaceURI: "http://www.w3.org/2005/xpath-functions/array", j: [{type: 5, g: 3}], arity: 1, i: {type: 59, g: 2}}); + this.type = 62; + this.h = a; + } + }; + function qb(a) { + switch (a.node.nodeType) { + case 2: + return 47; + case 1: + return 54; + case 3: + case 4: + return 56; + case 7: + return 57; + case 8: + return 58; + case 9: + return 55; + default: + return 53; + } + } + function rb(a) { + return {type: qb(a), value: a}; + } + function A(a, b) { + a = a.map((c) => c.first()); + return b(a); + } + function sb(a, b) { + var c = v(a.type, 1) || v(a.type, 20) || v(a.type, 19), d = v(b.type, 1) || v(b.type, 20) || v(b.type, 19); + if (c && d) + return a.value === b.value; + c = v(a.type, 4) || v(a.type, 3) || v(a.type, 6); + d = v(b.type, 4) || v(b.type, 3) || v(b.type, 6); + if (c && d) + return isNaN(a.value) && isNaN(b.value) ? true : a.value === b.value; + c = v(a.type, 0) || v(a.type, 22) || v(a.type, 18) || v(a.type, 23) || v(a.type, 44); + d = v(b.type, 0) || v(b.type, 22) || v(b.type, 18) || v(b.type, 23) || v(b.type, 44); + return c && d ? a.value === b.value : false; + } + var tb = (a, b, c, d, e) => A([d, e], ([f, h]) => (f = f.h.find((k) => sb(k.key, h))) ? f.value() : w.empty()); + var ub = class extends Va { + constructor(a) { + super({j: [{type: 59, g: 3}], arity: 1, localName: "get", namespaceURI: "http://www.w3.org/2005/xpath-functions/map", value: (b, c, d, e) => tb(b, c, d, w.m(this), e), i: {type: 59, g: 2}}); + this.type = 61; + this.h = a; + } + }; + function vb(a, b) { + return a.h() === b.h() && a.o() === b.o(); + } + var wb = class { + Za() { + return 0; + } + getHours() { + return 0; + } + getMinutes() { + return 0; + } + $a() { + return 0; + } + h() { + return 0; + } + o() { + return 0; + } + getSeconds() { + return 0; + } + ab() { + return 0; + } + na() { + return true; + } + }; + function xb(a) { + var b = Math.abs(a.Za()), c = Math.abs(a.getHours()); + const d = Math.abs(a.getMinutes()); + a = Math.abs(a.getSeconds()); + b = `${b ? `${b}D` : ""}`; + c = (c ? `${c}H` : "") + (d ? `${d}M` : "") + (a ? `${a}S` : ""); + return b && c ? `${b}T${c}` : b ? b : c ? `T${c}` : "T0S"; + } + var yb = class extends wb { + constructor(a) { + super(); + if (a > Number.MAX_SAFE_INTEGER || a < Number.MIN_SAFE_INTEGER) + throw Error("FODT0002: Number of seconds given to construct DayTimeDuration overflows MAX_SAFE_INTEGER or MIN_SAFE_INTEGER"); + this.ca = a; + } + Za() { + return Math.trunc(this.ca / 86400); + } + getHours() { + return Math.trunc(this.ca % 86400 / 3600); + } + getMinutes() { + return Math.trunc(this.ca % 3600 / 60); + } + o() { + return this.ca; + } + getSeconds() { + const a = this.ca % 60; + return Object.is(-0, a) ? 0 : a; + } + na() { + return Object.is(-0, this.ca) ? false : 0 <= this.ca; + } + toString() { + return (this.na() ? "P" : "-P") + xb(this); + } + }, zb = (a, b, c, d, e, f) => { + a = 86400 * a + 3600 * b + 60 * c + d + e; + return new yb(f || a === 0 ? a : -a); + }, Ab = (a) => (a = /^(-)?P(\d+Y)?(\d+M)?(\d+D)?(?:T(\d+H)?(\d+M)?(\d+(\.\d*)?S)?)?$/.exec(a)) ? zb(a[4] ? parseInt(a[4], 10) : 0, a[5] ? parseInt(a[5], 10) : 0, a[6] ? parseInt(a[6], 10) : 0, a[7] ? parseInt(a[7], 10) : 0, a[8] ? parseFloat(a[8]) : 0, !a[1]) : null, Bb = (a) => { + a = /^(Z)|([+-])([01]\d):([0-5]\d)$/.exec(a); + return a[1] === "Z" ? zb(0, 0, 0, 0, 0, true) : zb(0, a[3] ? parseInt(a[3], 10) : 0, a[4] ? parseInt(a[4], 10) : 0, 0, 0, a[2] === "+"); + }; + function Cb(a, b) { + if (isNaN(b)) + throw Error("FOCA0005: Cannot multiply xs:dayTimeDuration by NaN"); + a = a.ca * b; + if (a > Number.MAX_SAFE_INTEGER || !Number.isFinite(a)) + throw Error("FODT0002: Value overflow while multiplying xs:dayTimeDuration"); + return new yb(a < Number.MIN_SAFE_INTEGER || Object.is(-0, a) ? 0 : a); + } + function Db(a) { + return a ? parseInt(a, 10) : null; + } + function Fb(a) { + a += ""; + const b = a.startsWith("-"); + b && (a = a.substring(1)); + return (b ? "-" : "") + a.padStart(4, "0"); + } + function Gb(a) { + return (a + "").padStart(2, "0"); + } + function Hb(a) { + a += ""; + a.split(".")[0].length === 1 && (a = a.padStart(a.length + 1, "0")); + return a; + } + function Ib(a) { + return a.getHours() === 0 && a.getMinutes() === 0 ? "Z" : (a.na() ? "+" : "-") + Gb(Math.abs(a.getHours())) + ":" + Gb(Math.abs(a.getMinutes())); + } + function Jb(a) { + var b = /^(?:(-?\d{4,}))?(?:--?(\d\d))?(?:-{1,3}(\d\d))?(T)?(?:(\d\d):(\d\d):(\d\d))?(\.\d+)?(Z|(?:[+-]\d\d:\d\d))?$/.exec(a); + a = b[1] ? parseInt(b[1], 10) : null; + const c = Db(b[2]), d = Db(b[3]), e = b[4], f = Db(b[5]), h = Db(b[6]), k = Db(b[7]), l = b[8] ? parseFloat(b[8]) : 0; + b = b[9] ? Bb(b[9]) : null; + if (a && (-271821 > a || 273860 < a)) + throw Error("FODT0001: Datetime year is out of bounds"); + return e ? new Kb(a, c, d, f, h, k, l, b, 9) : f !== null && h !== null && k !== null ? new Kb(1972, 12, 31, f, h, k, l, b, 8) : a !== null && c !== null && d !== null ? new Kb(a, c, d, 0, 0, 0, 0, b, 7) : a !== null && c !== null ? new Kb(a, c, 1, 0, 0, 0, 0, b, 11) : c !== null && d !== null ? new Kb(1972, c, d, 0, 0, 0, 0, b, 13) : a !== null ? new Kb(a, 1, 1, 0, 0, 0, 0, b, 12) : c !== null ? new Kb(1972, c, 1, 0, 0, 0, 0, b, 14) : new Kb(1972, 12, d, 0, 0, 0, 0, b, 15); + } + function Lb(a, b) { + switch (b) { + case 15: + return new Kb(1972, 12, a.o, 0, 0, 0, 0, a.X, 15); + case 14: + return new Kb(1972, a.h, 1, 0, 0, 0, 0, a.X, 14); + case 12: + return new Kb(a.v, 1, 1, 0, 0, 0, 0, a.X, 12); + case 13: + return new Kb(1972, a.h, a.o, 0, 0, 0, 0, a.X, 13); + case 11: + return new Kb(a.v, a.h, 1, 0, 0, 0, 0, a.X, 11); + case 8: + return new Kb(1972, 12, 31, a.l, a.s, a.D, a.pa, a.X, 8); + case 7: + return new Kb(a.v, a.h, a.o, 0, 0, 0, 0, a.X, 7); + default: + return new Kb(a.v, a.h, a.o, a.l, a.s, a.D, a.pa, a.X, 9); + } + } + function Mb(a, b) { + b = a.X || b || Bb("Z"); + return new Date(Date.UTC(a.v, a.h - 1, a.o, a.l - b.getHours(), a.s - b.getMinutes(), a.D, 1e3 * a.pa)); + } + var Kb = class { + constructor(a, b, c, d, e, f, h, k, l = 9) { + this.v = a; + this.h = b; + this.o = c + (d === 24 ? 1 : 0); + this.l = d === 24 ? 0 : d; + this.s = e; + this.D = f; + this.pa = h; + this.X = k; + this.type = l; + } + getDay() { + return this.o; + } + getHours() { + return this.l; + } + getMinutes() { + return this.s; + } + getMonth() { + return this.h; + } + getSeconds() { + return this.D; + } + getYear() { + return this.v; + } + toString() { + switch (this.type) { + case 9: + return Fb(this.v) + "-" + Gb(this.h) + "-" + Gb(this.o) + "T" + Gb(this.l) + ":" + Gb(this.s) + ":" + Hb(this.D + this.pa) + (this.X ? Ib(this.X) : ""); + case 7: + return Fb(this.v) + "-" + Gb(this.h) + "-" + Gb(this.o) + (this.X ? Ib(this.X) : ""); + case 8: + return Gb(this.l) + ":" + Gb(this.s) + ":" + Hb(this.D + this.pa) + (this.X ? Ib(this.X) : ""); + case 15: + return "---" + Gb(this.o) + (this.X ? Ib(this.X) : ""); + case 14: + return "--" + Gb(this.h) + (this.X ? Ib(this.X) : ""); + case 13: + return "--" + Gb(this.h) + "-" + Gb(this.o) + (this.X ? Ib(this.X) : ""); + case 12: + return Fb(this.v) + (this.X ? Ib(this.X) : ""); + case 11: + return Fb(this.v) + "-" + Gb(this.h) + (this.X ? Ib(this.X) : ""); + } + throw Error("Unexpected subType"); + } + }; + function Nb(a, b, c) { + const d = Mb(a, c).getTime(); + c = Mb(b, c).getTime(); + return d === c ? a.pa === b.pa ? 0 : a.pa > b.pa ? 1 : -1 : d > c ? 1 : -1; + } + function Ob(a, b, c) { + return Nb(a, b, c) === 0; + } + function Pb(a, b, c) { + a = (Mb(a, c).getTime() - Mb(b, c).getTime()) / 1e3; + return new yb(a); + } + function Qb(a) { + throw Error(`Not implemented: adding durations to ${Ea[a.type]}`); + } + function Rb(a) { + throw Error(`Not implemented: subtracting durations from ${Ea[a.type]}`); + } + function Sb(a, b) { + if (a === null) + return null; + switch (typeof a) { + case "boolean": + return a ? va : wa; + case "number": + return g(a, 3); + case "string": + return g(a, 1); + case "object": + if ("nodeType" in a) + return rb({node: a, F: null}); + if (Array.isArray(a)) + return new pb(a.map((c) => { + if (c === void 0) + return () => w.empty(); + c = Sb(c); + c = c === null ? w.empty() : w.m(c); + return Ra(c); + })); + if (a instanceof Date) { + const c = Jb(a.toISOString()); + return g(c, c.type); + } + return new ub(Object.keys(a).filter((c) => a[c] !== void 0).map((c) => { + var d = Sb(a[c]); + d = d === null ? w.empty() : w.m(d); + return {key: g(c, 1), value: Ra(d)}; + })); + } + throw Error(`Value ${String(a)} of type "${typeof a}" is not adaptable to an XPath value.`); + } + function Tb(a, b) { + if (typeof a !== "number" && (typeof a !== "string" || !ta.get(b)(a))) + throw Error(`Cannot convert JavaScript value '${a}' to the XPath type ${Ea[b]} since it is not valid.`); + } + function Ub(a, b, c) { + if (b === null) + return null; + switch (a) { + case 0: + return b ? va : wa; + case 1: + return g(b + "", 1); + case 3: + case 2: + return Tb(b, 3), g(+b, 3); + case 4: + return Tb(b, a), g(+b, 4); + case 5: + return Tb(b, a), g(b | 0, 5); + case 6: + return Tb(b, a), g(+b, 6); + case 7: + case 8: + case 9: + case 11: + case 12: + case 13: + case 14: + case 15: + if (!(b instanceof Date)) + throw Error(`The JavaScript value ${b} with type ${typeof b} is not a valid type to be converted to an XPath ${Ea[a]}.`); + return g(Lb(Jb(b.toISOString()), a), a); + case 53: + case 47: + case 55: + case 54: + case 56: + case 57: + case 58: + if (typeof b !== "object" || !("nodeType" in b)) + throw Error(`The JavaScript value ${b} with type ${typeof b} is not a valid type to be converted to an XPath ${Ea[a]}.`); + return rb({node: b, F: null}); + case 59: + return Sb(b); + case 61: + return Sb(b); + default: + throw Error(`Values of the type "${Ea[a]}" can not be adapted from JavaScript to equivalent XPath values.`); + } + } + function Yb(a, b, c) { + if (c.g === 0) + return b = Ub(c.type, b), b === null ? [] : [b]; + if (c.g === 2 || c.g === 1) { + if (!Array.isArray(b)) + throw Error(`The JavaScript value ${b} should be an array if it is to be converted to ${Ha(c)}.`); + return b.map((e) => Ub(c.type, e)).filter((e) => e !== null); + } + const d = Ub(c.type, b); + if (d === null) + throw Error(`The JavaScript value ${b} should be a single entry if it is to be converted to ${Ha(c)}.`); + return [d]; + } + function Zb(a, b, c = {type: 59, g: 0}) { + return w.create(Yb(a, b, c)); + } + var ac = class { + constructor() { + this.h = Math.abs(Math.floor(Math.random() * $b) % $b); + } + }, $b = 2 ** 32; + function bc(a, b, c, d) { + return new cc({N: c, Fa: b, za: d || a.za, wa: a.wa}, a.h, a.o); + } + function dc(a, b) { + let c = 0; + const d = b.value; + return {next: (e) => { + e = d.next(e); + return e.done ? p : q(bc(a, c++, e.value, b)); + }}; + } + function ec(a) { + a.h.hb || (a.h.hb = true, a.h.ob = Jb(new Date().toISOString()), a.h.tb = Ab("PT0S")); + return a.h.ob; + } + function fc(a) { + a.h.hb || (a.h.hb = true, a.h.ob = Jb(new Date().toISOString()), a.h.tb = Ab("PT0S")); + return a.h.tb; + } + function gc(a, b = null) { + a = 29421 * (b !== null && b !== void 0 ? b : a.o.h) % $b; + return {pb: Math.floor(a), Yb: a / $b}; + } + function hc(a, b) { + return new cc({N: a.N, Fa: a.Fa, za: a.za, wa: Object.assign(Object.create(null), a.wa, b)}, a.h, a.o); + } + var cc = class { + constructor(a, b = {ob: null, tb: null, hb: false}, c = new ac()) { + this.h = b; + this.Fa = a.Fa; + this.za = a.za; + this.N = a.N; + this.wa = a.wa || Object.create(null); + this.o = c; + } + }; + var ic = class { + constructor(a, b, c, d, e, f, h, k, l) { + this.debug = a; + this.Ga = b; + this.h = c; + this.Ia = d; + this.Ma = e; + this.o = f; + this.v = h; + this.ib = k; + this.Ua = l; + } + }; + function jc(a) { + let b = 0, c = null, d = true; + return w.create({next: (e) => { + for (; b < a.length; ) { + c || (c = a[b].value, d = true); + const f = c.next(d ? 0 : e); + d = false; + if (f.done) + b++, c = null; + else + return f; + } + return p; + }}); + } + var kc = (a, b, c) => Error(`FORG0001: Cannot cast ${a} to ${Ea[b]}${c ? `, ${c}` : ""}`), lc = (a) => Error(`XPDY0002: ${a}`), mc = (a) => Error(`XPTY0004: ${a}`), nc = (a) => Error(`FOTY0013: Atomization is not supported for ${Ea[a]}.`), oc = (a) => Error(`XPST0081: The prefix ${a} could not be resolved.`); + function pc(a, b) { + if (v(a.type, 46) || v(a.type, 19) || v(a.type, 0) || v(a.type, 4) || v(a.type, 3) || v(a.type, 6) || v(a.type, 5) || v(a.type, 2) || v(a.type, 23) || v(a.type, 1)) + return w.create(a); + const c = b.h; + if (v(a.type, 53)) { + const d = a.value; + if (d.node.nodeType === 2 || d.node.nodeType === 3) + return w.create(g(ib(c, d), 19)); + if (d.node.nodeType === 8 || d.node.nodeType === 7) + return w.create(g(ib(c, d), 1)); + const e = []; + (function k(h) { + if (d.node.nodeType !== 8 && d.node.nodeType !== 7) { + var l = h.nodeType; + l === 3 || l === 4 ? e.push(c.getData(h)) : l !== 1 && l !== 9 || c.getChildNodes(h).forEach((n) => { + k(n); + }); + } + })(d.node); + return w.create(g(e.join(""), 19)); + } + if (v(a.type, 60) && !v(a.type, 62)) + throw nc(a.type); + if (v(a.type, 62)) + return jc(a.h.map((d) => qc(d(), b))); + throw Error(`Atomizing ${a.type} is not implemented.`); + } + function qc(a, b) { + let c = false; + const d = a.value; + let e = null; + return w.create({next: () => { + for (; !c; ) { + if (!e) { + var f = d.next(0); + if (f.done) { + c = true; + break; + } + e = pc(f.value, b).value; + } + f = e.next(0); + if (f.done) + e = null; + else + return f; + } + return p; + }}); + } + function rc(a) { + for (a = ua[a]; a && a.C !== 0; ) + a = a.parent; + return a ? a.type : null; + } + function sc(a, b) { + b = ua[b]; + const c = b.Ja; + if (!c || !c.whiteSpace) + return b.parent ? sc(a, b.parent.type) : a; + switch (b.Ja.whiteSpace) { + case "replace": + return a.replace(/[\u0009\u000A\u000D]/g, " "); + case "collapse": + return a.replace(/[\u0009\u000A\u000D]/g, " ").replace(/ {2,}/g, " ").replace(/^ | $/g, ""); + } + return a; + } + function tc(a, b) { + for (b = ua[b]; b && b.fb === null; ) { + if (b.C === 2 || b.C === 3) + return true; + b = b.parent; + } + return b ? b.fb(a) : true; + } + function xc(a, b) { + for (; a; ) { + if (a.Oa && a.Oa[b]) + return a.Oa[b]; + a = a.parent; + } + return () => true; + } + function yc(a, b) { + let c = ua[b]; + for (; c; ) { + if (c.Ja && !Object.keys(c.Ja).every((d) => { + if (d === "whiteSpace") + return true; + const e = xc(c, d); + return e ? e(a, c.Ja[d]) : true; + })) + return false; + c = c.parent; + } + return true; + } + function zc(a) { + return a ? a.g === 2 || a.g === 0 : true; + } + function Ac(a) { + return a(1) || a(19) ? (b) => ({u: true, value: g(b, 20)}) : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:anyURI or any of its derived types.")}); + } + function Bc(a) { + return a(22) ? (b) => { + let c = ""; + for (let d = 0; d < b.length; d += 2) + c += String.fromCharCode(parseInt(b.substr(d, 2), 16)); + return {u: true, value: g(btoa(c), 21)}; + } : a(1) || a(19) ? (b) => ({u: true, value: g(b, 21)}) : () => ({error: Error("XPTY0004: Casting not supported from given type to xs:base64Binary or any of its derived types."), u: false}); + } + function Cc(a) { + return a(2) ? (b) => ({u: true, value: b === 0 || isNaN(b) ? wa : va}) : a(1) || a(19) ? (b) => { + switch (b) { + case "true": + case "1": + return {u: true, value: va}; + case "false": + case "0": + return {u: true, value: wa}; + default: + return {u: false, error: Error("XPTY0004: Casting not supported from given type to xs:boolean or any of its derived types.")}; + } + } : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:boolean or any of its derived types.")}); + } + function Dc(a) { + return a(9) ? (b) => ({u: true, value: g(Lb(b, 7), 7)}) : a(19) || a(1) ? (b) => ({u: true, value: g(Jb(b), 7)}) : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:date or any of its derived types.")}); + } + function Ec(a) { + return a(7) ? (b) => ({u: true, value: g(Lb(b, 9), 9)}) : a(19) || a(1) ? (b) => ({u: true, value: g(Jb(b), 9)}) : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:dateTime or any of its derived types.")}); + } + function Fc(a) { + return a(18) && !a(16) ? (b) => ({u: true, value: g(b.Ea, 17)}) : a(16) ? () => ({u: true, value: g(Ab("PT0.0S"), 17)}) : a(19) || a(1) ? (b) => { + const c = Ab(b); + return c ? {u: true, value: g(c, 17)} : {u: false, error: Error(`FORG0001: Can not cast ${b} to xs:dayTimeDuration`)}; + } : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:dayTimeDuration or any of its derived types.")}); + } + function Gc(a) { + return a(5) ? (b) => ({u: true, value: g(b, 4)}) : a(6) || a(3) ? (b) => isNaN(b) || !isFinite(b) ? {u: false, error: Error(`FOCA0002: Can not cast ${b} to xs:decimal`)} : Math.abs(b) > Number.MAX_VALUE ? {u: false, error: Error(`FOAR0002: Can not cast ${b} to xs:decimal, it is out of bounds for JavaScript numbers`)} : {u: true, value: g(b, 4)} : a(0) ? (b) => ({u: true, value: g(b ? 1 : 0, 4)}) : a(1) || a(19) ? (b) => { + const c = parseFloat(b); + return !isNaN(c) || isFinite(c) ? {u: true, value: g(c, 4)} : {u: false, error: Error(`FORG0001: Can not cast ${b} to xs:decimal`)}; + } : () => ({ + u: false, + error: Error("XPTY0004: Casting not supported from given type to xs:decimal or any of its derived types.") + }); + } + function Hc(a, b) { + return a(2) ? (c) => ({u: true, value: c}) : a(0) ? (c) => ({u: true, value: c ? 1 : 0}) : a(1) || a(19) ? (c) => { + switch (c) { + case "NaN": + return {u: true, value: NaN}; + case "INF": + case "+INF": + return {u: true, value: Infinity}; + case "-INF": + return {u: true, value: -Infinity}; + case "0": + case "+0": + return {u: true, value: 0}; + case "-0": + return {u: true, value: -0}; + } + const d = parseFloat(c); + return isNaN(d) ? {u: false, error: kc(c, b)} : {u: true, value: d}; + } : () => ({u: false, error: Error(`XPTY0004: Casting not supported from given type to ${b} or any of its derived types.`)}); + } + function Ic(a) { + const b = Hc(a, 3); + return (c) => { + c = b(c); + return c.u ? {u: true, value: g(c.value, 3)} : c; + }; + } + function Jc(a) { + const b = Math.abs(a.ab()); + a = Math.abs(a.$a()); + return `${b ? `${b}Y` : ""}${a ? `${a}M` : ""}` || "0M"; + } + var Kc = class extends wb { + constructor(a) { + super(); + if (a > Number.MAX_SAFE_INTEGER || a < Number.MIN_SAFE_INTEGER) + throw Error("FODT0002: Number of months given to construct YearMonthDuration overflows MAX_SAFE_INTEGER or MIN_SAFE_INTEGER"); + this.ea = a; + } + $a() { + const a = this.ea % 12; + return a === 0 ? 0 : a; + } + h() { + return this.ea; + } + ab() { + return Math.trunc(this.ea / 12); + } + na() { + return Object.is(-0, this.ea) ? false : 0 <= this.ea; + } + toString() { + return (this.na() ? "P" : "-P") + Jc(this); + } + }, Lc = (a) => { + var b = /^(-)?P(\d+Y)?(\d+M)?(\d+D)?(?:T(\d+H)?(\d+M)?(\d+(\.\d*)?S)?)?$/.exec(a); + if (b) { + a = !b[1]; + b = 12 * (b[2] ? parseInt(b[2], 10) : 0) + (b[3] ? parseInt(b[3], 10) : 0); + if (b > Number.MAX_SAFE_INTEGER || !Number.isFinite(b)) + throw Error("FODT0002: Value overflow while constructing xs:yearMonthDuration"); + a = new Kc(a || b === 0 ? b : -b); + } else + a = null; + return a; + }; + function Mc(a, b) { + if (isNaN(b)) + throw Error("FOCA0005: Cannot multiply xs:yearMonthDuration by NaN"); + a = Math.round(a.ea * b); + if (a > Number.MAX_SAFE_INTEGER || !Number.isFinite(a)) + throw Error("FODT0002: Value overflow while constructing xs:yearMonthDuration"); + return new Kc(a < Number.MIN_SAFE_INTEGER || a === 0 ? 0 : a); + } + var Nc = class extends wb { + constructor(a, b) { + super(); + this.Va = a; + this.Ea = b; + } + Za() { + return this.Ea.Za(); + } + getHours() { + return this.Ea.getHours(); + } + getMinutes() { + return this.Ea.getMinutes(); + } + $a() { + return this.Va.$a(); + } + h() { + return this.Va.h(); + } + o() { + return this.Ea.o(); + } + getSeconds() { + return this.Ea.getSeconds(); + } + ab() { + return this.Va.ab(); + } + na() { + return this.Va.na() && this.Ea.na(); + } + toString() { + const a = this.na() ? "P" : "-P", b = Jc(this.Va), c = xb(this.Ea); + return b === "0M" ? a + c : c === "T0S" ? a + b : a + b + c; + } + }; + function Oc(a) { + return a(16) ? (b) => ({u: true, value: g(new Nc(b, new yb(b.na() ? 0 : -0)), 18)}) : a(17) ? (b) => { + b = new Nc(new Kc(b.na() ? 0 : -0), b); + return {u: true, value: g(b, 18)}; + } : a(18) ? (b) => ({u: true, value: g(b, 18)}) : a(19) || a(1) ? (b) => { + var c; + return c = new Nc(Lc(b), Ab(b)), {u: true, value: g(c, 18)}; + } : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:duration or any of its derived types.")}); + } + function Pc(a) { + const b = Hc(a, 6); + return (c) => { + c = b(c); + return c.u ? {u: true, value: g(c.value, 6)} : c; + }; + } + function Qc(a) { + return a(7) || a(9) ? (b) => ({u: true, value: g(Lb(b, 15), 15)}) : a(19) || a(1) ? (b) => ({u: true, value: g(Jb(b), 15)}) : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:gDay or any of its derived types.")}); + } + function Rc(a) { + return a(7) || a(9) ? (b) => ({u: true, value: g(Lb(b, 14), 14)}) : a(19) || a(1) ? (b) => ({u: true, value: g(Jb(b), 14)}) : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:gMonth or any of its derived types.")}); + } + function Sc(a) { + return a(7) || a(9) ? (b) => ({u: true, value: g(Lb(b, 13), 13)}) : a(19) || a(1) ? (b) => ({u: true, value: g(Jb(b), 13)}) : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:gMonthDay or any of its derived types.")}); + } + function Tc(a) { + return a(7) || a(9) ? (b) => ({u: true, value: g(Lb(b, 12), 12)}) : a(19) || a(1) ? (b) => ({u: true, value: g(Jb(b), 12)}) : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:gYear or any of its derived types.")}); + } + function Uc(a) { + return a(7) || a(9) ? (b) => ({u: true, value: g(Lb(b, 11), 11)}) : a(19) || a(1) ? (b) => ({u: true, value: g(Jb(b), 11)}) : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:gYearMonth or any of its derived types.")}); + } + function Vc(a) { + return a(21) ? (b) => { + b = atob(b); + let c = ""; + for (let d = 0, e = b.length; d < e; d++) + c += Number(b.charCodeAt(d)).toString(16); + return {u: true, value: g(c.toUpperCase(), 22)}; + } : a(1) || a(19) ? (b) => ({u: true, value: g(b, 22)}) : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:hexBinary or any of its derived types.")}); + } + function Wc(a) { + return a(0) ? (b) => ({u: true, value: g(b ? 1 : 0, 5)}) : a(2) ? (b) => { + const c = Math.trunc(b); + return !isFinite(c) || isNaN(c) ? {u: false, error: Error(`FOCA0002: can not cast ${b} to xs:integer`)} : Number.isSafeInteger(c) ? {u: true, value: g(c, 5)} : {u: false, error: Error(`FOAR0002: can not cast ${b} to xs:integer, it is out of bounds for JavaScript numbers.`)}; + } : a(1) || a(19) ? (b) => { + const c = parseInt(b, 10); + return isNaN(c) ? {u: false, error: kc(b, 5)} : Number.isSafeInteger(c) ? {u: true, value: g(c, 5)} : {u: false, error: Error(`FOCA0003: can not cast ${b} to xs:integer, it is out of bounds for JavaScript numbers.`)}; + } : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:integer or any of its derived types.")}); + } + const Xc = [3, 6, 4, 5]; + function Yc(a) { + var b = Zc; + return (c) => { + for (const d of Xc) { + const e = b(a, d)(c); + if (e.u) + return e; + } + return {u: false, error: Error(`XPTY0004: Casting not supported from "${c}" given type to xs:numeric or any of its derived types.`)}; + }; + } + function $c(a) { + if (a(1) || a(19)) + return (b) => ({u: true, value: b + ""}); + if (a(20)) + return (b) => ({u: true, value: b}); + if (a(23)) + return (b) => ({u: true, value: b.prefix ? `${b.prefix}:${b.localName}` : b.localName}); + if (a(44)) + return (b) => ({u: true, value: b.toString()}); + if (a(2)) { + if (a(5) || a(4)) + return (b) => ({u: true, value: (b + "").replace("e", "E")}); + if (a(6) || a(3)) + return (b) => isNaN(b) ? {u: true, value: "NaN"} : isFinite(b) ? Object.is(b, -0) ? {u: true, value: "-0"} : {u: true, value: (b + "").replace("e", "E").replace("E+", "E")} : {u: true, value: `${0 > b ? "-" : ""}INF`}; + } + return a(9) || a(7) || a(8) || a(15) || a(14) || a(13) || a(12) || a(11) ? (b) => ({u: true, value: b.toString()}) : a(16) ? (b) => ({u: true, value: b.toString()}) : a(17) ? (b) => ({u: true, value: b.toString()}) : a(18) ? (b) => ({u: true, value: b.toString()}) : a(22) ? (b) => ({u: true, value: b.toUpperCase()}) : (b) => ({u: true, value: b + ""}); + } + function ad(a) { + const b = $c(a); + return (c) => { + c = b(c); + return c.u ? {u: true, value: g(c.value, 1)} : c; + }; + } + function cd(a) { + return a(9) ? (b) => ({u: true, value: g(Lb(b, 8), 8)}) : a(19) || a(1) ? (b) => ({u: true, value: g(Jb(b), 8)}) : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:time or any of its derived types.")}); + } + function dd(a) { + const b = $c(a); + return (c) => { + c = b(c); + return c.u ? {u: true, value: g(c.value, 19)} : c; + }; + } + function ed(a) { + return a(18) && !a(17) ? (b) => ({u: true, value: g(b.Va, 16)}) : a(17) ? () => ({u: true, value: g(Lc("P0M"), 16)}) : a(19) || a(1) ? (b) => { + const c = Lc(b); + return c ? {u: true, value: g(c, 16)} : {u: false, error: kc(b, 16)}; + } : () => ({u: false, error: Error("XPTY0004: Casting not supported from given type to xs:yearMonthDuration or any of its derived types.")}); + } + const fd = [2, 5, 17, 16]; + function Zc(a, b) { + const c = (d) => v(a, d); + if (b === 39) + return () => ({u: false, error: Error("FORG0001: Casting to xs:error is always invalid.")}); + switch (b) { + case 19: + return dd(c); + case 1: + return ad(c); + case 6: + return Pc(c); + case 3: + return Ic(c); + case 4: + return Gc(c); + case 5: + return Wc(c); + case 2: + return Yc(a); + case 18: + return Oc(c); + case 16: + return ed(c); + case 17: + return Fc(c); + case 9: + return Ec(c); + case 8: + return cd(c); + case 7: + return Dc(c); + case 11: + return Uc(c); + case 12: + return Tc(c); + case 13: + return Sc(c); + case 15: + return Qc(c); + case 14: + return Rc(c); + case 0: + return Cc(c); + case 21: + return Bc(c); + case 22: + return Vc(c); + case 20: + return Ac(c); + case 23: + throw Error("Casting to xs:QName is not implemented."); + } + return () => ({u: false, error: Error(`XPTY0004: Casting not supported from ${a} to ${b}.`)}); + } + const gd = Object.create(null); + function hd(a, b) { + if (a === 19 && b === 1) + return (f) => ({u: true, value: g(f, 1)}); + if (b === 44) + return () => ({u: false, error: Error("XPST0080: Casting to xs:NOTATION is not permitted.")}); + if (b === 39) + return () => ({u: false, error: Error("FORG0001: Casting to xs:error is not permitted.")}); + if (a === 45 || b === 45) + return () => ({u: false, error: Error("XPST0080: Casting from or to xs:anySimpleType is not permitted.")}); + if (a === 46 || b === 46) + return () => ({u: false, error: Error("XPST0080: Casting from or to xs:anyAtomicType is not permitted.")}); + if (v(a, 60) && b === 1) + return () => ({u: false, error: Error("FOTY0014: Casting from function item to xs:string is not permitted.")}); + if (a === b) + return (f) => ({u: true, value: {type: b, value: f}}); + const c = fd.includes(a) ? a : rc(a), d = fd.includes(b) ? b : rc(b); + if (d === null || c === null) + return () => ({u: false, error: Error(`XPST0081: Can not cast: type ${d ? Ea[a] : Ea[b]} is unknown.`)}); + const e = []; + c !== 1 && c !== 19 || e.push((f) => { + const h = sc(f, b); + return tc(h, b) ? {u: true, value: h} : {u: false, error: kc(f, b, "pattern validation failed.")}; + }); + c !== d && (e.push(Zc(c, d)), e.push((f) => ({ + u: true, + value: f.value + }))); + d !== 19 && d !== 1 || e.push((f) => tc(f, b) ? {u: true, value: f} : {u: false, error: kc(f, b, "pattern validation failed.")}); + e.push((f) => yc(f, b) ? {u: true, value: f} : {u: false, error: kc(f, b, "pattern validation failed.")}); + e.push((f) => ({u: true, value: {type: b, value: f}})); + return (f) => { + f = {u: true, value: f}; + for (let h = 0, k = e.length; h < k && (f = e[h](f.value), f.u !== false); ++h) + ; + return f; + }; + } + function id(a, b) { + const c = a.type + 1e4 * b; + let d = gd[c]; + d || (d = gd[c] = hd(a.type, b)); + return d.call(void 0, a.value, b); + } + function jd(a, b) { + a = id(a, b); + if (a.u === true) + return a.value; + throw a.error; + } + function kd(a) { + let b = false; + return {next: () => { + if (b) + return p; + b = true; + return q(a); + }}; + } + function ld(a, b) { + return a === b ? true : a && b && a.offset === b.offset && a.parent === b.parent ? ld(a.F, b.F) : false; + } + function md(a, b) { + return a === b || a.node === b.node && ld(a.F, b.F) ? true : false; + } + function nd(a, b, c) { + var d = x(a, b, null); + a = hb(a, d, null); + for (let e = 0, f = a.length; e < f; ++e) { + d = a[e]; + if (md(d, b)) + return -1; + if (md(d, c)) + return 1; + } + } + function od(a, b) { + const c = []; + for (; b; b = x(a, b, null)) + c.unshift(b); + return c; + } + function pd(a, b) { + const c = []; + for (; b; b = a.getParentNode(b, null)) + c.unshift(b); + return c; + } + function qd(a, b, c, d) { + if (c.F || d.F || cb(c.node) || cb(d.node)) { + if (md(c, d)) + return 0; + c = od(b, c); + d = od(b, d); + const f = c[0], h = d[0]; + if (!md(f, h)) + return b = a.findIndex((k) => md(k, f)), c = a.findIndex((k) => md(k, h)), b === -1 && (b = a.push(f)), c === -1 && (c = a.push(h)), b - c; + a = 1; + for (var e = Math.min(c.length, d.length); a < e && md(c[a], d[a]); ++a) + ; + return c[a] ? d[a] ? nd(b, c[a], d[a]) : 1 : -1; + } + c = c.node; + e = d.node; + if (c === e) + return 0; + d = pd(b, c); + c = pd(b, e); + if (d[0] !== c[0]) { + const f = {node: d[0], F: null}, h = {node: c[0], F: null}; + b = a.findIndex((k) => md(k, f)); + c = a.findIndex((k) => md(k, h)); + b === -1 && (b = a.push(f)); + c === -1 && (c = a.push(h)); + return b - c; + } + a = 1; + for (e = Math.min(d.length, c.length); a < e && d[a] === c[a]; ++a) + ; + d = d[a]; + e = c[a]; + if (!d) + return -1; + if (!e) + return 1; + b = b.getChildNodes(c[a - 1], null); + for (let f = 0, h = b.length; f < h; ++f) { + a = b[f]; + if (a === d) + return -1; + if (a === e) + return 1; + } + } + function rd(a, b, c, d) { + const e = v(c.type, 47), f = v(d.type, 47); + if (e && !f) { + if (c = x(b, c.value), d = d.value, md(c, d)) + return 1; + } else if (f && !e) { + if (c = c.value, d = x(b, d.value), md(c, d)) + return -1; + } else if (e && f) { + if (md(x(b, d.value), x(b, c.value))) + return c.value.node.localName > d.value.node.localName ? 1 : -1; + c = x(b, c.value); + d = x(b, d.value); + } else + c = c.value, d = d.value; + return qd(a, b, c, d); + } + function sd(a, b, c) { + return rd(a.o, a, b, c); + } + function td(a, b) { + return ud(b, (c, d) => rd(a.o, a, c, d)).filter((c, d, e) => d === 0 ? true : !md(c.value, e[d - 1].value)); + } + const vd = (a, b) => a < b ? -1 : 0; + function ud(a, b = vd) { + if (1 >= a.length) + return a; + var c = Math.floor(a.length / 2); + const d = ud(a.slice(0, c), b); + a = ud(a.slice(c), b); + for (c = []; d.length && a.length; ) + 0 > b(d[0], a[0]) ? c.push(d.shift()) : c.push(a.shift()); + return c.concat(d.concat(a)); + } + var wd = xspattern2; + function xd(a, b) { + if (v(a.type, 2)) { + if (v(a.type, 6)) + return b === 3 ? g(a.value, 3) : null; + if (v(a.type, 4)) { + if (b === 6) + return g(a.value, 6); + if (b === 3) + return g(a.value, 3); + } + return null; + } + return v(a.type, 20) && b === 1 ? g(a.value, 1) : null; + } + function yd(a, b, c, d, e) { + if (v(a.type, b.type)) + return a; + v(b.type, 46) && v(a.type, 53) && (a = pc(a, c).first()); + if (v(a.type, b.type) || b.type === 46) + return a; + if (v(a.type, 19)) { + c = jd(a, b.type); + if (!c) + throw Error(`XPTY0004 Unable to convert ${e ? "return" : "argument"} of type ${Ea[a.type]} to type ${Ha(b)} while calling ${d}`); + return c; + } + c = xd(a, b.type); + if (!c) + throw Error(`XPTY0004 Unable to cast ${e ? "return" : "argument"} of type ${Ea[a.type]} to type ${Ha(b)} while calling ${d}`); + return c; + } + function zd(a) { + switch (a) { + case 2: + return "*"; + case 1: + return "+"; + case 0: + return "?"; + case 3: + return ""; + } + } + var Ad = (a, b, c, d, e) => a.g === 0 ? b.Y({default: () => b.map((f) => yd(f, a, c, d, e)), multiple: () => { + throw Error(`XPTY0004: Multiplicity of ${e ? "function return value" : "function argument"} of type ${Ea[a.type]}${zd(a.g)} for ${d} is incorrect. Expected "?", but got "+".`); + }}) : a.g === 1 ? b.Y({empty: () => { + throw Error(`XPTY0004: Multiplicity of ${e ? "function return value" : "function argument"} of type ${Ea[a.type]}${zd(a.g)} for ${d} is incorrect. Expected "+", but got "empty-sequence()"`); + }, default: () => b.map((f) => yd(f, a, c, d, e))}) : a.g === 2 ? b.map((f) => yd(f, a, c, d, e)) : b.Y({m: () => b.map((f) => yd(f, a, c, d, e)), default: () => { + throw Error(`XPTY0004: Multiplicity of ${e ? "function return value" : "function argument"} of type ${Ea[a.type]}${zd(a.g)} for ${d} is incorrect. Expected exactly one`); + }}); + function Bd(a, b) { + return v(a, 5) ? g(b, 5) : v(a, 6) ? g(b, 6) : v(a, 3) ? g(b, 3) : g(b, 4); + } + const Cd = [{la: "M", ja: 1e3}, {la: "CM", ja: 900}, {la: "D", ja: 500}, {la: "CD", ja: 400}, {la: "C", ja: 100}, {la: "XC", ja: 90}, {la: "L", ja: 50}, {la: "XL", ja: 40}, {la: "X", ja: 10}, {la: "IX", ja: 9}, {la: "V", ja: 5}, {la: "IV", ja: 4}, {la: "I", ja: 1}]; + function Dd(a, b) { + let c = parseInt(a, 10); + a = 0 > c; + c = Math.abs(c); + if (!c) + return "-"; + let d = Cd.reduce((e, f) => { + const h = Math.floor(c / f.ja); + c -= h * f.ja; + return e + f.la.repeat(h); + }, ""); + b && (d = d.toLowerCase()); + a && (d = `-${d}`); + return d; + } + const Ed = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""); + function Fd(a, b) { + a = parseInt(a, 10); + const c = 0 > a; + a = Math.abs(a); + if (!a) + return "-"; + let d = "", e; + for (; 0 < a; ) + e = (a - 1) % Ed.length, d = Ed[e] + d, a = (a - e) / Ed.length | 0; + b && (d = d.toLowerCase()); + c && (d = `-${d}`); + return d; + } + function Gd(a) { + if (Math.floor(a) === a || isNaN(a)) + return 0; + a = /\d+(?:\.(\d*))?(?:[Ee](-)?(\d+))*/.exec(`${a}`); + const b = a[1] ? a[1].length : 0; + if (a[3]) { + if (a[2]) + return b + parseInt(a[3], 10); + a = b - parseInt(a[3], 10); + return 0 > a ? 0 : a; + } + return b; + } + function Hd(a, b, c) { + return b && a * c % 1 % 0.5 === 0 ? Math.floor(a * c) % 2 === 0 ? Math.floor(a * c) / c : Math.ceil(a * c) / c : Math.round(a * c) / c; + } + function Id(a, b, c, d, e, f) { + let h = false; + return w.create({next: () => { + if (h) + return p; + const k = e.first(); + if (!k) + return h = true, p; + if ((v(k.type, 6) || v(k.type, 3)) && (k.value === 0 || isNaN(k.value) || k.value === Infinity || k.value === -Infinity)) + return h = true, q(k); + var l; + f ? l = f.first().value : l = 0; + h = true; + if (Gd(k.value) < l) + return q(k); + const n = [5, 4, 3, 6].find((u) => v(k.type, u)), t = jd(k, 4); + l = Hd(t.value, a, Math.pow(10, l)); + switch (n) { + case 4: + return q(g(l, 4)); + case 3: + return q(g(l, 3)); + case 6: + return q(g(l, 6)); + case 5: + return q(g(l, 5)); + } + }}); + } + const Jd = (a, b, c, d) => qc(d, b).Y({empty: () => w.m(g(NaN, 3)), m: () => { + const e = id(d.first(), 3); + return e.u ? w.m(e.value) : w.m(g(NaN, 3)); + }, multiple: () => { + throw Error("fn:number may only be called with zero or one values"); + }}); + function Kd(a) { + let b = 5381; + for (let c = 0; c < a.length; ++c) + b = 33 * b + a.charCodeAt(c), b %= Number.MAX_SAFE_INTEGER; + return b; + } + const Ld = (a, b, c, d = w.empty()) => { + function e(f) { + const h = (k, l, n, t) => { + if (t.G() || t.sa()) + return t; + k = t.O(); + l = f; + for (n = k.length - 1; 1 < n; n--) { + l = gc(a, l).pb; + t = l % n; + const u = k[t]; + k[t] = k[n]; + k[n] = u; + } + return w.create(k); + }; + return w.m(new ub([{key: g("number", 1), value: () => w.m(g(gc(a, f).Yb, 3))}, {key: g("next", 1), value: () => w.m(new Va({value: () => e(gc(a, f).pb), Xa: true, localName: "", namespaceURI: "", j: [], arity: 0, i: {type: 61, g: 3}}))}, {key: g("permute", 1), value: () => w.m(new Va({ + value: h, + Xa: true, + localName: "", + namespaceURI: "", + j: [{type: 59, g: 2}], + arity: 1, + i: {type: 59, g: 2} + }))}])); + } + b = d.G() ? gc(a) : gc(a, Kd(jd(d.first(), 1).value)); + return e(b.pb); + }; + var Md = [ + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "abs", j: [{type: 2, g: 0}], i: {type: 2, g: 0}, callFunction: (a, b, c, d) => d.map((e) => Bd(e.type, Math.abs(e.value)))}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "format-integer", j: [{type: 5, g: 0}, {type: 1, g: 3}], i: {type: 1, g: 3}, callFunction: (a, b, c, d, e) => { + a = d.first(); + e = e.first(); + if (d.G()) + return w.m(g("", 1)); + switch (e.value) { + case "I": + return d = Dd(a.value), w.m(g(d, 1)); + case "i": + return d = Dd(a.value, true), w.m(g(d, 1)); + case "A": + return w.m(g(Fd(a.value), 1)); + case "a": + return w.m(g(Fd(a.value, true), 1)); + default: + throw Error(`Picture: ${e.value} is not implemented yet. The supported picture strings are "A", "a", "I", and "i"`); + } + }}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "ceiling", j: [{type: 2, g: 0}], i: {type: 2, g: 0}, callFunction: (a, b, c, d) => d.map((e) => Bd(e.type, Math.ceil(e.value)))}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "floor", j: [{type: 2, g: 0}], i: {type: 2, g: 0}, callFunction: (a, b, c, d) => d.map((e) => Bd(e.type, Math.floor(e.value)))}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "round", j: [{type: 2, g: 0}], i: {type: 2, g: 0}, callFunction: Id.bind(null, false)}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "round", j: [{type: 2, g: 0}, {type: 5, g: 3}], i: {type: 2, g: 0}, callFunction: Id.bind(null, false)}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "round-half-to-even", j: [{type: 2, g: 0}], i: {type: 2, g: 0}, callFunction: Id.bind(null, true)}, + { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "round-half-to-even", + j: [{type: 2, g: 0}, {type: 5, g: 3}], + i: {type: 2, g: 0}, + callFunction: Id.bind(null, true) + }, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "number", j: [{type: 46, g: 0}], i: {type: 3, g: 3}, callFunction: Jd}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "number", j: [], i: {type: 3, g: 3}, callFunction: (a, b, c) => { + const d = a.N && Ad({type: 46, g: 0}, w.m(a.N), b, "fn:number", false); + if (!d) + throw lc("fn:number needs an atomizable context item."); + return Jd(a, b, c, d); + }}, + { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "random-number-generator", + j: [], + i: {type: 61, g: 3}, + callFunction: Ld + }, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "random-number-generator", j: [{type: 46, g: 0}], i: {type: 61, g: 3}, callFunction: Ld} + ]; + function Nd() { + throw Error("FOCH0002: No collations are supported"); + } + function Od(a, b, c, d) { + if (b.N === null) + throw lc("The function which was called depends on dynamic context, which is absent."); + return a(b, c, d, w.m(b.N)); + } + const Pd = (a, b, c, d) => d.Y({empty: () => w.m(g("", 1)), default: () => d.map((e) => { + if (v(e.type, 53)) { + const f = pc(e, b).first(); + return v(e.type, 47) ? jd(f, 1) : f; + } + return jd(e, 1); + })}), Qd = (a, b, c, d, e) => A([e], ([f]) => qc(d, b).M((h) => { + h = h.map((k) => jd(k, 1).value).join(f.value); + return w.m(g(h, 1)); + })), Rd = (a, b, c, d) => { + if (d.G()) + return w.m(g(0, 5)); + a = d.first().value; + return w.m(g(Array.from(a).length, 5)); + }, Sd = (a, b, c, d, e, f) => { + const h = Id(false, a, b, c, e, null), k = f !== null ? Id(false, a, b, c, f, null) : null; + let l = false, n = null, t = null, u = null; + return w.create({next: () => { + if (l) + return p; + if (!n && (n = d.first(), n === null)) + return l = true, q(g("", 1)); + t || (t = h.first()); + !u && f && (u = null, u = k.first()); + l = true; + return q(g(Array.from(n.value).slice(Math.max(t.value - 1, 0), f ? t.value + u.value - 1 : void 0).join(""), 1)); + }}); + }, Ud = (a, b, c, d, e) => { + if (d.G() || d.first().value.length === 0) + return w.empty(); + a = d.first().value; + e = e.first().value; + e = Td(e); + return w.create(a.split(e).map((f) => g(f, 1))); + }, Vd = (a, b, c, d) => { + if (d.G()) + return w.m(g("", 1)); + a = d.first().value.trim(); + return w.m(g(a.replace(/\s+/g, " "), 1)); + }, Wd = new Map(), Xd = new Map(); + function Td(a) { + if (Xd.has(a)) + return Xd.get(a); + let b; + try { + b = new RegExp(a, "g"); + } catch (c) { + throw Error(`FORX0002: ${c}`); + } + if (b.test("")) + throw Error(`FORX0003: the pattern ${a} matches the zero length string`); + Xd.set(a, b); + return b; + } + var Yd = [{namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "compare", j: [{type: 1, g: 0}, {type: 1, g: 0}], i: {type: 5, g: 0}, callFunction: (a, b, c, d, e) => { + if (d.G() || e.G()) + return w.empty(); + a = d.first().value; + e = e.first().value; + return a > e ? w.m(g(1, 5)) : a < e ? w.m(g(-1, 5)) : w.m(g(0, 5)); + }}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "compare", j: [{type: 1, g: 0}, {type: 1, g: 0}, {type: 1, g: 3}], i: {type: 5, g: 0}, callFunction: Nd}, { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "concat", + j: [{type: 46, g: 0}, {type: 46, g: 0}, 4], + i: {type: 1, g: 3}, + callFunction: (a, b, c, ...d) => { + d = d.map((e) => qc(e, b).M((f) => w.m(g(f.map((h) => h === null ? "" : jd(h, 1).value).join(""), 1)))); + return A(d, (e) => w.m(g(e.map((f) => f.value).join(""), 1))); + } + }, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "contains", j: [{type: 1, g: 0}, {type: 1, g: 0}, {type: 1, g: 0}], i: {type: 0, g: 3}, callFunction: Nd}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "contains", j: [{type: 1, g: 0}, {type: 1, g: 0}], i: {type: 0, g: 3}, callFunction: (a, b, c, d, e) => { + a = d.G() ? "" : d.first().value; + e = e.G() ? "" : e.first().value; + return e.length === 0 ? w.aa() : a.length === 0 ? w.V() : a.includes(e) ? w.aa() : w.V(); + }}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "ends-with", j: [{type: 1, g: 0}, {type: 1, g: 0}], i: {type: 0, g: 3}, callFunction: (a, b, c, d, e) => { + a = e.G() ? "" : e.first().value; + if (a.length === 0) + return w.aa(); + d = d.G() ? "" : d.first().value; + return d.length === 0 ? w.V() : d.endsWith(a) ? w.aa() : w.V(); + }}, { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "ends-with", + j: [{type: 1, g: 0}, {type: 1, g: 0}, {type: 1, g: 3}], + i: {type: 0, g: 3}, + callFunction: Nd + }, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "normalize-space", j: [{type: 1, g: 0}], i: {type: 1, g: 3}, callFunction: Vd}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "normalize-space", j: [], i: {type: 1, g: 3}, callFunction: Od.bind(null, (a, b, c, d) => Vd(a, b, c, Pd(a, b, c, d)))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "starts-with", j: [{type: 1, g: 0}, {type: 1, g: 0}], i: {type: 0, g: 3}, callFunction: (a, b, c, d, e) => { + a = e.G() ? "" : e.first().value; + if (a.length === 0) + return w.aa(); + d = d.G() ? "" : d.first().value; + return d.length === 0 ? w.V() : d.startsWith(a) ? w.aa() : w.V(); + }}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "starts-with", j: [{type: 1, g: 0}, {type: 1, g: 0}, {type: 1, g: 3}], i: {type: 0, g: 3}, callFunction: Nd}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "string", j: [{type: 59, g: 0}], i: {type: 1, g: 3}, callFunction: Pd}, { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "string", + j: [], + i: {type: 1, g: 3}, + callFunction: Od.bind(null, Pd) + }, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "substring-before", j: [{type: 1, g: 0}, {type: 1, g: 0}], i: {type: 1, g: 3}, callFunction: (a, b, c, d, e) => { + a = d.G() ? "" : d.first().value; + e = e.G() ? "" : e.first().value; + if (e === "") + return w.m(g("", 1)); + e = a.indexOf(e); + return e === -1 ? w.m(g("", 1)) : w.m(g(a.substring(0, e), 1)); + }}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "substring-after", j: [{type: 1, g: 0}, {type: 1, g: 0}], i: {type: 1, g: 3}, callFunction: (a, b, c, d, e) => { + a = d.G() ? "" : d.first().value; + e = e.G() ? "" : e.first().value; + if (e === "") + return w.m(g(a, 1)); + b = a.indexOf(e); + return b === -1 ? w.m(g("", 1)) : w.m(g(a.substring(b + e.length), 1)); + }}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "substring", j: [{type: 1, g: 0}, {type: 3, g: 3}], i: {type: 1, g: 3}, callFunction: Sd}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "substring", j: [{type: 1, g: 0}, {type: 3, g: 3}, {type: 3, g: 3}], i: {type: 1, g: 3}, callFunction: Sd}, { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "upper-case", + j: [{type: 1, g: 0}], + i: {type: 1, g: 3}, + callFunction: (a, b, c, d) => d.G() ? w.m(g("", 1)) : d.map((e) => g(e.value.toUpperCase(), 1)) + }, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "lower-case", j: [{type: 1, g: 0}], i: {type: 1, g: 3}, callFunction: (a, b, c, d) => d.G() ? w.m(g("", 1)) : d.map((e) => g(e.value.toLowerCase(), 1))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "string-join", j: [{type: 46, g: 2}, {type: 1, g: 3}], i: {type: 1, g: 3}, callFunction: Qd}, { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "string-join", + j: [{type: 46, g: 2}], + i: {type: 1, g: 3}, + callFunction(a, b, c, d) { + return Qd(a, b, c, d, w.m(g("", 1))); + } + }, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "string-length", j: [{type: 1, g: 0}], i: {type: 5, g: 3}, callFunction: Rd}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "string-length", j: [], i: {type: 5, g: 3}, callFunction: Od.bind(null, (a, b, c, d) => Rd(a, b, c, Pd(a, b, c, d)))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "tokenize", j: [{type: 1, g: 0}, { + type: 1, + g: 3 + }, {type: 1, g: 3}], i: {type: 1, g: 2}, callFunction() { + throw Error("Not implemented: Using flags in tokenize is not supported"); + }}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "tokenize", j: [{type: 1, g: 0}, {type: 1, g: 3}], i: {type: 1, g: 2}, callFunction: Ud}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "tokenize", j: [{type: 1, g: 0}], i: {type: 1, g: 2}, callFunction(a, b, c, d) { + return Ud(a, b, c, Vd(a, b, c, d), w.m(g(" ", 1))); + }}, {j: [{type: 1, g: 0}, {type: 1, g: 3}, {type: 1, g: 3}], callFunction: (a, b, c, d, e, f) => A([d, e, f], ([h, k, l]) => { + h = Array.from(h ? h.value : ""); + const n = Array.from(k.value), t = Array.from(l.value); + k = h.map((u) => { + if (n.includes(u)) { + if (u = n.indexOf(u), u <= t.length) + return t[u]; + } else + return u; + }); + return w.m(g(k.join(""), 1)); + }), localName: "translate", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 1, g: 3}}, {j: [{type: 5, g: 2}], callFunction: (a, b, c, d) => d.M((e) => { + e = e.map((f) => { + f = f.value; + if (f === 9 || f === 10 || f === 13 || 32 <= f && 55295 >= f || 57344 <= f && 65533 >= f || 65536 <= f && 1114111 >= f) + return String.fromCodePoint(f); + throw Error("FOCH0001"); + }).join(""); + return w.m(g(e, 1)); + }), localName: "codepoints-to-string", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 1, g: 3}}, {j: [{type: 1, g: 0}], callFunction: (a, b, c, d) => A([d], ([e]) => { + e = e ? e.value.split("") : []; + return e.length === 0 ? w.empty() : w.create(e.map((f) => g(f.codePointAt(0), 5))); + }), localName: "string-to-codepoints", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 5, g: 2}}, {j: [{type: 1, g: 0}], callFunction: (a, b, c, d) => A([d], ([e]) => e === null || e.value.length === 0 ? w.create(g("", 1)) : w.create(g(encodeURIComponent(e.value).replace(/[!'()*]/g, (f) => "%" + f.charCodeAt(0).toString(16).toUpperCase()), 1))), localName: "encode-for-uri", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 1, g: 3}}, { + j: [{type: 1, g: 0}], + callFunction: (a, b, c, d) => A([d], ([e]) => e === null || e.value.length === 0 ? w.create(g("", 1)) : w.create(g(e.value.replace(/([\u00A0-\uD7FF\uE000-\uFDCF\uFDF0-\uFFEF "<>{}|\\^`/\n\u007f\u0080-\u009f]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g, (f) => encodeURI(f)), 1))), + localName: "iri-to-uri", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 1, g: 3} + }, {j: [{type: 1, g: 0}, {type: 1, g: 0}], callFunction: (a, b, c, d, e) => A([d, e], ([f, h]) => { + if (f === null || h === null) + return w.empty(); + f = f.value; + var k = h.value; + if (f.length !== k.length) + return w.V(); + h = f.split(""); + f = k.split(""); + for (k = 0; k < h.length; k++) + if (h[k].codePointAt(0) !== f[k].codePointAt(0)) + return w.V(); + return w.aa(); + }), localName: "codepoint-equal", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 0, g: 0}}, {j: [{type: 1, g: 0}, {type: 1, g: 3}], callFunction: (a, b, c, d, e) => A([d, e], ([f, h]) => { + f = f ? f.value : ""; + h = h.value; + let k = Wd.get(h); + if (!k) { + try { + k = (0, wd.compile)(h, {language: "xpath"}); + } catch (l) { + throw Error(`FORX0002: ${l}`); + } + Wd.set(h, k); + } + return k(f) ? w.aa() : w.V(); + }), localName: "matches", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 0, g: 3}}, {j: [{type: 1, g: 0}, {type: 1, g: 3}, {type: 1, g: 3}], callFunction: (a, b, c, d, e, f) => A([d, e, f], ([h, k, l]) => { + h = h ? h.value : ""; + k = k.value; + l = l.value; + if (l.includes("$0")) + throw Error("Using $0 in fn:replace to replace substrings with full matches is not supported."); + l = l.split(/((?:\$\$)|(?:\\\$)|(?:\\\\))/).map((n) => { + switch (n) { + case "\\$": + return "$$"; + case "\\\\": + return "\\"; + case "$$": + throw Error('FORX0004: invalid replacement: "$$"'); + default: + return n; + } + }).join(""); + k = Td(k); + h = h.replace(k, l); + return w.m(g(h, 1)); + }), localName: "replace", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 1, g: 3}}, {j: [{type: 1, g: 0}, {type: 1, g: 3}, {type: 1, g: 3}, {type: 1, g: 3}], localName: "replace", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 1, g: 3}, callFunction() { + throw Error("Not implemented: Using flags in replace is not supported"); + }}]; + function Zd(a, b, c, d, e) { + if (c.N === null) + throw lc(`The function ${a} depends on dynamic context, which is absent.`); + return b(c, d, e, w.m(c.N)); + } + const $d = (a, b, c, d) => A([d], ([e]) => { + if (e === null) + return w.empty(); + e = e.value; + switch (e.node.nodeType) { + case 1: + case 2: + return w.m(g(new Ta(e.node.prefix, e.node.namespaceURI, e.node.localName), 23)); + case 7: + return w.m(g(new Ta("", "", e.node.target), 23)); + default: + return w.empty(); + } + }), ae = (a, b, c, d) => d.Y({default: () => Pd(a, b, c, $d(a, b, c, d)), empty: () => w.m(g("", 1))}), ce = (a, b, c, d) => qc(d, b), de = (a, b, c, d) => A([d], ([e]) => { + e = e ? e.value : null; + return e !== null && jb(b.h, e, null) ? w.aa() : w.V(); + }), ee = (a, b, c, d) => A([d], ([e]) => { + function f(n) { + let t = 0, u = n; + for (; u !== null; ) + (n.node.nodeType !== u.node.nodeType ? 0 : u.node.nodeType === 1 ? u.node.localName === n.node.localName && u.node.namespaceURI === n.node.namespaceURI : u.node.nodeType === 7 ? u.node.target === n.node.target : 1) && t++, u = mb(h, u, null); + return t; + } + if (e === null) + return w.empty(); + const h = b.h; + let k = ""; + for (e = e.value; x(b.h, e, null) !== null; e = x(b.h, e, null)) + switch (e.node.nodeType) { + case 1: + var l = e; + k = `/Q{${l.node.namespaceURI || ""}}${l.node.localName}[${f(l)}]${k}`; + break; + case 2: + l = e; + k = `/@${l.node.namespaceURI ? `Q{${l.node.namespaceURI}}` : ""}${l.node.localName}${k}`; + break; + case 3: + k = `/text()[${f(e)}]${k}`; + break; + case 7: + l = e; + k = `/processing-instruction(${l.node.target})[${f(l)}]${k}`; + break; + case 8: + k = `/comment()[${f(e)}]${k}`; + } + return e.node.nodeType === 9 ? w.create(g(k || "/", 1)) : w.create(g("Q{http://www.w3.org/2005/xpath-functions}root()" + k, 1)); + }), fe = (a, b, c, d) => d.map((e) => g(e.value.node.namespaceURI || "", 20)), ge = (a, b, c, d) => d.Y({default: () => d.map((e) => e.value.node.nodeType === 7 ? g(e.value.node.target, 1) : g(e.value.node.localName || "", 1)), empty: () => w.m(g("", 1))}); + function he(a, b, c) { + if (b.node.nodeType === 2) + return md(b, c); + for (; c; ) { + if (md(b, c)) + return true; + if (c.node.nodeType === 9) + break; + c = x(a, c, null); + } + return false; + } + const ie = (a, b, c, d) => d.map((e) => { + if (!v(e.type, 53)) + throw Error("XPTY0004 Argument passed to fn:root() should be of the type node()"); + let f; + for (e = e.value; e; ) + f = e, e = x(b.h, f, null); + return rb(f); + }); + var je = [{j: [{type: 53, g: 0}], callFunction: ae, localName: "name", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 1, g: 3}}, {j: [], callFunction: Zd.bind(null, "name", ae), localName: "name", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 1, g: 3}}, {j: [{type: 53, g: 3}], callFunction: fe, localName: "namespace-uri", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 20, g: 3}}, { + j: [], + callFunction: Zd.bind(null, "namespace-uri", fe), + localName: "namespace-uri", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 20, g: 3} + }, {j: [{type: 53, g: 2}], callFunction: (a, b, c, d) => d.M((e) => { + if (!e.length) + return w.empty(); + e = td(b.h, e).reduceRight((f, h, k, l) => { + if (k === l.length - 1) + return f.push(h), f; + if (he(b.h, h.value, f[0].value)) + return f; + f.unshift(h); + return f; + }, []); + return w.create(e); + }), localName: "innermost", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 53, g: 2}}, {j: [{type: 53, g: 2}], callFunction: (a, b, c, d) => d.M((e) => { + if (!e.length) + return w.empty(); + e = td(b.h, e).reduce((f, h, k) => { + if (k === 0) + return f.push(h), f; + if (he(b.h, f[f.length - 1].value, h.value)) + return f; + f.push(h); + return f; + }, []); + return w.create(e); + }, 1), localName: "outermost", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 53, g: 2}}, {j: [{type: 53, g: 0}], callFunction: de, localName: "has-children", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 0, g: 3}}, {j: [], callFunction: Zd.bind(null, "has-children", de), localName: "has-children", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 0, g: 3}}, { + j: [{type: 53, g: 0}], + callFunction: ee, + localName: "path", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 1, g: 0} + }, {j: [], callFunction: Zd.bind(null, "path", ee), localName: "path", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 1, g: 0}}, {j: [{type: 53, g: 0}], callFunction: $d, localName: "node-name", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 23, g: 0}}, {j: [], callFunction: Zd.bind(null, "node-name", $d), localName: "node-name", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 23, g: 0}}, { + j: [{type: 53, g: 0}], + callFunction: ge, + localName: "local-name", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 1, g: 3} + }, {j: [], callFunction: Zd.bind(null, "local-name", ge), localName: "local-name", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 1, g: 3}}, {j: [{type: 53, g: 0}], callFunction: ie, localName: "root", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 53, g: 0}}, {j: [], callFunction: Zd.bind(null, "root", ie), localName: "root", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 53, g: 0}}, { + j: [], + callFunction: Zd.bind(null, "data", ce), + localName: "data", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 46, g: 2} + }, {j: [{type: 59, g: 2}], callFunction: ce, localName: "data", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 46, g: 2}}]; + function ke(a, b) { + let c = 0; + const d = a.length; + let e = false, f = null; + return {next: () => { + if (!e) { + for (; c < d; ) { + f || (f = b(a[c], c, a)); + const h = f.next(0); + f = null; + if (h.value) + c++; + else + return q(false); + } + e = true; + return q(true); + } + return p; + }}; + } + function le(a) { + a = a.node.nodeType; + return a === 1 || a === 3; + } + function me(a, b) { + if ((v(a.type, 4) || v(a.type, 6)) && (v(b.type, 4) || v(b.type, 6))) { + var c = jd(a, 6), d = jd(b, 6); + return c.value === d.value || isNaN(a.value) && isNaN(b.value); + } + return (v(a.type, 4) || v(a.type, 6) || v(a.type, 3)) && (v(b.type, 4) || v(b.type, 6) || v(b.type, 3)) ? (c = jd(a, 3), d = jd(b, 3), c.value === d.value || isNaN(a.value) && isNaN(b.value)) : v(a.type, 23) && v(b.type, 23) ? a.value.namespaceURI === b.value.namespaceURI && a.value.localName === b.value.localName : (v(a.type, 9) || v(a.type, 7) || v(a.type, 8) || v(a.type, 11) || v(a.type, 12) || v(a.type, 13) || v(a.type, 14) || v(a.type, 15)) && (v(b.type, 9) || v(b.type, 7) || v(b.type, 8) || v(b.type, 11) || v(b.type, 12) || v(b.type, 13) || v(b.type, 14) || v(b.type, 15)) ? Ob(a.value, b.value) : (v(a.type, 16) || v(a.type, 17) || v(a.type, 18)) && (v(b.type, 16) || v(b.type, 17) || v(b.type, 17)) ? vb(a.value, b.value) : a.value === b.value; + } + function ne(a, b, c) { + const [d, e] = [b, c].map((f) => ({type: 1, value: f.reduce((h, k) => h += pc(k, a).first().value, "")})); + return q(me(d, e)); + } + function oe(a, b, c, d) { + for (; a.value && v(a.value.type, 56); ) { + b.push(a.value); + const e = lb(d, a.value.value); + a = c.next(0); + if (e && e.node.nodeType !== 3) + break; + } + return a; + } + function pe(a, b, c, d, e) { + const f = b.h, h = d.value, k = e.value; + let l = null, n = null, t = null, u; + const y = [], z = []; + return {next: () => { + for (; !u; ) + if (l || (l = h.next(0)), l = oe(l, y, h, f), n || (n = k.next(0)), n = oe(n, z, k, f), y.length || z.length) { + var F = ne(b, y, z); + y.length = 0; + z.length = 0; + if (F.value === false) + return u = true, F; + } else { + if (l.done || n.done) + return u = true, q(l.done === n.done); + t || (t = qe(a, b, c, l.value, n.value)); + F = t.next(0); + t = null; + if (F.value === false) + return u = true, F; + n = l = null; + } + return p; + }}; + } + function re(a, b, c, d, e) { + return d.h.length !== e.h.length ? kd(false) : ke(d.h, (f) => { + const h = e.h.find((k) => me(k.key, f.key)); + return h ? pe(a, b, c, f.value(), h.value()) : kd(false); + }); + } + function se(a, b, c, d, e) { + return d.h.length !== e.h.length ? kd(false) : ke(d.h, (f, h) => { + h = e.h[h]; + return pe(a, b, c, f(), h()); + }); + } + function te(a, b, c, d, e) { + d = hb(b.h, d.value); + e = hb(b.h, e.value); + d = d.filter((f) => le(f)); + e = e.filter((f) => le(f)); + d = w.create(d.map((f) => rb(f))); + e = w.create(e.map((f) => rb(f))); + return pe(a, b, c, d, e); + } + function ue(a, b, c, d, e) { + const f = pe(a, b, c, $d(a, b, c, w.m(d)), $d(a, b, c, w.m(e))), h = te(a, b, c, d, e); + d = fb(b.h, d.value).filter((n) => n.node.namespaceURI !== "http://www.w3.org/2000/xmlns/").sort((n, t) => n.node.nodeName > t.node.nodeName ? 1 : -1).map((n) => rb(n)); + e = fb(b.h, e.value).filter((n) => n.node.namespaceURI !== "http://www.w3.org/2000/xmlns/").sort((n, t) => n.node.nodeName > t.node.nodeName ? 1 : -1).map((n) => rb(n)); + const k = pe(a, b, c, w.create(d), w.create(e)); + let l = false; + return {next: () => { + if (l) + return p; + var n = f.next(0); + if (!n.done && n.value === false) + return l = true, n; + n = k.next(0); + if (!n.done && n.value === false) + return l = true, n; + n = h.next(0); + l = true; + return n; + }}; + } + function ve(a, b, c, d, e) { + const f = pe(a, b, c, $d(a, b, c, w.m(d)), $d(a, b, c, w.m(e))); + let h = false; + return {next: () => { + if (h) + return p; + const k = f.next(0); + return k.done || k.value !== false ? q(me(pc(d, b).first(), pc(e, b).first())) : (h = true, k); + }}; + } + function qe(a, b, c, d, e) { + if (v(d.type, 46) && v(e.type, 46)) + return kd(me(d, e)); + if (v(d.type, 61) && v(e.type, 61)) + return re(a, b, c, d, e); + if (v(d.type, 62) && v(e.type, 62)) + return se(a, b, c, d, e); + if (v(d.type, 53) && v(e.type, 53)) { + if (v(d.type, 55) && v(e.type, 55)) + return te(a, b, c, d, e); + if (v(d.type, 54) && v(e.type, 54)) + return ue(a, b, c, d, e); + if (v(d.type, 47) && v(e.type, 47) || v(d.type, 57) && v(e.type, 57) || v(d.type, 58) && v(e.type, 58)) + return ve(a, b, c, d, e); + } + return kd(false); + } + var we = (a = "Can not execute an updating expression in a non-updating context.") => Error(`XUST0001: ${a}`), xe = (a) => Error(`XUTY0004: The attribute ${a.name}="${a.value}" follows a node that is not an attribute node.`), ye = () => Error("XUTY0005: The target of a insert expression with into must be a single element or document node."), ze = () => Error("XUTY0006: The target of a insert expression with before or after must be a single element, text, comment, or processing instruction node."), Ae = () => Error("XUTY0008: The target of a replace expression must be a single element, attribute, text, comment, or processing instruction node."), Be = () => Error("XUTY0012: The target of a rename expression must be a single element, attribute, or processing instruction node."), Ce = (a) => Error(`XUDY0017: The target ${a.outerHTML} is used in more than one replace value of expression.`), De = (a) => Error(`XUDY0021: Applying the updates will result in the XDM instance violating constraint: '${a}'`), Ee = (a) => Error(`XUDY0023: The namespace binding ${a} is conflicting.`), Fe = (a) => Error(`XUDY0024: The namespace binding ${a} is conflicting.`), Ge = () => Error("XUDY0027: The target for an insert, replace, or rename expression expression should not be empty."); + function B(a, b, c) { + b && b.N !== null ? a.B ? (a.nb === null && (a.nb = Ra(a.h(null, c).gb())), a = a.nb()) : a = a.h(b, c) : a = a.h(b, c); + return a; + } + var D = class { + constructor(a, b, c = {B: false, W: false, P: "unsorted", subtree: false}, d = false, e) { + this.o = a; + this.ia = c.P || "unsorted"; + this.subtree = !!c.subtree; + this.W = !!c.W; + this.B = !!c.B; + this.Ka = b; + this.J = false; + this.nb = null; + this.Nb = d; + this.type = e; + } + D() { + return null; + } + v(a) { + this.Ka.forEach((b) => b.v(a)); + if (!this.Nb && this.Ka.some((b) => b.J)) + throw we(); + } + }; + var He = class { + constructor(a, b) { + this.I = a; + this.da = b; + } + }; + var Ie = class { + constructor(a) { + a && typeof a === "object" && "nodeType" in a && (a = a.ownerDocument || a, typeof a.createElementNS === "function" && typeof a.createProcessingInstruction === "function" && typeof a.createTextNode === "function" && typeof a.createComment === "function" && (this.h = a)); + this.h || (this.h = null); + } + createAttributeNS(a, b) { + if (!this.h) + throw Error("Please pass a node factory if an XQuery script uses node constructors"); + return this.h.createAttributeNS(a, b); + } + createCDATASection(a) { + if (!this.h) + throw Error("Please pass a node factory if an XQuery script uses node constructors"); + return this.h.createCDATASection(a); + } + createComment(a) { + if (!this.h) + throw Error("Please pass a node factory if an XQuery script uses node constructors"); + return this.h.createComment(a); + } + createDocument() { + if (!this.h) + throw Error("Please pass a node factory if an XQuery script uses node constructors"); + return this.h.implementation.createDocument(null, null, null); + } + createElementNS(a, b) { + if (!this.h) + throw Error("Please pass a node factory if an XQuery script uses node constructors"); + return this.h.createElementNS(a, b); + } + createProcessingInstruction(a, b) { + if (!this.h) + throw Error("Please pass a node factory if an XQuery script uses node constructors"); + return this.h.createProcessingInstruction(a, b); + } + createTextNode(a) { + if (!this.h) + throw Error("Please pass a node factory if an XQuery script uses node constructors"); + return this.h.createTextNode(a); + } + }; + var Je = (a, b, c, d) => { + const e = x(c, a).node, f = (a = lb(c, a)) ? a.node : null; + b.forEach((h) => { + d.insertBefore(e, h.node, f); + }); + }, Ke = (a, b, c, d) => { + const e = x(c, a).node; + b.forEach((f) => { + d.insertBefore(e, f.node, a.node); + }); + }, Le = (a, b, c, d) => { + const e = (c = jb(c, a)) ? c.node : null; + b.forEach((f) => { + d.insertBefore(a.node, f.node, e); + }); + }, Me = (a, b, c) => { + b.forEach((d) => { + c.insertBefore(a.node, d.node, null); + }); + }, Ne = (a, b, c, d) => { + b.forEach((e) => { + const f = e.node.nodeName; + if (gb(c, a, f)) + throw De(`An attribute ${f} already exists.`); + d.setAttributeNS(a.node, e.node.namespaceURI, f, ib(c, e)); + }); + }, Pe = (a, b, c, d, e) => { + d || (d = new Ie(a ? a.node : null)); + let f; + switch (a.node.nodeType) { + case 1: + const h = c.getAllAttributes(a.node), k = c.getChildNodes(a.node), l = d.createElementNS(b.namespaceURI, b.ya()); + f = {node: l, F: null}; + h.forEach((n) => { + e.setAttributeNS(l, n.namespaceURI, n.nodeName, n.value); + }); + k.forEach((n) => { + e.insertBefore(l, n, null); + }); + break; + case 2: + b = d.createAttributeNS(b.namespaceURI, b.ya()); + b.value = ib(c, a); + f = {node: b, F: null}; + break; + case 7: + f = {node: d.createProcessingInstruction(b.ya(), ib(c, a)), F: null}; + } + if (!x(c, a)) + throw Error("Not supported: renaming detached nodes."); + Oe(a, [f], c, e); + }, Qe = (a, b, c, d) => { + c.getChildNodes(a.node).forEach((e) => d.removeChild(a.node, e)); + b && d.insertBefore(a.node, b.node, null); + }, Oe = (a, b, c, d) => { + const e = x(c, a); + var f = a.node.nodeType; + if (f === 2) { + if (b.some((k) => k.node.nodeType !== 2)) + throw Error('Constraint "If $target is an attribute node, $replacement must consist of zero or more attribute nodes." failed.'); + const h = e ? e.node : null; + d.removeAttributeNS(h, a.node.namespaceURI, a.node.nodeName); + b.forEach((k) => { + const l = k.node.nodeName; + if (gb(c, e, l)) + throw De(`An attribute ${l} already exists.`); + d.setAttributeNS(h, k.node.namespaceURI, l, ib(c, k)); + }); + } + if (f === 1 || f === 3 || f === 8 || f === 7) { + const h = (f = lb(c, a)) ? f.node : null; + d.removeChild(e.node, a.node); + b.forEach((k) => { + d.insertBefore(e.node, k.node, h); + }); + } + }; + var Se = (a, b, c, d) => { + Re(a, b); + a.filter((e) => ["insertInto", "insertAttributes", "replaceValue", "rename"].indexOf(e.type) !== -1).forEach((e) => { + switch (e.type) { + case "insertInto": + Me(e.target, e.content, d); + break; + case "insertAttributes": + Ne(e.target, e.content, b, d); + break; + case "rename": + Pe(e.target, e.o, b, c, d); + break; + case "replaceValue": + var f = e.target; + e = e.o; + if (f.node.nodeType === 2) { + const h = x(b, f); + h ? d.setAttributeNS(h.node, f.node.namespaceURI, f.node.nodeName, e) : f.node.value = e; + } else + d.setData(f.node, e); + } + }); + a.filter((e) => [ + "insertBefore", + "insertAfter", + "insertIntoAsFirst", + "insertIntoAsLast" + ].indexOf(e.type) !== -1).forEach((e) => { + switch (e.type) { + case "insertAfter": + Je(e.target, e.content, b, d); + break; + case "insertBefore": + Ke(e.target, e.content, b, d); + break; + case "insertIntoAsFirst": + Le(e.target, e.content, b, d); + break; + case "insertIntoAsLast": + Me(e.target, e.content, d); + } + }); + a.filter((e) => e.type === "replaceNode").forEach((e) => { + Oe(e.target, e.o, b, d); + }); + a.filter((e) => e.type === "replaceElementContent").forEach((e) => { + Qe(e.target, e.text, b, d); + }); + a.filter((e) => e.type === "delete").forEach((e) => { + e = e.target; + var f = x(b, e); + (f = f ? f.node : null) && (e.node.nodeType === 2 ? d.removeAttributeNS(f, e.node.namespaceURI, e.node.nodeName) : d.removeChild(f, e.node)); + }); + if (a.some((e) => e.type === "put")) + throw Error('Not implemented: the execution for pendingUpdate "put" is not yet implemented.'); + }; + const Re = (a, b) => { + function c(f, h) { + const k = new Set(); + a.filter((l) => l.type === f).map((l) => l.target).forEach((l) => { + l = l ? l.node : null; + k.has(l) && h(l); + k.add(l); + }); + } + c("rename", (f) => { + throw Error(`XUDY0015: The target ${f.outerHTML} is used in more than one rename expression.`); + }); + c("replaceNode", (f) => { + throw Error(`XUDY0016: The target ${f.outerHTML} is used in more than one replace expression.`); + }); + c("replaceValue", (f) => { + throw Ce(f); + }); + c("replaceElementContent", (f) => { + throw Ce(f); + }); + const d = new Map(), e = (f) => new Ta(f.node.prefix, f.node.namespaceURI, f.node.localName); + a.filter((f) => f.type === "replaceNode" && f.target.node.nodeType === 2).forEach((f) => { + var h = x(b, f.target); + h = h ? h.node : null; + const k = d.get(h); + k ? k.push(...f.o.map(e)) : d.set(h, f.o.map(e)); + }); + a.filter((f) => f.type === "rename" && f.target.node.nodeType === 2).forEach((f) => { + var h = x(b, f.target); + if (h) { + h = h.node; + var k = d.get(h); + k ? k.push(f.o) : d.set(h, [f.o]); + } + }); + d.forEach((f) => { + const h = {}; + f.forEach((k) => { + h[k.prefix] || (h[k.prefix] = k.namespaceURI); + if (h[k.prefix] !== k.namespaceURI) + throw Fe(k.namespaceURI); + }); + }); + }; + var Te = (a, ...b) => a.concat(...b.filter(Boolean)); + function Ue(a) { + return a.J ? (b, c) => a.s(b, c) : (b, c) => { + const d = a.h(b, c); + return {next: () => { + const e = d.O(); + return q({da: [], I: e}); + }}; + }; + } + var Ve = class extends D { + constructor(a, b, c, d) { + super(a, b, c, true, d); + this.J = true; + } + h() { + throw we(); + } + }; + function We(a, b) { + a = a.next(0); + b(a.value.da); + return w.create(a.value.I); + } + function Xe(a) { + a.Ka.some((b) => b.J) && (a.J = true); + } + var Ye = class extends Ve { + constructor(a, b, c, d) { + super(a, b, c, d); + this.J = this.Ka.some((e) => e.J); + } + h(a, b) { + return this.A(a, b, this.Ka.map((c) => (d) => c.h(d, b))); + } + s(a, b) { + let c = []; + const d = this.A(a, b, this.Ka.map((f) => f.J ? (h) => { + h = f.s(h, b); + return We(h, (k) => c = Te(c, k)); + } : (h) => f.h(h, b))); + let e = false; + return {next: () => { + if (e) + return p; + const f = d.O(); + e = true; + return q(new He(f, c)); + }}; + } + v(a) { + super.v(a); + Xe(this); + } + }; + const Ze = ["external", "attribute", "nodeName", "nodeType", "universal"], $e = Ze.length; + function af(a, b) { + for (let c = 0; c < $e; ++c) { + if (b.h[c] < a.h[c]) + return 1; + if (b.h[c] > a.h[c]) + return -1; + } + return 0; + } + var bf = class { + constructor(a) { + this.h = Ze.map((b) => a[b] || 0); + if (Object.keys(a).some((b) => !Ze.includes(b))) + throw Error("Invalid specificity kind passed"); + } + add(a) { + const b = Ze.reduce((c, d, e) => { + c[d] = this.h[e] + a.h[e]; + return c; + }, Object.create(null)); + return new bf(b); + } + }; + const cf = () => mc("Expected base expression of a function call to evaluate to a sequence of single function item"); + function df(a, b, c, d) { + const e = []; + for (let f = 0; f < b.length; ++f) { + if (b[f] === null) { + e.push(null); + continue; + } + const h = Ad(a[f], b[f], c, d, false); + e.push(h); + } + return e; + } + function ef(a, b) { + if (!v(a.type, 60)) + throw mc("Expected base expression to evaluate to a function item"); + if (a.v !== b) + throw cf(); + return a; + } + function ff(a, b, c, d, e, f, h) { + let k = 0; + e = e.map((l) => l ? null : f[k++](c)); + e = df(a.o, e, d, a.D); + if (0 <= e.indexOf(null)) + return Ua(a, e); + b = b.apply(void 0, [c, d, h, ...e]); + return Ad(a.s, b, d, a.D, true); + } + var hf = class extends Ye { + constructor(a, b, c) { + super(new bf({external: 1}), [a].concat(b.filter((d) => !!d)), {P: "unsorted", W: false, subtree: false, B: false}, c); + this.ma = b.length; + this.S = b.map((d) => d === null); + this.L = null; + this.xa = a; + this.La = b; + } + s(a, b) { + if (!this.l || !this.l.J) + return super.s(a, b); + let c = []; + const d = ff(this.l, (f, h, k, ...l) => We(this.l.value(f, h, k, ...l), (n) => { + c = Te(c, n); + }), a, b, this.S, this.La.map((f) => () => f.J ? We(f.s(a, b), (h) => { + c = Te(c, h); + }) : B(f, a, b)), this.L); + let e = false; + return {next: () => { + if (e) + return p; + const f = d.O(); + e = true; + return q({ + da: c, + I: f + }); + }}; + } + A(a, b, [c, ...d]) { + if (this.l) + return ff(this.l, (f, h, k, ...l) => this.l.value(f, h, k, ...l), a, b, this.S, d, this.L); + const e = c(a); + return e.Y({default: () => { + throw cf(); + }, m: () => e.M(([f]) => { + f = ef(f, this.ma); + if (f.J) + throw Error("XUDY0038: The function returned by the PrimaryExpr of a dynamic function invocation can not be an updating function"); + return ff(f, f.value, a, b, this.S, d, this.L); + })}); + } + v(a) { + this.L = gf(a); + super.v(a); + if (this.xa.B) { + a = B(this.xa, null, null); + if (!a.sa()) + throw cf(); + this.l = ef(a.first(), this.ma); + this.l.J && (this.J = true); + } + } + }; + const jf = (a, b, c, d, e, f) => A([d, e, f], ([h, k, l]) => { + k = k.value; + l = l.value; + if (k > h.h.length || 0 >= k) + throw Error("FOAY0001: subarray start out of bounds."); + if (0 > l) + throw Error("FOAY0002: subarray length out of bounds."); + if (k + l > h.h.length + 1) + throw Error("FOAY0001: subarray start + length out of bounds."); + return w.m(new pb(h.h.slice(k - 1, l + k - 1))); + }), kf = (a, b, c, d, e) => A([d], ([f]) => e.M((h) => { + h = h.map((l) => l.value).sort((l, n) => n - l).filter((l, n, t) => t[n - 1] !== l); + const k = f.h.concat(); + for (let l = 0, n = h.length; l < n; ++l) { + const t = h[l]; + if (t > f.h.length || 0 >= t) + throw Error("FOAY0001: subarray position out of bounds."); + k.splice(t - 1, 1); + } + return w.m(new pb(k)); + })), lf = (a) => v(a, 1) || v(a, 20) || v(a, 19), mf = (a, b, c, d, e) => d.length === 0 ? e.length !== 0 : e.length !== 0 && qe(a, b, c, d[0], e[0]).next(0).value ? mf(a, b, c, d.slice(1), e.slice(1)) : d[0].value !== d[0].value ? true : lf(d[0].type) && e.length !== 0 && lf(e[0].type) ? d[0].value < e[0].value : e.length === 0 ? false : d[0].value < e[0].value, nf = (a, b, c, d) => { + d.sort((e, f) => pe(a, b, c, w.create(e), w.create(f)).next(0).value ? 0 : mf(a, b, c, e, f) ? -1 : 1); + return w.m(new pb(d.map((e) => () => w.create(e)))); + }; + function of(a, b) { + return v(b.type, 62) ? b.h.reduce((c, d) => d().M((e) => e.reduce(of, c)), a) : jc([a, w.m(b)]); + } + var pf = [ + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "size", j: [{type: 62, g: 3}], i: {type: 5, g: 3}, callFunction: (a, b, c, d) => A([d], ([e]) => w.m(g(e.h.length, 5)))}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "get", j: [{type: 62, g: 3}, {type: 5, g: 3}], i: {type: 59, g: 2}, callFunction: ob}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "put", j: [{type: 62, g: 3}, {type: 5, g: 3}, {type: 59, g: 2}], i: {type: 62, g: 3}, callFunction: (a, b, c, d, e, f) => A([e, d], ([h, k]) => { + h = h.value; + if (0 >= h || h > k.h.length) + throw Error("FOAY0001: array position out of bounds."); + k = k.h.concat(); + k.splice(h - 1, 1, Ra(f)); + return w.m(new pb(k)); + })}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "append", j: [{type: 62, g: 3}, {type: 59, g: 2}], i: {type: 62, g: 3}, callFunction: (a, b, c, d, e) => A([d], ([f]) => w.m(new pb(f.h.concat([Ra(e)]))))}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "subarray", j: [{type: 62, g: 3}, {type: 5, g: 3}, {type: 5, g: 3}], i: {type: 62, g: 3}, callFunction: jf}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "subarray", j: [{type: 62, g: 3}, {type: 5, g: 3}], i: {type: 62, g: 3}, callFunction(a, b, c, d, e) { + const f = w.m(g(d.first().value.length - e.first().value + 1, 5)); + return jf(a, b, c, d, e, f); + }}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "remove", j: [{type: 62, g: 3}, {type: 5, g: 2}], i: {type: 62, g: 3}, callFunction: kf}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "insert-before", j: [{type: 62, g: 3}, {type: 5, g: 3}, { + type: 59, + g: 2 + }], i: {type: 62, g: 3}, callFunction: (a, b, c, d, e, f) => A([d, e], ([h, k]) => { + k = k.value; + if (k > h.h.length + 1 || 0 >= k) + throw Error("FOAY0001: subarray position out of bounds."); + h = h.h.concat(); + h.splice(k - 1, 0, Ra(f)); + return w.m(new pb(h)); + })}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "head", j: [{type: 62, g: 3}], i: {type: 59, g: 2}, callFunction(a, b, c, d) { + return ob(a, b, c, d, w.m(g(1, 5))); + }}, + { + namespaceURI: "http://www.w3.org/2005/xpath-functions/array", + localName: "tail", + j: [{type: 62, g: 3}], + i: {type: 59, g: 2}, + callFunction(a, b, c, d) { + return kf(a, b, c, d, w.m(g(1, 5))); + } + }, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "reverse", j: [{type: 62, g: 3}], i: {type: 62, g: 3}, callFunction: (a, b, c, d) => A([d], ([e]) => w.m(new pb(e.h.concat().reverse())))}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "join", j: [{type: 62, g: 2}], i: {type: 62, g: 3}, callFunction: (a, b, c, d) => d.M((e) => { + e = e.reduce((f, h) => f.concat(h.h), []); + return w.m(new pb(e)); + })}, + { + namespaceURI: "http://www.w3.org/2005/xpath-functions/array", + localName: "for-each", + j: [{type: 62, g: 3}, {type: 60, g: 3}], + i: {type: 62, g: 3}, + callFunction: (a, b, c, d, e) => A([d, e], ([f, h]) => { + if (h.v !== 1) + throw mc("The callback passed into array:for-each has a wrong arity."); + f = f.h.map((k) => Ra(h.value.call(void 0, a, b, c, df(h.o, [k()], b, "array:for-each")[0]))); + return w.m(new pb(f)); + }) + }, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "filter", j: [{type: 62, g: 3}, {type: 60, g: 3}], i: {type: 62, g: 3}, callFunction: (a, b, c, d, e) => A([d, e], ([f, h]) => { + if (h.v !== 1) + throw mc("The callback passed into array:filter has a wrong arity."); + const k = f.h.map((t) => { + t = df(h.o, [t()], b, "array:filter")[0]; + const u = h.value; + return u(a, b, c, t); + }), l = []; + let n = false; + return w.create({next: () => { + if (n) + return p; + for (let u = 0, y = f.h.length; u < y; ++u) { + var t = k[u].fa(); + l[u] = t; + } + t = f.h.filter((u, y) => l[y]); + n = true; + return q(new pb(t)); + }}); + })}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "fold-left", j: [{type: 62, g: 3}, {type: 59, g: 2}, {type: 60, g: 3}], i: {type: 59, g: 2}, callFunction: (a, b, c, d, e, f) => A([d, f], ([h, k]) => { + if (k.v !== 2) + throw mc("The callback passed into array:fold-left has a wrong arity."); + return h.h.reduce((l, n) => { + n = df(k.o, [n()], b, "array:fold-left")[0]; + return k.value.call(void 0, a, b, c, l, n); + }, e); + })}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "fold-right", j: [{type: 62, g: 3}, {type: 59, g: 2}, {type: 60, g: 3}], i: {type: 59, g: 2}, callFunction: (a, b, c, d, e, f) => A([d, f], ([h, k]) => { + if (k.v !== 2) + throw mc("The callback passed into array:fold-right has a wrong arity."); + return h.h.reduceRight((l, n) => { + n = df(k.o, [n()], b, "array:fold-right")[0]; + return k.value.call(void 0, a, b, c, l, n); + }, e); + })}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "for-each-pair", j: [{type: 62, g: 3}, {type: 62, g: 3}, {type: 60, g: 3}], i: {type: 62, g: 3}, callFunction: (a, b, c, d, e, f) => A([d, e, f], ([h, k, l]) => { + if (l.v !== 2) + throw mc("The callback passed into array:for-each-pair has a wrong arity."); + const n = []; + for (let t = 0, u = Math.min(h.h.length, k.h.length); t < u; ++t) { + const [y, z] = df(l.o, [h.h[t](), k.h[t]()], b, "array:for-each-pair"); + n[t] = Ra(l.value.call(void 0, a, b, c, y, z)); + } + return w.m(new pb(n)); + })}, + { + namespaceURI: "http://www.w3.org/2005/xpath-functions/array", + localName: "sort", + j: [{type: 62, g: 3}], + i: {type: 62, g: 3}, + callFunction: (a, b, c, d) => A([d], ([e]) => { + e = e.h.map((f) => f().O()); + return nf(a, b, c, e); + }) + }, + {namespaceURI: "http://www.w3.org/2005/xpath-functions/array", localName: "flatten", j: [{type: 59, g: 2}], i: {type: 59, g: 2}, callFunction: (a, b, c, d) => d.M((e) => e.reduce(of, w.empty()))} + ]; + function E(a, b, c, d, e) { + return e.G() ? e : w.m(jd(e.first(), a)); + } + var vf = [{namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "untypedAtomic", j: [{type: 46, g: 0}], i: {type: 19, g: 0}, callFunction: E.bind(null, 19)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "error", j: [{type: 46, g: 0}], i: {type: 39, g: 0}, callFunction: E.bind(null, 39)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "string", j: [{type: 46, g: 0}], i: {type: 1, g: 0}, callFunction: E.bind(null, 1)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "boolean", j: [{type: 46, g: 0}], i: { + type: 0, + g: 0 + }, callFunction: E.bind(null, 0)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "decimal", j: [{type: 46, g: 0}], i: {type: 4, g: 0}, callFunction: E.bind(null, 4)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "float", j: [{type: 46, g: 0}], i: {type: 6, g: 0}, callFunction: E.bind(null, 6)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "double", j: [{type: 46, g: 0}], i: {type: 3, g: 0}, callFunction: E.bind(null, 3)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "duration", j: [{ + type: 46, + g: 0 + }], i: {type: 18, g: 0}, callFunction: E.bind(null, 18)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "dateTime", j: [{type: 46, g: 0}], i: {type: 9, g: 0}, callFunction: E.bind(null, 9)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "dateTimeStamp", j: [{type: 46, g: 0}], i: {type: 10, g: 0}, callFunction: E.bind(null, 10)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "time", j: [{type: 46, g: 0}], i: {type: 8, g: 0}, callFunction: E.bind(null, 8)}, { + namespaceURI: "http://www.w3.org/2001/XMLSchema", + localName: "date", + j: [{type: 46, g: 0}], + i: {type: 7, g: 0}, + callFunction: E.bind(null, 7) + }, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "gYearMonth", j: [{type: 46, g: 0}], i: {type: 11, g: 0}, callFunction: E.bind(null, 11)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "gYear", j: [{type: 46, g: 0}], i: {type: 12, g: 0}, callFunction: E.bind(null, 12)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "gMonthDay", j: [{type: 46, g: 0}], i: {type: 13, g: 0}, callFunction: E.bind(null, 13)}, { + namespaceURI: "http://www.w3.org/2001/XMLSchema", + localName: "gDay", + j: [{type: 46, g: 0}], + i: {type: 15, g: 0}, + callFunction: E.bind(null, 15) + }, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "gMonth", j: [{type: 46, g: 0}], i: {type: 14, g: 0}, callFunction: E.bind(null, 14)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "hexBinary", j: [{type: 46, g: 0}], i: {type: 22, g: 0}, callFunction: E.bind(null, 22)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "base64Binary", j: [{type: 46, g: 0}], i: {type: 21, g: 0}, callFunction: E.bind(null, 21)}, { + namespaceURI: "http://www.w3.org/2001/XMLSchema", + localName: "QName", + j: [{type: 46, g: 0}], + i: {type: 23, g: 0}, + callFunction: (a, b, c, d) => { + if (d.G()) + return d; + a = d.first(); + if (v(a.type, 2)) + throw Error("XPTY0004: The provided QName is not a string-like value."); + a = jd(a, 1).value; + a = sc(a, 23); + if (!tc(a, 23)) + throw Error("FORG0001: The provided QName is invalid."); + if (!a.includes(":")) + return c = c.$(""), w.m(g(new Ta("", c, a), 23)); + const [e, f] = a.split(":"); + c = c.$(e); + if (!c) + throw Error(`FONS0004: The value ${a} can not be cast to a QName. Did you mean to use fn:QName?`); + return w.m(g(new Ta(e, c, f), 23)); + } + }, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "anyURI", j: [{type: 46, g: 0}], i: {type: 20, g: 0}, callFunction: E.bind(null, 20)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "normalizedString", j: [{type: 46, g: 0}], i: {type: 48, g: 0}, callFunction: E.bind(null, 48)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "token", j: [{type: 46, g: 0}], i: {type: 52, g: 0}, callFunction: E.bind(null, 52)}, { + namespaceURI: "http://www.w3.org/2001/XMLSchema", + localName: "language", + j: [{type: 46, g: 0}], + i: {type: 51, g: 0}, + callFunction: E.bind(null, 51) + }, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "NMTOKEN", j: [{type: 46, g: 0}], i: {type: 50, g: 0}, callFunction: E.bind(null, 50)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "NMTOKENS", j: [{type: 46, g: 0}], i: {type: 49, g: 2}, callFunction: E.bind(null, 49)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "Name", j: [{type: 46, g: 0}], i: {type: 25, g: 0}, callFunction: E.bind(null, 25)}, { + namespaceURI: "http://www.w3.org/2001/XMLSchema", + localName: "NCName", + j: [{type: 46, g: 0}], + i: {type: 24, g: 0}, + callFunction: E.bind(null, 24) + }, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "ID", j: [{type: 46, g: 0}], i: {type: 42, g: 0}, callFunction: E.bind(null, 42)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "IDREF", j: [{type: 46, g: 0}], i: {type: 41, g: 0}, callFunction: E.bind(null, 41)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "IDREFS", j: [{type: 46, g: 0}], i: {type: 43, g: 2}, callFunction: E.bind(null, 43)}, { + namespaceURI: "http://www.w3.org/2001/XMLSchema", + localName: "ENTITY", + j: [{type: 46, g: 0}], + i: {type: 26, g: 0}, + callFunction: E.bind(null, 26) + }, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "ENTITIES", j: [{type: 46, g: 0}], i: {type: 40, g: 2}, callFunction: E.bind(null, 40)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "integer", j: [{type: 46, g: 0}], i: {type: 5, g: 0}, callFunction: E.bind(null, 5)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "nonPositiveInteger", j: [{type: 46, g: 0}], i: {type: 27, g: 0}, callFunction: E.bind(null, 27)}, { + namespaceURI: "http://www.w3.org/2001/XMLSchema", + localName: "negativeInteger", + j: [{type: 46, g: 0}], + i: {type: 28, g: 0}, + callFunction: E.bind(null, 28) + }, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "long", j: [{type: 46, g: 0}], i: {type: 31, g: 0}, callFunction: E.bind(null, 31)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "int", j: [{type: 46, g: 0}], i: {type: 32, g: 0}, callFunction: E.bind(null, 32)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "short", j: [{type: 46, g: 0}], i: {type: 33, g: 0}, callFunction: E.bind(null, 33)}, { + namespaceURI: "http://www.w3.org/2001/XMLSchema", + localName: "byte", + j: [{type: 46, g: 0}], + i: {type: 34, g: 0}, + callFunction: E.bind(null, 34) + }, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "nonNegativeInteger", j: [{type: 46, g: 0}], i: {type: 30, g: 0}, callFunction: E.bind(null, 30)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "unsignedLong", j: [{type: 46, g: 0}], i: {type: 36, g: 0}, callFunction: E.bind(null, 36)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "unsignedInt", j: [{type: 46, g: 0}], i: {type: 35, g: 0}, callFunction: E.bind(null, 35)}, { + namespaceURI: "http://www.w3.org/2001/XMLSchema", + localName: "unsignedShort", + j: [{type: 46, g: 0}], + i: {type: 38, g: 0}, + callFunction: E.bind(null, 38) + }, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "unsignedByte", j: [{type: 46, g: 0}], i: {type: 37, g: 0}, callFunction: E.bind(null, 37)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "positiveInteger", j: [{type: 46, g: 0}], i: {type: 29, g: 0}, callFunction: E.bind(null, 29)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "yearMonthDuration", j: [{type: 46, g: 0}], i: {type: 16, g: 0}, callFunction: E.bind(null, 16)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "dayTimeDuration", j: [{type: 46, g: 0}], i: {type: 17, g: 0}, callFunction: E.bind(null, 17)}, {namespaceURI: "http://www.w3.org/2001/XMLSchema", localName: "dateTimeStamp", j: [{type: 46, g: 0}], i: {type: 10, g: 0}, callFunction: E.bind(null, 10)}]; + const wf = (a, b, c, d) => d.G() ? d : w.m(g(d.first().value.getYear(), 5)), xf = (a, b, c, d) => d.G() ? d : w.m(g(d.first().value.getMonth(), 5)), yf = (a, b, c, d) => d.G() ? d : w.m(g(d.first().value.getDay(), 5)), zf = (a, b, c, d) => d.G() ? d : w.m(g(d.first().value.getHours(), 5)), Af = (a, b, c, d) => d.G() ? d : w.m(g(d.first().value.getMinutes(), 5)), Bf = (a, b, c, d) => { + d.G() || (a = w, b = a.m, d = d.first().value, d = b.call(a, g(d.D + d.pa, 4))); + return d; + }, Cf = (a, b, c, d) => d.G() ? d : (a = d.first().value.X) ? w.m(g(a, 17)) : w.empty(); + var Df = [ + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "dateTime", j: [{type: 7, g: 0}, {type: 8, g: 0}], i: {type: 9, g: 0}, callFunction: (a, b, c, d, e) => { + if (d.G()) + return d; + if (e.G()) + return e; + a = d.first().value; + e = e.first().value; + b = a.X; + c = e.X; + if (b || c) { + if (!b || c) { + if (!b && c) + b = c; + else if (!vb(b, c)) + throw Error("FORG0008: fn:dateTime: got a date and time value with different timezones."); + } + } else + b = null; + return w.m(g(new Kb(a.getYear(), a.getMonth(), a.getDay(), e.getHours(), e.getMinutes(), e.getSeconds(), e.pa, b), 9)); + }}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "year-from-dateTime", j: [{type: 9, g: 0}], i: {type: 5, g: 0}, callFunction: wf}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "month-from-dateTime", j: [{type: 9, g: 0}], i: {type: 5, g: 0}, callFunction: xf}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "day-from-dateTime", j: [{type: 9, g: 0}], i: {type: 5, g: 0}, callFunction: yf}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "hours-from-dateTime", j: [{ + type: 9, + g: 0 + }], i: {type: 5, g: 0}, callFunction: zf}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "minutes-from-dateTime", j: [{type: 9, g: 0}], i: {type: 5, g: 0}, callFunction: Af}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "seconds-from-dateTime", j: [{type: 9, g: 0}], i: {type: 4, g: 0}, callFunction: Bf}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "timezone-from-dateTime", j: [{type: 9, g: 0}], i: {type: 17, g: 0}, callFunction: Cf}, + { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "year-from-date", + j: [{type: 7, g: 0}], + i: {type: 5, g: 0}, + callFunction: wf + }, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "month-from-date", j: [{type: 7, g: 0}], i: {type: 5, g: 0}, callFunction: xf}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "day-from-date", j: [{type: 7, g: 0}], i: {type: 5, g: 0}, callFunction: yf}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "timezone-from-date", j: [{type: 7, g: 0}], i: {type: 17, g: 0}, callFunction: Cf}, + { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "hours-from-time", + j: [{type: 8, g: 0}], + i: {type: 5, g: 0}, + callFunction: zf + }, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "minutes-from-time", j: [{type: 8, g: 0}], i: {type: 5, g: 0}, callFunction: Af}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "seconds-from-time", j: [{type: 8, g: 0}], i: {type: 4, g: 0}, callFunction: Bf}, + {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "timezone-from-time", j: [{type: 8, g: 0}], i: {type: 17, g: 0}, callFunction: Cf} + ]; + function Ef(a, b) { + const c = b.h, d = b.Ia, e = b.Ma; + switch (a.node.nodeType) { + case 1: + const h = d.createElementNS(a.node.namespaceURI, a.node.nodeName); + c.getAllAttributes(a.node).forEach((k) => e.setAttributeNS(h, k.namespaceURI, k.nodeName, k.value)); + for (var f of hb(c, a)) + a = Ef(f, b), e.insertBefore(h, a.node, null); + return {node: h, F: null}; + case 2: + return b = d.createAttributeNS(a.node.namespaceURI, a.node.nodeName), b.value = ib(c, a), {node: b, F: null}; + case 4: + return {node: d.createCDATASection(ib(c, a)), F: null}; + case 8: + return {node: d.createComment(ib(c, a)), F: null}; + case 9: + f = d.createDocument(); + for (const k of hb(c, a)) + a = Ef(k, b), e.insertBefore(f, a.node, null); + return {node: f, F: null}; + case 7: + return {node: d.createProcessingInstruction(a.node.target, ib(c, a)), F: null}; + case 3: + return {node: d.createTextNode(ib(c, a)), F: null}; + } + } + function Ff(a, b) { + const c = b.Ma; + var d = b.Ia; + const e = b.h; + if (cb(a.node)) + switch (a.node.nodeType) { + case 2: + return d = d.createAttributeNS(a.node.namespaceURI, a.node.nodeName), d.value = ib(e, a), d; + case 8: + return d.createComment(ib(e, a)); + case 1: + const f = a.node.prefix, h = a.node.localName, k = d.createElementNS(a.node.namespaceURI, f ? f + ":" + h : h); + hb(e, a).forEach((l) => { + l = Ff(l, b); + c.insertBefore(k, l, null); + }); + fb(e, a).forEach((l) => { + c.setAttributeNS(k, l.node.namespaceURI, l.node.nodeName, ib(e, l)); + }); + k.normalize(); + return k; + case 7: + return d.createProcessingInstruction(a.node.target, ib(e, a)); + case 3: + return d.createTextNode(ib(e, a)); + } + else + return Ef(a, b).node; + } + function Gf(a, b, c) { + let d = a; + for (a = x(c, d); a !== null; ) { + if (d.node.nodeType === 2) + b.push(d.node.nodeName); + else { + const e = hb(c, a); + b.push(e.findIndex((f) => md(f, d))); + } + d = a; + a = x(c, d); + } + return d; + } + function Hf(a, b, c) { + for (; 0 < b.length; ) { + const d = b.pop(); + typeof d === "string" ? a = fb(c, a).find((e) => e.node.nodeName === d) : a = hb(c, a)[d]; + } + return a.node; + } + function If(a, b, c) { + var d = a.node; + if (!(cb(d) || c || a.F)) + return d; + d = b.v; + const e = []; + if (c) + return Ff(a, b); + a = Gf(a, e, b.h); + c = d.get(a.node); + c || (c = {node: Ff(a, b), F: null}, d.set(a.node, c)); + return Hf(c, e, b.h); + } + const Jf = (a, b, c, d, e) => d.M((f) => { + let h = ""; + for (let k = 0; k < f.length; k++) { + const l = f[k], n = b.Ua && v(l.type, 53) ? b.Ua.serializeToString(If(l.value, b, false)) : qc(w.m(l), b).map((t) => jd(t, 1)).first().value; + h += `{type: ${Ea[l.type]}, value: ${n}} +`; + } + e !== void 0 && (h += e.first().value); + b.ib.trace(h); + return w.create(f); + }); + var Kf = [{j: [{type: 59, g: 2}], callFunction: Jf, localName: "trace", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 59, g: 2}}, {j: [{type: 59, g: 2}, {type: 1, g: 3}], callFunction: Jf, localName: "trace", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 59, g: 2}}]; + const Lf = (a, b, c, d, e) => { + a = d === void 0 || d.G() ? new Ta("err", "http://www.w3.org/2005/xqt-errors", "FOER0000") : d.first().value; + b = ""; + e === void 0 || e.G() || (b = `: ${e.first().value}`); + throw Error(`${a.localName}${b}`); + }; + var Mf = [{namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "error", j: [], i: {type: 63, g: 3}, callFunction: Lf}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "error", j: [{type: 23, g: 0}], i: {type: 63, g: 3}, callFunction: Lf}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "error", j: [{type: 23, g: 0}, {type: 1, g: 3}], i: {type: 63, g: 3}, callFunction: Lf}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "error", j: [{type: 23, g: 0}, {type: 1, g: 3}, {type: 59, g: 2}], i: { + type: 63, + g: 3 + }, callFunction() { + throw Error("Not implemented: Using an error object in error is not supported"); + }}]; + function Nf(a) { + return typeof a === "string" ? a : (a = new Za().getChildNodes(a).find((b) => b.nodeType === 8)) ? a.data : "some expression"; + } + var Of = class extends Error { + constructor(a, b) { + super(a); + this.position = {end: {ha: b.end.ha, line: b.end.line, offset: b.end.offset}, start: {ha: b.start.ha, line: b.start.line, offset: b.start.offset}}; + } + }; + function Pf(a, b) { + if (b instanceof Error) + throw b; + typeof a !== "string" && (a = Nf(a)); + const c = Qf(b); + a = a.replace(/\r/g, "").split("\n"); + const d = Math.floor(Math.log10(Math.min(c.end.line + 2, a.length))) + 1; + a = a.reduce((e, f, h) => { + var k = h + 1; + if (2 < c.start.line - k || 2 < k - c.end.line) + return e; + h = `${Array(d).fill(" ", 0, Math.floor(Math.log10(k)) + 1 - d).join("")}${k}: `; + e.push(`${h}${f}`); + if (k >= c.start.line && k <= c.end.line) { + const l = k < c.end.line ? f.length + h.length : c.end.ha - 1 + h.length; + k = k > c.start.line ? h.length : c.start.ha - 1 + h.length; + f = " ".repeat(h.length) + Array.from(f.substring(0, k - h.length), (n) => n === " " ? " " : " ").join("") + "^".repeat(l - k); + e.push(f); + } + return e; + }, []); + b = Rf(b).join("\n"); + throw new Of(a.join("\n") + "\n\n" + b, c); + } + const Sf = Object.create(null); + function Tf(a, b) { + const c = new Map(); + for (let d = 0; d < a.length + 1; ++d) + c.set(d, new Map()); + return function h(e, f) { + if (e === 0) + return f; + if (f === 0) + return e; + if (c.get(e).has(f)) + return c.get(e).get(f); + var k = 0; + a[e - 1] !== b[f - 1] && (k = 1); + k = Math.min(h(e - 1, f) + 1, h(e, f - 1) + 1, h(e - 1, f - 1) + k); + c.get(e).set(f, k); + return k; + }(a.length, b.length); + } + function Uf(a) { + const b = Sf[a] ? Sf[a] : Object.keys(Sf).map((c) => ({name: c, qb: Tf(a, c.slice(c.lastIndexOf(":") + 1))})).sort((c, d) => c.qb - d.qb).slice(0, 5).filter((c) => c.qb < a.length / 2).reduce((c, d) => c.concat(Sf[d.name]), []).slice(0, 5); + return b.length ? b.map((c) => `"Q{${c.namespaceURI}}${c.localName} (${c.j.map((d) => d === 4 ? "..." : Ha(d)).join(", ")})"`).reduce((c, d, e, f) => e === 0 ? c + d : c + ((e !== f.length - 1 ? ", " : " or ") + d), "Did you mean ") + "?" : "No similar functions found."; + } + function Vf(a, b, c) { + var d = Sf[a + ":" + b]; + return d ? (d = d.find((e) => e.j.some((f) => f === 4) ? e.j.length - 1 <= c : e.j.length === c)) ? {j: d.j, arity: c, callFunction: d.callFunction, J: d.J, localName: b, namespaceURI: a, i: d.i} : null : null; + } + function Wf(a, b, c, d, e) { + Sf[a + ":" + b] || (Sf[a + ":" + b] = []); + Sf[a + ":" + b].push({j: c, arity: c.length, callFunction: e, J: false, localName: b, namespaceURI: a, i: d}); + } + var Xf = {xml: "http://www.w3.org/XML/1998/namespace", xs: "http://www.w3.org/2001/XMLSchema", fn: "http://www.w3.org/2005/xpath-functions", map: "http://www.w3.org/2005/xpath-functions/map", array: "http://www.w3.org/2005/xpath-functions/array", math: "http://www.w3.org/2005/xpath-functions/math", fontoxpath: "http://fontoxml.com/fontoxpath", local: "http://www.w3.org/2005/xquery-local-functions"}; + var Yf = class { + constructor(a, b, c, d) { + this.Ca = [Object.create(null)]; + this.Da = Object.create(null); + this.s = a; + this.ia = Object.keys(b).reduce((e, f) => { + if (b[f] === void 0) + return e; + e[f] = `Q{}${f}[0]`; + return e; + }, Object.create(null)); + this.o = Object.create(null); + this.h = Object.create(null); + this.v = c; + this.l = d; + this.D = []; + } + ta(a, b, c) { + return Vf(a, b, c); + } + cb(a, b) { + if (a) + return null; + a = this.ia[b]; + this.o[b] || (this.o[b] = {name: b}); + return a; + } + Sa(a, b) { + const c = this.l(a, b); + if (c) + this.D.push({ac: a, arity: b, Bb: c}); + else if (a.prefix === "") { + if (this.v) + return { + namespaceURI: this.v, + localName: a.localName + }; + } else if (b = this.$(a.prefix, true)) + return {namespaceURI: b, localName: a.localName}; + return c; + } + $(a, b = true) { + if (!b) + return null; + if (Xf[a]) + return Xf[a]; + b = this.s(a); + this.h[a] || (this.h[a] = {namespaceURI: b, prefix: a}); + return b !== void 0 || a ? b : null; + } + }; + var Zf = (a, b) => { + a = a.node.nodeType === 2 ? `${a.node.nodeName}="${ib(b, a)}"` : a.node.outerHTML; + return Error(`XQTY0024: The node ${a} follows a node that is not an attribute node or a namespace node.`); + }, $f = (a) => Error(`XQDY0044: The node name "${a.ya()}" is invalid for a computed attribute constructor.`), ag = () => Error("XQST0045: Functions and variables may not be declared in one of the reserved namespace URIs."), bg = (a, b) => Error(`XQST0049: The function or variable "Q{${a}}${b}" is declared more than once.`), cg = () => Error("XQST0060: Functions declared in a module or as an external function must reside in a namespace."), dg = () => Error("XQST0066: A Prolog may contain at most one default function namespace declaration."), eg = () => Error("XQST0070: The prefixes xml and xmlns may not be used in a namespace declaration or be bound to another namespaceURI."), fg = (a) => Error(`XQDY0074: The value "${a}" of a name expressions cannot be converted to an expanded QName.`), gg = (a) => Error(`XPST0081: The prefix "${a}" could not be resolved`); + function hg(a, b) { + return `Q{${a || ""}}${b}`; + } + function ig(a, b) { + for (let c = a.length - 1; 0 <= c; --c) + if (b in a[c]) + return a[c][b]; + } + function gf(a) { + const b = new jg(a.o); + for (let c = 0; c < a.h + 1; ++c) + b.D = [Object.assign(Object.create(null), b.D[0], a.D[c])], b.Ca = [Object.assign(Object.create(null), b.Ca[0], a.Ca[c])], b.l = Object.assign(Object.create(null), a.l), b.Da = a.Da, b.v = a.v; + return b; + } + function kg(a) { + a.s++; + a.h++; + a.D[a.h] = Object.create(null); + a.Ca[a.h] = Object.create(null); + } + function lg(a, b, c) { + return (a = a.Da[hg(b, c)]) ? a : null; + } + function mg(a, b, c, d, e) { + d = hg(b, c) + "~" + d; + if (a.l[d]) + throw bg(b, c); + a.l[d] = e; + } + function ng(a, b, c) { + a.D[a.h][b] = c; + } + function og(a, b, c) { + b = hg(b || "", c); + return a.Ca[a.h][b] = `${b}[${a.s}]`; + } + function pg(a, b, c, d) { + a.Da[`${hg(b || "", c)}[${a.s}]`] = d; + } + function qg(a) { + a.D.length = a.h; + a.Ca.length = a.h; + a.h--; + } + var jg = class { + constructor(a) { + this.o = a; + this.s = this.h = 0; + this.D = [Object.create(null)]; + this.l = Object.create(null); + this.v = null; + this.Da = a && a.Da; + this.Ca = a && a.Ca; + } + ta(a, b, c, d = false) { + const e = this.l[hg(a, b) + "~" + c]; + return !e || d && e.ub ? this.o === null ? null : this.o.ta(a, b, c, d) : e; + } + cb(a, b) { + const c = ig(this.Ca, hg(a, b)); + return c ? c : this.o === null ? null : this.o.cb(a, b); + } + Sa(a, b) { + var c = a.prefix; + const d = a.localName; + return c === "" && this.v ? {localName: d, namespaceURI: this.v} : c && (c = this.$(c, false)) ? {localName: d, namespaceURI: c} : this.o === null ? null : this.o.Sa(a, b); + } + $(a, b = true) { + const c = ig(this.D, a || ""); + return c === void 0 ? this.o === null ? void 0 : this.o.$(a || "", b) : c; + } + }; + function G(a, b) { + b === "*" || Array.isArray(b) || (b = [b]); + for (let c = 1; c < a.length; ++c) { + if (!Array.isArray(a[c])) + continue; + const d = a[c]; + if (b === "*" || b.includes(d[0])) + return d; + } + return null; + } + function H(a) { + return 2 > a.length ? "" : typeof a[1] === "object" ? a[2] || "" : a[1] || ""; + } + function I(a, b) { + if (!Array.isArray(a)) + return null; + a = a[1]; + return typeof a !== "object" || Array.isArray(a) ? null : b in a ? a[b] : null; + } + function J(a, b) { + return b.reduce(G, a); + } + function K(a, b) { + const c = []; + for (let d = 1; d < a.length; ++d) { + if (!Array.isArray(a[d])) + continue; + const e = a[d]; + b !== "*" && e[0] !== b || c.push(e); + } + return c; + } + function rg(a) { + return {localName: H(a), namespaceURI: I(a, "URI"), prefix: I(a, "prefix")}; + } + function sg(a) { + const b = G(a, "typeDeclaration"); + if (!b || G(b, "voidSequenceType")) + return {type: 59, g: 2}; + const c = (f) => { + switch (f[0]) { + case "documentTest": + return 55; + case "elementTest": + return 54; + case "attributeTest": + return 47; + case "piTest": + return 57; + case "commentTest": + return 58; + case "textTest": + return 56; + case "anyKindTest": + return 53; + case "anyItemType": + return 59; + case "anyFunctionTest": + case "functionTest": + case "typedFunctionTest": + return 60; + case "anyMapTest": + case "typedMapTest": + return 61; + case "anyArrayTest": + case "typedArrayTest": + return 62; + case "atomicType": + return Ia([I(f, "prefix"), H(f)].join(":")); + case "parenthesizedItemType": + return c(G(f, "*")); + default: + throw Error(`Type declaration "${G(b, "*")[0]}" is not supported.`); + } + }; + a = {type: c(G(b, "*")), g: 3}; + let d = null; + const e = G(b, "occurrenceIndicator"); + e && (d = H(e)); + switch (d) { + case "*": + return a.g = 2, a; + case "?": + return a.g = 0, a; + case "+": + return a.g = 1, a; + case "": + case null: + return a; + } + } + function L(a, b, c) { + if (typeof a[1] !== "object" || Array.isArray(a[1])) { + const d = {}; + d[b] = c; + a.splice(1, 0, d); + } else + a[1][b] = c; + } + function tg(a) { + const b = {type: 62, g: 3}; + L(a, "type", b); + return b; + } + function ug(a, b) { + if (!b || !b.ga) + return {type: 59, g: 2}; + var c = G(a, "EQName"); + if (!c) + return {type: 59, g: 2}; + var d = rg(c); + c = d.localName; + const e = d.prefix; + d = K(G(a, "arguments"), "*"); + c = b.ga.Sa({localName: c, prefix: e}, d.length); + if (!c) + return {type: 59, g: 2}; + b = b.ga.ta(c.namespaceURI, c.localName, d.length + 1); + if (!b) + return {type: 59, g: 2}; + b.i.type !== 59 && L(a, "type", b.i); + return b.i; + } + function M(a, b, c) { + return (a << 20) + (b << 12) + (c.charCodeAt(0) << 8) + c.charCodeAt(1); + } + var vg = {[M(2, 2, "idivOp")]: 5, [M(16, 16, "addOp")]: 16, [M(16, 16, "subtractOp")]: 16, [M(16, 16, "divOp")]: 4, [M(16, 2, "multiplyOp")]: 16, [M(16, 2, "divOp")]: 16, [M(2, 16, "multiplyOp")]: 16, [M(17, 17, "addOp")]: 17, [M(17, 17, "subtractOp")]: 17, [M(17, 17, "divOp")]: 4, [M(17, 2, "multiplyOp")]: 17, [M(17, 2, "divOp")]: 17, [M(2, 17, "multiplyOp")]: 17, [M(9, 9, "subtractOp")]: 17, [M(7, 7, "subtractOp")]: 17, [M(8, 8, "subtractOp")]: 17, [M(9, 16, "addOp")]: 9, [M(9, 16, "subtractOp")]: 9, [M(9, 17, "addOp")]: 9, [M(9, 17, "subtractOp")]: 9, [M(7, 16, "addOp")]: 7, [M(7, 16, "subtractOp")]: 7, [M(7, 17, "addOp")]: 7, [M(7, 17, "subtractOp")]: 7, [M(8, 17, "addOp")]: 8, [M(8, 17, "subtractOp")]: 8, [M(9, 16, "addOp")]: 9, [M(9, 16, "subtractOp")]: 9, [M(9, 17, "addOp")]: 9, [M(9, 17, "subtractOp")]: 9, [M(7, 17, "addOp")]: 7, [M(7, 17, "subtractOp")]: 7, [M(7, 16, "addOp")]: 7, [M(7, 16, "subtractOp")]: 7, [M(8, 17, "addOp")]: 8, [M(8, 17, "subtractOp")]: 8}, wg = { + [M(2, 2, "addOp")]: (a, b) => a + b, + [M(2, 2, "subtractOp")]: (a, b) => a - b, + [M(2, 2, "multiplyOp")]: (a, b) => a * b, + [M(2, 2, "divOp")]: (a, b) => a / b, + [M(2, 2, "modOp")]: (a, b) => a % b, + [M(2, 2, "idivOp")]: (a, b) => Math.trunc(a / b), + [M(16, 16, "addOp")]: function(a, b) { + return new Kc(a.ea + b.ea); + }, + [M(16, 16, "subtractOp")]: function(a, b) { + return new Kc(a.ea - b.ea); + }, + [M(16, 16, "divOp")]: function(a, b) { + return a.ea / b.ea; + }, + [M(16, 2, "multiplyOp")]: Mc, + [M(16, 2, "divOp")]: function(a, b) { + if (isNaN(b)) + throw Error("FOCA0005: Cannot divide xs:yearMonthDuration by NaN"); + a = Math.round(a.ea / b); + if (a > Number.MAX_SAFE_INTEGER || !Number.isFinite(a)) + throw Error("FODT0002: Value overflow while dividing xs:yearMonthDuration"); + return new Kc(a < Number.MIN_SAFE_INTEGER || a === 0 ? 0 : a); + }, + [M(2, 16, "multiplyOp")]: (a, b) => Mc(b, a), + [M(17, 17, "addOp")]: function(a, b) { + return new yb(a.ca + b.ca); + }, + [M(17, 17, "subtractOp")]: function(a, b) { + return new yb(a.ca - b.ca); + }, + [M(17, 17, "divOp")]: function(a, b) { + if (b.ca === 0) + throw Error("FOAR0001: Division by 0"); + return a.ca / b.ca; + }, + [M(17, 2, "multiplyOp")]: Cb, + [M(17, 2, "divOp")]: function(a, b) { + if (isNaN(b)) + throw Error("FOCA0005: Cannot divide xs:dayTimeDuration by NaN"); + a = a.ca / b; + if (a > Number.MAX_SAFE_INTEGER || !Number.isFinite(a)) + throw Error("FODT0002: Value overflow while dividing xs:dayTimeDuration"); + return new yb(a < Number.MIN_SAFE_INTEGER || Object.is(-0, a) ? 0 : a); + }, + [M(2, 17, "multiplyOp")]: (a, b) => Cb(b, a), + [M(9, 9, "subtractOp")]: Pb, + [M(7, 7, "subtractOp")]: Pb, + [M(8, 8, "subtractOp")]: Pb, + [M(9, 16, "addOp")]: Qb, + [M(9, 16, "subtractOp")]: Rb, + [M(9, 17, "addOp")]: Qb, + [M(9, 17, "subtractOp")]: Rb, + [M(7, 16, "addOp")]: Qb, + [M(7, 16, "subtractOp")]: Rb, + [M(7, 17, "addOp")]: Qb, + [M(7, 17, "subtractOp")]: Rb, + [M(8, 17, "addOp")]: Qb, + [M(8, 17, "subtractOp")]: Rb, + [M(9, 16, "addOp")]: Qb, + [M(9, 16, "subtractOp")]: Rb, + [M(9, 17, "addOp")]: Qb, + [M(9, 17, "subtractOp")]: Rb, + [M(7, 17, "addOp")]: Qb, + [M(7, 17, "subtractOp")]: Rb, + [M(7, 16, "addOp")]: Qb, + [M(7, 16, "subtractOp")]: Rb, + [M(8, 17, "addOp")]: Qb, + [M(8, 17, "subtractOp")]: Rb + }; + function xg(a, b) { + return v(a, 5) && v(b, 5) ? 5 : v(a, 4) && v(b, 4) ? 4 : v(a, 6) && v(b, 6) ? 6 : 3; + } + const yg = [2, 16, 17, 9, 7, 8]; + function zg(a, b, c) { + function d(l, n) { + return {T: e ? e(l) : l, U: f ? f(n) : n}; + } + let e = null, f = null; + v(b, 19) && (e = (l) => jd(l, 3), b = 3); + v(c, 19) && (f = (l) => jd(l, 3), c = 3); + const h = yg.filter((l) => v(b, l)), k = yg.filter((l) => v(c, l)); + if (h.includes(2) && k.includes(2)) { + const l = wg[M(2, 2, a)]; + let n = vg[M(2, 2, a)]; + n || (n = xg(b, c)); + a === "divOp" && n === 5 && (n = 4); + return a === "idivOp" ? Ag(d, l)[0] : (t, u) => { + const {T: y, U: z} = d(t, u); + return g(l(y.value, z.value), n); + }; + } + for (const l of h) + for (const n of k) { + const t = wg[M(l, n, a)], u = vg[M(l, n, a)]; + if (t && u !== void 0) + return (y, z) => { + const { + T: F, + U: O + } = d(y, z); + return g(t(F.value, O.value), u); + }; + } + } + function Bg(a, b, c) { + function d(n, t) { + return {T: f ? f(n) : n, U: h ? h(t) : t}; + } + var e = [2, 53, 59, 46, 47]; + if (e.includes(b) || e.includes(c)) + return 2; + let f = null, h = null; + v(b, 19) && (f = (n) => jd(n, 3), b = 3); + v(c, 19) && (h = (n) => jd(n, 3), c = 3); + var k = yg.filter((n) => v(b, n)); + e = yg.filter((n) => v(c, n)); + if (k.includes(2) && e.includes(2)) { + var l = vg[M(2, 2, a)]; + l === void 0 && (l = xg(b, c)); + a === "divOp" && l === 5 && (l = 4); + return a === "idivOp" ? Ag(d, (n, t) => Math.trunc(n / t))[1] : l; + } + for (l of k) + for (const n of e) + if (k = vg[M(l, n, a)], k !== void 0) + return k; + } + function Ag(a, b) { + return [(c, d) => { + const {T: e, U: f} = a(c, d); + if (f.value === 0) + throw Error("FOAR0001: Divisor of idiv operator cannot be (-)0"); + if (Number.isNaN(e.value) || Number.isNaN(f.value) || !Number.isFinite(e.value)) + throw Error("FOAR0002: One of the operands of idiv is NaN or the first operand is (-)INF"); + return Number.isFinite(e.value) && !Number.isFinite(f.value) ? g(0, 5) : g(b(e.value, f.value), 5); + }, 5]; + } + const Cg = Object.create(null); + var Dg = class extends D { + constructor(a, b, c, d, e) { + super(b.o.add(c.o), [b, c], {B: false}, false, d); + this.A = b; + this.L = c; + this.l = a; + this.s = e; + } + h(a, b) { + return qc(B(this.A, a, b), b).M((c) => c.length === 0 ? w.empty() : qc(B(this.L, a, b), b).M((d) => { + if (d.length === 0) + return w.empty(); + if (1 < c.length || 1 < d.length) + throw Error('XPTY0004: the operands of the "' + this.l + '" operator should be empty or singleton.'); + const e = c[0]; + d = d[0]; + if (this.s && this.type) + return w.m(this.s(e, d)); + var f = e.type; + var h = d.type, k = this.l; + const l = `${f}~${h}~${k}`; + let n = Cg[l]; + n || (n = Cg[l] = zg(k, f, h)); + f = n; + if (!f) + throw Error(`XPTY0004: ${this.l} not available for types ${Ea[e.type]} and ${Ea[d.type]}`); + return w.m(f(e, d)); + })); + } + }; + function Eg(a, b) { + var c = N; + let d = false; + for (var e = 1; e < a.length; e++) + switch (a[e][0]) { + case "letClause": + Fg(b); + var f = a[e], h = b, k = c, l = J(f, ["letClauseItem", "typedVariableBinding", "varName"]); + l = rg(l); + f = J(f, ["letClauseItem", "letExpr"]); + k = k(f[1], h); + Gg(h, l.localName, k); + break; + case "forClause": + d = true; + Fg(b); + Hg(a[e], b, c); + break; + case "whereClause": + Fg(b); + h = a[e]; + c(h, b); + L(h, "type", {type: 0, g: 3}); + break; + case "orderByClause": + Fg(b); + break; + case "returnClause": + e = a[e]; + h = c; + c = J(e, ["*"]); + b = h(c, b); + L(c, "type", b); + L(e, "type", b); + c = b; + if (!c) + return { + type: 59, + g: 2 + }; + d && (c = {type: c.type, g: 2}); + c.type !== 59 && L(a, "type", c); + return c; + default: + c = c(a[e], b); + if (!c) + return {type: 59, g: 2}; + d && (c = {type: c.type, g: 2}); + c.type !== 59 && L(a, "type", c); + return c; + } + if (0 < b.h) + b.h--, b.o.pop(), b.v.pop(); + else + throw Error("Variable scope out of bound"); + } + function Hg(a, b, c) { + const d = rg(J(a, ["forClauseItem", "typedVariableBinding", "varName"])); + if (a = J(a, ["forClauseItem", "forExpr", "sequenceExpr"])) + a = K(a, "*").map((e) => c(e, b)), a.includes(void 0) || a.includes(null) || (a = Ig(a), a.length === 1 && Gg(b, d.localName, a[0])); + } + function Ig(a) { + return a.filter((b, c, d) => d.findIndex((e) => e.type === b.type && e.g === b.g) === c); + } + function Jg(a, b) { + if (!b || !b.ga) + return {type: 59, g: 2}; + const c = G(a, "functionName"); + var d = rg(c); + let e = d.localName; + var f = d.prefix; + let h = d.namespaceURI; + d = K(G(a, "arguments"), "*"); + if (h === null) { + f = b.ga.Sa({localName: e, prefix: f}, d.length); + if (!f) + return {type: 59, g: 2}; + e = f.localName; + h = f.namespaceURI; + L(c, "URI", h); + c[2] = e; + } + b = b.ga.ta(h, e, d.length); + if (!b || b.i.type === 63) + return {type: 59, g: 2}; + b.i.type !== 59 && L(a, "type", b.i); + return b.i; + } + function Kg(a) { + const b = {type: 61, g: 3}; + L(a, "type", b); + return b; + } + function Lg(a, b) { + if (!b || !b.ga) + return {type: 59, g: 2}; + const c = G(a, "functionName"); + var d = rg(c); + let e = d.localName; + var f = d.namespaceURI; + const h = d.prefix; + d = Number(J(a, ["integerConstantExpr", "value"])[1]); + if (!f) { + f = b.ga.Sa({localName: e, prefix: h}, d); + if (!f) + return {type: 59, g: 2}; + e = f.localName; + f = f.namespaceURI; + L(c, "URI", f); + } + b = b.ga.ta(f, e, d) || null; + if (!b) + return {type: 59, g: 2}; + b.i.type !== 59 && b.i.type !== 63 && L(a, "type", b.i); + return b.i; + } + function Mg(a, b) { + var c = K(a, "stepExpr"); + if (!c) + return {type: 59, g: 2}; + for (const f of c) { + a: { + c = f; + var d = b; + let h = null; + if (!c) + break a; + var e = K(c, "*"); + let k = ""; + for (const l of e) + switch (l[0]) { + case "filterExpr": + h = I(J(l, ["*"]), "type"); + break; + case "xpathAxis": + k = l[1]; + b: { + switch (k) { + case "attribute": + h = {type: 47, g: 2}; + break b; + case "child": + case "decendant": + case "self": + case "descendant-or-self": + case "following-sibling": + case "following": + case "namespace": + case "parent": + case "ancestor": + case "preceding-sibling": + case "preceding": + case "ancestor-or-self": + h = {type: 53, g: 2}; + break b; + } + h = void 0; + } + break; + case "nameTest": + e = rg(l); + if (e.namespaceURI !== null) + break; + if (k === "attribute" && !e.prefix) + break; + e = d.$(e.prefix || ""); + e !== void 0 && L(l, "URI", e); + break; + case "lookup": + h = {type: 59, g: 2}; + } + h && h.type !== 59 && L(c, "type", h); + } + d = I(f, "type"); + } + d && d.type !== 59 && L(a, "type", d); + return d; + } + function Ng(a) { + const b = {type: 0, g: 3}; + L(a, "type", b); + return b; + } + function Og(a, b, c) { + b === 0 ? b = {type: 53, g: 2} : b === 1 ? b = c[0] : c.includes(void 0) || c.includes(null) ? b = {type: 59, g: 2} : (b = Ig(c), b = 1 < b.length ? {type: 59, g: 2} : {type: b[0].type, g: 2}); + b && b.type !== 59 && L(a, "type", b); + return b; + } + function Pg(a, b, c, d) { + if (!b || c.includes(void 0)) + return {type: 59, g: 2}; + var e = K(a, "typeswitchExprCaseClause"); + for (let h = 0; h < c.length; h++) { + var f = G(e[h], "*"); + switch (f[0]) { + case "sequenceType": + if (f = Qg(f, b, c[h])) + return f.type !== 59 && L(a, "type", f), f; + continue; + case "sequenceTypeUnion": + for (d = K(f, "*"), e = 0; 2 > e; e++) + if (f = Qg(d[e], b, c[h])) + return f.type !== 59 && L(a, "type", f), f; + default: + return {type: 59, g: 2}; + } + } + d.type !== 59 && L(a, "type", d); + return d; + } + function Qg(a, b, c) { + const d = K(a, "*"), e = G(a, "atomicType"); + if (!e) + return {type: 59, g: 2}; + if (Ia(I(e, "prefix") + ":" + e[2]) === b.type) { + if (d.length === 1) { + if (b.g === 3) + return c; + } else if (a = G(a, "occurrenceIndicator")[1], b.g === Ka(a)) + return c; + } + } + function Rg(a, b) { + N(a, b); + } + function N(a, b) { + var c = Sg.get(a[0]); + if (c) + return c(a, b); + for (c = 1; c < a.length; c++) + a[c] && N(a[c], b); + } + const Tg = (a, b) => { + var c = N(G(a, "firstOperand")[1], b); + const d = N(G(a, "secondOperand")[1], b); + var e = a[0]; + if (c && d) + if (b = Bg(e, c.type, d.type)) + c = {type: b, g: c.g}, b !== 2 && b !== 59 && L(a, "type", c), a = c; + else + throw Error(`XPTY0004: ${e} not available for types ${Ha(c)} and ${Ha(d)}`); + else + a = {type: 2, g: 3}; + return a; + }, Ug = (a, b) => { + N(G(a, "firstOperand")[1], b); + N(G(a, "secondOperand")[1], b); + a: { + switch (a[0]) { + case "orOp": + b = {type: 0, g: 3}; + L(a, "type", b); + a = b; + break a; + case "andOp": + b = {type: 0, g: 3}; + L(a, "type", b); + a = b; + break a; + } + a = void 0; + } + return a; + }, Vg = (a, b) => { + N(G(a, "firstOperand")[1], b); + N(G(a, "secondOperand")[1], b); + a: { + switch (a[0]) { + case "unionOp": + b = {type: 53, g: 2}; + L(a, "type", b); + a = b; + break a; + case "intersectOp": + b = {type: 53, g: 2}; + L(a, "type", b); + a = b; + break a; + case "exceptOp": + b = {type: 53, g: 2}; + L(a, "type", b); + a = b; + break a; + } + a = void 0; + } + return a; + }, Wg = (a, b) => { + N(G(a, "firstOperand")[1], b); + N(G(a, "secondOperand")[1], b); + b = {type: 0, g: 3}; + L(a, "type", b); + return b; + }, Xg = (a, b) => { + N(G(a, "firstOperand")[1], b); + N(G(a, "secondOperand")[1], b); + b = I(J(a, ["firstOperand", "*"]), "type"); + const c = I(J(a, ["secondOperand", "*"]), "type"); + b = {type: 0, g: zc(b) || zc(c) ? 0 : 3}; + L(a, "type", b); + return b; + }, Yg = (a, b) => { + N(G(a, "firstOperand")[1], b); + N(G(a, "secondOperand")[1], b); + b = I(J(a, ["firstOperand", "*"]), "type"); + const c = I(J(a, ["secondOperand", "*"]), "type"); + b = {type: 0, g: zc(b) || zc(c) ? 0 : 3}; + L(a, "type", b); + return b; + }, Sg = new Map([["unaryMinusOp", (a, b) => { + b = N(G(a, "operand")[1], b); + b ? v(b.type, 2) ? (b = {type: b.type, g: b.g}, L(a, "type", b), a = b) : (b = {type: 3, g: 3}, L(a, "type", b), a = b) : (b = {type: 2, g: 2}, L(a, "type", b), a = b); + return a; + }], [ + "unaryPlusOp", + (a, b) => { + b = N(G(a, "operand")[1], b); + b ? v(b.type, 2) ? (b = {type: b.type, g: b.g}, L(a, "type", b), a = b) : (b = {type: 3, g: 3}, L(a, "type", b), a = b) : (b = {type: 2, g: 2}, L(a, "type", b), a = b); + return a; + } + ], ["addOp", Tg], ["subtractOp", Tg], ["divOp", Tg], ["idivOp", Tg], ["modOp", Tg], ["multiplyOp", Tg], ["andOp", Ug], ["orOp", Ug], ["sequenceExpr", (a, b) => { + const c = K(a, "*"), d = c.map((e) => N(e, b)); + return Og(a, c.length, d); + }], ["unionOp", Vg], ["intersectOp", Vg], ["exceptOp", Vg], ["stringConcatenateOp", (a, b) => { + N(G(a, "firstOperand")[1], b); + N(G(a, "secondOperand")[1], b); + b = {type: 1, g: 3}; + L(a, "type", b); + return b; + }], ["rangeSequenceExpr", (a, b) => { + N(G(a, "startExpr")[1], b); + N(G(a, "endExpr")[1], b); + b = {type: 5, g: 1}; + L(a, "type", b); + return b; + }], ["equalOp", Wg], ["notEqualOp", Wg], ["lessThanOrEqualOp", Wg], ["lessThanOp", Wg], ["greaterThanOrEqualOp", Wg], ["greaterThanOp", Wg], ["eqOp", Xg], ["neOp", Xg], ["ltOp", Xg], ["leOp", Xg], ["gtOp", Xg], ["geOp", Xg], ["isOp", Yg], ["nodeBeforeOp", Yg], ["nodeAfterOp", Yg], ["pathExpr", (a, b) => { + const c = G(a, "rootExpr"); + c && c[1] && N(c[1], b); + K(a, "stepExpr").map((d) => N(d, b)); + return Mg(a, b); + }], ["contextItemExpr", () => ({type: 59, g: 2})], ["ifThenElseExpr", (a, b) => { + N(G(G(a, "ifClause"), "*"), b); + const c = N(G(G(a, "thenClause"), "*"), b); + b = N(G(G(a, "elseClause"), "*"), b); + c && b ? c.type === b.type && c.g === b.g ? (c.type !== 59 && L(a, "type", c), a = c) : a = {type: 59, g: 2} : a = {type: 59, g: 2}; + return a; + }], ["instanceOfExpr", (a, b) => { + N(G(a, "argExpr"), b); + N(G(a, "sequenceType"), b); + b = {type: 0, g: 3}; + L(a, "type", b); + return b; + }], ["integerConstantExpr", (a) => { + const b = {type: 5, g: 3}; + L(a, "type", b); + return b; + }], ["doubleConstantExpr", (a) => { + const b = {type: 3, g: 3}; + L(a, "type", b); + return b; + }], ["decimalConstantExpr", (a) => { + const b = {type: 4, g: 3}; + L(a, "type", b); + return b; + }], ["stringConstantExpr", (a) => { + const b = {type: 1, g: 3}; + L(a, "type", b); + return b; + }], ["functionCallExpr", (a, b) => { + const c = G(a, "arguments"); + K(c, "*").map((d) => N(d, b)); + return Jg(a, b); + }], ["arrowExpr", (a, b) => { + N(G(a, "argExpr")[1], b); + return ug(a, b); + }], ["dynamicFunctionInvocationExpr", (a, b) => { + N(J(a, ["functionItem", "*"]), b); + (a = G(a, "arguments")) && N(a, b); + return {type: 59, g: 2}; + }], ["namedFunctionRef", (a, b) => Lg(a, b)], [ + "inlineFunctionExpr", + (a, b) => { + N(G(a, "functionBody")[1], b); + b = {type: 60, g: 3}; + L(a, "type", b); + return b; + } + ], ["castExpr", (a) => { + var b = J(a, ["singleType", "atomicType"]); + b = {type: Ia(I(b, "prefix") + ":" + b[2]), g: 3}; + b.type !== 59 && L(a, "type", b); + return b; + }], ["castableExpr", (a) => { + const b = {type: 0, g: 3}; + L(a, "type", b); + return b; + }], ["simpleMapExpr", (a, b) => { + const c = K(a, "pathExpr"); + let d; + for (let e = 0; e < c.length; e++) + d = N(c[e], b); + d !== void 0 && d !== null ? ((b = {type: d.type, g: 2}, b.type !== 59) && L(a, "type", b), a = b) : a = {type: 59, g: 2}; + return a; + }], ["mapConstructor", (a, b) => { + K(a, "mapConstructorEntry").map((c) => ({key: N(J(c, ["mapKeyExpr", "*"]), b), value: N(J(c, ["mapValueExpr", "*"]), b)})); + return Kg(a); + }], ["arrayConstructor", (a, b) => { + K(G(a, "*"), "arrayElem").map((c) => N(c, b)); + return tg(a); + }], ["unaryLookup", (a) => { + G(a, "NCName"); + return {type: 59, g: 2}; + }], ["typeswitchExpr", (a, b) => { + const c = N(G(a, "argExpr")[1], b), d = K(a, "typeswitchExprCaseClause").map((f) => N(J(f, ["resultExpr"])[1], b)), e = N(J(a, ["typeswitchExprDefaultClause", "resultExpr"])[1], b); + return Pg(a, c, d, e); + }], ["quantifiedExpr", (a, b) => { + K(a, "*").map((c) => N(c, b)); + return Ng(a); + }], ["x:stackTrace", (a, b) => { + a = K(a, "*"); + return N(a[0], b); + }], ["queryBody", (a, b) => N(a[1], b)], ["flworExpr", (a, b) => Eg(a, b)], ["varRef", (a, b) => { + const c = rg(G(a, "name")); + var d; + a: { + for (d = b.h; 0 <= d; d--) { + const e = b.o[d][c.localName]; + if (e) { + d = e; + break a; + } + } + d = void 0; + } + d && d.type !== 59 && L(a, "type", d); + c.namespaceURI === null && (b = b.$(c.prefix), b !== void 0 && L(a, "URI", b)); + return d; + }]]); + function Fg(a) { + a.h++; + a.o.push({}); + a.v.push({}); + } + function Gg(a, b, c) { + if (a.o[a.h][b]) + throw Error(`Another variable of in the scope ${a.h} with the same name ${b} already exists`); + a.o[a.h][b] = c; + } + var Zg = class { + constructor(a) { + this.h = 0; + this.ga = a; + this.o = [{}]; + this.v = [{}]; + } + $(a) { + for (let b = this.h; 0 <= b; b--) { + const c = this.v[b][a]; + if (c !== void 0) + return c; + } + return this.ga ? this.ga.$(a) : void 0; + } + }; + var $g = class extends D { + constructor(a, b) { + super(new bf({external: 1}), a, {B: a.every((c) => c.B)}, false, b); + this.l = a; + } + h(a, b) { + return this.l.length === 0 ? w.m(new pb([])) : B(this.l[0], a, b).M((c) => w.m(new pb(c.map((d) => Ra(w.m(d)))))); + } + }; + var ah = class extends D { + constructor(a, b) { + super(new bf({external: 1}), a, {B: a.every((c) => c.B)}, false, b); + this.l = a; + } + h(a, b) { + return w.m(new pb(this.l.map((c) => Ra(B(c, a, b))))); + } + }; + function bh(a) { + if (a === null) + throw lc("context is absent, it needs to be present to use axes."); + if (!v(a.type, 53)) + throw Error("XPTY0020: Axes can only be applied to nodes."); + return a.value; + } + function ch(a, b, c) { + let d = b; + return {next: () => { + if (!d) + return p; + const e = d; + d = x(a, e, c); + return q(rb(e)); + }}; + } + var dh = class extends D { + constructor(a, b) { + b = b || {Qa: false}; + super(a.o, [a], {P: "reverse-sorted", W: false, subtree: false, B: false}); + this.l = a; + this.s = !!b.Qa; + } + h(a, b) { + b = b.h; + a = bh(a.N); + var c = this.l.D(); + c = c && (c.startsWith("name-") || c === "type-1") ? "type-1" : null; + return w.create(ch(b, this.s ? a : x(b, a, c), c)).filter((d) => this.l.l(d)); + } + }; + const eh = new Map([["type-1-or-type-2", ["name", "type-1", "type-2"]], ["type-1", ["name"]], ["type-2", ["name"]]]); + function fh(a, b) { + if (a === null) + return b; + if (b === null || a === b) + return a; + const c = a.startsWith("name-") ? "name" : a, d = b.startsWith("name-") ? "name" : b, e = eh.get(c); + if (e !== void 0 && e.includes(d)) + return b; + b = eh.get(d); + return b !== void 0 && b.includes(c) ? a : "empty"; + } + var gh = class extends D { + constructor(a, b) { + super(new bf({attribute: 1}), [a], {P: "unsorted", subtree: true, W: true, B: false}); + this.l = a; + this.s = fh(this.l.D(), b); + } + h(a, b) { + b = b.h; + a = bh(a.N); + if (a.node.nodeType !== 1) + return w.empty(); + a = fb(b, a, this.s).filter((c) => c.node.namespaceURI !== "http://www.w3.org/2000/xmlns/").map((c) => rb(c)).filter((c) => this.l.l(c)); + return w.create(a); + } + D() { + return "type-1"; + } + }; + var hh = class extends D { + constructor(a, b) { + super(a.o, [a], {P: "sorted", subtree: true, W: true, B: false}); + this.s = a; + this.l = fh(b, a.D()); + } + h(a, b) { + const c = b.h, d = bh(a.N); + a = d.node.nodeType; + if (a !== 1 && a !== 9) + return w.empty(); + let e = null, f = false; + return w.create({next: () => { + for (; !f; ) { + if (!e) { + e = jb(c, d, this.l); + if (!e) { + f = true; + continue; + } + return q(rb(e)); + } + if (e = lb(c, e, this.l)) + return q(rb(e)); + f = true; + } + return p; + }}).filter((h) => this.s.l(h)); + } + }; + function ih(a, b, c) { + const d = b.node.nodeType; + if (d !== 1 && d !== 9) + return {next: () => p}; + let e = jb(a, b, c); + return {next() { + if (!e) + return p; + const f = e; + e = lb(a, e, c); + return q(f); + }}; + } + function jh(a, b, c) { + const d = [kd(b)]; + return {next: (e) => { + 0 < d.length && (e & 1) !== 0 && d.shift(); + if (!d.length) + return p; + for (e = d[0].next(0); e.done; ) { + d.shift(); + if (!d.length) + return p; + e = d[0].next(0); + } + d.unshift(ih(a, e.value, c)); + return q(rb(e.value)); + }}; + } + var kh = class extends D { + constructor(a, b) { + b = b || {Qa: false}; + super(a.o, [a], {B: false, W: false, P: "sorted", subtree: true}); + this.l = a; + this.s = !!b.Qa; + this.A = (a = this.l.D()) && (a.startsWith("name-") || a === "type-1") || a === "type-1-or-type-2" ? "type-1" : null; + } + h(a, b) { + b = b.h; + a = bh(a.N); + a = jh(b, a, this.A); + this.s || a.next(0); + return w.create(a).filter((c) => this.l.l(c)); + } + }; + function lh(a, b, c) { + var d = a.node.nodeType; + if (d !== 1 && d !== 9) + return a; + for (d = kb(b, a, c); d !== null; ) { + if (d.node.nodeType !== 1) + return d; + a = d; + d = kb(b, a, c); + } + return a; + } + function mh(a, b, c = false, d) { + if (c) { + let f = b, h = false; + return {next: () => { + if (h) + return p; + if (md(f, b)) + return f = lh(b, a, d), md(f, b) ? (h = true, p) : q(rb(f)); + const k = f.node.nodeType, l = k === 9 || k === 2 ? null : mb(a, f, d); + if (l !== null) + return f = lh(l, a, d), q(rb(f)); + f = k === 9 ? null : x(a, f, d); + return md(f, b) ? (h = true, p) : q(rb(f)); + }}; + } + const e = [ih(a, b, d)]; + return {next: () => { + if (!e.length) + return p; + let f = e[0].next(0); + for (; f.done; ) { + e.shift(); + if (!e.length) + return p; + f = e[0].next(0); + } + e.unshift(ih(a, f.value, d)); + return q(rb(f.value)); + }}; + } + function nh(a, b, c) { + const d = []; + for (; b && b.node.nodeType !== 9; b = x(a, b, null)) { + const f = lb(a, b, c); + f && d.push(f); + } + let e = null; + return {next: () => { + for (; e || d.length; ) { + if (!e) { + e = mh(a, d[0], false, c); + var f = q(rb(d[0])); + const h = lb(a, d[0], c); + h ? d[0] = h : d.shift(); + return f; + } + f = e.next(0); + if (f.done) + e = null; + else + return f; + } + return p; + }}; + } + var oh = class extends D { + constructor(a) { + super(a.o, [a], {P: "sorted", W: true, subtree: false, B: false}); + this.l = a; + this.s = (a = this.l.D()) && (a.startsWith("name-") || a === "type-1") ? "type-1" : null; + } + h(a, b) { + b = b.h; + a = bh(a.N); + return w.create(nh(b, a, this.s)).filter((c) => this.l.l(c)); + } + }; + function ph(a, b, c) { + return {next: () => (b = b && lb(a, b, c)) ? q(rb(b)) : p}; + } + var qh = class extends D { + constructor(a, b) { + super(a.o, [a], {P: "sorted", W: true, subtree: false, B: false}); + this.l = a; + this.s = fh(this.l.D(), b); + } + h(a, b) { + b = b.h; + a = bh(a.N); + return w.create(ph(b, a, this.s)).filter((c) => this.l.l(c)); + } + }; + var rh = class extends D { + constructor(a, b) { + super(a.o, [a], {P: "reverse-sorted", W: true, subtree: true, B: false}); + this.l = a; + this.s = fh(b, this.l.D()); + } + h(a, b) { + b = b.h; + a = bh(a.N); + a = x(b, a, this.s); + if (!a) + return w.empty(); + a = rb(a); + return this.l.l(a) ? w.m(a) : w.empty(); + } + }; + function sh(a, b, c) { + const d = []; + for (; b && b.node.nodeType !== 9; b = x(a, b, null)) { + const f = mb(a, b, c); + f !== null && d.push(f); + } + let e = null; + return {next: () => { + for (; e || d.length; ) { + e || (e = mh(a, d[0], true, c)); + var f = e.next(0); + if (f.done) { + e = null; + f = mb(a, d[0], c); + const h = q(rb(d[0])); + f === null ? d.shift() : d[0] = f; + return h; + } + return f; + } + return p; + }}; + } + var th = class extends D { + constructor(a) { + super(a.o, [a], {B: false, W: true, P: "reverse-sorted", subtree: false}); + this.l = a; + this.s = (a = this.l.D()) && (a.startsWith("name-") || a === "type-1") ? "type-1" : null; + } + h(a, b) { + b = b.h; + a = bh(a.N); + return w.create(sh(b, a, this.s)).filter((c) => this.l.l(c)); + } + }; + function uh(a, b, c) { + return {next: () => (b = b && mb(a, b, c)) ? q(rb(b)) : p}; + } + var vh = class extends D { + constructor(a, b) { + super(a.o, [a], {B: false, W: true, P: "reverse-sorted", subtree: false}); + this.l = a; + this.s = fh(this.l.D(), b); + } + h(a, b) { + b = b.h; + a = bh(a.N); + return w.create(uh(b, a, this.s)).filter((c) => this.l.l(c)); + } + }; + var wh = class extends D { + constructor(a, b) { + super(a.o, [a], {P: "sorted", subtree: true, W: true, B: false}); + this.l = a; + this.s = fh(this.l.D(), b); + } + h(a) { + bh(a.N); + return this.l.l(a.N) ? w.m(a.N) : w.empty(); + } + D() { + return this.s; + } + }; + var xh = class extends Ye { + constructor(a, b, c, d) { + super(a.o.add(b.o).add(c.o), [a, b, c], {B: a.B && b.B && c.B, W: b.W === c.W && b.W, P: b.ia === c.ia ? b.ia : "unsorted", subtree: b.subtree === c.subtree && b.subtree}, d); + this.l = a; + } + A(a, b, c) { + let d = null; + const e = c[0](a); + return w.create({next: (f) => { + d || (d = (e.fa() ? c[1](a) : c[2](a)).value); + return d.next(f); + }}); + } + v(a) { + super.v(a); + if (this.l.J) + throw we(); + } + }; + function Qf(a) { + return a.h instanceof Error ? a.location : Qf(a.h); + } + function Rf(a) { + let b; + b = a.h instanceof Of ? ["Inner error:", a.h.message] : a.h instanceof Error ? [a.h.toString()] : Rf(a.h); + b.push(` at <${a.o}>:${a.location.start.line}:${a.location.start.ha} - ${a.location.end.line}:${a.location.end.ha}`); + return b; + } + var yh = class { + constructor(a, b, c) { + this.location = a; + this.o = b; + this.h = c; + } + }; + var zh = class extends Ye { + constructor(a, b, c) { + super(c.o, [c], {B: c.B, W: c.W, P: c.ia, subtree: c.subtree}); + this.l = b; + this.L = {end: {ha: a.end.ha, line: a.end.line, offset: a.end.offset}, start: {ha: a.start.ha, line: a.start.line, offset: a.start.offset}}; + } + A(a, b, [c]) { + let d; + try { + d = c(a); + } catch (e) { + throw new yh(this.L, this.l, e); + } + return w.create({next: (e) => { + try { + return d.value.next(e); + } catch (f) { + throw new yh(this.L, this.l, f); + } + }}); + } + v(a) { + try { + super.v(a); + } catch (b) { + throw new yh(this.L, this.l, b); + } + } + }; + function Ah(a, b, c, d) { + let e = []; + const f = a.L(b, c, d, (k) => { + if (a.l instanceof Bh) { + const n = Ah(a.l, b, k, d); + return We(n, (t) => e = t); + } + let l = null; + return w.create({next: () => { + for (; ; ) { + if (!l) { + var n = k.next(0); + if (n.done) + return p; + n = a.l.s(n.value, d); + l = We(n, (t) => e = Te(e, t)).value; + } + n = l.next(0); + if (n.done) + l = null; + else + return n; + } + }}); + }); + let h = false; + return {next: () => { + if (h) + return p; + const k = f.O(); + h = true; + return q(new He(k, e)); + }}; + } + function Ch(a, b, c, d) { + return a.L(b, c, d, (e) => { + if (a.l instanceof Bh) + return Ch(a.l, b, e, d); + let f = null; + return w.create({next: () => { + for (; ; ) { + if (!f) { + var h = e.next(0); + if (h.done) + return p; + f = B(a.l, h.value, d).value; + } + h = f.next(0); + if (h.done) + f = null; + else + return h; + } + }}); + }); + } + var Bh = class extends D { + constructor(a, b, c, d) { + super(a, b, c, true); + this.l = d; + this.J = this.l.J; + } + h(a, b) { + return this.L(a, kd(a), b, (c) => { + if (this.l instanceof Bh) + return Ch(this.l, a, c, b); + let d = null; + return w.create({next: (e) => { + for (; ; ) { + if (!d) { + var f = c.next(0); + if (f.done) + return p; + d = B(this.l, f.value, b).value; + } + f = d.next(e); + if (f.done) + d = null; + else + return f; + } + }}); + }); + } + s(a, b) { + return Ah(this, a, kd(a), b); + } + v(a) { + super.v(a); + this.J = this.l.J; + for (const b of this.Ka) + if (b !== this.l && b.J) + throw we(); + } + }; + var Dh = class extends Bh { + constructor(a, b, c, d) { + super(b.o.add(d.o), [b, d], {B: false}, d); + this.S = a.prefix; + this.ma = a.namespaceURI; + this.Mb = a.localName; + this.wb = null; + this.A = c; + this.La = null; + this.xa = b; + } + L(a, b, c, d) { + let e = null, f = null, h = 0; + return d({next: () => { + for (; ; ) { + if (!e) { + var k = b.next(0); + if (k.done) + return p; + f = k.value; + h = 0; + e = B(this.xa, f, c).value; + } + const l = e.next(0); + if (l.done) + e = null; + else + return h++, k = {[this.wb]: () => w.m(l.value)}, this.La && (k[this.La] = () => w.m(new Da(5, h))), q(hc(f, k)); + } + }}); + } + v(a) { + if (this.S && (this.ma = a.$(this.S), !this.ma && this.S)) + throw Error(`XPST0081: Could not resolve namespace for prefix ${this.S} in a for expression`); + this.xa.v(a); + kg(a); + this.wb = og(a, this.ma, this.Mb); + if (this.A) { + if (this.A.prefix && (this.A.namespaceURI = a.$(this.A.prefix), !this.A.namespaceURI && this.A.prefix)) + throw Error(`XPST0081: Could not resolve namespace for prefix ${this.S} in the positionalVariableBinding in a for expression`); + this.La = og(a, this.A.namespaceURI, this.A.localName); + } + this.l.v(a); + qg(a); + if (this.xa.J) + throw we(); + this.l.J && (this.J = true); + } + }; + var Eh = class extends D { + constructor(a, b, c) { + super(new bf({external: 1}), [c], {B: false, P: "unsorted"}); + this.S = a.map(({name: d}) => d); + this.A = a.map(({type: d}) => d); + this.s = null; + this.L = b; + this.l = c; + } + h(a, b) { + const c = new Va({j: this.A, arity: this.A.length, Xa: true, J: this.l.J, localName: "dynamic-function", namespaceURI: "", i: this.L, value: (d, e, f, ...h) => { + d = hc(bc(a, -1, null, w.empty()), this.s.reduce((k, l, n) => { + k[l] = Ra(h[n]); + return k; + }, Object.create(null))); + return B(this.l, d, b); + }}); + return w.m(c); + } + v(a) { + kg(a); + this.s = this.S.map((b) => og(a, b.namespaceURI, b.localName)); + this.l.v(a); + qg(a); + if (this.l.J) + throw Error("Not implemented: inline functions can not yet be updating."); + } + }; + var Fh = class extends Bh { + constructor(a, b, c) { + super(b.o.add(c.o), [b, c], {B: false, W: c.W, P: c.ia, subtree: c.subtree}, c); + if (a.prefix || a.namespaceURI) + throw Error("Not implemented: let expressions with namespace usage."); + this.A = a.prefix; + this.S = a.namespaceURI; + this.La = a.localName; + this.ma = b; + this.xa = null; + } + L(a, b, c, d) { + return d({next: () => { + var e = b.next(0); + if (e.done) + return p; + e = e.value; + e = hc(e, {[this.xa]: Ra(B(this.ma, e, c))}); + return q(e); + }}); + } + v(a) { + if (this.A && (this.S = a.$(this.A), !this.S && this.A)) + throw Error(`XPST0081: Could not resolve namespace for prefix ${this.A} using in a for expression`); + this.ma.v(a); + kg(a); + this.xa = og(a, this.S, this.La); + this.l.v(a); + qg(a); + this.J = this.l.J; + if (this.ma.J) + throw we(); + } + }; + var Gh = class extends D { + constructor(a, b) { + super(new bf({}), [], {B: true, P: "sorted"}, false, b); + let c; + switch (b.type) { + case 5: + c = g(parseInt(a, 10), b.type); + break; + case 1: + c = g(a, b.type); + break; + case 4: + case 3: + c = g(parseFloat(a), b.type); + break; + default: + throw new TypeError("Type " + b + " not expected in a literal"); + } + this.l = () => w.m(c); + } + h() { + return this.l(); + } + }; + var Hh = class extends D { + constructor(a, b) { + super(new bf({external: 1}), a.reduce((c, {key: d, value: e}) => c.concat(d, e), []), {B: false}, false, b); + this.l = a; + } + h(a, b) { + const c = this.l.map((d) => qc(B(d.key, a, b), b).Y({default: () => { + throw Error("XPTY0004: A key of a map should be a single atomizable value."); + }, m: (e) => e})); + return A(c, (d) => w.m(new ub(d.map((e, f) => ({key: e, value: Ra(B(this.l[f].value, a, b))}))))); + } + }; + var Ih = class extends D { + constructor(a, b, c) { + super(new bf({external: 1}), [], {B: true}, false, c); + this.s = b; + this.A = a; + this.l = null; + } + h() { + const a = new Va({j: this.l.j, J: this.l.J, arity: this.s, localName: this.l.localName, namespaceURI: this.l.namespaceURI, i: this.l.i, value: this.l.callFunction}); + return w.m(a); + } + v(a) { + let b = this.A.namespaceURI, c = this.A.localName; + const d = this.A.prefix; + if (b === null) { + const e = a.Sa({localName: c, prefix: d}, this.s); + if (!e) + throw Error(`XPST0017: The function ${d ? d + ":" : ""}${c} with arity ${this.s} could not be resolved. ${Uf(c)}`); + b = e.namespaceURI; + c = e.localName; + } + this.l = a.ta(b, c, this.s) || null; + if (!this.l) + throw a = this.A, Error(`XPST0017: Function ${`${a.namespaceURI ? `Q{${a.namespaceURI}}` : a.prefix ? `${a.prefix}:` : ""}${a.localName}`} with arity of ${this.s} not registered. ${Uf(c)}`); + super.v(a); + } + }; + const Jh = {[5]: 5, [27]: 5, [28]: 5, [31]: 5, [32]: 5, [33]: 5, [34]: 5, [30]: 5, [36]: 5, [35]: 5, [38]: 5, [37]: 5, [29]: 5, [4]: 4, [6]: 6, [3]: 3}; + var Kh = class extends D { + constructor(a, b, c) { + super(b.o, [b], {B: false}, false, c); + this.s = b; + this.l = a; + } + h(a, b) { + return qc(B(this.s, a, b), b).M((c) => { + if (c.length === 0) + return w.empty(); + var d = c[0]; + if (this.type) + return c = this.l === "+" ? +d.value : -d.value, d.type === 0 && (c = Number.NaN), w.m(g(c, this.type.type)); + if (1 < c.length) + throw Error("XPTY0004: The operand to a unary operator must be a sequence with a length less than one"); + return v(d.type, 19) ? (d = jd(d, 3).value, w.m(g(this.l === "+" ? d : -d, 3))) : v(d.type, 2) ? this.l === "+" ? w.m(d) : w.m(g(-1 * d.value, Jh[d.type])) : w.m(g(Number.NaN, 3)); + }); + } + }; + var Lh = class extends D { + constructor(a, b) { + super(a.reduce((c, d) => c.add(d.o), new bf({})), a, {B: a.every((c) => c.B)}, false, b); + this.l = a; + this.s = a.reduce((c, d) => fh(c, d.D()), null); + } + h(a, b) { + let c = 0, d = null, e = false, f = null; + if (a !== null) { + const h = a.N; + h !== null && v(h.type, 53) && (f = Xa(h.value)); + } + return w.create({next: () => { + if (!e) { + for (; c < this.l.length; ) { + if (!d) { + const h = this.l[c]; + if (f !== null && h.D() !== null && !f.includes(h.D())) + return c++, e = true, q(wa); + d = B(h, a, b); + } + if (d.fa() === false) + return e = true, q(wa); + d = null; + c++; + } + e = true; + return q(va); + } + return p; + }}); + } + D() { + return this.s; + } + }; + var Mh = class extends D { + constructor(a, b) { + super(a.reduce((d, e) => 0 < af(d, e.o) ? d : e.o, new bf({})), a, {B: a.every((d) => d.B)}, false, b); + let c; + for (b = 0; b < a.length; ++b) { + c === void 0 && (c = a[b].D()); + if (c === null) + break; + if (c !== a[b].D()) { + c = null; + break; + } + } + this.s = c; + this.l = a; + } + h(a, b) { + let c = 0, d = null, e = false, f = null; + if (a !== null) { + const h = a.N; + h !== null && v(h.type, 53) && (f = Xa(h.value)); + } + return w.create({next: () => { + if (!e) { + for (; c < this.l.length; ) { + if (!d) { + const h = this.l[c]; + if (f !== null && h.D() !== null && !f.includes(h.D())) { + c++; + continue; + } + d = B(h, a, b); + } + if (d.fa() === true) + return e = true, q(va); + d = null; + c++; + } + e = true; + return q(wa); + } + return p; + }}); + } + D() { + return this.s; + } + }; + function Nh(a, b) { + let c; + return w.create({next: (d) => { + for (; ; ) { + if (!c) { + var e = a.value.next(d); + if (e.done) + return p; + c = pc(e.value, b); + } + e = c.value.next(d); + if (e.done) + c = null; + else + return e; + } + }}); + } + function Oh(a, b) { + if (a === "eqOp") + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value.namespaceURI === f.value.namespaceURI && e.value.localName === f.value.localName; + }; + if (a === "neOp") + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value.namespaceURI !== f.value.namespaceURI || e.value.localName !== f.value.localName; + }; + throw Error('XPTY0004: Only the "eq" and "ne" comparison is defined for xs:QName'); + } + function Ph(a, b) { + switch (a) { + case "eqOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value === f.value; + }; + case "neOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value !== f.value; + }; + case "ltOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value < f.value; + }; + case "leOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value <= f.value; + }; + case "gtOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value > f.value; + }; + case "geOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value >= f.value; + }; + } + } + function Qh(a, b) { + switch (a) { + case "ltOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value.ea < f.value.ea; + }; + case "leOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return vb(e.value, f.value) || e.value.ea < f.value.ea; + }; + case "gtOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value.ea > f.value.ea; + }; + case "geOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return vb(e.value, f.value) || e.value.ea > f.value.ea; + }; + } + } + function Rh(a, b) { + switch (a) { + case "eqOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return vb(e.value, f.value); + }; + case "ltOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value.ca < f.value.ca; + }; + case "leOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return vb(e.value, f.value) || e.value.ca < f.value.ca; + }; + case "gtOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return e.value.ca > f.value.ca; + }; + case "geOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return vb(e.value, f.value) || e.value.ca > f.value.ca; + }; + } + } + function Sh(a, b) { + switch (a) { + case "eqOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return vb(e.value, f.value); + }; + case "neOp": + return (c, d) => { + const {T: e, U: f} = b(c, d); + return !vb(e.value, f.value); + }; + } + } + function Th(a, b) { + switch (a) { + case "eqOp": + return (c, d, e) => { + const {T: f, U: h} = b(c, d); + return Ob(f.value, h.value, fc(e)); + }; + case "neOp": + return (c, d, e) => { + const {T: f, U: h} = b(c, d); + return !Ob(f.value, h.value, fc(e)); + }; + case "ltOp": + return (c, d, e) => { + const {T: f, U: h} = b(c, d); + c = fc(e); + return 0 > Nb(f.value, h.value, c); + }; + case "leOp": + return (c, d, e) => { + const {T: f, U: h} = b(c, d); + (c = Ob(f.value, h.value, fc(e))) || (e = fc(e), c = 0 > Nb(f.value, h.value, e)); + return c; + }; + case "gtOp": + return (c, d, e) => { + const {T: f, U: h} = b(c, d); + c = fc(e); + return 0 < Nb(f.value, h.value, c); + }; + case "geOp": + return (c, d, e) => { + const {T: f, U: h} = b(c, d); + (c = Ob(f.value, h.value, fc(e))) || (e = fc(e), c = 0 < Nb(f.value, h.value, e)); + return c; + }; + } + } + function Uh(a, b) { + switch (a) { + case "eqOp": + return (c, d, e) => { + const {T: f, U: h} = b(c, d); + return Ob(f.value, h.value, fc(e)); + }; + case "neOp": + return (c, d, e) => { + const {T: f, U: h} = b(c, d); + return !Ob(f.value, h.value, fc(e)); + }; + } + } + function Vh(a, b, c) { + function d(n, t) { + return {T: h ? h(n) : n, U: k ? k(t) : t}; + } + function e(n) { + return v(b, n) && v(c, n); + } + function f(n) { + return 0 < n.filter((t) => v(b, t)).length && 0 < n.filter((t) => v(c, t)).length; + } + let h = null, k = null; + v(b, 19) && v(c, 19) ? b = c = 1 : v(b, 19) ? (h = (n) => jd(n, c), b = c) : v(c, 19) && (k = (n) => jd(n, b), c = b); + if (v(b, 23) && v(c, 23)) + return Oh(a, d); + if (e(0) || f([1, 47, 61]) || f([2, 47, 61]) || e(20) || e(22) || e(21) || f([1, 20])) { + var l = Ph(a, d); + if (l !== void 0) + return l; + } + if (e(16) && (l = Qh(a, d), l !== void 0) || e(17) && (l = Rh(a, d), l !== void 0) || e(18) && (l = Sh(a, d), l !== void 0)) + return l; + if (e(9) || e(7) || e(8)) { + if (l = Th(a, d), l !== void 0) + return l; + } + if (e(11) || e(12) || e(13) || e(14) || e(15)) { + if (l = Uh(a, d), l !== void 0) + return l; + } + throw Error(`XPTY0004: ${a} not available for ${Ea[b]} and ${Ea[c]}`); + } + const Wh = Object.create(null); + function Xh(a, b, c) { + const d = `${b}~${c}~${a}`; + let e = Wh[d]; + e || (e = Wh[d] = Vh(a, b, c)); + return e; + } + var Yh = class extends D { + constructor(a, b, c) { + super(b.o.add(c.o), [b, c], {B: false}); + this.l = b; + this.A = c; + this.s = a; + } + h(a, b) { + const c = B(this.l, a, b), d = B(this.A, a, b), e = Nh(c, b), f = Nh(d, b); + return e.Y({empty: () => w.empty(), m: () => f.Y({empty: () => w.empty(), m: () => { + const h = e.first(), k = f.first(); + return Xh(this.s, h.type, k.type)(h, k, a) ? w.aa() : w.V(); + }, multiple: () => { + throw Error("XPTY0004: Sequences to compare are not singleton."); + }}), multiple: () => { + throw Error("XPTY0004: Sequences to compare are not singleton."); + }}); + } + }; + const Zh = {equalOp: "eqOp", notEqualOp: "neOp", lessThanOrEqualOp: "leOp", lessThanOp: "ltOp", greaterThanOrEqualOp: "geOp", greaterThanOp: "gtOp"}; + function $h(a, b, c, d) { + a = Zh[a]; + return c.M((e) => b.filter((f) => { + for (let l = 0, n = e.length; l < n; ++l) { + let t = e[l], u = void 0, y = void 0; + var h = f.type, k = t.type; + if (v(h, 19) || v(k, 19)) + v(h, 2) ? u = 3 : v(k, 2) ? y = 3 : v(h, 17) ? u = 17 : v(k, 17) ? y = 17 : v(h, 16) ? u = 16 : v(k, 16) ? y = 16 : v(h, 19) ? y = k : v(k, 19) && (u = h); + const [z, F] = [y, u]; + h = z; + k = F; + h ? f = jd(f, h) : k && (t = jd(t, k)); + if (Xh(a, f.type, t.type)(f, t, d)) + return true; + } + return false; + }).Y({default: () => w.aa(), empty: () => w.V()})); + } + var ai = class extends D { + constructor(a, b, c) { + super(b.o.add(c.o), [b, c], {B: false}); + this.l = b; + this.A = c; + this.s = a; + } + h(a, b) { + const c = B(this.l, a, b), d = B(this.A, a, b); + return c.Y({empty: () => w.V(), default: () => d.Y({empty: () => w.V(), default: () => { + const e = Nh(c, b), f = Nh(d, b); + return $h(this.s, e, f, a); + }})}); + } + }; + function bi(a, b, c, d) { + if (!v(c, 53) || !v(d, 53)) + throw Error("XPTY0004: Sequences to compare are not nodes"); + switch (a) { + case "isOp": + return ci(c, d); + case "nodeBeforeOp": + return b ? (e, f) => 0 > sd(b, e.first(), f.first()) : void 0; + case "nodeAfterOp": + return b ? (e, f) => 0 < sd(b, e.first(), f.first()) : void 0; + default: + throw Error("Unexpected operator"); + } + } + function ci(a, b) { + return a !== b || a !== 47 && a !== 53 && a !== 54 && a !== 55 && a !== 56 && a !== 57 && a !== 58 ? () => false : (c, d) => md(c.first().value, d.first().value); + } + var di = class extends D { + constructor(a, b, c) { + super(b.o.add(c.o), [b, c], {B: false}); + this.l = b; + this.A = c; + this.s = a; + } + h(a, b) { + const c = B(this.l, a, b), d = B(this.A, a, b); + return c.Y({empty: () => w.empty(), multiple: () => { + throw Error("XPTY0004: Sequences to compare are not singleton"); + }, m: () => d.Y({empty: () => w.empty(), multiple: () => { + throw Error("XPTY0004: Sequences to compare are not singleton"); + }, m: () => { + const e = c.first(), f = d.first(); + return bi(this.s, b.h, e.type, f.type)(c, d, a) ? w.aa() : w.V(); + }})}); + } + }; + function ei(a, b, c, d) { + return c.M((e) => { + if (e.some((f) => !v(f.type, 53))) + throw Error(`XPTY0004: Sequences given to ${a} should only contain nodes.`); + return d === "sorted" ? w.create(e) : d === "reverse-sorted" ? w.create(e.reverse()) : w.create(td(b, e)); + }); + } + var fi = class extends D { + constructor(a, b, c, d) { + super(0 < af(b.o, c.o) ? b.o : c.o, [b, c], {B: b.B && c.B}, false, d); + this.l = a; + this.s = b; + this.A = c; + } + h(a, b) { + const c = ei(this.l, b.h, B(this.s, a, b), this.s.ia); + a = ei(this.l, b.h, B(this.A, a, b), this.A.ia); + const d = c.value, e = a.value; + let f = null, h = null, k = false, l = false; + return w.create({next: () => { + if (k) + return p; + for (; !l; ) { + if (!f) { + var n = d.next(0); + if (n.done) + return k = true, p; + f = n.value; + } + if (!h) { + n = e.next(0); + if (n.done) { + l = true; + break; + } + h = n.value; + } + if (md(f.value, h.value)) { + if (n = q(f), h = f = null, this.l === "intersectOp") + return n; + } else if (0 > sd(b.h, f, h)) { + if (n = q(f), f = null, this.l === "exceptOp") + return n; + } else + h = null; + } + if (this.l === "exceptOp") + return f !== null ? (n = q(f), f = null, n) : d.next(0); + k = true; + return p; + }}); + } + }; + var gi = class extends Ye { + constructor(a, b) { + super(a.reduce((c, d) => c.add(d.o), new bf({})), a, {P: "unsorted", B: a.every((c) => c.B)}, b); + } + A(a, b, c) { + return c.length ? jc(c.map((d) => d(a))) : w.empty(); + } + }; + var hi = class extends D { + constructor(a, b, c) { + super(new bf({}).add(a.o), [a, b], {B: a.B && b.B}, false, c); + this.l = a; + this.s = b; + } + h(a, b) { + const c = B(this.l, a, b), d = dc(a, c); + let e = null, f = null, h = false; + return w.create({next: (k) => { + for (; !h; ) { + if (!e && (e = d.next(k), e.done)) + return h = true, p; + f || (f = B(this.s, e.value, b)); + const l = f.value.next(k); + if (l.done) + e = f = null; + else + return l; + } + }}); + } + }; + var ii = class extends D { + constructor(a, b, c) { + super(a.o, [a], {B: false}); + this.l = Ia(b.prefix ? `${b.prefix}:${b.localName}` : b.localName); + if (this.l === 46 || this.l === 45 || this.l === 44) + throw Error("XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted."); + if (b.namespaceURI) + throw Error("Not implemented: castable as expressions with a namespace URI."); + this.A = a; + this.s = c; + } + h(a, b) { + const c = qc(B(this.A, a, b), b); + return c.Y({empty: () => this.s ? w.aa() : w.V(), m: () => c.map((d) => id(d, this.l).u ? va : wa), multiple: () => w.V()}); + } + }; + var ji = class extends D { + constructor(a, b, c) { + super(a.o, [a], {B: false}); + this.l = Ia(b.prefix ? `${b.prefix}:${b.localName}` : b.localName); + if (this.l === 46 || this.l === 45 || this.l === 44) + throw Error("XPST0080: Casting to xs:anyAtomicType, xs:anySimpleType or xs:NOTATION is not permitted."); + if (b.namespaceURI) + throw Error("Not implemented: casting expressions with a namespace URI."); + this.A = a; + this.s = c; + } + h(a, b) { + const c = qc(B(this.A, a, b), b); + return c.Y({empty: () => { + if (!this.s) + throw Error("XPTY0004: Sequence to cast is empty while target type is singleton."); + return w.empty(); + }, m: () => c.map((d) => jd(d, this.l)), multiple: () => { + throw Error("XPTY0004: Sequence to cast is not singleton or empty."); + }}); + } + }; + function ki(a, b) { + const c = a.value; + let d = null, e = false; + return w.create({next: () => { + for (; !e; ) { + if (!d) { + var f = c.next(0); + if (f.done) + return e = true, q(va); + d = b(f.value); + } + f = d.fa(); + d = null; + if (f === false) + return e = true, q(wa); + } + return p; + }}); + } + var li = class extends D { + constructor(a, b, c, d) { + super(a.o, [a], {B: false}, false, d); + this.A = a; + this.s = b; + this.l = c; + } + h(a, b) { + const c = B(this.A, a, b); + return c.Y({empty: () => this.l === "?" || this.l === "*" ? w.aa() : w.V(), multiple: () => this.l === "+" || this.l === "*" ? ki(c, (d) => { + const e = w.m(d); + d = bc(a, 0, d, e); + return B(this.s, d, b); + }) : w.V(), m: () => ki(c, (d) => { + const e = w.m(d); + d = bc(a, 0, d, e); + return B(this.s, d, b); + })}); + } + }; + function mi(a, b) { + return a !== null && b !== null && v(a.type, 53) && v(b.type, 53) ? md(a.value, b.value) : false; + } + function ni(a) { + let b = a.next(0); + if (b.done) + return w.empty(); + let c = null, d = null; + return w.create({next(e) { + if (b.done) + return p; + c || (c = b.value.value); + let f; + do + if (f = c.next(e), f.done) { + b = a.next(0); + if (b.done) + return f; + c = b.value.value; + } + while (f.done || mi(f.value, d)); + d = f.value; + return f; + }}); + } + function oi(a, b) { + const c = []; + (function() { + for (var f = b.next(0); !f.done; ) { + const h = f.value.value; + f = {current: h.next(0), next: (k) => h.next(k)}; + f.current.done || c.push(f); + f = b.next(0); + } + })(); + let d = null, e = false; + return w.create({[Symbol.iterator]() { + return this; + }, next: () => { + e || (e = true, c.every((h) => v(h.current.value.type, 53)) && c.sort((h, k) => sd(a, h.current.value, k.current.value))); + let f; + do { + if (!c.length) + return p; + const h = c.shift(); + f = h.current; + h.current = h.next(0); + if (!v(f.value.type, 53)) + return f; + if (!h.current.done) { + let k = 0, l = c.length - 1, n = 0; + for (; k <= l; ) { + n = Math.floor((k + l) / 2); + const t = sd(a, h.current.value, c[n].current.value); + if (t === 0) { + k = n; + break; + } + 0 < t ? k = n + 1 : l = n - 1; + } + c.splice(k, 0, h); + } + } while (mi(f.value, d)); + d = f.value; + return f; + }}); + } + var pi = class extends D { + constructor(a, b) { + super(a.reduce((c, d) => 0 < af(c, d.o) ? c : d.o, new bf({})), a, {B: a.every((c) => c.B)}, false, b); + this.l = a; + } + h(a, b) { + if (this.l.every((c) => c.ia === "sorted")) { + let c = 0; + return oi(b.h, {next: () => c >= this.l.length ? p : q(B(this.l[c++], a, b))}).map((d) => { + if (!v(d.type, 53)) + throw Error("XPTY0004: The sequences to union are not of type node()*"); + return d; + }); + } + return jc(this.l.map((c) => B(c, a, b))).M((c) => { + if (c.some((d) => !v(d.type, 53))) + throw Error("XPTY0004: The sequences to union are not of type node()*"); + c = td(b.h, c); + return w.create(c); + }); + } + }; + function qi(a) { + return a.every((b) => b === null || v(b.type, 5) || v(b.type, 4)) || a.map((b) => b ? rc(b.type) : null).reduce((b, c) => c === null ? b : c === b ? b : null) !== null ? a : a.every((b) => b === null || v(b.type, 1) || v(b.type, 20)) ? a.map((b) => b ? jd(b, 1) : null) : a.every((b) => b === null || v(b.type, 4) || v(b.type, 6)) ? a.map((b) => b ? jd(b, 6) : b) : a.every((b) => b === null || v(b.type, 4) || v(b.type, 6) || v(b.type, 3)) ? a.map((b) => b ? jd(b, 3) : b) : null; + } + function ri(a) { + return (a = a.find((b) => !!b)) ? rc(a.type) : null; + } + var si = class extends Bh { + constructor(a, b) { + super(new bf({}), [b, ...a.map((c) => c.ba)], {B: false, W: false, P: "unsorted", subtree: false}, b); + this.A = a; + } + L(a, b, c, d) { + if (this.A[1]) + throw Error("More than one order spec is not supported for the order by clause."); + const e = []; + let f = false, h, k, l = null; + const n = this.A[0]; + return w.create({next: () => { + if (!f) { + for (var t = b.next(0); !t.done; ) + e.push(t.value), t = b.next(0); + t = e.map((y) => n.ba.h(y, c)).map((y) => qc(y, c)); + if (t.find((y) => !y.G() && !y.sa())) + throw Error("XPTY0004: Order by only accepts empty or singleton sequences"); + h = t.map((y) => y.first()); + h = h.map((y) => y === null ? y : v(19, y.type) ? jd(y, 1) : y); + if (ri(h) && (h = qi(h), !h)) + throw Error("XPTY0004: Could not cast values"); + t = h.length; + k = h.map((y, z) => z); + for (let y = 0; y < t; y++) + if (y + 1 !== t) + for (let z = y; 0 <= z; z--) { + const F = z, O = z + 1; + if (O === t) + continue; + const U = h[k[F]], ba = h[k[O]]; + if (ba !== null || U !== null) { + if (n.$b) { + if (U === null) + continue; + if (ba === null && U !== null) { + [k[F], k[O]] = [k[O], k[F]]; + continue; + } + if (isNaN(ba.value) && U !== null && !isNaN(U.value)) { + [k[F], k[O]] = [k[O], k[F]]; + continue; + } + } else { + if (ba === null) + continue; + if (U === null && ba !== null) { + [k[F], k[O]] = [k[O], k[F]]; + continue; + } + if (isNaN(U.value) && ba !== null && !isNaN(ba.value)) { + [k[F], k[O]] = [k[O], k[F]]; + continue; + } + } + Xh("gtOp", U.type, ba.type)(U, ba, a) && ([k[F], k[O]] = [k[O], k[F]]); + } + } + let u = n.zb ? 0 : h.length - 1; + l = d({next: () => n.zb ? u >= h.length ? p : q(e[k[u++]]) : 0 > u ? p : q(e[k[u--]])}).value; + f = true; + } + return l.next(0); + }}); + } + }; + var ti = class extends D { + constructor(a) { + super(a ? a.o : new bf({}), a ? [a] : [], {P: "sorted", subtree: false, W: false, B: false}); + this.l = a; + } + h(a, b) { + if (a.N === null) + throw lc("context is absent, it needs to be present to use paths."); + var c = b.h; + let d = a.N.value; + for (; d.node.nodeType !== 9; ) + if (d = x(c, d), d === null) + throw Error("XPDY0050: the root node of the context node is not a document node."); + c = w.m(rb(d)); + return this.l ? B(this.l, bc(a, 0, c.first(), c), b) : c; + } + }; + var ui = class extends D { + constructor(a) { + super(new bf({}), [], {P: "sorted"}, false, a); + } + h(a) { + if (a.N === null) + throw lc('context is absent, it needs to be present to use the "." operator'); + return w.m(a.N); + } + }; + function vi(a, b) { + let c = false, d = false; + b.forEach((e) => { + v(e.type, 53) ? c = true : d = true; + }); + if (d && c) + throw Error("XPTY0018: The path operator should either return nodes or non-nodes. Mixed sequences are not allowed."); + return c ? td(a, b) : b; + } + var wi = class extends D { + constructor(a, b) { + const c = a.every((e) => e.W), d = a.every((e) => e.subtree); + super(a.reduce((e, f) => e.add(f.o), new bf({})), a, {B: false, W: c, P: b ? "sorted" : "unsorted", subtree: d}); + this.l = a; + this.s = b; + } + h(a, b) { + let c = true; + return this.l.reduce((d, e, f) => { + const h = d === null ? kd(a) : dc(a, d); + d = {next: (l) => { + l = h.next(l); + if (l.done) + return p; + if (l.value.N !== null && !v(l.value.N.type, 53) && 0 < f) + throw Error("XPTY0019: The result of E1 in a path expression E1/E2 should not evaluate to a sequence of nodes."); + return q(B(e, l.value, b)); + }}; + let k; + if (this.s) + switch (e.ia) { + case "reverse-sorted": + const l = d; + d = {next: (n) => { + n = l.next(n); + return n.done ? n : q(n.value.M((t) => w.create(t.reverse()))); + }}; + case "sorted": + if (e.subtree && c) { + k = ni(d); + break; + } + k = oi(b.h, d); + break; + case "unsorted": + return ni(d).M((n) => w.create(vi(b.h, n))); + } + else + k = ni(d); + c = c && e.W; + return k; + }, null); + } + D() { + return this.l[0].D(); + } + }; + var xi = class extends D { + constructor(a, b) { + super(a.o.add(b.o), [a, b], {B: a.B && b.B, W: a.W, P: a.ia, subtree: a.subtree}); + this.s = a; + this.l = b; + } + h(a, b) { + const c = B(this.s, a, b); + if (this.l.B) { + const k = B(this.l, a, b); + if (k.G()) + return k; + const l = k.first(); + if (v(l.type, 2)) { + let n = l.value; + if (!Number.isInteger(n)) + return w.empty(); + const t = c.value; + let u = false; + return w.create({next: () => { + if (!u) { + for (let y = t.next(0); !y.done; y = t.next(0)) + if (n-- === 1) + return u = true, y; + u = true; + } + return p; + }}); + } + return k.fa() ? c : w.empty(); + } + const d = c.value; + let e = null, f = 0, h = null; + return w.create({next: (k) => { + let l = false; + for (; !e || !e.done; ) { + e || (e = d.next(l ? 0 : k), l = true); + if (e.done) + break; + h || (h = B(this.l, bc(a, f, e.value, c), b)); + var n = h.first(); + n = n === null ? false : v(n.type, 2) ? n.value === f + 1 : h.fa(); + h = null; + const t = e.value; + e = null; + f++; + if (n) + return q(t); + } + return e; + }}); + } + D() { + return this.s.D(); + } + }; + function yi(a, b, c) { + c = [c]; + if (v(a.type, 62)) + if (b === "*") + c.push(...a.h.map((d) => d())); + else if (v(b.type, 5)) { + const d = b.value; + if (a.h.length < d || 0 >= d) + throw Error("FOAY0001: Array index out of bounds"); + c.push(a.h[d - 1]()); + } else + throw Error("XPTY0004: The key specifier is not an integer."); + else if (v(a.type, 61)) + b === "*" ? c.push(...a.h.map((d) => d.value())) : (a = a.h.find((d) => sb(d.key, b))) && c.push(a.value()); + else + throw Error("XPTY0004: The provided context item is not a map or an array."); + return jc(c); + } + function zi(a, b, c, d, e) { + if (b === "*") + return yi(a, b, c); + b = B(b, d, e); + b = Ra(b)().M((f) => f.reduce((h, k) => yi(a, k, h), new Ca())); + return jc([c, b]); + } + var Ai = class extends D { + constructor(a, b) { + super(a.o, [a].concat(b === "*" ? [] : [b]), {B: a.B, P: a.ia, subtree: a.subtree}); + this.l = a; + this.s = b; + } + h(a, b) { + return B(this.l, a, b).M((c) => c.reduce((d, e) => zi(e, this.s, d, a, b), new Ca())); + } + D() { + return this.l.D(); + } + }; + var Bi = class extends D { + constructor(a, b) { + super(new bf({external: 1}), a === "*" ? [] : [a], {B: false}, false, b); + this.l = a; + } + h(a, b) { + return zi(a.N, this.l, new Ca(), a, b); + } + }; + var Ci = class extends D { + constructor(a, b, c, d) { + const e = b.map((f) => f.eb); + b = b.map((f) => f.name); + super(e.reduce((f, h) => f.add(h.o), c.o), e.concat(c), {B: false}, false, d); + this.s = a; + this.A = b; + this.L = e; + this.S = c; + this.l = null; + } + h(a, b) { + let c = a; + const d = this.l.map((k, l) => { + const n = B(this.L[l], c, b).O(); + c = hc(a, {[k]: () => w.create(n)}); + return n; + }); + if (d.some((k) => k.length === 0)) + return this.s === "every" ? w.aa() : w.V(); + const e = Array(d.length).fill(0); + e[0] = -1; + for (var f = true; f; ) { + f = false; + for (let k = 0, l = e.length; k < l; ++k) { + var h = d[k]; + if (++e[k] > h.length - 1) + e[k] = 0; + else { + f = Object.create(null); + for (h = 0; h < e.length; h++) { + const n = d[h][e[h]]; + f[this.l[h]] = () => w.m(n); + } + f = hc(a, f); + f = B(this.S, f, b); + if (f.fa() && this.s === "some") + return w.aa(); + if (!f.fa() && this.s === "every") + return w.V(); + f = true; + break; + } + } + } + return this.s === "every" ? w.aa() : w.V(); + } + v(a) { + this.l = []; + for (let c = 0, d = this.A.length; c < d; ++c) { + this.L[c].v(a); + kg(a); + var b = this.A[c]; + const e = b.prefix ? a.$(b.prefix) : null; + b = og(a, e, b.localName); + this.l[c] = b; + } + this.S.v(a); + for (let c = 0, d = this.A.length; c < d; ++c) + qg(a); + } + }; + var Di = class extends D { + constructor(a) { + super(a, [], {B: false}); + } + h(a) { + return this.l(a.N) ? w.aa() : w.V(); + } + }; + var Ei = class extends Di { + constructor(a) { + super(new bf({nodeType: 1})); + this.s = a; + } + l(a) { + if (!v(a.type, 53)) + return false; + a = a.value.node.nodeType; + return this.s === 3 && a === 4 ? true : this.s === a; + } + D() { + return `type-${this.s}`; + } + }; + var Fi = class extends Di { + constructor(a, b = {kind: null}) { + const c = a.prefix, d = a.namespaceURI; + a = a.localName; + const e = {}; + a !== "*" && (e.nodeName = 1); + e.nodeType = 1; + super(new bf(e)); + this.s = a; + this.L = d; + this.A = c; + this.S = b.kind; + } + l(a) { + const b = v(a.type, 54), c = v(a.type, 47); + if (!b && !c) + return false; + a = a.value; + return this.S !== null && (this.S === 1 && !b || this.S === 2 && !c) ? false : this.A === null && this.L !== "" && this.s === "*" ? true : this.A === "*" ? this.s === "*" ? true : this.s === a.node.localName : this.s !== "*" && this.s !== a.node.localName ? false : (a.node.namespaceURI || null) === ((this.A === "" ? b ? this.L : null : this.L) || null); + } + D() { + return this.s === "*" ? this.S === null ? "type-1-or-type-2" : `type-${this.S}` : `name-${this.s}`; + } + v(a) { + if (this.L === null && this.A !== "*" && (this.L = a.$(this.A || "") || null, !this.L && this.A)) + throw Error(`XPST0081: The prefix ${this.A} could not be resolved.`); + } + }; + var Gi = class extends Di { + constructor(a) { + super(new bf({nodeName: 1})); + this.s = a; + } + l(a) { + return v(a.type, 57) && a.value.node.target === this.s; + } + D() { + return "type-7"; + } + }; + var Hi = class extends Di { + constructor(a) { + super(new bf({})); + this.s = a; + } + l(a) { + return v(a.type, Ia(this.s.prefix ? this.s.prefix + ":" + this.s.localName : this.s.localName)); + } + }; + var Ii = class extends D { + constructor(a, b, c) { + super(new bf({}), [], {B: false, P: "unsorted"}); + this.A = c; + this.s = b; + this.L = a; + this.l = null; + } + h(a, b) { + if (!a.wa[this.l]) { + if (this.S) + return this.S(a, b); + throw Error("XQDY0054: The variable " + this.A + " is declared but not in scope."); + } + return a.wa[this.l](); + } + v(a) { + this.s === null && this.L && (this.s = a.$(this.L)); + this.l = a.cb(this.s || "", this.A); + if (!this.l) + throw Error("XPST0008, The variable " + this.A + " is not in scope."); + if (a = a.Da[this.l]) + this.S = a; + } + }; + var Ji = class extends Bh { + constructor(a, b) { + super(new bf({}), [a, b], {B: false, W: false, P: "unsorted", subtree: false}, b); + this.A = a; + } + L(a, b, c, d) { + let e = null, f = null; + return d({next: () => { + for (; ; ) { + if (!f) { + var h = b.next(0); + if (h.done) + return p; + e = h.value; + f = B(this.A, e, c); + } + h = f.fa(); + const k = e; + f = e = null; + if (h) + return q(k); + } + }}); + } + }; + var Ki = class { + constructor(a) { + this.type = a; + } + }; + var Li = class extends Ki { + constructor(a) { + super("delete"); + this.target = a; + } + h(a) { + return {type: this.type, target: If(this.target, a, false)}; + } + }; + var Mi = class extends Ki { + constructor(a, b, c) { + super(c); + this.target = a; + this.content = b; + } + h(a) { + return {type: this.type, target: If(this.target, a, false), content: this.content.map((b) => If(b, a, true))}; + } + }; + var Ni = class extends Mi { + constructor(a, b) { + super(a, b, "insertAfter"); + } + }; + var Oi = class extends Ki { + constructor(a, b) { + super("insertAttributes"); + this.target = a; + this.content = b; + } + h(a) { + return {type: this.type, target: If(this.target, a, false), content: this.content.map((b) => If(b, a, true))}; + } + }; + var Pi = class extends Mi { + constructor(a, b) { + super(a, b, "insertBefore"); + } + }; + var Qi = class extends Mi { + constructor(a, b) { + super(a, b, "insertIntoAsFirst"); + } + }; + var Ri = class extends Mi { + constructor(a, b) { + super(a, b, "insertIntoAsLast"); + } + }; + var Si = class extends Mi { + constructor(a, b) { + super(a, b, "insertInto"); + } + }; + var Ti = class extends Ki { + constructor(a, b) { + super("rename"); + this.target = a; + this.o = b.ya ? b : new Ta(b.prefix, b.namespaceURI, b.localName); + } + h(a) { + return {type: this.type, target: If(this.target, a, false), newName: {prefix: this.o.prefix, namespaceURI: this.o.namespaceURI, localName: this.o.localName}}; + } + }; + var Ui = class extends Ki { + constructor(a, b) { + super("replaceElementContent"); + this.target = a; + this.text = b; + } + h(a) { + return {type: this.type, target: If(this.target, a, false), text: this.text ? If(this.text, a, true) : null}; + } + }; + var Vi = class extends Ki { + constructor(a, b) { + super("replaceNode"); + this.target = a; + this.o = b; + } + h(a) { + return {type: this.type, target: If(this.target, a, false), replacement: this.o.map((b) => If(b, a, true))}; + } + }; + var Wi = class extends Ki { + constructor(a, b) { + super("replaceValue"); + this.target = a; + this.o = b; + } + h(a) { + return {type: this.type, target: If(this.target, a, false), ["string-value"]: this.o}; + } + }; + var Xi = (a, b) => new Vi(a, b); + var Yi = class extends Ve { + constructor(a) { + super(new bf({}), [a], {B: false, P: "unsorted"}); + this.l = a; + } + s(a, b) { + const c = Ue(this.l)(a, b), d = b.h; + let e, f; + return {next: () => { + if (!e) { + const h = c.next(0); + if (h.value.I.some((k) => !v(k.type, 53))) + throw Error("XUTY0007: The target of a delete expression must be a sequence of zero or more nodes."); + e = h.value.I; + f = h.value.da; + } + e = e.filter((h) => x(d, h.value)); + return q({da: Te(e.map((h) => new Li(h.value)), f), I: []}); + }}; + } + }; + function Zi(a, b, c, d, e, f) { + const h = b.h; + a.reduce(function t(l, n) { + if (v(n.type, 62)) + return n.h.forEach((u) => u().O().forEach((y) => t(l, y))), l; + l.push(n); + return l; + }, []).forEach((l, n, t) => { + if (v(l.type, 47)) { + if (e) + throw f(l.value, h); + c.push(l.value.node); + } else if (v(l.type, 46) || v(l.type, 53) && l.value.node.nodeType === 3) { + const u = v(l.type, 46) ? jd(pc(l, b).first(), 1).value : ib(h, l.value); + n !== 0 && v(t[n - 1].type, 46) && v(l.type, 46) ? (d.push({data: " " + u, Ra: true, nodeType: 3}), e = true) : u && (d.push({data: "" + u, Ra: true, nodeType: 3}), e = true); + } else if (v(l.type, 55)) { + const u = []; + hb(h, l.value).forEach((y) => u.push(rb(y))); + e = Zi(u, b, c, d, e, f); + } else if (v(l.type, 53)) + d.push(l.value.node), e = true; + else { + if (v(l.type, 60)) + throw nc(l.type); + throw Error(`Atomizing ${l.type} is not implemented.`); + } + }); + return e; + } + function $i(a, b, c) { + const d = [], e = []; + let f = false; + a.forEach((h) => { + f = Zi(h, b, d, e, f, c); + }); + return {attributes: d, Wa: e}; + } + function aj(a, b, c, d, e) { + const f = []; + switch (a) { + case 4: + d.length && f.push(new Oi(b, d)); + e.length && f.push(new Qi(b, e)); + break; + case 5: + d.length && f.push(new Oi(b, d)); + e.length && f.push(new Ri(b, e)); + break; + case 3: + d.length && f.push(new Oi(b, d)); + e.length && f.push(new Si(b, e)); + break; + case 2: + d.length && f.push(new Oi(c, d)); + e.length && f.push(new Pi(b, e)); + break; + case 1: + d.length && f.push(new Oi(c, d)), e.length && f.push(new Ni(b, e)); + } + return f; + } + var bj = class extends Ve { + constructor(a, b, c) { + super(new bf({}), [a, c], {B: false, P: "unsorted"}); + this.L = a; + this.l = b; + this.A = c; + } + s(a, b) { + const c = Ue(this.L)(a, b), d = Ue(this.A)(a, b), e = b.h; + let f, h, k, l, n, t; + return {next: () => { + if (!f) { + var u = c.next(0); + const y = $i([u.value.I], b, xe); + f = y.attributes.map((z) => ({node: z, F: null})); + h = y.Wa.map((z) => ({node: z, F: null})); + k = u.value.da; + } + if (!l) { + u = d.next(0); + if (u.value.I.length === 0) + throw Ge(); + if (3 <= this.l) { + if (u.value.I.length !== 1) + throw ye(); + if (!v(u.value.I[0].type, 54) && !v(u.value.I[0].type, 55)) + throw ye(); + } else { + if (u.value.I.length !== 1) + throw ze(); + if (!(v(u.value.I[0].type, 54) || v(u.value.I[0].type, 56) || v(u.value.I[0].type, 58) || v(u.value.I[0].type, 57))) + throw ze(); + t = x(e, u.value.I[0].value, null); + if (t === null) + throw Error(`XUDY0029: The target ${u.value.I[0].value.outerHTML} for inserting a node before or after must have a parent.`); + } + l = u.value.I[0]; + n = u.value.da; + } + if (f.length) { + if (3 <= this.l) { + if (!v(l.type, 54)) + throw Error("XUTY0022: An insert expression specifies the insertion of an attribute node into a document node."); + } else if (t.node.nodeType !== 1) + throw Error("XUDY0030: An insert expression specifies the insertion of an attribute node before or after a child of a document node."); + f.reduce((y, z) => { + const F = z.node.prefix || ""; + var O = z.node.prefix || ""; + const U = z.node.namespaceURI, ba = O ? l.value.node.lookupNamespaceURI(O) : null; + if (ba && ba !== U) + throw Ee(U); + if ((O = y[O]) && U !== O) + throw Fe(U); + y[F] = z.node.namespaceURI; + return y; + }, {}); + } + return q({I: [], da: Te(aj(this.l, l.value, t ? t : null, f, h), k, n)}); + }}; + } + }; + const cj = () => mc("Casting not supported from given type to a single xs:string or xs:untypedAtomic or any of its derived types."), dj = /([A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])/, ej = new RegExp(`${dj.source}${new RegExp(`(${dj.source}|[-.0-9\xB7\u0300-\u036F\u203F\u2040])`).source}*`, "g"), fj = (a) => (a = a.match(ej)) ? a.length === 1 : false; + function gj(a, b) { + return qc(b, a).Y({m: (c) => { + c = c.first(); + if (v(c.type, 1) || v(c.type, 19)) { + if (!fj(c.value)) + throw Error(`XQDY0041: The value "${c.value}" of a name expressions cannot be converted to a NCName.`); + return w.m(c); + } + throw cj(); + }, default: () => { + throw cj(); + }}).value; + } + function hj(a, b, c) { + return qc(c, b).Y({m: (d) => { + d = d.first(); + if (v(d.type, 23)) + return w.m(d); + if (v(d.type, 1) || v(d.type, 19)) { + let e, f; + d = d.value.split(":"); + d.length === 1 ? d = d[0] : (e = d[0], f = a.$(e), d = d[1]); + if (!fj(d) || e && !fj(e)) + throw fg(e ? `${e}:${d}` : d); + if (e && !f) + throw fg(`${e}:${d}`); + return w.m({type: 23, value: new Ta(e, f, d)}); + } + throw cj(); + }, default: () => { + throw cj(); + }}).value; + } + var ij = class extends Ve { + constructor(a, b) { + super(new bf({}), [a, b], {B: false, P: "unsorted"}); + this.A = a; + this.L = b; + this.l = void 0; + } + s(a, b) { + const c = Ue(this.A)(a, b), d = Ue(this.L)(a, b); + return {next: () => { + const e = c.next(0); + var f = e.value.I; + if (f.length === 0) + throw Ge(); + if (f.length !== 1) + throw Be(); + if (!v(f[0].type, 54) && !v(f[0].type, 47) && !v(f[0].type, 57)) + throw Be(); + f = f[0]; + const h = d.next(0); + a: { + var k = this.l; + var l = w.create(h.value.I); + switch (f.type) { + case 54: + k = hj(k, b, l).next(0).value.value; + if ((l = f.value.node.lookupNamespaceURI(k.prefix)) && l !== k.namespaceURI) + throw Ee(k.namespaceURI); + break a; + case 47: + k = hj(k, b, l).next(0).value.value; + if (k.namespaceURI && (l = f.value.node.lookupNamespaceURI(k.prefix)) && l !== k.namespaceURI) + throw Ee(k.namespaceURI); + break a; + case 57: + k = gj(b, l).next(0).value.value; + k = new Ta("", null, k); + break a; + } + k = void 0; + } + return q({I: [], da: Te([new Ti(f.value, k)], e.value.da, h.value.da)}); + }}; + } + v(a) { + this.l = gf(a); + super.v(a); + } + }; + function jj(a, b, c) { + let d, e, f; + return {next: () => { + if (!d) { + var h = c.next(0), k = $i([h.value.I], a, Fe); + d = {attributes: k.attributes.map((l) => ({node: l, F: null})), Wa: k.Wa.map((l) => ({node: l, F: null}))}; + e = h.value.da; + } + k = b.next(0); + if (k.value.I.length === 0) + throw Ge(); + if (k.value.I.length !== 1) + throw Ae(); + if (!(v(k.value.I[0].type, 54) || v(k.value.I[0].type, 47) || v(k.value.I[0].type, 56) || v(k.value.I[0].type, 58) || v(k.value.I[0].type, 57))) + throw Ae(); + f = x(a.h, k.value.I[0].value, null); + if (f === null) + throw Error(`XUDY0009: The target ${k.value.I[0].value.outerHTML} for replacing a node must have a parent.`); + h = k.value.I[0]; + k = k.value.da; + if (v(h.type, 47)) { + if (d.Wa.length) + throw Error("XUTY0011: When replacing an attribute the new value must be zero or more attribute nodes."); + d.attributes.reduce((l, n) => { + const t = n.node.prefix || ""; + n = n.node.namespaceURI; + var u = f.node.lookupNamespaceURI(t); + if (u && u !== n) + throw Ee(n); + if ((u = l[t]) && n !== u) + throw Fe(n); + l[t] = n; + return l; + }, {}); + } else if (d.attributes.length) + throw Error("XUTY0010: When replacing an an element, text, comment, or processing instruction node the new value must be a single node."); + return q({I: [], da: Te([Xi(h.value, [].concat(d.attributes, d.Wa))], e, k)}); + }}; + } + function kj(a, b, c) { + let d, e, f, h, k = false; + return {next: () => { + if (k) + return p; + if (!f) { + var l = c.next(0); + const n = qc(w.create(l.value.I), a).map((t) => jd(t, 1)).O().map((t) => t.value).join(" "); + f = n.length === 0 ? null : {node: a.Ia.createTextNode(n), F: null}; + h = l.value.da; + } + if (!d) { + l = b.next(0); + if (l.value.I.length === 0) + throw Ge(); + if (l.value.I.length !== 1) + throw Ae(); + if (!(v(l.value.I[0].type, 54) || v(l.value.I[0].type, 47) || v(l.value.I[0].type, 56) || v(l.value.I[0].type, 58) || v(l.value.I[0].type, 57))) + throw Ae(); + d = l.value.I[0]; + e = l.value.da; + } + if (v(d.type, 54)) + return k = true, q({I: [], da: Te([new Ui(d.value, f)], h, e)}); + if (v(d.type, 47) || v(d.type, 56) || v(d.type, 58) || v(d.type, 57)) { + l = f ? ib(a.h, f) : ""; + if (v(d.type, 58) && (l.includes("--") || l.endsWith("-"))) + throw Error(`XQDY0072: The content "${l}" for a comment node contains two adjacent hyphens or ends with a hyphen.`); + if (v(d.type, 57) && l.includes("?>")) + throw Error(`XQDY0026: The content "${l}" for a processing instruction node contains "?>".`); + k = true; + return q({I: [], da: Te([new Wi(d.value, l)], h, e)}); + } + }}; + } + var lj = class extends Ve { + constructor(a, b, c) { + super(new bf({}), [b, c], {B: false, P: "unsorted"}); + this.L = a; + this.l = b; + this.A = c; + } + s(a, b) { + const c = Ue(this.l)(a, b); + a = Ue(this.A)(a, b); + return this.L ? kj(b, c, a) : jj(b, c, a); + } + }; + function yj(a) { + switch (a.type) { + case "delete": + return new Li({node: a.target, F: null}); + case "insertAfter": + return new Ni({node: a.target, F: null}, a.content.map((b) => ({node: b, F: null}))); + case "insertBefore": + return new Pi({node: a.target, F: null}, a.content.map((b) => ({node: b, F: null}))); + case "insertInto": + return new Si({node: a.target, F: null}, a.content.map((b) => ({node: b, F: null}))); + case "insertIntoAsFirst": + return new Qi({node: a.target, F: null}, a.content.map((b) => ({node: b, F: null}))); + case "insertIntoAsLast": + return new Ri({ + node: a.target, + F: null + }, a.content.map((b) => ({node: b, F: null}))); + case "insertAttributes": + return new Oi({node: a.target, F: null}, a.content.map((b) => ({node: b, F: null}))); + case "rename": + return new Ti({node: a.target, F: null}, a.newName); + case "replaceNode": + return new Vi({node: a.target, F: null}, a.replacement.map((b) => ({node: b, F: null}))); + case "replaceValue": + return new Wi({node: a.target, F: null}, a["string-value"]); + case "replaceElementContent": + return new Ui({node: a.target, F: null}, a.text ? {node: a.text, F: null} : null); + default: + throw Error(`Unexpected type "${a.type}" when parsing a transferable pending update.`); + } + } + function zj(a, b, c) { + if (b.find((e) => md(e, a))) + return true; + const d = x(c, a); + return d ? zj(d, b, c) : false; + } + var Aj = class extends Ve { + constructor(a, b, c) { + super(new bf({}), a.reduce((d, e) => { + d.push(e.eb); + return d; + }, [b, c]), {B: false, P: "unsorted"}); + this.l = a; + this.L = b; + this.A = c; + this.J = null; + } + h(a, b) { + a = this.s(a, b); + return We(a, () => { + }); + } + s(a, b) { + const c = b.h, d = b.Ia, e = b.Ma, f = []; + let h, k, l; + const n = [], t = []; + return {next: () => { + if (n.length !== this.l.length) + for (var u = n.length; u < this.l.length; u++) { + const z = this.l[u]; + var y = f[u]; + y || (f[u] = y = Ue(z.eb)(a, b)); + y = y.next(0); + if (y.value.I.length !== 1 || !v(y.value.I[0].type, 53)) + throw Error("XUTY0013: The source expression of a copy modify expression must return a single node."); + const F = rb(Ef(y.value.I[0].value, b)); + n.push(F.value); + t.push(y.value.da); + a = hc(a, {[z.dc]: () => w.m(F)}); + } + l || (h || (h = Ue(this.L)(a, b)), l = h.next(0).value.da); + l.forEach((z) => { + if (z.target && !zj(z.target, n, c)) + throw Error(`XUDY0014: The target ${z.target.node.outerHTML} must be a node created by the copy clause.`); + if (z.type === "put") + throw Error("XUDY0037: The modify expression of a copy modify expression can not contain a fn:put."); + }); + u = l.map((z) => { + z = z.h(b); + return yj(z); + }); + Se(u, c, d, e); + k || (k = Ue(this.A)(a, b)); + u = k.next(0); + return q({ + I: u.value.I, + da: Te(u.value.da, ...t) + }); + }}; + } + v(a) { + kg(a); + this.l.forEach((b) => b.dc = og(a, b.Gb.namespaceURI, b.Gb.localName)); + super.v(a); + qg(a); + this.J = this.l.some((b) => b.eb.J) || this.A.J; + } + }; + function Bj(a, b) { + return {node: {nodeType: 2, Ra: true, nodeName: a.ya(), namespaceURI: a.namespaceURI, prefix: a.prefix, localName: a.localName, name: a.ya(), value: b}, F: null}; + } + var Cj = class extends D { + constructor(a, b) { + let c = b.mb || []; + c = c.concat(a.Na || []); + super(new bf({}), c, {B: false, P: "unsorted"}); + a.Na ? this.s = a.Na : this.name = new Ta(a.prefix, a.namespaceURI, a.localName); + this.l = b; + this.A = void 0; + } + h(a, b) { + let c, d, e, f = false; + return w.create({next: () => { + if (f) + return p; + if (!d) { + if (this.s) { + if (!c) { + var h = this.s.h(a, b); + c = hj(this.A, b, h); + } + d = c.next(0).value.value; + } else + d = this.name; + if (d) { + if (d.prefix === "xmlns") + throw $f(d); + if (d.prefix === "" && d.localName === "xmlns") + throw $f(d); + if (d.namespaceURI === "http://www.w3.org/2000/xmlns/") + throw $f(d); + if (d.prefix === "xml" && d.namespaceURI !== "http://www.w3.org/XML/1998/namespace") + throw $f(d); + if (d.prefix !== "" && d.prefix !== "xml" && d.namespaceURI === "http://www.w3.org/XML/1998/namespace") + throw $f(d); + } + } + if (this.l.mb) + return h = this.l.mb, e || (e = jc(h.map((k) => qc(k.h(a, b), b).M((l) => w.m(g(l.map((n) => n.value).join(" "), 1))))).M((k) => w.m(rb(Bj(d, k.map((l) => l.value).join(""))))).value), e.next(0); + f = true; + return q(rb(Bj(d, this.l.value))); + }}); + } + v(a) { + this.A = gf(a); + if (this.name && this.name.prefix && !this.name.namespaceURI) { + const b = a.$(this.name.prefix); + if (b === void 0 && this.name.prefix) + throw oc(this.name.prefix); + this.name.namespaceURI = b || null; + } + super.v(a); + } + }; + var Dj = class extends D { + constructor(a) { + super(a ? a.o : new bf({}), a ? [a] : [], {B: false, P: "unsorted"}); + this.l = a; + } + h(a, b) { + const c = {data: "", Ra: true, nodeType: 8}, d = {node: c, F: null}; + if (!this.l) + return w.m(rb(d)); + a = B(this.l, a, b); + return qc(a, b).M((e) => { + e = e.map((f) => jd(f, 1).value).join(" "); + if (e.indexOf("-->") !== -1) + throw Error('XQDY0072: The contents of the data of a comment may not include "-->"'); + c.data = e; + return w.m(rb(d)); + }); + } + }; + var Ej = class extends D { + constructor(a, b, c, d) { + super(new bf({}), d.concat(b).concat(a.Na || []), {B: false, P: "unsorted"}); + a.Na ? this.s = a.Na : this.l = new Ta(a.prefix, a.namespaceURI, a.localName); + this.S = c.reduce((e, f) => { + if (f.prefix in e) + throw Error(`XQST0071: The namespace declaration with the prefix ${f.prefix} has already been declared on the constructed element.`); + e[f.prefix || ""] = f.uri; + return e; + }, {}); + this.L = b; + this.ma = d; + this.A = void 0; + } + h(a, b) { + let c = false, d, e, f = false, h, k, l, n = false; + return w.create({next: () => { + if (n) + return p; + c || (d || (d = jc(this.L.map((F) => B(F, a, b)))), e = d.O(), c = true); + if (!f) { + h || (h = this.ma.map((F) => B(F, a, b))); + var t = []; + for (var u = 0; u < h.length; u++) { + var y = h[u].O(); + t.push(y); + } + k = t; + f = true; + } + this.s && (l || (t = this.s.h(a, b), l = hj(this.A, b, t)), this.l = l.next(0).value.value); + if (this.l.prefix === "xmlns" || this.l.namespaceURI === "http://www.w3.org/2000/xmlns/" || this.l.prefix === "xml" && this.l.namespaceURI !== "http://www.w3.org/XML/1998/namespace" || this.l.prefix && this.l.prefix !== "xml" && this.l.namespaceURI === "http://www.w3.org/XML/1998/namespace") + throw Error(`XQDY0096: The node name "${this.l.ya()}" is invalid for a computed element constructor.`); + const z = {nodeType: 1, Ra: true, attributes: [], childNodes: [], nodeName: this.l.ya(), namespaceURI: this.l.namespaceURI, prefix: this.l.prefix, localName: this.l.localName}; + t = {node: z, F: null}; + e.forEach((F) => { + z.attributes.push(F.value.node); + }); + u = $i(k, b, Zf); + u.attributes.forEach((F) => { + if (z.attributes.find((O) => O.namespaceURI === F.namespaceURI && O.localName === F.localName)) + throw Error(`XQDY0025: The attribute ${F.name} does not have an unique name in the constructed element.`); + z.attributes.push(F); + }); + u.Wa.forEach((F) => { + z.childNodes.push(F); + }); + for (u = 0; u < z.childNodes.length; u++) { + y = z.childNodes[u]; + if (!cb(y) || y.nodeType !== 3) + continue; + const F = z.childNodes[u - 1]; + F && cb(F) && F.nodeType === 3 && (F.data += y.data, z.childNodes.splice(u, 1), u--); + } + n = true; + return q(rb(t)); + }}); + } + v(a) { + kg(a); + Object.keys(this.S).forEach((b) => ng(a, b, this.S[b])); + this.Ka.forEach((b) => b.v(a)); + this.L.reduce((b, c) => { + if (c.name) { + c = `Q{${c.name.namespaceURI === null ? a.$(c.name.prefix) : c.name.namespaceURI}}${c.name.localName}`; + if (b.includes(c)) + throw Error(`XQST0040: The attribute ${c} does not have an unique name in the constructed element.`); + b.push(c); + } + return b; + }, []); + if (this.l && this.l.namespaceURI === null) { + const b = a.$(this.l.prefix); + if (b === void 0 && this.l.prefix) + throw oc(this.l.prefix); + this.l.namespaceURI = b; + } + this.A = gf(a); + qg(a); + } + }; + function Fj(a) { + if (/^xml$/i.test(a)) + throw Error(`XQDY0064: The target of a created PI may not be "${a}"`); + } + function Gj(a, b) { + return {node: {data: b, Ra: true, nodeName: a, nodeType: 7, target: a}, F: null}; + } + var Hj = class extends D { + constructor(a, b) { + const c = a.vb ? [a.vb].concat(b) : [b]; + super(c.reduce((d, e) => d.add(e.o), new bf({})), c, {B: false, P: "unsorted"}); + this.l = a; + this.s = b; + } + h(a, b) { + const c = B(this.s, a, b); + return qc(c, b).M((d) => { + const e = d.map((h) => jd(h, 1).value).join(" "); + if (e.indexOf("?>") !== -1) + throw Error('XQDY0026: The contents of the data of a processing instruction may not include "?>"'); + if (this.l.Db !== null) + return d = this.l.Db, Fj(d), w.m(rb(Gj(d, e))); + d = B(this.l.vb, a, b); + const f = gj(b, d); + return w.create({next: () => { + var h = f.next(0); + if (h.done) + return h; + h = h.value.value; + Fj(h); + return q(rb(Gj(h, e))); + }}); + }); + } + }; + var Ij = class extends D { + constructor(a) { + super(a ? a.o : new bf({}), a ? [a] : [], {B: false, P: "unsorted"}); + this.l = a; + } + h(a, b) { + if (!this.l) + return w.empty(); + a = B(this.l, a, b); + return qc(a, b).M((c) => { + if (c.length === 0) + return w.empty(); + c = {node: {data: c.map((d) => jd(d, 1).value).join(" "), Ra: true, nodeType: 3}, F: null}; + return w.m(rb(c)); + }); + } + }; + var Jj = class extends Ye { + constructor(a, b, c, d) { + super(new bf({}), [a, ...b.map((e) => e.Xb), c].concat(...b.map((e) => e.Fb.map((f) => f.Eb))), {B: false, W: false, P: "unsorted", subtree: false}, d); + this.L = a; + this.l = b.length; + this.S = b.map((e) => e.Fb); + } + A(a, b, c) { + return c[0](a).M((d) => { + for (let e = 0; e < this.l; e++) + if (this.S[e].some((f) => { + switch (f.bc) { + case "?": + if (1 < d.length) + return false; + break; + case "*": + break; + case "+": + if (1 > d.length) + return false; + break; + default: + if (d.length !== 1) + return false; + } + const h = w.create(d); + return d.every((k, l) => { + k = bc(a, l, k, h); + return B(f.Eb, k, b).fa(); + }); + })) + return c[e + 1](a); + return c[this.l + 1](a); + }); + } + v(a) { + super.v(a); + if (this.L.J) + throw we(); + } + }; + var Kj = {Z: false, qa: false}, Lj = {Z: true, qa: false}, Mj = {Z: true, qa: true}; + function P(a) { + return a.Z ? a.qa ? Mj : Lj : Kj; + } + function Q(a, b) { + switch (a[0]) { + case "andOp": + var c = I(a, "type"); + return new Lh(Nj("andOp", a, P(b)), c); + case "orOp": + return c = I(a, "type"), new Mh(Nj("orOp", a, P(b)), c); + case "unaryPlusOp": + return c = G(G(a, "operand"), "*"), a = I(a, "type"), new Kh("+", Q(c, b), a); + case "unaryMinusOp": + return c = G(G(a, "operand"), "*"), a = I(a, "type"), new Kh("-", Q(c, b), a); + case "addOp": + case "subtractOp": + case "multiplyOp": + case "divOp": + case "idivOp": + case "modOp": + var d = a[0], e = Q(J(a, ["firstOperand", "*"]), P(b)); + b = Q(J(a, ["secondOperand", "*"]), P(b)); + const f = I(a, "type"), h = I(J(a, ["firstOperand", "*"]), "type"), k = I(J(a, ["secondOperand", "*"]), "type"); + h && k && I(a, "type") && (c = zg(d, h.type, k.type)); + return new Dg(d, e, b, f, c); + case "sequenceExpr": + return Oj(a, b); + case "unionOp": + return c = I(a, "type"), new pi([Q(J(a, ["firstOperand", "*"]), P(b)), Q(J(a, ["secondOperand", "*"]), P(b))], c); + case "exceptOp": + case "intersectOp": + return c = I(a, "type"), new fi(a[0], Q(J(a, ["firstOperand", "*"]), P(b)), Q(J(a, ["secondOperand", "*"]), P(b)), c); + case "stringConcatenateOp": + return Pj(a, b); + case "rangeSequenceExpr": + return Qj(a, b); + case "equalOp": + case "notEqualOp": + case "lessThanOrEqualOp": + case "lessThanOp": + case "greaterThanOrEqualOp": + case "greaterThanOp": + return Rj("generalCompare", a, b); + case "eqOp": + case "neOp": + case "ltOp": + case "leOp": + case "gtOp": + case "geOp": + return Rj("valueCompare", a, b); + case "isOp": + case "nodeBeforeOp": + case "nodeAfterOp": + return Rj("nodeCompare", a, b); + case "pathExpr": + return Sj(a, b); + case "contextItemExpr": + return new ui(I(a, "type")); + case "functionCallExpr": + return Tj(a, b); + case "inlineFunctionExpr": + return Uj(a, b); + case "arrowExpr": + return Vj(a, b); + case "dynamicFunctionInvocationExpr": + return Wj(a, b); + case "namedFunctionRef": + return b = G(a, "functionName"), c = I(a, "type"), a = H(J(a, ["integerConstantExpr", "value"])), new Ih(rg(b), parseInt(a, 10), c); + case "integerConstantExpr": + return new Gh(H(G(a, "value")), {type: 5, g: 3}); + case "stringConstantExpr": + return new Gh(H(G(a, "value")), {type: 1, g: 3}); + case "decimalConstantExpr": + return new Gh(H(G(a, "value")), {type: 4, g: 3}); + case "doubleConstantExpr": + return new Gh(H(G(a, "value")), {type: 3, g: 3}); + case "varRef": + const {prefix: l, namespaceURI: n, localName: t} = rg(G(a, "name")); + return new Ii(l, n, t); + case "flworExpr": + return Xj(a, b); + case "quantifiedExpr": + return Yj(a, b); + case "ifThenElseExpr": + return c = I(a, "type"), new xh(Q(G(G(a, "ifClause"), "*"), P(b)), Q(G(G(a, "thenClause"), "*"), b), Q(G(G(a, "elseClause"), "*"), b), c); + case "instanceOfExpr": + return c = Q(J(a, ["argExpr", "*"]), b), d = J(a, ["sequenceType", "*"]), e = J(a, ["sequenceType", "occurrenceIndicator"]), a = I(a, "type"), new li(c, Q(d, P(b)), e ? H(e) : "", a); + case "castExpr": + return b = Q(G(G(a, "argExpr"), "*"), P(b)), c = G(a, "singleType"), a = rg(G(c, "atomicType")), c = G(c, "optional") !== null, new ji(b, a, c); + case "castableExpr": + return b = Q(G(G(a, "argExpr"), "*"), P(b)), c = G(a, "singleType"), a = rg(G(c, "atomicType")), c = G(c, "optional") !== null, new ii(b, a, c); + case "simpleMapExpr": + return Zj(a, b); + case "mapConstructor": + return ak(a, b); + case "arrayConstructor": + return bk(a, b); + case "unaryLookup": + return c = I(a, "type"), new Bi(ck(a, b), c); + case "typeswitchExpr": + return dk(a, b); + case "elementConstructor": + return ek(a, b); + case "attributeConstructor": + return fk(a, b); + case "computedAttributeConstructor": + return (c = G(a, "tagName")) ? c = rg(c) : (c = G(a, "tagNameExpr"), c = {Na: Q(G(c, "*"), P(b))}), a = Q(G(G(a, "valueExpr"), "*"), P(b)), new Cj(c, {mb: [a]}); + case "computedCommentConstructor": + if (!b.Z) + throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context"); + a = (a = G(a, "argExpr")) ? Q(G(a, "*"), P(b)) : null; + return new Dj(a); + case "computedTextConstructor": + if (!b.Z) + throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context"); + a = (a = G(a, "argExpr")) ? Q(G(a, "*"), P(b)) : null; + return new Ij(a); + case "computedElementConstructor": + return gk(a, b); + case "computedPIConstructor": + if (!b.Z) + throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context"); + c = G(a, "piTargetExpr"); + d = G(a, "piTarget"); + e = G(a, "piValueExpr"); + a = I(a, "type"); + return new Hj({vb: c ? Q(G(c, "*"), P(b)) : null, Db: d ? H(d) : null}, e ? Q(G(e, "*"), P(b)) : new gi([], a)); + case "CDataSection": + return new Gh(H(a), {type: 1, g: 3}); + case "deleteExpr": + return a = Q(J(a, ["targetExpr", "*"]), b), new Yi(a); + case "insertExpr": + c = Q(J(a, ["sourceExpr", "*"]), b); + e = K(a, "*")[1]; + switch (e[0]) { + case "insertAfter": + d = 1; + break; + case "insertBefore": + d = 2; + break; + case "insertInto": + d = (d = G(e, "*")) ? d[0] === "insertAsFirst" ? 4 : 5 : 3; + } + a = Q(J(a, ["targetExpr", "*"]), b); + return new bj(c, d, a); + case "renameExpr": + return c = Q(J(a, ["targetExpr", "*"]), b), a = Q(J(a, ["newNameExpr", "*"]), b), new ij(c, a); + case "replaceExpr": + return c = !!G(a, "replaceValue"), d = Q(J(a, ["targetExpr", "*"]), b), a = Q(J(a, ["replacementExpr", "*"]), b), new lj(c, d, a); + case "transformExpr": + return hk(a, b); + case "x:stackTrace": + c = a[1]; + for (a = a[2]; a[0] === "x:stackTrace"; ) + a = a[2]; + return new zh(c, a[0], Q(a, b)); + default: + return ik(a); + } + } + function ik(a) { + switch (a[0]) { + case "nameTest": + return new Fi(rg(a)); + case "piTest": + return (a = G(a, "piTarget")) ? new Gi(H(a)) : new Ei(7); + case "commentTest": + return new Ei(8); + case "textTest": + return new Ei(3); + case "documentTest": + return new Ei(9); + case "attributeTest": + var b = (a = G(a, "attributeName")) && G(a, "star"); + return !a || b ? new Ei(2) : new Fi(rg(G(a, "QName")), {kind: 2}); + case "elementTest": + return b = (a = G(a, "elementName")) && G(a, "star"), !a || b ? new Ei(1) : new Fi(rg(G(a, "QName")), {kind: 1}); + case "anyKindTest": + return new Hi({ + prefix: "", + namespaceURI: null, + localName: "node()" + }); + case "anyMapTest": + return new Hi({prefix: "", namespaceURI: null, localName: "map(*)"}); + case "anyArrayTest": + return new Hi({prefix: "", namespaceURI: null, localName: "array(*)"}); + case "Wildcard": + return G(a, "star") ? (b = G(a, "uri")) ? a = new Fi({localName: "*", namespaceURI: H(b), prefix: ""}) : (b = G(a, "NCName"), a = G(a, "*")[0] === "star" ? new Fi({localName: H(b), namespaceURI: null, prefix: "*"}) : new Fi({localName: "*", namespaceURI: null, prefix: H(b)})) : a = new Fi({ + localName: "*", + namespaceURI: null, + prefix: "*" + }), a; + case "atomicType": + return new Hi(rg(a)); + case "anyItemType": + return new Hi({prefix: "", namespaceURI: null, localName: "item()"}); + default: + throw Error("No selector counterpart for: " + a[0] + "."); + } + } + function bk(a, b) { + const c = I(a, "type"); + a = G(a, "*"); + const d = K(a, "arrayElem").map((e) => Q(G(e, "*"), P(b))); + switch (a[0]) { + case "curlyArray": + return new $g(d, c); + case "squareArray": + return new ah(d, c); + default: + throw Error("Unrecognized arrayType: " + a[0]); + } + } + function ak(a, b) { + const c = I(a, "type"); + return new Hh(K(a, "mapConstructorEntry").map((d) => ({key: Q(J(d, ["mapKeyExpr", "*"]), P(b)), value: Q(J(d, ["mapValueExpr", "*"]), P(b))})), c); + } + function Nj(a, b, c) { + function d(f) { + const h = G(G(f, "firstOperand"), "*"); + f = G(G(f, "secondOperand"), "*"); + h[0] === a ? d(h) : e.push(Q(h, c)); + f[0] === a ? d(f) : e.push(Q(f, c)); + } + const e = []; + d(b); + return e; + } + function ck(a, b) { + a = G(a, "*"); + switch (a[0]) { + case "NCName": + return new Gh(H(a), {type: 1, g: 3}); + case "star": + return "*"; + default: + return Q(a, P(b)); + } + } + function Rj(a, b, c) { + var d = J(b, ["firstOperand", "*"]); + const e = J(b, ["secondOperand", "*"]); + d = Q(d, P(c)); + c = Q(e, P(c)); + switch (a) { + case "valueCompare": + return new Yh(b[0], d, c); + case "nodeCompare": + return new di(b[0], d, c); + case "generalCompare": + return new ai(b[0], d, c); + } + } + function jk(a, b, c) { + a = K(a, "*"); + return new si(a.filter((d) => d[0] !== "stable").map((d) => { + var e = G(d, "orderModifier"), f = e ? G(e, "orderingKind") : null; + e = e ? G(e, "emptyOrderingMode") : null; + f = f ? H(f) === "ascending" : true; + e = e ? H(e) === "empty least" : true; + return {ba: Q(J(d, ["orderByExpr", "*"]), b), zb: f, $b: e}; + }), c); + } + function Xj(a, b) { + var c = K(a, "*"); + a = G(c[c.length - 1], "*"); + c = c.slice(0, -1); + if (1 < c.length && !b.Z) + throw Error("XPST0003: Use of XQuery FLWOR expressions in XPath is no allowed"); + return c.reduceRight((d, e) => { + switch (e[0]) { + case "forClause": + e = K(e, "*"); + for (var f = e.length - 1; 0 <= f; --f) { + var h = e[f], k = J(h, ["forExpr", "*"]); + const l = G(h, "positionalVariableBinding"); + d = new Dh(rg(J(h, ["typedVariableBinding", "varName"])), Q(k, P(b)), l ? rg(l) : null, d); + } + return d; + case "letClause": + e = K(e, "*"); + for (f = e.length - 1; 0 <= f; --f) + h = e[f], k = J(h, ["letExpr", "*"]), d = new Fh(rg(J(h, ["typedVariableBinding", "varName"])), Q(k, P(b)), d); + return d; + case "whereClause": + e = K(e, "*"); + for (f = e.length - 1; 0 <= f; --f) + d = new Ji(Q(e[f], b), d); + return d; + case "windowClause": + throw Error(`Not implemented: ${e[0]} is not implemented yet.`); + case "groupByClause": + throw Error(`Not implemented: ${e[0]} is not implemented yet.`); + case "orderByClause": + return jk(e, b, d); + case "countClause": + throw Error(`Not implemented: ${e[0]} is not implemented yet.`); + default: + throw Error(`Not implemented: ${e[0]} is not supported in a flwor expression`); + } + }, Q(a, b)); + } + function Tj(a, b) { + const c = G(a, "functionName"), d = K(G(a, "arguments"), "*"); + a = I(a, "type"); + return new hf(new Ih(rg(c), d.length, a), d.map((e) => e[0] === "argumentPlaceholder" ? null : Q(e, b)), a); + } + function Vj(a, b) { + const c = I(a, "type"); + var d = J(a, ["argExpr", "*"]); + a = K(a, "*").slice(1); + d = [Q(d, b)]; + for (let f = 0; f < a.length; f++) + if (a[f][0] !== "arguments") { + if (a[f + 1][0] === "arguments") { + var e = K(a[f + 1], "*"); + d = d.concat(e.map((h) => h[0] === "argumentPlaceholder" ? null : Q(h, b))); + } + e = a[f][0] === "EQName" ? new Ih(rg(a[f]), d.length, c) : Q(a[f], P(b)); + d = [new hf(e, d, c)]; + } + return d[0]; + } + function Wj(a, b) { + const c = J(a, ["functionItem", "*"]), d = I(a, "type"); + a = G(a, "arguments"); + let e = []; + a && (e = K(a, "*").map((f) => f[0] === "argumentPlaceholder" ? null : Q(f, b))); + return new hf(Q(c, b), e, d); + } + function Uj(a, b) { + const c = K(G(a, "paramList"), "*"), d = J(a, ["functionBody", "*"]), e = I(a, "type"); + return new Eh(c.map((f) => ({name: rg(G(f, "varName")), type: sg(f)})), sg(a), d ? Q(d, b) : new gi([], e)); + } + function Sj(a, b) { + const c = I(a, "type"); + var d = K(a, "stepExpr"); + let e = false; + var f = d.map((h) => { + var k = G(h, "xpathAxis"); + let l; + var n = K(h, "*"); + const t = []; + let u = null; + for (const y of n) + switch (y[0]) { + case "lookup": + t.push(["lookup", ck(y, b)]); + break; + case "predicate": + case "predicates": + for (const z of K(y, "*")) + n = Q(z, P(b)), u = fh(u, n.D()), t.push(["predicate", n]); + } + if (k) + switch (e = true, h = G(h, "attributeTest anyElementTest piTest documentTest elementTest commentTest namespaceTest anyKindTest textTest anyFunctionTest typedFunctionTest schemaAttributeTest atomicType anyItemType parenthesizedItemType typedMapTest typedArrayTest nameTest Wildcard".split(" ")), h = ik(h), H(k)) { + case "ancestor": + l = new dh(h, {Qa: false}); + break; + case "ancestor-or-self": + l = new dh(h, {Qa: true}); + break; + case "attribute": + l = new gh(h, u); + break; + case "child": + l = new hh(h, u); + break; + case "descendant": + l = new kh(h, {Qa: false}); + break; + case "descendant-or-self": + l = new kh(h, {Qa: true}); + break; + case "parent": + l = new rh(h, u); + break; + case "following-sibling": + l = new qh(h, u); + break; + case "preceding-sibling": + l = new vh(h, u); + break; + case "following": + l = new oh(h); + break; + case "preceding": + l = new th(h); + break; + case "self": + l = new wh(h, u); + } + else + k = J(h, ["filterExpr", "*"]), l = Q(k, P(b)); + for (const y of t) + switch (y[0]) { + case "lookup": + l = new Ai(l, y[1]); + break; + case "predicate": + l = new xi(l, y[1]); + } + l.type = c; + return l; + }); + a = G(a, "rootExpr"); + d = e || a !== null || 1 < d.length; + if (!d && f.length === 1 || !a && f.length === 1 && f[0].ia === "sorted") + return f[0]; + if (a && f.length === 0) + return new ti(null); + f = new wi(f, d); + return a ? new ti(f) : f; + } + function Yj(a, b) { + const c = I(a, "type"), d = H(G(a, "quantifier")), e = J(a, ["predicateExpr", "*"]); + a = K(a, "quantifiedExprInClause").map((f) => { + const h = rg(J(f, ["typedVariableBinding", "varName"])); + f = J(f, ["sourceExpr", "*"]); + return {name: h, eb: Q(f, P(b))}; + }); + return new Ci(d, a, Q(e, P(b)), c); + } + function Oj(a, b) { + var c = K(a, "*").map((d) => Q(d, b)); + if (c.length === 1) + return c[0]; + c = I(a, "type"); + return new gi(K(a, "*").map((d) => Q(d, b)), c); + } + function Zj(a, b) { + const c = I(a, "type"); + return K(a, "*").reduce((d, e) => d === null ? Q(e, P(b)) : new hi(d, Q(e, P(b)), c), null); + } + function Pj(a, b) { + const c = I(a, "type"); + a = [J(a, ["firstOperand", "*"]), J(a, ["secondOperand", "*"])]; + return new hf(new Ih({localName: "concat", namespaceURI: "http://www.w3.org/2005/xpath-functions", prefix: ""}, a.length, c), a.map((d) => Q(d, P(b))), c); + } + function Qj(a, b) { + const c = I(a, "type"); + a = [G(G(a, "startExpr"), "*"), G(G(a, "endExpr"), "*")]; + const d = new Ih({localName: "to", namespaceURI: "http://fontoxpath/operators", prefix: ""}, a.length, c); + return new hf(d, a.map((e) => Q(e, P(b))), c); + } + function ek(a, b) { + if (!b.Z) + throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context"); + const c = rg(G(a, "tagName")); + var d = G(a, "attributeList"); + const e = d ? K(d, "attributeConstructor").map((f) => Q(f, P(b))) : []; + d = d ? K(d, "namespaceDeclaration").map((f) => { + const h = G(f, "prefix"); + return {prefix: h ? H(h) : "", uri: H(G(f, "uri"))}; + }) : []; + a = (a = G(a, "elementContent")) ? K(a, "*").map((f) => Q(f, P(b))) : []; + return new Ej(c, e, d, a); + } + function fk(a, b) { + if (!b.Z) + throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context"); + const c = rg(G(a, "attributeName")); + var d = G(a, "attributeValue"); + d = d ? H(d) : null; + a = (a = G(a, "attributeValueExpr")) ? K(a, "*").map((e) => Q(e, P(b))) : null; + return new Cj(c, {value: d, mb: a}); + } + function gk(a, b) { + var c = G(a, "tagName"); + c ? c = rg(c) : (c = G(a, "tagNameExpr"), c = {Na: Q(G(c, "*"), P(b))}); + a = (a = G(a, "contentExpr")) ? K(a, "*").map((d) => Q(d, P(b))) : []; + return new Ej(c, [], [], a); + } + function hk(a, b) { + const c = K(G(a, "transformCopies"), "transformCopy").map((e) => { + const f = rg(G(G(e, "varRef"), "name")); + return {eb: Q(G(G(e, "copySource"), "*"), b), Gb: new Ta(f.prefix, f.namespaceURI, f.localName)}; + }), d = Q(G(G(a, "modifyExpr"), "*"), b); + a = Q(G(G(a, "returnExpr"), "*"), b); + return new Aj(c, d, a); + } + function dk(a, b) { + if (!b.Z) + throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context"); + const c = I(a, "type"), d = Q(G(G(a, "argExpr"), "*"), b), e = K(a, "typeswitchExprCaseClause").map((f) => { + const h = K(f, "sequenceTypeUnion").length === 0 ? [G(f, "sequenceType")] : K(G(f, "sequenceTypeUnion"), "sequenceType"); + return {Xb: Q(J(f, ["resultExpr", "*"]), b), Fb: h.map((k) => { + const l = G(k, "occurrenceIndicator"); + return {bc: l ? H(l) : "", Eb: Q(G(k, "*"), b)}; + })}; + }); + a = Q(J(a, ["typeswitchExprDefaultClause", "resultExpr", "*"]), b); + return new Jj(d, e, a, c); + } + function kk(a, b) { + return Q(a, b); + } + const lk = new Map(); + class mk { + constructor(a, b, c, d, e, f) { + this.v = a; + this.D = b; + this.h = c; + this.jb = d; + this.o = e; + this.l = f; + } + } + function nk(a, b, c, d, e, f, h, k) { + a = lk.get(a); + if (!a) + return null; + b = a[b + (f ? "_DEBUG" : "")]; + return b ? (b = b.find((l) => l.o === h && l.v.every((n) => c(n.prefix) === n.namespaceURI) && l.D.every((n) => d[n.name] !== void 0) && l.jb.every((n) => e[n.prefix] === n.namespaceURI) && l.l.every((n) => { + const t = k(n.ac, n.arity); + return t && t.namespaceURI === n.Bb.namespaceURI && t.localName === n.Bb.localName; + }))) ? {ba: b.h, ec: false} : null : null; + } + function ok(a, b, c, d, e, f, h) { + let k = lk.get(a); + k || (k = Object.create(null), lk.set(a, k)); + a = b + (f ? "_DEBUG" : ""); + (b = k[a]) || (b = k[a] = []); + b.push(new mk(Object.values(c.h), Object.values(c.o), e, Object.keys(d).map((l) => ({namespaceURI: d[l], prefix: l})), h, c.D)); + } + function pk(a) { + var b = new Za(); + if (a.namespaceURI !== "http://www.w3.org/2005/XQueryX" && a.namespaceURI !== "http://www.w3.org/2005/XQueryX" && a.namespaceURI !== "http://fontoxml.com/fontoxpath" && a.namespaceURI !== "http://www.w3.org/2007/xquery-update-10") + throw mc("The XML structure passed as an XQueryX program was not valid XQueryX"); + const c = [a.localName === "stackTrace" ? "x:stackTrace" : a.localName], d = b.getAllAttributes(a); + d && 0 < d.length && c.push(Array.from(d).reduce((e, f) => { + f.localName === "start" || f.localName === "end" && a.localName === "stackTrace" ? e[f.localName] = JSON.parse(f.value) : f.localName === "type" ? e[f.localName] = Ja(f.value) : e[f.localName] = f.value; + return e; + }, {})); + b = b.getChildNodes(a); + for (const e of b) + switch (e.nodeType) { + case 1: + c.push(pk(e)); + break; + case 3: + c.push(e.data); + } + return c; + } + const qk = Object.create(null); + var rk = (a, b) => { + let c = qk[a]; + c || (c = qk[a] = {Ha: [], Ta: [], oa: null, source: b.source}); + const d = c.oa || (() => { + }); + c.Ha = c.Ha.concat(b.Ha); + c.Ta = c.Ta.concat(b.Ta); + c.oa = (e) => { + d(e); + b.oa && b.oa(e); + }; + }, sk = (a, b) => { + const c = qk[b]; + if (!c) + throw Error(`XQST0051: No modules found with the namespace uri ${b}`); + c.Ha.forEach((d) => { + d.bb && mg(a, b, d.localName, d.arity, d); + }); + c.Ta.forEach((d) => { + og(a, b, d.localName); + pg(a, b, d.localName, (e, f) => B(d.ba, e, f)); + }); + }, tk = () => { + Object.keys(qk).forEach((a) => { + a = qk[a]; + if (a.oa) + try { + a.oa(a); + } catch (b) { + a.oa = null, Pf(a.source, b); + } + a.oa = null; + }); + }; + function uk(a) { + return a.replace(/(\x0D\x0A)|(\x0D(?!\x0A))/g, String.fromCharCode(10)); + } + var R = prsc2; + function vk(a, b) { + return (c, d) => { + if (b.has(d)) + return b.get(d); + c = a(c, d); + b.set(d, c); + return c; + }; + } + function S(a, b) { + return (0, R.delimited)(b, a, b); + } + function T(a, b) { + return a.reverse().reduce((c, d) => (0, R.preceded)(d, c), b); + } + function wk(a, b, c, d) { + return (0, R.then)((0, R.then)(a, b, (e, f) => [e, f]), c, ([e, f], h) => d(e, f, h)); + } + function xk(a, b, c, d, e) { + return (0, R.then)((0, R.then)((0, R.then)(a, b, (f, h) => [f, h]), c, ([f, h], k) => [f, h, k]), d, ([f, h, k], l) => e(f, h, k, l)); + } + function yk(a, b, c, d, e, f) { + return (0, R.then)((0, R.then)((0, R.then)((0, R.then)(a, b, (h, k) => [h, k]), c, ([h, k], l) => [h, k, l]), d, ([h, k, l], n) => [h, k, l, n]), e, ([h, k, l, n], t) => f(h, k, l, n, t)); + } + function zk(a) { + return (0, R.map)(a, (b) => [b]); + } + function Ak(a, b) { + return (0, R.map)((0, R.or)(a), () => b); + } + function Bk(a) { + return (b, c) => (b = a.exec(b.substring(c))) && b.index === 0 ? (0, R.okWithValue)(c + b[0].length, b[0]) : (0, R.error)(c, [a.source], false); + } + var Ck = (0, R.or)([(0, R.token)(" "), (0, R.token)(" "), (0, R.token)("\r"), (0, R.token)("\n")]), Dk = (0, R.token)("(:"), Ek = (0, R.token)(":)"), Fk = (0, R.token)("(#"), Gk = (0, R.token)("#)"), Hk = (0, R.token)("("), Ik = (0, R.token)(")"), Jk = (0, R.token)("["), Kk = (0, R.token)("]"), Lk = (0, R.token)("{"), Mk = (0, R.token)("}"), Nk = (0, R.token)("{{"), Ok = (0, R.token)("}}"), Pk = (0, R.token)("'"), Qk = (0, R.token)("''"), Rk = (0, R.token)('"'), Sk = (0, R.token)('""'), Tk = (0, R.token)(""), Vk = (0, R.token)("/>"), Wk = (0, R.token)(""), Zk = (0, R.token)(""), al = (0, R.token)("&#x"), bl = (0, R.token)("&#"), cl = (0, R.token)(":*"), dl = (0, R.token)("*:"), el = (0, R.token)(":="), fl = (0, R.token)("&"), gl = (0, R.token)(":"), hl = (0, R.token)(";"), il = (0, R.token)("*"), jl = (0, R.token)("@"), kl = (0, R.token)("$"), ll = (0, R.token)("#"), ml = (0, R.token)("%"), nl = (0, R.token)("?"), ol = (0, R.token)("="), pl = (0, R.followed)((0, R.token)("!"), (0, R.not)((0, R.peek)(ol), [])), ql = (0, R.followed)((0, R.token)("|"), (0, R.not)((0, R.peek)((0, R.token)("|")), [])), rl = (0, R.token)("||"), sl = (0, R.token)("!="), tl = (0, R.token)("<"), ul = (0, R.token)("<<"), vl = (0, R.token)("<="), wl = (0, R.token)(">"), xl = (0, R.token)(">>"), yl = (0, R.token)(">="), zl = (0, R.token)(","), Al = (0, R.token)("."), Bl = (0, R.token)(".."), Cl = (0, R.token)("+"), Dl = (0, R.token)("-"), El = (0, R.token)("/"), Fl = (0, R.token)("//"), Gl = (0, R.token)("=>"), Hl = (0, R.token)("e"), Il = (0, R.token)("E"); + (0, R.token)("l"); + (0, R.token)("L"); + (0, R.token)("m"); + (0, R.token)("M"); + var Jl = (0, R.token)("Q"); + (0, R.token)("x"); + (0, R.token)("X"); + var Kl = (0, R.token)("as"), Ll = (0, R.token)("cast"), Ml = (0, R.token)("castable"), Nl = (0, R.token)("treat"), Ol = (0, R.token)("instance"), Pl = (0, R.token)("of"), Ql = (0, R.token)("node"), Rl = (0, R.token)("nodes"), Sl = (0, R.token)("delete"), Tl = (0, R.token)("value"), Ul = (0, R.token)("function"), Vl = (0, R.token)("map"), Wl = (0, R.token)("element"), Xl = (0, R.token)("attribute"), Yl = (0, R.token)("schema-element"), Zl = (0, R.token)("intersect"), $l = (0, R.token)("except"), am = (0, R.token)("union"), bm = (0, R.token)("to"), cm = (0, R.token)("is"), dm = (0, R.token)("or"), em = (0, R.token)("and"), fm = (0, R.token)("div"), gm = (0, R.token)("idiv"), hm = (0, R.token)("mod"), im = (0, R.token)("eq"), jm = (0, R.token)("ne"), km = (0, R.token)("lt"), lm = (0, R.token)("le"), mm = (0, R.token)("gt"), nm = (0, R.token)("ge"), om = (0, R.token)("amp"), pm = (0, R.token)("quot"), qm = (0, R.token)("apos"), rm = (0, R.token)("if"), sm = (0, R.token)("then"), tm = (0, R.token)("else"), um = (0, R.token)("allowing"), vm = (0, R.token)("empty"), wm = (0, R.token)("at"), xm = (0, R.token)("in"), ym = (0, R.token)("for"), zm = (0, R.token)("let"), Am = (0, R.token)("where"), Bm = (0, R.token)("collation"), Cm = (0, R.token)("group"), Dm = (0, R.token)("by"), Em = (0, R.token)("order"), Fm = (0, R.token)("stable"), Gm = (0, R.token)("return"), Hm = (0, R.token)("array"), Im = (0, R.token)("document"), Jm = (0, R.token)("namespace"), Km = (0, R.token)("text"), Lm = (0, R.token)("comment"), Mm = (0, R.token)("processing-instruction"), Nm = (0, R.token)("lax"), Om = (0, R.token)("strict"), Pm = (0, R.token)("validate"), Qm = (0, R.token)("type"), Rm = (0, R.token)("declare"), Sm = (0, R.token)("default"), Tm = (0, R.token)("boundary-space"), Um = (0, R.token)("strip"), Vm = (0, R.token)("preserve"), Wm = (0, R.token)("no-preserve"), Xm = (0, R.token)("inherit"), Ym = (0, R.token)("no-inherit"), Zm = (0, R.token)("greatest"), $m = (0, R.token)("least"), an = (0, R.token)("copy-namespaces"), bn = (0, R.token)("decimal-format"), cn = (0, R.token)("case"), dn = (0, R.token)("typeswitch"), en = (0, R.token)("some"), fn = (0, R.token)("every"), gn = (0, R.token)("satisfies"), hn = (0, R.token)("replace"), jn = (0, R.token)("with"), kn = (0, R.token)("copy"), ln = (0, R.token)("modify"), mn = (0, R.token)("first"), nn = (0, R.token)("last"), on = (0, R.token)("before"), pn = (0, R.token)("after"), qn = (0, R.token)("into"), rn = (0, R.token)("insert"), sn = (0, R.token)("rename"), tn = (0, R.token)("switch"), un = (0, R.token)("variable"), vn = (0, R.token)("external"), wn = (0, R.token)("updating"), xn = (0, R.token)("import"), yn = (0, R.token)("schema"), zn = (0, R.token)("module"), An = (0, R.token)("base-uri"), Bn = (0, R.token)("construction"), Cn = (0, R.token)("ordering"), Dn = (0, R.token)("ordered"), En = (0, R.token)("unordered"), Fn = (0, R.token)("option"), Gn = (0, R.token)("context"), Hn = (0, R.token)("item"), In = (0, R.token)("xquery"), Jn = (0, R.token)("version"), Kn = (0, R.token)("encoding"), Ln = (0, R.token)("document-node"), Mn = (0, R.token)("namespace-node"), Nn = (0, R.token)("schema-attribute"), On = (0, R.token)("ascending"), Pn = (0, R.token)("descending"), Qn = (0, R.token)("empty-sequence"), Rn = (0, R.token)("child::"), Sn = (0, R.token)("descendant::"), Tn = (0, R.token)("attribute::"), Un = (0, R.token)("self::"), Vn = (0, R.token)("descendant-or-self::"), Wn = (0, R.token)("following-sibling::"), Xn = (0, R.token)("following::"), Yn = (0, R.token)("parent::"), Zn = (0, R.token)("ancestor::"), $n = (0, R.token)("preceding-sibling::"), ao = (0, R.token)("preceding::"), bo = (0, R.token)("ancestor-or-self::"), co = (0, R.token)("decimal-separator"), eo = (0, R.token)("grouping-separator"), fo = (0, R.token)("infinity"), go = (0, R.token)("minus-sign"), ho = (0, R.token)("NaN"), io = (0, R.token)("per-mille"), jo = (0, R.token)("zero-digit"), ko = (0, R.token)("digit"), lo = (0, R.token)("pattern-separator"), mo = (0, R.token)("exponent-separator"), no = (0, R.token)("schema-attribute("), oo = (0, R.token)("document-node("), po = (0, R.token)("processing-instruction("), qo = (0, R.token)("processing-instruction()"), ro = (0, R.token)("comment()"), so = (0, R.token)("text()"), to = (0, R.token)("namespace-node()"), uo = (0, R.token)("node()"), vo = (0, R.token)("item()"), wo = (0, R.token)("empty-sequence()"); + var xo = new Map(), yo = new Map(), zo = (0, R.or)([Bk(/[\t\n\r -\uD7FF\uE000\uFFFD]/), Bk(/[\uD800-\uDBFF][\uDC00-\uDFFF]/)]), Ao = (0, R.preceded)((0, R.peek)((0, R.not)((0, R.or)([Dk, Ek]), ['comment contents cannot contain "(:" or ":)"'])), zo), Bo = (0, R.map)((0, R.delimited)(Dk, (0, R.star)((0, R.or)([Ao, function(a, b) { + return Bo(a, b); + }])), Ek, true), (a) => a.join("")), Co = (0, R.or)([Ck, Bo]), Do = (0, R.map)((0, R.plus)(Ck), (a) => a.join("")), V = vk((0, R.map)((0, R.star)(Co), (a) => a.join("")), xo), W = vk((0, R.map)((0, R.plus)(Co), (a) => a.join("")), yo); + const Eo = (0, R.or)([Bk(/[A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/), (0, R.then)(Bk(/[\uD800-\uDB7F]/), Bk(/[\uDC00-\uDFFF]/), (a, b) => a + b)]), Fo = (0, R.or)([Eo, Bk(/[\-\.0-9\xB7\u0300-\u036F\u203F\u2040]/)]); + var Go = (0, R.then)(Eo, (0, R.star)(Fo), (a, b) => a + b.join("")), Ho = (0, R.map)(Go, (a) => ["prefix", a]); + const Io = (0, R.or)([Eo, gl]), Jo = (0, R.or)([Fo, gl]); + (0, R.then)(Io, (0, R.star)(Jo), (a, b) => a + b.join("")); + const Ko = (0, R.map)(Go, (a) => [{prefix: "", URI: null}, a]), Lo = (0, R.then)(Go, (0, R.preceded)(gl, Go), (a, b) => [{prefix: a, URI: null}, b]); + var Mo = (0, R.or)([Lo, Ko]), No = (0, R.followed)(T([Jl, V, Lk], (0, R.map)((0, R.star)(Bk(/[^{}]/)), (a) => a.join("").replace(/\s+/g, " ").trim())), Mk); + const Oo = (0, R.then)(No, Go, (a, b) => [a, b]); + var Po = (0, R.or)([(0, R.map)(Oo, (a) => [{prefix: null, URI: a[0]}, a[1]]), Mo]), Qo = (0, R.or)([(0, R.map)(Po, (a) => ["QName", ...a]), (0, R.map)(il, () => ["star"])]), Ro = (0, R.map)((0, R.preceded)(kl, Po), (a) => ["varRef", ["name", ...a]]); + var So = (0, R.peek)((0, R.or)([Hk, Rk, Pk, Co])), To = (0, R.map)((0, R.or)([Rn, Sn, Tn, Un, Vn, Wn, Xn]), (a) => a.substring(0, a.length - 2)), Uo = (0, R.map)((0, R.or)([Yn, Zn, $n, ao, bo]), (a) => a.substring(0, a.length - 2)), Vo = wk(fl, (0, R.or)([km, mm, om, pm, qm]), hl, (a, b, c) => a + b + c), Wo = (0, R.or)([wk(al, Bk(/[0-9a-fA-F]+/), hl, (a, b, c) => a + b + c), wk(bl, Bk(/[0-9]+/), hl, (a, b, c) => a + b + c)]), Xo = Ak([Sk], '"'), Yo = Ak([Qk], "'"), Zo = zk(Ak([ro], "commentTest")), $o = zk(Ak([so], "textTest")), ap = zk(Ak([to], "namespaceTest")), bp = zk(Ak([uo], "anyKindTest")); + const cp = Bk(/[0-9]+/), dp = (0, R.then)((0, R.or)([(0, R.then)(Al, cp, (a, b) => a + b), (0, R.then)(cp, (0, R.optional)((0, R.preceded)(Al, Bk(/[0-9]*/))), (a, b) => a + (b !== null ? "." + b : ""))]), wk((0, R.or)([Hl, Il]), (0, R.optional)((0, R.or)([Cl, Dl])), cp, (a, b, c) => a + (b ? b : "") + c), (a, b) => ["doubleConstantExpr", ["value", a + b]]), ep = (0, R.or)([(0, R.map)((0, R.preceded)(Al, cp), (a) => ["decimalConstantExpr", ["value", "." + a]]), (0, R.then)((0, R.followed)(cp, Al), (0, R.optional)(cp), (a, b) => ["decimalConstantExpr", ["value", a + "." + (b !== null ? b : "")]])]); + var fp = (0, R.map)(cp, (a) => ["integerConstantExpr", ["value", a]]), gp = (0, R.followed)((0, R.or)([dp, ep, fp]), (0, R.peek)((0, R.not)(Bk(/[a-zA-Z]/), ["no alphabetical characters after numeric literal"]))), hp = (0, R.map)((0, R.followed)(Al, (0, R.peek)((0, R.not)(Al, ["context item should not be followed by another ."]))), () => ["contextItemExpr"]), ip = (0, R.or)([Hm, Xl, Lm, Ln, Wl, Qn, Ul, rm, Hn, Vl, Mn, Ql, Mm, Nn, Yl, tn, Km, dn]), jp = zk(Ak([nl], "argumentPlaceholder")), kp = (0, R.or)([nl, il, Cl]), lp = (0, R.preceded)((0, R.peek)((0, R.not)(Bk(/[{}<&]/), ["elementContentChar cannot be {, }, <, or &"])), zo), mp = (0, R.map)((0, R.delimited)(Tk, (0, R.star)((0, R.preceded)((0, R.peek)((0, R.not)(Uk, ['CDataSection content may not contain "]]>"'])), zo)), Uk, true), (a) => ["CDataSection", a.join("")]), np = (0, R.preceded)((0, R.peek)((0, R.not)(Bk(/["{}<&]/), ['quotAttrValueContentChar cannot be ", {, }, <, or &'])), zo), op = (0, R.preceded)((0, R.peek)((0, R.not)(Bk(/['{}<&]/), ["aposAttrValueContentChar cannot be ', {, }, <, or &"])), zo), pp = (0, R.map)((0, R.star)((0, R.or)([(0, R.preceded)((0, R.peek)((0, R.not)(Dl, [])), zo), (0, R.map)(T([Dl, (0, R.peek)((0, R.not)(Dl, []))], zo), (a) => "-" + a)])), (a) => a.join("")), qp = (0, R.map)((0, R.delimited)(Xk, pp, Yk, true), (a) => ["computedCommentConstructor", ["argExpr", ["stringConstantExpr", ["value", a]]]]); + const rp = (0, R.filter)(Go, (a) => a.toLowerCase() !== "xml", ['A processing instruction target cannot be "xml"']), sp = (0, R.map)((0, R.star)((0, R.preceded)((0, R.peek)((0, R.not)($k, [])), zo)), (a) => a.join("")); + var tp = (0, R.then)((0, R.preceded)(Zk, (0, R.cut)(rp)), (0, R.cut)((0, R.followed)((0, R.optional)((0, R.preceded)(Do, sp)), $k)), (a, b) => ["computedPIConstructor", ["piTarget", a], ["piValueExpr", ["stringConstantExpr", ["value", b]]]]), up = (0, R.map)(Fl, () => ["stepExpr", ["xpathAxis", "descendant-or-self"], ["anyKindTest"]]), vp = (0, R.or)([Nm, Om]), wp = (0, R.map)((0, R.star)((0, R.followed)(zo, (0, R.peek)((0, R.not)(Gk, ["Pragma contents should not contain '#)'"])))), (a) => a.join("")), xp = (0, R.map)((0, R.followed)((0, R.or)([ + im, + jm, + km, + lm, + mm, + nm + ]), So), (a) => a + "Op"), yp = (0, R.or)([(0, R.followed)(Ak([cm], "isOp"), So), Ak([ul], "nodeBeforeOp"), Ak([xl], "nodeAfterOp")]), zp = (0, R.or)([Ak([ol], "equalOp"), Ak([sl], "notEqualOp"), Ak([vl], "lessThanOrEqualOp"), Ak([tl], "lessThanOp"), Ak([yl], "greaterThanOrEqualOp"), Ak([wl], "greaterThanOp")]), Ap = (0, R.map)(wn, () => ["annotation", ["annotationName", "updating"]]); + const Bp = (0, R.or)([Vm, Wm]), Cp = (0, R.or)([Xm, Ym]); + var Dp = (0, R.or)([co, eo, fo, go, ho, ml, io, jo, ko, lo, mo]), Ep = (0, R.map)(T([Rm, W, Tm, W], (0, R.or)([Vm, Um])), (a) => ["boundarySpaceDecl", a]), Fp = (0, R.map)(T([Rm, W, Bn, W], (0, R.or)([Vm, Um])), (a) => ["constructionDecl", a]), Gp = (0, R.map)(T([Rm, W, Cn, W], (0, R.or)([Dn, En])), (a) => ["orderingModeDecl", a]), Hp = (0, R.map)(T([Rm, W, Sm, W, Em, W, vm, W], (0, R.or)([Zm, $m])), (a) => ["emptyOrderDecl", a]), Ip = (0, R.then)(T([Rm, W, an, W], Bp), T([V, zl, V], Cp), (a, b) => ["copyNamespacesDecl", ["preserveMode", a], ["inheritMode", b]]); + function Jp(a) { + switch (a[0]) { + case "constantExpr": + case "varRef": + case "contextItemExpr": + case "functionCallExpr": + case "sequenceExpr": + case "elementConstructor": + case "computedElementConstructor": + case "computedAttributeConstructor": + case "computedDocumentConstructor": + case "computedTextConstructor": + case "computedCommentConstructor": + case "computedNamespaceConstructor": + case "computedPIConstructor": + case "orderedExpr": + case "unorderedExpr": + case "namedFunctionRef": + case "inlineFunctionExpr": + case "dynamicFunctionInvocationExpr": + case "mapConstructor": + case "arrayConstructor": + case "stringConstructor": + case "unaryLookup": + return a; + } + return [ + "sequenceExpr", + a + ]; + } + function Kp(a) { + if (!(1 <= a && 55295 >= a || 57344 <= a && 65533 >= a || 65536 <= a && 1114111 >= a)) + throw Error("XQST0090: The character reference " + a + " (" + a.toString(16) + ") does not reference a valid codePoint."); + } + function Lp(a) { + return a.replace(/(&[^;]+);/g, (b) => { + if (/^&#x/.test(b)) + return b = parseInt(b.slice(3, -1), 16), Kp(b), String.fromCodePoint(b); + if (/^&#/.test(b)) + return b = parseInt(b.slice(2, -1), 10), Kp(b), String.fromCodePoint(b); + switch (b) { + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + case """: + return String.fromCharCode(34); + case "'": + return String.fromCharCode(39); + } + throw Error('XPST0003: Unknown character reference: "' + b + '"'); + }); + } + function Mp(a, b, c) { + if (!a.length) + return []; + let d = [a[0]]; + for (let e = 1; e < a.length; ++e) { + const f = d[d.length - 1]; + typeof f === "string" && typeof a[e] === "string" ? d[d.length - 1] = f + a[e] : d.push(a[e]); + } + if (typeof d[0] === "string" && d.length === 0) + return []; + d = d.reduce((e, f, h) => { + if (typeof f !== "string") + e.push(f); + else if (c && /^\s*$/.test(f)) { + const k = d[h + 1]; + k && k[0] === "CDataSection" ? e.push(Lp(f)) : (h = d[h - 1]) && h[0] === "CDataSection" && e.push(Lp(f)); + } else + e.push(Lp(f)); + return e; + }, []); + if (!d.length) + return d; + if (1 < d.length || b) + for (a = 0; a < d.length; a++) + typeof d[a] === "string" && (d[a] = ["stringConstantExpr", ["value", d[a]]]); + return d; + } + function Np(a) { + return a[0].prefix ? a[0].prefix + ":" + a[1] : a[1]; + } + var Op = (0, R.then)(Po, (0, R.optional)(nl), (a, b) => b !== null ? ["singleType", ["atomicType", ...a], ["optional"]] : ["singleType", ["atomicType", ...a]]), Pp = (0, R.map)(Po, (a) => ["atomicType", ...a]); + const Qp = new Map(); + function Rp(a) { + function b(m, r) { + return r.reduce((C, Z) => [Z[0], ["firstOperand", C], ["secondOperand", Z[1]]], m); + } + function c(m, r, C) { + return (0, R.then)(m, (0, R.star)((0, R.then)(S(r, V), (0, R.cut)(m), (Z, da) => [Z, da])), C); + } + function d(m, r, C = "firstOperand", Z = "secondOperand") { + return (0, R.then)(m, (0, R.optional)((0, R.then)(S(r, V), (0, R.cut)(m), (da, xa) => [da, xa])), (da, xa) => xa === null ? da : [xa[0], [C, da], [Z, xa[1]]]); + } + function e(m) { + return a.lb ? (r, C) => { + r = m(r, C); + if (!r.success) + return r; + const Z = n.has(C) ? n.get(C) : {offset: C, line: -1, ha: -1}, da = n.has(r.offset) ? n.get(r.offset) : {offset: r.offset, line: -1, ha: -1}; + n.set(C, Z); + n.set(r.offset, da); + return (0, R.okWithValue)(r.offset, ["x:stackTrace", {start: Z, end: da}, r.value]); + } : m; + } + function f(m, r) { + return mj(m, r); + } + function h(m, r) { + return qf(m, r); + } + function k(m, r) { + return e((0, R.or)([er, fr, gr, hr, ir, jr, kr, lr, mr, nr, or]))(m, r); + } + function l(m, r) { + return c(k, zl, (C, Z) => Z.length === 0 ? C : ["sequenceExpr", C, ...Z.map((da) => da[1])])(m, r); + } + const n = new Map(), t = (0, R.preceded)(Jk, (0, R.followed)(S(l, V), Kk)), u = (0, R.map)(a.Ya ? (0, R.or)([S((0, R.star)((0, R.or)([ + Vo, + Wo, + Xo, + Bk(/[^"&]/) + ])), Rk), S((0, R.star)((0, R.or)([Vo, Wo, Yo, Bk(/[^'&]/)])), Pk)]) : (0, R.or)([S((0, R.star)((0, R.or)([Xo, Bk(/[^"]/)])), Rk), S((0, R.star)((0, R.or)([Yo, Bk(/[^']/)])), Pk)]), (m) => m.join("")), y = (0, R.or)([(0, R.map)(T([Wl, V], (0, R.delimited)((0, R.followed)(Hk, V), (0, R.then)(Qo, T([V, zl, V], Po), (m, r) => [["elementName", m], ["typeName", ...r]]), (0, R.preceded)(V, Ik))), ([m, r]) => ["elementTest", m, r]), (0, R.map)(T([Wl, V], (0, R.delimited)(Hk, Qo, Ik)), (m) => ["elementTest", ["elementName", m]]), (0, R.map)(T([Wl, V], (0, R.delimited)(Hk, V, Ik)), () => ["elementTest"])]), z = (0, R.or)([(0, R.map)(Po, (m) => ["QName", ...m]), (0, R.map)(il, () => ["star"])]), F = (0, R.or)([(0, R.map)(T([Xl, V], (0, R.delimited)((0, R.followed)(Hk, V), (0, R.then)(z, T([V, zl, V], Po), (m, r) => [["attributeName", m], ["typeName", ...r]]), (0, R.preceded)(V, Ik))), ([m, r]) => ["attributeTest", m, r]), (0, R.map)(T([Xl, V], (0, R.delimited)(Hk, z, Ik)), (m) => ["attributeTest", ["attributeName", m]]), (0, R.map)(T([Xl, V], (0, R.delimited)(Hk, V, Ik)), () => ["attributeTest"])]), O = (0, R.map)(T([Yl, V, Hk], (0, R.followed)(Po, Ik)), (m) => ["schemaElementTest", ...m]), U = (0, R.map)((0, R.delimited)(no, S(Po, V), Ik), (m) => ["schemaAttributeTest", ...m]), ba = (0, R.map)((0, R.preceded)(oo, (0, R.followed)(S((0, R.optional)((0, R.or)([y, O])), V), Ik)), (m) => ["documentTest", ...m ? [m] : []]), Ga = (0, R.or)([(0, R.map)((0, R.preceded)(po, (0, R.followed)(S((0, R.or)([Go, u]), V), Ik)), (m) => ["piTest", ["piTarget", m]]), zk(Ak([qo], "piTest"))]), Eb = (0, R.or)([ba, y, F, O, U, Ga, Zo, $o, ap, bp]), Vb = (0, R.or)([(0, R.map)((0, R.preceded)(dl, Go), (m) => ["Wildcard", ["star"], ["NCName", m]]), zk(Ak([il], "Wildcard")), (0, R.map)((0, R.followed)(No, il), (m) => ["Wildcard", ["uri", m], ["star"]]), (0, R.map)((0, R.followed)(Go, cl), (m) => ["Wildcard", ["NCName", m], ["star"]])]), bd = (0, R.or)([Vb, (0, R.map)(Po, (m) => ["nameTest", ...m])]), Wb = (0, R.or)([Eb, bd]), pr = (0, R.then)((0, R.optional)(jl), Wb, (m, r) => m !== null || r[0] === "attributeTest" || r[0] === "schemaAttributeTest" ? ["stepExpr", ["xpathAxis", "attribute"], r] : ["stepExpr", ["xpathAxis", "child"], r]), qr = (0, R.or)([(0, R.then)(To, Wb, (m, r) => ["stepExpr", ["xpathAxis", m], r]), pr]), rr = (0, R.map)(Bl, () => ["stepExpr", ["xpathAxis", "parent"], ["anyKindTest"]]), sr = (0, R.or)([(0, R.then)(Uo, Wb, (m, r) => ["stepExpr", ["xpathAxis", m], r]), rr]), tr = (0, R.map)((0, R.star)((0, R.preceded)(V, t)), (m) => 0 < m.length ? ["predicates", ...m] : void 0), ur = (0, R.then)((0, R.or)([sr, qr]), tr, (m, r) => r === void 0 ? m : m.concat([r])), rf = (0, R.or)([gp, (0, R.map)(u, (m) => ["stringConstantExpr", ["value", a.Ya ? Lp(m) : m]])]), sf = (0, R.or)([(0, R.delimited)(Hk, S(l, V), Ik), (0, R.map)((0, R.delimited)(Hk, V, Ik), () => ["sequenceExpr"])]), nj = (0, R.or)([k, jp]), be = (0, R.map)((0, R.delimited)(Hk, S((0, R.optional)((0, R.then)(nj, (0, R.star)((0, R.preceded)(S(zl, V), nj)), (m, r) => [m, ...r])), V), Ik), (m) => m !== null ? m : []), vr = (0, R.preceded)((0, R.not)(wk(ip, V, Hk, () => { + }), ["cannot use reseved keyword for function names"]), (0, R.then)(Po, (0, R.preceded)(V, be), (m, r) => ["functionCallExpr", ["functionName", ...m], r !== null ? ["arguments", ...r] : ["arguments"]])), wr = (0, R.then)(Po, (0, R.preceded)(ll, fp), (m, r) => ["namedFunctionRef", ["functionName", ...m], r]), Sa = (0, R.delimited)(Lk, S((0, R.optional)(l), V), Mk), oj = (0, R.map)(Sa, (m) => m ? m : ["sequenceExpr"]), db = (0, R.or)([(0, R.map)(wo, () => [["voidSequenceType"]]), (0, R.then)(f, (0, R.optional)((0, R.preceded)(V, kp)), (m, r) => [m, ...r !== null ? [["occurrenceIndicator", r]] : []])]), tf = (0, R.then)(T([ml, V], Po), (0, R.optional)((0, R.followed)((0, R.then)(T([Hk, V], rf), (0, R.star)(T([zl, V], rf)), (m, r) => m.concat(r)), Ik)), (m, r) => ["annotation", ["annotationName", ...m], ...r ? ["arguments", r] : []]), xr = (0, R.map)(T([Ul, V, Hk, V, il, V], Ik), () => ["anyFunctionTest"]), yr = (0, R.then)(T([Ul, V, Hk, V], (0, R.optional)(c(db, zl, (m, r) => m.concat.apply(m, r.map((C) => C[1]))))), T([V, Ik, W, Kl, W], db), (m, r) => ["typedFunctionTest", ["paramTypeList", ["sequenceType", ...m ? m : []]], ["sequenceType", ...r]]), zr = (0, R.then)((0, R.star)(tf), (0, R.or)([xr, yr]), (m, r) => [r[0], ...m, ...r.slice(1)]), Ar = (0, R.map)(T([Vl, V, Hk, V, il, V], Ik), () => ["anyMapTest"]), Br = (0, R.then)(T([Vl, V, Hk, V], Pp), T([V, zl], (0, R.followed)(S(db, V), Ik)), (m, r) => ["typedMapTest", m, ["sequenceType", ...r]]), Cr = (0, R.or)([Ar, Br]), Dr = (0, R.map)(T([Hm, V, Hk, V, il, V], Ik), () => ["anyArrayTest"]), Er = (0, R.map)(T([ + Hm, + V, + Hk + ], (0, R.followed)(S(db, V), Ik)), (m) => ["typedArrayTest", ["sequenceType", ...m]]), Fr = (0, R.or)([Dr, Er]), Gr = (0, R.map)((0, R.delimited)(Hk, S(f, V), Ik), (m) => ["parenthesizedItemType", m]), mj = (0, R.or)([Eb, zk(Ak([vo], "anyItemType")), zr, Cr, Fr, Pp, Gr]), uc = (0, R.map)(T([Kl, W], db), (m) => ["typeDeclaration", ...m]), Hr = (0, R.then)((0, R.preceded)(kl, Po), (0, R.optional)((0, R.preceded)(W, uc)), (m, r) => ["param", ["varName", ...m], ...r ? [r] : []]), pj = c(Hr, zl, (m, r) => [m, ...r.map((C) => C[1])]), Ir = xk((0, R.star)(tf), T([V, Ul, V, Hk, V], (0, R.optional)(pj)), T([V, Ik, V], (0, R.optional)((0, R.map)(T([Kl, V], (0, R.followed)(db, V)), (m) => ["typeDeclaration", ...m]))), oj, (m, r, C, Z) => ["inlineFunctionExpr", ...m, ["paramList", ...r ? r : []], ...C ? [C] : [], ["functionBody", Z]]), Jr = (0, R.or)([wr, Ir]), Kr = (0, R.map)(k, (m) => ["mapKeyExpr", m]), Lr = (0, R.map)(k, (m) => ["mapValueExpr", m]), Mr = (0, R.then)(Kr, (0, R.preceded)(S(gl, V), Lr), (m, r) => ["mapConstructorEntry", m, r]), Nr = (0, R.preceded)(Vl, (0, R.delimited)(S(Lk, V), (0, R.map)((0, R.optional)(c(Mr, S(zl, V), (m, r) => [m, ...r.map((C) => C[1])])), (m) => m ? [ + "mapConstructor", + ...m + ] : ["mapConstructor"]), (0, R.preceded)(V, Mk))), Or = (0, R.map)((0, R.delimited)(Jk, S((0, R.optional)(c(k, zl, (m, r) => [m, ...r.map((C) => C[1])].map((C) => ["arrayElem", C]))), V), Kk), (m) => ["squareArray", ...m !== null ? m : []]), Pr = (0, R.map)((0, R.preceded)(Hm, (0, R.preceded)(V, Sa)), (m) => ["curlyArray", ...m !== null ? [["arrayElem", m]] : []]), Qr = (0, R.map)((0, R.or)([Or, Pr]), (m) => ["arrayConstructor", m]), qj = (0, R.or)([Go, fp, sf, il]), Rr = (0, R.map)((0, R.preceded)(nl, (0, R.preceded)(V, qj)), (m) => m === "*" ? ["unaryLookup", ["star"]] : typeof m === "string" ? ["unaryLookup", ["NCName", m]] : ["unaryLookup", m]), uf = (0, R.or)([Vo, Wo, Ak([Nk], "{"), Ak([Ok], "}"), (0, R.map)(Sa, (m) => m || ["sequenceExpr"])]), Sr = (0, R.or)([mp, function(m, r) { + return rj(m, r); + }, uf, lp]), Tr = (0, R.or)([(0, R.map)(np, (m) => m.replace(/[\x20\x0D\x0A\x09]/g, " ")), uf]), Ur = (0, R.or)([(0, R.map)(op, (m) => m.replace(/[\x20\x0D\x0A\x09]/g, " ")), uf]), Vr = (0, R.map)((0, R.or)([S((0, R.star)((0, R.or)([Xo, Tr])), Rk), S((0, R.star)((0, R.or)([Yo, Ur])), Pk)]), (m) => Mp(m, false, false)), Wr = (0, R.then)(Mo, (0, R.preceded)(S(ol, (0, R.optional)(Do)), Vr), (m, r) => { + if (m[0].prefix === "" && m[1] === "xmlns") { + if (r.length && typeof r[0] !== "string") + throw Error("XQST0022: A namespace declaration may not contain enclosed expressions"); + return ["namespaceDeclaration", r.length ? ["uri", r[0]] : ["uri"]]; + } + if (m[0].prefix === "xmlns") { + if (r.length && typeof r[0] !== "string") + throw Error("XQST0022: The namespace declaration for 'xmlns:" + m[1] + "' may not contain enclosed expressions"); + return ["namespaceDeclaration", ["prefix", m[1]], r.length ? ["uri", r[0]] : ["uri"]]; + } + return [ + "attributeConstructor", + ["attributeName"].concat(m), + r.length === 0 ? ["attributeValue"] : r.length === 1 && typeof r[0] === "string" ? ["attributeValue", r[0]] : ["attributeValueExpr"].concat(r) + ]; + }), Xr = (0, R.map)((0, R.star)((0, R.preceded)(Do, (0, R.optional)(Wr))), (m) => m.filter(Boolean)), Yr = wk((0, R.preceded)(tl, Mo), Xr, (0, R.or)([(0, R.map)(Vk, () => null), (0, R.then)((0, R.preceded)(wl, (0, R.star)(Sr)), T([V, Wk], (0, R.followed)(Mo, (0, R.then)((0, R.optional)(Do), wl, () => null))), (m, r) => [Mp(m, true, true), r])]), (m, r, C) => { + var Z = C; + if (C && C.length) { + Z = Np(m); + const da = Np(C[1]); + if (Z !== da) + throw Error('XQST0118: The start and the end tag of an element constructor must be equal. "' + Z + '" does not match "' + da + '"'); + Z = C[0]; + } + return ["elementConstructor", ["tagName", ...m], ...r.length ? [["attributeList", ...r]] : [], ...Z && Z.length ? [["elementContent", ...Z]] : []]; + }), rj = (0, R.or)([Yr, qp, tp]), Zr = (0, R.map)(T([Im, V], Sa), (m) => ["computedDocumentConstructor", ...m ? [["argExpr", m]] : []]), $r = (0, R.map)(Sa, (m) => m ? [["contentExpr", m]] : []), as = (0, R.then)(T([Wl, V], (0, R.or)([ + (0, R.map)(Po, (m) => ["tagName", ...m]), + (0, R.map)((0, R.delimited)(Lk, S(l, V), Mk), (m) => ["tagNameExpr", m]) + ])), (0, R.preceded)(V, $r), (m, r) => ["computedElementConstructor", m, ...r]), bs = (0, R.then)((0, R.preceded)(Xl, (0, R.or)([(0, R.map)(T([So, V], Po), (m) => ["tagName", ...m]), (0, R.map)((0, R.preceded)(V, (0, R.delimited)(Lk, S(l, V), Mk)), (m) => ["tagNameExpr", m])])), (0, R.preceded)(V, Sa), (m, r) => ["computedAttributeConstructor", m, ["valueExpr", r ? r : ["sequenceExpr"]]]), cs = (0, R.map)(Sa, (m) => m ? [["prefixExpr", m]] : []), ds = (0, R.map)(Sa, (m) => m ? [["URIExpr", m]] : []), es = (0, R.then)(T([ + Jm, + V + ], (0, R.or)([Ho, cs])), (0, R.preceded)(V, ds), (m, r) => ["computedNamespaceConstructor", ...m, ...r]), fs = (0, R.map)(T([Km, V], Sa), (m) => ["computedTextConstructor", ...m ? [["argExpr", m]] : []]), gs = (0, R.map)(T([Lm, V], Sa), (m) => ["computedCommentConstructor", ...m ? [["argExpr", m]] : []]), hs = T([Mm, V], (0, R.then)((0, R.or)([(0, R.map)(Go, (m) => ["piTarget", m]), (0, R.map)((0, R.delimited)(Lk, S(l, V), Mk), (m) => ["piTargetExpr", m])]), (0, R.preceded)(V, Sa), (m, r) => ["computedPIConstructor", m, ...r ? [["piValueExpr", r]] : []])), is = (0, R.or)([ + Zr, + as, + bs, + es, + fs, + gs, + hs + ]), js = (0, R.or)([rj, is]), sj = (0, R.or)([rf, Ro, sf, hp, vr, js, Jr, Nr, Qr, Rr]), tj = (0, R.map)(T([nl, V], qj), (m) => m === "*" ? ["lookup", ["star"]] : typeof m === "string" ? ["lookup", ["NCName", m]] : ["lookup", m]), ks = (0, R.then)((0, R.map)(sj, (m) => Jp(m)), (0, R.star)((0, R.or)([(0, R.map)((0, R.preceded)(V, t), (m) => ["predicate", m]), (0, R.map)((0, R.preceded)(V, be), (m) => ["argumentList", m]), (0, R.preceded)(V, tj)])), (m, r) => { + function C() { + uj && xa.length === 1 ? vc.push(["predicate", xa[0]]) : xa.length !== 0 && vc.push(["predicates", ...xa]); + xa.length = 0; + } + function Z(Xb) { + C(); + vc.length !== 0 ? (da[0][0] === "sequenceExpr" && 2 < da[0].length && (da = [["sequenceExpr", ...da]]), da = [["filterExpr", ...da], ...vc], vc.length = 0) : Xb && (da = [["filterExpr", ...da]]); + } + let da = [m]; + const xa = [], vc = []; + let uj = false; + for (const Xb of r) + switch (Xb[0]) { + case "predicate": + xa.push(Xb[1]); + break; + case "lookup": + uj = true; + C(); + vc.push(Xb); + break; + case "argumentList": + Z(false); + 1 < da.length && (da = [["sequenceExpr", ["pathExpr", ["stepExpr", ...da]]]]); + da = [["dynamicFunctionInvocationExpr", ["functionItem", ...da], ...Xb[1].length ? [["arguments", ...Xb[1]]] : []]]; + break; + default: + throw Error("unreachable"); + } + Z(true); + return da; + }), wc = (0, R.or)([(0, R.map)(ks, (m) => ["stepExpr", ...m]), ur]), ls = (0, R.followed)(sj, (0, R.peek)((0, R.not)((0, R.preceded)(V, (0, R.or)([t, be, tj])), ["primary expression not followed by predicate, argumentList, or lookup"]))), ms = (0, R.or)([wk(wc, (0, R.preceded)(V, up), (0, R.preceded)(V, h), (m, r, C) => ["pathExpr", m, r, ...C]), (0, R.then)(wc, (0, R.preceded)(S(El, V), h), (m, r) => ["pathExpr", m, ...r]), ls, (0, R.map)(wc, (m) => ["pathExpr", m])]), qf = (0, R.or)([wk(wc, (0, R.preceded)(V, up), (0, R.preceded)(V, h), (m, r, C) => [m, r, ...C]), (0, R.then)(wc, (0, R.preceded)(S(El, V), h), (m, r) => [m, ...r]), (0, R.map)(wc, (m) => [m])]), ns = (0, R.or)([(0, R.map)(T([El, V], qf), (m) => ["pathExpr", ["rootExpr"], ...m]), (0, R.then)(up, (0, R.preceded)(V, qf), (m, r) => ["pathExpr", ["rootExpr"], m, ...r]), (0, R.map)((0, R.followed)(El, (0, R.not)((0, R.preceded)(V, a.Ya ? Bk(/[* ["pathExpr", ["rootExpr"]])]), os = vk((0, R.or)([ms, ns]), Qp), ps = (0, R.preceded)(Pm, (0, R.then)((0, R.optional)((0, R.or)([(0, R.map)((0, R.preceded)(V, vp), (m) => ["validationMode", m]), (0, R.map)(T([V, Qm, V], Po), (m) => ["type", ...m])])), (0, R.delimited)((0, R.preceded)(V, Lk), S(l, V), Mk), (m, r) => ["validateExpr", ...m ? [m] : [], ["argExpr", r]])), qs = (0, R.delimited)(Fk, (0, R.then)((0, R.preceded)(V, Po), (0, R.optional)((0, R.preceded)(W, wp)), (m, r) => r ? ["pragma", ["pragmaName", m], ["pragmaContents", r]] : ["pragma", ["pragmaName", m]]), (0, R.preceded)(V, Gk)), rs = (0, R.map)((0, R.followed)((0, R.plus)(qs), (0, R.preceded)(V, (0, R.delimited)(Lk, S((0, R.optional)(l), V), Mk))), (m) => ["extensionExpr", ...m]), ss = e(c(os, pl, (m, r) => r.length === 0 ? m : ["simpleMapExpr", m[0] === "pathExpr" ? m : ["pathExpr", ["stepExpr", ["filterExpr", Jp(m)]]]].concat(r.map((C) => { + C = C[1]; + return C[0] === "pathExpr" ? C : ["pathExpr", ["stepExpr", ["filterExpr", Jp(C)]]]; + })))), ts = (0, R.or)([ps, rs, ss]), vj = (0, R.or)([(0, R.then)((0, R.or)([Ak([Dl], "unaryMinusOp"), Ak([Cl], "unaryPlusOp")]), (0, R.preceded)(V, function(m, r) { + return vj(m, r); + }), (m, r) => [m, ["operand", r]]), ts]), us = (0, R.or)([(0, R.map)(Po, (m) => ["EQName", ...m]), Ro, sf]), vs = (0, R.then)(vj, (0, R.star)(T([V, Gl, V], (0, R.then)(us, (0, R.preceded)(V, be), (m, r) => [m, r]))), (m, r) => r.reduce((C, Z) => ["arrowExpr", ["argExpr", C], Z[0], ["arguments", ...Z[1]]], m)), ws = (0, R.then)(vs, (0, R.optional)(T([V, Ll, W, Kl, So, V], Op)), (m, r) => r !== null ? ["castExpr", ["argExpr", m], r] : m), xs = (0, R.then)(ws, (0, R.optional)(T([V, Ml, W, Kl, So, V], Op)), (m, r) => r !== null ? ["castableExpr", ["argExpr", m], r] : m), ys = (0, R.then)(xs, (0, R.optional)(T([ + V, + Nl, + W, + Kl, + So, + V + ], db)), (m, r) => r !== null ? ["treatExpr", ["argExpr", m], ["sequenceType", ...r]] : m), zs = (0, R.then)(ys, (0, R.optional)(T([V, Ol, W, Pl, So, V], db)), (m, r) => r !== null ? ["instanceOfExpr", ["argExpr", m], ["sequenceType", ...r]] : m), As = c(zs, (0, R.followed)((0, R.or)([Ak([Zl], "intersectOp"), Ak([$l], "exceptOp")]), So), b), Bs = c(As, (0, R.or)([Ak([ql], "unionOp"), (0, R.followed)(Ak([am], "unionOp"), So)]), b), Cs = c(Bs, (0, R.or)([Ak([il], "multiplyOp"), (0, R.followed)(Ak([fm], "divOp"), So), (0, R.followed)(Ak([gm], "idivOp"), So), (0, R.followed)(Ak([hm], "modOp"), So)]), b), Ds = c(Cs, (0, R.or)([Ak([Dl], "subtractOp"), Ak([Cl], "addOp")]), b), Es = d(Ds, (0, R.followed)(Ak([bm], "rangeSequenceExpr"), So), "startExpr", "endExpr"), Fs = c(Es, Ak([rl], "stringConcatenateOp"), b), Gs = d(Fs, (0, R.or)([xp, yp, zp])), Hs = c(Gs, (0, R.followed)(Ak([em], "andOp"), So), b), or = c(Hs, (0, R.followed)(Ak([dm], "orOp"), So), b), ir = (0, R.then)((0, R.then)(T([rm, V, Hk, V], l), T([V, Ik, V, sm, So, V], k), (m, r) => [m, r]), T([V, tm, So, V], k), (m, r) => ["ifThenElseExpr", ["ifClause", m[0]], ["thenClause", m[1]], ["elseClause", r]]), Is = (0, R.delimited)(um, W, vm), Js = (0, R.map)(T([wm, W, kl], Po), (m) => ["positionalVariableBinding", ...m]), Ks = yk((0, R.preceded)(kl, (0, R.cut)(Po)), (0, R.cut)((0, R.preceded)(V, (0, R.optional)(uc))), (0, R.cut)((0, R.preceded)(V, (0, R.optional)(Is))), (0, R.cut)((0, R.preceded)(V, (0, R.optional)(Js))), (0, R.cut)((0, R.preceded)(S(xm, V), k)), (m, r, C, Z, da) => ["forClauseItem", ["typedVariableBinding", ["varName", ...m, ...r ? [r] : []]], ...C ? [["allowingEmpty"]] : [], ...Z ? [Z] : [], ["forExpr", da]]), Ls = T([ym, W], c(Ks, zl, (m, r) => [ + "forClause", + m, + ...r.map((C) => C[1]) + ])), Ms = wk((0, R.preceded)(kl, Po), (0, R.preceded)(V, (0, R.optional)(uc)), (0, R.preceded)(S(el, V), k), (m, r, C) => ["letClauseItem", ["typedVariableBinding", ["varName", ...m], ...r ? [r] : []], ["letExpr", C]]), Ns = (0, R.map)(T([zm, V], c(Ms, zl, (m, r) => [m, ...r.map((C) => C[1])])), (m) => ["letClause", ...m]), wj = (0, R.or)([Ls, Ns]), Os = (0, R.map)(T([Am, So, V], k), (m) => ["whereClause", m]), Ps = (0, R.map)((0, R.preceded)(kl, Po), (m) => ["varName", ...m]), Qs = (0, R.then)((0, R.preceded)(V, (0, R.optional)(uc)), (0, R.preceded)(S(el, V), k), (m, r) => ["groupVarInitialize", ...m ? [["typeDeclaration", ...m]] : [], ["varValue", r]]), Rs = wk(Ps, (0, R.optional)(Qs), (0, R.optional)((0, R.map)((0, R.preceded)(S(Bm, V), u), (m) => ["collation", m])), (m, r, C) => ["groupingSpec", m, ...r ? [r] : [], ...C ? [C] : []]), Ss = c(Rs, zl, (m, r) => [m, ...r.map((C) => C[1])]), Ts = (0, R.map)(T([Cm, W, Dm, V], Ss), (m) => ["groupByClause", ...m]), Us = wk((0, R.optional)((0, R.or)([On, Pn])), (0, R.optional)(T([V, vm, V], (0, R.or)([Zm, $m].map((m) => (0, R.map)(m, (r) => "empty " + r))))), (0, R.preceded)(V, (0, R.optional)(T([Bm, V], u))), (m, r, C) => m || r || C ? ["orderModifier", ...m ? [["orderingKind", m]] : [], ...r ? [["emptyOrderingMode", r]] : [], ...C ? [["collation", C]] : []] : null), Vs = (0, R.then)(k, (0, R.preceded)(V, Us), (m, r) => ["orderBySpec", ["orderByExpr", m], ...r ? [r] : []]), Ws = c(Vs, zl, (m, r) => [m, ...r.map((C) => C[1])]), Xs = (0, R.then)((0, R.or)([(0, R.map)(T([Em, W], Dm), () => false), (0, R.map)(T([Fm, W, Em, W], Dm), () => true)]), (0, R.preceded)(V, Ws), (m, r) => ["orderByClause", ...m ? [["stable"]] : [], ...r]), Ys = (0, R.or)([wj, Os, Ts, Xs]), Zs = (0, R.map)(T([Gm, V], k), (m) => [ + "returnClause", + m + ]), er = wk(wj, (0, R.cut)((0, R.star)((0, R.preceded)(V, Ys))), (0, R.cut)((0, R.preceded)(V, Zs)), (m, r, C) => ["flworExpr", m, ...r, C]), $s = c(db, ql, (m, r) => r.length === 0 ? ["sequenceType", ...m] : ["sequenceTypeUnion", ["sequenceType", ...m], ...r.map((C) => ["sequenceType", ...C[1]])]), at = wk(T([cn, V], (0, R.optional)((0, R.preceded)(kl, (0, R.followed)((0, R.followed)(Po, W), Kl)))), (0, R.preceded)(V, $s), T([W, Gm, W], k), (m, r, C) => ["typeswitchExprCaseClause"].concat(m ? [["variableBinding", ...m]] : [], [r], [["resultExpr", C]])), hr = xk((0, R.preceded)(dn, S((0, R.delimited)(Hk, S(l, V), Ik), V)), (0, R.plus)((0, R.followed)(at, V)), T([Sm, W], (0, R.optional)((0, R.preceded)(kl, (0, R.followed)(Po, W)))), T([Gm, W], k), (m, r, C, Z) => ["typeswitchExpr", ["argExpr", m], ...r, ["typeswitchExprDefaultClause", ...C || [], ["resultExpr", Z]]]), bt = wk((0, R.preceded)(kl, Po), (0, R.optional)((0, R.preceded)(W, uc)), (0, R.preceded)(S(xm, W), k), (m, r, C) => ["quantifiedExprInClause", ["typedVariableBinding", ["varName", ...m], ...r ? [r] : []], ["sourceExpr", C]]), ct = c(bt, zl, (m, r) => [m, ...r.map((C) => C[1])]), fr = wk((0, R.or)([en, fn]), (0, R.preceded)(W, ct), (0, R.preceded)(S(gn, V), k), (m, r, C) => ["quantifiedExpr", ["quantifier", m], ...r, ["predicateExpr", C]]), kr = (0, R.map)(T([Sl, W, (0, R.or)([Rl, Ql]), W], k), (m) => ["deleteExpr", ["targetExpr", m]]), mr = wk(T([hn, W], (0, R.optional)(T([Tl, W, Pl], W))), T([Ql, W], k), (0, R.preceded)(S(jn, W), k), (m, r, C) => m ? ["replaceExpr", ["replaceValue"], ["targetExpr", r], ["replacementExpr", C]] : ["replaceExpr", ["targetExpr", r], ["replacementExpr", C]]), dt = (0, R.then)(Ro, (0, R.preceded)(S(el, V), k), (m, r) => [ + "transformCopy", + m, + ["copySource", r] + ]), nr = wk(T([kn, W], c(dt, zl, (m, r) => [m, ...r.map((C) => C[1])])), T([V, ln, W], k), (0, R.preceded)(S(Gm, W), k), (m, r, C) => ["transformExpr", ["transformCopies", ...m], ["modifyExpr", r], ["returnExpr", C]]), et = (0, R.or)([(0, R.followed)((0, R.map)((0, R.optional)((0, R.followed)(T([Kl, W], (0, R.or)([(0, R.map)(mn, () => ["insertAsFirst"]), (0, R.map)(nn, () => ["insertAsLast"])])), W)), (m) => m ? ["insertInto", m] : ["insertInto"]), qn), (0, R.map)(pn, () => ["insertAfter"]), (0, R.map)(on, () => ["insertBefore"])]), jr = wk(T([rn, W, (0, R.or)([ + Rl, + Ql + ]), W], k), (0, R.preceded)(W, et), (0, R.preceded)(W, k), (m, r, C) => ["insertExpr", ["sourceExpr", m], r, ["targetExpr", C]]), lr = (0, R.then)(T([sn, W, Ql, V], k), T([W, Kl, W], k), (m, r) => ["renameExpr", ["targetExpr", m], ["newNameExpr", r]]), ft = (0, R.then)((0, R.plus)((0, R.map)(T([cn, W], k), (m) => ["switchCaseExpr", m])), T([W, Gm, W], k), (m, r) => ["switchExprCaseClause", ...m, ["resultExpr", r]]), gr = wk(T([tn, V, Hk], l), T([V, Ik, V], (0, R.plus)((0, R.followed)(ft, V))), T([Sm, W, Gm, W], k), (m, r, C) => ["switchExpr", ["argExpr", m], ...r, [ + "switchExprDefaultClause", + ["resultExpr", C] + ]]), gt = (0, R.map)(l, (m) => ["queryBody", m]), ht = T([Rm, W, Jm, W], (0, R.cut)((0, R.then)(Go, (0, R.preceded)(S(ol, V), u), (m, r) => ["namespaceDecl", ["prefix", m], ["uri", r]]))), it = (0, R.then)(T([un, W, kl, V], (0, R.then)(Po, (0, R.optional)((0, R.preceded)(V, uc)), (m, r) => [m, r])), (0, R.cut)((0, R.or)([(0, R.map)(T([V, el, V], k), (m) => ["varValue", m]), (0, R.map)(T([W, vn], (0, R.optional)(T([V, el, V], k))), (m) => ["external", ...m ? [["varValue", m]] : []])])), ([m, r], C) => ["varDecl", ["varName", ...m], ...r !== null ? [r] : [], C]), jt = xk(T([ + Ul, + W, + (0, R.peek)((0, R.not)(ip, ["Cannot use reserved function name"])) + ], Po), (0, R.cut)(T([V, Hk, V], (0, R.optional)(pj))), (0, R.cut)(T([V, Ik], (0, R.optional)(T([W, Kl, W], db)))), (0, R.cut)((0, R.preceded)(V, (0, R.or)([(0, R.map)(oj, (m) => ["functionBody", m]), (0, R.map)(vn, () => ["externalDefinition"])]))), (m, r, C, Z) => ["functionDecl", ["functionName", ...m], ["paramList", ...r || []], ...C ? [["typeDeclaration", ...C]] : [], Z]), kt = T([Rm, W], (0, R.then)((0, R.star)((0, R.followed)((0, R.or)([tf, Ap]), W)), (0, R.or)([it, jt]), (m, r) => [ + r[0], + ...m, + ...r.slice(1) + ])), lt = (0, R.then)(T([Rm, W, Sm, W], (0, R.or)([Wl, Ul])), T([W, Jm, W], u), (m, r) => ["defaultNamespaceDecl", ["defaultNamespaceCategory", m], ["uri", r]]), mt = (0, R.or)([(0, R.map)((0, R.followed)(T([Jm, W], Go), (0, R.preceded)(V, ol)), (m) => ["namespacePrefix", m]), (0, R.map)(T([Sm, W, Wl, W], Jm), () => ["defaultElementNamespace"])]), nt = T([xn, W, yn], wk((0, R.optional)((0, R.preceded)(W, mt)), (0, R.preceded)(V, u), (0, R.optional)((0, R.then)(T([W, wm, W], u), (0, R.star)(T([V, zl, V], u)), (m, r) => [m, ...r])), (m, r, C) => ["schemaImport", ...m ? [m] : [], ["targetNamespace", r], ...C ? [C] : []])), ot = T([xn, W, zn], wk((0, R.optional)((0, R.followed)(T([W, Jm, W], Go), (0, R.preceded)(V, ol))), (0, R.preceded)(V, u), (0, R.optional)((0, R.then)(T([W, wm, W], u), (0, R.star)(T([V, zl, V], u)), (m, r) => [m, ...r])), (m, r) => ["moduleImport", ["namespacePrefix", m], ["targetNamespace", r]])), pt = (0, R.or)([nt, ot]), qt = (0, R.map)(T([Rm, W, Sm, W, Bm, W], u), (m) => ["defaultCollationDecl", m]), rt = (0, R.map)(T([Rm, W, An, W], u), (m) => ["baseUriDecl", m]), st = (0, R.then)(T([Rm, W], (0, R.or)([(0, R.map)(T([bn, W], Po), (m) => ["decimalFormatName", ...m]), (0, R.map)(T([Sm, W], bn), () => null)])), (0, R.star)((0, R.then)((0, R.preceded)(W, Dp), (0, R.preceded)(S(ol, W), u), (m, r) => ["decimalFormatParam", ["decimalFormatParamName", m], ["decimalFormatParamValue", r]])), (m, r) => ["decimalFormatDecl", ...m ? [m] : [], ...r]), tt = (0, R.or)([Ep, qt, rt, Fp, Gp, Hp, Ip, st]), ut = (0, R.then)(T([Rm, W, Fn, W], Po), (0, R.preceded)(W, u), (m, r) => ["optionDecl", ["optionName", m], ["optionContents", r]]), vt = (0, R.then)(T([Rm, W, Gn, W, Hn], (0, R.optional)(T([W, Kl], mj))), (0, R.or)([(0, R.map)((0, R.preceded)(S(el, V), k), (m) => ["varValue", m]), (0, R.map)(T([W, vn], (0, R.optional)((0, R.preceded)(S(el, V), k))), () => ["external"])]), (m, r) => ["contextItemDecl", ...m ? [["contextItemType", m]] : [], r]), xj = (0, R.then)((0, R.star)((0, R.followed)((0, R.or)([lt, tt, ht, pt]), (0, R.cut)(S(hl, V)))), (0, R.star)((0, R.followed)((0, R.or)([vt, kt, ut]), (0, R.cut)(S(hl, V)))), (m, r) => m.length === 0 && r.length === 0 ? null : ["prolog", ...m, ...r]), wt = T([zn, W, Jm, W], (0, R.then)((0, R.followed)(Go, S(ol, V)), (0, R.followed)(u, S(hl, V)), (m, r) => ["moduleDecl", ["prefix", m], [ + "uri", + r + ]])), xt = (0, R.then)(wt, (0, R.preceded)(V, xj), (m, r) => ["libraryModule", m, ...r ? [r] : []]), yt = (0, R.then)(xj, (0, R.preceded)(V, gt), (m, r) => ["mainModule", ...m ? [m] : [], r]), zt = (0, R.map)(T([In, V], (0, R.followed)((0, R.or)([(0, R.then)((0, R.preceded)(Kn, W), u, (m) => ["encoding", m]), (0, R.then)(T([Jn, W], u), (0, R.optional)(T([W, Kn, W], u)), (m, r) => [["version", m], ...r ? [["encoding", r]] : []])]), (0, R.preceded)(V, hl))), (m) => ["versionDecl", ...m]), At = (0, R.then)((0, R.optional)(S(zt, V)), (0, R.or)([xt, yt]), (m, r) => [ + "module", + ...m ? [m] : [], + r + ]), Bt = (0, R.complete)(S(At, V)); + return (m, r) => { + n.clear(); + r = Bt(m, r); + let C = 1, Z = 1; + for (let xa = 0; xa < m.length + 1; xa++) { + if (n.has(xa)) { + var da = n.get(xa); + da.line = Z; + da.ha = C; + } + da = m[xa]; + da === "\r" || da === "\n" ? (Z++, C = 1) : C++; + } + return r; + }; + } + const Sp = Rp({lb: false, Ya: false}), Tp = Rp({lb: true, Ya: false}), Up = Rp({lb: false, Ya: true}), Vp = Rp({lb: true, Ya: true}); + function Wp(a, b) { + var c = !!b.Z; + b = !!b.debug; + xo.clear(); + yo.clear(); + Qp.clear(); + c = c ? b ? Vp(a, 0) : Up(a, 0) : b ? Tp(a, 0) : Sp(a, 0); + if (c.success === true) + return c.value; + a = a.substring(0, c.offset).split("\n"); + b = a[a.length - 1].length + 1; + throw new yh({start: {offset: c.offset, line: a.length, ha: b}, end: {offset: c.offset + 1, line: a.length, ha: b + 1}}, "", Error(`XPST0003: Failed to parse script. Expected ${[...new Set(c.expected)]}`)); + } + const Xp = "http://www.w3.org/XML/1998/namespace http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2005/xpath-functions http://www.w3.org/2005/xpath-functions/math http://www.w3.org/2012/xquery http://www.w3.org/2005/xpath-functions/array http://www.w3.org/2005/xpath-functions/map".split(" "); + function Yp(a, b, c, d, e) { + var f = G(a, "functionName"), h = I(f, "prefix") || ""; + let k = I(f, "URI"); + const l = H(f); + if (k === null && (k = h === "" ? b.v === null ? "http://www.w3.org/2005/xpath-functions" : b.v : b.$(h), !k && h)) + throw gg(h); + if (Xp.includes(k)) + throw ag(); + h = K(a, "annotation").map((z) => G(z, "annotationName")); + f = h.every((z) => !I(z, "URI") && H(z) !== "private"); + h = h.some((z) => !I(z, "URI") && H(z) === "updating"); + if (!k) + throw cg(); + const n = sg(a), t = K(G(a, "paramList"), "param"), u = t.map((z) => G(z, "varName")), y = t.map((z) => sg(z)); + if (a = G(a, "functionBody")) { + if (b.ta(k, l, y.length)) + throw bg(k, l); + if (!e) + return; + const z = kk(a[1], {qa: false, Z: true}), F = new jg(b), O = u.map((U) => { + let ba = I(U, "URI"); + const Ga = I(U, "prefix"); + U = H(U); + Ga && ba === null && (ba = b.$(Ga || "")); + return og(F, ba, U); + }); + e = h ? {j: y, arity: u.length, callFunction: (U, ba, Ga, ...Eb) => { + U = hc(bc(U, -1, null, w.empty()), O.reduce((Vb, bd, Wb) => { + Vb[bd] = Ra(Eb[Wb]); + return Vb; + }, Object.create(null))); + return z.s(U, ba); + }, ub: false, J: true, bb: f, localName: l, namespaceURI: k, i: n} : {j: y, arity: u.length, callFunction: (U, ba, Ga, ...Eb) => { + U = hc(bc(U, -1, null, w.empty()), O.reduce((Vb, bd, Wb) => { + Vb[bd] = Ra(Eb[Wb]); + return Vb; + }, Object.create(null))); + return B(z, U, ba); + }, ub: false, J: false, bb: f, localName: l, namespaceURI: k, i: n}; + c.push({ba: z, Cb: F}); + d.push({arity: u.length, ba: z, yb: e, localName: l, namespaceURI: k, bb: f}); + } else { + if (h) + throw Error("Updating external function declarations are not supported"); + e = {j: y, arity: u.length, callFunction: (z, F, O, ...U) => { + const ba = O.ta(k, l, u.length, true); + if (!ba) + throw Error(`XPST0017: Function Q{${k}}${l} with arity of ${u.length} not registered. ${Uf(l)}`); + if (ba.i.type !== n.type || ba.j.some((Ga, Eb) => Ga.type !== y[Eb].type)) + throw Error("External function declaration types do not match actual function"); + return ba.callFunction(z, F, O, ...U); + }, ub: true, J: false, localName: l, namespaceURI: k, bb: f, i: n}; + } + mg(b, k, l, u.length, e); + } + function Zp(a, b, c, d) { + const e = [], f = []; + K(a, "*").forEach((t) => { + switch (t[0]) { + case "moduleImport": + case "namespaceDecl": + case "defaultNamespaceDecl": + case "functionDecl": + case "varDecl": + break; + default: + throw Error("Not implemented: only module imports, namespace declarations, and function declarations are implemented in XQuery modules"); + } + }); + const h = new Set(); + K(a, "moduleImport").forEach((t) => { + const u = H(G(t, "namespacePrefix")); + t = H(G(t, "targetNamespace")); + if (h.has(t)) + throw Error(`XQST0047: The namespace "${t}" is imported more than once.`); + h.add(t); + ng(b, u, t); + }); + K(a, "namespaceDecl").forEach((t) => { + const u = H(G(t, "prefix")); + t = H(G(t, "uri")); + if (u === "xml" || u === "xmlns") + throw eg(); + if (t === "http://www.w3.org/XML/1998/namespace" || t === "http://www.w3.org/2000/xmlns/") + throw eg(); + ng(b, u, t); + }); + let k = null, l = null; + for (const t of K(a, "defaultNamespaceDecl")) { + const u = H(G(t, "defaultNamespaceCategory")), y = H(G(t, "uri")); + if (!y) + throw cg(); + if (y === "http://www.w3.org/XML/1998/namespace" || y === "http://www.w3.org/2000/xmlns/") + throw eg(); + if (u === "function") { + if (k) + throw dg(); + k = y; + } else if (u === "element") { + if (l) + throw dg(); + l = y; + } + } + k && (b.v = k); + l && ng(b, "", l); + K(a, "functionDecl").forEach((t) => { + Yp(t, b, e, f, c); + }); + const n = []; + K(a, "varDecl").forEach((t) => { + const u = rg(G(t, "varName")); + let y = u.namespaceURI; + if (y === null && (y = b.$(u.prefix), !y && u.prefix)) + throw gg(u.prefix); + if (Xp.includes(y)) + throw ag(); + var z = G(t, "external"); + t = G(t, "varValue"); + let F, O; + z !== null ? (z = G(z, "varValue"), z !== null && (F = G(z, "*"))) : t !== null && (F = G(t, "*")); + if (n.some((U) => U.namespaceURI === y && U.localName === u.localName)) + throw Error(`XQST0049: The variable ${y ? `Q{${y}}` : ""}${u.localName} has already been declared.`); + og(b, y || "", u.localName); + if (c && (F && (O = kk(F, {qa: false, Z: true})), F && !lg(b, y || "", u.localName))) { + let U = null; + pg(b, y, u.localName, (ba, Ga) => { + if (U) + return U(); + U = Ra(B(O, ba, Ga)); + return U(); + }); + e.push({ba: O, Cb: new jg(b)}); + n.push({ba: O, localName: u.localName, namespaceURI: y}); + } + }); + f.forEach((t) => { + if (!t.yb.J && t.ba.J) + throw we(`The function Q{${t.namespaceURI}}${t.localName} is updating but the %updating annotation is missing.`); + }); + return { + Ha: f.map((t) => t.yb), + Ta: n, + source: d, + oa: (t) => { + h.forEach((u) => { + sk(b, u); + }); + e.forEach(({ba: u, Cb: y}) => { + h.forEach((z) => { + sk(y, z); + }); + t.Ha.forEach((z) => { + y.ta(z.namespaceURI, z.localName, z.arity, true) || z.bb && mg(y, z.namespaceURI, z.localName, z.arity, z); + }); + t.Ta.forEach((z) => { + y.cb(z.namespaceURI, z.localName) || og(y, z.namespaceURI, z.localName); + }); + u.v(y); + }); + } + }; + } + function $p(a, b, c, d, e, f, h) { + const k = b.Z ? "XQuery" : "XPath"; + c = b.Ga ? null : nk(a, k, c, d, e, b.debug, f, h); + return c !== null ? {state: c.ec ? 1 : 2, ba: c.ba} : {state: 0, Wb: typeof a === "string" ? Wp(a, b) : pk(a)}; + } + function aq(a, b, c, d) { + const e = G(a, "mainModule"); + if (!e) + throw Error("Can not execute a library module."); + const f = G(e, "prolog"); + if (f) { + if (!b.Z) + throw Error("XPST0003: Use of XQuery functionality is not allowed in XPath context"); + tk(); + d = Zp(f, c, true, d); + d.oa(d); + } + N(a, new Zg(c)); + a = J(e, ["queryBody", "*"]); + return Q(a, b); + } + function bq(a, b, c, d, e, f, h) { + const k = new Yf(c, d, f, h), l = new jg(k); + 0 < Object.keys(e).length && tk(); + Object.keys(e).forEach((n) => { + const t = e[n]; + sk(l, t); + ng(l, n, t); + }); + typeof a === "string" && (a = uk(a)); + c = $p(a, b, c, d, e, f, h); + switch (c.state) { + case 2: + return {ga: l, ba: c.ba}; + case 1: + return c.ba.v(l), ok(a, b.Z ? "XQuery" : "XPath", k, e, c.ba, b.debug, f), {ga: l, ba: c.ba}; + case 0: + return c = aq(c.Wb, b, l, a), c.v(l), b.Ga || ok(a, b.Z ? "XQuery" : "XPath", k, e, c, b.debug, f), {ga: l, ba: c}; + } + } + function cq(a) { + if (v(a.type, 1)) + return a.value; + if (v(a.type, 54)) + return a.value.node; + throw mc(`Unable to convert selector argument of type ${Ea[a.type]} to either an ${Ea[1]} or an ${Ea[54]} representing an XQueryX program while calling 'fontoxpath:evaluate'`); + } + function dq(a, b, c, d) { + a = a.first(); + const e = b.first().h.reduce((f, h) => { + f[h.key.value] = Ra(h.value()); + return f; + }, Object.create(null)); + b = e["."] ? e["."]() : w.empty(); + delete e["."]; + try { + const {ba: f, ga: h} = bq(cq(a), {qa: false, Z: true, debug: d.debug, Ga: d.Ga}, (n) => c.$(n), Object.keys(e).reduce((n, t) => { + n[t] = t; + return n; + }, {}), {}, "http://www.w3.org/2005/xpath-functions", (n, t) => c.Sa(n, t)), k = !b.G(), l = new cc({N: k ? b.first() : null, Fa: k ? 0 : -1, za: b, wa: Object.keys(e).reduce((n, t) => { + n[h.cb(null, t)] = e[t]; + return n; + }, Object.create(null))}); + return {fc: f.h(l, d).value, cc: a}; + } catch (f) { + Pf(a.value, f); + } + } + function eq(a, b, c) { + if (b.node.nodeType !== 1 && b.node.nodeType !== 9) + return []; + const d = hb(a, b).reduce((e, f) => { + for (const h of eq(a, f, c)) + e.push(h); + return e; + }, []); + c(b) && d.unshift(b); + return d; + } + const fq = (a, b, c, d, e) => { + a = e.first(); + if (!a) + throw lc("The context is absent, it needs to be present to use id function."); + if (!v(a.type, 53)) + throw mc("The context item is not a node, it needs to be node to use id function."); + const f = b.h, h = d.O().reduce((k, l) => { + l.value.split(/\s+/).forEach((n) => { + k[n] = true; + }); + return k; + }, Object.create(null)); + for (b = a.value; b.node.nodeType !== 9; ) + if (b = x(f, b), b === null) + throw Error("FODC0001: the root node of the target node is not a document node."); + b = eq(f, b, (k) => { + if (k.node.nodeType !== 1) + return false; + k = gb(f, k, "id"); + if (!k || !h[k]) + return false; + h[k] = false; + return true; + }); + return w.create(b.map((k) => rb(k))); + }, gq = (a, b, c, d, e) => { + a = e.first(); + if (!a) + throw lc("The context is absent, it needs to be present to use idref function."); + if (!v(a.type, 53)) + throw mc("The context item is not a node, it needs to be node to use idref function."); + const f = b.h, h = d.O().reduce((k, l) => { + k[l.value] = true; + return k; + }, Object.create(null)); + for (b = a.value; b.node.nodeType !== 9; ) + if (b = x(f, b), b === null) + throw Error("FODC0001: the root node of the context node is not a document node."); + b = eq(f, b, (k) => k.node.nodeType !== 1 ? false : (k = gb(f, k, "idref")) ? k.split(/\s+/).some((l) => h[l]) : false); + return w.create(b.map((k) => rb(k))); + }; + function hq(a) { + switch (typeof a) { + case "object": + return Array.isArray(a) ? w.m(new pb(a.map((b) => Ra(hq(b))))) : a === null ? w.empty() : w.m(new ub(Object.keys(a).map((b) => ({key: g(b, 1), value: Ra(hq(a[b]))})))); + case "number": + return w.m(g(a, 3)); + case "string": + return w.m(g(a, 1)); + case "boolean": + return a ? w.aa() : w.V(); + default: + throw Error("Unexpected type in JSON parse"); + } + } + const iq = (a, b, c, d, e) => { + const f = w.m(g("duplicates", 1)); + a = tb(a, b, c, e, f); + const h = a.G() ? "use-first" : a.first().value; + return d.M((k) => w.m(new ub(k.reduce((l, n) => { + n.h.forEach((t) => { + const u = l.findIndex((y) => sb(y.key, t.key)); + if (0 <= u) + switch (h) { + case "reject": + throw Error("FOJS0003: Duplicate encountered when merging maps."); + case "use-last": + l.splice(u, 1, t); + return; + case "combine": + l.splice(u, 1, {key: t.key, value: Ra(w.create(l[u].value().O().concat(t.value().O())))}); + return; + default: + return; + } + l.push(t); + }); + return l; + }, [])))); + }; + function jq(a, b, c) { + let d = 1; + const e = a.value; + a = a.Pa(true); + let f = null; + const h = Math.max(b - 1, 0); + a !== -1 && (f = Math.max(0, (c === null ? a : Math.max(0, Math.min(a, c + (b - 1)))) - h)); + return w.create({next: (k) => { + for (; d < b; ) + e.next(k), d++; + if (c !== null && d >= b + c) + return p; + k = e.next(k); + d++; + return k; + }}, f); + } + function kq(a) { + return a.map((b) => v(b.type, 19) ? jd(b, 3) : b); + } + function lq(a) { + a = kq(a); + if (a.some((b) => Number.isNaN(b.value))) + return [g(NaN, 3)]; + a = qi(a); + if (!a) + throw Error("FORG0006: Incompatible types to be converted to a common type"); + return a; + } + const mq = (a, b, c, d, e, f) => A([e, f], ([h, k]) => { + if (h.value === Infinity) + return w.empty(); + if (h.value === -Infinity) + return k && k.value === Infinity ? w.empty() : d; + if (k) { + if (isNaN(k.value)) + return w.empty(); + k.value === Infinity && (k = null); + } + return isNaN(h.value) ? w.empty() : jq(d, Math.round(h.value), k ? Math.round(k.value) : null); + }), nq = (a, b, c, d, e) => { + if (d.G()) + return e; + a = kq(d.O()); + a = qi(a); + if (!a) + throw Error("FORG0006: Incompatible types to be converted to a common type"); + if (!a.every((f) => v(f.type, 2))) + throw Error("FORG0006: items passed to fn:sum are not all numeric."); + b = a.reduce((f, h) => f + h.value, 0); + return a.every((f) => v(f.type, 5)) ? w.m(g(b, 5)) : a.every((f) => v(f.type, 3)) ? w.m(g(b, 3)) : a.every((f) => v(f.type, 4)) ? w.m(g(b, 4)) : w.m(g(b, 6)); + }; + var oq = [].concat(pf, [{namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "boolean", j: [{type: 59, g: 2}], i: {type: 0, g: 3}, callFunction: (a, b, c, d) => d.fa() ? w.aa() : w.V()}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "true", j: [], i: {type: 0, g: 3}, callFunction: () => w.aa()}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "not", j: [{type: 59, g: 2}], i: {type: 0, g: 3}, callFunction: (a, b, c, d) => d.fa() === false ? w.aa() : w.V()}, { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "false", + j: [], + i: {type: 0, g: 3}, + callFunction: () => w.V() + }], [{namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "last", j: [], i: {type: 5, g: 3}, callFunction: (a) => { + if (a.N === null) + throw lc("The fn:last() function depends on dynamic context, which is absent."); + let b = false; + return w.create({next: () => { + if (b) + return p; + const c = a.za.Pa(); + b = true; + return q(g(c, 5)); + }}, 1); + }}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "position", j: [], i: {type: 5, g: 3}, callFunction: (a) => { + if (a.N === null) + throw lc("The fn:position() function depends on dynamic context, which is absent."); + return w.m(g(a.Fa + 1, 5)); + }}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "current-dateTime", j: [], i: {type: 10, g: 3}, callFunction: (a) => w.m(g(ec(a), 10))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "current-date", j: [], i: {type: 7, g: 3}, callFunction: (a) => w.m(g(Lb(ec(a), 7), 7))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "current-time", j: [], i: {type: 8, g: 3}, callFunction: (a) => w.m(g(Lb(ec(a), 8), 8))}, { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "implicit-timezone", + j: [], + i: {type: 17, g: 3}, + callFunction: (a) => w.m(g(fc(a), 17)) + }], vf, Df, Kf, [{namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "years-from-duration", j: [{type: 18, g: 0}], i: {type: 5, g: 0}, callFunction: (a, b, c, d) => d.G() ? d : w.m(g(d.first().value.ab(), 5))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "months-from-duration", j: [{type: 18, g: 0}], i: {type: 5, g: 0}, callFunction: (a, b, c, d) => d.G() ? d : w.m(g(d.first().value.$a(), 5))}, { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "days-from-duration", + j: [{type: 18, g: 0}], + i: {type: 5, g: 0}, + callFunction: (a, b, c, d) => d.G() ? d : w.m(g(d.first().value.Za(), 5)) + }, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "hours-from-duration", j: [{type: 18, g: 0}], i: {type: 5, g: 0}, callFunction: (a, b, c, d) => d.G() ? d : w.m(g(d.first().value.getHours(), 5))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "minutes-from-duration", j: [{type: 18, g: 0}], i: {type: 5, g: 0}, callFunction: (a, b, c, d) => d.G() ? d : w.m(g(d.first().value.getMinutes(), 5))}, { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "seconds-from-duration", + j: [{type: 18, g: 0}], + i: {type: 4, g: 0}, + callFunction: (a, b, c, d) => d.G() ? d : w.m(g(d.first().value.getSeconds(), 4)) + }], Mf, [{namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "id", j: [{type: 1, g: 2}, {type: 53, g: 3}], i: {type: 54, g: 2}, callFunction: fq}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "id", j: [{type: 1, g: 2}], i: {type: 54, g: 2}, callFunction(a, b, c, d) { + return fq(a, b, c, d, w.m(a.N)); + }}, { + namespaceURI: "http://www.w3.org/2005/xpath-functions", + localName: "idref", + j: [{type: 1, g: 2}, {type: 53, g: 3}], + i: {type: 53, g: 2}, + callFunction: gq + }, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "idref", j: [{type: 1, g: 2}], i: {type: 53, g: 2}, callFunction(a, b, c, d) { + return gq(a, b, c, d, w.m(a.N)); + }}], [{namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "parse-json", j: [{type: 1, g: 3}], i: {type: 59, g: 0}, callFunction: (a, b, c, d) => { + let e; + try { + e = JSON.parse(d.first().value); + } catch (f) { + throw Error("FOJS0001: parsed JSON string contains illegal JSON."); + } + return hq(e); + }}], [{ + namespaceURI: "http://www.w3.org/2005/xpath-functions/map", + localName: "contains", + j: [{type: 61, g: 3}, {type: 46, g: 3}], + i: {type: 0, g: 3}, + callFunction: (a, b, c, d, e) => A([d, e], ([f, h]) => f.h.some((k) => sb(k.key, h)) ? w.aa() : w.V()) + }, {namespaceURI: "http://www.w3.org/2005/xpath-functions/map", localName: "entry", j: [{type: 46, g: 3}, {type: 59, g: 2}], i: {type: 61, g: 3}, callFunction: (a, b, c, d, e) => d.map((f) => new ub([{key: f, value: Ra(e)}]))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/map", localName: "for-each", j: [{type: 61, g: 3}, {type: 59, g: 2}], i: {type: 59, g: 2}, callFunction: (a, b, c, d, e) => A([ + d, + e + ], ([f, h]) => jc(f.h.map((k) => h.value.call(void 0, a, b, c, w.m(k.key), k.value()))))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/map", localName: "get", j: [{type: 61, g: 3}, {type: 46, g: 3}], i: {type: 59, g: 2}, callFunction: tb}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/map", localName: "keys", j: [{type: 61, g: 3}], i: {type: 46, g: 2}, callFunction: (a, b, c, d) => A([d], ([e]) => w.create(e.h.map((f) => f.key)))}, { + namespaceURI: "http://www.w3.org/2005/xpath-functions/map", + localName: "merge", + j: [{type: 61, g: 2}, {type: 61, g: 3}], + i: {type: 61, g: 3}, + callFunction: iq + }, {namespaceURI: "http://www.w3.org/2005/xpath-functions/map", localName: "merge", j: [{type: 61, g: 2}], i: {type: 61, g: 3}, callFunction(a, b, c, d) { + return iq(a, b, c, d, w.m(new ub([{key: g("duplicates", 1), value: () => w.m(g("use-first", 1))}]))); + }}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/map", localName: "put", j: [{type: 61, g: 3}, {type: 46, g: 3}, {type: 59, g: 2}], i: {type: 61, g: 3}, callFunction: (a, b, c, d, e, f) => A([d, e], ([h, k]) => { + h = h.h.concat(); + const l = h.findIndex((n) => sb(n.key, k)); + 0 <= l ? h.splice(l, 1, {key: k, value: Ra(f)}) : h.push({key: k, value: Ra(f)}); + return w.m(new ub(h)); + })}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/map", localName: "remove", j: [{type: 61, g: 3}, {type: 46, g: 2}], i: {type: 61, g: 3}, callFunction: (a, b, c, d, e) => A([d], ([f]) => { + const h = f.h.concat(); + return e.M((k) => { + k.forEach((l) => { + const n = h.findIndex((t) => sb(t.key, l)); + 0 <= n && h.splice(n, 1); + }); + return w.m(new ub(h)); + }); + })}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/map", localName: "size", j: [{type: 61, g: 3}], i: {type: 5, g: 3}, callFunction: (a, b, c, d) => d.map((e) => g(e.h.length, 5))}], [{namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "pi", j: [], i: {type: 3, g: 3}, callFunction: () => w.m(g(Math.PI, 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "exp", j: [{type: 3, g: 0}], i: {type: 3, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(Math.pow(Math.E, e.value), 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "exp10", j: [{type: 3, g: 0}], i: {type: 3, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(Math.pow(10, e.value), 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "log", j: [{type: 3, g: 0}], i: {type: 3, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(Math.log(e.value), 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "log10", j: [{type: 3, g: 0}], i: {type: 3, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(Math.log10(e.value), 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "pow", j: [{type: 3, g: 0}, {type: 2, g: 3}], i: {type: 3, g: 0}, callFunction: (a, b, c, d, e) => e.M(([f]) => d.map((h) => Math.abs(h.value) !== 1 || Number.isFinite(f.value) ? g(Math.pow(h.value, f.value), 3) : g(1, 3)))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "sqrt", j: [{type: 3, g: 0}], i: {type: 3, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(Math.sqrt(e.value), 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "sin", j: [{type: 3, g: 0}], i: {type: 3, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(Math.sin(e.value), 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "cos", j: [{ + type: 3, + g: 0 + }], i: {type: 3, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(Math.cos(e.value), 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "tan", j: [{type: 3, g: 0}], i: {type: 3, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(Math.tan(e.value), 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "asin", j: [{type: 3, g: 0}], i: {type: 3, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(Math.asin(e.value), 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "acos", j: [{ + type: 3, + g: 0 + }], i: {type: 3, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(Math.acos(e.value), 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "atan", j: [{type: 3, g: 0}], i: {type: 3, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(Math.atan(e.value), 3))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions/math", localName: "atan2", j: [{type: 3, g: 0}, {type: 3, g: 3}], i: {type: 3, g: 0}, callFunction: (a, b, c, d, e) => e.M(([f]) => d.map((h) => g(Math.atan2(h.value, f.value), 3)))}], je, Md, [{ + namespaceURI: "http://fontoxpath/operators", + localName: "to", + j: [{type: 5, g: 0}, {type: 5, g: 0}], + i: {type: 5, g: 2}, + callFunction: (a, b, c, d, e) => { + a = d.first(); + e = e.first(); + if (a === null || e === null) + return w.empty(); + let f = a.value; + e = e.value; + return f > e ? w.empty() : w.create({next: () => q(g(f++, 5))}, e - f + 1); + } + }], [{namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "QName", j: [{type: 1, g: 0}, {type: 1, g: 3}], i: {type: 23, g: 3}, callFunction: (a, b, c, d, e) => A([d, e], ([f, h]) => { + h = h.value; + if (!tc(h, 23)) + throw Error("FOCA0002: The provided QName is invalid."); + f = f ? f.value || null : null; + if (f === null && h.includes(":")) + throw Error("FOCA0002: The URI of a QName may not be empty if a prefix is provided."); + if (d.G()) + return w.m(g(new Ta("", null, h), 23)); + if (!h.includes(":")) + return w.m(g(new Ta("", f, h), 23)); + const [k, l] = h.split(":"); + return w.m(g(new Ta(k, f, l), 23)); + })}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "prefix-from-QName", j: [{type: 23, g: 0}], i: {type: 24, g: 0}, callFunction: (a, b, c, d) => A([d], ([e]) => { + if (e === null) + return w.empty(); + e = e.value; + return e.prefix ? w.m(g(e.prefix, 24)) : w.empty(); + })}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "local-name-from-QName", j: [{type: 23, g: 0}], i: {type: 24, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(e.value.localName, 24))}, {namespaceURI: "http://www.w3.org/2005/xpath-functions", localName: "namespace-uri-from-QName", j: [{type: 23, g: 0}], i: {type: 20, g: 0}, callFunction: (a, b, c, d) => d.map((e) => g(e.value.namespaceURI || "", 20))}], [{ + j: [{type: 59, g: 2}], + callFunction: (a, b, c, d) => d.Y({empty: () => w.aa(), multiple: () => w.V(), m: () => w.V()}), + localName: "empty", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 0, g: 3} + }, {j: [{type: 59, g: 2}], callFunction: (a, b, c, d) => d.Y({empty: () => w.V(), multiple: () => w.aa(), m: () => w.aa()}), localName: "exists", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 0, g: 3}}, {j: [{type: 59, g: 2}], callFunction: (a, b, c, d) => jq(d, 1, 1), localName: "head", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 59, g: 0}}, { + j: [{type: 59, g: 2}], + callFunction: (a, b, c, d) => jq(d, 2, null), + localName: "tail", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 59, g: 2} + }, {j: [{type: 59, g: 2}, {type: 5, g: 3}, {type: 59, g: 2}], callFunction: (a, b, c, d, e, f) => { + if (d.G()) + return f; + if (f.G()) + return d; + a = d.O(); + e = e.first().value - 1; + 0 > e ? e = 0 : e > a.length && (e = a.length); + b = a.slice(e); + return w.create(a.slice(0, e).concat(f.O(), b)); + }, localName: "insert-before", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 59, g: 2}}, { + j: [{type: 59, g: 2}, {type: 5, g: 3}], + callFunction: (a, b, c, d, e) => { + a = e.first().value; + d = d.O(); + if (!d.length || 1 > a || a > d.length) + return w.create(d); + d.splice(a - 1, 1); + return w.create(d); + }, + localName: "remove", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 59, g: 2} + }, {j: [{type: 59, g: 2}], callFunction: (a, b, c, d) => d.M((e) => w.create(e.reverse())), localName: "reverse", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 59, g: 2}}, {j: [{type: 59, g: 2}, {type: 3, g: 3}], callFunction: (a, b, c, d, e) => mq(a, b, c, d, e, w.empty()), localName: "subsequence", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 59, g: 2}}, { + j: [{type: 59, g: 2}, {type: 3, g: 3}, {type: 3, g: 3}], + callFunction: mq, + localName: "subsequence", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 59, g: 2} + }, {j: [{type: 59, g: 2}], callFunction: (a, b, c, d) => d, localName: "unordered", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 59, g: 2}}, {j: [{type: 46, g: 2}], callFunction: (a, b, c, d) => { + const e = qc(d, b).O(); + return w.create(e).filter((f, h) => e.slice(0, h).every((k) => !me(f, k))); + }, localName: "distinct-values", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 46, g: 2}}, {j: [{type: 46, g: 2}, {type: 1, g: 3}], callFunction() { + throw Error("FOCH0002: No collations are supported"); + }, localName: "distinct-values", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 46, g: 2}}, {j: [{type: 46, g: 2}, {type: 46, g: 3}], callFunction: (a, b, c, d, e) => e.M(([f]) => qc(d, b).map((h, k) => Xh("eqOp", h.type, f.type)(h, f, a) ? g(k + 1, 5) : g(-1, 5)).filter((h) => h.value !== -1)), localName: "index-of", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 5, g: 2}}, { + j: [{type: 46, g: 2}, {type: 46, g: 3}, {type: 1, g: 3}], + callFunction() { + throw Error("FOCH0002: No collations are supported"); + }, + localName: "index-of", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 5, g: 2} + }, {j: [{type: 59, g: 2}, {type: 59, g: 2}], callFunction: (a, b, c, d, e) => { + let f = false; + const h = pe(a, b, c, d, e); + return w.create({next: () => { + if (f) + return p; + const k = h.next(0); + if (k.done) + return k; + f = true; + return q(g(k.value, 0)); + }}); + }, localName: "deep-equal", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 0, g: 3}}, { + j: [{type: 59, g: 2}, {type: 59, g: 2}, {type: 1, g: 3}], + callFunction() { + throw Error("FOCH0002: No collations are supported"); + }, + localName: "deep-equal", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 0, g: 3} + }, {j: [{type: 59, g: 2}], callFunction: (a, b, c, d) => { + let e = false; + return w.create({next: () => { + if (e) + return p; + const f = d.Pa(); + e = true; + return q(g(f, 5)); + }}); + }, localName: "count", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 5, g: 3}}, {j: [{type: 46, g: 2}], callFunction: (a, b, c, d) => { + if (d.G()) + return d; + a = kq(d.O()); + a = qi(a); + if (!a) + throw Error("FORG0006: Incompatible types to be converted to a common type"); + if (!a.every((e) => v(e.type, 2))) + throw Error("FORG0006: items passed to fn:avg are not all numeric."); + b = a.reduce((e, f) => e + f.value, 0) / a.length; + return a.every((e) => v(e.type, 5) || v(e.type, 3)) ? w.m(g(b, 3)) : a.every((e) => v(e.type, 4)) ? w.m(g(b, 4)) : w.m(g(b, 6)); + }, localName: "avg", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 46, g: 0}}, {j: [{type: 46, g: 2}], callFunction: (a, b, c, d) => { + if (d.G()) + return d; + a = lq(d.O()); + return w.m(a.reduce((e, f) => e.value < f.value ? f : e)); + }, localName: "max", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 46, g: 0}}, {j: [{type: 46, g: 2}, {type: 1, g: 3}], callFunction() { + throw Error("FOCH0002: No collations are supported"); + }, localName: "max", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 46, g: 0}}, {j: [{type: 46, g: 2}], callFunction: (a, b, c, d) => { + if (d.G()) + return d; + a = lq(d.O()); + return w.m(a.reduce((e, f) => e.value > f.value ? f : e)); + }, localName: "min", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 46, g: 0}}, {j: [{type: 46, g: 2}, {type: 1, g: 3}], callFunction() { + throw Error("FOCH0002: No collations are supported"); + }, localName: "min", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 46, g: 0}}, {j: [{ + type: 46, + g: 2 + }], callFunction: (a, b, c, d) => nq(a, b, c, d, w.m(g(0, 5))), localName: "sum", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 46, g: 3}}, {j: [{type: 46, g: 2}, {type: 46, g: 0}], callFunction: nq, localName: "sum", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 46, g: 0}}, { + j: [{type: 59, g: 2}], + callFunction: (a, b, c, d) => { + if (!d.G() && !d.sa()) + throw Error("FORG0003: The argument passed to fn:zero-or-one contained more than one item."); + return d; + }, + localName: "zero-or-one", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 59, g: 0} + }, {j: [{type: 59, g: 2}], callFunction: (a, b, c, d) => { + if (d.G()) + throw Error("FORG0004: The argument passed to fn:one-or-more was empty."); + return d; + }, localName: "one-or-more", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 59, g: 1}}, {j: [{type: 59, g: 2}], callFunction: (a, b, c, d) => { + if (!d.sa()) + throw Error("FORG0005: The argument passed to fn:exactly-one is empty or contained more than one item."); + return d; + }, localName: "exactly-one", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: { + type: 59, + g: 3 + }}, { + j: [{type: 59, g: 2}, {type: 60, g: 3}], + callFunction: (a, b, c, d, e) => { + if (d.G()) + return d; + const f = e.first(), h = f.o; + if (h.length !== 1) + throw Error("XPTY0004: signature of function passed to fn:filter is incompatible."); + return d.filter((k) => { + k = Ad(h[0], w.m(k), b, "fn:filter", false); + k = f.value.call(void 0, a, b, c, k); + if (!k.sa() || !v(k.first().type, 0)) + throw Error("XPTY0004: signature of function passed to fn:filter is incompatible."); + return k.first().value; + }); + }, + localName: "filter", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 59, g: 2} + }, { + j: [{type: 59, g: 2}, {type: 60, g: 3}], + callFunction: (a, b, c, d, e) => { + if (d.G()) + return d; + const f = e.first(), h = f.o; + if (h.length !== 1) + throw Error("XPTY0004: signature of function passed to fn:for-each is incompatible."); + const k = d.value; + let l; + return w.create({next: (n) => { + for (; ; ) { + if (!l) { + var t = k.next(0); + if (t.done) + return t; + t = Ad(h[0], w.m(t.value), b, "fn:for-each", false); + l = f.value.call(void 0, a, b, c, t).value; + } + t = l.next(n); + if (!t.done) + return t; + l = null; + } + }}); + }, + localName: "for-each", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {type: 59, g: 2} + }, {j: [{type: 59, g: 2}, {type: 59, g: 2}, {type: 60, g: 3}], callFunction: (a, b, c, d, e, f) => { + if (d.G()) + return d; + const h = f.first(), k = h.o; + if (k.length !== 2) + throw Error("XPTY0004: signature of function passed to fn:fold-left is incompatible."); + return d.M((l) => l.reduce((n, t) => { + n = Ad(k[0], n, b, "fn:fold-left", false); + t = Ad(k[1], w.m(t), b, "fn:fold-left", false); + return h.value.call(void 0, a, b, c, n, t); + }, e)); + }, localName: "fold-left", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 59, g: 2}}, {j: [{type: 59, g: 2}, { + type: 59, + g: 2 + }, {type: 60, g: 3}], callFunction: (a, b, c, d, e, f) => { + if (d.G()) + return d; + const h = f.first(), k = h.o; + if (k.length !== 2) + throw Error("XPTY0004: signature of function passed to fn:fold-right is incompatible."); + return d.M((l) => l.reduceRight((n, t) => { + n = Ad(k[0], n, b, "fn:fold-right", false); + t = Ad(k[1], w.m(t), b, "fn:fold-right", false); + return h.value.call(void 0, a, b, c, t, n); + }, e)); + }, localName: "fold-right", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 59, g: 2}}, {j: [{type: 59, g: 2}], callFunction: (a, b, c, d) => { + if (!b.Ua) + throw Error("serialize() called but no xmlSerializer set in execution parameters."); + a = d.O(); + if (!a.every((e) => v(e.type, 53))) + throw Error("Expected argument to fn:serialize to resolve to a sequence of Nodes."); + return w.m(g(a.map((e) => b.Ua.serializeToString(If(e.value, b, false))).join(""), 1)); + }, localName: "serialize", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 1, g: 3}}], Yd, [{ + j: [{type: 59, g: 3}, {type: 61, g: 3}], + callFunction: (a, b, c, d, e) => { + let f, h; + return w.create({next: () => { + f || ({fc: f, cc: h} = dq(d, e, c, b)); + try { + return f.next(0); + } catch (k) { + Pf(h.value, k); + } + }}); + }, + localName: "evaluate", + namespaceURI: "http://fontoxml.com/fontoxpath", + i: {type: 59, g: 2} + }, {j: [], callFunction: () => w.m(g(VERSION, 1)), localName: "version", namespaceURI: "http://fontoxml.com/fontoxpath", i: {type: 1, g: 3}}], [{ + j: [{type: 23, g: 3}, {type: 5, g: 3}], + callFunction: (a, b, c, d, e) => A([d, e], ([f, h]) => { + const k = c.ta(f.value.namespaceURI, f.value.localName, h.value); + if (k === null) + return w.empty(); + f = new Va({j: k.j, arity: h.value, localName: f.value.localName, namespaceURI: f.value.namespaceURI, i: k.i, value: k.callFunction}); + return w.m(f); + }), + localName: "function-lookup", + namespaceURI: "http://www.w3.org/2005/xpath-functions", + i: {g: 0, type: 60} + }, {j: [{type: 60, g: 3}], callFunction: (a, b, c, d) => A([d], ([e]) => e.Xa() ? w.empty() : w.m(g(new Ta("", e.l, e.D), 23))), localName: "function-name", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 23, g: 0}}, {j: [{type: 60, g: 3}], callFunction: (a, b, c, d) => A([d], ([e]) => w.m(g(e.v, 5))), localName: "function-arity", namespaceURI: "http://www.w3.org/2005/xpath-functions", i: {type: 5, g: 3}}]); + class pq { + constructor(a) { + this.h = a; + } + createAttributeNS(a, b) { + return this.h.createAttributeNS(a, b); + } + createCDATASection(a) { + return this.h.createCDATASection(a); + } + createComment(a) { + return this.h.createComment(a); + } + createDocument() { + return this.h.createDocument(); + } + createElementNS(a, b) { + return this.h.createElementNS(a, b); + } + createProcessingInstruction(a, b) { + return this.h.createProcessingInstruction(a, b); + } + createTextNode(a) { + return this.h.createTextNode(a); + } + } + var qq = Symbol("IS_XPATH_VALUE_SYMBOL"); + function rq(a) { + return (b, c) => { + b = Yb(new nb(c === null ? new Za() : c), b, Ja(a)); + return {[qq]: true, xb: b}; + }; + } + oq.forEach((a) => { + Wf(a.namespaceURI, a.localName, a.j, a.i, a.callFunction); + }); + function sq(a) { + return a && typeof a === "object" && "lookupNamespaceURI" in a ? (b) => a.lookupNamespaceURI(b || null) : () => null; + } + function tq(a) { + return ({prefix: b, localName: c}) => b ? null : {namespaceURI: a, localName: c}; + } + function uq(a, b, c, d, e, f) { + if (d === null || d === void 0) + d = d || {}; + const h = e ? {ib: e.logger || {trace: console.log.bind(console)}, Ma: e.documentWriter, jb: e.moduleImports, Ab: e.namespaceResolver, Zb: e.functionNameResolver, Ia: e.nodesFactory, Ua: e.xmlSerializer} : {ib: {trace: console.log.bind(console)}, jb: {}, Ab: null, Ia: null, Ma: null, Ua: null}, k = new nb(c === null ? new Za() : c); + c = h.jb || Object.create(null); + var l = e.defaultFunctionNamespaceURI === void 0 ? "http://www.w3.org/2005/xpath-functions" : e.defaultFunctionNamespaceURI; + const n = bq(a, f, h.Ab || sq(b), d, c, l, h.Zb || tq(l)); + a = b ? Zb(k, b) : w.empty(); + b = !h.Ia && f.Z ? new Ie(b) : new pq(h.Ia); + c = h.Ma ? new bb(h.Ma) : ab; + l = h.Ua; + const t = Object.keys(d).reduce((z, F) => { + const O = d[F]; + z[`Q{}${F}[0]`] = O && typeof O === "object" && qq in O ? () => w.create(O.xb) : () => Zb(k, d[F]); + return z; + }, Object.create(null)); + let u; + for (const z of Object.keys(n.ga.Da)) + t[z] || (t[z] = () => (0, n.ga.Da[z])(u, y)); + u = new cc({N: a.first(), Fa: 0, za: a, wa: t}); + const y = new ic(f.debug, f.Ga, k, b, c, e.currentContext, new Map(), h.ib, l); + return {rb: u, sb: y, ba: n.ba}; + } + function vq(a, b) { + const c = {}; + let d = 0, e = false, f = null; + return {next: () => { + if (e) + return p; + for (; d < a.h.length; ) { + const k = a.h[d].key.value; + if (!f) { + const l = a.h[d]; + var h = l.value().Y({default: (n) => n, multiple: () => { + throw Error(`Serialization error: The value of an entry in a map is expected to be a single item or an empty sequence. Use arrays when putting multiple values in a map. The value of the key ${l.key.value} holds multiple items`); + }}).first(); + if (h === null) { + c[k] = null; + d++; + continue; + } + f = wq(h, b); + } + h = f.next(0); + f = null; + c[k] = h.value; + d++; + } + e = true; + return q(c); + }}; + } + function xq(a, b) { + const c = []; + let d = 0, e = false, f = null; + return {next: () => { + if (e) + return p; + for (; d < a.h.length; ) { + if (!f) { + var h = a.h[d]().Y({default: (k) => k, multiple: () => { + throw Error("Serialization error: The value of an entry in an array is expected to be a single item or an empty sequence. Use nested arrays when putting multiple values in an array."); + }}).first(); + if (h === null) { + c[d++] = null; + continue; + } + f = wq(h, b); + } + h = f.next(0); + f = null; + c[d++] = h.value; + } + e = true; + return q(c); + }}; + } + function wq(a, b) { + if (v(a.type, 61)) + return vq(a, b); + if (v(a.type, 62)) + return xq(a, b); + if (v(a.type, 23)) { + const c = a.value; + return {next: () => q(`Q{${c.namespaceURI || ""}}${c.localName}`)}; + } + switch (a.type) { + case 7: + case 8: + case 9: + case 11: + case 12: + case 13: + case 14: + case 15: + const c = a.value; + return {next: () => q(Mb(c))}; + case 47: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + const d = a.value; + return {next: () => q(If(d, b, false))}; + default: + return {next: () => q(a.value)}; + } + } + var yq = {ANY: 0, NUMBER: 1, STRING: 2, BOOLEAN: 3, NODES: 7, FIRST_NODE: 9, STRINGS: 10, MAP: 11, ARRAY: 12, NUMBERS: 13, ALL_RESULTS: 14, ASYNC_ITERATOR: 99}; + yq[yq.ANY] = "ANY"; + yq[yq.NUMBER] = "NUMBER"; + yq[yq.STRING] = "STRING"; + yq[yq.BOOLEAN] = "BOOLEAN"; + yq[yq.NODES] = "NODES"; + yq[yq.FIRST_NODE] = "FIRST_NODE"; + yq[yq.STRINGS] = "STRINGS"; + yq[yq.MAP] = "MAP"; + yq[yq.ARRAY] = "ARRAY"; + yq[yq.NUMBERS] = "NUMBERS"; + yq[yq.ALL_RESULTS] = "ALL_RESULTS"; + yq[yq.ASYNC_ITERATOR] = "ASYNC_ITERATOR"; + function zq(a, b, c, d) { + switch (c) { + case 3: + return b.fa(); + case 2: + return b = qc(b, d).O(), b.length ? b.map((l) => jd(l, 1).value).join(" ") : ""; + case 10: + return b = qc(b, d).O(), b.length ? b.map((l) => l.value + "") : []; + case 1: + return b = b.first(), b !== null && v(b.type, 2) ? b.value : NaN; + case 9: + b = b.first(); + if (b === null) + return null; + if (!v(b.type, 53)) + throw Error("Expected XPath " + Nf(a) + " to resolve to Node. Got " + Ea[b.type]); + return If(b.value, d, false); + case 7: + b = b.O(); + if (!b.every((l) => v(l.type, 53))) + throw Error("Expected XPath " + Nf(a) + " to resolve to a sequence of Nodes."); + return b.map((l) => If(l.value, d, false)); + case 11: + b = b.O(); + if (b.length !== 1) + throw Error("Expected XPath " + Nf(a) + " to resolve to a single map."); + b = b[0]; + if (!v(b.type, 61)) + throw Error("Expected XPath " + Nf(a) + " to resolve to a map"); + return vq(b, d).next(0).value; + case 12: + b = b.O(); + if (b.length !== 1) + throw Error("Expected XPath " + Nf(a) + " to resolve to a single array."); + b = b[0]; + if (!v(b.type, 62)) + throw Error("Expected XPath " + Nf(a) + " to resolve to an array"); + return xq(b, d).next(0).value; + case 13: + return b.O().map((l) => { + if (!v(l.type, 2)) + throw Error("Expected XPath " + Nf(a) + " to resolve to numbers"); + return l.value; + }); + case 99: + const e = b.value; + let f = null, h = false; + const k = () => { + for (; !h; ) { + if (!f) { + var l = e.next(0); + if (l.done) { + h = true; + break; + } + f = wq(l.value, d); + } + l = f.next(0); + f = null; + return l; + } + return Promise.resolve({done: true, value: null}); + }; + return "asyncIterator" in Symbol ? {[Symbol.asyncIterator]() { + return this; + }, next: () => new Promise((l) => l(k())).catch((l) => { + Pf(a, l); + })} : {next: () => new Promise((l) => l(k()))}; + case 14: + return b.O().map((l) => wq(l, d).next(0).value); + default: + return b = b.O(), b.every((l) => v(l.type, 53) && !v(l.type, 47)) ? (b = b.map((l) => If(l.value, d, false)), b.length === 1 ? b[0] : b) : b.length === 1 ? (b = b[0], v(b.type, 62) ? xq(b, d).next(0).value : v(b.type, 61) ? vq(b, d).next(0).value : pc(b, d).first().value) : qc(w.create(b), d).O().map((l) => l.value); + } + } + let Aq = false, Bq = null; + var Cq = {getPerformanceSummary() { + const a = Bq.getEntriesByType("measure").filter((b) => b.name.startsWith("XPath: ")); + return Array.from(a.reduce((b, c) => { + var d = c.name.substring(7); + b.has(d) ? (d = b.get(d), d.times += 1, d.totalDuration += c.duration) : b.set(d, {xpath: d, times: 1, totalDuration: c.duration, average: 0}); + return b; + }, new Map()).values()).map((b) => { + b.average = b.totalDuration / b.times; + return b; + }).sort((b, c) => c.totalDuration - b.totalDuration); + }, setPerformanceImplementation(a) { + Bq = a; + }, startProfiling() { + if (Bq === null) + throw Error("Performance API object must be set using `profiler.setPerformanceImplementation` before starting to profile"); + Bq.clearMarks(); + Bq.clearMeasures(); + Aq = true; + }, stopProfiling() { + Aq = false; + }}; + let Dq = 0; + var Eq = {XPATH_3_1_LANGUAGE: "XPath3.1", XQUERY_3_1_LANGUAGE: "XQuery3.1", XQUERY_UPDATE_3_1_LANGUAGE: "XQueryUpdate3.1"}; + const Fq = (a, b, c, d, e, f) => { + e = e || 0; + if (!a || typeof a !== "string" && !("nodeType" in a)) + throw new TypeError("Failed to execute 'evaluateXPath': xpathExpression must be a string or an element depicting an XQueryX DOM tree."); + f = f || {}; + let h, k; + try { + const n = uq(a, b, c || null, d || {}, f, {qa: f.language === "XQueryUpdate3.1", Z: f.language === "XQuery3.1" || f.language === "XQueryUpdate3.1", debug: !!f.debug, Ga: !!f.disableCache}); + var l = n.rb; + h = n.sb; + k = n.ba; + } catch (n) { + Pf(a, n); + } + if (k.J) + throw Error("XUST0001: Updating expressions should be evaluated as updating expressions"); + if (e === 3 && b && typeof b === "object" && "nodeType" in b && (c = k.D(), b = Ya(b), c !== null && !b.includes(c))) + return false; + try { + b = a; + Aq && (typeof b !== "string" && (b = Nf(b)), Bq.mark(`${b}${Dq === 0 ? "" : "@" + Dq}`), Dq++); + const n = B(k, l, h), t = zq(a, n, e, h); + e = a; + Aq && (typeof e !== "string" && (e = Nf(e)), Dq--, l = `${e}${Dq === 0 ? "" : "@" + Dq}`, Bq.measure(`XPath: ${e}`, l), Bq.clearMarks(l)); + return t; + } catch (n) { + Pf(a, n); + } + }; + Object.assign(Fq, {hc: 14, ANY_TYPE: 0, Ib: 12, Jb: 99, BOOLEAN_TYPE: 3, Lb: 9, Ob: 11, Qb: 7, Rb: 13, NUMBER_TYPE: 1, Sb: 10, STRING_TYPE: 2, ic: "XPath3.1", jc: "XQuery3.1", Vb: "XQueryUpdate3.1"}); + Object.assign(Fq, {ALL_RESULTS_TYPE: 14, ANY_TYPE: 0, ARRAY_TYPE: 12, ASYNC_ITERATOR_TYPE: 99, BOOLEAN_TYPE: 3, FIRST_NODE_TYPE: 9, MAP_TYPE: 11, NODES_TYPE: 7, NUMBERS_TYPE: 13, NUMBER_TYPE: 1, STRINGS_TYPE: 10, STRING_TYPE: 2, XPATH_3_1_LANGUAGE: "XPath3.1", XQUERY_3_1_LANGUAGE: "XQuery3.1", XQUERY_UPDATE_3_1_LANGUAGE: "XQueryUpdate3.1"}); + function Gq(a, b, c, d, e) { + return Fq(a, b, c, d, Fq.Jb, e); + } + function Hq(a, b, c, d) { + return {pendingUpdateList: a.da.map((e) => e.h(d)), xdmValue: zq(b, w.create(a.I), c, d)}; + } + async function Iq(a, b, c, d, e) { + e = e || {}; + tk(); + let f, h; + try { + const n = uq(a, b, c || null, d || {}, e || {}, {qa: true, Z: true, debug: !!e.debug, Ga: !!e.disableCache}); + var k = n.rb; + f = n.sb; + h = n.ba; + } catch (n) { + Pf(a, n); + } + if (!h.J) { + k = []; + a = Gq(a, b, c, d, Object.assign(Object.assign({}, e), {language: "XQueryUpdate3.1"})); + for (b = await a.next(); !b.done; b = await a.next()) + k.push(b.value); + return Promise.resolve({pendingUpdateList: [], xdmValue: k}); + } + let l; + try { + l = h.s(k, f).next(0); + } catch (n) { + Pf(a, n); + } + return Hq(l.value, a, e.returnType, f); + } + function Jq(a, b, c, d, e) { + e = e || {}; + tk(); + let f, h, k; + try { + const n = uq(a, b, c || null, d || {}, e || {}, {qa: true, Z: true, debug: !!e.debug, Ga: !!e.disableCache}); + f = n.rb; + h = n.sb; + k = n.ba; + } catch (n) { + Pf(a, n); + } + if (!k.J) + return {pendingUpdateList: [], xdmValue: Fq(a, b, c, d, e.i, Object.assign(Object.assign({}, e), {language: Fq.Vb}))}; + let l; + try { + l = k.s(f, h).next(0); + } catch (n) { + Pf(a, n); + } + return Hq(l.value, a, e.returnType, h); + } + function Kq(a, b, c, d, e) { + return Fq(a, b, c, d, Fq.Ib, e); + } + function Lq(a, b, c, d, e) { + return Fq(a, b, c, d, Fq.BOOLEAN_TYPE, e); + } + function Mq(a, b, c, d, e) { + return Fq(a, b, c, d, Fq.Lb, e); + } + function Nq(a, b, c, d, e) { + return Fq(a, b, c, d, Fq.Ob, e); + } + function Oq(a, b, c, d, e) { + return Fq(a, b, c, d, Fq.Qb, e); + } + function Pq(a, b, c, d, e) { + return Fq(a, b, c, d, Fq.NUMBER_TYPE, e); + } + function Qq(a, b, c, d, e) { + return Fq(a, b, c, d, Fq.Rb, e); + } + function Rq(a, b, c, d, e) { + return Fq(a, b, c, d, Fq.STRING_TYPE, e); + } + function Sq(a, b, c, d, e) { + return Fq(a, b, c, d, Fq.Sb, e); + } + function Tq(a, b, c, d) { + b = new nb(b ? b : new Za()); + d = d ? new bb(d) : ab; + c = c ? c = new pq(c) : null; + a = a.map(yj); + Se(a, b, c, d); + } + function X(a, b, c) { + return {code: a, ra: b, H: c, isAstAccepted: true}; + } + function Uq(a) { + return {isAstAccepted: false, reason: a}; + } + function Y(a, b) { + return a.isAstAccepted ? b(a) : a; + } + function Vq(a, b) { + return a.isAstAccepted ? b(a) : [a, null]; + } + function Wq(a, b, c) { + return Y(a, (d) => { + switch (d.ra.type) { + case 0: + return d; + case 1: + return Y(Xq(c, d, "nodes"), (e) => Y(Xq(c, b, "contextItem"), (f) => X(`(function () { + const { done, value } = ${e.code}(${f.code}).next(); + return done ? null : value; + })()`, {type: 0}, [...e.H, ...f.H]))); + default: + throw Error(`invalid generated code type to convert to value: ${d.ra.type}`); + } + }); + } + function Yq(a, b, c, d) { + a = Wq(a, c, d); + return b && b.type === 0 && b.g === 3 ? a : Y(a, (e) => X(`!!${e.code}`, {type: 0}, e.H)); + } + function Zq(a, b, c) { + return b ? a.isAstAccepted && a.ra.type !== 0 ? Uq("Atomization only implemented for single value") : v(b.type, 1) ? a : v(b.type, 47) ? Y(Xq(c, a, "attr"), (d) => X(`(${d.code} ? domFacade.getData(${d.code}) : null)`, {type: 0}, d.H)) : Uq("Atomization only implemented for string and attribute") : Uq("Can not atomize value if type was not annotated"); + } + function $q(a, b, c, d) { + a = Wq(a, c, d); + d = Zq(a, b, d); + return zc(b) ? Y(d, (e) => X(`${e.code} ?? ''`, {type: 0}, e.H)) : d; + } + function ar(a, b, c) { + return Y(Xq(c, a, "node"), (d) => d.ra.type === 1 ? d : b && !v(b.type, 53) ? Uq("Can not evaluate to node if expression does not result in nodes") : X(`(function () { + if (${d.code} !== null && !${d.code}.nodeType) { + throw new Error('XPDY0050: The result of the expression was not a node'); + } + return ${d.code}; + })()`, {type: 0}, d.H)); + } + function br(a, b, c, d) { + return Y(a, (e) => { + switch (e.ra.type) { + case 1: + return Y(Xq(d, e, "nodes"), (f) => Y(Xq(d, c, "contextItem"), (h) => X(`Array.from(${f.code}(${h.code}))`, {type: 0}, [...f.H, ...h.H]))); + case 0: + return Y(Xq(d, ar(e, b, d), "node"), (f) => X(`(${f.code} === null ? [] : [${f.code}])`, {type: 0}, f.H)); + default: + return Uq("Unsupported code type to evaluate to nodes"); + } + }); + } + function cr(a, b) { + return Y(a, (c) => Y(b, (d) => { + if (c.ra.type !== 0 || d.ra.type !== 0) + throw Error("can only use emitAnd with value expressions"); + return X(`${c.code} && ${d.code}`, {type: 0}, [...c.H, ...d.H]); + })); + } + function dr(a, b, c, d) { + return (a = J(a, [b, "*"])) ? d.h(a, c, d) : [Uq(`${b} expression not found`), null]; + } + const Ct = {equalOp: "eqOp", notEqualOp: "neOp", lessThanOrEqualOp: "leOp", lessThanOp: "ltOp", greaterThanOrEqualOp: "geOp", greaterThanOp: "gtOp"}, Dt = {eqOp: "eqOp", neOp: "neOp", leOp: "geOp", ltOp: "gtOp", geOp: "leOp", gtOp: "ltOp"}; + function Et(a, b, c, d) { + const e = I(J(a, ["firstOperand", "*"]), "type"), f = I(J(a, ["secondOperand", "*"]), "type"); + if (!e || !f) + return Uq("Can not generate code for value compare without both types"); + var h = [47, 1]; + if (!h.includes(e.type) || !h.includes(f.type)) + return Uq(`Unsupported types in compare: [${Ea[e.type]}, ${Ea[f.type]}]`); + h = new Map([["eqOp", "==="], ["neOp", "!=="]]); + if (!h.has(b)) + return Uq(b + " not yet implemented"); + const k = h.get(b); + [b] = dr(a, "firstOperand", c, d); + b = Wq(b, c, d); + b = Zq(b, e, d); + return Y(Xq(d, b, "first"), (l) => { + var [n] = dr(a, "secondOperand", c, d); + n = Wq(n, c, d); + n = Zq(n, f, d); + return Y(Xq(d, n, "second"), (t) => { + const u = []; + zc(e) && u.push(`${l.code} === null`); + zc(f) && u.push(`${t.code} === null`); + return X(`(${u.length ? `${u.join(" || ")} ? null : ` : ""}${l.code} ${k} ${t.code})`, {type: 0}, [...l.H, ...t.H]); + }); + }); + } + function Ft(a, b, c, d, e, f) { + var h = I(J(a, [b, "*"]), "type"); + const k = I(J(a, [c, "*"]), "type"); + if (!h || !k) + return Uq("Can not generate code for general compare without both types"); + var l = [47, 1]; + if (!l.includes(h.type) || !l.includes(k.type)) + return Uq(`Unsupported types in compare: [${Ea[h.type]}, ${Ea[k.type]}]`); + l = new Map([["eqOp", "==="], ["neOp", "!=="]]); + if (!l.has(d)) + return Uq(d + " not yet implemented"); + const n = l.get(d); + [b] = dr(a, b, e, f); + b = Wq(b, e, f); + h = Zq(b, h, f); + return Y(Xq(f, h, "single"), (t) => { + const [u] = dr(a, c, e, f); + return Y(Xq(f, u, "multiple"), (y) => { + if (y.ra.type !== 1) + return Uq("can only generate general compare for a single value and a generator"); + const z = Gt(f, Ht(f, "n")), F = Zq(z, k, f); + return Y(e, (O) => Y(F, (U) => X(`(function () { + for (const ${z.code} of ${y.code}(${O.code})) { + ${U.H.join("\n")} + if (${U.code} ${n} ${t.code}) { + return true; + } + } + return false; + })()`, {type: 0}, [...t.H, ...z.H, ...O.H, ...y.H]))); + }); + }); + } + function It(a) { + return JSON.stringify(a).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"); + } + const Ot = {"false#0": Jt, "local-name#0": Kt, "local-name#1": Kt, "name#0": Lt, "name#1": Lt, "not#1": Mt, "true#0": Nt}, Pt = {["http://fontoxml.com/fontoxpath"]: ["version#0"], [""]: ["root#1", "path#1"]}; + function Qt(a, b, c, d) { + const [e] = d.h(a, c, d); + a = I(a, "type"); + if (b ? b.g === 2 || b.g === 1 : 1) + return Uq("Not supported: sequence arguments with multiple items"); + if (v(b.type, 53)) + return b = Wq(e, c, d), ar(b, a, d); + switch (b.type) { + case 59: + return Wq(e, c, d); + case 0: + return Yq(e, a, c, d); + case 1: + return $q(e, a, c, d); + } + return Uq(`Argument types not supported: ${a ? Ea[a.type] : "unknown"} -> ${Ea[b.type]}`); + } + function Rt(a, b, c, d) { + if (a.length !== b.length || b.some((l) => l === 4)) + return Uq("Not supported: variadic function or mismatch in argument count"); + if (a.length === 0) + return X("", {type: 0}, []); + const [e, ...f] = a, [h, ...k] = b; + a = Xq(d, Qt(e, h, c, d), "arg"); + return f.length === 0 ? a : Y(a, (l) => { + const n = Rt(f, k, c, d); + return Y(n, (t) => X(`${l.code}, ${t.code}`, {type: 0}, [...l.H, ...t.H])); + }); + } + function St(a, b) { + return Y(a, (c) => (b ? b.g === 2 || b.g === 1 : 1) || ![0, 1].includes(b.type) && !v(b.type, 53) ? Uq(`Function return type ${Ea[b.type]} not supported`) : c); + } + function Tt(a, b, c) { + const {localName: d, namespaceURI: e} = rg(G(a, "functionName")), f = K(G(a, "arguments"), "*"); + var h = f.length; + const k = `${d}#${h}`, l = e === c.D; + if (l) { + const n = Ot[k]; + if (n !== void 0) + return n(a, b, c); + } + if ((a = Pt[l ? "" : e]) && !a.includes(k)) + return Uq(`Not supported: built-in function not on allow list: ${k}`); + h = Vf(e, d, h); + if (!h) + return Uq(`Unknown function / arity: ${k}`); + if (h.J) + return Uq("Not supported: updating functions"); + b = Rt(f, h.j, b, c); + b = Y(b, (n) => X(`runtimeLib.callFunction(domFacade, ${It(e)}, ${It(d)}, [${n.code}], options)`, {type: 0}, n.H)); + return St(b, h.i); + } + function Ut(a, b) { + return Y(Xq(b, a, "contextItem"), (c) => X(c.code, {type: 0}, [...c.H, `if (${c.code} === undefined || ${c.code} === null) { + throw errXPDY0002('The function which was called depends on dynamic context, which is absent.'); + }`])); + } + function Vt(a, b, c, d) { + if ((a = J(a, ["arguments", "*"])) && a[0] !== "contextItemExpr") { + const e = I(a, "type"); + if (!e || !v(e.type, 53)) + return Uq("name function only implemented if arg is a node"); + [a] = c.h(a, b, c); + } else + a = Ut(b, c); + b = Wq(a, b, c); + return Y(Xq(c, b, "arg"), (e) => X(`(${e.code} ? ${d(e.code)} : '')`, {type: 0}, e.H)); + } + function Lt(a, b, c) { + return Vt(a, b, c, (d) => `(((${d}.prefix || '').length !== 0 ? ${d}.prefix + ':' : '') + + (${d}.localName || ${d}.target || ''))`); + } + function Kt(a, b, c) { + return Vt(a, b, c, (d) => `(${d}.localName || ${d}.target || '')`); + } + function Mt(a, b, c) { + var d = J(a, ["arguments", "*"]); + a = I(d, "type"); + [d] = c.h(d, b, c); + b = Yq(d, a, b, c); + return Y(b, (e) => X(`!${e.code}`, {type: 0}, e.H)); + } + function Jt() { + return X("false", {type: 0}, []); + } + function Nt() { + return X("true", {type: 0}, []); + } + function Wt(a, b, c, d) { + const [e, f] = dr(a, "firstOperand", c, d); + var h = I(J(a, ["firstOperand", "*"]), "type"); + h = Yq(e, h, c, d); + const [k, l] = dr(a, "secondOperand", c, d); + h = Y(h, (t) => { + var u = I(J(a, ["secondOperand", "*"]), "type"); + u = Yq(k, u, c, d); + return Y(u, (y) => X(`(${t.code} ${b} ${y.code})`, {type: 0}, [...t.H, ...y.H])); + }); + const n = b === "&&" ? fh(f, l) : f === l ? f : null; + return [h, n]; + } + function Xt(a, b, c) { + return Y(a, (d) => Y(b, (e) => Y(c, (f) => X(`for (${d.code}) { + ${e.H.join("\n")} + if (!(${e.code})) { + continue; + } + ${f.H.join("\n")} + ${f.code} + }`, {type: 2}, d.H)))); + } + function Yt(a, b, c, d, e) { + const f = b ? `, "${b}"` : ""; + b = Y(d, (h) => Y(e, (k) => X(`let ${h.code} = domFacade.getFirstChild(${k.code}${f}); + ${h.code}; + ${h.code} = domFacade.getNextSibling(${h.code}${f})`, {type: 2}, [...h.H, ...k.H]))); + return Xt(b, a, c); + } + function Zt(a, b, c, d, e) { + const f = fh(b, "type-2"), h = Y(e, (k) => X(`(${k.code} && ${k.code}.nodeType === /*ELEMENT_NODE*/ ${1} ? domFacade.getAllAttributes(${k.code}${f ? `, "${f}"` : ""}) : [])`, {type: 0}, k.H)); + b = Y(d, (k) => Y(h, (l) => X(`const ${k.code} of ${l.code}`, {type: 2}, [...k.H, ...l.H]))); + return Xt(b, a, c); + } + function $t(a, b, c, d, e) { + const f = b ? `, "${b}"` : ""; + b = Y(e, (h) => X(`domFacade.getParentNode(${h.code}${f})`, {type: 0}, h.H)); + return au(d, b, a, c); + } + function au(a, b, c, d) { + const e = cr(a, c); + return Y(a, (f) => Y(b, (h) => Y(e, (k) => Y(d, (l) => X(`const ${f.code} = ${h.code}; + ${k.H.join("\n")} + if (${k.code}) { + ${l.H.join("\n")} + ${l.code} + }`, {type: 2}, [...f.H, ...h.H]))))); + } + function bu(a, b, c, d, e, f) { + a = H(a); + switch (a) { + case "attribute": + return [Zt(b, c, d, e, f), "type-1"]; + case "child": + return [Yt(b, c, d, e, f), null]; + case "parent": + return [$t(b, c, d, e, f), null]; + case "self": + return [au(e, f, b, d), c]; + default: + return [Uq(`Unsupported: the ${a} axis`), null]; + } + } + const cu = {Tb: "textTest", Kb: "elementTest", Pb: "nameTest", Ub: "Wildcard", Hb: "anyKindTest"}; + var du = Object.values(cu); + function eu(a) { + return [Y(a, (b) => X(`${b.code}.nodeType === /*TEXT_NODE*/ ${3}`, {type: 0}, [])), "type-3"]; + } + function fu(a, b) { + if (a.namespaceURI === null && a.prefix !== "*") { + b = b.$(a.prefix || "") || null; + if (!b && a.prefix) + throw Error(`XPST0081: The prefix ${a.prefix} could not be resolved.`); + a.namespaceURI = b; + } + } + function gu(a, b, c, d) { + fu(a, d); + const e = a.prefix, f = a.namespaceURI, h = a.localName; + return Vq(c, (k) => { + var l = b ? X(`${k.code}.nodeType + && (${k.code}.nodeType === /*ELEMENT_NODE*/ ${1} + || ${k.code}.nodeType === /*ATTRIBUTE_NODE*/ ${2})`, {type: 0}, []) : X(`${k.code}.nodeType + && ${k.code}.nodeType === /*ELEMENT_NODE*/ ${1}`, {type: 0}, []); + if (e === "*") + return h === "*" ? [l, b ? "type-1-or-type-2" : "type-1"] : [cr(l, X(`${k.code}.localName === ${It(h)}`, {type: 0}, [])), `name-${h}`]; + l = h === "*" ? l : cr(l, X(`${k.code}.localName === ${It(h)}`, {type: 0}, [])); + var n = X(It(f), {type: 0}, []); + n = e === "" && b ? Y(n, (t) => X(`${k.code}.nodeType === /*ELEMENT_NODE*/ ${1} ? ${t.code} : null`, {type: 0}, t.H)) : n; + n = Y(n, (t) => X(`(${k.code}.namespaceURI || null) === ((${t.code}) || null)`, {type: 0}, t.H)); + return [cr(l, n), `name-${h}`]; + }); + } + function hu(a, b, c) { + const d = (a = G(a, "elementName")) && G(a, "star"); + if (a === null || d) + return [Y(b, (e) => X(`${e.code}.nodeType === /*ELEMENT_NODE*/ ${1}`, {type: 0}, [])), "type-1"]; + a = rg(G(a, "QName")); + return gu(a, false, b, c); + } + function iu(a) { + return [Y(a, (b) => X(`!!${b.code}.nodeType`, {type: 0}, [])), null]; + } + function ju(a, b, c, d) { + var e = a[0]; + switch (e) { + case cu.Kb: + return hu(a, c, d); + case cu.Tb: + return eu(c); + case cu.Pb: + return gu(rg(a), b, c, d); + case cu.Ub: + return G(a, "star") ? (e = G(a, "uri"), e !== null ? a = gu({localName: "*", namespaceURI: H(e), prefix: ""}, b, c, d) : (e = G(a, "NCName"), a = G(a, "*")[0] === "star" ? gu({localName: H(e), namespaceURI: null, prefix: "*"}, b, c, d) : gu({localName: "*", namespaceURI: null, prefix: H(e)}, b, c, d))) : a = gu({localName: "*", namespaceURI: null, prefix: "*"}, b, c, d), a; + case cu.Hb: + return iu(c); + default: + return [ + Uq(`Test not implemented: '${e}`), + null + ]; + } + } + function ku(a, b, c) { + const [d, e] = c.h(a, b, c); + return [Yq(d, I(a, "type"), b, c), e]; + } + function lu(a, b, c) { + a = a ? K(a, "*") : []; + const [d, e] = a.reduce(([f, h], k) => { + if (!f) + return ku(k, b, c); + let l = h; + return Vq(f, (n) => { + const [t, u] = ku(k, b, c); + l = fh(h, u); + return [Y(t, (y) => X(`${n.code} && ${y.code}`, {type: 0}, [...n.H, ...y.H])), l]; + }); + }, [null, null]); + return [d ? Y(d, (f) => X(`(function () { + ${f.H.join("\n")} + return ${f.code}; + })()`, {type: 0}, [])) : null, e]; + } + function mu(a, b, c, d) { + if (a.length === 0) + return [Y(c, (z) => X(`yield ${z.code};`, {type: 2}, z.H)), null]; + const [e, ...f] = a; + if (0 < K(e, "lookup").length) + return [Uq("Unsupported: lookups"), null]; + const h = Gt(d, Ht(d, "contextItem")); + a = G(e, "predicates"); + const [k, l] = lu(a, h, d); + if (a = G(e, "xpathAxis")) { + var n = G(e, du); + if (!n) + return [Uq("Unsupported test in step"), null]; + var t = H(a); + b = t === "attribute" || t === "self" && b; + const [z, F] = ju(n, b, h, d); + n = k === null ? z : cr(z, k); + t = fh(F, l); + [b] = mu(f, b, h, d); + return bu(a, n, t, b, h, c); + } + a = J(e, ["filterExpr", "*"]); + if (!a) + return [Uq("Unsupported: unknown step type"), null]; + const [u, y] = d.h(a, c, d); + return [Y(u, (z) => { + const F = f.length === 0 ? X("", {type: 2}, []) : X(`if (${h.code} !== null && !${h.code}.nodeType) { + throw new Error('XPTY0019: The result of E1 in a path expression E1/E2 should evaluate to a sequence of nodes.'); + }`, {type: 2}, []), [O] = mu(f, true, h, d), U = k === null ? O : Y(k, (ba) => Y(O, (Ga) => X(`if (${ba.code}) { + ${Ga.H.join("\n")} + ${Ga.code} + }`, {type: 2}, ba.H))); + return Y(U, (ba) => { + switch (z.ra.type) { + case 1: + return Y(c, (Ga) => X(`for (const ${h.code} of ${z.code}(${Ga.code})) { + ${ba.H.join("\n")} + ${ba.code} + }`, {type: 2}, [...h.H, ...z.H, ...F.H])); + case 0: + return X(`const ${h.code} = ${z.code}; + ${F.code} + if (${h.code} !== null) { + ${ba.H.join("\n")} + ${ba.code} + }`, {type: 2}, [...h.H, ...z.H, ...F.H]); + default: + return Uq("Unsupported generated code type for filterExpr"); + } + }); + }), y]; + } + function nu(a) { + return Y(a, (b) => X(`(function () { + let n = ${b.code}; + while (n.nodeType !== /*DOCUMENT_NODE*/${9}) { + n = domFacade.getParentNode(n); + if (n === null) { + throw new Error('XPDY0050: the root node of the context node is not a document node.'); + } + } + return n; + })()`, {type: 0}, b.H)); + } + function ou(a, b, c) { + return Vq(b, (d) => { + if (0 < K(a, "lookup").length) + return [Uq("Unsupported: lookups"), null]; + var e = G(a, "predicates"); + const [f, h] = lu(e, d, c); + e = G(a, du); + if (!e) + return [Uq("Unsupported test in step"), null]; + const [k, l] = ju(e, true, d, c); + e = f === null ? k : cr(k, f); + const n = fh(l, h); + return [Y(e, (t) => X(`((${t.code}) ? ${d.code} : null)`, {type: 0}, [...d.H, ...t.H])), n]; + }); + } + function pu(a, b, c) { + const d = K(a, "stepExpr"); + if (d.length === 1) { + const k = G(d[0], "xpathAxis"); + if (k && H(k) === "self") + return ou(d[0], b, c); + } + const e = Gt(c, Ht(c, "contextItem")); + b = (a = G(a, "rootExpr")) ? Xq(c, nu(e), "root") : e; + const [f, h] = mu(d, !a, b, c); + return [Y(f, (k) => X(`(function* (${e.code}) { + ${k.H.join("\n")} + ${k.code} + })`, {type: 1}, [])), h]; + } + function qu(a, b, c) { + const d = a[0]; + switch (d) { + case "contextItemExpr": + return [b, null]; + case "pathExpr": + return pu(a, b, c); + case "andOp": + return Wt(a, "&&", b, c); + case "orOp": + return Wt(a, "||", b, c); + case "stringConstantExpr": + return a = G(a, "value")[1] || "", a = It(a), [X(a, {type: 0}, []), null]; + case "equalOp": + case "notEqualOp": + case "lessThanOrEqualOp": + case "lessThanOp": + case "greaterThanOrEqualOp": + case "greaterThanOp": + case "eqOp": + case "neOp": + case "ltOp": + case "leOp": + case "gtOp": + case "geOp": + case "isOp": + case "nodeBeforeOp": + case "nodeAfterOp": + a: + switch (d) { + case "eqOp": + case "neOp": + case "ltOp": + case "leOp": + case "gtOp": + case "geOp": + case "isOp": + a = Et(a, d, b, c); + break a; + case "equalOp": + case "notEqualOp": + case "lessThanOrEqualOp": + case "lessThanOp": + case "greaterThanOrEqualOp": + case "greaterThanOp": + const e = I(J(a, ["firstOperand", "*"]), "type"), f = I(J(a, ["secondOperand", "*"]), "type"); + a = e && f ? e.g === 3 && f.g === 3 ? Et(a, Ct[d], b, c) : e.g === 3 ? Ft(a, "firstOperand", "secondOperand", Ct[d], b, c) : f.g === 3 ? Ft(a, "secondOperand", "firstOperand", Dt[Ct[d]], b, c) : Uq("General comparison for sequences is not implemented") : Uq("types of compare are not known"); + break a; + default: + a = Uq(`Unsupported compare type: ${d}`); + } + return [ + a, + null + ]; + case "functionCallExpr": + return [Tt(a, b, c), null]; + default: + return [Uq(`Unsupported: the base expression '${d}'.`), null]; + } + } + function Xq(a, b, c) { + return Y(b, (d) => { + var e = a.o.get(d); + e || (e = Ht(a, c), e = X(e, d.ra, [...d.H, `const ${e} = ${d.code};`]), a.o.set(d, e), a.o.set(e, e)); + return e; + }); + } + function Ht(a, b = "v") { + const c = a.v.get(b) || 0; + a.v.set(b, c + 1); + return `${b}${c}`; + } + function Gt(a, b) { + b = X(b, {type: 0}, []); + a.o.set(b, b); + return b; + } + var ru = class { + constructor(a, b) { + this.o = new Map(); + this.v = new Map(); + this.$ = a; + this.D = b; + this.h = qu; + } + }; + function su(a) { + const b = K(a, "*"); + if (a[0] === "pathExpr") + return true; + for (const c of b) + if (su(c)) + return true; + return false; + } + function tu(a, b, c) { + c = c || {}; + b = b || 0; + if (typeof a === "string") { + a = uk(a); + var d = {Z: c.language === "XQuery3.1" || c.language === "XQueryUpdate3.1", debug: false}; + try { + var e = Wp(a, d); + } catch (h) { + Pf(a, h); + } + } else + e = pk(a); + a = G(e, "mainModule"); + if (!a) + return Uq("Unsupported: XQuery Library modules are not supported."); + if (G(a, "prolog")) + return Uq("Unsupported: XQuery Prologs are not supported."); + d = c.defaultFunctionNamespaceURI === void 0 ? "http://www.w3.org/2005/xpath-functions" : c.defaultFunctionNamespaceURI; + a = new ru(c.namespaceResolver || sq(null), d); + c = new Zg(new jg(new Yf(a.$, {}, d, c.functionNameResolver || tq("http://www.w3.org/2005/xpath-functions")))); + N(e, c); + if (c = G(e, "mainModule")) + if (G(c, "prolog")) + a = Uq("Unsupported: XQuery."); + else { + var f = J(c, ["queryBody", "*"]); + c = Gt(a, "contextItem"); + [d] = a.h(f, c, a); + b: + switch (f = I(f, "type"), b) { + case 9: + b = Wq(d, c, a); + a = ar(b, f, a); + break b; + case 7: + a = br(d, f, c, a); + break b; + case 3: + a = Yq(d, f, c, a); + break b; + case 2: + a = $q(d, f, c, a); + break b; + default: + a = Uq(`Unsupported: the return type '${b}'.`); + } + a.isAstAccepted && (a = ` + ${a.H.join("\n")} + return ${a.code};`, b = "\n return (contextItem, domFacade, runtimeLib, options) => {\n const {\n errXPDY0002,\n } = runtimeLib;", su(e) && (b += '\n if (!contextItem) {\n throw errXPDY0002("Context is needed to evaluate the given path expression.");\n }\n\n if (!contextItem.nodeType) {\n throw new Error("Context item must be subtype of node().");\n }\n '), a = {code: b + (a + "}\n//# sourceURL=generated.js"), isAstAccepted: true}); + } + else + a = Uq("Unsupported: Can not execute a library module."); + return a; + } + class uu extends Error { + constructor(a, b, c) { + var d = a.stack; + d && (d.includes(a.message) && (d = d.substr(d.indexOf(a.message) + a.message.length).trim()), d = d.split("\n"), d.splice(10), d = d.map((e) => e.startsWith(" ") || e.startsWith(" ") ? e : ` ${e}`), d = d.join("\n")); + super(`Custom XPath function Q{${c}}${b} raised: +${a.message} +${d}`); + } + } + function vu(a, b, c) { + return b.g === 0 ? a.G() ? null : wq(a.first(), c).next(0).value : b.g === 2 || b.g === 1 ? a.O().map((d) => { + if (v(d.type, 47)) + throw Error("Cannot pass attribute nodes to custom functions"); + return wq(d, c).next(0).value; + }) : wq(a.first(), c).next(0).value; + } + function wu(a) { + if (typeof a === "object") + return a; + a = a.split(":"); + if (a.length !== 2) + throw Error("Do not register custom functions in the default function namespace"); + const [b, c] = a; + a = Xf[b]; + if (!a) { + a = `generated_namespace_uri_${b}`; + if (Xf[b]) + throw Error("Prefix already registered: Do not register the same prefix twice."); + Xf[b] = a; + } + return {localName: c, namespaceURI: a}; + } + function xu(a, b, c, d) { + const {namespaceURI: e, localName: f} = wu(a); + if (!e) + throw cg(); + const h = b.map((l) => Ja(l)), k = Ja(c); + Wf(e, f, h, k, function(l, n, t) { + var u = Array.from(arguments); + u.splice(0, 3); + u = u.map((F, O) => vu(F, h[O], n)); + const y = {currentContext: n.o, domFacade: n.h.h}; + let z; + try { + z = d.apply(void 0, [y, ...u]); + } catch (F) { + throw new uu(F, f, e); + } + return z && typeof z === "object" && Object.getOwnPropertySymbols(z).includes(qq) ? w.create(z.xb) : Zb(n.h, z, k); + }); + } + var yu = {callFunction(a, b, c, d, e) { + const f = Vf(b, c, d.length); + if (!f) + throw Error("function not found for codegen function call"); + b = new cc({N: null, Fa: 0, za: w.empty(), wa: {}}); + const h = new nb(a); + a = new ic(false, false, h, null, null, e ? e.currentContext : null, null); + d = f.callFunction(b, a, null, ...d.map((k, l) => Zb(h, k, f.j[l]))); + return vu(d, {type: 59, g: 0}, a); + }, errXPDY0002: lc}; + var zu = (a, b, c, d) => { + c = c ? c : new Za(); + return a()(b !== null && b !== void 0 ? b : null, c, yu, d); + }; + const Au = {["http://www.w3.org/2005/XQueryX"]: "xqx", ["http://www.w3.org/2007/xquery-update-10"]: "xquf", ["http://fontoxml.com/fontoxpath"]: "x"}; + function Bu(a, b) { + switch (a) { + case "copySource": + case "insertAfter": + case "insertAsFirst": + case "insertAsLast": + case "insertBefore": + case "insertInto": + case "modifyExpr": + case "newNameExpr": + case "replacementExpr": + case "replaceValue": + case "returnExpr": + case "sourceExpr": + case "targetExpr": + case "transformCopies": + case "transformCopy": + return {localName: a, kb: b || "http://www.w3.org/2005/XQueryX"}; + case "deleteExpr": + case "insertExpr": + case "renameExpr": + case "replaceExpr": + case "transformExpr": + return {localName: a, kb: "http://www.w3.org/2007/xquery-update-10"}; + case "x:stackTrace": + return {localName: "stackTrace", kb: "http://fontoxml.com/fontoxpath"}; + default: + return {localName: a, kb: "http://www.w3.org/2005/XQueryX"}; + } + } + function Cu(a, b, c, d, e) { + if (typeof c === "string") + return c.length === 0 ? null : b.createTextNode(c); + if (!Array.isArray(c)) + throw new TypeError("JsonML element should be an array or string"); + var f = Bu(c[0], d); + d = f.localName; + f = f.kb; + const h = b.createElementNS(f, Au[f] + ":" + d), k = c[1]; + var l = 1; + if (typeof k === "object" && !Array.isArray(k)) { + if (k !== null) + for (var n of Object.keys(k)) + l = k[n], l !== null && (n === "type" ? l !== void 0 && a.setAttributeNS(h, f, "fontoxpath:" + n, Ha(l)) : (n !== "start" && n !== "end" || d !== "stackTrace" || (l = JSON.stringify(l)), e && n === "prefix" && l === "" || a.setAttributeNS(h, f, Au[f] + ":" + n, l))); + l = 2; + } + for (let t = l, u = c.length; t < u; ++t) + n = Cu(a, b, c[t], f, e), n !== null && a.insertBefore(h, n, null); + return h; + } + function Du(a, b, c, d = ab) { + a = uk(a); + let e; + try { + e = Wp(a, {Z: b.language === "XQuery3.1" || b.language === "XQueryUpdate3.1", debug: b.debug}); + } catch (l) { + Pf(a, l); + } + var f = new Yf(b.namespaceResolver || (() => null), {}, b.defaultFunctionNamespaceURI === void 0 ? "http://www.w3.org/2005/xpath-functions" : b.defaultFunctionNamespaceURI, b.functionNameResolver || (() => null)); + f = new jg(f); + var h = G(e, ["mainModule", "libraryModule"]), k = G(h, "moduleDecl"); + if (k) { + const l = H(G(k, "prefix")); + k = H(G(k, "uri")); + ng(f, l, k); + } + (h = G(h, "prolog")) && Zp(h, f, false, a); + b.annotateAst !== false && Rg(e, new Zg(f)); + f = new Za(); + b = Cu(d, c, e, null, b.kc === false); + d.insertBefore(b, c.createComment(a), f.getFirstChild(b)); + return b; + } + function Eu(a) { + return Promise.resolve(a); + } + function Fu(a, b = {debug: false}) { + b = Wp(a, {Z: true, debug: b.debug}); + Rg(b, new Zg()); + b = G(b, "libraryModule"); + if (!b) + throw Error("XQuery module must be declared in a library module."); + var c = G(b, "moduleDecl"), d = G(c, "uri"); + const e = H(d); + c = G(c, "prefix"); + d = H(c); + c = new jg(new Yf(() => null, Object.create(null), "http://www.w3.org/2005/xpath-functions", tq("http://www.w3.org/2005/xpath-functions"))); + ng(c, d, e); + b = G(b, "prolog"); + if (b !== null) { + let f; + try { + f = Zp(b, c, true, a); + } catch (h) { + Pf(a, h); + } + f.Ha.forEach(({namespaceURI: h}) => { + if (e !== h) + throw Error("XQST0048: Functions and variables declared in a module must reside in the module target namespace."); + }); + rk(e, f); + } else + rk(e, {Ha: [], Ta: [], oa: null, source: a}); + return e; + } + const Gu = new Map(); + function Hu(a) { + var b; + a: { + if (b = lk.get(a)) { + for (const c of Object.keys(b)) + if (b[c] && b[c].length) { + b = b[c][0].h; + break a; + } + } + b = null; + } + if (b) + return b; + if (Gu.has(a)) + return Gu.get(a); + b = typeof a === "string" ? Wp(a, {Z: false}) : pk(a); + b = J(b, ["mainModule", "queryBody", "*"]); + if (b === null) + throw Error("Library modules do not have a specificity"); + b = kk(b, {qa: false, Z: false}); + Gu.set(a, b); + return b; + } + function Iu(a) { + return Hu(a).D(); + } + function Ju(a, b) { + return af(Hu(a).o, Hu(b).o); + } + var Ku = new Za(); + typeof fontoxpathGlobal !== "undefined" && (fontoxpathGlobal.compareSpecificity = Ju, fontoxpathGlobal.compileXPathToJavaScript = tu, fontoxpathGlobal.domFacade = Ku, fontoxpathGlobal.evaluateXPath = Fq, fontoxpathGlobal.evaluateXPathToArray = Kq, fontoxpathGlobal.evaluateXPathToAsyncIterator = Gq, fontoxpathGlobal.evaluateXPathToBoolean = Lq, fontoxpathGlobal.evaluateXPathToFirstNode = Mq, fontoxpathGlobal.evaluateXPathToMap = Nq, fontoxpathGlobal.evaluateXPathToNodes = Oq, fontoxpathGlobal.evaluateXPathToNumber = Pq, fontoxpathGlobal.evaluateXPathToNumbers = Qq, fontoxpathGlobal.evaluateXPathToString = Rq, fontoxpathGlobal.evaluateXPathToStrings = Sq, fontoxpathGlobal.evaluateUpdatingExpression = Iq, fontoxpathGlobal.evaluateUpdatingExpressionSync = Jq, fontoxpathGlobal.executeJavaScriptCompiledXPath = zu, fontoxpathGlobal.executePendingUpdateList = Tq, fontoxpathGlobal.getBucketForSelector = Iu, fontoxpathGlobal.getBucketsForNode = Ya, fontoxpathGlobal.precompileXPath = Eu, fontoxpathGlobal.registerXQueryModule = Fu, fontoxpathGlobal.registerCustomXPathFunction = xu, fontoxpathGlobal.parseScript = Du, fontoxpathGlobal.profiler = Cq, fontoxpathGlobal.createTypedValueFactory = rq, fontoxpathGlobal.finalizeModuleRegistration = tk, fontoxpathGlobal.Language = Eq, fontoxpathGlobal.ReturnType = yq); + return fontoxpathGlobal; +}.call(typeof window === "undefined" ? void 0 : window, xspattern, prsc); +const compareSpecificity = fontoxpath.compareSpecificity; +const compileXPathToJavaScript = fontoxpath.compileXPathToJavaScript; +const createTypedValueFactory = fontoxpath.createTypedValueFactory; +const domFacade = fontoxpath.domFacade; +const evaluateUpdatingExpression = fontoxpath.evaluateUpdatingExpression; +const evaluateUpdatingExpressionSync = fontoxpath.evaluateUpdatingExpressionSync; +const evaluateXPath = fontoxpath.evaluateXPath; +const evaluateXPathToArray = fontoxpath.evaluateXPathToArray; +const evaluateXPathToAsyncIterator = fontoxpath.evaluateXPathToAsyncIterator; +const evaluateXPathToBoolean = fontoxpath.evaluateXPathToBoolean; +const evaluateXPathToFirstNode = fontoxpath.evaluateXPathToFirstNode; +const evaluateXPathToMap = fontoxpath.evaluateXPathToMap; +const evaluateXPathToNodes = fontoxpath.evaluateXPathToNodes; +const evaluateXPathToNumber = fontoxpath.evaluateXPathToNumber; +const evaluateXPathToNumbers = fontoxpath.evaluateXPathToNumbers; +const evaluateXPathToString = fontoxpath.evaluateXPathToString; +const evaluateXPathToStrings = fontoxpath.evaluateXPathToStrings; +const executeJavaScriptCompiledXPath = fontoxpath.executeJavaScriptCompiledXPath; +const executePendingUpdateList = fontoxpath.executePendingUpdateList; +const finalizeModuleRegistration = fontoxpath.finalizeModuleRegistration; +const getBucketForSelector = fontoxpath.getBucketForSelector; +const getBucketsForNode = fontoxpath.getBucketsForNode; +const Language = fontoxpath.Language; +const parseScript = fontoxpath.parseScript; +const precompileXPath = fontoxpath.precompileXPath; +const profiler = fontoxpath.profiler; +const registerCustomXPathFunction = fontoxpath.registerCustomXPathFunction; +const registerXQueryModule = fontoxpath.registerXQueryModule; +const ReturnType = fontoxpath.ReturnType; +export default fontoxpath; +export {Language, ReturnType, compareSpecificity, compileXPathToJavaScript, createTypedValueFactory, domFacade, evaluateUpdatingExpression, evaluateUpdatingExpressionSync, evaluateXPath, evaluateXPathToArray, evaluateXPathToAsyncIterator, evaluateXPathToBoolean, evaluateXPathToFirstNode, evaluateXPathToMap, evaluateXPathToNodes, evaluateXPathToNumber, evaluateXPathToNumbers, evaluateXPathToString, evaluateXPathToStrings, executeJavaScriptCompiledXPath, executePendingUpdateList, finalizeModuleRegistration, getBucketForSelector, getBucketsForNode, parseScript, precompileXPath, profiler, registerCustomXPathFunction, registerXQueryModule}; diff --git a/src/vendor/cdn.skypack.dev/-/prsc@v4.0.0-yiYip3qo0YwPataeg654/dist=es2019,mode=imports/optimized/prsc.js b/src/vendor/cdn.skypack.dev/-/prsc@v4.0.0-yiYip3qo0YwPataeg654/dist=es2019,mode=imports/optimized/prsc.js new file mode 100644 index 00000000000..e0aaa853e24 --- /dev/null +++ b/src/vendor/cdn.skypack.dev/-/prsc@v4.0.0-yiYip3qo0YwPataeg654/dist=es2019,mode=imports/optimized/prsc.js @@ -0,0 +1,271 @@ +function n(n2, t2) { + return {success: true, offset: n2, value: t2}; +} +function t(t2) { + return n(t2, void 0); +} +function e(n2, t2, e2 = false) { + return {success: false, offset: n2, expected: t2, fatal: e2}; +} +function r(t2) { + return (r2, u2) => { + const o2 = u2 + t2.length; + return r2.slice(u2, o2) === t2 ? n(o2, t2) : e(u2, [t2]); + }; +} +function u(n2) { + return n2 > 65535 ? 2 : 1; +} +function o(n2, r2) { + return (o2, c2) => { + const f2 = o2.codePointAt(c2); + return f2 !== void 0 && n2(f2) ? t(c2 + u(f2)) : e(c2, r2); + }; +} +function c(n2, r2) { + return (u2, o2) => { + const c2 = o2; + for (; ; ) { + const t2 = u2.codePointAt(o2); + if (t2 === void 0) + break; + if (!n2(t2)) + break; + o2 += t2 > 65535 ? 2 : 1; + } + return r2 !== void 0 && o2 === c2 ? e(o2, r2) : t(o2); + }; +} +function f(n2, t2, e2) { + return o((e3) => n2 <= e3 && e3 <= t2, e2 || [`${String.fromCodePoint(n2)}-${String.fromCodePoint(t2)}`]); +} +function s(n2) { + return (r2, o2) => { + let c2 = n2; + for (; c2 > 0; ) { + const n3 = r2.codePointAt(o2); + if (n3 === void 0) + return e(o2, ["any character"]); + o2 += u(n3), c2 -= 1; + } + return t(o2); + }; +} +function i(t2, e2) { + return (r2, u2) => { + const o2 = t2(r2, u2); + return o2.success ? n(o2.offset, e2(o2.value)) : o2; + }; +} +function l(n2) { + return i(n2, () => { + }); +} +function a(n2, t2, r2, u2) { + return (o2, c2) => { + const f2 = n2(o2, c2); + return f2.success ? t2(f2.value) ? f2 : e(c2, r2, u2) : f2; + }; +} +function d(n2, t2) { + return (r2, u2) => { + let o2 = null; + for (const e2 of n2) { + const n3 = e2(r2, u2); + if (n3.success) + return n3; + if (o2 === null || n3.offset > o2.offset ? o2 = n3 : n3.offset === o2.offset && t2 === void 0 && (o2.expected = o2.expected.concat(n3.expected)), n3.fatal) + return n3; + } + return t2 = t2 || (o2 == null ? void 0 : o2.expected) || [], o2 && (o2.expected = t2), o2 || e(u2, t2); + }; +} +function v(t2) { + return (e2, r2) => { + const u2 = t2(e2, r2); + return u2.success || u2.fatal ? u2 : n(r2, null); + }; +} +function p(t2) { + return (e2, r2) => { + let u2 = [], o2 = r2; + for (; ; ) { + const n2 = t2(e2, o2); + if (!n2.success) { + if (n2.fatal) + return n2; + break; + } + if (u2.push(n2.value), n2.offset === o2) + break; + o2 = n2.offset; + } + return n(o2, u2); + }; +} +function x(n2) { + return (e2, r2) => { + let u2 = r2; + for (; ; ) { + const t2 = n2(e2, u2); + if (!t2.success) { + if (t2.fatal) + return t2; + break; + } + if (t2.offset === u2) + break; + u2 = t2.offset; + } + return t(u2); + }; +} +function y(n2) { + return i(n2, (n3) => n3.filter((n4) => n4 !== void 0)); +} +function b(t2, e2, r2) { + return (u2, o2) => { + const c2 = t2(u2, o2); + if (!c2.success) + return c2; + const f2 = e2(u2, c2.offset); + return f2.success ? n(f2.offset, r2(c2.value, f2.value)) : f2; + }; +} +function h(...t2) { + return (e2, r2) => { + const u2 = []; + for (const n2 of t2) { + const t3 = n2(e2, r2); + if (!t3.success) + return t3; + r2 = t3.offset, u2.push(t3.value); + } + return n(r2, u2); + }; +} +function k(...n2) { + return (e2, r2) => { + for (const t2 of n2) { + const n3 = t2(e2, r2); + if (!n3.success) + return n3; + r2 = n3.offset; + } + return t(r2); + }; +} +function P(n2) { + return b(n2, p(n2), (n3, t2) => [n3].concat(t2)); +} +function g(n2, t2) { + return n2; +} +function A(n2, t2) { + return t2; +} +function m(n2) { + return b(n2, x(n2), A); +} +function C(n2, t2) { + return b(n2, t2, A); +} +function S(n2, t2) { + return b(n2, t2, g); +} +function $(n2, t2, e2, r2 = false) { + return C(n2, r2 ? D(S(t2, e2)) : S(t2, e2)); +} +function j(t2) { + return (e2, r2) => { + const u2 = t2(e2, r2); + return u2.success ? n(u2.offset, e2.slice(r2, u2.offset)) : u2; + }; +} +function q(t2) { + return (e2, r2) => { + const u2 = t2(e2, r2); + return u2.success ? n(r2, u2.value) : u2; + }; +} +function w(n2, r2) { + return (u2, o2) => n2(u2, o2).success ? e(o2, r2) : t(o2); +} +function z(n2, t2, e2) { + return C(w(t2, e2), n2); +} +function B(n2, t2, r2 = 0, u2 = []) { + return (o2, c2) => { + const f2 = o2.codePointAt(c2 + r2); + if (f2 === void 0) + return e(c2, u2); + const s2 = n2[f2]; + return s2 === void 0 ? t2 === void 0 ? e(c2, u2) : t2(o2, c2) : s2(o2, c2); + }; +} +function D(n2) { + return (t2, r2) => { + const u2 = n2(t2, r2); + return u2.success ? u2 : e(u2.offset, u2.expected, true); + }; +} +const E = (n2, r2) => r2 === 0 ? t(r2) : e(r2, ["start of input"]), F = (n2, r2) => n2.length === r2 ? t(r2) : e(r2, ["end of input"]); +function G(n2) { + return b(n2, F, g); +} +function H(n2) { + const t2 = []; + let e2 = n2.next(); + for (; !e2.done; ) + t2.push(e2.value), e2 = n2.next(); + return [t2, e2.value]; +} +function I(n2) { + return function* (t2, e2) { + const r2 = n2(t2, e2); + return r2.success && (yield r2.value), r2; + }; +} +function J(n2, t2) { + return function* (e2, r2) { + const u2 = yield* n2(e2, r2); + return u2.success ? yield* t2(e2, u2.offset) : u2; + }; +} +function K(n2) { + return function* (t2, e2) { + const r2 = n2(t2, e2); + let u2 = r2.next(); + for (; !u2.done; ) { + const n3 = u2.value; + n3 !== void 0 && (yield n3), u2 = r2.next(); + } + return u2.value; + }; +} +function L(n2) { + return function* (e2, r2) { + for (; ; ) { + const [u2, o2] = H(n2(e2, r2)); + if (!o2.success) + return o2.fatal ? o2 : t(r2); + if (yield* u2, r2 === o2.offset) + return t(r2); + r2 = o2.offset; + } + }; +} +function M(n2) { + return function* (e2, r2) { + const [u2, o2] = H(n2(e2, r2)); + return o2.success ? (yield* u2, o2) : o2.fatal ? o2 : t(r2); + }; +} +function N(n2) { + return function* (t2, e2) { + const r2 = yield* n2(t2, e2); + return r2.success ? F(t2, r2.offset) : r2; + }; +} +export {o as codepoint, c as codepoints, H as collect, G as complete, l as consume, D as cut, $ as delimited, B as dispatch, F as end, e as error, z as except, a as filter, y as filterUndefined, g as first, S as followed, i as map, w as not, t as ok, n as okWithValue, v as optional, d as or, q as peek, P as plus, m as plusConsumed, C as preceded, f as range, j as recognize, A as second, h as sequence, k as sequenceConsumed, s as skipChars, p as star, x as starConsumed, E as start, I as streaming, N as streamingComplete, K as streamingFilterUndefined, M as streamingOptional, L as streamingStar, J as streamingThen, b as then, r as token}; +export default null; diff --git a/src/vendor/cdn.skypack.dev/-/slimdom@v4.2.0-QzuHPU3P67qdOzczKt6u/dist=es2019,mode=imports/optimized/slimdom.js b/src/vendor/cdn.skypack.dev/-/slimdom@v4.2.0-QzuHPU3P67qdOzczKt6u/dist=es2019,mode=imports/optimized/slimdom.js new file mode 100644 index 00000000000..8c291035d71 --- /dev/null +++ b/src/vendor/cdn.skypack.dev/-/slimdom@v4.2.0-QzuHPU3P67qdOzczKt6u/dist=es2019,mode=imports/optimized/slimdom.js @@ -0,0 +1,2342 @@ +class t { + constructor(t3, n2, e2, r2) { + this.source = null, this.observer = t3, this.node = n2, this.options = e2, this.source = r2 || null, r2 && t3.t.push(this); + } + collectInterestedObservers(t3, n2, e2, r2, o2) { + if (this.node !== n2 && !this.options.subtree) + return; + if (t3 === "attributes" && !this.options.attributes) + return; + if (t3 === "characterData" && !this.options.characterData) + return; + if (t3 === "childList" && !this.options.childList) + return; + let i2 = r2.indexOf(this.observer); + i2 < 0 && (i2 = r2.length, r2.push(this.observer), o2.push(void 0)), (t3 === "attributes" && this.options.attributeOldValue || t3 === "characterData" && this.options.characterDataOldValue) && (o2[i2] = e2.oldValue); + } +} +class n { + constructor(t2) { + this.o = [], this.i = t2; + } + register(n3, e2) { + const r2 = this.o; + let o2 = false; + r2.forEach((t2) => { + t2.observer === n3 && (o2 = true, function(t3) { + for (let n4 = t3.observer.t.length - 1; n4 >= 0; --n4) { + const e3 = t3.observer.t[n4]; + if (e3.source !== t3) + return; + e3.node.o.removeTransientRegisteredObserver(e3), t3.observer.t.splice(n4, 1); + } + }(t2), t2.options = e2); + }), o2 || (this.o.push(new t(n3, this.i, e2)), n3.u.push(this.i)); + } + removeTransientRegisteredObserver(t2) { + this.o.splice(this.o.indexOf(t2), 1); + } + removeForObserver(t2) { + let n3 = 0; + for (let e2 = 0, r2 = this.o.length; e2 < r2; ++e2) { + const r3 = this.o[e2]; + r3.observer !== t2 && (e2 !== n3 && (this.o[n3] = r3), ++n3); + } + this.o.length = n3; + } + collectInterestedObservers(t2, n3, e2, r2, o2) { + this.o.forEach((i2) => { + i2.collectInterestedObservers(t2, n3, e2, r2, o2); + }); + } + appendTransientRegisteredObservers(t2) { + this.o.forEach((n3) => { + n3.options.subtree && t2.o.registerTransient(n3); + }); + } + registerTransient(n3) { + this.o.push(new t(n3.observer, this.i, n3.options, n3)); + } +} +function e(t2, n2, ...e2) { + typeof queueMicrotask != "function" ? Promise.resolve().then(() => t2.apply(n2, e2)) : queueMicrotask(() => t2.apply(n2, e2)); +} +class r { + constructor() { + this.l = new Set(), this.h = false; + } + appendRecord(t2, n2) { + t2.m.push(n2), this.l.add(t2); + } + queueMutationObserverMicrotask() { + this.h || (this.h = true, e(() => { + this.p(); + }, this)); + } + p() { + this.h = false; + const t2 = Array.from(this.l); + this.l.clear(), t2.forEach((t3) => { + e((t4) => { + const n2 = t4.takeRecords(); + var e2; + (e2 = t4).t.forEach((t5) => { + t5.node.o.removeTransientRegisteredObserver(t5); + }), e2.t.length = 0, n2.length > 0 && t4.g(n2, t4); + }, this, t3); + }); + } +} +class o { + constructor(t2) { + this.v = t2; + } + deref() { + return this.v; + } +} +const i = new class { + constructor() { + this.l = new r(), this.N = [], this.S = new WeakSet(); + } + forEachRange(t2) { + let n2 = this.N.length; + for (let e2 = n2 - 1; e2 >= 0; --e2) { + const r2 = this.N[e2].deref(), o2 = r2 == null, i2 = !o2 && !this.S.has(r2); + o2 || i2 ? (this.N[e2] = this.N[n2 - 1], this.N.pop(), n2 -= 1) : t2(r2); + } + } + addRange(t2) { + const n2 = (e2 = t2, typeof WeakRef == "function" ? new WeakRef(e2) : new o(e2)); + var e2; + this.N.push(n2), this.S.add(t2); + } + removeRange(t2) { + this.S.delete(t2); + } +}(); +function s(t2) { + return i; +} +function u(t2, ...n2) { + return n2.some((n3) => t2.nodeType === n3); +} +function l(t2) { + return t2.nodeType === 2; +} +function c(t2) { + return t2.nodeType === 3 || t2.nodeType === 4 || t2.nodeType === 8 || t2.nodeType === 7; +} +function a(t2) { + return t2.nodeType === 3 || t2.nodeType === 4; +} +function h(t2) { + return t2.nodeType === 1; +} +function f(t2) { + return t2.nodeType === 10; +} +function d(t2) { + switch (t2.nodeType) { + case 3: + case 7: + case 8: + return t2.data.length; + default: + return t2.childNodes.length; + } +} +function m(t2) { + let n2 = t2, e2 = []; + for (; n2; ) + e2.unshift(n2), n2 = n2.parentNode; + return e2; +} +function p(t2) { + return u(t2, 9) ? t2 : t2.ownerDocument; +} +function g(t2) { + return t2.parentNode.childNodes.indexOf(t2); +} +function w(t2) { + for (; t2.parentNode; ) + t2 = t2.parentNode; + return t2; +} +function y(t2, n2) { + n2(t2); + for (let e2 = t2.firstChild; e2; e2 = e2.nextSibling) + y(e2, n2); +} +function b(t2, n2) { + const e2 = []; + return y(n2, (r2) => { + if (r2 === n2 || r2.nodeType !== 1) + return; + const o2 = r2; + t2 !== "*" && o2.nodeName !== t2 || e2.push(o2); + }), e2; +} +function x(t2, n2, e2) { + t2 === "" && (t2 = null); + const r2 = []; + return y(e2, (o2) => { + if (o2 === e2 || o2.nodeType !== 1) + return; + const i2 = o2; + t2 !== "*" && i2.namespaceURI !== t2 || n2 !== "*" && i2.localName !== n2 || r2.push(i2); + }), r2; +} +function v(t2, n2, e2) { + e2 || (e2 = p(t2)); + let r2 = t2.T(e2); + if (n2) + for (let n3 = t2.firstChild; n3; n3 = n3.nextSibling) + r2.appendChild(v(n3, true, e2)); + return r2; +} +function N(t2, n2) { + if (t2.length < n2) + throw new TypeError(`Function should be called with at least ${n2} arguments`); +} +const S = {IndexSizeError: 1, HierarchyRequestError: 3, WrongDocumentError: 4, InvalidCharacterError: 5, NotFoundError: 8, NotSupportedError: 9, InUseAttributeError: 10, InvalidStateError: 11, NamespaceError: 14, InvalidNodeTypeError: 24}; +class E extends Error { + constructor(t2 = "", n2 = "Error") { + super(t2), this.message = t2, this.name = n2, this.code = S[n2] || 0, this.stack = new Error(t2).stack; + } +} +function T(t2, n2) { + return new E(`${t2}: ${n2}`, t2); +} +function C(t2) { + throw T("HierarchyRequestError", t2); +} +function D(t2) { + throw T("IndexSizeError", t2); +} +function $(t2) { + throw T("InvalidCharacterError", t2); +} +function A(t2) { + throw T("InvalidNodeTypeError", t2); +} +function I(t2) { + throw T("InvalidStateError", t2); +} +function k(t2) { + throw T("NamespaceError", t2); +} +function M(t2) { + throw T("NotFoundError", t2); +} +function R(t2) { + throw T("NotSupportedError", t2); +} +function P(t2) { + throw T("WrongDocumentError", t2); +} +class L { + constructor(t2, n2) { + this.addedNodes = [], this.removedNodes = [], this.previousSibling = null, this.nextSibling = null, this.attributeName = null, this.attributeNamespace = null, this.oldValue = null, this.type = t2, this.target = n2; + } +} +function O(t2, n2, e2) { + const r2 = [], o2 = []; + for (let i3 = n2; i3; i3 = i3.parentNode) + i3.o.collectInterestedObservers(t2, n2, e2, r2, o2); + const i2 = s(); + r2.forEach((r3, s2) => { + const u2 = o2[s2], l2 = new L(t2, n2); + e2.name !== void 0 && e2.namespace !== void 0 && (l2.attributeName = e2.name, l2.attributeNamespace = e2.namespace), u2 !== void 0 && (l2.oldValue = u2), e2.addedNodes !== void 0 && (l2.addedNodes = e2.addedNodes), e2.removedNodes !== void 0 && (l2.removedNodes = e2.removedNodes), e2.previousSibling !== void 0 && (l2.previousSibling = e2.previousSibling), e2.nextSibling !== void 0 && (l2.nextSibling = e2.nextSibling), i2.l.appendRecord(r3, l2); + }), i2.l.queueMutationObserverMicrotask(); +} +function z(t2) { + const n2 = []; + for (let e2 = t2.firstElementChild; e2; e2 = e2.nextElementSibling) + n2.push(e2); + return n2; +} +function F(t2) { + for (let n2 = t2.previousSibling; n2; n2 = n2.previousSibling) + if (h(n2)) + return n2; + return null; +} +function V(t2) { + for (let n2 = t2.nextSibling; n2; n2 = n2.nextSibling) + if (h(n2)) + return n2; + return null; +} +function U(t2, n2) { + const e2 = t2.previousSibling, r2 = t2.nextSibling, o2 = u(t2, 1), i2 = o2 ? t2.previousElementSibling : null, s2 = o2 ? t2.nextElementSibling : null; + if (t2.parentNode = null, t2.previousSibling = null, t2.nextSibling = null, e2 ? e2.nextSibling = r2 : n2.firstChild = r2, r2 ? r2.previousSibling = e2 : n2.lastChild = e2, n2.childNodes.splice(n2.childNodes.indexOf(t2), 1), o2) { + const e3 = function(t3) { + return u(t3, 1, 9, 11) ? t3 : null; + }(n2); + e3 && (e3.firstElementChild === t2 && (e3.firstElementChild = s2), e3.lastElementChild === t2 && (e3.lastElementChild = i2), e3.childElementCount -= 1); + } + if (u(n2, 9)) { + const e3 = n2; + u(t2, 1) ? e3.documentElement = null : u(t2, 10) && (e3.doctype = null); + } +} +function q(t2, n2, e2) { + if (u(n2, 9, 11, 1) || C("parent must be a Document, DocumentFragment or Element node"), t2.contains(n2) && C("node must not be an inclusive ancestor of parent"), e2 && e2.parentNode !== n2 && M("child is not a child of parent"), u(t2, 11, 10, 1, 3, 4, 7, 8) || C("node must be a DocumentFragment, DocumentType, Element, Text, ProcessingInstruction or Comment node"), u(t2, 3) && u(n2, 9) && C("can not insert a Text node under a Document"), u(t2, 10) && !u(n2, 9) && C("can only insert a DocumentType node under a Document"), u(n2, 9)) { + const r2 = n2; + switch (t2.nodeType) { + case 11: + const n3 = t2; + n3.firstElementChild !== n3.lastElementChild && C("can not insert more than one element under a Document"), Array.from(n3.childNodes).some((t3) => u(t3, 3)) && C("can not insert a Text node under a Document"), n3.firstElementChild && (r2.documentElement || e2 && u(e2, 10) || e2 && r2.doctype && g(e2) < g(r2.doctype)) && C("Document should contain at most one doctype, followed by at most one element"); + break; + case 1: + (r2.documentElement || e2 && u(e2, 10) || e2 && r2.doctype && g(e2) < g(r2.doctype)) && C("Document should contain at most one doctype, followed by at most one element"); + break; + case 10: + (r2.doctype || e2 && r2.documentElement && g(r2.documentElement) < g(e2) || !e2 && r2.documentElement) && C("Document should contain at most one doctype, followed by at most one element"); + } + } +} +function _(t2, n2, e2) { + q(t2, n2, e2); + let r2 = e2; + return r2 === t2 && (r2 = t2.nextSibling), j(t2, p(n2)), B(t2, n2, r2), t2; +} +function B(t2, n2, e2, r2 = false) { + const o2 = function(t3) { + return t3.nodeType === 11; + }(t2), i2 = o2 ? Array.from(t2.childNodes) : [t2], u2 = i2.length; + if (u2 === 0) + return; + if (o2 && (i2.forEach((t3) => H(t3, true)), O("childList", t2, {removedNodes: i2})), e2 !== null) { + const t3 = g(e2); + s().forEachRange((e3) => { + e3.startContainer === n2 && e3.startOffset > t3 && (e3.startOffset += u2), e3.endContainer === n2 && e3.endOffset > t3 && (e3.endOffset += u2); + }); + } + let l2 = e2 === null ? n2.lastChild : e2.previousSibling; + i2.forEach((t3) => { + !function(t4, n3, e3) { + t4.parentNode = n3; + const r3 = e3 === null ? n3.lastChild : e3.previousSibling, o3 = e3 === null ? null : e3; + if (t4.previousSibling = r3, t4.nextSibling = o3, r3 ? r3.nextSibling = t4 : n3.firstChild = t4, o3 ? (o3.previousSibling = t4, n3.childNodes.splice(n3.childNodes.indexOf(o3), 0, t4)) : (n3.lastChild = t4, n3.childNodes.push(t4)), h(t4)) { + const e4 = n3; + let i3 = null; + for (let t5 = r3; t5; t5 = t5.previousSibling) { + if (h(t5)) { + i3 = t5; + break; + } + const n4 = t5; + if (!f(n4)) { + i3 = n4.previousElementSibling; + break; + } + } + let s2 = null; + for (let t5 = o3; t5; t5 = t5.nextSibling) { + if (h(t5)) { + s2 = t5; + break; + } + s2 = t5.nextElementSibling; + break; + } + i3 || (e4.firstElementChild = t4), s2 || (e4.lastElementChild = t4), e4.childElementCount += 1; + } + (function(t5) { + return t5.nodeType === 9; + })(n3) && (h(t4) ? n3.documentElement = t4 : f(t4) && (n3.doctype = t4)); + }(t3, n2, e2); + }), r2 || O("childList", n2, {addedNodes: i2, nextSibling: e2, previousSibling: l2}); +} +function W(t2, n2) { + return _(t2, n2, null); +} +function X(t2, n2, e2) { + if (u(e2, 9, 11, 1) || C("Can not replace under a non-parent node"), n2.contains(e2) && C("Can not insert a node under its own descendant"), t2.parentNode !== e2 && M("child is not a child of parent"), u(n2, 11, 10, 1, 3, 4, 7, 8) || C("Can not insert a node that isn't a DocumentFragment, DocumentType, Element, Text, ProcessingInstruction or Comment"), u(n2, 3) && u(e2, 9) && C("can not insert a Text node under a Document"), u(n2, 10) && !u(e2, 9) && C("can only insert a DocumentType node under a Document"), u(e2, 9)) { + const r3 = e2; + switch (n2.nodeType) { + case 11: + const e3 = n2; + e3.firstElementChild !== e3.lastElementChild && C("can not insert more than one element under a Document"), Array.from(e3.childNodes).some((t3) => u(t3, 3)) && C("can not insert a Text node under a Document"), e3.firstElementChild && (r3.documentElement && r3.documentElement !== t2 || t2 && r3.doctype && g(t2) < g(r3.doctype)) && C("Document should contain at most one doctype, followed by at most one element"); + break; + case 1: + (r3.documentElement && r3.documentElement !== t2 || r3.doctype && g(t2) < g(r3.doctype)) && C("Document should contain at most one doctype, followed by at most one element"); + break; + case 10: + (r3.doctype && r3.doctype !== t2 || r3.documentElement && g(r3.documentElement) < g(t2)) && C("Document should contain at most one doctype, followed by at most one element"); + } + } + let r2 = t2.nextSibling; + r2 === n2 && (r2 = n2.nextSibling); + const o2 = t2.previousSibling; + j(n2, p(e2)); + let i2 = []; + t2.parentNode !== null && (i2.push(t2), H(t2, true)); + const s2 = u(n2, 11) ? Array.from(n2.childNodes) : [n2]; + return B(n2, e2, r2, true), O("childList", e2, {addedNodes: s2, removedNodes: i2, nextSibling: r2, previousSibling: o2}), t2; +} +function Y(t2, n2) { + t2 !== null && j(t2, p(n2)); + const e2 = Array.from(n2.childNodes); + let r2 = []; + t2 !== null && (u(t2, 11) ? t2.childNodes.forEach((t3) => { + r2.push(t3); + }) : r2.push(t2)), e2.forEach((t3) => { + H(t3, true); + }), t2 !== null && B(t2, n2, null, true), (r2.length > 0 || e2.length > 0) && O("childList", n2, {addedNodes: r2, removedNodes: e2}); +} +function H(t2, n2 = false) { + const e2 = t2.parentNode, r2 = g(t2); + s().forEachRange((n3) => { + t2.contains(n3.startContainer) && (n3.startContainer = e2, n3.startOffset = r2), t2.contains(n3.endContainer) && (n3.endContainer = e2, n3.endOffset = r2), n3.startContainer === e2 && n3.startOffset > r2 && (n3.startOffset -= 1), n3.endContainer === e2 && n3.endOffset > r2 && (n3.endOffset -= 1); + }); + const o2 = t2.previousSibling, i2 = t2.nextSibling; + U(t2, e2); + for (let n3 = e2; n3; n3 = n3.parentNode) + n3.o.appendTransientRegisteredObservers(t2); + n2 || O("childList", e2, {removedNodes: [t2], nextSibling: i2, previousSibling: o2}); +} +function j(t2, n2) { + const e2 = p(t2); + t2.parentNode && H(t2), n2 !== e2 && y(t2, (t3) => { + if (t3.ownerDocument = n2, u(t3, 1)) + for (const e3 of t3.attributes) + e3.ownerDocument = n2; + }); +} +function Q(t2) { + const n2 = []; + return y(t2, (t3) => { + u(t3, 3, 4) && n2.push(t3.data); + }), n2.join(""); +} +function K(t2, n2) { + let e2 = null; + if (n2 !== "") { + e2 = new (s()).Text(n2); + } + Y(e2, t2); +} +function G(t2, n2) { + const e2 = t2.map((t3) => t3 instanceof Node ? t3 : n2.createTextNode(String(t3))); + if (e2.length === 1) + return e2[0]; + { + const t3 = n2.createDocumentFragment(); + return e2.forEach((n3) => { + t3.appendChild(n3); + }), t3; + } +} +function J(t2, n2) { + _(G(n2, p(t2)), t2, t2.firstChild); +} +function Z(t2, n2) { + W(G(n2, p(t2)), t2); +} +function tt(t2, n2) { + const e2 = G(n2, p(t2)); + q(e2, t2, null), Y(e2, t2); +} +function nt(t2, n2) { + const e2 = t2.parentNode; + if (e2 === null) + return; + let r2 = t2.previousSibling; + for (; r2 !== null && n2.indexOf(r2) >= 0; ) + r2 = r2.previousSibling; + _(G(n2, p(t2)), e2, r2 === null ? e2.firstChild : r2.nextSibling); +} +function et(t2, n2) { + const e2 = t2.parentNode; + if (e2 === null) + return; + let r2 = t2.nextSibling; + for (; r2 !== null && n2.indexOf(r2) >= 0; ) + r2 = r2.nextSibling; + _(G(n2, p(t2)), e2, r2); +} +function rt(t2, n2) { + const e2 = t2.parentNode; + if (e2 === null) + return; + let r2 = t2.nextSibling; + for (; r2 !== null && n2.indexOf(r2) >= 0; ) + r2 = r2.nextSibling; + const o2 = G(n2, p(t2)); + t2.parentNode === e2 ? X(t2, o2, e2) : _(o2, e2, r2); +} +function ot(t2) { + t2.parentNode !== null && H(t2); +} +function it(t2, n2) { + const e2 = n2.startContainer; + u(e2, 7) && C("Can not insert into a processing instruction"), u(e2, 8) && C("Can not insert into a comment"), a(e2) && e2.parentNode === null && C("Can not insert into a text node without a parent"); + let r2 = null; + r2 = a(e2) ? e2 : e2.childNodes[n2.startOffset] || null; + const o2 = r2 === null ? e2 : r2.parentNode; + q(t2, o2, r2), a(e2) && (r2 = e2.splitText(n2.startOffset)), t2 === r2 && (r2 = r2.nextSibling), t2.parentNode !== null && H(t2); + let i2 = r2 === null ? d(o2) : g(r2); + u(t2, 11) ? i2 += d(t2) : i2 += 1, _(t2, o2, r2), n2.collapsed && n2.setEnd(o2, i2); +} +function st(t2) { + return t2 >>> 0; +} +function ut(t2) { + return t2 === null ? "" : String(t2); +} +function lt(t2) { + return t2 == null ? "" : String(t2); +} +function ct(t2, n2) { + return function(t3, n3) { + if (!(t3 instanceof n3)) + throw new TypeError(`Value should be an instance of ${n3.name}`); + }(t2, n2), t2; +} +function at(t2, n2) { + return t2 == null ? null : ct(t2, n2); +} +function ht(t2) { + return t2 === void 0 ? null : t2; +} +const ft = new WeakMap(); +function dt(t2) { + let n2 = ft.get(t2); + return n2 === void 0 && (n2 = Math.random(), ft.set(t2, n2)), n2; +} +class Node { + constructor() { + this.ownerDocument = null, this.parentNode = null, this.childNodes = [], this.firstChild = null, this.lastChild = null, this.previousSibling = null, this.nextSibling = null, this.o = new n(this); + } + get parentElement() { + return this.parentNode && u(this.parentNode, 1) ? this.parentNode : null; + } + hasChildNodes() { + return !!this.childNodes.length; + } + normalize() { + let t2 = this.firstChild, n2 = 0; + for (p(this); t2; ) { + let e2 = t2.nextSibling; + if (!u(t2, 3)) { + t2.normalize(), t2 = e2; + continue; + } + const r2 = t2; + let o2 = r2.length; + if (o2 === 0) { + H(t2), --n2, t2 = e2; + continue; + } + let i2 = ""; + const l2 = []; + for (let t3 = r2.nextSibling; t3 && u(t3, 3); t3 = t3.nextSibling) + i2 += t3.data, l2.push(t3); + i2 && r2.replaceData(o2, 0, i2); + const c2 = s(); + for (let t3 = 0, e3 = l2.length; t3 < e3; ++t3) { + const e4 = l2[t3], i3 = n2 + t3 + 1; + c2.forEachRange((t4) => { + t4.startContainer === e4 && (t4.startOffset += o2, t4.startContainer = r2), t4.endContainer === e4 && (t4.endOffset += o2, t4.endContainer = r2), t4.startContainer === this && t4.startOffset === i3 && (t4.startContainer = r2, t4.startOffset = o2), t4.endContainer === this && t4.endOffset === i3 && (t4.endContainer = r2, t4.endOffset = o2); + }), o2 += e4.length; + } + for (; l2.length; ) + H(l2.shift()); + t2 = t2.nextSibling, ++n2; + } + } + cloneNode(t2 = false) { + return v(this, t2); + } + compareDocumentPosition(t2) { + if (N(arguments, 1), this === (t2 = ct(t2, Node))) + return 0; + let n2 = t2, e2 = this, r2 = null, o2 = null; + if (l(n2) && (r2 = n2, n2 = r2.ownerElement), l(e2) && (o2 = e2, e2 = o2.ownerElement, r2 !== null && n2 !== null && e2 === n2)) + for (const t3 of e2.attributes) { + if (t3 === r2) + return Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | Node.DOCUMENT_POSITION_PRECEDING; + if (t3 === o2) + return Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | Node.DOCUMENT_POSITION_FOLLOWING; + } + if (n2 === null || e2 === null) + return Node.DOCUMENT_POSITION_DISCONNECTED | Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | (dt(n2 || r2) > dt(e2 || o2) ? Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_PRECEDING); + const i2 = m(n2), s2 = m(e2); + if (i2[0] !== s2[0]) + return Node.DOCUMENT_POSITION_DISCONNECTED | Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | (dt(i2[0]) > dt(s2[0]) ? Node.DOCUMENT_POSITION_FOLLOWING : Node.DOCUMENT_POSITION_PRECEDING); + let u2 = 0; + for (; u2 < i2.length && u2 < s2.length && i2[u2] === s2[u2]; ) + ++u2; + const c2 = n2 !== e2 && u2 === i2.length, a2 = n2 !== e2 && u2 === s2.length; + return c2 && r2 === null || n2 === e2 && o2 !== null ? Node.DOCUMENT_POSITION_CONTAINS | Node.DOCUMENT_POSITION_PRECEDING : a2 && o2 === null || n2 === e2 && r2 !== null ? Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING : c2 || g(i2[u2]) < g(s2[u2]) ? Node.DOCUMENT_POSITION_PRECEDING : Node.DOCUMENT_POSITION_FOLLOWING; + } + contains(t2) { + for (N(arguments, 1), t2 = at(t2, Node); t2 && t2 != this; ) + t2 = t2.parentNode; + return t2 === this; + } + isDefaultNamespace(t2) { + N(arguments, 1), (t2 = ht(t2)) === "" && (t2 = null); + return this.lookupNamespaceURI(null) === t2; + } + insertBefore(t2, n2) { + return N(arguments, 2), _(t2 = ct(t2, Node), this, n2 = at(n2, Node)); + } + appendChild(t2) { + return N(arguments, 1), W(t2 = ct(t2, Node), this); + } + replaceChild(t2, n2) { + return N(arguments, 2), t2 = ct(t2, Node), X(n2 = ct(n2, Node), t2, this); + } + removeChild(t2) { + return N(arguments, 1), function(t3, n2) { + return t3.parentNode !== n2 && M("child is not a child of parent"), H(t3), t3; + }(t2 = ct(t2, Node), this); + } +} +function mt(t2, n2, e2, r2) { + O("attributes", n2, {name: t2.localName, namespace: t2.namespaceURI, oldValue: e2}); +} +function pt(t2, n2) { + mt(t2, t2.ownerElement, t2.value), t2.C = n2; +} +function gt(t2, n2, e2 = false) { + e2 || mt(t2, n2, null, t2.value), n2.attributes.push(t2), t2.ownerElement = n2; +} +function wt(t2) { + const n2 = t2.ownerElement; + mt(t2, n2, t2.value), n2.attributes.splice(n2.attributes.indexOf(t2), 1), t2.ownerElement = null; +} +Node.ELEMENT_NODE = 1, Node.ATTRIBUTE_NODE = 2, Node.TEXT_NODE = 3, Node.CDATA_SECTION_NODE = 4, Node.ENTITY_REFERENCE_NODE = 5, Node.ENTITY_NODE = 6, Node.PROCESSING_INSTRUCTION_NODE = 7, Node.COMMENT_NODE = 8, Node.DOCUMENT_NODE = 9, Node.DOCUMENT_TYPE_NODE = 10, Node.DOCUMENT_FRAGMENT_NODE = 11, Node.NOTATION_NODE = 12, Node.DOCUMENT_POSITION_DISCONNECTED = 1, Node.DOCUMENT_POSITION_PRECEDING = 2, Node.DOCUMENT_POSITION_FOLLOWING = 4, Node.DOCUMENT_POSITION_CONTAINS = 8, Node.DOCUMENT_POSITION_CONTAINED_BY = 16, Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32, Node.prototype.ELEMENT_NODE = 1, Node.prototype.ATTRIBUTE_NODE = 2, Node.prototype.TEXT_NODE = 3, Node.prototype.CDATA_SECTION_NODE = 4, Node.prototype.ENTITY_REFERENCE_NODE = 5, Node.prototype.ENTITY_NODE = 6, Node.prototype.PROCESSING_INSTRUCTION_NODE = 7, Node.prototype.COMMENT_NODE = 8, Node.prototype.DOCUMENT_NODE = 9, Node.prototype.DOCUMENT_TYPE_NODE = 10, Node.prototype.DOCUMENT_FRAGMENT_NODE = 11, Node.prototype.NOTATION_NODE = 12; +class Attr extends Node { + get nodeType() { + return 2; + } + get nodeName() { + return this.name; + } + get nodeValue() { + return this.C; + } + set nodeValue(t2) { + yt(this, t2 = lt(t2)); + } + get textContent() { + return this.C; + } + set textContent(t2) { + yt(this, t2 = lt(t2)); + } + lookupPrefix(t2) { + return N(arguments, 1), this.ownerElement !== null ? this.ownerElement.lookupPrefix(t2) : null; + } + lookupNamespaceURI(t2) { + return N(arguments, 1), this.ownerElement === null ? null : this.ownerElement.lookupNamespaceURI(t2); + } + get value() { + return this.C; + } + set value(t2) { + yt(this, t2); + } + constructor(t2, n2, e2, r2, o2) { + super(), this.namespaceURI = t2, this.prefix = n2, this.localName = e2, this.name = n2 === null ? e2 : `${n2}:${e2}`, this.C = r2, this.ownerElement = o2, this.ownerDocument = o2 ? o2.ownerDocument : s().document; + } + T(t2) { + const n2 = new (s()).Attr(this.namespaceURI, this.prefix, this.localName, this.value, null); + return n2.ownerDocument = t2, n2; + } +} +function yt(t2, n2) { + n2 = String(n2); + t2.ownerElement === null ? t2.C = n2 : pt(t2, n2); +} +class CharacterData extends Node { + get nodeValue() { + return this.D; + } + set nodeValue(t2) { + t2 = lt(t2), bt(this, 0, this.length, t2); + } + get textContent() { + return this.D; + } + set textContent(t2) { + t2 = lt(t2), bt(this, 0, this.length, t2); + } + lookupPrefix(t2) { + N(arguments, 1); + const n2 = this.parentElement; + return n2 !== null ? n2.lookupPrefix(t2) : null; + } + lookupNamespaceURI(t2) { + N(arguments, 1); + const n2 = this.parentElement; + return n2 === null ? null : n2.lookupNamespaceURI(t2); + } + before(...t2) { + nt(this, t2); + } + after(...t2) { + et(this, t2); + } + replaceWith(...t2) { + rt(this, t2); + } + remove() { + ot(this); + } + get previousElementSibling() { + return F(this); + } + get nextElementSibling() { + return V(this); + } + get data() { + return this.D; + } + set data(t2) { + t2 = ut(t2), bt(this, 0, this.length, t2); + } + get length() { + return this.data.length; + } + constructor(t2) { + super(), this.D = String(t2); + } + substringData(t2, n2) { + return N(arguments, 2), xt(this, t2, n2); + } + appendData(t2) { + N(arguments, 1), bt(this, this.length, 0, t2); + } + insertData(t2, n2) { + N(arguments, 1), bt(this, t2, 0, n2); + } + deleteData(t2, n2) { + N(arguments, 2), bt(this, t2, n2, ""); + } + replaceData(t2, n2, e2) { + N(arguments, 3), bt(this, t2, n2, e2); + } +} +function bt(t2, n2, e2, r2) { + n2 = st(n2), e2 = st(e2); + const o2 = t2.length; + n2 > o2 && D("can not replace data past the node's length"), n2 + e2 > o2 && (e2 = o2 - n2), O("characterData", t2, {oldValue: t2.data}); + const i2 = t2.data, u2 = i2.substring(0, n2) + r2 + i2.substring(n2 + e2); + t2.D = u2; + s().forEachRange((o3) => { + o3.startContainer === t2 && o3.startOffset > n2 && o3.startOffset <= n2 + e2 && (o3.startOffset = n2), o3.endContainer === t2 && o3.endOffset > n2 && o3.endOffset <= n2 + e2 && (o3.endOffset = n2), o3.startContainer === t2 && o3.startOffset > n2 + e2 && (o3.startOffset = o3.startOffset + r2.length - e2), o3.endContainer === t2 && o3.endOffset > n2 + e2 && (o3.endOffset = o3.endOffset + r2.length - e2); + }); +} +function xt(t2, n2, e2) { + n2 = st(n2), e2 = st(e2); + const r2 = t2.length; + return n2 > r2 && D("can not substring data past the node's length"), n2 + e2 > r2 ? t2.data.substring(n2) : t2.data.substring(n2, n2 + e2); +} +class Text extends CharacterData { + get nodeType() { + return 3; + } + get nodeName() { + return "#text"; + } + constructor(t2 = "") { + super(t2); + const n2 = s(); + this.ownerDocument = n2.document; + } + splitText(t2) { + return N(arguments, 1), function(t3, n2) { + const e2 = t3.length; + n2 > e2 && D("can not split past the node's length"); + const r2 = e2 - n2, o2 = xt(t3, n2, r2), i2 = new (s()).Text(o2); + i2.ownerDocument = t3.ownerDocument; + const u2 = t3.parentNode; + if (u2 !== null) { + B(i2, u2, t3.nextSibling); + const e3 = g(t3) + 1; + s().forEachRange((r3) => { + r3.startContainer === t3 && r3.startOffset > n2 && (r3.startContainer = i2, r3.startOffset -= n2), r3.endContainer === t3 && r3.endOffset > n2 && (r3.endContainer = i2, r3.endOffset -= n2), r3.startContainer === u2 && r3.startOffset === e3 && (r3.startOffset += 1), r3.endContainer === u2 && r3.endOffset === e3 && (r3.endOffset += 1); + }); + } + return bt(t3, n2, r2, ""), i2; + }(this, t2 = st(t2)); + } + T(t2) { + const n2 = new (s()).Text(this.data); + return n2.ownerDocument = t2, n2; + } + get wholeText() { + const t2 = [this.data]; + let n2 = this.previousSibling; + for (; n2 !== null && u(n2, 3, 4); ) { + const e3 = n2.data; + t2.unshift(e3), n2 = n2.previousSibling; + } + let e2 = this.nextSibling; + for (; e2 !== null && u(e2, 3, 4); ) { + const n3 = e2.data; + t2.push(n3), e2 = e2.nextSibling; + } + return t2.join(""); + } +} +class CDATASection extends Text { + get nodeType() { + return 4; + } + get nodeName() { + return "#cdata-section"; + } + constructor(t2) { + super(t2); + } + T(t2) { + const n2 = new (s()).CDATASection(this.data); + return n2.ownerDocument = t2, n2; + } +} +class vt extends CharacterData { + get nodeType() { + return 8; + } + get nodeName() { + return "#comment"; + } + constructor(t2 = "") { + super(t2); + const n2 = s(); + this.ownerDocument = n2.document; + } + T(t2) { + const n2 = new (s()).Comment(this.data); + return n2.ownerDocument = t2, n2; + } +} +class DocumentType extends Node { + get nodeType() { + return 10; + } + get nodeName() { + return this.name; + } + get nodeValue() { + return null; + } + set nodeValue(t2) { + } + get textContent() { + return null; + } + set textContent(t2) { + } + lookupPrefix(t2) { + return N(arguments, 1), null; + } + lookupNamespaceURI(t2) { + return N(arguments, 1), null; + } + before(...t2) { + nt(this, t2); + } + after(...t2) { + et(this, t2); + } + replaceWith(...t2) { + rt(this, t2); + } + remove() { + ot(this); + } + constructor(t2, n2 = "", e2 = "") { + super(), this.name = t2, this.publicId = n2, this.systemId = e2; + } + T(t2) { + const n2 = new (s()).DocumentType(this.name, this.publicId, this.systemId); + return n2.ownerDocument = t2, n2; + } +} +function Nt(t2, n2, e2, r2, o2) { + return new Attr(t2, n2, e2, r2, o2); +} +function St(t2, n2, e2, r2 = null) { + return wo(t2, n2, e2, r2); +} +function Et(t2, n2) { + gt(t2, n2); +} +const Tt = "http://www.w3.org/1999/xhtml", Ct = "http://www.w3.org/XML/1998/namespace", Dt = "http://www.w3.org/2000/xmlns/"; +function $t(t2) { + (function(t3) { + const n2 = t3.split(":"); + return !(n2.length > 2) && n2.every((t4) => Hr(t4)); + })(t2) || $("The qualified name is not a valid QName"); +} +function At(t2, n2) { + t2 === "" && (t2 = null), $t(n2); + let e2 = null, r2 = n2; + const o2 = n2.indexOf(":"); + return o2 >= 0 && (e2 = n2.substring(0, o2), r2 = n2.substring(o2 + 1)), e2 !== null && t2 === null && k("Qualified name with prefix can not have a null namespace"), e2 === "xml" && t2 !== Ct && k("xml prefix can only be used for the XML namespace"), n2 !== "xmlns" && e2 !== "xmlns" || t2 === Dt || k("xmlns prefix or qualifiedName must use the XMLNS namespace"), t2 === Dt && n2 !== "xmlns" && e2 !== "xmlns" && k("xmlns prefix or qualifiedName must be used for the XMLNS namespace"), {namespace: t2, prefix: e2, localName: r2}; +} +function It(t2, n2) { + if (t2.namespaceURI === n2 && t2.prefix !== null) + return t2.prefix; + const e2 = Array.from(t2.attributes).find((t3) => t3.prefix === "xmlns" && t3.value === n2); + return e2 ? e2.localName : t2.parentElement !== null ? It(t2.parentElement, n2) : null; +} +function kt(t2, n2) { + return {success: true, offset: t2, value: n2}; +} +function Mt(t2) { + return kt(t2, void 0); +} +function Rt(t2, n2, e2 = false) { + return {success: false, offset: t2, expected: n2, fatal: e2}; +} +function Pt(t2) { + return (n2, e2) => { + const r2 = e2 + t2.length; + return n2.slice(e2, r2) === t2 ? kt(r2, t2) : Rt(e2, [t2]); + }; +} +function Lt(t2, n2) { + return (e2, r2) => { + const o2 = e2.codePointAt(r2); + return o2 !== void 0 && t2(o2) ? Mt(r2 + function(t3) { + return t3 > 65535 ? 2 : 1; + }(o2)) : Rt(r2, n2); + }; +} +function Ot(t2, n2) { + return (e2, r2) => { + const o2 = r2; + for (; ; ) { + const n3 = e2.codePointAt(r2); + if (n3 === void 0) + break; + if (!t2(n3)) + break; + r2 += n3 > 65535 ? 2 : 1; + } + return n2 !== void 0 && r2 === o2 ? Rt(r2, n2) : Mt(r2); + }; +} +function zt(t2, n2, e2) { + return Lt((e3) => t2 <= e3 && e3 <= n2, e2 || [`${String.fromCodePoint(t2)}-${String.fromCodePoint(n2)}`]); +} +function Ft(t2, n2) { + return (e2, r2) => { + const o2 = t2(e2, r2); + return o2.success ? kt(o2.offset, n2(o2.value)) : o2; + }; +} +function Vt(t2) { + return Ft(t2, () => { + }); +} +function Ut(t2, n2, e2, r2) { + return (o2, i2) => { + const s2 = t2(o2, i2); + return s2.success ? n2(s2.value) ? s2 : Rt(i2, e2, r2) : s2; + }; +} +function qt(t2, n2) { + return (e2, r2) => { + let o2 = null; + for (const i2 of t2) { + const t3 = i2(e2, r2); + if (t3.success) + return t3; + if (o2 === null || t3.offset > o2.offset ? o2 = t3 : t3.offset === o2.offset && n2 === void 0 && (o2.expected = o2.expected.concat(t3.expected)), t3.fatal) + return t3; + } + return n2 = n2 || (o2 == null ? void 0 : o2.expected) || [], o2 && (o2.expected = n2), o2 || Rt(r2, n2); + }; +} +function _t(t2) { + return (n2, e2) => { + const r2 = t2(n2, e2); + return r2.success || r2.fatal ? r2 : kt(e2, null); + }; +} +function Bt(t2) { + return (n2, e2) => { + let r2 = [], o2 = e2; + for (; ; ) { + const e3 = t2(n2, o2); + if (!e3.success) { + if (e3.fatal) + return e3; + break; + } + if (r2.push(e3.value), e3.offset === o2) + break; + o2 = e3.offset; + } + return kt(o2, r2); + }; +} +function Wt(t2) { + return (n2, e2) => { + let r2 = e2; + for (; ; ) { + const e3 = t2(n2, r2); + if (!e3.success) { + if (e3.fatal) + return e3; + break; + } + if (e3.offset === r2) + break; + r2 = e3.offset; + } + return Mt(r2); + }; +} +function Xt(t2, n2, e2) { + return (r2, o2) => { + const i2 = t2(r2, o2); + if (!i2.success) + return i2; + const s2 = n2(r2, i2.offset); + return s2.success ? kt(s2.offset, e2(i2.value, s2.value)) : s2; + }; +} +function Yt(...t2) { + return (n2, e2) => { + const r2 = []; + for (const o2 of t2) { + const t3 = o2(n2, e2); + if (!t3.success) + return t3; + e2 = t3.offset, r2.push(t3.value); + } + return kt(e2, r2); + }; +} +function Ht(...t2) { + return (n2, e2) => { + for (const r2 of t2) { + const t3 = r2(n2, e2); + if (!t3.success) + return t3; + e2 = t3.offset; + } + return Mt(e2); + }; +} +function jt(t2, n2) { + return t2; +} +function Qt(t2, n2) { + return n2; +} +function Kt(t2) { + return Xt(t2, Wt(t2), Qt); +} +function Gt(t2, n2) { + return Xt(t2, n2, Qt); +} +function Jt(t2, n2) { + return Xt(t2, n2, jt); +} +function Zt(t2, n2, e2, r2 = false) { + return Gt(t2, r2 ? sn(Jt(n2, e2)) : Jt(n2, e2)); +} +function tn(t2) { + return (n2, e2) => { + const r2 = t2(n2, e2); + return r2.success ? kt(r2.offset, n2.slice(e2, r2.offset)) : r2; + }; +} +function nn(t2) { + return (n2, e2) => { + const r2 = t2(n2, e2); + return r2.success ? kt(e2, r2.value) : r2; + }; +} +function en(t2, n2) { + return (e2, r2) => t2(e2, r2).success ? Rt(r2, n2) : Mt(r2); +} +function rn(t2, n2, e2) { + return Gt(en(n2, e2), t2); +} +function on(t2, n2, e2 = 0, r2 = []) { + return (o2, i2) => { + const s2 = o2.codePointAt(i2 + e2); + if (s2 === void 0) + return Rt(i2, r2); + const u2 = t2[s2]; + return u2 === void 0 ? n2 === void 0 ? Rt(i2, r2) : n2(o2, i2) : u2(o2, i2); + }; +} +function sn(t2) { + return (n2, e2) => { + const r2 = t2(n2, e2); + return r2.success ? r2 : Rt(r2.offset, r2.expected, true); + }; +} +const un = (t2, n2) => t2.length === n2 ? Mt(n2) : Rt(n2, ["end of input"]); +function ln(t2) { + return Xt(t2, un, jt); +} +class cn { + constructor(t2, n2) { + this.$ = 0, this.A = 0, this.I = t2, this.k = n2; + } + next() { + if (this.$ >= this.k.length) + return {done: true, value: un(this.I, this.A)}; + const {parser: t2, type: n2} = this.k[this.$], e2 = t2(this.I, this.A); + return e2.success ? (this.A = e2.offset, n2 !== 1 && (this.$ += 1), e2.value === void 0 ? this.next() : {done: false, value: e2.value}) : n2 === 0 || e2.fatal ? {done: true, value: e2} : (this.$ += 1, this.next()); + } +} +function an(t2) { + return (n2, e2) => { + const r2 = e2, o2 = t2(n2, e2); + return o2.success ? kt(o2.offset, Object.assign({input: n2, start: r2, end: o2.offset}, o2.value)) : o2; + }; +} +const hn = Pt("_"), fn = Pt("-"), dn = Pt("."), mn = Pt('"'), pn = Pt("'"), gn = Pt("<"), wn = Pt(">"), yn = Pt("&"), bn = Pt("="), xn = Pt("["), vn = Pt("]"), Nn = Pt(";"), Sn = Pt("%"), En = Pt("("), Tn = Pt(")"), Cn = Pt("+"), Dn = Pt(","), $n = Pt("?"), An = Pt("*"), In = Pt("|"), kn = Pt("]]>"), Mn = Pt(""), Pn = Pt(""), On = Pt("1."), zn = Pt("version"), Fn = Pt("encoding"), Vn = Pt("standalone"), Un = Pt("yes"), qn = Pt("no"), _n = Pt(""), jn = Pt("&#"), Qn = Pt("&#x"), Kn = Pt(" !t2.includes(":"), ["name must not contain colon"], true), Ae = tn(Ot(Te, ["valid name character"])), Ie = an(Ft(Ut(qt([Ft(Zt(Qn, tn(Kt(pe)), Nn, true), (t2) => parseInt(t2, 16)), Ft(Zt(jn, tn(Kt(me)), Nn, true), (t2) => parseInt(t2, 10))]), (t2) => ge(t2), ["character reference must reference a valid character"], true), (t2) => ({type: 0, cp: t2}))), ke = qt([an(Ft(Zt(yn, $e, sn(Nn)), (t2) => ({type: 1, name: t2}))), Ie]), Me = an(Ft(Zt(Sn, $e, Nn), (t2) => ({type: 2, name: t2}))), Re = 38, Pe = qt([Zt(mn, Bt(qt([tn(Ot((t2) => t2 !== 37 && t2 !== Re && t2 !== Le && ge(t2), [])), Me, ke])), mn, true), Zt(pn, Bt(qt([tn(Ot((t2) => t2 !== 37 && t2 !== Re && t2 !== Oe && ge(t2), [])), Me, ke])), pn, true)]), Le = 34, Oe = 39, ze = on({[Le]: Zt(mn, Bt(on({[Re]: ke}, tn(Ot((t2) => t2 !== Be && t2 !== Re && t2 !== Le && ge(t2), [])))), mn, true), [Oe]: Zt(pn, Bt(on({[Re]: ke}, tn(Ot((t2) => t2 !== Be && t2 !== Re && t2 !== Oe && ge(t2), [])))), pn, true)}, void 0, 0, ["quoted attribute value"]), Fe = ln(Bt(qt([tn(Ot((t2) => t2 !== Be && t2 !== Re && ge(t2), [])), ke]))), Ve = Ut(qt([Zt(mn, tn(Ot((t2) => t2 !== Le && ge(t2))), mn), Zt(pn, tn(Ot((t2) => t2 !== Oe && ge(t2))), pn)]), (t2) => !t2.includes("#"), ["system identifier must not contain a fragment identifier"], true); +function Ue(t2) { + return t2 === 32 || t2 === 13 || t2 === 10 || he <= t2 && t2 <= fe || le <= t2 && t2 <= ce || 48 <= t2 && t2 <= 57 || 33 <= t2 && t2 <= 47 && t2 !== 34 && t2 !== 38 || 58 <= t2 && t2 <= 64 && t2 !== 60 && t2 !== 62 || t2 === 95; +} +const qe = ln(Ot(Ue)), _e = qt([Zt(mn, tn(Ot((t2) => t2 !== Le && Ue(t2))), mn, true), Zt(pn, tn(Ot((t2) => t2 !== Oe && Ue(t2))), pn, true)]), Be = 60, We = tn(Kt(qt([Ot((t2) => t2 !== Be && t2 !== Re && t2 !== 93 && ge(t2), []), rn(Vt(vn), kn, [])], ["character data"]))), Comment = Ft(Zt(Mn, tn(Wt(qt([Ot((t2) => t2 !== 45 && ge(t2), []), Jt(Vt(fn), en(fn, ["comment content may not contain --"]))]))), Rn, true), (t2) => ({type: 3, data: t2})), Xe = Ut($e, (t2) => t2.toLowerCase() !== "xml", ['processing instruction target must not be "xml"'], true), Ye = Zt(Pn, Xt(Xe, _t(Gt(be, tn(Wt(qt([Ot((t2) => t2 !== 63 && ge(t2), []), Jt(Vt($n), en(wn, ["PI data"]))]))))), (t2, n2) => ({type: 4, target: t2, data: n2})), Ln, true), He = Pt(" t2 !== 93 && ge(t2), []), rn(Vt(vn), kn, ["CData"])]))), Qe = an(Ft(Zt(He, je, kn, true), (t2) => ({type: 5, data: t2}))), Ke = Zt(_t(be), bn, _t(be)), Ge = tn(Gt(On, Kt(me))), Je = Gt(be, Gt(zn, Gt(Ke, qt([Zt(mn, Ge, mn, true), Zt(pn, Ge, pn, true)])))), Ze = tn(Gt(qt([ae, de]), Wt(qt([ae, de, me, Vt(dn), Vt(hn), Vt(fn)])))), tr = Gt(be, Gt(Fn, Gt(Ke, qt([Zt(mn, Ze, mn, true), Zt(pn, Ze, pn, true)])))), nr = qt([Ft(Un, () => true), Ft(qn, () => false)]), er = Gt(be, Gt(Vn, sn(Gt(Ke, qt([Zt(mn, nr, mn, true), Zt(pn, nr, pn, true)]))))), rr = Zt(Jt(_n, nn(be)), Jt(Xt(Je, Xt(_t(tr), _t(er), (t2, n2) => [t2, n2]), (t2, [n2, e2]) => ({type: 6, version: t2, encoding: n2, standalone: e2})), _t(be)), Ln, true), or = an(Ft(Ce, (t2) => ({name: t2}))), ir = Xt(or, Gt(sn(Ke), sn(ze)), (t2, n2) => ({name: t2, value: n2})), sr = Ft(Yt(gn, or, sn(Jt(Bt(Gt(be, ir)), _t(be))), sn(on({47: Ft(Hn, () => true)}, Ft(wn, () => false), 0, [">", "/>"]))), ([t2, n2, e2, r2]) => ({type: r2 ? 9 : 7, name: n2, attributes: e2})), ur = an(Ft(Zt(Yn, Jt(Ce, _t(be)), wn, true), (t2) => ({type: 8, name: t2}))), lr = qt([$n, An, Cn]), cr = Jt(qt([Vt(Ce), function(t2, n2) { + return ar(t2, n2); +}, function(t2, n2) { + return hr(t2, n2); +}]), Vt(_t(lr))), ar = Ht(En, _t(be), cr, Kt(Yt(_t(be), In, _t(be), sn(cr))), _t(be), Tn); +const hr = Ht(En, _t(be), cr, Wt(Yt(_t(be), Dn, _t(be), sn(cr))), _t(be), Tn); +const fr = Jt(qt([ar, hr]), _t(lr)), dr = Ht(En, _t(be), Zn, qt([Ht(Wt(Ht(_t(be), In, _t(be), Ce)), _t(be), Tn, An), Vt(Jt(_t(be), Tn))])), mr = Jt(Kn, sn(Ht(be, Ce, be, qt([Vt(Gn), Vt(Jn), Vt(dr), Vt(fr)]), _t(be), wn))), pr = Pt("CDATA"), gr = qt([Pt("IDREFS"), Pt("IDREF"), Pt("ID"), Pt("ENTITY"), Pt("ENTITIES"), Pt("NMTOKENS"), Pt("NMTOKEN")]), wr = qt([Jt(ne, sn(Ht(be, En, _t(be), $e, Wt(Ht(_t(be), In, _t(be), $e)), _t(be), Tn))), Jt(En, sn(Ht(_t(be), Ae, Wt(Ht(_t(be), In, _t(be), Ae)), _t(be), Tn)))]), yr = qt([Ft(pr, () => true), Ft(gr, () => false), Ft(wr, () => false)]), br = qt([Ft(ee, () => ({type: 0})), Ft(re, () => ({type: 1})), Xt(Ft(_t(Jt(oe, be)), (t2) => t2 !== null), ze, (t2, n2) => ({type: 2, fixed: t2, value: n2}))]), xr = Xt(Gt(be, or), sn(Xt(Gt(be, yr), Gt(be, br), (t2, n2) => ({isCData: t2, def: n2}))), (t2, {isCData: n2, def: e2}) => ({name: t2, isCData: n2, def: e2})), vr = Zt(Jt(te, be), Xt(Ce, sn(Bt(xr)), (t2, n2) => ({type: 0, name: t2, attdefs: n2})), Gt(_t(be), wn), true), Nr = qt([Ft(Gt(Wn, sn(Gt(be, Ve))), (t2) => ({publicId: null, systemId: t2})), Gt(Xn, Xt(sn(Gt(be, _e)), Gt(be, Ve), (t2, n2) => ({publicId: t2, systemId: n2})))]), Sr = qt([Pe, Xt(Nr, _t(Gt(Zt(be, se, be), $e)), (t2, n2) => ({ids: t2, ndata: n2}))]), Er = Zt(ie, Xt(Gt(be, $e), sn(Gt(be, Sr)), (t2, n2) => ({type: 1, name: t2, value: n2})), Gt(_t(be), wn)), Tr = qt([Pe, Vt(Nr)]), Cr = Zt(Jt(ie, Gt(be, Sn)), Xt(Gt(be, $e), sn(Gt(be, Tr)), (t2, n2) => n2 ? {type: 2, name: t2, value: n2} : void 0), Gt(_t(be), wn), true), Dr = Gt(nn(ie), sn(qt([Er, Cr]))), $r = Zt(Jt(_n, nn(be)), Jt(Xt(_t(Je), tr, (t2, n2) => ({type: 6, version: t2, encoding: n2, standalone: null})), _t(be)), Ln, true), Ar = Ft(Jt(Jt(Xn, be), sn(_e)), (t2) => ({publicId: t2, systemId: null})), Ir = Zt(ue, Xt(Zt(be, $e, be), qt([Vt(Nr), Vt(Ar)]), () => { +}), Gt(_t(be), wn), true), kr = qt([Vt(mr), vr, Dr, Vt(Ir), Vt(Ye), Vt(Comment)]), Mr = qt([Vt(Me), Vt(be)]), Rr = function(t2) { + return Ft(t2, (t3) => t3.filter((t4) => t4 !== void 0)); +}(Bt(qt([kr, Mr]))), Pr = Gt(Bn, sn(Ft(Yt(be, Ce, _t(Gt(be, Nr)), _t(be), _t(Jt(Zt(xn, Rr, vn, true), _t(be))), wn), ([t2, n2, e2, r2, o2, i2]) => ({type: 10, name: n2, ids: e2, intSubset: o2})))), Lr = {parser: on({[Be]: on({47: ur, 33: qt([Comment, Qe]), 63: Ye}, sr, 1), [Re]: ke}, We), type: 1}; +function Or(t2) { + return new cn(t2, [Lr]); +} +const zr = qt([Comment, Ye, be]), Fr = [...[{parser: rr, type: 2}, {parser: zr, type: 1}, {parser: Pr, type: 2}, {parser: zr, type: 1}], ...[{parser: sr, type: 0}, Lr]]; +function Vr(t2) { + return new cn(t2, Fr); +} +const Ur = [{parser: $r, type: 2}, Lr]; +function qr(t2) { + return new cn(t2, Ur); +} +function _r(t2) { + return Array.from(t2, (t3) => Yr(t3) ? t3 : "[invalid character]").join(""); +} +function Br(t2, n2, e2) { + const r2 = Array.from(t2); + if (r2.length < e2) + return t2; + switch (n2) { + case 0: + return "\u2026" + r2.slice(-e2).join(""); + case 1: + return r2.slice(0, e2).join("") + "\u2026"; + } + const o2 = 0 | Math.min(r2.length / 2, e2 / 2); + return r2.slice(0, o2).join("") + "\u2026" + r2.slice(-o2).join(""); +} +function Wr(t2, n2) { + const {line: e2, char: r2} = function(t3, n3) { + let e3 = 1, r3 = 1, o2 = 0; + for (; o2 < n3; ) { + const n4 = t3.codePointAt(o2); + r3++, o2 += n4 > 65535 ? 2 : 1, n4 === 10 && (e3++, r3 = 1); + } + return {line: e3, char: r3}; + }(n2.input, n2.start); + throw new Error(`${t2} +${`At line ${e2}, character ${r2}:`} + +${function(t3, n3, e3) { + const r3 = Br(_r(t3.substring(n3, e3)), 2, 30), o2 = t3.lastIndexOf("\n", n3), i2 = Br(_r(t3.substring(o2 + 1, n3)), 0, 55 - r3.length), s2 = t3.indexOf("\n", e3), u2 = Br(_r(s2 > 0 ? t3.substring(e3, s2) : t3.substring(e3)), 1, 80 - r3.length - i2.length), l2 = Array.from(i2, (t4) => jr(t4) ? t4 : " ").join(""); + return `${i2}${r3}${u2} +${l2}${"^".repeat(Math.max(Array.from(r3).length, 1))}`; + }(n2.input, n2.start, n2.end)}`); +} +function Xr(t2, n2, e2, r2) { + const o2 = Array.from(new Set(e2), (t3) => t3.includes('"') ? `'${t3}'` : `"${t3}"`), i2 = n2.codePointAt(r2), s2 = i2 ? String.fromCodePoint(i2) : ""; + Wr(`Parsing ${t2} failed, expected ${o2.length > 1 ? "one of " + o2.join(", ") : o2[0]}`, {input: n2, start: r2, end: r2 + Math.max(s2.length, 1)}); +} +function Yr(t2) { + return we(t2, 0).success; +} +function Hr(t2) { + return De(t2, 0).success; +} +function jr(t2) { + return xe(t2, 0).success; +} +function Qr(t2) { + const n2 = []; + for (const e2 of t2) + if (typeof e2 != "string") + switch (e2.type) { + case 0: + n2.push(String.fromCodePoint(e2.cp)); + break; + case 1: + n2.push(`&${e2.name};`); + break; + case 2: + Wr(`reference to parameter entity "${e2.name}" must not occur in an entity declaration in the internal subset`, e2); + } + else + n2.push(e2); + return n2.join(""); +} +class Kr { + constructor(t2) { + if (this.M = new Map(), this.R = new Map(), this.P = new Set(), this.L = new Set(), t2.intSubset) + for (const n2 of t2.intSubset) + switch (n2.type) { + case 0: { + for (const t4 of n2.attdefs) + if (t4.def.type === 2) + for (const n3 of t4.def.value) + typeof n3 != "string" && n3.type === 1 && (this.R.has(n3.name) || this.P.has(n3.name) || this.L.has(n3.name) || Wr(`default value of attribute "${t4.name.name}" contains reference to undefined entity "${n3.name}"`, n3), this.P.has(n3.name) && Wr(`default value of attribute "${t4.name.name}" must not contain reference to external entity "${n3.name}"`, n3)); + let t3 = this.M.get(n2.name); + t3 === void 0 && (t3 = new Map(), this.M.set(n2.name, t3)); + for (const e2 of n2.attdefs) + t3.has(e2.name.name) || t3.set(e2.name.name, e2); + break; + } + case 2: + if (Array.isArray(n2.value)) + for (const t3 of n2.value) + typeof t3 != "string" && t3.type === 2 && Wr(`reference to parameter entity "${t3.name}" must not occur in an entity declaration in the internal subset`, t3); + break; + case 1: + if (this.R.has(n2.name) || this.P.has(n2.name)) + continue; + Array.isArray(n2.value) ? this.R.set(n2.name, Qr(n2.value)) : n2.value.ndata === null ? this.P.add(n2.name) : this.L.add(n2.name); + } + } + getAttlist(t2) { + return this.M.get(t2.name); + } + getEntityReplacementText(t2, n2) { + const e2 = this.R.get(t2.name); + if (e2 === void 0 && (this.L.has(t2.name) && Wr(`reference to binary entity "${t2.name}" is not allowed`, t2), this.P.has(t2.name))) { + if (n2) + return ""; + Wr(`reference to external entity "${t2.name}" is not allowed in attribute value`, t2); + } + return e2; + } +} +const Gr = new Map([["lt", "<"], ["gt", ">"], ["amp", "&"], ["apos", "'"], ["quot", '"']]); +function Jr(t2, n2, e2, r2) { + for (const o2 of n2) { + if (typeof o2 == "string") { + t2.push(o2.replace(/[\r\n\t]/g, " ")); + continue; + } + if (o2.type === 0) { + t2.push(String.fromCodePoint(o2.cp)); + continue; + } + r2 !== null && r2.includes(o2.name) && Wr(`reference to entity "${o2.name}" must not be recursive`, o2); + let n3 = Gr.get(o2.name); + n3 === void 0 && e2 !== null && (n3 = e2.getEntityReplacementText(o2, false)), n3 === void 0 && Wr(`reference to unknown entity "${o2.name}" in attribute value`, o2); + const i2 = Fe(n3, 0); + i2.success || Xr(`replacement text for entity "${o2.name}"`, n3, i2.expected, i2.offset), Jr(t2, i2.value, e2, r2 ? [o2.name, ...r2] : [o2.name]); + } +} +function Zr(t2, n2, e2) { + const r2 = []; + return Jr(r2, t2, e2, null), n2 && !n2.isCData ? r2.join("").replace(/[ ]+/g, " ").replace(/^[ ]+|[ ]+$/g, "") : r2.join(""); +} +function to(t2, n2) { + const e2 = t2.name, r2 = n2.get(e2); + if (r2 !== void 0) + return r2; + let o2 = null, i2 = e2; + const s2 = e2.indexOf(":"); + s2 >= 0 && (o2 = e2.substring(0, s2), i2 = e2.substring(s2 + 1)), (o2 === "" || i2 === "" || i2.includes(":")) && Wr(`the name "${e2}" is not a valid qualified name`, t2); + const u2 = {prefix: o2, localName: i2}; + return n2.set(e2, u2), u2; +} +class no { + constructor(t2, n2 = null) { + var e2; + this.O = new Map(), this.F = null, this.V = t2, this.F = (e2 = n2 != null ? n2 : t2 == null ? void 0 : t2.F) !== null && e2 !== void 0 ? e2 : null; + } + getForElement(t2, n2) { + t2 === "xmlns" && Wr('element names must not have the prefix "xmlns"', n2); + for (let n3 = this; n3 !== null; n3 = n3.V) { + const e2 = n3.O.get(t2); + if (e2 !== void 0) + return e2; + } + if (t2 !== null && this.F) { + const n3 = this.F(t2); + if (n3 !== void 0) + return n3; + } + Wr(`use of undeclared element prefix "${t2}"`, n2); + } + getForAttribute(t2, n2, e2) { + if (t2 === null) + return n2 === "xmlns" ? Dt : null; + for (let n3 = this; n3 !== null; n3 = n3.V) { + const e3 = n3.O.get(t2); + if (e3 !== void 0) + return e3; + } + if (this.F) { + const n3 = this.F(t2); + if (n3 !== void 0) + return n3; + } + Wr(`use of undeclared attribute prefix ${t2}`, e2); + } + static fromAttrs(t2, n2, e2, r2, o2) { + let i2 = t2, s2 = false; + const u2 = (n3, e3, r3) => { + n3 !== null || e3 !== Ct && e3 !== Dt || Wr(`the namespace "${e3}" must not be used as the default namespace`, r3), e3 === Dt && Wr(`the namespace "${Dt}" must not be bound to a prefix`, r3), e3 === Ct && n3 !== "xml" && Wr(`the namespace "${Ct}" must be bound only to the prefix "xml"`, r3), e3 !== Ct && n3 === "xml" && Wr(`the xml namespace prefix must not be bound to any namespace other than "${Ct}"`, r3), n3 !== null && e3 === null && Wr(`the prefix "${n3}" must not be undeclared`, r3), s2 || (i2 = new no(t2), s2 = true), i2.O.set(n3, e3); + }, l2 = (t3, n3) => { + const {prefix: l3, localName: c2} = to(t3, o2), a2 = e2 == null ? void 0 : e2.get(t3.name); + if (l3 !== null || c2 !== "xmlns" || s2 && i2.O.has(null)) { + if (!(l3 !== "xmlns" || s2 && i2.O.has(c2))) { + c2 === "xmlns" && Wr('the "xmlns" namespace prefix must not be declared', t3); + const e3 = Zr(n3, a2, r2) || null; + u2(c2, e3, t3); + } + } else { + const e3 = Zr(n3, a2, r2) || null; + u2(null, e3, t3); + } + }; + for (const t3 of n2.attributes) + l2(t3.name, t3.value); + if (e2) + for (const t3 of e2.values()) { + const n3 = t3.def; + n3.type === 2 && l2(t3.name, n3.value); + } + return i2; + } + static default(t2) { + const n2 = new no(null, t2); + return n2.O.set(null, null), n2.O.set("xml", Ct), n2.O.set("xmlns", Dt), n2; + } +} +const eo = no.default(null); +function ro(t2, n2) { + B(n2, t2, null, true); +} +const oo = 100, io = 4194304; +function so(t2, n2, e2, r2, {entityExpansionMaxAmplification: o2 = oo, entityExpansionThreshold: i2 = io}) { + var s2, u2; + const l2 = p(r2); + let c2 = {parent: null, root: r2, namespaces: e2, entityRoot: true}, a2 = null; + const f2 = new Map(); + let d2 = []; + function m2() { + if (d2.length > 0) { + const t3 = d2.join(""); + if (c2.root === l2) { + if (!jr(t3)) + throw new Error("document must not contain text outside of elements"); + } else + ro(c2.root, l2.createTextNode(d2.join(""))); + d2.length = 0; + } + } + const g2 = (t2 = function(t3) { + return t3.replace(/\r\n?/g, "\n"); + }(t2 = t2.replace(/^\ufeff/, ""))).length; + let w2 = g2, y2 = null, b2 = {parent: null, entity: null, iterator: n2(t2)}; + for (; b2; ) { + let n3 = b2.iterator.next(); + for (; !n3.done; n3 = b2.iterator.next()) { + const t3 = n3.value; + if (typeof t3 != "string") { + switch (t3.type) { + case 0: + c2.root === l2 && l2.documentElement !== null && Wr("character reference must not appear after the document element", t3), d2.push(String.fromCodePoint(t3.cp)); + continue; + case 1: { + c2.root === l2 && l2.documentElement !== null && Wr(`reference to entity "${t3.name}" must not appear after the document element`, t3); + for (let n5 = b2; n5; n5 = n5.parent) + n5.entity === t3.name && Wr(`reference to entity "${t3.name}" must not be recursive`, t3); + let n4 = Gr.get(t3.name); + if (n4 === void 0 && a2 !== null && (n4 = a2.getEntityReplacementText(t3, true)), n4 === void 0 && Wr(`reference to unknown entity "${t3.name}" in content`, t3), y2 === null && (y2 = t3), w2 += n4.length, w2 > i2) { + w2 / g2 > o2 && Wr("too much entity expansion", y2); + } + c2 = {parent: c2, root: c2.root, namespaces: c2.namespaces, entityRoot: true}, b2 = {parent: b2, entity: t3.name, iterator: Or(n4)}; + continue; + } + } + switch (m2(), t3.type) { + case 5: + c2.root === l2 && l2.documentElement !== null && Wr("CData section must not appear after the document element", t3), ro(c2.root, l2.createCDATASection(t3.data)); + continue; + case 3: + ro(c2.root, l2.createComment(t3.data)); + continue; + case 10: + a2 = new Kr(t3), ro(c2.root, l2.implementation.createDocumentType(t3.name, ((s2 = t3.ids) === null || s2 === void 0 ? void 0 : s2.publicId) || "", ((u2 = t3.ids) === null || u2 === void 0 ? void 0 : u2.systemId) || "")); + continue; + case 4: + ro(c2.root, l2.createProcessingInstruction(t3.target, t3.data || "")); + continue; + case 7: + case 9: { + c2.root === l2 && l2.documentElement !== null && Wr(`document must contain a single root element, but found "${l2.documentElement.nodeName}" and "${t3.name.name}"`, t3.name); + const n4 = a2 ? a2.getAttlist(t3.name) : void 0, e3 = no.fromAttrs(c2.namespaces, t3, n4, a2, f2), {prefix: r3, localName: o3} = to(t3.name, f2), i3 = e3.getForElement(r3, t3.name), s3 = St(l2, o3, i3, r3); + for (const r4 of t3.attributes) { + const {prefix: o4, localName: i4} = to(r4.name, f2), u3 = e3.getForAttribute(o4, i4, r4.name), l3 = n4 == null ? void 0 : n4.get(r4.name.name); + s3.hasAttributeNS(u3, i4) && Wr(`attribute "${r4.name.name}" must not appear multiple times on element "${t3.name.name}"`, r4.name); + gt(Nt(u3, o4, i4, Zr(r4.value, l3, a2), s3), s3, true); + } + if (n4) + for (const t4 of n4.values()) { + const n5 = t4.def; + if (n5.type !== 2) + continue; + const {prefix: r4, localName: o4} = to(t4.name, f2), i4 = e3.getForAttribute(r4, o4, t4.name); + if (s3.hasAttributeNS(i4, o4)) + continue; + gt(Nt(i4, r4, o4, Zr(n5.value, t4, a2), s3), s3, true); + } + ro(c2.root, s3), t3.type === 7 && (c2 = {parent: c2, root: s3, namespaces: e3, entityRoot: false}); + continue; + } + case 8: + h(c2.root) && c2.root.nodeName === t3.name || Wr(`non-well-formed element: found end tag "${t3.name}" but expected ${h(c2.root) ? `"${c2.root.nodeName}"` : "no such tag"}`, t3), c2 = c2.parent; + continue; + } + } else + d2.push(t3); + } + if (n3.value.success || Xr(b2.entity ? `replacement text for entity ${b2.entity}` : r2 === l2 ? "document" : "fragment", t2, n3.value.expected, n3.value.offset), !c2.entityRoot) + throw new Error(`${b2.entity ? `replacement text for entity "${b2.entity}"` : r2 === l2 ? "document" : "fragment"} is not well-formed - element "${c2.root.nodeName}" is missing a closing tag`); + b2 = b2.parent, b2 && (c2 = c2.parent, b2.entity === null && (y2 = null)); + } + m2(); +} +function uo(t2, n2 = {}) { + const e2 = new Document().createDocumentFragment(); + return so(t2, qr, n2.resolveNamespacePrefix ? no.default(n2.resolveNamespacePrefix) : eo, e2, {}), e2; +} +function lo(t2, n2 = {}) { + const e2 = new Document(); + return so(t2, Vr, eo, e2, n2), e2; +} +class co { + constructor() { + this.U = new Map(); + } + copy() { + const t2 = new co(); + for (const [n2, e2] of Array.from(this.U.entries())) + t2.U.set(n2, e2.concat()); + return t2; + } + retrievePreferredPrefixString(t2, n2) { + const e2 = this.U.get(n2); + if (e2 === void 0) + return null; + for (const n3 of e2) + if (n3 === t2) + return n3; + return e2[e2.length - 1]; + } + checkIfFound(t2, n2) { + const e2 = this.U.get(n2); + return e2 !== void 0 && e2.indexOf(t2) >= 0; + } + add(t2, n2) { + const e2 = this.U.get(n2); + e2 === void 0 ? this.U.set(n2, [t2]) : e2.push(t2); + } +} +const ao = ["area", "base", "basefont", "bgsound", "br", "col", "embed", "frame", "hr", "img", "input", "keygen", "link", "menuitem", "meta", "param", "source", "track", "wbr"]; +function ho(t2, n2, e2 = false) { + const r2 = e2 ? [t2] : t2.childNodes, o2 = []; + for (const t3 of r2) + fo(t3, n2, o2); + return o2.join(""); +} +function fo(t2, n2, e2) { + const r2 = new co(); + r2.add("xml", Ct); + const o2 = {value: 1}; + try { + mo(t2, null, r2, o2, n2, e2); + } catch (t3) { + return I(t3.message); + } +} +function mo(t2, n2, e2, r2, o2, i2) { + switch (t2.nodeType) { + case 1: + return void function(t3, n3, e3, r3, o3, i3) { + const s2 = t3; + if (o3 && (s2.localName.indexOf(":") >= 0 || !Hr(s2.localName))) + throw new Error(`Can not serialize an element because the localName "${s2.localName}" is not allowed.`); + i3.push("<"); + let u2 = "", l2 = false, c2 = false; + const a2 = e3.copy(), h2 = {}, f2 = function(t4, n4, e4) { + let r4 = null; + for (const o4 of t4.attributes) { + const t5 = o4.namespaceURI, i4 = o4.prefix; + if (t5 === Dt) { + if (i4 === null) { + r4 = o4.value; + continue; + } + const t6 = o4.localName; + let s3 = o4.value; + if (s3 === Ct) + continue; + if (s3 === "" && (s3 = null), n4.checkIfFound(t6, s3)) + continue; + n4.add(t6, s3), e4[t6] = s3 === null ? "" : s3; + } + } + return r4; + }(s2, a2, h2); + let d2 = n3; + const m2 = s2.namespaceURI; + if (d2 === m2) + f2 !== null && (c2 = true), u2 += m2 === Ct ? "xml:" + s2.localName : s2.localName, i3.push(u2); + else { + let t4 = s2.prefix, n4 = a2.retrievePreferredPrefixString(t4, m2); + if (t4 === "xmlns") { + if (o3) + throw new Error('Can not serialize an element with prefix "xmlns" because it will not legally round-trip in a conforming XML parser.'); + n4 = t4; + } + n4 !== null ? (u2 += n4 + ":" + s2.localName, f2 !== null && f2 !== Ct && (d2 = f2 === "" ? null : f2), i3.push(u2)) : t4 !== null ? (t4 in h2 && (t4 = go(a2, m2, r3)), a2.add(t4, m2), u2 += t4 + ":" + s2.localName, i3.push(u2), i3.push(" xmlns:", t4, '="', po(m2, o3), '"'), f2 !== null && (d2 = f2 === "" ? null : f2)) : f2 === null || f2 !== null && f2 !== m2 ? (c2 = true, u2 += s2.localName, d2 = m2, i3.push(u2), i3.push(' xmlns="', po(m2, o3), '"')) : (u2 += s2.localName, d2 = m2, i3.push(u2)); + } + (function(t4, n4, e4, r4, o4, i4, s3) { + const u3 = []; + for (const l3 of t4.attributes) { + if (i4 && u3.find((t6) => t6.localName === l3.localName && t6.namespaceURI === l3.namespaceURI)) + throw new Error(`Can not serialize a duplicate attribute for namespaceURI "${l3.namespaceURI}", localName "${l3.localName}".`); + u3.push({namespaceURI: l3.namespaceURI, localName: l3.localName}); + const t5 = l3.namespaceURI; + let c3 = null; + if (t5 !== null) + if (c3 = n4.retrievePreferredPrefixString(l3.prefix, t5), t5 === Dt) { + if (l3.value === Ct) + continue; + if (l3.prefix === null && o4) + continue; + if (l3.prefix !== null && (!(l3.localName in r4) || r4[l3.localName] !== l3.value)) + continue; + if (i4 && l3.value === Dt) + throw new Error("The serialization of this attribute would produce invalid XML because the XMLNS namespace is reserved and cannot be applied as an element's namespace via XML parsing."); + if (i4 && l3.prefix !== null && l3.value === "") + throw new Error("Namespace prefix declarations cannot be used to undeclare a namespace. Use a default namespace declaration instead."); + l3.prefix === "xmlns" && (c3 = "xmlns"); + } else + c3 === null && (c3 = l3.prefix === null || l3.prefix in r4 ? go(n4, t5, e4) : l3.prefix, n4.add(c3, l3.namespaceURI), r4[c3] = l3.namespaceURI, s3.push(" xmlns:", c3, '="', po(t5, i4), '"')); + if (s3.push(" "), c3 !== null && s3.push(c3, ":"), i4 && (l3.localName.indexOf(":") >= 0 || !Hr(l3.localName) || l3.localName === "xmlns" && t5 === null)) + throw new Error(`Can not serialize an attribute because the localName "${l3.localName}" is not allowed.`); + s3.push(l3.localName, '="', po(l3.value, i4), '"'); + } + })(s2, a2, r3, h2, c2, o3, i3), m2 === Tt && !s2.hasChildNodes() && ao.indexOf(s2.localName) >= 0 && (i3.push(" /"), l2 = true); + m2 === Tt || s2.hasChildNodes() || (i3.push("/"), l2 = true); + if (i3.push(">"), l2) + return; + for (const n4 of t3.childNodes) + mo(n4, d2, a2, r3, o3, i3); + i3.push(""); + }(t2, n2, e2, r2, o2, i2); + case 9: + return void function(t3, n3, e3, r3, o3, i3) { + const s2 = t3; + if (o3 && s2.documentElement === null) + throw new Error("Can not serialize a document with no documentElement."); + for (const t4 of s2.childNodes) + mo(t4, n3, e3, r3, o3, i3); + }(t2, n2, e2, r2, o2, i2); + case 8: + return void function(t3, n3, e3, r3, o3, i3) { + const s2 = t3; + if (o3 && (!Yr(s2.data) || s2.data.indexOf("--") >= 0 || s2.data.endsWith("-"))) + throw new Error("Can not serialize a comment because it contains invalid characters."); + i3.push(""); + }(t2, 0, 0, 0, o2, i2); + case 4: + return void function(t3, n3, e3, r3, o3, i3) { + const s2 = t3; + i3.push(""); + }(t2, 0, 0, 0, 0, i2); + case 3: + return void function(t3, n3, e3, r3, o3, i3) { + const s2 = t3; + if (o3 && !Yr(s2.data)) + throw new Error("Can not serialize a text node because it contains invalid characters."); + let u2 = s2.data; + u2 = u2.replace(/&/g, "&"), u2 = u2.replace(//g, ">"), i3.push(u2); + }(t2, 0, 0, 0, o2, i2); + case 11: + return void function(t3, n3, e3, r3, o3, i3) { + for (const s2 of t3.childNodes) + mo(s2, n3, e3, r3, o3, i3); + }(t2, n2, e2, r2, o2, i2); + case 10: + return void function(t3, n3, e3, r3, o3, i3) { + const s2 = t3; + if (o3 && (u2 = s2.publicId, !qe(u2, 0).success)) + throw new Error("Can not serialize a document type because the publicId contains invalid characters."); + var u2; + if (o3 && (!Yr(s2.systemId) || s2.systemId.indexOf('"') >= 0 && s2.systemId.indexOf("'") >= 0)) + throw new Error("Can not serialize a document type because the systemId contains invalid characters."); + i3.push(""); + }(t2, 0, 0, 0, o2, i2); + case 7: + return void function(t3, n3, e3, r3, o3, i3) { + const s2 = t3; + if (o3) { + if (s2.target.indexOf(":") >= 0) + throw new Error(`Can not serialize a processing instruction because the target "${s2.target}" may not contain ":".`); + if (s2.target.toLowerCase() === "xml") + throw new Error('Can not serialize a processing instruction because "xml" may not be used as target.'); + } + if (o3 && (!Yr(s2.data) || s2.data.indexOf("?>") >= 0)) + throw new Error("Can not serialize a processing instruction because the data contains invalid characters."); + i3.push(""); + }(t2, 0, 0, 0, o2, i2); + case 2: + return; + default: + throw new TypeError("Only Nodes and Attr objects can be serialized by this algorithm."); + } +} +function po(t2, n2) { + if (n2 && t2 !== null && !Yr(t2)) + throw new Error("Can not serialize an attribute value because it contains invalid characters."); + return t2 === null ? "" : t2.replace(/&/g, "&").replace(/"/g, """).replace(//g, ">").replace(/\t/g, " ").replace(/\n/g, " ").replace(/\r/g, " "); +} +function go(t2, n2, e2) { + const r2 = "ns" + e2.value; + return e2.value += 1, t2.add(r2, n2), r2; +} +class Element extends Node { + get nodeType() { + return 1; + } + get nodeName() { + return this.tagName; + } + get nodeValue() { + return null; + } + set nodeValue(t2) { + } + get textContent() { + return Q(this); + } + set textContent(t2) { + K(this, t2 = lt(t2)); + } + lookupPrefix(t2) { + return N(arguments, 1), (t2 = ht(t2)) === null || t2 === "" ? null : It(this, t2); + } + lookupNamespaceURI(t2) { + if (N(arguments, 1), (t2 = ht(t2)) === "" && (t2 = null), this.namespaceURI !== null && this.prefix === t2) + return this.namespaceURI; + let n2 = null; + if (t2 !== null) { + const e3 = this.getAttributeNodeNS(Dt, t2); + e3 && e3.prefix === "xmlns" && (n2 = e3.value); + } else { + const t3 = this.getAttributeNodeNS(Dt, "xmlns"); + t3 && t3.prefix === null && (n2 = t3.value); + } + if (n2 !== null) + return n2 !== "" ? n2 : null; + const e2 = this.parentElement; + return e2 === null ? null : e2.lookupNamespaceURI(t2); + } + before(...t2) { + nt(this, t2); + } + after(...t2) { + et(this, t2); + } + replaceWith(...t2) { + rt(this, t2); + } + remove() { + ot(this); + } + get children() { + return z(this); + } + prepend(...t2) { + J(this, t2); + } + append(...t2) { + Z(this, t2); + } + replaceChildren(...t2) { + tt(this, t2); + } + get previousElementSibling() { + return F(this); + } + get nextElementSibling() { + return V(this); + } + constructor(t2, n2, e2) { + super(), this.firstElementChild = null, this.lastElementChild = null, this.childElementCount = 0, this.attributes = [], this.namespaceURI = t2, this.prefix = n2, this.localName = e2, this.tagName = n2 === null ? e2 : `${n2}:${e2}`; + } + hasAttributes() { + return this.attributes.length > 0; + } + getAttribute(t2) { + N(arguments, 1); + const n2 = yo(t2 = String(t2), this); + return n2 === null ? null : n2.value; + } + getAttributeNS(t2, n2) { + N(arguments, 2); + const e2 = bo(t2 = ht(t2), n2 = String(n2), this); + return e2 === null ? null : e2.value; + } + setAttribute(t2, n2) { + N(arguments, 2), t2 = String(t2), n2 = String(n2), Hr(t2) || $("The qualified name does not match the Name production"); + const e2 = yo(t2, this); + if (e2 === null) { + const e3 = new (s()).Attr(null, null, t2, n2, this); + return e3.ownerDocument = this.ownerDocument, void gt(e3, this); + } + pt(e2, n2); + } + setAttributeNS(t2, n2, e2) { + N(arguments, 3), t2 = ht(t2), n2 = String(n2), e2 = String(e2); + const {namespace: r2, prefix: o2, localName: i2} = At(t2, n2); + !function(t3, n3, e3, r3, o3) { + const i3 = bo(o3, n3, t3); + if (i3 === null) { + const i4 = new (s()).Attr(o3, r3, n3, e3, t3); + return i4.ownerDocument = t3.ownerDocument, void gt(i4, t3); + } + pt(i3, e3); + }(this, i2, e2, o2, r2); + } + removeAttribute(t2) { + N(arguments, 1), vo(t2 = String(t2), this); + } + removeAttributeNS(t2, n2) { + N(arguments, 2), function(t3, n3, e2) { + const r2 = bo(t3, n3, e2); + r2 !== null && wt(r2); + }(t2 = ht(t2), n2 = String(n2), this); + } + toggleAttribute(t2, n2) { + Hr(t2) || $("The qualified name does not match the Name production"); + if (yo(t2, this) === null) { + if (n2 === void 0 || n2 === true) { + const n3 = new (s()).Attr(null, null, t2, "", this); + return n3.ownerDocument = this.ownerDocument, gt(n3, this), true; + } + return false; + } + return n2 !== void 0 && n2 !== false || (vo(t2, this), false); + } + hasAttribute(t2) { + return N(arguments, 1), yo(t2 = String(t2), this) !== null; + } + hasAttributeNS(t2, n2) { + return N(arguments, 2), bo(t2 = ht(t2), n2 = String(n2), this) !== null; + } + getAttributeNode(t2) { + return N(arguments, 1), yo(t2 = String(t2), this); + } + getAttributeNodeNS(t2, n2) { + return N(arguments, 2), bo(t2 = ht(t2), n2 = String(n2), this); + } + setAttributeNode(t2) { + return N(arguments, 1), xo(t2 = ct(t2, Attr), this); + } + setAttributeNodeNS(t2) { + return N(arguments, 1), xo(t2 = ct(t2, Attr), this); + } + removeAttributeNode(t2) { + return N(arguments, 1), t2 = ct(t2, Attr), this.attributes.indexOf(t2) < 0 && M("the specified attribute does not exist"), wt(t2), t2; + } + getElementsByTagName(t2) { + return N(arguments, 1), b(t2 = String(t2), this); + } + getElementsByTagNameNS(t2, n2) { + return N(arguments, 2), x(t2 = ht(t2), n2 = String(n2), this); + } + T(t2) { + const n2 = wo(t2, this.localName, this.namespaceURI, this.prefix); + for (const e2 of this.attributes) { + const r2 = e2.T(t2); + n2.setAttributeNode(r2); + } + return n2; + } + get innerHTML() { + return ho(this, true); + } + get outerHTML() { + return ho(this, true, true); + } +} +function wo(t2, n2, e2, r2 = null) { + let o2 = null; + return o2 = new (s()).Element(e2, r2, n2), o2.ownerDocument = t2, o2; +} +function yo(t2, n2) { + return n2.attributes.find((n3) => n3.name === t2) || null; +} +function bo(t2, n2, e2) { + return t2 === "" && (t2 = null), e2.attributes.find((e3) => e3.namespaceURI === t2 && e3.localName === n2) || null; +} +function xo(t2, n2) { + t2.ownerElement !== null && t2.ownerElement !== n2 && function(t3) { + throw T("InUseAttributeError", t3); + }("attribute is in use by another element"); + const e2 = bo(t2.namespaceURI, t2.localName, n2); + return e2 === t2 ? t2 : (e2 !== null ? function(t3, n3) { + const e3 = t3.ownerElement; + mt(t3, e3, t3.value, n3.value), e3.attributes.splice(e3.attributes.indexOf(t3), 1, n3), n3.ownerElement = e3, t3.ownerElement = null; + }(e2, t2) : gt(t2, n2), e2); +} +function vo(t2, n2) { + const e2 = yo(t2, n2); + return e2 !== null && wt(e2), e2; +} +function No(t2, n2, e2) { + const {namespace: r2, prefix: o2, localName: i2} = At(n2, e2); + return wo(t2, i2, r2, o2); +} +class DOMImplementation { + constructor(t2) { + this.q = t2; + } + createDocumentType(t2, n2, e2) { + N(arguments, 3), t2 = String(t2), n2 = String(n2), e2 = String(e2), $t(t2); + const r2 = new (s(this.q)).DocumentType(t2, n2, e2); + return r2.ownerDocument = this.q, r2; + } + createDocument(t2, n2, e2 = null) { + N(arguments, 2), t2 = ht(t2), n2 = ut(n2), e2 = at(e2, DocumentType); + const r2 = new (s(this.q)).XMLDocument(); + let o2 = null; + return n2 !== "" && (o2 = No(r2, t2, n2)), e2 && r2.appendChild(e2), o2 && r2.appendChild(o2), r2; + } + createHTMLDocument(t2) { + t2 = ht(t2); + const n2 = s(this.q), e2 = new n2.Document(), r2 = new n2.DocumentType("html"); + r2.ownerDocument = e2, e2.appendChild(r2); + const o2 = wo(e2, "html", Tt); + e2.appendChild(o2); + const i2 = wo(e2, "head", Tt); + if (o2.appendChild(i2), t2 !== null) { + const n3 = wo(e2, "title", Tt); + i2.appendChild(n3), n3.appendChild(e2.createTextNode(t2)); + } + return o2.appendChild(wo(e2, "body", Tt)), e2; + } +} +class Document extends Node { + get nodeType() { + return 9; + } + get nodeName() { + return "#document"; + } + get nodeValue() { + return null; + } + set nodeValue(t2) { + } + get textContent() { + return null; + } + set textContent(t2) { + } + lookupPrefix(t2) { + return N(arguments, 1), this.documentElement !== null ? this.documentElement.lookupPrefix(t2) : null; + } + lookupNamespaceURI(t2) { + return N(arguments, 1), this.documentElement === null ? null : this.documentElement.lookupNamespaceURI(t2); + } + get children() { + return z(this); + } + prepend(...t2) { + J(this, t2); + } + append(...t2) { + Z(this, t2); + } + replaceChildren(...t2) { + tt(this, t2); + } + constructor() { + super(), this.firstElementChild = null, this.lastElementChild = null, this.childElementCount = 0, this.implementation = new DOMImplementation(this), this.doctype = null, this.documentElement = null; + } + getElementsByTagName(t2) { + return N(arguments, 1), b(t2 = String(t2), this); + } + getElementsByTagNameNS(t2, n2) { + return N(arguments, 2), x(t2 = ht(t2), n2 = String(n2), this); + } + createElement(t2) { + N(arguments, 1), Hr(t2 = String(t2)) || $("The local name is not a valid Name"); + return wo(this, t2, null, null); + } + createElementNS(t2, n2) { + return N(arguments, 2), No(this, t2 = ht(t2), n2 = String(n2)); + } + createDocumentFragment() { + const t2 = new (s()).DocumentFragment(); + return t2.ownerDocument = this, t2; + } + createTextNode(t2) { + N(arguments, 1), t2 = String(t2); + const n2 = new (s()).Text(t2); + return n2.ownerDocument = this, n2; + } + createCDATASection(t2) { + N(arguments, 1), (t2 = String(t2)).indexOf("]]>") >= 0 && $('Data must not contain the string "]]>"'); + const n2 = new (s()).CDATASection(t2); + return n2.ownerDocument = this, n2; + } + createComment(t2) { + N(arguments, 1), t2 = String(t2); + const n2 = new (s()).Comment(t2); + return n2.ownerDocument = this, n2; + } + createProcessingInstruction(t2, n2) { + N(arguments, 2), t2 = String(t2), n2 = String(n2), Hr(t2) || $("The target is not a valid Name"), n2.indexOf("?>") >= 0 && $('Data must not contain the string "?>"'); + const e2 = new (s()).ProcessingInstruction(t2, n2); + return e2.ownerDocument = this, e2; + } + importNode(t2, n2 = false) { + return N(arguments, 1), u(t2 = ct(t2, Node), 9) && R("importing a Document node is not supported"), v(t2, n2, this); + } + adoptNode(t2) { + return N(arguments, 1), u(t2 = ct(t2, Node), 9) && R("adopting a Document node is not supported"), j(t2, this), t2; + } + createAttribute(t2) { + N(arguments, 1), Hr(t2 = String(t2)) || $("The local name is not a valid Name"); + const n2 = new (s()).Attr(null, null, t2, "", null); + return n2.ownerDocument = this, n2; + } + createAttributeNS(t2, n2) { + N(arguments, 2), t2 = ht(t2), n2 = String(n2); + const {namespace: e2, prefix: r2, localName: o2} = At(t2, n2), i2 = new (s()).Attr(e2, r2, o2, "", null); + return i2.ownerDocument = this, i2; + } + createRange() { + const t2 = new (s()).Range(); + return t2.startContainer = this, t2.startOffset = 0, t2.endContainer = this, t2.endOffset = 0, t2; + } + T(t2) { + return new (s()).Document(); + } +} +class DocumentFragment extends Node { + get nodeType() { + return 11; + } + get nodeName() { + return "#document-fragment"; + } + get nodeValue() { + return null; + } + set nodeValue(t2) { + } + get textContent() { + return Q(this); + } + set textContent(t2) { + K(this, t2 = lt(t2)); + } + lookupPrefix(t2) { + return N(arguments, 1), null; + } + lookupNamespaceURI(t2) { + return N(arguments, 1), null; + } + get children() { + return z(this); + } + prepend(...t2) { + J(this, t2); + } + append(...t2) { + Z(this, t2); + } + replaceChildren(...t2) { + tt(this, t2); + } + constructor() { + super(), this.firstElementChild = null, this.lastElementChild = null, this.childElementCount = 0; + const t2 = s(); + this.ownerDocument = t2.document; + } + T(t2) { + const n2 = new (s()).DocumentFragment(); + return n2.ownerDocument = t2, n2; + } +} +class ProcessingInstruction extends CharacterData { + get nodeType() { + return 7; + } + get nodeName() { + return this.target; + } + constructor(t2, n2) { + super(n2), this.target = t2; + } + T(t2) { + const n2 = new (s()).ProcessingInstruction(this.target, this.data); + return n2.ownerDocument = t2, n2; + } +} +class So { + constructor(t2) { + u(t2.startContainer, 10, 2) && A("StaticRange startContainer must not be a doctype or attribute node"), u(t2.endContainer, 10, 2) && A("StaticRange endContainer must not be a doctype or attribute node"), this.startContainer = t2.startContainer, this.startOffset = t2.startOffset, this.endContainer = t2.endContainer, this.endOffset = t2.endOffset, this.collapsed = this.startContainer === this.endContainer && this.startOffset === this.endOffset; + } +} +function Eo(t2, n2) { + if (t2.collapsed) + return; + const e2 = m(t2.startContainer), r2 = m(t2.endContainer); + let o2 = 0; + for (; o2 < e2.length && o2 < r2.length && e2[o2] === r2[o2]; ) + ++o2; + const i2 = t2.endContainer.childNodes[t2.endOffset] || null; + for (let o3 = t2.startContainer.childNodes[t2.startOffset] || null; o3 && o3 !== i2 && o3 !== r2[e2.length]; o3 = o3.nextSibling) + n2(o3); + for (let t3 = e2.length - 1; t3 >= o2; --t3) + for (let o3 = e2[t3].nextSibling; o3 && o3 !== i2 && o3 !== r2[t3]; o3 = o3.nextSibling) + n2(o3); + for (let t3 = o2; t3 < r2.length; ++t3) + for (let e3 = r2[t3].firstChild; e3 && e3 !== i2 && e3 !== r2[t3 + 1]; e3 = e3.nextSibling) + n2(e3); +} +function To(t2, n2) { + const e2 = p(t2.startContainer), r2 = e2.createDocumentFragment(); + if (t2.collapsed) + return r2; + const o2 = t2.startContainer, i2 = t2.startOffset, s2 = t2.endContainer, l2 = t2.endOffset; + if (o2 === s2 && c(o2)) { + const t3 = o2.cloneNode(); + return t3.data = o2.substringData(i2, l2 - i2), W(t3, r2), n2 || o2.replaceData(i2, l2 - i2, ""), r2; + } + const a2 = m(t2.startContainer), h2 = m(t2.endContainer); + let f2 = 0; + for (; f2 < a2.length && f2 < h2.length && a2[f2] === h2[f2]; ) + ++f2; + const w2 = f2 === a2.length, y2 = f2 === h2.length; + let b2 = null; + w2 || (b2 = a2[f2]); + let x2 = null; + y2 || (x2 = h2[f2]); + const v2 = [], N2 = b2 ? b2.nextSibling : o2.childNodes[i2], S2 = x2 || s2.childNodes[l2] || null; + for (var E2 = N2; E2 && E2 !== S2; E2 = E2.nextSibling) + u(E2, 10) && C(n2 ? "Can not clone a doctype using cloneContents" : "Can not extract a doctype using extractContents"), v2.push(E2); + let T2, D2; + if (w2 || n2) + T2 = o2, D2 = i2; + else { + const t3 = a2[f2]; + T2 = t3.parentNode, D2 = 1 + g(t3); + } + if (b2 !== null && c(b2)) { + const t3 = b2.cloneNode(); + t3.data = b2.substringData(i2, b2.length - i2), W(t3, r2), n2 || b2.replaceData(i2, b2.length - i2, ""); + } else if (b2 !== null) { + const t3 = b2.cloneNode(); + W(t3, r2); + const s3 = e2.createRange(); + s3.setStart(o2, i2), s3.setEnd(b2, d(b2)); + const u2 = To(s3, n2); + s3.detach(), W(u2, t3); + } + if (v2.forEach((t3) => { + if (n2) { + W(t3.cloneNode(true), r2); + } else + W(t3, r2); + }), x2 && c(x2)) { + const t3 = x2.cloneNode(); + t3.data = x2.substringData(0, l2), W(t3, r2), n2 || x2.replaceData(0, l2, ""); + } else if (x2 !== null) { + const t3 = x2.cloneNode(); + W(t3, r2); + const o3 = e2.createRange(); + o3.setStart(x2, 0), o3.setEnd(s2, l2); + const i3 = To(o3, n2); + o3.detach(), W(i3, t3); + } + return n2 || (t2.setStart(T2, D2), t2.collapse(true)), r2; +} +class Range { + get collapsed() { + return (t2 = this).startContainer === t2.endContainer && t2.startOffset === t2.endOffset; + var t2; + } + constructor() { + const t2 = s(); + this.startContainer = t2.document, this.startOffset = 0, this.endContainer = t2.document, this.endOffset = 0, t2.addRange(this); + } + get commonAncestorContainer() { + const t2 = m(this.startContainer), n2 = m(this.endContainer); + let e2 = t2[0], r2 = 0; + for (; r2 < t2.length && r2 < n2.length && t2[r2] === n2[r2]; ) + e2 = t2[r2], ++r2; + return e2; + } + setStart(t2, n2) { + N(arguments, 2), t2 = ct(t2, Node), n2 = st(n2), u(t2, 10) && A("Can not set a range under a doctype node"), n2 > d(t2) && D("Can not set a range past the end of the node"); + Io(this) === w(t2) && Ao(t2, n2, this.endContainer, this.endOffset) !== $o || (this.endContainer = t2, this.endOffset = n2), this.startContainer = t2, this.startOffset = n2; + } + setEnd(t2, n2) { + N(arguments, 2), t2 = ct(t2, Node), n2 = st(n2), u(t2, 10) && A("Can not set a range under a doctype node"), n2 > d(t2) && D("Can not set a range past the end of the node"); + Io(this) === w(t2) && Ao(t2, n2, this.startContainer, this.startOffset) !== Co || (this.startContainer = t2, this.startOffset = n2), this.endContainer = t2, this.endOffset = n2; + } + setStartBefore(t2) { + N(arguments, 1); + const n2 = (t2 = ct(t2, Node)).parentNode; + if (n2 === null) + return A("Can not set range before node without a parent"); + this.setStart(n2, g(t2)); + } + setStartAfter(t2) { + N(arguments, 1); + const n2 = (t2 = ct(t2, Node)).parentNode; + if (n2 === null) + return A("Can not set range before node without a parent"); + this.setStart(n2, g(t2) + 1); + } + setEndBefore(t2) { + N(arguments, 1); + const n2 = (t2 = ct(t2, Node)).parentNode; + if (n2 === null) + return A("Can not set range before node without a parent"); + this.setEnd(n2, g(t2)); + } + setEndAfter(t2) { + N(arguments, 1); + const n2 = (t2 = ct(t2, Node)).parentNode; + if (n2 === null) + return A("Can not set range before node without a parent"); + this.setEnd(n2, g(t2) + 1); + } + collapse(t2 = false) { + t2 ? (this.endContainer = this.startContainer, this.endOffset = this.startOffset) : (this.startContainer = this.endContainer, this.startOffset = this.endOffset); + } + selectNode(t2) { + N(arguments, 1); + let n2 = (t2 = ct(t2, Node)).parentNode; + if (n2 === null) + return A("Can not select node with null parent"); + const e2 = g(t2); + this.startContainer = n2, this.startOffset = e2, this.endContainer = n2, this.endOffset = e2 + 1; + } + selectNodeContents(t2) { + N(arguments, 1), u(t2 = ct(t2, Node), 10) && A("Can not place range inside a doctype node"); + const n2 = d(t2); + this.startContainer = t2, this.startOffset = 0, this.endContainer = t2, this.endOffset = n2; + } + compareBoundaryPoints(t2, n2) { + switch (N(arguments, 2), n2 = ct(n2, Range), t2 !== Range.START_TO_START && t2 !== Range.START_TO_END && t2 !== Range.END_TO_END && t2 !== Range.END_TO_START && R("Unsupported comparison type"), Io(this) !== Io(n2) && P("Can not compare positions of ranges in different trees"), t2) { + case Range.START_TO_START: + return Ao(this.startContainer, this.startOffset, n2.startContainer, n2.startOffset); + case Range.START_TO_END: + return Ao(this.endContainer, this.endOffset, n2.startContainer, n2.startOffset); + case Range.END_TO_END: + return Ao(this.endContainer, this.endOffset, n2.endContainer, n2.endOffset); + default: + return Ao(this.startContainer, this.startOffset, n2.endContainer, n2.endOffset); + } + } + deleteContents() { + if (this.collapsed) + return; + const t2 = this.startContainer, n2 = this.startOffset, e2 = this.endContainer, r2 = this.endOffset; + if (t2 === e2 && c(t2)) + return void t2.replaceData(n2, r2 - n2, ""); + const o2 = []; + let i2, s2; + if (Eo(this, (t3) => { + o2.push(t3); + }), t2.contains(e2)) + i2 = t2, s2 = n2; + else { + let n3 = t2; + for (; n3.parentNode !== null && !n3.parentNode.contains(e2); ) + n3 = n3.parentNode; + i2 = n3.parentNode, s2 = 1 + g(n3); + } + c(t2) && t2.replaceData(n2, t2.length - n2, ""), o2.forEach((t3) => { + H(t3); + }), c(e2) && e2.replaceData(0, r2, ""), this.setStart(i2, s2), this.collapse(true); + } + extractContents() { + return To(this, false); + } + cloneContents() { + return To(this, true); + } + insertNode(t2) { + N(arguments, 1), it(t2 = ct(t2, Node), this); + } + surroundContents(t2) { + N(arguments, 1), t2 = ct(t2, Node); + (a(this.startContainer) ? this.startContainer.parentNode : this.startContainer) !== (a(this.endContainer) ? this.endContainer.parentNode : this.endContainer) && I("Can not use surroundContents on a range that has partially selected a non-Text node"), u(t2, 9, 10, 11) && A("Can not use Document, DocumentType, or DocumentFragment as a parent node in surroundContents"); + const n2 = To(this, false); + t2.firstChild && Y(null, t2), it(t2, this), W(n2, t2), this.selectNode(t2); + } + cloneRange() { + const t2 = new (s()).Range(); + return t2.startContainer = this.startContainer, t2.startOffset = this.startOffset, t2.endContainer = this.endContainer, t2.endOffset = this.endOffset, t2; + } + detach() { + s().removeRange(this); + } + isPointInRange(t2, n2) { + return N(arguments, 2), t2 = ct(t2, Node), n2 = st(n2), w(t2) === Io(this) && (u(t2, 10) && A("Point can not be under a doctype"), n2 > d(t2) && D("Offset should not be past the end of node"), Ao(t2, n2, this.startContainer, this.startOffset) !== Co && Ao(t2, n2, this.endContainer, this.endOffset) !== $o); + } + comparePoint(t2, n2) { + return N(arguments, 2), t2 = ct(t2, Node), n2 = st(n2), w(t2) !== Io(this) && P("Can not compare point to range in different trees"), u(t2, 10) && A("Point can not be under a doctype"), n2 > d(t2) && D("Offset should not be past the end of node"), Ao(t2, n2, this.startContainer, this.startOffset) === Co ? -1 : Ao(t2, n2, this.endContainer, this.endOffset) === $o ? 1 : 0; + } + intersectsNode(t2) { + if (N(arguments, 1), w(t2 = ct(t2, Node)) !== Io(this)) + return false; + const n2 = t2.parentNode; + if (n2 === null) + return true; + const e2 = g(t2); + return Ao(n2, e2, this.endContainer, this.endOffset) === Co && Ao(n2, e2 + 1, this.startContainer, this.startOffset) === $o; + } + toString() { + let t2 = []; + const n2 = this.startContainer; + if (a(n2)) { + if (this.startContainer === this.endContainer) + return n2.substringData(this.startOffset, this.endOffset - this.startOffset); + t2.push(n2.substringData(this.startOffset, n2.length - this.startOffset)); + } + Eo(this, (n3) => { + y(n3, (n4) => { + a(n4) && t2.push(n4.data); + }); + }); + const e2 = this.endContainer; + return a(e2) && t2.push(e2.substringData(0, this.endOffset)), t2.join(""); + } +} +Range.START_TO_START = 0, Range.START_TO_END = 1, Range.END_TO_END = 2, Range.END_TO_START = 3; +const Co = -1, Do = 0, $o = 1; +function Ao(t2, n2, e2, r2) { + if (t2 !== e2) { + const o2 = m(t2), i2 = m(e2); + for (; o2[0] && i2[0] && o2[0] === i2[0]; ) + o2.shift(), i2.shift(); + o2.length && (n2 = g(o2[0]) + 0.5), i2.length && (r2 = g(i2[0]) + 0.5); + } + return n2 === r2 ? Do : n2 < r2 ? Co : $o; +} +function Io(t2) { + return w(t2.startContainer); +} +class XMLDocument extends Document { + T(t2) { + return new (s()).XMLDocument(); + } +} +class DOMParser { + constructor() { + } + parseFromString(t2, n2) { + switch (n2) { + case "text/html": + throw new Error("HTML parsing is not implemented"); + case "text/xml": + case "application/xml": + case "application/xhtml+xml": + case "image/svg+xml": + try { + return lo(t2); + } catch (t3) { + const n3 = new Document(), e2 = n3.createElementNS("http://www.mozilla.org/newlayout/xml/parsererror.xml", "parsererror"); + return e2.appendChild(n3.createTextNode(`${t3}`)), n3.appendChild(e2), n3; + } + default: + throw new TypeError(`The type "${n2}" is not a valid value in the SupportedType enumeration.`); + } + } +} +class XMLSerializer { + constructor() { + } + serializeToString(t2) { + const n2 = []; + return fo(t2 = ct(t2, Node), false, n2), n2.join(""); + } +} +function ko(t2) { + const n2 = []; + return fo(t2 = ct(t2, Node), true, n2), n2.join(""); +} +class MutationObserver { + constructor(t2) { + this.u = [], this.m = [], this.t = [], N(arguments, 1), t2 = ct(t2, Function), this.g = t2; + } + observe(t2, n2) { + if (N(arguments, 2), t2 = ct(t2, Node), n2.childList = !!n2.childList, n2.subtree = !!n2.subtree, n2.attributeOldValue !== void 0 && n2.attributes === void 0 && (n2.attributes = true), n2.characterDataOldValue !== void 0 && n2.characterData === void 0 && (n2.characterData = true), !(n2.childList || n2.attributes || n2.characterData)) + throw new TypeError('The options object must set at least one of "attributes", "characterData", or "childList" to true.'); + if (n2.attributeOldValue && !n2.attributes) + throw new TypeError('The options object may only set "attributeOldValue" to true when "attributes" is true or not present.'); + if (n2.characterDataOldValue && !n2.characterData) + throw new TypeError('The options object may only set "characterDataOldValue" to true when "characterData" is true or not present.'); + t2.o.register(this, n2); + } + disconnect() { + this.u.forEach((t2) => t2.o.removeForObserver(this)), this.u.length = 0, this.m.length = 0; + } + takeRecords() { + const t2 = this.m.concat(); + return this.m.length = 0, t2; + } +} +const Mo = new Document(); +i.document = Mo, i.Attr = Attr, i.CDATASection = CDATASection, i.Comment = vt, i.Document = Document, i.DocumentFragment = DocumentFragment, i.DocumentType = DocumentType, i.DOMImplementation = DOMImplementation, i.Element = Element, i.ProcessingInstruction = ProcessingInstruction, i.Range = Range, i.Text = Text, i.XMLDocument = XMLDocument; +export {Attr, CDATASection, CharacterData, vt as Comment, E as DOMException, DOMImplementation, DOMParser, Document, DocumentFragment, DocumentType, Element, MutationObserver, L as MutationRecord, Node, ProcessingInstruction, Range, So as StaticRange, Text, XMLDocument, XMLSerializer, Mo as document, lo as parseXmlDocument, uo as parseXmlFragment, ko as serializeToWellFormedString, Et as unsafeAppendAttribute, Nt as unsafeCreateAttribute, St as unsafeCreateElement}; +export default null; diff --git a/src/vendor/cdn.skypack.dev/-/whynot@v5.0.0-TIWeI93neceQKiPCfmA6/dist=es2019,mode=imports/optimized/whynot.js b/src/vendor/cdn.skypack.dev/-/whynot@v5.0.0-TIWeI93neceQKiPCfmA6/dist=es2019,mode=imports/optimized/whynot.js new file mode 100644 index 00000000000..e97c03b1de7 --- /dev/null +++ b/src/vendor/cdn.skypack.dev/-/whynot@v5.0.0-TIWeI93neceQKiPCfmA6/dist=es2019,mode=imports/optimized/whynot.js @@ -0,0 +1,355 @@ +function t(t2, s2, r2, i2) { + const n2 = {op: s2, func: r2, data: i2}; + return t2.push(n2), n2; +} +function s(t2, s2) { + return t2; +} +class r { + constructor() { + this.program = []; + } + test(s2, r3) { + return t(this.program, 5, s2, r3 === void 0 ? null : r3); + } + jump(s2) { + return t(this.program, 3, null, s2); + } + record(r3, i2) { + return t(this.program, 4, i2 === void 0 ? s : i2, r3); + } + bad(s2 = 1) { + return t(this.program, 1, null, s2); + } + accept() { + return t(this.program, 0, null, null); + } + fail(s2) { + return t(this.program, 2, s2 || null, null); + } +} +class i { + constructor(t2, s2, r2) { + this.programLength = t2, this.maxFromByPc = s2, this.maxSurvivorFromByPc = r2; + } + static fromProgram(t2) { + const s2 = t2.length, r2 = [], n2 = []; + return t2.forEach((t3) => { + r2.push(0), n2.push(0); + }), t2.forEach((t3, i2) => { + switch (t3.op) { + case 2: + if (t3.func === null) + return; + if (i2 + 1 >= s2) + throw new Error("Invalid program: program could run past end"); + r2[i2 + 1] += 1; + break; + case 1: + case 4: + if (i2 + 1 >= s2) + throw new Error("Invalid program: program could run past end"); + r2[i2 + 1] += 1; + break; + case 3: + t3.data.forEach((t4) => { + if (t4 < 0 || t4 >= s2) + throw new Error("Invalid program: program could run past end"); + r2[t4] += 1; + }); + break; + case 5: + if (i2 + 1 >= s2) + throw new Error("Invalid program: program could run past end"); + n2[i2 + 1] += 1; + break; + case 0: + n2[i2] += 1; + } + }), new i(s2, r2, n2); + } + static createStub(t2) { + const s2 = [], r2 = []; + for (let i2 = 0; i2 < t2; ++i2) + s2.push(t2), r2.push(t2); + return new i(t2, s2, r2); + } +} +class n { + constructor(t2) { + this.acceptingTraces = t2, this.success = t2.length > 0; + } +} +class h { + constructor(t2) { + this.t = 0, this.i = 0, this.h = new Uint16Array(t2), this.l = new Uint8Array(t2); + } + getBadness(t2) { + return this.l[t2]; + } + add(t2, s2) { + this.l[t2] = s2 > 255 ? 255 : s2; + const r2 = function(t3, s3, r3, i2, n2) { + let h3 = i2, e2 = n2; + for (; h3 < e2; ) { + const i3 = h3 + e2 >>> 1; + r3 < s3[t3[i3]] ? e2 = i3 : h3 = i3 + 1; + } + return h3; + }(this.h, this.l, s2, this.i, this.t); + this.h.copyWithin(r2 + 1, r2, this.t), this.h[r2] = t2, this.t += 1; + } + reschedule(t2, s2) { + const r2 = Math.max(this.l[t2], s2 > 255 ? 255 : s2); + if (this.l[t2] !== r2) { + const s3 = this.h.indexOf(t2, this.i); + if (s3 < 0 || s3 >= this.t) + return void (this.l[t2] = r2); + this.h.copyWithin(s3, s3 + 1, this.t), this.t -= 1, this.add(t2, r2); + } + } + getNextPc() { + return this.i >= this.t ? null : this.h[this.i++]; + } + reset() { + this.t = 0, this.i = 0, this.l.fill(0); + } +} +class e { + constructor(t2) { + this.o = []; + let s2 = t2.length; + t2.forEach((t3) => { + this.o.push(t3 > 0 ? s2 : -1), s2 += t3; + }), this.u = new Uint16Array(s2); + } + clear() { + this.u.fill(0, 0, this.o.length); + } + add(t2, s2) { + const r2 = this.u[s2], i2 = this.o[s2]; + this.u[s2] += 1, this.u[i2 + r2] = t2; + } + has(t2) { + return this.u[t2] > 0; + } + forEach(t2, s2) { + const r2 = this.u[t2], i2 = this.o[t2]; + for (let t3 = i2; t3 < i2 + r2; ++t3) + s2(this.u[t3]); + } +} +function l(t2, s2, r2 = false) { + return t2 === null ? s2 : Array.isArray(t2) ? (t2.indexOf(s2) === -1 && (r2 && (t2 = t2.slice()), t2.push(s2)), t2) : t2 === s2 ? t2 : [t2, s2]; +} +class c { + constructor(t2, s2) { + this.prefixes = t2, this.record = s2; + } +} +function o(t2, s2) { + let r2; + if (s2 === null) { + if (!Array.isArray(t2)) + return t2; + r2 = t2; + } else + r2 = t2 === c.EMPTY ? [] : Array.isArray(t2) ? t2 : [t2]; + return new c(r2, s2); +} +c.EMPTY = new c([], null); +class u { + constructor(t2) { + this.p = [], this.v = []; + for (let s2 = 0; s2 < t2; ++s2) + this.p.push(0), this.v.push(null); + } + mergeTraces(t2, s2, r2, i2, n2, h2) { + let e2 = false; + return r2.forEach(s2, (s3) => { + const r3 = this.trace(s3, i2, n2, h2); + var c2, o2, u3; + o2 = r3, u3 = e2, t2 = (c2 = t2) === null ? o2 : o2 === null ? c2 : Array.isArray(o2) ? o2.reduce((t3, s4) => l(t3, s4, t3 === o2), c2) : l(c2, o2, u3), e2 = t2 === r3; + }), t2; + } + trace(t2, s2, r2, i2) { + switch (this.p[t2]) { + case 2: + return this.v[t2]; + case 1: + return null; + } + this.p[t2] = 1; + let n2 = null; + const h2 = s2[t2]; + if (h2 !== null) + n2 = h2; + else if (!r2.has(t2)) + throw new Error("Trace without source at pc " + t2); + if (n2 = this.mergeTraces(n2, t2, r2, s2, r2, i2), n2 !== null) { + const s3 = i2[t2]; + s3 !== null && (n2 = o(n2, s3)); + } + return this.v[t2] = n2, this.p[t2] = 2, n2; + } + buildSurvivorTraces(t2, s2, r2, i2, n2) { + for (let h2 = 0, e2 = t2.length; h2 < e2; ++h2) { + if (!r2.has(h2)) { + s2[h2] = null; + continue; + } + this.v.fill(null), this.p.fill(0); + const e3 = this.mergeTraces(null, h2, r2, t2, i2, n2); + if (e3 === null) + throw new Error("No non-cyclic paths found to survivor " + h2); + s2[h2] = o(e3, null); + } + this.v.fill(null); + } +} +class a { + constructor(t2) { + this.g = [], this.k = [], this.m = [], this.A = new e(t2.maxFromByPc), this.T = new e(t2.maxSurvivorFromByPc), this.S = new u(t2.programLength); + for (let s2 = 0; s2 < t2.programLength; ++s2) + this.g.push(null), this.k.push(null), this.m.push(null); + this.k[0] = c.EMPTY; + } + reset(t2) { + this.A.clear(), this.T.clear(), this.g.fill(null), t2 && (this.k.fill(null), this.m.fill(null), this.k[0] = c.EMPTY); + } + record(t2, s2) { + this.g[t2] = s2; + } + has(t2) { + return this.A.has(t2) || this.k[t2] !== null; + } + add(t2, s2) { + this.A.add(t2, s2); + } + hasSurvivor(t2) { + return this.T.has(t2); + } + addSurvivor(t2, s2) { + this.T.add(t2, s2); + } + buildSurvivorTraces() { + const t2 = this.k; + this.S.buildSurvivorTraces(t2, this.m, this.T, this.A, this.g), this.k = this.m, this.m = t2; + } + getTraces(t2) { + const s2 = t2.reduce((t3, s3) => l(t3, this.k[s3]), null); + return s2 === null ? [] : Array.isArray(s2) ? s2 : [s2]; + } +} +class f { + constructor(t2) { + this.I = [], this.N = new h(t2.programLength), this.M = new h(t2.programLength), this.P = new a(t2); + } + reset() { + this.N.reset(), this.N.add(0, 0), this.I.length = 0, this.P.reset(true); + } + getNextThreadPc() { + return this.N.getNextPc(); + } + step(t2, s2, r2) { + const i2 = this.P.has(s2); + this.P.add(t2, s2); + const n2 = this.N.getBadness(t2) + r2; + i2 ? this.N.reschedule(s2, n2) : this.N.add(s2, n2); + } + stepToNextGeneration(t2, s2) { + const r2 = this.P.hasSurvivor(s2); + this.P.addSurvivor(t2, s2); + const i2 = this.N.getBadness(t2); + r2 ? this.M.reschedule(s2, i2) : this.M.add(s2, i2); + } + accept(t2) { + this.I.push(t2), this.P.addSurvivor(t2, t2); + } + fail(t2) { + } + record(t2, s2) { + this.P.record(t2, s2); + } + nextGeneration() { + this.P.buildSurvivorTraces(), this.P.reset(false); + const t2 = this.N; + t2.reset(), this.N = this.M, this.M = t2; + } + getAcceptingTraces() { + return this.P.getTraces(this.I); + } +} +class d { + constructor(t2) { + this.U = [], this.G = t2, this.V = i.fromProgram(t2), this.U.push(new f(this.V)); + } + execute(t2, s2) { + const r2 = this.U.pop() || new f(this.V); + r2.reset(); + const i2 = t2.length; + let h2, e2 = -1; + do { + let n2 = r2.getNextThreadPc(); + if (n2 === null) + break; + for (++e2, h2 = e2 >= i2 ? null : t2[e2]; n2 !== null; ) { + const t3 = this.G[n2]; + switch (t3.op) { + case 0: + h2 === null ? r2.accept(n2) : r2.fail(n2); + break; + case 2: { + const i3 = t3.func; + if (i3 === null || i3(s2)) { + r2.fail(n2); + break; + } + r2.step(n2, n2 + 1, 0); + break; + } + case 1: + r2.step(n2, n2 + 1, t3.data); + break; + case 5: + if (h2 === null) { + r2.fail(n2); + break; + } + if (!(0, t3.func)(h2, t3.data, s2)) { + r2.fail(n2); + break; + } + r2.stepToNextGeneration(n2, n2 + 1); + break; + case 3: { + const s3 = t3.data, i3 = s3.length; + if (i3 === 0) { + r2.fail(n2); + break; + } + for (let t4 = 0; t4 < i3; ++t4) + r2.step(n2, s3[t4], 0); + break; + } + case 4: { + const i3 = (0, t3.func)(t3.data, e2, s2); + i3 != null && r2.record(n2, i3), r2.step(n2, n2 + 1, 0); + break; + } + } + n2 = r2.getNextThreadPc(); + } + r2.nextGeneration(); + } while (h2 !== null); + const l2 = new n(r2.getAcceptingTraces()); + return r2.reset(), this.U.push(r2), l2; + } +} +function w(t2) { + const s2 = new r(); + return t2(s2), new d(s2.program); +} +var p = {Assembler: r, VM: d, compileVM: w}; +export default p; +export {r as Assembler, d as VM, w as compileVM}; diff --git a/src/vendor/cdn.skypack.dev/-/xspattern@v3.1.0-ChOssaTvtX8cZQgPaNnM/dist=es2019,mode=imports/optimized/xspattern.js b/src/vendor/cdn.skypack.dev/-/xspattern@v3.1.0-ChOssaTvtX8cZQgPaNnM/dist=es2019,mode=imports/optimized/xspattern.js new file mode 100644 index 00000000000..f525525fc5e --- /dev/null +++ b/src/vendor/cdn.skypack.dev/-/xspattern@v3.1.0-ChOssaTvtX8cZQgPaNnM/dist=es2019,mode=imports/optimized/xspattern.js @@ -0,0 +1,323 @@ +import {compileVM} from "/-/whynot@v5.0.0-TIWeI93neceQKiPCfmA6/dist=es2019,mode=imports/optimized/whynot.js"; +function B(A) { + return (B2) => B2 === A; +} +function a(A, B2) { + if (A === null || B2 === null) + throw new Error("unescaped hyphen may not be used as a range endpoint"); + if (B2 < A) + throw new Error("character range is in the wrong order"); + return (a2) => A <= a2 && a2 <= B2; +} +function n(A) { + return true; +} +function e() { + return false; +} +function t(A, B2) { + return (a2) => A(a2) || B2(a2); +} +function G(A, B2) { + switch (B2.kind) { + case "predicate": + return void A.test(B2.value); + case "regexp": + return void r(A, B2.value, false); + } +} +function i(A, B2) { + B2.forEach((B3) => { + !function(A2, B4) { + const [a2, {min: n2, max: e2}] = B4; + if (e2 !== null) { + for (let B5 = 0; B5 < n2; ++B5) + G(A2, a2); + for (let B5 = n2; B5 < e2; ++B5) { + const B6 = A2.jump([]); + B6.data.push(A2.program.length), G(A2, a2), B6.data.push(A2.program.length); + } + } else if (n2 > 0) { + for (let B6 = 0; B6 < n2 - 1; ++B6) + G(A2, a2); + const B5 = A2.program.length; + G(A2, a2), A2.jump([B5]).data.push(A2.program.length); + } else { + const B5 = A2.program.length, n3 = A2.jump([]); + n3.data.push(A2.program.length), G(A2, a2), A2.jump([B5]), n3.data.push(A2.program.length); + } + }(A, B3); + }); +} +function r(A, B2, a2) { + const n2 = A.program.length, e2 = A.jump([]); + a2 && (e2.data.push(A.program.length), A.test(() => true), A.jump([n2])); + const t2 = []; + if (B2.forEach((B3) => { + e2.data.push(A.program.length), i(A, B3), t2.push(A.jump([])); + }), t2.forEach((B3) => { + B3.data.push(A.program.length); + }), a2) { + const B3 = A.program.length, a3 = A.jump([]); + a3.data.push(A.program.length), A.test(() => true), A.jump([B3]), a3.data.push(A.program.length); + } +} +function o(A, B2) { + return {success: true, offset: A, value: B2}; +} +function l(A) { + return o(A, void 0); +} +function H(A, B2, a2 = false) { + return {success: false, offset: A, expected: B2, fatal: a2}; +} +function C(A) { + return (B2, a2) => { + const n2 = a2 + A.length; + return B2.slice(a2, n2) === A ? o(n2, A) : H(a2, [A]); + }; +} +function u(A, B2) { + return (a2, n2) => { + const e2 = A(a2, n2); + return e2.success ? o(e2.offset, B2(e2.value)) : e2; + }; +} +function s(A, B2, a2, n2) { + return (e2, t2) => { + const G2 = A(e2, t2); + return G2.success ? B2(G2.value) ? G2 : H(t2, a2, n2) : G2; + }; +} +function c(A, B2) { + return (a2, n2) => { + let e2 = null; + for (const t2 of A) { + const A2 = t2(a2, n2); + if (A2.success) + return A2; + if (e2 === null || A2.offset > e2.offset ? e2 = A2 : A2.offset === e2.offset && B2 === void 0 && (e2.expected = e2.expected.concat(A2.expected)), A2.fatal) + return A2; + } + return B2 = B2 || (e2 == null ? void 0 : e2.expected) || [], e2 && (e2.expected = B2), e2 || H(n2, B2); + }; +} +function D(A) { + return (B2, a2) => { + const n2 = A(B2, a2); + return n2.success || n2.fatal ? n2 : o(a2, null); + }; +} +function m(A) { + return (B2, a2) => { + let n2 = [], e2 = a2; + for (; ; ) { + const a3 = A(B2, e2); + if (!a3.success) { + if (a3.fatal) + return a3; + break; + } + if (n2.push(a3.value), a3.offset === e2) + break; + e2 = a3.offset; + } + return o(e2, n2); + }; +} +function I(A, B2, a2) { + return (n2, e2) => { + const t2 = A(n2, e2); + if (!t2.success) + return t2; + const G2 = B2(n2, t2.offset); + return G2.success ? o(G2.offset, a2(t2.value, G2.value)) : G2; + }; +} +function d(A) { + return I(A, m(A), (A2, B2) => [A2].concat(B2)); +} +function h(A, B2) { + return A; +} +function p(A, B2) { + return B2; +} +function T(A, B2) { + return I(A, B2, p); +} +function F(A, B2) { + return I(A, B2, h); +} +function E(A, B2, a2, n2 = false) { + return T(A, n2 ? f(F(B2, a2)) : F(B2, a2)); +} +function g(A, B2) { + return (a2, n2) => A(a2, n2).success ? H(n2, B2) : l(n2); +} +function f(A) { + return (B2, a2) => { + const n2 = A(B2, a2); + return n2.success ? n2 : H(n2.offset, n2.expected, true); + }; +} +const P = (A, B2) => A.length === B2 ? l(B2) : H(B2, ["end of input"]); +const M = ["Lu", "Ll", "Lt", "Lm", "Lo", "Mn", "Mc", "Me", "Nd", "Nl", "No", "Pc", "Pd", "Ps", "Pe", "Pi", "Pf", "Po", "Zs", "Zl", "Zp", "Sm", "Sc", "Sk", "So", "Cc", "Cf", "Co", "Cn"]; +const J = {}; +function S(A) { + return A.codePointAt(0); +} +"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach((A, B2) => { + J[A] = B2; +}); +const K = (A) => A === -1 || A === -2; +function b(A) { + return (B2) => !K(B2) && !A(B2); +} +function y(A, B2) { + return B2 === null ? A : (a2) => A(a2) && !B2(a2); +} +const Q = function(A, B2) { + const n2 = new Map(); + let e2 = 0; + return A.forEach((A2, G2) => { + const i2 = B2[G2]; + A2 !== null && A2.split("|").forEach((A3) => { + const B3 = n2.get(A3), G3 = a(e2, e2 + i2 - 1); + n2.set(A3, B3 ? t(B3, G3) : G3); + }), e2 += i2; + }), n2; +}(["BasicLatin", "Latin-1Supplement", "LatinExtended-A", "LatinExtended-B", "IPAExtensions", "SpacingModifierLetters", "CombiningDiacriticalMarks", "GreekandCoptic|Greek", "Cyrillic", "CyrillicSupplement", "Armenian", "Hebrew", "Arabic", "Syriac", "ArabicSupplement", "Thaana", "NKo", "Samaritan", "Mandaic", "SyriacSupplement", "ArabicExtended-B", "ArabicExtended-A", "Devanagari", "Bengali", "Gurmukhi", "Gujarati", "Oriya", "Tamil", "Telugu", "Kannada", "Malayalam", "Sinhala", "Thai", "Lao", "Tibetan", "Myanmar", "Georgian", "HangulJamo", "Ethiopic", "EthiopicSupplement", "Cherokee", "UnifiedCanadianAboriginalSyllabics", "Ogham", "Runic", "Tagalog", "Hanunoo", "Buhid", "Tagbanwa", "Khmer", "Mongolian", "UnifiedCanadianAboriginalSyllabicsExtended", "Limbu", "TaiLe", "NewTaiLue", "KhmerSymbols", "Buginese", "TaiTham", "CombiningDiacriticalMarksExtended", "Balinese", "Sundanese", "Batak", "Lepcha", "OlChiki", "CyrillicExtended-C", "GeorgianExtended", "SundaneseSupplement", "VedicExtensions", "PhoneticExtensions", "PhoneticExtensionsSupplement", "CombiningDiacriticalMarksSupplement", "LatinExtendedAdditional", "GreekExtended", "GeneralPunctuation", "SuperscriptsandSubscripts", "CurrencySymbols", "CombiningDiacriticalMarksforSymbols|CombiningMarksforSymbols", "LetterlikeSymbols", "NumberForms", "Arrows", "MathematicalOperators", "MiscellaneousTechnical", "ControlPictures", "OpticalCharacterRecognition", "EnclosedAlphanumerics", "BoxDrawing", "BlockElements", "GeometricShapes", "MiscellaneousSymbols", "Dingbats", "MiscellaneousMathematicalSymbols-A", "SupplementalArrows-A", "BraillePatterns", "SupplementalArrows-B", "MiscellaneousMathematicalSymbols-B", "SupplementalMathematicalOperators", "MiscellaneousSymbolsandArrows", "Glagolitic", "LatinExtended-C", "Coptic", "GeorgianSupplement", "Tifinagh", "EthiopicExtended", "CyrillicExtended-A", "SupplementalPunctuation", "CJKRadicalsSupplement", "KangxiRadicals", null, "IdeographicDescriptionCharacters", "CJKSymbolsandPunctuation", "Hiragana", "Katakana", "Bopomofo", "HangulCompatibilityJamo", "Kanbun", "BopomofoExtended", "CJKStrokes", "KatakanaPhoneticExtensions", "EnclosedCJKLettersandMonths", "CJKCompatibility", "CJKUnifiedIdeographsExtensionA", "YijingHexagramSymbols", "CJKUnifiedIdeographs", "YiSyllables", "YiRadicals", "Lisu", "Vai", "CyrillicExtended-B", "Bamum", "ModifierToneLetters", "LatinExtended-D", "SylotiNagri", "CommonIndicNumberForms", "Phags-pa", "Saurashtra", "DevanagariExtended", "KayahLi", "Rejang", "HangulJamoExtended-A", "Javanese", "MyanmarExtended-B", "Cham", "MyanmarExtended-A", "TaiViet", "MeeteiMayekExtensions", "EthiopicExtended-A", "LatinExtended-E", "CherokeeSupplement", "MeeteiMayek", "HangulSyllables", "HangulJamoExtended-B", "HighSurrogates", "HighPrivateUseSurrogates", "LowSurrogates", "PrivateUseArea|PrivateUse", "CJKCompatibilityIdeographs", "AlphabeticPresentationForms", "ArabicPresentationForms-A", "VariationSelectors", "VerticalForms", "CombiningHalfMarks", "CJKCompatibilityForms", "SmallFormVariants", "ArabicPresentationForms-B", "HalfwidthandFullwidthForms", "Specials", "LinearBSyllabary", "LinearBIdeograms", "AegeanNumbers", "AncientGreekNumbers", "AncientSymbols", "PhaistosDisc", null, "Lycian", "Carian", "CopticEpactNumbers", "OldItalic", "Gothic", "OldPermic", "Ugaritic", "OldPersian", null, "Deseret", "Shavian", "Osmanya", "Osage", "Elbasan", "CaucasianAlbanian", "Vithkuqi", null, "LinearA", "LatinExtended-F", null, "CypriotSyllabary", "ImperialAramaic", "Palmyrene", "Nabataean", null, "Hatran", "Phoenician", "Lydian", null, "MeroiticHieroglyphs", "MeroiticCursive", "Kharoshthi", "OldSouthArabian", "OldNorthArabian", null, "Manichaean", "Avestan", "InscriptionalParthian", "InscriptionalPahlavi", "PsalterPahlavi", null, "OldTurkic", null, "OldHungarian", "HanifiRohingya", null, "RumiNumeralSymbols", "Yezidi", "ArabicExtended-C", "OldSogdian", "Sogdian", "OldUyghur", "Chorasmian", "Elymaic", "Brahmi", "Kaithi", "SoraSompeng", "Chakma", "Mahajani", "Sharada", "SinhalaArchaicNumbers", "Khojki", null, "Multani", "Khudawadi", "Grantha", null, "Newa", "Tirhuta", null, "Siddham", "Modi", "MongolianSupplement", "Takri", null, "Ahom", null, "Dogra", null, "WarangCiti", "DivesAkuru", null, "Nandinagari", "ZanabazarSquare", "Soyombo", "UnifiedCanadianAboriginalSyllabicsExtended-A", "PauCinHau", "DevanagariExtended-A", null, "Bhaiksuki", "Marchen", null, "MasaramGondi", "GunjalaGondi", null, "Makasar", "Kawi", null, "LisuSupplement", "TamilSupplement", "Cuneiform", "CuneiformNumbersandPunctuation", "EarlyDynasticCuneiform", null, "Cypro-Minoan", "EgyptianHieroglyphs", "EgyptianHieroglyphFormatControls", null, "AnatolianHieroglyphs", null, "BamumSupplement", "Mro", "Tangsa", "BassaVah", "PahawhHmong", null, "Medefaidrin", null, "Miao", null, "IdeographicSymbolsandPunctuation", "Tangut", "TangutComponents", "KhitanSmallScript", "TangutSupplement", null, "KanaExtended-B", "KanaSupplement", "KanaExtended-A", "SmallKanaExtension", "Nushu", null, "Duployan", "ShorthandFormatControls", null, "ZnamennyMusicalNotation", null, "ByzantineMusicalSymbols", "MusicalSymbols", "AncientGreekMusicalNotation", null, "KaktovikNumerals", "MayanNumerals", "TaiXuanJingSymbols", "CountingRodNumerals", null, "MathematicalAlphanumericSymbols", "SuttonSignWriting", null, "LatinExtended-G", "GlagoliticSupplement", "CyrillicExtended-D", null, "NyiakengPuachueHmong", null, "Toto", "Wancho", null, "NagMundari", null, "EthiopicExtended-B", "MendeKikakui", null, "Adlam", null, "IndicSiyaqNumbers", null, "OttomanSiyaqNumbers", null, "ArabicMathematicalAlphabeticSymbols", null, "MahjongTiles", "DominoTiles", "PlayingCards", "EnclosedAlphanumericSupplement", "EnclosedIdeographicSupplement", "MiscellaneousSymbolsandPictographs", "Emoticons", "OrnamentalDingbats", "TransportandMapSymbols", "AlchemicalSymbols", "GeometricShapesExtended", "SupplementalArrows-C", "SupplementalSymbolsandPictographs", "ChessSymbols", "SymbolsandPictographsExtended-A", "SymbolsforLegacyComputing", null, "CJKUnifiedIdeographsExtensionB", null, "CJKUnifiedIdeographsExtensionC", "CJKUnifiedIdeographsExtensionD", "CJKUnifiedIdeographsExtensionE", "CJKUnifiedIdeographsExtensionF", null, "CJKCompatibilityIdeographsSupplement", null, "CJKUnifiedIdeographsExtensionG", "CJKUnifiedIdeographsExtensionH", null, "Tags", null, "VariationSelectorsSupplement", null, "SupplementaryPrivateUseArea-A|PrivateUse", "SupplementaryPrivateUseArea-B|PrivateUse"], [128, 128, 128, 208, 96, 80, 112, 144, 256, 48, 96, 112, 256, 80, 48, 64, 64, 64, 32, 16, 48, 96, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 256, 160, 96, 256, 384, 32, 96, 640, 32, 96, 32, 32, 32, 32, 128, 176, 80, 80, 48, 96, 32, 32, 144, 80, 128, 64, 64, 80, 48, 16, 48, 16, 48, 128, 64, 64, 256, 256, 112, 48, 48, 48, 80, 64, 112, 256, 256, 64, 32, 160, 128, 32, 96, 256, 192, 48, 16, 256, 128, 128, 256, 256, 96, 32, 128, 48, 80, 96, 32, 128, 128, 224, 16, 16, 64, 96, 96, 48, 96, 16, 32, 48, 16, 256, 256, 6592, 64, 20992, 1168, 64, 48, 320, 96, 96, 32, 224, 48, 16, 64, 96, 32, 48, 48, 32, 96, 32, 96, 32, 96, 32, 48, 64, 80, 64, 11184, 80, 896, 128, 1024, 6400, 512, 80, 688, 16, 16, 16, 32, 32, 144, 240, 16, 128, 128, 64, 80, 64, 48, 128, 32, 64, 32, 48, 32, 48, 32, 64, 32, 80, 48, 48, 80, 48, 64, 80, 64, 384, 64, 64, 64, 32, 32, 48, 48, 32, 32, 32, 64, 32, 96, 96, 32, 32, 32, 64, 64, 32, 32, 48, 80, 80, 48, 128, 64, 288, 32, 64, 64, 48, 64, 64, 48, 32, 128, 80, 48, 80, 48, 96, 32, 80, 48, 48, 80, 128, 128, 128, 96, 160, 128, 96, 32, 80, 48, 80, 176, 80, 80, 96, 96, 64, 96, 80, 96, 16, 64, 96, 160, 112, 80, 64, 96, 80, 304, 32, 96, 80, 16, 64, 1024, 128, 208, 2624, 112, 1072, 48, 4e3, 640, 8576, 576, 48, 96, 48, 144, 688, 96, 96, 160, 64, 32, 6144, 768, 512, 128, 8816, 16, 256, 48, 64, 400, 2304, 160, 16, 4688, 208, 48, 256, 256, 80, 112, 32, 32, 96, 32, 128, 1024, 688, 1104, 256, 48, 96, 112, 80, 320, 48, 64, 464, 48, 736, 32, 224, 32, 96, 784, 80, 64, 80, 176, 256, 256, 48, 112, 96, 256, 256, 768, 80, 48, 128, 128, 128, 256, 256, 112, 144, 256, 1024, 42720, 32, 4160, 224, 5776, 7488, 3088, 544, 1504, 4944, 4192, 711760, 128, 128, 240, 65040, 65536, 65536]), x = function(A) { + const n2 = new Map(), G2 = A.split(""), i2 = M.map(() => []); + let r2 = 0, o2 = 0; + for (; o2 < G2.length; ) { + const A2 = J[G2[o2]], n3 = (31 & A2) - 2; + let e2 = 1 + J[G2[o2 + 1]]; + switch (32 & A2 ? (e2 += J[G2[o2 + 2]] << 6, e2 += J[G2[o2 + 3]] << 12, e2 += J[G2[o2 + 4]] << 18, o2 += 5) : o2 += 2, n3) { + case -2: { + let A3 = 0; + for (let a2 = r2; a2 < r2 + e2; ++a2) { + i2[A3].push(B(a2)), A3 = (A3 + 1) % 2; + } + break; + } + case -1: + break; + default: { + const A3 = i2[n3]; + e2 === 1 ? A3.push(B(r2)) : A3.push(a(r2, r2 + e2 - 1)); + break; + } + } + r2 += e2; + } + const l2 = new Map(); + return M.forEach((A2, B2) => { + const a2 = i2[B2].reduce(t, e); + n2.set(A2, a2); + const G3 = A2.charAt(0), r3 = l2.get(G3) || []; + l2.set(G3, r3), r3.push(a2); + }), l2.forEach((A2, B2) => { + n2.set(B2, A2.reduce(t, e)); + }), n2; +}("bfUATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAbgUATAYDaATAZAaAGARAXAcAaAZAaAXAMBZADATBZAMAGASAMCTACWXACGDXXADHA3DAAPDAAtCAAFDBCAADCAABCCDBCCABCAABCCDCCAABCAAFCAADDAABCAABCBADCBDBGACADCGDCAEADACAEADACAEADAAPDAARDACAEADAABCBA7DFCAABCBDBABCCAJjDBAAGADaFRZDFLZNFEZGFAZAFAZQnvBAAADFAZACADABBFADCTACABDZBCATACCBACABACAABCQBACIDiCADBCCDCAXDDCADAXAABCBDBCyDvAhaAHEJBA1CAANDAgfBAABAClBBFATFDoTAOABBaBYABAHsOAHATAHBTAHBTAHABHGaBDGDTBBKcFXCTBYATBaBHKTAcATCGfFAGJHUKJTDGBHAmiBAATAGAHGcAaAHFFBHBaAHDGBKJGCaBGATNBAcAGAHAGdHaBBmYBAAHKGABNKJGgHIFBaATCFABBHAYBGVHDFAHIFAHCFAHEBBTOBAGYHCBBTABAGKBEGXZAGFBAcBBFHHGoFAHXcAHfIAG1HAIAHAGAICHHIDHAIBGAHGGJHBTBKJTAFAGOHAIBBAGHBBGBBBGVBAGGBAGABCGDBBHAGAICHDBBIBBBIBHAGABHIABDGBBAGCHBBBKJGBYBMFaAYAGATAHABBHBIABAGFBDGBBBGVBAGGBAGBBAGBBAGBBBHABAICHBBDHBBBHCBCHABGGDBAGABGKJHBGCHATABJHBIABAGIBAGCBAGVBAGGBAGBBAGEBBHAGAICHEBAHBIABAIBHABBGABOGBHBBBKJTAYABGGAHFBAHAIBBAGHBBGBBBGVBAGGBAGBBAGEBBHAGAIAHAIAHDBBIBBBIBHABGHBIABDGBBAGCHBBBKJaAGAMFBJHAGABAGFBCGCBAGDBCGBBAGABAGBBCGBBCGCBCGLBDIBHAIBBCICBAICHABBGABFIABNKJMCaFYAaABEHAICHAGHBAGCBAGWBAGPBBHAGAHCIDBAHCBAHDBGHBBAGCBBGABBGBHBBBKJBGTAMGaAGAHAIBTAGHBAGCBAGWBAGJBAGEBBHAGAIAHAIEBAHAIBBAIBHBBGIBBFGBBAGBHBBBKJBAGBIABLHBIBGIBAGCBAGoHBGAICHDBAICBAICHAGAaABDGCIAMGGCHBBBKJMIaAGFBAHAIBBAGRBCGXBAGIBAGABBGGBCHABDICHCBAHABAIHBFKJBBIBTABLGvHAGBHGBDYAGFFAHHTAKJTBBkGBBAGABAGEBAGXBAGABAGJHAGBHIGABBGEBAFABAHGBAKJBBGDBfGAaCTOaATAaCHBaFKJMJaAHAaAHAaAHAPAQAPAQAIBGHBAGjBDHNIAHETAHBGEHKBAHjBAaHHAaFBAaBTEaDTBBkGqIBHDIAHFIAHBIBHBGAKJTFGFIBHBGDHCGAICGBIGGCHDGMHAIBHBIFHAGAIAKJICHAaBClBACABECABBDqTAFADCmIFAABAGDBBGGBAGABAGDBBGoBAGDBBGgBAGDBBGGBAGABAGDBBGOBAG4BAGDBBmCBAABBHCTIMTBCGPaJBFiVBAABBDFBBOAmrJAAaATAGQUAGZPAQABCmKBAATCLCGHBGGRHCIABIGSHBIATBBIGRHBBLGMBAGCBAHBBLGzHBIAHGIHHAIBHKTCFATCYAGAHABBKJBFMJBFTFOATDHCcAHAKJBFGiFAG0BGGEHBGhHAGABEmFBAABJGeBAHCIDHBICBDIBHAIFHCBDaABCTBKJGdBBGEBKGrBDGZBFKJMABCahGWHBIBHABBTBG0IAHAIAHGBAHAIAHAIBHHIFHJBBHAKJBFKJBFTGFATFBBHNJAHPBwHDIAGuHAIAHEIAHAIEHAIBGHBCKJTGaJHIaITBBAHBIAGdIAHDIBHBIAHCGBKJGrHAIAHBICHAIAHCIBBHTDGjIHHHIBHBBCTEKJBCGCKJGdFFTBDIBGCqBBCCTHBHHCTAHMIAHGGDHAGFHAGBIAHBGABEDrF+DMFADhFkH/gVCAADHghBAADHCHDFBBCFBBDHCHDHCHDFBBCFBBDHBACABACABACABACADHCHDNBBDHEHDHEHDHEHDEBADBCDEAZADAZCDCBADBCDEAZCDDBBDBCDBAZCDHCEZCBBDCBADBCDEAZBBAUKcEOFTBRASAPARBSAPARATHVAWAcEUATIRASATDNBTCXAPAQATKXATANATJUAcEBAcJMAFABBMFXCPAQAFAMJXCPAQABAFMBCYgBOHMJDHAJCHLBOaBCAaDCAaBDACCDBCCDAaACAaBXACEaFCAaACAaACAaACDaADACDDAGDDAaBDBCBXECADDaAXAaBDAaAMPLiCADALDMAaBBDXEaEXBaDXAaBXAaBXAaGXAaeXBaBXAaAXAae3LEAAaHPAQAPAQAaTXBaGPAQA6QBAAXAadXYanXF6EBAABYaKBUM76NBAAMV62CAAXAaIXAa1XH6uBAAXA63DAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAMdarXEPAQAXePAQAPAQAPAQAPAQAPAQAXP6/DAA3CCAAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQAX+PAQAPAQAXfPAQA3BEAAavXUaBXFamBBafBA6oBAACvDvABCCDBAFCCADDACADFFBCBgjBAADAaFADHCCADABETDMATBDlBADABEDABBG3BGFATABNHAGWBIGGBAGGBAGGBAGGBAGGBAGGBAGGBAGGBAHfTBRASARASATCRASATARASATIOATBOATARASATBRASAPAQAPAQAPAQAPAQATEFATJOBTDOATAPATMaBTCPAQAPAQAPAQAPAQAOABhaZBA6YBAABL6VDAABZaLBDUATCaAFAGALAPAQAPAQAPAQAPAQAPAQAaBPAQAPAQAPAQAPAQAOAPAQBaALIHDIBOAFEaBLCFAGATAaBBAmVBAABBHBZBFBGAOAmZBAATAFCGABEGqBAmdBAABAaBMDaJGfajBLGPaeBAMJadMHaAMOafMJamMO6/EAAm/mBAa/mUIFAFAm2RAABCa2BIGnFFTBmLEAAFATCGPKJGBBTAtGAHAJCTAHJTAFAAbFBHBmFBAALJHBTFBHZWFIZBANDBA9FADHADCAAJFAZBADGAADDBATCDABCDAPCCADBECADABADABADAADBXFCCADAGAFBDAGGHAGCHAGDHAGWIBHBIAaDHABCMFaBYAaABFGzTDBHIBGxIPHBBHTBKJBFHRGFTCGATAGBHAKJGbHHTBGWHKIBBKTAGcBCHCIAGuHAIBHDIBHBICTMBAFAKJBDTBGEHAFAGIKJGEBAGoHFIBHBIBHBBIGCHAGHHAIABBKJBBTDGPFAGFaCGAIAHAIAGxHAGAHCGBHBGEHBGAHAGABXGBFATBGKIAHBIBTBGAFBIAHABJGFBBGFBBGFBIGGBAGGBADqZAFDDIFAZBBDjPBAAGiIBHAIBHAIBTAIAHABBKJBFmjuCABLGWBDGwhDgAA9/jBAmtFAABBmpBAABlDGBLDEBEGAHAGJXAGMBAGEBAGABAGBBAGBBAmrBAAZQBPmqFAAQAPAaPG/BBG1BGaABfGLYAaCHPTGPAQATABFHPTAOBNBPAQAPAQAPAQAPAQAPAQAPAQAPAQAPAQATBPAQATDNCTCBATDOAPAQAPAQAPAQATCXAOAXCBATAYATBBDGEBAmGCAABBcABATCYATCPAQATAXATAOATBKJTBXCTBCZPATAQAZANAZADZPAXAQAXAPAQATAPAQATBGJFAGsFBGeBCGFBBGFBBGFBBGCBCYBXAZAaAYBBAaAXDaBBJcCaBBBGLBAGZBAGSBAGBBAGOBBGNBhm6BAABETCBDMsBCaIL0MDaQMBaCBAaMBCaABuasHAhBCAAGcBCGwBOHAMaBDGfMDBIGTLAGHLABEGlHEBEGdBATAGjBDGHTALEBpCnDnmNBAABBKJBFCjBDDjBDGnBHGzBKTACKBACOBACGBACBBADKBADOBADGBADBhCBAAm2EAABIGVBJGHBXFFBAFpBAFIhEBAAGFBBGABAGrBAGBBCGABBGWBATAMHGWaBMGGeBHMIBvGSBAGBBEMEGVMFBCTAGZBETAB/G3BDMBGBMPBBMtGAHCBAHBBEHDGDBAGCBAGcBBHCBDHAMIBGTIBGGcMBTAGcMCBfGHaAGbHBBDMETGBIG1BCTGGVBBMHGSBEMHGRBGTDBLMGhPBAAmIBAAB2CyBMDyBGMFGjHDBHKJhlEAAMeBAGpBAHBOABBGBhKBAAHCGcMJGABHGVHKMDTEBVGRHDTDBlGUMGBTGWBIIAHAIAG0HOTGBDMTKJHAGBHBGABIHCIAGsICHDIBHBTBcATDHABJcABBGYBGKJBFHCGjHEIAHHBAKJTDGAIBGABHGiHATBGABIHBIAGvICHIIBGDTDHDTAIAHAKJGATAGATCBAMTBKGRBAGYICHCIBHAIAHBTFHAGBHAB9GGBAGABAGDBAGOBAGJTABFGuHAICHHBEKJBFHBIBBAGHBBGBBBGVBAGGBAGBBAGEBAHBGAIBHAIDBBIBBBICBBGABFIABEGEIBBBHGBCHEhKCAAG0ICHHIBHCIAHAGDTEKJTBBATAHAGCBdGvICHFIAHAIDHBIAHBGBTAGABHKJhlCAAGuICHDBBIDHBIAHBTWGDHBBhGvICHHIBHAIAHBTCGABKKJBFTMBSGqHAIAHAIBHFIAHAGATABFKJB1GaBBHCIBHDIAHEBDKJMBTCaAGGh4CAAGrICHIIAHBTAhjBAACfDfKJMIBLGHBBGABBGHBAGBBAGXIFBAIBBBHBIAHAGAIAGAIAHATCBIKJhFBAAGHBBGmICHDBBHBIDHAGATAGAIABaGAHJGnHFIAGAHDTHHABHGAHFIBHCGtHMIAHBTCGATEBMmIBAABGTJh1DAAGIBAGkIAHGBAHFIAHAGATEBJKJMSBCTBGdBBHVBAIAHGIAHBIAHBhIBAAGGBAGBBAGlHFBCHABAHBBAHGGAHABHKJBFGFBAGBBAGfIEBAHBBAIBHAIAHAGABGKJh1EAAGSHBIBTBBGHBGAIAGMBAGhIBHEBCIBHAIAHATMKJhVBAAGABOMUaHYDaQBMTAmZOAAhlBAAruBAABATEBKmDDAAhLpAAmgBAATBBMmvQAAcPHAGFHOhp+AAmGJAAh4GCAm4IAABGGeBAKJBDTBmOBAABAKJBFGdBBHETABJGvHGTEaDFDTAaABJKJBAMGBAGUBEGShvKAACfDfMWTDhkBAAmKBAABDHAGAI2BGHDFMB/FBTAFAHABKIBBNm3fBABHmVTAABpGIhmLCAFDBAFGBAFBBAmiEAABOGABcGCBBGABNGDBHmLGAAhDkAAmqBAABEGMBCGIBGGJBBaAHBTAcDhbJBAHtBBHWBI6zBAAB761DAABJamBBa7IBHCaCIFcHHHaBHGadHDa8BU6BBAAHCaAh5BAAMTBLMTBL6WBAABIMYhGCAACZDZCZDGBADRCZDZCABACBBBCABBCBBBCDBACHDDBADABADGBADKCZDZCBBACDBBCHBACGBADZCBBACDBACEBACABCCGBADZCZDZCZDZCZDZCZDZCZDZCZDbBBCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCYXADYXADFCADABBKx6/HAAH2aDHxaHHAaNHAaBTEBOHEBAHOhPRAADJGADTBFDFhUDAAHGBAHQBBHGBAHBBAHEBEF9BgHAhvBAAGsBCHGFGBBKJBDGAaAh/EAAGdHABQGrHDKJBEYAhPHAAGaFAHDKJhlLAAGGBAGDBAGBBAGOBAmEDAABBMIHGBoChDhHGFABDKJBDTBhQMAAM6aAMCYAMDhLBAAMsaAMOhBDAAGDBAGaBAGBBAGABBGABAGJBAGDBAGABAGABFGABDGABAGABAGABAGCBAGBBAGABBGABAGABAGABAGABAGABAGBBAGABBGDBAGGBAGDBAGDBAGABAGJBAGQBEGCBAGEBAGQBzXBhNEAAarBD6jBAABLaOBBaOBAaOBAakBJMM6gCAAB3acBMarBDaIBGaBBNaFhZCAA66DAAZE6XLAABDaQBCaMBC62BAABD6eBAABFaLBDaABOaLBDa3BHaJBFanBHadBBaBhNBAA6TFAABLaNBBaMBCaIBGatBAaGBHaNBDaIBGaIBG6SCAABAa2BkKJhFQAAmfbKABfm5ABABFmdDAABBmBaBABNmw0BAhewAAmdIAAhhXAAmKNBABEmfBBAhQxtCcABd8fBAAh/BAAnvDAAhP4PA99/PABB99/PA"); +function L(A) { + return A === 32 || A === 9 || A === 10 || A === 13; +} +const X = [B(S(":")), a(S("A"), S("Z")), B(S("_")), a(S("a"), S("z")), a(192, 214), a(216, 246), a(192, 214), a(216, 246), a(248, 767), a(880, 893), a(895, 8191), a(8204, 8205), a(8304, 8591), a(11264, 12271), a(12289, 55295), a(63744, 64975), a(65008, 65533), a(65536, 983039)].reduce(t), Z = [X, B(S("-")), B(S(".")), a(S("0"), S("9")), B(183), a(768, 879), a(8255, 8256)].reduce(t), O = x.get("Nd"), k = b(O), N = y(a(0, 1114111), [x.get("P"), x.get("Z"), x.get("C")].reduce(t)), v = b(N); +function w(A) { + return A !== 10 && A !== 13 && !K(A); +} +const Y = {s: L, S: b(L), i: X, I: b(X), c: Z, C: b(Z), d: O, D: k, w: N, W: v}, U = C("*"), j = C("\\"), R = C("{"), V = C("}"), W = C("["), q = C("]"), z = C("^"), $ = C("$"), _ = C(","), AA = C("-"), BA = C("("), aA = C(")"), nA = C("."), eA = C("|"), tA = C("+"), GA = C("?"), iA = C("-["), rA = S("0"); +function oA(A) { + function e2(A2) { + return new Set(A2.split("").map((A3) => S(A3))); + } + function G2(A2, B2) { + const a2 = A2.codePointAt(B2); + return a2 === void 0 ? H(B2, ["any character"]) : o(B2 + String.fromCodePoint(a2).length, a2); + } + const i2 = A.language === "xpath" ? T(j, c([u(C("n"), () => 10), u(C("r"), () => 13), u(C("t"), () => 9), u(c([j, eA, nA, AA, z, GA, U, tA, R, V, $, BA, aA, W, q]), (A2) => S(A2))])) : T(j, c([u(C("n"), () => 10), u(C("r"), () => 13), u(C("t"), () => 9), u(c([j, eA, nA, AA, z, GA, U, tA, R, V, BA, aA, W, q]), (A2) => S(A2))])); + function r2(A2, B2) { + const a2 = e2(B2); + return I(C(A2), D(s(G2, (A3) => a2.has(A3), B2.split(""))), (A3, B3) => function(A4) { + const B4 = x.get(A4); + if (B4 == null) + throw new Error(A4 + " is not a valid unicode category"); + return B4; + }(B3 === null ? A3 : A3 + String.fromCodePoint(B3))); + } + const l2 = c([r2("L", "ultmo"), r2("M", "nce"), r2("N", "dlo"), r2("P", "cdseifo"), r2("Z", "slp"), r2("S", "mcko"), r2("C", "cfon")]), p2 = [a(S("a"), S("z")), a(S("A"), S("Z")), a(S("0"), S("9")), B(45)].reduce(t), M2 = c([l2, u(T(C("Is"), function(A2) { + return (B2, a2) => { + const n2 = A2(B2, a2); + return n2.success ? o(n2.offset, B2.slice(a2, n2.offset)) : n2; + }; + }(d(s(G2, p2, ["block identifier"])))), (B2) => function(A2, B3) { + const a2 = Q.get(A2); + if (a2 === void 0) { + if (B3) + return n; + throw new Error(`The unicode block identifier "${A2}" is not known.`); + } + return a2; + }(B2, A.language !== "xpath"))]), J2 = E(C("\\p{"), M2, V, true), K2 = u(E(C("\\P{"), M2, V, true), b), L2 = T(j, u(c("sSiIcCdDwW".split("").map((A2) => C(A2))), (A2) => Y[A2])), X2 = u(nA, () => w), Z2 = c([L2, J2, K2]), O2 = e2("\\[]"), k2 = c([i2, s(G2, (A2) => !O2.has(A2), ["unescaped character"])]), N2 = c([u(AA, () => null), k2]), v2 = I(N2, T(AA, N2), a); + function oA2(A2, B2) { + return [A2].concat(B2 || []); + } + const lA2 = u(function(A2) { + return (B2, a2) => { + const n2 = A2(B2, a2); + return n2.success ? o(a2, n2.value) : n2; + }; + }(c([q, iA])), () => null), HA2 = S("-"), CA = c([u(F(F(AA, g(W, ["not ["])), lA2), () => HA2), T(g(AA, ["not -"]), k2)]), uA = c([I(u(CA, B), c([function(A2, B2) { + return uA(A2, B2); + }, lA2]), oA2), I(c([v2, Z2]), c([cA, lA2]), oA2)]); + const sA = c([I(u(k2, B), c([uA, lA2]), oA2), I(c([v2, Z2]), c([cA, lA2]), oA2)]); + function cA(A2, B2) { + return sA(A2, B2); + } + const DA = u(sA, (A2) => A2.reduce(t)), mA = u(T(z, DA), b), IA = I(c([T(g(z, ["not ^"]), DA), mA]), D(T(AA, function(A2, B2) { + return dA(A2, B2); + })), y), dA = E(W, IA, q, true); + const hA = A.language === "xpath" ? c([u(i2, B), Z2, dA, X2, u(z, () => (A2) => A2 === -1), u($, () => (A2) => A2 === -2)]) : c([u(i2, B), Z2, dA, X2]), pA = A.language === "xpath" ? e2(".\\?*+{}()|^$[]") : e2(".\\?*+{}()|[]"), TA = s(G2, (A2) => !pA.has(A2), ["NormalChar"]), FA = u(T(j, I(u(s(G2, a(S("1"), S("9")), ["digit"]), (A2) => A2 - rA), m(u(s(G2, a(rA, S("9")), ["digit"]), (A2) => A2 - rA)), (A2, B2) => { + B2.reduce((A3, B3) => 10 * A3 + B3, A2); + })), (A2) => { + throw new Error("Backreferences in XPath patterns are not yet implemented."); + }), EA = A.language === "xpath" ? c([u(TA, (A2) => ({kind: "predicate", value: B(A2)})), u(hA, (A2) => ({kind: "predicate", value: A2})), u(E(BA, T(D(C("?:")), SA), aA, true), (A2) => ({kind: "regexp", value: A2})), FA]) : c([u(TA, (A2) => ({kind: "predicate", value: B(A2)})), u(hA, (A2) => ({kind: "predicate", value: A2})), u(E(BA, SA, aA, true), (A2) => ({kind: "regexp", value: A2}))]), gA = u(d(u(s(G2, a(rA, S("9")), ["digit"]), (A2) => A2 - rA)), (A2) => A2.reduce((A3, B2) => 10 * A3 + B2)), fA = c([I(gA, T(_, gA), (A2, B2) => { + if (B2 < A2) + throw new Error("quantifier range is in the wrong order"); + return {min: A2, max: B2}; + }), I(gA, _, (A2) => ({min: A2, max: null})), u(gA, (A2) => ({min: A2, max: A2}))]), PA = A.language === "xpath" ? I(c([u(GA, () => ({min: 0, max: 1})), u(U, () => ({min: 0, max: null})), u(tA, () => ({min: 1, max: null})), E(R, fA, V, true)]), D(GA), (A2, B2) => A2) : c([u(GA, () => ({min: 0, max: 1})), u(U, () => ({min: 0, max: null})), u(tA, () => ({min: 1, max: null})), E(R, fA, V, true)]), MA = m(I(EA, u(D(PA), (A2) => A2 === null ? {min: 1, max: 1} : A2), (A2, B2) => [A2, B2])), JA = I(MA, m(T(eA, f(MA))), (A2, B2) => [A2].concat(B2)); + function SA(A2, B2) { + return JA(A2, B2); + } + const KA = function(A2) { + return I(A2, P, h); + }(JA); + return function(A2) { + let B2; + try { + B2 = KA(A2, 0); + } catch (B3) { + throw new Error(`Error parsing pattern "${A2}": ${B3 instanceof Error ? B3.message : B3}`); + } + return B2.success ? B2.value : function(A3, B3, a2) { + const n2 = a2.map((A4) => `"${A4}"`); + throw new Error(`Error parsing pattern "${A3}" at offset ${B3}: expected ${n2.length > 1 ? "one of " + n2.join(", ") : n2[0]} but found "${A3.slice(B3, B3 + 1)}"`); + }(A2, B2.offset, B2.expected); + }; +} +function lA(A) { + return [...A].map((A2) => A2.codePointAt(0)); +} +function HA(B2, a2 = {language: "xsd"}) { + const n2 = oA(a2)(B2), e2 = compileVM((A) => { + r(A, n2, a2.language === "xpath"), A.accept(); + }); + return function(A) { + const B3 = a2.language === "xpath" ? [-1, ...lA(A), -2] : lA(A); + return e2.execute(B3).success; + }; +} +export {HA as compile}; +export default null; diff --git a/src/vendor/cdn.skypack.dev/fontoxpath@3.29.1.js b/src/vendor/cdn.skypack.dev/fontoxpath@3.29.1.js new file mode 100644 index 00000000000..a0afdba5877 --- /dev/null +++ b/src/vendor/cdn.skypack.dev/fontoxpath@3.29.1.js @@ -0,0 +1,16 @@ +/* + * Skypack CDN - fontoxpath@3.29.1 + * + * Learn more: + * 📙 Package Documentation: https://www.skypack.dev/view/fontoxpath + * 📘 Skypack Documentation: https://www.skypack.dev/docs + * + * Pinned URL: (Optimized for Production) + * ▶️ Normal: https://cdn.skypack.dev/pin/fontoxpath@v3.29.1-a0ohYsVP957eLX7RfgAa/mode=imports/optimized/fontoxpath.js + * ⏩ Minified: https://cdn.skypack.dev/pin/fontoxpath@v3.29.1-a0ohYsVP957eLX7RfgAa/mode=imports,min/optimized/fontoxpath.js + * + */ + +// Browser-Optimized Imports (Don't directly import the URLs below in your application!) +export * from '/-/fontoxpath@v3.29.1-a0ohYsVP957eLX7RfgAa/dist=es2019,mode=imports/optimized/fontoxpath.js'; +export {default} from '/-/fontoxpath@v3.29.1-a0ohYsVP957eLX7RfgAa/dist=es2019,mode=imports/optimized/fontoxpath.js'; diff --git a/src/vendor/cdn.skypack.dev/slimdom@4.2.0.js b/src/vendor/cdn.skypack.dev/slimdom@4.2.0.js new file mode 100644 index 00000000000..351ae0a7302 --- /dev/null +++ b/src/vendor/cdn.skypack.dev/slimdom@4.2.0.js @@ -0,0 +1,16 @@ +/* + * Skypack CDN - slimdom@4.2.0 + * + * Learn more: + * 📙 Package Documentation: https://www.skypack.dev/view/slimdom + * 📘 Skypack Documentation: https://www.skypack.dev/docs + * + * Pinned URL: (Optimized for Production) + * ▶️ Normal: https://cdn.skypack.dev/pin/slimdom@v4.2.0-QzuHPU3P67qdOzczKt6u/mode=imports/optimized/slimdom.js + * ⏩ Minified: https://cdn.skypack.dev/pin/slimdom@v4.2.0-QzuHPU3P67qdOzczKt6u/mode=imports,min/optimized/slimdom.js + * + */ + +// Browser-Optimized Imports (Don't directly import the URLs below in your application!) +export * from '/-/slimdom@v4.2.0-QzuHPU3P67qdOzczKt6u/dist=es2019,mode=imports/optimized/slimdom.js'; +export {default} from '/-/slimdom@v4.2.0-QzuHPU3P67qdOzczKt6u/dist=es2019,mode=imports/optimized/slimdom.js'; diff --git a/src/vendor/import_map.json b/src/vendor/import_map.json index a069f1be79f..f05293e9279 100644 --- a/src/vendor/import_map.json +++ b/src/vendor/import_map.json @@ -84,6 +84,8 @@ "another_cookiejar/mod.ts": "./deno.land/x/another_cookiejar@v4.1.4/mod.ts", "binary-search-bounds": "./cdn.skypack.dev/binary-search-bounds@2.0.5.js", "testing/asserts.ts": "./deno.land/std@0.185.0/testing/asserts.ts", + "slimdom": "./cdn.skypack.dev/slimdom@4.2.0.js", + "fontoxpath": "./cdn.skypack.dev/fontoxpath@3.29.1.js", "https://deno.land/std@0.161.0/fmt/colors.ts": "./deno.land/std@0.185.0/fmt/colors.ts", "https://deno.land/std@0.161.0/encoding/base64.ts": "./deno.land/std@0.185.0/encoding/base64.ts", "https://deno.land/std@0.161.0/path/mod.ts": "./deno.land/std@0.185.0/path/mod.ts", @@ -167,6 +169,9 @@ "/-/acorn-walk@v7.2.0-HE7wS37ePcNncqJvsD8k/dist=es2019,mode=imports/optimized/acorn-walk.js": "./cdn.skypack.dev/-/acorn-walk@v7.2.0-HE7wS37ePcNncqJvsD8k/dist=es2019,mode=imports/optimized/acorn-walk.js", "/-/acorn-private-class-elements@v1.0.0-74UyKouPfmJKyVmXndKD/dist=es2019,mode=imports/optimized/acorn-private-class-elements.js": "./cdn.skypack.dev/-/acorn-private-class-elements@v1.0.0-74UyKouPfmJKyVmXndKD/dist=es2019,mode=imports/optimized/acorn-private-class-elements.js", "/-/acorn@v8.4.0-TUBEehokUmfefnUMjao9/dist=es2019,mode=imports/optimized/acorn.js": "./cdn.skypack.dev/-/acorn@v8.4.0-TUBEehokUmfefnUMjao9/dist=es2019,mode=imports/optimized/acorn.js", + "/-/xspattern@v3.1.0-ChOssaTvtX8cZQgPaNnM/dist=es2019,mode=imports/optimized/xspattern.js": "./cdn.skypack.dev/-/xspattern@v3.1.0-ChOssaTvtX8cZQgPaNnM/dist=es2019,mode=imports/optimized/xspattern.js", + "/-/prsc@v4.0.0-yiYip3qo0YwPataeg654/dist=es2019,mode=imports/optimized/prsc.js": "./cdn.skypack.dev/-/prsc@v4.0.0-yiYip3qo0YwPataeg654/dist=es2019,mode=imports/optimized/prsc.js", + "/-/whynot@v5.0.0-TIWeI93neceQKiPCfmA6/dist=es2019,mode=imports/optimized/whynot.js": "./cdn.skypack.dev/-/whynot@v5.0.0-TIWeI93neceQKiPCfmA6/dist=es2019,mode=imports/optimized/whynot.js", "/-/@observablehq/parser@v4.5.0-rWZiNfab8flhVomtfVvr/dist=es2019,mode=imports/optimized/@observablehq/parser.js": "./cdn.skypack.dev/-/@observablehq/parser@v4.5.0-rWZiNfab8flhVomtfVvr/dist=es2019,mode=imports/optimized/@observablehq/parser.js", "/-/acorn-class-fields@v1.0.0-VEggkLxq9gMrdwRuKkzZ/dist=es2019,mode=imports/optimized/acorn-class-fields.js": "./cdn.skypack.dev/-/acorn-class-fields@v1.0.0-VEggkLxq9gMrdwRuKkzZ/dist=es2019,mode=imports/optimized/acorn-class-fields.js", "/-/acorn-walk@v8.2.0-X811aiix0R2fkBGq305v/dist=es2019,mode=imports/optimized/acorn-walk.js": "./cdn.skypack.dev/-/acorn-walk@v8.2.0-X811aiix0R2fkBGq305v/dist=es2019,mode=imports/optimized/acorn-walk.js", @@ -174,6 +179,7 @@ "/-/binary-search-bounds@v2.0.5-c8IgO4OqUhed8ANHQXKv/dist=es2019,mode=imports/optimized/binary-search-bounds.js": "./cdn.skypack.dev/-/binary-search-bounds@v2.0.5-c8IgO4OqUhed8ANHQXKv/dist=es2019,mode=imports/optimized/binary-search-bounds.js", "/-/blueimp-md5@v2.19.0-FsBtHB6ITwdC3L5Giq4Q/dist=es2019,mode=imports/optimized/blueimp-md5.js": "./cdn.skypack.dev/-/blueimp-md5@v2.19.0-FsBtHB6ITwdC3L5Giq4Q/dist=es2019,mode=imports/optimized/blueimp-md5.js", "/-/dayjs@v1.8.21-6syVEc6qGP8frQXKlmJD/dist=es2019,mode=imports/optimized/dayjs.js": "./cdn.skypack.dev/-/dayjs@v1.8.21-6syVEc6qGP8frQXKlmJD/dist=es2019,mode=imports/optimized/dayjs.js", + "/-/fontoxpath@v3.29.1-a0ohYsVP957eLX7RfgAa/dist=es2019,mode=imports/optimized/fontoxpath.js": "./cdn.skypack.dev/-/fontoxpath@v3.29.1-a0ohYsVP957eLX7RfgAa/dist=es2019,mode=imports/optimized/fontoxpath.js", "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/cloneDeep.js": "./cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/cloneDeep.js", "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/debounce.js": "./cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/debounce.js", "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/difference.js": "./cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/difference.js", @@ -190,7 +196,8 @@ "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/toString.js": "./cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/toString.js", "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/uniq.js": "./cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/uniq.js", "/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/uniqBy.js": "./cdn.skypack.dev/-/lodash@v4.17.21-K6GEbP02mWFnLA45zAmi/dist=es2019,mode=imports/unoptimized/uniqBy.js", - "/-/moment-guess@v1.2.4-bDXl7KQy0hLGNuGhyGb4/dist=es2019,mode=imports/optimized/moment-guess.js": "./cdn.skypack.dev/-/moment-guess@v1.2.4-bDXl7KQy0hLGNuGhyGb4/dist=es2019,mode=imports/optimized/moment-guess.js" + "/-/moment-guess@v1.2.4-bDXl7KQy0hLGNuGhyGb4/dist=es2019,mode=imports/optimized/moment-guess.js": "./cdn.skypack.dev/-/moment-guess@v1.2.4-bDXl7KQy0hLGNuGhyGb4/dist=es2019,mode=imports/optimized/moment-guess.js", + "/-/slimdom@v4.2.0-QzuHPU3P67qdOzczKt6u/dist=es2019,mode=imports/optimized/slimdom.js": "./cdn.skypack.dev/-/slimdom@v4.2.0-QzuHPU3P67qdOzczKt6u/dist=es2019,mode=imports/optimized/slimdom.js" } } } diff --git a/tests/.renvignore b/tests/.renvignore new file mode 100644 index 00000000000..33066e69566 --- /dev/null +++ b/tests/.renvignore @@ -0,0 +1,49 @@ +# Python Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# skip folders with no R to speed up dependencies detection + +/integration/ +/smoke/ +/unit/ + +_extensions/ + +# skip files with no R code to speed up dependencies detection +*.ts +*.js +*.yml +*.css +*.py +*.json +*.sh +*.ps1 +*.toml +*.csl +*.bib +*.mp4 +*.png +*.jpg +*.jpeg +*.svg +*.woff +*.tex +*.cls +*.sty +*.lua +*.theme +*.xml +*.gz +*.html +*.xls +*.pdf +*.eps +*.dtd +*.ent +*.mod diff --git a/tests/DESCRIPTION b/tests/DESCRIPTION new file mode 100644 index 00000000000..169f6a2f53c --- /dev/null +++ b/tests/DESCRIPTION @@ -0,0 +1,18 @@ +Type: tests +Description: Quarto tests projects +Depends: + rmarkdown, + knitr, + shiny, + downlit, + tidyverse, + ggplot2, + ggExtra, + scales, + kableExtra, + gt, + flextable, + tibble, + DT, + DBI, + RSQLite diff --git a/tests/README.md b/tests/README.md index ead06fd9a85..2790b73a053 100644 --- a/tests/README.md +++ b/tests/README.md @@ -24,7 +24,7 @@ Tests are running through `Deno.test()` framework, adapted for our Quarto projec Here are what is expected in the environment for the tests : - R should be installed and in PATH - - On Windows, Rtools should be to (for source package) e.g `winget install --id RProject.Rtools` + - On Windows, Rtools should be too (for source package installation) e.g `winget install --id RProject.Rtools` - Python should be installed and in PATH - On Windows, one can use [`pyenv-win`](https://pyenv-win.github.io/pyenv-win/) to manage version or install from https://www.python.org/ manually or using `winget`. - Julia should be installed and in PATH @@ -43,6 +43,14 @@ We use [**renv**](https://rstudio.github.io/renv/). `renv.lock` and `renv/` fold Updating `renv.lock` is done using `renv::snapshot()`. File shouldn't be modified manually. +Our project is using [explicit dependencies discovery](https://rstudio.github.io/renv/reference/dependencies.html?q=dependen#explicit-dependencies) through a `DESCRIPTION` file. This is to avoid a costly scanning of all files in `tests/` to guess R dependencies. This means that if you need to add a test with a new R package dependencies: + +- Add package(s) to `DESCRIPTION` in `tests/` +- `renv::install()` the package into the project library +- Finish to work on your test +- `renv::snapshot()` to record the new dependency in the `renv.lock` +- Commit the new `DESCRIPTION` and `renv.lock` + See [documentation](https://rstudio.github.io/renv/) if you need to tweak the R environment. #### Python diff --git a/tests/configure-test-env.ps1 b/tests/configure-test-env.ps1 index ed5b8fde74e..b24c1b39e9e 100644 --- a/tests/configure-test-env.ps1 +++ b/tests/configure-test-env.ps1 @@ -5,7 +5,11 @@ try { $null = gcm Rscript -ea stop; $r=$true} catch { } If ($r) { - Rscript -e "renv::restore()" + Write-Host -ForegroundColor green " > Restoring renv project" + Rscript -e 'renv::restore()' + Write-Host -ForegroundColor green " > Installing dev knitr and rmarkdown" + Rscript -e "install.packages('rmarkdown', repos = c('https://rstudio.r-universe.dev'))" + Rscript -e "install.packages('knitr', repos = c('https://yihui.r-universe.dev'))" } # Check python test environment --- diff --git a/tests/configure-test-env.sh b/tests/configure-test-env.sh index 2c28f63c2ed..d423d7bf8fa 100755 --- a/tests/configure-test-env.sh +++ b/tests/configure-test-env.sh @@ -7,7 +7,11 @@ if [ -z $r_exists ] then echo "No Rscript found in PATH - Check your PATH or install R and add to PATH." else + echo " > Restoring renv project" Rscript -e 'renv::restore()' + echo " > Installing dev knitr and rmarkdown" + Rscript -e "install.packages('rmarkdown', repos = c('https://rstudio.r-universe.dev'))" + Rscript -e "install.packages('knitr', repos = c('https://yihui.r-universe.dev'))" fi diff --git a/tests/docs/author-normalization/funding/award-institition-inline.qmd b/tests/docs/author-normalization/funding/award-institition-inline.qmd new file mode 100644 index 00000000000..ec96251e6ab --- /dev/null +++ b/tests/docs/author-normalization/funding/award-institition-inline.qmd @@ -0,0 +1,19 @@ +--- +title: Simple Funding +funding: + statement: "The author(s) received no specific funding for this work." + open-access: "This is open access" + awards: + id: foo + name: Award Name + description: Award Description + source: + institution: + name: NSF Grant + city: Boston + state: MA + country: USA + isni: 0000 0001 2169 1945 + type: Grant +format: jats +--- \ No newline at end of file diff --git a/tests/docs/author-normalization/funding/award-institition-multiple.qmd b/tests/docs/author-normalization/funding/award-institition-multiple.qmd new file mode 100644 index 00000000000..6d82a362f65 --- /dev/null +++ b/tests/docs/author-normalization/funding/award-institition-multiple.qmd @@ -0,0 +1,31 @@ +--- +title: Simple Funding +affiliations: + - id: nsf + name: NSF Grant + city: Boston + state: MA + country: USA + isni: 0000 0001 2169 1945 +funding: + statement: "The author(s) received no specific funding for this work." + open-access: "This is open access" + awards: + - id: foo + name: Award Name + description: Award Description + source: + ref: nsf + - id: bar + name: Award 2 + source: + text: This is the source text + country: USA + - id: bar2 + name: Another Award + source: + institution: + name: Grant Provider + ringgold: 3242-2lkjl-2342 +format: jats +--- \ No newline at end of file diff --git a/tests/docs/author-normalization/funding/award-institition-ref.qmd b/tests/docs/author-normalization/funding/award-institition-ref.qmd new file mode 100644 index 00000000000..a087c280e48 --- /dev/null +++ b/tests/docs/author-normalization/funding/award-institition-ref.qmd @@ -0,0 +1,22 @@ +--- +title: Simple Funding +affiliations: + - id: nsf + name: NSF Grant + city: Boston + state: MA + country: USA + isni: 0000 0001 2169 1945 +funding: + statement: "The author(s) received no specific funding for this work." + open-access: "This is open access" + awards: + id: foo + name: Award Name + description: Award Description + source: + ref: nsf + country: USA + type: Grant +format: jats +--- \ No newline at end of file diff --git a/tests/docs/author-normalization/funding/award-single.qmd b/tests/docs/author-normalization/funding/award-single.qmd new file mode 100644 index 00000000000..84c4ce8a4c7 --- /dev/null +++ b/tests/docs/author-normalization/funding/award-single.qmd @@ -0,0 +1,15 @@ +--- +title: Simple Funding +funding: + statement: "The author(s) received no specific funding for this work." + open-access: "This is open access" + awards: + id: foo + name: Award Name + description: Award Description + source: + text: This is source text + country: USA + type: Grant +format: jats +--- \ No newline at end of file diff --git a/tests/docs/author-normalization/funding/complex.qmd b/tests/docs/author-normalization/funding/complex.qmd new file mode 100644 index 00000000000..1820a12924f --- /dev/null +++ b/tests/docs/author-normalization/funding/complex.qmd @@ -0,0 +1,64 @@ +--- +title: Simple Funding +authors: + - id: cjt + name: Charles Teague + role: writing +affiliations: + - id: nsf + name: NSF Grant + city: Boston + state: MA + country: USA + isni: 0000 0001 2169 1945 + - id: sloan + name: Sloan Foundation + - id: mac + name: Macalester College +funding: + - statement: "The author(s) received no specific funding for this work." + open-access: "This is open access" + awards: + - id: foo + name: Award Name + description: Award Description + source: + ref: nsf + recipient: + - ref: cjt + - Another Recip + - id: bar + name: Award 2 + source: + text: This is the source text + country: USA + investigator: + ref: cjt + recipient: + ref: mac + - id: bar2 + name: Another Award + source: + institution: + name: Grant Provider + ringgold: 3242-2lkjl-2342 + - statement: "The author(s) received VERY specific funding for this work." + awards: + - id: grant-1 + name: Award Name + description: Award Description + source: + ref: sloan + - id: grant-2 + name: Award 2 + source: + text: This is the source text + country: USA + - id: grant-3 + name: Another Award + source: + institution: + name: Grant Provider + ringgold: 3242-2lkjl-2342 +format: jats +--- \ No newline at end of file diff --git a/tests/docs/author-normalization/funding/complex.xml b/tests/docs/author-normalization/funding/complex.xml new file mode 100644 index 00000000000..1b5736e015b --- /dev/null +++ b/tests/docs/author-normalization/funding/complex.xml @@ -0,0 +1,119 @@ + + +
+ + + + Simple Funding + + + + + Teague + Charles + + Charles Teague + writing + + + + + NSF Grant + 0000 0001 2169 +1945 + + Boston + MA + USA + + + + Sloan Foundation + + + + + Macalester College + + + + + + + + NSF Grant + 0000 0001 2169 +1945 + + + foo + + + Teague + Charles + + Charles Teague + + +Another Recip + + + + + + bar + + + Macalester College + + + + + Teague + Charles + + Charles Teague + + + + + + bar2 + + +

This is open access

+
+
+ + + + + Sloan Foundation + + + grant-1 + + + + + grant-2 + + + + + Grant Provider + 3242-2lkjl-2342 + + + grant-3 + + +
+
+ + + + + +
diff --git a/tests/docs/author-normalization/funding/simple.qmd b/tests/docs/author-normalization/funding/simple.qmd new file mode 100644 index 00000000000..ca5997664e8 --- /dev/null +++ b/tests/docs/author-normalization/funding/simple.qmd @@ -0,0 +1,8 @@ +--- +title: Simple Funding +funding: "The author(s) received no specific funding for this work." +format: jats +--- + + + diff --git a/tests/docs/author-normalization/funding/statement-array.qmd b/tests/docs/author-normalization/funding/statement-array.qmd new file mode 100644 index 00000000000..bff17c77738 --- /dev/null +++ b/tests/docs/author-normalization/funding/statement-array.qmd @@ -0,0 +1,7 @@ +--- +title: Simple Funding +funding: + - statement: "The author(s) received no specific funding for this work." + - statement: "The author(s) also received no specific funding for this work." +format: jats +--- \ No newline at end of file diff --git a/tests/docs/author-normalization/funding/statement-open-access.qmd b/tests/docs/author-normalization/funding/statement-open-access.qmd new file mode 100644 index 00000000000..bde32d79f33 --- /dev/null +++ b/tests/docs/author-normalization/funding/statement-open-access.qmd @@ -0,0 +1,7 @@ +--- +title: Simple Funding +funding: + statement: "The author(s) received no specific funding for this work." + open-access: "This is open access" +format: jats +--- \ No newline at end of file diff --git a/tests/docs/author-normalization/funding/statement-open-acess-list.qmd b/tests/docs/author-normalization/funding/statement-open-acess-list.qmd new file mode 100644 index 00000000000..777b86d6b16 --- /dev/null +++ b/tests/docs/author-normalization/funding/statement-open-acess-list.qmd @@ -0,0 +1,14 @@ +--- +title: Simple Funding +funding: + - statement: | + The author(s) received no specific funding for this work. + open-access: | + Funding to pay the Open Access publication charges for this article was provided by the grant-in-aid for scientific research. + - statement: | + The author(s) also received no specific funding for this work. + + This is another paragraph + open-access: "Funding to pay the Open Access publication charges for this article was provided by the grant-in-aid for scientific research." +format: jats +--- \ No newline at end of file diff --git a/tests/docs/author-normalization/funding/statement.qmd b/tests/docs/author-normalization/funding/statement.qmd new file mode 100644 index 00000000000..7dab92d0282 --- /dev/null +++ b/tests/docs/author-normalization/funding/statement.qmd @@ -0,0 +1,6 @@ +--- +title: Simple Funding +funding: + statement: "The author(s) received no specific funding for this work." +format: jats +--- \ No newline at end of file diff --git a/tests/docs/callouts.qmd b/tests/docs/callouts.qmd index bdb1eabedb9..2f976ae43aa 100644 --- a/tests/docs/callouts.qmd +++ b/tests/docs/callouts.qmd @@ -2,7 +2,7 @@ title: Hello Callout! --- -## Overview of callouts +## Overview of callouts {#overview} ::: {.callout-warning} Callouts provide a simple way to attract attention, for example, to this warning. @@ -24,6 +24,8 @@ Note that there are five types of callouts, including: `note`, `tip`, `warning`, This is an example of a callout with a caption. ::: +## Callout with markup {#markup} + ::: {.callout-tip} ## Caption with **formatted** text, like `function_name()` @@ -40,4 +42,28 @@ This is an example of a 'collapsed' caution callout that can be expanded by the ## Exercise You can also use a plain `callout` class to get a simple callout treatment. +::: + +## Callout Appearance {#appearance} + +::: {.callout-caution appearance="simple"} +A simple callout with no title +::: + +::: {.callout-caution appearance="default"} +A default callout with no title +::: + +::: {.callout-caution appearance="default" icon="false"} +A default callout with no title or icon +::: + +::: {.callout-caution appearance="simple" icon="false"} +A simple callout with no title or icon +::: + +## Minimal + +::: {.callout-caution appearance="minimal"} +A minimal callout with no title ::: \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-margin-figure-div.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-margin-figure-div.qmd new file mode 100644 index 00000000000..0daa1bb7b52 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-margin-figure-div.qmd @@ -0,0 +1,15 @@ +--- +title: "margin captions" +--- + +::: {#fig-cap-margin cap-location="margin"} + +![](img/abbas.jpg) + +A caption + +::: + +![Another caption](img/abbas.jpg){#fig-cap-margin-2 cap-location="margin"} + +See @fig-cap-margin and @fig-cap-margin-2. diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-margin.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-margin.qmd new file mode 100644 index 00000000000..a0e506ebbd4 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-margin.qmd @@ -0,0 +1,38 @@ +--- +title: "margin captions" +keep-md: true +--- + +```{r} +#| label: fig-cap-margin +#| fig-cap: "MPG vs horsepower, colored by transmission." +#| cap-location: margin + +library(ggplot2) +mtcars2 <- mtcars +mtcars2$am <- factor( + mtcars$am, labels = c('automatic', 'manual') +) +ggplot(mtcars2, aes(hp, mpg, color = am)) + + geom_point() + + geom_smooth(formula = y ~ x, method = "loess") + + theme(legend.position = 'bottom') +``` + + +```{r} +#| label: fig-cap-margin-2 +#| fig-cap: "MPG vs horsepower, colored by transmission." + +library(ggplot2) +mtcars2 <- mtcars +mtcars2$am <- factor( + mtcars$am, labels = c('automatic', 'manual') +) +ggplot(mtcars2, aes(hp, mpg, color = am)) + + geom_point() + + geom_smooth(formula = y ~ x, method = "loess") + + theme(legend.position = 'bottom') +``` + +@fig-cap-margin and @fig-cap-margin-2. \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-no-margin-figure-div.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-no-margin-figure-div.qmd new file mode 100644 index 00000000000..d175621b305 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-no-margin-figure-div.qmd @@ -0,0 +1,13 @@ +--- +title: "margin captions" +--- + +::: {#fig-cap-margin} + +![](img/abbas.jpg) + +A caption + +::: + +See @fig-cap-margin. \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-no-margin.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-no-margin.qmd new file mode 100644 index 00000000000..47bd0e117d7 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/captions-no-margin.qmd @@ -0,0 +1,18 @@ +--- +title: "margin captions" +--- + +```{r} +#| label: fig-cap-margin +#| fig-cap: "MPG vs horsepower, colored by transmission." + +library(ggplot2) +mtcars2 <- mtcars +mtcars2$am <- factor( + mtcars$am, labels = c('automatic', 'manual') +) +ggplot(mtcars2, aes(hp, mpg, color = am)) + + geom_point() + + geom_smooth(formula = y ~ x, method = "loess") + + theme(legend.position = 'bottom') +``` \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-margin.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-margin.qmd new file mode 100644 index 00000000000..cf56b630091 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-margin.qmd @@ -0,0 +1,28 @@ +--- +title: figure-margin +format: html +--- + +```{r} +#| label: fig-mtcars +#| fig-cap: "MPG vs horsepower, colored by transmission." +#| column: margin + +library(ggplot2) +mtcars2 <- mtcars +mtcars2$am <- factor( + mtcars$am, labels = c('automatic', 'manual') +) +ggplot(mtcars2, aes(hp, mpg, color = am)) + + geom_point() + + geom_smooth(formula = y ~ x, method = "loess") + + theme(legend.position = 'bottom') +``` + +```{r} +#| column: margin + +knitr::kable( + mtcars[1:6, 1:3] +) +``` \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-div.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-div.qmd new file mode 100644 index 00000000000..55b2154f6be --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-div.qmd @@ -0,0 +1,11 @@ +--- +title: Figure Syntax 1 +keep-tex: true +--- + +::: {#fig-foo} +![](img/surus.jpg) + +This is the figure +::: +See @fig-foo for more. diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-img-no-caption.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-img-no-caption.qmd new file mode 100644 index 00000000000..9a03c31443b --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-img-no-caption.qmd @@ -0,0 +1,7 @@ +--- +title: Figure Syntax 1 +--- + +![](img/surus.jpg){#fig-foo} + +See @fig-foo for more. diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-img.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-img.qmd new file mode 100644 index 00000000000..96d0d158ba3 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-img.qmd @@ -0,0 +1,7 @@ +--- +title: Figure Syntax 1 +--- + +![This is the figure](img/surus.jpg){#fig-foo} + +See @fig-foo for more. diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-link.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-link.qmd new file mode 100644 index 00000000000..9c0ad6b626e --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/figure-syntax-link.qmd @@ -0,0 +1,7 @@ +--- +title: Figure Syntax 1 +--- + +[![This is the figure](img/surus.jpg){#fig-foo}](https://www.example.com/) + +See @fig-foo for more. diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/img/abbas.jpg b/tests/docs/crossrefs/before-newcrossref-regression-tests/img/abbas.jpg new file mode 100644 index 00000000000..835b109d6f2 Binary files /dev/null and b/tests/docs/crossrefs/before-newcrossref-regression-tests/img/abbas.jpg differ diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/img/painter.jpg b/tests/docs/crossrefs/before-newcrossref-regression-tests/img/painter.jpg new file mode 100644 index 00000000000..82f7d35f580 Binary files /dev/null and b/tests/docs/crossrefs/before-newcrossref-regression-tests/img/painter.jpg differ diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/img/surus.jpg b/tests/docs/crossrefs/before-newcrossref-regression-tests/img/surus.jpg new file mode 100644 index 00000000000..9911bdbe3ad Binary files /dev/null and b/tests/docs/crossrefs/before-newcrossref-regression-tests/img/surus.jpg differ diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/img/thinker.jpg b/tests/docs/crossrefs/before-newcrossref-regression-tests/img/thinker.jpg new file mode 100644 index 00000000000..3776f332efe Binary files /dev/null and b/tests/docs/crossrefs/before-newcrossref-regression-tests/img/thinker.jpg differ diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/knitr-filename.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/knitr-filename.qmd new file mode 100644 index 00000000000..aa9c1289010 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/knitr-filename.qmd @@ -0,0 +1,10 @@ +--- +format: html +title: test +--- + +```{#lst-dummy .r lst-cap="Hello." filename="dummy.R"} +1 + 1 +``` + +See @lst-dummy. \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/knitr.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/knitr.qmd new file mode 100644 index 00000000000..205af3ccd61 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/knitr.qmd @@ -0,0 +1,14 @@ +--- +title: Knitr Crossref Test +--- + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Plot" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/listings.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/listings.qmd new file mode 100644 index 00000000000..dd6ade8544e --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/listings.qmd @@ -0,0 +1,9 @@ +--- +title: Listings Test +--- + +```{#lst-customers .sql lst-cap="Customers Query"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/subfigures-layout.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/subfigures-layout.qmd new file mode 100644 index 00000000000..1b63313cc5d --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/subfigures-layout.qmd @@ -0,0 +1,13 @@ +--- +title: basic subfigure test +--- + +::: {#fig-1 layout-ncol=2} + +![Subcaption 1](./img/abbas.jpg){#fig-1-1} + +![Subcaption 2](./img/painter.jpg){#fig-1-2} + +Caption. + +::: diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/subfigures.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/subfigures.qmd new file mode 100644 index 00000000000..c10b9fd4efb --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/subfigures.qmd @@ -0,0 +1,13 @@ +--- +title: basic subfigure test +--- + +::: {#fig-1} + +![Subcaption 1](./img/abbas.jpg){#fig-1-1} + +![Subcaption 2](./img/painter.jpg){#fig-1-2} + +Caption. + +::: diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/subtables.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/subtables.qmd new file mode 100644 index 00000000000..9a7a804cd45 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/subtables.qmd @@ -0,0 +1,23 @@ +--- +title: Table Crossref Test +--- + +::: {#tbl-panel layout-ncol=2} +| Col1 | Col2 | +|------|------| +| A | B | +| E | F | + +: First Table {#tbl-first} + +| Col1 | Col2 | +|------|------| +| A | B | +| E | F | + +: Second Table {#tbl-second} + +Main Caption +::: + +See @tbl-panel for details, especially @tbl-second. \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/table-margin.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/table-margin.qmd new file mode 100644 index 00000000000..f4f9d5e63bb --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/table-margin.qmd @@ -0,0 +1,15 @@ +--- +title: table-margin +keep-md: true +--- + + +```{r} +#| label: tbl-kable +#| tbl-cap: "A margin table with caption" +#| column: margin + +knitr::kable( + mtcars[1:6, 1:3] +) +``` \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/tables-simple.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/tables-simple.qmd new file mode 100644 index 00000000000..c851cedc825 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/tables-simple.qmd @@ -0,0 +1,15 @@ +--- +title: Table Crossref Test +--- + +## Simple Crossref Table + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/tables.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/tables.qmd new file mode 100644 index 00000000000..01316e6ab56 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/tables.qmd @@ -0,0 +1,40 @@ +--- +title: Table Crossref Test +format: latex +--- + +## Simple Crossref Table + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. + +## Sub tables + +::: {#tbl-panel layout-ncol=2} +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: First Table {#tbl-first} + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: Second Table {#tbl-second} + +Main Caption +::: + +See @tbl-panel for details, especially @tbl-second. \ No newline at end of file diff --git a/tests/docs/crossrefs/before-newcrossref-regression-tests/uncaption-column-layout.qmd b/tests/docs/crossrefs/before-newcrossref-regression-tests/uncaption-column-layout.qmd new file mode 100644 index 00000000000..3343d729ad8 --- /dev/null +++ b/tests/docs/crossrefs/before-newcrossref-regression-tests/uncaption-column-layout.qmd @@ -0,0 +1,15 @@ +--- +title: uncaptioned column layouts +keep-md: true +--- + +## Let's test this + +```{r} +#| column: screen-inset-shaded +#| layout-nrow: 1 + +plot(cars) +plot(iris) +plot(pressure) +``` \ No newline at end of file diff --git a/tests/docs/crossrefs/editor-support/theorems.qmd b/tests/docs/crossrefs/editor-support/theorems.qmd new file mode 100644 index 00000000000..1cd581594f9 --- /dev/null +++ b/tests/docs/crossrefs/editor-support/theorems.qmd @@ -0,0 +1,12 @@ +::: {#thm-line} + +## Line + +The equation of any straight line, called a linear equation, can be written as: + +$$ +y = mx + b +$$ +::: + +See @thm-line. \ No newline at end of file diff --git a/tests/docs/crossrefs/figure-syntax-img-no-caption.qmd b/tests/docs/crossrefs/figure-syntax-img-no-caption.qmd new file mode 100644 index 00000000000..9a03c31443b --- /dev/null +++ b/tests/docs/crossrefs/figure-syntax-img-no-caption.qmd @@ -0,0 +1,7 @@ +--- +title: Figure Syntax 1 +--- + +![](img/surus.jpg){#fig-foo} + +See @fig-foo for more. diff --git a/tests/docs/crossrefs/figure-syntax-link.qmd b/tests/docs/crossrefs/figure-syntax-link.qmd new file mode 100644 index 00000000000..9c0ad6b626e --- /dev/null +++ b/tests/docs/crossrefs/figure-syntax-link.qmd @@ -0,0 +1,7 @@ +--- +title: Figure Syntax 1 +--- + +[![This is the figure](img/surus.jpg){#fig-foo}](https://www.example.com/) + +See @fig-foo for more. diff --git a/tests/docs/crossrefs/v1.4/computational-cell-listings.qmd b/tests/docs/crossrefs/v1.4/computational-cell-listings.qmd new file mode 100644 index 00000000000..e32ef93b3d3 --- /dev/null +++ b/tests/docs/crossrefs/v1.4/computational-cell-listings.qmd @@ -0,0 +1,31 @@ +--- +title: PDF subfloats breakage +format: + pdf: + lof: true +validate-yaml: false +--- + +## Computational + +```{r} +#| label: fig-cars +#| fig-cap: This is a caption +#| fig-subcap: +#| - "subcap1" +#| - "subcap2" +plot(cars) +plot(mtcars) +``` + +## Manual + +::: {#fig-2 layout-ncol=2} + +![subcap1](./img/abbas.jpg){#fig-21} + +![subcap2](./img/painter.jpg){#fig-22} + +Caption. + +::: diff --git a/tests/docs/crossrefs/v1.4/custom-categories/diagram.jpg b/tests/docs/crossrefs/v1.4/custom-categories/diagram.jpg new file mode 100644 index 00000000000..82f7d35f580 Binary files /dev/null and b/tests/docs/crossrefs/v1.4/custom-categories/diagram.jpg differ diff --git a/tests/docs/crossrefs/v1.4/custom-categories/diagrams.qmd b/tests/docs/crossrefs/v1.4/custom-categories/diagrams.qmd new file mode 100644 index 00000000000..be4ec88e113 --- /dev/null +++ b/tests/docs/crossrefs/v1.4/custom-categories/diagrams.qmd @@ -0,0 +1,20 @@ +--- +title: Proposed syntax for custom crossrefs +keep-tex: true +crossref: + custom: + - kind: float + prefix: Diagram + name: Diagram + ref-type: dia + latex-env: diagram + latex-list-of-name: lod +--- + +::: {#dia-1} +![](./diagram.jpg) + +A diagram +::: + +See @dia-1. \ No newline at end of file diff --git a/tests/docs/crossrefs/v1.4/figure-crossrefs-pdf.qmd b/tests/docs/crossrefs/v1.4/figure-crossrefs-pdf.qmd new file mode 100644 index 00000000000..66e4178fd79 --- /dev/null +++ b/tests/docs/crossrefs/v1.4/figure-crossrefs-pdf.qmd @@ -0,0 +1,13 @@ +--- +title: PDF subfloats breakage +format: pdf +--- + +::: {#fig-sub-elephant layout-ncol=1} + +![Elephant](img/thinker.jpg){#fig-sub-elephant-sub1} + +![another elephant](img/thinker.jpg){#fig-sub-elephant-sub2} + +Overall caption +::: \ No newline at end of file diff --git a/tests/docs/crossrefs/v1.4/figure-crossrefs.qmd b/tests/docs/crossrefs/v1.4/figure-crossrefs.qmd new file mode 100644 index 00000000000..d15e1fc52c2 --- /dev/null +++ b/tests/docs/crossrefs/v1.4/figure-crossrefs.qmd @@ -0,0 +1,107 @@ +--- +title: All ways to get a figure crossref +keep-md: true +# format: pdf +--- + +## Floats + +### Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Plot" + +plot(cars) +``` + +### Simple Figure + +![Elephant](img/thinker.jpg){#fig-elephant} + +![another elephant](img/thinker.jpg){#fig-elephant-2} + +[![another elephant](img/thinker.jpg){#fig-linked-elephant-2}](https://www.example.com) + +### Figure Div + +::: {#fig-foo} +![](img/surus.jpg) + +This is the figure +::: + +### Linked Figure Div + +::: {#fig-linked-foo} +[![](img/surus.jpg)](https://www.example.com) + +This is the figure +::: + +See @fig-plot, @fig-elephant, @fig-elephant-2, @fig-foo, @fig-linked-foo, @fig-linked-elephant-2. + +## Subfloats + +### Simple subfloats + +::: {#fig-sub-elephant layout-ncol=2} + +![Elephant](img/thinker.jpg){#fig-sub-elephant-sub1} + +![another elephant](img/thinker.jpg){#fig-sub-elephant-sub2} + +Overall caption +::: + +### Div subfloats + +::: {#fig-sub-elephant-2 layout-ncol=2} + +::: {#fig-sub-elephant-2-sub1} +![](img/thinker.jpg) + +This is a subfigure +::: + +::: {#fig-sub-elephant-2-sub2} +![](img/thinker.jpg) + +another elephant +::: + +Overall caption +::: + +### Mixed subfloats + +::: {#fig-sub-elephant-3 layout-ncol=2} + +![This is a subfigure](img/thinker.jpg){#fig-sub-elephant-3-sub1} + +::: {#fig-sub-elephant-3-sub2} +![](img/thinker.jpg) + +another elephant +::: + +Overall caption +::: + +::: {#fig-sub-elephant-3 layout-ncol=2} + +![This is a subfigure](img/thinker.jpg){#fig-sub-elephant-3-sub1} + +```{r} +#| label: fig-sub-elephant-3-sub2 +#| fig-cap: "Not an elephant" + +plot(cars) +``` + +Overall caption +::: + + + + diff --git a/tests/docs/crossrefs/v1.4/img/abbas.jpg b/tests/docs/crossrefs/v1.4/img/abbas.jpg new file mode 100644 index 00000000000..835b109d6f2 Binary files /dev/null and b/tests/docs/crossrefs/v1.4/img/abbas.jpg differ diff --git a/tests/docs/crossrefs/v1.4/img/painter.jpg b/tests/docs/crossrefs/v1.4/img/painter.jpg new file mode 100644 index 00000000000..82f7d35f580 Binary files /dev/null and b/tests/docs/crossrefs/v1.4/img/painter.jpg differ diff --git a/tests/docs/crossrefs/v1.4/img/surus.jpg b/tests/docs/crossrefs/v1.4/img/surus.jpg new file mode 100644 index 00000000000..9911bdbe3ad Binary files /dev/null and b/tests/docs/crossrefs/v1.4/img/surus.jpg differ diff --git a/tests/docs/crossrefs/v1.4/img/thinker.jpg b/tests/docs/crossrefs/v1.4/img/thinker.jpg new file mode 100644 index 00000000000..3776f332efe Binary files /dev/null and b/tests/docs/crossrefs/v1.4/img/thinker.jpg differ diff --git a/tests/docs/crossrefs/v1.4/tables/markdown-table-caption.qmd b/tests/docs/crossrefs/v1.4/tables/markdown-table-caption.qmd new file mode 100644 index 00000000000..2b6ff60c39a --- /dev/null +++ b/tests/docs/crossrefs/v1.4/tables/markdown-table-caption.qmd @@ -0,0 +1,13 @@ +--- +title: table caption test +--- + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. diff --git a/tests/docs/crossrefs/v1.4/tables/rawtablecaption.qmd b/tests/docs/crossrefs/v1.4/tables/rawtablecaption.qmd new file mode 100644 index 00000000000..2d6a83bbf4d --- /dev/null +++ b/tests/docs/crossrefs/v1.4/tables/rawtablecaption.qmd @@ -0,0 +1,22 @@ +--- +title: table caption test +--- + +::: {#tbl-1} + +```{=html} + + + + + + + + + +
This is a caption.
col 1col 2
12
34
+``` + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/extensions/format/academic/document.qmd b/tests/docs/extensions/format/academic/document.qmd index 4a7b0534688..b7ca462ef73 100644 --- a/tests/docs/extensions/format/academic/document.qmd +++ b/tests/docs/extensions/format/academic/document.qmd @@ -112,17 +112,26 @@ Inline equations: $\sum_{i = 2}^\infty\{\alpha_i^\beta\}$ ## Figures and tables -Figure \ref{fig2} is generated using an R chunk. - -```{r fig2, fig.width = 5, fig.height = 5, fig.align='center', out.width="50%", fig.cap = "\\label{fig2}A meaningless scatterplot.", echo = FALSE} +@fig-fig2 is generated using an R chunk. + +```{r} +#| label: fig-fig2 +#| fig-width: 5 +#| fig-height: 5 +#| fig-align: center +#| out-width: 50% +#| fig-cap: A meaningless scatterplot. +#| echo: false plot(runif(25), runif(25)) ``` ## Tables coming from R -Tables can also be generated using R chunks, as shown in Table \ref{tab1} for example. +Tables can also be generated using R chunks, as shown in @tbl-tab1 for example. -```{r tab1, echo = TRUE} +```{r} +#| label: tbl-tab1 +#| echo: true knitr::kable(head(mtcars)[,1:4], caption = "Caption centered above table" ) diff --git a/tests/docs/jats/basic.qmd b/tests/docs/jats/basic.qmd index 9c328558e36..f6d9ad49400 100644 --- a/tests/docs/jats/basic.qmd +++ b/tests/docs/jats/basic.qmd @@ -46,21 +46,22 @@ author: roles: - data curation: lead funding: - - id: award_id_23213 - statement: "Special thanks to sloan foundation and all that." + - statement: "Special thanks to sloan foundation and all that." open-access: "Miscellaneous text about open access that appears here" - source: - - "The Sloan Foundation" - - text: Cool Source - country: USA - recipient: - - ref: cteague - - name: Norah Jones - - institution: Blue Note Records - - John Hamm - investigator: - - Norah Jones - - ref: bn-records + awards: + - id: award_id_23213 + source: + - "The Sloan Foundation" + - text: Cool Source + country: USA + recipient: + - ref: cteague + - name: Norah Jones + - institution: Blue Note Records + - John Hamm + investigator: + - Norah Jones + - ref: cteague - This is another simple statement what is up bro citation: container-id: AGU-SC diff --git a/tests/docs/page-layout/tufte-pdf.qmd b/tests/docs/page-layout/tufte-pdf.qmd index d4a27c1f25c..4403cc36a7c 100644 --- a/tests/docs/page-layout/tufte-pdf.qmd +++ b/tests/docs/page-layout/tufte-pdf.qmd @@ -1,7 +1,7 @@ --- title: "A Quarto Page Layout Example" subtitle: "Inspired by Tufte Handout, Using Quarto" -date: "`r Sys.Date()`" +date: today format: pdf: default reference-location: margin diff --git a/tests/docs/project/book/intro.qmd b/tests/docs/project/book/intro.qmd index da225e80f92..50b9a235478 100644 --- a/tests/docs/project/book/intro.qmd +++ b/tests/docs/project/book/intro.qmd @@ -3,3 +3,5 @@ Hello world. this is an introduction [@afzal2020] + +[A figure](./cover.png){#fig-1} \ No newline at end of file diff --git a/tests/docs/project/book/summary.qmd b/tests/docs/project/book/summary.qmd index ac9323cbcb8..bd8b46a9732 100644 --- a/tests/docs/project/book/summary.qmd +++ b/tests/docs/project/book/summary.qmd @@ -1 +1,3 @@ # Summary + +A reference to @fig-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/2022/12/9/jats/example.qmd b/tests/docs/smoke-all/2022/12/9/jats/example.qmd index 0689a9f5c2c..fbde333b4a8 100644 --- a/tests/docs/smoke-all/2022/12/9/jats/example.qmd +++ b/tests/docs/smoke-all/2022/12/9/jats/example.qmd @@ -37,21 +37,21 @@ author: deceased: true affiliation: Princeton University funding: - - id: award_id_23213 - statement: "Special thanks to sloan foundation and all that." + - statement: "Special thanks to sloan foundation and all that." open-access: "Miscellaneous text about open access that appears here" - source: - - "The Sloan Foundation" - - text: Cool Source - country: USA - recipient: - - ref: cteague - - name: Norah Jones - - institution: Blue Note Records - - John Hamm - investigator: - - Norah Jones - - ref: bn-records + awards: + id: award_id_23213 + source: + - "The Sloan Foundation" + - text: Cool Source + country: USA + recipient: + - ref: cteague + - name: Norah Jones + - institution: Blue Note Records + - John Hamm + investigator: + - Norah Jones - This is another simple statement what is up bro citation: container-id: AGU-SC @@ -96,6 +96,10 @@ format: _quarto: tests: jats: + ensureJatsXpath: + - + - '//fig[@id="tbl-stuff"]//table-wrap//table' # table + - '//fig[@id="tbl-stuff"]//caption' ensureFileRegexMatches: - - '' #mixed citation - '2013' #cite - '[\s\S]*?[\s\S]*?<\/fig>' # regular figure - - '[\s\S]*?[\s\S]*?<\/caption>[\s\S]*?[\s\S]*?<\/table>[\s\S]*?<\/table-wrap>' #table - - '[\s\S]*?<\/fig>' # custom figure div + # FIXME: Pandoc doesn't emit position="float"; do we need to? + # - '[\s\S]*?<\/fig>' # custom figure div + - '[\s\S]*?<\/fig>' # custom figure div - - '' # this id should be on the fig element, not the graphic - '\n\s*' # no nested boxed-text diff --git a/tests/docs/smoke-all/2023/03/28/remote-resources.qmd b/tests/docs/smoke-all/2023/03/28/remote-resources.qmd index bac442ff917..8c61526e36e 100644 --- a/tests/docs/smoke-all/2023/03/28/remote-resources.qmd +++ b/tests/docs/smoke-all/2023/03/28/remote-resources.qmd @@ -6,7 +6,7 @@ _quarto: tests: html: ensureHtmlElements: - - ["#remote-resource > p:nth-child(2) > img", "#remote-resource > p:nth-child(4) > img", "#data-uri > div > figure > p:nth-child(1) > img"] + - ["#remote-resource > :nth-child(2) figure img", "#remote-resource > p:nth-child(4) > img", "#data-uri > div > figure img"] --- ## Remote Resource diff --git a/tests/docs/smoke-all/2023/05/30/crossrefs-dataqmd.qmd b/tests/docs/smoke-all/2023/05/30/crossrefs-dataqmd.qmd new file mode 100644 index 00000000000..d019a9b2f0b --- /dev/null +++ b/tests/docs/smoke-all/2023/05/30/crossrefs-dataqmd.qmd @@ -0,0 +1,24 @@ +--- +title: Crossrefs in data-qmds +number-sections: true +--- + +```{=html} +
+ + + + + + + + + + + + + +
DataRegular output
+``` + +## Methods {#sec-methods} \ No newline at end of file diff --git a/tests/docs/smoke-all/2023/09/08/knitr-quarto-tools-env.qmd b/tests/docs/smoke-all/2023/09/08/knitr-quarto-tools-env.qmd new file mode 100644 index 00000000000..7964702360b --- /dev/null +++ b/tests/docs/smoke-all/2023/09/08/knitr-quarto-tools-env.qmd @@ -0,0 +1,26 @@ +--- +title: R special quarto env +format: markdown +_quarto: + tests: + markdown: + ensureFileRegexMatches: + - ["NBENV: 1"] + - [] +--- + + +format: html +--- + +`tools:quarto` special env should not be duplicated + +```{r} +envs <- base::search() +envs +knitr::asis_output(paste0("NBENV: ", sum(envs == "tools:quarto"))) +``` + +```{ojs} +1 + 1 +``` diff --git a/tests/docs/smoke-all/2023/09/13/knitr-warning-panel-layout.md b/tests/docs/smoke-all/2023/09/13/knitr-warning-panel-layout.md new file mode 100644 index 00000000000..74ccad3639a --- /dev/null +++ b/tests/docs/smoke-all/2023/09/13/knitr-warning-panel-layout.md @@ -0,0 +1,59 @@ +--- +title: Knitr Table Test +keep-md: true +--- + +::: {#tbl-tables .cell layout-ncol="2" tbl-cap='Tables'} + +```{.r .cell-code} +library(knitr) +``` + +::: {.cell-output .cell-output-stderr} + +``` +Warning: le package 'knitr' a été compilé avec la version R 4.2.3 +``` + +::: + +```{.r .cell-code} +kable(head(cars), caption = "Cars {#tbl-cars}") +``` + +::: {.cell-output-display} + +Table: Cars {#tbl-cars} + +| speed | dist | +| ----: | ---: | +| 4 | 2 | +| 4 | 10 | +| 7 | 4 | +| 7 | 22 | +| 8 | 16 | +| 9 | 10 | + +::: + +```{.r .cell-code} +kable(head(pressure), caption = "Pressure {#tbl-pressure}") +``` + +::: {.cell-output-display} + +Table: Pressure {#tbl-pressure} + +| temperature | pressure | +| ----------: | -------: | +| 0 | 0.0002 | +| 20 | 0.0012 | +| 40 | 0.0060 | +| 60 | 0.0300 | +| 80 | 0.0900 | +| 100 | 0.2700 | + +::: +::: + +See @tbl-cars for more information. diff --git a/tests/docs/smoke-all/2023/09/14/6833.qmd b/tests/docs/smoke-all/2023/09/14/6833.qmd new file mode 100644 index 00000000000..575bd94537c --- /dev/null +++ b/tests/docs/smoke-all/2023/09/14/6833.qmd @@ -0,0 +1,29 @@ +--- +title: "Video Test" +_quarto: + tests: + html: + ensureHtmlElements: + - + - "div.v2 iframe[height=\"360\"]" + - "div.v3 iframe[width=\"640\"]" + - [] +--- + +::: v1 + +{{< video https://www.youtube-nocookie.com/embed/aqz-KE-bpKQ width="640" height="360" >}} + +::: + +::: v2 + +{{< video https://www.youtube-nocookie.com/embed/aqz-KE-bpKQ width="640" aspect-ratio="16x9" >}} + +::: + +::: v3 + +{{< video https://www.youtube-nocookie.com/embed/aqz-KE-bpKQ height="360" aspect-ratio="16x9" >}} + +::: \ No newline at end of file diff --git a/tests/docs/smoke-all/2023/09/14/confluence-cross-refs.qmd b/tests/docs/smoke-all/2023/09/14/confluence-cross-refs.qmd new file mode 100644 index 00000000000..f835c7c6172 --- /dev/null +++ b/tests/docs/smoke-all/2023/09/14/confluence-cross-refs.qmd @@ -0,0 +1,178 @@ +--- +title: Confluence Cross Refs +format: confluence-publish +validate-yaml: false +keep-md: true +--- + + + +Goto links @sec-second. + +## My Heading {#sec-first} + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus mattis malesuada. Sed fringilla posuere ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur scelerisque, nisi a consequat aliquet, metus augue feugiat augue, non eleifend lectus eros non nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Mauris sollicitudin auctor orci id vulputate. Pellentesque at luctus urna. Quisque pretium sapien at elit congue maximus. Mauris fermentum sapien eget justo elementum, eleifend auctor dui mattis. Morbi purus elit, auctor id magna et, blandit mattis nunc. Cras commodo leo ut ultrices semper. Nunc a libero dapibus, vestibulum velit sed, bibendum risus. Duis sollicitudin, libero ac sollicitudin maximus, ante massa blandit risus, non laoreet lectus justo non nisl. +![Elephant Inline](elephant.png){#fig-elephant-inline} +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus mattis malesuada. Sed fringilla posuere ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur scelerisque, nisi a consequat aliquet, metus augue feugiat augue, non eleifend lectus eros non nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Mauris sollicitudin auctor orci id vulputate. Pellentesque at luctus urna. Quisque pretium sapien at elit congue maximus. Mauris fermentum sapien eget justo elementum, eleifend auctor dui mattis. Morbi purus elit, auctor id magna et, blandit mattis nunc. Cras commodo leo ut ultrices semper. Nunc a libero dapibus, vestibulum velit sed, bibendum risus. Duis sollicitudin, libero ac sollicitudin maximus, ante massa blandit risus, non laoreet lectus justo non nisl. + +![Elephant](elephant.png){#fig-elephant} + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus mattis malesuada. Sed fringilla posuere ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur scelerisque, nisi a consequat aliquet, metus augue feugiat augue, non eleifend lectus eros non nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Mauris sollicitudin auctor orci id vulputate. Pellentesque at luctus urna. Quisque pretium sapien at elit congue maximus. Mauris fermentum sapien eget justo elementum, eleifend auctor dui mattis. Morbi purus elit, auctor id magna et, blandit mattis nunc. Cras commodo leo ut ultrices semper. Nunc a libero dapibus, vestibulum velit sed, bibendum risus. Duis sollicitudin, libero ac sollicitudin maximus, ante massa blandit risus, non laoreet lectus justo non nisl. + +::: {#fig-elephants layout-ncol=2} + +![Surus](surus.png){#fig-surus} + +![Hanno](hanno.png){#fig-hanno} + +Famous Elephants +::: + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus mattis malesuada. Sed fringilla posuere ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur scelerisque, nisi a consequat aliquet, metus augue feugiat augue, non eleifend lectus eros non nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Mauris sollicitudin auctor orci id vulputate. Pellentesque at luctus urna. Quisque pretium sapien at elit congue maximus. Mauris fermentum sapien eget justo elementum, eleifend auctor dui mattis. Morbi purus elit, auctor id magna et, blandit mattis nunc. Cras commodo leo ut ultrices semper. Nunc a libero dapibus, vestibulum velit sed, bibendum risus. Duis sollicitudin, libero ac sollicitudin maximus, ante massa blandit risus, non laoreet lectus justo non nisl. + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus mattis malesuada. Sed fringilla posuere ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur scelerisque, nisi a consequat aliquet, metus augue feugiat augue, non eleifend lectus eros non nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Mauris sollicitudin auctor orci id vulputate. Pellentesque at luctus urna. Quisque pretium sapien at elit congue maximus. Mauris fermentum sapien eget justo elementum, eleifend auctor dui mattis. Morbi purus elit, auctor id magna et, blandit mattis nunc. Cras commodo leo ut ultrices semper. Nunc a libero dapibus, vestibulum velit sed, bibendum risus. Duis sollicitudin, libero ac sollicitudin maximus, ante massa blandit risus, non laoreet lectus justo non nisl. + + +::: {.cell} + +```{.r .cell-code} +plot(cars) +``` + +::: {.cell-output-display} +![Plot](confluence-cross-refs_files/figure-publish/fig-plot-1.png){#fig-plot} +::: +::: + + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus mattis malesuada. Sed fringilla posuere ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur scelerisque, nisi a consequat aliquet, metus augue feugiat augue, non eleifend lectus eros non nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Mauris sollicitudin auctor orci id vulputate. Pellentesque at luctus urna. Quisque pretium sapien at elit congue maximus. Mauris fermentum sapien eget justo elementum, eleifend auctor dui mattis. Morbi purus elit, auctor id magna et, blandit mattis nunc. Cras commodo leo ut ultrices semper. Nunc a libero dapibus, vestibulum velit sed, bibendum risus. Duis sollicitudin, libero ac sollicitudin maximus, ante massa blandit risus, non laoreet lectus justo non nisl. + + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus mattis malesuada. Sed fringilla posuere ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur scelerisque, nisi a consequat aliquet, metus augue feugiat augue, non eleifend lectus eros non nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Mauris sollicitudin auctor orci id vulputate. Pellentesque at luctus urna. Quisque pretium sapien at elit congue maximus. Mauris fermentum sapien eget justo elementum, eleifend auctor dui mattis. Morbi purus elit, auctor id magna et, blandit mattis nunc. Cras commodo leo ut ultrices semper. Nunc a libero dapibus, vestibulum velit sed, bibendum risus. Duis sollicitudin, libero ac sollicitudin maximus, ante massa blandit risus, non laoreet lectus justo non nisl. + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus mattis malesuada. Sed fringilla posuere ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur scelerisque, nisi a consequat aliquet, metus augue feugiat augue, non eleifend lectus eros non nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Mauris sollicitudin auctor orci id vulputate. Pellentesque at luctus urna. Quisque pretium sapien at elit congue maximus. Mauris fermentum sapien eget justo elementum, eleifend auctor dui mattis. Morbi purus elit, auctor id magna et, blandit mattis nunc. Cras commodo leo ut ultrices semper. Nunc a libero dapibus, vestibulum velit sed, bibendum risus. Duis sollicitudin, libero ac sollicitudin maximus, ante massa blandit risus, non laoreet lectus justo non nisl. + +::: {#tbl-panel layout-ncol=2} +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: First Table {#tbl-first} + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: Second Table {#tbl-second} + +Main Caption +::: + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus mattis malesuada. Sed fringilla posuere ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur scelerisque, nisi a consequat aliquet, metus augue feugiat augue, non eleifend lectus eros non nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Mauris sollicitudin auctor orci id vulputate. Pellentesque at luctus urna. Quisque pretium sapien at elit congue maximus. Mauris fermentum sapien eget justo elementum, eleifend auctor dui mattis. Morbi purus elit, auctor id magna et, blandit mattis nunc. Cras commodo leo ut ultrices semper. Nunc a libero dapibus, vestibulum velit sed, bibendum risus. Duis sollicitudin, libero ac sollicitudin maximus, ante massa blandit risus, non laoreet lectus justo non nisl. + + +::: {#tbl-tables .cell layout-ncol="2" tbl-cap='Tables' tbl-subcap='["Cars","Pressure"]'} + +```{.r .cell-code} +library(knitr) +``` + +::: {.cell-output .cell-output-stderr} + +``` +Warning: le package 'knitr' a été compilé avec la version R 4.2.3 +``` + + +::: + +```{.r .cell-code} +kable(head(cars)) +``` + +::: {.cell-output-display} + + +| speed| dist| +|-----:|----:| +| 4| 2| +| 4| 10| +| 7| 4| +| 7| 22| +| 8| 16| +| 9| 10| + + +::: + +```{.r .cell-code} +kable(head(pressure)) +``` + +::: {.cell-output-display} + + +| temperature| pressure| +|-----------:|--------:| +| 0| 0.0002| +| 20| 0.0012| +| 40| 0.0060| +| 60| 0.0300| +| 80| 0.0900| +| 100| 0.2700| + + +::: +::: + + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus mattis malesuada. Sed fringilla posuere ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur scelerisque, nisi a consequat aliquet, metus augue feugiat augue, non eleifend lectus eros non nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Mauris sollicitudin auctor orci id vulputate. Pellentesque at luctus urna. Quisque pretium sapien at elit congue maximus. Mauris fermentum sapien eget justo elementum, eleifend auctor dui mattis. Morbi purus elit, auctor id magna et, blandit mattis nunc. Cras commodo leo ut ultrices semper. Nunc a libero dapibus, vestibulum velit sed, bibendum risus. Duis sollicitudin, libero ac sollicitudin maximus, ante massa blandit risus, non laoreet lectus justo non nisl. + +```{#lst-customers .sql lst-cap="Customers Query"} +SELECT * FROM Customers +``` + +::: {#thm-line} + +## Line + +The equation of any straight line, called a linear equation, can be written as: + +$$ +y = mx + b +$$ +::: + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus mattis malesuada. Sed fringilla posuere ultricies. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur scelerisque, nisi a consequat aliquet, metus augue feugiat augue, non eleifend lectus eros non nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Mauris sollicitudin auctor orci id vulputate. Pellentesque at luctus urna. Quisque pretium sapien at elit congue maximus. Mauris fermentum sapien eget justo elementum, eleifend auctor dui mattis. Morbi purus elit, auctor id magna et, blandit mattis nunc. Cras commodo leo ut ultrices semper. Nunc a libero dapibus, vestibulum velit sed, bibendum risus. Duis sollicitudin, libero ac sollicitudin maximus, ante massa blandit risus, non laoreet lectus justo non nisl. + +## My Links {#sec-second} + +See @sec-first. + +See @fig-elephant @Fig-elephant [Fig @fig-elephant] [-@fig-elephant] + +See @fig-elephants for examples. In particular, @fig-hanno. + +For example, see @fig-plot. + +See @tbl-tables + +See @tbl-letters + +See @tbl-panel for details, especially @tbl-second. + +Then we query the customers database (@lst-customers). + +See @thm-line. \ No newline at end of file diff --git a/tests/docs/smoke-all/2023/09/18/6871-adoc.md b/tests/docs/smoke-all/2023/09/18/6871-adoc.md new file mode 100644 index 00000000000..8f27f62c8f5 --- /dev/null +++ b/tests/docs/smoke-all/2023/09/18/6871-adoc.md @@ -0,0 +1,66 @@ +--- + +title: Knitr Table Test +format: asciidoc +keep-md: true +\_quarto: +tests: +asciidoc: +ensureFileRegexMatches: # The checks here are looser than I'd like, because checking for asciidoc # nested structures in line-by-line regexes seems impossible, but this # is the only smoke-all test we can run in asciidoc.. # # TODO this is a problem. - - "\\[\\[tbl-cars\\]\\]" - "\\[\\[tbl-pressure\\]\\]" - "\\[#tbl-tables\\]" # TODO understand the difference between [[foo]] and [#foo]. From my reading of the asciidoc docs it seems ok but we should double-check. - "\\. Tables" - "\\. Cars" - "\\. Pressure" - [] + +--- + +::: {#tbl-tables .cell layout-ncol="2" tbl-cap='Tables'} + +```{.r .cell-code} +library(knitr) +``` + +::: {.cell-output .cell-output-stderr} + +``` +Warning: le package 'knitr' a été compilé avec la version R 4.2.3 +``` + +::: + +```{.r .cell-code} +kable(head(cars), caption = "Cars {#tbl-cars}") +``` + +::: {.cell-output-display} + +Table: Cars {#tbl-cars} + +| speed | dist | +| ----: | ---: | +| 4 | 2 | +| 4 | 10 | +| 7 | 4 | +| 7 | 22 | +| 8 | 16 | +| 9 | 10 | + +::: + +```{.r .cell-code} +kable(head(pressure), caption = "Pressure {#tbl-pressure}") +``` + +::: {.cell-output-display} + +Table: Pressure {#tbl-pressure} + +| temperature | pressure | +| ----------: | -------: | +| 0 | 0.0002 | +| 20 | 0.0012 | +| 40 | 0.0060 | +| 60 | 0.0300 | +| 80 | 0.0900 | +| 100 | 0.2700 | + +::: +::: + +See @tbl-cars for more information. diff --git a/tests/docs/smoke-all/2023/09/18/6871.md b/tests/docs/smoke-all/2023/09/18/6871.md new file mode 100644 index 00000000000..88c8fab3cbd --- /dev/null +++ b/tests/docs/smoke-all/2023/09/18/6871.md @@ -0,0 +1,72 @@ +--- +title: Knitr Table Test +format: jats +keep-md: true +_quarto: + tests: + jats: + ensureJatsXpath: + - - '//fig//fig[@id="tbl-cars"]//table' + - '//fig//fig[@id="tbl-cars"]//caption' + - '//fig//fig[@id="tbl-pressure"]//table' + - '//fig//fig[@id="tbl-pressure"]//caption' + - '//fig[@id="tbl-tables"]/caption' + - [] +--- + +::: {#tbl-tables .cell layout-ncol="2" tbl-cap='Tables'} + +```{.r .cell-code} +library(knitr) +``` + +::: {.cell-output .cell-output-stderr} + +``` +Warning: le package 'knitr' a été compilé avec la version R 4.2.3 +``` + +::: + +```{.r .cell-code} +kable(head(cars), caption = "Cars {#tbl-cars}") +``` + +::: {.cell-output-display} + +Table: Cars {#tbl-cars} + +| speed | dist | +| ----: | ---: | +| 4 | 2 | +| 4 | 10 | +| 7 | 4 | +| 7 | 22 | +| 8 | 16 | +| 9 | 10 | + +::: + +```{.r .cell-code} +kable(head(pressure), caption = "Pressure {#tbl-pressure}") +``` + +::: {.cell-output-display} + +Table: Pressure {#tbl-pressure} + +| temperature | pressure | +| ----------: | -------: | +| 0 | 0.0002 | +| 20 | 0.0012 | +| 40 | 0.0060 | +| 60 | 0.0300 | +| 80 | 0.0900 | +| 100 | 0.2700 | + +::: +::: + +See @tbl-cars for more information. + + diff --git a/tests/docs/smoke-all/2023/09/18/6873.md b/tests/docs/smoke-all/2023/09/18/6873.md new file mode 100644 index 00000000000..b6eadb85dbf --- /dev/null +++ b/tests/docs/smoke-all/2023/09/18/6873.md @@ -0,0 +1,534 @@ +--- +title: "table" +format: html +keep-md: true +--- + + +::: {#tbl-unetable .cell} + +```{.r .cell-code} +library(gt) +start_date <- "2010-06-07" +end_date <- "2010-06-14" +sp500 |> + dplyr::filter(date >= start_date & date <= end_date) |> + dplyr::select(-adj_close) |> + gt() |> + tab_header( + title = "S&P 500", + subtitle = glue::glue("{start_date} to {end_date}") + ) |> + fmt_currency() |> + fmt_date(columns = date, date_style = "wd_m_day_year") |> + fmt_number(columns = volume, suffixing = TRUE) +``` + +::: {.cell-output-display} + + +```{=html} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
S&P 500
2010-06-07 to 2010-06-14
dateopenhighlowclosevolume
Mon, Jun 14, 2010$1,095.00$1,105.91$1,089.03$1,089.634.43B
Fri, Jun 11, 2010$1,082.65$1,092.25$1,077.12$1,091.604.06B
Thu, Jun 10, 2010$1,058.77$1,087.85$1,058.77$1,086.845.14B
Wed, Jun 9, 2010$1,062.75$1,077.74$1,052.25$1,055.695.98B
Tue, Jun 8, 2010$1,050.81$1,063.15$1,042.17$1,062.006.19B
Mon, Jun 7, 2010$1,065.84$1,071.36$1,049.86$1,050.475.47B
+
+``` + + +::: +::: \ No newline at end of file diff --git a/tests/docs/smoke-all/2023/09/19/issue-2492-b.qmd b/tests/docs/smoke-all/2023/09/19/issue-2492-b.qmd new file mode 100644 index 00000000000..b53fa0c313c --- /dev/null +++ b/tests/docs/smoke-all/2023/09/19/issue-2492-b.qmd @@ -0,0 +1,26 @@ +--- +title: "MWE" +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - + - "\\\\label\\{fig-e1b\\}" + - "\\\\label\\{fig-e1a\\}" + - "\\\\subcaption\\{.*Surus\\}" + - "\\\\subcaption\\{.*Hanno\\}" + - [] +--- + +Figures + +::: {#fig-elephants layout-ncol="2"} + +![Surus](elephant.jpg){#fig-e1a} + +![Hanno](elephant.jpg){#fig-e1b} + +Famous Elephants +::: + diff --git a/tests/docs/smoke-all/2023/09/19/issue-2492.qmd b/tests/docs/smoke-all/2023/09/19/issue-2492.qmd new file mode 100644 index 00000000000..0f7a45b3ff4 --- /dev/null +++ b/tests/docs/smoke-all/2023/09/19/issue-2492.qmd @@ -0,0 +1,23 @@ +--- +title: "MWE" +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - + - "\\\\subcaption\\{.*Surus\\}" + - "\\\\subcaption\\{.*Hanno\\}" + - [] +--- + +Figures + +::: {#fig-elephants layout-ncol="2"} + +![Surus](elephant.jpg) + +![Hanno](elephant.jpg) + +Famous Elephants +::: diff --git a/tests/docs/smoke-all/2023/09/19/issue-6907.qmd b/tests/docs/smoke-all/2023/09/19/issue-6907.qmd new file mode 100644 index 00000000000..601039b46d7 --- /dev/null +++ b/tests/docs/smoke-all/2023/09/19/issue-6907.qmd @@ -0,0 +1,19 @@ +--- +title: "Footnote in Fig. Caption PDF issue." + +format: + pdf: + pdf-engine: xelatex + documentclass: scrartcl + fig-pos: "H" + output: true + toc: true + lof: true + colorlinks: true + code-line-numbers: true +--- + + +## A Figure + +![The caption of a figure with a footnote ^[This is a figure caption footnote containing a link ]](https://quarto.org/quarto-dark-bg.jpeg) diff --git a/tests/docs/smoke-all/2023/09/19/table-code-cell-location-bug.qmd b/tests/docs/smoke-all/2023/09/19/table-code-cell-location-bug.qmd new file mode 100644 index 00000000000..e74869f32ff --- /dev/null +++ b/tests/docs/smoke-all/2023/09/19/table-code-cell-location-bug.qmd @@ -0,0 +1,22 @@ +--- +title: table-cell-bug +keep-md: true +_quarto: + tests: + html: + ensureHtmlElements: + - [] + - ["figure div.cell-code pre"] +--- + +```{r} +#| label: tbl-1 +#| tbl-cap: A caption +knitr::kable(cars) +``` + +```{r} +#| label: fig-1 +#| fig-cap: A caption +plot(cars) +``` diff --git a/tests/docs/smoke-all/2023/09/21/issue-6935.qmd b/tests/docs/smoke-all/2023/09/21/issue-6935.qmd new file mode 100644 index 00000000000..c50a6473d70 --- /dev/null +++ b/tests/docs/smoke-all/2023/09/21/issue-6935.qmd @@ -0,0 +1,28 @@ +--- +title: issue-6935 +_quarto: + tests: + gfm: + ensureFileRegexMatches: + - + - "[>] ### With title" # Note that all headers are re-rendered to level 3 + - "[>] This is a callout" + - "[>] \\[[!]NOTE\\]" + - "[>] \\[[!]IMPORTANT\\]" + - ["
"] +--- + +::: {.callout-note} + +## With title + +This is a callout + +::: + + +::: {.callout-important} + +This is a callout without a title. + +::: diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-1.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-1.qmd new file mode 100644 index 00000000000..03fd062dfe2 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-1.qmd @@ -0,0 +1,44 @@ +--- +title: float crossref test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "\\[\\[fig-1\\]\\]" + - "<>" + - "\\[\\[tbl-1\\]\\]" + - "<>" + - [] +--- + +This tests: + +- custom content in floats +- classes of float captions + +::: {#fig-1} + +::: {.figure-content} +This is the figure content. +::: + +This is a caption. + +::: + +See @fig-1. + + +::: {#tbl-1} + +::: {.table-content} +This is the table content. +::: + +This is a table. + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-2.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-2.qmd new file mode 100644 index 00000000000..a8b98b339e2 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-2.qmd @@ -0,0 +1,36 @@ +--- +title: float crossref test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "image::img/surus.jpg" + - "\\[#fig-foo\\]" + - "\\[#tbl-foo\\]" + - "<>" + - "<>" +--- + +This tests: + +- div float with image element as payload. +- div float with image element as payload for non-figure floats. + + +::: {#fig-foo} +![](img/surus.jpg) + +This is the figure +::: +See @fig-foo for more. + + +::: {#tbl-foo} +![](img/surus.jpg) + +This is the table +::: +See @tbl-foo for more. + diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-3.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-3.qmd new file mode 100644 index 00000000000..69b8f962715 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-3.qmd @@ -0,0 +1,24 @@ +--- +title: float crossref test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "image::img/surus.jpg" + - "\\[#tbl-foo\\]" + - "\\[#fig-foo\\]" + - "<>" + - "<>" +--- + +This tests: + +- float syntax for implicit figures and tables as images with identifiers + +![This is a figure](img/surus.jpg){#fig-foo} + +![This is a table](img/surus.jpg){#tbl-foo} + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-4.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-4.qmd new file mode 100644 index 00000000000..70207a442eb --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-4.qmd @@ -0,0 +1,25 @@ +--- +title: float test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "https://www.example.com/\\[image:img/surus.jpg\\[This is the figure" + - "https://www.example.com/\\[image:img/surus.jpg\\[This is the table" + - "\\[\\[fig-foo\\]\\]" + - "\\[\\[tbl-foo\\]\\]" + - "<>" + - "<>" +--- + +This tests: + +- float syntax for implicit figures and tables as linked images with identifiers + +[![This is the figure](img/surus.jpg){#fig-foo}](https://www.example.com/) + +[![This is the table](img/surus.jpg){#tbl-foo}](https://www.example.com/) + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-5.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-5.qmd new file mode 100644 index 00000000000..ddcc374b588 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-5.qmd @@ -0,0 +1,20 @@ +--- +title: Crossref Test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "\\.Elephant" + - "\\[#fig-elephant\\]" + - "image::img/thinker.jpg" + - + - "<>" +--- + +## Unresolved Crossref Figure + +![Elephant](img/thinker.jpg){#fig-elephant} + +See @fig-elephant1 for examples. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-6.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-6.qmd new file mode 100644 index 00000000000..5694e8fe790 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-6.qmd @@ -0,0 +1,18 @@ +--- +title: test simple figure crossref +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "image::img/surus.jpg" + - "\\[#fig-simple\\]" + - "<>" + - [] +--- + +![A simple figure](img/surus.jpg){#fig-simple} + +See @fig-simple. + diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-caption-formatting-1.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-caption-formatting-1.qmd new file mode 100644 index 00000000000..1875bd14e78 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-caption-formatting-1.qmd @@ -0,0 +1,19 @@ +--- +title: caption-formatting-test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "\\. Customers _query_" + - "<>" + - "\\[\\[lst-customers\\]\\]" +--- + +```{#lst-customers .sql lst-cap="Customers *query*"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). + diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-numbering-1.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-numbering-1.qmd new file mode 100644 index 00000000000..093c2cb2e65 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-numbering-1.qmd @@ -0,0 +1,49 @@ +--- +title: "My Document" +format: asciidoc +# None of this is supported by asciidoc output afaict, so no testing necessary here, +# we just make sure it doesn't crash. +# +# crossref: +# fig-labels: alpha x # (default is arabic) +# tbl-labels: alpha A # (default is arabic) +# subref-labels: roman i # (default is alpha a) +# _quarto: +# tests: +# html: +# ensureFileRegexMatches: +# - +# - "Figure x: Elephant" +# - "Table A: My Caption" +# - "Figure y: Famous Elephants" +# - "\\(i\\) Surus" +# - "\\(ii\\) Abbas" +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + +| Col1 | Col2 | Col3 | +| ---- | ---- | ---- | +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol="2"} +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-options-1.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-options-1.qmd new file mode 100644 index 00000000000..4627feee380 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-options-1.qmd @@ -0,0 +1,39 @@ +--- +# I think asciidoc doesn't support custom crossref prefixes, so we're not testing anything here. +title: "My Document" +format: asciidoc +crossref: + fig-prefix: F. # (default is "fig.") + tbl-prefix: T. # (default is "tbl.") + title-delim: — # (default is ":") + ref-hyperlink: false # (default is true) +# _quarto: +# tests: +# html: +# ensureHtmlElements: +# - [] +# - +# - "a[href='#tbl-1'].quarto-xref" # ref-hyperlink: false +# ensureFileRegexMatches: +# - +# - "Figure 1— Elephant" +# - "See T. 1." +# - "See F. 1." +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-jupyter-1.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-jupyter-1.qmd new file mode 100644 index 00000000000..bc53ba90f19 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-jupyter-1.qmd @@ -0,0 +1,27 @@ +--- +title: Python Crossref Test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "<>" + - "\\[#fig-plot\\]" + - "\\.Plot" + - "image:.*/fig-plot-output-1.png" + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plot +#| fig-cap: "Plot" + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-jupyter-2.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-jupyter-2.qmd new file mode 100644 index 00000000000..00c861e0954 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-jupyter-2.qmd @@ -0,0 +1,37 @@ +--- +title: Python Subfig Test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "import matplotlib.pyplot as plt" # this checks if the panel preamble has been emitted + - "\\[#fig-plots\\]" + - "\\[#fig-plots-1\\]" + - "\\[#fig-plots-2\\]" + - "\\. Plots" + - "\\.Plot 1" + - "\\.Plot 2" + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plots +#| fig-cap: "Plots" +#| fig-subcap: +#| - "Plot 1" +#| - "Plot 2" +#| layout-ncol: 2 + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() + +plt.plot([8,65,23,90]) +plt.show() +``` + +See @fig-plots for examples. In particular, @fig-plots-2. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-1.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-1.qmd new file mode 100644 index 00000000000..9ca579466ea --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-1.qmd @@ -0,0 +1,24 @@ +--- +title: Knitr Crossref Test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "<>" + - "\\[#fig-plot\\]" + - "\\.Plot" + - "image:.*fig-plot-1.png" +--- + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Plot" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-2.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-2.qmd new file mode 100644 index 00000000000..ac99a74bd43 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-2.qmd @@ -0,0 +1,31 @@ +--- +title: Knitr Crossref Test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "\\.Fancy _caption_" # markdown processing test (*caption* -> _caption_) + - "\\..*latexmath:\\[e=mc\\^2\\]" # math processing test + - "<>" + - "\\[#fig-plot\\]" + - "image:.*fig-plot-1.png" +--- + + +This tests: + +- float figures from knitr +- Markdown support for captions from knitr + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Fancy *caption* with math: $e=mc^2$" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-table-captions-1.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-table-captions-1.qmd new file mode 100644 index 00000000000..f18a8f7a582 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-table-captions-1.qmd @@ -0,0 +1,33 @@ +--- +title: Knitr Table Test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + # The checks here are looser than I'd like, because checking for asciidoc + # nested structures in line-by-line regexes seems impossible, but this + # is the only smoke-all test we can run in asciidoc.. + # + # TODO this is a problem. + - + - "\\[\\[tbl-cars\\]\\]" + - "\\[\\[tbl-pressure\\]\\]" + - "\\[#tbl-tables\\]" # TODO understand the difference between [[foo]] and [#foo]. From my reading of the asciidoc docs it seems ok but we should double-check. + - "\\. Tables" + - "\\. Cars" + - "\\. Pressure" + - [] +--- + +```{r} +#| label: tbl-tables +#| tbl-cap: "Tables" +#| layout-ncol: 2 + +library(knitr) +kable(head(cars), caption = "Cars {#tbl-cars}") +kable(head(pressure), caption = "Pressure {#tbl-pressure}") +``` + +See @tbl-cars for more information. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-listings-1.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-listings-1.qmd new file mode 100644 index 00000000000..453b7677c3b --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-listings-1.qmd @@ -0,0 +1,18 @@ +--- +title: Listings Test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "<>" + - "\\[\\[lst-customers\\]\\]" + - "\\. Customers Query" +--- + +```{#lst-customers .sql lst-cap="Customers Query"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-lst-cap-location-1.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-lst-cap-location-1.qmd new file mode 100644 index 00000000000..cd8f50f3c70 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-lst-cap-location-1.qmd @@ -0,0 +1,25 @@ +--- +# asciidoc doesn't appear to support caption location control, so there's nothing to test here +title: lst-cap-location-test +format: asciidoc +# _quarto: +# tests: +# html: +# ensureHtmlElements: +# - +# - "div#lst-customers figcaption:nth-child(1)" +# - "div#lst-customers-2 figcaption:nth-child(2)" +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). + + +```{#lst-customers-2 .sql lst-cap="Customers _query_" lst-cap-location="bottom"} +SELECT * FROM Customers +``` + +Then we query the customers database again (@lst-customers-2), with a caption in a different location. diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-subfloat-1.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-subfloat-1.qmd new file mode 100644 index 00000000000..15ec1759a7c --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/asciidoc-subfloat-1.qmd @@ -0,0 +1,30 @@ +--- +title: Crossref Test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "\\.Surus" + - "\\.Abbas" + - "\\. Famous Elephants" # TODO We should try to understand why some captions have spaces in front of them and others don't + - "\\[#fig-elephants\\]" + - "\\[#fig-surus\\]" + - "\\[#fig-abbas\\]" + - "image::img/surus.jpg" + - "image::img/abbas.jpg" +--- + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol=2} + +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas and @fig-surus. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/asciidoc/rawtablecaption.qmd b/tests/docs/smoke-all/crossrefs/float/asciidoc/rawtablecaption.qmd new file mode 100644 index 00000000000..6079104ce5f --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/asciidoc/rawtablecaption.qmd @@ -0,0 +1,32 @@ +--- +title: table caption test +format: asciidoc +_quarto: + tests: + asciidoc: + ensureFileRegexMatches: + - + - "\\. This is a caption\\." + - "<>" + - "\\[\\[tbl-1\\]\\]" + - [] +--- + +::: {#tbl-1} + +```{=html} + + + + + + + + + +
This is a caption.
col 1col 2
12
34
+``` + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-float-1.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-1.qmd new file mode 100644 index 00000000000..ea2249a9f0e --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-1.qmd @@ -0,0 +1,41 @@ +--- +title: float crossref test +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:t[contains(text(), \"Table\u00a01\")]" # tests custom content in tables + - "//w:t[contains(text(), \"Figure\u00a01\")]" # tests custom content in figures + - [] +--- + +This tests: + +- custom content in floats +- classes of float captions + +::: {#fig-1} + +::: {.figure-content} +This is the figure content. +::: + +This is a caption. + +::: + +See @fig-1. + + +::: {#tbl-1} + +::: {.table-content} +This is the table content. +::: + +This is a table. + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-float-2.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-2.qmd new file mode 100644 index 00000000000..02867d086f0 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-2.qmd @@ -0,0 +1,36 @@ +--- +title: float crossref test +format: docx +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:tbl//w:p//w:r//w:t[contains(text(), \"Figure\u00a01\")]" + - "//w:tbl//w:p//w:r//w:t[contains(text(), \"Table\u00a01\")]" + - "//w:hyperlink[@w:anchor=\"tbl-foo\"]//w:t[contains(text(), \"Table\u00a01\")]" + - "//w:hyperlink[@w:anchor=\"fig-foo\"]//w:t[contains(text(), \"Figure\u00a01\")]" + - [] +--- + +This tests: + +- div float with image element as payload. +- div float with image element as payload for non-figure floats. + + +::: {#fig-foo} +![](../img/surus.jpg) + +This is the figure +::: +See @fig-foo for more. + + +::: {#tbl-foo} +![](../img/surus.jpg) + +This is the table +::: +See @tbl-foo for more. + diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-float-3.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-3.qmd new file mode 100644 index 00000000000..975850da9a3 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-3.qmd @@ -0,0 +1,21 @@ +--- +title: float test +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:tbl//w:p//w:r//w:t[contains(text(), \"Figure\u00a01\")]" + - "//w:tbl//w:p//w:r//w:t[contains(text(), \"Table\u00a01\")]" + - "//w:hyperlink[@w:anchor=\"tbl-foo\"]//w:t[contains(text(), \"Table\u00a01\")]" + - "//w:hyperlink[@w:anchor=\"fig-foo\"]//w:t[contains(text(), \"Figure\u00a01\")]" + - [] +--- + +This tests: + +![This is the figure](../img/surus.jpg){#fig-foo} + +![This is the table](../img/surus.jpg){#tbl-foo} + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-float-4.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-4.qmd new file mode 100644 index 00000000000..9c54d16bda5 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-4.qmd @@ -0,0 +1,21 @@ +--- +title: float test +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:tbl//w:p//w:r//w:t[contains(text(), \"Figure\u00a01\")]" + - "//w:tbl//w:p//w:r//w:t[contains(text(), \"Table\u00a01\")]" + - "//w:hyperlink[@w:anchor=\"tbl-foo\"]//w:t[contains(text(), \"Table\u00a01\")]" + - "//w:hyperlink[@w:anchor=\"fig-foo\"]//w:t[contains(text(), \"Figure\u00a01\")]" + - [] +--- + +This tests: + +[![This is the figure](../img/surus.jpg){#fig-foo}](https://www.example.com/) + +[![This is the table](../img/surus.jpg){#tbl-foo}](https://www.example.com/) + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-float-5.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-5.qmd new file mode 100644 index 00000000000..acae3bcc655 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-5.qmd @@ -0,0 +1,18 @@ +--- +title: Crossref Test +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:p//w:r//w:t[contains(text(), \"?@fig-elephant1\")]" + - "//w:tbl//w:p//w:r//w:t[contains(text(), \"Figure\u00a01\")]" + - + - "//w:p//w:hyperlink//w:r//w:t[contains(text(), \"Figure\u00a01\")]" +--- + +## Unresolved Crossref Figure + +![Elephant](../img/thinker.jpg){#fig-elephant} + +See @fig-elephant1 for examples. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-float-caption-formatting-1.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-caption-formatting-1.qmd new file mode 100644 index 00000000000..370349f97dd --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-caption-formatting-1.qmd @@ -0,0 +1,15 @@ +--- +title: caption-formatting-test +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:i" +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-float-numbering-1.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-numbering-1.qmd new file mode 100644 index 00000000000..142ec54cba4 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-numbering-1.qmd @@ -0,0 +1,46 @@ +--- +title: "My Document" +crossref: + fig-labels: alpha x # (default is arabic) + tbl-labels: alpha A # (default is arabic) + subref-labels: roman i # (default is alpha a) +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:tbl//w:tr//w:r//w:t[text()=\"Figure\u00a0x: Elephant\"]" + - "//w:tbl//w:tr//w:r//w:t[text()=\"Table\u00a0A: My Caption\"]" + - "//w:r//w:t[text()=\"Figure\u00a0y: Famous Elephants\"]" + - "//w:tbl//w:tr//w:r//w:t[text()=\"(i) Surus\"]" + - "//w:tbl//w:tr//w:r//w:t[text()=\"(ii) Abbas\"]" + - [] +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + +| Col1 | Col2 | Col3 | +| ---- | ---- | ---- | +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol="2"} +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-float-options-1.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-options-1.qmd new file mode 100644 index 00000000000..5af81cf6920 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-float-options-1.qmd @@ -0,0 +1,35 @@ +--- +title: "My Document" +crossref: + fig-prefix: F. # (default is "fig.") + tbl-prefix: T. # (default is "tbl.") + title-delim: — # (default is ":") + ref-hyperlink: false # (default is true) +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:p//w:r//w:t[contains(text(), \"See T.\u00a01\")]" + - "//w:p//w:r//w:t[contains(text(), \"See F.\u00a01\")]" + - "//w:t[contains(text(), \"Table\u00a01\")]" + - + - "//w:hyperlink[@w:anchor=\"tbl-foo\"]//w:t[contains(text(), \"Table\u00a01\")]" # ref-hyperlink: false +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-jupyter-1.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-jupyter-1.qmd new file mode 100644 index 00000000000..54ebc51c19f --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-jupyter-1.qmd @@ -0,0 +1,32 @@ +--- +title: Python Crossref Test +_quarto: + tests: + # html: + # ensureFileRegexMatches: + # - [] + # - [] + # ensureHtmlElements: + # - + # - "div#fig-plot figure.quarto-float-fig figcaption.quarto-float-caption" + # - [] + docx: + ensureDocxXpath: + - + - "//w:tbl//w:p//w:r//w:t[contains(text(), \"Figure\u00a01\")]" + - "//w:hyperlink[@w:anchor=\"fig-plot\"]//w:t[contains(text(), \"Figure\u00a01\")]" + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plot +#| fig-cap: "Plot" + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-jupyter-2.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-jupyter-2.qmd new file mode 100644 index 00000000000..a164782953f --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-jupyter-2.qmd @@ -0,0 +1,32 @@ +--- +title: Python Subfig Test +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:tbl//w:t[text()=\"(b) Plot 2\"]" + - "//w:tbl//w:t[text()=\"(a) Plot 1\"]" + - "//w:t[text()=\"Figure\u00a01: Plots\"]" + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plots +#| fig-cap: "Plots" +#| fig-subcap: +#| - "Plot 1" +#| - "Plot 2" +#| layout-ncol: 2 + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() + +plt.plot([8,65,23,90]) +plt.show() +``` + +See @fig-plots for examples. In particular, @fig-plots-2. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-knitr-1.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-knitr-1.qmd new file mode 100644 index 00000000000..cdee88e9a49 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-knitr-1.qmd @@ -0,0 +1,22 @@ +--- +title: Knitr Crossref Test +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:tbl//w:p//w:r//w:t[contains(text(), \"Figure\u00a01\")]" + - "//w:hyperlink[@w:anchor=\"fig-plot\"]//w:t[contains(text(), \"Figure\u00a01\")]" + - [] +--- + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Plot" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-knitr-2.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-knitr-2.qmd new file mode 100644 index 00000000000..72689b622d5 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-knitr-2.qmd @@ -0,0 +1,30 @@ +--- +title: Knitr Crossref Test +format: html +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:i" + - "//m:oMath" + - "//w:bookmarkStart[@w:name=\"fig-plot\"]" + - "//w:drawing" +--- + + +This tests: + +- float figures from knitr +- Markdown support for captions from knitr + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Fancy _caption_ with math: $e=mc^2$" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-knitr-table-captions-1.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-knitr-table-captions-1.qmd new file mode 100644 index 00000000000..687961b1841 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-knitr-table-captions-1.qmd @@ -0,0 +1,29 @@ +--- +title: Knitr Table Test +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:hyperlink[@w:anchor=\"tbl-cars\"]" + - "//w:hyperlink[@w:anchor=\"tbl-pressure\"]" + - "//w:tbl//w:r//w:t[text()=\"(a) Cars\"]" + - "//w:tbl//w:r//w:t[text()=\"(b) Pressure\"]" + - "//w:r//w:t[text()=\"Table\u00a01: Tables\"]" + - "//w:tbl//w:bookmarkStart[@w:name=\"tbl-cars\"]" + - "//w:tbl//w:bookmarkStart[@w:name=\"tbl-pressure\"]" + - "//w:bookmarkStart[@w:name=\"tbl-tables\"]" + - [] +--- + +```{r} +#| label: tbl-tables +#| tbl-cap: "Tables" +#| layout-ncol: 2 + +library(knitr) +kable(head(cars), caption = "Cars {#tbl-cars}") +kable(head(pressure), caption = "Pressure {#tbl-pressure}") +``` + +See @tbl-cars and @tbl-pressure for more information. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-listings-1.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-listings-1.qmd new file mode 100644 index 00000000000..346168feaad --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-listings-1.qmd @@ -0,0 +1,16 @@ +--- +title: Listings Test +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:hyperlink[@w:anchor=\"lst-customers\"]//w:t[contains(text(), \"Listing\u00a01\")]" + - [] +--- + +```{#lst-customers .sql lst-cap="Customers Query"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-lst-cap-location-1.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-lst-cap-location-1.qmd new file mode 100644 index 00000000000..5093ea25c11 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-lst-cap-location-1.qmd @@ -0,0 +1,25 @@ +--- +title: lst-cap-location-test +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:hyperlink[@w:anchor=\"lst-customers\"]" + - "//w:hyperlink[@w:anchor=\"lst-customers-2\"]" + - "//w:p//w:r//w:t[contains(text(), \"Listing\u00a01\")]" + - "//w:p//w:r//w:t[contains(text(), \"Listing\u00a02\")]" +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). + + +```{#lst-customers-2 .sql lst-cap="Customers _query_" lst-cap-location="bottom"} +SELECT * FROM Customers +``` + +Then we query the customers database again (@lst-customers-2), with a caption in a different location. diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-simple-figure.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-simple-figure.qmd new file mode 100644 index 00000000000..1f452ae2210 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-simple-figure.qmd @@ -0,0 +1,15 @@ +--- +format: docx +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:document" + - "//w:bookmarkStart[@w:name=\"fig-1\"]" + - [] +--- + +![A caption](../img/surus.jpg){#fig-1} + +A reference to @fig-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/docx-subfloat-1.qmd b/tests/docs/smoke-all/crossrefs/float/docx/docx-subfloat-1.qmd new file mode 100644 index 00000000000..f592ebf0ef6 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/docx-subfloat-1.qmd @@ -0,0 +1,29 @@ +--- +title: Crossref Test +format: docx +_quarto: + tests: + docx: + ensureDocxXpath: + - + - "//w:p//w:r//w:t[text()=\"Figure\u00a01: Famous Elephants\"]" + - "//w:tr//w:tc//w:p//w:r//w:t[text()=\"(a) Surus\"]" + - "//w:tr//w:tc//w:p//w:r//w:t[text()=\"(b) Abbas\"]" + - "//w:hyperlink[@w:anchor=\"fig-elephants\"]//w:t[contains(text(), \"Figure\u00a01\")]" + - "//w:hyperlink[@w:anchor=\"fig-abbas\"]//w:t[contains(text(), \"Figure\u00a01 (b)\")]" + - "//w:hyperlink[@w:anchor=\"fig-surus\"]//w:t[contains(text(), \"Figure\u00a01 (a)\")]" + - [] +--- + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol=2} + +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas and @fig-surus. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/docx/rawtablecaption.qmd b/tests/docs/smoke-all/crossrefs/float/docx/rawtablecaption.qmd new file mode 100644 index 00000000000..d33efcdf5a3 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/docx/rawtablecaption.qmd @@ -0,0 +1,29 @@ +--- +title: table caption test +_quarto: + tests: + html: + ensureFileRegexMatches: + - + - "Table\\ \\;1: This is a caption." + - [] +--- + +::: {#tbl-1} + +```{=html} + + + + + + + + + +
This is a caption.
col 1col 2
12
34
+``` + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/fig-cap.qmd b/tests/docs/smoke-all/crossrefs/float/fig-cap.qmd new file mode 100644 index 00000000000..e8e88b2d2e9 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/fig-cap.qmd @@ -0,0 +1,25 @@ +--- +title: fig-cap on div test +_quarto: + tests: + html: + ensureFileRegexMatches: + - + - "Figure\\ 1: This is a caption on a div" + - "Table\\ 1: This is a table caption on a div" + ensureHtmlElements: + - ["figcaption"] +--- + +::: {#fig-1 fig-cap="This is a caption on a div"} + +![](img/surus.jpg) + +::: + + +::: {#tbl-1 tbl-cap="This is a table caption on a div"} + +![](img/surus.jpg) + +::: \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-float-1.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-float-1.qmd new file mode 100644 index 00000000000..cf35d8777f6 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-float-1.qmd @@ -0,0 +1,45 @@ +--- +title: float crossref test +_quarto: + tests: + html: + ensureHtmlElements: + - + - "div.figure-content" + - "div.table-content" + - "figcaption.figure" + - "figcaption.table" + - "a[href='#fig-1'].quarto-xref" + - "a[href='#tbl-1'].quarto-xref" + - [] +--- + +This tests: + +- custom content in floats +- classes of float captions + +::: {#fig-1} + +::: {.figure-content} +This is the figure content. +::: + +This is a caption. + +::: + +See @fig-1. + + +::: {#tbl-1} + +::: {.table-content} +This is the table content. +::: + +This is a table. + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-float-2.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-float-2.qmd new file mode 100644 index 00000000000..1091dda310a --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-float-2.qmd @@ -0,0 +1,35 @@ +--- +title: float crossref test +format: html +_quarto: + tests: + html: + ensureHtmlElements: + - + - "div#tbl-foo figure.quarto-float-tbl img" + - "div#fig-foo figure.quarto-float-fig img" + - "a[href='#fig-foo'].quarto-xref" + - "a[href='#tbl-foo'].quarto-xref" +--- + +This tests: + +- div float with image element as payload. +- div float with image element as payload for non-figure floats. + + +::: {#fig-foo} +![](img/surus.jpg) + +This is the figure +::: +See @fig-foo for more. + + +::: {#tbl-foo} +![](img/surus.jpg) + +This is the table +::: +See @tbl-foo for more. + diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-float-3.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-float-3.qmd new file mode 100644 index 00000000000..58c3bacfa76 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-float-3.qmd @@ -0,0 +1,23 @@ +--- +title: float crossref test +format: html +_quarto: + tests: + html: + ensureHtmlElements: + - + - "div#tbl-foo figure.quarto-float-tbl img" + - "div#fig-foo figure.quarto-float-fig img" + - "a[href='#fig-foo'].quarto-xref" + - "a[href='#tbl-foo'].quarto-xref" +--- + +This tests: + +- float syntax for implicit figures and tables as images with identifiers + +![This is a figure](img/surus.jpg){#fig-foo} + +![This is a table](img/surus.jpg){#tbl-foo} + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-float-4.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-float-4.qmd new file mode 100644 index 00000000000..bce261def40 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-float-4.qmd @@ -0,0 +1,23 @@ +--- +title: float test +format: html +_quarto: + tests: + html: + ensureHtmlElements: + - + - "div#tbl-foo figure.quarto-float-tbl a img" + - "div#fig-foo figure.quarto-float-fig a img" + - "a[href='#fig-foo'].quarto-xref" + - "a[href='#tbl-foo'].quarto-xref" +--- + +This tests: + +- float syntax for implicit figures and tables as linked images with identifiers + +[![This is the figure](img/surus.jpg){#fig-foo}](https://www.example.com/) + +[![This is the table](img/surus.jpg){#tbl-foo}](https://www.example.com/) + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-float-5.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-float-5.qmd new file mode 100644 index 00000000000..5bc7d72130e --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-float-5.qmd @@ -0,0 +1,17 @@ +--- +title: Crossref Test +_quarto: + tests: + html: + ensureHtmlElements: + - + - "div#fig-elephant figure.quarto-float-fig figcaption.figure" + - + - "a[href='#fig-elephant1'].quarto-xref" +--- + +## Unresolved Crossref Figure + +![Elephant](img/thinker.jpg){#fig-elephant} + +See @fig-elephant1 for examples. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-float-6.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-float-6.qmd new file mode 100644 index 00000000000..ae3b789a0bd --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-float-6.qmd @@ -0,0 +1,18 @@ +--- +title: test simple figure crossref +_quarto: + tests: + html: + ensureHtmlElements: + - + - "div#fig-simple figure.quarto-float-fig img" + - "figcaption.figure" + - "a[href='#fig-simple'].quarto-xref" + - [] + +--- + +![A simple figure](img/surus.jpg){#fig-simple} + +See @fig-simple. + diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-float-caption-formatting-1.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-float-caption-formatting-1.qmd new file mode 100644 index 00000000000..b812ca8a72b --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-float-caption-formatting-1.qmd @@ -0,0 +1,15 @@ +--- +title: caption-formatting-test +_quarto: + tests: + html: + ensureHtmlElements: + - + - "div#lst-customers figcaption em" +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-float-numbering-1.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-float-numbering-1.qmd new file mode 100644 index 00000000000..1f3999eea46 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-float-numbering-1.qmd @@ -0,0 +1,45 @@ +--- +title: "My Document" +crossref: + fig-labels: alpha x # (default is arabic) + tbl-labels: alpha A # (default is arabic) + subref-labels: roman i # (default is alpha a) +_quarto: + tests: + html: + ensureFileRegexMatches: + - + - "Figure x: Elephant" + - "Table A: My Caption" + - "Figure y: Famous Elephants" + - "\\(i\\) Surus" + - "\\(ii\\) Abbas" +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + +| Col1 | Col2 | Col3 | +| ---- | ---- | ---- | +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol="2"} +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-float-options-1.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-float-options-1.qmd new file mode 100644 index 00000000000..195ec61d533 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-float-options-1.qmd @@ -0,0 +1,37 @@ +--- +title: "My Document" +crossref: + fig-prefix: F. # (default is "fig.") + tbl-prefix: T. # (default is "tbl.") + title-delim: — # (default is ":") + ref-hyperlink: false # (default is true) +_quarto: + tests: + html: + ensureHtmlElements: + - [] + - + - "a[href='#tbl-1'].quarto-xref" # ref-hyperlink: false + ensureFileRegexMatches: + - + - "Figure 1— Elephant" + - "See T. 1." + - "See F. 1." +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-jupyter-1.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-jupyter-1.qmd new file mode 100644 index 00000000000..d60d0b9c286 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-jupyter-1.qmd @@ -0,0 +1,26 @@ +--- +title: Python Crossref Test +_quarto: + tests: + html: + ensureFileRegexMatches: + - [] + - [] + ensureHtmlElements: + - + - "div#fig-plot figure.quarto-float-fig figcaption.quarto-float-caption" + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plot +#| fig-cap: "Plot" + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-jupyter-2.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-jupyter-2.qmd new file mode 100644 index 00000000000..7a2398fecfc --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-jupyter-2.qmd @@ -0,0 +1,35 @@ +--- +title: Python Subfig Test +_quarto: + tests: + html: + ensureFileRegexMatches: + - [] + - [] + ensureHtmlElements: + - + - "div#fig-plots figure.quarto-float-fig > figcaption.quarto-float-caption" + - "div#fig-plots-1 figure.quarto-subfloat-fig figcaption.quarto-subfloat-caption" + - "div#fig-plots-2 figure.quarto-subfloat-fig figcaption.quarto-subfloat-caption" + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plots +#| fig-cap: "Plots" +#| fig-subcap: +#| - "Plot 1" +#| - "Plot 2" +#| layout-ncol: 2 + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() + +plt.plot([8,65,23,90]) +plt.show() +``` + +See @fig-plots for examples. In particular, @fig-plots-2. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-knitr-1.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-knitr-1.qmd new file mode 100644 index 00000000000..4ebfcf62c9e --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-knitr-1.qmd @@ -0,0 +1,20 @@ +--- +title: Knitr Crossref Test +_quarto: + tests: + html: + ensureHtmlElements: + - + - "figure.quarto-float-fig figcaption.quarto-float-caption" +--- + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Plot" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-knitr-2.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-knitr-2.qmd new file mode 100644 index 00000000000..3732681914b --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-knitr-2.qmd @@ -0,0 +1,29 @@ +--- +title: Knitr Crossref Test +format: html +_quarto: + tests: + html: + ensureHtmlElements: + - + - "figcaption em" # markdown test + - "figcaption span.math" # math processing test + - "div#fig-plot figure.quarto-float-fig img.figure-img" # image +--- + + +This tests: + +- float figures from knitr +- Markdown support for captions from knitr + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Fancy _caption_ with math: $e=mc^2$" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-knitr-table-captions-1.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-knitr-table-captions-1.qmd new file mode 100644 index 00000000000..adb6b32544c --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-knitr-table-captions-1.qmd @@ -0,0 +1,26 @@ +--- +title: Knitr Table Test +_quarto: + tests: + html: + ensureHtmlElements: + - + - "figure.quarto-float-tbl div#tbl-cars figure.quarto-subfloat-tbl table.table" + - "figure.quarto-float-tbl div#tbl-cars figure.quarto-subfloat-tbl figcaption.quarto-subfloat-caption" + - "figure.quarto-float-tbl div#tbl-pressure figure.quarto-subfloat-tbl table.table" + - "figure.quarto-float-tbl div#tbl-pressure figure.quarto-subfloat-tbl figcaption.quarto-subfloat-caption" + - "div#tbl-tables > figure.quarto-float-tbl > figcaption.quarto-float-caption" + - [] +--- + +```{r} +#| label: tbl-tables +#| tbl-cap: "Tables" +#| layout-ncol: 2 + +library(knitr) +kable(head(cars), caption = "Cars {#tbl-cars}") +kable(head(pressure), caption = "Pressure {#tbl-pressure}") +``` + +See @tbl-cars for more information. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-listings-1.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-listings-1.qmd new file mode 100644 index 00000000000..1750a0b77c5 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-listings-1.qmd @@ -0,0 +1,17 @@ +--- +title: Listings Test +_quarto: + tests: + html: + ensureHtmlElements: + - + - "div#lst-customers figure.quarto-float-lst figcaption.listing" + - "a[href='#lst-customers'].quarto-xref" + - [] +--- + +```{#lst-customers .sql lst-cap="Customers Query"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-lst-and-fig-cell.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-lst-and-fig-cell.qmd new file mode 100644 index 00000000000..1e4729106a2 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-lst-and-fig-cell.qmd @@ -0,0 +1,15 @@ +--- +title: listing within R chunks +format: html +keep-md: true +--- + +```{r} +#| label: fig-code-source +#| lst-label: lst-code-source +#| lst-cap: A listing +#| fig-cap: Some code source +plot(cars) +``` + +See @fig-code-source and @lst-code-source. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-lst-cap-location-1.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-lst-cap-location-1.qmd new file mode 100644 index 00000000000..8e45611d3c0 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-lst-cap-location-1.qmd @@ -0,0 +1,23 @@ +--- +title: lst-cap-location-test +_quarto: + tests: + html: + ensureHtmlElements: + - + - "div#lst-customers figcaption:nth-child(1)" + - "div#lst-customers-2 figcaption:nth-child(2)" +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). + + +```{#lst-customers-2 .sql lst-cap="Customers _query_" lst-cap-location="bottom"} +SELECT * FROM Customers +``` + +Then we query the customers database again (@lst-customers-2), with a caption in a different location. diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-ojs-lst-cap.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-ojs-lst-cap.qmd new file mode 100644 index 00000000000..3f0f6f9cc7d --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-ojs-lst-cap.qmd @@ -0,0 +1,20 @@ +--- +title: listing within R chunks +format: html +keep-md: true +# FIXME cscheid needs to fix this on compile.ts +# _quarto: +# tests: +# html: +# ensureHtmlElements: +# - ['a.quarto-xref[href="#lst-code-source"]', 'div#lst-code-source.listing'] +# - [] +--- + +```{ojs} +//| lst-label: lst-code-source +//| lst-cap: Some code source +1 + 1 +``` + +See @lst-code-source. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/html-subfloat-1.qmd b/tests/docs/smoke-all/crossrefs/float/html/html-subfloat-1.qmd new file mode 100644 index 00000000000..163bd019a0f --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/html-subfloat-1.qmd @@ -0,0 +1,29 @@ +--- +title: Crossref Test +_quarto: + tests: + html: + ensureFileRegexMatches: + - + - "\\(a\\) Surus" + - "\\(b\\) Abbas" + ensureHtmlElements: + - + - "div#fig-elephants figure.quarto-float-fig > figcaption.quarto-float-caption" + - "div#fig-surus figure.quarto-subfloat-fig figcaption.quarto-subfloat-caption" + - "div#fig-abbas figure.quarto-subfloat-fig figcaption.quarto-subfloat-caption" + - [] +--- + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol=2} + +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas and @fig-surus. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/html/rawtablecaption.qmd b/tests/docs/smoke-all/crossrefs/float/html/rawtablecaption.qmd new file mode 100644 index 00000000000..d33efcdf5a3 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/html/rawtablecaption.qmd @@ -0,0 +1,29 @@ +--- +title: table caption test +_quarto: + tests: + html: + ensureFileRegexMatches: + - + - "Table\\ \\;1: This is a caption." + - [] +--- + +::: {#tbl-1} + +```{=html} + + + + + + + + + +
This is a caption.
col 1col 2
12
34
+``` + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/img/surus.jpg b/tests/docs/smoke-all/crossrefs/float/img/surus.jpg new file mode 100644 index 00000000000..9911bdbe3ad Binary files /dev/null and b/tests/docs/smoke-all/crossrefs/float/img/surus.jpg differ diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-float-1.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-1.qmd new file mode 100644 index 00000000000..8e9fdc9fc3d --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-1.qmd @@ -0,0 +1,44 @@ +--- +title: float crossref test +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig[@id=\"fig-1\"]//caption" + - "//fig[@id=\"tbl-1\"]//caption" + - "//xref[@rid=\"fig-1\"]" + - "//xref[@rid=\"tbl-1\"]" + - [] +--- + +This tests: + +- custom content in floats +- classes of float captions + +::: {#fig-1} + +::: {.figure-content} +This is the figure content. +::: + +This is a caption. + +::: + +See @fig-1. + + +::: {#tbl-1} + +::: {.table-content} +This is the table content. +::: + +This is a table. + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-float-2.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-2.qmd new file mode 100644 index 00000000000..8d3042e06cb --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-2.qmd @@ -0,0 +1,39 @@ +--- +title: float crossref test +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig[@id=\"fig-foo\"]//caption" + - "//fig[@id=\"fig-foo\"]//graphic[@xlink:href=\"img/surus.jpg\"]" + - "//fig[@id=\"tbl-foo\"]//caption" + - "//fig[@id=\"tbl-foo\"]//graphic[@xlink:href=\"img/surus.jpg\"]" + - "//xref[@rid=\"fig-foo\"]" + - "//xref[@rid=\"tbl-foo\"]" + - [] + +--- + +This tests: + +- div float with image element as payload. +- div float with image element as payload for non-figure floats. + + +::: {#fig-foo} +![](img/surus.jpg) + +This is the figure +::: +See @fig-foo for more. + + +::: {#tbl-foo} +![](img/surus.jpg) + +This is the table +::: +See @tbl-foo for more. + diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-float-3.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-3.qmd new file mode 100644 index 00000000000..a38a1f9310e --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-3.qmd @@ -0,0 +1,27 @@ +--- +title: float crossref test +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig[@id=\"fig-foo\"]//caption" + - "//fig[@id=\"fig-foo\"]//graphic[@xlink:href=\"img/surus.jpg\"]" + - "//fig[@id=\"tbl-foo\"]//caption" + - "//fig[@id=\"tbl-foo\"]//graphic[@xlink:href=\"img/surus.jpg\"]" + - "//xref[@rid=\"fig-foo\"]" + - "//xref[@rid=\"tbl-foo\"]" + - [] + +--- + +This tests: + +- float syntax for implicit figures and tables as images with identifiers + +![This is a figure](img/surus.jpg){#fig-foo} + +![This is a table](img/surus.jpg){#tbl-foo} + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-float-4.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-4.qmd new file mode 100644 index 00000000000..2235cf510f2 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-4.qmd @@ -0,0 +1,26 @@ +--- +title: float test +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig[@id=\"fig-foo\"]//caption" + - "//fig[@id=\"fig-foo\"]//ext-link//inline-graphic[@xlink:href=\"img/surus.jpg\"]" + - "//fig[@id=\"tbl-foo\"]//caption" + - "//fig[@id=\"tbl-foo\"]//ext-link//inline-graphic[@xlink:href=\"img/surus.jpg\"]" + - "//xref[@rid=\"fig-foo\"]" + - "//xref[@rid=\"tbl-foo\"]" + - [] +--- + +This tests: + +- float syntax for implicit figures and tables as linked images with identifiers + +[![This is the figure](img/surus.jpg){#fig-foo}](https://www.example.com/) + +[![This is the table](img/surus.jpg){#tbl-foo}](https://www.example.com/) + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-float-5.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-5.qmd new file mode 100644 index 00000000000..ba3a63f485c --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-5.qmd @@ -0,0 +1,19 @@ +--- +title: Crossref Test +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig[@id=\"fig-elephant\"]//caption" + - "//fig[@id=\"fig-elephant\"]//graphic[@xlink:href=\"img/thinker.jpg\"]" + - + - "//xref[@rid=\"fig-elephant1\"]" +--- + +## Unresolved Crossref Figure + +![Elephant](img/thinker.jpg){#fig-elephant} + +See @fig-elephant1 for examples. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-float-6.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-6.qmd new file mode 100644 index 00000000000..875061339b8 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-6.qmd @@ -0,0 +1,18 @@ +--- +title: test simple figure crossref +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig[@id=\"fig-simple\"]//caption" + - "//fig[@id=\"fig-simple\"]//graphic[@xlink:href=\"img/surus.jpg\"]" + - "//xref[@rid=\"fig-simple\"]" + - [] +--- + +![A simple figure](img/surus.jpg){#fig-simple} + +See @fig-simple. + diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-float-caption-formatting-1.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-caption-formatting-1.qmd new file mode 100644 index 00000000000..66d3e39c503 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-caption-formatting-1.qmd @@ -0,0 +1,17 @@ +--- +title: caption-formatting-test +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig//caption//p//italic" + - [] +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-float-numbering-1.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-numbering-1.qmd new file mode 100644 index 00000000000..e17b3d93d64 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-numbering-1.qmd @@ -0,0 +1,53 @@ +--- +title: "My Document" +crossref: + fig-labels: alpha x # (default is arabic) + tbl-labels: alpha A # (default is arabic) + subref-labels: roman i # (default is alpha a) +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - '//fig[@id="fig-elephant"]//caption' + - '//fig[@id="tbl-letters"]//caption' + - '//fig[@id="fig-elephants"]//caption' + - '//fig[@id="fig-surus"]//caption' + - '//fig[@id="fig-abbas"]//caption' + ensureFileRegexMatches: + - + - "Figure x: Elephant" + - "Table A: My Caption" + - "Figure y: Famous Elephants" + - "\\(i\\) Surus" + - "\\(ii\\) Abbas" +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + +| Col1 | Col2 | Col3 | +| ---- | ---- | ---- | +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol="2"} +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-float-options-1.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-options-1.qmd new file mode 100644 index 00000000000..40fbb2c65ac --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-float-options-1.qmd @@ -0,0 +1,40 @@ +--- +title: "My Document" +format: jats +crossref: + fig-prefix: F. # (default is "fig.") + tbl-prefix: T. # (default is "tbl.") + title-delim: "—" # (default is ":") + + ref-hyperlink: false # (default is true) +_quarto: + tests: + jats: + ensureJatsXPath: + - [] + - + - "//xref[@rid=\"tbl-letters\"]" + ensureFileRegexMatches: + - + # NB: JATS uses the unicode non-breaking space instead of the html entity + - "Figure 1— Elephant" + - "See T. 1." + - "See F. 1" +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-jupyter-1.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-jupyter-1.qmd new file mode 100644 index 00000000000..ac663504d05 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-jupyter-1.qmd @@ -0,0 +1,26 @@ +--- +title: Python Crossref Test +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig[@id=\"fig-plot\"]//caption" + - "//fig[@id=\"fig-plot\"]//graphic" + - "//xref[@rid=\"fig-plot\"]" + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plot +#| fig-cap: "Plot" + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-jupyter-2.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-jupyter-2.qmd new file mode 100644 index 00000000000..e9377f27bed --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-jupyter-2.qmd @@ -0,0 +1,35 @@ +--- +title: Python Subfig Test +format: jats +# FIXME: we're now emitting "boxed-text", need to figure out what that's about. +_quarto: + tests: + jats: + ensureJatsXpath: + - + - //code[@language="python"] # tests if subfloat preamble was included + - '//fig[@id="fig-plots"]//caption' + - '//fig//fig[@id="fig-plots-1"]//caption' + - '//fig//fig[@id="fig-plots-2"]//caption' + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plots +#| fig-cap: "Plots" +#| fig-subcap: +#| - "Plot 1" +#| - "Plot 2" +#| layout-ncol: 2 + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() + +plt.plot([8,65,23,90]) +plt.show() +``` + +See @fig-plots for examples. In particular, @fig-plots-2. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-knitr-1.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-knitr-1.qmd new file mode 100644 index 00000000000..ec0deec3c8f --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-knitr-1.qmd @@ -0,0 +1,24 @@ +--- +title: Knitr Crossref Test +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig[@id=\"fig-plot\"]//caption" + - "//fig[@id=\"fig-plot\"]//graphic" + - "//xref[@rid=\"fig-plot\"]" + - [] +--- + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Plot" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-knitr-2.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-knitr-2.qmd new file mode 100644 index 00000000000..6ba1010e99e --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-knitr-2.qmd @@ -0,0 +1,31 @@ +--- +title: Knitr Crossref Test +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig[@id=\"fig-plot\"]//caption//italic" # markdown test + - "//fig[@id=\"fig-plot\"]//caption//inline-formula//tex-math" # math processing test + - "//fig[@id=\"fig-plot\"]//caption//inline-formula//mml:math" # math processing test + - "//fig[@id=\"fig-plot\"]//graphic" + - "//xref[@rid=\"fig-plot\"]" +--- + + +This tests: + +- float figures from knitr +- Markdown support for captions from knitr + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Fancy *caption* with math: $e=mc^2$" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-knitr-table-captions-1.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-knitr-table-captions-1.qmd new file mode 100644 index 00000000000..4781ca45020 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-knitr-table-captions-1.qmd @@ -0,0 +1,27 @@ +--- +title: Knitr Table Test +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - '//fig//fig[@id="tbl-cars"]//table' + - '//fig//fig[@id="tbl-cars"]//caption' + - '//fig//fig[@id="tbl-pressure"]//table' + - '//fig//fig[@id="tbl-pressure"]//caption' + - '//fig[@id="tbl-tables"]/caption' + - [] +--- + +```{r} +#| label: tbl-tables +#| tbl-cap: "Tables" +#| layout-ncol: 2 + +library(knitr) +kable(head(cars), caption = "Cars {#tbl-cars}") +kable(head(pressure), caption = "Pressure {#tbl-pressure}") +``` + +See @tbl-cars for more information. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-listings-1.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-listings-1.qmd new file mode 100644 index 00000000000..4841585e515 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-listings-1.qmd @@ -0,0 +1,20 @@ +--- +title: Listings Test +format: jats +# FIXME: We've changed the output from to ... +# Why is that? +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig[@id=\"lst-customers\"]//caption" + - "//xref[@rid=\"lst-customers\"]" + - [] +--- + +```{#lst-customers .sql lst-cap="Customers Query"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-lst-cap-location-1.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-lst-cap-location-1.qmd new file mode 100644 index 00000000000..783699112af --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-lst-cap-location-1.qmd @@ -0,0 +1,26 @@ +--- +title: lst-cap-location-test +format: jats +# nothing to configure about caption location in jats, so nothing to test? +# +# _quarto: +# tests: +# html: +# ensureHtmlElements: +# - +# - "div#lst-customers figcaption:nth-child(1)" +# - "div#lst-customers-2 figcaption:nth-child(2)" +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). + + +```{#lst-customers-2 .sql lst-cap="Customers _query_" lst-cap-location="bottom"} +SELECT * FROM Customers +``` + +Then we query the customers database again (@lst-customers-2), with a caption in a different location. diff --git a/tests/docs/smoke-all/crossrefs/float/jats/jats-subfloat-1.qmd b/tests/docs/smoke-all/crossrefs/float/jats/jats-subfloat-1.qmd new file mode 100644 index 00000000000..32c406401cc --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/jats-subfloat-1.qmd @@ -0,0 +1,30 @@ +--- +title: Crossref Test +format: jats +_quarto: + tests: + jats: + ensureFileRegexMatches: + - + - "\\(a\\) Surus" + - "\\(b\\) Abbas" + ensureJatsXpath: + - + - '//fig[@id="fig-elephants"]/caption' + - '//fig//fig[@id="fig-surus"]/caption' + - '//fig//fig[@id="fig-abbas"]/caption' + - [] +--- + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol=2} + +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas and @fig-surus. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/jats/rawtablecaption.qmd b/tests/docs/smoke-all/crossrefs/float/jats/rawtablecaption.qmd new file mode 100644 index 00000000000..303367332d7 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/jats/rawtablecaption.qmd @@ -0,0 +1,34 @@ +--- +title: table caption test +format: jats +_quarto: + tests: + jats: + ensureJatsXpath: + - + - "//fig[@id=\"tbl-1\"]//caption" + - "//xref[@rid=\"tbl-1\"]" + ensureFileRegexMatches: + - + - "Table 1: This is a caption." + - [] +--- + +::: {#tbl-1} + +```{=html} + + + + + + + + + +
This is a caption.
col 1col 2
12
34
+``` + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-custom-categories.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-custom-categories.qmd new file mode 100644 index 00000000000..74c9472af0b --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-custom-categories.qmd @@ -0,0 +1,20 @@ +--- +title: Proposed syntax for custom crossrefs +format: pdf +# keep-tex: true +crossref-custom: # probably should be a key inside `crossref` + - kind: float + prefix: Diagram + name: Diagram + ref_type: dia + latex_env: diagram + latex_list_of_name: lod +--- + +::: {#dia-1} +![](../img/surus.jpg) + +A diagram +::: + +See @dia-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-float-1.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-1.qmd new file mode 100644 index 00000000000..d5d8c902792 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-1.qmd @@ -0,0 +1,46 @@ +--- +title: float crossref test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - + - "\\\\ref\\{fig-1\\}" + - "\\\\caption\\{\\\\label\\{fig-1\\}This is a caption.\\}" + - "\\\\ref\\{tbl-1\\}" + - "\\\\caption\\{\\\\label\\{tbl-1\\}This is a table.\\}" + - "\\\\begin\\{figure\\}" + - "\\\\begin\\{table\\}" + - [] +--- + +This tests: + +- custom content in floats +- classes of float captions + +::: {#fig-1} + +::: {.figure-content} +This is the figure content. +::: + +This is a caption. + +::: + +See @fig-1. + + +::: {#tbl-1} + +::: {.table-content} +This is the table content. +::: + +This is a table. + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-float-2.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-2.qmd new file mode 100644 index 00000000000..aae66794d53 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-2.qmd @@ -0,0 +1,36 @@ +--- +title: float crossref test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - + - "\\\\ref\\{fig-foo\\}" + - "\\\\ref\\{tbl-foo\\}" + - "\\\\label\\{fig-foo\\}" + - "\\\\label\\{tbl-foo\\}" + - [] +--- + +This tests: + +- div float with image element as payload. +- div float with image element as payload for non-figure floats. + + +::: {#fig-foo} +![](img/surus.jpg) + +This is the figure +::: +See @fig-foo for more. + + +::: {#tbl-foo} +![](img/surus.jpg) + +This is the table +::: +See @tbl-foo for more. + diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-float-3.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-3.qmd new file mode 100644 index 00000000000..2ef8943ce52 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-3.qmd @@ -0,0 +1,24 @@ +--- +title: float crossref test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - + - "\\\\ref\\{fig-foo\\}" + - "\\\\ref\\{tbl-foo\\}" + - "\\\\label\\{fig-foo\\}" + - "\\\\label\\{tbl-foo\\}" + - [] +--- + +This tests: + +- float syntax for implicit figures and tables as images with identifiers + +![This is a figure](img/surus.jpg){#fig-foo} + +![This is a table](img/surus.jpg){#tbl-foo} + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-float-4.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-4.qmd new file mode 100644 index 00000000000..e04c9f2e7c7 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-4.qmd @@ -0,0 +1,24 @@ +--- +title: float test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - + - "\\\\ref\\{fig-foo\\}" + - "\\\\ref\\{tbl-foo\\}" + - "\\\\label\\{fig-foo\\}" + - "\\\\label\\{tbl-foo\\}" + - [] +--- + +This tests: + +- float syntax for implicit figures and tables as linked images with identifiers + +[![This is the figure](img/surus.jpg){#fig-foo}](https://www.example.com/) + +[![This is the table](img/surus.jpg){#tbl-foo}](https://www.example.com/) + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-float-5.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-5.qmd new file mode 100644 index 00000000000..d04c71eaa2c --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-5.qmd @@ -0,0 +1,18 @@ +--- +title: Crossref Test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - [] + - + - "\\\\ref\\{fig-elephant1\\}" + - "\\\\label\\{tbl-elephant1\\}" +--- + +## Unresolved Crossref Figure + +![Elephant](img/thinker.jpg){#fig-elephant} + +See @fig-elephant1 for examples. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-float-numbering-1.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-numbering-1.qmd new file mode 100644 index 00000000000..6ae37ff3893 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-numbering-1.qmd @@ -0,0 +1,42 @@ +--- +title: "My Document" +crossref: + fig-labels: alpha x # (default is arabic) + tbl-labels: alpha A # (default is arabic) + subref-labels: roman i # (default is alpha a) +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - [] + - [] +--- + +# Introduction + +![Elephant](../img/surus.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + +| Col1 | Col2 | Col3 | +| ---- | ---- | ---- | +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol="2"} +![Surus](../img/surus.jpg){#fig-surus} + +![Abbas](../img/surus.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-float-options-1.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-options-1.qmd new file mode 100644 index 00000000000..8a0970ec2bc --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-float-options-1.qmd @@ -0,0 +1,32 @@ +--- +title: "My Document" +crossref: + fig-prefix: F. # (default is "fig.") + tbl-prefix: T. # (default is "tbl.") + title-delim: — # (default is ":") + ref-hyperlink: false # (default is true) +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - [] + - [] +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-jupyter-1.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-jupyter-1.qmd new file mode 100644 index 00000000000..2f03389f487 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-jupyter-1.qmd @@ -0,0 +1,23 @@ +--- +title: Python Crossref Test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - [] + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plot +#| fig-cap: "Plot" + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-jupyter-2.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-jupyter-2.qmd new file mode 100644 index 00000000000..3b17ed91cd4 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-jupyter-2.qmd @@ -0,0 +1,29 @@ +--- +title: Python Subfig Test +_quarto: + tests: + latex: + ensureFileRegexMatches: + - [] + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plots +#| fig-cap: "Plots" +#| fig-subcap: +#| - "Plot 1" +#| - "Plot 2" +#| layout-ncol: 2 + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() + +plt.plot([8,65,23,90]) +plt.show() +``` + +See @fig-plots for examples. In particular, @fig-plots-2. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-knitr-1.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-knitr-1.qmd new file mode 100644 index 00000000000..9360f616d05 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-knitr-1.qmd @@ -0,0 +1,21 @@ +--- +title: Knitr Crossref Test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - [] + - [] +--- + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Plot" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-knitr-2.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-knitr-2.qmd new file mode 100644 index 00000000000..bae0357b519 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-knitr-2.qmd @@ -0,0 +1,27 @@ +--- +title: Knitr Crossref Test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - [] + - [] +--- + + +This tests: + +- float figures from knitr +- Markdown support for captions from knitr + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Fancy _caption_ with math: $e=mc^2$" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-knitr-table-captions-1.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-knitr-table-captions-1.qmd new file mode 100644 index 00000000000..b3697374128 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-knitr-table-captions-1.qmd @@ -0,0 +1,22 @@ +--- +title: Knitr Table Test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - [] + - [] +--- + +```{r} +#| label: tbl-tables +#| tbl-cap: "Tables" +#| layout-ncol: 2 + +library(knitr) +kable(head(cars), caption = "Cars {#tbl-cars}") +kable(head(pressure), caption = "Pressure {#tbl-pressure}") +``` + +See @tbl-cars for more information. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-listings-1.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-listings-1.qmd new file mode 100644 index 00000000000..9c3a9dce9c0 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-listings-1.qmd @@ -0,0 +1,16 @@ +--- +title: Listings Test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - [] + - [] +--- + +```{#lst-customers .sql lst-cap="Customers Query"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-longtable-fixup-test.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-longtable-fixup-test.qmd new file mode 100644 index 00000000000..62802b72aab --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-longtable-fixup-test.qmd @@ -0,0 +1,59 @@ +--- +format: latex +title: "Long Table kable fixups etc" +_quarto: + tests: + latex: + ensureFileRegexMatches: + - + - "\\label{tbl-test}" + - "\\label{tbl-test-two-tables}" + - "\\label{tbl-test-two-tables-1}" + - "\\label{tbl-test-two-tables-2}" + - [] +--- + +```{r} +#| warning: false +#| output: false +#| echo: false +library(knitr) +library(tidyverse) +``` + +```{r} +#| echo: false +#| label: tbl-test +df <- tibble( + x = 1:20, + y = rnorm(20), + z = rnorm(20) +) +kable(df, + format = "latex", + longtable = TRUE, + booktabs = TRUE, + caption = "A long table with a caption") +``` + +See @tbl-test. + +```{r} +#| echo: false +#| label: tbl-test-two-tables +#| tbl-cap: Overall caption + +kable(df, + format = "latex", + longtable = TRUE, + booktabs = TRUE, + caption = "Table one") + +kable(df, + format = "latex", + longtable = TRUE, + booktabs = TRUE, + caption = "Table two because screw you, that's why") +``` + +See @tbl-test-two-tables, @tbl-test-two-tables-1, and @tbl-test-two-tables-2. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-lst-cap-location-1.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-lst-cap-location-1.qmd new file mode 100644 index 00000000000..2c7e3fc1bfa --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-lst-cap-location-1.qmd @@ -0,0 +1,23 @@ +--- +title: lst-cap-location-test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - [] + - [] +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). + + +```{#lst-customers-2 .sql lst-cap="Customers _query_" lst-cap-location="bottom"} +SELECT * FROM Customers +``` + +Then we query the customers database again (@lst-customers-2), with a caption in a different location. diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-margin-figure.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-margin-figure.qmd new file mode 100644 index 00000000000..4208707f9ca --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-margin-figure.qmd @@ -0,0 +1,29 @@ +--- +title: "matplotlib demo" +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - ["marginfigure"] + - [] +--- + +Demo + +```{python} +#| echo: false +#| column: margin + +import matplotlib.pyplot as plt + +plot = plt.figure() +plot.set_figwidth(2) +plot.set_figheight(3) + +x = [1, 2] +y = [2, 3] + +plt.plot(x,y) + +``` diff --git a/tests/docs/smoke-all/crossrefs/float/latex/latex-subfloat-1.qmd b/tests/docs/smoke-all/crossrefs/float/latex/latex-subfloat-1.qmd new file mode 100644 index 00000000000..ba74c761ae8 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/latex/latex-subfloat-1.qmd @@ -0,0 +1,23 @@ +--- +title: Crossref Test +format: latex +_quarto: + tests: + latex: + ensureFileRegexMatches: + - [] + - [] +--- + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol=2} + +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas and @fig-surus. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/lst-cap-in-jupyter-cells.qmd b/tests/docs/smoke-all/crossrefs/float/lst-cap-in-jupyter-cells.qmd new file mode 100644 index 00000000000..074f55efe7d --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/lst-cap-in-jupyter-cells.qmd @@ -0,0 +1,27 @@ +--- +title: listing within Jupyter cells +format: html +keep-md: true +_quarto: + tests: + html: + ensureHtmlElements: + - ['a.quarto-xref[href="#lst-code-source"]', 'div#lst-code-source.listing'] + - [] + latex: + ensureFileRegexMatches: + - ['Listing~\\ref\{lst-code-source\}', '\\caption\{\\label\{lst-code-source\}Some code source\}'] + - [] + docx: + ensureDocxRegexMatches: + - ['bookmarkStart.*name="lst-code-source"', 'hyperlink.*anchor="lst-code-source"'] + - [] +--- + +```{python} +#| lst-label: lst-code-source +#| lst-cap: Some code source +1 + 1 +``` + +See @lst-code-source. diff --git a/tests/docs/smoke-all/crossrefs/float/lst-cap-in-r-cells.qmd b/tests/docs/smoke-all/crossrefs/float/lst-cap-in-r-cells.qmd new file mode 100644 index 00000000000..fd76367405a --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/lst-cap-in-r-cells.qmd @@ -0,0 +1,27 @@ +--- +title: listing within R cells +format: html +keep-md: true +_quarto: + tests: + html: + ensureHtmlElements: + - ['a.quarto-xref[href="#lst-code-source"]', 'div#lst-code-source.listing'] + - [] + latex: + ensureFileRegexMatches: + - ['Listing~\\ref\{lst-code-source\}', '\\caption\{\\label\{lst-code-source\}Some code source\}'] + - [] + docx: + ensureDocxRegexMatches: + - ['bookmarkStart.*name="lst-code-source"', 'hyperlink.*anchor="lst-code-source"'] + - [] +--- + +```{r} +#| lst-label: lst-code-source +#| lst-cap: Some code source +1 + 1 +``` + +See @lst-code-source. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/multirow-layout.qmd b/tests/docs/smoke-all/crossrefs/float/multirow-layout.qmd new file mode 100644 index 00000000000..8cfd1455c0e --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/multirow-layout.qmd @@ -0,0 +1,84 @@ +--- +title: new-crossref-layout-test +--- + +Let's try lots of weird stuff here. + +::: {#fig-1 layout-nrow=2} +![Surus](surus.png){#fig-1-1} + +![Hanno](hanno.png) + +![Abdul Abbas](abdul-abbas.png){#fig-1-3} + +![Lin Wang](lin-wang.png){#fig-1-4} + +Many many subfloats. +::: + +See @fig-1. + +::: {layout-nrow=2} +![Surus](surus.png){#fig-2-1} + +![Hanno](hanno.png){#fig-2-2} + +![Abdul Abbas](abdul-abbas.png){#fig-2-3} + +![Lin Wang](lin-wang.png){#fig-2-4} + +Many many subfloats. +::: + +See @fig-2-1 and @fig-1-4. + + +::: {layout-nrow=2} +![Surus](surus.png) + +![Hanno](hanno.png) + +![Abdul Abbas](abdul-abbas.png) + +![Lin Wang](lin-wang.png) +::: + + +::: {#fig-3 layout-nrow=2} +![Surus](surus.png){#fig-3-1} + +![Hanno](hanno.png){#fig-3-3} + +![Abdul Abbas](abdul-abbas.png){#fig-3-3} + +![Lin Wang](lin-wang.png){#fig-3-4} + +Many many subfloats. +::: + + +See @fig-3 and @fig-3-3. + +::: {#fig-4 layout-nrow=2} +![Surus](surus.png) + +![Hanno](hanno.png) + +![Abdul Abbas](abdul-abbas.png) + +![Lin Wang](lin-wang.png) + +Many many subfloats. +::: + + +See @fig-4. + +::: {layout="[[1,1], [1]]"} +![Surus](surus.png) + +![Hanno](hanno.png) + +![Lin Wang](lin-wang.png) +::: + diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/rawtablecaption.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/rawtablecaption.qmd new file mode 100644 index 00000000000..0abe51fae8f --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/rawtablecaption.qmd @@ -0,0 +1,30 @@ +--- +title: table caption test +format: revealjs +_quarto: + tests: + revealjs: + ensureFileRegexMatches: + - + - "Table\\ \\;1: This is a caption." + - [] +--- + +::: {#tbl-1} + +```{=html} + + + + + + + + + +
This is a caption.
col 1col 2
12
34
+``` + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-1.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-1.qmd new file mode 100644 index 00000000000..7829adb5c1e --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-1.qmd @@ -0,0 +1,46 @@ +--- +title: float crossref test +format: revealjs +_quarto: + tests: + revealjs: + ensureHtmlElements: + - + - "div.figure-content" + - "div.table-content" + - "figcaption.figure" + - "figcaption.table" + - "a[href='#/fig-1'].quarto-xref" + - "a[href='#/tbl-1'].quarto-xref" + - [] +--- + +This tests: + +- custom content in floats +- classes of float captions + +::: {#fig-1} + +::: {.figure-content} +This is the figure content. +::: + +This is a caption. + +::: + +See @fig-1. + + +::: {#tbl-1} + +::: {.table-content} +This is the table content. +::: + +This is a table. + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-2.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-2.qmd new file mode 100644 index 00000000000..7c585199bbf --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-2.qmd @@ -0,0 +1,35 @@ +--- +title: float crossref test +format: html +_quarto: + tests: + revealjs: + ensureHtmlElements: + - + - "div#tbl-foo figure.quarto-float-tbl img" + - "div#fig-foo figure.quarto-float-fig img" + - "a[href='#/fig-foo'].quarto-xref" + - "a[href='#/tbl-foo'].quarto-xref" +--- + +This tests: + +- div float with image element as payload. +- div float with image element as payload for non-figure floats. + + +::: {#fig-foo} +![](img/surus.jpg) + +This is the figure +::: +See @fig-foo for more. + + +::: {#tbl-foo} +![](img/surus.jpg) + +This is the table +::: +See @tbl-foo for more. + diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-3.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-3.qmd new file mode 100644 index 00000000000..6d278f193f0 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-3.qmd @@ -0,0 +1,23 @@ +--- +title: float crossref test +format: revealjs +_quarto: + tests: + revealjs: + ensureHtmlElements: + - + - "div#tbl-foo figure.quarto-float-tbl img" + - "div#fig-foo figure.quarto-float-fig img" + - "a[href='#/fig-foo'].quarto-xref" + - "a[href='#/tbl-foo'].quarto-xref" +--- + +This tests: + +- float syntax for implicit figures and tables as images with identifiers + +![This is a figure](img/surus.jpg){#fig-foo} + +![This is a table](img/surus.jpg){#tbl-foo} + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-4.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-4.qmd new file mode 100644 index 00000000000..61579c3a3a7 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-4.qmd @@ -0,0 +1,23 @@ +--- +title: float test +format: html +_quarto: + tests: + revealjs: + ensureHtmlElements: + - + - "div#tbl-foo figure.quarto-float-tbl a img" + - "div#fig-foo figure.quarto-float-fig a img" + - "a[href='#/fig-foo'].quarto-xref" + - "a[href='#/tbl-foo'].quarto-xref" +--- + +This tests: + +- float syntax for implicit figures and tables as linked images with identifiers + +[![This is the figure](img/surus.jpg){#fig-foo}](https://www.example.com/) + +[![This is the table](img/surus.jpg){#tbl-foo}](https://www.example.com/) + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-5.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-5.qmd new file mode 100644 index 00000000000..ee23b261739 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-5.qmd @@ -0,0 +1,19 @@ +--- +title: Crossref Test +format: html +_quarto: + tests: + revealjs: + ensureHtmlElements: + - [] +# - "img[src='img/thinker.jpg']" # This appears to not work in deno-dom?! + - + - "a[href='#/fig-elephant1'].quarto-xref" + - "div#fig-elephant figure.quarto-float-fig figcaption.figure" # because of autostretch, we lose figure elements +--- + +## Unresolved Crossref Figure + +![Elephant](img/thinker.jpg){#fig-elephant} + +See @fig-elephant1 for examples. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-caption-formatting-1.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-caption-formatting-1.qmd new file mode 100644 index 00000000000..99888f08804 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-caption-formatting-1.qmd @@ -0,0 +1,15 @@ +--- +title: caption-formatting-test +_quarto: + tests: + revealjs: + ensureHtmlElements: + - + - "div#lst-customers figcaption em" +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-numbering-1.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-numbering-1.qmd new file mode 100644 index 00000000000..bed8bcaf0d5 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-numbering-1.qmd @@ -0,0 +1,45 @@ +--- +title: "My Document" +crossref: + fig-labels: alpha x # (default is arabic) + tbl-labels: alpha A # (default is arabic) + subref-labels: roman i # (default is alpha a) +_quarto: + tests: + revealjs: + ensureFileRegexMatches: + - + - "Figure x: Elephant" + - "Table A: My Caption" + - "Figure y: Famous Elephants" + - "\\(i\\) Surus" + - "\\(ii\\) Abbas" +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + +| Col1 | Col2 | Col3 | +| ---- | ---- | ---- | +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol="2"} +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-options-1.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-options-1.qmd new file mode 100644 index 00000000000..81a34e397ce --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-float-options-1.qmd @@ -0,0 +1,37 @@ +--- +title: "My Document" +crossref: + fig-prefix: F. # (default is "fig.") + tbl-prefix: T. # (default is "tbl.") + title-delim: — # (default is ":") + ref-hyperlink: false # (default is true) +_quarto: + tests: + revealjs: + ensureHtmlElements: + - [] + - + - "a[href='#/tbl-1'].quarto-xref" # ref-hyperlink: false + ensureFileRegexMatches: + - + - "Figure 1— Elephant" + - "See T. 1." + - "See F. 1." +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-jupyter-1.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-jupyter-1.qmd new file mode 100644 index 00000000000..4fdd93e3ab2 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-jupyter-1.qmd @@ -0,0 +1,26 @@ +--- +title: Python Crossref Test +_quarto: + tests: + revealjs: + ensureFileRegexMatches: + - [] + - [] + ensureHtmlElements: + - + - "div#fig-plot figure.quarto-float-fig figcaption.quarto-float-caption" + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plot +#| fig-cap: "Plot" + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-jupyter-2.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-jupyter-2.qmd new file mode 100644 index 00000000000..a04ca0dd363 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-jupyter-2.qmd @@ -0,0 +1,37 @@ +--- +title: Python Subfig Test +format: revealjs +# _quarto: +# tests: +# revealjs: +# ensureFileRegexMatches: +# - [] +# - [] +# ensureHtmlElements: +# - +# - "div#fig-plots figure.quarto-float-fig > figcaption.quarto-float-caption" +# - "div#fig-plots-1 figure.quarto-subfloat-fig figcaption.quarto-subfloat-caption" +# - "div#fig-plots-2 figure.quarto-subfloat-fig figcaption.quarto-subfloat-caption" +# - [] +# nothing to check here because autostretch butchers the DOM +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plots +#| fig-cap: "Plots" +#| fig-subcap: +#| - "Plot 1" +#| - "Plot 2" +#| layout-ncol: 2 + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() + +plt.plot([8,65,23,90]) +plt.show() +``` + +See @fig-plots for examples. In particular, @fig-plots-2. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-1.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-1.qmd new file mode 100644 index 00000000000..4401f15c1eb --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-1.qmd @@ -0,0 +1,21 @@ +--- +title: Knitr Crossref Test +# _quarto: +# tests: +# revealjs: +# ensureHtmlElements: +# - +# - "figure.quarto-float-fig figcaption.quarto-float-caption" +# nothing to check here because autostretch butchers the DOM +--- + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Plot" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-2.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-2.qmd new file mode 100644 index 00000000000..665d435a4db --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-2.qmd @@ -0,0 +1,30 @@ +--- +title: Knitr Crossref Test +format: revealjs +_quarto: + tests: + revealjs: + ensureHtmlElements: + - # note these are missing the figure element because this is in autostretch and we need to butcher the DOM for it + - "em" # markdown test + - "span.math" # math processing test + - "img" # image + +--- + + +This tests: + +- float figures from knitr +- Markdown support for captions from knitr + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Fancy _caption_ with math: $e=mc^2$" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-table-captions-1.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-table-captions-1.qmd new file mode 100644 index 00000000000..696aa80a43d --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-table-captions-1.qmd @@ -0,0 +1,27 @@ +--- +title: Knitr Table Test +# _quarto: +# tests: +# revealjs: +# ensureHtmlElements: +# - +# - "figure.quarto-float-tbl div#tbl-cars figure.quarto-float-tbl table.table" +# - "figure.quarto-float-tbl div#tbl-cars figure.quarto-float-tbl figcaption.quarto-subfloat-caption" +# - "figure.quarto-float-tbl div#tbl-pressure figure.quarto-float-tbl table.table" +# - "figure.quarto-float-tbl div#tbl-pressure figure.quarto-float-tbl figcaption.quarto-subfloat-caption" +# - "div#tbl-tables > figure.quarto-float-tbl > figcaption.quarto-float-caption" +# - [] +# nothing to check here because autostretch fixups require butchering the DOM +--- + +```{r} +#| label: tbl-tables +#| tbl-cap: "Tables" +#| layout-ncol: 2 + +library(knitr) +kable(head(cars), caption = "Cars {#tbl-cars}") +kable(head(pressure), caption = "Pressure {#tbl-pressure}") +``` + +See @tbl-cars for more information. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-listings-1.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-listings-1.qmd new file mode 100644 index 00000000000..8737e697dbc --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-listings-1.qmd @@ -0,0 +1,17 @@ +--- +title: Listings Test +_quarto: + tests: + revealjs: + ensureHtmlElements: + - + - "div#lst-customers figure.quarto-float-lst figcaption.listing" + - "a[href='#/lst-customers'].quarto-xref" + - [] +--- + +```{#lst-customers .sql lst-cap="Customers Query"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-lst-cap-location-1.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-lst-cap-location-1.qmd new file mode 100644 index 00000000000..89dd92a7b64 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-lst-cap-location-1.qmd @@ -0,0 +1,23 @@ +--- +title: lst-cap-location-test +_quarto: + tests: + revealjs: + ensureHtmlElements: + - + - "div#lst-customers figcaption:nth-child(1)" + - "div#lst-customers-2 figcaption:nth-child(2)" +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). + + +```{#lst-customers-2 .sql lst-cap="Customers _query_" lst-cap-location="bottom"} +SELECT * FROM Customers +``` + +Then we query the customers database again (@lst-customers-2), with a caption in a different location. diff --git a/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-subfloat-1.qmd b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-subfloat-1.qmd new file mode 100644 index 00000000000..07b62b3bbeb --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/revealjs/revealjs-subfloat-1.qmd @@ -0,0 +1,30 @@ +--- +title: Crossref Test +format: revealjs +_quarto: + tests: + revealjs: + ensureFileRegexMatches: + - + - "\\(a\\) Surus" + - "\\(b\\) Abbas" + ensureHtmlElements: + - + - "div#fig-elephants figure > figcaption.quarto-float-caption" + - "div#fig-surus figure.quarto-subfloat-fig figcaption.quarto-subfloat-caption" + - "div#fig-abbas figure.quarto-subfloat-fig figcaption.quarto-subfloat-caption" + - [] +--- + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol=2} + +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas and @fig-surus. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/img/abbas.jpg b/tests/docs/smoke-all/crossrefs/float/typst/img/abbas.jpg new file mode 100644 index 00000000000..835b109d6f2 Binary files /dev/null and b/tests/docs/smoke-all/crossrefs/float/typst/img/abbas.jpg differ diff --git a/tests/docs/smoke-all/crossrefs/float/typst/img/painter.jpg b/tests/docs/smoke-all/crossrefs/float/typst/img/painter.jpg new file mode 100644 index 00000000000..82f7d35f580 Binary files /dev/null and b/tests/docs/smoke-all/crossrefs/float/typst/img/painter.jpg differ diff --git a/tests/docs/smoke-all/crossrefs/float/typst/img/surus.jpg b/tests/docs/smoke-all/crossrefs/float/typst/img/surus.jpg new file mode 100644 index 00000000000..9911bdbe3ad Binary files /dev/null and b/tests/docs/smoke-all/crossrefs/float/typst/img/surus.jpg differ diff --git a/tests/docs/smoke-all/crossrefs/float/typst/rawtablecaption.qmd b/tests/docs/smoke-all/crossrefs/float/typst/rawtablecaption.qmd new file mode 100644 index 00000000000..6c5954bda16 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/rawtablecaption.qmd @@ -0,0 +1,33 @@ +--- +title: table caption test +format: typst +keep-typ: true +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - "This is a caption." + - "" + - "@tbl-1" + - [] +--- + +::: {#tbl-1} + +```{=html} + + + + + + + + + +
This is a caption.
col 1col 2
12
34
+``` + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-float-1.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-1.qmd new file mode 100644 index 00000000000..a834b34cae6 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-1.qmd @@ -0,0 +1,45 @@ +--- +title: float crossref test +format: typst +keep-typ: true +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - "" + - "" + - "@fig-1" + - "@tbl-1" + - [] +--- + +This tests: + +- custom content in floats +- classes of float captions + +::: {#fig-1} + +::: {.figure-content} +This is the figure content. +::: + +This is a caption. + +::: + +See @fig-1. + + +::: {#tbl-1} + +::: {.table-content} +This is the table content. +::: + +This is a table. + +::: + +See @tbl-1. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-float-2.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-2.qmd new file mode 100644 index 00000000000..c292e01ac25 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-2.qmd @@ -0,0 +1,38 @@ +--- +title: float crossref test +format: typst +keep-typ: true +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - "" + - "" + - "@fig-foo" + - "@tbl-foo" + - "This is the figure" + - "This is the table" +--- + +This tests: + +- div float with image element as payload. +- div float with image element as payload for non-figure floats. + + +::: {#fig-foo} +![](img/surus.jpg) + +This is the figure +::: +See @fig-foo for more. + + +::: {#tbl-foo} +![](img/surus.jpg) + +This is the table +::: +See @tbl-foo for more. + diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-float-3.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-3.qmd new file mode 100644 index 00000000000..d58e08ecb67 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-3.qmd @@ -0,0 +1,26 @@ +--- +title: float crossref test +format: typst +keep-typ: true +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - "" + - "" + - "@fig-foo" + - "@tbl-foo" + - "This is a figure" + - "This is a table" +--- + +This tests: + +- float syntax for implicit figures and tables as images with identifiers + +![This is a figure](img/surus.jpg){#fig-foo} + +![This is a table](img/surus.jpg){#tbl-foo} + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-float-4.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-4.qmd new file mode 100644 index 00000000000..e6ed1c3f8d0 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-4.qmd @@ -0,0 +1,25 @@ +--- +title: float test +format: typst +keep-typ: true +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - "" + - "" + - "@fig-foo" + - "@tbl-foo" + - "#link\\(\"https://www.example.com/\"\\)\\[#image\\(\"img/surus.jpg\"\\)\\]" +--- + +This tests: + +- float syntax for implicit figures and tables as linked images with identifiers + +[![This is the figure](img/surus.jpg){#fig-foo}](https://www.example.com/) + +[![This is the table](img/surus.jpg){#tbl-foo}](https://www.example.com/) + +See @fig-foo and @tbl-foo for more. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-float-5.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-5.qmd new file mode 100644 index 00000000000..f9a9e596844 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-5.qmd @@ -0,0 +1,19 @@ +--- +title: Crossref Test +format: typst +keep-typ: true +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - "Elephant" + - "" + - "#strong\\[\\?[\\\\]\\@fig-elephant1\\]" +--- + +## Unresolved Crossref Figure + +![Elephant](img/surus.jpg){#fig-elephant} + +See @fig-elephant1 for examples. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-float-6.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-6.qmd new file mode 100644 index 00000000000..7497f85d3bb --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-6.qmd @@ -0,0 +1,20 @@ +--- +title: test simple figure crossref +keep-typ: true +format: typst +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - "" + - "@fig-simple" + - "A simple figure" + - "#image\\(\"img/surus.jpg\"\\)" + - [] +--- + +![A simple figure](img/surus.jpg){#fig-simple} + +See @fig-simple. + diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-float-caption-formatting-1.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-caption-formatting-1.qmd new file mode 100644 index 00000000000..301e75c2c91 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-caption-formatting-1.qmd @@ -0,0 +1,18 @@ +--- +title: caption-formatting-test +format: typst +keep-typ: true +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - "Customers #emph\\[query\\]" + +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-float-numbering-1.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-numbering-1.qmd new file mode 100644 index 00000000000..ff67329046e --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-numbering-1.qmd @@ -0,0 +1,49 @@ +--- +title: "My Document" +format: typst +keep-typ: true +crossref: + fig-labels: alpha x # (default is arabic) + tbl-labels: alpha A # (default is arabic) + subref-labels: roman i # (default is alpha a) +# TODO how do we inspect the resulting PDF for these? +# +# _quarto: +# tests: +# typst: +# ensureTypstFileRegexMatches: +# - +# - "Figure x: Elephant" +# - "Table A: My Caption" +# - "Figure y: Famous Elephants" +# - "\\(i\\) Surus" +# - "\\(ii\\) Abbas" +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + +| Col1 | Col2 | Col3 | +| ---- | ---- | ---- | +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol="2"} +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +See @fig-elephants for examples. In particular, @fig-abbas. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-float-options-1.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-options-1.qmd new file mode 100644 index 00000000000..d6607b5feb7 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-float-options-1.qmd @@ -0,0 +1,38 @@ +--- +title: "My Document" +format: typst +crossref: + fig-prefix: F. # (default is "fig.") + tbl-prefix: T. # (default is "tbl.") + title-delim: — # (default is ":") + ref-hyperlink: false # (default is true) +# _quarto: +# tests: +# html: +# ensureHtmlElements: +# - [] +# - +# - "a[href='#tbl-1'].quarto-xref" # ref-hyperlink: false +# ensureFileRegexMatches: +# - +# - "Figure 1— Elephant" +# - "See T. 1." +# - "See F. 1." +--- + +# Introduction + +![Elephant](img/painter.jpg){#fig-elephant} + +See @fig-elephant for an illustration. + + +| Col1 | Col2 | Col3 | +|------|------|------| +| A | B | C | +| E | F | G | +| A | G | G | + +: My Caption {#tbl-letters} + +See @tbl-letters. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-jupyter-1.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-jupyter-1.qmd new file mode 100644 index 00000000000..29518770064 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-jupyter-1.qmd @@ -0,0 +1,28 @@ +--- +title: Python Crossref Test +format: typst +keep-typ: true +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - "" + - "@fig-plot" + - "Plot" + - "#image\\(\"typst-jupyter-1_files/figure-typst/fig-plot-output-1.svg\"\\)" + - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plot +#| fig-cap: "Plot" + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-jupyter-2.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-jupyter-2.qmd new file mode 100644 index 00000000000..fb377b6cb97 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-jupyter-2.qmd @@ -0,0 +1,36 @@ +--- +title: Python Subfig Test +format: typst +# _quarto: +# tests: +# html: +# ensureFileRegexMatches: +# - [] +# - [] +# ensureHtmlElements: +# - +# - "div#fig-plots figure.quarto-float-fig > figcaption.quarto-float-caption" +# - "div#fig-plots-1 figure.quarto-float-fig figcaption.quarto-subfloat-caption" +# - "div#fig-plots-2 figure.quarto-float-fig figcaption.quarto-subfloat-caption" +# - [] +--- + +## Python Crossref Figure + +```{python} +#| label: fig-plots +#| fig-cap: "Plots" +#| fig-subcap: +#| - "Plot 1" +#| - "Plot 2" +#| layout-ncol: 2 + +import matplotlib.pyplot as plt +plt.plot([1,23,2,4]) +plt.show() + +plt.plot([8,65,23,90]) +plt.show() +``` + +See @fig-plots for examples. In particular, @fig-plots-2. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-knitr-1.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-knitr-1.qmd new file mode 100644 index 00000000000..26b0a55017b --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-knitr-1.qmd @@ -0,0 +1,24 @@ +--- +title: Knitr Crossref Test +keep-typ: true +format: typst +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - "Plot" + - "" + - "@fig-plot" +--- + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Plot" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-knitr-2.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-knitr-2.qmd new file mode 100644 index 00000000000..aac13504647 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-knitr-2.qmd @@ -0,0 +1,29 @@ +--- +title: Knitr Crossref Test +format: typst +# _quarto: +# tests: +# html: +# ensureHtmlElements: +# - +# - "figcaption em" # markdown test +# - "figcaption span.math" # math processing test +# - "div#fig-plot figure.quarto-float-fig img.figure-img" # image +--- + + +This tests: + +- float figures from knitr +- Markdown support for captions from knitr + +## Knitr Crossref Figure + +```{r} +#| label: fig-plot +#| fig-cap: "Fancy _caption_ with math: $e=mc^2$" + +plot(cars) +``` + +For example, see @fig-plot. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-knitr-table-captions-1.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-knitr-table-captions-1.qmd new file mode 100644 index 00000000000..7cbc4b19026 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-knitr-table-captions-1.qmd @@ -0,0 +1,27 @@ +--- +title: Knitr Table Test +format: typst +# _quarto: +# tests: +# html: +# ensureHtmlElements: +# - +# - "figure.quarto-float-tbl div#tbl-cars figure.quarto-float-tbl table.table" +# - "figure.quarto-float-tbl div#tbl-cars figure.quarto-float-tbl figcaption.quarto-subfloat-caption" +# - "figure.quarto-float-tbl div#tbl-pressure figure.quarto-float-tbl table.table" +# - "figure.quarto-float-tbl div#tbl-pressure figure.quarto-float-tbl figcaption.quarto-subfloat-caption" +# - "div#tbl-tables > figure.quarto-float-tbl > figcaption.quarto-float-caption" +# - [] +--- + +```{r} +#| label: tbl-tables +#| tbl-cap: "Tables" +#| layout-ncol: 2 + +library(knitr) +kable(head(cars), caption = "Cars {#tbl-cars}") +kable(head(pressure), caption = "Pressure {#tbl-pressure}") +``` + +See @tbl-cars for more information. \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-listings-1.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-listings-1.qmd new file mode 100644 index 00000000000..e864935452a --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-listings-1.qmd @@ -0,0 +1,20 @@ +--- +title: Listings Test +format: typst +keep-typ: true +_quarto: + tests: + typst: + ensureTypstFileRegexMatches: + - + - "" + - "@lst-customers" + - "Customers Query" + - [] +--- + +```{#lst-customers .sql lst-cap="Customers Query"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). \ No newline at end of file diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-lst-cap-location-1.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-lst-cap-location-1.qmd new file mode 100644 index 00000000000..3060de3e729 --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-lst-cap-location-1.qmd @@ -0,0 +1,24 @@ +--- +title: lst-cap-location-test +format: typst +# _quarto: +# tests: +# html: +# ensureHtmlElements: +# - +# - "div#lst-customers figcaption:nth-child(1)" +# - "div#lst-customers-2 figcaption:nth-child(2)" +--- + +```{#lst-customers .sql lst-cap="Customers _query_"} +SELECT * FROM Customers +``` + +Then we query the customers database (@lst-customers). + + +```{#lst-customers-2 .sql lst-cap="Customers _query_" lst-cap-location="bottom"} +SELECT * FROM Customers +``` + +Then we query the customers database again (@lst-customers-2), with a caption in a different location. diff --git a/tests/docs/smoke-all/crossrefs/float/typst/typst-subfloat-1.qmd b/tests/docs/smoke-all/crossrefs/float/typst/typst-subfloat-1.qmd new file mode 100644 index 00000000000..fb2a938622a --- /dev/null +++ b/tests/docs/smoke-all/crossrefs/float/typst/typst-subfloat-1.qmd @@ -0,0 +1,43 @@ +--- +title: Crossref Test +keep-typ: true +format: typst +# _quarto: +# tests: +# html: +# ensureFileRegexMatches: +# - +# - "\\(a\\) Surus" +# - "\\(b\\) Abbas" +# ensureHtmlElements: +# - +# - "div#fig-elephants figure > figcaption.quarto-float-caption" +# - "div#fig-surus figure.quarto-float-fig figcaption.quarto-subfloat-caption" +# - "div#fig-abbas figure.quarto-float-fig figcaption.quarto-subfloat-caption" + # - [] +--- + +## Simple Sub Figure + +::: {#fig-elephants layout-ncol=2} + +![Surus](img/surus.jpg){#fig-surus} + +![Abbas](img/abbas.jpg){#fig-abbas} + +Famous Elephants +::: + +::: {#tbl-elephants layout-ncol=2} + +![Surus as a table](img/surus.jpg){#tbl-surus} + +![Abbas as a table](img/abbas.jpg){#tbl-abbas} + +Famous Elephants as tables +::: + + +See @fig-elephants for examples. In particular, @fig-abbas and @fig-surus. + +And then, see @tbl-elephants for examples. In particular, @tbl-abbas and @tbl-surus. \ No newline at end of file diff --git a/tests/docs/smoke-all/format/html/.gitignore b/tests/docs/smoke-all/format/html/.gitignore new file mode 100644 index 00000000000..075b2542afb --- /dev/null +++ b/tests/docs/smoke-all/format/html/.gitignore @@ -0,0 +1 @@ +/.quarto/ diff --git a/tests/docs/smoke-all/format/html/_extensions/dragonstyle/lipsum/_extension.yml b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/lipsum/_extension.yml new file mode 100644 index 00000000000..b9d9fd11d27 --- /dev/null +++ b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/lipsum/_extension.yml @@ -0,0 +1,8 @@ +title: Lipsum +author: Charles Teague +version: 1.0.0 +quarto-required: ">=99.9.0" +contributes: + shortcodes: + - lipsum.lua + diff --git a/tests/docs/smoke-all/format/html/_extensions/dragonstyle/lipsum/lipsum.json b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/lipsum/lipsum.json new file mode 100644 index 00000000000..22d6de3ee03 --- /dev/null +++ b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/lipsum/lipsum.json @@ -0,0 +1,24 @@ +[ + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sagittis posuere ligula sit amet lacinia. Duis dignissim pellentesque magna, rhoncus congue sapien finibus mollis. Ut eu sem laoreet, vehicula ipsum in, convallis erat. Vestibulum magna sem, blandit pulvinar augue sit amet, auctor malesuada sapien. Nullam faucibus leo eget eros hendrerit, non laoreet ipsum lacinia. Curabitur cursus diam elit, non tempus ante volutpat a. Quisque hendrerit blandit purus non fringilla. Integer sit amet elit viverra ante dapibus semper. Vestibulum viverra rutrum enim, at luctus enim posuere eu. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.", + "Nunc ac dignissim magna. Vestibulum vitae egestas elit. Proin feugiat leo quis ante condimentum, eu ornare mauris feugiat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris cursus laoreet ex, dignissim bibendum est posuere iaculis. Suspendisse et maximus elit. In fringilla gravida ornare. Aenean id lectus pulvinar, sagittis felis nec, rutrum risus. Nam vel neque eu arcu blandit fringilla et in quam. Aliquam luctus est sit amet vestibulum eleifend. Phasellus elementum sagittis molestie. Proin tempor lorem arcu, at condimentum purus volutpat eu. Fusce et pellentesque ligula. Pellentesque id tellus at erat luctus fringilla. Suspendisse potenti.", + "Etiam maximus accumsan gravida. Maecenas at nunc dignissim, euismod enim ac, bibendum ipsum. Maecenas vehicula velit in nisl aliquet ultricies. Nam eget massa interdum, maximus arcu vel, pretium erat. Maecenas sit amet tempor purus, vitae aliquet nunc. Vivamus cursus urna velit, eleifend dictum magna laoreet ut. Duis eu erat mollis, blandit magna id, tincidunt ipsum. Integer massa nibh, commodo eu ex vel, venenatis efficitur ligula. Integer convallis lacus elit, maximus eleifend lacus ornare ac. Vestibulum scelerisque viverra urna id lacinia. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aenean eget enim at diam bibendum tincidunt eu non purus. Nullam id magna ultrices, sodales metus viverra, tempus turpis.", + "Duis ornare ex ac iaculis pretium. Maecenas sagittis odio id erat pharetra, sit amet consectetur quam sollicitudin. Vivamus pharetra quam purus, nec sagittis risus pretium at. Nullam feugiat, turpis ac accumsan interdum, sem tellus blandit neque, id vulputate diam quam semper nisl. Donec sit amet enim at neque porttitor aliquet. Phasellus facilisis nulla eget placerat eleifend. Vestibulum non egestas eros, eget lobortis ipsum. Nulla rutrum massa eget enim aliquam, id porttitor erat luctus. Nunc sagittis quis eros eu sagittis. Pellentesque dictum, erat at pellentesque sollicitudin, justo augue pulvinar metus, quis rutrum est mi nec felis. Vestibulum efficitur mi lorem, at elementum purus tincidunt a. Aliquam finibus enim magna, vitae pellentesque erat faucibus at. Nulla mauris tellus, imperdiet id lobortis et, dignissim condimentum ipsum. Morbi nulla orci, varius at aliquet sed, facilisis id tortor. Donec ut urna nisi.", + "Aenean placerat luctus tortor vitae molestie. Nulla at aliquet nulla. Sed efficitur tellus orci, sed fringilla lectus laoreet eget. Vivamus maximus quam sit amet arcu dignissim, sed accumsan massa ullamcorper. Sed iaculis tincidunt feugiat. Nulla in est at nunc ultricies dictum ut vitae nunc. Aenean convallis vel diam at malesuada. Suspendisse arcu libero, vehicula tempus ultrices a, placerat sit amet tortor. Sed dictum id nulla commodo mattis. Aliquam mollis, nunc eu tristique faucibus, purus lacus tincidunt nulla, ac pretium lorem nunc ut enim. Curabitur eget mattis nisl, vitae sodales augue. Nam felis massa, bibendum sit amet nulla vel, vulputate rutrum lacus. Aenean convallis odio pharetra nulla mattis consequat.", + "Ut ut condimentum augue, nec eleifend nisl. Sed facilisis egestas odio ac pretium. Pellentesque consequat magna sed venenatis sagittis. Vivamus feugiat lobortis magna vitae accumsan. Pellentesque euismod malesuada hendrerit. Ut non mauris non arcu condimentum sodales vitae vitae dolor. Nullam dapibus, velit eget lacinia rutrum, ipsum justo malesuada odio, et lobortis sapien magna vel lacus. Nulla purus neque, hendrerit non malesuada eget, mattis vel erat. Suspendisse potenti.", + "Nullam dapibus cursus dolor sit amet consequat. Nulla facilisi. Curabitur vel nulla non magna lacinia tincidunt. Duis porttitor quam leo, et blandit velit efficitur ut. Etiam auctor tincidunt porttitor. Phasellus sed accumsan mi. Fusce ut erat dui. Suspendisse eu augue eget turpis condimentum finibus eu non lorem. Donec finibus eros eu ante condimentum, sed pharetra sapien sagittis. Phasellus non dolor ac ante mollis auctor nec et sapien. Pellentesque vulputate at nisi eu tincidunt. Vestibulum at dolor aliquam, hendrerit purus eu, eleifend massa. Morbi consectetur eros id tincidunt gravida. Fusce ut enim quis orci hendrerit lacinia sed vitae enim.", + "Nulla eget cursus ipsum. Vivamus porttitor leo diam, sed volutpat lectus facilisis sit amet. Maecenas et pulvinar metus. Ut at dignissim tellus. In in tincidunt elit. Etiam vulputate lobortis arcu, vel faucibus leo lobortis ac. Aliquam erat volutpat. In interdum orci ac est euismod euismod. Nunc eleifend tristique risus, at lacinia odio commodo in. Sed aliquet ligula odio, sed tempor neque ultricies sit amet.", + "Etiam quis tortor luctus, pellentesque ante a, finibus dolor. Phasellus in nibh et magna pulvinar malesuada. Ut nisl ex, sagittis at sollicitudin et, sollicitudin id nunc. In id porta urna. Proin porta dolor dolor, vel dapibus nisi lacinia in. Pellentesque ante mauris, ornare non euismod a, fermentum ut sapien. Proin sed vehicula enim. Aliquam tortor odio, vestibulum vitae odio in, tempor molestie justo. Praesent maximus lacus nec leo maximus blandit.", + "Maecenas turpis velit, ultricies non elementum vel, luctus nec nunc. Nulla a diam interdum, faucibus sapien viverra, finibus metus. Donec non tortor diam. In ut elit aliquet, bibendum sem et, aliquam tortor. Donec congue, sem at rhoncus ultrices, nunc augue cursus erat, quis porttitor mauris libero ut ex. Nullam quis leo urna. Donec faucibus ligula eget pellentesque interdum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean rhoncus interdum erat ut ultricies. Aenean tempus ex non elit suscipit, quis dignissim enim efficitur. Proin laoreet enim massa, vitae laoreet nulla mollis quis.", + "Vestibulum ultrices, tortor at mattis porta, odio nisi rutrum nulla, sit amet tincidunt eros quam facilisis tellus. Fusce eleifend lectus in elementum lacinia. Nam auctor nunc in massa ullamcorper, sit amet auctor ante accumsan. Nam ut varius metus. Curabitur eget tristique leo. Cras finibus euismod erat eget elementum. Integer vel placerat ex. Ut id eros quis lectus lacinia venenatis hendrerit vel ante.", + "Etiam congue quam eget velit convallis, eu sagittis orci vestibulum. Vestibulum at massa turpis. Curabitur ornare ex sed purus vulputate, vitae porta augue rhoncus. Phasellus auctor suscipit purus, vel ultricies nunc. Nunc eleifend nulla ac purus volutpat, id fringilla felis aliquet. Duis vitae porttitor nibh, in rhoncus risus. Vestibulum a est vitae est tristique vehicula. Proin mollis justo id est tempus hendrerit. Praesent suscipit placerat congue. Aliquam eu elit gravida, consequat augue non, ultricies sapien. Nunc ultricies viverra ante, sit amet vehicula ante volutpat id. Etiam tempus purus vitae tellus mollis viverra. Donec at ornare mauris. Aliquam sodales hendrerit ornare. Suspendisse accumsan lacinia sapien, sit amet imperdiet dui molestie ut.", + "Etiam non efficitur urna, quis elementum nisi. Mauris posuere a augue vel gravida. Praesent luctus erat et ex iaculis interdum. Nulla vestibulum quam ac nunc consequat vulputate. Nullam iaculis lobortis sem sit amet fringilla. Aliquam semper, metus ut blandit semper, nulla velit fermentum sapien, fermentum ultrices dolor sapien sed leo. Vestibulum molestie faucibus magna, at feugiat nulla ullamcorper a. Aliquam erat volutpat. Praesent scelerisque magna a justo maximus, sit amet suscipit mauris tempor. Nulla nec dolor eget ipsum pellentesque lobortis a in ipsum. Morbi turpis turpis, fringilla a eleifend maximus, viverra nec neque. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.", + "Duis urna urna, pellentesque eu urna ut, malesuada bibendum dolor. Suspendisse potenti. Vivamus ornare, arcu quis molestie ultrices, magna est accumsan augue, auctor vulputate erat quam quis neque. Nullam scelerisque odio vel ultricies facilisis. Ut porta arcu non magna sagittis lacinia. Cras ornare vulputate lectus a tristique. Pellentesque ac arcu congue, rhoncus mi id, dignissim ligula.", + "Praesent ornare dolor turpis, sed tincidunt nisl pretium eget. Curabitur sed iaculis ex, vitae tristique sapien. Quisque nec ex dolor. Quisque ut nisl a libero egestas molestie. Nulla vel porta nulla. Phasellus id pretium arcu. Etiam sed mi pellentesque nibh scelerisque elementum sed at urna. Ut congue molestie nibh, sit amet pretium ligula consectetur eu. Integer consectetur augue justo, at placerat erat posuere at. Ut elementum urna lectus, vitae bibendum neque pulvinar quis. Suspendisse vulputate cursus eros id maximus. Duis pulvinar facilisis massa, et condimentum est viverra congue. Curabitur ornare convallis nisl. Morbi dictum scelerisque turpis quis pellentesque. Etiam lectus risus, luctus lobortis risus ut, rutrum vulputate justo. Nulla facilisi.", + "Proin sodales neque erat, varius cursus diam tincidunt sit amet. Etiam scelerisque fringilla nisl eu venenatis. Donec sem ipsum, scelerisque ac venenatis quis, hendrerit vel mauris. Praesent semper erat sit amet purus condimentum, sit amet auctor mi feugiat. In hac habitasse platea dictumst. Nunc ac mauris in massa feugiat bibendum id in dui. Praesent accumsan urna at lacinia aliquet. Proin ultricies eu est quis pellentesque. In vel lorem at nisl rhoncus cursus eu quis mi. In eu rutrum ante, quis placerat justo. Etiam euismod nibh nibh, sed elementum nunc imperdiet in. Praesent gravida nunc vel odio lacinia, at tempus nisl placerat. Aenean id ipsum sed est sagittis hendrerit non in tortor.", + "In vehicula magna vel scelerisque eleifend. Nunc euismod luctus nisi, ut convallis nisl placerat eget. Etiam ornare, leo faucibus mollis fermentum, lacus diam eleifend augue, non ullamcorper lacus nunc vel dui. Vestibulum porttitor quam elit, fermentum bibendum quam tempor non. Nullam feugiat, mi sit amet mattis placerat, lectus ipsum volutpat lectus, vitae eleifend est augue ac nunc. Quisque ullamcorper neque eu luctus pulvinar. Morbi dictum dignissim turpis, ut aliquet enim rutrum nec. Nulla facilisi. Nullam aliquam malesuada purus in auctor. Nam ac suscipit enim. Integer nec volutpat tellus, quis lobortis felis. Fusce rutrum, sem sed dictum lobortis, mauris magna pellentesque augue, vitae facilisis sem tellus ut mi." +] + + + + + diff --git a/tests/docs/smoke-all/format/html/_extensions/dragonstyle/lipsum/lipsum.lua b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/lipsum/lipsum.lua new file mode 100644 index 00000000000..4e1a729012a --- /dev/null +++ b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/lipsum/lipsum.lua @@ -0,0 +1,85 @@ + + +local lipsum + +-- reads a file +local function read_file(path) + local file = io.open(path, "rb") + if not file then return nil end + local content = file:read "*a" + file:close() + return content +end + +-- read lipsum data +function readLipsum() + if lipsum == nil then + local file = quarto.utils.resolve_path("lipsum.json") + local fileContents = read_file(file) + if fileContents ~= nil then + local json = quarto.json.decode(fileContents) + lipsum = json + else + quarto.log.error("Unable to read lipsum data file.") + lipsum = {} + end + end + return lipsum +end + +local rangePattern = '(%d+)%-(%d+)' +local barePattern = '^(%d+)$' + +return { + ['lipsum'] = function(args, kwargs, meta) + + local paraStart = 1 + local paraEnd = 5 + + if args[1] ~= nil then + -- a range is specified, like 1-5, 2-3, 5-1 + local range = pandoc.utils.stringify(args[1]) + local _,_,startRange,endRange = range:find(rangePattern) + if startRange and endRange then + + local startNumber = tonumber(startRange) + if startNumber ~= nil then + paraStart = startNumber + end + + local endNumber = tonumber(endRange) + if endNumber ~= nil then + paraEnd = endNumber + end + else + -- a number of paragraphs is specified, like 10 + local _,_,bareVal = range:find(barePattern) + if bareVal then + local endNumber = tonumber(bareVal) + if endNumber ~= nil then + paraEnd = endNumber + end + end + end + end + + local paras = readLipsum(); + local outputParas = {} + + local count = paraEnd - paraStart + 1 + if paraStart > paraEnd then + count = paraStart - paraEnd + 1 + end + + for i=1,count do + local paraIdx = i + (paraStart - 1) + if paraStart > paraEnd then + paraIdx = (paraStart + 1) - i + end + local outIdx = ((paraIdx-1)%(#paras-1))+1 + outputParas[i] = pandoc.Para(paras[outIdx]) + end + + return outputParas + end +} diff --git a/tests/docs/smoke-all/format/html/_extensions/dragonstyle/unsplash/_extension.yml b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/unsplash/_extension.yml new file mode 100644 index 00000000000..f22a6d23208 --- /dev/null +++ b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/unsplash/_extension.yml @@ -0,0 +1,8 @@ +title: Unsplash +author: Charles Teague +version: 1.0.3 +quarto-required: ">=1.3.0" +contributes: + shortcodes: + - unsplash.lua + diff --git a/tests/docs/smoke-all/format/html/_extensions/dragonstyle/unsplash/style.css b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/unsplash/style.css new file mode 100644 index 00000000000..42f96206447 --- /dev/null +++ b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/unsplash/style.css @@ -0,0 +1,25 @@ +.unsplash-container { + overflow: hidden; + margin-bottom: 1em; +} + +.unsplash-container img { + object-fit: cover; + width: 100%; +} + +.unsplash-container.float-right { + float: right; + padding-left: 0.75em; +} + +.unsplash-container.float-left { + float: left; + padding-right: 0.75em; +} + +.unsplash-container.float-center { + float: center; + padding-left: 0.75em; + padding-right: 0.75em; +} \ No newline at end of file diff --git a/tests/docs/smoke-all/format/html/_extensions/dragonstyle/unsplash/unsplash.lua b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/unsplash/unsplash.lua new file mode 100644 index 00000000000..fd87ab22bb4 --- /dev/null +++ b/tests/docs/smoke-all/format/html/_extensions/dragonstyle/unsplash/unsplash.lua @@ -0,0 +1,193 @@ + +local mimeImgExts = { + ["image/jpeg"]="jpg", + ["image/gif"]="gif", + ["image/vnd.microsoft.icon"]="ico", + ["image/avif"]="avif", + ["image/bmp"]="bmp", + ["image/png"]="png", + ["image/svg+xml"]="svg", + ["image/tiff"]="tif", + ["image/webp"]="webp", +} + +local function file_exists(name) + local f = io.open(name, 'r') + if f ~= nil then + io.close(f) + return true + else + return false + end +end + +local function write_file(path, contents, mode) + pandoc.system.make_directory(pandoc.path.directory(path), true) + mode = mode or "a" + local file = io.open(path, mode) + if file then + file:write(contents) + file:close() + return true + else + return false + end +end + + + + +return { + ['unsplash'] = function(args, kwargs, meta) + + + -- positional == keywords + -- {{< unsplash cat >}} + -- {{< unsplash keywords="cats" height="300" width="300"}} + + -- TODO: use the real api to download a copy of the image using rest + -- TODO: ping the download url + -- TODO: Generate a stable name for the image + -- TODO: Make this a format resource instead of media bag, so images become stable + -- TODO: generate more complete information from REST endpoint to credit author + + local height = nil + local width = nil + local keywords = nil + local classes = nil + local float = nil + + -- the filename + local filename + if args[1] ~= nil then + filename = pandoc.utils.stringify(args[1]) + local stem = pandoc.path.split_extension(pandoc.path.filename(filename)) + keywords = stem + end + + -- height + if kwargs['height'] ~= nil and #kwargs['height'] > 0 then + height = pandoc.utils.stringify(kwargs['height']) + end + + -- width + if kwargs['width'] ~= nil and #kwargs['width'] > 0 then + width = pandoc.utils.stringify(kwargs['width']) + end + + -- keywords + if kwargs['keywords'] ~= nil and #kwargs['keywords'] > 0 then + keywords = pandoc.utils.stringify(kwargs['keywords']) + end + + -- classes + if kwargs['class'] ~= nil and #kwargs['class'] > 0 then + classes = pandoc.utils.stringify(kwargs['class']) + end + + -- classes + if kwargs['float'] ~= nil and #kwargs['float'] > 0 then + float = pandoc.utils.stringify(kwargs['float']) + end + + + -- form the unsplash URL that will be used + local url = "https://source.unsplash.com/random" + if width and height then + url = url .. "/" .. tostring(width) .. '×' .. tostring(height) + end + if keywords ~= nil then + url = url .. '/?' .. keywords + end + + -- deal with the height and width + + local imgContainer = function (imgEl) + + -- HTML formats use a container to implement sizing, so + -- apply classes and so on to that container + if quarto.doc.is_format("html") then + + + quarto.doc.add_html_dependency({ + name = "unsplash-styles", + version = "1.0.0", + stylesheets = {"style.css"} + }) + + local style = "" + if height then + style = style .. 'height: ' .. height .. '; ' + end + if width then + style = style .. 'width: ' .. width .. '; ' + end + + local divAttrRaw = {} + if style ~= "" then + divAttrRaw['style'] = style + end + + local clz = pandoc.List({'unsplash-container'}) + if float then + clz:insert('float-' .. float) + end + + if classes ~= nil then + for token in string.gmatch(classes, "[^%s]+") do + clz:insert(token) + end + end + + local divAttr = pandoc.Attr("", clz, divAttrRaw) + local div = pandoc.Div(imgEl, divAttr) + + return div + + else + + -- Non-HTML formats just return the raw image with + -- any options set on that + + if height then + imgEl.attr.attributes['height'] = height + end + if width then + imgEl.attr.attributes['width'] = width + end + + if classes ~= nil then + for clz in string.gmatch(classes, "[^%s]+") do + imgEl.attr.classes:insert(clz) + end + end + + return imgEl + + end + end + + if filename ~= nil and file_exists(filename) then + return imgContainer(pandoc.Image("", filename)) + elseif filename ~= nil then + -- read the image + local _imgMt, imgContents = pandoc.mediabag.fetch(url) + write_file(filename, imgContents, "wb") + return imgContainer(pandoc.Image("", filename)) + else + -- read the image + local imgMt, imgContents = pandoc.mediabag.fetch(url) + + -- place it in media bag and link to it + if imgContents ~= nil then + local tmpFileName = pandoc.path.filename(os.tmpname()) ..'.' .. mimeImgExts[imgMt] + pandoc.mediabag.insert(tmpFileName, imgMt, imgContents) + return imgContainer(pandoc.Image("", tmpFileName)) + end + end + + + end +} + + diff --git a/tests/docs/smoke-all/format/html/_quarto.yml b/tests/docs/smoke-all/format/html/_quarto.yml new file mode 100644 index 00000000000..a39137ec9b2 --- /dev/null +++ b/tests/docs/smoke-all/format/html/_quarto.yml @@ -0,0 +1,2 @@ +project: + title: "Foo" diff --git a/tests/docs/smoke-all/format/html/code-links-manual.qmd b/tests/docs/smoke-all/format/html/code-links-manual.qmd new file mode 100644 index 00000000000..2768495e302 --- /dev/null +++ b/tests/docs/smoke-all/format/html/code-links-manual.qmd @@ -0,0 +1,23 @@ +--- +title: Code Links Text +format: + html: + code-links: + - text: Hello World + href: https://www.charlesteague.com +toc: true +_quarto: + tests: + html: + ensureHtmlElements: + - + - ".quarto-code-links > ul > li:only-child" +--- + +## Section 1 + +{{< lipsum 1 >}} + +## Section 2 + +{{< unsplash imgs/beach.jpg >}} diff --git a/tests/docs/smoke-all/format/html/code-links-root.qmd b/tests/docs/smoke-all/format/html/code-links-root.qmd new file mode 100644 index 00000000000..5b0c7592d7a --- /dev/null +++ b/tests/docs/smoke-all/format/html/code-links-root.qmd @@ -0,0 +1,21 @@ +--- +title: Code Links Text +format: html +code-links: + - text: Hello World + href: https://www.charlesteague.com +_quarto: + tests: + html: + ensureHtmlElements: + - + - ".quarto-code-links > ul > li:only-child" +--- + +## Section 1 + +{{< lipsum 1 >}} + +## Section 2 + +{{< unsplash imgs/sunset.jpg >}} diff --git a/tests/docs/smoke-all/format/html/code-links.auto.qmd b/tests/docs/smoke-all/format/html/code-links.auto.qmd new file mode 100644 index 00000000000..b014f146845 --- /dev/null +++ b/tests/docs/smoke-all/format/html/code-links.auto.qmd @@ -0,0 +1,23 @@ +--- +title: Code Links Text +format: + html: + code-links: + - repo + - binder +toc: true +_quarto: + tests: + html: + ensureHtmlElements: + - + - ".quarto-code-links > ul > li" +--- + +## Section 1 + +{{< lipsum 1 >}} + +## Section 2 + +{{< unsplash imgs/jet.jpg >}} diff --git a/tests/docs/smoke-all/format/html/imgs/beach.jpg b/tests/docs/smoke-all/format/html/imgs/beach.jpg new file mode 100644 index 00000000000..fedb2137d07 Binary files /dev/null and b/tests/docs/smoke-all/format/html/imgs/beach.jpg differ diff --git a/tests/docs/smoke-all/format/html/imgs/jet.jpg b/tests/docs/smoke-all/format/html/imgs/jet.jpg new file mode 100644 index 00000000000..ee496530495 Binary files /dev/null and b/tests/docs/smoke-all/format/html/imgs/jet.jpg differ diff --git a/tests/docs/smoke-all/format/html/imgs/sunset.jpg b/tests/docs/smoke-all/format/html/imgs/sunset.jpg new file mode 100644 index 00000000000..763e07875b0 Binary files /dev/null and b/tests/docs/smoke-all/format/html/imgs/sunset.jpg differ diff --git a/tests/docs/smoke-all/jats/basic.qmd b/tests/docs/smoke-all/jats/basic.qmd index 38401447b66..f1d41b2c386 100644 --- a/tests/docs/smoke-all/jats/basic.qmd +++ b/tests/docs/smoke-all/jats/basic.qmd @@ -46,21 +46,21 @@ author: roles: - data curation: lead funding: - - id: award_id_23213 - statement: "Special thanks to sloan foundation and all that." + - statement: "Special thanks to sloan foundation and all that." open-access: "Miscellaneous text about open access that appears here" - source: - - "The Sloan Foundation" - - text: Cool Source - country: USA - recipient: - - ref: cteague - - name: Norah Jones - - institution: Blue Note Records - - John Hamm - investigator: - - Norah Jones - - ref: bn-records + awards: + - id: award_id_23213 + source: + - "The Sloan Foundation" + - text: Cool Source + country: USA + recipient: + - ref: cteague + - name: Norah Jones + - institution: Blue Note Records + - John Hamm + investigator: + - Norah Jones - This is another simple statement what is up bro citation: container-id: AGU-SC diff --git a/tests/docs/smoke-all/knitr/execute-options.qmd b/tests/docs/smoke-all/knitr/execute-options.qmd new file mode 100644 index 00000000000..942699a2886 --- /dev/null +++ b/tests/docs/smoke-all/knitr/execute-options.qmd @@ -0,0 +1,35 @@ +--- +engine: knitr +format: + html: + fig-asp: 0.5 + fig-width: 30 + fig-dpi: 9 + fig-format: png + df-print: kable +execute: + echo: false +_quarto: + tests: + html: + ensureFileRegexMatches: + - + - "dpi: 9" + - "fig[.]asp: 0[.]5" + - "fig[.]width: 30" + - "dev: png" + - "df_print: kable" +--- + +## Options + +```{r} +#| output: asis +opts <- knitr::opts_current$get(c("dpi", "fig.asp", "fig.width", "dev")) +cat(paste0("* ", names(opts), ": ", opts), sep = "\n") +``` + +```{r} +#| output: asis +cat(paste0("* df_print: ", knitr::opts_knit$get("rmarkdown.df_print"))) +``` diff --git a/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/lipsum/_extension.yml b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/lipsum/_extension.yml new file mode 100644 index 00000000000..b9d9fd11d27 --- /dev/null +++ b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/lipsum/_extension.yml @@ -0,0 +1,8 @@ +title: Lipsum +author: Charles Teague +version: 1.0.0 +quarto-required: ">=99.9.0" +contributes: + shortcodes: + - lipsum.lua + diff --git a/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/lipsum/lipsum.json b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/lipsum/lipsum.json new file mode 100644 index 00000000000..22d6de3ee03 --- /dev/null +++ b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/lipsum/lipsum.json @@ -0,0 +1,24 @@ +[ + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sagittis posuere ligula sit amet lacinia. Duis dignissim pellentesque magna, rhoncus congue sapien finibus mollis. Ut eu sem laoreet, vehicula ipsum in, convallis erat. Vestibulum magna sem, blandit pulvinar augue sit amet, auctor malesuada sapien. Nullam faucibus leo eget eros hendrerit, non laoreet ipsum lacinia. Curabitur cursus diam elit, non tempus ante volutpat a. Quisque hendrerit blandit purus non fringilla. Integer sit amet elit viverra ante dapibus semper. Vestibulum viverra rutrum enim, at luctus enim posuere eu. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.", + "Nunc ac dignissim magna. Vestibulum vitae egestas elit. Proin feugiat leo quis ante condimentum, eu ornare mauris feugiat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris cursus laoreet ex, dignissim bibendum est posuere iaculis. Suspendisse et maximus elit. In fringilla gravida ornare. Aenean id lectus pulvinar, sagittis felis nec, rutrum risus. Nam vel neque eu arcu blandit fringilla et in quam. Aliquam luctus est sit amet vestibulum eleifend. Phasellus elementum sagittis molestie. Proin tempor lorem arcu, at condimentum purus volutpat eu. Fusce et pellentesque ligula. Pellentesque id tellus at erat luctus fringilla. Suspendisse potenti.", + "Etiam maximus accumsan gravida. Maecenas at nunc dignissim, euismod enim ac, bibendum ipsum. Maecenas vehicula velit in nisl aliquet ultricies. Nam eget massa interdum, maximus arcu vel, pretium erat. Maecenas sit amet tempor purus, vitae aliquet nunc. Vivamus cursus urna velit, eleifend dictum magna laoreet ut. Duis eu erat mollis, blandit magna id, tincidunt ipsum. Integer massa nibh, commodo eu ex vel, venenatis efficitur ligula. Integer convallis lacus elit, maximus eleifend lacus ornare ac. Vestibulum scelerisque viverra urna id lacinia. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Aenean eget enim at diam bibendum tincidunt eu non purus. Nullam id magna ultrices, sodales metus viverra, tempus turpis.", + "Duis ornare ex ac iaculis pretium. Maecenas sagittis odio id erat pharetra, sit amet consectetur quam sollicitudin. Vivamus pharetra quam purus, nec sagittis risus pretium at. Nullam feugiat, turpis ac accumsan interdum, sem tellus blandit neque, id vulputate diam quam semper nisl. Donec sit amet enim at neque porttitor aliquet. Phasellus facilisis nulla eget placerat eleifend. Vestibulum non egestas eros, eget lobortis ipsum. Nulla rutrum massa eget enim aliquam, id porttitor erat luctus. Nunc sagittis quis eros eu sagittis. Pellentesque dictum, erat at pellentesque sollicitudin, justo augue pulvinar metus, quis rutrum est mi nec felis. Vestibulum efficitur mi lorem, at elementum purus tincidunt a. Aliquam finibus enim magna, vitae pellentesque erat faucibus at. Nulla mauris tellus, imperdiet id lobortis et, dignissim condimentum ipsum. Morbi nulla orci, varius at aliquet sed, facilisis id tortor. Donec ut urna nisi.", + "Aenean placerat luctus tortor vitae molestie. Nulla at aliquet nulla. Sed efficitur tellus orci, sed fringilla lectus laoreet eget. Vivamus maximus quam sit amet arcu dignissim, sed accumsan massa ullamcorper. Sed iaculis tincidunt feugiat. Nulla in est at nunc ultricies dictum ut vitae nunc. Aenean convallis vel diam at malesuada. Suspendisse arcu libero, vehicula tempus ultrices a, placerat sit amet tortor. Sed dictum id nulla commodo mattis. Aliquam mollis, nunc eu tristique faucibus, purus lacus tincidunt nulla, ac pretium lorem nunc ut enim. Curabitur eget mattis nisl, vitae sodales augue. Nam felis massa, bibendum sit amet nulla vel, vulputate rutrum lacus. Aenean convallis odio pharetra nulla mattis consequat.", + "Ut ut condimentum augue, nec eleifend nisl. Sed facilisis egestas odio ac pretium. Pellentesque consequat magna sed venenatis sagittis. Vivamus feugiat lobortis magna vitae accumsan. Pellentesque euismod malesuada hendrerit. Ut non mauris non arcu condimentum sodales vitae vitae dolor. Nullam dapibus, velit eget lacinia rutrum, ipsum justo malesuada odio, et lobortis sapien magna vel lacus. Nulla purus neque, hendrerit non malesuada eget, mattis vel erat. Suspendisse potenti.", + "Nullam dapibus cursus dolor sit amet consequat. Nulla facilisi. Curabitur vel nulla non magna lacinia tincidunt. Duis porttitor quam leo, et blandit velit efficitur ut. Etiam auctor tincidunt porttitor. Phasellus sed accumsan mi. Fusce ut erat dui. Suspendisse eu augue eget turpis condimentum finibus eu non lorem. Donec finibus eros eu ante condimentum, sed pharetra sapien sagittis. Phasellus non dolor ac ante mollis auctor nec et sapien. Pellentesque vulputate at nisi eu tincidunt. Vestibulum at dolor aliquam, hendrerit purus eu, eleifend massa. Morbi consectetur eros id tincidunt gravida. Fusce ut enim quis orci hendrerit lacinia sed vitae enim.", + "Nulla eget cursus ipsum. Vivamus porttitor leo diam, sed volutpat lectus facilisis sit amet. Maecenas et pulvinar metus. Ut at dignissim tellus. In in tincidunt elit. Etiam vulputate lobortis arcu, vel faucibus leo lobortis ac. Aliquam erat volutpat. In interdum orci ac est euismod euismod. Nunc eleifend tristique risus, at lacinia odio commodo in. Sed aliquet ligula odio, sed tempor neque ultricies sit amet.", + "Etiam quis tortor luctus, pellentesque ante a, finibus dolor. Phasellus in nibh et magna pulvinar malesuada. Ut nisl ex, sagittis at sollicitudin et, sollicitudin id nunc. In id porta urna. Proin porta dolor dolor, vel dapibus nisi lacinia in. Pellentesque ante mauris, ornare non euismod a, fermentum ut sapien. Proin sed vehicula enim. Aliquam tortor odio, vestibulum vitae odio in, tempor molestie justo. Praesent maximus lacus nec leo maximus blandit.", + "Maecenas turpis velit, ultricies non elementum vel, luctus nec nunc. Nulla a diam interdum, faucibus sapien viverra, finibus metus. Donec non tortor diam. In ut elit aliquet, bibendum sem et, aliquam tortor. Donec congue, sem at rhoncus ultrices, nunc augue cursus erat, quis porttitor mauris libero ut ex. Nullam quis leo urna. Donec faucibus ligula eget pellentesque interdum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean rhoncus interdum erat ut ultricies. Aenean tempus ex non elit suscipit, quis dignissim enim efficitur. Proin laoreet enim massa, vitae laoreet nulla mollis quis.", + "Vestibulum ultrices, tortor at mattis porta, odio nisi rutrum nulla, sit amet tincidunt eros quam facilisis tellus. Fusce eleifend lectus in elementum lacinia. Nam auctor nunc in massa ullamcorper, sit amet auctor ante accumsan. Nam ut varius metus. Curabitur eget tristique leo. Cras finibus euismod erat eget elementum. Integer vel placerat ex. Ut id eros quis lectus lacinia venenatis hendrerit vel ante.", + "Etiam congue quam eget velit convallis, eu sagittis orci vestibulum. Vestibulum at massa turpis. Curabitur ornare ex sed purus vulputate, vitae porta augue rhoncus. Phasellus auctor suscipit purus, vel ultricies nunc. Nunc eleifend nulla ac purus volutpat, id fringilla felis aliquet. Duis vitae porttitor nibh, in rhoncus risus. Vestibulum a est vitae est tristique vehicula. Proin mollis justo id est tempus hendrerit. Praesent suscipit placerat congue. Aliquam eu elit gravida, consequat augue non, ultricies sapien. Nunc ultricies viverra ante, sit amet vehicula ante volutpat id. Etiam tempus purus vitae tellus mollis viverra. Donec at ornare mauris. Aliquam sodales hendrerit ornare. Suspendisse accumsan lacinia sapien, sit amet imperdiet dui molestie ut.", + "Etiam non efficitur urna, quis elementum nisi. Mauris posuere a augue vel gravida. Praesent luctus erat et ex iaculis interdum. Nulla vestibulum quam ac nunc consequat vulputate. Nullam iaculis lobortis sem sit amet fringilla. Aliquam semper, metus ut blandit semper, nulla velit fermentum sapien, fermentum ultrices dolor sapien sed leo. Vestibulum molestie faucibus magna, at feugiat nulla ullamcorper a. Aliquam erat volutpat. Praesent scelerisque magna a justo maximus, sit amet suscipit mauris tempor. Nulla nec dolor eget ipsum pellentesque lobortis a in ipsum. Morbi turpis turpis, fringilla a eleifend maximus, viverra nec neque. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.", + "Duis urna urna, pellentesque eu urna ut, malesuada bibendum dolor. Suspendisse potenti. Vivamus ornare, arcu quis molestie ultrices, magna est accumsan augue, auctor vulputate erat quam quis neque. Nullam scelerisque odio vel ultricies facilisis. Ut porta arcu non magna sagittis lacinia. Cras ornare vulputate lectus a tristique. Pellentesque ac arcu congue, rhoncus mi id, dignissim ligula.", + "Praesent ornare dolor turpis, sed tincidunt nisl pretium eget. Curabitur sed iaculis ex, vitae tristique sapien. Quisque nec ex dolor. Quisque ut nisl a libero egestas molestie. Nulla vel porta nulla. Phasellus id pretium arcu. Etiam sed mi pellentesque nibh scelerisque elementum sed at urna. Ut congue molestie nibh, sit amet pretium ligula consectetur eu. Integer consectetur augue justo, at placerat erat posuere at. Ut elementum urna lectus, vitae bibendum neque pulvinar quis. Suspendisse vulputate cursus eros id maximus. Duis pulvinar facilisis massa, et condimentum est viverra congue. Curabitur ornare convallis nisl. Morbi dictum scelerisque turpis quis pellentesque. Etiam lectus risus, luctus lobortis risus ut, rutrum vulputate justo. Nulla facilisi.", + "Proin sodales neque erat, varius cursus diam tincidunt sit amet. Etiam scelerisque fringilla nisl eu venenatis. Donec sem ipsum, scelerisque ac venenatis quis, hendrerit vel mauris. Praesent semper erat sit amet purus condimentum, sit amet auctor mi feugiat. In hac habitasse platea dictumst. Nunc ac mauris in massa feugiat bibendum id in dui. Praesent accumsan urna at lacinia aliquet. Proin ultricies eu est quis pellentesque. In vel lorem at nisl rhoncus cursus eu quis mi. In eu rutrum ante, quis placerat justo. Etiam euismod nibh nibh, sed elementum nunc imperdiet in. Praesent gravida nunc vel odio lacinia, at tempus nisl placerat. Aenean id ipsum sed est sagittis hendrerit non in tortor.", + "In vehicula magna vel scelerisque eleifend. Nunc euismod luctus nisi, ut convallis nisl placerat eget. Etiam ornare, leo faucibus mollis fermentum, lacus diam eleifend augue, non ullamcorper lacus nunc vel dui. Vestibulum porttitor quam elit, fermentum bibendum quam tempor non. Nullam feugiat, mi sit amet mattis placerat, lectus ipsum volutpat lectus, vitae eleifend est augue ac nunc. Quisque ullamcorper neque eu luctus pulvinar. Morbi dictum dignissim turpis, ut aliquet enim rutrum nec. Nulla facilisi. Nullam aliquam malesuada purus in auctor. Nam ac suscipit enim. Integer nec volutpat tellus, quis lobortis felis. Fusce rutrum, sem sed dictum lobortis, mauris magna pellentesque augue, vitae facilisis sem tellus ut mi." +] + + + + + diff --git a/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/lipsum/lipsum.lua b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/lipsum/lipsum.lua new file mode 100644 index 00000000000..4e1a729012a --- /dev/null +++ b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/lipsum/lipsum.lua @@ -0,0 +1,85 @@ + + +local lipsum + +-- reads a file +local function read_file(path) + local file = io.open(path, "rb") + if not file then return nil end + local content = file:read "*a" + file:close() + return content +end + +-- read lipsum data +function readLipsum() + if lipsum == nil then + local file = quarto.utils.resolve_path("lipsum.json") + local fileContents = read_file(file) + if fileContents ~= nil then + local json = quarto.json.decode(fileContents) + lipsum = json + else + quarto.log.error("Unable to read lipsum data file.") + lipsum = {} + end + end + return lipsum +end + +local rangePattern = '(%d+)%-(%d+)' +local barePattern = '^(%d+)$' + +return { + ['lipsum'] = function(args, kwargs, meta) + + local paraStart = 1 + local paraEnd = 5 + + if args[1] ~= nil then + -- a range is specified, like 1-5, 2-3, 5-1 + local range = pandoc.utils.stringify(args[1]) + local _,_,startRange,endRange = range:find(rangePattern) + if startRange and endRange then + + local startNumber = tonumber(startRange) + if startNumber ~= nil then + paraStart = startNumber + end + + local endNumber = tonumber(endRange) + if endNumber ~= nil then + paraEnd = endNumber + end + else + -- a number of paragraphs is specified, like 10 + local _,_,bareVal = range:find(barePattern) + if bareVal then + local endNumber = tonumber(bareVal) + if endNumber ~= nil then + paraEnd = endNumber + end + end + end + end + + local paras = readLipsum(); + local outputParas = {} + + local count = paraEnd - paraStart + 1 + if paraStart > paraEnd then + count = paraStart - paraEnd + 1 + end + + for i=1,count do + local paraIdx = i + (paraStart - 1) + if paraStart > paraEnd then + paraIdx = (paraStart + 1) - i + end + local outIdx = ((paraIdx-1)%(#paras-1))+1 + outputParas[i] = pandoc.Para(paras[outIdx]) + end + + return outputParas + end +} diff --git a/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/unsplash/_extension.yml b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/unsplash/_extension.yml new file mode 100644 index 00000000000..f22a6d23208 --- /dev/null +++ b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/unsplash/_extension.yml @@ -0,0 +1,8 @@ +title: Unsplash +author: Charles Teague +version: 1.0.3 +quarto-required: ">=1.3.0" +contributes: + shortcodes: + - unsplash.lua + diff --git a/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/unsplash/style.css b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/unsplash/style.css new file mode 100644 index 00000000000..42f96206447 --- /dev/null +++ b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/unsplash/style.css @@ -0,0 +1,25 @@ +.unsplash-container { + overflow: hidden; + margin-bottom: 1em; +} + +.unsplash-container img { + object-fit: cover; + width: 100%; +} + +.unsplash-container.float-right { + float: right; + padding-left: 0.75em; +} + +.unsplash-container.float-left { + float: left; + padding-right: 0.75em; +} + +.unsplash-container.float-center { + float: center; + padding-left: 0.75em; + padding-right: 0.75em; +} \ No newline at end of file diff --git a/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/unsplash/unsplash.lua b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/unsplash/unsplash.lua new file mode 100644 index 00000000000..fd87ab22bb4 --- /dev/null +++ b/tests/docs/smoke-all/lightbox/_extensions/dragonstyle/unsplash/unsplash.lua @@ -0,0 +1,193 @@ + +local mimeImgExts = { + ["image/jpeg"]="jpg", + ["image/gif"]="gif", + ["image/vnd.microsoft.icon"]="ico", + ["image/avif"]="avif", + ["image/bmp"]="bmp", + ["image/png"]="png", + ["image/svg+xml"]="svg", + ["image/tiff"]="tif", + ["image/webp"]="webp", +} + +local function file_exists(name) + local f = io.open(name, 'r') + if f ~= nil then + io.close(f) + return true + else + return false + end +end + +local function write_file(path, contents, mode) + pandoc.system.make_directory(pandoc.path.directory(path), true) + mode = mode or "a" + local file = io.open(path, mode) + if file then + file:write(contents) + file:close() + return true + else + return false + end +end + + + + +return { + ['unsplash'] = function(args, kwargs, meta) + + + -- positional == keywords + -- {{< unsplash cat >}} + -- {{< unsplash keywords="cats" height="300" width="300"}} + + -- TODO: use the real api to download a copy of the image using rest + -- TODO: ping the download url + -- TODO: Generate a stable name for the image + -- TODO: Make this a format resource instead of media bag, so images become stable + -- TODO: generate more complete information from REST endpoint to credit author + + local height = nil + local width = nil + local keywords = nil + local classes = nil + local float = nil + + -- the filename + local filename + if args[1] ~= nil then + filename = pandoc.utils.stringify(args[1]) + local stem = pandoc.path.split_extension(pandoc.path.filename(filename)) + keywords = stem + end + + -- height + if kwargs['height'] ~= nil and #kwargs['height'] > 0 then + height = pandoc.utils.stringify(kwargs['height']) + end + + -- width + if kwargs['width'] ~= nil and #kwargs['width'] > 0 then + width = pandoc.utils.stringify(kwargs['width']) + end + + -- keywords + if kwargs['keywords'] ~= nil and #kwargs['keywords'] > 0 then + keywords = pandoc.utils.stringify(kwargs['keywords']) + end + + -- classes + if kwargs['class'] ~= nil and #kwargs['class'] > 0 then + classes = pandoc.utils.stringify(kwargs['class']) + end + + -- classes + if kwargs['float'] ~= nil and #kwargs['float'] > 0 then + float = pandoc.utils.stringify(kwargs['float']) + end + + + -- form the unsplash URL that will be used + local url = "https://source.unsplash.com/random" + if width and height then + url = url .. "/" .. tostring(width) .. '×' .. tostring(height) + end + if keywords ~= nil then + url = url .. '/?' .. keywords + end + + -- deal with the height and width + + local imgContainer = function (imgEl) + + -- HTML formats use a container to implement sizing, so + -- apply classes and so on to that container + if quarto.doc.is_format("html") then + + + quarto.doc.add_html_dependency({ + name = "unsplash-styles", + version = "1.0.0", + stylesheets = {"style.css"} + }) + + local style = "" + if height then + style = style .. 'height: ' .. height .. '; ' + end + if width then + style = style .. 'width: ' .. width .. '; ' + end + + local divAttrRaw = {} + if style ~= "" then + divAttrRaw['style'] = style + end + + local clz = pandoc.List({'unsplash-container'}) + if float then + clz:insert('float-' .. float) + end + + if classes ~= nil then + for token in string.gmatch(classes, "[^%s]+") do + clz:insert(token) + end + end + + local divAttr = pandoc.Attr("", clz, divAttrRaw) + local div = pandoc.Div(imgEl, divAttr) + + return div + + else + + -- Non-HTML formats just return the raw image with + -- any options set on that + + if height then + imgEl.attr.attributes['height'] = height + end + if width then + imgEl.attr.attributes['width'] = width + end + + if classes ~= nil then + for clz in string.gmatch(classes, "[^%s]+") do + imgEl.attr.classes:insert(clz) + end + end + + return imgEl + + end + end + + if filename ~= nil and file_exists(filename) then + return imgContainer(pandoc.Image("", filename)) + elseif filename ~= nil then + -- read the image + local _imgMt, imgContents = pandoc.mediabag.fetch(url) + write_file(filename, imgContents, "wb") + return imgContainer(pandoc.Image("", filename)) + else + -- read the image + local imgMt, imgContents = pandoc.mediabag.fetch(url) + + -- place it in media bag and link to it + if imgContents ~= nil then + local tmpFileName = pandoc.path.filename(os.tmpname()) ..'.' .. mimeImgExts[imgMt] + pandoc.mediabag.insert(tmpFileName, imgMt, imgContents) + return imgContainer(pandoc.Image("", tmpFileName)) + end + end + + + end +} + + diff --git a/tests/docs/smoke-all/lightbox/example.qmd b/tests/docs/smoke-all/lightbox/example.qmd new file mode 100644 index 00000000000..8bf4c34410c --- /dev/null +++ b/tests/docs/smoke-all/lightbox/example.qmd @@ -0,0 +1,128 @@ +--- +title: Example Lightbox Document +lightbox: auto +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'script[src$="libs/quarto-contrib/glightbox/glightbox.min.js' # make sure that lightbox is enabled + - 'a.lightbox' # make sure there is a lightbox image +--- + +## Chilmark + +Here is a simple image with a description. This also overrides the +description position and places it to the left of the image. + +![Beach in Chilmark](images/mv-0.jpg){#foobar description="Chilmark has a reputation as having some of the best beaches on Martha's Vineyard. Chilmark beaches are resident only in the summer, so be sure to have your proof of residency ready if you'd like to visit one of these special places. _credit:_ [Chilmark Beach](https://unsplash.com/photos/VBDJGOMCwps)" desc-position="left"} + +## Elsewhere + +The below demonstrates placing more than one image in a gallery. Note +the usage of the `layout-ncol` which arranges the images on the page +side by date. Adding the `group` attribute to the markdown images places +the images in a gallery grouped together based upon the group name +provided. + +::: {layout="[[1, 1], [1]]"} +![Aquinnah](images/mv-1.jpg){group="elsewhere" +description="The waves break off the coast of Aquinnah on a beautiful summer day."} + +![Oak Bluffs](images/mv-3.jpg){group="elsewhere" +description="Oak Bluffs is famous for its Gingerbread cottages, busy town center, and party like atmosphere."} + +![Vineyard lighthouse](images/mv-2.jpg){group="elsewhere" +description="The Edgartown Lighthouse is a short walk from downtown and has beautiful views over the entrance to Edgartown Harbor."} +::: + +## West Tisbury + +[![More about the ferry.](images/ferry.png)](https://www.steamshipauthority.com) + + +## With computation code chunks + +Options for lightbox can be passed using chunk options. + +```{r} +#| fig-cap: Simple demo R plot +#| lightbox: +#| group: r-graph +#| description: This is 1 to 10 plot +plot(1:10, rnorm(10)) +``` + +```{r} +#| fig-cap: Plot about cars data +#| lightbox: +#| group: r-graph +#| description: We see our cars data above +plot(cars) +``` + +It is possible to create several plots, and group them in a lightbox gallery. Use list in YAML for options when you have several plots, on per plot. +```{r} +#| fig-cap: +#| - Caption for first plot +#| - Caption for second plot +#| lightbox: +#| group: cars +#| description: +#| - This is the decription for first graph +#| - This is the decription for second graph +plot(mtcars) +plot(cars) +``` + +When `lightbox: auto` in main YAML config, you can opt-out lightbox on a plot by setting `lightbox: false` + +```{r} +#| fig-cap: mtcars +#| lightbox: false +plot(mtcars) +``` + +## Cross Referenceable Elements + +```{r} +#| label: fig-iris +#| fig-cap: This is a figure related to the iris data set which is so cool. +plot(iris) +``` + + +```{r} +#| label: fig-plots +#| fig-cap: | +#| The below demonstrates placing more than one image in a gallery. Note +#| the usage of the `layout-ncol` which arranges the images on the page +#| side by date. Adding the `group` attribute to the markdown images places +#| the images in a gallery grouped together based upon the group name +#| provided. +#| fig-subcap: +#| - "Clowning Fools Up In Here: This chart shows me clowning on fools up in this piece. It's embarrassing!" +#| - "A Graph of Cool Stuff: This chart shows some cool things, most frequently in the form of a visualization which makes a pretty strong point." +#| layout-ncol: 2 +plot(ToothGrowth) +plot(PlantGrowth) +``` + +See @fig-plots for examples. In particular, @fig-plots-2. + +## Inline Images Are Ignored + +In the case of automatic lightboxing, inline images are ignored. For example this image ![So cool](images/cool.png){width=30} will not be lightboxed since this document uses automatic lightbox mode. + +You can still explicitly call for lightboxing by using the explicit class, like ![That's a chunky!](images/chunky.jpg){.lightbox width=30} since it includes an `explicit` lightbox class. + +## Credits + +The images in this example were used under the [Unsplash +license](https://unsplash.com/license), view originals below: + +- [Chilmark Beach](https://unsplash.com/photos/VBDJGOMCwps) +- [Aquinnah](https://unsplash.com/photos/2iQnDPLIXwU) +- [Gingerbread House](https://unsplash.com/photos/HQEtvlNzUyA) +- [Edgartown Light](https://unsplash.com/photos/f59MyOfLpi8) +- [Edgartown Sailboat](https://unsplash.com/photos/IiLiz7XpQpI) \ No newline at end of file diff --git a/tests/docs/smoke-all/lightbox/images/chunky.jpg b/tests/docs/smoke-all/lightbox/images/chunky.jpg new file mode 100644 index 00000000000..5ac376160ee Binary files /dev/null and b/tests/docs/smoke-all/lightbox/images/chunky.jpg differ diff --git a/tests/docs/smoke-all/lightbox/images/cool.png b/tests/docs/smoke-all/lightbox/images/cool.png new file mode 100644 index 00000000000..d2e75c00299 Binary files /dev/null and b/tests/docs/smoke-all/lightbox/images/cool.png differ diff --git a/tests/docs/smoke-all/lightbox/images/ferry.png b/tests/docs/smoke-all/lightbox/images/ferry.png new file mode 100644 index 00000000000..850b1d8eb52 Binary files /dev/null and b/tests/docs/smoke-all/lightbox/images/ferry.png differ diff --git a/tests/docs/smoke-all/lightbox/images/mv-0.jpg b/tests/docs/smoke-all/lightbox/images/mv-0.jpg new file mode 100644 index 00000000000..17e98b0ecd1 Binary files /dev/null and b/tests/docs/smoke-all/lightbox/images/mv-0.jpg differ diff --git a/tests/docs/smoke-all/lightbox/images/mv-1.jpg b/tests/docs/smoke-all/lightbox/images/mv-1.jpg new file mode 100644 index 00000000000..00fa62fce46 Binary files /dev/null and b/tests/docs/smoke-all/lightbox/images/mv-1.jpg differ diff --git a/tests/docs/smoke-all/lightbox/images/mv-2.jpg b/tests/docs/smoke-all/lightbox/images/mv-2.jpg new file mode 100644 index 00000000000..91ec8b0d8e0 Binary files /dev/null and b/tests/docs/smoke-all/lightbox/images/mv-2.jpg differ diff --git a/tests/docs/smoke-all/lightbox/images/mv-3.jpg b/tests/docs/smoke-all/lightbox/images/mv-3.jpg new file mode 100644 index 00000000000..aab5b91a680 Binary files /dev/null and b/tests/docs/smoke-all/lightbox/images/mv-3.jpg differ diff --git a/tests/docs/smoke-all/lightbox/images/mv-4.jpg b/tests/docs/smoke-all/lightbox/images/mv-4.jpg new file mode 100644 index 00000000000..ffbc5de5cbc Binary files /dev/null and b/tests/docs/smoke-all/lightbox/images/mv-4.jpg differ diff --git a/tests/docs/smoke-all/lightbox/lightbox-explicit.qmd b/tests/docs/smoke-all/lightbox/lightbox-explicit.qmd new file mode 100644 index 00000000000..b6c04dad5f1 --- /dev/null +++ b/tests/docs/smoke-all/lightbox/lightbox-explicit.qmd @@ -0,0 +1,130 @@ +--- +title: Example Lightbox Document +format: + html: + theme: darkly +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'script[src="lightbox-explicit_files/libs/quarto-contrib/glightbox/glightbox.min.js' # make sure that lightbox is enabled + - 'a.lightbox' # make sure there is a lightbox image +--- + +## Chilmark + +Here is a simple image with a description. This also overrides the +description position and places it to the left of the image. + +![Beach in Chilmark](images/mv-0.jpg){#foobar description="Chilmark has a reputation as having some of the best beaches on Martha's Vineyard. Chilmark beaches are resident only in the summer, so be sure to have your proof of residency ready if you'd like to visit one of these special places. _credit:_ [Chilmark Beach](https://unsplash.com/photos/VBDJGOMCwps)" desc-position="left"} + +## Elsewhere + +The below demonstrates placing more than one image in a gallery. Note +the usage of the `layout-ncol` which arranges the images on the page +side by date. Adding the `group` attribute to the markdown images places +the images in a gallery grouped together based upon the group name +provided. + +::: {layout="[[1, 1], [1]]"} +![Aquinnah](images/mv-1.jpg){group="elsewhere" +description="The waves break off the coast of Aquinnah on a beautiful summer day."} + +![Oak Bluffs](images/mv-3.jpg){group="elsewhere" +description="Oak Bluffs is famous for its Gingerbread cottages, busy town center, and party like atmosphere."} + +![Vineyard lighthouse](images/mv-2.jpg){group="elsewhere" +description="The Edgartown Lighthouse is a short walk from downtown and has beautiful views over the entrance to Edgartown Harbor."} +::: + +## West Tisbury + +[![More about the ferry.](images/ferry.png)](https://www.steamshipauthority.com) + + +## With computation code chunks + +Options for lightbox can be passed using chunk options. + +```{r} +#| fig-cap: Simple demo R plot +#| lightbox: +#| group: r-graph +#| description: This is 1 to 10 plot +plot(1:10, rnorm(10)) +``` + +```{r} +#| fig-cap: Plot about cars data +#| lightbox: +#| group: r-graph +#| description: We see our cars data above +plot(cars) +``` + +It is possible to create several plots, and group them in a lightbox gallery. Use list in YAML for options when you have several plots, on per plot. +```{r} +#| fig-cap: +#| - Caption for first plot +#| - Caption for second plot +#| lightbox: +#| group: cars +#| description: +#| - This is the decription for first graph +#| - This is the decription for second graph +plot(mtcars) +plot(cars) +``` + +When `lightbox: auto` in main YAML config, you can opt-out lightbox on a plot by setting `lightbox: false` + +```{r} +#| fig-cap: mtcars +#| lightbox: false +plot(mtcars) +``` + +## Cross Referenceable Elements + +```{r} +#| label: fig-iris +#| fig-cap: This is a figure related to the iris data set which is so cool. +plot(iris) +``` + + +```{r} +#| label: fig-plots +#| fig-cap: | +#| The below demonstrates placing more than one image in a gallery. Note +#| the usage of the `layout-ncol` which arranges the images on the page +#| side by date. Adding the `group` attribute to the markdown images places +#| the images in a gallery grouped together based upon the group name +#| provided. +#| fig-subcap: +#| - "Clowning Fools Up In Here: This chart shows me clowning on fools up in this piece. It's embarrassing!" +#| - "A Graph of Cool Stuff: This chart shows some cool things, most frequently in the form of a visualization which makes a pretty strong point." +#| layout-ncol: 2 +plot(ToothGrowth) +plot(PlantGrowth) +``` + +See @fig-plots for examples. In particular, @fig-plots-2. + +## Inline Images Are Ignored + +In the case of automatic lightboxing, inline images are ignored. For example this image ![So cool](images/cool.png){width=30} will not be lightboxed since this document uses automatic lightbox mode. + +You can still explicitly call for lightboxing by using the explicit class, like ![That's a chunky!](images/chunky.jpg){.lightbox width=30} since it includes an `explicit` lightbox class. + +## Credits + +The images in this example were used under the [Unsplash +license](https://unsplash.com/license), view originals below: + +- [Chilmark Beach](https://unsplash.com/photos/VBDJGOMCwps) +- [Aquinnah](https://unsplash.com/photos/2iQnDPLIXwU) +- [Gingerbread House](https://unsplash.com/photos/HQEtvlNzUyA) +- [Edgartown Light](https://unsplash.com/photos/f59MyOfLpi8) +- [Edgartown Sailboat](https://unsplash.com/photos/IiLiz7XpQpI) \ No newline at end of file diff --git a/tests/docs/smoke-all/lightbox/lightbox-off.qmd b/tests/docs/smoke-all/lightbox/lightbox-off.qmd new file mode 100644 index 00000000000..6d73d54d87a --- /dev/null +++ b/tests/docs/smoke-all/lightbox/lightbox-off.qmd @@ -0,0 +1,129 @@ +--- +title: Example Lightbox Document +lightbox: false +_quarto: + tests: + html: + ensureHtmlElements: + - [] + - + - 'script[src="lightbox-off_files/libs/quarto-contrib/glightbox/glightbox.min.js' # make sure that lightbox is enabled + - 'a.lightbox' # make sure there is no lightbox image +--- + +## Chilmark + +Here is a simple image with a description. This also overrides the +description position and places it to the left of the image. + +![Beach in Chilmark](images/mv-0.jpg){#foobar description="Chilmark has a reputation as having some of the best beaches on Martha's Vineyard. Chilmark beaches are resident only in the summer, so be sure to have your proof of residency ready if you'd like to visit one of these special places. _credit:_ [Chilmark Beach](https://unsplash.com/photos/VBDJGOMCwps)" desc-position="left"} + +## Elsewhere + +The below demonstrates placing more than one image in a gallery. Note +the usage of the `layout-ncol` which arranges the images on the page +side by date. Adding the `group` attribute to the markdown images places +the images in a gallery grouped together based upon the group name +provided. + +::: {layout="[[1, 1], [1]]"} +![Aquinnah](images/mv-1.jpg){group="elsewhere" +description="The waves break off the coast of Aquinnah on a beautiful summer day."} + +![Oak Bluffs](images/mv-3.jpg){group="elsewhere" +description="Oak Bluffs is famous for its Gingerbread cottages, busy town center, and party like atmosphere."} + +![Vineyard lighthouse](images/mv-2.jpg){group="elsewhere" +description="The Edgartown Lighthouse is a short walk from downtown and has beautiful views over the entrance to Edgartown Harbor."} +::: + +## West Tisbury + +[![More about the ferry.](images/ferry.png)](https://www.steamshipauthority.com) + + +## With computation code chunks + +Options for lightbox can be passed using chunk options. + +```{r} +#| fig-cap: Simple demo R plot +#| lightbox: +#| group: r-graph +#| description: This is 1 to 10 plot +plot(1:10, rnorm(10)) +``` + +```{r} +#| fig-cap: Plot about cars data +#| lightbox: +#| group: r-graph +#| description: We see our cars data above +plot(cars) +``` + +It is possible to create several plots, and group them in a lightbox gallery. Use list in YAML for options when you have several plots, on per plot. +```{r} +#| fig-cap: +#| - Caption for first plot +#| - Caption for second plot +#| lightbox: +#| group: cars +#| description: +#| - This is the decription for first graph +#| - This is the decription for second graph +plot(mtcars) +plot(cars) +``` + +When `lightbox: auto` in main YAML config, you can opt-out lightbox on a plot by setting `lightbox: false` + +```{r} +#| fig-cap: mtcars +#| lightbox: false +plot(mtcars) +``` + +## Cross Referenceable Elements + +```{r} +#| label: fig-iris +#| fig-cap: This is a figure related to the iris data set which is so cool. +plot(iris) +``` + + +```{r} +#| label: fig-plots +#| fig-cap: | +#| The below demonstrates placing more than one image in a gallery. Note +#| the usage of the `layout-ncol` which arranges the images on the page +#| side by date. Adding the `group` attribute to the markdown images places +#| the images in a gallery grouped together based upon the group name +#| provided. +#| fig-subcap: +#| - "Clowning Fools Up In Here: This chart shows me clowning on fools up in this piece. It's embarrassing!" +#| - "A Graph of Cool Stuff: This chart shows some cool things, most frequently in the form of a visualization which makes a pretty strong point." +#| layout-ncol: 2 +plot(ToothGrowth) +plot(PlantGrowth) +``` + +See @fig-plots for examples. In particular, @fig-plots-2. + +## Inline Images Are Ignored + +In the case of automatic lightboxing, inline images are ignored. For example this image ![So cool](images/cool.png){width=30} will not be lightboxed since this document uses automatic lightbox mode. + +You can still explicitly call for lightboxing by using the explicit class, like ![That's a chunky!](images/chunky.jpg){.lightbox width=30} since it includes an `explicit` lightbox class. + +## Credits + +The images in this example were used under the [Unsplash +license](https://unsplash.com/license), view originals below: + +- [Chilmark Beach](https://unsplash.com/photos/VBDJGOMCwps) +- [Aquinnah](https://unsplash.com/photos/2iQnDPLIXwU) +- [Gingerbread House](https://unsplash.com/photos/HQEtvlNzUyA) +- [Edgartown Light](https://unsplash.com/photos/f59MyOfLpi8) +- [Edgartown Sailboat](https://unsplash.com/photos/IiLiz7XpQpI) \ No newline at end of file diff --git a/tests/docs/smoke-all/lightbox/options.qmd b/tests/docs/smoke-all/lightbox/options.qmd new file mode 100644 index 00000000000..62c3c030c5a --- /dev/null +++ b/tests/docs/smoke-all/lightbox/options.qmd @@ -0,0 +1,134 @@ +--- +title: Example Lightbox Document +lightbox: + match: auto + effect: fade + desc-position: top + loop: false + css-class: cool-beans +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'script[src$="libs/quarto-contrib/glightbox/glightbox.min.js' # make sure that lightbox is enabled + - 'a.lightbox' # make sure there is a lightbox image + +--- + +## Chilmark + +Here is a simple image with a description. This also overrides the +description position and places it to the left of the image. + +![Beach in Chilmark](images/mv-0.jpg){#foobar description="Chilmark has a reputation as having some of the best beaches on Martha's Vineyard. Chilmark beaches are resident only in the summer, so be sure to have your proof of residency ready if you'd like to visit one of these special places. _credit:_ [Chilmark Beach](https://unsplash.com/photos/VBDJGOMCwps)" desc-position="left"} + +## Elsewhere + +The below demonstrates placing more than one image in a gallery. Note +the usage of the `layout-ncol` which arranges the images on the page +side by date. Adding the `group` attribute to the markdown images places +the images in a gallery grouped together based upon the group name +provided. + +::: {layout="[[1, 1], [1]]"} +![Aquinnah](images/mv-1.jpg){group="elsewhere" +description="The waves break off the coast of Aquinnah on a beautiful summer day."} + +![Oak Bluffs](images/mv-3.jpg){group="elsewhere" +description="Oak Bluffs is famous for its Gingerbread cottages, busy town center, and party like atmosphere."} + +![Vineyard lighthouse](images/mv-2.jpg){group="elsewhere" +description="The Edgartown Lighthouse is a short walk from downtown and has beautiful views over the entrance to Edgartown Harbor."} +::: + +## West Tisbury + +[![More about the ferry.](images/ferry.png)](https://www.steamshipauthority.com) + + +## With computation code chunks + +Options for lightbox can be passed using chunk options. + +```{r} +#| fig-cap: Simple demo R plot +#| lightbox: +#| group: r-graph +#| description: This is 1 to 10 plot +plot(1:10, rnorm(10)) +``` + +```{r} +#| fig-cap: Plot about cars data +#| lightbox: +#| group: r-graph +#| description: We see our cars data above +plot(cars) +``` + +It is possible to create several plots, and group them in a lightbox gallery. Use list in YAML for options when you have several plots, on per plot. +```{r} +#| fig-cap: +#| - Caption for first plot +#| - Caption for second plot +#| lightbox: +#| group: cars +#| description: +#| - This is the decription for first graph +#| - This is the decription for second graph +plot(mtcars) +plot(cars) +``` + +When `lightbox: auto` in main YAML config, you can opt-out lightbox on a plot by setting `lightbox: false` + +```{r} +#| fig-cap: mtcars +#| lightbox: false +plot(mtcars) +``` + +## Cross Referenceable Elements + +```{r} +#| label: fig-iris +#| fig-cap: This is a figure related to the iris data set which is so cool. +plot(iris) +``` + + +```{r} +#| label: fig-plots +#| fig-cap: | +#| The below demonstrates placing more than one image in a gallery. Note +#| the usage of the `layout-ncol` which arranges the images on the page +#| side by date. Adding the `group` attribute to the markdown images places +#| the images in a gallery grouped together based upon the group name +#| provided. +#| fig-subcap: +#| - "Clowning Fools Up In Here: This chart shows me clowning on fools up in this piece. It's embarrassing!" +#| - "A Graph of Cool Stuff: This chart shows some cool things, most frequently in the form of a visualization which makes a pretty strong point." +#| layout-ncol: 2 +plot(ToothGrowth) +plot(PlantGrowth) +``` + +See @fig-plots for examples. In particular, @fig-plots-2. + +## Inline Images Are Ignored + +In the case of automatic lightboxing, inline images are ignored. For example this image ![So cool](images/cool.png){width=30} will not be lightboxed since this document uses automatic lightbox mode. + +You can still explicitly call for lightboxing by using the explicit class, like ![That's a chunky!](images/chunky.jpg){.lightbox width=30} since it includes an `explicit` lightbox class. + +## Credits + +The images in this example were used under the [Unsplash +license](https://unsplash.com/license), view originals below: + +- [Chilmark Beach](https://unsplash.com/photos/VBDJGOMCwps) +- [Aquinnah](https://unsplash.com/photos/2iQnDPLIXwU) +- [Gingerbread House](https://unsplash.com/photos/HQEtvlNzUyA) +- [Edgartown Light](https://unsplash.com/photos/f59MyOfLpi8) +- [Edgartown Sailboat](https://unsplash.com/photos/IiLiz7XpQpI) \ No newline at end of file diff --git a/tests/docs/smoke-all/lightbox/pandoc-figure.qmd b/tests/docs/smoke-all/lightbox/pandoc-figure.qmd new file mode 100644 index 00000000000..15823c8cebf --- /dev/null +++ b/tests/docs/smoke-all/lightbox/pandoc-figure.qmd @@ -0,0 +1,13 @@ +--- +title: Simple Lightbox Example +lightbox: true +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'script[src="pandoc-figure_files/libs/quarto-contrib/glightbox/glightbox.min.js' # make sure that lightbox is enabled + - 'a.lightbox' # make sure there is a lightbox image +--- + +![A Lovely Image](images/mv-0.jpg) diff --git a/tests/docs/smoke-all/lightbox/plot-layout.qmd b/tests/docs/smoke-all/lightbox/plot-layout.qmd new file mode 100644 index 00000000000..bd4d8902463 --- /dev/null +++ b/tests/docs/smoke-all/lightbox/plot-layout.qmd @@ -0,0 +1,39 @@ +--- +title: Example Lightbox Document +format: + html: + theme: litera +lightbox: true +echo: false +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'script[src="plot-layout_files/libs/quarto-contrib/glightbox/glightbox.min.js' # make sure that lightbox is enabled + - 'a.lightbox' # make sure there is a lightbox image + ensureFileRegexMatches: + - ['data-description="Figure 1 \(a\)', 'data-description="Figure 1 \(b\)'] # make sure the caption contains the sub figure prefix +--- + +## Sample Plot Layout + +{{< lipsum 1 >}} + +```{r} +#| label: fig-plots +#| fig-cap: | +#| The below demonstrates placing more than one image in a gallery. Note +#| the usage of the `layout-ncol` which arranges the images on the page +#| side by date. Adding the `group` attribute to the markdown images places +#| the images in a gallery grouped together based upon the group name +#| provided. +#| fig-subcap: +#| - "Clowning Fools Up In Here: This chart shows me clowning on fools up in this piece. It's embarrassing!" +#| - "A Graph of Cool Stuff: This chart shows some cool things, most frequently in the form of a visualization which makes a pretty strong point." +#| layout-ncol: 2 +plot(ToothGrowth) +plot(PlantGrowth) +``` + +See @fig-plots-1 \ No newline at end of file diff --git a/tests/docs/smoke-all/lightbox/plot.qmd b/tests/docs/smoke-all/lightbox/plot.qmd new file mode 100644 index 00000000000..503889d6803 --- /dev/null +++ b/tests/docs/smoke-all/lightbox/plot.qmd @@ -0,0 +1,32 @@ +--- +title: Example Lightbox Document +format: + html: + theme: lux +lightbox: true +echo: false +_quarto: + tests: + html: + ensureHtmlElements: + - + - 'script[src="plot_files/libs/quarto-contrib/glightbox/glightbox.min.js' # make sure that lightbox is enabled + - 'a.lightbox' # make sure there is a lightbox image + ensureFileRegexMatches: + - ['data-description="Figure 1'] # make sure the caption contains the figure prefix +--- + +## Sample Single Plot + +{{< lipsum 1 >}} + +```{r} +#| label: fig-single +#| fig-cap: | +#| What is going on? This is a single chart that shows some stuff about +#| eye color and a variety of other things that are very cool and useful +#| especially for learning things. +plot(iris) +``` + +See @fig-single. diff --git a/tests/docs/smoke-all/typst/block-divs.qmd b/tests/docs/smoke-all/typst/block-divs.qmd new file mode 100644 index 00000000000..e8b4207726b --- /dev/null +++ b/tests/docs/smoke-all/typst/block-divs.qmd @@ -0,0 +1,10 @@ +--- +title: "typst blocks" +format: typst +--- + +::: {.block fill="rgb(\"ff0000\")"} + +This is a block with red background (yuck.) + +::: \ No newline at end of file diff --git a/tests/renv.lock b/tests/renv.lock index 698b64feb9f..18eda4553ac 100644 --- a/tests/renv.lock +++ b/tests/renv.lock @@ -18,12 +18,6 @@ "Version": "1.1.3", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "DBI", - "RemoteRef": "DBI", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "1.1.3", "Requirements": [ "R", "methods" @@ -32,19 +26,20 @@ }, "DT": { "Package": "DT", - "Version": "0.28", + "Version": "0.29", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "crosstalk", "htmltools", "htmlwidgets", + "httpuv", "jquerylib", "jsonlite", "magrittr", "promises" ], - "Hash": "ab745834dfae7eaf71dd0b90f3b66759" + "Hash": "02f42b77a951a5ea7c891ef5c187d774" }, "MASS": { "Package": "MASS", @@ -63,11 +58,12 @@ }, "Matrix": { "Package": "Matrix", - "Version": "1.5-4.1", + "Version": "1.6-1.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", + "grDevices", "graphics", "grid", "lattice", @@ -75,19 +71,13 @@ "stats", "utils" ], - "Hash": "38082d362d317745fb932e13956dccbb" + "Hash": "1a00d4828f33a9d690806e98bd17150c" }, "R6": { "Package": "R6", "Version": "2.5.1", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "R6", - "RemoteRef": "R6", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "2.5.1", "Requirements": [ "R" ], @@ -98,12 +88,6 @@ "Version": "1.1-3", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "RColorBrewer", - "RemoteRef": "RColorBrewer", - "RemoteRepos": "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "1.1-3", "Requirements": [ "R" ], @@ -129,49 +113,43 @@ }, "Rcpp": { "Package": "Rcpp", - "Version": "1.0.10", + "Version": "1.0.11", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "methods", "utils" ], - "Hash": "e749cae40fa9ef469b6050959517453c" + "Hash": "ae6cbbe1492f4de79c45fce06f967ce8" }, "V8": { "Package": "V8", - "Version": "4.3.0", + "Version": "4.3.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "Rcpp", "curl", "jsonlite", "utils" ], - "Hash": "d1fa8fae6a47e88bb46d5152312bd8bd" + "Hash": "20d81ec18bde233d8cc3265761fe8c93" }, "askpass": { "Package": "askpass", - "Version": "1.1", + "Version": "1.2.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "sys" ], - "Hash": "e8a22846fff485f0be3770c2da758713" + "Hash": "cad6cf7f1d5f6e906700b9d3e718c796" }, "backports": { "Package": "backports", "Version": "1.4.1", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "backports", - "RemoteRef": "backports", - "RemoteRepos": "https://cran.rstudio.com/", - "RemotePkgPlatform": "x86_64-w64-mingw32", - "RemoteSha": "1.4.1", "Requirements": [ "R" ], @@ -182,12 +160,6 @@ "Version": "0.1-3", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "base64enc", - "RemoteRef": "base64enc", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "0.1-3", "Requirements": [ "R" ], @@ -198,12 +170,6 @@ "Version": "0.2.0", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "bigD", - "RemoteRef": "bigD", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "0.2.0", "Requirements": [ "R" ], @@ -224,12 +190,6 @@ "Version": "4.0.5", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "bit64", - "RemoteRef": "bit64", - "RemoteRepos": "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "4.0.5", "Requirements": [ "R", "bit", @@ -244,12 +204,6 @@ "Version": "1.0-7", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "bitops", - "RemoteRef": "bitops", - "RemoteRepos": "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "1.0-7", "Hash": "b7d8d8ee39869c18d8846a184dd8a1af" }, "blob": { @@ -264,11 +218,18 @@ ], "Hash": "40415719b5a479b87949f3aa0aee737c" }, + "brio": { + "Package": "brio", + "Version": "1.1.3", + "Source": "Repository", + "Repository": "RSPM", + "Hash": "976cf154dfb043c012d87cddd8bca363" + }, "broom": { "Package": "broom", - "Version": "1.0.4", + "Version": "1.0.5", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "backports", @@ -283,13 +244,13 @@ "tibble", "tidyr" ], - "Hash": "f62b2504021369a2449c54bbda362d30" + "Hash": "fd25391c3c4f6ecf0fa95f1e6d15378c" }, "bslib": { "Package": "bslib", - "Version": "0.4.2", + "Version": "0.5.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "base64enc", @@ -303,7 +264,7 @@ "rlang", "sass" ], - "Hash": "a7fbf03946ad741129dc81098722fca1" + "Hash": "283015ddfbb9d7bf15ea9f0b5698f0d9" }, "cachem": { "Package": "cachem", @@ -376,6 +337,24 @@ ], "Hash": "f20c47fd52fae58b4e377c37bb8c335b" }, + "colourpicker": { + "Package": "colourpicker", + "Version": "1.3.0", + "Source": "Repository", + "Repository": "RSPM", + "Requirements": [ + "R", + "ggplot2", + "htmltools", + "htmlwidgets", + "jsonlite", + "miniUI", + "shiny", + "shinyjs", + "utils" + ], + "Hash": "daec8f7d4ba89df06fe2c0802c3a9dac" + }, "commonmark": { "Package": "commonmark", "Version": "1.9.0", @@ -398,10 +377,13 @@ }, "cpp11": { "Package": "cpp11", - "Version": "0.4.3", + "Version": "0.4.6", "Source": "Repository", - "Repository": "CRAN", - "Hash": "ed588261931ee3be2c700d22e94a29ab" + "Repository": "RSPM", + "Requirements": [ + "R" + ], + "Hash": "707fae4bbf73697ec8d85f9d7076c061" }, "crayon": { "Package": "crayon", @@ -445,13 +427,13 @@ }, "curl": { "Package": "curl", - "Version": "5.0.0", + "Version": "5.0.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R" ], - "Hash": "e4f97056611e8e6b8b852d13b7400cf1" + "Hash": "511bacbfa153a15251166b463b4da4f9" }, "data.table": { "Package": "data.table", @@ -466,9 +448,9 @@ }, "dbplyr": { "Package": "dbplyr", - "Version": "2.3.2", + "Version": "2.3.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "DBI", "R", @@ -490,24 +472,58 @@ "vctrs", "withr" ], - "Hash": "d24305b92db333726aed162a2c23a147" + "Hash": "d6fd1b1440c1cacc6623aaa4e9fe352b" + }, + "desc": { + "Package": "desc", + "Version": "1.4.2", + "Source": "Repository", + "Repository": "RSPM", + "Requirements": [ + "R", + "R6", + "cli", + "rprojroot", + "utils" + ], + "Hash": "6b9602c7ebbe87101a9c8edb6e8b6d21" }, "digest": { "Package": "digest", - "Version": "0.6.31", + "Version": "0.6.33", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "utils" ], - "Hash": "8b708f296afd9ae69f450f9640be8990" + "Hash": "b18a9cf3c003977b0cc49d5e76ebe48d" + }, + "downlit": { + "Package": "downlit", + "Version": "0.4.3", + "Source": "Repository", + "Repository": "RSPM", + "Requirements": [ + "R", + "brio", + "desc", + "digest", + "evaluate", + "fansi", + "memoise", + "rlang", + "vctrs", + "withr", + "yaml" + ], + "Hash": "14fa1f248b60ed67e1f5418391a17b14" }, "dplyr": { "Package": "dplyr", - "Version": "1.1.2", + "Version": "1.1.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "R6", @@ -524,7 +540,7 @@ "utils", "vctrs" ], - "Hash": "dea6970ff715ca541c387de363ff405e" + "Hash": "e85ffbebaad5f70e1a2e2ef4302b4949" }, "dtplyr": { "Package": "dtplyr", @@ -550,12 +566,6 @@ "Version": "0.3.2", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "ellipsis", - "RemoteRef": "ellipsis", - "RemoteRepos": "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "0.3.2", "Requirements": [ "R", "rlang" @@ -590,12 +600,6 @@ "Version": "2.1.1", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "farver", - "RemoteRef": "farver", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "2.1.1", "Hash": "8106d78941f34855c440ddb946b8f7a5" }, "fastmap": { @@ -607,9 +611,9 @@ }, "flextable": { "Package": "flextable", - "Version": "0.9.1", + "Version": "0.9.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "data.table", "gdtools", @@ -627,7 +631,7 @@ "uuid", "xml2" ], - "Hash": "4b1608f01ef5550b07384c03e01cabbd" + "Hash": "73798b453ca1c8421a64a6ea0e045ba5" }, "fontBitstreamVera": { "Package": "fontBitstreamVera", @@ -651,15 +655,15 @@ }, "fontawesome": { "Package": "fontawesome", - "Version": "0.5.1", + "Version": "0.5.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "htmltools", "rlang" ], - "Hash": "1e22b8cabbad1eae951a75e9f8b52378" + "Hash": "c2efdd5f0bcd1ea861c2d4e2a883a67d" }, "fontquiver": { "Package": "fontquiver", @@ -691,20 +695,20 @@ }, "fs": { "Package": "fs", - "Version": "1.6.2", + "Version": "1.6.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "methods" ], - "Hash": "94af08e0aa9675a16fadbb3aaaa90d2a" + "Hash": "47b5f30c720c23999b913a1a635cf0bb" }, "gargle": { "Package": "gargle", - "Version": "1.4.0", + "Version": "1.5.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "cli", @@ -720,7 +724,7 @@ "utils", "withr" ], - "Hash": "8c72a723822dc317613da5ff8e8da6ee" + "Hash": "fc0b272e5847c58cd5da9b20eedbd026" }, "gdtools": { "Package": "gdtools", @@ -744,12 +748,6 @@ "Version": "0.1.3", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "generics", - "RemoteRef": "generics", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "0.1.3", "Requirements": [ "R", "methods" @@ -773,11 +771,32 @@ ], "Hash": "a535d76cf92645364997a8751396d63b" }, + "ggExtra": { + "Package": "ggExtra", + "Version": "0.10.1", + "Source": "Repository", + "Repository": "RSPM", + "Requirements": [ + "R", + "R6", + "colourpicker", + "ggplot2", + "grDevices", + "grid", + "gtable", + "miniUI", + "scales", + "shiny", + "shinyjs", + "utils" + ], + "Hash": "49ec8c1b50cef22596e30ace623bc116" + }, "ggplot2": { "Package": "ggplot2", - "Version": "3.4.2", + "Version": "3.4.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "MASS", "R", @@ -796,19 +815,13 @@ "vctrs", "withr" ], - "Hash": "3a147ee02e85a8941aad9909f1b43b7b" + "Hash": "85846544c596e71f8f46483ab165da33" }, "glue": { "Package": "glue", "Version": "1.6.2", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "glue", - "RemoteRef": "glue", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "1.6.2", "Requirements": [ "R", "methods" @@ -817,9 +830,9 @@ }, "googledrive": { "Package": "googledrive", - "Version": "2.1.0", + "Version": "2.1.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "cli", @@ -838,13 +851,13 @@ "vctrs", "withr" ], - "Hash": "e88ba642951bc8d1898ba0d12581850b" + "Hash": "e99641edef03e2a5e87f0a0b1fcc97f4" }, "googlesheets4": { "Package": "googlesheets4", - "Version": "1.1.0", + "Version": "1.1.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "cellranger", @@ -866,7 +879,7 @@ "vctrs", "withr" ], - "Hash": "fd7b97bd862a14297b0bb7ed28a3dada" + "Hash": "d6db1667059d027da730decdc214b959" }, "gt": { "Package": "gt", @@ -900,9 +913,9 @@ }, "gtable": { "Package": "gtable", - "Version": "0.3.3", + "Version": "0.3.4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "cli", @@ -911,13 +924,13 @@ "lifecycle", "rlang" ], - "Hash": "b44addadb528a0d227794121c00572a0" + "Hash": "b29cf3031f49b04ab9c852c912547eef" }, "haven": { "Package": "haven", - "Version": "2.5.2", + "Version": "2.5.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "cli", @@ -932,7 +945,7 @@ "tidyselect", "vctrs" ], - "Hash": "8b331e659e67d757db0fcc28e689c501" + "Hash": "9b302fe352f9cfc5dcf0a4139af3a565" }, "highr": { "Package": "highr", @@ -961,9 +974,9 @@ }, "htmltools": { "Package": "htmltools", - "Version": "0.5.5", + "Version": "0.5.6", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "base64enc", @@ -974,7 +987,7 @@ "rlang", "utils" ], - "Hash": "ba0240784ad50a62165058a27459304a" + "Hash": "a2326a66919a3311f7fbb1e3bf568283" }, "htmlwidgets": { "Package": "htmlwidgets", @@ -1015,9 +1028,9 @@ }, "httr": { "Package": "httr", - "Version": "1.4.6", + "Version": "1.4.7", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "R6", @@ -1026,7 +1039,7 @@ "mime", "openssl" ], - "Hash": "7e5e3cbd2a7bc07880c94e22348fb661" + "Hash": "ac107251d9d9fd72f0ca8049988f1d7f" }, "ids": { "Package": "ids", @@ -1055,12 +1068,6 @@ "Version": "0.1.4", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "jquerylib", - "RemoteRef": "jquerylib", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "0.1.4", "Requirements": [ "htmltools" ], @@ -1068,25 +1075,19 @@ }, "jsonlite": { "Package": "jsonlite", - "Version": "1.8.4", + "Version": "1.8.7", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "methods" ], - "Hash": "a4269a09a9b865579b2635c77e572374" + "Hash": "266a20443ca13c65688b2116d5220f76" }, "juicyjuice": { "Package": "juicyjuice", "Version": "0.1.0", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "juicyjuice", - "RemoteRef": "juicyjuice", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "0.1.0", "Requirements": [ "V8" ], @@ -1122,9 +1123,9 @@ }, "knitr": { "Package": "knitr", - "Version": "1.43", + "Version": "1.44", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "evaluate", @@ -1134,24 +1135,18 @@ "xfun", "yaml" ], - "Hash": "9775eb076713f627c07ce41d8199d8f6" + "Hash": "60885b9f746c9dfaef110d070b5f7dc0" }, "labeling": { "Package": "labeling", - "Version": "0.4.2", + "Version": "0.4.3", "Source": "Repository", - "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "labeling", - "RemoteRef": "labeling", - "RemoteRepos": "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "0.4.2", + "Repository": "RSPM", "Requirements": [ "graphics", "stats" ], - "Hash": "3d5108641f47470611a32d0bdf357a72" + "Hash": "b64ec208ac5bc1852b285f665d6368b3" }, "later": { "Package": "later", @@ -1194,12 +1189,6 @@ "Version": "1.0.3", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "lifecycle", - "RemoteRef": "lifecycle", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "1.0.3", "Requirements": [ "R", "cli", @@ -1226,12 +1215,6 @@ "Version": "2.0.3", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "magrittr", - "RemoteRef": "magrittr", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "2.0.3", "Requirements": [ "R" ], @@ -1239,28 +1222,22 @@ }, "markdown": { "Package": "markdown", - "Version": "1.7", + "Version": "1.8", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "commonmark", "utils", "xfun" ], - "Hash": "0ffaea87c070a56d140ce00b0727b278" + "Hash": "93cecf1e5f828d0fc1605a00ad48e3a2" }, "memoise": { "Package": "memoise", "Version": "2.0.1", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "memoise", - "RemoteRef": "memoise", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "2.0.1", "Requirements": [ "cachem", "rlang" @@ -1269,9 +1246,9 @@ }, "mgcv": { "Package": "mgcv", - "Version": "1.8-42", + "Version": "1.9-0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "Matrix", "R", @@ -1282,24 +1259,30 @@ "stats", "utils" ], - "Hash": "3460beba7ccc8946249ba35327ba902a" + "Hash": "086028ca0460d0c368028d3bda58f31b" }, "mime": { "Package": "mime", "Version": "0.12", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "mime", - "RemoteRef": "mime", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "0.12", "Requirements": [ "tools" ], "Hash": "18e9c28c1d3ca1560ce30658b22ce104" }, + "miniUI": { + "Package": "miniUI", + "Version": "0.1.1.1", + "Source": "Repository", + "Repository": "RSPM", + "Requirements": [ + "htmltools", + "shiny", + "utils" + ], + "Hash": "fec5f52652d60615fdb3957b3d74324a" + }, "modelr": { "Package": "modelr", "Version": "0.1.11", @@ -1323,12 +1306,6 @@ "Version": "0.5.0", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "munsell", - "RemoteRef": "munsell", - "RemoteRepos": "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "0.5.0", "Requirements": [ "colorspace", "methods" @@ -1337,9 +1314,9 @@ }, "nlme": { "Package": "nlme", - "Version": "3.1-162", + "Version": "3.1-163", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "graphics", @@ -1347,7 +1324,7 @@ "stats", "utils" ], - "Hash": "0984ce8da8da9ead8643c5cbbb60f83e" + "Hash": "8d1938040a05566f4f7a14af4feadd6b" }, "officer": { "Package": "officer", @@ -1370,13 +1347,13 @@ }, "openssl": { "Package": "openssl", - "Version": "2.0.6", + "Version": "2.1.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "askpass" ], - "Hash": "0f7cd2962e3044bb940cca4f4b5cecbe" + "Hash": "273a6bb4a9844c296a459d2176673270" }, "pillar": { "Package": "pillar", @@ -1400,12 +1377,6 @@ "Version": "2.0.3", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "pkgconfig", - "RemoteRef": "pkgconfig", - "RemoteRepos": "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "2.0.3", "Requirements": [ "utils" ], @@ -1416,12 +1387,6 @@ "Version": "0.2.0", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "plogr", - "RemoteRef": "plogr", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "0.2.0", "Hash": "09eb987710984fc2905c7129c7d85e65" }, "prettyunits": { @@ -1433,16 +1398,16 @@ }, "processx": { "Package": "processx", - "Version": "3.8.1", + "Version": "3.8.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "R6", "ps", "utils" ], - "Hash": "d75b4059d781336efba24021915902b4" + "Hash": "3efbd8ac1be0296a46c55387aeace0f3" }, "progress": { "Package": "progress", @@ -1459,24 +1424,19 @@ }, "promises": { "Package": "promises", - "Version": "1.2.0.1", + "Version": "1.2.1", "Source": "Repository", - "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "promises", - "RemoteRef": "promises", - "RemoteRepos": "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "1.2.0.1", + "Repository": "RSPM", "Requirements": [ "R6", "Rcpp", + "fastmap", "later", "magrittr", "rlang", "stats" ], - "Hash": "4ab2c43adb4d4699cf3690acd378d75d" + "Hash": "0d8a15c9d000970ada1ab21405387dee" }, "ps": { "Package": "ps", @@ -1491,9 +1451,9 @@ }, "purrr": { "Package": "purrr", - "Version": "1.0.1", + "Version": "1.0.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "cli", @@ -1502,7 +1462,7 @@ "rlang", "vctrs" ], - "Hash": "d71c815267c640f17ddbf7f16144b4bb" + "Hash": "1cba04a4e9414bdefc9dcaa99649a8dc" }, "ragg": { "Package": "ragg", @@ -1520,12 +1480,6 @@ "Version": "0.3.3", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "rappdirs", - "RemoteRef": "rappdirs", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "0.3.3", "Requirements": [ "R" ], @@ -1581,9 +1535,9 @@ }, "readxl": { "Package": "readxl", - "Version": "1.4.2", + "Version": "1.4.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "cellranger", @@ -1592,14 +1546,14 @@ "tibble", "utils" ], - "Hash": "2e6020b1399d95f947ed867045e9ca17" + "Hash": "8cf9c239b96df1bbb133b74aef77ad0a" }, "rematch": { "Package": "rematch", - "Version": "1.0.1", + "Version": "2.0.0", "Source": "Repository", - "Repository": "CRAN", - "Hash": "c66b930d20bb6d858cd18e1cebcfae5c" + "Repository": "RSPM", + "Hash": "cbff1b666c6fa6d21202f07e2318d4f1" }, "rematch2": { "Package": "rematch2", @@ -1613,13 +1567,13 @@ }, "renv": { "Package": "renv", - "Version": "0.17.3", + "Version": "1.0.3", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "utils" ], - "Hash": "4543b8cd233ae25c6aba8548be9e747e" + "Hash": "41b847654f567341725473431dd0d5ab" }, "reprex": { "Package": "reprex", @@ -1656,7 +1610,7 @@ }, "rmarkdown": { "Package": "rmarkdown", - "Version": "2.21", + "Version": "2.25", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1676,14 +1630,24 @@ "xfun", "yaml" ], - "Hash": "493df4ae51e2e984952ea4d5c75786a3" + "Hash": "d65e35823c817f09f4de424fcdfa812a" + }, + "rprojroot": { + "Package": "rprojroot", + "Version": "2.0.3", + "Source": "Repository", + "Repository": "RSPM", + "Requirements": [ + "R" + ], + "Hash": "1de7ab598047a87bba48434ba35d497d" }, "rstudioapi": { "Package": "rstudioapi", - "Version": "0.14", + "Version": "0.15.0", "Source": "Repository", - "Repository": "CRAN", - "Hash": "690bd2acc42a9166ce34845884459320" + "Repository": "RSPM", + "Hash": "5564500e25cffad9e22244ced1379887" }, "rvest": { "Package": "rvest", @@ -1707,9 +1671,9 @@ }, "sass": { "Package": "sass", - "Version": "0.4.6", + "Version": "0.4.7", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R6", "fs", @@ -1717,19 +1681,13 @@ "rappdirs", "rlang" ], - "Hash": "cc3ec7dd33982ef56570229b62d6388e" + "Hash": "6bd4d33b50ff927191ec9acbf52fd056" }, "scales": { "Package": "scales", "Version": "1.2.1", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "scales", - "RemoteRef": "scales", - "RemoteRepos": "https://packagemanager.rstudio.com/all/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "1.2.1", "Requirements": [ "R", "R6", @@ -1758,9 +1716,9 @@ }, "shiny": { "Package": "shiny", - "Version": "1.7.4", + "Version": "1.7.5", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "R6", @@ -1788,7 +1746,20 @@ "withr", "xtable" ], - "Hash": "c2eae3d8c670fa9dfa35a12066f4a1d5" + "Hash": "438b99792adbe82a8329ad8697d45afe" + }, + "shinyjs": { + "Package": "shinyjs", + "Version": "2.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "digest", + "jsonlite", + "shiny" + ], + "Hash": "802e4786b353a4bb27116957558548d5" }, "sourcetools": { "Package": "sourcetools", @@ -1983,13 +1954,13 @@ }, "tinytex": { "Package": "tinytex", - "Version": "0.45", + "Version": "0.46", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "xfun" ], - "Hash": "e4e357f28c2edff493936b6cb30c3d65" + "Hash": "0c41a73214d982f539c56a7773c7afa5" }, "triebeard": { "Package": "triebeard", @@ -2037,19 +2008,19 @@ }, "uuid": { "Package": "uuid", - "Version": "1.1-0", + "Version": "1.1-1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R" ], - "Hash": "f1cb46c157d080b729159d407be83496" + "Hash": "3d78edfb977a69fc7a0341bee25e163f" }, "vctrs": { "Package": "vctrs", - "Version": "0.6.2", + "Version": "0.6.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "cli", @@ -2057,7 +2028,7 @@ "lifecycle", "rlang" ], - "Hash": "a745bda7aff4734c17294bb41d4e4607" + "Hash": "d0ef2856b83dc33ea6e255caf6229ee2" }, "viridisLite": { "Package": "viridisLite", @@ -2097,28 +2068,22 @@ }, "webshot": { "Package": "webshot", - "Version": "0.5.4", + "Version": "0.5.5", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "callr", "jsonlite", "magrittr" ], - "Hash": "cfd9342c76693ae53108a474aafa1641" + "Hash": "16858ee1aba97f902d24049d4a44ef16" }, "withr": { "Package": "withr", "Version": "2.5.0", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "withr", - "RemoteRef": "withr", - "RemoteRepos": "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "2.5.0", "Requirements": [ "R", "grDevices", @@ -2129,37 +2094,31 @@ }, "xfun": { "Package": "xfun", - "Version": "0.39", + "Version": "0.40", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "stats", "tools" ], - "Hash": "8f56e9acb54fb525e66464d57ab58bcb" + "Hash": "be07d23211245fc7d4209f54c4e4ffc8" }, "xml2": { "Package": "xml2", - "Version": "1.3.4", + "Version": "1.3.5", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "R", "methods" ], - "Hash": "7dc765ac9b909487326a7d471fdd3821" + "Hash": "6c40e5cfcc6aefd88110666e18c31f40" }, "xtable": { "Package": "xtable", "Version": "1.8-4", "Source": "Repository", "Repository": "CRAN", - "RemoteType": "standard", - "RemotePkgRef": "xtable", - "RemoteRef": "xtable", - "RemoteRepos": "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", - "RemotePkgPlatform": "source", - "RemoteSha": "1.8-4", "Requirements": [ "R", "stats", diff --git a/tests/renv/activate.R b/tests/renv/activate.R index a8fdc3201b7..cb5401f93cb 100644 --- a/tests/renv/activate.R +++ b/tests/renv/activate.R @@ -2,11 +2,27 @@ local({ # the requested version of renv - version <- "0.17.3" + version <- "1.0.3" + attr(version, "sha") <- NULL # the project directory project <- getwd() + # use start-up diagnostics if enabled + diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE") + if (diagnostics) { + start <- Sys.time() + profile <- tempfile("renv-startup-", fileext = ".Rprof") + utils::Rprof(profile) + on.exit({ + utils::Rprof(NULL) + elapsed <- signif(difftime(Sys.time(), start, units = "auto"), digits = 2L) + writeLines(sprintf("- renv took %s to run the autoloader.", format(elapsed))) + writeLines(sprintf("- Profile: %s", profile)) + print(utils::summaryRprof(profile)) + }, add = TRUE) + } + # figure out whether the autoloader is enabled enabled <- local({ @@ -60,25 +76,75 @@ local({ # load bootstrap tools `%||%` <- function(x, y) { - if (is.environment(x) || length(x)) x else y + if (is.null(x)) y else x } - `%??%` <- function(x, y) { - if (is.null(x)) y else x + catf <- function(fmt, ..., appendLF = TRUE) { + + quiet <- getOption("renv.bootstrap.quiet", default = FALSE) + if (quiet) + return(invisible()) + + msg <- sprintf(fmt, ...) + cat(msg, file = stdout(), sep = if (appendLF) "\n" else "") + + invisible(msg) + + } + + header <- function(label, + ..., + prefix = "#", + suffix = "-", + n = min(getOption("width"), 78)) + { + label <- sprintf(label, ...) + n <- max(n - nchar(label) - nchar(prefix) - 2L, 8L) + if (n <= 0) + return(paste(prefix, label)) + + tail <- paste(rep.int(suffix, n), collapse = "") + paste0(prefix, " ", label, " ", tail) + + } + + startswith <- function(string, prefix) { + substring(string, 1, nchar(prefix)) == prefix } bootstrap <- function(version, library) { + friendly <- renv_bootstrap_version_friendly(version) + section <- header(sprintf("Bootstrapping renv %s", friendly)) + catf(section) + # attempt to download renv - tarball <- tryCatch(renv_bootstrap_download(version), error = identity) - if (inherits(tarball, "error")) - stop("failed to download renv ", version) + catf("- Downloading renv ... ", appendLF = FALSE) + withCallingHandlers( + tarball <- renv_bootstrap_download(version), + error = function(err) { + catf("FAILED") + stop("failed to download:\n", conditionMessage(err)) + } + ) + catf("OK") + on.exit(unlink(tarball), add = TRUE) # now attempt to install - status <- tryCatch(renv_bootstrap_install(version, tarball, library), error = identity) - if (inherits(status, "error")) - stop("failed to install renv ", version) + catf("- Installing renv ... ", appendLF = FALSE) + withCallingHandlers( + status <- renv_bootstrap_install(version, tarball, library), + error = function(err) { + catf("FAILED") + stop("failed to install:\n", conditionMessage(err)) + } + ) + catf("OK") + + # add empty line to break up bootstrapping from normal output + catf("") + return(invisible()) } renv_bootstrap_tests_running <- function() { @@ -108,13 +174,6 @@ local({ if (!inherits(repos, "error") && length(repos)) return(repos) - # if we're testing, re-use the test repositories - if (renv_bootstrap_tests_running()) { - repos <- getOption("renv.tests.repos") - if (!is.null(repos)) - return(repos) - } - # retrieve current repos repos <- getOption("repos") @@ -158,33 +217,34 @@ local({ renv_bootstrap_download <- function(version) { - # if the renv version number has 4 components, assume it must - # be retrieved via github - nv <- numeric_version(version) - components <- unclass(nv)[[1]] - - # if this appears to be a development version of 'renv', we'll - # try to restore from github - dev <- length(components) == 4L - - # begin collecting different methods for finding renv - methods <- c( - renv_bootstrap_download_tarball, - if (dev) - renv_bootstrap_download_github - else c( - renv_bootstrap_download_cran_latest, - renv_bootstrap_download_cran_archive + sha <- attr(version, "sha", exact = TRUE) + + methods <- if (!is.null(sha)) { + + # attempting to bootstrap a development version of renv + c( + function() renv_bootstrap_download_tarball(sha), + function() renv_bootstrap_download_github(sha) ) - ) + + } else { + + # attempting to bootstrap a release version of renv + c( + function() renv_bootstrap_download_tarball(version), + function() renv_bootstrap_download_cran_latest(version), + function() renv_bootstrap_download_cran_archive(version) + ) + + } for (method in methods) { - path <- tryCatch(method(version), error = identity) + path <- tryCatch(method(), error = identity) if (is.character(path) && file.exists(path)) return(path) } - stop("failed to download renv ", version) + stop("All download methods failed") } @@ -248,8 +308,6 @@ local({ type <- spec$type repos <- spec$repos - message("* Downloading renv ", version, " ... ", appendLF = FALSE) - baseurl <- utils::contrib.url(repos = repos, type = type) ext <- if (identical(type, "source")) ".tar.gz" @@ -266,13 +324,10 @@ local({ condition = identity ) - if (inherits(status, "condition")) { - message("FAILED") + if (inherits(status, "condition")) return(FALSE) - } # report success and return - message("OK (downloaded ", type, ")") destfile } @@ -329,8 +384,6 @@ local({ urls <- file.path(repos, "src/contrib/Archive/renv", name) destfile <- file.path(tempdir(), name) - message("* Downloading renv ", version, " ... ", appendLF = FALSE) - for (url in urls) { status <- tryCatch( @@ -338,14 +391,11 @@ local({ condition = identity ) - if (identical(status, 0L)) { - message("OK") + if (identical(status, 0L)) return(destfile) - } } - message("FAILED") return(FALSE) } @@ -368,7 +418,7 @@ local({ if (!file.exists(tarball)) { # let the user know we weren't able to honour their request - fmt <- "* RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist." + fmt <- "- RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist." msg <- sprintf(fmt, tarball) warning(msg) @@ -377,10 +427,7 @@ local({ } - fmt <- "* Bootstrapping with tarball at path '%s'." - msg <- sprintf(fmt, tarball) - message(msg) - + catf("- Using local tarball '%s'.", tarball) tarball } @@ -407,8 +454,6 @@ local({ on.exit(do.call(base::options, saved), add = TRUE) } - message("* Downloading renv ", version, " from GitHub ... ", appendLF = FALSE) - url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version) name <- sprintf("renv_%s.tar.gz", version) destfile <- file.path(tempdir(), name) @@ -418,26 +463,105 @@ local({ condition = identity ) - if (!identical(status, 0L)) { - message("FAILED") + if (!identical(status, 0L)) return(FALSE) - } - message("OK") + renv_bootstrap_download_augment(destfile) + return(destfile) } + # Add Sha to DESCRIPTION. This is stop gap until #890, after which we + # can use renv::install() to fully capture metadata. + renv_bootstrap_download_augment <- function(destfile) { + sha <- renv_bootstrap_git_extract_sha1_tar(destfile) + if (is.null(sha)) { + return() + } + + # Untar + tempdir <- tempfile("renv-github-") + on.exit(unlink(tempdir, recursive = TRUE), add = TRUE) + untar(destfile, exdir = tempdir) + pkgdir <- dir(tempdir, full.names = TRUE)[[1]] + + # Modify description + desc_path <- file.path(pkgdir, "DESCRIPTION") + desc_lines <- readLines(desc_path) + remotes_fields <- c( + "RemoteType: github", + "RemoteHost: api.github.com", + "RemoteRepo: renv", + "RemoteUsername: rstudio", + "RemotePkgRef: rstudio/renv", + paste("RemoteRef: ", sha), + paste("RemoteSha: ", sha) + ) + writeLines(c(desc_lines[desc_lines != ""], remotes_fields), con = desc_path) + + # Re-tar + local({ + old <- setwd(tempdir) + on.exit(setwd(old), add = TRUE) + + tar(destfile, compression = "gzip") + }) + invisible() + } + + # Extract the commit hash from a git archive. Git archives include the SHA1 + # hash as the comment field of the tarball pax extended header + # (see https://www.kernel.org/pub/software/scm/git/docs/git-archive.html) + # For GitHub archives this should be the first header after the default one + # (512 byte) header. + renv_bootstrap_git_extract_sha1_tar <- function(bundle) { + + # open the bundle for reading + # We use gzcon for everything because (from ?gzcon) + # > Reading from a connection which does not supply a 'gzip' magic + # > header is equivalent to reading from the original connection + conn <- gzcon(file(bundle, open = "rb", raw = TRUE)) + on.exit(close(conn)) + + # The default pax header is 512 bytes long and the first pax extended header + # with the comment should be 51 bytes long + # `52 comment=` (11 chars) + 40 byte SHA1 hash + len <- 0x200 + 0x33 + res <- rawToChar(readBin(conn, "raw", n = len)[0x201:len]) + + if (grepl("^52 comment=", res)) { + sub("52 comment=", "", res) + } else { + NULL + } + } + renv_bootstrap_install <- function(version, tarball, library) { # attempt to install it into project library - message("* Installing renv ", version, " ... ", appendLF = FALSE) dir.create(library, showWarnings = FALSE, recursive = TRUE) + output <- renv_bootstrap_install_impl(library, tarball) + + # check for successful install + status <- attr(output, "status") + if (is.null(status) || identical(status, 0L)) + return(status) + + # an error occurred; report it + header <- "installation of renv failed" + lines <- paste(rep.int("=", nchar(header)), collapse = "") + text <- paste(c(header, lines, output), collapse = "\n") + stop(text) + + } + + renv_bootstrap_install_impl <- function(library, tarball) { # invoke using system2 so we can capture and report output bin <- R.home("bin") exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R" - r <- file.path(bin, exe) + R <- file.path(bin, exe) args <- c( "--vanilla", "CMD", "INSTALL", "--no-multiarch", @@ -445,19 +569,7 @@ local({ shQuote(path.expand(tarball)) ) - output <- system2(r, args, stdout = TRUE, stderr = TRUE) - message("Done!") - - # check for successful install - status <- attr(output, "status") - if (is.numeric(status) && !identical(status, 0L)) { - header <- "Error installing renv:" - lines <- paste(rep.int("=", nchar(header)), collapse = "") - text <- c(header, lines, output) - writeLines(text, con = stderr()) - } - - status + system2(R, args, stdout = TRUE, stderr = TRUE) } @@ -667,34 +779,62 @@ local({ } - renv_bootstrap_validate_version <- function(version) { + renv_bootstrap_validate_version <- function(version, description = NULL) { - loadedversion <- utils::packageDescription("renv", fields = "Version") - if (version == loadedversion) - return(TRUE) + # resolve description file + # + # avoid passing lib.loc to `packageDescription()` below, since R will + # use the loaded version of the package by default anyhow. note that + # this function should only be called after 'renv' is loaded + # https://github.com/rstudio/renv/issues/1625 + description <- description %||% packageDescription("renv") - # assume four-component versions are from GitHub; - # three-component versions are from CRAN - components <- strsplit(loadedversion, "[.-]")[[1]] - remote <- if (length(components) == 4L) - paste("rstudio/renv", loadedversion, sep = "@") + # check whether requested version 'version' matches loaded version of renv + sha <- attr(version, "sha", exact = TRUE) + valid <- if (!is.null(sha)) + renv_bootstrap_validate_version_dev(sha, description) else - paste("renv", loadedversion, sep = "@") + renv_bootstrap_validate_version_release(version, description) + + if (valid) + return(TRUE) + + # the loaded version of renv doesn't match the requested version; + # give the user instructions on how to proceed + remote <- if (!is.null(description[["RemoteSha"]])) { + paste("rstudio/renv", description[["RemoteSha"]], sep = "@") + } else { + paste("renv", description[["Version"]], sep = "@") + } + + # display both loaded version + sha if available + friendly <- renv_bootstrap_version_friendly( + version = description[["Version"]], + sha = description[["RemoteSha"]] + ) fmt <- paste( "renv %1$s was loaded from project library, but this project is configured to use renv %2$s.", - "Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile.", - "Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.", + "- Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile.", + "- Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.", sep = "\n" ) - - msg <- sprintf(fmt, loadedversion, version, remote) - warning(msg, call. = FALSE) + catf(fmt, friendly, renv_bootstrap_version_friendly(version), remote) FALSE } + renv_bootstrap_validate_version_dev <- function(version, description) { + expected <- description[["RemoteSha"]] + is.character(expected) && startswith(expected, version) + } + + renv_bootstrap_validate_version_release <- function(version, description) { + expected <- description[["Version"]] + is.character(expected) && identical(expected, version) + } + renv_bootstrap_hash_text <- function(text) { hashfile <- tempfile("renv-hash-") @@ -718,7 +858,7 @@ local({ hooks <- getHook("renv::autoload") for (hook in hooks) if (is.function(hook)) - tryCatch(hook(), error = warning) + tryCatch(hook(), error = warnify) # load the project renv::load(project) @@ -859,6 +999,40 @@ local({ } + renv_bootstrap_version_friendly <- function(version, shafmt = NULL, sha = NULL) { + sha <- sha %||% attr(version, "sha", exact = TRUE) + parts <- c(version, sprintf(shafmt %||% " [sha: %s]", substring(sha, 1L, 7L))) + paste(parts, collapse = "") + } + + renv_bootstrap_exec <- function(project, libpath, version) { + if (!renv_bootstrap_load(project, libpath, version)) + renv_bootstrap_run(version, libpath) + } + + renv_bootstrap_run <- function(version, libpath) { + + # perform bootstrap + bootstrap(version, libpath) + + # exit early if we're just testing bootstrap + if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) + return(TRUE) + + # try again to load + if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { + return(renv::load(project = getwd())) + } + + # failed to download or load renv; warn the user + msg <- c( + "Failed to find an renv installation: the project will not be loaded.", + "Use `renv::activate()` to re-initialize the project." + ) + + warning(paste(msg, collapse = "\n"), call. = FALSE) + + } renv_json_read <- function(file = NULL, text = NULL) { @@ -998,35 +1172,9 @@ local({ # construct full libpath libpath <- file.path(root, prefix) - # attempt to load - if (renv_bootstrap_load(project, libpath, version)) - return(TRUE) - - # load failed; inform user we're about to bootstrap - prefix <- paste("# Bootstrapping renv", version) - postfix <- paste(rep.int("-", 77L - nchar(prefix)), collapse = "") - header <- paste(prefix, postfix) - message(header) - - # perform bootstrap - bootstrap(version, libpath) - - # exit early if we're just testing bootstrap - if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) - return(TRUE) - - # try again to load - if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { - message("* Successfully installed and loaded renv ", version, ".") - return(renv::load()) - } - - # failed to download or load renv; warn the user - msg <- c( - "Failed to find an renv installation: the project will not be loaded.", - "Use `renv::activate()` to re-initialize the project." - ) + # run bootstrap code + renv_bootstrap_exec(project, libpath, version) - warning(paste(msg, collapse = "\n"), call. = FALSE) + invisible() }) diff --git a/tests/renv/settings.dcf b/tests/renv/settings.dcf deleted file mode 100644 index 169d82f1bc9..00000000000 --- a/tests/renv/settings.dcf +++ /dev/null @@ -1,10 +0,0 @@ -bioconductor.version: -external.libraries: -ignored.packages: -package.dependency.fields: Imports, Depends, LinkingTo -r.version: -snapshot.type: implicit -use.cache: TRUE -vcs.ignore.cellar: TRUE -vcs.ignore.library: TRUE -vcs.ignore.local: TRUE diff --git a/tests/renv/settings.json b/tests/renv/settings.json index 3331ef25350..a0903c66038 100644 --- a/tests/renv/settings.json +++ b/tests/renv/settings.json @@ -1,5 +1,5 @@ { - "bioconductor.version": [], + "bioconductor.version": null, "external.libraries": [], "ignored.packages": [], "package.dependency.fields": [ @@ -7,8 +7,13 @@ "Depends", "LinkingTo" ], - "r.version": [], - "snapshot.type": "implicit", + "ppm.enabled": true, + "ppm.ignored.urls": [ + "https://yihui.r-universe.dev", + "https://rstudio.r-universe.dev" + ], + "r.version": "4.2.2", + "snapshot.type": "explicit", "use.cache": true, "vcs.ignore.cellar": true, "vcs.ignore.library": true, diff --git a/tests/run-tests-with-luacov.sh b/tests/run-tests-with-luacov.sh new file mode 100755 index 00000000000..6bab972a5df --- /dev/null +++ b/tests/run-tests-with-luacov.sh @@ -0,0 +1,12 @@ +#/bin/bash + +# We should do this for windows too + +export QUARTO_LUACOV=`pwd`/luacov.stats.out +rm -f luacov.stats.out # to get a fresh report; otherwise it appends +./run-tests.sh +cp luacov.stats.out ${QUARTO_LUACOV}-original +quarto run docs/luacov/fixup_coverage.ts ${QUARTO_LUACOV} > ${QUARTO_LUACOV}-fixed # required to resolve paths +mv ${QUARTO_LUACOV}-fixed ${QUARTO_LUACOV} +unset QUARTO_LUACOV +quarto render docs/luacov/report.qmd # generates the actual report file docs/luacov/luacov.report.html diff --git a/tests/run-tests.ps1 b/tests/run-tests.ps1 index 3c1c2795925..9d977b89f2c 100644 --- a/tests/run-tests.ps1 +++ b/tests/run-tests.ps1 @@ -26,7 +26,7 @@ $QUARTO_SRC_DIR= Join-Path $QUARTO_ROOT "src" # e.g quarto-cli/package/dist/bin $QUARTO_BIN_PATH = Join-Path $QUARTO_ROOT "package" "dist" "bin" # Deno binary in tools/ -$QUARTO_DENO = Join-Path $QUARTO_BIN_PATH "tools" "deno.exe" +$QUARTO_DENO = Join-Path $QUARTO_BIN_PATH "tools" "x86_64" "deno.exe" # Shared resource folder # e.g quarto-cli/src/resources @@ -137,12 +137,14 @@ $DENO_ARGS += -split $QUARTO_IMPORT_ARGMAP $DENO_ARGS += $TESTS_TO_RUN # Activate python virtualenv -# set QUARTO_TESTS_FORCE_NO_PIPENV env var to not activate the virtalenv manage by pipenv for the project +# set QUARTO_TESTS_FORCE_NO_PIPENV env var to not activate the virtualenv managed by pipenv for the project If ($null -eq $Env:QUARTO_TESTS_FORCE_NO_PIPENV) { # Save possible activated virtualenv for later restauration $OLD_VIRTUAL_ENV=$VIRTUAL_ENV Write-Host "> Activating virtualenv for Python tests in Quarto" . "$(pipenv --venv)/Scripts/activate.ps1" + Write-Host "> Using Python from " -NoNewline; Write-Host "$((gcm python).Source)" -ForegroundColor Blue; + Write-Host "> VIRTUAL_ENV: " -NoNewline; Write-Host "$($env:VIRTUAL_ENV)" -ForegroundColor Blue; $quarto_venv_activated = $true } @@ -159,11 +161,15 @@ $DENO_EXIT_CODE = $LASTEXITCODE If($quarto_venv_activated) { Write-Host "> Exiting virtualenv activated for tests" deactivate + Write-Host "> Using Python from " -NoNewline; Write-Host "$((gcm python).Source)" -ForegroundColor Blue; + Write-Host "> VIRTUAL_ENV: " -NoNewline; Write-Host "$($env:VIRTUAL_ENV)" -ForegroundColor Blue; Remove-Variable quarto_venv_activated } If($null -ne $OLD_VIRTUAL_ENV) { Write-Host "> Reactivating original virtualenv" . "$OLD_VIRTUAL_ENV/Scripts/activate.ps1" + Write-Host "> New Python from " -NoNewline; Write-Host "$((gcm python).Source)" -ForegroundColor Blue; + Write-Host "> VIRTUAL_ENV: " -NoNewline; Write-Host "$($env:VIRTUAL_ENV)" -ForegroundColor Blue; Remove-Variable OLD_VIRTUAL_ENV } diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 088728006dd..f64ddbee7e5 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -33,13 +33,15 @@ then fi # Activating python virtualenv -# set QUARTO_TESTS_FORCE_NO_PIPENV env var to not activate the virtalenv manage by pipenv for the project +# set QUARTO_TESTS_FORCE_NO_PIPENV env var to not activate the virtualenv managed by pipenv for the project if [[ -z $QUARTO_TESTS_FORCE_NO_PIPENV ]] then # Save possible activated virtualenv for later restauration OLD_VIRTUAL_ENV=$VIRTUAL_ENV echo "> Activating virtualenv for Python tests in Quarto" source "$(pipenv --venv)/bin/activate" + echo "> Using Python from $(which python)" + echo "> VIRTUAL_ENV: ${VIRTUAL_ENV}" quarto_venv_activated="true" fi @@ -118,12 +120,16 @@ if [[ $quarto_venv_activated == "true" ]] then echo "> Exiting virtualenv activated for tests" deactivate + echo "> Using Python from $(which python)" + echo "> VIRTUAL_ENV: ${VIRTUAL_ENV}" unset quarto_venv_activated fi if [[ -n $OLD_VIRTUAL_ENV ]] then echo "> Reactivating original virtualenv" source $OLD_VIRTUAL_ENV/bin/activate + echo "> Using Python from $(which python)" + echo "> VIRTUAL_ENV: ${VIRTUAL_ENV}" unset OLD_VIRTUAL_ENV fi diff --git a/tests/smoke/crossref/chapters.test.ts b/tests/smoke/crossref/chapters.test.ts index 1068bd2a848..49335a78102 100644 --- a/tests/smoke/crossref/chapters.test.ts +++ b/tests/smoke/crossref/chapters.test.ts @@ -1,9 +1,8 @@ /* -* chapters.test.ts -* -* Copyright (C) 2020-2022 Posit Software, PBC -* -*/ + * chapters.test.ts + * + * Copyright (C) 2020-2022 Posit Software, PBC + */ import { ensureFileRegexMatches, ensureHtmlElements } from "../../verify.ts"; import { testRender } from "../render/render.ts"; @@ -12,7 +11,7 @@ import { crossref } from "./utils.ts"; const chaptersQmd = crossref("chapters.qmd", "html"); testRender(chaptersQmd.input, "html", false, [ ensureHtmlElements(chaptersQmd.output.outputPath, [ - "div#fig-elephant > figure > figcaption.figure-caption", + "div#fig-elephant > figure > figcaption.figure.quarto-float-caption", ]), ensureFileRegexMatches(chaptersQmd.output.outputPath, [ /Figure 1.1/, diff --git a/tests/smoke/crossref/figures.test.ts b/tests/smoke/crossref/figures.test.ts index 7e1f46ae3c7..5f2c3fbe4c3 100644 --- a/tests/smoke/crossref/figures.test.ts +++ b/tests/smoke/crossref/figures.test.ts @@ -1,9 +1,8 @@ /* -* figures.test.ts -* -* Copyright (C) 2020-2022 Posit Software, PBC -* -*/ + * figures.test.ts + * + * Copyright (C) 2020-2022 Posit Software, PBC + */ import { ensureFileRegexMatches, ensureHtmlElements } from "../../verify.ts"; import { testRender } from "../render/render.ts"; @@ -13,10 +12,10 @@ const simpleQmd = crossref("simple.qmd", "html"); testRender(simpleQmd.input, "html", false, [ ensureHtmlElements(simpleQmd.output.outputPath, [ "section#simple-figure > h2", - "div#fig-elephant > figure > figcaption.figure-caption", + "div#fig-elephant > figure > figcaption.figure.quarto-float-caption", "section#simple-sub-figure > h2", - "section#simple-sub-figure > div.quarto-layout-panel > figure > div.quarto-layout-row", - "section#simple-sub-figure > div.quarto-layout-panel > figure > figcaption.figure-caption", + "section#simple-sub-figure > div.quarto-layout-panel > figure div.quarto-layout-row", + "section#simple-sub-figure > div.quarto-layout-panel > figure > figcaption.figure.quarto-float-caption", ]), ensureFileRegexMatches(simpleQmd.output.outputPath, [ /Figure 1: Elephant/, @@ -48,8 +47,8 @@ testRender(pythonQmd.input, "html", false, [ const pythonSubfigQmd = crossref("python-subfig.qmd", "html"); testRender(pythonSubfigQmd.input, "html", false, [ ensureHtmlElements(pythonSubfigQmd.output.outputPath, [ - "section#python-crossref-figure div.quarto-layout-panel > figure > div.quarto-layout-row", - "section#python-crossref-figure div.quarto-layout-panel > figure > figcaption.figure-caption", + "section#python-crossref-figure div.quarto-layout-panel > figure div.quarto-layout-row", + "section#python-crossref-figure div.quarto-layout-panel > figure > figcaption.figure.quarto-float-caption", "section#python-crossref-figure div.quarto-layout-panel > figure img.figure-img", ]), ensureFileRegexMatches(pythonSubfigQmd.output.outputPath, [ @@ -80,8 +79,8 @@ testRender(juliaQmd.input, "html", false, [ const juliaSubfigQmd = crossref("julia-subfig.qmd", "html"); testRender(juliaSubfigQmd.input, "html", false, [ ensureHtmlElements(juliaSubfigQmd.output.outputPath, [ - "section#julia-crossref-figure div.quarto-layout-panel > figure > div.quarto-layout-row", - "section#julia-crossref-figure div.quarto-layout-panel > figure > figcaption.figure-caption", + "section#julia-crossref-figure div.quarto-layout-panel > figure div.quarto-layout-row", + "section#julia-crossref-figure div.quarto-layout-panel > figure > figcaption.figure.quarto-float-caption", ]), ensureFileRegexMatches(juliaSubfigQmd.output.outputPath, [ /Figure 1: Plots/, diff --git a/tests/smoke/crossref/latex.test.ts b/tests/smoke/crossref/latex.test.ts index 77d3df41f96..4f9c23be5c6 100644 --- a/tests/smoke/crossref/latex.test.ts +++ b/tests/smoke/crossref/latex.test.ts @@ -1,9 +1,8 @@ /* -* latex.test.ts -* -* Copyright (C) 2020-2022 Posit Software, PBC -* -*/ + * latex.test.ts + * + * Copyright (C) 2020-2022 Posit Software, PBC + */ import { ensureFileRegexMatches } from "../../verify.ts"; import { testRender } from "../render/render.ts"; @@ -22,7 +21,7 @@ const subFigRegexes = [ ]; const simpleTableRegexes = [ - /\\begin{longtable}[^]*?\\caption{\\label{tbl-letters}[^]*?\\end{longtable}/, + /\\begin{longtable}[^]*?\\caption{.*}\\label{tbl-letters}[^]*?\\end{longtable}/, /Table~\\ref{tbl-letters}/, ]; const subTableRegexes = [ diff --git a/tests/smoke/crossref/syntax.test.ts b/tests/smoke/crossref/syntax.test.ts index b94fd6300aa..e070ad7f680 100644 --- a/tests/smoke/crossref/syntax.test.ts +++ b/tests/smoke/crossref/syntax.test.ts @@ -1,9 +1,8 @@ /* -* syntax.test.ts -* -* Copyright (C) 2020-2022 Posit Software, PBC -* -*/ + * syntax.test.ts + * + * Copyright (C) 2020-2022 Posit Software, PBC + */ import { ensureFileRegexMatches } from "../../verify.ts"; import { testRender } from "../render/render.ts"; @@ -67,7 +66,7 @@ const context: TestContext = { return Promise.resolve(); }, }; -const testDesc: TestDescriptor = { +const testDesc: TestDescriptor = { // FIXME: why is this test flaky now? Ask @dragonstyle name: "test html produced by different figure syntax", context, execute: async () => { diff --git a/tests/smoke/crossref/tables.test.ts b/tests/smoke/crossref/tables.test.ts index 30432dd5c80..26d6423e72a 100644 --- a/tests/smoke/crossref/tables.test.ts +++ b/tests/smoke/crossref/tables.test.ts @@ -1,9 +1,8 @@ /* -* tables.test.ts -* -* Copyright (C) 2020-2022 Posit Software, PBC -* -*/ + * tables.test.ts + * + * Copyright (C) 2020-2022 Posit Software, PBC + */ import { ensureFileRegexMatches, ensureHtmlElements } from "../../verify.ts"; import { renderVerifyLatexOutput, testRender } from "../render/render.ts"; @@ -15,9 +14,16 @@ import { docs } from "../../utils.ts"; const tablesQmd = crossref("tables.qmd", "html"); testRender(tablesQmd.input, "html", false, [ ensureHtmlElements(tablesQmd.output.outputPath, [ - "section#simple-crossref-table > div#tbl-letters > table > caption", - "section#sub-tables div.quarto-layout-panel > div.quarto-layout-row > div#tbl-first > table > caption", - "section#sub-tables div.quarto-layout-panel > div.quarto-layout-row > div#tbl-second > table > caption", + // tables in figure elements + "section#simple-crossref-table > div#tbl-letters > figure table", + "section#sub-tables div.quarto-layout-panel > figure div.quarto-layout-row div#tbl-first > figure table", + "section#sub-tables div.quarto-layout-panel > figure div.quarto-layout-row div#tbl-second > figure table", + + // table captions in figure elements (with and without subfloats) + "section#simple-crossref-table > div#tbl-letters > figure.quarto-float-tbl > figcaption.table.quarto-float-caption", + "section#sub-tables div#tbl-panel.quarto-layout-panel > figure.quarto-float-tbl > figcaption.table.quarto-float-caption", + "section#sub-tables div.quarto-layout-panel div.quarto-layout-row div#tbl-first > figure.quarto-subfloat-tbl > figcaption.table.quarto-subfloat-caption", + "section#sub-tables div.quarto-layout-panel div.quarto-layout-row div#tbl-second > figure.quarto-subfloat-tbl > figcaption.table.quarto-subfloat-caption", ]), ensureFileRegexMatches(tablesQmd.output.outputPath, [ /Table 1: My Caption/, @@ -35,8 +41,8 @@ testRender(tablesQmd.input, "html", false, [ const knitrTablesQmd = crossref("knitr-tables.qmd", "html"); testRender(knitrTablesQmd.input, "html", false, [ ensureHtmlElements(knitrTablesQmd.output.outputPath, [ - "div.quarto-layout-panel > div.quarto-layout-row > div#tbl-cars > table > caption", - "div.quarto-layout-panel > div.quarto-layout-row > div#tbl-pressure > table > caption", + "div.quarto-layout-panel div.quarto-layout-row div#tbl-cars > figure.quarto-subfloat-tbl >figcaption.table.quarto-subfloat-caption", + "div.quarto-layout-panel div.quarto-layout-row div#tbl-pressure > figure.quarto-subfloat-tbl > figcaption.table.quarto-subfloat-caption", ]), ensureFileRegexMatches(knitrTablesQmd.output.outputPath, [ /Table 1: Tables/, @@ -52,9 +58,8 @@ testRender(knitrTablesQmd.input, "html", false, [ /* caption is inserted in the right place in table environment*/ renderVerifyLatexOutput(docs("crossrefs/knitr-tables-latex.qmd"), [ - /\\begin{longtable}\[.*\]{.*}.*\n\\caption{\\label{tbl-1}.*}\\tabularnewline/, - /\\begin{table}\n\\caption{\\label{tbl-2}.*}.*\n+\\centering\n\\begin{tabular}{.*}/, - /\\begin{longtable}{.*}.*\n\\caption{\\label{tbl-3}.*}\\tabularnewline/, - /\\begin{table}\n\\caption{\\label{tbl-4}.*}.*\n+\\centering\n\\begin{tabular}\[c\]{.*}/, - /\\begin{table}\n\\caption{\\label{tbl-4}.*}.*\n+\\centering\n\\begin{tabular}\[c\]{.*}/, + /\\begin{table}.*\\caption{\\label{tbl-1}.*}.*\\begin{longtable}\[.*\]{.*}.*\\end{longtable}/s, + /\\begin{table}.*\\caption{\\label{tbl-2}.*}.*\\centering.*\\begin{tabular}{.*}/s, + /\\begin{table}.*\\caption{\\label{tbl-3}.*}.*\\centering.*\\begin{longtable\*}{.*}/s, + /\\begin{table}.*\\caption{\\label{tbl-4}.*}.*\\centering\n\\begin{tabular}\[c\]{.*}/s, ]); diff --git a/tests/smoke/extensions/extension-render-journals.test.ts b/tests/smoke/extensions/extension-render-journals.test.ts index fe7096649a2..e4bc240a005 100644 --- a/tests/smoke/extensions/extension-render-journals.test.ts +++ b/tests/smoke/extensions/extension-render-journals.test.ts @@ -1,9 +1,8 @@ /* -* extension-render-journals.test.ts -* -* Copyright (C) 2020 by RStudio, PBC -* -*/ + * extension-render-journals.test.ts + * + * Copyright (C) 2020 by RStudio, PBC + */ import { join } from "path/mod.ts"; import { quarto } from "../../../src/quarto.ts"; @@ -12,7 +11,7 @@ import { testRender } from "../render/render.ts"; import { removeIfEmptyDir } from "../../../src/core/path.ts"; const journalRepos = [ - { repo: "acm", noSupporting: true }, + // { repo: "acm", noSupporting: true }, TODO this format needs changes after this merge. { repo: "acs", noSupporting: true }, { repo: "agu", noSupporting: true }, { repo: "biophysical-journal", format: "bj", noSupporting: true }, diff --git a/tests/smoke/jats/render-jats-metadata.ts b/tests/smoke/jats/render-jats-metadata.ts new file mode 100644 index 00000000000..948f6d5bc6c --- /dev/null +++ b/tests/smoke/jats/render-jats-metadata.ts @@ -0,0 +1,27 @@ +/* +* render-jats.test.ts +* +* Copyright (C) 2020-2022 Posit Software, PBC +* +*/ + +import { extname, join } from "path/mod.ts"; +import { docs, outputForInput } from "../../utils.ts"; +import { + ensureXmlValidatesWithXsd, +} from "../../verify.ts"; +import { testRender } from "../render/render.ts"; + +const xsdPath = docs(join("jats", "xsd", "JATS-Archiving-1-2-MathML2-DTD")); + +// Test all the documents in this folder +const testDir = docs(join("author-normalization", "funding")); + +for (const entry of Deno.readDirSync(testDir)) { + if (entry.isFile && extname(entry.name) === ".qmd") { + const input = join(testDir, entry.name); + const output = outputForInput(input, "jats"); + testRender(input, "jats", true, [ensureXmlValidatesWithXsd(output.outputPath, xsdPath)]); + } +} + diff --git a/tests/smoke/jats/render-manuscript.test.ts b/tests/smoke/jats/render-manuscript.test.ts index 595b94e876c..351099f4b5c 100644 --- a/tests/smoke/jats/render-manuscript.test.ts +++ b/tests/smoke/jats/render-manuscript.test.ts @@ -5,11 +5,10 @@ * */ -import { join } from "path/mod.ts"; +import { dirname, join } from "path/mod.ts"; import { docs, outputForInput } from "../../utils.ts"; import { ensureMECAValidates, ensureXmlValidatesWithXsd } from "../../verify.ts"; import { testRender } from "../render/render.ts"; -import { dirname } from "../../../src/vendor/deno.land/std@0.185.0/path/win32.ts"; const xsdPath = docs(join("jats", "xsd", "JATS-Archiving-1-2-MathML2-DTD")); const projectOutDir = "_manuscript"; diff --git a/tests/smoke/render/render-callout.test.ts b/tests/smoke/render/render-callout.test.ts index 1cef145abc3..124234e098f 100644 --- a/tests/smoke/render/render-callout.test.ts +++ b/tests/smoke/render/render-callout.test.ts @@ -29,6 +29,47 @@ testRender(input, "html", false, [ // formatting is kept in caption "div.callout-tip > div.callout-header > div.callout-title-container > strong", "div.callout-tip > div.callout-header > div.callout-title-container > code", + // appearance correctly modify structure + "#appearance div.callout-style-simple > div.callout-body > div.callout-icon-container + div.callout-body-container", + "#appearance div.callout-style-default.callout-titled > div.callout-header > div.callout-icon-container + div.callout-title-container", + "#appearance div.callout-style-default.callout-titled > div.callout-header + div.callout-body-container", + "#appearance div.callout-style-default.no-icon.callout-titled > div.callout-header > div.callout-icon-container > i.no-icon", + "#appearance div.callout-style-default.no-icon.callout-titled > div.callout-header > div.callout-icon-container + div.callout-title-container", + "#appearance div.callout-style-simple.no-icon > div.callout-body", + "#minimal div.callout-style-simple.no-icon > div.callout-body", + ], + [ + "#appearance div.callout-style-simple.no-icon > div.callout-header", + "#minimal div.callout-style-simple.no-icon > div.callout-header" + ]), +]); + +testRender(input, "revealjs", false, [ + ensureHtmlElements(htmlOutput.outputPath, [ + // callout environments are created + "div.callout-warning", + "div.callout-important", + "div.callout-note", + "div.callout-tip", + "div.callout-caution", + "div.callout.no-icon", + // formatting is kept in caption + "#markup div.callout-tip > div.callout-body > div.callout-title strong > code", + "#markup div.callout-caution > div.callout-body > div.callout-content code", + "#markup div.callout-none.no-icon.callout-titled.callout-style-simple > div.callout-body > div.callout-content code", + // appearance correctly modify structure + "#overview div.callout-style-default.callout-titled > div.callout-body > div.callout-title > div.callout-icon-container + p > strong", // default: title and icon correctly set + "#overview div.callout-style-default.callout-titled > div.callout-body > div.callout-title + div.callout-content", // default: title and content correctly set + "#appearance div.callout-style-simple > div.callout-body > div.callout-icon-container + div.callout-content", // simple: icon and content correctly set + "#appearance div.callout-style-default.callout-titled > div.callout-body > div.callout-title + div.callout-content", // default: title and content correctly set + "#appearance div.callout-style-default.no-icon.callout-titled > div.callout-body > div.callout-title + div.callout-content", // default no icon: title and content correctly set + "#appearance div.callout-style-simple.no-icon > div.callout-body", // simple no icon: content correctly set + "#minimal div.callout-style-simple.no-icon > div.callout-body > div.callout-content", // minimal + ], + [ + "#appearance div.callout-style-default.no-icon.callout-titled > div.callout-body > div.callout-title > div.callout-icon-container", // default no icon: title and content correctly set + "#appearance div.callout-style-simple.no-icon > div.callout-body > div.callout-icon-container", // simple no icon + "#minimal div.callout-style-simple.no-icon > div.callout-body > div.callout-icon-container" ]), ]); diff --git a/tests/smoke/render/render-format-extension.test.ts b/tests/smoke/render/render-format-extension.test.ts index 9031adedb8a..bcfcb09d23c 100644 --- a/tests/smoke/render/render-format-extension.test.ts +++ b/tests/smoke/render/render-format-extension.test.ts @@ -1,9 +1,10 @@ /* -* render-format-extension.test.ts -* -* Copyright (C) 2020-2022 Posit Software, PBC -* -*/ + * render-format-extension.test.ts + * + * Copyright (C) 2020-2022 Posit Software, PBC + */ + +// TODO re-enable the ACM tests once the template has been updated import { docs } from "../../utils.ts"; @@ -11,7 +12,7 @@ import { testRender } from "./render.ts"; // Some HTML tests testRender(docs("extensions/format/academic/document.qmd"), "html", false); -testRender(docs("extensions/format/academic/document.qmd"), "acm-html", false); +// testRender(docs("extensions/format/academic/document.qmd"), "acm-html", false); testRender(docs("extensions/format/academic/document.qmd"), "acs-html", false); testRender( docs("extensions/format/academic/document.qmd"), @@ -21,20 +22,20 @@ testRender( // some PDF tests testRender(docs("extensions/format/academic/document.qmd"), "pdf", true); -testRender( - docs("extensions/format/academic/document.qmd"), - "acm-pdf", - true, - [], - { - teardown: async () => { - await Deno.remove(docs("extensions/format/academic/sensys-abstract.cls")); - await Deno.remove( - docs("extensions/format/academic/acm_proc_article-sp.cls"), - ); - }, - }, -); +// testRender( +// docs("extensions/format/academic/document.qmd"), +// "acm-pdf", +// true, +// [], +// { +// teardown: async () => { +// await Deno.remove(docs("extensions/format/academic/sensys-abstract.cls")); +// await Deno.remove( +// docs("extensions/format/academic/acm_proc_article-sp.cls"), +// ); +// }, +// }, +// ); testRender( docs("extensions/format/academic/document.qmd"), "acs-pdf", diff --git a/tests/smoke/render/render-latex-output.test.ts b/tests/smoke/render/render-latex-output.test.ts index 05fee8ae83c..de438159a80 100644 --- a/tests/smoke/render/render-latex-output.test.ts +++ b/tests/smoke/render/render-latex-output.test.ts @@ -1,9 +1,8 @@ /* -* render.latex-output.test.ts -* -* Copyright (C) 2020-2022 Posit Software, PBC -* -*/ + * render.latex-output.test.ts + * + * Copyright (C) 2020-2022 Posit Software, PBC + */ import { docs } from "../../utils.ts"; import { renderVerifyLatexOutput } from "./render.ts"; @@ -12,11 +11,15 @@ renderVerifyLatexOutput(docs("latex-output/captionless-margin-image.qmd"), [ /\\begin{marginfigure}/, ]); renderVerifyLatexOutput(docs("latex-output/figure-div.qmd"), [ - /{\\centering/, + /\\centering{/, /\\caption{\\label{fig-foo}This is the figure}/, /See Figure~\\ref{fig-foo} for more\./, ]); +// FIXME before merging: +// +// I don't understand how this test works even in 1.3 +// // All captions should be placed at the bottom // Note that the 'D' or '\\' are present after the caption command because one of the // test tables purposely msisses the caption handling to be sure that we don't diff --git a/tests/smoke/render/render-reveal.test.ts b/tests/smoke/render/render-reveal.test.ts index 3c45e349a47..134ab0f88e1 100644 --- a/tests/smoke/render/render-reveal.test.ts +++ b/tests/smoke/render/render-reveal.test.ts @@ -1,13 +1,12 @@ /* -* render-reveal.test.ts -* -* Copyright (C) 2020-2022 Posit Software, PBC -* -*/ + * render-reveal.test.ts + * + * Copyright (C) 2020-2022 Posit Software, PBC + */ import { docs, fileLoader, outputForInput } from "../../utils.ts"; import { -ensureFileRegexMatches, + ensureFileRegexMatches, ensureHtmlElements, ensureHtmlSelectorSatisfies, } from "../../verify.ts"; @@ -41,7 +40,7 @@ testRender(input, "revealjs", false, [ "#chunk-below > p + img.r-stretch + p.caption + div.cell", "#no-caption > p + img.r-stretch", "#height-defined img:not(.r-stretch)", - "#rigth-aligned > p + img.r-stretch.quarto-figure-right", + "#rigth-aligned > img.r-stretch.quarto-figure-right", "#only-image > img.r-stretch + p.caption", "#alt-text > img.r-stretch[alt]", "#caption-title > img.r-stretch[title] + p.caption", @@ -117,9 +116,9 @@ testRender(revealConfigs.input, "revealjs", false, [ "pdfSeparateFragments.*true", "smaller.*true", "pdfSeparateFragments.*true", - "autoAnimateEasing.*\"ease-in-out\"", + 'autoAnimateEasing.*"ease-in-out"', "autoAnimateDuration.*5", "autoAnimateUnmatched.*false", "pdfMaxPagesPerSlide.*1", - ], []) + ], []), ]); diff --git a/tests/smoke/smoke-all.test.ts b/tests/smoke/smoke-all.test.ts index a2be7ecd1bc..5a89ded24e5 100644 --- a/tests/smoke/smoke-all.test.ts +++ b/tests/smoke/smoke-all.test.ts @@ -2,7 +2,6 @@ * smoke-all.test.ts * * Copyright (C) 2022 Posit Software, PBC - * */ import { expandGlobSync } from "../../src/core/deno/expand-glob.ts"; @@ -18,9 +17,13 @@ import { parse } from "yaml/mod.ts"; import { cleanoutput } from "./render/render.ts"; import { ensureDocxRegexMatches, + ensureDocxXpath, ensureFileRegexMatches, ensureHtmlElements, + ensureJatsXpath, + ensureOdtXpath, ensurePptxRegexMatches, + ensureTypstFileRegexMatches, fileExists, noErrors, noErrorsOrWarnings, @@ -29,7 +32,7 @@ import { readYaml, readYamlFromMarkdown } from "../../src/core/yaml.ts"; import { outputForInput } from "../utils.ts"; import { jupyterNotebookToMarkdown } from "../../src/command/convert/jupyter.ts"; import { dirname, join, relative } from "path/mod.ts"; -import { existsSync } from "fs/mod.ts"; +import { existsSync, WalkEntry } from "fs/mod.ts"; import { kOutputExt } from "../../src/config/constants.ts"; async function fullInit() { @@ -88,7 +91,11 @@ function resolveTestSpecs( const verifyMap: Record = { ensureHtmlElements, ensureFileRegexMatches, + ensureTypstFileRegexMatches, ensureDocxRegexMatches, + ensureDocxXpath, + ensureOdtXpath, + ensureJatsXpath, ensurePptxRegexMatches, }; @@ -106,7 +113,7 @@ function resolveTestSpecs( } else { // See if there is a project and grab it's type const projectOutDir = findProjectOutputDir(input); - const ext = metadata?.[kOutputExt] + const ext = metadata?.[kOutputExt]; const outputFile = outputForInput(input, format, projectOutDir, ext); if (key === "fileExists") { for ( @@ -142,17 +149,29 @@ function resolveTestSpecs( return result; } -const globOutput = Deno.args.length - ? expandGlobSync(Deno.args[0]) - : expandGlobSync( - "docs/smoke-all/**/*.{qmd,ipynb}", - ); - await initYamlIntelligenceResourcesFromFilesystem(); -for ( - const { path: fileName } of globOutput -) { +// Ideally we'd just walk the one single glob here, +// but because smoke-all.test.ts ends up being called +// from a number of different places (including different shell +// scripts run under a variety of shells), it's +// actually non-trivial to guarantee that we'll see a single +// unexpanded glob pattern. So we assume that a pattern +// might have already been expanded here, and we also +// accommodate cases where it hasn't been expanded. +// +// (Do note that this means that files that don't exist will +// be silently ignored.) +const files: WalkEntry[] = []; +if (Deno.args.length === 0) { + files.push(...expandGlobSync("docs/smoke-all/**/*.{qmd,ipynb}")); +} else { + for (const arg of Deno.args) { + files.push(...expandGlobSync(arg)); + } +} + +for (const { path: fileName } of files) { const input = relative(Deno.cwd(), fileName); const metadata = input.endsWith("qmd") diff --git a/tests/test-deps.ts b/tests/test-deps.ts index 2ee50cb71e0..eec2f83af97 100644 --- a/tests/test-deps.ts +++ b/tests/test-deps.ts @@ -1,4 +1,6 @@ import _bounds from "binary-search-bounds"; import _asserts from "testing/asserts.ts"; +import * as _slimdom from "slimdom"; +import * as _xpath from "fontoxpath"; // import { serve } from "http/server.ts"; // import { serveDir } from "http/file_server.ts"; diff --git a/tests/timing-for-ci.txt b/tests/timing-for-ci.txt index d92d0b49936..43277191c9f 100644 --- a/tests/timing-for-ci.txt +++ b/tests/timing-for-ci.txt @@ -1,604 +1,903 @@ ./integration/guess-chunk-options-format-document.test.ts - 3.19 real 3.34 user 0.40 sys + 3.68 real 3.84 user 0.44 sys ./integration/mermaid/github-issue-1340.test.ts - 3.84 real 4.00 user 0.43 sys + 4.35 real 4.36 user 0.62 sys ./integration/playwright-tests.test.ts - 84.63 real 68.77 user 8.97 sys + 86.40 real 73.67 user 10.71 sys ./smoke/authors/author-name.test.ts - 7.72 real 7.47 user 1.29 sys + 8.79 real 8.30 user 1.52 sys ./smoke/book/render-book.test.ts - 30.53 real 29.49 user 3.20 sys + 36.87 real 34.88 user 4.05 sys ./smoke/convert/convert-empty-frontmatter.test.ts - 2.06 real 2.31 user 0.24 sys + 2.36 real 2.47 user 0.29 sys ./smoke/create/create.test.ts - 39.53 real 42.33 user 3.78 sys + 44.21 real 45.63 user 5.20 sys ./smoke/crossref/chapters.test.ts - 3.19 real 2.54 user 0.22 sys + 3.43 real 2.73 user 0.32 sys ./smoke/crossref/docx.test.ts - 1.70 real 2.02 user 0.17 sys + 1.87 real 2.12 user 0.25 sys ./smoke/crossref/equations.test.ts - 2.16 real 2.56 user 0.22 sys + 2.38 real 2.66 user 0.37 sys ./smoke/crossref/figures.test.ts - 67.01 real 59.33 user 2.92 sys + 73.46 real 63.74 user 3.70 sys ./smoke/crossref/latex.test.ts - 1.67 real 2.00 user 0.17 sys + 1.95 real 2.24 user 0.25 sys ./smoke/crossref/listings.test.ts - 2.14 real 2.54 user 0.20 sys + 2.40 real 2.69 user 0.33 sys ./smoke/crossref/options.test.ts - 2.69 real 3.11 user 0.33 sys + 3.06 real 3.41 user 0.43 sys ./smoke/crossref/sections.test.ts - 2.15 real 2.53 user 0.21 sys + 2.37 real 2.73 user 0.26 sys ./smoke/crossref/syntax.test.ts - 3.29 real 3.66 user 0.42 sys + 3.71 real 4.01 user 0.55 sys ./smoke/crossref/tables.test.ts - 5.42 real 5.51 user 0.67 sys + 6.17 real 6.15 user 0.90 sys ./smoke/crossref/thereoms.test.ts - 2.72 real 3.24 user 0.27 sys + 3.03 real 3.39 user 0.40 sys ./smoke/crossref/unresolved.test.ts - 2.15 real 2.47 user 0.26 sys + 2.38 real 2.72 user 0.29 sys ./smoke/directives/include-fixups.test.ts - 0.03 real 0.02 user 0.01 sys + 0.03 real 0.01 user 0.02 sys ./smoke/embed/render-embed.test.ts - 5.01 real 5.19 user 0.73 sys + 5.79 real 5.85 user 0.82 sys ./smoke/engine/include-engine-detection.test.ts - 3.34 real 3.57 user 0.40 sys + 3.81 real 3.93 user 0.53 sys ./smoke/env/check.test.ts - 8.54 real 7.95 user 1.05 sys + 9.68 real 8.74 user 1.43 sys ./smoke/env/install.test.ts - 0.81 real 0.45 user 0.10 sys + 0.85 real 0.52 user 0.13 sys ./smoke/extensions/extension-render-doc.test.ts - 5.54 real 5.85 user 0.70 sys + 6.27 real 6.42 user 0.90 sys ./smoke/extensions/extension-render-journals.test.ts - 96.24 real 84.02 user 6.88 sys + 97.94 real 89.66 user 7.44 sys ./smoke/extensions/extension-render-project.test.ts - 2.96 real 3.44 user 0.40 sys + 3.35 real 3.79 user 0.47 sys ./smoke/extensions/extension-render-reveal.test.ts - 3.64 real 3.02 user 0.46 sys + 4.24 real 3.40 user 0.66 sys ./smoke/extensions/install.test.ts - 4.53 real 3.67 user 0.65 sys + 4.61 real 3.71 user 0.77 sys ./smoke/filters/editor-support.test.ts - 2.02 real 1.69 user 0.39 sys + 2.37 real 1.95 user 0.47 sys ./smoke/filters/filters.test.ts - 3.94 real 4.27 user 0.48 sys + 4.53 real 4.69 user 0.67 sys ./smoke/jats/render-jats.test.ts - 2.13 real 2.41 user 0.31 sys + 2.44 real 2.75 user 0.34 sys ./smoke/jats/render-manuscript.test.ts - 4.19 real 3.76 user 0.50 sys + 4.53 real 4.11 user 0.70 sys ./smoke/manuscript/render-manuscript.test.ts - 44.93 real 37.86 user 4.60 sys + 68.32 real 57.58 user 8.83 sys ./smoke/ojs/complex-layout.test.ts - 3.24 real 3.53 user 0.40 sys + 3.60 real 3.91 user 0.46 sys ./smoke/ojs/dependency-traversal.test.ts - 2.49 real 2.85 user 0.22 sys + 2.75 real 3.02 user 0.33 sys ./smoke/project/project-book.test.ts - 8.03 real 8.31 user 0.77 sys + 9.54 real 9.77 user 0.90 sys ./smoke/project/project-simple.test.ts - 2.31 real 2.76 user 0.24 sys + 2.60 real 2.90 user 0.39 sys ./smoke/project/project-stdout.test.ts - 2.41 real 2.87 user 0.25 sys + 2.70 real 3.10 user 0.30 sys ./smoke/project/project-website.test.ts - 2.41 real 2.83 user 0.31 sys + 2.75 real 3.11 user 0.43 sys ./smoke/render/render-bibio.test.ts - 2.02 real 2.32 user 0.27 sys + 2.34 real 2.62 user 0.29 sys ./smoke/render/render-callout.test.ts - 2.81 real 3.24 user 0.37 sys + 3.28 real 3.61 user 0.53 sys ./smoke/render/render-citeproc.test.ts - 2.15 real 2.48 user 0.26 sys + 2.41 real 2.72 user 0.30 sys ./smoke/render/render-code-highlighting.test.ts - 3.54 real 3.64 user 0.51 sys + 3.91 real 4.21 user 0.42 sys ./smoke/render/render-code-tools.test.ts - 6.92 real 6.83 user 0.93 sys + 7.66 real 7.58 user 1.19 sys ./smoke/render/render-commonmark.test.ts - 24.77 real 21.12 user 1.32 sys + 28.71 real 22.93 user 1.77 sys ./smoke/render/render-date.test.ts - 4.75 real 5.07 user 0.60 sys + 5.12 real 5.24 user 0.77 sys ./smoke/render/render-docx.test.ts - 3.60 real 3.90 user 0.43 sys + 4.01 real 4.19 user 0.60 sys ./smoke/render/render-format-extension.test.ts - 39.08 real 36.09 user 3.70 sys + 42.00 real 38.40 user 4.90 sys ./smoke/render/render-freeze.test.ts - 11.07 real 10.60 user 1.42 sys + 12.47 real 11.72 user 1.85 sys ./smoke/render/render-jupyter.test.ts - 6.71 real 6.90 user 0.57 sys + 7.70 real 7.79 user 0.63 sys ./smoke/render/render-latex-output.test.ts - 3.55 real 3.82 user 0.32 sys + 4.08 real 4.14 user 0.60 sys ./smoke/render/render-minimal.test.ts - 1.69 real 2.09 user 0.19 sys + 1.91 real 2.22 user 0.26 sys ./smoke/render/render-ojs.test.ts - 2.51 real 2.86 user 0.26 sys + 2.80 real 3.13 user 0.32 sys ./smoke/render/render-page-layout.test.ts - 15.35 real 15.63 user 0.81 sys + 17.53 real 17.77 user 0.98 sys ./smoke/render/render-pdf.test.ts - 127.98 real 113.90 user 9.76 sys + 137.87 real 126.16 user 12.06 sys ./smoke/render/render-plain.test.ts - 3.13 real 3.47 user 0.39 sys + 3.47 real 3.80 user 0.46 sys ./smoke/render/render-r.test.ts - 10.18 real 9.91 user 1.19 sys + 11.26 real 10.82 user 1.45 sys ./smoke/render/render-required.test.ts - 1.41 real 1.80 user 0.11 sys + 1.54 real 1.89 user 0.13 sys ./smoke/render/render-reveal.test.ts - 13.97 real 10.93 user 1.14 sys + 14.24 real 12.02 user 1.43 sys +./smoke/render/render-stdout.test.ts + 1.88 real 2.21 user 0.20 sys ./smoke/render/render-templates.test.ts - 51.43 real 43.60 user 4.14 sys + 51.57 real 47.22 user 4.90 sys ./smoke/render/render-title-block.test.ts - 3.74 real 3.99 user 0.64 sys + 4.18 real 4.35 user 0.68 sys ./smoke/run/stdlib-run-version.test.ts - 1.16 real 0.85 user 0.22 sys + 1.31 real 0.89 user 0.28 sys ./smoke/schema/load-yaml-schema-schema.test.ts - 0.03 real 0.02 user 0.01 sys + 0.04 real 0.02 user 0.01 sys ./smoke/scholar/render-scholar.test.ts - 4.06 real 4.32 user 0.57 sys + 4.52 real 4.60 user 0.77 sys ./smoke/shortcodes/shortcodes-core.test.ts - 5.77 real 6.00 user 0.74 sys + 7.53 real 6.44 user 1.09 sys ./smoke/site/render-blog.test.ts - 5.95 real 6.29 user 0.85 sys + 6.99 real 6.99 user 1.15 sys ./smoke/site/render-listings.test.ts - 6.04 real 6.14 user 0.92 sys + 7.29 real 7.17 user 1.12 sys ./smoke/site/render-navigation.test.ts - 4.51 real 4.01 user 0.47 sys + 3.94 real 4.34 user 0.57 sys ./smoke/site/render-shortcode-navbar.test.ts - 2.28 real 2.72 user 0.26 sys + 2.49 real 2.81 user 0.36 sys ./smoke/site/render-site-themes.test.ts - 53.22 real 48.52 user 7.23 sys + 59.15 real 53.85 user 8.89 sys ./smoke/site/render-site.test.ts - 2.63 real 3.06 user 0.39 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/inline-execution/inline-knitr.qmd - 3.43 real 3.67 user 0.41 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/inline-execution/inline-jupyter.qmd - 6.05 real 5.73 user 0.59 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/video/video-smoke-test.qmd - 2.28 real 2.67 user 0.28 sys + 3.02 real 3.39 user 0.43 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/simple/index.qmd + 2.57 real 3.03 user 0.34 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/simple/references.qmd + 2.49 real 2.97 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/simple/summary.qmd + 2.54 real 3.01 user 0.35 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/simple/intro.qmd + 2.53 real 2.95 user 0.35 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/index.qmd + 1.97 real 2.41 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/appendix-2.qmd + 1.89 real 2.24 user 0.22 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/code.qmd + 3.17 real 3.49 user 0.37 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/appendix-1.qmd + 1.90 real 2.30 user 0.21 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/references.qmd + 1.92 real 2.33 user 0.21 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/chap-1-2.qmd + 1.89 real 2.28 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/part-1.qmd + 1.85 real 2.20 user 0.21 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/chap-1-1.qmd + 1.94 real 2.26 user 0.24 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/formatting.qmd + 1.92 real 2.27 user 0.27 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/website/index.qmd - 2.26 real 2.66 user 0.28 sys + 2.47 real 2.81 user 0.36 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/website/about.qmd - 2.23 real 2.63 user 0.25 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/lua/6215/test.qmd - 2.10 real 2.54 user 0.21 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/knitr/inline-code-execution/new-syntax.qmd - 3.60 real 3.90 user 0.39 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/jupyter/inline-execution-jupyter.qmd - 6.34 real 5.91 user 0.67 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/issues/3473-toc-side-body/left.qmd - 2.24 real 2.63 user 0.25 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/issues/3473-toc-side-body/left-body.qmd - 2.23 real 2.67 user 0.22 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/issues/3473-toc-side-body/right.qmd - 2.21 real 2.57 user 0.24 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/issues/3473-toc-side-body/right-body.qmd - 2.23 real 2.68 user 0.21 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/issues/3473-toc-side-body/body.qmd - 2.25 real 2.72 user 0.22 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/issues/4820-giscus-dark-mode/darkly-default/index.qmd - 2.77 real 2.94 user 0.31 sys + 2.46 real 2.86 user 0.33 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/issues/4820-giscus-dark-mode/lightly-light-cobalt/index.qmd - 2.83 real 3.00 user 0.31 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/issues/4820-giscus-dark-mode/lightly-cobalt_only/index.qmd - 2.82 real 3.08 user 0.24 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/issues/4820-giscus-dark-mode/lightly-default/index.qmd - 2.87 real 3.04 user 0.28 sys + 3.02 real 3.23 user 0.31 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/issues/4820-giscus-dark-mode/darkly-light-dark/index.qmd - 2.89 real 3.05 user 0.27 sys + 3.04 real 3.23 user 0.34 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/issues/4820-giscus-dark-mode/darkly-light-cobalt/index.qmd - 2.87 real 2.98 user 0.32 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/confluence/5814-confluence-figure-sizing-is-ignored.qmd - 1.61 real 1.99 user 0.16 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/confluence/confluence-smoke-test.qmd - 4.76 real 5.21 user 0.36 sys + 3.04 real 3.23 user 0.41 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/issues/4820-giscus-dark-mode/darkly-default/index.qmd + 3.05 real 3.13 user 0.38 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/issues/4820-giscus-dark-mode/lightly-cobalt_only/index.qmd + 3.12 real 3.20 user 0.39 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/issues/4820-giscus-dark-mode/lightly-default/index.qmd + 2.98 real 3.21 user 0.42 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/issues/3473-toc-side-body/body.qmd + 2.45 real 2.80 user 0.30 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/issues/3473-toc-side-body/right-body.qmd + 2.43 real 2.74 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/issues/3473-toc-side-body/left.qmd + 2.43 real 2.81 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/issues/3473-toc-side-body/right.qmd + 2.44 real 2.76 user 0.33 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/issues/3473-toc-side-body/left-body.qmd + 2.43 real 2.80 user 0.29 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/31/callout-inner-content/callout-filter-test.qmd + 2.37 real 2.66 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/31/include-notebook/plots.ipynb + 3.15 real 3.29 user 0.53 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/31/include-notebook/embed-sub.qmd + 3.12 real 3.47 user 0.49 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/31/include-notebook/embed.qmd + 3.10 real 3.53 user 0.40 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/31/include-notebook/subfolder/plots.ipynb + 3.17 real 3.44 user 0.43 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/12/test-customformat-2.qmd + 1.83 real 2.17 user 0.21 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/12/test-customformat.qmd + 1.85 real 2.20 user 0.20 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/06/issue-2228.qmd + 2.28 real 2.68 user 0.28 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/14/google-scholar-project/index.qmd + 2.52 real 2.92 user 0.39 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/14/google-scholar-project/about.qmd + 2.54 real 2.95 user 0.38 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/14/invalid-highlight-theme.qmd + 3.64 real 2.90 user 0.36 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/11/issue-2765.qmd + 2.29 real 2.68 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/30/author-crossref-conditions/crossref.qmd + 2.41 real 2.69 user 0.34 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/30/author-crossref-conditions/author.qmd + 2.31 real 2.64 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/30/caption-footnotes/test.qmd + 18.23 real 17.06 user 1.52 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/30/crossref-false/crossref-false.qmd + 2.28 real 2.57 user 0.35 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/30/custom-writer-emulation/customwriter-yaml.qmd + 1.82 real 2.18 user 0.21 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/29/ast-roundtrip-test.qmd + 7.41 real 7.51 user 0.73 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/29/hello.qmd + 7.07 real 7.26 user 0.49 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/12/9/jats/computations.ipynb + 3.26 real 3.48 user 0.45 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/12/9/jats/example.qmd + 4.31 real 4.51 user 0.51 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/12/12/code-annotation.qmd + 4.99 real 5.26 user 0.51 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/22/annote/test.qmd + 4.87 real 5.11 user 0.54 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/17/3359a.qmd + 6.54 real 6.38 user 0.53 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/17/3359b.qmd + 8.89 real 8.77 user 0.75 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/19/kbd-test.qmd + 7.12 real 7.29 user 0.62 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/18/mermaid-themes/3328.qmd + 2.49 real 2.89 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/15/callout-icon-test.qmd + 2.41 real 2.75 user 0.30 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/14/3310.qmd + 2.35 real 2.68 user 0.33 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/01/3126.qmd + 6.30 real 6.36 user 0.46 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/29/callout-constructor.qmd + 2.46 real 2.77 user 0.35 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/code-annotations/code-annotations-none.qmd + 2.70 real 3.08 user 0.42 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/lst-cap-in-jupyter-cells.qmd + 13.28 real 11.48 user 1.59 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-subfloat-1.qmd + 1.81 real 2.13 user 0.22 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-1.qmd + 2.93 real 3.19 user 0.42 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-lst-cap-location-1.qmd + 1.87 real 2.21 user 0.24 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-jupyter-2.qmd + 6.23 real 5.66 user 0.94 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-2.qmd + 1.79 real 2.07 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-5.qmd + 1.80 real 2.14 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-jupyter-1.qmd + 6.11 real 5.59 user 0.81 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-table-captions-1.qmd + 2.96 real 3.17 user 0.42 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-1.qmd + 1.81 real 2.09 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/rawtablecaption.qmd + 1.83 real 2.16 user 0.22 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-options-1.qmd + 1.80 real 2.07 user 0.24 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-caption-formatting-1.qmd + 1.84 real 2.15 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-listings-1.qmd + 1.87 real 2.25 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-knitr-2.qmd + 2.94 real 3.19 user 0.41 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-numbering-1.qmd + 1.85 real 2.21 user 0.22 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-6.qmd + 1.80 real 2.14 user 0.21 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-4.qmd + 1.87 real 2.25 user 0.21 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/asciidoc/asciidoc-float-3.qmd + 1.83 real 2.10 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-float-2.qmd + 2.07 real 2.29 user 0.30 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-float-caption-formatting-1.qmd + 1.98 real 2.18 user 0.29 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-jupyter-2.qmd + 6.30 real 5.88 user 0.87 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-knitr-1.qmd + 3.18 real 3.20 user 0.50 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-knitr-2.qmd + 3.04 real 3.17 user 0.45 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-float-6.qmd + 1.96 real 2.16 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-listings-1.qmd + 1.92 real 2.20 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-float-1.qmd + 1.92 real 2.14 user 0.30 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-float-5.qmd + 1.96 real 2.27 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-float-4.qmd + 1.99 real 2.33 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-lst-cap-location-1.qmd + 1.97 real 2.28 user 0.24 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/rawtablecaption.qmd + 1.88 real 2.18 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-subfloat-1.qmd + 2.02 real 2.28 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-jupyter-1.qmd + 6.31 real 5.67 user 0.96 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-knitr-table-captions-1.qmd + 3.02 real 3.17 user 0.47 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-float-numbering-1.qmd + 2.07 real 2.35 user 0.30 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-float-3.qmd + 2.01 real 2.32 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/typst/typst-float-options-1.qmd + 1.96 real 2.27 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-simple-figure.qmd + 1.97 real 2.22 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-float-options-1.qmd + 1.90 real 2.23 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-knitr-2.qmd + 3.26 real 3.40 user 0.46 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-float-2.qmd + 2.14 real 2.51 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-float-4.qmd + 2.12 real 2.50 user 0.19 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-float-numbering-1.qmd + 2.01 real 2.43 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-listings-1.qmd + 1.87 real 2.20 user 0.24 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-knitr-table-captions-1.qmd + 5.71 real 3.67 user 0.43 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-jupyter-1.qmd + 6.19 real 5.64 user 0.84 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-float-3.qmd + 2.13 real 2.44 user 0.29 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-subfloat-1.qmd + 1.91 real 2.25 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-jupyter-2.qmd + 6.34 real 5.91 user 0.84 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-lst-cap-location-1.qmd + 1.93 real 2.23 user 0.24 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/rawtablecaption.qmd + 2.38 real 2.75 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-float-5.qmd + 1.89 real 2.27 user 0.24 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-knitr-1.qmd + 3.28 real 3.50 user 0.44 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-float-1.qmd + 1.90 real 2.28 user 0.21 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/docx/docx-float-caption-formatting-1.qmd + 1.87 real 2.21 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-float-2.qmd + 1.90 real 2.24 user 0.20 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-jupyter-1.qmd + 6.52 real 5.88 user 0.91 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-float-1.qmd + 1.87 real 2.13 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-knitr-table-captions-1.qmd + 3.46 real 3.68 user 0.41 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-float-numbering-1.qmd + 1.97 real 2.34 user 0.22 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-float-options-1.qmd + 1.91 real 2.13 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-jupyter-2.qmd + 6.61 real 6.08 user 0.94 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-float-4.qmd + 1.93 real 2.28 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-float-caption-formatting-1.qmd + 1.89 real 2.18 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/rawtablecaption.qmd + 1.89 real 2.21 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-lst-cap-location-1.qmd + 1.87 real 2.18 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-knitr-2.qmd + 3.32 real 3.56 user 0.42 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-float-6.qmd + 1.87 real 2.21 user 0.22 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-listings-1.qmd + 1.90 real 2.21 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-float-5.qmd + 1.88 real 2.22 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-subfloat-1.qmd + 1.90 real 2.22 user 0.24 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-knitr-1.qmd + 3.30 real 3.44 user 0.44 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/jats/jats-float-3.qmd + 1.91 real 2.24 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-listings-1.qmd + 2.11 real 2.50 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-float-1.qmd + 2.12 real 2.51 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-float-caption-formatting-1.qmd + 2.13 real 2.50 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-table-captions-1.qmd + 3.88 real 4.16 user 0.47 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-float-numbering-1.qmd + 2.17 real 2.59 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-2.qmd + 3.29 real 3.53 user 0.44 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-jupyter-1.qmd + 6.72 real 6.11 user 0.95 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-jupyter-2.qmd + 6.77 real 6.26 user 1.03 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-float-2.qmd + 2.10 real 2.47 user 0.28 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-lst-cap-location-1.qmd + 2.16 real 2.40 user 0.33 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/rawtablecaption.qmd + 2.10 real 2.46 user 0.28 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-knitr-1.qmd + 3.91 real 4.09 user 0.53 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-float-3.qmd + 3.13 real 2.47 user 0.28 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-float-4.qmd + 2.13 real 2.46 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-float-options-1.qmd + 2.13 real 2.40 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-subfloat-1.qmd + 2.09 real 2.41 user 0.33 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/revealjs/revealjs-float-5.qmd + 2.02 real 2.40 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/multirow-layout.qmd + 2.49 real 2.84 user 0.30 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-jupyter-1.qmd + 6.75 real 6.14 user 0.97 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-float-6.qmd + 2.40 real 2.79 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-float-numbering-1.qmd + 2.42 real 2.77 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-float-3.qmd + 2.41 real 2.81 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-float-options-1.qmd + 2.42 real 2.75 user 0.35 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-knitr-1.qmd + 3.86 real 4.13 user 0.48 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-float-caption-formatting-1.qmd + 2.44 real 2.79 user 0.28 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-jupyter-2.qmd + 6.96 real 6.47 user 0.96 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-listings-1.qmd + 2.43 real 2.76 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-float-1.qmd + 3.40 real 2.68 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-lst-cap-location-1.qmd + 2.41 real 2.74 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-knitr-table-captions-1.qmd + 3.84 real 4.05 user 0.48 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-ojs-lst-cap.qmd + 2.81 real 3.10 user 0.35 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-knitr-2.qmd + 3.81 real 3.97 user 0.53 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/rawtablecaption.qmd + 2.43 real 2.81 user 0.28 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-float-5.qmd + 2.40 real 2.76 user 0.28 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-float-2.qmd + 2.41 real 2.76 user 0.30 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-subfloat-1.qmd + 2.45 real 2.80 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-float-4.qmd + 2.43 real 2.84 user 0.28 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/html/html-lst-and-fig-cell.qmd + 3.85 real 4.00 user 0.48 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-custom-categories.qmd + 6.33 real 6.44 user 0.41 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-float-numbering-1.qmd + 1.91 real 2.27 user 0.22 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-float-4.qmd + 1.88 real 2.21 user 0.24 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-jupyter-1.qmd + 6.28 real 5.72 user 0.84 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-knitr-table-captions-1.qmd + 3.31 real 3.49 user 0.41 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-lst-cap-location-1.qmd + 1.88 real 2.09 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-jupyter-2.qmd + 6.38 real 5.96 user 0.86 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-float-3.qmd + 1.87 real 2.19 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-listings-1.qmd + 1.88 real 2.21 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-longtable-fixup-test.qmd + 4.28 real 4.37 user 0.50 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-float-1.qmd + 1.90 real 2.22 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-knitr-2.qmd + 3.29 real 3.50 user 0.42 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-knitr-1.qmd + 3.22 real 3.38 user 0.40 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-float-2.qmd + 1.89 real 2.26 user 0.19 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-margin-figure.qmd + 6.29 real 5.83 user 0.90 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-float-options-1.qmd + 1.87 real 2.25 user 0.18 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-subfloat-1.qmd + 1.88 real 2.19 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/latex/latex-float-5.qmd + 1.86 real 2.16 user 0.21 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/lst-cap-in-r-cells.qmd + 6.44 real 6.43 user 0.99 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/crossrefs/float/fig-cap.qmd + 2.41 real 2.77 user 0.31 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/confluence/confluence-cross-refs.qmd - 2.97 real 3.22 user 0.32 sys + 3.35 real 3.61 user 0.40 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/confluence/5814-confluence-figure-sizing-is-ignored.qmd + 1.81 real 2.17 user 0.20 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/confluence/5815-confluence-links-to-file-attachments-not-supported.qmd - 2.17 real 2.55 user 0.26 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/confluence/confluence-hello-world.qmd - 1.64 real 2.03 user 0.16 sys + 2.36 real 2.70 user 0.28 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/confluence/4489-exeblocks-lang-value-confluence.qmd - 6.03 real 5.64 user 0.63 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/code-annotations/code-annotations-none.qmd - 2.37 real 2.85 user 0.29 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/11/5507.qmd - 2.19 real 2.65 user 0.23 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/03/5368.qmd - 2.17 real 2.58 user 0.23 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/03/5189.qmd - 2.25 real 2.67 user 0.29 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/30/shortcode-table-dataqmd.qmd - 2.21 real 2.65 user 0.25 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/25/escaped-shortcode-in-code.qmd - 2.09 real 2.46 user 0.25 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/25/callout-missing-title.qmd - 2.17 real 2.63 user 0.19 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/24/5661-html.qmd - 2.20 real 2.66 user 0.19 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/24/5657-raw.qmd - 2.32 real 2.77 user 0.26 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/24/unshortcode.qmd - 2.11 real 2.54 user 0.23 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/09/5472.qmd - 2.11 real 2.51 user 0.23 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/15/5536-codefilename-beamer.qmd - 5.73 real 5.76 user 0.52 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/01/5377.qmd - 2.21 real 2.60 user 0.25 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/16/empty-data-qmd.qmd - 6.37 real 6.71 user 0.44 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/16/5534.qmd - 2.14 real 2.53 user 0.27 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/08/30/6658.qmd - 3.45 real 3.80 user 0.34 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/08/22/issue-6584.qmd - 2.14 real 2.60 user 0.20 sys + 6.59 real 6.01 user 0.89 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/confluence/confluence-hello-world.qmd + 1.81 real 2.11 user 0.21 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/confluence/confluence-smoke-test.qmd + 5.23 real 5.51 user 0.56 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/conditional-content/meta.qmd + 2.44 real 2.81 user 0.28 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/lightbox/options.qmd +Command exited with non-zero status 1 + 5.06 real 5.30 user 0.45 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/lightbox/pandoc-figure.qmd + 2.39 real 2.67 user 0.33 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/lightbox/plot-layout.qmd + 3.84 real 4.08 user 0.56 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/lightbox/plot.qmd + 3.74 real 3.99 user 0.41 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/lightbox/example.qmd +Command exited with non-zero status 1 + 5.02 real 5.25 user 0.48 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/lightbox/lightbox-off.qmd + 5.60 real 5.84 user 0.48 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/lightbox/lightbox-explicit.qmd +Command exited with non-zero status 1 + 5.03 real 5.21 user 0.44 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/typst/typst-citeproc.qmd + 1.82 real 2.18 user 0.22 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/typst/typst-no-citeproc.qmd + 1.81 real 2.09 user 0.29 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/jats/computations.ipynb + 3.10 real 3.29 user 0.43 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/jats/basic.qmd + 2.02 real 2.42 user 0.27 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/knitr/inline-code-execution/new-syntax.qmd + 3.95 real 4.23 user 0.48 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/knitr/embed-verbatim-engine/knitr-embed-verbatim.qmd + 5.59 real 5.72 user 0.70 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/knitr/embed-verbatim-engine/revealjs-knitr-embed-verbatim.qmd + 3.60 real 3.87 user 0.42 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/knitr/execute-options.qmd + 3.53 real 3.80 user 0.47 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/lua/6215/test.qmd + 2.34 real 2.72 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/format/html/code-links-root.qmd + 2.45 real 2.77 user 0.33 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/format/html/code-links-manual.qmd + 2.44 real 2.79 user 0.34 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/format/html/code-links.auto.qmd + 2.64 real 2.93 user 0.34 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/video/video-smoke-test.qmd + 2.48 real 2.84 user 0.26 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/08/22/asciidoc-test.qmd - 1.66 real 2.09 user 0.13 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/28/remote-resources.qmd - 2.31 real 2.73 user 0.24 sys + 1.81 real 2.21 user 0.19 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/08/22/issue-6584.qmd + 2.31 real 2.72 user 0.28 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/08/30/6658.qmd + 3.77 real 3.95 user 0.53 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/08/revealjs-hash-number.qmd - 1.85 real 2.25 user 0.21 sys + 1.97 real 2.35 user 0.27 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/08/issue-3683.qmd - 4.36 real 4.44 user 0.53 sys + 4.70 real 4.85 user 0.61 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/08/revealjs-hash-number-pandoc-style.qmd - 1.79 real 2.17 user 0.26 sys + 1.94 real 2.31 user 0.23 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/08/issue-4710.qmd - 3.52 real 3.87 user 0.36 sys + 3.78 real 4.02 user 0.49 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/03/issue-4621.qmd - 3.55 real 3.79 user 0.40 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/03/article-layout/table-endnotes-4324.qmd - 5.69 real 5.89 user 0.36 sys + 3.79 real 4.03 user 0.50 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/03/article-layout/tabs-callouts-3280.qmd - 2.20 real 2.57 user 0.28 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/30/issue-5031.qmd - 1.65 real 2.05 user 0.16 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/30/5044.qmd - 2.22 real 2.62 user 0.26 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/29/5011.qmd - 17.10 real 15.41 user 1.14 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/24/3152.qmd - 6.12 real 5.72 user 0.63 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/knitr/embed-verbatim-engine/revealjs-knitr-embed-verbatim.qmd - 3.34 real 3.54 user 0.42 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/17/4867.qmd - 1.70 real 2.14 user 0.14 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/01/issue-4568.qmd - 2.97 real 3.24 user 0.35 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/01/issue-4586.qmd - 2.27 real 2.71 user 0.30 sys + 2.46 real 2.83 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/03/article-layout/table-endnotes-4324.qmd + 6.38 real 6.57 user 0.35 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/02/issue-4402.qmd + 3.59 real 3.80 user 0.52 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/22/gha-toc-4917.qmd - 1.64 real 2.05 user 0.14 sys + 1.77 real 2.08 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/17/4867.qmd + 1.86 real 2.20 user 0.21 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/24/3152.qmd + 6.47 real 5.87 user 0.88 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/07/issue-2997.qmd + 2.46 real 2.86 user 0.30 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/07/callout-footnote.qmd + 1.85 real 2.19 user 0.22 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/28/remote-resources.qmd + 2.45 real 2.72 user 0.34 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/30/5044.qmd + 2.43 real 2.76 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/30/issue-5031.qmd + 1.83 real 2.23 user 0.20 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/14/issue-4748.qmd - 7.92 real 7.85 user 0.54 sys + 8.72 real 8.66 user 0.66 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/14/issue-1093.qmd - 6.82 real 6.98 user 0.45 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/02/issue-4402.qmd - 3.31 real 3.63 user 0.36 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/07/callout-footnote.qmd - 1.69 real 2.10 user 0.16 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/07/issue-2997.qmd - 2.27 real 2.71 user 0.21 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/06/21/index.qmd - 2.58 real 2.95 user 0.26 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/06/12/ojs-local-ts-import.qmd - 3.17 real 3.89 user 0.32 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/06/13/5902.qmd - 2.12 real 2.51 user 0.21 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/06/07/issue-5783.qmd - 1.80 real 2.22 user 0.20 sys + 7.87 real 7.79 user 0.59 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/01/issue-4586.qmd + 2.44 real 2.77 user 0.38 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/01/issue-4568.qmd + 3.29 real 3.46 user 0.42 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/03/29/5011.qmd + 9.34 real 9.38 user 0.49 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/25/issue-4316.qmd + 4.25 real 4.49 user 0.53 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/08/4272.qmd + 4.15 real 4.49 user 0.43 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/22/generated-bib.qmd + 3.69 real 3.93 user 0.56 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/22/no-cite-as.qmd + 2.46 real 2.78 user 0.36 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/22/cite-as-only.qmd + 2.46 real 2.79 user 0.35 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/09/tutorial.ipynb + 3.50 real 4.07 user 0.40 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/24/issue-4423.qmd + 2.51 real 2.85 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/05/4200.qmd + 6.44 real 6.62 user 0.45 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/05/4200-1.qmd + 1.93 real 2.29 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/13/dot-bug.qmd + 2.48 real 3.05 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/01/4174.qmd + 2.44 real 2.83 user 0.29 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/01/3085-r.qmd + 5.00 real 5.10 user 0.58 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/09/08/knitr-quarto-tools-env.qmd + 3.06 real 3.28 user 0.43 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/09/14/confluence-cross-refs.qmd + 2.04 real 2.32 user 0.23 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/09/14/6833.qmd + 2.45 real 2.74 user 0.37 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/27/mergetablehtml.qmd - 2.19 real 2.64 user 0.20 sys + 2.38 real 2.72 user 0.35 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/27/5316.qmd - 1.66 real 2.05 user 0.17 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/11/format_underscores.qmd - 2.09 real 2.53 user 0.22 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/20/callout-test.qmd - 2.20 real 2.62 user 0.22 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/24/format-links.qmd - 2.27 real 2.70 user 0.24 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/24/5286.qmd - 1.71 real 2.09 user 0.18 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/06/5112.qmd - 1.62 real 2.01 user 0.17 sys + 1.85 real 2.12 user 0.28 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/26/issue-5317.qmd - 2.19 real 2.57 user 0.26 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/18/test-caption.qmd - 2.23 real 2.63 user 0.26 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/04/issue-5084.qmd - 4.85 real 4.32 user 0.41 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/04/ojs_define.qmd - 3.61 real 3.95 user 0.34 sys + 2.40 real 2.67 user 0.33 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/24/5286.qmd + 1.90 real 2.25 user 0.22 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/24/format-links.qmd + 2.45 real 2.77 user 0.32 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/04/5089.qmd - 6.15 real 5.96 user 0.34 sys + 6.72 real 6.55 user 0.52 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/04/ojs_define.qmd + 3.95 real 4.18 user 0.50 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/04/issue-5084.qmd + 5.35 real 4.77 user 0.44 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/18/test-caption.qmd + 2.46 real 2.86 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/06/5112.qmd + 1.81 real 2.07 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/20/callout-test.qmd + 2.37 real 2.67 user 0.30 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/01/5060.qmd - 1.96 real 2.36 user 0.16 sys + 2.23 real 2.48 user 0.26 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/04/11/format_underscores.qmd + 2.29 real 2.61 user 0.30 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/25/escaped-shortcode-in-code.qmd + 2.33 real 2.61 user 0.33 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/25/callout-missing-title.qmd + 2.46 real 2.86 user 0.33 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/03/5189.qmd + 2.48 real 2.93 user 0.35 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/03/5368.qmd + 2.39 real 2.76 user 0.29 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/09/5472.qmd + 2.32 real 2.65 user 0.28 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/24/unshortcode.qmd + 2.33 real 2.71 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/24/5657-raw.qmd + 2.55 real 2.92 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/24/5661-html.qmd + 2.41 real 2.82 user 0.29 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/15/5536-codefilename-beamer.qmd + 6.39 real 6.28 user 0.68 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/30/shortcode-table-dataqmd.qmd + 2.48 real 2.86 user 0.29 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/30/crossrefs-dataqmd.qmd + 2.42 real 2.79 user 0.29 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/01/5377.qmd + 2.35 real 2.63 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/11/5507.qmd + 2.38 real 2.71 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/16/5534.qmd + 2.31 real 2.67 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/05/16/empty-data-qmd.qmd + 7.24 real 7.50 user 0.51 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/10/6153.qmd + 2.47 real 2.97 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/03/table-colwidths.qmd + 3.81 real 3.97 user 0.54 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/17/echo-fenced-annotation.qmd + 3.72 real 3.98 user 0.48 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/31/4057.qmd + 3.81 real 4.04 user 0.52 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/24/code-annotation-exec-only.qmd + 3.75 real 4.03 user 0.46 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/24/code-annotation-false.qmd + 8.20 real 8.32 user 0.72 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/18/6237.qmd + 1.86 real 2.20 user 0.24 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/28/6367.qmd + 5.31 real 4.84 user 0.72 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/20/issue-6289.qmd + 4.44 real 4.69 user 0.53 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/06/21/index.qmd + 2.85 real 3.14 user 0.35 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/06/12/ojs-local-ts-import.qmd + 3.41 real 3.99 user 0.42 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/06/07/issue-5783.qmd + 1.98 real 2.26 user 0.30 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/06/13/5902.qmd + 2.32 real 2.70 user 0.27 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/27/asciidoc-video.qmd - 1.65 real 2.10 user 0.11 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/20/asciidoc.qmd - 1.65 real 2.02 user 0.17 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/20/test-quarto-disable-processing.qmd - 2.09 real 2.50 user 0.23 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/05/content-hidden.qmd - 2.20 real 2.67 user 0.18 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/05/notebook-preview-complex.qmd - 4.45 real 4.83 user 0.49 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/05/plots.ipynb - 2.89 real 3.22 user 0.34 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/05/pdf-remote-image.qmd - 5.94 real 5.86 user 0.36 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/05/notebook-preview-simple.qmd - 4.43 real 4.67 user 0.63 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/31/asciidoc-kbd.qmd - 1.71 real 2.03 user 0.19 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/31/asciidoc-theorems.qmd - 1.67 real 2.05 user 0.18 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/31/css-code-annotation.qmd - 3.30 real 3.62 user 0.39 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/03/code-annote-latex.qmd - 1.70 real 2.08 user 0.17 sys + 1.86 real 2.18 user 0.24 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/03/code-annote.ipynb - 2.94 real 3.25 user 0.35 sys + 3.22 real 3.52 user 0.39 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/03/code-annote-simple.qmd - 5.87 real 6.06 user 0.50 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/03/code-annote-hover.qmd - 2.26 real 2.64 user 0.27 sys + 6.52 real 6.50 user 0.66 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/03/issue-3833.qmd - 2.14 real 2.61 user 0.18 sys + 2.33 real 2.63 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/03/code-annote-hover.qmd + 2.46 real 2.75 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/03/code-annote-latex.qmd + 1.92 real 2.26 user 0.23 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/03/code-annote-select.qmd - 2.27 real 2.70 user 0.26 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/23/table-options.qmd - 2.23 real 2.62 user 0.26 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/23/reveal-config-quote-4063.qmd - 1.80 real 2.21 user 0.22 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/12/knitr-options-yaml.qmd - 3.65 real 3.99 user 0.35 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/13/lua-raw-html.qmd - 2.22 real 2.59 user 0.27 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/24/4073.qmd - 6.27 real 5.78 user 0.70 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/19/2107-2.qmd - 6.85 real 6.45 user 0.63 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/19/2107.qmd - 6.77 real 6.25 user 0.72 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/06/issue-3872.qmd - 2.21 real 2.56 user 0.30 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/06/test-inner-content.qmd - 2.21 real 2.65 user 0.20 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/06/test-filters.qmd - 2.14 real 2.61 user 0.20 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/06/input-relative/test/index.qmd - 2.29 real 2.79 user 0.24 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/09/gfm-callout.qmd - 1.63 real 2.04 user 0.15 sys + 2.46 real 2.79 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/02/citation-true.qmd + 2.75 real 3.11 user 0.44 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/09/file_1.ipynb - 3.10 real 3.44 user 0.42 sys + 3.38 real 3.69 user 0.47 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/09/gfm-callout.qmd + 1.79 real 2.06 user 0.25 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/17/format-variants.qmd + 20.04 real 19.69 user 1.14 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/17/online-image-mediabag.qmd + 10.16 real 10.26 user 0.45 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/31/asciidoc-theorems.qmd + 1.95 real 2.34 user 0.22 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/31/css-code-annotation.qmd + 5.86 real 3.92 user 0.52 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/31/asciidoc-kbd.qmd + 1.88 real 2.23 user 0.21 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/26/4068.qmd - 3.54 real 3.83 user 0.37 sys + 3.91 real 4.12 user 0.51 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/26/4034.qmd + 2.86 real 3.17 user 0.36 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/26/asciidoc-annotated-code.qmd - 1.63 real 2.03 user 0.15 sys + 1.82 real 2.18 user 0.23 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/26/asciidoc-callout.qmd - 1.63 real 2.02 user 0.17 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/26/4034.qmd - 2.58 real 2.84 user 0.32 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/18/3159.qmd - 2.10 real 2.54 user 0.22 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/17/online-image-mediabag.qmd - 9.97 real 9.83 user 0.45 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/17/format-variants.qmd - 16.83 real 16.66 user 0.86 sys + 1.81 real 2.18 user 0.19 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/24/4073.qmd + 6.64 real 6.04 user 0.77 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/19/2107.qmd + 7.37 real 6.72 user 0.94 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/19/2107-2.qmd + 7.35 real 6.80 user 0.87 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/04/issue-3847.qmd - 2.10 real 2.56 user 0.18 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/16/code-annote-none.qmd - 3.98 real 3.79 user 0.41 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/16/md-captions.qmd - 4.70 real 4.94 user 0.56 sys + 2.30 real 2.65 user 0.33 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/18/3159.qmd + 2.29 real 2.61 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/05/pdf-remote-image.qmd + 6.65 real 6.49 user 0.41 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/05/content-hidden.qmd + 2.45 real 2.79 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/05/plots.ipynb + 3.25 real 3.45 user 0.51 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/05/notebook-preview-complex.qmd + 5.00 real 5.20 user 0.73 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/05/notebook-preview-simple.qmd + 5.03 real 5.26 user 0.66 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/12/knitr-options-yaml.qmd + 4.07 real 4.23 user 0.49 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/23/table-options.qmd + 2.44 real 2.81 user 0.29 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/23/reveal-config-quote-4063.qmd + 2.00 real 2.33 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/06/test-filters.qmd + 2.31 real 2.70 user 0.30 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/06/test-inner-content.qmd + 2.42 real 2.76 user 0.31 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/06/input-relative/test/index.qmd + 2.57 real 2.85 user 0.34 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/06/issue-3872.qmd + 2.48 real 2.79 user 0.33 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/13/lua-raw-html.qmd + 2.38 real 2.69 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/20/asciidoc.qmd + 1.83 real 2.22 user 0.20 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/20/test-quarto-disable-processing.qmd + 2.30 real 2.75 user 0.27 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/16/main.qmd - 2.09 real 2.54 user 0.19 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/16/code-annote-two-cells.qmd - 3.56 real 3.84 user 0.40 sys + 2.29 real 2.62 user 0.32 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/16/code-annote-none.qmd + 3.89 real 4.07 user 0.52 sys ./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/16/code-annote-select.qmd - 3.63 real 3.91 user 0.41 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/02/citation-true.qmd - 2.49 real 2.98 user 0.30 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/05/4200-1.qmd - 1.70 real 2.13 user 0.18 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/05/4200.qmd - 5.43 real 5.64 user 0.36 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/08/4272.qmd - 3.81 real 4.18 user 0.31 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/25/issue-4316.qmd - 3.87 real 4.20 user 0.39 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/13/dot-bug.qmd - 2.26 real 2.84 user 0.29 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/24/issue-4423.qmd - 2.22 real 2.60 user 0.28 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/09/tutorial.ipynb - 3.06 real 3.74 user 0.31 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/01/4174.qmd - 2.22 real 2.60 user 0.27 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/01/3085-r.qmd - 4.41 real 4.69 user 0.38 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/22/no-cite-as.qmd - 2.28 real 2.75 user 0.20 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/22/generated-bib.qmd - 3.93 real 3.71 user 0.44 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/02/22/cite-as-only.qmd - 2.30 real 2.77 user 0.28 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/20/issue-6289.qmd - 4.01 real 4.34 user 0.40 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/31/4057.qmd - 3.39 real 3.69 user 0.39 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/28/6367.qmd - 4.76 real 4.44 user 0.46 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/03/table-colwidths.qmd - 3.47 real 3.80 user 0.37 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/24/code-annotation-false.qmd - 6.98 real 7.20 user 0.61 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/24/code-annotation-exec-only.qmd - 3.42 real 3.80 user 0.28 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/18/6237.qmd - 1.67 real 2.07 user 0.15 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/17/echo-fenced-annotation.qmd - 3.31 real 3.64 user 0.36 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2023/07/10/6153.qmd - 2.16 real 2.69 user 0.20 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/typst/typst-citeproc.qmd - 1.63 real 1.89 user 0.24 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/typst/typst-no-citeproc.qmd - 1.62 real 1.96 user 0.16 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/formatting.qmd - 1.75 real 2.22 user 0.17 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/code.qmd - 2.85 real 3.17 user 0.31 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/references.qmd - 1.69 real 2.12 user 0.19 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/index.qmd - 1.71 real 2.17 user 0.15 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/chap-1-2.qmd - 1.71 real 2.18 user 0.12 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/chap-1-1.qmd - 1.73 real 2.19 user 0.15 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/appendix-2.qmd - 1.71 real 2.16 user 0.15 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/part-1.qmd - 1.71 real 2.19 user 0.14 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/htmlbook/appendix-1.qmd - 1.71 real 2.14 user 0.19 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/simple/references.qmd - 2.35 real 2.78 user 0.25 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/simple/index.qmd - 2.33 real 2.82 user 0.25 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/simple/summary.qmd - 2.30 real 2.81 user 0.24 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/book/simple/intro.qmd - 2.33 real 2.88 user 0.21 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/jats/computations.ipynb - 2.89 real 3.26 user 0.29 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/jats/basic.qmd - 1.86 real 2.34 user 0.17 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/conditional-content/meta.qmd - 2.23 real 2.65 user 0.24 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/29/callout-constructor.qmd - 2.22 real 2.62 user 0.22 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/19/kbd-test.qmd - 6.09 real 6.42 user 0.45 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/15/callout-icon-test.qmd - 2.19 real 2.65 user 0.19 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/18/mermaid-themes/3328.qmd - 2.23 real 2.68 user 0.22 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/17/3359b.qmd - 8.24 real 8.11 user 0.59 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/17/3359a.qmd - 5.70 real 5.78 user 0.48 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/01/3126.qmd - 5.41 real 5.65 user 0.31 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/22/annote/test.qmd - 4.44 real 4.66 user 0.46 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/11/14/3310.qmd - 2.12 real 2.51 user 0.27 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/12/9/jats/computations.ipynb - 2.88 real 3.17 user 0.35 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/12/9/jats/example.qmd - 3.70 real 4.03 user 0.33 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/12/12/code-annotation.qmd - 4.45 real 4.65 user 0.45 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/30/custom-writer-emulation/customwriter-yaml.qmd - 1.65 real 2.03 user 0.17 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/30/author-crossref-conditions/author.qmd - 2.10 real 2.52 user 0.24 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/30/author-crossref-conditions/crossref.qmd - 2.19 real 2.60 user 0.23 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/30/caption-footnotes/test.qmd - 8.09 real 8.36 user 0.38 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/30/crossref-false/crossref-false.qmd - 2.09 real 2.51 user 0.21 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/29/hello.qmd - 6.06 real 6.32 user 0.41 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/09/29/ast-roundtrip-test.qmd - 6.34 real 6.64 user 0.56 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/11/issue-2765.qmd - 2.11 real 2.53 user 0.23 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/31/include-notebook/subfolder/plots.ipynb - 2.89 real 3.22 user 0.33 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/31/include-notebook/embed.qmd - 2.76 real 3.30 user 0.31 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/31/include-notebook/embed-sub.qmd - 2.77 real 3.19 user 0.37 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/31/include-notebook/plots.ipynb - 2.90 real 3.24 user 0.32 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/31/callout-inner-content/callout-filter-test.qmd - 2.24 real 2.70 user 0.21 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/12/test-customformat-2.qmd - 1.65 real 2.04 user 0.18 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/12/test-customformat.qmd - 1.64 real 1.96 user 0.21 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/06/issue-2228.qmd - 2.11 real 2.54 user 0.21 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/14/google-scholar-project/index.qmd - 2.29 real 2.78 user 0.30 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/14/google-scholar-project/about.qmd - 2.29 real 2.76 user 0.28 sys -./smoke/smoke-all.test.ts -- docs/smoke-all/2022/10/14/invalid-highlight-theme.qmd - 2.36 real 2.79 user 0.27 sys + 3.85 real 4.14 user 0.48 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/16/code-annote-two-cells.qmd + 3.88 real 4.07 user 0.56 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/2023/01/16/md-captions.qmd + 5.26 real 5.50 user 0.67 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/inline-execution/inline-jupyter.qmd + 6.74 real 6.13 user 0.88 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/inline-execution/inline-knitr.qmd + 3.81 real 3.98 user 0.51 sys +./smoke/smoke-all.test.ts -- docs/smoke-all/jupyter/inline-execution-jupyter.qmd + 7.06 real 6.53 user 0.84 sys ./smoke/yaml-intelligence/yaml-intelligence-folded-block-strings.test.ts - 1.34 real 1.65 user 0.15 sys + 1.44 real 1.79 user 0.17 sys ./smoke/yaml-intelligence/yaml-intelligence.test.ts - 1.44 real 1.84 user 0.13 sys + 1.53 real 1.94 user 0.15 sys ./smoke/yaml/core-yaml-dashes.test.ts - 1.73 real 2.06 user 0.24 sys + 1.94 real 2.23 user 0.30 sys ./unit/binary-search.test.ts - 0.46 real 0.38 user 0.08 sys + 0.51 real 0.41 user 0.11 sys ./unit/break-quarto-md/break-quarto-md.test.ts - 1.47 real 1.85 user 0.15 sys + 1.59 real 2.01 user 0.17 sys ./unit/confluence/confluence.test.ts - 0.56 real 0.47 user 0.10 sys + 0.63 real 0.48 user 0.14 sys ./unit/environment.test.ts - 0.46 real 0.40 user 0.06 sys + 0.50 real 0.39 user 0.12 sys ./unit/filter-paths.test.ts - 0.47 real 0.42 user 0.06 sys + 0.50 real 0.40 user 0.10 sys ./unit/giscus.test.ts - 0.47 real 0.40 user 0.07 sys + 0.50 real 0.39 user 0.12 sys ./unit/guess-chunk-options-format.test.ts - 0.46 real 0.38 user 0.09 sys + 0.50 real 0.40 user 0.10 sys ./unit/mapped-strings/mapped-text.test.ts - 0.48 real 0.42 user 0.07 sys + 0.52 real 0.45 user 0.08 sys ./unit/mapped-strings/multiple-source.test.ts - 0.46 real 0.36 user 0.10 sys + 0.50 real 0.40 user 0.10 sys ./unit/pandoc-formats.test.ts - 0.46 real 0.38 user 0.09 sys + 0.50 real 0.42 user 0.09 sys ./unit/pandoc-partition.test.ts - 0.47 real 0.41 user 0.05 sys + 0.50 real 0.42 user 0.08 sys ./unit/pandoc.test.ts - 0.45 real 0.39 user 0.07 sys + 0.50 real 0.37 user 0.14 sys ./unit/partition-cell-options.test.ts - 1.34 real 1.67 user 0.11 sys + 1.45 real 1.73 user 0.15 sys ./unit/path.test.ts - 0.47 real 0.41 user 0.07 sys + 0.52 real 0.42 user 0.11 sys ./unit/paths/qualified-path.test.ts - 0.46 real 0.39 user 0.08 sys + 0.51 real 0.43 user 0.09 sys ./unit/schema-validation/error-location.test.ts - 0.46 real 0.36 user 0.11 sys + 0.50 real 0.41 user 0.10 sys ./unit/schema-validation/error-narrowing.test.ts - 1.48 real 1.90 user 0.12 sys + 1.55 real 1.88 user 0.20 sys ./unit/schema-validation/format-aliases.test.ts - 1.45 real 1.88 user 0.17 sys + 1.56 real 1.92 user 0.18 sys ./unit/schema-validation/format-execute.test.ts - 0.03 real 0.02 user 0.00 sys + 0.04 real 0.02 user 0.01 sys ./unit/schema-validation/format-pandoc-from-file-simple-tests.test.ts - 1.49 real 1.87 user 0.19 sys + 1.62 real 1.98 user 0.20 sys ./unit/schema-validation/hello-world.test.ts - 1.47 real 1.91 user 0.12 sys + 1.65 real 2.01 user 0.22 sys ./unit/schema-validation/object-super.test.ts - 1.45 real 1.91 user 0.10 sys + 1.58 real 2.06 user 0.14 sys ./unit/schema-validation/schema-completions.test.ts - 1.32 real 1.69 user 0.10 sys + 1.43 real 1.70 user 0.16 sys ./unit/schema-validation/schema-files.test.ts - 1.46 real 1.90 user 0.13 sys + 1.58 real 1.96 user 0.23 sys ./unit/schema-validation/schema-schema.test.ts - 3.88 real 4.32 user 0.51 sys + 4.39 real 4.68 user 0.71 sys ./unit/schema-validation/simple.test.ts - 1.45 real 1.92 user 0.09 sys + 1.62 real 1.96 user 0.21 sys ./unit/text.test.ts - 0.45 real 0.39 user 0.06 sys + 0.51 real 0.43 user 0.09 sys ./unit/yaml-intelligence/annotated-yaml.test.ts - 1.44 real 1.79 user 0.16 sys + 1.59 real 1.92 user 0.20 sys ./unit/yaml-intelligence/error-colon-no-space.test.ts - 1.46 real 1.85 user 0.16 sys + 1.55 real 1.87 user 0.20 sys ./unit/yaml-intelligence/hover-info.test.ts - 1.45 real 1.84 user 0.16 sys + 1.57 real 1.96 user 0.18 sys ./unit/yaml.test.ts - 1.45 real 1.89 user 0.16 sys + 1.56 real 1.92 user 0.17 sys diff --git a/tests/verify.ts b/tests/verify.ts index a00db08194f..fd3d0066a29 100644 --- a/tests/verify.ts +++ b/tests/verify.ts @@ -7,7 +7,9 @@ import { existsSync } from "fs/mod.ts"; import { DOMParser, NodeList } from "../src/core/deno-dom.ts"; import { assert } from "testing/asserts.ts"; -import { dirname, join } from "path/mod.ts"; +import { join } from "path/mod.ts"; +import { parseXmlDocument } from "slimdom"; +import xpath from "fontoxpath"; import { readYamlFromString } from "../src/core/yaml.ts"; @@ -154,6 +156,51 @@ export const directoryEmptyButFor = ( }; }; +// FIXME: do this properly without resorting on file having keep-typ +export const ensureTypstFileRegexMatches = ( + file: string, + matchesUntyped: (string | RegExp)[], + noMatchesUntyped?: (string | RegExp)[], +): Verify => { + const asRegexp = (m: string | RegExp) => { + if (typeof m === "string") { + return new RegExp(m); + } else { + return m; + } + }; + const matches = matchesUntyped.map(asRegexp); + const noMatches = noMatchesUntyped?.map(asRegexp); + return { + name: `Inspecting ${file} for Regex matches`, + verify: async (_output: ExecuteOutput[]) => { + const keptTyp = file.replace(".pdf", ".typ"); + const tex = await Deno.readTextFile(keptTyp); + + try { + // Move the docx to a temp dir and unzip it + matches.forEach((regex) => { + assert( + regex.test(tex), + `Required match ${String(regex)} is missing from file ${file}.`, + ); + }); + + if (noMatches) { + noMatches.forEach((regex) => { + assert( + !regex.test(tex), + `Illegal match ${String(regex)} was found in file ${file}.`, + ); + }); + } + } finally { + await Deno.remove(keptTyp); + } + }, + }; +}; + export const ensureHtmlElements = ( file: string, selectors: string[], @@ -220,12 +267,51 @@ export const ensureFileRegexMatches = ( }; }; -export const ensureDocxRegexMatches = ( - file: string, - regexes: (string | RegExp)[], -): Verify => { - return { - name: "Inspecting Docx for Regex matches", +export const verifyOdtDocument = ( + callback: (doc: string) => Promise, + name?: string, +): (file: string) => Verify => { + return (file: string) => ({ + name: name ?? "Inspecting Odt", + verify: async (_output: ExecuteOutput[]) => { + const [_dir, stem] = dirAndStem(file); + const temp = await Deno.makeTempDir(); + try { + // Move the docx to a temp dir and unzip it + const zipFile = join(temp, stem + ".zip"); + await Deno.rename(file, zipFile); + await unzip(zipFile); + + // Open the core xml document and match the matches + const docXml = join(temp, "content.xml"); + const xml = await Deno.readTextFile(docXml); + await callback(xml); + } finally { + await Deno.remove(temp, { recursive: true }); + } + }, + }); +}; + +export const verifyJatsDocument = ( + callback: (doc: string) => Promise, + name?: string, +): (file: string) => Verify => { + return (file: string) => ({ + name: name ?? "Inspecting Jats", + verify: async (_output: ExecuteOutput[]) => { + const xml = await Deno.readTextFile(file); + await callback(xml); + }, + }); +}; + +export const verifyDocXDocument = ( + callback: (doc: string) => Promise, + name?: string, +): (file: string) => Verify => { + return (file: string) => ({ + name: name ?? "Inspecting Docx", verify: async (_output: ExecuteOutput[]) => { const [_dir, stem] = dirAndStem(file); const temp = await Deno.makeTempDir(); @@ -238,22 +324,127 @@ export const ensureDocxRegexMatches = ( // Open the core xml document and match the matches const docXml = join(temp, "word", "document.xml"); const xml = await Deno.readTextFile(docXml); - regexes.forEach((regex) => { - if (typeof regex === "string") { - regex = new RegExp(regex); - } - assert( - regex.test(xml), - `Required DocX Element ${String(regex)} is missing.`, - ); - }); + await callback(xml); } finally { await Deno.remove(temp, { recursive: true }); } }, + }); +}; + +const xmlChecker = ( + selectors: string[], + noMatchSelectors?: string[], +): (xmlText: string) => Promise => { + return (xmlText: string) => { + const xmlDoc = parseXmlDocument(xmlText); + for (const selector of selectors) { + const xpathResult = xpath.evaluateXPath(selector, xmlDoc); + const passes = (!Array.isArray(xpathResult) && xpathResult !== null) || + (Array.isArray(xpathResult) && xpathResult.length > 0); + assert( + passes, + `Required XPath selector ${selector} returned empty array. Failing document follows:\n\n${xmlText}}`, + ); + } + for (const falseSelector of noMatchSelectors ?? []) { + const xpathResult = xpath.evaluateXPath(falseSelector, xmlDoc); + const passes = (!Array.isArray(xpathResult) && xpathResult !== null) || + (Array.isArray(xpathResult) && xpathResult.length > 0); + assert( + !passes, + `Illegal XPath selector ${falseSelector} returned non-empty array. Failing document follows:\n\n${xmlText}}`, + ); + } + return Promise.resolve(); }; }; +export const ensureJatsXpath = ( + file: string, + selectors: string[], + noMatchSelectors?: string[], +): Verify => { + return verifyJatsDocument( + xmlChecker(selectors, noMatchSelectors), + "Inspecting Jats for XPath selectors", + )(file); +}; + +export const ensureOdtXpath = ( + file: string, + selectors: string[], + noMatchSelectors?: string[], +): Verify => { + return verifyOdtDocument( + xmlChecker(selectors, noMatchSelectors), + "Inspecting Odt for XPath selectors", + )(file); +}; + +export const ensureDocxXpath = ( + file: string, + selectors: string[], + noMatchSelectors?: string[], +): Verify => { + return verifyDocXDocument( + xmlChecker(selectors, noMatchSelectors), + "Inspecting Docx for XPath selectors", + )(file); +}; + +export const ensureDocxRegexMatches = ( + file: string, + regexes: (string | RegExp)[], +): Verify => { + return verifyDocXDocument((xml) => { + regexes.forEach((regex) => { + if (typeof regex === "string") { + regex = new RegExp(regex); + } + assert( + regex.test(xml), + `Required DocX Element ${String(regex)} is missing.`, + ); + }); + return Promise.resolve(); + }, "Inspecting Docx for Regex matches")(file); +}; + +// export const ensureDocxRegexMatches = ( +// file: string, +// regexes: (string | RegExp)[], +// ): Verify => { +// return { +// name: "Inspecting Docx for Regex matches", +// verify: async (_output: ExecuteOutput[]) => { +// const [_dir, stem] = dirAndStem(file); +// const temp = await Deno.makeTempDir(); +// try { +// // Move the docx to a temp dir and unzip it +// const zipFile = join(temp, stem + ".zip"); +// await Deno.rename(file, zipFile); +// await unzip(zipFile); + +// // Open the core xml document and match the matches +// const docXml = join(temp, "word", "document.xml"); +// const xml = await Deno.readTextFile(docXml); +// regexes.forEach((regex) => { +// if (typeof regex === "string") { +// regex = new RegExp(regex); +// } +// assert( +// regex.test(xml), +// `Required DocX Element ${String(regex)} is missing.`, +// ); +// }); +// } finally { +// await Deno.remove(temp, { recursive: true }); +// } +// }, +// }; +// }; + export const ensurePptxRegexMatches = ( file: string, regexes: (string | RegExp)[], @@ -399,7 +590,7 @@ export const ensureXmlValidatesWithXsd = ( const result = await execProcess(runOptions); assert( result.success, - `Failed XSD Validation\n${result.stderr}`, + `Failed XSD Validation for file ${file}\n${result.stderr}`, ); } }, @@ -432,7 +623,6 @@ export const ensureMECAValidates = ( } else { console.log("npm not present, skipping MECA validation"); } - } }, }; diff --git a/tools/find-bad-imports.ts b/tools/find-bad-imports.ts new file mode 100644 index 00000000000..40b38fc1cf2 --- /dev/null +++ b/tools/find-bad-imports.ts @@ -0,0 +1,51 @@ +// find-bad-imports +// +// uses `deno info --json` to find all imports that are not in our +// standard format. + +const entryPoints = [ + "package/src/bld.ts", + "src/quarto.ts", +]; + +let foundBadImport = false; + +for (const entry of entryPoints) { + // this only works if you have deno installed! + const cmd = new Deno.Command("deno", { + args: ["info", "--json", entry], + stdout: "piped", + stderr: "piped", + }); + + const output = cmd.outputSync(); + + if (!output.success) { + console.log(new TextDecoder().decode(output.stderr)); + Deno.exit(1); + } + + const info = JSON.parse(new TextDecoder().decode(output.stdout)); + const modules = info.modules || []; + for (const module of modules) { + if ((module.local || "").match("src/vendor")) { + // don't analyze vendor code + continue; + } + for (const dep of module.dependencies || []) { + const code = dep.code || {}; + if (((code.specifier || "") as string).match("src/vendor")) { + foundBadImport = true; + console.log( + `Bad import in ${module.local}:${code.span.start.line + 1}(${ + code.span.start.character + 1 + }--${code.span.end.character + 1})`, + ); + } + } + } +} + +if (foundBadImport) { + Deno.exit(1); +}